pybiolib 0.2.951__py3-none-any.whl → 1.2.1890__py3-none-any.whl
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.
- biolib/__init__.py +357 -11
- biolib/_data_record/data_record.py +380 -0
- biolib/_index/__init__.py +0 -0
- biolib/_index/index.py +55 -0
- biolib/_index/query_result.py +103 -0
- biolib/_internal/__init__.py +0 -0
- biolib/_internal/add_copilot_prompts.py +58 -0
- biolib/_internal/add_gui_files.py +81 -0
- biolib/_internal/data_record/__init__.py +1 -0
- biolib/_internal/data_record/data_record.py +85 -0
- biolib/_internal/data_record/push_data.py +116 -0
- biolib/_internal/data_record/remote_storage_endpoint.py +43 -0
- biolib/_internal/errors.py +5 -0
- biolib/_internal/file_utils.py +125 -0
- biolib/_internal/fuse_mount/__init__.py +1 -0
- biolib/_internal/fuse_mount/experiment_fuse_mount.py +209 -0
- biolib/_internal/http_client.py +159 -0
- biolib/_internal/lfs/__init__.py +1 -0
- biolib/_internal/lfs/cache.py +51 -0
- biolib/_internal/libs/__init__.py +1 -0
- biolib/_internal/libs/fusepy/__init__.py +1257 -0
- biolib/_internal/push_application.py +488 -0
- biolib/_internal/runtime.py +22 -0
- biolib/_internal/string_utils.py +13 -0
- biolib/_internal/templates/__init__.py +1 -0
- biolib/_internal/templates/copilot_template/.github/instructions/general-app-knowledge.instructions.md +10 -0
- biolib/_internal/templates/copilot_template/.github/instructions/style-general.instructions.md +20 -0
- biolib/_internal/templates/copilot_template/.github/instructions/style-python.instructions.md +16 -0
- biolib/_internal/templates/copilot_template/.github/instructions/style-react-ts.instructions.md +47 -0
- biolib/_internal/templates/copilot_template/.github/prompts/biolib_app_inputs.prompt.md +11 -0
- biolib/_internal/templates/copilot_template/.github/prompts/biolib_onboard_repo.prompt.md +19 -0
- biolib/_internal/templates/copilot_template/.github/prompts/biolib_run_apps.prompt.md +12 -0
- biolib/_internal/templates/dashboard_template/.biolib/config.yml +5 -0
- biolib/_internal/templates/github_workflow_template/.github/workflows/biolib.yml +21 -0
- biolib/_internal/templates/gitignore_template/.gitignore +10 -0
- biolib/_internal/templates/gui_template/.yarnrc.yml +1 -0
- biolib/_internal/templates/gui_template/App.tsx +53 -0
- biolib/_internal/templates/gui_template/Dockerfile +27 -0
- biolib/_internal/templates/gui_template/biolib-sdk.ts +82 -0
- biolib/_internal/templates/gui_template/dev-data/output.json +7 -0
- biolib/_internal/templates/gui_template/index.css +5 -0
- biolib/_internal/templates/gui_template/index.html +13 -0
- biolib/_internal/templates/gui_template/index.tsx +10 -0
- biolib/_internal/templates/gui_template/package.json +27 -0
- biolib/_internal/templates/gui_template/tsconfig.json +24 -0
- biolib/_internal/templates/gui_template/vite-plugin-dev-data.ts +50 -0
- biolib/_internal/templates/gui_template/vite.config.mts +10 -0
- biolib/_internal/templates/init_template/.biolib/config.yml +19 -0
- biolib/_internal/templates/init_template/Dockerfile +14 -0
- biolib/_internal/templates/init_template/requirements.txt +1 -0
- biolib/_internal/templates/init_template/run.py +12 -0
- biolib/_internal/templates/init_template/run.sh +4 -0
- biolib/_internal/templates/templates.py +25 -0
- biolib/_internal/tree_utils.py +106 -0
- biolib/_internal/utils/__init__.py +65 -0
- biolib/_internal/utils/auth.py +46 -0
- biolib/_internal/utils/job_url.py +33 -0
- biolib/_internal/utils/multinode.py +263 -0
- biolib/_runtime/runtime.py +157 -0
- biolib/_session/session.py +44 -0
- biolib/_shared/__init__.py +0 -0
- biolib/_shared/types/__init__.py +74 -0
- biolib/_shared/types/account.py +12 -0
- biolib/_shared/types/account_member.py +8 -0
- biolib/_shared/types/app.py +9 -0
- biolib/_shared/types/data_record.py +40 -0
- biolib/_shared/types/experiment.py +32 -0
- biolib/_shared/types/file_node.py +17 -0
- biolib/_shared/types/push.py +6 -0
- biolib/_shared/types/resource.py +37 -0
- biolib/_shared/types/resource_deploy_key.py +11 -0
- biolib/_shared/types/resource_permission.py +14 -0
- biolib/_shared/types/resource_version.py +19 -0
- biolib/_shared/types/result.py +14 -0
- biolib/_shared/types/typing.py +10 -0
- biolib/_shared/types/user.py +19 -0
- biolib/_shared/utils/__init__.py +7 -0
- biolib/_shared/utils/resource_uri.py +75 -0
- biolib/api/__init__.py +6 -0
- biolib/api/client.py +168 -0
- biolib/app/app.py +252 -49
- biolib/app/search_apps.py +45 -0
- biolib/biolib_api_client/api_client.py +126 -31
- biolib/biolib_api_client/app_types.py +24 -4
- biolib/biolib_api_client/auth.py +31 -8
- biolib/biolib_api_client/biolib_app_api.py +147 -52
- biolib/biolib_api_client/biolib_job_api.py +161 -141
- biolib/biolib_api_client/job_types.py +21 -5
- biolib/biolib_api_client/lfs_types.py +7 -23
- biolib/biolib_api_client/user_state.py +56 -0
- biolib/biolib_binary_format/__init__.py +1 -4
- biolib/biolib_binary_format/file_in_container.py +105 -0
- biolib/biolib_binary_format/module_input.py +24 -7
- biolib/biolib_binary_format/module_output_v2.py +149 -0
- biolib/biolib_binary_format/remote_endpoints.py +34 -0
- biolib/biolib_binary_format/remote_stream_seeker.py +59 -0
- biolib/biolib_binary_format/saved_job.py +3 -2
- biolib/biolib_binary_format/{attestation_document.py → stdout_and_stderr.py} +8 -8
- biolib/biolib_binary_format/system_status_update.py +3 -2
- biolib/biolib_binary_format/utils.py +175 -0
- biolib/biolib_docker_client/__init__.py +11 -2
- biolib/biolib_errors.py +36 -0
- biolib/biolib_logging.py +27 -10
- biolib/cli/__init__.py +38 -0
- biolib/cli/auth.py +46 -0
- biolib/cli/data_record.py +164 -0
- biolib/cli/index.py +32 -0
- biolib/cli/init.py +421 -0
- biolib/cli/lfs.py +101 -0
- biolib/cli/push.py +50 -0
- biolib/cli/run.py +63 -0
- biolib/cli/runtime.py +14 -0
- biolib/cli/sdk.py +16 -0
- biolib/cli/start.py +56 -0
- biolib/compute_node/cloud_utils/cloud_utils.py +110 -161
- biolib/compute_node/job_worker/cache_state.py +66 -88
- biolib/compute_node/job_worker/cache_types.py +1 -6
- biolib/compute_node/job_worker/docker_image_cache.py +112 -37
- biolib/compute_node/job_worker/executors/__init__.py +0 -3
- biolib/compute_node/job_worker/executors/docker_executor.py +532 -199
- biolib/compute_node/job_worker/executors/docker_types.py +9 -1
- biolib/compute_node/job_worker/executors/types.py +19 -9
- biolib/compute_node/job_worker/job_legacy_input_wait_timeout_thread.py +30 -0
- biolib/compute_node/job_worker/job_max_runtime_timer_thread.py +3 -5
- biolib/compute_node/job_worker/job_storage.py +108 -0
- biolib/compute_node/job_worker/job_worker.py +397 -212
- biolib/compute_node/job_worker/large_file_system.py +87 -38
- biolib/compute_node/job_worker/network_alloc.py +99 -0
- biolib/compute_node/job_worker/network_buffer.py +240 -0
- biolib/compute_node/job_worker/utilization_reporter_thread.py +197 -0
- biolib/compute_node/job_worker/utils.py +9 -24
- biolib/compute_node/remote_host_proxy.py +400 -98
- biolib/compute_node/utils.py +31 -9
- biolib/compute_node/webserver/compute_node_results_proxy.py +189 -0
- biolib/compute_node/webserver/proxy_utils.py +28 -0
- biolib/compute_node/webserver/webserver.py +130 -44
- biolib/compute_node/webserver/webserver_types.py +2 -6
- biolib/compute_node/webserver/webserver_utils.py +77 -12
- biolib/compute_node/webserver/worker_thread.py +183 -42
- biolib/experiments/__init__.py +0 -0
- biolib/experiments/experiment.py +356 -0
- biolib/jobs/__init__.py +1 -0
- biolib/jobs/job.py +741 -0
- biolib/jobs/job_result.py +185 -0
- biolib/jobs/types.py +50 -0
- biolib/py.typed +0 -0
- biolib/runtime/__init__.py +14 -0
- biolib/sdk/__init__.py +91 -0
- biolib/tables.py +34 -0
- biolib/typing_utils.py +2 -7
- biolib/user/__init__.py +1 -0
- biolib/user/sign_in.py +54 -0
- biolib/utils/__init__.py +162 -0
- biolib/utils/cache_state.py +94 -0
- biolib/utils/multipart_uploader.py +194 -0
- biolib/utils/seq_util.py +150 -0
- biolib/utils/zip/remote_zip.py +640 -0
- pybiolib-1.2.1890.dist-info/METADATA +41 -0
- pybiolib-1.2.1890.dist-info/RECORD +177 -0
- {pybiolib-0.2.951.dist-info → pybiolib-1.2.1890.dist-info}/WHEEL +1 -1
- pybiolib-1.2.1890.dist-info/entry_points.txt +2 -0
- README.md +0 -17
- biolib/app/app_result.py +0 -68
- biolib/app/utils.py +0 -62
- biolib/biolib-js/0-biolib.worker.js +0 -1
- biolib/biolib-js/1-biolib.worker.js +0 -1
- biolib/biolib-js/2-biolib.worker.js +0 -1
- biolib/biolib-js/3-biolib.worker.js +0 -1
- biolib/biolib-js/4-biolib.worker.js +0 -1
- biolib/biolib-js/5-biolib.worker.js +0 -1
- biolib/biolib-js/6-biolib.worker.js +0 -1
- biolib/biolib-js/index.html +0 -10
- biolib/biolib-js/main-biolib.js +0 -1
- biolib/biolib_api_client/biolib_account_api.py +0 -21
- biolib/biolib_api_client/biolib_large_file_system_api.py +0 -108
- biolib/biolib_binary_format/aes_encrypted_package.py +0 -42
- biolib/biolib_binary_format/module_output.py +0 -58
- biolib/biolib_binary_format/rsa_encrypted_aes_package.py +0 -57
- biolib/biolib_push.py +0 -114
- biolib/cli.py +0 -203
- biolib/cli_utils.py +0 -273
- biolib/compute_node/cloud_utils/enclave_parent_types.py +0 -7
- biolib/compute_node/enclave/__init__.py +0 -2
- biolib/compute_node/enclave/enclave_remote_hosts.py +0 -53
- biolib/compute_node/enclave/nitro_secure_module_utils.py +0 -64
- biolib/compute_node/job_worker/executors/base_executor.py +0 -18
- biolib/compute_node/job_worker/executors/pyppeteer_executor.py +0 -173
- biolib/compute_node/job_worker/executors/remote/__init__.py +0 -1
- biolib/compute_node/job_worker/executors/remote/nitro_enclave_utils.py +0 -81
- biolib/compute_node/job_worker/executors/remote/remote_executor.py +0 -51
- biolib/lfs.py +0 -196
- biolib/pyppeteer/.circleci/config.yml +0 -100
- biolib/pyppeteer/.coveragerc +0 -3
- biolib/pyppeteer/.gitignore +0 -89
- biolib/pyppeteer/.pre-commit-config.yaml +0 -28
- biolib/pyppeteer/CHANGES.md +0 -253
- biolib/pyppeteer/CONTRIBUTING.md +0 -26
- biolib/pyppeteer/LICENSE +0 -12
- biolib/pyppeteer/README.md +0 -137
- biolib/pyppeteer/docs/Makefile +0 -177
- biolib/pyppeteer/docs/_static/custom.css +0 -28
- biolib/pyppeteer/docs/_templates/layout.html +0 -10
- biolib/pyppeteer/docs/changes.md +0 -1
- biolib/pyppeteer/docs/conf.py +0 -299
- biolib/pyppeteer/docs/index.md +0 -21
- biolib/pyppeteer/docs/make.bat +0 -242
- biolib/pyppeteer/docs/reference.md +0 -211
- biolib/pyppeteer/docs/server.py +0 -60
- biolib/pyppeteer/poetry.lock +0 -1699
- biolib/pyppeteer/pyppeteer/__init__.py +0 -135
- biolib/pyppeteer/pyppeteer/accessibility.py +0 -286
- biolib/pyppeteer/pyppeteer/browser.py +0 -401
- biolib/pyppeteer/pyppeteer/browser_fetcher.py +0 -194
- biolib/pyppeteer/pyppeteer/command.py +0 -22
- biolib/pyppeteer/pyppeteer/connection/__init__.py +0 -242
- biolib/pyppeteer/pyppeteer/connection/cdpsession.py +0 -101
- biolib/pyppeteer/pyppeteer/coverage.py +0 -346
- biolib/pyppeteer/pyppeteer/device_descriptors.py +0 -787
- biolib/pyppeteer/pyppeteer/dialog.py +0 -79
- biolib/pyppeteer/pyppeteer/domworld.py +0 -597
- biolib/pyppeteer/pyppeteer/emulation_manager.py +0 -53
- biolib/pyppeteer/pyppeteer/errors.py +0 -48
- biolib/pyppeteer/pyppeteer/events.py +0 -63
- biolib/pyppeteer/pyppeteer/execution_context.py +0 -156
- biolib/pyppeteer/pyppeteer/frame/__init__.py +0 -299
- biolib/pyppeteer/pyppeteer/frame/frame_manager.py +0 -306
- biolib/pyppeteer/pyppeteer/helpers.py +0 -245
- biolib/pyppeteer/pyppeteer/input.py +0 -371
- biolib/pyppeteer/pyppeteer/jshandle.py +0 -598
- biolib/pyppeteer/pyppeteer/launcher.py +0 -683
- biolib/pyppeteer/pyppeteer/lifecycle_watcher.py +0 -169
- biolib/pyppeteer/pyppeteer/models/__init__.py +0 -103
- biolib/pyppeteer/pyppeteer/models/_protocol.py +0 -12460
- biolib/pyppeteer/pyppeteer/multimap.py +0 -82
- biolib/pyppeteer/pyppeteer/network_manager.py +0 -678
- biolib/pyppeteer/pyppeteer/options.py +0 -8
- biolib/pyppeteer/pyppeteer/page.py +0 -1728
- biolib/pyppeteer/pyppeteer/pipe_transport.py +0 -59
- biolib/pyppeteer/pyppeteer/target.py +0 -147
- biolib/pyppeteer/pyppeteer/task_queue.py +0 -24
- biolib/pyppeteer/pyppeteer/timeout_settings.py +0 -36
- biolib/pyppeteer/pyppeteer/tracing.py +0 -93
- biolib/pyppeteer/pyppeteer/us_keyboard_layout.py +0 -305
- biolib/pyppeteer/pyppeteer/util.py +0 -18
- biolib/pyppeteer/pyppeteer/websocket_transport.py +0 -47
- biolib/pyppeteer/pyppeteer/worker.py +0 -101
- biolib/pyppeteer/pyproject.toml +0 -97
- biolib/pyppeteer/spell.txt +0 -137
- biolib/pyppeteer/tox.ini +0 -72
- biolib/pyppeteer/utils/generate_protocol_types.py +0 -603
- biolib/start_cli.py +0 -7
- biolib/utils.py +0 -47
- biolib/validators/validate_app_version.py +0 -183
- biolib/validators/validate_argument.py +0 -134
- biolib/validators/validate_module.py +0 -323
- biolib/validators/validate_zip_file.py +0 -40
- biolib/validators/validator_utils.py +0 -103
- pybiolib-0.2.951.dist-info/LICENSE +0 -21
- pybiolib-0.2.951.dist-info/METADATA +0 -61
- pybiolib-0.2.951.dist-info/RECORD +0 -153
- pybiolib-0.2.951.dist-info/entry_points.txt +0 -3
- /LICENSE → /pybiolib-1.2.1890.dist-info/licenses/LICENSE +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=120)}([function(e,t,r){"use strict";r.d(t,"r",(function(){return d})),r.d(t,"g",(function(){return p})),r.d(t,"d",(function(){return v})),r.d(t,"v",(function(){return w})),r.d(t,"w",(function(){return _})),r.d(t,"n",(function(){return A})),r.d(t,"q",(function(){return B})),r.d(t,"b",(function(){return E})),r.d(t,"m",(function(){return N})),r.d(t,"h",(function(){return x})),r.d(t,"p",(function(){return j})),r.d(t,"A",(function(){return P})),r.d(t,"c",(function(){return M})),r.d(t,"z",(function(){return H})),r.d(t,"o",(function(){return K})),r.d(t,"s",(function(){return z})),r.d(t,"x",(function(){return q})),r.d(t,"B",(function(){return J})),r.d(t,"l",(function(){return Y})),r.d(t,"k",(function(){return G})),r.d(t,"C",(function(){return W})),r.d(t,"i",(function(){return X})),r.d(t,"e",(function(){return Q})),r.d(t,"y",(function(){return Z})),r.d(t,"j",(function(){return ee})),r.d(t,"f",(function(){return ae})),r.d(t,"a",(function(){return oe})),r.d(t,"u",(function(){return ue})),r.d(t,"t",(function(){return ce})),r.d(t,"E",(function(){return he})),r.d(t,"D",(function(){return fe}));var n=r(1);const i=[new Uint8Array([1])],s="0123456789";class a{constructor(e={}){this.blockLength=Object(n.f)(e,"blockLength",0),this.error=Object(n.f)(e,"error",""),this.warnings=Object(n.f)(e,"warnings",[]),this.valueBeforeDecode="valueBeforeDecode"in e?e.valueBeforeDecode.slice(0):new ArrayBuffer(0)}static blockName(){return"baseBlock"}toJSON(){return{blockName:this.constructor.blockName(),blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:Object(n.b)(this.valueBeforeDecode,0,this.valueBeforeDecode.byteLength)}}}const o=e=>class extends e{constructor(e={}){super(e),this.isHexOnly=Object(n.f)(e,"isHexOnly",!1),this.valueHex="valueHex"in e?e.valueHex.slice(0):new ArrayBuffer(0)}static blockName(){return"hexBlock"}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;return 0===new Uint8Array(e,t,r).length?(this.warnings.push("Zero buffer length"),t):(this.valueHex=e.slice(t,t+r),this.blockLength=r,t+r)}toBER(e=!1){return!0!==this.isHexOnly?(this.error='Flag "isHexOnly" is not set, abort',new ArrayBuffer(0)):!0===e?new ArrayBuffer(this.valueHex.byteLength):this.valueHex.slice(0)}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.blockName=this.constructor.blockName(),e.isHexOnly=this.isHexOnly,e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e}};class u extends(o(a)){constructor(e={}){super(),"idBlock"in e?(this.isHexOnly=Object(n.f)(e.idBlock,"isHexOnly",!1),this.valueHex=Object(n.f)(e.idBlock,"valueHex",new ArrayBuffer(0)),this.tagClass=Object(n.f)(e.idBlock,"tagClass",-1),this.tagNumber=Object(n.f)(e.idBlock,"tagNumber",-1),this.isConstructed=Object(n.f)(e.idBlock,"isConstructed",!1)):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}static blockName(){return"identificationBlock"}toBER(e=!1){let t,r,i=0;switch(this.tagClass){case 1:i|=0;break;case 2:i|=64;break;case 3:i|=128;break;case 4:i|=192;break;default:return this.error="Unknown tag class",new ArrayBuffer(0)}if(this.isConstructed&&(i|=32),this.tagNumber<31&&!this.isHexOnly){if(t=new ArrayBuffer(1),r=new Uint8Array(t),!e){let e=this.tagNumber;e&=31,i|=e,r[0]=i}return t}if(!1===this.isHexOnly){const s=Object(n.q)(this.tagNumber,7),a=new Uint8Array(s),o=s.byteLength;if(t=new ArrayBuffer(o+1),r=new Uint8Array(t),r[0]=31|i,!e){for(let e=0;e<o-1;e++)r[e+1]=128|a[e];r[o]=a[o-1]}return t}if(t=new ArrayBuffer(this.valueHex.byteLength+1),r=new Uint8Array(t),r[0]=31|i,!1===e){const e=new Uint8Array(this.valueHex);for(let t=0;t<e.length-1;t++)r[t+1]=128|e[t];r[this.valueHex.byteLength]=e[e.length-1]}return t}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;const i=new Uint8Array(e,t,r);if(0===i.length)return this.error="Zero buffer length",-1;switch(192&i[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=32==(32&i[0]),this.isHexOnly=!1;const s=31&i[0];if(31!==s)this.tagNumber=s,this.blockLength=1;else{let e=1;this.valueHex=new ArrayBuffer(255);let t=255,r=new Uint8Array(this.valueHex);for(;128&i[e];){if(r[e-1]=127&i[e],e++,e>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(e===t){t+=255;const e=new ArrayBuffer(t),n=new Uint8Array(e);for(let e=0;e<r.length;e++)n[e]=r[e];this.valueHex=new ArrayBuffer(t),r=new Uint8Array(this.valueHex)}}this.blockLength=e+1,r[e-1]=127&i[e];const s=new ArrayBuffer(e),a=new Uint8Array(s);for(let t=0;t<e;t++)a[t]=r[t];this.valueHex=new ArrayBuffer(e),r=new Uint8Array(this.valueHex),r.set(a),this.blockLength<=9?this.tagNumber=Object(n.p)(r,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.blockName=this.constructor.blockName(),e.tagClass=this.tagClass,e.tagNumber=this.tagNumber,e.isConstructed=this.isConstructed,e}}class c extends a{constructor(e={}){super(),"lenBlock"in e?(this.isIndefiniteForm=Object(n.f)(e.lenBlock,"isIndefiniteForm",!1),this.longFormUsed=Object(n.f)(e.lenBlock,"longFormUsed",!1),this.length=Object(n.f)(e.lenBlock,"length",0)):(this.isIndefiniteForm=!1,this.longFormUsed=!1,this.length=0)}static blockName(){return"lengthBlock"}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;const i=new Uint8Array(e,t,r);if(0===i.length)return this.error="Zero buffer length",-1;if(255===i[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===i[0],!0===this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(128&i[0]),!1===this.longFormUsed)return this.length=i[0],this.blockLength=1,t+this.blockLength;const s=127&i[0];if(s>8)return this.error="Too big integer",-1;if(s+1>i.length)return this.error="End of input reached before message was fully decoded",-1;const a=new Uint8Array(s);for(let e=0;e<s;e++)a[e]=i[e+1];return 0===a[s-1]&&this.warnings.push("Needlessly long encoded length"),this.length=Object(n.p)(a,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=s+1,t+this.blockLength}toBER(e=!1){let t,r;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&(r=new Uint8Array(t),r[0]=128),t;if(!0===this.longFormUsed){const i=Object(n.q)(this.length,8);if(i.byteLength>127)return this.error="Too big length",new ArrayBuffer(0);if(t=new ArrayBuffer(i.byteLength+1),!0===e)return t;const s=new Uint8Array(i);r=new Uint8Array(t),r[0]=128|i.byteLength;for(let e=0;e<i.byteLength;e++)r[e+1]=s[e];return t}return t=new ArrayBuffer(1),!1===e&&(r=new Uint8Array(t),r[0]=this.length),t}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.blockName=this.constructor.blockName(),e.isIndefiniteForm=this.isIndefiniteForm,e.longFormUsed=this.longFormUsed,e.length=this.length,e}}class l extends a{constructor(e={}){super(e)}static blockName(){return"valueBlock"}fromBER(e,t,r){throw TypeError('User need to make a specific function in a class which extends "ValueBlock"')}toBER(e=!1){throw TypeError('User need to make a specific function in a class which extends "ValueBlock"')}}class h extends a{constructor(e={},t=l){super(e),"name"in e&&(this.name=e.name),"optional"in e&&(this.optional=e.optional),"primitiveSchema"in e&&(this.primitiveSchema=e.primitiveSchema),this.idBlock=new u(e),this.lenBlock=new c(e),this.valueBlock=new t(e)}static blockName(){return"BaseBlock"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}toBER(e=!1){let t;const r=this.idBlock.toBER(e),i=this.valueBlock.toBER(!0);this.lenBlock.length=i.byteLength;const s=this.lenBlock.toBER(e);let a;if(t=Object(n.l)(r,s),a=!1===e?this.valueBlock.toBER(e):new ArrayBuffer(this.lenBlock.length),t=Object(n.l)(t,a),!0===this.lenBlock.isIndefiniteForm){const r=new ArrayBuffer(2);if(!1===e){const e=new Uint8Array(r);e[0]=0,e[1]=0}t=Object(n.l)(t,r)}return t}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.idBlock=this.idBlock.toJSON(),e.lenBlock=this.lenBlock.toJSON(),e.valueBlock=this.valueBlock.toJSON(),"name"in this&&(e.name=this.name),"optional"in this&&(e.optional=this.optional),"primitiveSchema"in this&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(){return`${this.constructor.blockName()} : ${Object(n.b)(this.valueBlock.valueHex)}`}}class f extends l{constructor(e={}){super(e),this.valueHex="valueHex"in e?e.valueHex.slice(0):new ArrayBuffer(0),this.isHexOnly=Object(n.f)(e,"isHexOnly",!0)}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;const i=new Uint8Array(e,t,r);if(0===i.length)return this.warnings.push("Zero buffer length"),t;this.valueHex=new ArrayBuffer(i.length);const s=new Uint8Array(this.valueHex);for(let e=0;e<i.length;e++)s[e]=i[e];return this.blockLength=r,t+r}toBER(e=!1){return this.valueHex.slice(0)}static blockName(){return"PrimitiveValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e.isHexOnly=this.isHexOnly,e}}class d extends h{constructor(e={}){super(e,f),this.idBlock.isConstructed=!1}static blockName(){return"PRIMITIVE"}}class m extends l{constructor(e={}){super(e),this.value=Object(n.f)(e,"value",[]),this.isIndefiniteForm=Object(n.f)(e,"isIndefiniteForm",!1)}fromBER(e,t,r){const i=t,s=r;if(!1===Object(n.c)(this,e,t,r))return-1;if(0===new Uint8Array(e,t,r).length)return this.warnings.push("Zero buffer length"),t;let a=t;for(;o=this.isIndefiniteForm,u=r,(!0===o?1:u)>0;){const t=le(e,a,r);if(-1===t.offset)return this.error=t.result.error,this.warnings.concat(t.result.warnings),-1;if(a=t.offset,this.blockLength+=t.result.blockLength,r-=t.result.blockLength,this.value.push(t.result),!0===this.isIndefiniteForm&&t.result.constructor.blockName()===g.blockName())break}var o,u;return!0===this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.blockName()===g.blockName()?this.value.pop():this.warnings.push("No EndOfContent block encoded")),this.valueBeforeDecode=e.slice(i,i+s),a}toBER(e=!1){let t=new ArrayBuffer(0);for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);t=Object(n.l)(t,i)}return t}static blockName(){return"ConstructedValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}e.isIndefiniteForm=this.isIndefiniteForm,e.value=[];for(let t=0;t<this.value.length;t++)e.value.push(this.value[t].toJSON());return e}}class p extends h{constructor(e={}){super(e,m),this.idBlock.isConstructed=!0}static blockName(){return"CONSTRUCTED"}fromBER(e,t,r){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}toString(){const e=[];for(const t of this.valueBlock.value)e.push(t.toString().split("\n").map((e=>` ${e}`)).join("\n"));const t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.blockName();return e.length?`${t} :\n${e.join("\n")}`:`${t} :`}}class b extends l{constructor(e={}){super(e)}fromBER(e,t,r){return t}toBER(e=!1){return new ArrayBuffer(0)}static blockName(){return"EndOfContentValueBlock"}}class g extends h{constructor(e={}){super(e,b),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}static blockName(){return"EndOfContent"}}class y extends l{constructor(e={}){if(super(e),this.value=Object(n.f)(e,"value",!1),this.isHexOnly=Object(n.f)(e,"isHexOnly",!1),"valueHex"in e)this.valueHex=e.valueHex.slice(0);else if(this.valueHex=new ArrayBuffer(1),!0===this.value){new Uint8Array(this.valueHex)[0]=255}}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;const i=new Uint8Array(e,t,r);r>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,this.valueHex=new ArrayBuffer(i.length);const s=new Uint8Array(this.valueHex);for(let e=0;e<i.length;e++)s[e]=i[e];return 0!==n.n.call(this)?this.value=!0:this.value=!1,this.blockLength=r,t+r}toBER(e=!1){return this.valueHex}static blockName(){return"BooleanValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e.isHexOnly=this.isHexOnly,e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e}}class v extends h{constructor(e={}){super(e,y),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}static blockName(){return"BOOLEAN"}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class w extends p{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}static blockName(){return"SEQUENCE"}}class _ extends p{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}static blockName(){return"SET"}}class A extends h{constructor(e={}){super(e,a),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}static blockName(){return"NULL"}fromBER(e,t,r){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=r,t+r>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+r}toBER(e=!1){const t=new ArrayBuffer(2);if(!0===e)return t;const r=new Uint8Array(t);return r[0]=5,r[1]=0,t}toString(){return`${this.constructor.blockName()}`}}class S extends(o(m)){constructor(e={}){super(e),this.isConstructed=Object(n.f)(e,"isConstructed",!1)}fromBER(e,t,r){let n=0;if(!0===this.isConstructed){if(this.isHexOnly=!1,n=m.prototype.fromBER.call(this,e,t,r),-1===n)return n;for(let e=0;e<this.value.length;e++){const t=this.value[e].constructor.blockName();if(t===g.blockName()){if(!0===this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(t!==B.blockName())return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,n=super.fromBER(e,t,r),this.blockLength=r;return n}toBER(e=!1){if(!0===this.isConstructed)return m.prototype.toBER.call(this,e);let t=new ArrayBuffer(this.valueHex.byteLength);return!0===e||0===this.valueHex.byteLength||(t=this.valueHex.slice(0)),t}static blockName(){return"OctetStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.isConstructed=this.isConstructed,e.isHexOnly=this.isHexOnly,e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e}}class B extends h{constructor(e={}){super(e,S),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,r){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===r)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const n=e.slice(t,t+r);try{const e=he(n);-1!==e.offset&&e.offset===r&&(this.valueBlock.value=[e.result])}catch(e){}}return super.fromBER(e,t,r)}static blockName(){return"OCTET STRING"}isEqual(e){return e instanceof B!=!1&&JSON.stringify(this)===JSON.stringify(e)}toString(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?p.prototype.toString.call(this):`${this.constructor.blockName()} : ${Object(n.b)(this.valueBlock.valueHex)}`}}class k extends(o(m)){constructor(e={}){super(e),this.unusedBits=Object(n.f)(e,"unusedBits",0),this.isConstructed=Object(n.f)(e,"isConstructed",!1),this.blockLength=this.valueHex.byteLength}fromBER(e,t,r){if(0===r)return t;let i=-1;if(!0===this.isConstructed){if(i=m.prototype.fromBER.call(this,e,t,r),-1===i)return i;for(let e=0;e<this.value.length;e++){const t=this.value[e].constructor.blockName();if(t===g.blockName()){if(!0===this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(t!==E.blockName())return this.error="BIT STRING may consists of BIT STRINGs only",-1;if(this.unusedBits>0&&this.value[e].valueBlock.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;if(this.unusedBits=this.value[e].valueBlock.unusedBits,this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1}return i}if(!1===Object(n.c)(this,e,t,r))return-1;const s=new Uint8Array(e,t,r);if(this.unusedBits=s[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const n=e.slice(t+1,t+r);try{const e=he(n);-1!==e.offset&&e.offset===r-1&&(this.value=[e.result])}catch(e){}}this.valueHex=new ArrayBuffer(s.length-1);const a=new Uint8Array(this.valueHex);for(let e=0;e<r-1;e++)a[e]=s[e+1];return this.blockLength=s.length,t+r}toBER(e=!1){if(!0===this.isConstructed)return m.prototype.toBER.call(this,e);if(!0===e)return new ArrayBuffer(this.valueHex.byteLength+1);if(0===this.valueHex.byteLength)return new ArrayBuffer(0);const t=new Uint8Array(this.valueHex),r=new ArrayBuffer(this.valueHex.byteLength+1),n=new Uint8Array(r);n[0]=this.unusedBits;for(let e=0;e<this.valueHex.byteLength;e++)n[e+1]=t[e];return r}static blockName(){return"BitStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.unusedBits=this.unusedBits,e.isConstructed=this.isConstructed,e.isHexOnly=this.isHexOnly,e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e}}class E extends h{constructor(e={}){super(e,k),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}static blockName(){return"BIT STRING"}fromBER(e,t,r){return 0===r?t:(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,r))}isEqual(e){return e instanceof E!=!1&&JSON.stringify(this)===JSON.stringify(e)}toString(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return p.prototype.toString.call(this);{const e=[],t=new Uint8Array(this.valueBlock.valueHex);for(const r of t)e.push(r.toString(2).padStart(8,"0"));return`${this.constructor.blockName()} : ${e.join("")}`}}}class O extends(o(l)){constructor(e={}){super(e),"value"in e&&(this.valueDec=e.value)}set valueHex(e){this._valueHex=e.slice(0),e.byteLength>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,e.byteLength>0&&(this._valueDec=n.n.call(this)))}get valueHex(){return this._valueHex}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this._valueHex=Object(n.o)(e)}get valueDec(){return this._valueDec}fromDER(e,t,r,n=0){const i=this.fromBER(e,t,r);if(-1===i)return i;const s=new Uint8Array(this._valueHex);if(0===s[0]&&0!=(128&s[1])){const e=new ArrayBuffer(this._valueHex.byteLength-1);new Uint8Array(e).set(new Uint8Array(this._valueHex,1,this._valueHex.byteLength-1)),this._valueHex=e.slice(0)}else if(0!==n&&this._valueHex.byteLength<n){n-this._valueHex.byteLength>1&&(n=this._valueHex.byteLength+1);const e=new ArrayBuffer(n);new Uint8Array(e).set(s,n-this._valueHex.byteLength),this._valueHex=e.slice(0)}return i}toDER(e=!1){const t=new Uint8Array(this._valueHex);switch(!0){case 0!=(128&t[0]):{const e=new ArrayBuffer(this._valueHex.byteLength+1),r=new Uint8Array(e);r[0]=0,r.set(t,1),this._valueHex=e.slice(0)}break;case 0===t[0]&&0==(128&t[1]):{const e=new ArrayBuffer(this._valueHex.byteLength-1);new Uint8Array(e).set(new Uint8Array(this._valueHex,1,this._valueHex.byteLength-1)),this._valueHex=e.slice(0)}}return this.toBER(e)}fromBER(e,t,r){const n=super.fromBER(e,t,r);return-1===n?n:(this.blockLength=r,t+r)}toBER(e=!1){return this.valueHex.slice(0)}static blockName(){return"IntegerValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.valueDec=this.valueDec,e}toString(){function e(e,t){const r=new Uint8Array([0]);let i=new Uint8Array(e),s=new Uint8Array(t),a=i.slice(0);const o=a.length-1;let u=s.slice(0);const c=u.length-1;let l=0;let h=0;for(let e=c<o?o:c;e>=0;e--,h++){switch(!0){case h<u.length:l=a[o-h]+u[c-h]+r[0];break;default:l=a[o-h]+r[0]}switch(r[0]=l/10,!0){case h>=a.length:a=Object(n.m)(new Uint8Array([l%10]),a);break;default:a[o-h]=l%10}}return r[0]>0&&(a=Object(n.m)(r,a)),a.slice(0)}function t(e){if(e>=i.length)for(let t=i.length;t<=e;t++){const e=new Uint8Array([0]);let r=i[t-1].slice(0);for(let t=r.length-1;t>=0;t--){const n=new Uint8Array([(r[t]<<1)+e[0]]);e[0]=n[0]/10,r[t]=n[0]%10}e[0]>0&&(r=Object(n.m)(e,r)),i.push(r)}return i[e]}function r(e,t){let r=0,n=new Uint8Array(e),i=new Uint8Array(t),s=n.slice(0);const a=s.length-1;let o=i.slice(0);const u=o.length-1;let c,l=0;for(let e=u;e>=0;e--,l++)switch(c=s[a-l]-o[u-l]-r,!0){case c<0:r=1,s[a-l]=c+10;break;default:r=0,s[a-l]=c}if(r>0)for(let e=a-u+1;e>=0;e--,l++){if(c=s[a-l]-r,!(c<0)){r=0,s[a-l]=c;break}r=1,s[a-l]=c+10}return s.slice()}const a=8*this._valueHex.byteLength-1;let o,u=new Uint8Array(8*this._valueHex.byteLength/3),c=0;const l=new Uint8Array(this._valueHex);let h="",f=!1;for(let n=this._valueHex.byteLength-1;n>=0;n--){o=l[n];for(let n=0;n<8;n++){if(1==(1&o))switch(c){case a:u=r(t(c),u),h="-";break;default:u=e(u,t(c))}c++,o>>=1}}for(let e=0;e<u.length;e++)u[e]&&(f=!0),f&&(h+=s.charAt(u[e]));return!1===f&&(h+=s.charAt(0)),h}}class N extends h{constructor(e={}){super(e,O),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}static blockName(){return"INTEGER"}isEqual(e){return e instanceof N?this.valueBlock.isHexOnly&&e.valueBlock.isHexOnly?Object(n.g)(this.valueBlock.valueHex,e.valueBlock.valueHex):this.valueBlock.isHexOnly===e.valueBlock.isHexOnly&&this.valueBlock.valueDec===e.valueBlock.valueDec:e instanceof ArrayBuffer&&Object(n.g)(this.valueBlock.valueHex,e)}convertToDER(){const e=new N({valueHex:this.valueBlock.valueHex});return e.valueBlock.toDER(),e}convertFromDER(){const e=this.valueBlock.valueHex.byteLength%2?this.valueBlock.valueHex.byteLength+1:this.valueBlock.valueHex.byteLength,t=new N({valueHex:this.valueBlock.valueHex});return t.valueBlock.fromDER(t.valueBlock.valueHex,0,t.valueBlock.valueHex.byteLength,e),t}toString(){const e=Object(n.b)(this.valueBlock.valueHex),t=BigInt(`0x${e}`);return`${this.constructor.blockName()} : ${t.toString()}`}}class x extends N{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}static blockName(){return"ENUMERATED"}}class I extends(o(a)){constructor(e={}){super(e),this.valueDec=Object(n.f)(e,"valueDec",-1),this.isFirstSid=Object(n.f)(e,"isFirstSid",!1)}static blockName(){return"sidBlock"}fromBER(e,t,r){if(0===r)return t;if(!1===Object(n.c)(this,e,t,r))return-1;const i=new Uint8Array(e,t,r);this.valueHex=new ArrayBuffer(r);let s=new Uint8Array(this.valueHex);for(let e=0;e<r&&(s[e]=127&i[e],this.blockLength++,0!=(128&i[e]));e++);const a=new ArrayBuffer(this.blockLength),o=new Uint8Array(a);for(let e=0;e<this.blockLength;e++)o[e]=s[e];return this.valueHex=a.slice(0),s=new Uint8Array(this.valueHex),0!=(128&i[this.blockLength-1])?(this.error="End of input reached before message was fully decoded",-1):(0===s[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Object(n.p)(s,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e=!1){let t,r;if(this.isHexOnly){if(!0===e)return new ArrayBuffer(this.valueHex.byteLength);const n=new Uint8Array(this.valueHex);t=new ArrayBuffer(this.blockLength),r=new Uint8Array(t);for(let e=0;e<this.blockLength-1;e++)r[e]=128|n[e];return r[this.blockLength-1]=n[this.blockLength-1],t}const i=Object(n.q)(this.valueDec,7);if(0===i.byteLength)return this.error="Error during encoding SID value",new ArrayBuffer(0);if(t=new ArrayBuffer(i.byteLength),!1===e){const e=new Uint8Array(i);r=new Uint8Array(t);for(let t=0;t<i.byteLength-1;t++)r[t]=128|e[t];r[i.byteLength-1]=e[i.byteLength-1]}return t}toString(){let e="";if(!0===this.isHexOnly)e=Object(n.b)(this.valueHex,0,this.valueHex.byteLength);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.valueDec=this.valueDec,e.isFirstSid=this.isFirstSid,e}}class C extends l{constructor(e={}){super(e),this.fromString(Object(n.f)(e,"value",""))}fromBER(e,t,r){let n=t;for(;r>0;){const t=new I;if(n=t.fromBER(e,n,r),-1===n)return this.blockLength=0,this.error=t.error,n;0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return n}toBER(e=!1){let t=new ArrayBuffer(0);for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);if(0===i.byteLength)return this.error=this.value[r].error,new ArrayBuffer(0);t=Object(n.l)(t,i)}return t}fromString(e){this.value=[];let t=0,r=0,n="",i=!1;do{if(r=e.indexOf(".",t),n=-1===r?e.substr(t):e.substr(t,r-t),t=r+1,i){const e=this.value[0];let t=0;switch(e.valueDec){case 0:break;case 1:t=40;break;case 2:t=80;break;default:return this.value=[],!1}const r=parseInt(n,10);if(isNaN(r))return!0;e.valueDec=r+t,i=!1}else{const e=new I;if(e.valueDec=parseInt(n,10),isNaN(e.valueDec))return!0;0===this.value.length&&(e.isFirstSid=!0,i=!0),this.value.push(e)}}while(-1!==r);return!0}toString(){let e="",t=!1;for(let r=0;r<this.value.length;r++){t=this.value[r].isHexOnly;let n=this.value[r].toString();0!==r&&(e=`${e}.`),t?(n=`{${n}}`,this.value[r].isFirstSid?e=`2.{${n} - 80}`:e+=n):e+=n}return e}static blockName(){return"ObjectIdentifierValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}e.value=this.toString(),e.sidArray=[];for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}class j extends h{constructor(e={}){super(e,C),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}static blockName(){return"OBJECT IDENTIFIER"}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.toString()}`}}class T extends(o(a)){constructor(e={}){super(e),this.isHexOnly=!0,this.value=""}static blockName(){return"Utf8StringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e}}class P extends h{constructor(e={}){super(e,T),"value"in e&&this.fromString(e.value),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}static blockName(){return"UTF8String"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,new Uint8Array(e));try{this.valueBlock.value=decodeURIComponent(escape(this.valueBlock.value))}catch(e){this.warnings.push(`Error during "decodeURIComponent": ${e}, using raw string`)}}fromString(e){const t=unescape(encodeURIComponent(e)),r=t.length;this.valueBlock.valueHex=new ArrayBuffer(r);const n=new Uint8Array(this.valueBlock.valueHex);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);this.valueBlock.value=e}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class D extends(o(a)){constructor(e={}){super(e),this.valueDec=Object(n.f)(e,"valueDec",-1)}static blockName(){return"relativeSidBlock"}fromBER(e,t,r){if(0===r)return t;if(!1===Object(n.c)(this,e,t,r))return-1;const i=new Uint8Array(e,t,r);this.valueHex=new ArrayBuffer(r);let s=new Uint8Array(this.valueHex);for(let e=0;e<r&&(s[e]=127&i[e],this.blockLength++,0!=(128&i[e]));e++);const a=new ArrayBuffer(this.blockLength),o=new Uint8Array(a);for(let e=0;e<this.blockLength;e++)o[e]=s[e];return this.valueHex=a.slice(0),s=new Uint8Array(this.valueHex),0!=(128&i[this.blockLength-1])?(this.error="End of input reached before message was fully decoded",-1):(0===s[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Object(n.p)(s,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e=!1){let t,r;if(this.isHexOnly){if(!0===e)return new ArrayBuffer(this.valueHex.byteLength);const n=new Uint8Array(this.valueHex);t=new ArrayBuffer(this.blockLength),r=new Uint8Array(t);for(let e=0;e<this.blockLength-1;e++)r[e]=128|n[e];return r[this.blockLength-1]=n[this.blockLength-1],t}const i=Object(n.q)(this.valueDec,7);if(0===i.byteLength)return this.error="Error during encoding SID value",new ArrayBuffer(0);if(t=new ArrayBuffer(i.byteLength),!1===e){const e=new Uint8Array(i);r=new Uint8Array(t);for(let t=0;t<i.byteLength-1;t++)r[t]=128|e[t];r[i.byteLength-1]=e[i.byteLength-1]}return t}toString(){let e="";return e=!0===this.isHexOnly?Object(n.b)(this.valueHex,0,this.valueHex.byteLength):this.valueDec.toString(),e}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.valueDec=this.valueDec,e}}class U extends l{constructor(e={}){super(e),this.fromString(Object(n.f)(e,"value",""))}fromBER(e,t,r){let n=t;for(;r>0;){const t=new D;if(n=t.fromBER(e,n,r),-1===n)return this.blockLength=0,this.error=t.error,n;this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return n}toBER(e=!1){let t=new ArrayBuffer(0);for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);if(0===i.byteLength)return this.error=this.value[r].error,new ArrayBuffer(0);t=Object(n.l)(t,i)}return t}fromString(e){this.value=[];let t=0,r=0,n="";do{r=e.indexOf(".",t),n=-1===r?e.substr(t):e.substr(t,r-t),t=r+1;const i=new D;if(i.valueDec=parseInt(n,10),isNaN(i.valueDec))return!0;this.value.push(i)}while(-1!==r);return!0}toString(){let e="",t=!1;for(let r=0;r<this.value.length;r++){t=this.value[r].isHexOnly;let n=this.value[r].toString();0!==r&&(e=`${e}.`),t?(n=`{${n}}`,e+=n):e+=n}return e}static blockName(){return"RelativeObjectIdentifierValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}e.value=this.toString(),e.sidArray=[];for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}class L extends h{constructor(e={}){super(e,U),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}static blockName(){return"RelativeObjectIdentifier"}}class R extends(o(a)){constructor(e={}){super(e),this.isHexOnly=!0,this.value=""}static blockName(){return"BmpStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e}}class M extends h{constructor(e={}){super(e,R),"value"in e&&this.fromString(e.value),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}static blockName(){return"BMPString"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){const t=e.slice(0),r=new Uint8Array(t);for(let e=0;e<r.length;e+=2){const t=r[e];r[e]=r[e+1],r[e+1]=t}this.valueBlock.value=String.fromCharCode.apply(null,new Uint16Array(t))}fromString(e){const t=e.length;this.valueBlock.valueHex=new ArrayBuffer(2*t);const r=new Uint8Array(this.valueBlock.valueHex);for(let i=0;i<t;i++){const t=Object(n.q)(e.charCodeAt(i),8),s=new Uint8Array(t);if(s.length>2)continue;const a=2-s.length;for(let e=s.length-1;e>=0;e--)r[2*i+e+a]=s[e]}this.valueBlock.value=e}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class $ extends(o(a)){constructor(e={}){super(e),this.isHexOnly=!0,this.value=""}static blockName(){return"UniversalStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e}}class H extends h{constructor(e={}){super(e,$),"value"in e&&this.fromString(e.value),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}static blockName(){return"UniversalString"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){const t=e.slice(0),r=new Uint8Array(t);for(let e=0;e<r.length;e+=4)r[e]=r[e+3],r[e+1]=r[e+2],r[e+2]=0,r[e+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length;this.valueBlock.valueHex=new ArrayBuffer(4*t);const r=new Uint8Array(this.valueBlock.valueHex);for(let i=0;i<t;i++){const t=Object(n.q)(e.charCodeAt(i),8),s=new Uint8Array(t);if(s.length>4)continue;const a=4-s.length;for(let e=s.length-1;e>=0;e--)r[4*i+e+a]=s[e]}this.valueBlock.value=e}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class V extends(o(a)){constructor(e={}){super(e),this.value="",this.isHexOnly=!0}static blockName(){return"SimpleStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e}}class F extends h{constructor(e={}){super(e,V),"value"in e&&this.fromString(e.value)}static blockName(){return"SIMPLESTRING"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,new Uint8Array(e))}fromString(e){const t=e.length;this.valueBlock.valueHex=new ArrayBuffer(t);const r=new Uint8Array(this.valueBlock.valueHex);for(let n=0;n<t;n++)r[n]=e.charCodeAt(n);this.valueBlock.value=e}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class K extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}static blockName(){return"NumericString"}}class z extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}static blockName(){return"PrintableString"}}class q extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}static blockName(){return"TeletexString"}}class J extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}static blockName(){return"VideotexString"}}class Y extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}static blockName(){return"IA5String"}}class G extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}static blockName(){return"GraphicString"}}class W extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}static blockName(){return"VisibleString"}}class X extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}static blockName(){return"GeneralString"}}class Q extends F{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}static blockName(){return"CharacterString"}}class Z extends W{constructor(e={}){if(super(e),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,"value"in e){this.fromString(e.value),this.valueBlock.valueHex=new ArrayBuffer(e.value.length);const t=new Uint8Array(this.valueBlock.valueHex);for(let r=0;r<e.value.length;r++)t[r]=e.value.charCodeAt(r)}"valueDate"in e&&(this.fromDate(e.valueDate),this.valueBlock.valueHex=this.toBuffer()),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,new Uint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const t=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi.exec(e);if(null===t)return void(this.error="Wrong input string for convertion");const r=parseInt(t[1],10);this.year=r>=50?1900+r:2e3+r,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(){const e=new Array(7);return e[0]=Object(n.i)(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=Object(n.i)(this.month,2),e[2]=Object(n.i)(this.day,2),e[3]=Object(n.i)(this.hour,2),e[4]=Object(n.i)(this.minute,2),e[5]=Object(n.i)(this.second,2),e[6]="Z",e.join("")}static blockName(){return"UTCTime"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.year=this.year,e.month=this.month,e.day=this.day,e.hour=this.hour,e.minute=this.minute,e.second=this.second,e}}class ee extends W{constructor(e={}){if(super(e),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,this.millisecond=0,"value"in e){this.fromString(e.value),this.valueBlock.valueHex=new ArrayBuffer(e.value.length);const t=new Uint8Array(this.valueBlock.valueHex);for(let r=0;r<e.value.length;r++)t[r]=e.value.charCodeAt(r)}"valueDate"in e&&(this.fromDate(e.valueDate),this.valueBlock.valueHex=this.toBuffer()),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,new Uint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds(),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t,r=!1,n="",i="",s=0,a=0,o=0;if("Z"===e[e.length-1])n=e.substr(0,e.length-1),r=!0;else{const t=new Number(e[e.length-1]);if(isNaN(t.valueOf()))throw new Error("Wrong input string for convertion");n=e}if(r){if(-1!==n.indexOf("+"))throw new Error("Wrong input string for convertion");if(-1!==n.indexOf("-"))throw new Error("Wrong input string for convertion")}else{let e=1,t=n.indexOf("+"),r="";if(-1===t&&(t=n.indexOf("-"),e=-1),-1!==t){if(r=n.substr(t+1),n=n.substr(0,t),2!==r.length&&4!==r.length)throw new Error("Wrong input string for convertion");let i=new Number(r.substr(0,2));if(isNaN(i.valueOf()))throw new Error("Wrong input string for convertion");if(a=e*i,4===r.length){if(i=new Number(r.substr(2,2)),isNaN(i.valueOf()))throw new Error("Wrong input string for convertion");o=e*i}}}let u=n.indexOf(".");if(-1===u&&(u=n.indexOf(",")),-1!==u){const e=new Number(`0${n.substr(u)}`);if(isNaN(e.valueOf()))throw new Error("Wrong input string for convertion");s=e.valueOf(),i=n.substr(0,u)}else i=n;switch(!0){case 8===i.length:if(t=/(\d{4})(\d{2})(\d{2})/gi,-1!==u)throw new Error("Wrong input string for convertion");break;case 10===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==u){let e=60*s;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==u){let e=60*s;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==u){const e=1e3*s;this.millisecond=Math.floor(e)}break;default:throw new Error("Wrong input string for convertion")}const c=t.exec(i);if(null===c)throw new Error("Wrong input string for convertion");for(let e=1;e<c.length;e++)switch(e){case 1:this.year=parseInt(c[e],10);break;case 2:this.month=parseInt(c[e],10);break;case 3:this.day=parseInt(c[e],10);break;case 4:this.hour=parseInt(c[e],10)+a;break;case 5:this.minute=parseInt(c[e],10)+o;break;case 6:this.second=parseInt(c[e],10);break;default:throw new Error("Wrong input string for convertion")}if(!1===r){const e=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=e.getUTCFullYear(),this.month=e.getUTCMonth(),this.day=e.getUTCDay(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds(),this.millisecond=e.getUTCMilliseconds()}}toString(){const e=[];return e.push(Object(n.i)(this.year,4)),e.push(Object(n.i)(this.month,2)),e.push(Object(n.i)(this.day,2)),e.push(Object(n.i)(this.hour,2)),e.push(Object(n.i)(this.minute,2)),e.push(Object(n.i)(this.second,2)),0!==this.millisecond&&(e.push("."),e.push(Object(n.i)(this.millisecond,3))),e.push("Z"),e.join("")}static blockName(){return"GeneralizedTime"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.year=this.year,e.month=this.month,e.day=this.day,e.hour=this.hour,e.minute=this.minute,e.second=this.second,e.millisecond=this.millisecond,e}}class te extends P{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}static blockName(){return"DATE"}}class re extends P{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}static blockName(){return"TimeOfDay"}}class ne extends P{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}static blockName(){return"DateTime"}}class ie extends P{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}static blockName(){return"Duration"}}class se extends P{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}static blockName(){return"TIME"}}class ae{constructor(e={}){this.value=Object(n.f)(e,"value",[]),this.optional=Object(n.f)(e,"optional",!1)}}class oe{constructor(e={}){this.name=Object(n.f)(e,"name",""),this.optional=Object(n.f)(e,"optional",!1)}}class ue{constructor(e={}){this.name=Object(n.f)(e,"name",""),this.optional=Object(n.f)(e,"optional",!1),this.value=Object(n.f)(e,"value",new oe),this.local=Object(n.f)(e,"local",!1)}}class ce{constructor(e={}){this.data=Object(n.f)(e,"data",new ArrayBuffer(0))}fromBER(e,t,r){return this.data=e.slice(t,r),t+r}toBER(e=!1){return this.data}}function le(e,t,r){const i=t;let s=new h({},Object);const o=new a;if(!1===Object(n.c)(o,e,t,r))return s.error=o.error,{offset:-1,result:s};if(0===new Uint8Array(e,t,r).length)return s.error="Zero buffer length",{offset:-1,result:s};let u=s.idBlock.fromBER(e,t,r);if(s.warnings.concat(s.idBlock.warnings),-1===u)return s.error=s.idBlock.error,{offset:-1,result:s};if(t=u,r-=s.idBlock.blockLength,u=s.lenBlock.fromBER(e,t,r),s.warnings.concat(s.lenBlock.warnings),-1===u)return s.error=s.lenBlock.error,{offset:-1,result:s};if(t=u,r-=s.lenBlock.blockLength,!1===s.idBlock.isConstructed&&!0===s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let c=h;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&!1===s.idBlock.isHexOnly)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(!0===s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};c=g;break;case 1:c=v;break;case 2:c=N;break;case 3:c=E;break;case 4:c=B;break;case 5:c=A;break;case 6:c=j;break;case 10:c=x;break;case 12:c=P;break;case 13:c=L;break;case 14:c=se;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=w;break;case 17:c=_;break;case 18:c=K;break;case 19:c=z;break;case 20:c=q;break;case 21:c=J;break;case 22:c=Y;break;case 23:c=Z;break;case 24:c=ee;break;case 25:c=G;break;case 26:c=W;break;case 27:c=X;break;case 28:c=H;break;case 29:c=Q;break;case 30:c=M;break;case 31:c=te;break;case 32:c=re;break;case 33:c=ne;break;case 34:c=ie;break;default:{let e;e=!0===s.idBlock.isConstructed?new p:new d,e.idBlock=s.idBlock,e.lenBlock=s.lenBlock,e.warnings=s.warnings,s=e}}break;case 2:case 3:case 4:default:c=!0===s.idBlock.isConstructed?p:d}return s=function(e,t){if(e instanceof t)return e;const r=new t;return r.idBlock=e.idBlock,r.lenBlock=e.lenBlock,r.warnings=e.warnings,r.valueBeforeDecode=e.valueBeforeDecode.slice(0),r}(s,c),u=s.fromBER(e,t,!0===s.lenBlock.isIndefiniteForm?r:s.lenBlock.length),s.valueBeforeDecode=e.slice(i,i+s.blockLength),{offset:u,result:s}}function he(e){if(0===e.byteLength){const e=new h({},Object);return e.error="Input buffer has zero length",{offset:-1,result:e}}return le(e,0,e.byteLength)}function fe(e,t,r){if(r instanceof ae){const n=!1;for(let n=0;n<r.value.length;n++){if(!0===fe(e,t,r.value[n]).verified)return{verified:!0,result:e}}if(!1===n){const e={verified:!1,result:{error:"Wrong values for Choice type"}};return r.hasOwnProperty("name")&&(e.name=r.name),e}}if(r instanceof oe)return r.hasOwnProperty("name")&&(e[r.name]=t),{verified:!0,result:e};if(e instanceof Object==!1)return{verified:!1,result:{error:"Wrong root object"}};if(t instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(r instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("idBlock"in r==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("fromBER"in r.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("toBER"in r.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const n=r.idBlock.toBER(!1);if(0===n.byteLength)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(-1===r.idBlock.fromBER(n,0,n.byteLength))return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(!1===r.idBlock.hasOwnProperty("tagClass"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagClass!==t.idBlock.tagClass)return{verified:!1,result:e};if(!1===r.idBlock.hasOwnProperty("tagNumber"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagNumber!==t.idBlock.tagNumber)return{verified:!1,result:e};if(!1===r.idBlock.hasOwnProperty("isConstructed"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isConstructed!==t.idBlock.isConstructed)return{verified:!1,result:e};if("isHexOnly"in r.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isHexOnly!==t.idBlock.isHexOnly)return{verified:!1,result:e};if(!0===r.idBlock.isHexOnly){if("valueHex"in r.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const n=new Uint8Array(r.idBlock.valueHex),i=new Uint8Array(t.idBlock.valueHex);if(n.length!==i.length)return{verified:!1,result:e};for(let t=0;t<n.length;t++)if(n[t]!==i[1])return{verified:!1,result:e}}if(r.hasOwnProperty("name")&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&(e[r.name]=t)),!0===r.idBlock.isConstructed){let n=0,i={verified:!1},s=r.valueBlock.value.length;if(s>0&&r.valueBlock.value[0]instanceof ue&&(s=t.valueBlock.value.length),0===s)return{verified:!0,result:e};if(0===t.valueBlock.value.length&&0!==r.valueBlock.value.length){let t=!0;for(let e=0;e<r.valueBlock.value.length;e++)t=t&&(r.valueBlock.value[e].optional||!1);return!0===t?{verified:!0,result:e}:(r.hasOwnProperty("name")&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&delete e[r.name]),e.error="Inconsistent object length",{verified:!1,result:e})}for(let a=0;a<s;a++)if(a-n>=t.valueBlock.value.length){if(!1===r.valueBlock.value[a].optional){const t={verified:!1,result:e};return e.error="Inconsistent length between ASN.1 data and schema",r.hasOwnProperty("name")&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&(delete e[r.name],t.name=r.name)),t}}else if(r.valueBlock.value[0]instanceof ue){if(i=fe(e,t.valueBlock.value[a],r.valueBlock.value[0].value),!1===i.verified){if(!0!==r.valueBlock.value[0].optional)return r.hasOwnProperty("name")&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&delete e[r.name]),i;n++}if("name"in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){let n={};n="local"in r.valueBlock.value[0]&&!0===r.valueBlock.value[0].local?t:e,void 0===n[r.valueBlock.value[0].name]&&(n[r.valueBlock.value[0].name]=[]),n[r.valueBlock.value[0].name].push(t.valueBlock.value[a])}}else if(i=fe(e,t.valueBlock.value[a-n],r.valueBlock.value[a]),!1===i.verified){if(!0!==r.valueBlock.value[a].optional)return r.hasOwnProperty("name")&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&delete e[r.name]),i;n++}if(!1===i.verified){const t={verified:!1,result:e};return r.hasOwnProperty("name")&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&(delete e[r.name],t.name=r.name)),t}return{verified:!0,result:e}}if("primitiveSchema"in r&&"valueHex"in t.valueBlock){const n=he(t.valueBlock.valueHex);if(-1===n.offset){const t={verified:!1,result:n.result};return r.hasOwnProperty("name")&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&(delete e[r.name],t.name=r.name)),t}return fe(e,n.result,r.primitiveSchema)}return{verified:!0,result:e}}},function(e,t,r){"use strict";function n(e,t,r){return e instanceof Object==!1?r:t in e?e[t]:r}function i(e,t=0,r=e.byteLength-t,n=!1){let i="";for(const s of new Uint8Array(e,t,r)){const e=s.toString(16).toUpperCase();1===e.length&&(i+="0"),i+=e,n&&(i+=" ")}return i.trim()}function s(e,t,r,n){return t instanceof ArrayBuffer==!1?(e.error='Wrong parameter: inputBuffer must be "ArrayBuffer"',!1):0===t.byteLength?(e.error="Wrong parameter: inputBuffer has zero length",!1):r<0?(e.error="Wrong parameter: inputOffset less than zero",!1):n<0?(e.error="Wrong parameter: inputLength less than zero",!1):!(t.byteLength-r-n<0)||(e.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1)}function a(e,t){let r=0;if(1===e.length)return e[0];for(let n=e.length-1;n>=0;n--)r+=e[e.length-1-n]*Math.pow(2,t*n);return r}function o(e,t,r=-1){const n=r;let i=e,s=0,a=Math.pow(2,t);for(let r=1;r<8;r++){if(e<a){let e;if(n<0)e=new ArrayBuffer(r),s=r;else{if(n<r)return new ArrayBuffer(0);e=new ArrayBuffer(n),s=n}const a=new Uint8Array(e);for(let e=r-1;e>=0;e--){const r=Math.pow(2,e*t);a[s-e-1]=Math.floor(i/r),i-=a[s-e-1]*r}return e}a*=Math.pow(2,t)}return new ArrayBuffer(0)}function u(...e){let t=0,r=0;for(const r of e)t+=r.byteLength;const n=new ArrayBuffer(t),i=new Uint8Array(n);for(const t of e)i.set(new Uint8Array(t),r),r+=t.byteLength;return n}function c(...e){let t=0,r=0;for(const r of e)t+=r.length;const n=new ArrayBuffer(t),i=new Uint8Array(n);for(const t of e)i.set(t,r),r+=t.length;return i}function l(){const e=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const t=255===e[0]&&128&e[1],r=0===e[0]&&0==(128&e[1]);(t||r)&&this.warnings.push("Needlessly long format")}const t=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(t);for(let e=0;e<this.valueHex.byteLength;e++)r[e]=0;r[0]=128&e[0];const n=a(r,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let t=0;t<this.valueHex.byteLength;t++)s[t]=e[t];s[0]&=127;return a(s,8)-n}function h(e){const t=e<0?-1*e:e;let r=128;for(let n=1;n<8;n++){if(t<=r){if(e<0){const e=o(r-t,8,n);return new Uint8Array(e)[0]|=128,e}let i=o(t,8,n),s=new Uint8Array(i);if(128&s[0]){const e=i.slice(0),t=new Uint8Array(e);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let r=0;r<e.byteLength;r++)s[r+1]=t[r];s[0]=0}return i}r*=Math.pow(2,8)}return new ArrayBuffer(0)}function f(e,t){if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let e=0;e<r.length;e++)if(r[e]!==n[e])return!1;return!0}function d(e,t){const r=e.toString(10);if(t<r.length)return"";const n=t-r.length,i=new Array(n);for(let e=0;e<n;e++)i[e]="0";return i.join("").concat(r)}r.d(t,"f",(function(){return n})),r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return s})),r.d(t,"p",(function(){return a})),r.d(t,"q",(function(){return o})),r.d(t,"l",(function(){return u})),r.d(t,"m",(function(){return c})),r.d(t,"n",(function(){return l})),r.d(t,"o",(function(){return h})),r.d(t,"g",(function(){return f})),r.d(t,"i",(function(){return d})),r.d(t,"k",(function(){return b})),r.d(t,"e",(function(){return g})),r.d(t,"a",(function(){return y})),r.d(t,"j",(function(){return v})),r.d(t,"h",(function(){return _})),r.d(t,"d",(function(){return A}));const m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";function b(e,t=!1,r=!1,n=!1){let i=0,s=0,a=0,o="";const u=t?p:m;if(n){let t=0;for(let r=0;r<e.length;r++)if(0!==e.charCodeAt(r)){t=r;break}e=e.slice(t)}for(;i<e.length;){const t=e.charCodeAt(i++);i>=e.length&&(s=1);const n=e.charCodeAt(i++);i>=e.length&&(a=1);const c=e.charCodeAt(i++),l=t>>2,h=(3&t)<<4|n>>4;let f=(15&n)<<2|c>>6,d=63&c;1===s?f=d=64:1===a&&(d=64),o+=r?64===f?`${u.charAt(l)}${u.charAt(h)}`:64===d?`${u.charAt(l)}${u.charAt(h)}${u.charAt(f)}`:`${u.charAt(l)}${u.charAt(h)}${u.charAt(f)}${u.charAt(d)}`:`${u.charAt(l)}${u.charAt(h)}${u.charAt(f)}${u.charAt(d)}`}return o}function g(e,t=!1,r=!1){const n=t?p:m;function i(e){for(let t=0;t<64;t++)if(n.charAt(t)===e)return t;return 64}function s(e){return 64===e?0:e}let a=0,o="";for(;a<e.length;){const t=i(e.charAt(a++)),r=a>=e.length?0:i(e.charAt(a++)),n=a>=e.length?0:i(e.charAt(a++)),u=a>=e.length?0:i(e.charAt(a++)),c=s(t)<<2|s(r)>>4,l=(15&s(r))<<4|s(n)>>2,h=(3&s(n))<<6|s(u);o+=String.fromCharCode(c),64!==n&&(o+=String.fromCharCode(l)),64!==u&&(o+=String.fromCharCode(h))}if(r){let e=-1;for(let t=o.length-1;t>=0;t--)if(0!==o.charCodeAt(t)){e=t;break}o=-1!==e?o.slice(0,e+1):""}return o}function y(e){let t="";const r=new Uint8Array(e);for(const e of r)t+=String.fromCharCode(e);return t}function v(e){const t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return r}const w=Math.log(2);function _(e){const t=Math.log(e)/w,r=Math.floor(t),n=Math.round(t);return r===n?r:n}function A(e,t){for(const r of t)delete e[r]}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),i=r(1);class s{constructor(e={}){this.algorithmId=Object(i.f)(e,"algorithmId",s.defaultValues("algorithmId")),"algorithmParams"in e&&(this.algorithmParams=Object(i.f)(e,"algorithmParams",s.defaultValues("algorithmParams"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"algorithmId":return"";case"algorithmParams":return new n.a;default:throw new Error(`Invalid member name for AlgorithmIdentifier class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"algorithmId":return""===t;case"algorithmParams":return t instanceof n.a;default:throw new Error(`Invalid member name for AlgorithmIdentifier class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",optional:t.optional||!1,value:[new n.p({name:t.algorithmIdentifier||""}),new n.a({name:t.algorithmParams||"",optional:!0})]})}fromSchema(e){Object(i.d)(e,["algorithm","params"]);const t=n.D(e,e,s.schema({names:{algorithmIdentifier:"algorithm",algorithmParams:"params"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AlgorithmIdentifier");this.algorithmId=t.result.algorithm.valueBlock.toString(),"params"in t.result&&(this.algorithmParams=t.result.params)}toSchema(){const e=[];return e.push(new n.p({value:this.algorithmId})),"algorithmParams"in this&&this.algorithmParams instanceof n.a==!1&&e.push(this.algorithmParams),new n.v({value:e})}toJSON(){const e={algorithmId:this.algorithmId};return"algorithmParams"in this&&this.algorithmParams instanceof n.a==!1&&(e.algorithmParams=this.algorithmParams.toJSON()),e}isEqual(e){return e instanceof s!=!1&&(this.algorithmId===e.algorithmId&&("algorithmParams"in this?"algorithmParams"in e&&JSON.stringify(this.algorithmParams)===JSON.stringify(e.algorithmParams):!("algorithmParams"in e)))}}},function(e,t,r){"use strict";(function(e,n){r.d(t,"e",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"g",(function(){return l})),r.d(t,"f",(function(){return h})),r.d(t,"a",(function(){return f})),r.d(t,"i",(function(){return d})),r.d(t,"b",(function(){return m})),r.d(t,"c",(function(){return p})),r.d(t,"h",(function(){return g}));var i=r(0),s=r(1),a=r(34);let o={name:"none",crypto:null,subtle:null};function u(){if(void 0!==e&&"pid"in e&&void 0!==n&&"undefined"==typeof window){let t;try{t=n[e.pid].pkijs.engine}catch(e){throw new Error('Please call "setEngine" before call to "getEngine"')}return t}return o}function c(){const e=u();if(null!==e.subtle)return e.subtle}function l(e){return u().subtle.getRandomValues(e)}function h(e){return u().subtle.getOIDByAlgorithm(e)}function f(e){if(e.byteLength%2!=0)return new ArrayBuffer(0);const t=e.byteLength/2,r=new ArrayBuffer(t);new Uint8Array(r).set(new Uint8Array(e,0,t));const n=new i.m({valueHex:r}),s=new ArrayBuffer(t);new Uint8Array(s).set(new Uint8Array(e,t,t));const a=new i.m({valueHex:s});return new i.v({value:[n.convertToDER(),a.convertToDER()]}).toBER(!1)}function d(e){let t=!1,r="";const n=e.trim();for(let e=0;e<n.length;e++)32===n.charCodeAt(e)?!1===t&&(t=!0):(t&&(r+=" ",t=!1),r+=n[e]);return r.toLowerCase()}function m(e){if(e instanceof i.v==!1)return new ArrayBuffer(0);if(2!==e.valueBlock.value.length)return new ArrayBuffer(0);if(e.valueBlock.value[0]instanceof i.m==!1)return new ArrayBuffer(0);if(e.valueBlock.value[1]instanceof i.m==!1)return new ArrayBuffer(0);const t=e.valueBlock.value[0].convertFromDER(),r=e.valueBlock.value[1].convertFromDER();switch(!0){case t.valueBlock.valueHex.byteLength<r.valueBlock.valueHex.byteLength:{if(r.valueBlock.valueHex.byteLength-t.valueBlock.valueHex.byteLength!=1)throw new Error("Incorrect DER integer decoding");const e=r.valueBlock.valueHex.byteLength,n=new Uint8Array(t.valueBlock.valueHex),i=new ArrayBuffer(e),a=new Uint8Array(i);return a.set(n,1),a[0]=0,Object(s.l)(i,r.valueBlock.valueHex)}case t.valueBlock.valueHex.byteLength>r.valueBlock.valueHex.byteLength:{if(t.valueBlock.valueHex.byteLength-r.valueBlock.valueHex.byteLength!=1)throw new Error("Incorrect DER integer decoding");const e=t.valueBlock.valueHex.byteLength,n=new Uint8Array(r.valueBlock.valueHex),i=new ArrayBuffer(e),a=new Uint8Array(i);return a.set(n,1),a[0]=0,Object(s.l)(t.valueBlock.valueHex,i)}default:if(t.valueBlock.valueHex.byteLength%2){const e=t.valueBlock.valueHex.byteLength+1,n=new Uint8Array(t.valueBlock.valueHex),i=new ArrayBuffer(e),a=new Uint8Array(i);a.set(n,1),a[0]=0;const o=new Uint8Array(r.valueBlock.valueHex),u=new ArrayBuffer(e),c=new Uint8Array(u);return c.set(o,1),c[0]=0,Object(s.l)(i,u)}}return Object(s.l)(t.valueBlock.valueHex,r.valueBlock.valueHex)}function p(e){return u().subtle.getAlgorithmByOID(e)}function b(e,t,r,n){switch(e.toUpperCase()){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;default:return Promise.reject(`Unknown hash function: ${e}`)}if(t instanceof ArrayBuffer==!1)return Promise.reject('Please set "Zbuffer" as "ArrayBuffer"');if(0===t.byteLength)return Promise.reject('"Zbuffer" has zero length, error');if(n instanceof ArrayBuffer==!1)return Promise.reject('Please set "SharedInfo" as "ArrayBuffer"');if(r>255)return Promise.reject('Please set "Counter" variable to value less or equal to 255');const i=new ArrayBuffer(4),a=new Uint8Array(i);a[0]=0,a[1]=0,a[2]=0,a[3]=r;let o=new ArrayBuffer(0);const u=c();return void 0===u?Promise.reject("Unable to create WebCrypto object"):(o=Object(s.l)(o,t),o=Object(s.l)(o,i),o=Object(s.l)(o,n),u.digest({name:e},o).then((e=>({counter:r,result:e}))))}function g(e,t,r,n){let i=0,a=1;const o=[];switch(e.toUpperCase()){case"SHA-1":i=160;break;case"SHA-256":i=256;break;case"SHA-384":i=384;break;case"SHA-512":i=512;break;default:return Promise.reject(`Unknown hash function: ${e}`)}if(t instanceof ArrayBuffer==!1)return Promise.reject('Please set "Zbuffer" as "ArrayBuffer"');if(0===t.byteLength)return Promise.reject('"Zbuffer" has zero length, error');if(n instanceof ArrayBuffer==!1)return Promise.reject('Please set "SharedInfo" as "ArrayBuffer"');const u=r/i;Math.floor(u)>0&&(a=Math.floor(u),u-a>0&&a++);for(let r=1;r<=a;r++)o.push(b(e,t,r,n));return Promise.all(o).then((e=>{let t=new ArrayBuffer(0),n=1,i=!0;for(;i;){i=!1;for(const r of e)if(r.counter===n){t=Object(s.l)(t,r.result),i=!0;break}n++}if(r>>=3,t.byteLength>r){const e=new ArrayBuffer(r),n=new Uint8Array(e),i=new Uint8Array(t);for(let e=0;e<r;e++)n[e]=i[e];return e}return t}))}!function(){if("undefined"!=typeof self&&"crypto"in self){let e="webcrypto";const t=self.crypto;let r;if("webkitSubtle"in self.crypto){try{r=self.crypto.webkitSubtle}catch(e){r=self.crypto.subtle}e="safari"}"subtle"in self.crypto&&(r=self.crypto.subtle),o=void 0===r?{name:e,crypto:t,subtle:null}:{name:e,crypto:t,subtle:new a.a({name:e,crypto:self.crypto,subtle:r})}}!function(t,r,i){if(void 0!==e&&"pid"in e&&void 0!==n&&"undefined"==typeof window){if(void 0===n[e.pid])n[e.pid]={};else if("object"!=typeof n[e.pid])throw new Error(`Name global.${e.pid} already exists and it is not an object`);if(void 0===n[e.pid].pkijs)n[e.pid].pkijs={};else if("object"!=typeof n[e.pid].pkijs)throw new Error(`Name global.${e.pid}.pkijs already exists and it is not an object`);n[e.pid].pkijs.engine={name:t,crypto:r,subtle:i}}else o.name!==t&&(o={name:t,crypto:r,subtle:i})}(o.name,o.crypto,o.subtle)}()}).call(this,r(14),r(12))},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),i=r(1);class s{constructor(e={}){this.type=Object(i.f)(e,"type",s.defaultValues("type")),this.values=Object(i.f)(e,"values",s.defaultValues("values")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return"";case"values":return[];default:throw new Error(`Invalid member name for Attribute class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"type":return""===t;case"values":return 0===t.length;default:throw new Error(`Invalid member name for Attribute class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.p({name:t.type||""}),new n.w({name:t.setName||"",value:[new n.u({name:t.values||"",value:new n.a})]})]})}fromSchema(e){Object(i.d)(e,["type","values"]);const t=n.D(e,e,s.schema({names:{type:"type",values:"values"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Attribute");this.type=t.result.type.valueBlock.toString(),this.values=t.result.values}toSchema(){return new n.v({value:[new n.p({value:this.type}),new n.w({value:this.values})]})}toJSON(){return{type:this.type,values:Array.from(this.values,(e=>e.toJSON()))}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),i=r(1),s=r(2);class a{constructor(e={}){if(this.contentType=Object(i.f)(e,"contentType",a.defaultValues("contentType")),this.contentEncryptionAlgorithm=Object(i.f)(e,"contentEncryptionAlgorithm",a.defaultValues("contentEncryptionAlgorithm")),"encryptedContent"in e&&(this.encryptedContent=e.encryptedContent,1===this.encryptedContent.idBlock.tagClass&&4===this.encryptedContent.idBlock.tagNumber&&!1===this.encryptedContent.idBlock.isConstructed)){const e=new n.q({idBlock:{isConstructed:!0},isConstructed:!0});let t=0,r=this.encryptedContent.valueBlock.valueHex.byteLength;for(;r>0;){const i=new Uint8Array(this.encryptedContent.valueBlock.valueHex,t,t+1024>this.encryptedContent.valueBlock.valueHex.byteLength?this.encryptedContent.valueBlock.valueHex.byteLength-t:1024),s=new ArrayBuffer(i.length),a=new Uint8Array(s);for(let e=0;e<a.length;e++)a[e]=i[e];e.valueBlock.value.push(new n.q({valueHex:s})),r-=i.length,t+=i.length}this.encryptedContent=e}"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"contentType":return"";case"contentEncryptionAlgorithm":return new s.a;case"encryptedContent":return new n.q;default:throw new Error(`Invalid member name for EncryptedContentInfo class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"contentType":return""===t;case"contentEncryptionAlgorithm":return""===t.algorithmId&&"algorithmParams"in t==!1;case"encryptedContent":return t.isEqual(a.defaultValues(e));default:throw new Error(`Invalid member name for EncryptedContentInfo class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.p({name:t.contentType||""}),s.a.schema(t.contentEncryptionAlgorithm||{}),new n.f({value:[new n.g({name:t.encryptedContent||"",idBlock:{tagClass:3,tagNumber:0},value:[new n.u({value:new n.q})]}),new n.r({name:t.encryptedContent||"",idBlock:{tagClass:3,tagNumber:0}})]})]})}fromSchema(e){Object(i.d)(e,["contentType","contentEncryptionAlgorithm","encryptedContent"]);const t=n.D(e,e,a.schema({names:{contentType:"contentType",contentEncryptionAlgorithm:{names:{blockName:"contentEncryptionAlgorithm"}},encryptedContent:"encryptedContent"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for EncryptedContentInfo");this.contentType=t.result.contentType.valueBlock.toString(),this.contentEncryptionAlgorithm=new s.a({schema:t.result.contentEncryptionAlgorithm}),"encryptedContent"in t.result&&(this.encryptedContent=t.result.encryptedContent,this.encryptedContent.idBlock.tagClass=1,this.encryptedContent.idBlock.tagNumber=4)}toSchema(){const e={isIndefiniteForm:!1},t=[];if(t.push(new n.p({value:this.contentType})),t.push(this.contentEncryptionAlgorithm.toSchema()),"encryptedContent"in this){e.isIndefiniteForm=this.encryptedContent.idBlock.isConstructed;const r=this.encryptedContent;r.idBlock.tagClass=3,r.idBlock.tagNumber=0,r.lenBlock.isIndefiniteForm=this.encryptedContent.idBlock.isConstructed,t.push(r)}return new n.v({lenBlock:e,value:t})}toJSON(){const e={contentType:this.contentType,contentEncryptionAlgorithm:this.contentEncryptionAlgorithm.toJSON()};return"encryptedContent"in this&&(e.encryptedContent=this.encryptedContent.toJSON()),e}}},function(e,t,r){"use strict";(function(e){var n=r(83),i=r(84),s=r(52);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=f(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(t,r),i=(e=o(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|d(t.length);return 0===(e=o(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?o(e,0):f(e,t);if("Buffer"===t.type&&s(t.data))return f(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(l(t),e=o(e,t<0?0:0|d(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|d(t.length);e=o(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function d(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function m(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(n)return H(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return N(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var s,a=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(s=r;s<o;s++)if(c(e,s)===c(t,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===u)return l*a}else-1!==l&&(s-=s-l),l=-1}else for(r+u>o&&(r=o-u),s=r;s>=0;s--){for(var h=!0,f=0;f<u;f++)if(c(e,s+f)!==c(t,f)){h=!1;break}if(h)return s}return-1}function v(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var a=0;a<n;++a){var o=parseInt(t.substr(2*a,2),16);if(isNaN(o))return a;e[r+a]=o}return a}function w(e,t,r,n){return F(H(t,e.length-r),e,r,n)}function _(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function A(e,t,r,n){return _(e,t,r,n)}function S(e,t,r,n){return F(V(t),e,r,n)}function B(e,t,r,n){return F(function(e,t){for(var r,n,i,s=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function k(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,a,o,u,c=e[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(s=e[i+1]))&&(u=(31&c)<<6|63&s)>127&&(l=u);break;case 3:s=e[i+1],a=e[i+2],128==(192&s)&&128==(192&a)&&(u=(15&c)<<12|(63&s)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:s=e[i+1],a=e[i+2],o=e[i+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(u=(15&c)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(e){var t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=O));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?o(e,t):void 0!==r?"string"==typeof n?o(e,t).fill(r,n):o(e,t).fill(r):o(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return h(null,e)},u.allocUnsafeSlow=function(e){return h(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).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}},u.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)b(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?E(this,0,e):p.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),o=Math.min(s,a),c=this.slice(n,i),l=e.slice(t,r),h=0;h<o;++h)if(c[h]!==l[h]){s=c[h],a=l[h];break}return s<a?-1:a<s?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return A(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function N(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function x(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function I(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=$(e[s]);return i}function C(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function j(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,s){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-r,2);i<s;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function D(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-r,4);i<s;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function U(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,n,s){return s||U(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,s){return s||U(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var s=0;s<i;++s)r[s]=this[s+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},u.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s<r&&(a*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);T(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var a=u.isBuffer(e)?e:H(new u(e,n).toString()),o=a.length;for(s=0;s<r-t;++s)this[s+t]=a[s%o]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function $(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){var r;t=t||1/0;for(var n=e.length,i=null,s=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(12))},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),i=r(1),s=r(3),a=r(2),o=r(10),u=r(28);class c{constructor(e={}){this.algorithm=Object(i.f)(e,"algorithm",c.defaultValues("algorithm")),this.subjectPublicKey=Object(i.f)(e,"subjectPublicKey",c.defaultValues("subjectPublicKey")),"parsedKey"in e&&(this.parsedKey=Object(i.f)(e,"parsedKey",c.defaultValues("parsedKey"))),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"algorithm":return new a.a;case"subjectPublicKey":return new n.b;default:throw new Error(`Invalid member name for PublicKeyInfo class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[a.a.schema(t.algorithm||{}),new n.b({name:t.subjectPublicKey||""})]})}fromSchema(e){Object(i.d)(e,["algorithm","subjectPublicKey"]);const t=n.D(e,e,c.schema({names:{algorithm:{names:{blockName:"algorithm"}},subjectPublicKey:"subjectPublicKey"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PublicKeyInfo");switch(this.algorithm=new a.a({schema:t.result.algorithm}),this.subjectPublicKey=t.result.subjectPublicKey,this.algorithm.algorithmId){case"1.2.840.10045.2.1":if("algorithmParams"in this.algorithm&&this.algorithm.algorithmParams.constructor.blockName()===n.p.blockName())try{this.parsedKey=new o.a({namedCurve:this.algorithm.algorithmParams.valueBlock.toString(),schema:this.subjectPublicKey.valueBlock.valueHex})}catch(e){}break;case"1.2.840.113549.1.1.1":{const e=n.E(this.subjectPublicKey.valueBlock.valueHex);if(-1!==e.offset)try{this.parsedKey=new u.a({schema:e.result})}catch(e){}}}}toSchema(){return new n.v({value:[this.algorithm.toSchema(),this.subjectPublicKey]})}toJSON(){if("parsedKey"in this==!1)return{algorithm:this.algorithm.toJSON(),subjectPublicKey:this.subjectPublicKey.toJSON()};const e={};switch(this.algorithm.algorithmId){case"1.2.840.10045.2.1":e.kty="EC";break;case"1.2.840.113549.1.1.1":e.kty="RSA"}const t=this.parsedKey.toJSON();for(const r of Object.keys(t))e[r]=t[r];return e}fromJSON(e){if("kty"in e){switch(e.kty.toUpperCase()){case"EC":this.parsedKey=new o.a({json:e}),this.algorithm=new a.a({algorithmId:"1.2.840.10045.2.1",algorithmParams:new n.p({value:this.parsedKey.namedCurve})});break;case"RSA":this.parsedKey=new u.a({json:e}),this.algorithm=new a.a({algorithmId:"1.2.840.113549.1.1.1",algorithmParams:new n.n});break;default:throw new Error(`Invalid value for "kty" parameter: ${e.kty}`)}this.subjectPublicKey=new n.b({valueHex:this.parsedKey.toSchema().toBER(!1)})}}importKey(e){let t=Promise.resolve();const r=this;if(void 0===e)return Promise.reject("Need to provide publicKey input parameter");const i=Object(s.d)();return void 0===i?Promise.reject("Unable to create WebCrypto object"):(t=t.then((()=>i.exportKey("spki",e))),t=t.then((e=>{const t=n.E(e);try{r.fromSchema(t.result)}catch(e){return Promise.reject("Error during initializing object from schema")}}),(e=>Promise.reject(`Error during exporting public key: ${e}`))),t)}}},function(e,t,r){"use strict";var n=r(44),i=Object.prototype.toString;function s(e){return"[object Array]"===i.call(e)}function a(e){return void 0===e}function o(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===i.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===i.call(e)},isBuffer:function(e){return null!==e&&!a(e)&&null!==e.constructor&&!a(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:o,isPlainObject:u,isUndefined:a,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:c,isStream:function(e){return o(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:l,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):s(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)l(arguments[n],r);return t},extend:function(e,t,r){return l(t,(function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t,r){e.exports=r(66)},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),i=r(1);class s{constructor(e={}){this.x=Object(i.f)(e,"x",s.defaultValues("x")),this.y=Object(i.f)(e,"y",s.defaultValues("y")),this.namedCurve=Object(i.f)(e,"namedCurve",s.defaultValues("namedCurve")),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"x":case"y":return new ArrayBuffer(0);case"namedCurve":return"";default:throw new Error(`Invalid member name for ECCPublicKey class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"x":case"y":return Object(i.g)(t,s.defaultValues(e));case"namedCurve":return""===t;default:throw new Error(`Invalid member name for ECCPublicKey class: ${e}`)}}static schema(e={}){return new n.t}fromSchema(e){if(e instanceof ArrayBuffer==!1)throw new Error("Object's schema was not verified against input data for ECPublicKey");if(4!==new Uint8Array(e)[0])throw new Error("Object's schema was not verified against input data for ECPublicKey");let t;switch(this.namedCurve){case"1.2.840.10045.3.1.7":t=32;break;case"1.3.132.0.34":t=48;break;case"1.3.132.0.35":t=66;break;default:throw new Error(`Incorrect curve OID: ${this.namedCurve}`)}if(e.byteLength!==2*t+1)throw new Error("Object's schema was not verified against input data for ECPublicKey");this.x=e.slice(1,t+1),this.y=e.slice(1+t,2*t+1)}toSchema(){return new n.t({data:Object(i.l)(new Uint8Array([4]).buffer,this.x,this.y)})}toJSON(){let e="";switch(this.namedCurve){case"1.2.840.10045.3.1.7":e="P-256";break;case"1.3.132.0.34":e="P-384";break;case"1.3.132.0.35":e="P-521"}return{crv:e,x:Object(i.k)(Object(i.a)(this.x),!0,!0,!1),y:Object(i.k)(Object(i.a)(this.y),!0,!0,!1)}}fromJSON(e){let t=0;if(!("crv"in e))throw new Error('Absent mandatory parameter "crv"');switch(e.crv.toUpperCase()){case"P-256":this.namedCurve="1.2.840.10045.3.1.7",t=32;break;case"P-384":this.namedCurve="1.3.132.0.34",t=48;break;case"P-521":this.namedCurve="1.3.132.0.35",t=66}if(!("x"in e))throw new Error('Absent mandatory parameter "x"');{const r=Object(i.j)(Object(i.e)(e.x,!0));if(r.byteLength<t){this.x=new ArrayBuffer(t);const e=new Uint8Array(this.x),n=new Uint8Array(r);e.set(n,1)}else this.x=r.slice(0,t)}if(!("y"in e))throw new Error('Absent mandatory parameter "y"');{const r=Object(i.j)(Object(i.e)(e.y,!0));if(r.byteLength<t){this.y=new ArrayBuffer(t);const e=new Uint8Array(this.y),n=new Uint8Array(r);e.set(n,1)}else this.y=r.slice(0,t)}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),i=r(1),s=r(2),a=r(4),o=r(29),u=r(30);class c{constructor(e={}){this.version=Object(i.f)(e,"version",c.defaultValues("version")),this.privateKeyAlgorithm=Object(i.f)(e,"privateKeyAlgorithm",c.defaultValues("privateKeyAlgorithm")),this.privateKey=Object(i.f)(e,"privateKey",c.defaultValues("privateKey")),"attributes"in e&&(this.attributes=Object(i.f)(e,"attributes",c.defaultValues("attributes"))),"parsedKey"in e&&(this.parsedKey=Object(i.f)(e,"parsedKey",c.defaultValues("parsedKey"))),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"version":return 0;case"privateKeyAlgorithm":return new s.a;case"privateKey":return new n.q;case"attributes":return[];case"parsedKey":return{};default:throw new Error(`Invalid member name for PrivateKeyInfo class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.version||""}),s.a.schema(t.privateKeyAlgorithm||{}),new n.q({name:t.privateKey||""}),new n.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new n.u({name:t.attributes||"",value:a.a.schema()})]})]})}fromSchema(e){Object(i.d)(e,["version","privateKeyAlgorithm","privateKey","attributes"]);const t=n.D(e,e,c.schema({names:{version:"version",privateKeyAlgorithm:{names:{blockName:"privateKeyAlgorithm"}},privateKey:"privateKey",attributes:"attributes"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PrivateKeyInfo");switch(this.version=t.result.version.valueBlock.valueDec,this.privateKeyAlgorithm=new s.a({schema:t.result.privateKeyAlgorithm}),this.privateKey=t.result.privateKey,"attributes"in t.result&&(this.attributes=Array.from(t.result.attributes,(e=>new a.a({schema:e})))),this.privateKeyAlgorithm.algorithmId){case"1.2.840.113549.1.1.1":{const e=n.E(this.privateKey.valueBlock.valueHex);-1!==e.offset&&(this.parsedKey=new u.a({schema:e.result}))}break;case"1.2.840.10045.2.1":if("algorithmParams"in this.privateKeyAlgorithm&&this.privateKeyAlgorithm.algorithmParams instanceof n.p){const e=n.E(this.privateKey.valueBlock.valueHex);-1!==e.offset&&(this.parsedKey=new o.a({namedCurve:this.privateKeyAlgorithm.algorithmParams.valueBlock.toString(),schema:e.result}))}}}toSchema(){const e=[new n.m({value:this.version}),this.privateKeyAlgorithm.toSchema(),this.privateKey];return"attributes"in this&&e.push(new n.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.attributes,(e=>e.toSchema()))})),new n.v({value:e})}toJSON(){if("parsedKey"in this==!1){const e={version:this.version,privateKeyAlgorithm:this.privateKeyAlgorithm.toJSON(),privateKey:this.privateKey.toJSON()};return"attributes"in this&&(e.attributes=Array.from(this.attributes,(e=>e.toJSON()))),e}const e={};switch(this.privateKeyAlgorithm.algorithmId){case"1.2.840.10045.2.1":e.kty="EC";break;case"1.2.840.113549.1.1.1":e.kty="RSA"}const t=this.parsedKey.toJSON();for(const r of Object.keys(t))e[r]=t[r];return e}fromJSON(e){if("kty"in e){switch(e.kty.toUpperCase()){case"EC":this.parsedKey=new o.a({json:e}),this.privateKeyAlgorithm=new s.a({algorithmId:"1.2.840.10045.2.1",algorithmParams:new n.p({value:this.parsedKey.namedCurve})});break;case"RSA":this.parsedKey=new u.a({json:e}),this.privateKeyAlgorithm=new s.a({algorithmId:"1.2.840.113549.1.1.1",algorithmParams:new n.n});break;default:throw new Error(`Invalid value for "kty" parameter: ${e.kty}`)}this.privateKey=new n.q({valueHex:this.parsedKey.toSchema().toBER(!1)})}}}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),i=r(1),s=r(2);class a{constructor(e={}){this.salt=Object(i.f)(e,"salt",a.defaultValues("salt")),this.iterationCount=Object(i.f)(e,"iterationCount",a.defaultValues("iterationCount")),"keyLength"in e&&(this.keyLength=Object(i.f)(e,"keyLength",a.defaultValues("keyLength"))),"prf"in e&&(this.prf=Object(i.f)(e,"prf",a.defaultValues("prf"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"salt":return{};case"iterationCount":return-1;case"keyLength":return 0;case"prf":return new s.a({algorithmId:"1.3.14.3.2.26",algorithmParams:new n.n});default:throw new Error(`Invalid member name for PBKDF2Params class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.f({value:[new n.q({name:t.saltPrimitive||""}),s.a.schema(t.saltConstructed||{})]}),new n.m({name:t.iterationCount||""}),new n.m({name:t.keyLength||"",optional:!0}),s.a.schema(t.prf||{names:{optional:!0}})]})}fromSchema(e){Object(i.d)(e,["salt","iterationCount","keyLength","prf"]);const t=n.D(e,e,a.schema({names:{saltPrimitive:"salt",saltConstructed:{names:{blockName:"salt"}},iterationCount:"iterationCount",keyLength:"keyLength",prf:{names:{blockName:"prf",optional:!0}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PBKDF2Params");this.salt=t.result.salt,this.iterationCount=t.result.iterationCount.valueBlock.valueDec,"keyLength"in t.result&&(this.keyLength=t.result.keyLength.valueBlock.valueDec),"prf"in t.result&&(this.prf=new s.a({schema:t.result.prf}))}toSchema(){const e=[];return e.push(this.salt),e.push(new n.m({value:this.iterationCount})),"keyLength"in this&&a.defaultValues("keyLength")!==this.keyLength&&e.push(new n.m({value:this.keyLength})),"prf"in this&&!1===a.defaultValues("prf").isEqual(this.prf)&&e.push(this.prf.toSchema()),new n.v({value:e})}toJSON(){const e={salt:this.salt.toJSON(),iterationCount:this.iterationCount};return"keyLength"in this&&a.defaultValues("keyLength")!==this.keyLength&&(e.keyLength=this.keyLength),"prf"in this&&!1===a.defaultValues("prf").isEqual(this.prf)&&(e.prf=this.prf.toJSON()),e}}},function(e,t){var r,n,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!l){var e=o(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++h<t;)u&&u[h].run();h=-1,t=c.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new m(e,t)),1!==c.length||l||o(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){var n;!function(i){"use strict";var s,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,o=Math.ceil,u=Math.floor,c="[BigNumber Error] ",l=c+"Number primitive has more than 15 significant digits: ",h=1e14,f=14,d=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,b=1e9;function g(e){var t=0|e;return e>0||e===t?t:t-1}function y(e){for(var t,r,n=1,i=e.length,s=e[0]+"";n<i;){for(t=e[n++]+"",r=f-t.length;r--;t="0"+t);s+=t}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function v(e,t){var r,n,i=e.c,s=t.c,a=e.s,o=t.s,u=e.e,c=t.e;if(!a||!o)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-o:a;if(a!=o)return a;if(r=a<0,n=u==c,!i||!s)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(o=(u=i.length)<(c=s.length)?u:c,a=0;a<o;a++)if(i[a]!=s[a])return i[a]>s[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function w(e,t,r,n){if(e<t||e>r||e!==u(e))throw Error(c+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function _(e){var t=e.c.length-1;return g(e.e/f)==t&&e.c[t]%2!=0}function A(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(s=function e(t){var r,n,i,s,B,k,E,O,N,x,I=F.prototype={constructor:F,toString:null,valueOf:null},C=new F(1),j=20,T=4,P=-7,D=21,U=-1e7,L=1e7,R=!1,M=1,$=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},V="0123456789abcdefghijklmnopqrstuvwxyz";function F(e,t){var r,s,o,c,h,m,p,b,g=this;if(!(g instanceof F))return new F(e,t);if(null==t){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>L?g.c=g.e=null:e.e<U?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((m="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,h=e;h>=10;h/=10,c++);return void(c>L?g.c=g.e=null:(g.e=c,g.c=[e]))}b=String(e)}else{if(!a.test(b=String(e)))return i(g,b,m);g.s=45==b.charCodeAt(0)?(b=b.slice(1),-1):1}(c=b.indexOf("."))>-1&&(b=b.replace(".","")),(h=b.search(/e/i))>0?(c<0&&(c=h),c+=+b.slice(h+1),b=b.substring(0,h)):c<0&&(c=b.length)}else{if(w(t,2,V.length,"Base"),10==t)return J(g=new F(e),j+g.e+1,T);if(b=String(e),m="number"==typeof e){if(0*e!=0)return i(g,b,m,t);if(g.s=1/e<0?(b=b.slice(1),-1):1,F.DEBUG&&b.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else g.s=45===b.charCodeAt(0)?(b=b.slice(1),-1):1;for(r=V.slice(0,t),c=h=0,p=b.length;h<p;h++)if(r.indexOf(s=b.charAt(h))<0){if("."==s){if(h>c){c=p;continue}}else if(!o&&(b==b.toUpperCase()&&(b=b.toLowerCase())||b==b.toLowerCase()&&(b=b.toUpperCase()))){o=!0,h=-1,c=0;continue}return i(g,String(e),m,t)}m=!1,(c=(b=n(b,t,10,g.s)).indexOf("."))>-1?b=b.replace(".",""):c=b.length}for(h=0;48===b.charCodeAt(h);h++);for(p=b.length;48===b.charCodeAt(--p););if(b=b.slice(h,++p)){if(p-=h,m&&F.DEBUG&&p>15&&(e>d||e!==u(e)))throw Error(l+g.s*e);if((c=c-h-1)>L)g.c=g.e=null;else if(c<U)g.c=[g.e=0];else{if(g.e=c,g.c=[],h=(c+1)%f,c<0&&(h+=f),h<p){for(h&&g.c.push(+b.slice(0,h)),p-=f;h<p;)g.c.push(+b.slice(h,h+=f));h=f-(b=b.slice(h)).length}else h-=p;for(;h--;b+="0");g.c.push(+b)}}else g.c=[g.e=0]}function K(e,t,r,n){var i,s,a,o,u;if(null==r?r=T:w(r,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)u=y(e.c),u=1==n||2==n&&(a<=P||a>=D)?A(u,a):S(u,a,"0");else if(s=(e=J(new F(e),t,r)).e,o=(u=y(e.c)).length,1==n||2==n&&(t<=s||s<=P)){for(;o<t;u+="0",o++);u=A(u,s)}else if(t-=a,u=S(u,s,"0"),s+1>o){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-o)>0)for(s+1==o&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,t){for(var r,n=1,i=new F(e[0]);n<e.length;n++){if(!(r=new F(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function q(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*f-1)>L?e.c=e.e=null:r<U?e.c=[e.e=0]:(e.e=r,e.c=t),e}function J(e,t,r,n){var i,s,a,c,l,d,p,b=e.c,g=m;if(b){e:{for(i=1,c=b[0];c>=10;c/=10,i++);if((s=t-i)<0)s+=f,a=t,p=(l=b[d=0])/g[i-a-1]%10|0;else if((d=o((s+1)/f))>=b.length){if(!n)break e;for(;b.length<=d;b.push(0));l=p=0,i=1,a=(s%=f)-f+1}else{for(l=c=b[d],i=1;c>=10;c/=10,i++);p=(a=(s%=f)-f+i)<0?0:l/g[i-a-1]%10|0}if(n=n||t<0||null!=b[d+1]||(a<0?l:l%g[i-a-1]),n=r<4?(p||n)&&(0==r||r==(e.s<0?3:2)):p>5||5==p&&(4==r||n||6==r&&(s>0?a>0?l/g[i-a]:0:b[d-1])%10&1||r==(e.s<0?8:7)),t<1||!b[0])return b.length=0,n?(t-=e.e+1,b[0]=g[(f-t%f)%f],e.e=-t||0):b[0]=e.e=0,e;if(0==s?(b.length=d,c=1,d--):(b.length=d+1,c=g[f-s],b[d]=a>0?u(l/g[i-a]%g[a])*c:0),n)for(;;){if(0==d){for(s=1,a=b[0];a>=10;a/=10,s++);for(a=b[0]+=c,c=1;a>=10;a/=10,c++);s!=c&&(e.e++,b[0]==h&&(b[0]=1));break}if(b[d]+=c,b[d]!=h)break;b[d--]=0,c=1}for(s=b.length;0===b[--s];b.pop());}e.e>L?e.c=e.e=null:e.e<U&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=y(e.c),t=r<=P||r>=D?A(t,r):S(t,r,"0"),e.s<0?"-"+t:t)}return F.clone=e,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(w(r=e[t],0,b,t),j=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(r=e[t],0,8,t),T=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(w(r[0],-b,0,t),w(r[1],0,b,t),P=r[0],D=r[1]):(w(r,-b,b,t),P=-(D=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)w(r[0],-b,-1,t),w(r[1],1,b,t),U=r[0],L=r[1];else{if(w(r,-b,b,t),!r)throw Error(c+t+" cannot be zero: "+r);U=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw R=!r,Error(c+"crypto unavailable");R=r}else R=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(w(r=e[t],0,9,t),M=r),e.hasOwnProperty(t="POW_PRECISION")&&(w(r=e[t],0,b,t),$=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(c+t+" not an object: "+r);H=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);V=r}}return{DECIMAL_PLACES:j,ROUNDING_MODE:T,EXPONENTIAL_AT:[P,D],RANGE:[U,L],CRYPTO:R,MODULO_MODE:M,POW_PRECISION:$,FORMAT:H,ALPHABET:V}},F.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!F.DEBUG)return!0;var t,r,n=e.c,i=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===s||-1===s)&&i>=-b&&i<=b&&i===u(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%f)<1&&(t+=f),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=h||r!==u(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(c+"Invalid BigNumber: "+e)},F.maximum=F.max=function(){return z(arguments,I.lt)},F.minimum=F.min=function(){return z(arguments,I.gt)},F.random=(s=9007199254740992,B=Math.random()*s&2097151?function(){return u(Math.random()*s)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,s,a=0,l=[],h=new F(C);if(null==e?e=j:w(e,0,b),i=o(e/f),R)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)(s=131072*t[a]+(t[a+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(l.push(s%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw R=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a<i;)(s=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])>=9e15?crypto.randomBytes(7).copy(t,a):(l.push(s%1e14),a+=7);a=i/7}if(!R)for(;a<i;)(s=B())<9e15&&(l[a++]=s%1e14);for(i=l[--a],e%=f,i&&e&&(s=m[f-e],l[a]=u(i/s)*s);0===l[a];l.pop(),a--);if(a<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=f);for(a=1,s=l[0];s>=10;s/=10,a++);a<f&&(n-=f-a)}return h.e=n,h.c=l,h}),F.sum=function(){for(var e=1,t=arguments,r=new F(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){var e="0123456789";function t(e,t,r,n){for(var i,s,a=[0],o=0,u=e.length;o<u;){for(s=a.length;s--;a[s]*=t);for(a[0]+=n.indexOf(e.charAt(o++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,s,a,o){var u,c,l,h,f,d,m,p,b=n.indexOf("."),g=j,v=T;for(b>=0&&(h=$,$=0,n=n.replace(".",""),d=(p=new F(i)).pow(n.length-b),$=h,p.c=t(S(y(d.c),d.e,"0"),10,s,e),p.e=p.c.length),l=h=(m=t(n,i,s,o?(u=V,e):(u=e,V))).length;0==m[--h];m.pop());if(!m[0])return u.charAt(0);if(b<0?--l:(d.c=m,d.e=l,d.s=a,m=(d=r(d,p,g,v,s)).c,f=d.r,l=d.e),b=m[c=l+g+1],h=s/2,f=f||c<0||null!=m[c+1],f=v<4?(null!=b||f)&&(0==v||v==(d.s<0?3:2)):b>h||b==h&&(4==v||f||6==v&&1&m[c-1]||v==(d.s<0?8:7)),c<1||!m[0])n=f?S(u.charAt(1),-g,u.charAt(0)):u.charAt(0);else{if(m.length=c,f)for(--s;++m[--c]>s;)m[c]=0,c||(++l,m=[1].concat(m));for(h=m.length;!m[--h];);for(b=0,n="";b<=h;n+=u.charAt(m[b++]));n=S(n,l,u.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,s,a,o=0,u=e.length,c=t%p,l=t/p|0;for(e=e.slice();u--;)o=((i=c*(s=e[u]%p)+(n=l*s+(a=e[u]/p|0)*c)%p*p+o)/r|0)+(n/p|0)+l*a,e[u]=i%r;return o&&(e=[o].concat(e)),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,s,a,o){var c,l,d,m,p,b,y,v,w,_,A,S,B,k,E,O,N,x=n.s==i.s?1:-1,I=n.c,C=i.c;if(!(I&&I[0]&&C&&C[0]))return new F(n.s&&i.s&&(I?!C||I[0]!=C[0]:C)?I&&0==I[0]||!C?0*x:x/0:NaN);for(w=(v=new F(x)).c=[],x=s+(l=n.e-i.e)+1,o||(o=h,l=g(n.e/f)-g(i.e/f),x=x/f|0),d=0;C[d]==(I[d]||0);d++);if(C[d]>(I[d]||0)&&l--,x<0)w.push(1),m=!0;else{for(k=I.length,O=C.length,d=0,x+=2,(p=u(o/(C[0]+1)))>1&&(C=e(C,p,o),I=e(I,p,o),O=C.length,k=I.length),B=O,A=(_=I.slice(0,O)).length;A<O;_[A++]=0);N=C.slice(),N=[0].concat(N),E=C[0],C[1]>=o/2&&E++;do{if(p=0,(c=t(C,_,O,A))<0){if(S=_[0],O!=A&&(S=S*o+(_[1]||0)),(p=u(S/E))>1)for(p>=o&&(p=o-1),y=(b=e(C,p,o)).length,A=_.length;1==t(b,_,y,A);)p--,r(b,O<y?N:C,y,o),y=b.length,c=1;else 0==p&&(c=p=1),y=(b=C.slice()).length;if(y<A&&(b=[0].concat(b)),r(_,b,A,o),A=_.length,-1==c)for(;t(C,_,O,A)<1;)p++,r(_,O<A?N:C,A,o),A=_.length}else 0===c&&(p++,_=[0]);w[d++]=p,_[0]?_[A++]=I[B]||0:(_=[I[B]],A=1)}while((B++<k||null!=_[0])&&x--);m=null!=_[0],w[0]||w.splice(0,1)}if(o==h){for(d=1,x=w[0];x>=10;x/=10,d++);J(v,s+(v.e=d+l*f-1)+1,a,m)}else v.e=l,v.r=+m;return v}}(),k=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,O=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,s=r?t:t.replace(x,"");if(N.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(k,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,s=s.replace(E,"$1").replace(O,"0.$1")),t!=s))return new F(s,i);if(F.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},I.absoluteValue=I.abs=function(){var e=new F(this);return e.s<0&&(e.s=1),e},I.comparedTo=function(e,t){return v(this,new F(e,t))},I.decimalPlaces=I.dp=function(e,t){var r,n,i,s=this;if(null!=e)return w(e,0,b),null==t?t=T:w(t,0,8),J(new F(s),e+s.e+1,t);if(!(r=s.c))return null;if(n=((i=r.length-1)-g(this.e/f))*f,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},I.dividedBy=I.div=function(e,t){return r(this,new F(e,t),j,T)},I.dividedToIntegerBy=I.idiv=function(e,t){return r(this,new F(e,t),0,1)},I.exponentiatedBy=I.pow=function(e,t){var r,n,i,s,a,l,h,d,m=this;if((e=new F(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new F(t)),a=e.e>14,!m.c||!m.c[0]||1==m.c[0]&&!m.e&&1==m.c.length||!e.c||!e.c[0])return d=new F(Math.pow(+Y(m),a?2-_(e):+Y(e))),t?d.mod(t):d;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new F(NaN);(n=!l&&m.isInteger()&&t.isInteger())&&(m=m.mod(t))}else{if(e.e>9&&(m.e>0||m.e<-1||(0==m.e?m.c[0]>1||a&&m.c[1]>=24e7:m.c[0]<8e13||a&&m.c[0]<=9999975e7)))return s=m.s<0&&_(e)?-0:0,m.e>-1&&(s=1/s),new F(l?1/s:s);$&&(s=o($/f+2))}for(a?(r=new F(.5),l&&(e.s=1),h=_(e)):h=(i=Math.abs(+Y(e)))%2,d=new F(C);;){if(h){if(!(d=d.times(m)).c)break;s?d.c.length>s&&(d.c.length=s):n&&(d=d.mod(t))}if(i){if(0===(i=u(i/2)))break;h=i%2}else if(J(e=e.times(r),e.e+1,1),e.e>14)h=_(e);else{if(0===(i=+Y(e)))break;h=i%2}m=m.times(m),s?m.c&&m.c.length>s&&(m.c.length=s):n&&(m=m.mod(t))}return n?d:(l&&(d=C.div(d)),t?d.mod(t):s?J(d,$,T,undefined):d)},I.integerValue=function(e){var t=new F(this);return null==e?e=T:w(e,0,8),J(t,t.e+1,e)},I.isEqualTo=I.eq=function(e,t){return 0===v(this,new F(e,t))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(e,t){return v(this,new F(e,t))>0},I.isGreaterThanOrEqualTo=I.gte=function(e,t){return 1===(t=v(this,new F(e,t)))||0===t},I.isInteger=function(){return!!this.c&&g(this.e/f)>this.c.length-2},I.isLessThan=I.lt=function(e,t){return v(this,new F(e,t))<0},I.isLessThanOrEqualTo=I.lte=function(e,t){return-1===(t=v(this,new F(e,t)))||0===t},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(e,t){var r,n,i,s,a=this,o=a.s;if(t=(e=new F(e,t)).s,!o||!t)return new F(NaN);if(o!=t)return e.s=-t,a.plus(e);var u=a.e/f,c=e.e/f,l=a.c,d=e.c;if(!u||!c){if(!l||!d)return l?(e.s=-t,e):new F(d?a:NaN);if(!l[0]||!d[0])return d[0]?(e.s=-t,e):new F(l[0]?a:3==T?-0:0)}if(u=g(u),c=g(c),l=l.slice(),o=u-c){for((s=o<0)?(o=-o,i=l):(c=u,i=d),i.reverse(),t=o;t--;i.push(0));i.reverse()}else for(n=(s=(o=l.length)<(t=d.length))?o:t,o=t=0;t<n;t++)if(l[t]!=d[t]){s=l[t]<d[t];break}if(s&&(i=l,l=d,d=i,e.s=-e.s),(t=(n=d.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=h-1;n>o;){if(l[--n]<d[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=h}l[n]-=d[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?q(e,l,c):(e.s=3==T?-1:1,e.c=[e.e=0],e)},I.modulo=I.mod=function(e,t){var n,i,s=this;return e=new F(e,t),!s.c||!e.s||e.c&&!e.c[0]?new F(NaN):!e.c||s.c&&!s.c[0]?new F(s):(9==M?(i=e.s,e.s=1,n=r(s,e,0,3),e.s=i,n.s*=i):n=r(s,e,0,M),(e=s.minus(n.times(e))).c[0]||1!=M||(e.s=s.s),e)},I.multipliedBy=I.times=function(e,t){var r,n,i,s,a,o,u,c,l,d,m,b,y,v,w,_=this,A=_.c,S=(e=new F(e,t)).c;if(!(A&&S&&A[0]&&S[0]))return!_.s||!e.s||A&&!A[0]&&!S||S&&!S[0]&&!A?e.c=e.e=e.s=null:(e.s*=_.s,A&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=g(_.e/f)+g(e.e/f),e.s*=_.s,(u=A.length)<(d=S.length)&&(y=A,A=S,S=y,i=u,u=d,d=i),i=u+d,y=[];i--;y.push(0));for(v=h,w=p,i=d;--i>=0;){for(r=0,m=S[i]%w,b=S[i]/w|0,s=i+(a=u);s>i;)r=((c=m*(c=A[--a]%w)+(o=b*c+(l=A[a]/w|0)*m)%w*w+y[s]+r)/v|0)+(o/w|0)+b*l,y[s--]=c%v;y[s]=r}return r?++n:y.splice(0,1),q(e,y,n)},I.negated=function(){var e=new F(this);return e.s=-e.s||null,e},I.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new F(e,t)).s,!i||!t)return new F(NaN);if(i!=t)return e.s=-t,n.minus(e);var s=n.e/f,a=e.e/f,o=n.c,u=e.c;if(!s||!a){if(!o||!u)return new F(i/0);if(!o[0]||!u[0])return u[0]?e:new F(o[0]?n:0*i)}if(s=g(s),a=g(a),o=o.slice(),i=s-a){for(i>0?(a=s,r=u):(i=-i,r=o),r.reverse();i--;r.push(0));r.reverse()}for((i=o.length)-(t=u.length)<0&&(r=u,u=o,o=r,t=i),i=0;t;)i=(o[--t]=o[t]+u[t]+i)/h|0,o[t]=h===o[t]?0:o[t]%h;return i&&(o=[i].concat(o),++a),q(e,o,a)},I.precision=I.sd=function(e,t){var r,n,i,s=this;if(null!=e&&e!==!!e)return w(e,1,b),null==t?t=T:w(t,0,8),J(new F(s),e,t);if(!(r=s.c))return null;if(n=(i=r.length-1)*f+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&s.e+1>n&&(n=s.e+1),n},I.shiftedBy=function(e){return w(e,-9007199254740991,d),this.times("1e"+e)},I.squareRoot=I.sqrt=function(){var e,t,n,i,s,a=this,o=a.c,u=a.s,c=a.e,l=j+4,h=new F("0.5");if(1!==u||!o||!o[0])return new F(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);if(0==(u=Math.sqrt(+Y(a)))||u==1/0?(((t=y(o)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=g((c+1)/2)-(c<0||c%2),n=new F(t=u==1/0?"5e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new F(u+""),n.c[0])for((u=(c=n.e)+l)<3&&(u=0);;)if(s=n,n=h.times(s.plus(r(a,s,l,1))),y(s.c).slice(0,u)===(t=y(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(J(n,n.e+j+2,1),e=!n.times(n).eq(a));break}if(!i&&(J(s,s.e+j+2,0),s.times(s).eq(a))){n=s;break}l+=4,u+=4,i=1}return J(n,n.e+j+1,T,e)},I.toExponential=function(e,t){return null!=e&&(w(e,0,b),e++),K(this,e,t,1)},I.toFixed=function(e,t){return null!=e&&(w(e,0,b),e=e+this.e+1),K(this,e,t)},I.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=H;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var s,a=n.split("."),o=+r.groupSize,u=+r.secondaryGroupSize,l=r.groupSeparator||"",h=a[0],f=a[1],d=i.s<0,m=d?h.slice(1):h,p=m.length;if(u&&(s=o,o=u,u=s,p-=s),o>0&&p>0){for(s=p%o||o,h=m.substr(0,s);s<p;s+=o)h+=l+m.substr(s,o);u>0&&(h+=l+m.slice(s)),d&&(h="-"+h)}n=f?h+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):h}return(r.prefix||"")+n+(r.suffix||"")},I.toFraction=function(e){var t,n,i,s,a,o,u,l,h,d,p,b,g=this,v=g.c;if(null!=e&&(!(u=new F(e)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+Y(u));if(!v)return new F(g);for(t=new F(C),h=n=new F(C),i=l=new F(C),b=y(v),a=t.e=b.length-g.e-1,t.c[0]=m[(o=a%f)<0?f+o:o],e=!e||u.comparedTo(t)>0?a>0?t:h:u,o=L,L=1/0,u=new F(b),l.c[0]=0;d=r(u,t,0,1),1!=(s=n.plus(d.times(i))).comparedTo(e);)n=i,i=s,h=l.plus(d.times(s=h)),l=s,t=u.minus(d.times(s=t)),u=s;return s=r(e.minus(n),i,0,1),l=l.plus(s.times(h)),n=n.plus(s.times(i)),l.s=h.s=g.s,p=r(h,i,a*=2,T).minus(g).abs().comparedTo(r(l,n,a,T).minus(g).abs())<1?[h,i]:[l,n],L=o,p},I.toNumber=function(){return+Y(this)},I.toPrecision=function(e,t){return null!=e&&w(e,1,b),K(this,e,t,2)},I.toString=function(e){var t,r=this,i=r.s,s=r.e;return null===s?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=s<=P||s>=D?A(y(r.c),s):S(y(r.c),s,"0"):10===e?t=S(y((r=J(new F(r),j+s+1,T)).c),r.e,"0"):(w(e,2,V.length,"Base"),t=n(S(y(r.c),s,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},I.valueOf=I.toJSON=function(){return Y(this)},I._isBigNumber=!0,null!=t&&F.set(t),F}()).default=s.BigNumber=s,void 0===(n=function(){return s}.call(t,r,t,e))||(e.exports=n)}()},function(e,t,r){"use strict";var n=r(32),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=h;var s=Object.create(r(24));s.inherits=r(19);var a=r(53),o=r(38);s.inherits(h,a);for(var u=i(o.prototype),c=0;c<u.length;c++){var l=u[c];h.prototype[l]||(h.prototype[l]=o.prototype[l])}function h(e){if(!(this instanceof h))return new h(e);a.call(this,e),o.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",f)}function f(){this.allowHalfOpen||this._writableState.ended||n.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),h.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}},function(e,t,r){"use strict";const n=r(15).BigNumber;t.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},t.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},t.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},t.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},t.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},t.SHIFT32=4294967296,t.BI={MINUS_ONE:-1,MAXINT32:4294967295,MAXINT64:"0xffffffffffffffff",SHIFT32:t.SHIFT32};const i=new n(-1);t.BN={MINUS_ONE:i,NEG_MAX:i.minus(new n(Number.MAX_SAFE_INTEGER.toString(16),16)),MAXINT:new n("0x20000000000000"),MAXINT32:new n(4294967295),MAXINT64:new n("0xffffffffffffffff"),SHIFT32:new n(t.SHIFT32)}},function(e,t,r){e.exports=i;var n=r(35).EventEmitter;function i(){n.call(this)}r(19)(i,n),i.Readable=r(36),i.Writable=r(96),i.Duplex=r(97),i.Transform=r(98),i.PassThrough=r(99),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",s),e._isStdio||t&&!1===t.end||(r.on("end",o),r.on("close",u));var a=!1;function o(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(l(),0===n.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",i),e.removeListener("drain",s),r.removeListener("end",o),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("error",c),e.on("error",c),r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";(function(e){const n=r(25),i=r(15).BigNumber,s=r(17),a=s.NUMBYTES,o=s.SHIFT32;t.hasBigInt="function"==typeof BigInt;const u="function"==typeof TextDecoder?TextDecoder:n.TextDecoder;if(u){const e=new u("utf8",{fatal:!0,ignoreBOM:!0});t.utf8=t=>e.decode(t),t.utf8.checksUTF8=!0}else t.utf8=e=>e.toString("utf8"),t.utf8.checksUTF8=!1;t.parseCBORint=function(e,t){switch(e){case a.ONE:return t.readUInt8(0);case a.TWO:return t.readUInt16BE(0);case a.FOUR:return t.readUInt32BE(0);case a.EIGHT:const r=t.readUInt32BE(0),n=t.readUInt32BE(4);return r>2097151?new i(r).times(o).plus(n):r*o+n;default:throw new Error("Invalid additional info for int: "+e)}},t.writeHalf=function(t,r){const n=e.allocUnsafe(4);n.writeFloatBE(r,0);const i=n.readUInt32BE(0);if(0!=(8191&i))return!1;let s=i>>16&32768;const a=i>>23&255,o=8388607&i;if(a>=113&&a<=142)s+=(a-112<<10)+(o>>13);else{if(!(a>=103&&a<113))return!1;if(o&(1<<126-a)-1)return!1;s+=o+8388608>>126-a}return t.writeUInt16BE(s),!0},t.parseHalf=function(e){const t=128&e[0]?-1:1,r=(124&e[0])>>2,n=(3&e[0])<<8|e[1];return r?31===r?t*(n?NaN:Infinity):t*Math.pow(2,r-25)*(1024+n):5.960464477539063e-8*t*n},t.parseCBORfloat=function(e){switch(e.length){case 2:return t.parseHalf(e);case 4:return e.readFloatBE(0);case 8:return e.readDoubleBE(0);default:throw new Error("Invalid float size: "+e.length)}},t.hex=function(t){return e.from(t.replace(/^0x/,""),"hex")},t.bin=function(t){let r=0,n=(t=t.replace(/\s/g,"")).length%8||8;const i=[];for(;n<=t.length;)i.push(parseInt(t.slice(r,n),2)),r=n,n+=8;return e.from(i)},t.extend=function(e={},...t){const r=t.length;for(let n=0;n<r;n++){const r=t[n];for(const t in r){const n=r[t];e[t]=n}}return e},t.arrayEqual=function(e,t){return null==e&&null==t||null!=e&&null!=t&&(e.length===t.length&&e.every(((e,r)=>e===t[r])))},t.bufferEqual=function(t,r){if(null==t&&null==r)return!0;if(null==t||null==r)return!1;if(!e.isBuffer(t)||!e.isBuffer(r)||t.length!==r.length)return!1;const n=t.length;let i,s,a=!0;for(i=s=0;s<n;i=++s){const e=t[i];a=a&&r[i]===e}return!!a},t.bufferToBignumber=function(e){return new i(e.toString("hex"),16)},t.toBigInt=function(e){return t.hasBigInt?BigInt(e):Number(e)},t.bigIntize=function(e){const r={};for(const n in e)r[n]=t.toBigInt(e[n]);return r},t.bufferToBigInt=function(e){return t.toBigInt("0x"+e.toString("hex"))},t.guessEncoding=function(t){if("string"==typeof t)return"hex";if(!e.isBuffer(t))throw new Error("Unknown input type")}}).call(this,r(6).Buffer)},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),i=r(1);class s{constructor(e={}){this.prime=Object(i.f)(e,"prime",s.defaultValues("prime")),this.exponent=Object(i.f)(e,"exponent",s.defaultValues("exponent")),this.coefficient=Object(i.f)(e,"coefficient",s.defaultValues("coefficient")),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"prime":case"exponent":case"coefficient":return new n.m;default:throw new Error(`Invalid member name for OtherPrimeInfo class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.prime||""}),new n.m({name:t.exponent||""}),new n.m({name:t.coefficient||""})]})}fromSchema(e){Object(i.d)(e,["prime","exponent","coefficient"]);const t=n.D(e,e,s.schema({names:{prime:"prime",exponent:"exponent",coefficient:"coefficient"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for OtherPrimeInfo");this.prime=t.result.prime.convertFromDER(),this.exponent=t.result.exponent.convertFromDER(),this.coefficient=t.result.coefficient.convertFromDER()}toSchema(){return new n.v({value:[this.prime.convertToDER(),this.exponent.convertToDER(),this.coefficient.convertToDER()]})}toJSON(){return{r:Object(i.k)(Object(i.a)(this.prime.valueBlock.valueHex),!0,!0),d:Object(i.k)(Object(i.a)(this.exponent.valueBlock.valueHex),!0,!0),t:Object(i.k)(Object(i.a)(this.coefficient.valueBlock.valueHex),!0,!0)}}fromJSON(e){if(!("r"in e))throw new Error('Absent mandatory parameter "r"');if(this.prime=new n.m({valueHex:Object(i.j)(Object(i.e)(e.r,!0))}),!("d"in e))throw new Error('Absent mandatory parameter "d"');if(this.exponent=new n.m({valueHex:Object(i.j)(Object(i.e)(e.d,!0))}),!("t"in e))throw new Error('Absent mandatory parameter "t"');this.coefficient=new n.m({valueHex:Object(i.j)(Object(i.e)(e.t,!0))})}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),i=r(1),s=r(2);class a{constructor(e={}){this.hashAlgorithm=Object(i.f)(e,"hashAlgorithm",a.defaultValues("hashAlgorithm")),this.maskGenAlgorithm=Object(i.f)(e,"maskGenAlgorithm",a.defaultValues("maskGenAlgorithm")),this.saltLength=Object(i.f)(e,"saltLength",a.defaultValues("saltLength")),this.trailerField=Object(i.f)(e,"trailerField",a.defaultValues("trailerField")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"hashAlgorithm":return new s.a({algorithmId:"1.3.14.3.2.26",algorithmParams:new n.n});case"maskGenAlgorithm":return new s.a({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:new s.a({algorithmId:"1.3.14.3.2.26",algorithmParams:new n.n}).toSchema()});case"saltLength":return 20;case"trailerField":return 1;default:throw new Error(`Invalid member name for RSASSAPSSParams class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.g({idBlock:{tagClass:3,tagNumber:0},optional:!0,value:[s.a.schema(t.hashAlgorithm||{})]}),new n.g({idBlock:{tagClass:3,tagNumber:1},optional:!0,value:[s.a.schema(t.maskGenAlgorithm||{})]}),new n.g({idBlock:{tagClass:3,tagNumber:2},optional:!0,value:[new n.m({name:t.saltLength||""})]}),new n.g({idBlock:{tagClass:3,tagNumber:3},optional:!0,value:[new n.m({name:t.trailerField||""})]})]})}fromSchema(e){Object(i.d)(e,["hashAlgorithm","maskGenAlgorithm","saltLength","trailerField"]);const t=n.D(e,e,a.schema({names:{hashAlgorithm:{names:{blockName:"hashAlgorithm"}},maskGenAlgorithm:{names:{blockName:"maskGenAlgorithm"}},saltLength:"saltLength",trailerField:"trailerField"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RSASSAPSSParams");"hashAlgorithm"in t.result&&(this.hashAlgorithm=new s.a({schema:t.result.hashAlgorithm})),"maskGenAlgorithm"in t.result&&(this.maskGenAlgorithm=new s.a({schema:t.result.maskGenAlgorithm})),"saltLength"in t.result&&(this.saltLength=t.result.saltLength.valueBlock.valueDec),"trailerField"in t.result&&(this.trailerField=t.result.trailerField.valueBlock.valueDec)}toSchema(){const e=[];return this.hashAlgorithm.isEqual(a.defaultValues("hashAlgorithm"))||e.push(new n.g({idBlock:{tagClass:3,tagNumber:0},value:[this.hashAlgorithm.toSchema()]})),this.maskGenAlgorithm.isEqual(a.defaultValues("maskGenAlgorithm"))||e.push(new n.g({idBlock:{tagClass:3,tagNumber:1},value:[this.maskGenAlgorithm.toSchema()]})),this.saltLength!==a.defaultValues("saltLength")&&e.push(new n.g({idBlock:{tagClass:3,tagNumber:2},value:[new n.m({value:this.saltLength})]})),this.trailerField!==a.defaultValues("trailerField")&&e.push(new n.g({idBlock:{tagClass:3,tagNumber:3},value:[new n.m({value:this.trailerField})]})),new n.v({value:e})}toJSON(){const e={};return this.hashAlgorithm.isEqual(a.defaultValues("hashAlgorithm"))||(e.hashAlgorithm=this.hashAlgorithm.toJSON()),this.maskGenAlgorithm.isEqual(a.defaultValues("maskGenAlgorithm"))||(e.maskGenAlgorithm=this.maskGenAlgorithm.toJSON()),this.saltLength!==a.defaultValues("saltLength")&&(e.saltLength=this.saltLength),this.trailerField!==a.defaultValues("trailerField")&&(e.trailerField=this.trailerField),e}}},function(e,t){e.exports=n;var r=null;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(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var s={},a={};function o(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=a[e])?n:(r=c(e,(0|e)<0?-1:0,!0),i&&(a[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(r=c(e,e<0?-1:0,!1),i&&(s[e]=r),r)}function u(e,t){if(isNaN(e))return t?y:g;if(t){if(e<0)return y;if(e>=m)return S}else{if(e<=-p)return B;if(e+1>=p)return A}return e<0?u(-e,t).neg():c(e%d|0,e/d|0,t)}function c(e,t,r){return new n(e,t,r)}n.fromInt=o,n.fromNumber=u,n.fromBits=c;var l=Math.pow;function h(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return h(e.substring(1),t,r).neg();for(var i=u(l(r,8)),s=g,a=0;a<e.length;a+=8){var o=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+o),r);if(o<8){var f=u(l(r,o));s=s.mul(f).add(u(c))}else s=(s=s.mul(i)).add(u(c))}return s.unsigned=t,s}function f(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?h(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=h,n.fromValue=f;var d=4294967296,m=d*d,p=m/2,b=o(1<<24),g=o(0);n.ZERO=g;var y=o(0,!0);n.UZERO=y;var v=o(1);n.ONE=v;var w=o(1,!0);n.UONE=w;var _=o(-1);n.NEG_ONE=_;var A=c(-1,2147483647,!1);n.MAX_VALUE=A;var S=c(-1,-1,!0);n.MAX_UNSIGNED_VALUE=S;var B=c(0,-2147483648,!1);n.MIN_VALUE=B;var k=n.prototype;k.toInt=function(){return this.unsigned?this.low>>>0:this.low},k.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},k.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(B)){var t=u(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=u(l(e,6),this.unsigned),s=this,a="";;){var o=s.div(i),c=(s.sub(o.mul(i)).toInt()>>>0).toString(e);if((s=o).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},k.getHighBits=function(){return this.high},k.getHighBitsUnsigned=function(){return this.high>>>0},k.getLowBits=function(){return this.low},k.getLowBitsUnsigned=function(){return this.low>>>0},k.getNumBitsAbs=function(){if(this.isNegative())return this.eq(B)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},k.isZero=function(){return 0===this.high&&0===this.low},k.eqz=k.isZero,k.isNegative=function(){return!this.unsigned&&this.high<0},k.isPositive=function(){return this.unsigned||this.high>=0},k.isOdd=function(){return 1==(1&this.low)},k.isEven=function(){return 0==(1&this.low)},k.equals=function(e){return i(e)||(e=f(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},k.eq=k.equals,k.notEquals=function(e){return!this.eq(e)},k.neq=k.notEquals,k.ne=k.notEquals,k.lessThan=function(e){return this.comp(e)<0},k.lt=k.lessThan,k.lessThanOrEqual=function(e){return this.comp(e)<=0},k.lte=k.lessThanOrEqual,k.le=k.lessThanOrEqual,k.greaterThan=function(e){return this.comp(e)>0},k.gt=k.greaterThan,k.greaterThanOrEqual=function(e){return this.comp(e)>=0},k.gte=k.greaterThanOrEqual,k.ge=k.greaterThanOrEqual,k.compare=function(e){if(i(e)||(e=f(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?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},k.comp=k.compare,k.negate=function(){return!this.unsigned&&this.eq(B)?B:this.not().add(v)},k.neg=k.negate,k.add=function(e){i(e)||(e=f(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,s=65535&this.low,a=e.high>>>16,o=65535&e.high,u=e.low>>>16,l=0,h=0,d=0,m=0;return d+=(m+=s+(65535&e.low))>>>16,h+=(d+=n+u)>>>16,l+=(h+=r+o)>>>16,l+=t+a,c((d&=65535)<<16|(m&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},k.subtract=function(e){return i(e)||(e=f(e)),this.add(e.neg())},k.sub=k.subtract,k.multiply=function(e){if(this.isZero())return g;if(i(e)||(e=f(e)),r)return c(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(B))return e.isOdd()?B:g;if(e.eq(B))return this.isOdd()?B:g;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(b)&&e.lt(b))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,s=this.low>>>16,a=65535&this.low,o=e.high>>>16,l=65535&e.high,h=e.low>>>16,d=65535&e.low,m=0,p=0,y=0,v=0;return y+=(v+=a*d)>>>16,p+=(y+=s*d)>>>16,y&=65535,p+=(y+=a*h)>>>16,m+=(p+=n*d)>>>16,p&=65535,m+=(p+=s*h)>>>16,p&=65535,m+=(p+=a*l)>>>16,m+=t*d+n*h+s*l+a*o,c((y&=65535)<<16|(v&=65535),(m&=65535)<<16|(p&=65535),this.unsigned)},k.mul=k.multiply,k.divide=function(e){if(i(e)||(e=f(e)),e.isZero())throw Error("division by zero");var t,n,s;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?y:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return y;if(e.gt(this.shru(1)))return w;s=y}else{if(this.eq(B))return e.eq(v)||e.eq(_)?B:e.eq(B)?v:(t=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:_:(n=this.sub(e.mul(t)),s=t.add(n.div(e)));if(e.eq(B))return this.unsigned?y:g;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();s=g}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(t)/Math.LN2),o=a<=48?1:l(2,a-48),h=u(t),d=h.mul(e);d.isNegative()||d.gt(n);)d=(h=u(t-=o,this.unsigned)).mul(e);h.isZero()&&(h=v),s=s.add(h),n=n.sub(d)}return s},k.div=k.divide,k.modulo=function(e){return i(e)||(e=f(e)),r?c((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},k.mod=k.modulo,k.rem=k.modulo,k.not=function(){return c(~this.low,~this.high,this.unsigned)},k.and=function(e){return i(e)||(e=f(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},k.or=function(e){return i(e)||(e=f(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},k.xor=function(e){return i(e)||(e=f(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},k.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},k.shl=k.shiftLeft,k.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},k.shr=k.shiftRight,k.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},k.shru=k.shiftRightUnsigned,k.shr_u=k.shiftRightUnsigned,k.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},k.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},k.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},k.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},k.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,r(6).Buffer)},function(e,t,r){(function(e){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},i=/%[sdj%]/g;t.format=function(e){if(!g(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(o(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,s=n.length,a=String(e).replace(i,(function(e){if("%%"===e)return"%";if(r>=s)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),u=n[r];r<s;u=n[++r])p(u)||!w(u)?a+=" "+u:a+=" "+o(u);return a},t.deprecate=function(r,n){if(void 0!==e&&!0===e.noDeprecation)return r;if(void 0===e)return function(){return t.deprecate(r,n).apply(this,arguments)};var i=!1;return function(){if(!i){if(e.throwDeprecation)throw new Error(n);e.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}};var s,a={};function o(e,r){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(r)?n.showHidden=r:r&&t._extend(n,r),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,e,n.depth)}function u(e,t){var r=o.styles[t];return r?"["+o.colors[r][0]+"m"+e+"["+o.colors[r][1]+"m":e}function c(e,t){return e}function l(e,r,n){if(e.customInspect&&r&&S(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return g(i)||(i=l(e,i,n)),i}var s=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(g(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(b(t))return e.stylize(""+t,"number");if(m(t))return e.stylize(""+t,"boolean");if(p(t))return e.stylize("null","null")}(e,r);if(s)return s;var a=Object.keys(r),o=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),A(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return h(r);if(0===a.length){if(S(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(v(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(_(r))return e.stylize(Date.prototype.toString.call(r),"date");if(A(r))return h(r)}var c,w="",B=!1,k=["{","}"];(d(r)&&(B=!0,k=["[","]"]),S(r))&&(w=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(w=" "+RegExp.prototype.toString.call(r)),_(r)&&(w=" "+Date.prototype.toUTCString.call(r)),A(r)&&(w=" "+h(r)),0!==a.length||B&&0!=r.length?n<0?v(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=B?function(e,t,r,n,i){for(var s=[],a=0,o=t.length;a<o;++a)N(t,String(a))?s.push(f(e,t,r,n,String(a),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(f(e,t,r,n,i,!0))})),s}(e,r,n,o,a):a.map((function(t){return f(e,r,n,o,t,B)})),e.seen.pop(),function(e,t,r){if(e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,w,k)):k[0]+w+k[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,r,n,i,s){var a,o,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?o=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(o=e.stylize("[Setter]","special")),N(n,i)||(a="["+i+"]"),o||(e.seen.indexOf(u.value)<0?(o=p(r)?l(e,u.value,null):l(e,u.value,r-1)).indexOf("\n")>-1&&(o=s?o.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+o.split("\n").map((function(e){return" "+e})).join("\n")):o=e.stylize("[Circular]","special")),y(a)){if(s&&i.match(/^\d+$/))return o;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+o}function d(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function p(e){return null===e}function b(e){return"number"==typeof e}function g(e){return"string"==typeof e}function y(e){return void 0===e}function v(e){return w(e)&&"[object RegExp]"===B(e)}function w(e){return"object"==typeof e&&null!==e}function _(e){return w(e)&&"[object Date]"===B(e)}function A(e){return w(e)&&("[object Error]"===B(e)||e instanceof Error)}function S(e){return"function"==typeof e}function B(e){return Object.prototype.toString.call(e)}function k(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(y(s)&&(s=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var n=e.pid;a[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else a[r]=function(){};return a[r]},t.inspect=o,o.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]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=m,t.isNull=p,t.isNullOrUndefined=function(e){return null==e},t.isNumber=b,t.isString=g,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=v,t.isObject=w,t.isDate=_,t.isError=A,t.isFunction=S,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(100);var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(){var e=new Date,t=[k(e.getHours()),k(e.getMinutes()),k(e.getSeconds())].join(":");return[e.getDate(),E[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",O(),t.format.apply(t,arguments))},t.inherits=r(101),t._extend=function(e,t){if(!t||!w(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function I(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(x&&e[x]){var t;if("function"!=typeof(t=e[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),x&&Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,n(e))},t.promisify.custom=x,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var s=this,a=function(){return i.apply(s,arguments)};t.apply(this,r).then((function(t){e.nextTick(a,null,t)}),(function(t){e.nextTick(I,t,a)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,n(t)),r}}).call(this,r(14))},function(e,t,r){"use strict";const n=r(25),i=r(17),s=i.MT,a=i.SIMPLE,o=i.SYMS;class u{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}[n.inspect.custom](e,t){return"simple("+this.value+")"}inspect(e,t){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(e){return e instanceof u}static decode(e,t=!0,r=!1){switch(e){case a.FALSE:return!1;case a.TRUE:return!0;case a.NULL:return t?null:o.NULL;case a.UNDEFINED:return t?void 0:o.UNDEFINED;case-1:if(!t||!r)throw new Error("Invalid BREAK");return o.BREAK;default:return new u(e)}}}e.exports=u},function(e,t,r){"use strict";(function(t){const n=r(18),i=r(25);class s extends n.Transform{constructor(e,r,n){let i,s;switch(null==n&&(n={}),typeof e){case"object":t.isBuffer(e)?(i=e,null!=r&&"object"==typeof r&&(n=r)):n=e;break;case"string":i=e,null!=r&&"object"==typeof r?n=r:s=r}null==n&&(n={}),null==i&&(i=n.input),null==s&&(s=n.inputEncoding),delete n.input,delete n.inputEncoding;const a=null==n.watchPipe||n.watchPipe;delete n.watchPipe;const o=!!n.readError;delete n.readError,super(n),this.readError=o,a&&this.on("pipe",(e=>{const t=e._readableState.objectMode;if(this.length>0&&t!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");return this._readableState.objectMode=t,this._writableState.objectMode=t})),null!=i&&this.end(i,s)}static isNoFilter(e){return e instanceof this}static compare(e,t){if(!(e instanceof this))throw new TypeError("Arguments must be NoFilters");return e===t?0:e.compare(t)}static concat(e,r){if(!Array.isArray(e))throw new TypeError("list argument must be an Array of NoFilters");if(0===e.length||0===r)return t.alloc(0);null==r&&(r=e.reduce(((e,t)=>{if(!(t instanceof s))throw new TypeError("list argument must be an Array of NoFilters");return e+t.length}),0));let n=!0,i=!0;const a=e.map((e=>{if(!(e instanceof s))throw new TypeError("list argument must be an Array of NoFilters");const r=e.slice();return t.isBuffer(r)?i=!1:n=!1,r}));if(n)return t.concat(a,r);if(i)return[].concat(...a).slice(0,r);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(e,r,n){this._readableState.objectMode||t.isBuffer(e)||(e=t.from(e,r)),this.push(e),n()}_bufArray(){let e=this._readableState.buffer;if(!Array.isArray(e)){let t=e.head;for(e=[];null!=t;)e.push(t.data),t=t.next}return e}read(e){const t=super.read(e);if(null!=t){if(this.emit("read",t),this.readError&&t.length<e)throw new Error(`Read ${t.length}, wanted ${e}`)}else if(this.readError)throw new Error(`No data available, wanted ${e}`);return t}promise(e){let t=!1;return new Promise(((r,n)=>{this.on("finish",(()=>{const n=this.read();null==e||t||(t=!0,e(null,n)),r(n)})),this.on("error",(r=>{null==e||t||(t=!0,e(r)),n(r)}))}))}compare(e){if(!(e instanceof s))throw new TypeError("Arguments must be NoFilters");if(this===e)return 0;{const r=this.slice(),n=e.slice();if(t.isBuffer(r)&&t.isBuffer(n))return r.compare(n);throw new Error("Cannot compare streams in object mode")}}equals(e){return 0===this.compare(e)}slice(e,r){if(this._readableState.objectMode)return this._bufArray().slice(e,r);const n=this._bufArray();switch(n.length){case 0:return t.alloc(0);case 1:return n[0].slice(e,r);default:return t.concat(n).slice(e,r)}}get(e){return this.slice()[e]}toJSON(){const e=this.slice();return t.isBuffer(e)?e.toJSON():e}toString(e,r,n){const s=this.slice(r,n);if(!t.isBuffer(s))return JSON.stringify(s);if((!e||"utf8"===e)&&i.TextDecoder){return new i.TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(s)}return s.toString(e,r,n)}inspect(e,t){return this[i.inspect.custom](e,t)}[i.inspect.custom](e,r){const n=this._bufArray().map((e=>t.isBuffer(e)?(null!=r?r.stylize:void 0)?r.stylize(e.toString("hex"),"string"):e.toString("hex"):i.inspect(e,r))).join(", ");return`${this.constructor.name} [${n}]`}get length(){return this._readableState.length}writeBigInt(e){let r=e.toString(16);if(e<0){const t=BigInt(Math.floor(r.length/2));r=(e=(BigInt(1)<<t*BigInt(8))+e).toString(16)}return r.length%2&&(r="0"+r),this.push(t.from(r,"hex"))}readUBigInt(e){const r=this.read(e);return t.isBuffer(r)?BigInt("0x"+r.toString("hex")):null}readBigInt(e){const r=this.read(e);if(!t.isBuffer(r))return null;let n=BigInt("0x"+r.toString("hex"));if(128&r[0]){n-=BigInt(1)<<BigInt(r.length)*BigInt(8)}return n}}function a(e,r){return function(n){const i=this.read(r);return t.isBuffer(i)?i[e].call(i,0,!0):null}}function o(e,r){return function(n){const i=t.alloc(r);return i[e].call(i,n,0,!0),this.push(i)}}Object.assign(s.prototype,{writeUInt8:o("writeUInt8",1),writeUInt16LE:o("writeUInt16LE",2),writeUInt16BE:o("writeUInt16BE",2),writeUInt32LE:o("writeUInt32LE",4),writeUInt32BE:o("writeUInt32BE",4),writeInt8:o("writeInt8",1),writeInt16LE:o("writeInt16LE",2),writeInt16BE:o("writeInt16BE",2),writeInt32LE:o("writeInt32LE",4),writeInt32BE:o("writeInt32BE",4),writeFloatLE:o("writeFloatLE",4),writeFloatBE:o("writeFloatBE",4),writeDoubleLE:o("writeDoubleLE",8),writeDoubleBE:o("writeDoubleBE",8),readUInt8:a("readUInt8",1),readUInt16LE:a("readUInt16LE",2),readUInt16BE:a("readUInt16BE",2),readUInt32LE:a("readUInt32LE",4),readUInt32BE:a("readUInt32BE",4),readInt8:a("readInt8",1),readInt16LE:a("readInt16LE",2),readInt16BE:a("readInt16BE",2),readInt32LE:a("readInt32LE",4),readInt32BE:a("readInt32BE",4),readFloatLE:a("readFloatLE",4),readFloatBE:a("readFloatBE",4),readDoubleLE:a("readDoubleLE",8),readDoubleBE:a("readDoubleBE",8)}),e.exports=s}).call(this,r(6).Buffer)},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),i=r(1);class s{constructor(e={}){this.modulus=Object(i.f)(e,"modulus",s.defaultValues("modulus")),this.publicExponent=Object(i.f)(e,"publicExponent",s.defaultValues("publicExponent")),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"modulus":case"publicExponent":return new n.m;default:throw new Error(`Invalid member name for RSAPublicKey class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.modulus||""}),new n.m({name:t.publicExponent||""})]})}fromSchema(e){Object(i.d)(e,["modulus","publicExponent"]);const t=n.D(e,e,s.schema({names:{modulus:"modulus",publicExponent:"publicExponent"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RSAPublicKey");this.modulus=t.result.modulus.convertFromDER(256),this.publicExponent=t.result.publicExponent}toSchema(){return new n.v({value:[this.modulus.convertToDER(),this.publicExponent]})}toJSON(){return{n:Object(i.k)(Object(i.a)(this.modulus.valueBlock.valueHex),!0,!0,!0),e:Object(i.k)(Object(i.a)(this.publicExponent.valueBlock.valueHex),!0,!0,!0)}}fromJSON(e){if(!("n"in e))throw new Error('Absent mandatory parameter "n"');{const t=Object(i.j)(Object(i.e)(e.n,!0));this.modulus=new n.m({valueHex:t.slice(0,Math.pow(2,Object(i.h)(t.byteLength)))})}if(!("e"in e))throw new Error('Absent mandatory parameter "e"');this.publicExponent=new n.m({valueHex:Object(i.j)(Object(i.e)(e.e,!0)).slice(0,3)})}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),i=r(1),s=r(10);class a{constructor(e={}){this.version=Object(i.f)(e,"version",a.defaultValues("version")),this.privateKey=Object(i.f)(e,"privateKey",a.defaultValues("privateKey")),"namedCurve"in e&&(this.namedCurve=Object(i.f)(e,"namedCurve",a.defaultValues("namedCurve"))),"publicKey"in e&&(this.publicKey=Object(i.f)(e,"publicKey",a.defaultValues("publicKey"))),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"version":return 1;case"privateKey":return new n.q;case"namedCurve":return"";case"publicKey":return new s.a;default:throw new Error(`Invalid member name for ECCPrivateKey class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"version":return t===a.defaultValues(e);case"privateKey":return t.isEqual(a.defaultValues(e));case"namedCurve":return""===t;case"publicKey":return s.a.compareWithDefault("namedCurve",t.namedCurve)&&s.a.compareWithDefault("x",t.x)&&s.a.compareWithDefault("y",t.y);default:throw new Error(`Invalid member name for ECCPrivateKey class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.version||""}),new n.q({name:t.privateKey||""}),new n.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new n.p({name:t.namedCurve||""})]}),new n.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new n.b({name:t.publicKey||""})]})]})}fromSchema(e){Object(i.d)(e,["version","privateKey","namedCurve","publicKey"]);const t=n.D(e,e,a.schema({names:{version:"version",privateKey:"privateKey",namedCurve:"namedCurve",publicKey:"publicKey"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for ECPrivateKey");if(this.version=t.result.version.valueBlock.valueDec,this.privateKey=t.result.privateKey,"namedCurve"in t.result&&(this.namedCurve=t.result.namedCurve.valueBlock.toString()),"publicKey"in t.result){const e={schema:t.result.publicKey.valueBlock.valueHex};"namedCurve"in this&&(e.namedCurve=this.namedCurve),this.publicKey=new s.a(e)}}toSchema(){const e=[new n.m({value:this.version}),this.privateKey];return"namedCurve"in this&&e.push(new n.g({idBlock:{tagClass:3,tagNumber:0},value:[new n.p({value:this.namedCurve})]})),"publicKey"in this&&e.push(new n.g({idBlock:{tagClass:3,tagNumber:1},value:[new n.b({valueHex:this.publicKey.toSchema().toBER(!1)})]})),new n.v({value:e})}toJSON(){if("namedCurve"in this==!1||a.compareWithDefault("namedCurve",this.namedCurve))throw new Error('Not enough information for making JSON: absent "namedCurve" value');let e="";switch(this.namedCurve){case"1.2.840.10045.3.1.7":e="P-256";break;case"1.3.132.0.34":e="P-384";break;case"1.3.132.0.35":e="P-521"}const t={crv:e,d:Object(i.k)(Object(i.a)(this.privateKey.valueBlock.valueHex),!0,!0,!1)};if("publicKey"in this){const e=this.publicKey.toJSON();t.x=e.x,t.y=e.y}return t}fromJSON(e){let t=0;if(!("crv"in e))throw new Error('Absent mandatory parameter "crv"');switch(e.crv.toUpperCase()){case"P-256":this.namedCurve="1.2.840.10045.3.1.7",t=32;break;case"P-384":this.namedCurve="1.3.132.0.34",t=48;break;case"P-521":this.namedCurve="1.3.132.0.35",t=66}if(!("d"in e))throw new Error('Absent mandatory parameter "d"');{const r=Object(i.j)(Object(i.e)(e.d,!0));if(r.byteLength<t){const e=new ArrayBuffer(t),i=new Uint8Array(e),s=new Uint8Array(r);i.set(s,1),this.privateKey=new n.q({valueHex:e})}else this.privateKey=new n.q({valueHex:r.slice(0,t)})}"x"in e&&"y"in e&&(this.publicKey=new s.a({json:e}))}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),i=r(1),s=r(21);class a{constructor(e={}){this.version=Object(i.f)(e,"version",a.defaultValues("version")),this.modulus=Object(i.f)(e,"modulus",a.defaultValues("modulus")),this.publicExponent=Object(i.f)(e,"publicExponent",a.defaultValues("publicExponent")),this.privateExponent=Object(i.f)(e,"privateExponent",a.defaultValues("privateExponent")),this.prime1=Object(i.f)(e,"prime1",a.defaultValues("prime1")),this.prime2=Object(i.f)(e,"prime2",a.defaultValues("prime2")),this.exponent1=Object(i.f)(e,"exponent1",a.defaultValues("exponent1")),this.exponent2=Object(i.f)(e,"exponent2",a.defaultValues("exponent2")),this.coefficient=Object(i.f)(e,"coefficient",a.defaultValues("coefficient")),"otherPrimeInfos"in e&&(this.otherPrimeInfos=Object(i.f)(e,"otherPrimeInfos",a.defaultValues("otherPrimeInfos"))),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"version":return 0;case"modulus":case"publicExponent":case"privateExponent":case"prime1":case"prime2":case"exponent1":case"exponent2":case"coefficient":return new n.m;case"otherPrimeInfos":return[];default:throw new Error(`Invalid member name for RSAPrivateKey class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.version||""}),new n.m({name:t.modulus||""}),new n.m({name:t.publicExponent||""}),new n.m({name:t.privateExponent||""}),new n.m({name:t.prime1||""}),new n.m({name:t.prime2||""}),new n.m({name:t.exponent1||""}),new n.m({name:t.exponent2||""}),new n.m({name:t.coefficient||""}),new n.v({optional:!0,value:[new n.u({name:t.otherPrimeInfosName||"",value:s.a.schema(t.otherPrimeInfo||{})})]})]})}fromSchema(e){Object(i.d)(e,["version","modulus","publicExponent","privateExponent","prime1","prime2","exponent1","exponent2","coefficient","otherPrimeInfos"]);const t=n.D(e,e,a.schema({names:{version:"version",modulus:"modulus",publicExponent:"publicExponent",privateExponent:"privateExponent",prime1:"prime1",prime2:"prime2",exponent1:"exponent1",exponent2:"exponent2",coefficient:"coefficient",otherPrimeInfo:{names:{blockName:"otherPrimeInfos"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RSAPrivateKey");this.version=t.result.version.valueBlock.valueDec,this.modulus=t.result.modulus.convertFromDER(256),this.publicExponent=t.result.publicExponent,this.privateExponent=t.result.privateExponent.convertFromDER(256),this.prime1=t.result.prime1.convertFromDER(128),this.prime2=t.result.prime2.convertFromDER(128),this.exponent1=t.result.exponent1.convertFromDER(128),this.exponent2=t.result.exponent2.convertFromDER(128),this.coefficient=t.result.coefficient.convertFromDER(128),"otherPrimeInfos"in t.result&&(this.otherPrimeInfos=Array.from(t.result.otherPrimeInfos,(e=>new s.a({schema:e}))))}toSchema(){const e=[];return e.push(new n.m({value:this.version})),e.push(this.modulus.convertToDER()),e.push(this.publicExponent),e.push(this.privateExponent.convertToDER()),e.push(this.prime1.convertToDER()),e.push(this.prime2.convertToDER()),e.push(this.exponent1.convertToDER()),e.push(this.exponent2.convertToDER()),e.push(this.coefficient.convertToDER()),"otherPrimeInfos"in this&&e.push(new n.v({value:Array.from(this.otherPrimeInfos,(e=>e.toSchema()))})),new n.v({value:e})}toJSON(){const e={n:Object(i.k)(Object(i.a)(this.modulus.valueBlock.valueHex),!0,!0,!0),e:Object(i.k)(Object(i.a)(this.publicExponent.valueBlock.valueHex),!0,!0,!0),d:Object(i.k)(Object(i.a)(this.privateExponent.valueBlock.valueHex),!0,!0,!0),p:Object(i.k)(Object(i.a)(this.prime1.valueBlock.valueHex),!0,!0,!0),q:Object(i.k)(Object(i.a)(this.prime2.valueBlock.valueHex),!0,!0,!0),dp:Object(i.k)(Object(i.a)(this.exponent1.valueBlock.valueHex),!0,!0,!0),dq:Object(i.k)(Object(i.a)(this.exponent2.valueBlock.valueHex),!0,!0,!0),qi:Object(i.k)(Object(i.a)(this.coefficient.valueBlock.valueHex),!0,!0,!0)};return"otherPrimeInfos"in this&&(e.oth=Array.from(this.otherPrimeInfos,(e=>e.toJSON()))),e}fromJSON(e){if(!("n"in e))throw new Error('Absent mandatory parameter "n"');if(this.modulus=new n.m({valueHex:Object(i.j)(Object(i.e)(e.n,!0,!0))}),!("e"in e))throw new Error('Absent mandatory parameter "e"');if(this.publicExponent=new n.m({valueHex:Object(i.j)(Object(i.e)(e.e,!0,!0))}),!("d"in e))throw new Error('Absent mandatory parameter "d"');if(this.privateExponent=new n.m({valueHex:Object(i.j)(Object(i.e)(e.d,!0,!0))}),!("p"in e))throw new Error('Absent mandatory parameter "p"');if(this.prime1=new n.m({valueHex:Object(i.j)(Object(i.e)(e.p,!0,!0))}),!("q"in e))throw new Error('Absent mandatory parameter "q"');if(this.prime2=new n.m({valueHex:Object(i.j)(Object(i.e)(e.q,!0,!0))}),!("dp"in e))throw new Error('Absent mandatory parameter "dp"');if(this.exponent1=new n.m({valueHex:Object(i.j)(Object(i.e)(e.dp,!0,!0))}),!("dq"in e))throw new Error('Absent mandatory parameter "dq"');if(this.exponent2=new n.m({valueHex:Object(i.j)(Object(i.e)(e.dq,!0,!0))}),!("qi"in e))throw new Error('Absent mandatory parameter "qi"');this.coefficient=new n.m({valueHex:Object(i.j)(Object(i.e)(e.qi,!0,!0))}),"oth"in e&&(this.otherPrimeInfos=Array.from(e.oth,(e=>new s.a({json:e}))))}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),i=r(1),s=r(2);class a{constructor(e={}){this.keyDerivationFunc=Object(i.f)(e,"keyDerivationFunc",a.defaultValues("keyDerivationFunc")),this.encryptionScheme=Object(i.f)(e,"encryptionScheme",a.defaultValues("encryptionScheme")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"keyDerivationFunc":case"encryptionScheme":return new s.a;default:throw new Error(`Invalid member name for PBES2Params class: ${e}`)}}static schema(e={}){const t=Object(i.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[s.a.schema(t.keyDerivationFunc||{}),s.a.schema(t.encryptionScheme||{})]})}fromSchema(e){Object(i.d)(e,["keyDerivationFunc","encryptionScheme"]);const t=n.D(e,e,a.schema({names:{keyDerivationFunc:{names:{blockName:"keyDerivationFunc"}},encryptionScheme:{names:{blockName:"encryptionScheme"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PBES2Params");this.keyDerivationFunc=new s.a({schema:t.result.keyDerivationFunc}),this.encryptionScheme=new s.a({schema:t.result.encryptionScheme})}toSchema(){return new n.v({value:[this.keyDerivationFunc.toSchema(),this.encryptionScheme.toSchema()]})}toJSON(){return{keyDerivationFunc:this.keyDerivationFunc.toJSON(),encryptionScheme:this.encryptionScheme.toJSON()}}}},function(e,t,r){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,a,o=arguments.length;switch(o){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,n)}));case 4:return t.nextTick((function(){e.call(null,r,n,i)}));default:for(s=new Array(o-1),a=0;a<s.length;)s[a++]=arguments[a];return t.nextTick((function(){e.apply(null,s)}))}}}:e.exports=t}).call(this,r(14))},function(e,t,r){"use strict";(function(t){const n=r(18),i=r(102),s=r(39),a=r(26),o=r(20),u=r(15).BigNumber,c=r(27),l=r(17),h=l.MT,f=l.NUMBYTES,d=(l.SIMPLE,l.SYMS),m=o.bigIntize(l.BI),p=l.BN,b=Symbol("count"),g=(Symbol("pending_key"),Symbol("major type")),y=Symbol("error"),v=Symbol("not found");function w(e,t,r){const n=[];return n[b]=r,n[d.PARENT]=e,n[g]=t,n}function _(e,t){const r=new c;return r[b]=-1,r[d.PARENT]=e,r[g]=t,r}function A(e){return o.bufferToBigInt(e)}function S(e){return m.MINUS_ONE-o.bufferToBigInt(e)}class B extends i{constructor(e){const t=(e=e||{}).tags;delete e.tags;const r=null!=e.max_depth?e.max_depth:-1;delete e.max_depth;const n=!!o.hasBigInt&&!!e.bigint;delete e.bigint,super(e),this.running=!0,this.max_depth=r,this.tags=t,n&&(null==this.tags&&(this.tags={}),null==this.tags[2]&&(this.tags[2]=A),null==this.tags[3]&&(this.tags[3]=S))}static nullcheck(e){switch(e){case d.NULL:return null;case d.UNDEFINED:return;case v:throw new Error("Value not found");default:return e}}static decodeFirstSync(e,t){let r,i={};switch(typeof(t=t||{encoding:"hex"})){case"string":r=t;break;case"object":i=o.extend({},t),r=i.encoding,delete i.encoding}const s=new B(i),a=e instanceof n.Readable?e:new c(e,null!=r?r:o.guessEncoding(e)),u=s._parse();let l=u.next();for(;!l.done;){const e=a.read(l.value);if(null==e||e.length!==l.value)throw new Error("Insufficient data");l=u.next(e)}const h=B.nullcheck(l.value);if(a.length>0){const e=a.read(1);a.unshift(e);const t=new Error("Unexpected data: 0x"+e[0].toString(16));throw t.value=h,t}return h}static decodeAllSync(e,t){let r,i={};switch(typeof(t=t||{encoding:"hex"})){case"string":r=t;break;case"object":i=o.extend({},t),r=i.encoding,delete i.encoding}const s=new B(i),a=e instanceof n.Readable?e:new c(e,null!=r?r:o.guessEncoding(e)),u=[];for(;a.length>0;){const e=s._parse();let t=e.next();for(;!t.done;){const r=a.read(t.value);if(null==r||r.length!==t.value)throw new Error("Insufficient data");t=e.next(r)}u.push(B.nullcheck(t.value))}return u}static decodeFirst(e,t,r){let n={},i=!1,s="hex";switch(typeof t){case"function":r=t,s=o.guessEncoding(e);break;case"string":s=t;break;case"object":n=o.extend({},t),s=null!=n.encoding?n.encoding:o.guessEncoding(e),delete n.encoding,i=null!=n.required&&n.required,delete n.required}const a=new B(n);let u=v;const c=new Promise(((e,t)=>{a.on("data",(e=>{u=B.nullcheck(e),a.close()})),a.once("error",(e=>(u!==v&&(e.value=u),u=y,a.close(),t(e)))),a.once("end",(()=>{switch(u){case v:return i?t(new Error("No CBOR found")):e(u);case y:return;default:return e(u)}}))}));return"function"==typeof r&&c.then((e=>r(null,e)),r),a.end(e,s),c}static decodeAll(e,t,r){let n={},i="hex";switch(typeof t){case"function":r=t,i=o.guessEncoding(e);break;case"string":i=t;break;case"object":n=o.extend({},t),i=null!=n.encoding?n.encoding:o.guessEncoding(e),delete n.encoding}const s=new B(n),a=[];s.on("data",(e=>a.push(B.nullcheck(e))));const u=new Promise(((e,t)=>{s.on("error",t),s.on("end",(()=>e(a)))}));return"function"==typeof r&&u.then((e=>r(null,e)),r),s.end(e,i),u}close(){this.running=!1,this.__fresh=!0}*_parse(){let e=null,r=0,n=null;for(;;){if(this.max_depth>=0&&r>this.max_depth)throw new Error("Maximum depth "+this.max_depth+" exceeded");const i=(yield 1)[0];if(!this.running)throw new Error("Unexpected data: 0x"+i.toString(16));const l=i>>5,m=31&i,y=null!=e?e[g]:void 0,v=null!=e?e.length:void 0;switch(m){case f.ONE:this.emit("more-bytes",l,1,y,v),n=(yield 1)[0];break;case f.TWO:case f.FOUR:case f.EIGHT:const e=1<<m-24;this.emit("more-bytes",l,e,y,v);const t=yield e;n=l===h.SIMPLE_FLOAT?t:o.parseCBORint(m,t);break;case 28:case 29:case 30:throw this.running=!1,new Error("Additional info not implemented: "+m);case f.INDEFINITE:switch(l){case h.POS_INT:case h.NEG_INT:case h.TAG:throw new Error(`Invalid indefinite encoding for MT ${l}`)}n=-1;break;default:n=m}switch(l){case h.POS_INT:break;case h.NEG_INT:n=n===Number.MAX_SAFE_INTEGER?p.NEG_MAX:n instanceof u?p.MINUS_ONE.minus(n):-1-n;break;case h.BYTE_STRING:case h.UTF8_STRING:switch(n){case 0:this.emit("start-string",l,n,y,v),n=l===h.BYTE_STRING?t.allocUnsafe(0):"";break;case-1:this.emit("start",l,d.STREAM,y,v),e=_(e,l),r++;continue;default:this.emit("start-string",l,n,y,v),n=yield n,l===h.UTF8_STRING&&(n=o.utf8(n))}break;case h.ARRAY:case h.MAP:switch(n){case 0:n=l===h.MAP?{}:[];break;case-1:this.emit("start",l,d.STREAM,y,v),e=w(e,l,-1),r++;continue;default:this.emit("start",l,n,y,v),e=w(e,l,n*(l-3)),r++;continue}break;case h.TAG:this.emit("start",l,n,y,v),e=w(e,l,1),e.push(n),r++;continue;case h.SIMPLE_FLOAT:if("number"==typeof n){if(m===f.ONE&&n<32)throw new Error(`Invalid two-byte encoding of simple value ${n}`);const t=null!=e;n=a.decode(n,t,t&&e[b]<0)}else n=o.parseCBORfloat(n)}this.emit("value",n,y,v,m);let A=!1;for(;null!=e;){switch(!1){case n!==d.BREAK:e[b]=1;break;case!Array.isArray(e):e.push(n);break;case!(e instanceof c):const t=e[g];if(null!=t&&t!==l)throw this.running=!1,new Error("Invalid major type in indefinite encoding");e.write(n)}if(0!=--e[b]){A=!0;break}if(--r,delete e[b],Array.isArray(e))switch(e[g]){case h.ARRAY:n=e;break;case h.MAP:let t=!0;if(e.length%2!=0)throw new Error("Invalid map length: "+e.length);for(let r=0,n=e.length;r<n;r+=2)if("string"!=typeof e[r]){t=!1;break}if(t){n={};for(let t=0,r=e.length;t<r;t+=2)n[e[t]]=e[t+1]}else{n=new Map;for(let t=0,r=e.length;t<r;t+=2)n.set(e[t],e[t+1])}break;case h.TAG:n=new s(e[0],e[1]).convert(this.tags)}else if(e instanceof c)switch(e[g]){case h.BYTE_STRING:n=e.slice();break;case h.UTF8_STRING:n=e.toString("utf-8")}this.emit("stop",e[g]);const t=e;e=e[d.PARENT],delete t[d.PARENT],delete t[g]}if(!A)return n}}}B.NOT_FOUND=v,e.exports=B}).call(this,r(6).Buffer)},function(e,t,r){"use strict";r.d(t,"a",(function(){return m}));var n=r(0),i=r(1),s=r(3),a=r(7),o=r(11),u=r(2),c=r(5),l=r(22),h=r(13),f=r(31);function d(e,t,r,n,i,s){let a,o;const u=[];switch(t.toUpperCase()){case"SHA-1":a=20,o=64;break;case"SHA-256":a=32,o=64;break;case"SHA-384":a=48,o=128;break;case"SHA-512":a=64,o=128;break;default:throw new Error("Unsupported hashing algorithm")}const c=new Uint8Array(n),l=new ArrayBuffer(2*n.byteLength+2),h=new Uint8Array(l);for(let e=0;e<c.length;e++)h[2*e]=0,h[2*e+1]=c[e];h[h.length-2]=0,h[h.length-1]=0,n=l.slice(0);const f=new ArrayBuffer(o),d=new Uint8Array(f);for(let e=0;e<f.byteLength;e++)d[e]=3;const m=i.byteLength,p=o*Math.ceil(m/o),b=new ArrayBuffer(p),g=new Uint8Array(b),y=new Uint8Array(i);for(let e=0;e<p;e++)g[e]=y[e%m];const v=n.byteLength,w=o*Math.ceil(v/o),_=new ArrayBuffer(w),A=new Uint8Array(_),S=new Uint8Array(n);for(let e=0;e<w;e++)A[e]=S[e%v];const B=b.byteLength+_.byteLength;let k=new ArrayBuffer(B),E=new Uint8Array(k);E.set(g),E.set(A,g.length);const O=Math.ceil((r>>3)/a);let N=Promise.resolve(k);for(let r=0;r<=O;r++){N=N.then((e=>{const t=new ArrayBuffer(f.byteLength+e.byteLength),r=new Uint8Array(t);return r.set(d),r.set(E,d.length),t}));for(let r=0;r<s;r++)N=N.then((r=>e.digest({name:t},new Uint8Array(r))));N=N.then((e=>{const t=new ArrayBuffer(o),r=new Uint8Array(t);for(let n=0;n<t.byteLength;n++)r[n]=e[n%e.length];const n=Math.ceil(m/o)+Math.ceil(v/o),i=[];let s=0,a=o;for(let e=0;e<n;e++){const e=Array.from(new Uint8Array(k.slice(s,s+a)));s+=o,s+o>k.byteLength&&(a=k.byteLength-s);let n=511;for(let i=t.byteLength-1;i>=0;i--)n>>=8,n+=r[i]+e[i],e[i]=255&n;i.push(...e)}return k=new ArrayBuffer(i.length),E=new Uint8Array(k),E.set(i),u.push(...new Uint8Array(e)),k}))}return N=N.then((()=>{const e=new ArrayBuffer(r>>3);return new Uint8Array(e).set(new Uint8Array(u).slice(0,r>>3)),e})),N}class m{constructor(e={}){this.crypto=Object(i.f)(e,"crypto",{}),this.subtle=Object(i.f)(e,"subtle",{}),this.name=Object(i.f)(e,"name","")}importKey(e,t,r,s,u){let c={};switch(t instanceof Uint8Array&&(t=t.buffer),e.toLowerCase()){case"raw":return this.subtle.importKey("raw",t,r,s,u);case"spki":{const e=n.E(t);if(-1===e.offset)return Promise.reject("Incorrect keyData");const i=new a.a;try{i.fromSchema(e.result)}catch(e){return Promise.reject("Incorrect keyData")}switch(r.name.toUpperCase()){case"RSA-PSS":switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="PS1";break;case"SHA-256":c.alg="PS256";break;case"SHA-384":c.alg="PS384";break;case"SHA-512":c.alg="PS512";break;default:return Promise.reject(`Incorrect hash algorithm: ${r.hash.name.toUpperCase()}`)}case"RSASSA-PKCS1-V1_5":{if(u=["verify"],c.kty="RSA",c.ext=s,c.key_ops=u,"1.2.840.113549.1.1.1"!==i.algorithm.algorithmId)return Promise.reject(`Incorrect public key algorithm: ${i.algorithm.algorithmId}`);if("alg"in c==!1)switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="RS1";break;case"SHA-256":c.alg="RS256";break;case"SHA-384":c.alg="RS384";break;case"SHA-512":c.alg="RS512";break;default:return Promise.reject(`Incorrect hash algorithm: ${r.hash.name.toUpperCase()}`)}const e=i.toJSON();for(const t of Object.keys(e))c[t]=e[t]}break;case"ECDSA":u=["verify"];case"ECDH":{if(c={kty:"EC",ext:s,key_ops:u},"1.2.840.10045.2.1"!==i.algorithm.algorithmId)return Promise.reject(`Incorrect public key algorithm: ${i.algorithm.algorithmId}`);const e=i.toJSON();for(const t of Object.keys(e))c[t]=e[t]}break;case"RSA-OAEP":{if(c.kty="RSA",c.ext=s,c.key_ops=u,"safari"===this.name.toLowerCase())c.alg="RSA-OAEP";else switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="RSA-OAEP";break;case"SHA-256":c.alg="RSA-OAEP-256";break;case"SHA-384":c.alg="RSA-OAEP-384";break;case"SHA-512":c.alg="RSA-OAEP-512";break;default:return Promise.reject(`Incorrect hash algorithm: ${r.hash.name.toUpperCase()}`)}const e=i.toJSON();for(const t of Object.keys(e))c[t]=e[t]}break;default:return Promise.reject(`Incorrect algorithm name: ${r.name.toUpperCase()}`)}}break;case"pkcs8":{const e=new o.a,i=n.E(t);if(-1===i.offset)return Promise.reject("Incorrect keyData");try{e.fromSchema(i.result)}catch(e){return Promise.reject("Incorrect keyData")}if("parsedKey"in e==!1)return Promise.reject("Incorrect keyData");switch(r.name.toUpperCase()){case"RSA-PSS":switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="PS1";break;case"SHA-256":c.alg="PS256";break;case"SHA-384":c.alg="PS384";break;case"SHA-512":c.alg="PS512";break;default:return Promise.reject(`Incorrect hash algorithm: ${r.hash.name.toUpperCase()}`)}case"RSASSA-PKCS1-V1_5":{if(u=["sign"],c.kty="RSA",c.ext=s,c.key_ops=u,"1.2.840.113549.1.1.1"!==e.privateKeyAlgorithm.algorithmId)return Promise.reject(`Incorrect private key algorithm: ${e.privateKeyAlgorithm.algorithmId}`);if("alg"in c==!1)switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="RS1";break;case"SHA-256":c.alg="RS256";break;case"SHA-384":c.alg="RS384";break;case"SHA-512":c.alg="RS512";break;default:return Promise.reject(`Incorrect hash algorithm: ${r.hash.name.toUpperCase()}`)}const t=e.toJSON();for(const e of Object.keys(t))c[e]=t[e]}break;case"ECDSA":u=["sign"];case"ECDH":{if(c={kty:"EC",ext:s,key_ops:u},"1.2.840.10045.2.1"!==e.privateKeyAlgorithm.algorithmId)return Promise.reject(`Incorrect algorithm: ${e.privateKeyAlgorithm.algorithmId}`);const t=e.toJSON();for(const e of Object.keys(t))c[e]=t[e]}break;case"RSA-OAEP":{if(c.kty="RSA",c.ext=s,c.key_ops=u,"safari"===this.name.toLowerCase())c.alg="RSA-OAEP";else switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="RSA-OAEP";break;case"SHA-256":c.alg="RSA-OAEP-256";break;case"SHA-384":c.alg="RSA-OAEP-384";break;case"SHA-512":c.alg="RSA-OAEP-512";break;default:return Promise.reject(`Incorrect hash algorithm: ${r.hash.name.toUpperCase()}`)}const t=e.toJSON();for(const e of Object.keys(t))c[e]=t[e]}break;default:return Promise.reject(`Incorrect algorithm name: ${r.name.toUpperCase()}`)}}break;case"jwk":c=t;break;default:return Promise.reject(`Incorrect format: ${e}`)}return"safari"===this.name.toLowerCase()?Promise.resolve().then((()=>this.subtle.importKey("jwk",Object(i.j)(JSON.stringify(c)),r,s,u))).then((e=>e),(()=>this.subtle.importKey("jwk",c,r,s,u))):this.subtle.importKey("jwk",c,r,s,u)}exportKey(e,t){let r=this.subtle.exportKey("jwk",t);switch("safari"===this.name.toLowerCase()&&(r=r.then((e=>e instanceof ArrayBuffer?JSON.parse(Object(i.a)(e)):e))),e.toLowerCase()){case"raw":return this.subtle.exportKey("raw",t);case"spki":r=r.then((e=>{const t=new a.a;try{t.fromJSON(e)}catch(e){return Promise.reject("Incorrect key data")}return t.toSchema().toBER(!1)}));break;case"pkcs8":r=r.then((e=>{const t=new o.a;try{t.fromJSON(e)}catch(e){return Promise.reject("Incorrect key data")}return t.toSchema().toBER(!1)}));break;case"jwk":break;default:return Promise.reject(`Incorrect format: ${e}`)}return r}convert(e,t,r,n,i,s){switch(e.toLowerCase()){case"raw":switch(t.toLowerCase()){case"raw":return Promise.resolve(r);case"spki":return Promise.resolve().then((()=>this.importKey("raw",r,n,i,s))).then((e=>this.exportKey("spki",e)));case"pkcs8":return Promise.resolve().then((()=>this.importKey("raw",r,n,i,s))).then((e=>this.exportKey("pkcs8",e)));case"jwk":return Promise.resolve().then((()=>this.importKey("raw",r,n,i,s))).then((e=>this.exportKey("jwk",e)));default:return Promise.reject(`Incorrect outputFormat: ${t}`)}case"spki":switch(t.toLowerCase()){case"raw":return Promise.resolve().then((()=>this.importKey("spki",r,n,i,s))).then((e=>this.exportKey("raw",e)));case"spki":return Promise.resolve(r);case"pkcs8":return Promise.reject("Impossible to convert between SPKI/PKCS8");case"jwk":return Promise.resolve().then((()=>this.importKey("spki",r,n,i,s))).then((e=>this.exportKey("jwk",e)));default:return Promise.reject(`Incorrect outputFormat: ${t}`)}case"pkcs8":switch(t.toLowerCase()){case"raw":return Promise.resolve().then((()=>this.importKey("pkcs8",r,n,i,s))).then((e=>this.exportKey("raw",e)));case"spki":return Promise.reject("Impossible to convert between SPKI/PKCS8");case"pkcs8":return Promise.resolve(r);case"jwk":return Promise.resolve().then((()=>this.importKey("pkcs8",r,n,i,s))).then((e=>this.exportKey("jwk",e)));default:return Promise.reject(`Incorrect outputFormat: ${t}`)}case"jwk":switch(t.toLowerCase()){case"raw":return Promise.resolve().then((()=>this.importKey("jwk",r,n,i,s))).then((e=>this.exportKey("raw",e)));case"spki":return Promise.resolve().then((()=>this.importKey("jwk",r,n,i,s))).then((e=>this.exportKey("spki",e)));case"pkcs8":return Promise.resolve().then((()=>this.importKey("jwk",r,n,i,s))).then((e=>this.exportKey("pkcs8",e)));case"jwk":return Promise.resolve(r);default:return Promise.reject(`Incorrect outputFormat: ${t}`)}default:return Promise.reject(`Incorrect inputFormat: ${e}`)}}encrypt(...e){return this.subtle.encrypt(...e)}decrypt(...e){return this.subtle.decrypt(...e)}sign(...e){return this.subtle.sign(...e)}verify(...e){return this.subtle.verify(...e)}digest(...e){return this.subtle.digest(...e)}generateKey(...e){return this.subtle.generateKey(...e)}deriveKey(...e){return this.subtle.deriveKey(...e)}deriveBits(...e){return this.subtle.deriveBits(...e)}wrapKey(...e){return this.subtle.wrapKey(...e)}unwrapKey(...e){return this.subtle.unwrapKey(...e)}getRandomValues(e){if("getRandomValues"in this.crypto==!1)throw new Error("No support for getRandomValues");return this.crypto.getRandomValues(e)}getAlgorithmByOID(e){switch(e){case"1.2.840.113549.1.1.1":case"1.2.840.113549.1.1.5":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case"1.2.840.113549.1.1.11":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"1.2.840.113549.1.1.12":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"1.2.840.113549.1.1.13":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"1.2.840.113549.1.1.10":return{name:"RSA-PSS"};case"1.2.840.113549.1.1.7":return{name:"RSA-OAEP"};case"1.2.840.10045.2.1":case"1.2.840.10045.4.1":return{name:"ECDSA",hash:{name:"SHA-1"}};case"1.2.840.10045.4.3.2":return{name:"ECDSA",hash:{name:"SHA-256"}};case"1.2.840.10045.4.3.3":return{name:"ECDSA",hash:{name:"SHA-384"}};case"1.2.840.10045.4.3.4":return{name:"ECDSA",hash:{name:"SHA-512"}};case"1.3.133.16.840.63.0.2":return{name:"ECDH",kdf:"SHA-1"};case"1.3.132.1.11.1":return{name:"ECDH",kdf:"SHA-256"};case"1.3.132.1.11.2":return{name:"ECDH",kdf:"SHA-384"};case"1.3.132.1.11.3":return{name:"ECDH",kdf:"SHA-512"};case"2.16.840.1.101.3.4.1.2":return{name:"AES-CBC",length:128};case"2.16.840.1.101.3.4.1.22":return{name:"AES-CBC",length:192};case"2.16.840.1.101.3.4.1.42":return{name:"AES-CBC",length:256};case"2.16.840.1.101.3.4.1.6":return{name:"AES-GCM",length:128};case"2.16.840.1.101.3.4.1.26":return{name:"AES-GCM",length:192};case"2.16.840.1.101.3.4.1.46":return{name:"AES-GCM",length:256};case"2.16.840.1.101.3.4.1.4":return{name:"AES-CFB",length:128};case"2.16.840.1.101.3.4.1.24":return{name:"AES-CFB",length:192};case"2.16.840.1.101.3.4.1.44":return{name:"AES-CFB",length:256};case"2.16.840.1.101.3.4.1.5":return{name:"AES-KW",length:128};case"2.16.840.1.101.3.4.1.25":return{name:"AES-KW",length:192};case"2.16.840.1.101.3.4.1.45":return{name:"AES-KW",length:256};case"1.2.840.113549.2.7":return{name:"HMAC",hash:{name:"SHA-1"}};case"1.2.840.113549.2.9":return{name:"HMAC",hash:{name:"SHA-256"}};case"1.2.840.113549.2.10":return{name:"HMAC",hash:{name:"SHA-384"}};case"1.2.840.113549.2.11":return{name:"HMAC",hash:{name:"SHA-512"}};case"1.2.840.113549.1.9.16.3.5":return{name:"DH"};case"1.3.14.3.2.26":return{name:"SHA-1"};case"2.16.840.1.101.3.4.2.1":return{name:"SHA-256"};case"2.16.840.1.101.3.4.2.2":return{name:"SHA-384"};case"2.16.840.1.101.3.4.2.3":return{name:"SHA-512"};case"1.2.840.113549.1.5.12":return{name:"PBKDF2"};case"1.2.840.10045.3.1.7":return{name:"P-256"};case"1.3.132.0.34":return{name:"P-384"};case"1.3.132.0.35":return{name:"P-521"}}return{}}getOIDByAlgorithm(e){let t="";switch(e.name.toUpperCase()){case"RSASSA-PKCS1-V1_5":switch(e.hash.name.toUpperCase()){case"SHA-1":t="1.2.840.113549.1.1.5";break;case"SHA-256":t="1.2.840.113549.1.1.11";break;case"SHA-384":t="1.2.840.113549.1.1.12";break;case"SHA-512":t="1.2.840.113549.1.1.13"}break;case"RSA-PSS":t="1.2.840.113549.1.1.10";break;case"RSA-OAEP":t="1.2.840.113549.1.1.7";break;case"ECDSA":switch(e.hash.name.toUpperCase()){case"SHA-1":t="1.2.840.10045.4.1";break;case"SHA-256":t="1.2.840.10045.4.3.2";break;case"SHA-384":t="1.2.840.10045.4.3.3";break;case"SHA-512":t="1.2.840.10045.4.3.4"}break;case"ECDH":switch(e.kdf.toUpperCase()){case"SHA-1":t="1.3.133.16.840.63.0.2";break;case"SHA-256":t="1.3.132.1.11.1";break;case"SHA-384":t="1.3.132.1.11.2";break;case"SHA-512":t="1.3.132.1.11.3"}break;case"AES-CTR":break;case"AES-CBC":switch(e.length){case 128:t="2.16.840.1.101.3.4.1.2";break;case 192:t="2.16.840.1.101.3.4.1.22";break;case 256:t="2.16.840.1.101.3.4.1.42"}break;case"AES-CMAC":break;case"AES-GCM":switch(e.length){case 128:t="2.16.840.1.101.3.4.1.6";break;case 192:t="2.16.840.1.101.3.4.1.26";break;case 256:t="2.16.840.1.101.3.4.1.46"}break;case"AES-CFB":switch(e.length){case 128:t="2.16.840.1.101.3.4.1.4";break;case 192:t="2.16.840.1.101.3.4.1.24";break;case 256:t="2.16.840.1.101.3.4.1.44"}break;case"AES-KW":switch(e.length){case 128:t="2.16.840.1.101.3.4.1.5";break;case 192:t="2.16.840.1.101.3.4.1.25";break;case 256:t="2.16.840.1.101.3.4.1.45"}break;case"HMAC":switch(e.hash.name.toUpperCase()){case"SHA-1":t="1.2.840.113549.2.7";break;case"SHA-256":t="1.2.840.113549.2.9";break;case"SHA-384":t="1.2.840.113549.2.10";break;case"SHA-512":t="1.2.840.113549.2.11"}break;case"DH":t="1.2.840.113549.1.9.16.3.5";break;case"SHA-1":t="1.3.14.3.2.26";break;case"SHA-256":t="2.16.840.1.101.3.4.2.1";break;case"SHA-384":t="2.16.840.1.101.3.4.2.2";break;case"SHA-512":t="2.16.840.1.101.3.4.2.3";break;case"CONCAT":case"HKDF":break;case"PBKDF2":t="1.2.840.113549.1.5.12";break;case"P-256":t="1.2.840.10045.3.1.7";break;case"P-384":t="1.3.132.0.34";break;case"P-521":t="1.3.132.0.35"}return t}getAlgorithmParameters(e,t){let r={algorithm:{},usages:[]};switch(e.toUpperCase()){case"RSASSA-PKCS1-V1_5":switch(t.toLowerCase()){case"generatekey":r={algorithm:{name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},usages:["sign","verify"]};break;case"verify":case"sign":case"importkey":r={algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},usages:["verify"]};break;case"exportkey":default:return{algorithm:{name:"RSASSA-PKCS1-v1_5"},usages:[]}}break;case"RSA-PSS":switch(t.toLowerCase()){case"sign":case"verify":r={algorithm:{name:"RSA-PSS",hash:{name:"SHA-1"},saltLength:20},usages:["sign","verify"]};break;case"generatekey":r={algorithm:{name:"RSA-PSS",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-1"}},usages:["sign","verify"]};break;case"importkey":r={algorithm:{name:"RSA-PSS",hash:{name:"SHA-1"}},usages:["verify"]};break;case"exportkey":default:return{algorithm:{name:"RSA-PSS"},usages:[]}}break;case"RSA-OAEP":switch(t.toLowerCase()){case"encrypt":case"decrypt":r={algorithm:{name:"RSA-OAEP"},usages:["encrypt","decrypt"]};break;case"generatekey":r={algorithm:{name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"importkey":r={algorithm:{name:"RSA-OAEP",hash:{name:"SHA-256"}},usages:["encrypt"]};break;case"exportkey":default:return{algorithm:{name:"RSA-OAEP"},usages:[]}}break;case"ECDSA":switch(t.toLowerCase()){case"generatekey":r={algorithm:{name:"ECDSA",namedCurve:"P-256"},usages:["sign","verify"]};break;case"importkey":r={algorithm:{name:"ECDSA",namedCurve:"P-256"},usages:["verify"]};break;case"verify":case"sign":r={algorithm:{name:"ECDSA",hash:{name:"SHA-256"}},usages:["sign"]};break;default:return{algorithm:{name:"ECDSA"},usages:[]}}break;case"ECDH":switch(t.toLowerCase()){case"exportkey":case"importkey":case"generatekey":r={algorithm:{name:"ECDH",namedCurve:"P-256"},usages:["deriveKey","deriveBits"]};break;case"derivekey":case"derivebits":r={algorithm:{name:"ECDH",namedCurve:"P-256",public:[]},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"ECDH"},usages:[]}}break;case"AES-CTR":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":r={algorithm:{name:"AES-CTR",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":r={algorithm:{name:"AES-CTR",counter:new Uint8Array(16),length:10},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-CTR"},usages:[]}}break;case"AES-CBC":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":r={algorithm:{name:"AES-CBC",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":r={algorithm:{name:"AES-CBC",iv:this.getRandomValues(new Uint8Array(16))},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-CBC"},usages:[]}}break;case"AES-GCM":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":r={algorithm:{name:"AES-GCM",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":r={algorithm:{name:"AES-GCM",iv:this.getRandomValues(new Uint8Array(16))},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-GCM"},usages:[]}}break;case"AES-KW":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":case"wrapkey":case"unwrapkey":r={algorithm:{name:"AES-KW",length:256},usages:["wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-KW"},usages:[]}}break;case"HMAC":switch(t.toLowerCase()){case"sign":case"verify":r={algorithm:{name:"HMAC"},usages:["sign","verify"]};break;case"importkey":case"exportkey":case"generatekey":r={algorithm:{name:"HMAC",length:32,hash:{name:"SHA-256"}},usages:["sign","verify"]};break;default:return{algorithm:{name:"HMAC"},usages:[]}}break;case"HKDF":switch(t.toLowerCase()){case"derivekey":r={algorithm:{name:"HKDF",hash:"SHA-256",salt:new Uint8Array([]),info:new Uint8Array([])},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"HKDF"},usages:[]}}break;case"PBKDF2":switch(t.toLowerCase()){case"derivekey":r={algorithm:{name:"PBKDF2",hash:{name:"SHA-256"},salt:new Uint8Array([]),iterations:1e4},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"PBKDF2"},usages:[]}}}return r}getHashAlgorithm(e){let t="";switch(e.algorithmId){case"1.2.840.10045.4.1":case"1.2.840.113549.1.1.5":t="SHA-1";break;case"1.2.840.10045.4.3.2":case"1.2.840.113549.1.1.11":t="SHA-256";break;case"1.2.840.10045.4.3.3":case"1.2.840.113549.1.1.12":t="SHA-384";break;case"1.2.840.10045.4.3.4":case"1.2.840.113549.1.1.13":t="SHA-512";break;case"1.2.840.113549.1.1.10":try{const r=new l.a({schema:e.algorithmParams});if("hashAlgorithm"in r){const e=this.getAlgorithmByOID(r.hashAlgorithm.algorithmId);if("name"in e==!1)return"";t=e.name}else t="SHA-1"}catch(e){}}return t}encryptEncryptedContentInfo(e){if(e instanceof Object==!1)return Promise.reject('Parameters must have type "Object"');if("password"in e==!1)return Promise.reject('Absent mandatory parameter "password"');if("contentEncryptionAlgorithm"in e==!1)return Promise.reject('Absent mandatory parameter "contentEncryptionAlgorithm"');if("hmacHashAlgorithm"in e==!1)return Promise.reject('Absent mandatory parameter "hmacHashAlgorithm"');if("iterationCount"in e==!1)return Promise.reject('Absent mandatory parameter "iterationCount"');if("contentToEncrypt"in e==!1)return Promise.reject('Absent mandatory parameter "contentToEncrypt"');if("contentType"in e==!1)return Promise.reject('Absent mandatory parameter "contentType"');const t=this.getOIDByAlgorithm(e.contentEncryptionAlgorithm);if(""===t)return Promise.reject('Wrong "contentEncryptionAlgorithm" value');const r=this.getOIDByAlgorithm({name:"PBKDF2"});if(""===r)return Promise.reject("Can not find OID for PBKDF2");const i=this.getOIDByAlgorithm({name:"HMAC",hash:{name:e.hmacHashAlgorithm}});if(""===i)return Promise.reject(`Incorrect value for "hmacHashAlgorithm": ${e.hmacHashAlgorithm}`);let s=Promise.resolve();const a=new ArrayBuffer(16),o=new Uint8Array(a);this.getRandomValues(o);const l=new ArrayBuffer(64),d=new Uint8Array(l);this.getRandomValues(d);const m=new Uint8Array(e.contentToEncrypt),p=new h.a({salt:new n.q({valueHex:l}),iterationCount:e.iterationCount,prf:new u.a({algorithmId:i,algorithmParams:new n.n})});return s=s.then((()=>{const t=new Uint8Array(e.password);return this.importKey("raw",t,"PBKDF2",!1,["deriveKey"])}),(e=>Promise.reject(e))),s=s.then((t=>this.deriveKey({name:"PBKDF2",hash:{name:e.hmacHashAlgorithm},salt:d,iterations:e.iterationCount},t,e.contentEncryptionAlgorithm,!1,["encrypt"])),(e=>Promise.reject(e))),s=s.then((t=>this.encrypt({name:e.contentEncryptionAlgorithm.name,iv:o},t,m)),(e=>Promise.reject(e))),s=s.then((i=>{const s=new f.a({keyDerivationFunc:new u.a({algorithmId:r,algorithmParams:p.toSchema()}),encryptionScheme:new u.a({algorithmId:t,algorithmParams:new n.q({valueHex:a})})});return new c.a({contentType:e.contentType,contentEncryptionAlgorithm:new u.a({algorithmId:"1.2.840.113549.1.5.13",algorithmParams:s.toSchema()}),encryptedContent:new n.q({valueHex:i})})}),(e=>Promise.reject(e))),s}decryptEncryptedContentInfo(e){if(e instanceof Object==!1)return Promise.reject('Parameters must have type "Object"');if("password"in e==!1)return Promise.reject('Absent mandatory parameter "password"');if("encryptedContentInfo"in e==!1)return Promise.reject('Absent mandatory parameter "encryptedContentInfo"');if("1.2.840.113549.1.5.13"!==e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId)return Promise.reject(`Unknown "contentEncryptionAlgorithm": ${e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId}`);let t,r,n=Promise.resolve();try{t=new f.a({schema:e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams})}catch(e){return Promise.reject('Incorrectly encoded "pbes2Parameters"')}try{r=new h.a({schema:t.keyDerivationFunc.algorithmParams})}catch(e){return Promise.reject('Incorrectly encoded "pbkdf2Params"')}const s=this.getAlgorithmByOID(t.encryptionScheme.algorithmId);if("name"in s==!1)return Promise.reject(`Incorrect OID for "contentEncryptionAlgorithm": ${t.encryptionScheme.algorithmId}`);const a=t.encryptionScheme.algorithmParams.valueBlock.valueHex,o=new Uint8Array(a),u=r.salt.valueBlock.valueHex,c=new Uint8Array(u),l=r.iterationCount;let d="SHA-1";if("prf"in r){const e=this.getAlgorithmByOID(r.prf.algorithmId);if("name"in e==!1)return Promise.reject("Incorrect OID for HMAC hash algorithm");d=e.hash.name}return n=n.then((()=>this.importKey("raw",e.password,"PBKDF2",!1,["deriveKey"])),(e=>Promise.reject(e))),n=n.then((e=>this.deriveKey({name:"PBKDF2",hash:{name:d},salt:c,iterations:l},e,s,!1,["decrypt"])),(e=>Promise.reject(e))),n=n.then((t=>{let r=new ArrayBuffer(0);if(!1===e.encryptedContentInfo.encryptedContent.idBlock.isConstructed)r=e.encryptedContentInfo.encryptedContent.valueBlock.valueHex;else for(const t of e.encryptedContentInfo.encryptedContent.valueBlock.value)r=Object(i.l)(r,t.valueBlock.valueHex);return this.decrypt({name:s.name,iv:o},t,r)}),(e=>Promise.reject(e))),n}stampDataWithPassword(e){if(e instanceof Object==!1)return Promise.reject('Parameters must have type "Object"');if("password"in e==!1)return Promise.reject('Absent mandatory parameter "password"');if("hashAlgorithm"in e==!1)return Promise.reject('Absent mandatory parameter "hashAlgorithm"');if("salt"in e==!1)return Promise.reject('Absent mandatory parameter "iterationCount"');if("iterationCount"in e==!1)return Promise.reject('Absent mandatory parameter "salt"');if("contentToStamp"in e==!1)return Promise.reject('Absent mandatory parameter "contentToStamp"');let t;switch(e.hashAlgorithm.toLowerCase()){case"sha-1":t=160;break;case"sha-256":t=256;break;case"sha-384":t=384;break;case"sha-512":t=512;break;default:return Promise.reject(`Incorrect "parameters.hashAlgorithm" parameter: ${e.hashAlgorithm}`)}let r=Promise.resolve();const n={name:"HMAC",length:t,hash:{name:e.hashAlgorithm}};return r=r.then((()=>d(this,e.hashAlgorithm,t,e.password,e.salt,e.iterationCount))),r=r.then((e=>this.importKey("raw",new Uint8Array(e),n,!1,["sign"]))),r=r.then((t=>this.sign(n,t,new Uint8Array(e.contentToStamp))),(e=>Promise.reject(e))),r}verifyDataStampedWithPassword(e){if(e instanceof Object==!1)return Promise.reject('Parameters must have type "Object"');if("password"in e==!1)return Promise.reject('Absent mandatory parameter "password"');if("hashAlgorithm"in e==!1)return Promise.reject('Absent mandatory parameter "hashAlgorithm"');if("salt"in e==!1)return Promise.reject('Absent mandatory parameter "iterationCount"');if("iterationCount"in e==!1)return Promise.reject('Absent mandatory parameter "salt"');if("contentToVerify"in e==!1)return Promise.reject('Absent mandatory parameter "contentToVerify"');if("signatureToVerify"in e==!1)return Promise.reject('Absent mandatory parameter "signatureToVerify"');let t;switch(e.hashAlgorithm.toLowerCase()){case"sha-1":t=160;break;case"sha-256":t=256;break;case"sha-384":t=384;break;case"sha-512":t=512;break;default:return Promise.reject(`Incorrect "parameters.hashAlgorithm" parameter: ${e.hashAlgorithm}`)}let r=Promise.resolve();const n={name:"HMAC",length:t,hash:{name:e.hashAlgorithm}};return r=r.then((()=>d(this,e.hashAlgorithm,t,e.password,e.salt,e.iterationCount))),r=r.then((e=>this.importKey("raw",new Uint8Array(e),n,!1,["verify"]))),r=r.then((t=>this.verify(n,t,new Uint8Array(e.signatureToVerify),new Uint8Array(e.contentToVerify))),(e=>Promise.reject(e))),r}getSignatureParameters(e,t="SHA-1"){if(""===this.getOIDByAlgorithm({name:t}))return Promise.reject(`Unsupported hash algorithm: ${t}`);const r=new u.a,i=this.getAlgorithmParameters(e.algorithm.name,"sign");switch(i.algorithm.hash.name=t,e.algorithm.name.toUpperCase()){case"RSASSA-PKCS1-V1_5":case"ECDSA":r.algorithmId=this.getOIDByAlgorithm(i.algorithm);break;case"RSA-PSS":{switch(t.toUpperCase()){case"SHA-256":i.algorithm.saltLength=32;break;case"SHA-384":i.algorithm.saltLength=48;break;case"SHA-512":i.algorithm.saltLength=64}const e={};if("SHA-1"!==t.toUpperCase()){const r=this.getOIDByAlgorithm({name:t});if(""===r)return Promise.reject(`Unsupported hash algorithm: ${t}`);e.hashAlgorithm=new u.a({algorithmId:r,algorithmParams:new n.n}),e.maskGenAlgorithm=new u.a({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:e.hashAlgorithm.toSchema()})}20!==i.algorithm.saltLength&&(e.saltLength=i.algorithm.saltLength);const s=new l.a(e);r.algorithmId="1.2.840.113549.1.1.10",r.algorithmParams=s.toSchema()}break;default:return Promise.reject(`Unsupported signature algorithm: ${e.algorithm.name}`)}return Promise.resolve().then((()=>({signatureAlgorithm:r,parameters:i})))}signWithPrivateKey(e,t,r){return this.sign(r.algorithm,t,new Uint8Array(e)).then((e=>("ECDSA"===r.algorithm.name&&(e=Object(s.a)(e)),e)),(e=>Promise.reject(`Signing error: ${e}`)))}fillPublicKeyParameters(e,t){const r={},n=this.getHashAlgorithm(t);if(""===n)return Promise.reject(`Unsupported signature algorithm: ${t.algorithmId}`);let i;i="1.2.840.113549.1.1.10"===t.algorithmId?t.algorithmId:e.algorithm.algorithmId;const s=this.getAlgorithmByOID(i);if("name"in s==="")return Promise.reject(`Unsupported public key algorithm: ${t.algorithmId}`);if(r.algorithm=this.getAlgorithmParameters(s.name,"importkey"),"hash"in r.algorithm.algorithm&&(r.algorithm.algorithm.hash.name=n),"ECDSA"===s.name){let t=!1;if("algorithmParams"in e.algorithm==!0&&"idBlock"in e.algorithm.algorithmParams&&1===e.algorithm.algorithmParams.idBlock.tagClass&&6===e.algorithm.algorithmParams.idBlock.tagNumber&&(t=!0),!1===t)return Promise.reject("Incorrect type for ECDSA public key parameters");const n=this.getAlgorithmByOID(e.algorithm.algorithmParams.valueBlock.toString());if("name"in n==!1)return Promise.reject(`Unsupported named curve algorithm: ${e.algorithm.algorithmParams.valueBlock.toString()}`);r.algorithm.algorithm.namedCurve=n.name}return r}getPublicKey(e,t,r=null){null===r&&(r=this.fillPublicKeyParameters(e,t));const n=e.toSchema().toBER(!1),i=new Uint8Array(n);return this.importKey("spki",i,r.algorithm.algorithm,!0,r.algorithm.usages)}verifyWithPublicKey(e,t,r,i,a=null){let o=Promise.resolve();if(null===a){if(""===(a=this.getHashAlgorithm(i)))return Promise.reject(`Unsupported signature algorithm: ${i.algorithmId}`);o=o.then((()=>this.getPublicKey(r,i)))}else{const e={};let t;t="1.2.840.113549.1.1.10"===i.algorithmId?i.algorithmId:r.algorithm.algorithmId;const n=this.getAlgorithmByOID(t);if("name"in n==="")return Promise.reject(`Unsupported public key algorithm: ${i.algorithmId}`);if(e.algorithm=this.getAlgorithmParameters(n.name,"importkey"),"hash"in e.algorithm.algorithm&&(e.algorithm.algorithm.hash.name=a),"ECDSA"===n.name){let t=!1;if("algorithmParams"in r.algorithm==!0&&"idBlock"in r.algorithm.algorithmParams&&1===r.algorithm.algorithmParams.idBlock.tagClass&&6===r.algorithm.algorithmParams.idBlock.tagNumber&&(t=!0),!1===t)return Promise.reject("Incorrect type for ECDSA public key parameters");const n=this.getAlgorithmByOID(r.algorithm.algorithmParams.valueBlock.toString());if("name"in n==!1)return Promise.reject(`Unsupported named curve algorithm: ${r.algorithm.algorithmParams.valueBlock.toString()}`);e.algorithm.algorithm.namedCurve=n.name}o=o.then((()=>this.getPublicKey(r,null,e)))}return o=o.then((r=>{const o=this.getAlgorithmParameters(r.algorithm.name,"verify");"hash"in o.algorithm&&(o.algorithm.hash.name=a);let u=t.valueBlock.valueHex;if("ECDSA"===r.algorithm.name){const e=n.E(u);u=Object(s.b)(e.result)}if("RSA-PSS"===r.algorithm.name){let e;try{e=new l.a({schema:i.algorithmParams})}catch(e){return Promise.reject(e)}o.algorithm.saltLength="saltLength"in e?e.saltLength:20;let t="SHA-1";if("hashAlgorithm"in e){const r=this.getAlgorithmByOID(e.hashAlgorithm.algorithmId);if("name"in r==!1)return Promise.reject(`Unrecognized hash algorithm: ${e.hashAlgorithm.algorithmId}`);t=r.name}o.algorithm.hash.name=t}return this.verify(o.algorithm,r,new Uint8Array(u),new Uint8Array(e))})),o}}},function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,s),n(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,s,a,o;if(c(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),a=s[t]),void 0===a)a=s[t]=r,++e._eventsCount;else if("function"==typeof a?a=s[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,o=u,console&&console.warn&&console.warn(o)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function m(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):b(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){n.once&&e.removeEventListener(t,i),r(s)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)s(u,this,t);else{var c=u.length,l=b(u,c);for(r=0;r<c;++r)s(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return h(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return h(this,e,t,!0)},o.prototype.once=function(e,t){return c(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,s,a;if(c(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){a=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return m(this,e,!0)},o.prototype.rawListeners=function(e){return m(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){(t=e.exports=r(53)).Stream=t,t.Readable=t,t.Writable=r(38),t.Duplex=r(16),t.Transform=r(57),t.PassThrough=r(95)},function(e,t,r){var n=r(6),i=n.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=a),s(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t,n,i){var s=r(32);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=y;var o,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?n:s.nextTick;y.WritableState=g;var c=Object.create(r(24));c.inherits=r(19);var l={deprecate:r(93)},h=r(54),f=r(37).Buffer,d=i.Uint8Array||function(){};var m,p=r(55);function b(){}function g(e,t){o=o||r(16),e=e||{};var n=t instanceof o;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(s.nextTick(i,n),s.nextTick(B,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),B(e,t))}(e,r,n,t,i);else{var a=A(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||_(e,r),n?u(w,e,r,a,i):w(e,r,a,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function y(e){if(o=o||r(16),!(m.call(y,this)||this instanceof o))return new y(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function v(e,t,r,n,i,s,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function w(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),B(e,t)}function _(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var o=0,u=!0;r;)i[o]=r,r.isBuf||(u=!1),r=r.next,o+=1;i.allBuffers=u,v(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,h=r.callback;if(v(e,t,!1,t.objectMode?1:c.length,c,l,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function A(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),B(e,t)}))}function B(e,t){var r=A(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(S,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}c.inherits(y,h),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(m=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!m.call(this,e)||this===y&&(e&&e._writableState instanceof g)}})):m=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,r){var n,i=this._writableState,a=!1,o=!i.objectMode&&(n=e,f.isBuffer(n)||n instanceof d);return o&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=b),i.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),s.nextTick(t,r)}(this,r):(o||function(e,t,r,n){var i=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),s.nextTick(n,a),i=!1),i}(this,i,e,r))&&(i.pendingcb++,a=function(e,t,r,n,i,s){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var o=t.objectMode?1:n.length;t.length+=o;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else v(e,t,!1,o,n,i,s);return u}(this,i,o,e,t,r)),a},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||_(this,e))},y.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,B(e,t),r&&(t.finished?s.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=p.destroy,y.prototype._undestroy=p.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(14),r(91).setImmediate,r(12))},function(e,t,r){"use strict";const n=r(15).BigNumber,i=r(20),s=r(58),a=new n(-1),o=new n(2);class u{constructor(e,t,r){if(this.tag=e,this.value=t,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){let t=null!=e?e[this.tag]:void 0;if("function"!=typeof t&&(t=u["_tag_"+this.tag],"function"!=typeof t))return this;try{return t.call(u,this.value)}catch(e){return this.err=e,this}}static _tag_0(e){return new Date(e)}static _tag_1(e){return new Date(1e3*e)}static _tag_2(e){return i.bufferToBignumber(e)}static _tag_3(e){return a.minus(i.bufferToBignumber(e))}static _tag_4(e){return n(e[1]).shiftedBy(e[0])}static _tag_5(e){return o.pow(e[0]).times(e[1])}static _tag_32(e){return s.parse(e)}static _tag_35(e){return new RegExp(e)}}e.exports=u},function(e,t,r){"use strict";var n=r(85);function i(e){this.message=e}i.prototype=new Error,i.prototype.name="InvalidTokenError",e.exports=function(e,t){if("string"!=typeof e)throw new i("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(n(e.split(".")[r]))}catch(e){throw new i("Invalid token specified: "+e.message)}},e.exports.InvalidTokenError=i},function(e){e.exports=JSON.parse('{"a":"MIICETCCAZagAwIBAgIRAPkxdWgbkK/hHUbMtOTn+FYwCgYIKoZIzj0EAwMwSTELMAkGA1UEBhMCVVMxDzANBgNVBAoMBkFtYXpvbjEMMAoGA1UECwwDQVdTMRswGQYDVQQDDBJhd3Mubml0cm8tZW5jbGF2ZXMwHhcNMTkxMDI4MTMyODA1WhcNNDkxMDI4MTQyODA1WjBJMQswCQYDVQQGEwJVUzEPMA0GA1UECgwGQW1hem9uMQwwCgYDVQQLDANBV1MxGzAZBgNVBAMMEmF3cy5uaXRyby1lbmNsYXZlczB2MBAGByqGSM49AgEGBSuBBAAiA2IABPwCVOumCMHzaHDimtqQvkY4MpJzbolL//Zy2YlES1BR5TSksfbb48C8WBoyt7F2Bw7eEtaaP+ohG2bnUs990d0JX28TcPQXCEPZ3BABIeTPYwEoCWZEh8l5YoQwTcU/9KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUkCW1DdkFR+eWw5b6cp3PmanfS5YwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2kAMGYCMQCjfy+Rocm9Xue4YnwWmNJVA44fA0P5W2OpYow9OYCVRaEevL8uO1XYru5xtMPWrfMCMQCi85sWBbJwKKXdS6BptQFuZbT73o/gBh1qUxl/nNr12UO8Yfwr6wPLb+6NIwLz3/Y=","b":[{"0":"9d26116e5a5d03ebbb32824175b8ed18281fcf9acc84e0cc1d9a52e1b6caa48723fc24c10b6136f4dc95161734ace097","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"9f7a621b9b37856025f2072ab290fe3721358aa36cb125340c46f22c219652268c21b4d12d6970e66812afbba30f5552"},{"0":"0a78034067a531217527abc1cb7fef7b79f0171c0b52c48dd3afe63d9cadecfc6899f8dcb70eb547c1a1624f259c5e4c","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"9ccd2f1bfe6584c3c878fde60c2a96cc3adfd1230871b307f77a3795b0a142e0fefda1756e74e6f1eb11c43c6568370e"},{"0":"3aa79be0ea50bba5e158b21e06720618fa3f26db12bf91cb2a792dcb018ecc4d1daaee2bc035304bc4587444252e72b8","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"4f9fa1e121373fa3574699875bfed5ec34bbdd532430f6c399963e571d43cccd0ac4b78b6293f4a0a596c4bf564fee85"},{"0":"278b9cc389586349a5c38b9228151d56f7f927e013a9de3323ed4a08c43d72e4892ed11f540d8fd9af3dc16d447a4970","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"b7759bdeea1a6eba993b7cb09b1fce4e9720a5b88e30cd0978ce8bc15e420a9243c55ba64bb178a51fc58f31a274864b"},{"0":"6cf577ba7551e05a97ef6415343ce45ba6a3fe6c3ac99d68d52e9cb2e345c2a837e614a199c70cb0bcf59914877b1d23","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"ead56c37b1a73a8c705c2be4296da5a2b53a1953be028de9baa90412fc43c67fa776c930382ba1c6facc997e46f3d39c"},{"0":"ad3d16d5cb7daf10913f63077c67d681747a062506acdff467c486d12507644134bc9fda0217201ffa047a13d1ea709b","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"5055de92ee48baa2af631c4ef6abee7ceb03c6739fe1ac053ce4e012f8b3f5d71a9369f4f3bc08574250d0dd40a642d7"},{"0":"ea6c1ddb378d605fe773841a84198fba9a3de5c24e85ece3c91a5e2dbc0be8245fa5980e72a2e19d730b599c0c4f4d02","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"20e283beebb408295220241f69c30ddd692b96bb94c1c3e01266ae60954027d098ebea0dd04ecde5bd2498b24ea8df5c"},{"0":"a63c67b4329f3d7061b6f1088348b9eb193ba350e1a82d436a7fd6bcd3092d31d02d286495f2f167adda7949254751be","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"2973e80e8fe4c89e9299a4506f4a57500a110b2207ef19bffa71c1b2a3992280636f21fdcc8dbaf91b3c1799f5c6e432"},{"0":"5accfc10177743113d97303cea9554b1b7a5d088acb177e70835fc11ae78d6e27acb389465e24f33f9af07254f013612","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"4a471dd2b07207a2a95ff6acc6b7d87f5455e4e307e5d10ca6ab02d860212836bab5e811edb56acd90bad94ffbf7aed1"},{"0":"87b7ee96d6c679a636adf50c8fe912d41c3507ea5056506442244e12a885f9951fb0f4ef7ea8c1d5f7c121ca14b5f087","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"b4134e51f7e203c85b7420a4fe4ec09ea227319bb00e41f73d0efb7772b678339f2e195ff0c858cf77fe89af2b472c7c"},{"0":"2962d3480c671a09265a3cdce4aee9faedbbcc063ecd30aeaa8e5a962ca240cc8f30155ffcd150fae35f315aed47049a","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"1baa72c3c28724772c5639680f0983ef4f803bc8dca339e4f8db905f26dca9bc6578e4c6a00d528a7bfa958b5b50ac2a"},{"0":"d13e8da7b1dc5531431321e424a7186ab25087384d6abf984347067a3fa62a720c3cdce73406985450ce27c80132568a","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"40887d2c52e738d212e649c08ff9aa2d17d8722b735bed569507a590c166b2e1a1e970bf2c9212094e9367a48f09fa9a"},{"0":"2956e2f62f8b4546f701d864dde2ea4184e8488fa19a7e1378cd756d1a4b315b10ba853d891419ef03f4b6eb76a3304f","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"05d6ba2a4f341ba5d3bc4ab4f30ae37d695c5032fe51ed766a7dd0c93c13fb48bcaa087a84d7d9424b4c869009b5ae51"},{"0":"af5be354b6ea9885799ce8ba0c9b97405002bc95f46ba3cadcdb9898d54e7cb02ad21c1b69a3b33d1da2caae1bff6912","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"dccbc370ee42f4a15c444f24f00126790b4339518ff220d3d10301e85765ee397e894e692164cc3c7ad0e5b557a6e85b"},{"0":"3ea713e5f203f37452b7c21a4b3215d4f890f506f798601b81c0e3d5d45da11e07e2116c84c28983e1f4b1b97e5d8c22","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"69143742fb9362cd35fb91733fd5830ac9fdd458bcc289c36c5f90b3d730355aa10476dd2d6b395e5439a5dcc0c13708"},{"0":"9301419bb48c0a64c1803d103ebb8e699d3dbb076a0391e2646db9fb77ccc8244751cfc552129a89c3c94dd8393c483b","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"2fa6d33f9c2f3452b4816f1b868297d4800eaafcb94a74a163ef7052d57f057d5703ab6a9ad7c9401a01117a32ad3e69"},{"0":"8b37ab95b6adb5f74f23b570f59f7871da3ce637f86722b49b82784bf789562db6aafed8c0fdaa9bf4f6ed8c9d463717","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"0e6c90edcd5f6443a7b52c6c2291ad18562acb1dbdf4f267604d0631031de2d329d094b1686d32a61fd288993740c6cf"},{"0":"d7c0383417feaf6f9cd86445c8ef772a4419468fb9f37786f2c9c83b9beef708b102f7f9f38c718e4be2ca6d7fc19aee","1":"04a2adc048ade242e2c24459365fcb0938630efccf5bb465328d922a14608a3de59810fd9a59a6b669b5b74bf17481d6","2":"e0e9c5623ebb48ae6aed3772c6411cf9da7c220b4a212d26ee3b658a58e03a4c7b604d8093e67845f620f5182d5a70b8"}]}')},function(e,t,r){var n,i;!function(s,a){"use strict";var o=Math.pow(2,-24),u=Math.pow(2,32),c=Math.pow(2,53);(i="function"==typeof(n={encode:function(e){var t,r=new ArrayBuffer(256),n=new DataView(r),i=0;function s(e){for(var s=r.byteLength,a=i+e;s<a;)s*=2;if(s!==r.byteLength){var o=n;r=new ArrayBuffer(s),n=new DataView(r);for(var u=i+3>>2,c=0;c<u;++c)n.setUint32(4*c,o.getUint32(4*c))}return t=e,n}function o(){i+=t}function l(e){o(s(1).setUint8(i,e))}function h(e){for(var t=s(e.length),r=0;r<e.length;++r)t.setUint8(i+r,e[r]);o()}function f(e,t){t<24?l(e<<5|t):t<256?(l(e<<5|24),l(t)):t<65536?(l(e<<5|25),function(e){o(s(2).setUint16(i,e))}(t)):t<4294967296?(l(e<<5|26),function(e){o(s(4).setUint32(i,e))}(t)):(l(e<<5|27),function(e){var t=e%u,r=(e-t)/u,n=s(8);n.setUint32(i,r),n.setUint32(i+4,t),o()}(t))}if(function e(t){var r;if(!1===t)return l(244);if(!0===t)return l(245);if(null===t)return l(246);if(t===a)return l(247);switch(typeof t){case"number":if(Math.floor(t)===t){if(0<=t&&t<=c)return f(0,t);if(-c<=t&&t<0)return f(1,-(t+1))}return l(251),function(e){o(s(8).setFloat64(i,e))}(t);case"string":var n=[];for(r=0;r<t.length;++r){var u=t.charCodeAt(r);u<128?n.push(u):u<2048?(n.push(192|u>>6),n.push(128|63&u)):u<55296?(n.push(224|u>>12),n.push(128|u>>6&63),n.push(128|63&u)):(u=(1023&u)<<10,u|=1023&t.charCodeAt(++r),u+=65536,n.push(240|u>>18),n.push(128|u>>12&63),n.push(128|u>>6&63),n.push(128|63&u))}return f(3,n.length),h(n);default:var d;if(Array.isArray(t))for(f(4,d=t.length),r=0;r<d;++r)e(t[r]);else if(t instanceof Uint8Array)f(2,t.length),h(t);else{var m=Object.keys(t);for(f(5,d=m.length),r=0;r<d;++r){var p=m[r];e(p),e(t[p])}}}}(e),"slice"in r)return r.slice(0,i);for(var d=new ArrayBuffer(i),m=new DataView(d),p=0;p<i;++p)m.setUint8(p,n.getUint8(p));return d},decode:function(e,t,r){var n=new DataView(e),i=0;function s(e,t){return i+=t,e}function c(t){return s(new Uint8Array(e,i,t),t)}function l(){return s(n.getUint8(i),1)}function h(){return s(n.getUint16(i),2)}function f(){return s(n.getUint32(i),4)}function d(){return 255===n.getUint8(i)&&(i+=1,!0)}function m(e){if(e<24)return e;if(24===e)return l();if(25===e)return h();if(26===e)return f();if(27===e)return f()*u+f();if(31===e)return-1;throw"Invalid length encoding"}function p(e){var t=l();if(255===t)return-1;var r=m(31&t);if(r<0||t>>5!==e)throw"Invalid indefinite length element";return r}function b(e,t){for(var r=0;r<t;++r){var n=l();128&n&&(n<224?(n=(31&n)<<6|63&l(),t-=1):n<240?(n=(15&n)<<12|(63&l())<<6|63&l(),t-=2):(n=(15&n)<<18|(63&l())<<12|(63&l())<<6|63&l(),t-=3)),n<65536?e.push(n):(n-=65536,e.push(55296|n>>10),e.push(56320|1023&n))}}"function"!=typeof t&&(t=function(e){return e}),"function"!=typeof r&&(r=function(){return a});var g=function e(){var u,f,g=l(),y=g>>5,v=31&g;if(7===y)switch(v){case 25:return function(){var e=new ArrayBuffer(4),t=new DataView(e),r=h(),n=32768&r,i=31744&r,s=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==s)return s*o;return t.setUint32(0,n<<16|i<<13|s<<13),t.getFloat32(0)}();case 26:return s(n.getFloat32(i),4);case 27:return s(n.getFloat64(i),8)}if((f=m(v))<0&&(y<2||6<y))throw"Invalid length";switch(y){case 0:return f;case 1:return-1-f;case 2:if(f<0){for(var w=[],_=0;(f=p(y))>=0;)_+=f,w.push(c(f));var A=new Uint8Array(_),S=0;for(u=0;u<w.length;++u)A.set(w[u],S),S+=w[u].length;return A}return c(f);case 3:var B=[];if(f<0)for(;(f=p(y))>=0;)b(B,f);else b(B,f);return String.fromCharCode.apply(null,B);case 4:var k;if(f<0)for(k=[];!d();)k.push(e());else for(k=new Array(f),u=0;u<f;++u)k[u]=e();return k;case 5:var E={};for(u=0;u<f||f<0&&!d();++u){E[e()]=e()}return E;case 6:return t(e(),f);case 7:switch(f){case 20:return!1;case 21:return!0;case 22:return null;case 23:return a;default:return r(f)}}}();if(i!==e.byteLength)throw"Remaining bytes";return g}})?n.call(t,r,t,e):n)===a||(e.exports=i)}()},function(e,t,r){e.exports=r(119)},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t,r){"use strict";var n=r(8);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(n.isURLSearchParams(t))s=t.toString();else{var a=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),a.push(i(t)+"="+i(e))})))})),s=a.join("&")}if(s){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";(function(t){var n=r(8),i=r(71),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var o,u={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(o=r(48)),o),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(a(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(s)})),e.exports=u}).call(this,r(14))},function(e,t,r){"use strict";var n=r(8),i=r(72),s=r(74),a=r(45),o=r(75),u=r(78),c=r(79),l=r(49);e.exports=function(e){return new Promise((function(t,r){var h=e.data,f=e.headers;n.isFormData(h)&&delete f["Content-Type"];var d=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",p=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(m+":"+p)}var b=o(e.baseURL,e.url);if(d.open(e.method.toUpperCase(),a(b,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in d?u(d.getAllResponseHeaders()):null,s={data:e.responseType&&"text"!==e.responseType?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:n,config:e,request:d};i(t,r,s),d=null}},d.onabort=function(){d&&(r(l("Request aborted",e,"ECONNABORTED",d)),d=null)},d.onerror=function(){r(l("Network Error",e,null,d)),d=null},d.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,"ECONNABORTED",d)),d=null},n.isStandardBrowserEnv()){var g=(e.withCredentials||c(b))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;g&&(f[e.xsrfHeaderName]=g)}if("setRequestHeader"in d&&n.forEach(f,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete f[t]:d.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){d&&(d.abort(),r(e),d=null)})),h||(h=null),d.send(h)}))}},function(e,t,r){"use strict";var n=r(73);e.exports=function(e,t,r,i,s){var a=new Error(e);return n(a,t,r,i,s)}},function(e,t,r){"use strict";var n=r(8);e.exports=function(e,t){t=t||{};var r={},i=["url","method","data"],s=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function u(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function c(i){n.isUndefined(t[i])?n.isUndefined(e[i])||(r[i]=u(void 0,e[i])):r[i]=u(e[i],t[i])}n.forEach(i,(function(e){n.isUndefined(t[e])||(r[e]=u(void 0,t[e]))})),n.forEach(s,c),n.forEach(a,(function(i){n.isUndefined(t[i])?n.isUndefined(e[i])||(r[i]=u(void 0,e[i])):r[i]=u(void 0,t[i])})),n.forEach(o,(function(n){n in t?r[n]=u(e[n],t[n]):n in e&&(r[n]=u(void 0,e[n]))}));var l=i.concat(s).concat(a).concat(o),h=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return n.forEach(h,c),r}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";(function(t,n){var i=r(32);e.exports=v;var s,a=r(52);v.ReadableState=y;r(35).EventEmitter;var o=function(e,t){return e.listeners(t).length},u=r(54),c=r(37).Buffer,l=t.Uint8Array||function(){};var h=Object.create(r(24));h.inherits=r(19);var f=r(88),d=void 0;d=f&&f.debuglog?f.debuglog("stream"):function(){};var m,p=r(89),b=r(55);h.inherits(v,u);var g=["error","close","destroy","pause","resume"];function y(e,t){e=e||{};var n=t instanceof(s=s||r(16));this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,a=e.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(a||0===a)?a:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(m||(m=r(56).StringDecoder),this.decoder=new m(e.encoding),this.encoding=e.encoding)}function v(e){if(s=s||r(16),!(this instanceof v))return new v(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function w(e,t,r,n,i){var s,a=e._readableState;null===t?(a.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,B(e)}(e,a)):(i||(s=function(e,t){var r;n=t,c.isBuffer(n)||n instanceof l||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(a,t)),s?e.emit("error",s):a.objectMode||t&&t.length>0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):_(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?_(e,a,t,!1):E(e,a)):_(e,a,t,!1))):n||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(a)}function _(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&B(e)),E(e,t)}Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),v.prototype.destroy=b.destroy,v.prototype._undestroy=b.undestroy,v.prototype._destroy=function(e,t){this.push(null),t(e)},v.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=c.from(e,t),t=""),r=!0),w(this,e,t,!1,r)},v.prototype.unshift=function(e){return w(this,e,null,!0,!1)},v.prototype.isPaused=function(){return!1===this._readableState.flowing},v.prototype.setEncoding=function(e){return m||(m=r(56).StringDecoder),this._readableState.decoder=new m(e),this._readableState.encoding=e,this};var A=8388608;function S(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=A?e=A:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(k,e):k(e))}function k(e){d("emit readable"),e.emit("readable"),I(e)}function E(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(O,e,t))}function O(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(d("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function N(e){d("readable nexttick read 0"),e.read(0)}function x(e,t){t.reading||(d("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),I(e),t.flowing&&!t.reading&&e.read(0)}function I(e){var t=e._readableState;for(d("flow",t.flowing);t.flowing&&null!==e.read(););}function C(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;e-=i.length;for(;r=r.next;){var s=r.data,a=e>s.length?s.length:e;if(a===s.length?i+=s:i+=s.slice(0,e),0===(e-=a)){a===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var s=n.data,a=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,a),0===(e-=a)){a===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function j(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(T,t,e))}function T(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function P(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}v.prototype.read=function(e){d("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):B(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,i=t.needReadable;return d("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&d("length less than watermark",i=!0),t.ended||t.reading?d("reading or ended",i=!1):i&&(d("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=S(r,t))),null===(n=e>0?C(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&j(this)),null!==n&&this.emit("data",n),n},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,d("pipe count=%d opts=%j",s.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:v;function c(t,n){d("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,d("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",h),e.removeListener("error",b),e.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",v),r.removeListener("data",p),f=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){d("onend"),e.end()}s.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",c);var h=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,I(e))}}(r);e.on("drain",h);var f=!1;var m=!1;function p(t){d("ondata"),m=!1,!1!==e.write(t)||m||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==P(s.pipes,e))&&!f&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,m=!0),r.pause())}function b(t){d("onerror",t),v(),e.removeListener("error",b),0===o(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),v()}function y(){d("onfinish"),e.removeListener("close",g),v()}function v(){d("unpipe"),r.unpipe(e)}return r.on("data",p),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",b),e.once("close",g),e.once("finish",y),e.emit("pipe",r),s.flowing||(d("pipe resume"),r.resume()),e},v.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,r);return this}var a=P(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},v.prototype.on=function(e,t){var r=u.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&B(this):i.nextTick(N,this))}return r},v.prototype.addListener=v.prototype.on,v.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(x,e,t))}(this,e)),this},v.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this},v.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(d("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(d("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<g.length;s++)e.on(g[s],this.emit.bind(this,g[s]));return this._read=function(t){d("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(v.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),v._fromList=C}).call(this,r(12),r(14))},function(e,t,r){e.exports=r(35).EventEmitter},function(e,t,r){"use strict";var n=r(32);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(n.nextTick(i,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,r){"use strict";var n=r(94).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=o,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=a(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=a(t[n]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=a(t[n]))>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=a;var n=r(16),i=Object.create(r(24));function s(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);n.call(this,e),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",o)}function o(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){u(e,t,r)})):u(this,null,null)}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=r(19),i.inherits(a,n),a.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},a.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},a.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}},function(e,t,r){"use strict";var n=r(103),i=r(105);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=v,t.resolve=function(e,t){return v(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?v(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=v(e));return e instanceof s?e.format():s.prototype.format.call(e)},t.Url=s;var a=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(106);function v(e,t,r){if(e&&i.isObject(e)&&e instanceof s)return e;var n=new s;return n.parse(e,t,r),n}s.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var s=e.indexOf("?"),o=-1!==s&&s<e.indexOf("#")?"?":"#",c=e.split(o);c[0]=c[0].replace(/\\/g,"/");var v=e=c.join(o);if(v=v.trim(),!r&&1===e.split("#").length){var w=u.exec(v);if(w)return this.path=v,this.href=v,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?y.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var _=a.exec(v);if(_){var A=(_=_[0]).toLowerCase();this.protocol=A,v=v.substr(_.length)}if(r||_||v.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===v.substr(0,2);!S||_&&b[_]||(v=v.substr(2),this.slashes=!0)}if(!b[_]&&(S||_&&!g[_])){for(var B,k,E=-1,O=0;O<f.length;O++){-1!==(N=v.indexOf(f[O]))&&(-1===E||N<E)&&(E=N)}-1!==(k=-1===E?v.lastIndexOf("@"):v.lastIndexOf("@",E))&&(B=v.slice(0,k),v=v.slice(k+1),this.auth=decodeURIComponent(B)),E=-1;for(O=0;O<h.length;O++){var N;-1!==(N=v.indexOf(h[O]))&&(-1===E||N<E)&&(E=N)}-1===E&&(E=v.length),this.host=v.slice(0,E),v=v.slice(E),this.parseHost(),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x)for(var I=this.hostname.split(/\./),C=(O=0,I.length);O<C;O++){var j=I[O];if(j&&!j.match(d)){for(var T="",P=0,D=j.length;P<D;P++)j.charCodeAt(P)>127?T+="x":T+=j[P];if(!T.match(d)){var U=I.slice(0,O),L=I.slice(O+1),R=j.match(m);R&&(U.push(R[1]),L.unshift(R[2])),L.length&&(v="/"+L.join(".")+v),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=n.toASCII(this.hostname));var M=this.port?":"+this.port:"",$=this.hostname||"";this.host=$+M,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!p[A])for(O=0,C=l.length;O<C;O++){var H=l[O];if(-1!==v.indexOf(H)){var V=encodeURIComponent(H);V===H&&(V=escape(H)),v=v.split(H).join(V)}}var F=v.indexOf("#");-1!==F&&(this.hash=v.substr(F),v=v.slice(0,F));var K=v.indexOf("?");if(-1!==K?(this.search=v.substr(K),this.query=v.substr(K+1),t&&(this.query=y.parse(this.query)),v=v.slice(0,K)):t&&(this.search="",this.query={}),v&&(this.pathname=v),g[A]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){M=this.pathname||"";var z=this.search||"";this.path=M+z}return this.href=this.format(),this},s.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",s=!1,a="";this.host?s=e+this.host:this.hostname&&(s=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(a=y.stringify(this.query));var o=this.search||a&&"?"+a||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||g[t])&&!1!==s?(s="//"+(s||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):s||(s=""),n&&"#"!==n.charAt(0)&&(n="#"+n),o&&"?"!==o.charAt(0)&&(o="?"+o),t+s+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(o=o.replace("#","%23"))+n},s.prototype.resolve=function(e){return this.resolveObject(v(e,!1,!0)).format()},s.prototype.resolveObject=function(e){if(i.isString(e)){var t=new s;t.parse(e,!1,!0),e=t}for(var r=new s,n=Object.keys(this),a=0;a<n.length;a++){var o=n[a];r[o]=this[o]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(r[l]=e[l])}return g[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!g[e.protocol]){for(var h=Object.keys(e),f=0;f<h.length;f++){var d=h[f];r[d]=e[d]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||b[e.protocol])r.pathname=e.pathname;else{for(var m=(e.pathname||"").split("/");m.length&&!(e.host=m.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==m[0]&&m.unshift(""),m.length<2&&m.unshift(""),r.pathname=m.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var p=r.pathname||"",y=r.search||"";r.path=p+y}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var v=r.pathname&&"/"===r.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),_=w||v||r.host&&e.pathname,A=_,S=r.pathname&&r.pathname.split("/")||[],B=(m=e.pathname&&e.pathname.split("/")||[],r.protocol&&!g[r.protocol]);if(B&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===m[0]?m[0]=e.host:m.unshift(e.host)),e.host=null),_=_&&(""===m[0]||""===S[0])),w)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,S=m;else if(m.length)S||(S=[]),S.pop(),S=S.concat(m),r.search=e.search,r.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(B)r.hostname=r.host=S.shift(),(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var k=S.slice(-1)[0],E=(r.host||e.host||S.length>1)&&("."===k||".."===k)||""===k,O=0,N=S.length;N>=0;N--)"."===(k=S[N])?S.splice(N,1):".."===k?(S.splice(N,1),O++):O&&(S.splice(N,1),O--);if(!_&&!A)for(;O--;O)S.unshift("..");!_||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),E&&"/"!==S.join("/").substr(-1)&&S.push("");var x,I=""===S[0]||S[0]&&"/"===S[0].charAt(0);B&&(r.hostname=r.host=I?"":S.length?S.shift():"",(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift()));return(_=_||r.host&&S.length)&&!I&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var e=this.host,t=o.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";(function(t){const n=r(18),i=r(58),s=(r(15).BigNumber,r(27)),a=(r(39),r(26),r(20)),o=r(17),u=o.MT,c=o.NUMBYTES,l=o.SHIFT32,h=o.SYMS,f=o.TAG,d=o.MT.SIMPLE_FLOAT<<5|o.NUMBYTES.TWO,m=o.MT.SIMPLE_FLOAT<<5|o.NUMBYTES.FOUR,p=o.MT.SIMPLE_FLOAT<<5|o.NUMBYTES.EIGHT,b=o.MT.SIMPLE_FLOAT<<5|o.SIMPLE.TRUE,g=o.MT.SIMPLE_FLOAT<<5|o.SIMPLE.FALSE,y=o.MT.SIMPLE_FLOAT<<5|o.SIMPLE.UNDEFINED,v=o.MT.SIMPLE_FLOAT<<5|o.SIMPLE.NULL,w=t.from([255]),_=a.bigIntize(o.BI),A=o.BN,S=t.from("f97e00","hex"),B=t.from("f9fc00","hex"),k=t.from("f97c00","hex"),E=t.from("f98000","hex"),O=Symbol("CBOR_LOOP_DETECT");class N extends n.Transform{constructor(e){const t=Object.assign({},e,{readableObjectMode:!1,writableObjectMode:!0});super(t),this.canonical=t.canonical,this.encodeUndefined=t.encodeUndefined,this.disallowUndefinedKeys=!!t.disallowUndefinedKeys,this.dateType=null!=t.dateType?t.dateType.toLowerCase():"number",this.collapseBigIntegers=!!t.collapseBigIntegers,"symbol"==typeof t.detectLoops?this.detectLoops=t.detectLoops:this.detectLoops=t.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes={Array:this._pushArray,Date:this._pushDate,Buffer:this._pushBuffer,Map:this._pushMap,NoFilter:this._pushNoFilter,RegExp:this._pushRegexp,Set:this._pushSet,BigNumber:this._pushBigNumber,ArrayBuffer:this._pushUint8Array,Uint8ClampedArray:this._pushUint8Array,Uint8Array:this._pushUint8Array,Uint16Array:this._pushArray,Uint32Array:this._pushArray,Int8Array:this._pushArray,Int16Array:this._pushArray,Int32Array:this._pushArray,Float32Array:this._pushFloat32Array,Float64Array:this._pushFloat64Array},i.Url&&this.addSemanticType("Url",this._pushUrl),i.URL&&this.addSemanticType("URL",this._pushURL);const r=t.genTypes||[];for(let e=0,t=r.length;e<t;e+=2)this.addSemanticType(r[e],r[e+1])}_transform(e,t,r){return r(!1===this.pushAny(e)?new Error("Push Error"):void 0)}_flush(e){return e()}addSemanticType(e,t){if("function"!=typeof t)throw new TypeError("fun must be of type function");const r="string"==typeof e?e:e.name,n=this.semanticTypes[r];return this.semanticTypes[r]=t,n}_pushUInt8(e){const r=t.allocUnsafe(1);return r.writeUInt8(e,0),this.push(r)}_pushUInt16BE(e){const r=t.allocUnsafe(2);return r.writeUInt16BE(e,0),this.push(r)}_pushUInt32BE(e){const r=t.allocUnsafe(4);return r.writeUInt32BE(e,0),this.push(r)}_pushFloatBE(e){const r=t.allocUnsafe(4);return r.writeFloatBE(e,0),this.push(r)}_pushDoubleBE(e){const r=t.allocUnsafe(8);return r.writeDoubleBE(e,0),this.push(r)}_pushNaN(){return this.push(S)}_pushInfinity(e){const t=e<0?B:k;return this.push(t)}_pushFloat(e){if(this.canonical){const r=t.allocUnsafe(2);if(a.writeHalf(r,e))return this._pushUInt8(d)&&this.push(r)}return Math.fround(e)===e?this._pushUInt8(m)&&this._pushFloatBE(e):this._pushUInt8(p)&&this._pushDoubleBE(e)}_pushInt(e,t,r){const n=t<<5;switch(!1){case!(e<24):return this._pushUInt8(n|e);case!(e<=255):return this._pushUInt8(n|c.ONE)&&this._pushUInt8(e);case!(e<=65535):return this._pushUInt8(n|c.TWO)&&this._pushUInt16BE(e);case!(e<=4294967295):return this._pushUInt8(n|c.FOUR)&&this._pushUInt32BE(e);case!(e<=Number.MAX_SAFE_INTEGER):return this._pushUInt8(n|c.EIGHT)&&this._pushUInt32BE(Math.floor(e/l))&&this._pushUInt32BE(e%l);default:return t===u.NEG_INT?this._pushFloat(r):this._pushFloat(e)}}_pushIntNum(e){return Object.is(e,-0)?this.push(E):e<0?this._pushInt(-e-1,u.NEG_INT,e):this._pushInt(e,u.POS_INT)}_pushNumber(e){switch(!1){case!isNaN(e):return this._pushNaN();case isFinite(e):return this._pushInfinity(e);case Math.round(e)!==e:return this._pushIntNum(e);default:return this._pushFloat(e)}}_pushString(e){const r=t.byteLength(e,"utf8");return this._pushInt(r,u.UTF8_STRING)&&this.push(e,"utf8")}_pushBoolean(e){return this._pushUInt8(e?b:g)}_pushUndefined(e){switch(typeof this.encodeUndefined){case"undefined":return this._pushUInt8(y);case"function":return this.pushAny(this.encodeUndefined.call(this,e));case"object":if(t.isBuffer(this.encodeUndefined))return this.push(this.encodeUndefined)}return this.pushAny(this.encodeUndefined)}_pushNull(e){return this._pushUInt8(v)}_pushArray(e,t,r){r=Object.assign({indefinite:!1},r);const n=t.length;if(r.indefinite){if(!e._pushUInt8(u.ARRAY<<5|c.INDEFINITE))return!1}else if(!e._pushInt(n,u.ARRAY))return!1;for(let r=0;r<n;r++)if(!e.pushAny(t[r]))return!1;return!(r.indefinite&&!e.push(w))}_pushTag(e){return this._pushInt(e,u.TAG)}_pushDate(e,t){switch(e.dateType){case"string":return e._pushTag(f.DATE_STRING)&&e._pushString(t.toISOString());case"int":case"integer":return e._pushTag(f.DATE_EPOCH)&&e._pushIntNum(Math.round(t/1e3));case"float":return e._pushTag(f.DATE_EPOCH)&&e._pushFloat(t/1e3);case"number":default:return e._pushTag(f.DATE_EPOCH)&&e.pushAny(t/1e3)}}_pushBuffer(e,t){return e._pushInt(t.length,u.BYTE_STRING)&&e.push(t)}_pushNoFilter(e,t){return e._pushBuffer(e,t.slice())}_pushRegexp(e,t){return e._pushTag(f.REGEXP)&&e.pushAny(t.source)}_pushSet(e,t){if(!e._pushInt(t.size,u.ARRAY))return!1;for(const r of t)if(!e.pushAny(r))return!1;return!0}_pushUrl(e,t){return e._pushTag(f.URI)&&e.pushAny(t.format())}_pushURL(e,t){return e._pushTag(f.URI)&&e.pushAny(t.toString())}_pushBigint(e){let r=u.POS_INT,n=f.POS_BIGINT;if(e.isNegative()&&(e=e.negated().minus(1),r=u.NEG_INT,n=f.NEG_BIGINT),this.collapseBigIntegers&&e.lte(A.MAXINT64))return e.lte(A.MAXINT32)?this._pushInt(e.toNumber(),r):this._pushUInt8(r<<5|c.EIGHT)&&this._pushUInt32BE(e.dividedToIntegerBy(A.SHIFT32).toNumber())&&this._pushUInt32BE(e.mod(A.SHIFT32).toNumber());let i=e.toString(16);i.length%2&&(i="0"+i);const s=t.from(i,"hex");return this._pushTag(n)&&this._pushBuffer(this,s)}_pushJSBigint(e){let r=u.POS_INT,n=f.POS_BIGINT;if(e<0&&(e=-e+_.MINUS_ONE,r=u.NEG_INT,n=f.NEG_BIGINT),this.collapseBigIntegers&&e<=_.MAXINT64)return e<=4294967295?this._pushInt(Number(e),r):this._pushUInt8(r<<5|c.EIGHT)&&this._pushUInt32BE(Number(e/_.SHIFT32))&&this._pushUInt32BE(Number(e%_.SHIFT32));let i=e.toString(16);i.length%2&&(i="0"+i);const s=t.from(i,"hex");return this._pushTag(n)&&this._pushBuffer(this,s)}_pushBigNumber(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!e._pushTag(f.DECIMAL_FRAC)||!e._pushInt(2,u.ARRAY))return!1;const r=t.decimalPlaces(),n=t.shiftedBy(r);return!!e._pushIntNum(-r)&&(n.abs().isLessThan(A.MAXINT)?e._pushIntNum(n.toNumber()):e._pushBigint(n))}_pushMap(e,t,r){if((r=Object.assign({indefinite:!1},r)).indefinite){if(!e._pushUInt8(u.MAP<<5|c.INDEFINITE))return!1}else if(!e._pushInt(t.size,u.MAP))return!1;if(e.canonical){const r=[...t.entries()],n=new N(this),i=new s({highWaterMark:this.readableHighWaterMark});n.pipe(i),r.sort((([e],[t])=>{n.pushAny(e);const r=i.read();n.pushAny(t);const s=i.read();return r.compare(s)}));for(const[t,n]of r){if(e.disallowUndefinedKeys&&void 0===t)throw new Error("Invalid Map key: undefined");if(!e.pushAny(t)||!e.pushAny(n))return!1}}else for(const[r,n]of t){if(e.disallowUndefinedKeys&&void 0===r)throw new Error("Invalid Map key: undefined");if(!e.pushAny(r)||!e.pushAny(n))return!1}return!(r.indefinite&&!e.push(w))}_pushUint8Array(e,r){return e._pushBuffer(e,t.from(r))}_pushFloat32Array(e,t){const r=t.length;if(!e._pushInt(r,u.ARRAY))return!1;for(let n=0;n<r;n++)if(!e._pushUInt8(m)||!e._pushFloatBE(t[n]))return!1;return!0}_pushFloat64Array(e,t){const r=t.length;if(!e._pushInt(r,u.ARRAY))return!1;for(let n=0;n<r;n++)if(!e._pushUInt8(p)||!e._pushDoubleBE(t[n]))return!1;return!0}removeLoopDetectors(e){return!!this.detectLoops&&N.removeLoopDetectors(e,this.detectLoops)}static removeLoopDetectors(e,t=null){if("object"!=typeof e||!e)return!1;const r=e[O];if(!r)return!1;if(null==t)t=r;else if(t!==r)return!1;if(delete e[O],Array.isArray(e))for(const r of e)this.removeLoopDetectors(r,t);else for(const r in e)this.removeLoopDetectors(e[r],t);return!0}_pushObject(e,t){if(!e)return this._pushNull(e);if(!(t=Object.assign({indefinite:!1,skipTypes:!1},t)).indefinite&&this.detectLoops){if(e[O]===this.detectLoops)throw new Error("Loop detected while CBOR encoding");e[O]=this.detectLoops}if(!t.skipTypes){const t=e.encodeCBOR;if("function"==typeof t)return t.call(e,this);const r=this.semanticTypes[e.constructor.name];if(r)return r.call(e,this,e)}const r=Object.keys(e).filter((t=>"function"!=typeof e[t])),n={};if(this.canonical&&r.sort(((e,t)=>{const r=n[e]||(n[e]=N.encode(e)),i=n[t]||(n[t]=N.encode(t));return r.compare(i)})),t.indefinite){if(!this._pushUInt8(u.MAP<<5|c.INDEFINITE))return!1}else if(!this._pushInt(r.length,u.MAP))return!1;let i;for(let t=0,s=r.length;t<s;t++){const s=r[t];if(this.canonical&&(i=n[s])){if(!this.push(i))return!1}else if(!this._pushString(s))return!1;if(!this.pushAny(e[s]))return!1}return!(t.indefinite&&!this.push(w))}pushAny(e){switch(typeof e){case"number":return this._pushNumber(e);case"bigint":return this._pushJSBigint(e);case"string":return this._pushString(e);case"boolean":return this._pushBoolean(e);case"undefined":return this._pushUndefined(e);case"object":return this._pushObject(e);case"symbol":switch(e){case h.NULL:return this._pushNull(null);case h.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+typeof e+", "+(e.toString?e.toString():""))}}_pushAny(e){return this.pushAny(e)}_encodeAll(e){const t=new s({highWaterMark:this.readableHighWaterMark});this.pipe(t);for(const t of e)this.pushAny(t);return this.end(),t.read()}static encodeIndefinite(e,r,n){if(null==r){if(null==this)throw new Error("No object to encode");r=this}n=Object.assign({chunkSize:4096},n);let i=!0;const s=typeof r;if("string"===s){i=i&&e._pushUInt8(u.UTF8_STRING<<5|c.INDEFINITE);let t=0;for(;t<r.length;){const s=t+n.chunkSize;i=i&&e._pushString(r.slice(t,s)),t=s}i=i&&e.push(w)}else if(t.isBuffer(r)){i=i&&e._pushUInt8(u.BYTE_STRING<<5|c.INDEFINITE);let t=0;for(;t<r.length;){const s=t+n.chunkSize;i=i&&e._pushBuffer(e,r.slice(t,s)),t=s}i=i&&e.push(w)}else if(Array.isArray(r))i=i&&e._pushArray(e,r,{indefinite:!0});else if(r instanceof Map)i=i&&e._pushMap(e,r,{indefinite:!0});else{if("object"!==s)throw new Error("Invalid indefinite encoding");i=i&&e._pushObject(r,{indefinite:!0,skipTypes:!0})}return i}static encode(...e){return(new N)._encodeAll(e)}static encodeCanonical(...e){return new N({canonical:!0})._encodeAll(e)}static encodeOne(e,t){return new N(t)._encodeAll([e])}static encodeAsync(e,r){return new Promise(((n,i)=>{const s=[],a=new N(r);a.on("data",(e=>s.push(e))),a.on("error",i),a.on("finish",(()=>n(t.concat(s)))),a.pushAny(e),a.end()}))}}e.exports=N}).call(this,r(6).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(115);let i=n.DefaultSerializer;t.registerSerializer=function(e){i=n.extendSerializer(i,e)},t.deserialize=function(e){return i.deserialize(e)},t.serialize=function(e){return i.serialize(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(116);t.isTransferDescriptor=function(e){return e&&"object"==typeof e&&e[n.$transferable]},t.Transfer=function(e,t){if(!t){if(!(r=e)||"object"!=typeof r)throw Error();t=[e]}var r;return{[n.$transferable]:!0,send:e,transferables:t}}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global,Buffer){__webpack_require__.d(__webpack_exports__,"a",(function(){return bson_47}));var long__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(23),long__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(long__WEBPACK_IMPORTED_MODULE_0__),buffer__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(6),buffer__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(buffer__WEBPACK_IMPORTED_MODULE_1__),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var map=createCommonjsModule((function(e){if(void 0!==commonjsGlobal.Map)e.exports=commonjsGlobal.Map,e.exports.Map=commonjsGlobal.Map;else{var t=function(e){this._keys=[],this._values={};for(var t=0;t<e.length;t++)if(null!=e[t]){var r=e[t],n=r[0],i=r[1];this._keys.push(n),this._values[n]={v:i,i:this._keys.length-1}}};t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var t=this._values[e];return null!=t&&(delete this._values[e],this._keys.splice(t.i,1),!0)},t.prototype.entries=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?[r,e._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(e,t){t=t||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];e.call(t,this._values[n].v,n,t)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return null!=this._values[e]},t.prototype.keys=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(e,t){return this._values[e]?(this._values[e].v=t,this):(this._keys.push(e),this._values[e]={v:t,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?e._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{enumerable:!0,get:function(){return this._keys.length}}),e.exports=t}})),map_1=map.Map;long__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},long__WEBPACK_IMPORTED_MODULE_0___default.a.fromExtendedJSON=function(e,t){var r=long__WEBPACK_IMPORTED_MODULE_0___default.a.fromString(e.$numberLong);return t&&t.relaxed?r.toNumber():r},Object.defineProperty(long__WEBPACK_IMPORTED_MODULE_0___default.a.prototype,"_bsontype",{value:"Long"});var long_1=long__WEBPACK_IMPORTED_MODULE_0___default.a;function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var Double=function(){function e(t){_classCallCheck(this,e),t instanceof Number&&(t=t.valueOf()),this.value=t}return _createClass(e,[{key:"valueOf",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:{$numberDouble:this.value.toString()}}}],[{key:"fromExtendedJSON",value:function(t,r){return r&&r.relaxed?parseFloat(t.$numberDouble):new e(parseFloat(t.$numberDouble))}}]),e}();Object.defineProperty(Double.prototype,"_bsontype",{value:"Double"});var double_1=Double;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),e}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Timestamp=function(e){function t(e,r){var n;return _classCallCheck$1(this,t),n=long_1.isLong(e)?_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e.low,e.high,!0)):_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,r,!0)),_possibleConstructorReturn(n)}return _inherits(t,e),_createClass$1(t,[{key:"toJSON",value:function(){return{$timestamp:this.toString()}}},{key:"toExtendedJSON",value:function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}}],[{key:"fromInt",value:function(e){return new t(long_1.fromInt(e,!0))}},{key:"fromNumber",value:function(e){return new t(long_1.fromNumber(e,!0))}},{key:"fromBits",value:function(e,r){return new t(e,r)}},{key:"fromString",value:function(e,r){return new t(long_1.fromString(e,r,!0))}},{key:"fromExtendedJSON",value:function(e){return new t(e.$timestamp.i,e.$timestamp.t)}}]),t}(long_1);Object.defineProperty(Timestamp.prototype,"_bsontype",{value:"Timestamp"}),Timestamp.MAX_VALUE=Timestamp.MAX_UNSIGNED_VALUE;var timestamp=Timestamp,require$$0={};function normalizedFunctionString(e){return e.toString().replace("function(","function (")}function insecureRandomBytes(e){for(var t=new Uint8Array(e),r=0;r<e;++r)t[r]=Math.floor(256*Math.random());return t}var randomBytes=insecureRandomBytes;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues)randomBytes=function(e){return window.crypto.getRandomValues(new Uint8Array(e))};else{try{randomBytes=require$$0.randomBytes}catch(e){}null==randomBytes&&(randomBytes=insecureRandomBytes)}var utils={normalizedFunctionString:normalizedFunctionString,randomBytes:randomBytes};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}"function"==typeof global.setTimeout&&(cachedSetTimeout=setTimeout),"function"==typeof global.clearTimeout&&(cachedClearTimeout=clearTimeout);var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function nextTick(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)}function Item(e,t){this.fun=e,this.array=t}Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version="",versions={},release={},config={};function noop(){}var on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop;function binding(e){throw new Error("process.binding is not supported")}function cwd(){return"/"}function chdir(e){throw new Error("process.chdir is not supported")}function umask(){return 0}var performance=global.performance||{},performanceNow=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()};function hrtime(e){var t=.001*performanceNow.call(performance),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]}var startTime=new Date;function uptime(){return(new Date-startTime)/1e3}var process={nextTick:nextTick,title:title,browser:browser,env:env,argv:argv,version:version,versions:versions,on:on,addListener:addListener,once:once,off:off,removeListener:removeListener,removeAllListeners:removeAllListeners,emit:emit,binding:binding,cwd:cwd,chdir:chdir,umask:umask,hrtime:hrtime,platform:platform,release:release,config:config,uptime:uptime},inherits;inherits="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e};var inherits$1=inherits;function _typeof$1(e){return(_typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var formatRegExp=/%[sdj%]/g;function format(e){if(!isString(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(inspect(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,s=String(e).replace(formatRegExp,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r<i;a=n[++r])isNull(a)||!isObject(a)?s+=" "+a:s+=" "+inspect(a);return s}function deprecate(e,t){if(isUndefined(global.process))return function(){return deprecate(e,t).apply(this,arguments)};var r=!1;return function(){return r||(console.error(t),r=!0),e.apply(this,arguments)}}var debugs={},debugEnviron;function debuglog(e){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),e=e.toUpperCase(),!debugs[e])if(new RegExp("\\b"+e+"\\b","i").test(debugEnviron)){debugs[e]=function(){var t=format.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else debugs[e]=function(){};return debugs[e]}function inspect(e,t){var r={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),isBoolean(t)?r.showHidden=t:t&&_extend(r,t),isUndefined(r.showHidden)&&(r.showHidden=!1),isUndefined(r.depth)&&(r.depth=2),isUndefined(r.colors)&&(r.colors=!1),isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,e,r.depth)}function stylizeWithColor(e,t){var r=inspect.styles[t];return r?"["+inspect.colors[r][0]+"m"+e+"["+inspect.colors[r][1]+"m":e}function stylizeNoColor(e,t){return e}function arrayToHash(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}function formatValue(e,t,r){if(e.customInspect&&t&&isFunction(t.inspect)&&t.inspect!==inspect&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return isString(n)||(n=formatValue(e,n,r)),n}var i=formatPrimitive(e,t);if(i)return i;var s=Object.keys(t),a=arrayToHash(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),isError(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return formatError(t);if(0===s.length){if(isFunction(t)){var o=t.name?": "+t.name:"";return e.stylize("[Function"+o+"]","special")}if(isRegExp(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(isDate(t))return e.stylize(Date.prototype.toString.call(t),"date");if(isError(t))return formatError(t)}var u,c="",l=!1,h=["{","}"];(isArray(t)&&(l=!0,h=["[","]"]),isFunction(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return isRegExp(t)&&(c=" "+RegExp.prototype.toString.call(t)),isDate(t)&&(c=" "+Date.prototype.toUTCString.call(t)),isError(t)&&(c=" "+formatError(t)),0!==s.length||l&&0!=t.length?r<0?isRegExp(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=l?formatArray(e,t,r,a,s):s.map((function(n){return formatProperty(e,t,r,a,n,l)})),e.seen.pop(),reduceToSingleString(u,c,h)):h[0]+c+h[1]}function formatPrimitive(e,t){if(isUndefined(t))return e.stylize("undefined","undefined");if(isString(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return isNumber(t)?e.stylize(""+t,"number"):isBoolean(t)?e.stylize(""+t,"boolean"):isNull(t)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,t,r,n,i){for(var s=[],a=0,o=t.length;a<o;++a)hasOwnProperty(t,String(a))?s.push(formatProperty(e,t,r,n,String(a),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(formatProperty(e,t,r,n,i,!0))})),s}function formatProperty(e,t,r,n,i,s){var a,o,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?o=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(o=e.stylize("[Setter]","special")),hasOwnProperty(n,i)||(a="["+i+"]"),o||(e.seen.indexOf(u.value)<0?(o=isNull(r)?formatValue(e,u.value,null):formatValue(e,u.value,r-1)).indexOf("\n")>-1&&(o=s?o.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+o.split("\n").map((function(e){return" "+e})).join("\n")):o=e.stylize("[Circular]","special")),isUndefined(a)){if(s&&i.match(/^\d+$/))return o;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+o}function reduceToSingleString(e,t,r){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"===_typeof$1(e)}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"===_typeof$1(e)&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"===_typeof$1(e)||void 0===e}function isBuffer(e){return Buffer.isBuffer(e)}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp$1(){var e=new Date,t=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],t].join(" ")}function log(){console.log("%s - %s",timestamp$1(),format.apply(null,arguments))}function _extend(e,t){if(!t||!isObject(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var util={inherits:inherits$1,_extend:_extend,log:log,isBuffer:isBuffer,isPrimitive:isPrimitive,isFunction:isFunction,isError:isError,isDate:isDate,isObject:isObject,isRegExp:isRegExp,isUndefined:isUndefined,isSymbol:isSymbol,isString:isString,isNumber:isNumber,isNullOrUndefined:isNullOrUndefined,isNull:isNull,isBoolean:isBoolean,isArray:isArray,inspect:inspect,deprecate:deprecate,format:format,debuglog:debuglog};function _classCallCheck$2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$2(e,t,r){return t&&_defineProperties$2(e.prototype,t),r&&_defineProperties$2(e,r),e}var Buffer$1=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,randomBytes$1=utils.randomBytes,deprecate$1=util.deprecate,PROCESS_UNIQUE=randomBytes$1(5),checkForHexRegExp=new RegExp("^[0-9a-fA-F]{24}$"),hasBufferType=!1;try{Buffer$1&&Buffer$1.from&&(hasBufferType=!0)}catch(e){hasBufferType=!1}for(var hexTable=[],_i=0;_i<256;_i++)hexTable[_i]=(_i<=15?"0":"")+_i.toString(16);for(var decodeLookup=[],i=0;i<10;)decodeLookup[48+i]=i++;for(;i<16;)decodeLookup[55+i]=decodeLookup[87+i]=i++;var _Buffer=Buffer$1;function convertToHex(e){return e.toString("hex")}function makeObjectIdError(e,t){var r=e[t];return new TypeError('ObjectId string "'.concat(e,'" contains invalid character "').concat(r,'" with character code (').concat(e.charCodeAt(t),"). All character codes for a non-hex string must be less than 256."))}var ObjectId=function(){function e(t){if(_classCallCheck$2(this,e),t instanceof e)return t;if(null==t||"number"==typeof t)return this.id=e.generate(t),void(e.cacheHexString&&(this.__id=this.toString("hex")));var r=e.isValid(t);if(!r&&null!=t)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(r&&"string"==typeof t&&24===t.length&&hasBufferType)return new e(Buffer$1.from(t,"hex"));if(r&&"string"==typeof t&&24===t.length)return e.createFromHexString(t);if(null==t||12!==t.length){if(null!=t&&t.toHexString)return e.createFromHexString(t.toHexString());throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}this.id=t,e.cacheHexString&&(this.__id=this.toString("hex"))}return _createClass$2(e,[{key:"toHexString",value:function(){if(e.cacheHexString&&this.__id)return this.__id;var t="";if(!this.id||!this.id.length)throw new TypeError("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(this.id instanceof _Buffer)return t=convertToHex(this.id),e.cacheHexString&&(this.__id=t),t;for(var r=0;r<this.id.length;r++){var n=hexTable[this.id.charCodeAt(r)];if("string"!=typeof n)throw makeObjectIdError(this.id,r);t+=n}return e.cacheHexString&&(this.__id=t),t}},{key:"toString",value:function(e){return this.id&&this.id.copy?this.id.toString("string"==typeof e?e:"hex"):this.toHexString()}},{key:"toJSON",value:function(){return this.toHexString()}},{key:"equals",value:function(t){return t instanceof e?this.toString()===t.toString():"string"==typeof t&&e.isValid(t)&&12===t.length&&this.id instanceof _Buffer?t===this.id.toString("binary"):"string"==typeof t&&e.isValid(t)&&24===t.length?t.toLowerCase()===this.toHexString():"string"==typeof t&&e.isValid(t)&&12===t.length?t===this.id:!(null==t||!(t instanceof e||t.toHexString))&&t.toHexString()===this.toHexString()}},{key:"getTimestamp",value:function(){var e=new Date,t=this.id.readUInt32BE(0);return e.setTime(1e3*Math.floor(t)),e}},{key:"toExtendedJSON",value:function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}}],[{key:"getInc",value:function(){return e.index=(e.index+1)%16777215}},{key:"generate",value:function(t){"number"!=typeof t&&(t=~~(Date.now()/1e3));var r=e.getInc(),n=Buffer$1.alloc(12);return n[3]=255&t,n[2]=t>>8&255,n[1]=t>>16&255,n[0]=t>>24&255,n[4]=PROCESS_UNIQUE[0],n[5]=PROCESS_UNIQUE[1],n[6]=PROCESS_UNIQUE[2],n[7]=PROCESS_UNIQUE[3],n[8]=PROCESS_UNIQUE[4],n[11]=255&r,n[10]=r>>8&255,n[9]=r>>16&255,n}},{key:"createPk",value:function(){return new e}},{key:"createFromTime",value:function(t){var r=Buffer$1.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r[3]=255&t,r[2]=t>>8&255,r[1]=t>>16&255,r[0]=t>>24&255,new e(r)}},{key:"createFromHexString",value:function(t){if(void 0===t||null!=t&&24!==t.length)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(hasBufferType)return new e(Buffer$1.from(t,"hex"));for(var r=new _Buffer(12),n=0,i=0;i<24;)r[n++]=decodeLookup[t.charCodeAt(i++)]<<4|decodeLookup[t.charCodeAt(i++)];return new e(r)}},{key:"isValid",value:function(t){return null!=t&&("number"==typeof t||("string"==typeof t?12===t.length||24===t.length&&checkForHexRegExp.test(t):t instanceof e||(t instanceof _Buffer&&12===t.length||!!t.toHexString&&(12===t.id.length||24===t.id.length&&checkForHexRegExp.test(t.id)))))}},{key:"fromExtendedJSON",value:function(t){return new e(t.$oid)}}]),e}();ObjectId.get_inc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.get_inc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.getInc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.generate=deprecate$1((function(e){return ObjectId.generate(e)}),"Please use the static `ObjectId.generate(time)` instead"),Object.defineProperty(ObjectId.prototype,"generationTime",{enumerable:!0,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(e){this.id[3]=255&e,this.id[2]=e>>8&255,this.id[1]=e>>16&255,this.id[0]=e>>24&255}}),ObjectId.prototype[util.inspect.custom||"inspect"]=ObjectId.prototype.toString,ObjectId.index=~~(16777215*Math.random()),Object.defineProperty(ObjectId.prototype,"_bsontype",{value:"ObjectID"});var objectid=ObjectId;function _classCallCheck$3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$3(e,t,r){return t&&_defineProperties$3(e.prototype,t),r&&_defineProperties$3(e,r),e}function alphabetize(e){return e.split("").sort().join("")}var BSONRegExp=function(){function e(t,r){_classCallCheck$3(this,e),this.pattern=t||"",this.options=r?alphabetize(r):"";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 [".concat(this.options[n],"] is not supported"))}return _createClass$3(e,[{key:"toExtendedJSON",value:function(e){return(e=e||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}}],[{key:"parseOptions",value:function(e){return e?e.split("").sort().join(""):""}},{key:"fromExtendedJSON",value:function(t){return t.$regex?"BSONRegExp"===t.$regex._bsontype?t:new e(t.$regex,e.parseOptions(t.$options)):new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options))}}]),e}();Object.defineProperty(BSONRegExp.prototype,"_bsontype",{value:"BSONRegExp"});var regexp=BSONRegExp;function _classCallCheck$4(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$4(e,t,r){return t&&_defineProperties$4(e.prototype,t),r&&_defineProperties$4(e,r),e}var BSONSymbol=function(){function e(t){_classCallCheck$4(this,e),this.value=t}return _createClass$4(e,[{key:"valueOf",value:function(){return this.value}},{key:"toString",value:function(){return this.value}},{key:"inspect",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(){return{$symbol:this.value}}}],[{key:"fromExtendedJSON",value:function(t){return new e(t.$symbol)}}]),e}();Object.defineProperty(BSONSymbol.prototype,"_bsontype",{value:"Symbol"});var symbol=BSONSymbol;function _classCallCheck$5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$5(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$5(e,t,r){return t&&_defineProperties$5(e.prototype,t),r&&_defineProperties$5(e,r),e}var Int32=function(){function e(t){_classCallCheck$5(this,e),t instanceof Number&&(t=t.valueOf()),this.value=t}return _createClass$5(e,[{key:"valueOf",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}}}],[{key:"fromExtendedJSON",value:function(t,r){return r&&r.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)}}]),e}();Object.defineProperty(Int32.prototype,"_bsontype",{value:"Int32"});var int_32=Int32;function _classCallCheck$6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$6(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$6(e,t,r){return t&&_defineProperties$6(e.prototype,t),r&&_defineProperties$6(e,r),e}var Code=function(){function e(t,r){_classCallCheck$6(this,e),this.code=t,this.scope=r}return _createClass$6(e,[{key:"toJSON",value:function(){return{scope:this.scope,code:this.code}}},{key:"toExtendedJSON",value:function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}}],[{key:"fromExtendedJSON",value:function(t){return new e(t.$code,t.$scope)}}]),e}();Object.defineProperty(Code.prototype,"_bsontype",{value:"Code"});var code=Code,Buffer$2=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,PARSE_STRING_REGEXP=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,PARSE_INF_REGEXP=/^(\+|-)?(Infinity|inf)$/i,PARSE_NAN_REGEXP=/^(\+|-)?NaN$/i,EXPONENT_MAX=6111,EXPONENT_MIN=-6176,EXPONENT_BIAS=6176,MAX_DIGITS=34,NAN_BUFFER=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_NEGATIVE_BUFFER=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_POSITIVE_BUFFER=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),EXPONENT_REGEX=/^([-+])?(\d+)?$/;function isDigit(e){return!isNaN(parseInt(e,10))}function divideu128(e){var t=long_1.fromNumber(1e9),r=long_1.fromNumber(0);if(!(e.parts[0]||e.parts[1]||e.parts[2]||e.parts[3]))return{quotient:e,rem:r};for(var n=0;n<=3;n++)r=(r=r.shiftLeft(32)).add(new long_1(e.parts[n],0)),e.parts[n]=r.div(t).low,r=r.modulo(t);return{quotient:e,rem:r}}function multiply64x2(e,t){if(!e&&!t)return{high:long_1.fromNumber(0),low:long_1.fromNumber(0)};var r=e.shiftRightUnsigned(32),n=new long_1(e.getLowBits(),0),i=t.shiftRightUnsigned(32),s=new long_1(t.getLowBits(),0),a=r.multiply(i),o=r.multiply(s),u=n.multiply(i),c=n.multiply(s);return a=a.add(o.shiftRightUnsigned(32)),o=new long_1(o.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:a=a.add(o.shiftRightUnsigned(32)),low:c=o.shiftLeft(32).add(new long_1(c.getLowBits(),0))}}function lessThan(e,t){var r=e.high>>>0,n=t.high>>>0;return r<n||r===n&&e.low>>>0<t.low>>>0}function invalidErr(e,t){throw new TypeError('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}function Decimal128(e){this.bytes=e}Decimal128.fromString=function(e){var t,r=!1,n=!1,i=!1,s=0,a=0,o=0,u=0,c=0,l=[0],h=0,f=0,d=0,m=0,p=0,b=0,g=[0,0],y=[0,0],v=0;if(e.length>=7e3)throw new TypeError(e+" not a valid Decimal128 string");var w=e.match(PARSE_STRING_REGEXP),_=e.match(PARSE_INF_REGEXP),A=e.match(PARSE_NAN_REGEXP);if(!w&&!_&&!A||0===e.length)throw new TypeError(e+" not a valid Decimal128 string");if(w){var S=w[2],B=w[4],k=w[5],E=w[6];B&&void 0===E&&invalidErr(e,"missing exponent power"),B&&void 0===S&&invalidErr(e,"missing exponent base"),void 0===B&&(k||E)&&invalidErr(e,"missing e before exponent")}if("+"!==e[v]&&"-"!==e[v]||(r="-"===e[v++]),!isDigit(e[v])&&"."!==e[v]){if("i"===e[v]||"I"===e[v])return new Decimal128(Buffer$2.from(r?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));if("N"===e[v])return new Decimal128(Buffer$2.from(NAN_BUFFER))}for(;isDigit(e[v])||"."===e[v];)"."!==e[v]?(h<34&&("0"!==e[v]||i)&&(i||(c=a),i=!0,l[f++]=parseInt(e[v],10),h+=1),i&&(o+=1),n&&(u+=1),a+=1,v+=1):(n&&invalidErr(e,"contains multiple periods"),n=!0,v+=1);if(n&&!a)throw new TypeError(e+" not a valid Decimal128 string");if("e"===e[v]||"E"===e[v]){var O=e.substr(++v).match(EXPONENT_REGEX);if(!O||!O[2])return new Decimal128(Buffer$2.from(NAN_BUFFER));p=parseInt(O[0],10),v+=O[0].length}if(e[v])return new Decimal128(Buffer$2.from(NAN_BUFFER));if(d=0,h){if(m=h-1,1!==(s=o))for(;"0"===e[c+s-1];)s-=1}else d=0,m=0,l[0]=0,o=1,h=1,s=0;for(p<=u&&u-p>16384?p=EXPONENT_MIN:p-=u;p>EXPONENT_MAX;){if((m+=1)-d>MAX_DIGITS){if(l.join("").match(/^0+$/)){p=EXPONENT_MAX;break}invalidErr(e,"overflow")}p-=1}for(;p<EXPONENT_MIN||h<o;){if(0===m&&s<h){p=EXPONENT_MIN,s=0;break}if(h<o?o-=1:m-=1,p<EXPONENT_MAX)p+=1;else{if(l.join("").match(/^0+$/)){p=EXPONENT_MAX;break}invalidErr(e,"overflow")}}if(m-d+1<s){var N=a;n&&(c+=1,N+=1),r&&(c+=1,N+=1);var x=parseInt(e[c+m+1],10),I=0;if(x>=5&&(I=1,5===x))for(I=l[m]%2==1,b=c+m+2;b<N;b++)if(parseInt(e[b],10)){I=1;break}if(I)for(var C=m;C>=0;C--)if(++l[C]>9&&(l[C]=0,0===C)){if(!(p<EXPONENT_MAX))return new Decimal128(Buffer$2.from(r?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));p+=1,l[C]=1}}if(g=long_1.fromNumber(0),y=long_1.fromNumber(0),0===s)g=long_1.fromNumber(0),y=long_1.fromNumber(0);else if(m-d<17){var j=d;for(y=long_1.fromNumber(l[j++]),g=new long_1(0,0);j<=m;j++)y=(y=y.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(l[j]))}else{var T=d;for(g=long_1.fromNumber(l[T++]);T<=m-17;T++)g=(g=g.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(l[T]));for(y=long_1.fromNumber(l[T++]);T<=m;T++)y=(y=y.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(l[T]))}var P=multiply64x2(g,long_1.fromString("100000000000000000"));P.low=P.low.add(y),lessThan(P.low,y)&&(P.high=P.high.add(long_1.fromNumber(1))),t=p+EXPONENT_BIAS;var D={low:long_1.fromNumber(0),high:long_1.fromNumber(0)};P.high.shiftRightUnsigned(49).and(long_1.fromNumber(1)).equals(long_1.fromNumber(1))?(D.high=D.high.or(long_1.fromNumber(3).shiftLeft(61)),D.high=D.high.or(long_1.fromNumber(t).and(long_1.fromNumber(16383).shiftLeft(47))),D.high=D.high.or(P.high.and(long_1.fromNumber(0x7fffffffffff)))):(D.high=D.high.or(long_1.fromNumber(16383&t).shiftLeft(49)),D.high=D.high.or(P.high.and(long_1.fromNumber(562949953421311)))),D.low=P.low,r&&(D.high=D.high.or(long_1.fromString("9223372036854775808")));var U=Buffer$2.alloc(16);return v=0,U[v++]=255&D.low.low,U[v++]=D.low.low>>8&255,U[v++]=D.low.low>>16&255,U[v++]=D.low.low>>24&255,U[v++]=255&D.low.high,U[v++]=D.low.high>>8&255,U[v++]=D.low.high>>16&255,U[v++]=D.low.high>>24&255,U[v++]=255&D.high.low,U[v++]=D.high.low>>8&255,U[v++]=D.high.low>>16&255,U[v++]=D.high.low>>24&255,U[v++]=255&D.high.high,U[v++]=D.high.high>>8&255,U[v++]=D.high.high>>16&255,U[v++]=D.high.high>>24&255,new Decimal128(U)};var COMBINATION_MASK=31,EXPONENT_MASK=16383,COMBINATION_INFINITY=30,COMBINATION_NAN=31;Decimal128.prototype.toString=function(){for(var e,t,r,n,i,s,a=0,o=new Array(36),u=0;u<o.length;u++)o[u]=0;var c,l,h,f,d,m=0,p=!1,b={parts:new Array(4)},g=[];m=0;var y=this.bytes;if(n=y[m++]|y[m++]<<8|y[m++]<<16|y[m++]<<24,r=y[m++]|y[m++]<<8|y[m++]<<16|y[m++]<<24,t=y[m++]|y[m++]<<8|y[m++]<<16|y[m++]<<24,e=y[m++]|y[m++]<<8|y[m++]<<16|y[m++]<<24,m=0,{low:new long_1(n,r),high:new long_1(t,e)}.high.lessThan(long_1.ZERO)&&g.push("-"),(i=e>>26&COMBINATION_MASK)>>3==3){if(i===COMBINATION_INFINITY)return g.join("")+"Infinity";if(i===COMBINATION_NAN)return"NaN";s=e>>15&EXPONENT_MASK,h=8+(e>>14&1)}else h=e>>14&7,s=e>>17&EXPONENT_MASK;if(c=s-EXPONENT_BIAS,b.parts[0]=(16383&e)+((15&h)<<14),b.parts[1]=t,b.parts[2]=r,b.parts[3]=n,0===b.parts[0]&&0===b.parts[1]&&0===b.parts[2]&&0===b.parts[3])p=!0;else for(d=3;d>=0;d--){var v=0,w=divideu128(b);if(b=w.quotient,v=w.rem.low)for(f=8;f>=0;f--)o[9*d+f]=v%10,v=Math.floor(v/10)}if(p)a=1,o[m]=0;else for(a=36;!o[m];)a-=1,m+=1;if((l=a-1+c)>=34||l<=-7||c>0){if(a>34)return g.push(0),c>0?g.push("E+"+c):c<0&&g.push("E"+c),g.join("");g.push(o[m++]),(a-=1)&&g.push(".");for(var _=0;_<a;_++)g.push(o[m++]);g.push("E"),l>0?g.push("+"+l):g.push(l)}else if(c>=0)for(var A=0;A<a;A++)g.push(o[m++]);else{var S=a+c;if(S>0)for(var B=0;B<S;B++)g.push(o[m++]);else g.push("0");for(g.push(".");S++<0;)g.push("0");for(var k=0;k<a-Math.max(S-1,0);k++)g.push(o[m++])}return g.join("")},Decimal128.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.fromExtendedJSON=function(e){return Decimal128.fromString(e.$numberDecimal)},Object.defineProperty(Decimal128.prototype,"_bsontype",{value:"Decimal128"});var decimal128=Decimal128;function _classCallCheck$7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$7(e,t,r){return t&&_defineProperties$7(e.prototype,t),r&&_defineProperties$7(e,r),e}var MinKey=function(){function e(){_classCallCheck$7(this,e)}return _createClass$7(e,[{key:"toExtendedJSON",value:function(){return{$minKey:1}}}],[{key:"fromExtendedJSON",value:function(){return new e}}]),e}();Object.defineProperty(MinKey.prototype,"_bsontype",{value:"MinKey"});var min_key=MinKey;function _classCallCheck$8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$8(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$8(e,t,r){return t&&_defineProperties$8(e.prototype,t),r&&_defineProperties$8(e,r),e}var MaxKey=function(){function e(){_classCallCheck$8(this,e)}return _createClass$8(e,[{key:"toExtendedJSON",value:function(){return{$maxKey:1}}}],[{key:"fromExtendedJSON",value:function(){return new e}}]),e}();Object.defineProperty(MaxKey.prototype,"_bsontype",{value:"MaxKey"});var max_key=MaxKey;function _classCallCheck$9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$9(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$9(e,t,r){return t&&_defineProperties$9(e.prototype,t),r&&_defineProperties$9(e,r),e}var DBRef=function(){function e(t,r,n,i){_classCallCheck$9(this,e);var s=t.split(".");2===s.length&&(n=s.shift(),t=s.shift()),this.collection=t,this.oid=r,this.db=n,this.fields=i||{}}return _createClass$9(e,[{key:"toJSON",value:function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(e.$db=this.db),e}},{key:"toExtendedJSON",value:function(e){e=e||{};var t={$ref:this.collection,$id:this.oid};return e.legacy?t:(this.db&&(t.$db=this.db),t=Object.assign(t,this.fields))}}],[{key:"fromExtendedJSON",value:function(t){var r=Object.assign({},t);return["$ref","$id","$db"].forEach((function(e){return delete r[e]})),new e(t.$ref,t.$id,t.$db,r)}}]),e}();Object.defineProperty(DBRef.prototype,"_bsontype",{value:"DBRef"}),Object.defineProperty(DBRef.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},configurable:!1});var db_ref=DBRef;function _classCallCheck$a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$a(e,t,r){return t&&_defineProperties$a(e.prototype,t),r&&_defineProperties$a(e,r),e}var Buffer$3=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,Binary=function(){function e(t,r){if(_classCallCheck$a(this,e),!(null==t||"string"==typeof t||Buffer$3.isBuffer(t)||t instanceof Uint8Array||Array.isArray(t)))throw new TypeError("only String, Buffer, Uint8Array or Array accepted");if(this.sub_type=null==r?BSON_BINARY_SUBTYPE_DEFAULT:r,this.position=0,null==t||t instanceof Number)void 0!==Buffer$3?this.buffer=Buffer$3.alloc(e.BUFFER_SIZE):"undefined"!=typeof Uint8Array?this.buffer=new Uint8Array(new ArrayBuffer(e.BUFFER_SIZE)):this.buffer=new Array(e.BUFFER_SIZE);else{if("string"==typeof t)if(void 0!==Buffer$3)this.buffer=Buffer$3.from(t);else{if("undefined"==typeof Uint8Array&&!Array.isArray(t))throw new TypeError("only String, Buffer, Uint8Array or Array accepted");this.buffer=writeStringToArray(t)}else this.buffer=t;this.position=t.length}}return _createClass$a(e,[{key:"put",value:function(t){if(null!=t.length&&"number"!=typeof t&&1!==t.length)throw new TypeError("only accepts single character String, Uint8Array or Array");if("number"!=typeof t&&t<0||t>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");var r=null;if(r="string"==typeof t?t.charCodeAt(0):null!=t.length?t[0]:t,this.buffer.length>this.position)this.buffer[this.position++]=r;else if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer)){var n=Buffer$3.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}else{var i=null;i=isUint8Array(this.buffer)?new Uint8Array(new ArrayBuffer(e.BUFFER_SIZE+this.buffer.length)):new Array(e.BUFFER_SIZE+this.buffer.length);for(var s=0;s<this.buffer.length;s++)i[s]=this.buffer[s];this.buffer=i,this.buffer[this.position++]=r}}},{key:"write",value:function(e,t){if(t="number"==typeof t?t:this.position,this.buffer.length<t+e.length){var r=null;if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer))r=Buffer$3.alloc(this.buffer.length+e.length),this.buffer.copy(r,0,0,this.buffer.length);else if(isUint8Array(this.buffer)){r=new Uint8Array(new ArrayBuffer(this.buffer.length+e.length));for(var n=0;n<this.position;n++)r[n]=this.buffer[n]}this.buffer=r}if(void 0!==Buffer$3&&Buffer$3.isBuffer(e)&&Buffer$3.isBuffer(this.buffer))e.copy(this.buffer,t,0,e.length),this.position=t+e.length>this.position?t+e.length:this.position;else if(void 0!==Buffer$3&&"string"==typeof e&&Buffer$3.isBuffer(this.buffer))this.buffer.write(e,t,"binary"),this.position=t+e.length>this.position?t+e.length:this.position;else if(isUint8Array(e)||Array.isArray(e)&&"string"!=typeof e){for(var i=0;i<e.length;i++)this.buffer[t++]=e[i];this.position=t>this.position?t:this.position}else if("string"==typeof e){for(var s=0;s<e.length;s++)this.buffer[t++]=e.charCodeAt(s);this.position=t>this.position?t:this.position}}},{key:"read",value:function(e,t){if(t=t&&t>0?t:this.position,this.buffer.slice)return this.buffer.slice(e,e+t);for(var r="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(t)):new Array(t),n=0;n<t;n++)r[n]=this.buffer[e++];return r}},{key:"value",value:function(e){if((e=null!=e&&e)&&void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer)&&this.buffer.length===this.position)return this.buffer;if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer))return e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position);if(e){if(null!=this.buffer.slice)return this.buffer.slice(0,this.position);for(var t=isUint8Array(this.buffer)?new Uint8Array(new ArrayBuffer(this.position)):new Array(this.position),r=0;r<this.position;r++)t[r]=this.buffer[r];return t}return convertArraytoUtf8BinaryString(this.buffer,0,this.position)}},{key:"length",value:function(){return this.position}},{key:"toJSON",value:function(){return null!=this.buffer?this.buffer.toString("base64"):""}},{key:"toString",value:function(e){return null!=this.buffer?this.buffer.slice(0,this.position).toString(e):""}},{key:"toExtendedJSON",value:function(e){e=e||{};var t=Buffer$3.isBuffer(this.buffer)?this.buffer.toString("base64"):Buffer$3.from(this.buffer).toString("base64"),r=Number(this.sub_type).toString(16);return e.legacy?{$binary:t,$type:1===r.length?"0"+r:r}:{$binary:{base64:t,subType:1===r.length?"0"+r:r}}}}],[{key:"fromExtendedJSON",value:function(t,r){var n,i;return(r=r||{}).legacy?(i=t.$type?parseInt(t.$type,16):0,n=Buffer$3.from(t.$binary,"base64")):(i=t.$binary.subType?parseInt(t.$binary.subType,16):0,n=Buffer$3.from(t.$binary.base64,"base64")),new e(n,i)}}]),e}(),BSON_BINARY_SUBTYPE_DEFAULT=0;function isUint8Array(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)}function writeStringToArray(e){for(var t="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(e.length)):new Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function convertArraytoUtf8BinaryString(e,t,r){for(var n="",i=t;i<r;i++)n+=String.fromCharCode(e[i]);return n}Binary.BUFFER_SIZE=256,Binary.SUBTYPE_DEFAULT=0,Binary.SUBTYPE_FUNCTION=1,Binary.SUBTYPE_BYTE_ARRAY=2,Binary.SUBTYPE_UUID_OLD=3,Binary.SUBTYPE_UUID=4,Binary.SUBTYPE_MD5=5,Binary.SUBTYPE_USER_DEFINED=128,Object.defineProperty(Binary.prototype,"_bsontype",{value:"Binary"});var binary=Binary,constants={BSON_INT32_MAX:2147483647,BSON_INT32_MIN:-2147483648,BSON_INT64_MAX:Math.pow(2,63)-1,BSON_INT64_MIN:-Math.pow(2,63),JS_INT_MAX:9007199254740992,JS_INT_MIN:-9007199254740992,BSON_DATA_NUMBER:1,BSON_DATA_STRING:2,BSON_DATA_OBJECT:3,BSON_DATA_ARRAY:4,BSON_DATA_BINARY:5,BSON_DATA_UNDEFINED:6,BSON_DATA_OID:7,BSON_DATA_BOOLEAN:8,BSON_DATA_DATE:9,BSON_DATA_NULL:10,BSON_DATA_REGEXP:11,BSON_DATA_DBPOINTER:12,BSON_DATA_CODE:13,BSON_DATA_SYMBOL:14,BSON_DATA_CODE_W_SCOPE:15,BSON_DATA_INT:16,BSON_DATA_TIMESTAMP:17,BSON_DATA_LONG:18,BSON_DATA_DECIMAL128:19,BSON_DATA_MIN_KEY:255,BSON_DATA_MAX_KEY:127,BSON_BINARY_SUBTYPE_DEFAULT:0,BSON_BINARY_SUBTYPE_FUNCTION:1,BSON_BINARY_SUBTYPE_BYTE_ARRAY:2,BSON_BINARY_SUBTYPE_UUID:3,BSON_BINARY_SUBTYPE_MD5:4,BSON_BINARY_SUBTYPE_USER_DEFINED:128};function _typeof$2(e){return(_typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var keysToCodecs={$oid:objectid,$binary:binary,$symbol:symbol,$numberInt:int_32,$numberDecimal:decimal128,$numberDouble:double_1,$numberLong:long_1,$minKey:min_key,$maxKey:max_key,$regex:regexp,$regularExpression:regexp,$timestamp:timestamp};function deserializeValue(e,t,r,n){if("number"==typeof r){if(n.relaxed||n.legacy)return r;if(Math.floor(r)===r){if(r>=BSON_INT32_MIN&&r<=BSON_INT32_MAX)return new int_32(r);if(r>=BSON_INT64_MIN&&r<=BSON_INT64_MAX)return new long_1.fromNumber(r)}return new double_1(r)}if(null==r||"object"!==_typeof$2(r))return r;if(r.$undefined)return null;for(var i=Object.keys(r).filter((function(e){return e.startsWith("$")&&null!=r[e]})),s=0;s<i.length;s++){var a=keysToCodecs[i[s]];if(a)return a.fromExtendedJSON(r,n)}if(null!=r.$date){var o=r.$date,u=new Date;return n.legacy?"number"==typeof o?u.setTime(o):"string"==typeof o&&u.setTime(Date.parse(o)):"string"==typeof o?u.setTime(Date.parse(o)):long_1.isLong(o)?u.setTime(o.toNumber()):"number"==typeof o&&n.relaxed&&u.setTime(o),u}if(null!=r.$code){var c=Object.assign({},r);return r.$scope&&(c.$scope=deserializeValue(e,null,r.$scope)),code.fromExtendedJSON(r)}if(null!=r.$ref||null!=r.$dbPointer){var l=r.$ref?r:r.$dbPointer;if(l instanceof db_ref)return l;var h=Object.keys(l).filter((function(e){return e.startsWith("$")})),f=!0;if(h.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(f=!1)})),f)return db_ref.fromExtendedJSON(l)}return r}function parse(e,t){var r=this;return"boolean"==typeof(t=Object.assign({},{relaxed:!0,legacy:!1},t)).relaxed&&(t.strict=!t.relaxed),"boolean"==typeof t.strict&&(t.relaxed=!t.strict),JSON.parse(e,(function(e,n){return deserializeValue(r,e,n,t)}))}var BSON_INT32_MAX=2147483647,BSON_INT32_MIN=-2147483648,BSON_INT64_MAX=0x8000000000000000,BSON_INT64_MIN=-0x8000000000000000;function stringify(e,t,r,n){null!=r&&"object"===_typeof$2(r)&&(n=r,r=0),null==t||"object"!==_typeof$2(t)||Array.isArray(t)||(n=t,t=null,r=0),n=Object.assign({},{relaxed:!0,legacy:!1},n);var i=Array.isArray(e)?serializeArray(e,n):serializeDocument(e,n);return JSON.stringify(i,t,r)}function serialize(e,t){return t=t||{},JSON.parse(stringify(e,t))}function deserialize(e,t){return t=t||{},parse(JSON.stringify(e),t)}function serializeArray(e,t){return e.map((function(e){return serializeValue(e,t)}))}function getISOString(e){var t=e.toISOString();return 0!==e.getUTCMilliseconds()?t:t.slice(0,-5)+"Z"}function serializeValue(e,t){if(Array.isArray(e))return serializeArray(e,t);if(void 0===e)return null;if(e instanceof Date){var r=e.getTime(),n=r>-1&&r<2534023188e5;return t.legacy?t.relaxed&&n?{$date:e.getTime()}:{$date:getISOString(e)}:t.relaxed&&n?{$date:getISOString(e)}:{$date:{$numberLong:e.getTime().toString()}}}if("number"==typeof e&&!t.relaxed){if(Math.floor(e)===e){var i=e>=BSON_INT64_MIN&&e<=BSON_INT64_MAX;if(e>=BSON_INT32_MIN&&e<=BSON_INT32_MAX)return{$numberInt:e.toString()};if(i)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp){var s=e.flags;return void 0===s&&(s=e.toString().match(/[gimuy]*$/)[0]),new regexp(e.source,s).toExtendedJSON(t)}return null!=e&&"object"===_typeof$2(e)?serializeDocument(e,t):e}var BSON_TYPE_MAPPINGS={Binary:function(e){return new binary(e.value(),e.subtype)},Code:function(e){return new code(e.code,e.scope)},DBRef:function(e){return new db_ref(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new decimal128(e.bytes)},Double:function(e){return new double_1(e.value)},Int32:function(e){return new int_32(e.value)},Long:function(e){return long_1.fromBits(null!=e.low?e.low:e.low_,null!=e.low?e.high:e.high_,null!=e.low?e.unsigned:e.unsigned_)},MaxKey:function(){return new max_key},MinKey:function(){return new min_key},ObjectID:function(e){return new objectid(e)},ObjectId:function(e){return new objectid(e)},BSONRegExp:function(e){return new regexp(e.pattern,e.options)},Symbol:function(e){return new symbol(e.value)},Timestamp:function(e){return timestamp.fromBits(e.low,e.high)}};function serializeDocument(e,t){if(null==e||"object"!==_typeof$2(e))throw new Error("not an object instance");var r=e._bsontype;if(void 0===r){var n={};for(var i in e)n[i]=serializeValue(e[i],t);return n}if("string"==typeof r){var s=e;if("function"!=typeof s.toExtendedJSON){var a=BSON_TYPE_MAPPINGS[r];if(!a)throw new TypeError("Unrecognized or invalid _bsontype: "+r);s=a(s)}return"Code"===r&&s.scope?s=new code(s.code,serializeValue(s.scope,t)):"DBRef"===r&&s.oid&&(s=new db_ref(s.collection,serializeValue(s.oid,t),s.db,s.fields)),s.toExtendedJSON(t)}throw new Error("_bsontype must be a string, but was: "+_typeof$2(r))}var extended_json={parse:parse,deserialize:deserialize,serialize:serialize,stringify:stringify},FIRST_BIT=128,FIRST_TWO_BITS=192,FIRST_THREE_BITS=224,FIRST_FOUR_BITS=240,FIRST_FIVE_BITS=248,TWO_BIT_CHAR=192,THREE_BIT_CHAR=224,FOUR_BIT_CHAR=240,CONTINUING_CHAR=128;function validateUtf8(e,t,r){for(var n=0,i=t;i<r;i+=1){var s=e[i];if(n){if((s&FIRST_TWO_BITS)!==CONTINUING_CHAR)return!1;n-=1}else if(s&FIRST_BIT)if((s&FIRST_THREE_BITS)===TWO_BIT_CHAR)n=1;else if((s&FIRST_FOUR_BITS)===THREE_BIT_CHAR)n=2;else{if((s&FIRST_FIVE_BITS)!==FOUR_BIT_CHAR)return!1;n=3}}return!n}var validateUtf8_1=validateUtf8,validate_utf8={validateUtf8:validateUtf8_1},Buffer$4=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,validateUtf8$1=validate_utf8.validateUtf8,JS_INT_MAX_LONG=long_1.fromNumber(constants.JS_INT_MAX),JS_INT_MIN_LONG=long_1.fromNumber(constants.JS_INT_MIN),functionCache={};function deserialize$1(e,t,r){var n=(t=null==t?{}:t)&&t.index?t.index:0,i=e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24;if(i<5)throw new Error("bson size must be >= 5, is ".concat(i));if(t.allowObjectSmallerThanBufferSize&&e.length<i)throw new Error("buffer length ".concat(e.length," must be >= bson size ").concat(i));if(!t.allowObjectSmallerThanBufferSize&&e.length!==i)throw new Error("buffer length ".concat(e.length," must === bson size ").concat(i));if(i+n>e.length)throw new Error("(bson size ".concat(i," + options.index ").concat(n," must be <= buffer length ").concat(Buffer$4.byteLength(e),")"));if(0!==e[n+i-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return deserializeObject(e,n,t,r)}function deserializeObject(e,t,r,n){var i=null!=r.evalFunctions&&r.evalFunctions,s=null!=r.cacheFunctions&&r.cacheFunctions,a=null!=r.cacheFunctionsCrc32&&r.cacheFunctionsCrc32;if(!a)var o=null;var u=null==r.fieldsAsRaw?null:r.fieldsAsRaw,c=null!=r.raw&&r.raw,l="boolean"==typeof r.bsonRegExp&&r.bsonRegExp,h=null!=r.promoteBuffers&&r.promoteBuffers,f=null==r.promoteLongs||r.promoteLongs,d=null==r.promoteValues||r.promoteValues,m=t;if(e.length<5)throw new Error("corrupt bson message < 5 bytes long");var p=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(p<5||p>e.length)throw new Error("corrupt bson message");for(var b=n?[]:{},g=0;;){var y=e[t++];if(0===y)break;for(var v=t;0!==e[v]&&v<e.length;)v++;if(v>=Buffer$4.byteLength(e))throw new Error("Bad BSON Document: illegal CString");var w=n?g++:e.toString("utf8",t,v);if(t=v+1,y===constants.BSON_DATA_STRING){var _=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(_<=0||_>e.length-t||0!==e[t+_-1])throw new Error("bad string length in bson");if(!validateUtf8$1(e,t,t+_-1))throw new Error("Invalid UTF-8 string in BSON document");var A=e.toString("utf8",t,t+_-1);b[w]=A,t+=_}else if(y===constants.BSON_DATA_OID){var S=Buffer$4.alloc(12);e.copy(S,0,t,t+12),b[w]=new objectid(S),t+=12}else if(y===constants.BSON_DATA_INT&&!1===d)b[w]=new int_32(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24);else if(y===constants.BSON_DATA_INT)b[w]=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;else if(y===constants.BSON_DATA_NUMBER&&!1===d)b[w]=new double_1(e.readDoubleLE(t)),t+=8;else if(y===constants.BSON_DATA_NUMBER)b[w]=e.readDoubleLE(t),t+=8;else if(y===constants.BSON_DATA_DATE){var B=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,k=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;b[w]=new Date(new long_1(B,k).toNumber())}else if(y===constants.BSON_DATA_BOOLEAN){if(0!==e[t]&&1!==e[t])throw new Error("illegal boolean type value");b[w]=1===e[t++]}else if(y===constants.BSON_DATA_OBJECT){var E=t,O=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;if(O<=0||O>e.length-t)throw new Error("bad embedded document length in bson");b[w]=c?e.slice(t,t+O):deserializeObject(e,E,r,!1),t+=O}else if(y===constants.BSON_DATA_ARRAY){var N=t,x=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24,I=r,C=t+x;if(u&&u[w]){for(var j in I={},r)I[j]=r[j];I.raw=!0}if(b[w]=deserializeObject(e,N,I,!0),0!==e[(t+=x)-1])throw new Error("invalid array terminator byte");if(t!==C)throw new Error("corrupted array bson")}else if(y===constants.BSON_DATA_UNDEFINED)b[w]=void 0;else if(y===constants.BSON_DATA_NULL)b[w]=null;else if(y===constants.BSON_DATA_LONG){var T=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,P=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,D=new long_1(T,P);b[w]=f&&!0===d&&D.lessThanOrEqual(JS_INT_MAX_LONG)&&D.greaterThanOrEqual(JS_INT_MIN_LONG)?D.toNumber():D}else if(y===constants.BSON_DATA_DECIMAL128){var U=Buffer$4.alloc(16);e.copy(U,0,t,t+16),t+=16;var L=new decimal128(U);b[w]=L.toObject?L.toObject():L}else if(y===constants.BSON_DATA_BINARY){var R=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,M=R,$=e[t++];if(R<0)throw new Error("Negative binary type element size found");if(R>Buffer$4.byteLength(e))throw new Error("Binary type size larger than document size");if(null!=e.slice){if($===binary.SUBTYPE_BYTE_ARRAY){if((R=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(R>M-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(R<M-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}b[w]=h&&d?e.slice(t,t+R):new binary(e.slice(t,t+R),$)}else{var H="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(R)):new Array(R);if($===binary.SUBTYPE_BYTE_ARRAY){if((R=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(R>M-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(R<M-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}for(v=0;v<R;v++)H[v]=e[t+v];b[w]=h&&d?H:new binary(H,$)}t+=R}else if(y===constants.BSON_DATA_REGEXP&&!1===l){for(v=t;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var V=e.toString("utf8",t,v);for(v=t=v+1;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var F=e.toString("utf8",t,v);t=v+1;var K=new Array(F.length);for(v=0;v<F.length;v++)switch(F[v]){case"m":K[v]="m";break;case"s":K[v]="g";break;case"i":K[v]="i"}b[w]=new RegExp(V,K.join(""))}else if(y===constants.BSON_DATA_REGEXP&&!0===l){for(v=t;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var z=e.toString("utf8",t,v);for(v=t=v+1;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var q=e.toString("utf8",t,v);t=v+1,b[w]=new regexp(z,q)}else if(y===constants.BSON_DATA_SYMBOL){var J=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(J<=0||J>e.length-t||0!==e[t+J-1])throw new Error("bad string length in bson");b[w]=e.toString("utf8",t,t+J-1),t+=J}else if(y===constants.BSON_DATA_TIMESTAMP){var Y=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,G=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;b[w]=new timestamp(Y,G)}else if(y===constants.BSON_DATA_MIN_KEY)b[w]=new min_key;else if(y===constants.BSON_DATA_MAX_KEY)b[w]=new max_key;else if(y===constants.BSON_DATA_CODE){var W=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(W<=0||W>e.length-t||0!==e[t+W-1])throw new Error("bad string length in bson");var X=e.toString("utf8",t,t+W-1);if(i)if(s){var Q=a?o(X):X;b[w]=isolateEvalWithHash(functionCache,Q,X,b)}else b[w]=isolateEval(X);else b[w]=new code(X);t+=W}else if(y===constants.BSON_DATA_CODE_W_SCOPE){var Z=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(Z<13)throw new Error("code_w_scope total size shorter minimum expected length");var ee=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(ee<=0||ee>e.length-t||0!==e[t+ee-1])throw new Error("bad string length in bson");var te=e.toString("utf8",t,t+ee-1),re=t+=ee,ne=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24,ie=deserializeObject(e,re,r,!1);if(t+=ne,Z<8+ne+ee)throw new Error("code_w_scope total size is to short, truncating scope");if(Z>8+ne+ee)throw new Error("code_w_scope total size is to long, clips outer document");if(i){if(s){var se=a?o(te):te;b[w]=isolateEvalWithHash(functionCache,se,te,b)}else b[w]=isolateEval(te);b[w].scope=ie}else b[w]=new code(te,ie)}else{if(y!==constants.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+y.toString(16)+' for fieldname "'+w+'", are you using the latest BSON parser?');var ae=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(ae<=0||ae>e.length-t||0!==e[t+ae-1])throw new Error("bad string length in bson");if(!validateUtf8$1(e,t,t+ae-1))throw new Error("Invalid UTF-8 string in BSON document");var oe=e.toString("utf8",t,t+ae-1);t+=ae;var ue=Buffer$4.alloc(12);e.copy(ue,0,t,t+12);var ce=new objectid(ue);t+=12,b[w]=new db_ref(oe,ce)}}if(p!==t-m){if(n)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}var le=Object.keys(b).filter((function(e){return e.startsWith("$")})),he=!0;if(le.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(he=!1)})),!he)return b;if(null!=b.$id&&null!=b.$ref){var fe=Object.assign({},b);return delete fe.$ref,delete fe.$id,delete fe.$db,new db_ref(b.$ref,b.$id,b.$db||null,fe)}return b}function isolateEvalWithHash(functionCache,hash,functionString,object){var value=null;return null==functionCache[hash]&&(eval("value = "+functionString),functionCache[hash]=value),functionCache[hash].bind(object)}function isolateEval(functionString){var value=null;return eval("value = "+functionString),value}var deserializer=deserialize$1;function readIEEE754(e,t,r,n,i){var s,a,o="big"===r,u=8*i-n-1,c=(1<<u)-1,l=c>>1,h=-7,f=o?0:i-1,d=o?1:-1,m=e[t+f];for(f+=d,s=m&(1<<-h)-1,m>>=-h,h+=u;h>0;s=256*s+e[t+f],f+=d,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=256*a+e[t+f],f+=d,h-=8);if(0===s)s=1-l;else{if(s===c)return a?NaN:1/0*(m?-1:1);a+=Math.pow(2,n),s-=l}return(m?-1:1)*a*Math.pow(2,s-n)}function writeIEEE754(e,t,r,n,i,s){var a,o,u,c="big"===n,l=8*s-i-1,h=(1<<l)-1,f=h>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,m=c?s-1:0,p=c?-1:1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=h?(o=0,a=h):a+f>=1?(o=(t*u-1)*Math.pow(2,i),a+=f):(o=t*Math.pow(2,f-1)*Math.pow(2,i),a=0)),isNaN(t)&&(o=0);i>=8;)e[r+m]=255&o,m+=p,o/=256,i-=8;for(a=a<<i|o,isNaN(t)&&(a+=8),l+=i;l>0;)e[r+m]=255&a,m+=p,a/=256,l-=8;e[r+m-p]|=128*b}var float_parser={readIEEE754:readIEEE754,writeIEEE754:writeIEEE754};function _typeof$3(e){return(_typeof$3="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Buffer$5=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,writeIEEE754$1=float_parser.writeIEEE754,normalizedFunctionString$1=utils.normalizedFunctionString,regexp$1=/\x00/,ignoreKeys=new Set(["$db","$ref","$id","$clusterTime"]),isDate$1=function(e){return"object"===_typeof$3(e)&&"[object Date]"===Object.prototype.toString.call(e)},isRegExp$1=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)};function serializeString(e,t,r,n,i){e[n++]=constants.BSON_DATA_STRING;var s=i?e.write(t,n,"ascii"):e.write(t,n,"utf8");e[(n=n+s+1)-1]=0;var a=e.write(r,n+4,"utf8");return e[n+3]=a+1>>24&255,e[n+2]=a+1>>16&255,e[n+1]=a+1>>8&255,e[n]=a+1&255,n=n+4+a,e[n++]=0,n}function serializeNumber(e,t,r,n,i){if(Math.floor(r)===r&&r>=constants.JS_INT_MIN&&r<=constants.JS_INT_MAX)if(r>=constants.BSON_INT32_MIN&&r<=constants.BSON_INT32_MAX)e[n++]=constants.BSON_DATA_INT,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=r>>16&255,e[n++]=r>>24&255;else if(r>=constants.JS_INT_MIN&&r<=constants.JS_INT_MAX){e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r,n,"little",52,8),n+=8}else{e[n++]=constants.BSON_DATA_LONG,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var s=long_1.fromNumber(r),a=s.getLowBits(),o=s.getHighBits();e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=o>>16&255,e[n++]=o>>24&255}else e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r,n,"little",52,8),n+=8;return n}function serializeNull(e,t,r,n,i){return e[n++]=constants.BSON_DATA_NULL,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,n}function serializeBoolean(e,t,r,n,i){return e[n++]=constants.BSON_DATA_BOOLEAN,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=r?1:0,n}function serializeDate(e,t,r,n,i){e[n++]=constants.BSON_DATA_DATE,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var s=long_1.fromNumber(r.getTime()),a=s.getLowBits(),o=s.getHighBits();return e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=o>>16&255,e[n++]=o>>24&255,n}function serializeRegExp(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_REGEXP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,r.source&&null!=r.source.match(regexp$1))throw Error("value "+r.source+" must not contain null bytes");return n+=e.write(r.source,n,"utf8"),e[n++]=0,r.ignoreCase&&(e[n++]=105),r.global&&(e[n++]=115),r.multiline&&(e[n++]=109),e[n++]=0,n}function serializeBSONRegExp(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_REGEXP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,null!=r.pattern.match(regexp$1))throw Error("pattern "+r.pattern+" must not contain null bytes");return n+=e.write(r.pattern,n,"utf8"),e[n++]=0,n+=e.write(r.options.split("").sort().join(""),n,"utf8"),e[n++]=0,n}function serializeMinMax(e,t,r,n,i){return null===r?e[n++]=constants.BSON_DATA_NULL:"MinKey"===r._bsontype?e[n++]=constants.BSON_DATA_MIN_KEY:e[n++]=constants.BSON_DATA_MAX_KEY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,n}function serializeObjectId(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_OID,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,"string"==typeof r.id)e.write(r.id,n,"binary");else{if(!r.id||!r.id.copy)throw new TypeError("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(e,n,0,12)}return n+12}function serializeBuffer(e,t,r,n,i){e[n++]=constants.BSON_DATA_BINARY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var s=r.length;return e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,e[n++]=constants.BSON_BINARY_SUBTYPE_DEFAULT,r.copy(e,n,0,s),n+=s}function serializeObject(e,t,r,n,i,s,a,o,u,c){for(var l=0;l<c.length;l++)if(c[l]===r)throw new Error("cyclic dependency detected");c.push(r),e[n++]=Array.isArray(r)?constants.BSON_DATA_ARRAY:constants.BSON_DATA_OBJECT,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var h=serializeInto(e,r,i,n,s+1,a,o,c);return c.pop(),h}function serializeDecimal128(e,t,r,n,i){return e[n++]=constants.BSON_DATA_DECIMAL128,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,r.bytes.copy(e,n,0,16),n+16}function serializeLong(e,t,r,n,i){e[n++]="Long"===r._bsontype?constants.BSON_DATA_LONG:constants.BSON_DATA_TIMESTAMP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var s=r.getLowBits(),a=r.getHighBits();return e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,n}function serializeInt32(e,t,r,n,i){return e[n++]=constants.BSON_DATA_INT,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=r>>16&255,e[n++]=r>>24&255,n}function serializeDouble(e,t,r,n,i){return e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r.value,n,"little",52,8),n+=8}function serializeFunction(e,t,r,n,i,s,a){e[n++]=constants.BSON_DATA_CODE,n+=a?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=normalizedFunctionString$1(r),u=e.write(o,n+4,"utf8")+1;return e[n]=255&u,e[n+1]=u>>8&255,e[n+2]=u>>16&255,e[n+3]=u>>24&255,n=n+4+u-1,e[n++]=0,n}function serializeCode(e,t,r,n,i,s,a,o,u){if(r.scope&&"object"===_typeof$3(r.scope)){e[n++]=constants.BSON_DATA_CODE_W_SCOPE,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var c=n,l="string"==typeof r.code?r.code:r.code.toString();n+=4;var h=e.write(l,n+4,"utf8")+1;e[n]=255&h,e[n+1]=h>>8&255,e[n+2]=h>>16&255,e[n+3]=h>>24&255,e[n+4+h-1]=0,n=n+h+4;var f=serializeInto(e,r.scope,i,n,s+1,a,o);n=f-1;var d=f-c;e[c++]=255&d,e[c++]=d>>8&255,e[c++]=d>>16&255,e[c++]=d>>24&255,e[n++]=0}else{e[n++]=constants.BSON_DATA_CODE,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var m=r.code.toString(),p=e.write(m,n+4,"utf8")+1;e[n]=255&p,e[n+1]=p>>8&255,e[n+2]=p>>16&255,e[n+3]=p>>24&255,n=n+4+p-1,e[n++]=0}return n}function serializeBinary(e,t,r,n,i){e[n++]=constants.BSON_DATA_BINARY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var s=r.value(!0),a=r.position;return r.sub_type===binary.SUBTYPE_BYTE_ARRAY&&(a+=4),e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,e[n++]=r.sub_type,r.sub_type===binary.SUBTYPE_BYTE_ARRAY&&(a-=4,e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255),s.copy(e,n,0,r.position),n+=r.position}function serializeSymbol(e,t,r,n,i){e[n++]=constants.BSON_DATA_SYMBOL,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var s=e.write(r.value,n+4,"utf8")+1;return e[n]=255&s,e[n+1]=s>>8&255,e[n+2]=s>>16&255,e[n+3]=s>>24&255,n=n+4+s-1,e[n++]=0,n}function serializeDBRef(e,t,r,n,i,s,a){e[n++]=constants.BSON_DATA_OBJECT,n+=a?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o,u=n,c={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(c.$db=r.db);var l=(o=serializeInto(e,c=Object.assign(c,r.fields),!1,n,i+1,s))-u;return e[u++]=255&l,e[u++]=l>>8&255,e[u++]=l>>16&255,e[u++]=l>>24&255,o}function serializeInto(e,t,r,n,i,s,a,o){n=n||0,(o=o||[]).push(t);var u=n+4;if(Array.isArray(t))for(var c=0;c<t.length;c++){var l=""+c,h=t[c];if(h&&h.toBSON){if("function"!=typeof h.toBSON)throw new TypeError("toBSON is not a function");h=h.toBSON()}var f=_typeof$3(h);if("string"===f)u=serializeString(e,l,h,u,!0);else if("number"===f)u=serializeNumber(e,l,h,u,!0);else if("boolean"===f)u=serializeBoolean(e,l,h,u,!0);else if(h instanceof Date||isDate$1(h))u=serializeDate(e,l,h,u,!0);else if(void 0===h)u=serializeNull(e,l,h,u,!0);else if(null===h)u=serializeNull(e,l,h,u,!0);else if("ObjectId"===h._bsontype||"ObjectID"===h._bsontype)u=serializeObjectId(e,l,h,u,!0);else if(Buffer$5.isBuffer(h))u=serializeBuffer(e,l,h,u,!0);else if(h instanceof RegExp||isRegExp$1(h))u=serializeRegExp(e,l,h,u,!0);else if("object"===f&&null==h._bsontype)u=serializeObject(e,l,h,u,r,i,s,a,!0,o);else if("object"===f&&"Decimal128"===h._bsontype)u=serializeDecimal128(e,l,h,u,!0);else if("Long"===h._bsontype||"Timestamp"===h._bsontype)u=serializeLong(e,l,h,u,!0);else if("Double"===h._bsontype)u=serializeDouble(e,l,h,u,!0);else if("function"==typeof h&&s)u=serializeFunction(e,l,h,u,r,i,s,!0);else if("Code"===h._bsontype)u=serializeCode(e,l,h,u,r,i,s,a,!0);else if("Binary"===h._bsontype)u=serializeBinary(e,l,h,u,!0);else if("Symbol"===h._bsontype)u=serializeSymbol(e,l,h,u,!0);else if("DBRef"===h._bsontype)u=serializeDBRef(e,l,h,u,i,s,!0);else if("BSONRegExp"===h._bsontype)u=serializeBSONRegExp(e,l,h,u,!0);else if("Int32"===h._bsontype)u=serializeInt32(e,l,h,u,!0);else if("MinKey"===h._bsontype||"MaxKey"===h._bsontype)u=serializeMinMax(e,l,h,u,!0);else if(void 0!==h._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+h._bsontype)}else if(t instanceof map)for(var d=t.entries(),m=!1;!m;){var p=d.next();if(!(m=p.done)){var b=p.value[0],g=p.value[1],y=_typeof$3(g);if("string"==typeof b&&!ignoreKeys.has(b)){if(null!=b.match(regexp$1))throw Error("key "+b+" must not contain null bytes");if(r){if("$"===b[0])throw Error("key "+b+" must not start with '$'");if(~b.indexOf("."))throw Error("key "+b+" must not contain '.'")}}if("string"===y)u=serializeString(e,b,g,u);else if("number"===y)u=serializeNumber(e,b,g,u);else if("boolean"===y)u=serializeBoolean(e,b,g,u);else if(g instanceof Date||isDate$1(g))u=serializeDate(e,b,g,u);else if(null===g||void 0===g&&!1===a)u=serializeNull(e,b,g,u);else if("ObjectId"===g._bsontype||"ObjectID"===g._bsontype)u=serializeObjectId(e,b,g,u);else if(Buffer$5.isBuffer(g))u=serializeBuffer(e,b,g,u);else if(g instanceof RegExp||isRegExp$1(g))u=serializeRegExp(e,b,g,u);else if("object"===y&&null==g._bsontype)u=serializeObject(e,b,g,u,r,i,s,a,!1,o);else if("object"===y&&"Decimal128"===g._bsontype)u=serializeDecimal128(e,b,g,u);else if("Long"===g._bsontype||"Timestamp"===g._bsontype)u=serializeLong(e,b,g,u);else if("Double"===g._bsontype)u=serializeDouble(e,b,g,u);else if("Code"===g._bsontype)u=serializeCode(e,b,g,u,r,i,s,a);else if("function"==typeof g&&s)u=serializeFunction(e,b,g,u,r,i,s);else if("Binary"===g._bsontype)u=serializeBinary(e,b,g,u);else if("Symbol"===g._bsontype)u=serializeSymbol(e,b,g,u);else if("DBRef"===g._bsontype)u=serializeDBRef(e,b,g,u,i,s);else if("BSONRegExp"===g._bsontype)u=serializeBSONRegExp(e,b,g,u);else if("Int32"===g._bsontype)u=serializeInt32(e,b,g,u);else if("MinKey"===g._bsontype||"MaxKey"===g._bsontype)u=serializeMinMax(e,b,g,u);else if(void 0!==g._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+g._bsontype)}}else{if(t.toBSON){if("function"!=typeof t.toBSON)throw new TypeError("toBSON is not a function");if(null!=(t=t.toBSON())&&"object"!==_typeof$3(t))throw new TypeError("toBSON function did not return an object")}for(var v in t){var w=t[v];if(w&&w.toBSON){if("function"!=typeof w.toBSON)throw new TypeError("toBSON is not a function");w=w.toBSON()}var _=_typeof$3(w);if("string"==typeof v&&!ignoreKeys.has(v)){if(null!=v.match(regexp$1))throw Error("key "+v+" must not contain null bytes");if(r){if("$"===v[0])throw Error("key "+v+" must not start with '$'");if(~v.indexOf("."))throw Error("key "+v+" must not contain '.'")}}if("string"===_)u=serializeString(e,v,w,u);else if("number"===_)u=serializeNumber(e,v,w,u);else if("boolean"===_)u=serializeBoolean(e,v,w,u);else if(w instanceof Date||isDate$1(w))u=serializeDate(e,v,w,u);else if(void 0===w)!1===a&&(u=serializeNull(e,v,w,u));else if(null===w)u=serializeNull(e,v,w,u);else if("ObjectId"===w._bsontype||"ObjectID"===w._bsontype)u=serializeObjectId(e,v,w,u);else if(Buffer$5.isBuffer(w))u=serializeBuffer(e,v,w,u);else if(w instanceof RegExp||isRegExp$1(w))u=serializeRegExp(e,v,w,u);else if("object"===_&&null==w._bsontype)u=serializeObject(e,v,w,u,r,i,s,a,!1,o);else if("object"===_&&"Decimal128"===w._bsontype)u=serializeDecimal128(e,v,w,u);else if("Long"===w._bsontype||"Timestamp"===w._bsontype)u=serializeLong(e,v,w,u);else if("Double"===w._bsontype)u=serializeDouble(e,v,w,u);else if("Code"===w._bsontype)u=serializeCode(e,v,w,u,r,i,s,a);else if("function"==typeof w&&s)u=serializeFunction(e,v,w,u,r,i,s);else if("Binary"===w._bsontype)u=serializeBinary(e,v,w,u);else if("Symbol"===w._bsontype)u=serializeSymbol(e,v,w,u);else if("DBRef"===w._bsontype)u=serializeDBRef(e,v,w,u,i,s);else if("BSONRegExp"===w._bsontype)u=serializeBSONRegExp(e,v,w,u);else if("Int32"===w._bsontype)u=serializeInt32(e,v,w,u);else if("MinKey"===w._bsontype||"MaxKey"===w._bsontype)u=serializeMinMax(e,v,w,u);else if(void 0!==w._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+w._bsontype)}}o.pop(),e[u++]=0;var A=u-n;return e[n++]=255&A,e[n++]=A>>8&255,e[n++]=A>>16&255,e[n++]=A>>24&255,u}var serializer=serializeInto;function _typeof$4(e){return(_typeof$4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Buffer$6=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,normalizedFunctionString$2=utils.normalizedFunctionString;function isDate$2(e){return"object"===_typeof$4(e)&&"[object Date]"===Object.prototype.toString.call(e)}function calculateObjectSize(e,t,r){var n=5;if(Array.isArray(e))for(var i=0;i<e.length;i++)n+=calculateElement(i.toString(),e[i],t,!0,r);else for(var s in e.toBSON&&(e=e.toBSON()),e)n+=calculateElement(s,e[s],t,!1,r);return n}function calculateElement(e,t,r,n,i){switch(t&&t.toBSON&&(t=t.toBSON()),_typeof$4(t)){case"string":return 1+Buffer$6.byteLength(e,"utf8")+1+4+Buffer$6.byteLength(t,"utf8")+1;case"number":return Math.floor(t)===t&&t>=constants.JS_INT_MIN&&t<=constants.JS_INT_MAX&&t>=constants.BSON_INT32_MIN&&t<=constants.BSON_INT32_MAX?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+5:(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;case"undefined":return n||!i?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1:0;case"boolean":return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+2;case"object":if(null==t||"MinKey"===t._bsontype||"MaxKey"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1;if("ObjectId"===t._bsontype||"ObjectID"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+13;if(t instanceof Date||isDate$2(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;if(void 0!==Buffer$6&&Buffer$6.isBuffer(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+6+t.length;if("Long"===t._bsontype||"Double"===t._bsontype||"Timestamp"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;if("Decimal128"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+17;if("Code"===t._bsontype)return null!=t.scope&&Object.keys(t.scope).length>0?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+4+Buffer$6.byteLength(t.code.toString(),"utf8")+1+calculateObjectSize(t.scope,r,i):(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+Buffer$6.byteLength(t.code.toString(),"utf8")+1;if("Binary"===t._bsontype)return t.sub_type===binary.SUBTYPE_BYTE_ARRAY?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+(t.position+1+4+1+4):(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+(t.position+1+4+1);if("Symbol"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+Buffer$6.byteLength(t.value,"utf8")+4+1+1;if("DBRef"===t._bsontype){var s=Object.assign({$ref:t.collection,$id:t.oid},t.fields);return null!=t.db&&(s.$db=t.db),(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+calculateObjectSize(s,r,i)}return t instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(t)?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1:"BSONRegExp"===t._bsontype?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.pattern,"utf8")+1+Buffer$6.byteLength(t.options,"utf8")+1:(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+calculateObjectSize(t,r,i)+1;case"function":if(t instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(t)||"[object RegExp]"===String.call(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;if(r&&null!=t.scope&&Object.keys(t.scope).length>0)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+4+Buffer$6.byteLength(normalizedFunctionString$2(t),"utf8")+1+calculateObjectSize(t.scope,r,i);if(r)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+Buffer$6.byteLength(normalizedFunctionString$2(t),"utf8")+1}return 0}var calculate_size=calculateObjectSize,Buffer$7=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,ensure_buffer=function(e){if(e instanceof Buffer$7)return e;if(e instanceof Uint8Array)return Buffer$7.from(e.buffer);throw new TypeError("Must use either Buffer or Uint8Array")},Buffer$8=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,MAXSIZE=17825792,buffer$1=Buffer$8.alloc(MAXSIZE);function setInternalBufferSize(e){buffer$1.length<e&&(buffer$1=Buffer$8.alloc(e))}function serialize$1(e,t){var r="boolean"==typeof(t=t||{}).checkKeys&&t.checkKeys,n="boolean"==typeof t.serializeFunctions&&t.serializeFunctions,i="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined,s="number"==typeof t.minInternalBufferSize?t.minInternalBufferSize:MAXSIZE;buffer$1.length<s&&(buffer$1=Buffer$8.alloc(s));var a=serializer(buffer$1,e,r,0,0,n,i,[]),o=Buffer$8.alloc(a);return buffer$1.copy(o,0,0,o.length),o}function serializeWithBufferAndIndex(e,t,r){var n="boolean"==typeof(r=r||{}).checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,s="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,a="number"==typeof r.index?r.index:0,o=serializer(buffer$1,e,n,0,0,i,s);return buffer$1.copy(t,a,0,o),a+o-1}function deserialize$2(e,t){return e=ensure_buffer(e),deserializer(e,t)}function calculateObjectSize$1(e,t){var r="boolean"==typeof(t=t||{}).serializeFunctions&&t.serializeFunctions,n="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined;return calculate_size(e,r,n)}function deserializeStream(e,t,r,n,i,s){s=Object.assign({allowObjectSmallerThanBufferSize:!0},s),e=ensure_buffer(e);for(var a=t,o=0;o<r;o++){var u=e[a]|e[a+1]<<8|e[a+2]<<16|e[a+3]<<24;s.index=a,n[i+o]=deserializer(e,s),a+=u}return a}var bson={BSON_INT32_MAX:constants.BSON_INT32_MAX,BSON_INT32_MIN:constants.BSON_INT32_MIN,BSON_INT64_MAX:constants.BSON_INT64_MAX,BSON_INT64_MIN:constants.BSON_INT64_MIN,JS_INT_MAX:constants.JS_INT_MAX,JS_INT_MIN:constants.JS_INT_MIN,BSON_DATA_NUMBER:constants.BSON_DATA_NUMBER,BSON_DATA_STRING:constants.BSON_DATA_STRING,BSON_DATA_OBJECT:constants.BSON_DATA_OBJECT,BSON_DATA_ARRAY:constants.BSON_DATA_ARRAY,BSON_DATA_BINARY:constants.BSON_DATA_BINARY,BSON_DATA_UNDEFINED:constants.BSON_DATA_UNDEFINED,BSON_DATA_OID:constants.BSON_DATA_OID,BSON_DATA_BOOLEAN:constants.BSON_DATA_BOOLEAN,BSON_DATA_DATE:constants.BSON_DATA_DATE,BSON_DATA_NULL:constants.BSON_DATA_NULL,BSON_DATA_REGEXP:constants.BSON_DATA_REGEXP,BSON_DATA_DBPOINTER:constants.BSON_DATA_DBPOINTER,BSON_DATA_CODE:constants.BSON_DATA_CODE,BSON_DATA_SYMBOL:constants.BSON_DATA_SYMBOL,BSON_DATA_CODE_W_SCOPE:constants.BSON_DATA_CODE_W_SCOPE,BSON_DATA_INT:constants.BSON_DATA_INT,BSON_DATA_TIMESTAMP:constants.BSON_DATA_TIMESTAMP,BSON_DATA_LONG:constants.BSON_DATA_LONG,BSON_DATA_DECIMAL128:constants.BSON_DATA_DECIMAL128,BSON_DATA_MIN_KEY:constants.BSON_DATA_MIN_KEY,BSON_DATA_MAX_KEY:constants.BSON_DATA_MAX_KEY,BSON_BINARY_SUBTYPE_DEFAULT:constants.BSON_BINARY_SUBTYPE_DEFAULT,BSON_BINARY_SUBTYPE_FUNCTION:constants.BSON_BINARY_SUBTYPE_FUNCTION,BSON_BINARY_SUBTYPE_BYTE_ARRAY:constants.BSON_BINARY_SUBTYPE_BYTE_ARRAY,BSON_BINARY_SUBTYPE_UUID:constants.BSON_BINARY_SUBTYPE_UUID,BSON_BINARY_SUBTYPE_MD5:constants.BSON_BINARY_SUBTYPE_MD5,BSON_BINARY_SUBTYPE_USER_DEFINED:constants.BSON_BINARY_SUBTYPE_USER_DEFINED,Code:code,Map:map,BSONSymbol:symbol,DBRef:db_ref,Binary:binary,ObjectId:objectid,Long:long_1,Timestamp:timestamp,Double:double_1,Int32:int_32,MinKey:min_key,MaxKey:max_key,BSONRegExp:regexp,Decimal128:decimal128,serialize:serialize$1,serializeWithBufferAndIndex:serializeWithBufferAndIndex,deserialize:deserialize$2,calculateObjectSize:calculateObjectSize$1,deserializeStream:deserializeStream,setInternalBufferSize:setInternalBufferSize,ObjectID:objectid,EJSON:extended_json},bson_1=bson.BSON_INT32_MAX,bson_2=bson.BSON_INT32_MIN,bson_3=bson.BSON_INT64_MAX,bson_4=bson.BSON_INT64_MIN,bson_5=bson.JS_INT_MAX,bson_6=bson.JS_INT_MIN,bson_7=bson.BSON_DATA_NUMBER,bson_8=bson.BSON_DATA_STRING,bson_9=bson.BSON_DATA_OBJECT,bson_10=bson.BSON_DATA_ARRAY,bson_11=bson.BSON_DATA_BINARY,bson_12=bson.BSON_DATA_UNDEFINED,bson_13=bson.BSON_DATA_OID,bson_14=bson.BSON_DATA_BOOLEAN,bson_15=bson.BSON_DATA_DATE,bson_16=bson.BSON_DATA_NULL,bson_17=bson.BSON_DATA_REGEXP,bson_18=bson.BSON_DATA_DBPOINTER,bson_19=bson.BSON_DATA_CODE,bson_20=bson.BSON_DATA_SYMBOL,bson_21=bson.BSON_DATA_CODE_W_SCOPE,bson_22=bson.BSON_DATA_INT,bson_23=bson.BSON_DATA_TIMESTAMP,bson_24=bson.BSON_DATA_LONG,bson_25=bson.BSON_DATA_DECIMAL128,bson_26=bson.BSON_DATA_MIN_KEY,bson_27=bson.BSON_DATA_MAX_KEY,bson_28=bson.BSON_BINARY_SUBTYPE_DEFAULT,bson_29=bson.BSON_BINARY_SUBTYPE_FUNCTION,bson_30=bson.BSON_BINARY_SUBTYPE_BYTE_ARRAY,bson_31=bson.BSON_BINARY_SUBTYPE_UUID,bson_32=bson.BSON_BINARY_SUBTYPE_MD5,bson_33=bson.BSON_BINARY_SUBTYPE_USER_DEFINED,bson_34=bson.Code,bson_35=bson.BSONSymbol,bson_36=bson.DBRef,bson_37=bson.Binary,bson_38=bson.ObjectId,bson_39=bson.Long,bson_40=bson.Timestamp,bson_41=bson.Double,bson_42=bson.Int32,bson_43=bson.MinKey,bson_44=bson.MaxKey,bson_45=bson.BSONRegExp,bson_46=bson.Decimal128,bson_47=bson.serialize,bson_48=bson.serializeWithBufferAndIndex,bson_49=bson.deserialize,bson_50=bson.calculateObjectSize,bson_51=bson.deserializeStream,bson_52=bson.setInternalBufferSize,bson_53=bson.ObjectID,bson_54=bson.EJSON,_unused_webpack_default_export=bson}).call(this,__webpack_require__(12),__webpack_require__(6).Buffer)},function(e,t,r){"use strict";t.BigNumber=r(15).BigNumber,t.Commented=r(87),t.Diagnose=r(109),t.Decoder=r(33),t.Encoder=r(59),t.Simple=r(26),t.Tagged=r(39),t.Map=r(110),t.comment=t.Commented.comment,t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.decodeAllSync=t.Decoder.decodeAllSync,t.decodeFirstSync=t.Decoder.decodeFirstSync,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.encodeCanonical=t.Encoder.encodeCanonical,t.encodeOne=t.Encoder.encodeOne,t.encodeAsync=t.Encoder.encodeAsync,t.decode=t.Decoder.decodeFirstSync,t.leveldb={decode:t.Decoder.decodeAllSync,encode:t.Encoder.encode,buffer:!0,name:"cbor"},t.hasBigInt=r(20).hasBigInt},function(e,t,r){e.exports=r(111)},function(e,t,r){"use strict";function n(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";var n=r(8),i=r(44),s=r(67),a=r(50);function o(e){var t=new s(e),r=i(s.prototype.request,t);return n.extend(r,s.prototype,t),n.extend(r,t),r}var u=o(r(47));u.Axios=s,u.create=function(e){return o(a(u.defaults,e))},u.Cancel=r(51),u.CancelToken=r(80),u.isCancel=r(46),u.all=function(e){return Promise.all(e)},u.spread=r(81),u.isAxiosError=r(82),e.exports=u,e.exports.default=u},function(e,t,r){"use strict";var n=r(8),i=r(45),s=r(68),a=r(69),o=r(50);function u(e){this.defaults=e,this.interceptors={request:new s,response:new s}}u.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=o(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[a,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},u.prototype.getUri=function(e){return e=o(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){u.prototype[e]=function(t,r){return this.request(o(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){u.prototype[e]=function(t,r,n){return this.request(o(n||{},{method:e,url:t,data:r}))}})),e.exports=u},function(e,t,r){"use strict";var n=r(8);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,r){"use strict";var n=r(8),i=r(70),s=r(46),a=r(47);function o(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return o(e),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return o(e),t.data=i(t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(o(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var n=r(8);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t,r){"use strict";var n=r(8);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},function(e,t,r){"use strict";var n=r(49);e.exports=function(e,t,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){"use strict";var n=r(8);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,s,a){var o=[];o.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),n.isString(i)&&o.push("path="+i),n.isString(s)&&o.push("domain="+s),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";var n=r(76),i=r(77);e.exports=function(e,t){return e&&!n(t)?i(e,t):t}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(8),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,a={};return e?(n.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=n.trim(e.substr(0,s)).toLowerCase(),r=n.trim(e.substr(s+1)),t){if(a[t]&&i.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([r]):a[t]?a[t]+", "+r:r}})),a):a}},function(e,t,r){"use strict";var n=r(8);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(51);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),a=n[0],o=n[1],u=new s(function(e,t,r){return 3*(t+r)/4-r}(0,a,o)),l=0,h=o>0?a-4:a;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===o&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===o&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],a=16383,o=0,u=r-i;o<u;o+=a)s.push(l(e,o,o+a>u?u:o+a));1===i?(t=e[r-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=a.length;o<u;++o)n[o]=a[o],i[a.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,s,a=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(n[(s=i)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var s,a,o=8*i-n-1,u=(1<<o)-1,c=u>>1,l=-7,h=r?i-1:0,f=r?-1:1,d=e[t+h];for(h+=f,s=d&(1<<-l)-1,d>>=-l,l+=o;l>0;s=256*s+e[t+h],h+=f,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=n;l>0;a=256*a+e[t+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),s-=c}return(d?-1:1)*a*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var a,o,u,c=8*s-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,m=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(t*u-1)*Math.pow(2,i),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&o,d+=m,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;e[r+d]=255&a,d+=m,a/=256,c-=8);e[r+d-m]|=128*p}},function(e,t,r){var n=r(86);e.exports=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(n(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return n(t)}}},function(e,t){function r(e){this.message=e}r.prototype=new Error,r.prototype.name="InvalidCharacterError",e.exports="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,s=0,a=0,o="";i=t.charAt(a++);~i&&(n=s%4?64*n+i:i,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o}},function(e,t,r){"use strict";(function(t){const n=r(18),i=r(25),s=(r(20),r(26),r(33)),a=r(17),o=r(15).BigNumber,u=r(27),c=a.MT,l=a.NUMBYTES,h=a.SYMS;function f(e){return e>1?"s":""}class d extends n.Transform{constructor(e){const t=Object.assign({depth:1,max_depth:10,no_summary:!1},e,{readableObjectMode:!1,writableObjectMode:!1}),r=t.max_depth;delete t.max_depth;const n=t.depth;delete t.depth,super(t),this.depth=n,this.max_depth=r,this.all=new u,t.tags={24:this._tag_24.bind(this)},this.parser=new s(t),this.parser.on("value",this._on_value.bind(this)),this.parser.on("start",this._on_start.bind(this)),this.parser.on("start-string",this._on_start_string.bind(this)),this.parser.on("stop",this._on_stop.bind(this)),this.parser.on("more-bytes",this._on_more.bind(this)),this.parser.on("error",this._on_error.bind(this)),t.no_summary||this.parser.on("data",this._on_data.bind(this)),this.parser.bs.on("read",this._on_read.bind(this))}_tag_24(e){const t=new d({depth:this.depth+1,no_summary:!0});t.on("data",(e=>this.push(e))),t.on("error",(e=>this.emit("error",e))),t.end(e)}_transform(e,t,r){this.parser.write(e,t,r)}_flush(e){return this.parser._flush(e)}static comment(e,t,r){if(null==e)throw new Error("input required");let n="string"==typeof e?"hex":void 0,i=10;switch(typeof t){case"function":r=t;break;case"string":n=t;break;case"number":i=t;break;case"object":const e=t.encoding,s=t.max_depth;n=null!=e?e:n,i=null!=s?s:i;break;case"undefined":break;default:throw new Error("Unknown option type")}const s=new u,a=new d({max_depth:i});let o=null;return"function"==typeof r?(a.on("end",(()=>{r(null,s.toString("utf8"))})),a.on("error",r)):o=new Promise(((e,t)=>(a.on("end",(()=>{e(s.toString("utf8"))})),a.on("error",t)))),a.pipe(s),a.end(e,n),o}_on_error(e){this.push("ERROR: "),this.push(e.toString()),this.push("\n")}_on_read(e){this.all.write(e);const t=e.toString("hex");this.push(new Array(this.depth+1).join(" ")),this.push(t);let r=2*(this.max_depth-this.depth);return r-=t.length,r<1&&(r=1),this.push(new Array(r+1).join(" ")),this.push("-- ")}_on_more(e,t,r,n){this.depth++;let i="";switch(e){case c.POS_INT:i="Positive number,";break;case c.NEG_INT:i="Negative number,";break;case c.ARRAY:i="Array, length";break;case c.MAP:i="Map, count";break;case c.BYTE_STRING:i="Bytes, length";break;case c.UTF8_STRING:i="String, length";break;case c.SIMPLE_FLOAT:i=1===t?"Simple value,":"Float,"}return this.push(i+" next "+t+" byte"+f(t)+"\n")}_on_start_string(e,t,r,n){this.depth++;let i="";switch(e){case c.BYTE_STRING:i="Bytes, length: "+t;break;case c.UTF8_STRING:i="String, length: "+t.toString()}return this.push(i+"\n")}_on_start(e,t,r,n){if(this.depth++,t!==h.BREAK)switch(r){case c.ARRAY:this.push(`[${n}], `);break;case c.MAP:n%2?this.push(`{Val:${Math.floor(n/2)}}, `):this.push(`{Key:${Math.floor(n/2)}}, `)}switch(e){case c.TAG:this.push(`Tag #${t}`),24==t&&this.push(" Encoded CBOR data item");break;case c.ARRAY:t===h.STREAM?this.push("Array (streaming)"):this.push(`Array, ${t} item${f(t)}`);break;case c.MAP:t===h.STREAM?this.push("Map (streaming)"):this.push(`Map, ${t} pair${f(t)}`);break;case c.BYTE_STRING:this.push("Bytes (streaming)");break;case c.UTF8_STRING:this.push("String (streaming)")}return this.push("\n")}_on_stop(e){return this.depth--}_on_value(e,r,n,s){if(e!==h.BREAK)switch(r){case c.ARRAY:this.push(`[${n}], `);break;case c.MAP:n%2?this.push(`{Val:${Math.floor(n/2)}}, `):this.push(`{Key:${Math.floor(n/2)}}, `)}switch(e===h.BREAK?this.push("BREAK\n"):e===h.NULL?this.push("null\n"):e===h.UNDEFINED?this.push("undefined\n"):"string"==typeof e?(this.depth--,e.length>0&&(this.push(JSON.stringify(e)),this.push("\n"))):t.isBuffer(e)?(this.depth--,e.length>0&&(this.push(e.toString("hex")),this.push("\n"))):e instanceof o?(this.push(e.toString()),this.push("\n")):(this.push(i.inspect(e)),this.push("\n")),s){case l.ONE:case l.TWO:case l.FOUR:case l.EIGHT:this.depth--}}_on_data(){return this.push("0x"),this.push(this.all.read().toString("hex")),this.push("\n")}}e.exports=d}).call(this,r(6).Buffer)},function(e,t){},function(e,t,r){"use strict";var n=r(37).Buffer,i=r(90);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t,r,i,s=n.allocUnsafe(e>>>0),a=this.head,o=0;a;)t=a.data,r=s,i=o,t.copy(r,i),o+=a.data.length,a=a.next;return s},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new s(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(92),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(12))},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i,s,a,o,u=1,c={},l=!1,h=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){m(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){m(e.data)},n=function(e){s.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,n=function(e){var t=h.createElement("script");t.onreadystatechange=function(){m(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(m,0,e)}:(a="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&m(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),n=function(t){e.postMessage(a+t,"*")}),f.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var i={callback:e,args:t};return c[u]=i,n(u),u++},f.clearImmediate=d}function d(e){delete c[e]}function m(e){if(l)setTimeout(m,0,e);else{var t=c[e];if(t){l=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{d(e),l=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(12),r(14))},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this,r(12))},function(e,t,r){var n=r(6),i=n.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=a),a.prototype=Object.create(i.prototype),s(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";e.exports=s;var n=r(57),i=Object.create(r(24));function s(e){if(!(this instanceof s))return new s(e);n.call(this,e)}i.inherits=r(19),i.inherits(s,n),s.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(38)},function(e,t,r){e.exports=r(16)},function(e,t,r){e.exports=r(36).Transform},function(e,t,r){e.exports=r(36).PassThrough},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";const n=r(18),i=r(27),s=n.Transform;e.exports=class extends s{constructor(e){super(e),this._writableState.objectMode=!1,this._readableState.objectMode=!0,this.bs=new i,this.__restart()}_transform(e,t,r){for(this.bs.write(e);this.bs.length>=this.__needed;){let e;const t=null===this.__needed?void 0:this.bs.read(this.__needed);try{e=this.__parser.next(t)}catch(e){return r(e)}this.__needed&&(this.__fresh=!1),e.done?(this.push(e.value),this.__restart()):this.__needed=e.value||0}return r()}*_parse(){throw new Error("Must be implemented in subclass")}__restart(){this.__needed=null,this.__parser=this._parse(),this.__fresh=!0}_flush(e){e(this.__fresh?null:new Error("unexpected end of input"))}}},function(e,t,r){(function(e,n){var i;!function(s){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof n&&n;a.global!==a&&a.window!==a&&a.self;var o,u=2147483647,c=36,l=/^xn--/,h=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,p=String.fromCharCode;function b(e){throw new RangeError(d[e])}function g(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function y(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+g((e=e.replace(f,".")).split("."),t).join(".")}function v(e){for(var t,r,n=[],i=0,s=e.length;i<s;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<s?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function w(e){return g(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function _(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function A(e,t,r){var n=0;for(e=r?m(e/700):e>>1,e+=m(e/t);e>455;n+=c)e=m(e/35);return m(n+36*e/(e+38))}function S(e){var t,r,n,i,s,a,o,l,h,f,d,p=[],g=e.length,y=0,v=128,_=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&b("not-basic"),p.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<g;){for(s=y,a=1,o=c;i>=g&&b("invalid-input"),((l=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:c)>=c||l>m((u-y)/a))&&b("overflow"),y+=l*a,!(l<(h=o<=_?1:o>=_+26?26:o-_));o+=c)a>m(u/(f=c-h))&&b("overflow"),a*=f;_=A(y-s,t=p.length+1,0==s),m(y/t)>u-v&&b("overflow"),v+=m(y/t),y%=t,p.splice(y++,0,v)}return w(p)}function B(e){var t,r,n,i,s,a,o,l,h,f,d,g,y,w,S,B=[];for(g=(e=v(e)).length,t=128,r=0,s=72,a=0;a<g;++a)(d=e[a])<128&&B.push(p(d));for(n=i=B.length,i&&B.push("-");n<g;){for(o=u,a=0;a<g;++a)(d=e[a])>=t&&d<o&&(o=d);for(o-t>m((u-r)/(y=n+1))&&b("overflow"),r+=(o-t)*y,t=o,a=0;a<g;++a)if((d=e[a])<t&&++r>u&&b("overflow"),d==t){for(l=r,h=c;!(l<(f=h<=s?1:h>=s+26?26:h-s));h+=c)S=l-f,w=c-f,B.push(p(_(f+S%w,0))),l=m(S/w);B.push(p(_(l,0))),s=A(r,y,n==i),r=0,++n}++r,++t}return B.join("")}o={version:"1.4.1",ucs2:{decode:v,encode:w},decode:S,encode:B,toASCII:function(e){return y(e,(function(e){return h.test(e)?"xn--"+B(e):e}))},toUnicode:function(e){return y(e,(function(e){return l.test(e)?S(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return o}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(104)(e),r(12))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";t.decode=t.parse=r(107),t.encode=t.stringify=r(108)},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,s){t=t||"&",r=r||"=";var a={};if("string"!=typeof e||0===e.length)return a;var o=/\+/g;e=e.split(t);var u=1e3;s&&"number"==typeof s.maxKeys&&(u=s.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var h,f,d,m,p=e[l].replace(o,"%20"),b=p.indexOf(r);b>=0?(h=p.substr(0,b),f=p.substr(b+1)):(h=p,f=""),d=decodeURIComponent(h),m=decodeURIComponent(f),n(a,d)?i(a[d])?a[d].push(m):a[d]=[a[d],m]:a[d]=m}return a};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?s(a(e),(function(a){var o=encodeURIComponent(n(a))+r;return i(e[a])?s(e[a],(function(e){return o+encodeURIComponent(n(e))})).join(t):o+encodeURIComponent(n(e[a]))})).join(t):o?encodeURIComponent(n(o))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function s(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var a=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},function(e,t,r){"use strict";(function(t){const n=r(18),i=r(25),s=r(33),a=(r(26),r(20)),o=r(17),u=r(15).BigNumber,c=r(27),l=o.MT,h=o.SYMS;class f extends n.Transform{constructor(e){const t=Object.assign({separator:"\n",stream_errors:!1},e,{readableObjectMode:!1,writableObjectMode:!1}),r=t.separator;delete t.separator;const n=t.stream_errors;delete t.stream_errors,super(t),this.float_bytes=-1,this.separator=r,this.stream_errors=n,this.parser=new s(t),this.parser.on("more-bytes",this._on_more.bind(this)),this.parser.on("value",this._on_value.bind(this)),this.parser.on("start",this._on_start.bind(this)),this.parser.on("stop",this._on_stop.bind(this)),this.parser.on("data",this._on_data.bind(this)),this.parser.on("error",this._on_error.bind(this))}_transform(e,t,r){return this.parser.write(e,t,r)}_flush(e){return this.parser._flush((t=>this.stream_errors?(t&&this._on_error(t),e()):e(t)))}static diagnose(e,t,r){if(null==e)throw new Error("input required");let n={},i="hex";switch(typeof t){case"function":r=t,i=a.guessEncoding(e);break;case"object":n=a.extend({},t),i=null!=n.encoding?n.encoding:a.guessEncoding(e),delete n.encoding;break;default:i=null!=t?t:"hex"}const s=new c,o=new f(n);let u=null;return"function"==typeof r?(o.on("end",(()=>r(null,s.toString("utf8")))),o.on("error",r)):u=new Promise(((e,t)=>(o.on("end",(()=>e(s.toString("utf8")))),o.on("error",t)))),o.pipe(s),o.end(e,i),u}_on_error(e){return this.stream_errors?this.push(e.toString()):this.emit("error",e)}_on_more(e,t,r,n){if(e===l.SIMPLE_FLOAT)return this.float_bytes={2:1,4:2,8:3}[t]}_fore(e,t){switch(e){case l.BYTE_STRING:case l.UTF8_STRING:case l.ARRAY:if(t>0)return this.push(", ");break;case l.MAP:if(t>0)return t%2?this.push(": "):this.push(", ")}}_on_value(e,r,n){if(e!==h.BREAK)return this._fore(r,n),this.push((()=>{switch(!1){case e!==h.NULL:return"null";case e!==h.UNDEFINED:return"undefined";case"string"!=typeof e:return JSON.stringify(e);case!(this.float_bytes>0):const r=this.float_bytes;return this.float_bytes=-1,i.inspect(e)+"_"+r;case!t.isBuffer(e):return"h'"+e.toString("hex")+"'";case!(e instanceof u):return e.toString();default:return i.inspect(e)}})())}_on_start(e,t,r,n){switch(this._fore(r,n),e){case l.TAG:this.push(`${t}(`);break;case l.ARRAY:this.push("[");break;case l.MAP:this.push("{");break;case l.BYTE_STRING:case l.UTF8_STRING:this.push("(")}if(t===h.STREAM)return this.push("_ ")}_on_stop(e){switch(e){case l.TAG:return this.push(")");case l.ARRAY:return this.push("]");case l.MAP:return this.push("}");case l.BYTE_STRING:case l.UTF8_STRING:return this.push(")")}}_on_data(){return this.push(this.separator)}}e.exports=f}).call(this,r(6).Buffer)},function(e,t,r){"use strict";(function(t){const n=r(59),i=r(33),s=r(17).MT;class a extends Map{constructor(e){super(e)}static _encode(e){return n.encodeCanonical(e).toString("base64")}static _decode(e){return i.decodeFirstSync(e,"base64")}get(e){return super.get(a._encode(e))}set(e,t){return super.set(a._encode(e),t)}delete(e){return super.delete(a._encode(e))}has(e){return super.has(a._encode(e))}*keys(){for(const e of super.keys())yield a._decode(e)}*entries(){for(const e of super.entries())yield[a._decode(e[0]),e[1]]}[Symbol.iterator](){return this.entries()}forEach(e,t){if("function"!=typeof e)throw new TypeError("Must be function");for(const t of super.entries())e.call(this,t[1],a._decode(t[0]),this)}encodeCBOR(e){if(!e._pushInt(this.size,s.MAP))return!1;if(e.canonical){const r=Array.from(super.entries()).map((e=>[t.from(e[0],"base64"),e[1]]));r.sort(((e,t)=>e[0].compare(t[0])));for(const t of r)if(!e.push(t[0])||!e.pushAny(t[1]))return!1}else for(const r of super.entries())if(!e.push(t.from(r[0],"base64"))||!e.pushAny(r[1]))return!1;return!0}}e.exports=a}).call(this,r(6).Buffer)},function(e,t,r){"use strict";(function(e){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=i(r(112)),a=r(60),o=r(61),u=r(117),c=i(r(118));var l=r(60);t.registerSerializer=l.registerSerializer;var h=r(61);t.Transfer=h.Transfer;let f=!1;const d=e=>e&&e.type===u.MasterMessageType.run,m=e=>s.default(e)||function(e){return e&&"object"==typeof e&&"function"==typeof e.subscribe}(e);function p(e){return o.isTransferDescriptor(e)?{payload:e.send,transferables:e.transferables}:{payload:e,transferables:void 0}}function b(e,t){const{payload:r,transferables:n}=p(t),i={type:u.WorkerMessageType.error,uid:e,error:a.serialize(r)};c.default.postMessageToMaster(i,n)}function g(e,t,r){const{payload:n,transferables:i}=p(r),s={type:u.WorkerMessageType.result,uid:e,complete:!!t||void 0,payload:n};c.default.postMessageToMaster(s,i)}function y(e){const t={type:u.WorkerMessageType.uncaughtError,error:a.serialize(e)};c.default.postMessageToMaster(t)}function v(e,t,r){return n(this,void 0,void 0,(function*(){let n;try{n=t(...r)}catch(t){return b(e,t)}const i=m(n)?"observable":"promise";if(function(e,t){const r={type:u.WorkerMessageType.running,uid:e,resultType:t};c.default.postMessageToMaster(r)}(e,i),m(n))n.subscribe((t=>g(e,!1,a.serialize(t))),(t=>b(e,a.serialize(t))),(()=>g(e,!0)));else try{const t=yield n;g(e,!0,a.serialize(t))}catch(t){b(e,a.serialize(t))}}))}t.expose=function(e){if(!c.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(f)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(f=!0,"function"==typeof e)c.default.subscribeToMasterMessages((t=>{d(t)&&!t.method&&v(t.uid,e,t.args.map(a.deserialize))})),function(){const e={type:u.WorkerMessageType.init,exposed:{type:"function"}};c.default.postMessageToMaster(e)}();else{if("object"!=typeof e||!e)throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${e}`);c.default.subscribeToMasterMessages((t=>{d(t)&&t.method&&v(t.uid,e[t.method],t.args.map(a.deserialize))}));!function(e){const t={type:u.WorkerMessageType.init,exposed:{type:"module",methods:e}};c.default.postMessageToMaster(t)}(Object.keys(e).filter((t=>"function"==typeof e[t])))}},"undefined"!=typeof self&&"function"==typeof self.addEventListener&&c.default.isWorkerRuntime()&&(self.addEventListener("error",(e=>{setTimeout((()=>y(e.error||e)),250)})),self.addEventListener("unhandledrejection",(e=>{const t=e.reason;t&&"string"==typeof t.message&&setTimeout((()=>y(t)),250)}))),void 0!==e&&"function"==typeof e.on&&c.default.isWorkerRuntime()&&(e.on("uncaughtException",(e=>{setTimeout((()=>y(e)),250)})),e.on("unhandledRejection",(e=>{e&&"string"==typeof e.message&&setTimeout((()=>y(e)),250)})))}).call(this,r(14))},function(e,t,r){"use strict";const n=r(113).default;e.exports=e=>Boolean(e&&e[n]&&e===e[n]())},function(e,t,r){"use strict";r.r(t),function(e,n){var i,s=r(65);i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var a=Object(s.a)(i);t.default=a}.call(this,r(12),r(114)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSerializer=function(e,t){const r=e.deserialize.bind(e),n=e.serialize.bind(e);return{deserialize:e=>t.deserialize(e,r),serialize:e=>t.serialize(e,n)}};const n={deserialize:e=>Object.assign(Error(e.message),{name:e.name,stack:e.stack}),serialize:e=>({__error_marker:"$$error",message:e.message,name:e.name,stack:e.stack})};t.DefaultSerializer={deserialize(e){return(t=e)&&"object"==typeof t&&"__error_marker"in t&&"$$error"===t.__error_marker?n.deserialize(e):e;var t},serialize:e=>e instanceof Error?n.serialize(e):e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.$errors=Symbol("thread.errors"),t.$events=Symbol("thread.events"),t.$terminate=Symbol("thread.terminate"),t.$transferable=Symbol("thread.transferable"),t.$worker=Symbol("thread.worker")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.run="run"}(t.MasterMessageType||(t.MasterMessageType={})),function(e){e.error="error",e.init="init",e.result="result",e.running="running",e.uncaughtError="uncaughtError"}(t.WorkerMessageType||(t.WorkerMessageType={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={isWorkerRuntime:function(){return!("undefined"==typeof self||!self.postMessage)},postMessageToMaster:function(e,t){self.postMessage(e,t)},subscribeToMasterMessages:function(e){const t=t=>{e(t.data)};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(121);t.Observable=n.Observable;const i=Symbol("observers");class s extends n.Observable{constructor(){super((e=>{this[i]=[...this[i]||[],e];return()=>{this[i]=this[i].filter((t=>t!==e))}})),this[i]=[]}complete(){this[i].forEach((e=>e.complete()))}error(e){this[i].forEach((t=>t.error(e)))}next(e){this[i].forEach((t=>t.next(e)))}}t.Subject=s},function(e,t,r){"use strict";r.r(t);var n=r(9),i=r.n(n),s=r(62);class a extends Error{constructor(e){super(""),this.chainedErrors=[],"string"==typeof e?this.message=e:e&&void 0!==e.message&&(this.message=e.message),this.name="BioLibError",this.date=new Date}static chainErrors(e,t){const r=new a(e);let n;if(t instanceof Error){n=(t.stack?t.stack.toString():"").includes(t.message)?t.stack:`${t.message}: ${t.stack}`}else n=t.toString();return r.message=`${r.message}\n\n${n}`,"string"==typeof e&&"object"==typeof t&&(r.name=t.name),r}toString(){let e=`${this.message}\n`;for(let t=this.chainedErrors.length-1;t>=0;t-=1)e=`${e}\n${this.chainedErrors[t].message}\n`;return e}}var o=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))};const u=e=>new Promise((t=>o(void 0,void 0,void 0,(function*(){return setTimeout(t,e)}))));function c(e){const t=atob(e),r=t.length,n=new Uint8Array(r);for(let e=0;e<r;e+=1)n[e]=t.charCodeAt(e);return n}class l extends Error{constructor(e){var t;super("string"==typeof e?e:e.statusText),this.name="ApiError","object"==typeof e&&(this.status=e.status,this.validationErrors=e.data,400!==e.status&&(this.message=(null===(t=this.validationErrors)||void 0===t?void 0:t.detail)||this.message))}toString(){return`${this.name}: ${this.message}`}static generate(e){if(!e)return new l("Unknown API Error");switch(e.status){case 400:return e.data&&"compute_limit_exceeded_please_signin"in e.data?new w(e):e.data&&"compute_limit_exceeded_please_contact_biolib"in e.data?new _(e):new h(e);case 401:return new f(e);case 403:return new d(e);case 404:return new m(e);case 429:return new g(e);case 500:return new p(e);case 503:return new b(e);default:return new l(e)}}}class h extends l{constructor(e){super(e),this.name="ValidationError";const t=this.validationErrors;t&&(this.message=JSON.stringify(t))}toString(){const e=this.validationErrors;if(e)try{return h.recurseValidationErrors(e)}catch(e){return`${this.name}: ${this.message}`}return`${this.name}: ${this.message}`}static recurseValidationErrors(e){if("string"==typeof e)return e;if(Array.isArray(e)&&0===e.length)return"";if(Array.isArray(e)&&"string"==typeof e[0])return e.join("\n");let t="";if(Array.isArray(e))for(const r of e)t=`${t}${t.endsWith("\n")?"":"\n"}${h.recurseValidationErrors(r)}`;else if("object"==typeof e)for(const r in e){const n=e[r];t=`${t}${t.endsWith("\n")?"":"\n"}${h.recurseValidationErrors(n)}`}return t}}class f extends l{constructor(){super(...arguments),this.name="AuthenticationError"}}class d extends l{constructor(){super(...arguments),this.name="PermissionError"}}class m extends l{constructor(){super(...arguments),this.name="NotFoundError"}}class p extends l{constructor(){super(...arguments),this.name="ServerError"}}class b extends l{constructor(){super(...arguments),this.name="ServerUnavailableError"}}class g extends l{constructor(){super(...arguments),this.name="BioLibServerMaximumAttemptsReached"}}class y extends l{constructor(){super(...arguments),this.name="ComputeNodeConnectionLost"}}class v extends y{constructor(){super(...arguments),this.name="CustomComputeNodeConnectionLost"}}class w extends l{constructor(){super(...arguments),this.name="compute_limit_exceeded_please_signin"}}class _ extends l{constructor(){super(...arguments),this.name="compute_limit_exceeded_please_contact_biolib"}}var A=r(40);function S(e){return e instanceof l?Promise.reject(e):function(e){return!!e.isAxiosError&&!e.response}(e)?Promise.reject(new l("Network Error: Lost Connection to Server")):Promise.reject(l.generate(e.response))}var B=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))};class k{constructor(e){var t;this.interceptRequest=e=>new Promise(((t,r)=>B(this,void 0,void 0,(function*(){var n,i,s;if(null===(n=null==e?void 0:e.headers)||void 0===n?void 0:n.Authorization){if(!this.refreshToken)return delete e.headers.Authorization,t(e);if(k.isJwtExpired(this.refreshToken))return r(new f("The session has expired"));if(!this.accessToken||k.isJwtExpired(this.accessToken))try{this.accessToken=yield this.fetchNewAccessToken()}catch(e){return r(new f(null===(s=null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.data)||void 0===s?void 0:s.detail))}e.headers.Authorization=`Bearer ${this.accessToken}`}t(e)})))),this.baseUrl=e.baseURL,this.accessTokenPath=null!==(t=e.accessTokenPath)&&void 0!==t?t:"/api/user/token/refresh/",this.refreshToken=e.refreshToken,this.axios=this.axios=i.a.create({baseURL:this.baseUrl}),this.axios.interceptors.request.use(this.interceptRequest,(e=>Promise.reject(e))),this.axios.interceptors.response.use((e=>e),S)}setRefreshToken(e){this.refreshToken=e}setAccessToken(e){this.accessToken=e}getAccessToken(){if(!this.accessToken)throw new Error("HttpClient: Failed to get access token it was undefined");return this.accessToken}getRefreshToken(){return this.refreshToken}clearTokens(){this.accessToken=void 0,this.refreshToken=void 0}getSingedInUserId(){if(void 0===this.refreshToken)return;const{public_id:e}=A(this.refreshToken);return e}fetchNewAccessToken(){return B(this,void 0,void 0,(function*(){return this.accessToken=yield this.axios.post(this.accessTokenPath,{refresh:this.refreshToken}).then((e=>e.data.access)),this.accessToken}))}static isJwtExpired(e){const{exp:t}=A(e);return 1e3*t-Date.now()<=0}}class E{constructor(e){this.basePath="",this.httpClient=e}post(e){const{url:t,data:r,params:n,shouldAuthenticate:i,shouldSendAsFormData:s,responseType:a}=e,o=E.getAxiosRequestConfig({url:t,shouldAuthenticate:i,params:n,responseType:a}),u=s?E.createFormData(r):r;return this.httpClient.axios.post(this.getFullUrl(t),u,o).then((e=>e.data))}get(e){const{url:t,params:r,shouldAuthenticate:n,responseType:i}=e,s=E.getAxiosRequestConfig({url:t,shouldAuthenticate:n,params:r,responseType:i});return this.httpClient.axios.get(this.getFullUrl(t),s).then((e=>e.data))}patch(e){const{url:t,data:r,params:n,shouldAuthenticate:i,shouldSendAsFormData:s,responseType:a}=e,o=E.getAxiosRequestConfig({url:t,shouldAuthenticate:i,params:n,responseType:a}),u=s?E.createFormData(r):r;return this.httpClient.axios.patch(this.getFullUrl(t),u,o).then((e=>e.data))}delete(e){const{url:t,params:r,shouldAuthenticate:n,responseType:i}=e,s=E.getAxiosRequestConfig({url:t,shouldAuthenticate:n,params:r,responseType:i});return this.httpClient.axios.delete(this.getFullUrl(t),s).then((e=>e.data))}getFullUrl(e){return""!==this.basePath?`${this.basePath}${e}`:e}static getAxiosRequestConfig(e){const{shouldAuthenticate:t,params:r,timeout:n,responseType:i}=e;let s={};return t&&(s={headers:{Authorization:!0}}),r&&(s.params=r),n&&(s.timeout=n),i&&(s.responseType=i),s}static createFormData(e,t,r){const n=t||new FormData;for(const t in e){if(!e.hasOwnProperty(t)||void 0===e[t])continue;const i=r?`${r}[${t}]`:t,s=e[t]instanceof Blob;e[t]instanceof Date?n.append(i,e[t].toISOString()):"object"!=typeof e[t]||s?n.append(i,e[t]):this.createFormData(e[t],n,i)}return n}}var O=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))};class N extends E{constructor(){super(...arguments),this.basePath="/api/jobs"}create(e){return this.post({url:"/",data:e,shouldAuthenticate:!0})}update(e,t){return this.patch({url:`/${e}/`,data:t,shouldAuthenticate:!0})}createCloudJob(e,t){return O(this,void 0,void 0,(function*(){let r=null;for(let t=0;t<5;t+=1)try{r=yield this.post({data:e,url:"/cloud/",shouldAuthenticate:!0});break}catch(e){if(!(e instanceof b))throw e;yield u(1e3)}if(null===r)throw new g("Reached retry limit for cloud job creation");if(r.is_compute_node_ready){if(null===r.compute_node_info)throw new l("Compute node info was null");return r}t("Cloud: Starting a compute node, this might take up to 2 minutes.");for(let e=0;e<25;e+=1){if(r=yield this.get({url:`/cloud/${r.public_id}/status/`,shouldAuthenticate:!0}),r.is_compute_node_ready){if(null===r.compute_node_info)throw new l("Compute node info was null");return r}t("Cloud: Reserved compute node not ready, retrying..."),yield u(1e4)}throw new g("Reached timeout for compute node initialization")}))}}var x,I,C,j,T,P,D=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))};class U{send(e){return D(this,void 0,void 0,(function*(){yield i.a.post(U.apiUrl,e)}))}}U.apiUrl="https://vqfmyscbod.execute-api.eu-west-1.amazonaws.com/default/websiteContact";!function(e){e.intrinsic="intrinsic",e.admin="admin",e.member="member"}(x||(x={})),function(e){e.admin="admin",e.member="member"}(I||(I={})),function(e){e.basic="basic",e.enterprise="enterprise"}(C||(C={})),function(e){e.draft="draft",e.public="public"}(j||(j={})),function(e){e.published="published",e.unpublished="unpublished"}(T||(T={})),function(e){e.markdown="markdown",e.text="text"}(P||(P={}));var L,R,M,$;!function(e){e.dropdown="dropdown",e.file="file",e.hidden="hidden",e.number="number",e.radio="radio",e.text="text",e.textFile="text-file",e.toggle="toggle"}(L||(L={})),function(e){e.biolibApp="biolib-app",e.biolibCustom="biolib-custom",e.biolibEcr="biolib-ecr"}(R||(R={})),function(e){e.completed="completed",e.failed="failed",e.inProgress="in_progress",e.awaitingInput="awaiting_input",e.clientAborted="client_aborted"}(M||(M={})),function(e){e.active="active",e.revoked="revoked"}($||($={}));var H=r(41),V=r(63),F=r(0),K=r(42),z=r(3),q=r(1);class J{constructor(e={}){this.type=Object(q.f)(e,"type",J.defaultValues("type")),this.value=Object(q.f)(e,"value",J.defaultValues("value")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return"";case"value":return{};default:throw new Error(`Invalid member name for AttributeTypeAndValue class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.p({name:t.type||""}),new F.a({name:t.value||""})]})}static blockName(){return"AttributeTypeAndValue"}fromSchema(e){Object(q.d)(e,["type","typeValue"]);const t=F.D(e,e,J.schema({names:{type:"type",value:"typeValue"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AttributeTypeAndValue");this.type=t.result.type.valueBlock.toString(),this.value=t.result.typeValue}toSchema(){return new F.v({value:[new F.p({value:this.type}),this.value]})}toJSON(){const e={type:this.type};return 0!==Object.keys(this.value).length?e.value=this.value.toJSON():e.value=this.value,e}isEqual(e){const t=[F.A.blockName(),F.c.blockName(),F.z.blockName(),F.o.blockName(),F.s.blockName(),F.x.blockName(),F.B.blockName(),F.l.blockName(),F.k.blockName(),F.C.blockName(),F.i.blockName(),F.e.blockName()];if(e.constructor.blockName()===J.blockName()){if(this.type!==e.type)return!1;let r=!1;const n=this.value.constructor.blockName();if(n===e.value.constructor.blockName())for(const e of t)if(n===e){r=!0;break}if(r){const t=Object(z.i)(this.value.valueBlock.value),r=Object(z.i)(e.value.valueBlock.value);if(0!==t.localeCompare(r))return!1}else if(!1===Object(q.g)(this.value.valueBeforeDecode,e.value.valueBeforeDecode))return!1;return!0}return e instanceof ArrayBuffer&&Object(q.g)(this.value.valueBeforeDecode,e)}}class Y{constructor(e={}){this.typesAndValues=Object(q.f)(e,"typesAndValues",Y.defaultValues("typesAndValues")),this.valueBeforeDecode=Object(q.f)(e,"valueBeforeDecode",Y.defaultValues("valueBeforeDecode")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"typesAndValues":return[];case"valueBeforeDecode":return new ArrayBuffer(0);default:throw new Error(`Invalid member name for RelativeDistinguishedNames class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"typesAndValues":return 0===t.length;case"valueBeforeDecode":return 0===t.byteLength;default:throw new Error(`Invalid member name for RelativeDistinguishedNames class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.repeatedSequence||"",value:new F.w({value:[new F.u({name:t.repeatedSet||"",value:J.schema(t.typeAndValue||{})})]})})]})}fromSchema(e){Object(q.d)(e,["RDN","typesAndValues"]);const t=F.D(e,e,Y.schema({names:{blockName:"RDN",repeatedSet:"typesAndValues"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RelativeDistinguishedNames");"typesAndValues"in t.result&&(this.typesAndValues=Array.from(t.result.typesAndValues,(e=>new J({schema:e})))),this.valueBeforeDecode=t.result.RDN.valueBeforeDecode}toSchema(){if(0===this.valueBeforeDecode.byteLength)return new F.v({value:[new F.w({value:Array.from(this.typesAndValues,(e=>e.toSchema()))})]});return F.E(this.valueBeforeDecode).result}toJSON(){return{typesAndValues:Array.from(this.typesAndValues,(e=>e.toJSON()))}}isEqual(e){if(e instanceof Y){if(this.typesAndValues.length!==e.typesAndValues.length)return!1;for(const[t,r]of this.typesAndValues.entries())if(!1===r.isEqual(e.typesAndValues[t]))return!1;return!0}return e instanceof ArrayBuffer&&Object(q.g)(this.valueBeforeDecode,e)}}function G(e={},t=!1){const r=Object(q.f)(e,"names",{});return new F.v({optional:t,value:[new F.g({optional:!0,idBlock:{tagClass:2,tagNumber:1},name:r.country_name||"",value:[new F.f({value:[new F.o,new F.s]})]}),new F.g({optional:!0,idBlock:{tagClass:2,tagNumber:2},name:r.administration_domain_name||"",value:[new F.f({value:[new F.o,new F.s]})]}),new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:0},name:r.network_address||"",isHexOnly:!0}),new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:1},name:r.terminal_identifier||"",isHexOnly:!0}),new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:2},name:r.private_domain_name||"",value:[new F.f({value:[new F.o,new F.s]})]}),new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:3},name:r.organization_name||"",isHexOnly:!0}),new F.r({optional:!0,name:r.numeric_user_identifier||"",idBlock:{tagClass:3,tagNumber:4},isHexOnly:!0}),new F.g({optional:!0,name:r.personal_name||"",idBlock:{tagClass:3,tagNumber:5},value:[new F.r({idBlock:{tagClass:3,tagNumber:0},isHexOnly:!0}),new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:1},isHexOnly:!0}),new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:2},isHexOnly:!0}),new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:3},isHexOnly:!0})]}),new F.g({optional:!0,name:r.organizational_unit_names||"",idBlock:{tagClass:3,tagNumber:6},value:[new F.u({value:new F.s})]})]})}function W(e=!1){return new F.v({optional:e,value:[new F.s,new F.s]})}function X(e=!1){return new F.w({optional:e,value:[new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:0},isHexOnly:!0}),new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new F.a]})]})}class Q{constructor(e={}){this.type=Object(q.f)(e,"type",Q.defaultValues("type")),this.value=Object(q.f)(e,"value",Q.defaultValues("value")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return 9;case"value":return{};default:throw new Error(`Invalid member name for GeneralName class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"type":return t===Q.defaultValues(e);case"value":return 0===Object.keys(t).length;default:throw new Error(`Invalid member name for GeneralName class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.f({value:[new F.g({idBlock:{tagClass:3,tagNumber:0},name:t.blockName||"",value:[new F.p,new F.g({idBlock:{tagClass:3,tagNumber:0},value:[new F.a]})]}),new F.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:1}}),new F.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:2}}),new F.g({idBlock:{tagClass:3,tagNumber:3},name:t.blockName||"",value:[G(t.builtInStandardAttributes||{},!1),W(!0),X(!0)]}),new F.g({idBlock:{tagClass:3,tagNumber:4},name:t.blockName||"",value:[Y.schema(t.directoryName||{})]}),new F.g({idBlock:{tagClass:3,tagNumber:5},name:t.blockName||"",value:[new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new F.f({value:[new F.x,new F.s,new F.z,new F.A,new F.c]})]}),new F.g({idBlock:{tagClass:3,tagNumber:1},value:[new F.f({value:[new F.x,new F.s,new F.z,new F.A,new F.c]})]})]}),new F.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:6}}),new F.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:7}}),new F.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:8}})]})}fromSchema(e){Object(q.d)(e,["blockName","otherName","rfc822Name","dNSName","x400Address","directoryName","ediPartyName","uniformResourceIdentifier","iPAddress","registeredID"]);const t=F.D(e,e,Q.schema({names:{blockName:"blockName",otherName:"otherName",rfc822Name:"rfc822Name",dNSName:"dNSName",x400Address:"x400Address",directoryName:{names:{blockName:"directoryName"}},ediPartyName:"ediPartyName",uniformResourceIdentifier:"uniformResourceIdentifier",iPAddress:"iPAddress",registeredID:"registeredID"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for GeneralName");switch(this.type=t.result.blockName.idBlock.tagNumber,this.type){case 0:this.value=t.result.blockName;break;case 1:case 2:case 6:{const e=t.result.blockName;e.idBlock.tagClass=1,e.idBlock.tagNumber=22;const r=e.toBER(!1);this.value=F.E(r).result.valueBlock.value}break;case 3:this.value=t.result.blockName;break;case 4:this.value=new Y({schema:t.result.directoryName});break;case 5:this.value=t.result.ediPartyName;break;case 7:this.value=new F.q({valueHex:t.result.blockName.valueBlock.valueHex});break;case 8:{const e=t.result.blockName;e.idBlock.tagClass=1,e.idBlock.tagNumber=6;const r=e.toBER(!1);this.value=F.E(r).result.valueBlock.toString()}}}toSchema(){switch(this.type){case 0:case 3:case 5:return new F.g({idBlock:{tagClass:3,tagNumber:this.type},value:[this.value]});case 1:case 2:case 6:{const e=new F.l({value:this.value});return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}case 4:return new F.g({idBlock:{tagClass:3,tagNumber:4},value:[this.value.toSchema()]});case 7:{const e=this.value;return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}case 8:{const e=new F.p({value:this.value});return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}default:return Q.schema()}}toJSON(){const e={type:this.type,value:""};if("string"==typeof this.value)e.value=this.value;else try{e.value=this.value.toJSON()}catch(e){}return e}}class Z{constructor(e={}){this.accessMethod=Object(q.f)(e,"accessMethod",Z.defaultValues("accessMethod")),this.accessLocation=Object(q.f)(e,"accessLocation",Z.defaultValues("accessLocation")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"accessMethod":return"";case"accessLocation":return new Q;default:throw new Error(`Invalid member name for AccessDescription class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.p({name:t.accessMethod||""}),Q.schema(t.accessLocation||{})]})}fromSchema(e){Object(q.d)(e,["accessMethod","accessLocation"]);const t=F.D(e,e,Z.schema({names:{accessMethod:"accessMethod",accessLocation:{names:{blockName:"accessLocation"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AccessDescription");this.accessMethod=t.result.accessMethod.valueBlock.toString(),this.accessLocation=new Q({schema:t.result.accessLocation})}toSchema(){return new F.v({value:[new F.p({value:this.accessMethod}),this.accessLocation.toSchema()]})}toJSON(){return{accessMethod:this.accessMethod,accessLocation:this.accessLocation.toJSON()}}}var ee=r(2);class te{constructor(e={}){this.altNames=Object(q.f)(e,"altNames",te.defaultValues("altNames")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"altNames":return[];default:throw new Error(`Invalid member name for AltName class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.altNames||"",value:Q.schema()})]})}fromSchema(e){Object(q.d)(e,["altNames"]);const t=F.D(e,e,te.schema({names:{altNames:"altNames"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AltName");"altNames"in t.result&&(this.altNames=Array.from(t.result.altNames,(e=>new Q({schema:e}))))}toSchema(){return new F.v({value:Array.from(this.altNames,(e=>e.toSchema()))})}toJSON(){return{altNames:Array.from(this.altNames,(e=>e.toJSON()))}}}var re=r(4);var ne=r(11);r(5);class ie{constructor(e={}){this.type=Object(q.f)(e,"type",ie.defaultValues("type")),this.value=Object(q.f)(e,"value",ie.defaultValues("value")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return 0;case"value":return new Date(0,0,0);default:throw new Error(`Invalid member name for Time class: ${e}`)}}static schema(e={},t=!1){const r=Object(q.f)(e,"names",{});return new F.f({optional:t,value:[new F.y({name:r.utcTimeName||""}),new F.j({name:r.generalTimeName||""})]})}fromSchema(e){Object(q.d)(e,["utcTimeName","generalTimeName"]);const t=F.D(e,e,ie.schema({names:{utcTimeName:"utcTimeName",generalTimeName:"generalTimeName"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Time");"utcTimeName"in t.result&&(this.type=0,this.value=t.result.utcTimeName.toDate()),"generalTimeName"in t.result&&(this.type=1,this.value=t.result.generalTimeName.toDate())}toSchema(){let e={};return 0===this.type&&(e=new F.y({valueDate:this.value})),1===this.type&&(e=new F.j({valueDate:this.value})),e}toJSON(){return{type:this.type,value:this.value}}}var se=r(7);class ae{constructor(e={}){this.attributes=Object(q.f)(e,"attributes",ae.defaultValues("attributes")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"attributes":return[];default:throw new Error(`Invalid member name for SubjectDirectoryAttributes class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.attributes||"",value:re.a.schema()})]})}fromSchema(e){Object(q.d)(e,["attributes"]);const t=F.D(e,e,ae.schema({names:{attributes:"attributes"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for SubjectDirectoryAttributes");this.attributes=Array.from(t.result.attributes,(e=>new re.a({schema:e})))}toSchema(){return new F.v({value:Array.from(this.attributes,(e=>e.toSchema()))})}toJSON(){return{attributes:Array.from(this.attributes,(e=>e.toJSON()))}}}class oe{constructor(e={}){"notBefore"in e&&(this.notBefore=Object(q.f)(e,"notBefore",oe.defaultValues("notBefore"))),"notAfter"in e&&(this.notAfter=Object(q.f)(e,"notAfter",oe.defaultValues("notAfter"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"notBefore":case"notAfter":return new Date;default:throw new Error(`Invalid member name for PrivateKeyUsagePeriod class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.r({name:t.notBefore||"",optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new F.r({name:t.notAfter||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Object(q.d)(e,["notBefore","notAfter"]);const t=F.D(e,e,oe.schema({names:{notBefore:"notBefore",notAfter:"notAfter"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PrivateKeyUsagePeriod");if("notBefore"in t.result){const e=new F.j;e.fromBuffer(t.result.notBefore.valueBlock.valueHex),this.notBefore=e.toDate()}if("notAfter"in t.result){const e=new F.j({valueHex:t.result.notAfter.valueBlock.valueHex});e.fromBuffer(t.result.notAfter.valueBlock.valueHex),this.notAfter=e.toDate()}}toSchema(){const e=[];return"notBefore"in this&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:0},valueHex:new F.j({valueDate:this.notBefore}).valueBlock.valueHex})),"notAfter"in this&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:1},valueHex:new F.j({valueDate:this.notAfter}).valueBlock.valueHex})),new F.v({value:e})}toJSON(){const e={};return"notBefore"in this&&(e.notBefore=this.notBefore),"notAfter"in this&&(e.notAfter=this.notAfter),e}}class ue{constructor(e={}){this.cA=Object(q.f)(e,"cA",!1),"pathLenConstraint"in e&&(this.pathLenConstraint=Object(q.f)(e,"pathLenConstraint",0)),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"cA":return!1;default:throw new Error(`Invalid member name for BasicConstraints class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.d({optional:!0,name:t.cA||""}),new F.m({optional:!0,name:t.pathLenConstraint||""})]})}fromSchema(e){Object(q.d)(e,["cA","pathLenConstraint"]);const t=F.D(e,e,ue.schema({names:{cA:"cA",pathLenConstraint:"pathLenConstraint"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for BasicConstraints");"cA"in t.result&&(this.cA=t.result.cA.valueBlock.value),"pathLenConstraint"in t.result&&(t.result.pathLenConstraint.valueBlock.isHexOnly?this.pathLenConstraint=t.result.pathLenConstraint:this.pathLenConstraint=t.result.pathLenConstraint.valueBlock.valueDec)}toSchema(){const e=[];return this.cA!==ue.defaultValues("cA")&&e.push(new F.d({value:this.cA})),"pathLenConstraint"in this&&(this.pathLenConstraint instanceof F.m?e.push(this.pathLenConstraint):e.push(new F.m({value:this.pathLenConstraint}))),new F.v({value:e})}toJSON(){const e={};return this.cA!==ue.defaultValues("cA")&&(e.cA=this.cA),"pathLenConstraint"in this&&(this.pathLenConstraint instanceof F.m?e.pathLenConstraint=this.pathLenConstraint.toJSON():e.pathLenConstraint=this.pathLenConstraint),e}}class ce{constructor(e={}){"distributionPoint"in e&&(this.distributionPoint=Object(q.f)(e,"distributionPoint",ce.defaultValues("distributionPoint"))),this.onlyContainsUserCerts=Object(q.f)(e,"onlyContainsUserCerts",ce.defaultValues("onlyContainsUserCerts")),this.onlyContainsCACerts=Object(q.f)(e,"onlyContainsCACerts",ce.defaultValues("onlyContainsCACerts")),"onlySomeReasons"in e&&(this.onlySomeReasons=Object(q.f)(e,"onlySomeReasons",ce.defaultValues("onlySomeReasons"))),this.indirectCRL=Object(q.f)(e,"indirectCRL",ce.defaultValues("indirectCRL")),this.onlyContainsAttributeCerts=Object(q.f)(e,"onlyContainsAttributeCerts",ce.defaultValues("onlyContainsAttributeCerts")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"distributionPoint":return[];case"onlyContainsUserCerts":case"onlyContainsCACerts":return!1;case"onlySomeReasons":return 0;case"indirectCRL":case"onlyContainsAttributeCerts":return!1;default:throw new Error(`Invalid member name for IssuingDistributionPoint class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new F.f({value:[new F.g({name:t.distributionPoint||"",idBlock:{tagClass:3,tagNumber:0},value:[new F.u({name:t.distributionPointNames||"",value:Q.schema()})]}),new F.g({name:t.distributionPoint||"",idBlock:{tagClass:3,tagNumber:1},value:Y.schema().valueBlock.value})]})]}),new F.r({name:t.onlyContainsUserCerts||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new F.r({name:t.onlyContainsCACerts||"",optional:!0,idBlock:{tagClass:3,tagNumber:2}}),new F.r({name:t.onlySomeReasons||"",optional:!0,idBlock:{tagClass:3,tagNumber:3}}),new F.r({name:t.indirectCRL||"",optional:!0,idBlock:{tagClass:3,tagNumber:4}}),new F.r({name:t.onlyContainsAttributeCerts||"",optional:!0,idBlock:{tagClass:3,tagNumber:5}})]})}fromSchema(e){Object(q.d)(e,["distributionPoint","distributionPointNames","onlyContainsUserCerts","onlyContainsCACerts","onlySomeReasons","indirectCRL","onlyContainsAttributeCerts"]);const t=F.D(e,e,ce.schema({names:{distributionPoint:"distributionPoint",distributionPointNames:"distributionPointNames",onlyContainsUserCerts:"onlyContainsUserCerts",onlyContainsCACerts:"onlyContainsCACerts",onlySomeReasons:"onlySomeReasons",indirectCRL:"indirectCRL",onlyContainsAttributeCerts:"onlyContainsAttributeCerts"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for IssuingDistributionPoint");if("distributionPoint"in t.result)switch(!0){case 0===t.result.distributionPoint.idBlock.tagNumber:this.distributionPoint=Array.from(t.result.distributionPointNames,(e=>new Q({schema:e})));break;case 1===t.result.distributionPoint.idBlock.tagNumber:this.distributionPoint=new Y({schema:new F.v({value:t.result.distributionPoint.valueBlock.value})});break;default:throw new Error("Unknown tagNumber for distributionPoint: {$asn1.result.distributionPoint.idBlock.tagNumber}")}if("onlyContainsUserCerts"in t.result){const e=new Uint8Array(t.result.onlyContainsUserCerts.valueBlock.valueHex);this.onlyContainsUserCerts=0!==e[0]}if("onlyContainsCACerts"in t.result){const e=new Uint8Array(t.result.onlyContainsCACerts.valueBlock.valueHex);this.onlyContainsCACerts=0!==e[0]}if("onlySomeReasons"in t.result){const e=new Uint8Array(t.result.onlySomeReasons.valueBlock.valueHex);this.onlySomeReasons=e[0]}if("indirectCRL"in t.result){const e=new Uint8Array(t.result.indirectCRL.valueBlock.valueHex);this.indirectCRL=0!==e[0]}if("onlyContainsAttributeCerts"in t.result){const e=new Uint8Array(t.result.onlyContainsAttributeCerts.valueBlock.valueHex);this.onlyContainsAttributeCerts=0!==e[0]}}toSchema(){const e=[];if("distributionPoint"in this){let t;this.distributionPoint instanceof Array?t=new F.g({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.distributionPoint,(e=>e.toSchema()))}):(t=this.distributionPoint.toSchema(),t.idBlock.tagClass=3,t.idBlock.tagNumber=1),e.push(new F.g({idBlock:{tagClass:3,tagNumber:0},value:[t]}))}if(this.onlyContainsUserCerts!==ce.defaultValues("onlyContainsUserCerts")&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:1},valueHex:new Uint8Array([255]).buffer})),this.onlyContainsCACerts!==ce.defaultValues("onlyContainsCACerts")&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:2},valueHex:new Uint8Array([255]).buffer})),"onlySomeReasons"in this){const t=new ArrayBuffer(1);new Uint8Array(t)[0]=this.onlySomeReasons,e.push(new F.r({idBlock:{tagClass:3,tagNumber:3},valueHex:t}))}return this.indirectCRL!==ce.defaultValues("indirectCRL")&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:4},valueHex:new Uint8Array([255]).buffer})),this.onlyContainsAttributeCerts!==ce.defaultValues("onlyContainsAttributeCerts")&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:5},valueHex:new Uint8Array([255]).buffer})),new F.v({value:e})}toJSON(){const e={};return"distributionPoint"in this&&(this.distributionPoint instanceof Array?e.distributionPoint=Array.from(this.distributionPoint,(e=>e.toJSON())):e.distributionPoint=this.distributionPoint.toJSON()),this.onlyContainsUserCerts!==ce.defaultValues("onlyContainsUserCerts")&&(e.onlyContainsUserCerts=this.onlyContainsUserCerts),this.onlyContainsCACerts!==ce.defaultValues("onlyContainsCACerts")&&(e.onlyContainsCACerts=this.onlyContainsCACerts),"onlySomeReasons"in this&&(e.onlySomeReasons=this.onlySomeReasons),this.indirectCRL!==ce.defaultValues("indirectCRL")&&(e.indirectCRL=this.indirectCRL),this.onlyContainsAttributeCerts!==ce.defaultValues("onlyContainsAttributeCerts")&&(e.onlyContainsAttributeCerts=this.onlyContainsAttributeCerts),e}}class le{constructor(e={}){this.names=Object(q.f)(e,"names",le.defaultValues("names")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"names":return[];default:throw new Error(`Invalid member name for GeneralNames class: ${e}`)}}static schema(e={},t=!1){const r=Object(q.f)(e,"names",{});return new F.v({optional:t,name:r.blockName||"",value:[new F.u({name:r.generalNames||"",value:Q.schema()})]})}fromSchema(e){Object(q.d)(e,["names","generalNames"]);const t=F.D(e,e,le.schema({names:{blockName:"names",generalNames:"generalNames"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for GeneralNames");this.names=Array.from(t.result.generalNames,(e=>new Q({schema:e})))}toSchema(){return new F.v({value:Array.from(this.names,(e=>e.toSchema()))})}toJSON(){return{names:Array.from(this.names,(e=>e.toJSON()))}}}class he{constructor(e={}){this.base=Object(q.f)(e,"base",he.defaultValues("base")),this.minimum=Object(q.f)(e,"minimum",he.defaultValues("minimum")),"maximum"in e&&(this.maximum=Object(q.f)(e,"maximum",he.defaultValues("maximum"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"base":return new Q;case"minimum":case"maximum":return 0;default:throw new Error(`Invalid member name for GeneralSubtree class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[Q.schema(t.base||{}),new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new F.m({name:t.minimum||""})]}),new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new F.m({name:t.maximum||""})]})]})}fromSchema(e){Object(q.d)(e,["base","minimum","maximum"]);const t=F.D(e,e,he.schema({names:{base:{names:{blockName:"base"}},minimum:"minimum",maximum:"maximum"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for GeneralSubtree");this.base=new Q({schema:t.result.base}),"minimum"in t.result&&(t.result.minimum.valueBlock.isHexOnly?this.minimum=t.result.minimum:this.minimum=t.result.minimum.valueBlock.valueDec),"maximum"in t.result&&(t.result.maximum.valueBlock.isHexOnly?this.maximum=t.result.maximum:this.maximum=t.result.maximum.valueBlock.valueDec)}toSchema(){const e=[];if(e.push(this.base.toSchema()),0!==this.minimum){let t=0;t=this.minimum instanceof F.m?this.minimum:new F.m({value:this.minimum}),e.push(new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[t]}))}if("maximum"in this){let t=0;t=this.maximum instanceof F.m?this.maximum:new F.m({value:this.maximum}),e.push(new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[t]}))}return new F.v({value:e})}toJSON(){const e={base:this.base.toJSON()};return 0!==this.minimum&&("number"==typeof this.minimum?e.minimum=this.minimum:e.minimum=this.minimum.toJSON()),"maximum"in this&&("number"==typeof this.maximum?e.maximum=this.maximum:e.maximum=this.maximum.toJSON()),e}}class fe{constructor(e={}){"permittedSubtrees"in e&&(this.permittedSubtrees=Object(q.f)(e,"permittedSubtrees",fe.defaultValues("permittedSubtrees"))),"excludedSubtrees"in e&&(this.excludedSubtrees=Object(q.f)(e,"excludedSubtrees",fe.defaultValues("excludedSubtrees"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"permittedSubtrees":case"excludedSubtrees":return[];default:throw new Error(`Invalid member name for NameConstraints class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new F.u({name:t.permittedSubtrees||"",value:he.schema()})]}),new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new F.u({name:t.excludedSubtrees||"",value:he.schema()})]})]})}fromSchema(e){Object(q.d)(e,["permittedSubtrees","excludedSubtrees"]);const t=F.D(e,e,fe.schema({names:{permittedSubtrees:"permittedSubtrees",excludedSubtrees:"excludedSubtrees"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for NameConstraints");"permittedSubtrees"in t.result&&(this.permittedSubtrees=Array.from(t.result.permittedSubtrees,(e=>new he({schema:e})))),"excludedSubtrees"in t.result&&(this.excludedSubtrees=Array.from(t.result.excludedSubtrees,(e=>new he({schema:e}))))}toSchema(){const e=[];return"permittedSubtrees"in this&&e.push(new F.g({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.permittedSubtrees,(e=>e.toSchema()))})),"excludedSubtrees"in this&&e.push(new F.g({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.excludedSubtrees,(e=>e.toSchema()))})),new F.v({value:e})}toJSON(){const e={};return"permittedSubtrees"in this&&(e.permittedSubtrees=Array.from(this.permittedSubtrees,(e=>e.toJSON()))),"excludedSubtrees"in this&&(e.excludedSubtrees=Array.from(this.excludedSubtrees,(e=>e.toJSON()))),e}}class de{constructor(e={}){"distributionPoint"in e&&(this.distributionPoint=Object(q.f)(e,"distributionPoint",de.defaultValues("distributionPoint"))),"reasons"in e&&(this.reasons=Object(q.f)(e,"reasons",de.defaultValues("reasons"))),"cRLIssuer"in e&&(this.cRLIssuer=Object(q.f)(e,"cRLIssuer",de.defaultValues("cRLIssuer"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"distributionPoint":return[];case"reasons":return new F.b;case"cRLIssuer":return[];default:throw new Error(`Invalid member name for DistributionPoint class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new F.f({value:[new F.g({name:t.distributionPoint||"",optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new F.u({name:t.distributionPointNames||"",value:Q.schema()})]}),new F.g({name:t.distributionPoint||"",optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Y.schema().valueBlock.value})]})]}),new F.r({name:t.reasons||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new F.g({name:t.cRLIssuer||"",optional:!0,idBlock:{tagClass:3,tagNumber:2},value:[new F.u({name:t.cRLIssuerNames||"",value:Q.schema()})]})]})}fromSchema(e){Object(q.d)(e,["distributionPoint","distributionPointNames","reasons","cRLIssuer","cRLIssuerNames"]);const t=F.D(e,e,de.schema({names:{distributionPoint:"distributionPoint",distributionPointNames:"distributionPointNames",reasons:"reasons",cRLIssuer:"cRLIssuer",cRLIssuerNames:"cRLIssuerNames"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for DistributionPoint");"distributionPoint"in t.result&&(0===t.result.distributionPoint.idBlock.tagNumber&&(this.distributionPoint=Array.from(t.result.distributionPointNames,(e=>new Q({schema:e})))),1===t.result.distributionPoint.idBlock.tagNumber&&(this.distributionPoint=new Y({schema:new F.v({value:t.result.distributionPoint.valueBlock.value})}))),"reasons"in t.result&&(this.reasons=new F.b({valueHex:t.result.reasons.valueBlock.valueHex})),"cRLIssuer"in t.result&&(this.cRLIssuer=Array.from(t.result.cRLIssuerNames,(e=>new Q({schema:e}))))}toSchema(){const e=[];if("distributionPoint"in this){let t;t=this.distributionPoint instanceof Array?new F.g({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.distributionPoint,(e=>e.toSchema()))}):new F.g({idBlock:{tagClass:3,tagNumber:1},value:[this.distributionPoint.toSchema()]}),e.push(new F.g({idBlock:{tagClass:3,tagNumber:0},value:[t]}))}return"reasons"in this&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:1},valueHex:this.reasons.valueBlock.valueHex})),"cRLIssuer"in this&&e.push(new F.g({idBlock:{tagClass:3,tagNumber:2},value:Array.from(this.cRLIssuer,(e=>e.toSchema()))})),new F.v({value:e})}toJSON(){const e={};return"distributionPoint"in this&&(this.distributionPoint instanceof Array?e.distributionPoint=Array.from(this.distributionPoint,(e=>e.toJSON())):e.distributionPoint=this.distributionPoint.toJSON()),"reasons"in this&&(e.reasons=this.reasons.toJSON()),"cRLIssuer"in this&&(e.cRLIssuer=Array.from(this.cRLIssuer,(e=>e.toJSON()))),e}}class me{constructor(e={}){this.distributionPoints=Object(q.f)(e,"distributionPoints",me.defaultValues("distributionPoints")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"distributionPoints":return[];default:throw new Error(`Invalid member name for CRLDistributionPoints class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.distributionPoints||"",value:de.schema()})]})}fromSchema(e){Object(q.d)(e,["distributionPoints"]);const t=F.D(e,e,me.schema({names:{distributionPoints:"distributionPoints"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CRLDistributionPoints");this.distributionPoints=Array.from(t.result.distributionPoints,(e=>new de({schema:e})))}toSchema(){return new F.v({value:Array.from(this.distributionPoints,(e=>e.toSchema()))})}toJSON(){return{distributionPoints:Array.from(this.distributionPoints,(e=>e.toJSON()))}}}class pe{constructor(e={}){this.policyQualifierId=Object(q.f)(e,"policyQualifierId",pe.defaultValues("policyQualifierId")),this.qualifier=Object(q.f)(e,"qualifier",pe.defaultValues("qualifier")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"policyQualifierId":return"";case"qualifier":return new F.a;default:throw new Error(`Invalid member name for PolicyQualifierInfo class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.p({name:t.policyQualifierId||""}),new F.a({name:t.qualifier||""})]})}fromSchema(e){Object(q.d)(e,["policyQualifierId","qualifier"]);const t=F.D(e,e,pe.schema({names:{policyQualifierId:"policyQualifierId",qualifier:"qualifier"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyQualifierInfo");this.policyQualifierId=t.result.policyQualifierId.valueBlock.toString(),this.qualifier=t.result.qualifier}toSchema(){return new F.v({value:[new F.p({value:this.policyQualifierId}),this.qualifier]})}toJSON(){return{policyQualifierId:this.policyQualifierId,qualifier:this.qualifier.toJSON()}}}class be{constructor(e={}){this.policyIdentifier=Object(q.f)(e,"policyIdentifier",be.defaultValues("policyIdentifier")),"policyQualifiers"in e&&(this.policyQualifiers=Object(q.f)(e,"policyQualifiers",be.defaultValues("policyQualifiers"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"policyIdentifier":return"";case"policyQualifiers":return[];default:throw new Error(`Invalid member name for PolicyInformation class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.p({name:t.policyIdentifier||""}),new F.v({optional:!0,value:[new F.u({name:t.policyQualifiers||"",value:pe.schema()})]})]})}fromSchema(e){Object(q.d)(e,["policyIdentifier","policyQualifiers"]);const t=F.D(e,e,be.schema({names:{policyIdentifier:"policyIdentifier",policyQualifiers:"policyQualifiers"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyInformation");this.policyIdentifier=t.result.policyIdentifier.valueBlock.toString(),"policyQualifiers"in t.result&&(this.policyQualifiers=Array.from(t.result.policyQualifiers,(e=>new pe({schema:e}))))}toSchema(){const e=[];return e.push(new F.p({value:this.policyIdentifier})),"policyQualifiers"in this&&e.push(new F.v({value:Array.from(this.policyQualifiers,(e=>e.toSchema()))})),new F.v({value:e})}toJSON(){const e={policyIdentifier:this.policyIdentifier};return"policyQualifiers"in this&&(e.policyQualifiers=Array.from(this.policyQualifiers,(e=>e.toJSON()))),e}}class ge{constructor(e={}){this.certificatePolicies=Object(q.f)(e,"certificatePolicies",ge.defaultValues("certificatePolicies")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"certificatePolicies":return[];default:throw new Error(`Invalid member name for CertificatePolicies class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.certificatePolicies||"",value:be.schema()})]})}fromSchema(e){Object(q.d)(e,["certificatePolicies"]);const t=F.D(e,e,ge.schema({names:{certificatePolicies:"certificatePolicies"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CertificatePolicies");this.certificatePolicies=Array.from(t.result.certificatePolicies,(e=>new be({schema:e})))}toSchema(){return new F.v({value:Array.from(this.certificatePolicies,(e=>e.toSchema()))})}toJSON(){return{certificatePolicies:Array.from(this.certificatePolicies,(e=>e.toJSON()))}}}class ye{constructor(e={}){this.issuerDomainPolicy=Object(q.f)(e,"issuerDomainPolicy",ye.defaultValues("issuerDomainPolicy")),this.subjectDomainPolicy=Object(q.f)(e,"subjectDomainPolicy",ye.defaultValues("subjectDomainPolicy")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"issuerDomainPolicy":case"subjectDomainPolicy":return"";default:throw new Error(`Invalid member name for PolicyMapping class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.p({name:t.issuerDomainPolicy||""}),new F.p({name:t.subjectDomainPolicy||""})]})}fromSchema(e){Object(q.d)(e,["issuerDomainPolicy","subjectDomainPolicy"]);const t=F.D(e,e,ye.schema({names:{issuerDomainPolicy:"issuerDomainPolicy",subjectDomainPolicy:"subjectDomainPolicy"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyMapping");this.issuerDomainPolicy=t.result.issuerDomainPolicy.valueBlock.toString(),this.subjectDomainPolicy=t.result.subjectDomainPolicy.valueBlock.toString()}toSchema(){return new F.v({value:[new F.p({value:this.issuerDomainPolicy}),new F.p({value:this.subjectDomainPolicy})]})}toJSON(){return{issuerDomainPolicy:this.issuerDomainPolicy,subjectDomainPolicy:this.subjectDomainPolicy}}}class ve{constructor(e={}){this.mappings=Object(q.f)(e,"mappings",ve.defaultValues("mappings")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"mappings":return[];default:throw new Error(`Invalid member name for PolicyMappings class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.mappings||"",value:ye.schema()})]})}fromSchema(e){Object(q.d)(e,["mappings"]);const t=F.D(e,e,ve.schema({names:{mappings:"mappings"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyMappings");this.mappings=Array.from(t.result.mappings,(e=>new ye({schema:e})))}toSchema(){return new F.v({value:Array.from(this.mappings,(e=>e.toSchema()))})}toJSON(){return{mappings:Array.from(this.mappings,(e=>e.toJSON()))}}}class we{constructor(e={}){"keyIdentifier"in e&&(this.keyIdentifier=Object(q.f)(e,"keyIdentifier",we.defaultValues("keyIdentifier"))),"authorityCertIssuer"in e&&(this.authorityCertIssuer=Object(q.f)(e,"authorityCertIssuer",we.defaultValues("authorityCertIssuer"))),"authorityCertSerialNumber"in e&&(this.authorityCertSerialNumber=Object(q.f)(e,"authorityCertSerialNumber",we.defaultValues("authorityCertSerialNumber"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"keyIdentifier":return new F.q;case"authorityCertIssuer":return[];case"authorityCertSerialNumber":return new F.m;default:throw new Error(`Invalid member name for AuthorityKeyIdentifier class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.r({name:t.keyIdentifier||"",optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new F.u({name:t.authorityCertIssuer||"",value:Q.schema()})]}),new F.r({name:t.authorityCertSerialNumber||"",optional:!0,idBlock:{tagClass:3,tagNumber:2}})]})}fromSchema(e){Object(q.d)(e,["keyIdentifier","authorityCertIssuer","authorityCertSerialNumber"]);const t=F.D(e,e,we.schema({names:{keyIdentifier:"keyIdentifier",authorityCertIssuer:"authorityCertIssuer",authorityCertSerialNumber:"authorityCertSerialNumber"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AuthorityKeyIdentifier");"keyIdentifier"in t.result&&(this.keyIdentifier=new F.q({valueHex:t.result.keyIdentifier.valueBlock.valueHex})),"authorityCertIssuer"in t.result&&(this.authorityCertIssuer=Array.from(t.result.authorityCertIssuer,(e=>new Q({schema:e})))),"authorityCertSerialNumber"in t.result&&(this.authorityCertSerialNumber=new F.m({valueHex:t.result.authorityCertSerialNumber.valueBlock.valueHex}))}toSchema(){const e=[];return"keyIdentifier"in this&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:0},valueHex:this.keyIdentifier.valueBlock.valueHex})),"authorityCertIssuer"in this&&e.push(new F.g({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.authorityCertIssuer,(e=>e.toSchema()))})),"authorityCertSerialNumber"in this&&e.push(new F.r({idBlock:{tagClass:3,tagNumber:2},valueHex:this.authorityCertSerialNumber.valueBlock.valueHex})),new F.v({value:e})}toJSON(){const e={};return"keyIdentifier"in this&&(e.keyIdentifier=this.keyIdentifier.toJSON()),"authorityCertIssuer"in this&&(e.authorityCertIssuer=Array.from(this.authorityCertIssuer,(e=>e.toJSON()))),"authorityCertSerialNumber"in this&&(e.authorityCertSerialNumber=this.authorityCertSerialNumber.toJSON()),e}}class _e{constructor(e={}){"requireExplicitPolicy"in e&&(this.requireExplicitPolicy=Object(q.f)(e,"requireExplicitPolicy",_e.defaultValues("requireExplicitPolicy"))),"inhibitPolicyMapping"in e&&(this.inhibitPolicyMapping=Object(q.f)(e,"inhibitPolicyMapping",_e.defaultValues("inhibitPolicyMapping"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"requireExplicitPolicy":case"inhibitPolicyMapping":return 0;default:throw new Error(`Invalid member name for PolicyConstraints class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.r({name:t.requireExplicitPolicy||"",optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new F.r({name:t.inhibitPolicyMapping||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Object(q.d)(e,["requireExplicitPolicy","inhibitPolicyMapping"]);const t=F.D(e,e,_e.schema({names:{requireExplicitPolicy:"requireExplicitPolicy",inhibitPolicyMapping:"inhibitPolicyMapping"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyConstraints");if("requireExplicitPolicy"in t.result){const e=t.result.requireExplicitPolicy;e.idBlock.tagClass=1,e.idBlock.tagNumber=2;const r=e.toBER(!1),n=F.E(r);this.requireExplicitPolicy=n.result.valueBlock.valueDec}if("inhibitPolicyMapping"in t.result){const e=t.result.inhibitPolicyMapping;e.idBlock.tagClass=1,e.idBlock.tagNumber=2;const r=e.toBER(!1),n=F.E(r);this.inhibitPolicyMapping=n.result.valueBlock.valueDec}}toSchema(){const e=[];if("requireExplicitPolicy"in this){const t=new F.m({value:this.requireExplicitPolicy});t.idBlock.tagClass=3,t.idBlock.tagNumber=0,e.push(t)}if("inhibitPolicyMapping"in this){const t=new F.m({value:this.inhibitPolicyMapping});t.idBlock.tagClass=3,t.idBlock.tagNumber=1,e.push(t)}return new F.v({value:e})}toJSON(){const e={};return"requireExplicitPolicy"in this&&(e.requireExplicitPolicy=this.requireExplicitPolicy),"inhibitPolicyMapping"in this&&(e.inhibitPolicyMapping=this.inhibitPolicyMapping),e}}class Ae{constructor(e={}){this.keyPurposes=Object(q.f)(e,"keyPurposes",Ae.defaultValues("keyPurposes")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"keyPurposes":return[];default:throw new Error(`Invalid member name for ExtKeyUsage class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.keyPurposes||"",value:new F.p})]})}fromSchema(e){Object(q.d)(e,["keyPurposes"]);const t=F.D(e,e,Ae.schema({names:{keyPurposes:"keyPurposes"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for ExtKeyUsage");this.keyPurposes=Array.from(t.result.keyPurposes,(e=>e.valueBlock.toString()))}toSchema(){return new F.v({value:Array.from(this.keyPurposes,(e=>new F.p({value:e})))})}toJSON(){return{keyPurposes:Array.from(this.keyPurposes)}}}class Se{constructor(e={}){this.accessDescriptions=Object(q.f)(e,"accessDescriptions",Se.defaultValues("accessDescriptions")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"accessDescriptions":return[];default:throw new Error(`Invalid member name for InfoAccess class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.accessDescriptions||"",value:Z.schema()})]})}fromSchema(e){Object(q.d)(e,["accessDescriptions"]);const t=F.D(e,e,Se.schema({names:{accessDescriptions:"accessDescriptions"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for InfoAccess");this.accessDescriptions=Array.from(t.result.accessDescriptions,(e=>new Z({schema:e})))}toSchema(){return new F.v({value:Array.from(this.accessDescriptions,(e=>e.toSchema()))})}toJSON(){return{accessDescriptions:Array.from(this.accessDescriptions,(e=>e.toJSON()))}}}class Be{constructor(e={}){this.clear();for(const t of Object.keys(e))switch(t){case"length":this.length=e.length;break;case"stub":for(let t=0;t<this._view.length;t++)this._view[t]=e.stub;break;case"view":this.fromUint8Array(e.view);break;case"buffer":this.fromArrayBuffer(e.buffer);break;case"string":this.fromString(e.string);break;case"hexstring":this.fromHexString(e.hexstring)}}set buffer(e){this._buffer=e.slice(0),this._view=new Uint8Array(this._buffer)}get buffer(){return this._buffer}set view(e){this._buffer=new ArrayBuffer(e.length),this._view=new Uint8Array(this._buffer),this._view.set(e)}get view(){return this._view}get length(){return this._buffer.byteLength}set length(e){this._buffer=new ArrayBuffer(e),this._view=new Uint8Array(this._buffer)}clear(){this._buffer=new ArrayBuffer(0),this._view=new Uint8Array(this._buffer)}fromArrayBuffer(e){this.buffer=e}fromUint8Array(e){this._buffer=new ArrayBuffer(e.length),this._view=new Uint8Array(this._buffer),this._view.set(e)}fromString(e){const t=e.length;this.length=t;for(let r=0;r<t;r++)this.view[r]=e.charCodeAt(r)}toString(e=0,t=this.view.length-e){let r="";(e>=this.view.length||e<0)&&(e=0),(t>=this.view.length||t<0)&&(t=this.view.length-e);for(let n=e;n<e+t;n++)r+=String.fromCharCode(this.view[n]);return r}fromHexString(e){const t=e.length;this.buffer=new ArrayBuffer(t>>1),this.view=new Uint8Array(this.buffer);const r=new Map;r.set("0",0),r.set("1",1),r.set("2",2),r.set("3",3),r.set("4",4),r.set("5",5),r.set("6",6),r.set("7",7),r.set("8",8),r.set("9",9),r.set("A",10),r.set("a",10),r.set("B",11),r.set("b",11),r.set("C",12),r.set("c",12),r.set("D",13),r.set("d",13),r.set("E",14),r.set("e",14),r.set("F",15),r.set("f",15);let n=0,i=0;for(let s=0;s<t;s++)s%2?(i|=r.get(e.charAt(s)),this.view[n]=i,n++):i=r.get(e.charAt(s))<<4}toHexString(e=0,t=this.view.length-e){let r="";(e>=this.view.length||e<0)&&(e=0),(t>=this.view.length||t<0)&&(t=this.view.length-e);for(let n=e;n<e+t;n++){const e=this.view[n].toString(16).toUpperCase();r=r+(1==e.length?"0":"")+e}return r}copy(e=0,t=this._buffer.byteLength-e){if(0===e&&0===this._buffer.byteLength)return new Be;if(e<0||e>this._buffer.byteLength-1)throw new Error(`Wrong start position: ${e}`);const r=new Be;return r._buffer=this._buffer.slice(e,e+t),r._view=new Uint8Array(r._buffer),r}slice(e=0,t=this._buffer.byteLength){if(0===e&&0===this._buffer.byteLength)return new Be;if(e<0||e>this._buffer.byteLength-1)throw new Error(`Wrong start position: ${e}`);const r=new Be;return r._buffer=this._buffer.slice(e,t),r._view=new Uint8Array(r._buffer),r}realloc(e){const t=new ArrayBuffer(e),r=new Uint8Array(t);e>this._view.length?r.set(this._view):r.set(new Uint8Array(this._buffer,0,e)),this._buffer=t.slice(0),this._view=new Uint8Array(this._buffer)}append(e){const t=this._buffer.byteLength,r=e._buffer.byteLength,n=e._view.slice();this.realloc(t+r),this._view.set(n,t)}insert(e,t=0,r=this._buffer.byteLength-t){return!(t>this._buffer.byteLength-1)&&(r>this._buffer.byteLength-t&&(r=this._buffer.byteLength-t),r>e._buffer.byteLength&&(r=e._buffer.byteLength),r==e._buffer.byteLength?this._view.set(e._view,t):this._view.set(e._view.slice(0,r),t),!0)}isEqual(e){if(this._buffer.byteLength!=e._buffer.byteLength)return!1;for(let t=0;t<e._buffer.byteLength;t++)if(this.view[t]!=e.view[t])return!1;return!0}isEqualView(e){if(e.length!=this.view.length)return!1;for(let t=0;t<e.length;t++)if(this.view[t]!=e[t])return!1;return!0}findPattern(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));const i=e.buffer.byteLength;if(i>r)return-1;const s=[];for(let t=0;t<i;t++)s.push(e.view[t]);for(let e=0;e<=r-i;e++){let r=!0;const a=n?t-i-e:t+e;for(let e=0;e<i;e++)if(this.view[e+a]!=s[e]){r=!1;break}if(r)return n?t-i-e:t+i+e}return-1}findFirstIn(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));const i={id:-1,position:n?0:t+r,length:0};for(let s=0;s<e.length;s++){const a=this.findPattern(e[s],t,r,n);if(-1!=a){let t=!1;const r=e[s].length;n?a-r>=i.position-i.length&&(t=!0):a-r<=i.position-i.length&&(t=!0),t&&(i.position=a,i.id=s,i.length=r)}}return i}findAllIn(e,t=0,r=this.buffer.byteLength-t){const n=[];if(null==t&&(t=0),t>this.buffer.byteLength-1)return n;null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t);let i={id:-1,position:t};for(;;){const t=i.position;if(i=this.findFirstIn(e,i.position,r),-1==i.id)break;r-=i.position-t,n.push({id:i.id,position:i.position})}return n}findAllPatternIn(e,t=0,r=this.buffer.byteLength-t){null==t&&(t=0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t);const n=[],i=e.buffer.byteLength;if(i>r)return-1;const s=Array.from(e.view);for(let e=0;e<=r-i;e++){let r=!0;const a=t+e;for(let e=0;e<i;e++)if(this.view[e+a]!=s[e]){r=!1;break}r&&(n.push(t+i+e),e+=i-1)}return n}findFirstNotIn(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));const i={left:{id:-1,position:t},right:{id:-1,position:0},value:new Be};let s=r;for(;s>0;){if(i.right=this.findFirstIn(e,n?t-r+s:t+r-s,s,n),-1==i.right.id){r=s,n?t-=r:t=i.left.position,i.value=new Be,i.value._buffer=this._buffer.slice(t,t+r),i.value._view=new Uint8Array(i.value._buffer);break}if(i.right.position!=(n?i.left.position-e[i.right.id].buffer.byteLength:i.left.position+e[i.right.id].buffer.byteLength)){n?(t=i.right.position+e[i.right.id].buffer.byteLength,r=i.left.position-i.right.position-e[i.right.id].buffer.byteLength):(t=i.left.position,r=i.right.position-i.left.position-e[i.right.id].buffer.byteLength),i.value=new Be,i.value._buffer=this._buffer.slice(t,t+r),i.value._view=new Uint8Array(i.value._buffer);break}i.left=i.right,s-=e[i.right.id]._buffer.byteLength}if(n){const e=i.right;i.right=i.left,i.left=e}return i}findAllNotIn(e,t=null,r=null){const n=[];if(null==t&&(t=0),t>this.buffer.byteLength-1)return n;null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t);let i={left:{id:-1,position:t},right:{id:-1,position:t},value:new Be};do{const t=i.right.position;i=this.findFirstNotIn(e,i.right.position,r),r-=i.right.position-t,n.push({left:{id:i.left.id,position:i.left.position},right:{id:i.right.id,position:i.right.position},value:i.value})}while(-1!=i.right.id);return n}findFirstSequence(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));const i=this.skipNotPatterns(e,t,r,n);if(-1==i)return{position:-1,value:new Be};const s=this.skipPatterns(e,i,r-(n?t-i:i-t),n);n?(t=s,r=i-s):(t=i,r=s-i);const a=new Be;return a._buffer=this._buffer.slice(t,t+r),a._view=new Uint8Array(a._buffer),{position:s,value:a}}findAllSequences(e,t=null,r=null){const n=[];if(null==t&&(t=0),t>this.buffer.byteLength-1)return n;null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t);let i={position:t,value:new Be};do{const t=i.position;i=this.findFirstSequence(e,i.position,r),-1!=i.position&&(r-=i.position-t,n.push({position:i.position,value:i.value}))}while(-1!=i.position);return n}findPairedPatterns(e,t,r=null,n=null){const i=[];if(e.isEqual(t))return i;if(null==r&&(r=0),r>this.buffer.byteLength-1)return i;null==n&&(n=this.buffer.byteLength-r),n>this.buffer.byteLength-r&&(n=this.buffer.byteLength-r);let s=0;const a=this.findAllPatternIn(e,r,n);if(0==a.length)return i;const o=this.findAllPatternIn(t,r,n);if(0==o.length)return i;for(;s<a.length&&0!=o.length;)if(a[0]!=o[0]){if(a[s]>o[0])break;for(;a[s]<o[0]&&(s++,!(s>=a.length)););i.push({left:a[s-1],right:o[0]}),a.splice(s-1,1),o.splice(0,1),s=0}else i.push({left:a[0],right:o[0]}),a.splice(0,1),o.splice(0,1);return i.sort(((e,t)=>e.left-t.left)),i}findPairedArrays(e,t,r=null,n=null){const i=[];if(null==r&&(r=0),r>this.buffer.byteLength-1)return i;null==n&&(n=this.buffer.byteLength-r),n>this.buffer.byteLength-r&&(n=this.buffer.byteLength-r);let s=0;const a=this.findAllIn(e,r,n);if(0==a.length)return i;const o=this.findAllIn(t,r,n);if(0==o.length)return i;for(;s<a.length&&0!=o.length;)if(a[0].position!=o[0].position){if(a[s].position>o[0].position)break;for(;a[s].position<o[0].position&&(s++,!(s>=a.length)););i.push({left:a[s-1],right:o[0]}),a.splice(s-1,1),o.splice(0,1),s=0}else i.push({left:a[0],right:o[0]}),a.splice(0,1),o.splice(0,1);return i.sort(((e,t)=>e.left.position-t.left.position)),i}replacePattern(e,t,r=null,n=null,i=null){let s,a;const o={status:-1,searchPatternPositions:[],replacePatternPositions:[]};if(null==r&&(r=0),r>this.buffer.byteLength-1)return!1;if(null==n&&(n=this.buffer.byteLength-r),n>this.buffer.byteLength-r&&(n=this.buffer.byteLength-r),null==i){if(s=this.findAllIn([e],r,n),0==s.length)return o}else s=i;o.searchPatternPositions.push(...Array.from(s,(e=>e.position)));const u=e.buffer.byteLength-t.buffer.byteLength,c=new ArrayBuffer(this.view.length-s.length*u),l=new Uint8Array(c);for(l.set(new Uint8Array(this.buffer,0,r)),a=0;a<s.length;a++){const n=0==a?r:s[a-1].position;l.set(new Uint8Array(this.buffer,n,s[a].position-e.buffer.byteLength-n),n-a*u),l.set(t.view,s[a].position-e.buffer.byteLength-a*u),o.replacePatternPositions.push(s[a].position-e.buffer.byteLength-a*u)}return a--,l.set(new Uint8Array(this.buffer,s[a].position,this.buffer.byteLength-s[a].position),s[a].position-e.buffer.byteLength+t.buffer.byteLength-a*u),this.buffer=c,this.view=new Uint8Array(this.buffer),o.status=1,o}skipPatterns(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));let i=t;for(let s=0;s<e.length;s++){const a=e[s].buffer.byteLength,o=n?i-a:i;let u=!0;for(let t=0;t<a;t++)if(this.view[t+o]!=e[s].view[t]){u=!1;break}if(u)if(s=-1,n){if(i-=a,i<=0)return i}else if(i+=a,i>=t+r)return i}return i}skipNotPatterns(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));let i=-1;for(let s=0;s<r;s++){for(let r=0;r<e.length;r++){const a=e[r].buffer.byteLength,o=n?t-s-a:t+s;let u=!0;for(let t=0;t<a;t++)if(this.view[t+o]!=e[r].view[t]){u=!1;break}if(u){i=n?t-s:t+s;break}}if(-1!=i)break}return i}}class ke{constructor(e={}){this.stream=new Be,this._length=0,this.backward=!1,this._start=0,this.appendBlock=0,this.prevLength=0,this.prevStart=0;for(const t of Object.keys(e))switch(t){case"stream":this.stream=e.stream;break;case"backward":this.backward=e.backward,this._start=this.stream.buffer.byteLength;break;case"length":this._length=e.length;break;case"start":this._start=e.start;break;case"appendBlock":this.appendBlock=e.appendBlock;break;case"view":this.stream=new Be({view:e.view});break;case"buffer":this.stream=new Be({buffer:e.buffer});break;case"string":this.stream=new Be({string:e.string});break;case"hexstring":this.stream=new Be({hexstring:e.hexstring})}}set stream(e){this._stream=e,this.prevLength=this._length,this._length=e._buffer.byteLength,this.prevStart=this._start,this._start=0}get stream(){return this._stream}set length(e){this.prevLength=this._length,this._length=e}get length(){return this.appendBlock?this.start:this._length}set start(e){e>this.stream.buffer.byteLength||(this.prevStart=this._start,this.prevLength=this._length,this._length-=this.backward?this._start-e:e-this._start,this._start=e)}get start(){return this._start}get buffer(){return this._stream._buffer.slice(0,this._length)}resetPosition(){this._start=this.prevStart,this._length=this.prevLength}findPattern(e,t=null){(null==t||t>this.length)&&(t=this.length);const r=this.stream.findPattern(e,this.start,this.length,this.backward);if(-1==r)return r;if(this.backward){if(r<this.start-e.buffer.byteLength-t)return-1}else if(r>this.start+e.buffer.byteLength+t)return-1;return this.start=r,r}findFirstIn(e,t=null){(null==t||t>this.length)&&(t=this.length);const r=this.stream.findFirstIn(e,this.start,this.length,this.backward);if(-1==r.id)return r;if(this.backward){if(r.position<this.start-e[r.id].buffer.byteLength-t)return{id:-1,position:this.backward?0:this.start+this.length}}else if(r.position>this.start+e[r.id].buffer.byteLength+t)return{id:-1,position:this.backward?0:this.start+this.length};return this.start=r.position,r}findAllIn(e){const t=this.backward?this.start-this.length:this.start;return this.stream.findAllIn(e,t,this.length)}findFirstNotIn(e,t=null){(null==t||t>this._length)&&(t=this._length);const r=this._stream.findFirstNotIn(e,this._start,this._length,this.backward);if(-1==r.left.id&&-1==r.right.id)return r;if(this.backward){if(-1!=r.right.id&&r.right.position<this._start-e[r.right.id]._buffer.byteLength-t)return{left:{id:-1,position:this._start},right:{id:-1,position:0},value:new Be}}else if(-1!=r.left.id&&r.left.position>this._start+e[r.left.id]._buffer.byteLength+t)return{left:{id:-1,position:this._start},right:{id:-1,position:0},value:new Be};return this.backward?-1==r.left.id?this.start=0:this.start=r.left.position:-1==r.right.id?this.start=this._start+this._length:this.start=r.right.position,r}findAllNotIn(e){const t=this.backward?this._start-this._length:this._start;return this._stream.findAllNotIn(e,t,this._length)}findFirstSequence(e,t=null,r=null){(null==t||t>this._length)&&(t=this._length),(null==r||r>t)&&(r=t);const n=this._stream.findFirstSequence(e,this._start,t,this.backward);if(0==n.value.buffer.byteLength)return n;if(this.backward){if(n.position<this._start-n.value._buffer.byteLength-r)return{position:-1,value:new Be}}else if(n.position>this._start+n.value._buffer.byteLength+r)return{position:-1,value:new Be};return this.start=n.position,n}findAllSequences(e){const t=this.backward?this.start-this.length:this.start;return this.stream.findAllSequences(e,t,this.length)}findPairedPatterns(e,t,r=null){(null==r||r>this.length)&&(r=this.length);const n=this.backward?this.start-this.length:this.start,i=this.stream.findPairedPatterns(e,t,n,this.length);if(i.length)if(this.backward){if(i[0].right<this.start-t.buffer.byteLength-r)return[]}else if(i[0].left>this.start+e.buffer.byteLength+r)return[];return i}findPairedArrays(e,t,r=null){(null==r||r>this.length)&&(r=this.length);const n=this.backward?this.start-this.length:this.start,i=this.stream.findPairedArrays(e,t,n,this.length);if(i.length)if(this.backward){if(i[0].right.position<this.start-t[i[0].right.id].buffer.byteLength-r)return[]}else if(i[0].left.position>this.start+e[i[0].left.id].buffer.byteLength+r)return[];return i}replacePattern(e,t){const r=this.backward?this.start-this.length:this.start;return this.stream.replacePattern(e,t,r,this.length)}skipPatterns(e){const t=this.stream.skipPatterns(e,this.start,this.length,this.backward);return this.start=t,t}skipNotPatterns(e){const t=this.stream.skipNotPatterns(e,this.start,this.length,this.backward);return-1==t?-1:(this.start=t,t)}append(e){this._start+e._buffer.byteLength>this._stream._buffer.byteLength&&(e._buffer.byteLength>this.appendBlock&&(this.appendBlock=e._buffer.byteLength+1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock)),this._stream._view.set(e._view,this._start),this._length+=2*e._buffer.byteLength,this.start=this._start+e._buffer.byteLength,this.prevLength-=2*e._buffer.byteLength}appendView(e){this._start+e.length>this._stream._buffer.byteLength&&(e.length>this.appendBlock&&(this.appendBlock=e.length+1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock)),this._stream._view.set(e,this._start),this._length+=2*e.length,this.start=this._start+e.length,this.prevLength-=2*e.length}appendChar(e){this._start+1>this._stream._buffer.byteLength&&(1>this.appendBlock&&(this.appendBlock=1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock)),this._stream._view[this._start]=e,this._length+=2,this.start=this._start+1,this.prevLength-=2}appendUint16(e){this._start+2>this._stream._buffer.byteLength&&(2>this.appendBlock&&(this.appendBlock=1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock));const t=new Uint16Array([e]),r=new Uint8Array(t.buffer);this._stream._view[this._start]=r[1],this._stream._view[this._start+1]=r[0],this._length+=4,this.start=this._start+2,this.prevLength-=4}appendUint24(e){this._start+3>this._stream._buffer.byteLength&&(3>this.appendBlock&&(this.appendBlock=1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock));const t=new Uint32Array([e]),r=new Uint8Array(t.buffer);this._stream._view[this._start]=r[2],this._stream._view[this._start+1]=r[1],this._stream._view[this._start+2]=r[0],this._length+=6,this.start=this._start+3,this.prevLength-=6}appendUint32(e){this._start+4>this._stream._buffer.byteLength&&(4>this.appendBlock&&(this.appendBlock=1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock));const t=new Uint32Array([e]),r=new Uint8Array(t.buffer);this._stream._view[this._start]=r[3],this._stream._view[this._start+1]=r[2],this._stream._view[this._start+2]=r[1],this._stream._view[this._start+3]=r[0],this._length+=8,this.start=this._start+4,this.prevLength-=8}getBlock(e,t=!0){if(this._length<=0)return[];let r;if(this._length<e&&(e=this._length),this.backward){const t=this._stream._buffer.slice(this._length-e,this._length),n=new Uint8Array(t);r=new Array(e);for(let t=0;t<e;t++)r[e-1-t]=n[t]}else{const t=this._stream._buffer.slice(this._start,this._start+e);r=Array.from(new Uint8Array(t))}return t&&(this.start+=this.backward?-1*e:e),r}getUint16(e=!0){const t=this.getBlock(2,e);if(t.length<2)return 0;const r=new Uint16Array(1),n=new Uint8Array(r.buffer);return n[0]=t[1],n[1]=t[0],r[0]}getInt16(e=!0){const t=this.getBlock(2,e);if(t.length<2)return 0;const r=new Int16Array(1),n=new Uint8Array(r.buffer);return n[0]=t[1],n[1]=t[0],r[0]}getUint24(e=!0){const t=this.getBlock(3,e);if(t.length<3)return 0;const r=new Uint32Array(1),n=new Uint8Array(r.buffer);for(let e=3;e>=1;e--)n[3-e]=t[e-1];return r[0]}getUint32(e=!0){const t=this.getBlock(4,e);if(t.length<4)return 0;const r=new Uint32Array(1),n=new Uint8Array(r.buffer);for(let e=3;e>=0;e--)n[3-e]=t[e];return r[0]}getInt32(e=!0){const t=this.getBlock(4,e);if(t.length<4)return 0;const r=new Int32Array(1),n=new Uint8Array(r.buffer);for(let e=3;e>=0;e--)n[3-e]=t[e];return r[0]}}class Ee{constructor(e={}){this.version=Object(q.f)(e,"version",Ee.defaultValues("version")),this.logID=Object(q.f)(e,"logID",Ee.defaultValues("logID")),this.timestamp=Object(q.f)(e,"timestamp",Ee.defaultValues("timestamp")),this.extensions=Object(q.f)(e,"extensions",Ee.defaultValues("extensions")),this.hashAlgorithm=Object(q.f)(e,"hashAlgorithm",Ee.defaultValues("hashAlgorithm")),this.signatureAlgorithm=Object(q.f)(e,"signatureAlgorithm",Ee.defaultValues("signatureAlgorithm")),this.signature=Object(q.f)(e,"signature",Ee.defaultValues("signature")),"schema"in e&&this.fromSchema(e.schema),"stream"in e&&this.fromStream(e.stream)}static defaultValues(e){switch(e){case"version":return 0;case"logID":case"extensions":return new ArrayBuffer(0);case"timestamp":return new Date(0);case"hashAlgorithm":case"signatureAlgorithm":return"";case"signature":return new F.a;default:throw new Error(`Invalid member name for SignedCertificateTimestamp class: ${e}`)}}fromSchema(e){if(e instanceof F.t==!1)throw new Error("Object's schema was not verified against input data for SignedCertificateTimestamp");const t=new ke({stream:new Be({buffer:e.data})});this.fromStream(t)}fromStream(e){const t=e.getUint16();if(this.version=e.getBlock(1)[0],0===this.version){this.logID=new Uint8Array(e.getBlock(32)).buffer.slice(0),this.timestamp=new Date(Object(q.p)(new Uint8Array(e.getBlock(8)),8));const r=e.getUint16();switch(this.extensions=new Uint8Array(e.getBlock(r)).buffer.slice(0),e.getBlock(1)[0]){case 0:this.hashAlgorithm="none";break;case 1:this.hashAlgorithm="md5";break;case 2:this.hashAlgorithm="sha1";break;case 3:this.hashAlgorithm="sha224";break;case 4:this.hashAlgorithm="sha256";break;case 5:this.hashAlgorithm="sha384";break;case 6:this.hashAlgorithm="sha512";break;default:throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}switch(e.getBlock(1)[0]){case 0:this.signatureAlgorithm="anonymous";break;case 1:this.signatureAlgorithm="rsa";break;case 2:this.signatureAlgorithm="dsa";break;case 3:this.signatureAlgorithm="ecdsa";break;default:throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}const n=e.getUint16(),i=new Uint8Array(e.getBlock(n)).buffer.slice(0),s=F.E(i);if(-1===s.offset)throw new Error("Object's stream was not correct for SignedCertificateTimestamp");if(this.signature=s.result,t!==47+r+n)throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}}toSchema(){const e=this.toStream();return new F.t({data:e.stream.buffer})}toStream(){const e=new ke;e.appendUint16(47+this.extensions.byteLength+this.signature.valueBeforeDecode.byteLength),e.appendChar(this.version),e.appendView(new Uint8Array(this.logID));const t=new ArrayBuffer(8),r=new Uint8Array(t),n=Object(q.q)(this.timestamp.valueOf(),8);let i,s;switch(r.set(new Uint8Array(n),8-n.byteLength),e.appendView(r),e.appendUint16(this.extensions.byteLength),this.extensions.byteLength&&e.appendView(new Uint8Array(this.extensions)),this.hashAlgorithm.toLowerCase()){case"none":i=0;break;case"md5":i=1;break;case"sha1":i=2;break;case"sha224":i=3;break;case"sha256":i=4;break;case"sha384":i=5;break;case"sha512":i=6;break;default:throw new Error(`Incorrect data for hashAlgorithm: ${this.hashAlgorithm}`)}switch(e.appendChar(i),this.signatureAlgorithm.toLowerCase()){case"anonymous":s=0;break;case"rsa":s=1;break;case"dsa":s=2;break;case"ecdsa":s=3;break;default:throw new Error(`Incorrect data for signatureAlgorithm: ${this.signatureAlgorithm}`)}e.appendChar(s);const a=this.signature.toBER(!1);return e.appendUint16(a.byteLength),e.appendView(new Uint8Array(a)),e}toJSON(){return{version:this.version,logID:Object(q.b)(this.logID),timestamp:this.timestamp,extensions:Object(q.b)(this.extensions),hashAlgorithm:this.hashAlgorithm,signatureAlgorithm:this.signatureAlgorithm,signature:this.signature.toJSON()}}async verify(e,t,r=0){let n,i=Object(q.k)(Object(q.a)(this.logID)),s=null,a=new ke;for(const t of e)if(t.log_id===i){s=t.key;break}if(null===s)throw new Error(`Public key not found for CT with logId: ${i}`);const o=F.E(Object(q.j)(Object(q.e)(s)));if(-1===o.offset)throw new Error(`Incorrect key value for CT Log with logId: ${i}`);n=new se.a({schema:o.result}),a.appendChar(0),a.appendChar(0);const u=new ArrayBuffer(8),c=new Uint8Array(u),l=Object(q.q)(this.timestamp.valueOf(),8);return c.set(new Uint8Array(l),8-l.byteLength),a.appendView(c),a.appendUint16(r),0===r&&a.appendUint24(t.byteLength),a.appendView(new Uint8Array(t)),a.appendUint16(this.extensions.byteLength),0!==this.extensions.byteLength&&a.appendView(new Uint8Array(this.extensions)),Object(z.e)().subtle.verifyWithPublicKey(a._stream._buffer.slice(0,a._length),{valueBlock:{valueHex:this.signature.toBER(!1)}},n,{algorithmId:""},"SHA-256")}}class Oe{constructor(e={}){this.timestamps=Object(q.f)(e,"timestamps",Oe.defaultValues("timestamps")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"timestamps":return[];default:throw new Error(`Invalid member name for SignedCertificateTimestampList class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"timestamps":return 0===t.length;default:throw new Error(`Invalid member name for SignedCertificateTimestampList class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return"optional"in t==!1&&(t.optional=!1),new F.q({name:t.blockName||"SignedCertificateTimestampList",optional:t.optional})}fromSchema(e){if(e instanceof F.q==!1)throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList");const t=new ke({stream:new Be({buffer:e.valueBlock.valueHex})});if(t.getUint16()!==t.length)throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList");for(;t.length;)this.timestamps.push(new Ee({stream:t}))}toSchema(){const e=new ke;let t=0;const r=[];for(const e of this.timestamps){const n=e.toStream();r.push(n),t+=n.stream.buffer.byteLength}e.appendUint16(t);for(const t of r)e.appendView(t.stream.view);return new F.q({valueHex:e.stream.buffer.slice(0)})}toJSON(){return{timestamps:Array.from(this.timestamps,(e=>e.toJSON()))}}}class Ne{constructor(e={}){this.templateID=Object(q.f)(e,"templateID",Ne.defaultValues("templateID")),"templateMajorVersion"in e&&(this.templateMajorVersion=Object(q.f)(e,"templateMajorVersion",Ne.defaultValues("templateMajorVersion"))),"templateMinorVersion"in e&&(this.templateMinorVersion=Object(q.f)(e,"templateMinorVersion",Ne.defaultValues("templateMinorVersion"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"templateID":return"";case"templateMajorVersion":case"templateMinorVersion":return 0;default:throw new Error(`Invalid member name for CertificateTemplate class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.p({name:t.templateID||""}),new F.m({name:t.templateMajorVersion||"",optional:!0}),new F.m({name:t.templateMinorVersion||"",optional:!0})]})}fromSchema(e){Object(q.d)(e,["templateID","templateMajorVersion","templateMinorVersion"]);let t=F.D(e,e,Ne.schema({names:{templateID:"templateID",templateMajorVersion:"templateMajorVersion",templateMinorVersion:"templateMinorVersion"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CertificateTemplate");this.templateID=t.result.templateID.valueBlock.toString(),"templateMajorVersion"in t.result&&(this.templateMajorVersion=t.result.templateMajorVersion.valueBlock.valueDec),"templateMinorVersion"in t.result&&(this.templateMinorVersion=t.result.templateMinorVersion.valueBlock.valueDec)}toSchema(){const e=[];return e.push(new F.p({value:this.templateID})),"templateMajorVersion"in this&&e.push(new F.m({value:this.templateMajorVersion})),"templateMinorVersion"in this&&e.push(new F.m({value:this.templateMinorVersion})),new F.v({value:e})}toJSON(){const e={extnID:this.templateID};return"templateMajorVersion"in this&&(e.templateMajorVersion=this.templateMajorVersion),"templateMinorVersion"in this&&(e.templateMinorVersion=this.templateMinorVersion),e}}class xe{constructor(e={}){this.certificateIndex=Object(q.f)(e,"certificateIndex",xe.defaultValues("certificateIndex")),this.keyIndex=Object(q.f)(e,"keyIndex",xe.defaultValues("keyIndex")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"certificateIndex":case"keyIndex":return 0;default:throw new Error(`Invalid member name for CAVersion class: ${e}`)}}static schema(e={}){return new F.m}fromSchema(e){if(e.constructor.blockName()!==F.m.blockName())throw new Error("Object's schema was not verified against input data for CAVersion");let t=e.valueBlock.valueHex.slice(0);const r=new Uint8Array(t);switch(!0){case t.byteLength<4:{const e=new ArrayBuffer(4);new Uint8Array(e).set(r,4-t.byteLength),t=e.slice(0)}break;case t.byteLength>4:{const e=new ArrayBuffer(4);new Uint8Array(e).set(r.slice(0,4)),t=e.slice(0)}}const n=t.slice(0,2),i=new Uint8Array(n);let s=i[0];i[0]=i[1],i[1]=s;const a=new Uint16Array(n);this.keyIndex=a[0];const o=t.slice(2),u=new Uint8Array(o);s=u[0],u[0]=u[1],u[1]=s;const c=new Uint16Array(o);this.certificateIndex=c[0]}toSchema(){const e=new ArrayBuffer(2);new Uint16Array(e)[0]=this.certificateIndex;const t=new Uint8Array(e);let r=t[0];t[0]=t[1],t[1]=r;const n=new ArrayBuffer(2);new Uint16Array(n)[0]=this.keyIndex;const i=new Uint8Array(n);return r=i[0],i[0]=i[1],i[1]=r,new F.m({valueHex:Object(q.l)(n,e)})}toJSON(){return{certificateIndex:this.certificateIndex,keyIndex:this.keyIndex}}}class Ie{constructor(e={}){this.id=Object(q.f)(e,"id",Ie.defaultValues("id")),"type"in e&&(this.type=Object(q.f)(e,"type",Ie.defaultValues("type"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"id":return"";case"type":return new F.n;default:throw new Error(`Invalid member name for QCStatement class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"id":return""===t;case"type":return t instanceof F.n;default:throw new Error(`Invalid member name for QCStatement class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.p({name:t.id||""}),new F.a({name:t.type||"",optional:!0})]})}fromSchema(e){Object(q.d)(e,["id","type"]);const t=F.D(e,e,Ie.schema({names:{id:"id",type:"type"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for QCStatement");this.id=t.result.id.valueBlock.toString(),"type"in t.result&&(this.type=t.result.type)}toSchema(){const e=[new F.p({value:this.id})];return"type"in this&&e.push(this.type),new F.v({value:e})}toJSON(){const e={id:this.id};return"type"in this&&(e.type=this.type.toJSON()),e}}class Ce{constructor(e={}){this.values=Object(q.f)(e,"values",Ce.defaultValues("values")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"values":return[];default:throw new Error(`Invalid member name for QCStatements class: ${e}`)}}static compareWithDefault(e,t){switch(e){case"values":return 0===t.length;default:throw new Error(`Invalid member name for QCStatements class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.u({name:t.values||"",value:Ie.schema(t.value||{})})]})}fromSchema(e){Object(q.d)(e,["values"]);const t=F.D(e,e,Ce.schema({names:{values:"values"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for QCStatements");this.values=Array.from(t.result.values,(e=>new Ie({schema:e})))}toSchema(){return new F.v({value:Array.from(this.values,(e=>e.toSchema()))})}toJSON(){return{extensions:Array.from(this.values,(e=>e.toJSON()))}}}class je{constructor(e={}){this.extnID=Object(q.f)(e,"extnID",je.defaultValues("extnID")),this.critical=Object(q.f)(e,"critical",je.defaultValues("critical")),this.extnValue="extnValue"in e?new F.q({valueHex:e.extnValue}):je.defaultValues("extnValue"),"parsedValue"in e&&(this.parsedValue=Object(q.f)(e,"parsedValue",je.defaultValues("parsedValue"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"extnID":return"";case"critical":return!1;case"extnValue":return new F.q;case"parsedValue":return{};default:throw new Error(`Invalid member name for Extension class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[new F.p({name:t.extnID||""}),new F.d({name:t.critical||"",optional:!0}),new F.q({name:t.extnValue||""})]})}fromSchema(e){Object(q.d)(e,["extnID","critical","extnValue"]);let t=F.D(e,e,je.schema({names:{extnID:"extnID",critical:"critical",extnValue:"extnValue"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Extension");if(this.extnID=t.result.extnID.valueBlock.toString(),"critical"in t.result&&(this.critical=t.result.critical.valueBlock.value),this.extnValue=t.result.extnValue,t=F.E(this.extnValue.valueBlock.valueHex),-1!==t.offset)switch(this.extnID){case"2.5.29.9":try{this.parsedValue=new ae({schema:t.result})}catch(e){this.parsedValue=new ae,this.parsedValue.parsingError="Incorrectly formated SubjectDirectoryAttributes"}break;case"2.5.29.14":case"2.5.29.15":this.parsedValue=t.result;break;case"2.5.29.16":try{this.parsedValue=new oe({schema:t.result})}catch(e){this.parsedValue=new oe,this.parsedValue.parsingError="Incorrectly formated PrivateKeyUsagePeriod"}break;case"2.5.29.17":case"2.5.29.18":try{this.parsedValue=new te({schema:t.result})}catch(e){this.parsedValue=new te,this.parsedValue.parsingError="Incorrectly formated AltName"}break;case"2.5.29.19":try{this.parsedValue=new ue({schema:t.result})}catch(e){this.parsedValue=new ue,this.parsedValue.parsingError="Incorrectly formated BasicConstraints"}break;case"2.5.29.20":case"2.5.29.27":case"2.5.29.21":case"2.5.29.24":this.parsedValue=t.result;break;case"2.5.29.28":try{this.parsedValue=new ce({schema:t.result})}catch(e){this.parsedValue=new ce,this.parsedValue.parsingError="Incorrectly formated IssuingDistributionPoint"}break;case"2.5.29.29":try{this.parsedValue=new le({schema:t.result})}catch(e){this.parsedValue=new le,this.parsedValue.parsingError="Incorrectly formated GeneralNames"}break;case"2.5.29.30":try{this.parsedValue=new fe({schema:t.result})}catch(e){this.parsedValue=new fe,this.parsedValue.parsingError="Incorrectly formated NameConstraints"}break;case"2.5.29.31":case"2.5.29.46":try{this.parsedValue=new me({schema:t.result})}catch(e){this.parsedValue=new me,this.parsedValue.parsingError="Incorrectly formated CRLDistributionPoints"}break;case"2.5.29.32":case"1.3.6.1.4.1.311.21.10":try{this.parsedValue=new ge({schema:t.result})}catch(e){this.parsedValue=new ge,this.parsedValue.parsingError="Incorrectly formated CertificatePolicies"}break;case"2.5.29.33":try{this.parsedValue=new ve({schema:t.result})}catch(e){this.parsedValue=new ve,this.parsedValue.parsingError="Incorrectly formated CertificatePolicies"}break;case"2.5.29.35":try{this.parsedValue=new we({schema:t.result})}catch(e){this.parsedValue=new we,this.parsedValue.parsingError="Incorrectly formated AuthorityKeyIdentifier"}break;case"2.5.29.36":try{this.parsedValue=new _e({schema:t.result})}catch(e){this.parsedValue=new _e,this.parsedValue.parsingError="Incorrectly formated PolicyConstraints"}break;case"2.5.29.37":try{this.parsedValue=new Ae({schema:t.result})}catch(e){this.parsedValue=new Ae,this.parsedValue.parsingError="Incorrectly formated ExtKeyUsage"}break;case"2.5.29.54":this.parsedValue=t.result;break;case"1.3.6.1.5.5.7.1.1":case"1.3.6.1.5.5.7.1.11":try{this.parsedValue=new Se({schema:t.result})}catch(e){this.parsedValue=new Se,this.parsedValue.parsingError="Incorrectly formated InfoAccess"}break;case"1.3.6.1.4.1.11129.2.4.2":try{this.parsedValue=new Oe({schema:t.result})}catch(e){this.parsedValue=new Oe,this.parsedValue.parsingError="Incorrectly formated SignedCertificateTimestampList"}break;case"1.3.6.1.4.1.311.20.2":case"1.3.6.1.4.1.311.21.2":this.parsedValue=t.result;break;case"1.3.6.1.4.1.311.21.7":try{this.parsedValue=new Ne({schema:t.result})}catch(e){this.parsedValue=new Ne,this.parsedValue.parsingError="Incorrectly formated CertificateTemplate"}break;case"1.3.6.1.4.1.311.21.1":try{this.parsedValue=new xe({schema:t.result})}catch(e){this.parsedValue=new xe,this.parsedValue.parsingError="Incorrectly formated CAVersion"}break;case"1.3.6.1.5.5.7.1.3":try{this.parsedValue=new Ce({schema:t.result})}catch(e){this.parsedValue=new Ce,this.parsedValue.parsingError="Incorrectly formated QCStatements"}}}toSchema(){const e=[];return e.push(new F.p({value:this.extnID})),this.critical!==je.defaultValues("critical")&&e.push(new F.d({value:this.critical})),e.push(this.extnValue),new F.v({value:e})}toJSON(){const e={extnID:this.extnID,extnValue:this.extnValue.toJSON()};return this.critical!==je.defaultValues("critical")&&(e.critical=this.critical),"parsedValue"in this&&"toJSON"in this.parsedValue&&(e.parsedValue=this.parsedValue.toJSON()),e}}class Te{constructor(e={}){this.extensions=Object(q.f)(e,"extensions",Te.defaultValues("extensions")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"extensions":return[];default:throw new Error(`Invalid member name for Extensions class: ${e}`)}}static schema(e={},t=!1){const r=Object(q.f)(e,"names",{});return new F.v({optional:t,name:r.blockName||"",value:[new F.u({name:r.extensions||"",value:je.schema(r.extension||{})})]})}fromSchema(e){Object(q.d)(e,["extensions"]);const t=F.D(e,e,Te.schema({names:{extensions:"extensions"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Extensions");this.extensions=Array.from(t.result.extensions,(e=>new je({schema:e})))}toSchema(){return new F.v({value:Array.from(this.extensions,(e=>e.toSchema()))})}toJSON(){return{extensions:Array.from(this.extensions,(e=>e.toJSON()))}}}function Pe(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"tbsCertificate",value:[new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new F.m({name:t.tbsCertificateVersion||"tbsCertificate.version"})]}),new F.m({name:t.tbsCertificateSerialNumber||"tbsCertificate.serialNumber"}),ee.a.schema(t.signature||{names:{blockName:"tbsCertificate.signature"}}),Y.schema(t.issuer||{names:{blockName:"tbsCertificate.issuer"}}),new F.v({name:t.tbsCertificateValidity||"tbsCertificate.validity",value:[ie.schema(t.notBefore||{names:{utcTimeName:"tbsCertificate.notBefore",generalTimeName:"tbsCertificate.notBefore"}}),ie.schema(t.notAfter||{names:{utcTimeName:"tbsCertificate.notAfter",generalTimeName:"tbsCertificate.notAfter"}})]}),Y.schema(t.subject||{names:{blockName:"tbsCertificate.subject"}}),se.a.schema(t.subjectPublicKeyInfo||{names:{blockName:"tbsCertificate.subjectPublicKeyInfo"}}),new F.r({name:t.tbsCertificateIssuerUniqueID||"tbsCertificate.issuerUniqueID",optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new F.r({name:t.tbsCertificateSubjectUniqueID||"tbsCertificate.subjectUniqueID",optional:!0,idBlock:{tagClass:3,tagNumber:2}}),new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:3},value:[Te.schema(t.extensions||{names:{blockName:"tbsCertificate.extensions"}})]})]})}class De{constructor(e={}){this.tbs=Object(q.f)(e,"tbs",De.defaultValues("tbs")),this.version=Object(q.f)(e,"version",De.defaultValues("version")),this.serialNumber=Object(q.f)(e,"serialNumber",De.defaultValues("serialNumber")),this.signature=Object(q.f)(e,"signature",De.defaultValues("signature")),this.issuer=Object(q.f)(e,"issuer",De.defaultValues("issuer")),this.notBefore=Object(q.f)(e,"notBefore",De.defaultValues("notBefore")),this.notAfter=Object(q.f)(e,"notAfter",De.defaultValues("notAfter")),this.subject=Object(q.f)(e,"subject",De.defaultValues("subject")),this.subjectPublicKeyInfo=Object(q.f)(e,"subjectPublicKeyInfo",De.defaultValues("subjectPublicKeyInfo")),"issuerUniqueID"in e&&(this.issuerUniqueID=Object(q.f)(e,"issuerUniqueID",De.defaultValues("issuerUniqueID"))),"subjectUniqueID"in e&&(this.subjectUniqueID=Object(q.f)(e,"subjectUniqueID",De.defaultValues("subjectUniqueID"))),"extensions"in e&&(this.extensions=Object(q.f)(e,"extensions",De.defaultValues("extensions"))),this.signatureAlgorithm=Object(q.f)(e,"signatureAlgorithm",De.defaultValues("signatureAlgorithm")),this.signatureValue=Object(q.f)(e,"signatureValue",De.defaultValues("signatureValue")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"tbs":return new ArrayBuffer(0);case"version":return 0;case"serialNumber":return new F.m;case"signature":return new ee.a;case"issuer":return new Y;case"notBefore":case"notAfter":return new ie;case"subject":return new Y;case"subjectPublicKeyInfo":return new se.a;case"issuerUniqueID":case"subjectUniqueID":return new ArrayBuffer(0);case"extensions":return[];case"signatureAlgorithm":return new ee.a;case"signatureValue":return new F.b;default:throw new Error(`Invalid member name for Certificate class: ${e}`)}}static schema(e={}){const t=Object(q.f)(e,"names",{});return new F.v({name:t.blockName||"",value:[Pe(t.tbsCertificate),ee.a.schema(t.signatureAlgorithm||{names:{blockName:"signatureAlgorithm"}}),new F.b({name:t.signatureValue||"signatureValue"})]})}fromSchema(e){Object(q.d)(e,["tbsCertificate","tbsCertificate.extensions","tbsCertificate.version","tbsCertificate.serialNumber","tbsCertificate.signature","tbsCertificate.issuer","tbsCertificate.notBefore","tbsCertificate.notAfter","tbsCertificate.subject","tbsCertificate.subjectPublicKeyInfo","tbsCertificate.issuerUniqueID","tbsCertificate.subjectUniqueID","signatureAlgorithm","signatureValue"]);const t=F.D(e,e,De.schema({names:{tbsCertificate:{names:{extensions:{names:{extensions:"tbsCertificate.extensions"}}}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Certificate");this.tbs=t.result.tbsCertificate.valueBeforeDecode,"tbsCertificate.version"in t.result&&(this.version=t.result["tbsCertificate.version"].valueBlock.valueDec),this.serialNumber=t.result["tbsCertificate.serialNumber"],this.signature=new ee.a({schema:t.result["tbsCertificate.signature"]}),this.issuer=new Y({schema:t.result["tbsCertificate.issuer"]}),this.notBefore=new ie({schema:t.result["tbsCertificate.notBefore"]}),this.notAfter=new ie({schema:t.result["tbsCertificate.notAfter"]}),this.subject=new Y({schema:t.result["tbsCertificate.subject"]}),this.subjectPublicKeyInfo=new se.a({schema:t.result["tbsCertificate.subjectPublicKeyInfo"]}),"tbsCertificate.issuerUniqueID"in t.result&&(this.issuerUniqueID=t.result["tbsCertificate.issuerUniqueID"].valueBlock.valueHex),"tbsCertificate.subjectUniqueID"in t.result&&(this.subjectUniqueID=t.result["tbsCertificate.subjectUniqueID"].valueBlock.valueHex),"tbsCertificate.extensions"in t.result&&(this.extensions=Array.from(t.result["tbsCertificate.extensions"],(e=>new je({schema:e})))),this.signatureAlgorithm=new ee.a({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){const e=[];return"version"in this&&this.version!==De.defaultValues("version")&&e.push(new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new F.m({value:this.version})]})),e.push(this.serialNumber),e.push(this.signature.toSchema()),e.push(this.issuer.toSchema()),e.push(new F.v({value:[this.notBefore.toSchema(),this.notAfter.toSchema()]})),e.push(this.subject.toSchema()),e.push(this.subjectPublicKeyInfo.toSchema()),"issuerUniqueID"in this&&e.push(new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:1},valueHex:this.issuerUniqueID})),"subjectUniqueID"in this&&e.push(new F.r({optional:!0,idBlock:{tagClass:3,tagNumber:2},valueHex:this.subjectUniqueID})),"extensions"in this&&e.push(new F.g({optional:!0,idBlock:{tagClass:3,tagNumber:3},value:[new F.v({value:Array.from(this.extensions,(e=>e.toSchema()))})]})),new F.v({value:e})}toSchema(e=!1){let t={};if(!1===e){if(0===this.tbs.length)return De.schema().value[0];t=F.E(this.tbs).result}else t=this.encodeTBS();return new F.v({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){const e={tbs:Object(q.b)(this.tbs,0,this.tbs.byteLength),serialNumber:this.serialNumber.toJSON(),signature:this.signature.toJSON(),issuer:this.issuer.toJSON(),notBefore:this.notBefore.toJSON(),notAfter:this.notAfter.toJSON(),subject:this.subject.toJSON(),subjectPublicKeyInfo:this.subjectPublicKeyInfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return"version"in this&&this.version!==De.defaultValues("version")&&(e.version=this.version),"issuerUniqueID"in this&&(e.issuerUniqueID=Object(q.b)(this.issuerUniqueID,0,this.issuerUniqueID.byteLength)),"subjectUniqueID"in this&&(e.subjectUniqueID=Object(q.b)(this.subjectUniqueID,0,this.subjectUniqueID.byteLength)),"extensions"in this&&(e.extensions=Array.from(this.extensions,(e=>e.toJSON()))),e}getPublicKey(e=null){return Object(z.e)().subtle.getPublicKey(this.subjectPublicKeyInfo,this.signatureAlgorithm,e)}getKeyHash(e="SHA-1"){const t=Object(z.d)();return void 0===t?Promise.reject("Unable to create WebCrypto object"):t.digest({name:e},new Uint8Array(this.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHex))}sign(e,t="SHA-1"){if(void 0===e)return Promise.reject("Need to provide a private key for signing");let r,n=Promise.resolve();const i=Object(z.e)();return n=n.then((()=>i.subtle.getSignatureParameters(e,t))),n=n.then((e=>{r=e.parameters,this.signature=e.signatureAlgorithm,this.signatureAlgorithm=e.signatureAlgorithm})),n=n.then((()=>{this.tbs=this.encodeTBS().toBER(!1)})),n=n.then((()=>i.subtle.signWithPrivateKey(this.tbs,e,r))),n=n.then((e=>{this.signatureValue=new F.b({valueHex:e})})),n}verify(e=null){let t={};return null!==e?t=e.subjectPublicKeyInfo:this.issuer.isEqual(this.subject)&&(t=this.subjectPublicKeyInfo),t instanceof se.a==!1?Promise.reject("Please provide issuer certificate as a parameter"):Object(z.e)().subtle.verifyWithPublicKey(this.tbs,this.signatureValue,t,this.signatureAlgorithm)}}r(13);class Ue{constructor(e={}){this.trustedCerts=Object(q.f)(e,"trustedCerts",this.defaultValues("trustedCerts")),this.certs=Object(q.f)(e,"certs",this.defaultValues("certs")),this.crls=Object(q.f)(e,"crls",this.defaultValues("crls")),this.ocsps=Object(q.f)(e,"ocsps",this.defaultValues("ocsps")),this.checkDate=Object(q.f)(e,"checkDate",this.defaultValues("checkDate")),this.findOrigin=Object(q.f)(e,"findOrigin",this.defaultValues("findOrigin")),this.findIssuer=Object(q.f)(e,"findIssuer",this.defaultValues("findIssuer"))}static defaultFindOrigin(e,t){0===e.tbs.byteLength&&(e.tbs=e.encodeTBS());for(const r of t.certs)if(0===r.tbs.byteLength&&(r.tbs=r.encodeTBS()),Object(q.g)(e.tbs,r.tbs))return"Intermediate Certificates";for(const r of t.trustedCerts)if(0===r.tbs.byteLength&&(r.tbs=r.encodeTBS()),Object(q.g)(e.tbs,r.tbs))return"Trusted Certificates";return"Unknown"}async defaultFindIssuer(e,t){let r=[],n=null,i=null,s=null;if(e.subject.isEqual(e.issuer))try{if(!0===await e.verify())return[e]}catch(e){}if("extensions"in e)for(const t of e.extensions)if("2.5.29.35"===t.extnID){"keyIdentifier"in t.parsedValue?n=t.parsedValue.keyIdentifier:("authorityCertIssuer"in t.parsedValue&&(i=t.parsedValue.authorityCertIssuer),"authorityCertSerialNumber"in t.parsedValue&&(s=t.parsedValue.authorityCertSerialNumber));break}function a(t){if(null!==n&&"extensions"in t){let e=!1;for(const i of t.extensions)if("2.5.29.14"===i.extnID){e=!0,Object(q.g)(i.parsedValue.valueBlock.valueHex,n.valueBlock.valueHex)&&r.push(t);break}if(e)return}let a=!1;null!==s&&(a=t.serialNumber.isEqual(s)),null!==i?t.subject.isEqual(i)&&a&&r.push(t):e.issuer.isEqual(t.subject)&&r.push(t)}for(const e of t.trustedCerts)a(e);for(const e of t.certs)a(e);for(let t=0;t<r.length;t++)try{!1===await e.verify(r[t])&&r.splice(t,1)}catch(e){r.splice(t,1)}return r}defaultValues(e){switch(e){case"trustedCerts":case"certs":case"crls":case"ocsps":return[];case"checkDate":return new Date;case"findOrigin":return Ue.defaultFindOrigin;case"findIssuer":return this.defaultFindIssuer;default:throw new Error(`Invalid member name for CertificateChainValidationEngine class: ${e}`)}}async sort(e=!1){const t=[],r=this;async function n(e){const n=[],i=[],s=[];if(n.push(...t.filter((t=>e.issuer.isEqual(t.subject)))),0===n.length)return{status:1,statusMessage:"No certificate's issuers"};if(i.push(...r.crls.filter((t=>t.issuer.isEqual(e.issuer)))),0===i.length)return{status:2,statusMessage:"No CRLs for specific certificate issuer"};for(let e=0;e<i.length;e++)if(!(i[e].nextUpdate.value<r.checkDate))for(let t=0;t<n.length;t++)try{if(await i[e].verify({issuerCertificate:n[t]})){s.push({crl:i[e],certificate:n[t]});break}}catch(e){}return s.length?{status:0,statusMessage:"",result:s}:{status:3,statusMessage:"No valid CRLs found"}}async function i(e,t){const n=Object(z.c)(e.signatureAlgorithm.algorithmId);if("name"in n==!1)return 1;if("hash"in n==!1)return 1;for(let n=0;n<r.ocsps.length;n++){const i=await r.ocsps[n].getCertificateStatus(e,t);if(i.isForCertificate)return 0===i.status?0:1}return 2}async function s(e,t=!1){let r=!1,n=!1,i=!1,s=!1;if("extensions"in e){for(let t=0;t<e.extensions.length;t++){if(!0===e.extensions[t].critical&&"parsedValue"in e.extensions[t]==!1)return{result:!1,resultCode:6,resultMessage:`Unable to parse critical certificate extension: ${e.extensions[t].extnID}`};if("2.5.29.15"===e.extensions[t].extnID){i=!0;const r=new Uint8Array(e.extensions[t].parsedValue.valueBlock.valueHex);4==(4&r[0])&&(n=!0),2==(2&r[0])&&(s=!0)}"2.5.29.19"===e.extensions[t].extnID&&"cA"in e.extensions[t].parsedValue&&!0===e.extensions[t].parsedValue.cA&&(r=!0)}if(!0===n&&!1===r)return{result:!1,resultCode:3,resultMessage:'Unable to build certificate chain - using "keyCertSign" flag set without BasicConstaints'};if(!0===i&&!0===r&&!1===n)return{result:!1,resultCode:4,resultMessage:'Unable to build certificate chain - "keyCertSign" flag was not set'};if(!0===r&&!0===i&&t&&!1===s)return{result:!1,resultCode:5,resultMessage:'Unable to build certificate chain - intermediate certificate must have "cRLSign" key usage flag'}}return!1===r?{result:!1,resultCode:7,resultMessage:"Unable to build certificate chain - more than one possible end-user certificate"}:{result:!0,resultCode:0,resultMessage:""}}t.push(...r.trustedCerts),t.push(...r.certs);for(let e=0;e<t.length;e++)for(let r=0;r<t.length;r++)if(e!==r&&Object(q.g)(t[e].tbs,t[r].tbs)){t.splice(r,1),e=0;break}let a;const o=[t[t.length-1]];if(a=await async function e(t){const n=[];function i(e){let t=!0;for(let r=0;r<e.length;r++){for(let n=0;n<e.length;n++)if(n!==r&&e[r]===e[n]){t=!1;break}if(!t)break}return t}const s=await r.findIssuer(t,r);if(0===s.length)throw new Error("No valid certificate paths found");for(let r=0;r<s.length;r++){if(Object(q.g)(s[r].tbs,t.tbs)){n.push([s[r]]);continue}const a=await e(s[r]);for(let e=0;e<a.length;e++){const t=a[e].slice();t.splice(0,0,s[r]),i(t)?n.push(t):n.push(a[e])}}return n}(t[t.length-1]),0===a.length)return{result:!1,resultCode:60,resultMessage:"Unable to find certificate path"};for(let e=0;e<a.length;e++){let t=!1;for(let n=0;n<a[e].length;n++){const i=a[e][n];for(let e=0;e<r.trustedCerts.length;e++)if(Object(q.g)(i.tbs,r.trustedCerts[e].tbs)){t=!0;break}if(t)break}t||(a.splice(e,1),e=0)}if(0===a.length)throw{result:!1,resultCode:97,resultMessage:"No valid certificate paths found"};let u=a[0].length,c=0;for(let e=0;e<a.length;e++)a[e].length<u&&(u=a[e].length,c=e);for(let e=0;e<a[c].length;e++)o.push(a[c][e]);if(a=await async function(t,a){for(let e=0;e<t.length;e++)if(t[e].notBefore.value>a||t[e].notAfter.value<a)return{result:!1,resultCode:8,resultMessage:"The certificate is either not yet valid or expired"};if(t.length<2)return{result:!1,resultCode:9,resultMessage:"Too short certificate path"};for(let e=t.length-2;e>=0;e--)if(!1===t[e].issuer.isEqual(t[e].subject)&&!1===t[e].issuer.isEqual(t[e+1].subject))return{result:!1,resultCode:10,resultMessage:"Incorrect name chaining"};if(0!==r.crls.length||0!==r.ocsps.length)for(let a=0;a<t.length-1;a++){let o=2,u={status:0,statusMessage:""};if(0!==r.ocsps.length)switch(o=await i(t[a],t[a+1]),o){case 0:continue;case 1:return{result:!1,resultCode:12,resultMessage:"One of certificates was revoked via OCSP response"}}if(0!==r.crls.length){if(u=await n(t[a]),0===u.status)for(let e=0;e<u.result.length;e++){if(u.result[e].crl.isCertificateRevoked(t[a]))return{result:!1,resultCode:12,resultMessage:"One of certificates had been revoked"};if(!1===(await s(u.result[e].certificate,!0)).result)return{result:!1,resultCode:13,resultMessage:"CRL issuer certificate is not a CA certificate or does not have crlSign flag"}}else if(!1===e)throw{result:!1,resultCode:11,resultMessage:`No revocation values found for one of certificates: ${u.statusMessage}`}}else if(2===o)return{result:!1,resultCode:11,resultMessage:"No revocation values found for one of certificates"};if(2===o&&2===u.status&&e){const e=t[a+1];let r=!1;if("extensions"in e)for(const t of e.extensions)switch(t.extnID){case"2.5.29.31":case"2.5.29.46":case"1.3.6.1.5.5.7.1.1":r=!0}if(r)throw{result:!1,resultCode:11,resultMessage:`No revocation values found for one of certificates: ${u.statusMessage}`}}}for(let e=1;e<t.length;e++){if(!1===(await s(t[e])).result)return{result:!1,resultCode:14,resultMessage:"One of intermediate certificates is not a CA certificate"}}return{result:!0}}(o,r.checkDate),!1===a.result)throw a;return o}async verify(e={}){function t(e,t){const r=Object(z.i)(e),n=Object(z.i)(t),i=r.split("."),s=n.split("."),a=i.length,o=s.length;if(0===a||0===o||a<o)return!1;for(let e=0;e<a;e++)if(0===i[e].length)return!1;for(let e=0;e<o;e++)if(0===s[e].length){if(0===e){if(1===o)return!1;continue}return!1}for(let e=0;e<o;e++)if(0!==s[o-1-e].length&&0!==i[a-1-e].localeCompare(s[o-1-e]))return!1;return!0}function r(e,r){const n=Object(z.i)(e),i=Object(z.i)(r),s=n.split("@"),a=i.split("@");if(0===s.length||0===a.length||s.length<a.length)return!1;if(1===a.length){if(t(s[1],a[0])){const e=s[1].split("."),t=a[0].split(".");return 0===t[0].length||e.length===t.length}return!1}return 0===n.localeCompare(i)}function n(e,r){let n=Object(z.i)(e);const i=Object(z.i)(r),s=n.split("/");if(i.split("/").length>1)return!1;if(s.length>1)for(let e=0;e<s.length;e++)if(s[e].length>0&&":"!==s[e].charAt(s[e].length-1)){n=s[e].split(":")[0];break}if(t(n,i)){const e=n.split("."),t=i.split(".");return 0===t[0].length||e.length===t.length}return!1}function i(e,t){const r=new Uint8Array(e.valueBlock.valueHex),n=new Uint8Array(t.valueBlock.valueHex);if(4===r.length&&8===n.length){for(let e=0;e<4;e++)if((r[e]^n[e])&n[e+4])return!1;return!0}if(16===r.length&&32===n.length){for(let e=0;e<16;e++)if((r[e]^n[e])&n[e+16])return!1;return!0}return!1}function s(e,t){if(0===e.typesAndValues.length||0===t.typesAndValues.length)return!0;if(e.typesAndValues.length<t.typesAndValues.length)return!1;let r=!0,n=0;for(let i=0;i<t.typesAndValues.length;i++){let s=!1;for(let a=n;a<e.typesAndValues.length;a++)if(s=e.typesAndValues[a].isEqual(t.typesAndValues[i]),e.typesAndValues[a].type===t.typesAndValues[i].type&&(r=r&&s),!0===s){if(0===n||n===a){n=a+1;break}return!1}if(!1===s)return!1}return 0!==n&&r}try{if(0===this.certs.length)throw"Empty certificate array";let a=!1;"passedWhenNotRevValues"in e&&(a=e.passedWhenNotRevValues);let o=[];o.push("2.5.29.32.0");let u=!1,c=!1,l=!1,h=[],f=[],d=[];"initialPolicySet"in e&&(o=e.initialPolicySet),"initialExplicitPolicy"in e&&(u=e.initialExplicitPolicy),"initialPolicyMappingInhibit"in e&&(c=e.initialPolicyMappingInhibit),"initialInhibitPolicy"in e&&(l=e.initialInhibitPolicy),"initialPermittedSubtreesSet"in e&&(h=e.initialPermittedSubtreesSet),"initialExcludedSubtreesSet"in e&&(f=e.initialExcludedSubtreesSet),"initialRequiredNameForms"in e&&(d=e.initialRequiredNameForms);let m=u,p=c,b=l;const g=new Array(3);g[0]=!1,g[1]=!1,g[2]=!1;let y=0,v=0,w=0,_=h,A=f;const S=d;let B=1;this.certs=await this.sort(a);const k=[];k.push("2.5.29.32.0");const E=[],O=new Array(this.certs.length-1);for(let e=0;e<this.certs.length-1;e++)O[e]=!0;E.push(O);const N=new Array(this.certs.length-1),x=new Array(this.certs.length-1);let I=m?this.certs.length-1:-1;for(let e=this.certs.length-2;e>=0;e--,B++)if("extensions"in this.certs[e]){for(let t=0;t<this.certs[e].extensions.length;t++){if("2.5.29.32"===this.certs[e].extensions[t].extnID){x[e]=this.certs[e].extensions[t].parsedValue;for(let t=0;t<k.length;t++)if("2.5.29.32.0"===k[t]){delete E[t][e];break}for(let r=0;r<this.certs[e].extensions[t].parsedValue.certificatePolicies.length;r++){let n=-1;for(let i=0;i<k.length;i++)if(this.certs[e].extensions[t].parsedValue.certificatePolicies[r].policyIdentifier===k[i]){n=i;break}if(-1===n){k.push(this.certs[e].extensions[t].parsedValue.certificatePolicies[r].policyIdentifier);const n=new Array(this.certs.length-1);n[e]=!0,E.push(n)}else E[n][e]=!0}}if("2.5.29.33"===this.certs[e].extensions[t].extnID){if(p)return{result:!1,resultCode:98,resultMessage:"Policy mapping prohibited"};N[e]=this.certs[e].extensions[t].parsedValue}"2.5.29.36"===this.certs[e].extensions[t].extnID&&!1===m&&(0===this.certs[e].extensions[t].parsedValue.requireExplicitPolicy?(m=!0,I=e):!1===g[0]?(g[0]=!0,y=this.certs[e].extensions[t].parsedValue.requireExplicitPolicy):y=y>this.certs[e].extensions[t].parsedValue.requireExplicitPolicy?this.certs[e].extensions[t].parsedValue.requireExplicitPolicy:y,0===this.certs[e].extensions[t].parsedValue.inhibitPolicyMapping?p=!0:!1===g[1]?(g[1]=!0,v=this.certs[e].extensions[t].parsedValue.inhibitPolicyMapping+1):v=v>this.certs[e].extensions[t].parsedValue.inhibitPolicyMapping+1?this.certs[e].extensions[t].parsedValue.inhibitPolicyMapping+1:v),"2.5.29.54"===this.certs[e].extensions[t].extnID&&!1===b&&(0===this.certs[e].extensions[t].parsedValue.valueBlock.valueDec?b=!0:!1===g[2]?(g[2]=!0,w=this.certs[e].extensions[t].parsedValue.valueBlock.valueDec):w=w>this.certs[e].extensions[t].parsedValue.valueBlock.valueDec?this.certs[e].extensions[t].parsedValue.valueBlock.valueDec:w)}if(!0===b){let t=-1;for(let e=0;e<k.length;e++)if("2.5.29.32.0"===k[e]){t=e;break}-1!==t&&delete E[0][e]}!1===m&&!0===g[0]&&(y--,0===y&&(m=!0,I=e,g[0]=!1)),!1===p&&!0===g[1]&&(v--,0===v&&(p=!0,g[1]=!1)),!1===b&&!0===g[2]&&(w--,0===w&&(b=!0,g[2]=!1))}for(let e=0;e<this.certs.length-1;e++)if(e<this.certs.length-2&&void 0!==N[e+1])for(let t=0;t<N[e+1].mappings.length;t++){if("2.5.29.32.0"===N[e+1].mappings[t].issuerDomainPolicy||"2.5.29.32.0"===N[e+1].mappings[t].subjectDomainPolicy)return{result:!1,resultCode:99,resultMessage:'The "anyPolicy" should not be a part of policy mapping scheme'};let r=-1,n=-1;for(let i=0;i<k.length;i++)k[i]===N[e+1].mappings[t].issuerDomainPolicy&&(r=i),k[i]===N[e+1].mappings[t].subjectDomainPolicy&&(n=i);void 0!==E[r][e]&&delete E[r][e];for(let i=0;i<x[e].certificatePolicies.length;i++)if(N[e+1].mappings[t].subjectDomainPolicy===x[e].certificatePolicies[i].policyIdentifier&&-1!==r&&-1!==n)for(let t=0;t<=e;t++)void 0!==E[n][t]&&(E[r][t]=!0,delete E[n][t])}for(let e=0;e<k.length;e++)if("2.5.29.32.0"===k[e])for(let t=0;t<I;t++)delete E[e][t];const C=[];for(let e=0;e<E.length;e++){let t=!0;for(let r=0;r<this.certs.length-1;r++){let n=!1;if(r<I&&"2.5.29.32.0"===k[e]&&k.length>1){t=!1;break}if(void 0===E[e][r]){if(r>=I)for(let e=0;e<k.length;e++)if("2.5.29.32.0"===k[e]){!0===E[e][r]&&(n=!0);break}if(!n){t=!1;break}}}!0===t&&C.push(k[e])}let j=[];if(1===o.length&&"2.5.29.32.0"===o[0]&&!1===m)j=o;else if(1===C.length&&"2.5.29.32.0"===C[0])j=o;else for(let e=0;e<C.length;e++)for(let t=0;t<o.length;t++)if(o[t]===C[e]||"2.5.29.32.0"===o[t]){j.push(C[e]);break}const T={result:j.length>0,resultCode:0,resultMessage:j.length>0?"":'Zero "userConstrPolicies" array, no intersections with "authConstrPolicies"',authConstrPolicies:C,userConstrPolicies:j,explicitPolicyIndicator:m,policyMappings:N,certificatePath:this.certs};if(0===j.length)return T;if(!1===T.result)return T;B=1;for(let e=this.certs.length-2;e>=0;e--,B++){let a=[],o=[],u=[];if("extensions"in this.certs[e])for(let t=0;t<this.certs[e].extensions.length;t++)"2.5.29.30"===this.certs[e].extensions[t].extnID&&("permittedSubtrees"in this.certs[e].extensions[t].parsedValue&&(o=o.concat(this.certs[e].extensions[t].parsedValue.permittedSubtrees)),"excludedSubtrees"in this.certs[e].extensions[t].parsedValue&&(u=u.concat(this.certs[e].extensions[t].parsedValue.excludedSubtrees))),"2.5.29.17"===this.certs[e].extensions[t].extnID&&(a=a.concat(this.certs[e].extensions[t].parsedValue.altNames));let c=S.length<=0;for(let t=0;t<S.length;t++)switch(S[t].base.type){case 4:if(S[t].base.value.typesAndValues.length!==this.certs[e].subject.typesAndValues.length)continue;c=!0;for(let r=0;r<this.certs[e].subject.typesAndValues.length;r++)if(this.certs[e].subject.typesAndValues[r].type!==S[t].base.value.typesAndValues[r].type){c=!1;break}if(!0===c)break}if(!1===c)throw T.result=!1,T.resultCode=21,T.resultMessage="No neccessary name form found",T;const l=[];l[0]=[],l[1]=[],l[2]=[],l[3]=[],l[4]=[];for(let e=0;e<_.length;e++)switch(_[e].base.type){case 1:l[0].push(_[e]);break;case 2:l[1].push(_[e]);break;case 4:l[2].push(_[e]);break;case 6:l[3].push(_[e]);break;case 7:l[4].push(_[e])}for(let o=0;o<5;o++){let u=!1,c=!1;const h=l[o];for(let l=0;l<h.length;l++){switch(o){case 0:if(a.length>0)for(let e=0;e<a.length;e++)1===a[e].type&&(c=!0,u=u||r(a[e].value,h[l].base.value));else for(let t=0;t<this.certs[e].subject.typesAndValues.length;t++)"1.2.840.113549.1.9.1"!==this.certs[e].subject.typesAndValues[t].type&&"0.9.2342.19200300.100.1.3"!==this.certs[e].subject.typesAndValues[t].type||(c=!0,u=u||r(this.certs[e].subject.typesAndValues[t].value.valueBlock.value,h[l].base.value));break;case 1:if(a.length>0)for(let e=0;e<a.length;e++)2===a[e].type&&(c=!0,u=u||t(a[e].value,h[l].base.value));break;case 2:c=!0,u=s(this.certs[e].subject,h[l].base.value);break;case 3:if(a.length>0)for(let e=0;e<a.length;e++)6===a[e].type&&(c=!0,u=u||n(a[e].value,h[l].base.value));break;case 4:if(a.length>0)for(let e=0;e<a.length;e++)7===a[e].type&&(c=!0,u=u||i(a[e].value,h[l].base.value))}if(u)break}if(!1===u&&h.length>0&&c)throw T.result=!1,T.resultCode=41,T.resultMessage='Failed to meet "permitted sub-trees" name constraint',T}let h=!1;for(let o=0;o<A.length;o++){switch(A[o].base.type){case 1:if(a.length>=0)for(let e=0;e<a.length;e++)1===a[e].type&&(h=h||r(a[e].value,A[o].base.value));else for(let t=0;t<this.certs[e].subject.typesAndValues.length;t++)"1.2.840.113549.1.9.1"!==this.certs[e].subject.typesAndValues[t].type&&"0.9.2342.19200300.100.1.3"!==this.certs[e].subject.typesAndValues[t].type||(h=h||r(this.certs[e].subject.typesAndValues[t].value.valueBlock.value,A[o].base.value));break;case 2:if(a.length>0)for(let e=0;e<a.length;e++)2===a[e].type&&(h=h||t(a[e].value,A[o].base.value));break;case 4:h=h||s(this.certs[e].subject,A[o].base.value);break;case 6:if(a.length>0)for(let e=0;e<a.length;e++)6===a[e].type&&(h=h||n(a[e].value,A[o].base.value));break;case 7:if(a.length>0)for(let e=0;e<a.length;e++)7===a[e].type&&(h=h||i(a[e].value,A[o].base.value))}if(h)break}if(!0===h)throw T.result=!1,T.resultCode=42,T.resultMessage='Failed to meet "excluded sub-trees" name constraint',T;_=_.concat(o),A=A.concat(u)}return T}catch(e){if(e instanceof Object){if("resultMessage"in e)return e;if("message"in e)return{result:!1,resultCode:-1,resultMessage:e.message}}return{result:!1,resultCode:-1,resultMessage:e}}}}r(34);r(29),r(10);ne.a;r(21),r(31);r(30),r(28),r(22);var Le=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))};class Re{static attestEnclaveAndGetRsaPublicKey(e){return Le(this,void 0,void 0,(function*(){const t=K.decode(e.buffer),r=new Uint8Array(t[2]).buffer,n=K.decode(r),i={};for(const e in n.pcrs)i[e]=(s=n.pcrs[e],Array.prototype.map.call(new Uint8Array(s),(e=>`00${e.toString(16)}`.slice(-2))).join("").toUpperCase()).toLowerCase();var s;Re.assertPcrObjectValidity(i),yield Re.assertCertificateChainValidity(n.cabundle);const a=Re.getCertificatePublicKeyCoordinates(n.certificate);return yield Re.assertCoseSignatureValidity(t,a),new Uint8Array(n.public_key)}))}static assertCertificateChainValidity(e){return Le(this,void 0,void 0,(function*(){const t=F.E(c(H.a).buffer),r=new De({schema:t.result}),n=[];for(const t of e.slice(1)){const e=new Uint8Array(t).buffer,r=F.E(e),i=new De({schema:r.result});n.push(i)}const i=new Ue({trustedCerts:[r],certs:n,crls:[]}),s=yield i.verify();if(!0!==s.result)throw new Error(`Could not verify the certificate chain: ${s.resultMessage}`)}))}static getCertificatePublicKeyCoordinates(e){const t=new Uint8Array(e).buffer,r=F.E(t),n=new De({schema:r.result}),{x:i,y:s}=n.toJSON().subjectPublicKeyInfo;return{x:i,y:s}}static assertPcrObjectValidity(e){function t(t){for(const r in t){if(!e[r])return!1;if(t[r]!==e[r])return!1}return!0}const r=H.b;for(const e of r)if(t(e))return;throw new Error("Unexpected enclave PCR values")}static assertCoseSignatureValidity(e,t){return Le(this,void 0,void 0,(function*(){const r=new Uint8Array(e[0]),n=new Uint8Array(0),i=new Uint8Array(e[2]),s=new Uint8Array(e[3]),a=V.encode(["Signature1",r,n,i]),{x:o,y:u}=t,c=yield crypto.subtle.importKey("jwk",{x:o,y:u,key_ops:["verify"],kty:"EC",crv:"P-384"},{name:"ECDSA",namedCurve:"P-384"},!0,["verify"]);if(!(yield crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-384"}},c,s,a.buffer)))throw new Error("Could not verify COSE signature: Signature Mismatch")}))}}var Me=r(64),$e=r(43);class He{constructor(){this.VERSION=1}assertVersionAndType(e){const t=e.getUint8(0),r=e.getUint8(1);if(t!==this.VERSION)throw Error(`Unsupported BioLib Binary Format version: Got ${t} expected ${this.VERSION}`);if(r!==this.TYPE)throw Error(`Unsupported BioLib Binary Format type: Got ${r} expected ${this.TYPE}`)}}class Ve extends DataView{getBigUint64(e,t){if("function"==typeof super.getBigUint64)return super.getBigUint64(e,t);const r=BigInt(32),n=BigInt(this.getUint32(0|e,!!t)>>>0),i=BigInt(this.getUint32(4+(0|e)|0,!!t)>>>0);return t?i<<r|n:n<<r|i}setBigUint64(e,t,r){if("function"==typeof super.setBigUint64)return super.setBigUint64(e,t,r);const n=this.bigIntTo64BitByteArray(t);for(let t=0;t<n.length;t+=1){const i=r?n[n.length-1-t]:n[t];this.setUint8(e+t,i)}}bigIntTo64BitByteArray(e){let t=BigInt(e).toString(16);for(t.length%2!=0&&(t="0".concat(t));t.length<16;)t="00".concat(t);const r=t.length/2;if(8!==r)throw new Error("BigInt does not fit in 64 bits");const n=new Uint8Array(r);for(let e=0,i=0;e<r;e+=1,i+=2)n[e]=parseInt(t.slice(i,i+2),16);return n}}var Fe=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))};class Ke extends He{constructor(e){super(),this.TYPE=6;const t=e instanceof Uint8Array?this.deserialize(e):e;this.aesEncryptedData=t.aesEncryptedData,this.iv=t.iv,this.rsaEncryptedAesKey=t.rsaEncryptedAesKey,this.tag=t.tag}static create(e,t){return Fe(this,void 0,void 0,(function*(){try{const r=yield crypto.subtle.importKey("spki",e,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),n=yield crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),i=yield crypto.subtle.exportKey("raw",n),s=yield crypto.subtle.encrypt("RSA-OAEP",r,i),a=new Uint8Array(s),o=crypto.getRandomValues(new Uint8Array(this.IV_BYTE_LENGTH)),u=yield crypto.subtle.encrypt({iv:o,tagLength:8*this.TAG_BYTE_LENGTH,name:"AES-GCM"},n,t),c=new Uint8Array(u.slice(-this.TAG_BYTE_LENGTH,-1)),l=new Uint8Array(u.slice(0,-this.TAG_BYTE_LENGTH));return{aesKey:n,rsaEncryptedAesPackage:new Ke({aesEncryptedData:l,iv:o,rsaEncryptedAesKey:a,tag:c})}}catch(e){throw new Error(`Failed to encrypt package: ${e.message}`)}}))}getAttributes(){return{aesEncryptedData:this.aesEncryptedData,iv:this.iv,rsaEncryptedAesKey:this.rsaEncryptedAesKey,tag:this.tag}}serialize(){let e=0;e+=2,e+=2+this.rsaEncryptedAesKey.byteLength,e+=28,e+=8+this.aesEncryptedData.byteLength;const t=new Uint8Array(e),r=new Ve(t.buffer);r.setUint8(0,this.VERSION),r.setUint8(1,this.TYPE),r.setUint16(2,this.rsaEncryptedAesKey.byteLength),t.set(this.rsaEncryptedAesKey,4);let n=4+this.rsaEncryptedAesKey.byteLength;return t.set(this.iv,n),n+=12,t.set(this.tag,n),n+=16,r.setBigUint64(n,BigInt(this.aesEncryptedData.byteLength)),n+=8,t.set(this.aesEncryptedData,n),t}deserialize(e){throw Error("RsaEncryptedAesPackage: Deserialize not implemented")}}Ke.IV_BYTE_LENGTH=12,Ke.TAG_BYTE_LENGTH=16;var ze=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))};class qe extends He{constructor(e){super(),this.TYPE=7,this.IV_BYTE_LENGTH=12,this.TAG_BYTE_LENGTH=16;const t=e instanceof Uint8Array?this.deserialize(e):e;this.aesEncryptedData=t.aesEncryptedData,this.iv=t.iv,this.tag=t.tag}getAttributes(){return{aesEncryptedData:this.aesEncryptedData,iv:this.iv,tag:this.tag}}serialize(){throw Error("AesEncryptedPackage: Serialize not implemented")}decrypt(e){return ze(this,void 0,void 0,(function*(){const t=new Uint8Array(this.aesEncryptedData.byteLength+this.tag.byteLength);t.set(this.aesEncryptedData,0),t.set(this.tag,this.aesEncryptedData.byteLength);const r=yield crypto.subtle.decrypt({iv:this.iv,name:"AES-GCM",tagLength:8*this.TAG_BYTE_LENGTH},e,t);return new Uint8Array(r)}))}deserialize(e){const t=new Ve(e.buffer,e.byteOffset,e.byteLength);this.assertVersionAndType(t);let r=2;const n=e.slice(r,r+this.IV_BYTE_LENGTH);r+=this.IV_BYTE_LENGTH;const i=e.slice(r,r+this.TAG_BYTE_LENGTH);r+=this.TAG_BYTE_LENGTH;const s=Number(t.getBigUint64(r));r+=8;return{aesEncryptedData:e.slice(r,r+s),iv:n,tag:i}}}const Je={1:"Failed to init compute process variables",2:"Failed to connect to worker thread socket",3:"Failed to start sender or receiver thread",4:"Failed to get attestation document",5:"Failed to create docker networks",6:"Failed to start remote host proxies",7:"Failed to redirect enclave traffic to proxies",8:"Failed to create proxy container",9:"Failed to configure allowed remote host",10:"Failed to send status update",11:"Failed to get required data for compute",12:"Failed to start runtime zip download thread",13:"Failed to download runtime zip",14:"Failed to contact backend to create job",15:"Failed to create new job",16:"Failed to start image pulling thread",17:"Failed to pull docker image",18:"Failed to start compute container",19:"Failed to copy input files to compute container",20:"Failed to copy runtime files to compute container",21:"Failed to run compute container",22:"Failed to retrieve and map output files",23:"Failed to serialize and send module output",24:"Failed to deserialize job",25:"Unknown Compute Process Error",26:"Failed to initialize worker thread",27:"Failed to handle package in worker thread"};var Ye=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))};(new class{constructor(){this.statusUpdateSubject=new $e.Subject,this.logMessage=e=>this.statusUpdateSubject.next({message:e}),this.setProgressCompute=e=>this.statusUpdateSubject.next({progressCompute:e}),this.setProgressInitialization=e=>this.statusUpdateSubject.next({progressInitialization:e}),this.methodsExposedToParent={statusUpdateObservable:()=>$e.Observable.from(this.statusUpdateSubject),runJobRemote:this.runJobRemote.bind(this)}}expose(){Object(Me.expose)(this.methodsExposedToParent)}runJobRemote(e,t,r){return Ye(this,void 0,void 0,(function*(){const n=!e.job.custom_compute_node_url||!e.job.app_version.modules;try{let i;if(i=n?yield this.runJobBiolibCloud(e,t):yield this.runJobCustomComputeNode(e,t),!r)return i;(class{dummyMethod(){Object(s.a)({})}static checkAtomicsAndCreateSharedArray(){if("undefined"==typeof Atomics)throw new a("Synchronous module calls are only supported in browsers that support shared memory.\nConsider using Chrome.");return new WebAssembly.Memory({shared:!0,initial:1,maximum:3e4})}static writeToSharedMemoryBuffer(e,t){const r=e.length+4-t.buffer.byteLength;if(r>0){const e=Math.ceil(r/65536);t.grow(e)}const n=new Int32Array(t.buffer,0,1),i=new Uint8Array(t.buffer,4,e.length);return Atomics.store(n,0,e.length),i.set(e),Atomics.notify(n,0,1),i}static blockAndReadSharedArrayBuffer(e){const t=new Int32Array(e.buffer,0,1);Atomics.wait(t,0,0);const r=Atomics.load(t,0);return Atomics.store(t,0,0),new Uint8Array(e.buffer,4,r)}}).writeToSharedMemoryBuffer(i,r)}catch(e){throw!n&&e instanceof y?new v(e.message):a.chainErrors("Remote job failed",e)}}))}runJobBiolibCloud(e,t){return Ye(this,void 0,void 0,(function*(){const{job:r,moduleName:n,biolibApiBaseUrl:i,refreshToken:s}=e;this.logMessage("Cloud: Creating job");const a=new k({refreshToken:s,baseURL:i}),o=new N(a),u=yield o.createCloudJob({module_name:n,job_id:r.public_id},this.logMessage);this.logMessage(`Cloud: Job created with id ${u.public_id}`);const{url:l,attestation_document_base64:h}=u.compute_node_info,f=this.getComputeNode(l),d=l.split("/cloud-proxy/")[1];this.logMessage(`Cloud: Awaiting initialization of compute node at ${d}`);const m=c(h);this.logMessage("Cloud: Got enclave attestation document. Verifying enclave...");const p=yield Re.attestEnclaveAndGetRsaPublicKey(m);return this.logMessage("Cloud: Enclave is verified. Encrypting module input data..."),yield this.computeCloudJob(f,p,r.public_id,t,"Cloud")}))}runJobCustomComputeNode(e,t){return Ye(this,void 0,void 0,(function*(){const{job:r,moduleName:n,biolibApiBaseUrl:i,refreshToken:s}=e;if(!r.custom_compute_node_url)throw new a("Custom compute node url was undefined");const{modules:o}=r.app_version;if(!o)throw new a("Starting compute node: Modules were undefined");if(!o.find((({name:e})=>e===n)))throw new a(`Starting compute node: Did not find module ${n}`);const u=this.getComputeNode(r.custom_compute_node_url),c=new k({refreshToken:s,baseURL:i}),l=yield c.fetchNewAccessToken();return this.logMessage("Compute node: Saving job"),yield u.post("/job/",{access_token:l,job:r,module_name:n},{timeout:15e3}),yield this.computeCloudJob(u,null,r.public_id,t,"Compute node")}))}computeCloudJob(e,t,r,n,i){return Ye(this,void 0,void 0,(function*(){let s,a=null;if(t){const{aesKey:e,rsaEncryptedAesPackage:r}=yield Ke.create(t,n);a=e,s=r.serialize()}else s=n;yield e.post(`/job/${r}/start/`,s,{headers:{"Content-Type":"application/octet-stream"}}),yield this.awaitComputeNodeStatus({computeNode:e,type:i,jobId:r,errorMessageOnLimitHit:"Failed to get results: Retry limit exceeded",retryIntervalInSeconds:1.5,retryLimitInMinutes:30,statusToAwait:"Result Ready"});const o=yield e.get(`/job/${r}/result/`,{responseType:"arraybuffer"});this.logMessage(`${i}: Got module output.`);const u=new Uint8Array(o.data);let c;if(a){this.logMessage(`${i}: Decrypting module output...`);const e=new qe(u);c=yield e.decrypt(a),this.logMessage(`${i}: Successfully decrypted module output`)}else c=u;return c}))}getComputeNode(e){const t=i.a.create({baseURL:`${e}/v1`});return t.interceptors.response.use((e=>e),(t=>t instanceof l?Promise.reject(t):t.isAxiosError&&!t.response?Promise.reject(new y(`Lost connection to compute node at ${e}`)):Promise.reject(l.generate(t.response)))),t}awaitComputeNodeStatus(e){return Ye(this,void 0,void 0,(function*(){const{computeNode:t,errorMessageOnLimitHit:r,retryIntervalInSeconds:n,retryLimitInMinutes:i,statusToAwait:s,type:o,jobId:c}=e,l=Math.floor(60*i/n);for(let e=0;e<l;e+=1){const e=yield t.get(`/job/${c}/status/`),{error_code:r,status_updates:i}=e.data;let l=!1;for(const{log_message:e,progress:t}of i)void 0!==t&&this.setProgressCompute(t),void 0!==e&&this.logMessage(`${o}: ${e}`),e===s&&(l=!0);if(void 0!==r){throw new a(`${o}: ${Je[r]}`)}if(l)return;yield u(1e3*n)}throw new g(r)}))}}).expose()},function(e,t,r){"use strict";r.r(t),r.d(t,"filter",(function(){return k})),r.d(t,"flatMap",(function(){return N})),r.d(t,"interval",(function(){return x})),r.d(t,"map",(function(){return C})),r.d(t,"merge",(function(){return j})),r.d(t,"multicast",(function(){return P})),r.d(t,"Observable",(function(){return A})),r.d(t,"scan",(function(){return U})),r.d(t,"Subject",(function(){return T})),r.d(t,"unsubscribe",(function(){return S}));var n=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,o)}u((n=n.apply(e,t||[])).next())}))};class i{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then((()=>this._baseObserver.complete())).catch((e=>this._baseObserver.error(e)))}error(e){this._baseObserver.error(e)}schedule(e){const t=Promise.all(this._pendingPromises),r=[],i=e=>r.push(e),s=Promise.resolve().then((()=>n(this,void 0,void 0,(function*(){yield t,yield e(i),this._pendingPromises.delete(s);for(const e of r)this._baseObserver.next(e)})))).catch((e=>{this._pendingPromises.delete(s),this._baseObserver.error(e)}));this._pendingPromises.add(s)}}const s=()=>"function"==typeof Symbol,a=e=>s()&&Boolean(Symbol[e]),o=e=>a(e)?Symbol[e]:"@@"+e;a("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const u=o("iterator"),c=o("observable"),l=o("species");function h(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function f(e){let t=e.constructor;return void 0!==t&&(t=t[l],null===t&&(t=void 0)),void 0!==t?t:_}function d(e){d.log?d.log(e):setTimeout((()=>{throw e}),0)}function m(e){Promise.resolve().then((()=>{try{e()}catch(e){d(e)}}))}function p(e){const t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{const e=h(t,"unsubscribe");e&&e.call(t)}}catch(e){d(e)}}function b(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function g(e,t,r){e._state="running";const n=e._observer;try{const i=n?h(n,t):void 0;switch(t){case"next":i&&i.call(n,r);break;case"error":if(b(e),!i)throw r;i.call(n,r);break;case"complete":b(e),i&&i.call(n)}}catch(e){d(e)}"closed"===e._state?p(e):"running"===e._state&&(e._state="ready")}function y(e,t,r){if("closed"!==e._state)return"buffering"===e._state?(e._queue=e._queue||[],void e._queue.push({type:t,value:r})):"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void m((()=>function(e){const t=e._queue;if(t){e._queue=void 0,e._state="ready";for(const r of t)if(g(e,r.type,r.value),"closed"===e._state)break}}(e)))):void g(e,t,r)}class v{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const r=new w(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(b(this),p(this))}}class w{constructor(e){this._subscription=e}get closed(){return"closed"===this._subscription._state}next(e){y(this._subscription,"next",e)}error(e){y(this._subscription,"error",e)}complete(){y(this._subscription,"complete")}}class _{constructor(e){if(!(this instanceof _))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,t,r){return"object"==typeof e&&null!==e||(e={next:e,error:t,complete:r}),new v(e,this._subscriber)}pipe(e,...t){let r=this;for(const n of[e,...t])r=n(r);return r}tap(e,t,r){const n="object"!=typeof e||null===e?{next:e,error:t,complete:r}:e;return new _((e=>this.subscribe({next(t){n.next&&n.next(t),e.next(t)},error(t){n.error&&n.error(t),e.error(t)},complete(){n.complete&&n.complete(),e.complete()},start(e){n.start&&n.start(e)}})))}forEach(e){return new Promise(((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){i.unsubscribe(),t()}const i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t})}))}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(f(this))((t=>this.subscribe({next(r){let n=r;try{n=e(r)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}})))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(f(this))((t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}})))}reduce(e,t){if("function"!=typeof e)throw new TypeError(e+" is not a function");const r=f(this),n=arguments.length>1;let i=!1,s=t;return new r((t=>this.subscribe({next(r){const a=!i;if(i=!0,!a||n)try{s=e(s,r)}catch(e){return t.error(e)}else s=r},error(e){t.error(e)},complete(){if(!i&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(s),t.complete()}})))}concat(...e){const t=f(this);return new t((r=>{let n,i=0;return function s(a){n=a.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):s(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}}))}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");const t=f(this);return new t((r=>{const n=[],i=this.subscribe({next(i){let a;if(e)try{a=e(i)}catch(e){return r.error(e)}else a=i;const o=t.from(a).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){const e=n.indexOf(o);e>=0&&n.splice(e,1),s()}});n.push(o)},error(e){r.error(e)},complete(){s()}});function s(){i.closed&&0===n.length&&r.complete()}return()=>{n.forEach((e=>e.unsubscribe())),i.unsubscribe()}}))}[c](){return this}static from(e){const t="function"==typeof this?this:_;if(null==e)throw new TypeError(e+" is not an object");const r=h(e,c);if(r){const n=r.call(e);if(Object(n)!==n)throw new TypeError(n+" is not an object");return function(e){return e instanceof _}(n)&&n.constructor===t?n:new t((e=>n.subscribe(e)))}if(a("iterator")){const r=h(e,u);if(r)return new t((t=>{m((()=>{if(!t.closed){for(const n of r.call(e))if(t.next(n),t.closed)return;t.complete()}}))}))}if(Array.isArray(e))return new t((t=>{m((()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}}))}));throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:_)((t=>{m((()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}}))}))}static get[l](){return this}}s()&&Object.defineProperty(_,Symbol("extensions"),{value:{symbol:c,hostReportError:d},configurable:!0});var A=_;var S=function(e){"function"==typeof e?e():e&&"function"==typeof e.unsubscribe&&e.unsubscribe()},B=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,o)}u((n=n.apply(e,t||[])).next())}))};var k=function(e){return t=>new A((r=>{const n=new i(r),s=t.subscribe({complete(){n.complete()},error(e){n.error(e)},next(t){n.schedule((r=>B(this,void 0,void 0,(function*(){(yield e(t))&&r(t)}))))}});return()=>S(s)}))};var E=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,o)}u((n=n.apply(e,t||[])).next())}))},O=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}};var N=function(e){return t=>new A((r=>{const n=new i(r),s=t.subscribe({complete(){n.complete()},error(e){n.error(e)},next(t){n.schedule((r=>E(this,void 0,void 0,(function*(){var n,i;const s=yield e(t);if((c=s)&&a("iterator")&&c[Symbol.iterator]||function(e){return e&&a("asyncIterator")&&e[Symbol.asyncIterator]}(s))try{for(var o,u=O(s);!(o=yield u.next()).done;){const e=o.value;r(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}else s.map((e=>r(e)));var c}))))}});return()=>S(s)}))};function x(e){return new _((t=>{let r=0;const n=setInterval((()=>{t.next(r++)}),e);return()=>clearInterval(n)}))}var I=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,o)}u((n=n.apply(e,t||[])).next())}))};var C=function(e){return t=>new A((r=>{const n=new i(r),s=t.subscribe({complete(){n.complete()},error(e){n.error(e)},next(t){n.schedule((r=>I(this,void 0,void 0,(function*(){const n=yield e(t);r(n)}))))}});return()=>S(s)}))};var j=function(...e){return 0===e.length?_.from([]):new _((t=>{let r=0;const n=e.map((n=>n.subscribe({error(e){t.error(e),i()},next(e){t.next(e)},complete(){++r===e.length&&(t.complete(),i())}}))),i=()=>{n.forEach((e=>S(e)))};return i}))};var T=class extends A{constructor(){super((e=>(this._observers.add(e),()=>this._observers.delete(e)))),this._observers=new Set}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){for(const e of this._observers)e.complete()}};var P=function(e){const t=new T;let r,n=0;return new A((i=>{r||(r=e.subscribe(t));const s=t.subscribe(i);return n++,()=>{n--,s.unsubscribe(),0===n&&(S(r),r=void 0)}}))},D=function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,o)}u((n=n.apply(e,t||[])).next())}))};var U=function(e,t){return r=>new A((n=>{let s,a=0;const o=new i(n),u=r.subscribe({complete(){o.complete()},error(e){o.error(e)},next(r){o.schedule((n=>D(this,void 0,void 0,(function*(){const i=0===a?void 0===t?r:t:s;s=yield e(i,r,a++),n(s)}))))}});return()=>S(u)}))}}]);
|