@be-link/request 1.44.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.
- package/README.md +366 -20
- package/dist/application/clients/BeLinkClient.d.ts +75 -0
- package/dist/application/clients/BeLinkClient.d.ts.map +1 -0
- package/dist/application/clients/HttpClient.d.ts +64 -0
- package/dist/application/clients/HttpClient.d.ts.map +1 -0
- package/dist/application/clients/LiveClient.d.ts +15 -0
- package/dist/application/clients/LiveClient.d.ts.map +1 -0
- package/dist/application/interceptors/AuthInterceptor.d.ts +23 -0
- package/dist/application/interceptors/AuthInterceptor.d.ts.map +1 -0
- package/dist/application/interceptors/TimeInterceptor.d.ts +21 -0
- package/dist/application/interceptors/TimeInterceptor.d.ts.map +1 -0
- package/dist/application/interceptors/TokenInterceptor.d.ts +24 -0
- package/dist/application/interceptors/TokenInterceptor.d.ts.map +1 -0
- package/dist/application/services/UserInfoService.d.ts +33 -0
- package/dist/application/services/UserInfoService.d.ts.map +1 -0
- package/dist/cloudbase/index.d.ts +27 -0
- package/dist/cloudbase/index.d.ts.map +1 -0
- package/dist/cloudbase/types.d.ts +63 -0
- package/dist/cloudbase/types.d.ts.map +1 -0
- package/dist/core/constants/index.d.ts +59 -0
- package/dist/core/constants/index.d.ts.map +1 -0
- package/dist/core/errors/index.d.ts +42 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/interfaces/IConfigManager.d.ts +31 -0
- package/dist/core/interfaces/IConfigManager.d.ts.map +1 -0
- package/dist/core/interfaces/IEncryptionService.d.ts +28 -0
- package/dist/core/interfaces/IEncryptionService.d.ts.map +1 -0
- package/dist/core/interfaces/IHttpClient.d.ts +43 -0
- package/dist/core/interfaces/IHttpClient.d.ts.map +1 -0
- package/dist/core/interfaces/index.d.ts +4 -0
- package/dist/core/interfaces/index.d.ts.map +1 -0
- package/dist/core/types/config.types.d.ts +57 -0
- package/dist/core/types/config.types.d.ts.map +1 -0
- package/dist/core/types/index.d.ts +5 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/interceptor.types.d.ts +48 -0
- package/dist/core/types/interceptor.types.d.ts.map +1 -0
- package/dist/core/types/request.types.d.ts +65 -0
- package/dist/core/types/request.types.d.ts.map +1 -0
- package/dist/core/types/response.types.d.ts +29 -0
- package/dist/core/types/response.types.d.ts.map +1 -0
- package/dist/index.cjs.js +6266 -0
- package/dist/index.d.ts +39 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +6235 -0
- package/dist/infrastructure/adapters/AxiosAdapter.d.ts +47 -0
- package/dist/infrastructure/adapters/AxiosAdapter.d.ts.map +1 -0
- package/dist/infrastructure/services/ConfigManager.d.ts +52 -0
- package/dist/infrastructure/services/ConfigManager.d.ts.map +1 -0
- package/dist/infrastructure/services/EncryptionService.d.ts +34 -0
- package/dist/infrastructure/services/EncryptionService.d.ts.map +1 -0
- package/dist/infrastructure/services/TimeSyncService.d.ts +44 -0
- package/dist/infrastructure/services/TimeSyncService.d.ts.map +1 -0
- package/dist/infrastructure/utils/env.utils.d.ts +13 -0
- package/dist/infrastructure/utils/env.utils.d.ts.map +1 -0
- package/dist/presets/belink.preset.d.ts +4 -0
- package/dist/presets/belink.preset.d.ts.map +1 -0
- package/dist/presets/index.d.ts +4 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/live.preset.d.ts +4 -0
- package/dist/presets/live.preset.d.ts.map +1 -0
- package/dist/presets/request.preset.d.ts +9 -0
- package/dist/presets/request.preset.d.ts.map +1 -0
- package/package.json +37 -35
- package/dist/beLinkRequest.d.ts +0 -43
- package/dist/callFunction.d.ts +0 -36
- package/dist/config.d.ts +0 -5
- package/dist/createInit.d.ts +0 -14
- package/dist/index.js +0 -1
- 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";function r(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 o(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 i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(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 c={},u={},l={};Object.defineProperty(l,"__esModule",{value:!0}),l.COMMUNITY_SITE_URL=l.IS_DEBUG_MODE=l.getProtocol=l.setProtocol=l.getSdkName=l.setSdkName=void 0;var f="@cloudbase/js-sdk";l.setSdkName=function(e){f=e},l.getSdkName=function(){return f};var h="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";l.setProtocol=function(e){h=e},l.getProtocol=function(){return h},l.IS_DEBUG_MODE="development"===process.env.NODE_ENV,l.COMMUNITY_SITE_URL="https://support.qq.com/products/148793";var p={};Object.defineProperty(p,"__esModule",{value:!0}),p.ERRORS=void 0,p.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=i&&i.__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=i&&i.__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(l,e),n(p,e)}(u);var d,y={},g={};!function(e){e.local="local",e.none="none",e.session="session"}(d||(d={}));var v=function(){},_=function(){};function m(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 b=a(Object.freeze({__proto__:null,AbstractSDKRequest:v,AbstractStorage:_,get StorageType(){return d},formatUrl:m})),w={},E={exports:{}};var S,I={exports:{}};function O(){return S||(S=1,I.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!==i&&i.crypto&&(n=i.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}}(),s={},a=s.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=s.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=s.algo={};return s}(Math);return e}()),I.exports}var A,T={exports:{}};function N(){return A||(A=1,T.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}(O())),T.exports}var x,R={exports:{}};function P(){return x||(x=1,R.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))}})}(O())),R.exports}E.exports=function(e){return e.HmacSHA256}(O(),N(),P());var k,C=E.exports,L={exports:{}};function D(){return k||(k=1,L.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}(O())),L.exports}var j={exports:{}};j.exports=function(e){return e.enc.Utf8}(O());var U=j.exports,M=i&&i.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(w,"__esModule",{value:!0}),w.transformPhone=w.sleep=w.printGroupLog=w.throwError=w.printInfo=w.printError=w.printWarn=w.execCallback=w.createPromiseCallback=w.removeParam=w.getHash=w.getQuery=w.toQueryString=w.createSign=w.formatUrl=w.genSeqId=w.isFormData=w.isInstanceOf=w.isNull=w.isPalinObject=w.isUndefined=w.isString=w.isArray=void 0;var B=M(C),q=M(D()),W=M(U),F=u;function H(e){var t=q.default.stringify(e);return t=(t=(t=t.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}w.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},w.isString=function(e){return"string"==typeof e},w.isUndefined=function(e){return void 0===e},w.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},w.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},w.isInstanceOf=function(e,t){return e instanceof t},w.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},w.genSeqId=function(){return Math.random().toString(16).slice(2)},w.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)},w.createSign=function(e,t){var n=H(W.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"}))),r=H(W.default.parse(JSON.stringify(e))),o="".concat(n,".").concat(r),i=H((0,B.default)(o,t));return"".concat(o,".").concat(i)},w.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("&")},w.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]:""};w.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]".concat(e,"=([^&#]*)")));return t?t[1]:""},w.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},w.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},w.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},w.printWarn=function(e,t){console.warn("[".concat((0,F.getSdkName)(),"][").concat(e,"]:").concat(t))},w.printError=function(e,t){console.error({code:e,msg:"[".concat((0,F.getSdkName)(),"][").concat(e,"]:").concat(t)})},w.printInfo=function(e,t){console.log("[".concat((0,F.getSdkName)(),"][").concat(e,"]:").concat(t))},w.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,F.getSdkName)(),"][").concat(e,"]:").concat(t)}))},w.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()};w.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},w.transformPhone=function(e){return"+86".concat(e)};var $,G=i&&i.__extends||($=function(e,t){return $=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)},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}$(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),K=i&&i.__assign||function(){return K=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},K.apply(this,arguments)},V=i&&i.__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())}))},J=i&&i.__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(g,"__esModule",{value:!0}),g.WebRequest=g.genAdapter=void 0;var z=w,Y=l,X=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 G(t,e),t.prototype.get=function(e){return this._request(K(K({},e),{method:"get"}),this._restrictedMethods.includes("get"))},t.prototype.post=function(e){return this._request(K(K({},e),{method:"post"}),this._restrictedMethods.includes("post"))},t.prototype.put=function(e){return this._request(K(K({},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(K(K({},e),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},t.prototype.download=function(e){return V(this,void 0,void 0,(function(){var t,n,r,o;return J(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(K(K({},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,z.formatUrl)((0,Y.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,z.isFormData)(l)?l:"application/x-www-form-urlencoded"===u["content-type"]?(0,z.toQueryString)(l):p||(l?JSON.stringify(l):void 0),h&&(g.withCredentials=!0),g.send(s)}))},t}(b.AbstractSDKRequest);g.WebRequest=X,g.genAdapter=function(){return{root:window,reqClass:X,wsClass:WebSocket,localStorage:localStorage,sessionStorage:sessionStorage}},function(e){var t=i&&i.__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=i&&i.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=i&&i.__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,s=r(g),a=w;!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:s.genAdapter(),runtime:o.WEB}}}(y);var Z={},Q=i&&i.__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)}}(),ee=i&&i.__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())}))},te=i&&i.__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(Z,"__esModule",{value:!0}),Z.CloudbaseCache=void 0;var ne=w,re=u,oe=function(e){function t(t){var n=e.call(this)||this;return n._root=t,t.tcbCacheObject||(t.tcbCacheObject={}),n}return Q(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}(b.AbstractStorage);function ie(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:((0,ne.printWarn)(re.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new oe(t.root));case"none":return new oe(t.root);case"session":return t.sessionStorage?t.sessionStorage:((0,ne.printWarn)(re.ERRORS.INVALID_PARAMS,"sessionStorage is not supported on current platform"),new oe(t.root))}}var se=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=ie(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=ie(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,ne.isUndefined)(i)||(0,ne.isNull)(i)||(n.setItem(o,i),this._storage.removeItem(o))}}this._storage=n}}else(0,ne.printWarn)(re.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use updatePersistenceAsync insteed")},e.prototype.updatePersistenceAsync=function(e){return ee(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,c,u;return te(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=ie(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,ne.isUndefined)(u)||(0,ne.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:re.ERRORS.OPERATION_FAIL,msg:"[".concat((0,re.getSdkName)(),"][").concat(re.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,ne.printWarn)(re.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,n){return ee(this,void 0,void 0,(function(){var r;return te(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,ne.printWarn)(re.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var n;return ee(this,void 0,void 0,(function(){var r;return te(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,ne.printWarn)(re.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return ee(this,void 0,void 0,(function(){return te(this,(function(t){switch(t.label){case 0:return[4,this._storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}();Z.CloudbaseCache=se;var ae={},ce=i&&i.__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)}}(),ue=i&&i.__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(ae,"__esModule",{value:!0}),ae.removeEventListener=ae.activateEvent=ae.addEventListener=ae.CloudbaseEventEmitter=ae.IErrorEvent=ae.CloudbaseEvent=void 0;var le=w;var fe=function(e,t){this.data=t||null,this.name=e};ae.CloudbaseEvent=fe;var he=function(e){function t(t,n){var r=e.call(this,"error",{error:t,data:n})||this;return r.error=t,r}return ce(t,e),t}(fe);ae.IErrorEvent=he;var pe=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,le.isInstanceOf)(e,he))return console.error(e.error),this;var n=(0,le.isString)(e)?new fe(e,t||{}):e,r=n.name;if(this._listens(r)){n.target=this;for(var o=0,i=this._listeners[r]?ue([],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}();ae.CloudbaseEventEmitter=pe;var de=new pe;ae.addEventListener=function(e,t){de.on(e,t)},ae.activateEvent=function(e,t){void 0===t&&(t={}),de.fire(e,t)},ae.removeEventListener=function(e,t){de.off(e,t)};var ye={},ge={},ve=i&&i.__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())}))},_e=i&&i.__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(ge,"__esModule",{value:!0}),ge.catchErrorsDecorator=void 0;var me=w,be=u,we=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(we=-1!==navigator.userAgent.indexOf("Firefox"));var Ee=we?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,Se=/https?\:\/\/.+\:\d*\/.*\.js\:\d+\:\d+/;function Ie(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=we?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]\\s*\\(.*\\)$")),c=we?/^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(Se,o)),(i=new Error).stack="".concat(we?"@debugger":"Error","\n").concat(l.join("\n"))}return i}ge.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(be.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 Ee.test(e)}));if(-1!==r){var o=Se.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=Ie({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,me.printGroupLog)(f),r}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ve(this,void 0,void 0,(function(){var t,n,r,o,f,h;return _e(this,(function(p){switch(p.label){case 0:t=Ie({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,me.printGroupLog)(f),r;case 4:return[2]}}))}))}}}},function(e){var t=i&&i.__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=i&&i.__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(ge,e)}(ye);var Oe=i&&i.__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]}),Ae=i&&i.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Te=i&&i.__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)&&Oe(t,e,n);return Ae(t,e),t};Object.defineProperty(c,"__esModule",{value:!0});var Ne=c.helpers=c.utils=c.events=c.cache=c.adapters=c.constants=void 0,xe=Te(u),Re=c.constants=xe,Pe=Te(y),ke=c.adapters=Pe,Ce=Te(Z),Le=c.cache=Ce,De=Te(ae),je=c.events=De,Ue=Te(w),Me=c.utils=Ue,Be=Te(ye);Ne=c.helpers=Be;var qe=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)}}(),We=function(){return We=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},We.apply(this,arguments)},Fe=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())}))},He=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 $e=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 qe(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:m("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 Fe(t,void 0,void 0,(function(){var t,o,i,s,a,c;return He(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:We({},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:m("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}(v),Ge={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()}},Ke=function(e,t){void 0===t&&(t={});var n=wx.connectSocket(We({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 Ve={genAdapter:function(){return{root:{},reqClass:$e,wsClass:Ke,localStorage:Ge,primaryStorage:d.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"},Je=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))},ze=Re.ERRORS,Ye={};function Xe(e,t){var n=t.name,r=t.namespace,o=t.entity,i=t.injectEvents,s=t.IIFE,a=void 0!==s&&s;if(Ye[n]||r&&e[r])throw new Error(JSON.stringify({code:ze.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(a){if(!o||"function"!=typeof o)throw new Error(JSON.stringify({code:ze.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));o.call(e)}if(Ye[n]=t,r?e.prototype[r]=o:Ze(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=Je(Je([],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 Ze(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]=Ze(e[n],t[n]));return e}var Qe={},et=function(){return et=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},et.apply(this,arguments)},tt=Le.CloudbaseCache,nt={},rt={};function ot(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)};nt[t]?nt[t].updatePersistence(n):nt[t]=new tt(et(et({},e),{keys:o,platformInfo:r,alwaysLocalKeys:["anonymousUuidKey"]})),rt[t]=rt[t]||new tt(et(et({},e),{keys:o,platformInfo:r,persistence:"local"}))}function it(e){return nt[e]}function st(e){return rt[e]}var at=Re.setSdkName,ct=Re.setProtocol,ut="",lt="@cloudbase/js-sdk";var ft,ht="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:",pt="undefined"!=typeof process&&"e2e"===process.env.NODE_ENV&&"pre"===process.env.END_POINT?"//tcb-pre.tencentcloudapi.com/web":"//tcb-api.tencentcloudapi.com/web";function dt(e,t){pt=e,t&&(ht=t,ct(t))}function yt(){return{BASE_URL:pt,PROTOCOL:ht}}!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.CUSTOM="CUSTOM",e.NULL="NULL"}(ft||(ft={}));var gt="loginStateExpire",vt="refreshAccessToken",_t=function(){return _t=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},_t.apply(this,arguments)},mt=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())}))},bt=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])}}},wt=Re.ERRORS,Et=Me.genSeqId,St=Me.isFormData,It=Me.formatUrl,Ot=Me.createSign,At=ke.RUNTIME,Tt=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function Nt(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(St(s))for(var e in o)s.append(e,o[e]);else t.data=_t(_t({},s),o)}(),t.headers=_t(_t({},t.headers||{}),i),r.call(e,t)}}function xt(){var e=Et();return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(ut),"x-seqid":e}}}var Rt=function(){function e(e){this._throwWhenRequestFail=!1,this.config=e,this._reqClass=new Qe.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=it(this.config.env),this._localCache=st(this.config.env),Nt(this._reqClass,"post",[xt]),Nt(this._reqClass,"upload",[xt]),Nt(this._reqClass,"download",[xt])}return e.prototype.post=function(e){return mt(this,void 0,void 0,(function(){return bt(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 mt(this,void 0,void 0,(function(){return bt(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 mt(this,void 0,void 0,(function(){return bt(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 mt(this,void 0,void 0,(function(){var e,t,n;return bt(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 mt(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a,c;return bt(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:wt.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 mt(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 bt(this,(function(x){switch(x.label){case 0:return r="x-tcb-trace_".concat(this.config.env),o="application/x-www-form-urlencoded",i=_t({action:e,dataVersion:"2020-01-10",env:this.config.env},t),-1!==Tt.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),Qe.runtime!==At.WEB&&(h=this.config,p=h.appSign,d=h.appSecret,y=Date.now(),g=d.appAccessKey,v=d.appAccessKeyId,_=Ot({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=_t(_t({},b),E)),S=yt(),I=S.BASE_URL,O=S.PROTOCOL,A=It(O,I,E),w&&(A+=w),[4,this.post(_t({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={}),mt(this,void 0,void 0,(function(){var n;return bt(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!==Tt.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:wt.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),mt(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,c,u,l,f,h,p;return bt(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:wt.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()===ft.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:wt.OPERATION_FAIL,message:"重试获取 refresh token 失败"}));case 9:return Jt.fire(gt),[4,this._cache.removeStoreAsync(o)];case 10:d.sent(),d.label=11;case 11:throw new Error(JSON.stringify({code:wt.NETWORK_ERROR,msg:"refresh access_token failed:".concat(u.data.code)}));case 12:return u.data.access_token?(Jt.fire(vt),[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 mt(this,void 0,void 0,(function(){var t,n,r,o;return bt(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}(),Pt={};var kt=function(){return kt=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},kt.apply(this,arguments)},Ct=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},Lt=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Dt=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())}))},jt=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])}}},Ut=ke.useAdapters,Mt=ke.useDefaultAdapter,Bt=ke.RUNTIME,qt=Re.ERRORS,Wt=Re.COMMUNITY_SITE_URL,Ft=Me.printWarn,Ht=Ne.catchErrorsDecorator,$t={timeout:15e3,persistence:"local"},Gt=6e5,Kt={},Vt=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 Qe},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return it(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return st(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return e=this._config.env,Pt[e];var e},enumerable:!1,configurable:!0}),e.prototype.init=function(t){if(!t.env)throw new Error(JSON.stringify({code:qt.INVALID_PARAMS,msg:"env must not be specified"}));if(Qe.adapter||this._useDefaultAdapter(),this.requestClient=new Qe.adapter.reqClass({timeout:t.timeout||5e3,timeoutMsg:"[".concat(lt,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(t.timeout/1e3,"s")}),Qe.runtime!==Bt.WEB){if(!t.appSecret)throw new Error(JSON.stringify({code:qt.INVALID_PARAMS,msg:"invalid appSecret"}));var n=Qe.adapter.getAppSign?Qe.adapter.getAppSign():"";if(t.appSign&&n&&t.appSign!==n)throw new Error(JSON.stringify({code:qt.INVALID_PARAMS,msg:"invalid appSign"}));if(n&&(t.appSign=n),!t.appSign)throw new Error(JSON.stringify({code:qt.INVALID_PARAMS,msg:"invalid appSign"}))}this._config=kt(kt({},$t),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;ot({env:o,persistence:i,debug:s,platformInfo:this.platform}),function(e){Pt[e.env]=new Rt(_t(_t({},e),{throw:!0}))}({env:o,region:t.region||"",timeout:a,appSecret:c,appSign:u}),t.region&&function(e,t,n){dt(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,ot({env:this._config.env,persistence:t,debug:n,platformInfo:this.platform})},e.prototype.registerExtension=function(e){Kt[e.name]=e},e.prototype.invokeExtension=function(e,t){return Dt(this,void 0,void 0,(function(){var n;return jt(this,(function(r){switch(r.label){case 0:if(!(n=Kt[e]))throw new Error(JSON.stringify({code:qt.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=Ut(e)||{},n=t.adapter,r=t.runtime;n&&(Qe.adapter=n),r&&(Qe.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:ze.INVALID_OPERATION,msg:"target:".concat(r," is not exist")}));var o=e.prototype[r];if("function"!=typeof o)throw new Error(JSON.stringify({code:ze.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,Je([this],e,!1)),o.call.apply(o,Je([this],e,!1))}}(e,t)},e.prototype.registerComponent=function(t){Xe(e,t)},e.prototype.registerVersion=function(e){!function(e){ut=e}(e)},e.prototype.registerSdkName=function(e){!function(e){lt=e,at(e)}(e)},e.prototype.registerEndPoint=function(e,t){dt(e,t)},e.prototype._useDefaultAdapter=function(){var e=Mt(),t=e.adapter,n=e.runtime;Qe.adapter=t,Qe.runtime=n},e.prototype._formatTimeout=function(e){switch(!0){case e>Gt:return Ft(qt.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),Gt;case e<100:return Ft(qt.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},Ct([Ht({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv2/adapter.html#jie-ru-liu-cheng)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Wt)]}),Lt("design:type",Function),Lt("design:paramtypes",[Object]),Lt("design:returntype",e)],e.prototype,"init",null),Ct([Ht({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Wt)]}),Lt("design:type",Function),Lt("design:paramtypes",[String,Object]),Lt("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}(),Jt=new Vt;Jt.useAdapters(Ve);var zt,Yt=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())}))},Xt=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])}}},Zt=function(){function e(e){this._config=e,this._cache=e.cache,this._request=e.request}return e.prototype.checkLocalLoginState=function(){return Yt(this,void 0,void 0,(function(){var e,t,n,r,o,i;return Xt(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 Dr({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 Yt(this,void 0,void 0,(function(){var t,n,r,o;return Xt(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 Yt(this,void 0,void 0,(function(){var n,r,o;return Xt(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 Yt(this,void 0,void 0,(function(){var e;return Xt(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 Yt(this,void 0,void 0,(function(){var t;return Xt(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"}(zt||(zt={}));var Qt=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)}}(),en=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},tn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},nn=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())}))},rn=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])}}},on=Re.getSdkName,sn=Re.ERRORS,an=Re.COMMUNITY_SITE_URL,cn=ke.RUNTIME,un=Me.getQuery,ln=Me.getHash,fn=Me.removeParam,hn=Me.printWarn,pn=Ne.catchErrorsDecorator,dn=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 Qt(t,e),t.prototype.signIn=function(){return nn(this,void 0,void 0,(function(){return rn(this,(function(e){return[2,hn(sn.OPERATION_FAIL,"API signIn has been deprecated, please use signInWithRedirect insteed")]}))}))},t.prototype.signInWithRedirect=function(){return nn(this,void 0,void 0,(function(){return rn(this,(function(e){return[2,this._redirect()]}))}))},t.prototype.getRedirectResult=function(e){return nn(this,void 0,void 0,(function(){var t;return rn(this,(function(n){return(t=yn())?[2,this._signInWithCode(t,e)]:[2,null]}))}))},t.prototype.getLinkRedirectResult=function(e){return void 0===e&&(e={}),nn(this,void 0,void 0,(function(){var t,n,r,o,i,s;return rn(this,(function(a){return s=e.withUnionId,t=void 0!==s&&s,(n=yn())?(r=this._appid,c=this._scope,o="snsapi_login"===c?"WECHAT-OPEN":"WECHAT-PUBLIC",i=this._runtime===cn.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=fn("code",location.href);e=fn("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(on(),"][").concat(sn.UNKOWN_ERROR,"]").concat(e))}},t.prototype._signInWithCode=function(e,t){return nn(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u;return rn(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 Cr.fire(Ur.LOGIN_STATE_CHANGED),Cr.fire(Ur.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:zt.WECHAT,persistence:this._config.persistence}),[4,this.refreshUserInfo()];case 7:return l.sent(),[4,(c=new Dr({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={}),nn(this,void 0,void 0,(function(){var o,i,s,a,c,u;return rn(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===cn.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(on(),"][").concat(sn.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(on(),"][").concat(sn.OPERATION_FAIL,"] action:getJwt not return refreshToken"))}))]}))}))},en([pn({title:"跳转微信公众号授权失败",messages:["请确认以下各项:"," 1 - 调用 auth().weixinAuthProvider().signInWithRedirect() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(an)]}),tn("design:type",Function),tn("design:paramtypes",[]),tn("design:returntype",Promise)],t.prototype,"signInWithRedirect",null),en([pn({title:"微信公众号登录失败",messages:["请确认以下各项:"," 1 - 调用 auth().weixinAuthProvider().getRedirectResult() 的语法或参数是否正确"," 2 - 当前环境是否开通了微信公众号登录授权"," 3 - 微信公众号的 AppId 与 AppSecret 配置是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(an)]}),tn("design:type",Function),tn("design:paramtypes",[Object]),tn("design:returntype",Promise)],t.prototype,"getRedirectResult",null),en([pn({title:"获取微信重定向绑定结果",messages:["请确认以下各项:"," 1 - 调用 auth().weixinAuthProvider().getLinkRedirectResult() 的语法或参数是否正确"," 2 - 当前环境是否开通了微信公众号登录授权"," 3 - 微信公众号的 AppId 与 AppSecret 配置是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(an)]}),tn("design:type",Function),tn("design:paramtypes",[Object]),tn("design:returntype",Promise)],t.prototype,"getLinkRedirectResult",null),t}(Zt);function yn(){return un("code")||ln("code")}var gn=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)}}(),vn=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},_n=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},mn=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())}))},bn=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])}}},wn=Re.ERRORS,En=Re.COMMUNITY_SITE_URL,Sn=Me.throwError,In=Me.isString,On=je.addEventListener,An=Ne.catchErrorsDecorator,Tn=function(e){function t(t){var n=e.call(this,t)||this;return n._onConverted=n._onConverted.bind(n),On(Ur.ANONYMOUS_CONVERTED,n._onConverted),n}return gn(t,e),t.prototype.signIn=function(){return mn(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return bn(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(),Cr.fire(Ur.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:zt.ANONYMOUS,persistence:"local"}),Cr.fire(Ur.LOGIN_STATE_CHANGED),[4,(i=new Dr({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:wn.OPERATION_FAIL,msg:JSON.stringify(o)||"anonymous signIn failed"}))}}))}))},t.prototype.linkAndRetrieveDataWithTicket=function(e){return mn(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return bn(this,(function(c){switch(c.label){case 0:return In(e)||Sn(wn.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(),Cr.fire(Ur.ANONYMOUS_CONVERTED,{env:this._config.env}),Cr.fire(Ur.LOGIN_TYPE_CHANGED,{loginType:zt.CUSTOM,persistence:"local"}),[4,(s=new Dr({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 7:return c.sent(),[2,s];case 8:return Sn(wn.OPERATION_FAIL,JSON.stringify(i)||"linkAndRetrieveDataWithTicket failed"),[2]}}))}))},t.prototype._setAnonymousUUID=function(e){return mn(this,void 0,void 0,(function(){var t,n,r;return bn(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,zt.ANONYMOUS)];case 3:return o.sent(),[2]}}))}))},t.prototype._clearAnonymousUUID=function(){return mn(this,void 0,void 0,(function(){return bn(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 mn(this,void 0,void 0,(function(){return bn(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]}}))}))},vn([An({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().anonymouseProvider().signIn() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(En)]}),_n("design:type",Function),_n("design:paramtypes",[]),_n("design:returntype",Promise)],t.prototype,"signIn",null),t}(Zt),Nn=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},Rn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Pn=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())}))},kn=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])}}},Cn=Re.ERRORS,Ln=Re.COMMUNITY_SITE_URL,Dn=Me.isString,jn=Ne.catchErrorsDecorator,Un=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Nn(t,e),t.prototype.signIn=function(e){return Pn(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return kn(this,(function(c){switch(c.label){case 0:if(!Dn(e))throw new Error(JSON.stringify({code:Cn.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(),Cr.fire(Ur.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:zt.CUSTOM,persistence:this._config.persistence}),Cr.fire(Ur.LOGIN_STATE_CHANGED),[4,this.refreshUserInfo()];case 5:return c.sent(),[4,(s=new Dr({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:Cn.OPERATION_FAIL,msg:"custom signIn failed"}))}}))}))},xn([jn({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().customAuthProvider().signIn() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Ln)]}),Rn("design:type",Function),Rn("design:paramtypes",[String]),Rn("design:returntype",Promise)],t.prototype,"signIn",null),t}(Zt),Mn=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)}}(),Bn=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},qn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Wn=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())}))},Fn=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])}}},Hn=Me.throwError,$n=Me.isString,Gn=Re.ERRORS,Kn=Re.COMMUNITY_SITE_URL,Vn=Ne.catchErrorsDecorator,Jn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Mn(t,e),t.prototype.signIn=function(e,t){return Wn(this,void 0,void 0,(function(){var n,r,o,i,s;return Fn(this,(function(a){switch(a.label){case 0:return $n(e)||Hn(Gn.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(),Cr.fire(Ur.LOGIN_STATE_CHANGED),Cr.fire(Ur.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:zt.EMAIL,persistence:this._config.persistence}),[2,new Dr({envId:this._config.env,cache:this._cache,request:this._request})];case 8:return r.code?Hn(Gn.OPERATION_FAIL,"Email login fail[".concat(r.code,"] ").concat(r.message)):Hn(Gn.OPERATION_FAIL,"Email login fail"),[2]}}))}))},t.prototype.signUp=function(e,t){return Wn(this,void 0,void 0,(function(){return Fn(this,(function(n){return[2,this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})]}))}))},t.prototype.resetPassword=function(e){return Wn(this,void 0,void 0,(function(){return Fn(this,(function(t){return[2,this._request.send("auth.sendPasswordResetEmail",{email:e})]}))}))},t.prototype.resetPasswordWithToken=function(e,t){return Wn(this,void 0,void 0,(function(){return Fn(this,(function(n){return[2,this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})]}))}))},t.prototype.activate=function(e){return Wn(this,void 0,void 0,(function(){return Fn(this,(function(t){return[2,this._request.send("auth.activateEndUserMail",{token:e})]}))}))},Bn([Vn({title:"邮箱密码登录失败",messages:["请确认以下各项:"," 1 - 调用 auth().emailAuthProvider() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录"," 3 - 邮箱地址与密码是否匹配","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Kn)]}),qn("design:type",Function),qn("design:paramtypes",[String,String]),qn("design:returntype",Promise)],t.prototype,"signIn",null),Bn([Vn({title:"邮箱注册失败",messages:["请确认以下各项:"," 1 - 调用 auth().signUpWithEmailAndPassword() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录"," 3 - 此邮箱地址是否已经被其他用户占用","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Kn)]}),qn("design:type",Function),qn("design:paramtypes",[String,String]),qn("design:returntype",Promise)],t.prototype,"signUp",null),Bn([Vn({title:"重置密码失败",messages:["请确认以下各项:"," 1 - 调用 auth().sendPasswordResetEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录"," 3 - 此邮箱地址是否已经与当前用户绑定"," 4 - 此邮箱地址是否已经被其他用户占用","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Kn)]}),qn("design:type",Function),qn("design:paramtypes",[String]),qn("design:returntype",Promise)],t.prototype,"resetPassword",null),Bn([Vn({title:"重置密码失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Kn)]}),qn("design:type",Function),qn("design:paramtypes",[String,String]),qn("design:returntype",Promise)],t.prototype,"resetPasswordWithToken",null),Bn([Vn({title:"邮箱激活失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Kn)]}),qn("design:type",Function),qn("design:paramtypes",[String]),qn("design:returntype",Promise)],t.prototype,"activate",null),t}(Zt),zn=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)}}(),Yn=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},Xn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Zn=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())}))},Qn=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])}}},er=Me.printWarn,tr=Re.ERRORS,nr=Re.COMMUNITY_SITE_URL,rr=Ne.catchErrorsDecorator,or=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return zn(t,e),t.prototype.signIn=function(e,t){return Zn(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u,l;return Qn(this,(function(f){switch(f.label){case 0:if("string"!=typeof e)throw new Error(JSON.stringify({code:tr.INVALID_PARAMS,msg:"username must be a string"}));return"string"!=typeof t&&(t="",er(tr.INVALID_PARAMS,"password is empty")),n=this._cache.keys.refreshTokenKey,i=(o=this._request).send,s=["auth.signIn"],l={loginType:zt.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(),Cr.fire(Ur.LOGIN_STATE_CHANGED),Cr.fire(Ur.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:zt.USERNAME,persistence:this._config.persistence}),[2,new Dr({envId:this._config.env,cache:this._cache,request:this._request})];case 9:throw r.code?new Error(JSON.stringify({code:tr.OPERATION_FAIL,msg:"login by username failed:[".concat(r.code,"] ").concat(r.message)})):new Error(JSON.stringify({code:tr.OPERATION_FAIL,msg:"login by username failed"}))}}))}))},Yn([rr({title:"用户名密码登录失败",messages:["请确认以下各项:"," 1 - 调用 auth().signInWithUsernameAndPassword() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录"," 3 - 用户名密码是否匹配","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(nr)]}),Xn("design:type",Function),Xn("design:paramtypes",[String,String]),Xn("design:returntype",Promise)],t.prototype,"signIn",null),t}(Zt),ir=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)}}(),sr=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},ar=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},cr=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())}))},ur=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])}}},lr=Me.throwError,fr=Me.isString,hr=Me.transformPhone,pr=Re.ERRORS,dr=Re.COMMUNITY_SITE_URL,yr=Ne.catchErrorsDecorator,gr="SIGNIN",vr="SIGNUP",_r="FORCERESETPWD",mr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ir(t,e),t.prototype.signIn=function(e){return cr(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,c,u;return ur(this,(function(l){switch(l.label){case 0:return t=e.phoneNumber,n=e.phoneCode,r=e.password,o=e.signMethod,fr(t)||lr(pr.INVALID_PARAMS,"phoneNumber must be a string"),fr(n)||fr(r)||lr(pr.INVALID_PARAMS,"phoneCode or password must be a string"),o||(o=gr),i=this._cache.keys.refreshTokenKey,[4,this._request.send("auth.signIn",{loginType:zt.PHONE,phoneNumber:hr(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(),Cr.fire(Ur.LOGIN_STATE_CHANGED),Cr.fire(Ur.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:zt.PHONE,persistence:this._config.persistence}),[2,new Dr({envId:this._config.env,cache:this._cache,request:this._request})];case 8:return s.code?lr(pr.OPERATION_FAIL,"Phone login fail[".concat(s.code,"] ").concat(s.message)):lr(pr.OPERATION_FAIL,"Phone login fail"),[2]}}))}))},t.prototype.signUp=function(e,t,n){return cr(this,void 0,void 0,(function(){return ur(this,(function(r){return[2,this.signIn({phoneNumber:e,phoneCode:t,password:n,signMethod:vr})]}))}))},t.prototype.forceResetPwd=function(e,t,n){return cr(this,void 0,void 0,(function(){return ur(this,(function(r){return[2,this.signIn({phoneNumber:e,phoneCode:t,password:n,signMethod:_r})]}))}))},sr([yr({title:"手机号登录失败",messages:["请确认以下各项:"," 1 - 调用 auth().SmsAuthProvider() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录"," 3 - 短信验证码/密码是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(dr)]}),ar("design:type",Function),ar("design:paramtypes",[Object]),ar("design:returntype",Promise)],t.prototype,"signIn",null),sr([yr({title:"手机短信注册失败",messages:["请确认以下各项:"," 1 - 调用 auth().signUpWithPhoneCode() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(dr)]}),ar("design:type",Function),ar("design:paramtypes",[String,String,String]),ar("design:returntype",Promise)],t.prototype,"signUp",null),sr([yr({title:"手机密码重置失败",messages:["请确认以下各项:"," 1 - 调用 auth().forceResetPwd() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(dr)]}),ar("design:type",Function),ar("design:paramtypes",[String,String,String]),ar("design:returntype",Promise)],t.prototype,"forceResetPwd",null),t}(Zt),br=function(){return br=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},br.apply(this,arguments)},wr=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},Er=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Sr=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())}))},Ir=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])}}},Or=je.CloudbaseEventEmitter,Ar=ke.RUNTIME,Tr=Me.printWarn,Nr=Me.throwError,xr=Me.transformPhone,Rr=Re.ERRORS,Pr=Re.COMMUNITY_SITE_URL,kr=Ne.catchErrorsDecorator,Cr=new Or,Lr=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 Sr(this,void 0,void 0,(function(){return Ir(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 Sr(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 Ir(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 Sr(this,void 0,void 0,(function(){var e,t,n,r,o,i;return Ir(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 Sr(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Ir(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&&Nr(Rr.INVALID_PARAMS,"username must be a string"),this._request.send("auth.updateUsername",{username:e})},e.prototype.refresh=function(){return Sr(this,void 0,void 0,(function(){var e;return Ir(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 Sr(this,void 0,void 0,(function(){return Ir(this,(function(n){return[2,this._request.send("auth.linkOrUpdatePhoneNumber",{phoneNumber:xr(e),phoneCode:t})]}))}))},e.prototype.updatePhoneNumber=function(e,t){return Sr(this,void 0,void 0,(function(){return Ir(this,(function(n){return[2,this._request.send("auth.linkOrUpdatePhoneNumber",{phoneNumber:xr(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 Sr(this,void 0,void 0,(function(){var t;return Ir(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()},wr([kr({title:"绑定自定义登录失败",messages:["请确认以下各项:"," 1 - 调用 User.linkWithTicket() 的语法或参数是否正确"," 2 - 此账户是否已经绑定自定义登录"," 3 - ticket 参数是否归属当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String]),Er("design:returntype",Promise)],e.prototype,"linkWithTicket",null),wr([kr({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 User.linkWithRedirect() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方"," 3 - 此第三方是否已经授权","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[Object]),Er("design:returntype",void 0)],e.prototype,"linkWithRedirect",null),wr([kr({title:"获取账户列表失败",messages:["请确认以下各项:"," 1 - 调用 User.getLinkedUidList() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[]),Er("design:returntype",Promise)],e.prototype,"getLinkedUidList",null),wr([kr({title:"设置微信主账号失败",messages:["请确认以下各项:"," 1 - 调用 User.setPrimaryUid() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String]),Er("design:returntype",void 0)],e.prototype,"setPrimaryUid",null),wr([kr({title:"接触绑定失败",messages:["请确认以下各项:"," 1 - 调用 User.unlink() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String]),Er("design:returntype",void 0)],e.prototype,"unlink",null),wr([kr({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[Object]),Er("design:returntype",Promise)],e.prototype,"update",null),wr([kr({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String,String]),Er("design:returntype",void 0)],e.prototype,"updatePassword",null),wr([kr({title:"更新邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 User.updateEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String,String]),Er("design:returntype",void 0)],e.prototype,"updateEmail",null),wr([kr({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String]),Er("design:returntype",void 0)],e.prototype,"updateUsername",null),wr([kr({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[]),Er("design:returntype",Promise)],e.prototype,"refresh",null),wr([kr({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().linkWithPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String,String]),Er("design:returntype",Promise)],e.prototype,"linkWithPhoneNumber",null),wr([kr({title:"更新手机号失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String,String]),Er("design:returntype",Promise)],e.prototype,"updatePhoneNumber",null),e}(),Dr=function(){function e(e){var t=e.envId,n=e.cache,r=e.request;t||Nr(Rr.INVALID_PARAMS,"envId is not defined"),this._cache=n,this.user=new Lr({cache:n,request:r})}return e.prototype.checkLocalState=function(){return Sr(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Ir(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 Sr(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a;return Ir(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===zt.ANONYMOUS},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCustomAuth",{get:function(){return this.loginType===zt.CUSTOM},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isWeixinAuth",{get:function(){return this.loginType===zt.WECHAT||this.loginType===zt.WECHAT_OPEN||this.loginType===zt.WECHAT_PUBLIC},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsernameAuth",{get:function(){return this.loginType===zt.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===zt.PHONE},enumerable:!1,configurable:!0}),e}(),jr=function(){function e(e){this._config=e,this._cache=e.cache,this._request=e.request,this._runtime=e.runtime||Ar.WEB,Cr.on(Ur.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}Tr(Rr.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 Sr(this,void 0,void 0,(function(){return Ir(this,(function(e){switch(e.label){case 0:return[4,this.getCurrentUser()];case 1:return[2,e.sent()]}}))}))},e.prototype.getCurrentUser=function(){return Sr(this,void 0,void 0,(function(){var e;return Ir(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 Sr(this,void 0,void 0,(function(){return Ir(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 Sr(this,void 0,void 0,(function(){var e;return Ir(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 dn(br(br({},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 Tn(br(br({},this._config),{cache:this._cache,request:this._request}))),this._anonymousAuthProvider},e.prototype.customAuthProvider=function(){return this._customAuthProvider||(this._customAuthProvider=new Un(br(br({},this._config),{cache:this._cache,request:this._request}))),this._customAuthProvider},e.prototype.emailAuthProvider=function(){return this._emailAuthProvider||(this._emailAuthProvider=new Jn(br(br({},this._config),{cache:this._cache,request:this._request}))),this._emailAuthProvider},e.prototype.usernameAuthProvider=function(){return this._usernameAuthProvider||(this._usernameAuthProvider=new or(br(br({},this._config),{cache:this._cache,request:this._request}))),this._usernameAuthProvider},e.prototype.phoneAuthProvider=function(){return this._phoneAuthProvider||(this._phoneAuthProvider=new mr(br(br({},this._config),{cache:this._cache,request:this._request}))),this._phoneAuthProvider},e.prototype.signInWithUsernameAndPassword=function(e,t){return Sr(this,void 0,void 0,(function(){return Ir(this,(function(n){return[2,this.usernameAuthProvider().signIn(e,t)]}))}))},e.prototype.isUsernameRegistered=function(e){return Sr(this,void 0,void 0,(function(){var t;return Ir(this,(function(n){switch(n.label){case 0:return"string"!=typeof e&&Nr(Rr.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 Sr(this,void 0,void 0,(function(){return Ir(this,(function(n){return[2,this.emailAuthProvider().signIn(e,t)]}))}))},e.prototype.signUpWithEmailAndPassword=function(e,t){return Sr(this,void 0,void 0,(function(){return Ir(this,(function(n){return[2,this.emailAuthProvider().signUp(e,t)]}))}))},e.prototype.sendPasswordResetEmail=function(e){return Sr(this,void 0,void 0,(function(){return Ir(this,(function(t){return[2,this.emailAuthProvider().resetPassword(e)]}))}))},e.prototype.signOut=function(){return Sr(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Ir(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),Cr.fire(Ur.LOGIN_STATE_CHANGED),Cr.fire(Ur.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:zt.NULL,persistence:this._config.persistence}),[2,s]}}))}))},e.prototype.onLoginStateChanged=function(e){return Sr(this,void 0,void 0,(function(){var t,n=this;return Ir(this,(function(r){switch(r.label){case 0:return Cr.on(Ur.LOGIN_STATE_CHANGED,(function(){return Sr(n,void 0,void 0,(function(){var t;return Ir(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){Cr.on(Ur.LOGIN_STATE_EXPIRED,e.bind(this))},e.prototype.onAccessTokenRefreshed=function(e){Cr.on(Ur.ACCESS_TOKEN_REFRESHD,e.bind(this))},e.prototype.onAnonymousConverted=function(e){Cr.on(Ur.ANONYMOUS_CONVERTED,e.bind(this))},e.prototype.onLoginTypeChanged=function(e){var t=this;Cr.on(Ur.LOGIN_TYPE_CHANGED,(function(){return Sr(t,void 0,void 0,(function(){var t;return Ir(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 Dr({envId:this._config.env,cache:this._cache,request:this._request});return t.checkLocalState(),t}return null}Tr(Rr.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return Sr(this,void 0,void 0,(function(){var e,t;return Ir(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 Dr({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 Sr(this,void 0,void 0,(function(){var e;return Ir(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,br(br({},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 Sr(this,void 0,void 0,(function(){var e,t,n,r,o;return Ir(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 Sr(this,void 0,void 0,(function(){return Ir(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.sendPhoneCode",{phoneNumber:xr(e)})];case 1:return[2,"Ok"===t.sent().data.SendStatus]}}))}))},e.prototype.signUpWithPhoneCode=function(e,t,n){return Sr(this,void 0,void 0,(function(){return Ir(this,(function(r){return[2,this.phoneAuthProvider().signUp(e,t,n)]}))}))},e.prototype.signInWithPhoneCodeOrPassword=function(e){return Sr(this,void 0,void 0,(function(){return Ir(this,(function(t){return[2,this.phoneAuthProvider().signIn(e)]}))}))},e.prototype.forceResetPwdByPhoneCode=function(e){return Sr(this,void 0,void 0,(function(){return Ir(this,(function(t){return[2,this.phoneAuthProvider().signIn(br(br({},e),{signMethod:_r}))]}))}))},e.prototype._onLoginTypeChanged=function(e){return Sr(this,void 0,void 0,(function(){var t,n,r;return Ir(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]}}))}))},wr([kr({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrenUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[]),Er("design:returntype",Promise)],e.prototype,"getCurrenUser",null),wr([kr({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[]),Er("design:returntype",Promise)],e.prototype,"getCurrentUser",null),wr([kr({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String]),Er("design:returntype",Promise)],e.prototype,"isUsernameRegistered",null),wr([kr({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[]),Er("design:returntype",Promise)],e.prototype,"signOut",null),wr([kr({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[]),Er("design:returntype",Promise)],e.prototype,"getLoginState",null),wr([kr({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[]),Er("design:returntype",Promise)],e.prototype,"getUserInfo",null),wr([kr({title:"发送短信验证码失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pr)]}),Er("design:type",Function),Er("design:paramtypes",[String]),Er("design:returntype",Promise)],e.prototype,"sendPhoneCode",null),e}(),Ur={LOGIN_STATE_CHANGED:"loginStateChanged",LOGIN_STATE_EXPIRED:"loginStateExpire",LOGIN_TYPE_CHANGED:"loginTypeChanged",ANONYMOUS_CONVERTED:"anonymousConverted",ACCESS_TOKEN_REFRESHD:"refreshAccessToken"},Mr={name:"auth",namespace:"auth",injectEvents:{bus:Cr,events:[Ur.LOGIN_TYPE_CHANGED,Ur.LOGIN_STATE_EXPIRED,Ur.LOGIN_STATE_CHANGED,Ur.ACCESS_TOKEN_REFRESHD,Ur.ANONYMOUS_CONVERTED]},entity:function(e){if(void 0===e&&(e={region:"",persistence:"local"}),this.authInstance)return Tr(Rr.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 jr({env:s,region:e.region,persistence:a,debug:c,cache:this.cache,request:this.request,runtime:r}),this.authInstance}};try{cloudbase.registerComponent(Mr)}catch(e){}var Br=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},qr=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Wr=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())}))},Fr=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])}}},Hr=Re.getSdkName,$r=Re.ERRORS,Gr=Re.COMMUNITY_SITE_URL,Kr=Me.execCallback,Vr=Ne.catchErrorsDecorator,Jr="functions",zr=function(){function e(){}return e.prototype.callFunction=function(e,t){return Wr(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u,l,f,h,p;return Fr(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:$r.INVALID_PARAMS,msg:"[".concat(Jr,".callFunction] invalid function name")}));try{a=r?JSON.stringify(r):""}catch(e){throw new Error(JSON.stringify({code:$r.INVALID_PARAMS,msg:"[".concat(Jr,".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,Kr(t,null,f)];if(h=f.data.response_data,i)return[2,Kr(t,null,{result:h,requestId:f.requestId})];try{return h=JSON.parse(f.data.response_data),[2,Kr(t,null,{result:h,requestId:f.requestId})]}catch(e){Kr(t,new Error("[".concat(Hr(),"][").concat($r.INVALID_PARAMS,"][").concat(Jr,".callFunction] response data must be json")))}return[3,4];case 3:return p=d.sent(),Kr(t,p),[3,4];case 4:return[2]}}))}))},Br([Vr({customInfo:{className:"Cloudbase",methodName:"callFunction"},title:"函数调用失败",messages:["请确认以下各项:"," 1 - 调用 callFunction() 的语法或参数是否正确"," 2 - 当前环境下是否存在此函数"," 3 - 函数安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Gr)]}),qr("design:type",Function),qr("design:paramtypes",[Object,Function]),qr("design:returntype",Promise)],e.prototype,"callFunction",null),e}(),Yr=new zr,Xr={name:Jr,entity:{callFunction:Yr.callFunction}};try{cloudbase.registerComponent(Xr)}catch(e){}var Zr=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},Qr=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},eo=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())}))},to=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])}}},no=Re.getSdkName,ro=Re.ERRORS,oo=Re.COMMUNITY_SITE_URL,io=Me.isArray,so=Me.isString,ao=Me.isPalinObject,co=Me.execCallback,uo=Ne.catchErrorsDecorator,lo="storage",fo=function(){function e(){}return e.prototype.uploadFile=function(e,t){return eo(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u,l,f,h,p,d,y,g;return to(this,(function(v){switch(v.label){case 0:if(n=e.cloudPath,r=e.filePath,o=e.onUploadProgress,!so(n)||!r)throw new Error(JSON.stringify({code:ro.INVALID_PARAMS,msg:"[".concat(lo,".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,co(t,null,{fileID:f,download_url:p,requestId:d})]:[2,co(t,new Error("[".concat(no(),"][").concat(ro.OPERATION_FAIL,"][").concat(lo,"]:").concat(g.data)))]}}))}))},e.prototype.getUploadMetadata=function(e,t){return eo(this,void 0,void 0,(function(){var n,r,o,i,s;return to(this,(function(a){switch(a.label){case 0:if(n=e.cloudPath,!so(n))throw new Error(JSON.stringify({code:ro.INVALID_PARAMS,msg:"[".concat(lo,".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,co(t,null,i)];case 3:return s=a.sent(),[2,co(t,s)];case 4:return[2]}}))}))},e.prototype.deleteFile=function(e,t){return eo(this,void 0,void 0,(function(){var n,r,o,i,s,a;return to(this,(function(c){switch(c.label){case 0:if(!(n=e.fileList)||!io(n)||0===n.length)throw new Error(JSON.stringify({code:ro.INVALID_PARAMS,msg:"[".concat(lo,".deleteFile] fileList must not be empty")}));for(r=0,o=n;r<o.length;r++)if(!(i=o[r])||!so(i))throw new Error(JSON.stringify({code:ro.INVALID_PARAMS,msg:"[".concat(lo,".deleteFile] fileID must be string")}));return[4,this.request.send("storage.batchDeleteFile",{fileid_list:n})];case 1:return(s=c.sent()).code?[2,co(t,null,s)]:(a={fileList:s.data.delete_list,requestId:s.requestId},[2,co(t,null,a)])}}))}))},e.prototype.getTempFileURL=function(e,t){return eo(this,void 0,void 0,(function(){var n,r,o,i,s,a;return to(this,(function(c){switch(c.label){case 0:if(!(n=e.fileList)||!io(n)||0===n.length)throw new Error(JSON.stringify({code:ro.INVALID_PARAMS,msg:"[".concat(lo,".getTempFileURL] fileList must not be empty")}));for(r=[],o=0,i=n;o<i.length;o++)if(s=i[o],ao(s)){if(!s.hasOwnProperty("fileID")||!s.hasOwnProperty("maxAge"))throw new Error(JSON.stringify({code:ro.INVALID_PARAMS,msg:"[".concat(lo,".getTempFileURL] file info must include fileID and maxAge")}));r.push({fileid:s.fileID,max_age:s.maxAge})}else{if(!so(s))throw new Error(JSON.stringify({code:ro.INVALID_PARAMS,msg:"[".concat(lo,".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,co(t,null,a)]:[2,co(t,null,{fileList:a.data.download_list,requestId:a.requestId})]}}))}))},e.prototype.downloadFile=function(e,t){return eo(this,void 0,void 0,(function(){var n,r,o,i,s,a;return to(this,(function(c){switch(c.label){case 0:if(n=e.fileID,!so(n))throw new Error(JSON.stringify({code:ro.INVALID_PARAMS,msg:"[".concat(lo,".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,co(t,o)]:(i=this.request,s=encodeURI(o.download_url),[4,i.download({url:s})]);case 2:return a=c.sent(),[2,co(t,null,a)]}}))}))},Zr([uo({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(oo)]}),Qr("design:type",Function),Qr("design:paramtypes",[Object,Function]),Qr("design:returntype",Promise)],e.prototype,"uploadFile",null),Zr([uo({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(oo)]}),Qr("design:type",Function),Qr("design:paramtypes",[Object,Function]),Qr("design:returntype",Promise)],e.prototype,"getUploadMetadata",null),Zr([uo({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(oo)]}),Qr("design:type",Function),Qr("design:paramtypes",[Object,Function]),Qr("design:returntype",Promise)],e.prototype,"deleteFile",null),Zr([uo({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(oo)]}),Qr("design:type",Function),Qr("design:paramtypes",[Object,Function]),Qr("design:returntype",Promise)],e.prototype,"getTempFileURL",null),Zr([uo({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(oo)]}),Qr("design:type",Function),Qr("design:paramtypes",[Object,Function]),Qr("design:returntype",Promise)],e.prototype,"downloadFile",null),e}(),ho=new fo,po={name:lo,entity:{uploadFile:ho.uploadFile,deleteFile:ho.deleteFile,getTempFileURL:ho.getTempFileURL,downloadFile:ho.downloadFile,getUploadMetadata:ho.getUploadMetadata}};try{cloudbase.registerComponent(po)}catch(e){}var yo="__lodash_hash_undefined__",go="[object Function]",vo="[object GeneratorFunction]",_o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mo=/^\w*$/,bo=/^\./,wo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Eo=/\\(\\)?/g,So=/^\[object .+?Constructor\]$/,Io=/^(?:0|[1-9]\d*)$/,Oo="object"==typeof i&&i&&i.Object===Object&&i,Ao="object"==typeof self&&self&&self.Object===Object&&self,To=Oo||Ao||Function("return this")();var No,xo=Array.prototype,Ro=Function.prototype,Po=Object.prototype,ko=To["__core-js_shared__"],Co=(No=/[^.]+$/.exec(ko&&ko.keys&&ko.keys.IE_PROTO||""))?"Symbol(src)_1."+No:"",Lo=Ro.toString,Do=Po.hasOwnProperty,jo=Po.toString,Uo=RegExp("^"+Lo.call(Do).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mo=To.Symbol,Bo=xo.splice,qo=Zo(To,"Map"),Wo=Zo(Object,"create"),Fo=Mo?Mo.prototype:void 0,Ho=Fo?Fo.toString:void 0;function $o(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 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,t,n){var r=e[t];Do.call(e,t)&&ri(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Jo(e,t){for(var n=e.length;n--;)if(ri(e[n][0],t))return n;return-1}function zo(e){if(!ii(e)||(t=e,Co&&Co in t))return!1;var t,n=function(e){var t=ii(e)?jo.call(e):"";return t==go||t==vo}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?Uo:So;return n.test(function(e){if(null!=e){try{return Lo.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function Yo(e,t,n,r){if(!ii(e))return e;t=function(e,t){if(oi(e))return!1;var n=typeof e;if("number"==n||"symbol"==n||"boolean"==n||null==e||si(e))return!0;return mo.test(e)||!_o.test(e)||null!=t&&e in Object(t)}(t,e)?[t]:function(e){return oi(e)?e:ei(e)}(t);for(var o=-1,i=t.length,s=i-1,a=e;null!=a&&++o<i;){var c=ti(t[o]),u=n;if(o!=s){var l=a[c];void 0===(u=r?r(l,c,a):void 0)&&(u=ii(l)?l:Qo(t[o+1])?[]:{})}Vo(a,c,u),a=a[c]}return e}function Xo(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 Zo(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return zo(n)?n:void 0}function Qo(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||Io.test(e))&&e>-1&&e%1==0&&e<t}$o.prototype.clear=function(){this.__data__=Wo?Wo(null):{}},$o.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},$o.prototype.get=function(e){var t=this.__data__;if(Wo){var n=t[e];return n===yo?void 0:n}return Do.call(t,e)?t[e]:void 0},$o.prototype.has=function(e){var t=this.__data__;return Wo?void 0!==t[e]:Do.call(t,e)},$o.prototype.set=function(e,t){return this.__data__[e]=Wo&&void 0===t?yo:t,this},Go.prototype.clear=function(){this.__data__=[]},Go.prototype.delete=function(e){var t=this.__data__,n=Jo(t,e);return!(n<0)&&(n==t.length-1?t.pop():Bo.call(t,n,1),!0)},Go.prototype.get=function(e){var t=this.__data__,n=Jo(t,e);return n<0?void 0:t[n][1]},Go.prototype.has=function(e){return Jo(this.__data__,e)>-1},Go.prototype.set=function(e,t){var n=this.__data__,r=Jo(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ko.prototype.clear=function(){this.__data__={hash:new $o,map:new(qo||Go),string:new $o}},Ko.prototype.delete=function(e){return Xo(this,e).delete(e)},Ko.prototype.get=function(e){return Xo(this,e).get(e)},Ko.prototype.has=function(e){return Xo(this,e).has(e)},Ko.prototype.set=function(e,t){return Xo(this,e).set(e,t),this};var ei=ni((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(si(e))return Ho?Ho.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return bo.test(e)&&n.push(""),e.replace(wo,(function(e,t,r,o){n.push(r?o.replace(Eo,"$1"):t||e)})),n}));function ti(e){if("string"==typeof e||si(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ni(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(ni.Cache||Ko),n}function ri(e,t){return e===t||e!=e&&t!=t}ni.Cache=Ko;var oi=Array.isArray;function ii(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function si(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==jo.call(e)}var ai=s((function(e,t,n){return null==e?e:Yo(e,t,n)})),ci="__lodash_hash_undefined__",ui="[object Function]",li="[object GeneratorFunction]",fi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hi=/^\w*$/,pi=/^\./,di=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yi=/\\(\\)?/g,gi=/^\[object .+?Constructor\]$/,vi="object"==typeof i&&i&&i.Object===Object&&i,_i="object"==typeof self&&self&&self.Object===Object&&self,mi=vi||_i||Function("return this")();var bi=Array.prototype,wi=Function.prototype,Ei=Object.prototype,Si=mi["__core-js_shared__"],Ii=function(){var e=/[^.]+$/.exec(Si&&Si.keys&&Si.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Oi=wi.toString,Ai=Ei.hasOwnProperty,Ti=Ei.toString,Ni=RegExp("^"+Oi.call(Ai).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xi=mi.Symbol,Ri=bi.splice,Pi=Hi(mi,"Map"),ki=Hi(Object,"create"),Ci=xi?xi.prototype:void 0,Li=Ci?Ci.toString:void 0;function Di(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 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,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 Bi(e){if(!zi(e)||(t=e,Ii&&Ii in t))return!1;var t,n=function(e){var t=zi(e)?Ti.call(e):"";return t==ui||t==li}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?Ni:gi;return n.test(function(e){if(null!=e){try{return Oi.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function qi(e,t){e=function(e,t){return 1==t.length?e:function(e,t){for(var n=0,r=(t=$i(t,e)?[t]:Wi(t)).length;null!=e&&n<r;)e=e[Ki(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=$i(t,e)?[t]:Wi(t));var n,r,o=Ki((r=(n=t)?n.length:0)?n[r-1]:void 0);return!(null!=e&&Ai.call(e,o))||delete e[o]}function Wi(e){return Ji(e)?e:Gi(e)}function Fi(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 Hi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Bi(n)?n:void 0}function $i(e,t){if(Ji(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Yi(e))||(hi.test(e)||!fi.test(e)||null!=t&&e in Object(t))}Di.prototype.clear=function(){this.__data__=ki?ki(null):{}},Di.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Di.prototype.get=function(e){var t=this.__data__;if(ki){var n=t[e];return n===ci?void 0:n}return Ai.call(t,e)?t[e]:void 0},Di.prototype.has=function(e){var t=this.__data__;return ki?void 0!==t[e]:Ai.call(t,e)},Di.prototype.set=function(e,t){return this.__data__[e]=ki&&void 0===t?ci:t,this},ji.prototype.clear=function(){this.__data__=[]},ji.prototype.delete=function(e){var t=this.__data__,n=Mi(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ri.call(t,n,1),!0)},ji.prototype.get=function(e){var t=this.__data__,n=Mi(t,e);return n<0?void 0:t[n][1]},ji.prototype.has=function(e){return Mi(this.__data__,e)>-1},ji.prototype.set=function(e,t){var n=this.__data__,r=Mi(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ui.prototype.clear=function(){this.__data__={hash:new Di,map:new(Pi||ji),string:new Di}},Ui.prototype.delete=function(e){return Fi(this,e).delete(e)},Ui.prototype.get=function(e){return Fi(this,e).get(e)},Ui.prototype.has=function(e){return Fi(this,e).has(e)},Ui.prototype.set=function(e,t){return Fi(this,e).set(e,t),this};var Gi=Vi((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(Yi(e))return Li?Li.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return pi.test(e)&&n.push(""),e.replace(di,(function(e,t,r,o){n.push(r?o.replace(yi,"$1"):t||e)})),n}));function Ki(e){if("string"==typeof e||Yi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Vi(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(Vi.Cache||Ui),n}Vi.Cache=Ui;var Ji=Array.isArray;function zi(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Yi(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==Ti.call(e)}var Xi=s((function(e,t){return null==e||qi(e,t)})),Zi={exports:{}};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",s="[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[s]=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 i&&i&&i.Object===Object&&i,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,i,p,_){var P;if(r&&(P=p?r(e,i,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 s: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 i=e,Ie?Object(Ie.call(i)):{}}var i}(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)}}(Zi,Zi.exports);var Qi=s(Zi.exports);function es(e){return void 0===e&&(e=""),"".concat(e?"".concat(e,"_"):"").concat(+new Date,"_").concat(Math.random())}var ts,ns=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}})},rs=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}})},os=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)}}(),is=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 os(t,e),t}(Error),ss=function(e){return null==e?void 0:e.isRealtimeErrorMessageError},as=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 os(t,e),t}(Error),cs=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 os(t,e),t}(Error),us=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(ls[this.errCode]||""," | errMsg: ").concat(this.errMsg)},set:function(e){this.errMsg=e}}}),n.errCode=t.errCode||"UNKNOWN_ERROR",n.errMsg=t.errMsg,n}return os(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),ls={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"},fs=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},hs=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())}))},ps=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])}}},ds=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"}(ts||(ts={}));var ys=function(){function e(e){var t=this;this.watchStatus=ts.INITING,this._login=function(e,n){return hs(t,void 0,void 0,(function(){var t;return ps(this,(function(r){switch(r.label){case 0:return this.watchStatus=ts.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 hs(t,void 0,void 0,(function(){var t,n=this;return ps(this,(function(r){switch(r.label){case 0:if(this._initWatchPromise)return[2,this._initWatchPromise];this._initWatchPromise=new Promise((function(t,r){return hs(n,void 0,void 0,(function(){var n,o,i,s,a,c,u,l,f,h;return ps(this,(function(p){switch(p.label){case 0:return p.trys.push([0,3,,4]),this.watchStatus===ts.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===ts.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,t()]):(this.watchStatus=ts.INITING,o={watchId:this.watchId,requestId:es(),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 rs({id:c,docChanges:[],docs:[],type:"init"}),this.listener.onChange(f),this.scheduleSendACK();return this.onWatchStart(this,this.sessionInfo.queryID),this.watchStatus=ts.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 hs(t,void 0,void 0,(function(){var t,n=this;return ps(this,(function(r){switch(r.label){case 0:if(this._rebuildWatchPromise)return[2,this._rebuildWatchPromise];this._rebuildWatchPromise=new Promise((function(t,r){return hs(n,void 0,void 0,(function(){var n,o,i,s;return ps(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),this.watchStatus===ts.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===ts.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,t()]):(this.watchStatus=ts.REBUILDING,o={watchId:this.watchId,requestId:es(),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=ts.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 hs(t,void 0,void 0,(function(){var t,r,o,i=this;return ps(this,(function(s){return t="INIT_WATCH"===n.operationName,r=function(){i.closeWithError(new us({errCode:t?ls.SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:ls.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 hs(i,void 0,void 0,(function(){var e,t=this;return ps(this,(function(r){switch(r.label){case 0:return r.trys.push([0,8,,9]),e=function(){return hs(t,void 0,void 0,(function(){return ps(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,fs(100)];case 3:return r.sent(),this.watchStatus!==ts.PAUSED?[3,4]:(n.reject(new cs("".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 hs(t,void 0,void 0,(function(){var e,t,n;return ps(this,(function(r){switch(r.label){case 0:if(e=this.sessionInfo?this.sessionInfo.queryID:"",this.watchStatus!==ts.ACTIVE)return this.watchStatus=ts.CLOSED,this.onWatchClose(this,e),[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),this.watchStatus=ts.CLOSING,t={watchId:this.watchId,requestId:es(),msgType:"CLOSE_WATCH",msgData:null},[4,this.send({msg:t})];case 2:return r.sent(),this.sessionInfo=void 0,this.watchStatus=ts.CLOSED,[3,5];case 3:return n=r.sent(),this.closeWithError(new us({errCode:ls.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 hs(t,void 0,void 0,(function(){var e,t,n;return ps(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.watchStatus!==ts.ACTIVE?(this.scheduleSendACK(),[2]):this.sessionInfo?(e={watchId:this.watchId,requestId:es(),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(),ss(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 us({errCode:ls.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 us({errCode:ls.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:t})),[3,3];case 3:return[2]}}))}))},this.handleCommonError=function(e,t){if(ss(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 ns({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 ts.PAUSED:if("ERROR"!==e.msgType)return;break;case ts.LOGGINGIN:case ts.INITING:case ts.REBUILDING:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received while ".concat(this.watchStatus));case ts.CLOSED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has closed");case ts.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 us({errCode:ls.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=ts.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=ts.PAUSED,console.log("[realtime] client paused (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},e.prototype.resume=function(){return hs(this,void 0,void 0,(function(){var e;return ps(this,(function(t){switch(t.label){case 0:this.watchStatus=ts.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 hs(this,void 0,void 0,(function(){var t;return ps(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 hs(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,c,u,l,f,h;return ps(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(gs)}catch(e){return this.closeWithError(new us({errCode:ls.SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA,errMsg:e})),[2]}s=ds([],o.currentDocs,!0),a=!1,c=function(n,c){var l,f,h,p,d,y,g,v,_,m,b;return ps(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=Qi(f),l.updatedFields)for(d in l.updatedFields)ai(y,d,l.updatedFields[d]);if(l.removedFields)for(h=0,p=l.removedFields;h<p.length;h++)d=p[h],Xi(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 us({errCode:ls.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 us({errCode:ls.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 us({errCode:ls.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)&&(_=ds([],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 rs({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 gs(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 vs,_s={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"}(vs||(vs={}));var ms=function(e,t){var n=_s[e],r=n?"".concat(n.name,", code ").concat(e,", reason ").concat(t||n.description):"code ".concat(e);return new us({errCode:ls.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED,errMsg:r})},bs=null,ws="web";function Es(){return bs}function Ss(){return ws}function Is(e){ws=e}var Os=function(){return Os=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},Os.apply(this,arguments)},As=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())}))},Ts=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])}}},Ns=1,xs=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 As(t,void 0,void 0,(function(){var t=this;return Ts(this,(function(n){return[2,new Promise((function(n,r){return As(t,void 0,void 0,(function(){var t,o,i,s,a,c,u,l=this;return Ts(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 As(l,void 0,void 0,(function(){return Ts(this,(function(e){switch(e.label){case 0:return o&&i?[3,2]:[4,fs(0)];case 1:e.sent(),o&&i||a(new as("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!==Ns)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),As(t,void 0,void 0,(function(){var t=this;return Ts(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(vs.ReconnectWebSocket),this._wsInitPromise=new Promise((function(r,o){return As(t,void 0,void 0,(function(){var t,i,s=this;return Ts(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=Es();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,fs(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 us({errCode:ls.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 us({errCode:ls.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 vs.ReconnectWebSocket:case vs.NoRealtimeListeners:break;case vs.HeartbeatPingError:case vs.HeartbeatPongTimeoutError:case vs.NormalClosure:case vs.AbnormalClosure:t._maxReconnect>0?t.initWebSocketConnection(!0,t._maxReconnect):t.closeAllClients(ms(e.code));break;case vs.NoAuthentication:t.closeAllClients(ms(e.code,e.reason));break;default:t._maxReconnect>0?t.initWebSocketConnection(!0,t._maxReconnect):t.closeAllClients(ms(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 is(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===Ns)},this.onceWSConnected=function(){return As(t,void 0,void 0,(function(){var e=this;return Ts(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 As(t,void 0,void 0,(function(){var t,r,o,i,s,a,c,u,l=this;return Ts(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 As(l,void 0,void 0,(function(){var n,r,o,i,s;return Ts(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:es(),msgType:"LOGIN",msgData:r,exMsgData:{runtime:Ss(),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 As(t,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Ts(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:Ss()})]);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 As(t,void 0,void 0,(function(){var e;return Ts(this,(function(t){switch(t.label){case 0:return e={watchId:void 0,requestId:es(),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(vs.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,_s[e].name),this._ws=void 0)},e.prototype.watch=function(e){this._ws||this._wsInitPromise||this.initWebSocketConnection(!1);var t=new ys(Os(Os({},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 As(t,void 0,void 0,(function(){var e=this;return Ts(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this._ws&&this._ws.readyState===Ns?(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(vs.HeartbeatPingError),[3,3];case 3:return[2]}}))}))}),e?0:this._context.appConfig.realtimePingInterval)},e}(),Rs={target:"database",entity:function(){var e,t=this.platform,n=t.adapter,r=t.runtime;e=n.wsClass,bs=e,Is(r)}},Ps={name:"realtime",IIFE:!0,entity:function(){this.prototype.wsClientClass=xs}};try{cloudbase.registerComponent(Ps),cloudbase.registerHook(Rs)}catch(e){}var ks=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},Cs=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Ls=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])}}},js=Re.ERRORS,Us=Re.COMMUNITY_SITE_URL,Ms=Ne.catchErrorsDecorator,Bs="analytics",qs=["mall"];var Ws,Fs,Hs=new(function(){function e(){}return e.prototype.analytics=function(e){return Ls(this,void 0,void 0,(function(){var t,n,r;return Ds(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!==qs.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:js.INVALID_PARAMS,msg:"[".concat(Bs,".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]}))}))},ks([Ms({customInfo:{className:"Cloudbase",methodName:"analytics"},title:"上报调用失败",messages:["请确认以下各项:"," 1 - 调用 analytics() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Us)]}),Cs("design:type",Function),Cs("design:paramtypes",[Object]),Cs("design:returntype",Promise)],e.prototype,"analytics",null),e}()),$s={name:Bs,entity:{analytics:Hs.analytics}};try{cloudbase.registerComponent($s)}catch(e){}!function(e){e.DocIDError="文档ID不合法",e.CollNameError="集合名称不合法",e.OpStrError="操作符不合法",e.DirectionError="排序字符不合法",e.IntergerError="must be integer",e.QueryParamTypeError="查询参数必须为对象",e.QueryParamValueError="查询参数对象值不能均为undefined"}(Fs||(Fs={}));var Gs,Ks,Vs="Number",Js="Object",zs="Array",Ys="GeoPoint",Xs="GeoLineString",Zs="GeoPolygon",Qs="GeoMultiPoint",ea="GeoMultiLineString",ta="GeoMultiPolygon",na="Date",ra="ServerDate",oa="BsonDate",ia=["desc","asc"],sa=["<","<=","==",">=",">"];!function(e){e.lt="<",e.gt=">",e.lte="<=",e.gte=">=",e.eq="=="}(Gs||(Gs={})),(Ws={})[Gs.eq]="$eq",Ws[Gs.lt]="$lt",Ws[Gs.lte]="$lte",Ws[Gs.gt]="$gt",Ws[Gs.gte]="$gte",function(e){e.WHERE="WHERE",e.DOC="DOC"}(Ks||(Ks={}));var aa=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)}}(),ca=[],ua={},la=function(e){function t(t,n){if(n!==ua)throw new TypeError("InternalSymbol cannot be constructed with new operator");return e.call(this,t)||this}return aa(t,e),t.for=function(e){for(var n=0,r=ca.length;n<r;n++)if(ca[n].target===e)return ca[n].instance;var o=new t(e,ua);return ca.push({target:e,instance:o}),o},t}((function(e){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:e}})})),fa=la,ha=fa.for("UNSET_FIELD_NAME"),pa=fa.for("UPDATE_COMMAND"),da=fa.for("QUERY_COMMAND"),ya=fa.for("LOGIC_COMMAND"),ga=fa.for("GEO_POINT"),va=fa.for("SYMBOL_GEO_LINE_STRING"),_a=fa.for("SYMBOL_GEO_POLYGON"),ma=fa.for("SYMBOL_GEO_MULTI_POINT"),ba=fa.for("SYMBOL_GEO_MULTI_LINE_STRING"),wa=fa.for("SYMBOL_GEO_MULTI_POLYGON"),Ea=fa.for("SERVER_DATE"),Sa=fa.for("REGEXP"),Ia=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 Ea},enumerable:!0,configurable:!0}),e.prototype.parse=function(){return{$date:{offset:this.offset}}},e}();function Oa(e){return new Ia(e)}var Aa,Ta=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},Na=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 Ys:o=new Ua(i.coordinates[0],i.coordinates[1]);break;case Xs:o=new Ba(i.coordinates.map((function(e){return new Ua(e[0],e[1])})));break;case Zs:o=new Wa(i.coordinates.map((function(e){return new Ba(e.map((function(e){var t=Ta(e,2),n=t[0],r=t[1];return new Ua(n,r)})))})));break;case Qs:o=new Ha(i.coordinates.map((function(e){return new Ua(e[0],e[1])})));break;case ea:o=new Ga(i.coordinates.map((function(e){return new Ba(e.map((function(e){var t=Ta(e,2),n=t[0],r=t[1];return new Ua(n,r)})))})));break;case ta:o=new Va(i.coordinates.map((function(e){return new Wa(e.map((function(e){return new Ba(e.map((function(e){var t=Ta(e,2),n=t[0],r=t[1];return new Ua(n,r)})))})))})));break;case na:o=new Date(1e3*i.$timestamp);break;case Js:case zs:o=e.formatField(i);break;case ra: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===na)return oa;if(t===Js){if(e instanceof Ua)return Ys;if(e instanceof Date)return na;if(e instanceof Ia)return ra;e.$timestamp?t=na:e.$date?t=ra:Ua.validate(e)?t=Ys:Ba.validate(e)?t=Xs:Wa.validate(e)?t=Zs:Ha.validate(e)?t=Qs:Ga.validate(e)?t=ea:Va.validate(e)&&(t=ta)}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}(),xa=function(){function e(){}return e.isGeopoint=function(e,t){if(Na.whichType(t)!==Vs)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+Fs.IntergerError);return!0},e.isFieldOrder=function(e){if(-1===ia.indexOf(e))throw new Error(Fs.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===sa.indexOf(e))throw new Error(Fs.OpStrError);return!0},e.isCollName=function(e){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(e))throw new Error(Fs.CollNameError);return!0},e.isDocID=function(e){if(!/^([a-fA-F0-9]){24}$/.test(e))throw new Error(Fs.DocIDError);return!0},e}(),Ra=function(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()},Pa=function(e){return"object"===Ra(e)},ka=function(e){return"number"===Ra(e)},Ca=function(e){return Array.isArray(e)},La=function(e){return"date"===Ra(e)},Da=function(e){return"regexp"===Ra(e)},ja=function(e){return e&&e._internalType instanceof la},Ua=function(){function e(e,t){xa.isGeopoint("longitude",e),xa.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&&Ca(e.coordinates)&&xa.isGeopoint("longitude",e.coordinates[0])&&xa.isGeopoint("latitude",e.coordinates[1])},Object.defineProperty(e.prototype,"_internalType",{get:function(){return ga},enumerable:!0,configurable:!0}),e}(),Ma=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.")},Ba=function(){function e(e){if(!Ca(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 Ua))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||!Ca(e.coordinates))return!1;try{for(var r=Ma(e.coordinates),o=r.next();!o.done;o=r.next()){var i=o.value;if(!ka(i[0])||!ka(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 va},enumerable:!0,configurable:!0}),e}(),qa=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.")},Wa=function(){function e(e){if(!Ca(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 Ba))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof e+"[]");if(!Ba.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||!Ca(e.coordinates))return!1;try{for(var i=qa(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,qa(a)),u=c.next();!u.done;u=c.next()){var l=u.value;if(!ka(l[0])||!ka(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 wa},enumerable:!0,configurable:!0}),e}(),Fa=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.")},Ha=function(){function e(e){if(!Ca(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 Ua))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||!Ca(e.coordinates))return!1;try{for(var r=Fa(e.coordinates),o=r.next();!o.done;o=r.next()){var i=o.value;if(!ka(i[0])||!ka(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 ma},enumerable:!0,configurable:!0}),e}(),$a=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.")},Ga=function(){function e(e){if(!Ca(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 Ba))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||!Ca(e.coordinates))return!1;try{for(var i=$a(e.coordinates),s=i.next();!s.done;s=i.next()){var a=s.value;try{for(var c=(r=void 0,$a(a)),u=c.next();!u.done;u=c.next()){var l=u.value;if(!ka(l[0])||!ka(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 ba},enumerable:!0,configurable:!0}),e}(),Ka=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.")},Va=function(){function e(e){var t,n;if(!Ca(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=Ka(e),o=r.next();!o.done;o=r.next()){var i=o.value;if(!(i instanceof Wa))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||!Ca(e.coordinates))return!1;try{for(var a=Ka(e.coordinates),c=a.next();!c.done;c=a.next()){var u=c.value;try{for(var l=(r=void 0,Ka(u)),f=l.next();!f.done;f=l.next()){var h=f.value;try{for(var p=(i=void 0,Ka(h)),d=p.next();!d.done;d=p.next()){var y=d.value;if(!ka(y[0])||!ka(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 _a},enumerable:!0,configurable:!0}),e}(),Ja=Object.freeze({__proto__:null,LineString:Ba,MultiLineString:Ga,MultiPoint:Ha,MultiPolygon:Va,Point:Ua,Polygon:Wa}),za=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"}(Aa||(Aa={}));var Ya,Xa=function(){function e(e,t,n){this._internalType=pa,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=e,this.operands=t,this.fieldName=n||ha}return e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e}();function Za(e){return e&&e instanceof Xa&&e._internalType===pa}!function(e){e.AND="and",e.OR="or",e.NOT="not",e.NOR="nor"}(Ya||(Ya={}));var Qa=function(){function e(e,t,n){if(this._internalType=ya,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=e,this.operands=t,this.fieldName=n||ha,this.fieldName!==ha)if(Array.isArray(t)){t=t.slice(),this.operands=t;for(var r=0,o=t.length;r<o;r++){(ec(i=t[r])||oc(i))&&(t[r]=i._setFieldName(this.fieldName))}}else{var i;(ec(i=t)||oc(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(Ya.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(Ya.OR,t,this.fieldName)},e}();function ec(e){return e&&e instanceof Qa&&e._internalType===ya}var tc,nc=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"}(tc||(tc={}));var rc=function(e){function t(t,n,r){var o=e.call(this,t,n,r)||this;return o.operator=t,o._internalType=da,o}return nc(t,e),t.prototype.toJSON=function(){var e,t;switch(this.operator){case tc.IN:case tc.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(tc.EQ,[e],this.fieldName);return this.and(n)},t.prototype.neq=function(e){var n=new t(tc.NEQ,[e],this.fieldName);return this.and(n)},t.prototype.gt=function(e){var n=new t(tc.GT,[e],this.fieldName);return this.and(n)},t.prototype.gte=function(e){var n=new t(tc.GTE,[e],this.fieldName);return this.and(n)},t.prototype.lt=function(e){var n=new t(tc.LT,[e],this.fieldName);return this.and(n)},t.prototype.lte=function(e){var n=new t(tc.LTE,[e],this.fieldName);return this.and(n)},t.prototype.in=function(e){var n=new t(tc.IN,e,this.fieldName);return this.and(n)},t.prototype.nin=function(e){var n=new t(tc.NIN,e,this.fieldName);return this.and(n)},t.prototype.geoNear=function(e){if(!(e.geometry instanceof Ua))throw new TypeError('"geometry" must be of type Point. Received type '+typeof e.geometry);if(void 0!==e.maxDistance&&!ka(e.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof e.maxDistance);if(void 0!==e.minDistance&&!ka(e.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof e.minDistance);var n=new t(tc.GEO_NEAR,[e],this.fieldName);return this.and(n)},t.prototype.geoWithin=function(e){if(!(e.geometry instanceof Va||e.geometry instanceof Wa))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof e.geometry);var n=new t(tc.GEO_WITHIN,[e],this.fieldName);return this.and(n)},t.prototype.geoIntersects=function(e){if(!(e.geometry instanceof Ua||e.geometry instanceof Ba||e.geometry instanceof Wa||e.geometry instanceof Ha||e.geometry instanceof Ga||e.geometry instanceof Va))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof e.geometry);var n=new t(tc.GEO_INTERSECTS,[e],this.fieldName);return this.and(n)},t}(Qa);function oc(e){return e&&e instanceof rc&&e._internalType===da}function ic(e){return oc(e)}var sc={};for(var ac in tc)sc[ac]="$"+ac;for(var ac in Ya)sc[ac]="$"+ac;for(var ac in Aa)sc[ac]="$"+ac;function cc(e){return sc[e]||"$"+e}sc[tc.NEQ]="$ne",sc[Aa.REMOVE]="$unset",sc[Aa.SHIFT]="$pop",sc[Aa.UNSHIFT]="$push";var uc=function(){return uc=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},uc.apply(this,arguments)},lc=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},fc=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(lc(arguments[t]));return e};function hc(e){return pc(e,[e])}function pc(e,t){if(!ja(e)){if(La(e))return{$date:+e};if(Da(e))return{$regex:e.source,$options:e.flags};if(Ca(e))return e.map((function(e){if(t.indexOf(e)>-1)throw new Error("Cannot convert circular structure to JSON");return pc(e,fc(t,[e]))}));if(Pa(e)){var n=uc({},e);for(var r in n){if(t.indexOf(n[r])>-1)throw new Error("Cannot convert circular structure to JSON");n[r]=pc(n[r],fc(t,[n[r]]))}return n}return e}switch(e._internalType){case ga:return e.toJSON();case Ea:case Sa:return e.parse();default:return e.toJSON?e.toJSON():e}}var dc=function(){return dc=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},dc.apply(this,arguments)},yc=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},gc=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(yc(arguments[t]));return e};function vc(e,t,n,r){var o=dc({},e);for(var i in e)if(!/^\$/.test(i)){var s=e[i];if(s&&Pa(s)&&!t(s)){if(r.indexOf(s)>-1)throw new Error("Cannot convert circular structure to JSON");var a=vc(s,t,gc(n,[i]),gc(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 _c(e){return vc(e,bc,[],[e])}function mc(e,t,n){for(var r in t[n]||delete e[n],t)e[r]?Ca(e[r])?e[r].push(t[r]):Pa(e[r])?Pa(t[r])?Object.assign(e[r],t[r]):(console.warn("unmergable condition, query is object but condition is "+Ra(t)+", can only overwrite",t,n),e[r]=t[r]):(console.warn("to-merge query is of type "+Ra(e)+", can only overwrite",e,t,n),e[r]=t[r]):e[r]=t[r]}function bc(e){return ja(e)||La(e)||Da(e)}function wc(e){return hc(e)}var Ec=function(){function e(){}return e.encode=function(t){return(new e).encodeUpdate(t)},e.prototype.encodeUpdate=function(e){return Za(e)?this.encodeUpdateCommand(e):"object"===Ra(e)?this.encodeUpdateObject(e):e},e.prototype.encodeUpdateCommand=function(e){if(e.fieldName===ha)throw new Error("Cannot encode a comparison command with unset field name");switch(e.operator){case Aa.PUSH:case Aa.PULL:case Aa.PULL_ALL:case Aa.POP:case Aa.SHIFT:case Aa.UNSHIFT:case Aa.ADD_TO_SET:return this.encodeArrayUpdateCommand(e);default:return this.encodeFieldUpdateCommand(e)}},e.prototype.encodeFieldUpdateCommand=function(e){var t,n,r,o,i=cc(e.operator);return e.operator===Aa.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=cc(e.operator);switch(e.operator){case Aa.PUSH:var h=void 0;return h=Ca(e.operands)?{$each:e.operands.map(wc)}:e.operands,(t={})[f]=((n={})[e.fieldName]=h,n),t;case Aa.UNSHIFT:h={$each:e.operands.map(wc),$position:0};return(r={})[f]=((o={})[e.fieldName]=h,o),r;case Aa.POP:return(i={})[f]=((s={})[e.fieldName]=1,s),i;case Aa.SHIFT:return(a={})[f]=((c={})[e.fieldName]=-1,c),a;default:return(u={})[f]=((l={})[e.fieldName]=wc(e.operands),l),u}},e.prototype.encodeUpdateObject=function(e){var t=_c(e);for(var n in t)if(!/^\$/.test(n)){var r=t[n];if(Za(r)){t[n]=r._setFieldName(n),mc(t,this.encodeUpdateCommand(t[n]),n)}else{t[n]=r=wc(r);var o=new Xa(Aa.SET,[r],n);mc(t,this.encodeUpdateCommand(o),n)}}return t},e}(),Sc={};function Ic(e){if(!dl.wsClientClass)throw new Error("to use realtime you must import realtime module first");var t=e.config.env;return Sc[t]||(Sc[t]=new dl.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:new dl.reqClass(e.config)}}})),Sc[t]}var Oc=function(){return Oc=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},Oc.apply(this,arguments)},Ac=function(){function e(e,t,n,r){var o=this;void 0===r&&(r={}),this.watch=function(e){return Ic(o._db).watch(Oc(Oc({},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 dl.reqClass(this._db.config),this.projection=r}return e.prototype.create=function(e,t){t=t||za();var n={collectionName:this._coll,data:hc(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||za(),!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 Xa?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:Ks.DOC,data:hc(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||za(),!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:Ec.encode(e),query:n,queryType:Ks.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||za();var t={_id:this.id},n={collectionName:this._coll,query:t,queryType:Ks.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||za();var t={_id:this.id},n={collectionName:this._coll,query:t,queryType:Ks.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=Na.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}(),Tc=function(){function e(){}return e.encode=function(e){return(new Nc).encodeQuery(e)},e}(),Nc=function(){function e(){}return e.prototype.encodeQuery=function(e,t){var n;return bc(e)?ec(e)?this.encodeLogicCommand(e):oc(e)?this.encodeQueryCommand(e):((n={})[t]=this.encodeQueryObject(e),n):Pa(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 Ya.NOR:case Ya.AND:case Ya.OR:var u=cc(e.operator),l=e.operands.map((function(t){return c.encodeQuery(t,e.fieldName)}));return(t={})[u]=l,t;case Ya.NOT:u=cc(e.operator);var f=e.operands[0];if(Da(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=cc(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 ic(e),this.encodeComparisonCommand(e)},e.prototype.encodeComparisonCommand=function(e){var t,n,r,o,i,s,a,c,u;if(e.fieldName===ha)throw new Error("Cannot encode a comparison command with unset field name");var l=cc(e.operator);switch(e.operator){case tc.EQ:case tc.NEQ:case tc.LT:case tc.LTE:case tc.GT:case tc.GTE:case tc.ELEM_MATCH:case tc.EXISTS:case tc.SIZE:case tc.MOD:return(t={})[e.fieldName]=((n={})[l]=wc(e.operands[0]),n),t;case tc.IN:case tc.NIN:case tc.ALL:return(r={})[e.fieldName]=((o={})[l]=wc(e.operands),o),r;case tc.GEO_NEAR:var f=e.operands[0];return(i={})[e.fieldName]={$nearSphere:{$geometry:f.geometry.toJSON(),$maxDistance:f.maxDistance,$minDistance:f.minDistance}},i;case tc.GEO_WITHIN:f=e.operands[0];return(s={})[e.fieldName]={$geoWithin:{$geometry:f.geometry.toJSON()}},s;case tc.GEO_INTERSECTS:f=e.operands[0];return(a={})[e.fieldName]={$geoIntersects:{$geometry:f.geometry.toJSON()}},a;default:return(c={})[e.fieldName]=((u={})[l]=wc(e.operands[0]),u),c}},e.prototype.encodeQueryObject=function(e){var t=_c(e);for(var n in t){var r=t[n];if(ec(r)){t[n]=r._setFieldName(n);var o=this.encodeLogicCommand(t[n]);this.mergeConditionAfterEncode(t,o,n)}else if(ic(r)){t[n]=r._setFieldName(n);o=this.encodeComparisonCommand(t[n]);this.mergeConditionAfterEncode(t,o,n)}else bc(r)&&(t[n]=wc(r))}return t},e.prototype.mergeConditionAfterEncode=function(e,t,n){for(var r in t[n]||delete e[n],t)e[r]?Ca(e[r])?e[r]=e[r].concat(t[r]):Pa(e[r])?Pa(t[r])?Object.assign(e,t):(console.warn("unmergable condition, query is object but condition is "+Ra(t)+", can only overwrite",t,n),e[r]=t[r]):(console.warn("to-merge query is of type "+Ra(e)+", can only overwrite",e,t,n),e[r]=t[r]):e[r]=t[r]},e}(),xc=function(){return xc=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},xc.apply(this,arguments)},Rc=function(){function e(e,t,n,r,o){var i=this;this.watch=function(e){return Ic(i._db).watch(xc(xc({},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 dl.reqClass(this._db.config)}return e.prototype.get=function(e){e=e||za();var t=[];this._fieldOrders&&this._fieldOrders.forEach((function(e){t.push(e)}));var n={collectionName:this._coll,queryType:Ks.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:Na.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||za();var t={collectionName:this._coll,queryType:Ks.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(Fs.QueryParamTypeError);var n=Object.keys(t),r=n.some((function(e){return void 0!==t[e]}));if(n.length&&!r)throw Error(Fs.QueryParamValueError);return new e(this._db,this._coll,Tc.encode(t),this._fieldOrders,this._queryOptions)},e.prototype.orderBy=function(t,n){xa.isFieldPath(t),xa.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){xa.isInteger("limit",t);var n=xc({},this._queryOptions);return n.limit=t,new e(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},e.prototype.skip=function(t){xa.isInteger("offset",t);var n=xc({},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||za(),!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:Ks.WHERE,multi:!0,merge:!0,upsert:!1,data:Ec.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=xc({},this._queryOptions);return r.projection=t,new e(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},e.prototype.remove=function(e){e=e||za(),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:Tc.encode(this._fieldFilters),queryType:Ks.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}(),Pc=function(e,t){return Pc=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])},Pc(e,t)};function kc(e,t){function n(){this.constructor=e}Pc(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Cc=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return kc(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t}(Error),Lc=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return kc(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t}(TypeError);function Dc(e){return e&&e.Math==Math&&e}function jc(){return Dc("object"==typeof globalThis&&globalThis)||Dc("object"==typeof window&&window)||Dc("object"==typeof self&&self)||Dc("object"==typeof global&&global)||Function("return this")()}var Uc=function(t){var n,r="object"==typeof(n=jc()).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},Mc=function(){var e=void 0;try{e=require("crypto").randomBytes}catch(e){}return e||Uc}();function Bc(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)}function qc(e){return"object"==typeof e&&null!==e}function Wc(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 Fc(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 Lc("Must use either Buffer or TypedArray")}var Hc=/^(?:[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,$c=function(e){return"string"==typeof e&&Hc.test(e)},Gc=function(t){if(!$c(t))throw new Lc('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")},Kc=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")},Vc=Math.pow(2,53),Jc=-Math.pow(2,53),zc=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 Lc("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=Fc(n),this.position=this.buffer.byteLength)}return t.prototype.put=function(n){if("string"==typeof n&&1!==n.length)throw new Lc("only accepts single character String");if("number"!=typeof n&&1!==n.length)throw new Lc("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 Lc("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(Fc(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 Yc(this.buffer.slice(0,this.position));throw new Cc('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=Gc(n.$uuid)),!o)throw new Lc("Unexpected Binary Extended JSON format ".concat(JSON.stringify(n)));return 4===i?new Yc(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(zc.prototype,"_bsontype",{value:"Binary"});var Yc=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=Fc(r);else{if("string"!=typeof r)throw new Lc("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=Gc(r)}return(s=t.call(this,o,4)||this).__id=i,s}return kc(n,t),Object.defineProperty(n.prototype,"id",{get:function(){return this.buffer},set:function(e){this.buffer=e,n.cacheHexString&&(this.__id=Kc(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=Kc(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 zc(this.id,zc.SUBTYPE_UUID)},n.generate=function(){var t=Mc(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?$c(e):!!Bc(e)&&(16===e.length&&(64==(240&e[6])&&!(128&~e[8])))))},n.createFromHexString=function(e){return new n(Gc(e))},n.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},n.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},n}(zc),Xc=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(Xc.prototype,"_bsontype",{value:"Code"});var Zc=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(Zc.prototype,"_bsontype",{value:"DBRef"});var Qc=void 0;try{Qc=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(Ws){}var eu=4294967296,tu=0x10000000000000000,nu=tu/2,ru={},ou={},iu=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=ou[t])?o:(r=e.fromBits(t,(0|t)<0?-1:0,!0),i&&(ou[t]=r),r):(i=-128<=(t|=0)&&t<128)&&(o=ru[t])?o:(r=e.fromBits(t,t<0?-1:0,!1),i&&(ru[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>=tu)return e.MAX_UNSIGNED_VALUE}else{if(t<=-nu)return e.MIN_VALUE;if(t+1>=nu)return e.MAX_VALUE}return t<0?e.fromNumber(-t,n).neg():e.fromBits(t%eu|0,t/eu|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 qc(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(Qc){if(!this.unsigned&&-2147483648===this.high&&-1===t.low&&-1===t.high)return this;var n=(this.unsigned?Qc.div_u:Qc.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,Qc.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)),Qc){var n=(this.unsigned?Qc.rem_u:Qc.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,Qc.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)),Qc){var n=Qc.mul(this.low,this.high,t.low,t.high);return e.fromBits(n,Qc.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)*eu+(this.low>>>0):this.high*eu+(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(iu.prototype,"__isLong__",{value:!0}),Object.defineProperty(iu.prototype,"_bsontype",{value:"Long"});var su=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,au=/^(\+|-)?(Infinity|inf)$/i,cu=/^(\+|-)?NaN$/i,uu=6111,lu=-6176,fu=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),hu=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),pu=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),du=/^([-+])?(\d+)?$/;function yu(e){return!isNaN(parseInt(e,10))}function gu(e){var t=iu.fromNumber(1e9),n=iu.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 iu(e.parts[r],0)),e.parts[r]=n.div(t).low,n=n.modulo(t);return{quotient:e,rem:n}}function vu(e,t){throw new Lc('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var _u=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!Bc(e))throw new Lc("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new Lc("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 iu(0,0),b=new iu(0,0),w=0;if(n.length>=7e3)throw new Lc(n+" not a valid Decimal128 string");var E=n.match(su),S=n.match(au),I=n.match(cu);if(!E&&!S&&!I||0===n.length)throw new Lc(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&&vu(n,"missing exponent power"),A&&void 0===O&&vu(n,"missing exponent base"),void 0===A&&(T||N)&&vu(n,"missing e before exponent")}if("+"!==n[w]&&"-"!==n[w]||(o="-"===n[w++]),!yu(n[w])&&"."!==n[w]){if("i"===n[w]||"I"===n[w])return new t(e.from(o?hu:pu));if("N"===n[w])return new t(e.from(fu))}for(;yu(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&&vu(n,"contains multiple periods"),i=!0,w+=1);if(i&&!c)throw new Lc(n+" not a valid Decimal128 string");if("e"===n[w]||"E"===n[w]){var x=n.substr(++w).match(du);if(!x||!x[2])return new t(e.from(fu));v=parseInt(x[0],10),w+=x[0].length}if(n[w])return new t(e.from(fu));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=lu:v-=l;v>uu;){if((g+=1)-y>34){if(h.join("").match(/^0+$/)){v=uu;break}vu(n,"overflow")}v-=1}for(;v<lu||p<u;){if(0===g&&a<p){v=lu,a=0;break}if(p<u?u-=1:g-=1,v<uu)v+=1;else{if(h.join("").match(/^0+$/)){v=uu;break}vu(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<uu))return new t(e.from(o?hu:pu));v+=1,h[C]=1}}if(m=iu.fromNumber(0),b=iu.fromNumber(0),0===a)m=iu.fromNumber(0),b=iu.fromNumber(0);else if(g-y<17){C=y;for(b=iu.fromNumber(h[C++]),m=new iu(0,0);C<=g;C++)b=(b=b.multiply(iu.fromNumber(10))).add(iu.fromNumber(h[C]))}else{C=y;for(m=iu.fromNumber(h[C++]);C<=g-17;C++)m=(m=m.multiply(iu.fromNumber(10))).add(iu.fromNumber(h[C]));for(b=iu.fromNumber(h[C++]);C<=g;C++)b=(b=b.multiply(iu.fromNumber(10))).add(iu.fromNumber(h[C]))}var L,D,j,U,M=function(e,t){if(!e&&!t)return{high:iu.fromNumber(0),low:iu.fromNumber(0)};var n=e.shiftRightUnsigned(32),r=new iu(e.getLowBits(),0),o=t.shiftRightUnsigned(32),i=new iu(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 iu(a.getLowBits(),0).add(c).add(u.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:u=a.shiftLeft(32).add(new iu(u.getLowBits(),0))}}(m,iu.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(iu.fromNumber(1))),r=v+6176;var B={low:iu.fromNumber(0),high:iu.fromNumber(0)};M.high.shiftRightUnsigned(49).and(iu.fromNumber(1)).equals(iu.fromNumber(1))?(B.high=B.high.or(iu.fromNumber(3).shiftLeft(61)),B.high=B.high.or(iu.fromNumber(r).and(iu.fromNumber(16383).shiftLeft(47))),B.high=B.high.or(M.high.and(iu.fromNumber(0x7fffffffffff)))):(B.high=B.high.or(iu.fromNumber(16383&r).shiftLeft(49)),B.high=B.high.or(M.high.and(iu.fromNumber(562949953421311)))),B.low=M.low,o&&(B.high=B.high.or(iu.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 iu(h,p),high:new iu(d,y)}.high.lessThan(iu.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=gu(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(_u.prototype,"_bsontype",{value:"Decimal128"});var mu=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(mu.prototype,"_bsontype",{value:"Double"});var bu=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(bu.prototype,"_bsontype",{value:"Int32"});var wu=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(wu.prototype,"_bsontype",{value:"MaxKey"});var Eu=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(Eu.prototype,"_bsontype",{value:"MinKey"});var Su=new RegExp("^[0-9a-fA-F]{24}$"),Iu=null,Ou=Symbol("id"),Au=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 Lc("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[Ou]=t.generate("number"==typeof r?r:void 0);else if(ArrayBuffer.isView(r)&&12===r.byteLength)this[Ou]=r instanceof e?r:Fc(r);else{if("string"!=typeof r)throw new Lc("Argument passed in does not match the accepted types");if(12===r.length){var o=e.from(r);if(12!==o.byteLength)throw new Lc("Argument passed in must be a string of 12 bytes");this[Ou]=o}else{if(24!==r.length||!Su.test(r))throw new Lc("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Ou]=e.from(r,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Ou]},set:function(e){this[Ou]=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===Iu&&(Iu=Mc(5)),o[4]=Iu[0],o[5]=Iu[1],o[6]=Iu[2],o[7]=Iu[3],o[8]=Iu[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[Ou][11]===n[Ou][11]&&this[Ou].equals(n[Ou]);if("string"==typeof n&&t.isValid(n)&&12===n.length&&Bc(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 Lc("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(Au.prototype,"generate",{value:Wc((function(e){return Au.generate(e)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(Au.prototype,"getInc",{value:Wc((function(){return Au.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Au.prototype,"get_inc",{value:Wc((function(){return Au.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Au,"get_inc",{value:Wc((function(){return Au.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Au.prototype,"_bsontype",{value:"ObjectID"});var Tu=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 Cc("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new Cc("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 Cc("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 Lc("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e}();Object.defineProperty(Tu.prototype,"_bsontype",{value:"BSONRegExp"});var Nu=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(Nu.prototype,"_bsontype",{value:"Symbol"});var xu=function(e){function t(n,r){var o=this;return o instanceof t?(o=iu.isLong(n)?e.call(this,n.low,n.high,!0)||this:qc(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 kc(t,e),t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(e){return new t(iu.fromInt(e,!0))},t.fromNumber=function(e){return new t(iu.fromNumber(e,!0))},t.fromBits=function(e,n){return new t(e,n)},t.fromString=function(e,n){return new t(iu.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=iu.MAX_UNSIGNED_VALUE,t}(iu);var Ru=2147483647,Pu=-2147483648,ku=0x8000000000000000,Cu=-0x8000000000000000,Lu={$oid:Au,$binary:zc,$uuid:zc,$symbol:Nu,$numberInt:bu,$numberDecimal:_u,$numberDouble:mu,$numberLong:iu,$minKey:Eu,$maxKey:wu,$regex:Tu,$regularExpression:Tu,$timestamp:xu};function Du(e,t){if(void 0===t&&(t={}),"number"==typeof e){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=Pu&&e<=Ru)return new bu(e);if(e>=Cu&&e<=ku)return iu.fromNumber(e)}return new mu(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=Lu[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)):iu.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=Du(e.$scope)),Xc.fromExtendedJSON(e)}if(function(e){return qc(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 Zc)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 Zc.fromExtendedJSON(c)}return e}function ju(e){var t=e.toISOString();return 0!==e.getUTCMilliseconds()?t:t.slice(0,-5)+"Z"}function Uu(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 Lc("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 Uu(e,t)}finally{t.seenObjects.pop()}}))}(e,t);if(void 0===e)return null;if(e instanceof Date||qc(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:ju(e)}:t.relaxed&&f?{$date:ju(e)}:{$date:{$numberLong:e.getTime().toString()}}}var h;if(!("number"!=typeof e||t.relaxed&&isFinite(e))){if(Math.floor(e)===e){var p=e>=Cu&&e<=ku;if(e>=Pu&&e<=Ru)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 Tu(e.source,d).toExtendedJSON(t)}return null!=e&&"object"==typeof e?function(e,t){if(null==e||"object"!=typeof e)throw new Cc("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=Uu(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 qc(e)&&Reflect.has(e,"_bsontype")&&"string"==typeof e._bsontype}(e)){var s=e;if("function"!=typeof s.toExtendedJSON){var a=Bu[e._bsontype];if(!a)throw new Lc("Unrecognized or invalid _bsontype: "+e._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new Xc(s.code,Uu(s.scope,t)):"DBRef"===n&&s.oid&&(s=new Zc(Uu(s.collection,t),Uu(s.oid,t),Uu(s.db,t),Uu(s.fields,t))),s.toExtendedJSON(t)}throw new Cc("_bsontype must be a string, but was: "+typeof n)}(e,t):e}var Mu,Bu={Binary:function(e){return new zc(e.value(),e.sub_type)},Code:function(e){return new Xc(e.code,e.scope)},DBRef:function(e){return new Zc(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new _u(e.bytes)},Double:function(e){return new mu(e.value)},Int32:function(e){return new bu(e.value)},Long:function(e){return iu.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 wu},MinKey:function(){return new Eu},ObjectID:function(e){return new Au(e)},ObjectId:function(e){return new Au(e)},BSONRegExp:function(e){return new Tu(e.pattern,e.options)},Symbol:function(e){return new Nu(e.value)},Timestamp:function(e){return xu.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 Cc("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(e)));return Du(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=Uu(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)}}(Mu||(Mu={}));var qu=jc();qu.Map?qu.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})}(),iu.fromNumber(Vc),iu.fromNumber(Jc);var Wu=new Uint8Array(8);new DataView(Wu.buffer,Wu.byteOffset,Wu.byteLength);e.alloc(17825792);var Fu=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())}))},Hu=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])}}},$u=function(){function e(e,t){this._stages=[],e&&t&&(this._db=e,this._request=new dl.reqClass(this._db.config),this._collectionName=t)}return e.prototype.end=function(){return Fu(this,void 0,void 0,(function(){var e;return Hu(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(Mu.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",Tc.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}(),Gu=$u,Ku=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)}}(),Vu=function(e){function t(t,n){return e.call(this,t,n)||this}return Ku(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 Ac(this._db,this._coll,e)},t.prototype.add=function(e,t){return new Ac(this._db,this._coll,void 0).create(e,t)},t.prototype.aggregate=function(){return new Gu(this._db,this._coll)},t}(Rc),Ju={eq:function(e){return new rc(tc.EQ,[e])},neq:function(e){return new rc(tc.NEQ,[e])},lt:function(e){return new rc(tc.LT,[e])},lte:function(e){return new rc(tc.LTE,[e])},gt:function(e){return new rc(tc.GT,[e])},gte:function(e){return new rc(tc.GTE,[e])},in:function(e){return new rc(tc.IN,e)},nin:function(e){return new rc(tc.NIN,e)},all:function(e){return new rc(tc.ALL,e)},elemMatch:function(e){return new rc(tc.ELEM_MATCH,[e])},exists:function(e){return new rc(tc.EXISTS,[e])},size:function(e){return new rc(tc.SIZE,[e])},mod:function(e){return new rc(tc.MOD,[e])},geoNear:function(e){return new rc(tc.GEO_NEAR,[e])},geoWithin:function(e){return new rc(tc.GEO_WITHIN,[e])},geoIntersects:function(e){return new rc(tc.GEO_INTERSECTS,[e])},and:function(){var e=Ca(arguments[0])?arguments[0]:Array.from(arguments);return new Qa(Ya.AND,e)},nor:function(){var e=Ca(arguments[0])?arguments[0]:Array.from(arguments);return new Qa(Ya.NOR,e)},or:function(){var e=Ca(arguments[0])?arguments[0]:Array.from(arguments);return new Qa(Ya.OR,e)},not:function(){var e=Ca(arguments[0])?arguments[0]:Array.from(arguments);return new Qa(Ya.NOT,e)},set:function(e){return new Xa(Aa.SET,[e])},remove:function(){return new Xa(Aa.REMOVE,[])},inc:function(e){return new Xa(Aa.INC,[e])},mul:function(e){return new Xa(Aa.MUL,[e])},push:function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(Pa(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=Ca(t[0])?t[0]:Array.from(t);return new Xa(Aa.PUSH,e)},pull:function(e){return new Xa(Aa.PULL,e)},pullAll:function(e){return new Xa(Aa.PULL_ALL,e)},pop:function(){return new Xa(Aa.POP,[])},shift:function(){return new Xa(Aa.SHIFT,[])},unshift:function(){var e=Ca(arguments[0])?arguments[0]:Array.from(arguments);return new Xa(Aa.UNSHIFT,e)},addToSet:function(e){return new Xa(Aa.ADD_TO_SET,e)},rename:function(e){return new Xa(Aa.RENAME,[e])},bit:function(e){return new Xa(Aa.BIT,[e])},max:function(e){return new Xa(Aa.MAX,[e])},min:function(e){return new Xa(Aa.MIN,[e])},expr:function(e){return{$expr:e}},jsonSchema:function(e){return{$jsonSchema:e}},text:function(e){return"string"===Ra(e)?{$search:e.search}:{$search:e.search,$language:e.language,$caseSensitive:e.caseSensitive,$diacriticSensitive:e.diacriticSensitive}},aggregate:{pipeline:function(){return new Gu},abs:function(e){return new zu("abs",e)},add:function(e){return new zu("add",e)},ceil:function(e){return new zu("ceil",e)},divide:function(e){return new zu("divide",e)},exp:function(e){return new zu("exp",e)},floor:function(e){return new zu("floor",e)},ln:function(e){return new zu("ln",e)},log:function(e){return new zu("log",e)},log10:function(e){return new zu("log10",e)},mod:function(e){return new zu("mod",e)},multiply:function(e){return new zu("multiply",e)},pow:function(e){return new zu("pow",e)},sqrt:function(e){return new zu("sqrt",e)},subtract:function(e){return new zu("subtract",e)},trunc:function(e){return new zu("trunc",e)},arrayElemAt:function(e){return new zu("arrayElemAt",e)},arrayToObject:function(e){return new zu("arrayToObject",e)},concatArrays:function(e){return new zu("concatArrays",e)},filter:function(e){return new zu("filter",e)},in:function(e){return new zu("in",e)},indexOfArray:function(e){return new zu("indexOfArray",e)},isArray:function(e){return new zu("isArray",e)},map:function(e){return new zu("map",e)},range:function(e){return new zu("range",e)},reduce:function(e){return new zu("reduce",e)},reverseArray:function(e){return new zu("reverseArray",e)},size:function(e){return new zu("size",e)},slice:function(e){return new zu("slice",e)},zip:function(e){return new zu("zip",e)},and:function(e){return new zu("and",e)},not:function(e){return new zu("not",e)},or:function(e){return new zu("or",e)},cmp:function(e){return new zu("cmp",e)},eq:function(e){return new zu("eq",e)},gt:function(e){return new zu("gt",e)},gte:function(e){return new zu("gte",e)},lt:function(e){return new zu("lt",e)},lte:function(e){return new zu("lte",e)},neq:function(e){return new zu("ne",e)},cond:function(e){return new zu("cond",e)},ifNull:function(e){return new zu("ifNull",e)},switch:function(e){return new zu("switch",e)},dateFromParts:function(e){return new zu("dateFromParts",e)},dateFromString:function(e){return new zu("dateFromString",e)},dayOfMonth:function(e){return new zu("dayOfMonth",e)},dayOfWeek:function(e){return new zu("dayOfWeek",e)},dayOfYear:function(e){return new zu("dayOfYear",e)},isoDayOfWeek:function(e){return new zu("isoDayOfWeek",e)},isoWeek:function(e){return new zu("isoWeek",e)},isoWeekYear:function(e){return new zu("isoWeekYear",e)},millisecond:function(e){return new zu("millisecond",e)},minute:function(e){return new zu("minute",e)},month:function(e){return new zu("month",e)},second:function(e){return new zu("second",e)},hour:function(e){return new zu("hour",e)},week:function(e){return new zu("week",e)},year:function(e){return new zu("year",e)},literal:function(e){return new zu("literal",e)},mergeObjects:function(e){return new zu("mergeObjects",e)},objectToArray:function(e){return new zu("objectToArray",e)},allElementsTrue:function(e){return new zu("allElementsTrue",e)},anyElementTrue:function(e){return new zu("anyElementTrue",e)},setDifference:function(e){return new zu("setDifference",e)},setEquals:function(e){return new zu("setEquals",e)},setIntersection:function(e){return new zu("setIntersection",e)},setIsSubset:function(e){return new zu("setIsSubset",e)},setUnion:function(e){return new zu("setUnion",e)},concat:function(e){return new zu("concat",e)},dateToString:function(e){return new zu("dateToString",e)},indexOfBytes:function(e){return new zu("indexOfBytes",e)},indexOfCP:function(e){return new zu("indexOfCP",e)},split:function(e){return new zu("split",e)},strLenBytes:function(e){return new zu("strLenBytes",e)},strLenCP:function(e){return new zu("strLenCP",e)},strcasecmp:function(e){return new zu("strcasecmp",e)},substr:function(e){return new zu("substr",e)},substrBytes:function(e){return new zu("substrBytes",e)},substrCP:function(e){return new zu("substrCP",e)},toLower:function(e){return new zu("toLower",e)},toUpper:function(e){return new zu("toUpper",e)},meta:function(e){return new zu("meta",e)},addToSet:function(e){return new zu("addToSet",e)},avg:function(e){return new zu("avg",e)},first:function(e){return new zu("first",e)},last:function(e){return new zu("last",e)},max:function(e){return new zu("max",e)},min:function(e){return new zu("min",e)},push:function(e){return new zu("push",e)},stdDevPop:function(e){return new zu("stdDevPop",e)},stdDevSamp:function(e){return new zu("stdDevSamp",e)},sum:function(e){return new zu("sum",e)},let:function(e){return new zu("let",e)}},project:{slice:function(e){return new Yu("slice",e)},elemMatch:function(e){return new Yu("elemMatch",e)}}},zu=function(e,t){this["$"+e]=t},Yu=function(e,t){this["$"+e]=t},Xu=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 Sa},enumerable:!0,configurable:!0}),e}();function Zu(e){return new Xu(e)}var Qu={code:"INSERT_DOC_FAIL",message:"insert document failed"},el={code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"},tl=function(){return tl=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},tl.apply(this,arguments)},nl=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())}))},rl=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])}}},ol="database.updateDocInTransaction",il=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 nl(this,void 0,void 0,(function(){var t,n,r,o;return rl(this,(function(i){switch(i.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,data:Mu.stringify(hc(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=Mu.parse(n.inserted),1==(o=Mu.parse(n.ok))&&1==r)return[2,tl(tl({},n),{ok:o,inserted:r})];throw new Error(Qu.message)}}))}))},e.prototype.get=function(){return nl(this,void 0,void 0,(function(){var e,t;return rl(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?Na.formatField(Mu.parse(t.data)):Mu.parse(t.data),requestId:t.requestId}]}}))}))},e.prototype.set=function(e){return nl(this,void 0,void 0,(function(){var t,n;return rl(this,(function(r){switch(r.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Mu.stringify(hc(e),{relaxed:!1}),upsert:!0},[4,this._request.send(ol,t)];case 1:if((n=r.sent()).code)throw n;return[2,tl(tl({},n),{updated:Mu.parse(n.updated),upserted:n.upserted?JSON.parse(n.upserted):null})]}}))}))},e.prototype.update=function(e){return nl(this,void 0,void 0,(function(){var t,n;return rl(this,(function(r){switch(r.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Mu.stringify(Ec.encode(e),{relaxed:!1})},[4,this._request.send(ol,t)];case 1:if((n=r.sent()).code)throw n;return[2,tl(tl({},n),{updated:Mu.parse(n.updated)})]}}))}))},e.prototype.delete=function(){return nl(this,void 0,void 0,(function(){var e,t;return rl(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,tl(tl({},t),{deleted:Mu.parse(t.deleted)})]}}))}))},e}(),sl=function(e,t){this._coll=t,this._transaction=e},al=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)}}(),cl=function(e){function t(t,n){return e.call(this,t,n)||this}return al(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 il(this._transaction,this._coll,e)},t.prototype.add=function(e){var t;return void 0!==e._id&&(t=e._id),new il(this._transaction,this._coll,t).create(e)},t}(sl),ul=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())}))},ll=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])}}},fl=function(){function e(e){this._db=e,this._request=new dl.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return e.prototype.init=function(){return ul(this,void 0,void 0,(function(){var e;return ll(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 cl(this,e)},e.prototype.getTransactionId=function(){return this._id},e.prototype.getRequestMethod=function(){return this._request},e.prototype.commit=function(){return ul(this,void 0,void 0,(function(){var e,t;return ll(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 ul(this,void 0,void 0,(function(){var t,n;return ll(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 hl(){return ul(this,void 0,void 0,(function(){var e;return ll(this,(function(t){switch(t.label){case 0:return[4,(e=new fl(this)).init()];case 1:return t.sent(),[2,e]}}))}))}function pl(e,t){return void 0===t&&(t=3),ul(this,void 0,void 0,(function(){var n,r,o,i,s=this;return ll(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,10]),[4,(n=new fl(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 ul(s,void 0,void 0,(function(){return ll(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===el.code?[4,pl.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 dl=function(){function e(e){this.config=e,this.Geo=Ja,this.serverDate=Oa,this.command=Ju,this.RegExp=Zu,this.startTransaction=hl,this.runTransaction=pl,this.logicCommand=Qa,this.updateCommand=Xa,this.queryCommand=rc}return e.prototype.collection=function(e){if(!e)throw new Error("Collection name is required");return new Vu(this,e)},e.prototype.createCollection=function(t){var n={collectionName:t};return new e.reqClass(this.config).send("database.addCollection",n)},e}(),yl=function(){return yl=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},yl.apply(this,arguments)};var gl={name:"database",entity:{database:function(e){var t=this.platform,n=t.adapter,r=t.runtime;return dl.reqClass=this.request.constructor,dl.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},dl.runtime=r,this.wsClientClass&&(dl.wsClass=n.wsClass,dl.wsClientClass=this.wsClientClass),dl.ws||(dl.ws=null),new dl(yl(yl({},this.config),e))}}};try{cloudbase.registerComponent(gl)}catch(e){}var vl;Jt.registerVersion("1.7.1");try{!function(e){try{e.registerComponent(Mr)}catch(e){console.warn(e)}}(Jt),function(e){try{e.registerComponent(Xr)}catch(e){console.warn(e)}}(Jt),function(e){try{e.registerComponent(po)}catch(e){console.warn(e)}}(Jt),function(e){try{e.registerComponent(gl)}catch(e){console.warn(e)}}(Jt),function(e){try{e.registerComponent(Ps),e.registerHook(Rs)}catch(e){console.warn(e)}}(Jt),function(e){try{e.registerComponent($s)}catch(e){console.warn(e)}}(Jt)}catch(e){}try{window.cloudbase=Jt}catch(e){}!function(e){e.development="dev-1gpp53ju3ceb46c7",e.testing="dev-1gpp53ju3ceb46c7",e.production="release-7gvojkxi667a3f26"}(vl||(vl={}));var _l=function(){function e(){this.userInfo={userName:""}}return e.prototype.init=function(e){this.userInfo=(null==e?void 0:e.userInfo)||{userName:""}},e.prototype.getParams=function(){return this.userInfo},e}(),ml=new _l,bl={ENV:vl[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};console.log("options",wl);var El=Jt.init(wl);function Sl(e){return r(this,void 0,void 0,(function(){var t,n,r;return o(this,(function(o){switch(o.label){case 0:return console.log("参数",e),(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.operateUser)||(console.log("存储的参数",ml.getParams),e.data.operateUser={name:null===(r=ml.getParams())||void 0===r?void 0:r.userName}),[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}(O())),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}(O())),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}(O())),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}(O())),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}(O())),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}(O())),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}(O(),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}(O(),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}(O(),$l(),P())),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)}})}()}(O(),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}(O(),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}(O(),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}(O(),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}(O(),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}(O(),D(),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}(O(),D(),Wl(),cf(),ff())),Yf.exports}Tl.exports=function(e){return e}(O(),xl(),kl(),Dl(),D(),Ml(),Wl(),$l(),N(),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}(O(),N())),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}(O(),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}(O())),P(),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}(O(),N(),P())),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}(O(),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}(O(),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}(O(),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}(O(),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}(O(),ff())),Lf||(Lf=1,Df.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(O(),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}(O(),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}(O(),D(),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}(O(),D(),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}(O(),D(),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}(O(),D(),Wl(),cf(),ff())),Xf());var Zf=s(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 r(this,void 0,void 0,(function(){return o(this,(function(e){return localStorage.removeItem("x-belink-serverTime"),localStorage.removeItem("x-belink-timeDiff"),[2]}))}))},e.prototype.setupReqeustTime=function(e){return r(this,void 0,void 0,(function(){var t,n,r,i,s,a,c;return o(this,(function(o){switch(o.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,o.sent().json()];case 2:return i=o.sent(),(s=i.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 r(this,void 0,void 0,(function(){var t=this;return o(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,Sl as callFunction,ml as createInit,Ol as request};
|