@cloudbase/oauth 0.1.1-alpha → 0.1.1-alpha.2
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/Dockerfile +15 -0
- package/README.md +1 -1
- package/_exmaple/assets/scripts/function/function.ts +99 -0
- package/_exmaple/assets/scripts/index.ts +99 -0
- package/_exmaple/assets/scripts/request.ts +11 -0
- package/_exmaple/index.html +15 -0
- package/_exmaple/package.json +33 -0
- package/_exmaple/tsconfig.json +71 -0
- package/_exmaple/typings.d.ts +0 -0
- package/_exmaple/webpack.config.js +42 -0
- package/cdnjs/1.0.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.0/cloudbase.database.js +8 -0
- package/cdnjs/1.0.0/cloudbase.full.js +8 -0
- package/cdnjs/1.0.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.0/cloudbase.js +1 -0
- package/cdnjs/1.0.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.0.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.1/cloudbase.database.js +8 -0
- package/cdnjs/1.0.1/cloudbase.full.js +8 -0
- package/cdnjs/1.0.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.1/cloudbase.js +1 -0
- package/cdnjs/1.0.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.0.2/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.2/cloudbase.database.js +8 -0
- package/cdnjs/1.0.2/cloudbase.full.js +8 -0
- package/cdnjs/1.0.2/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.2/cloudbase.js +1 -0
- package/cdnjs/1.0.2/cloudbase.storage.js +1 -0
- package/cdnjs/1.0.3/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.3/cloudbase.database.js +8 -0
- package/cdnjs/1.0.3/cloudbase.full.js +8 -0
- package/cdnjs/1.0.3/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.3/cloudbase.js +1 -0
- package/cdnjs/1.0.3/cloudbase.storage.js +1 -0
- package/cdnjs/1.0.4/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.4/cloudbase.database.js +8 -0
- package/cdnjs/1.0.4/cloudbase.full.js +8 -0
- package/cdnjs/1.0.4/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.4/cloudbase.js +1 -0
- package/cdnjs/1.0.4/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.0/cloudbase.database.js +8 -0
- package/cdnjs/1.1.0/cloudbase.full.js +8 -0
- package/cdnjs/1.1.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.0/cloudbase.js +1 -0
- package/cdnjs/1.1.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.1/cloudbase.database.js +8 -0
- package/cdnjs/1.1.1/cloudbase.full.js +8 -0
- package/cdnjs/1.1.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.1/cloudbase.js +1 -0
- package/cdnjs/1.1.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.2/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.2/cloudbase.database.js +8 -0
- package/cdnjs/1.1.2/cloudbase.full.js +8 -0
- package/cdnjs/1.1.2/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.2/cloudbase.js +1 -0
- package/cdnjs/1.1.2/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.3/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.3/cloudbase.database.js +8 -0
- package/cdnjs/1.1.3/cloudbase.full.js +8 -0
- package/cdnjs/1.1.3/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.3/cloudbase.js +1 -0
- package/cdnjs/1.1.3/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.4/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.4/cloudbase.database.js +8 -0
- package/cdnjs/1.1.4/cloudbase.full.js +8 -0
- package/cdnjs/1.1.4/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.4/cloudbase.js +1 -0
- package/cdnjs/1.1.4/cloudbase.storage.js +1 -0
- package/cdnjs/1.2.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.2.1/cloudbase.database.js +8 -0
- package/cdnjs/1.2.1/cloudbase.full.js +8 -0
- package/cdnjs/1.2.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.2.1/cloudbase.js +1 -0
- package/cdnjs/1.2.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.2.2/cloudbase.auth.js +1 -0
- package/cdnjs/1.2.2/cloudbase.database.js +8 -0
- package/cdnjs/1.2.2/cloudbase.full.js +8 -0
- package/cdnjs/1.2.2/cloudbase.functions.js +1 -0
- package/cdnjs/1.2.2/cloudbase.js +1 -0
- package/cdnjs/1.2.2/cloudbase.storage.js +1 -0
- package/cdnjs/1.2.3/cloudbase.auth.js +1 -0
- package/cdnjs/1.2.3/cloudbase.database.js +8 -0
- package/cdnjs/1.2.3/cloudbase.full.js +8 -0
- package/cdnjs/1.2.3/cloudbase.functions.js +1 -0
- package/cdnjs/1.2.3/cloudbase.js +1 -0
- package/cdnjs/1.2.3/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.0/cloudbase.database.js +8 -0
- package/cdnjs/1.3.0/cloudbase.full.js +8 -0
- package/cdnjs/1.3.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.0/cloudbase.js +1 -0
- package/cdnjs/1.3.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.1/cloudbase.database.js +8 -0
- package/cdnjs/1.3.1/cloudbase.full.js +8 -0
- package/cdnjs/1.3.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.1/cloudbase.js +1 -0
- package/cdnjs/1.3.1/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.2/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.2/cloudbase.database.js +8 -0
- package/cdnjs/1.3.2/cloudbase.full.js +8 -0
- package/cdnjs/1.3.2/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.2/cloudbase.js +1 -0
- package/cdnjs/1.3.2/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.2/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.3/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.3/cloudbase.database.js +8 -0
- package/cdnjs/1.3.3/cloudbase.full.js +8 -0
- package/cdnjs/1.3.3/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.3/cloudbase.js +1 -0
- package/cdnjs/1.3.3/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.3/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.database.js +8 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.full.js +8 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.5/cloudbase.analytics.js +1 -0
- package/cdnjs/1.3.5/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.5/cloudbase.database.js +10 -0
- package/cdnjs/1.3.5/cloudbase.full.js +10 -0
- package/cdnjs/1.3.5/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.5/cloudbase.js +1 -0
- package/cdnjs/1.3.5/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.5/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.database.js +10 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.full.js +10 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.4.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.4.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.4.0/cloudbase.database.js +10 -0
- package/cdnjs/1.4.0/cloudbase.full.js +10 -0
- package/cdnjs/1.4.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.4.0/cloudbase.js +1 -0
- package/cdnjs/1.4.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.4.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.4.1/cloudbase.analytics.js +1 -0
- package/cdnjs/1.4.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.4.1/cloudbase.database.js +10 -0
- package/cdnjs/1.4.1/cloudbase.full.js +10 -0
- package/cdnjs/1.4.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.4.1/cloudbase.js +1 -0
- package/cdnjs/1.4.1/cloudbase.realtime.js +1 -0
- package/cdnjs/1.4.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.database.js +10 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.full.js +10 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.database.js +10 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.full.js +10 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.5.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.5.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.5.0/cloudbase.database.js +10 -0
- package/cdnjs/1.5.0/cloudbase.full.js +10 -0
- package/cdnjs/1.5.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.5.0/cloudbase.js +1 -0
- package/cdnjs/1.5.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.5.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.5.1/cloudbase.analytics.js +1 -0
- package/cdnjs/1.5.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.5.1/cloudbase.database.js +26 -0
- package/cdnjs/1.5.1/cloudbase.full.js +26 -0
- package/cdnjs/1.5.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.5.1/cloudbase.js +1 -0
- package/cdnjs/1.5.1/cloudbase.realtime.js +1 -0
- package/cdnjs/1.5.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.database.js +10 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.full.js +10 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.database.js +26 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.full.js +26 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.6.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.6.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.6.0/cloudbase.database.js +26 -0
- package/cdnjs/1.6.0/cloudbase.full.js +26 -0
- package/cdnjs/1.6.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.6.0/cloudbase.js +1 -0
- package/cdnjs/1.6.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.6.0/cloudbase.storage.js +1 -0
- package/{CHANGELOG.md → changelog.md} +0 -0
- package/dist/README.md +153 -0
- package/{app → dist/app}/index.d.ts +1 -0
- package/{app → dist/app}/index.js +0 -0
- package/dist/app/index.js.map +1 -0
- package/{app → dist/app}/internal.d.ts +0 -0
- package/{app → dist/app}/internal.js +0 -0
- package/{app → dist/app}/internal.js.map +0 -0
- package/{app → dist/app}/openuri.d.ts +0 -0
- package/{app → dist/app}/openuri.js +2 -1
- package/{app → dist/app}/openuri.js.map +1 -1
- package/{app → dist/app}/request.d.ts +4 -3
- package/{app → dist/app}/request.js +20 -12
- package/dist/app/request.js.map +1 -0
- package/{app → dist/app}/storage.d.ts +0 -0
- package/{app → dist/app}/storage.js +0 -0
- package/{app → dist/app}/storage.js.map +0 -0
- package/{auth → dist/auth}/consts.d.ts +21 -4
- package/{auth → dist/auth}/consts.js +27 -5
- package/dist/auth/consts.js.map +1 -0
- package/{auth → dist/auth}/index.d.ts +83 -34
- package/{auth → dist/auth}/index.js +239 -92
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/models.d.ts +284 -0
- package/{oauthclient → dist/auth}/models.js +1 -0
- package/dist/auth/models.js.map +1 -0
- package/{captcha → dist/captcha}/index.d.ts +0 -0
- package/{captcha → dist/captcha}/index.js +4 -2
- package/dist/captcha/index.js.map +1 -0
- package/dist/changelog.md +30 -0
- package/dist/function/index.d.ts +38 -0
- package/dist/function/index.js +80 -0
- package/dist/function/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/{oauthclient → dist/oauthclient}/consts.d.ts +0 -0
- package/{oauthclient → dist/oauthclient}/consts.js +0 -0
- package/{oauthclient → dist/oauthclient}/consts.js.map +0 -0
- package/{oauthclient → dist/oauthclient}/index.d.ts +0 -0
- package/{oauthclient → dist/oauthclient}/index.js +2 -2
- package/dist/oauthclient/index.js.map +1 -0
- package/{oauthclient → dist/oauthclient}/interface.d.ts +4 -0
- package/{oauthclient → dist/oauthclient}/interface.js +0 -0
- package/{oauthclient → dist/oauthclient}/interface.js.map +1 -1
- package/{oauthclient → dist/oauthclient}/models.d.ts +12 -11
- package/{auth → dist/oauthclient}/models.js +0 -0
- package/{oauthclient → dist/oauthclient}/models.js.map +0 -0
- package/{oauthclient → dist/oauthclient}/oauthclient.d.ts +11 -7
- package/{oauthclient → dist/oauthclient}/oauthclient.js +27 -12
- package/dist/oauthclient/oauthclient.js.map +1 -0
- package/dist/package.json +32 -0
- package/{utils/single-promise.d.ts → dist/utils/promise.d.ts} +3 -3
- package/{utils/single-promise.js → dist/utils/promise.js} +6 -6
- package/dist/utils/promise.js.map +1 -0
- package/{utils → dist/utils}/uuid.d.ts +0 -0
- package/{utils → dist/utils}/uuid.js +0 -0
- package/{utils → dist/utils}/uuid.js.map +0 -0
- package/docs/dev.md +71 -0
- package/docs/errlog.md +79 -0
- package/package.json +3 -2
- package/publish.sh +2 -0
- package/src/app/index.ts +83 -0
- package/src/app/internal.ts +26 -0
- package/src/app/openuri.ts +111 -0
- package/src/app/request.ts +66 -0
- package/src/app/storage.ts +58 -0
- package/src/auth/consts.ts +74 -0
- package/src/auth/index.ts +718 -0
- package/src/auth/models.ts +352 -0
- package/src/captcha/index.ts +170 -0
- package/src/function/index.ts +103 -0
- package/src/index.ts +32 -0
- package/src/oauthclient/consts.ts +48 -0
- package/src/oauthclient/index.ts +33 -0
- package/src/oauthclient/interface.ts +34 -0
- package/src/oauthclient/models.ts +50 -0
- package/src/oauthclient/oauthclient.ts +487 -0
- package/src/utils/promise.ts +41 -0
- package/src/utils/uuid.ts +11 -0
- package/test/e2e/cases/custom-login.test.js +122 -0
- package/test/e2e/cases/index.test.js +61 -0
- package/test/e2e/cases/login-state.test.js +89 -0
- package/test/e2e/environment.js +39 -0
- package/test/e2e/global_setup.js +33 -0
- package/test/e2e/global_teardown.js +15 -0
- package/test/e2e/setup.js +37 -0
- package/test/unit/index.test.js +89 -0
- package/test/web/cases/auth/index.js +256 -0
- package/test/web/cases/database/collection.js +173 -0
- package/test/web/cases/database/command.js +754 -0
- package/test/web/cases/database/date.js +122 -0
- package/test/web/cases/database/db.js +20 -0
- package/test/web/cases/database/document.js +160 -0
- package/test/web/cases/database/geo-advanced.js +327 -0
- package/test/web/cases/database/geo.js +105 -0
- package/test/web/cases/database/index.js +315 -0
- package/test/web/cases/database/order.js +83 -0
- package/test/web/cases/database/realtime.js +102 -0
- package/test/web/cases/database/regex.js +140 -0
- package/test/web/cases/ext/index.js +88 -0
- package/test/web/cases/function/index.js +77 -0
- package/test/web/cases/storage/cos.jpeg +0 -0
- package/test/web/cases/storage/index.js +207 -0
- package/test/web/index.html +63 -0
- package/test/web/index.js +109 -0
- package/test/web/util.js +80 -0
- package/tsconfig.json +35 -0
- package/wiki/README.md +75 -0
- package/app/index.js.map +0 -1
- package/app/request.js.map +0 -1
- package/auth/consts.js.map +0 -1
- package/auth/index.js.map +0 -1
- package/auth/models.d.ts +0 -158
- package/auth/models.js.map +0 -1
- package/captcha/index.js.map +0 -1
- package/index.d.ts +0 -8
- package/index.js +0 -17
- package/index.js.map +0 -1
- package/oauthclient/index.js.map +0 -1
- package/oauthclient/oauthclient.js.map +0 -1
- package/utils/single-promise.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_database",[],e):"object"==typeof exports?exports.cloudbase_database=e():t.cloudbase_database=e()}("undefined"!=typeof window?window:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=2)}([function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return It}));var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function u(t,e){return t(e={exports:{}},e.exports),e.exports}for(var s=function(t){var e=g(t),r=e[0],n=e[1];return 3*(r+n)/4-n},f=function(t){var e,r,n=g(t),o=n[0],i=n[1],u=new p(function(t,e,r){return 3*(e+r)/4-r}(0,o,i)),s=0,f=i>0?o-4:o;for(r=0;r<f;r+=4)e=l[t.charCodeAt(r)]<<18|l[t.charCodeAt(r+1)]<<12|l[t.charCodeAt(r+2)]<<6|l[t.charCodeAt(r+3)],u[s++]=e>>16&255,u[s++]=e>>8&255,u[s++]=255&e;2===i&&(e=l[t.charCodeAt(r)]<<2|l[t.charCodeAt(r+1)]>>4,u[s++]=255&e);1===i&&(e=l[t.charCodeAt(r)]<<10|l[t.charCodeAt(r+1)]<<4|l[t.charCodeAt(r+2)]>>2,u[s++]=e>>8&255,u[s++]=255&e);return u},a=function(t){for(var e,r=t.length,n=r%3,o=[],i=0,u=r-n;i<u;i+=16383)o.push(_(t,i,i+16383>u?u:i+16383));1===n?(e=t[r-1],o.push(c[e>>2]+c[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(c[e>>10]+c[e>>4&63]+c[e<<2&63]+"="));return o.join("")},c=[],l=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,y=h.length;d<y;++d)c[d]=h[d],l[h.charCodeAt(d)]=d;function g(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function _(t,e,r){for(var n,o,i=[],u=e;u<r;u+=3)n=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),i.push(c[(o=n)>>18&63]+c[o>>12&63]+c[o>>6&63]+c[63&o]);return i.join("")}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63;var b={byteLength:s,toByteArray:f,fromByteArray:a},m=function(t,e,r,n,o){var i,u,s=8*o-n-1,f=(1<<s)-1,a=f>>1,c=-7,l=r?o-1:0,p=r?-1:1,h=t[e+l];for(l+=p,i=h&(1<<-c)-1,h>>=-c,c+=s;c>0;i=256*i+t[e+l],l+=p,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=n;c>0;u=256*u+t[e+l],l+=p,c-=8);if(0===i)i=1-a;else{if(i===f)return u?NaN:1/0*(h?-1:1);u+=Math.pow(2,n),i-=a}return(h?-1:1)*u*Math.pow(2,i-n)},w=function(t,e,r,n,o,i){var u,s,f,a=8*i-o-1,c=(1<<a)-1,l=c>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=c):(u=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-u))<1&&(u--,f*=2),(e+=u+l>=1?p/f:p*Math.pow(2,1-l))*f>=2&&(u++,f/=2),u+l>=c?(s=0,u=c):u+l>=1?(s=(e*f-1)*Math.pow(2,o),u+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[r+h]=255&s,h+=d,s/=256,o-=8);for(u=u<<o|s,a+=o;a>0;t[r+h]=255&u,h+=d,u/=256,a-=8);t[r+h-d]|=128*y},v=u((function(t,e){var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){+t!=t&&(t=0);return o.alloc(+t)},e.INSPECT_MAX_BYTES=50;function n(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return s(t)}return i(t,e,r)}function i(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|l(t,e),i=n(r),u=i.write(t,e);u!==r&&(i=i.slice(0,u));return i}(t,e);if(ArrayBuffer.isView(t))return f(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if($(t,ArrayBuffer)||t&&$(t.buffer,ArrayBuffer))return a(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&($(t,SharedArrayBuffer)||t&&$(t.buffer,SharedArrayBuffer)))return a(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return o.from(i,e,r);var u=function(t){if(o.isBuffer(t)){var e=0|c(t.length),r=n(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||q(t.length)?n(0):f(t);if("Buffer"===t.type&&Array.isArray(t.data))return f(t.data)}(t);if(u)return u;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function s(t){return u(t),n(t<0?0:0|c(t))}function f(t){for(var e=t.length<0?0:0|c(t.length),r=n(e),o=0;o<e;o+=1)r[o]=255&t[o];return r}function a(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,o.prototype),n}function c(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function l(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||$(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return x(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(t).length;default:if(i)return n?-1:x(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return E(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function h(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,o){var i,u=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,s/=2,f/=2,r/=2}function a(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(o){var c=-1;for(i=r;i<s;i++)if(a(t,i)===a(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===f)return c*u}else-1!==c&&(i-=i-c),c=-1}else for(r+f>s&&(r=s-f),i=r;i>=0;i--){for(var l=!0,p=0;p<f;p++)if(a(t,i+p)!==a(e,p)){l=!1;break}if(l)return i}return-1}function g(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var u=0;u<n;++u){var s=parseInt(e.substr(2*u,2),16);if(q(s))return u;t[r+u]=s}return u}function _(t,e,r,n){return Y(x(e,t.length-r),t,r,n)}function v(t,e,r,n){return Y(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function O(t,e,r,n){return v(t,e,r,n)}function N(t,e,r,n){return Y(C(e),t,r,n)}function S(t,e,r,n){return Y(function(t,e){for(var r,n,o,i=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?b.fromByteArray(t):b.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,u,s,f,a=t[o],c=null,l=a>239?4:a>223?3:a>191?2:1;if(o+l<=r)switch(l){case 1:a<128&&(c=a);break;case 2:128==(192&(i=t[o+1]))&&(f=(31&a)<<6|63&i)>127&&(c=f);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(f=(15&a)<<12|(63&i)<<6|63&u)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:i=t[o+1],u=t[o+2],s=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&s)&&(f=(15&a)<<18|(63&i)<<12|(63&u)<<6|63&s)>65535&&f<1114112&&(c=f)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.kMaxLength=2147483647,o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,r){return i(t,e,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}(t,e,r)},o.allocUnsafe=function(t){return s(t)},o.allocUnsafeSlow=function(t){return s(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if($(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),$(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,u=Math.min(r,n);i<u;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=o.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var u=t[r];if($(u,Uint8Array)&&(u=o.from(u)),!o.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,i),i+=u.length}return n},o.byteLength=l,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)h(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)h(this,e,e+3),h(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)h(this,e,e+7),h(this,e+1,e+6),h(this,e+2,e+5),h(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(t,e,r,n,i){if($(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var u=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),f=Math.min(u,s),a=this.slice(n,i),c=t.slice(e,r),l=0;l<f;++l)if(a[l]!==c[l]){u=a[l],s=c[l];break}return u<s?-1:s<u?1:0},o.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},o.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},o.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},o.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return O(this,t,e,r);case"base64":return N(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function E(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=F[t[i]];return o}function D(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,u){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<u)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),w(t,e,r,n,23,4),r+4}function M(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),w(t,e,r,n,52,8),r+8}o.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},o.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},o.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},o.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),m(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),m(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),m(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),m(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);P(this,t,e,r,o-1,-o)}var i=0,u=1,s=0;for(this[e]=255&t;++i<r&&(u*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);P(this,t,e,r,o-1,-o)}var i=r-1,u=1,s=0;for(this[e+i]=255&t;--i>=0&&(u*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var u=i-1;u>=0;--u)t[u+e]=this[u+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},o.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var u;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(u=e;u<r;++u)this[u]=t;else{var s=o.isBuffer(t)?t:o.from(t,n),f=s.length;if(0===f)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(u=0;u<r-e;++u)this[u+e]=s[u%f]}return this};var j=/[^+/0-9A-Za-z-_]/g;function x(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if((r=t.charCodeAt(u))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function C(t){return b.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function $(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}var F=function(){for(var t=new Array(256),e=0;e<16;++e)for(var r=16*e,n=0;n<16;++n)t[r+n]="0123456789abcdef"[e]+"0123456789abcdef"[n];return t}()})),O=(v.Buffer,v.SlowBuffer,v.INSPECT_MAX_BYTES,v.kMaxLength,function(t,e){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)});var N=function(){return(N=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function S(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function A(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function B(t){return this instanceof B?(this.v=t,this):new B(t)}var E=Object.freeze({__proto__:null,__extends:function(t,e){function r(){this.constructor=t}O(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},get __assign(){return N},__rest:function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r},__decorate:function(t,e,r,n){var o,i=arguments.length,u=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"===("undefined"==typeof Reflect?"undefined":babelHelpers.typeof(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(u=(i<3?o(u):i>3?o(e,r,u):o(e,r))||u);return i>3&&u&&Object.defineProperty(e,r,u),u},__param:function(t,e){return function(r,n){e(r,n,t)}},__metadata:function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":babelHelpers.typeof(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter:function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},__generator:function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},__createBinding:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},__exportStar:function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||(e[r]=t[r])},__values:S,__read:A,__spread:function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(A(arguments[e]));return t},__spreadArrays:function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],u=0,s=i.length;u<s;u++,o++)n[o]=i[u];return n},__await:B,__asyncGenerator:function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},u("next"),u("throw"),u("return"),n[Symbol.asyncIterator]=function(){return this},n;function u(t){o[t]&&(n[t]=function(e){return new Promise((function(r,n){i.push([t,e,r,n])>1||s(t,e)}))})}function s(t,e){try{(r=o[t](e)).value instanceof B?Promise.resolve(r.value.v).then(f,a):c(i[0][2],r)}catch(t){c(i[0][3],t)}var r}function f(t){s("next",t)}function a(t){s("throw",t)}function c(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}},__asyncDelegator:function(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,o){e[n]=t[n]?function(e){return(r=!r)?{value:B(t[n](e)),done:"return"===n}:o?o(e):e}:o}},__asyncValues:function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=S(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}},__makeTemplateObject:function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},__importStar:function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},__importDefault:function(t){return t&&t.__esModule?t:{default:t}},__classPrivateFieldGet:function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},__classPrivateFieldSet:function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}}),T={},I="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},D=/%[sdj%]/g;function R(t){if(!z(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(U(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,o=n.length,i=String(t).replace(D,(function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r<o;u=n[++r])F(u)||!H(u)?i+=" "+u:i+=" "+U(u);return i}var P,L={};function U(t,e){var r={seen:[],stylize:j};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),q(e)?r.showHidden=e:e&&et(r,e),J(r.showHidden)&&(r.showHidden=!1),J(r.depth)&&(r.depth=2),J(r.colors)&&(r.colors=!1),J(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=M),x(r,t,r.depth)}function M(t,e){var r=U.styles[e];return r?"["+U.colors[r][0]+"m"+t+"["+U.colors[r][1]+"m":t}function j(t,e){return t}function x(t,e,r){if(t.customInspect&&e&&W(e.inspect)&&e.inspect!==U&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return z(n)||(n=x(t,n,r)),n}var o=function(t,e){if(J(e))return t.stylize("undefined","undefined");if(z(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(k(e))return t.stylize(""+e,"number");if(q(e))return t.stylize(""+e,"boolean");if(F(e))return t.stylize("null","null")}(t,e);if(o)return o;var i=Object.keys(e),u=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(i);if(t.showHidden&&(i=Object.getOwnPropertyNames(e)),V(e)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return C(e);if(0===i.length){if(W(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(G(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(K(e))return t.stylize(Date.prototype.toString.call(e),"date");if(V(e))return C(e)}var f,a="",c=!1,l=["{","}"];($(e)&&(c=!0,l=["[","]"]),W(e))&&(a=" [Function"+(e.name?": "+e.name:"")+"]");return G(e)&&(a=" "+RegExp.prototype.toString.call(e)),K(e)&&(a=" "+Date.prototype.toUTCString.call(e)),V(e)&&(a=" "+C(e)),0!==i.length||c&&0!=e.length?r<0?G(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),f=c?function(t,e,r,n,o){for(var i=[],u=0,s=e.length;u<s;++u)rt(e,String(u))?i.push(Y(t,e,r,n,String(u),!0)):i.push("");return o.forEach((function(o){o.match(/^\d+$/)||i.push(Y(t,e,r,n,o,!0))})),i}(t,e,r,u,i):i.map((function(n){return Y(t,e,r,u,n,c)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(f,a,l)):l[0]+a+l[1]}function C(t){return"["+Error.prototype.toString.call(t)+"]"}function Y(t,e,r,n,o,i){var u,s,f;if((f=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?s=f.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):f.set&&(s=t.stylize("[Setter]","special")),rt(n,o)||(u="["+o+"]"),s||(t.seen.indexOf(f.value)<0?(s=F(r)?x(t,f.value,null):x(t,f.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),J(u)){if(i&&o.match(/^\d+$/))return s;(u=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+s}function $(t){return Array.isArray(t)}function q(t){return"boolean"==typeof t}function F(t){return null===t}function k(t){return"number"==typeof t}function z(t){return"string"==typeof t}function J(t){return void 0===t}function G(t){return H(t)&&"[object RegExp]"===X(t)}function H(t){return"object"===babelHelpers.typeof(t)&&null!==t}function K(t){return H(t)&&"[object Date]"===X(t)}function V(t){return H(t)&&("[object Error]"===X(t)||t instanceof Error)}function W(t){return"function"==typeof t}function X(t){return Object.prototype.toString.call(t)}function Z(t){return t<10?"0"+t.toString(10):t.toString(10)}U.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},U.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function tt(){var t=new Date,e=[Z(t.getHours()),Z(t.getMinutes()),Z(t.getSeconds())].join(":");return[t.getDate(),Q[t.getMonth()],e].join(" ")}function et(t,e){if(!e||!H(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function rt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var nt={inherits:I,_extend:et,log:function(){console.log("%s - %s",tt(),R.apply(null,arguments))},isBuffer:function(t){return n.isBuffer(t)},isPrimitive:function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===babelHelpers.typeof(t)||void 0===t},isFunction:W,isError:V,isDate:K,isObject:H,isRegExp:G,isUndefined:J,isSymbol:function(t){return"symbol"===babelHelpers.typeof(t)},isString:z,isNumber:k,isNullOrUndefined:function(t){return null==t},isNull:F,isBoolean:q,isArray:$,inspect:U,deprecate:function e(r,n){if(J(t.process))return function(){return e(r,n).apply(this,arguments)};var o=!1;return function(){return o||(console.error(n),o=!0),r.apply(this,arguments)}},format:R,debuglog:function(t){if(J(P)&&(P=""),t=t.toUpperCase(),!L[t])if(new RegExp("\\b"+t+"\\b","i").test(P)){L[t]=function(){var e=R.apply(null,arguments);console.error("%s %d: %s",t,0,e)}}else L[t]=function(){};return L[t]}},ot=u((function(t,e){function r(t){for(var e=v.Buffer.alloc(t),r=0;r<t;++r)e[r]=Math.floor(256*Math.random());return e}if(Object.defineProperty(e,"__esModule",{value:!0}),e.deprecate=e.isObjectLike=e.isDate=e.isBuffer=e.haveBuffer=e.isBigUInt64Array=e.isBigInt64Array=e.isUint8Array=e.randomBytes=e.normalizedFunctionString=void 0,e.normalizedFunctionString=function(t){return t.toString().replace("function(","function (")},e.randomBytes=r,"undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues)e.randomBytes=function(t){return window.crypto.getRandomValues(v.Buffer.alloc(t))};else{try{e.randomBytes=T.randomBytes}catch(t){}null==e.randomBytes&&(e.randomBytes=r)}function n(t){return"object"==typeof t&&null!==t}e.isUint8Array=function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},e.isBigInt64Array=function(t){return"[object BigInt64Array]"===Object.prototype.toString.call(t)},e.isBigUInt64Array=function(t){return"[object BigUint64Array]"===Object.prototype.toString.call(t)},e.haveBuffer=function(){return void 0!==o&&void 0!==o.Buffer},e.isBuffer=function(t){var e;return"object"==typeof t&&"Buffer"===(null===(e=null==t?void 0:t.constructor)||void 0===e?void 0:e.name)},e.isDate=function(t){return n(t)&&"[object Date]"===Object.prototype.toString.call(t)},e.isObjectLike=n,e.deprecate=function(t,e){if("undefined"==typeof window&&"undefined"==typeof self)return nt.deprecate(t,e);var r=!1;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply.apply(t,E.__spreadArrays([this],n))}}}));i(ot);ot.deprecate,ot.isObjectLike,ot.isDate,ot.isBuffer,ot.haveBuffer,ot.isBigUInt64Array,ot.isBigInt64Array,ot.isUint8Array,ot.randomBytes,ot.normalizedFunctionString;var it=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0,e.ensureBuffer=function(t){if(ot.isBuffer(t))return t;if(ArrayBuffer.isView(t))return v.Buffer.from(t.buffer);if(t instanceof ArrayBuffer)return v.Buffer.from(t);throw new TypeError("Must use either Buffer or TypedArray")}}));i(it);it.ensureBuffer;var ut=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseUUID=void 0;var r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;e.parseUUID=function(t){if("string"!=typeof t)throw new TypeError("Invalid type for UUID, expected string but got "+typeof t);if(!r.test(t))throw new TypeError("Invalid format for UUID: "+t);var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}}));i(ut);ut.parseUUID;var st=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;var r=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=r?r:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=v.Buffer.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=v.Buffer.from(e,"binary"):Array.isArray(e)?this.buffer=v.Buffer.from(e):this.buffer=it.ensureBuffer(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new TypeError("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new TypeError("only accepts single character Uint8Array or Array");var r;if((r="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||r>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=v.Buffer.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var r=v.Buffer.alloc(this.buffer.length+t.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}ArrayBuffer.isView(t)?(this.buffer.set(it.ensureBuffer(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?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(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),r=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===r.length?"0"+r:r}:{$binary:{base64:e,subType:1===r.length?"0"+r:r}}},t.fromExtendedJSON=function(e,r){var n,o;if(r=r||{},"$binary"in e?r.legacy&&"string"==typeof e.$binary&&"$type"in e?(o=e.$type?parseInt(e.$type,16):0,n=v.Buffer.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(o=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=v.Buffer.from(e.$binary.base64,"base64")):"$uuid"in e&&(o=4,n=v.Buffer.from(ut.parseUUID(e.$uuid))),!n)throw new TypeError("Unexpected Binary Extended JSON format "+JSON.stringify(e));return new t(n,o)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Binary(Buffer.from("'+this.value(!0).toString("hex")+'", "hex"), '+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_USER_DEFINED=128,t}();e.Binary=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Binary"})}));i(st);st.Binary;var ft=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;var r=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'+t.code+'"'+(t.scope?", "+JSON.stringify(t.scope):"")+")"},t}();e.Code=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Code"})}));i(ft);ft.Code;var at=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0,e.isDBRefLike=function(t){return ot.isObjectLike(t)&&null!=t.$id&&null!=t.$ref};var r=function(){function t(e,r,n,o){if(!(this instanceof t))return new t(e,r,n,o);var i=e.split(".");2===i.length&&(n=i.shift(),e=i.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=o||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'+this.namespace+'", new ObjectId("'+t+'")'+(this.db?', "'+this.db+'"':"")+")"},t}();e.DBRef=r,Object.defineProperty(r.prototype,"_bsontype",{value:"DBRef"})}));i(at);at.DBRef,at.isDBRefLike;var ct=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;var r=void 0;try{r=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(t){}var n={},o={},i=function(){function t(e,r,n){if(void 0===e&&(e=0),void 0===r&&(r=0),!(this instanceof t))return new t(e,r,n);this.low=0|e,this.high=0|r,this.unsigned=!!n,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var i,u,s;return r?(s=0<=(e>>>=0)&&e<256)&&(u=o[e])?u:(i=t.fromBits(e,(0|e)<0?-1:0,!0),s&&(o[e]=i),i):(s=-128<=(e|=0)&&e<128)&&(u=n[e])?u:(i=t.fromBits(e,e<0?-1:0,!1),s&&(n[e]=i),i)},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=0x10000000000000000)return t.MAX_UNSIGNED_VALUE}else{if(e<=-0x8000000000000000)return t.MIN_VALUE;if(e+1>=0x8000000000000000)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%4294967296|0,e/4294967296|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof r?(n=r,r=!1):r=!!r,(n=n||10)<2||36<n)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return t.fromString(e.substring(1),r,n).neg();for(var i=t.fromNumber(Math.pow(n,8)),u=t.ZERO,s=0;s<e.length;s+=8){var f=Math.min(8,e.length-s),a=parseInt(e.substring(s,s+f),n);if(f<8){var c=t.fromNumber(Math.pow(n,f));u=u.mul(c).add(t.fromNumber(a))}else u=(u=u.mul(i)).add(t.fromNumber(a))}return u.unsigned=r,u},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(t){return ot.isObjectLike(t)&&!0===t.__isLong__},t.fromValue=function(e,r){return"number"==typeof e?t.fromNumber(e,r):"string"==typeof e?t.fromString(e,r):t.fromBits(e.low,e.high,"boolean"==typeof r?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=65535&this.high,o=this.low>>>16,i=65535&this.low,u=e.high>>>16,s=65535&e.high,f=e.low>>>16,a=0,c=0,l=0,p=0;return l+=(p+=i+(65535&e.low))>>>16,p&=65535,c+=(l+=o+f)>>>16,l&=65535,a+=(c+=n+s)>>>16,c&=65535,a+=r+u,a&=65535,t.fromBits(l<<16|p,a<<16|c,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(r){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,r.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var o,i,u;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;u=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(o=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(o)),u=o.add(i.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();u=t.ZERO}for(i=this;i.gte(e);){o=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(o)/Math.LN2),f=s<=48?1:Math.pow(2,s-48),a=t.fromNumber(o),c=a.mul(e);c.isNegative()||c.gt(i);)o-=f,c=(a=t.fromNumber(o,this.unsigned)).mul(e);a.isZero()&&(a=t.ONE),u=u.add(a),i=i.sub(c)}return u},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,r=0!==this.high?this.high:this.low;for(e=31;e>0&&0==(r&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),r){var n=(this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,r.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),r){var n=r.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,r.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var o=this.high>>>16,i=65535&this.high,u=this.low>>>16,s=65535&this.low,f=e.high>>>16,a=65535&e.high,c=e.low>>>16,l=65535&e.low,p=0,h=0,d=0,y=0;return d+=(y+=s*l)>>>16,y&=65535,h+=(d+=u*l)>>>16,d&=65535,h+=(d+=s*c)>>>16,d&=65535,p+=(h+=i*l)>>>16,h&=65535,p+=(h+=u*c)>>>16,h&=65535,p+=(h+=s*a)>>>16,h&=65535,p+=o*l+i*c+u*a+s*f,p&=65535,t.fromBits(d<<16|y,p<<16|h,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0===(e&=63))return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}return 32===e?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),o=n.mul(r).sub(this);return n.toString(e)+o.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=t.fromNumber(Math.pow(e,6),this.unsigned),u=this,s="";;){var f=u.div(i),a=(u.sub(f.mul(i)).toInt()>>>0).toString(e);if((u=f).isZero())return a+s;for(;a.length<6;)a="0"+a;s=""+a+s}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'+this.toString()+'")'},t.TWO_PWR_24=t.fromInt(1<<24),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();e.Long=i,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),Object.defineProperty(i.prototype,"_bsontype",{value:"Long"})}));i(ct);ct.Long;var lt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;var r=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,n=/^(\+|-)?(Infinity|inf)$/i,o=/^(\+|-)?NaN$/i,i=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),u=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),s=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),f=/^([-+])?(\d+)?$/;function a(t){return!isNaN(parseInt(t,10))}function c(t){var e=ct.Long.fromNumber(1e9),r=ct.Long.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=(r=r.shiftLeft(32)).add(new ct.Long(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function l(t,e){throw new TypeError('"'+t+'" is not a valid Decimal128 string - '+e)}var p=function(){function t(e){if(!(this instanceof t))return new t(e);this.bytes=e}return t.fromString=function(e){var c,p=!1,h=!1,d=!1,y=0,g=0,_=0,b=0,m=0,w=[0],O=0,N=0,S=0,A=0,B=0,E=0,T=new ct.Long(0,0),I=new ct.Long(0,0),D=0;if(e.length>=7e3)throw new TypeError(e+" not a valid Decimal128 string");var R=e.match(r),P=e.match(n),L=e.match(o);if(!R&&!P&&!L||0===e.length)throw new TypeError(e+" not a valid Decimal128 string");if(R){var U=R[2],M=R[4],j=R[5],x=R[6];M&&void 0===x&&l(e,"missing exponent power"),M&&void 0===U&&l(e,"missing exponent base"),void 0===M&&(j||x)&&l(e,"missing e before exponent")}if("+"!==e[D]&&"-"!==e[D]||(p="-"===e[D++]),!a(e[D])&&"."!==e[D]){if("i"===e[D]||"I"===e[D])return new t(v.Buffer.from(p?u:s));if("N"===e[D])return new t(v.Buffer.from(i))}for(;a(e[D])||"."===e[D];)"."!==e[D]?(O<34&&("0"!==e[D]||d)&&(d||(m=g),d=!0,w[N++]=parseInt(e[D],10),O+=1),d&&(_+=1),h&&(b+=1),g+=1,D+=1):(h&&l(e,"contains multiple periods"),h=!0,D+=1);if(h&&!g)throw new TypeError(e+" not a valid Decimal128 string");if("e"===e[D]||"E"===e[D]){var C=e.substr(++D).match(f);if(!C||!C[2])return new t(v.Buffer.from(i));B=parseInt(C[0],10),D+=C[0].length}if(e[D])return new t(v.Buffer.from(i));if(S=0,O){if(A=O-1,1!==(y=_))for(;"0"===e[m+y-1];)y-=1}else S=0,A=0,w[0]=0,_=1,O=1,y=0;for(B<=b&&b-B>16384?B=-6176:B-=b;B>6111;){if((A+=1)-S>34){if(w.join("").match(/^0+$/)){B=6111;break}l(e,"overflow")}B-=1}for(;B<-6176||O<_;){if(0===A&&y<O){B=-6176,y=0;break}if(O<_?_-=1:A-=1,B<6111)B+=1;else{if(w.join("").match(/^0+$/)){B=6111;break}l(e,"overflow")}}if(A-S+1<y){var Y=g;h&&(m+=1,Y+=1),p&&(m+=1,Y+=1);var $=parseInt(e[m+A+1],10),q=0;if($>=5&&(q=1,5===$))for(q=w[A]%2==1?1:0,E=m+A+2;E<Y;E++)if(parseInt(e[E],10)){q=1;break}if(q)for(var F=A;F>=0;F--)if(++w[F]>9&&(w[F]=0,0===F)){if(!(B<6111))return new t(v.Buffer.from(p?u:s));B+=1,w[F]=1}}if(T=ct.Long.fromNumber(0),I=ct.Long.fromNumber(0),0===y)T=ct.Long.fromNumber(0),I=ct.Long.fromNumber(0);else if(A-S<17){F=S;for(I=ct.Long.fromNumber(w[F++]),T=new ct.Long(0,0);F<=A;F++)I=(I=I.multiply(ct.Long.fromNumber(10))).add(ct.Long.fromNumber(w[F]))}else{F=S;for(T=ct.Long.fromNumber(w[F++]);F<=A-17;F++)T=(T=T.multiply(ct.Long.fromNumber(10))).add(ct.Long.fromNumber(w[F]));for(I=ct.Long.fromNumber(w[F++]);F<=A;F++)I=(I=I.multiply(ct.Long.fromNumber(10))).add(ct.Long.fromNumber(w[F]))}var k,z,J,G,H=function(t,e){if(!t&&!e)return{high:ct.Long.fromNumber(0),low:ct.Long.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new ct.Long(t.getLowBits(),0),o=e.shiftRightUnsigned(32),i=new ct.Long(e.getLowBits(),0),u=r.multiply(o),s=r.multiply(i),f=n.multiply(o),a=n.multiply(i);return u=u.add(s.shiftRightUnsigned(32)),s=new ct.Long(s.getLowBits(),0).add(f).add(a.shiftRightUnsigned(32)),{high:u=u.add(s.shiftRightUnsigned(32)),low:a=s.shiftLeft(32).add(new ct.Long(a.getLowBits(),0))}}(T,ct.Long.fromString("100000000000000000"));H.low=H.low.add(I),k=H.low,z=I,J=k.high>>>0,G=z.high>>>0,(J<G||J===G&&k.low>>>0<z.low>>>0)&&(H.high=H.high.add(ct.Long.fromNumber(1))),c=B+6176;var K={low:ct.Long.fromNumber(0),high:ct.Long.fromNumber(0)};H.high.shiftRightUnsigned(49).and(ct.Long.fromNumber(1)).equals(ct.Long.fromNumber(1))?(K.high=K.high.or(ct.Long.fromNumber(3).shiftLeft(61)),K.high=K.high.or(ct.Long.fromNumber(c).and(ct.Long.fromNumber(16383).shiftLeft(47))),K.high=K.high.or(H.high.and(ct.Long.fromNumber(0x7fffffffffff)))):(K.high=K.high.or(ct.Long.fromNumber(16383&c).shiftLeft(49)),K.high=K.high.or(H.high.and(ct.Long.fromNumber(562949953421311)))),K.low=H.low,p&&(K.high=K.high.or(ct.Long.fromString("9223372036854775808")));var V=v.Buffer.alloc(16);return D=0,V[D++]=255&K.low.low,V[D++]=K.low.low>>8&255,V[D++]=K.low.low>>16&255,V[D++]=K.low.low>>24&255,V[D++]=255&K.low.high,V[D++]=K.low.high>>8&255,V[D++]=K.low.high>>16&255,V[D++]=K.low.high>>24&255,V[D++]=255&K.high.low,V[D++]=K.high.low>>8&255,V[D++]=K.high.low>>16&255,V[D++]=K.high.low>>24&255,V[D++]=255&K.high.high,V[D++]=K.high.high>>8&255,V[D++]=K.high.high>>16&255,V[D++]=K.high.high>>24&255,new t(V)},t.prototype.toString=function(){for(var t,e=0,r=new Array(36),n=0;n<r.length;n++)r[n]=0;var o,i,u,s=0,f=!1,a={parts:[0,0,0,0]},l=[];s=0;var p=this.bytes,h=p[s++]|p[s++]<<8|p[s++]<<16|p[s++]<<24,d=p[s++]|p[s++]<<8|p[s++]<<16|p[s++]<<24,y=p[s++]|p[s++]<<8|p[s++]<<16|p[s++]<<24,g=p[s++]|p[s++]<<8|p[s++]<<16|p[s++]<<24;s=0,{low:new ct.Long(h,d),high:new ct.Long(y,g)}.high.lessThan(ct.Long.ZERO)&&l.push("-");var _=g>>26&31;if(_>>3==3){if(30===_)return l.join("")+"Infinity";if(31===_)return"NaN";t=g>>15&16383,o=8+(g>>14&1)}else o=g>>14&7,t=g>>17&16383;var b=t-6176;if(a.parts[0]=(16383&g)+((15&o)<<14),a.parts[1]=y,a.parts[2]=d,a.parts[3]=h,0===a.parts[0]&&0===a.parts[1]&&0===a.parts[2]&&0===a.parts[3])f=!0;else for(u=3;u>=0;u--){var m=0,w=c(a);if(a=w.quotient,m=w.rem.low)for(i=8;i>=0;i--)r[9*u+i]=m%10,m=Math.floor(m/10)}if(f)e=1,r[s]=0;else for(e=36;!r[s];)e-=1,s+=1;var v=e-1+b;if(v>=34||v<=-7||b>0){if(e>34)return l.push("0"),b>0?l.push("E+"+b):b<0&&l.push("E"+b),l.join("");l.push(""+r[s++]),(e-=1)&&l.push(".");for(n=0;n<e;n++)l.push(""+r[s++]);l.push("E"),v>0?l.push("+"+v):l.push(""+v)}else if(b>=0)for(n=0;n<e;n++)l.push(""+r[s++]);else{var O=e+b;if(O>0)for(n=0;n<O;n++)l.push(""+r[s++]);else l.push("0");for(l.push(".");O++<0;)l.push("0");for(n=0;n<e-Math.max(O-1,0);n++)l.push(""+r[s++])}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'Decimal128.fromString("'+this.toString()+'")'},t}();e.Decimal128=p,Object.defineProperty(p.prototype,"_bsontype",{value:"Decimal128"})}));i(lt);lt.Decimal128;var pt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;var r=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-"+this.value.toFixed(1)}:(Number.isInteger(this.value)?(e=this.value.toFixed(1)).length>=13&&(e=this.value.toExponential(13).toUpperCase()):e=this.value.toString(),{$numberDouble:e});var e},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Double("+this.toExtendedJSON().$numberDouble+")"},t}();e.Double=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Double"})}));i(pt);pt.Double;var ht=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;var r=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32("+this.valueOf()+")"},t}();e.Int32=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Int32"})}));i(ht);ht.Int32;var dt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;var r=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();e.MaxKey=r,Object.defineProperty(r.prototype,"_bsontype",{value:"MaxKey"})}));i(dt);dt.MaxKey;var yt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;var r=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();e.MinKey=r,Object.defineProperty(r.prototype,"_bsontype",{value:"MinKey"})}));i(yt);yt.MinKey;var gt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;for(var r=ot.randomBytes(5),n=new RegExp("^[0-9a-fA-F]{24}$"),o=[],i=0;i<256;i++)o[i]=(i<=15?"0":"")+i.toString(16);for(var u=[],s=0;s<10;)u[48+s]=s++;for(;s<16;)u[55+s]=u[87+s]=s++;var f=Symbol("id"),a=function(){function t(e){if(!(this instanceof t))return new t(e);if(e instanceof t&&(this[f]=e.id,this.__id=e.__id),"object"==typeof e&&e&&"id"in e&&("toHexString"in e&&"function"==typeof e.toHexString?this[f]=v.Buffer.from(e.toHexString(),"hex"):this[f]="string"==typeof e.id?v.Buffer.from(e.id):e.id),null!=e&&"number"!=typeof e||(this[f]=t.generate("number"==typeof e?e:void 0),t.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(e)&&12===e.byteLength&&(this[f]=it.ensureBuffer(e)),"string"==typeof e)if(12===e.length){var r=v.Buffer.from(e);12===r.byteLength&&(this[f]=r)}else{if(24!==e.length||!n.test(e))throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");this[f]=v.Buffer.from(e,"hex")}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[f]},set:function(e){this[f]=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(t){this.id.writeUInt32BE(t,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(e){"number"!=typeof e&&(e=~~(Date.now()/1e3));var n=t.getInc(),o=v.Buffer.alloc(12);return o.writeUInt32BE(e,0),o[4]=r[0],o[5]=r[1],o[6]=r[2],o[7]=r[3],o[8]=r[4],o[11]=255&n,o[10]=n>>8&255,o[9]=n>>16&255,o},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){return null!=e&&(e instanceof t?this.toString()===e.toString():"string"==typeof e&&t.isValid(e)&&12===e.length&&this.id instanceof v.Buffer?e===this.id.toString("binary"):"string"==typeof e&&t.isValid(e)&&24===e.length?e.toLowerCase()===this.toHexString():"string"==typeof e&&t.isValid(e)&&12===e.length?v.Buffer.from(e).equals(this.id):"object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString&&e.toHexString()===this.toHexString())},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var r=v.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(v.Buffer.from(e,"hex"))},t.isValid=function(e){return null!=e&&("number"==typeof e||("string"==typeof e?12===e.length||24===e.length&&n.test(e):e instanceof t||(e instanceof v.Buffer&&12===e.length||"object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString&&("string"==typeof e.id?12===e.id.length:24===e.toHexString().length&&n.test(e.id.toString("hex"))))))},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("'+this.toHexString()+'")'},t.index=~~(16777215*Math.random()),t}();e.ObjectId=a,Object.defineProperty(a.prototype,"generate",{value:ot.deprecate((function(t){return a.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(a.prototype,"getInc",{value:ot.deprecate((function(){return a.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(a.prototype,"get_inc",{value:ot.deprecate((function(){return a.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(a,"get_inc",{value:ot.deprecate((function(){return a.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(a.prototype,"_bsontype",{value:"ObjectID"})}));i(gt);gt.ObjectId;var _t=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;var r=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.pattern=e,this.options=null!=r?r:"",this.options.split("").sort().join("");for(var n=0;n<this.options.length;n++)if("i"!==this.options[n]&&"m"!==this.options[n]&&"x"!==this.options[n]&&"l"!==this.options[n]&&"s"!==this.options[n]&&"u"!==this.options[n])throw new Error("The regular expression option ["+this.options[n]+"] is not supported")}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new TypeError("Unexpected BSONRegExp EJSON object form: "+JSON.stringify(e))},t}();e.BSONRegExp=r,Object.defineProperty(r.prototype,"_bsontype",{value:"BSONRegExp"})}));i(_t);_t.BSONRegExp;var bt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;var r=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'+this.value+'")'},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();e.BSONSymbol=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Symbol"})}));i(bt);bt.BSONSymbol;var mt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=ct.Long;var r=function(t){function e(r,n){var o=this;return o instanceof e?(o=ct.Long.isLong(r)?t.call(this,r.low,r.high,!0)||this:t.call(this,r,n,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new e(r,n)}return E.__extends(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(ct.Long.fromInt(t,!0))},e.fromNumber=function(t){return new e(ct.Long.fromNumber(t,!0))},e.fromBits=function(t,r){return new e(t,r)},e.fromString=function(t,r){return new e(ct.Long.fromString(t,!0,r))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp.i,t.$timestamp.t)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp("+this.getLowBits().toString()+", "+this.getHighBits().toString()+")"},e.MAX_VALUE=ct.Long.MAX_UNSIGNED_VALUE,e}(e.LongWithoutOverridesClass);e.Timestamp=r}));i(mt);mt.Timestamp,mt.LongWithoutOverridesClass;var wt=u((function(t,e){function r(t){return ot.isObjectLike(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0,e.isBSONType=r;var n={$oid:gt.ObjectId,$binary:st.Binary,$uuid:st.Binary,$symbol:bt.BSONSymbol,$numberInt:ht.Int32,$numberDecimal:lt.Decimal128,$numberDouble:pt.Double,$numberLong:ct.Long,$minKey:yt.MinKey,$maxKey:dt.MaxKey,$regex:_t.BSONRegExp,$regularExpression:_t.BSONRegExp,$timestamp:mt.Timestamp};function o(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function i(t,e){if(Array.isArray(t))return function(t,e){return t.map((function(t){return i(t,e)}))}(t,e);if(void 0===t)return null;if(t instanceof Date){var n=t.getTime(),s=n>-1&&n<2534023188e5;return e.legacy?e.relaxed&&s?{$date:t.getTime()}:{$date:o(t)}:e.relaxed&&s?{$date:o(t)}:{$date:{$numberLong:t.getTime().toString()}}}if("number"==typeof t&&!e.relaxed){if(Math.floor(t)===t){var f=t>=-0x8000000000000000&&t<=0x8000000000000000;if(t>=-2147483648&&t<=2147483647)return{$numberInt:t.toString()};if(f)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp){var a=t.flags;if(void 0===a){var c=t.toString().match(/[gimuy]*$/);c&&(a=c[0])}return new _t.BSONRegExp(t.source,a).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new Error("not an object instance");var n=t._bsontype;if(void 0===n){var o={};for(var s in t)o[s]=i(t[s],e);return o}if(r(t)){var f=t;if("function"!=typeof f.toExtendedJSON){var a=u[t._bsontype];if(!a)throw new TypeError("Unrecognized or invalid _bsontype: "+t._bsontype);f=a(f)}return"Code"===n&&f.scope?f=new ft.Code(f.code,i(f.scope,e)):"DBRef"===n&&f.oid&&(f=new at.DBRef(f.collection,i(f.oid,e),f.db,f.fields)),f.toExtendedJSON(e)}throw new Error("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var u={Binary:function(t){return new st.Binary(t.value(),t.sub_type)},Code:function(t){return new ft.Code(t.code,t.scope)},DBRef:function(t){return new at.DBRef(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new lt.Decimal128(t.bytes)},Double:function(t){return new pt.Double(t.value)},Int32:function(t){return new ht.Int32(t.value)},Long:function(t){return ct.Long.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new dt.MaxKey},MinKey:function(){return new yt.MinKey},ObjectID:function(t){return new gt.ObjectId(t)},ObjectId:function(t){return new gt.ObjectId(t)},BSONRegExp:function(t){return new _t.BSONRegExp(t.pattern,t.options)},Symbol:function(t){return new bt.BSONSymbol(t.value)},Timestamp:function(t){return mt.Timestamp.fromBits(t.low,t.high)}};!function(t){function e(t,e){var r=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof r.relaxed&&(r.strict=!r.relaxed),"boolean"==typeof r.strict&&(r.relaxed=!r.strict),JSON.parse(t,(function(t,e){return function t(e,r){if(void 0===r&&(r={}),"number"==typeof e){if(r.relaxed||r.legacy)return e;if(Math.floor(e)===e){if(e>=-2147483648&&e<=2147483647)return new ht.Int32(e);if(e>=-0x8000000000000000&&e<=0x8000000000000000)return ct.Long.fromNumber(e)}return new pt.Double(e)}if(null==e||"object"!=typeof e)return e;if(e.$undefined)return null;for(var o=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),i=0;i<o.length;i++){var u=n[o[i]];if(u)return u.fromExtendedJSON(e,r)}if(null!=e.$date){var s=e.$date,f=new Date;return r.legacy?"number"==typeof s?f.setTime(s):"string"==typeof s&&f.setTime(Date.parse(s)):"string"==typeof s?f.setTime(Date.parse(s)):ct.Long.isLong(s)?f.setTime(s.toNumber()):"number"==typeof s&&r.relaxed&&f.setTime(s),f}if(null!=e.$code){var a=Object.assign({},e);return e.$scope&&(a.$scope=t(e.$scope)),ft.Code.fromExtendedJSON(e)}if(null!=e.$ref||null!=e.$dbPointer){var c=e.$ref?e:e.$dbPointer;if(c instanceof at.DBRef)return c;var l=Object.keys(c).filter((function(t){return t.startsWith("$")})),p=!0;if(l.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(p=!1)})),p)return at.DBRef.fromExtendedJSON(c)}return e}(e,r)}))}function r(t,e,r,n){null!=r&&"object"==typeof r&&(n=r,r=0),null==e||"object"!=typeof e||Array.isArray(e)||(n=e,e=void 0,r=0);var o=i(t,n=Object.assign({},{relaxed:!0,legacy:!1},n));return JSON.stringify(o,e,r)}t.parse=e,t.stringify=r,t.serialize=function(t,e){return e=e||{},JSON.parse(r(t,e))},t.deserialize=function(t,r){return r=r||{},e(JSON.stringify(t),r)}}(e.EJSON||(e.EJSON={}))}));i(wt);wt.EJSON,wt.isBSONType;var vt=u((function(t,e){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0,e.Map=r;var n=function(t){return t&&t.Math==Math&&t};var i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof o&&o)||Function("return this")();Object.prototype.hasOwnProperty.call(i,"Map")?e.Map=r=i.Map:e.Map=r=function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var r=t[e],n=r[0],o=r[1];this._keys.push(n),this._values[n]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?[r,t._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(t,e){e=e||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];t.call(e,this._values[n].v,n,e)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?t._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}()}));i(vt);vt.Map;var Ot=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_DATA_MAX_KEY=e.BSON_DATA_MIN_KEY=e.BSON_DATA_DECIMAL128=e.BSON_DATA_LONG=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_INT=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_SYMBOL=e.BSON_DATA_CODE=e.BSON_DATA_DBPOINTER=e.BSON_DATA_REGEXP=e.BSON_DATA_NULL=e.BSON_DATA_DATE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_OID=e.BSON_DATA_UNDEFINED=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_DATA_OBJECT=e.BSON_DATA_STRING=e.BSON_DATA_NUMBER=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=void 0,e.BSON_INT32_MAX=2147483647,e.BSON_INT32_MIN=-2147483648,e.BSON_INT64_MAX=Math.pow(2,63)-1,e.BSON_INT64_MIN=-Math.pow(2,63),e.JS_INT_MAX=Math.pow(2,53),e.JS_INT_MIN=-Math.pow(2,53),e.BSON_DATA_NUMBER=1,e.BSON_DATA_STRING=2,e.BSON_DATA_OBJECT=3,e.BSON_DATA_ARRAY=4,e.BSON_DATA_BINARY=5,e.BSON_DATA_UNDEFINED=6,e.BSON_DATA_OID=7,e.BSON_DATA_BOOLEAN=8,e.BSON_DATA_DATE=9,e.BSON_DATA_NULL=10,e.BSON_DATA_REGEXP=11,e.BSON_DATA_DBPOINTER=12,e.BSON_DATA_CODE=13,e.BSON_DATA_SYMBOL=14,e.BSON_DATA_CODE_W_SCOPE=15,e.BSON_DATA_INT=16,e.BSON_DATA_TIMESTAMP=17,e.BSON_DATA_LONG=18,e.BSON_DATA_DECIMAL128=19,e.BSON_DATA_MIN_KEY=255,e.BSON_DATA_MAX_KEY=127,e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BSON_BINARY_SUBTYPE_FUNCTION=1,e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,e.BSON_BINARY_SUBTYPE_UUID=3,e.BSON_BINARY_SUBTYPE_UUID_NEW=4,e.BSON_BINARY_SUBTYPE_MD5=5,e.BSON_BINARY_SUBTYPE_USER_DEFINED=128}));i(Ot);Ot.BSON_BINARY_SUBTYPE_USER_DEFINED,Ot.BSON_BINARY_SUBTYPE_MD5,Ot.BSON_BINARY_SUBTYPE_UUID_NEW,Ot.BSON_BINARY_SUBTYPE_UUID,Ot.BSON_BINARY_SUBTYPE_BYTE_ARRAY,Ot.BSON_BINARY_SUBTYPE_FUNCTION,Ot.BSON_BINARY_SUBTYPE_DEFAULT,Ot.BSON_DATA_MAX_KEY,Ot.BSON_DATA_MIN_KEY,Ot.BSON_DATA_DECIMAL128,Ot.BSON_DATA_LONG,Ot.BSON_DATA_TIMESTAMP,Ot.BSON_DATA_INT,Ot.BSON_DATA_CODE_W_SCOPE,Ot.BSON_DATA_SYMBOL,Ot.BSON_DATA_CODE,Ot.BSON_DATA_DBPOINTER,Ot.BSON_DATA_REGEXP,Ot.BSON_DATA_NULL,Ot.BSON_DATA_DATE,Ot.BSON_DATA_BOOLEAN,Ot.BSON_DATA_OID,Ot.BSON_DATA_UNDEFINED,Ot.BSON_DATA_BINARY,Ot.BSON_DATA_ARRAY,Ot.BSON_DATA_OBJECT,Ot.BSON_DATA_STRING,Ot.BSON_DATA_NUMBER,Ot.JS_INT_MIN,Ot.JS_INT_MAX,Ot.BSON_INT64_MIN,Ot.BSON_INT64_MAX,Ot.BSON_INT32_MIN,Ot.BSON_INT32_MAX;var Nt=u((function(t,e){function r(t,e,r){var o=5;if(Array.isArray(t))for(var i=0;i<t.length;i++)o+=n(i.toString(),t[i],e,!0,r);else for(var u in t.toBSON&&(t=t.toBSON()),t)o+=n(u,t[u],e,!1,r);return o}function n(t,e,n,o,i){switch(void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===i&&(i=!1),e&&e.toBSON&&(e=e.toBSON()),typeof e){case"string":return 1+v.Buffer.byteLength(t,"utf8")+1+4+v.Buffer.byteLength(e,"utf8")+1;case"number":return Math.floor(e)===e&&e>=Ot.JS_INT_MIN&&e<=Ot.JS_INT_MAX&&e>=Ot.BSON_INT32_MIN&&e<=Ot.BSON_INT32_MAX?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+5:(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;case"undefined":return o||!i?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+2;case"object":if(null==e||"MinKey"===e._bsontype||"MaxKey"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1;if("ObjectId"===e._bsontype||"ObjectID"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+13;if(e instanceof Date||ot.isDate(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+6+e.byteLength;if("Long"===e._bsontype||"Double"===e._bsontype||"Timestamp"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;if("Decimal128"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+17;if("Code"===e._bsontype)return null!=e.scope&&Object.keys(e.scope).length>0?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+4+v.Buffer.byteLength(e.code.toString(),"utf8")+1+r(e.scope,n,i):(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+v.Buffer.byteLength(e.code.toString(),"utf8")+1;if("Binary"===e._bsontype)return e.sub_type===st.Binary.SUBTYPE_BYTE_ARRAY?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+(e.position+1+4+1+4):(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+(e.position+1+4+1);if("Symbol"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+v.Buffer.byteLength(e.value,"utf8")+4+1+1;if("DBRef"===e._bsontype){var u=Object.assign({$ref:e.collection,$id:e.oid},e.fields);return null!=e.db&&(u.$db=e.db),(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+r(u,n,i)}return e instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(e)?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1:"BSONRegExp"===e._bsontype?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.pattern,"utf8")+1+v.Buffer.byteLength(e.options,"utf8")+1:(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+r(e,n,i)+1;case"function":if(e instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(e)||"[object RegExp]"===String.call(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1;if(n&&null!=e.scope&&Object.keys(e.scope).length>0)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+4+v.Buffer.byteLength(ot.normalizedFunctionString(e),"utf8")+1+r(e.scope,n,i);if(n)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+v.Buffer.byteLength(ot.normalizedFunctionString(e),"utf8")+1}return 0}Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0,e.calculateObjectSize=r}));i(Nt);Nt.calculateObjectSize;var St=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;e.validateUtf8=function(t,e,r){for(var n=0,o=e;o<r;o+=1){var i=t[o];if(n){if(128!=(192&i))return!1;n-=1}else if(128&i)if(192==(224&i))n=1;else if(224==(240&i))n=2;else{if(240!=(248&i))return!1;n=3}}return!n}}));i(St);St.validateUtf8;var At=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;var r=ct.Long.fromNumber(Ot.JS_INT_MAX),n=ct.Long.fromNumber(Ot.JS_INT_MIN),o={};function i(t,e,s,f){void 0===f&&(f=!1);var a=null!=s.evalFunctions&&s.evalFunctions,c=null!=s.cacheFunctions&&s.cacheFunctions,l=null==s.fieldsAsRaw?null:s.fieldsAsRaw,p=null!=s.raw&&s.raw,h="boolean"==typeof s.bsonRegExp&&s.bsonRegExp,d=null!=s.promoteBuffers&&s.promoteBuffers,y=null==s.promoteLongs||s.promoteLongs,g=null==s.promoteValues||s.promoteValues,_=e;if(t.length<5)throw new Error("corrupt bson message < 5 bytes long");var b=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(b<5||b>t.length)throw new Error("corrupt bson message");for(var m=f?[]:{},w=0;;){var O=t[e++];if(0===O)break;for(var N=e;0!==t[N]&&N<t.length;)N++;if(N>=t.byteLength)throw new Error("Bad BSON Document: illegal CString");var S=f?w++:t.toString("utf8",e,N);if(e=N+1,O===Ot.BSON_DATA_STRING){if((K=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||K>t.length-e||0!==t[e+K-1])throw new Error("bad string length in bson");if(!St.validateUtf8(t,e,e+K-1))throw new Error("Invalid UTF-8 string in BSON document");var A=t.toString("utf8",e,e+K-1);m[S]=A,e+=K}else if(O===Ot.BSON_DATA_OID){var B=v.Buffer.alloc(12);t.copy(B,0,e,e+12),m[S]=new gt.ObjectId(B),e+=12}else if(O===Ot.BSON_DATA_INT&&!1===g)m[S]=new ht.Int32(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24);else if(O===Ot.BSON_DATA_INT)m[S]=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;else if(O===Ot.BSON_DATA_NUMBER&&!1===g)m[S]=new pt.Double(t.readDoubleLE(e)),e+=8;else if(O===Ot.BSON_DATA_NUMBER)m[S]=t.readDoubleLE(e),e+=8;else if(O===Ot.BSON_DATA_DATE){var E=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;m[S]=new Date(new ct.Long(E,T).toNumber())}else if(O===Ot.BSON_DATA_BOOLEAN){if(0!==t[e]&&1!==t[e])throw new Error("illegal boolean type value");m[S]=1===t[e++]}else if(O===Ot.BSON_DATA_OBJECT){var I=e;if((G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)<=0||G>t.length-e)throw new Error("bad embedded document length in bson");m[S]=p?t.slice(e,e+G):i(t,I,s,!1),e+=G}else if(O===Ot.BSON_DATA_ARRAY){I=e;var D=s,R=e+(G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24);if(l&&l[S]){for(var P in D={},s)D[P]=s[P];D.raw=!0}if(m[S]=i(t,I,D,!0),0!==t[(e+=G)-1])throw new Error("invalid array terminator byte");if(e!==R)throw new Error("corrupted array bson")}else if(O===Ot.BSON_DATA_UNDEFINED)m[S]=void 0;else if(O===Ot.BSON_DATA_NULL)m[S]=null;else if(O===Ot.BSON_DATA_LONG){E=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;var L=new ct.Long(E,T);m[S]=y&&!0===g&&L.lessThanOrEqual(r)&&L.greaterThanOrEqual(n)?L.toNumber():L}else if(O===Ot.BSON_DATA_DECIMAL128){var U=v.Buffer.alloc(16);t.copy(U,0,e,e+16),e+=16;var M=new lt.Decimal128(U);"toObject"in M&&"function"==typeof M.toObject?m[S]=M.toObject():m[S]=M}else if(O===Ot.BSON_DATA_BINARY){var j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,x=j,C=t[e++];if(j<0)throw new Error("Negative binary type element size found");if(j>t.byteLength)throw new Error("Binary type size larger than document size");if(null!=t.slice){if(C===st.Binary.SUBTYPE_BYTE_ARRAY){if((j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>x-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(j<x-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}m[S]=d&&g?t.slice(e,e+j):new st.Binary(t.slice(e,e+j),C)}else{var Y=v.Buffer.alloc(j);if(C===st.Binary.SUBTYPE_BYTE_ARRAY){if((j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>x-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(j<x-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(N=0;N<j;N++)Y[N]=t[e+N];m[S]=d&&g?Y:new st.Binary(Y,C)}e+=j}else if(O===Ot.BSON_DATA_REGEXP&&!1===h){for(N=e;0!==t[N]&&N<t.length;)N++;if(N>=t.length)throw new Error("Bad BSON Document: illegal CString");var $=t.toString("utf8",e,N);for(N=e=N+1;0!==t[N]&&N<t.length;)N++;if(N>=t.length)throw new Error("Bad BSON Document: illegal CString");var q=t.toString("utf8",e,N);e=N+1;var F=new Array(q.length);for(N=0;N<q.length;N++)switch(q[N]){case"m":F[N]="m";break;case"s":F[N]="g";break;case"i":F[N]="i"}m[S]=new RegExp($,F.join(""))}else if(O===Ot.BSON_DATA_REGEXP&&!0===h){for(N=e;0!==t[N]&&N<t.length;)N++;if(N>=t.length)throw new Error("Bad BSON Document: illegal CString");$=t.toString("utf8",e,N);for(N=e=N+1;0!==t[N]&&N<t.length;)N++;if(N>=t.length)throw new Error("Bad BSON Document: illegal CString");q=t.toString("utf8",e,N);e=N+1,m[S]=new _t.BSONRegExp($,q)}else if(O===Ot.BSON_DATA_SYMBOL){if((K=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||K>t.length-e||0!==t[e+K-1])throw new Error("bad string length in bson");var k=t.toString("utf8",e,e+K-1);m[S]=g?k:new bt.BSONSymbol(k),e+=K}else if(O===Ot.BSON_DATA_TIMESTAMP){E=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;m[S]=new mt.Timestamp(E,T)}else if(O===Ot.BSON_DATA_MIN_KEY)m[S]=new yt.MinKey;else if(O===Ot.BSON_DATA_MAX_KEY)m[S]=new dt.MaxKey;else if(O===Ot.BSON_DATA_CODE){if((K=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||K>t.length-e||0!==t[e+K-1])throw new Error("bad string length in bson");var z=t.toString("utf8",e,e+K-1);m[S]=a?c?u(z,o,m):u(z):new ft.Code(z),e+=K}else if(O===Ot.BSON_DATA_CODE_W_SCOPE){var J=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(J<13)throw new Error("code_w_scope total size shorter minimum expected length");if((K=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||K>t.length-e||0!==t[e+K-1])throw new Error("bad string length in bson");z=t.toString("utf8",e,e+K-1),I=e+=K;var G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24,H=i(t,I,s,!1);if(e+=G,J<8+G+K)throw new Error("code_w_scope total size is too short, truncating scope");if(J>8+G+K)throw new Error("code_w_scope total size is too long, clips outer document");a?(m[S]=c?u(z,o,m):u(z),m[S].scope=H):m[S]=new ft.Code(z,H)}else{if(O!==Ot.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+O.toString(16)+' for fieldname "'+S+'"');var K;if((K=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||K>t.length-e||0!==t[e+K-1])throw new Error("bad string length in bson");if(!St.validateUtf8(t,e,e+K-1))throw new Error("Invalid UTF-8 string in BSON document");var V=t.toString("utf8",e,e+K-1);e+=K;var W=v.Buffer.alloc(12);t.copy(W,0,e,e+12);B=new gt.ObjectId(W);e+=12,m[S]=new at.DBRef(V,B)}}if(b!==e-_){if(f)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}var X=Object.keys(m).filter((function(t){return t.startsWith("$")})),Z=!0;if(X.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(Z=!1)})),!Z)return m;if(at.isDBRefLike(m)){var Q=Object.assign({},m);return delete Q.$ref,delete Q.$id,delete Q.$db,new at.DBRef(m.$ref,m.$id,m.$db,Q)}return m}function u(t,e,r){return e?(null==e[t]&&(e[t]=new Function(t)),e[t].bind(r)):new Function(t)}e.deserialize=function(t,e,r){var n=(e=null==e?{}:e)&&e.index?e.index:0,o=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;if(o<5)throw new Error("bson size must be >= 5, is "+o);if(e.allowObjectSmallerThanBufferSize&&t.length<o)throw new Error("buffer length "+t.length+" must be >= bson size "+o);if(!e.allowObjectSmallerThanBufferSize&&t.length!==o)throw new Error("buffer length "+t.length+" must === bson size "+o);if(o+n>t.byteLength)throw new Error("(bson size "+o+" + options.index "+n+" must be <= buffer length "+t.byteLength+")");if(0!==t[n+o-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return i(t,n,e,r)}}));i(At);At.deserialize;var Bt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0,e.readIEEE754=function(t,e,r,n,o){var i,u,s="big"===r,f=8*o-n-1,a=(1<<f)-1,c=a>>1,l=-7,p=s?0:o-1,h=s?1:-1,d=t[e+p];for(p+=h,i=d&(1<<-l)-1,d>>=-l,l+=f;l>0;i=256*i+t[e+p],p+=h,l-=8);for(u=i&(1<<-l)-1,i>>=-l,l+=n;l>0;u=256*u+t[e+p],p+=h,l-=8);if(0===i)i=1-c;else{if(i===a)return u?NaN:1/0*(d?-1:1);u+=Math.pow(2,n),i-=c}return(d?-1:1)*u*Math.pow(2,i-n)},e.writeIEEE754=function(t,e,r,n,o,i){var u,s,f,a="big"===n,c=8*i-o-1,l=(1<<c)-1,p=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=a?i-1:0,y=a?-1:1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=l):(u=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-u))<1&&(u--,f*=2),(e+=u+p>=1?h/f:h*Math.pow(2,1-p))*f>=2&&(u++,f/=2),u+p>=l?(s=0,u=l):u+p>=1?(s=(e*f-1)*Math.pow(2,o),u+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,o),u=0)),isNaN(e)&&(s=0);o>=8;)t[r+d]=255&s,d+=y,s/=256,o-=8;for(u=u<<o|s,isNaN(e)&&(u+=8),c+=o;c>0;)t[r+d]=255&u,d+=y,u/=256,c-=8;t[r+d-y]|=128*g}}));i(Bt);Bt.writeIEEE754,Bt.readIEEE754;var Et=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;var r=/\x00/,n=new Set(["$db","$ref","$id","$clusterTime"]);function o(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function i(t,e,r,n,o){t[n++]=Ot.BSON_DATA_STRING;var i=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8");t[(n=n+i+1)-1]=0;var u=t.write(r,n+4,void 0,"utf8");return t[n+3]=u+1>>24&255,t[n+2]=u+1>>16&255,t[n+1]=u+1>>8&255,t[n]=u+1&255,n=n+4+u,t[n++]=0,n}function u(t,e,r,n,o){Number.isInteger(r)&&r>=Ot.BSON_INT32_MIN&&r<=Ot.BSON_INT32_MAX?(t[n++]=Ot.BSON_DATA_INT,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255):(t[n++]=Ot.BSON_DATA_NUMBER,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,Bt.writeIEEE754(t,r,n,"little",52,8),n+=8);return n}function s(t,e,r,n,o){return t[n++]=Ot.BSON_DATA_NULL,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function f(t,e,r,n,o){return t[n++]=Ot.BSON_DATA_BOOLEAN,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=r?1:0,n}function a(t,e,r,n,o){t[n++]=Ot.BSON_DATA_DATE,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=ct.Long.fromNumber(r.getTime()),u=i.getLowBits(),s=i.getHighBits();return t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,n}function c(t,e,n,o,i){if(t[o++]=Ot.BSON_DATA_REGEXP,o+=i?t.write(e,o,void 0,"ascii"):t.write(e,o,void 0,"utf8"),t[o++]=0,n.source&&null!=n.source.match(r))throw Error("value "+n.source+" must not contain null bytes");return o+=t.write(n.source,o,void 0,"utf8"),t[o++]=0,n.ignoreCase&&(t[o++]=105),n.global&&(t[o++]=115),n.multiline&&(t[o++]=109),t[o++]=0,o}function l(t,e,n,o,i){if(t[o++]=Ot.BSON_DATA_REGEXP,o+=i?t.write(e,o,void 0,"ascii"):t.write(e,o,void 0,"utf8"),t[o++]=0,null!=n.pattern.match(r))throw Error("pattern "+n.pattern+" must not contain null bytes");return o+=t.write(n.pattern,o,void 0,"utf8"),t[o++]=0,o+=t.write(n.options.split("").sort().join(""),o,void 0,"utf8"),t[o++]=0,o}function p(t,e,r,n,o){return null===r?t[n++]=Ot.BSON_DATA_NULL:"MinKey"===r._bsontype?t[n++]=Ot.BSON_DATA_MIN_KEY:t[n++]=Ot.BSON_DATA_MAX_KEY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function h(t,e,r,n,o){if(t[n++]=Ot.BSON_DATA_OID,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,"string"==typeof r.id)t.write(r.id,n,void 0,"binary");else{if(!r.id||!r.id.copy)throw new TypeError("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(t,n,0,12)}return n+12}function d(t,e,r,n,o){t[n++]=Ot.BSON_DATA_BINARY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.length;return t[n++]=255&i,t[n++]=i>>8&255,t[n++]=i>>16&255,t[n++]=i>>24&255,t[n++]=Ot.BSON_BINARY_SUBTYPE_DEFAULT,t.set(it.ensureBuffer(r),n),n+=i}function y(t,e,r,n,o,i,u,s,f,a){void 0===o&&(o=!1),void 0===i&&(i=0),void 0===u&&(u=!1),void 0===s&&(s=!0),void 0===f&&(f=!1),void 0===a&&(a=[]);for(var c=0;c<a.length;c++)if(a[c]===r)throw new Error("cyclic dependency detected");a.push(r),t[n++]=Array.isArray(r)?Ot.BSON_DATA_ARRAY:Ot.BSON_DATA_OBJECT,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var l=A(t,r,o,n,i+1,u,s,a);return a.pop(),l}function g(t,e,r,n,o){return t[n++]=Ot.BSON_DATA_DECIMAL128,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,r.bytes.copy(t,n,0,16),n+16}function _(t,e,r,n,o){t[n++]="Long"===r._bsontype?Ot.BSON_DATA_LONG:Ot.BSON_DATA_TIMESTAMP,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.getLowBits(),u=r.getHighBits();return t[n++]=255&i,t[n++]=i>>8&255,t[n++]=i>>16&255,t[n++]=i>>24&255,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,n}function b(t,e,r,n,o){return r=r.valueOf(),t[n++]=Ot.BSON_DATA_INT,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255,n}function m(t,e,r,n,o){return t[n++]=Ot.BSON_DATA_NUMBER,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,Bt.writeIEEE754(t,r.value,n,"little",52,8),n+=8}function w(t,e,r,n,o,i,u){t[n++]=Ot.BSON_DATA_CODE,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var s=ot.normalizedFunctionString(r),f=t.write(s,n+4,void 0,"utf8")+1;return t[n]=255&f,t[n+1]=f>>8&255,t[n+2]=f>>16&255,t[n+3]=f>>24&255,n=n+4+f-1,t[n++]=0,n}function v(t,e,r,n,o,i,u,s,f){if(void 0===o&&(o=!1),void 0===i&&(i=0),void 0===u&&(u=!1),void 0===s&&(s=!0),void 0===f&&(f=!1),r.scope&&"object"==typeof r.scope){t[n++]=Ot.BSON_DATA_CODE_W_SCOPE,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var a=n,c="string"==typeof r.code?r.code:r.code.toString();n+=4;var l=t.write(c,n+4,void 0,"utf8")+1;t[n]=255&l,t[n+1]=l>>8&255,t[n+2]=l>>16&255,t[n+3]=l>>24&255,t[n+4+l-1]=0,n=n+l+4;var p=A(t,r.scope,o,n,i+1,u,s);n=p-1;var h=p-a;t[a++]=255&h,t[a++]=h>>8&255,t[a++]=h>>16&255,t[a++]=h>>24&255,t[n++]=0}else{t[n++]=Ot.BSON_DATA_CODE,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;c=r.code.toString();var d=t.write(c,n+4,void 0,"utf8")+1;t[n]=255&d,t[n+1]=d>>8&255,t[n+2]=d>>16&255,t[n+3]=d>>24&255,n=n+4+d-1,t[n++]=0}return n}function O(t,e,r,n,o){t[n++]=Ot.BSON_DATA_BINARY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.value(!0),u=r.position;return r.sub_type===st.Binary.SUBTYPE_BYTE_ARRAY&&(u+=4),t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=r.sub_type,r.sub_type===st.Binary.SUBTYPE_BYTE_ARRAY&&(u-=4,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255),t.set(i,n),n+=r.position}function N(t,e,r,n,o){t[n++]=Ot.BSON_DATA_SYMBOL,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=t.write(r.value,n+4,void 0,"utf8")+1;return t[n]=255&i,t[n+1]=i>>8&255,t[n+2]=i>>16&255,t[n+3]=i>>24&255,n=n+4+i-1,t[n++]=0,n}function S(t,e,r,n,o,i,u){t[n++]=Ot.BSON_DATA_OBJECT,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var s=n,f={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(f.$db=r.db);var a=A(t,f=Object.assign(f,r.fields),!1,n,o+1,i),c=a-s;return t[s++]=255&c,t[s++]=c>>8&255,t[s++]=c>>16&255,t[s++]=c>>24&255,a}function A(t,e,A,B,E,T,I,D){void 0===A&&(A=!1),void 0===B&&(B=0),void 0===E&&(E=0),void 0===T&&(T=!1),void 0===I&&(I=!0),void 0===D&&(D=[]),B=B||0,(D=D||[]).push(e);var R=B+4;if(Array.isArray(e))for(var P=0;P<e.length;P++){var L=""+P;if((C=e[P])&&C.toBSON){if("function"!=typeof C.toBSON)throw new TypeError("toBSON is not a function");C=C.toBSON()}if("string"==typeof C)R=i(t,L,C,R,!0);else if("number"==typeof C)R=u(t,L,C,R,!0);else{if("bigint"==typeof C)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof C)R=f(t,L,C,R,!0);else if(C instanceof Date||ot.isDate(C))R=a(t,L,C,R,!0);else if(void 0===C)R=s(t,L,0,R,!0);else if(null===C)R=s(t,L,0,R,!0);else if("ObjectId"===C._bsontype||"ObjectID"===C._bsontype)R=h(t,L,C,R,!0);else if(ot.isBuffer(C)||ot.isUint8Array(C))R=d(t,L,C,R,!0);else if(C instanceof RegExp||o(C))R=c(t,L,C,R,!0);else if("object"==typeof C&&null==C._bsontype)R=y(t,L,C,R,A,E,T,I,!0,D);else if("object"==typeof C&&wt.isBSONType(C)&&"Decimal128"===C._bsontype)R=g(t,L,C,R,!0);else if("Long"===C._bsontype||"Timestamp"===C._bsontype)R=_(t,L,C,R,!0);else if("Double"===C._bsontype)R=m(t,L,C,R,!0);else if("function"==typeof C&&T)R=w(t,L,C,R,0,0,!0);else if("Code"===C._bsontype)R=v(t,L,C,R,A,E,T,I,!0);else if("Binary"===C._bsontype)R=O(t,L,C,R,!0);else if("Symbol"===C._bsontype)R=N(t,L,C,R,!0);else if("DBRef"===C._bsontype)R=S(t,L,C,R,E,T,!0);else if("BSONRegExp"===C._bsontype)R=l(t,L,C,R,!0);else if("Int32"===C._bsontype)R=b(t,L,C,R,!0);else if("MinKey"===C._bsontype||"MaxKey"===C._bsontype)R=p(t,L,C,R,!0);else if(void 0!==C._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+C._bsontype)}}else if(e instanceof vt.Map)for(var U=e.entries(),M=!1;!M;){var j=U.next();if(!(M=!!j.done)){L=j.value[0];var x=typeof(C=j.value[1]);if("string"==typeof L&&!n.has(L)){if(null!=L.match(r))throw Error("key "+L+" must not contain null bytes");if(A){if("$"===L[0])throw Error("key "+L+" must not start with '$'");if(~L.indexOf("."))throw Error("key "+L+" must not contain '.'")}}if("string"===x)R=i(t,L,C,R);else if("number"===x)R=u(t,L,C,R);else{if("bigint"===x||ot.isBigInt64Array(C)||ot.isBigUInt64Array(C))throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===x)R=f(t,L,C,R);else if(C instanceof Date||ot.isDate(C))R=a(t,L,C,R);else if(null===C||void 0===C&&!1===I)R=s(t,L,0,R);else if("ObjectId"===C._bsontype||"ObjectID"===C._bsontype)R=h(t,L,C,R);else if(ot.isBuffer(C)||ot.isUint8Array(C))R=d(t,L,C,R);else if(C instanceof RegExp||o(C))R=c(t,L,C,R);else if("object"===x&&null==C._bsontype)R=y(t,L,C,R,A,E,T,I,!1,D);else if("object"===x&&"Decimal128"===C._bsontype)R=g(t,L,C,R);else if("Long"===C._bsontype||"Timestamp"===C._bsontype)R=_(t,L,C,R);else if("Double"===C._bsontype)R=m(t,L,C,R);else if("Code"===C._bsontype)R=v(t,L,C,R,A,E,T,I);else if("function"==typeof C&&T)R=w(t,L,C,R,0,0,T);else if("Binary"===C._bsontype)R=O(t,L,C,R);else if("Symbol"===C._bsontype)R=N(t,L,C,R);else if("DBRef"===C._bsontype)R=S(t,L,C,R,E,T);else if("BSONRegExp"===C._bsontype)R=l(t,L,C,R);else if("Int32"===C._bsontype)R=b(t,L,C,R);else if("MinKey"===C._bsontype||"MaxKey"===C._bsontype)R=p(t,L,C,R);else if(void 0!==C._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+C._bsontype)}}}else{if(e.toBSON){if("function"!=typeof e.toBSON)throw new TypeError("toBSON is not a function");if(null!=(e=e.toBSON())&&"object"!=typeof e)throw new TypeError("toBSON function did not return an object")}for(var L in e){var C;if((C=e[L])&&C.toBSON){if("function"!=typeof C.toBSON)throw new TypeError("toBSON is not a function");C=C.toBSON()}x=typeof C;if("string"==typeof L&&!n.has(L)){if(null!=L.match(r))throw Error("key "+L+" must not contain null bytes");if(A){if("$"===L[0])throw Error("key "+L+" must not start with '$'");if(~L.indexOf("."))throw Error("key "+L+" must not contain '.'")}}if("string"===x)R=i(t,L,C,R);else if("number"===x)R=u(t,L,C,R);else{if("bigint"===x)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===x)R=f(t,L,C,R);else if(C instanceof Date||ot.isDate(C))R=a(t,L,C,R);else if(void 0===C)!1===I&&(R=s(t,L,0,R));else if(null===C)R=s(t,L,0,R);else if("ObjectId"===C._bsontype||"ObjectID"===C._bsontype)R=h(t,L,C,R);else if(ot.isBuffer(C)||ot.isUint8Array(C))R=d(t,L,C,R);else if(C instanceof RegExp||o(C))R=c(t,L,C,R);else if("object"===x&&null==C._bsontype)R=y(t,L,C,R,A,E,T,I,!1,D);else if("object"===x&&"Decimal128"===C._bsontype)R=g(t,L,C,R);else if("Long"===C._bsontype||"Timestamp"===C._bsontype)R=_(t,L,C,R);else if("Double"===C._bsontype)R=m(t,L,C,R);else if("Code"===C._bsontype)R=v(t,L,C,R,A,E,T,I);else if("function"==typeof C&&T)R=w(t,L,C,R,0,0,T);else if("Binary"===C._bsontype)R=O(t,L,C,R);else if("Symbol"===C._bsontype)R=N(t,L,C,R);else if("DBRef"===C._bsontype)R=S(t,L,C,R,E,T);else if("BSONRegExp"===C._bsontype)R=l(t,L,C,R);else if("Int32"===C._bsontype)R=b(t,L,C,R);else if("MinKey"===C._bsontype||"MaxKey"===C._bsontype)R=p(t,L,C,R);else if(void 0!==C._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+C._bsontype)}}}D.pop(),t[R++]=0;var Y=R-B;return t[B++]=255&Y,t[B++]=Y>>8&255,t[B++]=Y>>16&255,t[B++]=Y>>24&255,R}e.serializeInto=A}));i(Et);Et.serializeInto;var Tt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeStream=e.calculateObjectSize=e.deserialize=e.serializeWithBufferAndIndex=e.serialize=e.setInternalBufferSize=e.ObjectID=e.Decimal128=e.BSONRegExp=e.MaxKey=e.MinKey=e.Int32=e.Double=e.Timestamp=e.Long=e.ObjectId=e.Binary=e.DBRef=e.BSONSymbol=e.Map=e.Code=e.LongWithoutOverridesClass=e.EJSON=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=e.BSON_DATA_UNDEFINED=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_SYMBOL=e.BSON_DATA_STRING=e.BSON_DATA_REGEXP=e.BSON_DATA_OID=e.BSON_DATA_OBJECT=e.BSON_DATA_NUMBER=e.BSON_DATA_NULL=e.BSON_DATA_MIN_KEY=e.BSON_DATA_MAX_KEY=e.BSON_DATA_LONG=e.BSON_DATA_INT=e.BSON_DATA_DECIMAL128=e.BSON_DATA_DBPOINTER=e.BSON_DATA_DATE=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_CODE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,Object.defineProperty(e,"Binary",{enumerable:!0,get:function(){return st.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return ft.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return at.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return lt.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return pt.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return ht.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return ct.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return vt.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return dt.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return yt.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return gt.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return gt.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return _t.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return bt.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return mt.Timestamp}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return Ot.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return Ot.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return Ot.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return Ot.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return Ot.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return Ot.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return Ot.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return Ot.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return Ot.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return Ot.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return Ot.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return Ot.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return Ot.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return Ot.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return Ot.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return Ot.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return Ot.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return Ot.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return Ot.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return Ot.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return Ot.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return Ot.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return Ot.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return Ot.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return Ot.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return Ot.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return Ot.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return Ot.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return Ot.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return Ot.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return Ot.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return Ot.BSON_INT64_MIN}});var r=wt;Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return r.EJSON}});var n=mt;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return n.LongWithoutOverridesClass}});var o=v.Buffer.alloc(17825792);function i(t){o.length<t&&(o=v.Buffer.alloc(t))}function u(t,e){void 0===e&&(e={});var r="boolean"==typeof e.checkKeys&&e.checkKeys,n="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,i="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,u="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:17825792;o.length<u&&(o=v.Buffer.alloc(u));var s=Et.serializeInto(o,t,r,0,0,n,i,[]),f=v.Buffer.alloc(s);return o.copy(f,0,0,f.length),f}function s(t,e,r){void 0===r&&(r={});var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,u="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0,f=Et.serializeInto(o,t,n,0,0,i,u);return o.copy(e,s,0,f),s+f-1}function f(t,e){return void 0===e&&(e={}),At.deserialize(it.ensureBuffer(t),e)}function a(t,e){void 0===e&&(e={});var r="boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,n="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined;return Nt.calculateObjectSize(t,r,n)}function c(t,e,r,n,o,i){for(var u=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},i),s=it.ensureBuffer(t),f=e,a=0;a<r;a++){var c=s[f]|s[f+1]<<8|s[f+2]<<16|s[f+3]<<24;u.index=f,n[o+a]=At.deserialize(s,u),f+=c}return f}e.setInternalBufferSize=i,e.serialize=u,e.serializeWithBufferAndIndex=s,e.deserialize=f,e.calculateObjectSize=a,e.deserializeStream=c;var l={Binary:st.Binary,Code:ft.Code,DBRef:at.DBRef,Decimal128:lt.Decimal128,Double:pt.Double,Int32:ht.Int32,Long:ct.Long,Map:vt.Map,MaxKey:dt.MaxKey,MinKey:yt.MinKey,ObjectId:gt.ObjectId,ObjectID:gt.ObjectId,BSONRegExp:_t.BSONRegExp,BSONSymbol:bt.BSONSymbol,Timestamp:mt.Timestamp,EJSON:wt.EJSON,setInternalBufferSize:i,serialize:u,serializeWithBufferAndIndex:s,deserialize:f,calculateObjectSize:a,deserializeStream:c};e.default=l})),It=(i(Tt),Tt.deserializeStream,Tt.calculateObjectSize,Tt.deserialize,Tt.serializeWithBufferAndIndex,Tt.serialize,Tt.setInternalBufferSize,Tt.ObjectID,Tt.Decimal128,Tt.BSONRegExp,Tt.MaxKey,Tt.MinKey,Tt.Int32,Tt.Double,Tt.Timestamp,Tt.Long,Tt.ObjectId,Tt.Binary,Tt.DBRef,Tt.BSONSymbol,Tt.Map,Tt.Code,Tt.LongWithoutOverridesClass,Tt.EJSON);Tt.BSON_INT64_MIN,Tt.BSON_INT64_MAX,Tt.BSON_INT32_MIN,Tt.BSON_INT32_MAX,Tt.BSON_DATA_UNDEFINED,Tt.BSON_DATA_TIMESTAMP,Tt.BSON_DATA_SYMBOL,Tt.BSON_DATA_STRING,Tt.BSON_DATA_REGEXP,Tt.BSON_DATA_OID,Tt.BSON_DATA_OBJECT,Tt.BSON_DATA_NUMBER,Tt.BSON_DATA_NULL,Tt.BSON_DATA_MIN_KEY,Tt.BSON_DATA_MAX_KEY,Tt.BSON_DATA_LONG,Tt.BSON_DATA_INT,Tt.BSON_DATA_DECIMAL128,Tt.BSON_DATA_DBPOINTER,Tt.BSON_DATA_DATE,Tt.BSON_DATA_CODE_W_SCOPE,Tt.BSON_DATA_CODE,Tt.BSON_DATA_BOOLEAN,Tt.BSON_DATA_BINARY,Tt.BSON_DATA_ARRAY,Tt.BSON_BINARY_SUBTYPE_UUID_NEW,Tt.BSON_BINARY_SUBTYPE_UUID,Tt.BSON_BINARY_SUBTYPE_USER_DEFINED,Tt.BSON_BINARY_SUBTYPE_MD5,Tt.BSON_BINARY_SUBTYPE_FUNCTION,Tt.BSON_BINARY_SUBTYPE_DEFAULT,Tt.BSON_BINARY_SUBTYPE_BYTE_ARRAY}).call(this,r(1),r(3).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.registerDatabase=void 0;var o=r(7);var i={name:"database",entity:{database:function(t){var e=this.platform,r=e.adapter,i=e.runtime;return o.Db.reqClass=this.request.constructor,o.Db.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},o.Db.runtime=i,this.wsClientClass&&(o.Db.wsClass=r.wsClass,o.Db.wsClientClass=this.wsClientClass),o.Db.ws||(o.Db.ws=null),new o.Db(n(n({},this.config),t))}}};try{cloudbase.registerComponent(i)}catch(t){}e.registerDatabase=function(t){try{t.registerComponent(i)}catch(t){console.warn(t)}}},function(t,e,r){"use strict";(function(t){
|
|
2
|
+
/*!
|
|
3
|
+
* The buffer module from node.js, for the browser.
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <http://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
var n=r(4),o=r(5),i=r(6);function u(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(u()<e)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=f.prototype:(null===t&&(t=new f(e)),t.length=e),t}function f(t,e,r){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return a(this,t,e,r)}function a(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);f.TYPED_ARRAY_SUPPORT?(t=e).__proto__=f.prototype:t=p(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!f.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=s(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(f.isBuffer(e)){var r=0|h(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):p(t,e);if("Buffer"===e.type&&i(e.data))return p(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(c(e),t=s(t,e<0?0:0|h(e)),!f.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function p(t,e){var r=e.length<0?0:0|h(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function d(t,e){if(f.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return $(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return E(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function _(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=f.from(e,n)),f.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,o);if("number"==typeof e)return e&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,o){var i,u=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,s/=2,f/=2,r/=2}function a(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(o){var c=-1;for(i=r;i<s;i++)if(a(t,i)===a(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===f)return c*u}else-1!==c&&(i-=i-c),c=-1}else for(r+f>s&&(r=s-f),i=r;i>=0;i--){for(var l=!0,p=0;p<f;p++)if(a(t,i+p)!==a(e,p)){l=!1;break}if(l)return i}return-1}function m(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u<n;++u){var s=parseInt(e.substr(2*u,2),16);if(isNaN(s))return u;t[r+u]=s}return u}function w(t,e,r,n){return F($(e,t.length-r),t,r,n)}function v(t,e,r,n){return F(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function O(t,e,r,n){return v(t,e,r,n)}function N(t,e,r,n){return F(q(e),t,r,n)}function S(t,e,r,n){return F(function(t,e){for(var r,n,o,i=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,u,s,f,a=t[o],c=null,l=a>239?4:a>223?3:a>191?2:1;if(o+l<=r)switch(l){case 1:a<128&&(c=a);break;case 2:128==(192&(i=t[o+1]))&&(f=(31&a)<<6|63&i)>127&&(c=f);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(f=(15&a)<<12|(63&i)<<6|63&u)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:i=t[o+1],u=t[o+2],s=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&s)&&(f=(15&a)<<18|(63&i)<<12|(63&u)<<6|63&s)>65535&&f<1114112&&(c=f)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=f,e.SlowBuffer=function(t){+t!=t&&(t=0);return f.alloc(+t)},e.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=u(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,e,r){return a(null,t,e,r)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},f.allocUnsafe=function(t){return l(null,t)},f.allocUnsafeSlow=function(t){return l(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,e){if(!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=f.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var u=t[r];if(!f.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,o),o+=u.length}return n},f.byteLength=d,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},f.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},f.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},f.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?B(this,0,t):y.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,e,r,n,o){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(r>>>=0)-(e>>>=0),s=Math.min(i,u),a=this.slice(n,o),c=t.slice(e,r),l=0;l<s;++l)if(a[l]!==c[l]){i=a[l],u=c[l];break}return i<u?-1:u<i?1:0},f.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},f.prototype.indexOf=function(t,e,r){return _(this,t,e,r,!0)},f.prototype.lastIndexOf=function(t,e,r){return _(this,t,e,r,!1)},f.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return O(this,t,e,r);case"base64":return N(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function E(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=Y(t[i]);return o}function D(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,o,i){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function L(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function M(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,i){return i||M(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function x(t,e,r,n,i){return i||M(t,0,r,8),o.write(t,e,r,n,52,8),r+8}f.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),f.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=f.prototype;else{var o=e-t;r=new f(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},f.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},f.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},f.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},f.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},f.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},f.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},f.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},f.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},f.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},f.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},f.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},f.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);P(this,t,e,r,o-1,-o)}var i=0,u=1,s=0;for(this[e]=255&t;++i<r&&(u*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},f.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);P(this,t,e,r,o-1,-o)}var i=r-1,u=1,s=0;for(this[e+i]=255&t;--i>=0&&(u*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},f.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},f.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},f.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},f.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},f.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},f.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},f.prototype.writeDoubleLE=function(t,e,r){return x(this,t,e,!0,r)},f.prototype.writeDoubleBE=function(t,e,r){return x(this,t,e,!1,r)},f.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!f.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},f.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var u=f.isBuffer(t)?t:$(new f(t,n).toString()),s=u.length;for(i=0;i<r-e;++i)this[i+e]=u[i%s]}return this};var C=/[^+\/0-9A-Za-z-_]/g;function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if((r=t.charCodeAt(u))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(1))},function(t,e,r){"use strict";e.byteLength=function(t){var e=a(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=a(t),u=n[0],s=n[1],f=new i(function(t,e,r){return 3*(e+r)/4-r}(0,u,s)),c=0,l=s>0?u-4:u;for(r=0;r<l;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],f[c++]=e>>16&255,f[c++]=e>>8&255,f[c++]=255&e;2===s&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,f[c++]=255&e);1===s&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,f[c++]=e>>8&255,f[c++]=255&e);return f},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],u=0,s=r-o;u<s;u+=16383)i.push(c(t,u,u+16383>s?s:u+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,f=u.length;s<f;++s)n[s]=u[s],o[u.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var o,i,u=[],s=e;s<r;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),u.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){
|
|
9
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
|
+
e.read=function(t,e,r,n,o){var i,u,s=8*o-n-1,f=(1<<s)-1,a=f>>1,c=-7,l=r?o-1:0,p=r?-1:1,h=t[e+l];for(l+=p,i=h&(1<<-c)-1,h>>=-c,c+=s;c>0;i=256*i+t[e+l],l+=p,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=n;c>0;u=256*u+t[e+l],l+=p,c-=8);if(0===i)i=1-a;else{if(i===f)return u?NaN:1/0*(h?-1:1);u+=Math.pow(2,n),i-=a}return(h?-1:1)*u*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var u,s,f,a=8*i-o-1,c=(1<<a)-1,l=c>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=c):(u=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-u))<1&&(u--,f*=2),(e+=u+l>=1?p/f:p*Math.pow(2,1-l))*f>=2&&(u++,f/=2),u+l>=c?(s=0,u=c):u+l>=1?(s=(e*f-1)*Math.pow(2,o),u+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[r+h]=255&s,h+=d,s/=256,o-=8);for(u=u<<o|s,a+=o;a>0;t[r+h]=255&u,h+=d,u/=256,a-=8);t[r+h-d]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";r.r(e),r.d(e,"Query",(function(){return zt})),r.d(e,"CollectionReference",(function(){return Wt})),r.d(e,"DocumentReference",(function(){return $t})),r.d(e,"Db",(function(){return _e}));var n,o,i={};r.r(i),r.d(i,"Point",(function(){return Q})),r.d(i,"LineString",(function(){return et})),r.d(i,"Polygon",(function(){return nt})),r.d(i,"MultiPoint",(function(){return it})),r.d(i,"MultiLineString",(function(){return st})),r.d(i,"MultiPolygon",(function(){return at})),function(t){t.DocIDError="文档ID不合法",t.CollNameError="集合名称不合法",t.OpStrError="操作符不合法",t.DirectionError="排序字符不合法",t.IntergerError="must be integer",t.QueryParamTypeError="查询参数必须为对象",t.QueryParamValueError="查询参数对象值不能均为undefined"}(o||(o={}));var u,s="Number",f="Object",a="Array",c="GeoPoint",l="GeoLineString",p="GeoPolygon",h="GeoMultiPoint",d="GeoMultiLineString",y="GeoMultiPolygon",g="Date",_="ServerDate",b="BsonDate",m=["desc","asc"],w=["<","<=","==",">=",">"];!function(t){t.lt="<",t.gt=">",t.lte="<=",t.gte=">=",t.eq="=="}(u||(u={}));var v;(n={})[u.eq]="$eq",n[u.lt]="$lt",n[u.lte]="$lte",n[u.gt]="$gt",n[u.gte]="$gte";!function(t){t.WHERE="WHERE",t.DOC="DOC"}(v||(v={}));var O,N=(O=function(t,e){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}O(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),S=[],A={},B=function(t){function e(e,r){if(r!==A)throw new TypeError("InternalSymbol cannot be constructed with new operator");return t.call(this,e)||this}return N(e,t),e.for=function(t){for(var r=0,n=S.length;r<n;r++)if(S[r].target===t)return S[r].instance;var o=new e(t,A);return S.push({target:t,instance:o}),o},e}((function(t){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:t}})})),E=B,T=E.for("UNSET_FIELD_NAME"),I=E.for("UPDATE_COMMAND"),D=E.for("QUERY_COMMAND"),R=E.for("LOGIC_COMMAND"),P=E.for("GEO_POINT"),L=E.for("SYMBOL_GEO_LINE_STRING"),U=E.for("SYMBOL_GEO_POLYGON"),M=E.for("SYMBOL_GEO_MULTI_POINT"),j=E.for("SYMBOL_GEO_MULTI_LINE_STRING"),x=E.for("SYMBOL_GEO_MULTI_POLYGON"),C=E.for("SERVER_DATE"),Y=E.for("REGEXP"),$=function(){function t(t){var e=(void 0===t?{}:t).offset,r=void 0===e?0:e;this.offset=r}return Object.defineProperty(t.prototype,"_internalType",{get:function(){return C},enumerable:!0,configurable:!0}),t.prototype.parse=function(){return{$date:{offset:this.offset}}},t}();function q(t){return new $(t)}var F,k=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u},z=function(){function t(){}return t.formatResDocumentData=function(e){return e.map((function(e){return t.formatField(e)}))},t.formatField=function(e){var r=Object.keys(e),n={};return Array.isArray(e)&&(n=[]),r.forEach((function(r){var o,i=e[r];switch(t.whichType(i)){case c:o=new Q(i.coordinates[0],i.coordinates[1]);break;case l:o=new et(i.coordinates.map((function(t){return new Q(t[0],t[1])})));break;case p:o=new nt(i.coordinates.map((function(t){return new et(t.map((function(t){var e=k(t,2),r=e[0],n=e[1];return new Q(r,n)})))})));break;case h:o=new it(i.coordinates.map((function(t){return new Q(t[0],t[1])})));break;case d:o=new st(i.coordinates.map((function(t){return new et(t.map((function(t){var e=k(t,2),r=e[0],n=e[1];return new Q(r,n)})))})));break;case y:o=new at(i.coordinates.map((function(t){return new nt(t.map((function(t){return new et(t.map((function(t){var e=k(t,2),r=e[0],n=e[1];return new Q(r,n)})))})))})));break;case g:o=new Date(1e3*i.$timestamp);break;case f:case a:o=t.formatField(i);break;case _:o=new Date(i.$date);break;default:o=i}Array.isArray(n)?n.push(o):n[r]=o})),n},t.whichType=function(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(e===g)return b;if(e===f){if(t instanceof Q)return c;if(t instanceof Date)return g;if(t instanceof $)return _;t.$timestamp?e=g:t.$date?e=_:Q.validate(t)?e=c:et.validate(t)?e=l:nt.validate(t)?e=p:it.validate(t)?e=h:st.validate(t)?e=d:at.validate(t)&&(e=y)}return e},t.generateDocId=function(){for(var t="ABCDEFabcdef0123456789",e="",r=0;r<24;r++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},t}(),J=function(){function t(){}return t.isGeopoint=function(t,e){if(z.whichType(e)!==s)throw new Error("Geo Point must be number type");var r=Math.abs(e);if("latitude"===t&&r>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===t&&r>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0},t.isInteger=function(t,e){if(!Number.isInteger(e))throw new Error(t+o.IntergerError);return!0},t.isFieldOrder=function(t){if(-1===m.indexOf(t))throw new Error(o.DirectionError);return!0},t.isFieldPath=function(t){if(!/^[a-zA-Z0-9-_\.]/.test(t))throw new Error;return!0},t.isOperator=function(t){if(-1===w.indexOf(t))throw new Error(o.OpStrError);return!0},t.isCollName=function(t){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(t))throw new Error(o.CollNameError);return!0},t.isDocID=function(t){if(!/^([a-fA-F0-9]){24}$/.test(t))throw new Error(o.DocIDError);return!0},t}(),G=function(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()},H=function(t){return"object"===G(t)},K=function(t){return"number"===G(t)},V=function(t){return Array.isArray(t)},W=function(t){return"date"===G(t)},X=function(t){return"regexp"===G(t)},Z=function(t){return t&&t._internalType instanceof B},Q=function(){function t(t,e){J.isGeopoint("longitude",t),J.isGeopoint("latitude",e),this.longitude=t,this.latitude=e}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Point",coordinates:[this.longitude,this.latitude]},e},t.prototype.toJSON=function(){return{type:"Point",coordinates:[this.longitude,this.latitude]}},t.prototype.toReadableString=function(){return"["+this.longitude+","+this.latitude+"]"},t.validate=function(t){return"Point"===t.type&&V(t.coordinates)&&J.isGeopoint("longitude",t.coordinates[0])&&J.isGeopoint("latitude",t.coordinates[1])},Object.defineProperty(t.prototype,"_internalType",{get:function(){return P},enumerable:!0,configurable:!0}),t}(),tt=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},et=function(){function t(t){if(!V(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(t.length<2)throw new Error('"points" must contain 2 points at least');t.forEach((function(t){if(!(t instanceof Q))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,r;if("LineString"!==t.type||!V(t.coordinates))return!1;try{for(var n=tt(t.coordinates),o=n.next();!o.done;o=n.next()){var i=o.value;if(!K(i[0])||!K(i[1]))return!1}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return!0},t.isClosed=function(t){var e=t.points[0],r=t.points[t.points.length-1];if(e.latitude===r.latitude&&e.longitude===r.longitude)return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return L},enumerable:!0,configurable:!0}),t}(),rt=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},nt=function(){function t(t){if(!V(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof et))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]");if(!et.isClosed(t))throw new Error("LineString "+t.points.map((function(t){return t.toReadableString()}))+" is not a closed cycle")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,r,n,o;if("Polygon"!==t.type||!V(t.coordinates))return!1;try{for(var i=rt(t.coordinates),u=i.next();!u.done;u=i.next()){var s=u.value;if(!this.isCloseLineString(s))return!1;try{for(var f=(n=void 0,rt(s)),a=f.next();!a.done;a=f.next()){var c=a.value;if(!K(c[0])||!K(c[1]))return!1}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return!0},t.isCloseLineString=function(t){var e=t[0],r=t[t.length-1];return e[0]===r[0]&&e[1]===r[1]},Object.defineProperty(t.prototype,"_internalType",{get:function(){return x},enumerable:!0,configurable:!0}),t}(),ot=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},it=function(){function t(t){if(!V(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(0===t.length)throw new Error('"points" must contain 1 point at least');t.forEach((function(t){if(!(t instanceof Q))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,r;if("MultiPoint"!==t.type||!V(t.coordinates))return!1;try{for(var n=ot(t.coordinates),o=n.next();!o.done;o=n.next()){var i=o.value;if(!K(i[0])||!K(i[1]))return!1}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return M},enumerable:!0,configurable:!0}),t}(),ut=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},st=function(){function t(t){if(!V(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof et))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,r,n,o;if("MultiLineString"!==t.type||!V(t.coordinates))return!1;try{for(var i=ut(t.coordinates),u=i.next();!u.done;u=i.next()){var s=u.value;try{for(var f=(n=void 0,ut(s)),a=f.next();!a.done;a=f.next()){var c=a.value;if(!K(c[0])||!K(c[1]))return!1}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return j},enumerable:!0,configurable:!0}),t}(),ft=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},at=function(){function t(t){var e,r;if(!V(t))throw new TypeError('"polygons" must be of type Polygon[]. Received type '+typeof t);if(0===t.length)throw new Error("MultiPolygon must contain 1 polygon at least");try{for(var n=ft(t),o=n.next();!o.done;o=n.next()){var i=o.value;if(!(i instanceof nt))throw new TypeError('"polygon" must be of type Polygon[]. Received type '+typeof i+"[]")}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}this.polygons=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))},e},t.prototype.toJSON=function(){return{type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))}},t.validate=function(t){var e,r,n,o,i,u;if("MultiPolygon"!==t.type||!V(t.coordinates))return!1;try{for(var s=ft(t.coordinates),f=s.next();!f.done;f=s.next()){var a=f.value;try{for(var c=(n=void 0,ft(a)),l=c.next();!l.done;l=c.next()){var p=l.value;try{for(var h=(i=void 0,ft(p)),d=h.next();!d.done;d=h.next()){var y=d.value;if(!K(y[0])||!K(y[1]))return!1}}catch(t){i={error:t}}finally{try{d&&!d.done&&(u=h.return)&&u.call(h)}finally{if(i)throw i.error}}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return U},enumerable:!0,configurable:!0}),t}(),ct=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t};!function(t){t.SET="set",t.REMOVE="remove",t.INC="inc",t.MUL="mul",t.PUSH="push",t.PULL="pull",t.PULL_ALL="pullAll",t.POP="pop",t.SHIFT="shift",t.UNSHIFT="unshift",t.ADD_TO_SET="addToSet",t.BIT="bit",t.RENAME="rename",t.MAX="max",t.MIN="min"}(F||(F={}));var lt=function(){function t(t,e,r){this._internalType=I,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=r||T}return t.prototype._setFieldName=function(e){return new t(this.operator,this.operands,e)},t}();function pt(t){return t&&t instanceof lt&&t._internalType===I}var ht;!function(t){t.AND="and",t.OR="or",t.NOT="not",t.NOR="nor"}(ht||(ht={}));var dt=function(){function t(t,e,r){if(this._internalType=R,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=r||T,this.fieldName!==T)if(Array.isArray(e)){e=e.slice(),this.operands=e;for(var n=0,o=e.length;n<o;n++){(yt(i=e[n])||mt(i))&&(e[n]=i._setFieldName(this.fieldName))}}else{var i;(yt(i=e)||mt(i))&&(e=i._setFieldName(this.fieldName))}}return t.prototype._setFieldName=function(e){var r=this.operands.map((function(r){return r instanceof t?r._setFieldName(e):r}));return new t(this.operator,r,e)},t.prototype.and=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return n.unshift(this),new t(ht.AND,n,this.fieldName)},t.prototype.or=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return n.unshift(this),new t(ht.OR,n,this.fieldName)},t}();function yt(t){return t&&t instanceof dt&&t._internalType===R}var gt,_t=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();!function(t){t.EQ="eq",t.NEQ="neq",t.GT="gt",t.GTE="gte",t.LT="lt",t.LTE="lte",t.IN="in",t.NIN="nin",t.ALL="all",t.ELEM_MATCH="elemMatch",t.EXISTS="exists",t.SIZE="size",t.MOD="mod",t.GEO_NEAR="geoNear",t.GEO_WITHIN="geoWithin",t.GEO_INTERSECTS="geoIntersects"}(gt||(gt={}));var bt=function(t){function e(e,r,n){var o=t.call(this,e,r,n)||this;return o.operator=e,o._internalType=D,o}return _t(e,t),e.prototype.toJSON=function(){var t,e;switch(this.operator){case gt.IN:case gt.NIN:return(t={})["$"+this.operator]=this.operands,t;default:return(e={})["$"+this.operator]=this.operands[0],e}},e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e.prototype.eq=function(t){var r=new e(gt.EQ,[t],this.fieldName);return this.and(r)},e.prototype.neq=function(t){var r=new e(gt.NEQ,[t],this.fieldName);return this.and(r)},e.prototype.gt=function(t){var r=new e(gt.GT,[t],this.fieldName);return this.and(r)},e.prototype.gte=function(t){var r=new e(gt.GTE,[t],this.fieldName);return this.and(r)},e.prototype.lt=function(t){var r=new e(gt.LT,[t],this.fieldName);return this.and(r)},e.prototype.lte=function(t){var r=new e(gt.LTE,[t],this.fieldName);return this.and(r)},e.prototype.in=function(t){var r=new e(gt.IN,t,this.fieldName);return this.and(r)},e.prototype.nin=function(t){var r=new e(gt.NIN,t,this.fieldName);return this.and(r)},e.prototype.geoNear=function(t){if(!(t.geometry instanceof Q))throw new TypeError('"geometry" must be of type Point. Received type '+typeof t.geometry);if(void 0!==t.maxDistance&&!K(t.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof t.maxDistance);if(void 0!==t.minDistance&&!K(t.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof t.minDistance);var r=new e(gt.GEO_NEAR,[t],this.fieldName);return this.and(r)},e.prototype.geoWithin=function(t){if(!(t.geometry instanceof at||t.geometry instanceof nt))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof t.geometry);var r=new e(gt.GEO_WITHIN,[t],this.fieldName);return this.and(r)},e.prototype.geoIntersects=function(t){if(!(t.geometry instanceof Q||t.geometry instanceof et||t.geometry instanceof nt||t.geometry instanceof it||t.geometry instanceof st||t.geometry instanceof at))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof t.geometry);var r=new e(gt.GEO_INTERSECTS,[t],this.fieldName);return this.and(r)},e}(dt);function mt(t){return t&&t instanceof bt&&t._internalType===D}function wt(t){return mt(t)}var vt={};for(var Ot in gt)vt[Ot]="$"+Ot;for(var Ot in ht)vt[Ot]="$"+Ot;for(var Ot in F)vt[Ot]="$"+Ot;function Nt(t){return vt[t]||"$"+t}vt[gt.NEQ]="$ne",vt[F.REMOVE]="$unset",vt[F.SHIFT]="$pop",vt[F.UNSHIFT]="$push";var St=function(){return(St=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},At=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u},Bt=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(At(arguments[e]));return t};function Et(t){return function t(e,r){if(!Z(e)){if(W(e))return{$date:+e};if(X(e))return{$regex:e.source,$options:e.flags};if(V(e))return e.map((function(e){if(r.indexOf(e)>-1)throw new Error("Cannot convert circular structure to JSON");return t(e,Bt(r,[e]))}));if(H(e)){var n=St({},e);for(var o in n){if(r.indexOf(n[o])>-1)throw new Error("Cannot convert circular structure to JSON");n[o]=t(n[o],Bt(r,[n[o]]))}return n}return e}switch(e._internalType){case P:return e.toJSON();case C:case Y:return e.parse();default:return e.toJSON?e.toJSON():e}}(t,[t])}var Tt=function(){return(Tt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},It=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u},Dt=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(It(arguments[e]));return t};function Rt(t,e,r,n){var o=Tt({},t);for(var i in t)if(!/^\$/.test(i)){var u=t[i];if(u&&H(u)&&!e(u)){if(n.indexOf(u)>-1)throw new Error("Cannot convert circular structure to JSON");var s=Rt(u,e,Dt(r,[i]),Dt(n,[u]));o[i]=s;var f=!1;for(var a in s)/^\$/.test(a)?f=!0:(o[i+"."+a]=s[a],delete o[i][a]);f||delete o[i]}}return o}function Pt(t){return Rt(t,Ut,[],[t])}function Lt(t,e,r){for(var n in e[r]||delete t[r],e)t[n]?V(t[n])?t[n].push(e[n]):H(t[n])?H(e[n])?Object.assign(t[n],e[n]):(console.warn("unmergable condition, query is object but condition is "+G(e)+", can only overwrite",e,r),t[n]=e[n]):(console.warn("to-merge query is of type "+G(t)+", can only overwrite",t,e,r),t[n]=e[n]):t[n]=e[n]}function Ut(t){return Z(t)||W(t)||X(t)}function Mt(t){return Et(t)}var jt=function(){function t(){}return t.encode=function(e){return(new t).encodeUpdate(e)},t.prototype.encodeUpdate=function(t){return pt(t)?this.encodeUpdateCommand(t):"object"===G(t)?this.encodeUpdateObject(t):t},t.prototype.encodeUpdateCommand=function(t){if(t.fieldName===T)throw new Error("Cannot encode a comparison command with unset field name");switch(t.operator){case F.PUSH:case F.PULL:case F.PULL_ALL:case F.POP:case F.SHIFT:case F.UNSHIFT:case F.ADD_TO_SET:return this.encodeArrayUpdateCommand(t);default:return this.encodeFieldUpdateCommand(t)}},t.prototype.encodeFieldUpdateCommand=function(t){var e,r,n,o,i=Nt(t.operator);switch(t.operator){case F.REMOVE:return(e={})[i]=((r={})[t.fieldName]="",r),e;default:return(n={})[i]=((o={})[t.fieldName]=t.operands[0],o),n}},t.prototype.encodeArrayUpdateCommand=function(t){var e,r,n,o,i,u,s,f,a,c,l=Nt(t.operator);switch(t.operator){case F.PUSH:var p=void 0;return p=V(t.operands)?{$each:t.operands.map(Mt)}:t.operands,(e={})[l]=((r={})[t.fieldName]=p,r),e;case F.UNSHIFT:p={$each:t.operands.map(Mt),$position:0};return(n={})[l]=((o={})[t.fieldName]=p,o),n;case F.POP:return(i={})[l]=((u={})[t.fieldName]=1,u),i;case F.SHIFT:return(s={})[l]=((f={})[t.fieldName]=-1,f),s;default:return(a={})[l]=((c={})[t.fieldName]=Mt(t.operands),c),a}},t.prototype.encodeUpdateObject=function(t){var e=Pt(t);for(var r in e)if(!/^\$/.test(r)){var n=e[r];if(pt(n)){e[r]=n._setFieldName(r),Lt(e,this.encodeUpdateCommand(e[r]),r)}else{e[r]=n=Mt(n);var o=new lt(F.SET,[n],r);Lt(e,this.encodeUpdateCommand(o),r)}}return e},t}(),xt={};function Ct(t){if(!_e.wsClientClass)throw new Error("to use realtime you must import realtime module first");var e=t.config.env;return xt[e]||(xt[e]=new _e.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:new _e.reqClass(t.config)}}})),xt[e]}var Yt=function(){return(Yt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},$t=function(){function t(t,e,r,n){var o=this;void 0===n&&(n={}),this.watch=function(t){return Ct(o._db).watch(Yt(Yt({},t),{envId:o._db.config.env,collectionName:o._coll,query:JSON.stringify({_id:o.id})}))},this._db=t,this._coll=e,this.id=r,this.request=new _e.reqClass(this._db.config),this.projection=n}return t.prototype.create=function(t,e){e=e||ct();var r={collectionName:this._coll,data:Et(t)};return this.id&&(r._id=this.id),this.request.send("database.addDocument",r).then((function(t){t.code?e(0,t):e(0,{id:t.data._id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.set=function(t,e){if(e=e||ct(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var r=!1,n=function(t){if("object"==typeof t)for(var e in t)t[e]instanceof lt?r=!0:"object"==typeof t[e]&&n(t[e])};if(n(t),r)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});var o={collectionName:this._coll,queryType:v.DOC,data:Et(t),multi:!1,merge:!1,upsert:!0};return this.id&&(o.query={_id:this.id}),this.request.send("database.updateDocument",o).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.update=function(t,e){if(e=e||ct(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var r={_id:this.id},n={collectionName:this._coll,data:jt.encode(t),query:r,queryType:v.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",n).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.remove=function(t){t=t||ct();var e={_id:this.id},r={collectionName:this._coll,query:e,queryType:v.DOC,multi:!1};return this.request.send("database.deleteDocument",r).then((function(e){e.code?t(0,e):t(0,{deleted:e.data.deleted,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},t.prototype.get=function(t){t=t||ct();var e={_id:this.id},r={collectionName:this._coll,query:e,queryType:v.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",r).then((function(e){if(e.code)t(0,e);else{var r=z.formatResDocumentData(e.data.list);t(0,{data:r,requestId:e.requestId,total:e.TotalCount,limit:e.Limit,offset:e.Offset})}})).catch((function(e){t(e)})),t.promise},t.prototype.field=function(e){for(var r in e)e[r]?e[r]=1:e[r]=0;return new t(this._db,this._coll,this.id,e)},t}(),qt=function(){function t(){}return t.encode=function(t){return(new Ft).encodeQuery(t)},t}(),Ft=function(){function t(){}return t.prototype.encodeQuery=function(t,e){var r;return Ut(t)?yt(t)?this.encodeLogicCommand(t):mt(t)?this.encodeQueryCommand(t):((r={})[e]=this.encodeQueryObject(t),r):H(t)?this.encodeQueryObject(t):t},t.prototype.encodeRegExp=function(t){return{$regex:t.source,$options:t.flags}},t.prototype.encodeLogicCommand=function(t){var e,r,n,o,i,u,s,f=this;switch(t.operator){case ht.NOR:case ht.AND:case ht.OR:var a=Nt(t.operator),c=t.operands.map((function(e){return f.encodeQuery(e,t.fieldName)}));return(e={})[a]=c,e;case ht.NOT:a=Nt(t.operator);var l=t.operands[0];if(X(l))return(r={})[t.fieldName]=((n={})[a]=this.encodeRegExp(l),n),r;c=this.encodeQuery(l)[t.fieldName];return(o={})[t.fieldName]=((i={})[a]=c,i),o;default:a=Nt(t.operator);if(1===t.operands.length){var p=this.encodeQuery(t.operands[0]);return(u={})[a]=p,u}c=t.operands.map(this.encodeQuery.bind(this));return(s={})[a]=c,s}},t.prototype.encodeQueryCommand=function(t){return wt(t),this.encodeComparisonCommand(t)},t.prototype.encodeComparisonCommand=function(t){var e,r,n,o,i,u,s,f,a;if(t.fieldName===T)throw new Error("Cannot encode a comparison command with unset field name");var c=Nt(t.operator);switch(t.operator){case gt.EQ:case gt.NEQ:case gt.LT:case gt.LTE:case gt.GT:case gt.GTE:case gt.ELEM_MATCH:case gt.EXISTS:case gt.SIZE:case gt.MOD:return(e={})[t.fieldName]=((r={})[c]=Mt(t.operands[0]),r),e;case gt.IN:case gt.NIN:case gt.ALL:return(n={})[t.fieldName]=((o={})[c]=Mt(t.operands),o),n;case gt.GEO_NEAR:var l=t.operands[0];return(i={})[t.fieldName]={$nearSphere:{$geometry:l.geometry.toJSON(),$maxDistance:l.maxDistance,$minDistance:l.minDistance}},i;case gt.GEO_WITHIN:l=t.operands[0];return(u={})[t.fieldName]={$geoWithin:{$geometry:l.geometry.toJSON()}},u;case gt.GEO_INTERSECTS:l=t.operands[0];return(s={})[t.fieldName]={$geoIntersects:{$geometry:l.geometry.toJSON()}},s;default:return(f={})[t.fieldName]=((a={})[c]=Mt(t.operands[0]),a),f}},t.prototype.encodeQueryObject=function(t){var e=Pt(t);for(var r in e){var n=e[r];if(yt(n)){e[r]=n._setFieldName(r);var o=this.encodeLogicCommand(e[r]);this.mergeConditionAfterEncode(e,o,r)}else if(wt(n)){e[r]=n._setFieldName(r);o=this.encodeComparisonCommand(e[r]);this.mergeConditionAfterEncode(e,o,r)}else Ut(n)&&(e[r]=Mt(n))}return e},t.prototype.mergeConditionAfterEncode=function(t,e,r){for(var n in e[r]||delete t[r],e)t[n]?V(t[n])?t[n]=t[n].concat(e[n]):H(t[n])?H(e[n])?Object.assign(t,e):(console.warn("unmergable condition, query is object but condition is "+G(e)+", can only overwrite",e,r),t[n]=e[n]):(console.warn("to-merge query is of type "+G(t)+", can only overwrite",t,e,r),t[n]=e[n]):t[n]=e[n]},t}(),kt=function(){return(kt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},zt=function(){function t(t,e,r,n,o){var i=this;this.watch=function(t){return Ct(i._db).watch(kt(kt({},t),{envId:i._db.config.env,collectionName:i._coll,query:JSON.stringify(i._fieldFilters||{}),limit:i._queryOptions.limit,orderBy:i._fieldOrders?i._fieldOrders.reduce((function(t,e){return t[e.field]=e.direction,t}),{}):void 0}))},this._db=t,this._coll=e,this._fieldFilters=r,this._fieldOrders=n||[],this._queryOptions=o||{},this._request=new _e.reqClass(this._db.config)}return t.prototype.get=function(t){t=t||ct();var e=[];this._fieldOrders&&this._fieldOrders.forEach((function(t){e.push(t)}));var r={collectionName:this._coll,queryType:v.WHERE};return this._fieldFilters&&(r.query=this._fieldFilters),e.length>0&&(r.order=e),this._queryOptions.offset&&(r.offset=this._queryOptions.offset),this._queryOptions.limit?r.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:r.limit=100,this._queryOptions.projection&&(r.projection=this._queryOptions.projection),this._request.send("database.queryDocument",r).then((function(e){if(e.code)t(0,e);else{var r={data:z.formatResDocumentData(e.data.list),requestId:e.requestId};e.TotalCount&&(r.total=e.TotalCount),e.Limit&&(r.limit=e.Limit),e.Offset&&(r.offset=e.Offset),t(0,r)}})).catch((function(e){t(e)})),t.promise},t.prototype.count=function(t){t=t||ct();var e={collectionName:this._coll,queryType:v.WHERE};return this._fieldFilters&&(e.query=this._fieldFilters),this._request.send("database.countDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,total:e.data.total})})).catch((function(e){t(e)})),t.promise},t.prototype.where=function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(o.QueryParamTypeError);var r=Object.keys(e),n=r.some((function(t){return void 0!==e[t]}));if(r.length&&!n)throw Error(o.QueryParamValueError);return new t(this._db,this._coll,qt.encode(e),this._fieldOrders,this._queryOptions)},t.prototype.orderBy=function(e,r){J.isFieldPath(e),J.isFieldOrder(r);var n={field:e,direction:r},o=this._fieldOrders.concat(n);return new t(this._db,this._coll,this._fieldFilters,o,this._queryOptions)},t.prototype.limit=function(e){J.isInteger("limit",e);var r=kt({},this._queryOptions);return r.limit=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},t.prototype.skip=function(e){J.isInteger("offset",e);var r=kt({},this._queryOptions);return r.offset=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},t.prototype.update=function(t,e){if(e=e||ct(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var r={collectionName:this._coll,query:this._fieldFilters,queryType:v.WHERE,multi:!0,merge:!0,upsert:!1,data:jt.encode(t)};return this._request.send("database.updateDocument",r).then((function(t){t.code?e(0,t):e(0,{requestId:t.requestId,updated:t.data.updated,upsertId:t.data.upsert_id})})).catch((function(t){e(t)})),e.promise},t.prototype.field=function(e){for(var r in e)e[r]?"object"!=typeof e[r]&&(e[r]=1):e[r]=0;var n=kt({},this._queryOptions);return n.projection=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.remove=function(t){t=t||ct(),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 e={collectionName:this._coll,query:qt.encode(this._fieldFilters),queryType:v.WHERE,multi:!0};return this._request.send("database.deleteDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,deleted:e.data.deleted})})).catch((function(e){t(e)})),t.promise},t}(),Jt=r(0),Gt=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},Ht=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Kt=function(){function t(t,e){this._stages=[],t&&e&&(this._db=t,this._request=new _e.reqClass(this._db.config),this._collectionName=e)}return t.prototype.end=function(){return Gt(this,void 0,void 0,(function(){var t;return Ht(this,(function(e){switch(e.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(t=e.sent())&&t.data&&t.data.list?[2,{requestId:t.requestId,data:JSON.parse(t.data.list).map(Jt.a.parse)}]:[2,t]}}))}))},t.prototype.unwrap=function(){return this._stages},t.prototype.done=function(){return this._stages.map((function(t){var e,r=t.stageKey,n=t.stageValue;return(e={})[r]=JSON.parse(n),e}))},t.prototype._pipe=function(t,e){return this._stages.push({stageKey:"$"+t,stageValue:JSON.stringify(e)}),this},t.prototype.addFields=function(t){return this._pipe("addFields",t)},t.prototype.bucket=function(t){return this._pipe("bucket",t)},t.prototype.bucketAuto=function(t){return this._pipe("bucketAuto",t)},t.prototype.count=function(t){return this._pipe("count",t)},t.prototype.geoNear=function(t){return this._pipe("geoNear",t)},t.prototype.group=function(t){return this._pipe("group",t)},t.prototype.limit=function(t){return this._pipe("limit",t)},t.prototype.match=function(t){return this._pipe("match",qt.encode(t))},t.prototype.project=function(t){return this._pipe("project",t)},t.prototype.lookup=function(t){return this._pipe("lookup",t)},t.prototype.replaceRoot=function(t){return this._pipe("replaceRoot",t)},t.prototype.sample=function(t){return this._pipe("sample",t)},t.prototype.skip=function(t){return this._pipe("skip",t)},t.prototype.sort=function(t){return this._pipe("sort",t)},t.prototype.sortByCount=function(t){return this._pipe("sortByCount",t)},t.prototype.unwind=function(t){return this._pipe("unwind",t)},t}(),Vt=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wt=function(t){function e(e,r){return t.call(this,e,r)||this}return Vt(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new $t(this._db,this._coll,t)},e.prototype.add=function(t,e){return new $t(this._db,this._coll,void 0).create(t,e)},e.prototype.aggregate=function(){return new Kt(this._db,this._coll)},e}(zt),Xt={eq:function(t){return new bt(gt.EQ,[t])},neq:function(t){return new bt(gt.NEQ,[t])},lt:function(t){return new bt(gt.LT,[t])},lte:function(t){return new bt(gt.LTE,[t])},gt:function(t){return new bt(gt.GT,[t])},gte:function(t){return new bt(gt.GTE,[t])},in:function(t){return new bt(gt.IN,t)},nin:function(t){return new bt(gt.NIN,t)},all:function(t){return new bt(gt.ALL,t)},elemMatch:function(t){return new bt(gt.ELEM_MATCH,[t])},exists:function(t){return new bt(gt.EXISTS,[t])},size:function(t){return new bt(gt.SIZE,[t])},mod:function(t){return new bt(gt.MOD,[t])},geoNear:function(t){return new bt(gt.GEO_NEAR,[t])},geoWithin:function(t){return new bt(gt.GEO_WITHIN,[t])},geoIntersects:function(t){return new bt(gt.GEO_INTERSECTS,[t])},and:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=V(arguments[0])?arguments[0]:Array.from(arguments);return new dt(ht.AND,r)},nor:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=V(arguments[0])?arguments[0]:Array.from(arguments);return new dt(ht.NOR,r)},or:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=V(arguments[0])?arguments[0]:Array.from(arguments);return new dt(ht.OR,r)},not:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=V(arguments[0])?arguments[0]:Array.from(arguments);return new dt(ht.NOT,r)},set:function(t){return new lt(F.SET,[t])},remove:function(){return new lt(F.REMOVE,[])},inc:function(t){return new lt(F.INC,[t])},mul:function(t){return new lt(F.MUL,[t])},push:function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(H(e[0])&&e[0].hasOwnProperty("each")){var n=e[0];t={$each:n.each,$position:n.position,$sort:n.sort,$slice:n.slice}}else t=V(e[0])?e[0]:Array.from(e);return new lt(F.PUSH,t)},pull:function(t){return new lt(F.PULL,t)},pullAll:function(t){return new lt(F.PULL_ALL,t)},pop:function(){return new lt(F.POP,[])},shift:function(){return new lt(F.SHIFT,[])},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=V(arguments[0])?arguments[0]:Array.from(arguments);return new lt(F.UNSHIFT,r)},addToSet:function(t){return new lt(F.ADD_TO_SET,t)},rename:function(t){return new lt(F.RENAME,[t])},bit:function(t){return new lt(F.BIT,[t])},max:function(t){return new lt(F.MAX,[t])},min:function(t){return new lt(F.MIN,[t])},expr:function(t){return{$expr:t}},jsonSchema:function(t){return{$jsonSchema:t}},text:function(t){return"string"===G(t)?{$search:t.search}:{$search:t.search,$language:t.language,$caseSensitive:t.caseSensitive,$diacriticSensitive:t.diacriticSensitive}},aggregate:{pipeline:function(){return new Kt},abs:function(t){return new Zt("abs",t)},add:function(t){return new Zt("add",t)},ceil:function(t){return new Zt("ceil",t)},divide:function(t){return new Zt("divide",t)},exp:function(t){return new Zt("exp",t)},floor:function(t){return new Zt("floor",t)},ln:function(t){return new Zt("ln",t)},log:function(t){return new Zt("log",t)},log10:function(t){return new Zt("log10",t)},mod:function(t){return new Zt("mod",t)},multiply:function(t){return new Zt("multiply",t)},pow:function(t){return new Zt("pow",t)},sqrt:function(t){return new Zt("sqrt",t)},subtract:function(t){return new Zt("subtract",t)},trunc:function(t){return new Zt("trunc",t)},arrayElemAt:function(t){return new Zt("arrayElemAt",t)},arrayToObject:function(t){return new Zt("arrayToObject",t)},concatArrays:function(t){return new Zt("concatArrays",t)},filter:function(t){return new Zt("filter",t)},in:function(t){return new Zt("in",t)},indexOfArray:function(t){return new Zt("indexOfArray",t)},isArray:function(t){return new Zt("isArray",t)},map:function(t){return new Zt("map",t)},range:function(t){return new Zt("range",t)},reduce:function(t){return new Zt("reduce",t)},reverseArray:function(t){return new Zt("reverseArray",t)},size:function(t){return new Zt("size",t)},slice:function(t){return new Zt("slice",t)},zip:function(t){return new Zt("zip",t)},and:function(t){return new Zt("and",t)},not:function(t){return new Zt("not",t)},or:function(t){return new Zt("or",t)},cmp:function(t){return new Zt("cmp",t)},eq:function(t){return new Zt("eq",t)},gt:function(t){return new Zt("gt",t)},gte:function(t){return new Zt("gte",t)},lt:function(t){return new Zt("lt",t)},lte:function(t){return new Zt("lte",t)},neq:function(t){return new Zt("ne",t)},cond:function(t){return new Zt("cond",t)},ifNull:function(t){return new Zt("ifNull",t)},switch:function(t){return new Zt("switch",t)},dateFromParts:function(t){return new Zt("dateFromParts",t)},dateFromString:function(t){return new Zt("dateFromString",t)},dayOfMonth:function(t){return new Zt("dayOfMonth",t)},dayOfWeek:function(t){return new Zt("dayOfWeek",t)},dayOfYear:function(t){return new Zt("dayOfYear",t)},isoDayOfWeek:function(t){return new Zt("isoDayOfWeek",t)},isoWeek:function(t){return new Zt("isoWeek",t)},isoWeekYear:function(t){return new Zt("isoWeekYear",t)},millisecond:function(t){return new Zt("millisecond",t)},minute:function(t){return new Zt("minute",t)},month:function(t){return new Zt("month",t)},second:function(t){return new Zt("second",t)},hour:function(t){return new Zt("hour",t)},week:function(t){return new Zt("week",t)},year:function(t){return new Zt("year",t)},literal:function(t){return new Zt("literal",t)},mergeObjects:function(t){return new Zt("mergeObjects",t)},objectToArray:function(t){return new Zt("objectToArray",t)},allElementsTrue:function(t){return new Zt("allElementsTrue",t)},anyElementTrue:function(t){return new Zt("anyElementTrue",t)},setDifference:function(t){return new Zt("setDifference",t)},setEquals:function(t){return new Zt("setEquals",t)},setIntersection:function(t){return new Zt("setIntersection",t)},setIsSubset:function(t){return new Zt("setIsSubset",t)},setUnion:function(t){return new Zt("setUnion",t)},concat:function(t){return new Zt("concat",t)},dateToString:function(t){return new Zt("dateToString",t)},indexOfBytes:function(t){return new Zt("indexOfBytes",t)},indexOfCP:function(t){return new Zt("indexOfCP",t)},split:function(t){return new Zt("split",t)},strLenBytes:function(t){return new Zt("strLenBytes",t)},strLenCP:function(t){return new Zt("strLenCP",t)},strcasecmp:function(t){return new Zt("strcasecmp",t)},substr:function(t){return new Zt("substr",t)},substrBytes:function(t){return new Zt("substrBytes",t)},substrCP:function(t){return new Zt("substrCP",t)},toLower:function(t){return new Zt("toLower",t)},toUpper:function(t){return new Zt("toUpper",t)},meta:function(t){return new Zt("meta",t)},addToSet:function(t){return new Zt("addToSet",t)},avg:function(t){return new Zt("avg",t)},first:function(t){return new Zt("first",t)},last:function(t){return new Zt("last",t)},max:function(t){return new Zt("max",t)},min:function(t){return new Zt("min",t)},push:function(t){return new Zt("push",t)},stdDevPop:function(t){return new Zt("stdDevPop",t)},stdDevSamp:function(t){return new Zt("stdDevSamp",t)},sum:function(t){return new Zt("sum",t)},let:function(t){return new Zt("let",t)}},project:{slice:function(t){return new Qt("slice",t)},elemMatch:function(t){return new Qt("elemMatch",t)}}},Zt=function(t,e){this["$"+t]=e},Qt=function(t,e){this["$"+t]=e},te=function(){function t(t){var e=t.regexp,r=t.options;if(!e)throw new TypeError("regexp must be a string");this.$regex=e,this.$options=r}return t.prototype.parse=function(){return{$regex:this.$regex,$options:this.$options}},Object.defineProperty(t.prototype,"_internalType",{get:function(){return Y},enumerable:!0,configurable:!0}),t}();function ee(t){return new te(t)}var re={code:"INSERT_DOC_FAIL",message:"insert document failed"},ne={code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"},oe=function(){return(oe=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},ie=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},ue=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},se="database.updateDocInTransaction",fe=function(){function t(t,e,r){this._coll=e,this.id=r,this._transaction=t,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return t.prototype.create=function(t){return ie(this,void 0,void 0,(function(){var e,r,n,o;return ue(this,(function(i){switch(i.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,data:Jt.a.stringify(Et(t),{relaxed:!1})},this.id&&(e._id=this.id),[4,this._request.send("database.insertDocInTransaction",e)];case 1:if((r=i.sent()).code)throw r;if(n=Jt.a.parse(r.inserted),1==(o=Jt.a.parse(r.ok))&&1==n)return[2,oe(oe({},r),{ok:o,inserted:n})];throw new Error(re.message)}}))}))},t.prototype.get=function(){return ie(this,void 0,void 0,(function(){var t,e;return ue(this,(function(r){switch(r.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.getInTransaction",t)];case 1:if((e=r.sent()).code)throw e;return[2,{data:"null"!==e.data?z.formatField(Jt.a.parse(e.data)):Jt.a.parse(e.data),requestId:e.requestId}]}}))}))},t.prototype.set=function(t){return ie(this,void 0,void 0,(function(){var e,r;return ue(this,(function(n){switch(n.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Jt.a.stringify(Et(t),{relaxed:!1}),upsert:!0},[4,this._request.send(se,e)];case 1:if((r=n.sent()).code)throw r;return[2,oe(oe({},r),{updated:Jt.a.parse(r.updated),upserted:r.upserted?JSON.parse(r.upserted):null})]}}))}))},t.prototype.update=function(t){return ie(this,void 0,void 0,(function(){var e,r;return ue(this,(function(n){switch(n.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Jt.a.stringify(jt.encode(t),{relaxed:!1})},[4,this._request.send(se,e)];case 1:if((r=n.sent()).code)throw r;return[2,oe(oe({},r),{updated:Jt.a.parse(r.updated)})]}}))}))},t.prototype.delete=function(){return ie(this,void 0,void 0,(function(){var t,e;return ue(this,(function(r){switch(r.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.deleteDocInTransaction",t)];case 1:if((e=r.sent()).code)throw e;return[2,oe(oe({},e),{deleted:Jt.a.parse(e.deleted)})]}}))}))},t}(),ae=function(t,e){this._coll=e,this._transaction=t},ce=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),le=function(t){function e(e,r){return t.call(this,e,r)||this}return ce(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new fe(this._transaction,this._coll,t)},e.prototype.add=function(t){var e;return void 0!==t._id&&(e=t._id),new fe(this._transaction,this._coll,e).create(t)},e}(ae),pe=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},he=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},de=function(){function t(t){this._db=t,this._request=new _e.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return t.prototype.init=function(){return pe(this,void 0,void 0,(function(){var t;return he(this,(function(e){switch(e.label){case 0:return[4,this._request.send("database.startTransaction")];case 1:if((t=e.sent()).code)throw t;return this.inited=!0,this._id=t.transactionId,[2]}}))}))},t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new le(this,t)},t.prototype.getTransactionId=function(){return this._id},t.prototype.getRequestMethod=function(){return this._request},t.prototype.commit=function(){return pe(this,void 0,void 0,(function(){var t,e;return he(this,(function(r){switch(r.label){case 0:return t={transactionId:this._id},[4,this._request.send("database.commitTransaction",t)];case 1:if((e=r.sent()).code)throw e;return this.commited=!0,[2,e]}}))}))},t.prototype.rollback=function(t){return pe(this,void 0,void 0,(function(){var e,r;return he(this,(function(n){switch(n.label){case 0:return e={transactionId:this._id},[4,this._request.send("database.abortTransaction",e)];case 1:if((r=n.sent()).code)throw r;return this.aborted=!0,this.abortReason=t,[2,r]}}))}))},t}();function ye(){return pe(this,void 0,void 0,(function(){var t;return he(this,(function(e){switch(e.label){case 0:return[4,(t=new de(this)).init()];case 1:return e.sent(),[2,t]}}))}))}function ge(t,e){return void 0===e&&(e=3),pe(this,void 0,void 0,(function(){var r,n,o,i,u=this;return he(this,(function(s){switch(s.label){case 0:return s.trys.push([0,4,,10]),[4,(r=new de(this)).init()];case 1:return s.sent(),[4,t(r)];case 2:if(n=s.sent(),!0===r.aborted)throw r.abortReason;return[4,r.commit()];case 3:return s.sent(),[2,n];case 4:if(o=s.sent(),!1===r.inited)throw o;return i=function(t){return pe(u,void 0,void 0,(function(){return he(this,(function(e){switch(e.label){case 0:if(r.aborted||r.commited)return[3,5];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,r.rollback()];case 2:return e.sent(),[3,4];case 3:return e.sent(),[3,4];case 4:throw t;case 5:if(!0===r.aborted)throw r.abortReason;throw t}}))}))},e<=0?[4,i(o)]:[3,6];case 5:s.sent(),s.label=6;case 6:return o&&o.code===ne.code?[4,ge.bind(this)(t,--e)]:[3,8];case 7:return[2,s.sent()];case 8:return[4,i(o)];case 9:return s.sent(),[3,10];case 10:return[2]}}))}))}var _e=function(){function t(t){this.config=t,this.Geo=i,this.serverDate=q,this.command=Xt,this.RegExp=ee,this.startTransaction=ye,this.runTransaction=ge,this.logicCommand=dt,this.updateCommand=lt,this.queryCommand=bt}return t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new Wt(this,t)},t.prototype.createCollection=function(e){var r={collectionName:e};return new t.reqClass(this.config).send("database.addCollection",r)},t}()}])}));
|