@nmshd/transport 2.1.4 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildInformation.js +5 -5
- package/dist/core/CoreCrypto.js.map +1 -1
- package/dist/core/CoreError.js.map +1 -1
- package/dist/core/CoreErrors.d.ts +1 -0
- package/dist/core/CoreErrors.js +3 -0
- package/dist/core/CoreErrors.js.map +1 -1
- package/dist/core/CoreIdHelper.js.map +1 -1
- package/dist/core/CoreUtil.js.map +1 -1
- package/dist/core/ICacheable.js.map +1 -1
- package/dist/core/Reference.js.map +1 -1
- package/dist/core/Transport.js.map +1 -1
- package/dist/core/TransportContext.js.map +1 -1
- package/dist/core/TransportController.js.map +1 -1
- package/dist/core/TransportLoggerFactory.js.map +1 -1
- package/dist/core/backbone/AuthClient.js +3 -3
- package/dist/core/backbone/AuthClient.js.map +1 -1
- package/dist/core/backbone/Authenticator.js.map +1 -1
- package/dist/core/backbone/ClientResult.js.map +1 -1
- package/dist/core/backbone/Paginator.js.map +1 -1
- package/dist/core/backbone/RESTClient.js.map +1 -1
- package/dist/core/backbone/RESTClientAuthenticate.js.map +1 -1
- package/dist/core/backbone/RequestError.js.map +1 -1
- package/dist/core/logging/logExecutionTime.js.map +1 -1
- package/dist/core/types/CoreAddress.js.map +1 -1
- package/dist/core/types/CoreDate.js.map +1 -1
- package/dist/core/types/CoreHash.js.map +1 -1
- package/dist/core/types/CoreId.js.map +1 -1
- package/dist/modules/accounts/AccountController.js.map +1 -1
- package/dist/modules/accounts/IdentityController.js.map +1 -1
- package/dist/modules/accounts/IdentityUtil.js.map +1 -1
- package/dist/modules/challenges/ChallengeController.js.map +1 -1
- package/dist/modules/challenges/data/ChallengeSigned.js.map +1 -1
- package/dist/modules/devices/DeviceController.js.map +1 -1
- package/dist/modules/devices/DeviceSecretController.js.map +1 -1
- package/dist/modules/devices/DevicesController.js +7 -0
- package/dist/modules/devices/DevicesController.js.map +1 -1
- package/dist/modules/devices/backbone/DeviceAuthClient.d.ts +1 -0
- package/dist/modules/devices/backbone/DeviceAuthClient.js +3 -0
- package/dist/modules/devices/backbone/DeviceAuthClient.js.map +1 -1
- package/dist/modules/files/FileController.js.map +1 -1
- package/dist/modules/messages/MessageController.js +10 -10
- package/dist/modules/messages/MessageController.js.map +1 -1
- package/dist/modules/messages/transmission/MessageContentWrapper.js.map +1 -1
- package/dist/modules/messages/transmission/MessageEnvelope.js.map +1 -1
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -1
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js.map +1 -1
- package/dist/modules/relationships/RelationshipSecretController.js.map +1 -1
- package/dist/modules/relationships/RelationshipsController.js.map +1 -1
- package/dist/modules/relationships/transmission/changes/RelationshipChange.js.map +1 -1
- package/dist/modules/secrets/SecretController.js.map +1 -1
- package/dist/modules/sync/DatawalletModificationMapper.js.map +1 -1
- package/dist/modules/sync/DatawalletModificationsProcessor.js.map +1 -1
- package/dist/modules/sync/ExternalEventsProcessor.js.map +1 -1
- package/dist/modules/sync/SyncController.js.map +1 -1
- package/dist/modules/sync/SynchronizedCollection.js.map +1 -1
- package/dist/modules/tokens/AnonymousTokenController.js.map +1 -1
- package/dist/modules/tokens/TokenController.js.map +1 -1
- package/dist/util/PasswordGenerator.js.map +1 -1
- package/dist/util/Random.js.map +1 -1
- package/lib-web/nmshd.transport.js +24588 -24572
- package/lib-web/nmshd.transport.js.map +1 -1
- package/lib-web/nmshd.transport.min.js +1 -1
- package/lib-web/nmshd.transport.min.js.map +1 -1
- package/package.json +60 -52
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see nmshd.transport.min.js.LICENSE.txt */
|
|
2
|
-
var NMSHDTransport;(()=>{var e={2500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildInformation=void 0;const n=r(194),i=r(2890);t.buildInformation={version:"2.1.4",build:"63",date:"2023-11-17T14:40:52+00:00",commit:"09eb88033395f248a6df1c4b89ab9dc1c8c2c59b",dependencies:{"@js-soft/docdb-access-abstractions":"1.0.2","@js-soft/logging-abstractions":"1.0.1","@js-soft/simple-logger":"1.0.4","@js-soft/ts-utils":"2.3.3",axios:"^1.6.2","fast-json-patch":"^3.1.1","form-data":"^4.0.0","json-stringify-safe":"^5.0.1",lodash:"^4.17.21",luxon:"^3.4.4",qs:"^6.11.2","reflect-metadata":"^0.1.13","ts-simple-nameof":"^1.3.1",uuid:"^9.0.1"},libraries:{crypto:i.buildInformation,serval:n.buildInformation}}},4093:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreCrypto=void 0;const n=r(2890),i=r(1577),a=r(1796),o=r(819);t.CoreCrypto=class CoreCrypto{static async generateSignatureKeypair(e=o.TransportVersion.Latest){if(e===o.TransportVersion.V1)return await n.CryptoSignatures.generateKeypair(3);throw this.invalidVersion(e)}static async generateExchangeKeypair(e=o.TransportVersion.Latest){if(e===o.TransportVersion.V1)return await n.CryptoExchange.generateKeypair(3);throw this.invalidVersion(e)}static async generateSecretKey(e=o.TransportVersion.Latest){if(e===o.TransportVersion.V1)return await n.CryptoEncryption.generateKey(3);throw this.invalidVersion(e)}static async generatePassword(e,t="enmeshed",r=3,i=o.TransportVersion.Latest){const a=n.CoreBuffer.fromString(e,n.Encoding.Utf8),s=n.CoreBuffer.fromString(t,n.Encoding.Utf8);if(i===o.TransportVersion.V1)return await n.CryptoDerivation.deriveKeyFromMaster(a,15e4,r,s);throw this.invalidVersion(i)}static async deriveKeyFromBase(e,t,r,i=3){let o;if(e instanceof n.CryptoSecretKey)o=e.secretKey;else{if(!(e instanceof n.CoreBuffer))throw new a.TransportError("The secret type is invalid.");o=e}return await n.CryptoDerivation.deriveKeyFromBase(o,t,r,i)}static async deriveClient(e,t,r=3,i=o.TransportVersion.Latest){if(i===o.TransportVersion.V1){return await n.CryptoExchange.deriveTemplator(e,t,r)}throw this.invalidVersion(i)}static async deriveServer(e,t,r=3,i=o.TransportVersion.Latest){if(i===o.TransportVersion.V1){return await n.CryptoExchange.deriveRequestor(e,t,r)}throw this.invalidVersion(i)}static async sign(e,t,r=o.TransportVersion.Latest){if(r===o.TransportVersion.V1)return await n.CryptoSignatures.sign(e,t,2);throw this.invalidVersion(r)}static async verify(e,t,r,i=o.TransportVersion.Latest){if(i===o.TransportVersion.V1)return await n.CryptoSignatures.verify(e,t,r);throw this.invalidVersion(i)}static async encrypt(e,t,r=o.TransportVersion.Latest){if(r===o.TransportVersion.V1)return await n.CryptoEncryption.encrypt(e,t);throw this.invalidVersion(r)}static async decrypt(e,t,r=o.TransportVersion.Latest){if(r===o.TransportVersion.V1)return await n.CryptoEncryption.decrypt(e,t);throw this.invalidVersion(r)}static async random(e){return await n.CryptoRandom.bytes(e)}static async createAccountPassword(){return await i.PasswordGenerator.createStrongPassword(100,100)}static invalidVersion(e){return new a.TransportError(`The version ${e} is not supported.`)}}},8147:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreError=void 0;const i=n(r(4530));class CoreError extends Error{get code(){return this._code}get reason(){return this._reason}get data(){return this._data}get time(){return this._time}get rootError(){return this._rootError}get context(){return this._context}constructor(e="error.unknown",t="Operation failed unexpectedly.",r=null,n=new Date,a,o){const s=[];s.push(e),t&&s.push(": '",t,"'"),s.push(" at ",n.toISOString()),r&&("function"==typeof r.toJSON?s.push(` with data ${r.toJSON(!1)}`):s.push(` with data ${(0,i.default)(r)}`)),super(s.join("")),this._code=e,this._reason=t,this._time=n,this._data=r,this.name="CoreError",this._rootError=a,this._context=o,void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,null!=o?o:CoreError)}equals(e){return this.code===e.code}logWith(e){return e.error(this),this}}t.CoreError=CoreError},6555:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreErrors=void 0;const i=n(r(4530)),a=r(8147);class CoreErrors{}t.CoreErrors=CoreErrors,CoreErrors.relationships=new class Relationships{wrongChangeStatus(e){return new a.CoreError("error.transport.relationships.wrongChangeStatus",`The relationship change has the wrong status (${e}) to run this operation`)}},CoreErrors.general=new class General{baseUrlNotSet(){return new a.CoreError("error.transport.general.baseUrlNotSet","The baseUrl was not set.")}platformClientSecretNotSet(){return new a.CoreError("error.transport.general.platformClientSecretNotSet","The platform clientSecret was not set.")}platformClientIdNotSet(){return new a.CoreError("error.transport.general.platformClientIdNotSet","The platform clientId was not set.")}platformClientInvalid(){return new a.CoreError("error.transport.general.platformClientInvalid","The combination of platform clientId and clientSecret is invalid.")}signatureNotValid(e){return new a.CoreError("error.transport.signatureNotValid",`The ${e?`${e}-`:""}signature is not valid.`)}recordNotFound(e,t){return new a.CoreError("error.transport.recordNotFound",`'${e instanceof Function?e.name:e}' not found.`,t)}notSupported(){return new a.CoreError("error.transport.notSupported","The method is not yet supported.")}realmLength(){return new a.CoreError("error.transport.identity.realmLength","Realm must be of length 3.")}invalidTruncatedReference(){return new a.CoreError("error.transport.files.invalidTruncatedReference","invalid truncated reference")}},CoreErrors.messages=new class Messages{plaintextMismatch(e){return new a.CoreError("error.transport.messages.plaintextMismatch",`The own address ${e} was not named as a recipient within the signed MessagePlaintext. A replay attack might be the cause of this.`)}signatureListMismatch(e){return new a.CoreError("error.transport.messages.signatureListMismatch",`The signature list didn't contain an entry for address ${e}.`)}signatureNotValid(){return new a.CoreError("error.transport.messages.signatureNotValid","The digital signature on this message for peer key is invalid. An impersonination attack might be the cause of this.")}ownAddressNotInList(e){return new a.CoreError("error.transport.messages.ownAddressNotInList",`The recipients list of message ${e} didn't contain an entry for the own address. This message should not have been received.`)}noMatchingRelationship(e){return new a.CoreError("error.transport.messages.noMatchingRelationship",`A Relationship with the given address '${e}' does not exist.`)}},CoreErrors.secrets=new class Secrets{wrongSecretType(e){return new a.CoreError("error.transport.secrets.wrongBaseKeyType","The given secret type is not supported!",{secretId:e})}secretNotFound(e){return new a.CoreError("error.transport.secrets.secretNotFound",`secret "${e}" not found`)}},CoreErrors.device=new class Device{alreadyOnboarded(){return new a.CoreError("error.transport.devices.alreadyOnboarded","The device has already been onboarded.")}},CoreErrors.files=new class Files{plaintextHashMismatch(){return new a.CoreError("error.transport.files.plaintextHashMismatch","The actual hash of the plaintext does not match the given plaintextHash. Something went wrong while encrypting/decrypting the file.")}cipherMismatch(){return new a.CoreError("error.transport.files.cipherMismatch","The actual hash of the cipher does not match the given cipherHash. Something went wrong while storing/transmitting the file.")}invalidMetadata(e){return new a.CoreError("error.transport.files.invalidMetadata",`The metadata of the file with id "${e}" is invalid.`)}fileContentUndefined(){return new a.CoreError("error.transport.files.fileContentUndefined","The given file content is undefined.")}maxFileSizeExceeded(e,t){return new a.CoreError("error.transport.files.maxFileSizeExceeded",`The given file content size (${e}) exceeds the max file size the backbone accepts (${t}).`)}},CoreErrors.challenges=new class Challenges{challengeTypeRequiresRelationship(){return new a.CoreError("error.transport.challenges.challengeTypeRequiresRelationship","The challenge type 'Relationship' requires a relationship.")}},CoreErrors.datawallet=new class Datawallet{encryptedPayloadIsNoCipher(){return new a.CoreError("error.transport.datawallet.encryptedPayloadIsNoCipher","The given encrypted payload is no cipher.")}unsupportedModification(e,t){const r=t?(0,i.default)(t):"";if("unsupportedCacheChangedModificationCollection"===e)return new a.CoreError("error.transport.datawallet.unsupportedModification",`The following collections were received in CacheChanged datawallet modifications but are not supported by the current version of this library: ${r}.`);throw new Error(`Given type '${e}' is not supported.`)}insufficientSupportedDatawalletVersion(e,t){return new a.CoreError("error.transport.datawallet.insufficientSupportedDatawalletVersion",`The SupportedDatawalletVersion '${e}' is too low. A minimum version of '${t}' is required.`)}currentBiggerThanTarget(e,t){return new a.CoreError("error.transport.datawallet.currentBiggerThanTarget",`The current datawallet version '${e}' is bigger than the target version '${t}'.`)}},CoreErrors.tokens=new class Tokens{invalidTokenContent(e){return new a.CoreError("error.transport.tokens.invalidTokenContent",`The content of token ${e} is not of type TokenContent`)}}},3289:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreIdHelper=void 0;const n=r(5833),i=r(1796),a=r(9170);t.CoreIdHelper=class CoreIdHelper{constructor(e,t=!1){this.prefix=e,this.validateOnly=t,this.coreIdRegex=new RegExp(`${e}[${n.RandomCharacterRange.Alphanumeric}]{${20-e.length}}`)}async generate(){if(this.validateOnly)throw new i.TransportError("This CoreIdHelper is set up for validation only.");return await a.CoreId.generate(this.prefix)}async generateUnsafe(){return await a.CoreId.generate(this.prefix)}validate(e){return e instanceof a.CoreId&&(e=e.toString()),this.coreIdRegex.test(e)}}},6904:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreSerializable=void 0;const i=r(194),a=r(2890);let o=class CoreSerializable extends i.Serializable{toBase64(){return a.CoreBuffer.fromUtf8(this.serialize()).toBase64URL()}static fromBase64T(e){const t=a.CoreBuffer.fromBase64URL(e).toUtf8();return this.deserialize(t)}static fromBase64Unknown(e){const t=a.CoreBuffer.fromBase64URL(e).toUtf8();return i.Serializable.deserializeUnknown(t)}};t.CoreSerializable=o,t.CoreSerializable=o=n([(0,i.type)("CoreSerializable")],o)},2970:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreSerializableAsync=void 0;const i=r(194),a=r(2890);let o=class CoreSerializableAsync extends i.SerializableAsync{toBase64(){return a.CoreBuffer.fromUtf8(this.serialize()).toBase64URL()}static async fromBase64T(e){const t=a.CoreBuffer.fromBase64URL(e).toUtf8(),r=this.deserialize(t);return await r}static async fromBase64Unknown(e){const t=a.CoreBuffer.fromBase64URL(e).toUtf8();return await i.SerializableAsync.deserializeUnknown(t)}};t.CoreSerializableAsync=o,t.CoreSerializableAsync=o=n([(0,i.type)("CoreSerializableAsync")],o)},6564:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreSynchronizable=void 0;const a=r(194),o=r(6904),s=r(9170);class CoreSynchronizable extends o.CoreSerializable{constructor(){super(...arguments),this.technicalProperties=[],this.userdataProperties=[],this.metadataProperties=[]}}t.CoreSynchronizable=CoreSynchronizable,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],CoreSynchronizable.prototype,"id",void 0)},1341:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreUtil=void 0;const n=r(194),i=r(2890),a=r(1796);t.CoreUtil=class CoreUtil{static toBuffer(e,t=!1){let r;if(e instanceof i.CoreBuffer)return e;if("string"==typeof e)r=i.CoreBuffer.fromUtf8(e);else if(e instanceof n.SerializableAsync||e instanceof n.Serializable)r=i.CoreBuffer.fromUtf8(e.serialize(t));else{if(!(e instanceof ArrayBuffer||e instanceof Uint8Array))throw new a.TransportError("The given content cannot be transformed to buffer.");r=new i.CoreBuffer(e)}return r}static toSerializable(e){return e instanceof n.SerializableAsync||e instanceof n.Serializable?e:n.Serializable.fromUnknown(e)}}},369:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DbCollectionName=void 0,function(e){e.Files="Files",e.Tokens="Tokens",e.Relationships="Relationships",e.RelationshipTemplates="Templates",e.Messages="Messages",e.CertificatesIssued="CertificatesIssued",e.UnpushedDatawalletModifications="UnpushedDatawalletModifications",e.Devices="Devices",e.Secrets="Secrets"}(r||(t.DbCollectionName=r={}))},5796:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1201:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressReporterStep=t.ProgressReporter=void 0;t.ProgressReporter=class ProgressReporter{constructor(e){this.callback=e}createStep(e,t=-1){return new ProgressReporterStep(e,t,this.callback)}};class ProgressReporterStep{constructor(e,t,r){this.name=e,this.totalNumberOfItems=t,this.callback=r,t>0&&this.progressTo(0)}progress(){this.progressTo(this.currentItem+1)}progressTo(e){var t;this.currentItem=e,null===(t=this.callback)||void 0===t||t.call(this,Math.round(e/this.totalNumberOfItems*100),this.name)}incrementTotalNumberOfItems(){this.updateTotalNumberOfItems(this.totalNumberOfItems+1)}updateTotalNumberOfItems(e){this.totalNumberOfItems=e}finish(){this.currentItem<this.totalNumberOfItems&&this.progressTo(this.totalNumberOfItems)}manualReport(e){var t;null===(t=this.callback)||void 0===t||t.call(this,e,this.name)}}t.ProgressReporterStep=ProgressReporterStep},8925:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Reference=void 0;const a=r(194),o=r(2890),s=r(6555),l=r(9170);class Reference extends a.Serializable{truncate(){return o.CoreBuffer.fromUtf8(`${this.id.toString()}|${this.key.algorithm}|${this.key.secretKey.toBase64URL()}`).toBase64URL()}static fromTruncated(e){const t=o.CoreBuffer.fromBase64URL(e).toUtf8().split("|");if(3!==t.length)throw s.CoreErrors.general.invalidTruncatedReference();try{const e=l.CoreId.from(t[0]),r=parseInt(t[1]),n=t[2],i=o.CryptoSecretKey.from({algorithm:r,secretKey:o.CoreBuffer.fromBase64URL(n)});return this.from({id:l.CoreId.from(e),key:i})}catch(e){throw s.CoreErrors.general.invalidTruncatedReference()}}static validateId(e,t){if((null==e?void 0:e.id)&&!t.validate(e.id))throw new a.ValidationError(this.name,"id",`id must start with '${t.prefix}' but is '${e.id}'`)}static from(e){return"string"==typeof e?this.fromTruncated(e):this.fromAny(e)}}t.Reference=Reference,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreId)],Reference.prototype,"id",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],Reference.prototype,"key",void 0)},2685:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Transport=void 0;const i=r(2391),a=r(2890),o=n(r(6486)),s=r(2016),l=r(6555),c=r(981),u=r(1796),d=r(392);let p;class Transport{get config(){return this._config}constructor(e,t,r,n=new i.SimpleLoggerFactory){if(this.eventBus=r,this.databaseConnection=e,this._config=o.default.defaultsDeep({},t,Transport.defaultConfig),d.TransportLoggerFactory.init(n),p=d.TransportLoggerFactory.getLogger(Transport),!this._config.platformClientId)throw l.CoreErrors.general.platformClientIdNotSet().logWith(p);if(!this._config.platformClientSecret)throw l.CoreErrors.general.platformClientSecretNotSet().logWith(p);if(!this._config.baseUrl)throw l.CoreErrors.general.baseUrlNotSet().logWith(p);if(this._config.supportedDatawalletVersion<1)throw new u.TransportError("The given supported datawallet version is invalid. The value must be 1 or higher.");if(this._config.supportedIdentityVersion<1)throw new u.TransportError("The given supported identity version is invalid. The value must be 1 or higher.");if(3!==this._config.realm.length)throw l.CoreErrors.general.realmLength()}async init(){return p.trace("Initializing Libsodium..."),await a.SodiumWrapper.ready(),p.trace("Libsodium initialized"),p.info("Transport initialized"),this}async createDatabase(e){return await this.databaseConnection.getDatabase(e)}static get context(){return c.TransportContext.currentContext()}}t.Transport=Transport,Transport.defaultConfig={supportedDatawalletVersion:1,supportedIdentityVersion:-1,debug:!1,platformClientId:"",platformClientSecret:"",platformTimeout:6e4,platformMaxRedirects:10,platformMaxUnencryptedFileSize:10485760,baseUrl:"",realm:s.Realm.Prod,datawalletEnabled:!1,httpAgent:{keepAlive:!0,maxSockets:5,maxFreeSockets:2},httpsAgent:{keepAlive:!0,maxSockets:5,maxFreeSockets:2}}},981:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TransportContext=void 0,function(e){e.Web="Web",e.Cordova="Cordova",e.Node="Node"}(r||(t.TransportContext=r={})),function(e){let t;e.currentContext=function currentContext(){return t||(t=function _queryContext(){return"undefined"==typeof window?e.Node:window.isCordovaApp?e.Cordova:e.Web}()),t}}(r||(t.TransportContext=r={}))},2508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportController=t.ControllerName=void 0;const n=r(1796),i=r(392);var a;!function(e){e.Account="Account",e.Attribute="Attribute",e.Certificate="Certificate",e.CertificateIssuer="CertificateIssuer",e.CertificateValidator="CertificateValidator",e.Challenge="Challenge",e.Device="Device",e.Devices="Devices",e.DeviceSecret="DeviceSecret",e.File="File",e.Identity="Identity",e.Message="Message",e.Relationship="Relationship",e.Relationships="Relationships",e.RelationshipTemplate="RelationshipTemplate",e.RelationshipRequest="RelationshipRequest",e.RelationshipRequestor="RelationshipRequestor",e.RelationshipSecret="RelationshipSecret",e.RelationshipTemplator="RelationshipTemplator",e.Secret="Secret",e.Sync="Sync",e.Token="Token"}(a||(t.ControllerName=a={}));t.TransportController=class TransportController{get initialized(){return this._initialized}get log(){return this._log}get parent(){return this._parent}get config(){return this._parent.config}get db(){return this._parent.db}get transport(){return this._parent.transport}get controllerName(){return this._controllerName}get eventBus(){return this.transport.eventBus}constructor(e,t){var r;this._controllerName=e,this._parent=t,this._initialized=!1,this._dbClosed=!1;let n=e;this.config.debug&&(null===(r=this.parent.activeDeviceOrUndefined)||void 0===r?void 0:r.deviceOrUndefined)&&(n+=` of ${this.parent.activeDevice.device.id}`),this._log=i.TransportLoggerFactory.getLogger(n)}init(...e){if(this._initialized)throw new n.TransportError(`The controller ${this.controllerName} is already initialized.`);return this._initialized=!0,Promise.resolve(this)}parseArray(e,t){return e.map((e=>t.fromAny(e)))}newCacheEmptyError(e,t){return new n.TransportError(`The cache of ${e instanceof Function?e.name:e} with id "${t}" is empty.`)}}},1796:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportError=void 0;class TransportError extends Error{}t.TransportError=TransportError},8169:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportIds=void 0;const n=r(3289);class TransportIds{}t.TransportIds=TransportIds,TransportIds.generic=new n.CoreIdHelper(""),TransportIds.secret=new n.CoreIdHelper("TRPSEC"),TransportIds.relationshipSecret=new n.CoreIdHelper("TRPRSE"),TransportIds.relationshipTemplateKey=new n.CoreIdHelper("TRPRTK"),TransportIds.datawalletModification=new n.CoreIdHelper("TRPDWM")},392:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportLoggerFactory=void 0;const n=r(1796);t.TransportLoggerFactory=class TransportLoggerFactory{static init(e){this.instance=e}static getLogger(e){if(!this.isInitialized())throw new n.TransportError("The logger factory is not yet initialized. Call TransportLoggerFactory.init() first.");return"function"==typeof e?this.instance.getLogger(`Transport.${e.name}`):this.instance.getLogger(`Transport.${e}`)}static isInitialized(){return!!this.instance}}},9369:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AuthClient=void 0;const i=n(r(129)),a=r(1732),o=r(8892),s=r(8990),l=r(8103);class AuthClient extends l.RESTClient{async authenticate(e){var t;const r="/connect/token";let n;try{n=await this.createAxios().post(r,i.default.stringify({client_id:e.clientId,client_secret:e.clientSecret,grant_type:e.grantType,username:e.username,password:e.password}))}catch(e){const n=new s.RequestError("post",r,void 0,"error.transport.request.noAuthPossible","Authentication was not possible. Is the service up and running?"+(e.message?` Root cause: '${e.message}'`:""),"",null===(t=e.response)||void 0===t?void 0:t.status).setObject(e.isAxiosError?s.RequestError.cleanAxiosError(e):e);return o.ClientResult.fail(n)}const l={requestTime:n.headers["x-request-time"],responseDuration:n.headers["x-response-duration-ms"],responseTime:n.headers["x-response-time"],traceId:n.headers["x-trace-id"]};if(200!==n.status)return o.ClientResult.fail(new s.RequestError("post",r,l,"error.transport.request.noAuthGrant","Backbone did not grant authentication. Are the credentials correct?","",n.status).setObject(n.data.error));const c=n.data;return o.ClientResult.ok({expiry:a.CoreDate.utc().add({seconds:parseInt(c.expires_in)}),token:c.access_token})}}t.AuthClient=AuthClient},4381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Authenticator=void 0;const n=r(9369);t.Authenticator=class Authenticator{constructor(e){this.accountController=e,this.authClient=new n.AuthClient(e.config)}async getToken(){return this.token&&!this.isExpired()||await this.authenticate(),this.token}debugLog(e){var t;e.error("Current token is: ",this.token),e.error("Expiry is: ",null===(t=this.expiry)||void 0===t?void 0:t.toISOString())}clear(){this.token=void 0,this.expiry=void 0}isExpired(){if(!this.expiry)return!0;return this.expiry.subtract({seconds:10}).isExpired()}async authenticate(){if(this.request)return await this.request;this.clear(),this.request=this.authenticateInternal();try{await this.request}finally{this.request=void 0}}async authenticateInternal(){const e=await this.accountController.activeDevice.getCredentials(),t={grantType:"password",clientId:this.accountController.config.platformClientId,clientSecret:this.accountController.config.platformClientSecret,username:e.username,password:e.password},r=await this.authClient.authenticate(t);this.token=r.value.token,this.expiry=r.value.expiry}}},9867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BackboneIds=void 0;const n=r(3289);class BackboneIds{}t.BackboneIds=BackboneIds,BackboneIds.file=new n.CoreIdHelper("FIL",!0),BackboneIds.relationship=new n.CoreIdHelper("REL",!0),BackboneIds.message=new n.CoreIdHelper("MSG",!0),BackboneIds.relationshipTemplate=new n.CoreIdHelper("RLT",!0),BackboneIds.token=new n.CoreIdHelper("TOK",!0),BackboneIds.relationshipChange=new n.CoreIdHelper("RCH",!0),BackboneIds.device=new n.CoreIdHelper("DVC",!0)},8892:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientResult=void 0;const n=r(1796),i=r(4062);class ClientResult{constructor(e,t,r,a){if(e&&r)throw new n.TransportError("InvalidOperation: A result cannot be successful and contain an error");if(!e&&!r)throw new n.TransportError("InvalidOperation: A failing result needs to contain an error");if(void 0!==t&&!e)throw new n.TransportError("InvalidOperation: A value is only useful in case of a success.");this._value=t,this._isSuccess=e,this._error=r,a&&(this.requestTime=a.requestTime?i.CoreDate.from(a.requestTime):void 0,this.responseDuration=a.responseDuration?parseInt(a.responseDuration):void 0,this.responseTime=a.responseTime?i.CoreDate.from(a.responseTime):void 0,this.traceId=a.traceId)}get isSuccess(){return this._isSuccess}get isError(){return!this._isSuccess}get error(){if(this._isSuccess)throw new n.TransportError("Can't get the error of an succeeded result. Use 'value' instead.");return this._error}get value(){if(!this._isSuccess)throw this.error;return this._value}static fail(e,t){return new ClientResult(!1,void 0,e,t)}static ok(e,t){return new ClientResult(!0,e,void 0,t)}}t.ClientResult=ClientResult},4765:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Paginator=void 0;class Paginator{constructor(e,t,r,n){this.currentPage=e,this.paginationProperties=t,this.dataSource=r,this.progessCallback=n,this.currentItemIndex=0,this.processedItemCount=0,n&&n(0)}hasNext(){return this.hasNextPage()||this.currentItemIndex<this.currentPage.length}async next(){return this.currentItemIndex>=this.currentPage.length&&this.hasNextPage()&&(this.currentItemIndex=0,this.currentPage=await this.nextPage()),this.processedItemCount++,this.sendProgess(),this.currentPage[this.currentItemIndex++]}sendProgess(){if(this.progessCallback)return this.processedItemCount===this.paginationProperties.totalRecords?this.progessCallback(100):void(this.processedItemCount%10==0&&this.progessCallback(Math.round(this.processedItemCount/this.paginationProperties.totalRecords*100)))}hasNextPage(){return this.paginationProperties.pageNumber<this.paginationProperties.totalPages}async nextPage(){this.paginationProperties.pageNumber++;return await this.dataSource.getPage(this.paginationProperties.pageNumber)}async collect(){var e,t;const r=this.currentPage;for(null===(e=this.progessCallback)||void 0===e||e.call(this,this.pagePercentage);this.hasNextPage();)r.push(...await this.nextPage()),null===(t=this.progessCallback)||void 0===t||t.call(this,this.pagePercentage);return r}[Symbol.asyncIterator](){return{next:async()=>this.hasNext()?{value:await this.next(),done:!1}:{value:void 0,done:!0}}}get pagePercentage(){return Math.round(this.paginationProperties.pageNumber/this.paginationProperties.totalPages*100)}get totalRecords(){return this.paginationProperties.totalRecords}}t.Paginator=Paginator},8103:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=t.RESTClientLogDirective=t.RestPaginationDataSource=void 0;const i=r(2890),a=n(r(7218)),o=n(r(6230)),s=n(r(6486)),l=r(392),c=r(1732),u=r(8892),d=r(4765),p=r(8990);class RestPaginationDataSource{constructor(e,t,r){this.client=e,this.path=t,this.args=r}async getPage(e){return this.args.pageNumber=e,(await this.client.get(this.path,this.args)).value}}var h;t.RestPaginationDataSource=RestPaginationDataSource,function(e){e[e.LogNone=0]="LogNone",e[e.LogRequest=1]="LogRequest",e[e.LogResponse=2]="LogResponse",e[e.LogAll=3]="LogAll"}(h||(t.RESTClientLogDirective=h={}));class RESTClient{logRequest(){return this._logDirective===h.LogRequest||this._logDirective===h.LogAll}logResponse(){return this._logDirective===h.LogResponse||this._logDirective===h.LogAll}async generateRequestId(){return(await c.CoreId.generate("HTTP")).toString()}constructor(e,t={}){var n,i;this.config=e,this.requestConfig=t,this._logDirective=h.LogAll;const a={baseURL:e.baseUrl,timeout:this.config.platformTimeout,maxRedirects:this.config.platformMaxRedirects,maxContentLength:1/0,maxBodyLength:1/0,validateStatus:e=>e<300||400===e||404===e||500===e,paramsSerializer:{dots:!0,indexes:null}};this.config.platformAdditionalHeaders&&(a.headers=s.default.defaultsDeep({},a.headers,this.config.platformAdditionalHeaders));try{const e=null===(n=r(2890))||void 0===n?void 0:n.Agent,t=null===(i=r(2890))||void 0===i?void 0:i.Agent;void 0!==e&&void 0!==t&&(a.httpAgent=new e(this.config.httpAgent),a.httpsAgent=new t(this.config.httpsAgent))}catch(e){}this.requestConfig=s.default.defaultsDeep(this.requestConfig,a),this._logger=l.TransportLoggerFactory.getLogger(RESTClient)}createAxios(){const e=a.default.create(this.requestConfig);return this.config.debug&&this.addAxiosLoggingInterceptors(e),e}addAxiosLoggingInterceptors(e){e.interceptors.request.use((e=>{const t=e;return t.meta=e.meta||{},t.meta.startTime=(new Date).getTime(),e})),e.interceptors.response.use((e=>(logResponseTime(e),e)));const logResponseTime=e=>{const t=e.config.meta.startTime,r=e.headers["x-response-duration-ms"]?Number.parseInt(e.headers["x-response-duration-ms"]):void 0,n=`${e.config.method.toUpperCase()} ${e.request.path} (backbone call): ${r?`${r}ms`:"unknown"}`;r&&r>200?this._logger.warn(n):this._logger.debug(n);const i=(new Date).getTime()-t,a=r?i-r:void 0,o=`${e.config.method.toUpperCase()} ${e.request.path} (latency): ${a}ms`;this._logger.debug(o),this._logger.debug(`${e.config.method.toUpperCase()} ${e.request.path} (backbone call + latency): ${i}ms`)}}getResult(e,t,r,n){var a,o,s;const l=this.extractPlatformParameters(r);if(this._logResponse(r,l,n,e,t),400===r.status&&!(null===(a=r.data)||void 0===a?void 0:a.error)&&"application/json; charset=utf-8"===r.headers["content-type"])try{const e=i.CoreBuffer.from(r.data).toUtf8();r.data=JSON.parse(e)}catch(e){}if(null===(o=r.data)||void 0===o?void 0:o.error){const n=r.data.error,i=new p.RequestError(e,t,l,n.code,n.message,n.docs,r.status,n.time,{id:n.id,details:n.details});return this._logger.debug(i),u.ClientResult.fail(i,l)}if(204===r.status)return u.ClientResult.ok({},l);if(404===r.status){const r=new p.RequestError(e,t,l,"error.transport.request.notFound","An http request returned an unspecific 404 (Not Found) error, which is usually the case if the Backbone is not reachable. This could be a temporary problem, or a network, gateway, firewall or configuration issue.","",404);return this._logger.debug(r),u.ClientResult.fail(r,l)}if(r.status>=400&&r.status<=499){const n=new p.RequestError(e,t,l,"error.transport.request.badRequest","The platform responded with a Bad Request without giving any specific reason.","",r.status).setObject(r.data);return this._logger.debug(n),u.ClientResult.fail(n,l)}if("function"==typeof Buffer&&r.data instanceof Buffer||r.data instanceof ArrayBuffer)return u.ClientResult.ok(r.data,l);if(!(null===(s=r.data)||void 0===s?void 0:s.result)){const n=new p.RequestError(e,t,l,"error.transport.request.resultUndefined","The Platform responded without a result.").setObject(r.data);return this._logger.debug(n),u.ClientResult.fail(n,l)}return u.ClientResult.ok(r.data.result,l)}getPaginator(e,t,r,n,i){var a,o;const s=this.extractPlatformParameters(t);if(this._logResponse(t,s,r,"GET",e),null===(a=t.data)||void 0===a?void 0:a.error){const r=t.data.error,n=new p.RequestError("GET",e,s,r.code,r.message,r.docs,t.status,r.time,{id:r.id,details:r.details});return this._logger.debug(n),u.ClientResult.fail(n,s)}if(t.status>=400&&t.status<=499){const r=new p.RequestError("GET",e,s,"error.transport.request.badRequest","The platform responded with a Bad Request without giving any specific reason.","",t.status).setObject(t.data);return this._logger.debug(r),u.ClientResult.fail(r,s)}if(!(null===(o=t.data)||void 0===o?void 0:o.result)){const r=new p.RequestError("GET",e,s,"error.transport.request.resultUndefined","The Platform responded without a result.").setObject(t.data);return this._logger.debug(r),u.ClientResult.fail(r,s)}t.data.pagination||(t.data.pagination={pageNumber:1,pageSize:t.data.result.length,totalPages:1,totalRecords:t.data.result.length});const l=new RestPaginationDataSource(this,e,n),c=new d.Paginator(t.data.result,t.data.pagination,l,i);return u.ClientResult.ok(c,s)}async get(e,t={},r){const n=await this.generateRequestId(),i=s.default.defaultsDeep({params:t},r,this.requestConfig);if(this.logRequest()){const t=this;t._username?this._logger.trace(`Request ${n} by ${t._username}: GET ${e}`):this._logger.trace(`Request ${n}: GET ${e}`)}try{const t=await this.createAxios().get(e,i);return this.getResult("GET",e,t,n)}catch(t){const r=p.RequestError.fromAxiosError("GET",e,t,n);return this._logger.debug(r),u.ClientResult.fail(r)}}async getPaged(e,t={},r,n){const i=await this.generateRequestId(),a=s.default.defaultsDeep({params:t},r,this.requestConfig);try{const r=await this.createAxios().get(e,a);return this.getPaginator(e,r,i,t,n)}catch(t){const r=p.RequestError.fromAxiosError("GET",e,t,i);return this._logger.debug(r),u.ClientResult.fail(r)}}async post(e,t,r={},n){const i=await this.generateRequestId(),a=s.default.defaultsDeep({params:r},n,this.requestConfig);if(this.logRequest()){const r=this;r._username?this._logger.trace(`Request ${i} by ${r._username}: POST ${e}`,t):this._logger.trace(`Request ${i}: POST ${e}`,t)}try{const r=await this.createAxios().post(e,t,a);return this.getResult("POST",e,r,i)}catch(t){const r=p.RequestError.fromAxiosError("POST",e,t,i);return this._logger.debug(r),u.ClientResult.fail(r)}}async postMultipart(e,t,r){const n=await this.generateRequestId(),i=new o.default;for(const e in t)if(t.hasOwnProperty(e))if("content"===e.toLowerCase()){const r=t[e],n="undefined"!=typeof Buffer?Buffer.from(r):new Blob([r]);i.append(e,n,{filename:"cipher.bin"})}else i.append(e,t[e]);const a=s.default.defaultsDeep({},r,this.requestConfig);let l=i;if(void 0!==i.getHeaders){const e=i.getHeaders();a.headers=a.headers||{};for(const t in e)a.headers[t]=e[t];l=i.getBuffer()}if(this.logRequest()){const t=this;t._username?this._logger.trace(`Request ${n} by ${t._username}: POST-Upload ${e}`):this._logger.trace(`Request ${n}: POST-Upload ${e}`)}try{const t=await this.createAxios().post(e,l,a);return this.getResult("POST-Upload",e,t,n)}catch(t){const r=p.RequestError.fromAxiosError("POST-Upload",e,t,n);return this._logger.debug(r),u.ClientResult.fail(r)}}async put(e,t,r){const n=await this.generateRequestId(),i=s.default.defaultsDeep({},r,this.requestConfig);if(this.logRequest()){const r=this;r._username?this._logger.trace(`Request ${n} by ${r._username}: PUT ${e}`,t):this._logger.trace(`Request ${n}: PUT ${e}`,t)}try{const r=await this.createAxios().put(e,t,i);return this.getResult("PUT",e,r,n)}catch(t){const r=p.RequestError.fromAxiosError("PUT",e,t,n);return this._logger.debug(r),u.ClientResult.fail(r)}}async delete(e,t){const r=await this.generateRequestId(),n=s.default.defaultsDeep({},t,this.requestConfig);if(this.logRequest()){const t=this;t._username?this._logger.trace(`Request ${r} by ${t._username}: DELETE ${e}`):this._logger.trace(`Request ${r}: DELETE ${e}`)}try{const t=await this.createAxios().delete(e,n);return this.getResult("DELETE",e,t,r)}catch(t){const n=p.RequestError.fromAxiosError("DELETE",e,t,r);return this._logger.debug(n),u.ClientResult.fail(n)}}async download(e,t){const r=await this.generateRequestId(),n=s.default.defaultsDeep({},t,this.requestConfig);if(n.responseType="arraybuffer",this.logRequest()){const t=this;t._username?this._logger.trace(`Request ${r} by ${t._username}: GET-Download ${e}`):this._logger.trace(`Request ${r}: GET-Download ${e}`)}try{const t=await this.createAxios().get(e,n),i=this.extractPlatformParameters(t);return this._logResponse(t,i,r,"GET-Download",e),u.ClientResult.ok(t.data,this.extractPlatformParameters(t))}catch(t){const n=p.RequestError.fromAxiosError("GET-Download",e,t,r);return this._logger.debug(n),u.ClientResult.fail(n)}}extractPlatformParameters(e){return{requestTime:e.headers["x-request-time"],responseDuration:e.headers["x-response-duration-ms"],responseTime:e.headers["x-response-time"],traceId:e.headers["x-trace-id"]}}_logResponse(e,t,r,n,i){if(e.data&&this.logResponse()){const a=`Response ${r}: ${n} ${i} | TraceId: '${t.traceId}' | PlatformDuration: ${t.responseDuration}`;try{this._logger.trace(a,JSON.stringify(e.data,void 0,2))}catch(e){this._logger.trace(a)}}}}t.RESTClient=RESTClient},6054:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClientAuthenticate=void 0;const i=n(r(6486)),a=r(8892),o=r(8990),s=r(8103);class RESTClientAuthenticate extends s.RESTClient{constructor(e,t,r={}){super(e,r),this.authenticator=t}async runAuthenticated(e){const t=await this.authenticator.getToken(),r=await e(t);if(!r.isError)return r;if(r.error instanceof o.RequestError&&401===r.error.status){this._logger.error("401 Authorization Error: ",r.error.message),this.authenticator.debugLog(this._logger),this.authenticator.clear();const t=await this.authenticator.getToken();return await e(t)}return a.ClientResult.fail(r.error)}async get(e,t="",r={}){return await this.runAuthenticated((async n=>await super.get(e,t,this.buildAuthenticatedConfig(n,r))))}async getPaged(e,t={},r={},n){return await this.runAuthenticated((async i=>await super.getPaged(e,t,this.buildAuthenticatedConfig(i,r),n)))}async post(e,t,r={},n={}){return await this.runAuthenticated((async i=>await super.post(e,t,r,this.buildAuthenticatedConfig(i,n))))}async postMultipart(e,t,r={}){return await this.runAuthenticated((async n=>await super.postMultipart(e,t,this.buildAuthenticatedConfig(n,r))))}async put(e,t,r={}){return await this.runAuthenticated((async n=>await super.put(e,t,this.buildAuthenticatedConfig(n,r))))}async delete(e,t={}){return await this.runAuthenticated((async r=>await super.delete(e,this.buildAuthenticatedConfig(r,t))))}async download(e,t={}){return await this.runAuthenticated((async r=>await super.download(e,this.buildAuthenticatedConfig(r,t))))}buildAuthenticatedConfig(e,t){return i.default.defaultsDeep({headers:{Authorization:`Bearer ${e}`}},t)}}t.RESTClientAuthenticate=RESTClientAuthenticate},8990:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RequestError=void 0;const i=r(5172),a=n(r(4530)),o=r(4062);class RequestError extends i.ApplicationError{constructor(e,t,r,n="error.platform.unexpected",i="Platform operation failed unexpectedly.",a="",s=500,l=o.CoreDate.utc().toISOString(),c){super(n,""),this.method=e,this.path=t,this.platformParameters=r,this.reason=i,this.requestId=a,this.status=s,this.time=l,this.object=c;let u=n;s&&(u+=` (${s})`),i&&(u+=`: '${i}'`),u+=` for ${e} ${t}`,l&&(u+=` at ${l}`),r&&(u+=` with traceId '${r.traceId}'`),super.message=u}setObject(e){return this.object=e,this}toString(){return`${this.name}\n${(0,a.default)(this.object)}\n${this.stack}`}static cleanAxiosError(e){const t=e.toJSON();return delete t.config.adapter,delete t.config.data,delete t.config.headers.Authorization,delete t.config.httpAgent,delete t.config.httpsAgent,delete t.config.transformRequest,delete t.config.transformResponse,delete t.config.validateStatus,delete t.request,delete t.response,t}static fromAxiosError(e,t,r,n,i){try{if(!r.isAxiosError){const n=new RequestError(e,t,i,"error.transport.request.unknown",r.message);return n.stack=r.stack,n}if(!r.response){let n="error.transport.request.unknown",a=500,o=r.message;switch(r.code){case"ERR_FR_MAX_BODY_LENGTH_EXCEEDED":n="error.transport.request.bodyLengthExceeded",a=413;break;case"ECONNABORTED":n="error.transport.request.aborted";break;default:"Network Error"===r.message?(n="error.transport.request.network",o="It seems the platform was available but another network error happened. It could also be a CORS problem."):r.message.includes("ENOTFOUND")&&(n="error.transport.request.addressNotFound")}return new RequestError(e,t,i,n,o,"",a).setObject(this.cleanAxiosError(r))}return 401===r.response.status?new RequestError(e,t,i,"error.platform.unauthorized","Unauthorized.",n,r.response.status).setObject(this.cleanAxiosError(r)):new RequestError(e,t,i,"error.platform.unexpected","Received invalid error content from platform. Contact the platform team.",n,r.response.status).setObject(this.cleanAxiosError(r))}catch(r){return new RequestError(e,t,i,"error.platform.unexpected","An error occured while handling an axios error",n).setObject(r)}}}t.RequestError=RequestError},6699:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4381),t),i(r(9867),t),i(r(8892),t),i(r(4765),t),i(r(8990),t),i(r(8103),t),i(r(6054),t)},2027:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(6699),t),i(r(4093),t),i(r(8147),t),i(r(6555),t),i(r(3289),t),i(r(6904),t),i(r(2970),t),i(r(6564),t),i(r(1341),t),i(r(5796),t),i(r(1201),t),i(r(8925),t),i(r(2685),t),i(r(981),t),i(r(2508),t),i(r(1796),t),i(r(8169),t),i(r(392),t),i(r(1732),t)},7875:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreAddress=void 0;const a=r(194),o=r(6904);let s=class CoreAddress extends o.CoreSerializable{static preFrom(e){return"string"==typeof e?{address:e}:e}static from(e){return this.fromAny(e)}equals(e){return void 0!==e&&this.address===e.toString()}toString(){return this.address}serialize(){return this.address}};t.CoreAddress=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"address",void 0),t.CoreAddress=s=n([(0,a.type)("CoreAddress"),(0,a.serializeOnly)("address","string")],s)},4062:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreDate=void 0;const o=r(194),s=r(8565),l=r(6904),c=r(1796);let u=n=class CoreDate extends l.CoreSerializable{get dateTime(){return this._dateTime}get date(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISODate()}constructor(e=s.DateTime.utc()){super(),this._dateTime=e}static utc(){return new n(s.DateTime.utc())}static local(){return new n(s.DateTime.local())}equals(e){return this.dateTime.equals(e.dateTime)}add(e){return new n(this.dateTime.plus(e))}subtract(e){return new n(this.dateTime.minus(e))}startOf(e){return new n(this.dateTime.startOf(e))}endOf(e){return new n(this.dateTime.endOf(e))}format(e){return this.dateTime.toFormat(e)}isWithin(e,t,r,i){void 0===t&&(t=e),void 0===r&&(r=n.utc());const a=r.subtract(e),o=r.add(t);return void 0!==i?this.dateTime.startOf(i)>a.dateTime.startOf(i)&&this.dateTime.startOf(i)<o.dateTime.startOf(i):this.dateTime>a.dateTime&&this.dateTime<o.dateTime}isBefore(e,t){return void 0!==t?this.dateTime.startOf(t)<e.dateTime.startOf(t):this.dateTime<e.dateTime}isAfter(e,t){return void 0!==t?this.dateTime.startOf(t)>e.dateTime.startOf(t):this.dateTime>e.dateTime}isSame(e,t){return void 0!==t?this.dateTime.startOf(t).valueOf()===e.dateTime.startOf(t).valueOf():this.dateTime.valueOf()===e.dateTime.valueOf()}isSameOrAfter(e,t){return void 0!==t?this.dateTime.startOf(t)>=e.dateTime.startOf(t):this.dateTime>=e.dateTime}isSameOrBefore(e,t){return void 0!==t?this.dateTime.startOf(t)<=e.dateTime.startOf(t):this.dateTime<=e.dateTime}isBetween(e,t,r){return t?s.Interval.fromDateTimes(e.dateTime,t.dateTime).contains(this.dateTime):this.isAfter(e,r)}isExpired(){return this.isSameOrBefore(n.utc())}compare(e){return this.dateTime.valueOf()-e.dateTime.valueOf()}toString(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISO()}toISOString(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISO()}toLocaleString(){return this.dateTime.toLocaleString()}toJSON(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISO()}serialize(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISO()}static preFrom(e){if(void 0===e)throw new c.TransportError("The provided object is undefined and cannot be deserialized.");if("object"==typeof e){if(void 0===e.date){if("function"!=typeof e.toISOString)throw new c.TransportError("The provided object doesn't have an 'toISOString' string method.");const t=e.toISOString();return s.DateTime.fromISO(t,{zone:"utc"})}return s.DateTime.fromISO(e.date,{zone:"utc"})}if("number"==typeof e)return s.DateTime.fromMillis(e);if("string"==typeof e)return s.DateTime.fromISO(e,{zone:"utc"}).toUTC();throw new c.TransportError("The provided object is invalid cannot be deserialized.")}static from(e){return this.fromAny(e)}};t.CoreDate=u,t.CoreDate=u=n=i([(0,o.type)("CoreDate"),a("design:paramtypes",[s.DateTime])],u)},2186:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreHash=void 0;const o=r(194),s=r(2890),l=r(6904);let c=n=class CoreHash extends l.CoreSerializable{toString(){return this.hash}static async hash(e,t=2){const r=await s.CryptoHash.hash(s.CoreBuffer.fromString(e,s.Encoding.Base64_UrlSafe_NoPadding),t);return n.from(r.toBase64())}async verify(e,t=2){return await s.CryptoHash.verify(e,s.CoreBuffer.fromString(this.hash,s.Encoding.Base64_UrlSafe_NoPadding),t)}static preFrom(e){return"string"==typeof e?{hash:e}:e}static from(e){return this.fromAny(e)}serialize(){return this.hash}toBase64(){return this.hash}};t.CoreHash=c,i([(0,o.validate)(),(0,o.serialize)(),a("design:type",String)],c.prototype,"hash",void 0),t.CoreHash=c=n=i([(0,o.serializeOnly)("hash","string")],c)},9170:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreId=void 0;const a=r(194),o=r(5833),s=r(6904),l=r(1796);let c=class CoreId extends s.CoreSerializable{toString(){return this.id}equals(e){return this.id===e.toString()}static async generate(e=""){if(e.length>6)throw new l.TransportError(`The prefix "${e}" is too long. It must not be longer than 6 characters.`);const t=await o.Random.string(20-e.length,o.RandomCharacterRange.Alphanumeric);return this.from(e.toUpperCase()+t)}static from(e){return this.fromAny(e)}static preFrom(e){return"string"==typeof e?{id:e}:e}serialize(){return this.id}};t.CoreId=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"id",void 0),t.CoreId=c=n([(0,a.type)("CoreId"),(0,a.serializeOnly)("id","string")],c)},819:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TransportVersion=void 0,function(e){e.Latest="1",e.V1="1"}(r||(t.TransportVersion=r={}))},1732:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7875),t),i(r(4062),t),i(r(2186),t),i(r(9170),t),i(r(819),t)},9391:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageDeliveredEvent=void 0;const n=r(2278);class MessageDeliveredEvent extends n.TransportDataEvent{constructor(e,t){super(MessageDeliveredEvent.namespace,e,t)}}t.MessageDeliveredEvent=MessageDeliveredEvent,MessageDeliveredEvent.namespace="transport.messageDelivered"},9461:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageReceivedEvent=void 0;const n=r(2278);class MessageReceivedEvent extends n.TransportDataEvent{constructor(e,t){super(MessageReceivedEvent.namespace,e,t)}}t.MessageReceivedEvent=MessageReceivedEvent,MessageReceivedEvent.namespace="transport.messageReceived"},9771:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageSentEvent=void 0;const n=r(2278);class MessageSentEvent extends n.TransportDataEvent{constructor(e,t){super(MessageSentEvent.namespace,e,t)}}t.MessageSentEvent=MessageSentEvent,MessageSentEvent.namespace="transport.messageSent"},8e3:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PeerRelationshipTemplateLoadedEvent=void 0;const n=r(2278);class PeerRelationshipTemplateLoadedEvent extends n.TransportDataEvent{constructor(e,t){super(PeerRelationshipTemplateLoadedEvent.namespace,e,t)}}t.PeerRelationshipTemplateLoadedEvent=PeerRelationshipTemplateLoadedEvent,PeerRelationshipTemplateLoadedEvent.namespace="transport.peerRelationshipTemplateLoaded"},9697:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangedEvent=void 0;const n=r(2278);class RelationshipChangedEvent extends n.TransportDataEvent{constructor(e,t){super(RelationshipChangedEvent.namespace,e,t)}}t.RelationshipChangedEvent=RelationshipChangedEvent,RelationshipChangedEvent.namespace="transport.relationshipChanged"},2278:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportDataEvent=void 0;const n=r(5172);class TransportDataEvent extends n.DataEvent{constructor(e,t,r){super(e,r),this.eventTargetAddress=t}}t.TransportDataEvent=TransportDataEvent},2205:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(9391),t),i(r(9461),t),i(r(9771),t),i(r(8e3),t),i(r(9697),t),i(r(2278),t)},5590:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(2500),t),i(r(2027),t),i(r(2205),t),i(r(9662),t),i(r(2212),t)},7024:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.AccountController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(4093),c=r(369),u=r(392),d=r(4381),p=r(2212),h=r(1615),y=r(2723),g=r(8324),m=r(9626),v=r(7896),b=r(2556),w=r(4980),C=r(8382),S=r(6961),_=r(6453),R=r(413),O=r(6758),T=r(9777),I=r(5832),E=r(2343),D=r(3654),P=r(3666),A=r(5739),j=r(307),M=r(1295),x=r(26),k=r(4503),L=r(6346),F=r(761),N=r(5366),z=r(2016);class AccountController{get authenticator(){return this._authenticator}get log(){return this._log}get config(){return this._config}get db(){return this._db}get transport(){return this._transport}get activeDevice(){if(!this._activeDevice)throw new s.TransportError("The DeviceController is not initialized yet.");return this._activeDevice}get activeDeviceOrUndefined(){return this._activeDevice}get identity(){return this._identity}constructor(e,t,r,n={}){this._transport=e,this._db=t,this._config=r,this.dependencyOverrides=n,this._dbClosed=!1,this.autoSync=!0,this._authenticator=new d.Authenticator(this),this._log=u.TransportLoggerFactory.getLogger(s.ControllerName.Account)}async init(e){this.info=await this.db.getMap("AccountInfo"),this.unpushedDatawalletModifications=await this.db.getCollection(c.DbCollectionName.UnpushedDatawalletModifications),this.deviceClient=new S.DeviceClient(this.config),this.identityClient=new N.IdentityClient(this.config),this._identity=new L.IdentityController(this),this._activeDevice=new v.DeviceController(this),this.challenges=await new m.ChallengeController(this).init();const[t,r,n]=await Promise.all([this.info.get("identity"),this.info.get("device"),this.info.get("baseKey")]);let i,a=!1,l=!1;if(t||r){if(e||!t||!r)throw new s.TransportError("The combination of deviceSharedSecret, existing identity or device is not allowed.");{if(!n)throw s.CoreErrors.secrets.secretNotFound("BaseKey");const e=z.Identity.from(t),i=_.Device.from(r),a=o.CryptoSecretKey.fromJSON(n);await this.identity.init(e),await this.activeDevice.init(a,i),this.deviceAuthClient=new C.DeviceAuthClient(this.config,this.authenticator)}}else if(e)i=await this.onboardDevice(e),l=!0;else{this._log.trace("No account information found. Creating new account...");a=!0,i=(await this.createIdentityAndDevice()).device,this.deviceAuthClient=new C.DeviceAuthClient(this.config,this.authenticator)}return this._log.trace(`Using device ${this.activeDevice.id} for identity ${this.identity.address}.`),await this.initControllers(),a?(await this.devices.addExistingDevice(i),await this.synchronization.setInititalDatawalletVersion(this._config.supportedDatawalletVersion)):l&&(await this.syncDatawallet(),await this.devices.update(i)),await this.syncDatawallet(),this}async close(){this._dbClosed||(this._log.trace(`Closing DB for account ${this.identity.identity.address.toString()}.`),await this._db.close(),this._dbClosed=!0)}async initControllers(){this._log.trace("Initializing controllers..."),this.relationshipSecrets=await new D.RelationshipSecretController(this).init(),this.devices=await new w.DevicesController(this).init(),this.certificates=await new h.CertificateController(this).init(),this.certificateIssuer=await new y.CertificateIssuer(this).init(),this.certificateValidator=await new g.CertificateValidator(this).init(),this.files=await new T.FileController(this).init(),this.relationships=await new P.RelationshipsController(this,this.relationshipSecrets).init(),this.relationshipTemplates=await new E.RelationshipTemplateController(this,this.relationshipSecrets).init(),this.messages=await new I.MessageController(this).init(),this.tokens=await new k.TokenController(this).init(),this.synchronization=await new M.SyncController(this,this.dependencyOverrides,this.unpushedDatawalletModifications,this.config.datawalletEnabled).init(),this._log.trace("Initialization of controllers finished.")}disableAutoSync(){this.autoSync=!1}async enableAutoSync(){this.autoSync=!0,await this.syncDatawallet()}async syncDatawallet(e=!1,t){if(!e&&!this.autoSync)return;const r=j.SyncProgressReporter.fromCallback(t);return await this.synchronization.sync("OnlyDatawallet",r)}async syncEverything(e){const t=j.SyncProgressReporter.fromCallback(e);return await this.synchronization.sync("Everything",t)}async getLastCompletedSyncTime(){return await this.synchronization.getLastCompletedSyncTime()}async getLastCompletedDatawalletSyncTime(){return await this.synchronization.getLastCompletedDatawalletSyncTime()}async createIdentityAndDevice(){const[e,t,r,n,i]=await Promise.all([l.CoreCrypto.generateSignatureKeypair(),p.PasswordGenerator.createStrongPassword(45,50),l.CoreCrypto.generateSignatureKeypair(),l.CoreCrypto.generateSecretKey(),l.CoreCrypto.generateSecretKey()]);this._log.trace("Created keys. Requesting challenge...");const a=await this.challenges.createAccountCreationChallenge(e);this._log.trace("Challenge signed. Creating device...");const[o,c,u,d]=await Promise.all([this.identityClient.createIdentity({devicePassword:t,identityPublicKey:e.publicKey.toBase64(),signedChallenge:a.toJSON(!1),clientId:this._config.platformClientId,clientSecret:this._config.platformClientSecret,identityVersion:this._config.supportedIdentityVersion}),l.CoreCrypto.generateSecretKey(),F.IdentityUtil.createAddress(e.publicKey,this._config.realm),this.fetchDeviceInfo()]);if(o.isError){if("error.platform.unauthorized"===o.error.code)throw s.CoreErrors.general.platformClientInvalid()}const h=o.value;if(this._log.trace(`Registered identity with address ${h.address}, device id is ${h.device.id}.`),!u.equals(h.address))throw new s.TransportError("The backbone address does not match the local address.");const y=z.Identity.from({address:s.CoreAddress.from(h.address),realm:this._config.realm,publicKey:e.publicKey}),g=s.CoreId.from(h.device.id),m=_.Device.from({createdAt:s.CoreDate.from(h.createdAt),createdByDevice:g,id:g,description:"",name:"Device 1",lastLoginAt:s.CoreDate.utc(),operatingSystem:d.operatingSystem,publicKey:r.publicKey,type:d.type,certificate:"",username:h.device.username,datawalletVersion:this._config.supportedDatawalletVersion});await this.identity.init(y),await this.activeDevice.init(i,m);const v=R.DeviceSecretCredentials.from({id:m.id,username:h.device.username,password:t});return await Promise.all([this.info.set("device",m.toJSON()),this.info.set("identity",y.toJSON()),this.info.set("baseKey",i.toJSON()),this.activeDevice.secrets.storeSecret(n,b.DeviceSecretType.SharedSecretBaseKey),this.activeDevice.secrets.storeSecret(c,b.DeviceSecretType.IdentitySynchronizationMaster),this.activeDevice.secrets.storeSecret(e.privateKey,b.DeviceSecretType.IdentitySignature),this.activeDevice.secrets.storeSecret(r.privateKey,b.DeviceSecretType.DeviceSignature),this.activeDevice.secrets.storeSecret(v,b.DeviceSecretType.DeviceCredentials)]),{identity:y,device:m}}async onboardDevice(e){this._log.trace("Onboarding device for existing identity...");const[t,r,n,i]=await Promise.all([p.PasswordGenerator.createStrongPassword(45,50),l.CoreCrypto.generateSignatureKeypair(),this.fetchDeviceInfo(),l.CoreCrypto.generateSecretKey()]),a=_.Device.from({id:e.id,name:e.name?e.name:"",description:e.description?e.name:"",lastLoginAt:s.CoreDate.utc(),createdAt:e.createdAt,createdByDevice:e.createdByDevice,operatingSystem:n.operatingSystem,type:n.type,publicKey:r.publicKey,username:e.username,initialPassword:void 0,isAdmin:!!e.identityPrivateKey});await this.identity.init(e.identity),await this.activeDevice.init(i,a);const o=R.DeviceSecretCredentials.from({id:e.id,username:e.username,password:e.password});return await Promise.all([this.info.set("device",a.toJSON()),this.info.set("identity",e.identity.toJSON()),this.info.set("baseKey",i.toJSON()),this.info.set(A.SecretController.secretNonceKey,1e6*e.deviceIndex),this.activeDevice.secrets.storeSecret(e.secretBaseKey,b.DeviceSecretType.SharedSecretBaseKey),this.activeDevice.secrets.storeSecret(e.synchronizationKey,b.DeviceSecretType.IdentitySynchronizationMaster),this.activeDevice.secrets.storeSecret(r.privateKey,b.DeviceSecretType.DeviceSignature),this.activeDevice.secrets.storeSecret(o,b.DeviceSecretType.DeviceCredentials)]),e.identityPrivateKey&&await this.activeDevice.secrets.storeSecret(e.identityPrivateKey,b.DeviceSecretType.IdentitySignature),this.deviceAuthClient=new C.DeviceAuthClient(this.config,this.authenticator),await this.activeDevice.changePassword(t),a}async registerPushNotificationToken(e){await this.deviceAuthClient.registerPushNotificationToken(e)}fetchDeviceInfo(){return Promise.resolve({operatingSystem:"",type:_.DeviceType.Unknown})}async getSynchronizedCollection(e){const t=await this.db.getCollection(e);return this.config.datawalletEnabled?new x.SynchronizedCollection(t,this.config.supportedDatawalletVersion,this.unpushedDatawalletModifications):new x.SynchronizedCollection(t,this.config.supportedDatawalletVersion)}}t.AccountController=AccountController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[O.DeviceSharedSecret]),i("design:returntype",Promise)],AccountController.prototype,"init",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",Promise)],AccountController.prototype,"createIdentityAndDevice",null)},6346:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(2556),c=r(2016);class IdentityController extends s.TransportController{get address(){return this._identity.address}get publicKey(){return this._identity.publicKey}get realm(){return this._identity.realm}get identity(){return this._identity}constructor(e){super(s.ControllerName.Identity,e)}async init(e){return await super.init(),this._identity=e,this}isMe(e){return this.address.equals(e)}async update(){await this.parent.info.set("identity",this.identity)}async sign(e){const t=await this.parent.activeDevice.secrets.loadSecret(l.DeviceSecretType.IdentitySignature);if(!(t&&t.secret instanceof o.CryptoSignaturePrivateKey))throw s.CoreErrors.secrets.secretNotFound(l.DeviceSecretType.IdentitySignature);const r=t.secret,n=await s.CoreCrypto.sign(e,r);return r.clear(),n}async verify(e,t){return await s.CoreCrypto.verify(e,t,this.publicKey)}}t.IdentityController=IdentityController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[c.Identity]),i("design:returntype",Promise)],IdentityController.prototype,"init",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[o.CoreBuffer]),i("design:returntype",Promise)],IdentityController.prototype,"sign",null)},761:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityUtil=void 0;const n=r(2890),i=r(2027);t.IdentityUtil=class IdentityUtil{static async createAddress(e,t){if(3!==t.length)throw i.CoreErrors.general.realmLength();const r=await n.CryptoHash.hash(e.publicKey,2),a=await n.CryptoHash.hash(r,1),o=new n.CoreBuffer(a.buffer.slice(0,20)),s=n.CoreBuffer.fromUtf8(t);s.append(o);const l=await n.CryptoHash.hash(s,2),c=await n.CryptoHash.hash(l,1),u=new n.CoreBuffer(c.buffer.slice(0,4)),d=o;d.append(u);const p=t+d.toBase58();return i.CoreAddress.from({address:p})}static async checkAddress(e,t,r="id1"){const i=e.toString(),a=i.substr(0,3);if(r&&a!==r)return!1;const o=i.substr(3),s=n.CoreBuffer.fromBase58(o).buffer,l=s.slice(0,s.byteLength-4),c=s.slice(s.byteLength-4,s.byteLength),u=n.CoreBuffer.fromUtf8(a);u.append(new n.CoreBuffer(l));const d=await n.CryptoHash.hash(u,2),p=await n.CryptoHash.hash(d,1);if(!new n.CoreBuffer(p.buffer.slice(0,4)).equals(new n.CoreBuffer(c)))return!1;if(t){const e=await n.CryptoHash.hash(t.publicKey,2);let r=await n.CryptoHash.hash(e,1);if(r=new n.CoreBuffer(r.buffer.slice(0,20)),!r.equals(new n.CoreBuffer(l)))return!1}return!0}}},5366:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityClient=void 0;const n=r(2027);class IdentityClient extends n.RESTClient{constructor(){super(...arguments),this._logDirective=n.RESTClientLogDirective.LogResponse}async createIdentity(e){return await this.post("/api/v1/Identities",e,{})}}t.IdentityClient=IdentityClient},2016:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=t.Realm=void 0;const a=r(194),o=r(2890),s=r(6904),l=r(7875);var c;!function(e){e.Dev="dev",e.Stage="id0",e.Prod="id1"}(c||(t.Realm=c={}));let u=class Identity extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.Identity=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreAddress)],u.prototype,"address",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignaturePublicKey)],u.prototype,"publicKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],u.prototype,"realm",void 0),t.Identity=u=n([(0,a.type)("Identity")],u)},1615:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateController=void 0;const n=r(2027);class CertificateController extends n.TransportController{constructor(e){super(n.ControllerName.Certificate,e)}}t.CertificateController=CertificateController},2723:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateContentParam=t.CertificateIssuer=void 0;const n=r(2890),i=r(2027),a=r(369),o=r(365),s=r(4507);class CertificateIssuer extends i.TransportController{constructor(e){super(i.ControllerName.CertificateIssuer,e)}async init(){return await super.init(),this.certificatesIssued=await this.db.getCollection(a.DbCollectionName.CertificatesIssued),this}async issueCertificate(e){const t=s.CertificateContent.from(e).serialize(),r=n.CoreBuffer.fromUtf8(t),i=await this.parent.identity.sign(r);return o.Certificate.from({content:t,signature:i})}}t.CertificateIssuer=CertificateIssuer;t.CertificateContentParam=class CertificateContentParam{constructor(){this.issuedAt=i.CoreDate.utc()}}},8324:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateValidator=void 0;const n=r(2027);class CertificateValidator extends n.TransportController{constructor(e){super(n.ControllerName.CertificateValidator,e)}}t.CertificateValidator=CertificateValidator},365:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Certificate=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class Certificate extends s.CoreSerializable{static from(e){return this.fromAny(e)}async verify(e){const t=o.CoreBuffer.fromUtf8(this.content);return await s.CoreCrypto.verify(t,this.signature,e)}};t.Certificate=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"signature",void 0),t.Certificate=l=n([(0,a.type)("Certificate")],l)},8951:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateConstraint=void 0;const i=r(194),a=r(2027);let o=class CertificateConstraint extends a.CoreSerializable{static from(e){return this.fromAny(e)}};t.CertificateConstraint=o,t.CertificateConstraint=o=n([(0,i.type)("CertificateConstraint")],o)},4507:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateContent=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(8951),c=r(7584);let u=class CertificateContent extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.CertificateContent=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreDate)],u.prototype,"issuedAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreAddress)],u.prototype,"issuer",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreSerializable)],u.prototype,"issuerData",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreAddress)],u.prototype,"subject",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignaturePublicKey)],u.prototype,"subjectPublicKey",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.CertificateConstraint}),i("design:type",Array)],u.prototype,"constraints",void 0),n([(0,a.validate)(),(0,a.serialize)({type:c.CertificateItem}),i("design:type",Array)],u.prototype,"items",void 0),t.CertificateContent=u=n([(0,a.type)("CertificateContent")],u)},7584:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateItem=void 0;const i=r(194),a=r(2027);let o=class CertificateItem extends a.CoreSerializable{static from(e){return this.fromAny(e)}};t.CertificateItem=o,t.CertificateItem=o=n([(0,i.type)("CertificateItem")],o)},1949:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateBorderConstraint=void 0;const a=r(194),o=r(8951);let s=class CertificateBorderConstraint extends o.CertificateConstraint{static from(e){return this.fromAny(e)}};t.CertificateBorderConstraint=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"union",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"country",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"state",void 0),t.CertificateBorderConstraint=s=n([(0,a.type)("CertificateBorderConstraint")],s)},8176:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateCityConstraint=void 0;const a=r(194),o=r(8951);let s=class CertificateCityConstraint extends o.CertificateConstraint{static from(e){return this.fromAny(e)}};t.CertificateCityConstraint=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"district",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"city",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"zipCode",void 0),t.CertificateCityConstraint=s=n([(0,a.type)("CertificateCityConstraint")],s)},6578:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateIdentityConstraint=void 0;const a=r(194),o=r(2027),s=r(8951);let l=class CertificateIdentityConstraint extends s.CertificateConstraint{static from(e){return this.fromAny(e)}};t.CertificateIdentityConstraint=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],l.prototype,"identity",void 0),t.CertificateIdentityConstraint=l=n([(0,a.type)("CertificateIdentityConstraint")],l)},4220:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateTimeConstraint=void 0;const a=r(194),o=r(2027),s=r(8951);let l=class CertificateTimeConstraint extends s.CertificateConstraint{static from(e){return this.fromAny(e)}};t.CertificateTimeConstraint=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"validFrom",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"validTo",void 0),t.CertificateTimeConstraint=l=n([(0,a.type)("CertificateTimeConstraint")],l)},3327:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateAuthorizationItem=void 0;const a=r(194),o=r(7584);let s=class CertificateAuthorizationItem extends o.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificateAuthorizationItem=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"authorization",void 0),t.CertificateAuthorizationItem=s=n([(0,a.type)("CertificateAuthorizationItem")],s)},7376:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateDelegateItem=t.CertificateDelegateType=void 0;const a=r(194),o=r(7584);var s;!function(e){e.Clone="clone",e.Custodian="custodian",e.Sign="sign",e.Ppa="ppa",e.Communication="communication"}(s||(t.CertificateDelegateType=s={}));let l=class CertificateDelegateItem extends o.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificateDelegateItem=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"type",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],l.prototype,"content",void 0),t.CertificateDelegateItem=l=n([(0,a.type)("CertificateDelegateItem")],l)},8579:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificatePrivateAttributeItem=void 0;const a=r(194),o=r(1732),s=r(7584);let l=class CertificatePrivateAttributeItem extends s.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificatePrivateAttributeItem=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreHash)],l.prototype,"hash",void 0),t.CertificatePrivateAttributeItem=l=n([(0,a.type)("CertificatePrivateAttributeItem")],l)},3727:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificatePrivateAttributeItemSource=void 0;const a=r(194),o=r(1732),s=r(7584);let l=class CertificatePrivateAttributeItemSource extends s.CertificateItem{async hash(){return await o.CoreHash.hash(`${this.nonce}|${this.name}|${this.value}`)}static from(e){return this.fromAny(e)}};t.CertificatePrivateAttributeItemSource=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"nonce",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"name",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"value",void 0),t.CertificatePrivateAttributeItemSource=l=n([(0,a.type)("CertificatePrivateAttributeItem")],l)},9745:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificatePublicAttributeItem=void 0;const a=r(194),o=r(7584);let s=class CertificatePublicAttributeItem extends o.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificatePublicAttributeItem=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"name",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"value",void 0),t.CertificatePublicAttributeItem=s=n([(0,a.type)("CertificatePublicAttributeItem")],s)},1430:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateRoleItem=void 0;const a=r(194),o=r(7584);let s=class CertificateRoleItem extends o.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificateRoleItem=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"role",void 0),t.CertificateRoleItem=s=n([(0,a.type)("CertificateRoleItem")],s)},9626:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ChallengeController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(2508),c=r(2182),u=r(3122),d=r(1772),p=r(9643),h=r(4621);class ChallengeController extends l.TransportController{constructor(e){super(l.ControllerName.Challenge,e)}async init(){return await super.init(),this.client=new d.ChallengeClient(this.config),this.authClient=new u.ChallengeAuthClient(this.config,this.parent.authenticator),this}async validateChallengeLocally(e,t){if(!e.createdBy)return{isValid:!1};const r=await this.parent.relationships.getActiveRelationshipToIdentity(e.createdBy);if(!r)throw s.CoreErrors.general.recordNotFound(c.Relationship,e.createdBy.toString());const n=o.CoreBuffer.fromUtf8(t.challenge);let i=!1;switch(e.type){case p.ChallengeType.Identity:i=await this.parent.relationships.verifyIdentity(r,n,t.signature);break;case p.ChallengeType.Device:throw s.CoreErrors.general.notSupported();case p.ChallengeType.Relationship:i=await this.parent.relationships.verify(r,n,t.signature)}return i?{isValid:!0,correspondingRelationship:r}:{isValid:!1}}async validateChallenge(e,t){const r=p.Challenge.deserialize(e.challenge);if(t&&r.type!==t)return{isValid:!1};if(r.expiresAt.isExpired())return{isValid:!1};const n=await this.authClient.getChallenge(r.id.toString());return n.isError||n.value.id!==r.id.toString()||r.createdBy&&n.value.createdBy!==r.createdBy.toString()?{isValid:!1}:await this.validateChallengeLocally(r,e)}async createAccountCreationChallenge(e){const t=(await this.client.createChallenge()).value,r=p.Challenge.from({id:s.CoreId.from(t.id),expiresAt:s.CoreDate.from(t.expiresAt),type:p.ChallengeType.Identity}).serialize(!1),n=o.CoreBuffer.fromUtf8(r),i=await s.CoreCrypto.sign(n,e.privateKey);return h.ChallengeSigned.from({challenge:r,signature:i})}async createChallenge(e=p.ChallengeType.Identity,t){if(e===p.ChallengeType.Relationship&&!t)throw s.CoreErrors.challenges.challengeTypeRequiresRelationship();const r=(await this.authClient.createChallenge()).value,n=p.Challenge.from({id:s.CoreId.from(r.id),expiresAt:s.CoreDate.from(r.expiresAt),createdBy:r.createdBy?s.CoreAddress.from(r.createdBy):void 0,createdByDevice:r.createdByDevice?s.CoreId.from(r.createdByDevice):void 0,type:e}).serialize(!1),i=o.CoreBuffer.fromUtf8(n);let a;switch(e){case p.ChallengeType.Identity:a=await this.parent.identity.sign(i);break;case p.ChallengeType.Device:a=await this.parent.activeDevice.sign(i);break;case p.ChallengeType.Relationship:a=await this.parent.relationships.sign(t,i)}return h.ChallengeSigned.from({challenge:n,signature:a})}}t.ChallengeController=ChallengeController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[p.Challenge,h.ChallengeSigned]),i("design:returntype",Promise)],ChallengeController.prototype,"validateChallengeLocally",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,c.Relationship]),i("design:returntype",Promise)],ChallengeController.prototype,"createChallenge",null)},3122:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChallengeAuthClient=void 0;const n=r(6054);class ChallengeAuthClient extends n.RESTClientAuthenticate{async createChallenge(){return await this.post("/api/v1/Challenges",{})}async getChallenge(e){return await this.get(`/api/v1/Challenges/${e}`)}}t.ChallengeAuthClient=ChallengeAuthClient},1772:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChallengeClient=void 0;const n=r(2027);class ChallengeClient extends n.RESTClient{async createChallenge(){return await this.post("/api/v1/Challenges",{})}}t.ChallengeClient=ChallengeClient},9643:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Challenge=t.ChallengeType=void 0;const a=r(194),o=r(2027);var s;!function(e){e.Identity="Identity",e.Device="Device",e.Relationship="Relationship"}(s||(t.ChallengeType=s={}));let l=class Challenge extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.Challenge=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],l.prototype,"id",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"expiresAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreAddress)],l.prototype,"createdBy",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreId)],l.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"type",void 0),t.Challenge=l=n([(0,a.type)("Challenge")],l)},4621:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ChallengeSigned=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class ChallengeSigned extends s.CoreSerializable{static from(e){return this.fromAny(e)}static fromJSON(e){const t=o.CryptoSignature.fromBase64(e.signature);return this.from({signature:t,challenge:e.challenge})}toJSON(e=!0){const t={challenge:this.challenge,signature:this.signature.toBase64()};return e&&(t["@type"]="ChallengeSigned"),t}};t.ChallengeSigned=l,n([(0,a.validate)(),(0,a.serialize)({enforceString:!0}),i("design:type",String)],l.prototype,"challenge",void 0),n([(0,a.validate)(),(0,a.serialize)({enforceString:!0}),i("design:type",o.CryptoSignature)],l.prototype,"signature",void 0),t.ChallengeSigned=l=n([(0,a.type)("ChallengeSigned")],l)},7896:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(2556),c=r(6453),u=r(413);class DeviceController extends s.TransportController{get secrets(){return this._secrets}get id(){return this.device.id}get publicKey(){return this.device.publicKey}get certificate(){return this.device.certificate}get name(){return this.device.name}get description(){return this.device.description}get operatingSystem(){return this.device.operatingSystem}get createdAt(){return this.device.createdAt}get type(){return this.device.type}get device(){if(!this._device)throw new s.TransportError("The Device controller is not initialized.");return this._device}get deviceOrUndefined(){return this._device}constructor(e){super(s.ControllerName.Device,e)}async init(e,t){return await super.init(),this._device=t,this._secrets=await new l.DeviceSecretController(this.parent,e).init(),this}async changePassword(e){const t=(await this.getCredentials()).password;await this.parent.deviceAuthClient.changeDevicePassword({oldPassword:t,newPassword:e});try{const t=await this.secrets.loadSecret(l.DeviceSecretType.DeviceCredentials);if(!t)throw new s.TransportError("There was an error while accessing the device_credentials secret.");const r=t.secret;r.password=e,await this.secrets.storeSecret(r,l.DeviceSecretType.DeviceCredentials)}catch(t){throw this.log.warn(`We've changed the device password on the backbone but weren't able to store it to the database. The new password is '${e}'.`),t}}async update(e){e.name&&(this.device.name=e.name),e.description&&(this.device.description=e.description),e.datawalletVersion&&(this.device.datawalletVersion=e.datawalletVersion),await this.parent.devices.update(this.device),await this.parent.info.set("device",this.device.toJSON())}async sign(e){const t=await this.secrets.loadSecret(l.DeviceSecretType.DeviceSignature);if(!(t&&t.secret instanceof o.CryptoSignaturePrivateKey))throw s.CoreErrors.secrets.secretNotFound(l.DeviceSecretType.DeviceSignature);const r=t.secret,n=await s.CoreCrypto.sign(e,r);return r.privateKey.clear(),n}async verify(e,t){if(!this.publicKey)throw new s.TransportError("The device has no public key to verify a signature. This can happen if the device is not onboarded yet.");return await s.CoreCrypto.verify(e,t,this.publicKey)}async getCredentials(){const e=await this.secrets.loadSecret(l.DeviceSecretType.DeviceCredentials);if(!e)throw s.CoreErrors.secrets.secretNotFound(l.DeviceSecretType.DeviceCredentials);if(!(e.secret instanceof u.DeviceSecretCredentials))throw s.CoreErrors.secrets.wrongSecretType(l.DeviceSecretType.DeviceCredentials);const t=e.secret;if(!t.username||!t.password)throw s.CoreErrors.secrets.wrongSecretType(l.DeviceSecretType.DeviceCredentials);return{username:t.username,password:t.password}}}t.DeviceController=DeviceController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[o.CryptoSecretKey,c.Device]),i("design:returntype",Promise)],DeviceController.prototype,"init",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[o.CoreBuffer]),i("design:returntype",Promise)],DeviceController.prototype,"sign",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[o.CoreBuffer,o.CryptoSignature]),i("design:returntype",Promise)],DeviceController.prototype,"verify",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",Promise)],DeviceController.prototype,"getCredentials",null)},2556:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceSecretController=t.DeviceSecretType=void 0;const a=r(194),o=r(5172),s=r(2890),l=r(2027),c=r(2508),u=r(8169),d=r(9423),p=r(7636),h=r(9750),y=r(6453),g=r(6758);var m;!function(e){e.IdentitySynchronizationMaster="identity_synchronization_master",e.IdentitySignature="identity_signature",e.SharedSecretBaseKey="shared_basekey",e.DeviceSecretBaseKey="secret_basekey",e.DeviceSignature="device_signature",e.DeviceCredentials="device_credentials"}(m||(t.DeviceSecretType=m={}));class DeviceSecretController extends c.TransportController{constructor(e,t){super(c.ControllerName.DeviceSecret,e),this.baseKey=t}async init(){return await super.init(),this.secrets=await this.db.getMap("DeviceSecrets"),this}async storeSecret(e,t){const r=e.serialize(),n=s.CoreBuffer.fromUtf8(r),i=await l.CoreCrypto.deriveKeyFromBase(this.getBaseKey(),1,DeviceSecretController.secretContext),a=await l.CoreCrypto.encrypt(n,i),o=l.CoreDate.utc(),c={cipher:a,createdAt:o,name:t,id:await u.TransportIds.secret.generate(),validFrom:o,active:!0},p=d.SecretContainerCipher.from(c);return this.log.trace(`Created device secret id:${p.id} name:${p.name} on ${p.createdAt.toISOString()}.`),await this.secrets.set(t,p.toJSON()),p}async loadSecret(e){const t=await this.secrets.get(e);if(!t)return;const r=this.getBaseKey(),n=d.SecretContainerCipher.from(t),i=await l.CoreCrypto.deriveKeyFromBase(r,1,DeviceSecretController.secretContext),o=(await l.CoreCrypto.decrypt(n.cipher,i)).toUtf8(),s=a.Serializable.deserializeUnknown(o),c=p.SecretContainerPlain.from({id:n.id,createdAt:n.createdAt,name:n.name,secret:s,validFrom:n.validFrom,validTo:n.validTo,active:n.active});return this.log.trace(`Accessed device secret id:${c.id} name:${c.name} on ${l.CoreDate.utc().toISOString()}.`),c}async deleteSecret(e){const t=await this.secrets.get(e);return!!t&&(await this.secrets.delete(e),this.log.trace(`Deleted device secret id:${t.id} name:${t.name} on ${l.CoreDate.utc().toISOString()}.`),!0)}async createDeviceSharedSecret(e,t,r=!1){const n=await this.loadSecret(m.IdentitySynchronizationMaster);if(!(n&&n.secret instanceof s.CryptoSecretKey))throw l.CoreErrors.secrets.secretNotFound("SynchronizationKey");const i=await this.loadSecret(m.SharedSecretBaseKey);if(!(i&&i.secret instanceof s.CryptoSecretKey))throw l.CoreErrors.secrets.secretNotFound("baseKey");let a;if(r&&(a=await this.loadSecret(m.IdentitySignature),!(a&&a.secret instanceof s.CryptoSignaturePrivateKey)))throw l.CoreErrors.secrets.secretNotFound("IdentityKey");return g.DeviceSharedSecret.from({id:e.id,createdAt:e.createdAt,createdByDevice:e.createdByDevice,deviceIndex:t,secretBaseKey:i.secret,name:e.name,description:e.description,synchronizationKey:n.secret,identityPrivateKey:null==a?void 0:a.secret,username:e.username,password:e.initialPassword,identity:this.parent.identity.identity})}async encryptDatawalletModificationPayload(e,t){if(!e.payload)return;const r=s.CoreBuffer.fromUtf8(JSON.stringify(e.payload)),n=await this.loadSecret(m.IdentitySynchronizationMaster);if(!(n&&n.secret instanceof s.CryptoSecretKey))throw l.CoreErrors.secrets.secretNotFound(m.IdentitySynchronizationMaster);const i=await l.CoreCrypto.deriveKeyFromBase(n.secret,t,"DataSync"),a=await l.CoreCrypto.encrypt(r,i);return n.secret.clear(),a.toBase64()}async decryptDatawalletModificationPayload(e,t){if(!e)return;const r=s.CryptoCipher.fromBase64(e),n=await this.loadSecret(m.IdentitySynchronizationMaster);if(!(n&&n.secret instanceof s.CryptoSecretKey))throw l.CoreErrors.secrets.secretNotFound(m.IdentitySynchronizationMaster);const i=await l.CoreCrypto.deriveKeyFromBase(n.secret,t,"DataSync"),a=await l.CoreCrypto.decrypt(r,i);n.secret.clear();return JSON.parse(a.toUtf8())}getBaseKey(){if(!this.baseKey)throw l.CoreErrors.general.recordNotFound(s.CryptoSecretKey,m.SharedSecretBaseKey);return this.baseKey}}t.DeviceSecretController=DeviceSecretController,DeviceSecretController.secretContext="DEVICE01",n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[y.Device,Number,Object]),i("design:returntype",Promise)],DeviceSecretController.prototype,"createDeviceSharedSecret",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[h.DatawalletModification,Number]),i("design:returntype",Promise)],DeviceSecretController.prototype,"encryptDatawalletModificationPayload",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[Object,Number]),i("design:returntype",Promise)],DeviceSecretController.prototype,"decryptDatawalletModificationPayload",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",s.CryptoSecretKey)],DeviceSecretController.prototype,"getBaseKey",null)},4980:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DevicesController=void 0;const n=r(2027),i=r(369),a=r(2508),o=r(2212),s=r(9643),l=r(8382),c=r(6453),u=r(9798);class DevicesController extends a.TransportController{constructor(e){super(a.ControllerName.Devices,e)}async init(){return await super.init(),this.client=new l.DeviceAuthClient(this.config,this.parent.authenticator),this.devices=await this.parent.getSynchronizedCollection(i.DbCollectionName.Devices),this}async get(e){const t=await this.devices.read(e.toString());if(t)return c.Device.from(t)}async addExistingDevice(e){await this.devices.create(e)}async createDevice(e="",t="",r=!1){const[i,a]=await Promise.all([this.parent.challenges.createChallenge(s.ChallengeType.Identity),o.PasswordGenerator.createStrongPassword(45,50)]);this.log.trace("Device Creation Challenge signed. Creating device on backbone...");const l=(await this.client.createDevice({signedChallenge:i.toJSON(),devicePassword:a})).value;this.log.trace(`Created device with id ${l.id}.`);return c.Device.from({createdAt:n.CoreDate.from(l.createdAt),createdByDevice:n.CoreId.from(l.createdByDevice),id:n.CoreId.from(l.id),name:e,description:t,type:c.DeviceType.Unknown,username:l.username,initialPassword:a,isAdmin:r})}async sendDevice(e){if(!(e=u.SendDeviceParameters.from(e)).name){const t=await this.parent.devices.list();e.name=`Device ${t.length+1}`}const t=await this.createDevice(e.name,e.description,e.isAdmin);return await this.devices.create(t),t}async getSharedSecret(e){const t=await this.devices.read(e.toString());if(!t)throw n.CoreErrors.general.recordNotFound(c.Device,e.toString());const r=await this.devices.count(),i=c.Device.from(t);if(void 0!==i.publicKey)throw n.CoreErrors.device.alreadyOnboarded();const a=!0===i.isAdmin;return await this.parent.activeDevice.secrets.createDeviceSharedSecret(i,r,a)}async update(e){const t=await this.devices.read(e.id.toString());if(!t)throw n.CoreErrors.general.recordNotFound(c.Device,e.id.toString());await this.devices.update(t,e)}async delete(e){await this.devices.delete(e)}async list(){const e=await this.devices.list();return this.parseArray(e,c.Device)}}t.DevicesController=DevicesController},3378:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8382:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceAuthClient=void 0;const n=r(2027);class DeviceAuthClient extends n.RESTClientAuthenticate{constructor(){super(...arguments),this._logDirective=n.RESTClientLogDirective.LogResponse}async changeDevicePassword(e){return await this.put("/api/v1/Devices/Self/Password",e,{})}async createDevice(e){return await this.post("/api/v1/Devices",e,{})}async registerPushNotificationToken(e){return await this.put("/api/v1/Devices/Self/PushNotifications",e)}}t.DeviceAuthClient=DeviceAuthClient},6961:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceClient=void 0;const n=r(2027);class DeviceClient extends n.RESTClient{constructor(){super(...arguments),this._logDirective=n.RESTClientLogDirective.LogResponse}async createDevice(e){return await this.post("/api/v1/Devices",e,{})}}t.DeviceClient=DeviceClient},6453:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Device=t.DeviceType=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(4062),u=r(9170);var d;!function(e){e[e.Unknown=0]="Unknown",e[e.Phone=1]="Phone",e[e.Tablet=2]="Tablet",e[e.Desktop=3]="Desktop",e[e.Connector=4]="Connector"}(d||(t.DeviceType=d={}));let p=class Device extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.isAdmin)),(0,s.nameof)((e=>e.publicKey)),(0,s.nameof)((e=>e.certificate)),(0,s.nameof)((e=>e.operatingSystem)),(0,s.nameof)((e=>e.type)),(0,s.nameof)((e=>e.createdAt)),(0,s.nameof)((e=>e.createdByDevice)),(0,s.nameof)((e=>e.lastLoginAt)),(0,s.nameof)((e=>e.username)),(0,s.nameof)((e=>e.initialPassword)),(0,s.nameof)((e=>e.datawalletVersion))],this.userdataProperties=[(0,s.nameof)((e=>e.name)),(0,s.nameof)((e=>e.description))]}static from(e){return this.fromAny(e)}};t.Device=p,n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CryptoSignaturePublicKey)],p.prototype,"publicKey",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"certificate",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],p.prototype,"name",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"description",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"operatingSystem",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",c.CoreDate)],p.prototype,"createdAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",u.CoreId)],p.prototype,"createdByDevice",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.CoreDate)],p.prototype,"lastLoginAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Number)],p.prototype,"type",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"username",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"initialPassword",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Boolean)],p.prototype,"isAdmin",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Number)],p.prototype,"datawalletVersion",void 0),t.Device=p=n([(0,a.type)("Device")],p)},413:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceSecretCredentials=void 0;const a=r(194),o=r(2027);let s=class DeviceSecretCredentials extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.DeviceSecretCredentials=s,n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CoreId)],s.prototype,"id",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],s.prototype,"password",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],s.prototype,"username",void 0),t.DeviceSecretCredentials=s=n([(0,a.type)("DeviceSecretCredentials")],s)},9798:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendDeviceParameters=void 0;const a=r(194),o=r(2027);let s=class SendDeviceParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendDeviceParameters=s,n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],s.prototype,"name",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],s.prototype,"description",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Boolean)],s.prototype,"isAdmin",void 0),t.SendDeviceParameters=s=n([(0,a.type)("SendDeviceParameters")],s)},6758:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceSharedSecret=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(2016);let c=class DeviceSharedSecret extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.DeviceSharedSecret=c,n([(0,a.serialize)(),(0,a.validate)(),i("design:type",s.CoreId)],c.prototype,"id",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",s.CoreId)],c.prototype,"createdByDevice",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",s.CoreDate)],c.prototype,"createdAt",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],c.prototype,"name",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],c.prototype,"description",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CryptoSecretKey)],c.prototype,"synchronizationKey",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CryptoSecretKey)],c.prototype,"secretBaseKey",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",Number)],c.prototype,"deviceIndex",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",o.CryptoSignaturePrivateKey)],c.prototype,"identityPrivateKey",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",l.Identity)],c.prototype,"identity",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",String)],c.prototype,"username",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",String)],c.prototype,"password",void 0),t.DeviceSharedSecret=c=n([(0,a.type)("DeviceSharedSecret")],c)},9777:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.FileController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(369),c=r(2508),u=r(7145),d=r(7373),p=r(9873),h=r(8340),y=r(3159),g=r(9579);class FileController extends c.TransportController{constructor(e){super(c.ControllerName.File,e)}async init(){return await super.init(),this.client=new u.FileClient(this.config,this.parent.authenticator),this.files=await this.parent.getSynchronizedCollection(l.DbCollectionName.Files),this}async getFiles(e){const t=await this.files.find(e);return this.parseArray(t,p.File)}async getFile(e){const t=await this.files.read(e.toString());return t?p.File.from(t):void 0}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getFiles({ids:e.map((e=>e.id))})).value.collect()).map((async e=>{const t=await this.files.read(e.id),r=p.File.from(t);return{id:s.CoreId.from(e.id),cache:await this.decryptFile(e,r.secretKey)}}));return await Promise.all(t)}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getFiles({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingFileInDb(e.id,e));return await Promise.all(r)}async updateCacheOfExistingFileInDb(e,t){const r=await this.files.read(e);if(!r)throw s.CoreErrors.general.recordNotFound(p.File,e);const n=p.File.from(r);return await this.updateCacheOfFile(n,t),await this.files.update(r,n),n}async updateCacheOfFile(e,t){const r=e.id.toString();t||(t=(await this.client.getFile(r)).value);const n=await this.decryptFile(t,e.secretKey);e.setCache(n),e.isOwn=this.parent.identity.isMe(n.createdBy)}async decryptFile(e,t){const r=o.CryptoCipher.fromBase64(e.encryptedProperties),n=await s.CoreCrypto.decrypt(r,t),i=y.FileMetadata.deserialize(n.toUtf8());if(!(i instanceof y.FileMetadata))throw s.CoreErrors.files.invalidMetadata(e.id);return d.CachedFile.fromBackbone(e,i)}async getOrLoadFileByTruncated(e){const t=g.FileReference.fromTruncated(e);return await this.getOrLoadFileByReference(t)}async getOrLoadFileByReference(e){return await this.getOrLoadFile(e.id,e.key)}async getOrLoadFile(e,t){const r=await this.files.read(e.toString());if(r)return r.cache?p.File.from(r):await this.updateCacheOfExistingFileInDb(e.toString());const n=p.File.from({id:e,secretKey:t,isOwn:!1});return await this.updateCacheOfFile(n),await this.files.create(n),n}async setFileMetadata(e,t){const r=e instanceof s.CoreId?e.toString():e.id.toString(),n=await this.files.read(r);if(!n)throw s.CoreErrors.general.recordNotFound(p.File,r.toString());const i=p.File.from(n);return i.setMetadata(t),await this.files.update(n,i),i}async sendFile(e){const t=h.SendFileParameters.from(e),r=t.buffer,n=r.length;if(n>this.config.platformMaxUnencryptedFileSize)throw s.CoreErrors.files.maxFileSizeExceeded(n,this.config.platformMaxUnencryptedFileSize);const i=await o.CryptoHash.hash(r,2),a=s.CoreHash.from(i.toBase64URL()),l=await this.parent.activeDevice.sign(i),c=l.toBase64(),u=await s.CoreCrypto.generateSecretKey(),g=await s.CoreCrypto.encrypt(r,u),m=o.CoreBuffer.fromBase64URL(g.toBase64()),v=await o.CryptoHash.hash(m,2),b=s.CoreHash.from(v.toBase64URL()),w=y.FileMetadata.from({title:t.title,description:t.description,filename:t.filename,filesize:n,plaintextHash:a,secretKey:u,filemodified:t.filemodified,mimetype:t.mimetype}).serialize(),C=o.CoreBuffer.fromString(w,o.Encoding.Utf8),S=await s.CoreCrypto.generateSecretKey(),_=await s.CoreCrypto.encrypt(C,S),R=this.parent.identity.address,O=(await this.client.createFile({content:m.buffer,cipherHash:v.toBase64URL(),owner:R.toString(),ownerSignature:c,expiresAt:t.expiresAt.toString(),encryptedProperties:_.toBase64()})).value,T=d.CachedFile.from({title:t.title,description:t.description,filename:t.filename,filesize:n,filemodified:t.filemodified,cipherKey:u,cipherHash:b,createdAt:s.CoreDate.from(O.createdAt),createdBy:s.CoreAddress.from(O.createdBy),createdByDevice:s.CoreId.from(O.createdByDevice),expiresAt:s.CoreDate.from(O.expiresAt),mimetype:t.mimetype,owner:s.CoreAddress.from(O.owner),ownerSignature:l,plaintextHash:a}),I=p.File.from({id:s.CoreId.from(O.id),secretKey:S,isOwn:!0});return I.setCache(T),await this.files.create(I),I}async downloadFileContent(e){const t=e instanceof p.File?e:await this.getFile(e);if(!t)throw s.CoreErrors.general.recordNotFound(p.File,e.toString());if(!t.cache)throw this.newCacheEmptyError(p.File,t.id.toString());const r=(await this.client.downloadFile(t.id.toString())).value,n=o.CoreBuffer.fromObject(r);if((await o.CryptoHash.hash(n,2)).toBase64URL()!==t.cache.cipherHash.hash)throw s.CoreErrors.files.cipherMismatch();const i=o.CryptoCipher.fromBase64(n.toBase64URL()),a=await s.CoreCrypto.decrypt(i,t.cache.cipherKey);if(!await t.cache.plaintextHash.verify(a,2))throw s.CoreErrors.files.plaintextHashMismatch();return a}}t.FileController=FileController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],FileController.prototype,"updateCacheOfExistingFileInDb",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,o.CryptoSecretKey]),i("design:returntype",Promise)],FileController.prototype,"decryptFile",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],FileController.prototype,"setFileMetadata",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],FileController.prototype,"downloadFileContent",null)},2153:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5560:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7145:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileClient=void 0;const n=r(6054);class FileClient extends n.RESTClientAuthenticate{async createFile(e){return await this.postMultipart("/api/v1/Files",e)}async getFiles(e){return await this.getPaged("/api/v1/Files",e)}async getFile(e){return await this.get(`/api/v1/Files/${e}/metadata`)}async deleteFile(e){return await this.delete(`/api/v1/Files/${e}`)}async downloadFile(e){return await this.download(`/api/v1/Files/${e}`)}}t.FileClient=FileClient},7373:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CachedFile=void 0;const o=r(194),s=r(2890),l=r(2027);let c=n=class CachedFile extends l.CoreSerializable{static from(e){return this.fromAny(e)}static fromBackbone(e,t){return n.from({title:t.title,description:t.description,cipherKey:t.secretKey,filemodified:t.filemodified,filename:t.filename,filesize:t.filesize,plaintextHash:t.plaintextHash,deletedAt:e.deletedAt?l.CoreDate.from(e.deletedAt):void 0,deletedBy:e.deletedBy?l.CoreAddress.from(e.deletedBy):void 0,deletedByDevice:e.deletedByDevice?l.CoreId.from(e.deletedByDevice):void 0,cipherHash:l.CoreHash.from(e.cipherHash),createdAt:l.CoreDate.from(e.createdAt),createdBy:l.CoreAddress.from(e.createdBy),createdByDevice:l.CoreId.from(e.createdByDevice),expiresAt:l.CoreDate.from(e.expiresAt),mimetype:t.mimetype,owner:l.CoreAddress.from(e.owner),ownerSignature:s.CryptoSignature.fromBase64(e.ownerSignature)})}};t.CachedFile=c,i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",String)],c.prototype,"title",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",String)],c.prototype,"filename",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",Number)],c.prototype,"filesize",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreDate)],c.prototype,"filemodified",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",String)],c.prototype,"mimetype",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreHash)],c.prototype,"cipherHash",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreDate)],c.prototype,"createdAt",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreDate)],c.prototype,"expiresAt",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",String)],c.prototype,"description",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreAddress)],c.prototype,"owner",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",s.CryptoSignature)],c.prototype,"ownerSignature",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreHash)],c.prototype,"plaintextHash",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreAddress)],c.prototype,"createdBy",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreId)],c.prototype,"createdByDevice",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",s.CryptoSecretKey)],c.prototype,"cipherKey",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreDate)],c.prototype,"deletedAt",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreAddress)],c.prototype,"deletedBy",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreId)],c.prototype,"deletedByDevice",void 0),t.CachedFile=c=n=i([(0,o.type)("CachedFile")],c)},9873:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.File=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(9579),u=r(7373);let d=class File extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.secretKey)),(0,s.nameof)((e=>e.isOwn))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static from(e){return this.fromAny(e)}toFileReference(){return c.FileReference.from({id:this.id,key:this.secretKey})}truncate(){return this.toFileReference().truncate()}setCache(e){return this.cache=e,this.cachedAt=l.CoreDate.utc(),this}setMetadata(e){return this.metadata=e,this.metadataModifiedAt=l.CoreDate.utc(),this}};t.File=d,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],d.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],d.prototype,"isOwn",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",u.CachedFile)],d.prototype,"cache",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],d.prototype,"cachedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],d.prototype,"metadata",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],d.prototype,"metadataModifiedAt",void 0),t.File=d=n([(0,a.type)("File")],d)},8340:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendFileParameters=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(4062);let c=class SendFileParameters extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendFileParameters=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"title",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"description",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"filename",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"mimetype",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreDate)],c.prototype,"expiresAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],c.prototype,"filemodified",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreBuffer)],c.prototype,"buffer",void 0),t.SendFileParameters=c=n([(0,a.type)("SendFileParameters")],c)},3159:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.FileMetadata=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class FileMetadata extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.FileMetadata=l,n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],l.prototype,"title",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],l.prototype,"description",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"filename",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreHash)],l.prototype,"plaintextHash",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],l.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Number)],l.prototype,"filesize",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",s.CoreDate)],l.prototype,"filemodified",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"mimetype",void 0),t.FileMetadata=l=n([(0,a.type)("FileMetadata")],l)},9579:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.FileReference=void 0;const i=r(194),a=r(2027);let o=class FileReference extends a.Reference{static preFrom(e){return super.validateId(e,a.BackboneIds.file),e}static from(e){return super.from(e)}};t.FileReference=o,t.FileReference=o=n([(0,i.type)("FileReference")],o)},9662:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.SyncStep=void 0,i(r(7024),t),i(r(5366),t),i(r(2016),t),i(r(6346),t),i(r(761),t),i(r(1615),t),i(r(2723),t),i(r(8324),t),i(r(365),t),i(r(8951),t),i(r(4507),t),i(r(7584),t),i(r(1949),t),i(r(8176),t),i(r(6578),t),i(r(4220),t),i(r(3327),t),i(r(7376),t),i(r(8579),t),i(r(3727),t),i(r(9745),t),i(r(1430),t),i(r(3122),t),i(r(1772),t),i(r(9626),t),i(r(9643),t),i(r(4621),t),i(r(3378),t),i(r(8382),t),i(r(6961),t),i(r(7896),t),i(r(4980),t),i(r(2556),t),i(r(6453),t),i(r(413),t),i(r(9798),t),i(r(6758),t),i(r(2153),t),i(r(5560),t),i(r(7145),t),i(r(9777),t),i(r(7373),t),i(r(9873),t),i(r(8340),t),i(r(3159),t),i(r(9579),t),i(r(7239),t),i(r(5523),t),i(r(3125),t),i(r(2510),t),i(r(6614),t),i(r(4949),t),i(r(5832),t),i(r(682),t),i(r(8909),t),i(r(4937),t),i(r(9829),t),i(r(7242),t),i(r(6164),t),i(r(7902),t),i(r(1903),t),i(r(4002),t),i(r(169),t),i(r(2182),t),i(r(8440),t),i(r(3666),t),i(r(3654),t),i(r(3582),t),i(r(1512),t),i(r(3771),t),i(r(3611),t),i(r(6411),t),i(r(5289),t),i(r(5784),t),i(r(2618),t),i(r(8174),t),i(r(3861),t),i(r(8333),t),i(r(7262),t),i(r(8805),t),i(r(8572),t),i(r(7215),t),i(r(9270),t),i(r(1752),t),i(r(3778),t),i(r(2343),t),i(r(3250),t),i(r(3293),t),i(r(2860),t),i(r(3129),t),i(r(9423),t),i(r(7636),t),i(r(5739),t),i(r(6890),t),i(r(3670),t),i(r(8571),t),i(r(4401),t),i(r(1541),t),i(r(7224),t),i(r(5079),t),i(r(7596),t),i(r(9267),t),i(r(3132),t),i(r(9761),t),i(r(9750),t);var a=r(307);Object.defineProperty(t,"SyncStep",{enumerable:!0,get:function(){return a.SyncStep}}),i(r(1295),t),i(r(26),t),i(r(8697),t),i(r(7653),t),i(r(7267),t),i(r(6591),t),i(r(8342),t),i(r(5898),t),i(r(4102),t),i(r(4503),t),i(r(5083),t),i(r(2238),t),i(r(1488),t),i(r(7776),t)},5832:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageController=void 0;const a=r(5172),o=r(2890),s=r(4714),l=r(2027),c=r(369),u=r(2508),d=r(2205),p=r(9873),h=r(2182),y=r(3654),g=r(3125),m=r(2510),v=r(6614),b=r(4949),w=r(682),C=r(8909),S=r(4937),_=r(9829),R=r(7242);class MessageController extends u.TransportController{constructor(e){super(u.ControllerName.Message,e),this.relationships=e.relationships}async init(){return await super.init(),this.secrets=new y.RelationshipSecretController(this.parent),await this.secrets.init(),this.client=new g.MessageClient(this.config,this.parent.authenticator),this.messages=await this.parent.getSynchronizedCollection(c.DbCollectionName.Messages),this}async getMessages(e){const t=await this.messages.find(e);return this.parseArray(t,v.Message)}async getMessagesByRelationshipId(e){return await this.getMessages({[(0,s.nameof)((e=>e.relationshipIds))]:{$contains:e.toString()}})}async getMessagesByAddress(e){const t=await this.parent.relationships.getActiveRelationshipToIdentity(e);if(!t)throw l.CoreErrors.messages.noMatchingRelationship(e.toString());return await this.getMessagesByRelationshipId(t.id)}async getReceivedMessages(){return await this.getMessages({[(0,s.nameof)((e=>e.isOwn))]:!1})}async getMessage(e){const t=await this.messages.read(e.toString());return t?v.Message.from(t):void 0}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getMessages({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingMessageInDb(e.id,e));return await Promise.all(r)}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getMessages({ids:e.map((e=>e.toString()))})).value.collect()).map((async e=>{const t=await this.messages.read(e.id),r=v.Message.from(t),n=this.getEnvelopeFromBackboneGetMessagesResponse(e),i=(await this.decryptMessage(n,r.secretKey))[0];return{id:l.CoreId.from(e.id),cache:i}}));return await Promise.all(t)}async updateCacheOfExistingMessageInDb(e,t){const r=await this.messages.read(e);if(!r)throw l.CoreErrors.general.recordNotFound(v.Message,e);const n=v.Message.from(r);return await this.updateCacheOfMessage(n,t),await this.messages.update(r,n),n}async updateCacheOfMessage(e,t){const r=e.id.toString();t||(t=(await this.client.getMessage(r)).value);const n=this.getEnvelopeFromBackboneGetMessagesResponse(t),[i,a]=await this.decryptMessage(n,e.secretKey);e.secretKey=a,e.setCache(i)}async loadPeerMessage(e){const t=(await this.client.getMessage(e.toString())).value,r=this.getEnvelopeFromBackboneGetMessagesResponse(t),[n,i,a]=await this.decryptMessage(r);if(!a)throw l.CoreErrors.general.recordNotFound(h.Relationship,r.id.toString());const o=v.Message.from({id:r.id,isOwn:!1,secretKey:i,relationshipIds:[a.id]});return o.setCache(n),await this.messages.create(o),o}getEnvelopeFromBackboneGetMessagesResponse(e){const t=[];for(const r of e.recipients){const e=S.MessageEnvelopeRecipient.from({encryptedKey:o.CryptoCipher.fromBase64(r.encryptedKey),address:l.CoreAddress.from(r.address),receivedAt:r.receivedAt?l.CoreDate.from(r.receivedAt):void 0,receivedByDevice:r.receivedByDevice?l.CoreId.from(r.receivedByDevice):void 0});t.push(e)}return C.MessageEnvelope.from({id:l.CoreId.from(e.id),createdAt:l.CoreDate.from(e.createdAt),createdBy:l.CoreAddress.from(e.createdBy),createdByDevice:l.CoreId.from(e.createdByDevice),cipher:o.CryptoCipher.fromBase64(e.body),attachments:e.attachments,recipients:t})}async setMessageMetadata(e,t){const r=e instanceof l.CoreId?e.toString():e.id.toString(),n=await this.messages.read(r);if(!n)throw l.CoreErrors.general.recordNotFound(v.Message,r.toString());const i=v.Message.from(n);return i.setMetadata(t),await this.messages.update(n,i),i}async sendMessage(e){(e=b.SendMessageParameters.from(e)).attachments||(e.attachments=[]);const t=await l.CoreCrypto.generateSecretKey(),r=t.serialize(!1),n=[],i=[];for(const t of e.recipients){const e=await this.relationships.getActiveRelationshipToIdentity(l.CoreAddress.from(t));if(!e)throw l.CoreErrors.general.recordNotFound(h.Relationship,t.toString());const a=await this.secrets.encrypt(e.relationshipSecretId,r);i.push(S.MessageEnvelopeRecipient.from({address:t,encryptedKey:a})),n.push(t)}const a=[],s=[];for(const t of e.attachments){const e=p.File.from(t);s.push(e.toFileReference()),a.push(e.id)}const c=w.MessageContentWrapper.from({content:e.content,recipients:n,createdAt:l.CoreDate.utc(),attachments:s}).serialize(),u=o.CoreBuffer.fromUtf8(c),y=[],g=[];for(const t of e.recipients){const e=await this.relationships.getActiveRelationshipToIdentity(l.CoreAddress.from(t));if(!e)throw l.CoreErrors.general.recordNotFound(h.Relationship,t.toString());const r=await this.secrets.sign(e.relationshipSecretId,u),n=_.MessageSignature.from({recipient:t,signature:r});y.push(n),g.push(e.id)}const C=R.MessageSigned.from({message:c,signatures:y}).serialize(),O=await l.CoreCrypto.encrypt(o.CoreBuffer.fromUtf8(C),t),T=i.map((e=>({address:e.address.toString(),encryptedKey:e.encryptedKey.toBase64()}))),I=a.map((e=>({id:e.id}))),E=(await this.client.createMessage({attachments:I,body:O.toBase64(),recipients:T})).value,D=m.CachedMessage.from({content:e.content,createdAt:l.CoreDate.from(E.createdAt),createdBy:this.parent.identity.identity.address,createdByDevice:this.parent.activeDevice.id,recipients:i,attachments:a,receivedByEveryone:!1}),P=v.Message.from({id:l.CoreId.from(E.id),secretKey:t,cache:D,cachedAt:l.CoreDate.utc(),isOwn:!0,relationshipIds:g});return await this.messages.create(P),this.eventBus.publish(new d.MessageSentEvent(this.parent.identity.address.toString(),P)),P}async decryptOwnEnvelope(e,t){this.log.trace(`Decrypting own envelope with id ${e.id.toString()}...`);const r=await l.CoreCrypto.decrypt(e.cipher,t),n=R.MessageSigned.deserialize(r.toUtf8());return w.MessageContentWrapper.from(JSON.parse(n.message))}async decryptPeerEnvelope(e,t){var r,n;const i=null===(r=e.recipients.find((e=>this.parent.identity.isMe(e.address))))||void 0===r?void 0:r.encryptedKey;if(!i)throw l.CoreErrors.messages.ownAddressNotInList(e.id.toString());const a=await this.secrets.decryptPeer(t.relationshipSecretId,i,!0),s=o.CryptoSecretKey.deserialize(a.toUtf8()),c=await l.CoreCrypto.decrypt(e.cipher,s),u=R.MessageSigned.deserialize(c.toUtf8()),d=null===(n=u.signatures.find((e=>this.parent.identity.isMe(e.recipient))))||void 0===n?void 0:n.signature;if(!d)throw l.CoreErrors.messages.signatureListMismatch(e.id.toString());const p=w.MessageContentWrapper.from(JSON.parse(u.message));u.signatures.length!==p.recipients.length&&this.log.debug(`Number of signatures does not match number of recipients from envelope ${e.id}.`);const h=o.CoreBuffer.fromUtf8(u.message);if(!await this.secrets.verifyPeer(t.relationshipSecretId,h,d))throw l.CoreErrors.messages.signatureNotValid();p.recipients.length!==e.recipients.length&&this.log.debug(`Number of signed recipients within the message does not match number of recipients from envelope ${e.id}.`),p.recipients.length!==u.signatures.length&&this.log.debug(`Number of signed recipients within the message does not match number of signatures from envelope ${e.id}.`);if(!p.recipients.some((e=>this.parent.identity.isMe(e))))throw l.CoreErrors.messages.plaintextMismatch(e.id.toString());return[p,s]}async decryptMessage(e,t){let r,n,i;if(this.log.trace(`Decrypting MessageEnvelope with id ${e.id}...`),this.parent.identity.isMe(e.createdBy)){if(!t)throw new l.TransportError(`The own message (${e.id.toString()}) could not be decrypted, because no secret key was passed for it.`);n=t,r=await this.decryptOwnEnvelope(e,t)}else{if(i=await this.relationships.getActiveRelationshipToIdentity(e.createdBy),!i)throw l.CoreErrors.messages.noMatchingRelationship(e.createdBy.toString());const[t,a]=await this.decryptPeerEnvelope(e,i);r=t,n=a}this.log.trace("Message is valid. Fetching attachments for message...");const a=[],o=[];for(const e of r.attachments)o.push(this.parent.files.getOrLoadFileByReference(e)),a.push(e.id);await Promise.all(o),this.log.trace("Attachments fetched. Creating message...");return[m.CachedMessage.from({createdBy:e.createdBy,createdByDevice:e.createdByDevice,recipients:e.recipients,attachments:a,content:r.content,createdAt:e.createdAt,receivedByEveryone:!1}),n,i]}}t.MessageController=MessageController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[l.CoreAddress]),i("design:returntype",Promise)],MessageController.prototype,"getMessagesByAddress",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],MessageController.prototype,"updateCacheOfExistingMessageInDb",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[l.CoreId]),i("design:returntype",Promise)],MessageController.prototype,"loadPeerMessage",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],MessageController.prototype,"setMessageMetadata",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],MessageController.prototype,"sendMessage",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[C.MessageEnvelope,h.Relationship]),i("design:returntype",Promise)],MessageController.prototype,"decryptPeerEnvelope",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[C.MessageEnvelope,o.CryptoSecretKey]),i("design:returntype",Promise)],MessageController.prototype,"decryptMessage",null)},7239:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5523:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3125:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageClient=void 0;const n=r(6054);class MessageClient extends n.RESTClientAuthenticate{async getMessages(e){return await this.getPaged("/api/v1/Messages",e)}async createMessage(e){return await this.post("/api/v1/Messages",e)}async getMessage(e){return await this.get(`/api/v1/Messages/${e}`)}async deleteMessage(e){return await this.delete(`/api/v1/Messages/${e}`)}async setRead(e){return await this.put(`/api/v1/Messages/${e}/setReadFlag`,void 0)}}t.MessageClient=MessageClient},2510:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CachedMessage=void 0;const a=r(194),o=r(2027),s=r(4062),l=r(4937);let c=class CachedMessage extends o.CoreSerializable{constructor(){super(...arguments),this.receivedByEveryone=!1}static from(e){return this.fromAny(e)}};t.CachedMessage=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],c.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],c.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.MessageEnvelopeRecipient}),i("design:type",Array)],c.prototype,"recipients",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreDate)],c.prototype,"createdAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)({type:o.CoreId}),i("design:type",Array)],c.prototype,"attachments",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],c.prototype,"receivedByEveryone",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],c.prototype,"content",void 0),t.CachedMessage=c=n([(0,a.type)("CachedMessage")],c)},6614:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Message=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(2510);let u=class Message extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.secretKey)),(0,s.nameof)((e=>e.isOwn)),(0,s.nameof)((e=>e.relationshipIds))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static from(e){return this.fromAny(e)}setCache(e){return this.cache=e,this.cachedAt=l.CoreDate.utc(),this}setMetadata(e){return this.metadata=e,this.metadataModifiedAt=l.CoreDate.utc(),this}};t.Message=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],u.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],u.prototype,"isOwn",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.CachedMessage)],u.prototype,"cache",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],u.prototype,"cachedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],u.prototype,"metadata",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],u.prototype,"metadataModifiedAt",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.CoreId}),i("design:type",Array)],u.prototype,"relationshipIds",void 0),t.Message=u=n([(0,a.type)("Message")],u)},4949:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendMessageParameters=void 0;const a=r(194),o=r(2027),s=r(9873);let l=class SendMessageParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendMessageParameters=l,n([(0,a.validate)(),(0,a.serialize)({type:o.CoreAddress}),i("design:type",Array)],l.prototype,"recipients",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)({type:s.File}),i("design:type",Array)],l.prototype,"attachments",void 0),t.SendMessageParameters=l=n([(0,a.type)("SendMessageParameters")],l)},682:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageContentWrapper=void 0;const a=r(194),o=r(2027),s=r(7875),l=r(4062),c=r(9579);let u=class MessageContentWrapper extends o.CoreSerializable{constructor(){super(...arguments),this.attachments=[]}static preFrom(e){return void 0===e.attachments&&(e.attachments=[]),e}static from(e){return this.fromAny(e)}};t.MessageContentWrapper=u,n([(0,a.validate)(),(0,a.serialize)({type:c.FileReference}),i("design:type",Array)],u.prototype,"attachments",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],u.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreDate)],u.prototype,"createdAt",void 0),n([(0,a.validate)(),(0,a.serialize)({type:s.CoreAddress}),i("design:type",Array)],u.prototype,"recipients",void 0),t.MessageContentWrapper=u=n([(0,a.type)("MessageContentWrapper")],u)},8909:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageEnvelope=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(4937);let c=class MessageEnvelope extends s.CoreSerializable{static from(e){return this.fromAny(e)}static mapToJSON(e){const t={};for(const[r,n]of e.entries()){const e=r.serialize(),i=n.serialize();t[e]=i}return t}static deserializeMap(e){const t=new Map;for(const r in e){const n=e[r],i=s.CoreAddress.deserialize(r),a=o.CryptoCipher.deserialize(n);t.set(i,a)}return t}};t.MessageEnvelope=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],c.prototype,"id",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreDate)],c.prototype,"createdAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreAddress)],c.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],c.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.MessageEnvelopeRecipient}),i("design:type",Array)],c.prototype,"recipients",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoCipher)],c.prototype,"cipher",void 0),n([(0,a.validate)(),(0,a.serialize)({type:s.CoreId}),i("design:type",Array)],c.prototype,"attachments",void 0),t.MessageEnvelope=c=n([(0,a.type)("MessageEnvelope")],c)},4937:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageEnvelopeRecipient=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(7875);let c=class MessageEnvelopeRecipient extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.MessageEnvelopeRecipient=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreAddress)],c.prototype,"address",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoCipher)],c.prototype,"encryptedKey",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",s.CoreDate)],c.prototype,"receivedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",s.CoreId)],c.prototype,"receivedByDevice",void 0),t.MessageEnvelopeRecipient=c=n([(0,a.type)("MessageEnvelopeRecipient")],c)},9829:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageSignature=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class MessageSignature extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.MessageSignature=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreAddress)],l.prototype,"recipient",void 0),n([(0,a.validate)(),(0,a.serialize)({enforceString:!0}),i("design:type",o.CryptoSignature)],l.prototype,"signature",void 0),t.MessageSignature=l=n([(0,a.type)("MessageSignature")],l)},7242:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageSigned=void 0;const a=r(194),o=r(2027),s=r(9829);let l=class MessageSigned extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.MessageSigned=l,n([(0,a.validate)(),(0,a.serialize)({type:s.MessageSignature}),i("design:type",Array)],l.prototype,"signatures",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"message",void 0),t.MessageSigned=l=n([(0,a.type)("MessageSigned")],l)},2343:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(369),c=r(2508),u=r(2205),d=r(7215),p=r(9270),h=r(1752),y=r(3778),g=r(3250),m=r(2860),v=r(3129);class RelationshipTemplateController extends c.TransportController{constructor(e,t,r){super(r||c.ControllerName.RelationshipTemplate,e),this.secrets=t,this.client=new d.RelationshipTemplateClient(this.config,this.parent.authenticator)}async init(){return await super.init(),this.templates=await this.parent.getSynchronizedCollection(l.DbCollectionName.RelationshipTemplates),this}async sendRelationshipTemplate(e){e=y.SendRelationshipTemplateParameters.from(e);const t=await this.secrets.createTemplateKey(),r=g.RelationshipTemplateContentWrapper.from({content:e.content,identity:this.parent.identity.identity,templateKey:t}),n=await s.CoreCrypto.generateSecretKey(),i=r.serialize(),a=o.CoreBuffer.fromUtf8(i),l=await this.parent.identity.sign(a),c=v.RelationshipTemplateSigned.from({deviceSignature:l,serializedTemplate:i}),u=o.CoreBuffer.fromUtf8(c.serialize()),d=await s.CoreCrypto.encrypt(u,n),m=(await this.client.createRelationshipTemplate({expiresAt:e.expiresAt.toString(),maxNumberOfAllocations:e.maxNumberOfAllocations,content:d.toBase64()})).value,b=p.CachedRelationshipTemplate.from({content:e.content,createdAt:s.CoreDate.from(m.createdAt),createdBy:this.parent.identity.address,createdByDevice:this.parent.activeDevice.id,expiresAt:e.expiresAt,identity:this.parent.identity.identity,maxNumberOfAllocations:e.maxNumberOfAllocations,templateKey:t}),w=h.RelationshipTemplate.from({id:s.CoreId.from(m.id),secretKey:n,isOwn:!0,cache:b,cachedAt:s.CoreDate.utc()});return await this.templates.create(w),w}async deleteRelationshipTemplate(e){await this.client.deleteRelationshipTemplate(e.id.toString()),await this.templates.delete(e)}async getRelationshipTemplates(e){const t=await this.templates.find(e);return this.parseArray(t,h.RelationshipTemplate)}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getRelationshipTemplates({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingTemplateInDb(e.id,e));return await Promise.all(r)}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getRelationshipTemplates({ids:e.map((e=>e.id))})).value.collect()).map((async e=>{const t=await this.templates.read(e.id),r=h.RelationshipTemplate.from(t);return{id:s.CoreId.from(e.id),cache:await this.decryptRelationshipTemplate(e,r.secretKey)}}));return await Promise.all(t)}async updateCacheOfExistingTemplateInDb(e,t){const r=await this.templates.read(e);if(!r)throw s.CoreErrors.general.recordNotFound(h.RelationshipTemplate,e);const n=h.RelationshipTemplate.from(r);return await this.updateCacheOfTemplate(n,t),await this.templates.update(r,n),n}async updateCacheOfTemplate(e,t){t||(t=(await this.client.getRelationshipTemplate(e.id.toString())).value);const r=await this.decryptRelationshipTemplate(t,e.secretKey);e.setCache(r),e.isOwn=this.parent.identity.isMe(r.createdBy)}async decryptRelationshipTemplate(e,t){var r;const n=o.CryptoCipher.fromBase64(e.content),i=await this.secrets.decryptTemplate(n,t),a=v.RelationshipTemplateSigned.deserialize(i.toUtf8()),l=g.RelationshipTemplateContentWrapper.deserialize(a.serializedTemplate);if(!await this.secrets.verifyTemplate(o.CoreBuffer.fromUtf8(a.serializedTemplate),a.deviceSignature,l.identity.publicKey))throw s.CoreErrors.general.signatureNotValid("template");return p.CachedRelationshipTemplate.from({content:l.content,createdBy:s.CoreAddress.from(e.createdBy),createdByDevice:s.CoreId.from(e.createdByDevice),createdAt:s.CoreDate.from(e.createdAt),expiresAt:e.expiresAt?s.CoreDate.from(e.expiresAt):void 0,identity:l.identity,maxNumberOfAllocations:null!==(r=e.maxNumberOfAllocations)&&void 0!==r?r:void 0,templateKey:l.templateKey})}async getRelationshipTemplate(e){const t=await this.templates.read(e.toString());if(t)return h.RelationshipTemplate.from(t)}async setRelationshipTemplateMetadata(e,t){const r=e instanceof s.CoreId?e.toString():e.id.toString(),n=await this.templates.read(r);if(!n)throw s.CoreErrors.general.recordNotFound(h.RelationshipTemplate,r.toString());const i=h.RelationshipTemplate.from(n);return i.setMetadata(t),await this.templates.update(n,i),i}async loadPeerRelationshipTemplateByTruncated(e){const t=m.RelationshipTemplateReference.fromTruncated(e);return await this.loadPeerRelationshipTemplateByReference(t)}async loadPeerRelationshipTemplateByReference(e){return await this.loadPeerRelationshipTemplate(e.id,e.key)}async loadPeerRelationshipTemplate(e,t){if(await this.templates.read(e.toString())){const t=await this.updateCacheOfExistingTemplateInDb(e.toString());return this.eventBus.publish(new u.PeerRelationshipTemplateLoadedEvent(this.parent.identity.address.toString(),t)),t}const r=h.RelationshipTemplate.from({id:e,secretKey:t,isOwn:!1});return await this.updateCacheOfTemplate(r),await this.templates.create(r),this.eventBus.publish(new u.PeerRelationshipTemplateLoadedEvent(this.parent.identity.address.toString(),r)),r}}t.RelationshipTemplateController=RelationshipTemplateController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],RelationshipTemplateController.prototype,"updateCacheOfExistingTemplateInDb",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,o.CryptoSecretKey]),i("design:returntype",Promise)],RelationshipTemplateController.prototype,"decryptRelationshipTemplate",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],RelationshipTemplateController.prototype,"setRelationshipTemplateMetadata",null)},8805:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8572:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7215:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateClient=void 0;const n=r(2027);class RelationshipTemplateClient extends n.RESTClientAuthenticate{async getRelationshipTemplates(e){return await this.getPaged("/api/v1/RelationshipTemplates",e)}async getRelationshipTemplate(e){return await this.get(`/api/v1/RelationshipTemplates/${e}`)}async deleteRelationshipTemplate(e){return await this.delete(`/api/v1/RelationshipTemplates/${e}`)}async createRelationshipTemplate(e){return await this.post("/api/v1/RelationshipTemplates",e)}}t.RelationshipTemplateClient=RelationshipTemplateClient},9270:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.validateMaxNumberOfAllocations=t.CachedRelationshipTemplate=void 0;const a=r(194),o=r(2027),s=r(9170),l=r(2016),c=r(3293);let u=class CachedRelationshipTemplate extends o.CoreSerializable{static from(e){return this.fromAny(e)}};function validateMaxNumberOfAllocations(e){if(void 0!==e)return e<=0?"maxNumberOfAllocations must be greater than 0":void 0}t.CachedRelationshipTemplate=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.Identity)],u.prototype,"identity",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],u.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],u.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",c.RelationshipTemplatePublicKey)],u.prototype,"templateKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],u.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],u.prototype,"createdAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreDate)],u.prototype,"expiresAt",void 0),n([(0,a.validate)({nullable:!0,customValidator:validateMaxNumberOfAllocations}),(0,a.serialize)(),i("design:type",Number)],u.prototype,"maxNumberOfAllocations",void 0),t.CachedRelationshipTemplate=u=n([(0,a.type)("CachedRelationshipTemplate")],u),t.validateMaxNumberOfAllocations=validateMaxNumberOfAllocations},1752:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplate=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(4062),u=r(2860),d=r(9270);let p=class RelationshipTemplate extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.secretKey)),(0,s.nameof)((e=>e.isOwn))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static from(e){return this.fromAny(e)}toRelationshipTemplateReference(){return u.RelationshipTemplateReference.from({id:this.id,key:this.secretKey})}truncate(){return this.toRelationshipTemplateReference().truncate()}setCache(e){return this.cache=e,this.cachedAt=c.CoreDate.utc(),this}setMetadata(e){return this.metadata=e,this.metadataModifiedAt=c.CoreDate.utc(),this}};t.RelationshipTemplate=p,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],p.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],p.prototype,"isOwn",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",d.CachedRelationshipTemplate)],p.prototype,"cache",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.CoreDate)],p.prototype,"cachedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],p.prototype,"metadata",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.CoreDate)],p.prototype,"metadataModifiedAt",void 0),t.RelationshipTemplate=p=n([(0,a.type)("RelationshipTemplate")],p)},3778:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendRelationshipTemplateParameters=void 0;const a=r(194),o=r(2027),s=r(9270);let l=class SendRelationshipTemplateParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendRelationshipTemplateParameters=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"expiresAt",void 0),n([(0,a.validate)({nullable:!0,customValidator:s.validateMaxNumberOfAllocations}),(0,a.serialize)(),i("design:type",Number)],l.prototype,"maxNumberOfAllocations",void 0),t.SendRelationshipTemplateParameters=l=n([(0,a.type)("SendRelationshipTemplateParameters")],l)},3250:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateContentWrapper=void 0;const a=r(194),o=r(2027),s=r(2016),l=r(3293);let c=class RelationshipTemplateContentWrapper extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipTemplateContentWrapper=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.Identity)],c.prototype,"identity",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.RelationshipTemplatePublicKey)],c.prototype,"templateKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],c.prototype,"content",void 0),t.RelationshipTemplateContentWrapper=c=n([(0,a.type)("RelationshipTemplateContentWrapper")],c)},3293:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplatePublicKey=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipTemplatePublicKey extends o.CryptoExchangePublicKey{toJSON(e=!0){return{id:this.id.toString(),pub:this.publicKey.toBase64URL(),alg:this.algorithm,"@type":e?"RelationshipTemplatePublicKey":void 0}}toBase64(){return o.CoreBuffer.utf8_base64(this.serialize())}serialize(e=!0){return JSON.stringify(this.toJSON(e))}static preFrom(e){const t=super.preFrom(e);return t.id=e.id,t}static fromJSON(e){return this.fromAny(e)}static from(e){return this.fromAny(e)}};t.RelationshipTemplatePublicKey=l,n([(0,a.serialize)(),(0,a.validate)(),i("design:type",s.CoreId)],l.prototype,"id",void 0),t.RelationshipTemplatePublicKey=l=n([(0,a.type)("RelationshipTemplatePublicKey")],l)},2860:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateReference=void 0;const i=r(194),a=r(2027);let o=class RelationshipTemplateReference extends a.Reference{static preFrom(e){return super.validateId(e,a.BackboneIds.relationshipTemplate),e}static from(e){return super.from(e)}};t.RelationshipTemplateReference=o,t.RelationshipTemplateReference=o=n([(0,i.type)("RelationshipTemplateReference")],o)},3129:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateSigned=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipTemplateSigned extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipTemplateSigned=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"serializedTemplate",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"deviceSignature",void 0),t.RelationshipTemplateSigned=l=n([(0,a.type)("RelationshipTemplateSigned")],l)},3654:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipSecretController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(6555),c=r(1341),u=r(8169),d=r(9270),p=r(3293),h=r(5739);class RelationshipSecretController extends h.SecretController{constructor(e){super(e,s.ControllerName.RelationshipSecret),this.cache=new Map}async getSecret(e){const t=e.toString(),r=this.cache.get(e);if(r)return r;const n=await this.loadActiveSecretByName(t);if(!n)throw l.CoreErrors.general.recordNotFound("CryptoRelationshipRequestSecrets | CryptoRelationshipSecrets",t);if(!(n.secret instanceof o.CryptoRelationshipRequestSecrets||n.secret instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(t);const i=n.secret;return this.cache.set(e,i),i}async createRequestorSecrets(e,t){const r=await o.CryptoRelationshipRequestSecrets.fromPeer(e.templateKey,e.identity.publicKey);await this.storeSecret(r,t.toString(),"");return r.toPublicRequest()}async createTemplatorSecrets(e,t,r){const n=t.templateKey.id.toString(),i=await this.loadActiveSecretByName(n);if(!i)throw l.CoreErrors.general.recordNotFound(o.CryptoExchangeKeypair,n);if(!(i.secret instanceof o.CryptoExchangeKeypair))throw l.CoreErrors.secrets.wrongSecretType(n);const a=i.secret,s=await o.CryptoRelationshipSecrets.fromRelationshipRequest(r,a);return await this.storeSecret(s,e.toString())}async getPublicResponse(e){const t=await this.loadActiveSecretByName(e.toString());if(!t)throw l.CoreErrors.general.recordNotFound(o.CryptoRelationshipSecrets,e.toString());if(!(t.secret instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(t.id.toString());return t.secret.toPublicResponse()}async convertSecrets(e,t){const r=await this.getSecret(e);if(r instanceof o.CryptoRelationshipSecrets)throw l.CoreErrors.secrets.wrongSecretType();const n=await o.CryptoRelationshipSecrets.fromRelationshipResponse(t,r),i=await this.succeedSecretWithName(n,e.toString());return this.cache.set(e,n),i}async deleteSecretForRequest(e){const t=await this.loadActiveSecretByName(`request_to_${e.address}`);return!!t&&await this.deleteSecretById(t.id)}async decryptTemplate(e,t){return await s.CoreCrypto.decrypt(e,t)}async verifyTemplate(e,t,r){return await s.CoreCrypto.verify(e,t,r)}async encryptRequest(e,t){const r=c.CoreUtil.toBuffer(t),n=await this.getSecret(e);if(!(n instanceof o.CryptoRelationshipRequestSecrets))throw l.CoreErrors.secrets.wrongSecretType(n.id);return await n.encryptRequest(r)}async encrypt(e,t){const r=c.CoreUtil.toBuffer(t),n=await this.getSecret(e);if(!(n instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(n.id);return await n.encrypt(r)}async decryptRequest(e,t){const r=await this.getSecret(e);if(!(r instanceof o.CryptoRelationshipRequestSecrets||r instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(e.toString());return await r.decryptRequest(t)}async createTemplateKey(){const e=await u.TransportIds.relationshipTemplateKey.generate(),t=(await this.createExchangeKey(`${e.toString()}`))[0];return p.RelationshipTemplatePublicKey.from({id:e,algorithm:t.algorithm,publicKey:t.publicKey})}async decryptPeer(e,t,r=!1){const n=await this.getSecret(e);if(!(n instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(n.id);return await n.decryptPeer(t,r)}async hasCryptoRelationshipSecrets(e){return await this.getSecret(e)instanceof o.CryptoRelationshipSecrets}async decryptOwn(e,t){const r=await this.getSecret(e);if(!(r instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(r.id);return await r.decryptOwn(t)}async sign(e,t){const r=c.CoreUtil.toBuffer(t),n=await this.getSecret(e);return await n.sign(r)}async verifyOwn(e,t,r){const n=c.CoreUtil.toBuffer(t),i=await this.getSecret(e);return await i.verifyOwn(n,r)}async verifyPeer(e,t,r){const n=c.CoreUtil.toBuffer(t),i=await this.getSecret(e);if(i instanceof o.CryptoRelationshipRequestSecrets)throw l.CoreErrors.secrets.wrongSecretType(i.id);return await i.verifyPeer(n,r)}}t.RelationshipSecretController=RelationshipSecretController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"getSecret",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,d.CachedRelationshipTemplate,o.CryptoRelationshipPublicRequest]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"createTemplatorSecrets",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"getPublicResponse",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,o.CryptoRelationshipPublicResponse]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"convertSecrets",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,Object]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"encryptRequest",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,Object]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"encrypt",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,o.CryptoCipher]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"decryptRequest",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,o.CryptoCipher,Object]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"decryptPeer",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,o.CryptoCipher]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"decryptOwn",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,Object,o.CryptoSignature]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"verifyPeer",null)},3666:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipsController=void 0;const a=r(5172),o=r(2890),s=r(4714),l=r(2027),c=r(6555),u=r(1341),d=r(369),p=r(8169),h=r(2205),y=r(1752),g=r(4002),m=r(169),v=r(2182),b=r(8440),w=r(3582),C=r(3771),S=r(3611),_=r(6411),R=r(5289),O=r(5784),T=r(2618),I=r(8174),E=r(3861),D=r(8333),P=r(7262);class RelationshipsController extends l.TransportController{constructor(e,t){super(l.ControllerName.Relationships,e),this.secrets=t}async init(){return await super.init(),this.client=new g.RelationshipClient(this.config,this.parent.authenticator),this.relationships=await this.parent.getSynchronizedCollection(d.DbCollectionName.Relationships),this}async getRelationships(e){const t=await this.relationships.find(e);return this.parseArray(t,v.Relationship)}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getRelationships({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingRelationshipInDb(e.id,e));return await Promise.all(r)}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getRelationships({ids:e.map((e=>e.id))})).value.collect()).map((async e=>{const t=await this.relationships.read(e.id),r=v.Relationship.from(t);return{id:l.CoreId.from(e.id),cache:await this.decryptRelationship(e,r.relationshipSecretId)}}));return await Promise.all(t)}async updateCacheOfExistingRelationshipInDb(e,t){const r=await this.relationships.read(e);if(!r)throw c.CoreErrors.general.recordNotFound(v.Relationship,e);const n=v.Relationship.from(r);return await this.updateCacheOfRelationship(n,t),await this.relationships.update(r,n),n}async getRelationshipToIdentity(e,t){const r={[`${(0,s.nameof)((e=>e.peer))}.${(0,s.nameof)((e=>e.address))}`]:e.toString()};t&&(r[`${(0,s.nameof)((e=>e.status))}`]=t);const n=await this.relationships.findOne(r);if(n)return v.Relationship.from(n)}async getActiveRelationshipToIdentity(e){return await this.getRelationshipToIdentity(e,R.RelationshipStatus.Active)}async getRelationship(e){const t=await this.relationships.read(e.toString());if(t)return v.Relationship.from(t)}async sign(e,t){return await this.secrets.sign(e.relationshipSecretId,t)}async verify(e,t,r){return await this.secrets.verifyPeer(e.relationshipSecretId,t,r)}async verifyIdentity(e,t,r){return await l.CoreCrypto.verify(t,r,e.peer.publicKey)}async sendRelationship(e){const t=(e=b.SendRelationshipParameters.from(e)).template;if(!t.cache)throw this.newCacheEmptyError(y.RelationshipTemplate,t.id.toString());const r=await p.TransportIds.relationshipSecret.generate(),{requestCipher:n,requestContent:i}=await this.prepareRequest(r,t,e.content),a=(await this.client.createRelationship({content:n.toBase64(),relationshipTemplateId:t.id.toString()})).value,o=v.Relationship.fromRequestSent(l.CoreId.from(a.id),t,t.cache.identity,w.RelationshipChange.fromBackbone(a.changes[0],i.content),r);return await this.relationships.create(o),this.eventBus.publish(new h.RelationshipChangedEvent(this.parent.identity.address.toString(),o)),o}async setRelationshipMetadata(e,t){const r=e instanceof l.CoreId?e.toString():e.id.toString(),n=await this.relationships.read(r);if(!n)throw c.CoreErrors.general.recordNotFound(v.Relationship,r.toString());const i=v.Relationship.from(n);return i.metadata=t,i.metadataModifiedAt=l.CoreDate.utc(),await this.relationships.update(n,i),i}async acceptChange(e,t){return await this.completeChange(S.RelationshipChangeStatus.Accepted,e,t)}async rejectChange(e,t){return await this.completeChange(S.RelationshipChangeStatus.Rejected,e,t)}async revokeChange(e,t){return await this.completeChange(S.RelationshipChangeStatus.Revoked,e,t)}async updateCacheOfRelationship(e,t){t||(t=(await this.client.getRelationship(e.id.toString())).value);const r=await this.decryptRelationship(t,e.relationshipSecretId);e.setCache(r)}async decryptRelationship(e,t){const r=l.CoreId.from(e.relationshipTemplateId);this._log.trace(`Parsing relationship template ${r} for ${e.id}...`);const n=await this.parent.relationshipTemplates.getRelationshipTemplate(r);if(!n)throw c.CoreErrors.general.recordNotFound(y.RelationshipTemplate,r.toString());this._log.trace(`Parsing relationship changes of ${e.id}...`);const i=[];for(const n of e.changes)if(n.type===_.RelationshipChangeType.Creation)i.push(this.parseCreationChange(n,t,r));const a=await Promise.all(i);return m.CachedRelationship.from({changes:a,template:n})}async prepareRequest(e,t,r){if(!t.cache)throw this.newCacheEmptyError(y.RelationshipTemplate,t.id.toString());const n=await this.secrets.createRequestorSecrets(t.cache,e),i=T.RelationshipCreationChangeRequestContentWrapper.from({content:r,identity:this.parent.identity.identity,templateId:t.id}),a=i.serialize(),o=u.CoreUtil.toBuffer(a),[s,l]=await Promise.all([this.parent.activeDevice.sign(o),this.secrets.sign(e,o)]),c=I.RelationshipCreationChangeRequestSigned.from({serializedRequest:a,deviceSignature:s,relationshipSignature:l}),d=await this.secrets.encryptRequest(e,c);return{requestCipher:O.RelationshipCreationChangeRequestCipher.from({cipher:d,publicRequestCrypto:n}),requestContent:i}}async applyChangeById(e){const t=(await this.client.getRelationshipChange(e.toString())).value;return await this.applyChange(t)}async applyChange(e){switch(e.type){case _.RelationshipChangeType.Creation:return await this.applyCreationChange(e);case _.RelationshipChangeType.Termination:case _.RelationshipChangeType.TerminationCancellation:default:throw c.CoreErrors.general.notSupported()}}async applyCreationChange(e){const t=await this.relationships.read(e.relationshipId);if(t)return e.response?await this.updatePendingRelationshipWithPeerResponse(t,e):void 0;const r=await this.createNewRelationshipByIncomingCreationChange(e);if(e.response){const t=await this.relationships.read(e.relationshipId);return await this.updatePendingRelationshipWithPeerResponse(t,e)}return r}async parseCreationChange(e,t,r){e.type!==_.RelationshipChangeType.Creation&&this.throwWrongChangeType(e.type);const n=[];n.push(this.decryptCreationChangeRequest(e.request,t,r));const i=await this.secrets.hasCryptoRelationshipSecrets(t);e.response&&i&&n.push(this.decryptCreationChangeResponse(e,t));const[a,o]=await Promise.all(n);return w.RelationshipChange.fromBackbone(e,a.content,null==o?void 0:o.content)}async decryptCreationChangeRequest(e,t,r){if(!e.content)throw this.newEmptyOrInvalidContentError();const n=this.parent.identity.isMe(l.CoreAddress.from(e.createdBy)),i=O.RelationshipCreationChangeRequestCipher.fromBase64(e.content),a=await this.secrets.decryptRequest(t,i.cipher),s=I.RelationshipCreationChangeRequestSigned.deserialize(a.toUtf8());let u;if(u=n?await this.secrets.verifyOwn(t,o.CoreBuffer.fromUtf8(s.serializedRequest),s.relationshipSignature):await this.secrets.verifyPeer(t,o.CoreBuffer.fromUtf8(s.serializedRequest),s.relationshipSignature),!u)throw c.CoreErrors.general.signatureNotValid("relationshipRequest");const d=T.RelationshipCreationChangeRequestContentWrapper.deserialize(s.serializedRequest);if(!d.templateId.equals(r))throw new l.TransportError("The relationship request contains a wrong template id.");return d}async decryptCreationChangeResponse(e,t){if(!e.response)throw this.newChangeResponseMissingError(e.id);if(e.type!==_.RelationshipChangeType.Creation&&this.throwWrongChangeType(e.type),!e.response.content)throw this.newEmptyOrInvalidContentError(e);const r=this.parent.identity.isMe(l.CoreAddress.from(e.response.createdBy)),n=E.RelationshipCreationChangeResponseCipher.fromBase64(e.response.content);let i;i=e.status!==S.RelationshipChangeStatus.Revoked?r?await this.secrets.decryptOwn(t,n.cipher):await this.secrets.decryptPeer(t,n.cipher,!0):await this.secrets.decryptRequest(t,n.cipher);const a=P.RelationshipCreationChangeResponseSigned.deserialize(i.toUtf8());let s;if(s=r?await this.secrets.verifyOwn(t,o.CoreBuffer.fromUtf8(a.serializedResponse),a.relationshipSignature):await this.secrets.verifyPeer(t,o.CoreBuffer.fromUtf8(a.serializedResponse),a.relationshipSignature),!s)throw c.CoreErrors.general.signatureNotValid("relationshipResponse");const u=D.RelationshipCreationChangeResponseContentWrapper.deserialize(a.serializedResponse);if(!u.relationshipId.equals(e.relationshipId))throw new l.TransportError("The relationship response contains a wrong relationship id.");return u}async updatePendingRelationshipWithPeerResponse(e,t){const r=v.Relationship.from(e);if(r.status!==R.RelationshipStatus.Pending)return void this.log.debug("Trying to update non-pending relationship with creation change",t);if(r.cache||await this.updateCacheOfRelationship(r,void 0),!t.response)throw this.newChangeResponseMissingError(t.id);if(!t.response.content)throw this.newEmptyOrInvalidContentError(t);const n=E.RelationshipCreationChangeResponseCipher.fromBase64(t.response.content);if(t.status!==S.RelationshipChangeStatus.Revoked){if(!n.publicResponseCrypto)throw new l.TransportError("The response crypto is missing.");await this.secrets.convertSecrets(r.relationshipSecretId,n.publicResponseCrypto)}const i=await this.decryptCreationChangeResponse(t,r.relationshipSecretId),a=C.RelationshipChangeResponse.fromBackbone(t.response,i.content);if(!r.cache)throw this.newCacheEmptyError(v.Relationship,r.id.toString());switch(r.cache.changes[0].status=t.status,t.status){case S.RelationshipChangeStatus.Accepted:r.toActive(a);break;case S.RelationshipChangeStatus.Rejected:r.toRejected(a);break;case S.RelationshipChangeStatus.Revoked:r.toRevoked(a);break;default:throw c.CoreErrors.general.notSupported()}return await this.relationships.update(e,r),r}async createNewRelationshipByIncomingCreationChange(e){const t=(await this.client.getRelationship(e.relationshipId)).value,r=l.CoreId.from(t.relationshipTemplateId),n=await this.parent.relationshipTemplates.getRelationshipTemplate(r);if(!n)throw c.CoreErrors.general.recordNotFound(y.RelationshipTemplate,r.toString());if(!n.cache)throw this.newCacheEmptyError(y.RelationshipTemplate,n.id.toString());if(!e.request.content)throw this.newEmptyOrInvalidContentError(e);const i=await p.TransportIds.relationshipSecret.generate(),a=O.RelationshipCreationChangeRequestCipher.fromBase64(e.request.content);await this.secrets.createTemplatorSecrets(i,n.cache,a.publicRequestCrypto);const o=await this.decryptCreationChangeRequest(t.changes[0].request,i,r),s=w.RelationshipChange.fromBackbone(e,o.content),u=v.Relationship.fromCreationChangeReceived(t,n,o.identity,s,i);return await this.relationships.create(u),u}async completeChange(e,t,r){const n=await this.relationships.read(t.relationshipId.toString());if(!n)throw c.CoreErrors.general.recordNotFound(v.Relationship,t.relationshipId.toString());const i=v.Relationship.from(n);if(i.cache||await this.updateCacheOfRelationship(i),!i.cache)throw this.newCacheEmptyError(v.Relationship,i.id.toString());const a=i.cache.changes.find((e=>e.id.toString()===t.id.toString()));if(!a)throw c.CoreErrors.general.recordNotFound(w.RelationshipChange,t.id.toString());if(a.status!==S.RelationshipChangeStatus.Pending)throw c.CoreErrors.relationships.wrongChangeStatus(a.status);let o,s;switch(r&&(o=e===S.RelationshipChangeStatus.Revoked?await this.encryptRevokeContent(i,r):await this.encryptAcceptRejectContent(i,r)),e){case S.RelationshipChangeStatus.Accepted:s=(await this.client.acceptRelationshipChange(i.id.toString(),t.id.toString(),o)).value;break;case S.RelationshipChangeStatus.Rejected:s=(await this.client.rejectRelationshipChange(i.id.toString(),t.id.toString(),o)).value;break;case S.RelationshipChangeStatus.Revoked:s=(await this.client.revokeRelationshipChange(i.id.toString(),t.id.toString(),o)).value;break;default:throw new l.TransportError("target change status not supported")}const u=s.changes[s.changes.length-1];return a.response=C.RelationshipChangeResponse.fromBackbone(s.changes[s.changes.length-1].response,r),a.status=u.status,i.status=s.status,await this.relationships.update(n,i),this.eventBus.publish(new h.RelationshipChangedEvent(this.parent.identity.address.toString(),i)),i}async encryptRevokeContent(e,t){const r=D.RelationshipCreationChangeResponseContentWrapper.from({relationshipId:e.id,content:t}).serialize(),n=u.CoreUtil.toBuffer(r),[i,a]=await Promise.all([this.parent.activeDevice.sign(n),this.secrets.sign(e.relationshipSecretId,n)]),o=P.RelationshipCreationChangeResponseSigned.from({serializedResponse:r,deviceSignature:i,relationshipSignature:a}),s=await this.secrets.encryptRequest(e.relationshipSecretId,o);return E.RelationshipCreationChangeResponseCipher.from({cipher:s}).toBase64()}async encryptAcceptRejectContent(e,t){const r=await this.secrets.getPublicResponse(e.relationshipSecretId),n=D.RelationshipCreationChangeResponseContentWrapper.from({relationshipId:e.id,content:t}).serialize(),i=u.CoreUtil.toBuffer(n),[a,o]=await Promise.all([this.parent.activeDevice.sign(i),this.secrets.sign(e.relationshipSecretId,i)]),s=P.RelationshipCreationChangeResponseSigned.from({serializedResponse:n,deviceSignature:a,relationshipSignature:o}),l=await this.secrets.encrypt(e.relationshipSecretId,s);return E.RelationshipCreationChangeResponseCipher.from({cipher:l,publicResponseCrypto:r}).toBase64()}throwWrongChangeType(e){throw new l.TransportError(`The relationship change has the wrong type (${e}) to run this operation`)}newChangeResponseMissingError(e){return new l.TransportError(`The response of the relationship change (${e}) is missing`)}newEmptyOrInvalidContentError(e){return new l.TransportError(`The content property of the relationship change ${null==e?void 0:e.id} is missing or invalid`)}}t.RelationshipsController=RelationshipsController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"updateCacheOfExistingRelationshipInDb",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"setRelationshipMetadata",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"applyChange",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,l.CoreId,l.CoreId]),i("design:returntype",Promise)],RelationshipsController.prototype,"parseCreationChange",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,l.CoreId,l.CoreId]),i("design:returntype",Promise)],RelationshipsController.prototype,"decryptCreationChangeRequest",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,l.CoreId]),i("design:returntype",Promise)],RelationshipsController.prototype,"decryptCreationChangeResponse",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"updatePendingRelationshipWithPeerResponse",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"createNewRelationshipByIncomingCreationChange",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,w.RelationshipChange,Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"completeChange",null)},6164:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7902:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1903:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4002:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipClient=void 0;const n=r(6054);class RelationshipClient extends n.RESTClientAuthenticate{async createRelationship(e){return await this.post("/api/v1/Relationships",e)}async createRelationshipChange(e,t){return await this.post(`/api/v1/Relationships/${e}/Changes`,t)}async acceptRelationshipChange(e,t,r){return await this.put(`/api/v1/Relationships/${e}/Changes/${t}/Accept`,{content:r})}async rejectRelationshipChange(e,t,r){return await this.put(`/api/v1/Relationships/${e}/Changes/${t}/Reject`,{content:r})}async revokeRelationshipChange(e,t,r){return await this.put(`/api/v1/Relationships/${e}/Changes/${t}/Revoke`,{content:r})}async getRelationships(e){return await this.getPaged("/api/v1/Relationships",e)}async getRelationship(e){return await this.get(`/api/v1/Relationships/${e}`)}async getRelationshipChanges(e){return await this.getPaged("/api/v1/Relationships/Changes",e)}async getRelationshipChange(e){return await this.get(`/api/v1/Relationships/Changes/${e}`)}}t.RelationshipClient=RelationshipClient},169:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CachedRelationship=void 0;const a=r(194),o=r(2027),s=r(1752),l=r(3582);let c=class CachedRelationship extends o.CoreSerializable{get creationChange(){return this.changes[0]}static from(e){return this.fromAny(e)}};t.CachedRelationship=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.RelationshipTemplate)],c.prototype,"template",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.RelationshipChange}),i("design:type",Array)],c.prototype,"changes",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreDate)],c.prototype,"lastMessageSentAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreDate)],c.prototype,"lastMessageReceivedAt",void 0),t.CachedRelationship=c=n([(0,a.type)("CachedRelationship")],c)},2182:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Relationship=void 0;const o=r(194),s=r(4714),l=r(2027),c=r(2016),u=r(5289),d=r(169);let p=n=class Relationship extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.relationshipSecretId)),(0,s.nameof)((e=>e.peer)),(0,s.nameof)((e=>e.status))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static fromRequestSent(e,t,r,i,a){const o=d.CachedRelationship.from({changes:[i],template:t});return n.from({id:e,peer:r,status:u.RelationshipStatus.Pending,cache:o,cachedAt:l.CoreDate.utc(),relationshipSecretId:a})}static fromCreationChangeReceived(e,t,r,i,a){const o=d.CachedRelationship.from({changes:[i],template:t});return n.from({id:l.CoreId.from(e.id),relationshipSecretId:a,peer:r,status:u.RelationshipStatus.Pending,cache:o,cachedAt:l.CoreDate.utc()})}toActive(e){if(!this.cache)throw this.newCacheEmptyError();this.cache.changes[0].response=e,this.status=u.RelationshipStatus.Active}toRejected(e){if(!this.cache)throw this.newCacheEmptyError();this.cache.changes[0].response=e,this.status=u.RelationshipStatus.Rejected}toRevoked(e){if(!this.cache)throw this.newCacheEmptyError();this.cache.changes[0].response=e,this.status=u.RelationshipStatus.Revoked}static from(e){return this.fromAny(e)}setCache(e){return this.cache=e,this.cachedAt=l.CoreDate.utc(),this}setMetadata(e){return this.metadata=e,this.metadataModifiedAt=l.CoreDate.utc(),this}newCacheEmptyError(){return new l.TransportError(`The cache of the Relationship with id "${this.id}" is empty.`)}};t.Relationship=p,i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreId)],p.prototype,"relationshipSecretId",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",c.Identity)],p.prototype,"peer",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",String)],p.prototype,"status",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",d.CachedRelationship)],p.prototype,"cache",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreDate)],p.prototype,"cachedAt",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",Object)],p.prototype,"metadata",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreDate)],p.prototype,"metadataModifiedAt",void 0),t.Relationship=p=n=i([(0,o.type)("Relationship")],p)},8440:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendRelationshipParameters=void 0;const a=r(194),o=r(2027),s=r(1752);let l=class SendRelationshipParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendRelationshipParameters=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.RelationshipTemplate)],l.prototype,"template",void 0),t.SendRelationshipParameters=l=n([(0,a.type)("SendRelationshipParameters")],l)},5289:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipStatus=void 0,function(e){e.Pending="Pending",e.Active="Active",e.Rejected="Rejected",e.Revoked="Revoked",e.Terminating="Terminating",e.Terminated="Terminated"}(r||(t.RelationshipStatus=r={}))},3582:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChange=void 0;const a=r(194),o=r(2027),s=r(9170),l=r(1512),c=r(3771);r(3611),r(6411);let u=class RelationshipChange extends o.CoreSerializable{static fromBackbone(e,t,r){const n=this.from({id:s.CoreId.from(e.id),relationshipId:s.CoreId.from(e.relationshipId),type:e.type,status:e.status,request:l.RelationshipChangeRequest.fromBackbone(e.request,t)});return e.response&&(n.response=c.RelationshipChangeResponse.fromBackbone(e.response,r)),n}static from(e){return this.fromAny(e)}};t.RelationshipChange=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],u.prototype,"id",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],u.prototype,"relationshipId",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.RelationshipChangeRequest)],u.prototype,"request",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.RelationshipChangeResponse)],u.prototype,"response",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],u.prototype,"status",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],u.prototype,"type",void 0),t.RelationshipChange=u=n([(0,a.type)("RelationshipChange")],u)},1512:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangeRequest=void 0;const a=r(194),o=r(2027),s=r(9170);let l=class RelationshipChangeRequest extends o.CoreSerializable{static fromBackbone(e,t){return this.from({createdBy:o.CoreAddress.from(e.createdBy),createdByDevice:s.CoreId.from(e.createdByDevice),createdAt:o.CoreDate.from(e.createdAt),content:t})}static from(e){return this.fromAny(e)}};t.RelationshipChangeRequest=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],l.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],l.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"createdAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),t.RelationshipChangeRequest=l=n([(0,a.type)("RelationshipChangeRequest")],l)},3771:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangeResponse=void 0;const a=r(194),o=r(2027),s=r(9170);let l=class RelationshipChangeResponse extends o.CoreSerializable{static fromBackbone(e,t){return this.from({createdBy:o.CoreAddress.from(e.createdBy),createdByDevice:s.CoreId.from(e.createdByDevice),createdAt:o.CoreDate.from(e.createdAt),content:t})}static from(e){return this.fromAny(e)}};t.RelationshipChangeResponse=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],l.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],l.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"createdAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),t.RelationshipChangeResponse=l=n([(0,a.type)("RelationshipChangeResponse")],l)},3611:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangeStatus=void 0,function(e){e.Pending="Pending",e.Rejected="Rejected",e.Revoked="Revoked",e.Accepted="Accepted"}(r||(t.RelationshipChangeStatus=r={}))},6411:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangeType=void 0,function(e){e.Creation="Creation",e.Termination="Termination",e.TerminationCancellation="TerminationCancellation"}(r||(t.RelationshipChangeType=r={}))},5784:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeRequestCipher=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipCreationChangeRequestCipher extends s.CoreSerializable{static from(e){return this.fromAny(e)}static fromBase64(e){return super.fromBase64T(e)}};t.RelationshipCreationChangeRequestCipher=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoCipher)],l.prototype,"cipher",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoRelationshipPublicRequest)],l.prototype,"publicRequestCrypto",void 0),t.RelationshipCreationChangeRequestCipher=l=n([(0,a.type)("RelationshipCreationChangeRequestCipher")],l)},2618:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeRequestContentWrapper=void 0;const a=r(194),o=r(2027),s=r(2016);let l=class RelationshipCreationChangeRequestContentWrapper extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipCreationChangeRequestContentWrapper=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.Identity)],l.prototype,"identity",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],l.prototype,"templateId",void 0),t.RelationshipCreationChangeRequestContentWrapper=l=n([(0,a.type)("RelationshipCreationChangeRequestContentWrapper")],l)},8174:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeRequestSigned=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipCreationChangeRequestSigned extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipCreationChangeRequestSigned=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"serializedRequest",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"deviceSignature",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"relationshipSignature",void 0),t.RelationshipCreationChangeRequestSigned=l=n([(0,a.type)("RelationshipCreationChangeRequestSigned")],l)},3861:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeResponseCipher=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipCreationChangeResponseCipher extends s.CoreSerializable{static from(e){return this.fromAny(e)}static fromBase64(e){return super.fromBase64T(e)}};t.RelationshipCreationChangeResponseCipher=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoCipher)],l.prototype,"cipher",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CryptoRelationshipPublicResponse)],l.prototype,"publicResponseCrypto",void 0),t.RelationshipCreationChangeResponseCipher=l=n([(0,a.type)("RelationshipCreationChangeResponseCipher")],l)},8333:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeResponseContentWrapper=void 0;const a=r(194),o=r(2027);let s=class RelationshipCreationChangeResponseContentWrapper extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipCreationChangeResponseContentWrapper=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],s.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],s.prototype,"relationshipId",void 0),t.RelationshipCreationChangeResponseContentWrapper=s=n([(0,a.type)("RelationshipCreationChangeResponseContentWrapper")],s)},7262:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeResponseSigned=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipCreationChangeResponseSigned extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipCreationChangeResponseSigned=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"serializedResponse",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"deviceSignature",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"relationshipSignature",void 0),t.RelationshipCreationChangeResponseSigned=l=n([(0,a.type)("RelationshipCreationChangeResponseSigned")],l)},5739:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SecretController=t.SecretBaseKeyType=void 0;const a=r(194),o=r(5172),s=r(2890),l=r(2027),c=r(369),u=r(2508),d=r(2556),p=r(9423),h=r(7636);var y;!function(e){e.Random="random",e.Password="password",e.External="external"}(y||(t.SecretBaseKeyType=y={}));class SecretController extends u.TransportController{constructor(e,t=u.ControllerName.Secret){super(t,e),this.nonce=0}async init(){await super.init(),this.secrets=await this.parent.getSynchronizedCollection(c.DbCollectionName.Secrets);const e=await this.parent.info.get(SecretController.secretNonceKey);return e&&(this.nonce=e),this}async storeSecret(e,t,r="",n){const i=e.serialize(),a=s.CoreBuffer.fromUtf8(i),o=await this.increaseNonce(),c=await l.CoreCrypto.deriveKeyFromBase(await this.getBaseKey(),o,SecretController.secretContext),u=await l.CoreCrypto.encrypt(a,c),d=l.CoreDate.utc(),h={cipher:u,createdAt:d,name:t,description:r,id:await l.TransportIds.secret.generate(),nonce:o,validFrom:d,validTo:n,active:!0},y=p.SecretContainerCipher.from(h);return this.log.trace(`Created secret id:${y.id} name:${y.name} on ${y.createdAt.toISOString()}.`),await this.secrets.create(y),y}async loadSecretsByName(e){const t=await this.secrets.find({name:e}),r=[];for(const e of t){const t=p.SecretContainerCipher.from(e),n=await this.loadSecretById(t.id);n&&r.push(n)}return r}async loadActiveSecretByName(e){const t=await this.getActiveSecretContainerByName(e);if(!t)return;return await this.loadSecretById(t.id)}async getActiveSecretContainerByName(e){const t=await this.secrets.find({name:e,active:!0});if(!t.length)return;t.length>1&&this.log.warn(`More than one active secret has been found for secret name '${e}'.`);return p.SecretContainerCipher.from(t[0])}async succeedSecretWithName(e,t,r="",n){const i=await this.secrets.findOne({name:t,active:!0});if(i){const e=p.SecretContainerCipher.from(i);e.validTo=l.CoreDate.utc(),e.active=!1,await this.secrets.update(i,e)}return await this.storeSecret(e,t,r,n)}async decryptSecret(e){const t=await this.getBaseKey(),r=await l.CoreCrypto.deriveKeyFromBase(t,e.nonce?e.nonce:0,SecretController.secretContext),n=(await l.CoreCrypto.decrypt(e.cipher,r)).toUtf8(),i=a.Serializable.deserializeUnknown(n),o=h.SecretContainerPlain.from({id:e.id,createdAt:e.createdAt,description:e.description,nonce:e.nonce,name:e.name,secret:i,active:e.active,validFrom:e.validFrom,validTo:e.validTo});return this.log.trace(`Accessed secret id:${o.id} name:${o.name} on ${l.CoreDate.utc().toISOString()}.`),o}async loadSecretById(e){const t=await this.secrets.findOne({id:e.toString()});if(!t)return;const r=p.SecretContainerCipher.from(t);return await this.decryptSecret(r)}async deleteSecretById(e){const t=await this.secrets.findOne({id:e.toString()});return!!t&&(await this.secrets.delete({id:e}),this.log.trace(`Deleted secret id:${t.id} name:${t.name} on ${l.CoreDate.utc().toISOString()}.`),!0)}async createExchangeKey(e="",t="",r){const n=await l.CoreCrypto.generateExchangeKeypair(),i=await this.storeSecret(n,e,t,r);return[n.publicKey,i]}async getBaseKey(){if(this.baseKey)return this.baseKey;const e=await this.parent.activeDevice.secrets.loadSecret(d.DeviceSecretType.SharedSecretBaseKey);if(!e)throw l.CoreErrors.general.recordNotFound(s.CryptoSecretKey,d.DeviceSecretType.SharedSecretBaseKey);return this.baseKey=e.secret,this.baseKey}async increaseNonce(){const e=this.nonce++;return await this.parent.info.set(SecretController.secretNonceKey,e),e}}t.SecretController=SecretController,SecretController.secretContext="SECRET01",SecretController.secretNonceKey="secret_lastnonce",n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",Promise)],SecretController.prototype,"getBaseKey",null)},9423:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SecretContainerCipher=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(6564),c=r(4062);let u=class SecretContainerCipher extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.name)),(0,s.nameof)((e=>e.description)),(0,s.nameof)((e=>e.createdAt)),(0,s.nameof)((e=>e.validFrom)),(0,s.nameof)((e=>e.validTo)),(0,s.nameof)((e=>e.nonce)),(0,s.nameof)((e=>e.active)),(0,s.nameof)((e=>e.cipher))],this.name="",this.description=""}static from(e){return this.fromAny(e)}};t.SecretContainerCipher=u,n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],u.prototype,"name",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],u.prototype,"description",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",c.CoreDate)],u.prototype,"createdAt",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",c.CoreDate)],u.prototype,"validFrom",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",c.CoreDate)],u.prototype,"validTo",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",Number)],u.prototype,"nonce",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",Boolean)],u.prototype,"active",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CryptoCipher)],u.prototype,"cipher",void 0),t.SecretContainerCipher=u=n([(0,a.type)("SecretContainerCipher")],u)},7636:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SecretContainerPlain=void 0;const a=r(194),o=r(2027);let s=class SecretContainerPlain extends o.CoreSerializable{constructor(){super(...arguments),this.name="",this.description=""}static from(e){return this.fromAny(e)}};t.SecretContainerPlain=s,n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CoreId)],s.prototype,"id",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],s.prototype,"name",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],s.prototype,"description",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CoreDate)],s.prototype,"createdAt",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CoreDate)],s.prototype,"validFrom",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",o.CoreDate)],s.prototype,"validTo",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",Number)],s.prototype,"nonce",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",Boolean)],s.prototype,"active",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",a.Serializable)],s.prototype,"secret",void 0),t.SecretContainerPlain=s=n([(0,a.type)("SecretContainerPlain")],s)},9267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChangedItems=void 0;t.ChangedItems=class ChangedItems{constructor(e=[],t=[]){this.relationships=e,this.messages=t}addRelationship(e){this.relationships.push(e)}addMessage(e){this.messages.push(e)}}},8189:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DatawalletModificationMapper=void 0;const n=r(2027),i=r(9750);t.DatawalletModificationMapper=class DatawalletModificationMapper{static async fromBackboneDatawalletModification(e,t,r){let a,o;switch(e.type){case"Create":a=i.DatawalletModificationType.Create;break;case"Update":a=i.DatawalletModificationType.Update;break;case"Delete":a=i.DatawalletModificationType.Delete;break;case"CacheChanged":a=i.DatawalletModificationType.CacheChanged;break;default:throw new n.TransportError("Unsupported DatawalletModificationType '${backboneDatawalletModification.type}'")}switch(e.payloadCategory){case"TechnicalData":o=i.DatawalletModificationCategory.TechnicalData;break;case"Userdata":o=i.DatawalletModificationCategory.Userdata;break;case"Metadata":o=i.DatawalletModificationCategory.Metadata;break;case null:o=void 0;break;default:throw new n.TransportError(`Unsupported DatawalletModificationCategory '${e.payloadCategory}'`)}return i.DatawalletModification.from({localId:await n.TransportIds.datawalletModification.generate(),objectIdentifier:n.CoreId.from(e.objectIdentifier),payloadCategory:o,collection:e.collection,type:a,payload:t,datawalletVersion:r})}static toCreateDatawalletModificationsRequestItem(e,t){var r;return{objectIdentifier:e.objectIdentifier.toString(),payloadCategory:e.payloadCategory,collection:e.collection,type:e.type,encryptedPayload:t,datawalletVersion:null!==(r=e.datawalletVersion)&&void 0!==r?r:0}}}},3132:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CacheFetcher=t.DatawalletModificationsProcessor=void 0;const o=r(5172),s=a(r(6486)),l=r(2027),c=r(369),u=r(9873),d=r(6614),p=r(1752),h=r(2182),y=r(4102),g=r(307),m=r(9750);class DatawalletModificationsProcessor{get log(){return this.logger}constructor(e,t,r,n,i){var a,o,l,u;this.cacheFetcher=t,this.collectionProvider=r,this.logger=n,this.collectionsWithCacheableItems=[c.DbCollectionName.Files,c.DbCollectionName.Messages,c.DbCollectionName.Relationships,c.DbCollectionName.RelationshipTemplates,c.DbCollectionName.Tokens];const d=s.default.groupBy(e,(e=>e.type));this.creates=null!==(a=d[m.DatawalletModificationType.Create])&&void 0!==a?a:[],this.updates=null!==(o=d[m.DatawalletModificationType.Update])&&void 0!==o?o:[],this.deletes=null!==(l=d[m.DatawalletModificationType.Delete])&&void 0!==l?l:[],this.cacheChanges=null!==(u=d[m.DatawalletModificationType.CacheChanged])&&void 0!==u?u:[];const p=this.creates.length+this.updates.length+this.deletes.length+this.cacheChanges.length;this.syncStep=i.createStep(g.SyncStep.DatawalletSyncProcessing,p)}async execute(){await this.applyCreates(),await this.applyUpdates(),await this.applyCacheChanges(),await this.applyDeletes(),this.syncStep.finish()}async applyCreates(){if(0===this.creates.length)return;const e=s.default.groupBy(this.creates,(e=>e.objectIdentifier));for(const t in e){const r=e[t],n=r[0].collection,i=await this.collectionProvider.getCollection(n);let a={id:t};for(const e of r)a={...a,...e.payload};const o=l.CoreSerializable.fromUnknown(a),s=await i.read(t);if(s){const e={...l.CoreSerializable.fromUnknown(s).toJSON(),...o.toJSON()};await i.update(s,e)}else await this.simulateCacheChangeForCreate(n,t),await i.create(o);this.syncStep.progress()}}async simulateCacheChangeForCreate(e,t){if(!this.collectionsWithCacheableItems.includes(e))return;const r=m.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:m.DatawalletModificationType.CacheChanged,collection:e,objectIdentifier:l.CoreId.from(t)});this.cacheChanges.push(r),this.syncStep.incrementTotalNumberOfItems()}async applyUpdates(){if(0!==this.updates.length)for(const e of this.updates){const t=await this.collectionProvider.getCollection(e.collection),r=await t.read(e.objectIdentifier.toString());if(!r)throw new l.TransportError("Document to update was not found.");const n={...l.CoreSerializable.fromUnknown(r).toJSON(),...e.payload};await t.update(r,n),this.syncStep.progress()}}async applyCacheChanges(){if(0===this.cacheChanges.length)return;this.ensureAllItemsAreCacheable();const e=this.groupCacheChangesByCollection(this.cacheChanges),t=await this.cacheFetcher.fetchCacheFor({files:e.fileIds,messages:e.messageIds,relationshipTemplates:e.relationshipTemplateIds,tokens:e.tokenIds});await this.saveNewCaches(t.files,c.DbCollectionName.Files,u.File),await this.saveNewCaches(t.messages,c.DbCollectionName.Messages,d.Message),await this.saveNewCaches(t.relationshipTemplates,c.DbCollectionName.RelationshipTemplates,p.RelationshipTemplate),await this.saveNewCaches(t.tokens,c.DbCollectionName.Tokens,y.Token);const r=await this.cacheFetcher.fetchCacheFor({relationships:e.relationshipIds});await this.saveNewCaches(r.relationships,c.DbCollectionName.Relationships,h.Relationship)}ensureAllItemsAreCacheable(){const e=this.cacheChanges.map((e=>e.collection)),t=[...new Set(e)].filter((e=>!this.collectionsWithCacheableItems.includes(e)));if(t.length>0)throw l.CoreErrors.datawallet.unsupportedModification("unsupportedCacheChangedModificationCollection",t)}groupCacheChangesByCollection(e){var t,r,n,i,a;const o=s.default.groupBy(e,(e=>e.collection)),l=(null!==(t=o[c.DbCollectionName.Files])&&void 0!==t?t:[]).map((e=>e.objectIdentifier)),u=(null!==(r=o[c.DbCollectionName.Messages])&&void 0!==r?r:[]).map((e=>e.objectIdentifier)),d=(null!==(n=o[c.DbCollectionName.Relationships])&&void 0!==n?n:[]).map((e=>e.objectIdentifier));return{fileIds:l,messageIds:u,relationshipTemplateIds:(null!==(i=o[c.DbCollectionName.RelationshipTemplates])&&void 0!==i?i:[]).map((e=>e.objectIdentifier)),tokenIds:(null!==(a=o[c.DbCollectionName.Tokens])&&void 0!==a?a:[]).map((e=>e.objectIdentifier)),relationshipIds:d}}async saveNewCaches(e,t,r){if(0===e.length)return;const n=await this.collectionProvider.getCollection(t);await Promise.all(e.map((async e=>{const t=await n.read(e.id.toString()),i=r.from(t);i.setCache(e.cache),await n.update(t,i),this.syncStep.progress()})))}async applyDeletes(){if(0!==this.deletes.length)for(const e of this.deletes){const t=await this.collectionProvider.getCollection(e.collection);await t.delete({id:e.objectIdentifier.toString()}),this.syncStep.progress()}}}t.DatawalletModificationsProcessor=DatawalletModificationsProcessor,n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",void 0)],DatawalletModificationsProcessor.prototype,"ensureAllItemsAreCacheable",null);t.CacheFetcher=class CacheFetcher{constructor(e,t,r,n,i){this.fileController=e,this.messageController=t,this.relationshipTemplateController=r,this.relationshipController=n,this.tokenController=i}async fetchCacheFor(e){const t=await Promise.all([this.fetchCaches(this.fileController,e.files),this.fetchCaches(this.messageController,e.messages),this.fetchCaches(this.relationshipController,e.relationships),this.fetchCaches(this.relationshipTemplateController,e.relationshipTemplates),this.fetchCaches(this.tokenController,e.tokens)]);return{files:t[0],messages:t[1],relationships:t[2],relationshipTemplates:t[3],tokens:t[4]}}async fetchCaches(e,t){if(!t)return[];return await e.fetchCaches(t)}}},9761:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExternalEventsProcessor=void 0;const n=r(2027),i=r(2205),a=r(9267),o=r(307);class ExternalEventsProcessor{constructor(e,t,r,i,s,l){this.messagesController=e,this.relationshipsController=t,this.externalEvents=r,this.eventBus=s,this.ownAddress=l,this.changedItems=new a.ChangedItems,this.results=[],this.log=n.TransportLoggerFactory.getLogger(ExternalEventsProcessor),this.syncStep=i.createStep(o.SyncStep.ExternalEventsProcessing,r.length)}async execute(){for(const e of this.externalEvents)try{switch(e.type){case"MessageReceived":await this.applyMessageReceivedEvent(e);break;case"MessageDelivered":await this.applyMessageDeliveredEvent(e);break;case"RelationshipChangeCreated":await this.applyRelationshipChangeCreatedEvent(e);break;case"RelationshipChangeCompleted":await this.applyRelationshipChangeCompletedEvent(e);break;default:throw new n.TransportError(`'${e.type}' is not a supported external event type.`)}this.results.push({externalEventId:e.id})}catch(t){let r;this.log.error("There was an error while trying to apply an external event: ",t),r=t.code?t.code:t.message?t.message:JSON.stringify(t),this.results.push({externalEventId:e.id,errorCode:r})}finally{this.syncStep.progress()}}async applyRelationshipChangeCompletedEvent(e){const t=e.payload,r=await this.relationshipsController.applyChangeById(t.changeId);r&&(this.eventBus.publish(new i.RelationshipChangedEvent(this.ownAddress,r)),this.changedItems.addRelationship(r))}async applyRelationshipChangeCreatedEvent(e){const t=e.payload,r=await this.relationshipsController.applyChangeById(t.changeId);r&&(this.eventBus.publish(new i.RelationshipChangedEvent(this.ownAddress,r)),this.changedItems.addRelationship(r))}async applyMessageDeliveredEvent(e){const t=e.payload,r=(await this.messagesController.updateCache([t.id]))[0];this.eventBus.publish(new i.MessageDeliveredEvent(this.ownAddress,r)),this.changedItems.addMessage(r)}async applyMessageReceivedEvent(e){const t=e.payload,r=await this.messagesController.loadPeerMessage(n.CoreId.from(t.id));this.eventBus.publish(new i.MessageReceivedEvent(this.ownAddress,r)),this.changedItems.addMessage(r)}}t.ExternalEventsProcessor=ExternalEventsProcessor},307:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncStep=t.SyncProgressReporterStep=t.SyncProgressReporter=void 0;const n=r(2027);class SyncProgressReporter extends n.ProgressReporter{static fromCallback(e){return new SyncProgressReporter(e)}}t.SyncProgressReporter=SyncProgressReporter;class SyncProgressReporterStep extends n.ProgressReporterStep{}var i;t.SyncProgressReporterStep=SyncProgressReporterStep,function(e){e.Sync="sync",e.DatawalletSync="sync:datawallet",e.DatawalletSyncDownloading="sync:datawallet:downloading",e.DatawalletSyncDecryption="sync:datawallet:decrypting",e.DatawalletSyncProcessing="sync:datawallet:processing",e.ExternalEventsSync="sync:externalEvents",e.ExternalEventsSyncDownloading="sync:externalEvents:downloading",e.ExternalEventsProcessing="sync:externalEvents:processing"}(i||(t.SyncStep=i={}))},1295:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SyncController=void 0;const a=r(5172),o=r(2027),s=r(5079),l=r(7596),c=r(9267),u=r(8189),d=r(3132),p=r(9761),h=r(9750),y=r(9258),g=r(2864),m=r(307);class SyncController extends o.TransportController{get cacheFetcher(){return this._cacheFetcher||(this._cacheFetcher=new d.CacheFetcher(this.parent.files,this.parent.messages,this.parent.relationshipTemplates,this.parent.relationships,this.parent.tokens)),this._cacheFetcher}constructor(e,t,r,n){var i;super(o.ControllerName.Sync,e),this.unpushedDatawalletModifications=r,this.datawalletEnabled=n,this.client=null!==(i=t.syncClient)&&void 0!==i?i:new l.SyncClient(this.config,this.parent.authenticator),this.identityMigrations=new g.IdentityMigrations(this.parent),this.deviceMigrations=new y.DeviceMigrations(this.parent)}async init(){return await super.init(),this.syncInfo=await this.db.getMap("SyncInfo"),this}async sync(e="Everything",t){var r;if(null===(r=this.currentSync)||void 0===r?void 0:r.includes(e))return await this.currentSync.promise;if(this.currentSync&&!this.currentSync.includes(e))return await this.currentSync.promise.catch((()=>{})),await this.sync(e,t);const n=this._syncAndResyncDatawallet(e,t);this.currentSync=new LocalSyncRun(n,e);try{return await this.currentSync.promise}finally{this.currentSync=void 0}}async _syncAndResyncDatawallet(e="Everything",t){try{return await this._sync(e,t)}finally{this.datawalletEnabled&&await this.unpushedDatawalletModifications.exists()&&await this.syncDatawallet(t).catch((e=>this.log.error(e)))}}async _sync(e,t){const r=t.createStep(m.SyncStep.Sync,1);if("OnlyDatawallet"===e){const e=await this.syncDatawallet(t);return r.finish(),e}const n=await this.syncExternalEvents(t);if(await this.setLastCompletedSyncTime(),n.externalEventResults.some((e=>void 0!==e.errorCode)))throw new o.CoreError("error.transport.errorWhileApplyingExternalEvents",n.externalEventResults.filter((e=>void 0!==e.errorCode)).map((e=>e.errorCode)).join(" | "));return r.finish(),this.datawalletEnabled&&await this.unpushedDatawalletModifications.exists()&&await this.syncDatawallet(t).catch((e=>this.log.error(e))),n.changedItems}async syncExternalEvents(e){if(!await this.startExternalEventsSyncRun())return await this.syncDatawallet(e),{changedItems:new c.ChangedItems,externalEventResults:[]};await this.applyIncomingDatawalletModifications(e);const t=await this.applyIncomingExternalEvents(e);return await this.finalizeExternalEventsSyncRun(t.externalEventResults),t}async syncDatawallet(e){if(!this.datawalletEnabled)return;const t=await this.getIdentityDatawalletVersion();if(this.config.supportedDatawalletVersion<t)throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion,t);this.log.trace("Synchronization of Datawallet events started...");try{await this.applyIncomingDatawalletModifications(e),await this.pushLocalDatawalletModifications(),await this.setLastCompletedDatawalletSyncTime()}catch(e){const r="error.platform.validation.datawallet.insufficientSupportedDatawalletVersion";if(!(e instanceof o.RequestError)||e.code!==r)throw e;throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion,t)}this.log.trace("Synchronization of Datawallet events ended..."),await this.checkDatawalletVersion(t)}async checkDatawalletVersion(e){var t;if(this.config.supportedDatawalletVersion<e)throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion,e);this.config.supportedDatawalletVersion>e&&await this.upgradeIdentityDatawalletVersion(e,this.config.supportedDatawalletVersion);const r=null!==(t=this.parent.activeDevice.device.datawalletVersion)&&void 0!==t?t:0;r<e&&await this.upgradeDeviceDatawalletVersion(r,this.config.supportedDatawalletVersion)}async upgradeIdentityDatawalletVersion(e,t){if(e!==t){if(this.config.supportedDatawalletVersion<t)throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(t,e);if(e>t)throw o.CoreErrors.datawallet.currentBiggerThanTarget(e,t);for(;e<t;){e++,await this.startDatawalletVersionUpgradeSyncRun();const t=this.identityMigrations[`v${e}`];if(!t)throw this.newNoMigrationAvailableError(e);await t.call(this.identityMigrations),await this.finalizeDatawalletVersionUpgradeSyncRun(e)}}}async upgradeDeviceDatawalletVersion(e,t){if(e!==t){if(this.config.supportedDatawalletVersion<t)throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(t,e);if(e>t)throw o.CoreErrors.datawallet.currentBiggerThanTarget(e,t);for(;e<t;){e++;const t=this.deviceMigrations[`v${e}`];if(!t)throw this.newNoMigrationAvailableError(e);await t.call(this.deviceMigrations),await this.parent.activeDevice.update({datawalletVersion:e})}}}async applyIncomingDatawalletModifications(e){const t=e.createStep(m.SyncStep.DatawalletSync,1),r=e.createStep(m.SyncStep.DatawalletSyncDownloading),n=await this.client.getDatawalletModifications({localIndex:await this.getLocalDatawalletModificationIndex()},(e=>r.manualReport(e))),i=await n.value.collect();if(0===i.length)return void t.finish();const a=await this.decryptDatawalletModifications(i,e);this.log.trace(`${a.length} incoming modifications found`);const s=new d.DatawalletModificationsProcessor(a,this.cacheFetcher,this.db,o.TransportLoggerFactory.getLogger(d.DatawalletModificationsProcessor),e);await s.execute(),this.log.trace(`${a.length} incoming modifications executed`,a),await this.updateLocalDatawalletModificationIndex(i.sort(descending)[0].index),t.finish()}async promiseAllWithProgess(e,t){t(0);let r=0;for(const n of e)n.then((()=>{r++;const n=Math.round(r/e.length*100);t(n)}));return await Promise.all(e)}async decryptDatawalletModifications(e,t){const r=e.map((e=>this.decryptDatawalletModification(e))),n=t.createStep(m.SyncStep.DatawalletSyncDecryption);return await this.promiseAllWithProgess(r,(e=>n.manualReport(e)))}async decryptDatawalletModification(e){const t=await this.parent.activeDevice.secrets.decryptDatawalletModificationPayload(e.encryptedPayload,e.index);return await u.DatawalletModificationMapper.fromBackboneDatawalletModification(e,t,this.config.supportedDatawalletVersion)}async pushLocalDatawalletModifications(){const{backboneModifications:e,localModificationIds:t}=await this.prepareLocalDatawalletModificationsForPush();if(0===e.length)return;const r=await this.client.createDatawalletModifications({localIndex:await this.getLocalDatawalletModificationIndex(),modifications:e});await this.deleteUnpushedDatawalletModifications(t),await this.updateLocalDatawalletModificationIndex(r.value.newIndex)}async prepareLocalDatawalletModificationsForPush(){const e=[],t=[];if(!this.datawalletEnabled)return{backboneModifications:e,localModificationIds:t};const r=this.parseArray(await this.unpushedDatawalletModifications.list(),h.DatawalletModification),n=await this.getLocalDatawalletModificationIndex();let i="number"!=typeof n?0:n+1;for(const n of r){const r=await this.parent.activeDevice.secrets.encryptDatawalletModificationPayload(n,i++),a=u.DatawalletModificationMapper.toCreateDatawalletModificationsRequestItem(n,r);t.push(n.localId),e.push(a)}return{backboneModifications:e,localModificationIds:t}}async deleteUnpushedDatawalletModifications(e){for(const t of e)await this.unpushedDatawalletModifications.delete({localId:t.toString()})}async setInititalDatawalletVersion(e){await this.startDatawalletVersionUpgradeSyncRun(),await this.finalizeDatawalletVersionUpgradeSyncRun(e)}async getIdentityDatawalletVersion(){return(await this.client.getDatawallet()).value.version}async startExternalEventsSyncRun(){var e;const t=await this.client.startSyncRun({type:s.SyncRunType.ExternalEventSync});return t.value.status!==s.StartSyncRunStatus.NoNewEvents&&(this.currentSyncRun=null!==(e=t.value.syncRun)&&void 0!==e?e:void 0,void 0!==this.currentSyncRun)}async startDatawalletVersionUpgradeSyncRun(){var e;const t=await this.client.startSyncRun({type:s.SyncRunType.DatawalletVersionUpgrade});return this.currentSyncRun=null!==(e=t.value.syncRun)&&void 0!==e?e:void 0,void 0!==this.currentSyncRun}async applyIncomingExternalEvents(e){const t=e.createStep(m.SyncStep.ExternalEventsSync,1),r=e.createStep(m.SyncStep.ExternalEventsSyncDownloading),n=await this.client.getExternalEventsOfSyncRun(this.currentSyncRun.id.toString(),(e=>r.manualReport(e)));if(n.isError)throw n.error;const i=await n.value.collect(),a=new p.ExternalEventsProcessor(this.parent.messages,this.parent.relationships,i,e,this.eventBus,this.parent.identity.address.toString());return await a.execute(),t.finish(),{externalEventResults:a.results,changedItems:a.changedItems}}async finalizeExternalEventsSyncRun(e){if(!this.currentSyncRun)throw new o.TransportError("There is no active sync run to finalize");const{backboneModifications:t,localModificationIds:r}=await this.prepareLocalDatawalletModificationsForPush();await this.client.finalizeExternalEventSync(this.currentSyncRun.id.toString(),{datawalletModifications:t,externalEventResults:e}),await this.deleteUnpushedDatawalletModifications(r);const n=(await this.getLocalDatawalletModificationIndex()||-1)+t.length;await this.updateLocalDatawalletModificationIndex(n),this.currentSyncRun=void 0}async finalizeDatawalletVersionUpgradeSyncRun(e){if(!this.currentSyncRun)throw new o.TransportError("There is no active sync run to finalize");const{backboneModifications:t,localModificationIds:r}=await this.prepareLocalDatawalletModificationsForPush(),n=await this.client.finalizeDatawalletVersionUpgrade(this.currentSyncRun.id.toString(),{newDatawalletVersion:e,datawalletModifications:t});if(n.isError)throw n.error;await this.deleteUnpushedDatawalletModifications(r);const i=(await this.getLocalDatawalletModificationIndex()||-1)+t.length;await this.updateLocalDatawalletModificationIndex(i),this.currentSyncRun=void 0}async getLocalDatawalletModificationIndex(){return await this.syncInfo.get("localDatawalletModificationIndex")}async updateLocalDatawalletModificationIndex(e){await this.syncInfo.set("localDatawalletModificationIndex",e)}async getSyncTimeByName(e){const t=await this.syncInfo.get(`SyncTime-${e}`);return t?o.CoreDate.from(t):void 0}async setSyncTimeByName(e){const t=o.CoreDate.utc().toISOString();await this.syncInfo.set(`SyncTime-${e}`,t)}async getLastCompletedSyncTime(){return await this.getSyncTimeByName("Everything")}async getLastCompletedDatawalletSyncTime(){return await this.getSyncTimeByName("Datawallet")}async setLastCompletedSyncTime(){await this.setSyncTimeByName("Everything")}async setLastCompletedDatawalletSyncTime(){await this.setSyncTimeByName("Datawallet")}newNoMigrationAvailableError(e){return new o.TransportError(`There is no migration available for the datawallet version '${e}'.`)}}function descending(e,t){return t.index-e.index}t.SyncController=SyncController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,m.SyncProgressReporter]),i("design:returntype",Promise)],SyncController.prototype,"_sync",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[m.SyncProgressReporter]),i("design:returntype",Promise)],SyncController.prototype,"syncDatawallet",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Number]),i("design:returntype",Promise)],SyncController.prototype,"checkDatawalletVersion",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Number,Number]),i("design:returntype",Promise)],SyncController.prototype,"upgradeIdentityDatawalletVersion",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Number,Number]),i("design:returntype",Promise)],SyncController.prototype,"upgradeDeviceDatawalletVersion",null);class LocalSyncRun{constructor(e,t){this.promise=e,this.whatToSync=t}includes(e){return"Everything"===this.whatToSync||"OnlyDatawallet"===e}}},26:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SynchronizedCollection=void 0;const i=n(r(4901)),a=n(r(6486)),o=r(4714),s=r(6904),l=r(8169),c=r(9750);t.SynchronizedCollection=class SynchronizedCollection{constructor(e,t,r){this.parent=e,this.datawalletVersion=t,this.datawalletModifications=r,this.name=e.name,this.databaseType=e.databaseType}async create(e){const t=e.toJSON();if(!this.datawalletModifications)return await this.parent.create(e);const r=a.default.pickBy(t,((t,r)=>void 0!==t&&e.technicalProperties.includes(r))),n=a.default.pickBy(t,((t,r)=>void 0!==t&&e.metadataProperties.includes(r))),i=a.default.pickBy(t,((t,r)=>void 0!==t&&e.userdataProperties.includes(r))),o=e.id;0!==Object.getOwnPropertyNames(r).length&&await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Create,collection:this.name,objectIdentifier:o,payloadCategory:c.DatawalletModificationCategory.TechnicalData,payload:r,datawalletVersion:this.datawalletVersion})),0!==Object.getOwnPropertyNames(n).length&&await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Create,collection:this.name,objectIdentifier:o,payloadCategory:c.DatawalletModificationCategory.Metadata,payload:n,datawalletVersion:this.datawalletVersion})),0!==Object.getOwnPropertyNames(i).length&&await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Create,collection:this.name,objectIdentifier:o,payloadCategory:c.DatawalletModificationCategory.Userdata,payload:i,datawalletVersion:this.datawalletVersion})),await this.parent.create(e)}async read(e){return await this.parent.read(e)}async update(e,t){const r=s.CoreSerializable.fromUnknown(e),n=t.toJSON();if(!this.datawalletModifications)return await this.parent.update(e,t);const u=i.default.compare(r.toJSON(),n),d=[];for(const e of u){const t=e.path.split("/").find((e=>e));d.push(t)}const p=0!==a.default.intersection(t.technicalProperties,d).length,h=0!==a.default.intersection(t.metadataProperties,d).length,y=0!==a.default.intersection(t.userdataProperties,d).length,g=d.some((e=>e===(0,o.nameof)((e=>e.cache)))),m=t.id;if(p){const e=a.default.pick(n,t.technicalProperties);await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Update,collection:this.name,objectIdentifier:m,payloadCategory:c.DatawalletModificationCategory.TechnicalData,payload:e,datawalletVersion:this.datawalletVersion}))}if(h){const e=a.default.pick(n,t.metadataProperties);await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Update,collection:this.name,objectIdentifier:m,payloadCategory:c.DatawalletModificationCategory.Metadata,payload:e,datawalletVersion:this.datawalletVersion}))}if(y){const e=a.default.pick(n,t.userdataProperties);await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Update,collection:this.name,objectIdentifier:m,payloadCategory:c.DatawalletModificationCategory.Userdata,payload:e,datawalletVersion:this.datawalletVersion}))}return g&&await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.CacheChanged,collection:this.name,objectIdentifier:m,datawalletVersion:this.datawalletVersion})),await this.parent.update(e,t)}async delete(e){return this.datawalletModifications?(await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Delete,collection:this.name,objectIdentifier:e.id,datawalletVersion:this.datawalletVersion})),await this.parent.delete({id:e.id.toString()})):await this.parent.delete({id:e.id.toString()})}async list(){return await this.parent.list()}async find(e){return await this.parent.find(e)}async count(e){return await this.parent.count(e)}async exists(e){return await this.parent.exists(e)}async findOne(e){return await this.parent.findOne(e)}}},6890:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3670:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8571:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4401:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1541:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7224:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5079:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.StartSyncRunStatus=t.SyncRunType=void 0,function(e){e.ExternalEventSync="ExternalEventSync",e.DatawalletVersionUpgrade="DatawalletVersionUpgrade"}(r||(t.SyncRunType=r={})),function(e){e.Created="Created",e.NoNewEvents="NoNewEvents"}(n||(t.StartSyncRunStatus=n={}))},7596:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncClient=void 0;const n=r(2027);class SyncClient extends n.RESTClientAuthenticate{constructor(e,t){super(e,t,{headers:{"x-supported-datawallet-version":e.supportedDatawalletVersion.toString()}})}async startSyncRun(e){return await this.post("/api/v1/SyncRuns",e)}async finalizeExternalEventSync(e,t){return await this.put(`/api/v1/SyncRuns/${e}/FinalizeExternalEventSync`,t)}async finalizeDatawalletVersionUpgrade(e,t){return await this.put(`/api/v1/SyncRuns/${e}/FinalizeDatawalletVersionUpgrade`,t)}async getExternalEventsOfSyncRun(e,t){return await this.getPaged(`/api/v1/SyncRuns/${e}/ExternalEvents`,{},void 0,t)}async getDatawallet(){return await this.get("/api/v1/Datawallet")}async getDatawalletModifications(e,t){return await this.getPaged("/api/v1/Datawallet/Modifications",e,void 0,t)}async createDatawalletModifications(e){return await this.post("/api/v1/Datawallet/Modifications",e)}}t.SyncClient=SyncClient},9750:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DatawalletModification=t.DatawalletModificationCategory=t.DatawalletModificationType=void 0;const a=r(194),o=r(2027);var s,l;!function(e){e.Create="Create",e.Update="Update",e.Delete="Delete",e.CacheChanged="CacheChanged"}(s||(t.DatawalletModificationType=s={})),function(e){e.TechnicalData="TechnicalData",e.Userdata="Userdata",e.Metadata="Metadata"}(l||(t.DatawalletModificationCategory=l={}));let c=class DatawalletModification extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.DatawalletModification=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],c.prototype,"localId",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],c.prototype,"objectIdentifier",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],c.prototype,"payloadCategory",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"collection",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"type",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],c.prototype,"payload",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Number)],c.prototype,"datawalletVersion",void 0),t.DatawalletModification=c=n([(0,a.type)("DatawalletModification")],c)},9258:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceMigrations=void 0;t.DeviceMigrations=class DeviceMigrations{constructor(e){this.accountController=e}async v1(){const e={cache:{$exists:!1}},synchronizableToId=e=>e.id.toString(),t=await this.accountController.files.getFiles(e);await this.accountController.files.updateCache(t.map(synchronizableToId));const r=await this.accountController.messages.getMessages(e);await this.accountController.messages.updateCache(r.map(synchronizableToId));const n=await this.accountController.relationships.getRelationships(e);await this.accountController.relationships.updateCache(n.map(synchronizableToId));const i=await this.accountController.relationshipTemplates.getRelationshipTemplates(e);await this.accountController.relationshipTemplates.updateCache(i.map(synchronizableToId));const a=await this.accountController.tokens.getTokens(e);await this.accountController.tokens.updateCache(a.map(synchronizableToId))}}},2864:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityMigrations=void 0;t.IdentityMigrations=class IdentityMigrations{constructor(e){this.accountController=e}v1(){return Promise.resolve()}}},8697:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousTokenController=void 0;const n=r(194),i=r(2890),a=r(2027),o=r(2069),s=r(8342),l=r(4102),c=r(7776);t.AnonymousTokenController=class AnonymousTokenController{constructor(e){this.client=new o.AnonymousTokenClient(e)}async loadPeerTokenByTruncated(e){const t=c.TokenReference.fromTruncated(e);return await this.loadPeerTokenByReference(t)}async loadPeerTokenByReference(e){return await this.loadPeerToken(e.id,e.key)}async loadPeerToken(e,t){const r=(await this.client.getToken(e.toString())).value,o=i.CryptoCipher.fromBase64(r.content),c=await a.CoreCrypto.decrypt(o,t),u=a.CoreSerializable.deserializeUnknown(c.toUtf8());if(!(u instanceof n.Serializable))throw a.CoreErrors.tokens.invalidTokenContent(e.toString());const d=l.Token.from({id:e,secretKey:t,isOwn:!1}),p=s.CachedToken.from({createdAt:a.CoreDate.from(r.createdAt),expiresAt:a.CoreDate.from(r.expiresAt),createdBy:a.CoreAddress.from(r.createdBy),createdByDevice:a.CoreId.from(r.createdByDevice),content:u});return d.setCache(p),d}}},4503:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenController=void 0;const a=r(194),o=r(5172),s=r(2890),l=r(2027),c=r(369),u=r(2508),d=r(6591),p=r(8342),h=r(5898),y=r(4102),g=r(7776);class TokenController extends u.TransportController{constructor(e){super(u.ControllerName.Token,e)}async init(){return await super.init(),this.client=new d.TokenClient(this.config,this.parent.authenticator),this.tokens=await this.parent.getSynchronizedCollection(c.DbCollectionName.Tokens),this}async getTokens(e){const t=await this.tokens.find(e);return this.parseArray(t,y.Token)}async sendToken(e){const t=h.SendTokenParameters.from(e),r=await l.CoreCrypto.generateSecretKey(),n=t.content.serialize(),i=s.CoreBuffer.fromUtf8(n),a=await l.CoreCrypto.encrypt(i,r),o=(await this.client.createToken({content:a.toBase64(),expiresAt:t.expiresAt.toString()})).value,c=p.CachedToken.from({createdAt:l.CoreDate.from(o.createdAt),expiresAt:t.expiresAt,createdBy:this.parent.identity.address,createdByDevice:this.parent.activeDevice.id,content:t.content}),u=y.Token.from({id:l.CoreId.from(o.id),secretKey:r,isOwn:!0,cache:c,cachedAt:l.CoreDate.utc()});return t.ephemeral||await this.tokens.create(u),u}async setTokenMetadata(e,t){const r=e instanceof l.CoreId?e.toString():e.id.toString(),n=await this.tokens.read(r);if(!n)throw l.CoreErrors.general.recordNotFound(y.Token,r.toString());const i=y.Token.from(n);return i.setMetadata(t),await this.tokens.update(n,i),i}async getToken(e){const t=await this.tokens.read(e.toString());return t?y.Token.from(t):void 0}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getTokens({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingTokenInDb(e.id,e));return(await Promise.all(r)).filter((e=>!!e))}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getTokens({ids:e.map((e=>e.id))})).value.collect()).map((async e=>{const t=await this.tokens.read(e.id),r=y.Token.from(t);return{id:l.CoreId.from(e),cache:await this.decryptToken(e,r.secretKey)}}));return await Promise.all(t)}async updateCacheOfExistingTokenInDb(e,t){const r=await this.tokens.read(e);if(!r)return void l.CoreErrors.general.recordNotFound(y.Token,e);const n=y.Token.from(r);return await this.updateCacheOfToken(n,t),await this.tokens.update(r,n),n}async updateCacheOfToken(e,t){const r=e.id.toString();t||(t=(await this.client.getToken(r)).value);const n=await this.decryptToken(t,e.secretKey);e.setCache(n),e.isOwn=this.parent.identity.isMe(n.createdBy)}async decryptToken(e,t){const r=s.CryptoCipher.fromBase64(e.content),n=await l.CoreCrypto.decrypt(r,t),i=l.CoreSerializable.deserializeUnknown(n.toUtf8());if(!(i instanceof a.Serializable))throw l.CoreErrors.tokens.invalidTokenContent(e.id);return p.CachedToken.from({createdAt:l.CoreDate.from(e.createdAt),expiresAt:l.CoreDate.from(e.expiresAt),createdBy:l.CoreAddress.from(e.createdBy),createdByDevice:l.CoreId.from(e.createdByDevice),content:i})}async loadPeerTokenByTruncated(e,t){const r=g.TokenReference.fromTruncated(e);return await this.loadPeerTokenByReference(r,t)}async loadPeerTokenByReference(e,t){return await this.loadPeerToken(e.id,e.key,t)}async loadPeerToken(e,t,r){const n=await this.tokens.read(e.toString());if(n){let t=y.Token.from(n);if(t.cache)return t;if(t=await this.updateCacheOfExistingTokenInDb(e.toString()),!t)throw new l.TransportError(`Tried to update a token (with ID: '${e.toString()}') that doesn't exist in the local database.`);return t}const i=y.Token.from({id:e,secretKey:t,isOwn:!1});return await this.updateCacheOfToken(i),r||await this.tokens.create(i),i}}t.TokenController=TokenController,n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],TokenController.prototype,"setTokenMetadata",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],TokenController.prototype,"updateCacheOfExistingTokenInDb",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[Object,s.CryptoSecretKey]),i("design:returntype",Promise)],TokenController.prototype,"decryptToken",null)},2069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousTokenClient=void 0;const n=r(2027);class AnonymousTokenClient extends n.RESTClient{async getToken(e){return await this.get(`/api/v1/Tokens/${e}`)}}t.AnonymousTokenClient=AnonymousTokenClient},7653:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClient=void 0;const n=r(6054);class TokenClient extends n.RESTClientAuthenticate{async createToken(e){return await this.post("/api/v1/Tokens",e)}async getTokens(e){return await this.getPaged("/api/v1/Tokens",e)}async getToken(e){return await this.get(`/api/v1/Tokens/${e}`)}async deleteToken(e){return await this.delete(`/api/v1/Tokens/${e}`)}}t.TokenClient=TokenClient},8342:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CachedToken=void 0;const a=r(194),o=r(2027);let s=class CachedToken extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.CachedToken=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],s.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],s.prototype,"createdAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],s.prototype,"expiresAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],s.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],s.prototype,"createdByDevice",void 0),t.CachedToken=s=n([(0,a.type)("CachedToken")],s)},5898:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendTokenParameters=void 0;const a=r(194),o=r(2027);let s=class SendTokenParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendTokenParameters=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],s.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],s.prototype,"expiresAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],s.prototype,"ephemeral",void 0),t.SendTokenParameters=s=n([(0,a.type)("SendTokenParameters")],s)},4102:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Token=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(7776),u=r(8342);let d=class Token extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.secretKey)),(0,s.nameof)((e=>e.isOwn))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static from(e){return this.fromAny(e)}toTokenReference(){return c.TokenReference.from({id:this.id,key:this.secretKey})}truncate(){return this.toTokenReference().truncate()}setCache(e){return this.cache=e,this.cachedAt=l.CoreDate.utc(),this}setMetadata(e){this.metadata=e,this.metadataModifiedAt=l.CoreDate.utc()}};t.Token=d,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],d.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],d.prototype,"isOwn",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",u.CachedToken)],d.prototype,"cache",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],d.prototype,"cachedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],d.prototype,"metadata",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],d.prototype,"metadataModifiedAt",void 0),t.Token=d=n([(0,a.type)("Token")],d)},5083:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenContentDeviceSharedSecret=void 0;const a=r(194),o=r(2027),s=r(6758);let l=class TokenContentDeviceSharedSecret extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.TokenContentDeviceSharedSecret=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.DeviceSharedSecret)],l.prototype,"sharedSecret",void 0),t.TokenContentDeviceSharedSecret=l=n([(0,a.type)("TokenContentDeviceSharedSecret")],l)},2238:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenContentFile=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class TokenContentFile extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.TokenContentFile=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],l.prototype,"fileId",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],l.prototype,"secretKey",void 0),t.TokenContentFile=l=n([(0,a.type)("TokenContentFile")],l)},1488:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenContentRelationshipTemplate=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class TokenContentRelationshipTemplate extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.TokenContentRelationshipTemplate=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],l.prototype,"templateId",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],l.prototype,"secretKey",void 0),t.TokenContentRelationshipTemplate=l=n([(0,a.type)("TokenContentRelationshipTemplate")],l)},7776:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenReference=void 0;const i=r(194),a=r(2027);let o=class TokenReference extends a.Reference{static preFrom(e){return super.validateId(e,a.BackboneIds.token),e}static from(e){return super.from(e)}};t.TokenReference=o,t.TokenReference=o=n([(0,i.type)("TokenReference")],o)},1577:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordGenerator=void 0;const n=r(1796),i=r(5833),a=i.RandomCharacterRange.AlphanumericEase+i.RandomCharacterRange.SpecialCharacters;class PasswordGenerator{static async createPassword(e,t=0,r=a){return t<=0&&(t=e),await i.Random.stringRandomLength(e,t,r)}static async createStrongPassword(e=8,t=12){if(e>t&&(t=e),e<8)throw new n.TransportError("Minimum password length for a strong password should be 8 characters.");const r={minLength:1,maxLength:1,allowedChars:i.RandomCharacterRange.SpecialCharacters},o={minLength:1,maxLength:1,allowedChars:i.RandomCharacterRange.LowerCaseEase},s={minLength:1,maxLength:1,allowedChars:i.RandomCharacterRange.UpperCaseEase},l={minLength:e-4,maxLength:t-4,allowedChars:a},c=await i.Random.stringWithBuckets([r,o,s,{minLength:1,maxLength:1,allowedChars:"123456789"},l]);return await i.Random.scramble(c)}static async createUnitPassword(){return`${await i.Random.stringWithBuckets([{minLength:1,maxLength:1,allowedChars:"123456789"},{minLength:0,maxLength:2,allowedChars:"0123456789"},{minLength:0,maxLength:1,allowedChars:","},{minLength:0,maxLength:1,allowedChars:"0123456789"},{minLength:1,maxLength:1,allowedChars:"123456789"}])} ${await this.createPassword(1,0,this.unitsGerman)}`}static async createElementPassword(){return`${await this.createPassword(1,0,this.elementsGerman)} ${await this.createPassword(1,0,i.RandomCharacterRange.Digit)}`}}t.PasswordGenerator=PasswordGenerator,PasswordGenerator.elementsGerman=["Wasserstoff","Helium","Lithium","Beryllium","Bor","Kohlenstoff","Stickstoff","Sauerstoff","Fluor","Neon","Natrium","Magnesium","Aluminium","Silicium","Phosphor","Schwefel","Chlor","Argon","Kalium","Calcium","Scandium","Titan","Vanadium","Chrom","Mangan","Eisen","Cobalt","Nickel","Kupfer","Zink"],PasswordGenerator.unitsGerman=["Kelvin","Mol","Candela","Mikrosekunden","Nanosekunden","Millisekunden","Sekunden","Minuten","Stunden","Tage","Wochen","Monate","Jahre","Seemeilen","Astronomische Einheiten","Parsecs","Lichtjahre","Millimeter","Zentimeter","Meter","Kilometer","Quadratmeter","Ar","Hektar","Milliliter","Zentiliter","Liter","Kubikmeter","Barrel","Gramm","Kilogramm","Tonnen","Pfund","Zentner","Knoten","Newton","Pascal","Bar","Joule","Kilojoule","Megajoule","Wattstunden","Kilowattstunden","Megawattstunden","Kalorien","Kilokalorien","Elektronenvolt","Watt","Kilowatt","Megawatt","Voltampere","Ampere","Milliampere","Ohm","Siemens","Coulomb","Amperestunde","Milliamperestunde","Farad","Kelvin","Grad Celsius","Lumen","Lux","Bit","Byte","Kilobyte","Megabyte","Gigabyte","Terabyte","Etabyte"]},5833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Random=t.RandomCharacterRange=void 0;const n=r(2890),i=r(7429),a=r(1796);var o;!function(e){e.Digit="0123456789",e.DigitEase="123456789",e.Hex="0123456789ABCDEF",e.LowerCase="abcdefghijklmnopqrstuvwxyz",e.LowerCaseEase="abcdefghijkmnpqrstuvwxyz",e.UpperCase="ABCDEFGHIJKLMNOPQRSTUVWXYZ",e.UpperCaseEase="ABCDEFGHJKLMNPQRSTUVWXYZ",e.Alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.Alphanumeric="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e.AlphanumericEase="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz123456789",e.AlphanumericUpperCaseEase="ABCDEFGHJKLMNPQRSTUVWXYZ0123456789",e.GermanUmlaut="ÄÖÜäöü",e.SpecialCharacters="!?-_.:,;#+"}(o||(t.RandomCharacterRange=o={}));class Random{static async bytes(e){return await n.CryptoRandom.bytes(e)}static async int(e){if(e>21||e<=0)throw new a.TransportError("Length must be between 1 and 21.");return parseInt(await this.string(e,o.Digit))}static async array(e){return(await n.CryptoRandom.bytes(e)).toArray()}static uuid(){return(0,i.v4)()}static async scramble(e){const t=[],r=e.split(""),n=e.length;for(let e=0;e<n-1;e++){const i=await Random.intBetween(0,n-1-e);t.push(r.splice(i,1)[0])}return t.push(r[0]),t.join("")}static async intBetween(e,t){if(t<=e)throw new a.TransportError("Max must be larger than min.");const r=t-e+1,n=Math.abs(Math.ceil(Math.log2(r)));if(n>32)throw new a.TransportError("The range between the numbers is too big, 32 bit is the maximum -> 4294967296");const i=Math.ceil(n/8),o=Math.pow(2,n)-1,s=await this.bytes(i);let l=0,c=8*(i-1);for(let e=0;e<i;e++)l+=s.buffer[e]*Math.pow(2,c),c-=8;return l&=o,l>=r?await this.intBetween(e,t):e+l}static async intRandomLength(e,t){if(t>21)throw new a.TransportError("Max must be below 22.");return parseInt(await this.stringRandomLength(e,t,o.Digit))}static async scrambleWithBuckets(e){const t=await this.stringWithBuckets(e);return await this.scramble(t)}static async stringWithBuckets(e){const t=[];for(const r of e)t.push(await this.stringRandomLength(r.minLength,r.maxLength,r.allowedChars));return t.join("")}static async string(e,t=o.Alphanumeric){if(e<=0)return"";if(t.length>256)throw new a.TransportError("Input exceeds maximum length of 256.");const r=[],n=t.length,i=await this.array(e+10),s=255-255%n;for(let a=0;a<e;a++){const e=i[a];e>s||r.push(t[e%n])}let l=r.join("");return l.length<e&&(l+=await this.string(e-l.length,t)),l}static async stringRandomLength(e,t,r){if(e>t)throw new a.TransportError("maxLength must be larger than minLength.");if(e<0)throw new a.TransportError("minlength must not be less than zero.");const n=t>e?await this.intBetween(e,t):t;return await this.string(n,r)}}t.Random=Random},2212:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(1577),t),i(r(5833),t)},4225:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLogger=void 0;const i=n(r(4530));t.SimpleLogger=class SimpleLogger{constructor(e){this.logger=e}trace(...e){this.logger.trace(this.formatMessage(e))}debug(...e){this.logger.debug(this.formatMessage(e))}info(...e){this.logger.info(this.formatMessage(e))}warn(...e){this.logger.warn(this.formatMessage(e))}error(...e){this.logger.error(this.formatMessage(e))}fatal(...e){this.logger.fatal(this.formatMessage(e))}formatMessage(e){return e.map((e=>{var t;return e instanceof Error?null!==(t=e.stack)&&void 0!==t?t:`${e.name}: ${e.message}`:(0,i.default)(e)})).join("\n")}}},7004:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLoggerFactory=void 0;const n=r(9959),i=r(6379),a=r(4225);t.SimpleLoggerFactory=class SimpleLoggerFactory{getLogger(e){const t=this.provider.getLogger(e instanceof Function?e.name:e);return new a.SimpleLogger(t)}constructor(e=n.LogLevel.Warn,t=Math.random().toString(36).substring(7)){this.provider=i.Log4TSProvider.createProvider(t,{groups:[{expression:new RegExp(".*"),level:e}]})}}},2391:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4225),t),i(r(7004),t)},1174:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9159:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEventNamespaceFromObject=t.EventBus=void 0;t.EventBus=class EventBus{},t.getEventNamespaceFromObject=function getEventNamespaceFromObject(e){return e.namespace}},5970:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubscriptionTargetInfo=void 0;class SubscriptionTargetInfo{namespace;constructor(e){this.namespace=e}static from(e){return e instanceof Function?new ConstructorSubscriptionTargetInfo(e):new NamespaceSubscriptionTargetInfo(e)}}t.SubscriptionTargetInfo=SubscriptionTargetInfo;class ConstructorSubscriptionTargetInfo extends SubscriptionTargetInfo{constructorFunction;constructor(e){super(function getEventNamespaceFromClass(e){return e.namespace}(e)),this.constructorFunction=e}isCompatibleWith(e){return e instanceof this.constructorFunction}}class NamespaceSubscriptionTargetInfo extends SubscriptionTargetInfo{constructor(e){super(e)}isCompatibleWith(e){return!0}}},9729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventEmitter2EventBus=void 0;const n=r(6387);r(8660);const i=r(9159),a=r(5970);t.EventEmitter2EventBus=class EventEmitter2EventBus{errorCallback;emitter;listeners=new Map;nextId=0;invocationPromises=[];constructor(e,t){this.errorCallback=e,this.emitter=new n.EventEmitter2({maxListeners:50,verboseMemoryLeak:!0,...t,wildcard:!0})}subscribe(e,t){return this.registerHandler(e,t)}subscribeOnce(e,t){return this.registerHandler(e,t,!0)}unsubscribe(e){return this.unregisterHandler(e)}registerHandler(e,t,r=!1){const n=a.SubscriptionTargetInfo.from(e),i=this.nextId++,handlerWrapper=async e=>{if(!n.isCompatibleWith(e))return;const a=(async()=>await t(e))();this.invocationPromises.push(a),await a.catch((e=>this.errorCallback(e,n.namespace))),this.invocationPromises=this.invocationPromises.filter((e=>e!==a)),r&&this.listeners.delete(i)};if(r){const e=this.emitter.once(n.namespace,handlerWrapper,{objectify:!0});return this.listeners.set(i,e),i}const o=this.emitter.on(n.namespace,handlerWrapper,{objectify:!0});return this.listeners.set(i,o),i}unregisterHandler(e){const t=this.listeners.get(e);return!!t&&(t.off(),this.listeners.delete(e),!0)}publish(e){const t=(0,i.getEventNamespaceFromObject)(e);if(!t)throw Error("The event needs a namespace. Use the EventNamespace-decorator in order to define a namespace for a event.");this.emitter.emit(t,e)}async close(e){this.emitter.removeAllListeners();const t=Promise.all(this.invocationPromises).catch((()=>{}));if(!e)return void await t;let r;const n=new Promise(((t,n)=>{r=setTimeout((()=>{n(new Error("timeout exceeded while waiting for events to process"))}),e)}));await Promise.race([t,n]),clearTimeout(r)}}},9256:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(9159),t),i(r(9729),t)},5917:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataEvent=void 0;const n=r(8267);class DataEvent extends n.Event{data;constructor(e,t){super(e),this.data=t}}t.DataEvent=DataEvent},8267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Event=void 0;t.Event=class Event{namespace;constructor(e){this.namespace=e}}},2636:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5917),t),i(r(8267),t)},5172:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(9256),t),i(r(2636),t),i(r(9855),t),i(r(1809),t),i(r(4569),t),i(r(1174),t),i(r(7226),t),i(r(7374),t)},9855:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.log=void 0;const i=n(r(4530));t.log=function log(e){return function(t,r,n){const a=n.value;return n.value=function(...t){const n=this;try{e?.logParams?n.log.trace(`Calling ${r}(${t.map((e=>(0,i.default)(e))).join(", ")})`):n.log.trace(`Calling ${r}`);const o=a.apply(this,t);return e?.logReturnValue?n.log.trace(`Returning from ${r} with: ${(0,i.default)(o)}`):n.log.trace(`Returning from ${r}`),o}catch(e){throw e instanceof Error&&e.stack&&(e.stack=e.stack.split("\n").filter((e=>!e.includes(".propertyDescriptorDoNotChangeMyNamePlease.value"))).join("\n")),n.log.error(`Error in ${r}:`,e),e}},n}}},1809:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.measureExcecutionTime=void 0,t.measureExcecutionTime=function measureExcecutionTime(e,t,r){const n=r.value;return r.value=async function(...e){const t=Date.now(),r=await n.apply(this,e),i=Date.now();return console.info(`Execution time: ${i-t}ms`),r},r}},4569:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomString=void 0,t.randomString=function randomString(e,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){let r="";const n=t.length;for(let i=0;i<e;i++)r+=t.charAt(Math.floor(Math.random()*n));return r}},7807:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApplicationError=void 0;class ApplicationError extends Error{code;data;constructor(e,t,r){super(t),this.code=e,this.data=r}equals(e){return this.code===e.code}toString(){return JSON.stringify({code:this.code,message:this.message,data:this.data},void 0,2)}}t.ApplicationError=ApplicationError},9278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Result=void 0;class Result{_isSuccess;_error;_value;constructor(e,t,r){if(e&&r)throw new Error("InvalidOperation: A result cannot be successful and contain an error");if(!e&&!r)throw new Error("InvalidOperation: A failing result needs to contain an error");if(void 0!==t&&!e)throw new Error("InvalidOperation: A value is only useful in case of a success.");this._value=t,this._isSuccess=e,this._error=r}get isSuccess(){return this._isSuccess}get isError(){return!this._isSuccess}get error(){return this._error}get value(){if(!this.isSuccess)throw new Error(`Can't get the value of an error result. Use 'error' instead. Root error: \r\n${this.error}`);return this._value}static ok(e){return new Result(!0,e)}static fail(e){return new Result(!1,void 0,e)}}t.Result=Result},7226:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7807),t),i(r(9278),t)},7374:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sleep=void 0,t.sleep=function sleep(e){return new Promise((t=>{setTimeout(t,e)}))}},1924:(e,t,r)=>{"use strict";var n=r(210),i=r(5559),a=i(n("String.prototype.indexOf"));e.exports=function callBoundIntrinsic(e,t){var r=n(e,!!t);return"function"==typeof r&&a(e,".prototype.")>-1?i(r):r}},5559:(e,t,r)=>{"use strict";var n=r(8612),i=r(210),a=r(7771),o=i("%TypeError%"),s=i("%Function.prototype.apply%"),l=i("%Function.prototype.call%"),c=i("%Reflect.apply%",!0)||n.call(l,s),u=i("%Object.defineProperty%",!0),d=i("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function callBind(e){if("function"!=typeof e)throw new o("a function is required");var t=c(n,l,arguments);return a(t,1+d(0,e.length-(arguments.length-1)),!0)};var p=function applyBind(){return c(n,s,arguments)};u?u(e.exports,"apply",{value:p}):e.exports.apply=p},2296:(e,t,r)=>{"use strict";var n=r(1044)(),i=r(210),a=n&&i("%Object.defineProperty%",!0);if(a)try{a({},"a",{value:1})}catch(e){a=!1}var o=i("%SyntaxError%"),s=i("%TypeError%"),l=r(7296);e.exports=function defineDataProperty(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new s("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new s("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],d=!!l&&l(e,t);if(a)a(e,t,{configurable:null===c&&d?d.configurable:!c,enumerable:null===n&&d?d.enumerable:!n,value:r,writable:null===i&&d?d.writable:!i});else{if(!u&&(n||i||c))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},6387:(e,t,r)=>{var n;!function(i){var a=Object.hasOwnProperty,o=Array.isArray?Array.isArray:function _isArray(e){return"[object Array]"===Object.prototype.toString.call(e)},s="object"==typeof process&&"function"==typeof process.nextTick,l="function"==typeof Symbol,c="object"==typeof Reflect,u="function"==typeof setImmediate?setImmediate:setTimeout,d=l?c&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function init(){this._events={},this._conf&&configure.call(this,this._conf)}function configure(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==i&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function logPossibleMemoryLeak(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var toArray=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function toObject(e,t){for(var r={},n=e.length,a=t?t.length:0,o=0;o<n;o++)r[e[o]]=o<a?t[o]:i;return r}function TargetObserver(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=n,this._off=i;var a=e._observers;a?a.push(this):e._observers=[this]}function resolveOptions(e,t,r,n){var o=Object.assign({},t);if(!e)return o;if("object"!=typeof e)throw TypeError("options must be an object");var s,l,c,u=Object.keys(e),d=u.length;function reject(e){throw Error('Invalid "'+s+'" option value'+(e?". Reason: "+e:""))}for(var p=0;p<d;p++){if(s=u[p],!n&&!a.call(t,s))throw Error('Unknown "'+s+'" option');(l=e[s])!==i&&(c=r[s],o[s]=c?c(l,reject):l)}return o}function constructorReducer(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function makeTypeReducer(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var a=typeof e;if(a===n||a===i)return e;r(t)}:function(n,i){for(var a=typeof n,o=r;o-- >0;)if(a===e[o])return n;i(t)}}Object.assign(TargetObserver.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,a=this._emitter,o=this._listeners,handler=function(){var n=toArray.apply(null,arguments),o={data:n,name:t,original:e};r?!1!==r.call(i,o)&&a.emit.apply(a,[o.name].concat(n)):a.emit.apply(a,[t].concat(n))};if(o[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,a._newListener&&a._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===o[e]&&(o[e]=handler,n._on.call(i,e,handler))},a.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!a.hasListeners(r)&&o[e]&&(o[e]=null,n._off.call(i,e,handler))},o[e]=null,a.on("removeListener",this._onRemoveListener)):(o[e]=handler,n._on.call(i,e,handler))},unsubscribe:function(e){var t,r,n,i=this,a=this._listeners,o=this._emitter,s=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function clearRefs(){i._onNewListener&&(o.off("newListener",i._onNewListener),o.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=findTargetIndex.call(o,i);o._observers.splice(e,1)}if(e){if(!(t=a[e]))return;s.call(l,e,t),delete a[e],--this._listenersCount||clearRefs()}else{for(n=(r=d(a)).length;n-- >0;)e=r[n],s.call(l,e,a[e]);this._listeners={},this._listenersCount=0,clearRefs()}}});var p=makeTypeReducer(["function"]),h=makeTypeReducer(["object","function"]);function makeCancelablePromise(e,t,r){var n,i,a,o=0,s=new e((function(l,c,u){function cleanup(){i&&(i=null),o&&(clearTimeout(o),o=0)}r=resolveOptions(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var _resolve=function(e){cleanup(),l(e)},_reject=function(e){cleanup(),c(e)};n?t(_resolve,_reject,u):(i=[function(e){_reject(e||Error("canceled"))}],t(_resolve,_reject,(function(e){if(a)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),a=!0),r.timeout>0&&(o=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",o=0,s.cancel(e),c(e)}),r.timeout))}));return n||(s.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),s}function findTargetIndex(e){var t=this._observers;if(!t)return-1;for(var r=t.length,n=0;n<r;n++)if(t[n]._target===e)return n;return-1}function searchListenerTree(e,t,r,n,i){if(!r)return null;if(0===n){var a=typeof t;if("string"===a){var o,s,l=0,c=0,u=this.delimiter,p=u.length;if(-1!==(s=t.indexOf(u))){o=new Array(5);do{o[l++]=t.slice(c,s),c=s+p}while(-1!==(s=t.indexOf(u,c)));o[l++]=t.slice(c),t=o,i=l}else t=[t],i=1}else"object"===a?i=t.length:(t=[t],i=1)}var h,y,g,m,v,b,w,C=null,S=t[n],_=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),C=[r]):(e&&e.push.apply(e,r._listeners),C=[r]));else{if("*"===S){for(s=(b=d(r)).length;s-- >0;)"_listeners"!==(h=b[s])&&(w=searchListenerTree(e,t,r[h],n+1,i))&&(C?C.push.apply(C,w):C=w);return C}if("**"===S){for((v=n+1===i||n+2===i&&"*"===_)&&r._listeners&&(C=searchListenerTree(e,t,r,i,i)),s=(b=d(r)).length;s-- >0;)"_listeners"!==(h=b[s])&&("*"===h||"**"===h?(r[h]._listeners&&!v&&(w=searchListenerTree(e,t,r[h],i,i))&&(C?C.push.apply(C,w):C=w),w=searchListenerTree(e,t,r[h],n,i)):w=searchListenerTree(e,t,r[h],h===_?n+2:n,i),w&&(C?C.push.apply(C,w):C=w));return C}r[S]&&(C=searchListenerTree(e,t,r[S],n+1,i))}if((y=r["*"])&&searchListenerTree(e,t,y,n+1,i),g=r["**"])if(n<i)for(g._listeners&&searchListenerTree(e,t,g,i,i),s=(b=d(g)).length;s-- >0;)"_listeners"!==(h=b[s])&&(h===_?searchListenerTree(e,t,g[h],n+2,i):h===S?searchListenerTree(e,t,g[h],n+1,i):((m={})[h]=g[h],searchListenerTree(e,t,{"**":m},n+1,i)));else g._listeners?searchListenerTree(e,t,g,i,i):g["*"]&&g["*"]._listeners&&searchListenerTree(e,t,g["*"],i,i);return C}function growListenerTree(e,t,r){var n,i,a=0,o=0,s=this.delimiter,l=s.length;if("string"==typeof e)if(-1!==(n=e.indexOf(s))){i=new Array(5);do{i[a++]=e.slice(o,n),o=n+l}while(-1!==(n=e.indexOf(s,o)));i[a++]=e.slice(o)}else i=[e],a=1;else i=e,a=e.length;if(a>1)for(n=0;n+1<a;n++)if("**"===i[n]&&"**"===i[n+1])return;var c,u=this.listenerTree;for(n=0;n<a;n++)if(u=u[c=i[n]]||(u[c]={}),n===a-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),r?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,logPossibleMemoryLeak.call(this,u._listeners.length,c))):u._listeners=t,!0;return!0}function collectTreeEvents(e,t,r,n){for(var i,a,o,s,l=d(e),c=l.length,u=e._listeners;c-- >0;)i=e[a=l[c]],o="_listeners"===a?r:r?r.concat(a):[a],s=n||"symbol"==typeof a,u&&t.push(s?o:o.join(this.delimiter)),"object"==typeof i&&collectTreeEvents.call(this,i,t,o,s);return t}function recursivelyGarbageCollect(e){for(var t,r,n,i=d(e),a=i.length;a-- >0;)(t=e[r=i[a]])&&(n=!0,"_listeners"===r||recursivelyGarbageCollect(t)||delete e[r]);return n}function Listener(e,t,r){this.emitter=e,this.event=t,this.listener=r}function setupListener(e,t,r){if(!0===r)a=!0;else if(!1===r)n=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var n=r.async,a=r.promisify,o=r.nextTick,l=r.objectify}if(n||o||a){var c=t,d=t._origin||t;if(o&&!s)throw Error("process.nextTick is not supported");a===i&&(a="AsyncFunction"===t.constructor.name),t=function(){var e=arguments,t=this,r=this.event;return a?o?Promise.resolve():new Promise((function(e){u(e)})).then((function(){return t.event=r,c.apply(t,e)})):(o?process.nextTick:u)((function(){t.event=r,c.apply(t,e)}))},t._async=!0,t._origin=d}return[t,l?new Listener(this,e,t):this]}function EventEmitter(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,configure.call(this,e)}Listener.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},EventEmitter.EventEmitter2=EventEmitter,EventEmitter.prototype.listenTo=function(e,t,r){if("object"!=typeof e)throw TypeError("target musts be an object");var n=this;function listen(t){if("object"!=typeof t)throw TypeError("events must be an object");var i,a=r.reducers,o=findTargetIndex.call(n,e);i=-1===o?new TargetObserver(n,e,r):n._observers[o];for(var s,l=d(t),c=l.length,u="function"==typeof a,p=0;p<c;p++)s=l[p],i.subscribe(s,t[s]||s,u?a:a&&a[s])}return r=resolveOptions(r,{on:i,off:i,reducers:i},{on:p,off:p,reducers:h}),o(t)?listen(toObject(t)):listen("string"==typeof t?toObject(t.split(/\s+/)):t),this},EventEmitter.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,a=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),a=!0);return a},EventEmitter.prototype.delimiter=".",EventEmitter.prototype.setMaxListeners=function(e){e!==i&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},EventEmitter.prototype.getMaxListeners=function(){return this._maxListeners},EventEmitter.prototype.event="",EventEmitter.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},EventEmitter.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},EventEmitter.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},EventEmitter.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},EventEmitter.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},EventEmitter.prototype._many=function(e,t,r,n,i){var a=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function listener(){return 0==--t&&a.off(e,listener),r.apply(this,arguments)}return listener._origin=r,this._on(e,listener,n,i)},EventEmitter.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||init.call(this);var e,t,r,n,i,a,o=arguments[0],s=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(s&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,l)for(n=0;n<r;n++)if("symbol"==typeof o[n]){a=!0;break}a||(o=o.join(this.delimiter))}var c,u=arguments.length;if(this._all&&this._all.length)for(n=0,r=(c=this._all.slice()).length;n<r;n++)switch(this.event=o,u){case 1:c[n].call(this,o);break;case 2:c[n].call(this,o,arguments[1]);break;case 3:c[n].call(this,o,arguments[1],arguments[2]);break;default:c[n].apply(this,arguments)}if(s)c=[],searchListenerTree.call(this,c,e,this.listenerTree,0,r);else{if("function"==typeof(c=this._events[o])){switch(this.event=o,u){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(u-1),i=1;i<u;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(u>3)for(t=new Array(u-1),i=1;i<u;i++)t[i-1]=arguments[i];for(n=0,r=c.length;n<r;n++)switch(this.event=o,u){case 1:c[n].call(this);break;case 2:c[n].call(this,arguments[1]);break;case 3:c[n].call(this,arguments[1],arguments[2]);break;default:c[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},EventEmitter.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||init.call(this);var e,t,r,n,i,a,o=arguments[0],s=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(s&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,l)for(i=0;i<n;i++)if("symbol"==typeof o[i]){t=!0;break}t||(o=o.join(this.delimiter))}var c,u=[],d=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=o,d){case 1:u.push(this._all[i].call(this,o));break;case 2:u.push(this._all[i].call(this,o,arguments[1]));break;case 3:u.push(this._all[i].call(this,o,arguments[1],arguments[2]));break;default:u.push(this._all[i].apply(this,arguments))}if(s?(c=[],searchListenerTree.call(this,c,e,this.listenerTree,0)):c=this._events[o],"function"==typeof c)switch(this.event=o,d){case 1:u.push(c.call(this));break;case 2:u.push(c.call(this,arguments[1]));break;case 3:u.push(c.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(d-1),a=1;a<d;a++)r[a-1]=arguments[a];u.push(c.apply(this,r))}else if(c&&c.length){if(c=c.slice(),d>3)for(r=new Array(d-1),a=1;a<d;a++)r[a-1]=arguments[a];for(i=0,n=c.length;i<n;i++)switch(this.event=o,d){case 1:u.push(c[i].call(this));break;case 2:u.push(c[i].call(this,arguments[1]));break;case 3:u.push(c[i].call(this,arguments[1],arguments[2]));break;default:u.push(c[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(u)},EventEmitter.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},EventEmitter.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},EventEmitter.prototype.onAny=function(e){return this._onAny(e,!1)},EventEmitter.prototype.prependAny=function(e){return this._onAny(e,!0)},EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},EventEmitter.prototype._on=function(e,t,r,n){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");this._events||init.call(this);var a,o=this;return n!==i&&(t=(a=setupListener.call(this,e,t,n))[0],o=a[1]),this._newListener&&this.emit("newListener",e,t),this.wildcard?(growListenerTree.call(this,e,t,r),o):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,logPossibleMemoryLeak.call(this,this._events[e].length,e))):this._events[e]=t,o)},EventEmitter.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();if(!(n=searchListenerTree.call(this,null,i,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var a=0;a<n.length;a++){var s=n[a];if(r=s._listeners,o(r)){for(var l=-1,c=0,u=r.length;c<u;c++)if(r[c]===t||r[c].listener&&r[c].listener===t||r[c]._origin&&r[c]._origin===t){l=c;break}if(l<0)continue;return this.wildcard?s._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete s._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete s._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&recursivelyGarbageCollect(this.listenerTree),this},EventEmitter.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},EventEmitter.prototype.removeListener=EventEmitter.prototype.off,EventEmitter.prototype.removeAllListeners=function(e){if(e===i)return!this._events||init.call(this),this;if(this.wildcard){var t,r=searchListenerTree.call(this,null,e,this.listenerTree,0);if(!r)return this;for(t=0;t<r.length;t++)r[t]._listeners=null;this.listenerTree&&recursivelyGarbageCollect(this.listenerTree)}else this._events&&(this._events[e]=null);return this},EventEmitter.prototype.listeners=function(e){var t,r,n,a,o,s=this._events;if(e===i){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!s)return[];for(a=(t=d(s)).length,n=[];a-- >0;)"function"==typeof(r=s[t[a]])?n.push(r):n.push.apply(n,r);return n}if(this.wildcard){if(!(o=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return searchListenerTree.call(this,l,c,o,0),l}return s&&(r=s[e])?"function"==typeof r?[r]:r:[]},EventEmitter.prototype.eventNames=function(e){var t=this._events;return this.wildcard?collectTreeEvents.call(this,this.listenerTree,[],null,e):t?d(t):[]},EventEmitter.prototype.listenerCount=function(e){return this.listeners(e).length},EventEmitter.prototype.hasListeners=function(e){if(this.wildcard){var t=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return searchListenerTree.call(this,t,r,this.listenerTree,0),t.length>0}var n=this._events,a=this._all;return!!(a&&a.length||n&&(e===i?d(n).length:n[e]))},EventEmitter.prototype.listenersAny=function(){return this._all?this._all:[]},EventEmitter.prototype.waitFor=function(e,t){var r=this,n=typeof t;return"number"===n?t={timeout:t}:"function"===n&&(t={filter:t}),makeCancelablePromise((t=resolveOptions(t,{timeout:0,filter:i,handleError:!1,Promise,overload:!1},{filter:p,Promise:constructorReducer})).Promise,(function(n,i,a){function listener(){var a=t.filter;if(!a||a.apply(r,arguments))if(r.off(e,listener),t.handleError){var o=arguments[0];o?i(o):n(toArray.apply(null,arguments).slice(1))}else n(toArray.apply(null,arguments))}a((function(){r.off(e,listener)})),r._on(e,listener,!1)}),{timeout:t.timeout,overload:t.overload})};var y=EventEmitter.prototype;Object.defineProperties(EventEmitter,{defaultMaxListeners:{get:function(){return y._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");y._maxListeners=e},enumerable:!0},once:{value:function once(e,t,r){return makeCancelablePromise((r=resolveOptions(r,{Promise,timeout:0,overload:!1},{Promise:constructorReducer})).Promise,(function(r,n,i){var a;if("function"==typeof e.addEventListener)return a=function(){r(toArray.apply(null,arguments))},i((function(){e.removeEventListener(t,a)})),void e.addEventListener(t,a,{once:!0});var o,eventListener=function(){o&&e.removeListener("error",o),r(toArray.apply(null,arguments))};"error"!==t&&(o=function(r){e.removeListener(t,eventListener),n(r)},e.once("error",o)),i((function(){o&&e.removeListener("error",o),e.removeListener(t,eventListener)})),e.once(t,eventListener)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(y,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),(n=function(){return EventEmitter}.call(t,r,t,e))===i||(e.exports=n)}()},6230:e=>{e.exports="object"==typeof self?self.FormData:window.FormData},7648:e=>{"use strict";var t=Object.prototype.toString,r=Math.max,n=function concatty(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r};e.exports=function bind(e){var i=this;if("function"!=typeof i||"[object Function]"!==t.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var a,o=function slicy(e,t){for(var r=[],n=t||0,i=0;n<e.length;n+=1,i+=1)r[i]=e[n];return r}(arguments,1),s=r(0,i.length-o.length),l=[],c=0;c<s;c++)l[c]="$"+c;if(a=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r}(l,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof a){var t=i.apply(this,n(o,arguments));return Object(t)===t?t:this}return i.apply(e,n(o,arguments))})),i.prototype){var u=function Empty(){};u.prototype=i.prototype,a.prototype=new u,u.prototype=null}return a}},8612:(e,t,r)=>{"use strict";var n=r(7648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,i=SyntaxError,a=Function,o=TypeError,getEvalledConstructor=function(e){try{return a('"use strict"; return ('+e+").constructor;")()}catch(e){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(e){s=null}var throwTypeError=function(){throw new o},l=s?function(){try{return throwTypeError}catch(e){try{return s(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,c=r(1405)(),u=r(8185)(),d=Object.getPrototypeOf||(u?function(e){return e.__proto__}:null),p={},h="undefined"!=typeof Uint8Array&&d?d(Uint8Array):n,y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":c&&d?d([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":a,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":c&&d?d(d([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&c&&d?d((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&c&&d?d((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":c&&d?d(""[Symbol.iterator]()):n,"%Symbol%":c?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":l,"%TypedArray%":h,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(d)try{null.error}catch(e){var g=d(d(e));y["%Error.prototype%"]=g}var m=function doEval(e){var t;if("%AsyncFunction%"===e)t=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===e)t=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===e)t=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===e){var r=doEval("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=doEval("%AsyncGenerator%");n&&d&&(t=d(n.prototype))}return y[e]=t,t},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=r(8612),w=r(8824),C=b.call(Function.call,Array.prototype.concat),S=b.call(Function.apply,Array.prototype.splice),_=b.call(Function.call,String.prototype.replace),R=b.call(Function.call,String.prototype.slice),O=b.call(Function.call,RegExp.prototype.exec),T=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,I=/\\(\\)?/g,E=function getBaseIntrinsic(e,t){var r,n=e;if(w(v,n)&&(n="%"+(r=v[n])[0]+"%"),w(y,n)){var a=y[n];if(a===p&&(a=m(n)),void 0===a&&!t)throw new o("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:a}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function GetIntrinsic(e,t){if("string"!=typeof e||0===e.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');if(null===O(/^%?[^%]*%?$/,e))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function stringToPath(e){var t=R(e,0,1),r=R(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return _(e,T,(function(e,t,r,i){n[n.length]=r?_(i,I,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",a=E("%"+n+"%",t),l=a.name,c=a.value,u=!1,d=a.alias;d&&(n=d[0],S(r,C([0,1],d)));for(var p=1,h=!0;p<r.length;p+=1){var g=r[p],m=R(g,0,1),v=R(g,-1);if(('"'===m||"'"===m||"`"===m||'"'===v||"'"===v||"`"===v)&&m!==v)throw new i("property names with quotes must have matching quotes");if("constructor"!==g&&h||(u=!0),w(y,l="%"+(n+="."+g)+"%"))c=y[l];else if(null!=c){if(!(g in c)){if(!t)throw new o("base intrinsic for "+e+" exists, but the property is not available.");return}if(s&&p+1>=r.length){var b=s(c,g);c=(h=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:c[g]}else h=w(c,g),c=c[g];h&&!u&&(y[l]=c)}}return c}},7296:(e,t,r)=>{"use strict";var n=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},1044:(e,t,r)=>{"use strict";var n=r(210)("%Object.defineProperty%",!0),i=function hasPropertyDescriptors(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};i.hasArrayLengthDefineBug=function hasArrayLengthDefineBug(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},8185:e=>{"use strict";var t={foo:{}},r=Object;e.exports=function hasProto(){return{__proto__:t}.foo===t.foo&&!({__proto__:null}instanceof r)}},1405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(5419);e.exports=function hasNativeSymbols(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},5419:e=>{"use strict";e.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},8824:(e,t,r)=>{"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,a=r(8612);e.exports=a.call(n,i)},4530:(e,t)=>{function serializer(e,t){var r=[],n=[];return null==t&&(t=function(e,t){return r[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(t)).join(".")+"]"}),function(i,a){if(r.length>0){var o=r.indexOf(this);~o?r.splice(o+1):r.push(this),~o?n.splice(o,1/0,i):n.push(i),~r.indexOf(a)&&(a=t.call(this,i,a))}else r.push(a);return null==e?a:e.call(this,i,a)}}(e.exports=function stringify(e,t,r,n){return JSON.stringify(e,serializer(t,n),r)}).getSerialize=serializer},6486:function(e,t,r){var n;e=r.nmd(e),function(){var i,a="Expected a function",o="__lodash_hash_undefined__",s="__lodash_placeholder__",l=16,c=32,u=64,d=128,p=256,h=1/0,y=9007199254740991,g=NaN,m=4294967295,v=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",l],["flip",512],["partial",c],["partialRight",u],["rearg",p]],b="[object Arguments]",w="[object Array]",C="[object Boolean]",S="[object Date]",_="[object Error]",R="[object Function]",O="[object GeneratorFunction]",T="[object Map]",I="[object Number]",E="[object Object]",D="[object Promise]",P="[object RegExp]",A="[object Set]",j="[object String]",M="[object Symbol]",x="[object WeakMap]",k="[object ArrayBuffer]",L="[object DataView]",F="[object Float32Array]",N="[object Float64Array]",z="[object Int8Array]",B="[object Int16Array]",U="[object Int32Array]",W="[object Uint8Array]",V="[object Uint8ClampedArray]",q="[object Uint16Array]",$="[object Uint32Array]",K=/\b__p \+= '';/g,H=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Z=/&(?:amp|lt|gt|quot|#39);/g,J=/[&<>"']/g,Y=RegExp(Z.source),Q=RegExp(J.source),X=/<%-([\s\S]+?)%>/g,ee=/<%([\s\S]+?)%>/g,te=/<%=([\s\S]+?)%>/g,re=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,ie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ae=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(ae.source),se=/^\s+/,le=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,de=/,? & /,fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,pe=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,ye=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ge=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ve=/^0b[01]+$/i,be=/^\[object .+?Constructor\]$/,we=/^0o[0-7]+$/i,Ce=/^(?:0|[1-9]\d*)$/,Se=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,Re=/['\n\r\u2028\u2029\\]/g,Oe="\\ud800-\\udfff",Te="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ie="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",De="A-Z\\xc0-\\xd6\\xd8-\\xde",Pe="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="['’]",Me="["+Oe+"]",xe="["+Ae+"]",ke="["+Te+"]",Le="\\d+",Fe="["+Ie+"]",Ne="["+Ee+"]",ze="[^"+Oe+Ae+Le+Ie+Ee+De+"]",Be="\\ud83c[\\udffb-\\udfff]",Ue="[^"+Oe+"]",We="(?:\\ud83c[\\udde6-\\uddff]){2}",Ve="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+De+"]",$e="\\u200d",Ke="(?:"+Ne+"|"+ze+")",He="(?:"+qe+"|"+ze+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",Ze="(?:['’](?:D|LL|M|RE|S|T|VE))?",Je="(?:"+ke+"|"+Be+")"+"?",Ye="["+Pe+"]?",Qe=Ye+Je+("(?:"+$e+"(?:"+[Ue,We,Ve].join("|")+")"+Ye+Je+")*"),Xe="(?:"+[Fe,We,Ve].join("|")+")"+Qe,et="(?:"+[Ue+ke+"?",ke,We,Ve,Me].join("|")+")",tt=RegExp(je,"g"),rt=RegExp(ke,"g"),nt=RegExp(Be+"(?="+Be+")|"+et+Qe,"g"),it=RegExp([qe+"?"+Ne+"+"+Ge+"(?="+[xe,qe,"$"].join("|")+")",He+"+"+Ze+"(?="+[xe,qe+Ke,"$"].join("|")+")",qe+"?"+Ke+"+"+Ge,qe+"+"+Ze,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Le,Xe].join("|"),"g"),at=RegExp("["+$e+Oe+Te+Pe+"]"),ot=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,st=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],lt=-1,ct={};ct[F]=ct[N]=ct[z]=ct[B]=ct[U]=ct[W]=ct[V]=ct[q]=ct[$]=!0,ct[b]=ct[w]=ct[k]=ct[C]=ct[L]=ct[S]=ct[_]=ct[R]=ct[T]=ct[I]=ct[E]=ct[P]=ct[A]=ct[j]=ct[x]=!1;var ut={};ut[b]=ut[w]=ut[k]=ut[L]=ut[C]=ut[S]=ut[F]=ut[N]=ut[z]=ut[B]=ut[U]=ut[T]=ut[I]=ut[E]=ut[P]=ut[A]=ut[j]=ut[M]=ut[W]=ut[V]=ut[q]=ut[$]=!0,ut[_]=ut[R]=ut[x]=!1;var dt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ft=parseFloat,pt=parseInt,ht="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,yt="object"==typeof self&&self&&self.Object===Object&&self,gt=ht||yt||Function("return this")(),mt=t&&!t.nodeType&&t,vt=mt&&e&&!e.nodeType&&e,bt=vt&&vt.exports===mt,wt=bt&&ht.process,Ct=function(){try{var e=vt&&vt.require&&vt.require("util").types;return e||wt&&wt.binding&&wt.binding("util")}catch(e){}}(),St=Ct&&Ct.isArrayBuffer,_t=Ct&&Ct.isDate,Rt=Ct&&Ct.isMap,Ot=Ct&&Ct.isRegExp,Tt=Ct&&Ct.isSet,It=Ct&&Ct.isTypedArray;function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function arrayAggregator(e,t,r,n){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(n,o,r(o),e)}return n}function arrayEach(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function arrayEachRight(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function arrayEvery(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function arrayFilter(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}function arrayIncludes(e,t){return!!(null==e?0:e.length)&&baseIndexOf(e,t,0)>-1}function arrayIncludesWith(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function arrayPush(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function arrayReduce(e,t,r,n){var i=-1,a=null==e?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function arrayReduceRight(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function arraySome(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Et=baseProperty("length");function baseFindKey(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function baseFindIndex(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function baseIndexOf(e,t,r){return t==t?function strictIndexOf(e,t,r){var n=r-1,i=e.length;for(;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):baseFindIndex(e,baseIsNaN,r)}function baseIndexOfWith(e,t,r,n){for(var i=r-1,a=e.length;++i<a;)if(n(e[i],t))return i;return-1}function baseIsNaN(e){return e!=e}function baseMean(e,t){var r=null==e?0:e.length;return r?baseSum(e,t)/r:g}function baseProperty(e){return function(t){return null==t?i:t[e]}}function basePropertyOf(e){return function(t){return null==e?i:e[t]}}function baseReduce(e,t,r,n,i){return i(e,(function(e,i,a){r=n?(n=!1,e):t(r,e,i,a)})),r}function baseSum(e,t){for(var r,n=-1,a=e.length;++n<a;){var o=t(e[n]);o!==i&&(r=r===i?o:r+o)}return r}function baseTimes(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function baseTrim(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(se,""):e}function baseUnary(e){return function(t){return e(t)}}function baseValues(e,t){return arrayMap(t,(function(t){return e[t]}))}function cacheHas(e,t){return e.has(t)}function charsStartIndex(e,t){for(var r=-1,n=e.length;++r<n&&baseIndexOf(t,e[r],0)>-1;);return r}function charsEndIndex(e,t){for(var r=e.length;r--&&baseIndexOf(t,e[r],0)>-1;);return r}var Dt=basePropertyOf({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Pt=basePropertyOf({"&":"&","<":"<",">":">",'"':""","'":"'"});function escapeStringChar(e){return"\\"+dt[e]}function hasUnicode(e){return at.test(e)}function mapToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function overArg(e,t){return function(r){return e(t(r))}}function replaceHolders(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r];o!==t&&o!==s||(e[r]=s,a[i++]=r)}return a}function setToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function setToPairs(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}function stringSize(e){return hasUnicode(e)?function unicodeSize(e){var t=nt.lastIndex=0;for(;nt.test(e);)++t;return t}(e):Et(e)}function stringToArray(e){return hasUnicode(e)?function unicodeToArray(e){return e.match(nt)||[]}(e):function asciiToArray(e){return e.split("")}(e)}function trimmedEndIndex(e){for(var t=e.length;t--&&le.test(e.charAt(t)););return t}var At=basePropertyOf({"&":"&","<":"<",">":">",""":'"',"'":"'"});var jt=function runInContext(e){var t,r=(e=null==e?gt:jt.defaults(gt.Object(),e,jt.pick(gt,st))).Array,n=e.Date,le=e.Error,Oe=e.Function,Te=e.Math,Ie=e.Object,Ee=e.RegExp,De=e.String,Pe=e.TypeError,Ae=r.prototype,je=Oe.prototype,Me=Ie.prototype,xe=e["__core-js_shared__"],ke=je.toString,Le=Me.hasOwnProperty,Fe=0,Ne=(t=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"",ze=Me.toString,Be=ke.call(Ie),Ue=gt._,We=Ee("^"+ke.call(Le).replace(ae,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=bt?e.Buffer:i,qe=e.Symbol,$e=e.Uint8Array,Ke=Ve?Ve.allocUnsafe:i,He=overArg(Ie.getPrototypeOf,Ie),Ge=Ie.create,Ze=Me.propertyIsEnumerable,Je=Ae.splice,Ye=qe?qe.isConcatSpreadable:i,Qe=qe?qe.iterator:i,Xe=qe?qe.toStringTag:i,et=function(){try{var e=getNative(Ie,"defineProperty");return e({},"",{}),e}catch(e){}}(),nt=e.clearTimeout!==gt.clearTimeout&&e.clearTimeout,at=n&&n.now!==gt.Date.now&&n.now,dt=e.setTimeout!==gt.setTimeout&&e.setTimeout,ht=Te.ceil,yt=Te.floor,mt=Ie.getOwnPropertySymbols,vt=Ve?Ve.isBuffer:i,wt=e.isFinite,Ct=Ae.join,Et=overArg(Ie.keys,Ie),Mt=Te.max,xt=Te.min,kt=n.now,Lt=e.parseInt,Ft=Te.random,Nt=Ae.reverse,zt=getNative(e,"DataView"),Bt=getNative(e,"Map"),Ut=getNative(e,"Promise"),Wt=getNative(e,"Set"),Vt=getNative(e,"WeakMap"),qt=getNative(Ie,"create"),$t=Vt&&new Vt,Kt={},Ht=toSource(zt),Gt=toSource(Bt),Zt=toSource(Ut),Jt=toSource(Wt),Yt=toSource(Vt),Qt=qe?qe.prototype:i,Xt=Qt?Qt.valueOf:i,er=Qt?Qt.toString:i;function lodash(e){if(isObjectLike(e)&&!an(e)&&!(e instanceof LazyWrapper)){if(e instanceof LodashWrapper)return e;if(Le.call(e,"__wrapped__"))return wrapperClone(e)}return new LodashWrapper(e)}var tr=function(){function object(){}return function(e){if(!isObject(e))return{};if(Ge)return Ge(e);object.prototype=e;var t=new object;return object.prototype=i,t}}();function baseLodash(){}function LodashWrapper(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function LazyWrapper(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new MapCache;++t<r;)this.add(e[t])}function Stack(e){var t=this.__data__=new ListCache(e);this.size=t.size}function arrayLikeKeys(e,t){var r=an(e),n=!r&&nn(e),i=!r&&!n&&sn(e),a=!r&&!n&&!i&&fn(e),o=r||n||i||a,s=o?baseTimes(e.length,De):[],l=s.length;for(var c in e)!t&&!Le.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||isIndex(c,l))||s.push(c);return s}function arraySample(e){var t=e.length;return t?e[baseRandom(0,t-1)]:i}function arraySampleSize(e,t){return shuffleSelf(copyArray(e),baseClamp(t,0,e.length))}function arrayShuffle(e){return shuffleSelf(copyArray(e))}function assignMergeValue(e,t,r){(r!==i&&!eq(e[t],r)||r===i&&!(t in e))&&baseAssignValue(e,t,r)}function assignValue(e,t,r){var n=e[t];Le.call(e,t)&&eq(n,r)&&(r!==i||t in e)||baseAssignValue(e,t,r)}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}function baseAggregator(e,t,r,n){return rr(e,(function(e,i,a){t(n,e,r(e),a)})),n}function baseAssign(e,t){return e&©Object(t,keys(t),e)}function baseAssignValue(e,t,r){"__proto__"==t&&et?et(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function baseAt(e,t){for(var n=-1,a=t.length,o=r(a),s=null==e;++n<a;)o[n]=s?i:get(e,t[n]);return o}function baseClamp(e,t,r){return e==e&&(r!==i&&(e=e<=r?e:r),t!==i&&(e=e>=t?e:t)),e}function baseClone(e,t,r,n,a,o){var s,l=1&t,c=2&t,u=4&t;if(r&&(s=a?r(e,n,a,o):r(e)),s!==i)return s;if(!isObject(e))return e;var d=an(e);if(d){if(s=function initCloneArray(e){var t=e.length,r=new e.constructor(t);t&&"string"==typeof e[0]&&Le.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!l)return copyArray(e,s)}else{var p=hr(e),h=p==R||p==O;if(sn(e))return cloneBuffer(e,l);if(p==E||p==b||h&&!a){if(s=c||h?{}:initCloneObject(e),!l)return c?function copySymbolsIn(e,t){return copyObject(e,pr(e),t)}(e,function baseAssignIn(e,t){return e&©Object(t,keysIn(t),e)}(s,e)):function copySymbols(e,t){return copyObject(e,fr(e),t)}(e,baseAssign(s,e))}else{if(!ut[p])return a?e:{};s=function initCloneByTag(e,t,r){var n=e.constructor;switch(t){case k:return cloneArrayBuffer(e);case C:case S:return new n(+e);case L:return function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case F:case N:case z:case B:case U:case W:case V:case q:case $:return cloneTypedArray(e,r);case T:return new n;case I:case j:return new n(e);case P:return function cloneRegExp(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new n;case M:return function cloneSymbol(e){return Xt?Ie(Xt.call(e)):{}}(e)}}(e,p,l)}}o||(o=new Stack);var y=o.get(e);if(y)return y;o.set(e,s),dn(e)?e.forEach((function(n){s.add(baseClone(n,t,r,n,e,o))})):cn(e)&&e.forEach((function(n,i){s.set(i,baseClone(n,t,r,i,e,o))}));var g=d?i:(u?c?getAllKeysIn:getAllKeys:c?keysIn:keys)(e);return arrayEach(g||e,(function(n,i){g&&(n=e[i=n]),assignValue(s,i,baseClone(n,t,r,i,e,o))})),s}function baseConformsTo(e,t,r){var n=r.length;if(null==e)return!n;for(e=Ie(e);n--;){var a=r[n],o=t[a],s=e[a];if(s===i&&!(a in e)||!o(s))return!1}return!0}function baseDelay(e,t,r){if("function"!=typeof e)throw new Pe(a);return mr((function(){e.apply(i,r)}),t)}function baseDifference(e,t,r,n){var i=-1,a=arrayIncludes,o=!0,s=e.length,l=[],c=t.length;if(!s)return l;r&&(t=arrayMap(t,baseUnary(r))),n?(a=arrayIncludesWith,o=!1):t.length>=200&&(a=cacheHas,o=!1,t=new SetCache(t));e:for(;++i<s;){var u=e[i],d=null==r?u:r(u);if(u=n||0!==u?u:0,o&&d==d){for(var p=c;p--;)if(t[p]===d)continue e;l.push(u)}else a(t,d,n)||l.push(u)}return l}lodash.templateSettings={escape:X,evaluate:ee,interpolate:te,variable:"",imports:{_:lodash}},lodash.prototype=baseLodash.prototype,lodash.prototype.constructor=lodash,LodashWrapper.prototype=tr(baseLodash.prototype),LodashWrapper.prototype.constructor=LodashWrapper,LazyWrapper.prototype=tr(baseLodash.prototype),LazyWrapper.prototype.constructor=LazyWrapper,Hash.prototype.clear=function hashClear(){this.__data__=qt?qt(null):{},this.size=0},Hash.prototype.delete=function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hash.prototype.get=function hashGet(e){var t=this.__data__;if(qt){var r=t[e];return r===o?i:r}return Le.call(t,e)?t[e]:i},Hash.prototype.has=function hashHas(e){var t=this.__data__;return qt?t[e]!==i:Le.call(t,e)},Hash.prototype.set=function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=qt&&t===i?o:t,this},ListCache.prototype.clear=function listCacheClear(){this.__data__=[],this.size=0},ListCache.prototype.delete=function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():Je.call(t,r,1),--this.size,!0)},ListCache.prototype.get=function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?i:t[r][1]},ListCache.prototype.has=function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1},ListCache.prototype.set=function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},MapCache.prototype.clear=function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Bt||ListCache),string:new Hash}},MapCache.prototype.delete=function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t},MapCache.prototype.get=function mapCacheGet(e){return getMapData(this,e).get(e)},MapCache.prototype.has=function mapCacheHas(e){return getMapData(this,e).has(e)},MapCache.prototype.set=function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},SetCache.prototype.add=SetCache.prototype.push=function setCacheAdd(e){return this.__data__.set(e,o),this},SetCache.prototype.has=function setCacheHas(e){return this.__data__.has(e)},Stack.prototype.clear=function stackClear(){this.__data__=new ListCache,this.size=0},Stack.prototype.delete=function stackDelete(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Stack.prototype.get=function stackGet(e){return this.__data__.get(e)},Stack.prototype.has=function stackHas(e){return this.__data__.has(e)},Stack.prototype.set=function stackSet(e,t){var r=this.__data__;if(r instanceof ListCache){var n=r.__data__;if(!Bt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new MapCache(n)}return r.set(e,t),this.size=r.size,this};var rr=createBaseEach(baseForOwn),nr=createBaseEach(baseForOwnRight,!0);function baseEvery(e,t){var r=!0;return rr(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function baseExtremum(e,t,r){for(var n=-1,a=e.length;++n<a;){var o=e[n],s=t(o);if(null!=s&&(l===i?s==s&&!isSymbol(s):r(s,l)))var l=s,c=o}return c}function baseFilter(e,t){var r=[];return rr(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function baseFlatten(e,t,r,n,i){var a=-1,o=e.length;for(r||(r=isFlattenable),i||(i=[]);++a<o;){var s=e[a];t>0&&r(s)?t>1?baseFlatten(s,t-1,r,n,i):arrayPush(i,s):n||(i[i.length]=s)}return i}var ir=createBaseFor(),ar=createBaseFor(!0);function baseForOwn(e,t){return e&&ir(e,t,keys)}function baseForOwnRight(e,t){return e&&ar(e,t,keys)}function baseFunctions(e,t){return arrayFilter(t,(function(t){return isFunction(e[t])}))}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:i}function baseGetAllKeys(e,t,r){var n=t(e);return an(e)?n:arrayPush(n,r(e))}function baseGetTag(e){return null==e?e===i?"[object Undefined]":"[object Null]":Xe&&Xe in Ie(e)?function getRawTag(e){var t=Le.call(e,Xe),r=e[Xe];try{e[Xe]=i;var n=!0}catch(e){}var a=ze.call(e);n&&(t?e[Xe]=r:delete e[Xe]);return a}(e):function objectToString(e){return ze.call(e)}(e)}function baseGt(e,t){return e>t}function baseHas(e,t){return null!=e&&Le.call(e,t)}function baseHasIn(e,t){return null!=e&&t in Ie(e)}function baseIntersection(e,t,n){for(var a=n?arrayIncludesWith:arrayIncludes,o=e[0].length,s=e.length,l=s,c=r(s),u=1/0,d=[];l--;){var p=e[l];l&&t&&(p=arrayMap(p,baseUnary(t))),u=xt(p.length,u),c[l]=!n&&(t||o>=120&&p.length>=120)?new SetCache(l&&p):i}p=e[0];var h=-1,y=c[0];e:for(;++h<o&&d.length<u;){var g=p[h],m=t?t(g):g;if(g=n||0!==g?g:0,!(y?cacheHas(y,m):a(d,m,n))){for(l=s;--l;){var v=c[l];if(!(v?cacheHas(v,m):a(e[l],m,n)))continue e}y&&y.push(m),d.push(g)}}return d}function baseInvoke(e,t,r){var n=null==(e=parent(e,t=castPath(t,e)))?e:e[toKey(last(t))];return null==n?i:apply(n,e,r)}function baseIsArguments(e){return isObjectLike(e)&&baseGetTag(e)==b}function baseIsEqual(e,t,r,n,a){return e===t||(null==e||null==t||!isObjectLike(e)&&!isObjectLike(t)?e!=e&&t!=t:function baseIsEqualDeep(e,t,r,n,a,o){var s=an(e),l=an(t),c=s?w:hr(e),u=l?w:hr(t),d=(c=c==b?E:c)==E,p=(u=u==b?E:u)==E,h=c==u;if(h&&sn(e)){if(!sn(t))return!1;s=!0,d=!1}if(h&&!d)return o||(o=new Stack),s||fn(e)?equalArrays(e,t,r,n,a,o):function equalByTag(e,t,r,n,i,a,o){switch(r){case L:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case k:return!(e.byteLength!=t.byteLength||!a(new $e(e),new $e(t)));case C:case S:case I:return eq(+e,+t);case _:return e.name==t.name&&e.message==t.message;case P:case j:return e==t+"";case T:var s=mapToArray;case A:var l=1&n;if(s||(s=setToArray),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var u=equalArrays(s(e),s(t),n,i,a,o);return o.delete(e),u;case M:if(Xt)return Xt.call(e)==Xt.call(t)}return!1}(e,t,c,r,n,a,o);if(!(1&r)){var y=d&&Le.call(e,"__wrapped__"),g=p&&Le.call(t,"__wrapped__");if(y||g){var m=y?e.value():e,v=g?t.value():t;return o||(o=new Stack),a(m,v,r,n,o)}}if(!h)return!1;return o||(o=new Stack),function equalObjects(e,t,r,n,a,o){var s=1&r,l=getAllKeys(e),c=l.length,u=getAllKeys(t),d=u.length;if(c!=d&&!s)return!1;var p=c;for(;p--;){var h=l[p];if(!(s?h in t:Le.call(t,h)))return!1}var y=o.get(e),g=o.get(t);if(y&&g)return y==t&&g==e;var m=!0;o.set(e,t),o.set(t,e);var v=s;for(;++p<c;){var b=e[h=l[p]],w=t[h];if(n)var C=s?n(w,b,h,t,e,o):n(b,w,h,e,t,o);if(!(C===i?b===w||a(b,w,r,n,o):C)){m=!1;break}v||(v="constructor"==h)}if(m&&!v){var S=e.constructor,_=t.constructor;S==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof _&&_ instanceof _||(m=!1)}return o.delete(e),o.delete(t),m}(e,t,r,n,a,o)}(e,t,r,n,baseIsEqual,a))}function baseIsMatch(e,t,r,n){var a=r.length,o=a,s=!n;if(null==e)return!o;for(e=Ie(e);a--;){var l=r[a];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<o;){var c=(l=r[a])[0],u=e[c],d=l[1];if(s&&l[2]){if(u===i&&!(c in e))return!1}else{var p=new Stack;if(n)var h=n(u,d,c,e,t,p);if(!(h===i?baseIsEqual(d,u,3,n,p):h))return!1}}return!0}function baseIsNative(e){return!(!isObject(e)||function isMasked(e){return!!Ne&&Ne in e}(e))&&(isFunction(e)?We:be).test(toSource(e))}function baseIteratee(e){return"function"==typeof e?e:null==e?identity:"object"==typeof e?an(e)?baseMatchesProperty(e[0],e[1]):baseMatches(e):property(e)}function baseKeys(e){if(!isPrototype(e))return Et(e);var t=[];for(var r in Ie(e))Le.call(e,r)&&"constructor"!=r&&t.push(r);return t}function baseKeysIn(e){if(!isObject(e))return function nativeKeysIn(e){var t=[];if(null!=e)for(var r in Ie(e))t.push(r);return t}(e);var t=isPrototype(e),r=[];for(var n in e)("constructor"!=n||!t&&Le.call(e,n))&&r.push(n);return r}function baseLt(e,t){return e<t}function baseMap(e,t){var n=-1,i=isArrayLike(e)?r(e.length):[];return rr(e,(function(e,r,a){i[++n]=t(e,r,a)})),i}function baseMatches(e){var t=getMatchData(e);return 1==t.length&&t[0][2]?matchesStrictComparable(t[0][0],t[0][1]):function(r){return r===e||baseIsMatch(r,e,t)}}function baseMatchesProperty(e,t){return isKey(e)&&isStrictComparable(t)?matchesStrictComparable(toKey(e),t):function(r){var n=get(r,e);return n===i&&n===t?hasIn(r,e):baseIsEqual(t,n,3)}}function baseMerge(e,t,r,n,a){e!==t&&ir(t,(function(o,s){if(a||(a=new Stack),isObject(o))!function baseMergeDeep(e,t,r,n,a,o,s){var l=safeGet(e,r),c=safeGet(t,r),u=s.get(c);if(u)return void assignMergeValue(e,r,u);var d=o?o(l,c,r+"",e,t,s):i,p=d===i;if(p){var h=an(c),y=!h&&sn(c),g=!h&&!y&&fn(c);d=c,h||y||g?an(l)?d=l:isArrayLikeObject(l)?d=copyArray(l):y?(p=!1,d=cloneBuffer(c,!0)):g?(p=!1,d=cloneTypedArray(c,!0)):d=[]:isPlainObject(c)||nn(c)?(d=l,nn(l)?d=toPlainObject(l):isObject(l)&&!isFunction(l)||(d=initCloneObject(c))):p=!1}p&&(s.set(c,d),a(d,c,n,o,s),s.delete(c));assignMergeValue(e,r,d)}(e,t,s,r,baseMerge,n,a);else{var l=n?n(safeGet(e,s),o,s+"",e,t,a):i;l===i&&(l=o),assignMergeValue(e,s,l)}}),keysIn)}function baseNth(e,t){var r=e.length;if(r)return isIndex(t+=t<0?r:0,r)?e[t]:i}function baseOrderBy(e,t,r){t=t.length?arrayMap(t,(function(e){return an(e)?function(t){return baseGet(t,1===e.length?e[0]:e)}:e})):[identity];var n=-1;t=arrayMap(t,baseUnary(getIteratee()));var i=baseMap(e,(function(e,r,i){var a=arrayMap(t,(function(t){return t(e)}));return{criteria:a,index:++n,value:e}}));return function baseSortBy(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(i,(function(e,t){return function compareMultiple(e,t,r){var n=-1,i=e.criteria,a=t.criteria,o=i.length,s=r.length;for(;++n<o;){var l=compareAscending(i[n],a[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function basePickBy(e,t,r){for(var n=-1,i=t.length,a={};++n<i;){var o=t[n],s=baseGet(e,o);r(s,o)&&baseSet(a,castPath(o,e),s)}return a}function basePullAll(e,t,r,n){var i=n?baseIndexOfWith:baseIndexOf,a=-1,o=t.length,s=e;for(e===t&&(t=copyArray(t)),r&&(s=arrayMap(e,baseUnary(r)));++a<o;)for(var l=0,c=t[a],u=r?r(c):c;(l=i(s,u,l,n))>-1;)s!==e&&Je.call(s,l,1),Je.call(e,l,1);return e}function basePullAt(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==a){var a=i;isIndex(i)?Je.call(e,i,1):baseUnset(e,i)}}return e}function baseRandom(e,t){return e+yt(Ft()*(t-e+1))}function baseRepeat(e,t){var r="";if(!e||t<1||t>y)return r;do{t%2&&(r+=e),(t=yt(t/2))&&(e+=e)}while(t);return r}function baseRest(e,t){return vr(overRest(e,t,identity),e+"")}function baseSample(e){return arraySample(values(e))}function baseSampleSize(e,t){var r=values(e);return shuffleSelf(r,baseClamp(t,0,r.length))}function baseSet(e,t,r,n){if(!isObject(e))return e;for(var a=-1,o=(t=castPath(t,e)).length,s=o-1,l=e;null!=l&&++a<o;){var c=toKey(t[a]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(a!=s){var d=l[c];(u=n?n(d,c,l):i)===i&&(u=isObject(d)?d:isIndex(t[a+1])?[]:{})}assignValue(l,c,u),l=l[c]}return e}var or=$t?function(e,t){return $t.set(e,t),e}:identity,sr=et?function(e,t){return et(e,"toString",{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity;function baseShuffle(e){return shuffleSelf(values(e))}function baseSlice(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i<a;)o[i]=e[i+t];return o}function baseSome(e,t){var r;return rr(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function baseSortedIndex(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var a=n+i>>>1,o=e[a];null!==o&&!isSymbol(o)&&(r?o<=t:o<t)?n=a+1:i=a}return i}return baseSortedIndexBy(e,t,identity,r)}function baseSortedIndexBy(e,t,r,n){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=r(t))!=t,l=null===t,c=isSymbol(t),u=t===i;a<o;){var d=yt((a+o)/2),p=r(e[d]),h=p!==i,y=null===p,g=p==p,m=isSymbol(p);if(s)var v=n||g;else v=u?g&&(n||h):l?g&&h&&(n||!y):c?g&&h&&!y&&(n||!m):!y&&!m&&(n?p<=t:p<t);v?a=d+1:o=d}return xt(o,4294967294)}function baseSortedUniq(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r],s=t?t(o):o;if(!r||!eq(s,l)){var l=s;a[i++]=0===o?0:o}}return a}function baseToNumber(e){return"number"==typeof e?e:isSymbol(e)?g:+e}function baseToString(e){if("string"==typeof e)return e;if(an(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return er?er.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function baseUniq(e,t,r){var n=-1,i=arrayIncludes,a=e.length,o=!0,s=[],l=s;if(r)o=!1,i=arrayIncludesWith;else if(a>=200){var c=t?null:ur(e);if(c)return setToArray(c);o=!1,i=cacheHas,l=new SetCache}else l=t?[]:s;e:for(;++n<a;){var u=e[n],d=t?t(u):u;if(u=r||0!==u?u:0,o&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;t&&l.push(d),s.push(u)}else i(l,d,r)||(l!==s&&l.push(d),s.push(u))}return s}function baseUnset(e,t){return null==(e=parent(e,t=castPath(t,e)))||delete e[toKey(last(t))]}function baseUpdate(e,t,r,n){return baseSet(e,t,r(baseGet(e,t)),n)}function baseWhile(e,t,r,n){for(var i=e.length,a=n?i:-1;(n?a--:++a<i)&&t(e[a],a,e););return r?baseSlice(e,n?0:a,n?a+1:i):baseSlice(e,n?a+1:0,n?i:a)}function baseWrapperValue(e,t){var r=e;return r instanceof LazyWrapper&&(r=r.value()),arrayReduce(t,(function(e,t){return t.func.apply(t.thisArg,arrayPush([e],t.args))}),r)}function baseXor(e,t,n){var i=e.length;if(i<2)return i?baseUniq(e[0]):[];for(var a=-1,o=r(i);++a<i;)for(var s=e[a],l=-1;++l<i;)l!=a&&(o[a]=baseDifference(o[a]||s,e[l],t,n));return baseUniq(baseFlatten(o,1),t,n)}function baseZipObject(e,t,r){for(var n=-1,a=e.length,o=t.length,s={};++n<a;){var l=n<o?t[n]:i;r(s,e[n],l)}return s}function castArrayLikeObject(e){return isArrayLikeObject(e)?e:[]}function castFunction(e){return"function"==typeof e?e:identity}function castPath(e,t){return an(e)?e:isKey(e,t)?[e]:br(toString(e))}var lr=baseRest;function castSlice(e,t,r){var n=e.length;return r=r===i?n:r,!t&&r>=n?e:baseSlice(e,t,r)}var cr=nt||function(e){return gt.clearTimeout(e)};function cloneBuffer(e,t){if(t)return e.slice();var r=e.length,n=Ke?Ke(r):new e.constructor(r);return e.copy(n),n}function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function compareAscending(e,t){if(e!==t){var r=e!==i,n=null===e,a=e==e,o=isSymbol(e),s=t!==i,l=null===t,c=t==t,u=isSymbol(t);if(!l&&!u&&!o&&e>t||o&&s&&c&&!l&&!u||n&&s&&c||!r&&c||!a)return 1;if(!n&&!o&&!u&&e<t||u&&r&&a&&!n&&!o||l&&r&&a||!s&&a||!c)return-1}return 0}function composeArgs(e,t,n,i){for(var a=-1,o=e.length,s=n.length,l=-1,c=t.length,u=Mt(o-s,0),d=r(c+u),p=!i;++l<c;)d[l]=t[l];for(;++a<s;)(p||a<o)&&(d[n[a]]=e[a]);for(;u--;)d[l++]=e[a++];return d}function composeArgsRight(e,t,n,i){for(var a=-1,o=e.length,s=-1,l=n.length,c=-1,u=t.length,d=Mt(o-l,0),p=r(d+u),h=!i;++a<d;)p[a]=e[a];for(var y=a;++c<u;)p[y+c]=t[c];for(;++s<l;)(h||a<o)&&(p[y+n[s]]=e[a++]);return p}function copyArray(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function copyObject(e,t,r,n){var a=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var l=t[o],c=n?n(r[l],e[l],l,r,e):i;c===i&&(c=e[l]),a?baseAssignValue(r,l,c):assignValue(r,l,c)}return r}function createAggregator(e,t){return function(r,n){var i=an(r)?arrayAggregator:baseAggregator,a=t?t():{};return i(r,e,getIteratee(n,2),a)}}function createAssigner(e){return baseRest((function(t,r){var n=-1,a=r.length,o=a>1?r[a-1]:i,s=a>2?r[2]:i;for(o=e.length>3&&"function"==typeof o?(a--,o):i,s&&isIterateeCall(r[0],r[1],s)&&(o=a<3?i:o,a=1),t=Ie(t);++n<a;){var l=r[n];l&&e(t,l,n,o)}return t}))}function createBaseEach(e,t){return function(r,n){if(null==r)return r;if(!isArrayLike(r))return e(r,n);for(var i=r.length,a=t?i:-1,o=Ie(r);(t?a--:++a<i)&&!1!==n(o[a],a,o););return r}}function createBaseFor(e){return function(t,r,n){for(var i=-1,a=Ie(t),o=n(t),s=o.length;s--;){var l=o[e?s:++i];if(!1===r(a[l],l,a))break}return t}}function createCaseFirst(e){return function(t){var r=hasUnicode(t=toString(t))?stringToArray(t):i,n=r?r[0]:t.charAt(0),a=r?castSlice(r,1).join(""):t.slice(1);return n[e]()+a}}function createCompounder(e){return function(t){return arrayReduce(words(deburr(t).replace(tt,"")),e,"")}}function createCtor(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=tr(e.prototype),n=e.apply(r,t);return isObject(n)?n:r}}function createFind(e){return function(t,r,n){var a=Ie(t);if(!isArrayLike(t)){var o=getIteratee(r,3);t=keys(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,n);return s>-1?a[o?t[s]:s]:i}}function createFlow(e){return flatRest((function(t){var r=t.length,n=r,o=LodashWrapper.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new Pe(a);if(o&&!l&&"wrapper"==getFuncName(s))var l=new LodashWrapper([],!0)}for(n=l?n:r;++n<r;){var c=getFuncName(s=t[n]),u="wrapper"==c?dr(s):i;l=u&&isLaziable(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[getFuncName(u[0])].apply(l,u[3]):1==s.length&&isLaziable(s)?l[c]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&an(n))return l.plant(n).value();for(var i=0,a=r?t[i].apply(this,e):n;++i<r;)a=t[i].call(this,a);return a}}))}function createHybrid(e,t,n,a,o,s,l,c,u,p){var h=t&d,y=1&t,g=2&t,m=24&t,v=512&t,b=g?i:createCtor(e);return function wrapper(){for(var d=arguments.length,w=r(d),C=d;C--;)w[C]=arguments[C];if(m)var S=getHolder(wrapper),_=function countHolders(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(w,S);if(a&&(w=composeArgs(w,a,o,m)),s&&(w=composeArgsRight(w,s,l,m)),d-=_,m&&d<p){var R=replaceHolders(w,S);return createRecurry(e,t,createHybrid,wrapper.placeholder,n,w,R,c,u,p-d)}var O=y?n:this,T=g?O[e]:e;return d=w.length,c?w=function reorder(e,t){var r=e.length,n=xt(t.length,r),a=copyArray(e);for(;n--;){var o=t[n];e[n]=isIndex(o,r)?a[o]:i}return e}(w,c):v&&d>1&&w.reverse(),h&&u<d&&(w.length=u),this&&this!==gt&&this instanceof wrapper&&(T=b||createCtor(T)),T.apply(O,w)}}function createInverter(e,t){return function(r,n){return function baseInverter(e,t,r,n){return baseForOwn(e,(function(e,i,a){t(n,r(e),i,a)})),n}(r,e,t(n),{})}}function createMathOperation(e,t){return function(r,n){var a;if(r===i&&n===i)return t;if(r!==i&&(a=r),n!==i){if(a===i)return n;"string"==typeof r||"string"==typeof n?(r=baseToString(r),n=baseToString(n)):(r=baseToNumber(r),n=baseToNumber(n)),a=e(r,n)}return a}}function createOver(e){return flatRest((function(t){return t=arrayMap(t,baseUnary(getIteratee())),baseRest((function(r){var n=this;return e(t,(function(e){return apply(e,n,r)}))}))}))}function createPadding(e,t){var r=(t=t===i?" ":baseToString(t)).length;if(r<2)return r?baseRepeat(t,e):t;var n=baseRepeat(t,ht(e/stringSize(t)));return hasUnicode(t)?castSlice(stringToArray(n),0,e).join(""):n.slice(0,e)}function createRange(e){return function(t,n,a){return a&&"number"!=typeof a&&isIterateeCall(t,n,a)&&(n=a=i),t=toFinite(t),n===i?(n=t,t=0):n=toFinite(n),function baseRange(e,t,n,i){for(var a=-1,o=Mt(ht((t-e)/(n||1)),0),s=r(o);o--;)s[i?o:++a]=e,e+=n;return s}(t,n,a=a===i?t<n?1:-1:toFinite(a),e)}}function createRelationalOperation(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=toNumber(t),r=toNumber(r)),e(t,r)}}function createRecurry(e,t,r,n,a,o,s,l,d,p){var h=8&t;t|=h?c:u,4&(t&=~(h?u:c))||(t&=-4);var y=[e,t,a,h?o:i,h?s:i,h?i:o,h?i:s,l,d,p],g=r.apply(i,y);return isLaziable(e)&&gr(g,y),g.placeholder=n,setWrapToString(g,e,t)}function createRound(e){var t=Te[e];return function(e,r){if(e=toNumber(e),(r=null==r?0:xt(toInteger(r),292))&&wt(e)){var n=(toString(e)+"e").split("e");return+((n=(toString(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var ur=Wt&&1/setToArray(new Wt([,-0]))[1]==h?function(e){return new Wt(e)}:noop;function createToPairs(e){return function(t){var r=hr(t);return r==T?mapToArray(t):r==A?setToPairs(t):function baseToPairs(e,t){return arrayMap(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function createWrap(e,t,n,o,h,y,g,m){var v=2&t;if(!v&&"function"!=typeof e)throw new Pe(a);var b=o?o.length:0;if(b||(t&=-97,o=h=i),g=g===i?g:Mt(toInteger(g),0),m=m===i?m:toInteger(m),b-=h?h.length:0,t&u){var w=o,C=h;o=h=i}var S=v?i:dr(e),_=[e,t,n,o,h,w,C,y,g,m];if(S&&function mergeData(e,t){var r=e[1],n=t[1],i=r|n,a=i<131,o=n==d&&8==r||n==d&&r==p&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!a&&!o)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var l=t[3];if(l){var c=e[3];e[3]=c?composeArgs(c,l,t[4]):l,e[4]=c?replaceHolders(e[3],s):t[4]}(l=t[5])&&(c=e[5],e[5]=c?composeArgsRight(c,l,t[6]):l,e[6]=c?replaceHolders(e[5],s):t[6]);(l=t[7])&&(e[7]=l);n&d&&(e[8]=null==e[8]?t[8]:xt(e[8],t[8]));null==e[9]&&(e[9]=t[9]);return e[0]=t[0],e[1]=i,e}(_,S),e=_[0],t=_[1],n=_[2],o=_[3],h=_[4],!(m=_[9]=_[9]===i?v?0:e.length:Mt(_[9]-b,0))&&24&t&&(t&=-25),t&&1!=t)R=8==t||t==l?function createCurry(e,t,n){var a=createCtor(e);return function wrapper(){for(var o=arguments.length,s=r(o),l=o,c=getHolder(wrapper);l--;)s[l]=arguments[l];var u=o<3&&s[0]!==c&&s[o-1]!==c?[]:replaceHolders(s,c);return(o-=u.length)<n?createRecurry(e,t,createHybrid,wrapper.placeholder,i,s,u,i,i,n-o):apply(this&&this!==gt&&this instanceof wrapper?a:e,this,s)}}(e,t,m):t!=c&&33!=t||h.length?createHybrid.apply(i,_):function createPartial(e,t,n,i){var a=1&t,o=createCtor(e);return function wrapper(){for(var t=-1,s=arguments.length,l=-1,c=i.length,u=r(c+s),d=this&&this!==gt&&this instanceof wrapper?o:e;++l<c;)u[l]=i[l];for(;s--;)u[l++]=arguments[++t];return apply(d,a?n:this,u)}}(e,t,n,o);else var R=function createBind(e,t,r){var n=1&t,i=createCtor(e);return function wrapper(){return(this&&this!==gt&&this instanceof wrapper?i:e).apply(n?r:this,arguments)}}(e,t,n);return setWrapToString((S?or:gr)(R,_),e,t)}function customDefaultsAssignIn(e,t,r,n){return e===i||eq(e,Me[r])&&!Le.call(n,r)?t:e}function customDefaultsMerge(e,t,r,n,a,o){return isObject(e)&&isObject(t)&&(o.set(t,e),baseMerge(e,t,i,customDefaultsMerge,o),o.delete(t)),e}function customOmitClone(e){return isPlainObject(e)?i:e}function equalArrays(e,t,r,n,a,o){var s=1&r,l=e.length,c=t.length;if(l!=c&&!(s&&c>l))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var p=-1,h=!0,y=2&r?new SetCache:i;for(o.set(e,t),o.set(t,e);++p<l;){var g=e[p],m=t[p];if(n)var v=s?n(m,g,p,t,e,o):n(g,m,p,e,t,o);if(v!==i){if(v)continue;h=!1;break}if(y){if(!arraySome(t,(function(e,t){if(!cacheHas(y,t)&&(g===e||a(g,e,r,n,o)))return y.push(t)}))){h=!1;break}}else if(g!==m&&!a(g,m,r,n,o)){h=!1;break}}return o.delete(e),o.delete(t),h}function flatRest(e){return vr(overRest(e,i,flatten),e+"")}function getAllKeys(e){return baseGetAllKeys(e,keys,fr)}function getAllKeysIn(e){return baseGetAllKeys(e,keysIn,pr)}var dr=$t?function(e){return $t.get(e)}:noop;function getFuncName(e){for(var t=e.name+"",r=Kt[t],n=Le.call(Kt,t)?r.length:0;n--;){var i=r[n],a=i.func;if(null==a||a==e)return i.name}return t}function getHolder(e){return(Le.call(lodash,"placeholder")?lodash:e).placeholder}function getIteratee(){var e=lodash.iteratee||iteratee;return e=e===iteratee?baseIteratee:e,arguments.length?e(arguments[0],arguments[1]):e}function getMapData(e,t){var r=e.__data__;return function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function getMatchData(e){for(var t=keys(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,isStrictComparable(i)]}return t}function getNative(e,t){var r=function getValue(e,t){return null==e?i:e[t]}(e,t);return baseIsNative(r)?r:i}var fr=mt?function(e){return null==e?[]:(e=Ie(e),arrayFilter(mt(e),(function(t){return Ze.call(e,t)})))}:stubArray,pr=mt?function(e){for(var t=[];e;)arrayPush(t,fr(e)),e=He(e);return t}:stubArray,hr=baseGetTag;function hasPath(e,t,r){for(var n=-1,i=(t=castPath(t,e)).length,a=!1;++n<i;){var o=toKey(t[n]);if(!(a=null!=e&&r(e,o)))break;e=e[o]}return a||++n!=i?a:!!(i=null==e?0:e.length)&&isLength(i)&&isIndex(o,i)&&(an(e)||nn(e))}function initCloneObject(e){return"function"!=typeof e.constructor||isPrototype(e)?{}:tr(He(e))}function isFlattenable(e){return an(e)||nn(e)||!!(Ye&&e&&e[Ye])}function isIndex(e,t){var r=typeof e;return!!(t=null==t?y:t)&&("number"==r||"symbol"!=r&&Ce.test(e))&&e>-1&&e%1==0&&e<t}function isIterateeCall(e,t,r){if(!isObject(r))return!1;var n=typeof t;return!!("number"==n?isArrayLike(r)&&isIndex(t,r.length):"string"==n&&t in r)&&eq(r[t],e)}function isKey(e,t){if(an(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(ne.test(e)||!re.test(e)||null!=t&&e in Ie(t))}function isLaziable(e){var t=getFuncName(e),r=lodash[t];if("function"!=typeof r||!(t in LazyWrapper.prototype))return!1;if(e===r)return!0;var n=dr(r);return!!n&&e===n[0]}(zt&&hr(new zt(new ArrayBuffer(1)))!=L||Bt&&hr(new Bt)!=T||Ut&&hr(Ut.resolve())!=D||Wt&&hr(new Wt)!=A||Vt&&hr(new Vt)!=x)&&(hr=function(e){var t=baseGetTag(e),r=t==E?e.constructor:i,n=r?toSource(r):"";if(n)switch(n){case Ht:return L;case Gt:return T;case Zt:return D;case Jt:return A;case Yt:return x}return t});var yr=xe?isFunction:stubFalse;function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Me)}function isStrictComparable(e){return e==e&&!isObject(e)}function matchesStrictComparable(e,t){return function(r){return null!=r&&(r[e]===t&&(t!==i||e in Ie(r)))}}function overRest(e,t,n){return t=Mt(t===i?e.length-1:t,0),function(){for(var i=arguments,a=-1,o=Mt(i.length-t,0),s=r(o);++a<o;)s[a]=i[t+a];a=-1;for(var l=r(t+1);++a<t;)l[a]=i[a];return l[t]=n(s),apply(e,this,l)}}function parent(e,t){return t.length<2?e:baseGet(e,baseSlice(t,0,-1))}function safeGet(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gr=shortOut(or),mr=dt||function(e,t){return gt.setTimeout(e,t)},vr=shortOut(sr);function setWrapToString(e,t,r){var n=t+"";return vr(e,function insertWrapDetails(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(n,function updateWrapDetails(e,t){return arrayEach(v,(function(r){var n="_."+r[0];t&r[1]&&!arrayIncludes(e,n)&&e.push(n)})),e.sort()}(function getWrapDetails(e){var t=e.match(ue);return t?t[1].split(de):[]}(n),r)))}function shortOut(e){var t=0,r=0;return function(){var n=kt(),a=16-(n-r);if(r=n,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function shuffleSelf(e,t){var r=-1,n=e.length,a=n-1;for(t=t===i?n:t;++r<t;){var o=baseRandom(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var br=function memoizeCapped(e){var t=memoize(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ie,(function(e,r,n,i){t.push(n?i.replace(he,"$1"):r||e)})),t}));function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function toSource(e){if(null!=e){try{return ke.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function wrapperClone(e){if(e instanceof LazyWrapper)return e.clone();var t=new LodashWrapper(e.__wrapped__,e.__chain__);return t.__actions__=copyArray(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var wr=baseRest((function(e,t){return isArrayLikeObject(e)?baseDifference(e,baseFlatten(t,1,isArrayLikeObject,!0)):[]})),Cr=baseRest((function(e,t){var r=last(t);return isArrayLikeObject(r)&&(r=i),isArrayLikeObject(e)?baseDifference(e,baseFlatten(t,1,isArrayLikeObject,!0),getIteratee(r,2)):[]})),Sr=baseRest((function(e,t){var r=last(t);return isArrayLikeObject(r)&&(r=i),isArrayLikeObject(e)?baseDifference(e,baseFlatten(t,1,isArrayLikeObject,!0),i,r):[]}));function findIndex(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:toInteger(r);return i<0&&(i=Mt(n+i,0)),baseFindIndex(e,getIteratee(t,3),i)}function findLastIndex(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=n-1;return r!==i&&(a=toInteger(r),a=r<0?Mt(n+a,0):xt(a,n-1)),baseFindIndex(e,getIteratee(t,3),a,!0)}function flatten(e){return(null==e?0:e.length)?baseFlatten(e,1):[]}function head(e){return e&&e.length?e[0]:i}var _r=baseRest((function(e){var t=arrayMap(e,castArrayLikeObject);return t.length&&t[0]===e[0]?baseIntersection(t):[]})),Rr=baseRest((function(e){var t=last(e),r=arrayMap(e,castArrayLikeObject);return t===last(r)?t=i:r.pop(),r.length&&r[0]===e[0]?baseIntersection(r,getIteratee(t,2)):[]})),Or=baseRest((function(e){var t=last(e),r=arrayMap(e,castArrayLikeObject);return(t="function"==typeof t?t:i)&&r.pop(),r.length&&r[0]===e[0]?baseIntersection(r,i,t):[]}));function last(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Tr=baseRest(pullAll);function pullAll(e,t){return e&&e.length&&t&&t.length?basePullAll(e,t):e}var Ir=flatRest((function(e,t){var r=null==e?0:e.length,n=baseAt(e,t);return basePullAt(e,arrayMap(t,(function(e){return isIndex(e,r)?+e:e})).sort(compareAscending)),n}));function reverse(e){return null==e?e:Nt.call(e)}var Er=baseRest((function(e){return baseUniq(baseFlatten(e,1,isArrayLikeObject,!0))})),Dr=baseRest((function(e){var t=last(e);return isArrayLikeObject(t)&&(t=i),baseUniq(baseFlatten(e,1,isArrayLikeObject,!0),getIteratee(t,2))})),Pr=baseRest((function(e){var t=last(e);return t="function"==typeof t?t:i,baseUniq(baseFlatten(e,1,isArrayLikeObject,!0),i,t)}));function unzip(e){if(!e||!e.length)return[];var t=0;return e=arrayFilter(e,(function(e){if(isArrayLikeObject(e))return t=Mt(e.length,t),!0})),baseTimes(t,(function(t){return arrayMap(e,baseProperty(t))}))}function unzipWith(e,t){if(!e||!e.length)return[];var r=unzip(e);return null==t?r:arrayMap(r,(function(e){return apply(t,i,e)}))}var Ar=baseRest((function(e,t){return isArrayLikeObject(e)?baseDifference(e,t):[]})),jr=baseRest((function(e){return baseXor(arrayFilter(e,isArrayLikeObject))})),Mr=baseRest((function(e){var t=last(e);return isArrayLikeObject(t)&&(t=i),baseXor(arrayFilter(e,isArrayLikeObject),getIteratee(t,2))})),xr=baseRest((function(e){var t=last(e);return t="function"==typeof t?t:i,baseXor(arrayFilter(e,isArrayLikeObject),i,t)})),kr=baseRest(unzip);var Lr=baseRest((function(e){var t=e.length,r=t>1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,unzipWith(e,r)}));function chain(e){var t=lodash(e);return t.__chain__=!0,t}function thru(e,t){return t(e)}var Fr=flatRest((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,interceptor=function(t){return baseAt(t,e)};return!(t>1||this.__actions__.length)&&n instanceof LazyWrapper&&isIndex(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:thru,args:[interceptor],thisArg:i}),new LodashWrapper(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(interceptor)}));var Nr=createAggregator((function(e,t,r){Le.call(e,r)?++e[r]:baseAssignValue(e,r,1)}));var zr=createFind(findIndex),Br=createFind(findLastIndex);function forEach(e,t){return(an(e)?arrayEach:rr)(e,getIteratee(t,3))}function forEachRight(e,t){return(an(e)?arrayEachRight:nr)(e,getIteratee(t,3))}var Ur=createAggregator((function(e,t,r){Le.call(e,r)?e[r].push(t):baseAssignValue(e,r,[t])}));var Wr=baseRest((function(e,t,n){var i=-1,a="function"==typeof t,o=isArrayLike(e)?r(e.length):[];return rr(e,(function(e){o[++i]=a?apply(t,e,n):baseInvoke(e,t,n)})),o})),Vr=createAggregator((function(e,t,r){baseAssignValue(e,r,t)}));function map(e,t){return(an(e)?arrayMap:baseMap)(e,getIteratee(t,3))}var qr=createAggregator((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));var $r=baseRest((function(e,t){if(null==e)return[];var r=t.length;return r>1&&isIterateeCall(e,t[0],t[1])?t=[]:r>2&&isIterateeCall(t[0],t[1],t[2])&&(t=[t[0]]),baseOrderBy(e,baseFlatten(t,1),[])})),Kr=at||function(){return gt.Date.now()};function ary(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,createWrap(e,d,i,i,i,i,t)}function before(e,t){var r;if("function"!=typeof t)throw new Pe(a);return e=toInteger(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Hr=baseRest((function(e,t,r){var n=1;if(r.length){var i=replaceHolders(r,getHolder(Hr));n|=c}return createWrap(e,n,t,r,i)})),Gr=baseRest((function(e,t,r){var n=3;if(r.length){var i=replaceHolders(r,getHolder(Gr));n|=c}return createWrap(t,n,e,r,i)}));function debounce(e,t,r){var n,o,s,l,c,u,d=0,p=!1,h=!1,y=!0;if("function"!=typeof e)throw new Pe(a);function invokeFunc(t){var r=n,a=o;return n=o=i,d=t,l=e.apply(a,r)}function shouldInvoke(e){var r=e-u;return u===i||r>=t||r<0||h&&e-d>=s}function timerExpired(){var e=Kr();if(shouldInvoke(e))return trailingEdge(e);c=mr(timerExpired,function remainingWait(e){var r=t-(e-u);return h?xt(r,s-(e-d)):r}(e))}function trailingEdge(e){return c=i,y&&n?invokeFunc(e):(n=o=i,l)}function debounced(){var e=Kr(),r=shouldInvoke(e);if(n=arguments,o=this,u=e,r){if(c===i)return function leadingEdge(e){return d=e,c=mr(timerExpired,t),p?invokeFunc(e):l}(u);if(h)return cr(c),c=mr(timerExpired,t),invokeFunc(u)}return c===i&&(c=mr(timerExpired,t)),l}return t=toNumber(t)||0,isObject(r)&&(p=!!r.leading,s=(h="maxWait"in r)?Mt(toNumber(r.maxWait)||0,t):s,y="trailing"in r?!!r.trailing:y),debounced.cancel=function cancel(){c!==i&&cr(c),d=0,n=u=o=c=i},debounced.flush=function flush(){return c===i?l:trailingEdge(Kr())},debounced}var Zr=baseRest((function(e,t){return baseDelay(e,1,t)})),Jr=baseRest((function(e,t,r){return baseDelay(e,toNumber(t)||0,r)}));function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Pe(a);var memoized=function(){var r=arguments,n=t?t.apply(this,r):r[0],i=memoized.cache;if(i.has(n))return i.get(n);var a=e.apply(this,r);return memoized.cache=i.set(n,a)||i,a};return memoized.cache=new(memoize.Cache||MapCache),memoized}function negate(e){if("function"!=typeof e)throw new Pe(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}memoize.Cache=MapCache;var Yr=lr((function(e,t){var r=(t=1==t.length&&an(t[0])?arrayMap(t[0],baseUnary(getIteratee())):arrayMap(baseFlatten(t,1),baseUnary(getIteratee()))).length;return baseRest((function(n){for(var i=-1,a=xt(n.length,r);++i<a;)n[i]=t[i].call(this,n[i]);return apply(e,this,n)}))})),Qr=baseRest((function(e,t){var r=replaceHolders(t,getHolder(Qr));return createWrap(e,c,i,t,r)})),Xr=baseRest((function(e,t){var r=replaceHolders(t,getHolder(Xr));return createWrap(e,u,i,t,r)})),en=flatRest((function(e,t){return createWrap(e,p,i,i,i,t)}));function eq(e,t){return e===t||e!=e&&t!=t}var tn=createRelationalOperation(baseGt),rn=createRelationalOperation((function(e,t){return e>=t})),nn=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&Le.call(e,"callee")&&!Ze.call(e,"callee")},an=r.isArray,on=St?baseUnary(St):function baseIsArrayBuffer(e){return isObjectLike(e)&&baseGetTag(e)==k};function isArrayLike(e){return null!=e&&isLength(e.length)&&!isFunction(e)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}var sn=vt||stubFalse,ln=_t?baseUnary(_t):function baseIsDate(e){return isObjectLike(e)&&baseGetTag(e)==S};function isError(e){if(!isObjectLike(e))return!1;var t=baseGetTag(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!isPlainObject(e)}function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==R||t==O||"[object AsyncFunction]"==t||"[object Proxy]"==t}function isInteger(e){return"number"==typeof e&&e==toInteger(e)}function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=y}function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function isObjectLike(e){return null!=e&&"object"==typeof e}var cn=Rt?baseUnary(Rt):function baseIsMap(e){return isObjectLike(e)&&hr(e)==T};function isNumber(e){return"number"==typeof e||isObjectLike(e)&&baseGetTag(e)==I}function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=E)return!1;var t=He(e);if(null===t)return!0;var r=Le.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ke.call(r)==Be}var un=Ot?baseUnary(Ot):function baseIsRegExp(e){return isObjectLike(e)&&baseGetTag(e)==P};var dn=Tt?baseUnary(Tt):function baseIsSet(e){return isObjectLike(e)&&hr(e)==A};function isString(e){return"string"==typeof e||!an(e)&&isObjectLike(e)&&baseGetTag(e)==j}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&baseGetTag(e)==M}var fn=It?baseUnary(It):function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!ct[baseGetTag(e)]};var pn=createRelationalOperation(baseLt),hn=createRelationalOperation((function(e,t){return e<=t}));function toArray(e){if(!e)return[];if(isArrayLike(e))return isString(e)?stringToArray(e):copyArray(e);if(Qe&&e[Qe])return function iteratorToArray(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Qe]());var t=hr(e);return(t==T?mapToArray:t==A?setToArray:values)(e)}function toFinite(e){return e?(e=toNumber(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function toInteger(e){var t=toFinite(e),r=t%1;return t==t?r?t-r:t:0}function toLength(e){return e?baseClamp(toInteger(e),0,m):0}function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return g;if(isObject(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=baseTrim(e);var r=ve.test(e);return r||we.test(e)?pt(e.slice(2),r?2:8):me.test(e)?g:+e}function toPlainObject(e){return copyObject(e,keysIn(e))}function toString(e){return null==e?"":baseToString(e)}var yn=createAssigner((function(e,t){if(isPrototype(t)||isArrayLike(t))copyObject(t,keys(t),e);else for(var r in t)Le.call(t,r)&&assignValue(e,r,t[r])})),gn=createAssigner((function(e,t){copyObject(t,keysIn(t),e)})),mn=createAssigner((function(e,t,r,n){copyObject(t,keysIn(t),e,n)})),vn=createAssigner((function(e,t,r,n){copyObject(t,keys(t),e,n)})),bn=flatRest(baseAt);var wn=baseRest((function(e,t){e=Ie(e);var r=-1,n=t.length,a=n>2?t[2]:i;for(a&&isIterateeCall(t[0],t[1],a)&&(n=1);++r<n;)for(var o=t[r],s=keysIn(o),l=-1,c=s.length;++l<c;){var u=s[l],d=e[u];(d===i||eq(d,Me[u])&&!Le.call(e,u))&&(e[u]=o[u])}return e})),Cn=baseRest((function(e){return e.push(i,customDefaultsMerge),apply(Tn,i,e)}));function get(e,t,r){var n=null==e?i:baseGet(e,t);return n===i?r:n}function hasIn(e,t){return null!=e&&hasPath(e,t,baseHasIn)}var Sn=createInverter((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=ze.call(t)),e[t]=r}),constant(identity)),_n=createInverter((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=ze.call(t)),Le.call(e,t)?e[t].push(r):e[t]=[r]}),getIteratee),Rn=baseRest(baseInvoke);function keys(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}function keysIn(e){return isArrayLike(e)?arrayLikeKeys(e,!0):baseKeysIn(e)}var On=createAssigner((function(e,t,r){baseMerge(e,t,r)})),Tn=createAssigner((function(e,t,r,n){baseMerge(e,t,r,n)})),In=flatRest((function(e,t){var r={};if(null==e)return r;var n=!1;t=arrayMap(t,(function(t){return t=castPath(t,e),n||(n=t.length>1),t})),copyObject(e,getAllKeysIn(e),r),n&&(r=baseClone(r,7,customOmitClone));for(var i=t.length;i--;)baseUnset(r,t[i]);return r}));var En=flatRest((function(e,t){return null==e?{}:function basePick(e,t){return basePickBy(e,t,(function(t,r){return hasIn(e,r)}))}(e,t)}));function pickBy(e,t){if(null==e)return{};var r=arrayMap(getAllKeysIn(e),(function(e){return[e]}));return t=getIteratee(t),basePickBy(e,r,(function(e,r){return t(e,r[0])}))}var Dn=createToPairs(keys),Pn=createToPairs(keysIn);function values(e){return null==e?[]:baseValues(e,keys(e))}var An=createCompounder((function(e,t,r){return t=t.toLowerCase(),e+(r?capitalize(t):t)}));function capitalize(e){return Nn(toString(e).toLowerCase())}function deburr(e){return(e=toString(e))&&e.replace(Se,Dt).replace(rt,"")}var jn=createCompounder((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Mn=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),xn=createCaseFirst("toLowerCase");var kn=createCompounder((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}));var Ln=createCompounder((function(e,t,r){return e+(r?" ":"")+Nn(t)}));var Fn=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Nn=createCaseFirst("toUpperCase");function words(e,t,r){return e=toString(e),(t=r?i:t)===i?function hasUnicodeWord(e){return ot.test(e)}(e)?function unicodeWords(e){return e.match(it)||[]}(e):function asciiWords(e){return e.match(fe)||[]}(e):e.match(t)||[]}var zn=baseRest((function(e,t){try{return apply(e,i,t)}catch(e){return isError(e)?e:new le(e)}})),Bn=flatRest((function(e,t){return arrayEach(t,(function(t){t=toKey(t),baseAssignValue(e,t,Hr(e[t],e))})),e}));function constant(e){return function(){return e}}var Un=createFlow(),Wn=createFlow(!0);function identity(e){return e}function iteratee(e){return baseIteratee("function"==typeof e?e:baseClone(e,1))}var Vn=baseRest((function(e,t){return function(r){return baseInvoke(r,e,t)}})),qn=baseRest((function(e,t){return function(r){return baseInvoke(e,r,t)}}));function mixin(e,t,r){var n=keys(t),i=baseFunctions(t,n);null!=r||isObject(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=baseFunctions(t,keys(t)));var a=!(isObject(r)&&"chain"in r&&!r.chain),o=isFunction(e);return arrayEach(i,(function(r){var n=t[r];e[r]=n,o&&(e.prototype[r]=function(){var t=this.__chain__;if(a||t){var r=e(this.__wrapped__);return(r.__actions__=copyArray(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,arrayPush([this.value()],arguments))})})),e}function noop(){}var $n=createOver(arrayMap),Kn=createOver(arrayEvery),Hn=createOver(arraySome);function property(e){return isKey(e)?baseProperty(toKey(e)):function basePropertyDeep(e){return function(t){return baseGet(t,e)}}(e)}var Gn=createRange(),Zn=createRange(!0);function stubArray(){return[]}function stubFalse(){return!1}var Jn=createMathOperation((function(e,t){return e+t}),0),Yn=createRound("ceil"),Qn=createMathOperation((function(e,t){return e/t}),1),Xn=createRound("floor");var ei,ti=createMathOperation((function(e,t){return e*t}),1),ri=createRound("round"),ni=createMathOperation((function(e,t){return e-t}),0);return lodash.after=function after(e,t){if("function"!=typeof t)throw new Pe(a);return e=toInteger(e),function(){if(--e<1)return t.apply(this,arguments)}},lodash.ary=ary,lodash.assign=yn,lodash.assignIn=gn,lodash.assignInWith=mn,lodash.assignWith=vn,lodash.at=bn,lodash.before=before,lodash.bind=Hr,lodash.bindAll=Bn,lodash.bindKey=Gr,lodash.castArray=function castArray(){if(!arguments.length)return[];var e=arguments[0];return an(e)?e:[e]},lodash.chain=chain,lodash.chunk=function chunk(e,t,n){t=(n?isIterateeCall(e,t,n):t===i)?1:Mt(toInteger(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var o=0,s=0,l=r(ht(a/t));o<a;)l[s++]=baseSlice(e,o,o+=t);return l},lodash.compact=function compact(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var a=e[t];a&&(i[n++]=a)}return i},lodash.concat=function concat(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return arrayPush(an(n)?copyArray(n):[n],baseFlatten(t,1))},lodash.cond=function cond(e){var t=null==e?0:e.length,r=getIteratee();return e=t?arrayMap(e,(function(e){if("function"!=typeof e[1])throw new Pe(a);return[r(e[0]),e[1]]})):[],baseRest((function(r){for(var n=-1;++n<t;){var i=e[n];if(apply(i[0],this,r))return apply(i[1],this,r)}}))},lodash.conforms=function conforms(e){return function baseConforms(e){var t=keys(e);return function(r){return baseConformsTo(r,e,t)}}(baseClone(e,1))},lodash.constant=constant,lodash.countBy=Nr,lodash.create=function create(e,t){var r=tr(e);return null==t?r:baseAssign(r,t)},lodash.curry=function curry(e,t,r){var n=createWrap(e,8,i,i,i,i,i,t=r?i:t);return n.placeholder=curry.placeholder,n},lodash.curryRight=function curryRight(e,t,r){var n=createWrap(e,l,i,i,i,i,i,t=r?i:t);return n.placeholder=curryRight.placeholder,n},lodash.debounce=debounce,lodash.defaults=wn,lodash.defaultsDeep=Cn,lodash.defer=Zr,lodash.delay=Jr,lodash.difference=wr,lodash.differenceBy=Cr,lodash.differenceWith=Sr,lodash.drop=function drop(e,t,r){var n=null==e?0:e.length;return n?baseSlice(e,(t=r||t===i?1:toInteger(t))<0?0:t,n):[]},lodash.dropRight=function dropRight(e,t,r){var n=null==e?0:e.length;return n?baseSlice(e,0,(t=n-(t=r||t===i?1:toInteger(t)))<0?0:t):[]},lodash.dropRightWhile=function dropRightWhile(e,t){return e&&e.length?baseWhile(e,getIteratee(t,3),!0,!0):[]},lodash.dropWhile=function dropWhile(e,t){return e&&e.length?baseWhile(e,getIteratee(t,3),!0):[]},lodash.fill=function fill(e,t,r,n){var a=null==e?0:e.length;return a?(r&&"number"!=typeof r&&isIterateeCall(e,t,r)&&(r=0,n=a),function baseFill(e,t,r,n){var a=e.length;for((r=toInteger(r))<0&&(r=-r>a?0:a+r),(n=n===i||n>a?a:toInteger(n))<0&&(n+=a),n=r>n?0:toLength(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},lodash.filter=function filter(e,t){return(an(e)?arrayFilter:baseFilter)(e,getIteratee(t,3))},lodash.flatMap=function flatMap(e,t){return baseFlatten(map(e,t),1)},lodash.flatMapDeep=function flatMapDeep(e,t){return baseFlatten(map(e,t),h)},lodash.flatMapDepth=function flatMapDepth(e,t,r){return r=r===i?1:toInteger(r),baseFlatten(map(e,t),r)},lodash.flatten=flatten,lodash.flattenDeep=function flattenDeep(e){return(null==e?0:e.length)?baseFlatten(e,h):[]},lodash.flattenDepth=function flattenDepth(e,t){return(null==e?0:e.length)?baseFlatten(e,t=t===i?1:toInteger(t)):[]},lodash.flip=function flip(e){return createWrap(e,512)},lodash.flow=Un,lodash.flowRight=Wn,lodash.fromPairs=function fromPairs(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},lodash.functions=function functions(e){return null==e?[]:baseFunctions(e,keys(e))},lodash.functionsIn=function functionsIn(e){return null==e?[]:baseFunctions(e,keysIn(e))},lodash.groupBy=Ur,lodash.initial=function initial(e){return(null==e?0:e.length)?baseSlice(e,0,-1):[]},lodash.intersection=_r,lodash.intersectionBy=Rr,lodash.intersectionWith=Or,lodash.invert=Sn,lodash.invertBy=_n,lodash.invokeMap=Wr,lodash.iteratee=iteratee,lodash.keyBy=Vr,lodash.keys=keys,lodash.keysIn=keysIn,lodash.map=map,lodash.mapKeys=function mapKeys(e,t){var r={};return t=getIteratee(t,3),baseForOwn(e,(function(e,n,i){baseAssignValue(r,t(e,n,i),e)})),r},lodash.mapValues=function mapValues(e,t){var r={};return t=getIteratee(t,3),baseForOwn(e,(function(e,n,i){baseAssignValue(r,n,t(e,n,i))})),r},lodash.matches=function matches(e){return baseMatches(baseClone(e,1))},lodash.matchesProperty=function matchesProperty(e,t){return baseMatchesProperty(e,baseClone(t,1))},lodash.memoize=memoize,lodash.merge=On,lodash.mergeWith=Tn,lodash.method=Vn,lodash.methodOf=qn,lodash.mixin=mixin,lodash.negate=negate,lodash.nthArg=function nthArg(e){return e=toInteger(e),baseRest((function(t){return baseNth(t,e)}))},lodash.omit=In,lodash.omitBy=function omitBy(e,t){return pickBy(e,negate(getIteratee(t)))},lodash.once=function once(e){return before(2,e)},lodash.orderBy=function orderBy(e,t,r,n){return null==e?[]:(an(t)||(t=null==t?[]:[t]),an(r=n?i:r)||(r=null==r?[]:[r]),baseOrderBy(e,t,r))},lodash.over=$n,lodash.overArgs=Yr,lodash.overEvery=Kn,lodash.overSome=Hn,lodash.partial=Qr,lodash.partialRight=Xr,lodash.partition=qr,lodash.pick=En,lodash.pickBy=pickBy,lodash.property=property,lodash.propertyOf=function propertyOf(e){return function(t){return null==e?i:baseGet(e,t)}},lodash.pull=Tr,lodash.pullAll=pullAll,lodash.pullAllBy=function pullAllBy(e,t,r){return e&&e.length&&t&&t.length?basePullAll(e,t,getIteratee(r,2)):e},lodash.pullAllWith=function pullAllWith(e,t,r){return e&&e.length&&t&&t.length?basePullAll(e,t,i,r):e},lodash.pullAt=Ir,lodash.range=Gn,lodash.rangeRight=Zn,lodash.rearg=en,lodash.reject=function reject(e,t){return(an(e)?arrayFilter:baseFilter)(e,negate(getIteratee(t,3)))},lodash.remove=function remove(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],a=e.length;for(t=getIteratee(t,3);++n<a;){var o=e[n];t(o,n,e)&&(r.push(o),i.push(n))}return basePullAt(e,i),r},lodash.rest=function rest(e,t){if("function"!=typeof e)throw new Pe(a);return baseRest(e,t=t===i?t:toInteger(t))},lodash.reverse=reverse,lodash.sampleSize=function sampleSize(e,t,r){return t=(r?isIterateeCall(e,t,r):t===i)?1:toInteger(t),(an(e)?arraySampleSize:baseSampleSize)(e,t)},lodash.set=function set(e,t,r){return null==e?e:baseSet(e,t,r)},lodash.setWith=function setWith(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:baseSet(e,t,r,n)},lodash.shuffle=function shuffle(e){return(an(e)?arrayShuffle:baseShuffle)(e)},lodash.slice=function slice(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&isIterateeCall(e,t,r)?(t=0,r=n):(t=null==t?0:toInteger(t),r=r===i?n:toInteger(r)),baseSlice(e,t,r)):[]},lodash.sortBy=$r,lodash.sortedUniq=function sortedUniq(e){return e&&e.length?baseSortedUniq(e):[]},lodash.sortedUniqBy=function sortedUniqBy(e,t){return e&&e.length?baseSortedUniq(e,getIteratee(t,2)):[]},lodash.split=function split(e,t,r){return r&&"number"!=typeof r&&isIterateeCall(e,t,r)&&(t=r=i),(r=r===i?m:r>>>0)?(e=toString(e))&&("string"==typeof t||null!=t&&!un(t))&&!(t=baseToString(t))&&hasUnicode(e)?castSlice(stringToArray(e),0,r):e.split(t,r):[]},lodash.spread=function spread(e,t){if("function"!=typeof e)throw new Pe(a);return t=null==t?0:Mt(toInteger(t),0),baseRest((function(r){var n=r[t],i=castSlice(r,0,t);return n&&arrayPush(i,n),apply(e,this,i)}))},lodash.tail=function tail(e){var t=null==e?0:e.length;return t?baseSlice(e,1,t):[]},lodash.take=function take(e,t,r){return e&&e.length?baseSlice(e,0,(t=r||t===i?1:toInteger(t))<0?0:t):[]},lodash.takeRight=function takeRight(e,t,r){var n=null==e?0:e.length;return n?baseSlice(e,(t=n-(t=r||t===i?1:toInteger(t)))<0?0:t,n):[]},lodash.takeRightWhile=function takeRightWhile(e,t){return e&&e.length?baseWhile(e,getIteratee(t,3),!1,!0):[]},lodash.takeWhile=function takeWhile(e,t){return e&&e.length?baseWhile(e,getIteratee(t,3)):[]},lodash.tap=function tap(e,t){return t(e),e},lodash.throttle=function throttle(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new Pe(a);return isObject(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),debounce(e,t,{leading:n,maxWait:t,trailing:i})},lodash.thru=thru,lodash.toArray=toArray,lodash.toPairs=Dn,lodash.toPairsIn=Pn,lodash.toPath=function toPath(e){return an(e)?arrayMap(e,toKey):isSymbol(e)?[e]:copyArray(br(toString(e)))},lodash.toPlainObject=toPlainObject,lodash.transform=function transform(e,t,r){var n=an(e),i=n||sn(e)||fn(e);if(t=getIteratee(t,4),null==r){var a=e&&e.constructor;r=i?n?new a:[]:isObject(e)&&isFunction(a)?tr(He(e)):{}}return(i?arrayEach:baseForOwn)(e,(function(e,n,i){return t(r,e,n,i)})),r},lodash.unary=function unary(e){return ary(e,1)},lodash.union=Er,lodash.unionBy=Dr,lodash.unionWith=Pr,lodash.uniq=function uniq(e){return e&&e.length?baseUniq(e):[]},lodash.uniqBy=function uniqBy(e,t){return e&&e.length?baseUniq(e,getIteratee(t,2)):[]},lodash.uniqWith=function uniqWith(e,t){return t="function"==typeof t?t:i,e&&e.length?baseUniq(e,i,t):[]},lodash.unset=function unset(e,t){return null==e||baseUnset(e,t)},lodash.unzip=unzip,lodash.unzipWith=unzipWith,lodash.update=function update(e,t,r){return null==e?e:baseUpdate(e,t,castFunction(r))},lodash.updateWith=function updateWith(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:baseUpdate(e,t,castFunction(r),n)},lodash.values=values,lodash.valuesIn=function valuesIn(e){return null==e?[]:baseValues(e,keysIn(e))},lodash.without=Ar,lodash.words=words,lodash.wrap=function wrap(e,t){return Qr(castFunction(t),e)},lodash.xor=jr,lodash.xorBy=Mr,lodash.xorWith=xr,lodash.zip=kr,lodash.zipObject=function zipObject(e,t){return baseZipObject(e||[],t||[],assignValue)},lodash.zipObjectDeep=function zipObjectDeep(e,t){return baseZipObject(e||[],t||[],baseSet)},lodash.zipWith=Lr,lodash.entries=Dn,lodash.entriesIn=Pn,lodash.extend=gn,lodash.extendWith=mn,mixin(lodash,lodash),lodash.add=Jn,lodash.attempt=zn,lodash.camelCase=An,lodash.capitalize=capitalize,lodash.ceil=Yn,lodash.clamp=function clamp(e,t,r){return r===i&&(r=t,t=i),r!==i&&(r=(r=toNumber(r))==r?r:0),t!==i&&(t=(t=toNumber(t))==t?t:0),baseClamp(toNumber(e),t,r)},lodash.clone=function clone(e){return baseClone(e,4)},lodash.cloneDeep=function cloneDeep(e){return baseClone(e,5)},lodash.cloneDeepWith=function cloneDeepWith(e,t){return baseClone(e,5,t="function"==typeof t?t:i)},lodash.cloneWith=function cloneWith(e,t){return baseClone(e,4,t="function"==typeof t?t:i)},lodash.conformsTo=function conformsTo(e,t){return null==t||baseConformsTo(e,t,keys(t))},lodash.deburr=deburr,lodash.defaultTo=function defaultTo(e,t){return null==e||e!=e?t:e},lodash.divide=Qn,lodash.endsWith=function endsWith(e,t,r){e=toString(e),t=baseToString(t);var n=e.length,a=r=r===i?n:baseClamp(toInteger(r),0,n);return(r-=t.length)>=0&&e.slice(r,a)==t},lodash.eq=eq,lodash.escape=function escape(e){return(e=toString(e))&&Q.test(e)?e.replace(J,Pt):e},lodash.escapeRegExp=function escapeRegExp(e){return(e=toString(e))&&oe.test(e)?e.replace(ae,"\\$&"):e},lodash.every=function every(e,t,r){var n=an(e)?arrayEvery:baseEvery;return r&&isIterateeCall(e,t,r)&&(t=i),n(e,getIteratee(t,3))},lodash.find=zr,lodash.findIndex=findIndex,lodash.findKey=function findKey(e,t){return baseFindKey(e,getIteratee(t,3),baseForOwn)},lodash.findLast=Br,lodash.findLastIndex=findLastIndex,lodash.findLastKey=function findLastKey(e,t){return baseFindKey(e,getIteratee(t,3),baseForOwnRight)},lodash.floor=Xn,lodash.forEach=forEach,lodash.forEachRight=forEachRight,lodash.forIn=function forIn(e,t){return null==e?e:ir(e,getIteratee(t,3),keysIn)},lodash.forInRight=function forInRight(e,t){return null==e?e:ar(e,getIteratee(t,3),keysIn)},lodash.forOwn=function forOwn(e,t){return e&&baseForOwn(e,getIteratee(t,3))},lodash.forOwnRight=function forOwnRight(e,t){return e&&baseForOwnRight(e,getIteratee(t,3))},lodash.get=get,lodash.gt=tn,lodash.gte=rn,lodash.has=function has(e,t){return null!=e&&hasPath(e,t,baseHas)},lodash.hasIn=hasIn,lodash.head=head,lodash.identity=identity,lodash.includes=function includes(e,t,r,n){e=isArrayLike(e)?e:values(e),r=r&&!n?toInteger(r):0;var i=e.length;return r<0&&(r=Mt(i+r,0)),isString(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&baseIndexOf(e,t,r)>-1},lodash.indexOf=function indexOf(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:toInteger(r);return i<0&&(i=Mt(n+i,0)),baseIndexOf(e,t,i)},lodash.inRange=function inRange(e,t,r){return t=toFinite(t),r===i?(r=t,t=0):r=toFinite(r),function baseInRange(e,t,r){return e>=xt(t,r)&&e<Mt(t,r)}(e=toNumber(e),t,r)},lodash.invoke=Rn,lodash.isArguments=nn,lodash.isArray=an,lodash.isArrayBuffer=on,lodash.isArrayLike=isArrayLike,lodash.isArrayLikeObject=isArrayLikeObject,lodash.isBoolean=function isBoolean(e){return!0===e||!1===e||isObjectLike(e)&&baseGetTag(e)==C},lodash.isBuffer=sn,lodash.isDate=ln,lodash.isElement=function isElement(e){return isObjectLike(e)&&1===e.nodeType&&!isPlainObject(e)},lodash.isEmpty=function isEmpty(e){if(null==e)return!0;if(isArrayLike(e)&&(an(e)||"string"==typeof e||"function"==typeof e.splice||sn(e)||fn(e)||nn(e)))return!e.length;var t=hr(e);if(t==T||t==A)return!e.size;if(isPrototype(e))return!baseKeys(e).length;for(var r in e)if(Le.call(e,r))return!1;return!0},lodash.isEqual=function isEqual(e,t){return baseIsEqual(e,t)},lodash.isEqualWith=function isEqualWith(e,t,r){var n=(r="function"==typeof r?r:i)?r(e,t):i;return n===i?baseIsEqual(e,t,i,r):!!n},lodash.isError=isError,lodash.isFinite=function isFinite(e){return"number"==typeof e&&wt(e)},lodash.isFunction=isFunction,lodash.isInteger=isInteger,lodash.isLength=isLength,lodash.isMap=cn,lodash.isMatch=function isMatch(e,t){return e===t||baseIsMatch(e,t,getMatchData(t))},lodash.isMatchWith=function isMatchWith(e,t,r){return r="function"==typeof r?r:i,baseIsMatch(e,t,getMatchData(t),r)},lodash.isNaN=function isNaN(e){return isNumber(e)&&e!=+e},lodash.isNative=function isNative(e){if(yr(e))throw new le("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return baseIsNative(e)},lodash.isNil=function isNil(e){return null==e},lodash.isNull=function isNull(e){return null===e},lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isObjectLike=isObjectLike,lodash.isPlainObject=isPlainObject,lodash.isRegExp=un,lodash.isSafeInteger=function isSafeInteger(e){return isInteger(e)&&e>=-9007199254740991&&e<=y},lodash.isSet=dn,lodash.isString=isString,lodash.isSymbol=isSymbol,lodash.isTypedArray=fn,lodash.isUndefined=function isUndefined(e){return e===i},lodash.isWeakMap=function isWeakMap(e){return isObjectLike(e)&&hr(e)==x},lodash.isWeakSet=function isWeakSet(e){return isObjectLike(e)&&"[object WeakSet]"==baseGetTag(e)},lodash.join=function join(e,t){return null==e?"":Ct.call(e,t)},lodash.kebabCase=jn,lodash.last=last,lodash.lastIndexOf=function lastIndexOf(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=n;return r!==i&&(a=(a=toInteger(r))<0?Mt(n+a,0):xt(a,n-1)),t==t?function strictLastIndexOf(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,a):baseFindIndex(e,baseIsNaN,a,!0)},lodash.lowerCase=Mn,lodash.lowerFirst=xn,lodash.lt=pn,lodash.lte=hn,lodash.max=function max(e){return e&&e.length?baseExtremum(e,identity,baseGt):i},lodash.maxBy=function maxBy(e,t){return e&&e.length?baseExtremum(e,getIteratee(t,2),baseGt):i},lodash.mean=function mean(e){return baseMean(e,identity)},lodash.meanBy=function meanBy(e,t){return baseMean(e,getIteratee(t,2))},lodash.min=function min(e){return e&&e.length?baseExtremum(e,identity,baseLt):i},lodash.minBy=function minBy(e,t){return e&&e.length?baseExtremum(e,getIteratee(t,2),baseLt):i},lodash.stubArray=stubArray,lodash.stubFalse=stubFalse,lodash.stubObject=function stubObject(){return{}},lodash.stubString=function stubString(){return""},lodash.stubTrue=function stubTrue(){return!0},lodash.multiply=ti,lodash.nth=function nth(e,t){return e&&e.length?baseNth(e,toInteger(t)):i},lodash.noConflict=function noConflict(){return gt._===this&&(gt._=Ue),this},lodash.noop=noop,lodash.now=Kr,lodash.pad=function pad(e,t,r){e=toString(e);var n=(t=toInteger(t))?stringSize(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return createPadding(yt(i),r)+e+createPadding(ht(i),r)},lodash.padEnd=function padEnd(e,t,r){e=toString(e);var n=(t=toInteger(t))?stringSize(e):0;return t&&n<t?e+createPadding(t-n,r):e},lodash.padStart=function padStart(e,t,r){e=toString(e);var n=(t=toInteger(t))?stringSize(e):0;return t&&n<t?createPadding(t-n,r)+e:e},lodash.parseInt=function parseInt(e,t,r){return r||null==t?t=0:t&&(t=+t),Lt(toString(e).replace(se,""),t||0)},lodash.random=function random(e,t,r){if(r&&"boolean"!=typeof r&&isIterateeCall(e,t,r)&&(t=r=i),r===i&&("boolean"==typeof t?(r=t,t=i):"boolean"==typeof e&&(r=e,e=i)),e===i&&t===i?(e=0,t=1):(e=toFinite(e),t===i?(t=e,e=0):t=toFinite(t)),e>t){var n=e;e=t,t=n}if(r||e%1||t%1){var a=Ft();return xt(e+a*(t-e+ft("1e-"+((a+"").length-1))),t)}return baseRandom(e,t)},lodash.reduce=function reduce(e,t,r){var n=an(e)?arrayReduce:baseReduce,i=arguments.length<3;return n(e,getIteratee(t,4),r,i,rr)},lodash.reduceRight=function reduceRight(e,t,r){var n=an(e)?arrayReduceRight:baseReduce,i=arguments.length<3;return n(e,getIteratee(t,4),r,i,nr)},lodash.repeat=function repeat(e,t,r){return t=(r?isIterateeCall(e,t,r):t===i)?1:toInteger(t),baseRepeat(toString(e),t)},lodash.replace=function replace(){var e=arguments,t=toString(e[0]);return e.length<3?t:t.replace(e[1],e[2])},lodash.result=function result(e,t,r){var n=-1,a=(t=castPath(t,e)).length;for(a||(a=1,e=i);++n<a;){var o=null==e?i:e[toKey(t[n])];o===i&&(n=a,o=r),e=isFunction(o)?o.call(e):o}return e},lodash.round=ri,lodash.runInContext=runInContext,lodash.sample=function sample(e){return(an(e)?arraySample:baseSample)(e)},lodash.size=function size(e){if(null==e)return 0;if(isArrayLike(e))return isString(e)?stringSize(e):e.length;var t=hr(e);return t==T||t==A?e.size:baseKeys(e).length},lodash.snakeCase=kn,lodash.some=function some(e,t,r){var n=an(e)?arraySome:baseSome;return r&&isIterateeCall(e,t,r)&&(t=i),n(e,getIteratee(t,3))},lodash.sortedIndex=function sortedIndex(e,t){return baseSortedIndex(e,t)},lodash.sortedIndexBy=function sortedIndexBy(e,t,r){return baseSortedIndexBy(e,t,getIteratee(r,2))},lodash.sortedIndexOf=function sortedIndexOf(e,t){var r=null==e?0:e.length;if(r){var n=baseSortedIndex(e,t);if(n<r&&eq(e[n],t))return n}return-1},lodash.sortedLastIndex=function sortedLastIndex(e,t){return baseSortedIndex(e,t,!0)},lodash.sortedLastIndexBy=function sortedLastIndexBy(e,t,r){return baseSortedIndexBy(e,t,getIteratee(r,2),!0)},lodash.sortedLastIndexOf=function sortedLastIndexOf(e,t){if(null==e?0:e.length){var r=baseSortedIndex(e,t,!0)-1;if(eq(e[r],t))return r}return-1},lodash.startCase=Ln,lodash.startsWith=function startsWith(e,t,r){return e=toString(e),r=null==r?0:baseClamp(toInteger(r),0,e.length),t=baseToString(t),e.slice(r,r+t.length)==t},lodash.subtract=ni,lodash.sum=function sum(e){return e&&e.length?baseSum(e,identity):0},lodash.sumBy=function sumBy(e,t){return e&&e.length?baseSum(e,getIteratee(t,2)):0},lodash.template=function template(e,t,r){var n=lodash.templateSettings;r&&isIterateeCall(e,t,r)&&(t=i),e=toString(e),t=mn({},t,n,customDefaultsAssignIn);var a,o,s=mn({},t.imports,n.imports,customDefaultsAssignIn),l=keys(s),c=baseValues(s,l),u=0,d=t.interpolate||_e,p="__p += '",h=Ee((t.escape||_e).source+"|"+d.source+"|"+(d===te?ye:_e).source+"|"+(t.evaluate||_e).source+"|$","g"),y="//# sourceURL="+(Le.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++lt+"]")+"\n";e.replace(h,(function(t,r,n,i,s,l){return n||(n=i),p+=e.slice(u,l).replace(Re,escapeStringChar),r&&(a=!0,p+="' +\n__e("+r+") +\n'"),s&&(o=!0,p+="';\n"+s+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),p+="';\n";var g=Le.call(t,"variable")&&t.variable;if(g){if(pe.test(g))throw new le("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(o?p.replace(K,""):p).replace(H,"$1").replace(G,"$1;"),p="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=zn((function(){return Oe(l,y+"return "+p).apply(i,c)}));if(m.source=p,isError(m))throw m;return m},lodash.times=function times(e,t){if((e=toInteger(e))<1||e>y)return[];var r=m,n=xt(e,m);t=getIteratee(t),e-=m;for(var i=baseTimes(n,t);++r<e;)t(r);return i},lodash.toFinite=toFinite,lodash.toInteger=toInteger,lodash.toLength=toLength,lodash.toLower=function toLower(e){return toString(e).toLowerCase()},lodash.toNumber=toNumber,lodash.toSafeInteger=function toSafeInteger(e){return e?baseClamp(toInteger(e),-9007199254740991,y):0===e?e:0},lodash.toString=toString,lodash.toUpper=function toUpper(e){return toString(e).toUpperCase()},lodash.trim=function trim(e,t,r){if((e=toString(e))&&(r||t===i))return baseTrim(e);if(!e||!(t=baseToString(t)))return e;var n=stringToArray(e),a=stringToArray(t);return castSlice(n,charsStartIndex(n,a),charsEndIndex(n,a)+1).join("")},lodash.trimEnd=function trimEnd(e,t,r){if((e=toString(e))&&(r||t===i))return e.slice(0,trimmedEndIndex(e)+1);if(!e||!(t=baseToString(t)))return e;var n=stringToArray(e);return castSlice(n,0,charsEndIndex(n,stringToArray(t))+1).join("")},lodash.trimStart=function trimStart(e,t,r){if((e=toString(e))&&(r||t===i))return e.replace(se,"");if(!e||!(t=baseToString(t)))return e;var n=stringToArray(e);return castSlice(n,charsStartIndex(n,stringToArray(t))).join("")},lodash.truncate=function truncate(e,t){var r=30,n="...";if(isObject(t)){var a="separator"in t?t.separator:a;r="length"in t?toInteger(t.length):r,n="omission"in t?baseToString(t.omission):n}var o=(e=toString(e)).length;if(hasUnicode(e)){var s=stringToArray(e);o=s.length}if(r>=o)return e;var l=r-stringSize(n);if(l<1)return n;var c=s?castSlice(s,0,l).join(""):e.slice(0,l);if(a===i)return c+n;if(s&&(l+=c.length-l),un(a)){if(e.slice(l).search(a)){var u,d=c;for(a.global||(a=Ee(a.source,toString(ge.exec(a))+"g")),a.lastIndex=0;u=a.exec(d);)var p=u.index;c=c.slice(0,p===i?l:p)}}else if(e.indexOf(baseToString(a),l)!=l){var h=c.lastIndexOf(a);h>-1&&(c=c.slice(0,h))}return c+n},lodash.unescape=function unescape(e){return(e=toString(e))&&Y.test(e)?e.replace(Z,At):e},lodash.uniqueId=function uniqueId(e){var t=++Fe;return toString(e)+t},lodash.upperCase=Fn,lodash.upperFirst=Nn,lodash.each=forEach,lodash.eachRight=forEachRight,lodash.first=head,mixin(lodash,(ei={},baseForOwn(lodash,(function(e,t){Le.call(lodash.prototype,t)||(ei[t]=e)})),ei),{chain:!1}),lodash.VERSION="4.17.21",arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){lodash[e].placeholder=lodash})),arrayEach(["drop","take"],(function(e,t){LazyWrapper.prototype[e]=function(r){r=r===i?1:Mt(toInteger(r),0);var n=this.__filtered__&&!t?new LazyWrapper(this):this.clone();return n.__filtered__?n.__takeCount__=xt(r,n.__takeCount__):n.__views__.push({size:xt(r,m),type:e+(n.__dir__<0?"Right":"")}),n},LazyWrapper.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),arrayEach(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;LazyWrapper.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:getIteratee(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),arrayEach(["head","last"],(function(e,t){var r="take"+(t?"Right":"");LazyWrapper.prototype[e]=function(){return this[r](1).value()[0]}})),arrayEach(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");LazyWrapper.prototype[e]=function(){return this.__filtered__?new LazyWrapper(this):this[r](1)}})),LazyWrapper.prototype.compact=function(){return this.filter(identity)},LazyWrapper.prototype.find=function(e){return this.filter(e).head()},LazyWrapper.prototype.findLast=function(e){return this.reverse().find(e)},LazyWrapper.prototype.invokeMap=baseRest((function(e,t){return"function"==typeof e?new LazyWrapper(this):this.map((function(r){return baseInvoke(r,e,t)}))})),LazyWrapper.prototype.reject=function(e){return this.filter(negate(getIteratee(e)))},LazyWrapper.prototype.slice=function(e,t){e=toInteger(e);var r=this;return r.__filtered__&&(e>0||t<0)?new LazyWrapper(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==i&&(r=(t=toInteger(t))<0?r.dropRight(-t):r.take(t-e)),r)},LazyWrapper.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},LazyWrapper.prototype.toArray=function(){return this.take(m)},baseForOwn(LazyWrapper.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),a=lodash[n?"take"+("last"==t?"Right":""):t],o=n||/^find/.test(t);a&&(lodash.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,l=t instanceof LazyWrapper,c=s[0],u=l||an(t),interceptor=function(e){var t=a.apply(lodash,arrayPush([e],s));return n&&d?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var d=this.__chain__,p=!!this.__actions__.length,h=o&&!d,y=l&&!p;if(!o&&u){t=y?t:new LazyWrapper(this);var g=e.apply(t,s);return g.__actions__.push({func:thru,args:[interceptor],thisArg:i}),new LodashWrapper(g,d)}return h&&y?e.apply(this,s):(g=this.thru(interceptor),h?n?g.value()[0]:g.value():g)})})),arrayEach(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ae[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);lodash.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(an(i)?i:[],e)}return this[r]((function(r){return t.apply(an(r)?r:[],e)}))}})),baseForOwn(LazyWrapper.prototype,(function(e,t){var r=lodash[t];if(r){var n=r.name+"";Le.call(Kt,n)||(Kt[n]=[]),Kt[n].push({name:t,func:r})}})),Kt[createHybrid(i,2).name]=[{name:"wrapper",func:i}],LazyWrapper.prototype.clone=function lazyClone(){var e=new LazyWrapper(this.__wrapped__);return e.__actions__=copyArray(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=copyArray(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=copyArray(this.__views__),e},LazyWrapper.prototype.reverse=function lazyReverse(){if(this.__filtered__){var e=new LazyWrapper(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},LazyWrapper.prototype.value=function lazyValue(){var e=this.__wrapped__.value(),t=this.__dir__,r=an(e),n=t<0,i=r?e.length:0,a=function getView(e,t,r){var n=-1,i=r.length;for(;++n<i;){var a=r[n],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=xt(t,e+o);break;case"takeRight":e=Mt(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,l=s-o,c=n?s:o-1,u=this.__iteratees__,d=u.length,p=0,h=xt(l,this.__takeCount__);if(!r||!n&&i==l&&h==l)return baseWrapperValue(e,this.__actions__);var y=[];e:for(;l--&&p<h;){for(var g=-1,m=e[c+=t];++g<d;){var v=u[g],b=v.iteratee,w=v.type,C=b(m);if(2==w)m=C;else if(!C){if(1==w)continue e;break e}}y[p++]=m}return y},lodash.prototype.at=Fr,lodash.prototype.chain=function wrapperChain(){return chain(this)},lodash.prototype.commit=function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)},lodash.prototype.next=function wrapperNext(){this.__values__===i&&(this.__values__=toArray(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},lodash.prototype.plant=function wrapperPlant(e){for(var t,r=this;r instanceof baseLodash;){var n=wrapperClone(r);n.__index__=0,n.__values__=i,t?a.__wrapped__=n:t=n;var a=n;r=r.__wrapped__}return a.__wrapped__=e,t},lodash.prototype.reverse=function wrapperReverse(){var e=this.__wrapped__;if(e instanceof LazyWrapper){var t=e;return this.__actions__.length&&(t=new LazyWrapper(this)),(t=t.reverse()).__actions__.push({func:thru,args:[reverse],thisArg:i}),new LodashWrapper(t,this.__chain__)}return this.thru(reverse)},lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)},lodash.prototype.first=lodash.prototype.head,Qe&&(lodash.prototype[Qe]=function wrapperToIterator(){return this}),lodash}();gt._=jt,(n=function(){return jt}.call(t,r,t,e))===i||(e.exports=n)}.call(this)},8565:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class LuxonError extends Error{}class InvalidDateTimeError extends LuxonError{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class InvalidIntervalError extends LuxonError{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class InvalidDurationError extends LuxonError{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class ConflictingSpecificationError extends LuxonError{}class InvalidUnitError extends LuxonError{constructor(e){super(`Invalid unit ${e}`)}}class InvalidArgumentError extends LuxonError{}class ZoneIsAbstractError extends LuxonError{constructor(){super("Zone is an abstract class")}}const r="numeric",n="short",i="long",a={year:r,month:r,day:r},o={year:r,month:n,day:r},s={year:r,month:n,day:r,weekday:n},l={year:r,month:i,day:r},c={year:r,month:i,day:r,weekday:i},u={hour:r,minute:r},d={hour:r,minute:r,second:r},p={hour:r,minute:r,second:r,timeZoneName:n},h={hour:r,minute:r,second:r,timeZoneName:i},y={hour:r,minute:r,hourCycle:"h23"},g={hour:r,minute:r,second:r,hourCycle:"h23"},m={hour:r,minute:r,second:r,hourCycle:"h23",timeZoneName:n},v={hour:r,minute:r,second:r,hourCycle:"h23",timeZoneName:i},b={year:r,month:r,day:r,hour:r,minute:r},w={year:r,month:r,day:r,hour:r,minute:r,second:r},C={year:r,month:n,day:r,hour:r,minute:r},S={year:r,month:n,day:r,hour:r,minute:r,second:r},_={year:r,month:n,day:r,weekday:n,hour:r,minute:r},R={year:r,month:i,day:r,hour:r,minute:r,timeZoneName:n},O={year:r,month:i,day:r,hour:r,minute:r,second:r,timeZoneName:n},T={year:r,month:i,day:r,weekday:i,hour:r,minute:r,timeZoneName:i},I={year:r,month:i,day:r,weekday:i,hour:r,minute:r,second:r,timeZoneName:i};class Zone{get type(){throw new ZoneIsAbstractError}get name(){throw new ZoneIsAbstractError}get ianaName(){return this.name}get isUniversal(){throw new ZoneIsAbstractError}offsetName(e,t){throw new ZoneIsAbstractError}formatOffset(e,t){throw new ZoneIsAbstractError}offset(e){throw new ZoneIsAbstractError}equals(e){throw new ZoneIsAbstractError}get isValid(){throw new ZoneIsAbstractError}}let E=null;class SystemZone extends Zone{static get instance(){return null===E&&(E=new SystemZone),E}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return parseZoneInfo(e,t,r)}formatOffset(e,t){return formatOffset(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}let D={};const P={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};let A={};class IANAZone extends Zone{static create(e){return A[e]||(A[e]=new IANAZone(e)),A[e]}static resetCache(){A={},D={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=IANAZone.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return parseZoneInfo(e,t,r,this.name)}formatOffset(e,t){return formatOffset(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const r=function makeDTF(e){return D[e]||(D[e]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),D[e]}(this.name);let[n,i,a,o,s,l,c]=r.formatToParts?function partsOffset(e,t){const r=e.formatToParts(t),n=[];for(let e=0;e<r.length;e++){const{type:t,value:i}=r[e],a=P[t];"era"===t?n[a]=i:isUndefined(a)||(n[a]=parseInt(i,10))}return n}(r,t):function hackyOffset(e,t){const r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,a,o,s,l,c,u]=n;return[o,i,a,s,l,c,u]}(r,t);"BC"===o&&(n=1-Math.abs(n));let u=+t;const d=u%1e3;return u-=d>=0?d:1e3+d,(objToLocalTS({year:n,month:i,day:a,hour:24===s?0:s,minute:l,second:c,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let j={};let M={};function getCachedDTF(e,t={}){const r=JSON.stringify([e,t]);let n=M[r];return n||(n=new Intl.DateTimeFormat(e,t),M[r]=n),n}let x={};let k={};let L=null;let F={};function listStuff(e,t,r,n){const i=e.listingMode();return"error"===i?null:"en"===i?r(t):n(t)}class PolyNumberFormatter{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:n,floor:i,...a}=r;if(!t||Object.keys(a).length>0){const t={useGrouping:!1,...r};r.padTo>0&&(t.minimumIntegerDigits=r.padTo),this.inf=function getCachedINF(e,t={}){const r=JSON.stringify([e,t]);let n=x[r];return n||(n=new Intl.NumberFormat(e,t),x[r]=n),n}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return padStart(this.floor?Math.floor(e):roundTo(e,3),this.padTo)}}class PolyDateFormatter{constructor(e,t,r){let n;if(this.opts=r,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,r=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&IANAZone.create(r).valid?(n=r,this.dt=e):(n="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=getCachedDTF(t,i)}format(){return this.originalZone?this.formatToParts().map((({value:e})=>e)).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map((e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e})):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class PolyRelFormatter{constructor(e,t,r){this.opts={style:"long",...r},!t&&hasRelative()&&(this.rtf=function getCachedRTF(e,t={}){const{base:r,...n}=t,i=JSON.stringify([e,n]);let a=k[i];return a||(a=new Intl.RelativeTimeFormat(e,t),k[i]=a),a}(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):function formatRelativeTime(e,t,r="always",n=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===r&&a){const r="days"===e;switch(t){case 1:return r?"tomorrow":`next ${i[e][0]}`;case-1:return r?"yesterday":`last ${i[e][0]}`;case 0:return r?"today":`this ${i[e][0]}`}}const o=Object.is(t,-0)||t<0,s=Math.abs(t),l=1===s,c=i[e],u=n?l?c[1]:c[2]||c[1]:l?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const N={firstDay:1,minimalDays:4,weekend:[6,7]};class Locale{static fromOpts(e){return Locale.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,n,i=!1){const a=e||Settings.defaultLocale,o=a||(i?"en-US":function systemLocale(){return L||(L=(new Intl.DateTimeFormat).resolvedOptions().locale,L)}()),s=t||Settings.defaultNumberingSystem,l=r||Settings.defaultOutputCalendar,c=validateWeekSettings(n)||Settings.defaultWeekSettings;return new Locale(o,s,l,c,a)}static resetCache(){L=null,M={},x={},k={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:n}={}){return Locale.create(e,t,r,n)}constructor(e,t,r,n,i){const[a,o,s]=function parseLocaleString(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const r=e.indexOf("-u-");if(-1===r)return[e];{let t,n;try{t=getCachedDTF(e).resolvedOptions(),n=e}catch(i){const a=e.substring(0,r);t=getCachedDTF(a).resolvedOptions(),n=a}const{numberingSystem:i,calendar:a}=t;return[n,i,a]}}(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=r||s||null,this.weekSettings=n,this.intl=function intlConfigString(e,t,r){return r||t?(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`),e):e}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return null==this.fastNumbersCached&&(this.fastNumbersCached=function supportsFastNumbers(e){return(!e.numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===new Intl.DateTimeFormat(e.intl).resolvedOptions().numberingSystem)}(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Locale.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,validateWeekSettings(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return listStuff(this,e,months,(()=>{const r=t?{month:e,day:"numeric"}:{month:e},n=t?"format":"standalone";return this.monthsCache[n][e]||(this.monthsCache[n][e]=function mapMonths(e){const t=[];for(let r=1;r<=12;r++){const n=DateTime.utc(2009,r,1);t.push(e(n))}return t}((e=>this.extract(e,r,"month")))),this.monthsCache[n][e]}))}weekdays(e,t=!1){return listStuff(this,e,weekdays,(()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=function mapWeekdays(e){const t=[];for(let r=1;r<=7;r++){const n=DateTime.utc(2016,11,13+r);t.push(e(n))}return t}((e=>this.extract(e,r,"weekday")))),this.weekdaysCache[n][e]}))}meridiems(){return listStuff(this,void 0,(()=>te),(()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[DateTime.utc(2016,11,13,9),DateTime.utc(2016,11,13,19)].map((t=>this.extract(t,e,"dayperiod")))}return this.meridiemCache}))}eras(e){return listStuff(this,e,eras,(()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[DateTime.utc(-40,1,1),DateTime.utc(2017,1,1)].map((e=>this.extract(e,t,"era")))),this.eraCache[e]}))}extract(e,t,r){const n=this.dtFormatter(e,t).formatToParts().find((e=>e.type.toLowerCase()===r));return n?n.value:null}numberFormatter(e={}){return new PolyNumberFormatter(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new PolyDateFormatter(e,this.intl,t)}relFormatter(e={}){return new PolyRelFormatter(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function getCachedLF(e,t={}){const r=JSON.stringify([e,t]);let n=j[r];return n||(n=new Intl.ListFormat(e,t),j[r]=n),n}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hasLocaleWeekInfo()?function getCachedWeekInfo(e){let t=F[e];if(!t){const r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,F[e]=t}return t}(this.locale):N}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let z=null;class FixedOffsetZone extends Zone{static get utcInstance(){return null===z&&(z=new FixedOffsetZone(0)),z}static instance(e){return 0===e?FixedOffsetZone.utcInstance:new FixedOffsetZone(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new FixedOffsetZone(signedOffset(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${formatOffset(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${formatOffset(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return formatOffset(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class InvalidZone extends Zone{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function normalizeZone(e,t){if(isUndefined(e)||null===e)return t;if(e instanceof Zone)return e;if(function isString(e){return"string"==typeof e}(e)){const r=e.toLowerCase();return"default"===r?t:"local"===r||"system"===r?SystemZone.instance:"utc"===r||"gmt"===r?FixedOffsetZone.utcInstance:FixedOffsetZone.parseSpecifier(r)||IANAZone.create(e)}return isNumber(e)?FixedOffsetZone.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new InvalidZone(e)}let B,now=()=>Date.now(),U="system",W=null,V=null,q=null,$=60,K=null;class Settings{static get now(){return now}static set now(e){now=e}static set defaultZone(e){U=e}static get defaultZone(){return normalizeZone(U,SystemZone.instance)}static get defaultLocale(){return W}static set defaultLocale(e){W=e}static get defaultNumberingSystem(){return V}static set defaultNumberingSystem(e){V=e}static get defaultOutputCalendar(){return q}static set defaultOutputCalendar(e){q=e}static get defaultWeekSettings(){return K}static set defaultWeekSettings(e){K=validateWeekSettings(e)}static get twoDigitCutoffYear(){return $}static set twoDigitCutoffYear(e){$=e%100}static get throwOnInvalid(){return B}static set throwOnInvalid(e){B=e}static resetCaches(){Locale.resetCache(),IANAZone.resetCache()}}class Invalid{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const H=[0,31,59,90,120,151,181,212,243,273,304,334],G=[0,31,60,91,121,152,182,213,244,274,305,335];function unitOutOfRange(e,t){return new Invalid("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function dayOfWeek(e,t,r){const n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return 0===i?7:i}function computeOrdinal(e,t,r){return r+(isLeapYear(e)?G:H)[t-1]}function uncomputeOrdinal(e,t){const r=isLeapYear(e)?G:H,n=r.findIndex((e=>e<t));return{month:n+1,day:t-r[n]}}function isoWeekdayToLocal(e,t){return(e-t+7)%7+1}function gregorianToWeek(e,t=4,r=1){const{year:n,month:i,day:a}=e,o=computeOrdinal(n,i,a),s=isoWeekdayToLocal(dayOfWeek(n,i,a),r);let l,c=Math.floor((o-s+14-t)/7);return c<1?(l=n-1,c=weeksInWeekYear(l,t,r)):c>weeksInWeekYear(n,t,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:s,...timeObject(e)}}function weekToGregorian(e,t=4,r=1){const{weekYear:n,weekNumber:i,weekday:a}=e,o=isoWeekdayToLocal(dayOfWeek(n,1,t),r),s=daysInYear(n);let l,c=7*i+a-o-7+t;c<1?(l=n-1,c+=daysInYear(l)):c>s?(l=n+1,c-=daysInYear(n)):l=n;const{month:u,day:d}=uncomputeOrdinal(l,c);return{year:l,month:u,day:d,...timeObject(e)}}function gregorianToOrdinal(e){const{year:t,month:r,day:n}=e;return{year:t,ordinal:computeOrdinal(t,r,n),...timeObject(e)}}function ordinalToGregorian(e){const{year:t,ordinal:r}=e,{month:n,day:i}=uncomputeOrdinal(t,r);return{year:t,month:n,day:i,...timeObject(e)}}function usesLocalWeekValues(e,t){if(!isUndefined(e.localWeekday)||!isUndefined(e.localWeekNumber)||!isUndefined(e.localWeekYear)){if(!isUndefined(e.weekday)||!isUndefined(e.weekNumber)||!isUndefined(e.weekYear))throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");return isUndefined(e.localWeekday)||(e.weekday=e.localWeekday),isUndefined(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),isUndefined(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function hasInvalidGregorianData(e){const t=isInteger(e.year),r=integerBetween(e.month,1,12),n=integerBetween(e.day,1,daysInMonth(e.year,e.month));return t?r?!n&&unitOutOfRange("day",e.day):unitOutOfRange("month",e.month):unitOutOfRange("year",e.year)}function hasInvalidTimeData(e){const{hour:t,minute:r,second:n,millisecond:i}=e,a=integerBetween(t,0,23)||24===t&&0===r&&0===n&&0===i,o=integerBetween(r,0,59),s=integerBetween(n,0,59),l=integerBetween(i,0,999);return a?o?s?!l&&unitOutOfRange("millisecond",i):unitOutOfRange("second",n):unitOutOfRange("minute",r):unitOutOfRange("hour",t)}function isUndefined(e){return void 0===e}function isNumber(e){return"number"==typeof e}function isInteger(e){return"number"==typeof e&&e%1==0}function hasRelative(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function hasLocaleWeekInfo(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function bestBy(e,t,r){if(0!==e.length)return e.reduce(((e,n)=>{const i=[t(n),n];return e&&r(e[0],i[0])===e[0]?e:i}),null)[1]}function hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function validateWeekSettings(e){if(null==e)return null;if("object"!=typeof e)throw new InvalidArgumentError("Week settings must be an object");if(!integerBetween(e.firstDay,1,7)||!integerBetween(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some((e=>!integerBetween(e,1,7))))throw new InvalidArgumentError("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function integerBetween(e,t,r){return isInteger(e)&&e>=t&&e<=r}function padStart(e,t=2){let r;return r=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),r}function parseInteger(e){return isUndefined(e)||null===e||""===e?void 0:parseInt(e,10)}function parseFloating(e){return isUndefined(e)||null===e||""===e?void 0:parseFloat(e)}function parseMillis(e){if(!isUndefined(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function roundTo(e,t,r=!1){const n=10**t;return(r?Math.trunc:Math.round)(e*n)/n}function isLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}function daysInYear(e){return isLeapYear(e)?366:365}function daysInMonth(e,t){const r=function floorMod(e,t){return e-t*Math.floor(e/t)}(t-1,12)+1;return 2===r?isLeapYear(e+(t-r)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function objToLocalTS(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function firstWeekOffset(e,t,r){return-isoWeekdayToLocal(dayOfWeek(e,1,t),r)+t-1}function weeksInWeekYear(e,t=4,r=1){const n=firstWeekOffset(e,t,r),i=firstWeekOffset(e+1,t,r);return(daysInYear(e)-n+i)/7}function untruncateYear(e){return e>99?e:e>Settings.twoDigitCutoffYear?1900+e:2e3+e}function parseZoneInfo(e,t,r,n=null){const i=new Date(e),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);const o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(r,o).formatToParts(i).find((e=>"timezonename"===e.type.toLowerCase()));return s?s.value:null}function signedOffset(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);const n=parseInt(t,10)||0;return 60*r+(r<0||Object.is(r,-0)?-n:n)}function asNumber(e){const t=Number(e);if("boolean"==typeof e||""===e||Number.isNaN(t))throw new InvalidArgumentError(`Invalid unit value ${e}`);return t}function normalizeObject(e,t){const r={};for(const n in e)if(hasOwnProperty(e,n)){const i=e[n];if(null==i)continue;r[t(n)]=asNumber(i)}return r}function formatOffset(e,t){const r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${padStart(r,2)}:${padStart(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${padStart(r,2)}${padStart(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function timeObject(e){return function pick(e,t){return t.reduce(((t,r)=>(t[r]=e[r],t)),{})}(e,["hour","minute","second","millisecond"])}const Z=["January","February","March","April","May","June","July","August","September","October","November","December"],J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Y=["J","F","M","A","M","J","J","A","S","O","N","D"];function months(e){switch(e){case"narrow":return[...Y];case"short":return[...J];case"long":return[...Z];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Q=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],X=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ee=["M","T","W","T","F","S","S"];function weekdays(e){switch(e){case"narrow":return[...ee];case"short":return[...X];case"long":return[...Q];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const te=["AM","PM"],re=["Before Christ","Anno Domini"],ne=["BC","AD"],ie=["B","A"];function eras(e){switch(e){case"narrow":return[...ie];case"short":return[...ne];case"long":return[...re];default:return null}}function stringifyTokens(e,t){let r="";for(const n of e)n.literal?r+=n.val:r+=t(n.val);return r}const ae={D:a,DD:o,DDD:l,DDDD:c,t:u,tt:d,ttt:p,tttt:h,T:y,TT:g,TTT:m,TTTT:v,f:b,ff:C,fff:R,ffff:T,F:w,FF:S,FFF:O,FFFF:I};class Formatter{static create(e,t={}){return new Formatter(e,t)}static parseFormat(e){let t=null,r="",n=!1;const i=[];for(let a=0;a<e.length;a++){const o=e.charAt(a);"'"===o?(r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),t=null,r="",n=!n):n||o===t?r+=o:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return ae[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem());return this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return padStart(e,t);const r={...this.opts};return t>0&&(r.padTo=t),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const r="en"===this.loc.listingMode(),n=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,string=(t,r)=>this.loc.extract(e,t,r),formatOffset=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",meridiem=()=>r?function meridiemForDateTime(e){return te[e.hour<12?0:1]}(e):string({hour:"numeric",hourCycle:"h12"},"dayperiod"),month=(t,n)=>r?function monthForDateTime(e,t){return months(t)[e.month-1]}(e,t):string(n?{month:t}:{month:t,day:"numeric"},"month"),weekday=(t,n)=>r?function weekdayForDateTime(e,t){return weekdays(t)[e.weekday-1]}(e,t):string(n?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),maybeMacro=t=>{const r=Formatter.macroTokenToFormatOpts(t);return r?this.formatWithSystemDefault(e,r):t},era=t=>r?function eraForDateTime(e,t){return eras(t)[e.year<0?0:1]}(e,t):string({era:t},"era");return stringifyTokens(Formatter.parseFormat(t),(t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return formatOffset({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return formatOffset({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return formatOffset({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return meridiem();case"d":return n?string({day:"numeric"},"day"):this.num(e.day);case"dd":return n?string({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return weekday("short",!0);case"cccc":return weekday("long",!0);case"ccccc":return weekday("narrow",!0);case"EEE":return weekday("short",!1);case"EEEE":return weekday("long",!1);case"EEEEE":return weekday("narrow",!1);case"L":return n?string({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?string({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return month("short",!0);case"LLLL":return month("long",!0);case"LLLLL":return month("narrow",!0);case"M":return n?string({month:"numeric"},"month"):this.num(e.month);case"MM":return n?string({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return month("short",!1);case"MMMM":return month("long",!1);case"MMMMM":return month("narrow",!1);case"y":return n?string({year:"numeric"},"year"):this.num(e.year);case"yy":return n?string({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?string({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?string({year:"numeric"},"year"):this.num(e.year,6);case"G":return era("short");case"GG":return era("long");case"GGGGG":return era("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return maybeMacro(t)}}))}formatDurationFromString(e,t){const tokenToField=e=>{switch(e[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},r=Formatter.parseFormat(t),n=r.reduce(((e,{literal:t,val:r})=>t?e:e.concat(r)),[]);return stringifyTokens(r,(e=>t=>{const r=tokenToField(t);return r?this.num(e.get(r),t.length):t})(e.shiftTo(...n.map(tokenToField).filter((e=>e)))))}}const oe=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function combineRegexes(...e){const t=e.reduce(((e,t)=>e+t.source),"");return RegExp(`^${t}$`)}function combineExtractors(...e){return t=>e.reduce((([e,r,n],i)=>{const[a,o,s]=i(t,n);return[{...e,...a},o||r,s]}),[{},null,1]).slice(0,2)}function parse(e,...t){if(null==e)return[null,null];for(const[r,n]of t){const t=r.exec(e);if(t)return n(t)}return[null,null]}function simpleParse(...e){return(t,r)=>{const n={};let i;for(i=0;i<e.length;i++)n[e[i]]=parseInteger(t[r+i]);return[n,null,r+i]}}const se=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,le=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ce=RegExp(`${le.source}${`(?:${se.source}?(?:\\[(${oe.source})\\])?)?`}`),ue=RegExp(`(?:T${ce.source})?`),de=simpleParse("weekYear","weekNumber","weekDay"),fe=simpleParse("year","ordinal"),pe=RegExp(`${le.source} ?(?:${se.source}|(${oe.source}))?`),he=RegExp(`(?: ${pe.source})?`);function int(e,t,r){const n=e[t];return isUndefined(n)?r:parseInteger(n)}function extractISOTime(e,t){return[{hours:int(e,t,0),minutes:int(e,t+1,0),seconds:int(e,t+2,0),milliseconds:parseMillis(e[t+3])},null,t+4]}function extractISOOffset(e,t){const r=!e[t]&&!e[t+1],n=signedOffset(e[t+1],e[t+2]);return[{},r?null:FixedOffsetZone.instance(n),t+3]}function extractIANAZone(e,t){return[{},e[t]?IANAZone.create(e[t]):null,t+1]}const ye=RegExp(`^T?${le.source}$`),ge=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function extractISODuration(e){const[t,r,n,i,a,o,s,l,c]=e,u="-"===t[0],d=l&&"-"===l[0],maybeNegate=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:maybeNegate(parseFloating(r)),months:maybeNegate(parseFloating(n)),weeks:maybeNegate(parseFloating(i)),days:maybeNegate(parseFloating(a)),hours:maybeNegate(parseFloating(o)),minutes:maybeNegate(parseFloating(s)),seconds:maybeNegate(parseFloating(l),"-0"===l),milliseconds:maybeNegate(parseMillis(c),d)}]}const me={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function fromStrings(e,t,r,n,i,a,o){const s={year:2===t.length?untruncateYear(parseInteger(t)):parseInteger(t),month:J.indexOf(r)+1,day:parseInteger(n),hour:parseInteger(i),minute:parseInteger(a)};return o&&(s.second=parseInteger(o)),e&&(s.weekday=e.length>3?Q.indexOf(e)+1:X.indexOf(e)+1),s}const ve=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function extractRFC2822(e){const[,t,r,n,i,a,o,s,l,c,u,d]=e,p=fromStrings(t,i,n,r,a,o,s);let h;return h=l?me[l]:c?0:signedOffset(u,d),[p,new FixedOffsetZone(h)]}const be=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,we=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ce=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function extractRFC1123Or850(e){const[,t,r,n,i,a,o,s]=e;return[fromStrings(t,i,n,r,a,o,s),FixedOffsetZone.utcInstance]}function extractASCII(e){const[,t,r,n,i,a,o,s]=e;return[fromStrings(t,s,r,n,i,a,o),FixedOffsetZone.utcInstance]}const Se=combineRegexes(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ue),_e=combineRegexes(/(\d{4})-?W(\d\d)(?:-?(\d))?/,ue),Re=combineRegexes(/(\d{4})-?(\d{3})/,ue),Oe=combineRegexes(ce),Te=combineExtractors((function extractISOYmd(e,t){return[{year:int(e,t),month:int(e,t+1,1),day:int(e,t+2,1)},null,t+3]}),extractISOTime,extractISOOffset,extractIANAZone),Ie=combineExtractors(de,extractISOTime,extractISOOffset,extractIANAZone),Ee=combineExtractors(fe,extractISOTime,extractISOOffset,extractIANAZone),De=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);const Pe=combineExtractors(extractISOTime);const Ae=combineRegexes(/(\d{4})-(\d\d)-(\d\d)/,he),je=combineRegexes(pe),Me=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);const xe="Invalid Duration",ke={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Le={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...ke},Fe=365.2425,Ne=30.436875,ze={years:{quarters:4,months:12,weeks:52.1775,days:Fe,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:Ne,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...ke},Be=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Ue=Be.slice(0).reverse();function clone$1(e,t,r=!1){const n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new Duration(n)}function durationToMillis(e,t){var r;let n=null!=(r=t.milliseconds)?r:0;for(const r of Ue.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function normalizeValues(e,t){const r=durationToMillis(e,t)<0?-1:1;Be.reduceRight(((n,i)=>{if(isUndefined(t[i]))return n;if(n){const a=t[n]*r,o=e[i][n],s=Math.floor(a/o);t[i]+=s*r,t[n]-=s*o*r}return i}),null),Be.reduce(((r,n)=>{if(isUndefined(t[n]))return r;if(r){const i=t[r]%1;t[r]-=i,t[n]+=i*e[r][n]}return n}),null)}class Duration{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let r=t?ze:Le;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Locale.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return Duration.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new Duration({values:normalizeObject(e,Duration.normalizeUnit),loc:Locale.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(isNumber(e))return Duration.fromMillis(e);if(Duration.isDuration(e))return e;if("object"==typeof e)return Duration.fromObject(e);throw new InvalidArgumentError(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=function parseISODuration(e){return parse(e,[ge,extractISODuration])}(e);return r?Duration.fromObject(r,t):Duration.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=function parseISOTimeOnly(e){return parse(e,[ye,Pe])}(e);return r?Duration.fromObject(r,t):Duration.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the Duration is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidDurationError(r);return new Duration({invalid:r})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e?e.toLowerCase():e];if(!t)throw new InvalidUnitError(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const r={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?Formatter.create(this.loc,r).formatDurationFromString(this,e):xe}toHuman(e={}){if(!this.isValid)return xe;const t=Be.map((t=>{const r=this.values[t];return isUndefined(r)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:t.slice(0,-1)}).format(r)})).filter((e=>e));return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=roundTo(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1};return DateTime.fromMillis(t,{zone:"UTC"}).toISOTime(e)}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?durationToMillis(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Duration.fromDurationLike(e),r={};for(const e of Be)(hasOwnProperty(t.values,e)||hasOwnProperty(this.values,e))&&(r[e]=t.get(e)+this.get(e));return clone$1(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=Duration.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=asNumber(e(this.values[r],r));return clone$1(this,{values:t},!0)}get(e){return this[Duration.normalizeUnit(e)]}set(e){if(!this.isValid)return this;return clone$1(this,{values:{...this.values,...normalizeObject(e,Duration.normalizeUnit)}})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:n}={}){return clone$1(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:r})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return normalizeValues(this.matrix,e),clone$1(this,{values:e},!0)}rescale(){if(!this.isValid)return this;return clone$1(this,{values:function removeZeroes(e){const t={};for(const[r,n]of Object.entries(e))0!==n&&(t[r]=n);return t}(this.normalize().shiftToAll().toObject())},!0)}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map((e=>Duration.normalizeUnit(e)));const t={},r={},n=this.toObject();let i;for(const a of Be)if(e.indexOf(a)>=0){i=a;let e=0;for(const t in r)e+=this.matrix[t][a]*r[t],r[t]=0;isNumber(n[a])&&(e+=n[a]);const o=Math.trunc(e);t[a]=o,r[a]=(1e3*e-1e3*o)/1e3}else isNumber(n[a])&&(r[a]=n[a]);for(const e in r)0!==r[e]&&(t[i]+=e===i?r[e]:r[e]/this.matrix[i][e]);return normalizeValues(this.matrix,t),clone$1(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return clone$1(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid)return!1;if(!this.loc.equals(e.loc))return!1;for(const n of Be)if(t=this.values[n],r=e.values[n],!(void 0===t||0===t?void 0===r||0===r:t===r))return!1;var t,r;return!0}}const We="Invalid Interval";class Interval{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the Interval is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidIntervalError(r);return new Interval({invalid:r})}static fromDateTimes(e,t){const r=friendlyDateTime(e),n=friendlyDateTime(t),i=function validateStartEnd(e,t){return e&&e.isValid?t&&t.isValid?t<e?Interval.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null:Interval.invalid("missing or invalid end"):Interval.invalid("missing or invalid start")}(r,n);return null==i?new Interval({start:r,end:n}):i}static after(e,t){const r=Duration.fromDurationLike(t),n=friendlyDateTime(e);return Interval.fromDateTimes(n,n.plus(r))}static before(e,t){const r=Duration.fromDurationLike(t),n=friendlyDateTime(e);return Interval.fromDateTimes(n.minus(r),n)}static fromISO(e,t){const[r,n]=(e||"").split("/",2);if(r&&n){let e,i,a,o;try{e=DateTime.fromISO(r,t),i=e.isValid}catch(n){i=!1}try{a=DateTime.fromISO(n,t),o=a.isValid}catch(n){o=!1}if(i&&o)return Interval.fromDateTimes(e,a);if(i){const r=Duration.fromISO(n,t);if(r.isValid)return Interval.after(e,r)}else if(o){const e=Duration.fromISO(r,t);if(e.isValid)return Interval.before(a,e)}}return Interval.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const r=this.start.startOf(e,t);let n;return n=null!=t&&t.useLocaleWeeks?this.end.reconfigure({locale:r.locale}):this.end,n=n.startOf(e,t),Math.floor(n.diff(r,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&(this.s<=e&&this.e>e)}set({start:e,end:t}={}){return this.isValid?Interval.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(friendlyDateTime).filter((e=>this.contains(e))).sort(((e,t)=>e.toMillis()-t.toMillis())),r=[];let{s:n}=this,i=0;for(;n<this.e;){const e=t[i]||this.e,a=+e>+this.e?this.e:e;r.push(Interval.fromDateTimes(n,a)),n=a,i+=1}return r}splitBy(e){const t=Duration.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let r,{s:n}=this,i=1;const a=[];for(;n<this.e;){const e=this.start.plus(t.mapUnits((e=>e*i)));r=+e>+this.e?this.e:e,a.push(Interval.fromDateTimes(n,r)),n=r,i+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return!!this.isValid&&+this.e==+e.s}abutsEnd(e){return!!this.isValid&&+e.e==+this.s}engulfs(e){return!!this.isValid&&(this.s<=e.s&&this.e>=e.e)}equals(e){return!(!this.isValid||!e.isValid)&&(this.s.equals(e.s)&&this.e.equals(e.e))}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:Interval.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return Interval.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort(((e,t)=>e.s-t.s)).reduce((([e,t],r)=>t?t.overlaps(r)||t.abutsStart(r)?[e,t.union(r)]:[e.concat([t]),r]:[e,r]),[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const n=[],i=e.map((e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}])),a=Array.prototype.concat(...i).sort(((e,t)=>e.time-t.time));for(const e of a)r+="s"===e.type?1:-1,1===r?t=e.time:(t&&+t!=+e.time&&n.push(Interval.fromDateTimes(t,e.time)),t=null);return Interval.merge(n)}difference(...e){return Interval.xor([this].concat(e)).map((e=>this.intersection(e))).filter((e=>e&&!e.isEmpty()))}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:We}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=a,t={}){return this.isValid?Formatter.create(this.s.loc.clone(t),e).formatInterval(this):We}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:We}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:We}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:We}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:We}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Duration.invalid(this.invalidReason)}mapEndpoints(e){return Interval.fromDateTimes(e(this.s),e(this.e))}}class Info{static hasDST(e=Settings.defaultZone){const t=DateTime.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return IANAZone.isValidZone(e)}static normalizeZone(e){return normalizeZone(e,Settings.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||Locale.create(t,r,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||Locale.create(t,r,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Locale.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Locale.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Locale.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Locale.create(t,null,"gregory").eras(e)}static features(){return{relative:hasRelative(),localeWeek:hasLocaleWeekInfo()}}}function dayDiff(e,t){const utcDayStart=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=utcDayStart(t)-utcDayStart(e);return Math.floor(Duration.fromMillis(r).as("days"))}function diff(e,t,r,n){let[i,a,o,s]=function highOrderDiffs(e,t,r){const n=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const r=dayDiff(e,t);return(r-r%7)/7}],["days",dayDiff]],i={},a=e;let o,s;for(const[l,c]of n)r.indexOf(l)>=0&&(o=l,i[l]=c(e,t),s=a.plus(i),s>t?(i[l]--,(e=a.plus(i))>t&&(s=e,i[l]--,e=a.plus(i))):e=s);return[e,i,s,o]}(e,t,r);const l=t-i,c=r.filter((e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0));0===c.length&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+l/(o-i)));const u=Duration.fromObject(a,n);return c.length>0?Duration.fromMillis(l,n).shiftTo(...c).plus(u):u}const Ve={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},qe={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},$e=Ve.hanidec.replace(/[\[|\]]/g,"").split("");function digitRegex({numberingSystem:e},t=""){return new RegExp(`${Ve[e||"latn"]}${t}`)}const Ke="missing Intl.DateTimeFormat.formatToParts support";function intUnit(e,t=(e=>e)){return{regex:e,deser:([e])=>t(function parseDigits(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(-1!==e[r].search(Ve.hanidec))t+=$e.indexOf(e[r]);else for(const e in qe){const[r,i]=qe[e];n>=r&&n<=i&&(t+=n-r)}}return parseInt(t,10)}return t}(e))}}const He=`[ ${String.fromCharCode(160)}]`,Ge=new RegExp(He,"g");function fixListRegex(e){return e.replace(/\./g,"\\.?").replace(Ge,He)}function stripInsensitivities(e){return e.replace(/\./g,"").replace(Ge," ").toLowerCase()}function oneOf(e,t){return null===e?null:{regex:RegExp(e.map(fixListRegex).join("|")),deser:([r])=>e.findIndex((e=>stripInsensitivities(r)===stripInsensitivities(e)))+t}}function offset(e,t){return{regex:e,deser:([,e,t])=>signedOffset(e,t),groups:t}}function simple(e){return{regex:e,deser:([e])=>e}}const Ze={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let Je=null;function expandMacroTokens(e,t){return Array.prototype.concat(...e.map((e=>function maybeExpandMacroToken(e,t){if(e.literal)return e;const r=formatOptsToTokens(Formatter.macroTokenToFormatOpts(e.val),t);return null==r||r.includes(void 0)?e:r}(e,t))))}function explainFromTokens(e,t,r){const n=expandMacroTokens(Formatter.parseFormat(r),e),i=n.map((t=>function unitForToken(e,t){const r=digitRegex(t),n=digitRegex(t,"{2}"),i=digitRegex(t,"{3}"),a=digitRegex(t,"{4}"),o=digitRegex(t,"{6}"),s=digitRegex(t,"{1,2}"),l=digitRegex(t,"{1,3}"),c=digitRegex(t,"{1,6}"),u=digitRegex(t,"{1,9}"),d=digitRegex(t,"{2,4}"),p=digitRegex(t,"{4,6}"),literal=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},h=(h=>{if(e.literal)return literal(h);switch(h.val){case"G":return oneOf(t.eras("short"),0);case"GG":return oneOf(t.eras("long"),0);case"y":return intUnit(c);case"yy":case"kk":return intUnit(d,untruncateYear);case"yyyy":case"kkkk":return intUnit(a);case"yyyyy":return intUnit(p);case"yyyyyy":return intUnit(o);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return intUnit(s);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return intUnit(n);case"MMM":return oneOf(t.months("short",!0),1);case"MMMM":return oneOf(t.months("long",!0),1);case"LLL":return oneOf(t.months("short",!1),1);case"LLLL":return oneOf(t.months("long",!1),1);case"o":case"S":return intUnit(l);case"ooo":case"SSS":return intUnit(i);case"u":return simple(u);case"uu":return simple(s);case"uuu":case"E":case"c":return intUnit(r);case"a":return oneOf(t.meridiems(),0);case"EEE":return oneOf(t.weekdays("short",!1),1);case"EEEE":return oneOf(t.weekdays("long",!1),1);case"ccc":return oneOf(t.weekdays("short",!0),1);case"cccc":return oneOf(t.weekdays("long",!0),1);case"Z":case"ZZ":return offset(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return offset(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return simple(/[a-z_+-/]{1,256}?/i);case" ":return simple(/[^\S\n\r]/);default:return literal(h)}})(e)||{invalidReason:Ke};return h.token=e,h}(t,e))),a=i.find((e=>e.invalidReason));if(a)return{input:t,tokens:n,invalidReason:a.invalidReason};{const[e,r]=function buildRegex(e){return[`^${e.map((e=>e.regex)).reduce(((e,t)=>`${e}(${t.source})`),"")}$`,e]}(i),a=RegExp(e,"i"),[o,s]=function match(e,t,r){const n=e.match(t);if(n){const e={};let t=1;for(const i in r)if(hasOwnProperty(r,i)){const a=r[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(n.slice(t,t+o))),t+=o}return[n,e]}return[n,{}]}(t,a,r),[l,c,u]=s?function dateTimeFromMatches(e){let t,r=null;return isUndefined(e.z)||(r=IANAZone.create(e.z)),isUndefined(e.Z)||(r||(r=new FixedOffsetZone(e.Z)),t=e.Z),isUndefined(e.q)||(e.M=3*(e.q-1)+1),isUndefined(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),isUndefined(e.u)||(e.S=parseMillis(e.u)),[Object.keys(e).reduce(((t,r)=>{const n=(e=>{switch(e){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(r);return n&&(t[n]=e[r]),t}),{}),r,t]}(s):[null,null,void 0];if(hasOwnProperty(s,"a")&&hasOwnProperty(s,"H"))throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:n,regex:a,rawMatches:o,matches:s,result:l,zone:c,specificOffset:u}}}function formatOptsToTokens(e,t){if(!e)return null;const r=Formatter.create(t,e).dtFormatter(function getDummyDateTime(){return Je||(Je=DateTime.fromMillis(1555555555555)),Je}()),n=r.formatToParts(),i=r.resolvedOptions();return n.map((t=>function tokenForPart(e,t,r){const{type:n,value:i}=e;if("literal"===n){const e=/^\s+$/.test(i);return{literal:!e,val:e?" ":i}}const a=t[n];let o=n;"hour"===n&&(o=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":r.hour12?"hour12":"hour24");let s=Ze[o];if("object"==typeof s&&(s=s[a]),s)return{literal:!1,val:s}}(t,e,i)))}const Ye="Invalid DateTime",Qe=864e13;function unsupportedZone(e){return new Invalid("unsupported zone",`the zone "${e.name}" is not supported`)}function possiblyCachedWeekData(e){return null===e.weekData&&(e.weekData=gregorianToWeek(e.c)),e.weekData}function possiblyCachedLocalWeekData(e){return null===e.localWeekData&&(e.localWeekData=gregorianToWeek(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function clone(e,t){const r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new DateTime({...r,...t,old:r})}function fixOffset(e,t,r){let n=e-60*t*1e3;const i=r.offset(n);if(t===i)return[n,t];n-=60*(i-t)*1e3;const a=r.offset(n);return i===a?[n,i]:[e-60*Math.min(i,a)*1e3,Math.max(i,a)]}function tsToObj(e,t){const r=new Date(e+=60*t*1e3);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function objToTS(e,t,r){return fixOffset(objToLocalTS(e),t,r)}function adjustTime(e,t){const r=e.o,n=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),a={...e.c,year:n,month:i,day:Math.min(e.c.day,daysInMonth(n,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},o=Duration.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),s=objToLocalTS(a);let[l,c]=fixOffset(s,r,e.zone);return 0!==o&&(l+=o,c=e.zone.offset(l)),{ts:l,o:c}}function parseDataToDateTime(e,t,r,n,i,a){const{setZone:o,zone:s}=r;if(e&&0!==Object.keys(e).length||t){const n=t||s,i=DateTime.fromObject(e,{...r,zone:n,specificOffset:a});return o?i:i.setZone(s)}return DateTime.invalid(new Invalid("unparsable",`the input "${i}" can't be parsed as ${n}`))}function toTechFormat(e,t,r=!0){return e.isValid?Formatter.create(Locale.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function toISODate(e,t){const r=e.c.year>9999||e.c.year<0;let n="";return r&&e.c.year>=0&&(n+="+"),n+=padStart(e.c.year,r?6:4),t?(n+="-",n+=padStart(e.c.month),n+="-",n+=padStart(e.c.day)):(n+=padStart(e.c.month),n+=padStart(e.c.day)),n}function toISOTime(e,t,r,n,i,a){let o=padStart(e.c.hour);return t?(o+=":",o+=padStart(e.c.minute),0===e.c.millisecond&&0===e.c.second&&r||(o+=":")):o+=padStart(e.c.minute),0===e.c.millisecond&&0===e.c.second&&r||(o+=padStart(e.c.second),0===e.c.millisecond&&n||(o+=".",o+=padStart(e.c.millisecond,3))),i&&(e.isOffsetFixed&&0===e.offset&&!a?o+="Z":e.o<0?(o+="-",o+=padStart(Math.trunc(-e.o/60)),o+=":",o+=padStart(Math.trunc(-e.o%60))):(o+="+",o+=padStart(Math.trunc(e.o/60)),o+=":",o+=padStart(Math.trunc(e.o%60)))),a&&(o+="["+e.zone.ianaName+"]"),o}const Xe={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},et={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},tt={ordinal:1,hour:0,minute:0,second:0,millisecond:0},rt=["year","month","day","hour","minute","second","millisecond"],nt=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],it=["year","ordinal","hour","minute","second","millisecond"];function normalizeUnitWithLocalWeeks(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return function normalizeUnit(e){const t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new InvalidUnitError(e);return t}(e)}}function quickDT(e,t){const r=normalizeZone(t.zone,Settings.defaultZone),n=Locale.fromObject(t),i=Settings.now();let a,o;if(isUndefined(e.year))a=i;else{for(const t of rt)isUndefined(e[t])&&(e[t]=Xe[t]);const t=hasInvalidGregorianData(e)||hasInvalidTimeData(e);if(t)return DateTime.invalid(t);const n=r.offset(i);[a,o]=objToTS(e,n,r)}return new DateTime({ts:a,zone:r,loc:n,o})}function diffRelative(e,t,r){const n=!!isUndefined(r.round)||r.round,format=(e,i)=>{e=roundTo(e,n||r.calendary?0:2,!0);return t.loc.clone(r).relFormatter(r).format(e,i)},differ=n=>r.calendary?t.hasSame(e,n)?0:t.startOf(n).diff(e.startOf(n),n).get(n):t.diff(e,n).get(n);if(r.unit)return format(differ(r.unit),r.unit);for(const e of r.units){const t=differ(e);if(Math.abs(t)>=1)return format(t,e)}return format(e>t?-0:0,r.units[r.units.length-1])}function lastOpts(e){let t,r={};return e.length>0&&"object"==typeof e[e.length-1]?(r=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[r,t]}class DateTime{constructor(e){const t=e.zone||Settings.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new Invalid("invalid input"):null)||(t.isValid?null:unsupportedZone(t));this.ts=isUndefined(e.ts)?Settings.now():e.ts;let n=null,i=null;if(!r){if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{const e=t.offset(this.ts);n=tsToObj(this.ts,e),r=Number.isNaN(n.year)?new Invalid("invalid input"):null,n=r?null:n,i=r?null:e}}this._zone=t,this.loc=e.loc||Locale.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new DateTime({})}static local(){const[e,t]=lastOpts(arguments),[r,n,i,a,o,s,l]=t;return quickDT({year:r,month:n,day:i,hour:a,minute:o,second:s,millisecond:l},e)}static utc(){const[e,t]=lastOpts(arguments),[r,n,i,a,o,s,l]=t;return e.zone=FixedOffsetZone.utcInstance,quickDT({year:r,month:n,day:i,hour:a,minute:o,second:s,millisecond:l},e)}static fromJSDate(e,t={}){const r=function isDate(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(r))return DateTime.invalid("invalid input");const n=normalizeZone(t.zone,Settings.defaultZone);return n.isValid?new DateTime({ts:r,zone:n,loc:Locale.fromObject(t)}):DateTime.invalid(unsupportedZone(n))}static fromMillis(e,t={}){if(isNumber(e))return e<-Qe||e>Qe?DateTime.invalid("Timestamp out of range"):new DateTime({ts:e,zone:normalizeZone(t.zone,Settings.defaultZone),loc:Locale.fromObject(t)});throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(isNumber(e))return new DateTime({ts:1e3*e,zone:normalizeZone(t.zone,Settings.defaultZone),loc:Locale.fromObject(t)});throw new InvalidArgumentError("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=normalizeZone(t.zone,Settings.defaultZone);if(!r.isValid)return DateTime.invalid(unsupportedZone(r));const n=Locale.fromObject(t),i=normalizeObject(e,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:a,startOfWeek:o}=usesLocalWeekValues(i,n),s=Settings.now(),l=isUndefined(t.specificOffset)?r.offset(s):t.specificOffset,c=!isUndefined(i.ordinal),u=!isUndefined(i.year),d=!isUndefined(i.month)||!isUndefined(i.day),p=u||d,h=i.weekYear||i.weekNumber;if((p||c)&&h)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&c)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const y=h||i.weekday&&!p;let g,m,v=tsToObj(s,l);y?(g=nt,m=et,v=gregorianToWeek(v,a,o)):c?(g=it,m=tt,v=gregorianToOrdinal(v)):(g=rt,m=Xe);let b=!1;for(const e of g){isUndefined(i[e])?i[e]=b?m[e]:v[e]:b=!0}const w=y?function hasInvalidWeekData(e,t=4,r=1){const n=isInteger(e.weekYear),i=integerBetween(e.weekNumber,1,weeksInWeekYear(e.weekYear,t,r)),a=integerBetween(e.weekday,1,7);return n?i?!a&&unitOutOfRange("weekday",e.weekday):unitOutOfRange("week",e.weekNumber):unitOutOfRange("weekYear",e.weekYear)}(i,a,o):c?function hasInvalidOrdinalData(e){const t=isInteger(e.year),r=integerBetween(e.ordinal,1,daysInYear(e.year));return t?!r&&unitOutOfRange("ordinal",e.ordinal):unitOutOfRange("year",e.year)}(i):hasInvalidGregorianData(i),C=w||hasInvalidTimeData(i);if(C)return DateTime.invalid(C);const S=y?weekToGregorian(i,a,o):c?ordinalToGregorian(i):i,[_,R]=objToTS(S,l,r),O=new DateTime({ts:_,zone:r,o:R,loc:n});return i.weekday&&p&&e.weekday!==O.weekday?DateTime.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${O.toISO()}`):O}static fromISO(e,t={}){const[r,n]=function parseISODate(e){return parse(e,[Se,Te],[_e,Ie],[Re,Ee],[Oe,De])}(e);return parseDataToDateTime(r,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,n]=function parseRFC2822Date(e){return parse(function preprocessRFC2822(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[ve,extractRFC2822])}(e);return parseDataToDateTime(r,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,n]=function parseHTTPDate(e){return parse(e,[be,extractRFC1123Or850],[we,extractRFC1123Or850],[Ce,extractASCII])}(e);return parseDataToDateTime(r,n,t,"HTTP",t)}static fromFormat(e,t,r={}){if(isUndefined(e)||isUndefined(t))throw new InvalidArgumentError("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:i=null}=r,a=Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,s,l,c]=function parseFromTokens(e,t,r){const{result:n,zone:i,specificOffset:a,invalidReason:o}=explainFromTokens(e,t,r);return[n,i,a,o]}(a,e,t);return c?DateTime.invalid(c):parseDataToDateTime(o,s,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return DateTime.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,n]=function parseSQL(e){return parse(e,[Ae,Te],[je,Me])}(e);return parseDataToDateTime(r,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidDateTimeError(r);return new DateTime({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=formatOptsToTokens(e,Locale.fromObject(t));return r?r.map((e=>e?e.val:null)).join(""):null}static expandFormat(e,t={}){return expandMacroTokens(Formatter.parseFormat(e),Locale.fromObject(t)).map((e=>e.val)).join("")}get(e){return this[e]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?possiblyCachedWeekData(this).weekYear:NaN}get weekNumber(){return this.isValid?possiblyCachedWeekData(this).weekNumber:NaN}get weekday(){return this.isValid?possiblyCachedWeekData(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?possiblyCachedLocalWeekData(this).weekday:NaN}get localWeekNumber(){return this.isValid?possiblyCachedLocalWeekData(this).weekNumber:NaN}get localWeekYear(){return this.isValid?possiblyCachedLocalWeekData(this).weekYear:NaN}get ordinal(){return this.isValid?gregorianToOrdinal(this.c).ordinal:NaN}get monthShort(){return this.isValid?Info.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Info.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Info.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Info.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=objToLocalTS(this.c),n=this.zone.offset(r-e),i=this.zone.offset(r+e),a=this.zone.offset(r-n*t),o=this.zone.offset(r-i*t);if(a===o)return[this];const s=r-a*t,l=r-o*t,c=tsToObj(s,a),u=tsToObj(l,o);return c.hour===u.hour&&c.minute===u.minute&&c.second===u.second&&c.millisecond===u.millisecond?[clone(this,{ts:s}),clone(this,{ts:l})]:[this]}get isInLeapYear(){return isLeapYear(this.year)}get daysInMonth(){return daysInMonth(this.year,this.month)}get daysInYear(){return this.isValid?daysInYear(this.year):NaN}get weeksInWeekYear(){return this.isValid?weeksInWeekYear(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?weeksInWeekYear(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:n}=Formatter.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(FixedOffsetZone.instance(e),t)}toLocal(){return this.setZone(Settings.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if((e=normalizeZone(e,Settings.defaultZone)).equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||r){const t=e.offset(this.ts),r=this.toObject();[n]=objToTS(r,t,e)}return clone(this,{ts:n,zone:e})}return DateTime.invalid(unsupportedZone(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){return clone(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=normalizeObject(e,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:r,startOfWeek:n}=usesLocalWeekValues(t,this.loc),i=!isUndefined(t.weekYear)||!isUndefined(t.weekNumber)||!isUndefined(t.weekday),a=!isUndefined(t.ordinal),o=!isUndefined(t.year),s=!isUndefined(t.month)||!isUndefined(t.day),l=o||s,c=t.weekYear||t.weekNumber;if((l||a)&&c)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(s&&a)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");let u;i?u=weekToGregorian({...gregorianToWeek(this.c,r,n),...t},r,n):isUndefined(t.ordinal)?(u={...this.toObject(),...t},isUndefined(t.day)&&(u.day=Math.min(daysInMonth(u.year,u.month),u.day))):u=ordinalToGregorian({...gregorianToOrdinal(this.c),...t});const[d,p]=objToTS(u,this.o,this.zone);return clone(this,{ts:d,o:p})}plus(e){if(!this.isValid)return this;return clone(this,adjustTime(this,Duration.fromDurationLike(e)))}minus(e){if(!this.isValid)return this;return clone(this,adjustTime(this,Duration.fromDurationLike(e).negate()))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},n=Duration.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0}if("weeks"===n)if(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(r.weekNumber=this.weekNumber-1),r.weekday=e}else r.weekday=1;if("quarters"===n){const e=Math.ceil(this.month/3);r.month=3*(e-1)+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Formatter.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Ye}toLocaleString(e=a,t={}){return this.isValid?Formatter.create(this.loc.clone(t),e).formatDateTime(this):Ye}toLocaleParts(e={}){return this.isValid?Formatter.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:n=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;const a="extended"===e;let o=toISODate(this,a);return o+="T",o+=toISOTime(this,a,t,r,n,i),o}toISODate({format:e="extended"}={}){return this.isValid?toISODate(this,"extended"===e):null}toISOWeekDate(){return toTechFormat(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:n=!1,extendedZone:i=!1,format:a="extended"}={}){if(!this.isValid)return null;return(n?"T":"")+toISOTime(this,"extended"===a,t,e,r,i)}toRFC2822(){return toTechFormat(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return toTechFormat(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?toISODate(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(r&&(n+=" "),t?n+="z":e&&(n+="ZZ")),toTechFormat(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ye}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return Duration.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=function maybeArray(e){return Array.isArray(e)?e:[e]}(t).map(Duration.normalizeUnit),a=e.valueOf()>this.valueOf(),o=diff(a?this:e,a?e:this,i,n);return a?o.negate():o}diffNow(e="milliseconds",t={}){return this.diff(DateTime.now(),e,t)}until(e){return this.isValid?Interval.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,r)<=n&&n<=i.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||DateTime.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),diffRelative(t,this.plus(r),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?diffRelative(e.base||DateTime.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(DateTime.isDateTime))throw new InvalidArgumentError("min requires all arguments be DateTimes");return bestBy(e,(e=>e.valueOf()),Math.min)}static max(...e){if(!e.every(DateTime.isDateTime))throw new InvalidArgumentError("max requires all arguments be DateTimes");return bestBy(e,(e=>e.valueOf()),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:n=null,numberingSystem:i=null}=r;return explainFromTokens(Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,r={}){return DateTime.fromFormatExplain(e,t,r)}static get DATE_SHORT(){return a}static get DATE_MED(){return o}static get DATE_MED_WITH_WEEKDAY(){return s}static get DATE_FULL(){return l}static get DATE_HUGE(){return c}static get TIME_SIMPLE(){return u}static get TIME_WITH_SECONDS(){return d}static get TIME_WITH_SHORT_OFFSET(){return p}static get TIME_WITH_LONG_OFFSET(){return h}static get TIME_24_SIMPLE(){return y}static get TIME_24_WITH_SECONDS(){return g}static get TIME_24_WITH_SHORT_OFFSET(){return m}static get TIME_24_WITH_LONG_OFFSET(){return v}static get DATETIME_SHORT(){return b}static get DATETIME_SHORT_WITH_SECONDS(){return w}static get DATETIME_MED(){return C}static get DATETIME_MED_WITH_SECONDS(){return S}static get DATETIME_MED_WITH_WEEKDAY(){return _}static get DATETIME_FULL(){return R}static get DATETIME_FULL_WITH_SECONDS(){return O}static get DATETIME_HUGE(){return T}static get DATETIME_HUGE_WITH_SECONDS(){return I}}function friendlyDateTime(e){if(DateTime.isDateTime(e))return e;if(e&&e.valueOf&&isNumber(e.valueOf()))return DateTime.fromJSDate(e);if(e&&"object"==typeof e)return DateTime.fromObject(e);throw new InvalidArgumentError(`Unknown datetime argument: ${e}, of type ${typeof e}`)}t.DateTime=DateTime,t.Duration=Duration,t.FixedOffsetZone=FixedOffsetZone,t.IANAZone=IANAZone,t.Info=Info,t.Interval=Interval,t.InvalidZone=InvalidZone,t.Settings=Settings,t.SystemZone=SystemZone,t.VERSION="3.4.4",t.Zone=Zone},631:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,a=n&&i&&"function"==typeof i.get?i.get:null,o=n&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,l=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&l&&"function"==typeof l.get?l.get:null,u=s&&Set.prototype.forEach,d="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,p="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,h="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,y=Boolean.prototype.valueOf,g=Object.prototype.toString,m=Function.prototype.toString,v=String.prototype.match,b=String.prototype.slice,w=String.prototype.replace,C=String.prototype.toUpperCase,S=String.prototype.toLowerCase,_=RegExp.prototype.test,R=Array.prototype.concat,O=Array.prototype.join,T=Array.prototype.slice,I=Math.floor,E="function"==typeof BigInt?BigInt.prototype.valueOf:null,D=Object.getOwnPropertySymbols,P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,A="function"==typeof Symbol&&"object"==typeof Symbol.iterator,j="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===A||"symbol")?Symbol.toStringTag:null,M=Object.prototype.propertyIsEnumerable,x=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function addNumericSeparator(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||_.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-I(-e):I(e);if(n!==e){var i=String(n),a=b.call(t,i.length+1);return w.call(i,r,"$&_")+"."+w.call(w.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return w.call(t,r,"$&_")}var k=r(4654),L=k.custom,F=isSymbol(L)?L:null;function wrapQuotes(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function quote(e){return w.call(String(e),/"/g,""")}function isArray(e){return!("[object Array]"!==toStr(e)||j&&"object"==typeof e&&j in e)}function isRegExp(e){return!("[object RegExp]"!==toStr(e)||j&&"object"==typeof e&&j in e)}function isSymbol(e){if(A)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!P)return!1;try{return P.call(e),!0}catch(e){}return!1}e.exports=function inspect_(e,t,r,n){var i=t||{};if(has(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&i.maxStringLength!==1/0:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=!has(i,"customInspect")||i.customInspect;if("boolean"!=typeof s&&"symbol"!==s)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(i,"numericSeparator")&&"boolean"!=typeof i.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=i.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return inspectString(e,i);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var g=String(e);return l?addNumericSeparator(e,g):g}if("bigint"==typeof e){var C=String(e)+"n";return l?addNumericSeparator(e,C):C}var _=void 0===i.depth?5:i.depth;if(void 0===r&&(r=0),r>=_&&_>0&&"object"==typeof e)return isArray(e)?"[Array]":"[Object]";var I=function getIndent(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=O.call(Array(e.indent+1)," ")}return{base:r,prev:O.call(Array(t+1),r)}}(i,r);if(void 0===n)n=[];else if(indexOf(n,e)>=0)return"[Circular]";function inspect(e,t,a){if(t&&(n=T.call(n)).push(t),a){var o={depth:i.depth};return has(i,"quoteStyle")&&(o.quoteStyle=i.quoteStyle),inspect_(e,o,r+1,n)}return inspect_(e,i,r+1,n)}if("function"==typeof e&&!isRegExp(e)){var D=function nameOf(e){if(e.name)return e.name;var t=v.call(m.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(e),L=arrObjKeys(e,inspect);return"[Function"+(D?": "+D:" (anonymous)")+"]"+(L.length>0?" { "+O.call(L,", ")+" }":"")}if(isSymbol(e)){var N=A?w.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):P.call(e);return"object"!=typeof e||A?N:markBoxed(N)}if(function isElement(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(e)){for(var z="<"+S.call(String(e.nodeName)),B=e.attributes||[],U=0;U<B.length;U++)z+=" "+B[U].name+"="+wrapQuotes(quote(B[U].value),"double",i);return z+=">",e.childNodes&&e.childNodes.length&&(z+="..."),z+="</"+S.call(String(e.nodeName))+">"}if(isArray(e)){if(0===e.length)return"[]";var W=arrObjKeys(e,inspect);return I&&!function singleLineValues(e){for(var t=0;t<e.length;t++)if(indexOf(e[t],"\n")>=0)return!1;return!0}(W)?"["+indentedJoin(W,I)+"]":"[ "+O.call(W,", ")+" ]"}if(function isError(e){return!("[object Error]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e)){var V=arrObjKeys(e,inspect);return"cause"in Error.prototype||!("cause"in e)||M.call(e,"cause")?0===V.length?"["+String(e)+"]":"{ ["+String(e)+"] "+O.call(V,", ")+" }":"{ ["+String(e)+"] "+O.call(R.call("[cause]: "+inspect(e.cause),V),", ")+" }"}if("object"==typeof e&&s){if(F&&"function"==typeof e[F]&&k)return k(e,{depth:_-r});if("symbol"!==s&&"function"==typeof e.inspect)return e.inspect()}if(function isMap(e){if(!a||!e||"object"!=typeof e)return!1;try{a.call(e);try{c.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(e)){var q=[];return o.call(e,(function(t,r){q.push(inspect(r,e,!0)+" => "+inspect(t,e))})),collectionOf("Map",a.call(e),q,I)}if(function isSet(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e);try{a.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(e)){var $=[];return u.call(e,(function(t){$.push(inspect(t,e))})),collectionOf("Set",c.call(e),$,I)}if(function isWeakMap(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(e))return weakCollectionOf("WeakMap");if(function isWeakSet(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(e))return weakCollectionOf("WeakSet");if(function isWeakRef(e){if(!h||!e||"object"!=typeof e)return!1;try{return h.call(e),!0}catch(e){}return!1}(e))return weakCollectionOf("WeakRef");if(function isNumber(e){return!("[object Number]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e))return markBoxed(inspect(Number(e)));if(function isBigInt(e){if(!e||"object"!=typeof e||!E)return!1;try{return E.call(e),!0}catch(e){}return!1}(e))return markBoxed(inspect(E.call(e)));if(function isBoolean(e){return!("[object Boolean]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e))return markBoxed(y.call(e));if(function isString(e){return!("[object String]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e))return markBoxed(inspect(String(e)));if(!function isDate(e){return!("[object Date]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e)&&!isRegExp(e)){var K=arrObjKeys(e,inspect),H=x?x(e)===Object.prototype:e instanceof Object||e.constructor===Object,G=e instanceof Object?"":"null prototype",Z=!H&&j&&Object(e)===e&&j in e?b.call(toStr(e),8,-1):G?"Object":"",J=(H||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(Z||G?"["+O.call(R.call([],Z||[],G||[]),": ")+"] ":"");return 0===K.length?J+"{}":I?J+"{"+indentedJoin(K,I)+"}":J+"{ "+O.call(K,", ")+" }"}return String(e)};var N=Object.prototype.hasOwnProperty||function(e){return e in this};function has(e,t){return N.call(e,t)}function toStr(e){return g.call(e)}function indexOf(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function inspectString(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return inspectString(b.call(e,0,t.maxStringLength),t)+n}return wrapQuotes(w.call(w.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",t)}function lowbyte(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+C.call(t.toString(16))}function markBoxed(e){return"Object("+e+")"}function weakCollectionOf(e){return e+" { ? }"}function collectionOf(e,t,r,n){return e+" ("+t+") {"+(n?indentedJoin(r,n):O.call(r,", "))+"}"}function indentedJoin(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+O.call(e,","+r)+"\n"+t.prev}function arrObjKeys(e,t){var r=isArray(e),n=[];if(r){n.length=e.length;for(var i=0;i<e.length;i++)n[i]=has(e,i)?t(e[i],e):""}var a,o="function"==typeof D?D(e):[];if(A){a={};for(var s=0;s<o.length;s++)a["$"+o[s]]=o[s]}for(var l in e)has(e,l)&&(r&&String(Number(l))===l&&l<e.length||A&&a["$"+l]instanceof Symbol||(_.call(/[^\w$]/,l)?n.push(t(l,e)+": "+t(e[l],e)):n.push(l+": "+t(e[l],e))));if("function"==typeof D)for(var c=0;c<o.length;c++)M.call(e,o[c])&&n.push("["+t(o[c])+"]: "+t(e[o[c]],e));return n}},5798:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC1738",i="RFC3986";e.exports={default:i,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:n,RFC3986:i}},129:(e,t,r)=>{"use strict";var n=r(8261),i=r(5235),a=r(5798);e.exports={formats:a,parse:i,stringify:n}},5235:(e,t,r)=>{"use strict";var n=r(2769),i=Object.prototype.hasOwnProperty,a=Array.isArray,o={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},parseArrayValue=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},s=function parseQueryStringKeys(e,t,r,n){if(e){var a=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,s=r.depth>0&&/(\[[^[\]]*])/.exec(a),l=s?a.slice(0,s.index):a,c=[];if(l){if(!r.plainObjects&&i.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&null!==(s=o.exec(a))&&u<r.depth;){if(u+=1,!r.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(s[1])}return s&&c.push("["+a.slice(s.index)+"]"),function(e,t,r,n){for(var i=n?t:parseArrayValue(t,r),a=e.length-1;a>=0;--a){var o,s=e[a];if("[]"===s&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var l="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,c=parseInt(l,10);r.parseArrays||""!==l?!isNaN(c)&&s!==l&&String(c)===l&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[])[c]=i:"__proto__"!==l&&(o[l]=i):o={0:i}}i=o}return i}(c,t,r,n)}};e.exports=function(e,t){var r=function normalizeParseOptions(e){if(!e)return o;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?o.charset:e.charset;return{allowDots:void 0===e.allowDots?o.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:o.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:o.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:o.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:o.comma,decoder:"function"==typeof e.decoder?e.decoder:o.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:o.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:o.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:o.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:o.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:o.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function parseQueryStringValues(e,t){var r,s={__proto__:null},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,c=t.parameterLimit===1/0?void 0:t.parameterLimit,u=l.split(t.delimiter,c),d=-1,p=t.charset;if(t.charsetSentinel)for(r=0;r<u.length;++r)0===u[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===u[r]?p="utf-8":"utf8=%26%2310003%3B"===u[r]&&(p="iso-8859-1"),d=r,r=u.length);for(r=0;r<u.length;++r)if(r!==d){var h,y,g=u[r],m=g.indexOf("]="),v=-1===m?g.indexOf("="):m+1;-1===v?(h=t.decoder(g,o.decoder,p,"key"),y=t.strictNullHandling?null:""):(h=t.decoder(g.slice(0,v),o.decoder,p,"key"),y=n.maybeMap(parseArrayValue(g.slice(v+1),t),(function(e){return t.decoder(e,o.decoder,p,"value")}))),y&&t.interpretNumericEntities&&"iso-8859-1"===p&&(y=interpretNumericEntities(y)),g.indexOf("[]=")>-1&&(y=a(y)?[y]:y),i.call(s,h)?s[h]=n.combine(s[h],y):s[h]=y}return s}(e,r):e,c=r.plainObjects?Object.create(null):{},u=Object.keys(l),d=0;d<u.length;++d){var p=u[d],h=s(p,l[p],r,"string"==typeof e);c=n.merge(c,h,r)}return!0===r.allowSparse?c:n.compact(c)}},8261:(e,t,r)=>{"use strict";var n=r(7478),i=r(2769),a=r(5798),o=Object.prototype.hasOwnProperty,s={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,t){return e+"["+t+"]"},repeat:function repeat(e){return e}},l=Array.isArray,c=Array.prototype.push,pushToArray=function(e,t){c.apply(e,l(t)?t:[t])},u=Date.prototype.toISOString,d=a.default,p={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:i.encode,encodeValuesOnly:!1,format:d,formatter:a.formatters[d],indices:!1,serializeDate:function serializeDate(e){return u.call(e)},skipNulls:!1,strictNullHandling:!1},h={},y=function stringify(e,t,r,a,o,s,c,u,d,y,g,m,v,b,w,C){for(var S=e,_=C,R=0,O=!1;void 0!==(_=_.get(h))&&!O;){var T=_.get(e);if(R+=1,void 0!==T){if(T===R)throw new RangeError("Cyclic object value");O=!0}void 0===_.get(h)&&(R=0)}if("function"==typeof u?S=u(t,S):S instanceof Date?S=g(S):"comma"===r&&l(S)&&(S=i.maybeMap(S,(function(e){return e instanceof Date?g(e):e}))),null===S){if(o)return c&&!b?c(t,p.encoder,w,"key",m):t;S=""}if(function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e}(S)||i.isBuffer(S))return c?[v(b?t:c(t,p.encoder,w,"key",m))+"="+v(c(S,p.encoder,w,"value",m))]:[v(t)+"="+v(String(S))];var I,E=[];if(void 0===S)return E;if("comma"===r&&l(S))b&&c&&(S=i.maybeMap(S,c)),I=[{value:S.length>0?S.join(",")||null:void 0}];else if(l(u))I=u;else{var D=Object.keys(S);I=d?D.sort(d):D}for(var P=a&&l(S)&&1===S.length?t+"[]":t,A=0;A<I.length;++A){var j=I[A],M="object"==typeof j&&void 0!==j.value?j.value:S[j];if(!s||null!==M){var x=l(S)?"function"==typeof r?r(P,j):P:P+(y?"."+j:"["+j+"]");C.set(e,R);var k=n();k.set(h,C),pushToArray(E,stringify(M,x,r,a,o,s,"comma"===r&&b&&l(S)?null:c,u,d,y,g,m,v,b,w,k))}}return E};e.exports=function(e,t){var r,i=e,c=function normalizeStringifyOptions(e){if(!e)return p;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||p.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=a.default;if(void 0!==e.format){if(!o.call(a.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=a.formatters[r],i=p.filter;return("function"==typeof e.filter||l(e.filter))&&(i=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:p.addQueryPrefix,allowDots:void 0===e.allowDots?p.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:p.charsetSentinel,delimiter:void 0===e.delimiter?p.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:p.encode,encoder:"function"==typeof e.encoder?e.encoder:p.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:p.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:p.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:p.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:p.strictNullHandling}}(t);"function"==typeof c.filter?i=(0,c.filter)("",i):l(c.filter)&&(r=c.filter);var u,d=[];if("object"!=typeof i||null===i)return"";u=t&&t.arrayFormat in s?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var h=s[u];if(t&&"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var g="comma"===h&&t&&t.commaRoundTrip;r||(r=Object.keys(i)),c.sort&&r.sort(c.sort);for(var m=n(),v=0;v<r.length;++v){var b=r[v];c.skipNulls&&null===i[b]||pushToArray(d,y(i[b],b,h,g,c.strictNullHandling,c.skipNulls,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,m))}var w=d.join(c.delimiter),C=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?C+="utf8=%26%2310003%3B&":C+="utf8=%E2%9C%93&"),w.length>0?C+w:""}},2769:(e,t,r)=>{"use strict";var n=r(5798),i=Object.prototype.hasOwnProperty,a=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function arrayToObject(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:s,assign:function assignSingleSource(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function combine(e,t){return[].concat(e,t)},compact:function compact(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var i=t[n],o=i.obj[i.prop],s=Object.keys(o),l=0;l<s.length;++l){var c=s[l],u=o[c];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:o,prop:c}),r.push(u))}return function compactQueue(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(a(r)){for(var n=[],i=0;i<r.length;++i)void 0!==r[i]&&n.push(r[i]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function encode(e,t,r,i,a){if(0===e.length)return e;var s=e;if("symbol"==typeof e?s=Symbol.prototype.toString.call(e):"string"!=typeof e&&(s=String(e)),"iso-8859-1"===r)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var l="",c=0;c<s.length;++c){var u=s.charCodeAt(c);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||a===n.RFC1738&&(40===u||41===u)?l+=s.charAt(c):u<128?l+=o[u]:u<2048?l+=o[192|u>>6]+o[128|63&u]:u<55296||u>=57344?l+=o[224|u>>12]+o[128|u>>6&63]+o[128|63&u]:(c+=1,u=65536+((1023&u)<<10|1023&s.charCodeAt(c)),l+=o[240|u>>18]+o[128|u>>12&63]+o[128|u>>6&63]+o[128|63&u])}return l},isBuffer:function isBuffer(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function maybeMap(e,t){if(a(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function merge(e,t,r){if(!t)return e;if("object"!=typeof t){if(a(e))e.push(t);else{if(!e||"object"!=typeof e)return[e,t];(r&&(r.plainObjects||r.allowPrototypes)||!i.call(Object.prototype,t))&&(e[t]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(t);var n=e;return a(e)&&!a(t)&&(n=s(e,r)),a(e)&&a(t)?(t.forEach((function(t,n){if(i.call(e,n)){var a=e[n];a&&"object"==typeof a&&t&&"object"==typeof t?e[n]=merge(a,t,r):e.push(t)}else e[n]=t})),e):Object.keys(t).reduce((function(e,n){var a=t[n];return i.call(e,n)?e[n]=merge(e[n],a,r):e[n]=a,e}),n)}}},8660:(e,t,r)=>{var n;!function(e){!function(t){var n="object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=makeExporter(e);function makeExporter(e,t){return function(r,n){"function"!=typeof e[r]&&Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0===n.Reflect?n.Reflect=e:i=makeExporter(n.Reflect,i),function(e){var t=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,n=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",a="function"==typeof Object.create,o={__proto__:[]}instanceof Array,s=!a&&!o,l={create:a?function(){return MakeDictionary(Object.create(null))}:o?function(){return MakeDictionary({__proto__:null})}:function(){return MakeDictionary({})},has:s?function(e,r){return t.call(e,r)}:function(e,t){return t in e},get:s?function(e,r){return t.call(e,r)?e[r]:void 0}:function(e,t){return e[t]}},c=Object.getPrototypeOf(Function),u="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=u||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?CreateMapPolyfill():Map,p=u||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?CreateSetPolyfill():Set,h=new(u||"function"!=typeof WeakMap?CreateWeakMapPolyfill():WeakMap);function decorate(e,t,r,n){if(IsUndefined(r)){if(!IsArray(e))throw new TypeError;if(!IsConstructor(t))throw new TypeError;return DecorateConstructor(e,t)}if(!IsArray(e))throw new TypeError;if(!IsObject(t))throw new TypeError;if(!IsObject(n)&&!IsUndefined(n)&&!IsNull(n))throw new TypeError;return IsNull(n)&&(n=void 0),DecorateProperty(e,t,r=ToPropertyKey(r),n)}function metadata(e,t){function decorator(r,n){if(!IsObject(r))throw new TypeError;if(!IsUndefined(n)&&!IsPropertyKey(n))throw new TypeError;OrdinaryDefineOwnMetadata(e,t,r,n)}return decorator}function defineMetadata(e,t,r,n){if(!IsObject(r))throw new TypeError;return IsUndefined(n)||(n=ToPropertyKey(n)),OrdinaryDefineOwnMetadata(e,t,r,n)}function hasMetadata(e,t,r){if(!IsObject(t))throw new TypeError;return IsUndefined(r)||(r=ToPropertyKey(r)),OrdinaryHasMetadata(e,t,r)}function hasOwnMetadata(e,t,r){if(!IsObject(t))throw new TypeError;return IsUndefined(r)||(r=ToPropertyKey(r)),OrdinaryHasOwnMetadata(e,t,r)}function getMetadata(e,t,r){if(!IsObject(t))throw new TypeError;return IsUndefined(r)||(r=ToPropertyKey(r)),OrdinaryGetMetadata(e,t,r)}function getOwnMetadata(e,t,r){if(!IsObject(t))throw new TypeError;return IsUndefined(r)||(r=ToPropertyKey(r)),OrdinaryGetOwnMetadata(e,t,r)}function getMetadataKeys(e,t){if(!IsObject(e))throw new TypeError;return IsUndefined(t)||(t=ToPropertyKey(t)),OrdinaryMetadataKeys(e,t)}function getOwnMetadataKeys(e,t){if(!IsObject(e))throw new TypeError;return IsUndefined(t)||(t=ToPropertyKey(t)),OrdinaryOwnMetadataKeys(e,t)}function deleteMetadata(e,t,r){if(!IsObject(t))throw new TypeError;IsUndefined(r)||(r=ToPropertyKey(r));var n=GetOrCreateMetadataMap(t,r,!1);if(IsUndefined(n))return!1;if(!n.delete(e))return!1;if(n.size>0)return!0;var i=h.get(t);return i.delete(r),i.size>0||h.delete(t),!0}function DecorateConstructor(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!IsUndefined(n)&&!IsNull(n)){if(!IsConstructor(n))throw new TypeError;t=n}}return t}function DecorateProperty(e,t,r,n){for(var i=e.length-1;i>=0;--i){var a=(0,e[i])(t,r,n);if(!IsUndefined(a)&&!IsNull(a)){if(!IsObject(a))throw new TypeError;n=a}}return n}function GetOrCreateMetadataMap(e,t,r){var n=h.get(e);if(IsUndefined(n)){if(!r)return;n=new d,h.set(e,n)}var i=n.get(t);if(IsUndefined(i)){if(!r)return;i=new d,n.set(t,i)}return i}function OrdinaryHasMetadata(e,t,r){if(OrdinaryHasOwnMetadata(e,t,r))return!0;var n=OrdinaryGetPrototypeOf(t);return!IsNull(n)&&OrdinaryHasMetadata(e,n,r)}function OrdinaryHasOwnMetadata(e,t,r){var n=GetOrCreateMetadataMap(t,r,!1);return!IsUndefined(n)&&ToBoolean(n.has(e))}function OrdinaryGetMetadata(e,t,r){if(OrdinaryHasOwnMetadata(e,t,r))return OrdinaryGetOwnMetadata(e,t,r);var n=OrdinaryGetPrototypeOf(t);return IsNull(n)?void 0:OrdinaryGetMetadata(e,n,r)}function OrdinaryGetOwnMetadata(e,t,r){var n=GetOrCreateMetadataMap(t,r,!1);if(!IsUndefined(n))return n.get(e)}function OrdinaryDefineOwnMetadata(e,t,r,n){GetOrCreateMetadataMap(r,n,!0).set(e,t)}function OrdinaryMetadataKeys(e,t){var r=OrdinaryOwnMetadataKeys(e,t),n=OrdinaryGetPrototypeOf(e);if(null===n)return r;var i=OrdinaryMetadataKeys(n,t);if(i.length<=0)return r;if(r.length<=0)return i;for(var a=new p,o=[],s=0,l=r;s<l.length;s++){var c=l[s];a.has(c)||(a.add(c),o.push(c))}for(var u=0,d=i;u<d.length;u++){c=d[u];a.has(c)||(a.add(c),o.push(c))}return o}function OrdinaryOwnMetadataKeys(e,t){var r=[],n=GetOrCreateMetadataMap(e,t,!1);if(IsUndefined(n))return r;for(var i=GetIterator(n.keys()),a=0;;){var o=IteratorStep(i);if(!o)return r.length=a,r;var s=IteratorValue(o);try{r[a]=s}catch(e){try{IteratorClose(i)}finally{throw e}}a++}}function Type(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function IsUndefined(e){return void 0===e}function IsNull(e){return null===e}function IsSymbol(e){return"symbol"==typeof e}function IsObject(e){return"object"==typeof e?null!==e:"function"==typeof e}function ToPrimitive(e,t){switch(Type(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",i=GetMethod(e,n);if(void 0!==i){var a=i.call(e,r);if(IsObject(a))throw new TypeError;return a}return OrdinaryToPrimitive(e,"default"===r?"number":r)}function OrdinaryToPrimitive(e,t){if("string"===t){var r=e.toString;if(IsCallable(r))if(!IsObject(i=r.call(e)))return i;if(IsCallable(n=e.valueOf))if(!IsObject(i=n.call(e)))return i}else{var n;if(IsCallable(n=e.valueOf))if(!IsObject(i=n.call(e)))return i;var i,a=e.toString;if(IsCallable(a))if(!IsObject(i=a.call(e)))return i}throw new TypeError}function ToBoolean(e){return!!e}function ToString(e){return""+e}function ToPropertyKey(e){var t=ToPrimitive(e,3);return IsSymbol(t)?t:ToString(t)}function IsArray(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function IsCallable(e){return"function"==typeof e}function IsConstructor(e){return"function"==typeof e}function IsPropertyKey(e){switch(Type(e)){case 3:case 4:return!0;default:return!1}}function GetMethod(e,t){var r=e[t];if(null!=r){if(!IsCallable(r))throw new TypeError;return r}}function GetIterator(e){var t=GetMethod(e,i);if(!IsCallable(t))throw new TypeError;var r=t.call(e);if(!IsObject(r))throw new TypeError;return r}function IteratorValue(e){return e.value}function IteratorStep(e){var t=e.next();return!t.done&&t}function IteratorClose(e){var t=e.return;t&&t.call(e)}function OrdinaryGetPrototypeOf(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===c)return t;if(t!==c)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var i=n.constructor;return"function"!=typeof i||i===e?t:i}function CreateMapPolyfill(){var e={},t=[],r=function(){function MapIterator(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return MapIterator.prototype["@@iterator"]=function(){return this},MapIterator.prototype[i]=function(){return this},MapIterator.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},MapIterator.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},MapIterator.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},MapIterator}();return function(){function Map(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(Map.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Map.prototype.has=function(e){return this._find(e,!1)>=0},Map.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},Map.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},Map.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,i=r+1;i<n;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,t===this._cacheKey&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},Map.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},Map.prototype.keys=function(){return new r(this._keys,this._values,getKey)},Map.prototype.values=function(){return new r(this._keys,this._values,getValue)},Map.prototype.entries=function(){return new r(this._keys,this._values,getEntry)},Map.prototype["@@iterator"]=function(){return this.entries()},Map.prototype[i]=function(){return this.entries()},Map.prototype._find=function(e,t){return this._cacheKey!==e&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=e)),this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},Map}();function getKey(e,t){return e}function getValue(e,t){return t}function getEntry(e,t){return[e,t]}}function CreateSetPolyfill(){return function(){function Set(){this._map=new d}return Object.defineProperty(Set.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),Set.prototype.has=function(e){return this._map.has(e)},Set.prototype.add=function(e){return this._map.set(e,e),this},Set.prototype.delete=function(e){return this._map.delete(e)},Set.prototype.clear=function(){this._map.clear()},Set.prototype.keys=function(){return this._map.keys()},Set.prototype.values=function(){return this._map.values()},Set.prototype.entries=function(){return this._map.entries()},Set.prototype["@@iterator"]=function(){return this.keys()},Set.prototype[i]=function(){return this.keys()},Set}()}function CreateWeakMapPolyfill(){var e=16,r=l.create(),n=CreateUniqueKey();return function(){function WeakMap(){this._key=CreateUniqueKey()}return WeakMap.prototype.has=function(e){var t=GetOrCreateWeakMapTable(e,!1);return void 0!==t&&l.has(t,this._key)},WeakMap.prototype.get=function(e){var t=GetOrCreateWeakMapTable(e,!1);return void 0!==t?l.get(t,this._key):void 0},WeakMap.prototype.set=function(e,t){return GetOrCreateWeakMapTable(e,!0)[this._key]=t,this},WeakMap.prototype.delete=function(e){var t=GetOrCreateWeakMapTable(e,!1);return void 0!==t&&delete t[this._key]},WeakMap.prototype.clear=function(){this._key=CreateUniqueKey()},WeakMap}();function CreateUniqueKey(){var e;do{e="@@WeakMap@@"+CreateUUID()}while(l.has(r,e));return r[e]=!0,e}function GetOrCreateWeakMapTable(e,r){if(!t.call(e,n)){if(!r)return;Object.defineProperty(e,n,{value:l.create()})}return e[n]}function FillRandomBytes(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function GenRandomBytes(e){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(e)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(e)):FillRandomBytes(new Uint8Array(e),e):FillRandomBytes(new Array(e),e)}function CreateUUID(){var t=GenRandomBytes(e);t[6]=79&t[6]|64,t[8]=191&t[8]|128;for(var r="",n=0;n<e;++n){var i=t[n];4!==n&&6!==n&&8!==n||(r+="-"),i<16&&(r+="0"),r+=i.toString(16).toLowerCase()}return r}}function MakeDictionary(e){return e.__=void 0,delete e.__,e}e("decorate",decorate),e("metadata",metadata),e("defineMetadata",defineMetadata),e("hasMetadata",hasMetadata),e("hasOwnMetadata",hasOwnMetadata),e("getMetadata",getMetadata),e("getOwnMetadata",getOwnMetadata),e("getMetadataKeys",getMetadataKeys),e("getOwnMetadataKeys",getOwnMetadataKeys),e("deleteMetadata",deleteMetadata)}(i)}()}(n||(n={}))},7771:(e,t,r)=>{"use strict";var n=r(210),i=r(2296),a=r(1044)(),o=r(7296),s=n("%TypeError%"),l=n("%Math.floor%");e.exports=function setFunctionLength(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||l(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,c=!0;if("length"in e&&o){var u=o(e,"length");u&&!u.configurable&&(n=!1),u&&!u.writable&&(c=!1)}return(n||c||!r)&&(a?i(e,"length",t,!0,!0):i(e,"length",t)),e}},7478:(e,t,r)=>{"use strict";var n=r(210),i=r(1924),a=r(631),o=n("%TypeError%"),s=n("%WeakMap%",!0),l=n("%Map%",!0),c=i("WeakMap.prototype.get",!0),u=i("WeakMap.prototype.set",!0),d=i("WeakMap.prototype.has",!0),p=i("Map.prototype.get",!0),h=i("Map.prototype.set",!0),y=i("Map.prototype.has",!0),listGetNode=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function getSideChannel(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new o("Side channel does not contain "+a(e))},get:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(e)return c(e,n)}else if(l){if(t)return p(t,n)}else if(r)return function(e,t){var r=listGetNode(e,t);return r&&r.value}(r,n)},has:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(e)return d(e,n)}else if(l){if(t)return y(t,n)}else if(r)return function(e,t){return!!listGetNode(e,t)}(r,n);return!1},set:function(n,i){s&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new s),u(e,n,i)):l?(t||(t=new l),h(t,n,i)):(r||(r={key:{},next:null}),function(e,t,r){var n=listGetNode(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,i))}};return n}},4714:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nameof=void 0;var n=r(6898);Object.defineProperty(t,"nameof",{enumerable:!0,get:function(){return n.nameof}})},6898:(e,t)=>{"use strict";function cleanseAssertionOperators(e){return e.replace(/[?!]/g,"")}Object.defineProperty(t,"__esModule",{value:!0}),t.nameof=void 0,t.nameof=function nameof(e,t){var r=e.toString();if(r.startsWith("class ")&&!r.startsWith("class =>"))return cleanseAssertionOperators(r.substring(6,r.indexOf(" {")));if(r.includes("=>"))return cleanseAssertionOperators(r.substring(r.indexOf(".")+1));var n=r.match(/function\s*\(\w+\)\s*\{[\r\n\s]*return\s+\w+\.((\w+\.)*(\w+))/i);if(n)return t&&t.lastProp?n[3]:n[1];if(r.startsWith("function "))return cleanseAssertionOperators(r.substring(9,r.indexOf("(")));throw new Error("ts-simple-nameof: Invalid function.")}},6379:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LOG4TS_LOG_CONTROL:()=>LOG4TS_LOG_CONTROL,Log4TSProvider:()=>d});class EnhancedMap extends Map{computeIfAbsent(e,t){if(this.has(e))return this.get(e);const r=t(e);return this.set(e,r),r}computeIfPresent(e,t){const r=this.get(e);if(void 0===r)return;const n=t(e,r);return void 0!==n?this.set(e,n):this.delete(e),n}compute(e,t){const r=t(e,this.get(e));return r?this.set(e,r):this.delete(e),r}}var n;function getInternalLogger(e){return a.getLogger(e)}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error"}(n||(n={}));const i={setInternalLogLevel:e=>a.changeLogLevel(e),setOutput:e=>a.changeOutput(e),reset:()=>a.reset()};class InternalLoggerImpl{constructor(e,t,r){this._name=e,this._level=t,this._fnOutput=r}trace(e){this.log(n.Trace,e)}debug(e){this.log(n.Debug,e)}error(e,t){this.log(n.Error,e,t)}info(e){this.log(n.Info,e)}warn(e,t){this.log(n.Warn,e,t)}setLevel(e){this._level=e}setOutput(e){this._fnOutput=e}log(e,t,r){this._level>e||this._fnOutput(`${n[this._level].toString()} <INTERNAL LOGGER> ${this._name} ${t()}${r?"\n"+r.stack:""}`)}}class InternalProviderImpl{constructor(){this._loggers=new EnhancedMap,this._logLevel=n.Error,this._fnOutput=InternalProviderImpl.logConsole}getLogger(e){return this._loggers.computeIfAbsent(e,(e=>new InternalLoggerImpl(e,this._logLevel,this._fnOutput)))}changeLogLevel(e){this._logLevel=e,this._loggers.forEach((t=>t.setLevel(e)))}changeOutput(e){this._fnOutput=e,this._loggers.forEach((e=>e.setOutput(this._fnOutput)))}reset(){this.changeLogLevel(n.Error),this._fnOutput=InternalProviderImpl.logConsole,this._loggers.forEach((e=>e.setOutput(this._fnOutput)))}static logConsole(e){console&&console.log&&console.log(e)}}const a=new InternalProviderImpl;var o,s,l=Object.freeze({__proto__:null,INTERNAL_LOGGING_SETTINGS:i,get InternalLogLevel(){return n},getInternalLogger});!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error",e[e.Fatal=5]="Fatal",e[e.Off=6]="Off"}(o||(o={})),function(e){e.toLogLevel=function toLogLevel(t){switch(t.toLowerCase()){case"trace":return e.Trace;case"debug":return e.Debug;case"info":return e.Info;case"warn":return e.Warn;case"error":return e.Error;case"fatal":return e.Fatal;case"off":return e.Off;default:return}}}(o||(o={}));class CoreLoggerImpl{constructor(e){this._runtime=e}get id(){return this._runtime.id}get logLevel(){return this._runtime.level}get runtimeSettings(){return Object.assign({},this._runtime)}set runtimeSettings(e){this._runtime=e}trace(e,...t){this.logMessage(o.Trace,e,t)}debug(e,...t){this.logMessage(o.Debug,e,t)}info(e,...t){this.logMessage(o.Info,e,t)}warn(e,...t){this.logMessage(o.Warn,e,t)}error(e,...t){this.logMessage(o.Error,e,t)}fatal(e,...t){this.logMessage(o.Fatal,e,t)}logMessage(e,t,r){if(this._runtime.level>e)return;const n=Date.now(),i="string"==typeof t?t:t(),a=CoreLoggerImpl.getErrorAndArgs(r);switch(this._runtime.channel.type){case"RawLogChannel":return void this._runtime.channel.write({message:i,exception:a.error,args:a.args,timeInMillis:n,level:e,logNames:this._runtime.name},this._runtime.argumentFormatter);case"LogChannel":this._runtime.channel.write(this.createLogMessage(i,e,a,n))}}formatArgValue(e){try{return this._runtime.argumentFormatter(e)}catch(t){return`>>ARG CONVERT FAILED: '${void 0!==e?e.toString():"undefined"}'<<`}}createLogMessage(e,t,r,n){let i;const a=r.error,s=r.args;a&&(i=`${a.name}: ${a.message}`,a.stack&&(i+=`@\n${a.stack}`));const l=this._runtime.dateFormatter(n);let c=o[t].toUpperCase();c.length<5&&(c+=" ");return{message:l+" "+c+" ["+("string"==typeof this._runtime.name?this._runtime.name:this._runtime.name.join(", "))+"] "+e+(void 0!==s&&s.length>0?" ["+s.map((e=>this.formatArgValue(e))).join(", ")+"]":""),error:i}}static getErrorAndArgs(e){if(0===e.length)return{};let t,r;const n=e[0];if(n instanceof Error)return t=n,r=e.length>1?e.slice(1):void 0,{error:t,args:r};if("function"==typeof n){const i=n();return i instanceof Error?(t=i,r=e.length>1?e.slice(1):void 0,{error:t,args:r}):1===e.length?Array.isArray(i)?{args:i.length>0?i:void 0}:{args:i}:Array.isArray(i)?{args:[...i,...e.slice(1)]}:{args:[i,...e.slice(1)]}}return{args:e}}}function padStart(e,t,r=" "){return padInternal(e,t,"start",r)}function padInternal(e,t,r,n=" "){if(t<=e.length)return e;if(n.length>1)throw new Error(`Fill char must be one char exactly, it is: ${n.length}`);const i=t-e.length;let a="";for(let e=0;e<i;e++)a+=n;return"start"===r?a+e:e+a}function formatArgument(e){return void 0===e?"undefined":JSON.stringify(e)}function formatDate(e){const t=new Date(e);return`${t.getFullYear()}-${padStart((t.getMonth()+1).toString(),2,"0")}-${padStart(t.getDate().toString(),2,"0")} ${padStart(t.getHours().toString(),2,"0")}:${padStart(t.getMinutes().toString(),2,"0")}:${padStart(t.getSeconds().toString(),2,"0")},${padStart(t.getMilliseconds().toString(),2,"0")}`}class ConsoleLogChannel{constructor(){this.type="LogChannel"}write(e){console&&console.log&&console.log(e.message+(e.error?`\n${e.error}`:""))}}!function(e){e.createConsoleChannel=function createConsoleChannel(){return new ConsoleLogChannel}}(s||(s={}));class LogProviderImpl{constructor(e,t){this._log=getInternalLogger("core.impl.LogProviderImpl"),this._name=e,this._settings=t,this._loggers=new EnhancedMap,this._idToKeyMap=new EnhancedMap,this._globalRuntimeSettings={level:t.level,channel:t.channel},this._nextLoggerId=1,this._log.trace((()=>`Created LogProviderImpl with settings: ${JSON.stringify(this._settings)}`))}get runtimeSettings(){return Object.assign(Object.assign({},this._settings),{level:this._globalRuntimeSettings.level,channel:this._globalRuntimeSettings.channel})}getLogger(e){return this.getOrCreateLogger(e)}updateLoggerRuntime(e,t){this._log.debug((()=>`Updating logger ${e.id} runtime settings using: '${JSON.stringify(t)}'`));const r=this._idToKeyMap.get(e.id);return void 0===r?(this._log.warn((()=>`Cannot update logger with id: ${e.id}, it was not found.`)),!1):(this._loggers.computeIfPresent(r,((e,r)=>(r.runtimeSettings=LogProviderImpl.mergeRuntimeSettingsIntoLogRuntime(r.runtimeSettings,t),r))),!0)}updateRuntimeSettings(e){this._log.debug((()=>`Updating global runtime settings and updating existing loggers runtime settings using: '${JSON.stringify(e)}'`)),this._globalRuntimeSettings={level:void 0!==e.level?e.level:this._globalRuntimeSettings.level,channel:void 0!==e.channel?e.channel:this._globalRuntimeSettings.channel},this._loggers.forEach((t=>t.runtimeSettings=LogProviderImpl.mergeRuntimeSettingsIntoLogRuntime(t.runtimeSettings,e)))}clear(){this._loggers.clear(),this._idToKeyMap.clear(),this._globalRuntimeSettings=Object.assign({},this._settings),this._nextLoggerId=1}getOrCreateLogger(e){const t=LogProviderImpl.createKey(e),r=this._loggers.computeIfAbsent(t,(()=>{const t={level:this._globalRuntimeSettings.level,channel:this._globalRuntimeSettings.channel,id:this.nextLoggerId(),name:e,argumentFormatter:this._settings.argumentFormatter,dateFormatter:this._settings.dateFormatter};return new CoreLoggerImpl(t)}));return this._idToKeyMap.computeIfAbsent(r.id,(()=>t)),r}nextLoggerId(){const e=this._name+"_"+this._nextLoggerId;return this._nextLoggerId++,e}static mergeRuntimeSettingsIntoLogRuntime(e,t){return Object.assign(Object.assign({},e),{level:void 0!==t.level?t.level:e.level,channel:void 0!==t.channel?t.channel:e.channel})}static createKey(e){return"string"==typeof e?e:e.join(",")}}function createLogProvider(e,t){return new LogProviderImpl(e,t)}var c=Object.freeze({__proto__:null,EnhancedMap,maxLengthStringValueInArray:function maxLengthStringValueInArray(e){return e.map((e=>e.length)).reduce(((e,t)=>t>e?t:e),0)},padEnd:function padEnd(e,t,r=" "){return padInternal(e,t,"end",r)},padStart});function log4TSGroupConfigDebug(e){return`Log4TSGroupConfig=level: ${o[e.level].toString()}, expression: ${e.expression.toString()}, (omitted functions/channel)`}class Log4TSProviderImpl{constructor(e,t,r){this._log=l.getInternalLogger("log4ts.impl.Log4TSProviderImpl"),this._name=e,this._defaultConfig=[Object.assign(Object.assign({},t),{identifier:t.identifier}),createLogProvider("log4ts_"+e+"_"+t.identifier,t)],this._logProviders=new Map(r.map((t=>{const r=Object.assign({},t),n=createLogProvider("log4ts_"+e+"_"+t.identifier,t);return[t.identifier,{groupConfig:r,provider:n}]}))),this._log.trace((()=>{const e=[...this._logProviders.values()].map((e=>log4TSGroupConfigDebug(e.groupConfig))).join(", ");return`Creating Log4TSProviderImpl '${this._name}', defaultConfig: ${log4TSGroupConfigDebug(this._defaultConfig[0])}, groupConfigs: ${e}`}))}get name(){return this._name}get config(){return Object.assign({},this._defaultConfig[0])}get groupConfigs(){return[...this._logProviders.values()].map((e=>Object.assign({},e.groupConfig)))}getLogger(e){for(const t of this._logProviders.values())if(t.groupConfig.expression.test(e))return t.provider.getLogger(e);return this._defaultConfig[1].getLogger(e)}updateRuntimeSettingsGroup(e,t){const r=this._logProviders.get(e);if(void 0===r)throw new Error(`Cannot update group with identifier '${e}', it does not exist.`);this._log.debug((()=>`Will update ${log4TSGroupConfigDebug(r.groupConfig)}, associated LogProvider '${r.provider}' - applying runtime change: ${JSON.stringify(t)}.`)),Log4TSProviderImpl.updateLog4TGroupConfig(r.groupConfig,r.provider,t)}updateRuntimeSettings(e){this._log.debug((()=>`Will update settings for all groups and existing loggers - will apply runtime change: ${JSON.stringify(e)}.`)),this._logProviders.forEach((t=>{const r=t.groupConfig,n=t.provider;this._log.debug((()=>`Will update ${log4TSGroupConfigDebug(r)}, associated LogProvider '${n}' - applying runtime change: ${JSON.stringify(e)}.`)),Log4TSProviderImpl.updateLog4TGroupConfig(r,n,e)}))}static updateLog4TGroupConfig(e,t,r){r.level&&(e.level=r.level),r.channel&&(e.channel=r.channel),t.updateRuntimeSettings(r)}}class Log4TSControlProviderImpl{constructor(e,t){this._provider=e,this._messageChannel=t,this._originalLogLevels=Log4TSControlProviderImpl.loadCurrentGroupLogLevels(e)}get name(){return this._provider.name}showSettings(){let e=`Available group configs (Log4TSProvider '${this._provider.name}'):\n`;const t=this._provider.groupConfigs.map((e=>({level:o[e.level],channelDescription:e.channel.toString?e.channel.toString():JSON.stringify(e.channel),identifier:e.identifier}))),r=t.length.toString().length,n=c.maxLengthStringValueInArray(t.map((e=>e.identifier)));e+=t.map(((e,t)=>` [${c.padStart(t.toString(),r)}, ${c.padEnd(e.identifier,n)} (level=${c.padEnd(e.level,5)})]`)).join("\n")+"\n",this._messageChannel(e)}update(e,t){const r=o.toLogLevel(e);if(void 0===r)throw new Error(`Cannot update log provider, log level '${e}' is invalid.`);const n={level:r};if(void 0===t)return this._provider.updateRuntimeSettings(n),void this._messageChannel("Updated all group configs successfully.");if("number"==typeof t){const e=this._provider.groupConfigs;if(t<0||t>=e.length)throw new Error(`Group config with index '${t}' does not exist (outside of range).`);const r=e[t];return this._provider.updateRuntimeSettingsGroup(r.identifier,n),void this._messageChannel(`Updated group config with index '${t}' successfully.`)}this._provider.updateRuntimeSettingsGroup(t,n),this._messageChannel(`Updated group config with id '${t}' successfully.`)}reset(){this._originalLogLevels.forEach(((e,t)=>{this._provider.updateRuntimeSettingsGroup(t,{level:e})})),this._messageChannel("Successfully reset log levels back to original state (from when this Log4TSControlProvider was created).")}save(){if(!localStorage)return void this._messageChannel("Cannot save state, localStorage is not available.");const e={name:this._provider.name,groups:this._provider.groupConfigs.map((e=>({identifier:e.identifier,level:o[e.level]})))};localStorage.setItem(this.createKey(),JSON.stringify(e)),this._messageChannel(`Successfully saved state for Log4TSControlProvider '${this._provider.name}'.`)}restore(e){const t=void 0===e||e;if(!localStorage)return void(t&&this._messageChannel(`Will not attempt to restore state for Log4TSControlProvider '${this._provider.name}', localStorage is not available.`));const r=this.createKey(),n=localStorage.getItem(r);if(null!==n)try{const e=JSON.parse(n);if(this._provider.name!==e.name)return void(t&&this._messageChannel(`Cannot restore state for Log4TSControlProvider '${this._provider.name}', data is not for provider - found name '${e.name}'.`));this.restoreGroups(e,t),this._originalLogLevels=Log4TSControlProviderImpl.loadCurrentGroupLogLevels(this._provider)}catch(e){localStorage.removeItem(r),this._messageChannel(`Cannot restore state for Log4TSControlProvider '${this._provider.name}', data is not valid. Invalid data removed from localStorage.`)}else t&&this._messageChannel(`Cannot restore state for Log4TSControlProvider '${this._provider.name}', no data available.`)}help(){const e=`You can use the following commands (Log4TSProvider ${this._provider.name}):\n showSettings()\n Shows the current configuration settings.\n update(logLevel: Log4TSControlProviderLogLevel, groupId?: number | string)\n Change the log level for one or all config groups.\n @param level The log level to set - must be one of 'trace', 'debug', 'info', 'warn', 'error' or 'fatal'\n @param groupId Optional group config to update by either index or identifier, when omitted updates all groups.\n Use showSettings() to find details about index and/or identifier.\n reset()\n Resets the log levels of the config groups back to when this control provider was created.\n save()\n Saves the current log levels for all config groups of this provider. Use restore() to load last saved state.\n restore()\n Restore stored saved state, if any. Log levels will be set according to saved state.\n help()\n Shows this help.\n`;this._messageChannel(e)}restoreGroups(e,t){e.groups.forEach((e=>{try{const r=o.toLogLevel(e.level);void 0!==r?(this._provider.updateRuntimeSettingsGroup(e.identifier,{level:r}),this._messageChannel(`Log4TSControlProvider '${this._provider.name}' - restored log level of group '${e.identifier}' to '${o[r]}'.`)):t&&this._messageChannel(`Log4TSControlProvider '${this._provider.name}' - failed to restore log level of group '${e.identifier}', invalid log level was specified.`)}catch(r){t&&this._messageChannel(`Log4TSControlProvider '${this._provider.name}' - failed to restore log level of group '${e.identifier}'.`)}}))}createKey(){return`Log4TSProvider-${this._provider.name}`}static loadCurrentGroupLogLevels(e){return new Map(e.groupConfigs.map((e=>[e.identifier,e.level])))}}class Log4TSProviderService{constructor(){this._log=l.getInternalLogger("log4ts.impl.Log4TSProviderService"),this._providers=new c.EnhancedMap}createLogProvider(e,t){const r=this._providers.compute(e,((r,n)=>{if(n)throw new Error(`Log4TSProvider with name '${e}' already exists, cannot create another.`);const i=function mergeLog4TSConfigs(e,t){const r={argumentFormatter:t.argumentFormatter?t.argumentFormatter:e.argumentFormatter,channel:t.channel?t.channel:e.channel,dateFormatter:t.dateFormatter?t.dateFormatter:e.dateFormatter,groups:[],level:void 0!==t.level?t.level:e.level};return r.groups=t.groups.map((e=>function mergeLog4TSGroupConfigs(e,t){return{argumentFormatter:t.argumentFormatter?t.argumentFormatter:e.argumentFormatter,channel:e.channel,dateFormatter:t.dateFormatter?t.dateFormatter:e.dateFormatter,expression:t.expression,level:void 0!==t.level?t.level:e.level,identifier:t.identifier?t.identifier:t.expression.toString()}}(r,e))),r}(function createDefaultLog4TSConfig(){return{argumentFormatter:formatArgument,channel:s.createConsoleChannel(),dateFormatter:formatDate,groups:[],level:o.Error}}(),t);!function validateLog4TSConfig(e){if(0===e.groups.length)throw new Error("Invalid configuration, 'groups' on configuration is empty, at least 1 group config must be specified.")}(i),this._log.debug((()=>`Creating new Log4TSProvider with name '${e}', using main config settings '${function log4TSConfigDebug(e){const t=e.groups.map((e=>log4TSGroupConfigDebug(e))).join(", ");return`Log4TSGroupConfig=level: ${o[e.level].toString()}, groups: ${t}, (omitted functions/channel)`}(i)}'.`));const a=new RegExp(".+"),l={channel:i.channel,level:i.level,expression:a,dateFormatter:i.dateFormatter,argumentFormatter:i.argumentFormatter,identifier:a.toString()};return new Log4TSProviderImpl(r,l,i.groups)}));return r}clear(){this._providers.clear()}getLog4TSControl(e){const t=e||(e=>{if(!console||!console.log)throw new Error("Cannot use console (it is not present), please specify a custom function to write to.");console.log(e)});return{help:()=>t(Log4TSProviderService.help()),showSettings:()=>t(this.showSettings()),getProvider:e=>this.getLog4TSControlProviderByIdOrName(e,t)}}showSettings(){let e="Available Log4TSProviders:\n";const t=this._providers.size.toString().length,r=c.maxLengthStringValueInArray([...this._providers.keys()]),n=[...this._providers.entries()].map(((e,n)=>{const i=e[0];return` [${c.padStart(n.toString(),t)}, ${c.padEnd(i,r)}]`}));return e+=n.join("\n")+(n.length>0?"\n":""),e}getLog4TSControlProviderByIdOrName(e,t){if("string"==typeof e){const r=this._providers.get(e);if(void 0===r)throw new Error(`Provider with name '${e}' does not exist.`);return new Log4TSControlProviderImpl(r,t)}const r=[...this._providers.values()];if(e<0||e>=r.length)throw new Error(`Provider with index '${e}' does not exist (outside of range).`);return new Log4TSControlProviderImpl(r[e],t)}static help(){return"You can use the following commands:\n showSettings()\n Shows the current configuration settings.\n getProvider: (id: number | string): Log4TSControlProvider\n Get access to a Log4TSControlProvider to change log levels.\n @param id The id (use showSettings to see) or name of the provider\n help()\n Shows this help.\n"}}const u=new Log4TSProviderService,LOG4TS_LOG_CONTROL=e=>u.getLog4TSControl(e);var d;!function(e){e.createProvider=function createProvider(e,t){return u.createLogProvider(e,t)},e.clear=function clear(){u.clear()}}(d||(d={}))},9959:(e,t,r)=>{"use strict";r.r(t),r.d(t,{$internal:()=>l,$test:()=>u,DefaultChannels:()=>s,LogLevel:()=>o,createLogProvider:()=>createLogProvider,formatArgument:()=>formatArgument,formatDate:()=>formatDate,util:()=>c});class EnhancedMap extends Map{computeIfAbsent(e,t){if(this.has(e))return this.get(e);const r=t(e);return this.set(e,r),r}computeIfPresent(e,t){const r=this.get(e);if(void 0===r)return;const n=t(e,r);return void 0!==n?this.set(e,n):this.delete(e),n}compute(e,t){const r=t(e,this.get(e));return r?this.set(e,r):this.delete(e),r}}var n;function getInternalLogger(e){return a.getLogger(e)}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error"}(n||(n={}));const i={setInternalLogLevel:e=>a.changeLogLevel(e),setOutput:e=>a.changeOutput(e),reset:()=>a.reset()};class InternalLoggerImpl{constructor(e,t,r){this._name=e,this._level=t,this._fnOutput=r}trace(e){this.log(n.Trace,e)}debug(e){this.log(n.Debug,e)}error(e,t){this.log(n.Error,e,t)}info(e){this.log(n.Info,e)}warn(e,t){this.log(n.Warn,e,t)}setLevel(e){this._level=e}setOutput(e){this._fnOutput=e}log(e,t,r){this._level>e||this._fnOutput(`${n[this._level].toString()} <INTERNAL LOGGER> ${this._name} ${t()}${r?"\n"+r.stack:""}`)}}class InternalProviderImpl{constructor(){this._loggers=new EnhancedMap,this._logLevel=n.Error,this._fnOutput=InternalProviderImpl.logConsole}getLogger(e){return this._loggers.computeIfAbsent(e,(e=>new InternalLoggerImpl(e,this._logLevel,this._fnOutput)))}changeLogLevel(e){this._logLevel=e,this._loggers.forEach((t=>t.setLevel(e)))}changeOutput(e){this._fnOutput=e,this._loggers.forEach((e=>e.setOutput(this._fnOutput)))}reset(){this.changeLogLevel(n.Error),this._fnOutput=InternalProviderImpl.logConsole,this._loggers.forEach((e=>e.setOutput(this._fnOutput)))}static logConsole(e){console&&console.log&&console.log(e)}}const a=new InternalProviderImpl;var o,s,l=Object.freeze({__proto__:null,INTERNAL_LOGGING_SETTINGS:i,get InternalLogLevel(){return n},getInternalLogger});!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error",e[e.Fatal=5]="Fatal",e[e.Off=6]="Off"}(o||(o={})),function(e){e.toLogLevel=function toLogLevel(t){switch(t.toLowerCase()){case"trace":return e.Trace;case"debug":return e.Debug;case"info":return e.Info;case"warn":return e.Warn;case"error":return e.Error;case"fatal":return e.Fatal;case"off":return e.Off;default:return}}}(o||(o={}));class CoreLoggerImpl{constructor(e){this._runtime=e}get id(){return this._runtime.id}get logLevel(){return this._runtime.level}get runtimeSettings(){return Object.assign({},this._runtime)}set runtimeSettings(e){this._runtime=e}trace(e,...t){this.logMessage(o.Trace,e,t)}debug(e,...t){this.logMessage(o.Debug,e,t)}info(e,...t){this.logMessage(o.Info,e,t)}warn(e,...t){this.logMessage(o.Warn,e,t)}error(e,...t){this.logMessage(o.Error,e,t)}fatal(e,...t){this.logMessage(o.Fatal,e,t)}logMessage(e,t,r){if(this._runtime.level>e)return;const n=Date.now(),i="string"==typeof t?t:t(),a=CoreLoggerImpl.getErrorAndArgs(r);switch(this._runtime.channel.type){case"RawLogChannel":return void this._runtime.channel.write({message:i,exception:a.error,args:a.args,timeInMillis:n,level:e,logNames:this._runtime.name},this._runtime.argumentFormatter);case"LogChannel":this._runtime.channel.write(this.createLogMessage(i,e,a,n))}}formatArgValue(e){try{return this._runtime.argumentFormatter(e)}catch(t){return`>>ARG CONVERT FAILED: '${void 0!==e?e.toString():"undefined"}'<<`}}createLogMessage(e,t,r,n){let i;const a=r.error,s=r.args;a&&(i=`${a.name}: ${a.message}`,a.stack&&(i+=`@\n${a.stack}`));const l=this._runtime.dateFormatter(n);let c=o[t].toUpperCase();c.length<5&&(c+=" ");return{message:l+" "+c+" ["+("string"==typeof this._runtime.name?this._runtime.name:this._runtime.name.join(", "))+"] "+e+(void 0!==s&&s.length>0?" ["+s.map((e=>this.formatArgValue(e))).join(", ")+"]":""),error:i}}static getErrorAndArgs(e){if(0===e.length)return{};let t,r;const n=e[0];if(n instanceof Error)return t=n,r=e.length>1?e.slice(1):void 0,{error:t,args:r};if("function"==typeof n){const i=n();return i instanceof Error?(t=i,r=e.length>1?e.slice(1):void 0,{error:t,args:r}):1===e.length?Array.isArray(i)?{args:i.length>0?i:void 0}:{args:i}:Array.isArray(i)?{args:[...i,...e.slice(1)]}:{args:[i,...e.slice(1)]}}return{args:e}}}function padStart(e,t,r=" "){return padInternal(e,t,"start",r)}function padInternal(e,t,r,n=" "){if(t<=e.length)return e;if(n.length>1)throw new Error(`Fill char must be one char exactly, it is: ${n.length}`);const i=t-e.length;let a="";for(let e=0;e<i;e++)a+=n;return"start"===r?a+e:e+a}function formatArgument(e){return void 0===e?"undefined":JSON.stringify(e)}function formatDate(e){const t=new Date(e);return`${t.getFullYear()}-${padStart((t.getMonth()+1).toString(),2,"0")}-${padStart(t.getDate().toString(),2,"0")} ${padStart(t.getHours().toString(),2,"0")}:${padStart(t.getMinutes().toString(),2,"0")}:${padStart(t.getSeconds().toString(),2,"0")},${padStart(t.getMilliseconds().toString(),2,"0")}`}class ConsoleLogChannel{constructor(){this.type="LogChannel"}write(e){console&&console.log&&console.log(e.message+(e.error?`\n${e.error}`:""))}}!function(e){e.createConsoleChannel=function createConsoleChannel(){return new ConsoleLogChannel}}(s||(s={}));class LogProviderImpl{constructor(e,t){this._log=getInternalLogger("core.impl.LogProviderImpl"),this._name=e,this._settings=t,this._loggers=new EnhancedMap,this._idToKeyMap=new EnhancedMap,this._globalRuntimeSettings={level:t.level,channel:t.channel},this._nextLoggerId=1,this._log.trace((()=>`Created LogProviderImpl with settings: ${JSON.stringify(this._settings)}`))}get runtimeSettings(){return Object.assign(Object.assign({},this._settings),{level:this._globalRuntimeSettings.level,channel:this._globalRuntimeSettings.channel})}getLogger(e){return this.getOrCreateLogger(e)}updateLoggerRuntime(e,t){this._log.debug((()=>`Updating logger ${e.id} runtime settings using: '${JSON.stringify(t)}'`));const r=this._idToKeyMap.get(e.id);return void 0===r?(this._log.warn((()=>`Cannot update logger with id: ${e.id}, it was not found.`)),!1):(this._loggers.computeIfPresent(r,((e,r)=>(r.runtimeSettings=LogProviderImpl.mergeRuntimeSettingsIntoLogRuntime(r.runtimeSettings,t),r))),!0)}updateRuntimeSettings(e){this._log.debug((()=>`Updating global runtime settings and updating existing loggers runtime settings using: '${JSON.stringify(e)}'`)),this._globalRuntimeSettings={level:void 0!==e.level?e.level:this._globalRuntimeSettings.level,channel:void 0!==e.channel?e.channel:this._globalRuntimeSettings.channel},this._loggers.forEach((t=>t.runtimeSettings=LogProviderImpl.mergeRuntimeSettingsIntoLogRuntime(t.runtimeSettings,e)))}clear(){this._loggers.clear(),this._idToKeyMap.clear(),this._globalRuntimeSettings=Object.assign({},this._settings),this._nextLoggerId=1}getOrCreateLogger(e){const t=LogProviderImpl.createKey(e),r=this._loggers.computeIfAbsent(t,(()=>{const t={level:this._globalRuntimeSettings.level,channel:this._globalRuntimeSettings.channel,id:this.nextLoggerId(),name:e,argumentFormatter:this._settings.argumentFormatter,dateFormatter:this._settings.dateFormatter};return new CoreLoggerImpl(t)}));return this._idToKeyMap.computeIfAbsent(r.id,(()=>t)),r}nextLoggerId(){const e=this._name+"_"+this._nextLoggerId;return this._nextLoggerId++,e}static mergeRuntimeSettingsIntoLogRuntime(e,t){return Object.assign(Object.assign({},e),{level:void 0!==t.level?t.level:e.level,channel:void 0!==t.channel?t.channel:e.channel})}static createKey(e){return"string"==typeof e?e:e.join(",")}}function createLogProvider(e,t){return new LogProviderImpl(e,t)}var c=Object.freeze({__proto__:null,EnhancedMap,maxLengthStringValueInArray:function maxLengthStringValueInArray(e){return e.map((e=>e.length)).reduce(((e,t)=>t>e?t:e),0)},padEnd:function padEnd(e,t,r=" "){return padInternal(e,t,"end",r)},padStart});var u=Object.freeze({__proto__:null,ArrayLogChannel:class ArrayLogChannel{constructor(){this._buffer=[],this.type="LogChannel"}write(e){this._buffer.push(e)}get logMessages(){return this._buffer}get messages(){return this._buffer.map((e=>e.message))}},ArrayRawLogChannel:class ArrayRawLogChannel{constructor(){this._buffer=[],this.type="RawLogChannel"}write(e,t){this._buffer.push(e)}get messages(){return this._buffer.map((e=>e.message))}get errors(){return this._buffer.map((e=>e.exception))}get size(){return this._buffer.length}get rawMessages(){return this._buffer}clear(){this._buffer=[]}},TestControlMessage:class TestControlMessage{constructor(){this._messages=[],this.write=this.write.bind(this)}get messages(){return this._messages}write(e){this._messages.push(e)}clear(){this._messages=[]}}})},7429:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NIL",{enumerable:!0,get:function get(){return s.default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function get(){return d.default}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function get(){return u.default}}),Object.defineProperty(t,"v1",{enumerable:!0,get:function get(){return n.default}}),Object.defineProperty(t,"v3",{enumerable:!0,get:function get(){return i.default}}),Object.defineProperty(t,"v4",{enumerable:!0,get:function get(){return a.default}}),Object.defineProperty(t,"v5",{enumerable:!0,get:function get(){return o.default}}),Object.defineProperty(t,"validate",{enumerable:!0,get:function get(){return c.default}}),Object.defineProperty(t,"version",{enumerable:!0,get:function get(){return l.default}});var n=_interopRequireDefault(r(3990)),i=_interopRequireDefault(r(8237)),a=_interopRequireDefault(r(5355)),o=_interopRequireDefault(r(3764)),s=_interopRequireDefault(r(6314)),l=_interopRequireDefault(r(8464)),c=_interopRequireDefault(r(6435)),u=_interopRequireDefault(r(4008)),d=_interopRequireDefault(r(8222));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},4163:(e,t)=>{"use strict";function getOutputLength(e){return 14+(e+64>>>9<<4)+1}function safeAdd(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function md5cmn(e,t,r,n,i,a){return safeAdd(function bitRotateLeft(e,t){return e<<t|e>>>32-t}(safeAdd(safeAdd(t,e),safeAdd(n,a)),i),r)}function md5ff(e,t,r,n,i,a,o){return md5cmn(t&r|~t&n,e,t,i,a,o)}function md5gg(e,t,r,n,i,a,o){return md5cmn(t&n|r&~n,e,t,i,a,o)}function md5hh(e,t,r,n,i,a,o){return md5cmn(t^r^n,e,t,i,a,o)}function md5ii(e,t,r,n,i,a,o){return md5cmn(r^(t|~n),e,t,i,a,o)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function md5(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function md5ToHexEncodedArray(e){const t=[],r=32*e.length,n="0123456789abcdef";for(let i=0;i<r;i+=8){const r=e[i>>5]>>>i%32&255,a=parseInt(n.charAt(r>>>4&15)+n.charAt(15&r),16);t.push(a)}return t}(function wordsToMd5(e,t){e[t>>5]|=128<<t%32,e[getOutputLength(t)-1]=t;let r=1732584193,n=-271733879,i=-1732584194,a=271733878;for(let t=0;t<e.length;t+=16){const o=r,s=n,l=i,c=a;r=md5ff(r,n,i,a,e[t],7,-680876936),a=md5ff(a,r,n,i,e[t+1],12,-389564586),i=md5ff(i,a,r,n,e[t+2],17,606105819),n=md5ff(n,i,a,r,e[t+3],22,-1044525330),r=md5ff(r,n,i,a,e[t+4],7,-176418897),a=md5ff(a,r,n,i,e[t+5],12,1200080426),i=md5ff(i,a,r,n,e[t+6],17,-1473231341),n=md5ff(n,i,a,r,e[t+7],22,-45705983),r=md5ff(r,n,i,a,e[t+8],7,1770035416),a=md5ff(a,r,n,i,e[t+9],12,-1958414417),i=md5ff(i,a,r,n,e[t+10],17,-42063),n=md5ff(n,i,a,r,e[t+11],22,-1990404162),r=md5ff(r,n,i,a,e[t+12],7,1804603682),a=md5ff(a,r,n,i,e[t+13],12,-40341101),i=md5ff(i,a,r,n,e[t+14],17,-1502002290),n=md5ff(n,i,a,r,e[t+15],22,1236535329),r=md5gg(r,n,i,a,e[t+1],5,-165796510),a=md5gg(a,r,n,i,e[t+6],9,-1069501632),i=md5gg(i,a,r,n,e[t+11],14,643717713),n=md5gg(n,i,a,r,e[t],20,-373897302),r=md5gg(r,n,i,a,e[t+5],5,-701558691),a=md5gg(a,r,n,i,e[t+10],9,38016083),i=md5gg(i,a,r,n,e[t+15],14,-660478335),n=md5gg(n,i,a,r,e[t+4],20,-405537848),r=md5gg(r,n,i,a,e[t+9],5,568446438),a=md5gg(a,r,n,i,e[t+14],9,-1019803690),i=md5gg(i,a,r,n,e[t+3],14,-187363961),n=md5gg(n,i,a,r,e[t+8],20,1163531501),r=md5gg(r,n,i,a,e[t+13],5,-1444681467),a=md5gg(a,r,n,i,e[t+2],9,-51403784),i=md5gg(i,a,r,n,e[t+7],14,1735328473),n=md5gg(n,i,a,r,e[t+12],20,-1926607734),r=md5hh(r,n,i,a,e[t+5],4,-378558),a=md5hh(a,r,n,i,e[t+8],11,-2022574463),i=md5hh(i,a,r,n,e[t+11],16,1839030562),n=md5hh(n,i,a,r,e[t+14],23,-35309556),r=md5hh(r,n,i,a,e[t+1],4,-1530992060),a=md5hh(a,r,n,i,e[t+4],11,1272893353),i=md5hh(i,a,r,n,e[t+7],16,-155497632),n=md5hh(n,i,a,r,e[t+10],23,-1094730640),r=md5hh(r,n,i,a,e[t+13],4,681279174),a=md5hh(a,r,n,i,e[t],11,-358537222),i=md5hh(i,a,r,n,e[t+3],16,-722521979),n=md5hh(n,i,a,r,e[t+6],23,76029189),r=md5hh(r,n,i,a,e[t+9],4,-640364487),a=md5hh(a,r,n,i,e[t+12],11,-421815835),i=md5hh(i,a,r,n,e[t+15],16,530742520),n=md5hh(n,i,a,r,e[t+2],23,-995338651),r=md5ii(r,n,i,a,e[t],6,-198630844),a=md5ii(a,r,n,i,e[t+7],10,1126891415),i=md5ii(i,a,r,n,e[t+14],15,-1416354905),n=md5ii(n,i,a,r,e[t+5],21,-57434055),r=md5ii(r,n,i,a,e[t+12],6,1700485571),a=md5ii(a,r,n,i,e[t+3],10,-1894986606),i=md5ii(i,a,r,n,e[t+10],15,-1051523),n=md5ii(n,i,a,r,e[t+1],21,-2054922799),r=md5ii(r,n,i,a,e[t+8],6,1873313359),a=md5ii(a,r,n,i,e[t+15],10,-30611744),i=md5ii(i,a,r,n,e[t+6],15,-1560198380),n=md5ii(n,i,a,r,e[t+13],21,1309151649),r=md5ii(r,n,i,a,e[t+4],6,-145523070),a=md5ii(a,r,n,i,e[t+11],10,-1120210379),i=md5ii(i,a,r,n,e[t+2],15,718787259),n=md5ii(n,i,a,r,e[t+9],21,-343485551),r=safeAdd(r,o),n=safeAdd(n,s),i=safeAdd(i,l),a=safeAdd(a,c)}return[r,n,i,a]}(function bytesToWords(e){if(0===e.length)return[];const t=8*e.length,r=new Uint32Array(getOutputLength(t));for(let n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))};t.default=r},4790:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};t.default=r},6314:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default="00000000-0000-0000-0000-000000000000"},8222:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(6435));var i=function parse(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");let t;const r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};t.default=i},58:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},3319:(e,t)=>{"use strict";let r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function rng(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(n)};const n=new Uint8Array(16)},3757:(e,t)=>{"use strict";function f(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function ROTL(e,t){return e<<t|e>>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function sha1(e){const t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const n=e.length/4+2,i=Math.ceil(n/16),a=new Array(i);for(let t=0;t<i;++t){const r=new Uint32Array(16);for(let n=0;n<16;++n)r[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];a[t]=r}a[i-1][14]=8*(e.length-1)/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<i;++e){const n=new Uint32Array(80);for(let t=0;t<16;++t)n[t]=a[e][t];for(let e=16;e<80;++e)n[e]=ROTL(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let i=r[0],o=r[1],s=r[2],l=r[3],c=r[4];for(let e=0;e<80;++e){const r=Math.floor(e/20),a=ROTL(i,5)+f(r,o,s,l)+c+t[r]+n[e]>>>0;c=l,l=s,s=ROTL(o,30)>>>0,o=i,i=a}r[0]=r[0]+i>>>0,r[1]=r[1]+o>>>0,r[2]=r[2]+s>>>0,r[3]=r[3]+l>>>0,r[4]=r[4]+c>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]};t.default=r},4008:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=unsafeStringify;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(6435));const i=[];for(let e=0;e<256;++e)i.push((e+256).toString(16).slice(1));function unsafeStringify(e,t=0){return i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+"-"+i[e[t+4]]+i[e[t+5]]+"-"+i[e[t+6]]+i[e[t+7]]+"-"+i[e[t+8]]+i[e[t+9]]+"-"+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]}var a=function stringify(e,t=0){const r=unsafeStringify(e,t);if(!(0,n.default)(r))throw TypeError("Stringified UUID is invalid");return r};t.default=a},3990:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(3319)),i=r(4008);let a,o,s=0,l=0;var c=function v1(e,t,r){let c=t&&r||0;const u=t||new Array(16);let d=(e=e||{}).node||a,p=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==p){const t=e.random||(e.rng||n.default)();null==d&&(d=a=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==p&&(p=o=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),y=void 0!==e.nsecs?e.nsecs:l+1;const g=h-s+(y-l)/1e4;if(g<0&&void 0===e.clockseq&&(p=p+1&16383),(g<0||h>s)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=h,l=y,o=p,h+=122192928e5;const m=(1e4*(268435455&h)+y)%4294967296;u[c++]=m>>>24&255,u[c++]=m>>>16&255,u[c++]=m>>>8&255,u[c++]=255&m;const v=h/4294967296*1e4&268435455;u[c++]=v>>>8&255,u[c++]=255&v,u[c++]=v>>>24&15|16,u[c++]=v>>>16&255,u[c++]=p>>>8|128,u[c++]=255&p;for(let e=0;e<6;++e)u[c+e]=d[e];return t||(0,i.unsafeStringify)(u)};t.default=c},8237:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(r(7925)),i=_interopRequireDefault(r(4163));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var a=(0,n.default)("v3",48,i.default);t.default=a},7925:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function v35(e,t,r){function generateUUID(e,a,o,s){var l;if("string"==typeof e&&(e=function stringToBytes(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof a&&(a=(0,i.default)(a)),16!==(null===(l=a)||void 0===l?void 0:l.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+e.length);if(c.set(a),c.set(e,a.length),c=r(c),c[6]=15&c[6]|t,c[8]=63&c[8]|128,o){s=s||0;for(let e=0;e<16;++e)o[s+e]=c[e];return o}return(0,n.unsafeStringify)(c)}try{generateUUID.name=e}catch(e){}return generateUUID.DNS=a,generateUUID.URL=o,generateUUID};var n=r(4008),i=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(8222));const a="6ba7b810-9dad-11d1-80b4-00c04fd430c8";t.DNS=a;const o="6ba7b811-9dad-11d1-80b4-00c04fd430c8";t.URL=o},5355:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(r(4790)),i=_interopRequireDefault(r(3319)),a=r(4008);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var o=function v4(e,t,r){if(n.default.randomUUID&&!t&&!e)return n.default.randomUUID();const o=(e=e||{}).random||(e.rng||i.default)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=o[e];return t}return(0,a.unsafeStringify)(o)};t.default=o},3764:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(r(7925)),i=_interopRequireDefault(r(3757));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var a=(0,n.default)("v5",80,i.default);t.default=a},6435:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(58));var i=function validate(e){return"string"==typeof e&&n.default.test(e)};t.default=i},8464:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(6435));var i=function version(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)};t.default=i},2890:e=>{"use strict";e.exports=NMSHDCrypto},194:e=>{"use strict";e.exports=TSServal},4654:()=>{},7218:(e,t,r)=>{"use strict";function bind(e,t){return function wrap(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:i}=Object,a=(o=Object.create(null),e=>{const t=n.call(e);return o[t]||(o[t]=t.slice(8,-1).toLowerCase())});var o;const kindOfTest=e=>(e=e.toLowerCase(),t=>a(t)===e),typeOfTest=e=>t=>typeof t===e,{isArray:s}=Array,l=typeOfTest("undefined");const c=kindOfTest("ArrayBuffer");const u=typeOfTest("string"),d=typeOfTest("function"),p=typeOfTest("number"),isObject=e=>null!==e&&"object"==typeof e,isPlainObject=e=>{if("object"!==a(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},h=kindOfTest("Date"),y=kindOfTest("File"),g=kindOfTest("Blob"),m=kindOfTest("FileList"),v=kindOfTest("URLSearchParams");function forEach(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),s(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function findKey(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:r.g,isContextDefined=e=>!l(e)&&e!==b;const w=(C="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>C&&e instanceof C);var C;const S=kindOfTest("HTMLFormElement"),_=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),R=kindOfTest("RegExp"),reduceDescriptors=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};forEach(r,((r,i)=>{let a;!1!==(a=t(r,i,e))&&(n[i]=a||r)})),Object.defineProperties(e,n)},O="abcdefghijklmnopqrstuvwxyz",T="0123456789",I={DIGIT:T,ALPHA:O,ALPHA_DIGIT:O+O.toUpperCase()+T};const E=kindOfTest("AsyncFunction");var D={isArray:s,isArrayBuffer:c,isBuffer:function isBuffer(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&d(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||d(e.append)&&("formdata"===(t=a(e))||"object"===t&&d(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function isArrayBufferView(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&c(e.buffer),t},isString:u,isNumber:p,isBoolean:e=>!0===e||!1===e,isObject,isPlainObject,isUndefined:l,isDate:h,isFile:y,isBlob:g,isRegExp:R,isFunction:d,isStream:e=>isObject(e)&&d(e.pipe),isURLSearchParams:v,isTypedArray:w,isFileList:m,forEach,merge:function merge(){const{caseless:e}=isContextDefined(this)&&this||{},t={},assignValue=(r,n)=>{const i=e&&findKey(t,n)||n;isPlainObject(t[i])&&isPlainObject(r)?t[i]=merge(t[i],r):isPlainObject(r)?t[i]=merge({},r):s(r)?t[i]=r.slice():t[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&forEach(arguments[e],assignValue);return t},extend:(e,t,r,{allOwnKeys:n}={})=>(forEach(t,((t,n)=>{r&&d(t)?e[n]=bind(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,s;const l={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],n&&!n(s,e,t)||l[s]||(t[s]=e[s],l[s]=!0);e=!1!==r&&i(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(s(e))return e;let t=e.length;if(!p(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:S,hasOwnProperty:_,hasOwnProp:_,reduceDescriptors,freezeMethods:e=>{reduceDescriptors(e,((t,r)=>{if(d(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];d(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},define=e=>{e.forEach((e=>{r[e]=!0}))};return s(e)?define(e):define(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function replacer(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey,global:b,isContextDefined,ALPHABET:I,generateString:(e=16,t=I.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function isSpecCompliantForm(e){return!!(e&&d(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),visit=(e,r)=>{if(isObject(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const n=s(e)?[]:{};return forEach(e,((e,t)=>{const i=visit(e,r+1);!l(i)&&(n[t]=i)})),t[r]=void 0,n}}return e};return visit(e,0)},isAsyncFn:E,isThenable:e=>e&&(isObject(e)||d(e))&&d(e.then)&&d(e.catch)};function AxiosError(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}D.inherits(AxiosError,Error,{toJSON:function toJSON(){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:D.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const P=AxiosError.prototype,A={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{A[e]={value:e}})),Object.defineProperties(AxiosError,A),Object.defineProperty(P,"isAxiosError",{value:!0}),AxiosError.from=(e,t,r,n,i,a)=>{const o=Object.create(P);return D.toFlatObject(e,o,(function filter(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),AxiosError.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function isVisitable(e){return D.isPlainObject(e)||D.isArray(e)}function removeBrackets(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function renderKey(e,t,r){return e?e.concat(t).map((function each(e,t){return e=removeBrackets(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const j=D.toFlatObject(D,{},null,(function filter(e){return/^is[A-Z]/.test(e)}));function toFormData(e,t,r){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function defined(e,t){return!D.isUndefined(t[e])}))).metaTokens,i=r.visitor||defaultVisitor,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&D.isSpecCompliantForm(t);if(!D.isFunction(i))throw new TypeError("visitor must be a function");function convertValue(e){if(null===e)return"";if(D.isDate(e))return e.toISOString();if(!s&&D.isBlob(e))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(e)||D.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function defaultVisitor(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(D.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(D.isArray(e)&&function isFlatArray(e){return D.isArray(e)&&!e.some(isVisitable)}(e)||(D.isFileList(e)||D.endsWith(r,"[]"))&&(s=D.toArray(e)))return r=removeBrackets(r),s.forEach((function each(e,n){!D.isUndefined(e)&&null!==e&&t.append(!0===o?renderKey([r],n,a):null===o?r:r+"[]",convertValue(e))})),!1;return!!isVisitable(e)||(t.append(renderKey(i,r,a),convertValue(e)),!1)}const l=[],c=Object.assign(j,{defaultVisitor,convertValue,isVisitable});if(!D.isObject(e))throw new TypeError("data must be an object");return function build(e,r){if(!D.isUndefined(e)){if(-1!==l.indexOf(e))throw Error("Circular reference detected in "+r.join("."));l.push(e),D.forEach(e,(function each(e,n){!0===(!(D.isUndefined(e)||null===e)&&i.call(t,e,D.isString(n)?n.trim():n,r,c))&&build(e,r?r.concat(n):[n])})),l.pop()}}(e),t}function encode$1(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function replacer(e){return t[e]}))}function AxiosURLSearchParams(e,t){this._pairs=[],e&&toFormData(e,this,t)}const M=AxiosURLSearchParams.prototype;function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(e,t,r){if(!t)return e;const n=r&&r.encode||encode,i=r&&r.serialize;let a;if(a=i?i(t,r):D.isURLSearchParams(t)?t.toString():new AxiosURLSearchParams(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}M.append=function append(e,t){this._pairs.push([e,t])},M.toString=function toString(e){const t=e?function(t){return e.call(this,t,encode$1)}:encode$1;return this._pairs.map((function each(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var x=class InterceptorManager{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){D.forEach(this.handlers,(function forEachHandler(t){null!==t&&e(t)}))}},k={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},L={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:AxiosURLSearchParams,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const F="undefined"!=typeof window&&"undefined"!=typeof document,N=(z="undefined"!=typeof navigator&&navigator.product,F&&["ReactNative","NativeScript","NS"].indexOf(z)<0);var z;const B="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var U={...Object.freeze({__proto__:null,hasBrowserEnv:F,hasStandardBrowserWebWorkerEnv:B,hasStandardBrowserEnv:N}),...L};function formDataToJSON(e){function buildPath(e,t,r,n){let i=e[n++];const a=Number.isFinite(+i),o=n>=e.length;if(i=!i&&D.isArray(r)?r.length:i,o)return D.hasOwnProp(r,i)?r[i]=[r[i],t]:r[i]=t,!a;r[i]&&D.isObject(r[i])||(r[i]=[]);return buildPath(e,t,r[i],n)&&D.isArray(r[i])&&(r[i]=function arrayToObject(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(r[i])),!a}if(D.isFormData(e)&&D.isFunction(e.entries)){const t={};return D.forEachEntry(e,((e,r)=>{buildPath(function parsePropPath(e){return D.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,t,0)})),t}return null}const W={transitional:k,adapter:["xhr","http"],transformRequest:[function transformRequest(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=D.isObject(e);i&&D.isHTMLForm(e)&&(e=new FormData(e));if(D.isFormData(e))return n&&n?JSON.stringify(formDataToJSON(e)):e;if(D.isArrayBuffer(e)||D.isBuffer(e)||D.isStream(e)||D.isFile(e)||D.isBlob(e))return e;if(D.isArrayBufferView(e))return e.buffer;if(D.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function toURLEncodedForm(e,t){return toFormData(e,new U.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return U.isNode&&D.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=D.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return toFormData(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function stringifySafely(e,t,r){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function transformResponse(e){const t=this.transitional||W.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&D.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw AxiosError.from(e,AxiosError.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:U.classes.FormData,Blob:U.classes.Blob},validateStatus:function validateStatus(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch"],(e=>{W.headers[e]={}}));var V=W;const q=D.toObjectSet(["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"]);const $=Symbol("internals");function normalizeHeader(e){return e&&String(e).trim().toLowerCase()}function normalizeValue(e){return!1===e||null==e?e:D.isArray(e)?e.map(normalizeValue):String(e)}function matchHeaderValue(e,t,r,n,i){return D.isFunction(n)?n.call(this,t,r):(i&&(t=r),D.isString(t)?D.isString(n)?-1!==t.indexOf(n):D.isRegExp(n)?n.test(t):void 0:void 0)}class AxiosHeaders{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function setHeader(e,t,r){const i=normalizeHeader(t);if(!i)throw new Error("header name must be a non-empty string");const a=D.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=normalizeValue(e))}const setHeaders=(e,t)=>D.forEach(e,((e,r)=>setHeader(e,r,t)));return D.isPlainObject(e)||e instanceof this.constructor?setHeaders(e,t):D.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?setHeaders((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function parser(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&q[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&setHeader(t,e,r),this}get(e,t){if(e=normalizeHeader(e)){const r=D.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function parseTokens(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(D.isFunction(t))return t.call(this,e,r);if(D.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=normalizeHeader(e)){const r=D.findKey(this,e);return!(!r||void 0===this[r]||t&&!matchHeaderValue(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function deleteHeader(e){if(e=normalizeHeader(e)){const i=D.findKey(r,e);!i||t&&!matchHeaderValue(0,r[i],i,t)||(delete r[i],n=!0)}}return D.isArray(e)?e.forEach(deleteHeader):deleteHeader(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!matchHeaderValue(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return D.forEach(this,((n,i)=>{const a=D.findKey(r,i);if(a)return t[a]=normalizeValue(n),void delete t[i];const o=e?function formatHeader(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=normalizeValue(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return D.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&D.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[$]=this[$]={accessors:{}}).accessors,r=this.prototype;function defineAccessor(e){const n=normalizeHeader(e);t[n]||(!function buildAccessors(e,t){const r=D.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return D.isArray(e)?e.forEach(defineAccessor):defineAccessor(e),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(AxiosHeaders.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),D.freezeMethods(AxiosHeaders);var K=AxiosHeaders;function transformData(e,t){const r=this||V,n=t||r,i=K.from(n.headers);let a=n.data;return D.forEach(e,(function transform(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function isCancel(e){return!(!e||!e.__CANCEL__)}function CanceledError(e,t,r){AxiosError.call(this,null==e?"canceled":e,AxiosError.ERR_CANCELED,t,r),this.name="CanceledError"}D.inherits(CanceledError,AxiosError,{__CANCEL__:!0});var H=U.hasStandardBrowserEnv?{write(e,t,r,n,i,a){const o=[e+"="+encodeURIComponent(t)];D.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),D.isString(n)&&o.push("path="+n),D.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function buildFullPath(e,t){return e&&!function isAbsoluteURL(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function combineURLs(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var G=U.hasStandardBrowserEnv?function standardBrowserEnv(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function resolveURL(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=resolveURL(window.location.href),function isURLSameOrigin(e){const t=D.isString(e)?resolveURL(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function isURLSameOrigin(){return!0};function progressEventReducer(e,t){let r=0;const n=function speedometer(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function push(s){const l=Date.now(),c=n[o];i||(i=l),r[a]=s,n[a]=l;let u=o,d=0;for(;u!==a;)d+=r[u++],u%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),l-i<t)return;const p=c&&l-c;return p?Math.round(1e3*d/p):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,l=n(s);r=a;const c={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:l||void 0,estimated:l&&o&&a<=o?(o-a)/l:void 0,event:i};c[t?"download":"upload"]=!0,e(c)}}const Z={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function dispatchXhrRequest(t,r){let n=e.data;const i=K.from(e.headers).normalize();let a,o,{responseType:s,withXSRFToken:l}=e;function done(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}if(D.isFormData(n))if(U.hasStandardBrowserEnv||U.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(o=i.getContentType())){const[e,...t]=o?o.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=buildFullPath(e.baseURL,e.url);function onloadend(){if(!c)return;const n=K.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function settle(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new AxiosError("Request failed with status code "+r.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function _resolve(e){t(e),done()}),(function _reject(e){r(e),done()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),buildURL(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=onloadend:c.onreadystatechange=function handleLoad(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(onloadend)},c.onabort=function handleAbort(){c&&(r(new AxiosError("Request aborted",AxiosError.ECONNABORTED,e,c)),c=null)},c.onerror=function handleError(){r(new AxiosError("Network Error",AxiosError.ERR_NETWORK,e,c)),c=null},c.ontimeout=function handleTimeout(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||k;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new AxiosError(t,n.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,e,c)),c=null},U.hasStandardBrowserEnv&&(l&&D.isFunction(l)&&(l=l(e)),l||!1!==l&&G(u))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&H.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&D.forEach(i.toJSON(),(function setRequestHeader(e,t){c.setRequestHeader(t,e)})),D.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&"json"!==s&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",progressEventReducer(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",progressEventReducer(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=t=>{c&&(r(!t||t.type?new CanceledError(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const d=function parseProtocol(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===U.protocols.indexOf(d)?r(new AxiosError("Unsupported protocol "+d+":",AxiosError.ERR_BAD_REQUEST,e)):c.send(n||null)}))}};D.forEach(Z,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const renderReason=e=>`- ${e}`,isResolvedHandle=e=>D.isFunction(e)||null===e||!1===e;var adapters_getAdapter=e=>{e=D.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let a=0;a<t;a++){let t;if(r=e[a],n=r,!isResolvedHandle(r)&&(n=Z[(t=String(r)).toLowerCase()],void 0===n))throw new AxiosError(`Unknown adapter '${t}'`);if(n)break;i[t||"#"+a]=n}if(!n){const e=Object.entries(i).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new AxiosError("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(renderReason).join("\n"):" "+renderReason(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function throwIfCancellationRequested(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new CanceledError(null,e)}function dispatchRequest(e){throwIfCancellationRequested(e),e.headers=K.from(e.headers),e.data=transformData.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return adapters_getAdapter(e.adapter||V.adapter)(e).then((function onAdapterResolution(t){return throwIfCancellationRequested(e),t.data=transformData.call(e,e.transformResponse,t),t.headers=K.from(t.headers),t}),(function onAdapterRejection(t){return isCancel(t)||(throwIfCancellationRequested(e),t&&t.response&&(t.response.data=transformData.call(e,e.transformResponse,t.response),t.response.headers=K.from(t.response.headers))),Promise.reject(t)}))}const headersToObject=e=>e instanceof K?e.toJSON():e;function mergeConfig(e,t){t=t||{};const r={};function getMergedValue(e,t,r){return D.isPlainObject(e)&&D.isPlainObject(t)?D.merge.call({caseless:r},e,t):D.isPlainObject(t)?D.merge({},t):D.isArray(t)?t.slice():t}function mergeDeepProperties(e,t,r){return D.isUndefined(t)?D.isUndefined(e)?void 0:getMergedValue(void 0,e,r):getMergedValue(e,t,r)}function valueFromConfig2(e,t){if(!D.isUndefined(t))return getMergedValue(void 0,t)}function defaultToConfig2(e,t){return D.isUndefined(t)?D.isUndefined(e)?void 0:getMergedValue(void 0,e):getMergedValue(void 0,t)}function mergeDirectKeys(r,n,i){return i in t?getMergedValue(r,n):i in e?getMergedValue(void 0,r):void 0}const n={url:valueFromConfig2,method:valueFromConfig2,data:valueFromConfig2,baseURL:defaultToConfig2,transformRequest:defaultToConfig2,transformResponse:defaultToConfig2,paramsSerializer:defaultToConfig2,timeout:defaultToConfig2,timeoutMessage:defaultToConfig2,withCredentials:defaultToConfig2,withXSRFToken:defaultToConfig2,adapter:defaultToConfig2,responseType:defaultToConfig2,xsrfCookieName:defaultToConfig2,xsrfHeaderName:defaultToConfig2,onUploadProgress:defaultToConfig2,onDownloadProgress:defaultToConfig2,decompress:defaultToConfig2,maxContentLength:defaultToConfig2,maxBodyLength:defaultToConfig2,beforeRedirect:defaultToConfig2,transport:defaultToConfig2,httpAgent:defaultToConfig2,httpsAgent:defaultToConfig2,cancelToken:defaultToConfig2,socketPath:defaultToConfig2,responseEncoding:defaultToConfig2,validateStatus:mergeDirectKeys,headers:(e,t)=>mergeDeepProperties(headersToObject(e),headersToObject(t),!0)};return D.forEach(Object.keys(Object.assign({},e,t)),(function computeConfigValue(i){const a=n[i]||mergeDeepProperties,o=a(e[i],t[i],i);D.isUndefined(o)&&a!==mergeDirectKeys||(r[i]=o)})),r}const J="1.6.2",Y={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Y[e]=function validator(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Q={};Y.transitional=function transitional(e,t,r){function formatMessage(e,t){return"[Axios v1.6.2] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,i)=>{if(!1===e)throw new AxiosError(formatMessage(n," has been removed"+(t?" in "+t:"")),AxiosError.ERR_DEPRECATED);return t&&!Q[n]&&(Q[n]=!0,console.warn(formatMessage(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,i)}};var X={assertOptions:function assertOptions(e,t,r){if("object"!=typeof e)throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new AxiosError("option "+a+" must be "+r,AxiosError.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new AxiosError("Unknown option "+a,AxiosError.ERR_BAD_OPTION)}},validators:Y};const ee=X.validators;class Axios{constructor(e){this.defaults=e,this.interceptors={request:new x,response:new x}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=mergeConfig(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&X.assertOptions(r,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1),null!=n&&(D.isFunction(n)?t.paramsSerializer={serialize:n}:X.assertOptions(n,{encode:ee.function,serialize:ee.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&D.merge(i.common,i[t.method]);i&&D.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=K.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function unshiftRequestInterceptors(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const l=[];let c;this.interceptors.response.forEach((function pushResponseInterceptors(e){l.push(e.fulfilled,e.rejected)}));let u,d=0;if(!s){const e=[dispatchRequest.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,l),u=e.length,c=Promise.resolve(t);d<u;)c=c.then(e[d++],e[d++]);return c}u=o.length;let p=t;for(d=0;d<u;){const e=o[d++],t=o[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{c=dispatchRequest.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return buildURL(buildFullPath((e=mergeConfig(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}D.forEach(["delete","get","head","options"],(function forEachMethodNoData(e){Axios.prototype[e]=function(t,r){return this.request(mergeConfig(r||{},{method:e,url:t,data:(r||{}).data}))}})),D.forEach(["post","put","patch"],(function forEachMethodWithData(e){function generateHTTPMethod(t){return function httpMethod(r,n,i){return this.request(mergeConfig(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Axios.prototype[e]=generateHTTPMethod(),Axios.prototype[e+"Form"]=generateHTTPMethod(!0)}));var te=Axios;class CancelToken{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function promiseExecutor(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function reject(){r.unsubscribe(t)},n},e((function cancel(e,n,i){r.reason||(r.reason=new CanceledError(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new CancelToken((function executor(t){e=t})),cancel:e}}}var re=CancelToken;const ne={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ne).forEach((([e,t])=>{ne[t]=e}));var ie=ne;const ae=function createInstance(e){const t=new te(e),r=bind(te.prototype.request,t);return D.extend(r,te.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function create(t){return createInstance(mergeConfig(e,t))},r}(V);ae.Axios=te,ae.CanceledError=CanceledError,ae.CancelToken=re,ae.isCancel=isCancel,ae.VERSION=J,ae.toFormData=toFormData,ae.AxiosError=AxiosError,ae.Cancel=ae.CanceledError,ae.all=function all(e){return Promise.all(e)},ae.spread=function spread(e){return function wrap(t){return e.apply(null,t)}},ae.isAxiosError=function isAxiosError(e){return D.isObject(e)&&!0===e.isAxiosError},ae.mergeConfig=mergeConfig,ae.AxiosHeaders=K,ae.formToJSON=e=>formDataToJSON(D.isHTMLForm(e)?new FormData(e):e),ae.getAdapter=adapters_getAdapter,ae.HttpStatusCode=ie,ae.default=ae,e.exports=ae},4901:(e,t,r)=>{"use strict";r.r(t),r.d(t,{JsonPatchError:()=>l,_areEquals:()=>_areEquals,applyOperation:()=>applyOperation,applyPatch:()=>applyPatch,applyReducer:()=>applyReducer,compare:()=>compare,deepClone:()=>_deepClone,default:()=>m,escapePathComponent:()=>escapePathComponent,generate:()=>generate,getValueByPointer:()=>getValueByPointer,observe:()=>observe,unescapePathComponent:()=>unescapePathComponent,unobserve:()=>unobserve,validate:()=>validate,validator:()=>validator});var n={};r.r(n),r.d(n,{JsonPatchError:()=>c,_areEquals:()=>_areEquals,applyOperation:()=>applyOperation,applyPatch:()=>applyPatch,applyReducer:()=>applyReducer,deepClone:()=>u,getValueByPointer:()=>getValueByPointer,validate:()=>validate,validator:()=>validator});var i={};r.r(i),r.d(i,{compare:()=>compare,generate:()=>generate,observe:()=>observe,unobserve:()=>unobserve});var a,o=(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},a(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=Object.prototype.hasOwnProperty;function helpers_hasOwnProperty(e,t){return s.call(e,t)}function _objectKeys(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var i in e)helpers_hasOwnProperty(e,i)&&n.push(i);return n}function _deepClone(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function isInteger(e){for(var t,r=0,n=e.length;r<n;){if(!((t=e.charCodeAt(r))>=48&&t<=57))return!1;r++}return!0}function escapePathComponent(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function unescapePathComponent(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function hasUndefined(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(hasUndefined(e[t]))return!0}else if("object"==typeof e)for(var n=_objectKeys(e),i=n.length,a=0;a<i;a++)if(hasUndefined(e[n[a]]))return!0;return!1}function patchErrorMessageFormatter(e,t){var r=[e];for(var n in t){var i="object"==typeof t[n]?JSON.stringify(t[n],null,2):t[n];void 0!==i&&r.push(n+": "+i)}return r.join("\n")}var l=function(e){function PatchError(t,r,n,i,a){var o=this.constructor,s=e.call(this,patchErrorMessageFormatter(t,{name:r,index:n,operation:i,tree:a}))||this;return s.name=r,s.index=n,s.operation=i,s.tree=a,Object.setPrototypeOf(s,o.prototype),s.message=patchErrorMessageFormatter(t,{name:r,index:n,operation:i,tree:a}),s}return o(PatchError,e),PatchError}(Error),c=l,u=_deepClone,d={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=getValueByPointer(r,this.path);n&&(n=_deepClone(n));var i=applyOperation(r,{op:"remove",path:this.from}).removed;return applyOperation(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=getValueByPointer(r,this.from);return applyOperation(r,{op:"add",path:this.path,value:_deepClone(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:_areEquals(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},p={add:function(e,t,r){return isInteger(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:d.move,copy:d.copy,test:d.test,_get:d._get};function getValueByPointer(e,t){if(""==t)return e;var r={op:"_get",path:t};return applyOperation(e,r),r.value}function applyOperation(e,t,r,n,i,a){if(void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===i&&(i=!0),void 0===a&&(a=0),r&&("function"==typeof r?r(t,0,e,t.path):validator(t,0)),""===t.path){var o={newDocument:e};if("add"===t.op)return o.newDocument=t.value,o;if("replace"===t.op)return o.newDocument=t.value,o.removed=e,o;if("move"===t.op||"copy"===t.op)return o.newDocument=getValueByPointer(e,t.from),"move"===t.op&&(o.removed=e),o;if("test"===t.op){if(o.test=_areEquals(e,t.value),!1===o.test)throw new c("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return o.newDocument=e,o}if("remove"===t.op)return o.removed=e,o.newDocument=null,o;if("_get"===t.op)return t.value=e,o;if(r)throw new c("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return o}n||(e=_deepClone(e));var s=(t.path||"").split("/"),l=e,u=1,h=s.length,y=void 0,g=void 0,m=void 0;for(m="function"==typeof r?r:validator;;){if((g=s[u])&&-1!=g.indexOf("~")&&(g=unescapePathComponent(g)),i&&("__proto__"==g||"prototype"==g&&u>0&&"constructor"==s[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&void 0===y&&(void 0===l[g]?y=s.slice(0,u).join("/"):u==h-1&&(y=t.path),void 0!==y&&m(t,0,e,y)),u++,Array.isArray(l)){if("-"===g)g=l.length;else{if(r&&!isInteger(g))throw new c("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);isInteger(g)&&(g=~~g)}if(u>=h){if(r&&"add"===t.op&&g>l.length)throw new c("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);if(!1===(o=p[t.op].call(t,l,g,e)).test)throw new c("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return o}}else if(u>=h){if(!1===(o=d[t.op].call(t,l,g,e)).test)throw new c("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return o}if(l=l[g],r&&u<h&&(!l||"object"!=typeof l))throw new c("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}function applyPatch(e,t,r,n,i){if(void 0===n&&(n=!0),void 0===i&&(i=!0),r&&!Array.isArray(t))throw new c("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=_deepClone(e));for(var a=new Array(t.length),o=0,s=t.length;o<s;o++)a[o]=applyOperation(e,t[o],r,!0,i,o),e=a[o].newDocument;return a.newDocument=e,a}function applyReducer(e,t,r){var n=applyOperation(e,t);if(!1===n.test)throw new c("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function validator(e,t,r,n){if("object"!=typeof e||null===e||Array.isArray(e))throw new c("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(!d[e.op])throw new c("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r);if("string"!=typeof e.path)throw new c("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new c('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new c("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new c("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&hasUndefined(e.value))throw new c("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r)if("add"==e.op){var i=e.path.split("/").length,a=n.split("/").length;if(i!==a+1&&i!==a)throw new c("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==n)throw new c("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if("move"===e.op||"copy"===e.op){var o=validate([{op:"_get",path:e.from,value:void 0}],r);if(o&&"OPERATION_PATH_UNRESOLVABLE"===o.name)throw new c("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}function validate(e,t,r){try{if(!Array.isArray(e))throw new c("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)applyPatch(_deepClone(t),_deepClone(e),r||!0);else{r=r||validator;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(e){if(e instanceof c)return e;throw e}}function _areEquals(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var r,n,i,a=Array.isArray(e),o=Array.isArray(t);if(a&&o){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!_areEquals(e[r],t[r]))return!1;return!0}if(a!=o)return!1;var s=Object.keys(e);if((n=s.length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!t.hasOwnProperty(s[r]))return!1;for(r=n;0!=r--;)if(!_areEquals(e[i=s[r]],t[i]))return!1;return!0}return e!=e&&t!=t}var h=new WeakMap,y=function y(e){this.observers=new Map,this.obj=e},g=function g(e,t){this.callback=e,this.observer=t};function unobserve(e,t){t.unobserve()}function observe(e,t){var r,n=function getMirror(e){return h.get(e)}(e);if(n){var i=function getObserverFromMirror(e,t){return e.observers.get(t)}(n,t);r=i&&i.observer}else n=new y(e),h.set(e,n);if(r)return r;if(r={},n.value=_deepClone(e),t){r.callback=t,r.next=null;var dirtyCheck=function(){generate(r)},fastCheck=function(){clearTimeout(r.next),r.next=setTimeout(dirtyCheck)};"undefined"!=typeof window&&(window.addEventListener("mouseup",fastCheck),window.addEventListener("keyup",fastCheck),window.addEventListener("mousedown",fastCheck),window.addEventListener("keydown",fastCheck),window.addEventListener("change",fastCheck))}return r.patches=[],r.object=e,r.unobserve=function(){generate(r),clearTimeout(r.next),function removeObserverFromMirror(e,t){e.observers.delete(t.callback)}(n,r),"undefined"!=typeof window&&(window.removeEventListener("mouseup",fastCheck),window.removeEventListener("keyup",fastCheck),window.removeEventListener("mousedown",fastCheck),window.removeEventListener("keydown",fastCheck),window.removeEventListener("change",fastCheck))},n.observers.set(t,new g(t,r)),r}function generate(e,t){void 0===t&&(t=!1);var r=h.get(e.object);_generate(r.value,e.object,e.patches,"",t),e.patches.length&&applyPatch(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function _generate(e,t,r,n,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var a=_objectKeys(t),o=_objectKeys(e),s=!1,l=o.length-1;l>=0;l--){var c=e[d=o[l]];if(!helpers_hasOwnProperty(t,d)||void 0===t[d]&&void 0!==c&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&r.push({op:"test",path:n+"/"+escapePathComponent(d),value:_deepClone(c)}),r.push({op:"remove",path:n+"/"+escapePathComponent(d)}),s=!0):(i&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),!0);else{var u=t[d];"object"==typeof c&&null!=c&&"object"==typeof u&&null!=u&&Array.isArray(c)===Array.isArray(u)?_generate(c,u,r,n+"/"+escapePathComponent(d),i):c!==u&&(!0,i&&r.push({op:"test",path:n+"/"+escapePathComponent(d),value:_deepClone(c)}),r.push({op:"replace",path:n+"/"+escapePathComponent(d),value:_deepClone(u)}))}}if(s||a.length!=o.length)for(l=0;l<a.length;l++){var d;helpers_hasOwnProperty(e,d=a[l])||void 0===t[d]||r.push({op:"add",path:n+"/"+escapePathComponent(d),value:_deepClone(t[d])})}}}function compare(e,t,r){void 0===r&&(r=!1);var n=[];return _generate(e,t,n,"",r),n}const m=Object.assign({},n,i,{JsonPatchError:l,deepClone:_deepClone,escapePathComponent,unescapePathComponent})}},t={};function __webpack_require__(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r=__webpack_require__(5590);NMSHDTransport=r})();
|
|
2
|
+
var NMSHDTransport;(()=>{var e={2500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildInformation=void 0;const n=r(194),i=r(2890);t.buildInformation={version:"2.2.1",build:"67",date:"2024-01-16T11:48:04+00:00",commit:"ffb392ea91d019f27b40bc92a2eb2650288e84a6",dependencies:{"@js-soft/docdb-access-abstractions":"1.0.3","@js-soft/logging-abstractions":"1.0.1","@js-soft/simple-logger":"1.0.4","@js-soft/ts-utils":"2.3.3",axios:"^1.6.5","fast-json-patch":"^3.1.1","form-data":"^4.0.0","json-stringify-safe":"^5.0.1",lodash:"^4.17.21",luxon:"^3.4.4",qs:"^6.11.2","reflect-metadata":"^0.2.1","ts-simple-nameof":"^1.3.1",uuid:"^9.0.1"},libraries:{crypto:i.buildInformation,serval:n.buildInformation}}},4093:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreCrypto=void 0;const n=r(2890),i=r(1577),a=r(1796),o=r(819);t.CoreCrypto=class CoreCrypto{static async generateSignatureKeypair(e=o.TransportVersion.Latest){if(e===o.TransportVersion.V1)return await n.CryptoSignatures.generateKeypair(3);throw this.invalidVersion(e)}static async generateExchangeKeypair(e=o.TransportVersion.Latest){if(e===o.TransportVersion.V1)return await n.CryptoExchange.generateKeypair(3);throw this.invalidVersion(e)}static async generateSecretKey(e=o.TransportVersion.Latest){if(e===o.TransportVersion.V1)return await n.CryptoEncryption.generateKey(3);throw this.invalidVersion(e)}static async generatePassword(e,t="enmeshed",r=3,i=o.TransportVersion.Latest){const a=n.CoreBuffer.fromString(e,n.Encoding.Utf8),s=n.CoreBuffer.fromString(t,n.Encoding.Utf8);if(i===o.TransportVersion.V1)return await n.CryptoDerivation.deriveKeyFromMaster(a,15e4,r,s);throw this.invalidVersion(i)}static async deriveKeyFromBase(e,t,r,i=3){let o;if(e instanceof n.CryptoSecretKey)o=e.secretKey;else{if(!(e instanceof n.CoreBuffer))throw new a.TransportError("The secret type is invalid.");o=e}return await n.CryptoDerivation.deriveKeyFromBase(o,t,r,i)}static async deriveClient(e,t,r=3,i=o.TransportVersion.Latest){if(i===o.TransportVersion.V1){return await n.CryptoExchange.deriveTemplator(e,t,r)}throw this.invalidVersion(i)}static async deriveServer(e,t,r=3,i=o.TransportVersion.Latest){if(i===o.TransportVersion.V1){return await n.CryptoExchange.deriveRequestor(e,t,r)}throw this.invalidVersion(i)}static async sign(e,t,r=o.TransportVersion.Latest){if(r===o.TransportVersion.V1)return await n.CryptoSignatures.sign(e,t,2);throw this.invalidVersion(r)}static async verify(e,t,r,i=o.TransportVersion.Latest){if(i===o.TransportVersion.V1)return await n.CryptoSignatures.verify(e,t,r);throw this.invalidVersion(i)}static async encrypt(e,t,r=o.TransportVersion.Latest){if(r===o.TransportVersion.V1)return await n.CryptoEncryption.encrypt(e,t);throw this.invalidVersion(r)}static async decrypt(e,t,r=o.TransportVersion.Latest){if(r===o.TransportVersion.V1)return await n.CryptoEncryption.decrypt(e,t);throw this.invalidVersion(r)}static async random(e){return await n.CryptoRandom.bytes(e)}static async createAccountPassword(){return await i.PasswordGenerator.createStrongPassword(100,100)}static invalidVersion(e){return new a.TransportError(`The version ${e} is not supported.`)}}},8147:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreError=void 0;const i=n(r(4530));class CoreError extends Error{get code(){return this._code}get reason(){return this._reason}get data(){return this._data}get time(){return this._time}get rootError(){return this._rootError}get context(){return this._context}constructor(e="error.unknown",t="Operation failed unexpectedly.",r=null,n=new Date,a,o){const s=[];s.push(e),t&&s.push(": '",t,"'"),s.push(" at ",n.toISOString()),r&&("function"==typeof r.toJSON?s.push(` with data ${r.toJSON(!1)}`):s.push(` with data ${(0,i.default)(r)}`)),super(s.join("")),this._code=e,this._reason=t,this._time=n,this._data=r,this.name="CoreError",this._rootError=a,this._context=o,void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,null!=o?o:CoreError)}equals(e){return this.code===e.code}logWith(e){return e.error(this),this}}t.CoreError=CoreError},6555:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreErrors=void 0;const i=n(r(4530)),a=r(8147);class CoreErrors{}t.CoreErrors=CoreErrors,CoreErrors.relationships=new class Relationships{wrongChangeStatus(e){return new a.CoreError("error.transport.relationships.wrongChangeStatus",`The relationship change has the wrong status (${e}) to run this operation`)}},CoreErrors.general=new class General{baseUrlNotSet(){return new a.CoreError("error.transport.general.baseUrlNotSet","The baseUrl was not set.")}platformClientSecretNotSet(){return new a.CoreError("error.transport.general.platformClientSecretNotSet","The platform clientSecret was not set.")}platformClientIdNotSet(){return new a.CoreError("error.transport.general.platformClientIdNotSet","The platform clientId was not set.")}platformClientInvalid(){return new a.CoreError("error.transport.general.platformClientInvalid","The combination of platform clientId and clientSecret is invalid.")}signatureNotValid(e){return new a.CoreError("error.transport.signatureNotValid",`The ${e?`${e}-`:""}signature is not valid.`)}recordNotFound(e,t){return new a.CoreError("error.transport.recordNotFound",`'${e instanceof Function?e.name:e}' not found.`,t)}notSupported(){return new a.CoreError("error.transport.notSupported","The method is not yet supported.")}realmLength(){return new a.CoreError("error.transport.identity.realmLength","Realm must be of length 3.")}invalidTruncatedReference(){return new a.CoreError("error.transport.files.invalidTruncatedReference","invalid truncated reference")}},CoreErrors.messages=new class Messages{plaintextMismatch(e){return new a.CoreError("error.transport.messages.plaintextMismatch",`The own address ${e} was not named as a recipient within the signed MessagePlaintext. A replay attack might be the cause of this.`)}signatureListMismatch(e){return new a.CoreError("error.transport.messages.signatureListMismatch",`The signature list didn't contain an entry for address ${e}.`)}signatureNotValid(){return new a.CoreError("error.transport.messages.signatureNotValid","The digital signature on this message for peer key is invalid. An impersonination attack might be the cause of this.")}ownAddressNotInList(e){return new a.CoreError("error.transport.messages.ownAddressNotInList",`The recipients list of message ${e} didn't contain an entry for the own address. This message should not have been received.`)}noMatchingRelationship(e){return new a.CoreError("error.transport.messages.noMatchingRelationship",`A Relationship with the given address '${e}' does not exist.`)}},CoreErrors.secrets=new class Secrets{wrongSecretType(e){return new a.CoreError("error.transport.secrets.wrongBaseKeyType","The given secret type is not supported!",{secretId:e})}secretNotFound(e){return new a.CoreError("error.transport.secrets.secretNotFound",`secret "${e}" not found`)}},CoreErrors.device=new class Device{alreadyOnboarded(){return new a.CoreError("error.transport.devices.alreadyOnboarded","The device has already been onboarded.")}couldNotDeleteDevice(e,t){return new a.CoreError("error.transport.devices.couldNotDeleteDevice",`Could not delete device: ${e}`,t)}},CoreErrors.files=new class Files{plaintextHashMismatch(){return new a.CoreError("error.transport.files.plaintextHashMismatch","The actual hash of the plaintext does not match the given plaintextHash. Something went wrong while encrypting/decrypting the file.")}cipherMismatch(){return new a.CoreError("error.transport.files.cipherMismatch","The actual hash of the cipher does not match the given cipherHash. Something went wrong while storing/transmitting the file.")}invalidMetadata(e){return new a.CoreError("error.transport.files.invalidMetadata",`The metadata of the file with id "${e}" is invalid.`)}fileContentUndefined(){return new a.CoreError("error.transport.files.fileContentUndefined","The given file content is undefined.")}maxFileSizeExceeded(e,t){return new a.CoreError("error.transport.files.maxFileSizeExceeded",`The given file content size (${e}) exceeds the max file size the backbone accepts (${t}).`)}},CoreErrors.challenges=new class Challenges{challengeTypeRequiresRelationship(){return new a.CoreError("error.transport.challenges.challengeTypeRequiresRelationship","The challenge type 'Relationship' requires a relationship.")}},CoreErrors.datawallet=new class Datawallet{encryptedPayloadIsNoCipher(){return new a.CoreError("error.transport.datawallet.encryptedPayloadIsNoCipher","The given encrypted payload is no cipher.")}unsupportedModification(e,t){const r=t?(0,i.default)(t):"";if("unsupportedCacheChangedModificationCollection"===e)return new a.CoreError("error.transport.datawallet.unsupportedModification",`The following collections were received in CacheChanged datawallet modifications but are not supported by the current version of this library: ${r}.`);throw new Error(`Given type '${e}' is not supported.`)}insufficientSupportedDatawalletVersion(e,t){return new a.CoreError("error.transport.datawallet.insufficientSupportedDatawalletVersion",`The SupportedDatawalletVersion '${e}' is too low. A minimum version of '${t}' is required.`)}currentBiggerThanTarget(e,t){return new a.CoreError("error.transport.datawallet.currentBiggerThanTarget",`The current datawallet version '${e}' is bigger than the target version '${t}'.`)}},CoreErrors.tokens=new class Tokens{invalidTokenContent(e){return new a.CoreError("error.transport.tokens.invalidTokenContent",`The content of token ${e} is not of type TokenContent`)}}},3289:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreIdHelper=void 0;const n=r(5833),i=r(1796),a=r(9170);t.CoreIdHelper=class CoreIdHelper{constructor(e,t=!1){this.prefix=e,this.validateOnly=t,this.coreIdRegex=new RegExp(`${e}[${n.RandomCharacterRange.Alphanumeric}]{${20-e.length}}`)}async generate(){if(this.validateOnly)throw new i.TransportError("This CoreIdHelper is set up for validation only.");return await a.CoreId.generate(this.prefix)}async generateUnsafe(){return await a.CoreId.generate(this.prefix)}validate(e){return e instanceof a.CoreId&&(e=e.toString()),this.coreIdRegex.test(e)}}},6904:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreSerializable=void 0;const i=r(194),a=r(2890);let o=class CoreSerializable extends i.Serializable{toBase64(){return a.CoreBuffer.fromUtf8(this.serialize()).toBase64URL()}static fromBase64T(e){const t=a.CoreBuffer.fromBase64URL(e).toUtf8();return this.deserialize(t)}static fromBase64Unknown(e){const t=a.CoreBuffer.fromBase64URL(e).toUtf8();return i.Serializable.deserializeUnknown(t)}};t.CoreSerializable=o,t.CoreSerializable=o=n([(0,i.type)("CoreSerializable")],o)},2970:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreSerializableAsync=void 0;const i=r(194),a=r(2890);let o=class CoreSerializableAsync extends i.SerializableAsync{toBase64(){return a.CoreBuffer.fromUtf8(this.serialize()).toBase64URL()}static async fromBase64T(e){const t=a.CoreBuffer.fromBase64URL(e).toUtf8(),r=this.deserialize(t);return await r}static async fromBase64Unknown(e){const t=a.CoreBuffer.fromBase64URL(e).toUtf8();return await i.SerializableAsync.deserializeUnknown(t)}};t.CoreSerializableAsync=o,t.CoreSerializableAsync=o=n([(0,i.type)("CoreSerializableAsync")],o)},6564:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreSynchronizable=void 0;const a=r(194),o=r(6904),s=r(9170);class CoreSynchronizable extends o.CoreSerializable{constructor(){super(...arguments),this.technicalProperties=[],this.userdataProperties=[],this.metadataProperties=[]}}t.CoreSynchronizable=CoreSynchronizable,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],CoreSynchronizable.prototype,"id",void 0)},1341:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreUtil=void 0;const n=r(194),i=r(2890),a=r(1796);t.CoreUtil=class CoreUtil{static toBuffer(e,t=!1){let r;if(e instanceof i.CoreBuffer)return e;if("string"==typeof e)r=i.CoreBuffer.fromUtf8(e);else if(e instanceof n.SerializableAsync||e instanceof n.Serializable)r=i.CoreBuffer.fromUtf8(e.serialize(t));else{if(!(e instanceof ArrayBuffer||e instanceof Uint8Array))throw new a.TransportError("The given content cannot be transformed to buffer.");r=new i.CoreBuffer(e)}return r}static toSerializable(e){return e instanceof n.SerializableAsync||e instanceof n.Serializable?e:n.Serializable.fromUnknown(e)}}},369:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DbCollectionName=void 0,function(e){e.Files="Files",e.Tokens="Tokens",e.Relationships="Relationships",e.RelationshipTemplates="Templates",e.Messages="Messages",e.CertificatesIssued="CertificatesIssued",e.UnpushedDatawalletModifications="UnpushedDatawalletModifications",e.Devices="Devices",e.Secrets="Secrets"}(r||(t.DbCollectionName=r={}))},5796:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1201:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressReporterStep=t.ProgressReporter=void 0;t.ProgressReporter=class ProgressReporter{constructor(e){this.callback=e}createStep(e,t=-1){return new ProgressReporterStep(e,t,this.callback)}};class ProgressReporterStep{constructor(e,t,r){this.name=e,this.totalNumberOfItems=t,this.callback=r,t>0&&this.progressTo(0)}progress(){this.progressTo(this.currentItem+1)}progressTo(e){var t;this.currentItem=e,null===(t=this.callback)||void 0===t||t.call(this,Math.round(e/this.totalNumberOfItems*100),this.name)}incrementTotalNumberOfItems(){this.updateTotalNumberOfItems(this.totalNumberOfItems+1)}updateTotalNumberOfItems(e){this.totalNumberOfItems=e}finish(){this.currentItem<this.totalNumberOfItems&&this.progressTo(this.totalNumberOfItems)}manualReport(e){var t;null===(t=this.callback)||void 0===t||t.call(this,e,this.name)}}t.ProgressReporterStep=ProgressReporterStep},8925:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Reference=void 0;const a=r(194),o=r(2890),s=r(6555),l=r(9170);class Reference extends a.Serializable{truncate(){return o.CoreBuffer.fromUtf8(`${this.id.toString()}|${this.key.algorithm}|${this.key.secretKey.toBase64URL()}`).toBase64URL()}static fromTruncated(e){const t=o.CoreBuffer.fromBase64URL(e).toUtf8().split("|");if(3!==t.length)throw s.CoreErrors.general.invalidTruncatedReference();try{const e=l.CoreId.from(t[0]),r=parseInt(t[1]),n=t[2],i=o.CryptoSecretKey.from({algorithm:r,secretKey:o.CoreBuffer.fromBase64URL(n)});return this.from({id:l.CoreId.from(e),key:i})}catch(e){throw s.CoreErrors.general.invalidTruncatedReference()}}static validateId(e,t){if((null==e?void 0:e.id)&&!t.validate(e.id))throw new a.ValidationError(this.name,"id",`id must start with '${t.prefix}' but is '${e.id}'`)}static from(e){return"string"==typeof e?this.fromTruncated(e):this.fromAny(e)}}t.Reference=Reference,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreId)],Reference.prototype,"id",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],Reference.prototype,"key",void 0)},2685:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Transport=void 0;const i=r(2391),a=r(2890),o=n(r(6486)),s=r(2016),l=r(6555),c=r(981),u=r(1796),d=r(392);let p;class Transport{get config(){return this._config}constructor(e,t,r,n=new i.SimpleLoggerFactory){if(this.eventBus=r,this.databaseConnection=e,this._config=o.default.defaultsDeep({},t,Transport.defaultConfig),d.TransportLoggerFactory.init(n),p=d.TransportLoggerFactory.getLogger(Transport),!this._config.platformClientId)throw l.CoreErrors.general.platformClientIdNotSet().logWith(p);if(!this._config.platformClientSecret)throw l.CoreErrors.general.platformClientSecretNotSet().logWith(p);if(!this._config.baseUrl)throw l.CoreErrors.general.baseUrlNotSet().logWith(p);if(this._config.supportedDatawalletVersion<1)throw new u.TransportError("The given supported datawallet version is invalid. The value must be 1 or higher.");if(this._config.supportedIdentityVersion<1)throw new u.TransportError("The given supported identity version is invalid. The value must be 1 or higher.");if(3!==this._config.realm.length)throw l.CoreErrors.general.realmLength()}async init(){return p.trace("Initializing Libsodium..."),await a.SodiumWrapper.ready(),p.trace("Libsodium initialized"),p.info("Transport initialized"),this}async createDatabase(e){return await this.databaseConnection.getDatabase(e)}static get context(){return c.TransportContext.currentContext()}}t.Transport=Transport,Transport.defaultConfig={supportedDatawalletVersion:1,supportedIdentityVersion:-1,debug:!1,platformClientId:"",platformClientSecret:"",platformTimeout:6e4,platformMaxRedirects:10,platformMaxUnencryptedFileSize:10485760,baseUrl:"",realm:s.Realm.Prod,datawalletEnabled:!1,httpAgent:{keepAlive:!0,maxSockets:5,maxFreeSockets:2},httpsAgent:{keepAlive:!0,maxSockets:5,maxFreeSockets:2}}},981:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TransportContext=void 0,function(e){e.Web="Web",e.Cordova="Cordova",e.Node="Node"}(r||(t.TransportContext=r={})),function(e){let t;e.currentContext=function currentContext(){return t||(t=function _queryContext(){return"undefined"==typeof window?e.Node:window.isCordovaApp?e.Cordova:e.Web}()),t}}(r||(t.TransportContext=r={}))},2508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportController=t.ControllerName=void 0;const n=r(1796),i=r(392);var a;!function(e){e.Account="Account",e.Attribute="Attribute",e.Certificate="Certificate",e.CertificateIssuer="CertificateIssuer",e.CertificateValidator="CertificateValidator",e.Challenge="Challenge",e.Device="Device",e.Devices="Devices",e.DeviceSecret="DeviceSecret",e.File="File",e.Identity="Identity",e.Message="Message",e.Relationship="Relationship",e.Relationships="Relationships",e.RelationshipTemplate="RelationshipTemplate",e.RelationshipRequest="RelationshipRequest",e.RelationshipRequestor="RelationshipRequestor",e.RelationshipSecret="RelationshipSecret",e.RelationshipTemplator="RelationshipTemplator",e.Secret="Secret",e.Sync="Sync",e.Token="Token"}(a||(t.ControllerName=a={}));t.TransportController=class TransportController{get initialized(){return this._initialized}get log(){return this._log}get parent(){return this._parent}get config(){return this._parent.config}get db(){return this._parent.db}get transport(){return this._parent.transport}get controllerName(){return this._controllerName}get eventBus(){return this.transport.eventBus}constructor(e,t){var r;this._controllerName=e,this._parent=t,this._initialized=!1,this._dbClosed=!1;let n=e;this.config.debug&&(null===(r=this.parent.activeDeviceOrUndefined)||void 0===r?void 0:r.deviceOrUndefined)&&(n+=` of ${this.parent.activeDevice.device.id}`),this._log=i.TransportLoggerFactory.getLogger(n)}init(...e){if(this._initialized)throw new n.TransportError(`The controller ${this.controllerName} is already initialized.`);return this._initialized=!0,Promise.resolve(this)}parseArray(e,t){return e.map((e=>t.fromAny(e)))}newCacheEmptyError(e,t){return new n.TransportError(`The cache of ${e instanceof Function?e.name:e} with id "${t}" is empty.`)}}},1796:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportError=void 0;class TransportError extends Error{}t.TransportError=TransportError},8169:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportIds=void 0;const n=r(3289);class TransportIds{}t.TransportIds=TransportIds,TransportIds.generic=new n.CoreIdHelper(""),TransportIds.secret=new n.CoreIdHelper("TRPSEC"),TransportIds.relationshipSecret=new n.CoreIdHelper("TRPRSE"),TransportIds.relationshipTemplateKey=new n.CoreIdHelper("TRPRTK"),TransportIds.datawalletModification=new n.CoreIdHelper("TRPDWM")},392:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportLoggerFactory=void 0;const n=r(1796);t.TransportLoggerFactory=class TransportLoggerFactory{static init(e){this.instance=e}static getLogger(e){if(!this.isInitialized())throw new n.TransportError("The logger factory is not yet initialized. Call TransportLoggerFactory.init() first.");return"function"==typeof e?this.instance.getLogger(`Transport.${e.name}`):this.instance.getLogger(`Transport.${e}`)}static isInitialized(){return!!this.instance}}},9369:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AuthClient=void 0;const i=n(r(129)),a=r(1732),o=r(8892),s=r(8990),l=r(8103);class AuthClient extends l.RESTClient{async authenticate(e){var t;const r="/connect/token";let n;try{n=await this.createAxios().post(r,i.default.stringify({client_id:e.clientId,client_secret:e.clientSecret,grant_type:e.grantType,username:e.username,password:e.password}))}catch(e){const n=new s.RequestError("post",r,void 0,"error.transport.request.noAuthPossible","Authentication was not possible. Is the service up and running?"+(e.message?` Root cause: '${e.message}'`:""),"",null===(t=e.response)||void 0===t?void 0:t.status).setObject(e.isAxiosError?s.RequestError.cleanAxiosError(e):e);return o.ClientResult.fail(n)}const l={requestTime:n.headers["x-request-time"],responseDuration:n.headers["x-response-duration-ms"],responseTime:n.headers["x-response-time"],traceId:n.headers["x-trace-id"]};if(200!==n.status)return o.ClientResult.fail(new s.RequestError("post",r,l,"error.transport.request.noAuthGrant","Backbone did not grant authentication. Are the credentials correct?","",n.status).setObject(n.data.error));const c=n.data;return o.ClientResult.ok({expiry:a.CoreDate.utc().add({seconds:parseInt(c.expires_in)}),token:c.access_token})}}t.AuthClient=AuthClient},4381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Authenticator=void 0;const n=r(9369);t.Authenticator=class Authenticator{constructor(e){this.accountController=e,this.authClient=new n.AuthClient(e.config)}async getToken(){return this.token&&!this.isExpired()||await this.authenticate(),this.token}debugLog(e){var t;e.error("Current token is: ",this.token),e.error("Expiry is: ",null===(t=this.expiry)||void 0===t?void 0:t.toISOString())}clear(){this.token=void 0,this.expiry=void 0}isExpired(){if(!this.expiry)return!0;return this.expiry.subtract({seconds:10}).isExpired()}async authenticate(){if(this.request)return await this.request;this.clear(),this.request=this.authenticateInternal();try{await this.request}finally{this.request=void 0}}async authenticateInternal(){const e=await this.accountController.activeDevice.getCredentials(),t={grantType:"password",clientId:this.accountController.config.platformClientId,clientSecret:this.accountController.config.platformClientSecret,username:e.username,password:e.password},r=await this.authClient.authenticate(t);this.token=r.value.token,this.expiry=r.value.expiry}}},9867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BackboneIds=void 0;const n=r(3289);class BackboneIds{}t.BackboneIds=BackboneIds,BackboneIds.file=new n.CoreIdHelper("FIL",!0),BackboneIds.relationship=new n.CoreIdHelper("REL",!0),BackboneIds.message=new n.CoreIdHelper("MSG",!0),BackboneIds.relationshipTemplate=new n.CoreIdHelper("RLT",!0),BackboneIds.token=new n.CoreIdHelper("TOK",!0),BackboneIds.relationshipChange=new n.CoreIdHelper("RCH",!0),BackboneIds.device=new n.CoreIdHelper("DVC",!0)},8892:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientResult=void 0;const n=r(1796),i=r(4062);class ClientResult{constructor(e,t,r,a){if(e&&r)throw new n.TransportError("InvalidOperation: A result cannot be successful and contain an error");if(!e&&!r)throw new n.TransportError("InvalidOperation: A failing result needs to contain an error");if(void 0!==t&&!e)throw new n.TransportError("InvalidOperation: A value is only useful in case of a success.");this._value=t,this._isSuccess=e,this._error=r,a&&(this.requestTime=a.requestTime?i.CoreDate.from(a.requestTime):void 0,this.responseDuration=a.responseDuration?parseInt(a.responseDuration):void 0,this.responseTime=a.responseTime?i.CoreDate.from(a.responseTime):void 0,this.traceId=a.traceId)}get isSuccess(){return this._isSuccess}get isError(){return!this._isSuccess}get error(){if(this._isSuccess)throw new n.TransportError("Can't get the error of an succeeded result. Use 'value' instead.");return this._error}get value(){if(!this._isSuccess)throw this.error;return this._value}static fail(e,t){return new ClientResult(!1,void 0,e,t)}static ok(e,t){return new ClientResult(!0,e,void 0,t)}}t.ClientResult=ClientResult},4765:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Paginator=void 0;class Paginator{constructor(e,t,r,n){this.currentPage=e,this.paginationProperties=t,this.dataSource=r,this.progessCallback=n,this.currentItemIndex=0,this.processedItemCount=0,n&&n(0)}hasNext(){return this.hasNextPage()||this.currentItemIndex<this.currentPage.length}async next(){return this.currentItemIndex>=this.currentPage.length&&this.hasNextPage()&&(this.currentItemIndex=0,this.currentPage=await this.nextPage()),this.processedItemCount++,this.sendProgess(),this.currentPage[this.currentItemIndex++]}sendProgess(){if(this.progessCallback)return this.processedItemCount===this.paginationProperties.totalRecords?this.progessCallback(100):void(this.processedItemCount%10==0&&this.progessCallback(Math.round(this.processedItemCount/this.paginationProperties.totalRecords*100)))}hasNextPage(){return this.paginationProperties.pageNumber<this.paginationProperties.totalPages}async nextPage(){this.paginationProperties.pageNumber++;return await this.dataSource.getPage(this.paginationProperties.pageNumber)}async collect(){var e,t;const r=this.currentPage;for(null===(e=this.progessCallback)||void 0===e||e.call(this,this.pagePercentage);this.hasNextPage();)r.push(...await this.nextPage()),null===(t=this.progessCallback)||void 0===t||t.call(this,this.pagePercentage);return r}[Symbol.asyncIterator](){return{next:async()=>this.hasNext()?{value:await this.next(),done:!1}:{value:void 0,done:!0}}}get pagePercentage(){return Math.round(this.paginationProperties.pageNumber/this.paginationProperties.totalPages*100)}get totalRecords(){return this.paginationProperties.totalRecords}}t.Paginator=Paginator},8103:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClient=t.RESTClientLogDirective=t.RestPaginationDataSource=void 0;const i=r(2890),a=n(r(7218)),o=n(r(6230)),s=n(r(6486)),l=r(392),c=r(1732),u=r(8892),d=r(4765),p=r(8990);class RestPaginationDataSource{constructor(e,t,r){this.client=e,this.path=t,this.args=r}async getPage(e){return this.args.pageNumber=e,(await this.client.get(this.path,this.args)).value}}var h;t.RestPaginationDataSource=RestPaginationDataSource,function(e){e[e.LogNone=0]="LogNone",e[e.LogRequest=1]="LogRequest",e[e.LogResponse=2]="LogResponse",e[e.LogAll=3]="LogAll"}(h||(t.RESTClientLogDirective=h={}));class RESTClient{logRequest(){return this._logDirective===h.LogRequest||this._logDirective===h.LogAll}logResponse(){return this._logDirective===h.LogResponse||this._logDirective===h.LogAll}async generateRequestId(){return(await c.CoreId.generate("HTTP")).toString()}constructor(e,t={}){var n,i;this.config=e,this.requestConfig=t,this._logDirective=h.LogAll;const a={baseURL:e.baseUrl,timeout:this.config.platformTimeout,maxRedirects:this.config.platformMaxRedirects,maxContentLength:1/0,maxBodyLength:1/0,validateStatus:e=>e<300||400===e||404===e||500===e,paramsSerializer:{dots:!0,indexes:null}};this.config.platformAdditionalHeaders&&(a.headers=s.default.defaultsDeep({},a.headers,this.config.platformAdditionalHeaders));try{const e=null===(n=r(2890))||void 0===n?void 0:n.Agent,t=null===(i=r(2890))||void 0===i?void 0:i.Agent;void 0!==e&&void 0!==t&&(a.httpAgent=new e(this.config.httpAgent),a.httpsAgent=new t(this.config.httpsAgent))}catch(e){}this.requestConfig=s.default.defaultsDeep(this.requestConfig,a),this._logger=l.TransportLoggerFactory.getLogger(RESTClient)}createAxios(){const e=a.default.create(this.requestConfig);return this.config.debug&&this.addAxiosLoggingInterceptors(e),e}addAxiosLoggingInterceptors(e){e.interceptors.request.use((e=>{const t=e;return t.meta=e.meta||{},t.meta.startTime=(new Date).getTime(),e})),e.interceptors.response.use((e=>(logResponseTime(e),e)));const logResponseTime=e=>{const t=e.config.meta.startTime,r=e.headers["x-response-duration-ms"]?Number.parseInt(e.headers["x-response-duration-ms"]):void 0,n=`${e.config.method.toUpperCase()} ${e.request.path} (backbone call): ${r?`${r}ms`:"unknown"}`;r&&r>200?this._logger.warn(n):this._logger.debug(n);const i=(new Date).getTime()-t,a=r?i-r:void 0,o=`${e.config.method.toUpperCase()} ${e.request.path} (latency): ${a}ms`;this._logger.debug(o),this._logger.debug(`${e.config.method.toUpperCase()} ${e.request.path} (backbone call + latency): ${i}ms`)}}getResult(e,t,r,n){var a,o,s;const l=this.extractPlatformParameters(r);if(this._logResponse(r,l,n,e,t),400===r.status&&!(null===(a=r.data)||void 0===a?void 0:a.error)&&"application/json; charset=utf-8"===r.headers["content-type"])try{const e=i.CoreBuffer.from(r.data).toUtf8();r.data=JSON.parse(e)}catch(e){}if(null===(o=r.data)||void 0===o?void 0:o.error){const n=r.data.error,i=new p.RequestError(e,t,l,n.code,n.message,n.docs,r.status,n.time,{id:n.id,details:n.details});return this._logger.debug(i),u.ClientResult.fail(i,l)}if(204===r.status)return u.ClientResult.ok({},l);if(404===r.status){const r=new p.RequestError(e,t,l,"error.transport.request.notFound","An http request returned an unspecific 404 (Not Found) error, which is usually the case if the Backbone is not reachable. This could be a temporary problem, or a network, gateway, firewall or configuration issue.","",404);return this._logger.debug(r),u.ClientResult.fail(r,l)}if(r.status>=400&&r.status<=499){const n=new p.RequestError(e,t,l,"error.transport.request.badRequest","The platform responded with a Bad Request without giving any specific reason.","",r.status).setObject(r.data);return this._logger.debug(n),u.ClientResult.fail(n,l)}if("function"==typeof Buffer&&r.data instanceof Buffer||r.data instanceof ArrayBuffer)return u.ClientResult.ok(r.data,l);if(!(null===(s=r.data)||void 0===s?void 0:s.result)){const n=new p.RequestError(e,t,l,"error.transport.request.resultUndefined","The Platform responded without a result.").setObject(r.data);return this._logger.debug(n),u.ClientResult.fail(n,l)}return u.ClientResult.ok(r.data.result,l)}getPaginator(e,t,r,n,i){var a,o;const s=this.extractPlatformParameters(t);if(this._logResponse(t,s,r,"GET",e),null===(a=t.data)||void 0===a?void 0:a.error){const r=t.data.error,n=new p.RequestError("GET",e,s,r.code,r.message,r.docs,t.status,r.time,{id:r.id,details:r.details});return this._logger.debug(n),u.ClientResult.fail(n,s)}if(t.status>=400&&t.status<=499){const r=new p.RequestError("GET",e,s,"error.transport.request.badRequest","The platform responded with a Bad Request without giving any specific reason.","",t.status).setObject(t.data);return this._logger.debug(r),u.ClientResult.fail(r,s)}if(!(null===(o=t.data)||void 0===o?void 0:o.result)){const r=new p.RequestError("GET",e,s,"error.transport.request.resultUndefined","The Platform responded without a result.").setObject(t.data);return this._logger.debug(r),u.ClientResult.fail(r,s)}t.data.pagination||(t.data.pagination={pageNumber:1,pageSize:t.data.result.length,totalPages:1,totalRecords:t.data.result.length});const l=new RestPaginationDataSource(this,e,n),c=new d.Paginator(t.data.result,t.data.pagination,l,i);return u.ClientResult.ok(c,s)}async get(e,t={},r){const n=await this.generateRequestId(),i=s.default.defaultsDeep({params:t},r,this.requestConfig);if(this.logRequest()){const t=this;t._username?this._logger.trace(`Request ${n} by ${t._username}: GET ${e}`):this._logger.trace(`Request ${n}: GET ${e}`)}try{const t=await this.createAxios().get(e,i);return this.getResult("GET",e,t,n)}catch(t){const r=p.RequestError.fromAxiosError("GET",e,t,n);return this._logger.debug(r),u.ClientResult.fail(r)}}async getPaged(e,t={},r,n){const i=await this.generateRequestId(),a=s.default.defaultsDeep({params:t},r,this.requestConfig);try{const r=await this.createAxios().get(e,a);return this.getPaginator(e,r,i,t,n)}catch(t){const r=p.RequestError.fromAxiosError("GET",e,t,i);return this._logger.debug(r),u.ClientResult.fail(r)}}async post(e,t,r={},n){const i=await this.generateRequestId(),a=s.default.defaultsDeep({params:r},n,this.requestConfig);if(this.logRequest()){const r=this;r._username?this._logger.trace(`Request ${i} by ${r._username}: POST ${e}`,t):this._logger.trace(`Request ${i}: POST ${e}`,t)}try{const r=await this.createAxios().post(e,t,a);return this.getResult("POST",e,r,i)}catch(t){const r=p.RequestError.fromAxiosError("POST",e,t,i);return this._logger.debug(r),u.ClientResult.fail(r)}}async postMultipart(e,t,r){const n=await this.generateRequestId(),i=new o.default;for(const e in t)if(t.hasOwnProperty(e))if("content"===e.toLowerCase()){const r=t[e],n="undefined"!=typeof Buffer?Buffer.from(r):new Blob([r]);i.append(e,n,{filename:"cipher.bin"})}else i.append(e,t[e]);const a=s.default.defaultsDeep({},r,this.requestConfig);let l=i;if(void 0!==i.getHeaders){const e=i.getHeaders();a.headers=a.headers||{};for(const t in e)a.headers[t]=e[t];l=i.getBuffer()}if(this.logRequest()){const t=this;t._username?this._logger.trace(`Request ${n} by ${t._username}: POST-Upload ${e}`):this._logger.trace(`Request ${n}: POST-Upload ${e}`)}try{const t=await this.createAxios().post(e,l,a);return this.getResult("POST-Upload",e,t,n)}catch(t){const r=p.RequestError.fromAxiosError("POST-Upload",e,t,n);return this._logger.debug(r),u.ClientResult.fail(r)}}async put(e,t,r){const n=await this.generateRequestId(),i=s.default.defaultsDeep({},r,this.requestConfig);if(this.logRequest()){const r=this;r._username?this._logger.trace(`Request ${n} by ${r._username}: PUT ${e}`,t):this._logger.trace(`Request ${n}: PUT ${e}`,t)}try{const r=await this.createAxios().put(e,t,i);return this.getResult("PUT",e,r,n)}catch(t){const r=p.RequestError.fromAxiosError("PUT",e,t,n);return this._logger.debug(r),u.ClientResult.fail(r)}}async delete(e,t){const r=await this.generateRequestId(),n=s.default.defaultsDeep({},t,this.requestConfig);if(this.logRequest()){const t=this;t._username?this._logger.trace(`Request ${r} by ${t._username}: DELETE ${e}`):this._logger.trace(`Request ${r}: DELETE ${e}`)}try{const t=await this.createAxios().delete(e,n);return this.getResult("DELETE",e,t,r)}catch(t){const n=p.RequestError.fromAxiosError("DELETE",e,t,r);return this._logger.debug(n),u.ClientResult.fail(n)}}async download(e,t){const r=await this.generateRequestId(),n=s.default.defaultsDeep({},t,this.requestConfig);if(n.responseType="arraybuffer",this.logRequest()){const t=this;t._username?this._logger.trace(`Request ${r} by ${t._username}: GET-Download ${e}`):this._logger.trace(`Request ${r}: GET-Download ${e}`)}try{const t=await this.createAxios().get(e,n),i=this.extractPlatformParameters(t);return this._logResponse(t,i,r,"GET-Download",e),u.ClientResult.ok(t.data,this.extractPlatformParameters(t))}catch(t){const n=p.RequestError.fromAxiosError("GET-Download",e,t,r);return this._logger.debug(n),u.ClientResult.fail(n)}}extractPlatformParameters(e){return{requestTime:e.headers["x-request-time"],responseDuration:e.headers["x-response-duration-ms"],responseTime:e.headers["x-response-time"],traceId:e.headers["x-trace-id"]}}_logResponse(e,t,r,n,i){if(e.data&&this.logResponse()){const a=`Response ${r}: ${n} ${i} | TraceId: '${t.traceId}' | PlatformDuration: ${t.responseDuration}`;try{this._logger.trace(a,JSON.stringify(e.data,void 0,2))}catch(e){this._logger.trace(a)}}}}t.RESTClient=RESTClient},6054:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RESTClientAuthenticate=void 0;const i=n(r(6486)),a=r(8892),o=r(8990),s=r(8103);class RESTClientAuthenticate extends s.RESTClient{constructor(e,t,r={}){super(e,r),this.authenticator=t}async runAuthenticated(e){const t=await this.authenticator.getToken(),r=await e(t);if(!r.isError)return r;if(r.error instanceof o.RequestError&&401===r.error.status){this._logger.error("401 Authorization Error: ",r.error.message),this.authenticator.debugLog(this._logger),this.authenticator.clear();const t=await this.authenticator.getToken();return await e(t)}return a.ClientResult.fail(r.error)}async get(e,t="",r={}){return await this.runAuthenticated((async n=>await super.get(e,t,this.buildAuthenticatedConfig(n,r))))}async getPaged(e,t={},r={},n){return await this.runAuthenticated((async i=>await super.getPaged(e,t,this.buildAuthenticatedConfig(i,r),n)))}async post(e,t,r={},n={}){return await this.runAuthenticated((async i=>await super.post(e,t,r,this.buildAuthenticatedConfig(i,n))))}async postMultipart(e,t,r={}){return await this.runAuthenticated((async n=>await super.postMultipart(e,t,this.buildAuthenticatedConfig(n,r))))}async put(e,t,r={}){return await this.runAuthenticated((async n=>await super.put(e,t,this.buildAuthenticatedConfig(n,r))))}async delete(e,t={}){return await this.runAuthenticated((async r=>await super.delete(e,this.buildAuthenticatedConfig(r,t))))}async download(e,t={}){return await this.runAuthenticated((async r=>await super.download(e,this.buildAuthenticatedConfig(r,t))))}buildAuthenticatedConfig(e,t){return i.default.defaultsDeep({headers:{Authorization:`Bearer ${e}`}},t)}}t.RESTClientAuthenticate=RESTClientAuthenticate},8990:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RequestError=void 0;const i=r(5172),a=n(r(4530)),o=r(4062);class RequestError extends i.ApplicationError{constructor(e,t,r,n="error.platform.unexpected",i="Platform operation failed unexpectedly.",a="",s=500,l=o.CoreDate.utc().toISOString(),c){super(n,""),this.method=e,this.path=t,this.platformParameters=r,this.reason=i,this.requestId=a,this.status=s,this.time=l,this.object=c;let u=n;s&&(u+=` (${s})`),i&&(u+=`: '${i}'`),u+=` for ${e} ${t}`,l&&(u+=` at ${l}`),r&&(u+=` with traceId '${r.traceId}'`),super.message=u}setObject(e){return this.object=e,this}toString(){return`${this.name}\n${(0,a.default)(this.object)}\n${this.stack}`}static cleanAxiosError(e){const t=e.toJSON();return delete t.config.adapter,delete t.config.data,delete t.config.headers.Authorization,delete t.config.httpAgent,delete t.config.httpsAgent,delete t.config.transformRequest,delete t.config.transformResponse,delete t.config.validateStatus,delete t.request,delete t.response,t}static fromAxiosError(e,t,r,n,i){try{if(!r.isAxiosError){const n=new RequestError(e,t,i,"error.transport.request.unknown",r.message);return n.stack=r.stack,n}if(!r.response){let n="error.transport.request.unknown",a=500,o=r.message;switch(r.code){case"ERR_FR_MAX_BODY_LENGTH_EXCEEDED":n="error.transport.request.bodyLengthExceeded",a=413;break;case"ECONNABORTED":n="error.transport.request.aborted";break;default:"Network Error"===r.message?(n="error.transport.request.network",o="It seems the platform was available but another network error happened. It could also be a CORS problem."):r.message.includes("ENOTFOUND")&&(n="error.transport.request.addressNotFound")}return new RequestError(e,t,i,n,o,"",a).setObject(this.cleanAxiosError(r))}return 401===r.response.status?new RequestError(e,t,i,"error.platform.unauthorized","Unauthorized.",n,r.response.status).setObject(this.cleanAxiosError(r)):new RequestError(e,t,i,"error.platform.unexpected","Received invalid error content from platform. Contact the platform team.",n,r.response.status).setObject(this.cleanAxiosError(r))}catch(r){return new RequestError(e,t,i,"error.platform.unexpected","An error occured while handling an axios error",n).setObject(r)}}}t.RequestError=RequestError},6699:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4381),t),i(r(9867),t),i(r(8892),t),i(r(4765),t),i(r(8990),t),i(r(8103),t),i(r(6054),t)},2027:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(6699),t),i(r(4093),t),i(r(8147),t),i(r(6555),t),i(r(3289),t),i(r(6904),t),i(r(2970),t),i(r(6564),t),i(r(1341),t),i(r(5796),t),i(r(1201),t),i(r(8925),t),i(r(2685),t),i(r(981),t),i(r(2508),t),i(r(1796),t),i(r(8169),t),i(r(392),t),i(r(1732),t)},7875:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreAddress=void 0;const a=r(194),o=r(6904);let s=class CoreAddress extends o.CoreSerializable{static preFrom(e){return"string"==typeof e?{address:e}:e}static from(e){return this.fromAny(e)}equals(e){return void 0!==e&&this.address===e.toString()}toString(){return this.address}serialize(){return this.address}};t.CoreAddress=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"address",void 0),t.CoreAddress=s=n([(0,a.type)("CoreAddress"),(0,a.serializeOnly)("address","string")],s)},4062:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreDate=void 0;const o=r(194),s=r(8565),l=r(6904),c=r(1796);let u=n=class CoreDate extends l.CoreSerializable{get dateTime(){return this._dateTime}get date(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISODate()}constructor(e=s.DateTime.utc()){super(),this._dateTime=e}static utc(){return new n(s.DateTime.utc())}static local(){return new n(s.DateTime.local())}equals(e){return this.dateTime.equals(e.dateTime)}add(e){return new n(this.dateTime.plus(e))}subtract(e){return new n(this.dateTime.minus(e))}startOf(e){return new n(this.dateTime.startOf(e))}endOf(e){return new n(this.dateTime.endOf(e))}format(e){return this.dateTime.toFormat(e)}isWithin(e,t,r,i){void 0===t&&(t=e),void 0===r&&(r=n.utc());const a=r.subtract(e),o=r.add(t);return void 0!==i?this.dateTime.startOf(i)>a.dateTime.startOf(i)&&this.dateTime.startOf(i)<o.dateTime.startOf(i):this.dateTime>a.dateTime&&this.dateTime<o.dateTime}isBefore(e,t){return void 0!==t?this.dateTime.startOf(t)<e.dateTime.startOf(t):this.dateTime<e.dateTime}isAfter(e,t){return void 0!==t?this.dateTime.startOf(t)>e.dateTime.startOf(t):this.dateTime>e.dateTime}isSame(e,t){return void 0!==t?this.dateTime.startOf(t).valueOf()===e.dateTime.startOf(t).valueOf():this.dateTime.valueOf()===e.dateTime.valueOf()}isSameOrAfter(e,t){return void 0!==t?this.dateTime.startOf(t)>=e.dateTime.startOf(t):this.dateTime>=e.dateTime}isSameOrBefore(e,t){return void 0!==t?this.dateTime.startOf(t)<=e.dateTime.startOf(t):this.dateTime<=e.dateTime}isBetween(e,t,r){return t?s.Interval.fromDateTimes(e.dateTime,t.dateTime).contains(this.dateTime):this.isAfter(e,r)}isExpired(){return this.isSameOrBefore(n.utc())}compare(e){return this.dateTime.valueOf()-e.dateTime.valueOf()}toString(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISO()}toISOString(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISO()}toLocaleString(){return this.dateTime.toLocaleString()}toJSON(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISO()}serialize(){if(!this.dateTime.isValid)throw new c.TransportError("The date is invalid.");return this.dateTime.toISO()}static preFrom(e){if(void 0===e)throw new c.TransportError("The provided object is undefined and cannot be deserialized.");if("object"==typeof e){if(void 0===e.date){if("function"!=typeof e.toISOString)throw new c.TransportError("The provided object doesn't have an 'toISOString' string method.");const t=e.toISOString();return s.DateTime.fromISO(t,{zone:"utc"})}return s.DateTime.fromISO(e.date,{zone:"utc"})}if("number"==typeof e)return s.DateTime.fromMillis(e);if("string"==typeof e)return s.DateTime.fromISO(e,{zone:"utc"}).toUTC();throw new c.TransportError("The provided object is invalid cannot be deserialized.")}static from(e){return this.fromAny(e)}};t.CoreDate=u,t.CoreDate=u=n=i([(0,o.type)("CoreDate"),a("design:paramtypes",[s.DateTime])],u)},2186:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreHash=void 0;const o=r(194),s=r(2890),l=r(6904);let c=n=class CoreHash extends l.CoreSerializable{toString(){return this.hash}static async hash(e,t=2){const r=await s.CryptoHash.hash(s.CoreBuffer.fromString(e,s.Encoding.Base64_UrlSafe_NoPadding),t);return n.from(r.toBase64())}async verify(e,t=2){return await s.CryptoHash.verify(e,s.CoreBuffer.fromString(this.hash,s.Encoding.Base64_UrlSafe_NoPadding),t)}static preFrom(e){return"string"==typeof e?{hash:e}:e}static from(e){return this.fromAny(e)}serialize(){return this.hash}toBase64(){return this.hash}};t.CoreHash=c,i([(0,o.validate)(),(0,o.serialize)(),a("design:type",String)],c.prototype,"hash",void 0),t.CoreHash=c=n=i([(0,o.serializeOnly)("hash","string")],c)},9170:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreId=void 0;const a=r(194),o=r(5833),s=r(6904),l=r(1796);let c=class CoreId extends s.CoreSerializable{toString(){return this.id}equals(e){return this.id===e.toString()}static async generate(e=""){if(e.length>6)throw new l.TransportError(`The prefix "${e}" is too long. It must not be longer than 6 characters.`);const t=await o.Random.string(20-e.length,o.RandomCharacterRange.Alphanumeric);return this.from(e.toUpperCase()+t)}static from(e){return this.fromAny(e)}static preFrom(e){return"string"==typeof e?{id:e}:e}serialize(){return this.id}};t.CoreId=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"id",void 0),t.CoreId=c=n([(0,a.type)("CoreId"),(0,a.serializeOnly)("id","string")],c)},819:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TransportVersion=void 0,function(e){e.Latest="1",e.V1="1"}(r||(t.TransportVersion=r={}))},1732:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7875),t),i(r(4062),t),i(r(2186),t),i(r(9170),t),i(r(819),t)},9391:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageDeliveredEvent=void 0;const n=r(2278);class MessageDeliveredEvent extends n.TransportDataEvent{constructor(e,t){super(MessageDeliveredEvent.namespace,e,t)}}t.MessageDeliveredEvent=MessageDeliveredEvent,MessageDeliveredEvent.namespace="transport.messageDelivered"},9461:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageReceivedEvent=void 0;const n=r(2278);class MessageReceivedEvent extends n.TransportDataEvent{constructor(e,t){super(MessageReceivedEvent.namespace,e,t)}}t.MessageReceivedEvent=MessageReceivedEvent,MessageReceivedEvent.namespace="transport.messageReceived"},9771:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageSentEvent=void 0;const n=r(2278);class MessageSentEvent extends n.TransportDataEvent{constructor(e,t){super(MessageSentEvent.namespace,e,t)}}t.MessageSentEvent=MessageSentEvent,MessageSentEvent.namespace="transport.messageSent"},8e3:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PeerRelationshipTemplateLoadedEvent=void 0;const n=r(2278);class PeerRelationshipTemplateLoadedEvent extends n.TransportDataEvent{constructor(e,t){super(PeerRelationshipTemplateLoadedEvent.namespace,e,t)}}t.PeerRelationshipTemplateLoadedEvent=PeerRelationshipTemplateLoadedEvent,PeerRelationshipTemplateLoadedEvent.namespace="transport.peerRelationshipTemplateLoaded"},9697:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangedEvent=void 0;const n=r(2278);class RelationshipChangedEvent extends n.TransportDataEvent{constructor(e,t){super(RelationshipChangedEvent.namespace,e,t)}}t.RelationshipChangedEvent=RelationshipChangedEvent,RelationshipChangedEvent.namespace="transport.relationshipChanged"},2278:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransportDataEvent=void 0;const n=r(5172);class TransportDataEvent extends n.DataEvent{constructor(e,t,r){super(e,r),this.eventTargetAddress=t}}t.TransportDataEvent=TransportDataEvent},2205:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(9391),t),i(r(9461),t),i(r(9771),t),i(r(8e3),t),i(r(9697),t),i(r(2278),t)},5590:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(2500),t),i(r(2027),t),i(r(2205),t),i(r(9662),t),i(r(2212),t)},7024:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.AccountController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(4093),c=r(369),u=r(392),d=r(4381),p=r(2212),h=r(1615),y=r(2723),g=r(8324),m=r(9626),v=r(7896),b=r(2556),w=r(4980),C=r(8382),S=r(6961),_=r(6453),R=r(413),O=r(6758),T=r(9777),I=r(5832),E=r(2343),D=r(3654),P=r(3666),A=r(5739),j=r(307),M=r(1295),x=r(26),k=r(4503),L=r(6346),F=r(761),N=r(5366),z=r(2016);class AccountController{get authenticator(){return this._authenticator}get log(){return this._log}get config(){return this._config}get db(){return this._db}get transport(){return this._transport}get activeDevice(){if(!this._activeDevice)throw new s.TransportError("The DeviceController is not initialized yet.");return this._activeDevice}get activeDeviceOrUndefined(){return this._activeDevice}get identity(){return this._identity}constructor(e,t,r,n={}){this._transport=e,this._db=t,this._config=r,this.dependencyOverrides=n,this._dbClosed=!1,this.autoSync=!0,this._authenticator=new d.Authenticator(this),this._log=u.TransportLoggerFactory.getLogger(s.ControllerName.Account)}async init(e){this.info=await this.db.getMap("AccountInfo"),this.unpushedDatawalletModifications=await this.db.getCollection(c.DbCollectionName.UnpushedDatawalletModifications),this.deviceClient=new S.DeviceClient(this.config),this.identityClient=new N.IdentityClient(this.config),this._identity=new L.IdentityController(this),this._activeDevice=new v.DeviceController(this),this.challenges=await new m.ChallengeController(this).init();const[t,r,n]=await Promise.all([this.info.get("identity"),this.info.get("device"),this.info.get("baseKey")]);let i,a=!1,l=!1;if(t||r){if(e||!t||!r)throw new s.TransportError("The combination of deviceSharedSecret, existing identity or device is not allowed.");{if(!n)throw s.CoreErrors.secrets.secretNotFound("BaseKey");const e=z.Identity.from(t),i=_.Device.from(r),a=o.CryptoSecretKey.fromJSON(n);await this.identity.init(e),await this.activeDevice.init(a,i),this.deviceAuthClient=new C.DeviceAuthClient(this.config,this.authenticator)}}else if(e)i=await this.onboardDevice(e),l=!0;else{this._log.trace("No account information found. Creating new account...");a=!0,i=(await this.createIdentityAndDevice()).device,this.deviceAuthClient=new C.DeviceAuthClient(this.config,this.authenticator)}return this._log.trace(`Using device ${this.activeDevice.id} for identity ${this.identity.address}.`),await this.initControllers(),a?(await this.devices.addExistingDevice(i),await this.synchronization.setInititalDatawalletVersion(this._config.supportedDatawalletVersion)):l&&(await this.syncDatawallet(),await this.devices.update(i)),await this.syncDatawallet(),this}async close(){this._dbClosed||(this._log.trace(`Closing DB for account ${this.identity.identity.address.toString()}.`),await this._db.close(),this._dbClosed=!0)}async initControllers(){this._log.trace("Initializing controllers..."),this.relationshipSecrets=await new D.RelationshipSecretController(this).init(),this.devices=await new w.DevicesController(this).init(),this.certificates=await new h.CertificateController(this).init(),this.certificateIssuer=await new y.CertificateIssuer(this).init(),this.certificateValidator=await new g.CertificateValidator(this).init(),this.files=await new T.FileController(this).init(),this.relationships=await new P.RelationshipsController(this,this.relationshipSecrets).init(),this.relationshipTemplates=await new E.RelationshipTemplateController(this,this.relationshipSecrets).init(),this.messages=await new I.MessageController(this).init(),this.tokens=await new k.TokenController(this).init(),this.synchronization=await new M.SyncController(this,this.dependencyOverrides,this.unpushedDatawalletModifications,this.config.datawalletEnabled).init(),this._log.trace("Initialization of controllers finished.")}disableAutoSync(){this.autoSync=!1}async enableAutoSync(){this.autoSync=!0,await this.syncDatawallet()}async syncDatawallet(e=!1,t){if(!e&&!this.autoSync)return;const r=j.SyncProgressReporter.fromCallback(t);return await this.synchronization.sync("OnlyDatawallet",r)}async syncEverything(e){const t=j.SyncProgressReporter.fromCallback(e);return await this.synchronization.sync("Everything",t)}async getLastCompletedSyncTime(){return await this.synchronization.getLastCompletedSyncTime()}async getLastCompletedDatawalletSyncTime(){return await this.synchronization.getLastCompletedDatawalletSyncTime()}async createIdentityAndDevice(){const[e,t,r,n,i]=await Promise.all([l.CoreCrypto.generateSignatureKeypair(),p.PasswordGenerator.createStrongPassword(45,50),l.CoreCrypto.generateSignatureKeypair(),l.CoreCrypto.generateSecretKey(),l.CoreCrypto.generateSecretKey()]);this._log.trace("Created keys. Requesting challenge...");const a=await this.challenges.createAccountCreationChallenge(e);this._log.trace("Challenge signed. Creating device...");const[o,c,u,d]=await Promise.all([this.identityClient.createIdentity({devicePassword:t,identityPublicKey:e.publicKey.toBase64(),signedChallenge:a.toJSON(!1),clientId:this._config.platformClientId,clientSecret:this._config.platformClientSecret,identityVersion:this._config.supportedIdentityVersion}),l.CoreCrypto.generateSecretKey(),F.IdentityUtil.createAddress(e.publicKey,this._config.realm),this.fetchDeviceInfo()]);if(o.isError){if("error.platform.unauthorized"===o.error.code)throw s.CoreErrors.general.platformClientInvalid()}const h=o.value;if(this._log.trace(`Registered identity with address ${h.address}, device id is ${h.device.id}.`),!u.equals(h.address))throw new s.TransportError("The backbone address does not match the local address.");const y=z.Identity.from({address:s.CoreAddress.from(h.address),realm:this._config.realm,publicKey:e.publicKey}),g=s.CoreId.from(h.device.id),m=_.Device.from({createdAt:s.CoreDate.from(h.createdAt),createdByDevice:g,id:g,description:"",name:"Device 1",lastLoginAt:s.CoreDate.utc(),operatingSystem:d.operatingSystem,publicKey:r.publicKey,type:d.type,certificate:"",username:h.device.username,datawalletVersion:this._config.supportedDatawalletVersion});await this.identity.init(y),await this.activeDevice.init(i,m);const v=R.DeviceSecretCredentials.from({id:m.id,username:h.device.username,password:t});return await Promise.all([this.info.set("device",m.toJSON()),this.info.set("identity",y.toJSON()),this.info.set("baseKey",i.toJSON()),this.activeDevice.secrets.storeSecret(n,b.DeviceSecretType.SharedSecretBaseKey),this.activeDevice.secrets.storeSecret(c,b.DeviceSecretType.IdentitySynchronizationMaster),this.activeDevice.secrets.storeSecret(e.privateKey,b.DeviceSecretType.IdentitySignature),this.activeDevice.secrets.storeSecret(r.privateKey,b.DeviceSecretType.DeviceSignature),this.activeDevice.secrets.storeSecret(v,b.DeviceSecretType.DeviceCredentials)]),{identity:y,device:m}}async onboardDevice(e){this._log.trace("Onboarding device for existing identity...");const[t,r,n,i]=await Promise.all([p.PasswordGenerator.createStrongPassword(45,50),l.CoreCrypto.generateSignatureKeypair(),this.fetchDeviceInfo(),l.CoreCrypto.generateSecretKey()]),a=_.Device.from({id:e.id,name:e.name?e.name:"",description:e.description?e.name:"",lastLoginAt:s.CoreDate.utc(),createdAt:e.createdAt,createdByDevice:e.createdByDevice,operatingSystem:n.operatingSystem,type:n.type,publicKey:r.publicKey,username:e.username,initialPassword:void 0,isAdmin:!!e.identityPrivateKey});await this.identity.init(e.identity),await this.activeDevice.init(i,a);const o=R.DeviceSecretCredentials.from({id:e.id,username:e.username,password:e.password});return await Promise.all([this.info.set("device",a.toJSON()),this.info.set("identity",e.identity.toJSON()),this.info.set("baseKey",i.toJSON()),this.info.set(A.SecretController.secretNonceKey,1e6*e.deviceIndex),this.activeDevice.secrets.storeSecret(e.secretBaseKey,b.DeviceSecretType.SharedSecretBaseKey),this.activeDevice.secrets.storeSecret(e.synchronizationKey,b.DeviceSecretType.IdentitySynchronizationMaster),this.activeDevice.secrets.storeSecret(r.privateKey,b.DeviceSecretType.DeviceSignature),this.activeDevice.secrets.storeSecret(o,b.DeviceSecretType.DeviceCredentials)]),e.identityPrivateKey&&await this.activeDevice.secrets.storeSecret(e.identityPrivateKey,b.DeviceSecretType.IdentitySignature),this.deviceAuthClient=new C.DeviceAuthClient(this.config,this.authenticator),await this.activeDevice.changePassword(t),a}async registerPushNotificationToken(e){await this.deviceAuthClient.registerPushNotificationToken(e)}fetchDeviceInfo(){return Promise.resolve({operatingSystem:"",type:_.DeviceType.Unknown})}async getSynchronizedCollection(e){const t=await this.db.getCollection(e);return this.config.datawalletEnabled?new x.SynchronizedCollection(t,this.config.supportedDatawalletVersion,this.unpushedDatawalletModifications):new x.SynchronizedCollection(t,this.config.supportedDatawalletVersion)}}t.AccountController=AccountController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[O.DeviceSharedSecret]),i("design:returntype",Promise)],AccountController.prototype,"init",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",Promise)],AccountController.prototype,"createIdentityAndDevice",null)},6346:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(2556),c=r(2016);class IdentityController extends s.TransportController{get address(){return this._identity.address}get publicKey(){return this._identity.publicKey}get realm(){return this._identity.realm}get identity(){return this._identity}constructor(e){super(s.ControllerName.Identity,e)}async init(e){return await super.init(),this._identity=e,this}isMe(e){return this.address.equals(e)}async update(){await this.parent.info.set("identity",this.identity)}async sign(e){const t=await this.parent.activeDevice.secrets.loadSecret(l.DeviceSecretType.IdentitySignature);if(!(t&&t.secret instanceof o.CryptoSignaturePrivateKey))throw s.CoreErrors.secrets.secretNotFound(l.DeviceSecretType.IdentitySignature);const r=t.secret,n=await s.CoreCrypto.sign(e,r);return r.clear(),n}async verify(e,t){return await s.CoreCrypto.verify(e,t,this.publicKey)}}t.IdentityController=IdentityController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[c.Identity]),i("design:returntype",Promise)],IdentityController.prototype,"init",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[o.CoreBuffer]),i("design:returntype",Promise)],IdentityController.prototype,"sign",null)},761:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityUtil=void 0;const n=r(2890),i=r(2027);t.IdentityUtil=class IdentityUtil{static async createAddress(e,t){if(3!==t.length)throw i.CoreErrors.general.realmLength();const r=await n.CryptoHash.hash(e.publicKey,2),a=await n.CryptoHash.hash(r,1),o=new n.CoreBuffer(a.buffer.slice(0,20)),s=n.CoreBuffer.fromUtf8(t);s.append(o);const l=await n.CryptoHash.hash(s,2),c=await n.CryptoHash.hash(l,1),u=new n.CoreBuffer(c.buffer.slice(0,4)),d=o;d.append(u);const p=t+d.toBase58();return i.CoreAddress.from({address:p})}static async checkAddress(e,t,r="id1"){const i=e.toString(),a=i.substr(0,3);if(r&&a!==r)return!1;const o=i.substr(3),s=n.CoreBuffer.fromBase58(o).buffer,l=s.slice(0,s.byteLength-4),c=s.slice(s.byteLength-4,s.byteLength),u=n.CoreBuffer.fromUtf8(a);u.append(new n.CoreBuffer(l));const d=await n.CryptoHash.hash(u,2),p=await n.CryptoHash.hash(d,1);if(!new n.CoreBuffer(p.buffer.slice(0,4)).equals(new n.CoreBuffer(c)))return!1;if(t){const e=await n.CryptoHash.hash(t.publicKey,2);let r=await n.CryptoHash.hash(e,1);if(r=new n.CoreBuffer(r.buffer.slice(0,20)),!r.equals(new n.CoreBuffer(l)))return!1}return!0}}},5366:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityClient=void 0;const n=r(2027);class IdentityClient extends n.RESTClient{constructor(){super(...arguments),this._logDirective=n.RESTClientLogDirective.LogResponse}async createIdentity(e){return await this.post("/api/v1/Identities",e,{})}}t.IdentityClient=IdentityClient},2016:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Identity=t.Realm=void 0;const a=r(194),o=r(2890),s=r(6904),l=r(7875);var c;!function(e){e.Dev="dev",e.Stage="id0",e.Prod="id1"}(c||(t.Realm=c={}));let u=class Identity extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.Identity=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreAddress)],u.prototype,"address",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignaturePublicKey)],u.prototype,"publicKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],u.prototype,"realm",void 0),t.Identity=u=n([(0,a.type)("Identity")],u)},1615:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateController=void 0;const n=r(2027);class CertificateController extends n.TransportController{constructor(e){super(n.ControllerName.Certificate,e)}}t.CertificateController=CertificateController},2723:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateContentParam=t.CertificateIssuer=void 0;const n=r(2890),i=r(2027),a=r(369),o=r(365),s=r(4507);class CertificateIssuer extends i.TransportController{constructor(e){super(i.ControllerName.CertificateIssuer,e)}async init(){return await super.init(),this.certificatesIssued=await this.db.getCollection(a.DbCollectionName.CertificatesIssued),this}async issueCertificate(e){const t=s.CertificateContent.from(e).serialize(),r=n.CoreBuffer.fromUtf8(t),i=await this.parent.identity.sign(r);return o.Certificate.from({content:t,signature:i})}}t.CertificateIssuer=CertificateIssuer;t.CertificateContentParam=class CertificateContentParam{constructor(){this.issuedAt=i.CoreDate.utc()}}},8324:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateValidator=void 0;const n=r(2027);class CertificateValidator extends n.TransportController{constructor(e){super(n.ControllerName.CertificateValidator,e)}}t.CertificateValidator=CertificateValidator},365:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Certificate=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class Certificate extends s.CoreSerializable{static from(e){return this.fromAny(e)}async verify(e){const t=o.CoreBuffer.fromUtf8(this.content);return await s.CoreCrypto.verify(t,this.signature,e)}};t.Certificate=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"signature",void 0),t.Certificate=l=n([(0,a.type)("Certificate")],l)},8951:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateConstraint=void 0;const i=r(194),a=r(2027);let o=class CertificateConstraint extends a.CoreSerializable{static from(e){return this.fromAny(e)}};t.CertificateConstraint=o,t.CertificateConstraint=o=n([(0,i.type)("CertificateConstraint")],o)},4507:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateContent=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(8951),c=r(7584);let u=class CertificateContent extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.CertificateContent=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreDate)],u.prototype,"issuedAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreAddress)],u.prototype,"issuer",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreSerializable)],u.prototype,"issuerData",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreAddress)],u.prototype,"subject",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignaturePublicKey)],u.prototype,"subjectPublicKey",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.CertificateConstraint}),i("design:type",Array)],u.prototype,"constraints",void 0),n([(0,a.validate)(),(0,a.serialize)({type:c.CertificateItem}),i("design:type",Array)],u.prototype,"items",void 0),t.CertificateContent=u=n([(0,a.type)("CertificateContent")],u)},7584:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateItem=void 0;const i=r(194),a=r(2027);let o=class CertificateItem extends a.CoreSerializable{static from(e){return this.fromAny(e)}};t.CertificateItem=o,t.CertificateItem=o=n([(0,i.type)("CertificateItem")],o)},1949:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateBorderConstraint=void 0;const a=r(194),o=r(8951);let s=class CertificateBorderConstraint extends o.CertificateConstraint{static from(e){return this.fromAny(e)}};t.CertificateBorderConstraint=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"union",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"country",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"state",void 0),t.CertificateBorderConstraint=s=n([(0,a.type)("CertificateBorderConstraint")],s)},8176:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateCityConstraint=void 0;const a=r(194),o=r(8951);let s=class CertificateCityConstraint extends o.CertificateConstraint{static from(e){return this.fromAny(e)}};t.CertificateCityConstraint=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"district",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"city",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"zipCode",void 0),t.CertificateCityConstraint=s=n([(0,a.type)("CertificateCityConstraint")],s)},6578:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateIdentityConstraint=void 0;const a=r(194),o=r(2027),s=r(8951);let l=class CertificateIdentityConstraint extends s.CertificateConstraint{static from(e){return this.fromAny(e)}};t.CertificateIdentityConstraint=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],l.prototype,"identity",void 0),t.CertificateIdentityConstraint=l=n([(0,a.type)("CertificateIdentityConstraint")],l)},4220:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateTimeConstraint=void 0;const a=r(194),o=r(2027),s=r(8951);let l=class CertificateTimeConstraint extends s.CertificateConstraint{static from(e){return this.fromAny(e)}};t.CertificateTimeConstraint=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"validFrom",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"validTo",void 0),t.CertificateTimeConstraint=l=n([(0,a.type)("CertificateTimeConstraint")],l)},3327:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateAuthorizationItem=void 0;const a=r(194),o=r(7584);let s=class CertificateAuthorizationItem extends o.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificateAuthorizationItem=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"authorization",void 0),t.CertificateAuthorizationItem=s=n([(0,a.type)("CertificateAuthorizationItem")],s)},7376:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateDelegateItem=t.CertificateDelegateType=void 0;const a=r(194),o=r(7584);var s;!function(e){e.Clone="clone",e.Custodian="custodian",e.Sign="sign",e.Ppa="ppa",e.Communication="communication"}(s||(t.CertificateDelegateType=s={}));let l=class CertificateDelegateItem extends o.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificateDelegateItem=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"type",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],l.prototype,"content",void 0),t.CertificateDelegateItem=l=n([(0,a.type)("CertificateDelegateItem")],l)},8579:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificatePrivateAttributeItem=void 0;const a=r(194),o=r(1732),s=r(7584);let l=class CertificatePrivateAttributeItem extends s.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificatePrivateAttributeItem=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreHash)],l.prototype,"hash",void 0),t.CertificatePrivateAttributeItem=l=n([(0,a.type)("CertificatePrivateAttributeItem")],l)},3727:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificatePrivateAttributeItemSource=void 0;const a=r(194),o=r(1732),s=r(7584);let l=class CertificatePrivateAttributeItemSource extends s.CertificateItem{async hash(){return await o.CoreHash.hash(`${this.nonce}|${this.name}|${this.value}`)}static from(e){return this.fromAny(e)}};t.CertificatePrivateAttributeItemSource=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"nonce",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"name",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"value",void 0),t.CertificatePrivateAttributeItemSource=l=n([(0,a.type)("CertificatePrivateAttributeItem")],l)},9745:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificatePublicAttributeItem=void 0;const a=r(194),o=r(7584);let s=class CertificatePublicAttributeItem extends o.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificatePublicAttributeItem=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"name",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"value",void 0),t.CertificatePublicAttributeItem=s=n([(0,a.type)("CertificatePublicAttributeItem")],s)},1430:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CertificateRoleItem=void 0;const a=r(194),o=r(7584);let s=class CertificateRoleItem extends o.CertificateItem{static from(e){return this.fromAny(e)}};t.CertificateRoleItem=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],s.prototype,"role",void 0),t.CertificateRoleItem=s=n([(0,a.type)("CertificateRoleItem")],s)},9626:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ChallengeController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(2508),c=r(2182),u=r(3122),d=r(1772),p=r(9643),h=r(4621);class ChallengeController extends l.TransportController{constructor(e){super(l.ControllerName.Challenge,e)}async init(){return await super.init(),this.client=new d.ChallengeClient(this.config),this.authClient=new u.ChallengeAuthClient(this.config,this.parent.authenticator),this}async validateChallengeLocally(e,t){if(!e.createdBy)return{isValid:!1};const r=await this.parent.relationships.getActiveRelationshipToIdentity(e.createdBy);if(!r)throw s.CoreErrors.general.recordNotFound(c.Relationship,e.createdBy.toString());const n=o.CoreBuffer.fromUtf8(t.challenge);let i=!1;switch(e.type){case p.ChallengeType.Identity:i=await this.parent.relationships.verifyIdentity(r,n,t.signature);break;case p.ChallengeType.Device:throw s.CoreErrors.general.notSupported();case p.ChallengeType.Relationship:i=await this.parent.relationships.verify(r,n,t.signature)}return i?{isValid:!0,correspondingRelationship:r}:{isValid:!1}}async validateChallenge(e,t){const r=p.Challenge.deserialize(e.challenge);if(t&&r.type!==t)return{isValid:!1};if(r.expiresAt.isExpired())return{isValid:!1};const n=await this.authClient.getChallenge(r.id.toString());return n.isError||n.value.id!==r.id.toString()||r.createdBy&&n.value.createdBy!==r.createdBy.toString()?{isValid:!1}:await this.validateChallengeLocally(r,e)}async createAccountCreationChallenge(e){const t=(await this.client.createChallenge()).value,r=p.Challenge.from({id:s.CoreId.from(t.id),expiresAt:s.CoreDate.from(t.expiresAt),type:p.ChallengeType.Identity}).serialize(!1),n=o.CoreBuffer.fromUtf8(r),i=await s.CoreCrypto.sign(n,e.privateKey);return h.ChallengeSigned.from({challenge:r,signature:i})}async createChallenge(e=p.ChallengeType.Identity,t){if(e===p.ChallengeType.Relationship&&!t)throw s.CoreErrors.challenges.challengeTypeRequiresRelationship();const r=(await this.authClient.createChallenge()).value,n=p.Challenge.from({id:s.CoreId.from(r.id),expiresAt:s.CoreDate.from(r.expiresAt),createdBy:r.createdBy?s.CoreAddress.from(r.createdBy):void 0,createdByDevice:r.createdByDevice?s.CoreId.from(r.createdByDevice):void 0,type:e}).serialize(!1),i=o.CoreBuffer.fromUtf8(n);let a;switch(e){case p.ChallengeType.Identity:a=await this.parent.identity.sign(i);break;case p.ChallengeType.Device:a=await this.parent.activeDevice.sign(i);break;case p.ChallengeType.Relationship:a=await this.parent.relationships.sign(t,i)}return h.ChallengeSigned.from({challenge:n,signature:a})}}t.ChallengeController=ChallengeController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[p.Challenge,h.ChallengeSigned]),i("design:returntype",Promise)],ChallengeController.prototype,"validateChallengeLocally",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,c.Relationship]),i("design:returntype",Promise)],ChallengeController.prototype,"createChallenge",null)},3122:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChallengeAuthClient=void 0;const n=r(6054);class ChallengeAuthClient extends n.RESTClientAuthenticate{async createChallenge(){return await this.post("/api/v1/Challenges",{})}async getChallenge(e){return await this.get(`/api/v1/Challenges/${e}`)}}t.ChallengeAuthClient=ChallengeAuthClient},1772:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChallengeClient=void 0;const n=r(2027);class ChallengeClient extends n.RESTClient{async createChallenge(){return await this.post("/api/v1/Challenges",{})}}t.ChallengeClient=ChallengeClient},9643:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Challenge=t.ChallengeType=void 0;const a=r(194),o=r(2027);var s;!function(e){e.Identity="Identity",e.Device="Device",e.Relationship="Relationship"}(s||(t.ChallengeType=s={}));let l=class Challenge extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.Challenge=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],l.prototype,"id",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"expiresAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreAddress)],l.prototype,"createdBy",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreId)],l.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"type",void 0),t.Challenge=l=n([(0,a.type)("Challenge")],l)},4621:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ChallengeSigned=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class ChallengeSigned extends s.CoreSerializable{static from(e){return this.fromAny(e)}static fromJSON(e){const t=o.CryptoSignature.fromBase64(e.signature);return this.from({signature:t,challenge:e.challenge})}toJSON(e=!0){const t={challenge:this.challenge,signature:this.signature.toBase64()};return e&&(t["@type"]="ChallengeSigned"),t}};t.ChallengeSigned=l,n([(0,a.validate)(),(0,a.serialize)({enforceString:!0}),i("design:type",String)],l.prototype,"challenge",void 0),n([(0,a.validate)(),(0,a.serialize)({enforceString:!0}),i("design:type",o.CryptoSignature)],l.prototype,"signature",void 0),t.ChallengeSigned=l=n([(0,a.type)("ChallengeSigned")],l)},7896:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(2556),c=r(6453),u=r(413);class DeviceController extends s.TransportController{get secrets(){return this._secrets}get id(){return this.device.id}get publicKey(){return this.device.publicKey}get certificate(){return this.device.certificate}get name(){return this.device.name}get description(){return this.device.description}get operatingSystem(){return this.device.operatingSystem}get createdAt(){return this.device.createdAt}get type(){return this.device.type}get device(){if(!this._device)throw new s.TransportError("The Device controller is not initialized.");return this._device}get deviceOrUndefined(){return this._device}constructor(e){super(s.ControllerName.Device,e)}async init(e,t){return await super.init(),this._device=t,this._secrets=await new l.DeviceSecretController(this.parent,e).init(),this}async changePassword(e){const t=(await this.getCredentials()).password;await this.parent.deviceAuthClient.changeDevicePassword({oldPassword:t,newPassword:e});try{const t=await this.secrets.loadSecret(l.DeviceSecretType.DeviceCredentials);if(!t)throw new s.TransportError("There was an error while accessing the device_credentials secret.");const r=t.secret;r.password=e,await this.secrets.storeSecret(r,l.DeviceSecretType.DeviceCredentials)}catch(t){throw this.log.warn(`We've changed the device password on the backbone but weren't able to store it to the database. The new password is '${e}'.`),t}}async update(e){e.name&&(this.device.name=e.name),e.description&&(this.device.description=e.description),e.datawalletVersion&&(this.device.datawalletVersion=e.datawalletVersion),await this.parent.devices.update(this.device),await this.parent.info.set("device",this.device.toJSON())}async sign(e){const t=await this.secrets.loadSecret(l.DeviceSecretType.DeviceSignature);if(!(t&&t.secret instanceof o.CryptoSignaturePrivateKey))throw s.CoreErrors.secrets.secretNotFound(l.DeviceSecretType.DeviceSignature);const r=t.secret,n=await s.CoreCrypto.sign(e,r);return r.privateKey.clear(),n}async verify(e,t){if(!this.publicKey)throw new s.TransportError("The device has no public key to verify a signature. This can happen if the device is not onboarded yet.");return await s.CoreCrypto.verify(e,t,this.publicKey)}async getCredentials(){const e=await this.secrets.loadSecret(l.DeviceSecretType.DeviceCredentials);if(!e)throw s.CoreErrors.secrets.secretNotFound(l.DeviceSecretType.DeviceCredentials);if(!(e.secret instanceof u.DeviceSecretCredentials))throw s.CoreErrors.secrets.wrongSecretType(l.DeviceSecretType.DeviceCredentials);const t=e.secret;if(!t.username||!t.password)throw s.CoreErrors.secrets.wrongSecretType(l.DeviceSecretType.DeviceCredentials);return{username:t.username,password:t.password}}}t.DeviceController=DeviceController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[o.CryptoSecretKey,c.Device]),i("design:returntype",Promise)],DeviceController.prototype,"init",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[o.CoreBuffer]),i("design:returntype",Promise)],DeviceController.prototype,"sign",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[o.CoreBuffer,o.CryptoSignature]),i("design:returntype",Promise)],DeviceController.prototype,"verify",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",Promise)],DeviceController.prototype,"getCredentials",null)},2556:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceSecretController=t.DeviceSecretType=void 0;const a=r(194),o=r(5172),s=r(2890),l=r(2027),c=r(2508),u=r(8169),d=r(9423),p=r(7636),h=r(9750),y=r(6453),g=r(6758);var m;!function(e){e.IdentitySynchronizationMaster="identity_synchronization_master",e.IdentitySignature="identity_signature",e.SharedSecretBaseKey="shared_basekey",e.DeviceSecretBaseKey="secret_basekey",e.DeviceSignature="device_signature",e.DeviceCredentials="device_credentials"}(m||(t.DeviceSecretType=m={}));class DeviceSecretController extends c.TransportController{constructor(e,t){super(c.ControllerName.DeviceSecret,e),this.baseKey=t}async init(){return await super.init(),this.secrets=await this.db.getMap("DeviceSecrets"),this}async storeSecret(e,t){const r=e.serialize(),n=s.CoreBuffer.fromUtf8(r),i=await l.CoreCrypto.deriveKeyFromBase(this.getBaseKey(),1,DeviceSecretController.secretContext),a=await l.CoreCrypto.encrypt(n,i),o=l.CoreDate.utc(),c={cipher:a,createdAt:o,name:t,id:await u.TransportIds.secret.generate(),validFrom:o,active:!0},p=d.SecretContainerCipher.from(c);return this.log.trace(`Created device secret id:${p.id} name:${p.name} on ${p.createdAt.toISOString()}.`),await this.secrets.set(t,p.toJSON()),p}async loadSecret(e){const t=await this.secrets.get(e);if(!t)return;const r=this.getBaseKey(),n=d.SecretContainerCipher.from(t),i=await l.CoreCrypto.deriveKeyFromBase(r,1,DeviceSecretController.secretContext),o=(await l.CoreCrypto.decrypt(n.cipher,i)).toUtf8(),s=a.Serializable.deserializeUnknown(o),c=p.SecretContainerPlain.from({id:n.id,createdAt:n.createdAt,name:n.name,secret:s,validFrom:n.validFrom,validTo:n.validTo,active:n.active});return this.log.trace(`Accessed device secret id:${c.id} name:${c.name} on ${l.CoreDate.utc().toISOString()}.`),c}async deleteSecret(e){const t=await this.secrets.get(e);return!!t&&(await this.secrets.delete(e),this.log.trace(`Deleted device secret id:${t.id} name:${t.name} on ${l.CoreDate.utc().toISOString()}.`),!0)}async createDeviceSharedSecret(e,t,r=!1){const n=await this.loadSecret(m.IdentitySynchronizationMaster);if(!(n&&n.secret instanceof s.CryptoSecretKey))throw l.CoreErrors.secrets.secretNotFound("SynchronizationKey");const i=await this.loadSecret(m.SharedSecretBaseKey);if(!(i&&i.secret instanceof s.CryptoSecretKey))throw l.CoreErrors.secrets.secretNotFound("baseKey");let a;if(r&&(a=await this.loadSecret(m.IdentitySignature),!(a&&a.secret instanceof s.CryptoSignaturePrivateKey)))throw l.CoreErrors.secrets.secretNotFound("IdentityKey");return g.DeviceSharedSecret.from({id:e.id,createdAt:e.createdAt,createdByDevice:e.createdByDevice,deviceIndex:t,secretBaseKey:i.secret,name:e.name,description:e.description,synchronizationKey:n.secret,identityPrivateKey:null==a?void 0:a.secret,username:e.username,password:e.initialPassword,identity:this.parent.identity.identity})}async encryptDatawalletModificationPayload(e,t){if(!e.payload)return;const r=s.CoreBuffer.fromUtf8(JSON.stringify(e.payload)),n=await this.loadSecret(m.IdentitySynchronizationMaster);if(!(n&&n.secret instanceof s.CryptoSecretKey))throw l.CoreErrors.secrets.secretNotFound(m.IdentitySynchronizationMaster);const i=await l.CoreCrypto.deriveKeyFromBase(n.secret,t,"DataSync"),a=await l.CoreCrypto.encrypt(r,i);return n.secret.clear(),a.toBase64()}async decryptDatawalletModificationPayload(e,t){if(!e)return;const r=s.CryptoCipher.fromBase64(e),n=await this.loadSecret(m.IdentitySynchronizationMaster);if(!(n&&n.secret instanceof s.CryptoSecretKey))throw l.CoreErrors.secrets.secretNotFound(m.IdentitySynchronizationMaster);const i=await l.CoreCrypto.deriveKeyFromBase(n.secret,t,"DataSync"),a=await l.CoreCrypto.decrypt(r,i);n.secret.clear();return JSON.parse(a.toUtf8())}getBaseKey(){if(!this.baseKey)throw l.CoreErrors.general.recordNotFound(s.CryptoSecretKey,m.SharedSecretBaseKey);return this.baseKey}}t.DeviceSecretController=DeviceSecretController,DeviceSecretController.secretContext="DEVICE01",n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[y.Device,Number,Object]),i("design:returntype",Promise)],DeviceSecretController.prototype,"createDeviceSharedSecret",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[h.DatawalletModification,Number]),i("design:returntype",Promise)],DeviceSecretController.prototype,"encryptDatawalletModificationPayload",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[Object,Number]),i("design:returntype",Promise)],DeviceSecretController.prototype,"decryptDatawalletModificationPayload",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",s.CryptoSecretKey)],DeviceSecretController.prototype,"getBaseKey",null)},4980:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DevicesController=void 0;const n=r(2027),i=r(369),a=r(2508),o=r(2212),s=r(9643),l=r(8382),c=r(6453),u=r(9798);class DevicesController extends a.TransportController{constructor(e){super(a.ControllerName.Devices,e)}async init(){return await super.init(),this.client=new l.DeviceAuthClient(this.config,this.parent.authenticator),this.devices=await this.parent.getSynchronizedCollection(i.DbCollectionName.Devices),this}async get(e){const t=await this.devices.read(e.toString());if(t)return c.Device.from(t)}async addExistingDevice(e){await this.devices.create(e)}async createDevice(e="",t="",r=!1){const[i,a]=await Promise.all([this.parent.challenges.createChallenge(s.ChallengeType.Identity),o.PasswordGenerator.createStrongPassword(45,50)]);this.log.trace("Device Creation Challenge signed. Creating device on backbone...");const l=(await this.client.createDevice({signedChallenge:i.toJSON(),devicePassword:a})).value;this.log.trace(`Created device with id ${l.id}.`);return c.Device.from({createdAt:n.CoreDate.from(l.createdAt),createdByDevice:n.CoreId.from(l.createdByDevice),id:n.CoreId.from(l.id),name:e,description:t,type:c.DeviceType.Unknown,username:l.username,initialPassword:a,isAdmin:r})}async sendDevice(e){if(!(e=u.SendDeviceParameters.from(e)).name){const t=await this.parent.devices.list();e.name=`Device ${t.length+1}`}const t=await this.createDevice(e.name,e.description,e.isAdmin);return await this.devices.create(t),t}async getSharedSecret(e){const t=await this.devices.read(e.toString());if(!t)throw n.CoreErrors.general.recordNotFound(c.Device,e.toString());const r=await this.devices.count(),i=c.Device.from(t);if(void 0!==i.publicKey)throw n.CoreErrors.device.alreadyOnboarded();const a=!0===i.isAdmin;return await this.parent.activeDevice.secrets.createDeviceSharedSecret(i,r,a)}async update(e){const t=await this.devices.read(e.id.toString());if(!t)throw n.CoreErrors.general.recordNotFound(c.Device,e.id.toString());await this.devices.update(t,e)}async delete(e){if(void 0!==e.publicKey)throw n.CoreErrors.device.couldNotDeleteDevice("Device is already onboarded.");const t=await this.client.deleteDevice(e.id.toString());if(t.isError)throw n.CoreErrors.device.couldNotDeleteDevice("Backbone did not authorize deletion.",t.error);await this.devices.delete(e)}async list(){const e=await this.devices.list();return this.parseArray(e,c.Device)}}t.DevicesController=DevicesController},3378:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8382:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceAuthClient=void 0;const n=r(2027);class DeviceAuthClient extends n.RESTClientAuthenticate{constructor(){super(...arguments),this._logDirective=n.RESTClientLogDirective.LogResponse}async changeDevicePassword(e){return await this.put("/api/v1/Devices/Self/Password",e,{})}async createDevice(e){return await this.post("/api/v1/Devices",e,{})}async deleteDevice(e){return await this.delete(`/api/v1/Devices/${e}`)}async registerPushNotificationToken(e){return await this.put("/api/v1/Devices/Self/PushNotifications",e)}}t.DeviceAuthClient=DeviceAuthClient},6961:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceClient=void 0;const n=r(2027);class DeviceClient extends n.RESTClient{constructor(){super(...arguments),this._logDirective=n.RESTClientLogDirective.LogResponse}async createDevice(e){return await this.post("/api/v1/Devices",e,{})}}t.DeviceClient=DeviceClient},6453:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Device=t.DeviceType=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(4062),u=r(9170);var d;!function(e){e[e.Unknown=0]="Unknown",e[e.Phone=1]="Phone",e[e.Tablet=2]="Tablet",e[e.Desktop=3]="Desktop",e[e.Connector=4]="Connector"}(d||(t.DeviceType=d={}));let p=class Device extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.isAdmin)),(0,s.nameof)((e=>e.publicKey)),(0,s.nameof)((e=>e.certificate)),(0,s.nameof)((e=>e.operatingSystem)),(0,s.nameof)((e=>e.type)),(0,s.nameof)((e=>e.createdAt)),(0,s.nameof)((e=>e.createdByDevice)),(0,s.nameof)((e=>e.lastLoginAt)),(0,s.nameof)((e=>e.username)),(0,s.nameof)((e=>e.initialPassword)),(0,s.nameof)((e=>e.datawalletVersion))],this.userdataProperties=[(0,s.nameof)((e=>e.name)),(0,s.nameof)((e=>e.description))]}static from(e){return this.fromAny(e)}};t.Device=p,n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CryptoSignaturePublicKey)],p.prototype,"publicKey",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"certificate",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],p.prototype,"name",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"description",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"operatingSystem",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",c.CoreDate)],p.prototype,"createdAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",u.CoreId)],p.prototype,"createdByDevice",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.CoreDate)],p.prototype,"lastLoginAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Number)],p.prototype,"type",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"username",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],p.prototype,"initialPassword",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Boolean)],p.prototype,"isAdmin",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Number)],p.prototype,"datawalletVersion",void 0),t.Device=p=n([(0,a.type)("Device")],p)},413:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceSecretCredentials=void 0;const a=r(194),o=r(2027);let s=class DeviceSecretCredentials extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.DeviceSecretCredentials=s,n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CoreId)],s.prototype,"id",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],s.prototype,"password",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],s.prototype,"username",void 0),t.DeviceSecretCredentials=s=n([(0,a.type)("DeviceSecretCredentials")],s)},9798:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendDeviceParameters=void 0;const a=r(194),o=r(2027);let s=class SendDeviceParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendDeviceParameters=s,n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],s.prototype,"name",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],s.prototype,"description",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Boolean)],s.prototype,"isAdmin",void 0),t.SendDeviceParameters=s=n([(0,a.type)("SendDeviceParameters")],s)},6758:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceSharedSecret=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(2016);let c=class DeviceSharedSecret extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.DeviceSharedSecret=c,n([(0,a.serialize)(),(0,a.validate)(),i("design:type",s.CoreId)],c.prototype,"id",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",s.CoreId)],c.prototype,"createdByDevice",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",s.CoreDate)],c.prototype,"createdAt",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],c.prototype,"name",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],c.prototype,"description",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CryptoSecretKey)],c.prototype,"synchronizationKey",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CryptoSecretKey)],c.prototype,"secretBaseKey",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",Number)],c.prototype,"deviceIndex",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",o.CryptoSignaturePrivateKey)],c.prototype,"identityPrivateKey",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",l.Identity)],c.prototype,"identity",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",String)],c.prototype,"username",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",String)],c.prototype,"password",void 0),t.DeviceSharedSecret=c=n([(0,a.type)("DeviceSharedSecret")],c)},9777:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.FileController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(369),c=r(2508),u=r(7145),d=r(7373),p=r(9873),h=r(8340),y=r(3159),g=r(9579);class FileController extends c.TransportController{constructor(e){super(c.ControllerName.File,e)}async init(){return await super.init(),this.client=new u.FileClient(this.config,this.parent.authenticator),this.files=await this.parent.getSynchronizedCollection(l.DbCollectionName.Files),this}async getFiles(e){const t=await this.files.find(e);return this.parseArray(t,p.File)}async getFile(e){const t=await this.files.read(e.toString());return t?p.File.from(t):void 0}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getFiles({ids:e.map((e=>e.id))})).value.collect()).map((async e=>{const t=await this.files.read(e.id),r=p.File.from(t);return{id:s.CoreId.from(e.id),cache:await this.decryptFile(e,r.secretKey)}}));return await Promise.all(t)}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getFiles({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingFileInDb(e.id,e));return await Promise.all(r)}async updateCacheOfExistingFileInDb(e,t){const r=await this.files.read(e);if(!r)throw s.CoreErrors.general.recordNotFound(p.File,e);const n=p.File.from(r);return await this.updateCacheOfFile(n,t),await this.files.update(r,n),n}async updateCacheOfFile(e,t){const r=e.id.toString();t||(t=(await this.client.getFile(r)).value);const n=await this.decryptFile(t,e.secretKey);e.setCache(n),e.isOwn=this.parent.identity.isMe(n.createdBy)}async decryptFile(e,t){const r=o.CryptoCipher.fromBase64(e.encryptedProperties),n=await s.CoreCrypto.decrypt(r,t),i=y.FileMetadata.deserialize(n.toUtf8());if(!(i instanceof y.FileMetadata))throw s.CoreErrors.files.invalidMetadata(e.id);return d.CachedFile.fromBackbone(e,i)}async getOrLoadFileByTruncated(e){const t=g.FileReference.fromTruncated(e);return await this.getOrLoadFileByReference(t)}async getOrLoadFileByReference(e){return await this.getOrLoadFile(e.id,e.key)}async getOrLoadFile(e,t){const r=await this.files.read(e.toString());if(r)return r.cache?p.File.from(r):await this.updateCacheOfExistingFileInDb(e.toString());const n=p.File.from({id:e,secretKey:t,isOwn:!1});return await this.updateCacheOfFile(n),await this.files.create(n),n}async setFileMetadata(e,t){const r=e instanceof s.CoreId?e.toString():e.id.toString(),n=await this.files.read(r);if(!n)throw s.CoreErrors.general.recordNotFound(p.File,r.toString());const i=p.File.from(n);return i.setMetadata(t),await this.files.update(n,i),i}async sendFile(e){const t=h.SendFileParameters.from(e),r=t.buffer,n=r.length;if(n>this.config.platformMaxUnencryptedFileSize)throw s.CoreErrors.files.maxFileSizeExceeded(n,this.config.platformMaxUnencryptedFileSize);const i=await o.CryptoHash.hash(r,2),a=s.CoreHash.from(i.toBase64URL()),l=await this.parent.activeDevice.sign(i),c=l.toBase64(),u=await s.CoreCrypto.generateSecretKey(),g=await s.CoreCrypto.encrypt(r,u),m=o.CoreBuffer.fromBase64URL(g.toBase64()),v=await o.CryptoHash.hash(m,2),b=s.CoreHash.from(v.toBase64URL()),w=y.FileMetadata.from({title:t.title,description:t.description,filename:t.filename,filesize:n,plaintextHash:a,secretKey:u,filemodified:t.filemodified,mimetype:t.mimetype}).serialize(),C=o.CoreBuffer.fromString(w,o.Encoding.Utf8),S=await s.CoreCrypto.generateSecretKey(),_=await s.CoreCrypto.encrypt(C,S),R=this.parent.identity.address,O=(await this.client.createFile({content:m.buffer,cipherHash:v.toBase64URL(),owner:R.toString(),ownerSignature:c,expiresAt:t.expiresAt.toString(),encryptedProperties:_.toBase64()})).value,T=d.CachedFile.from({title:t.title,description:t.description,filename:t.filename,filesize:n,filemodified:t.filemodified,cipherKey:u,cipherHash:b,createdAt:s.CoreDate.from(O.createdAt),createdBy:s.CoreAddress.from(O.createdBy),createdByDevice:s.CoreId.from(O.createdByDevice),expiresAt:s.CoreDate.from(O.expiresAt),mimetype:t.mimetype,owner:s.CoreAddress.from(O.owner),ownerSignature:l,plaintextHash:a}),I=p.File.from({id:s.CoreId.from(O.id),secretKey:S,isOwn:!0});return I.setCache(T),await this.files.create(I),I}async downloadFileContent(e){const t=e instanceof p.File?e:await this.getFile(e);if(!t)throw s.CoreErrors.general.recordNotFound(p.File,e.toString());if(!t.cache)throw this.newCacheEmptyError(p.File,t.id.toString());const r=(await this.client.downloadFile(t.id.toString())).value,n=o.CoreBuffer.fromObject(r);if((await o.CryptoHash.hash(n,2)).toBase64URL()!==t.cache.cipherHash.hash)throw s.CoreErrors.files.cipherMismatch();const i=o.CryptoCipher.fromBase64(n.toBase64URL()),a=await s.CoreCrypto.decrypt(i,t.cache.cipherKey);if(!await t.cache.plaintextHash.verify(a,2))throw s.CoreErrors.files.plaintextHashMismatch();return a}}t.FileController=FileController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],FileController.prototype,"updateCacheOfExistingFileInDb",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,o.CryptoSecretKey]),i("design:returntype",Promise)],FileController.prototype,"decryptFile",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],FileController.prototype,"setFileMetadata",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],FileController.prototype,"downloadFileContent",null)},2153:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5560:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7145:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileClient=void 0;const n=r(6054);class FileClient extends n.RESTClientAuthenticate{async createFile(e){return await this.postMultipart("/api/v1/Files",e)}async getFiles(e){return await this.getPaged("/api/v1/Files",e)}async getFile(e){return await this.get(`/api/v1/Files/${e}/metadata`)}async deleteFile(e){return await this.delete(`/api/v1/Files/${e}`)}async downloadFile(e){return await this.download(`/api/v1/Files/${e}`)}}t.FileClient=FileClient},7373:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CachedFile=void 0;const o=r(194),s=r(2890),l=r(2027);let c=n=class CachedFile extends l.CoreSerializable{static from(e){return this.fromAny(e)}static fromBackbone(e,t){return n.from({title:t.title,description:t.description,cipherKey:t.secretKey,filemodified:t.filemodified,filename:t.filename,filesize:t.filesize,plaintextHash:t.plaintextHash,deletedAt:e.deletedAt?l.CoreDate.from(e.deletedAt):void 0,deletedBy:e.deletedBy?l.CoreAddress.from(e.deletedBy):void 0,deletedByDevice:e.deletedByDevice?l.CoreId.from(e.deletedByDevice):void 0,cipherHash:l.CoreHash.from(e.cipherHash),createdAt:l.CoreDate.from(e.createdAt),createdBy:l.CoreAddress.from(e.createdBy),createdByDevice:l.CoreId.from(e.createdByDevice),expiresAt:l.CoreDate.from(e.expiresAt),mimetype:t.mimetype,owner:l.CoreAddress.from(e.owner),ownerSignature:s.CryptoSignature.fromBase64(e.ownerSignature)})}};t.CachedFile=c,i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",String)],c.prototype,"title",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",String)],c.prototype,"filename",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",Number)],c.prototype,"filesize",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreDate)],c.prototype,"filemodified",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",String)],c.prototype,"mimetype",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreHash)],c.prototype,"cipherHash",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreDate)],c.prototype,"createdAt",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreDate)],c.prototype,"expiresAt",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",String)],c.prototype,"description",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreAddress)],c.prototype,"owner",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",s.CryptoSignature)],c.prototype,"ownerSignature",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreHash)],c.prototype,"plaintextHash",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreAddress)],c.prototype,"createdBy",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreId)],c.prototype,"createdByDevice",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",s.CryptoSecretKey)],c.prototype,"cipherKey",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreDate)],c.prototype,"deletedAt",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreAddress)],c.prototype,"deletedBy",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreId)],c.prototype,"deletedByDevice",void 0),t.CachedFile=c=n=i([(0,o.type)("CachedFile")],c)},9873:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.File=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(9579),u=r(7373);let d=class File extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.secretKey)),(0,s.nameof)((e=>e.isOwn))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static from(e){return this.fromAny(e)}toFileReference(){return c.FileReference.from({id:this.id,key:this.secretKey})}truncate(){return this.toFileReference().truncate()}setCache(e){return this.cache=e,this.cachedAt=l.CoreDate.utc(),this}setMetadata(e){return this.metadata=e,this.metadataModifiedAt=l.CoreDate.utc(),this}};t.File=d,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],d.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],d.prototype,"isOwn",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",u.CachedFile)],d.prototype,"cache",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],d.prototype,"cachedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],d.prototype,"metadata",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],d.prototype,"metadataModifiedAt",void 0),t.File=d=n([(0,a.type)("File")],d)},8340:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendFileParameters=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(4062);let c=class SendFileParameters extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendFileParameters=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"title",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"description",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"filename",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"mimetype",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreDate)],c.prototype,"expiresAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],c.prototype,"filemodified",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreBuffer)],c.prototype,"buffer",void 0),t.SendFileParameters=c=n([(0,a.type)("SendFileParameters")],c)},3159:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.FileMetadata=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class FileMetadata extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.FileMetadata=l,n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],l.prototype,"title",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],l.prototype,"description",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"filename",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreHash)],l.prototype,"plaintextHash",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],l.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Number)],l.prototype,"filesize",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",s.CoreDate)],l.prototype,"filemodified",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"mimetype",void 0),t.FileMetadata=l=n([(0,a.type)("FileMetadata")],l)},9579:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.FileReference=void 0;const i=r(194),a=r(2027);let o=class FileReference extends a.Reference{static preFrom(e){return super.validateId(e,a.BackboneIds.file),e}static from(e){return super.from(e)}};t.FileReference=o,t.FileReference=o=n([(0,i.type)("FileReference")],o)},9662:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.SyncStep=void 0,i(r(7024),t),i(r(5366),t),i(r(2016),t),i(r(6346),t),i(r(761),t),i(r(1615),t),i(r(2723),t),i(r(8324),t),i(r(365),t),i(r(8951),t),i(r(4507),t),i(r(7584),t),i(r(1949),t),i(r(8176),t),i(r(6578),t),i(r(4220),t),i(r(3327),t),i(r(7376),t),i(r(8579),t),i(r(3727),t),i(r(9745),t),i(r(1430),t),i(r(3122),t),i(r(1772),t),i(r(9626),t),i(r(9643),t),i(r(4621),t),i(r(3378),t),i(r(8382),t),i(r(6961),t),i(r(7896),t),i(r(4980),t),i(r(2556),t),i(r(6453),t),i(r(413),t),i(r(9798),t),i(r(6758),t),i(r(2153),t),i(r(5560),t),i(r(7145),t),i(r(9777),t),i(r(7373),t),i(r(9873),t),i(r(8340),t),i(r(3159),t),i(r(9579),t),i(r(7239),t),i(r(5523),t),i(r(3125),t),i(r(2510),t),i(r(6614),t),i(r(4949),t),i(r(5832),t),i(r(682),t),i(r(8909),t),i(r(4937),t),i(r(9829),t),i(r(7242),t),i(r(6164),t),i(r(7902),t),i(r(1903),t),i(r(4002),t),i(r(169),t),i(r(2182),t),i(r(8440),t),i(r(3666),t),i(r(3654),t),i(r(3582),t),i(r(1512),t),i(r(3771),t),i(r(3611),t),i(r(6411),t),i(r(5289),t),i(r(5784),t),i(r(2618),t),i(r(8174),t),i(r(3861),t),i(r(8333),t),i(r(7262),t),i(r(8805),t),i(r(8572),t),i(r(7215),t),i(r(9270),t),i(r(1752),t),i(r(3778),t),i(r(2343),t),i(r(3250),t),i(r(3293),t),i(r(2860),t),i(r(3129),t),i(r(9423),t),i(r(7636),t),i(r(5739),t),i(r(6890),t),i(r(3670),t),i(r(8571),t),i(r(4401),t),i(r(1541),t),i(r(7224),t),i(r(5079),t),i(r(7596),t),i(r(9267),t),i(r(3132),t),i(r(9761),t),i(r(9750),t);var a=r(307);Object.defineProperty(t,"SyncStep",{enumerable:!0,get:function(){return a.SyncStep}}),i(r(1295),t),i(r(26),t),i(r(8697),t),i(r(7653),t),i(r(7267),t),i(r(6591),t),i(r(8342),t),i(r(5898),t),i(r(4102),t),i(r(4503),t),i(r(5083),t),i(r(2238),t),i(r(1488),t),i(r(7776),t)},5832:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageController=void 0;const a=r(5172),o=r(2890),s=r(4714),l=r(2027),c=r(369),u=r(2508),d=r(2205),p=r(9873),h=r(3654),y=r(2182),g=r(3125),m=r(2510),v=r(6614),b=r(4949),w=r(682),C=r(8909),S=r(4937),_=r(9829),R=r(7242);class MessageController extends u.TransportController{constructor(e){super(u.ControllerName.Message,e),this.relationships=e.relationships}async init(){return await super.init(),this.secrets=new h.RelationshipSecretController(this.parent),await this.secrets.init(),this.client=new g.MessageClient(this.config,this.parent.authenticator),this.messages=await this.parent.getSynchronizedCollection(c.DbCollectionName.Messages),this}async getMessages(e){const t=await this.messages.find(e);return this.parseArray(t,v.Message)}async getMessagesByRelationshipId(e){return await this.getMessages({[(0,s.nameof)((e=>e.relationshipIds))]:{$contains:e.toString()}})}async getMessagesByAddress(e){const t=await this.parent.relationships.getActiveRelationshipToIdentity(e);if(!t)throw l.CoreErrors.messages.noMatchingRelationship(e.toString());return await this.getMessagesByRelationshipId(t.id)}async getReceivedMessages(){return await this.getMessages({[(0,s.nameof)((e=>e.isOwn))]:!1})}async getMessage(e){const t=await this.messages.read(e.toString());return t?v.Message.from(t):void 0}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getMessages({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingMessageInDb(e.id,e));return await Promise.all(r)}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getMessages({ids:e.map((e=>e.toString()))})).value.collect()).map((async e=>{const t=await this.messages.read(e.id),r=v.Message.from(t),n=this.getEnvelopeFromBackboneGetMessagesResponse(e),i=(await this.decryptMessage(n,r.secretKey))[0];return{id:l.CoreId.from(e.id),cache:i}}));return await Promise.all(t)}async updateCacheOfExistingMessageInDb(e,t){const r=await this.messages.read(e);if(!r)throw l.CoreErrors.general.recordNotFound(v.Message,e);const n=v.Message.from(r);return await this.updateCacheOfMessage(n,t),await this.messages.update(r,n),n}async updateCacheOfMessage(e,t){const r=e.id.toString();t||(t=(await this.client.getMessage(r)).value);const n=this.getEnvelopeFromBackboneGetMessagesResponse(t),[i,a]=await this.decryptMessage(n,e.secretKey);e.secretKey=a,e.setCache(i)}async loadPeerMessage(e){const t=(await this.client.getMessage(e.toString())).value,r=this.getEnvelopeFromBackboneGetMessagesResponse(t),[n,i,a]=await this.decryptMessage(r);if(!a)throw l.CoreErrors.general.recordNotFound(y.Relationship,r.id.toString());const o=v.Message.from({id:r.id,isOwn:!1,secretKey:i,relationshipIds:[a.id]});return o.setCache(n),await this.messages.create(o),o}getEnvelopeFromBackboneGetMessagesResponse(e){const t=[];for(const r of e.recipients){const e=S.MessageEnvelopeRecipient.from({encryptedKey:o.CryptoCipher.fromBase64(r.encryptedKey),address:l.CoreAddress.from(r.address),receivedAt:r.receivedAt?l.CoreDate.from(r.receivedAt):void 0,receivedByDevice:r.receivedByDevice?l.CoreId.from(r.receivedByDevice):void 0});t.push(e)}return C.MessageEnvelope.from({id:l.CoreId.from(e.id),createdAt:l.CoreDate.from(e.createdAt),createdBy:l.CoreAddress.from(e.createdBy),createdByDevice:l.CoreId.from(e.createdByDevice),cipher:o.CryptoCipher.fromBase64(e.body),attachments:e.attachments,recipients:t})}async setMessageMetadata(e,t){const r=e instanceof l.CoreId?e.toString():e.id.toString(),n=await this.messages.read(r);if(!n)throw l.CoreErrors.general.recordNotFound(v.Message,r.toString());const i=v.Message.from(n);return i.setMetadata(t),await this.messages.update(n,i),i}async sendMessage(e){const t=b.SendMessageParameters.from(e);t.attachments||(t.attachments=[]);const r=await l.CoreCrypto.generateSecretKey(),n=r.serialize(!1),i=[],a=[];for(const e of t.recipients){const t=await this.relationships.getActiveRelationshipToIdentity(e);if(!t)throw l.CoreErrors.general.recordNotFound(y.Relationship,e.toString());const r=await this.secrets.encrypt(t.relationshipSecretId,n);a.push(S.MessageEnvelopeRecipient.from({address:e,encryptedKey:r})),i.push(e)}const s=[],c=[];for(const e of t.attachments){const t=p.File.from(e);c.push(t.toFileReference()),s.push(t.id)}const u=w.MessageContentWrapper.from({content:t.content,recipients:i,createdAt:l.CoreDate.utc(),attachments:c}).serialize(),h=o.CoreBuffer.fromUtf8(u),g=[],C=[];for(const e of t.recipients){const t=await this.relationships.getActiveRelationshipToIdentity(l.CoreAddress.from(e));if(!t)throw l.CoreErrors.general.recordNotFound(y.Relationship,e.toString());const r=await this.secrets.sign(t.relationshipSecretId,h),n=_.MessageSignature.from({recipient:e,signature:r});g.push(n),C.push(t.id)}const O=R.MessageSigned.from({message:u,signatures:g}).serialize(),T=await l.CoreCrypto.encrypt(o.CoreBuffer.fromUtf8(O),r),I=a.map((e=>({address:e.address.toString(),encryptedKey:e.encryptedKey.toBase64()}))),E=s.map((e=>({id:e.id}))),D=(await this.client.createMessage({attachments:E,body:T.toBase64(),recipients:I})).value,P=m.CachedMessage.from({content:t.content,createdAt:l.CoreDate.from(D.createdAt),createdBy:this.parent.identity.identity.address,createdByDevice:this.parent.activeDevice.id,recipients:a,attachments:s,receivedByEveryone:!1}),A=v.Message.from({id:l.CoreId.from(D.id),secretKey:r,cache:P,cachedAt:l.CoreDate.utc(),isOwn:!0,relationshipIds:C});return await this.messages.create(A),this.eventBus.publish(new d.MessageSentEvent(this.parent.identity.address.toString(),A)),A}async decryptOwnEnvelope(e,t){this.log.trace(`Decrypting own envelope with id ${e.id.toString()}...`);const r=await l.CoreCrypto.decrypt(e.cipher,t),n=R.MessageSigned.deserialize(r.toUtf8());return w.MessageContentWrapper.from(JSON.parse(n.message))}async decryptPeerEnvelope(e,t){var r,n;const i=null===(r=e.recipients.find((e=>this.parent.identity.isMe(e.address))))||void 0===r?void 0:r.encryptedKey;if(!i)throw l.CoreErrors.messages.ownAddressNotInList(e.id.toString());const a=await this.secrets.decryptPeer(t.relationshipSecretId,i,!0),s=o.CryptoSecretKey.deserialize(a.toUtf8()),c=await l.CoreCrypto.decrypt(e.cipher,s),u=R.MessageSigned.deserialize(c.toUtf8()),d=null===(n=u.signatures.find((e=>this.parent.identity.isMe(e.recipient))))||void 0===n?void 0:n.signature;if(!d)throw l.CoreErrors.messages.signatureListMismatch(e.id.toString());const p=w.MessageContentWrapper.from(JSON.parse(u.message));u.signatures.length!==p.recipients.length&&this.log.debug(`Number of signatures does not match number of recipients from envelope ${e.id}.`);const h=o.CoreBuffer.fromUtf8(u.message);if(!await this.secrets.verifyPeer(t.relationshipSecretId,h,d))throw l.CoreErrors.messages.signatureNotValid();p.recipients.length!==e.recipients.length&&this.log.debug(`Number of signed recipients within the message does not match number of recipients from envelope ${e.id}.`),p.recipients.length!==u.signatures.length&&this.log.debug(`Number of signed recipients within the message does not match number of signatures from envelope ${e.id}.`);if(!p.recipients.some((e=>this.parent.identity.isMe(e))))throw l.CoreErrors.messages.plaintextMismatch(e.id.toString());return[p,s]}async decryptMessage(e,t){let r,n,i;if(this.log.trace(`Decrypting MessageEnvelope with id ${e.id}...`),this.parent.identity.isMe(e.createdBy)){if(!t)throw new l.TransportError(`The own message (${e.id.toString()}) could not be decrypted, because no secret key was passed for it.`);n=t,r=await this.decryptOwnEnvelope(e,t)}else{if(i=await this.relationships.getActiveRelationshipToIdentity(e.createdBy),!i)throw l.CoreErrors.messages.noMatchingRelationship(e.createdBy.toString());const[t,a]=await this.decryptPeerEnvelope(e,i);r=t,n=a}this.log.trace("Message is valid. Fetching attachments for message...");const a=[],o=[];for(const e of r.attachments)o.push(this.parent.files.getOrLoadFileByReference(e)),a.push(e.id);await Promise.all(o),this.log.trace("Attachments fetched. Creating message...");return[m.CachedMessage.from({createdBy:e.createdBy,createdByDevice:e.createdByDevice,recipients:e.recipients,attachments:a,content:r.content,createdAt:e.createdAt,receivedByEveryone:!1}),n,i]}}t.MessageController=MessageController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[l.CoreAddress]),i("design:returntype",Promise)],MessageController.prototype,"getMessagesByAddress",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],MessageController.prototype,"updateCacheOfExistingMessageInDb",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[l.CoreId]),i("design:returntype",Promise)],MessageController.prototype,"loadPeerMessage",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],MessageController.prototype,"setMessageMetadata",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],MessageController.prototype,"sendMessage",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[C.MessageEnvelope,y.Relationship]),i("design:returntype",Promise)],MessageController.prototype,"decryptPeerEnvelope",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[C.MessageEnvelope,o.CryptoSecretKey]),i("design:returntype",Promise)],MessageController.prototype,"decryptMessage",null)},7239:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5523:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3125:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageClient=void 0;const n=r(6054);class MessageClient extends n.RESTClientAuthenticate{async getMessages(e){return await this.getPaged("/api/v1/Messages",e)}async createMessage(e){return await this.post("/api/v1/Messages",e)}async getMessage(e){return await this.get(`/api/v1/Messages/${e}`)}async deleteMessage(e){return await this.delete(`/api/v1/Messages/${e}`)}async setRead(e){return await this.put(`/api/v1/Messages/${e}/setReadFlag`,void 0)}}t.MessageClient=MessageClient},2510:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CachedMessage=void 0;const a=r(194),o=r(2027),s=r(4062),l=r(4937);let c=class CachedMessage extends o.CoreSerializable{constructor(){super(...arguments),this.receivedByEveryone=!1}static from(e){return this.fromAny(e)}};t.CachedMessage=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],c.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],c.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.MessageEnvelopeRecipient}),i("design:type",Array)],c.prototype,"recipients",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreDate)],c.prototype,"createdAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)({type:o.CoreId}),i("design:type",Array)],c.prototype,"attachments",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],c.prototype,"receivedByEveryone",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],c.prototype,"content",void 0),t.CachedMessage=c=n([(0,a.type)("CachedMessage")],c)},6614:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Message=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(2510);let u=class Message extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.secretKey)),(0,s.nameof)((e=>e.isOwn)),(0,s.nameof)((e=>e.relationshipIds))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static from(e){return this.fromAny(e)}setCache(e){return this.cache=e,this.cachedAt=l.CoreDate.utc(),this}setMetadata(e){return this.metadata=e,this.metadataModifiedAt=l.CoreDate.utc(),this}};t.Message=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],u.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],u.prototype,"isOwn",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.CachedMessage)],u.prototype,"cache",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],u.prototype,"cachedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],u.prototype,"metadata",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],u.prototype,"metadataModifiedAt",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.CoreId}),i("design:type",Array)],u.prototype,"relationshipIds",void 0),t.Message=u=n([(0,a.type)("Message")],u)},4949:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendMessageParameters=void 0;const a=r(194),o=r(2027),s=r(9873);let l=class SendMessageParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendMessageParameters=l,n([(0,a.validate)(),(0,a.serialize)({type:o.CoreAddress}),i("design:type",Array)],l.prototype,"recipients",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)({type:s.File}),i("design:type",Array)],l.prototype,"attachments",void 0),t.SendMessageParameters=l=n([(0,a.type)("SendMessageParameters")],l)},682:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageContentWrapper=void 0;const a=r(194),o=r(2027),s=r(7875),l=r(4062),c=r(9579);let u=class MessageContentWrapper extends o.CoreSerializable{constructor(){super(...arguments),this.attachments=[]}static preFrom(e){return void 0===e.attachments&&(e.attachments=[]),e}static from(e){return this.fromAny(e)}};t.MessageContentWrapper=u,n([(0,a.validate)(),(0,a.serialize)({type:c.FileReference}),i("design:type",Array)],u.prototype,"attachments",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],u.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreDate)],u.prototype,"createdAt",void 0),n([(0,a.validate)(),(0,a.serialize)({type:s.CoreAddress}),i("design:type",Array)],u.prototype,"recipients",void 0),t.MessageContentWrapper=u=n([(0,a.type)("MessageContentWrapper")],u)},8909:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageEnvelope=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(4937);let c=class MessageEnvelope extends s.CoreSerializable{static from(e){return this.fromAny(e)}static mapToJSON(e){const t={};for(const[r,n]of e.entries()){const e=r.serialize(),i=n.serialize();t[e]=i}return t}static deserializeMap(e){const t=new Map;for(const r in e){const n=e[r],i=s.CoreAddress.deserialize(r),a=o.CryptoCipher.deserialize(n);t.set(i,a)}return t}};t.MessageEnvelope=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],c.prototype,"id",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreDate)],c.prototype,"createdAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreAddress)],c.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],c.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.MessageEnvelopeRecipient}),i("design:type",Array)],c.prototype,"recipients",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoCipher)],c.prototype,"cipher",void 0),n([(0,a.validate)(),(0,a.serialize)({type:s.CoreId}),i("design:type",Array)],c.prototype,"attachments",void 0),t.MessageEnvelope=c=n([(0,a.type)("MessageEnvelope")],c)},4937:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageEnvelopeRecipient=void 0;const a=r(194),o=r(2890),s=r(2027),l=r(7875);let c=class MessageEnvelopeRecipient extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.MessageEnvelopeRecipient=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.CoreAddress)],c.prototype,"address",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoCipher)],c.prototype,"encryptedKey",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",s.CoreDate)],c.prototype,"receivedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",s.CoreId)],c.prototype,"receivedByDevice",void 0),t.MessageEnvelopeRecipient=c=n([(0,a.type)("MessageEnvelopeRecipient")],c)},9829:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageSignature=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class MessageSignature extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.MessageSignature=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreAddress)],l.prototype,"recipient",void 0),n([(0,a.validate)(),(0,a.serialize)({enforceString:!0}),i("design:type",o.CryptoSignature)],l.prototype,"signature",void 0),t.MessageSignature=l=n([(0,a.type)("MessageSignature")],l)},7242:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageSigned=void 0;const a=r(194),o=r(2027),s=r(9829);let l=class MessageSigned extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.MessageSigned=l,n([(0,a.validate)(),(0,a.serialize)({type:s.MessageSignature}),i("design:type",Array)],l.prototype,"signatures",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"message",void 0),t.MessageSigned=l=n([(0,a.type)("MessageSigned")],l)},2343:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(369),c=r(2508),u=r(2205),d=r(7215),p=r(9270),h=r(1752),y=r(3778),g=r(3250),m=r(2860),v=r(3129);class RelationshipTemplateController extends c.TransportController{constructor(e,t,r){super(r||c.ControllerName.RelationshipTemplate,e),this.secrets=t,this.client=new d.RelationshipTemplateClient(this.config,this.parent.authenticator)}async init(){return await super.init(),this.templates=await this.parent.getSynchronizedCollection(l.DbCollectionName.RelationshipTemplates),this}async sendRelationshipTemplate(e){e=y.SendRelationshipTemplateParameters.from(e);const t=await this.secrets.createTemplateKey(),r=g.RelationshipTemplateContentWrapper.from({content:e.content,identity:this.parent.identity.identity,templateKey:t}),n=await s.CoreCrypto.generateSecretKey(),i=r.serialize(),a=o.CoreBuffer.fromUtf8(i),l=await this.parent.identity.sign(a),c=v.RelationshipTemplateSigned.from({deviceSignature:l,serializedTemplate:i}),u=o.CoreBuffer.fromUtf8(c.serialize()),d=await s.CoreCrypto.encrypt(u,n),m=(await this.client.createRelationshipTemplate({expiresAt:e.expiresAt.toString(),maxNumberOfAllocations:e.maxNumberOfAllocations,content:d.toBase64()})).value,b=p.CachedRelationshipTemplate.from({content:e.content,createdAt:s.CoreDate.from(m.createdAt),createdBy:this.parent.identity.address,createdByDevice:this.parent.activeDevice.id,expiresAt:e.expiresAt,identity:this.parent.identity.identity,maxNumberOfAllocations:e.maxNumberOfAllocations,templateKey:t}),w=h.RelationshipTemplate.from({id:s.CoreId.from(m.id),secretKey:n,isOwn:!0,cache:b,cachedAt:s.CoreDate.utc()});return await this.templates.create(w),w}async deleteRelationshipTemplate(e){await this.client.deleteRelationshipTemplate(e.id.toString()),await this.templates.delete(e)}async getRelationshipTemplates(e){const t=await this.templates.find(e);return this.parseArray(t,h.RelationshipTemplate)}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getRelationshipTemplates({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingTemplateInDb(e.id,e));return await Promise.all(r)}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getRelationshipTemplates({ids:e.map((e=>e.id))})).value.collect()).map((async e=>{const t=await this.templates.read(e.id),r=h.RelationshipTemplate.from(t);return{id:s.CoreId.from(e.id),cache:await this.decryptRelationshipTemplate(e,r.secretKey)}}));return await Promise.all(t)}async updateCacheOfExistingTemplateInDb(e,t){const r=await this.templates.read(e);if(!r)throw s.CoreErrors.general.recordNotFound(h.RelationshipTemplate,e);const n=h.RelationshipTemplate.from(r);return await this.updateCacheOfTemplate(n,t),await this.templates.update(r,n),n}async updateCacheOfTemplate(e,t){t||(t=(await this.client.getRelationshipTemplate(e.id.toString())).value);const r=await this.decryptRelationshipTemplate(t,e.secretKey);e.setCache(r),e.isOwn=this.parent.identity.isMe(r.createdBy)}async decryptRelationshipTemplate(e,t){var r;const n=o.CryptoCipher.fromBase64(e.content),i=await this.secrets.decryptTemplate(n,t),a=v.RelationshipTemplateSigned.deserialize(i.toUtf8()),l=g.RelationshipTemplateContentWrapper.deserialize(a.serializedTemplate);if(!await this.secrets.verifyTemplate(o.CoreBuffer.fromUtf8(a.serializedTemplate),a.deviceSignature,l.identity.publicKey))throw s.CoreErrors.general.signatureNotValid("template");return p.CachedRelationshipTemplate.from({content:l.content,createdBy:s.CoreAddress.from(e.createdBy),createdByDevice:s.CoreId.from(e.createdByDevice),createdAt:s.CoreDate.from(e.createdAt),expiresAt:e.expiresAt?s.CoreDate.from(e.expiresAt):void 0,identity:l.identity,maxNumberOfAllocations:null!==(r=e.maxNumberOfAllocations)&&void 0!==r?r:void 0,templateKey:l.templateKey})}async getRelationshipTemplate(e){const t=await this.templates.read(e.toString());if(t)return h.RelationshipTemplate.from(t)}async setRelationshipTemplateMetadata(e,t){const r=e instanceof s.CoreId?e.toString():e.id.toString(),n=await this.templates.read(r);if(!n)throw s.CoreErrors.general.recordNotFound(h.RelationshipTemplate,r.toString());const i=h.RelationshipTemplate.from(n);return i.setMetadata(t),await this.templates.update(n,i),i}async loadPeerRelationshipTemplateByTruncated(e){const t=m.RelationshipTemplateReference.fromTruncated(e);return await this.loadPeerRelationshipTemplateByReference(t)}async loadPeerRelationshipTemplateByReference(e){return await this.loadPeerRelationshipTemplate(e.id,e.key)}async loadPeerRelationshipTemplate(e,t){if(await this.templates.read(e.toString())){const t=await this.updateCacheOfExistingTemplateInDb(e.toString());return this.eventBus.publish(new u.PeerRelationshipTemplateLoadedEvent(this.parent.identity.address.toString(),t)),t}const r=h.RelationshipTemplate.from({id:e,secretKey:t,isOwn:!1});return await this.updateCacheOfTemplate(r),await this.templates.create(r),this.eventBus.publish(new u.PeerRelationshipTemplateLoadedEvent(this.parent.identity.address.toString(),r)),r}}t.RelationshipTemplateController=RelationshipTemplateController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],RelationshipTemplateController.prototype,"updateCacheOfExistingTemplateInDb",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,o.CryptoSecretKey]),i("design:returntype",Promise)],RelationshipTemplateController.prototype,"decryptRelationshipTemplate",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],RelationshipTemplateController.prototype,"setRelationshipTemplateMetadata",null)},8805:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8572:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7215:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateClient=void 0;const n=r(2027);class RelationshipTemplateClient extends n.RESTClientAuthenticate{async getRelationshipTemplates(e){return await this.getPaged("/api/v1/RelationshipTemplates",e)}async getRelationshipTemplate(e){return await this.get(`/api/v1/RelationshipTemplates/${e}`)}async deleteRelationshipTemplate(e){return await this.delete(`/api/v1/RelationshipTemplates/${e}`)}async createRelationshipTemplate(e){return await this.post("/api/v1/RelationshipTemplates",e)}}t.RelationshipTemplateClient=RelationshipTemplateClient},9270:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.validateMaxNumberOfAllocations=t.CachedRelationshipTemplate=void 0;const a=r(194),o=r(2027),s=r(9170),l=r(2016),c=r(3293);let u=class CachedRelationshipTemplate extends o.CoreSerializable{static from(e){return this.fromAny(e)}};function validateMaxNumberOfAllocations(e){if(void 0!==e)return e<=0?"maxNumberOfAllocations must be greater than 0":void 0}t.CachedRelationshipTemplate=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.Identity)],u.prototype,"identity",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],u.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],u.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",c.RelationshipTemplatePublicKey)],u.prototype,"templateKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],u.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],u.prototype,"createdAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreDate)],u.prototype,"expiresAt",void 0),n([(0,a.validate)({nullable:!0,customValidator:validateMaxNumberOfAllocations}),(0,a.serialize)(),i("design:type",Number)],u.prototype,"maxNumberOfAllocations",void 0),t.CachedRelationshipTemplate=u=n([(0,a.type)("CachedRelationshipTemplate")],u),t.validateMaxNumberOfAllocations=validateMaxNumberOfAllocations},1752:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplate=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(4062),u=r(2860),d=r(9270);let p=class RelationshipTemplate extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.secretKey)),(0,s.nameof)((e=>e.isOwn))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static from(e){return this.fromAny(e)}toRelationshipTemplateReference(){return u.RelationshipTemplateReference.from({id:this.id,key:this.secretKey})}truncate(){return this.toRelationshipTemplateReference().truncate()}setCache(e){return this.cache=e,this.cachedAt=c.CoreDate.utc(),this}setMetadata(e){return this.metadata=e,this.metadataModifiedAt=c.CoreDate.utc(),this}};t.RelationshipTemplate=p,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],p.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],p.prototype,"isOwn",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",d.CachedRelationshipTemplate)],p.prototype,"cache",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.CoreDate)],p.prototype,"cachedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],p.prototype,"metadata",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.CoreDate)],p.prototype,"metadataModifiedAt",void 0),t.RelationshipTemplate=p=n([(0,a.type)("RelationshipTemplate")],p)},3778:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendRelationshipTemplateParameters=void 0;const a=r(194),o=r(2027),s=r(9270);let l=class SendRelationshipTemplateParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendRelationshipTemplateParameters=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"expiresAt",void 0),n([(0,a.validate)({nullable:!0,customValidator:s.validateMaxNumberOfAllocations}),(0,a.serialize)(),i("design:type",Number)],l.prototype,"maxNumberOfAllocations",void 0),t.SendRelationshipTemplateParameters=l=n([(0,a.type)("SendRelationshipTemplateParameters")],l)},3250:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateContentWrapper=void 0;const a=r(194),o=r(2027),s=r(2016),l=r(3293);let c=class RelationshipTemplateContentWrapper extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipTemplateContentWrapper=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.Identity)],c.prototype,"identity",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.RelationshipTemplatePublicKey)],c.prototype,"templateKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],c.prototype,"content",void 0),t.RelationshipTemplateContentWrapper=c=n([(0,a.type)("RelationshipTemplateContentWrapper")],c)},3293:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplatePublicKey=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipTemplatePublicKey extends o.CryptoExchangePublicKey{toJSON(e=!0){return{id:this.id.toString(),pub:this.publicKey.toBase64URL(),alg:this.algorithm,"@type":e?"RelationshipTemplatePublicKey":void 0}}toBase64(){return o.CoreBuffer.utf8_base64(this.serialize())}serialize(e=!0){return JSON.stringify(this.toJSON(e))}static preFrom(e){const t=super.preFrom(e);return t.id=e.id,t}static fromJSON(e){return this.fromAny(e)}static from(e){return this.fromAny(e)}};t.RelationshipTemplatePublicKey=l,n([(0,a.serialize)(),(0,a.validate)(),i("design:type",s.CoreId)],l.prototype,"id",void 0),t.RelationshipTemplatePublicKey=l=n([(0,a.type)("RelationshipTemplatePublicKey")],l)},2860:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateReference=void 0;const i=r(194),a=r(2027);let o=class RelationshipTemplateReference extends a.Reference{static preFrom(e){return super.validateId(e,a.BackboneIds.relationshipTemplate),e}static from(e){return super.from(e)}};t.RelationshipTemplateReference=o,t.RelationshipTemplateReference=o=n([(0,i.type)("RelationshipTemplateReference")],o)},3129:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipTemplateSigned=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipTemplateSigned extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipTemplateSigned=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"serializedTemplate",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"deviceSignature",void 0),t.RelationshipTemplateSigned=l=n([(0,a.type)("RelationshipTemplateSigned")],l)},3654:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipSecretController=void 0;const a=r(5172),o=r(2890),s=r(2027),l=r(6555),c=r(1341),u=r(8169),d=r(9270),p=r(3293),h=r(5739);class RelationshipSecretController extends h.SecretController{constructor(e){super(e,s.ControllerName.RelationshipSecret),this.cache=new Map}async getSecret(e){const t=e.toString(),r=this.cache.get(e);if(r)return r;const n=await this.loadActiveSecretByName(t);if(!n)throw l.CoreErrors.general.recordNotFound("CryptoRelationshipRequestSecrets | CryptoRelationshipSecrets",t);if(!(n.secret instanceof o.CryptoRelationshipRequestSecrets||n.secret instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(t);const i=n.secret;return this.cache.set(e,i),i}async createRequestorSecrets(e,t){const r=await o.CryptoRelationshipRequestSecrets.fromPeer(e.templateKey,e.identity.publicKey);await this.storeSecret(r,t.toString(),"");return r.toPublicRequest()}async createTemplatorSecrets(e,t,r){const n=t.templateKey.id.toString(),i=await this.loadActiveSecretByName(n);if(!i)throw l.CoreErrors.general.recordNotFound(o.CryptoExchangeKeypair,n);if(!(i.secret instanceof o.CryptoExchangeKeypair))throw l.CoreErrors.secrets.wrongSecretType(n);const a=i.secret,s=await o.CryptoRelationshipSecrets.fromRelationshipRequest(r,a);return await this.storeSecret(s,e.toString())}async getPublicResponse(e){const t=await this.loadActiveSecretByName(e.toString());if(!t)throw l.CoreErrors.general.recordNotFound(o.CryptoRelationshipSecrets,e.toString());if(!(t.secret instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(t.id.toString());return t.secret.toPublicResponse()}async convertSecrets(e,t){const r=await this.getSecret(e);if(r instanceof o.CryptoRelationshipSecrets)throw l.CoreErrors.secrets.wrongSecretType();const n=await o.CryptoRelationshipSecrets.fromRelationshipResponse(t,r),i=await this.succeedSecretWithName(n,e.toString());return this.cache.set(e,n),i}async deleteSecretForRequest(e){const t=await this.loadActiveSecretByName(`request_to_${e.address}`);return!!t&&await this.deleteSecretById(t.id)}async decryptTemplate(e,t){return await s.CoreCrypto.decrypt(e,t)}async verifyTemplate(e,t,r){return await s.CoreCrypto.verify(e,t,r)}async encryptRequest(e,t){const r=c.CoreUtil.toBuffer(t),n=await this.getSecret(e);if(!(n instanceof o.CryptoRelationshipRequestSecrets))throw l.CoreErrors.secrets.wrongSecretType(n.id);return await n.encryptRequest(r)}async encrypt(e,t){const r=c.CoreUtil.toBuffer(t),n=await this.getSecret(e);if(!(n instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(n.id);return await n.encrypt(r)}async decryptRequest(e,t){const r=await this.getSecret(e);if(!(r instanceof o.CryptoRelationshipRequestSecrets||r instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(e.toString());return await r.decryptRequest(t)}async createTemplateKey(){const e=await u.TransportIds.relationshipTemplateKey.generate(),t=(await this.createExchangeKey(`${e.toString()}`))[0];return p.RelationshipTemplatePublicKey.from({id:e,algorithm:t.algorithm,publicKey:t.publicKey})}async decryptPeer(e,t,r=!1){const n=await this.getSecret(e);if(!(n instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(n.id);return await n.decryptPeer(t,r)}async hasCryptoRelationshipSecrets(e){return await this.getSecret(e)instanceof o.CryptoRelationshipSecrets}async decryptOwn(e,t){const r=await this.getSecret(e);if(!(r instanceof o.CryptoRelationshipSecrets))throw l.CoreErrors.secrets.wrongSecretType(r.id);return await r.decryptOwn(t)}async sign(e,t){const r=c.CoreUtil.toBuffer(t),n=await this.getSecret(e);return await n.sign(r)}async verifyOwn(e,t,r){const n=c.CoreUtil.toBuffer(t),i=await this.getSecret(e);return await i.verifyOwn(n,r)}async verifyPeer(e,t,r){const n=c.CoreUtil.toBuffer(t),i=await this.getSecret(e);if(i instanceof o.CryptoRelationshipRequestSecrets)throw l.CoreErrors.secrets.wrongSecretType(i.id);return await i.verifyPeer(n,r)}}t.RelationshipSecretController=RelationshipSecretController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"getSecret",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,d.CachedRelationshipTemplate,o.CryptoRelationshipPublicRequest]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"createTemplatorSecrets",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"getPublicResponse",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,o.CryptoRelationshipPublicResponse]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"convertSecrets",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,Object]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"encryptRequest",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,Object]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"encrypt",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,o.CryptoCipher]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"decryptRequest",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,o.CryptoCipher,Object]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"decryptPeer",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,o.CryptoCipher]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"decryptOwn",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[s.CoreId,Object,o.CryptoSignature]),i("design:returntype",Promise)],RelationshipSecretController.prototype,"verifyPeer",null)},3666:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipsController=void 0;const a=r(5172),o=r(2890),s=r(4714),l=r(2027),c=r(6555),u=r(1341),d=r(369),p=r(8169),h=r(2205),y=r(1752),g=r(4002),m=r(169),v=r(2182),b=r(8440),w=r(3582),C=r(3771),S=r(3611),_=r(6411),R=r(5289),O=r(5784),T=r(2618),I=r(8174),E=r(3861),D=r(8333),P=r(7262);class RelationshipsController extends l.TransportController{constructor(e,t){super(l.ControllerName.Relationships,e),this.secrets=t}async init(){return await super.init(),this.client=new g.RelationshipClient(this.config,this.parent.authenticator),this.relationships=await this.parent.getSynchronizedCollection(d.DbCollectionName.Relationships),this}async getRelationships(e){const t=await this.relationships.find(e);return this.parseArray(t,v.Relationship)}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getRelationships({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingRelationshipInDb(e.id,e));return await Promise.all(r)}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getRelationships({ids:e.map((e=>e.id))})).value.collect()).map((async e=>{const t=await this.relationships.read(e.id),r=v.Relationship.from(t);return{id:l.CoreId.from(e.id),cache:await this.decryptRelationship(e,r.relationshipSecretId)}}));return await Promise.all(t)}async updateCacheOfExistingRelationshipInDb(e,t){const r=await this.relationships.read(e);if(!r)throw c.CoreErrors.general.recordNotFound(v.Relationship,e);const n=v.Relationship.from(r);return await this.updateCacheOfRelationship(n,t),await this.relationships.update(r,n),n}async getRelationshipToIdentity(e,t){const r={[`${(0,s.nameof)((e=>e.peer))}.${(0,s.nameof)((e=>e.address))}`]:e.toString()};t&&(r[`${(0,s.nameof)((e=>e.status))}`]=t);const n=await this.relationships.findOne(r);if(n)return v.Relationship.from(n)}async getActiveRelationshipToIdentity(e){return await this.getRelationshipToIdentity(e,R.RelationshipStatus.Active)}async getRelationship(e){const t=await this.relationships.read(e.toString());if(t)return v.Relationship.from(t)}async sign(e,t){return await this.secrets.sign(e.relationshipSecretId,t)}async verify(e,t,r){return await this.secrets.verifyPeer(e.relationshipSecretId,t,r)}async verifyIdentity(e,t,r){return await l.CoreCrypto.verify(t,r,e.peer.publicKey)}async sendRelationship(e){const t=(e=b.SendRelationshipParameters.from(e)).template;if(!t.cache)throw this.newCacheEmptyError(y.RelationshipTemplate,t.id.toString());const r=await p.TransportIds.relationshipSecret.generate(),{requestCipher:n,requestContent:i}=await this.prepareRequest(r,t,e.content),a=(await this.client.createRelationship({content:n.toBase64(),relationshipTemplateId:t.id.toString()})).value,o=v.Relationship.fromRequestSent(l.CoreId.from(a.id),t,t.cache.identity,w.RelationshipChange.fromBackbone(a.changes[0],i.content),r);return await this.relationships.create(o),this.eventBus.publish(new h.RelationshipChangedEvent(this.parent.identity.address.toString(),o)),o}async setRelationshipMetadata(e,t){const r=e instanceof l.CoreId?e.toString():e.id.toString(),n=await this.relationships.read(r);if(!n)throw c.CoreErrors.general.recordNotFound(v.Relationship,r.toString());const i=v.Relationship.from(n);return i.metadata=t,i.metadataModifiedAt=l.CoreDate.utc(),await this.relationships.update(n,i),i}async acceptChange(e,t){return await this.completeChange(S.RelationshipChangeStatus.Accepted,e,t)}async rejectChange(e,t){return await this.completeChange(S.RelationshipChangeStatus.Rejected,e,t)}async revokeChange(e,t){return await this.completeChange(S.RelationshipChangeStatus.Revoked,e,t)}async updateCacheOfRelationship(e,t){t||(t=(await this.client.getRelationship(e.id.toString())).value);const r=await this.decryptRelationship(t,e.relationshipSecretId);e.setCache(r)}async decryptRelationship(e,t){const r=l.CoreId.from(e.relationshipTemplateId);this._log.trace(`Parsing relationship template ${r} for ${e.id}...`);const n=await this.parent.relationshipTemplates.getRelationshipTemplate(r);if(!n)throw c.CoreErrors.general.recordNotFound(y.RelationshipTemplate,r.toString());this._log.trace(`Parsing relationship changes of ${e.id}...`);const i=[];for(const n of e.changes)if(n.type===_.RelationshipChangeType.Creation)i.push(this.parseCreationChange(n,t,r));const a=await Promise.all(i);return m.CachedRelationship.from({changes:a,template:n})}async prepareRequest(e,t,r){if(!t.cache)throw this.newCacheEmptyError(y.RelationshipTemplate,t.id.toString());const n=await this.secrets.createRequestorSecrets(t.cache,e),i=T.RelationshipCreationChangeRequestContentWrapper.from({content:r,identity:this.parent.identity.identity,templateId:t.id}),a=i.serialize(),o=u.CoreUtil.toBuffer(a),[s,l]=await Promise.all([this.parent.activeDevice.sign(o),this.secrets.sign(e,o)]),c=I.RelationshipCreationChangeRequestSigned.from({serializedRequest:a,deviceSignature:s,relationshipSignature:l}),d=await this.secrets.encryptRequest(e,c);return{requestCipher:O.RelationshipCreationChangeRequestCipher.from({cipher:d,publicRequestCrypto:n}),requestContent:i}}async applyChangeById(e){const t=(await this.client.getRelationshipChange(e.toString())).value;return await this.applyChange(t)}async applyChange(e){switch(e.type){case _.RelationshipChangeType.Creation:return await this.applyCreationChange(e);case _.RelationshipChangeType.Termination:case _.RelationshipChangeType.TerminationCancellation:default:throw c.CoreErrors.general.notSupported()}}async applyCreationChange(e){const t=await this.relationships.read(e.relationshipId);if(t)return e.response?await this.updatePendingRelationshipWithPeerResponse(t,e):void 0;const r=await this.createNewRelationshipByIncomingCreationChange(e);if(e.response){const t=await this.relationships.read(e.relationshipId);return await this.updatePendingRelationshipWithPeerResponse(t,e)}return r}async parseCreationChange(e,t,r){e.type!==_.RelationshipChangeType.Creation&&this.throwWrongChangeType(e.type);const n=[];n.push(this.decryptCreationChangeRequest(e.request,t,r));const i=await this.secrets.hasCryptoRelationshipSecrets(t);e.response&&i&&n.push(this.decryptCreationChangeResponse(e,t));const[a,o]=await Promise.all(n);return w.RelationshipChange.fromBackbone(e,a.content,null==o?void 0:o.content)}async decryptCreationChangeRequest(e,t,r){if(!e.content)throw this.newEmptyOrInvalidContentError();const n=this.parent.identity.isMe(l.CoreAddress.from(e.createdBy)),i=O.RelationshipCreationChangeRequestCipher.fromBase64(e.content),a=await this.secrets.decryptRequest(t,i.cipher),s=I.RelationshipCreationChangeRequestSigned.deserialize(a.toUtf8());let u;if(u=n?await this.secrets.verifyOwn(t,o.CoreBuffer.fromUtf8(s.serializedRequest),s.relationshipSignature):await this.secrets.verifyPeer(t,o.CoreBuffer.fromUtf8(s.serializedRequest),s.relationshipSignature),!u)throw c.CoreErrors.general.signatureNotValid("relationshipRequest");const d=T.RelationshipCreationChangeRequestContentWrapper.deserialize(s.serializedRequest);if(!d.templateId.equals(r))throw new l.TransportError("The relationship request contains a wrong template id.");return d}async decryptCreationChangeResponse(e,t){if(!e.response)throw this.newChangeResponseMissingError(e.id);if(e.type!==_.RelationshipChangeType.Creation&&this.throwWrongChangeType(e.type),!e.response.content)throw this.newEmptyOrInvalidContentError(e);const r=this.parent.identity.isMe(l.CoreAddress.from(e.response.createdBy)),n=E.RelationshipCreationChangeResponseCipher.fromBase64(e.response.content);let i;i=e.status!==S.RelationshipChangeStatus.Revoked?r?await this.secrets.decryptOwn(t,n.cipher):await this.secrets.decryptPeer(t,n.cipher,!0):await this.secrets.decryptRequest(t,n.cipher);const a=P.RelationshipCreationChangeResponseSigned.deserialize(i.toUtf8());let s;if(s=r?await this.secrets.verifyOwn(t,o.CoreBuffer.fromUtf8(a.serializedResponse),a.relationshipSignature):await this.secrets.verifyPeer(t,o.CoreBuffer.fromUtf8(a.serializedResponse),a.relationshipSignature),!s)throw c.CoreErrors.general.signatureNotValid("relationshipResponse");const u=D.RelationshipCreationChangeResponseContentWrapper.deserialize(a.serializedResponse);if(!u.relationshipId.equals(e.relationshipId))throw new l.TransportError("The relationship response contains a wrong relationship id.");return u}async updatePendingRelationshipWithPeerResponse(e,t){const r=v.Relationship.from(e);if(r.status!==R.RelationshipStatus.Pending)return void this.log.debug("Trying to update non-pending relationship with creation change",t);if(r.cache||await this.updateCacheOfRelationship(r,void 0),!t.response)throw this.newChangeResponseMissingError(t.id);if(!t.response.content)throw this.newEmptyOrInvalidContentError(t);const n=E.RelationshipCreationChangeResponseCipher.fromBase64(t.response.content);if(t.status!==S.RelationshipChangeStatus.Revoked){if(!n.publicResponseCrypto)throw new l.TransportError("The response crypto is missing.");await this.secrets.convertSecrets(r.relationshipSecretId,n.publicResponseCrypto)}const i=await this.decryptCreationChangeResponse(t,r.relationshipSecretId),a=C.RelationshipChangeResponse.fromBackbone(t.response,i.content);if(!r.cache)throw this.newCacheEmptyError(v.Relationship,r.id.toString());switch(r.cache.changes[0].status=t.status,t.status){case S.RelationshipChangeStatus.Accepted:r.toActive(a);break;case S.RelationshipChangeStatus.Rejected:r.toRejected(a);break;case S.RelationshipChangeStatus.Revoked:r.toRevoked(a);break;default:throw c.CoreErrors.general.notSupported()}return await this.relationships.update(e,r),r}async createNewRelationshipByIncomingCreationChange(e){const t=(await this.client.getRelationship(e.relationshipId)).value,r=l.CoreId.from(t.relationshipTemplateId),n=await this.parent.relationshipTemplates.getRelationshipTemplate(r);if(!n)throw c.CoreErrors.general.recordNotFound(y.RelationshipTemplate,r.toString());if(!n.cache)throw this.newCacheEmptyError(y.RelationshipTemplate,n.id.toString());if(!e.request.content)throw this.newEmptyOrInvalidContentError(e);const i=await p.TransportIds.relationshipSecret.generate(),a=O.RelationshipCreationChangeRequestCipher.fromBase64(e.request.content);await this.secrets.createTemplatorSecrets(i,n.cache,a.publicRequestCrypto);const o=await this.decryptCreationChangeRequest(t.changes[0].request,i,r),s=w.RelationshipChange.fromBackbone(e,o.content),u=v.Relationship.fromCreationChangeReceived(t,n,o.identity,s,i);return await this.relationships.create(u),u}async completeChange(e,t,r){const n=await this.relationships.read(t.relationshipId.toString());if(!n)throw c.CoreErrors.general.recordNotFound(v.Relationship,t.relationshipId.toString());const i=v.Relationship.from(n);if(i.cache||await this.updateCacheOfRelationship(i),!i.cache)throw this.newCacheEmptyError(v.Relationship,i.id.toString());const a=i.cache.changes.find((e=>e.id.toString()===t.id.toString()));if(!a)throw c.CoreErrors.general.recordNotFound(w.RelationshipChange,t.id.toString());if(a.status!==S.RelationshipChangeStatus.Pending)throw c.CoreErrors.relationships.wrongChangeStatus(a.status);let o,s;switch(r&&(o=e===S.RelationshipChangeStatus.Revoked?await this.encryptRevokeContent(i,r):await this.encryptAcceptRejectContent(i,r)),e){case S.RelationshipChangeStatus.Accepted:s=(await this.client.acceptRelationshipChange(i.id.toString(),t.id.toString(),o)).value;break;case S.RelationshipChangeStatus.Rejected:s=(await this.client.rejectRelationshipChange(i.id.toString(),t.id.toString(),o)).value;break;case S.RelationshipChangeStatus.Revoked:s=(await this.client.revokeRelationshipChange(i.id.toString(),t.id.toString(),o)).value;break;default:throw new l.TransportError("target change status not supported")}const u=s.changes[s.changes.length-1];return a.response=C.RelationshipChangeResponse.fromBackbone(s.changes[s.changes.length-1].response,r),a.status=u.status,i.status=s.status,await this.relationships.update(n,i),this.eventBus.publish(new h.RelationshipChangedEvent(this.parent.identity.address.toString(),i)),i}async encryptRevokeContent(e,t){const r=D.RelationshipCreationChangeResponseContentWrapper.from({relationshipId:e.id,content:t}).serialize(),n=u.CoreUtil.toBuffer(r),[i,a]=await Promise.all([this.parent.activeDevice.sign(n),this.secrets.sign(e.relationshipSecretId,n)]),o=P.RelationshipCreationChangeResponseSigned.from({serializedResponse:r,deviceSignature:i,relationshipSignature:a}),s=await this.secrets.encryptRequest(e.relationshipSecretId,o);return E.RelationshipCreationChangeResponseCipher.from({cipher:s}).toBase64()}async encryptAcceptRejectContent(e,t){const r=await this.secrets.getPublicResponse(e.relationshipSecretId),n=D.RelationshipCreationChangeResponseContentWrapper.from({relationshipId:e.id,content:t}).serialize(),i=u.CoreUtil.toBuffer(n),[a,o]=await Promise.all([this.parent.activeDevice.sign(i),this.secrets.sign(e.relationshipSecretId,i)]),s=P.RelationshipCreationChangeResponseSigned.from({serializedResponse:n,deviceSignature:a,relationshipSignature:o}),l=await this.secrets.encrypt(e.relationshipSecretId,s);return E.RelationshipCreationChangeResponseCipher.from({cipher:l,publicResponseCrypto:r}).toBase64()}throwWrongChangeType(e){throw new l.TransportError(`The relationship change has the wrong type (${e}) to run this operation`)}newChangeResponseMissingError(e){return new l.TransportError(`The response of the relationship change (${e}) is missing`)}newEmptyOrInvalidContentError(e){return new l.TransportError(`The content property of the relationship change ${null==e?void 0:e.id} is missing or invalid`)}}t.RelationshipsController=RelationshipsController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"updateCacheOfExistingRelationshipInDb",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"setRelationshipMetadata",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"applyChange",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,l.CoreId,l.CoreId]),i("design:returntype",Promise)],RelationshipsController.prototype,"parseCreationChange",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,l.CoreId,l.CoreId]),i("design:returntype",Promise)],RelationshipsController.prototype,"decryptCreationChangeRequest",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,l.CoreId]),i("design:returntype",Promise)],RelationshipsController.prototype,"decryptCreationChangeResponse",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"updatePendingRelationshipWithPeerResponse",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"createNewRelationshipByIncomingCreationChange",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,w.RelationshipChange,Object]),i("design:returntype",Promise)],RelationshipsController.prototype,"completeChange",null)},6164:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7902:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1903:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4002:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipClient=void 0;const n=r(6054);class RelationshipClient extends n.RESTClientAuthenticate{async createRelationship(e){return await this.post("/api/v1/Relationships",e)}async createRelationshipChange(e,t){return await this.post(`/api/v1/Relationships/${e}/Changes`,t)}async acceptRelationshipChange(e,t,r){return await this.put(`/api/v1/Relationships/${e}/Changes/${t}/Accept`,{content:r})}async rejectRelationshipChange(e,t,r){return await this.put(`/api/v1/Relationships/${e}/Changes/${t}/Reject`,{content:r})}async revokeRelationshipChange(e,t,r){return await this.put(`/api/v1/Relationships/${e}/Changes/${t}/Revoke`,{content:r})}async getRelationships(e){return await this.getPaged("/api/v1/Relationships",e)}async getRelationship(e){return await this.get(`/api/v1/Relationships/${e}`)}async getRelationshipChanges(e){return await this.getPaged("/api/v1/Relationships/Changes",e)}async getRelationshipChange(e){return await this.get(`/api/v1/Relationships/Changes/${e}`)}}t.RelationshipClient=RelationshipClient},169:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CachedRelationship=void 0;const a=r(194),o=r(2027),s=r(1752),l=r(3582);let c=class CachedRelationship extends o.CoreSerializable{get creationChange(){return this.changes[0]}static from(e){return this.fromAny(e)}};t.CachedRelationship=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.RelationshipTemplate)],c.prototype,"template",void 0),n([(0,a.validate)(),(0,a.serialize)({type:l.RelationshipChange}),i("design:type",Array)],c.prototype,"changes",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreDate)],c.prototype,"lastMessageSentAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CoreDate)],c.prototype,"lastMessageReceivedAt",void 0),t.CachedRelationship=c=n([(0,a.type)("CachedRelationship")],c)},2182:function(e,t,r){"use strict";var n,i=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Relationship=void 0;const o=r(194),s=r(4714),l=r(2027),c=r(2016),u=r(5289),d=r(169);let p=n=class Relationship extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.relationshipSecretId)),(0,s.nameof)((e=>e.peer)),(0,s.nameof)((e=>e.status))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static fromRequestSent(e,t,r,i,a){const o=d.CachedRelationship.from({changes:[i],template:t});return n.from({id:e,peer:r,status:u.RelationshipStatus.Pending,cache:o,cachedAt:l.CoreDate.utc(),relationshipSecretId:a})}static fromCreationChangeReceived(e,t,r,i,a){const o=d.CachedRelationship.from({changes:[i],template:t});return n.from({id:l.CoreId.from(e.id),relationshipSecretId:a,peer:r,status:u.RelationshipStatus.Pending,cache:o,cachedAt:l.CoreDate.utc()})}toActive(e){if(!this.cache)throw this.newCacheEmptyError();this.cache.changes[0].response=e,this.status=u.RelationshipStatus.Active}toRejected(e){if(!this.cache)throw this.newCacheEmptyError();this.cache.changes[0].response=e,this.status=u.RelationshipStatus.Rejected}toRevoked(e){if(!this.cache)throw this.newCacheEmptyError();this.cache.changes[0].response=e,this.status=u.RelationshipStatus.Revoked}static from(e){return this.fromAny(e)}setCache(e){return this.cache=e,this.cachedAt=l.CoreDate.utc(),this}setMetadata(e){return this.metadata=e,this.metadataModifiedAt=l.CoreDate.utc(),this}newCacheEmptyError(){return new l.TransportError(`The cache of the Relationship with id "${this.id}" is empty.`)}};t.Relationship=p,i([(0,o.validate)(),(0,o.serialize)(),a("design:type",l.CoreId)],p.prototype,"relationshipSecretId",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",c.Identity)],p.prototype,"peer",void 0),i([(0,o.validate)(),(0,o.serialize)(),a("design:type",String)],p.prototype,"status",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",d.CachedRelationship)],p.prototype,"cache",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreDate)],p.prototype,"cachedAt",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",Object)],p.prototype,"metadata",void 0),i([(0,o.validate)({nullable:!0}),(0,o.serialize)(),a("design:type",l.CoreDate)],p.prototype,"metadataModifiedAt",void 0),t.Relationship=p=n=i([(0,o.type)("Relationship")],p)},8440:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendRelationshipParameters=void 0;const a=r(194),o=r(2027),s=r(1752);let l=class SendRelationshipParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendRelationshipParameters=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.RelationshipTemplate)],l.prototype,"template",void 0),t.SendRelationshipParameters=l=n([(0,a.type)("SendRelationshipParameters")],l)},5289:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipStatus=void 0,function(e){e.Pending="Pending",e.Active="Active",e.Rejected="Rejected",e.Revoked="Revoked",e.Terminating="Terminating",e.Terminated="Terminated"}(r||(t.RelationshipStatus=r={}))},3582:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChange=void 0;const a=r(194),o=r(2027),s=r(9170),l=r(1512),c=r(3771);r(3611),r(6411);let u=class RelationshipChange extends o.CoreSerializable{static fromBackbone(e,t,r){const n=this.from({id:s.CoreId.from(e.id),relationshipId:s.CoreId.from(e.relationshipId),type:e.type,status:e.status,request:l.RelationshipChangeRequest.fromBackbone(e.request,t)});return e.response&&(n.response=c.RelationshipChangeResponse.fromBackbone(e.response,r)),n}static from(e){return this.fromAny(e)}};t.RelationshipChange=u,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],u.prototype,"id",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],u.prototype,"relationshipId",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",l.RelationshipChangeRequest)],u.prototype,"request",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",c.RelationshipChangeResponse)],u.prototype,"response",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],u.prototype,"status",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],u.prototype,"type",void 0),t.RelationshipChange=u=n([(0,a.type)("RelationshipChange")],u)},1512:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangeRequest=void 0;const a=r(194),o=r(2027),s=r(9170);let l=class RelationshipChangeRequest extends o.CoreSerializable{static fromBackbone(e,t){return this.from({createdBy:o.CoreAddress.from(e.createdBy),createdByDevice:s.CoreId.from(e.createdByDevice),createdAt:o.CoreDate.from(e.createdAt),content:t})}static from(e){return this.fromAny(e)}};t.RelationshipChangeRequest=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],l.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],l.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"createdAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),t.RelationshipChangeRequest=l=n([(0,a.type)("RelationshipChangeRequest")],l)},3771:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangeResponse=void 0;const a=r(194),o=r(2027),s=r(9170);let l=class RelationshipChangeResponse extends o.CoreSerializable{static fromBackbone(e,t){return this.from({createdBy:o.CoreAddress.from(e.createdBy),createdByDevice:s.CoreId.from(e.createdByDevice),createdAt:o.CoreDate.from(e.createdAt),content:t})}static from(e){return this.fromAny(e)}};t.RelationshipChangeResponse=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],l.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],l.prototype,"createdByDevice",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],l.prototype,"createdAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),t.RelationshipChangeResponse=l=n([(0,a.type)("RelationshipChangeResponse")],l)},3611:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangeStatus=void 0,function(e){e.Pending="Pending",e.Rejected="Rejected",e.Revoked="Revoked",e.Accepted="Accepted"}(r||(t.RelationshipChangeStatus=r={}))},6411:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipChangeType=void 0,function(e){e.Creation="Creation",e.Termination="Termination",e.TerminationCancellation="TerminationCancellation"}(r||(t.RelationshipChangeType=r={}))},5784:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeRequestCipher=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipCreationChangeRequestCipher extends s.CoreSerializable{static from(e){return this.fromAny(e)}static fromBase64(e){return super.fromBase64T(e)}};t.RelationshipCreationChangeRequestCipher=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoCipher)],l.prototype,"cipher",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoRelationshipPublicRequest)],l.prototype,"publicRequestCrypto",void 0),t.RelationshipCreationChangeRequestCipher=l=n([(0,a.type)("RelationshipCreationChangeRequestCipher")],l)},2618:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeRequestContentWrapper=void 0;const a=r(194),o=r(2027),s=r(2016);let l=class RelationshipCreationChangeRequestContentWrapper extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipCreationChangeRequestContentWrapper=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.Identity)],l.prototype,"identity",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],l.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],l.prototype,"templateId",void 0),t.RelationshipCreationChangeRequestContentWrapper=l=n([(0,a.type)("RelationshipCreationChangeRequestContentWrapper")],l)},8174:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeRequestSigned=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipCreationChangeRequestSigned extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipCreationChangeRequestSigned=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"serializedRequest",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"deviceSignature",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"relationshipSignature",void 0),t.RelationshipCreationChangeRequestSigned=l=n([(0,a.type)("RelationshipCreationChangeRequestSigned")],l)},3861:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeResponseCipher=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipCreationChangeResponseCipher extends s.CoreSerializable{static from(e){return this.fromAny(e)}static fromBase64(e){return super.fromBase64T(e)}};t.RelationshipCreationChangeResponseCipher=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoCipher)],l.prototype,"cipher",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",o.CryptoRelationshipPublicResponse)],l.prototype,"publicResponseCrypto",void 0),t.RelationshipCreationChangeResponseCipher=l=n([(0,a.type)("RelationshipCreationChangeResponseCipher")],l)},8333:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeResponseContentWrapper=void 0;const a=r(194),o=r(2027);let s=class RelationshipCreationChangeResponseContentWrapper extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipCreationChangeResponseContentWrapper=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],s.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],s.prototype,"relationshipId",void 0),t.RelationshipCreationChangeResponseContentWrapper=s=n([(0,a.type)("RelationshipCreationChangeResponseContentWrapper")],s)},7262:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RelationshipCreationChangeResponseSigned=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class RelationshipCreationChangeResponseSigned extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.RelationshipCreationChangeResponseSigned=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],l.prototype,"serializedResponse",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"deviceSignature",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSignature)],l.prototype,"relationshipSignature",void 0),t.RelationshipCreationChangeResponseSigned=l=n([(0,a.type)("RelationshipCreationChangeResponseSigned")],l)},5739:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SecretController=t.SecretBaseKeyType=void 0;const a=r(194),o=r(5172),s=r(2890),l=r(2027),c=r(369),u=r(2508),d=r(2556),p=r(9423),h=r(7636);var y;!function(e){e.Random="random",e.Password="password",e.External="external"}(y||(t.SecretBaseKeyType=y={}));class SecretController extends u.TransportController{constructor(e,t=u.ControllerName.Secret){super(t,e),this.nonce=0}async init(){await super.init(),this.secrets=await this.parent.getSynchronizedCollection(c.DbCollectionName.Secrets);const e=await this.parent.info.get(SecretController.secretNonceKey);return e&&(this.nonce=e),this}async storeSecret(e,t,r="",n){const i=e.serialize(),a=s.CoreBuffer.fromUtf8(i),o=await this.increaseNonce(),c=await l.CoreCrypto.deriveKeyFromBase(await this.getBaseKey(),o,SecretController.secretContext),u=await l.CoreCrypto.encrypt(a,c),d=l.CoreDate.utc(),h={cipher:u,createdAt:d,name:t,description:r,id:await l.TransportIds.secret.generate(),nonce:o,validFrom:d,validTo:n,active:!0},y=p.SecretContainerCipher.from(h);return this.log.trace(`Created secret id:${y.id} name:${y.name} on ${y.createdAt.toISOString()}.`),await this.secrets.create(y),y}async loadSecretsByName(e){const t=await this.secrets.find({name:e}),r=[];for(const e of t){const t=p.SecretContainerCipher.from(e),n=await this.loadSecretById(t.id);n&&r.push(n)}return r}async loadActiveSecretByName(e){const t=await this.getActiveSecretContainerByName(e);if(!t)return;return await this.loadSecretById(t.id)}async getActiveSecretContainerByName(e){const t=await this.secrets.find({name:e,active:!0});if(!t.length)return;t.length>1&&this.log.warn(`More than one active secret has been found for secret name '${e}'.`);return p.SecretContainerCipher.from(t[0])}async succeedSecretWithName(e,t,r="",n){const i=await this.secrets.findOne({name:t,active:!0});if(i){const e=p.SecretContainerCipher.from(i);e.validTo=l.CoreDate.utc(),e.active=!1,await this.secrets.update(i,e)}return await this.storeSecret(e,t,r,n)}async decryptSecret(e){const t=await this.getBaseKey(),r=await l.CoreCrypto.deriveKeyFromBase(t,e.nonce?e.nonce:0,SecretController.secretContext),n=(await l.CoreCrypto.decrypt(e.cipher,r)).toUtf8(),i=a.Serializable.deserializeUnknown(n),o=h.SecretContainerPlain.from({id:e.id,createdAt:e.createdAt,description:e.description,nonce:e.nonce,name:e.name,secret:i,active:e.active,validFrom:e.validFrom,validTo:e.validTo});return this.log.trace(`Accessed secret id:${o.id} name:${o.name} on ${l.CoreDate.utc().toISOString()}.`),o}async loadSecretById(e){const t=await this.secrets.findOne({id:e.toString()});if(!t)return;const r=p.SecretContainerCipher.from(t);return await this.decryptSecret(r)}async deleteSecretById(e){const t=await this.secrets.findOne({id:e.toString()});return!!t&&(await this.secrets.delete({id:e}),this.log.trace(`Deleted secret id:${t.id} name:${t.name} on ${l.CoreDate.utc().toISOString()}.`),!0)}async createExchangeKey(e="",t="",r){const n=await l.CoreCrypto.generateExchangeKeypair(),i=await this.storeSecret(n,e,t,r);return[n.publicKey,i]}async getBaseKey(){if(this.baseKey)return this.baseKey;const e=await this.parent.activeDevice.secrets.loadSecret(d.DeviceSecretType.SharedSecretBaseKey);if(!e)throw l.CoreErrors.general.recordNotFound(s.CryptoSecretKey,d.DeviceSecretType.SharedSecretBaseKey);return this.baseKey=e.secret,this.baseKey}async increaseNonce(){const e=this.nonce++;return await this.parent.info.set(SecretController.secretNonceKey,e),e}}t.SecretController=SecretController,SecretController.secretContext="SECRET01",SecretController.secretNonceKey="secret_lastnonce",n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",Promise)],SecretController.prototype,"getBaseKey",null)},9423:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SecretContainerCipher=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(6564),c=r(4062);let u=class SecretContainerCipher extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.name)),(0,s.nameof)((e=>e.description)),(0,s.nameof)((e=>e.createdAt)),(0,s.nameof)((e=>e.validFrom)),(0,s.nameof)((e=>e.validTo)),(0,s.nameof)((e=>e.nonce)),(0,s.nameof)((e=>e.active)),(0,s.nameof)((e=>e.cipher))],this.name="",this.description=""}static from(e){return this.fromAny(e)}};t.SecretContainerCipher=u,n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],u.prototype,"name",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],u.prototype,"description",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",c.CoreDate)],u.prototype,"createdAt",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",c.CoreDate)],u.prototype,"validFrom",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",c.CoreDate)],u.prototype,"validTo",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",Number)],u.prototype,"nonce",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",Boolean)],u.prototype,"active",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CryptoCipher)],u.prototype,"cipher",void 0),t.SecretContainerCipher=u=n([(0,a.type)("SecretContainerCipher")],u)},7636:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SecretContainerPlain=void 0;const a=r(194),o=r(2027);let s=class SecretContainerPlain extends o.CoreSerializable{constructor(){super(...arguments),this.name="",this.description=""}static from(e){return this.fromAny(e)}};t.SecretContainerPlain=s,n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CoreId)],s.prototype,"id",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],s.prototype,"name",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",String)],s.prototype,"description",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CoreDate)],s.prototype,"createdAt",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",o.CoreDate)],s.prototype,"validFrom",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",o.CoreDate)],s.prototype,"validTo",void 0),n([(0,a.serialize)(),(0,a.validate)({nullable:!0}),i("design:type",Number)],s.prototype,"nonce",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",Boolean)],s.prototype,"active",void 0),n([(0,a.serialize)(),(0,a.validate)(),i("design:type",a.Serializable)],s.prototype,"secret",void 0),t.SecretContainerPlain=s=n([(0,a.type)("SecretContainerPlain")],s)},9267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChangedItems=void 0;t.ChangedItems=class ChangedItems{constructor(e=[],t=[]){this.relationships=e,this.messages=t}addRelationship(e){this.relationships.push(e)}addMessage(e){this.messages.push(e)}}},8189:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DatawalletModificationMapper=void 0;const n=r(2027),i=r(9750);t.DatawalletModificationMapper=class DatawalletModificationMapper{static async fromBackboneDatawalletModification(e,t,r){let a,o;switch(e.type){case"Create":a=i.DatawalletModificationType.Create;break;case"Update":a=i.DatawalletModificationType.Update;break;case"Delete":a=i.DatawalletModificationType.Delete;break;case"CacheChanged":a=i.DatawalletModificationType.CacheChanged;break;default:throw new n.TransportError("Unsupported DatawalletModificationType '${backboneDatawalletModification.type}'")}switch(e.payloadCategory){case"TechnicalData":o=i.DatawalletModificationCategory.TechnicalData;break;case"Userdata":o=i.DatawalletModificationCategory.Userdata;break;case"Metadata":o=i.DatawalletModificationCategory.Metadata;break;case null:o=void 0;break;default:throw new n.TransportError(`Unsupported DatawalletModificationCategory '${e.payloadCategory}'`)}return i.DatawalletModification.from({localId:await n.TransportIds.datawalletModification.generate(),objectIdentifier:n.CoreId.from(e.objectIdentifier),payloadCategory:o,collection:e.collection,type:a,payload:t,datawalletVersion:r})}static toCreateDatawalletModificationsRequestItem(e,t){var r;return{objectIdentifier:e.objectIdentifier.toString(),payloadCategory:e.payloadCategory,collection:e.collection,type:e.type,encryptedPayload:t,datawalletVersion:null!==(r=e.datawalletVersion)&&void 0!==r?r:0}}}},3132:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CacheFetcher=t.DatawalletModificationsProcessor=void 0;const o=r(5172),s=a(r(6486)),l=r(2027),c=r(369),u=r(9873),d=r(6614),p=r(1752),h=r(2182),y=r(4102),g=r(307),m=r(9750);class DatawalletModificationsProcessor{get log(){return this.logger}constructor(e,t,r,n,i){var a,o,l,u;this.cacheFetcher=t,this.collectionProvider=r,this.logger=n,this.collectionsWithCacheableItems=[c.DbCollectionName.Files,c.DbCollectionName.Messages,c.DbCollectionName.Relationships,c.DbCollectionName.RelationshipTemplates,c.DbCollectionName.Tokens];const d=s.default.groupBy(e,(e=>e.type));this.creates=null!==(a=d[m.DatawalletModificationType.Create])&&void 0!==a?a:[],this.updates=null!==(o=d[m.DatawalletModificationType.Update])&&void 0!==o?o:[],this.deletes=null!==(l=d[m.DatawalletModificationType.Delete])&&void 0!==l?l:[],this.cacheChanges=null!==(u=d[m.DatawalletModificationType.CacheChanged])&&void 0!==u?u:[];const p=this.creates.length+this.updates.length+this.deletes.length+this.cacheChanges.length;this.syncStep=i.createStep(g.SyncStep.DatawalletSyncProcessing,p)}async execute(){await this.applyCreates(),await this.applyUpdates(),await this.applyCacheChanges(),await this.applyDeletes(),this.syncStep.finish()}async applyCreates(){if(0===this.creates.length)return;const e=s.default.groupBy(this.creates,(e=>e.objectIdentifier));for(const t in e){const r=e[t],n=r[0].collection,i=await this.collectionProvider.getCollection(n);let a={id:t};for(const e of r)a={...a,...e.payload};const o=l.CoreSerializable.fromUnknown(a),s=await i.read(t);if(s){const e={...l.CoreSerializable.fromUnknown(s).toJSON(),...o.toJSON()};await i.update(s,e)}else await this.simulateCacheChangeForCreate(n,t),await i.create(o);this.syncStep.progress()}}async simulateCacheChangeForCreate(e,t){if(!this.collectionsWithCacheableItems.includes(e))return;const r=m.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:m.DatawalletModificationType.CacheChanged,collection:e,objectIdentifier:l.CoreId.from(t)});this.cacheChanges.push(r),this.syncStep.incrementTotalNumberOfItems()}async applyUpdates(){if(0!==this.updates.length)for(const e of this.updates){const t=await this.collectionProvider.getCollection(e.collection),r=await t.read(e.objectIdentifier.toString());if(!r)throw new l.TransportError("Document to update was not found.");const n={...l.CoreSerializable.fromUnknown(r).toJSON(),...e.payload};await t.update(r,n),this.syncStep.progress()}}async applyCacheChanges(){if(0===this.cacheChanges.length)return;this.ensureAllItemsAreCacheable();const e=this.groupCacheChangesByCollection(this.cacheChanges),t=await this.cacheFetcher.fetchCacheFor({files:e.fileIds,messages:e.messageIds,relationshipTemplates:e.relationshipTemplateIds,tokens:e.tokenIds});await this.saveNewCaches(t.files,c.DbCollectionName.Files,u.File),await this.saveNewCaches(t.messages,c.DbCollectionName.Messages,d.Message),await this.saveNewCaches(t.relationshipTemplates,c.DbCollectionName.RelationshipTemplates,p.RelationshipTemplate),await this.saveNewCaches(t.tokens,c.DbCollectionName.Tokens,y.Token);const r=await this.cacheFetcher.fetchCacheFor({relationships:e.relationshipIds});await this.saveNewCaches(r.relationships,c.DbCollectionName.Relationships,h.Relationship)}ensureAllItemsAreCacheable(){const e=this.cacheChanges.map((e=>e.collection)),t=[...new Set(e)].filter((e=>!this.collectionsWithCacheableItems.includes(e)));if(t.length>0)throw l.CoreErrors.datawallet.unsupportedModification("unsupportedCacheChangedModificationCollection",t)}groupCacheChangesByCollection(e){var t,r,n,i,a;const o=s.default.groupBy(e,(e=>e.collection)),l=(null!==(t=o[c.DbCollectionName.Files])&&void 0!==t?t:[]).map((e=>e.objectIdentifier)),u=(null!==(r=o[c.DbCollectionName.Messages])&&void 0!==r?r:[]).map((e=>e.objectIdentifier)),d=(null!==(n=o[c.DbCollectionName.Relationships])&&void 0!==n?n:[]).map((e=>e.objectIdentifier));return{fileIds:l,messageIds:u,relationshipTemplateIds:(null!==(i=o[c.DbCollectionName.RelationshipTemplates])&&void 0!==i?i:[]).map((e=>e.objectIdentifier)),tokenIds:(null!==(a=o[c.DbCollectionName.Tokens])&&void 0!==a?a:[]).map((e=>e.objectIdentifier)),relationshipIds:d}}async saveNewCaches(e,t,r){if(0===e.length)return;const n=await this.collectionProvider.getCollection(t);await Promise.all(e.map((async e=>{const t=await n.read(e.id.toString()),i=r.from(t);i.setCache(e.cache),await n.update(t,i),this.syncStep.progress()})))}async applyDeletes(){if(0!==this.deletes.length)for(const e of this.deletes){const t=await this.collectionProvider.getCollection(e.collection);await t.delete({id:e.objectIdentifier.toString()}),this.syncStep.progress()}}}t.DatawalletModificationsProcessor=DatawalletModificationsProcessor,n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",void 0)],DatawalletModificationsProcessor.prototype,"ensureAllItemsAreCacheable",null);t.CacheFetcher=class CacheFetcher{constructor(e,t,r,n,i){this.fileController=e,this.messageController=t,this.relationshipTemplateController=r,this.relationshipController=n,this.tokenController=i}async fetchCacheFor(e){const t=await Promise.all([this.fetchCaches(this.fileController,e.files),this.fetchCaches(this.messageController,e.messages),this.fetchCaches(this.relationshipController,e.relationships),this.fetchCaches(this.relationshipTemplateController,e.relationshipTemplates),this.fetchCaches(this.tokenController,e.tokens)]);return{files:t[0],messages:t[1],relationships:t[2],relationshipTemplates:t[3],tokens:t[4]}}async fetchCaches(e,t){if(!t)return[];return await e.fetchCaches(t)}}},9761:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExternalEventsProcessor=void 0;const n=r(2027),i=r(2205),a=r(9267),o=r(307);class ExternalEventsProcessor{constructor(e,t,r,i,s,l){this.messagesController=e,this.relationshipsController=t,this.externalEvents=r,this.eventBus=s,this.ownAddress=l,this.changedItems=new a.ChangedItems,this.results=[],this.log=n.TransportLoggerFactory.getLogger(ExternalEventsProcessor),this.syncStep=i.createStep(o.SyncStep.ExternalEventsProcessing,r.length)}async execute(){for(const e of this.externalEvents)try{switch(e.type){case"MessageReceived":await this.applyMessageReceivedEvent(e);break;case"MessageDelivered":await this.applyMessageDeliveredEvent(e);break;case"RelationshipChangeCreated":await this.applyRelationshipChangeCreatedEvent(e);break;case"RelationshipChangeCompleted":await this.applyRelationshipChangeCompletedEvent(e);break;default:throw new n.TransportError(`'${e.type}' is not a supported external event type.`)}this.results.push({externalEventId:e.id})}catch(t){let r;this.log.error("There was an error while trying to apply an external event: ",t),r=t.code?t.code:t.message?t.message:JSON.stringify(t),this.results.push({externalEventId:e.id,errorCode:r})}finally{this.syncStep.progress()}}async applyRelationshipChangeCompletedEvent(e){const t=e.payload,r=await this.relationshipsController.applyChangeById(t.changeId);r&&(this.eventBus.publish(new i.RelationshipChangedEvent(this.ownAddress,r)),this.changedItems.addRelationship(r))}async applyRelationshipChangeCreatedEvent(e){const t=e.payload,r=await this.relationshipsController.applyChangeById(t.changeId);r&&(this.eventBus.publish(new i.RelationshipChangedEvent(this.ownAddress,r)),this.changedItems.addRelationship(r))}async applyMessageDeliveredEvent(e){const t=e.payload,r=(await this.messagesController.updateCache([t.id]))[0];this.eventBus.publish(new i.MessageDeliveredEvent(this.ownAddress,r)),this.changedItems.addMessage(r)}async applyMessageReceivedEvent(e){const t=e.payload,r=await this.messagesController.loadPeerMessage(n.CoreId.from(t.id));this.eventBus.publish(new i.MessageReceivedEvent(this.ownAddress,r)),this.changedItems.addMessage(r)}}t.ExternalEventsProcessor=ExternalEventsProcessor},307:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncStep=t.SyncProgressReporterStep=t.SyncProgressReporter=void 0;const n=r(2027);class SyncProgressReporter extends n.ProgressReporter{static fromCallback(e){return new SyncProgressReporter(e)}}t.SyncProgressReporter=SyncProgressReporter;class SyncProgressReporterStep extends n.ProgressReporterStep{}var i;t.SyncProgressReporterStep=SyncProgressReporterStep,function(e){e.Sync="sync",e.DatawalletSync="sync:datawallet",e.DatawalletSyncDownloading="sync:datawallet:downloading",e.DatawalletSyncDecryption="sync:datawallet:decrypting",e.DatawalletSyncProcessing="sync:datawallet:processing",e.ExternalEventsSync="sync:externalEvents",e.ExternalEventsSyncDownloading="sync:externalEvents:downloading",e.ExternalEventsProcessing="sync:externalEvents:processing"}(i||(t.SyncStep=i={}))},1295:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SyncController=void 0;const a=r(5172),o=r(2027),s=r(5079),l=r(7596),c=r(9267),u=r(8189),d=r(3132),p=r(9761),h=r(9750),y=r(9258),g=r(2864),m=r(307);class SyncController extends o.TransportController{get cacheFetcher(){return this._cacheFetcher||(this._cacheFetcher=new d.CacheFetcher(this.parent.files,this.parent.messages,this.parent.relationshipTemplates,this.parent.relationships,this.parent.tokens)),this._cacheFetcher}constructor(e,t,r,n){var i;super(o.ControllerName.Sync,e),this.unpushedDatawalletModifications=r,this.datawalletEnabled=n,this.client=null!==(i=t.syncClient)&&void 0!==i?i:new l.SyncClient(this.config,this.parent.authenticator),this.identityMigrations=new g.IdentityMigrations(this.parent),this.deviceMigrations=new y.DeviceMigrations(this.parent)}async init(){return await super.init(),this.syncInfo=await this.db.getMap("SyncInfo"),this}async sync(e="Everything",t){var r;if(null===(r=this.currentSync)||void 0===r?void 0:r.includes(e))return await this.currentSync.promise;if(this.currentSync&&!this.currentSync.includes(e))return await this.currentSync.promise.catch((()=>{})),await this.sync(e,t);const n=this._syncAndResyncDatawallet(e,t);this.currentSync=new LocalSyncRun(n,e);try{return await this.currentSync.promise}finally{this.currentSync=void 0}}async _syncAndResyncDatawallet(e="Everything",t){try{return await this._sync(e,t)}finally{this.datawalletEnabled&&await this.unpushedDatawalletModifications.exists()&&await this.syncDatawallet(t).catch((e=>this.log.error(e)))}}async _sync(e,t){const r=t.createStep(m.SyncStep.Sync,1);if("OnlyDatawallet"===e){const e=await this.syncDatawallet(t);return r.finish(),e}const n=await this.syncExternalEvents(t);if(await this.setLastCompletedSyncTime(),n.externalEventResults.some((e=>void 0!==e.errorCode)))throw new o.CoreError("error.transport.errorWhileApplyingExternalEvents",n.externalEventResults.filter((e=>void 0!==e.errorCode)).map((e=>e.errorCode)).join(" | "));return r.finish(),this.datawalletEnabled&&await this.unpushedDatawalletModifications.exists()&&await this.syncDatawallet(t).catch((e=>this.log.error(e))),n.changedItems}async syncExternalEvents(e){if(!await this.startExternalEventsSyncRun())return await this.syncDatawallet(e),{changedItems:new c.ChangedItems,externalEventResults:[]};await this.applyIncomingDatawalletModifications(e);const t=await this.applyIncomingExternalEvents(e);return await this.finalizeExternalEventsSyncRun(t.externalEventResults),t}async syncDatawallet(e){if(!this.datawalletEnabled)return;const t=await this.getIdentityDatawalletVersion();if(this.config.supportedDatawalletVersion<t)throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion,t);this.log.trace("Synchronization of Datawallet events started...");try{await this.applyIncomingDatawalletModifications(e),await this.pushLocalDatawalletModifications(),await this.setLastCompletedDatawalletSyncTime()}catch(e){const r="error.platform.validation.datawallet.insufficientSupportedDatawalletVersion";if(!(e instanceof o.RequestError)||e.code!==r)throw e;throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion,t)}this.log.trace("Synchronization of Datawallet events ended..."),await this.checkDatawalletVersion(t)}async checkDatawalletVersion(e){var t;if(this.config.supportedDatawalletVersion<e)throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion,e);this.config.supportedDatawalletVersion>e&&await this.upgradeIdentityDatawalletVersion(e,this.config.supportedDatawalletVersion);const r=null!==(t=this.parent.activeDevice.device.datawalletVersion)&&void 0!==t?t:0;r<e&&await this.upgradeDeviceDatawalletVersion(r,this.config.supportedDatawalletVersion)}async upgradeIdentityDatawalletVersion(e,t){if(e!==t){if(this.config.supportedDatawalletVersion<t)throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(t,e);if(e>t)throw o.CoreErrors.datawallet.currentBiggerThanTarget(e,t);for(;e<t;){e++,await this.startDatawalletVersionUpgradeSyncRun();const t=this.identityMigrations[`v${e}`];if(!t)throw this.newNoMigrationAvailableError(e);await t.call(this.identityMigrations),await this.finalizeDatawalletVersionUpgradeSyncRun(e)}}}async upgradeDeviceDatawalletVersion(e,t){if(e!==t){if(this.config.supportedDatawalletVersion<t)throw o.CoreErrors.datawallet.insufficientSupportedDatawalletVersion(t,e);if(e>t)throw o.CoreErrors.datawallet.currentBiggerThanTarget(e,t);for(;e<t;){e++;const t=this.deviceMigrations[`v${e}`];if(!t)throw this.newNoMigrationAvailableError(e);await t.call(this.deviceMigrations),await this.parent.activeDevice.update({datawalletVersion:e})}}}async applyIncomingDatawalletModifications(e){const t=e.createStep(m.SyncStep.DatawalletSync,1),r=e.createStep(m.SyncStep.DatawalletSyncDownloading),n=await this.client.getDatawalletModifications({localIndex:await this.getLocalDatawalletModificationIndex()},(e=>r.manualReport(e))),i=await n.value.collect();if(0===i.length)return void t.finish();const a=await this.decryptDatawalletModifications(i,e);this.log.trace(`${a.length} incoming modifications found`);const s=new d.DatawalletModificationsProcessor(a,this.cacheFetcher,this.db,o.TransportLoggerFactory.getLogger(d.DatawalletModificationsProcessor),e);await s.execute(),this.log.trace(`${a.length} incoming modifications executed`,a),await this.updateLocalDatawalletModificationIndex(i.sort(descending)[0].index),t.finish()}async promiseAllWithProgess(e,t){t(0);let r=0;for(const n of e)n.then((()=>{r++;const n=Math.round(r/e.length*100);t(n)}));return await Promise.all(e)}async decryptDatawalletModifications(e,t){const r=e.map((e=>this.decryptDatawalletModification(e))),n=t.createStep(m.SyncStep.DatawalletSyncDecryption);return await this.promiseAllWithProgess(r,(e=>n.manualReport(e)))}async decryptDatawalletModification(e){const t=await this.parent.activeDevice.secrets.decryptDatawalletModificationPayload(e.encryptedPayload,e.index);return await u.DatawalletModificationMapper.fromBackboneDatawalletModification(e,t,this.config.supportedDatawalletVersion)}async pushLocalDatawalletModifications(){const{backboneModifications:e,localModificationIds:t}=await this.prepareLocalDatawalletModificationsForPush();if(0===e.length)return;const r=await this.client.createDatawalletModifications({localIndex:await this.getLocalDatawalletModificationIndex(),modifications:e});await this.deleteUnpushedDatawalletModifications(t),await this.updateLocalDatawalletModificationIndex(r.value.newIndex)}async prepareLocalDatawalletModificationsForPush(){const e=[],t=[];if(!this.datawalletEnabled)return{backboneModifications:e,localModificationIds:t};const r=this.parseArray(await this.unpushedDatawalletModifications.list(),h.DatawalletModification),n=await this.getLocalDatawalletModificationIndex();let i="number"!=typeof n?0:n+1;for(const n of r){const r=await this.parent.activeDevice.secrets.encryptDatawalletModificationPayload(n,i++),a=u.DatawalletModificationMapper.toCreateDatawalletModificationsRequestItem(n,r);t.push(n.localId),e.push(a)}return{backboneModifications:e,localModificationIds:t}}async deleteUnpushedDatawalletModifications(e){for(const t of e)await this.unpushedDatawalletModifications.delete({localId:t.toString()})}async setInititalDatawalletVersion(e){await this.startDatawalletVersionUpgradeSyncRun(),await this.finalizeDatawalletVersionUpgradeSyncRun(e)}async getIdentityDatawalletVersion(){return(await this.client.getDatawallet()).value.version}async startExternalEventsSyncRun(){var e;const t=await this.client.startSyncRun({type:s.SyncRunType.ExternalEventSync});return t.value.status!==s.StartSyncRunStatus.NoNewEvents&&(this.currentSyncRun=null!==(e=t.value.syncRun)&&void 0!==e?e:void 0,void 0!==this.currentSyncRun)}async startDatawalletVersionUpgradeSyncRun(){var e;const t=await this.client.startSyncRun({type:s.SyncRunType.DatawalletVersionUpgrade});return this.currentSyncRun=null!==(e=t.value.syncRun)&&void 0!==e?e:void 0,void 0!==this.currentSyncRun}async applyIncomingExternalEvents(e){const t=e.createStep(m.SyncStep.ExternalEventsSync,1),r=e.createStep(m.SyncStep.ExternalEventsSyncDownloading),n=await this.client.getExternalEventsOfSyncRun(this.currentSyncRun.id.toString(),(e=>r.manualReport(e)));if(n.isError)throw n.error;const i=await n.value.collect(),a=new p.ExternalEventsProcessor(this.parent.messages,this.parent.relationships,i,e,this.eventBus,this.parent.identity.address.toString());return await a.execute(),t.finish(),{externalEventResults:a.results,changedItems:a.changedItems}}async finalizeExternalEventsSyncRun(e){if(!this.currentSyncRun)throw new o.TransportError("There is no active sync run to finalize");const{backboneModifications:t,localModificationIds:r}=await this.prepareLocalDatawalletModificationsForPush();await this.client.finalizeExternalEventSync(this.currentSyncRun.id.toString(),{datawalletModifications:t,externalEventResults:e}),await this.deleteUnpushedDatawalletModifications(r);const n=(await this.getLocalDatawalletModificationIndex()||-1)+t.length;await this.updateLocalDatawalletModificationIndex(n),this.currentSyncRun=void 0}async finalizeDatawalletVersionUpgradeSyncRun(e){if(!this.currentSyncRun)throw new o.TransportError("There is no active sync run to finalize");const{backboneModifications:t,localModificationIds:r}=await this.prepareLocalDatawalletModificationsForPush(),n=await this.client.finalizeDatawalletVersionUpgrade(this.currentSyncRun.id.toString(),{newDatawalletVersion:e,datawalletModifications:t});if(n.isError)throw n.error;await this.deleteUnpushedDatawalletModifications(r);const i=(await this.getLocalDatawalletModificationIndex()||-1)+t.length;await this.updateLocalDatawalletModificationIndex(i),this.currentSyncRun=void 0}async getLocalDatawalletModificationIndex(){return await this.syncInfo.get("localDatawalletModificationIndex")}async updateLocalDatawalletModificationIndex(e){await this.syncInfo.set("localDatawalletModificationIndex",e)}async getSyncTimeByName(e){const t=await this.syncInfo.get(`SyncTime-${e}`);return t?o.CoreDate.from(t):void 0}async setSyncTimeByName(e){const t=o.CoreDate.utc().toISOString();await this.syncInfo.set(`SyncTime-${e}`,t)}async getLastCompletedSyncTime(){return await this.getSyncTimeByName("Everything")}async getLastCompletedDatawalletSyncTime(){return await this.getSyncTimeByName("Datawallet")}async setLastCompletedSyncTime(){await this.setSyncTimeByName("Everything")}async setLastCompletedDatawalletSyncTime(){await this.setSyncTimeByName("Datawallet")}newNoMigrationAvailableError(e){return new o.TransportError(`There is no migration available for the datawallet version '${e}'.`)}}function descending(e,t){return t.index-e.index}t.SyncController=SyncController,n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[String,m.SyncProgressReporter]),i("design:returntype",Promise)],SyncController.prototype,"_sync",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[m.SyncProgressReporter]),i("design:returntype",Promise)],SyncController.prototype,"syncDatawallet",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Number]),i("design:returntype",Promise)],SyncController.prototype,"checkDatawalletVersion",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Number,Number]),i("design:returntype",Promise)],SyncController.prototype,"upgradeIdentityDatawalletVersion",null),n([(0,a.log)(),i("design:type",Function),i("design:paramtypes",[Number,Number]),i("design:returntype",Promise)],SyncController.prototype,"upgradeDeviceDatawalletVersion",null);class LocalSyncRun{constructor(e,t){this.promise=e,this.whatToSync=t}includes(e){return"Everything"===this.whatToSync||"OnlyDatawallet"===e}}},26:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SynchronizedCollection=void 0;const i=n(r(4901)),a=n(r(6486)),o=r(4714),s=r(6904),l=r(8169),c=r(9750);t.SynchronizedCollection=class SynchronizedCollection{constructor(e,t,r){this.parent=e,this.datawalletVersion=t,this.datawalletModifications=r,this.name=e.name,this.databaseType=e.databaseType}async create(e){const t=e.toJSON();if(!this.datawalletModifications)return await this.parent.create(e);const r=a.default.pickBy(t,((t,r)=>void 0!==t&&e.technicalProperties.includes(r))),n=a.default.pickBy(t,((t,r)=>void 0!==t&&e.metadataProperties.includes(r))),i=a.default.pickBy(t,((t,r)=>void 0!==t&&e.userdataProperties.includes(r))),o=e.id;0!==Object.getOwnPropertyNames(r).length&&await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Create,collection:this.name,objectIdentifier:o,payloadCategory:c.DatawalletModificationCategory.TechnicalData,payload:r,datawalletVersion:this.datawalletVersion})),0!==Object.getOwnPropertyNames(n).length&&await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Create,collection:this.name,objectIdentifier:o,payloadCategory:c.DatawalletModificationCategory.Metadata,payload:n,datawalletVersion:this.datawalletVersion})),0!==Object.getOwnPropertyNames(i).length&&await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Create,collection:this.name,objectIdentifier:o,payloadCategory:c.DatawalletModificationCategory.Userdata,payload:i,datawalletVersion:this.datawalletVersion})),await this.parent.create(e)}async read(e){return await this.parent.read(e)}async update(e,t){const r=s.CoreSerializable.fromUnknown(e),n=t.toJSON();if(!this.datawalletModifications)return await this.parent.update(e,t);const u=i.default.compare(r.toJSON(),n),d=[];for(const e of u){const t=e.path.split("/").find((e=>e));d.push(t)}const p=0!==a.default.intersection(t.technicalProperties,d).length,h=0!==a.default.intersection(t.metadataProperties,d).length,y=0!==a.default.intersection(t.userdataProperties,d).length,g=d.some((e=>e===(0,o.nameof)((e=>e.cache)))),m=t.id;if(p){const e=a.default.pick(n,t.technicalProperties);await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Update,collection:this.name,objectIdentifier:m,payloadCategory:c.DatawalletModificationCategory.TechnicalData,payload:e,datawalletVersion:this.datawalletVersion}))}if(h){const e=a.default.pick(n,t.metadataProperties);await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Update,collection:this.name,objectIdentifier:m,payloadCategory:c.DatawalletModificationCategory.Metadata,payload:e,datawalletVersion:this.datawalletVersion}))}if(y){const e=a.default.pick(n,t.userdataProperties);await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Update,collection:this.name,objectIdentifier:m,payloadCategory:c.DatawalletModificationCategory.Userdata,payload:e,datawalletVersion:this.datawalletVersion}))}return g&&await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.CacheChanged,collection:this.name,objectIdentifier:m,datawalletVersion:this.datawalletVersion})),await this.parent.update(e,t)}async delete(e){return this.datawalletModifications?(await this.datawalletModifications.create(c.DatawalletModification.from({localId:await l.TransportIds.datawalletModification.generate(),type:c.DatawalletModificationType.Delete,collection:this.name,objectIdentifier:e.id,datawalletVersion:this.datawalletVersion})),await this.parent.delete({id:e.id.toString()})):await this.parent.delete({id:e.id.toString()})}async list(){return await this.parent.list()}async find(e){return await this.parent.find(e)}async count(e){return await this.parent.count(e)}async exists(e){return await this.parent.exists(e)}async findOne(e){return await this.parent.findOne(e)}}},6890:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3670:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8571:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4401:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1541:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7224:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5079:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.StartSyncRunStatus=t.SyncRunType=void 0,function(e){e.ExternalEventSync="ExternalEventSync",e.DatawalletVersionUpgrade="DatawalletVersionUpgrade"}(r||(t.SyncRunType=r={})),function(e){e.Created="Created",e.NoNewEvents="NoNewEvents"}(n||(t.StartSyncRunStatus=n={}))},7596:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncClient=void 0;const n=r(2027);class SyncClient extends n.RESTClientAuthenticate{constructor(e,t){super(e,t,{headers:{"x-supported-datawallet-version":e.supportedDatawalletVersion.toString()}})}async startSyncRun(e){return await this.post("/api/v1/SyncRuns",e)}async finalizeExternalEventSync(e,t){return await this.put(`/api/v1/SyncRuns/${e}/FinalizeExternalEventSync`,t)}async finalizeDatawalletVersionUpgrade(e,t){return await this.put(`/api/v1/SyncRuns/${e}/FinalizeDatawalletVersionUpgrade`,t)}async getExternalEventsOfSyncRun(e,t){return await this.getPaged(`/api/v1/SyncRuns/${e}/ExternalEvents`,{},void 0,t)}async getDatawallet(){return await this.get("/api/v1/Datawallet")}async getDatawalletModifications(e,t){return await this.getPaged("/api/v1/Datawallet/Modifications",e,void 0,t)}async createDatawalletModifications(e){return await this.post("/api/v1/Datawallet/Modifications",e)}}t.SyncClient=SyncClient},9750:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DatawalletModification=t.DatawalletModificationCategory=t.DatawalletModificationType=void 0;const a=r(194),o=r(2027);var s,l;!function(e){e.Create="Create",e.Update="Update",e.Delete="Delete",e.CacheChanged="CacheChanged"}(s||(t.DatawalletModificationType=s={})),function(e){e.TechnicalData="TechnicalData",e.Userdata="Userdata",e.Metadata="Metadata"}(l||(t.DatawalletModificationCategory=l={}));let c=class DatawalletModification extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.DatawalletModification=c,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],c.prototype,"localId",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],c.prototype,"objectIdentifier",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",String)],c.prototype,"payloadCategory",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"collection",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",String)],c.prototype,"type",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],c.prototype,"payload",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Number)],c.prototype,"datawalletVersion",void 0),t.DatawalletModification=c=n([(0,a.type)("DatawalletModification")],c)},9258:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceMigrations=void 0;t.DeviceMigrations=class DeviceMigrations{constructor(e){this.accountController=e}async v1(){const e={cache:{$exists:!1}},synchronizableToId=e=>e.id.toString(),t=await this.accountController.files.getFiles(e);await this.accountController.files.updateCache(t.map(synchronizableToId));const r=await this.accountController.messages.getMessages(e);await this.accountController.messages.updateCache(r.map(synchronizableToId));const n=await this.accountController.relationships.getRelationships(e);await this.accountController.relationships.updateCache(n.map(synchronizableToId));const i=await this.accountController.relationshipTemplates.getRelationshipTemplates(e);await this.accountController.relationshipTemplates.updateCache(i.map(synchronizableToId));const a=await this.accountController.tokens.getTokens(e);await this.accountController.tokens.updateCache(a.map(synchronizableToId))}}},2864:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdentityMigrations=void 0;t.IdentityMigrations=class IdentityMigrations{constructor(e){this.accountController=e}v1(){return Promise.resolve()}}},8697:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousTokenController=void 0;const n=r(194),i=r(2890),a=r(2027),o=r(2069),s=r(8342),l=r(4102),c=r(7776);t.AnonymousTokenController=class AnonymousTokenController{constructor(e){this.client=new o.AnonymousTokenClient(e)}async loadPeerTokenByTruncated(e){const t=c.TokenReference.fromTruncated(e);return await this.loadPeerTokenByReference(t)}async loadPeerTokenByReference(e){return await this.loadPeerToken(e.id,e.key)}async loadPeerToken(e,t){const r=(await this.client.getToken(e.toString())).value,o=i.CryptoCipher.fromBase64(r.content),c=await a.CoreCrypto.decrypt(o,t),u=a.CoreSerializable.deserializeUnknown(c.toUtf8());if(!(u instanceof n.Serializable))throw a.CoreErrors.tokens.invalidTokenContent(e.toString());const d=l.Token.from({id:e,secretKey:t,isOwn:!1}),p=s.CachedToken.from({createdAt:a.CoreDate.from(r.createdAt),expiresAt:a.CoreDate.from(r.expiresAt),createdBy:a.CoreAddress.from(r.createdBy),createdByDevice:a.CoreId.from(r.createdByDevice),content:u});return d.setCache(p),d}}},4503:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenController=void 0;const a=r(194),o=r(5172),s=r(2890),l=r(2027),c=r(369),u=r(2508),d=r(6591),p=r(8342),h=r(5898),y=r(4102),g=r(7776);class TokenController extends u.TransportController{constructor(e){super(u.ControllerName.Token,e)}async init(){return await super.init(),this.client=new d.TokenClient(this.config,this.parent.authenticator),this.tokens=await this.parent.getSynchronizedCollection(c.DbCollectionName.Tokens),this}async getTokens(e){const t=await this.tokens.find(e);return this.parseArray(t,y.Token)}async sendToken(e){const t=h.SendTokenParameters.from(e),r=await l.CoreCrypto.generateSecretKey(),n=t.content.serialize(),i=s.CoreBuffer.fromUtf8(n),a=await l.CoreCrypto.encrypt(i,r),o=(await this.client.createToken({content:a.toBase64(),expiresAt:t.expiresAt.toString()})).value,c=p.CachedToken.from({createdAt:l.CoreDate.from(o.createdAt),expiresAt:t.expiresAt,createdBy:this.parent.identity.address,createdByDevice:this.parent.activeDevice.id,content:t.content}),u=y.Token.from({id:l.CoreId.from(o.id),secretKey:r,isOwn:!0,cache:c,cachedAt:l.CoreDate.utc()});return t.ephemeral||await this.tokens.create(u),u}async setTokenMetadata(e,t){const r=e instanceof l.CoreId?e.toString():e.id.toString(),n=await this.tokens.read(r);if(!n)throw l.CoreErrors.general.recordNotFound(y.Token,r.toString());const i=y.Token.from(n);return i.setMetadata(t),await this.tokens.update(n,i),i}async getToken(e){const t=await this.tokens.read(e.toString());return t?y.Token.from(t):void 0}async updateCache(e){if(e.length<1)return[];const t=(await this.client.getTokens({ids:e})).value,r=[];for await(const e of t)r.push(this.updateCacheOfExistingTokenInDb(e.id,e));return(await Promise.all(r)).filter((e=>!!e))}async fetchCaches(e){if(0===e.length)return[];const t=(await(await this.client.getTokens({ids:e.map((e=>e.id))})).value.collect()).map((async e=>{const t=await this.tokens.read(e.id),r=y.Token.from(t);return{id:l.CoreId.from(e),cache:await this.decryptToken(e,r.secretKey)}}));return await Promise.all(t)}async updateCacheOfExistingTokenInDb(e,t){const r=await this.tokens.read(e);if(!r)return void l.CoreErrors.general.recordNotFound(y.Token,e);const n=y.Token.from(r);return await this.updateCacheOfToken(n,t),await this.tokens.update(r,n),n}async updateCacheOfToken(e,t){const r=e.id.toString();t||(t=(await this.client.getToken(r)).value);const n=await this.decryptToken(t,e.secretKey);e.setCache(n),e.isOwn=this.parent.identity.isMe(n.createdBy)}async decryptToken(e,t){const r=s.CryptoCipher.fromBase64(e.content),n=await l.CoreCrypto.decrypt(r,t),i=l.CoreSerializable.deserializeUnknown(n.toUtf8());if(!(i instanceof a.Serializable))throw l.CoreErrors.tokens.invalidTokenContent(e.id);return p.CachedToken.from({createdAt:l.CoreDate.from(e.createdAt),expiresAt:l.CoreDate.from(e.expiresAt),createdBy:l.CoreAddress.from(e.createdBy),createdByDevice:l.CoreId.from(e.createdByDevice),content:i})}async loadPeerTokenByTruncated(e,t){const r=g.TokenReference.fromTruncated(e);return await this.loadPeerTokenByReference(r,t)}async loadPeerTokenByReference(e,t){return await this.loadPeerToken(e.id,e.key,t)}async loadPeerToken(e,t,r){const n=await this.tokens.read(e.toString());if(n){let t=y.Token.from(n);if(t.cache)return t;if(t=await this.updateCacheOfExistingTokenInDb(e.toString()),!t)throw new l.TransportError(`Tried to update a token (with ID: '${e.toString()}') that doesn't exist in the local database.`);return t}const i=y.Token.from({id:e,secretKey:t,isOwn:!1});return await this.updateCacheOfToken(i),r||await this.tokens.create(i),i}}t.TokenController=TokenController,n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[Object,Object]),i("design:returntype",Promise)],TokenController.prototype,"setTokenMetadata",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[String,Object]),i("design:returntype",Promise)],TokenController.prototype,"updateCacheOfExistingTokenInDb",null),n([(0,o.log)(),i("design:type",Function),i("design:paramtypes",[Object,s.CryptoSecretKey]),i("design:returntype",Promise)],TokenController.prototype,"decryptToken",null)},2069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousTokenClient=void 0;const n=r(2027);class AnonymousTokenClient extends n.RESTClient{async getToken(e){return await this.get(`/api/v1/Tokens/${e}`)}}t.AnonymousTokenClient=AnonymousTokenClient},7653:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClient=void 0;const n=r(6054);class TokenClient extends n.RESTClientAuthenticate{async createToken(e){return await this.post("/api/v1/Tokens",e)}async getTokens(e){return await this.getPaged("/api/v1/Tokens",e)}async getToken(e){return await this.get(`/api/v1/Tokens/${e}`)}async deleteToken(e){return await this.delete(`/api/v1/Tokens/${e}`)}}t.TokenClient=TokenClient},8342:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CachedToken=void 0;const a=r(194),o=r(2027);let s=class CachedToken extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.CachedToken=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreAddress)],s.prototype,"createdBy",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],s.prototype,"createdAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],s.prototype,"expiresAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],s.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreId)],s.prototype,"createdByDevice",void 0),t.CachedToken=s=n([(0,a.type)("CachedToken")],s)},5898:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SendTokenParameters=void 0;const a=r(194),o=r(2027);let s=class SendTokenParameters extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.SendTokenParameters=s,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",a.Serializable)],s.prototype,"content",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CoreDate)],s.prototype,"expiresAt",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],s.prototype,"ephemeral",void 0),t.SendTokenParameters=s=n([(0,a.type)("SendTokenParameters")],s)},4102:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Token=void 0;const a=r(194),o=r(2890),s=r(4714),l=r(2027),c=r(7776),u=r(8342);let d=class Token extends l.CoreSynchronizable{constructor(){super(...arguments),this.technicalProperties=["@type","@context",(0,s.nameof)((e=>e.secretKey)),(0,s.nameof)((e=>e.isOwn))],this.metadataProperties=[(0,s.nameof)((e=>e.metadata)),(0,s.nameof)((e=>e.metadataModifiedAt))]}static from(e){return this.fromAny(e)}toTokenReference(){return c.TokenReference.from({id:this.id,key:this.secretKey})}truncate(){return this.toTokenReference().truncate()}setCache(e){return this.cache=e,this.cachedAt=l.CoreDate.utc(),this}setMetadata(e){this.metadata=e,this.metadataModifiedAt=l.CoreDate.utc()}};t.Token=d,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],d.prototype,"secretKey",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",Boolean)],d.prototype,"isOwn",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",u.CachedToken)],d.prototype,"cache",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],d.prototype,"cachedAt",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",Object)],d.prototype,"metadata",void 0),n([(0,a.validate)({nullable:!0}),(0,a.serialize)(),i("design:type",l.CoreDate)],d.prototype,"metadataModifiedAt",void 0),t.Token=d=n([(0,a.type)("Token")],d)},5083:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenContentDeviceSharedSecret=void 0;const a=r(194),o=r(2027),s=r(6758);let l=class TokenContentDeviceSharedSecret extends o.CoreSerializable{static from(e){return this.fromAny(e)}};t.TokenContentDeviceSharedSecret=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.DeviceSharedSecret)],l.prototype,"sharedSecret",void 0),t.TokenContentDeviceSharedSecret=l=n([(0,a.type)("TokenContentDeviceSharedSecret")],l)},2238:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenContentFile=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class TokenContentFile extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.TokenContentFile=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],l.prototype,"fileId",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],l.prototype,"secretKey",void 0),t.TokenContentFile=l=n([(0,a.type)("TokenContentFile")],l)},1488:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenContentRelationshipTemplate=void 0;const a=r(194),o=r(2890),s=r(2027);let l=class TokenContentRelationshipTemplate extends s.CoreSerializable{static from(e){return this.fromAny(e)}};t.TokenContentRelationshipTemplate=l,n([(0,a.validate)(),(0,a.serialize)(),i("design:type",s.CoreId)],l.prototype,"templateId",void 0),n([(0,a.validate)(),(0,a.serialize)(),i("design:type",o.CryptoSecretKey)],l.prototype,"secretKey",void 0),t.TokenContentRelationshipTemplate=l=n([(0,a.type)("TokenContentRelationshipTemplate")],l)},7776:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenReference=void 0;const i=r(194),a=r(2027);let o=class TokenReference extends a.Reference{static preFrom(e){return super.validateId(e,a.BackboneIds.token),e}static from(e){return super.from(e)}};t.TokenReference=o,t.TokenReference=o=n([(0,i.type)("TokenReference")],o)},1577:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordGenerator=void 0;const n=r(1796),i=r(5833),a=i.RandomCharacterRange.AlphanumericEase+i.RandomCharacterRange.SpecialCharacters;class PasswordGenerator{static async createPassword(e,t=0,r=a){return t<=0&&(t=e),await i.Random.stringRandomLength(e,t,r)}static async createStrongPassword(e=8,t=12){if(e>t&&(t=e),e<8)throw new n.TransportError("Minimum password length for a strong password should be 8 characters.");const r={minLength:1,maxLength:1,allowedChars:i.RandomCharacterRange.SpecialCharacters},o={minLength:1,maxLength:1,allowedChars:i.RandomCharacterRange.LowerCaseEase},s={minLength:1,maxLength:1,allowedChars:i.RandomCharacterRange.UpperCaseEase},l={minLength:e-4,maxLength:t-4,allowedChars:a},c=await i.Random.stringWithBuckets([r,o,s,{minLength:1,maxLength:1,allowedChars:"123456789"},l]);return await i.Random.scramble(c)}static async createUnitPassword(){return`${await i.Random.stringWithBuckets([{minLength:1,maxLength:1,allowedChars:"123456789"},{minLength:0,maxLength:2,allowedChars:"0123456789"},{minLength:0,maxLength:1,allowedChars:","},{minLength:0,maxLength:1,allowedChars:"0123456789"},{minLength:1,maxLength:1,allowedChars:"123456789"}])} ${await this.createPassword(1,0,this.unitsGerman)}`}static async createElementPassword(){return`${await this.createPassword(1,0,this.elementsGerman)} ${await this.createPassword(1,0,i.RandomCharacterRange.Digit)}`}}t.PasswordGenerator=PasswordGenerator,PasswordGenerator.elementsGerman=["Wasserstoff","Helium","Lithium","Beryllium","Bor","Kohlenstoff","Stickstoff","Sauerstoff","Fluor","Neon","Natrium","Magnesium","Aluminium","Silicium","Phosphor","Schwefel","Chlor","Argon","Kalium","Calcium","Scandium","Titan","Vanadium","Chrom","Mangan","Eisen","Cobalt","Nickel","Kupfer","Zink"],PasswordGenerator.unitsGerman=["Kelvin","Mol","Candela","Mikrosekunden","Nanosekunden","Millisekunden","Sekunden","Minuten","Stunden","Tage","Wochen","Monate","Jahre","Seemeilen","Astronomische Einheiten","Parsecs","Lichtjahre","Millimeter","Zentimeter","Meter","Kilometer","Quadratmeter","Ar","Hektar","Milliliter","Zentiliter","Liter","Kubikmeter","Barrel","Gramm","Kilogramm","Tonnen","Pfund","Zentner","Knoten","Newton","Pascal","Bar","Joule","Kilojoule","Megajoule","Wattstunden","Kilowattstunden","Megawattstunden","Kalorien","Kilokalorien","Elektronenvolt","Watt","Kilowatt","Megawatt","Voltampere","Ampere","Milliampere","Ohm","Siemens","Coulomb","Amperestunde","Milliamperestunde","Farad","Kelvin","Grad Celsius","Lumen","Lux","Bit","Byte","Kilobyte","Megabyte","Gigabyte","Terabyte","Etabyte"]},5833:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Random=t.RandomCharacterRange=void 0;const n=r(2890),i=r(7429),a=r(1796);var o;!function(e){e.Digit="0123456789",e.DigitEase="123456789",e.Hex="0123456789ABCDEF",e.LowerCase="abcdefghijklmnopqrstuvwxyz",e.LowerCaseEase="abcdefghijkmnpqrstuvwxyz",e.UpperCase="ABCDEFGHIJKLMNOPQRSTUVWXYZ",e.UpperCaseEase="ABCDEFGHJKLMNPQRSTUVWXYZ",e.Alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.Alphanumeric="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e.AlphanumericEase="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz123456789",e.AlphanumericUpperCaseEase="ABCDEFGHJKLMNPQRSTUVWXYZ0123456789",e.GermanUmlaut="ÄÖÜäöü",e.SpecialCharacters="!?-_.:,;#+"}(o||(t.RandomCharacterRange=o={}));class Random{static async bytes(e){return await n.CryptoRandom.bytes(e)}static async int(e){if(e>21||e<=0)throw new a.TransportError("Length must be between 1 and 21.");return parseInt(await this.string(e,o.Digit))}static async array(e){return(await n.CryptoRandom.bytes(e)).toArray()}static uuid(){return(0,i.v4)()}static async scramble(e){const t=[],r=e.split(""),n=e.length;for(let e=0;e<n-1;e++){const i=await Random.intBetween(0,n-1-e);t.push(r.splice(i,1)[0])}return t.push(r[0]),t.join("")}static async intBetween(e,t){if(t<=e)throw new a.TransportError("Max must be larger than min.");const r=t-e+1,n=Math.abs(Math.ceil(Math.log2(r)));if(n>32)throw new a.TransportError("The range between the numbers is too big, 32 bit is the maximum -> 4294967296");const i=Math.ceil(n/8),o=Math.pow(2,n)-1,s=await this.bytes(i);let l=0,c=8*(i-1);for(let e=0;e<i;e++)l+=s.buffer[e]*Math.pow(2,c),c-=8;return l&=o,l>=r?await this.intBetween(e,t):e+l}static async intRandomLength(e,t){if(t>21)throw new a.TransportError("Max must be below 22.");return parseInt(await this.stringRandomLength(e,t,o.Digit))}static async scrambleWithBuckets(e){const t=await this.stringWithBuckets(e);return await this.scramble(t)}static async stringWithBuckets(e){const t=[];for(const r of e)t.push(await this.stringRandomLength(r.minLength,r.maxLength,r.allowedChars));return t.join("")}static async string(e,t=o.Alphanumeric){if(e<=0)return"";if(t.length>256)throw new a.TransportError("Input exceeds maximum length of 256.");const r=[],n=t.length,i=await this.array(e+10),s=255-255%n;for(let a=0;a<e;a++){const e=i[a];e>s||r.push(t[e%n])}let l=r.join("");return l.length<e&&(l+=await this.string(e-l.length,t)),l}static async stringRandomLength(e,t,r){if(e>t)throw new a.TransportError("maxLength must be larger than minLength.");if(e<0)throw new a.TransportError("minlength must not be less than zero.");const n=t>e?await this.intBetween(e,t):t;return await this.string(n,r)}}t.Random=Random},2212:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(1577),t),i(r(5833),t)},4225:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLogger=void 0;const i=n(r(4530));t.SimpleLogger=class SimpleLogger{constructor(e){this.logger=e}trace(...e){this.logger.trace(this.formatMessage(e))}debug(...e){this.logger.debug(this.formatMessage(e))}info(...e){this.logger.info(this.formatMessage(e))}warn(...e){this.logger.warn(this.formatMessage(e))}error(...e){this.logger.error(this.formatMessage(e))}fatal(...e){this.logger.fatal(this.formatMessage(e))}formatMessage(e){return e.map((e=>{var t;return e instanceof Error?null!==(t=e.stack)&&void 0!==t?t:`${e.name}: ${e.message}`:(0,i.default)(e)})).join("\n")}}},7004:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLoggerFactory=void 0;const n=r(9959),i=r(6379),a=r(4225);t.SimpleLoggerFactory=class SimpleLoggerFactory{getLogger(e){const t=this.provider.getLogger(e instanceof Function?e.name:e);return new a.SimpleLogger(t)}constructor(e=n.LogLevel.Warn,t=Math.random().toString(36).substring(7)){this.provider=i.Log4TSProvider.createProvider(t,{groups:[{expression:new RegExp(".*"),level:e}]})}}},2391:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4225),t),i(r(7004),t)},1174:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9159:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEventNamespaceFromObject=t.EventBus=void 0;t.EventBus=class EventBus{},t.getEventNamespaceFromObject=function getEventNamespaceFromObject(e){return e.namespace}},5970:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubscriptionTargetInfo=void 0;class SubscriptionTargetInfo{namespace;constructor(e){this.namespace=e}static from(e){return e instanceof Function?new ConstructorSubscriptionTargetInfo(e):new NamespaceSubscriptionTargetInfo(e)}}t.SubscriptionTargetInfo=SubscriptionTargetInfo;class ConstructorSubscriptionTargetInfo extends SubscriptionTargetInfo{constructorFunction;constructor(e){super(function getEventNamespaceFromClass(e){return e.namespace}(e)),this.constructorFunction=e}isCompatibleWith(e){return e instanceof this.constructorFunction}}class NamespaceSubscriptionTargetInfo extends SubscriptionTargetInfo{constructor(e){super(e)}isCompatibleWith(e){return!0}}},9729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventEmitter2EventBus=void 0;const n=r(6387);r(6034);const i=r(9159),a=r(5970);t.EventEmitter2EventBus=class EventEmitter2EventBus{errorCallback;emitter;listeners=new Map;nextId=0;invocationPromises=[];constructor(e,t){this.errorCallback=e,this.emitter=new n.EventEmitter2({maxListeners:50,verboseMemoryLeak:!0,...t,wildcard:!0})}subscribe(e,t){return this.registerHandler(e,t)}subscribeOnce(e,t){return this.registerHandler(e,t,!0)}unsubscribe(e){return this.unregisterHandler(e)}registerHandler(e,t,r=!1){const n=a.SubscriptionTargetInfo.from(e),i=this.nextId++,handlerWrapper=async e=>{if(!n.isCompatibleWith(e))return;const a=(async()=>await t(e))();this.invocationPromises.push(a),await a.catch((e=>this.errorCallback(e,n.namespace))),this.invocationPromises=this.invocationPromises.filter((e=>e!==a)),r&&this.listeners.delete(i)};if(r){const e=this.emitter.once(n.namespace,handlerWrapper,{objectify:!0});return this.listeners.set(i,e),i}const o=this.emitter.on(n.namespace,handlerWrapper,{objectify:!0});return this.listeners.set(i,o),i}unregisterHandler(e){const t=this.listeners.get(e);return!!t&&(t.off(),this.listeners.delete(e),!0)}publish(e){const t=(0,i.getEventNamespaceFromObject)(e);if(!t)throw Error("The event needs a namespace. Use the EventNamespace-decorator in order to define a namespace for a event.");this.emitter.emit(t,e)}async close(e){this.emitter.removeAllListeners();const t=Promise.all(this.invocationPromises).catch((()=>{}));if(!e)return void await t;let r;const n=new Promise(((t,n)=>{r=setTimeout((()=>{n(new Error("timeout exceeded while waiting for events to process"))}),e)}));await Promise.race([t,n]),clearTimeout(r)}}},9256:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(9159),t),i(r(9729),t)},5917:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataEvent=void 0;const n=r(8267);class DataEvent extends n.Event{data;constructor(e,t){super(e),this.data=t}}t.DataEvent=DataEvent},8267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Event=void 0;t.Event=class Event{namespace;constructor(e){this.namespace=e}}},2636:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5917),t),i(r(8267),t)},5172:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(9256),t),i(r(2636),t),i(r(9855),t),i(r(1809),t),i(r(4569),t),i(r(1174),t),i(r(7226),t),i(r(7374),t)},9855:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.log=void 0;const i=n(r(4530));t.log=function log(e){return function(t,r,n){const a=n.value;return n.value=function(...t){const n=this;try{e?.logParams?n.log.trace(`Calling ${r}(${t.map((e=>(0,i.default)(e))).join(", ")})`):n.log.trace(`Calling ${r}`);const o=a.apply(this,t);return e?.logReturnValue?n.log.trace(`Returning from ${r} with: ${(0,i.default)(o)}`):n.log.trace(`Returning from ${r}`),o}catch(e){throw e instanceof Error&&e.stack&&(e.stack=e.stack.split("\n").filter((e=>!e.includes(".propertyDescriptorDoNotChangeMyNamePlease.value"))).join("\n")),n.log.error(`Error in ${r}:`,e),e}},n}}},1809:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.measureExcecutionTime=void 0,t.measureExcecutionTime=function measureExcecutionTime(e,t,r){const n=r.value;return r.value=async function(...e){const t=Date.now(),r=await n.apply(this,e),i=Date.now();return console.info(`Execution time: ${i-t}ms`),r},r}},4569:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomString=void 0,t.randomString=function randomString(e,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){let r="";const n=t.length;for(let i=0;i<e;i++)r+=t.charAt(Math.floor(Math.random()*n));return r}},7807:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApplicationError=void 0;class ApplicationError extends Error{code;data;constructor(e,t,r){super(t),this.code=e,this.data=r}equals(e){return this.code===e.code}toString(){return JSON.stringify({code:this.code,message:this.message,data:this.data},void 0,2)}}t.ApplicationError=ApplicationError},9278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Result=void 0;class Result{_isSuccess;_error;_value;constructor(e,t,r){if(e&&r)throw new Error("InvalidOperation: A result cannot be successful and contain an error");if(!e&&!r)throw new Error("InvalidOperation: A failing result needs to contain an error");if(void 0!==t&&!e)throw new Error("InvalidOperation: A value is only useful in case of a success.");this._value=t,this._isSuccess=e,this._error=r}get isSuccess(){return this._isSuccess}get isError(){return!this._isSuccess}get error(){return this._error}get value(){if(!this.isSuccess)throw new Error(`Can't get the value of an error result. Use 'error' instead. Root error: \r\n${this.error}`);return this._value}static ok(e){return new Result(!0,e)}static fail(e){return new Result(!1,void 0,e)}}t.Result=Result},7226:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7807),t),i(r(9278),t)},7374:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sleep=void 0,t.sleep=function sleep(e){return new Promise((t=>{setTimeout(t,e)}))}},6034:(e,t,r)=>{var n;!function(e){!function(t){var n="object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=makeExporter(e);function makeExporter(e,t){return function(r,n){"function"!=typeof e[r]&&Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0===n.Reflect?n.Reflect=e:i=makeExporter(n.Reflect,i),function(e){var t=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,n=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",a="function"==typeof Object.create,o={__proto__:[]}instanceof Array,s=!a&&!o,l={create:a?function(){return MakeDictionary(Object.create(null))}:o?function(){return MakeDictionary({__proto__:null})}:function(){return MakeDictionary({})},has:s?function(e,r){return t.call(e,r)}:function(e,t){return t in e},get:s?function(e,r){return t.call(e,r)?e[r]:void 0}:function(e,t){return e[t]}},c=Object.getPrototypeOf(Function),u="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=u||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?CreateMapPolyfill():Map,p=u||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?CreateSetPolyfill():Set,h=new(u||"function"!=typeof WeakMap?CreateWeakMapPolyfill():WeakMap);function decorate(e,t,r,n){if(IsUndefined(r)){if(!IsArray(e))throw new TypeError;if(!IsConstructor(t))throw new TypeError;return DecorateConstructor(e,t)}if(!IsArray(e))throw new TypeError;if(!IsObject(t))throw new TypeError;if(!IsObject(n)&&!IsUndefined(n)&&!IsNull(n))throw new TypeError;return IsNull(n)&&(n=void 0),DecorateProperty(e,t,r=ToPropertyKey(r),n)}function metadata(e,t){function decorator(r,n){if(!IsObject(r))throw new TypeError;if(!IsUndefined(n)&&!IsPropertyKey(n))throw new TypeError;OrdinaryDefineOwnMetadata(e,t,r,n)}return decorator}function defineMetadata(e,t,r,n){if(!IsObject(r))throw new TypeError;return IsUndefined(n)||(n=ToPropertyKey(n)),OrdinaryDefineOwnMetadata(e,t,r,n)}function hasMetadata(e,t,r){if(!IsObject(t))throw new TypeError;return IsUndefined(r)||(r=ToPropertyKey(r)),OrdinaryHasMetadata(e,t,r)}function hasOwnMetadata(e,t,r){if(!IsObject(t))throw new TypeError;return IsUndefined(r)||(r=ToPropertyKey(r)),OrdinaryHasOwnMetadata(e,t,r)}function getMetadata(e,t,r){if(!IsObject(t))throw new TypeError;return IsUndefined(r)||(r=ToPropertyKey(r)),OrdinaryGetMetadata(e,t,r)}function getOwnMetadata(e,t,r){if(!IsObject(t))throw new TypeError;return IsUndefined(r)||(r=ToPropertyKey(r)),OrdinaryGetOwnMetadata(e,t,r)}function getMetadataKeys(e,t){if(!IsObject(e))throw new TypeError;return IsUndefined(t)||(t=ToPropertyKey(t)),OrdinaryMetadataKeys(e,t)}function getOwnMetadataKeys(e,t){if(!IsObject(e))throw new TypeError;return IsUndefined(t)||(t=ToPropertyKey(t)),OrdinaryOwnMetadataKeys(e,t)}function deleteMetadata(e,t,r){if(!IsObject(t))throw new TypeError;IsUndefined(r)||(r=ToPropertyKey(r));var n=GetOrCreateMetadataMap(t,r,!1);if(IsUndefined(n))return!1;if(!n.delete(e))return!1;if(n.size>0)return!0;var i=h.get(t);return i.delete(r),i.size>0||h.delete(t),!0}function DecorateConstructor(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!IsUndefined(n)&&!IsNull(n)){if(!IsConstructor(n))throw new TypeError;t=n}}return t}function DecorateProperty(e,t,r,n){for(var i=e.length-1;i>=0;--i){var a=(0,e[i])(t,r,n);if(!IsUndefined(a)&&!IsNull(a)){if(!IsObject(a))throw new TypeError;n=a}}return n}function GetOrCreateMetadataMap(e,t,r){var n=h.get(e);if(IsUndefined(n)){if(!r)return;n=new d,h.set(e,n)}var i=n.get(t);if(IsUndefined(i)){if(!r)return;i=new d,n.set(t,i)}return i}function OrdinaryHasMetadata(e,t,r){if(OrdinaryHasOwnMetadata(e,t,r))return!0;var n=OrdinaryGetPrototypeOf(t);return!IsNull(n)&&OrdinaryHasMetadata(e,n,r)}function OrdinaryHasOwnMetadata(e,t,r){var n=GetOrCreateMetadataMap(t,r,!1);return!IsUndefined(n)&&ToBoolean(n.has(e))}function OrdinaryGetMetadata(e,t,r){if(OrdinaryHasOwnMetadata(e,t,r))return OrdinaryGetOwnMetadata(e,t,r);var n=OrdinaryGetPrototypeOf(t);return IsNull(n)?void 0:OrdinaryGetMetadata(e,n,r)}function OrdinaryGetOwnMetadata(e,t,r){var n=GetOrCreateMetadataMap(t,r,!1);if(!IsUndefined(n))return n.get(e)}function OrdinaryDefineOwnMetadata(e,t,r,n){GetOrCreateMetadataMap(r,n,!0).set(e,t)}function OrdinaryMetadataKeys(e,t){var r=OrdinaryOwnMetadataKeys(e,t),n=OrdinaryGetPrototypeOf(e);if(null===n)return r;var i=OrdinaryMetadataKeys(n,t);if(i.length<=0)return r;if(r.length<=0)return i;for(var a=new p,o=[],s=0,l=r;s<l.length;s++){var c=l[s];a.has(c)||(a.add(c),o.push(c))}for(var u=0,d=i;u<d.length;u++){c=d[u];a.has(c)||(a.add(c),o.push(c))}return o}function OrdinaryOwnMetadataKeys(e,t){var r=[],n=GetOrCreateMetadataMap(e,t,!1);if(IsUndefined(n))return r;for(var i=GetIterator(n.keys()),a=0;;){var o=IteratorStep(i);if(!o)return r.length=a,r;var s=IteratorValue(o);try{r[a]=s}catch(e){try{IteratorClose(i)}finally{throw e}}a++}}function Type(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function IsUndefined(e){return void 0===e}function IsNull(e){return null===e}function IsSymbol(e){return"symbol"==typeof e}function IsObject(e){return"object"==typeof e?null!==e:"function"==typeof e}function ToPrimitive(e,t){switch(Type(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",i=GetMethod(e,n);if(void 0!==i){var a=i.call(e,r);if(IsObject(a))throw new TypeError;return a}return OrdinaryToPrimitive(e,"default"===r?"number":r)}function OrdinaryToPrimitive(e,t){if("string"===t){var r=e.toString;if(IsCallable(r))if(!IsObject(i=r.call(e)))return i;if(IsCallable(n=e.valueOf))if(!IsObject(i=n.call(e)))return i}else{var n;if(IsCallable(n=e.valueOf))if(!IsObject(i=n.call(e)))return i;var i,a=e.toString;if(IsCallable(a))if(!IsObject(i=a.call(e)))return i}throw new TypeError}function ToBoolean(e){return!!e}function ToString(e){return""+e}function ToPropertyKey(e){var t=ToPrimitive(e,3);return IsSymbol(t)?t:ToString(t)}function IsArray(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function IsCallable(e){return"function"==typeof e}function IsConstructor(e){return"function"==typeof e}function IsPropertyKey(e){switch(Type(e)){case 3:case 4:return!0;default:return!1}}function GetMethod(e,t){var r=e[t];if(null!=r){if(!IsCallable(r))throw new TypeError;return r}}function GetIterator(e){var t=GetMethod(e,i);if(!IsCallable(t))throw new TypeError;var r=t.call(e);if(!IsObject(r))throw new TypeError;return r}function IteratorValue(e){return e.value}function IteratorStep(e){var t=e.next();return!t.done&&t}function IteratorClose(e){var t=e.return;t&&t.call(e)}function OrdinaryGetPrototypeOf(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===c)return t;if(t!==c)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var i=n.constructor;return"function"!=typeof i||i===e?t:i}function CreateMapPolyfill(){var e={},t=[],r=function(){function MapIterator(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return MapIterator.prototype["@@iterator"]=function(){return this},MapIterator.prototype[i]=function(){return this},MapIterator.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},MapIterator.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},MapIterator.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},MapIterator}();return function(){function Map(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(Map.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Map.prototype.has=function(e){return this._find(e,!1)>=0},Map.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},Map.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},Map.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,i=r+1;i<n;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,t===this._cacheKey&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},Map.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},Map.prototype.keys=function(){return new r(this._keys,this._values,getKey)},Map.prototype.values=function(){return new r(this._keys,this._values,getValue)},Map.prototype.entries=function(){return new r(this._keys,this._values,getEntry)},Map.prototype["@@iterator"]=function(){return this.entries()},Map.prototype[i]=function(){return this.entries()},Map.prototype._find=function(e,t){return this._cacheKey!==e&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=e)),this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},Map}();function getKey(e,t){return e}function getValue(e,t){return t}function getEntry(e,t){return[e,t]}}function CreateSetPolyfill(){return function(){function Set(){this._map=new d}return Object.defineProperty(Set.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),Set.prototype.has=function(e){return this._map.has(e)},Set.prototype.add=function(e){return this._map.set(e,e),this},Set.prototype.delete=function(e){return this._map.delete(e)},Set.prototype.clear=function(){this._map.clear()},Set.prototype.keys=function(){return this._map.keys()},Set.prototype.values=function(){return this._map.values()},Set.prototype.entries=function(){return this._map.entries()},Set.prototype["@@iterator"]=function(){return this.keys()},Set.prototype[i]=function(){return this.keys()},Set}()}function CreateWeakMapPolyfill(){var e=16,r=l.create(),n=CreateUniqueKey();return function(){function WeakMap(){this._key=CreateUniqueKey()}return WeakMap.prototype.has=function(e){var t=GetOrCreateWeakMapTable(e,!1);return void 0!==t&&l.has(t,this._key)},WeakMap.prototype.get=function(e){var t=GetOrCreateWeakMapTable(e,!1);return void 0!==t?l.get(t,this._key):void 0},WeakMap.prototype.set=function(e,t){return GetOrCreateWeakMapTable(e,!0)[this._key]=t,this},WeakMap.prototype.delete=function(e){var t=GetOrCreateWeakMapTable(e,!1);return void 0!==t&&delete t[this._key]},WeakMap.prototype.clear=function(){this._key=CreateUniqueKey()},WeakMap}();function CreateUniqueKey(){var e;do{e="@@WeakMap@@"+CreateUUID()}while(l.has(r,e));return r[e]=!0,e}function GetOrCreateWeakMapTable(e,r){if(!t.call(e,n)){if(!r)return;Object.defineProperty(e,n,{value:l.create()})}return e[n]}function FillRandomBytes(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function GenRandomBytes(e){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(e)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(e)):FillRandomBytes(new Uint8Array(e),e):FillRandomBytes(new Array(e),e)}function CreateUUID(){var t=GenRandomBytes(e);t[6]=79&t[6]|64,t[8]=191&t[8]|128;for(var r="",n=0;n<e;++n){var i=t[n];4!==n&&6!==n&&8!==n||(r+="-"),i<16&&(r+="0"),r+=i.toString(16).toLowerCase()}return r}}function MakeDictionary(e){return e.__=void 0,delete e.__,e}e("decorate",decorate),e("metadata",metadata),e("defineMetadata",defineMetadata),e("hasMetadata",hasMetadata),e("hasOwnMetadata",hasOwnMetadata),e("getMetadata",getMetadata),e("getOwnMetadata",getOwnMetadata),e("getMetadataKeys",getMetadataKeys),e("getOwnMetadataKeys",getOwnMetadataKeys),e("deleteMetadata",deleteMetadata)}(i)}()}(n||(n={}))},1924:(e,t,r)=>{"use strict";var n=r(210),i=r(5559),a=i(n("String.prototype.indexOf"));e.exports=function callBoundIntrinsic(e,t){var r=n(e,!!t);return"function"==typeof r&&a(e,".prototype.")>-1?i(r):r}},5559:(e,t,r)=>{"use strict";var n=r(8612),i=r(210),a=r(7771),o=i("%TypeError%"),s=i("%Function.prototype.apply%"),l=i("%Function.prototype.call%"),c=i("%Reflect.apply%",!0)||n.call(l,s),u=i("%Object.defineProperty%",!0),d=i("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function callBind(e){if("function"!=typeof e)throw new o("a function is required");var t=c(n,l,arguments);return a(t,1+d(0,e.length-(arguments.length-1)),!0)};var p=function applyBind(){return c(n,s,arguments)};u?u(e.exports,"apply",{value:p}):e.exports.apply=p},2296:(e,t,r)=>{"use strict";var n=r(1044)(),i=r(210),a=n&&i("%Object.defineProperty%",!0);if(a)try{a({},"a",{value:1})}catch(e){a=!1}var o=i("%SyntaxError%"),s=i("%TypeError%"),l=r(7296);e.exports=function defineDataProperty(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new s("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new s("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],d=!!l&&l(e,t);if(a)a(e,t,{configurable:null===c&&d?d.configurable:!c,enumerable:null===n&&d?d.enumerable:!n,value:r,writable:null===i&&d?d.writable:!i});else{if(!u&&(n||i||c))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},6387:(e,t,r)=>{var n;!function(i){var a=Object.hasOwnProperty,o=Array.isArray?Array.isArray:function _isArray(e){return"[object Array]"===Object.prototype.toString.call(e)},s="object"==typeof process&&"function"==typeof process.nextTick,l="function"==typeof Symbol,c="object"==typeof Reflect,u="function"==typeof setImmediate?setImmediate:setTimeout,d=l?c&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function init(){this._events={},this._conf&&configure.call(this,this._conf)}function configure(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==i&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function logPossibleMemoryLeak(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var toArray=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function toObject(e,t){for(var r={},n=e.length,a=t?t.length:0,o=0;o<n;o++)r[e[o]]=o<a?t[o]:i;return r}function TargetObserver(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=n,this._off=i;var a=e._observers;a?a.push(this):e._observers=[this]}function resolveOptions(e,t,r,n){var o=Object.assign({},t);if(!e)return o;if("object"!=typeof e)throw TypeError("options must be an object");var s,l,c,u=Object.keys(e),d=u.length;function reject(e){throw Error('Invalid "'+s+'" option value'+(e?". Reason: "+e:""))}for(var p=0;p<d;p++){if(s=u[p],!n&&!a.call(t,s))throw Error('Unknown "'+s+'" option');(l=e[s])!==i&&(c=r[s],o[s]=c?c(l,reject):l)}return o}function constructorReducer(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function makeTypeReducer(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var a=typeof e;if(a===n||a===i)return e;r(t)}:function(n,i){for(var a=typeof n,o=r;o-- >0;)if(a===e[o])return n;i(t)}}Object.assign(TargetObserver.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,a=this._emitter,o=this._listeners,handler=function(){var n=toArray.apply(null,arguments),o={data:n,name:t,original:e};r?!1!==r.call(i,o)&&a.emit.apply(a,[o.name].concat(n)):a.emit.apply(a,[t].concat(n))};if(o[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,a._newListener&&a._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===o[e]&&(o[e]=handler,n._on.call(i,e,handler))},a.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!a.hasListeners(r)&&o[e]&&(o[e]=null,n._off.call(i,e,handler))},o[e]=null,a.on("removeListener",this._onRemoveListener)):(o[e]=handler,n._on.call(i,e,handler))},unsubscribe:function(e){var t,r,n,i=this,a=this._listeners,o=this._emitter,s=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function clearRefs(){i._onNewListener&&(o.off("newListener",i._onNewListener),o.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=findTargetIndex.call(o,i);o._observers.splice(e,1)}if(e){if(!(t=a[e]))return;s.call(l,e,t),delete a[e],--this._listenersCount||clearRefs()}else{for(n=(r=d(a)).length;n-- >0;)e=r[n],s.call(l,e,a[e]);this._listeners={},this._listenersCount=0,clearRefs()}}});var p=makeTypeReducer(["function"]),h=makeTypeReducer(["object","function"]);function makeCancelablePromise(e,t,r){var n,i,a,o=0,s=new e((function(l,c,u){function cleanup(){i&&(i=null),o&&(clearTimeout(o),o=0)}r=resolveOptions(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var _resolve=function(e){cleanup(),l(e)},_reject=function(e){cleanup(),c(e)};n?t(_resolve,_reject,u):(i=[function(e){_reject(e||Error("canceled"))}],t(_resolve,_reject,(function(e){if(a)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),a=!0),r.timeout>0&&(o=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",o=0,s.cancel(e),c(e)}),r.timeout))}));return n||(s.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),s}function findTargetIndex(e){var t=this._observers;if(!t)return-1;for(var r=t.length,n=0;n<r;n++)if(t[n]._target===e)return n;return-1}function searchListenerTree(e,t,r,n,i){if(!r)return null;if(0===n){var a=typeof t;if("string"===a){var o,s,l=0,c=0,u=this.delimiter,p=u.length;if(-1!==(s=t.indexOf(u))){o=new Array(5);do{o[l++]=t.slice(c,s),c=s+p}while(-1!==(s=t.indexOf(u,c)));o[l++]=t.slice(c),t=o,i=l}else t=[t],i=1}else"object"===a?i=t.length:(t=[t],i=1)}var h,y,g,m,v,b,w,C=null,S=t[n],_=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),C=[r]):(e&&e.push.apply(e,r._listeners),C=[r]));else{if("*"===S){for(s=(b=d(r)).length;s-- >0;)"_listeners"!==(h=b[s])&&(w=searchListenerTree(e,t,r[h],n+1,i))&&(C?C.push.apply(C,w):C=w);return C}if("**"===S){for((v=n+1===i||n+2===i&&"*"===_)&&r._listeners&&(C=searchListenerTree(e,t,r,i,i)),s=(b=d(r)).length;s-- >0;)"_listeners"!==(h=b[s])&&("*"===h||"**"===h?(r[h]._listeners&&!v&&(w=searchListenerTree(e,t,r[h],i,i))&&(C?C.push.apply(C,w):C=w),w=searchListenerTree(e,t,r[h],n,i)):w=searchListenerTree(e,t,r[h],h===_?n+2:n,i),w&&(C?C.push.apply(C,w):C=w));return C}r[S]&&(C=searchListenerTree(e,t,r[S],n+1,i))}if((y=r["*"])&&searchListenerTree(e,t,y,n+1,i),g=r["**"])if(n<i)for(g._listeners&&searchListenerTree(e,t,g,i,i),s=(b=d(g)).length;s-- >0;)"_listeners"!==(h=b[s])&&(h===_?searchListenerTree(e,t,g[h],n+2,i):h===S?searchListenerTree(e,t,g[h],n+1,i):((m={})[h]=g[h],searchListenerTree(e,t,{"**":m},n+1,i)));else g._listeners?searchListenerTree(e,t,g,i,i):g["*"]&&g["*"]._listeners&&searchListenerTree(e,t,g["*"],i,i);return C}function growListenerTree(e,t,r){var n,i,a=0,o=0,s=this.delimiter,l=s.length;if("string"==typeof e)if(-1!==(n=e.indexOf(s))){i=new Array(5);do{i[a++]=e.slice(o,n),o=n+l}while(-1!==(n=e.indexOf(s,o)));i[a++]=e.slice(o)}else i=[e],a=1;else i=e,a=e.length;if(a>1)for(n=0;n+1<a;n++)if("**"===i[n]&&"**"===i[n+1])return;var c,u=this.listenerTree;for(n=0;n<a;n++)if(u=u[c=i[n]]||(u[c]={}),n===a-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),r?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,logPossibleMemoryLeak.call(this,u._listeners.length,c))):u._listeners=t,!0;return!0}function collectTreeEvents(e,t,r,n){for(var i,a,o,s,l=d(e),c=l.length,u=e._listeners;c-- >0;)i=e[a=l[c]],o="_listeners"===a?r:r?r.concat(a):[a],s=n||"symbol"==typeof a,u&&t.push(s?o:o.join(this.delimiter)),"object"==typeof i&&collectTreeEvents.call(this,i,t,o,s);return t}function recursivelyGarbageCollect(e){for(var t,r,n,i=d(e),a=i.length;a-- >0;)(t=e[r=i[a]])&&(n=!0,"_listeners"===r||recursivelyGarbageCollect(t)||delete e[r]);return n}function Listener(e,t,r){this.emitter=e,this.event=t,this.listener=r}function setupListener(e,t,r){if(!0===r)a=!0;else if(!1===r)n=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var n=r.async,a=r.promisify,o=r.nextTick,l=r.objectify}if(n||o||a){var c=t,d=t._origin||t;if(o&&!s)throw Error("process.nextTick is not supported");a===i&&(a="AsyncFunction"===t.constructor.name),t=function(){var e=arguments,t=this,r=this.event;return a?o?Promise.resolve():new Promise((function(e){u(e)})).then((function(){return t.event=r,c.apply(t,e)})):(o?process.nextTick:u)((function(){t.event=r,c.apply(t,e)}))},t._async=!0,t._origin=d}return[t,l?new Listener(this,e,t):this]}function EventEmitter(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,configure.call(this,e)}Listener.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},EventEmitter.EventEmitter2=EventEmitter,EventEmitter.prototype.listenTo=function(e,t,r){if("object"!=typeof e)throw TypeError("target musts be an object");var n=this;function listen(t){if("object"!=typeof t)throw TypeError("events must be an object");var i,a=r.reducers,o=findTargetIndex.call(n,e);i=-1===o?new TargetObserver(n,e,r):n._observers[o];for(var s,l=d(t),c=l.length,u="function"==typeof a,p=0;p<c;p++)s=l[p],i.subscribe(s,t[s]||s,u?a:a&&a[s])}return r=resolveOptions(r,{on:i,off:i,reducers:i},{on:p,off:p,reducers:h}),o(t)?listen(toObject(t)):listen("string"==typeof t?toObject(t.split(/\s+/)):t),this},EventEmitter.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,a=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),a=!0);return a},EventEmitter.prototype.delimiter=".",EventEmitter.prototype.setMaxListeners=function(e){e!==i&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},EventEmitter.prototype.getMaxListeners=function(){return this._maxListeners},EventEmitter.prototype.event="",EventEmitter.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},EventEmitter.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},EventEmitter.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},EventEmitter.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},EventEmitter.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},EventEmitter.prototype._many=function(e,t,r,n,i){var a=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function listener(){return 0==--t&&a.off(e,listener),r.apply(this,arguments)}return listener._origin=r,this._on(e,listener,n,i)},EventEmitter.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||init.call(this);var e,t,r,n,i,a,o=arguments[0],s=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(s&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,l)for(n=0;n<r;n++)if("symbol"==typeof o[n]){a=!0;break}a||(o=o.join(this.delimiter))}var c,u=arguments.length;if(this._all&&this._all.length)for(n=0,r=(c=this._all.slice()).length;n<r;n++)switch(this.event=o,u){case 1:c[n].call(this,o);break;case 2:c[n].call(this,o,arguments[1]);break;case 3:c[n].call(this,o,arguments[1],arguments[2]);break;default:c[n].apply(this,arguments)}if(s)c=[],searchListenerTree.call(this,c,e,this.listenerTree,0,r);else{if("function"==typeof(c=this._events[o])){switch(this.event=o,u){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(u-1),i=1;i<u;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(u>3)for(t=new Array(u-1),i=1;i<u;i++)t[i-1]=arguments[i];for(n=0,r=c.length;n<r;n++)switch(this.event=o,u){case 1:c[n].call(this);break;case 2:c[n].call(this,arguments[1]);break;case 3:c[n].call(this,arguments[1],arguments[2]);break;default:c[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},EventEmitter.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||init.call(this);var e,t,r,n,i,a,o=arguments[0],s=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(s&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,l)for(i=0;i<n;i++)if("symbol"==typeof o[i]){t=!0;break}t||(o=o.join(this.delimiter))}var c,u=[],d=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=o,d){case 1:u.push(this._all[i].call(this,o));break;case 2:u.push(this._all[i].call(this,o,arguments[1]));break;case 3:u.push(this._all[i].call(this,o,arguments[1],arguments[2]));break;default:u.push(this._all[i].apply(this,arguments))}if(s?(c=[],searchListenerTree.call(this,c,e,this.listenerTree,0)):c=this._events[o],"function"==typeof c)switch(this.event=o,d){case 1:u.push(c.call(this));break;case 2:u.push(c.call(this,arguments[1]));break;case 3:u.push(c.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(d-1),a=1;a<d;a++)r[a-1]=arguments[a];u.push(c.apply(this,r))}else if(c&&c.length){if(c=c.slice(),d>3)for(r=new Array(d-1),a=1;a<d;a++)r[a-1]=arguments[a];for(i=0,n=c.length;i<n;i++)switch(this.event=o,d){case 1:u.push(c[i].call(this));break;case 2:u.push(c[i].call(this,arguments[1]));break;case 3:u.push(c[i].call(this,arguments[1],arguments[2]));break;default:u.push(c[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(u)},EventEmitter.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},EventEmitter.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},EventEmitter.prototype.onAny=function(e){return this._onAny(e,!1)},EventEmitter.prototype.prependAny=function(e){return this._onAny(e,!0)},EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},EventEmitter.prototype._on=function(e,t,r,n){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");this._events||init.call(this);var a,o=this;return n!==i&&(t=(a=setupListener.call(this,e,t,n))[0],o=a[1]),this._newListener&&this.emit("newListener",e,t),this.wildcard?(growListenerTree.call(this,e,t,r),o):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,logPossibleMemoryLeak.call(this,this._events[e].length,e))):this._events[e]=t,o)},EventEmitter.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();if(!(n=searchListenerTree.call(this,null,i,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var a=0;a<n.length;a++){var s=n[a];if(r=s._listeners,o(r)){for(var l=-1,c=0,u=r.length;c<u;c++)if(r[c]===t||r[c].listener&&r[c].listener===t||r[c]._origin&&r[c]._origin===t){l=c;break}if(l<0)continue;return this.wildcard?s._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete s._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete s._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&recursivelyGarbageCollect(this.listenerTree),this},EventEmitter.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},EventEmitter.prototype.removeListener=EventEmitter.prototype.off,EventEmitter.prototype.removeAllListeners=function(e){if(e===i)return!this._events||init.call(this),this;if(this.wildcard){var t,r=searchListenerTree.call(this,null,e,this.listenerTree,0);if(!r)return this;for(t=0;t<r.length;t++)r[t]._listeners=null;this.listenerTree&&recursivelyGarbageCollect(this.listenerTree)}else this._events&&(this._events[e]=null);return this},EventEmitter.prototype.listeners=function(e){var t,r,n,a,o,s=this._events;if(e===i){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!s)return[];for(a=(t=d(s)).length,n=[];a-- >0;)"function"==typeof(r=s[t[a]])?n.push(r):n.push.apply(n,r);return n}if(this.wildcard){if(!(o=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return searchListenerTree.call(this,l,c,o,0),l}return s&&(r=s[e])?"function"==typeof r?[r]:r:[]},EventEmitter.prototype.eventNames=function(e){var t=this._events;return this.wildcard?collectTreeEvents.call(this,this.listenerTree,[],null,e):t?d(t):[]},EventEmitter.prototype.listenerCount=function(e){return this.listeners(e).length},EventEmitter.prototype.hasListeners=function(e){if(this.wildcard){var t=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return searchListenerTree.call(this,t,r,this.listenerTree,0),t.length>0}var n=this._events,a=this._all;return!!(a&&a.length||n&&(e===i?d(n).length:n[e]))},EventEmitter.prototype.listenersAny=function(){return this._all?this._all:[]},EventEmitter.prototype.waitFor=function(e,t){var r=this,n=typeof t;return"number"===n?t={timeout:t}:"function"===n&&(t={filter:t}),makeCancelablePromise((t=resolveOptions(t,{timeout:0,filter:i,handleError:!1,Promise,overload:!1},{filter:p,Promise:constructorReducer})).Promise,(function(n,i,a){function listener(){var a=t.filter;if(!a||a.apply(r,arguments))if(r.off(e,listener),t.handleError){var o=arguments[0];o?i(o):n(toArray.apply(null,arguments).slice(1))}else n(toArray.apply(null,arguments))}a((function(){r.off(e,listener)})),r._on(e,listener,!1)}),{timeout:t.timeout,overload:t.overload})};var y=EventEmitter.prototype;Object.defineProperties(EventEmitter,{defaultMaxListeners:{get:function(){return y._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");y._maxListeners=e},enumerable:!0},once:{value:function once(e,t,r){return makeCancelablePromise((r=resolveOptions(r,{Promise,timeout:0,overload:!1},{Promise:constructorReducer})).Promise,(function(r,n,i){var a;if("function"==typeof e.addEventListener)return a=function(){r(toArray.apply(null,arguments))},i((function(){e.removeEventListener(t,a)})),void e.addEventListener(t,a,{once:!0});var o,eventListener=function(){o&&e.removeListener("error",o),r(toArray.apply(null,arguments))};"error"!==t&&(o=function(r){e.removeListener(t,eventListener),n(r)},e.once("error",o)),i((function(){o&&e.removeListener("error",o),e.removeListener(t,eventListener)})),e.once(t,eventListener)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(y,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),(n=function(){return EventEmitter}.call(t,r,t,e))===i||(e.exports=n)}()},6230:e=>{e.exports="object"==typeof self?self.FormData:window.FormData},7648:e=>{"use strict";var t=Object.prototype.toString,r=Math.max,n=function concatty(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r};e.exports=function bind(e){var i=this;if("function"!=typeof i||"[object Function]"!==t.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var a,o=function slicy(e,t){for(var r=[],n=t||0,i=0;n<e.length;n+=1,i+=1)r[i]=e[n];return r}(arguments,1),s=r(0,i.length-o.length),l=[],c=0;c<s;c++)l[c]="$"+c;if(a=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r}(l,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof a){var t=i.apply(this,n(o,arguments));return Object(t)===t?t:this}return i.apply(e,n(o,arguments))})),i.prototype){var u=function Empty(){};u.prototype=i.prototype,a.prototype=new u,u.prototype=null}return a}},8612:(e,t,r)=>{"use strict";var n=r(7648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,i=SyntaxError,a=Function,o=TypeError,getEvalledConstructor=function(e){try{return a('"use strict"; return ('+e+").constructor;")()}catch(e){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(e){s=null}var throwTypeError=function(){throw new o},l=s?function(){try{return throwTypeError}catch(e){try{return s(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,c=r(1405)(),u=r(8185)(),d=Object.getPrototypeOf||(u?function(e){return e.__proto__}:null),p={},h="undefined"!=typeof Uint8Array&&d?d(Uint8Array):n,y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":c&&d?d([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":a,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":c&&d?d(d([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&c&&d?d((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&c&&d?d((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":c&&d?d(""[Symbol.iterator]()):n,"%Symbol%":c?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":l,"%TypedArray%":h,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(d)try{null.error}catch(e){var g=d(d(e));y["%Error.prototype%"]=g}var m=function doEval(e){var t;if("%AsyncFunction%"===e)t=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===e)t=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===e)t=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===e){var r=doEval("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=doEval("%AsyncGenerator%");n&&d&&(t=d(n.prototype))}return y[e]=t,t},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=r(8612),w=r(8824),C=b.call(Function.call,Array.prototype.concat),S=b.call(Function.apply,Array.prototype.splice),_=b.call(Function.call,String.prototype.replace),R=b.call(Function.call,String.prototype.slice),O=b.call(Function.call,RegExp.prototype.exec),T=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,I=/\\(\\)?/g,E=function getBaseIntrinsic(e,t){var r,n=e;if(w(v,n)&&(n="%"+(r=v[n])[0]+"%"),w(y,n)){var a=y[n];if(a===p&&(a=m(n)),void 0===a&&!t)throw new o("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:a}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function GetIntrinsic(e,t){if("string"!=typeof e||0===e.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');if(null===O(/^%?[^%]*%?$/,e))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function stringToPath(e){var t=R(e,0,1),r=R(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return _(e,T,(function(e,t,r,i){n[n.length]=r?_(i,I,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",a=E("%"+n+"%",t),l=a.name,c=a.value,u=!1,d=a.alias;d&&(n=d[0],S(r,C([0,1],d)));for(var p=1,h=!0;p<r.length;p+=1){var g=r[p],m=R(g,0,1),v=R(g,-1);if(('"'===m||"'"===m||"`"===m||'"'===v||"'"===v||"`"===v)&&m!==v)throw new i("property names with quotes must have matching quotes");if("constructor"!==g&&h||(u=!0),w(y,l="%"+(n+="."+g)+"%"))c=y[l];else if(null!=c){if(!(g in c)){if(!t)throw new o("base intrinsic for "+e+" exists, but the property is not available.");return}if(s&&p+1>=r.length){var b=s(c,g);c=(h=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:c[g]}else h=w(c,g),c=c[g];h&&!u&&(y[l]=c)}}return c}},7296:(e,t,r)=>{"use strict";var n=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},1044:(e,t,r)=>{"use strict";var n=r(210)("%Object.defineProperty%",!0),i=function hasPropertyDescriptors(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};i.hasArrayLengthDefineBug=function hasArrayLengthDefineBug(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},8185:e=>{"use strict";var t={foo:{}},r=Object;e.exports=function hasProto(){return{__proto__:t}.foo===t.foo&&!({__proto__:null}instanceof r)}},1405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(5419);e.exports=function hasNativeSymbols(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},5419:e=>{"use strict";e.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},8824:(e,t,r)=>{"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,a=r(8612);e.exports=a.call(n,i)},4530:(e,t)=>{function serializer(e,t){var r=[],n=[];return null==t&&(t=function(e,t){return r[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(t)).join(".")+"]"}),function(i,a){if(r.length>0){var o=r.indexOf(this);~o?r.splice(o+1):r.push(this),~o?n.splice(o,1/0,i):n.push(i),~r.indexOf(a)&&(a=t.call(this,i,a))}else r.push(a);return null==e?a:e.call(this,i,a)}}(e.exports=function stringify(e,t,r,n){return JSON.stringify(e,serializer(t,n),r)}).getSerialize=serializer},6486:function(e,t,r){var n;e=r.nmd(e),function(){var i,a="Expected a function",o="__lodash_hash_undefined__",s="__lodash_placeholder__",l=16,c=32,u=64,d=128,p=256,h=1/0,y=9007199254740991,g=NaN,m=4294967295,v=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",l],["flip",512],["partial",c],["partialRight",u],["rearg",p]],b="[object Arguments]",w="[object Array]",C="[object Boolean]",S="[object Date]",_="[object Error]",R="[object Function]",O="[object GeneratorFunction]",T="[object Map]",I="[object Number]",E="[object Object]",D="[object Promise]",P="[object RegExp]",A="[object Set]",j="[object String]",M="[object Symbol]",x="[object WeakMap]",k="[object ArrayBuffer]",L="[object DataView]",F="[object Float32Array]",N="[object Float64Array]",z="[object Int8Array]",B="[object Int16Array]",U="[object Int32Array]",W="[object Uint8Array]",V="[object Uint8ClampedArray]",q="[object Uint16Array]",$="[object Uint32Array]",K=/\b__p \+= '';/g,H=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Z=/&(?:amp|lt|gt|quot|#39);/g,J=/[&<>"']/g,Y=RegExp(Z.source),Q=RegExp(J.source),X=/<%-([\s\S]+?)%>/g,ee=/<%([\s\S]+?)%>/g,te=/<%=([\s\S]+?)%>/g,re=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ne=/^\w*$/,ie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ae=/[\\^$.*+?()[\]{}|]/g,oe=RegExp(ae.source),se=/^\s+/,le=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ue=/\{\n\/\* \[wrapped with (.+)\] \*/,de=/,? & /,fe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,pe=/[()=,{}\[\]\/\s]/,he=/\\(\\)?/g,ye=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ge=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,ve=/^0b[01]+$/i,be=/^\[object .+?Constructor\]$/,we=/^0o[0-7]+$/i,Ce=/^(?:0|[1-9]\d*)$/,Se=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,Re=/['\n\r\u2028\u2029\\]/g,Oe="\\ud800-\\udfff",Te="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ie="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",De="A-Z\\xc0-\\xd6\\xd8-\\xde",Pe="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="['’]",Me="["+Oe+"]",xe="["+Ae+"]",ke="["+Te+"]",Le="\\d+",Fe="["+Ie+"]",Ne="["+Ee+"]",ze="[^"+Oe+Ae+Le+Ie+Ee+De+"]",Be="\\ud83c[\\udffb-\\udfff]",Ue="[^"+Oe+"]",We="(?:\\ud83c[\\udde6-\\uddff]){2}",Ve="[\\ud800-\\udbff][\\udc00-\\udfff]",qe="["+De+"]",$e="\\u200d",Ke="(?:"+Ne+"|"+ze+")",He="(?:"+qe+"|"+ze+")",Ge="(?:['’](?:d|ll|m|re|s|t|ve))?",Ze="(?:['’](?:D|LL|M|RE|S|T|VE))?",Je="(?:"+ke+"|"+Be+")"+"?",Ye="["+Pe+"]?",Qe=Ye+Je+("(?:"+$e+"(?:"+[Ue,We,Ve].join("|")+")"+Ye+Je+")*"),Xe="(?:"+[Fe,We,Ve].join("|")+")"+Qe,et="(?:"+[Ue+ke+"?",ke,We,Ve,Me].join("|")+")",tt=RegExp(je,"g"),rt=RegExp(ke,"g"),nt=RegExp(Be+"(?="+Be+")|"+et+Qe,"g"),it=RegExp([qe+"?"+Ne+"+"+Ge+"(?="+[xe,qe,"$"].join("|")+")",He+"+"+Ze+"(?="+[xe,qe+Ke,"$"].join("|")+")",qe+"?"+Ke+"+"+Ge,qe+"+"+Ze,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Le,Xe].join("|"),"g"),at=RegExp("["+$e+Oe+Te+Pe+"]"),ot=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,st=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],lt=-1,ct={};ct[F]=ct[N]=ct[z]=ct[B]=ct[U]=ct[W]=ct[V]=ct[q]=ct[$]=!0,ct[b]=ct[w]=ct[k]=ct[C]=ct[L]=ct[S]=ct[_]=ct[R]=ct[T]=ct[I]=ct[E]=ct[P]=ct[A]=ct[j]=ct[x]=!1;var ut={};ut[b]=ut[w]=ut[k]=ut[L]=ut[C]=ut[S]=ut[F]=ut[N]=ut[z]=ut[B]=ut[U]=ut[T]=ut[I]=ut[E]=ut[P]=ut[A]=ut[j]=ut[M]=ut[W]=ut[V]=ut[q]=ut[$]=!0,ut[_]=ut[R]=ut[x]=!1;var dt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ft=parseFloat,pt=parseInt,ht="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,yt="object"==typeof self&&self&&self.Object===Object&&self,gt=ht||yt||Function("return this")(),mt=t&&!t.nodeType&&t,vt=mt&&e&&!e.nodeType&&e,bt=vt&&vt.exports===mt,wt=bt&&ht.process,Ct=function(){try{var e=vt&&vt.require&&vt.require("util").types;return e||wt&&wt.binding&&wt.binding("util")}catch(e){}}(),St=Ct&&Ct.isArrayBuffer,_t=Ct&&Ct.isDate,Rt=Ct&&Ct.isMap,Ot=Ct&&Ct.isRegExp,Tt=Ct&&Ct.isSet,It=Ct&&Ct.isTypedArray;function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function arrayAggregator(e,t,r,n){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(n,o,r(o),e)}return n}function arrayEach(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function arrayEachRight(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function arrayEvery(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function arrayFilter(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}function arrayIncludes(e,t){return!!(null==e?0:e.length)&&baseIndexOf(e,t,0)>-1}function arrayIncludesWith(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function arrayPush(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function arrayReduce(e,t,r,n){var i=-1,a=null==e?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function arrayReduceRight(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function arraySome(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Et=baseProperty("length");function baseFindKey(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function baseFindIndex(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function baseIndexOf(e,t,r){return t==t?function strictIndexOf(e,t,r){var n=r-1,i=e.length;for(;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):baseFindIndex(e,baseIsNaN,r)}function baseIndexOfWith(e,t,r,n){for(var i=r-1,a=e.length;++i<a;)if(n(e[i],t))return i;return-1}function baseIsNaN(e){return e!=e}function baseMean(e,t){var r=null==e?0:e.length;return r?baseSum(e,t)/r:g}function baseProperty(e){return function(t){return null==t?i:t[e]}}function basePropertyOf(e){return function(t){return null==e?i:e[t]}}function baseReduce(e,t,r,n,i){return i(e,(function(e,i,a){r=n?(n=!1,e):t(r,e,i,a)})),r}function baseSum(e,t){for(var r,n=-1,a=e.length;++n<a;){var o=t(e[n]);o!==i&&(r=r===i?o:r+o)}return r}function baseTimes(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function baseTrim(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(se,""):e}function baseUnary(e){return function(t){return e(t)}}function baseValues(e,t){return arrayMap(t,(function(t){return e[t]}))}function cacheHas(e,t){return e.has(t)}function charsStartIndex(e,t){for(var r=-1,n=e.length;++r<n&&baseIndexOf(t,e[r],0)>-1;);return r}function charsEndIndex(e,t){for(var r=e.length;r--&&baseIndexOf(t,e[r],0)>-1;);return r}var Dt=basePropertyOf({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Pt=basePropertyOf({"&":"&","<":"<",">":">",'"':""","'":"'"});function escapeStringChar(e){return"\\"+dt[e]}function hasUnicode(e){return at.test(e)}function mapToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function overArg(e,t){return function(r){return e(t(r))}}function replaceHolders(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r];o!==t&&o!==s||(e[r]=s,a[i++]=r)}return a}function setToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function setToPairs(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}function stringSize(e){return hasUnicode(e)?function unicodeSize(e){var t=nt.lastIndex=0;for(;nt.test(e);)++t;return t}(e):Et(e)}function stringToArray(e){return hasUnicode(e)?function unicodeToArray(e){return e.match(nt)||[]}(e):function asciiToArray(e){return e.split("")}(e)}function trimmedEndIndex(e){for(var t=e.length;t--&&le.test(e.charAt(t)););return t}var At=basePropertyOf({"&":"&","<":"<",">":">",""":'"',"'":"'"});var jt=function runInContext(e){var t,r=(e=null==e?gt:jt.defaults(gt.Object(),e,jt.pick(gt,st))).Array,n=e.Date,le=e.Error,Oe=e.Function,Te=e.Math,Ie=e.Object,Ee=e.RegExp,De=e.String,Pe=e.TypeError,Ae=r.prototype,je=Oe.prototype,Me=Ie.prototype,xe=e["__core-js_shared__"],ke=je.toString,Le=Me.hasOwnProperty,Fe=0,Ne=(t=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"",ze=Me.toString,Be=ke.call(Ie),Ue=gt._,We=Ee("^"+ke.call(Le).replace(ae,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=bt?e.Buffer:i,qe=e.Symbol,$e=e.Uint8Array,Ke=Ve?Ve.allocUnsafe:i,He=overArg(Ie.getPrototypeOf,Ie),Ge=Ie.create,Ze=Me.propertyIsEnumerable,Je=Ae.splice,Ye=qe?qe.isConcatSpreadable:i,Qe=qe?qe.iterator:i,Xe=qe?qe.toStringTag:i,et=function(){try{var e=getNative(Ie,"defineProperty");return e({},"",{}),e}catch(e){}}(),nt=e.clearTimeout!==gt.clearTimeout&&e.clearTimeout,at=n&&n.now!==gt.Date.now&&n.now,dt=e.setTimeout!==gt.setTimeout&&e.setTimeout,ht=Te.ceil,yt=Te.floor,mt=Ie.getOwnPropertySymbols,vt=Ve?Ve.isBuffer:i,wt=e.isFinite,Ct=Ae.join,Et=overArg(Ie.keys,Ie),Mt=Te.max,xt=Te.min,kt=n.now,Lt=e.parseInt,Ft=Te.random,Nt=Ae.reverse,zt=getNative(e,"DataView"),Bt=getNative(e,"Map"),Ut=getNative(e,"Promise"),Wt=getNative(e,"Set"),Vt=getNative(e,"WeakMap"),qt=getNative(Ie,"create"),$t=Vt&&new Vt,Kt={},Ht=toSource(zt),Gt=toSource(Bt),Zt=toSource(Ut),Jt=toSource(Wt),Yt=toSource(Vt),Qt=qe?qe.prototype:i,Xt=Qt?Qt.valueOf:i,er=Qt?Qt.toString:i;function lodash(e){if(isObjectLike(e)&&!an(e)&&!(e instanceof LazyWrapper)){if(e instanceof LodashWrapper)return e;if(Le.call(e,"__wrapped__"))return wrapperClone(e)}return new LodashWrapper(e)}var tr=function(){function object(){}return function(e){if(!isObject(e))return{};if(Ge)return Ge(e);object.prototype=e;var t=new object;return object.prototype=i,t}}();function baseLodash(){}function LodashWrapper(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function LazyWrapper(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new MapCache;++t<r;)this.add(e[t])}function Stack(e){var t=this.__data__=new ListCache(e);this.size=t.size}function arrayLikeKeys(e,t){var r=an(e),n=!r&&nn(e),i=!r&&!n&&sn(e),a=!r&&!n&&!i&&fn(e),o=r||n||i||a,s=o?baseTimes(e.length,De):[],l=s.length;for(var c in e)!t&&!Le.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||isIndex(c,l))||s.push(c);return s}function arraySample(e){var t=e.length;return t?e[baseRandom(0,t-1)]:i}function arraySampleSize(e,t){return shuffleSelf(copyArray(e),baseClamp(t,0,e.length))}function arrayShuffle(e){return shuffleSelf(copyArray(e))}function assignMergeValue(e,t,r){(r!==i&&!eq(e[t],r)||r===i&&!(t in e))&&baseAssignValue(e,t,r)}function assignValue(e,t,r){var n=e[t];Le.call(e,t)&&eq(n,r)&&(r!==i||t in e)||baseAssignValue(e,t,r)}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}function baseAggregator(e,t,r,n){return rr(e,(function(e,i,a){t(n,e,r(e),a)})),n}function baseAssign(e,t){return e&©Object(t,keys(t),e)}function baseAssignValue(e,t,r){"__proto__"==t&&et?et(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function baseAt(e,t){for(var n=-1,a=t.length,o=r(a),s=null==e;++n<a;)o[n]=s?i:get(e,t[n]);return o}function baseClamp(e,t,r){return e==e&&(r!==i&&(e=e<=r?e:r),t!==i&&(e=e>=t?e:t)),e}function baseClone(e,t,r,n,a,o){var s,l=1&t,c=2&t,u=4&t;if(r&&(s=a?r(e,n,a,o):r(e)),s!==i)return s;if(!isObject(e))return e;var d=an(e);if(d){if(s=function initCloneArray(e){var t=e.length,r=new e.constructor(t);t&&"string"==typeof e[0]&&Le.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!l)return copyArray(e,s)}else{var p=hr(e),h=p==R||p==O;if(sn(e))return cloneBuffer(e,l);if(p==E||p==b||h&&!a){if(s=c||h?{}:initCloneObject(e),!l)return c?function copySymbolsIn(e,t){return copyObject(e,pr(e),t)}(e,function baseAssignIn(e,t){return e&©Object(t,keysIn(t),e)}(s,e)):function copySymbols(e,t){return copyObject(e,fr(e),t)}(e,baseAssign(s,e))}else{if(!ut[p])return a?e:{};s=function initCloneByTag(e,t,r){var n=e.constructor;switch(t){case k:return cloneArrayBuffer(e);case C:case S:return new n(+e);case L:return function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case F:case N:case z:case B:case U:case W:case V:case q:case $:return cloneTypedArray(e,r);case T:return new n;case I:case j:return new n(e);case P:return function cloneRegExp(e){var t=new e.constructor(e.source,ge.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new n;case M:return function cloneSymbol(e){return Xt?Ie(Xt.call(e)):{}}(e)}}(e,p,l)}}o||(o=new Stack);var y=o.get(e);if(y)return y;o.set(e,s),dn(e)?e.forEach((function(n){s.add(baseClone(n,t,r,n,e,o))})):cn(e)&&e.forEach((function(n,i){s.set(i,baseClone(n,t,r,i,e,o))}));var g=d?i:(u?c?getAllKeysIn:getAllKeys:c?keysIn:keys)(e);return arrayEach(g||e,(function(n,i){g&&(n=e[i=n]),assignValue(s,i,baseClone(n,t,r,i,e,o))})),s}function baseConformsTo(e,t,r){var n=r.length;if(null==e)return!n;for(e=Ie(e);n--;){var a=r[n],o=t[a],s=e[a];if(s===i&&!(a in e)||!o(s))return!1}return!0}function baseDelay(e,t,r){if("function"!=typeof e)throw new Pe(a);return mr((function(){e.apply(i,r)}),t)}function baseDifference(e,t,r,n){var i=-1,a=arrayIncludes,o=!0,s=e.length,l=[],c=t.length;if(!s)return l;r&&(t=arrayMap(t,baseUnary(r))),n?(a=arrayIncludesWith,o=!1):t.length>=200&&(a=cacheHas,o=!1,t=new SetCache(t));e:for(;++i<s;){var u=e[i],d=null==r?u:r(u);if(u=n||0!==u?u:0,o&&d==d){for(var p=c;p--;)if(t[p]===d)continue e;l.push(u)}else a(t,d,n)||l.push(u)}return l}lodash.templateSettings={escape:X,evaluate:ee,interpolate:te,variable:"",imports:{_:lodash}},lodash.prototype=baseLodash.prototype,lodash.prototype.constructor=lodash,LodashWrapper.prototype=tr(baseLodash.prototype),LodashWrapper.prototype.constructor=LodashWrapper,LazyWrapper.prototype=tr(baseLodash.prototype),LazyWrapper.prototype.constructor=LazyWrapper,Hash.prototype.clear=function hashClear(){this.__data__=qt?qt(null):{},this.size=0},Hash.prototype.delete=function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hash.prototype.get=function hashGet(e){var t=this.__data__;if(qt){var r=t[e];return r===o?i:r}return Le.call(t,e)?t[e]:i},Hash.prototype.has=function hashHas(e){var t=this.__data__;return qt?t[e]!==i:Le.call(t,e)},Hash.prototype.set=function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=qt&&t===i?o:t,this},ListCache.prototype.clear=function listCacheClear(){this.__data__=[],this.size=0},ListCache.prototype.delete=function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():Je.call(t,r,1),--this.size,!0)},ListCache.prototype.get=function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?i:t[r][1]},ListCache.prototype.has=function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1},ListCache.prototype.set=function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},MapCache.prototype.clear=function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Bt||ListCache),string:new Hash}},MapCache.prototype.delete=function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t},MapCache.prototype.get=function mapCacheGet(e){return getMapData(this,e).get(e)},MapCache.prototype.has=function mapCacheHas(e){return getMapData(this,e).has(e)},MapCache.prototype.set=function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},SetCache.prototype.add=SetCache.prototype.push=function setCacheAdd(e){return this.__data__.set(e,o),this},SetCache.prototype.has=function setCacheHas(e){return this.__data__.has(e)},Stack.prototype.clear=function stackClear(){this.__data__=new ListCache,this.size=0},Stack.prototype.delete=function stackDelete(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Stack.prototype.get=function stackGet(e){return this.__data__.get(e)},Stack.prototype.has=function stackHas(e){return this.__data__.has(e)},Stack.prototype.set=function stackSet(e,t){var r=this.__data__;if(r instanceof ListCache){var n=r.__data__;if(!Bt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new MapCache(n)}return r.set(e,t),this.size=r.size,this};var rr=createBaseEach(baseForOwn),nr=createBaseEach(baseForOwnRight,!0);function baseEvery(e,t){var r=!0;return rr(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function baseExtremum(e,t,r){for(var n=-1,a=e.length;++n<a;){var o=e[n],s=t(o);if(null!=s&&(l===i?s==s&&!isSymbol(s):r(s,l)))var l=s,c=o}return c}function baseFilter(e,t){var r=[];return rr(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function baseFlatten(e,t,r,n,i){var a=-1,o=e.length;for(r||(r=isFlattenable),i||(i=[]);++a<o;){var s=e[a];t>0&&r(s)?t>1?baseFlatten(s,t-1,r,n,i):arrayPush(i,s):n||(i[i.length]=s)}return i}var ir=createBaseFor(),ar=createBaseFor(!0);function baseForOwn(e,t){return e&&ir(e,t,keys)}function baseForOwnRight(e,t){return e&&ar(e,t,keys)}function baseFunctions(e,t){return arrayFilter(t,(function(t){return isFunction(e[t])}))}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:i}function baseGetAllKeys(e,t,r){var n=t(e);return an(e)?n:arrayPush(n,r(e))}function baseGetTag(e){return null==e?e===i?"[object Undefined]":"[object Null]":Xe&&Xe in Ie(e)?function getRawTag(e){var t=Le.call(e,Xe),r=e[Xe];try{e[Xe]=i;var n=!0}catch(e){}var a=ze.call(e);n&&(t?e[Xe]=r:delete e[Xe]);return a}(e):function objectToString(e){return ze.call(e)}(e)}function baseGt(e,t){return e>t}function baseHas(e,t){return null!=e&&Le.call(e,t)}function baseHasIn(e,t){return null!=e&&t in Ie(e)}function baseIntersection(e,t,n){for(var a=n?arrayIncludesWith:arrayIncludes,o=e[0].length,s=e.length,l=s,c=r(s),u=1/0,d=[];l--;){var p=e[l];l&&t&&(p=arrayMap(p,baseUnary(t))),u=xt(p.length,u),c[l]=!n&&(t||o>=120&&p.length>=120)?new SetCache(l&&p):i}p=e[0];var h=-1,y=c[0];e:for(;++h<o&&d.length<u;){var g=p[h],m=t?t(g):g;if(g=n||0!==g?g:0,!(y?cacheHas(y,m):a(d,m,n))){for(l=s;--l;){var v=c[l];if(!(v?cacheHas(v,m):a(e[l],m,n)))continue e}y&&y.push(m),d.push(g)}}return d}function baseInvoke(e,t,r){var n=null==(e=parent(e,t=castPath(t,e)))?e:e[toKey(last(t))];return null==n?i:apply(n,e,r)}function baseIsArguments(e){return isObjectLike(e)&&baseGetTag(e)==b}function baseIsEqual(e,t,r,n,a){return e===t||(null==e||null==t||!isObjectLike(e)&&!isObjectLike(t)?e!=e&&t!=t:function baseIsEqualDeep(e,t,r,n,a,o){var s=an(e),l=an(t),c=s?w:hr(e),u=l?w:hr(t),d=(c=c==b?E:c)==E,p=(u=u==b?E:u)==E,h=c==u;if(h&&sn(e)){if(!sn(t))return!1;s=!0,d=!1}if(h&&!d)return o||(o=new Stack),s||fn(e)?equalArrays(e,t,r,n,a,o):function equalByTag(e,t,r,n,i,a,o){switch(r){case L:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case k:return!(e.byteLength!=t.byteLength||!a(new $e(e),new $e(t)));case C:case S:case I:return eq(+e,+t);case _:return e.name==t.name&&e.message==t.message;case P:case j:return e==t+"";case T:var s=mapToArray;case A:var l=1&n;if(s||(s=setToArray),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var u=equalArrays(s(e),s(t),n,i,a,o);return o.delete(e),u;case M:if(Xt)return Xt.call(e)==Xt.call(t)}return!1}(e,t,c,r,n,a,o);if(!(1&r)){var y=d&&Le.call(e,"__wrapped__"),g=p&&Le.call(t,"__wrapped__");if(y||g){var m=y?e.value():e,v=g?t.value():t;return o||(o=new Stack),a(m,v,r,n,o)}}if(!h)return!1;return o||(o=new Stack),function equalObjects(e,t,r,n,a,o){var s=1&r,l=getAllKeys(e),c=l.length,u=getAllKeys(t),d=u.length;if(c!=d&&!s)return!1;var p=c;for(;p--;){var h=l[p];if(!(s?h in t:Le.call(t,h)))return!1}var y=o.get(e),g=o.get(t);if(y&&g)return y==t&&g==e;var m=!0;o.set(e,t),o.set(t,e);var v=s;for(;++p<c;){var b=e[h=l[p]],w=t[h];if(n)var C=s?n(w,b,h,t,e,o):n(b,w,h,e,t,o);if(!(C===i?b===w||a(b,w,r,n,o):C)){m=!1;break}v||(v="constructor"==h)}if(m&&!v){var S=e.constructor,_=t.constructor;S==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof _&&_ instanceof _||(m=!1)}return o.delete(e),o.delete(t),m}(e,t,r,n,a,o)}(e,t,r,n,baseIsEqual,a))}function baseIsMatch(e,t,r,n){var a=r.length,o=a,s=!n;if(null==e)return!o;for(e=Ie(e);a--;){var l=r[a];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<o;){var c=(l=r[a])[0],u=e[c],d=l[1];if(s&&l[2]){if(u===i&&!(c in e))return!1}else{var p=new Stack;if(n)var h=n(u,d,c,e,t,p);if(!(h===i?baseIsEqual(d,u,3,n,p):h))return!1}}return!0}function baseIsNative(e){return!(!isObject(e)||function isMasked(e){return!!Ne&&Ne in e}(e))&&(isFunction(e)?We:be).test(toSource(e))}function baseIteratee(e){return"function"==typeof e?e:null==e?identity:"object"==typeof e?an(e)?baseMatchesProperty(e[0],e[1]):baseMatches(e):property(e)}function baseKeys(e){if(!isPrototype(e))return Et(e);var t=[];for(var r in Ie(e))Le.call(e,r)&&"constructor"!=r&&t.push(r);return t}function baseKeysIn(e){if(!isObject(e))return function nativeKeysIn(e){var t=[];if(null!=e)for(var r in Ie(e))t.push(r);return t}(e);var t=isPrototype(e),r=[];for(var n in e)("constructor"!=n||!t&&Le.call(e,n))&&r.push(n);return r}function baseLt(e,t){return e<t}function baseMap(e,t){var n=-1,i=isArrayLike(e)?r(e.length):[];return rr(e,(function(e,r,a){i[++n]=t(e,r,a)})),i}function baseMatches(e){var t=getMatchData(e);return 1==t.length&&t[0][2]?matchesStrictComparable(t[0][0],t[0][1]):function(r){return r===e||baseIsMatch(r,e,t)}}function baseMatchesProperty(e,t){return isKey(e)&&isStrictComparable(t)?matchesStrictComparable(toKey(e),t):function(r){var n=get(r,e);return n===i&&n===t?hasIn(r,e):baseIsEqual(t,n,3)}}function baseMerge(e,t,r,n,a){e!==t&&ir(t,(function(o,s){if(a||(a=new Stack),isObject(o))!function baseMergeDeep(e,t,r,n,a,o,s){var l=safeGet(e,r),c=safeGet(t,r),u=s.get(c);if(u)return void assignMergeValue(e,r,u);var d=o?o(l,c,r+"",e,t,s):i,p=d===i;if(p){var h=an(c),y=!h&&sn(c),g=!h&&!y&&fn(c);d=c,h||y||g?an(l)?d=l:isArrayLikeObject(l)?d=copyArray(l):y?(p=!1,d=cloneBuffer(c,!0)):g?(p=!1,d=cloneTypedArray(c,!0)):d=[]:isPlainObject(c)||nn(c)?(d=l,nn(l)?d=toPlainObject(l):isObject(l)&&!isFunction(l)||(d=initCloneObject(c))):p=!1}p&&(s.set(c,d),a(d,c,n,o,s),s.delete(c));assignMergeValue(e,r,d)}(e,t,s,r,baseMerge,n,a);else{var l=n?n(safeGet(e,s),o,s+"",e,t,a):i;l===i&&(l=o),assignMergeValue(e,s,l)}}),keysIn)}function baseNth(e,t){var r=e.length;if(r)return isIndex(t+=t<0?r:0,r)?e[t]:i}function baseOrderBy(e,t,r){t=t.length?arrayMap(t,(function(e){return an(e)?function(t){return baseGet(t,1===e.length?e[0]:e)}:e})):[identity];var n=-1;t=arrayMap(t,baseUnary(getIteratee()));var i=baseMap(e,(function(e,r,i){var a=arrayMap(t,(function(t){return t(e)}));return{criteria:a,index:++n,value:e}}));return function baseSortBy(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(i,(function(e,t){return function compareMultiple(e,t,r){var n=-1,i=e.criteria,a=t.criteria,o=i.length,s=r.length;for(;++n<o;){var l=compareAscending(i[n],a[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function basePickBy(e,t,r){for(var n=-1,i=t.length,a={};++n<i;){var o=t[n],s=baseGet(e,o);r(s,o)&&baseSet(a,castPath(o,e),s)}return a}function basePullAll(e,t,r,n){var i=n?baseIndexOfWith:baseIndexOf,a=-1,o=t.length,s=e;for(e===t&&(t=copyArray(t)),r&&(s=arrayMap(e,baseUnary(r)));++a<o;)for(var l=0,c=t[a],u=r?r(c):c;(l=i(s,u,l,n))>-1;)s!==e&&Je.call(s,l,1),Je.call(e,l,1);return e}function basePullAt(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==a){var a=i;isIndex(i)?Je.call(e,i,1):baseUnset(e,i)}}return e}function baseRandom(e,t){return e+yt(Ft()*(t-e+1))}function baseRepeat(e,t){var r="";if(!e||t<1||t>y)return r;do{t%2&&(r+=e),(t=yt(t/2))&&(e+=e)}while(t);return r}function baseRest(e,t){return vr(overRest(e,t,identity),e+"")}function baseSample(e){return arraySample(values(e))}function baseSampleSize(e,t){var r=values(e);return shuffleSelf(r,baseClamp(t,0,r.length))}function baseSet(e,t,r,n){if(!isObject(e))return e;for(var a=-1,o=(t=castPath(t,e)).length,s=o-1,l=e;null!=l&&++a<o;){var c=toKey(t[a]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(a!=s){var d=l[c];(u=n?n(d,c,l):i)===i&&(u=isObject(d)?d:isIndex(t[a+1])?[]:{})}assignValue(l,c,u),l=l[c]}return e}var or=$t?function(e,t){return $t.set(e,t),e}:identity,sr=et?function(e,t){return et(e,"toString",{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity;function baseShuffle(e){return shuffleSelf(values(e))}function baseSlice(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i<a;)o[i]=e[i+t];return o}function baseSome(e,t){var r;return rr(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function baseSortedIndex(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var a=n+i>>>1,o=e[a];null!==o&&!isSymbol(o)&&(r?o<=t:o<t)?n=a+1:i=a}return i}return baseSortedIndexBy(e,t,identity,r)}function baseSortedIndexBy(e,t,r,n){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=r(t))!=t,l=null===t,c=isSymbol(t),u=t===i;a<o;){var d=yt((a+o)/2),p=r(e[d]),h=p!==i,y=null===p,g=p==p,m=isSymbol(p);if(s)var v=n||g;else v=u?g&&(n||h):l?g&&h&&(n||!y):c?g&&h&&!y&&(n||!m):!y&&!m&&(n?p<=t:p<t);v?a=d+1:o=d}return xt(o,4294967294)}function baseSortedUniq(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var o=e[r],s=t?t(o):o;if(!r||!eq(s,l)){var l=s;a[i++]=0===o?0:o}}return a}function baseToNumber(e){return"number"==typeof e?e:isSymbol(e)?g:+e}function baseToString(e){if("string"==typeof e)return e;if(an(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return er?er.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function baseUniq(e,t,r){var n=-1,i=arrayIncludes,a=e.length,o=!0,s=[],l=s;if(r)o=!1,i=arrayIncludesWith;else if(a>=200){var c=t?null:ur(e);if(c)return setToArray(c);o=!1,i=cacheHas,l=new SetCache}else l=t?[]:s;e:for(;++n<a;){var u=e[n],d=t?t(u):u;if(u=r||0!==u?u:0,o&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;t&&l.push(d),s.push(u)}else i(l,d,r)||(l!==s&&l.push(d),s.push(u))}return s}function baseUnset(e,t){return null==(e=parent(e,t=castPath(t,e)))||delete e[toKey(last(t))]}function baseUpdate(e,t,r,n){return baseSet(e,t,r(baseGet(e,t)),n)}function baseWhile(e,t,r,n){for(var i=e.length,a=n?i:-1;(n?a--:++a<i)&&t(e[a],a,e););return r?baseSlice(e,n?0:a,n?a+1:i):baseSlice(e,n?a+1:0,n?i:a)}function baseWrapperValue(e,t){var r=e;return r instanceof LazyWrapper&&(r=r.value()),arrayReduce(t,(function(e,t){return t.func.apply(t.thisArg,arrayPush([e],t.args))}),r)}function baseXor(e,t,n){var i=e.length;if(i<2)return i?baseUniq(e[0]):[];for(var a=-1,o=r(i);++a<i;)for(var s=e[a],l=-1;++l<i;)l!=a&&(o[a]=baseDifference(o[a]||s,e[l],t,n));return baseUniq(baseFlatten(o,1),t,n)}function baseZipObject(e,t,r){for(var n=-1,a=e.length,o=t.length,s={};++n<a;){var l=n<o?t[n]:i;r(s,e[n],l)}return s}function castArrayLikeObject(e){return isArrayLikeObject(e)?e:[]}function castFunction(e){return"function"==typeof e?e:identity}function castPath(e,t){return an(e)?e:isKey(e,t)?[e]:br(toString(e))}var lr=baseRest;function castSlice(e,t,r){var n=e.length;return r=r===i?n:r,!t&&r>=n?e:baseSlice(e,t,r)}var cr=nt||function(e){return gt.clearTimeout(e)};function cloneBuffer(e,t){if(t)return e.slice();var r=e.length,n=Ke?Ke(r):new e.constructor(r);return e.copy(n),n}function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function compareAscending(e,t){if(e!==t){var r=e!==i,n=null===e,a=e==e,o=isSymbol(e),s=t!==i,l=null===t,c=t==t,u=isSymbol(t);if(!l&&!u&&!o&&e>t||o&&s&&c&&!l&&!u||n&&s&&c||!r&&c||!a)return 1;if(!n&&!o&&!u&&e<t||u&&r&&a&&!n&&!o||l&&r&&a||!s&&a||!c)return-1}return 0}function composeArgs(e,t,n,i){for(var a=-1,o=e.length,s=n.length,l=-1,c=t.length,u=Mt(o-s,0),d=r(c+u),p=!i;++l<c;)d[l]=t[l];for(;++a<s;)(p||a<o)&&(d[n[a]]=e[a]);for(;u--;)d[l++]=e[a++];return d}function composeArgsRight(e,t,n,i){for(var a=-1,o=e.length,s=-1,l=n.length,c=-1,u=t.length,d=Mt(o-l,0),p=r(d+u),h=!i;++a<d;)p[a]=e[a];for(var y=a;++c<u;)p[y+c]=t[c];for(;++s<l;)(h||a<o)&&(p[y+n[s]]=e[a++]);return p}function copyArray(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function copyObject(e,t,r,n){var a=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var l=t[o],c=n?n(r[l],e[l],l,r,e):i;c===i&&(c=e[l]),a?baseAssignValue(r,l,c):assignValue(r,l,c)}return r}function createAggregator(e,t){return function(r,n){var i=an(r)?arrayAggregator:baseAggregator,a=t?t():{};return i(r,e,getIteratee(n,2),a)}}function createAssigner(e){return baseRest((function(t,r){var n=-1,a=r.length,o=a>1?r[a-1]:i,s=a>2?r[2]:i;for(o=e.length>3&&"function"==typeof o?(a--,o):i,s&&isIterateeCall(r[0],r[1],s)&&(o=a<3?i:o,a=1),t=Ie(t);++n<a;){var l=r[n];l&&e(t,l,n,o)}return t}))}function createBaseEach(e,t){return function(r,n){if(null==r)return r;if(!isArrayLike(r))return e(r,n);for(var i=r.length,a=t?i:-1,o=Ie(r);(t?a--:++a<i)&&!1!==n(o[a],a,o););return r}}function createBaseFor(e){return function(t,r,n){for(var i=-1,a=Ie(t),o=n(t),s=o.length;s--;){var l=o[e?s:++i];if(!1===r(a[l],l,a))break}return t}}function createCaseFirst(e){return function(t){var r=hasUnicode(t=toString(t))?stringToArray(t):i,n=r?r[0]:t.charAt(0),a=r?castSlice(r,1).join(""):t.slice(1);return n[e]()+a}}function createCompounder(e){return function(t){return arrayReduce(words(deburr(t).replace(tt,"")),e,"")}}function createCtor(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=tr(e.prototype),n=e.apply(r,t);return isObject(n)?n:r}}function createFind(e){return function(t,r,n){var a=Ie(t);if(!isArrayLike(t)){var o=getIteratee(r,3);t=keys(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,n);return s>-1?a[o?t[s]:s]:i}}function createFlow(e){return flatRest((function(t){var r=t.length,n=r,o=LodashWrapper.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new Pe(a);if(o&&!l&&"wrapper"==getFuncName(s))var l=new LodashWrapper([],!0)}for(n=l?n:r;++n<r;){var c=getFuncName(s=t[n]),u="wrapper"==c?dr(s):i;l=u&&isLaziable(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[getFuncName(u[0])].apply(l,u[3]):1==s.length&&isLaziable(s)?l[c]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&an(n))return l.plant(n).value();for(var i=0,a=r?t[i].apply(this,e):n;++i<r;)a=t[i].call(this,a);return a}}))}function createHybrid(e,t,n,a,o,s,l,c,u,p){var h=t&d,y=1&t,g=2&t,m=24&t,v=512&t,b=g?i:createCtor(e);return function wrapper(){for(var d=arguments.length,w=r(d),C=d;C--;)w[C]=arguments[C];if(m)var S=getHolder(wrapper),_=function countHolders(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(w,S);if(a&&(w=composeArgs(w,a,o,m)),s&&(w=composeArgsRight(w,s,l,m)),d-=_,m&&d<p){var R=replaceHolders(w,S);return createRecurry(e,t,createHybrid,wrapper.placeholder,n,w,R,c,u,p-d)}var O=y?n:this,T=g?O[e]:e;return d=w.length,c?w=function reorder(e,t){var r=e.length,n=xt(t.length,r),a=copyArray(e);for(;n--;){var o=t[n];e[n]=isIndex(o,r)?a[o]:i}return e}(w,c):v&&d>1&&w.reverse(),h&&u<d&&(w.length=u),this&&this!==gt&&this instanceof wrapper&&(T=b||createCtor(T)),T.apply(O,w)}}function createInverter(e,t){return function(r,n){return function baseInverter(e,t,r,n){return baseForOwn(e,(function(e,i,a){t(n,r(e),i,a)})),n}(r,e,t(n),{})}}function createMathOperation(e,t){return function(r,n){var a;if(r===i&&n===i)return t;if(r!==i&&(a=r),n!==i){if(a===i)return n;"string"==typeof r||"string"==typeof n?(r=baseToString(r),n=baseToString(n)):(r=baseToNumber(r),n=baseToNumber(n)),a=e(r,n)}return a}}function createOver(e){return flatRest((function(t){return t=arrayMap(t,baseUnary(getIteratee())),baseRest((function(r){var n=this;return e(t,(function(e){return apply(e,n,r)}))}))}))}function createPadding(e,t){var r=(t=t===i?" ":baseToString(t)).length;if(r<2)return r?baseRepeat(t,e):t;var n=baseRepeat(t,ht(e/stringSize(t)));return hasUnicode(t)?castSlice(stringToArray(n),0,e).join(""):n.slice(0,e)}function createRange(e){return function(t,n,a){return a&&"number"!=typeof a&&isIterateeCall(t,n,a)&&(n=a=i),t=toFinite(t),n===i?(n=t,t=0):n=toFinite(n),function baseRange(e,t,n,i){for(var a=-1,o=Mt(ht((t-e)/(n||1)),0),s=r(o);o--;)s[i?o:++a]=e,e+=n;return s}(t,n,a=a===i?t<n?1:-1:toFinite(a),e)}}function createRelationalOperation(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=toNumber(t),r=toNumber(r)),e(t,r)}}function createRecurry(e,t,r,n,a,o,s,l,d,p){var h=8&t;t|=h?c:u,4&(t&=~(h?u:c))||(t&=-4);var y=[e,t,a,h?o:i,h?s:i,h?i:o,h?i:s,l,d,p],g=r.apply(i,y);return isLaziable(e)&&gr(g,y),g.placeholder=n,setWrapToString(g,e,t)}function createRound(e){var t=Te[e];return function(e,r){if(e=toNumber(e),(r=null==r?0:xt(toInteger(r),292))&&wt(e)){var n=(toString(e)+"e").split("e");return+((n=(toString(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var ur=Wt&&1/setToArray(new Wt([,-0]))[1]==h?function(e){return new Wt(e)}:noop;function createToPairs(e){return function(t){var r=hr(t);return r==T?mapToArray(t):r==A?setToPairs(t):function baseToPairs(e,t){return arrayMap(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function createWrap(e,t,n,o,h,y,g,m){var v=2&t;if(!v&&"function"!=typeof e)throw new Pe(a);var b=o?o.length:0;if(b||(t&=-97,o=h=i),g=g===i?g:Mt(toInteger(g),0),m=m===i?m:toInteger(m),b-=h?h.length:0,t&u){var w=o,C=h;o=h=i}var S=v?i:dr(e),_=[e,t,n,o,h,w,C,y,g,m];if(S&&function mergeData(e,t){var r=e[1],n=t[1],i=r|n,a=i<131,o=n==d&&8==r||n==d&&r==p&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!a&&!o)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var l=t[3];if(l){var c=e[3];e[3]=c?composeArgs(c,l,t[4]):l,e[4]=c?replaceHolders(e[3],s):t[4]}(l=t[5])&&(c=e[5],e[5]=c?composeArgsRight(c,l,t[6]):l,e[6]=c?replaceHolders(e[5],s):t[6]);(l=t[7])&&(e[7]=l);n&d&&(e[8]=null==e[8]?t[8]:xt(e[8],t[8]));null==e[9]&&(e[9]=t[9]);return e[0]=t[0],e[1]=i,e}(_,S),e=_[0],t=_[1],n=_[2],o=_[3],h=_[4],!(m=_[9]=_[9]===i?v?0:e.length:Mt(_[9]-b,0))&&24&t&&(t&=-25),t&&1!=t)R=8==t||t==l?function createCurry(e,t,n){var a=createCtor(e);return function wrapper(){for(var o=arguments.length,s=r(o),l=o,c=getHolder(wrapper);l--;)s[l]=arguments[l];var u=o<3&&s[0]!==c&&s[o-1]!==c?[]:replaceHolders(s,c);return(o-=u.length)<n?createRecurry(e,t,createHybrid,wrapper.placeholder,i,s,u,i,i,n-o):apply(this&&this!==gt&&this instanceof wrapper?a:e,this,s)}}(e,t,m):t!=c&&33!=t||h.length?createHybrid.apply(i,_):function createPartial(e,t,n,i){var a=1&t,o=createCtor(e);return function wrapper(){for(var t=-1,s=arguments.length,l=-1,c=i.length,u=r(c+s),d=this&&this!==gt&&this instanceof wrapper?o:e;++l<c;)u[l]=i[l];for(;s--;)u[l++]=arguments[++t];return apply(d,a?n:this,u)}}(e,t,n,o);else var R=function createBind(e,t,r){var n=1&t,i=createCtor(e);return function wrapper(){return(this&&this!==gt&&this instanceof wrapper?i:e).apply(n?r:this,arguments)}}(e,t,n);return setWrapToString((S?or:gr)(R,_),e,t)}function customDefaultsAssignIn(e,t,r,n){return e===i||eq(e,Me[r])&&!Le.call(n,r)?t:e}function customDefaultsMerge(e,t,r,n,a,o){return isObject(e)&&isObject(t)&&(o.set(t,e),baseMerge(e,t,i,customDefaultsMerge,o),o.delete(t)),e}function customOmitClone(e){return isPlainObject(e)?i:e}function equalArrays(e,t,r,n,a,o){var s=1&r,l=e.length,c=t.length;if(l!=c&&!(s&&c>l))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var p=-1,h=!0,y=2&r?new SetCache:i;for(o.set(e,t),o.set(t,e);++p<l;){var g=e[p],m=t[p];if(n)var v=s?n(m,g,p,t,e,o):n(g,m,p,e,t,o);if(v!==i){if(v)continue;h=!1;break}if(y){if(!arraySome(t,(function(e,t){if(!cacheHas(y,t)&&(g===e||a(g,e,r,n,o)))return y.push(t)}))){h=!1;break}}else if(g!==m&&!a(g,m,r,n,o)){h=!1;break}}return o.delete(e),o.delete(t),h}function flatRest(e){return vr(overRest(e,i,flatten),e+"")}function getAllKeys(e){return baseGetAllKeys(e,keys,fr)}function getAllKeysIn(e){return baseGetAllKeys(e,keysIn,pr)}var dr=$t?function(e){return $t.get(e)}:noop;function getFuncName(e){for(var t=e.name+"",r=Kt[t],n=Le.call(Kt,t)?r.length:0;n--;){var i=r[n],a=i.func;if(null==a||a==e)return i.name}return t}function getHolder(e){return(Le.call(lodash,"placeholder")?lodash:e).placeholder}function getIteratee(){var e=lodash.iteratee||iteratee;return e=e===iteratee?baseIteratee:e,arguments.length?e(arguments[0],arguments[1]):e}function getMapData(e,t){var r=e.__data__;return function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function getMatchData(e){for(var t=keys(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,isStrictComparable(i)]}return t}function getNative(e,t){var r=function getValue(e,t){return null==e?i:e[t]}(e,t);return baseIsNative(r)?r:i}var fr=mt?function(e){return null==e?[]:(e=Ie(e),arrayFilter(mt(e),(function(t){return Ze.call(e,t)})))}:stubArray,pr=mt?function(e){for(var t=[];e;)arrayPush(t,fr(e)),e=He(e);return t}:stubArray,hr=baseGetTag;function hasPath(e,t,r){for(var n=-1,i=(t=castPath(t,e)).length,a=!1;++n<i;){var o=toKey(t[n]);if(!(a=null!=e&&r(e,o)))break;e=e[o]}return a||++n!=i?a:!!(i=null==e?0:e.length)&&isLength(i)&&isIndex(o,i)&&(an(e)||nn(e))}function initCloneObject(e){return"function"!=typeof e.constructor||isPrototype(e)?{}:tr(He(e))}function isFlattenable(e){return an(e)||nn(e)||!!(Ye&&e&&e[Ye])}function isIndex(e,t){var r=typeof e;return!!(t=null==t?y:t)&&("number"==r||"symbol"!=r&&Ce.test(e))&&e>-1&&e%1==0&&e<t}function isIterateeCall(e,t,r){if(!isObject(r))return!1;var n=typeof t;return!!("number"==n?isArrayLike(r)&&isIndex(t,r.length):"string"==n&&t in r)&&eq(r[t],e)}function isKey(e,t){if(an(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(ne.test(e)||!re.test(e)||null!=t&&e in Ie(t))}function isLaziable(e){var t=getFuncName(e),r=lodash[t];if("function"!=typeof r||!(t in LazyWrapper.prototype))return!1;if(e===r)return!0;var n=dr(r);return!!n&&e===n[0]}(zt&&hr(new zt(new ArrayBuffer(1)))!=L||Bt&&hr(new Bt)!=T||Ut&&hr(Ut.resolve())!=D||Wt&&hr(new Wt)!=A||Vt&&hr(new Vt)!=x)&&(hr=function(e){var t=baseGetTag(e),r=t==E?e.constructor:i,n=r?toSource(r):"";if(n)switch(n){case Ht:return L;case Gt:return T;case Zt:return D;case Jt:return A;case Yt:return x}return t});var yr=xe?isFunction:stubFalse;function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Me)}function isStrictComparable(e){return e==e&&!isObject(e)}function matchesStrictComparable(e,t){return function(r){return null!=r&&(r[e]===t&&(t!==i||e in Ie(r)))}}function overRest(e,t,n){return t=Mt(t===i?e.length-1:t,0),function(){for(var i=arguments,a=-1,o=Mt(i.length-t,0),s=r(o);++a<o;)s[a]=i[t+a];a=-1;for(var l=r(t+1);++a<t;)l[a]=i[a];return l[t]=n(s),apply(e,this,l)}}function parent(e,t){return t.length<2?e:baseGet(e,baseSlice(t,0,-1))}function safeGet(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gr=shortOut(or),mr=dt||function(e,t){return gt.setTimeout(e,t)},vr=shortOut(sr);function setWrapToString(e,t,r){var n=t+"";return vr(e,function insertWrapDetails(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ce,"{\n/* [wrapped with "+t+"] */\n")}(n,function updateWrapDetails(e,t){return arrayEach(v,(function(r){var n="_."+r[0];t&r[1]&&!arrayIncludes(e,n)&&e.push(n)})),e.sort()}(function getWrapDetails(e){var t=e.match(ue);return t?t[1].split(de):[]}(n),r)))}function shortOut(e){var t=0,r=0;return function(){var n=kt(),a=16-(n-r);if(r=n,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function shuffleSelf(e,t){var r=-1,n=e.length,a=n-1;for(t=t===i?n:t;++r<t;){var o=baseRandom(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var br=function memoizeCapped(e){var t=memoize(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ie,(function(e,r,n,i){t.push(n?i.replace(he,"$1"):r||e)})),t}));function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function toSource(e){if(null!=e){try{return ke.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function wrapperClone(e){if(e instanceof LazyWrapper)return e.clone();var t=new LodashWrapper(e.__wrapped__,e.__chain__);return t.__actions__=copyArray(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var wr=baseRest((function(e,t){return isArrayLikeObject(e)?baseDifference(e,baseFlatten(t,1,isArrayLikeObject,!0)):[]})),Cr=baseRest((function(e,t){var r=last(t);return isArrayLikeObject(r)&&(r=i),isArrayLikeObject(e)?baseDifference(e,baseFlatten(t,1,isArrayLikeObject,!0),getIteratee(r,2)):[]})),Sr=baseRest((function(e,t){var r=last(t);return isArrayLikeObject(r)&&(r=i),isArrayLikeObject(e)?baseDifference(e,baseFlatten(t,1,isArrayLikeObject,!0),i,r):[]}));function findIndex(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:toInteger(r);return i<0&&(i=Mt(n+i,0)),baseFindIndex(e,getIteratee(t,3),i)}function findLastIndex(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=n-1;return r!==i&&(a=toInteger(r),a=r<0?Mt(n+a,0):xt(a,n-1)),baseFindIndex(e,getIteratee(t,3),a,!0)}function flatten(e){return(null==e?0:e.length)?baseFlatten(e,1):[]}function head(e){return e&&e.length?e[0]:i}var _r=baseRest((function(e){var t=arrayMap(e,castArrayLikeObject);return t.length&&t[0]===e[0]?baseIntersection(t):[]})),Rr=baseRest((function(e){var t=last(e),r=arrayMap(e,castArrayLikeObject);return t===last(r)?t=i:r.pop(),r.length&&r[0]===e[0]?baseIntersection(r,getIteratee(t,2)):[]})),Or=baseRest((function(e){var t=last(e),r=arrayMap(e,castArrayLikeObject);return(t="function"==typeof t?t:i)&&r.pop(),r.length&&r[0]===e[0]?baseIntersection(r,i,t):[]}));function last(e){var t=null==e?0:e.length;return t?e[t-1]:i}var Tr=baseRest(pullAll);function pullAll(e,t){return e&&e.length&&t&&t.length?basePullAll(e,t):e}var Ir=flatRest((function(e,t){var r=null==e?0:e.length,n=baseAt(e,t);return basePullAt(e,arrayMap(t,(function(e){return isIndex(e,r)?+e:e})).sort(compareAscending)),n}));function reverse(e){return null==e?e:Nt.call(e)}var Er=baseRest((function(e){return baseUniq(baseFlatten(e,1,isArrayLikeObject,!0))})),Dr=baseRest((function(e){var t=last(e);return isArrayLikeObject(t)&&(t=i),baseUniq(baseFlatten(e,1,isArrayLikeObject,!0),getIteratee(t,2))})),Pr=baseRest((function(e){var t=last(e);return t="function"==typeof t?t:i,baseUniq(baseFlatten(e,1,isArrayLikeObject,!0),i,t)}));function unzip(e){if(!e||!e.length)return[];var t=0;return e=arrayFilter(e,(function(e){if(isArrayLikeObject(e))return t=Mt(e.length,t),!0})),baseTimes(t,(function(t){return arrayMap(e,baseProperty(t))}))}function unzipWith(e,t){if(!e||!e.length)return[];var r=unzip(e);return null==t?r:arrayMap(r,(function(e){return apply(t,i,e)}))}var Ar=baseRest((function(e,t){return isArrayLikeObject(e)?baseDifference(e,t):[]})),jr=baseRest((function(e){return baseXor(arrayFilter(e,isArrayLikeObject))})),Mr=baseRest((function(e){var t=last(e);return isArrayLikeObject(t)&&(t=i),baseXor(arrayFilter(e,isArrayLikeObject),getIteratee(t,2))})),xr=baseRest((function(e){var t=last(e);return t="function"==typeof t?t:i,baseXor(arrayFilter(e,isArrayLikeObject),i,t)})),kr=baseRest(unzip);var Lr=baseRest((function(e){var t=e.length,r=t>1?e[t-1]:i;return r="function"==typeof r?(e.pop(),r):i,unzipWith(e,r)}));function chain(e){var t=lodash(e);return t.__chain__=!0,t}function thru(e,t){return t(e)}var Fr=flatRest((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,interceptor=function(t){return baseAt(t,e)};return!(t>1||this.__actions__.length)&&n instanceof LazyWrapper&&isIndex(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:thru,args:[interceptor],thisArg:i}),new LodashWrapper(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(interceptor)}));var Nr=createAggregator((function(e,t,r){Le.call(e,r)?++e[r]:baseAssignValue(e,r,1)}));var zr=createFind(findIndex),Br=createFind(findLastIndex);function forEach(e,t){return(an(e)?arrayEach:rr)(e,getIteratee(t,3))}function forEachRight(e,t){return(an(e)?arrayEachRight:nr)(e,getIteratee(t,3))}var Ur=createAggregator((function(e,t,r){Le.call(e,r)?e[r].push(t):baseAssignValue(e,r,[t])}));var Wr=baseRest((function(e,t,n){var i=-1,a="function"==typeof t,o=isArrayLike(e)?r(e.length):[];return rr(e,(function(e){o[++i]=a?apply(t,e,n):baseInvoke(e,t,n)})),o})),Vr=createAggregator((function(e,t,r){baseAssignValue(e,r,t)}));function map(e,t){return(an(e)?arrayMap:baseMap)(e,getIteratee(t,3))}var qr=createAggregator((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));var $r=baseRest((function(e,t){if(null==e)return[];var r=t.length;return r>1&&isIterateeCall(e,t[0],t[1])?t=[]:r>2&&isIterateeCall(t[0],t[1],t[2])&&(t=[t[0]]),baseOrderBy(e,baseFlatten(t,1),[])})),Kr=at||function(){return gt.Date.now()};function ary(e,t,r){return t=r?i:t,t=e&&null==t?e.length:t,createWrap(e,d,i,i,i,i,t)}function before(e,t){var r;if("function"!=typeof t)throw new Pe(a);return e=toInteger(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=i),r}}var Hr=baseRest((function(e,t,r){var n=1;if(r.length){var i=replaceHolders(r,getHolder(Hr));n|=c}return createWrap(e,n,t,r,i)})),Gr=baseRest((function(e,t,r){var n=3;if(r.length){var i=replaceHolders(r,getHolder(Gr));n|=c}return createWrap(t,n,e,r,i)}));function debounce(e,t,r){var n,o,s,l,c,u,d=0,p=!1,h=!1,y=!0;if("function"!=typeof e)throw new Pe(a);function invokeFunc(t){var r=n,a=o;return n=o=i,d=t,l=e.apply(a,r)}function shouldInvoke(e){var r=e-u;return u===i||r>=t||r<0||h&&e-d>=s}function timerExpired(){var e=Kr();if(shouldInvoke(e))return trailingEdge(e);c=mr(timerExpired,function remainingWait(e){var r=t-(e-u);return h?xt(r,s-(e-d)):r}(e))}function trailingEdge(e){return c=i,y&&n?invokeFunc(e):(n=o=i,l)}function debounced(){var e=Kr(),r=shouldInvoke(e);if(n=arguments,o=this,u=e,r){if(c===i)return function leadingEdge(e){return d=e,c=mr(timerExpired,t),p?invokeFunc(e):l}(u);if(h)return cr(c),c=mr(timerExpired,t),invokeFunc(u)}return c===i&&(c=mr(timerExpired,t)),l}return t=toNumber(t)||0,isObject(r)&&(p=!!r.leading,s=(h="maxWait"in r)?Mt(toNumber(r.maxWait)||0,t):s,y="trailing"in r?!!r.trailing:y),debounced.cancel=function cancel(){c!==i&&cr(c),d=0,n=u=o=c=i},debounced.flush=function flush(){return c===i?l:trailingEdge(Kr())},debounced}var Zr=baseRest((function(e,t){return baseDelay(e,1,t)})),Jr=baseRest((function(e,t,r){return baseDelay(e,toNumber(t)||0,r)}));function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Pe(a);var memoized=function(){var r=arguments,n=t?t.apply(this,r):r[0],i=memoized.cache;if(i.has(n))return i.get(n);var a=e.apply(this,r);return memoized.cache=i.set(n,a)||i,a};return memoized.cache=new(memoize.Cache||MapCache),memoized}function negate(e){if("function"!=typeof e)throw new Pe(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}memoize.Cache=MapCache;var Yr=lr((function(e,t){var r=(t=1==t.length&&an(t[0])?arrayMap(t[0],baseUnary(getIteratee())):arrayMap(baseFlatten(t,1),baseUnary(getIteratee()))).length;return baseRest((function(n){for(var i=-1,a=xt(n.length,r);++i<a;)n[i]=t[i].call(this,n[i]);return apply(e,this,n)}))})),Qr=baseRest((function(e,t){var r=replaceHolders(t,getHolder(Qr));return createWrap(e,c,i,t,r)})),Xr=baseRest((function(e,t){var r=replaceHolders(t,getHolder(Xr));return createWrap(e,u,i,t,r)})),en=flatRest((function(e,t){return createWrap(e,p,i,i,i,t)}));function eq(e,t){return e===t||e!=e&&t!=t}var tn=createRelationalOperation(baseGt),rn=createRelationalOperation((function(e,t){return e>=t})),nn=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&Le.call(e,"callee")&&!Ze.call(e,"callee")},an=r.isArray,on=St?baseUnary(St):function baseIsArrayBuffer(e){return isObjectLike(e)&&baseGetTag(e)==k};function isArrayLike(e){return null!=e&&isLength(e.length)&&!isFunction(e)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}var sn=vt||stubFalse,ln=_t?baseUnary(_t):function baseIsDate(e){return isObjectLike(e)&&baseGetTag(e)==S};function isError(e){if(!isObjectLike(e))return!1;var t=baseGetTag(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!isPlainObject(e)}function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==R||t==O||"[object AsyncFunction]"==t||"[object Proxy]"==t}function isInteger(e){return"number"==typeof e&&e==toInteger(e)}function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=y}function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function isObjectLike(e){return null!=e&&"object"==typeof e}var cn=Rt?baseUnary(Rt):function baseIsMap(e){return isObjectLike(e)&&hr(e)==T};function isNumber(e){return"number"==typeof e||isObjectLike(e)&&baseGetTag(e)==I}function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=E)return!1;var t=He(e);if(null===t)return!0;var r=Le.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ke.call(r)==Be}var un=Ot?baseUnary(Ot):function baseIsRegExp(e){return isObjectLike(e)&&baseGetTag(e)==P};var dn=Tt?baseUnary(Tt):function baseIsSet(e){return isObjectLike(e)&&hr(e)==A};function isString(e){return"string"==typeof e||!an(e)&&isObjectLike(e)&&baseGetTag(e)==j}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&baseGetTag(e)==M}var fn=It?baseUnary(It):function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!ct[baseGetTag(e)]};var pn=createRelationalOperation(baseLt),hn=createRelationalOperation((function(e,t){return e<=t}));function toArray(e){if(!e)return[];if(isArrayLike(e))return isString(e)?stringToArray(e):copyArray(e);if(Qe&&e[Qe])return function iteratorToArray(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Qe]());var t=hr(e);return(t==T?mapToArray:t==A?setToArray:values)(e)}function toFinite(e){return e?(e=toNumber(e))===h||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function toInteger(e){var t=toFinite(e),r=t%1;return t==t?r?t-r:t:0}function toLength(e){return e?baseClamp(toInteger(e),0,m):0}function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return g;if(isObject(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=baseTrim(e);var r=ve.test(e);return r||we.test(e)?pt(e.slice(2),r?2:8):me.test(e)?g:+e}function toPlainObject(e){return copyObject(e,keysIn(e))}function toString(e){return null==e?"":baseToString(e)}var yn=createAssigner((function(e,t){if(isPrototype(t)||isArrayLike(t))copyObject(t,keys(t),e);else for(var r in t)Le.call(t,r)&&assignValue(e,r,t[r])})),gn=createAssigner((function(e,t){copyObject(t,keysIn(t),e)})),mn=createAssigner((function(e,t,r,n){copyObject(t,keysIn(t),e,n)})),vn=createAssigner((function(e,t,r,n){copyObject(t,keys(t),e,n)})),bn=flatRest(baseAt);var wn=baseRest((function(e,t){e=Ie(e);var r=-1,n=t.length,a=n>2?t[2]:i;for(a&&isIterateeCall(t[0],t[1],a)&&(n=1);++r<n;)for(var o=t[r],s=keysIn(o),l=-1,c=s.length;++l<c;){var u=s[l],d=e[u];(d===i||eq(d,Me[u])&&!Le.call(e,u))&&(e[u]=o[u])}return e})),Cn=baseRest((function(e){return e.push(i,customDefaultsMerge),apply(Tn,i,e)}));function get(e,t,r){var n=null==e?i:baseGet(e,t);return n===i?r:n}function hasIn(e,t){return null!=e&&hasPath(e,t,baseHasIn)}var Sn=createInverter((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=ze.call(t)),e[t]=r}),constant(identity)),_n=createInverter((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=ze.call(t)),Le.call(e,t)?e[t].push(r):e[t]=[r]}),getIteratee),Rn=baseRest(baseInvoke);function keys(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}function keysIn(e){return isArrayLike(e)?arrayLikeKeys(e,!0):baseKeysIn(e)}var On=createAssigner((function(e,t,r){baseMerge(e,t,r)})),Tn=createAssigner((function(e,t,r,n){baseMerge(e,t,r,n)})),In=flatRest((function(e,t){var r={};if(null==e)return r;var n=!1;t=arrayMap(t,(function(t){return t=castPath(t,e),n||(n=t.length>1),t})),copyObject(e,getAllKeysIn(e),r),n&&(r=baseClone(r,7,customOmitClone));for(var i=t.length;i--;)baseUnset(r,t[i]);return r}));var En=flatRest((function(e,t){return null==e?{}:function basePick(e,t){return basePickBy(e,t,(function(t,r){return hasIn(e,r)}))}(e,t)}));function pickBy(e,t){if(null==e)return{};var r=arrayMap(getAllKeysIn(e),(function(e){return[e]}));return t=getIteratee(t),basePickBy(e,r,(function(e,r){return t(e,r[0])}))}var Dn=createToPairs(keys),Pn=createToPairs(keysIn);function values(e){return null==e?[]:baseValues(e,keys(e))}var An=createCompounder((function(e,t,r){return t=t.toLowerCase(),e+(r?capitalize(t):t)}));function capitalize(e){return Nn(toString(e).toLowerCase())}function deburr(e){return(e=toString(e))&&e.replace(Se,Dt).replace(rt,"")}var jn=createCompounder((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Mn=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),xn=createCaseFirst("toLowerCase");var kn=createCompounder((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}));var Ln=createCompounder((function(e,t,r){return e+(r?" ":"")+Nn(t)}));var Fn=createCompounder((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Nn=createCaseFirst("toUpperCase");function words(e,t,r){return e=toString(e),(t=r?i:t)===i?function hasUnicodeWord(e){return ot.test(e)}(e)?function unicodeWords(e){return e.match(it)||[]}(e):function asciiWords(e){return e.match(fe)||[]}(e):e.match(t)||[]}var zn=baseRest((function(e,t){try{return apply(e,i,t)}catch(e){return isError(e)?e:new le(e)}})),Bn=flatRest((function(e,t){return arrayEach(t,(function(t){t=toKey(t),baseAssignValue(e,t,Hr(e[t],e))})),e}));function constant(e){return function(){return e}}var Un=createFlow(),Wn=createFlow(!0);function identity(e){return e}function iteratee(e){return baseIteratee("function"==typeof e?e:baseClone(e,1))}var Vn=baseRest((function(e,t){return function(r){return baseInvoke(r,e,t)}})),qn=baseRest((function(e,t){return function(r){return baseInvoke(e,r,t)}}));function mixin(e,t,r){var n=keys(t),i=baseFunctions(t,n);null!=r||isObject(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=baseFunctions(t,keys(t)));var a=!(isObject(r)&&"chain"in r&&!r.chain),o=isFunction(e);return arrayEach(i,(function(r){var n=t[r];e[r]=n,o&&(e.prototype[r]=function(){var t=this.__chain__;if(a||t){var r=e(this.__wrapped__);return(r.__actions__=copyArray(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,arrayPush([this.value()],arguments))})})),e}function noop(){}var $n=createOver(arrayMap),Kn=createOver(arrayEvery),Hn=createOver(arraySome);function property(e){return isKey(e)?baseProperty(toKey(e)):function basePropertyDeep(e){return function(t){return baseGet(t,e)}}(e)}var Gn=createRange(),Zn=createRange(!0);function stubArray(){return[]}function stubFalse(){return!1}var Jn=createMathOperation((function(e,t){return e+t}),0),Yn=createRound("ceil"),Qn=createMathOperation((function(e,t){return e/t}),1),Xn=createRound("floor");var ei,ti=createMathOperation((function(e,t){return e*t}),1),ri=createRound("round"),ni=createMathOperation((function(e,t){return e-t}),0);return lodash.after=function after(e,t){if("function"!=typeof t)throw new Pe(a);return e=toInteger(e),function(){if(--e<1)return t.apply(this,arguments)}},lodash.ary=ary,lodash.assign=yn,lodash.assignIn=gn,lodash.assignInWith=mn,lodash.assignWith=vn,lodash.at=bn,lodash.before=before,lodash.bind=Hr,lodash.bindAll=Bn,lodash.bindKey=Gr,lodash.castArray=function castArray(){if(!arguments.length)return[];var e=arguments[0];return an(e)?e:[e]},lodash.chain=chain,lodash.chunk=function chunk(e,t,n){t=(n?isIterateeCall(e,t,n):t===i)?1:Mt(toInteger(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var o=0,s=0,l=r(ht(a/t));o<a;)l[s++]=baseSlice(e,o,o+=t);return l},lodash.compact=function compact(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var a=e[t];a&&(i[n++]=a)}return i},lodash.concat=function concat(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return arrayPush(an(n)?copyArray(n):[n],baseFlatten(t,1))},lodash.cond=function cond(e){var t=null==e?0:e.length,r=getIteratee();return e=t?arrayMap(e,(function(e){if("function"!=typeof e[1])throw new Pe(a);return[r(e[0]),e[1]]})):[],baseRest((function(r){for(var n=-1;++n<t;){var i=e[n];if(apply(i[0],this,r))return apply(i[1],this,r)}}))},lodash.conforms=function conforms(e){return function baseConforms(e){var t=keys(e);return function(r){return baseConformsTo(r,e,t)}}(baseClone(e,1))},lodash.constant=constant,lodash.countBy=Nr,lodash.create=function create(e,t){var r=tr(e);return null==t?r:baseAssign(r,t)},lodash.curry=function curry(e,t,r){var n=createWrap(e,8,i,i,i,i,i,t=r?i:t);return n.placeholder=curry.placeholder,n},lodash.curryRight=function curryRight(e,t,r){var n=createWrap(e,l,i,i,i,i,i,t=r?i:t);return n.placeholder=curryRight.placeholder,n},lodash.debounce=debounce,lodash.defaults=wn,lodash.defaultsDeep=Cn,lodash.defer=Zr,lodash.delay=Jr,lodash.difference=wr,lodash.differenceBy=Cr,lodash.differenceWith=Sr,lodash.drop=function drop(e,t,r){var n=null==e?0:e.length;return n?baseSlice(e,(t=r||t===i?1:toInteger(t))<0?0:t,n):[]},lodash.dropRight=function dropRight(e,t,r){var n=null==e?0:e.length;return n?baseSlice(e,0,(t=n-(t=r||t===i?1:toInteger(t)))<0?0:t):[]},lodash.dropRightWhile=function dropRightWhile(e,t){return e&&e.length?baseWhile(e,getIteratee(t,3),!0,!0):[]},lodash.dropWhile=function dropWhile(e,t){return e&&e.length?baseWhile(e,getIteratee(t,3),!0):[]},lodash.fill=function fill(e,t,r,n){var a=null==e?0:e.length;return a?(r&&"number"!=typeof r&&isIterateeCall(e,t,r)&&(r=0,n=a),function baseFill(e,t,r,n){var a=e.length;for((r=toInteger(r))<0&&(r=-r>a?0:a+r),(n=n===i||n>a?a:toInteger(n))<0&&(n+=a),n=r>n?0:toLength(n);r<n;)e[r++]=t;return e}(e,t,r,n)):[]},lodash.filter=function filter(e,t){return(an(e)?arrayFilter:baseFilter)(e,getIteratee(t,3))},lodash.flatMap=function flatMap(e,t){return baseFlatten(map(e,t),1)},lodash.flatMapDeep=function flatMapDeep(e,t){return baseFlatten(map(e,t),h)},lodash.flatMapDepth=function flatMapDepth(e,t,r){return r=r===i?1:toInteger(r),baseFlatten(map(e,t),r)},lodash.flatten=flatten,lodash.flattenDeep=function flattenDeep(e){return(null==e?0:e.length)?baseFlatten(e,h):[]},lodash.flattenDepth=function flattenDepth(e,t){return(null==e?0:e.length)?baseFlatten(e,t=t===i?1:toInteger(t)):[]},lodash.flip=function flip(e){return createWrap(e,512)},lodash.flow=Un,lodash.flowRight=Wn,lodash.fromPairs=function fromPairs(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},lodash.functions=function functions(e){return null==e?[]:baseFunctions(e,keys(e))},lodash.functionsIn=function functionsIn(e){return null==e?[]:baseFunctions(e,keysIn(e))},lodash.groupBy=Ur,lodash.initial=function initial(e){return(null==e?0:e.length)?baseSlice(e,0,-1):[]},lodash.intersection=_r,lodash.intersectionBy=Rr,lodash.intersectionWith=Or,lodash.invert=Sn,lodash.invertBy=_n,lodash.invokeMap=Wr,lodash.iteratee=iteratee,lodash.keyBy=Vr,lodash.keys=keys,lodash.keysIn=keysIn,lodash.map=map,lodash.mapKeys=function mapKeys(e,t){var r={};return t=getIteratee(t,3),baseForOwn(e,(function(e,n,i){baseAssignValue(r,t(e,n,i),e)})),r},lodash.mapValues=function mapValues(e,t){var r={};return t=getIteratee(t,3),baseForOwn(e,(function(e,n,i){baseAssignValue(r,n,t(e,n,i))})),r},lodash.matches=function matches(e){return baseMatches(baseClone(e,1))},lodash.matchesProperty=function matchesProperty(e,t){return baseMatchesProperty(e,baseClone(t,1))},lodash.memoize=memoize,lodash.merge=On,lodash.mergeWith=Tn,lodash.method=Vn,lodash.methodOf=qn,lodash.mixin=mixin,lodash.negate=negate,lodash.nthArg=function nthArg(e){return e=toInteger(e),baseRest((function(t){return baseNth(t,e)}))},lodash.omit=In,lodash.omitBy=function omitBy(e,t){return pickBy(e,negate(getIteratee(t)))},lodash.once=function once(e){return before(2,e)},lodash.orderBy=function orderBy(e,t,r,n){return null==e?[]:(an(t)||(t=null==t?[]:[t]),an(r=n?i:r)||(r=null==r?[]:[r]),baseOrderBy(e,t,r))},lodash.over=$n,lodash.overArgs=Yr,lodash.overEvery=Kn,lodash.overSome=Hn,lodash.partial=Qr,lodash.partialRight=Xr,lodash.partition=qr,lodash.pick=En,lodash.pickBy=pickBy,lodash.property=property,lodash.propertyOf=function propertyOf(e){return function(t){return null==e?i:baseGet(e,t)}},lodash.pull=Tr,lodash.pullAll=pullAll,lodash.pullAllBy=function pullAllBy(e,t,r){return e&&e.length&&t&&t.length?basePullAll(e,t,getIteratee(r,2)):e},lodash.pullAllWith=function pullAllWith(e,t,r){return e&&e.length&&t&&t.length?basePullAll(e,t,i,r):e},lodash.pullAt=Ir,lodash.range=Gn,lodash.rangeRight=Zn,lodash.rearg=en,lodash.reject=function reject(e,t){return(an(e)?arrayFilter:baseFilter)(e,negate(getIteratee(t,3)))},lodash.remove=function remove(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],a=e.length;for(t=getIteratee(t,3);++n<a;){var o=e[n];t(o,n,e)&&(r.push(o),i.push(n))}return basePullAt(e,i),r},lodash.rest=function rest(e,t){if("function"!=typeof e)throw new Pe(a);return baseRest(e,t=t===i?t:toInteger(t))},lodash.reverse=reverse,lodash.sampleSize=function sampleSize(e,t,r){return t=(r?isIterateeCall(e,t,r):t===i)?1:toInteger(t),(an(e)?arraySampleSize:baseSampleSize)(e,t)},lodash.set=function set(e,t,r){return null==e?e:baseSet(e,t,r)},lodash.setWith=function setWith(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:baseSet(e,t,r,n)},lodash.shuffle=function shuffle(e){return(an(e)?arrayShuffle:baseShuffle)(e)},lodash.slice=function slice(e,t,r){var n=null==e?0:e.length;return n?(r&&"number"!=typeof r&&isIterateeCall(e,t,r)?(t=0,r=n):(t=null==t?0:toInteger(t),r=r===i?n:toInteger(r)),baseSlice(e,t,r)):[]},lodash.sortBy=$r,lodash.sortedUniq=function sortedUniq(e){return e&&e.length?baseSortedUniq(e):[]},lodash.sortedUniqBy=function sortedUniqBy(e,t){return e&&e.length?baseSortedUniq(e,getIteratee(t,2)):[]},lodash.split=function split(e,t,r){return r&&"number"!=typeof r&&isIterateeCall(e,t,r)&&(t=r=i),(r=r===i?m:r>>>0)?(e=toString(e))&&("string"==typeof t||null!=t&&!un(t))&&!(t=baseToString(t))&&hasUnicode(e)?castSlice(stringToArray(e),0,r):e.split(t,r):[]},lodash.spread=function spread(e,t){if("function"!=typeof e)throw new Pe(a);return t=null==t?0:Mt(toInteger(t),0),baseRest((function(r){var n=r[t],i=castSlice(r,0,t);return n&&arrayPush(i,n),apply(e,this,i)}))},lodash.tail=function tail(e){var t=null==e?0:e.length;return t?baseSlice(e,1,t):[]},lodash.take=function take(e,t,r){return e&&e.length?baseSlice(e,0,(t=r||t===i?1:toInteger(t))<0?0:t):[]},lodash.takeRight=function takeRight(e,t,r){var n=null==e?0:e.length;return n?baseSlice(e,(t=n-(t=r||t===i?1:toInteger(t)))<0?0:t,n):[]},lodash.takeRightWhile=function takeRightWhile(e,t){return e&&e.length?baseWhile(e,getIteratee(t,3),!1,!0):[]},lodash.takeWhile=function takeWhile(e,t){return e&&e.length?baseWhile(e,getIteratee(t,3)):[]},lodash.tap=function tap(e,t){return t(e),e},lodash.throttle=function throttle(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new Pe(a);return isObject(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),debounce(e,t,{leading:n,maxWait:t,trailing:i})},lodash.thru=thru,lodash.toArray=toArray,lodash.toPairs=Dn,lodash.toPairsIn=Pn,lodash.toPath=function toPath(e){return an(e)?arrayMap(e,toKey):isSymbol(e)?[e]:copyArray(br(toString(e)))},lodash.toPlainObject=toPlainObject,lodash.transform=function transform(e,t,r){var n=an(e),i=n||sn(e)||fn(e);if(t=getIteratee(t,4),null==r){var a=e&&e.constructor;r=i?n?new a:[]:isObject(e)&&isFunction(a)?tr(He(e)):{}}return(i?arrayEach:baseForOwn)(e,(function(e,n,i){return t(r,e,n,i)})),r},lodash.unary=function unary(e){return ary(e,1)},lodash.union=Er,lodash.unionBy=Dr,lodash.unionWith=Pr,lodash.uniq=function uniq(e){return e&&e.length?baseUniq(e):[]},lodash.uniqBy=function uniqBy(e,t){return e&&e.length?baseUniq(e,getIteratee(t,2)):[]},lodash.uniqWith=function uniqWith(e,t){return t="function"==typeof t?t:i,e&&e.length?baseUniq(e,i,t):[]},lodash.unset=function unset(e,t){return null==e||baseUnset(e,t)},lodash.unzip=unzip,lodash.unzipWith=unzipWith,lodash.update=function update(e,t,r){return null==e?e:baseUpdate(e,t,castFunction(r))},lodash.updateWith=function updateWith(e,t,r,n){return n="function"==typeof n?n:i,null==e?e:baseUpdate(e,t,castFunction(r),n)},lodash.values=values,lodash.valuesIn=function valuesIn(e){return null==e?[]:baseValues(e,keysIn(e))},lodash.without=Ar,lodash.words=words,lodash.wrap=function wrap(e,t){return Qr(castFunction(t),e)},lodash.xor=jr,lodash.xorBy=Mr,lodash.xorWith=xr,lodash.zip=kr,lodash.zipObject=function zipObject(e,t){return baseZipObject(e||[],t||[],assignValue)},lodash.zipObjectDeep=function zipObjectDeep(e,t){return baseZipObject(e||[],t||[],baseSet)},lodash.zipWith=Lr,lodash.entries=Dn,lodash.entriesIn=Pn,lodash.extend=gn,lodash.extendWith=mn,mixin(lodash,lodash),lodash.add=Jn,lodash.attempt=zn,lodash.camelCase=An,lodash.capitalize=capitalize,lodash.ceil=Yn,lodash.clamp=function clamp(e,t,r){return r===i&&(r=t,t=i),r!==i&&(r=(r=toNumber(r))==r?r:0),t!==i&&(t=(t=toNumber(t))==t?t:0),baseClamp(toNumber(e),t,r)},lodash.clone=function clone(e){return baseClone(e,4)},lodash.cloneDeep=function cloneDeep(e){return baseClone(e,5)},lodash.cloneDeepWith=function cloneDeepWith(e,t){return baseClone(e,5,t="function"==typeof t?t:i)},lodash.cloneWith=function cloneWith(e,t){return baseClone(e,4,t="function"==typeof t?t:i)},lodash.conformsTo=function conformsTo(e,t){return null==t||baseConformsTo(e,t,keys(t))},lodash.deburr=deburr,lodash.defaultTo=function defaultTo(e,t){return null==e||e!=e?t:e},lodash.divide=Qn,lodash.endsWith=function endsWith(e,t,r){e=toString(e),t=baseToString(t);var n=e.length,a=r=r===i?n:baseClamp(toInteger(r),0,n);return(r-=t.length)>=0&&e.slice(r,a)==t},lodash.eq=eq,lodash.escape=function escape(e){return(e=toString(e))&&Q.test(e)?e.replace(J,Pt):e},lodash.escapeRegExp=function escapeRegExp(e){return(e=toString(e))&&oe.test(e)?e.replace(ae,"\\$&"):e},lodash.every=function every(e,t,r){var n=an(e)?arrayEvery:baseEvery;return r&&isIterateeCall(e,t,r)&&(t=i),n(e,getIteratee(t,3))},lodash.find=zr,lodash.findIndex=findIndex,lodash.findKey=function findKey(e,t){return baseFindKey(e,getIteratee(t,3),baseForOwn)},lodash.findLast=Br,lodash.findLastIndex=findLastIndex,lodash.findLastKey=function findLastKey(e,t){return baseFindKey(e,getIteratee(t,3),baseForOwnRight)},lodash.floor=Xn,lodash.forEach=forEach,lodash.forEachRight=forEachRight,lodash.forIn=function forIn(e,t){return null==e?e:ir(e,getIteratee(t,3),keysIn)},lodash.forInRight=function forInRight(e,t){return null==e?e:ar(e,getIteratee(t,3),keysIn)},lodash.forOwn=function forOwn(e,t){return e&&baseForOwn(e,getIteratee(t,3))},lodash.forOwnRight=function forOwnRight(e,t){return e&&baseForOwnRight(e,getIteratee(t,3))},lodash.get=get,lodash.gt=tn,lodash.gte=rn,lodash.has=function has(e,t){return null!=e&&hasPath(e,t,baseHas)},lodash.hasIn=hasIn,lodash.head=head,lodash.identity=identity,lodash.includes=function includes(e,t,r,n){e=isArrayLike(e)?e:values(e),r=r&&!n?toInteger(r):0;var i=e.length;return r<0&&(r=Mt(i+r,0)),isString(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&baseIndexOf(e,t,r)>-1},lodash.indexOf=function indexOf(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:toInteger(r);return i<0&&(i=Mt(n+i,0)),baseIndexOf(e,t,i)},lodash.inRange=function inRange(e,t,r){return t=toFinite(t),r===i?(r=t,t=0):r=toFinite(r),function baseInRange(e,t,r){return e>=xt(t,r)&&e<Mt(t,r)}(e=toNumber(e),t,r)},lodash.invoke=Rn,lodash.isArguments=nn,lodash.isArray=an,lodash.isArrayBuffer=on,lodash.isArrayLike=isArrayLike,lodash.isArrayLikeObject=isArrayLikeObject,lodash.isBoolean=function isBoolean(e){return!0===e||!1===e||isObjectLike(e)&&baseGetTag(e)==C},lodash.isBuffer=sn,lodash.isDate=ln,lodash.isElement=function isElement(e){return isObjectLike(e)&&1===e.nodeType&&!isPlainObject(e)},lodash.isEmpty=function isEmpty(e){if(null==e)return!0;if(isArrayLike(e)&&(an(e)||"string"==typeof e||"function"==typeof e.splice||sn(e)||fn(e)||nn(e)))return!e.length;var t=hr(e);if(t==T||t==A)return!e.size;if(isPrototype(e))return!baseKeys(e).length;for(var r in e)if(Le.call(e,r))return!1;return!0},lodash.isEqual=function isEqual(e,t){return baseIsEqual(e,t)},lodash.isEqualWith=function isEqualWith(e,t,r){var n=(r="function"==typeof r?r:i)?r(e,t):i;return n===i?baseIsEqual(e,t,i,r):!!n},lodash.isError=isError,lodash.isFinite=function isFinite(e){return"number"==typeof e&&wt(e)},lodash.isFunction=isFunction,lodash.isInteger=isInteger,lodash.isLength=isLength,lodash.isMap=cn,lodash.isMatch=function isMatch(e,t){return e===t||baseIsMatch(e,t,getMatchData(t))},lodash.isMatchWith=function isMatchWith(e,t,r){return r="function"==typeof r?r:i,baseIsMatch(e,t,getMatchData(t),r)},lodash.isNaN=function isNaN(e){return isNumber(e)&&e!=+e},lodash.isNative=function isNative(e){if(yr(e))throw new le("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return baseIsNative(e)},lodash.isNil=function isNil(e){return null==e},lodash.isNull=function isNull(e){return null===e},lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isObjectLike=isObjectLike,lodash.isPlainObject=isPlainObject,lodash.isRegExp=un,lodash.isSafeInteger=function isSafeInteger(e){return isInteger(e)&&e>=-9007199254740991&&e<=y},lodash.isSet=dn,lodash.isString=isString,lodash.isSymbol=isSymbol,lodash.isTypedArray=fn,lodash.isUndefined=function isUndefined(e){return e===i},lodash.isWeakMap=function isWeakMap(e){return isObjectLike(e)&&hr(e)==x},lodash.isWeakSet=function isWeakSet(e){return isObjectLike(e)&&"[object WeakSet]"==baseGetTag(e)},lodash.join=function join(e,t){return null==e?"":Ct.call(e,t)},lodash.kebabCase=jn,lodash.last=last,lodash.lastIndexOf=function lastIndexOf(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=n;return r!==i&&(a=(a=toInteger(r))<0?Mt(n+a,0):xt(a,n-1)),t==t?function strictLastIndexOf(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,a):baseFindIndex(e,baseIsNaN,a,!0)},lodash.lowerCase=Mn,lodash.lowerFirst=xn,lodash.lt=pn,lodash.lte=hn,lodash.max=function max(e){return e&&e.length?baseExtremum(e,identity,baseGt):i},lodash.maxBy=function maxBy(e,t){return e&&e.length?baseExtremum(e,getIteratee(t,2),baseGt):i},lodash.mean=function mean(e){return baseMean(e,identity)},lodash.meanBy=function meanBy(e,t){return baseMean(e,getIteratee(t,2))},lodash.min=function min(e){return e&&e.length?baseExtremum(e,identity,baseLt):i},lodash.minBy=function minBy(e,t){return e&&e.length?baseExtremum(e,getIteratee(t,2),baseLt):i},lodash.stubArray=stubArray,lodash.stubFalse=stubFalse,lodash.stubObject=function stubObject(){return{}},lodash.stubString=function stubString(){return""},lodash.stubTrue=function stubTrue(){return!0},lodash.multiply=ti,lodash.nth=function nth(e,t){return e&&e.length?baseNth(e,toInteger(t)):i},lodash.noConflict=function noConflict(){return gt._===this&&(gt._=Ue),this},lodash.noop=noop,lodash.now=Kr,lodash.pad=function pad(e,t,r){e=toString(e);var n=(t=toInteger(t))?stringSize(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return createPadding(yt(i),r)+e+createPadding(ht(i),r)},lodash.padEnd=function padEnd(e,t,r){e=toString(e);var n=(t=toInteger(t))?stringSize(e):0;return t&&n<t?e+createPadding(t-n,r):e},lodash.padStart=function padStart(e,t,r){e=toString(e);var n=(t=toInteger(t))?stringSize(e):0;return t&&n<t?createPadding(t-n,r)+e:e},lodash.parseInt=function parseInt(e,t,r){return r||null==t?t=0:t&&(t=+t),Lt(toString(e).replace(se,""),t||0)},lodash.random=function random(e,t,r){if(r&&"boolean"!=typeof r&&isIterateeCall(e,t,r)&&(t=r=i),r===i&&("boolean"==typeof t?(r=t,t=i):"boolean"==typeof e&&(r=e,e=i)),e===i&&t===i?(e=0,t=1):(e=toFinite(e),t===i?(t=e,e=0):t=toFinite(t)),e>t){var n=e;e=t,t=n}if(r||e%1||t%1){var a=Ft();return xt(e+a*(t-e+ft("1e-"+((a+"").length-1))),t)}return baseRandom(e,t)},lodash.reduce=function reduce(e,t,r){var n=an(e)?arrayReduce:baseReduce,i=arguments.length<3;return n(e,getIteratee(t,4),r,i,rr)},lodash.reduceRight=function reduceRight(e,t,r){var n=an(e)?arrayReduceRight:baseReduce,i=arguments.length<3;return n(e,getIteratee(t,4),r,i,nr)},lodash.repeat=function repeat(e,t,r){return t=(r?isIterateeCall(e,t,r):t===i)?1:toInteger(t),baseRepeat(toString(e),t)},lodash.replace=function replace(){var e=arguments,t=toString(e[0]);return e.length<3?t:t.replace(e[1],e[2])},lodash.result=function result(e,t,r){var n=-1,a=(t=castPath(t,e)).length;for(a||(a=1,e=i);++n<a;){var o=null==e?i:e[toKey(t[n])];o===i&&(n=a,o=r),e=isFunction(o)?o.call(e):o}return e},lodash.round=ri,lodash.runInContext=runInContext,lodash.sample=function sample(e){return(an(e)?arraySample:baseSample)(e)},lodash.size=function size(e){if(null==e)return 0;if(isArrayLike(e))return isString(e)?stringSize(e):e.length;var t=hr(e);return t==T||t==A?e.size:baseKeys(e).length},lodash.snakeCase=kn,lodash.some=function some(e,t,r){var n=an(e)?arraySome:baseSome;return r&&isIterateeCall(e,t,r)&&(t=i),n(e,getIteratee(t,3))},lodash.sortedIndex=function sortedIndex(e,t){return baseSortedIndex(e,t)},lodash.sortedIndexBy=function sortedIndexBy(e,t,r){return baseSortedIndexBy(e,t,getIteratee(r,2))},lodash.sortedIndexOf=function sortedIndexOf(e,t){var r=null==e?0:e.length;if(r){var n=baseSortedIndex(e,t);if(n<r&&eq(e[n],t))return n}return-1},lodash.sortedLastIndex=function sortedLastIndex(e,t){return baseSortedIndex(e,t,!0)},lodash.sortedLastIndexBy=function sortedLastIndexBy(e,t,r){return baseSortedIndexBy(e,t,getIteratee(r,2),!0)},lodash.sortedLastIndexOf=function sortedLastIndexOf(e,t){if(null==e?0:e.length){var r=baseSortedIndex(e,t,!0)-1;if(eq(e[r],t))return r}return-1},lodash.startCase=Ln,lodash.startsWith=function startsWith(e,t,r){return e=toString(e),r=null==r?0:baseClamp(toInteger(r),0,e.length),t=baseToString(t),e.slice(r,r+t.length)==t},lodash.subtract=ni,lodash.sum=function sum(e){return e&&e.length?baseSum(e,identity):0},lodash.sumBy=function sumBy(e,t){return e&&e.length?baseSum(e,getIteratee(t,2)):0},lodash.template=function template(e,t,r){var n=lodash.templateSettings;r&&isIterateeCall(e,t,r)&&(t=i),e=toString(e),t=mn({},t,n,customDefaultsAssignIn);var a,o,s=mn({},t.imports,n.imports,customDefaultsAssignIn),l=keys(s),c=baseValues(s,l),u=0,d=t.interpolate||_e,p="__p += '",h=Ee((t.escape||_e).source+"|"+d.source+"|"+(d===te?ye:_e).source+"|"+(t.evaluate||_e).source+"|$","g"),y="//# sourceURL="+(Le.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++lt+"]")+"\n";e.replace(h,(function(t,r,n,i,s,l){return n||(n=i),p+=e.slice(u,l).replace(Re,escapeStringChar),r&&(a=!0,p+="' +\n__e("+r+") +\n'"),s&&(o=!0,p+="';\n"+s+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=l+t.length,t})),p+="';\n";var g=Le.call(t,"variable")&&t.variable;if(g){if(pe.test(g))throw new le("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(o?p.replace(K,""):p).replace(H,"$1").replace(G,"$1;"),p="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=zn((function(){return Oe(l,y+"return "+p).apply(i,c)}));if(m.source=p,isError(m))throw m;return m},lodash.times=function times(e,t){if((e=toInteger(e))<1||e>y)return[];var r=m,n=xt(e,m);t=getIteratee(t),e-=m;for(var i=baseTimes(n,t);++r<e;)t(r);return i},lodash.toFinite=toFinite,lodash.toInteger=toInteger,lodash.toLength=toLength,lodash.toLower=function toLower(e){return toString(e).toLowerCase()},lodash.toNumber=toNumber,lodash.toSafeInteger=function toSafeInteger(e){return e?baseClamp(toInteger(e),-9007199254740991,y):0===e?e:0},lodash.toString=toString,lodash.toUpper=function toUpper(e){return toString(e).toUpperCase()},lodash.trim=function trim(e,t,r){if((e=toString(e))&&(r||t===i))return baseTrim(e);if(!e||!(t=baseToString(t)))return e;var n=stringToArray(e),a=stringToArray(t);return castSlice(n,charsStartIndex(n,a),charsEndIndex(n,a)+1).join("")},lodash.trimEnd=function trimEnd(e,t,r){if((e=toString(e))&&(r||t===i))return e.slice(0,trimmedEndIndex(e)+1);if(!e||!(t=baseToString(t)))return e;var n=stringToArray(e);return castSlice(n,0,charsEndIndex(n,stringToArray(t))+1).join("")},lodash.trimStart=function trimStart(e,t,r){if((e=toString(e))&&(r||t===i))return e.replace(se,"");if(!e||!(t=baseToString(t)))return e;var n=stringToArray(e);return castSlice(n,charsStartIndex(n,stringToArray(t))).join("")},lodash.truncate=function truncate(e,t){var r=30,n="...";if(isObject(t)){var a="separator"in t?t.separator:a;r="length"in t?toInteger(t.length):r,n="omission"in t?baseToString(t.omission):n}var o=(e=toString(e)).length;if(hasUnicode(e)){var s=stringToArray(e);o=s.length}if(r>=o)return e;var l=r-stringSize(n);if(l<1)return n;var c=s?castSlice(s,0,l).join(""):e.slice(0,l);if(a===i)return c+n;if(s&&(l+=c.length-l),un(a)){if(e.slice(l).search(a)){var u,d=c;for(a.global||(a=Ee(a.source,toString(ge.exec(a))+"g")),a.lastIndex=0;u=a.exec(d);)var p=u.index;c=c.slice(0,p===i?l:p)}}else if(e.indexOf(baseToString(a),l)!=l){var h=c.lastIndexOf(a);h>-1&&(c=c.slice(0,h))}return c+n},lodash.unescape=function unescape(e){return(e=toString(e))&&Y.test(e)?e.replace(Z,At):e},lodash.uniqueId=function uniqueId(e){var t=++Fe;return toString(e)+t},lodash.upperCase=Fn,lodash.upperFirst=Nn,lodash.each=forEach,lodash.eachRight=forEachRight,lodash.first=head,mixin(lodash,(ei={},baseForOwn(lodash,(function(e,t){Le.call(lodash.prototype,t)||(ei[t]=e)})),ei),{chain:!1}),lodash.VERSION="4.17.21",arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){lodash[e].placeholder=lodash})),arrayEach(["drop","take"],(function(e,t){LazyWrapper.prototype[e]=function(r){r=r===i?1:Mt(toInteger(r),0);var n=this.__filtered__&&!t?new LazyWrapper(this):this.clone();return n.__filtered__?n.__takeCount__=xt(r,n.__takeCount__):n.__views__.push({size:xt(r,m),type:e+(n.__dir__<0?"Right":"")}),n},LazyWrapper.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),arrayEach(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;LazyWrapper.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:getIteratee(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),arrayEach(["head","last"],(function(e,t){var r="take"+(t?"Right":"");LazyWrapper.prototype[e]=function(){return this[r](1).value()[0]}})),arrayEach(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");LazyWrapper.prototype[e]=function(){return this.__filtered__?new LazyWrapper(this):this[r](1)}})),LazyWrapper.prototype.compact=function(){return this.filter(identity)},LazyWrapper.prototype.find=function(e){return this.filter(e).head()},LazyWrapper.prototype.findLast=function(e){return this.reverse().find(e)},LazyWrapper.prototype.invokeMap=baseRest((function(e,t){return"function"==typeof e?new LazyWrapper(this):this.map((function(r){return baseInvoke(r,e,t)}))})),LazyWrapper.prototype.reject=function(e){return this.filter(negate(getIteratee(e)))},LazyWrapper.prototype.slice=function(e,t){e=toInteger(e);var r=this;return r.__filtered__&&(e>0||t<0)?new LazyWrapper(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==i&&(r=(t=toInteger(t))<0?r.dropRight(-t):r.take(t-e)),r)},LazyWrapper.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},LazyWrapper.prototype.toArray=function(){return this.take(m)},baseForOwn(LazyWrapper.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),a=lodash[n?"take"+("last"==t?"Right":""):t],o=n||/^find/.test(t);a&&(lodash.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,l=t instanceof LazyWrapper,c=s[0],u=l||an(t),interceptor=function(e){var t=a.apply(lodash,arrayPush([e],s));return n&&d?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var d=this.__chain__,p=!!this.__actions__.length,h=o&&!d,y=l&&!p;if(!o&&u){t=y?t:new LazyWrapper(this);var g=e.apply(t,s);return g.__actions__.push({func:thru,args:[interceptor],thisArg:i}),new LodashWrapper(g,d)}return h&&y?e.apply(this,s):(g=this.thru(interceptor),h?n?g.value()[0]:g.value():g)})})),arrayEach(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ae[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);lodash.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(an(i)?i:[],e)}return this[r]((function(r){return t.apply(an(r)?r:[],e)}))}})),baseForOwn(LazyWrapper.prototype,(function(e,t){var r=lodash[t];if(r){var n=r.name+"";Le.call(Kt,n)||(Kt[n]=[]),Kt[n].push({name:t,func:r})}})),Kt[createHybrid(i,2).name]=[{name:"wrapper",func:i}],LazyWrapper.prototype.clone=function lazyClone(){var e=new LazyWrapper(this.__wrapped__);return e.__actions__=copyArray(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=copyArray(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=copyArray(this.__views__),e},LazyWrapper.prototype.reverse=function lazyReverse(){if(this.__filtered__){var e=new LazyWrapper(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},LazyWrapper.prototype.value=function lazyValue(){var e=this.__wrapped__.value(),t=this.__dir__,r=an(e),n=t<0,i=r?e.length:0,a=function getView(e,t,r){var n=-1,i=r.length;for(;++n<i;){var a=r[n],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=xt(t,e+o);break;case"takeRight":e=Mt(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,l=s-o,c=n?s:o-1,u=this.__iteratees__,d=u.length,p=0,h=xt(l,this.__takeCount__);if(!r||!n&&i==l&&h==l)return baseWrapperValue(e,this.__actions__);var y=[];e:for(;l--&&p<h;){for(var g=-1,m=e[c+=t];++g<d;){var v=u[g],b=v.iteratee,w=v.type,C=b(m);if(2==w)m=C;else if(!C){if(1==w)continue e;break e}}y[p++]=m}return y},lodash.prototype.at=Fr,lodash.prototype.chain=function wrapperChain(){return chain(this)},lodash.prototype.commit=function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)},lodash.prototype.next=function wrapperNext(){this.__values__===i&&(this.__values__=toArray(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},lodash.prototype.plant=function wrapperPlant(e){for(var t,r=this;r instanceof baseLodash;){var n=wrapperClone(r);n.__index__=0,n.__values__=i,t?a.__wrapped__=n:t=n;var a=n;r=r.__wrapped__}return a.__wrapped__=e,t},lodash.prototype.reverse=function wrapperReverse(){var e=this.__wrapped__;if(e instanceof LazyWrapper){var t=e;return this.__actions__.length&&(t=new LazyWrapper(this)),(t=t.reverse()).__actions__.push({func:thru,args:[reverse],thisArg:i}),new LodashWrapper(t,this.__chain__)}return this.thru(reverse)},lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)},lodash.prototype.first=lodash.prototype.head,Qe&&(lodash.prototype[Qe]=function wrapperToIterator(){return this}),lodash}();gt._=jt,(n=function(){return jt}.call(t,r,t,e))===i||(e.exports=n)}.call(this)},8565:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class LuxonError extends Error{}class InvalidDateTimeError extends LuxonError{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class InvalidIntervalError extends LuxonError{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class InvalidDurationError extends LuxonError{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class ConflictingSpecificationError extends LuxonError{}class InvalidUnitError extends LuxonError{constructor(e){super(`Invalid unit ${e}`)}}class InvalidArgumentError extends LuxonError{}class ZoneIsAbstractError extends LuxonError{constructor(){super("Zone is an abstract class")}}const r="numeric",n="short",i="long",a={year:r,month:r,day:r},o={year:r,month:n,day:r},s={year:r,month:n,day:r,weekday:n},l={year:r,month:i,day:r},c={year:r,month:i,day:r,weekday:i},u={hour:r,minute:r},d={hour:r,minute:r,second:r},p={hour:r,minute:r,second:r,timeZoneName:n},h={hour:r,minute:r,second:r,timeZoneName:i},y={hour:r,minute:r,hourCycle:"h23"},g={hour:r,minute:r,second:r,hourCycle:"h23"},m={hour:r,minute:r,second:r,hourCycle:"h23",timeZoneName:n},v={hour:r,minute:r,second:r,hourCycle:"h23",timeZoneName:i},b={year:r,month:r,day:r,hour:r,minute:r},w={year:r,month:r,day:r,hour:r,minute:r,second:r},C={year:r,month:n,day:r,hour:r,minute:r},S={year:r,month:n,day:r,hour:r,minute:r,second:r},_={year:r,month:n,day:r,weekday:n,hour:r,minute:r},R={year:r,month:i,day:r,hour:r,minute:r,timeZoneName:n},O={year:r,month:i,day:r,hour:r,minute:r,second:r,timeZoneName:n},T={year:r,month:i,day:r,weekday:i,hour:r,minute:r,timeZoneName:i},I={year:r,month:i,day:r,weekday:i,hour:r,minute:r,second:r,timeZoneName:i};class Zone{get type(){throw new ZoneIsAbstractError}get name(){throw new ZoneIsAbstractError}get ianaName(){return this.name}get isUniversal(){throw new ZoneIsAbstractError}offsetName(e,t){throw new ZoneIsAbstractError}formatOffset(e,t){throw new ZoneIsAbstractError}offset(e){throw new ZoneIsAbstractError}equals(e){throw new ZoneIsAbstractError}get isValid(){throw new ZoneIsAbstractError}}let E=null;class SystemZone extends Zone{static get instance(){return null===E&&(E=new SystemZone),E}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return parseZoneInfo(e,t,r)}formatOffset(e,t){return formatOffset(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}let D={};const P={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};let A={};class IANAZone extends Zone{static create(e){return A[e]||(A[e]=new IANAZone(e)),A[e]}static resetCache(){A={},D={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=IANAZone.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return parseZoneInfo(e,t,r,this.name)}formatOffset(e,t){return formatOffset(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const r=function makeDTF(e){return D[e]||(D[e]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),D[e]}(this.name);let[n,i,a,o,s,l,c]=r.formatToParts?function partsOffset(e,t){const r=e.formatToParts(t),n=[];for(let e=0;e<r.length;e++){const{type:t,value:i}=r[e],a=P[t];"era"===t?n[a]=i:isUndefined(a)||(n[a]=parseInt(i,10))}return n}(r,t):function hackyOffset(e,t){const r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,a,o,s,l,c,u]=n;return[o,i,a,s,l,c,u]}(r,t);"BC"===o&&(n=1-Math.abs(n));let u=+t;const d=u%1e3;return u-=d>=0?d:1e3+d,(objToLocalTS({year:n,month:i,day:a,hour:24===s?0:s,minute:l,second:c,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let j={};let M={};function getCachedDTF(e,t={}){const r=JSON.stringify([e,t]);let n=M[r];return n||(n=new Intl.DateTimeFormat(e,t),M[r]=n),n}let x={};let k={};let L=null;let F={};function listStuff(e,t,r,n){const i=e.listingMode();return"error"===i?null:"en"===i?r(t):n(t)}class PolyNumberFormatter{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:n,floor:i,...a}=r;if(!t||Object.keys(a).length>0){const t={useGrouping:!1,...r};r.padTo>0&&(t.minimumIntegerDigits=r.padTo),this.inf=function getCachedINF(e,t={}){const r=JSON.stringify([e,t]);let n=x[r];return n||(n=new Intl.NumberFormat(e,t),x[r]=n),n}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return padStart(this.floor?Math.floor(e):roundTo(e,3),this.padTo)}}class PolyDateFormatter{constructor(e,t,r){let n;if(this.opts=r,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,r=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&IANAZone.create(r).valid?(n=r,this.dt=e):(n="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||n,this.dtf=getCachedDTF(t,i)}format(){return this.originalZone?this.formatToParts().map((({value:e})=>e)).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map((e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e})):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class PolyRelFormatter{constructor(e,t,r){this.opts={style:"long",...r},!t&&hasRelative()&&(this.rtf=function getCachedRTF(e,t={}){const{base:r,...n}=t,i=JSON.stringify([e,n]);let a=k[i];return a||(a=new Intl.RelativeTimeFormat(e,t),k[i]=a),a}(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):function formatRelativeTime(e,t,r="always",n=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===r&&a){const r="days"===e;switch(t){case 1:return r?"tomorrow":`next ${i[e][0]}`;case-1:return r?"yesterday":`last ${i[e][0]}`;case 0:return r?"today":`this ${i[e][0]}`}}const o=Object.is(t,-0)||t<0,s=Math.abs(t),l=1===s,c=i[e],u=n?l?c[1]:c[2]||c[1]:l?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const N={firstDay:1,minimalDays:4,weekend:[6,7]};class Locale{static fromOpts(e){return Locale.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,n,i=!1){const a=e||Settings.defaultLocale,o=a||(i?"en-US":function systemLocale(){return L||(L=(new Intl.DateTimeFormat).resolvedOptions().locale,L)}()),s=t||Settings.defaultNumberingSystem,l=r||Settings.defaultOutputCalendar,c=validateWeekSettings(n)||Settings.defaultWeekSettings;return new Locale(o,s,l,c,a)}static resetCache(){L=null,M={},x={},k={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:n}={}){return Locale.create(e,t,r,n)}constructor(e,t,r,n,i){const[a,o,s]=function parseLocaleString(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const r=e.indexOf("-u-");if(-1===r)return[e];{let t,n;try{t=getCachedDTF(e).resolvedOptions(),n=e}catch(i){const a=e.substring(0,r);t=getCachedDTF(a).resolvedOptions(),n=a}const{numberingSystem:i,calendar:a}=t;return[n,i,a]}}(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=r||s||null,this.weekSettings=n,this.intl=function intlConfigString(e,t,r){return r||t?(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`),e):e}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return null==this.fastNumbersCached&&(this.fastNumbersCached=function supportsFastNumbers(e){return(!e.numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===new Intl.DateTimeFormat(e.intl).resolvedOptions().numberingSystem)}(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Locale.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,validateWeekSettings(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return listStuff(this,e,months,(()=>{const r=t?{month:e,day:"numeric"}:{month:e},n=t?"format":"standalone";return this.monthsCache[n][e]||(this.monthsCache[n][e]=function mapMonths(e){const t=[];for(let r=1;r<=12;r++){const n=DateTime.utc(2009,r,1);t.push(e(n))}return t}((e=>this.extract(e,r,"month")))),this.monthsCache[n][e]}))}weekdays(e,t=!1){return listStuff(this,e,weekdays,(()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=t?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=function mapWeekdays(e){const t=[];for(let r=1;r<=7;r++){const n=DateTime.utc(2016,11,13+r);t.push(e(n))}return t}((e=>this.extract(e,r,"weekday")))),this.weekdaysCache[n][e]}))}meridiems(){return listStuff(this,void 0,(()=>te),(()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[DateTime.utc(2016,11,13,9),DateTime.utc(2016,11,13,19)].map((t=>this.extract(t,e,"dayperiod")))}return this.meridiemCache}))}eras(e){return listStuff(this,e,eras,(()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[DateTime.utc(-40,1,1),DateTime.utc(2017,1,1)].map((e=>this.extract(e,t,"era")))),this.eraCache[e]}))}extract(e,t,r){const n=this.dtFormatter(e,t).formatToParts().find((e=>e.type.toLowerCase()===r));return n?n.value:null}numberFormatter(e={}){return new PolyNumberFormatter(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new PolyDateFormatter(e,this.intl,t)}relFormatter(e={}){return new PolyRelFormatter(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function getCachedLF(e,t={}){const r=JSON.stringify([e,t]);let n=j[r];return n||(n=new Intl.ListFormat(e,t),j[r]=n),n}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hasLocaleWeekInfo()?function getCachedWeekInfo(e){let t=F[e];if(!t){const r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,F[e]=t}return t}(this.locale):N}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let z=null;class FixedOffsetZone extends Zone{static get utcInstance(){return null===z&&(z=new FixedOffsetZone(0)),z}static instance(e){return 0===e?FixedOffsetZone.utcInstance:new FixedOffsetZone(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new FixedOffsetZone(signedOffset(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${formatOffset(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${formatOffset(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return formatOffset(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class InvalidZone extends Zone{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function normalizeZone(e,t){if(isUndefined(e)||null===e)return t;if(e instanceof Zone)return e;if(function isString(e){return"string"==typeof e}(e)){const r=e.toLowerCase();return"default"===r?t:"local"===r||"system"===r?SystemZone.instance:"utc"===r||"gmt"===r?FixedOffsetZone.utcInstance:FixedOffsetZone.parseSpecifier(r)||IANAZone.create(e)}return isNumber(e)?FixedOffsetZone.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new InvalidZone(e)}let B,now=()=>Date.now(),U="system",W=null,V=null,q=null,$=60,K=null;class Settings{static get now(){return now}static set now(e){now=e}static set defaultZone(e){U=e}static get defaultZone(){return normalizeZone(U,SystemZone.instance)}static get defaultLocale(){return W}static set defaultLocale(e){W=e}static get defaultNumberingSystem(){return V}static set defaultNumberingSystem(e){V=e}static get defaultOutputCalendar(){return q}static set defaultOutputCalendar(e){q=e}static get defaultWeekSettings(){return K}static set defaultWeekSettings(e){K=validateWeekSettings(e)}static get twoDigitCutoffYear(){return $}static set twoDigitCutoffYear(e){$=e%100}static get throwOnInvalid(){return B}static set throwOnInvalid(e){B=e}static resetCaches(){Locale.resetCache(),IANAZone.resetCache()}}class Invalid{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const H=[0,31,59,90,120,151,181,212,243,273,304,334],G=[0,31,60,91,121,152,182,213,244,274,305,335];function unitOutOfRange(e,t){return new Invalid("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function dayOfWeek(e,t,r){const n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const i=n.getUTCDay();return 0===i?7:i}function computeOrdinal(e,t,r){return r+(isLeapYear(e)?G:H)[t-1]}function uncomputeOrdinal(e,t){const r=isLeapYear(e)?G:H,n=r.findIndex((e=>e<t));return{month:n+1,day:t-r[n]}}function isoWeekdayToLocal(e,t){return(e-t+7)%7+1}function gregorianToWeek(e,t=4,r=1){const{year:n,month:i,day:a}=e,o=computeOrdinal(n,i,a),s=isoWeekdayToLocal(dayOfWeek(n,i,a),r);let l,c=Math.floor((o-s+14-t)/7);return c<1?(l=n-1,c=weeksInWeekYear(l,t,r)):c>weeksInWeekYear(n,t,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:s,...timeObject(e)}}function weekToGregorian(e,t=4,r=1){const{weekYear:n,weekNumber:i,weekday:a}=e,o=isoWeekdayToLocal(dayOfWeek(n,1,t),r),s=daysInYear(n);let l,c=7*i+a-o-7+t;c<1?(l=n-1,c+=daysInYear(l)):c>s?(l=n+1,c-=daysInYear(n)):l=n;const{month:u,day:d}=uncomputeOrdinal(l,c);return{year:l,month:u,day:d,...timeObject(e)}}function gregorianToOrdinal(e){const{year:t,month:r,day:n}=e;return{year:t,ordinal:computeOrdinal(t,r,n),...timeObject(e)}}function ordinalToGregorian(e){const{year:t,ordinal:r}=e,{month:n,day:i}=uncomputeOrdinal(t,r);return{year:t,month:n,day:i,...timeObject(e)}}function usesLocalWeekValues(e,t){if(!isUndefined(e.localWeekday)||!isUndefined(e.localWeekNumber)||!isUndefined(e.localWeekYear)){if(!isUndefined(e.weekday)||!isUndefined(e.weekNumber)||!isUndefined(e.weekYear))throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");return isUndefined(e.localWeekday)||(e.weekday=e.localWeekday),isUndefined(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),isUndefined(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function hasInvalidGregorianData(e){const t=isInteger(e.year),r=integerBetween(e.month,1,12),n=integerBetween(e.day,1,daysInMonth(e.year,e.month));return t?r?!n&&unitOutOfRange("day",e.day):unitOutOfRange("month",e.month):unitOutOfRange("year",e.year)}function hasInvalidTimeData(e){const{hour:t,minute:r,second:n,millisecond:i}=e,a=integerBetween(t,0,23)||24===t&&0===r&&0===n&&0===i,o=integerBetween(r,0,59),s=integerBetween(n,0,59),l=integerBetween(i,0,999);return a?o?s?!l&&unitOutOfRange("millisecond",i):unitOutOfRange("second",n):unitOutOfRange("minute",r):unitOutOfRange("hour",t)}function isUndefined(e){return void 0===e}function isNumber(e){return"number"==typeof e}function isInteger(e){return"number"==typeof e&&e%1==0}function hasRelative(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function hasLocaleWeekInfo(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function bestBy(e,t,r){if(0!==e.length)return e.reduce(((e,n)=>{const i=[t(n),n];return e&&r(e[0],i[0])===e[0]?e:i}),null)[1]}function hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function validateWeekSettings(e){if(null==e)return null;if("object"!=typeof e)throw new InvalidArgumentError("Week settings must be an object");if(!integerBetween(e.firstDay,1,7)||!integerBetween(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some((e=>!integerBetween(e,1,7))))throw new InvalidArgumentError("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function integerBetween(e,t,r){return isInteger(e)&&e>=t&&e<=r}function padStart(e,t=2){let r;return r=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),r}function parseInteger(e){return isUndefined(e)||null===e||""===e?void 0:parseInt(e,10)}function parseFloating(e){return isUndefined(e)||null===e||""===e?void 0:parseFloat(e)}function parseMillis(e){if(!isUndefined(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function roundTo(e,t,r=!1){const n=10**t;return(r?Math.trunc:Math.round)(e*n)/n}function isLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}function daysInYear(e){return isLeapYear(e)?366:365}function daysInMonth(e,t){const r=function floorMod(e,t){return e-t*Math.floor(e/t)}(t-1,12)+1;return 2===r?isLeapYear(e+(t-r)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function objToLocalTS(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function firstWeekOffset(e,t,r){return-isoWeekdayToLocal(dayOfWeek(e,1,t),r)+t-1}function weeksInWeekYear(e,t=4,r=1){const n=firstWeekOffset(e,t,r),i=firstWeekOffset(e+1,t,r);return(daysInYear(e)-n+i)/7}function untruncateYear(e){return e>99?e:e>Settings.twoDigitCutoffYear?1900+e:2e3+e}function parseZoneInfo(e,t,r,n=null){const i=new Date(e),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);const o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(r,o).formatToParts(i).find((e=>"timezonename"===e.type.toLowerCase()));return s?s.value:null}function signedOffset(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);const n=parseInt(t,10)||0;return 60*r+(r<0||Object.is(r,-0)?-n:n)}function asNumber(e){const t=Number(e);if("boolean"==typeof e||""===e||Number.isNaN(t))throw new InvalidArgumentError(`Invalid unit value ${e}`);return t}function normalizeObject(e,t){const r={};for(const n in e)if(hasOwnProperty(e,n)){const i=e[n];if(null==i)continue;r[t(n)]=asNumber(i)}return r}function formatOffset(e,t){const r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${padStart(r,2)}:${padStart(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${padStart(r,2)}${padStart(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function timeObject(e){return function pick(e,t){return t.reduce(((t,r)=>(t[r]=e[r],t)),{})}(e,["hour","minute","second","millisecond"])}const Z=["January","February","March","April","May","June","July","August","September","October","November","December"],J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Y=["J","F","M","A","M","J","J","A","S","O","N","D"];function months(e){switch(e){case"narrow":return[...Y];case"short":return[...J];case"long":return[...Z];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Q=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],X=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ee=["M","T","W","T","F","S","S"];function weekdays(e){switch(e){case"narrow":return[...ee];case"short":return[...X];case"long":return[...Q];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const te=["AM","PM"],re=["Before Christ","Anno Domini"],ne=["BC","AD"],ie=["B","A"];function eras(e){switch(e){case"narrow":return[...ie];case"short":return[...ne];case"long":return[...re];default:return null}}function stringifyTokens(e,t){let r="";for(const n of e)n.literal?r+=n.val:r+=t(n.val);return r}const ae={D:a,DD:o,DDD:l,DDDD:c,t:u,tt:d,ttt:p,tttt:h,T:y,TT:g,TTT:m,TTTT:v,f:b,ff:C,fff:R,ffff:T,F:w,FF:S,FFF:O,FFFF:I};class Formatter{static create(e,t={}){return new Formatter(e,t)}static parseFormat(e){let t=null,r="",n=!1;const i=[];for(let a=0;a<e.length;a++){const o=e.charAt(a);"'"===o?(r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),t=null,r="",n=!n):n||o===t?r+=o:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&i.push({literal:n||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return ae[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem());return this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return padStart(e,t);const r={...this.opts};return t>0&&(r.padTo=t),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const r="en"===this.loc.listingMode(),n=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,string=(t,r)=>this.loc.extract(e,t,r),formatOffset=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",meridiem=()=>r?function meridiemForDateTime(e){return te[e.hour<12?0:1]}(e):string({hour:"numeric",hourCycle:"h12"},"dayperiod"),month=(t,n)=>r?function monthForDateTime(e,t){return months(t)[e.month-1]}(e,t):string(n?{month:t}:{month:t,day:"numeric"},"month"),weekday=(t,n)=>r?function weekdayForDateTime(e,t){return weekdays(t)[e.weekday-1]}(e,t):string(n?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),maybeMacro=t=>{const r=Formatter.macroTokenToFormatOpts(t);return r?this.formatWithSystemDefault(e,r):t},era=t=>r?function eraForDateTime(e,t){return eras(t)[e.year<0?0:1]}(e,t):string({era:t},"era");return stringifyTokens(Formatter.parseFormat(t),(t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return formatOffset({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return formatOffset({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return formatOffset({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return meridiem();case"d":return n?string({day:"numeric"},"day"):this.num(e.day);case"dd":return n?string({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return weekday("short",!0);case"cccc":return weekday("long",!0);case"ccccc":return weekday("narrow",!0);case"EEE":return weekday("short",!1);case"EEEE":return weekday("long",!1);case"EEEEE":return weekday("narrow",!1);case"L":return n?string({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?string({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return month("short",!0);case"LLLL":return month("long",!0);case"LLLLL":return month("narrow",!0);case"M":return n?string({month:"numeric"},"month"):this.num(e.month);case"MM":return n?string({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return month("short",!1);case"MMMM":return month("long",!1);case"MMMMM":return month("narrow",!1);case"y":return n?string({year:"numeric"},"year"):this.num(e.year);case"yy":return n?string({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?string({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?string({year:"numeric"},"year"):this.num(e.year,6);case"G":return era("short");case"GG":return era("long");case"GGGGG":return era("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return maybeMacro(t)}}))}formatDurationFromString(e,t){const tokenToField=e=>{switch(e[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},r=Formatter.parseFormat(t),n=r.reduce(((e,{literal:t,val:r})=>t?e:e.concat(r)),[]);return stringifyTokens(r,(e=>t=>{const r=tokenToField(t);return r?this.num(e.get(r),t.length):t})(e.shiftTo(...n.map(tokenToField).filter((e=>e)))))}}const oe=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function combineRegexes(...e){const t=e.reduce(((e,t)=>e+t.source),"");return RegExp(`^${t}$`)}function combineExtractors(...e){return t=>e.reduce((([e,r,n],i)=>{const[a,o,s]=i(t,n);return[{...e,...a},o||r,s]}),[{},null,1]).slice(0,2)}function parse(e,...t){if(null==e)return[null,null];for(const[r,n]of t){const t=r.exec(e);if(t)return n(t)}return[null,null]}function simpleParse(...e){return(t,r)=>{const n={};let i;for(i=0;i<e.length;i++)n[e[i]]=parseInteger(t[r+i]);return[n,null,r+i]}}const se=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,le=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ce=RegExp(`${le.source}${`(?:${se.source}?(?:\\[(${oe.source})\\])?)?`}`),ue=RegExp(`(?:T${ce.source})?`),de=simpleParse("weekYear","weekNumber","weekDay"),fe=simpleParse("year","ordinal"),pe=RegExp(`${le.source} ?(?:${se.source}|(${oe.source}))?`),he=RegExp(`(?: ${pe.source})?`);function int(e,t,r){const n=e[t];return isUndefined(n)?r:parseInteger(n)}function extractISOTime(e,t){return[{hours:int(e,t,0),minutes:int(e,t+1,0),seconds:int(e,t+2,0),milliseconds:parseMillis(e[t+3])},null,t+4]}function extractISOOffset(e,t){const r=!e[t]&&!e[t+1],n=signedOffset(e[t+1],e[t+2]);return[{},r?null:FixedOffsetZone.instance(n),t+3]}function extractIANAZone(e,t){return[{},e[t]?IANAZone.create(e[t]):null,t+1]}const ye=RegExp(`^T?${le.source}$`),ge=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function extractISODuration(e){const[t,r,n,i,a,o,s,l,c]=e,u="-"===t[0],d=l&&"-"===l[0],maybeNegate=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:maybeNegate(parseFloating(r)),months:maybeNegate(parseFloating(n)),weeks:maybeNegate(parseFloating(i)),days:maybeNegate(parseFloating(a)),hours:maybeNegate(parseFloating(o)),minutes:maybeNegate(parseFloating(s)),seconds:maybeNegate(parseFloating(l),"-0"===l),milliseconds:maybeNegate(parseMillis(c),d)}]}const me={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function fromStrings(e,t,r,n,i,a,o){const s={year:2===t.length?untruncateYear(parseInteger(t)):parseInteger(t),month:J.indexOf(r)+1,day:parseInteger(n),hour:parseInteger(i),minute:parseInteger(a)};return o&&(s.second=parseInteger(o)),e&&(s.weekday=e.length>3?Q.indexOf(e)+1:X.indexOf(e)+1),s}const ve=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function extractRFC2822(e){const[,t,r,n,i,a,o,s,l,c,u,d]=e,p=fromStrings(t,i,n,r,a,o,s);let h;return h=l?me[l]:c?0:signedOffset(u,d),[p,new FixedOffsetZone(h)]}const be=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,we=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ce=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function extractRFC1123Or850(e){const[,t,r,n,i,a,o,s]=e;return[fromStrings(t,i,n,r,a,o,s),FixedOffsetZone.utcInstance]}function extractASCII(e){const[,t,r,n,i,a,o,s]=e;return[fromStrings(t,s,r,n,i,a,o),FixedOffsetZone.utcInstance]}const Se=combineRegexes(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ue),_e=combineRegexes(/(\d{4})-?W(\d\d)(?:-?(\d))?/,ue),Re=combineRegexes(/(\d{4})-?(\d{3})/,ue),Oe=combineRegexes(ce),Te=combineExtractors((function extractISOYmd(e,t){return[{year:int(e,t),month:int(e,t+1,1),day:int(e,t+2,1)},null,t+3]}),extractISOTime,extractISOOffset,extractIANAZone),Ie=combineExtractors(de,extractISOTime,extractISOOffset,extractIANAZone),Ee=combineExtractors(fe,extractISOTime,extractISOOffset,extractIANAZone),De=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);const Pe=combineExtractors(extractISOTime);const Ae=combineRegexes(/(\d{4})-(\d\d)-(\d\d)/,he),je=combineRegexes(pe),Me=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);const xe="Invalid Duration",ke={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Le={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...ke},Fe=365.2425,Ne=30.436875,ze={years:{quarters:4,months:12,weeks:52.1775,days:Fe,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:Ne,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...ke},Be=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Ue=Be.slice(0).reverse();function clone$1(e,t,r=!1){const n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new Duration(n)}function durationToMillis(e,t){var r;let n=null!=(r=t.milliseconds)?r:0;for(const r of Ue.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function normalizeValues(e,t){const r=durationToMillis(e,t)<0?-1:1;Be.reduceRight(((n,i)=>{if(isUndefined(t[i]))return n;if(n){const a=t[n]*r,o=e[i][n],s=Math.floor(a/o);t[i]+=s*r,t[n]-=s*o*r}return i}),null),Be.reduce(((r,n)=>{if(isUndefined(t[n]))return r;if(r){const i=t[r]%1;t[r]-=i,t[n]+=i*e[r][n]}return n}),null)}class Duration{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let r=t?ze:Le;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Locale.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return Duration.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new Duration({values:normalizeObject(e,Duration.normalizeUnit),loc:Locale.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(isNumber(e))return Duration.fromMillis(e);if(Duration.isDuration(e))return e;if("object"==typeof e)return Duration.fromObject(e);throw new InvalidArgumentError(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=function parseISODuration(e){return parse(e,[ge,extractISODuration])}(e);return r?Duration.fromObject(r,t):Duration.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=function parseISOTimeOnly(e){return parse(e,[ye,Pe])}(e);return r?Duration.fromObject(r,t):Duration.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the Duration is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidDurationError(r);return new Duration({invalid:r})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e?e.toLowerCase():e];if(!t)throw new InvalidUnitError(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const r={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?Formatter.create(this.loc,r).formatDurationFromString(this,e):xe}toHuman(e={}){if(!this.isValid)return xe;const t=Be.map((t=>{const r=this.values[t];return isUndefined(r)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:t.slice(0,-1)}).format(r)})).filter((e=>e));return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=roundTo(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1};return DateTime.fromMillis(t,{zone:"UTC"}).toISOTime(e)}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?durationToMillis(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Duration.fromDurationLike(e),r={};for(const e of Be)(hasOwnProperty(t.values,e)||hasOwnProperty(this.values,e))&&(r[e]=t.get(e)+this.get(e));return clone$1(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=Duration.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=asNumber(e(this.values[r],r));return clone$1(this,{values:t},!0)}get(e){return this[Duration.normalizeUnit(e)]}set(e){if(!this.isValid)return this;return clone$1(this,{values:{...this.values,...normalizeObject(e,Duration.normalizeUnit)}})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:n}={}){return clone$1(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:n,conversionAccuracy:r})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return normalizeValues(this.matrix,e),clone$1(this,{values:e},!0)}rescale(){if(!this.isValid)return this;return clone$1(this,{values:function removeZeroes(e){const t={};for(const[r,n]of Object.entries(e))0!==n&&(t[r]=n);return t}(this.normalize().shiftToAll().toObject())},!0)}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map((e=>Duration.normalizeUnit(e)));const t={},r={},n=this.toObject();let i;for(const a of Be)if(e.indexOf(a)>=0){i=a;let e=0;for(const t in r)e+=this.matrix[t][a]*r[t],r[t]=0;isNumber(n[a])&&(e+=n[a]);const o=Math.trunc(e);t[a]=o,r[a]=(1e3*e-1e3*o)/1e3}else isNumber(n[a])&&(r[a]=n[a]);for(const e in r)0!==r[e]&&(t[i]+=e===i?r[e]:r[e]/this.matrix[i][e]);return normalizeValues(this.matrix,t),clone$1(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return clone$1(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid)return!1;if(!this.loc.equals(e.loc))return!1;for(const n of Be)if(t=this.values[n],r=e.values[n],!(void 0===t||0===t?void 0===r||0===r:t===r))return!1;var t,r;return!0}}const We="Invalid Interval";class Interval{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the Interval is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidIntervalError(r);return new Interval({invalid:r})}static fromDateTimes(e,t){const r=friendlyDateTime(e),n=friendlyDateTime(t),i=function validateStartEnd(e,t){return e&&e.isValid?t&&t.isValid?t<e?Interval.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null:Interval.invalid("missing or invalid end"):Interval.invalid("missing or invalid start")}(r,n);return null==i?new Interval({start:r,end:n}):i}static after(e,t){const r=Duration.fromDurationLike(t),n=friendlyDateTime(e);return Interval.fromDateTimes(n,n.plus(r))}static before(e,t){const r=Duration.fromDurationLike(t),n=friendlyDateTime(e);return Interval.fromDateTimes(n.minus(r),n)}static fromISO(e,t){const[r,n]=(e||"").split("/",2);if(r&&n){let e,i,a,o;try{e=DateTime.fromISO(r,t),i=e.isValid}catch(n){i=!1}try{a=DateTime.fromISO(n,t),o=a.isValid}catch(n){o=!1}if(i&&o)return Interval.fromDateTimes(e,a);if(i){const r=Duration.fromISO(n,t);if(r.isValid)return Interval.after(e,r)}else if(o){const e=Duration.fromISO(r,t);if(e.isValid)return Interval.before(a,e)}}return Interval.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const r=this.start.startOf(e,t);let n;return n=null!=t&&t.useLocaleWeeks?this.end.reconfigure({locale:r.locale}):this.end,n=n.startOf(e,t),Math.floor(n.diff(r,e).get(e))+(n.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&(this.s<=e&&this.e>e)}set({start:e,end:t}={}){return this.isValid?Interval.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(friendlyDateTime).filter((e=>this.contains(e))).sort(((e,t)=>e.toMillis()-t.toMillis())),r=[];let{s:n}=this,i=0;for(;n<this.e;){const e=t[i]||this.e,a=+e>+this.e?this.e:e;r.push(Interval.fromDateTimes(n,a)),n=a,i+=1}return r}splitBy(e){const t=Duration.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let r,{s:n}=this,i=1;const a=[];for(;n<this.e;){const e=this.start.plus(t.mapUnits((e=>e*i)));r=+e>+this.e?this.e:e,a.push(Interval.fromDateTimes(n,r)),n=r,i+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return!!this.isValid&&+this.e==+e.s}abutsEnd(e){return!!this.isValid&&+e.e==+this.s}engulfs(e){return!!this.isValid&&(this.s<=e.s&&this.e>=e.e)}equals(e){return!(!this.isValid||!e.isValid)&&(this.s.equals(e.s)&&this.e.equals(e.e))}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:Interval.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return Interval.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort(((e,t)=>e.s-t.s)).reduce((([e,t],r)=>t?t.overlaps(r)||t.abutsStart(r)?[e,t.union(r)]:[e.concat([t]),r]:[e,r]),[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const n=[],i=e.map((e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}])),a=Array.prototype.concat(...i).sort(((e,t)=>e.time-t.time));for(const e of a)r+="s"===e.type?1:-1,1===r?t=e.time:(t&&+t!=+e.time&&n.push(Interval.fromDateTimes(t,e.time)),t=null);return Interval.merge(n)}difference(...e){return Interval.xor([this].concat(e)).map((e=>this.intersection(e))).filter((e=>e&&!e.isEmpty()))}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:We}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=a,t={}){return this.isValid?Formatter.create(this.s.loc.clone(t),e).formatInterval(this):We}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:We}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:We}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:We}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:We}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Duration.invalid(this.invalidReason)}mapEndpoints(e){return Interval.fromDateTimes(e(this.s),e(this.e))}}class Info{static hasDST(e=Settings.defaultZone){const t=DateTime.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return IANAZone.isValidZone(e)}static normalizeZone(e){return normalizeZone(e,Settings.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Locale.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||Locale.create(t,r,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null,outputCalendar:i="gregory"}={}){return(n||Locale.create(t,r,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Locale.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Locale.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Locale.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Locale.create(t,null,"gregory").eras(e)}static features(){return{relative:hasRelative(),localeWeek:hasLocaleWeekInfo()}}}function dayDiff(e,t){const utcDayStart=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=utcDayStart(t)-utcDayStart(e);return Math.floor(Duration.fromMillis(r).as("days"))}function diff(e,t,r,n){let[i,a,o,s]=function highOrderDiffs(e,t,r){const n=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const r=dayDiff(e,t);return(r-r%7)/7}],["days",dayDiff]],i={},a=e;let o,s;for(const[l,c]of n)r.indexOf(l)>=0&&(o=l,i[l]=c(e,t),s=a.plus(i),s>t?(i[l]--,(e=a.plus(i))>t&&(s=e,i[l]--,e=a.plus(i))):e=s);return[e,i,s,o]}(e,t,r);const l=t-i,c=r.filter((e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0));0===c.length&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+l/(o-i)));const u=Duration.fromObject(a,n);return c.length>0?Duration.fromMillis(l,n).shiftTo(...c).plus(u):u}const Ve={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},qe={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},$e=Ve.hanidec.replace(/[\[|\]]/g,"").split("");function digitRegex({numberingSystem:e},t=""){return new RegExp(`${Ve[e||"latn"]}${t}`)}const Ke="missing Intl.DateTimeFormat.formatToParts support";function intUnit(e,t=(e=>e)){return{regex:e,deser:([e])=>t(function parseDigits(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(-1!==e[r].search(Ve.hanidec))t+=$e.indexOf(e[r]);else for(const e in qe){const[r,i]=qe[e];n>=r&&n<=i&&(t+=n-r)}}return parseInt(t,10)}return t}(e))}}const He=`[ ${String.fromCharCode(160)}]`,Ge=new RegExp(He,"g");function fixListRegex(e){return e.replace(/\./g,"\\.?").replace(Ge,He)}function stripInsensitivities(e){return e.replace(/\./g,"").replace(Ge," ").toLowerCase()}function oneOf(e,t){return null===e?null:{regex:RegExp(e.map(fixListRegex).join("|")),deser:([r])=>e.findIndex((e=>stripInsensitivities(r)===stripInsensitivities(e)))+t}}function offset(e,t){return{regex:e,deser:([,e,t])=>signedOffset(e,t),groups:t}}function simple(e){return{regex:e,deser:([e])=>e}}const Ze={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let Je=null;function expandMacroTokens(e,t){return Array.prototype.concat(...e.map((e=>function maybeExpandMacroToken(e,t){if(e.literal)return e;const r=formatOptsToTokens(Formatter.macroTokenToFormatOpts(e.val),t);return null==r||r.includes(void 0)?e:r}(e,t))))}function explainFromTokens(e,t,r){const n=expandMacroTokens(Formatter.parseFormat(r),e),i=n.map((t=>function unitForToken(e,t){const r=digitRegex(t),n=digitRegex(t,"{2}"),i=digitRegex(t,"{3}"),a=digitRegex(t,"{4}"),o=digitRegex(t,"{6}"),s=digitRegex(t,"{1,2}"),l=digitRegex(t,"{1,3}"),c=digitRegex(t,"{1,6}"),u=digitRegex(t,"{1,9}"),d=digitRegex(t,"{2,4}"),p=digitRegex(t,"{4,6}"),literal=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},h=(h=>{if(e.literal)return literal(h);switch(h.val){case"G":return oneOf(t.eras("short"),0);case"GG":return oneOf(t.eras("long"),0);case"y":return intUnit(c);case"yy":case"kk":return intUnit(d,untruncateYear);case"yyyy":case"kkkk":return intUnit(a);case"yyyyy":return intUnit(p);case"yyyyyy":return intUnit(o);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return intUnit(s);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return intUnit(n);case"MMM":return oneOf(t.months("short",!0),1);case"MMMM":return oneOf(t.months("long",!0),1);case"LLL":return oneOf(t.months("short",!1),1);case"LLLL":return oneOf(t.months("long",!1),1);case"o":case"S":return intUnit(l);case"ooo":case"SSS":return intUnit(i);case"u":return simple(u);case"uu":return simple(s);case"uuu":case"E":case"c":return intUnit(r);case"a":return oneOf(t.meridiems(),0);case"EEE":return oneOf(t.weekdays("short",!1),1);case"EEEE":return oneOf(t.weekdays("long",!1),1);case"ccc":return oneOf(t.weekdays("short",!0),1);case"cccc":return oneOf(t.weekdays("long",!0),1);case"Z":case"ZZ":return offset(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return offset(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return simple(/[a-z_+-/]{1,256}?/i);case" ":return simple(/[^\S\n\r]/);default:return literal(h)}})(e)||{invalidReason:Ke};return h.token=e,h}(t,e))),a=i.find((e=>e.invalidReason));if(a)return{input:t,tokens:n,invalidReason:a.invalidReason};{const[e,r]=function buildRegex(e){return[`^${e.map((e=>e.regex)).reduce(((e,t)=>`${e}(${t.source})`),"")}$`,e]}(i),a=RegExp(e,"i"),[o,s]=function match(e,t,r){const n=e.match(t);if(n){const e={};let t=1;for(const i in r)if(hasOwnProperty(r,i)){const a=r[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(n.slice(t,t+o))),t+=o}return[n,e]}return[n,{}]}(t,a,r),[l,c,u]=s?function dateTimeFromMatches(e){let t,r=null;return isUndefined(e.z)||(r=IANAZone.create(e.z)),isUndefined(e.Z)||(r||(r=new FixedOffsetZone(e.Z)),t=e.Z),isUndefined(e.q)||(e.M=3*(e.q-1)+1),isUndefined(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),isUndefined(e.u)||(e.S=parseMillis(e.u)),[Object.keys(e).reduce(((t,r)=>{const n=(e=>{switch(e){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(r);return n&&(t[n]=e[r]),t}),{}),r,t]}(s):[null,null,void 0];if(hasOwnProperty(s,"a")&&hasOwnProperty(s,"H"))throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:n,regex:a,rawMatches:o,matches:s,result:l,zone:c,specificOffset:u}}}function formatOptsToTokens(e,t){if(!e)return null;const r=Formatter.create(t,e).dtFormatter(function getDummyDateTime(){return Je||(Je=DateTime.fromMillis(1555555555555)),Je}()),n=r.formatToParts(),i=r.resolvedOptions();return n.map((t=>function tokenForPart(e,t,r){const{type:n,value:i}=e;if("literal"===n){const e=/^\s+$/.test(i);return{literal:!e,val:e?" ":i}}const a=t[n];let o=n;"hour"===n&&(o=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":r.hour12?"hour12":"hour24");let s=Ze[o];if("object"==typeof s&&(s=s[a]),s)return{literal:!1,val:s}}(t,e,i)))}const Ye="Invalid DateTime",Qe=864e13;function unsupportedZone(e){return new Invalid("unsupported zone",`the zone "${e.name}" is not supported`)}function possiblyCachedWeekData(e){return null===e.weekData&&(e.weekData=gregorianToWeek(e.c)),e.weekData}function possiblyCachedLocalWeekData(e){return null===e.localWeekData&&(e.localWeekData=gregorianToWeek(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function clone(e,t){const r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new DateTime({...r,...t,old:r})}function fixOffset(e,t,r){let n=e-60*t*1e3;const i=r.offset(n);if(t===i)return[n,t];n-=60*(i-t)*1e3;const a=r.offset(n);return i===a?[n,i]:[e-60*Math.min(i,a)*1e3,Math.max(i,a)]}function tsToObj(e,t){const r=new Date(e+=60*t*1e3);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function objToTS(e,t,r){return fixOffset(objToLocalTS(e),t,r)}function adjustTime(e,t){const r=e.o,n=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),a={...e.c,year:n,month:i,day:Math.min(e.c.day,daysInMonth(n,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},o=Duration.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),s=objToLocalTS(a);let[l,c]=fixOffset(s,r,e.zone);return 0!==o&&(l+=o,c=e.zone.offset(l)),{ts:l,o:c}}function parseDataToDateTime(e,t,r,n,i,a){const{setZone:o,zone:s}=r;if(e&&0!==Object.keys(e).length||t){const n=t||s,i=DateTime.fromObject(e,{...r,zone:n,specificOffset:a});return o?i:i.setZone(s)}return DateTime.invalid(new Invalid("unparsable",`the input "${i}" can't be parsed as ${n}`))}function toTechFormat(e,t,r=!0){return e.isValid?Formatter.create(Locale.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}function toISODate(e,t){const r=e.c.year>9999||e.c.year<0;let n="";return r&&e.c.year>=0&&(n+="+"),n+=padStart(e.c.year,r?6:4),t?(n+="-",n+=padStart(e.c.month),n+="-",n+=padStart(e.c.day)):(n+=padStart(e.c.month),n+=padStart(e.c.day)),n}function toISOTime(e,t,r,n,i,a){let o=padStart(e.c.hour);return t?(o+=":",o+=padStart(e.c.minute),0===e.c.millisecond&&0===e.c.second&&r||(o+=":")):o+=padStart(e.c.minute),0===e.c.millisecond&&0===e.c.second&&r||(o+=padStart(e.c.second),0===e.c.millisecond&&n||(o+=".",o+=padStart(e.c.millisecond,3))),i&&(e.isOffsetFixed&&0===e.offset&&!a?o+="Z":e.o<0?(o+="-",o+=padStart(Math.trunc(-e.o/60)),o+=":",o+=padStart(Math.trunc(-e.o%60))):(o+="+",o+=padStart(Math.trunc(e.o/60)),o+=":",o+=padStart(Math.trunc(e.o%60)))),a&&(o+="["+e.zone.ianaName+"]"),o}const Xe={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},et={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},tt={ordinal:1,hour:0,minute:0,second:0,millisecond:0},rt=["year","month","day","hour","minute","second","millisecond"],nt=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],it=["year","ordinal","hour","minute","second","millisecond"];function normalizeUnitWithLocalWeeks(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return function normalizeUnit(e){const t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new InvalidUnitError(e);return t}(e)}}function quickDT(e,t){const r=normalizeZone(t.zone,Settings.defaultZone),n=Locale.fromObject(t),i=Settings.now();let a,o;if(isUndefined(e.year))a=i;else{for(const t of rt)isUndefined(e[t])&&(e[t]=Xe[t]);const t=hasInvalidGregorianData(e)||hasInvalidTimeData(e);if(t)return DateTime.invalid(t);const n=r.offset(i);[a,o]=objToTS(e,n,r)}return new DateTime({ts:a,zone:r,loc:n,o})}function diffRelative(e,t,r){const n=!!isUndefined(r.round)||r.round,format=(e,i)=>{e=roundTo(e,n||r.calendary?0:2,!0);return t.loc.clone(r).relFormatter(r).format(e,i)},differ=n=>r.calendary?t.hasSame(e,n)?0:t.startOf(n).diff(e.startOf(n),n).get(n):t.diff(e,n).get(n);if(r.unit)return format(differ(r.unit),r.unit);for(const e of r.units){const t=differ(e);if(Math.abs(t)>=1)return format(t,e)}return format(e>t?-0:0,r.units[r.units.length-1])}function lastOpts(e){let t,r={};return e.length>0&&"object"==typeof e[e.length-1]?(r=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[r,t]}class DateTime{constructor(e){const t=e.zone||Settings.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new Invalid("invalid input"):null)||(t.isValid?null:unsupportedZone(t));this.ts=isUndefined(e.ts)?Settings.now():e.ts;let n=null,i=null;if(!r){if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[n,i]=[e.old.c,e.old.o];else{const e=t.offset(this.ts);n=tsToObj(this.ts,e),r=Number.isNaN(n.year)?new Invalid("invalid input"):null,n=r?null:n,i=r?null:e}}this._zone=t,this.loc=e.loc||Locale.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=i,this.isLuxonDateTime=!0}static now(){return new DateTime({})}static local(){const[e,t]=lastOpts(arguments),[r,n,i,a,o,s,l]=t;return quickDT({year:r,month:n,day:i,hour:a,minute:o,second:s,millisecond:l},e)}static utc(){const[e,t]=lastOpts(arguments),[r,n,i,a,o,s,l]=t;return e.zone=FixedOffsetZone.utcInstance,quickDT({year:r,month:n,day:i,hour:a,minute:o,second:s,millisecond:l},e)}static fromJSDate(e,t={}){const r=function isDate(e){return"[object Date]"===Object.prototype.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(r))return DateTime.invalid("invalid input");const n=normalizeZone(t.zone,Settings.defaultZone);return n.isValid?new DateTime({ts:r,zone:n,loc:Locale.fromObject(t)}):DateTime.invalid(unsupportedZone(n))}static fromMillis(e,t={}){if(isNumber(e))return e<-Qe||e>Qe?DateTime.invalid("Timestamp out of range"):new DateTime({ts:e,zone:normalizeZone(t.zone,Settings.defaultZone),loc:Locale.fromObject(t)});throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(isNumber(e))return new DateTime({ts:1e3*e,zone:normalizeZone(t.zone,Settings.defaultZone),loc:Locale.fromObject(t)});throw new InvalidArgumentError("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=normalizeZone(t.zone,Settings.defaultZone);if(!r.isValid)return DateTime.invalid(unsupportedZone(r));const n=Locale.fromObject(t),i=normalizeObject(e,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:a,startOfWeek:o}=usesLocalWeekValues(i,n),s=Settings.now(),l=isUndefined(t.specificOffset)?r.offset(s):t.specificOffset,c=!isUndefined(i.ordinal),u=!isUndefined(i.year),d=!isUndefined(i.month)||!isUndefined(i.day),p=u||d,h=i.weekYear||i.weekNumber;if((p||c)&&h)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&c)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const y=h||i.weekday&&!p;let g,m,v=tsToObj(s,l);y?(g=nt,m=et,v=gregorianToWeek(v,a,o)):c?(g=it,m=tt,v=gregorianToOrdinal(v)):(g=rt,m=Xe);let b=!1;for(const e of g){isUndefined(i[e])?i[e]=b?m[e]:v[e]:b=!0}const w=y?function hasInvalidWeekData(e,t=4,r=1){const n=isInteger(e.weekYear),i=integerBetween(e.weekNumber,1,weeksInWeekYear(e.weekYear,t,r)),a=integerBetween(e.weekday,1,7);return n?i?!a&&unitOutOfRange("weekday",e.weekday):unitOutOfRange("week",e.weekNumber):unitOutOfRange("weekYear",e.weekYear)}(i,a,o):c?function hasInvalidOrdinalData(e){const t=isInteger(e.year),r=integerBetween(e.ordinal,1,daysInYear(e.year));return t?!r&&unitOutOfRange("ordinal",e.ordinal):unitOutOfRange("year",e.year)}(i):hasInvalidGregorianData(i),C=w||hasInvalidTimeData(i);if(C)return DateTime.invalid(C);const S=y?weekToGregorian(i,a,o):c?ordinalToGregorian(i):i,[_,R]=objToTS(S,l,r),O=new DateTime({ts:_,zone:r,o:R,loc:n});return i.weekday&&p&&e.weekday!==O.weekday?DateTime.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${O.toISO()}`):O}static fromISO(e,t={}){const[r,n]=function parseISODate(e){return parse(e,[Se,Te],[_e,Ie],[Re,Ee],[Oe,De])}(e);return parseDataToDateTime(r,n,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,n]=function parseRFC2822Date(e){return parse(function preprocessRFC2822(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[ve,extractRFC2822])}(e);return parseDataToDateTime(r,n,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,n]=function parseHTTPDate(e){return parse(e,[be,extractRFC1123Or850],[we,extractRFC1123Or850],[Ce,extractASCII])}(e);return parseDataToDateTime(r,n,t,"HTTP",t)}static fromFormat(e,t,r={}){if(isUndefined(e)||isUndefined(t))throw new InvalidArgumentError("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:i=null}=r,a=Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),[o,s,l,c]=function parseFromTokens(e,t,r){const{result:n,zone:i,specificOffset:a,invalidReason:o}=explainFromTokens(e,t,r);return[n,i,a,o]}(a,e,t);return c?DateTime.invalid(c):parseDataToDateTime(o,s,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return DateTime.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,n]=function parseSQL(e){return parse(e,[Ae,Te],[je,Me])}(e);return parseDataToDateTime(r,n,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");const r=e instanceof Invalid?e:new Invalid(e,t);if(Settings.throwOnInvalid)throw new InvalidDateTimeError(r);return new DateTime({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=formatOptsToTokens(e,Locale.fromObject(t));return r?r.map((e=>e?e.val:null)).join(""):null}static expandFormat(e,t={}){return expandMacroTokens(Formatter.parseFormat(e),Locale.fromObject(t)).map((e=>e.val)).join("")}get(e){return this[e]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?possiblyCachedWeekData(this).weekYear:NaN}get weekNumber(){return this.isValid?possiblyCachedWeekData(this).weekNumber:NaN}get weekday(){return this.isValid?possiblyCachedWeekData(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?possiblyCachedLocalWeekData(this).weekday:NaN}get localWeekNumber(){return this.isValid?possiblyCachedLocalWeekData(this).weekNumber:NaN}get localWeekYear(){return this.isValid?possiblyCachedLocalWeekData(this).weekYear:NaN}get ordinal(){return this.isValid?gregorianToOrdinal(this.c).ordinal:NaN}get monthShort(){return this.isValid?Info.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Info.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Info.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Info.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=objToLocalTS(this.c),n=this.zone.offset(r-e),i=this.zone.offset(r+e),a=this.zone.offset(r-n*t),o=this.zone.offset(r-i*t);if(a===o)return[this];const s=r-a*t,l=r-o*t,c=tsToObj(s,a),u=tsToObj(l,o);return c.hour===u.hour&&c.minute===u.minute&&c.second===u.second&&c.millisecond===u.millisecond?[clone(this,{ts:s}),clone(this,{ts:l})]:[this]}get isInLeapYear(){return isLeapYear(this.year)}get daysInMonth(){return daysInMonth(this.year,this.month)}get daysInYear(){return this.isValid?daysInYear(this.year):NaN}get weeksInWeekYear(){return this.isValid?weeksInWeekYear(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?weeksInWeekYear(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:n}=Formatter.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:n}}toUTC(e=0,t={}){return this.setZone(FixedOffsetZone.instance(e),t)}toLocal(){return this.setZone(Settings.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if((e=normalizeZone(e,Settings.defaultZone)).equals(this.zone))return this;if(e.isValid){let n=this.ts;if(t||r){const t=e.offset(this.ts),r=this.toObject();[n]=objToTS(r,t,e)}return clone(this,{ts:n,zone:e})}return DateTime.invalid(unsupportedZone(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){return clone(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=normalizeObject(e,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:r,startOfWeek:n}=usesLocalWeekValues(t,this.loc),i=!isUndefined(t.weekYear)||!isUndefined(t.weekNumber)||!isUndefined(t.weekday),a=!isUndefined(t.ordinal),o=!isUndefined(t.year),s=!isUndefined(t.month)||!isUndefined(t.day),l=o||s,c=t.weekYear||t.weekNumber;if((l||a)&&c)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(s&&a)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");let u;i?u=weekToGregorian({...gregorianToWeek(this.c,r,n),...t},r,n):isUndefined(t.ordinal)?(u={...this.toObject(),...t},isUndefined(t.day)&&(u.day=Math.min(daysInMonth(u.year,u.month),u.day))):u=ordinalToGregorian({...gregorianToOrdinal(this.c),...t});const[d,p]=objToTS(u,this.o,this.zone);return clone(this,{ts:d,o:p})}plus(e){if(!this.isValid)return this;return clone(this,adjustTime(this,Duration.fromDurationLike(e)))}minus(e){if(!this.isValid)return this;return clone(this,adjustTime(this,Duration.fromDurationLike(e).negate()))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},n=Duration.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0}if("weeks"===n)if(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(r.weekNumber=this.weekNumber-1),r.weekday=e}else r.weekday=1;if("quarters"===n){const e=Math.ceil(this.month/3);r.month=3*(e-1)+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?Formatter.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Ye}toLocaleString(e=a,t={}){return this.isValid?Formatter.create(this.loc.clone(t),e).formatDateTime(this):Ye}toLocaleParts(e={}){return this.isValid?Formatter.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:n=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;const a="extended"===e;let o=toISODate(this,a);return o+="T",o+=toISOTime(this,a,t,r,n,i),o}toISODate({format:e="extended"}={}){return this.isValid?toISODate(this,"extended"===e):null}toISOWeekDate(){return toTechFormat(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:n=!1,extendedZone:i=!1,format:a="extended"}={}){if(!this.isValid)return null;return(n?"T":"")+toISOTime(this,"extended"===a,t,e,r,i)}toRFC2822(){return toTechFormat(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return toTechFormat(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?toISODate(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let n="HH:mm:ss.SSS";return(t||e)&&(r&&(n+=" "),t?n+="z":e&&(n+="ZZ")),toTechFormat(this,n,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ye}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return Duration.invalid("created by diffing an invalid DateTime");const n={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=function maybeArray(e){return Array.isArray(e)?e:[e]}(t).map(Duration.normalizeUnit),a=e.valueOf()>this.valueOf(),o=diff(a?this:e,a?e:this,i,n);return a?o.negate():o}diffNow(e="milliseconds",t={}){return this.diff(DateTime.now(),e,t)}until(e){return this.isValid?Interval.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const n=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,r)<=n&&n<=i.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||DateTime.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let n=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(n=e.unit,i=void 0),diffRelative(t,this.plus(r),{...e,numeric:"always",units:n,unit:i})}toRelativeCalendar(e={}){return this.isValid?diffRelative(e.base||DateTime.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(DateTime.isDateTime))throw new InvalidArgumentError("min requires all arguments be DateTimes");return bestBy(e,(e=>e.valueOf()),Math.min)}static max(...e){if(!e.every(DateTime.isDateTime))throw new InvalidArgumentError("max requires all arguments be DateTimes");return bestBy(e,(e=>e.valueOf()),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:n=null,numberingSystem:i=null}=r;return explainFromTokens(Locale.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,r={}){return DateTime.fromFormatExplain(e,t,r)}static get DATE_SHORT(){return a}static get DATE_MED(){return o}static get DATE_MED_WITH_WEEKDAY(){return s}static get DATE_FULL(){return l}static get DATE_HUGE(){return c}static get TIME_SIMPLE(){return u}static get TIME_WITH_SECONDS(){return d}static get TIME_WITH_SHORT_OFFSET(){return p}static get TIME_WITH_LONG_OFFSET(){return h}static get TIME_24_SIMPLE(){return y}static get TIME_24_WITH_SECONDS(){return g}static get TIME_24_WITH_SHORT_OFFSET(){return m}static get TIME_24_WITH_LONG_OFFSET(){return v}static get DATETIME_SHORT(){return b}static get DATETIME_SHORT_WITH_SECONDS(){return w}static get DATETIME_MED(){return C}static get DATETIME_MED_WITH_SECONDS(){return S}static get DATETIME_MED_WITH_WEEKDAY(){return _}static get DATETIME_FULL(){return R}static get DATETIME_FULL_WITH_SECONDS(){return O}static get DATETIME_HUGE(){return T}static get DATETIME_HUGE_WITH_SECONDS(){return I}}function friendlyDateTime(e){if(DateTime.isDateTime(e))return e;if(e&&e.valueOf&&isNumber(e.valueOf()))return DateTime.fromJSDate(e);if(e&&"object"==typeof e)return DateTime.fromObject(e);throw new InvalidArgumentError(`Unknown datetime argument: ${e}, of type ${typeof e}`)}t.DateTime=DateTime,t.Duration=Duration,t.FixedOffsetZone=FixedOffsetZone,t.IANAZone=IANAZone,t.Info=Info,t.Interval=Interval,t.InvalidZone=InvalidZone,t.Settings=Settings,t.SystemZone=SystemZone,t.VERSION="3.4.4",t.Zone=Zone},631:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,a=n&&i&&"function"==typeof i.get?i.get:null,o=n&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,l=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&l&&"function"==typeof l.get?l.get:null,u=s&&Set.prototype.forEach,d="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,p="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,h="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,y=Boolean.prototype.valueOf,g=Object.prototype.toString,m=Function.prototype.toString,v=String.prototype.match,b=String.prototype.slice,w=String.prototype.replace,C=String.prototype.toUpperCase,S=String.prototype.toLowerCase,_=RegExp.prototype.test,R=Array.prototype.concat,O=Array.prototype.join,T=Array.prototype.slice,I=Math.floor,E="function"==typeof BigInt?BigInt.prototype.valueOf:null,D=Object.getOwnPropertySymbols,P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,A="function"==typeof Symbol&&"object"==typeof Symbol.iterator,j="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===A||"symbol")?Symbol.toStringTag:null,M=Object.prototype.propertyIsEnumerable,x=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function addNumericSeparator(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||_.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-I(-e):I(e);if(n!==e){var i=String(n),a=b.call(t,i.length+1);return w.call(i,r,"$&_")+"."+w.call(w.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return w.call(t,r,"$&_")}var k=r(4654),L=k.custom,F=isSymbol(L)?L:null;function wrapQuotes(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function quote(e){return w.call(String(e),/"/g,""")}function isArray(e){return!("[object Array]"!==toStr(e)||j&&"object"==typeof e&&j in e)}function isRegExp(e){return!("[object RegExp]"!==toStr(e)||j&&"object"==typeof e&&j in e)}function isSymbol(e){if(A)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!P)return!1;try{return P.call(e),!0}catch(e){}return!1}e.exports=function inspect_(e,t,r,n){var i=t||{};if(has(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&i.maxStringLength!==1/0:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=!has(i,"customInspect")||i.customInspect;if("boolean"!=typeof s&&"symbol"!==s)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(i,"numericSeparator")&&"boolean"!=typeof i.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=i.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return inspectString(e,i);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var g=String(e);return l?addNumericSeparator(e,g):g}if("bigint"==typeof e){var C=String(e)+"n";return l?addNumericSeparator(e,C):C}var _=void 0===i.depth?5:i.depth;if(void 0===r&&(r=0),r>=_&&_>0&&"object"==typeof e)return isArray(e)?"[Array]":"[Object]";var I=function getIndent(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=O.call(Array(e.indent+1)," ")}return{base:r,prev:O.call(Array(t+1),r)}}(i,r);if(void 0===n)n=[];else if(indexOf(n,e)>=0)return"[Circular]";function inspect(e,t,a){if(t&&(n=T.call(n)).push(t),a){var o={depth:i.depth};return has(i,"quoteStyle")&&(o.quoteStyle=i.quoteStyle),inspect_(e,o,r+1,n)}return inspect_(e,i,r+1,n)}if("function"==typeof e&&!isRegExp(e)){var D=function nameOf(e){if(e.name)return e.name;var t=v.call(m.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(e),L=arrObjKeys(e,inspect);return"[Function"+(D?": "+D:" (anonymous)")+"]"+(L.length>0?" { "+O.call(L,", ")+" }":"")}if(isSymbol(e)){var N=A?w.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):P.call(e);return"object"!=typeof e||A?N:markBoxed(N)}if(function isElement(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(e)){for(var z="<"+S.call(String(e.nodeName)),B=e.attributes||[],U=0;U<B.length;U++)z+=" "+B[U].name+"="+wrapQuotes(quote(B[U].value),"double",i);return z+=">",e.childNodes&&e.childNodes.length&&(z+="..."),z+="</"+S.call(String(e.nodeName))+">"}if(isArray(e)){if(0===e.length)return"[]";var W=arrObjKeys(e,inspect);return I&&!function singleLineValues(e){for(var t=0;t<e.length;t++)if(indexOf(e[t],"\n")>=0)return!1;return!0}(W)?"["+indentedJoin(W,I)+"]":"[ "+O.call(W,", ")+" ]"}if(function isError(e){return!("[object Error]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e)){var V=arrObjKeys(e,inspect);return"cause"in Error.prototype||!("cause"in e)||M.call(e,"cause")?0===V.length?"["+String(e)+"]":"{ ["+String(e)+"] "+O.call(V,", ")+" }":"{ ["+String(e)+"] "+O.call(R.call("[cause]: "+inspect(e.cause),V),", ")+" }"}if("object"==typeof e&&s){if(F&&"function"==typeof e[F]&&k)return k(e,{depth:_-r});if("symbol"!==s&&"function"==typeof e.inspect)return e.inspect()}if(function isMap(e){if(!a||!e||"object"!=typeof e)return!1;try{a.call(e);try{c.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(e)){var q=[];return o.call(e,(function(t,r){q.push(inspect(r,e,!0)+" => "+inspect(t,e))})),collectionOf("Map",a.call(e),q,I)}if(function isSet(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e);try{a.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(e)){var $=[];return u.call(e,(function(t){$.push(inspect(t,e))})),collectionOf("Set",c.call(e),$,I)}if(function isWeakMap(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{p.call(e,p)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(e))return weakCollectionOf("WeakMap");if(function isWeakSet(e){if(!p||!e||"object"!=typeof e)return!1;try{p.call(e,p);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(e))return weakCollectionOf("WeakSet");if(function isWeakRef(e){if(!h||!e||"object"!=typeof e)return!1;try{return h.call(e),!0}catch(e){}return!1}(e))return weakCollectionOf("WeakRef");if(function isNumber(e){return!("[object Number]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e))return markBoxed(inspect(Number(e)));if(function isBigInt(e){if(!e||"object"!=typeof e||!E)return!1;try{return E.call(e),!0}catch(e){}return!1}(e))return markBoxed(inspect(E.call(e)));if(function isBoolean(e){return!("[object Boolean]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e))return markBoxed(y.call(e));if(function isString(e){return!("[object String]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e))return markBoxed(inspect(String(e)));if(!function isDate(e){return!("[object Date]"!==toStr(e)||j&&"object"==typeof e&&j in e)}(e)&&!isRegExp(e)){var K=arrObjKeys(e,inspect),H=x?x(e)===Object.prototype:e instanceof Object||e.constructor===Object,G=e instanceof Object?"":"null prototype",Z=!H&&j&&Object(e)===e&&j in e?b.call(toStr(e),8,-1):G?"Object":"",J=(H||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(Z||G?"["+O.call(R.call([],Z||[],G||[]),": ")+"] ":"");return 0===K.length?J+"{}":I?J+"{"+indentedJoin(K,I)+"}":J+"{ "+O.call(K,", ")+" }"}return String(e)};var N=Object.prototype.hasOwnProperty||function(e){return e in this};function has(e,t){return N.call(e,t)}function toStr(e){return g.call(e)}function indexOf(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function inspectString(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return inspectString(b.call(e,0,t.maxStringLength),t)+n}return wrapQuotes(w.call(w.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",t)}function lowbyte(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+C.call(t.toString(16))}function markBoxed(e){return"Object("+e+")"}function weakCollectionOf(e){return e+" { ? }"}function collectionOf(e,t,r,n){return e+" ("+t+") {"+(n?indentedJoin(r,n):O.call(r,", "))+"}"}function indentedJoin(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+O.call(e,","+r)+"\n"+t.prev}function arrObjKeys(e,t){var r=isArray(e),n=[];if(r){n.length=e.length;for(var i=0;i<e.length;i++)n[i]=has(e,i)?t(e[i],e):""}var a,o="function"==typeof D?D(e):[];if(A){a={};for(var s=0;s<o.length;s++)a["$"+o[s]]=o[s]}for(var l in e)has(e,l)&&(r&&String(Number(l))===l&&l<e.length||A&&a["$"+l]instanceof Symbol||(_.call(/[^\w$]/,l)?n.push(t(l,e)+": "+t(e[l],e)):n.push(l+": "+t(e[l],e))));if("function"==typeof D)for(var c=0;c<o.length;c++)M.call(e,o[c])&&n.push("["+t(o[c])+"]: "+t(e[o[c]],e));return n}},5798:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC1738",i="RFC3986";e.exports={default:i,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:n,RFC3986:i}},129:(e,t,r)=>{"use strict";var n=r(8261),i=r(5235),a=r(5798);e.exports={formats:a,parse:i,stringify:n}},5235:(e,t,r)=>{"use strict";var n=r(2769),i=Object.prototype.hasOwnProperty,a=Array.isArray,o={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},parseArrayValue=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},s=function parseQueryStringKeys(e,t,r,n){if(e){var a=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,s=r.depth>0&&/(\[[^[\]]*])/.exec(a),l=s?a.slice(0,s.index):a,c=[];if(l){if(!r.plainObjects&&i.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&null!==(s=o.exec(a))&&u<r.depth;){if(u+=1,!r.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(s[1])}return s&&c.push("["+a.slice(s.index)+"]"),function(e,t,r,n){for(var i=n?t:parseArrayValue(t,r),a=e.length-1;a>=0;--a){var o,s=e[a];if("[]"===s&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var l="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,c=parseInt(l,10);r.parseArrays||""!==l?!isNaN(c)&&s!==l&&String(c)===l&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[])[c]=i:"__proto__"!==l&&(o[l]=i):o={0:i}}i=o}return i}(c,t,r,n)}};e.exports=function(e,t){var r=function normalizeParseOptions(e){if(!e)return o;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?o.charset:e.charset;return{allowDots:void 0===e.allowDots?o.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:o.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:o.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:o.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:o.comma,decoder:"function"==typeof e.decoder?e.decoder:o.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:o.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:o.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:o.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:o.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:o.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function parseQueryStringValues(e,t){var r,s={__proto__:null},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,c=t.parameterLimit===1/0?void 0:t.parameterLimit,u=l.split(t.delimiter,c),d=-1,p=t.charset;if(t.charsetSentinel)for(r=0;r<u.length;++r)0===u[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===u[r]?p="utf-8":"utf8=%26%2310003%3B"===u[r]&&(p="iso-8859-1"),d=r,r=u.length);for(r=0;r<u.length;++r)if(r!==d){var h,y,g=u[r],m=g.indexOf("]="),v=-1===m?g.indexOf("="):m+1;-1===v?(h=t.decoder(g,o.decoder,p,"key"),y=t.strictNullHandling?null:""):(h=t.decoder(g.slice(0,v),o.decoder,p,"key"),y=n.maybeMap(parseArrayValue(g.slice(v+1),t),(function(e){return t.decoder(e,o.decoder,p,"value")}))),y&&t.interpretNumericEntities&&"iso-8859-1"===p&&(y=interpretNumericEntities(y)),g.indexOf("[]=")>-1&&(y=a(y)?[y]:y),i.call(s,h)?s[h]=n.combine(s[h],y):s[h]=y}return s}(e,r):e,c=r.plainObjects?Object.create(null):{},u=Object.keys(l),d=0;d<u.length;++d){var p=u[d],h=s(p,l[p],r,"string"==typeof e);c=n.merge(c,h,r)}return!0===r.allowSparse?c:n.compact(c)}},8261:(e,t,r)=>{"use strict";var n=r(7478),i=r(2769),a=r(5798),o=Object.prototype.hasOwnProperty,s={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,t){return e+"["+t+"]"},repeat:function repeat(e){return e}},l=Array.isArray,c=Array.prototype.push,pushToArray=function(e,t){c.apply(e,l(t)?t:[t])},u=Date.prototype.toISOString,d=a.default,p={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:i.encode,encodeValuesOnly:!1,format:d,formatter:a.formatters[d],indices:!1,serializeDate:function serializeDate(e){return u.call(e)},skipNulls:!1,strictNullHandling:!1},h={},y=function stringify(e,t,r,a,o,s,c,u,d,y,g,m,v,b,w,C){for(var S=e,_=C,R=0,O=!1;void 0!==(_=_.get(h))&&!O;){var T=_.get(e);if(R+=1,void 0!==T){if(T===R)throw new RangeError("Cyclic object value");O=!0}void 0===_.get(h)&&(R=0)}if("function"==typeof u?S=u(t,S):S instanceof Date?S=g(S):"comma"===r&&l(S)&&(S=i.maybeMap(S,(function(e){return e instanceof Date?g(e):e}))),null===S){if(o)return c&&!b?c(t,p.encoder,w,"key",m):t;S=""}if(function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e}(S)||i.isBuffer(S))return c?[v(b?t:c(t,p.encoder,w,"key",m))+"="+v(c(S,p.encoder,w,"value",m))]:[v(t)+"="+v(String(S))];var I,E=[];if(void 0===S)return E;if("comma"===r&&l(S))b&&c&&(S=i.maybeMap(S,c)),I=[{value:S.length>0?S.join(",")||null:void 0}];else if(l(u))I=u;else{var D=Object.keys(S);I=d?D.sort(d):D}for(var P=a&&l(S)&&1===S.length?t+"[]":t,A=0;A<I.length;++A){var j=I[A],M="object"==typeof j&&void 0!==j.value?j.value:S[j];if(!s||null!==M){var x=l(S)?"function"==typeof r?r(P,j):P:P+(y?"."+j:"["+j+"]");C.set(e,R);var k=n();k.set(h,C),pushToArray(E,stringify(M,x,r,a,o,s,"comma"===r&&b&&l(S)?null:c,u,d,y,g,m,v,b,w,k))}}return E};e.exports=function(e,t){var r,i=e,c=function normalizeStringifyOptions(e){if(!e)return p;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||p.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=a.default;if(void 0!==e.format){if(!o.call(a.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=a.formatters[r],i=p.filter;return("function"==typeof e.filter||l(e.filter))&&(i=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:p.addQueryPrefix,allowDots:void 0===e.allowDots?p.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:p.charsetSentinel,delimiter:void 0===e.delimiter?p.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:p.encode,encoder:"function"==typeof e.encoder?e.encoder:p.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:p.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:p.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:p.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:p.strictNullHandling}}(t);"function"==typeof c.filter?i=(0,c.filter)("",i):l(c.filter)&&(r=c.filter);var u,d=[];if("object"!=typeof i||null===i)return"";u=t&&t.arrayFormat in s?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var h=s[u];if(t&&"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var g="comma"===h&&t&&t.commaRoundTrip;r||(r=Object.keys(i)),c.sort&&r.sort(c.sort);for(var m=n(),v=0;v<r.length;++v){var b=r[v];c.skipNulls&&null===i[b]||pushToArray(d,y(i[b],b,h,g,c.strictNullHandling,c.skipNulls,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,m))}var w=d.join(c.delimiter),C=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?C+="utf8=%26%2310003%3B&":C+="utf8=%E2%9C%93&"),w.length>0?C+w:""}},2769:(e,t,r)=>{"use strict";var n=r(5798),i=Object.prototype.hasOwnProperty,a=Array.isArray,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function arrayToObject(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:s,assign:function assignSingleSource(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function combine(e,t){return[].concat(e,t)},compact:function compact(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var i=t[n],o=i.obj[i.prop],s=Object.keys(o),l=0;l<s.length;++l){var c=s[l],u=o[c];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:o,prop:c}),r.push(u))}return function compactQueue(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(a(r)){for(var n=[],i=0;i<r.length;++i)void 0!==r[i]&&n.push(r[i]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function encode(e,t,r,i,a){if(0===e.length)return e;var s=e;if("symbol"==typeof e?s=Symbol.prototype.toString.call(e):"string"!=typeof e&&(s=String(e)),"iso-8859-1"===r)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var l="",c=0;c<s.length;++c){var u=s.charCodeAt(c);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||a===n.RFC1738&&(40===u||41===u)?l+=s.charAt(c):u<128?l+=o[u]:u<2048?l+=o[192|u>>6]+o[128|63&u]:u<55296||u>=57344?l+=o[224|u>>12]+o[128|u>>6&63]+o[128|63&u]:(c+=1,u=65536+((1023&u)<<10|1023&s.charCodeAt(c)),l+=o[240|u>>18]+o[128|u>>12&63]+o[128|u>>6&63]+o[128|63&u])}return l},isBuffer:function isBuffer(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function maybeMap(e,t){if(a(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function merge(e,t,r){if(!t)return e;if("object"!=typeof t){if(a(e))e.push(t);else{if(!e||"object"!=typeof e)return[e,t];(r&&(r.plainObjects||r.allowPrototypes)||!i.call(Object.prototype,t))&&(e[t]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(t);var n=e;return a(e)&&!a(t)&&(n=s(e,r)),a(e)&&a(t)?(t.forEach((function(t,n){if(i.call(e,n)){var a=e[n];a&&"object"==typeof a&&t&&"object"==typeof t?e[n]=merge(a,t,r):e.push(t)}else e[n]=t})),e):Object.keys(t).reduce((function(e,n){var a=t[n];return i.call(e,n)?e[n]=merge(e[n],a,r):e[n]=a,e}),n)}}},7771:(e,t,r)=>{"use strict";var n=r(210),i=r(2296),a=r(1044)(),o=r(7296),s=n("%TypeError%"),l=n("%Math.floor%");e.exports=function setFunctionLength(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||l(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,c=!0;if("length"in e&&o){var u=o(e,"length");u&&!u.configurable&&(n=!1),u&&!u.writable&&(c=!1)}return(n||c||!r)&&(a?i(e,"length",t,!0,!0):i(e,"length",t)),e}},7478:(e,t,r)=>{"use strict";var n=r(210),i=r(1924),a=r(631),o=n("%TypeError%"),s=n("%WeakMap%",!0),l=n("%Map%",!0),c=i("WeakMap.prototype.get",!0),u=i("WeakMap.prototype.set",!0),d=i("WeakMap.prototype.has",!0),p=i("Map.prototype.get",!0),h=i("Map.prototype.set",!0),y=i("Map.prototype.has",!0),listGetNode=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function getSideChannel(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new o("Side channel does not contain "+a(e))},get:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(e)return c(e,n)}else if(l){if(t)return p(t,n)}else if(r)return function(e,t){var r=listGetNode(e,t);return r&&r.value}(r,n)},has:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(e)return d(e,n)}else if(l){if(t)return y(t,n)}else if(r)return function(e,t){return!!listGetNode(e,t)}(r,n);return!1},set:function(n,i){s&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new s),u(e,n,i)):l?(t||(t=new l),h(t,n,i)):(r||(r={key:{},next:null}),function(e,t,r){var n=listGetNode(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,i))}};return n}},4714:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nameof=void 0;var n=r(6898);Object.defineProperty(t,"nameof",{enumerable:!0,get:function(){return n.nameof}})},6898:(e,t)=>{"use strict";function cleanseAssertionOperators(e){return e.replace(/[?!]/g,"")}Object.defineProperty(t,"__esModule",{value:!0}),t.nameof=void 0,t.nameof=function nameof(e,t){var r=e.toString();if(r.startsWith("class ")&&!r.startsWith("class =>"))return cleanseAssertionOperators(r.substring(6,r.indexOf(" {")));if(r.includes("=>"))return cleanseAssertionOperators(r.substring(r.indexOf(".")+1));var n=r.match(/function\s*\(\w+\)\s*\{[\r\n\s]*return\s+\w+\.((\w+\.)*(\w+))/i);if(n)return t&&t.lastProp?n[3]:n[1];if(r.startsWith("function "))return cleanseAssertionOperators(r.substring(9,r.indexOf("(")));throw new Error("ts-simple-nameof: Invalid function.")}},6379:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LOG4TS_LOG_CONTROL:()=>LOG4TS_LOG_CONTROL,Log4TSProvider:()=>d});class EnhancedMap extends Map{computeIfAbsent(e,t){if(this.has(e))return this.get(e);const r=t(e);return this.set(e,r),r}computeIfPresent(e,t){const r=this.get(e);if(void 0===r)return;const n=t(e,r);return void 0!==n?this.set(e,n):this.delete(e),n}compute(e,t){const r=t(e,this.get(e));return r?this.set(e,r):this.delete(e),r}}var n;function getInternalLogger(e){return a.getLogger(e)}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error"}(n||(n={}));const i={setInternalLogLevel:e=>a.changeLogLevel(e),setOutput:e=>a.changeOutput(e),reset:()=>a.reset()};class InternalLoggerImpl{constructor(e,t,r){this._name=e,this._level=t,this._fnOutput=r}trace(e){this.log(n.Trace,e)}debug(e){this.log(n.Debug,e)}error(e,t){this.log(n.Error,e,t)}info(e){this.log(n.Info,e)}warn(e,t){this.log(n.Warn,e,t)}setLevel(e){this._level=e}setOutput(e){this._fnOutput=e}log(e,t,r){this._level>e||this._fnOutput(`${n[this._level].toString()} <INTERNAL LOGGER> ${this._name} ${t()}${r?"\n"+r.stack:""}`)}}class InternalProviderImpl{constructor(){this._loggers=new EnhancedMap,this._logLevel=n.Error,this._fnOutput=InternalProviderImpl.logConsole}getLogger(e){return this._loggers.computeIfAbsent(e,(e=>new InternalLoggerImpl(e,this._logLevel,this._fnOutput)))}changeLogLevel(e){this._logLevel=e,this._loggers.forEach((t=>t.setLevel(e)))}changeOutput(e){this._fnOutput=e,this._loggers.forEach((e=>e.setOutput(this._fnOutput)))}reset(){this.changeLogLevel(n.Error),this._fnOutput=InternalProviderImpl.logConsole,this._loggers.forEach((e=>e.setOutput(this._fnOutput)))}static logConsole(e){console&&console.log&&console.log(e)}}const a=new InternalProviderImpl;var o,s,l=Object.freeze({__proto__:null,INTERNAL_LOGGING_SETTINGS:i,get InternalLogLevel(){return n},getInternalLogger});!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error",e[e.Fatal=5]="Fatal",e[e.Off=6]="Off"}(o||(o={})),function(e){e.toLogLevel=function toLogLevel(t){switch(t.toLowerCase()){case"trace":return e.Trace;case"debug":return e.Debug;case"info":return e.Info;case"warn":return e.Warn;case"error":return e.Error;case"fatal":return e.Fatal;case"off":return e.Off;default:return}}}(o||(o={}));class CoreLoggerImpl{constructor(e){this._runtime=e}get id(){return this._runtime.id}get logLevel(){return this._runtime.level}get runtimeSettings(){return Object.assign({},this._runtime)}set runtimeSettings(e){this._runtime=e}trace(e,...t){this.logMessage(o.Trace,e,t)}debug(e,...t){this.logMessage(o.Debug,e,t)}info(e,...t){this.logMessage(o.Info,e,t)}warn(e,...t){this.logMessage(o.Warn,e,t)}error(e,...t){this.logMessage(o.Error,e,t)}fatal(e,...t){this.logMessage(o.Fatal,e,t)}logMessage(e,t,r){if(this._runtime.level>e)return;const n=Date.now(),i="string"==typeof t?t:t(),a=CoreLoggerImpl.getErrorAndArgs(r);switch(this._runtime.channel.type){case"RawLogChannel":return void this._runtime.channel.write({message:i,exception:a.error,args:a.args,timeInMillis:n,level:e,logNames:this._runtime.name},this._runtime.argumentFormatter);case"LogChannel":this._runtime.channel.write(this.createLogMessage(i,e,a,n))}}formatArgValue(e){try{return this._runtime.argumentFormatter(e)}catch(t){return`>>ARG CONVERT FAILED: '${void 0!==e?e.toString():"undefined"}'<<`}}createLogMessage(e,t,r,n){let i;const a=r.error,s=r.args;a&&(i=`${a.name}: ${a.message}`,a.stack&&(i+=`@\n${a.stack}`));const l=this._runtime.dateFormatter(n);let c=o[t].toUpperCase();c.length<5&&(c+=" ");return{message:l+" "+c+" ["+("string"==typeof this._runtime.name?this._runtime.name:this._runtime.name.join(", "))+"] "+e+(void 0!==s&&s.length>0?" ["+s.map((e=>this.formatArgValue(e))).join(", ")+"]":""),error:i}}static getErrorAndArgs(e){if(0===e.length)return{};let t,r;const n=e[0];if(n instanceof Error)return t=n,r=e.length>1?e.slice(1):void 0,{error:t,args:r};if("function"==typeof n){const i=n();return i instanceof Error?(t=i,r=e.length>1?e.slice(1):void 0,{error:t,args:r}):1===e.length?Array.isArray(i)?{args:i.length>0?i:void 0}:{args:i}:Array.isArray(i)?{args:[...i,...e.slice(1)]}:{args:[i,...e.slice(1)]}}return{args:e}}}function padStart(e,t,r=" "){return padInternal(e,t,"start",r)}function padInternal(e,t,r,n=" "){if(t<=e.length)return e;if(n.length>1)throw new Error(`Fill char must be one char exactly, it is: ${n.length}`);const i=t-e.length;let a="";for(let e=0;e<i;e++)a+=n;return"start"===r?a+e:e+a}function formatArgument(e){return void 0===e?"undefined":JSON.stringify(e)}function formatDate(e){const t=new Date(e);return`${t.getFullYear()}-${padStart((t.getMonth()+1).toString(),2,"0")}-${padStart(t.getDate().toString(),2,"0")} ${padStart(t.getHours().toString(),2,"0")}:${padStart(t.getMinutes().toString(),2,"0")}:${padStart(t.getSeconds().toString(),2,"0")},${padStart(t.getMilliseconds().toString(),2,"0")}`}class ConsoleLogChannel{constructor(){this.type="LogChannel"}write(e){console&&console.log&&console.log(e.message+(e.error?`\n${e.error}`:""))}}!function(e){e.createConsoleChannel=function createConsoleChannel(){return new ConsoleLogChannel}}(s||(s={}));class LogProviderImpl{constructor(e,t){this._log=getInternalLogger("core.impl.LogProviderImpl"),this._name=e,this._settings=t,this._loggers=new EnhancedMap,this._idToKeyMap=new EnhancedMap,this._globalRuntimeSettings={level:t.level,channel:t.channel},this._nextLoggerId=1,this._log.trace((()=>`Created LogProviderImpl with settings: ${JSON.stringify(this._settings)}`))}get runtimeSettings(){return Object.assign(Object.assign({},this._settings),{level:this._globalRuntimeSettings.level,channel:this._globalRuntimeSettings.channel})}getLogger(e){return this.getOrCreateLogger(e)}updateLoggerRuntime(e,t){this._log.debug((()=>`Updating logger ${e.id} runtime settings using: '${JSON.stringify(t)}'`));const r=this._idToKeyMap.get(e.id);return void 0===r?(this._log.warn((()=>`Cannot update logger with id: ${e.id}, it was not found.`)),!1):(this._loggers.computeIfPresent(r,((e,r)=>(r.runtimeSettings=LogProviderImpl.mergeRuntimeSettingsIntoLogRuntime(r.runtimeSettings,t),r))),!0)}updateRuntimeSettings(e){this._log.debug((()=>`Updating global runtime settings and updating existing loggers runtime settings using: '${JSON.stringify(e)}'`)),this._globalRuntimeSettings={level:void 0!==e.level?e.level:this._globalRuntimeSettings.level,channel:void 0!==e.channel?e.channel:this._globalRuntimeSettings.channel},this._loggers.forEach((t=>t.runtimeSettings=LogProviderImpl.mergeRuntimeSettingsIntoLogRuntime(t.runtimeSettings,e)))}clear(){this._loggers.clear(),this._idToKeyMap.clear(),this._globalRuntimeSettings=Object.assign({},this._settings),this._nextLoggerId=1}getOrCreateLogger(e){const t=LogProviderImpl.createKey(e),r=this._loggers.computeIfAbsent(t,(()=>{const t={level:this._globalRuntimeSettings.level,channel:this._globalRuntimeSettings.channel,id:this.nextLoggerId(),name:e,argumentFormatter:this._settings.argumentFormatter,dateFormatter:this._settings.dateFormatter};return new CoreLoggerImpl(t)}));return this._idToKeyMap.computeIfAbsent(r.id,(()=>t)),r}nextLoggerId(){const e=this._name+"_"+this._nextLoggerId;return this._nextLoggerId++,e}static mergeRuntimeSettingsIntoLogRuntime(e,t){return Object.assign(Object.assign({},e),{level:void 0!==t.level?t.level:e.level,channel:void 0!==t.channel?t.channel:e.channel})}static createKey(e){return"string"==typeof e?e:e.join(",")}}function createLogProvider(e,t){return new LogProviderImpl(e,t)}var c=Object.freeze({__proto__:null,EnhancedMap,maxLengthStringValueInArray:function maxLengthStringValueInArray(e){return e.map((e=>e.length)).reduce(((e,t)=>t>e?t:e),0)},padEnd:function padEnd(e,t,r=" "){return padInternal(e,t,"end",r)},padStart});function log4TSGroupConfigDebug(e){return`Log4TSGroupConfig=level: ${o[e.level].toString()}, expression: ${e.expression.toString()}, (omitted functions/channel)`}class Log4TSProviderImpl{constructor(e,t,r){this._log=l.getInternalLogger("log4ts.impl.Log4TSProviderImpl"),this._name=e,this._defaultConfig=[Object.assign(Object.assign({},t),{identifier:t.identifier}),createLogProvider("log4ts_"+e+"_"+t.identifier,t)],this._logProviders=new Map(r.map((t=>{const r=Object.assign({},t),n=createLogProvider("log4ts_"+e+"_"+t.identifier,t);return[t.identifier,{groupConfig:r,provider:n}]}))),this._log.trace((()=>{const e=[...this._logProviders.values()].map((e=>log4TSGroupConfigDebug(e.groupConfig))).join(", ");return`Creating Log4TSProviderImpl '${this._name}', defaultConfig: ${log4TSGroupConfigDebug(this._defaultConfig[0])}, groupConfigs: ${e}`}))}get name(){return this._name}get config(){return Object.assign({},this._defaultConfig[0])}get groupConfigs(){return[...this._logProviders.values()].map((e=>Object.assign({},e.groupConfig)))}getLogger(e){for(const t of this._logProviders.values())if(t.groupConfig.expression.test(e))return t.provider.getLogger(e);return this._defaultConfig[1].getLogger(e)}updateRuntimeSettingsGroup(e,t){const r=this._logProviders.get(e);if(void 0===r)throw new Error(`Cannot update group with identifier '${e}', it does not exist.`);this._log.debug((()=>`Will update ${log4TSGroupConfigDebug(r.groupConfig)}, associated LogProvider '${r.provider}' - applying runtime change: ${JSON.stringify(t)}.`)),Log4TSProviderImpl.updateLog4TGroupConfig(r.groupConfig,r.provider,t)}updateRuntimeSettings(e){this._log.debug((()=>`Will update settings for all groups and existing loggers - will apply runtime change: ${JSON.stringify(e)}.`)),this._logProviders.forEach((t=>{const r=t.groupConfig,n=t.provider;this._log.debug((()=>`Will update ${log4TSGroupConfigDebug(r)}, associated LogProvider '${n}' - applying runtime change: ${JSON.stringify(e)}.`)),Log4TSProviderImpl.updateLog4TGroupConfig(r,n,e)}))}static updateLog4TGroupConfig(e,t,r){r.level&&(e.level=r.level),r.channel&&(e.channel=r.channel),t.updateRuntimeSettings(r)}}class Log4TSControlProviderImpl{constructor(e,t){this._provider=e,this._messageChannel=t,this._originalLogLevels=Log4TSControlProviderImpl.loadCurrentGroupLogLevels(e)}get name(){return this._provider.name}showSettings(){let e=`Available group configs (Log4TSProvider '${this._provider.name}'):\n`;const t=this._provider.groupConfigs.map((e=>({level:o[e.level],channelDescription:e.channel.toString?e.channel.toString():JSON.stringify(e.channel),identifier:e.identifier}))),r=t.length.toString().length,n=c.maxLengthStringValueInArray(t.map((e=>e.identifier)));e+=t.map(((e,t)=>` [${c.padStart(t.toString(),r)}, ${c.padEnd(e.identifier,n)} (level=${c.padEnd(e.level,5)})]`)).join("\n")+"\n",this._messageChannel(e)}update(e,t){const r=o.toLogLevel(e);if(void 0===r)throw new Error(`Cannot update log provider, log level '${e}' is invalid.`);const n={level:r};if(void 0===t)return this._provider.updateRuntimeSettings(n),void this._messageChannel("Updated all group configs successfully.");if("number"==typeof t){const e=this._provider.groupConfigs;if(t<0||t>=e.length)throw new Error(`Group config with index '${t}' does not exist (outside of range).`);const r=e[t];return this._provider.updateRuntimeSettingsGroup(r.identifier,n),void this._messageChannel(`Updated group config with index '${t}' successfully.`)}this._provider.updateRuntimeSettingsGroup(t,n),this._messageChannel(`Updated group config with id '${t}' successfully.`)}reset(){this._originalLogLevels.forEach(((e,t)=>{this._provider.updateRuntimeSettingsGroup(t,{level:e})})),this._messageChannel("Successfully reset log levels back to original state (from when this Log4TSControlProvider was created).")}save(){if(!localStorage)return void this._messageChannel("Cannot save state, localStorage is not available.");const e={name:this._provider.name,groups:this._provider.groupConfigs.map((e=>({identifier:e.identifier,level:o[e.level]})))};localStorage.setItem(this.createKey(),JSON.stringify(e)),this._messageChannel(`Successfully saved state for Log4TSControlProvider '${this._provider.name}'.`)}restore(e){const t=void 0===e||e;if(!localStorage)return void(t&&this._messageChannel(`Will not attempt to restore state for Log4TSControlProvider '${this._provider.name}', localStorage is not available.`));const r=this.createKey(),n=localStorage.getItem(r);if(null!==n)try{const e=JSON.parse(n);if(this._provider.name!==e.name)return void(t&&this._messageChannel(`Cannot restore state for Log4TSControlProvider '${this._provider.name}', data is not for provider - found name '${e.name}'.`));this.restoreGroups(e,t),this._originalLogLevels=Log4TSControlProviderImpl.loadCurrentGroupLogLevels(this._provider)}catch(e){localStorage.removeItem(r),this._messageChannel(`Cannot restore state for Log4TSControlProvider '${this._provider.name}', data is not valid. Invalid data removed from localStorage.`)}else t&&this._messageChannel(`Cannot restore state for Log4TSControlProvider '${this._provider.name}', no data available.`)}help(){const e=`You can use the following commands (Log4TSProvider ${this._provider.name}):\n showSettings()\n Shows the current configuration settings.\n update(logLevel: Log4TSControlProviderLogLevel, groupId?: number | string)\n Change the log level for one or all config groups.\n @param level The log level to set - must be one of 'trace', 'debug', 'info', 'warn', 'error' or 'fatal'\n @param groupId Optional group config to update by either index or identifier, when omitted updates all groups.\n Use showSettings() to find details about index and/or identifier.\n reset()\n Resets the log levels of the config groups back to when this control provider was created.\n save()\n Saves the current log levels for all config groups of this provider. Use restore() to load last saved state.\n restore()\n Restore stored saved state, if any. Log levels will be set according to saved state.\n help()\n Shows this help.\n`;this._messageChannel(e)}restoreGroups(e,t){e.groups.forEach((e=>{try{const r=o.toLogLevel(e.level);void 0!==r?(this._provider.updateRuntimeSettingsGroup(e.identifier,{level:r}),this._messageChannel(`Log4TSControlProvider '${this._provider.name}' - restored log level of group '${e.identifier}' to '${o[r]}'.`)):t&&this._messageChannel(`Log4TSControlProvider '${this._provider.name}' - failed to restore log level of group '${e.identifier}', invalid log level was specified.`)}catch(r){t&&this._messageChannel(`Log4TSControlProvider '${this._provider.name}' - failed to restore log level of group '${e.identifier}'.`)}}))}createKey(){return`Log4TSProvider-${this._provider.name}`}static loadCurrentGroupLogLevels(e){return new Map(e.groupConfigs.map((e=>[e.identifier,e.level])))}}class Log4TSProviderService{constructor(){this._log=l.getInternalLogger("log4ts.impl.Log4TSProviderService"),this._providers=new c.EnhancedMap}createLogProvider(e,t){const r=this._providers.compute(e,((r,n)=>{if(n)throw new Error(`Log4TSProvider with name '${e}' already exists, cannot create another.`);const i=function mergeLog4TSConfigs(e,t){const r={argumentFormatter:t.argumentFormatter?t.argumentFormatter:e.argumentFormatter,channel:t.channel?t.channel:e.channel,dateFormatter:t.dateFormatter?t.dateFormatter:e.dateFormatter,groups:[],level:void 0!==t.level?t.level:e.level};return r.groups=t.groups.map((e=>function mergeLog4TSGroupConfigs(e,t){return{argumentFormatter:t.argumentFormatter?t.argumentFormatter:e.argumentFormatter,channel:e.channel,dateFormatter:t.dateFormatter?t.dateFormatter:e.dateFormatter,expression:t.expression,level:void 0!==t.level?t.level:e.level,identifier:t.identifier?t.identifier:t.expression.toString()}}(r,e))),r}(function createDefaultLog4TSConfig(){return{argumentFormatter:formatArgument,channel:s.createConsoleChannel(),dateFormatter:formatDate,groups:[],level:o.Error}}(),t);!function validateLog4TSConfig(e){if(0===e.groups.length)throw new Error("Invalid configuration, 'groups' on configuration is empty, at least 1 group config must be specified.")}(i),this._log.debug((()=>`Creating new Log4TSProvider with name '${e}', using main config settings '${function log4TSConfigDebug(e){const t=e.groups.map((e=>log4TSGroupConfigDebug(e))).join(", ");return`Log4TSGroupConfig=level: ${o[e.level].toString()}, groups: ${t}, (omitted functions/channel)`}(i)}'.`));const a=new RegExp(".+"),l={channel:i.channel,level:i.level,expression:a,dateFormatter:i.dateFormatter,argumentFormatter:i.argumentFormatter,identifier:a.toString()};return new Log4TSProviderImpl(r,l,i.groups)}));return r}clear(){this._providers.clear()}getLog4TSControl(e){const t=e||(e=>{if(!console||!console.log)throw new Error("Cannot use console (it is not present), please specify a custom function to write to.");console.log(e)});return{help:()=>t(Log4TSProviderService.help()),showSettings:()=>t(this.showSettings()),getProvider:e=>this.getLog4TSControlProviderByIdOrName(e,t)}}showSettings(){let e="Available Log4TSProviders:\n";const t=this._providers.size.toString().length,r=c.maxLengthStringValueInArray([...this._providers.keys()]),n=[...this._providers.entries()].map(((e,n)=>{const i=e[0];return` [${c.padStart(n.toString(),t)}, ${c.padEnd(i,r)}]`}));return e+=n.join("\n")+(n.length>0?"\n":""),e}getLog4TSControlProviderByIdOrName(e,t){if("string"==typeof e){const r=this._providers.get(e);if(void 0===r)throw new Error(`Provider with name '${e}' does not exist.`);return new Log4TSControlProviderImpl(r,t)}const r=[...this._providers.values()];if(e<0||e>=r.length)throw new Error(`Provider with index '${e}' does not exist (outside of range).`);return new Log4TSControlProviderImpl(r[e],t)}static help(){return"You can use the following commands:\n showSettings()\n Shows the current configuration settings.\n getProvider: (id: number | string): Log4TSControlProvider\n Get access to a Log4TSControlProvider to change log levels.\n @param id The id (use showSettings to see) or name of the provider\n help()\n Shows this help.\n"}}const u=new Log4TSProviderService,LOG4TS_LOG_CONTROL=e=>u.getLog4TSControl(e);var d;!function(e){e.createProvider=function createProvider(e,t){return u.createLogProvider(e,t)},e.clear=function clear(){u.clear()}}(d||(d={}))},9959:(e,t,r)=>{"use strict";r.r(t),r.d(t,{$internal:()=>l,$test:()=>u,DefaultChannels:()=>s,LogLevel:()=>o,createLogProvider:()=>createLogProvider,formatArgument:()=>formatArgument,formatDate:()=>formatDate,util:()=>c});class EnhancedMap extends Map{computeIfAbsent(e,t){if(this.has(e))return this.get(e);const r=t(e);return this.set(e,r),r}computeIfPresent(e,t){const r=this.get(e);if(void 0===r)return;const n=t(e,r);return void 0!==n?this.set(e,n):this.delete(e),n}compute(e,t){const r=t(e,this.get(e));return r?this.set(e,r):this.delete(e),r}}var n;function getInternalLogger(e){return a.getLogger(e)}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error"}(n||(n={}));const i={setInternalLogLevel:e=>a.changeLogLevel(e),setOutput:e=>a.changeOutput(e),reset:()=>a.reset()};class InternalLoggerImpl{constructor(e,t,r){this._name=e,this._level=t,this._fnOutput=r}trace(e){this.log(n.Trace,e)}debug(e){this.log(n.Debug,e)}error(e,t){this.log(n.Error,e,t)}info(e){this.log(n.Info,e)}warn(e,t){this.log(n.Warn,e,t)}setLevel(e){this._level=e}setOutput(e){this._fnOutput=e}log(e,t,r){this._level>e||this._fnOutput(`${n[this._level].toString()} <INTERNAL LOGGER> ${this._name} ${t()}${r?"\n"+r.stack:""}`)}}class InternalProviderImpl{constructor(){this._loggers=new EnhancedMap,this._logLevel=n.Error,this._fnOutput=InternalProviderImpl.logConsole}getLogger(e){return this._loggers.computeIfAbsent(e,(e=>new InternalLoggerImpl(e,this._logLevel,this._fnOutput)))}changeLogLevel(e){this._logLevel=e,this._loggers.forEach((t=>t.setLevel(e)))}changeOutput(e){this._fnOutput=e,this._loggers.forEach((e=>e.setOutput(this._fnOutput)))}reset(){this.changeLogLevel(n.Error),this._fnOutput=InternalProviderImpl.logConsole,this._loggers.forEach((e=>e.setOutput(this._fnOutput)))}static logConsole(e){console&&console.log&&console.log(e)}}const a=new InternalProviderImpl;var o,s,l=Object.freeze({__proto__:null,INTERNAL_LOGGING_SETTINGS:i,get InternalLogLevel(){return n},getInternalLogger});!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error",e[e.Fatal=5]="Fatal",e[e.Off=6]="Off"}(o||(o={})),function(e){e.toLogLevel=function toLogLevel(t){switch(t.toLowerCase()){case"trace":return e.Trace;case"debug":return e.Debug;case"info":return e.Info;case"warn":return e.Warn;case"error":return e.Error;case"fatal":return e.Fatal;case"off":return e.Off;default:return}}}(o||(o={}));class CoreLoggerImpl{constructor(e){this._runtime=e}get id(){return this._runtime.id}get logLevel(){return this._runtime.level}get runtimeSettings(){return Object.assign({},this._runtime)}set runtimeSettings(e){this._runtime=e}trace(e,...t){this.logMessage(o.Trace,e,t)}debug(e,...t){this.logMessage(o.Debug,e,t)}info(e,...t){this.logMessage(o.Info,e,t)}warn(e,...t){this.logMessage(o.Warn,e,t)}error(e,...t){this.logMessage(o.Error,e,t)}fatal(e,...t){this.logMessage(o.Fatal,e,t)}logMessage(e,t,r){if(this._runtime.level>e)return;const n=Date.now(),i="string"==typeof t?t:t(),a=CoreLoggerImpl.getErrorAndArgs(r);switch(this._runtime.channel.type){case"RawLogChannel":return void this._runtime.channel.write({message:i,exception:a.error,args:a.args,timeInMillis:n,level:e,logNames:this._runtime.name},this._runtime.argumentFormatter);case"LogChannel":this._runtime.channel.write(this.createLogMessage(i,e,a,n))}}formatArgValue(e){try{return this._runtime.argumentFormatter(e)}catch(t){return`>>ARG CONVERT FAILED: '${void 0!==e?e.toString():"undefined"}'<<`}}createLogMessage(e,t,r,n){let i;const a=r.error,s=r.args;a&&(i=`${a.name}: ${a.message}`,a.stack&&(i+=`@\n${a.stack}`));const l=this._runtime.dateFormatter(n);let c=o[t].toUpperCase();c.length<5&&(c+=" ");return{message:l+" "+c+" ["+("string"==typeof this._runtime.name?this._runtime.name:this._runtime.name.join(", "))+"] "+e+(void 0!==s&&s.length>0?" ["+s.map((e=>this.formatArgValue(e))).join(", ")+"]":""),error:i}}static getErrorAndArgs(e){if(0===e.length)return{};let t,r;const n=e[0];if(n instanceof Error)return t=n,r=e.length>1?e.slice(1):void 0,{error:t,args:r};if("function"==typeof n){const i=n();return i instanceof Error?(t=i,r=e.length>1?e.slice(1):void 0,{error:t,args:r}):1===e.length?Array.isArray(i)?{args:i.length>0?i:void 0}:{args:i}:Array.isArray(i)?{args:[...i,...e.slice(1)]}:{args:[i,...e.slice(1)]}}return{args:e}}}function padStart(e,t,r=" "){return padInternal(e,t,"start",r)}function padInternal(e,t,r,n=" "){if(t<=e.length)return e;if(n.length>1)throw new Error(`Fill char must be one char exactly, it is: ${n.length}`);const i=t-e.length;let a="";for(let e=0;e<i;e++)a+=n;return"start"===r?a+e:e+a}function formatArgument(e){return void 0===e?"undefined":JSON.stringify(e)}function formatDate(e){const t=new Date(e);return`${t.getFullYear()}-${padStart((t.getMonth()+1).toString(),2,"0")}-${padStart(t.getDate().toString(),2,"0")} ${padStart(t.getHours().toString(),2,"0")}:${padStart(t.getMinutes().toString(),2,"0")}:${padStart(t.getSeconds().toString(),2,"0")},${padStart(t.getMilliseconds().toString(),2,"0")}`}class ConsoleLogChannel{constructor(){this.type="LogChannel"}write(e){console&&console.log&&console.log(e.message+(e.error?`\n${e.error}`:""))}}!function(e){e.createConsoleChannel=function createConsoleChannel(){return new ConsoleLogChannel}}(s||(s={}));class LogProviderImpl{constructor(e,t){this._log=getInternalLogger("core.impl.LogProviderImpl"),this._name=e,this._settings=t,this._loggers=new EnhancedMap,this._idToKeyMap=new EnhancedMap,this._globalRuntimeSettings={level:t.level,channel:t.channel},this._nextLoggerId=1,this._log.trace((()=>`Created LogProviderImpl with settings: ${JSON.stringify(this._settings)}`))}get runtimeSettings(){return Object.assign(Object.assign({},this._settings),{level:this._globalRuntimeSettings.level,channel:this._globalRuntimeSettings.channel})}getLogger(e){return this.getOrCreateLogger(e)}updateLoggerRuntime(e,t){this._log.debug((()=>`Updating logger ${e.id} runtime settings using: '${JSON.stringify(t)}'`));const r=this._idToKeyMap.get(e.id);return void 0===r?(this._log.warn((()=>`Cannot update logger with id: ${e.id}, it was not found.`)),!1):(this._loggers.computeIfPresent(r,((e,r)=>(r.runtimeSettings=LogProviderImpl.mergeRuntimeSettingsIntoLogRuntime(r.runtimeSettings,t),r))),!0)}updateRuntimeSettings(e){this._log.debug((()=>`Updating global runtime settings and updating existing loggers runtime settings using: '${JSON.stringify(e)}'`)),this._globalRuntimeSettings={level:void 0!==e.level?e.level:this._globalRuntimeSettings.level,channel:void 0!==e.channel?e.channel:this._globalRuntimeSettings.channel},this._loggers.forEach((t=>t.runtimeSettings=LogProviderImpl.mergeRuntimeSettingsIntoLogRuntime(t.runtimeSettings,e)))}clear(){this._loggers.clear(),this._idToKeyMap.clear(),this._globalRuntimeSettings=Object.assign({},this._settings),this._nextLoggerId=1}getOrCreateLogger(e){const t=LogProviderImpl.createKey(e),r=this._loggers.computeIfAbsent(t,(()=>{const t={level:this._globalRuntimeSettings.level,channel:this._globalRuntimeSettings.channel,id:this.nextLoggerId(),name:e,argumentFormatter:this._settings.argumentFormatter,dateFormatter:this._settings.dateFormatter};return new CoreLoggerImpl(t)}));return this._idToKeyMap.computeIfAbsent(r.id,(()=>t)),r}nextLoggerId(){const e=this._name+"_"+this._nextLoggerId;return this._nextLoggerId++,e}static mergeRuntimeSettingsIntoLogRuntime(e,t){return Object.assign(Object.assign({},e),{level:void 0!==t.level?t.level:e.level,channel:void 0!==t.channel?t.channel:e.channel})}static createKey(e){return"string"==typeof e?e:e.join(",")}}function createLogProvider(e,t){return new LogProviderImpl(e,t)}var c=Object.freeze({__proto__:null,EnhancedMap,maxLengthStringValueInArray:function maxLengthStringValueInArray(e){return e.map((e=>e.length)).reduce(((e,t)=>t>e?t:e),0)},padEnd:function padEnd(e,t,r=" "){return padInternal(e,t,"end",r)},padStart});var u=Object.freeze({__proto__:null,ArrayLogChannel:class ArrayLogChannel{constructor(){this._buffer=[],this.type="LogChannel"}write(e){this._buffer.push(e)}get logMessages(){return this._buffer}get messages(){return this._buffer.map((e=>e.message))}},ArrayRawLogChannel:class ArrayRawLogChannel{constructor(){this._buffer=[],this.type="RawLogChannel"}write(e,t){this._buffer.push(e)}get messages(){return this._buffer.map((e=>e.message))}get errors(){return this._buffer.map((e=>e.exception))}get size(){return this._buffer.length}get rawMessages(){return this._buffer}clear(){this._buffer=[]}},TestControlMessage:class TestControlMessage{constructor(){this._messages=[],this.write=this.write.bind(this)}get messages(){return this._messages}write(e){this._messages.push(e)}clear(){this._messages=[]}}})},7429:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NIL",{enumerable:!0,get:function get(){return s.default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function get(){return d.default}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function get(){return u.default}}),Object.defineProperty(t,"v1",{enumerable:!0,get:function get(){return n.default}}),Object.defineProperty(t,"v3",{enumerable:!0,get:function get(){return i.default}}),Object.defineProperty(t,"v4",{enumerable:!0,get:function get(){return a.default}}),Object.defineProperty(t,"v5",{enumerable:!0,get:function get(){return o.default}}),Object.defineProperty(t,"validate",{enumerable:!0,get:function get(){return c.default}}),Object.defineProperty(t,"version",{enumerable:!0,get:function get(){return l.default}});var n=_interopRequireDefault(r(3990)),i=_interopRequireDefault(r(8237)),a=_interopRequireDefault(r(5355)),o=_interopRequireDefault(r(3764)),s=_interopRequireDefault(r(6314)),l=_interopRequireDefault(r(8464)),c=_interopRequireDefault(r(6435)),u=_interopRequireDefault(r(4008)),d=_interopRequireDefault(r(8222));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},4163:(e,t)=>{"use strict";function getOutputLength(e){return 14+(e+64>>>9<<4)+1}function safeAdd(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function md5cmn(e,t,r,n,i,a){return safeAdd(function bitRotateLeft(e,t){return e<<t|e>>>32-t}(safeAdd(safeAdd(t,e),safeAdd(n,a)),i),r)}function md5ff(e,t,r,n,i,a,o){return md5cmn(t&r|~t&n,e,t,i,a,o)}function md5gg(e,t,r,n,i,a,o){return md5cmn(t&n|r&~n,e,t,i,a,o)}function md5hh(e,t,r,n,i,a,o){return md5cmn(t^r^n,e,t,i,a,o)}function md5ii(e,t,r,n,i,a,o){return md5cmn(r^(t|~n),e,t,i,a,o)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function md5(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function md5ToHexEncodedArray(e){const t=[],r=32*e.length,n="0123456789abcdef";for(let i=0;i<r;i+=8){const r=e[i>>5]>>>i%32&255,a=parseInt(n.charAt(r>>>4&15)+n.charAt(15&r),16);t.push(a)}return t}(function wordsToMd5(e,t){e[t>>5]|=128<<t%32,e[getOutputLength(t)-1]=t;let r=1732584193,n=-271733879,i=-1732584194,a=271733878;for(let t=0;t<e.length;t+=16){const o=r,s=n,l=i,c=a;r=md5ff(r,n,i,a,e[t],7,-680876936),a=md5ff(a,r,n,i,e[t+1],12,-389564586),i=md5ff(i,a,r,n,e[t+2],17,606105819),n=md5ff(n,i,a,r,e[t+3],22,-1044525330),r=md5ff(r,n,i,a,e[t+4],7,-176418897),a=md5ff(a,r,n,i,e[t+5],12,1200080426),i=md5ff(i,a,r,n,e[t+6],17,-1473231341),n=md5ff(n,i,a,r,e[t+7],22,-45705983),r=md5ff(r,n,i,a,e[t+8],7,1770035416),a=md5ff(a,r,n,i,e[t+9],12,-1958414417),i=md5ff(i,a,r,n,e[t+10],17,-42063),n=md5ff(n,i,a,r,e[t+11],22,-1990404162),r=md5ff(r,n,i,a,e[t+12],7,1804603682),a=md5ff(a,r,n,i,e[t+13],12,-40341101),i=md5ff(i,a,r,n,e[t+14],17,-1502002290),n=md5ff(n,i,a,r,e[t+15],22,1236535329),r=md5gg(r,n,i,a,e[t+1],5,-165796510),a=md5gg(a,r,n,i,e[t+6],9,-1069501632),i=md5gg(i,a,r,n,e[t+11],14,643717713),n=md5gg(n,i,a,r,e[t],20,-373897302),r=md5gg(r,n,i,a,e[t+5],5,-701558691),a=md5gg(a,r,n,i,e[t+10],9,38016083),i=md5gg(i,a,r,n,e[t+15],14,-660478335),n=md5gg(n,i,a,r,e[t+4],20,-405537848),r=md5gg(r,n,i,a,e[t+9],5,568446438),a=md5gg(a,r,n,i,e[t+14],9,-1019803690),i=md5gg(i,a,r,n,e[t+3],14,-187363961),n=md5gg(n,i,a,r,e[t+8],20,1163531501),r=md5gg(r,n,i,a,e[t+13],5,-1444681467),a=md5gg(a,r,n,i,e[t+2],9,-51403784),i=md5gg(i,a,r,n,e[t+7],14,1735328473),n=md5gg(n,i,a,r,e[t+12],20,-1926607734),r=md5hh(r,n,i,a,e[t+5],4,-378558),a=md5hh(a,r,n,i,e[t+8],11,-2022574463),i=md5hh(i,a,r,n,e[t+11],16,1839030562),n=md5hh(n,i,a,r,e[t+14],23,-35309556),r=md5hh(r,n,i,a,e[t+1],4,-1530992060),a=md5hh(a,r,n,i,e[t+4],11,1272893353),i=md5hh(i,a,r,n,e[t+7],16,-155497632),n=md5hh(n,i,a,r,e[t+10],23,-1094730640),r=md5hh(r,n,i,a,e[t+13],4,681279174),a=md5hh(a,r,n,i,e[t],11,-358537222),i=md5hh(i,a,r,n,e[t+3],16,-722521979),n=md5hh(n,i,a,r,e[t+6],23,76029189),r=md5hh(r,n,i,a,e[t+9],4,-640364487),a=md5hh(a,r,n,i,e[t+12],11,-421815835),i=md5hh(i,a,r,n,e[t+15],16,530742520),n=md5hh(n,i,a,r,e[t+2],23,-995338651),r=md5ii(r,n,i,a,e[t],6,-198630844),a=md5ii(a,r,n,i,e[t+7],10,1126891415),i=md5ii(i,a,r,n,e[t+14],15,-1416354905),n=md5ii(n,i,a,r,e[t+5],21,-57434055),r=md5ii(r,n,i,a,e[t+12],6,1700485571),a=md5ii(a,r,n,i,e[t+3],10,-1894986606),i=md5ii(i,a,r,n,e[t+10],15,-1051523),n=md5ii(n,i,a,r,e[t+1],21,-2054922799),r=md5ii(r,n,i,a,e[t+8],6,1873313359),a=md5ii(a,r,n,i,e[t+15],10,-30611744),i=md5ii(i,a,r,n,e[t+6],15,-1560198380),n=md5ii(n,i,a,r,e[t+13],21,1309151649),r=md5ii(r,n,i,a,e[t+4],6,-145523070),a=md5ii(a,r,n,i,e[t+11],10,-1120210379),i=md5ii(i,a,r,n,e[t+2],15,718787259),n=md5ii(n,i,a,r,e[t+9],21,-343485551),r=safeAdd(r,o),n=safeAdd(n,s),i=safeAdd(i,l),a=safeAdd(a,c)}return[r,n,i,a]}(function bytesToWords(e){if(0===e.length)return[];const t=8*e.length,r=new Uint32Array(getOutputLength(t));for(let n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))};t.default=r},4790:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};t.default=r},6314:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default="00000000-0000-0000-0000-000000000000"},8222:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(6435));var i=function parse(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");let t;const r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};t.default=i},58:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},3319:(e,t)=>{"use strict";let r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function rng(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(n)};const n=new Uint8Array(16)},3757:(e,t)=>{"use strict";function f(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function ROTL(e,t){return e<<t|e>>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function sha1(e){const t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const n=e.length/4+2,i=Math.ceil(n/16),a=new Array(i);for(let t=0;t<i;++t){const r=new Uint32Array(16);for(let n=0;n<16;++n)r[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];a[t]=r}a[i-1][14]=8*(e.length-1)/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<i;++e){const n=new Uint32Array(80);for(let t=0;t<16;++t)n[t]=a[e][t];for(let e=16;e<80;++e)n[e]=ROTL(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let i=r[0],o=r[1],s=r[2],l=r[3],c=r[4];for(let e=0;e<80;++e){const r=Math.floor(e/20),a=ROTL(i,5)+f(r,o,s,l)+c+t[r]+n[e]>>>0;c=l,l=s,s=ROTL(o,30)>>>0,o=i,i=a}r[0]=r[0]+i>>>0,r[1]=r[1]+o>>>0,r[2]=r[2]+s>>>0,r[3]=r[3]+l>>>0,r[4]=r[4]+c>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]};t.default=r},4008:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=unsafeStringify;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(6435));const i=[];for(let e=0;e<256;++e)i.push((e+256).toString(16).slice(1));function unsafeStringify(e,t=0){return i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+"-"+i[e[t+4]]+i[e[t+5]]+"-"+i[e[t+6]]+i[e[t+7]]+"-"+i[e[t+8]]+i[e[t+9]]+"-"+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]}var a=function stringify(e,t=0){const r=unsafeStringify(e,t);if(!(0,n.default)(r))throw TypeError("Stringified UUID is invalid");return r};t.default=a},3990:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(3319)),i=r(4008);let a,o,s=0,l=0;var c=function v1(e,t,r){let c=t&&r||0;const u=t||new Array(16);let d=(e=e||{}).node||a,p=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==p){const t=e.random||(e.rng||n.default)();null==d&&(d=a=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==p&&(p=o=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),y=void 0!==e.nsecs?e.nsecs:l+1;const g=h-s+(y-l)/1e4;if(g<0&&void 0===e.clockseq&&(p=p+1&16383),(g<0||h>s)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=h,l=y,o=p,h+=122192928e5;const m=(1e4*(268435455&h)+y)%4294967296;u[c++]=m>>>24&255,u[c++]=m>>>16&255,u[c++]=m>>>8&255,u[c++]=255&m;const v=h/4294967296*1e4&268435455;u[c++]=v>>>8&255,u[c++]=255&v,u[c++]=v>>>24&15|16,u[c++]=v>>>16&255,u[c++]=p>>>8|128,u[c++]=255&p;for(let e=0;e<6;++e)u[c+e]=d[e];return t||(0,i.unsafeStringify)(u)};t.default=c},8237:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(r(7925)),i=_interopRequireDefault(r(4163));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var a=(0,n.default)("v3",48,i.default);t.default=a},7925:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function v35(e,t,r){function generateUUID(e,a,o,s){var l;if("string"==typeof e&&(e=function stringToBytes(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof a&&(a=(0,i.default)(a)),16!==(null===(l=a)||void 0===l?void 0:l.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+e.length);if(c.set(a),c.set(e,a.length),c=r(c),c[6]=15&c[6]|t,c[8]=63&c[8]|128,o){s=s||0;for(let e=0;e<16;++e)o[s+e]=c[e];return o}return(0,n.unsafeStringify)(c)}try{generateUUID.name=e}catch(e){}return generateUUID.DNS=a,generateUUID.URL=o,generateUUID};var n=r(4008),i=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(8222));const a="6ba7b810-9dad-11d1-80b4-00c04fd430c8";t.DNS=a;const o="6ba7b811-9dad-11d1-80b4-00c04fd430c8";t.URL=o},5355:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(r(4790)),i=_interopRequireDefault(r(3319)),a=r(4008);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var o=function v4(e,t,r){if(n.default.randomUUID&&!t&&!e)return n.default.randomUUID();const o=(e=e||{}).random||(e.rng||i.default)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=o[e];return t}return(0,a.unsafeStringify)(o)};t.default=o},3764:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(r(7925)),i=_interopRequireDefault(r(3757));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var a=(0,n.default)("v5",80,i.default);t.default=a},6435:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(58));var i=function validate(e){return"string"==typeof e&&n.default.test(e)};t.default=i},8464:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r(6435));var i=function version(e){if(!(0,n.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)};t.default=i},2890:e=>{"use strict";e.exports=NMSHDCrypto},194:e=>{"use strict";e.exports=TSServal},4654:()=>{},7218:(e,t,r)=>{"use strict";function bind(e,t){return function wrap(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:i}=Object,a=(o=Object.create(null),e=>{const t=n.call(e);return o[t]||(o[t]=t.slice(8,-1).toLowerCase())});var o;const kindOfTest=e=>(e=e.toLowerCase(),t=>a(t)===e),typeOfTest=e=>t=>typeof t===e,{isArray:s}=Array,l=typeOfTest("undefined");const c=kindOfTest("ArrayBuffer");const u=typeOfTest("string"),d=typeOfTest("function"),p=typeOfTest("number"),isObject=e=>null!==e&&"object"==typeof e,isPlainObject=e=>{if("object"!==a(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},h=kindOfTest("Date"),y=kindOfTest("File"),g=kindOfTest("Blob"),m=kindOfTest("FileList"),v=kindOfTest("URLSearchParams");function forEach(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),s(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function findKey(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:r.g,isContextDefined=e=>!l(e)&&e!==b;const w=(C="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>C&&e instanceof C);var C;const S=kindOfTest("HTMLFormElement"),_=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),R=kindOfTest("RegExp"),reduceDescriptors=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};forEach(r,((r,i)=>{let a;!1!==(a=t(r,i,e))&&(n[i]=a||r)})),Object.defineProperties(e,n)},O="abcdefghijklmnopqrstuvwxyz",T="0123456789",I={DIGIT:T,ALPHA:O,ALPHA_DIGIT:O+O.toUpperCase()+T};const E=kindOfTest("AsyncFunction");var D={isArray:s,isArrayBuffer:c,isBuffer:function isBuffer(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&d(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||d(e.append)&&("formdata"===(t=a(e))||"object"===t&&d(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function isArrayBufferView(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&c(e.buffer),t},isString:u,isNumber:p,isBoolean:e=>!0===e||!1===e,isObject,isPlainObject,isUndefined:l,isDate:h,isFile:y,isBlob:g,isRegExp:R,isFunction:d,isStream:e=>isObject(e)&&d(e.pipe),isURLSearchParams:v,isTypedArray:w,isFileList:m,forEach,merge:function merge(){const{caseless:e}=isContextDefined(this)&&this||{},t={},assignValue=(r,n)=>{const i=e&&findKey(t,n)||n;isPlainObject(t[i])&&isPlainObject(r)?t[i]=merge(t[i],r):isPlainObject(r)?t[i]=merge({},r):s(r)?t[i]=r.slice():t[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&forEach(arguments[e],assignValue);return t},extend:(e,t,r,{allOwnKeys:n}={})=>(forEach(t,((t,n)=>{r&&d(t)?e[n]=bind(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,s;const l={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],n&&!n(s,e,t)||l[s]||(t[s]=e[s],l[s]=!0);e=!1!==r&&i(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(s(e))return e;let t=e.length;if(!p(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:S,hasOwnProperty:_,hasOwnProp:_,reduceDescriptors,freezeMethods:e=>{reduceDescriptors(e,((t,r)=>{if(d(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];d(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},define=e=>{e.forEach((e=>{r[e]=!0}))};return s(e)?define(e):define(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function replacer(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey,global:b,isContextDefined,ALPHABET:I,generateString:(e=16,t=I.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function isSpecCompliantForm(e){return!!(e&&d(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),visit=(e,r)=>{if(isObject(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const n=s(e)?[]:{};return forEach(e,((e,t)=>{const i=visit(e,r+1);!l(i)&&(n[t]=i)})),t[r]=void 0,n}}return e};return visit(e,0)},isAsyncFn:E,isThenable:e=>e&&(isObject(e)||d(e))&&d(e.then)&&d(e.catch)};function AxiosError(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}D.inherits(AxiosError,Error,{toJSON:function toJSON(){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:D.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const P=AxiosError.prototype,A={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{A[e]={value:e}})),Object.defineProperties(AxiosError,A),Object.defineProperty(P,"isAxiosError",{value:!0}),AxiosError.from=(e,t,r,n,i,a)=>{const o=Object.create(P);return D.toFlatObject(e,o,(function filter(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),AxiosError.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function isVisitable(e){return D.isPlainObject(e)||D.isArray(e)}function removeBrackets(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function renderKey(e,t,r){return e?e.concat(t).map((function each(e,t){return e=removeBrackets(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const j=D.toFlatObject(D,{},null,(function filter(e){return/^is[A-Z]/.test(e)}));function toFormData(e,t,r){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function defined(e,t){return!D.isUndefined(t[e])}))).metaTokens,i=r.visitor||defaultVisitor,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&D.isSpecCompliantForm(t);if(!D.isFunction(i))throw new TypeError("visitor must be a function");function convertValue(e){if(null===e)return"";if(D.isDate(e))return e.toISOString();if(!s&&D.isBlob(e))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(e)||D.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function defaultVisitor(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(D.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(D.isArray(e)&&function isFlatArray(e){return D.isArray(e)&&!e.some(isVisitable)}(e)||(D.isFileList(e)||D.endsWith(r,"[]"))&&(s=D.toArray(e)))return r=removeBrackets(r),s.forEach((function each(e,n){!D.isUndefined(e)&&null!==e&&t.append(!0===o?renderKey([r],n,a):null===o?r:r+"[]",convertValue(e))})),!1;return!!isVisitable(e)||(t.append(renderKey(i,r,a),convertValue(e)),!1)}const l=[],c=Object.assign(j,{defaultVisitor,convertValue,isVisitable});if(!D.isObject(e))throw new TypeError("data must be an object");return function build(e,r){if(!D.isUndefined(e)){if(-1!==l.indexOf(e))throw Error("Circular reference detected in "+r.join("."));l.push(e),D.forEach(e,(function each(e,n){!0===(!(D.isUndefined(e)||null===e)&&i.call(t,e,D.isString(n)?n.trim():n,r,c))&&build(e,r?r.concat(n):[n])})),l.pop()}}(e),t}function encode$1(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function replacer(e){return t[e]}))}function AxiosURLSearchParams(e,t){this._pairs=[],e&&toFormData(e,this,t)}const M=AxiosURLSearchParams.prototype;function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(e,t,r){if(!t)return e;const n=r&&r.encode||encode,i=r&&r.serialize;let a;if(a=i?i(t,r):D.isURLSearchParams(t)?t.toString():new AxiosURLSearchParams(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}M.append=function append(e,t){this._pairs.push([e,t])},M.toString=function toString(e){const t=e?function(t){return e.call(this,t,encode$1)}:encode$1;return this._pairs.map((function each(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var x=class InterceptorManager{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){D.forEach(this.handlers,(function forEachHandler(t){null!==t&&e(t)}))}},k={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},L={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:AxiosURLSearchParams,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const F="undefined"!=typeof window&&"undefined"!=typeof document,N=(z="undefined"!=typeof navigator&&navigator.product,F&&["ReactNative","NativeScript","NS"].indexOf(z)<0);var z;const B="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var U={...Object.freeze({__proto__:null,hasBrowserEnv:F,hasStandardBrowserWebWorkerEnv:B,hasStandardBrowserEnv:N}),...L};function formDataToJSON(e){function buildPath(e,t,r,n){let i=e[n++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),o=n>=e.length;if(i=!i&&D.isArray(r)?r.length:i,o)return D.hasOwnProp(r,i)?r[i]=[r[i],t]:r[i]=t,!a;r[i]&&D.isObject(r[i])||(r[i]=[]);return buildPath(e,t,r[i],n)&&D.isArray(r[i])&&(r[i]=function arrayToObject(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(r[i])),!a}if(D.isFormData(e)&&D.isFunction(e.entries)){const t={};return D.forEachEntry(e,((e,r)=>{buildPath(function parsePropPath(e){return D.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,t,0)})),t}return null}const W={transitional:k,adapter:["xhr","http"],transformRequest:[function transformRequest(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=D.isObject(e);i&&D.isHTMLForm(e)&&(e=new FormData(e));if(D.isFormData(e))return n&&n?JSON.stringify(formDataToJSON(e)):e;if(D.isArrayBuffer(e)||D.isBuffer(e)||D.isStream(e)||D.isFile(e)||D.isBlob(e))return e;if(D.isArrayBufferView(e))return e.buffer;if(D.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function toURLEncodedForm(e,t){return toFormData(e,new U.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return U.isNode&&D.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=D.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return toFormData(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function stringifySafely(e,t,r){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function transformResponse(e){const t=this.transitional||W.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&D.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw AxiosError.from(e,AxiosError.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:U.classes.FormData,Blob:U.classes.Blob},validateStatus:function validateStatus(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch"],(e=>{W.headers[e]={}}));var V=W;const q=D.toObjectSet(["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"]);const $=Symbol("internals");function normalizeHeader(e){return e&&String(e).trim().toLowerCase()}function normalizeValue(e){return!1===e||null==e?e:D.isArray(e)?e.map(normalizeValue):String(e)}function matchHeaderValue(e,t,r,n,i){return D.isFunction(n)?n.call(this,t,r):(i&&(t=r),D.isString(t)?D.isString(n)?-1!==t.indexOf(n):D.isRegExp(n)?n.test(t):void 0:void 0)}class AxiosHeaders{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function setHeader(e,t,r){const i=normalizeHeader(t);if(!i)throw new Error("header name must be a non-empty string");const a=D.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=normalizeValue(e))}const setHeaders=(e,t)=>D.forEach(e,((e,r)=>setHeader(e,r,t)));return D.isPlainObject(e)||e instanceof this.constructor?setHeaders(e,t):D.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?setHeaders((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function parser(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&q[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&setHeader(t,e,r),this}get(e,t){if(e=normalizeHeader(e)){const r=D.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function parseTokens(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(D.isFunction(t))return t.call(this,e,r);if(D.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=normalizeHeader(e)){const r=D.findKey(this,e);return!(!r||void 0===this[r]||t&&!matchHeaderValue(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function deleteHeader(e){if(e=normalizeHeader(e)){const i=D.findKey(r,e);!i||t&&!matchHeaderValue(0,r[i],i,t)||(delete r[i],n=!0)}}return D.isArray(e)?e.forEach(deleteHeader):deleteHeader(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!matchHeaderValue(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return D.forEach(this,((n,i)=>{const a=D.findKey(r,i);if(a)return t[a]=normalizeValue(n),void delete t[i];const o=e?function formatHeader(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=normalizeValue(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return D.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&D.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[$]=this[$]={accessors:{}}).accessors,r=this.prototype;function defineAccessor(e){const n=normalizeHeader(e);t[n]||(!function buildAccessors(e,t){const r=D.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return D.isArray(e)?e.forEach(defineAccessor):defineAccessor(e),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(AxiosHeaders.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),D.freezeMethods(AxiosHeaders);var K=AxiosHeaders;function transformData(e,t){const r=this||V,n=t||r,i=K.from(n.headers);let a=n.data;return D.forEach(e,(function transform(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function isCancel(e){return!(!e||!e.__CANCEL__)}function CanceledError(e,t,r){AxiosError.call(this,null==e?"canceled":e,AxiosError.ERR_CANCELED,t,r),this.name="CanceledError"}D.inherits(CanceledError,AxiosError,{__CANCEL__:!0});var H=U.hasStandardBrowserEnv?{write(e,t,r,n,i,a){const o=[e+"="+encodeURIComponent(t)];D.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),D.isString(n)&&o.push("path="+n),D.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function buildFullPath(e,t){return e&&!function isAbsoluteURL(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function combineURLs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var G=U.hasStandardBrowserEnv?function standardBrowserEnv(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function resolveURL(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=resolveURL(window.location.href),function isURLSameOrigin(e){const t=D.isString(e)?resolveURL(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function isURLSameOrigin(){return!0};function progressEventReducer(e,t){let r=0;const n=function speedometer(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function push(s){const l=Date.now(),c=n[o];i||(i=l),r[a]=s,n[a]=l;let u=o,d=0;for(;u!==a;)d+=r[u++],u%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),l-i<t)return;const p=c&&l-c;return p?Math.round(1e3*d/p):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,l=n(s);r=a;const c={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:l||void 0,estimated:l&&o&&a<=o?(o-a)/l:void 0,event:i};c[t?"download":"upload"]=!0,e(c)}}const Z={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function dispatchXhrRequest(t,r){let n=e.data;const i=K.from(e.headers).normalize();let a,o,{responseType:s,withXSRFToken:l}=e;function done(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}if(D.isFormData(n))if(U.hasStandardBrowserEnv||U.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(o=i.getContentType())){const[e,...t]=o?o.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=buildFullPath(e.baseURL,e.url);function onloadend(){if(!c)return;const n=K.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function settle(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new AxiosError("Request failed with status code "+r.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function _resolve(e){t(e),done()}),(function _reject(e){r(e),done()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),buildURL(u,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=onloadend:c.onreadystatechange=function handleLoad(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(onloadend)},c.onabort=function handleAbort(){c&&(r(new AxiosError("Request aborted",AxiosError.ECONNABORTED,e,c)),c=null)},c.onerror=function handleError(){r(new AxiosError("Network Error",AxiosError.ERR_NETWORK,e,c)),c=null},c.ontimeout=function handleTimeout(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||k;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new AxiosError(t,n.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,e,c)),c=null},U.hasStandardBrowserEnv&&(l&&D.isFunction(l)&&(l=l(e)),l||!1!==l&&G(u))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&H.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in c&&D.forEach(i.toJSON(),(function setRequestHeader(e,t){c.setRequestHeader(t,e)})),D.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),s&&"json"!==s&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",progressEventReducer(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",progressEventReducer(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=t=>{c&&(r(!t||t.type?new CanceledError(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const d=function parseProtocol(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===U.protocols.indexOf(d)?r(new AxiosError("Unsupported protocol "+d+":",AxiosError.ERR_BAD_REQUEST,e)):c.send(n||null)}))}};D.forEach(Z,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const renderReason=e=>`- ${e}`,isResolvedHandle=e=>D.isFunction(e)||null===e||!1===e;var adapters_getAdapter=e=>{e=D.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let a=0;a<t;a++){let t;if(r=e[a],n=r,!isResolvedHandle(r)&&(n=Z[(t=String(r)).toLowerCase()],void 0===n))throw new AxiosError(`Unknown adapter '${t}'`);if(n)break;i[t||"#"+a]=n}if(!n){const e=Object.entries(i).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new AxiosError("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(renderReason).join("\n"):" "+renderReason(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function throwIfCancellationRequested(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new CanceledError(null,e)}function dispatchRequest(e){throwIfCancellationRequested(e),e.headers=K.from(e.headers),e.data=transformData.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return adapters_getAdapter(e.adapter||V.adapter)(e).then((function onAdapterResolution(t){return throwIfCancellationRequested(e),t.data=transformData.call(e,e.transformResponse,t),t.headers=K.from(t.headers),t}),(function onAdapterRejection(t){return isCancel(t)||(throwIfCancellationRequested(e),t&&t.response&&(t.response.data=transformData.call(e,e.transformResponse,t.response),t.response.headers=K.from(t.response.headers))),Promise.reject(t)}))}const headersToObject=e=>e instanceof K?e.toJSON():e;function mergeConfig(e,t){t=t||{};const r={};function getMergedValue(e,t,r){return D.isPlainObject(e)&&D.isPlainObject(t)?D.merge.call({caseless:r},e,t):D.isPlainObject(t)?D.merge({},t):D.isArray(t)?t.slice():t}function mergeDeepProperties(e,t,r){return D.isUndefined(t)?D.isUndefined(e)?void 0:getMergedValue(void 0,e,r):getMergedValue(e,t,r)}function valueFromConfig2(e,t){if(!D.isUndefined(t))return getMergedValue(void 0,t)}function defaultToConfig2(e,t){return D.isUndefined(t)?D.isUndefined(e)?void 0:getMergedValue(void 0,e):getMergedValue(void 0,t)}function mergeDirectKeys(r,n,i){return i in t?getMergedValue(r,n):i in e?getMergedValue(void 0,r):void 0}const n={url:valueFromConfig2,method:valueFromConfig2,data:valueFromConfig2,baseURL:defaultToConfig2,transformRequest:defaultToConfig2,transformResponse:defaultToConfig2,paramsSerializer:defaultToConfig2,timeout:defaultToConfig2,timeoutMessage:defaultToConfig2,withCredentials:defaultToConfig2,withXSRFToken:defaultToConfig2,adapter:defaultToConfig2,responseType:defaultToConfig2,xsrfCookieName:defaultToConfig2,xsrfHeaderName:defaultToConfig2,onUploadProgress:defaultToConfig2,onDownloadProgress:defaultToConfig2,decompress:defaultToConfig2,maxContentLength:defaultToConfig2,maxBodyLength:defaultToConfig2,beforeRedirect:defaultToConfig2,transport:defaultToConfig2,httpAgent:defaultToConfig2,httpsAgent:defaultToConfig2,cancelToken:defaultToConfig2,socketPath:defaultToConfig2,responseEncoding:defaultToConfig2,validateStatus:mergeDirectKeys,headers:(e,t)=>mergeDeepProperties(headersToObject(e),headersToObject(t),!0)};return D.forEach(Object.keys(Object.assign({},e,t)),(function computeConfigValue(i){const a=n[i]||mergeDeepProperties,o=a(e[i],t[i],i);D.isUndefined(o)&&a!==mergeDirectKeys||(r[i]=o)})),r}const J="1.6.5",Y={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Y[e]=function validator(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Q={};Y.transitional=function transitional(e,t,r){function formatMessage(e,t){return"[Axios v1.6.5] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,i)=>{if(!1===e)throw new AxiosError(formatMessage(n," has been removed"+(t?" in "+t:"")),AxiosError.ERR_DEPRECATED);return t&&!Q[n]&&(Q[n]=!0,console.warn(formatMessage(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,i)}};var X={assertOptions:function assertOptions(e,t,r){if("object"!=typeof e)throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new AxiosError("option "+a+" must be "+r,AxiosError.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new AxiosError("Unknown option "+a,AxiosError.ERR_BAD_OPTION)}},validators:Y};const ee=X.validators;class Axios{constructor(e){this.defaults=e,this.interceptors={request:new x,response:new x}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=mergeConfig(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&X.assertOptions(r,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1),null!=n&&(D.isFunction(n)?t.paramsSerializer={serialize:n}:X.assertOptions(n,{encode:ee.function,serialize:ee.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&D.merge(i.common,i[t.method]);i&&D.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=K.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function unshiftRequestInterceptors(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const l=[];let c;this.interceptors.response.forEach((function pushResponseInterceptors(e){l.push(e.fulfilled,e.rejected)}));let u,d=0;if(!s){const e=[dispatchRequest.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,l),u=e.length,c=Promise.resolve(t);d<u;)c=c.then(e[d++],e[d++]);return c}u=o.length;let p=t;for(d=0;d<u;){const e=o[d++],t=o[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{c=dispatchRequest.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return buildURL(buildFullPath((e=mergeConfig(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}D.forEach(["delete","get","head","options"],(function forEachMethodNoData(e){Axios.prototype[e]=function(t,r){return this.request(mergeConfig(r||{},{method:e,url:t,data:(r||{}).data}))}})),D.forEach(["post","put","patch"],(function forEachMethodWithData(e){function generateHTTPMethod(t){return function httpMethod(r,n,i){return this.request(mergeConfig(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Axios.prototype[e]=generateHTTPMethod(),Axios.prototype[e+"Form"]=generateHTTPMethod(!0)}));var te=Axios;class CancelToken{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function promiseExecutor(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function reject(){r.unsubscribe(t)},n},e((function cancel(e,n,i){r.reason||(r.reason=new CanceledError(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new CancelToken((function executor(t){e=t})),cancel:e}}}var re=CancelToken;const ne={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ne).forEach((([e,t])=>{ne[t]=e}));var ie=ne;const ae=function createInstance(e){const t=new te(e),r=bind(te.prototype.request,t);return D.extend(r,te.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function create(t){return createInstance(mergeConfig(e,t))},r}(V);ae.Axios=te,ae.CanceledError=CanceledError,ae.CancelToken=re,ae.isCancel=isCancel,ae.VERSION=J,ae.toFormData=toFormData,ae.AxiosError=AxiosError,ae.Cancel=ae.CanceledError,ae.all=function all(e){return Promise.all(e)},ae.spread=function spread(e){return function wrap(t){return e.apply(null,t)}},ae.isAxiosError=function isAxiosError(e){return D.isObject(e)&&!0===e.isAxiosError},ae.mergeConfig=mergeConfig,ae.AxiosHeaders=K,ae.formToJSON=e=>formDataToJSON(D.isHTMLForm(e)?new FormData(e):e),ae.getAdapter=adapters_getAdapter,ae.HttpStatusCode=ie,ae.default=ae,e.exports=ae},4901:(e,t,r)=>{"use strict";r.r(t),r.d(t,{JsonPatchError:()=>l,_areEquals:()=>_areEquals,applyOperation:()=>applyOperation,applyPatch:()=>applyPatch,applyReducer:()=>applyReducer,compare:()=>compare,deepClone:()=>_deepClone,default:()=>m,escapePathComponent:()=>escapePathComponent,generate:()=>generate,getValueByPointer:()=>getValueByPointer,observe:()=>observe,unescapePathComponent:()=>unescapePathComponent,unobserve:()=>unobserve,validate:()=>validate,validator:()=>validator});var n={};r.r(n),r.d(n,{JsonPatchError:()=>c,_areEquals:()=>_areEquals,applyOperation:()=>applyOperation,applyPatch:()=>applyPatch,applyReducer:()=>applyReducer,deepClone:()=>u,getValueByPointer:()=>getValueByPointer,validate:()=>validate,validator:()=>validator});var i={};r.r(i),r.d(i,{compare:()=>compare,generate:()=>generate,observe:()=>observe,unobserve:()=>unobserve});var a,o=(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},a(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),s=Object.prototype.hasOwnProperty;function helpers_hasOwnProperty(e,t){return s.call(e,t)}function _objectKeys(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var i in e)helpers_hasOwnProperty(e,i)&&n.push(i);return n}function _deepClone(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function isInteger(e){for(var t,r=0,n=e.length;r<n;){if(!((t=e.charCodeAt(r))>=48&&t<=57))return!1;r++}return!0}function escapePathComponent(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function unescapePathComponent(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function hasUndefined(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(hasUndefined(e[t]))return!0}else if("object"==typeof e)for(var n=_objectKeys(e),i=n.length,a=0;a<i;a++)if(hasUndefined(e[n[a]]))return!0;return!1}function patchErrorMessageFormatter(e,t){var r=[e];for(var n in t){var i="object"==typeof t[n]?JSON.stringify(t[n],null,2):t[n];void 0!==i&&r.push(n+": "+i)}return r.join("\n")}var l=function(e){function PatchError(t,r,n,i,a){var o=this.constructor,s=e.call(this,patchErrorMessageFormatter(t,{name:r,index:n,operation:i,tree:a}))||this;return s.name=r,s.index=n,s.operation=i,s.tree=a,Object.setPrototypeOf(s,o.prototype),s.message=patchErrorMessageFormatter(t,{name:r,index:n,operation:i,tree:a}),s}return o(PatchError,e),PatchError}(Error),c=l,u=_deepClone,d={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=getValueByPointer(r,this.path);n&&(n=_deepClone(n));var i=applyOperation(r,{op:"remove",path:this.from}).removed;return applyOperation(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=getValueByPointer(r,this.from);return applyOperation(r,{op:"add",path:this.path,value:_deepClone(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:_areEquals(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},p={add:function(e,t,r){return isInteger(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:d.move,copy:d.copy,test:d.test,_get:d._get};function getValueByPointer(e,t){if(""==t)return e;var r={op:"_get",path:t};return applyOperation(e,r),r.value}function applyOperation(e,t,r,n,i,a){if(void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===i&&(i=!0),void 0===a&&(a=0),r&&("function"==typeof r?r(t,0,e,t.path):validator(t,0)),""===t.path){var o={newDocument:e};if("add"===t.op)return o.newDocument=t.value,o;if("replace"===t.op)return o.newDocument=t.value,o.removed=e,o;if("move"===t.op||"copy"===t.op)return o.newDocument=getValueByPointer(e,t.from),"move"===t.op&&(o.removed=e),o;if("test"===t.op){if(o.test=_areEquals(e,t.value),!1===o.test)throw new c("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return o.newDocument=e,o}if("remove"===t.op)return o.removed=e,o.newDocument=null,o;if("_get"===t.op)return t.value=e,o;if(r)throw new c("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return o}n||(e=_deepClone(e));var s=(t.path||"").split("/"),l=e,u=1,h=s.length,y=void 0,g=void 0,m=void 0;for(m="function"==typeof r?r:validator;;){if((g=s[u])&&-1!=g.indexOf("~")&&(g=unescapePathComponent(g)),i&&("__proto__"==g||"prototype"==g&&u>0&&"constructor"==s[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&void 0===y&&(void 0===l[g]?y=s.slice(0,u).join("/"):u==h-1&&(y=t.path),void 0!==y&&m(t,0,e,y)),u++,Array.isArray(l)){if("-"===g)g=l.length;else{if(r&&!isInteger(g))throw new c("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);isInteger(g)&&(g=~~g)}if(u>=h){if(r&&"add"===t.op&&g>l.length)throw new c("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);if(!1===(o=p[t.op].call(t,l,g,e)).test)throw new c("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return o}}else if(u>=h){if(!1===(o=d[t.op].call(t,l,g,e)).test)throw new c("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return o}if(l=l[g],r&&u<h&&(!l||"object"!=typeof l))throw new c("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}function applyPatch(e,t,r,n,i){if(void 0===n&&(n=!0),void 0===i&&(i=!0),r&&!Array.isArray(t))throw new c("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=_deepClone(e));for(var a=new Array(t.length),o=0,s=t.length;o<s;o++)a[o]=applyOperation(e,t[o],r,!0,i,o),e=a[o].newDocument;return a.newDocument=e,a}function applyReducer(e,t,r){var n=applyOperation(e,t);if(!1===n.test)throw new c("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function validator(e,t,r,n){if("object"!=typeof e||null===e||Array.isArray(e))throw new c("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(!d[e.op])throw new c("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r);if("string"!=typeof e.path)throw new c("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new c('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new c("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new c("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&hasUndefined(e.value))throw new c("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r)if("add"==e.op){var i=e.path.split("/").length,a=n.split("/").length;if(i!==a+1&&i!==a)throw new c("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==n)throw new c("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if("move"===e.op||"copy"===e.op){var o=validate([{op:"_get",path:e.from,value:void 0}],r);if(o&&"OPERATION_PATH_UNRESOLVABLE"===o.name)throw new c("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}function validate(e,t,r){try{if(!Array.isArray(e))throw new c("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)applyPatch(_deepClone(t),_deepClone(e),r||!0);else{r=r||validator;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(e){if(e instanceof c)return e;throw e}}function _areEquals(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var r,n,i,a=Array.isArray(e),o=Array.isArray(t);if(a&&o){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!_areEquals(e[r],t[r]))return!1;return!0}if(a!=o)return!1;var s=Object.keys(e);if((n=s.length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!t.hasOwnProperty(s[r]))return!1;for(r=n;0!=r--;)if(!_areEquals(e[i=s[r]],t[i]))return!1;return!0}return e!=e&&t!=t}var h=new WeakMap,y=function y(e){this.observers=new Map,this.obj=e},g=function g(e,t){this.callback=e,this.observer=t};function unobserve(e,t){t.unobserve()}function observe(e,t){var r,n=function getMirror(e){return h.get(e)}(e);if(n){var i=function getObserverFromMirror(e,t){return e.observers.get(t)}(n,t);r=i&&i.observer}else n=new y(e),h.set(e,n);if(r)return r;if(r={},n.value=_deepClone(e),t){r.callback=t,r.next=null;var dirtyCheck=function(){generate(r)},fastCheck=function(){clearTimeout(r.next),r.next=setTimeout(dirtyCheck)};"undefined"!=typeof window&&(window.addEventListener("mouseup",fastCheck),window.addEventListener("keyup",fastCheck),window.addEventListener("mousedown",fastCheck),window.addEventListener("keydown",fastCheck),window.addEventListener("change",fastCheck))}return r.patches=[],r.object=e,r.unobserve=function(){generate(r),clearTimeout(r.next),function removeObserverFromMirror(e,t){e.observers.delete(t.callback)}(n,r),"undefined"!=typeof window&&(window.removeEventListener("mouseup",fastCheck),window.removeEventListener("keyup",fastCheck),window.removeEventListener("mousedown",fastCheck),window.removeEventListener("keydown",fastCheck),window.removeEventListener("change",fastCheck))},n.observers.set(t,new g(t,r)),r}function generate(e,t){void 0===t&&(t=!1);var r=h.get(e.object);_generate(r.value,e.object,e.patches,"",t),e.patches.length&&applyPatch(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function _generate(e,t,r,n,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var a=_objectKeys(t),o=_objectKeys(e),s=!1,l=o.length-1;l>=0;l--){var c=e[d=o[l]];if(!helpers_hasOwnProperty(t,d)||void 0===t[d]&&void 0!==c&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&r.push({op:"test",path:n+"/"+escapePathComponent(d),value:_deepClone(c)}),r.push({op:"remove",path:n+"/"+escapePathComponent(d)}),s=!0):(i&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),!0);else{var u=t[d];"object"==typeof c&&null!=c&&"object"==typeof u&&null!=u&&Array.isArray(c)===Array.isArray(u)?_generate(c,u,r,n+"/"+escapePathComponent(d),i):c!==u&&(!0,i&&r.push({op:"test",path:n+"/"+escapePathComponent(d),value:_deepClone(c)}),r.push({op:"replace",path:n+"/"+escapePathComponent(d),value:_deepClone(u)}))}}if(s||a.length!=o.length)for(l=0;l<a.length;l++){var d;helpers_hasOwnProperty(e,d=a[l])||void 0===t[d]||r.push({op:"add",path:n+"/"+escapePathComponent(d),value:_deepClone(t[d])})}}}function compare(e,t,r){void 0===r&&(r=!1);var n=[];return _generate(e,t,n,"",r),n}const m=Object.assign({},n,i,{JsonPatchError:l,deepClone:_deepClone,escapePathComponent,unescapePathComponent})}},t={};function __webpack_require__(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r=__webpack_require__(5590);NMSHDTransport=r})();
|
|
3
3
|
//# sourceMappingURL=nmshd.transport.min.js.map
|