lavva.exalushome 1.0.607 → 1.0.608
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/build/exalushome-library-bundle.js +1 -1
- package/build/exalushome-library-bundle.js.map +1 -1
- package/build/js/Services/Devices/Device.d.ts +3 -1
- package/build/js/Services/Devices/Device.js +9 -0
- package/build/js/Services/Devices/Device.js.map +1 -1
- package/build/js/Services/Devices/DeviceChannel.d.ts +0 -2
- package/build/js/Services/Devices/DeviceChannel.js +0 -6
- package/build/js/Services/Devices/DeviceChannel.js.map +1 -1
- package/build/js/Services/Devices/IDevice.d.ts +2 -1
- package/build/js/Services/Devices/IDevice.js.map +1 -1
- package/build/js/Services/Devices/IDeviceChannel.d.ts +0 -2
- package/build/js/Services/Devices/IDeviceChannel.js.map +1 -1
- package/build/js/Services/Devices/IDeviceState.d.ts +1 -3
- package/build/js/Services/Devices/IDeviceState.js +0 -2
- package/build/js/Services/Devices/IDeviceState.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exalushome-library-bundle.js","mappings":"mBACA,ICwBYA,EDxBRC,EAAsB,CEA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,GCNDH,EAAoBS,EAAI,WACvB,GAA0B,iBAAfC,WAAyB,OAAOA,WAC3C,IACC,OAAOC,MAAQ,IAAIC,SAAS,cAAb,EAGhB,CAFE,MAAOC,GACR,GAAsB,iBAAXC,OAAqB,OAAOA,MACxC,CACA,CAPuB,GCAxBd,EAAoBI,EAAI,CAACW,EAAKC,IAAUX,OAAOY,UAAUC,eAAeC,KAAKJ,EAAKC,G,mBCO3E,MAAMI,EAA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,IAAIl6C,SAAQC,GAAWU,WAAWV,EAASi6C,IACtD,EAxCO,GAAAj5C,iBAA2B,GAC3B,GAAAk5C,QAAkB,C","sources":["webpack://lavva.exalushome/webpack/bootstrap","webpack://lavva.exalushome/./src/Services/Logging/ILoggerService.ts","webpack://lavva.exalushome/webpack/runtime/define property getters","webpack://lavva.exalushome/webpack/runtime/global","webpack://lavva.exalushome/webpack/runtime/hasOwnProperty shorthand","webpack://lavva.exalushome/./src/TypedEvent.ts","webpack://lavva.exalushome/./src/Services/Logging/LoggerService.ts","webpack://lavva.exalushome/./src/DependencyContainer.ts","webpack://lavva.exalushome/./src/Services/LocalStorageService.ts","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HeaderNames.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/Errors.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/ILogger.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/ITransport.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HubConnection.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/Loggers.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/Utils.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/AbortController.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HttpConnection.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/Subject.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js","webpack://lavva.exalushome/./src/Helpers.ts","webpack://lavva.exalushome/./src/DataFrame.ts","webpack://lavva.exalushome/./src/Services/IExalusConnectionService.ts","webpack://lavva.exalushome/./src/Services/Users/IUser.ts","webpack://lavva.exalushome/./src/Services/Session/ISessionService.ts","webpack://lavva.exalushome/./src/Event.ts","webpack://lavva.exalushome/./src/Services/Users/User.ts","webpack://lavva.exalushome/./src/Services/Session/SessionService.ts","webpack://lavva.exalushome/./src/Services/Controller/ControllerConfigurationService.ts","webpack://lavva.exalushome/./src/Services/WebApi/WebApiCacheService.ts","webpack://lavva.exalushome/./src/Services/ExalusConnectionService.ts","webpack://lavva.exalushome/./src/Services/Devices/IDeviceChannel.ts","webpack://lavva.exalushome/./src/Services/Devices/IDevice.ts","webpack://lavva.exalushome/./src/Services/Devices/TaskExecutionResult.ts","webpack://lavva.exalushome/./src/Services/Devices/IDeviceState.ts","webpack://lavva.exalushome/./src/Services/FieldChangeResult.ts","webpack://lavva.exalushome/./src/Services/Users/UsersService.ts","webpack://lavva.exalushome/./src/Services/Devices/IDevicesService.ts","webpack://lavva.exalushome/./src/Services/Devices/Device.ts","webpack://lavva.exalushome/./src/Services/Devices/IDeviceTask.ts","webpack://lavva.exalushome/./src/Services/Devices/Tasks/Tasks.ts","webpack://lavva.exalushome/./src/Services/Devices/DeviceChannel.ts","webpack://lavva.exalushome/./src/Services/Controller/IGeolocationService.ts","webpack://lavva.exalushome/./src/Services/Devices/DevicesService.ts","webpack://lavva.exalushome/./src/Services/Controller/GeolocationService.ts","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/shared/ArgumentOutOfRangeException.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/shared/ErrorString.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/shared/InvalidOperationException.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/shared/StrictEqualityComparer.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/ArrayEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/BasicAsyncEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/BasicParallelEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/BasicEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/aggregate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/all.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/allAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/any.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/anyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/static/fromAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/asAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/static/fromParallel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/asParallel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/average.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/averageAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/chunk.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/concatenate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/contains.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/containsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/count.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/countAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/defaultIfEmpty.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/distinct.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/distinctAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/each.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/eachAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/elementAt.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/elementAtOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/except.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/exceptAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/first.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/firstAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/firstOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/firstOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/Grouping.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupByShared.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupByWithSel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupJoin.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupJoinAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/intersect.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/intersectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/join.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/last.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/lastAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/lastOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/lastOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/max.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/maxAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/min.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/minAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/ofType.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asAsyncSortedKeyValuesSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asAsyncKeyMapSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asSortedKeyValuesSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asKeyMapSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/OrderedAsyncEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asAsyncSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asAsyncKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_ordered/asSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_ordered/asKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_ordered/asSortedKeyValuesAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_ordered/asKeyMapAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/OrderedEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/orderBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/orderByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/orderByDescending.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/orderByDescendingAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/partition.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/partitionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/reverse.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/select.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/selectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/selectMany.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/selectManyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/sequenceEquals.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/sequenceEqualsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/single.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/singleAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/singleOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/singleOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/skip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/skipWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/skipWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/sum.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/sumAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/take.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/takeWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/takeWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toMapAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toObject.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toObjectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toSet.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/union.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/unionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/where.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/whereAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/zip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/zipAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindLinq.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/aggregate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/all.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/allAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/any.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/anyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/asParallel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/average.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/averageAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/chunk.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/concatenate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/contains.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/containsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/count.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/countAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/defaultIfEmpty.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/distinct.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/distinctAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/each.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/eachAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/elementAt.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/elementAtOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/except.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/exceptAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/first.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/firstAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/firstOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/firstOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupByWithSel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupJoin.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupJoinAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/intersect.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/intersectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/join.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/last.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/lastAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/lastOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/lastOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/max.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/maxAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/min.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/minAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/ofType.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/orderBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/orderByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/orderByDescending.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/orderByDescendingAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/partition.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/partitionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/reverse.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/select.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/selectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/selectMany.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/selectManyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/sequenceEquals.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/sequenceEqualsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/single.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/singleAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/singleOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/singleOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/skip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/skipWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/skipWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/sum.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/sumAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/take.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/takeWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/takeWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toMapAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toObject.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toObjectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toSet.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/union.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/unionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/where.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/whereAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/zip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/zipAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/aggregate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_nextIteration.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/all.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_nextIterationAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/allAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/any.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/anyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/asAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_typeDataToArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/average.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/averageAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/chunk.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/concatenate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/contains.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/containsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/count.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/countAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/defaultIfEmpty.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/distinct.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/distinctAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/each.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/eachAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/elementAt.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/elementAtOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/except.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/exceptAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/first.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/firstAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/firstOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/firstOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupByWithSel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupJoin.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupJoinAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/intersect.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/intersectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/join.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/last.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/lastAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/lastOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/lastOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/max.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/maxAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/min.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/minAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/ofType.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asAsyncSortedKeyValuesSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asAsyncKeyMapSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asSortedKeyValuesSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asKeyMapSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/OrderedParallelEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asAsyncSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asAsyncKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/orderBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/orderByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/orderByDescending.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/orderByDescendingAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/partition.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/partitionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/reverse.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_nextIterationWithIndex.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/select.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_nextIterationWithIndexAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/selectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/selectMany.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/selectManyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/sequenceEquals.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/sequenceEqualsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/single.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/singleAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/singleOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/singleOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/skip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/skipWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/skipWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/sum.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/sumAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/take.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/takeWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/takeWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toMapAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toObject.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toObjectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toSet.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/union.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/unionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/where.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/whereAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/zip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/zipAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/initializer.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindLinqAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindLinqParallel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindArrayEnumerable.js","webpack://lavva.exalushome/./src/Services/Devices/IChannelsGroupsService.ts","webpack://lavva.exalushome/./src/Services/Devices/ChannelsGroupsService.ts","webpack://lavva.exalushome/./src/AsyncLock.ts","webpack://lavva.exalushome/./src/Services/AppStateService.ts","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/initializeLinq.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindString.js","webpack://lavva.exalushome/./src/Api.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","import { IDIService } from \"./../../IDIService\";\r\n\r\nexport interface ILoggerService extends IDIService {\r\n get LogLevel(): LogLevel;\r\n set LogLevel(level: LogLevel);\r\n\r\n DisableLogsFrom(name: string): void;\r\n EnableLogsFrom(name: string): void;\r\n \r\n Warning(message: string): void;\r\n Warning(contextClassType: string, message: string): void;\r\n\r\n Error(message: string): void;\r\n Error(contextClassType: string, message: string): void;\r\n\r\n Info(message: string): void;\r\n Info(contextClassType: string, message: string): void;\r\n\r\n Debug(message: string): void;\r\n Debug(contextClassType: string, message: string): void;\r\n\r\n Log(message: string): void;\r\n Log(contextClassType: string, message: string): void;\r\n}\r\n\r\nexport enum LogLevel {\r\n Debug = 0,\r\n Info = 1,\r\n Warning = 2,\r\n Error = 3\r\n}","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import { DependencyContainer } from './DependencyContainer';\r\n\r\nexport interface ITypedEvent<T> {\r\n Subscribe(handler: { (data: T): void }): void;\r\n Unsubscribe(handler: { (data: T): void }): void;\r\n}\r\n\r\nexport class TypedEvent<T> implements ITypedEvent<T> {\r\n private handlers: { (data: T): void; }[] = [];\r\n\r\n public Subscribe(handler: { (data: T): void }): void {\r\n this.handlers.push(handler);\r\n }\r\n\r\n public Unsubscribe(handler: { (data: T): void }): void {\r\n this.handlers = this.handlers.filter(h => h !== handler);\r\n }\r\n\r\n public Invoke(data: T) {\r\n this.handlers.slice(0).forEach(h => {\r\n try {\r\n h(data);\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(ex);\r\n }\r\n });\r\n }\r\n}\r\n","import { ILoggerService, LogLevel } from \"./ILoggerService\";\r\n\r\nexport class LoggerService implements ILoggerService {\r\n private _blockedServices: string[] = [];\r\n public static readonly ServiceName: string = \"LoggerService\";\r\n\r\n private IsBlocked<T>(service: string): boolean {\r\n if (service === undefined)\r\n return false;\r\n\r\n return this._blockedServices.any(a => a == service);\r\n }\r\n\r\n DisableLogsFrom(name: string): void {\r\n if (this._blockedServices.all(a => a != name))\r\n this._blockedServices.push(name);\r\n\r\n this.Debug(LoggerService.ServiceName, `Disabling logs from ${name}`);\r\n }\r\n\r\n EnableLogsFrom(name: string): void {\r\n if (this._blockedServices.any(a => a == name))\r\n this._blockedServices = this._blockedServices.where(a => a != name).toArray();\r\n \r\n this.Debug(LoggerService.ServiceName, `Enaabling logs from ${name}`);\r\n }\r\n\r\n private _logLevel: LogLevel = LogLevel.Debug;\r\n\r\n get LogLevel(): LogLevel {\r\n return this._logLevel;\r\n }\r\n\r\n set LogLevel(level: LogLevel) {\r\n this._logLevel = level;\r\n }\r\n\r\n GetServiceName(): string {\r\n return LoggerService.ServiceName;\r\n }\r\n\r\n private GetTimeStamp(): string {\r\n const date = new Date();\r\n return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${date.getMilliseconds()} | `;\r\n }\r\n Warning(message: string): void;\r\n Warning(contextClassType: string, message: string): void;\r\n Warning(contextClassType: unknown, message?: unknown): void {\r\n\r\n switch (this._logLevel) {\r\n case LogLevel.Warning:\r\n case LogLevel.Info:\r\n case LogLevel.Debug:\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n if (contextClassType === undefined || this.IsBlocked(contextClassType as string))\r\n return;\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.warn(`${this.GetTimeStamp()}[WARN] ${contextClassType}`);\r\n else\r\n console.warn(`${this.GetTimeStamp()}[WARN] [${contextClassType}] ${message}`);\r\n }\r\n\r\n Error(message: string): void;\r\n Error(contextClassType: string, message: string): void;\r\n Error(contextClassType: unknown, message?: unknown): void {\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.error(`${this.GetTimeStamp()}[ERROR] ${contextClassType}`);\r\n else\r\n console.error(`${this.GetTimeStamp()}[ERROR] [${contextClassType}] ${message}`);\r\n }\r\n\r\n Info(message: string): void;\r\n Info(contextClassType: string, message: string): void;\r\n Info(contextClassType: unknown, message?: unknown): void {\r\n\r\n switch (this._logLevel) {\r\n case LogLevel.Info:\r\n case LogLevel.Debug:\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n if (contextClassType === undefined || this.IsBlocked(contextClassType as string))\r\n return;\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.info(`${this.GetTimeStamp()}[INFO] ${contextClassType}`);\r\n else\r\n console.info(`${this.GetTimeStamp()}[INFO] [${contextClassType}] ${message}`);\r\n }\r\n\r\n Debug(message: string): void;\r\n Debug(contextClassType: string, message: string): void;\r\n Debug(contextClassType: unknown, message?: unknown): void {\r\n\r\n switch (this._logLevel) {\r\n case LogLevel.Debug:\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n if (contextClassType === undefined || this.IsBlocked(contextClassType as string))\r\n return;\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.debug(`${this.GetTimeStamp()}[DEBUG] ${contextClassType}`);\r\n else\r\n console.debug(`${this.GetTimeStamp()}[DEBUG] [${contextClassType}] ${message}`);\r\n }\r\n\r\n Log(message: string): void;\r\n Log(contextClassType: string, message: string): void;\r\n Log(contextClassType: unknown, message?: unknown): void {\r\n\r\n if (contextClassType === undefined || this.IsBlocked(contextClassType as string))\r\n return;\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.log(`${this.GetTimeStamp()}[LOG] ${contextClassType}`);\r\n else\r\n console.log(`${this.GetTimeStamp()}[LOG] [${contextClassType}] ${message}`);\r\n }\r\n}","import { IDIService } from \"./IDIService\";\r\nimport { TypedEvent, ITypedEvent } from './TypedEvent';\r\nimport { CancelationTokenSource } from './CancelationTokenSource';\r\nimport { ILoggerService } from './Services/Logging/ILoggerService';\r\nimport { LoggerService } from './Services/Logging/LoggerService';\r\n\r\nexport class DependencyContainer {\r\n private static _instance: DependencyContainer;\r\n private _services: { [key: string]: IDIService } = {};\r\n private _serviceRegistrationEvent: ITypedEvent<IDIService> = new TypedEvent<IDIService>();\r\n public static Log?: ILoggerService;\r\n public static IsInitialized: boolean = false;\r\n\r\n public static get Instance(): DependencyContainer {\r\n if (DependencyContainer._instance != null)\r\n return DependencyContainer._instance;\r\n\r\n DependencyContainer._instance = new DependencyContainer();\r\n this.Log = new LoggerService();\r\n this.Log.Warning(\"Initializing DependencyContainer\");\r\n DependencyContainer._instance.RegisterService(this.Log);\r\n this.IsInitialized = true;\r\n return DependencyContainer._instance;\r\n }\r\n\r\n public RegisterService(service: IDIService): void {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Registering new service: ${service.GetServiceName()}`);\r\n this._services[service.GetServiceName()] = service;\r\n }\r\n\r\n public GetService<T extends IDIService>(serviceName: string): T {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Getting service [${serviceName}] by GetService<T>()`);\r\n return this._services[serviceName] as unknown as T;\r\n }\r\n\r\n public GetServiceAsync<T extends IDIService>(serviceName: string, token?: CancelationTokenSource): Promise<T> {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Waiting for service availability [${serviceName}] by GetServiceAsync<T>()`);\r\n\r\n if (this._services.hasOwnProperty(serviceName)) {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Got service [${serviceName}] by GetServiceAsync<T>()`);\r\n return Promise.resolve(this._services[serviceName] as unknown as T);\r\n }\r\n return new Promise<T>((resolve, reject) => {\r\n var sub = (service: IDIService) => {\r\n if (service?.GetServiceName() === serviceName) {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Got service [${name}] by GetServiceAsync<T>()`);\r\n this._serviceRegistrationEvent.Unsubscribe(sub);\r\n resolve(service as unknown as T);\r\n }\r\n };\r\n\r\n var onCancel = () => {\r\n this._serviceRegistrationEvent.Unsubscribe(sub);\r\n token?.CancellationEvent.Unsubscribe(onCancel);\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Cancelled service [${name}] retrieval by GetServiceAsync<T>()`);\r\n reject(new Error(\"Operation cancelled!\"));\r\n };\r\n\r\n token?.CancellationEvent.Subscribe(onCancel);\r\n this._serviceRegistrationEvent.Subscribe(sub);\r\n });\r\n }\r\n\r\n public GetServiceWithTimeoutAsync<T extends IDIService>(serviceName: string, timeout: number): Promise<T> {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Waiting for service[${serviceName}] availability by GetServiceWithTimeoutAsync<T>()`);\r\n\r\n if (this._services.hasOwnProperty(serviceName)) {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Got service [${serviceName}] by GetServiceWithTimeoutAsync<T>()`);\r\n return Promise.resolve(this._services[serviceName] as unknown as T);\r\n }\r\n\r\n return new Promise<T>((resolve, reject) => {\r\n let timeoutId = 0;\r\n let sub = (service: any) => {\r\n if (service?.GetClassName() === service) {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Got service [${service}] by GetServiceWithTimeoutAsync<T>()`);\r\n window.clearTimeout(timeoutId);\r\n this._serviceRegistrationEvent.Unsubscribe(sub);\r\n resolve(service as unknown as T);\r\n }\r\n };\r\n\r\n let onTimeout = () => {\r\n window.clearTimeout(timeoutId);\r\n this._serviceRegistrationEvent.Unsubscribe(sub);\r\n DependencyContainer.Log?.Error(\"DependencyContainer\", `Failed to get service [${serviceName}] in time by GetServiceWithTimeoutAsync<T>()`);\r\n reject(new Error(\"Operation cancelled!\"));\r\n };\r\n\r\n timeoutId = window.setTimeout(onTimeout, timeout);\r\n this._serviceRegistrationEvent.Subscribe(sub);\r\n });\r\n }\r\n}","import { ILocalStorageService } from \"./ILocalStorageService\";\r\nimport { DependencyContainer } from \"../DependencyContainer\";\r\nimport { Api } from \"../Api\";\r\n\r\nexport class LocalStorageService implements ILocalStorageService {\r\n public static readonly ServiceName: string = \"LocalStorageService\";\r\n\r\n GetServiceName(): string {\r\n return LocalStorageService.ServiceName;\r\n }\r\n\r\n private GetResourceName(inContextOf: string, objectId: string): string {\r\n return `_exalus_${Api.WorksInContextOf}_${inContextOf}_${objectId}`;\r\n }\r\n\r\n Remove(inContextOf: string, objectId: string): void {\r\n localStorage.removeItem(this.GetResourceName(inContextOf, objectId));\r\n }\r\n\r\n DropStorage(inContextOf: string): void {\r\n let prefix = `_exalus_${inContextOf}`;\r\n\r\n for (const key in localStorage) {\r\n if (key?.startsWith(prefix))\r\n localStorage.removeItem(key);\r\n }\r\n }\r\n\r\n Save(inContextOf: string, objectId: string, data: any): void {\r\n localStorage.setItem(this.GetResourceName(inContextOf, objectId), JSON.stringify(data));\r\n }\r\n\r\n Read<T>(inContextOf: string, objectId: string): T | null {\r\n try {\r\n let name = this.GetResourceName(inContextOf, objectId);\r\n let obj = localStorage.getItem(name);\r\n\r\n if (obj == null)\r\n return null;\r\n\r\n return JSON.parse(obj) as T;\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(LocalStorageService.ServiceName, `Exception has occurred while reading ${this.GetResourceName(inContextOf, objectId)}`);\r\n return null;\r\n }\r\n }\r\n}","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// 0, 2, 10, 30 second delays before reconnect attempts.\r\nconst DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];\r\n/** @private */\r\nexport class DefaultReconnectPolicy {\r\n constructor(retryDelays) {\r\n this._retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;\r\n }\r\n nextRetryDelayInMilliseconds(retryContext) {\r\n return this._retryDelays[retryContext.previousRetryCount];\r\n }\r\n}\r\n//# sourceMappingURL=DefaultReconnectPolicy.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nexport class HeaderNames {\r\n}\r\nHeaderNames.Authorization = \"Authorization\";\r\nHeaderNames.Cookie = \"Cookie\";\r\n//# sourceMappingURL=HeaderNames.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Represents an HTTP response. */\r\nexport class HttpResponse {\r\n constructor(statusCode, statusText, content) {\r\n this.statusCode = statusCode;\r\n this.statusText = statusText;\r\n this.content = content;\r\n }\r\n}\r\n/** Abstraction over an HTTP client.\r\n *\r\n * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.\r\n */\r\nexport class HttpClient {\r\n get(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"GET\",\r\n url,\r\n });\r\n }\r\n post(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"POST\",\r\n url,\r\n });\r\n }\r\n delete(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"DELETE\",\r\n url,\r\n });\r\n }\r\n /** Gets all cookies that apply to the specified URL.\r\n *\r\n * @param url The URL that the cookies are valid for.\r\n * @returns {string} A string containing all the key-value cookie pairs for the specified URL.\r\n */\r\n // @ts-ignore\r\n getCookieString(url) {\r\n return \"\";\r\n }\r\n}\r\n//# sourceMappingURL=HttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HeaderNames } from \"./HeaderNames\";\r\nimport { HttpClient } from \"./HttpClient\";\r\n/** @private */\r\nexport class AccessTokenHttpClient extends HttpClient {\r\n constructor(innerClient, accessTokenFactory) {\r\n super();\r\n this._innerClient = innerClient;\r\n this._accessTokenFactory = accessTokenFactory;\r\n }\r\n async send(request) {\r\n let allowRetry = true;\r\n if (this._accessTokenFactory && (!this._accessToken || (request.url && request.url.indexOf(\"/negotiate?\") > 0))) {\r\n // don't retry if the request is a negotiate or if we just got a potentially new token from the access token factory\r\n allowRetry = false;\r\n this._accessToken = await this._accessTokenFactory();\r\n }\r\n this._setAuthorizationHeader(request);\r\n const response = await this._innerClient.send(request);\r\n if (allowRetry && response.statusCode === 401 && this._accessTokenFactory) {\r\n this._accessToken = await this._accessTokenFactory();\r\n this._setAuthorizationHeader(request);\r\n return await this._innerClient.send(request);\r\n }\r\n return response;\r\n }\r\n _setAuthorizationHeader(request) {\r\n if (!request.headers) {\r\n request.headers = {};\r\n }\r\n if (this._accessToken) {\r\n request.headers[HeaderNames.Authorization] = `Bearer ${this._accessToken}`;\r\n }\r\n // don't remove the header if there isn't an access token factory, the user manually added the header in this case\r\n else if (this._accessTokenFactory) {\r\n if (request.headers[HeaderNames.Authorization]) {\r\n delete request.headers[HeaderNames.Authorization];\r\n }\r\n }\r\n }\r\n getCookieString(url) {\r\n return this._innerClient.getCookieString(url);\r\n }\r\n}\r\n//# sourceMappingURL=AccessTokenHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Error thrown when an HTTP request fails. */\r\nexport class HttpError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n * @param {number} statusCode The HTTP status code represented by this error.\r\n */\r\n constructor(errorMessage, statusCode) {\r\n const trueProto = new.target.prototype;\r\n super(`${errorMessage}: Status code '${statusCode}'`);\r\n this.statusCode = statusCode;\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when a timeout elapses. */\r\nexport class TimeoutError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage = \"A timeout occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when an action is aborted. */\r\nexport class AbortError extends Error {\r\n /** Constructs a new instance of {@link AbortError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage = \"An abort occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport is unsupported by the browser. */\r\n/** @private */\r\nexport class UnsupportedTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'UnsupportedTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport is disabled by the browser. */\r\n/** @private */\r\nexport class DisabledTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'DisabledTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport cannot be started. */\r\n/** @private */\r\nexport class FailedToStartTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'FailedToStartTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the negotiation with the server failed to complete. */\r\n/** @private */\r\nexport class FailedToNegotiateWithServerError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n */\r\n constructor(message) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.errorType = 'FailedToNegotiateWithServerError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when multiple errors have occurred. */\r\n/** @private */\r\nexport class AggregateErrors extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {Error[]} innerErrors The collection of errors this error is aggregating.\r\n */\r\n constructor(message, innerErrors) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.innerErrors = innerErrors;\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n//# sourceMappingURL=Errors.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\r\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\r\nexport var LogLevel;\r\n(function (LogLevel) {\r\n /** Log level for very low severity diagnostic messages. */\r\n LogLevel[LogLevel[\"Trace\"] = 0] = \"Trace\";\r\n /** Log level for low severity diagnostic messages. */\r\n LogLevel[LogLevel[\"Debug\"] = 1] = \"Debug\";\r\n /** Log level for informational diagnostic messages. */\r\n LogLevel[LogLevel[\"Information\"] = 2] = \"Information\";\r\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\r\n LogLevel[LogLevel[\"Warning\"] = 3] = \"Warning\";\r\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\r\n LogLevel[LogLevel[\"Error\"] = 4] = \"Error\";\r\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\r\n LogLevel[LogLevel[\"Critical\"] = 5] = \"Critical\";\r\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\r\n LogLevel[LogLevel[\"None\"] = 6] = \"None\";\r\n})(LogLevel || (LogLevel = {}));\r\n//# sourceMappingURL=ILogger.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\r\n/** Specifies a specific HTTP transport type. */\r\nexport var HttpTransportType;\r\n(function (HttpTransportType) {\r\n /** Specifies no transport preference. */\r\n HttpTransportType[HttpTransportType[\"None\"] = 0] = \"None\";\r\n /** Specifies the WebSockets transport. */\r\n HttpTransportType[HttpTransportType[\"WebSockets\"] = 1] = \"WebSockets\";\r\n /** Specifies the Server-Sent Events transport. */\r\n HttpTransportType[HttpTransportType[\"ServerSentEvents\"] = 2] = \"ServerSentEvents\";\r\n /** Specifies the Long Polling transport. */\r\n HttpTransportType[HttpTransportType[\"LongPolling\"] = 4] = \"LongPolling\";\r\n})(HttpTransportType || (HttpTransportType = {}));\r\n/** Specifies the transfer format for a connection. */\r\nexport var TransferFormat;\r\n(function (TransferFormat) {\r\n /** Specifies that only text data will be transmitted over the connection. */\r\n TransferFormat[TransferFormat[\"Text\"] = 1] = \"Text\";\r\n /** Specifies that binary data will be transmitted over the connection. */\r\n TransferFormat[TransferFormat[\"Binary\"] = 2] = \"Binary\";\r\n})(TransferFormat || (TransferFormat = {}));\r\n//# sourceMappingURL=ITransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Defines the type of a Hub Message. */\r\nexport var MessageType;\r\n(function (MessageType) {\r\n /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */\r\n MessageType[MessageType[\"Invocation\"] = 1] = \"Invocation\";\r\n /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */\r\n MessageType[MessageType[\"StreamItem\"] = 2] = \"StreamItem\";\r\n /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */\r\n MessageType[MessageType[\"Completion\"] = 3] = \"Completion\";\r\n /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */\r\n MessageType[MessageType[\"StreamInvocation\"] = 4] = \"StreamInvocation\";\r\n /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */\r\n MessageType[MessageType[\"CancelInvocation\"] = 5] = \"CancelInvocation\";\r\n /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */\r\n MessageType[MessageType[\"Ping\"] = 6] = \"Ping\";\r\n /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */\r\n MessageType[MessageType[\"Close\"] = 7] = \"Close\";\r\n})(MessageType || (MessageType = {}));\r\n//# sourceMappingURL=IHubProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HandshakeProtocol } from \"./HandshakeProtocol\";\r\nimport { AbortError } from \"./Errors\";\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { Subject } from \"./Subject\";\r\nimport { Arg, getErrorString, Platform } from \"./Utils\";\r\nconst DEFAULT_TIMEOUT_IN_MS = 30 * 1000;\r\nconst DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000;\r\n/** Describes the current state of the {@link HubConnection} to the server. */\r\nexport var HubConnectionState;\r\n(function (HubConnectionState) {\r\n /** The hub connection is disconnected. */\r\n HubConnectionState[\"Disconnected\"] = \"Disconnected\";\r\n /** The hub connection is connecting. */\r\n HubConnectionState[\"Connecting\"] = \"Connecting\";\r\n /** The hub connection is connected. */\r\n HubConnectionState[\"Connected\"] = \"Connected\";\r\n /** The hub connection is disconnecting. */\r\n HubConnectionState[\"Disconnecting\"] = \"Disconnecting\";\r\n /** The hub connection is reconnecting. */\r\n HubConnectionState[\"Reconnecting\"] = \"Reconnecting\";\r\n})(HubConnectionState || (HubConnectionState = {}));\r\n/** Represents a connection to a SignalR Hub. */\r\nexport class HubConnection {\r\n constructor(connection, logger, protocol, reconnectPolicy) {\r\n this._nextKeepAlive = 0;\r\n this._freezeEventListener = () => {\r\n this._logger.log(LogLevel.Warning, \"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep\");\r\n };\r\n Arg.isRequired(connection, \"connection\");\r\n Arg.isRequired(logger, \"logger\");\r\n Arg.isRequired(protocol, \"protocol\");\r\n this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;\r\n this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;\r\n this._logger = logger;\r\n this._protocol = protocol;\r\n this.connection = connection;\r\n this._reconnectPolicy = reconnectPolicy;\r\n this._handshakeProtocol = new HandshakeProtocol();\r\n this.connection.onreceive = (data) => this._processIncomingData(data);\r\n this.connection.onclose = (error) => this._connectionClosed(error);\r\n this._callbacks = {};\r\n this._methods = {};\r\n this._closedCallbacks = [];\r\n this._reconnectingCallbacks = [];\r\n this._reconnectedCallbacks = [];\r\n this._invocationId = 0;\r\n this._receivedHandshakeResponse = false;\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n this._cachedPingMessage = this._protocol.writeMessage({ type: MessageType.Ping });\r\n }\r\n /** @internal */\r\n // Using a public static factory method means we can have a private constructor and an _internal_\r\n // create method that can be used by HubConnectionBuilder. An \"internal\" constructor would just\r\n // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a\r\n // public parameter-less constructor.\r\n static create(connection, logger, protocol, reconnectPolicy) {\r\n return new HubConnection(connection, logger, protocol, reconnectPolicy);\r\n }\r\n /** Indicates the state of the {@link HubConnection} to the server. */\r\n get state() {\r\n return this._connectionState;\r\n }\r\n /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either\r\n * in the disconnected state or if the negotiation step was skipped.\r\n */\r\n get connectionId() {\r\n return this.connection ? (this.connection.connectionId || null) : null;\r\n }\r\n /** Indicates the url of the {@link HubConnection} to the server. */\r\n get baseUrl() {\r\n return this.connection.baseUrl || \"\";\r\n }\r\n /**\r\n * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or\r\n * Reconnecting states.\r\n * @param {string} url The url to connect to.\r\n */\r\n set baseUrl(url) {\r\n if (this._connectionState !== HubConnectionState.Disconnected && this._connectionState !== HubConnectionState.Reconnecting) {\r\n throw new Error(\"The HubConnection must be in the Disconnected or Reconnecting state to change the url.\");\r\n }\r\n if (!url) {\r\n throw new Error(\"The HubConnection url must be a valid url.\");\r\n }\r\n this.connection.baseUrl = url;\r\n }\r\n /** Starts the connection.\r\n *\r\n * @returns {Promise<void>} A Promise that resolves when the connection has been successfully established, or rejects with an error.\r\n */\r\n start() {\r\n this._startPromise = this._startWithStateTransitions();\r\n return this._startPromise;\r\n }\r\n async _startWithStateTransitions() {\r\n if (this._connectionState !== HubConnectionState.Disconnected) {\r\n return Promise.reject(new Error(\"Cannot start a HubConnection that is not in the 'Disconnected' state.\"));\r\n }\r\n this._connectionState = HubConnectionState.Connecting;\r\n this._logger.log(LogLevel.Debug, \"Starting HubConnection.\");\r\n try {\r\n await this._startInternal();\r\n if (Platform.isBrowser) {\r\n // Log when the browser freezes the tab so users know why their connection unexpectedly stopped working\r\n window.document.addEventListener(\"freeze\", this._freezeEventListener);\r\n }\r\n this._connectionState = HubConnectionState.Connected;\r\n this._connectionStarted = true;\r\n this._logger.log(LogLevel.Debug, \"HubConnection connected successfully.\");\r\n }\r\n catch (e) {\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._logger.log(LogLevel.Debug, `HubConnection failed to start successfully because of error '${e}'.`);\r\n return Promise.reject(e);\r\n }\r\n }\r\n async _startInternal() {\r\n this._stopDuringStartError = undefined;\r\n this._receivedHandshakeResponse = false;\r\n // Set up the promise before any connection is (re)started otherwise it could race with received messages\r\n const handshakePromise = new Promise((resolve, reject) => {\r\n this._handshakeResolver = resolve;\r\n this._handshakeRejecter = reject;\r\n });\r\n await this.connection.start(this._protocol.transferFormat);\r\n try {\r\n const handshakeRequest = {\r\n protocol: this._protocol.name,\r\n version: this._protocol.version,\r\n };\r\n this._logger.log(LogLevel.Debug, \"Sending handshake request.\");\r\n await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(handshakeRequest));\r\n this._logger.log(LogLevel.Information, `Using HubProtocol '${this._protocol.name}'.`);\r\n // defensively cleanup timeout in case we receive a message from the server before we finish start\r\n this._cleanupTimeout();\r\n this._resetTimeoutPeriod();\r\n this._resetKeepAliveInterval();\r\n await handshakePromise;\r\n // It's important to check the stopDuringStartError instead of just relying on the handshakePromise\r\n // being rejected on close, because this continuation can run after both the handshake completed successfully\r\n // and the connection was closed.\r\n if (this._stopDuringStartError) {\r\n // It's important to throw instead of returning a rejected promise, because we don't want to allow any state\r\n // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise\r\n // will cause the calling continuation to get scheduled to run later.\r\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\r\n throw this._stopDuringStartError;\r\n }\r\n if (!this.connection.features.inherentKeepAlive) {\r\n await this._sendMessage(this._cachedPingMessage);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Debug, `Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`);\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n // HttpConnection.stop() should not complete until after the onclose callback is invoked.\r\n // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes.\r\n await this.connection.stop(e);\r\n throw e;\r\n }\r\n }\r\n /** Stops the connection.\r\n *\r\n * @returns {Promise<void>} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.\r\n */\r\n async stop() {\r\n // Capture the start promise before the connection might be restarted in an onclose callback.\r\n const startPromise = this._startPromise;\r\n this._stopPromise = this._stopInternal();\r\n await this._stopPromise;\r\n try {\r\n // Awaiting undefined continues immediately\r\n await startPromise;\r\n }\r\n catch (e) {\r\n // This exception is returned to the user as a rejected Promise from the start method.\r\n }\r\n }\r\n _stopInternal(error) {\r\n if (this._connectionState === HubConnectionState.Disconnected) {\r\n this._logger.log(LogLevel.Debug, `Call to HubConnection.stop(${error}) ignored because it is already in the disconnected state.`);\r\n return Promise.resolve();\r\n }\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\r\n return this._stopPromise;\r\n }\r\n this._connectionState = HubConnectionState.Disconnecting;\r\n this._logger.log(LogLevel.Debug, \"Stopping HubConnection.\");\r\n if (this._reconnectDelayHandle) {\r\n // We're in a reconnect delay which means the underlying connection is currently already stopped.\r\n // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and\r\n // fire the onclose callbacks.\r\n this._logger.log(LogLevel.Debug, \"Connection stopped during reconnect delay. Done reconnecting.\");\r\n clearTimeout(this._reconnectDelayHandle);\r\n this._reconnectDelayHandle = undefined;\r\n this._completeClose();\r\n return Promise.resolve();\r\n }\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n this._stopDuringStartError = error || new AbortError(\"The connection was stopped before the hub handshake could complete.\");\r\n // HttpConnection.stop() should not complete until after either HttpConnection.start() fails\r\n // or the onclose callback is invoked. The onclose callback will transition the HubConnection\r\n // to the disconnected state if need be before HttpConnection.stop() completes.\r\n return this.connection.stop(error);\r\n }\r\n /** Invokes a streaming hub method on the server using the specified name and arguments.\r\n *\r\n * @typeparam T The type of the items returned by the server.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {IStreamResult<T>} An object that yields results from the server as they are received.\r\n */\r\n stream(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const invocationDescriptor = this._createStreamInvocation(methodName, args, streamIds);\r\n // eslint-disable-next-line prefer-const\r\n let promiseQueue;\r\n const subject = new Subject();\r\n subject.cancelCallback = () => {\r\n const cancelInvocation = this._createCancelInvocation(invocationDescriptor.invocationId);\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n return promiseQueue.then(() => {\r\n return this._sendWithProtocol(cancelInvocation);\r\n });\r\n };\r\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\r\n if (error) {\r\n subject.error(error);\r\n return;\r\n }\r\n else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n subject.error(new Error(invocationEvent.error));\r\n }\r\n else {\r\n subject.complete();\r\n }\r\n }\r\n else {\r\n subject.next((invocationEvent.item));\r\n }\r\n }\r\n };\r\n promiseQueue = this._sendWithProtocol(invocationDescriptor)\r\n .catch((e) => {\r\n subject.error(e);\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n });\r\n this._launchStreams(streams, promiseQueue);\r\n return subject;\r\n }\r\n _sendMessage(message) {\r\n this._resetKeepAliveInterval();\r\n return this.connection.send(message);\r\n }\r\n /**\r\n * Sends a js object to the server.\r\n * @param message The js object to serialize and send.\r\n */\r\n _sendWithProtocol(message) {\r\n return this._sendMessage(this._protocol.writeMessage(message));\r\n }\r\n /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.\r\n *\r\n * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still\r\n * be processing the invocation.\r\n *\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise<void>} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.\r\n */\r\n send(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const sendPromise = this._sendWithProtocol(this._createInvocation(methodName, args, true, streamIds));\r\n this._launchStreams(streams, sendPromise);\r\n return sendPromise;\r\n }\r\n /** Invokes a hub method on the server using the specified name and arguments.\r\n *\r\n * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise\r\n * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of\r\n * resolving the Promise.\r\n *\r\n * @typeparam T The expected return type.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise<T>} A Promise that resolves with the result of the server method (if any), or rejects with an error.\r\n */\r\n invoke(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const invocationDescriptor = this._createInvocation(methodName, args, false, streamIds);\r\n const p = new Promise((resolve, reject) => {\r\n // invocationId will always have a value for a non-blocking invocation\r\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\r\n if (error) {\r\n reject(error);\r\n return;\r\n }\r\n else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n reject(new Error(invocationEvent.error));\r\n }\r\n else {\r\n resolve(invocationEvent.result);\r\n }\r\n }\r\n else {\r\n reject(new Error(`Unexpected message type: ${invocationEvent.type}`));\r\n }\r\n }\r\n };\r\n const promiseQueue = this._sendWithProtocol(invocationDescriptor)\r\n .catch((e) => {\r\n reject(e);\r\n // invocationId will always have a value for a non-blocking invocation\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n });\r\n this._launchStreams(streams, promiseQueue);\r\n });\r\n return p;\r\n }\r\n on(methodName, newMethod) {\r\n if (!methodName || !newMethod) {\r\n return;\r\n }\r\n methodName = methodName.toLowerCase();\r\n if (!this._methods[methodName]) {\r\n this._methods[methodName] = [];\r\n }\r\n // Preventing adding the same handler multiple times.\r\n if (this._methods[methodName].indexOf(newMethod) !== -1) {\r\n return;\r\n }\r\n this._methods[methodName].push(newMethod);\r\n }\r\n off(methodName, method) {\r\n if (!methodName) {\r\n return;\r\n }\r\n methodName = methodName.toLowerCase();\r\n const handlers = this._methods[methodName];\r\n if (!handlers) {\r\n return;\r\n }\r\n if (method) {\r\n const removeIdx = handlers.indexOf(method);\r\n if (removeIdx !== -1) {\r\n handlers.splice(removeIdx, 1);\r\n if (handlers.length === 0) {\r\n delete this._methods[methodName];\r\n }\r\n }\r\n }\r\n else {\r\n delete this._methods[methodName];\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection is closed.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).\r\n */\r\n onclose(callback) {\r\n if (callback) {\r\n this._closedCallbacks.push(callback);\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection starts reconnecting.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).\r\n */\r\n onreconnecting(callback) {\r\n if (callback) {\r\n this._reconnectingCallbacks.push(callback);\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection successfully reconnects.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.\r\n */\r\n onreconnected(callback) {\r\n if (callback) {\r\n this._reconnectedCallbacks.push(callback);\r\n }\r\n }\r\n _processIncomingData(data) {\r\n this._cleanupTimeout();\r\n if (!this._receivedHandshakeResponse) {\r\n data = this._processHandshakeResponse(data);\r\n this._receivedHandshakeResponse = true;\r\n }\r\n // Data may have all been read when processing handshake response\r\n if (data) {\r\n // Parse the messages\r\n const messages = this._protocol.parseMessages(data, this._logger);\r\n for (const message of messages) {\r\n switch (message.type) {\r\n case MessageType.Invocation:\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._invokeClientMethod(message);\r\n break;\r\n case MessageType.StreamItem:\r\n case MessageType.Completion: {\r\n const callback = this._callbacks[message.invocationId];\r\n if (callback) {\r\n if (message.type === MessageType.Completion) {\r\n delete this._callbacks[message.invocationId];\r\n }\r\n try {\r\n callback(message);\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `Stream callback threw error: ${getErrorString(e)}`);\r\n }\r\n }\r\n break;\r\n }\r\n case MessageType.Ping:\r\n // Don't care about pings\r\n break;\r\n case MessageType.Close: {\r\n this._logger.log(LogLevel.Information, \"Close message received from server.\");\r\n const error = message.error ? new Error(\"Server returned an error on close: \" + message.error) : undefined;\r\n if (message.allowReconnect === true) {\r\n // It feels wrong not to await connection.stop() here, but processIncomingData is called as part of an onreceive callback which is not async,\r\n // this is already the behavior for serverTimeout(), and HttpConnection.Stop() should catch and log all possible exceptions.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.connection.stop(error);\r\n }\r\n else {\r\n // We cannot await stopInternal() here, but subsequent calls to stop() will await this if stopInternal() is still ongoing.\r\n this._stopPromise = this._stopInternal(error);\r\n }\r\n break;\r\n }\r\n default:\r\n this._logger.log(LogLevel.Warning, `Invalid message type: ${message.type}.`);\r\n break;\r\n }\r\n }\r\n }\r\n this._resetTimeoutPeriod();\r\n }\r\n _processHandshakeResponse(data) {\r\n let responseMessage;\r\n let remainingData;\r\n try {\r\n [remainingData, responseMessage] = this._handshakeProtocol.parseHandshakeResponse(data);\r\n }\r\n catch (e) {\r\n const message = \"Error parsing handshake response: \" + e;\r\n this._logger.log(LogLevel.Error, message);\r\n const error = new Error(message);\r\n this._handshakeRejecter(error);\r\n throw error;\r\n }\r\n if (responseMessage.error) {\r\n const message = \"Server returned handshake error: \" + responseMessage.error;\r\n this._logger.log(LogLevel.Error, message);\r\n const error = new Error(message);\r\n this._handshakeRejecter(error);\r\n throw error;\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, \"Server handshake complete.\");\r\n }\r\n this._handshakeResolver();\r\n return remainingData;\r\n }\r\n _resetKeepAliveInterval() {\r\n if (this.connection.features.inherentKeepAlive) {\r\n return;\r\n }\r\n // Set the time we want the next keep alive to be sent\r\n // Timer will be setup on next message receive\r\n this._nextKeepAlive = new Date().getTime() + this.keepAliveIntervalInMilliseconds;\r\n this._cleanupPingTimer();\r\n }\r\n _resetTimeoutPeriod() {\r\n if (!this.connection.features || !this.connection.features.inherentKeepAlive) {\r\n // Set the timeout timer\r\n this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);\r\n // Set keepAlive timer if there isn't one\r\n if (this._pingServerHandle === undefined) {\r\n let nextPing = this._nextKeepAlive - new Date().getTime();\r\n if (nextPing < 0) {\r\n nextPing = 0;\r\n }\r\n // The timer needs to be set from a networking callback to avoid Chrome timer throttling from causing timers to run once a minute\r\n this._pingServerHandle = setTimeout(async () => {\r\n if (this._connectionState === HubConnectionState.Connected) {\r\n try {\r\n await this._sendMessage(this._cachedPingMessage);\r\n }\r\n catch {\r\n // We don't care about the error. It should be seen elsewhere in the client.\r\n // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering\r\n this._cleanupPingTimer();\r\n }\r\n }\r\n }, nextPing);\r\n }\r\n }\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n serverTimeout() {\r\n // The server hasn't talked to us in a while. It doesn't like us anymore ... :(\r\n // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.connection.stop(new Error(\"Server timeout elapsed without receiving a message from the server.\"));\r\n }\r\n async _invokeClientMethod(invocationMessage) {\r\n const methodName = invocationMessage.target.toLowerCase();\r\n const methods = this._methods[methodName];\r\n if (!methods) {\r\n this._logger.log(LogLevel.Warning, `No client method with the name '${methodName}' found.`);\r\n // No handlers provided by client but the server is expecting a response still, so we send an error\r\n if (invocationMessage.invocationId) {\r\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\r\n await this._sendWithProtocol(this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null));\r\n }\r\n return;\r\n }\r\n // Avoid issues with handlers removing themselves thus modifying the list while iterating through it\r\n const methodsCopy = methods.slice();\r\n // Server expects a response\r\n const expectsResponse = invocationMessage.invocationId ? true : false;\r\n // We preserve the last result or exception but still call all handlers\r\n let res;\r\n let exception;\r\n let completionMessage;\r\n for (const m of methodsCopy) {\r\n try {\r\n const prevRes = res;\r\n res = await m.apply(this, invocationMessage.arguments);\r\n if (expectsResponse && res && prevRes) {\r\n this._logger.log(LogLevel.Error, `Multiple results provided for '${methodName}'. Sending error to server.`);\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `Client provided multiple results.`, null);\r\n }\r\n // Ignore exception if we got a result after, the exception will be logged\r\n exception = undefined;\r\n }\r\n catch (e) {\r\n exception = e;\r\n this._logger.log(LogLevel.Error, `A callback for the method '${methodName}' threw error '${e}'.`);\r\n }\r\n }\r\n if (completionMessage) {\r\n await this._sendWithProtocol(completionMessage);\r\n }\r\n else if (expectsResponse) {\r\n // If there is an exception that means either no result was given or a handler after a result threw\r\n if (exception) {\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `${exception}`, null);\r\n }\r\n else if (res !== undefined) {\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, null, res);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\r\n // Client didn't provide a result or throw from a handler, server expects a response so we send an error\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null);\r\n }\r\n await this._sendWithProtocol(completionMessage);\r\n }\r\n else {\r\n if (res) {\r\n this._logger.log(LogLevel.Error, `Result given for '${methodName}' method but server is not expecting a result.`);\r\n }\r\n }\r\n }\r\n _connectionClosed(error) {\r\n this._logger.log(LogLevel.Debug, `HubConnection.connectionClosed(${error}) called while in state ${this._connectionState}.`);\r\n // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet.\r\n this._stopDuringStartError = this._stopDuringStartError || error || new AbortError(\"The underlying connection was closed before the hub handshake could complete.\");\r\n // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it.\r\n // If it has already completed, this should just noop.\r\n if (this._handshakeResolver) {\r\n this._handshakeResolver();\r\n }\r\n this._cancelCallbacksWithError(error || new Error(\"Invocation canceled due to the underlying connection being closed.\"));\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._completeClose(error);\r\n }\r\n else if (this._connectionState === HubConnectionState.Connected && this._reconnectPolicy) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._reconnect(error);\r\n }\r\n else if (this._connectionState === HubConnectionState.Connected) {\r\n this._completeClose(error);\r\n }\r\n // If none of the above if conditions were true were called the HubConnection must be in either:\r\n // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it.\r\n // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt\r\n // and potentially continue the reconnect() loop.\r\n // 3. The Disconnected state in which case we're already done.\r\n }\r\n _completeClose(error) {\r\n if (this._connectionStarted) {\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n if (Platform.isBrowser) {\r\n window.document.removeEventListener(\"freeze\", this._freezeEventListener);\r\n }\r\n try {\r\n this._closedCallbacks.forEach((c) => c.apply(this, [error]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onclose callback called with error '${error}' threw error '${e}'.`);\r\n }\r\n }\r\n }\r\n async _reconnect(error) {\r\n const reconnectStartTime = Date.now();\r\n let previousReconnectAttempts = 0;\r\n let retryError = error !== undefined ? error : new Error(\"Attempting to reconnect due to a unknown error.\");\r\n let nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, 0, retryError);\r\n if (nextRetryDelay === null) {\r\n this._logger.log(LogLevel.Debug, \"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.\");\r\n this._completeClose(error);\r\n return;\r\n }\r\n this._connectionState = HubConnectionState.Reconnecting;\r\n if (error) {\r\n this._logger.log(LogLevel.Information, `Connection reconnecting because of error '${error}'.`);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Information, \"Connection reconnecting.\");\r\n }\r\n if (this._reconnectingCallbacks.length !== 0) {\r\n try {\r\n this._reconnectingCallbacks.forEach((c) => c.apply(this, [error]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onreconnecting callback called with error '${error}' threw error '${e}'.`);\r\n }\r\n // Exit early if an onreconnecting callback called connection.stop().\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.\");\r\n return;\r\n }\r\n }\r\n while (nextRetryDelay !== null) {\r\n this._logger.log(LogLevel.Information, `Reconnect attempt number ${previousReconnectAttempts} will start in ${nextRetryDelay} ms.`);\r\n await new Promise((resolve) => {\r\n this._reconnectDelayHandle = setTimeout(resolve, nextRetryDelay);\r\n });\r\n this._reconnectDelayHandle = undefined;\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state during reconnect delay. Done reconnecting.\");\r\n return;\r\n }\r\n try {\r\n await this._startInternal();\r\n this._connectionState = HubConnectionState.Connected;\r\n this._logger.log(LogLevel.Information, \"HubConnection reconnected successfully.\");\r\n if (this._reconnectedCallbacks.length !== 0) {\r\n try {\r\n this._reconnectedCallbacks.forEach((c) => c.apply(this, [this.connection.connectionId]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`);\r\n }\r\n }\r\n return;\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Information, `Reconnect attempt failed because of error '${e}'.`);\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`);\r\n // The TypeScript compiler thinks that connectionState must be Connected here. The TypeScript compiler is wrong.\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._completeClose();\r\n }\r\n return;\r\n }\r\n retryError = e instanceof Error ? e : new Error(e.toString());\r\n nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);\r\n }\r\n }\r\n this._logger.log(LogLevel.Information, `Reconnect retries have been exhausted after ${Date.now() - reconnectStartTime} ms and ${previousReconnectAttempts} failed attempts. Connection disconnecting.`);\r\n this._completeClose();\r\n }\r\n _getNextRetryDelay(previousRetryCount, elapsedMilliseconds, retryReason) {\r\n try {\r\n return this._reconnectPolicy.nextRetryDelayInMilliseconds({\r\n elapsedMilliseconds,\r\n previousRetryCount,\r\n retryReason,\r\n });\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${previousRetryCount}, ${elapsedMilliseconds}) threw error '${e}'.`);\r\n return null;\r\n }\r\n }\r\n _cancelCallbacksWithError(error) {\r\n const callbacks = this._callbacks;\r\n this._callbacks = {};\r\n Object.keys(callbacks)\r\n .forEach((key) => {\r\n const callback = callbacks[key];\r\n try {\r\n callback(null, error);\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `Stream 'error' callback called with '${error}' threw error: ${getErrorString(e)}`);\r\n }\r\n });\r\n }\r\n _cleanupPingTimer() {\r\n if (this._pingServerHandle) {\r\n clearTimeout(this._pingServerHandle);\r\n this._pingServerHandle = undefined;\r\n }\r\n }\r\n _cleanupTimeout() {\r\n if (this._timeoutHandle) {\r\n clearTimeout(this._timeoutHandle);\r\n }\r\n }\r\n _createInvocation(methodName, args, nonblocking, streamIds) {\r\n if (nonblocking) {\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n else {\r\n const invocationId = this._invocationId;\r\n this._invocationId++;\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n }\r\n _launchStreams(streams, promiseQueue) {\r\n if (streams.length === 0) {\r\n return;\r\n }\r\n // Synchronize stream data so they arrive in-order on the server\r\n if (!promiseQueue) {\r\n promiseQueue = Promise.resolve();\r\n }\r\n // We want to iterate over the keys, since the keys are the stream ids\r\n // eslint-disable-next-line guard-for-in\r\n for (const streamId in streams) {\r\n streams[streamId].subscribe({\r\n complete: () => {\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId)));\r\n },\r\n error: (err) => {\r\n let message;\r\n if (err instanceof Error) {\r\n message = err.message;\r\n }\r\n else if (err && err.toString) {\r\n message = err.toString();\r\n }\r\n else {\r\n message = \"Unknown error\";\r\n }\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId, message)));\r\n },\r\n next: (item) => {\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createStreamItemMessage(streamId, item)));\r\n },\r\n });\r\n }\r\n }\r\n _replaceStreamingParams(args) {\r\n const streams = [];\r\n const streamIds = [];\r\n for (let i = 0; i < args.length; i++) {\r\n const argument = args[i];\r\n if (this._isObservable(argument)) {\r\n const streamId = this._invocationId;\r\n this._invocationId++;\r\n // Store the stream for later use\r\n streams[streamId] = argument;\r\n streamIds.push(streamId.toString());\r\n // remove stream from args\r\n args.splice(i, 1);\r\n }\r\n }\r\n return [streams, streamIds];\r\n }\r\n _isObservable(arg) {\r\n // This allows other stream implementations to just work (like rxjs)\r\n return arg && arg.subscribe && typeof arg.subscribe === \"function\";\r\n }\r\n _createStreamInvocation(methodName, args, streamIds) {\r\n const invocationId = this._invocationId;\r\n this._invocationId++;\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n }\r\n _createCancelInvocation(id) {\r\n return {\r\n invocationId: id,\r\n type: MessageType.CancelInvocation,\r\n };\r\n }\r\n _createStreamItemMessage(id, item) {\r\n return {\r\n invocationId: id,\r\n item,\r\n type: MessageType.StreamItem,\r\n };\r\n }\r\n _createCompletionMessage(id, error, result) {\r\n if (error) {\r\n return {\r\n error,\r\n invocationId: id,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n return {\r\n invocationId: id,\r\n result,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n}\r\n//# sourceMappingURL=HubConnection.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** A logger that does nothing when log messages are sent to it. */\r\nexport class NullLogger {\r\n constructor() { }\r\n /** @inheritDoc */\r\n // eslint-disable-next-line\r\n log(_logLevel, _message) {\r\n }\r\n}\r\n/** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */\r\nNullLogger.instance = new NullLogger();\r\n//# sourceMappingURL=Loggers.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { NullLogger } from \"./Loggers\";\r\n// Version token that will be replaced by the prepack command\r\n/** The version of the SignalR client. */\r\nexport const VERSION = \"7.0.0\";\r\n/** @private */\r\nexport class Arg {\r\n static isRequired(val, name) {\r\n if (val === null || val === undefined) {\r\n throw new Error(`The '${name}' argument is required.`);\r\n }\r\n }\r\n static isNotEmpty(val, name) {\r\n if (!val || val.match(/^\\s*$/)) {\r\n throw new Error(`The '${name}' argument should not be empty.`);\r\n }\r\n }\r\n static isIn(val, values, name) {\r\n // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.\r\n if (!(val in values)) {\r\n throw new Error(`Unknown ${name} value: ${val}.`);\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport class Platform {\r\n // react-native has a window but no document so we should check both\r\n static get isBrowser() {\r\n return typeof window === \"object\" && typeof window.document === \"object\";\r\n }\r\n // WebWorkers don't have a window object so the isBrowser check would fail\r\n static get isWebWorker() {\r\n return typeof self === \"object\" && \"importScripts\" in self;\r\n }\r\n // react-native has a window but no document\r\n static get isReactNative() {\r\n return typeof window === \"object\" && typeof window.document === \"undefined\";\r\n }\r\n // Node apps shouldn't have a window object, but WebWorkers don't either\r\n // so we need to check for both WebWorker and window\r\n static get isNode() {\r\n return !this.isBrowser && !this.isWebWorker && !this.isReactNative;\r\n }\r\n}\r\n/** @private */\r\nexport function getDataDetail(data, includeContent) {\r\n let detail = \"\";\r\n if (isArrayBuffer(data)) {\r\n detail = `Binary data of length ${data.byteLength}`;\r\n if (includeContent) {\r\n detail += `. Content: '${formatArrayBuffer(data)}'`;\r\n }\r\n }\r\n else if (typeof data === \"string\") {\r\n detail = `String data of length ${data.length}`;\r\n if (includeContent) {\r\n detail += `. Content: '${data}'`;\r\n }\r\n }\r\n return detail;\r\n}\r\n/** @private */\r\nexport function formatArrayBuffer(data) {\r\n const view = new Uint8Array(data);\r\n // Uint8Array.map only supports returning another Uint8Array?\r\n let str = \"\";\r\n view.forEach((num) => {\r\n const pad = num < 16 ? \"0\" : \"\";\r\n str += `0x${pad}${num.toString(16)} `;\r\n });\r\n // Trim of trailing space.\r\n return str.substr(0, str.length - 1);\r\n}\r\n// Also in signalr-protocol-msgpack/Utils.ts\r\n/** @private */\r\nexport function isArrayBuffer(val) {\r\n return val && typeof ArrayBuffer !== \"undefined\" &&\r\n (val instanceof ArrayBuffer ||\r\n // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof\r\n (val.constructor && val.constructor.name === \"ArrayBuffer\"));\r\n}\r\n/** @private */\r\nexport async function sendMessage(logger, transportName, httpClient, url, content, options) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n logger.log(LogLevel.Trace, `(${transportName} transport) sending data. ${getDataDetail(content, options.logMessageContent)}.`);\r\n const responseType = isArrayBuffer(content) ? \"arraybuffer\" : \"text\";\r\n const response = await httpClient.post(url, {\r\n content,\r\n headers: { ...headers, ...options.headers },\r\n responseType,\r\n timeout: options.timeout,\r\n withCredentials: options.withCredentials,\r\n });\r\n logger.log(LogLevel.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`);\r\n}\r\n/** @private */\r\nexport function createLogger(logger) {\r\n if (logger === undefined) {\r\n return new ConsoleLogger(LogLevel.Information);\r\n }\r\n if (logger === null) {\r\n return NullLogger.instance;\r\n }\r\n if (logger.log !== undefined) {\r\n return logger;\r\n }\r\n return new ConsoleLogger(logger);\r\n}\r\n/** @private */\r\nexport class SubjectSubscription {\r\n constructor(subject, observer) {\r\n this._subject = subject;\r\n this._observer = observer;\r\n }\r\n dispose() {\r\n const index = this._subject.observers.indexOf(this._observer);\r\n if (index > -1) {\r\n this._subject.observers.splice(index, 1);\r\n }\r\n if (this._subject.observers.length === 0 && this._subject.cancelCallback) {\r\n this._subject.cancelCallback().catch((_) => { });\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport class ConsoleLogger {\r\n constructor(minimumLogLevel) {\r\n this._minLevel = minimumLogLevel;\r\n this.out = console;\r\n }\r\n log(logLevel, message) {\r\n if (logLevel >= this._minLevel) {\r\n const msg = `[${new Date().toISOString()}] ${LogLevel[logLevel]}: ${message}`;\r\n switch (logLevel) {\r\n case LogLevel.Critical:\r\n case LogLevel.Error:\r\n this.out.error(msg);\r\n break;\r\n case LogLevel.Warning:\r\n this.out.warn(msg);\r\n break;\r\n case LogLevel.Information:\r\n this.out.info(msg);\r\n break;\r\n default:\r\n // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug\r\n this.out.log(msg);\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport function getUserAgentHeader() {\r\n let userAgentHeaderName = \"X-SignalR-User-Agent\";\r\n if (Platform.isNode) {\r\n userAgentHeaderName = \"User-Agent\";\r\n }\r\n return [userAgentHeaderName, constructUserAgent(VERSION, getOsName(), getRuntime(), getRuntimeVersion())];\r\n}\r\n/** @private */\r\nexport function constructUserAgent(version, os, runtime, runtimeVersion) {\r\n // Microsoft SignalR/[Version] ([Detailed Version]; [Operating System]; [Runtime]; [Runtime Version])\r\n let userAgent = \"Microsoft SignalR/\";\r\n const majorAndMinor = version.split(\".\");\r\n userAgent += `${majorAndMinor[0]}.${majorAndMinor[1]}`;\r\n userAgent += ` (${version}; `;\r\n if (os && os !== \"\") {\r\n userAgent += `${os}; `;\r\n }\r\n else {\r\n userAgent += \"Unknown OS; \";\r\n }\r\n userAgent += `${runtime}`;\r\n if (runtimeVersion) {\r\n userAgent += `; ${runtimeVersion}`;\r\n }\r\n else {\r\n userAgent += \"; Unknown Runtime Version\";\r\n }\r\n userAgent += \")\";\r\n return userAgent;\r\n}\r\n// eslint-disable-next-line spaced-comment\r\n/*#__PURE__*/ function getOsName() {\r\n if (Platform.isNode) {\r\n switch (process.platform) {\r\n case \"win32\":\r\n return \"Windows NT\";\r\n case \"darwin\":\r\n return \"macOS\";\r\n case \"linux\":\r\n return \"Linux\";\r\n default:\r\n return process.platform;\r\n }\r\n }\r\n else {\r\n return \"\";\r\n }\r\n}\r\n// eslint-disable-next-line spaced-comment\r\n/*#__PURE__*/ function getRuntimeVersion() {\r\n if (Platform.isNode) {\r\n return process.versions.node;\r\n }\r\n return undefined;\r\n}\r\nfunction getRuntime() {\r\n if (Platform.isNode) {\r\n return \"NodeJS\";\r\n }\r\n else {\r\n return \"Browser\";\r\n }\r\n}\r\n/** @private */\r\nexport function getErrorString(e) {\r\n if (e.stack) {\r\n return e.stack;\r\n }\r\n else if (e.message) {\r\n return e.message;\r\n }\r\n return `${e}`;\r\n}\r\n/** @private */\r\nexport function getGlobalThis() {\r\n // globalThis is semi-new and not available in Node until v12\r\n if (typeof globalThis !== \"undefined\") {\r\n return globalThis;\r\n }\r\n if (typeof self !== \"undefined\") {\r\n return self;\r\n }\r\n if (typeof window !== \"undefined\") {\r\n return window;\r\n }\r\n if (typeof global !== \"undefined\") {\r\n return global;\r\n }\r\n throw new Error(\"could not find global\");\r\n}\r\n//# sourceMappingURL=Utils.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { Platform, getGlobalThis, isArrayBuffer } from \"./Utils\";\r\nexport class FetchHttpClient extends HttpClient {\r\n constructor(logger) {\r\n super();\r\n this._logger = logger;\r\n if (typeof fetch === \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n // Cookies aren't automatically handled in Node so we need to add a CookieJar to preserve cookies across requests\r\n this._jar = new (requireFunc(\"tough-cookie\")).CookieJar();\r\n this._fetchType = requireFunc(\"node-fetch\");\r\n // node-fetch doesn't have a nice API for getting and setting cookies\r\n // fetch-cookie will wrap a fetch implementation with a default CookieJar or a provided one\r\n this._fetchType = requireFunc(\"fetch-cookie\")(this._fetchType, this._jar);\r\n }\r\n else {\r\n this._fetchType = fetch.bind(getGlobalThis());\r\n }\r\n if (typeof AbortController === \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n // Node needs EventListener methods on AbortController which our custom polyfill doesn't provide\r\n this._abortControllerType = requireFunc(\"abort-controller\");\r\n }\r\n else {\r\n this._abortControllerType = AbortController;\r\n }\r\n }\r\n /** @inheritDoc */\r\n async send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n throw new AbortError();\r\n }\r\n if (!request.method) {\r\n throw new Error(\"No method defined.\");\r\n }\r\n if (!request.url) {\r\n throw new Error(\"No url defined.\");\r\n }\r\n const abortController = new this._abortControllerType();\r\n let error;\r\n // Hook our abortSignal into the abort controller\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = () => {\r\n abortController.abort();\r\n error = new AbortError();\r\n };\r\n }\r\n // If a timeout has been passed in, setup a timeout to call abort\r\n // Type needs to be any to fit window.setTimeout and NodeJS.setTimeout\r\n let timeoutId = null;\r\n if (request.timeout) {\r\n const msTimeout = request.timeout;\r\n timeoutId = setTimeout(() => {\r\n abortController.abort();\r\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\r\n error = new TimeoutError();\r\n }, msTimeout);\r\n }\r\n if (request.content === \"\") {\r\n request.content = undefined;\r\n }\r\n if (request.content) {\r\n // Explicitly setting the Content-Type header for React Native on Android platform.\r\n request.headers = request.headers || {};\r\n if (isArrayBuffer(request.content)) {\r\n request.headers[\"Content-Type\"] = \"application/octet-stream\";\r\n }\r\n else {\r\n request.headers[\"Content-Type\"] = \"text/plain;charset=UTF-8\";\r\n }\r\n }\r\n let response;\r\n try {\r\n response = await this._fetchType(request.url, {\r\n body: request.content,\r\n cache: \"no-cache\",\r\n credentials: request.withCredentials === true ? \"include\" : \"same-origin\",\r\n headers: {\r\n \"X-Requested-With\": \"XMLHttpRequest\",\r\n ...request.headers,\r\n },\r\n method: request.method,\r\n mode: \"cors\",\r\n redirect: \"follow\",\r\n signal: abortController.signal,\r\n });\r\n }\r\n catch (e) {\r\n if (error) {\r\n throw error;\r\n }\r\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${e}.`);\r\n throw e;\r\n }\r\n finally {\r\n if (timeoutId) {\r\n clearTimeout(timeoutId);\r\n }\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = null;\r\n }\r\n }\r\n if (!response.ok) {\r\n const errorMessage = await deserializeContent(response, \"text\");\r\n throw new HttpError(errorMessage || response.statusText, response.status);\r\n }\r\n const content = deserializeContent(response, request.responseType);\r\n const payload = await content;\r\n return new HttpResponse(response.status, response.statusText, payload);\r\n }\r\n getCookieString(url) {\r\n let cookies = \"\";\r\n if (Platform.isNode && this._jar) {\r\n // @ts-ignore: unused variable\r\n this._jar.getCookies(url, (e, c) => cookies = c.join(\"; \"));\r\n }\r\n return cookies;\r\n }\r\n}\r\nfunction deserializeContent(response, responseType) {\r\n let content;\r\n switch (responseType) {\r\n case \"arraybuffer\":\r\n content = response.arrayBuffer();\r\n break;\r\n case \"text\":\r\n content = response.text();\r\n break;\r\n case \"blob\":\r\n case \"document\":\r\n case \"json\":\r\n throw new Error(`${responseType} is not supported.`);\r\n default:\r\n content = response.text();\r\n break;\r\n }\r\n return content;\r\n}\r\n//# sourceMappingURL=FetchHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\nexport class XhrHttpClient extends HttpClient {\r\n constructor(logger) {\r\n super();\r\n this._logger = logger;\r\n }\r\n /** @inheritDoc */\r\n send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(request.method, request.url, true);\r\n xhr.withCredentials = request.withCredentials === undefined ? true : request.withCredentials;\r\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\r\n if (request.content === \"\") {\r\n request.content = undefined;\r\n }\r\n if (request.content) {\r\n // Explicitly setting the Content-Type header for React Native on Android platform.\r\n if (isArrayBuffer(request.content)) {\r\n xhr.setRequestHeader(\"Content-Type\", \"application/octet-stream\");\r\n }\r\n else {\r\n xhr.setRequestHeader(\"Content-Type\", \"text/plain;charset=UTF-8\");\r\n }\r\n }\r\n const headers = request.headers;\r\n if (headers) {\r\n Object.keys(headers)\r\n .forEach((header) => {\r\n xhr.setRequestHeader(header, headers[header]);\r\n });\r\n }\r\n if (request.responseType) {\r\n xhr.responseType = request.responseType;\r\n }\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = () => {\r\n xhr.abort();\r\n reject(new AbortError());\r\n };\r\n }\r\n if (request.timeout) {\r\n xhr.timeout = request.timeout;\r\n }\r\n xhr.onload = () => {\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = null;\r\n }\r\n if (xhr.status >= 200 && xhr.status < 300) {\r\n resolve(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));\r\n }\r\n else {\r\n reject(new HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));\r\n }\r\n };\r\n xhr.onerror = () => {\r\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${xhr.status}: ${xhr.statusText}.`);\r\n reject(new HttpError(xhr.statusText, xhr.status));\r\n };\r\n xhr.ontimeout = () => {\r\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\r\n reject(new TimeoutError());\r\n };\r\n xhr.send(request.content);\r\n });\r\n }\r\n}\r\n//# sourceMappingURL=XhrHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError } from \"./Errors\";\r\nimport { FetchHttpClient } from \"./FetchHttpClient\";\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { Platform } from \"./Utils\";\r\nimport { XhrHttpClient } from \"./XhrHttpClient\";\r\n/** Default implementation of {@link @microsoft/signalr.HttpClient}. */\r\nexport class DefaultHttpClient extends HttpClient {\r\n /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */\r\n constructor(logger) {\r\n super();\r\n if (typeof fetch !== \"undefined\" || Platform.isNode) {\r\n this._httpClient = new FetchHttpClient(logger);\r\n }\r\n else if (typeof XMLHttpRequest !== \"undefined\") {\r\n this._httpClient = new XhrHttpClient(logger);\r\n }\r\n else {\r\n throw new Error(\"No usable HttpClient found.\");\r\n }\r\n }\r\n /** @inheritDoc */\r\n send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n return this._httpClient.send(request);\r\n }\r\n getCookieString(url) {\r\n return this._httpClient.getCookieString(url);\r\n }\r\n}\r\n//# sourceMappingURL=DefaultHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\r\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\r\n// it's a very new API right now.\r\n// Not exported from index.\r\n/** @private */\r\nexport class AbortController {\r\n constructor() {\r\n this._isAborted = false;\r\n this.onabort = null;\r\n }\r\n abort() {\r\n if (!this._isAborted) {\r\n this._isAborted = true;\r\n if (this.onabort) {\r\n this.onabort();\r\n }\r\n }\r\n }\r\n get signal() {\r\n return this;\r\n }\r\n get aborted() {\r\n return this._isAborted;\r\n }\r\n}\r\n//# sourceMappingURL=AbortController.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortController } from \"./AbortController\";\r\nimport { HttpError, TimeoutError } from \"./Errors\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, sendMessage } from \"./Utils\";\r\n// Not exported from 'index', this type is internal.\r\n/** @private */\r\nexport class LongPollingTransport {\r\n constructor(httpClient, logger, options) {\r\n this._httpClient = httpClient;\r\n this._logger = logger;\r\n this._pollAbort = new AbortController();\r\n this._options = options;\r\n this._running = false;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n // This is an internal type, not exported from 'index' so this is really just internal.\r\n get pollAborted() {\r\n return this._pollAbort.aborted;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._url = url;\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Connecting.\");\r\n // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property)\r\n if (transferFormat === TransferFormat.Binary &&\r\n (typeof XMLHttpRequest !== \"undefined\" && typeof new XMLHttpRequest().responseType !== \"string\")) {\r\n throw new Error(\"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.\");\r\n }\r\n const [name, value] = getUserAgentHeader();\r\n const headers = { [name]: value, ...this._options.headers };\r\n const pollOptions = {\r\n abortSignal: this._pollAbort.signal,\r\n headers,\r\n timeout: 100000,\r\n withCredentials: this._options.withCredentials,\r\n };\r\n if (transferFormat === TransferFormat.Binary) {\r\n pollOptions.responseType = \"arraybuffer\";\r\n }\r\n // Make initial long polling request\r\n // Server uses first long polling request to finish initializing connection and it returns without data\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this._httpClient.get(pollUrl, pollOptions);\r\n if (response.statusCode !== 200) {\r\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n // Mark running as false so that the poll immediately ends and runs the close logic\r\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this._running = false;\r\n }\r\n else {\r\n this._running = true;\r\n }\r\n this._receiving = this._poll(this._url, pollOptions);\r\n }\r\n async _poll(url, pollOptions) {\r\n try {\r\n while (this._running) {\r\n try {\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this._httpClient.get(pollUrl, pollOptions);\r\n if (response.statusCode === 204) {\r\n this._logger.log(LogLevel.Information, \"(LongPolling transport) Poll terminated by server.\");\r\n this._running = false;\r\n }\r\n else if (response.statusCode !== 200) {\r\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n // Unexpected status code\r\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this._running = false;\r\n }\r\n else {\r\n // Process the response\r\n if (response.content) {\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this._options.logMessageContent)}.`);\r\n if (this.onreceive) {\r\n this.onreceive(response.content);\r\n }\r\n }\r\n else {\r\n // This is another way timeout manifest.\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n }\r\n }\r\n }\r\n catch (e) {\r\n if (!this._running) {\r\n // Log but disregard errors that occur after stopping\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) Poll errored after shutdown: ${e.message}`);\r\n }\r\n else {\r\n if (e instanceof TimeoutError) {\r\n // Ignore timeouts and reissue the poll.\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n }\r\n else {\r\n // Close the connection with the error as the result.\r\n this._closeError = e;\r\n this._running = false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Polling complete.\");\r\n // We will reach here with pollAborted==false when the server returned a response causing the transport to stop.\r\n // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent.\r\n if (!this.pollAborted) {\r\n this._raiseOnClose();\r\n }\r\n }\r\n }\r\n async send(data) {\r\n if (!this._running) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this._logger, \"LongPolling\", this._httpClient, this._url, data, this._options);\r\n }\r\n async stop() {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stopping polling.\");\r\n // Tell receiving loop to stop, abort any current request, and then wait for it to finish\r\n this._running = false;\r\n this._pollAbort.abort();\r\n try {\r\n await this._receiving;\r\n // Send DELETE to clean up long polling on the server\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n const deleteOptions = {\r\n headers: { ...headers, ...this._options.headers },\r\n timeout: this._options.timeout,\r\n withCredentials: this._options.withCredentials,\r\n };\r\n await this._httpClient.delete(this._url, deleteOptions);\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) DELETE request sent.\");\r\n }\r\n finally {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stop finished.\");\r\n // Raise close event here instead of in polling\r\n // It needs to happen after the DELETE request is sent\r\n this._raiseOnClose();\r\n }\r\n }\r\n _raiseOnClose() {\r\n if (this.onclose) {\r\n let logMessage = \"(LongPolling transport) Firing onclose event.\";\r\n if (this._closeError) {\r\n logMessage += \" Error: \" + this._closeError;\r\n }\r\n this._logger.log(LogLevel.Trace, logMessage);\r\n this.onclose(this._closeError);\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=LongPollingTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, Platform, sendMessage } from \"./Utils\";\r\n/** @private */\r\nexport class ServerSentEventsTransport {\r\n constructor(httpClient, accessToken, logger, options) {\r\n this._httpClient = httpClient;\r\n this._accessToken = accessToken;\r\n this._logger = logger;\r\n this._options = options;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Trace, \"(SSE transport) Connecting.\");\r\n // set url before accessTokenFactory because this._url is only for send and we set the auth header instead of the query string for send\r\n this._url = url;\r\n if (this._accessToken) {\r\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(this._accessToken)}`;\r\n }\r\n return new Promise((resolve, reject) => {\r\n let opened = false;\r\n if (transferFormat !== TransferFormat.Text) {\r\n reject(new Error(\"The Server-Sent Events transport only supports the 'Text' transfer format\"));\r\n return;\r\n }\r\n let eventSource;\r\n if (Platform.isBrowser || Platform.isWebWorker) {\r\n eventSource = new this._options.EventSource(url, { withCredentials: this._options.withCredentials });\r\n }\r\n else {\r\n // Non-browser passes cookies via the dictionary\r\n const cookies = this._httpClient.getCookieString(url);\r\n const headers = {};\r\n headers.Cookie = cookies;\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n eventSource = new this._options.EventSource(url, { withCredentials: this._options.withCredentials, headers: { ...headers, ...this._options.headers } });\r\n }\r\n try {\r\n eventSource.onmessage = (e) => {\r\n if (this.onreceive) {\r\n try {\r\n this._logger.log(LogLevel.Trace, `(SSE transport) data received. ${getDataDetail(e.data, this._options.logMessageContent)}.`);\r\n this.onreceive(e.data);\r\n }\r\n catch (error) {\r\n this._close(error);\r\n return;\r\n }\r\n }\r\n };\r\n // @ts-ignore: not using event on purpose\r\n eventSource.onerror = (e) => {\r\n // EventSource doesn't give any useful information about server side closes.\r\n if (opened) {\r\n this._close();\r\n }\r\n else {\r\n reject(new Error(\"EventSource failed to connect. The connection could not be found on the server,\"\r\n + \" either the connection ID is not present on the server, or a proxy is refusing/buffering the connection.\"\r\n + \" If you have multiple servers check that sticky sessions are enabled.\"));\r\n }\r\n };\r\n eventSource.onopen = () => {\r\n this._logger.log(LogLevel.Information, `SSE connected to ${this._url}`);\r\n this._eventSource = eventSource;\r\n opened = true;\r\n resolve();\r\n };\r\n }\r\n catch (e) {\r\n reject(e);\r\n return;\r\n }\r\n });\r\n }\r\n async send(data) {\r\n if (!this._eventSource) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this._logger, \"SSE\", this._httpClient, this._url, data, this._options);\r\n }\r\n stop() {\r\n this._close();\r\n return Promise.resolve();\r\n }\r\n _close(e) {\r\n if (this._eventSource) {\r\n this._eventSource.close();\r\n this._eventSource = undefined;\r\n if (this.onclose) {\r\n this.onclose(e);\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=ServerSentEventsTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HeaderNames } from \"./HeaderNames\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, Platform } from \"./Utils\";\r\n/** @private */\r\nexport class WebSocketTransport {\r\n constructor(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor, headers) {\r\n this._logger = logger;\r\n this._accessTokenFactory = accessTokenFactory;\r\n this._logMessageContent = logMessageContent;\r\n this._webSocketConstructor = webSocketConstructor;\r\n this._httpClient = httpClient;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n this._headers = headers;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) Connecting.\");\r\n let token;\r\n if (this._accessTokenFactory) {\r\n token = await this._accessTokenFactory();\r\n }\r\n return new Promise((resolve, reject) => {\r\n url = url.replace(/^http/, \"ws\");\r\n let webSocket;\r\n const cookies = this._httpClient.getCookieString(url);\r\n let opened = false;\r\n if (Platform.isNode || Platform.isReactNative) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n if (token) {\r\n headers[HeaderNames.Authorization] = `Bearer ${token}`;\r\n }\r\n if (cookies) {\r\n headers[HeaderNames.Cookie] = cookies;\r\n }\r\n // Only pass headers when in non-browser environments\r\n webSocket = new this._webSocketConstructor(url, undefined, {\r\n headers: { ...headers, ...this._headers },\r\n });\r\n }\r\n else {\r\n if (token) {\r\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(token)}`;\r\n }\r\n }\r\n if (!webSocket) {\r\n // Chrome is not happy with passing 'undefined' as protocol\r\n webSocket = new this._webSocketConstructor(url);\r\n }\r\n if (transferFormat === TransferFormat.Binary) {\r\n webSocket.binaryType = \"arraybuffer\";\r\n }\r\n webSocket.onopen = (_event) => {\r\n this._logger.log(LogLevel.Information, `WebSocket connected to ${url}.`);\r\n this._webSocket = webSocket;\r\n opened = true;\r\n resolve();\r\n };\r\n webSocket.onerror = (event) => {\r\n let error = null;\r\n // ErrorEvent is a browser only type we need to check if the type exists before using it\r\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\r\n error = event.error;\r\n }\r\n else {\r\n error = \"There was an error with the transport\";\r\n }\r\n this._logger.log(LogLevel.Information, `(WebSockets transport) ${error}.`);\r\n };\r\n webSocket.onmessage = (message) => {\r\n this._logger.log(LogLevel.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this._logMessageContent)}.`);\r\n if (this.onreceive) {\r\n try {\r\n this.onreceive(message.data);\r\n }\r\n catch (error) {\r\n this._close(error);\r\n return;\r\n }\r\n }\r\n };\r\n webSocket.onclose = (event) => {\r\n // Don't call close handler if connection was never established\r\n // We'll reject the connect call instead\r\n if (opened) {\r\n this._close(event);\r\n }\r\n else {\r\n let error = null;\r\n // ErrorEvent is a browser only type we need to check if the type exists before using it\r\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\r\n error = event.error;\r\n }\r\n else {\r\n error = \"WebSocket failed to connect. The connection could not be found on the server,\"\r\n + \" either the endpoint may not be a SignalR endpoint,\"\r\n + \" the connection ID is not present on the server, or there is a proxy blocking WebSockets.\"\r\n + \" If you have multiple servers check that sticky sessions are enabled.\";\r\n }\r\n reject(new Error(error));\r\n }\r\n };\r\n });\r\n }\r\n send(data) {\r\n if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {\r\n this._logger.log(LogLevel.Trace, `(WebSockets transport) sending data. ${getDataDetail(data, this._logMessageContent)}.`);\r\n this._webSocket.send(data);\r\n return Promise.resolve();\r\n }\r\n return Promise.reject(\"WebSocket is not in the OPEN state\");\r\n }\r\n stop() {\r\n if (this._webSocket) {\r\n // Manually invoke onclose callback inline so we know the HttpConnection was closed properly before returning\r\n // This also solves an issue where websocket.onclose could take 18+ seconds to trigger during network disconnects\r\n this._close(undefined);\r\n }\r\n return Promise.resolve();\r\n }\r\n _close(event) {\r\n // webSocket will be null if the transport did not start successfully\r\n if (this._webSocket) {\r\n // Clear websocket handlers because we are considering the socket closed now\r\n this._webSocket.onclose = () => { };\r\n this._webSocket.onmessage = () => { };\r\n this._webSocket.onerror = () => { };\r\n this._webSocket.close();\r\n this._webSocket = undefined;\r\n }\r\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) socket closed.\");\r\n if (this.onclose) {\r\n if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1000)) {\r\n this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason || \"no reason given\"}).`));\r\n }\r\n else if (event instanceof Error) {\r\n this.onclose(event);\r\n }\r\n else {\r\n this.onclose();\r\n }\r\n }\r\n }\r\n _isCloseEvent(event) {\r\n return event && typeof event.wasClean === \"boolean\" && typeof event.code === \"number\";\r\n }\r\n}\r\n//# sourceMappingURL=WebSocketTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AccessTokenHttpClient } from \"./AccessTokenHttpClient\";\r\nimport { DefaultHttpClient } from \"./DefaultHttpClient\";\r\nimport { AggregateErrors, DisabledTransportError, FailedToNegotiateWithServerError, FailedToStartTransportError, HttpError, UnsupportedTransportError, AbortError } from \"./Errors\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { HttpTransportType, TransferFormat } from \"./ITransport\";\r\nimport { LongPollingTransport } from \"./LongPollingTransport\";\r\nimport { ServerSentEventsTransport } from \"./ServerSentEventsTransport\";\r\nimport { Arg, createLogger, getUserAgentHeader, Platform } from \"./Utils\";\r\nimport { WebSocketTransport } from \"./WebSocketTransport\";\r\nconst MAX_REDIRECTS = 100;\r\n/** @private */\r\nexport class HttpConnection {\r\n constructor(url, options = {}) {\r\n this._stopPromiseResolver = () => { };\r\n this.features = {};\r\n this._negotiateVersion = 1;\r\n Arg.isRequired(url, \"url\");\r\n this._logger = createLogger(options.logger);\r\n this.baseUrl = this._resolveUrl(url);\r\n options = options || {};\r\n options.logMessageContent = options.logMessageContent === undefined ? false : options.logMessageContent;\r\n if (typeof options.withCredentials === \"boolean\" || options.withCredentials === undefined) {\r\n options.withCredentials = options.withCredentials === undefined ? true : options.withCredentials;\r\n }\r\n else {\r\n throw new Error(\"withCredentials option was not a 'boolean' or 'undefined' value\");\r\n }\r\n options.timeout = options.timeout === undefined ? 100 * 1000 : options.timeout;\r\n let webSocketModule = null;\r\n let eventSourceModule = null;\r\n if (Platform.isNode && typeof require !== \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n webSocketModule = requireFunc(\"ws\");\r\n eventSourceModule = requireFunc(\"eventsource\");\r\n }\r\n if (!Platform.isNode && typeof WebSocket !== \"undefined\" && !options.WebSocket) {\r\n options.WebSocket = WebSocket;\r\n }\r\n else if (Platform.isNode && !options.WebSocket) {\r\n if (webSocketModule) {\r\n options.WebSocket = webSocketModule;\r\n }\r\n }\r\n if (!Platform.isNode && typeof EventSource !== \"undefined\" && !options.EventSource) {\r\n options.EventSource = EventSource;\r\n }\r\n else if (Platform.isNode && !options.EventSource) {\r\n if (typeof eventSourceModule !== \"undefined\") {\r\n options.EventSource = eventSourceModule;\r\n }\r\n }\r\n this._httpClient = new AccessTokenHttpClient(options.httpClient || new DefaultHttpClient(this._logger), options.accessTokenFactory);\r\n this._connectionState = \"Disconnected\" /* Disconnected */;\r\n this._connectionStarted = false;\r\n this._options = options;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n async start(transferFormat) {\r\n transferFormat = transferFormat || TransferFormat.Binary;\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Debug, `Starting connection with transfer format '${TransferFormat[transferFormat]}'.`);\r\n if (this._connectionState !== \"Disconnected\" /* Disconnected */) {\r\n return Promise.reject(new Error(\"Cannot start an HttpConnection that is not in the 'Disconnected' state.\"));\r\n }\r\n this._connectionState = \"Connecting\" /* Connecting */;\r\n this._startInternalPromise = this._startInternal(transferFormat);\r\n await this._startInternalPromise;\r\n // The TypeScript compiler thinks that connectionState must be Connecting here. The TypeScript compiler is wrong.\r\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\r\n // stop() was called and transitioned the client into the Disconnecting state.\r\n const message = \"Failed to start the HttpConnection before stop() was called.\";\r\n this._logger.log(LogLevel.Error, message);\r\n // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise.\r\n await this._stopPromise;\r\n return Promise.reject(new AbortError(message));\r\n }\r\n else if (this._connectionState !== \"Connected\" /* Connected */) {\r\n // stop() was called and transitioned the client into the Disconnecting state.\r\n const message = \"HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!\";\r\n this._logger.log(LogLevel.Error, message);\r\n return Promise.reject(new AbortError(message));\r\n }\r\n this._connectionStarted = true;\r\n }\r\n send(data) {\r\n if (this._connectionState !== \"Connected\" /* Connected */) {\r\n return Promise.reject(new Error(\"Cannot send data if the connection is not in the 'Connected' State.\"));\r\n }\r\n if (!this._sendQueue) {\r\n this._sendQueue = new TransportSendQueue(this.transport);\r\n }\r\n // Transport will not be null if state is connected\r\n return this._sendQueue.send(data);\r\n }\r\n async stop(error) {\r\n if (this._connectionState === \"Disconnected\" /* Disconnected */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnected state.`);\r\n return Promise.resolve();\r\n }\r\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\r\n return this._stopPromise;\r\n }\r\n this._connectionState = \"Disconnecting\" /* Disconnecting */;\r\n this._stopPromise = new Promise((resolve) => {\r\n // Don't complete stop() until stopConnection() completes.\r\n this._stopPromiseResolver = resolve;\r\n });\r\n // stopInternal should never throw so just observe it.\r\n await this._stopInternal(error);\r\n await this._stopPromise;\r\n }\r\n async _stopInternal(error) {\r\n // Set error as soon as possible otherwise there is a race between\r\n // the transport closing and providing an error and the error from a close message\r\n // We would prefer the close message error.\r\n this._stopError = error;\r\n try {\r\n await this._startInternalPromise;\r\n }\r\n catch (e) {\r\n // This exception is returned to the user as a rejected Promise from the start method.\r\n }\r\n // The transport's onclose will trigger stopConnection which will run our onclose event.\r\n // The transport should always be set if currently connected. If it wasn't set, it's likely because\r\n // stop was called during start() and start() failed.\r\n if (this.transport) {\r\n try {\r\n await this.transport.stop();\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `HttpConnection.transport.stop() threw error '${e}'.`);\r\n this._stopConnection();\r\n }\r\n this.transport = undefined;\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, \"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.\");\r\n }\r\n }\r\n async _startInternal(transferFormat) {\r\n // Store the original base url and the access token factory since they may change\r\n // as part of negotiating\r\n let url = this.baseUrl;\r\n this._accessTokenFactory = this._options.accessTokenFactory;\r\n this._httpClient._accessTokenFactory = this._accessTokenFactory;\r\n try {\r\n if (this._options.skipNegotiation) {\r\n if (this._options.transport === HttpTransportType.WebSockets) {\r\n // No need to add a connection ID in this case\r\n this.transport = this._constructTransport(HttpTransportType.WebSockets);\r\n // We should just call connect directly in this case.\r\n // No fallback or negotiate in this case.\r\n await this._startTransport(url, transferFormat);\r\n }\r\n else {\r\n throw new Error(\"Negotiation can only be skipped when using the WebSocket transport directly.\");\r\n }\r\n }\r\n else {\r\n let negotiateResponse = null;\r\n let redirects = 0;\r\n do {\r\n negotiateResponse = await this._getNegotiationResponse(url);\r\n // the user tries to stop the connection when it is being started\r\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */ || this._connectionState === \"Disconnected\" /* Disconnected */) {\r\n throw new AbortError(\"The connection was stopped during negotiation.\");\r\n }\r\n if (negotiateResponse.error) {\r\n throw new Error(negotiateResponse.error);\r\n }\r\n if (negotiateResponse.ProtocolVersion) {\r\n throw new Error(\"Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.\");\r\n }\r\n if (negotiateResponse.url) {\r\n url = negotiateResponse.url;\r\n }\r\n if (negotiateResponse.accessToken) {\r\n // Replace the current access token factory with one that uses\r\n // the returned access token\r\n const accessToken = negotiateResponse.accessToken;\r\n this._accessTokenFactory = () => accessToken;\r\n // set the factory to undefined so the AccessTokenHttpClient won't retry with the same token, since we know it won't change until a connection restart\r\n this._httpClient._accessToken = accessToken;\r\n this._httpClient._accessTokenFactory = undefined;\r\n }\r\n redirects++;\r\n } while (negotiateResponse.url && redirects < MAX_REDIRECTS);\r\n if (redirects === MAX_REDIRECTS && negotiateResponse.url) {\r\n throw new Error(\"Negotiate redirection limit exceeded.\");\r\n }\r\n await this._createTransport(url, this._options.transport, negotiateResponse, transferFormat);\r\n }\r\n if (this.transport instanceof LongPollingTransport) {\r\n this.features.inherentKeepAlive = true;\r\n }\r\n if (this._connectionState === \"Connecting\" /* Connecting */) {\r\n // Ensure the connection transitions to the connected state prior to completing this.startInternalPromise.\r\n // start() will handle the case when stop was called and startInternal exits still in the disconnecting state.\r\n this._logger.log(LogLevel.Debug, \"The HttpConnection connected successfully.\");\r\n this._connectionState = \"Connected\" /* Connected */;\r\n }\r\n // stop() is waiting on us via this.startInternalPromise so keep this.transport around so it can clean up.\r\n // This is the only case startInternal can exit in neither the connected nor disconnected state because stopConnection()\r\n // will transition to the disconnected state. start() will wait for the transition using the stopPromise.\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, \"Failed to start the connection: \" + e);\r\n this._connectionState = \"Disconnected\" /* Disconnected */;\r\n this.transport = undefined;\r\n // if start fails, any active calls to stop assume that start will complete the stop promise\r\n this._stopPromiseResolver();\r\n return Promise.reject(e);\r\n }\r\n }\r\n async _getNegotiationResponse(url) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n const negotiateUrl = this._resolveNegotiateUrl(url);\r\n this._logger.log(LogLevel.Debug, `Sending negotiation request: ${negotiateUrl}.`);\r\n try {\r\n const response = await this._httpClient.post(negotiateUrl, {\r\n content: \"\",\r\n headers: { ...headers, ...this._options.headers },\r\n timeout: this._options.timeout,\r\n withCredentials: this._options.withCredentials,\r\n });\r\n if (response.statusCode !== 200) {\r\n return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`));\r\n }\r\n const negotiateResponse = JSON.parse(response.content);\r\n if (!negotiateResponse.negotiateVersion || negotiateResponse.negotiateVersion < 1) {\r\n // Negotiate version 0 doesn't use connectionToken\r\n // So we set it equal to connectionId so all our logic can use connectionToken without being aware of the negotiate version\r\n negotiateResponse.connectionToken = negotiateResponse.connectionId;\r\n }\r\n return negotiateResponse;\r\n }\r\n catch (e) {\r\n let errorMessage = \"Failed to complete negotiation with the server: \" + e;\r\n if (e instanceof HttpError) {\r\n if (e.statusCode === 404) {\r\n errorMessage = errorMessage + \" Either this is not a SignalR endpoint or there is a proxy blocking the connection.\";\r\n }\r\n }\r\n this._logger.log(LogLevel.Error, errorMessage);\r\n return Promise.reject(new FailedToNegotiateWithServerError(errorMessage));\r\n }\r\n }\r\n _createConnectUrl(url, connectionToken) {\r\n if (!connectionToken) {\r\n return url;\r\n }\r\n return url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + `id=${connectionToken}`;\r\n }\r\n async _createTransport(url, requestedTransport, negotiateResponse, requestedTransferFormat) {\r\n let connectUrl = this._createConnectUrl(url, negotiateResponse.connectionToken);\r\n if (this._isITransport(requestedTransport)) {\r\n this._logger.log(LogLevel.Debug, \"Connection was provided an instance of ITransport, using that directly.\");\r\n this.transport = requestedTransport;\r\n await this._startTransport(connectUrl, requestedTransferFormat);\r\n this.connectionId = negotiateResponse.connectionId;\r\n return;\r\n }\r\n const transportExceptions = [];\r\n const transports = negotiateResponse.availableTransports || [];\r\n let negotiate = negotiateResponse;\r\n for (const endpoint of transports) {\r\n const transportOrError = this._resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat);\r\n if (transportOrError instanceof Error) {\r\n // Store the error and continue, we don't want to cause a re-negotiate in these cases\r\n transportExceptions.push(`${endpoint.transport} failed:`);\r\n transportExceptions.push(transportOrError);\r\n }\r\n else if (this._isITransport(transportOrError)) {\r\n this.transport = transportOrError;\r\n if (!negotiate) {\r\n try {\r\n negotiate = await this._getNegotiationResponse(url);\r\n }\r\n catch (ex) {\r\n return Promise.reject(ex);\r\n }\r\n connectUrl = this._createConnectUrl(url, negotiate.connectionToken);\r\n }\r\n try {\r\n await this._startTransport(connectUrl, requestedTransferFormat);\r\n this.connectionId = negotiate.connectionId;\r\n return;\r\n }\r\n catch (ex) {\r\n this._logger.log(LogLevel.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);\r\n negotiate = undefined;\r\n transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, HttpTransportType[endpoint.transport]));\r\n if (this._connectionState !== \"Connecting\" /* Connecting */) {\r\n const message = \"Failed to select transport before stop() was called.\";\r\n this._logger.log(LogLevel.Debug, message);\r\n return Promise.reject(new AbortError(message));\r\n }\r\n }\r\n }\r\n }\r\n if (transportExceptions.length > 0) {\r\n return Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${transportExceptions.join(\" \")}`, transportExceptions));\r\n }\r\n return Promise.reject(new Error(\"None of the transports supported by the client are supported by the server.\"));\r\n }\r\n _constructTransport(transport) {\r\n switch (transport) {\r\n case HttpTransportType.WebSockets:\r\n if (!this._options.WebSocket) {\r\n throw new Error(\"'WebSocket' is not supported in your environment.\");\r\n }\r\n return new WebSocketTransport(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});\r\n case HttpTransportType.ServerSentEvents:\r\n if (!this._options.EventSource) {\r\n throw new Error(\"'EventSource' is not supported in your environment.\");\r\n }\r\n return new ServerSentEventsTransport(this._httpClient, this._httpClient._accessToken, this._logger, this._options);\r\n case HttpTransportType.LongPolling:\r\n return new LongPollingTransport(this._httpClient, this._logger, this._options);\r\n default:\r\n throw new Error(`Unknown transport: ${transport}.`);\r\n }\r\n }\r\n _startTransport(url, transferFormat) {\r\n this.transport.onreceive = this.onreceive;\r\n this.transport.onclose = (e) => this._stopConnection(e);\r\n return this.transport.connect(url, transferFormat);\r\n }\r\n _resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat) {\r\n const transport = HttpTransportType[endpoint.transport];\r\n if (transport === null || transport === undefined) {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\r\n return new Error(`Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\r\n }\r\n else {\r\n if (transportMatches(requestedTransport, transport)) {\r\n const transferFormats = endpoint.transferFormats.map((s) => TransferFormat[s]);\r\n if (transferFormats.indexOf(requestedTransferFormat) >= 0) {\r\n if ((transport === HttpTransportType.WebSockets && !this._options.WebSocket) ||\r\n (transport === HttpTransportType.ServerSentEvents && !this._options.EventSource)) {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);\r\n return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, transport);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);\r\n try {\r\n return this._constructTransport(transport);\r\n }\r\n catch (ex) {\r\n return ex;\r\n }\r\n }\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it does not support the requested transfer format '${TransferFormat[requestedTransferFormat]}'.`);\r\n return new Error(`'${HttpTransportType[transport]}' does not support ${TransferFormat[requestedTransferFormat]}.`);\r\n }\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it was disabled by the client.`);\r\n return new DisabledTransportError(`'${HttpTransportType[transport]}' is disabled by the client.`, transport);\r\n }\r\n }\r\n }\r\n _isITransport(transport) {\r\n return transport && typeof (transport) === \"object\" && \"connect\" in transport;\r\n }\r\n _stopConnection(error) {\r\n this._logger.log(LogLevel.Debug, `HttpConnection.stopConnection(${error}) called while in state ${this._connectionState}.`);\r\n this.transport = undefined;\r\n // If we have a stopError, it takes precedence over the error from the transport\r\n error = this._stopError || error;\r\n this._stopError = undefined;\r\n if (this._connectionState === \"Disconnected\" /* Disconnected */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is already in the disconnected state.`);\r\n return;\r\n }\r\n if (this._connectionState === \"Connecting\" /* Connecting */) {\r\n this._logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is still in the connecting state.`);\r\n throw new Error(`HttpConnection.stopConnection(${error}) was called while the connection is still in the connecting state.`);\r\n }\r\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\r\n // A call to stop() induced this call to stopConnection and needs to be completed.\r\n // Any stop() awaiters will be scheduled to continue after the onclose callback fires.\r\n this._stopPromiseResolver();\r\n }\r\n if (error) {\r\n this._logger.log(LogLevel.Error, `Connection disconnected with error '${error}'.`);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Information, \"Connection disconnected.\");\r\n }\r\n if (this._sendQueue) {\r\n this._sendQueue.stop().catch((e) => {\r\n this._logger.log(LogLevel.Error, `TransportSendQueue.stop() threw error '${e}'.`);\r\n });\r\n this._sendQueue = undefined;\r\n }\r\n this.connectionId = undefined;\r\n this._connectionState = \"Disconnected\" /* Disconnected */;\r\n if (this._connectionStarted) {\r\n this._connectionStarted = false;\r\n try {\r\n if (this.onclose) {\r\n this.onclose(error);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `HttpConnection.onclose(${error}) threw error '${e}'.`);\r\n }\r\n }\r\n }\r\n _resolveUrl(url) {\r\n // startsWith is not supported in IE\r\n if (url.lastIndexOf(\"https://\", 0) === 0 || url.lastIndexOf(\"http://\", 0) === 0) {\r\n return url;\r\n }\r\n if (!Platform.isBrowser) {\r\n throw new Error(`Cannot resolve '${url}'.`);\r\n }\r\n // Setting the url to the href propery of an anchor tag handles normalization\r\n // for us. There are 3 main cases.\r\n // 1. Relative path normalization e.g \"b\" -> \"http://localhost:5000/a/b\"\r\n // 2. Absolute path normalization e.g \"/a/b\" -> \"http://localhost:5000/a/b\"\r\n // 3. Networkpath reference normalization e.g \"//localhost:5000/a/b\" -> \"http://localhost:5000/a/b\"\r\n const aTag = window.document.createElement(\"a\");\r\n aTag.href = url;\r\n this._logger.log(LogLevel.Information, `Normalizing '${url}' to '${aTag.href}'.`);\r\n return aTag.href;\r\n }\r\n _resolveNegotiateUrl(url) {\r\n const index = url.indexOf(\"?\");\r\n let negotiateUrl = url.substring(0, index === -1 ? url.length : index);\r\n if (negotiateUrl[negotiateUrl.length - 1] !== \"/\") {\r\n negotiateUrl += \"/\";\r\n }\r\n negotiateUrl += \"negotiate\";\r\n negotiateUrl += index === -1 ? \"\" : url.substring(index);\r\n if (negotiateUrl.indexOf(\"negotiateVersion\") === -1) {\r\n negotiateUrl += index === -1 ? \"?\" : \"&\";\r\n negotiateUrl += \"negotiateVersion=\" + this._negotiateVersion;\r\n }\r\n return negotiateUrl;\r\n }\r\n}\r\nfunction transportMatches(requestedTransport, actualTransport) {\r\n return !requestedTransport || ((actualTransport & requestedTransport) !== 0);\r\n}\r\n/** @private */\r\nexport class TransportSendQueue {\r\n constructor(_transport) {\r\n this._transport = _transport;\r\n this._buffer = [];\r\n this._executing = true;\r\n this._sendBufferedData = new PromiseSource();\r\n this._transportResult = new PromiseSource();\r\n this._sendLoopPromise = this._sendLoop();\r\n }\r\n send(data) {\r\n this._bufferData(data);\r\n if (!this._transportResult) {\r\n this._transportResult = new PromiseSource();\r\n }\r\n return this._transportResult.promise;\r\n }\r\n stop() {\r\n this._executing = false;\r\n this._sendBufferedData.resolve();\r\n return this._sendLoopPromise;\r\n }\r\n _bufferData(data) {\r\n if (this._buffer.length && typeof (this._buffer[0]) !== typeof (data)) {\r\n throw new Error(`Expected data to be of type ${typeof (this._buffer)} but was of type ${typeof (data)}`);\r\n }\r\n this._buffer.push(data);\r\n this._sendBufferedData.resolve();\r\n }\r\n async _sendLoop() {\r\n while (true) {\r\n await this._sendBufferedData.promise;\r\n if (!this._executing) {\r\n if (this._transportResult) {\r\n this._transportResult.reject(\"Connection stopped.\");\r\n }\r\n break;\r\n }\r\n this._sendBufferedData = new PromiseSource();\r\n const transportResult = this._transportResult;\r\n this._transportResult = undefined;\r\n const data = typeof (this._buffer[0]) === \"string\" ?\r\n this._buffer.join(\"\") :\r\n TransportSendQueue._concatBuffers(this._buffer);\r\n this._buffer.length = 0;\r\n try {\r\n await this._transport.send(data);\r\n transportResult.resolve();\r\n }\r\n catch (error) {\r\n transportResult.reject(error);\r\n }\r\n }\r\n }\r\n static _concatBuffers(arrayBuffers) {\r\n const totalLength = arrayBuffers.map((b) => b.byteLength).reduce((a, b) => a + b);\r\n const result = new Uint8Array(totalLength);\r\n let offset = 0;\r\n for (const item of arrayBuffers) {\r\n result.set(new Uint8Array(item), offset);\r\n offset += item.byteLength;\r\n }\r\n return result.buffer;\r\n }\r\n}\r\nclass PromiseSource {\r\n constructor() {\r\n this.promise = new Promise((resolve, reject) => [this._resolver, this._rejecter] = [resolve, reject]);\r\n }\r\n resolve() {\r\n this._resolver();\r\n }\r\n reject(reason) {\r\n this._rejecter(reason);\r\n }\r\n}\r\n//# sourceMappingURL=HttpConnection.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// Not exported from index\r\n/** @private */\r\nexport class TextMessageFormat {\r\n static write(output) {\r\n return `${output}${TextMessageFormat.RecordSeparator}`;\r\n }\r\n static parse(input) {\r\n if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n const messages = input.split(TextMessageFormat.RecordSeparator);\r\n messages.pop();\r\n return messages;\r\n }\r\n}\r\nTextMessageFormat.RecordSeparatorCode = 0x1e;\r\nTextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);\r\n//# sourceMappingURL=TextMessageFormat.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\n/** @private */\r\nexport class HandshakeProtocol {\r\n // Handshake request is always JSON\r\n writeHandshakeRequest(handshakeRequest) {\r\n return TextMessageFormat.write(JSON.stringify(handshakeRequest));\r\n }\r\n parseHandshakeResponse(data) {\r\n let messageData;\r\n let remainingData;\r\n if (isArrayBuffer(data)) {\r\n // Format is binary but still need to read JSON text from handshake response\r\n const binaryData = new Uint8Array(data);\r\n const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));\r\n remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null;\r\n }\r\n else {\r\n const textData = data;\r\n const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = textData.substring(0, responseLength);\r\n remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null;\r\n }\r\n // At this point we should have just the single handshake message\r\n const messages = TextMessageFormat.parse(messageData);\r\n const response = JSON.parse(messages[0]);\r\n if (response.type) {\r\n throw new Error(\"Expected a handshake response from the server.\");\r\n }\r\n const responseMessage = response;\r\n // multiple messages could have arrived with handshake\r\n // return additional data to be parsed as usual, or null if all parsed\r\n return [remainingData, responseMessage];\r\n }\r\n}\r\n//# sourceMappingURL=HandshakeProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { SubjectSubscription } from \"./Utils\";\r\n/** Stream implementation to stream items to the server. */\r\nexport class Subject {\r\n constructor() {\r\n this.observers = [];\r\n }\r\n next(item) {\r\n for (const observer of this.observers) {\r\n observer.next(item);\r\n }\r\n }\r\n error(err) {\r\n for (const observer of this.observers) {\r\n if (observer.error) {\r\n observer.error(err);\r\n }\r\n }\r\n }\r\n complete() {\r\n for (const observer of this.observers) {\r\n if (observer.complete) {\r\n observer.complete();\r\n }\r\n }\r\n }\r\n subscribe(observer) {\r\n this.observers.push(observer);\r\n return new SubjectSubscription(this, observer);\r\n }\r\n}\r\n//# sourceMappingURL=Subject.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nconst JSON_HUB_PROTOCOL_NAME = \"json\";\r\n/** Implements the JSON Hub Protocol. */\r\nexport class JsonHubProtocol {\r\n constructor() {\r\n /** @inheritDoc */\r\n this.name = JSON_HUB_PROTOCOL_NAME;\r\n /** @inheritDoc */\r\n this.version = 1;\r\n /** @inheritDoc */\r\n this.transferFormat = TransferFormat.Text;\r\n }\r\n /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * @param {string} input A string containing the serialized representation.\r\n * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.\r\n */\r\n parseMessages(input, logger) {\r\n // The interface does allow \"ArrayBuffer\" to be passed in, but this implementation does not. So let's throw a useful error.\r\n if (typeof input !== \"string\") {\r\n throw new Error(\"Invalid input for JSON hub protocol. Expected a string.\");\r\n }\r\n if (!input) {\r\n return [];\r\n }\r\n if (logger === null) {\r\n logger = NullLogger.instance;\r\n }\r\n // Parse the messages\r\n const messages = TextMessageFormat.parse(input);\r\n const hubMessages = [];\r\n for (const message of messages) {\r\n const parsedMessage = JSON.parse(message);\r\n if (typeof parsedMessage.type !== \"number\") {\r\n throw new Error(\"Invalid payload.\");\r\n }\r\n switch (parsedMessage.type) {\r\n case MessageType.Invocation:\r\n this._isInvocationMessage(parsedMessage);\r\n break;\r\n case MessageType.StreamItem:\r\n this._isStreamItemMessage(parsedMessage);\r\n break;\r\n case MessageType.Completion:\r\n this._isCompletionMessage(parsedMessage);\r\n break;\r\n case MessageType.Ping:\r\n // Single value, no need to validate\r\n break;\r\n case MessageType.Close:\r\n // All optional values, no need to validate\r\n break;\r\n default:\r\n // Future protocol changes can add message types, old clients can ignore them\r\n logger.log(LogLevel.Information, \"Unknown message type '\" + parsedMessage.type + \"' ignored.\");\r\n continue;\r\n }\r\n hubMessages.push(parsedMessage);\r\n }\r\n return hubMessages;\r\n }\r\n /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string} A string containing the serialized representation of the message.\r\n */\r\n writeMessage(message) {\r\n return TextMessageFormat.write(JSON.stringify(message));\r\n }\r\n _isInvocationMessage(message) {\r\n this._assertNotEmptyString(message.target, \"Invalid payload for Invocation message.\");\r\n if (message.invocationId !== undefined) {\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Invocation message.\");\r\n }\r\n }\r\n _isStreamItemMessage(message) {\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for StreamItem message.\");\r\n if (message.item === undefined) {\r\n throw new Error(\"Invalid payload for StreamItem message.\");\r\n }\r\n }\r\n _isCompletionMessage(message) {\r\n if (message.result && message.error) {\r\n throw new Error(\"Invalid payload for Completion message.\");\r\n }\r\n if (!message.result && message.error) {\r\n this._assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\r\n }\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\r\n }\r\n _assertNotEmptyString(value, errorMessage) {\r\n if (typeof value !== \"string\" || value === \"\") {\r\n throw new Error(errorMessage);\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=JsonHubProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { DefaultReconnectPolicy } from \"./DefaultReconnectPolicy\";\r\nimport { HttpConnection } from \"./HttpConnection\";\r\nimport { HubConnection } from \"./HubConnection\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { JsonHubProtocol } from \"./JsonHubProtocol\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { Arg, ConsoleLogger } from \"./Utils\";\r\nconst LogLevelNameMapping = {\r\n trace: LogLevel.Trace,\r\n debug: LogLevel.Debug,\r\n info: LogLevel.Information,\r\n information: LogLevel.Information,\r\n warn: LogLevel.Warning,\r\n warning: LogLevel.Warning,\r\n error: LogLevel.Error,\r\n critical: LogLevel.Critical,\r\n none: LogLevel.None,\r\n};\r\nfunction parseLogLevel(name) {\r\n // Case-insensitive matching via lower-casing\r\n // Yes, I know case-folding is a complicated problem in Unicode, but we only support\r\n // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse.\r\n const mapping = LogLevelNameMapping[name.toLowerCase()];\r\n if (typeof mapping !== \"undefined\") {\r\n return mapping;\r\n }\r\n else {\r\n throw new Error(`Unknown log level: ${name}`);\r\n }\r\n}\r\n/** A builder for configuring {@link @microsoft/signalr.HubConnection} instances. */\r\nexport class HubConnectionBuilder {\r\n configureLogging(logging) {\r\n Arg.isRequired(logging, \"logging\");\r\n if (isLogger(logging)) {\r\n this.logger = logging;\r\n }\r\n else if (typeof logging === \"string\") {\r\n const logLevel = parseLogLevel(logging);\r\n this.logger = new ConsoleLogger(logLevel);\r\n }\r\n else {\r\n this.logger = new ConsoleLogger(logging);\r\n }\r\n return this;\r\n }\r\n withUrl(url, transportTypeOrOptions) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isNotEmpty(url, \"url\");\r\n this.url = url;\r\n // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed\r\n // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.\r\n if (typeof transportTypeOrOptions === \"object\") {\r\n this.httpConnectionOptions = { ...this.httpConnectionOptions, ...transportTypeOrOptions };\r\n }\r\n else {\r\n this.httpConnectionOptions = {\r\n ...this.httpConnectionOptions,\r\n transport: transportTypeOrOptions,\r\n };\r\n }\r\n return this;\r\n }\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.\r\n *\r\n * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.\r\n */\r\n withHubProtocol(protocol) {\r\n Arg.isRequired(protocol, \"protocol\");\r\n this.protocol = protocol;\r\n return this;\r\n }\r\n withAutomaticReconnect(retryDelaysOrReconnectPolicy) {\r\n if (this.reconnectPolicy) {\r\n throw new Error(\"A reconnectPolicy has already been set.\");\r\n }\r\n if (!retryDelaysOrReconnectPolicy) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy();\r\n }\r\n else if (Array.isArray(retryDelaysOrReconnectPolicy)) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);\r\n }\r\n else {\r\n this.reconnectPolicy = retryDelaysOrReconnectPolicy;\r\n }\r\n return this;\r\n }\r\n /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.\r\n *\r\n * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.\r\n */\r\n build() {\r\n // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one\r\n // provided to configureLogger\r\n const httpConnectionOptions = this.httpConnectionOptions || {};\r\n // If it's 'null', the user **explicitly** asked for null, don't mess with it.\r\n if (httpConnectionOptions.logger === undefined) {\r\n // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.\r\n httpConnectionOptions.logger = this.logger;\r\n }\r\n // Now create the connection\r\n if (!this.url) {\r\n throw new Error(\"The 'HubConnectionBuilder.withUrl' method must be called before building the connection.\");\r\n }\r\n const connection = new HttpConnection(this.url, httpConnectionOptions);\r\n return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol(), this.reconnectPolicy);\r\n }\r\n}\r\nfunction isLogger(logger) {\r\n return logger.log !== undefined;\r\n}\r\n//# sourceMappingURL=HubConnectionBuilder.js.map","export class Helpers {\r\n static GenerateUUID(): string { // Public Domain/MIT\r\n var d = new Date().getTime();//Timestamp\r\n var d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0;//Time in microseconds since page-load or 0 if unsupported\r\n \r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16;//random number between 0 and 16\r\n\r\n if (d > 0) {//Use timestamp until depleted\r\n r = (d + r) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n } \r\n else {//Use microseconds since page-load if supported\r\n r = (d2 + r) % 16 | 0;\r\n d2 = Math.floor(d2 / 16);\r\n }\r\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Type to generate int range types\r\n */\r\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\r\n ? Acc[number]\r\n : Enumerate<N, [...Acc, Acc['length']]>;\r\n\r\nexport type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;","import { Helpers } from \"./Helpers\";\r\n\r\nexport interface IDataFrame<T>\r\n{\r\n Resource?: string;\r\n TransactionId?: string;\r\n Data?: T;\r\n Status?: Status;\r\n Method?: Method;\r\n}\r\n\r\nexport class DataFrame<T> implements IDataFrame<T>\r\n{\r\n Resource?: string;\r\n TransactionId?: string = Helpers.GenerateUUID();\r\n Data?: T;\r\n Status?: Status;\r\n Method?: Method;\r\n}\r\n\r\nexport enum Status\r\n{\r\n /// <summary>\r\n /// Gdy zapytanie się powiodło i nie wystąpiły błędy\r\n /// </summary>\r\n OK = 0,\r\n\r\n /// <summary>\r\n /// Gdy wystąpił nieznany błąd podczas wykonywania zapytania\r\n /// </summary>\r\n UnknownError = 1,\r\n\r\n /// <summary>\r\n /// Gdy wystąpił błąd którego oprogramowanie kontrolera nie mogło rozwiązać\r\n /// </summary>\r\n FatalError = 2,\r\n\r\n /// <summary>\r\n /// Gdy zapytanie zostało wykonane z niepoprawnymi danymi\r\n /// </summary>\r\n WrongData = 3,\r\n\r\n /// <summary>\r\n /// Gdy zostało wykonane zapytanie do zasobu który nie istnieje\r\n /// </summary>\r\n ResourceDoesNotExists = 4,\r\n\r\n /// <summary>\r\n /// Gdy zostało wykonane zapytanie o wykonanie operacji do której zalogowany użytkownik nie ma uprawnień (np. gdy próbuje zmienić dane użytkownika o uprawnieniach wyższych od siebie)\r\n /// </summary>\r\n NoPermissionToPerformThisOperation = 5,\r\n\r\n /// <summary>\r\n /// Gdy zostanie dokonana próba ponownego logowania dla już zalogowanej sesji\r\n /// </summary>\r\n SessionHasAlreadyLoggedOnUser = 6,\r\n\r\n /// <summary>\r\n /// Gdy żądana operacja jest niedozwolona\r\n /// </summary>\r\n OperationNotPermitted = 7,\r\n\r\n /// <summary>\r\n /// Gdy zostanie wykonane zapytanie do zasobu do którego użytkownik nie ma uprawnień\r\n /// </summary>\r\n NoPermissionsToCallGivenResource = 8,\r\n\r\n /// <summary>\r\n /// Gdy zostanie wykonane zapytanie do zasobu aktualnie nie dostępnego (gdy np. zasób został wyłączony)\r\n /// </summary>\r\n ResourceIsNotAvailable = 9,\r\n\r\n /// <summary>\r\n /// Gdy zapytanie do zasobu zakończyło się okreslonym błędem\r\n /// </summary>\r\n Error = 10,\r\n\r\n /// <summary>\r\n /// Gdy w ramach odpowiedzi na zapytanie nie są zwracane dane\r\n /// </summary>\r\n NoData = 11,\r\n\r\n /// <summary>\r\n /// Gdy zostanie wykonane zapytanie do nie wspieranego zasobu (np. dotyczącego okreslonego systemu operacyjnego)\r\n /// </summary>\r\n NotSupportedMethod = 12,\r\n\r\n /// <summary>\r\n /// Gdy zostanie wykonane zapytanie do dowolnego zasobu a żaden użytkownik nie jest zalogowany w ramach sesji\r\n /// </summary>\r\n UserIsNotLoggedIn = 13,\r\n /// <summary>\r\n /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu\r\n /// </summary>\r\n MultiDataResponseStart = 14,\r\n /// <summary>\r\n /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu. Informuje, że dana odpowiedź jest jedną z odpowiedzi\r\n /// </summary>\r\n MultiDataResponse = 15,\r\n /// <summary>\r\n /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu. Informuje, że dana odpowiedź jest ostatnią odpowiedzią danego zasobu\r\n /// </summary>\r\n MultiDataResponseStop = 16\r\n}\r\n\r\n\r\nexport enum Method\r\n{\r\n Get = 0,\r\n Post = 1,\r\n Delete = 2,\r\n Put = 3,\r\n Options = 4,\r\n Head = 5\r\n}","import { TypedEvent, ITypedEvent } from \"../TypedEvent\";\r\nimport { DataFrame, IDataFrame } from \"../DataFrame\";\r\nimport { IDIService } from \"../IDIService\";\r\n\r\nexport interface IExalusConnectionService extends IDIService {\r\n SetServersBrokerAddress(address: string): void;\r\n SetDefaultPacketsBrokerAddress(address: string): void;\r\n GetServerAddressAsync(): Promise<string | null>;\r\n ConnectAsync(address: string): Promise<ConnectionResult>;\r\n AuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<boolean>;\r\n ConnectAndAuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<ConnectionResult>;\r\n DisconnectAsync(): Promise<void>;\r\n IsConnected(): boolean;\r\n EnablePacketsLogging(): void;\r\n DisablePacketsLogging(): void;\r\n SendAsync(dataFrame: IDataFrame<any>): Promise<boolean>;\r\n SendAndWaitForResponseAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean): Promise<IDataFrame<T>>;\r\n SendAndWaitForResponseAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean, logTransmission: boolean): Promise<IDataFrame<T>>;\r\n OnDataReceivedEvent(): ITypedEvent<IDataFrame<any>>;\r\n OnErrorOccuredEvent(): ITypedEvent<[sender: string, data: string]>;\r\n OnConnectionStateChangedEvent(): ITypedEvent<ConnectionState>;\r\n}\r\n\r\nexport class AuthorizationInfo {\r\n public constructor(public serialNumber: string, public pin: string) {\r\n this.SerialNumber = serialNumber;\r\n this.PIN = pin;\r\n }\r\n\r\n public SerialNumber: string;\r\n public PIN: string;\r\n}\r\n\r\nexport enum ConnectionType {\r\n ByCloud = 0,\r\n LocalNetwork = 1,\r\n P2P = 2,\r\n}\r\n\r\nexport enum ConnectionResult {\r\n FailedToConnect = 0,\r\n AuthorizationFailed = 1,\r\n FailedToConnectToServer = 2,\r\n Connected = 3,\r\n ControllerIsNotConnected = 4\r\n}\r\n\r\nexport enum ConnectionState {\r\n Disconnected = 0,\r\n Connecting = 1,\r\n Connected = 3,\r\n Disconnecting = 4,\r\n Failed = 5,\r\n Reconnecting = 6\r\n}","export interface IUser {\r\n get Guid(): string;\r\n get CloudGuid(): string;\r\n get Name(): string;\r\n get Surname(): string;\r\n get Phone(): string;\r\n get AccessLevel(): AccessLevel;\r\n get Email(): string;\r\n get IsAccountOnline(): boolean;\r\n get IsActive(): boolean;\r\n get IsBanned(): boolean;\r\n get NotificationChannels(): string[];\r\n get Gender(): Gender;\r\n get Localization(): Localization;\r\n}\r\n\r\nexport enum AccessLevel\r\n{\r\n Any = 0,\r\n Guest = 10,\r\n Standard = 20,\r\n Admin = 30,\r\n Installator = 40,\r\n Support = 50\r\n}\r\n\r\nexport enum Gender\r\n{\r\n Unknown = 0,\r\n Men = 1,\r\n Woman = 2,\r\n Other = 3\r\n}\r\n\r\nexport enum Localization\r\n{\r\n En_Us = 0,\r\n Pl_Pl = 1,\r\n}","import { IDIService } from \"../../IDIService\";\r\nimport { ITypedEvent } from \"../../TypedEvent\";\r\nimport { AccessLevel, Gender, IUser } from \"../Users/IUser\";\r\n\r\nexport interface ISessionService extends IDIService {\r\n OnUserLoggedInEvent(): ITypedEvent<IUser>;\r\n OnUserLoggedOutEvent(): ITypedEvent<IUser>;\r\n \r\n get User(): IUser | null;\r\n UserLogOutAsync(): Promise<void>;\r\n UserLogInAsync(email: string, password: string): Promise<IUser | LoginError>;\r\n}\r\n\r\nexport enum LoginError\r\n{\r\n Unknown = 0,\r\n WrongAuthData = 1,\r\n NoResponseFromController = 2,\r\n}\r\n","\r\nimport { Api } from './Api';\r\nimport { ILoggerService } from './Services/Logging/ILoggerService';\r\nimport { LoggerService } from './Services/Logging/LoggerService';\r\n\r\nexport interface IEvent {\r\n Subscribe(handler: { (): void }): void;\r\n Unsubscribe(handler: { (): void }): void;\r\n}\r\n\r\nexport class Event implements IEvent {\r\n private _log: ILoggerService = Api.Get<ILoggerService>(LoggerService.ServiceName);\r\n\r\n private handlers: { (): void; }[] = [];\r\n\r\n public Subscribe(handler: { (): void }): void {\r\n this.handlers.push(handler);\r\n }\r\n\r\n public Unsubscribe(handler: { (): void }): void {\r\n this.handlers = this.handlers.filter(h => h !== handler);\r\n }\r\n\r\n public Invoke() {\r\n this.handlers.slice(0).forEach(h => {\r\n try {\r\n h();\r\n }\r\n catch (ex: any) {\r\n this._log.Error(ex);\r\n }\r\n });\r\n }\r\n}","import { AccessLevel, Gender, IUser, Localization } from \"./IUser\";\r\n\r\nexport class User implements IUser {\r\n private _guid: string = \"\";\r\n private _cloudGuid: string = \"\";\r\n private _name: string = \"\";\r\n private _surname: string = \"\";\r\n private _phone: string = \"\";\r\n private _email: string = \"\";\r\n private _isAccountOnline: boolean = true;\r\n private _isAccountActive: boolean = true;\r\n private _isAccountBanned: boolean = true;\r\n private _notificationChannels: string[] = [];\r\n private _gender: Gender = Gender.Unknown;\r\n private _accessLevel: AccessLevel = AccessLevel.Any;\r\n private _localization: Localization = Localization.En_Us;\r\n\r\n get Guid(): string {\r\n return this._guid;\r\n }\r\n\r\n set Guid(value: string) {\r\n this._guid = value;\r\n }\r\n\r\n get CloudGuid(): string {\r\n return this._cloudGuid;\r\n }\r\n\r\n set CloudGuid(value: string) {\r\n this._cloudGuid = value;\r\n }\r\n\r\n get Name(): string {\r\n return this._name;\r\n }\r\n\r\n set Name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n get Surname(): string {\r\n return this._surname;\r\n }\r\n\r\n set Surname(value: string) {\r\n this._surname = value;\r\n }\r\n\r\n get Phone(): string {\r\n return this._phone;\r\n }\r\n\r\n set Phone(value: string) {\r\n this._phone = value;\r\n }\r\n\r\n get AccessLevel(): AccessLevel {\r\n return this._accessLevel;\r\n }\r\n\r\n set AccessLevel(value: AccessLevel) {\r\n this._accessLevel = value;\r\n }\r\n\r\n get Email(): string {\r\n return this._email;\r\n }\r\n\r\n set Email(value: string) {\r\n this._email = value;\r\n }\r\n\r\n get IsAccountOnline(): boolean {\r\n return this._isAccountOnline;\r\n }\r\n\r\n set IsAccountOnline(value: boolean) {\r\n this._isAccountOnline = value;\r\n }\r\n\r\n get IsActive(): boolean {\r\n return this._isAccountActive;\r\n }\r\n\r\n set IsActive(value: boolean) {\r\n this._isAccountActive = value;\r\n }\r\n\r\n get IsBanned(): boolean {\r\n return this._isAccountBanned;\r\n }\r\n\r\n set IsBanned(value: boolean) {\r\n this._isAccountBanned = value;\r\n }\r\n\r\n get NotificationChannels(): string[] {\r\n return this._notificationChannels;\r\n }\r\n\r\n set NotificationChannels(value: string[]) {\r\n this._notificationChannels = value;\r\n }\r\n\r\n get Gender(): Gender {\r\n return this._gender;\r\n }\r\n\r\n set Gender(value: Gender) {\r\n this._gender = value;\r\n }\r\n\r\n get Localization(): Localization {\r\n return this._localization;\r\n }\r\n\r\n set Localization(value: Localization) {\r\n this._localization = value;\r\n }\r\n}","import { Api } from \"../../Api\";\r\nimport { ExalusConnectionService } from \"../ExalusConnectionService\";\r\nimport { ConnectionState, IExalusConnectionService } from \"../IExalusConnectionService\";\r\nimport { ITypedEvent, TypedEvent } from \"../../TypedEvent\";\r\nimport { IUser, AccessLevel, Gender } from '../Users/IUser';\r\nimport { ISessionService, LoginError } from \"./ISessionService\";\r\nimport { DataFrame, Method, Status } from '../../DataFrame';\r\nimport { DependencyContainer } from \"../../DependencyContainer\";\r\nimport { User } from \"../Users/User\";\r\n\r\nexport class SessionService implements ISessionService {\r\n private _onUserLoggedInEvent: ITypedEvent<IUser> = new TypedEvent<IUser>();\r\n private _onUserLoggedOutEvent: ITypedEvent<IUser> = new TypedEvent<IUser>();\r\n public static readonly ServiceName: string = \"SessionService\";\r\n private _email: string = \"\";\r\n private _password: string = \"\";\r\n private _loginTaskCompletionSource: Promise<void> = this.CreateSessionCompletionSourceAsync();\r\n private _alreadySubsribedToNetworkEvents: boolean = false;\r\n private _user: IUser | null = null;\r\n\r\n public async CreateSessionCompletionSourceAsync(): Promise<void> {\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `Creating _loginTaskCompletionSource`);\r\n \r\n this._loginTaskCompletionSource = new Promise<void>((resolve) => {\r\n \r\n let onUserLoggedIn = (user: IUser) => {\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `Logged in as ${user.Name}, completing CreateSessionCompletionSourceAsync()`);\r\n resolve();\r\n this.OnUserLoggedInEvent().Unsubscribe(onUserLoggedIn);\r\n };\r\n\r\n this.OnUserLoggedInEvent().Subscribe(onUserLoggedIn);\r\n });\r\n }\r\n\r\n private Subscribe(handler: { (data: IUser): void }): void\r\n {\r\n\r\n }\r\n\r\n public async RestoreSessionAsync(): Promise<void> { \r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `Creating RestoreSessionAsync ${this._email} ${this._password}`);\r\n\r\n if (this._user === undefined || this._user === null)\r\n return;\r\n\r\n await this.UserLogInAsync(this._email, this._password);\r\n }\r\n\r\n public async WaitForSessionCreationAsync(): Promise<void> {\r\n return this._loginTaskCompletionSource as Promise<void>;\r\n }\r\n\r\n OnUserLoggedInEvent(): ITypedEvent<IUser> {\r\n return this._onUserLoggedInEvent;\r\n }\r\n\r\n OnUserLoggedOutEvent(): ITypedEvent<IUser> {\r\n return this._onUserLoggedOutEvent;\r\n }\r\n\r\n get User(): IUser | null {\r\n return this._user;\r\n }\r\n\r\n async UserLogOutAsync(): Promise<void> {\r\n var logoutRequest = new DataFrame();\r\n logoutRequest.Resource = \"/users/user/logout\";\r\n logoutRequest.Method = Method.Put;\r\n this._email = \"\";\r\n this._password = \"\";\r\n //var connection = Api.Get<IExalusConnectionService>(ExalusConnectionService);\r\n //connection.OnConnectionStateChangedEvent().Unsubscribe(this.OnConnectionStateChanged);\r\n\r\n const result = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName)\r\n .SendAndWaitForResponseAsync(logoutRequest, 20000, false);\r\n\r\n if (result.Status == Status.OK) {\r\n (this._onUserLoggedOutEvent as TypedEvent<IUser>).Invoke(this._user as IUser);\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, \"User has been logged out.\");\r\n }\r\n else\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, \"Failed to logout user!\");\r\n }\r\n\r\n private async OnConnectionStateChanged(connectionState: ConnectionState) {\r\n switch (connectionState) {\r\n case ConnectionState.Disconnected:\r\n case ConnectionState.Failed:\r\n break;\r\n\r\n case ConnectionState.Connected:\r\n Api.Get<SessionService>(SessionService.ServiceName).RestoreSessionAsync();\r\n break;\r\n }\r\n }\r\n\r\n async UserLogInAsync(email: string, password: string): Promise<IUser | LoginError> {\r\n var connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n const result = await connection.SendAndWaitForResponseAsync<UserData>(new LoginUserRequest(email, password), 20000, false);\r\n\r\n if (result.Status == Status.OK && result.Data != null) {\r\n this._email = email;\r\n this._password = password;\r\n var user = new User();\r\n this._user = user;\r\n user.AccessLevel = result.Data.AccessLevel;\r\n user.Email = result.Data.Email;\r\n user.Gender = result.Data.Gender;\r\n user.Guid = result.Data.Guid;\r\n user.IsAccountOnline = result.Data.IsAccountOnline;\r\n user.Name = result.Data.Name;\r\n user.IsActive = result.Data.IsActive;\r\n user.IsBanned = result.Data.IsBanned;\r\n user.Phone = result.Data.Phone;\r\n user.Surname = result.Data.Surname;\r\n\r\n if (!this._alreadySubsribedToNetworkEvents)\r\n {\r\n this._alreadySubsribedToNetworkEvents = true;\r\n connection.OnConnectionStateChangedEvent().Subscribe(this.OnConnectionStateChanged);\r\n }\r\n\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `Did logging in succeded?: ${result.Status == Status.OK}`);\r\n (this._onUserLoggedInEvent as TypedEvent<IUser>).Invoke(this._user as IUser);\r\n return user;\r\n }\r\n else {\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `User login response: ${result.Data}`);\r\n return LoginError.WrongAuthData;\r\n }\r\n }\r\n\r\n GetServiceName(): string {\r\n return SessionService.ServiceName;\r\n }\r\n}\r\n\r\nexport class UserData {\r\n Guid: string = \"\";\r\n Name: string = \"\";\r\n Surname: string = \"\";\r\n Password: string = \"\";\r\n Email: string = \"\";\r\n Phone: string = \"\";\r\n IsActive: boolean = true;\r\n IsBanned: boolean = false;\r\n IsAccountOnline: boolean = false;\r\n AccessLevel: AccessLevel = AccessLevel.Any;\r\n Gender: Gender = Gender.Unknown;\r\n ConfigurationTime: string = \"\";\r\n IsGeolocationSet: boolean = false;\r\n UpdatesChannel: string = \"\";\r\n}\r\n\r\nclass UserLoginData {\r\n constructor(email: string, password: string) {\r\n this.Email = email;\r\n this.Password = password;\r\n }\r\n\r\n Email: string = \"\";\r\n Password: string = \"\";\r\n}\r\n\r\nclass LoginUserRequest extends DataFrame<UserLoginData>\r\n{\r\n constructor(email: string, password: string) {\r\n super();\r\n this.Data = new UserLoginData(email, password);\r\n this.Resource = \"/users/user/login\";\r\n this.Method = Method.Put;\r\n }\r\n}","import { ITypedEvent } from \"../../TypedEvent\";\r\nimport { IEvent, Event } from \"../../Event\";\r\nimport { IControllerConfigurationService } from \"./IControllerConfigurationService\";\r\nimport { TypedEvent } from '../../TypedEvent';\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { Api } from \"../../Api\";\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { ISessionService } from \"../Session/ISessionService\";\r\nimport { SessionService } from '../Session/SessionService';\r\nimport { DataFrame, Method, Status } from \"../../DataFrame\";\r\nimport { ILocalStorageService } from '../ILocalStorageService';\r\nimport { LocalStorageService } from \"../LocalStorageService\";\r\nimport { DependencyContainer } from \"../../DependencyContainer\";\r\n\r\nexport class ControllerConfigurationService implements IControllerConfigurationService {\r\n private _connection: IExalusConnectionService | null = null;\r\n private _session: ISessionService | null = null;\r\n private _localStorage: ILocalStorageService | null = null;\r\n public static readonly ServiceName: string = \"ControllerConfigurationService\";\r\n private _onEnteredConfigurationEvent: IEvent = new Event();\r\n private _onExitedConfigurationEvent: IEvent = new Event();\r\n private _onConfigurationTimeCheckedEvent: ITypedEvent<Date> = new TypedEvent<Date>();\r\n private _configurationTime: Date = new Date();\r\n private _appEnteredConfigurationMode: boolean = false;\r\n private _didConfigurationChange: boolean = false;\r\n private _synchronizationTaskCompletionSource: Promise<void> = new Promise<void>((resolve) => {\r\n Api.Get<ISessionService>(SessionService.ServiceName).OnUserLoggedInEvent().Subscribe(async user => {\r\n this._didConfigurationChange = await this.CheckIfConfigurationHasChangedAsync();\r\n resolve();\r\n });\r\n });\r\n\r\n GetServiceName(): string {\r\n return ControllerConfigurationService.ServiceName;\r\n }\r\n\r\n constructor() {\r\n this._connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n this._session = Api.Get<ISessionService>(SessionService.ServiceName);\r\n this._localStorage = Api.Get<ILocalStorageService>(LocalStorageService.ServiceName);\r\n\r\n this._connection.OnDataReceivedEvent().Subscribe(data => {\r\n if (data.Resource == \"/info/configuration/mode/entry\") {\r\n if (!this._appEnteredConfigurationMode)\r\n (this._onEnteredConfigurationEvent as Event).Invoke();\r\n }\r\n else if (data.Resource == \"/info/configuration/mode/exit\") {\r\n if (!this._appEnteredConfigurationMode)\r\n (this._onExitedConfigurationEvent as Event).Invoke();\r\n }\r\n });\r\n }\r\n\r\n async DidCofigurationChangeAsync(): Promise<boolean> {\r\n let result = await this._synchronizationTaskCompletionSource;\r\n return Promise.resolve(this._didConfigurationChange);\r\n }\r\n\r\n private GetLastKnownConfigurationChangeTime(): Date {\r\n const result = this._localStorage?.Read<string>(this.GetServiceName(), \"last_configuration_time\");\r\n\r\n if (result != null)\r\n return new Date(result);\r\n else\r\n return new Date();\r\n }\r\n\r\n private SaveLastConfigurationChangeTime(time: Date): void {\r\n this._localStorage?.Save(this.GetServiceName(), \"last_configuration_time\", time.toString());\r\n }\r\n\r\n async EnterConfigurationModeAsync(): Promise<void> {\r\n this._appEnteredConfigurationMode = true;\r\n await this._connection?.SendAndWaitForResponseAsync(new EntryConfigurationModeRequest(), 20000, false);\r\n }\r\n\r\n async ExitConfigurationModeAsync(): Promise<void> {\r\n await this._connection?.SendAndWaitForResponseAsync(new ExitConfigurationModeRequest(), 20000, false);\r\n this._appEnteredConfigurationMode = false;\r\n }\r\n\r\n OnEnteredConfigurationEvent(): IEvent {\r\n return this._onEnteredConfigurationEvent;\r\n }\r\n\r\n OnExitedConfigurationEvent(): IEvent {\r\n return this._onExitedConfigurationEvent;\r\n }\r\n\r\n OnConfigurationTimeCheckedEvent(): ITypedEvent<Date> {\r\n return this._onConfigurationTimeCheckedEvent;\r\n }\r\n\r\n async GetLastConfigurationChangeTimeAsync(): Promise<Date> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<string>(new LastChangeTimeRequest(), 20000, false);\r\n\r\n if (result == null || result?.Status != Status.OK)\r\n throw new Error(\"Failed to get last configuration change time\");\r\n\r\n this._configurationTime = new Date(result.Data as string);\r\n return this._configurationTime;\r\n }\r\n\r\n async CheckIfConfigurationHasChangedAsync(): Promise<boolean> {\r\n const result = await this.GetLastConfigurationChangeTimeAsync();\r\n if (this.GetLastKnownConfigurationChangeTime().toString() != result.toString()) {\r\n this.SaveLastConfigurationChangeTime(result);\r\n (this._onConfigurationTimeCheckedEvent as TypedEvent<Date>).Invoke(result);\r\n return true;\r\n }\r\n else\r\n return false;\r\n }\r\n}\r\n\r\nclass EntryConfigurationModeRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/system/configuration/mode/entry\";\r\n this.Method = Method.Put;\r\n }\r\n}\r\n\r\nclass ExitConfigurationModeRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/system/configuration/mode/exit\";\r\n this.Method = Method.Put;\r\n }\r\n}\r\n\r\nclass LastChangeTimeRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/system/configuration/change/time\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\n","import { Api } from '../../Api';\r\nimport { DataFrame, Status } from \"../../DataFrame\";\r\nimport { IWebApiCacheService } from \"./IWebApiCacheService\";\r\nimport { ILocalStorageService } from '../ILocalStorageService';\r\nimport { LocalStorageService } from '../LocalStorageService';\r\nimport { ILoggerService } from '../Logging/ILoggerService';\r\nimport { LoggerService } from '../Logging/LoggerService';\r\n\r\nexport class WebApiCacheService implements IWebApiCacheService {\r\n private static _localStorageService: ILocalStorageService | null = null;\r\n private _log: ILoggerService = Api.Get<ILoggerService>(LoggerService.ServiceName);\r\n public static readonly ServiceName: string = \"WebApiCacheService\";\r\n\r\n constructor() {\r\n WebApiCacheService._localStorageService = Api.Get<ILocalStorageService>(LocalStorageService.ServiceName);\r\n }\r\n\r\n GetServiceName(): string {\r\n return WebApiCacheService.ServiceName;\r\n }\r\n\r\n private GetResourceName(data: DataFrame<any>): string {\r\n return `${data.Resource}_${data.Method}`;\r\n }\r\n\r\n Cache(data: DataFrame<any>): void {\r\n \r\n if (data.Status !== Status.OK)\r\n return;\r\n\r\n this._log.Debug(WebApiCacheService.ServiceName, `Caching request: ${data.Resource} ${data.Method}`);\r\n WebApiCacheService._localStorageService?.Save(this.GetServiceName(), this.GetResourceName(data), data);\r\n }\r\n\r\n GetCache(data: DataFrame<any>): DataFrame<any> | null {\r\n let tmp = WebApiCacheService._localStorageService?.Read<DataFrame<any>>(this.GetServiceName(), this.GetResourceName(data));\r\n\r\n if (tmp != null)\r\n this._log.Debug(WebApiCacheService.ServiceName, `Got request response from cache: ${data.Resource} ${data.Method}`);\r\n\r\n return tmp as DataFrame<any>;\r\n }\r\n\r\n ClearCache(): void {\r\n WebApiCacheService._localStorageService?.DropStorage(this.GetServiceName());\r\n this._log.Debug(WebApiCacheService.ServiceName, `Clearing cache for ${this.GetServiceName()}`);\r\n }\r\n\r\n Remove(data: DataFrame<any>): void {\r\n WebApiCacheService._localStorageService?.Remove(this.GetServiceName(), this.GetResourceName(data));\r\n this._log.Debug(WebApiCacheService.ServiceName, `Clearing cache for cache: ${data.Resource} ${data.Method}`);\r\n }\r\n}","import * as signalR from \"@microsoft/signalr\";\r\nimport { DataFrame, IDataFrame, Method, Status } from \"../DataFrame\";\r\nimport { ConnectionResult, IExalusConnectionService, AuthorizationInfo, ConnectionState } from \"./IExalusConnectionService\";\r\nimport { ITypedEvent, TypedEvent } from \"../TypedEvent\";\r\nimport { Api } from '../Api';\r\nimport { LoggerService } from \"./Logging/LoggerService\";\r\nimport { ILoggerService } from './Logging/ILoggerService';\r\nimport { IEvent, Event } from \"../Event\";\r\nimport { IControllerConfigurationService } from \"./Controller/IControllerConfigurationService\";\r\nimport { ControllerConfigurationService } from \"./Controller/ControllerConfigurationService\";\r\nimport { IWebApiCacheService } from './WebApi/IWebApiCacheService';\r\nimport { WebApiCacheService } from './WebApi/WebApiCacheService';\r\nimport { ISessionService } from \"./Session/ISessionService\";\r\nimport { SessionService } from \"./Session/SessionService\";\r\nimport { AsyncLock } from \"../AsyncLock\";\r\n\r\nexport class ExalusConnectionService implements IExalusConnectionService {\r\n private _logPackets: boolean = false;\r\n private _connection?: signalR.HubConnection;\r\n private _disconnectedOnPurpose: boolean = false;\r\n private _defaultPacketsBrokerAddress?: string = \"br1.tr7.pl\";\r\n private _serversBrokerAddress?: string = \"https://broker.tr7.pl\";\r\n private _address?: string = \"br1.tr7.pl\";\r\n private _serialId?: string;\r\n private _PIN?: string;\r\n private _isEstabilished: boolean = false;\r\n private readonly _timeout: number = 10000;\r\n private _dataReceivedEvent: ITypedEvent<DataFrame<any>> = new TypedEvent<IDataFrame<any>>();\r\n private _pongReceivedEvent: IEvent = new Event();\r\n private _authorizationReceivedEvent: ITypedEvent<boolean> = new TypedEvent<boolean>();\r\n private _registrationReceivedEvent: ITypedEvent<string> = new TypedEvent<string>();\r\n private _connectionStateChangedEvent: ITypedEvent<ConnectionState> = new TypedEvent<ConnectionState>();\r\n private _errorOccuredEvent: ITypedEvent<[sender: string, data: string]> = new TypedEvent<[sender: string, data: string]>();\r\n private _log: ILoggerService = Api.Get<ILoggerService>(LoggerService.ServiceName);\r\n private _controllerConfiguration: IControllerConfigurationService | null = null;\r\n private _cache: IWebApiCacheService | null = null;\r\n private _session: SessionService | null = null;\r\n public static readonly ServiceName: string = \"ExalusConnectionService\";\r\n private _packetsBrokerServers: string[] = [\"br1.tr7.pl\", \"br1.exala.pl\"];\r\n\r\n GetServiceName(): string {\r\n return ExalusConnectionService.ServiceName;\r\n }\r\n\r\n EnablePacketsLogging(): void {\r\n this._logPackets = true;\r\n }\r\n\r\n DisablePacketsLogging(): void {\r\n this._logPackets = false;\r\n }\r\n\r\n private InitializeConnection(): void {\r\n this._controllerConfiguration = Api.Get<IControllerConfigurationService>(ControllerConfigurationService.ServiceName);\r\n this._cache = Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName);\r\n this._session = Api.Get<SessionService>(SessionService.ServiceName);\r\n\r\n if (this._connection) {\r\n try {\r\n this._connection.stop();\r\n }\r\n catch (ex: any) { }\r\n\r\n this._connection = undefined;\r\n }\r\n\r\n if (!this._address)\r\n throw new Error(\"Domain is not set\");\r\n\r\n if (!this._serialId)\r\n throw new Error(\"SerialId is not set\");\r\n\r\n if (!this._PIN)\r\n throw new Error(\"PIN is not set\");\r\n\r\n this._connection = new signalR.HubConnectionBuilder()\r\n .withUrl(`https://${this._address}/broker`)\r\n .build();\r\n }\r\n\r\n SetServersBrokerAddress(address: string): void {\r\n this._serversBrokerAddress = address;\r\n }\r\n\r\n SetDefaultPacketsBrokerAddress(address: string): void {\r\n this._defaultPacketsBrokerAddress = address;\r\n this._address = address;\r\n }\r\n\r\n async GetServerAddressAsync(): Promise<string | null> {\r\n try {\r\n let result = await fetch(`${this._serversBrokerAddress}/api/connections/broker/whichserver/${this._serialId}`);\r\n\r\n if (result.ok) {\r\n let address = await result.text();\r\n\r\n if (!address) {\r\n this._log.Error(ExalusConnectionService.ServiceName, `Failed to get server address, status: ${result.status}`);\r\n return null;\r\n }\r\n\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Got server address: ${address}`);\r\n return address;\r\n }\r\n else {\r\n this._log.Error(ExalusConnectionService.ServiceName, `Failed to get server address, status: ${result.status}`);\r\n return null;\r\n }\r\n }\r\n catch (ex: any) {\r\n this._log.Error(ExalusConnectionService.ServiceName, ex);\r\n return null;\r\n }\r\n }\r\n\r\n async ConnectAsync(address: string): Promise<ConnectionResult> {\r\n this._address = address;\r\n return await this.connectAsync();\r\n }\r\n\r\n AuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<boolean> {\r\n let timeoutTime = 2000;\r\n return new Promise<boolean>(async (resolve, reject) => {\r\n let timeoutId = 0;\r\n\r\n let sub = (result: boolean) => {\r\n window.clearTimeout(timeoutId);\r\n this._authorizationReceivedEvent.Unsubscribe(sub);\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Got authorization result: ${result}`);\r\n resolve(result);\r\n };\r\n\r\n let onTimeout = () => {\r\n window.clearTimeout(timeoutId);\r\n this._authorizationReceivedEvent.Unsubscribe(sub);\r\n resolve(false);\r\n };\r\n\r\n timeoutId = window.setTimeout(onTimeout, timeoutTime);\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Authorizing to cloud using: ${authorizationInfo.SerialNumber} PIN: ${authorizationInfo.PIN}`);\r\n this._authorizationReceivedEvent.Subscribe(sub);\r\n await this._connection?.send(\"AuthorizeTo\", authorizationInfo.SerialNumber, authorizationInfo.PIN);\r\n });\r\n }\r\n\r\n async ConnectAndAuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<ConnectionResult> {\r\n //if (this._isEstabilished)\r\n // return Promise.resolve(ConnectionResult.Connected);\r\n\r\n //this._isEstabilished = true;\r\n\r\n Api.WorksInContextOf = authorizationInfo.SerialNumber;\r\n this._serialId = authorizationInfo.SerialNumber;\r\n this._PIN = authorizationInfo.PIN;\r\n var packetsBroker = await this.GetServerAddressAsync();\r\n\r\n if (!packetsBroker || packetsBroker == null) {\r\n let result = ConnectionResult.ControllerIsNotConnected;\r\n\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Server did not return packets broker address, trying to connect to known brokers.`);\r\n\r\n for (let server of this._packetsBrokerServers) {\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Testing connection to ${server}`);\r\n this.SetDefaultPacketsBrokerAddress(server);\r\n\r\n try {\r\n await this.DisconnectAsync();\r\n }\r\n catch (ex: any) { }\r\n\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Connecting to server: ${server}`);\r\n let conResult = await this.connectAsync();\r\n\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Connection result: ${conResult}`);\r\n if (conResult == ConnectionResult.Connected)\r\n if (await this.AuthorizeAsync(authorizationInfo)) {\r\n result = ConnectionResult.Connected;\r\n return result;\r\n }\r\n else {\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Failed to authorize in ${server}`);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n else {\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Got packets broker address: ${packetsBroker}`);\r\n this.SetDefaultPacketsBrokerAddress(packetsBroker);\r\n let conResult = await this.connectAsync();\r\n\r\n if (conResult != ConnectionResult.Connected)\r\n return conResult;\r\n\r\n return await this.AuthorizeAsync(authorizationInfo)\r\n ? ConnectionResult.Connected : ConnectionResult.AuthorizationFailed;\r\n }\r\n }\r\n\r\n private async connectAsync(): Promise<ConnectionResult> {\r\n let result = ConnectionResult.FailedToConnect;\r\n\r\n if (!this._address)\r\n return Promise.resolve(ConnectionResult.ControllerIsNotConnected);\r\n\r\n if (this._disconnectedOnPurpose) {\r\n this._disconnectedOnPurpose = false;\r\n }\r\n\r\n const connectionEvent = this._connectionStateChangedEvent as TypedEvent<ConnectionState>;\r\n this.InitializeConnection();\r\n\r\n this._connection?.onclose(async () => {\r\n this._log.Error(ExalusConnectionService.ServiceName, `Connection closed`);\r\n\r\n Api.Get<SessionService>(SessionService.ServiceName).CreateSessionCompletionSourceAsync();\r\n this.FireConnectionStateChanged();\r\n\r\n if (this._connection?.state !== signalR.HubConnectionState.Disconnected)\r\n return;\r\n\r\n if (this._disconnectedOnPurpose)\r\n return;\r\n\r\n await this._connection?.start();\r\n\r\n if (this._connection != null) {\r\n await this.AuthorizeAsync(new AuthorizationInfo(this._serialId as string, this._PIN as string));\r\n this._log.Info(ExalusConnectionService.ServiceName, `Reconnected from onClose`);\r\n return this.FireConnectionStateChanged();\r\n }\r\n\r\n return ConnectionResult.FailedToConnect;\r\n });\r\n\r\n this._connection?.onreconnected(async () => {\r\n await this.AuthorizeAsync(new AuthorizationInfo(this._serialId as string, this._PIN as string));\r\n this._log.Info(ExalusConnectionService.ServiceName, `Reconnected from onreconnected`);\r\n return this.FireConnectionStateChanged();\r\n });\r\n\r\n this._connection?.onreconnecting(() => {\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Reconnecting...`);\r\n return this.FireConnectionStateChanged();\r\n });\r\n\r\n await this._connection?.start();\r\n\r\n this._connection?.on(\"Pong\", () => {\r\n this._log.Debug(ExalusConnectionService.ServiceName, \"Pong received <-\");\r\n (this._pongReceivedEvent as Event).Invoke();\r\n });\r\n\r\n this._connection?.on(\"Registration\", (data: string) => {\r\n (this._registrationReceivedEvent as TypedEvent<string>)?.Invoke(data);\r\n });\r\n\r\n this._connection?.on(\"Authorization\", (data: boolean) => {\r\n (this._authorizationReceivedEvent as TypedEvent<boolean>)?.Invoke(data);\r\n });\r\n\r\n this._connection?.on(\"SendError\", async (sender: string, data: string) => {\r\n if (sender.startsWith(\"NotAuthorized:\")) {\r\n this._log.Error(ExalusConnectionService.ServiceName, \"Failed to authorize!\");\r\n await this.AuthorizeAsync(new AuthorizationInfo(this._serialId as string, this._PIN as string));\r\n }\r\n else {\r\n this._log.Error(ExalusConnectionService.ServiceName, `Server returned error: ${sender} ${data}`);\r\n (this._errorOccuredEvent as TypedEvent<[sender: string, data: string]>).Invoke([sender, data]);\r\n }\r\n });\r\n\r\n let dataReceivedEvent = this._dataReceivedEvent as TypedEvent<IDataFrame<any>>;\r\n\r\n this._connection?.on(\"Data\", (sender: string, data: string) => {\r\n const d = JSON.parse(data);\r\n\r\n if (this._logPackets)\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Received data:\\n${JSON.stringify(d, null, 2)}`);\r\n\r\n dataReceivedEvent.Invoke(d as IDataFrame<any>);\r\n });\r\n\r\n if (this._connection != null)\r\n return this.FireConnectionStateChanged();\r\n\r\n return ConnectionResult.FailedToConnect;\r\n }\r\n\r\n FireConnectionStateChanged(): ConnectionResult {\r\n const connectionEvent = this._connectionStateChangedEvent as TypedEvent<ConnectionState>;\r\n\r\n switch (this._connection?.state) {\r\n case signalR.HubConnectionState.Connected:\r\n connectionEvent.Invoke(ConnectionState.Connected);\r\n return ConnectionResult.Connected;\r\n\r\n case signalR.HubConnectionState.Connecting:\r\n connectionEvent.Invoke(ConnectionState.Connecting);\r\n return ConnectionResult.Connected;\r\n\r\n case signalR.HubConnectionState.Disconnected:\r\n connectionEvent.Invoke(ConnectionState.Disconnected);\r\n return ConnectionResult.FailedToConnect;\r\n\r\n case signalR.HubConnectionState.Disconnecting:\r\n connectionEvent.Invoke(ConnectionState.Disconnecting);\r\n return ConnectionResult.FailedToConnect;\r\n\r\n case signalR.HubConnectionState.Reconnecting:\r\n connectionEvent.Invoke(ConnectionState.Reconnecting);\r\n return ConnectionResult.FailedToConnect;\r\n }\r\n\r\n return ConnectionResult.FailedToConnect;\r\n }\r\n\r\n async DisconnectAsync(): Promise<void> {\r\n this._disconnectedOnPurpose = true;\r\n await this._connection?.stop();\r\n }\r\n\r\n IsConnected(): boolean {\r\n return this._connection?.state === signalR.HubConnectionState.Connected;\r\n }\r\n\r\n SendAndWaitForResponseAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean, logTransmission: boolean = true): Promise<IDataFrame<T>> {\r\n return this.SendAndWaitForResponseWithRepeatAsync(dataFrame, timeout, useCache, logTransmission);\r\n }\r\n\r\n async SendAndWaitForResponseWithRepeatAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean, repeat = true, logTransmission: boolean = true): Promise<IDataFrame<T>> {\r\n if (dataFrame.Method === Method.Get && useCache) {\r\n if (!await this._controllerConfiguration?.DidCofigurationChangeAsync()) {\r\n let res = this._cache?.GetCache(dataFrame) as IDataFrame<T>;\r\n\r\n if (res !== null) {\r\n return Promise.resolve(res);\r\n }\r\n }\r\n }\r\n\r\n let timeoutId = 0;\r\n const startTime = Date.now();\r\n\r\n if (!this.IsConnected())\r\n throw new Error(\"Connection is not established\");\r\n\r\n if (dataFrame.Resource !== \"/users/user/login\")\r\n await this._session?.WaitForSessionCreationAsync();\r\n\r\n return new Promise<IDataFrame<T>>(async (resolve, reject) => {\r\n let onReceivedFrame = async (receivedFrame?: IDataFrame<any>) => {\r\n if (receivedFrame?.TransactionId == dataFrame.TransactionId) {\r\n window.clearTimeout(timeoutId);\r\n this._dataReceivedEvent.Unsubscribe(onReceivedFrame);\r\n const difference = Date.now() - startTime;\r\n\r\n if (logTransmission)\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Received response for: ${receivedFrame?.Resource} ${receivedFrame?.Method} id: ${receivedFrame?.TransactionId} in ${difference}ms`);\r\n\r\n if (dataFrame.Method === Method.Get && useCache)\r\n this._cache?.Cache(receivedFrame as DataFrame<any>);\r\n\r\n if (!useCache && receivedFrame?.Status === Status.UserIsNotLoggedIn && repeat) {\r\n await this._session?.RestoreSessionAsync();\r\n resolve(await this.SendAndWaitForResponseWithRepeatAsync(dataFrame, timeout, useCache, false, logTransmission));\r\n }\r\n\r\n resolve(receivedFrame as IDataFrame<T>);\r\n }\r\n };\r\n\r\n this._dataReceivedEvent.Subscribe(onReceivedFrame);\r\n\r\n timeoutId = window.setTimeout(() => {\r\n this._dataReceivedEvent.Unsubscribe(onReceivedFrame);\r\n let errorMessage = `Response timeout, resource: ${dataFrame.Resource} method: ${dataFrame.Method} transaction id: ${dataFrame.TransactionId}`;\r\n this._log.Error(ExalusConnectionService.ServiceName, errorMessage);\r\n reject(new signalR.TimeoutError(errorMessage));\r\n }, timeout);\r\n\r\n if (!await this.SendAsync(dataFrame, logTransmission)) {\r\n let errorMessage = `Failed to send request, resource: ${dataFrame.Resource} method: ${dataFrame.Method} transaction id: ${dataFrame.TransactionId}`;\r\n reject(new Error(errorMessage));\r\n }\r\n });\r\n }\r\n\r\n SendAsync(dataFrame: IDataFrame<any>, logTransmission: boolean = false): Promise<boolean> {\r\n\r\n if (!this.IsConnected())\r\n throw new Error(\"Connection is not established\");\r\n\r\n return new Promise<boolean>((resolve) => {\r\n\r\n if (this._logPackets)\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Sent DataFrame ${dataFrame.Resource} ${dataFrame.Method} transaction id: ${dataFrame.TransactionId} data:\\n${JSON.stringify(dataFrame, null, 2)}`);\r\n\r\n else if (logTransmission)\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Sent DataFrame ${dataFrame.Resource} ${dataFrame.Method} transaction id: ${dataFrame.TransactionId}`);\r\n\r\n\r\n this._connection?.invoke(\"SendTo\", this._serialId, dataFrame)\r\n .then(() => {\r\n resolve(true);\r\n })\r\n .catch(err => {\r\n this._log.Error(ExalusConnectionService.ServiceName, `${err}`);\r\n resolve(false);\r\n });\r\n });\r\n }\r\n\r\n OnDataReceivedEvent(): ITypedEvent<any> {\r\n return this._dataReceivedEvent;\r\n }\r\n\r\n OnConnectionStateChangedEvent(): ITypedEvent<ConnectionState> {\r\n return this._connectionStateChangedEvent;\r\n }\r\n\r\n OnErrorOccuredEvent(): ITypedEvent<[sender: string, data: string]> {\r\n return this._errorOccuredEvent;\r\n }\r\n}","import { IDeviceState, IDeviceStateData } from './IDeviceState';\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\nimport { IDeviceTask } from './IDeviceTask';\r\nimport { DeviceResponseType, DeviceTaskType, IDevice, IDeviceResponseTypeInfo, IDeviceTaskTypeInfo } from './IDevice';\r\nimport { ITypedEvent } from '../../TypedEvent';\r\nimport { FieldChangeResult, FieldChangeResultType } from '../FieldChangeResult';\r\n\r\nexport interface IDeviceChannel\r\n{\r\n get Number(): number;\r\n set Number(value: number);\r\n\r\n get Name(): string;\r\n set Name(value: string);\r\n\r\n get IconName(): string;\r\n set IconName(value: string);\r\n\r\n get States(): IDeviceState<IDeviceStateData>[];\r\n set States(value: IDeviceState<IDeviceStateData>[]);\r\n\r\n set State(value: IDeviceState<IDeviceStateData>);\r\n\r\n get Mode(): ChannelConfigurations;\r\n get ChannelGroups(): string[];\r\n\r\n get IsHidden(): boolean;\r\n \r\n get AvailableTaskTypes(): IDeviceTaskTypeInfo[];\r\n get AvailableResponseTypes(): IDeviceResponseTypeInfo[];\r\n \r\n GetDevice(): IDevice;\r\n HideAsync(): Promise<FieldChangeResult>;\r\n ShowAsync(): Promise<FieldChangeResult>;\r\n ChangeNameAsync(name: string): Promise<FieldChangeResult>;\r\n ChangeIconNameAsync(name: string): Promise<FieldChangeResult>;\r\n ChangeGroupsAsync(groups: string[]): Promise<FieldChangeResult>;\r\n ExecuteTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult>;\r\n OnTasksExecutionChangeEvent(): ITypedEvent<TaskExecution>;\r\n}\r\n\r\nexport enum TaskExecution {\r\n NoTasksExecuting = 0,\r\n ExecutingTasks = 1\r\n}\r\n\r\nexport enum ChannelConfigurations\r\n {\r\n Default = 0,\r\n Monostable = 1,\r\n Bistable = 2,\r\n Gate = 3,\r\n Gateway = 4,\r\n }","import { IDeviceTask } from './IDeviceTask';\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\nimport { ChannelConfigurations, IDeviceChannel, TaskExecution } from './IDeviceChannel';\r\nimport { FieldChangeResult } from '../FieldChangeResult';\r\nimport { ITypedEvent } from '../../TypedEvent';\r\nimport { IDeviceState } from './IDeviceState';\r\n\r\nexport interface IDevice {\r\n OnDeviceStateChangedEvent(): ITypedEvent<IDeviceState<any>>;\r\n OnDeviceTasksExecutionChangedOnChannelsEvent(): ITypedEvent<number[]>;\r\n\r\n get Guid(): string;\r\n get Name(): string;\r\n get SerialNumber(): string | null;\r\n get ModelGuid(): string | null;\r\n get ManufacturerGuid(): string | null;\r\n get IsVirtual(): boolean;\r\n get IsEnabled(): boolean;\r\n get DeviceState(): DeviceState;\r\n get DeviceType(): DeviceType;\r\n get CommunicationWay(): CommunicationWay;\r\n get AvailableTaskTypes(): IDeviceTaskTypeInfo[];\r\n get AvailableResponseTypes(): IDeviceResponseTypeInfo[];\r\n get ChannelsAmount(): number;\r\n get Channels(): IDeviceChannel[];\r\n\r\n ChangeDeviceNameAsync(name: string): Promise<FieldChangeResult>;\r\n RemoveDeviceAsync(): Promise<DeviceTaskExecutionResult>;\r\n ExecuteDeviceTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult>;\r\n ExecuteTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult>;\r\n}\r\n\r\nexport interface IDeviceTaskTypeInfo {\r\n get Type(): DeviceTaskType;\r\n get InterfaceType(): string;\r\n}\r\n\r\nexport class DeviceTaskTypeInfo implements IDeviceTaskTypeInfo {\r\n private _type: DeviceTaskType = DeviceTaskType.Unknown;\r\n private _interfaceType: string = \"\";\r\n\r\n get Type(): DeviceTaskType {\r\n return this._type;\r\n }\r\n\r\n get InterfaceType(): string {\r\n return this._interfaceType;\r\n }\r\n\r\n set InterfaceType(value: string) {\r\n this._interfaceType = value;\r\n this._type = value as DeviceTaskType;\r\n }\r\n}\r\n\r\nexport enum DeviceTaskType {\r\n Unknown = \"Unknown\",\r\n SetBlindPosition = \"IBlindPosition\",\r\n SetBlindPositionSimple = \"IBlindPositionSimple\",\r\n SetBlindMicroventilation = \"IMicroventilation\",\r\n TurnOff = \"IChannelOff\",\r\n TurnOn = \"IChannelOn\",\r\n TogleState = \"IChannelSwitchState\",\r\n SetLightBrightnessDynamicly = \"IDynamicLightBrightness\",\r\n SetLightBrightness = \"ILightBrightness\",\r\n SetLightColor = \"ILightColor\",\r\n SetLightTemperature = \"ILightTemperature\",\r\n PairDevice = \"IPair\",\r\n UnpairDevice = \"IUnpair\",\r\n IdentifyDevice = \"IIdentifyDevice\",\r\n GetChannelsState = \"IGetDeviceState\",\r\n GetPowerMeasurements = \"IGetPowerMeasurements\",\r\n GetAvailableData = \"IGetAvailableData\",\r\n MultipleDataRequest = \"IMultipleDataRequest\",\r\n SetBlindOpenCloseTime = \"ISetBlindOpenCloseTime\",\r\n SetTemperature = \"IChangeTemperature\",\r\n //SetGatePosition = \"IGatePosition\",\r\n //SetGatewayPosition = \"IGatewayPosition\",\r\n ChangeGatePositionPulse = \"IGatePulse\",\r\n ChangeGatewayPositionPulse = \"IGatewayPulse\",\r\n SetFacadePosition = \"IFacadePosition\",\r\n GetFacadeType = \"IGetFacadeType\"\r\n}\r\n\r\nexport interface IDeviceResponseTypeInfo {\r\n get Type(): DeviceResponseType;\r\n get InterfaceType(): string;\r\n}\r\n\r\nexport class DeviceResponseTypeInfo implements IDeviceResponseTypeInfo {\r\n private _type: DeviceResponseType = DeviceResponseType.Unknown;\r\n private _interfaceType: string = \"\";\r\n\r\n get Type(): DeviceResponseType {\r\n return this._type;\r\n }\r\n\r\n get InterfaceType(): string {\r\n return this._interfaceType;\r\n }\r\n\r\n set InterfaceType(value: string) {\r\n this._interfaceType = value;\r\n this._type = value as DeviceResponseType;\r\n }\r\n}\r\n\r\nexport enum DeviceResponseType {\r\n Unknown = \"Unknown\",\r\n BatteryState = \"IBatteryState\",\r\n BinarySensorState = \"IBinarySensor\",\r\n BlindOpenCloseTime = \"IBlindOpenCloseTime\",\r\n BlindPosition = \"IBlindPosition\",\r\n BlindRemoteButtonState = \"IBlindsControlButton\",\r\n MeasuredBrightness = \"IBrightness\",\r\n RemoteButtonState = \"IButtonState\",\r\n ChannelOnOffState = \"IChannelOnOff\",\r\n DoorBellState = \"IDoorBell\",\r\n FacadeRemoteButtonState = \"IFacadeControlButton\",\r\n FacadePosition = \"IFacadeState\",\r\n FacadeType = \"IFacadeType\",\r\n FloodSensorState = \"IFloodSensor\",\r\n GatePosition = \"IGatePosition\",\r\n GatewayPosition = \"IGatewayPosition\",\r\n HumiditySensorState = \"IHumiditySensor\",\r\n LightBrightness = \"ILightBrightness\",\r\n LightColor = \"ILightColor\",\r\n LightWarmth = \"ILightTemperature\",\r\n LightTreshold = \"ILightTreshold\",\r\n MovementSensorState = \"IMovementSensor\",\r\n OnlineCamera = \"IOnlineCamera\",\r\n OvercurrentProtectionState = \"IOvercurrentProtection\",\r\n OvercurrentProtectionThreshold = \"IOvercurrentProtectionThreshold\",\r\n ReedState = \"IReedState\",\r\n SignalStrength = \"ISignalStrength\",\r\n SmokeSensorState = \"ISmokeSensor\",\r\n MeasuredTemperature = \"ITemperature\",\r\n VibrationSensorState = \"IVibrationSensor\",\r\n MeasuredWindSpeed = \"IWindSpeed\",\r\n WindThreshold = \"IWindThreshold\",\r\n MeasuredEnergy = \"IEnergy\",\r\n MeasuredDistance = \"DistanceSensor\",\r\n BlindCalibration = \"BlindCalibration\",\r\n ConfigurationState = \"ConfigurationState\",\r\n CurrentWindThreshold = \"CurrentWindThreshold\",\r\n CurrentLightThreshold = \"CurrentLightThreshold\",\r\n WindSpeedState = \"WindSpeed\",\r\n TamperProtectionState = \"ITamperProtection\",\r\n PressureSensorState = \"IPressureSensor\",\r\n}\r\n\r\nexport enum DeviceState {\r\n NotResponding = 0,\r\n Working = 1,\r\n Broken = 2,\r\n FirmareUpgradeMode = 3\r\n}\r\n\r\nexport enum CommunicationWay {\r\n TwoWay = 1,\r\n OneWay = 2,\r\n ConditionalTwoWay = 3\r\n}\r\n\r\nexport enum DeviceType {\r\n Unknown = -1,\r\n Multipurpose = 0,\r\n Controller = 1,\r\n Driver = 2,\r\n Receiver = 3,\r\n Remote = 4,\r\n Sensor = 5,\r\n Scene = 6,\r\n}\r\n\r\nexport class DeviceTasksInfo {\r\n DeviceGuid: string = \"\";\r\n Channel: number = 0;\r\n Status: TaskExecution = TaskExecution.NoTasksExecuting;\r\n}\r\n\r\nexport enum TaskExecutionResult {\r\n Unknown = 0,\r\n Executed = 1,\r\n ResponseTimeout = 2,\r\n TaskRepeatedAndExecuted = 3,\r\n TaskRepeatedResponseTimeout = 4,\r\n FlowControlNotAvailable = 5,\r\n ExecutionError = 6,\r\n}","export enum DeviceTaskExecutionResult {\r\n ControllerResponseTimeout = -4,\r\n DeviceNotFound = -3,\r\n DeviceResponseTimeout = -2,\r\n Failed = -1,\r\n Unknown = 0,\r\n Executed = 1,\r\n}","import { DeviceResponseType } from \"./IDevice\";\r\nimport { DeviceStateChangedObject } from \"./DevicesService\";\r\n\r\nexport class DeviceState<T extends IDeviceStateData> implements IDeviceState<T> {\r\n _type: string = \"\";\r\n _data: T | null = null;\r\n _typeAsEnum: DeviceResponseType = DeviceResponseType.Unknown;\r\n\r\n get Data(): T {\r\n return this._data as T;\r\n }\r\n\r\n set Data(value: T) {\r\n this._data = value;\r\n }\r\n\r\n get Type(): string {\r\n return this._type;\r\n }\r\n\r\n set Type(value: string) {\r\n this._type = value;\r\n }\r\n\r\n get TypeAsEnum(): DeviceResponseType {\r\n return this._typeAsEnum;\r\n }\r\n\r\n set TypeAsEnum(value: DeviceResponseType) {\r\n this._typeAsEnum = value;\r\n }\r\n}\r\n\r\nexport interface IDeviceStateData {\r\n Channel: number;\r\n StateReliability: StateReliability;\r\n Time: string;\r\n}\r\n\r\nexport interface IDeviceState<T extends IDeviceStateData> {\r\n get Type(): string;\r\n get TypeAsEnum(): DeviceResponseType;\r\n get Data(): T;\r\n set Data(value: T);\r\n}\r\n\r\nexport enum StateReliability {\r\n /// <summary>\r\n /// pewny\r\n /// </summary>\r\n Confident = 0,\r\n /// <summary>\r\n /// niepewny\r\n /// </summary>\r\n Unconfident = 1\r\n}\r\n\r\n/// ON/OFF state\r\nexport class ChannelOnOffDeviceState extends DeviceState<ChannelOnOffState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.ChannelOnOffState;\r\n this.Type = \"ChannelOnOffState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class ChannelOnOffState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: ChannelOnOffStateEnum = ChannelOnOffStateEnum.Unknown;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum ChannelOnOffStateEnum {\r\n On = 0,\r\n Off = 1,\r\n Unknown = 2\r\n}\r\n\r\n/// DoorBellState \r\nexport class DoorBellDeviceState extends DeviceState<DoorBellState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.DoorBellState;\r\n this.Type = \"DoorBellState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class DoorBellState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: DoorBellStateEnum = DoorBellStateEnum.Relased;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum DoorBellStateEnum {\r\n Pressed = 0,\r\n Relased = 1,\r\n PressedAndRelased = 2\r\n}\r\n\r\n/// reed position\r\nexport class ReedStateDeviceState extends DeviceState<ReedState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.ReedState;\r\n this.Type = \"ReedState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class ReedState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: boolean = false;\r\n Time: string = \"\";\r\n}\r\n\r\n/// blind position\r\nexport class BlindPositionDeviceState extends DeviceState<BlindPostionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BlindPosition;\r\n this.Type = \"BlindPostionState\";\r\n this.Data = state.state as any;\r\n }\r\n\r\n public GetBlindStatus(): BlindStatusCode {\r\n switch (this.Data.Position) {\r\n case 200:\r\n return BlindStatusCode.UnableToMove;\r\n\r\n case 201:\r\n return BlindStatusCode.MotorOverheatedPleaseWait;\r\n\r\n default:\r\n return BlindStatusCode.Working;\r\n }\r\n }\r\n}\r\n\r\nexport enum BlindStatusCode {\r\n Unknown = 0,\r\n Working = 1,\r\n UnableToMove = 200,\r\n MotorOverheatedPleaseWait = 201,\r\n}\r\n\r\nexport class BlindPostionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Position: number = 0;\r\n RawPosition: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// ButtonState \r\nexport class RemoteButtonDeviceState extends DeviceState<RemoteButtonState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.RemoteButtonState;\r\n this.Type = \"RemoteButtonState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class RemoteButtonState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: RemoteButtonStateEnum = RemoteButtonStateEnum.Relased;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum RemoteButtonStateEnum {\r\n Pressed = 1,\r\n Relased = 2,\r\n PressedAndRelased = 3\r\n}\r\n\r\n/// device light color\r\nexport class LightColorDeviceState extends DeviceState<LightColorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.LightColor;\r\n this.Type = \"LightColorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class LightColorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n R: number = 0;\r\n G: number = 0;\r\n B: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// light warmth\r\nexport class LightWarmthDeviceState extends DeviceState<LightWarmthState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.LightWarmth;\r\n this.Type = \"LightWarmthState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class LightWarmthState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Temperature: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// light brightness\r\nexport class LightBrightnessDeviceState extends DeviceState<LightBrightnessState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.LightBrightness;\r\n this.Type = \"LightBrightnessState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class LightBrightnessState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Brightness: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// MeasuredTemperature\r\nexport class MeasuredTemperatureDeviceState extends DeviceState<MeasuredTemperatureState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MeasuredTemperature;\r\n this.Type = \"MeasuredTemperatureState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MeasuredTemperatureState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Temperature: number = 0;\r\n Type: MeasuredTemperatureTypeEnum = MeasuredTemperatureTypeEnum.InsideTemperature;\r\n Time: string = \"\";\r\n}\r\n\r\nenum MeasuredTemperatureTypeEnum {\r\n AirTemperature = 0,\r\n InsideTemperature = 1,\r\n OutsideTemperature = 2,\r\n FloorTemperature = 3,\r\n SafetyTemperature = 4,\r\n SetTemperature = 5,\r\n}\r\n\r\n/// battery state\r\nexport class BatteryDeviceState extends DeviceState<BatteryState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BatteryState;\r\n this.Type = \"BatteryState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BatteryState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: BatteryStateEnum = BatteryStateEnum.Half;\r\n Percentage: number = -1;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum BatteryStateEnum {\r\n Unknown = -1,\r\n Full = 0,\r\n Empty = 1,\r\n Half = 2,\r\n Percentage = 3,\r\n Low = 4,\r\n ExternalPower = 5\r\n}\r\n\r\n/// measured brightness\r\nexport class MeasuredBrightnessDeviceState extends DeviceState<MeasuredBrightnessState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MeasuredBrightness;\r\n this.Type = \"MeasuredBrightnessState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MeasuredBrightnessState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Brightness: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// measured energy\r\nexport class MeasuredEnergyDeviceState extends DeviceState<MeasuredEnergyState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MeasuredEnergy;\r\n this.Type = \"MeasuredEnergyState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MeasuredEnergyState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Voltage: number = 0;\r\n Current: number = 0;\r\n PhaseShift: number = 0;\r\n ActivePower: number = 0;\r\n ReactivePower: number = 0;\r\n ApparentPower: number = 0;\r\n PowerFactor: number = 0;\r\n ActiveEnergy: number = 0;\r\n ReactiveEnergy: number = 0;\r\n Frequency: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// measured distance\r\nexport class MeasuredDistanceDeviceState extends DeviceState<MeasuredDistanceState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MeasuredDistance;\r\n this.Type = \"MeasuredDistanceState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MeasuredDistanceState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Distance: number = 0;\r\n DetectedObject: DetectedObjectStateEnum = DetectedObjectStateEnum.No;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum DetectedObjectStateEnum {\r\n No = 0,\r\n Yes = 1,\r\n}\r\n\r\n/// movement detection\r\nexport class MovementSensorDeviceState extends DeviceState<MovementSensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MovementSensorState;\r\n this.Type = \"MovementSensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MovementSensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n /// <summary>\r\n /// percentage 0% no movement, 100% intense movement\r\n /// </summary>\r\n Intensity: number = 0;\r\n Movement: MovementStateEnum = MovementStateEnum.No;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum MovementStateEnum {\r\n No = 0,\r\n Yes = 1,\r\n}\r\n\r\n/// remote blind control button\r\nexport class BlindRemoteButtonDeviceState extends DeviceState<BlindRemoteButtonState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BlindRemoteButtonState;\r\n this.Type = \"BlindRemoteButtonState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BlindRemoteButtonState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: BlindRemoteButtonStateEnum = BlindRemoteButtonStateEnum.StopReleased;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum BlindRemoteButtonStateEnum {\r\n OpenPressed = 1,\r\n OpenReleased = 2,\r\n StopPressed = 3,\r\n StopReleased = 4,\r\n ClosePressed = 5,\r\n CloseReleased = 6\r\n}\r\n\r\n/// remote facade control button\r\nexport class FacadeRemoteButtonDeviceState extends DeviceState<FacadeRemoteButtonState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.FacadeRemoteButtonState;\r\n this.Type = \"FacadeRemoteButtonState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class FacadeRemoteButtonState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: FacadeRemoteButtonStateEnum = FacadeRemoteButtonStateEnum.StopReleased;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum FacadeRemoteButtonStateEnum {\r\n OpenPressed = 1,\r\n OpenReleased = 2,\r\n StopPressed = 3,\r\n StopReleased = 4,\r\n ClosePressed = 5,\r\n CloseReleased = 6\r\n}\r\n\r\n/// signal strenght\r\nexport class SignalStrenghtDeviceState extends DeviceState<SignalStrenghtState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.SignalStrength;\r\n this.Type = \"SignalStrenghtState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class SignalStrenghtState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Quality: LinkQualityEnum = LinkQualityEnum.Unknown;\r\n MeasurementTime: string = \"\";\r\n DidLastTaskSucceded: boolean = false;\r\n Percentage: number = 0;\r\n SuccededExecutionsPercentage: number = 0;\r\n SuccededTransmissionsPercentage: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum LinkQualityEnum {\r\n Unknown = 0,\r\n Excellent = 1,\r\n Good = 2,\r\n Acceptable = 3,\r\n Low = 4,\r\n Terrible = 5,\r\n NoLink = 6\r\n}\r\n\r\n/// gate position\r\nexport class GatePositionDeviceState extends DeviceState<GatePositionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.GatePosition;\r\n this.Type = \"GatePositionState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class GatePositionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n PositionType: GatePositionTypeEnum = GatePositionTypeEnum.Unknown;\r\n Position: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum GatePositionTypeEnum {\r\n Unknown = 0,\r\n Open = 1,\r\n PartiallyOpen = 2,\r\n Close = 3,\r\n On = 4,\r\n Off = 5\r\n}\r\n\r\n/// gateway position\r\nexport class GatewayPositionDeviceState extends DeviceState<GatewayPositionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.GatewayPosition;\r\n this.Type = \"GatewayPositionState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class GatewayPositionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n PositionType: GatewayPositionTypeEnum = GatewayPositionTypeEnum.Unknown;\r\n Position: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum GatewayPositionTypeEnum {\r\n Unknown = 0,\r\n Open = 1,\r\n PartiallyOpen = 2,\r\n Close = 3,\r\n On = 4,\r\n Off = 5\r\n}\r\n\r\n/// blind calibration status\r\nexport class BlindCalibrationDeviceState extends DeviceState<BlindCalibrationState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BlindCalibration;\r\n this.Type = \"BlindCalibrationState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BlindCalibrationState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n CalibrationStatus: BlindCalibrationStatusEnum = BlindCalibrationStatusEnum.AutoLernIdle;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum BlindCalibrationStatusEnum {\r\n AutoLernIdle = 0x00,\r\n AutoLernInProgress = 0x01,\r\n AutoLernSuccessfull = 0x02,\r\n AutoLernCancelled = 0x04,\r\n}\r\n\r\n/// humidity sensor\r\nexport class HumiditySensorDeviceState extends DeviceState<HumiditySensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.HumiditySensorState;\r\n this.Type = \"HumiditySensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class HumiditySensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Type: HumidityTypeEnum = HumidityTypeEnum.AirHumidity;\r\n Humidity: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum HumidityTypeEnum {\r\n AirHumidity = 0,\r\n InsideHumidity = 1,\r\n OutsideHumidity = 2,\r\n SafetyHumidity = 3,\r\n SetHumidity = 4,\r\n}\r\n\r\n\r\n/// Vibration sensor\r\nexport class VibrationSensorDeviceState extends DeviceState<VibrationSensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.VibrationSensorState;\r\n this.Type = \"VibrationSensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class VibrationSensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Vibration: VibrationTypeEnum = VibrationTypeEnum.No;\r\n Acceleration_X: number = 0;\r\n Acceleration_Y: number = 0;\r\n Acceleration_Z: number = 0;\r\n AccelerationModule: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum VibrationTypeEnum {\r\n No = 0,\r\n Yes = 1,\r\n}\r\n\r\n/// binary sensor\r\nexport class BinarySensorStateDeviceState extends DeviceState<BinarySensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BinarySensorState;\r\n this.Type = \"BinarySensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BinarySensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: BinarySensorStateEnum = BinarySensorStateEnum.Low;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum BinarySensorStateEnum {\r\n High = 1,\r\n Low = 0\r\n}\r\n\r\n/// ConfigurationState\r\nexport class ConfigurationDeviceState extends DeviceState<ConfigurationState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.ConfigurationState;\r\n this.Type = \"ConfigurationState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class ConfigurationState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Configuration: ConfigurationStateEnum = ConfigurationStateEnum.Unknown;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum ConfigurationStateEnum {\r\n Unknown = 0,\r\n OngoingConfiguration = 1,\r\n NotConfigured = 2,\r\n Configured = 3,\r\n PartiallyConfigured = 4\r\n}\r\n\r\n/// BlindOpenCloseTime\r\nexport class BlindOpenCloseTimeDeviceState extends DeviceState<BlindOpenCloseTimeState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BlindOpenCloseTime;\r\n this.Type = \"BlindOpenCloseTimeState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BlindOpenCloseTimeState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Vibration: VibrationTypeEnum = VibrationTypeEnum.No;\r\n CloseTime: number = 0;\r\n OpenTime: number = 0;\r\n HallCounter: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// OvercurrentProtection\r\nexport class OvercurrentProtectionDeviceState extends DeviceState<OvercurrentProtectionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.OvercurrentProtectionState;\r\n this.Type = \"OvercurrentProtectionState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class OvercurrentProtectionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Triggered: boolean = false;\r\n Time: string = \"\";\r\n}\r\n\r\n/// OvercurrentProtectionThreshold\r\nexport class OvercurrentProtectionThresholdDeviceState extends DeviceState<OvercurrentProtectionThresholdState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.OvercurrentProtectionThreshold;\r\n this.Type = \"OvercurrentProtectionThresholdState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class OvercurrentProtectionThresholdState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Current: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// FacadePositionDeviceState\r\nexport class FacadePositionDeviceState extends DeviceState<FacadePositionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.FacadePosition;\r\n this.Type = \"FacadePositionState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class FacadePositionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Position: number = 0;\r\n Tilt: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport class FacadeTypeDeviceState extends DeviceState<FacadeTypeState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.FacadeType;\r\n this.Type = \"FacadeTypeState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class FacadeTypeState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Time: string = \"\";\r\n FType: FacadeType = FacadeType.Facade180;\r\n}\r\n\r\n/// CurrentWindThreshold\r\nexport class CurrentWindThresholdDeviceState extends DeviceState<CurrentWindThresholdState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.CurrentWindThreshold;\r\n this.Type = \"CurrentWindThresholdState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class CurrentWindThresholdState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n WindThreshold: WindThresholdStateEnum = WindThresholdStateEnum.Unknown;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum WindThresholdStateEnum {\r\n Unknown = 0,\r\n Below = 1,\r\n Exceeded = 2,\r\n Inactive = 3\r\n}\r\n\r\n/// CurrentLightThreshold\r\nexport class CurrentLightThresholdDeviceState extends DeviceState<CurrentLightThresholdState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.CurrentLightThreshold;\r\n this.Type = \"CurrentLightThresholdState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class CurrentLightThresholdState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n LightThreshold: LightThresholdStateEnum = LightThresholdStateEnum.Unknown;\r\n Value: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum LightThresholdStateEnum {\r\n Unknown = 0,\r\n Below = 1,\r\n Exceeded = 2\r\n}\r\n\r\n/// WindSpeed\r\nexport class WindSpeedDeviceState extends DeviceState<WindSpeedState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.WindSpeedState;\r\n this.Type = \"WindSpeedState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class WindSpeedState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Value: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n//flood sensor\r\nexport class FloodSensorDeviceState extends DeviceState<FloodSensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.FloodSensorState;\r\n this.Type = \"FloodSensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class FloodSensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: FloodSensorStates = FloodSensorStates.NoFloodDetected;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum FloodSensorStates {\r\n FloodDetected = 1,\r\n NoFloodDetected = 0\r\n}\r\n\r\nexport enum HumidityType {\r\n AirHumidity = 0,\r\n InsideHumidity = 1,\r\n OutsideHumidity = 2,\r\n SafetyHumidity = 3,\r\n SetHumidity = 4,\r\n}\r\n\r\n//Pressure\r\nexport class PressureSensorDeviceState extends DeviceState<PressureSensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.PressureSensorState;\r\n this.Type = \"PressureSensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class PressureSensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Pressure: number = 0;\r\n Time: string = \"\";\r\n PressureType: PressureType = PressureType.OutsidePressure\r\n}\r\n\r\nexport enum PressureType {\r\n InsidePressure = 0,\r\n OutsidePressure = 1,\r\n SetPressure = 2\r\n}\r\n\r\nexport enum FacadeType\r\n{\r\n Facade90 = 0,\r\n Facade180 = 1\r\n}\r\n\r\n// TamperProtection\r\nexport class TamperProtectionDeviceState extends DeviceState<TamperProtectionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.TamperProtectionState;\r\n this.Type = \"TamperProtection\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class TamperProtectionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: TamperProtectionStatus = TamperProtectionStatus.OK;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum TamperProtectionStatus {\r\n OK = 0,\r\n Breach = 1\r\n}","export class FieldChangeResult {\r\n private _type: FieldChangeResultType = FieldChangeResultType.Unknown;\r\n private _data: string = \"\";\r\n constructor(type: FieldChangeResultType, data: string) {\r\n this._type = type;\r\n this._data = data;\r\n }\r\n\r\n get Type(): FieldChangeResultType {\r\n return this._type;\r\n }\r\n\r\n set Type(value: FieldChangeResultType) {\r\n this._type = value;\r\n }\r\n\r\n get Data(): string {\r\n return this._data;\r\n }\r\n\r\n set Data(value: string) {\r\n this._data = value;\r\n }\r\n}\r\n\r\nexport class ResponseResult<T> {\r\n private _type: T | null = null;\r\n private _data: string = \"\";\r\n\r\n constructor(type: T, data: string) {\r\n this._type = type;\r\n this._data = data;\r\n }\r\n\r\n get Type(): T {\r\n return this._type as T;\r\n }\r\n\r\n set Type(value: T) {\r\n this._type = value;\r\n }\r\n\r\n get Data(): string {\r\n return this._data;\r\n }\r\n\r\n set Data(value: string) {\r\n this._data = value;\r\n }\r\n}\r\n\r\nexport enum FieldChangeResultType {\r\n UnknownError = -5,\r\n NoPermissions = -4,\r\n WrongData = -3,\r\n ControllerResponseTimeout = -2,\r\n Failed = -1,\r\n Unknown = 0,\r\n Changed = 1,\r\n}","import { IUsersService } from './IUsersService';\r\nimport { IUser } from './IUser';\r\nimport { Api } from '../../Api';\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { DataFrame, Method, Status } from '../../DataFrame';\r\nimport { UserData } from '../Session/SessionService';\r\nimport { User } from './User';\r\nimport { DependencyContainer } from '../../DependencyContainer';\r\n\r\nexport class UsersService implements IUsersService {\r\n private _connection: IExalusConnectionService | null = null;\r\n public static readonly ServiceName: string = \"UsersService\";\r\n\r\n constructor() {\r\n this._connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n }\r\n\r\n GetServiceName(): string {\r\n return UsersService.ServiceName;\r\n }\r\n\r\n async GetUsersAsync(): Promise<IUser[]> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<UserData[]>(new GetUsersListRequest(), 20000, false);\r\n\r\n if (result === null || result === undefined)\r\n return Promise.resolve([]);\r\n\r\n if (result?.Status == Status.OK) {\r\n if (result.Data != null) {\r\n const users: User[] = [];\r\n\r\n result.Data.forEach(element => {\r\n var user = new User();\r\n user.AccessLevel = element.AccessLevel;\r\n user.Email = element.Email;\r\n user.Gender = element.Gender;\r\n user.Guid = element.Guid;\r\n user.IsAccountOnline = element.IsAccountOnline;\r\n user.Name = element.Name;\r\n user.IsActive = element.IsActive;\r\n user.IsBanned = element.IsBanned;\r\n user.Phone = element.Phone;\r\n user.Surname = element.Surname;\r\n users.push(user);\r\n });\r\n\r\n return users;\r\n }\r\n else\r\n return Promise.resolve([]);\r\n }\r\n else if (result?.Status == Status.NoData)\r\n return Promise.resolve([]);\r\n else {\r\n DependencyContainer.Log?.Debug(UsersService.ServiceName, `Failed to retrieve users, error: ${result.Status}`);\r\n throw new Error(`Failed to retrieve users, error: ${result.Status}`);\r\n }\r\n }\r\n\r\n GetUserAsync(id: string): Promise<IUser | null> {\r\n return new Promise((resolve, reject) => {\r\n resolve(null);\r\n });\r\n }\r\n\r\n CreateUserAsync(user: IUser): Promise<IUser> {\r\n return new Promise((resolve, reject) => {\r\n resolve(user);\r\n });\r\n }\r\n\r\n UpdateUserAsync(user: IUser): Promise<IUser> {\r\n return new Promise((resolve, reject) => {\r\n resolve(user);\r\n });\r\n }\r\n\r\n DeleteUserAsync(id: string): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n resolve();\r\n });\r\n }\r\n}\r\n\r\nclass GetUsersListRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/users/list\";\r\n this.Method = Method.Get;\r\n }\r\n}","import { IDIService } from \"../../IDIService\";\r\nimport { ITypedEvent } from \"../../TypedEvent\";\r\nimport { FieldChangeResult } from \"../FieldChangeResult\";\r\nimport { DeviceTasksInfo, IDevice } from './IDevice';\r\nimport { IDeviceState } from './IDeviceState';\r\nimport { IDeviceTask } from \"./IDeviceTask\";\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\n\r\nexport interface IDevicesService extends IDIService {\r\n OnDeviceRegisteredEvent(): ITypedEvent<IDevice>;\r\n OnDeviceRemovedEvent(): ITypedEvent<IDevice>;\r\n OnDeviceFoundEvent(): ITypedEvent<IDevice>;\r\n OnDeviceStateChangedEvent(): ITypedEvent<{ Device: IDevice, State: IDeviceState<any> }>;\r\n OnDevicesTasksExecutionChangeEvent(): ITypedEvent<DeviceTasksInfo[]>;\r\n\r\n GetDevicesAsync(): Promise<IDevice[]>;\r\n SyncDevicesStatesAsync(): Promise<boolean>;\r\n GetDevice(guid: string): IDevice | undefined;\r\n FindDevicesAsync(): Promise<void>;\r\n GetFoundDevicesAsync(): Promise<IDevice[]>;\r\n StopSearchingForDevices(): Promise<void>;\r\n RegisterDeviceAsync(device: IDevice): Promise<DeviceTaskExecutionResult>;\r\n RemoveDeviceAsync(device: IDevice): Promise<DeviceTaskExecutionResult>;\r\n ExecuteDeviceTaskAsync(device: IDevice, task: IDeviceTask): Promise<DeviceTaskExecutionResult>;\r\n WaitForSynchronizationAsync(): Promise<void>;\r\n WaitForDevicesStatesSynchronizationAsync(): Promise<void>;\r\n ExecuteDevicesTasksAsync(tasks: [Device: IDevice, Task: IDeviceTask][]): Promise<DeviceTaskPairExecutionResult[]>;\r\n}\r\n\r\nexport class DeviceTaskPairExecutionResult {\r\n Device: IDevice | null = null;\r\n Channel: number = 0;\r\n Task: IDeviceTask | null = null;\r\n Result: DeviceTaskExecutionResult = DeviceTaskExecutionResult.Unknown;\r\n}","import { Api } from '../../Api';\r\nimport { DataFrame, Method, Status } from '../../DataFrame';\r\nimport { ITypedEvent, TypedEvent } from '../../TypedEvent';\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { FieldChangeResult, FieldChangeResultType } from '../FieldChangeResult';\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { DevicesService } from './DevicesService';\r\nimport { CommunicationWay, DeviceState, DeviceType, IDevice, IDeviceResponseTypeInfo, IDeviceTaskTypeInfo } from './IDevice';\r\nimport { IDeviceChannel } from './IDeviceChannel';\r\nimport { IDevicesService } from './IDevicesService';\r\nimport { IDeviceState } from './IDeviceState';\r\nimport { IDeviceTask } from './IDeviceTask';\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\n\r\nexport class Device implements IDevice {\r\n private _onDeviceStateChangedEvent: ITypedEvent<IDeviceState<any>> = new TypedEvent<IDeviceState<any>>();\r\n private _onDeviceTasksExecutionChangedOnChannelsEvent: ITypedEvent<number[]> = new TypedEvent<number[]>();\r\n private _guid?: string;\r\n private _name?: string;\r\n private _channelsAmount?: number;\r\n private _serialNumber: string | null = null;\r\n private _model: string | null = null;\r\n private _modelGuid: string | null = null;\r\n private _manufacturerGuid: string | null = null;\r\n private _isVirtual: boolean = false;\r\n private _isEnabled: boolean = false;\r\n private _deviceState: DeviceState = DeviceState.Working;\r\n private _deviceType: DeviceType = DeviceType.Unknown;\r\n private _communicationWay: CommunicationWay = CommunicationWay.OneWay;\r\n private _availableTasksTypes: IDeviceTaskTypeInfo[] = [];\r\n private _availableResponseTypes: IDeviceResponseTypeInfo[] = [];\r\n private _channels: IDeviceChannel[] = [];\r\n\r\n constructor() {\r\n const devicesApi = Api.Get<IDevicesService>(DevicesService.ServiceName);\r\n const stateChangedEvent = this._onDeviceStateChangedEvent as TypedEvent<IDeviceState<any>>;\r\n const tasksExecutionChangeEvent = this._onDeviceTasksExecutionChangedOnChannelsEvent as TypedEvent<number[]>;\r\n\r\n devicesApi.OnDeviceStateChangedEvent().Subscribe(stateChange => {\r\n if (stateChange.Device.Guid != this._guid)\r\n return;\r\n\r\n stateChangedEvent.Invoke(stateChange.State);\r\n });\r\n\r\n devicesApi.OnDevicesTasksExecutionChangeEvent().Subscribe(tasks => {\r\n tasksExecutionChangeEvent.Invoke(tasks.filter(task => task.DeviceGuid == this._guid).map(task => task.Channel));\r\n });\r\n }\r\n\r\n RemoveDeviceAsync(): Promise<DeviceTaskExecutionResult> {\r\n return Api.Get<IDevicesService>(DevicesService.ServiceName).RemoveDeviceAsync(this);\r\n }\r\n\r\n ExecuteDeviceTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult> {\r\n return Api.Get<IDevicesService>(DevicesService.ServiceName).ExecuteDeviceTaskAsync(this, task);\r\n }\r\n\r\n OnDeviceTasksExecutionChangedOnChannelsEvent(): ITypedEvent<number[]> {\r\n return this._onDeviceTasksExecutionChangedOnChannelsEvent;\r\n }\r\n\r\n OnDeviceStateChangedEvent(): ITypedEvent<IDeviceState<any>> {\r\n return this._onDeviceStateChangedEvent;\r\n }\r\n\r\n public get Guid(): string {\r\n return this._guid == null ? \"\" : this._guid;\r\n }\r\n\r\n public set Guid(guid: string) {\r\n this._guid = guid;\r\n }\r\n\r\n public get Name(): string {\r\n return this._name == null ? \"\" : this._name;\r\n }\r\n\r\n public set Name(name: string) {\r\n this._name = name;\r\n }\r\n\r\n get ChannelsAmount(): number {\r\n return this._channelsAmount == null ? 0 : this._channelsAmount;\r\n }\r\n\r\n public set ChannelsAmount(amount: number) {\r\n this._channelsAmount = amount;\r\n }\r\n\r\n get SerialNumber(): string | null {\r\n return this._serialNumber;\r\n }\r\n\r\n public set SerialNumber(serialNumber: string | null) {\r\n this._serialNumber = serialNumber;\r\n }\r\n\r\n get Model(): string | null {\r\n return this._model;\r\n }\r\n\r\n public set Model(model: string | null) {\r\n this._model = model;\r\n }\r\n\r\n get ModelGuid(): string | null {\r\n return this._modelGuid;\r\n }\r\n\r\n public set ModelGuid(model: string | null) {\r\n this._modelGuid = model;\r\n }\r\n\r\n get ManufacturerGuid(): string | null {\r\n return this._manufacturerGuid;\r\n }\r\n\r\n set ManufacturerGuid(manufacturerGuid: string | null) {\r\n this._manufacturerGuid = manufacturerGuid;\r\n }\r\n\r\n get IsVirtual(): boolean {\r\n return this._isVirtual;\r\n }\r\n\r\n set IsVirtual(isVirtual: boolean) {\r\n this._isVirtual = isVirtual;\r\n }\r\n\r\n get IsEnabled(): boolean {\r\n return this._isEnabled;\r\n }\r\n\r\n set IsEnabled(isEnabled: boolean) {\r\n this._isEnabled = isEnabled;\r\n }\r\n\r\n get DeviceState(): DeviceState {\r\n return this._deviceState;\r\n }\r\n\r\n set DeviceState(deviceState: DeviceState) {\r\n this._deviceState = deviceState;\r\n }\r\n\r\n get DeviceType(): DeviceType {\r\n return this._deviceType;\r\n }\r\n\r\n set DeviceType(deviceType: DeviceType) {\r\n this._deviceType = deviceType;\r\n }\r\n\r\n get CommunicationWay(): CommunicationWay {\r\n return this._communicationWay;\r\n }\r\n\r\n set CommunicationWay(communicationWay: CommunicationWay) {\r\n this._communicationWay = communicationWay;\r\n }\r\n\r\n get AvailableTaskTypes(): IDeviceTaskTypeInfo[] {\r\n return this._availableTasksTypes;\r\n }\r\n\r\n set AvailableTaskTypes(availableTasksTypes: IDeviceTaskTypeInfo[]) {\r\n this._availableTasksTypes = availableTasksTypes;\r\n }\r\n\r\n get AvailableResponseTypes(): IDeviceResponseTypeInfo[] {\r\n return this._availableResponseTypes;\r\n }\r\n\r\n set AvailableResponseTypes(availableResponseTypes: IDeviceResponseTypeInfo[]) {\r\n this._availableResponseTypes = availableResponseTypes;\r\n }\r\n\r\n get Channels(): IDeviceChannel[] {\r\n return this._channels;\r\n }\r\n\r\n async ChangeDeviceNameAsync(name: string): Promise<FieldChangeResult> {\r\n try {\r\n const result = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName)\r\n .SendAndWaitForResponseAsync(new DeviceChannelConfigurationRequest(this, name), 20000, false);\r\n\r\n switch (result.Status) {\r\n case Status.OK:\r\n return new FieldChangeResult(FieldChangeResultType.Changed, \"\");\r\n\r\n case Status.WrongData:\r\n if (result.Data == \"DeviceNotFound\")\r\n return new FieldChangeResult(FieldChangeResultType.Failed, \"DeviceNotFound\");\r\n break;\r\n\r\n case Status.NoPermissionsToCallGivenResource:\r\n return new FieldChangeResult(FieldChangeResultType.NoPermissions, \"\");\r\n\r\n\r\n }\r\n }\r\n catch (ex: any) {\r\n if ((ex as Error).message.includes(\"timeout\"))\r\n return new FieldChangeResult(FieldChangeResultType.ControllerResponseTimeout, \"\");\r\n\r\n return new FieldChangeResult(FieldChangeResultType.UnknownError, \"\");\r\n }\r\n\r\n return new FieldChangeResult(FieldChangeResultType.Unknown, \"\");\r\n }\r\n\r\n ExecuteTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult> {\r\n return Api.Get<IDevicesService>(DevicesService.ServiceName).ExecuteDeviceTaskAsync(this, task);\r\n }\r\n}\r\n\r\n\r\nclass DeviceChannelConfigurationRequest extends DataFrame<DeviceNameData>\r\n{\r\n constructor(device: IDevice, name: string) {\r\n super();\r\n this.Resource = \"/devices/device/name\";\r\n this.Method = Method.Put;\r\n const data = new DeviceNameData();\r\n data.DeviceGuid = device.Guid;\r\n data.Name = name;\r\n this.Data = data;\r\n }\r\n}\r\n\r\nclass DeviceNameData {\r\n DeviceGuid: string = \"\";\r\n Name: string = \"\";\r\n}","import { DeviceTaskType } from \"./IDevice\";\r\n\r\nexport interface IDeviceTask {\r\n get TaskType(): DeviceTaskType;\r\n\r\n get Guid(): string;\r\n\r\n get DeviceGuid(): string;\r\n\r\n get Channel(): number;\r\n}\r\n\r\nexport enum DeviceControlFeature {\r\n TurnOn = 0,\r\n TurnOff = 1,\r\n ToggleState = 2,\r\n SetBlindPosition = 3,\r\n SetLightColor = 4,\r\n SetLightTemperature = 5,\r\n SetLightBrightness = 6,\r\n SetTemperature = 7,\r\n GetState = 8,\r\n TurnOnWithTimeout = 9,\r\n SetLightBrightnessDynamicly = 10,\r\n IdentifyDevice = 11,\r\n SetBlindOpenCloseTime = 12,\r\n SetBlindMicroventilation = 13,\r\n //SetGatePosition = 14,\r\n //OpenGate = 15,\r\n //CloseGate = 16,\r\n //SetGatePositionPercentage = 17,\r\n //GateOn = 18,\r\n //GateOff = 19,\r\n //OpenGateway = 20,\r\n //CloseGateway = 21,\r\n //SetGatewayPositionPercentage = 22,\r\n //GatewayOn = 23,\r\n //GatewayOff = 24,\r\n GatewayPulse = 25,\r\n GatePulse = 26,\r\n //SetFacadePosition = 27,\r\n //SetFacadeTilt = 28,\r\n SetFacadePositionAndTilt = 29,\r\n GetFacadeType = 30,\r\n}","import { DeviceTaskType } from \"../IDevice\";\r\nimport { DeviceControlFeature } from \"../IDeviceTask\";\r\nimport { DeviceTask } from \"./DeviceTask\";\r\n\r\nexport class SetTemperature extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetTemperature;\r\n this.TaskType = DeviceTaskType.SetTemperature;\r\n }\r\n\r\n Temperature: number = 0;\r\n}\r\n\r\nexport class TurnOff extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.TurnOff;\r\n this.TaskType = DeviceTaskType.TurnOff;\r\n }\r\n}\r\n\r\nexport class TurnOn extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.TurnOn;\r\n this.TaskType = DeviceTaskType.TurnOn;\r\n }\r\n}\r\n\r\nexport class SetLightBrightness extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetLightBrightness;\r\n this.TaskType = DeviceTaskType.SetLightBrightness;\r\n }\r\n\r\n Brightness: number = 0;\r\n}\r\n\r\nexport class ToggleState extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.ToggleState;\r\n this.TaskType = DeviceTaskType.TogleState;\r\n }\r\n}\r\n\r\nexport class SetLightColor extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetLightColor;\r\n this.TaskType = DeviceTaskType.SetLightColor;\r\n }\r\n\r\n R: number = 0;\r\n G: number = 0;\r\n B: number = 0;\r\n}\r\n\r\nexport class SetLightTemperature extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetLightTemperature;\r\n this.TaskType = DeviceTaskType.SetLightTemperature;\r\n }\r\n\r\n Temperature: number = 0;\r\n}\r\n\r\nexport class SetBlindPosition extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetBlindPosition;\r\n this.TaskType = DeviceTaskType.SetBlindPosition;\r\n }\r\n\r\n Action: BlindActionEnum = BlindActionEnum.Stop;\r\n Position: number = 0;\r\n}\r\n\r\nexport enum BlindActionEnum {\r\n Open = 0,\r\n Close = 1,\r\n Stop = 2,\r\n Percentage = 3\r\n}\r\nexport class SetBlindPositionSimple extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetBlindPosition;\r\n this.TaskType = DeviceTaskType.SetBlindPositionSimple;\r\n }\r\n\r\n Action: BlindActionSimpleEnum = BlindActionSimpleEnum.Stop;\r\n Position: number = 0;\r\n}\r\n\r\nexport enum BlindActionSimpleEnum {\r\n Open = 0,\r\n Close = 1,\r\n Stop = 2,\r\n}\r\n\r\nexport class SetLightBrightnessDynamicly extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetLightBrightnessDynamicly;\r\n this.TaskType = DeviceTaskType.SetLightBrightnessDynamicly;\r\n }\r\n\r\n Brightness: number = 0;\r\n}\r\n\r\nexport class IdentifyDevice extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.IdentifyDevice;\r\n this.TaskType = DeviceTaskType.IdentifyDevice;\r\n }\r\n}\r\n\r\nexport class SetBlindOpenCloseTime extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetBlindOpenCloseTime;\r\n this.TaskType = DeviceTaskType.SetBlindOpenCloseTime;\r\n }\r\n\r\n Data: BlindOpenCloseTimeData = new BlindOpenCloseTimeData();\r\n}\r\n\r\nexport class BlindOpenCloseTimeData {\r\n Channel: number = 0;\r\n CloseTime: number = 0;\r\n OpenTime: number = 0;\r\n}\r\n\r\nexport class GetDeviceState extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.GetState;\r\n this.TaskType = DeviceTaskType.GetChannelsState;\r\n }\r\n}\r\n\r\nexport class SetBlindMicroventilation extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetBlindMicroventilation;\r\n this.TaskType = DeviceTaskType.SetBlindMicroventilation;\r\n }\r\n\r\n Position: number = 0;\r\n}\r\n\r\nexport class ChangeGatePositionPulse extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.GatePulse;\r\n this.TaskType = DeviceTaskType.ChangeGatewayPositionPulse;\r\n }\r\n}\r\n\r\nexport class ChangeGatewayPositionPulse extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.GatewayPulse;\r\n this.TaskType = DeviceTaskType.ChangeGatewayPositionPulse;\r\n }\r\n}\r\n\r\nexport class SetFacadePosition extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetFacadePositionAndTilt;\r\n this.TaskType = DeviceTaskType.SetFacadePosition;\r\n }\r\n\r\n FacadeAction: FacadeActionEnum = FacadeActionEnum.Stop;\r\n Tilt: number = 0;\r\n Position: number = 0;\r\n}\r\n\r\nexport class GetFacadeType extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.GetFacadeType;\r\n this.TaskType = DeviceTaskType.GetFacadeType;\r\n }\r\n}\r\n\r\nexport enum FacadeActionEnum {\r\n Open = 0,\r\n Close = 1,\r\n Stop = 2,\r\n Percentage = 3,\r\n Tilt = 4,\r\n TiltAndPercentage = 5\r\n}","import { Api } from \"../../Api\";\r\nimport { ITypedEvent, TypedEvent } from \"../../TypedEvent\";\r\nimport { FieldChangeResultType, FieldChangeResult } from \"../FieldChangeResult\";\r\nimport { DevicesService } from \"./DevicesService\";\r\nimport { IDeviceTaskTypeInfo, IDeviceResponseTypeInfo, IDevice } from './IDevice';\r\nimport { ChannelConfigurations, IDeviceChannel, TaskExecution } from \"./IDeviceChannel\";\r\nimport { IDevicesService } from \"./IDevicesService\";\r\nimport { IDeviceState, IDeviceStateData } from \"./IDeviceState\";\r\nimport { IDeviceTask } from \"./IDeviceTask\";\r\nimport { DeviceTaskExecutionResult } from \"./TaskExecutionResult\";\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { ExalusConnectionService } from \"../ExalusConnectionService\";\r\nimport { DataFrame, Method, Status } from \"../../DataFrame\";\r\nimport { DependencyContainer } from '../../DependencyContainer';\r\nimport { DeviceTask } from \"./Tasks/DeviceTask\";\r\nimport { Device } from \"./Device\";\r\n\r\nexport class DeviceChannel implements IDeviceChannel {\r\n private _device: IDevice = new Device();\r\n private _number: number = 0;\r\n private _name: string = \"\";\r\n private _iconName: string = \"\";\r\n private _states: IDeviceState<any>[] = [];\r\n private _mode: ChannelConfigurations = ChannelConfigurations.Default;\r\n private _channelGroups: string[] = [];\r\n private _isHidden: boolean = false;\r\n private _availableTasksTypes: IDeviceTaskTypeInfo[] = [];\r\n private _availableResponseTypes: IDeviceResponseTypeInfo[] = [];\r\n private _onTasksExecutionChangedEvent: ITypedEvent<TaskExecution> = new TypedEvent<TaskExecution>();\r\n\r\n SetDevice(device: IDevice): void {\r\n this._device = device;\r\n this._device.OnDeviceStateChangedEvent().Subscribe(newState => {\r\n const channel = (newState.Data as IDeviceStateData).Channel;\r\n\r\n if (channel != this._number)\r\n return;\r\n\r\n this._states = this._states.where(state => state.TypeAsEnum != newState.TypeAsEnum).toArray();\r\n this._states.push(newState);\r\n });\r\n }\r\n\r\n GetDevice(): IDevice {\r\n return this._device;\r\n }\r\n\r\n GetChannelConfigurationData(): ChannelConfigurationData {\r\n const data = new ChannelConfigurationData();\r\n data.Channel = this._number;\r\n data.ChannelName = this._name;\r\n data.Configuration = this._mode;\r\n data.GroupsGuids = this._channelGroups;\r\n data.Hidden = this._isHidden;\r\n data.IconName = this._iconName;\r\n return data;\r\n }\r\n\r\n HideAsync(): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.Hidden = true;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n ShowAsync(): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.Hidden = false;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n ChangeNameAsync(name: string): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.ChannelName = name;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n ChangeIconNameAsync(name: string): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.IconName = name;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n ChangeGroupsAsync(groups: string[]): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.GroupsGuids = groups;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n async ChangeConfigurationAsync(configuration: ChannelConfigurationData): Promise<FieldChangeResult> {\r\n try {\r\n const result = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName)\r\n .SendAndWaitForResponseAsync(new DeviceChannelConfigurationRequest(configuration), 20000, false);\r\n\r\n switch (result.Status) {\r\n case Status.OK:\r\n return new FieldChangeResult(FieldChangeResultType.Changed, \"\");\r\n\r\n case Status.WrongData:\r\n switch (result.Data) {\r\n case \"DeviceNotFound\":\r\n DependencyContainer.Log?.Error(`Failed to change channel configuration, referenced device does not exist!`);\r\n return new FieldChangeResult(FieldChangeResultType.WrongData, \"DeviceNotFound\");\r\n }\r\n break;\r\n\r\n case Status.FatalError:\r\n return new FieldChangeResult(FieldChangeResultType.UnknownError, \"\");\r\n }\r\n }\r\n catch (ex: any) {\r\n if ((ex as Error).message.includes(\"timeout\"))\r\n return new FieldChangeResult(FieldChangeResultType.ControllerResponseTimeout, \"\");\r\n }\r\n\r\n return new FieldChangeResult(FieldChangeResultType.Unknown, \"\");\r\n }\r\n\r\n get Number(): number {\r\n return this._number;\r\n }\r\n\r\n set Number(value: number) {\r\n this._number = value;\r\n }\r\n\r\n get Name(): string {\r\n return this._name;\r\n }\r\n set Name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n get IconName(): string {\r\n return this._iconName;\r\n }\r\n\r\n set IconName(value: string) {\r\n this._iconName = value;\r\n }\r\n\r\n get States(): IDeviceState<IDeviceStateData>[] {\r\n return this._states;\r\n }\r\n\r\n set States(value: IDeviceState<IDeviceStateData>[]) {\r\n this._states = value;\r\n }\r\n\r\n set State(value: IDeviceState<IDeviceStateData>) {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n\r\n get Mode(): ChannelConfigurations {\r\n return this._mode;\r\n }\r\n\r\n set Mode(value: ChannelConfigurations) {\r\n this._mode = value;\r\n }\r\n\r\n get ChannelGroups(): string[] {\r\n return this._channelGroups;\r\n }\r\n\r\n set ChannelGroups(value: string[]) {\r\n this._channelGroups = value;\r\n }\r\n\r\n get IsHidden(): boolean {\r\n return this._isHidden;\r\n }\r\n\r\n set IsHidden(value: boolean) {\r\n this._isHidden = value;\r\n }\r\n\r\n get AvailableTaskTypes(): IDeviceTaskTypeInfo[] {\r\n return this._availableTasksTypes;\r\n }\r\n\r\n set AvailableTaskTypes(value: IDeviceTaskTypeInfo[]) {\r\n this._availableTasksTypes = value;\r\n }\r\n\r\n get AvailableResponseTypes(): IDeviceResponseTypeInfo[] {\r\n return this._availableResponseTypes;\r\n }\r\n\r\n set AvailableResponseTypes(value: IDeviceResponseTypeInfo[]) {\r\n this._availableResponseTypes = value;\r\n }\r\n\r\n OnTasksExecutionChangeEvent(): ITypedEvent<TaskExecution> {\r\n return this._onTasksExecutionChangedEvent;\r\n }\r\n\r\n ExecuteTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult> {\r\n if (this._device != null) {\r\n (task as DeviceTask).Channel = this.Number;\r\n (task as DeviceTask).DeviceGuid = this._device.Guid;\r\n return Api.Get<IDevicesService>(DevicesService.ServiceName).ExecuteDeviceTaskAsync(this._device, task);\r\n }\r\n else\r\n return Promise.resolve(DeviceTaskExecutionResult.Failed);\r\n }\r\n}\r\n\r\nexport class ChannelConfigurationData {\r\n Channel: number = 0;\r\n ChannelName: string = \"\";\r\n Configuration: ChannelConfigurations = ChannelConfigurations.Default;\r\n GroupsGuids: string[] = [];\r\n IconName: string = \"\";\r\n Hidden: boolean = false;\r\n}\r\n\r\nclass DeviceChannelConfigurationRequest extends DataFrame<ChannelConfigurationData>\r\n{\r\n constructor(configuration: ChannelConfigurationData) {\r\n super();\r\n this.Resource = \"/devices/device/channel/configuration\";\r\n this.Method = Method.Put;\r\n this.Data = configuration;\r\n }\r\n}","import { Status } from \"../../DataFrame\";\r\nimport { IDIService } from \"../../IDIService\";\r\nimport { ResponseResult } from \"../FieldChangeResult\";\r\n\r\nexport interface IGeolocationService extends IDIService {\r\n\tGetCurrentGeolocationAsync(): Promise<GeolocationPosition | GeolocationPositionError>;\r\n\tSetControllerGeolocationAsync(location: Coordinates | Status): Promise<ResponseResult<SetGeolocationResponseCode>>;\r\n\tGetControlllerGeolocationAsync(): Promise<CoordinatesWithSourceInfo | Status>;\r\n\tIsControllerGeolocationSetAsync(): Promise<boolean | Status>;\r\n}\r\n\r\nexport class Coordinates {\r\n\tLongitude: number = 0;\r\n\tLatitude: number = 0;\r\n}\r\n\r\nexport class CoordinatesWithSourceInfo {\r\n\tLongitude: number = 0;\r\n\tLatitude: number = 0;\r\n\tIsNetworkBased: boolean = false;\r\n}\r\n\r\nexport enum SetGeolocationResponseCode {\r\n\tOK = 0,\r\n\tNoPermissions = 1,\r\n\tUserIsNotLoggedIn = 2,\r\n\tUnknownError = 3,\r\n}","import { IDIService } from '../../IDIService';\r\nimport { ITypedEvent, TypedEvent } from '../../TypedEvent';\r\nimport { DeviceState, IDevice, CommunicationWay, DeviceType, DeviceTaskTypeInfo, DeviceResponseTypeInfo, DeviceTasksInfo, DeviceResponseType } from './IDevice';\r\nimport { DeviceTaskPairExecutionResult, IDevicesService } from './IDevicesService';\r\nimport { BatteryDeviceState, BinarySensorStateDeviceState, BlindCalibrationDeviceState, BlindOpenCloseTimeDeviceState, BlindPositionDeviceState, BlindRemoteButtonDeviceState, ChannelOnOffDeviceState, ConfigurationDeviceState, CurrentLightThresholdDeviceState, CurrentWindThresholdDeviceState, DoorBellDeviceState, FacadePositionDeviceState, FacadeRemoteButtonDeviceState, FacadeTypeDeviceState, FloodSensorDeviceState, GatePositionDeviceState, GatewayPositionDeviceState, HumiditySensorDeviceState, IDeviceState, LightBrightnessDeviceState, LightColorDeviceState, LightWarmthDeviceState, MeasuredBrightnessDeviceState, MeasuredDistanceDeviceState, MeasuredEnergyDeviceState, MeasuredTemperatureDeviceState, MovementSensorDeviceState, OvercurrentProtectionDeviceState, OvercurrentProtectionThresholdDeviceState, PressureSensorDeviceState, ReedStateDeviceState, RemoteButtonDeviceState, SignalStrenghtDeviceState, StateReliability, TamperProtectionDeviceState, VibrationSensorDeviceState, WindSpeedDeviceState } from './IDeviceState';\r\nimport { DeviceChannel } from './DeviceChannel';\r\nimport { ChannelConfigurations, TaskExecution } from './IDeviceChannel';\r\nimport { Api } from '../../Api';\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { DependencyContainer } from '../../DependencyContainer';\r\nimport { DataFrame, Status, Method } from '../../DataFrame';\r\nimport { Device } from './Device';\r\nimport { ConnectionState, IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { DeviceControlFeature, IDeviceTask } from './IDeviceTask';\r\nimport { BlindActionEnum, SetBlindPosition, SetTemperature, SetLightBrightnessDynamicly, SetLightBrightness, SetLightColor, SetLightTemperature, SetBlindOpenCloseTime, SetBlindMicroventilation, SetFacadePosition, FacadeActionEnum, GetFacadeType } from './Tasks/Tasks';\r\nimport { DeviceTask } from './Tasks/DeviceTask';\r\nimport { ISessionService } from '../Session/ISessionService';\r\nimport { SessionService } from '../Session/SessionService';\r\nimport { IControllerConfigurationService } from '../Controller/IControllerConfigurationService';\r\nimport { ControllerConfigurationService } from '../Controller/ControllerConfigurationService';\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\nimport { threadId } from 'worker_threads';\r\n\r\nexport class DevicesService implements IDIService, IDevicesService {\r\n private _devices: IDevice[] = [];\r\n public static readonly ServiceName: string = \"DevicesService\";\r\n private _onDevicesTasksChangedEvent: ITypedEvent<DeviceTasksInfo[]> = new TypedEvent<DeviceTasksInfo[]>();\r\n private _onDeviceFoundEvent: ITypedEvent<IDevice> = new TypedEvent<IDevice>();\r\n private _onDeviceRegisteredEvent: ITypedEvent<IDevice> = new TypedEvent<IDevice>();\r\n private _onDeviceRemovedEvent: ITypedEvent<IDevice> = new TypedEvent<IDevice>();\r\n private _onDeviceStateChangedEvent: ITypedEvent<{ Device: IDevice, State: IDeviceState<any> }> = new TypedEvent<{ Device: IDevice, State: IDeviceState<any> }>();\r\n private _connection: IExalusConnectionService | null = null;\r\n private _session: ISessionService | null = null;\r\n private _controllerConfiguration: IControllerConfigurationService | null = null;\r\n private _fastStatesSync: boolean = false;\r\n private _synchronized: boolean = false;\r\n private _synchronizedDevicesStates: boolean = false;\r\n private _synchronizationTaskCompletionSource: Promise<void> | null = null;\r\n private _deviceStatesSynchronizationTaskCompletionSource: Promise<void> | null = null;\r\n\r\n constructor() {\r\n this._connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n this._session = Api.Get<ISessionService>(SessionService.ServiceName);\r\n this._controllerConfiguration = Api.Get<IControllerConfigurationService>(ControllerConfigurationService.ServiceName);\r\n this._synchronizationTaskCompletionSource = new Promise<void>((resolve) => {\r\n this._session?.OnUserLoggedInEvent().Subscribe(async user => {\r\n try {\r\n this._devices = await this.GetPairedDevicesAsync();\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get paired devices: ${ex}`);\r\n }\r\n this._synchronized = true;\r\n resolve();\r\n });\r\n });\r\n this._deviceStatesSynchronizationTaskCompletionSource = new Promise<void>((resolve) => {\r\n this._session?.OnUserLoggedInEvent().Subscribe(async user => {\r\n try {\r\n await this.WaitForSynchronizationAsync();\r\n await this.SyncDevicesStatesAsync();\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to sync devices states: ${ex}`);\r\n }\r\n this._synchronizedDevicesStates = true;\r\n resolve();\r\n });\r\n });\r\n\r\n this._connection.OnDataReceivedEvent().Subscribe(frame => {\r\n if (frame.Resource === \"/info/devices/tasks\") {\r\n this.ParseDeviceTaskInfo(frame.Data as string[]);\r\n }\r\n else if (frame.Resource === \"/devices/blinds/times\") {\r\n\r\n }\r\n else if (frame.Resource === \"/info/devices/device/found\") {\r\n const foundDevices = this.MapApiDevices(frame.Data);\r\n foundDevices.forEach(device => {\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Found device: ${device.Name} guid: ${device.Guid}`);\r\n (this._onDeviceFoundEvent as TypedEvent<IDevice>).Invoke(device);\r\n });\r\n }\r\n else if (frame.Resource === \"/info/devices/device/state/changed\") {\r\n const state = frame.Data as DeviceStateChangedObject;\r\n const devices = this._devices.filter(a => a.Guid == state.DeviceGuid);\r\n\r\n if (devices.length > 0) {\r\n const device = devices[0];\r\n\r\n const st = this.MapApiDeviceStateToDeviceState(device, state);\r\n\r\n if (st != null) {\r\n (this._onDeviceStateChangedEvent as TypedEvent<{ Device: IDevice, State: IDeviceState<any> }>)\r\n .Invoke({ Device: device, State: st });\r\n\r\n if (st.TypeAsEnum == DeviceResponseType.SignalStrength) {\r\n device.Channels.forEach(channel => {\r\n /// object copy { ...state }\r\n let newState = new SignalStrenghtDeviceState({ ...state });\r\n st.Data.Channel = channel.Number;\r\n \r\n (this._onDeviceStateChangedEvent as TypedEvent<{ Device: IDevice, State: IDeviceState<any> }>)\r\n .Invoke({ Device: device, State: newState });\r\n });\r\n }\r\n\r\n else if (st.TypeAsEnum == DeviceResponseType.BatteryState) {\r\n device.Channels.forEach(channel => {\r\n let newState = new BatteryDeviceState({ ...state });\r\n st.Data.Channel = channel.Number;\r\n \r\n (this._onDeviceStateChangedEvent as TypedEvent<{ Device: IDevice, State: IDeviceState<any> }>)\r\n .Invoke({ Device: device, State: newState });\r\n });\r\n }\r\n }\r\n }\r\n }\r\n else if (frame.Resource === \"/info/devices/device/registered\") {\r\n const registeredDevices = this.MapApiDevices(frame.Data);\r\n registeredDevices.forEach(device => {\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Registered device: ${device.Name} guid: ${device.Guid}`);\r\n (this._onDeviceRegisteredEvent as TypedEvent<IDevice>).Invoke(device);\r\n });\r\n }\r\n else if (frame.Resource === \"/info/devices/device/removed\") {\r\n const removedDevices = this.MapApiDevices(frame.Data);\r\n removedDevices.forEach(device => {\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Removed device: ${device.Name} guid: ${device.Guid}`);\r\n (this._onDeviceRemovedEvent as TypedEvent<IDevice>).Invoke(device);\r\n });\r\n }\r\n });\r\n }\r\n\r\n WaitForSynchronizationAsync(): Promise<void> {\r\n return this._synchronizationTaskCompletionSource as Promise<void>;\r\n }\r\n\r\n WaitForDevicesStatesSynchronizationAsync(): Promise<void> {\r\n return this._deviceStatesSynchronizationTaskCompletionSource as Promise<void>;\r\n }\r\n\r\n async GetCurrentlyRunningTaksAsync() {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<string[]>(new GetRunningDevicesTasksRequest(), 15000, false);\r\n\r\n if (result?.Status == Status.OK && result.Data != null) {\r\n this.ParseDeviceTaskInfo(result.Data);\r\n }\r\n }\r\n\r\n ParseDeviceTaskInfo(tasks: string[]) {\r\n const devicesTasks: DeviceTasksInfo[] = [];\r\n\r\n tasks.forEach(taskChannelPair => {\r\n const pair = taskChannelPair.split(\";\");\r\n const task = new DeviceTasksInfo();\r\n task.DeviceGuid = pair[0];\r\n task.Channel = Number(pair[1]);\r\n task.Status = TaskExecution.ExecutingTasks;\r\n devicesTasks.push(task);\r\n });\r\n\r\n (this._onDevicesTasksChangedEvent as TypedEvent<DeviceTasksInfo[]>).Invoke(devicesTasks);\r\n }\r\n\r\n MapApiDeviceStateToDeviceState(device: IDevice, state: DeviceStateChangedObject): IDeviceState<any> | null {\r\n const st = state.state as any as DeviceState;\r\n\r\n switch (state.DataType) {\r\n case \"ChannelOnOff\":\r\n return new ChannelOnOffDeviceState(state);\r\n\r\n case \"DoorBell\":\r\n return new DoorBellDeviceState(state);\r\n\r\n case \"ReedPosition\":\r\n return new ReedStateDeviceState(state);\r\n\r\n case \"BlindPosition\":\r\n return new BlindPositionDeviceState(state);\r\n\r\n case \"ButtonState\":\r\n return new RemoteButtonDeviceState(state);\r\n\r\n case \"LightColor\":\r\n return new LightColorDeviceState(state);\r\n\r\n case \"LightTemperature\":\r\n return new LightWarmthDeviceState(state);\r\n\r\n case \"LightBrightness\":\r\n return new LightBrightnessDeviceState(state);\r\n\r\n case \"TemperatureSensor\":\r\n case \"TemperatureState\":\r\n case \"MeasuredTemperature\":\r\n return new MeasuredTemperatureDeviceState(state);\r\n\r\n case \"BatteryState\":\r\n return new BatteryDeviceState(state);\r\n\r\n case \"MeasuredBrightness\":\r\n case \"DeviceBrightnessState\":\r\n return new MeasuredBrightnessDeviceState(state);\r\n\r\n case \"EnergyMeasuredPower\":\r\n break;\r\n\r\n case \"EnergyMeasuredCurrent\":\r\n break;\r\n\r\n case \"EnergyMeasuredVoltage\":\r\n break;\r\n\r\n case \"Energy\":\r\n return new MeasuredEnergyDeviceState(state);\r\n\r\n case \"DistanceSensor\":\r\n return new MeasuredDistanceDeviceState(state);\r\n\r\n case \"MovementSensor\":\r\n return new MovementSensorDeviceState(state);\r\n\r\n case \"BlindsControlButton\":\r\n return new BlindRemoteButtonDeviceState(state);\r\n\r\n case \"FacadeControlButton\":\r\n return new FacadeRemoteButtonDeviceState(state);\r\n\r\n case \"SignalStrength\":\r\n return new SignalStrenghtDeviceState(state);\r\n\r\n case \"GatePosition\":\r\n return new GatePositionDeviceState(state);\r\n\r\n case \"GatewayPosition\":\r\n return new GatewayPositionDeviceState(state);\r\n\r\n case \"IBlindCalibrationStatus\":\r\n case \"BlindCalibration\":\r\n return new BlindCalibrationDeviceState(state);\r\n\r\n case \"HumiditySensor\":\r\n case \"HumidityState\":\r\n return new HumiditySensorDeviceState(state);\r\n\r\n case \"VibrationSensor\":\r\n return new VibrationSensorDeviceState(state);\r\n\r\n case \"DigitalInputSensor\":\r\n return new BinarySensorStateDeviceState(state);\r\n\r\n case \"ConfigurationState\":\r\n return new ConfigurationDeviceState(state);\r\n\r\n case \"BlindOpenCloseTime\":\r\n case \"IBlindOpenCloseTime\":\r\n return new BlindOpenCloseTimeDeviceState(state);\r\n\r\n case \"IOvercurrentProtection\":\r\n case \"OvercurrentProtection\":\r\n return new OvercurrentProtectionDeviceState(state);\r\n\r\n case \"IOvercurrentProtectionThreshold\":\r\n case \"OvercurrentProtectionThreshold\":\r\n return new OvercurrentProtectionThresholdDeviceState(state);\r\n\r\n case \"FacadePosition\":\r\n case \"FacadeState\":\r\n return new FacadePositionDeviceState(state);\r\n\r\n case \"FacadeTypeState\":\r\n return new FacadeTypeDeviceState(state);\r\n\r\n case \"CurrentWindThreshold\":\r\n return new CurrentWindThresholdDeviceState(state);\r\n\r\n case \"CurrentLightThreshold\":\r\n return new CurrentLightThresholdDeviceState(state);\r\n\r\n case \"WindSpeed\":\r\n return new WindSpeedDeviceState(state);\r\n\r\n case \"FloodSensor\":\r\n return new FloodSensorDeviceState(state);\r\n\r\n case \"PressureState\":\r\n return new PressureSensorDeviceState(state);\r\n\r\n case \"ITamperProtection\": \r\n case \"TamperProtection\":\r\n return new TamperProtectionDeviceState(state);\r\n\r\n default:\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Not supported device state ${state.DataType}`);\r\n break;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n GetServiceName(): string {\r\n return DevicesService.ServiceName;\r\n }\r\n\r\n async SyncDevicesStatesAsync(): Promise<boolean> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(new GetDevicesStatesRequest(), 15000, false);\r\n\r\n if (this._fastStatesSync) {\r\n return result?.Status == Status.OK;\r\n }\r\n else {\r\n let syncStatesRequest = new SyncDevicesStatesRequest();\r\n syncStatesRequest.Data = true;\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(syncStatesRequest, 35000, false);\r\n return result?.Status == Status.OK;\r\n }\r\n }\r\n\r\n OnDevicesTasksExecutionChangeEvent(): ITypedEvent<DeviceTasksInfo[]> {\r\n return this._onDevicesTasksChangedEvent;\r\n }\r\n\r\n OnDeviceStateChangedEvent(): ITypedEvent<{ Device: IDevice, State: IDeviceState<any> }> {\r\n return this._onDeviceStateChangedEvent;\r\n }\r\n\r\n OnDeviceRegisteredEvent(): ITypedEvent<IDevice> {\r\n return this._onDeviceRegisteredEvent;\r\n }\r\n\r\n OnDeviceRemovedEvent(): ITypedEvent<IDevice> {\r\n return this._onDeviceRemovedEvent;\r\n }\r\n\r\n OnDeviceFoundEvent(): ITypedEvent<IDevice> {\r\n return this._onDeviceFoundEvent;\r\n }\r\n\r\n private MapApiDevices(devicesObjects: DeviceObject[]): IDevice[] {\r\n const devices: IDevice[] = [];\r\n\r\n if (devicesObjects == null)\r\n return [];\r\n\r\n devicesObjects.forEach(element => {\r\n var device = new Device();\r\n device.Guid = element.Guid;\r\n device.Name = element.DeviceName;\r\n device.ChannelsAmount = element.ChannelsNumber;\r\n device.DeviceType = element.DeviceType;\r\n device.CommunicationWay = element.CommunicationWay;\r\n device.DeviceState = element.DeviceState;\r\n device.IsEnabled = element.IsEnabled;\r\n device.IsVirtual = element.IsVirtual;\r\n device.SerialNumber = element.DeviceSerialNumber;\r\n device.ManufacturerGuid = element.ManufacturerGuid;\r\n device.ModelGuid = element.DeviceModelGuid;\r\n device.Model = element.DeviceModel;\r\n device.Name = element.DeviceName;\r\n\r\n try {\r\n element.AvailableTasks?.forEach(task => {\r\n var typeInfo = new DeviceTaskTypeInfo();\r\n\r\n if (device.CommunicationWay == CommunicationWay.OneWay) {\r\n switch (task) {\r\n case \"IBlindPosition\":\r\n typeInfo.InterfaceType = \"IBlindPositionSimple\";\r\n break;\r\n }\r\n }\r\n else\r\n switch (task) {\r\n case \"IGatePosition\":\r\n typeInfo.InterfaceType = \"IGatePulse\";\r\n break;\r\n\r\n case \"IGatewayPosition\":\r\n typeInfo.InterfaceType = \"IGatewayPulse\";\r\n break;\r\n\r\n default:\r\n typeInfo.InterfaceType = task;\r\n break;\r\n }\r\n\r\n device.AvailableTaskTypes.push(typeInfo);\r\n });\r\n\r\n element.AvailableResponses?.forEach(response => {\r\n var typeInfo = new DeviceResponseTypeInfo();\r\n typeInfo.InterfaceType = response;\r\n device.AvailableResponseTypes.push(typeInfo);\r\n });\r\n\r\n element.ChannelsConfiguration?.forEach(configuration => {\r\n try {\r\n var ch = new DeviceChannel();\r\n ch.SetDevice(device);\r\n device.Channels.push(ch);\r\n ch.Number = configuration.Channel;\r\n ch.Name = configuration.ChannelName;\r\n ch.ChannelGroups = configuration.GroupsGuids;\r\n ch.IconName = configuration.IconName;\r\n ch.IsHidden = configuration.Hidden;\r\n\r\n configuration.AvailableResponses?.forEach(response => {\r\n var typeInfo = new DeviceResponseTypeInfo();\r\n typeInfo.InterfaceType = response;\r\n ch.AvailableResponseTypes.push(typeInfo);\r\n });\r\n\r\n configuration.AvailableTasks?.forEach(task => {\r\n var typeInfo = new DeviceTaskTypeInfo();\r\n typeInfo.InterfaceType = task;\r\n ch.AvailableTaskTypes.push(typeInfo);\r\n });\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(ex);\r\n }\r\n });\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(ex);\r\n }\r\n devices.push(device);\r\n });\r\n\r\n this._devices = devices;\r\n return devices;\r\n }\r\n\r\n private async GetPairedDevicesAsync(): Promise<IDevice[]> {\r\n if (this._synchronized && !await this._controllerConfiguration?.DidCofigurationChangeAsync())\r\n return Promise.resolve(this._devices);\r\n\r\n const result = await this._connection?.SendAndWaitForResponseAsync<DeviceObject[]>(new GetDevicesListRequest(), 15000, true);\r\n\r\n if (result == null || result === undefined)\r\n return [];\r\n\r\n if (result.Status == Status.OK && result.Data != null)\r\n return this.MapApiDevices(result.Data);\r\n else {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get devices. ${result.Status} ${result.Data}`);\r\n return [];\r\n }\r\n }\r\n\r\n async GetDevicesAsync(): Promise<IDevice[]> {\r\n await this.WaitForSynchronizationAsync();\r\n\r\n return this.GetPairedDevicesAsync();\r\n }\r\n\r\n async GetFoundDevicesAsync(): Promise<IDevice[]> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<DeviceObject[]>(new GetFoundDevicesRequest(), 15000, false);\r\n\r\n if (result == null)\r\n return [];\r\n\r\n if (result.Status == Status.OK && result.Data != null)\r\n return this.MapApiDevices(result.Data);\r\n else {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get found devices. ${result.Status} ${result.Data}`);\r\n return [];\r\n }\r\n }\r\n\r\n GetDevice(guid: string): IDevice | undefined {\r\n return this._devices.find(a => a.Guid === guid);\r\n }\r\n\r\n async FindDevicesAsync(): Promise<void> {\r\n await this._connection?.SendAndWaitForResponseAsync<any>(new SearchForDevicesRequest(), 35000, false);\r\n }\r\n\r\n async StopSearchingForDevices(): Promise<void> {\r\n await this._connection?.SendAndWaitForResponseAsync<any>(new StopSearchingForDevicesRequest(), 20000, false);\r\n }\r\n\r\n async RegisterDeviceAsync(device: IDevice): Promise<DeviceTaskExecutionResult> {\r\n const req = new DevicePairRequest();\r\n req.Data = device.Guid;\r\n const res = await this._connection?.SendAndWaitForResponseAsync<any>(req, 20000, false);\r\n\r\n if (res?.Status == Status.OK) {\r\n this._devices.push(device);\r\n (this._onDeviceRegisteredEvent as TypedEvent<IDevice>).Invoke(device);\r\n return DeviceTaskExecutionResult.Executed;\r\n }\r\n else\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n\r\n async RemoveDeviceAsync(device: IDevice): Promise<DeviceTaskExecutionResult> {\r\n var req = new DeviceUnpairRequest();\r\n req.Data = device.Guid;\r\n const res = await this._connection?.SendAndWaitForResponseAsync<any>(req, 35000, false);\r\n\r\n if (res?.Status == Status.OK) {\r\n this._devices = this._devices.where(a => a.Guid == device.Guid).toArray();\r\n (this._onDeviceRemovedEvent as TypedEvent<IDevice>).Invoke(device);\r\n return DeviceTaskExecutionResult.Executed;\r\n }\r\n else\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n\r\n private MapDeviceTaskToDeviceTaskInfo(device: IDevice, task: IDeviceTask): DeviceTaskInfo {\r\n let t = new DeviceTaskInfo();\r\n const tsk = task as DeviceTask;\r\n\r\n switch (tsk.FeatureType) {\r\n case DeviceControlFeature.SetTemperature:\r\n t.Data = (tsk as SetTemperature).Temperature;\r\n break;\r\n\r\n case DeviceControlFeature.SetLightBrightness:\r\n t.Data = (tsk as SetLightBrightness).Brightness;\r\n break;\r\n\r\n case DeviceControlFeature.SetLightColor:\r\n t = new LightColorTaskInfo();\r\n const ts = tsk as SetLightColor;\r\n (t as LightColorTaskInfo).R = ts.R;\r\n (t as LightColorTaskInfo).G = ts.G;\r\n (t as LightColorTaskInfo).B = ts.B;\r\n break;\r\n\r\n case DeviceControlFeature.SetLightTemperature:\r\n t.Data = (tsk as SetLightTemperature).Temperature;\r\n break;\r\n\r\n case DeviceControlFeature.SetBlindPosition:\r\n switch ((tsk as SetBlindPosition).Action) {\r\n case BlindActionEnum.Open:\r\n t.Data = 101;\r\n break;\r\n\r\n case BlindActionEnum.Close:\r\n t.Data = 102;\r\n break;\r\n\r\n case BlindActionEnum.Stop:\r\n t.Data = 103;\r\n break;\r\n\r\n case BlindActionEnum.Percentage:\r\n t.Data = (tsk as SetBlindPosition).Position;\r\n break;\r\n }\r\n break;\r\n\r\n case DeviceControlFeature.SetLightBrightnessDynamicly:\r\n t.Data = (tsk as SetLightBrightnessDynamicly).Brightness;\r\n break;\r\n\r\n case DeviceControlFeature.SetBlindOpenCloseTime:\r\n t.Data = (tsk as SetBlindOpenCloseTime).Data;\r\n break;\r\n\r\n case DeviceControlFeature.SetBlindMicroventilation:\r\n t.Data = (tsk as SetBlindMicroventilation).Position;\r\n break;\r\n\r\n case DeviceControlFeature.SetFacadePositionAndTilt:\r\n t = new FacadePositionTaskInfo();\r\n const fp = tsk as SetFacadePosition;\r\n (t as FacadePositionTaskInfo).FacadeAction = fp.FacadeAction;\r\n (t as FacadePositionTaskInfo).Tilt = fp.Tilt;\r\n (t as FacadePositionTaskInfo).Position = fp.Position;\r\n break;\r\n }\r\n\r\n t.Channel = tsk.Channel;\r\n t.DeviceGuid = device.Guid;\r\n t.ControlFeature = tsk.FeatureType;\r\n return t;\r\n }\r\n\r\n async ExecuteDeviceTaskAsync(device: IDevice, task: IDeviceTask): Promise<DeviceTaskExecutionResult> {\r\n try {\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Preparing device task execution, device: ${device.Guid} task: ${task.TaskType} channel: ${task.Channel}`);\r\n let t = this.MapDeviceTaskToDeviceTaskInfo(device, task);\r\n\r\n try {\r\n const req = new ExecuteDeviceTaskRequest(t);\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Sending device task for execution, device: ${t.DeviceGuid} task: ${t.ControlFeature} channel: ${t.Channel} request: ${JSON.stringify(req)}`);\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n\r\n switch (result?.Status) {\r\n case Status.OK:\r\n return DeviceTaskExecutionResult.Executed;\r\n\r\n case Status.FatalError:\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Fatal error occured when tried to execute task on device. Error code: ${result.Data}`);\r\n return DeviceTaskExecutionResult.Failed;\r\n\r\n case Status.WrongData:\r\n switch (result.Data) {\r\n case \"DeviceNotFound\":\r\n return DeviceTaskExecutionResult.DeviceNotFound;\r\n }\r\n break;\r\n\r\n case Status.Error:\r\n switch (result.Data) {\r\n case \"DeviceResponseTimeout\":\r\n return DeviceTaskExecutionResult.DeviceResponseTimeout;\r\n }\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when trying to execute task on device. Error code: ${result.Data}`);\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n }\r\n catch (ex: any) {\r\n if ((ex as Error).message.includes(\"timeout\")) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get controller response in time.\\n${ex}`);\r\n return DeviceTaskExecutionResult.ControllerResponseTimeout;\r\n }\r\n else {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when tried to execute task on device.\\n${ex}`);\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n }\r\n\r\n return DeviceTaskExecutionResult.Unknown;\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when tried to execute task on device.\\n${ex}`);\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n }\r\n\r\n async ExecuteDevicesTasksAsync(tasks: [Device: IDevice, Task: IDeviceTask][]): Promise<DeviceTaskPairExecutionResult[]> {\r\n let results: DeviceTaskPairExecutionResult[] = [];\r\n let tasksPair: DeviceTaskInfo[] = [];\r\n let devices: IDevice[] = [];\r\n let position = 0;\r\n\r\n for (const [device, task] of tasks) {\r\n const tmp = this.MapDeviceTaskToDeviceTaskInfo(device, task);\r\n tmp.SequnceExecutionOrder = position;\r\n position++;\r\n tasksPair.push(tmp);\r\n }\r\n\r\n const req = new ExecuteDevicesTasksRequest(tasksPair);\r\n try {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<DevicesTaskExecutionApiResult[]>(req, 120000, false);\r\n\r\n let responsePosition = -1;\r\n result?.Data?.forEach(element => {\r\n responsePosition++;\r\n let res: DeviceTaskExecutionResult = DeviceTaskExecutionResult.Unknown;\r\n\r\n switch (element.Status) {\r\n case Status.OK:\r\n return DeviceTaskExecutionResult.Executed;\r\n\r\n case Status.FatalError:\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Fatal error occured when tried to execute task on device. Error code: ${element.Data}`);\r\n res = DeviceTaskExecutionResult.Failed;\r\n break;\r\n\r\n case Status.WrongData:\r\n switch (element.Data) {\r\n case \"DeviceNotFound\":\r\n res = DeviceTaskExecutionResult.DeviceNotFound;\r\n break;\r\n }\r\n break;\r\n\r\n case Status.Error:\r\n switch (element.Data) {\r\n case \"DeviceResponseTimeout\":\r\n res = DeviceTaskExecutionResult.DeviceResponseTimeout;\r\n break;\r\n\r\n default:\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when trying to execute task on device. Error code: ${result.Data}`);\r\n res = DeviceTaskExecutionResult.Failed;\r\n break;\r\n }\r\n break;\r\n }\r\n\r\n let pos = 0;\r\n let info = new DeviceTaskPairExecutionResult();\r\n\r\n for (const [device, task] of tasks) {\r\n if (pos == responsePosition) {\r\n info.Device = device;\r\n info.Task = task;\r\n info.Channel = task.Channel;\r\n results.push(info);\r\n break;\r\n }\r\n else\r\n pos++;\r\n }\r\n });\r\n }\r\n catch (ex: any) {\r\n if ((ex as Error).message.includes(\"timeout\")) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get controller response in time.\\n${ex}`);\r\n\r\n for (const [device, task] of tasks) {\r\n let info = new DeviceTaskPairExecutionResult();\r\n results.push(info);\r\n info.Device = device;\r\n info.Task = task;\r\n info.Channel = task.Channel;\r\n info.Result = DeviceTaskExecutionResult.ControllerResponseTimeout;\r\n }\r\n }\r\n else {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when tried to execute task on device.\\n${ex}`);\r\n\r\n for (const [device, task] of tasks) {\r\n let info = new DeviceTaskPairExecutionResult();\r\n results.push(info);\r\n info.Device = device;\r\n info.Task = task;\r\n info.Channel = task.Channel;\r\n info.Result = DeviceTaskExecutionResult.Failed;\r\n }\r\n }\r\n }\r\n return results;\r\n }\r\n}\r\n\r\nclass DeviceObject {\r\n Guid: string = \"\";\r\n CloudGuid: string = \"\";\r\n DeviceSerialNumber: string = \"\";\r\n DeviceModelGuid: string = \"\";\r\n ProtocolGuid: string = \"\";\r\n DeviceName: string = \"\";\r\n DeviceModel: string = \"\";\r\n ManufacturerGuid: string = \"\";\r\n ChannelsNumber: number = 0;\r\n IsVirtual: boolean = false;\r\n IsEnabled: boolean = false;\r\n DeviceState: DeviceState = DeviceState.Working;\r\n CommunicationWay: CommunicationWay = CommunicationWay.OneWay;\r\n DeviceType: DeviceType = DeviceType.Unknown;\r\n ChannelsConfiguration: ChannelConfigurationObject[] = [];\r\n Groups: DeviceGroupObject[] = [];\r\n AvailableTasks: string[] = [];\r\n AvailableResponses: string[] = [];\r\n}\r\n\r\nclass DeviceGroupObject {\r\n Guid: string = \"\";\r\n Name: string = \"\";\r\n}\r\n\r\nclass ChannelConfigurationObject {\r\n Channel: number = 0;\r\n ChannelName: string = \"\";\r\n Configuration: ChannelConfigurations = ChannelConfigurations.Default;\r\n IconName: string = \"\";\r\n GroupsGuids: string[] = [];\r\n Hidden: boolean = false;\r\n AvailableTasks: any[] = [];\r\n AvailableResponses: any[] = [];\r\n}\r\n\r\n\r\nclass GetDevicesListRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/list\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\nclass GetDevicesStatesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/channels/states\";\r\n this.Method = Method.Get;\r\n }\r\n Data: boolean = false;\r\n}\r\n\r\nclass SyncDevicesStatesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/channels/states/sync\";\r\n this.Method = Method.Get;\r\n }\r\n Data: boolean = false;\r\n}\r\n\r\nclass SearchForDevicesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/search\";\r\n this.Method = Method.Post;\r\n }\r\n}\r\n\r\nclass StopSearchingForDevicesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/search/stop\";\r\n this.Method = Method.Post;\r\n }\r\n}\r\n\r\nclass GetFoundDevicesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/found/list\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\n\r\nexport class DeviceStateChangedObject {\r\n DeviceGuid: string = \"\";\r\n state: DeviceStateObject = new DeviceStateObject();\r\n Type: number = 0;\r\n DataType: string = \"\";\r\n}\r\n\r\nexport class DeviceStateObject {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n}\r\n\r\nclass GetRunningDevicesTasksRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/tasks\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\n\r\nclass DevicePairRequest extends DataFrame<string>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/device/pair\";\r\n this.Method = Method.Put;\r\n }\r\n}\r\n\r\nclass DeviceUnpairRequest extends DataFrame<string>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/device/unpair\";\r\n this.Method = Method.Put;\r\n }\r\n}\r\n\r\nclass ExecuteDeviceTaskRequest extends DataFrame<DeviceTaskInfo>\r\n{\r\n constructor(task: DeviceTaskInfo) {\r\n super();\r\n this.Resource = \"/devices/device/control\";\r\n this.Method = Method.Post;\r\n this.Data = task;\r\n }\r\n}\r\n\r\nclass ExecuteDevicesTasksRequest extends DataFrame<DeviceTaskInfo[]>\r\n{\r\n constructor(tasks: DeviceTaskInfo[]) {\r\n super();\r\n this.Resource = \"/devices/devices/control\";\r\n this.Method = Method.Post;\r\n this.Data = tasks;\r\n }\r\n}\r\n\r\nclass DeviceTaskInfo {\r\n DeviceGuid: string = \"\";\r\n Channel: number = 0;\r\n ControlFeature: DeviceControlFeature = DeviceControlFeature.GetState;\r\n Data: any;\r\n /// does't exist in controller, its is used only by this library to map responses that are returned in order to tasks\r\n SequnceExecutionOrder: number = 0;\r\n}\r\n\r\nclass LightColorTaskInfo extends DeviceTaskInfo {\r\n R: number = 0;\r\n G: number = 0;\r\n B: number = 0;\r\n}\r\n\r\nclass FacadePositionTaskInfo extends DeviceTaskInfo {\r\n FacadeAction: FacadeActionEnum = FacadeActionEnum.Stop;\r\n Tilt: number = 0;\r\n Position: number = 0;\r\n}\r\n\r\nclass DevicesTaskExecutionApiResult {\r\n DeviceGuid: string = \"\";\r\n Data: any;\r\n Status: Status = Status.OK;\r\n}","import { ResponseResult } from '../FieldChangeResult';\r\nimport { Coordinates, CoordinatesWithSourceInfo, IGeolocationService, SetGeolocationResponseCode } from './IGeolocationService';\r\nimport { DataFrame, Method, Status } from '../../DataFrame';\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { Api } from '../../Api';\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { DependencyContainer } from '../../DependencyContainer';\r\n\r\nexport class GeolocationService implements IGeolocationService {\r\n\tpublic static readonly ServiceName: string = \"GeolocationService\";\r\n\r\n\tasync IsControllerGeolocationSetAsync(): Promise<boolean | Status> {\t\t\r\n\t\tlet req = new IsGeolocationSetRequest();\r\n\t\tlet response = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName).SendAndWaitForResponseAsync<boolean>(req, 15000, true);\r\n\r\n\t\tswitch (response?.Status) {\r\n\t\t\tcase Status.OK:\r\n\t\t\t\treturn response?.Data as boolean;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\treturn response?.Status as Status;\r\n\t\t}\r\n\t}\r\n\r\n\tasync GetCurrentGeolocationAsync(): Promise<GeolocationPosition | GeolocationPositionError> {\r\n\t\treturn new Promise<GeolocationPosition | GeolocationPositionError>(async (resolve, reject) => {\r\n\t\t\twindow.navigator.geolocation.getCurrentPosition(position => {\r\n\t\t\t\tresolve(position);\r\n\t\t\t}, error => {\r\n\t\t\t\tresolve(error);\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\r\n\tasync SetControllerGeolocationAsync(location: Coordinates): Promise<ResponseResult<SetGeolocationResponseCode>> {\r\n\t\tlet req = new SetCoordinatesRequest();\r\n\t\treq.Data.Latitude = location.Latitude;\r\n\t\treq.Data.Longitude = location.Longitude;\r\n\t\r\n\t\tDependencyContainer.Log?.Warning(GeolocationService.ServiceName, `SetControllerGeolocationAsync() ${JSON.stringify(req)}`);\r\n\t\tlet response = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName).SendAndWaitForResponseAsync<boolean>(req, 15000, false);\t\r\n\t\tDependencyContainer.Log?.Warning(GeolocationService.ServiceName, `${JSON.stringify(response)}`);\r\n\r\n\t\tswitch (response?.Status) {\r\n\t\t\tcase Status.OK:\r\n\t\t\t\treturn new ResponseResult<SetGeolocationResponseCode>(SetGeolocationResponseCode.OK, \"\");\r\n\r\n\t\t\tcase Status.NoPermissionToPerformThisOperation:\r\n\t\t\tcase Status.NoPermissionsToCallGivenResource:\r\n\t\t\t\treturn new ResponseResult<SetGeolocationResponseCode>(SetGeolocationResponseCode.NoPermissions, \"\");\r\n\r\n\t\t\tcase Status.UserIsNotLoggedIn:\r\n\t\t\t\treturn new ResponseResult<SetGeolocationResponseCode>(SetGeolocationResponseCode.UserIsNotLoggedIn, \"\");\r\n\r\n\t\t\tdefault:\r\n\t\t\t\treturn new ResponseResult<SetGeolocationResponseCode>(SetGeolocationResponseCode.UnknownError, \"\");\r\n\t\t}\r\n\t}\r\n\r\n\tasync GetControlllerGeolocationAsync(): Promise<CoordinatesWithSourceInfo | Status> {\r\n\t\tlet req = new GetSetCoordinatesRequest();\r\n\t\tDependencyContainer.Log?.Warning(GeolocationService.ServiceName, `GetControlllerGeolocationAsync(): ${JSON.stringify(req)}`);\r\n\t\tlet response = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName).SendAndWaitForResponseAsync<CoordinatesWithSourceInfo>(req, 15000, true);\r\n\t\tDependencyContainer.Log?.Warning(GeolocationService.ServiceName, `${JSON.stringify(response)}`);\r\n\r\n\t\tswitch (response?.Status) {\r\n\t\t\tcase Status.OK:\r\n\t\t\t\tlet c = new CoordinatesWithSourceInfo();\r\n\t\t\t\tc.IsNetworkBased = (response?.Data as CoordinatesWithSourceInfo).IsNetworkBased;\r\n\t\t\t\tc.Latitude = (response?.Data as CoordinatesWithSourceInfo).Latitude;\r\n\t\t\t\tc.Longitude = (response?.Data as CoordinatesWithSourceInfo).Longitude;\r\n\t\t\t\treturn c;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\treturn response?.Status as Status;\r\n\t\t}\r\n\t}\r\n\r\n\tGetServiceName(): string {\r\n\t\treturn GeolocationService.ServiceName;\r\n\t}\r\n\r\n}\r\n\r\nclass IsGeolocationSetRequest extends DataFrame<any>\r\n{\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.Resource = \"/geolocation/isset\";\r\n\t\tthis.Method = Method.Get;\r\n\t}\r\n}\r\n\r\nclass GetSetCoordinatesRequest extends DataFrame<any>\r\n{\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.Resource = \"/geolocation/get\";\r\n\t\tthis.Method = Method.Get;\r\n\t}\r\n}\r\n\r\nclass SetCoordinatesRequest extends DataFrame<any>\r\n{\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.Resource = \"/geolocation/save\";\r\n\t\tthis.Method = Method.Put;\r\n\t}\r\n\r\n\tData: Coordinates = new Coordinates();\r\n}","export class ArgumentOutOfRangeException extends RangeError {\r\n constructor(paramName) {\r\n super(`${paramName} was out of range.` +\r\n \" Must be non-negative and less than the size of the collection.\");\r\n this.paramName = paramName;\r\n this.name = \"ArgumentOutOfRangeException\";\r\n this.stack = this.stack || (new Error()).stack;\r\n }\r\n}\r\n","export const ErrorString = Object.freeze({\r\n MoreThanOneElement: \"Sequence contains more than one element\",\r\n MoreThanOneMatchingElement: \"Sequence contains more than one matching element\",\r\n NoElements: \"Sequence contains no elements\",\r\n NoMatch: \"Sequence contains no matching element\",\r\n});\r\n","export class InvalidOperationException extends Error {\r\n constructor(message) {\r\n super(message);\r\n this.name = \"InvalidOperationException\";\r\n this.stack = this.stack || (new Error()).stack;\r\n }\r\n}\r\n","export const StrictEqualityComparer = (x, y) => x === y;\r\n","export class ArrayEnumerable extends Array {\r\n}\r\n","export class BasicAsyncEnumerable {\r\n constructor(iterator) {\r\n this.iterator = iterator;\r\n }\r\n [Symbol.asyncIterator]() {\r\n return this.iterator();\r\n }\r\n}\r\n","export class BasicParallelEnumerable {\r\n constructor(dataFunc) {\r\n this.dataFunc = dataFunc;\r\n }\r\n [Symbol.asyncIterator]() {\r\n const { dataFunc } = this;\r\n async function* iterator() {\r\n switch (dataFunc.type) {\r\n case 1:\r\n for (const value of dataFunc.generator()) {\r\n yield value;\r\n }\r\n break;\r\n case 2:\r\n for (const value of await dataFunc.generator()) {\r\n yield value;\r\n }\r\n break;\r\n case 0:\r\n default:\r\n for (const value of await dataFunc.generator()) {\r\n yield value;\r\n }\r\n break;\r\n }\r\n }\r\n return iterator();\r\n }\r\n}\r\n","export class BasicEnumerable {\r\n constructor(iterator) {\r\n this.iterator = iterator;\r\n }\r\n [Symbol.iterator]() {\r\n return this.iterator();\r\n }\r\n}\r\n","import { ArrayEnumerable } from \"../sync/ArrayEnumerable.js\";\r\nexport const bindArray = (jsArray) => {\r\n var _a;\r\n const arrayEnumerablePrototype = ArrayEnumerable.prototype;\r\n const bindToPrototype = jsArray.prototype;\r\n const propertyNames = Object\r\n .getOwnPropertyNames(arrayEnumerablePrototype);\r\n for (const prop of propertyNames) {\r\n bindToPrototype[prop] = (_a = bindToPrototype[prop]) !== null && _a !== void 0 ? _a : arrayEnumerablePrototype[prop];\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const aggregate = (source, seedOrFunc, func, resultSelector) => {\r\n if (resultSelector) {\r\n if (!func) {\r\n throw new ReferenceError(\"TAccumulate function is undefined\");\r\n }\r\n return aggregate3(source, seedOrFunc, func, resultSelector);\r\n }\r\n else if (func) {\r\n return aggregate2(source, seedOrFunc, func);\r\n }\r\n else {\r\n return aggregate1(source, seedOrFunc);\r\n }\r\n};\r\nconst aggregate1 = (source, func) => {\r\n let aggregateValue;\r\n for (const value of source) {\r\n if (aggregateValue) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n else {\r\n aggregateValue = value;\r\n }\r\n }\r\n if (aggregateValue === undefined) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate2 = (source, seed, func) => {\r\n let aggregateValue = seed;\r\n for (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate3 = (source, seed, func, resultSelector) => {\r\n let aggregateValue = seed;\r\n for (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return resultSelector(aggregateValue);\r\n};\r\n","export const all = (source, predicate) => {\r\n for (const item of source) {\r\n if (predicate(item) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const allAsync = async (source, predicate) => {\r\n for (const item of source) {\r\n if (await predicate(item) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const any = (source, predicate) => {\r\n if (predicate) {\r\n return any2(source, predicate);\r\n }\r\n else {\r\n return any1(source);\r\n }\r\n};\r\nconst any1 = (source) => {\r\n for (const _ of source) {\r\n return true;\r\n }\r\n return false;\r\n};\r\nconst any2 = (source, predicate) => {\r\n for (const item of source) {\r\n if (predicate(item) === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const anyAsync = async (source, predicate) => {\r\n for (const item of source) {\r\n if (await predicate(item) === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const fromAsync = (promisesOrIterable) => {\r\n if (Array.isArray(promisesOrIterable)) {\r\n if (promisesOrIterable.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return new BasicAsyncEnumerable(async function* () {\r\n for await (const value of promisesOrIterable) {\r\n yield value;\r\n }\r\n });\r\n }\r\n else {\r\n return new BasicAsyncEnumerable(promisesOrIterable);\r\n }\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const asAsync = (source) => {\r\n async function* generator() {\r\n for (const value of source) {\r\n yield value;\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const fromParallel = (type, generator) => {\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type,\r\n });\r\n};\r\n","import { fromParallel } from \"../../parallel/static/fromParallel.js\";\r\nexport const asParallel = (source) => {\r\n const generator = async () => {\r\n const array = [];\r\n for (const value of source) {\r\n array.push(value);\r\n }\r\n return array;\r\n };\r\n return fromParallel(0, generator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const average = (source, selector) => {\r\n let value = 0;\r\n let count = 0;\r\n if (selector) {\r\n for (const item of source) {\r\n value = value + selector(item);\r\n count = count + 1;\r\n }\r\n }\r\n else {\r\n for (const item of source) {\r\n value = value + item;\r\n count = count + 1;\r\n }\r\n }\r\n if (count === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return value / count;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const averageAsync = async (source, selector) => {\r\n let value = 0;\r\n let count = 0;\r\n for (const item of source) {\r\n value = value + await selector(item);\r\n count = count + 1;\r\n }\r\n if (count === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return value / count;\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nimport { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const chunk = (source, size) => {\r\n if (size < 1) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n function* iterator() {\r\n let yieldChunk = [];\r\n for (const value of source) {\r\n yieldChunk.push(value);\r\n if (yieldChunk.length === size) {\r\n yield yieldChunk;\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n yield yieldChunk;\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const concatenate = (first, second) => {\r\n function* iterator() {\r\n yield* first;\r\n yield* second;\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const contains = (source, value, comparer = StrictEqualityComparer) => {\r\n for (const item of source) {\r\n if (comparer(value, item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const containsAsync = async (source, value, comparer) => {\r\n for (const item of source) {\r\n if (await comparer(value, item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const count = (source, predicate) => {\r\n if (predicate) {\r\n return count2(source, predicate);\r\n }\r\n else {\r\n return count1(source);\r\n }\r\n};\r\nconst count1 = (source) => {\r\n let count = 0;\r\n for (const _ of source) {\r\n count++;\r\n }\r\n return count;\r\n};\r\nconst count2 = (source, predicate) => {\r\n let count = 0;\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n};\r\n","export const countAsync = async (source, predicate) => {\r\n let count = 0;\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const defaultIfEmpty = (source, defaultValue) => {\r\n function* generator() {\r\n let found = false;\r\n for (const value of source) {\r\n found = true;\r\n yield value;\r\n }\r\n if (!found) {\r\n yield defaultValue;\r\n }\r\n }\r\n return new BasicEnumerable(generator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const distinct = (source, comparer = StrictEqualityComparer) => {\r\n function* iterator() {\r\n const distinctElements = [];\r\n for (const item of source) {\r\n const foundItem = distinctElements.find((x) => comparer(x, item));\r\n if (!foundItem) {\r\n distinctElements.push(item);\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const distinctAsync = (source, comparer) => {\r\n async function* iterator() {\r\n const distinctElements = [];\r\n outerLoop: for (const item of source) {\r\n for (const distinctElement of distinctElements) {\r\n const found = await comparer(distinctElement, item);\r\n if (found) {\r\n continue outerLoop;\r\n }\r\n }\r\n distinctElements.push(item);\r\n yield item;\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const each = (source, action) => {\r\n function* generator() {\r\n for (const value of source) {\r\n action(value);\r\n yield value;\r\n }\r\n }\r\n return new BasicEnumerable(generator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const eachAsync = (source, action) => {\r\n async function* generator() {\r\n for (const value of source) {\r\n await action(value);\r\n yield value;\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const elementAt = (source, index) => {\r\n if (index < 0) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n let i = 0;\r\n for (const item of source) {\r\n if (index === i++) {\r\n return item;\r\n }\r\n }\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n};\r\n","export const elementAtOrDefault = (source, index) => {\r\n let i = 0;\r\n for (const item of source) {\r\n if (index === i++) {\r\n return item;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const except = (first, second, comparer = StrictEqualityComparer) => {\r\n function* iterator() {\r\n const secondArray = [...second];\r\n for (const firstItem of first) {\r\n let exists = false;\r\n for (let j = 0; j < secondArray.length; j++) {\r\n const secondItem = secondArray[j];\r\n if (comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield firstItem;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const exceptAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const secondArray = [...second];\r\n for (const firstItem of first) {\r\n let exists = false;\r\n for (let j = 0; j < secondArray.length; j++) {\r\n const secondItem = secondArray[j];\r\n if (await comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield firstItem;\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const first = (source, predicate) => {\r\n if (predicate) {\r\n return first2(source, predicate);\r\n }\r\n else {\r\n return first1(source);\r\n }\r\n};\r\nconst first1 = (source) => {\r\n const first = source[Symbol.iterator]().next();\r\n if (first.done === true) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return first.value;\r\n};\r\nconst first2 = (source, predicate) => {\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const firstAsync = async (source, predicate) => {\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","export const firstOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return firstOrDefault2(source, predicate);\r\n }\r\n else {\r\n return firstOrDefault1(source);\r\n }\r\n};\r\nconst firstOrDefault1 = (source) => {\r\n const first = source[Symbol.iterator]().next();\r\n return first.value || null;\r\n};\r\nconst firstOrDefault2 = (source, predicate) => {\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","export const firstOrDefaultAsync = async (source, predicate) => {\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { ArrayEnumerable } from \"./ArrayEnumerable.js\";\r\nexport class Grouping extends ArrayEnumerable {\r\n constructor(key, startingItem) {\r\n super(1);\r\n this.key = key;\r\n this[0] = startingItem;\r\n }\r\n}\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nimport { Grouping } from \"../Grouping.js\";\r\nexport const groupBy_0 = (source, keySelector, comparer) => {\r\n return function* generate() {\r\n const keyMap = new Array();\r\n for (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n for (const keyValue of keyMap) {\r\n yield keyValue;\r\n }\r\n };\r\n};\r\nexport const groupBy_0_Simple = (source, keySelector) => {\r\n return function* iterator() {\r\n const keyMap = {};\r\n for (const value of source) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n };\r\n};\r\nexport const groupBy_1_Simple = (source, keySelector, elementSelector) => {\r\n function* generate() {\r\n const keyMap = {};\r\n for (const value of source) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n const element = elementSelector(value);\r\n if (grouping) {\r\n grouping.push(element);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, element);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return new BasicEnumerable(generate);\r\n};\r\nexport const groupBy_1 = (source, keySelector, elementSelector, comparer) => {\r\n function* generate() {\r\n const keyMap = new Array();\r\n for (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(elementSelector(value));\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n const element = elementSelector(value);\r\n keyMap.push(new Grouping(key, element));\r\n }\r\n }\r\n for (const keyValue of keyMap) {\r\n yield keyValue;\r\n }\r\n }\r\n return new BasicEnumerable(generate);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nimport { groupBy_0, groupBy_0_Simple } from \"./groupByShared.js\";\r\nexport const groupBy = (source, keySelector, comparer) => {\r\n let iterable;\r\n if (comparer) {\r\n iterable = groupBy_0(source, keySelector, comparer);\r\n }\r\n else {\r\n iterable = groupBy_0_Simple(source, keySelector);\r\n }\r\n return new BasicEnumerable(iterable);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nimport { Grouping } from \"../Grouping.js\";\r\nexport const groupByAsync = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupByAsync_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupByAsync_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupByAsync_0_Simple = (source, keySelector) => {\r\n async function* iterator() {\r\n const keyMap = {};\r\n for (const value of source) {\r\n const key = await keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst groupByAsync_0 = (source, keySelector, comparer) => {\r\n async function* generate() {\r\n const keyMap = new Array();\r\n for (const value of source) {\r\n const key = await keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (await comparer(group.key, key) === true) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n for (const keyValue of keyMap) {\r\n yield keyValue;\r\n }\r\n }\r\n return fromAsync(generate);\r\n};\r\n","import { groupBy_1, groupBy_1_Simple } from \"./groupByShared.js\";\r\nexport const groupByWithSel = (source, keySelector, elementSelector, comparer) => {\r\n if (comparer) {\r\n return groupBy_1(source, keySelector, elementSelector, comparer);\r\n }\r\n else {\r\n return groupBy_1_Simple(source, keySelector, elementSelector);\r\n }\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const groupJoin = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicEnumerable(generator);\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return function* () {\r\n var _a;\r\n const innerKeyMap = [];\r\n for (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n for (const outerValue of outer) {\r\n const key = outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n yield resultSelector(outerValue, innerRecord.values);\r\n }\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return function* () {\r\n var _a;\r\n const innerKeyMap = new Map();\r\n for (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n for (const outerValue of outer) {\r\n const key = outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n yield resultSelector(outerValue, values);\r\n }\r\n };\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const groupJoinAsync = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return fromAsync(generator);\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = [];\r\n for (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n for (const outerValue of outer) {\r\n const key = await outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n yield resultSelector(outerValue, innerRecord.values);\r\n }\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = new Map();\r\n for (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n for (const outerValue of outer) {\r\n const key = await outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n yield resultSelector(outerValue, values);\r\n }\r\n };\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const intersect = (first, second, comparer = StrictEqualityComparer) => {\r\n function* iterator() {\r\n const firstResults = [...first.distinct(comparer)];\r\n if (firstResults.length === 0) {\r\n return;\r\n }\r\n const secondResults = [...second];\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (comparer(firstValue, secondValue) === true) {\r\n yield firstValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const intersectAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const firstResults = [];\r\n for await (const item of first.distinctAsync(comparer)) {\r\n firstResults.push(item);\r\n }\r\n if (firstResults.length === 0) {\r\n return;\r\n }\r\n const secondResults = [...second];\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (await comparer(firstValue, secondValue) === true) {\r\n yield firstValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const join = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer = StrictEqualityComparer) => {\r\n function* iterator() {\r\n const innerArray = [...inner];\r\n for (const o of outer) {\r\n const outerKey = outerKeySelector(o);\r\n for (const i of innerArray) {\r\n const innerKey = innerKeySelector(i);\r\n if (comparer(outerKey, innerKey) === true) {\r\n yield resultSelector(o, i);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const last = (source, predicate) => {\r\n if (predicate) {\r\n return last2(source, predicate);\r\n }\r\n else {\r\n return last1(source);\r\n }\r\n};\r\nconst last1 = (source) => {\r\n let lastItem;\r\n for (const value of source) {\r\n lastItem = value;\r\n }\r\n if (!lastItem) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return lastItem;\r\n};\r\nconst last2 = (source, predicate) => {\r\n let lastItem;\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n lastItem = value;\r\n }\r\n }\r\n if (!lastItem) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return lastItem;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const lastAsync = async (source, predicate) => {\r\n let last;\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n if (!last) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return last;\r\n};\r\n","export const lastOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return lastOrDefault2(source, predicate);\r\n }\r\n else {\r\n return lastOrDefault1(source);\r\n }\r\n};\r\nconst lastOrDefault1 = (source) => {\r\n let last = null;\r\n for (const value of source) {\r\n last = value;\r\n }\r\n return last;\r\n};\r\nconst lastOrDefault2 = (source, predicate) => {\r\n let last = null;\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n return last;\r\n};\r\n","export const lastOrDefaultAsync = async (source, predicate) => {\r\n let last = null;\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n return last;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const max = (source, selector) => {\r\n if (selector) {\r\n return max2(source, selector);\r\n }\r\n else {\r\n return max1(source);\r\n }\r\n};\r\nconst max1 = (source) => {\r\n let maxItem = null;\r\n for (const item of source) {\r\n maxItem = Math.max(maxItem || Number.NEGATIVE_INFINITY, item);\r\n }\r\n if (maxItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return maxItem;\r\n }\r\n};\r\nconst max2 = (source, selector) => {\r\n let maxItem = null;\r\n for (const item of source) {\r\n maxItem = Math.max(maxItem || Number.NEGATIVE_INFINITY, selector(item));\r\n }\r\n if (maxItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return maxItem;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const maxAsync = async (source, selector) => {\r\n let max = null;\r\n for (const item of source) {\r\n max = Math.max(max || Number.NEGATIVE_INFINITY, await selector(item));\r\n }\r\n if (max === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return max;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const min = (source, selector) => {\r\n if (selector) {\r\n return min2(source, selector);\r\n }\r\n else {\r\n return min1(source);\r\n }\r\n};\r\nconst min1 = (source) => {\r\n let minItem = null;\r\n for (const item of source) {\r\n minItem = Math.min(minItem || Number.POSITIVE_INFINITY, item);\r\n }\r\n if (minItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return minItem;\r\n }\r\n};\r\nconst min2 = (source, selector) => {\r\n let minItem = null;\r\n for (const item of source) {\r\n minItem = Math.min(minItem || Number.POSITIVE_INFINITY, selector(item));\r\n }\r\n if (minItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return minItem;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const minAsync = async (source, selector) => {\r\n let min = null;\r\n for (const item of source) {\r\n min = Math.min(min || Number.POSITIVE_INFINITY, await selector(item));\r\n }\r\n if (min === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return min;\r\n }\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const ofType = (source, type) => {\r\n const typeCheck = typeof type === \"string\" ?\r\n ((x) => typeof x === type) :\r\n ((x) => x instanceof type);\r\n function* iterator() {\r\n for (const item of source) {\r\n if (typeCheck(item)) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { asAsyncKeyMapSync } from \"./asAsyncKeyMapSync.js\";\r\nexport async function* asAsyncSortedKeyValuesSync(source, keySelector, ascending, comparer) {\r\n const map = await asAsyncKeyMapSync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asAsyncKeyMapSync = async (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMapSync } from \"./asKeyMapSync.js\";\r\nexport function* asSortedKeyValuesSync(source, keySelector, ascending, comparer) {\r\n const map = asKeyMapSync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMapSync = (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asAsyncSortedKeyValues } from \"./_ordered/asAsyncSortedKeyValues.js\";\r\nimport { asAsyncSortedKeyValuesSync } from \"./_ordered/asAsyncSortedKeyValuesSync.js\";\r\nimport { asSortedKeyValues } from \"./_ordered/asSortedKeyValues.js\";\r\nimport { asSortedKeyValuesSync } from \"./_ordered/asSortedKeyValuesSync.js\";\r\nimport { BasicAsyncEnumerable } from \"./BasicAsyncEnumerable.js\";\r\nexport class OrderedAsyncEnumerable extends BasicAsyncEnumerable {\r\n constructor(orderedPairs) {\r\n super(async function* () {\r\n for await (const orderedPair of orderedPairs()) {\r\n yield* orderedPair;\r\n }\r\n });\r\n this.orderedPairs = orderedPairs;\r\n }\r\n static generateAsync(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedAsyncEnumerable) {\r\n orderedPairs = async function* () {\r\n for await (const pair of source.orderedPairs()) {\r\n yield* asAsyncSortedKeyValuesSync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asAsyncSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedAsyncEnumerable(orderedPairs);\r\n }\r\n static generate(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedAsyncEnumerable) {\r\n orderedPairs = async function* () {\r\n for await (const pair of source.orderedPairs()) {\r\n yield* asSortedKeyValuesSync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedAsyncEnumerable(orderedPairs);\r\n }\r\n thenBy(keySelector, comparer) {\r\n return OrderedAsyncEnumerable.generate(this, keySelector, true, comparer);\r\n }\r\n thenByAsync(keySelector, comparer) {\r\n return OrderedAsyncEnumerable.generateAsync(this, keySelector, true, comparer);\r\n }\r\n thenByDescending(keySelector, comparer) {\r\n return OrderedAsyncEnumerable.generate(this, keySelector, false, comparer);\r\n }\r\n thenByDescendingAsync(keySelector, comparer) {\r\n return OrderedAsyncEnumerable.generateAsync(this, keySelector, false, comparer);\r\n }\r\n}\r\n","import { asAsyncKeyMap } from \"./asAsyncKeyMap.js\";\r\nexport async function* asAsyncSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = await asAsyncKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asAsyncKeyMap = async (source, keySelector) => {\r\n const map = new Map();\r\n for await (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMap } from \"./asKeyMap.js\";\r\nexport async function* asSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = await asKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMap = async (source, keySelector) => {\r\n const map = new Map();\r\n for await (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMap } from \"./asKeyMap.js\";\r\nexport function* asSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = asKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMap = (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMapAsync } from \"./asKeyMapAsync.js\";\r\nexport async function* asSortedKeyValuesAsync(source, keySelector, ascending, comparer) {\r\n const map = await asKeyMapAsync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMapAsync = async (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../async/OrderedAsyncEnumerable.js\";\r\nimport { asSortedKeyValues } from \"./_ordered/asSortedKeyValues.js\";\r\nimport { asSortedKeyValuesAsync } from \"./_ordered/asSortedKeyValuesAsync.js\";\r\nimport { BasicEnumerable } from \"./BasicEnumerable.js\";\r\nexport class OrderedEnumerable extends BasicEnumerable {\r\n constructor(orderedPairs) {\r\n super(function* () {\r\n for (const orderedPair of orderedPairs()) {\r\n yield* orderedPair;\r\n }\r\n });\r\n this.orderedPairs = orderedPairs;\r\n }\r\n static generate(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedEnumerable) {\r\n orderedPairs = function* () {\r\n for (const pair of source.orderedPairs()) {\r\n yield* asSortedKeyValues(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedEnumerable(orderedPairs);\r\n }\r\n static generateAsync(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedEnumerable) {\r\n orderedPairs = async function* () {\r\n for (const pair of source.orderedPairs()) {\r\n yield* asSortedKeyValuesAsync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asSortedKeyValuesAsync(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedAsyncEnumerable(orderedPairs);\r\n }\r\n thenBy(keySelector, comparer) {\r\n return OrderedEnumerable.generate(this, keySelector, true, comparer);\r\n }\r\n thenByAsync(keySelector, comparer) {\r\n return OrderedEnumerable.generateAsync(this, keySelector, true, comparer);\r\n }\r\n thenByDescending(keySelector, comparer) {\r\n return OrderedEnumerable.generate(this, keySelector, false, comparer);\r\n }\r\n thenByDescendingAsync(keySelector, comparer) {\r\n return OrderedEnumerable.generateAsync(this, keySelector, false, comparer);\r\n }\r\n}\r\n","import { OrderedEnumerable } from \"../OrderedEnumerable.js\";\r\nexport const orderBy = (source, keySelector, comparer) => {\r\n return OrderedEnumerable.generate(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedEnumerable } from \"../OrderedEnumerable.js\";\r\nexport const orderByAsync = (source, keySelector, comparer) => {\r\n return OrderedEnumerable.generateAsync(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedEnumerable } from \"../OrderedEnumerable.js\";\r\nexport const orderByDescending = (source, keySelector, comparer) => {\r\n return OrderedEnumerable.generate(source, keySelector, false, comparer);\r\n};\r\n","import { OrderedEnumerable } from \"../OrderedEnumerable.js\";\r\nexport const orderByDescendingAsync = (source, keySelector, comparer) => {\r\n return OrderedEnumerable.generateAsync(source, keySelector, false, comparer);\r\n};\r\n","export const partition = (source, predicate) => {\r\n const fail = [];\r\n const pass = [];\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","export const partitionAsync = async (source, predicate) => {\r\n const fail = [];\r\n const pass = [];\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const reverse = (source) => {\r\n function* iterator() {\r\n const array = [...source];\r\n for (let i = array.length - 1; i >= 0; i--) {\r\n yield array[i];\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const select = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n const { length } = selector;\r\n if (length === 1) {\r\n return select1(source, selector);\r\n }\r\n else {\r\n return select2(source, selector);\r\n }\r\n }\r\n else {\r\n return select3(source, selector);\r\n }\r\n};\r\nconst select1 = (source, selector) => {\r\n function* iterator() {\r\n for (const value of source) {\r\n yield selector(value);\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst select2 = (source, selector) => {\r\n function* iterator() {\r\n let index = 0;\r\n for (const value of source) {\r\n yield selector(value, index);\r\n index++;\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst select3 = (source, key) => {\r\n function* iterator() {\r\n for (const value of source) {\r\n yield value[key];\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const selectAsync = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n return selectAsync1(source, selector);\r\n }\r\n else {\r\n return selectAsync2(source, selector);\r\n }\r\n }\r\n else {\r\n return selectAsync3(source, selector);\r\n }\r\n};\r\nconst selectAsync1 = (source, selector) => {\r\n async function* iterator() {\r\n for (const value of source) {\r\n yield selector(value);\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst selectAsync2 = (source, selector) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for (const value of source) {\r\n yield selector(value, index);\r\n index++;\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst selectAsync3 = (source, key) => {\r\n async function* iterator() {\r\n for (const value of source) {\r\n yield value[key];\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const selectMany = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n return selectMany1(source, selector);\r\n }\r\n else {\r\n return selectMany2(source, selector);\r\n }\r\n }\r\n else {\r\n return selectMany3(source, selector);\r\n }\r\n};\r\nconst selectMany1 = (source, selector) => {\r\n function* iterator() {\r\n for (const value of source) {\r\n for (const selectorValue of selector(value)) {\r\n yield selectorValue;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst selectMany2 = (source, selector) => {\r\n function* iterator() {\r\n let index = 0;\r\n for (const value of source) {\r\n for (const selectorValue of selector(value, index)) {\r\n yield selectorValue;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst selectMany3 = (source, selector) => {\r\n function* iterator() {\r\n for (const value of source) {\r\n for (const selectorValue of value[selector]) {\r\n yield selectorValue;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const selectManyAsync = (source, selector) => {\r\n if (selector.length === 1) {\r\n return selectManyAsync1(source, selector);\r\n }\r\n else {\r\n return selectManyAsync2(source, selector);\r\n }\r\n};\r\nconst selectManyAsync1 = (source, selector) => {\r\n async function* generator() {\r\n for (const value of source) {\r\n const innerValues = await selector(value);\r\n for (const innerValue of innerValues) {\r\n yield innerValue;\r\n }\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\nconst selectManyAsync2 = (source, selector) => {\r\n async function* generator() {\r\n let index = 0;\r\n for (const value of source) {\r\n const innerValues = await selector(value, index);\r\n for (const innerValue of innerValues) {\r\n yield innerValue;\r\n }\r\n index++;\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const sequenceEquals = (first, second, comparer = StrictEqualityComparer) => {\r\n const firstIterator = first[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n let firstResult = firstIterator.next();\r\n let secondResult = secondIterator.next();\r\n while (!firstResult.done && !secondResult.done) {\r\n if (!comparer(firstResult.value, secondResult.value)) {\r\n return false;\r\n }\r\n firstResult = firstIterator.next();\r\n secondResult = secondIterator.next();\r\n }\r\n return firstResult.done === true && secondResult.done === true;\r\n};\r\n","export const sequenceEqualsAsync = async (first, second, comparer) => {\r\n const firstIterator = first[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n let firstResult = firstIterator.next();\r\n let secondResult = secondIterator.next();\r\n while (!firstResult.done && !secondResult.done) {\r\n if (await comparer(firstResult.value, secondResult.value) === false) {\r\n return false;\r\n }\r\n firstResult = firstIterator.next();\r\n secondResult = secondIterator.next();\r\n }\r\n return firstResult.done === true && secondResult.done === true;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const single = (source, predicate) => {\r\n if (predicate) {\r\n return single2(source, predicate);\r\n }\r\n else {\r\n return single1(source);\r\n }\r\n};\r\nconst single1 = (source) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return singleValue;\r\n};\r\nconst single2 = (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleAsync = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (await predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return singleOrDefault2(source, predicate);\r\n }\r\n else {\r\n return singleOrDefault1(source);\r\n }\r\n};\r\nconst singleOrDefault1 = (source) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n return singleValue;\r\n};\r\nconst singleOrDefault2 = (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleOrDefaultAsync = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (await predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const skip = (source, count) => {\r\n function* iterator() {\r\n let i = 0;\r\n for (const item of source) {\r\n if (i++ >= count) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const skipWhile = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return skipWhile1(source, predicate);\r\n }\r\n else {\r\n return skipWhile2(source, predicate);\r\n }\r\n};\r\nconst skipWhile1 = (source, predicate) => {\r\n function* iterator() {\r\n let skip = true;\r\n for (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (predicate(item) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst skipWhile2 = (source, predicate) => {\r\n function* iterator() {\r\n let index = 0;\r\n let skip = true;\r\n for (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (predicate(item, index) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const skipWhileAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return skipWhileAsync1(source, predicate);\r\n }\r\n else {\r\n return skipWhileAsync2(source, predicate);\r\n }\r\n};\r\nconst skipWhileAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n let skip = true;\r\n for (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (await predicate(item) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst skipWhileAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n let skip = true;\r\n for (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (await predicate(item, index) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n index++;\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","export const sum = (source, selector) => {\r\n if (selector) {\r\n return sum2(source, selector);\r\n }\r\n else {\r\n return sum1(source);\r\n }\r\n};\r\nconst sum1 = (source) => {\r\n let total = 0;\r\n for (const value of source) {\r\n total += value;\r\n }\r\n return total;\r\n};\r\nconst sum2 = (source, selector) => {\r\n let total = 0;\r\n for (const value of source) {\r\n total += selector(value);\r\n }\r\n return total;\r\n};\r\n","export const sumAsync = async (source, selector) => {\r\n let sum = 0;\r\n for (const value of source) {\r\n sum += await selector(value);\r\n }\r\n return sum;\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const take = (source, amount) => {\r\n function* iterator() {\r\n let amountLeft = amount > 0 ? amount : 0;\r\n for (const item of source) {\r\n if (amountLeft-- === 0) {\r\n break;\r\n }\r\n else {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const takeWhile = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return takeWhile1(source, predicate);\r\n }\r\n else {\r\n return takeWhile2(source, predicate);\r\n }\r\n};\r\nconst takeWhile1 = (source, predicate) => {\r\n function* iterator() {\r\n for (const item of source) {\r\n if (predicate(item)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst takeWhile2 = (source, predicate) => {\r\n function* iterator() {\r\n let index = 0;\r\n for (const item of source) {\r\n if (predicate(item, index++)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const takeWhileAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return takeWhileAsync1(source, predicate);\r\n }\r\n else {\r\n return takeWhileAsync2(source, predicate);\r\n }\r\n};\r\nconst takeWhileAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n for (const item of source) {\r\n if (await predicate(item)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst takeWhileAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for (const item of source) {\r\n if (await predicate(item, index++)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","export const toArray = (source) => {\r\n return [...source];\r\n};\r\n","export const toMap = (source, selector) => {\r\n const map = new Map();\r\n for (const value of source) {\r\n const key = selector(value);\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","export const toMapAsync = async (source, selector) => {\r\n const map = new Map();\r\n for (const value of source) {\r\n const key = await selector(value);\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","export const toObject = (source, selector) => {\r\n const map = {};\r\n for (const value of source) {\r\n map[selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","export const toObjectAsync = async (source, selector) => {\r\n const map = {};\r\n for (const value of source) {\r\n map[await selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","export const toSet = (source) => {\r\n return new Set(source);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const union = (first, second, comparer) => {\r\n if (comparer) {\r\n return union2(first, second, comparer);\r\n }\r\n else {\r\n return union1(first, second);\r\n }\r\n};\r\nconst union1 = (first, second) => {\r\n function* iterator() {\r\n const set = new Set();\r\n for (const item of first) {\r\n if (set.has(item) === false) {\r\n yield item;\r\n set.add(item);\r\n }\r\n }\r\n for (const item of second) {\r\n if (set.has(item) === false) {\r\n yield item;\r\n set.add(item);\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst union2 = (first, second, comparer) => {\r\n function* iterator() {\r\n const result = [];\r\n for (const source of [first, second]) {\r\n for (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield value;\r\n result.push(value);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const unionAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const result = [];\r\n for (const source of [first, second]) {\r\n for (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (await comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield value;\r\n result.push(value);\r\n }\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const where = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return where1(source, predicate);\r\n }\r\n else {\r\n return where2(source, predicate);\r\n }\r\n};\r\nconst where1 = (source, predicate) => {\r\n function* iterator() {\r\n for (const item of source) {\r\n if (predicate(item) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst where2 = (source, predicate) => {\r\n function* iterator() {\r\n let i = 0;\r\n for (const item of source) {\r\n if (predicate(item, i++) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const whereAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return whereAsync1(source, predicate);\r\n }\r\n else {\r\n return whereAsync2(source, predicate);\r\n }\r\n};\r\nconst whereAsync1 = (source, predicate) => {\r\n async function* generator() {\r\n for (const item of source) {\r\n if (await predicate(item) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\nconst whereAsync2 = (source, predicate) => {\r\n async function* generator() {\r\n let i = 0;\r\n for (const item of source) {\r\n if (await predicate(item, i++) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const zip = (source, second, resultSelector) => {\r\n if (resultSelector) {\r\n return zip2(source, second, resultSelector);\r\n }\r\n else {\r\n return zip1(source, second);\r\n }\r\n};\r\nconst zip1 = (source, second) => {\r\n function* iterator() {\r\n const firstIterator = source[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n while (true) {\r\n const a = firstIterator.next();\r\n const b = secondIterator.next();\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield [a.value, b.value];\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst zip2 = (source, second, resultSelector) => {\r\n function* iterator() {\r\n const firstIterator = source[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n while (true) {\r\n const a = firstIterator.next();\r\n const b = secondIterator.next();\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield resultSelector(a.value, b.value);\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const zipAsync = (first, second, resultSelector) => {\r\n async function* generator() {\r\n const firstIterator = first[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n while (true) {\r\n const a = firstIterator.next();\r\n const b = secondIterator.next();\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield resultSelector(a.value, b.value);\r\n }\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { aggregate } from \"./../sync/_private/aggregate.js\";\r\nimport { all } from \"./../sync/_private/all.js\";\r\nimport { allAsync } from \"./../sync/_private/allAsync.js\";\r\nimport { any } from \"./../sync/_private/any.js\";\r\nimport { anyAsync } from \"./../sync/_private/anyAsync.js\";\r\nimport { asAsync } from \"./../sync/_private/asAsync.js\";\r\nimport { asParallel } from \"./../sync/_private/asParallel.js\";\r\nimport { average } from \"./../sync/_private/average.js\";\r\nimport { averageAsync } from \"./../sync/_private/averageAsync.js\";\r\nimport { chunk } from \"./../sync/_private/chunk.js\";\r\nimport { concatenate } from \"../sync/_private/concatenate.js\";\r\nimport { contains } from \"./../sync/_private/contains.js\";\r\nimport { containsAsync } from \"./../sync/_private/containsAsync.js\";\r\nimport { count } from \"./../sync/_private/count.js\";\r\nimport { countAsync } from \"./../sync/_private/countAsync.js\";\r\nimport { defaultIfEmpty } from \"../sync/_private/defaultIfEmpty.js\";\r\nimport { distinct } from \"./../sync/_private/distinct.js\";\r\nimport { distinctAsync } from \"./../sync/_private/distinctAsync.js\";\r\nimport { each } from \"./../sync/_private/each.js\";\r\nimport { eachAsync } from \"./../sync/_private/eachAsync.js\";\r\nimport { elementAt } from \"./../sync/_private/elementAt.js\";\r\nimport { elementAtOrDefault } from \"./../sync/_private/elementAtOrDefault.js\";\r\nimport { except } from \"./../sync/_private/except.js\";\r\nimport { exceptAsync } from \"./../sync/_private/exceptAsync.js\";\r\nimport { first } from \"./../sync/_private/first.js\";\r\nimport { firstAsync } from \"./../sync/_private/firstAsync.js\";\r\nimport { firstOrDefault } from \"./../sync/_private/firstOrDefault.js\";\r\nimport { firstOrDefaultAsync } from \"./../sync/_private/firstOrDefaultAsync.js\";\r\nimport { groupBy } from \"./../sync/_private/groupBy.js\";\r\nimport { groupByAsync } from \"./../sync/_private/groupByAsync.js\";\r\nimport { groupByWithSel } from \"./../sync/_private/groupByWithSel.js\";\r\nimport { groupJoin } from \"../sync/_private/groupJoin.js\";\r\nimport { groupJoinAsync } from \"../sync/_private/groupJoinAsync.js\";\r\nimport { intersect } from \"./../sync/_private/intersect.js\";\r\nimport { intersectAsync } from \"./../sync/_private/intersectAsync.js\";\r\nimport { join } from \"./../sync/_private/join.js\";\r\nimport { last } from \"./../sync/_private/last.js\";\r\nimport { lastAsync } from \"./../sync/_private/lastAsync.js\";\r\nimport { lastOrDefault } from \"./../sync/_private/lastOrDefault.js\";\r\nimport { lastOrDefaultAsync } from \"./../sync/_private/lastOrDefaultAsync.js\";\r\nimport { max } from \"./../sync/_private/max.js\";\r\nimport { maxAsync } from \"./../sync/_private/maxAsync.js\";\r\nimport { min } from \"./../sync/_private/min.js\";\r\nimport { minAsync } from \"./../sync/_private/minAsync.js\";\r\nimport { ofType } from \"./../sync/_private/ofType.js\";\r\nimport { orderBy } from \"./../sync/_private/orderBy.js\";\r\nimport { orderByAsync } from \"./../sync/_private/orderByAsync.js\";\r\nimport { orderByDescending } from \"./../sync/_private/orderByDescending.js\";\r\nimport { orderByDescendingAsync } from \"./../sync/_private/orderByDescendingAsync.js\";\r\nimport { partition } from \"./../sync/_private/partition.js\";\r\nimport { partitionAsync } from \"./../sync/_private/partitionAsync.js\";\r\nimport { reverse } from \"./../sync/_private/reverse.js\";\r\nimport { select } from \"./../sync/_private/select.js\";\r\nimport { selectAsync } from \"./../sync/_private/selectAsync.js\";\r\nimport { selectMany } from \"./../sync/_private/selectMany.js\";\r\nimport { selectManyAsync } from \"./../sync/_private/selectManyAsync.js\";\r\nimport { sequenceEquals } from \"./../sync/_private/sequenceEquals.js\";\r\nimport { sequenceEqualsAsync } from \"./../sync/_private/sequenceEqualsAsync.js\";\r\nimport { single } from \"./../sync/_private/single.js\";\r\nimport { singleAsync } from \"./../sync/_private/singleAsync.js\";\r\nimport { singleOrDefault } from \"./../sync/_private/singleOrDefault.js\";\r\nimport { singleOrDefaultAsync } from \"./../sync/_private/singleOrDefaultAsync.js\";\r\nimport { skip } from \"./../sync/_private/skip.js\";\r\nimport { skipWhile } from \"./../sync/_private/skipWhile.js\";\r\nimport { skipWhileAsync } from \"./../sync/_private/skipWhileAsync.js\";\r\nimport { sum } from \"./../sync/_private/sum.js\";\r\nimport { sumAsync } from \"./../sync/_private/sumAsync.js\";\r\nimport { take } from \"./../sync/_private/take.js\";\r\nimport { takeWhile } from \"./../sync/_private/takeWhile.js\";\r\nimport { takeWhileAsync } from \"./../sync/_private/takeWhileAsync.js\";\r\nimport { toArray } from \"./../sync/_private/toArray.js\";\r\nimport { toMap } from \"./../sync/_private/toMap.js\";\r\nimport { toMapAsync } from \"./../sync/_private/toMapAsync.js\";\r\nimport { toObject } from \"./../sync/_private/toObject.js\";\r\nimport { toObjectAsync } from \"./../sync/_private/toObjectAsync.js\";\r\nimport { toSet } from \"./../sync/_private/toSet.js\";\r\nimport { union } from \"./../sync/_private/union.js\";\r\nimport { unionAsync } from \"./../sync/_private/unionAsync.js\";\r\nimport { where } from \"./../sync/_private/where.js\";\r\nimport { whereAsync } from \"./../sync/_private/whereAsync.js\";\r\nimport { zip } from \"./../sync/_private/zip.js\";\r\nimport { zipAsync } from \"./../sync/_private/zipAsync.js\";\r\nexport const bindLinq = (object) => {\r\n const prototype = object.prototype;\r\n const bind = (func, key) => {\r\n const wrapped = function (...params) {\r\n return func(this, ...params);\r\n };\r\n Object.defineProperty(wrapped, \"length\", { value: func.length - 1 });\r\n prototype[key] = wrapped;\r\n };\r\n bind(aggregate, \"aggregate\");\r\n bind(all, \"all\");\r\n bind(allAsync, \"allAsync\");\r\n bind(any, \"any\");\r\n bind(anyAsync, \"anyAsync\");\r\n bind(asAsync, \"asAsync\");\r\n bind(asParallel, \"asParallel\");\r\n bind(average, \"average\");\r\n bind(averageAsync, \"averageAsync\");\r\n bind(chunk, \"chunk\");\r\n bind(concatenate, \"concatenate\");\r\n bind(contains, \"contains\");\r\n bind(containsAsync, \"containsAsync\");\r\n bind(count, \"count\");\r\n bind(countAsync, \"countAsync\");\r\n bind(defaultIfEmpty, \"defaultIfEmpty\");\r\n bind(distinct, \"distinct\");\r\n bind(distinctAsync, \"distinctAsync\");\r\n bind(each, \"each\");\r\n bind(eachAsync, \"eachAsync\");\r\n bind(elementAt, \"elementAt\");\r\n bind(elementAtOrDefault, \"elementAtOrDefault\");\r\n bind(except, \"except\");\r\n bind(exceptAsync, \"exceptAsync\");\r\n bind(first, \"first\");\r\n bind(firstAsync, \"firstAsync\");\r\n bind(firstOrDefault, \"firstOrDefault\");\r\n bind(firstOrDefaultAsync, \"firstOrDefaultAsync\");\r\n bind(groupBy, \"groupBy\");\r\n bind(groupByAsync, \"groupByAsync\");\r\n bind(groupByWithSel, \"groupByWithSel\");\r\n bind(groupJoin, \"groupJoin\");\r\n bind(groupJoinAsync, \"groupJoinAsync\");\r\n bind(intersect, \"intersect\");\r\n bind(intersectAsync, \"intersectAsync\");\r\n bind(join, \"joinByKey\");\r\n bind(last, \"last\");\r\n bind(lastAsync, \"lastAsync\");\r\n bind(lastOrDefault, \"lastOrDefault\");\r\n bind(lastOrDefaultAsync, \"lastOrDefaultAsync\");\r\n bind(max, \"max\");\r\n bind(maxAsync, \"maxAsync\");\r\n bind(min, \"min\");\r\n bind(minAsync, \"minAsync\");\r\n bind(ofType, \"ofType\");\r\n bind(orderBy, \"orderBy\");\r\n bind(orderByAsync, \"orderByAsync\");\r\n bind(orderByDescending, \"orderByDescending\");\r\n bind(orderByDescendingAsync, \"orderByDescendingAsync\");\r\n bind(reverse, \"reverse\");\r\n bind(select, \"select\");\r\n bind(selectAsync, \"selectAsync\");\r\n bind(selectMany, \"selectMany\");\r\n bind(selectManyAsync, \"selectManyAsync\");\r\n bind(sequenceEquals, \"sequenceEquals\");\r\n bind(sequenceEqualsAsync, \"sequenceEqualsAsync\");\r\n bind(single, \"single\");\r\n bind(singleAsync, \"singleAsync\");\r\n bind(singleOrDefault, \"singleOrDefault\");\r\n bind(singleOrDefaultAsync, \"singleOrDefaultAsync\");\r\n bind(skip, \"skip\");\r\n bind(skipWhile, \"skipWhile\");\r\n bind(skipWhileAsync, \"skipWhileAsync\");\r\n bind(sum, \"sum\");\r\n bind(sumAsync, \"sumAsync\");\r\n bind(take, \"take\");\r\n bind(takeWhile, \"takeWhile\");\r\n bind(takeWhileAsync, \"takeWhileAsync\");\r\n bind(toArray, \"toArray\");\r\n bind(toMap, \"toMap\");\r\n bind(toMapAsync, \"toMapAsync\");\r\n bind(toObject, \"toObject\");\r\n bind(toObjectAsync, \"toObjectAsync\");\r\n bind(partition, \"partition\");\r\n bind(partitionAsync, \"partitionAsync\");\r\n bind(toSet, \"toSet\");\r\n bind(union, \"union\");\r\n bind(unionAsync, \"unionAsync\");\r\n bind(where, \"where\");\r\n bind(whereAsync, \"whereAsync\");\r\n bind(zip, \"zip\");\r\n bind(zipAsync, \"zipAsync\");\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const aggregate = (source, seedOrFunc, func, resultSelector) => {\r\n if (resultSelector) {\r\n if (!func) {\r\n throw new ReferenceError(\"TAccumulate function is undefined\");\r\n }\r\n return aggregate3(source, seedOrFunc, func, resultSelector);\r\n }\r\n else if (func) {\r\n return aggregate2(source, seedOrFunc, func);\r\n }\r\n else {\r\n return aggregate1(source, seedOrFunc);\r\n }\r\n};\r\nconst aggregate1 = async (source, func) => {\r\n let aggregateValue;\r\n for await (const value of source) {\r\n if (aggregateValue) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n else {\r\n aggregateValue = value;\r\n }\r\n }\r\n if (aggregateValue === undefined) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate2 = async (source, seed, func) => {\r\n let aggregateValue = seed;\r\n for await (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate3 = async (source, seed, func, resultSelector) => {\r\n let aggregateValue = seed;\r\n for await (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return resultSelector(aggregateValue);\r\n};\r\n","export const all = async (source, predicate) => {\r\n for await (const item of source) {\r\n if (predicate(item) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const allAsync = async (source, predicate) => {\r\n for await (const item of source) {\r\n if (await predicate(item) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const any = (source, predicate) => {\r\n if (predicate) {\r\n return any2(source, predicate);\r\n }\r\n else {\r\n return any1(source);\r\n }\r\n};\r\nconst any1 = async (source) => {\r\n for await (const _ of source) {\r\n return true;\r\n }\r\n return false;\r\n};\r\nconst any2 = async (source, predicate) => {\r\n for await (const item of source) {\r\n if (predicate(item) === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const anyAsync = async (source, predicate) => {\r\n for await (const item of source) {\r\n if (await predicate(item) === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","import { fromParallel } from \"../../parallel/static/fromParallel.js\";\r\nexport const asParallel = (source) => {\r\n const generator = async () => {\r\n const data = [];\r\n for await (const value of source) {\r\n data.push(value);\r\n }\r\n return data;\r\n };\r\n return fromParallel(0, generator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const average = async (source, selector) => {\r\n let value = 0;\r\n let count = 0;\r\n if (selector) {\r\n for await (const item of source) {\r\n value = value + selector(item);\r\n count = count + 1;\r\n }\r\n }\r\n else {\r\n for await (const item of source) {\r\n value = value + item;\r\n count = count + 1;\r\n }\r\n }\r\n if (count === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return value / count;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const averageAsync = async (source, selector) => {\r\n let value = 0;\r\n let count = 0;\r\n for await (const item of source) {\r\n value = value + await selector(item);\r\n count = count + 1;\r\n }\r\n if (count === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return value / count;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nimport { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const chunk = (source, size) => {\r\n if (size < 1) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n async function* iterator() {\r\n let yieldChunk = [];\r\n for await (const value of source) {\r\n yieldChunk.push(value);\r\n if (yieldChunk.length === size) {\r\n yield yieldChunk;\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n yield yieldChunk;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const concatenate = (first, second) => {\r\n async function* iterator() {\r\n yield* first;\r\n yield* second;\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const contains = async (source, value, comparer = StrictEqualityComparer) => {\r\n for await (const item of source) {\r\n if (comparer(value, item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const containsAsync = async (source, value, comparer) => {\r\n for await (const item of source) {\r\n if (await comparer(value, item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const count = (source, predicate) => {\r\n if (predicate) {\r\n return count2(source, predicate);\r\n }\r\n else {\r\n return count1(source);\r\n }\r\n};\r\nconst count1 = async (source) => {\r\n let total = 0;\r\n for await (const _ of source) {\r\n total++;\r\n }\r\n return total;\r\n};\r\nconst count2 = async (source, predicate) => {\r\n let total = 0;\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n total++;\r\n }\r\n }\r\n return total;\r\n};\r\n","export const countAsync = async (source, predicate) => {\r\n let count = 0;\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const defaultIfEmpty = (source, defaultValue) => {\r\n async function* generator() {\r\n let found = false;\r\n for await (const value of source) {\r\n found = true;\r\n yield value;\r\n }\r\n if (!found) {\r\n yield defaultValue;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const distinct = (source, comparer = StrictEqualityComparer) => {\r\n async function* iterator() {\r\n const distinctElements = [];\r\n for await (const item of source) {\r\n const foundItem = distinctElements.find((x) => comparer(x, item));\r\n if (!foundItem) {\r\n distinctElements.push(item);\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const distinctAsync = (source, comparer) => {\r\n async function* iterator() {\r\n const distinctElements = [];\r\n outerLoop: for await (const item of source) {\r\n for (const distinctElement of distinctElements) {\r\n const found = await comparer(distinctElement, item);\r\n if (found) {\r\n continue outerLoop;\r\n }\r\n }\r\n distinctElements.push(item);\r\n yield item;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const each = (source, action) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n action(value);\r\n yield value;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const eachAsync = (source, action) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n await action(value);\r\n yield value;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const elementAt = async (source, index) => {\r\n if (index < 0) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n let i = 0;\r\n for await (const item of source) {\r\n if (index === i++) {\r\n return item;\r\n }\r\n }\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n};\r\n","export const elementAtOrDefault = async (source, index) => {\r\n let i = 0;\r\n for await (const item of source) {\r\n if (index === i++) {\r\n return item;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const except = (first, second, comparer = StrictEqualityComparer) => {\r\n async function* iterator() {\r\n const secondArray = [];\r\n for await (const x of second) {\r\n secondArray.push(x);\r\n }\r\n for await (const firstItem of first) {\r\n let exists = false;\r\n for (let j = 0; j < secondArray.length; j++) {\r\n const secondItem = secondArray[j];\r\n if (comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield firstItem;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const exceptAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const secondArray = [];\r\n for await (const x of second) {\r\n secondArray.push(x);\r\n }\r\n for await (const firstItem of first) {\r\n let exists = false;\r\n for (let j = 0; j < secondArray.length; j++) {\r\n const secondItem = secondArray[j];\r\n if (await comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield firstItem;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const first = (source, predicate) => {\r\n if (predicate) {\r\n return first2(source, predicate);\r\n }\r\n else {\r\n return first1(source);\r\n }\r\n};\r\nconst first1 = async (source) => {\r\n const firstElement = await source[Symbol.asyncIterator]().next();\r\n if (firstElement.done === true) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return firstElement.value;\r\n};\r\nconst first2 = async (source, predicate) => {\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const firstAsync = async (source, predicate) => {\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","export const firstOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return firstOrDefault2(source, predicate);\r\n }\r\n else {\r\n return firstOrDefault1(source);\r\n }\r\n};\r\nconst firstOrDefault1 = async (source) => {\r\n const first = await source[Symbol.asyncIterator]().next();\r\n return first.value || null;\r\n};\r\nconst firstOrDefault2 = async (source, predicate) => {\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","export const firstOrDefaultAsync = async (source, predicate) => {\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupBy = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupBy_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupBy_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupBy_0 = (source, keySelector, comparer) => {\r\n async function* generate() {\r\n const keyMap = new Array();\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n for (const g of keyMap) {\r\n yield g;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generate);\r\n};\r\nconst groupBy_0_Simple = (source, keySelector) => {\r\n async function* iterator() {\r\n const keyMap = {};\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupByAsync = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupByAsync_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupByAsync_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupByAsync_0_Simple = (source, keySelector) => {\r\n async function* iterator() {\r\n const keyMap = {};\r\n for await (const value of source) {\r\n const key = await keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst groupByAsync_0 = (source, keySelector, comparer) => {\r\n async function* generate() {\r\n const keyMap = new Array();\r\n for await (const value of source) {\r\n const key = await keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (await comparer(group.key, key) === true) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n for (const keyValue of keyMap) {\r\n yield keyValue;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generate);\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupByWithSel = (source, keySelector, elementSelector, comparer) => {\r\n if (comparer) {\r\n return groupBy1(source, keySelector, elementSelector, comparer);\r\n }\r\n else {\r\n return groupBy1Simple(source, keySelector, elementSelector);\r\n }\r\n};\r\nconst groupBy1Simple = (source, keySelector, elementSelector) => {\r\n async function* generate() {\r\n const keyMap = {};\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n const element = elementSelector(value);\r\n if (grouping) {\r\n grouping.push(element);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, element);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generate);\r\n};\r\nconst groupBy1 = (source, keySelector, elementSelector, comparer) => {\r\n async function* generate() {\r\n const keyMap = new Array();\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(elementSelector(value));\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n const element = elementSelector(value);\r\n keyMap.push(new Grouping(key, element));\r\n }\r\n }\r\n for (const value of keyMap) {\r\n yield value;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generate);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupJoin = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicAsyncEnumerable(generator);\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = [];\r\n for await (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n for await (const outerValue of outer) {\r\n const key = outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n yield resultSelector(outerValue, innerRecord.values);\r\n }\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = new Map();\r\n for await (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n for await (const outerValue of outer) {\r\n const key = outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n yield resultSelector(outerValue, values);\r\n }\r\n };\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupJoinAsync = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicAsyncEnumerable(generator);\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = [];\r\n for await (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n for await (const outerValue of outer) {\r\n const key = await outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n yield resultSelector(outerValue, innerRecord.values);\r\n }\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = new Map();\r\n for await (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n for await (const outerValue of outer) {\r\n const key = await outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n yield resultSelector(outerValue, values);\r\n }\r\n };\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const intersect = (first, second, comparer = StrictEqualityComparer) => {\r\n async function* iterator() {\r\n const firstResults = await first.distinct(comparer).toArray();\r\n if (firstResults.length === 0) {\r\n return;\r\n }\r\n const secondResults = await second.toArray();\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (comparer(firstValue, secondValue) === true) {\r\n yield firstValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const intersectAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const firstResults = await first.distinctAsync(comparer).toArray();\r\n if (firstResults.length === 0) {\r\n return;\r\n }\r\n const secondResults = await second.toArray();\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (await comparer(firstValue, secondValue) === true) {\r\n yield firstValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const join = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer = StrictEqualityComparer) => {\r\n async function* iterator() {\r\n const innerArray = [];\r\n for await (const i of inner) {\r\n innerArray.push(i);\r\n }\r\n for await (const o of outer) {\r\n const outerKey = outerKeySelector(o);\r\n for (const i of innerArray) {\r\n const innerKey = innerKeySelector(i);\r\n if (comparer(outerKey, innerKey) === true) {\r\n yield resultSelector(o, i);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const last = (source, predicate) => {\r\n if (predicate) {\r\n return last2(source, predicate);\r\n }\r\n else {\r\n return last1(source);\r\n }\r\n};\r\nconst last1 = async (source) => {\r\n let lastItem = null;\r\n for await (const value of source) {\r\n lastItem = value;\r\n }\r\n if (!lastItem) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return lastItem;\r\n};\r\nconst last2 = async (source, predicate) => {\r\n let lastItem = null;\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n lastItem = value;\r\n }\r\n }\r\n if (!lastItem) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return lastItem;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const lastAsync = async (source, predicate) => {\r\n let last = null;\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n if (!last) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return last;\r\n};\r\n","export const lastOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return lastOrDefault2(source, predicate);\r\n }\r\n else {\r\n return lastOrDefault1(source);\r\n }\r\n};\r\nconst lastOrDefault1 = async (source) => {\r\n let last = null;\r\n for await (const value of source) {\r\n last = value;\r\n }\r\n return last;\r\n};\r\nconst lastOrDefault2 = async (source, predicate) => {\r\n let last = null;\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n return last;\r\n};\r\n","export const lastOrDefaultAsync = async (source, predicate) => {\r\n let last = null;\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n return last;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const max = (source, selector) => {\r\n if (selector) {\r\n return max2(source, selector);\r\n }\r\n else {\r\n return max1(source);\r\n }\r\n};\r\nconst max1 = async (source) => {\r\n let maxItem = null;\r\n for await (const item of source) {\r\n maxItem = Math.max(maxItem || Number.NEGATIVE_INFINITY, item);\r\n }\r\n if (maxItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return maxItem;\r\n }\r\n};\r\nconst max2 = async (source, selector) => {\r\n let maxItem = null;\r\n for await (const item of source) {\r\n maxItem = Math.max(maxItem || Number.NEGATIVE_INFINITY, selector(item));\r\n }\r\n if (maxItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return maxItem;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const maxAsync = async (source, selector) => {\r\n let max = null;\r\n for await (const item of source) {\r\n max = Math.max(max || Number.NEGATIVE_INFINITY, await selector(item));\r\n }\r\n if (max === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return max;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const min = (source, selector) => {\r\n if (selector) {\r\n return min2(source, selector);\r\n }\r\n else {\r\n return min1(source);\r\n }\r\n};\r\nconst min1 = async (source) => {\r\n let minValue = null;\r\n for await (const item of source) {\r\n minValue = Math.min(minValue || Number.POSITIVE_INFINITY, item);\r\n }\r\n if (minValue === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return minValue;\r\n }\r\n};\r\nconst min2 = async (source, selector) => {\r\n let minValue = null;\r\n for await (const item of source) {\r\n minValue = Math.min(minValue || Number.POSITIVE_INFINITY, selector(item));\r\n }\r\n if (minValue === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return minValue;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const minAsync = async (source, selector) => {\r\n let min = null;\r\n for await (const item of source) {\r\n min = Math.min(min || Number.POSITIVE_INFINITY, await selector(item));\r\n }\r\n if (min === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return min;\r\n }\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const ofType = (source, type) => {\r\n const typeCheck = typeof type === \"string\" ?\r\n ((x) => typeof x === type) :\r\n ((x) => x instanceof type);\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (typeCheck(item)) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../OrderedAsyncEnumerable.js\";\r\nexport const orderBy = (source, keySelector, comparer) => {\r\n return OrderedAsyncEnumerable.generate(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../OrderedAsyncEnumerable.js\";\r\nexport const orderByAsync = (source, keySelector, comparer) => {\r\n return OrderedAsyncEnumerable.generateAsync(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../OrderedAsyncEnumerable.js\";\r\nexport const orderByDescending = (source, keySelector, comparer) => {\r\n return OrderedAsyncEnumerable.generate(source, keySelector, false, comparer);\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../OrderedAsyncEnumerable.js\";\r\nexport const orderByDescendingAsync = (source, keySelector, comparer) => {\r\n return OrderedAsyncEnumerable.generateAsync(source, keySelector, false, comparer);\r\n};\r\n","export const partition = async (source, predicate) => {\r\n const fail = [];\r\n const pass = [];\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","export const partitionAsync = async (source, predicate) => {\r\n const fail = [];\r\n const pass = [];\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const reverse = (source) => {\r\n async function* iterator() {\r\n const values = [];\r\n for await (const value of source) {\r\n values.push(value);\r\n }\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n yield values[i];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const select = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n return select1(source, selector);\r\n }\r\n else {\r\n return select2(source, selector);\r\n }\r\n }\r\n else {\r\n return select3(source, selector);\r\n }\r\n};\r\nconst select1 = (source, selector) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n yield selector(value);\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst select2 = (source, selector) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for await (const value of source) {\r\n yield selector(value, index);\r\n index++;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst select3 = (source, key) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n yield value[key];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const selectAsync = (source, selector) => {\r\n if (typeof selector === \"string\") {\r\n return selectAsync2(source, selector);\r\n }\r\n else {\r\n return selectAsync1(source, selector);\r\n }\r\n};\r\nconst selectAsync1 = (source, selector) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n yield selector(value);\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst selectAsync2 = (source, key) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n yield value[key];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const selectMany = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n return selectMany1(source, selector);\r\n }\r\n else {\r\n return selectMany2(source, selector);\r\n }\r\n }\r\n else {\r\n return selectMany3(source, selector);\r\n }\r\n};\r\nconst selectMany1 = (source, selector) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n for (const selectorValue of selector(value)) {\r\n yield selectorValue;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst selectMany2 = (source, selector) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for await (const value of source) {\r\n for (const selectorValue of selector(value, index)) {\r\n yield selectorValue;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst selectMany3 = (source, selector) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n for (const selectorValue of value[selector]) {\r\n yield selectorValue;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const selectManyAsync = (source, selector) => {\r\n if (selector.length === 1) {\r\n const iterator = async function* () {\r\n for await (const value of source) {\r\n const many = await selector(value);\r\n for (const innerValue of many) {\r\n yield innerValue;\r\n }\r\n }\r\n };\r\n return new BasicAsyncEnumerable(iterator);\r\n }\r\n else {\r\n const iterator = async function* () {\r\n let index = 0;\r\n for await (const value of source) {\r\n const many = await selector(value, index);\r\n for (const innerValue of many) {\r\n yield innerValue;\r\n }\r\n index++;\r\n }\r\n };\r\n return new BasicAsyncEnumerable(iterator);\r\n }\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const sequenceEquals = async (first, second, comparer = StrictEqualityComparer) => {\r\n const firstIterator = first[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n let results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n let firstResult = results[0];\r\n let secondResult = results[1];\r\n while (!firstResult.done && !secondResult.done) {\r\n if (!comparer(firstResult.value, secondResult.value)) {\r\n return false;\r\n }\r\n results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n firstResult = results[0];\r\n secondResult = results[1];\r\n }\r\n return firstResult.done === true && secondResult.done === true;\r\n};\r\n","export const sequenceEqualsAsync = async (first, second, comparer) => {\r\n const firstIterator = first[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n let results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n let firstResult = results[0];\r\n let secondResult = results[1];\r\n while (!firstResult.done && !secondResult.done) {\r\n if (await comparer(firstResult.value, secondResult.value) === false) {\r\n return false;\r\n }\r\n results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n firstResult = results[0];\r\n secondResult = results[1];\r\n }\r\n return firstResult.done === true && secondResult.done === true;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const single = (source, predicate) => {\r\n if (predicate) {\r\n return single2(source, predicate);\r\n }\r\n else {\r\n return single1(source);\r\n }\r\n};\r\nconst single1 = async (source) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return singleValue;\r\n};\r\nconst single2 = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleAsync = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (await predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return singleOrDefault2(source, predicate);\r\n }\r\n else {\r\n return singleOrDefault1(source);\r\n }\r\n};\r\nconst singleOrDefault1 = async (source) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n return singleValue;\r\n};\r\nconst singleOrDefault2 = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleOrDefaultAsync = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (await predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const skip = (source, count) => {\r\n async function* iterator() {\r\n let i = 0;\r\n for await (const item of source) {\r\n if (i++ >= count) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const skipWhile = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return skipWhile1(source, predicate);\r\n }\r\n else {\r\n return skipWhile2(source, predicate);\r\n }\r\n};\r\nconst skipWhile1 = (source, predicate) => {\r\n async function* iterator() {\r\n let skip = true;\r\n for await (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (predicate(item) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst skipWhile2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n let skip = true;\r\n for await (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (predicate(item, index) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const skipWhileAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return skipWhileAsync1(source, predicate);\r\n }\r\n else {\r\n return skipWhileAsync2(source, predicate);\r\n }\r\n};\r\nconst skipWhileAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n let skip = true;\r\n for await (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (await predicate(item) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst skipWhileAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n let skip = true;\r\n for await (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (await predicate(item, index) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","export const sum = (source, selector) => {\r\n if (selector) {\r\n return sum2(source, selector);\r\n }\r\n else {\r\n return sum1(source);\r\n }\r\n};\r\nconst sum1 = async (source) => {\r\n let total = 0;\r\n for await (const value of source) {\r\n total += value;\r\n }\r\n return total;\r\n};\r\nconst sum2 = async (source, selector) => {\r\n let total = 0;\r\n for await (const value of source) {\r\n total += selector(value);\r\n }\r\n return total;\r\n};\r\n","export const sumAsync = async (source, selector) => {\r\n let sum = 0;\r\n for await (const value of source) {\r\n sum += await selector(value);\r\n }\r\n return sum;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const take = (source, amount) => {\r\n async function* iterator() {\r\n let amountLeft = amount > 0 ? amount : 0;\r\n for await (const item of source) {\r\n if (amountLeft-- === 0) {\r\n break;\r\n }\r\n else {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const takeWhile = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return takeWhile1(source, predicate);\r\n }\r\n else {\r\n return takeWhile2(source, predicate);\r\n }\r\n};\r\nconst takeWhile1 = (source, predicate) => {\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (predicate(item)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst takeWhile2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for await (const item of source) {\r\n if (predicate(item, index++)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const takeWhileAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return takeWhileAsync1(source, predicate);\r\n }\r\n else {\r\n return takeWhileAsync2(source, predicate);\r\n }\r\n};\r\nconst takeWhileAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (await predicate(item)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst takeWhileAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for await (const item of source) {\r\n if (await predicate(item, index++)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","export const toArray = async (source) => {\r\n const array = [];\r\n for await (const item of source) {\r\n array.push(item);\r\n }\r\n return array;\r\n};\r\n","export const toMap = async (source, selector) => {\r\n const map = new Map();\r\n for await (const value of source) {\r\n const key = selector(value);\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","export const toMapAsync = async (source, selector) => {\r\n const map = new Map();\r\n for await (const value of source) {\r\n const key = await selector(value);\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","export const toObject = async (source, selector) => {\r\n const map = {};\r\n for await (const value of source) {\r\n map[selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","export const toObjectAsync = async (source, selector) => {\r\n const map = {};\r\n for await (const value of source) {\r\n map[await selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","export const toSet = async (source) => {\r\n const set = new Set();\r\n for await (const item of source) {\r\n set.add(item);\r\n }\r\n return set;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const union = (first, second, comparer) => {\r\n if (comparer) {\r\n return union2(first, second, comparer);\r\n }\r\n else {\r\n return union1(first, second);\r\n }\r\n};\r\nconst union1 = (first, second) => {\r\n async function* iterator() {\r\n const set = new Set();\r\n for await (const item of first) {\r\n if (set.has(item) === false) {\r\n yield item;\r\n set.add(item);\r\n }\r\n }\r\n for await (const item of second) {\r\n if (set.has(item) === false) {\r\n yield item;\r\n set.add(item);\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst union2 = (first, second, comparer) => {\r\n async function* iterator() {\r\n const result = [];\r\n for (const source of [first, second]) {\r\n for await (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield value;\r\n result.push(value);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const unionAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const result = [];\r\n for (const source of [first, second]) {\r\n for await (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (await comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield value;\r\n result.push(value);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const where = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return where1(source, predicate);\r\n }\r\n else {\r\n return where2(source, predicate);\r\n }\r\n};\r\nconst where1 = (source, predicate) => {\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (predicate(item) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst where2 = (source, predicate) => {\r\n async function* iterator() {\r\n let i = 0;\r\n for await (const item of source) {\r\n if (predicate(item, i++) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const whereAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return whereAsync1(source, predicate);\r\n }\r\n else {\r\n return whereAsync2(source, predicate);\r\n }\r\n};\r\nconst whereAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (await predicate(item) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst whereAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let i = 0;\r\n for await (const item of source) {\r\n if (await predicate(item, i++) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const zip = (first, second, resultSelector) => {\r\n if (resultSelector) {\r\n return zip2(first, second, resultSelector);\r\n }\r\n else {\r\n return zip1(first, second);\r\n }\r\n};\r\nconst zip1 = (source, second) => {\r\n async function* iterator() {\r\n const firstIterator = source[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n while (true) {\r\n const [a, b] = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield [a.value, b.value];\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst zip2 = (source, second, resultSelector) => {\r\n async function* iterator() {\r\n const firstIterator = source[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n while (true) {\r\n const [a, b] = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield resultSelector(a.value, b.value);\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const zipAsync = (first, second, resultSelector) => {\r\n async function* generator() {\r\n const firstIterator = first[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n while (true) {\r\n const results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n const firstNext = results[0];\r\n const secondNext = results[1];\r\n if (firstNext.done || secondNext.done) {\r\n break;\r\n }\r\n else {\r\n yield resultSelector(firstNext.value, secondNext.value);\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const aggregate = (source, seedOrFunc, func, resultSelector) => {\r\n if (resultSelector) {\r\n if (!func) {\r\n throw new ReferenceError(\"TAccumulate function is undefined\");\r\n }\r\n return aggregate3(source, seedOrFunc, func, resultSelector);\r\n }\r\n else if (func) {\r\n return aggregate2(source, seedOrFunc, func);\r\n }\r\n else {\r\n return aggregate1(source, seedOrFunc);\r\n }\r\n};\r\nconst aggregate1 = async (source, func) => {\r\n let aggregateValue;\r\n for await (const value of source) {\r\n if (aggregateValue) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n else {\r\n aggregateValue = value;\r\n }\r\n }\r\n if (aggregateValue === undefined) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate2 = async (source, seed, func) => {\r\n let aggregateValue = seed;\r\n for await (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate3 = async (source, seed, func, resultSelector) => {\r\n let aggregateValue = seed;\r\n for await (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return resultSelector(aggregateValue);\r\n};\r\n","export const nextIteration = (source, onfulfilled) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = () => dataFunc.generator().then((x) => {\r\n const convValues = new Array(x.length);\r\n for (let i = 0; i < x.length; i++) {\r\n convValues[i] = onfulfilled(x[i]);\r\n }\r\n return convValues;\r\n });\r\n return {\r\n generator,\r\n type: 0,\r\n };\r\n }\r\n case 1: {\r\n const generator = () => {\r\n const previousData = dataFunc.generator();\r\n const newPromises = new Array(previousData.length);\r\n for (let i = 0; i < previousData.length; i++) {\r\n newPromises[i] = previousData[i].then(onfulfilled);\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 1,\r\n };\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const previousData = await dataFunc.generator();\r\n const newPromises = new Array(previousData.length);\r\n for (let i = 0; i < previousData.length; i++) {\r\n newPromises[i] = previousData[i].then(onfulfilled);\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n }\r\n};\r\n","import { nextIteration } from \"./_nextIteration.js\";\r\nexport const all = (source, predicate) => {\r\n const nextIter = nextIteration(source, (x) => {\r\n if (!predicate(x)) {\r\n throw new Error(String(false));\r\n }\r\n return true;\r\n });\r\n switch (nextIter.type) {\r\n case 0:\r\n return nextIter.generator()\r\n .then(() => true, () => false);\r\n case 1:\r\n return Promise.all(nextIter.generator())\r\n .then(() => true, () => false);\r\n case 2:\r\n return nextIter.generator()\r\n .then(Promise.all.bind(Promise))\r\n .then(() => true, () => false);\r\n }\r\n};\r\n","export const nextIterationAsync = (source, onfulfilled) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = async () => {\r\n const results = await dataFunc.generator();\r\n const newPromises = new Array(results.length);\r\n for (let i = 0; i < results.length; i++) {\r\n newPromises[i] = onfulfilled(results[i]);\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n case 1: {\r\n const generator = () => {\r\n const promises = dataFunc.generator();\r\n return promises.map(async (promise) => {\r\n const value = await promise;\r\n return await onfulfilled(value);\r\n });\r\n };\r\n return {\r\n generator,\r\n type: 1,\r\n };\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const promises = await dataFunc.generator();\r\n return promises.map((promise) => promise.then(onfulfilled));\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n }\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const allAsync = (source, predicate) => {\r\n const nextIter = nextIterationAsync(source, async (x) => {\r\n if (await predicate(x) === false) {\r\n throw new Error(String(false));\r\n }\r\n return true;\r\n });\r\n switch (nextIter.type) {\r\n case 1:\r\n return Promise.all(nextIter.generator())\r\n .then(() => true, () => false);\r\n case 2:\r\n return nextIter.generator()\r\n .then(Promise.all.bind(Promise))\r\n .then(() => true, () => false);\r\n }\r\n};\r\n","import { nextIteration } from \"./_nextIteration.js\";\r\nexport const any = (source, predicate) => {\r\n if (predicate) {\r\n return any2(source, predicate);\r\n }\r\n else {\r\n return any1(source);\r\n }\r\n};\r\nconst any1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n let values;\r\n switch (dataFunc.type) {\r\n case 1:\r\n values = dataFunc.generator();\r\n return values.length !== 0;\r\n case 0:\r\n case 2:\r\n values = await dataFunc.generator();\r\n return values.length !== 0;\r\n }\r\n};\r\nconst any2 = async (source, predicate) => {\r\n const dataFunc = nextIteration(source, predicate);\r\n let values;\r\n switch (dataFunc.type) {\r\n case 0:\r\n values = await dataFunc.generator();\r\n return values.includes(true);\r\n case 1:\r\n values = await Promise.all(dataFunc.generator());\r\n return values.includes(true);\r\n case 2:\r\n values = await Promise.all(await dataFunc.generator());\r\n return values.includes(true);\r\n }\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const anyAsync = async (source, predicate) => {\r\n const nextIter = nextIterationAsync(source, predicate);\r\n let promises;\r\n switch (nextIter.type) {\r\n case 1:\r\n promises = nextIter.generator();\r\n if (promises.length === 0) {\r\n return false;\r\n }\r\n return new Promise((resolve, reject) => {\r\n let resolvedCount = 0;\r\n for (const promise of promises) {\r\n promise.then(value => {\r\n resolvedCount++;\r\n if (value) {\r\n resolve(true);\r\n }\r\n else if (resolvedCount === promises.length) {\r\n resolve(false);\r\n }\r\n }, reject);\r\n }\r\n });\r\n case 2:\r\n promises = await nextIter.generator();\r\n if (Promise.length === 0) {\r\n return false;\r\n }\r\n const values = await Promise.all(promises);\r\n return values.includes(true);\r\n }\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const asAsync = (source) => {\r\n async function* generator() {\r\n for await (const value of source) {\r\n yield value;\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","export const typeDataToArray = async (dataFunc) => {\r\n switch (dataFunc.type) {\r\n case 0:\r\n return await dataFunc.generator();\r\n case 1:\r\n return await Promise.all(dataFunc.generator());\r\n case 2:\r\n const data = await dataFunc.generator();\r\n return await Promise.all(data);\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const average = async (source, selector) => {\r\n let data;\r\n if (selector) {\r\n data = nextIteration(source, selector);\r\n }\r\n else {\r\n data = source.dataFunc;\r\n }\r\n const values = await typeDataToArray(data);\r\n if (values.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n let sum = 0;\r\n for (const item of values) {\r\n sum += item;\r\n }\r\n return sum / values.length;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const averageAsync = async (source, selector) => {\r\n const nextIter = nextIterationAsync(source, selector);\r\n const values = await typeDataToArray(nextIter);\r\n if (values.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n let value = 0;\r\n for (const selectedValue of values) {\r\n value += selectedValue;\r\n }\r\n return value / values.length;\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const chunk = (source, size) => {\r\n if (size < 1) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n let dataFunc;\r\n switch (source.dataFunc.type) {\r\n case 1:\r\n const arrayOfPromises = source.dataFunc.generator;\r\n dataFunc = {\r\n type: 1,\r\n generator: () => {\r\n const chunks = [];\r\n let yieldChunk = [];\r\n for (const promise of arrayOfPromises()) {\r\n yieldChunk.push(promise);\r\n if (yieldChunk.length === size) {\r\n chunks.push(Promise.all(yieldChunk));\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n chunks.push(Promise.all(yieldChunk));\r\n }\r\n return chunks;\r\n }\r\n };\r\n break;\r\n case 2:\r\n const promiseOfPromises = source.dataFunc.generator;\r\n dataFunc = {\r\n type: 2,\r\n generator: async () => {\r\n const chunks = [];\r\n let yieldChunk = [];\r\n for (const promise of await promiseOfPromises()) {\r\n yieldChunk.push(promise);\r\n if (yieldChunk.length === size) {\r\n chunks.push(Promise.all(yieldChunk));\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n chunks.push(Promise.all(yieldChunk));\r\n }\r\n return chunks;\r\n }\r\n };\r\n break;\r\n case 0:\r\n const promiseToArray = source.dataFunc.generator;\r\n dataFunc = {\r\n type: 0,\r\n generator: async () => {\r\n const chunks = [];\r\n let yieldChunk = [];\r\n for (const value of await promiseToArray()) {\r\n yieldChunk.push(value);\r\n if (yieldChunk.length === size) {\r\n chunks.push(yieldChunk);\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n chunks.push(yieldChunk);\r\n }\r\n return chunks;\r\n }\r\n };\r\n break;\r\n }\r\n return new BasicParallelEnumerable(dataFunc);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const concatenate = (first, second) => {\r\n const generator = async () => {\r\n const [firstData, secondData] = await Promise.all([first.toArray(), second.toArray()]);\r\n return [...firstData, ...secondData];\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nexport const contains = async (source, value, comparer = StrictEqualityComparer) => {\r\n let values;\r\n if (comparer) {\r\n values = nextIteration(source, (x) => comparer(value, x));\r\n }\r\n else {\r\n values = nextIteration(source, (x) => x === value);\r\n }\r\n switch (values.type) {\r\n case 0: {\r\n const data = await values.generator();\r\n return data.some((x) => x);\r\n }\r\n case 1: {\r\n const data = await Promise.all(values.generator());\r\n return data.some((x) => x);\r\n }\r\n case 2: {\r\n const data = await Promise.all(await values.generator());\r\n return data.some((x) => x);\r\n }\r\n }\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const containsAsync = async (source, value, comparer) => {\r\n const values = nextIterationAsync(source, (x) => comparer(value, x));\r\n switch (values.type) {\r\n case 1: {\r\n const data = await Promise.all(values.generator());\r\n return data.some((x) => x);\r\n }\r\n case 2: {\r\n const data = await Promise.all(await values.generator());\r\n return data.some((x) => x);\r\n }\r\n }\r\n};\r\n","export const count = (source, predicate) => {\r\n if (predicate) {\r\n return count2(source, predicate);\r\n }\r\n else {\r\n return count1(source);\r\n }\r\n};\r\nconst count1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0:\r\n case 2:\r\n const arrayData = await source.toArray();\r\n return arrayData.length;\r\n case 1:\r\n const promises = dataFunc.generator();\r\n return promises.length;\r\n }\r\n};\r\nconst count2 = async (source, predicate) => {\r\n const values = await source.toArray();\r\n let totalCount = 0;\r\n for (let i = 0; i < values.length; i++) {\r\n if (predicate(values[i]) === true) {\r\n totalCount++;\r\n }\r\n }\r\n return totalCount;\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const countAsync = async (source, predicate) => {\r\n const data = nextIterationAsync(source, predicate);\r\n let countPromise;\r\n switch (data.type) {\r\n case 1:\r\n countPromise = Promise.all(data.generator());\r\n break;\r\n case 2:\r\n countPromise = Promise.all(await data.generator());\r\n break;\r\n }\r\n let totalCount = 0;\r\n for (const value of await countPromise) {\r\n if (value) {\r\n totalCount++;\r\n }\r\n }\r\n return totalCount;\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const defaultIfEmpty = (source, defaultValue) => {\r\n const dataFunc = source.dataFunc;\r\n const isPromise = defaultValue instanceof Promise;\r\n let typeData;\r\n switch (dataFunc.type) {\r\n case 0:\r\n {\r\n const generator = () => dataFunc\r\n .generator()\r\n .then((values) => {\r\n if (values.length) {\r\n return values;\r\n }\r\n if (isPromise) {\r\n return defaultValue.then(value => [value]);\r\n }\r\n else {\r\n return [defaultValue];\r\n }\r\n });\r\n typeData = {\r\n generator,\r\n type: dataFunc.type\r\n };\r\n }\r\n break;\r\n case 1:\r\n {\r\n const generator = () => {\r\n const promises = dataFunc.generator();\r\n if (promises.length) {\r\n return promises;\r\n }\r\n if (isPromise) {\r\n return [defaultValue];\r\n }\r\n else {\r\n return [Promise.resolve(defaultValue)];\r\n }\r\n };\r\n typeData = {\r\n generator,\r\n type: dataFunc.type\r\n };\r\n }\r\n break;\r\n case 2:\r\n {\r\n const generator = async () => {\r\n const promises = await dataFunc.generator();\r\n if (promises.length) {\r\n return promises;\r\n }\r\n if (isPromise) {\r\n return [defaultValue];\r\n }\r\n else {\r\n return [Promise.resolve(defaultValue)];\r\n }\r\n };\r\n typeData = {\r\n generator,\r\n type: dataFunc.type\r\n };\r\n }\r\n break;\r\n }\r\n return new BasicParallelEnumerable(typeData);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const distinct = (source, comparer = StrictEqualityComparer) => {\r\n const generator = async () => {\r\n const distinctElements = [];\r\n for (const item of await source.toArray()) {\r\n const foundItem = distinctElements.find((x) => comparer(x, item));\r\n if (!foundItem) {\r\n distinctElements.push(item);\r\n }\r\n }\r\n return distinctElements;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const distinctAsync = (source, comparer) => {\r\n const generator = async () => {\r\n const distinctElements = [];\r\n outerLoop: for (const item of await source.toArray()) {\r\n for (const distinctElement of distinctElements) {\r\n const found = await comparer(distinctElement, item);\r\n if (found) {\r\n continue outerLoop;\r\n }\r\n }\r\n distinctElements.push(item);\r\n }\r\n return distinctElements;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nexport const each = (source, action) => {\r\n return new BasicParallelEnumerable(nextIteration(source, (x) => {\r\n action(x);\r\n return x;\r\n }));\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const eachAsync = (source, action) => {\r\n const dataFunc = nextIterationAsync(source, async (x) => {\r\n await action(x);\r\n return x;\r\n });\r\n return new BasicParallelEnumerable(dataFunc);\r\n};\r\n","import { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const elementAt = async (source, index) => {\r\n if (index < 0) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (index >= values.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n else {\r\n return values[index];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (index >= promises.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n else {\r\n return await promises[index];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (index >= promises.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n else {\r\n return await promises[index];\r\n }\r\n }\r\n }\r\n};\r\n","export const elementAtOrDefault = async (source, index) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (index >= values.length) {\r\n return null;\r\n }\r\n else {\r\n return values[index];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (index >= promises.length) {\r\n return null;\r\n }\r\n else {\r\n return await promises[index];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (index >= promises.length) {\r\n return null;\r\n }\r\n else {\r\n return await promises[index];\r\n }\r\n }\r\n }\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const except = (first, second, comparer = StrictEqualityComparer) => {\r\n const generator = async () => {\r\n const [firstValues, secondValues] = await Promise.all([first.toArray(), second.toArray()]);\r\n const resultValues = [];\r\n for (const firstItem of firstValues) {\r\n let exists = false;\r\n for (let j = 0; j < secondValues.length; j++) {\r\n const secondItem = secondValues[j];\r\n if (comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n resultValues.push(firstItem);\r\n }\r\n }\r\n return resultValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const exceptAsync = (first, second, comparer) => {\r\n const generator = async () => {\r\n const [firstValues, secondValues] = await Promise.all([first.toArray(), second.toArray()]);\r\n const resultValues = [];\r\n for (const firstItem of firstValues) {\r\n let exists = false;\r\n for (let j = 0; j < secondValues.length; j++) {\r\n const secondItem = secondValues[j];\r\n if (await comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n resultValues.push(firstItem);\r\n }\r\n }\r\n return resultValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toArray = (source) => {\r\n return typeDataToArray(source.dataFunc);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const first = (source, predicate) => {\r\n if (predicate) {\r\n return first2(source, predicate);\r\n }\r\n else {\r\n return first1(source);\r\n }\r\n};\r\nconst first1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (values.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return values[0];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (promises.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return await promises[0];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (promises.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return await promises[0];\r\n }\r\n }\r\n }\r\n};\r\nconst first2 = async (source, predicate) => {\r\n const data = await toArray(source);\r\n for (const value of data) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const firstAsync = async (source, predicate) => {\r\n const data = await toArray(source);\r\n for (const value of data) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { toArray } from \"./toArray.js\";\r\nexport const firstOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return firstOrDefault2(source, predicate);\r\n }\r\n else {\r\n return firstOrDefault1(source);\r\n }\r\n};\r\nconst firstOrDefault1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (values.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return values[0];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (promises.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return await promises[0];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (promises.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return await promises[0];\r\n }\r\n }\r\n }\r\n};\r\nconst firstOrDefault2 = async (source, predicate) => {\r\n const data = await toArray(source);\r\n for (const value of data) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { toArray } from \"./toArray.js\";\r\nexport const firstOrDefaultAsync = async (source, predicate) => {\r\n const data = await toArray(source);\r\n for (const value of data) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const groupBy = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupBy_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupBy_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupBy_0_Simple = (source, keySelector) => {\r\n const generator = async () => {\r\n const keyMap = {};\r\n for (const value of await source.toArray()) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n const results = new Array();\r\n for (const value in keyMap) {\r\n results.push(keyMap[value]);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst groupBy_0 = (source, keySelector, comparer) => {\r\n const generator = async () => {\r\n const keyMap = new Array();\r\n for (const value of await source.toArray()) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n const results = new Array();\r\n for (const g of keyMap) {\r\n results.push(g);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const groupByAsync = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupByAsync_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupByAsync_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupByAsync_0 = (source, keySelector, comparer) => {\r\n const generator = async () => {\r\n const typedData = nextIterationAsync(source, async (value) => {\r\n const key = await keySelector(value);\r\n return [key, value];\r\n });\r\n let values;\r\n switch (typedData.type) {\r\n case 1:\r\n values = await Promise.all(typedData.generator());\r\n break;\r\n case 2:\r\n values = await Promise.all(await typedData.generator());\r\n break;\r\n }\r\n const keyMap = new Array();\r\n for (const [key, value] of values) {\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (await comparer(group.key, key) === true) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n const results = new Array();\r\n for (const g of keyMap) {\r\n results.push(g);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst groupByAsync_0_Simple = (source, keySelector) => {\r\n const generator = async () => {\r\n const typedData = nextIterationAsync(source, async (value) => {\r\n const key = await keySelector(value);\r\n return [key, value];\r\n });\r\n let values;\r\n switch (typedData.type) {\r\n case 1:\r\n values = await Promise.all(typedData.generator());\r\n break;\r\n case 2:\r\n values = await Promise.all(await typedData.generator());\r\n break;\r\n }\r\n const keyMap = {};\r\n for (const [key, value] of values) {\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n const results = new Array();\r\n for (const value in keyMap) {\r\n results.push(keyMap[value]);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const groupByWithSel = (source, keySelector, elementSelector, comparer) => {\r\n if (comparer) {\r\n return groupBy1(source, keySelector, elementSelector, comparer);\r\n }\r\n else {\r\n return groupBy1Simple(source, keySelector, elementSelector);\r\n }\r\n};\r\nconst groupBy1 = (source, keySelector, elementSelector, comparer) => {\r\n const generator = async () => {\r\n const keyMap = new Array();\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(elementSelector(value));\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n const element = elementSelector(value);\r\n keyMap.push(new Grouping(key, element));\r\n }\r\n }\r\n const results = new Array();\r\n for (const value of keyMap) {\r\n results.push(value);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst groupBy1Simple = (source, keySelector, elementSelector) => {\r\n const generator = async () => {\r\n const keyMap = {};\r\n for (const value of await source.toArray()) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n const element = elementSelector(value);\r\n if (grouping) {\r\n grouping.push(element);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, element);\r\n }\r\n }\r\n const results = new Array();\r\n for (const value in keyMap) {\r\n results.push(keyMap[value]);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const groupJoin = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0\r\n });\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async () => {\r\n const innerKeyMap = [];\r\n for await (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n const outerValues = await outer.toArray();\r\n return outerValues\r\n .map(outerValue => {\r\n var _a;\r\n const key = outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n return resultSelector(outerValue, innerRecord.values);\r\n });\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async () => {\r\n const innerKeyMap = new Map();\r\n for await (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n const outerValues = await outer.toArray();\r\n return outerValues\r\n .map(outerValue => {\r\n var _a;\r\n const key = outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n return resultSelector(outerValue, values);\r\n });\r\n };\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const groupJoinAsync = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0\r\n });\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async () => {\r\n const innerKeyMap = [];\r\n for await (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n const outerValues = await outer.toArray();\r\n const resultPromises = outerValues.map(async (outerValue) => {\r\n var _a;\r\n const key = await outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n return resultSelector(outerValue, innerRecord.values);\r\n });\r\n return await Promise.all(resultPromises);\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async () => {\r\n const innerKeyMap = new Map();\r\n for await (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n const outerValues = await outer.toArray();\r\n const resultPromises = outerValues.map(async (outerValue) => {\r\n var _a;\r\n const key = await outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n return resultSelector(outerValue, values);\r\n });\r\n return await Promise.all(resultPromises);\r\n };\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const intersect = (first, second, comparer = StrictEqualityComparer) => {\r\n const generator = async () => {\r\n const firstResults = await first.distinct(comparer).toArray();\r\n if (firstResults.length === 0) {\r\n return [];\r\n }\r\n const secondResults = await second.toArray();\r\n const results = new Array();\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (comparer(firstValue, secondValue) === true) {\r\n results.push(firstValue);\r\n break;\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const intersectAsync = (first, second, comparer) => {\r\n const generator = async () => {\r\n const firstResults = await first.distinctAsync(comparer).toArray();\r\n if (firstResults.length === 0) {\r\n return [];\r\n }\r\n const secondResults = await second.toArray();\r\n const results = new Array();\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (await comparer(firstValue, secondValue) === true) {\r\n results.push(firstValue);\r\n break;\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const join = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer = StrictEqualityComparer) => {\r\n const generator = async () => {\r\n const [innerArray, outerArray] = await Promise.all([inner.toArray(), outer.toArray()]);\r\n const results = new Array();\r\n for (const o of outerArray) {\r\n const outerKey = outerKeySelector(o);\r\n for (const i of innerArray) {\r\n const innerKey = innerKeySelector(i);\r\n if (comparer(outerKey, innerKey) === true) {\r\n results.push(resultSelector(o, i));\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const last = (source, predicate) => {\r\n if (predicate) {\r\n return last2(source, predicate);\r\n }\r\n else {\r\n return last1(source);\r\n }\r\n};\r\nconst last1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (values.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return values[values.length - 1];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (promises.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return await promises[promises.length - 1];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (promises.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return await promises[promises.length - 1];\r\n }\r\n }\r\n }\r\n};\r\nconst last2 = async (source, predicate) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n const value = values[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const lastAsync = async (source, predicate) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n const value = values[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","export const lastOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return lastOrDefault2(source, predicate);\r\n }\r\n else {\r\n return lastOrDefault1(source);\r\n }\r\n};\r\nconst lastOrDefault1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (values.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return values[values.length - 1];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (promises.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return await promises[promises.length - 1];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (promises.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return await promises[promises.length - 1];\r\n }\r\n }\r\n }\r\n};\r\nconst lastOrDefault2 = async (source, predicate) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n const value = values[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return null;\r\n};\r\n","export const lastOrDefaultAsync = async (source, predicate) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n const value = values[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const max = async (source, selector) => {\r\n let dataFunc;\r\n if (selector) {\r\n dataFunc = nextIteration(source, selector);\r\n }\r\n else {\r\n dataFunc = source.dataFunc;\r\n }\r\n const data = await typeDataToArray(dataFunc);\r\n if (data.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return Math.max.apply(null, data);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const maxAsync = async (source, selector) => {\r\n const dataFunc = nextIterationAsync(source, selector);\r\n const maxInfo = await typeDataToArray(dataFunc);\r\n if (maxInfo.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return Math.max.apply(null, maxInfo);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const min = async (source, selector) => {\r\n let dataFunc;\r\n if (selector) {\r\n dataFunc = nextIteration(source, selector);\r\n }\r\n else {\r\n dataFunc = source.dataFunc;\r\n }\r\n const data = await typeDataToArray(dataFunc);\r\n if (data.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return Math.min.apply(null, data);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const minAsync = async (source, selector) => {\r\n const dataFunc = nextIterationAsync(source, selector);\r\n const maxInfo = await typeDataToArray(dataFunc);\r\n if (maxInfo.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return Math.min.apply(null, maxInfo);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const ofType = (source, type) => {\r\n const typeCheck = typeof type === \"string\" ?\r\n (x) => [typeof x === type, x] :\r\n (x) => [x instanceof type, x];\r\n const generator = async () => {\r\n const dataFunc = nextIteration(source, typeCheck);\r\n const values = await typeDataToArray(dataFunc);\r\n const filteredValues = [];\r\n for (const [pass, value] of values) {\r\n if (pass) {\r\n filteredValues.push(value);\r\n }\r\n }\r\n return filteredValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { asAsyncKeyMapSync } from \"./asAsyncKeyMapSync.js\";\r\nexport async function* asAsyncSortedKeyValuesSync(source, keySelector, ascending, comparer) {\r\n const map = await asAsyncKeyMapSync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asAsyncKeyMapSync = async (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMapSync } from \"./asKeyMapSync.js\";\r\nexport async function* asSortedKeyValuesSync(source, keySelector, ascending, comparer) {\r\n const map = asKeyMapSync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMapSync = (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asAsyncSortedKeyValues } from \"./_ordered/asAsyncSortedKeyValues.js\";\r\nimport { asAsyncSortedKeyValuesSync } from \"./_ordered/asAsyncSortedKeyValuesSync.js\";\r\nimport { asSortedKeyValues } from \"./_ordered/asSortedKeyValues.js\";\r\nimport { asSortedKeyValuesSync } from \"./_ordered/asSortedKeyValuesSync.js\";\r\nimport { BasicParallelEnumerable } from \"./BasicParallelEnumerable.js\";\r\nexport class OrderedParallelEnumerable extends BasicParallelEnumerable {\r\n constructor(orderedPairs) {\r\n super({\r\n generator: async () => {\r\n const asyncVals = orderedPairs();\r\n const array = [];\r\n for await (const val of asyncVals) {\r\n array.push(...val);\r\n }\r\n return array;\r\n },\r\n type: 0,\r\n });\r\n this.orderedPairs = orderedPairs;\r\n }\r\n static generateAsync(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedParallelEnumerable) {\r\n orderedPairs = async function* () {\r\n for await (const pair of source.orderedPairs()) {\r\n yield* asAsyncSortedKeyValuesSync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asAsyncSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedParallelEnumerable(orderedPairs);\r\n }\r\n static generate(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedParallelEnumerable) {\r\n orderedPairs = async function* () {\r\n for await (const pair of source.orderedPairs()) {\r\n yield* asSortedKeyValuesSync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedParallelEnumerable(orderedPairs);\r\n }\r\n thenBy(keySelector, comparer) {\r\n return OrderedParallelEnumerable.generate(this, keySelector, true, comparer);\r\n }\r\n thenByAsync(keySelector, comparer) {\r\n return OrderedParallelEnumerable.generateAsync(this, keySelector, true, comparer);\r\n }\r\n thenByDescending(keySelector, comparer) {\r\n return OrderedParallelEnumerable.generate(this, keySelector, false, comparer);\r\n }\r\n thenByDescendingAsync(keySelector, comparer) {\r\n return OrderedParallelEnumerable.generateAsync(this, keySelector, false, comparer);\r\n }\r\n}\r\n","import { asAsyncKeyMap } from \"./asAsyncKeyMap.js\";\r\nexport async function* asAsyncSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = await asAsyncKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asAsyncKeyMap = async (source, keySelector) => {\r\n const map = new Map();\r\n for await (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMap } from \"./asKeyMap.js\";\r\nexport async function* asSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = await asKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMap = async (source, keySelector) => {\r\n const map = new Map();\r\n for await (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { OrderedParallelEnumerable } from \"../OrderedParallelEnumerable.js\";\r\nexport const orderBy = (source, keySelector, comparer) => {\r\n return OrderedParallelEnumerable.generate(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedParallelEnumerable } from \"../OrderedParallelEnumerable.js\";\r\nexport const orderByAsync = (source, keySelector, comparer) => {\r\n return OrderedParallelEnumerable.generateAsync(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedParallelEnumerable } from \"../OrderedParallelEnumerable.js\";\r\nexport const orderByDescending = (source, keySelector, comparer) => {\r\n return OrderedParallelEnumerable.generate(source, keySelector, false, comparer);\r\n};\r\n","import { OrderedParallelEnumerable } from \"../OrderedParallelEnumerable.js\";\r\nexport const orderByDescendingAsync = (source, keySelector, comparer) => {\r\n return OrderedParallelEnumerable.generateAsync(source, keySelector, false, comparer);\r\n};\r\n","import { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const partition = async (source, predicate) => {\r\n const dataFunc = nextIteration(source, (value) => {\r\n return [predicate(value), value];\r\n });\r\n const values = await typeDataToArray(dataFunc);\r\n const fail = [];\r\n const pass = [];\r\n for (const [passed, value] of values) {\r\n if (passed) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const partitionAsync = async (source, predicate) => {\r\n const dataFunc = nextIterationAsync(source, async (value) => {\r\n const passed = await predicate(value);\r\n return [passed, value];\r\n });\r\n const values = await typeDataToArray(dataFunc);\r\n const fail = [];\r\n const pass = [];\r\n for (const [passed, value] of values) {\r\n if (passed) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const reverse = (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 1: {\r\n const generator = () => {\r\n return dataFunc.generator().reverse();\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: dataFunc.type,\r\n });\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const array = await dataFunc.generator();\r\n return array.reverse();\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: dataFunc.type,\r\n });\r\n }\r\n case 0: {\r\n const generator = async () => {\r\n const array = await dataFunc.generator();\r\n return array.reverse();\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: dataFunc.type,\r\n });\r\n }\r\n }\r\n};\r\n","export const nextIterationWithIndex = (source, onfulfilled) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = () => dataFunc.generator().then((x) => {\r\n const convValues = new Array(x.length);\r\n for (let i = 0; i < x.length; i++) {\r\n convValues[i] = onfulfilled(x[i], i);\r\n }\r\n return convValues;\r\n });\r\n return {\r\n generator,\r\n type: 0,\r\n };\r\n }\r\n case 1: {\r\n const generator = () => {\r\n const previousData = dataFunc.generator();\r\n const newPromises = new Array(previousData.length);\r\n for (let i = 0; i < previousData.length; i++) {\r\n newPromises[i] = previousData[i].then((value) => {\r\n return onfulfilled(value, i);\r\n });\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 1,\r\n };\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const previousData = await dataFunc.generator();\r\n const newPromises = new Array(previousData.length);\r\n for (let i = 0; i < previousData.length; i++) {\r\n newPromises[i] = previousData[i].then((value) => onfulfilled(value, i));\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n }\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { nextIterationWithIndex } from \"./_nextIterationWithIndex.js\";\r\nexport const select = (source, key) => {\r\n if (typeof key === \"function\") {\r\n if (key.length === 1) {\r\n return new BasicParallelEnumerable(nextIteration(source, key));\r\n }\r\n else {\r\n return new BasicParallelEnumerable(nextIterationWithIndex(source, key));\r\n }\r\n }\r\n else {\r\n return new BasicParallelEnumerable(nextIteration(source, (x) => x[key]));\r\n }\r\n};\r\n","export const nextIterationWithIndexAsync = (source, onfulfilled) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = async () => {\r\n const results = await dataFunc.generator();\r\n const newPromises = new Array(results.length);\r\n for (let i = 0; i < results.length; i++) {\r\n newPromises[i] = onfulfilled(results[i], i);\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n case 1: {\r\n const generator = () => dataFunc\r\n .generator()\r\n .map((promise, index) => promise.then((x) => onfulfilled(x, index)));\r\n return {\r\n generator,\r\n type: 1,\r\n };\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const promises = await dataFunc.generator();\r\n return promises.map((promise, index) => promise.then((x) => onfulfilled(x, index)));\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n }\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { nextIterationWithIndexAsync } from \"./_nextIterationWithIndexAsync.js\";\r\nexport const selectAsync = (source, keyOrSelector) => {\r\n let generator;\r\n if (typeof keyOrSelector === \"function\") {\r\n if (keyOrSelector.length === 1) {\r\n generator = nextIterationAsync(source, keyOrSelector);\r\n }\r\n else {\r\n generator = nextIterationWithIndexAsync(source, keyOrSelector);\r\n }\r\n }\r\n else {\r\n generator = nextIterationAsync(source, (x) => (x[keyOrSelector]));\r\n }\r\n return new BasicParallelEnumerable(generator);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { nextIterationWithIndex } from \"./_nextIterationWithIndex.js\";\r\nexport const selectMany = (source, selector) => {\r\n const generator = async () => {\r\n let values;\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n values = nextIteration(source, selector);\r\n }\r\n else {\r\n values = nextIterationWithIndex(source, selector);\r\n }\r\n }\r\n else {\r\n values = nextIteration(source, (x) => x[selector]);\r\n }\r\n const valuesArray = [];\r\n switch (values.type) {\r\n case 0: {\r\n for (const outer of await values.generator()) {\r\n for (const y of outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n for (const outer of values.generator()) {\r\n for (const y of await outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n for (const outer of await values.generator()) {\r\n for (const y of await outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return valuesArray;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { nextIterationWithIndexAsync } from \"./_nextIterationWithIndexAsync.js\";\r\nexport const selectManyAsync = (source, selector) => {\r\n const generator = async () => {\r\n let values;\r\n if (selector.length === 1) {\r\n values = nextIterationAsync(source, selector);\r\n }\r\n else {\r\n values = nextIterationWithIndexAsync(source, selector);\r\n }\r\n const valuesArray = [];\r\n switch (values.type) {\r\n case 1: {\r\n for (const outer of values.generator()) {\r\n for (const y of await outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n for (const outer of await values.generator()) {\r\n for (const y of await outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return valuesArray;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const sequenceEquals = async (first, second, comparer = StrictEqualityComparer) => {\r\n const firstArray = await first.toArray();\r\n const secondArray = await second.toArray();\r\n if (firstArray.length !== secondArray.length) {\r\n return false;\r\n }\r\n for (let i = 0; i < firstArray.length; i++) {\r\n const firstResult = firstArray[i];\r\n const secondResult = secondArray[i];\r\n if (comparer(firstResult, secondResult) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const sequenceEqualsAsync = async (first, second, comparer) => {\r\n const firstArray = await first.toArray();\r\n const secondArray = await second.toArray();\r\n if (firstArray.length !== secondArray.length) {\r\n return false;\r\n }\r\n for (let i = 0; i < firstArray.length; i++) {\r\n const firstResult = firstArray[i];\r\n const secondResult = secondArray[i];\r\n if (await comparer(firstResult, secondResult) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const single = (source, predicate) => {\r\n if (predicate) {\r\n return single2(source, predicate);\r\n }\r\n else {\r\n return single1(source);\r\n }\r\n};\r\nconst single1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const results = await dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return results[0];\r\n }\r\n case 1: {\r\n const results = dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return results[0];\r\n }\r\n case 2: {\r\n const results = await dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return await results[0];\r\n }\r\n }\r\n};\r\nconst single2 = async (source, predicate) => {\r\n const results = await toArray(source);\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of results) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const singleAsync = async (source, predicate) => {\r\n const results = await toArray(source);\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of results) {\r\n if (await predicate(value) === true) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const singleOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return singleOrDefault2(source, predicate);\r\n }\r\n else {\r\n return singleOrDefault1(source);\r\n }\r\n};\r\nconst singleOrDefault1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const results = await dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n return null;\r\n }\r\n return results[0];\r\n }\r\n case 1: {\r\n const results = dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n return null;\r\n }\r\n return results[0];\r\n }\r\n case 2: {\r\n const results = await dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n return null;\r\n }\r\n return await results[0];\r\n }\r\n }\r\n};\r\nconst singleOrDefault2 = async (source, predicate) => {\r\n const results = await toArray(source);\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of results) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const singleOrDefaultAsync = async (source, predicate) => {\r\n const results = await toArray(source);\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of results) {\r\n if (await predicate(value) === true) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const skip = (source, count) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = async () => (await dataFunc.generator()).slice(count);\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n }\r\n case 1: {\r\n const generator = () => dataFunc.generator().slice(count);\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 1,\r\n });\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const dataInner = await dataFunc.generator();\r\n return dataInner.slice(count);\r\n };\r\n const dataFuncNew = {\r\n generator,\r\n type: 2,\r\n };\r\n return new BasicParallelEnumerable(dataFuncNew);\r\n }\r\n }\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const skipWhile = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n let i = 0;\r\n for (; i < values.length; i++) {\r\n const value = values[i];\r\n if (predicate(value, i) === false) {\r\n break;\r\n }\r\n }\r\n const returnedValues = [];\r\n for (; i < values.length; i++) {\r\n returnedValues.push(values[i]);\r\n }\r\n return returnedValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const skipWhileAsync = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n let i = 0;\r\n for (; i < values.length; i++) {\r\n const value = values[i];\r\n if (await predicate(value, i) === false) {\r\n break;\r\n }\r\n }\r\n const returnedValues = [];\r\n for (; i < values.length; i++) {\r\n returnedValues.push(values[i]);\r\n }\r\n return returnedValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","export const sum = (source, selector) => {\r\n if (selector) {\r\n return sum2(source, selector);\r\n }\r\n else {\r\n return sum1(source);\r\n }\r\n};\r\nconst sum1 = async (source) => {\r\n let totalSum = 0;\r\n for (const value of await source.toArray()) {\r\n totalSum += value;\r\n }\r\n return totalSum;\r\n};\r\nconst sum2 = async (source, selector) => {\r\n let total = 0;\r\n for (const value of await source.toArray()) {\r\n total += selector(value);\r\n }\r\n return total;\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const sumAsync = async (source, selector) => {\r\n const dataFunc = nextIterationAsync(source, selector);\r\n const values = await typeDataToArray(dataFunc);\r\n let sum = 0;\r\n for (const value of values) {\r\n sum += value;\r\n }\r\n return sum;\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const take = (source, amount) => {\r\n const amountLeft = amount > 0 ? amount : 0;\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 1:\r\n const generator1 = () => dataFunc.generator().splice(0, amountLeft);\r\n return new BasicParallelEnumerable({\r\n generator: generator1,\r\n type: 1,\r\n });\r\n case 2:\r\n const generator2 = () => dataFunc.generator().then((x) => x.splice(0, amountLeft));\r\n return new BasicParallelEnumerable({\r\n generator: generator2,\r\n type: 2,\r\n });\r\n case 0:\r\n default:\r\n const generator3 = () => dataFunc.generator().then((x) => x.splice(0, amountLeft));\r\n return new BasicParallelEnumerable({\r\n generator: generator3,\r\n type: 0,\r\n });\r\n }\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const takeWhile = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n const results = new Array();\r\n if (predicate.length === 1) {\r\n for (const value of values) {\r\n if (predicate(value) === true) {\r\n results.push(value);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < values.length; i++) {\r\n const value = values[i];\r\n if (predicate(value, i) === true) {\r\n results.push(value);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const takeWhileAsync = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n const results = new Array();\r\n if (predicate.length === 1) {\r\n const sPredicate = predicate;\r\n for (const value of values) {\r\n if (await sPredicate(value) === true) {\r\n results.push(value);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < values.length; i++) {\r\n const value = values[i];\r\n if (await predicate(value, i) === true) {\r\n results.push(value);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toMap = async (source, selector) => {\r\n const map = new Map();\r\n const dataFunc = nextIteration(source, (value) => {\r\n const key = selector(value);\r\n return [key, value];\r\n });\r\n const keyValues = await typeDataToArray(dataFunc);\r\n for (const [key, value] of keyValues) {\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toMapAsync = async (source, selector) => {\r\n const map = new Map();\r\n const dataFunc = nextIterationAsync(source, async (value) => {\r\n const key = await selector(value);\r\n return [key, value];\r\n });\r\n const keyValues = await typeDataToArray(dataFunc);\r\n for (const [key, value] of keyValues) {\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toObject = async (source, selector) => {\r\n const dataFunc = source.dataFunc;\r\n const values = await typeDataToArray(dataFunc);\r\n const map = {};\r\n for (const value of values) {\r\n map[selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toObjectAsync = async (source, selector) => {\r\n const dataFunc = nextIterationAsync(source, async (value) => {\r\n const key = await selector(value);\r\n return [key, value];\r\n });\r\n const keyValues = await typeDataToArray(dataFunc);\r\n const map = {};\r\n for (const [key, value] of keyValues) {\r\n map[key] = value;\r\n }\r\n return map;\r\n};\r\n","import { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toSet = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n const values = await typeDataToArray(dataFunc);\r\n return new Set(values);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const union = (first, second, comparer) => {\r\n if (comparer) {\r\n return union2(first, second, comparer);\r\n }\r\n else {\r\n return union1(first, second);\r\n }\r\n};\r\nconst union1 = (first, second) => {\r\n const generator = async () => {\r\n const set = new Set();\r\n const secondPromise = second.toArray();\r\n for await (const item of first) {\r\n if (set.has(item) === false) {\r\n set.add(item);\r\n }\r\n }\r\n const secondValues = await secondPromise;\r\n for (const item of secondValues) {\r\n if (set.has(item) === false) {\r\n set.add(item);\r\n }\r\n }\r\n return [...set.keys()];\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst union2 = (first, second, comparer) => {\r\n const generator = async () => {\r\n const result = [];\r\n const values = await Promise.all([first.toArray(), second.toArray()]);\r\n for (const source of values) {\r\n for (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n result.push(value);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const unionAsync = (first, second, comparer) => {\r\n const generator = async () => {\r\n const result = [];\r\n const values = await Promise.all([first.toArray(), second.toArray()]);\r\n for (const source of values) {\r\n for (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (await comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n result.push(value);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const where = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n return values.filter(predicate);\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationWithIndexAsync } from \"./_nextIterationWithIndexAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const whereAsync = (source, predicate) => {\r\n const generator = async () => {\r\n const dataFunc = nextIterationWithIndexAsync(source, async (value, index) => {\r\n const keep = await predicate(value, index);\r\n return [keep, value];\r\n });\r\n const valuesAsync = await typeDataToArray(dataFunc);\r\n const filteredValues = [];\r\n for (const [keep, value] of valuesAsync) {\r\n if (keep) {\r\n filteredValues.push(value);\r\n }\r\n }\r\n return filteredValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const zip = (first, second, resultSelector) => {\r\n if (resultSelector) {\r\n return zip2(first, second, resultSelector);\r\n }\r\n else {\r\n return zip1(first, second);\r\n }\r\n};\r\nconst zip1 = (source, second) => {\r\n const generator = async () => {\r\n const [left, right] = await Promise.all([source.toArray(), second.toArray()]);\r\n const minLength = left.length < right.length ? left.length : right.length;\r\n const results = new Array(minLength);\r\n for (let i = 0; i < minLength; i++) {\r\n const a = left[i];\r\n const b = right[i];\r\n results[i] = [a, b];\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst zip2 = (source, second, resultSelector) => {\r\n const generator = async () => {\r\n const [left, right] = await Promise.all([source.toArray(), second.toArray()]);\r\n const minLength = left.length < right.length ? left.length : right.length;\r\n const results = new Array(minLength);\r\n for (let i = 0; i < minLength; i++) {\r\n const a = left[i];\r\n const b = right[i];\r\n results[i] = resultSelector(a, b);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const zipAsync = (first, second, resultSelector) => {\r\n const generator = async () => {\r\n const [left, right] = await Promise.all([first.toArray(), second.toArray()]);\r\n const minLength = left.length < right.length ? left.length : right.length;\r\n const resultPromises = new Array(minLength);\r\n for (let i = 0; i < minLength; i++) {\r\n const a = left[i];\r\n const b = right[i];\r\n resultPromises[i] = resultSelector(a, b);\r\n }\r\n return Promise.all(resultPromises);\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicAsyncEnumerable } from \"../async/BasicAsyncEnumerable.js\";\r\nimport { BasicParallelEnumerable } from \"../parallel/BasicParallelEnumerable.js\";\r\nimport { BasicEnumerable } from \"../sync/BasicEnumerable.js\";\r\nimport { bindArray } from \"./bindArray.js\";\r\nimport { bindArrayEnumerable } from \"./bindArrayEnumerable.js\";\r\nimport { bindLinq } from \"./bindLinq.js\";\r\nimport { bindLinqAsync } from \"./bindLinqAsync.js\";\r\nimport { bindLinqParallel } from \"./bindLinqParallel.js\";\r\nimport { bindString } from \"./bindString.js\";\r\nbindLinq(BasicEnumerable);\r\nbindLinqAsync(BasicAsyncEnumerable);\r\nbindLinqParallel(BasicParallelEnumerable);\r\nbindArrayEnumerable();\r\nexport { bindLinq, bindLinqAsync, bindArray, bindString };\r\nexport { initializeLinq } from \"./initializeLinq.js\";\r\n","import { aggregate } from \"./../async/_private/aggregate.js\";\r\nimport { all } from \"./../async/_private/all.js\";\r\nimport { allAsync } from \"./../async/_private/allAsync.js\";\r\nimport { any } from \"./../async/_private/any.js\";\r\nimport { anyAsync } from \"./../async/_private/anyAsync.js\";\r\nimport { asParallel } from \"./../async/_private/asParallel.js\";\r\nimport { average } from \"./../async/_private/average.js\";\r\nimport { averageAsync } from \"./../async/_private/averageAsync.js\";\r\nimport { chunk } from \"./../async/_private/chunk.js\";\r\nimport { concatenate } from \"../async/_private/concatenate.js\";\r\nimport { contains } from \"./../async/_private/contains.js\";\r\nimport { containsAsync } from \"./../async/_private/containsAsync.js\";\r\nimport { count } from \"./../async/_private/count.js\";\r\nimport { countAsync } from \"./../async/_private/countAsync.js\";\r\nimport { defaultIfEmpty } from \"../async/_private/defaultIfEmpty.js\";\r\nimport { distinct } from \"./../async/_private/distinct.js\";\r\nimport { distinctAsync } from \"./../async/_private/distinctAsync.js\";\r\nimport { each } from \"./../async/_private/each.js\";\r\nimport { eachAsync } from \"./../async/_private/eachAsync.js\";\r\nimport { elementAt } from \"./../async/_private/elementAt.js\";\r\nimport { elementAtOrDefault } from \"./../async/_private/elementAtOrDefault.js\";\r\nimport { except } from \"./../async/_private/except.js\";\r\nimport { exceptAsync } from \"./../async/_private/exceptAsync.js\";\r\nimport { first } from \"./../async/_private/first.js\";\r\nimport { firstAsync } from \"./../async/_private/firstAsync.js\";\r\nimport { firstOrDefault } from \"./../async/_private/firstOrDefault.js\";\r\nimport { firstOrDefaultAsync } from \"./../async/_private/firstOrDefaultAsync.js\";\r\nimport { groupBy } from \"./../async/_private/groupBy.js\";\r\nimport { groupByAsync } from \"./../async/_private/groupByAsync.js\";\r\nimport { groupByWithSel } from \"./../async/_private/groupByWithSel.js\";\r\nimport { groupJoin } from \"./../async/_private/groupJoin.js\";\r\nimport { groupJoinAsync } from \"./../async/_private/groupJoinAsync.js\";\r\nimport { intersect } from \"./../async/_private/intersect.js\";\r\nimport { intersectAsync } from \"./../async/_private/intersectAsync.js\";\r\nimport { join } from \"./../async/_private/join.js\";\r\nimport { last } from \"./../async/_private/last.js\";\r\nimport { lastAsync } from \"./../async/_private/lastAsync.js\";\r\nimport { lastOrDefault } from \"./../async/_private/lastOrDefault.js\";\r\nimport { lastOrDefaultAsync } from \"./../async/_private/lastOrDefaultAsync.js\";\r\nimport { max } from \"./../async/_private/max.js\";\r\nimport { maxAsync } from \"./../async/_private/maxAsync.js\";\r\nimport { min } from \"./../async/_private/min.js\";\r\nimport { minAsync } from \"./../async/_private/minAsync.js\";\r\nimport { ofType } from \"./../async/_private/ofType.js\";\r\nimport { orderBy } from \"./../async/_private/orderBy.js\";\r\nimport { orderByAsync } from \"./../async/_private/orderByAsync.js\";\r\nimport { orderByDescending } from \"./../async/_private/orderByDescending.js\";\r\nimport { orderByDescendingAsync } from \"./../async/_private/orderByDescendingAsync.js\";\r\nimport { partition } from \"./../async/_private/partition.js\";\r\nimport { partitionAsync } from \"./../async/_private/partitionAsync.js\";\r\nimport { reverse } from \"./../async/_private/reverse.js\";\r\nimport { select } from \"./../async/_private/select.js\";\r\nimport { selectAsync } from \"./../async/_private/selectAsync.js\";\r\nimport { selectMany } from \"./../async/_private/selectMany.js\";\r\nimport { selectManyAsync } from \"./../async/_private/selectManyAsync.js\";\r\nimport { sequenceEquals } from \"./../async/_private/sequenceEquals.js\";\r\nimport { sequenceEqualsAsync } from \"./../async/_private/sequenceEqualsAsync.js\";\r\nimport { single } from \"./../async/_private/single.js\";\r\nimport { singleAsync } from \"./../async/_private/singleAsync.js\";\r\nimport { singleOrDefault } from \"./../async/_private/singleOrDefault.js\";\r\nimport { singleOrDefaultAsync } from \"./../async/_private/singleOrDefaultAsync.js\";\r\nimport { skip } from \"./../async/_private/skip.js\";\r\nimport { skipWhile } from \"./../async/_private/skipWhile.js\";\r\nimport { skipWhileAsync } from \"./../async/_private/skipWhileAsync.js\";\r\nimport { sum } from \"./../async/_private/sum.js\";\r\nimport { sumAsync } from \"./../async/_private/sumAsync.js\";\r\nimport { take } from \"./../async/_private/take.js\";\r\nimport { takeWhile } from \"./../async/_private/takeWhile.js\";\r\nimport { takeWhileAsync } from \"./../async/_private/takeWhileAsync.js\";\r\nimport { toArray } from \"./../async/_private/toArray.js\";\r\nimport { toMap } from \"./../async/_private/toMap.js\";\r\nimport { toMapAsync } from \"./../async/_private/toMapAsync.js\";\r\nimport { toObject } from \"./../async/_private/toObject.js\";\r\nimport { toObjectAsync } from \"./../async/_private/toObjectAsync.js\";\r\nimport { toSet } from \"./../async/_private/toSet.js\";\r\nimport { union } from \"./../async/_private/union.js\";\r\nimport { unionAsync } from \"./../async/_private/unionAsync.js\";\r\nimport { where } from \"./../async/_private/where.js\";\r\nimport { whereAsync } from \"./../async/_private/whereAsync.js\";\r\nimport { zip } from \"./../async/_private/zip.js\";\r\nimport { zipAsync } from \"./../async/_private/zipAsync.js\";\r\nexport const bindLinqAsync = (object) => {\r\n const prototype = object.prototype;\r\n const bind = (func, key) => {\r\n const wrapped = function (...params) {\r\n return func(this, ...params);\r\n };\r\n Object.defineProperty(wrapped, \"length\", { value: func.length - 1 });\r\n prototype[key] = wrapped;\r\n };\r\n bind(aggregate, \"aggregate\");\r\n bind(all, \"all\");\r\n bind(allAsync, \"allAsync\");\r\n bind(any, \"any\");\r\n bind(anyAsync, \"anyAsync\");\r\n bind(asParallel, \"asParallel\");\r\n bind(average, \"average\");\r\n bind(averageAsync, \"averageAsync\");\r\n bind(chunk, \"chunk\");\r\n bind(concatenate, \"concatenate\");\r\n bind(contains, \"contains\");\r\n bind(containsAsync, \"containsAsync\");\r\n bind(count, \"count\");\r\n bind(countAsync, \"countAsync\");\r\n bind(defaultIfEmpty, \"defaultIfEmpty\");\r\n bind(distinct, \"distinct\");\r\n bind(distinctAsync, \"distinctAsync\");\r\n bind(each, \"each\");\r\n bind(eachAsync, \"eachAsync\");\r\n bind(elementAt, \"elementAt\");\r\n bind(elementAtOrDefault, \"elementAtOrDefault\");\r\n bind(except, \"except\");\r\n bind(exceptAsync, \"exceptAsync\");\r\n bind(first, \"first\");\r\n bind(firstAsync, \"firstAsync\");\r\n bind(firstOrDefault, \"firstOrDefault\");\r\n bind(firstOrDefaultAsync, \"firstOrDefaultAsync\");\r\n bind(groupBy, \"groupBy\");\r\n bind(groupByAsync, \"groupByAsync\");\r\n bind(groupByWithSel, \"groupByWithSel\");\r\n bind(groupJoin, \"groupJoin\");\r\n bind(groupJoinAsync, \"groupJoinAsync\");\r\n bind(intersect, \"intersect\");\r\n bind(intersectAsync, \"intersectAsync\");\r\n bind(join, \"joinByKey\");\r\n bind(last, \"last\");\r\n bind(lastAsync, \"lastAsync\");\r\n bind(lastOrDefault, \"lastOrDefault\");\r\n bind(lastOrDefaultAsync, \"lastOrDefaultAsync\");\r\n bind(max, \"max\");\r\n bind(maxAsync, \"maxAsync\");\r\n bind(min, \"min\");\r\n bind(minAsync, \"minAsync\");\r\n bind(ofType, \"ofType\");\r\n bind(orderBy, \"orderBy\");\r\n bind(orderByAsync, \"orderByAsync\");\r\n bind(orderByDescending, \"orderByDescending\");\r\n bind(orderByDescendingAsync, \"orderByDescendingAsync\");\r\n bind(partition, \"partition\");\r\n bind(partitionAsync, \"partitionAsync\");\r\n bind(reverse, \"reverse\");\r\n bind(select, \"select\");\r\n bind(selectAsync, \"selectAsync\");\r\n bind(selectMany, \"selectMany\");\r\n bind(selectManyAsync, \"selectManyAsync\");\r\n bind(sequenceEquals, \"sequenceEquals\");\r\n bind(sequenceEqualsAsync, \"sequenceEqualsAsync\");\r\n bind(single, \"single\");\r\n bind(singleAsync, \"singleAsync\");\r\n bind(singleOrDefault, \"singleOrDefault\");\r\n bind(singleOrDefaultAsync, \"singleOrDefaultAsync\");\r\n bind(skip, \"skip\");\r\n bind(skipWhile, \"skipWhile\");\r\n bind(skipWhileAsync, \"skipWhileAsync\");\r\n bind(sum, \"sum\");\r\n bind(sumAsync, \"sumAsync\");\r\n bind(take, \"take\");\r\n bind(takeWhile, \"takeWhile\");\r\n bind(takeWhileAsync, \"takeWhileAsync\");\r\n bind(toArray, \"toArray\");\r\n bind(toMap, \"toMap\");\r\n bind(toMapAsync, \"toMapAsync\");\r\n bind(toObject, \"toObject\");\r\n bind(toObjectAsync, \"toObjectAsync\");\r\n bind(toSet, \"toSet\");\r\n bind(union, \"union\");\r\n bind(unionAsync, \"unionAsync\");\r\n bind(where, \"where\");\r\n bind(whereAsync, \"whereAsync\");\r\n bind(zip, \"zip\");\r\n bind(zipAsync, \"zipAsync\");\r\n};\r\n","import { aggregate } from \"./../parallel/_private/aggregate.js\";\r\nimport { all } from \"./../parallel/_private/all.js\";\r\nimport { allAsync } from \"./../parallel/_private/allAsync.js\";\r\nimport { any } from \"./../parallel/_private/any.js\";\r\nimport { anyAsync } from \"./../parallel/_private/anyAsync.js\";\r\nimport { asAsync } from \"./../parallel/_private/asAsync.js\";\r\nimport { average } from \"./../parallel/_private/average.js\";\r\nimport { averageAsync } from \"./../parallel/_private/averageAsync.js\";\r\nimport { chunk } from \"./../parallel/_private/chunk.js\";\r\nimport { concatenate } from \"../parallel/_private/concatenate.js\";\r\nimport { contains } from \"./../parallel/_private/contains.js\";\r\nimport { containsAsync } from \"./../parallel/_private/containsAsync.js\";\r\nimport { count } from \"./../parallel/_private/count.js\";\r\nimport { countAsync } from \"./../parallel/_private/countAsync.js\";\r\nimport { defaultIfEmpty } from \"./../parallel/_private/defaultIfEmpty.js\";\r\nimport { distinct } from \"./../parallel/_private/distinct.js\";\r\nimport { distinctAsync } from \"./../parallel/_private/distinctAsync.js\";\r\nimport { each } from \"./../parallel/_private/each.js\";\r\nimport { eachAsync } from \"./../parallel/_private/eachAsync.js\";\r\nimport { elementAt } from \"./../parallel/_private/elementAt.js\";\r\nimport { elementAtOrDefault } from \"./../parallel/_private/elementAtOrDefault.js\";\r\nimport { except } from \"./../parallel/_private/except.js\";\r\nimport { exceptAsync } from \"./../parallel/_private/exceptAsync.js\";\r\nimport { first } from \"./../parallel/_private/first.js\";\r\nimport { firstAsync } from \"./../parallel/_private/firstAsync.js\";\r\nimport { firstOrDefault } from \"./../parallel/_private/firstOrDefault.js\";\r\nimport { firstOrDefaultAsync } from \"./../parallel/_private/firstOrDefaultAsync.js\";\r\nimport { groupBy } from \"./../parallel/_private/groupBy.js\";\r\nimport { groupByAsync } from \"./../parallel/_private/groupByAsync.js\";\r\nimport { groupByWithSel } from \"./../parallel/_private/groupByWithSel.js\";\r\nimport { groupJoin } from \"./../parallel/_private/groupJoin.js\";\r\nimport { groupJoinAsync } from \"./../parallel/_private/groupJoinAsync.js\";\r\nimport { intersect } from \"./../parallel/_private/intersect.js\";\r\nimport { intersectAsync } from \"./../parallel/_private/intersectAsync.js\";\r\nimport { join } from \"./../parallel/_private/join.js\";\r\nimport { last } from \"./../parallel/_private/last.js\";\r\nimport { lastAsync } from \"./../parallel/_private/lastAsync.js\";\r\nimport { lastOrDefault } from \"./../parallel/_private/lastOrDefault.js\";\r\nimport { lastOrDefaultAsync } from \"./../parallel/_private/lastOrDefaultAsync.js\";\r\nimport { max } from \"./../parallel/_private/max.js\";\r\nimport { maxAsync } from \"./../parallel/_private/maxAsync.js\";\r\nimport { min } from \"./../parallel/_private/min.js\";\r\nimport { minAsync } from \"./../parallel/_private/minAsync.js\";\r\nimport { ofType } from \"./../parallel/_private/ofType.js\";\r\nimport { orderBy } from \"./../parallel/_private/orderBy.js\";\r\nimport { orderByAsync } from \"./../parallel/_private/orderByAsync.js\";\r\nimport { orderByDescending } from \"./../parallel/_private/orderByDescending.js\";\r\nimport { orderByDescendingAsync } from \"./../parallel/_private/orderByDescendingAsync.js\";\r\nimport { partition } from \"./../parallel/_private/partition.js\";\r\nimport { partitionAsync } from \"./../parallel/_private/partitionAsync.js\";\r\nimport { reverse } from \"./../parallel/_private/reverse.js\";\r\nimport { select } from \"./../parallel/_private/select.js\";\r\nimport { selectAsync } from \"./../parallel/_private/selectAsync.js\";\r\nimport { selectMany } from \"./../parallel/_private/selectMany.js\";\r\nimport { selectManyAsync } from \"./../parallel/_private/selectManyAsync.js\";\r\nimport { sequenceEquals } from \"./../parallel/_private/sequenceEquals.js\";\r\nimport { sequenceEqualsAsync } from \"./../parallel/_private/sequenceEqualsAsync.js\";\r\nimport { single } from \"./../parallel/_private/single.js\";\r\nimport { singleAsync } from \"./../parallel/_private/singleAsync.js\";\r\nimport { singleOrDefault } from \"./../parallel/_private/singleOrDefault.js\";\r\nimport { singleOrDefaultAsync } from \"./../parallel/_private/singleOrDefaultAsync.js\";\r\nimport { skip } from \"./../parallel/_private/skip.js\";\r\nimport { skipWhile } from \"./../parallel/_private/skipWhile.js\";\r\nimport { skipWhileAsync } from \"./../parallel/_private/skipWhileAsync.js\";\r\nimport { sum } from \"./../parallel/_private/sum.js\";\r\nimport { sumAsync } from \"./../parallel/_private/sumAsync.js\";\r\nimport { take } from \"./../parallel/_private/take.js\";\r\nimport { takeWhile } from \"./../parallel/_private/takeWhile.js\";\r\nimport { takeWhileAsync } from \"./../parallel/_private/takeWhileAsync.js\";\r\nimport { toArray } from \"./../parallel/_private/toArray.js\";\r\nimport { toMap } from \"./../parallel/_private/toMap.js\";\r\nimport { toMapAsync } from \"./../parallel/_private/toMapAsync.js\";\r\nimport { toObject } from \"./../parallel/_private/toObject.js\";\r\nimport { toObjectAsync } from \"./../parallel/_private/toObjectAsync.js\";\r\nimport { toSet } from \"./../parallel/_private/toSet.js\";\r\nimport { union } from \"./../parallel/_private/union.js\";\r\nimport { unionAsync } from \"./../parallel/_private/unionAsync.js\";\r\nimport { where } from \"./../parallel/_private/where.js\";\r\nimport { whereAsync } from \"./../parallel/_private/whereAsync.js\";\r\nimport { zip } from \"./../parallel/_private/zip.js\";\r\nimport { zipAsync } from \"./../parallel/_private/zipAsync.js\";\r\nexport const bindLinqParallel = (object) => {\r\n const prototype = object.prototype;\r\n const bind = (func, key) => {\r\n const wrapped = function (...params) {\r\n return func(this, ...params);\r\n };\r\n Object.defineProperty(wrapped, \"length\", { value: func.length - 1 });\r\n prototype[key] = wrapped;\r\n };\r\n bind(aggregate, \"aggregate\");\r\n bind(all, \"all\");\r\n bind(allAsync, \"allAsync\");\r\n bind(any, \"any\");\r\n bind(anyAsync, \"anyAsync\");\r\n bind(asAsync, \"asAsync\");\r\n bind(average, \"average\");\r\n bind(averageAsync, \"averageAsync\");\r\n bind(chunk, \"chunk\");\r\n bind(concatenate, \"concatenate\");\r\n bind(contains, \"contains\");\r\n bind(containsAsync, \"containsAsync\");\r\n bind(count, \"count\");\r\n bind(countAsync, \"countAsync\");\r\n bind(defaultIfEmpty, \"defaultIfEmpty\");\r\n bind(distinct, \"distinct\");\r\n bind(distinctAsync, \"distinctAsync\");\r\n bind(each, \"each\");\r\n bind(eachAsync, \"eachAsync\");\r\n bind(elementAt, \"elementAt\");\r\n bind(elementAtOrDefault, \"elementAtOrDefault\");\r\n bind(except, \"except\");\r\n bind(exceptAsync, \"exceptAsync\");\r\n bind(first, \"first\");\r\n bind(firstAsync, \"firstAsync\");\r\n bind(firstOrDefault, \"firstOrDefault\");\r\n bind(firstOrDefaultAsync, \"firstOrDefaultAsync\");\r\n bind(groupBy, \"groupBy\");\r\n bind(groupByAsync, \"groupByAsync\");\r\n bind(groupByWithSel, \"groupByWithSel\");\r\n bind(groupJoin, \"groupJoin\");\r\n bind(groupJoinAsync, \"groupJoinAsync\");\r\n bind(groupJoin, \"groupJoin\");\r\n bind(groupJoinAsync, \"groupJoinAsync\");\r\n bind(intersect, \"intersect\");\r\n bind(intersectAsync, \"intersectAsync\");\r\n bind(join, \"joinByKey\");\r\n bind(last, \"last\");\r\n bind(lastAsync, \"lastAsync\");\r\n bind(lastOrDefault, \"lastOrDefault\");\r\n bind(lastOrDefaultAsync, \"lastOrDefaultAsync\");\r\n bind(max, \"max\");\r\n bind(maxAsync, \"maxAsync\");\r\n bind(min, \"min\");\r\n bind(minAsync, \"minAsync\");\r\n bind(ofType, \"ofType\");\r\n bind(orderBy, \"orderBy\");\r\n bind(orderByAsync, \"orderByAsync\");\r\n bind(orderByDescending, \"orderByDescending\");\r\n bind(orderByDescendingAsync, \"orderByDescendingAsync\");\r\n bind(partition, \"partition\");\r\n bind(partitionAsync, \"partitionAsync\");\r\n bind(reverse, \"reverse\");\r\n bind(select, \"select\");\r\n bind(selectAsync, \"selectAsync\");\r\n bind(selectMany, \"selectMany\");\r\n bind(selectManyAsync, \"selectManyAsync\");\r\n bind(sequenceEquals, \"sequenceEquals\");\r\n bind(sequenceEqualsAsync, \"sequenceEqualsAsync\");\r\n bind(single, \"single\");\r\n bind(singleAsync, \"singleAsync\");\r\n bind(singleOrDefault, \"singleOrDefault\");\r\n bind(singleOrDefaultAsync, \"singleOrDefaultAsync\");\r\n bind(skip, \"skip\");\r\n bind(skipWhile, \"skipWhile\");\r\n bind(skipWhileAsync, \"skipWhileAsync\");\r\n bind(sum, \"sum\");\r\n bind(sumAsync, \"sumAsync\");\r\n bind(take, \"take\");\r\n bind(takeWhile, \"takeWhile\");\r\n bind(takeWhileAsync, \"takeWhileAsync\");\r\n bind(toArray, \"toArray\");\r\n bind(toMap, \"toMap\");\r\n bind(toMapAsync, \"toMapAsync\");\r\n bind(toObject, \"toObject\");\r\n bind(toObjectAsync, \"toObjectAsync\");\r\n bind(toSet, \"toSet\");\r\n bind(union, \"union\");\r\n bind(unionAsync, \"unionAsync\");\r\n bind(where, \"where\");\r\n bind(whereAsync, \"whereAsync\");\r\n bind(zip, \"zip\");\r\n bind(zipAsync, \"zipAsync\");\r\n};\r\n","import { ArgumentOutOfRangeException, ErrorString, InvalidOperationException } from \"../shared/index.js\";\r\nimport { ArrayEnumerable } from \"../sync/ArrayEnumerable.js\";\r\nimport { BasicEnumerable } from \"../sync/BasicEnumerable.js\";\r\nexport const bindArrayEnumerable = () => {\r\n var _a;\r\n const { prototype } = ArrayEnumerable;\r\n const propertyNames = Object.getOwnPropertyNames(BasicEnumerable.prototype);\r\n for (const prop of propertyNames) {\r\n prototype[prop] = (_a = prototype[prop]) !== null && _a !== void 0 ? _a : BasicEnumerable.prototype[prop];\r\n }\r\n prototype.all = function (predicate) {\r\n return this.every(predicate);\r\n };\r\n prototype.any = function (predicate) {\r\n if (predicate) {\r\n return this.some(predicate);\r\n }\r\n else {\r\n return this.length !== 0;\r\n }\r\n };\r\n prototype.count = function (predicate) {\r\n if (predicate) {\r\n let count = 0;\r\n for (let i = 0; i < this.length; i++) {\r\n if (predicate(this[i]) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n }\r\n else {\r\n return this.length;\r\n }\r\n };\r\n prototype.elementAt = function (index) {\r\n if (index < 0 || index >= this.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n return this[index];\r\n };\r\n prototype.elementAtOrDefault = function (index) {\r\n return this[index] || null;\r\n };\r\n prototype.first = function (predicate) {\r\n if (predicate) {\r\n const value = this.find(predicate);\r\n if (value === undefined) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n else {\r\n return value;\r\n }\r\n }\r\n else {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return this[0];\r\n }\r\n };\r\n prototype.firstOrDefault = function (predicate) {\r\n if (predicate) {\r\n const value = this.find(predicate);\r\n if (value === undefined) {\r\n return null;\r\n }\r\n else {\r\n return value;\r\n }\r\n }\r\n else {\r\n return this.length === 0 ? null : this[0];\r\n }\r\n };\r\n prototype.last = function (predicate) {\r\n if (predicate) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n else {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return this[this.length - 1];\r\n }\r\n };\r\n prototype.lastOrDefault = function (predicate) {\r\n if (predicate) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n }\r\n else {\r\n return this.length === 0 ? null : this[this.length - 1];\r\n }\r\n };\r\n prototype.max = function (selector) {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n if (selector) {\r\n let max = Number.NEGATIVE_INFINITY;\r\n for (let i = 0; i < this.length; i++) {\r\n max = Math.max(selector(this[i]), max);\r\n }\r\n return max;\r\n }\r\n else {\r\n return Math.max.apply(null, this);\r\n }\r\n };\r\n prototype.min = function (selector) {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n if (selector) {\r\n let min = Number.POSITIVE_INFINITY;\r\n for (let i = 0; i < this.length; i++) {\r\n min = Math.min(selector(this[i]), min);\r\n }\r\n return min;\r\n }\r\n else {\r\n return Math.min.apply(null, this);\r\n }\r\n };\r\n prototype.reverse = function () {\r\n Array.prototype.reverse.apply(this);\r\n return this;\r\n };\r\n};\r\n","import { Api } from \"../../Api\";\r\nimport { Status } from \"../../DataFrame\";\r\nimport { IDIService } from \"../../IDIService\";\r\nimport { FieldChangeResult, ResponseResult } from \"../FieldChangeResult\";\r\nimport { ChannelsGroupsService } from \"./ChannelsGroupsService\";\r\nimport { DeviceChannel } from \"./DeviceChannel\";\r\nimport { DevicesService } from \"./DevicesService\";\r\nimport { IDevice } from \"./IDevice\";\r\nimport { IDeviceChannel } from \"./IDeviceChannel\";\r\nimport { IDevicesService } from \"./IDevicesService\";\r\n\r\nexport interface IChannelsGroupsService extends IDIService {\r\n WaitForSynchronizationAsync(): Promise<void>;\r\n RemoveGroupAsync(group: IChannelsGroup): Promise<Status>;\r\n RemoveGroupByGuidAsync(groupGuid: string): Promise<Status>;\r\n GetGroupByGuid(guid: string): IChannelsGroup | null;\r\n GetGroupsAsync(): Promise<IChannelsGroup[]>;\r\n\r\n AddDeviceChannelToGroupAsync(channel: IDeviceChannel, group: IChannelsGroup): Promise<Status>;\r\n AddDeviceChannelToGroupByGuidAsync(channel: IDeviceChannel, groupGuid: string): Promise<Status>;\r\n\r\n RemoveDeviceChannelFromGroupAsync(channel: IDeviceChannel, group: IChannelsGroup): Promise<Status>;\r\n RemoveDeviceChannelFromGroupByGuidAsync(channel: IDeviceChannel, groupGuid: string): Promise<Status>;\r\n\r\n AddNewGroupAsync(name: string): Promise<IChannelsGroup | ResponseResult<AddNewGroupErrorCode>>;\r\n UpsertGroupWithDevicesChannelsAsync(group: IChannelsGroup, deviceChannels: IDeviceChannel[]): Promise<IChannelsGroup | ResponseResult<AddNewGroupErrorCode>>;\r\n UpdateGroupWithDevicesChannelsAsync(groupGuid: string, deviceChannels: IDeviceChannel[]): Promise<Status>;\r\n\r\n ChangeGroupNameAsync(group: IChannelsGroup, name: string): Promise<ResponseResult<AddNewGroupErrorCode>>;\r\n ChangeGroupNameByGuidAsync(groupGuid: string, name: string): Promise<ResponseResult<AddNewGroupErrorCode>>;\r\n}\r\n\r\nexport enum AddNewGroupErrorCode\r\n{\r\n Success = \"Success\",\r\n NoPermissions = \"NoPermissions\",\r\n NameToShort = \"NameToShort\",\r\n NameAlreadyExists = \"NameAlreadyExists\",\r\n OtherError = \"OtherError\",\r\n UnknownError = \"UnknownError\"\r\n}\r\n\r\nexport interface IChannelsGroup {\r\n get Guid(): string;\r\n get Name(): string;\r\n GetDevicesChannelsInGroupAsync(): Promise<IDeviceChannel[]>;\r\n ChangeNameAsync(name: string): Promise<ResponseResult<AddNewGroupErrorCode>>;\r\n}\r\n\r\nexport class ChannelsGroup implements IChannelsGroup {\r\n\r\n async GetDevicesChannelsInGroupAsync(): Promise<IDeviceChannel[]> {\r\n let channels: IDeviceChannel[] = [];\r\n\r\n for (let device of await Api.Get<IDevicesService>(DevicesService.ServiceName).GetDevicesAsync()) {\r\n for (let channel of device.Channels.where(channel => channel.ChannelGroups.any(group => group === this._guid))) {\r\n channels.push(channel);\r\n }\r\n }\r\n \r\n return channels;\r\n }\r\n private _guid: string = \"\";\r\n private _name: string = \"\";\r\n\r\n get Guid(): string {\r\n return this._guid;\r\n }\r\n\r\n set Guid(value: string) {\r\n this._guid = value;\r\n }\r\n\r\n get Name(): string {\r\n return this._name;\r\n }\r\n\r\n set Name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n ChangeNameAsync(name: string): Promise<ResponseResult<AddNewGroupErrorCode>> {\r\n return Api.Get<IChannelsGroupsService>(ChannelsGroupsService.ServiceName).ChangeGroupNameAsync(this, name);\r\n }\r\n}","import { Api } from \"../../Api\";\r\nimport { DataFrame, Method, Status } from \"../../DataFrame\";\r\nimport { ExalusConnectionService } from \"../ExalusConnectionService\";\r\nimport { FieldChangeResult, FieldChangeResultType, ResponseResult } from \"../FieldChangeResult\";\r\nimport { IExalusConnectionService } from \"../IExalusConnectionService\";\r\nimport { ISessionService } from \"../Session/ISessionService\";\r\nimport { SessionService } from \"../Session/SessionService\";\r\nimport { IWebApiCacheService } from \"../WebApi/IWebApiCacheService\";\r\nimport { WebApiCacheService } from \"../WebApi/WebApiCacheService\";\r\nimport { DeviceChannel } from \"./DeviceChannel\";\r\nimport { AddNewGroupErrorCode, ChannelsGroup, IChannelsGroup, IChannelsGroupsService } from \"./IChannelsGroupsService\";\r\nimport { IDeviceChannel } from \"./IDeviceChannel\";\r\nimport { ILoggerService } from '../Logging/ILoggerService';\r\nimport { LoggerService } from \"../Logging/LoggerService\";\r\nimport { DevicesService } from './DevicesService';\r\nimport { IDevicesService } from './IDevicesService';\r\n\r\nexport class ChannelsGroupsService implements IChannelsGroupsService {\r\n public static readonly ServiceName: string = \"ChannelsGroupsService\";\r\n private _connection: IExalusConnectionService | null = null;\r\n private _synchronized: boolean = false;\r\n private _synchronizationTaskCompletionSource: Promise<void> | null = null;\r\n private _groups: IChannelsGroup[] = [];\r\n\r\n public constructor() {\r\n this._connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n this._synchronizationTaskCompletionSource = new Promise<void>((resolve) => {\r\n Api.Get<ISessionService>(SessionService.ServiceName).OnUserLoggedInEvent().Subscribe(async user => {\r\n await this.SyncGroups();\r\n resolve();\r\n this._synchronized = true;\r\n });\r\n });\r\n }\r\n\r\n private async SyncGroups() {\r\n this._groups = await this.GetGroupsAsync();\r\n }\r\n\r\n async AddDeviceChannelToGroupByGuidAsync(channel: IDeviceChannel, groupGuid: string): Promise<Status> {\r\n const req = new AddDeviceChannelToGroupRequest();\r\n (req.Data as AddRemoveDeviceChannelToGroup).Channel = channel.Number;\r\n let device = (channel as DeviceChannel).GetDevice();\r\n\r\n if (device == null)\r\n throw new Error(\"Device is not set on this channel!\");\r\n\r\n (req.Data as AddRemoveDeviceChannelToGroup).DeviceGuid = (channel as DeviceChannel).GetDevice()?.Guid as string;\r\n (req.Data as AddRemoveDeviceChannelToGroup).GroupGuid = groupGuid;\r\n\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n\r\n if (result != null && result.Status != null) {\r\n if (result.Status == Status.OK)\r\n channel.ChannelGroups.push(groupGuid);\r\n\r\n return result.Status;\r\n }\r\n\r\n return Status.Error;\r\n }\r\n\r\n async RemoveDeviceChannelFromGroupByGuidAsync(channel: IDeviceChannel, groupGuid: string): Promise<Status> {\r\n const req = new RemoveDeviceChannelToGroupRequest();\r\n\r\n let device = (channel as DeviceChannel).GetDevice();\r\n\r\n if (device == null)\r\n throw new Error(\"Device is not set on this channel!\");\r\n\r\n (req.Data as AddRemoveDeviceChannelToGroup).DeviceGuid = (channel as DeviceChannel).GetDevice()?.Guid as string;\r\n (req.Data as AddRemoveDeviceChannelToGroup).Channel = channel.Number;\r\n (req.Data as AddRemoveDeviceChannelToGroup).GroupGuid = groupGuid;\r\n\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n\r\n if (result != null && result.Status != null) {\r\n if (result.Status == Status.OK)\r\n (channel as DeviceChannel).ChannelGroups = channel.ChannelGroups.where(a => a != groupGuid).toArray();\r\n\r\n return result.Status;\r\n }\r\n\r\n return Status.Error;\r\n }\r\n\r\n async UpsertGroupWithDevicesChannelsAsync(group: IChannelsGroup, deviceChannels: IDeviceChannel[]): Promise<ResponseResult<AddNewGroupErrorCode> | IChannelsGroup> {\r\n if (this._groups.all(g => g.Guid != group.Guid)) {\r\n let result = await this.AddNewGroupAsync(group.Name);\r\n\r\n if (result instanceof ChannelsGroup)\r\n group = result as ChannelsGroup;\r\n else if (result instanceof ResponseResult)\r\n return result;\r\n else\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, \"\");\r\n }\r\n\r\n /// add devices channels to groups that are not already in groups\r\n for (let channel of deviceChannels.where(a => a.ChannelGroups.all(b => b !== group.Guid))) {\r\n let status = await this.AddDeviceChannelToGroupAsync(channel, group);\r\n\r\n if (status !== Status.OK) {\r\n Api.Get<ILoggerService>(LoggerService.ServiceName).Error(ChannelsGroupsService.ServiceName, `Failed to add device channel ${channel.Name} to group ${group.Name}, controller responded with error ${status}`);\r\n\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, `Failed to add device channel ${channel.Name} to group ${group.Name}, controller responded with error ${status}`);\r\n }\r\n }\r\n\r\n let devices = await Api.Get<IDevicesService>(DevicesService.ServiceName).GetDevicesAsync();\r\n\r\n for (let device of devices) {\r\n for (let channel of device.Channels.except(deviceChannels, (a, b) => a.GetDevice().Guid == b.GetDevice().Guid && a.Number == b.Number)) {\r\n for (var gr of channel.ChannelGroups.where(gr => group.Guid == gr)) {\r\n let status = await this.RemoveDeviceChannelFromGroupAsync(channel, group);\r\n\r\n if (status !== Status.OK) {\r\n Api.Get<ILoggerService>(LoggerService.ServiceName).Error(ChannelsGroupsService.ServiceName, `Failed to remove device channel ${channel.Name} from group ${group.Name}, controller responded with error ${status}`);\r\n\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, `Failed to remove device channel ${channel.Name} from group ${group.Name}, controller responded with error ${status}`);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return group;\r\n }\r\n\r\n async UpdateGroupWithDevicesChannelsAsync(groupGuid: string, deviceChannels: IDeviceChannel[]): Promise<Status> {\r\n /// add devices channels to groups that are not already in groups\r\n for (let channel of deviceChannels.where(a => a.ChannelGroups.all(b => b !== groupGuid))) {\r\n let status = await this.AddDeviceChannelToGroupByGuidAsync(channel, groupGuid);\r\n if (status !== Status.OK) {\r\n Api.Get<ILoggerService>(LoggerService.ServiceName).Error(ChannelsGroupsService.ServiceName, `Failed to add device channel ${channel.Name} to group ${groupGuid}, controller responded with error ${status}`);\r\n return Status.FatalError;\r\n }\r\n }\r\n\r\n let devices = await Api.Get<IDevicesService>(DevicesService.ServiceName).GetDevicesAsync();\r\n\r\n for (let device of devices) {\r\n for (let channel of device.Channels.except(deviceChannels, (a, b) => a.GetDevice().Guid == b.GetDevice().Guid && a.Number == b.Number)) {\r\n for (var gr of channel.ChannelGroups.where(gr => groupGuid == gr)) {\r\n let status = await this.RemoveDeviceChannelFromGroupByGuidAsync(channel, groupGuid);\r\n if (status !== Status.OK) {\r\n Api.Get<ILoggerService>(LoggerService.ServiceName).Error(ChannelsGroupsService.ServiceName, `Failed to add device channel ${channel.Name} to group ${groupGuid}, controller responded with error ${status}`);\r\n return Status.FatalError;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return Status.OK;\r\n }\r\n\r\n async ChangeGroupNameByGuidAsync(groupGuid: string, name: string): Promise<ResponseResult<AddNewGroupErrorCode>> {\r\n let req = new AddUpdateChannelsGroupsRequest();\r\n let gr = new ApiGroupObject();\r\n gr.Guid = groupGuid;\r\n gr.Name = name;\r\n req.Data?.push(gr);\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n this._groups = await this.GetGroupsAsync();\r\n\r\n if (result != null && result.Status != null) {\r\n switch (result.Status) {\r\n case Status.OK:\r\n return new ResponseResult(AddNewGroupErrorCode.Success, \"\");\r\n\r\n case Status.WrongData:\r\n switch (result.Data) {\r\n case \"NameToShort\":\r\n return new ResponseResult(AddNewGroupErrorCode.NameToShort, \"At least 3 characters required\");\r\n\r\n case \"NameAlreadyExists\":\r\n return new ResponseResult(AddNewGroupErrorCode.NameAlreadyExists, \"Group with this name already exists\");\r\n\r\n default:\r\n return new ResponseResult(AddNewGroupErrorCode.OtherError, `Response error: ${result.Status} data: ${result.Data}`);\r\n }\r\n\r\n default:\r\n return new ResponseResult(AddNewGroupErrorCode.OtherError, `Response error: ${result.Status} data: ${result.Data}`);\r\n }\r\n }\r\n\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, \"\");\r\n }\r\n\r\n GetServiceName(): string {\r\n return ChannelsGroupsService.ServiceName;\r\n }\r\n\r\n WaitForSynchronizationAsync(): Promise<void> {\r\n return this._synchronizationTaskCompletionSource as Promise<void>;\r\n }\r\n\r\n GetGroupByGuid(guid: string): IChannelsGroup | null {\r\n return this._groups.first(a => a.Guid === guid);\r\n }\r\n\r\n ChangeGroupNameAsync(group: IChannelsGroup, name: string): Promise<ResponseResult<AddNewGroupErrorCode>> {\r\n return this.ChangeGroupNameByGuidAsync(group.Guid, name);\r\n }\r\n\r\n RemoveGroupAsync(group: IChannelsGroup): Promise<Status> {\r\n return this.RemoveGroupByGuidAsync(group.Guid);\r\n\r\n }\r\n\r\n async RemoveGroupByGuidAsync(groupGuid: string): Promise<Status> {\r\n let req = new RemoveGroupRequest();\r\n req.Data = groupGuid;\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n await this.SyncGroups();\r\n\r\n for (let device of await Api.Get<IDevicesService>(DevicesService.ServiceName).GetDevicesAsync()) {\r\n for (let channel of device.Channels) {\r\n if (channel.ChannelGroups.any(a => a === groupGuid)) {\r\n (channel as DeviceChannel).ChannelGroups = channel.ChannelGroups.except(groupGuid, (a, b) => a === b).toArray();\r\n }\r\n }\r\n }\r\n\r\n if (result != null && result.Status != null)\r\n return result?.Status;\r\n\r\n return Status.Error;\r\n }\r\n\r\n async GetGroupsAsync(): Promise<IChannelsGroup[]> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<ApiGroupObject[]>(new GetGroupsRequest(), 15000, false);\r\n let groups: ChannelsGroup[] = [];\r\n\r\n switch (result?.Status) {\r\n case Status.OK:\r\n let log = Api.Get<ILoggerService>(LoggerService.ServiceName);\r\n result.Data?.forEach(group => {\r\n let gr = new ChannelsGroup();\r\n gr.Guid = group.Guid;\r\n gr.Name = group.Name;\r\n log.Info(ChannelsGroupsService.ServiceName, `Got group: ${group.Name} ${group.Guid}`);\r\n groups.push(gr);\r\n\r\n });\r\n return groups;\r\n\r\n default:\r\n throw new Error(`Failed to get groups, API responded with status ${result?.Status} data: ${result?.Data}`);\r\n }\r\n }\r\n\r\n AddDeviceChannelToGroupAsync(channel: IDeviceChannel, group: IChannelsGroup): Promise<Status> {\r\n return this.AddDeviceChannelToGroupByGuidAsync(channel, group.Guid);\r\n }\r\n\r\n RemoveDeviceChannelFromGroupAsync(channel: IDeviceChannel, group: IChannelsGroup): Promise<Status> {\r\n return this.RemoveDeviceChannelFromGroupByGuidAsync(channel, group.Guid);\r\n }\r\n\r\n async AddNewGroupAsync(name: string): Promise<IChannelsGroup | ResponseResult<AddNewGroupErrorCode>> {\r\n let req = new AddUpdateChannelsGroupsRequest();\r\n let gr = new ApiGroupObject();\r\n gr.Name = name;\r\n req.Data?.push(gr);\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n this._groups = await this.GetGroupsAsync();\r\n\r\n if (result != null && result.Status != null) {\r\n switch (result.Status) {\r\n case Status.OK:\r\n return this._groups.first(a => a.Name === name);\r\n break;\r\n\r\n case Status.WrongData:\r\n switch (result.Data) {\r\n case \"NameToShort\":\r\n return new ResponseResult(AddNewGroupErrorCode.NameToShort, \"At least 3 characters required\");\r\n\r\n case \"NameAlreadyExists\":\r\n return new ResponseResult(AddNewGroupErrorCode.NameAlreadyExists, \"Group with this name already exists\");\r\n\r\n default:\r\n return new ResponseResult(AddNewGroupErrorCode.OtherError, `Response error: ${result.Status} data: ${result.Data}`);\r\n }\r\n\r\n default:\r\n return new ResponseResult(AddNewGroupErrorCode.OtherError, `Response error: ${result.Status} data: ${result.Data}`);\r\n }\r\n }\r\n\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, \"\");\r\n }\r\n}\r\n\r\nclass RemoveGroupRequest extends DataFrame<string>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/groups/group\";\r\n this.Method = Method.Delete;\r\n }\r\n}\r\n\r\nclass GetGroupsRequest extends DataFrame<string>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/groups/\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\n\r\nclass AddUpdateChannelsGroupsRequest extends DataFrame<ApiGroupObject[]>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/groups/group\";\r\n this.Method = Method.Put;\r\n this.Data = [];\r\n }\r\n}\r\n\r\nclass AddDeviceChannelToGroupRequest extends DataFrame<AddRemoveDeviceChannelToGroup>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/device/channel/groups/group/\";\r\n this.Method = Method.Put;\r\n this.Data = new AddRemoveDeviceChannelToGroup();\r\n }\r\n}\r\n\r\nclass RemoveDeviceChannelToGroupRequest extends DataFrame<AddRemoveDeviceChannelToGroup>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/device/channel/groups/group/\";\r\n this.Method = Method.Delete;\r\n this.Data = new AddRemoveDeviceChannelToGroup();\r\n }\r\n}\r\n\r\nclass ApiGroupObject {\r\n Id: number = 0;\r\n Guid: string = \"\";\r\n Name: string = \"\";\r\n}\r\n\r\nclass AddRemoveDeviceChannelToGroup {\r\n GroupGuid: string = \"\";\r\n DeviceGuid: string = \"\";\r\n Channel: number = 0;\r\n}","export class AsyncLock {\r\n\tprivate _promise: Promise<void> = Promise.resolve();\r\n\tprivate _disable = () => { };\r\n\r\n\tpublic Lock(): void {\r\n\t\tthis._promise = new Promise(resolve => this._disable = resolve);\r\n\t}\r\n\r\n\tpublic Unlock(): void {\r\n\t\tthis._disable();\r\n\t}\r\n\r\n\tpublic WaitForLockAsync(): Promise<void> {\r\n\t\treturn this._promise;\r\n\t}\r\n}","import { AsyncLock } from \"../AsyncLock\";\r\nimport { DependencyContainer } from \"../DependencyContainer\";\r\nimport { Event, IEvent } from \"../Event\";\r\nimport { IAppStateService } from \"./IAppStateService\";\r\n\r\nexport class AppStateService implements IAppStateService {\r\n\t//// BLOCK DISCONNECTION WHEN PENDING REQUESTS\r\n\tprivate _syncLock: AsyncLock = new AsyncLock();\r\n\tprivate _isInFouces: boolean = true;\r\n\tprivate _canHibernate: boolean = true;\r\n\tprivate _returnedFromSuspension: boolean = false;\r\n\tpublic static readonly ServiceName: string = \"AppStateService\";\r\n\tprivate _onReturnedFromSuspensionEvent: Event = new Event();\r\n\tprivate _onSuspendedEvent: Event = new Event();\r\n\tprivate _onEnterLowPowerModeEvent: Event = new Event();\r\n\tprivate _onExitLowPowerModeEvent: Event = new Event();\r\n\tprivate _onBackButtonPressedEvent: Event = new Event();\r\n\tprivate _onForwardButtonPressedEvent: Event = new Event();\r\n\r\n\r\n\tpublic _constructor() {\r\n\t\tif (navigator.userAgent.match(/Safari/i) != null && !navigator.mediaDevices) {\r\n\t\t\twindow.addEventListener(\"onblur\", () => {\r\n\t\t\t\tif (!this._isInFouces)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tthis._isInFouces = false;\r\n\t\t\t\tthis.Suspend();\r\n\t\t\t});\r\n\r\n\t\t\twindow.addEventListener(\"onfocus\", () => {\r\n\t\t\t\tif (this._isInFouces)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tthis._isInFouces = true;\r\n\t\t\t\tthis.ReturnFromSuspension();\r\n\t\t\t})\r\n\t\t}\r\n\t\telse {\r\n\t\t\twindow.addEventListener(\"visibilitychange\", async () => {\r\n\t\t\t\tawait this._syncLock.WaitForLockAsync();\r\n\t\t\t\tthis._syncLock.Lock();\r\n\r\n\t\t\t\tif (this.IsHidden())\r\n\t\t\t\t\tthis.Suspend();\r\n\t\t\t\telse\r\n\t\t\t\t\tthis.ReturnFromSuspension();\r\n\r\n\t\t\t\tthis._syncLock.Unlock();\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tSuspend(): void {\r\n\t\tif (!this.IsHibernationAllowed())\r\n\t\t\treturn;\r\n\r\n\t\tthis._returnedFromSuspension = false;\r\n\t\tthis._onSuspendedEvent.Invoke();\r\n\r\n\t\tDependencyContainer.Log?.Warning(AppStateService.ServiceName, \"App switched to background\");\r\n\t}\r\n\r\n\tReturnFromSuspension(): void {\r\n\t\tif (!this.IsHibernationAllowed())\r\n\t\t\treturn;\r\n\r\n\t\tthis._returnedFromSuspension = true;\r\n\t\tthis._onReturnedFromSuspensionEvent.Invoke();\r\n\r\n\t\tDependencyContainer.Log?.Warning(AppStateService.ServiceName, \"App switched to foreground\");\r\n\t}\r\n\r\n\tEnterLowPowerMode(): void {\r\n\t\tthis._onEnterLowPowerModeEvent.Invoke();\r\n\t}\r\n\r\n\tExitLowPowerMode(): void {\r\n\t\tthis._onExitLowPowerModeEvent.Invoke();\r\n\t}\r\n\r\n\tIsWorkingInWebView(): boolean {\r\n\t\t/// for apple devices\r\n\t\tif (navigator.userAgent.match(/Safari/i) != null) {\r\n\t\t\t/// normally iOS WebView does not support mediaDevices like in Safari or other browsers\r\n\t\t\tif (navigator.mediaDevices)\r\n\t\t\t\treturn false;\r\n\t\t\telse\r\n\t\t\t\treturn true;\r\n\t\t}\r\n\t\t/// for Android WebView\r\n\t\telse if (window.hasOwnProperty('Android ')) {\r\n\t\t\t// is android web view\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\t// is not android web view\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tprivate IsHidden(): boolean {\r\n\t\treturn document.hidden;\r\n\t}\r\n\r\n\tIsActive(): boolean {\r\n\t\treturn !this.IsHidden();\r\n\t}\r\n\r\n\tIsInBackground(): boolean {\r\n\t\treturn this.IsHidden();\r\n\t}\r\n\r\n\tReturnedFromSuspension(): boolean {\r\n\t\treturn this._returnedFromSuspension;\r\n\t}\r\n\r\n\tIsHibernationAllowed(): boolean {\r\n\t\treturn this._canHibernate;\r\n\t}\r\n\r\n\tDisallowHibernation(): void {\r\n\t\tthis._canHibernate = false;\r\n\t}\r\n\r\n\tAllowHibernation(): void {\r\n\t\tthis._canHibernate = true;\r\n\t}\r\n\r\n\tOnReturnedFromSuspension(): IEvent {\r\n\t\treturn this._onReturnedFromSuspensionEvent;\r\n\t}\r\n\r\n\tOnSuspended(): IEvent {\r\n\t\treturn this._onSuspendedEvent;\r\n\t}\r\n\r\n\tOnEnterLowPowerMode(): IEvent {\r\n\t\treturn this._onEnterLowPowerModeEvent;\r\n\t}\r\n\r\n\tOnExitLowPowerMode(): IEvent {\r\n\t\treturn this._onExitLowPowerModeEvent;\r\n\t}\r\n\r\n\tOnBackButtonPressed(): IEvent {\r\n\t\treturn this._onBackButtonPressedEvent;\r\n\t}\r\n\r\n\tOnForwardButtonPressed(): IEvent {\r\n\t\treturn this._onForwardButtonPressedEvent;\r\n\t}\r\n\r\n\tGetServiceName(): string {\r\n\t\treturn AppStateService.ServiceName;\r\n\t}\r\n}","import { bindArray } from \"./bindArray.js\";\r\nimport { bindString } from \"./bindString.js\";\r\nimport { bindLinq } from \"./bindLinq.js\";\r\nexport const initializeLinq = () => {\r\n bindLinq(Map);\r\n bindLinq(Set);\r\n bindString();\r\n bindArray(Array);\r\n bindArray(Int8Array);\r\n bindArray(Int16Array);\r\n bindArray(Int32Array);\r\n bindArray(Uint8Array);\r\n bindArray(Uint8ClampedArray);\r\n bindArray(Uint16Array);\r\n bindArray(Uint32Array);\r\n bindArray(Float32Array);\r\n bindArray(Float64Array);\r\n};\r\n","import { ArgumentOutOfRangeException, ErrorString, InvalidOperationException } from \"../shared/index.js\";\r\nimport { BasicEnumerable } from \"../sync/BasicEnumerable.js\";\r\nexport const bindString = () => {\r\n var _a;\r\n const prototype = String.prototype;\r\n const propertyNames = Object.getOwnPropertyNames(BasicEnumerable.prototype);\r\n for (const prop of propertyNames) {\r\n prototype[prop] = (_a = prototype[prop]) !== null && _a !== void 0 ? _a : BasicEnumerable.prototype[prop];\r\n }\r\n prototype.first = function (predicate) {\r\n if (predicate) {\r\n for (let i = 0; i < this.length; i++) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return this[0];\r\n };\r\n prototype.firstOrDefault = function (predicate) {\r\n if (predicate) {\r\n for (let i = 0; i < this.length; i++) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n }\r\n return this.length === 0 ? null : this[0];\r\n };\r\n prototype.count = function (predicate) {\r\n if (predicate) {\r\n let count = 0;\r\n for (let i = 0; i < this.length; i++) {\r\n if (predicate(this[i]) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n }\r\n else {\r\n return this.length;\r\n }\r\n };\r\n prototype.elementAt = function (index) {\r\n if (index < 0 || index >= this.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n return this[index];\r\n };\r\n prototype.elementAtOrDefault = function (index) {\r\n return this[index] || null;\r\n };\r\n prototype.last = function (predicate) {\r\n if (predicate) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n else {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return this[this.length - 1];\r\n }\r\n };\r\n prototype.lastOrDefault = function (predicate) {\r\n if (predicate) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n }\r\n else {\r\n return this.length === 0 ? null : this[this.length - 1];\r\n }\r\n };\r\n prototype.reverse = function () {\r\n const outer = this;\r\n function* generator() {\r\n for (let i = outer.length - 1; i >= 0; i--) {\r\n yield outer[i];\r\n }\r\n }\r\n return new BasicEnumerable(generator);\r\n };\r\n};\r\n","import { DependencyContainer } from \"./DependencyContainer\";\r\nimport { IDIService } from \"./IDIService\";\r\nimport { CancelationTokenSource } from './CancelationTokenSource';\r\nimport { LocalStorageService } from \"./Services/LocalStorageService\";\r\nimport { ExalusConnectionService } from './Services/ExalusConnectionService';\r\nimport { WebApiCacheService } from \"./Services/WebApi/WebApiCacheService\";\r\nimport { UsersService } from \"./Services/Users/UsersService\";\r\nimport { DevicesService } from \"./Services/Devices/DevicesService\";\r\nimport { SessionService } from \"./Services/Session/SessionService\";\r\nimport { GeolocationService } from \"./Services/Controller/GeolocationService\";\r\nimport { ControllerConfigurationService } from \"./Services/Controller/ControllerConfigurationService\";\r\n// 0. Import Module\r\nimport { initializeLinq, IEnumerable } from \"linq-to-typescript\"\r\nimport { ChannelsGroupsService } from \"./Services/Devices/ChannelsGroupsService\";\r\nimport { AppStateService } from \"./Services/AppStateService\";\r\n// 1. Declare that the JS types implement the IEnumerable interface\r\ndeclare global {\r\n interface Array<T> extends IEnumerable<T> { }\r\n interface Uint8Array extends IEnumerable<number> { }\r\n interface Uint8ClampedArray extends IEnumerable<number> { }\r\n interface Uint16Array extends IEnumerable<number> { }\r\n interface Uint32Array extends IEnumerable<number> { }\r\n interface Int8Array extends IEnumerable<number> { }\r\n interface Int16Array extends IEnumerable<number> { }\r\n interface Int32Array extends IEnumerable<number> { }\r\n interface Float32Array extends IEnumerable<number> { }\r\n interface Float64Array extends IEnumerable<number> { }\r\n interface Map<K, V> extends IEnumerable<[K, V]> { }\r\n interface Set<T> extends IEnumerable<T> { }\r\n interface String extends IEnumerable<string> { }\r\n}\r\n// 2. Bind Linq Functions to Array, Map, etc\r\ninitializeLinq();\r\n\r\nexport class Api {\r\n static WorksInContextOf: string = \"\";\r\n static Version: number = 1.0;\r\n\r\n static Init(): void {\r\n if (DependencyContainer.IsInitialized)\r\n return;\r\n\r\n let dep = DependencyContainer.Instance;\r\n\r\n try {\r\n dep.RegisterService(new LocalStorageService());\r\n dep.RegisterService(new AppStateService());\r\n dep.RegisterService(new WebApiCacheService());\r\n dep.RegisterService(new SessionService());\r\n dep.RegisterService(new ExalusConnectionService());\r\n dep.RegisterService(new GeolocationService());\r\n dep.RegisterService(new ControllerConfigurationService());\r\n dep.RegisterService(new UsersService());\r\n dep.RegisterService(new DevicesService());\r\n dep.RegisterService(new ChannelsGroupsService());\r\n }\r\n catch (ex: any) {\r\n console.error(ex);\r\n }\r\n }\r\n\r\n static GetAsync<T extends IDIService>(classType: string, cancelationToken?: CancelationTokenSource): Promise<T> {\r\n return DependencyContainer.Instance.GetServiceAsync<T>(classType, cancelationToken);\r\n }\r\n\r\n static GetWithTimeoutAsync<T extends IDIService>(classType: string, timeout: number): Promise<T> {\r\n return DependencyContainer.Instance.GetServiceWithTimeoutAsync<T>(classType, timeout);\r\n }\r\n\r\n static Get<T extends IDIService>(classType: string): T {\r\n return DependencyContainer.Instance.GetService<T>(classType);\r\n }\r\n\r\n static SleepForAsync(miliseconds: number): Promise<void> {\r\n return new Promise(resolve => setTimeout(resolve, miliseconds));\r\n }\r\n}"],"names":["LogLevel","__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","this","Function","e","window","obj","prop","prototype","hasOwnProperty","call","TypedEvent","handlers","Subscribe","handler","push","Unsubscribe","filter","h","Invoke","data","slice","forEach","ex","DependencyContainer","Error","LoggerService","_blockedServices","_logLevel","Debug","IsBlocked","service","undefined","any","a","DisableLogsFrom","name","all","ServiceName","EnableLogsFrom","where","toArray","level","GetServiceName","GetTimeStamp","date","Date","getHours","getMinutes","getSeconds","getMilliseconds","Warning","contextClassType","message","Info","console","warn","error","info","debug","Log","log","_services","_serviceRegistrationEvent","Instance","_instance","RegisterService","IsInitialized","GetService","serviceName","GetServiceAsync","token","Promise","resolve","reject","sub","onCancel","CancellationEvent","GetServiceWithTimeoutAsync","timeout","timeoutId","GetClassName","clearTimeout","setTimeout","LocalStorageService","GetResourceName","inContextOf","objectId","Api","WorksInContextOf","Remove","localStorage","removeItem","DropStorage","prefix","startsWith","Save","setItem","JSON","stringify","Read","getItem","parse","DEFAULT_RETRY_DELAYS_IN_MILLISECONDS","DefaultReconnectPolicy","constructor","retryDelays","_retryDelays","nextRetryDelayInMilliseconds","retryContext","previousRetryCount","HeaderNames","Authorization","Cookie","HttpResponse","statusCode","statusText","content","HttpClient","url","options","send","method","post","delete","getCookieString","AccessTokenHttpClient","innerClient","accessTokenFactory","super","_innerClient","_accessTokenFactory","async","request","allowRetry","_accessToken","indexOf","_setAuthorizationHeader","response","headers","HttpError","errorMessage","trueProto","__proto__","TimeoutError","AbortError","UnsupportedTransportError","transport","errorType","DisabledTransportError","FailedToStartTransportError","FailedToNegotiateWithServerError","AggregateErrors","innerErrors","HttpTransportType","TransferFormat","MessageType","HubConnectionState","NullLogger","_message","instance","Arg","static","val","match","values","Platform","isBrowser","document","isWebWorker","self","isReactNative","isNode","getDataDetail","includeContent","detail","isArrayBuffer","byteLength","view","Uint8Array","str","num","toString","substr","length","formatArrayBuffer","ArrayBuffer","sendMessage","logger","transportName","httpClient","value","getUserAgentHeader","logMessageContent","responseType","withCredentials","SubjectSubscription","subject","observer","_subject","_observer","dispose","index","observers","splice","cancelCallback","catch","_","ConsoleLogger","minimumLogLevel","_minLevel","out","logLevel","msg","toISOString","userAgentHeaderName","constructUserAgent","getOsName","getRuntimeVersion","version","os","runtime","runtimeVersion","userAgent","majorAndMinor","split","process","platform","versions","node","getErrorString","stack","FetchHttpClient","_logger","fetch","requireFunc","_jar","CookieJar","_fetchType","bind","getGlobalThis","AbortController","_abortControllerType","abortSignal","aborted","abortController","onabort","abort","msTimeout","body","cache","credentials","mode","redirect","signal","ok","deserializeContent","status","payload","cookies","getCookies","c","join","arrayBuffer","text","XhrHttpClient","xhr","XMLHttpRequest","open","setRequestHeader","keys","header","onload","responseText","onerror","ontimeout","DefaultHttpClient","_httpClient","_isAborted","LongPollingTransport","_pollAbort","_options","_running","onreceive","onclose","pollAborted","transferFormat","isRequired","isIn","_url","Binary","pollOptions","pollUrl","now","_closeError","_receiving","_poll","_raiseOnClose","deleteOptions","logMessage","ServerSentEventsTransport","accessToken","encodeURIComponent","eventSource","opened","Text","EventSource","onmessage","_close","onopen","_eventSource","stop","close","WebSocketTransport","webSocketConstructor","_logMessageContent","_webSocketConstructor","_headers","webSocket","replace","binaryType","_event","_webSocket","event","ErrorEvent","readyState","OPEN","_isCloseEvent","wasClean","code","reason","HttpConnection","_stopPromiseResolver","features","_negotiateVersion","baseUrl","_resolveUrl","webSocketModule","eventSourceModule","WebSocket","_connectionState","_connectionStarted","_startInternalPromise","_startInternal","_stopPromise","_sendQueue","TransportSendQueue","_stopInternal","_stopError","_stopConnection","skipNegotiation","WebSockets","_constructTransport","_startTransport","negotiateResponse","redirects","_getNegotiationResponse","ProtocolVersion","_createTransport","inherentKeepAlive","negotiateUrl","_resolveNegotiateUrl","negotiateVersion","connectionToken","connectionId","_createConnectUrl","requestedTransport","requestedTransferFormat","connectUrl","_isITransport","transportExceptions","transports","availableTransports","negotiate","endpoint","transportOrError","_resolveTransportOrError","ServerSentEvents","LongPolling","connect","actualTransport","transportMatches","transferFormats","map","s","lastIndexOf","aTag","createElement","href","substring","_transport","_buffer","_executing","_sendBufferedData","PromiseSource","_transportResult","_sendLoopPromise","_sendLoop","_bufferData","promise","transportResult","_concatBuffers","arrayBuffers","totalLength","b","reduce","result","offset","item","set","buffer","_resolver","_rejecter","TextMessageFormat","output","RecordSeparator","input","messages","pop","RecordSeparatorCode","String","fromCharCode","HandshakeProtocol","writeHandshakeRequest","handshakeRequest","write","parseHandshakeResponse","messageData","remainingData","binaryData","separatorIndex","responseLength","apply","Array","textData","type","Subject","next","err","complete","subscribe","HubConnection","connection","protocol","reconnectPolicy","_nextKeepAlive","_freezeEventListener","serverTimeoutInMilliseconds","keepAliveIntervalInMilliseconds","_protocol","_reconnectPolicy","_handshakeProtocol","_processIncomingData","_connectionClosed","_callbacks","_methods","_closedCallbacks","_reconnectingCallbacks","_reconnectedCallbacks","_invocationId","_receivedHandshakeResponse","Disconnected","_cachedPingMessage","writeMessage","Ping","state","Reconnecting","start","_startPromise","_startWithStateTransitions","Connecting","addEventListener","Connected","_stopDuringStartError","handshakePromise","_handshakeResolver","_handshakeRejecter","_sendMessage","_cleanupTimeout","_resetTimeoutPeriod","_resetKeepAliveInterval","_cleanupPingTimer","startPromise","Disconnecting","_reconnectDelayHandle","_completeClose","stream","methodName","args","streams","streamIds","_replaceStreamingParams","invocationDescriptor","_createStreamInvocation","promiseQueue","cancelInvocation","_createCancelInvocation","invocationId","then","_sendWithProtocol","invocationEvent","Completion","_launchStreams","sendPromise","_createInvocation","invoke","on","newMethod","toLowerCase","off","removeIdx","callback","onreconnecting","onreconnected","_processHandshakeResponse","parseMessages","Invocation","_invokeClientMethod","StreamItem","Close","allowReconnect","responseMessage","getTime","_timeoutHandle","serverTimeout","_pingServerHandle","nextPing","invocationMessage","target","methods","_createCompletionMessage","methodsCopy","expectsResponse","res","exception","completionMessage","m","prevRes","arguments","_cancelCallbacksWithError","_reconnect","removeEventListener","reconnectStartTime","previousReconnectAttempts","retryError","nextRetryDelay","_getNextRetryDelay","elapsedMilliseconds","retryReason","callbacks","nonblocking","streamId","_createStreamItemMessage","i","argument","_isObservable","arg","StreamInvocation","id","CancelInvocation","JsonHubProtocol","hubMessages","parsedMessage","_isInvocationMessage","_isStreamItemMessage","_isCompletionMessage","_assertNotEmptyString","LogLevelNameMapping","trace","information","warning","critical","none","HubConnectionBuilder","configureLogging","logging","mapping","parseLogLevel","withUrl","transportTypeOrOptions","isNotEmpty","httpConnectionOptions","withHubProtocol","withAutomaticReconnect","retryDelaysOrReconnectPolicy","isArray","build","create","Helpers","d","d2","performance","r","Math","random","floor","DataFrame","TransactionId","GenerateUUID","Method","ConnectionType","ConnectionResult","ConnectionState","Localization","LoginError","Status","Gender","AccessLevel","AuthorizationInfo","serialNumber","pin","SerialNumber","PIN","Event","_log","Get","User","_guid","_cloudGuid","_name","_surname","_phone","_email","_isAccountOnline","_isAccountActive","_isAccountBanned","_notificationChannels","_gender","_accessLevel","_localization","En_Us","Guid","CloudGuid","Name","Surname","Phone","Email","IsAccountOnline","IsActive","IsBanned","NotificationChannels","SessionService","_onUserLoggedInEvent","_onUserLoggedOutEvent","_password","_loginTaskCompletionSource","CreateSessionCompletionSourceAsync","_alreadySubsribedToNetworkEvents","_user","onUserLoggedIn","user","OnUserLoggedInEvent","RestoreSessionAsync","UserLogInAsync","WaitForSessionCreationAsync","OnUserLoggedOutEvent","UserLogOutAsync","logoutRequest","Resource","Put","ExalusConnectionService","SendAndWaitForResponseAsync","OnConnectionStateChanged","connectionState","Failed","email","password","LoginUserRequest","Data","OnConnectionStateChangedEvent","WrongAuthData","UserLoginData","Password","ControllerConfigurationService","_connection","_session","_localStorage","_onEnteredConfigurationEvent","_onExitedConfigurationEvent","_onConfigurationTimeCheckedEvent","_configurationTime","_appEnteredConfigurationMode","_didConfigurationChange","_synchronizationTaskCompletionSource","CheckIfConfigurationHasChangedAsync","OnDataReceivedEvent","DidCofigurationChangeAsync","GetLastKnownConfigurationChangeTime","SaveLastConfigurationChangeTime","time","EnterConfigurationModeAsync","EntryConfigurationModeRequest","ExitConfigurationModeAsync","ExitConfigurationModeRequest","OnEnteredConfigurationEvent","OnExitedConfigurationEvent","OnConfigurationTimeCheckedEvent","GetLastConfigurationChangeTimeAsync","LastChangeTimeRequest","WebApiCacheService","_localStorageService","Cache","GetCache","tmp","ClearCache","_logPackets","_disconnectedOnPurpose","_defaultPacketsBrokerAddress","_serversBrokerAddress","_address","_isEstabilished","_timeout","_dataReceivedEvent","_pongReceivedEvent","_authorizationReceivedEvent","_registrationReceivedEvent","_connectionStateChangedEvent","_errorOccuredEvent","_controllerConfiguration","_cache","_packetsBrokerServers","EnablePacketsLogging","DisablePacketsLogging","InitializeConnection","_serialId","_PIN","SetServersBrokerAddress","address","SetDefaultPacketsBrokerAddress","GetServerAddressAsync","ConnectAsync","connectAsync","AuthorizeAsync","authorizationInfo","ConnectAndAuthorizeAsync","packetsBroker","conResult","AuthorizationFailed","ControllerIsNotConnected","server","DisconnectAsync","FailedToConnect","FireConnectionStateChanged","sender","dataReceivedEvent","connectionEvent","IsConnected","dataFrame","useCache","logTransmission","SendAndWaitForResponseWithRepeatAsync","repeat","startTime","onReceivedFrame","receivedFrame","difference","SendAsync","OnErrorOccuredEvent","TaskExecution","DeviceResponseType","TaskExecutionResult","DeviceTaskExecutionResult","ChannelOnOffStateEnum","DoorBellStateEnum","BlindStatusCode","RemoteButtonStateEnum","MeasuredTemperatureTypeEnum","BatteryStateEnum","DetectedObjectStateEnum","MovementStateEnum","BlindRemoteButtonStateEnum","FacadeRemoteButtonStateEnum","LinkQualityEnum","GatePositionTypeEnum","GatewayPositionTypeEnum","BlindCalibrationStatusEnum","HumidityTypeEnum","VibrationTypeEnum","BinarySensorStateEnum","ConfigurationStateEnum","WindThresholdStateEnum","LightThresholdStateEnum","FloodSensorStates","HumidityType","PressureType","FacadeType","TamperProtectionStatus","FieldChangeResultType","ChannelConfigurations","DeviceTaskType","DeviceType","CommunicationWay","DeviceState","StateReliability","UsersService","GetUsersAsync","GetUsersListRequest","users","element","GetUserAsync","CreateUserAsync","UpdateUserAsync","DeleteUserAsync","DeviceTaskTypeInfo","_type","Unknown","_interfaceType","Type","InterfaceType","DeviceResponseTypeInfo","DeviceTasksInfo","DeviceGuid","Channel","NoTasksExecuting","DeviceTaskPairExecutionResult","Device","Task","Result","_data","_typeAsEnum","TypeAsEnum","ChannelOnOffDeviceState","ChannelOnOffState","DoorBellDeviceState","DoorBellState","ReedStateDeviceState","ReedState","BlindPositionDeviceState","BlindPosition","GetBlindStatus","Position","UnableToMove","MotorOverheatedPleaseWait","Working","RemoteButtonDeviceState","RemoteButtonState","LightColorDeviceState","LightColor","LightWarmthDeviceState","LightWarmth","LightBrightnessDeviceState","LightBrightness","MeasuredTemperatureDeviceState","MeasuredTemperature","BatteryDeviceState","BatteryState","MeasuredBrightnessDeviceState","MeasuredBrightness","MeasuredEnergyDeviceState","MeasuredEnergy","MeasuredDistanceDeviceState","MeasuredDistance","MovementSensorDeviceState","MovementSensorState","BlindRemoteButtonDeviceState","BlindRemoteButtonState","FacadeRemoteButtonDeviceState","FacadeRemoteButtonState","SignalStrenghtDeviceState","SignalStrength","GatePositionDeviceState","GatePosition","GatewayPositionDeviceState","GatewayPosition","BlindCalibrationDeviceState","BlindCalibration","HumiditySensorDeviceState","HumiditySensorState","VibrationSensorDeviceState","VibrationSensorState","BinarySensorStateDeviceState","BinarySensorState","ConfigurationDeviceState","ConfigurationState","BlindOpenCloseTimeDeviceState","BlindOpenCloseTime","OvercurrentProtectionDeviceState","OvercurrentProtectionState","OvercurrentProtectionThresholdDeviceState","OvercurrentProtectionThreshold","FacadePositionDeviceState","FacadePosition","FacadeTypeDeviceState","CurrentWindThresholdDeviceState","CurrentWindThreshold","CurrentLightThresholdDeviceState","CurrentLightThreshold","WindSpeedDeviceState","WindSpeedState","FloodSensorDeviceState","FloodSensorState","PressureSensorDeviceState","PressureSensorState","TamperProtectionDeviceState","TamperProtectionState","FieldChangeResult","ResponseResult","_onDeviceStateChangedEvent","_onDeviceTasksExecutionChangedOnChannelsEvent","_serialNumber","_model","_modelGuid","_manufacturerGuid","_isVirtual","_isEnabled","_deviceState","_deviceType","_communicationWay","_availableTasksTypes","_availableResponseTypes","_channels","devicesApi","DevicesService","stateChangedEvent","tasksExecutionChangeEvent","OnDeviceStateChangedEvent","stateChange","State","OnDevicesTasksExecutionChangeEvent","tasks","task","RemoveDeviceAsync","ExecuteDeviceTaskAsync","OnDeviceTasksExecutionChangedOnChannelsEvent","guid","ChannelsAmount","_channelsAmount","amount","Model","model","ModelGuid","ManufacturerGuid","manufacturerGuid","IsVirtual","isVirtual","IsEnabled","isEnabled","deviceState","deviceType","communicationWay","AvailableTaskTypes","availableTasksTypes","AvailableResponseTypes","availableResponseTypes","Channels","ChangeDeviceNameAsync","DeviceChannelConfigurationRequest","Changed","NoPermissions","includes","ControllerResponseTimeout","UnknownError","ExecuteTaskAsync","device","DeviceNameData","BlindActionEnum","BlindActionSimpleEnum","FacadeActionEnum","DeviceControlFeature","DeviceChannel","_device","_number","_iconName","_states","_mode","_channelGroups","_isHidden","_onTasksExecutionChangedEvent","SetDevice","newState","GetDevice","GetChannelConfigurationData","ChannelConfigurationData","ChannelName","Configuration","GroupsGuids","Hidden","IconName","HideAsync","ChangeConfigurationAsync","ShowAsync","ChangeNameAsync","ChangeIconNameAsync","ChangeGroupsAsync","groups","configuration","WrongData","Number","States","Mode","ChannelGroups","IsHidden","OnTasksExecutionChangeEvent","SetGeolocationResponseCode","_devices","_onDevicesTasksChangedEvent","_onDeviceFoundEvent","_onDeviceRegisteredEvent","_onDeviceRemovedEvent","_fastStatesSync","_synchronized","_synchronizedDevicesStates","_deviceStatesSynchronizationTaskCompletionSource","GetPairedDevicesAsync","WaitForSynchronizationAsync","SyncDevicesStatesAsync","frame","ParseDeviceTaskInfo","MapApiDevices","devices","st","MapApiDeviceStateToDeviceState","channel","WaitForDevicesStatesSynchronizationAsync","GetCurrentlyRunningTaksAsync","GetRunningDevicesTasksRequest","devicesTasks","taskChannelPair","pair","ExecutingTasks","DataType","GetDevicesStatesRequest","syncStatesRequest","SyncDevicesStatesRequest","OnDeviceRegisteredEvent","OnDeviceRemovedEvent","OnDeviceFoundEvent","devicesObjects","DeviceName","ChannelsNumber","DeviceSerialNumber","DeviceModelGuid","DeviceModel","AvailableTasks","typeInfo","AvailableResponses","ChannelsConfiguration","ch","GetDevicesListRequest","GetDevicesAsync","GetFoundDevicesAsync","GetFoundDevicesRequest","find","FindDevicesAsync","SearchForDevicesRequest","StopSearchingForDevices","StopSearchingForDevicesRequest","RegisterDeviceAsync","req","DevicePairRequest","Executed","DeviceUnpairRequest","MapDeviceTaskToDeviceTaskInfo","t","DeviceTaskInfo","tsk","FeatureType","Temperature","Brightness","LightColorTaskInfo","ts","R","G","B","Action","Open","Stop","Percentage","FacadePositionTaskInfo","fp","FacadeAction","Tilt","ControlFeature","TaskType","ExecuteDeviceTaskRequest","DeviceNotFound","DeviceResponseTimeout","ExecuteDevicesTasksAsync","results","tasksPair","position","SequnceExecutionOrder","ExecuteDevicesTasksRequest","responsePosition","pos","Post","Coordinates","Longitude","Latitude","CoordinatesWithSourceInfo","IsNetworkBased","GeolocationService","IsControllerGeolocationSetAsync","IsGeolocationSetRequest","GetCurrentGeolocationAsync","navigator","geolocation","getCurrentPosition","SetControllerGeolocationAsync","location","SetCoordinatesRequest","OK","UserIsNotLoggedIn","GetControlllerGeolocationAsync","GetSetCoordinatesRequest","RangeError","paramName","ErrorString","freeze","MoreThanOneElement","MoreThanOneMatchingElement","NoElements","NoMatch","InvalidOperationException","StrictEqualityComparer","x","y","iterator","Symbol","asyncIterator","dataFunc","generator","bindArray","jsArray","_a","arrayEnumerablePrototype","bindToPrototype","propertyNames","getOwnPropertyNames","aggregate","source","seedOrFunc","func","resultSelector","ReferenceError","aggregate3","aggregate2","aggregate1","aggregateValue","seed","predicate","allAsync","any2","any1","anyAsync","fromAsync","promisesOrIterable","asAsync","fromParallel","asParallel","array","average","selector","count","averageAsync","chunk","size","yieldChunk","concatenate","first","second","contains","comparer","containsAsync","count2","count1","countAsync","defaultIfEmpty","defaultValue","found","distinct","distinctElements","distinctAsync","outerLoop","distinctElement","each","action","eachAsync","elementAt","elementAtOrDefault","except","secondArray","firstItem","exists","j","exceptAsync","secondItem","first2","first1","done","firstAsync","firstOrDefault","firstOrDefault2","firstOrDefault1","firstOrDefaultAsync","Grouping","startingItem","groupBy","keySelector","iterable","keyMap","group","keyValue","groupBy_0","grouping","groupBy_0_Simple","groupByAsync","groupByAsync_0","groupByAsync_0_Simple","groupByWithSel","elementSelector","groupBy_1","groupBy_1_Simple","groupJoin","outer","inner","outerKeySelector","innerKeySelector","groupJoinWithComparer","groupJoinSimple","innerKeyMap","innerValue","record","outerValue","innerRecord","Map","groupJoinAsync","intersect","firstResults","secondResults","firstValue","intersectAsync","secondValue","innerArray","outerKey","innerKey","last","last2","last1","lastItem","lastAsync","lastOrDefault","lastOrDefault2","lastOrDefault1","lastOrDefaultAsync","max","max2","max1","maxItem","NEGATIVE_INFINITY","maxAsync","min","min2","min1","minItem","POSITIVE_INFINITY","minAsync","ofType","typeCheck","asAsyncSortedKeyValuesSync","ascending","currentMapping","asAsyncKeyMapSync","sortedKeys","sort","asSortedKeyValuesSync","asKeyMapSync","OrderedAsyncEnumerable","orderedPairs","orderedPair","asAsyncKeyMap","asAsyncSortedKeyValues","asKeyMap","asSortedKeyValues","thenBy","generate","thenByAsync","generateAsync","thenByDescending","thenByDescendingAsync","asSortedKeyValuesAsync","asKeyMapAsync","OrderedEnumerable","orderBy","orderByAsync","orderByDescending","orderByDescendingAsync","partition","fail","pass","partitionAsync","reverse","select1","select2","select3","selectAsync","selectAsync1","selectAsync2","selectAsync3","selectMany","selectMany1","selectMany2","selectMany3","selectorValue","selectManyAsync","selectManyAsync1","selectManyAsync2","innerValues","sequenceEquals","firstIterator","secondIterator","firstResult","secondResult","sequenceEqualsAsync","single","single2","single1","hasValue","singleValue","singleAsync","singleOrDefault","singleOrDefault2","singleOrDefault1","singleOrDefaultAsync","skip","skipWhile","skipWhile1","skipWhile2","skipWhileAsync","skipWhileAsync1","skipWhileAsync2","sum","sum2","sum1","total","sumAsync","take","amountLeft","takeWhile","takeWhile1","takeWhile2","takeWhileAsync","takeWhileAsync1","takeWhileAsync2","toMap","toMapAsync","toObject","toObjectAsync","toSet","Set","union","union2","union1","has","add","resultValue","unionAsync","where1","where2","whereAsync","whereAsync1","whereAsync2","zip","zip2","zip1","zipAsync","bindLinq","object","wrapped","params","firstElement","groupBy1","groupBy1Simple","minValue","many","firstNext","secondNext","nextIteration","onfulfilled","convValues","previousData","newPromises","nextIter","nextIterationAsync","promises","resolvedCount","typeDataToArray","selectedValue","arrayOfPromises","chunks","promiseOfPromises","promiseToArray","firstData","secondData","some","totalCount","countPromise","isPromise","typeData","firstValues","secondValues","resultValues","typedData","resultPromises","outerArray","maxInfo","filteredValues","OrderedParallelEnumerable","asyncVals","passed","nextIterationWithIndex","nextIterationWithIndexAsync","keyOrSelector","valuesArray","firstArray","returnedValues","totalSum","sPredicate","keyValues","secondPromise","valuesAsync","keep","left","right","minLength","bindLinqAsync","bindLinqParallel","every","bindArrayEnumerable","AddNewGroupErrorCode","ChannelsGroup","GetDevicesChannelsInGroupAsync","channels","ChannelsGroupsService","ChangeGroupNameAsync","_groups","SyncGroups","GetGroupsAsync","AddDeviceChannelToGroupByGuidAsync","groupGuid","AddDeviceChannelToGroupRequest","GroupGuid","RemoveDeviceChannelFromGroupByGuidAsync","RemoveDeviceChannelToGroupRequest","UpsertGroupWithDevicesChannelsAsync","deviceChannels","AddNewGroupAsync","AddDeviceChannelToGroupAsync","gr","RemoveDeviceChannelFromGroupAsync","UpdateGroupWithDevicesChannelsAsync","ChangeGroupNameByGuidAsync","AddUpdateChannelsGroupsRequest","ApiGroupObject","Success","NameToShort","NameAlreadyExists","OtherError","GetGroupByGuid","RemoveGroupAsync","RemoveGroupByGuidAsync","RemoveGroupRequest","GetGroupsRequest","Delete","AddRemoveDeviceChannelToGroup","Id","AsyncLock","_promise","_disable","Lock","Unlock","WaitForLockAsync","AppStateService","_syncLock","_isInFouces","_canHibernate","_returnedFromSuspension","_onReturnedFromSuspensionEvent","_onSuspendedEvent","_onEnterLowPowerModeEvent","_onExitLowPowerModeEvent","_onBackButtonPressedEvent","_onForwardButtonPressedEvent","_constructor","mediaDevices","Suspend","ReturnFromSuspension","IsHibernationAllowed","EnterLowPowerMode","ExitLowPowerMode","IsWorkingInWebView","hidden","IsInBackground","ReturnedFromSuspension","DisallowHibernation","AllowHibernation","OnReturnedFromSuspension","OnSuspended","OnEnterLowPowerMode","OnExitLowPowerMode","OnBackButtonPressed","OnForwardButtonPressed","bindString","Int8Array","Int16Array","Int32Array","Uint8ClampedArray","Uint16Array","Uint32Array","Float32Array","Float64Array","dep","classType","cancelationToken","miliseconds","Version"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"exalushome-library-bundle.js","mappings":"mBACA,ICwBYA,EDxBRC,EAAsB,CEA1BA,EAA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L,KAAKkyB,MAAQrmB,CACjB,GAGQslB,GAAA,QAAc,KACtB,kBACA,qCACA,iDACA,gDACA,yBACA,uBACA,oCACA,yDACA,yCACA,+BACA,2CACA,sBACA,0BACA,oCACA,sCACA,gDACA,wCACA,8CACA,kDACA,uCAGA,wCACA,8CACA,uCACA,kCAQG,MAAMoB,GAAb,cACY,KAAAL,MAA4B7C,GAAmB8C,QAC/C,KAAAC,eAAyB,EAcrC,CAZQC,WACA,OAAOryB,KAAKkyB,KAChB,CAEII,oBACA,OAAOtyB,KAAKoyB,cAChB,CAEIE,kBAAczmB,GACd7L,KAAKoyB,eAAiBvmB,EACtB7L,KAAKkyB,MAAQrmB,CACjB,GAGJ,SAAYwjB,GACR,oBACA,+BACA,oCACA,2CACA,iCACA,gDACA,mCACA,mCACA,oCACA,4BACA,iDACA,gCACA,2BACA,kCACA,+BACA,qCACA,wCACA,qCACA,2BACA,kCACA,iCACA,wCACA,+BACA,sDACA,mEACA,yBACA,mCACA,kCACA,qCACA,0CACA,iCACA,iCACA,2BACA,oCACA,sCACA,0CACA,8CACA,gDACA,6BACA,4CACA,uCACH,CA1CD,CAAYA,KAAAA,GAAkB,MA4ClBiC,GAAA,QAAW,KACnB,oCACA,2BACA,yBACA,kDAGQD,GAAA,QAAgB,KACxB,sBACA,yBACA,gDAGQD,GAAA,QAAU,KAClB,yBACA,qCACA,iCACA,yBACA,6BACA,yBACA,yBACA,uBAGG,MAAMoB,GAAb,cACI,KAAAC,WAAqB,GACrB,KAAAC,QAAkB,EAClB,KAAA/M,OAAwByJ,GAAcuD,gBAC1C,GAEA,SAAYrD,GACR,yBACA,2BACA,yCACA,yDACA,iEACA,yDACA,sCACH,CARD,CAAYA,KAAAA,GAAmB,KCtL/B,SAAYC,GACR,8DACA,wCACA,sDACA,wBACA,yBACA,0BACH,CAPD,CAAYA,KAAAA,GAAyB,KI6B9B,MAAMqD,GAAb,cACI,KAAAC,OAAyB,KACzB,KAAAH,QAAkB,EAClB,KAAAI,KA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83C,IACxBuC,EAAIr6C,gBAAgB,IAAIynB,IACxB4yB,EAAIr6C,gBAAgB,IAAI+jB,IACxBs2B,EAAIr6C,gBAAgB,IAAIklB,IACxBm1B,EAAIr6C,gBAAgB,IAAIigC,IACxBoa,EAAIr6C,gBAAgB,IAAI+lB,IACxBs0B,EAAIr6C,gBAAgB,IAAIwtB,IACxB6sB,EAAIr6C,gBAAgB,IAAI+0B,IACxBslB,EAAIr6C,gBAAgB,IAAIu1C,G,CAE5B,MAAOl4C,GACHgC,QAAQE,MAAMlC,E,CAEtB,CAEA2I,gBAAsCs0C,EAAmBC,GACrD,OAAOj9C,EAAoBwC,SAASM,gBAAmBk6C,EAAWC,EACtE,CAEAv0C,2BAAiDs0C,EAAmBz5C,GAChE,OAAOvD,EAAoBwC,SAASc,2BAA8B05C,EAAWz5C,EACjF,CAEAmF,WAAiCs0C,GAC7B,OAAOh9C,EAAoBwC,SAASI,WAAco6C,EACtD,CAEAt0C,qBAAqBw0C,GACjB,OAAO,IAAIl6C,SAAQC,GAAWU,WAAWV,EAASi6C,IACtD,EAxCO,GAAAj5C,iBAA2B,GAC3B,GAAAk5C,QAAkB,C","sources":["webpack://lavva.exalushome/webpack/bootstrap","webpack://lavva.exalushome/./src/Services/Logging/ILoggerService.ts","webpack://lavva.exalushome/webpack/runtime/define property getters","webpack://lavva.exalushome/webpack/runtime/global","webpack://lavva.exalushome/webpack/runtime/hasOwnProperty shorthand","webpack://lavva.exalushome/./src/TypedEvent.ts","webpack://lavva.exalushome/./src/Services/Logging/LoggerService.ts","webpack://lavva.exalushome/./src/DependencyContainer.ts","webpack://lavva.exalushome/./src/Services/LocalStorageService.ts","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HeaderNames.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/Errors.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/ILogger.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/ITransport.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HubConnection.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/Loggers.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/Utils.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/AbortController.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HttpConnection.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/Subject.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","webpack://lavva.exalushome/./node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js","webpack://lavva.exalushome/./src/Helpers.ts","webpack://lavva.exalushome/./src/DataFrame.ts","webpack://lavva.exalushome/./src/Services/IExalusConnectionService.ts","webpack://lavva.exalushome/./src/Services/Users/IUser.ts","webpack://lavva.exalushome/./src/Services/Session/ISessionService.ts","webpack://lavva.exalushome/./src/Event.ts","webpack://lavva.exalushome/./src/Services/Users/User.ts","webpack://lavva.exalushome/./src/Services/Session/SessionService.ts","webpack://lavva.exalushome/./src/Services/Controller/ControllerConfigurationService.ts","webpack://lavva.exalushome/./src/Services/WebApi/WebApiCacheService.ts","webpack://lavva.exalushome/./src/Services/ExalusConnectionService.ts","webpack://lavva.exalushome/./src/Services/Devices/IDeviceChannel.ts","webpack://lavva.exalushome/./src/Services/Devices/IDevice.ts","webpack://lavva.exalushome/./src/Services/Devices/TaskExecutionResult.ts","webpack://lavva.exalushome/./src/Services/Devices/IDeviceState.ts","webpack://lavva.exalushome/./src/Services/FieldChangeResult.ts","webpack://lavva.exalushome/./src/Services/Users/UsersService.ts","webpack://lavva.exalushome/./src/Services/Devices/IDevicesService.ts","webpack://lavva.exalushome/./src/Services/Devices/Device.ts","webpack://lavva.exalushome/./src/Services/Devices/IDeviceTask.ts","webpack://lavva.exalushome/./src/Services/Devices/Tasks/Tasks.ts","webpack://lavva.exalushome/./src/Services/Devices/DeviceChannel.ts","webpack://lavva.exalushome/./src/Services/Controller/IGeolocationService.ts","webpack://lavva.exalushome/./src/Services/Devices/DevicesService.ts","webpack://lavva.exalushome/./src/Services/Controller/GeolocationService.ts","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/shared/ArgumentOutOfRangeException.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/shared/ErrorString.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/shared/InvalidOperationException.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/shared/StrictEqualityComparer.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/ArrayEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/BasicAsyncEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/BasicParallelEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/BasicEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/aggregate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/all.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/allAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/any.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/anyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/static/fromAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/asAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/static/fromParallel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/asParallel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/average.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/averageAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/chunk.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/concatenate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/contains.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/containsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/count.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/countAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/defaultIfEmpty.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/distinct.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/distinctAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/each.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/eachAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/elementAt.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/elementAtOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/except.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/exceptAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/first.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/firstAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/firstOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/firstOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/Grouping.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupByShared.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupByWithSel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupJoin.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/groupJoinAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/intersect.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/intersectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/join.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/last.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/lastAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/lastOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/lastOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/max.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/maxAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/min.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/minAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/ofType.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asAsyncSortedKeyValuesSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asAsyncKeyMapSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asSortedKeyValuesSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asKeyMapSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/OrderedAsyncEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asAsyncSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asAsyncKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_ordered/asKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_ordered/asSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_ordered/asKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_ordered/asSortedKeyValuesAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_ordered/asKeyMapAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/OrderedEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/orderBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/orderByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/orderByDescending.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/orderByDescendingAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/partition.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/partitionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/reverse.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/select.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/selectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/selectMany.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/selectManyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/sequenceEquals.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/sequenceEqualsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/single.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/singleAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/singleOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/singleOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/skip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/skipWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/skipWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/sum.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/sumAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/take.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/takeWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/takeWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toMapAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toObject.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toObjectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/toSet.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/union.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/unionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/where.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/whereAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/zip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/sync/_private/zipAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindLinq.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/aggregate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/all.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/allAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/any.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/anyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/asParallel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/average.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/averageAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/chunk.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/concatenate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/contains.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/containsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/count.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/countAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/defaultIfEmpty.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/distinct.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/distinctAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/each.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/eachAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/elementAt.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/elementAtOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/except.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/exceptAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/first.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/firstAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/firstOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/firstOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupByWithSel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupJoin.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/groupJoinAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/intersect.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/intersectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/join.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/last.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/lastAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/lastOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/lastOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/max.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/maxAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/min.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/minAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/ofType.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/orderBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/orderByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/orderByDescending.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/orderByDescendingAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/partition.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/partitionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/reverse.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/select.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/selectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/selectMany.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/selectManyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/sequenceEquals.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/sequenceEqualsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/single.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/singleAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/singleOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/singleOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/skip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/skipWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/skipWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/sum.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/sumAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/take.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/takeWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/takeWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toMapAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toObject.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toObjectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/toSet.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/union.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/unionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/where.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/whereAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/zip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/async/_private/zipAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/aggregate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_nextIteration.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/all.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_nextIterationAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/allAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/any.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/anyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/asAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_typeDataToArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/average.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/averageAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/chunk.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/concatenate.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/contains.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/containsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/count.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/countAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/defaultIfEmpty.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/distinct.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/distinctAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/each.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/eachAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/elementAt.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/elementAtOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/except.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/exceptAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toArray.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/first.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/firstAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/firstOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/firstOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupByWithSel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupJoin.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/groupJoinAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/intersect.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/intersectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/join.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/last.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/lastAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/lastOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/lastOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/max.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/maxAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/min.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/minAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/ofType.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asAsyncSortedKeyValuesSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asAsyncKeyMapSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asSortedKeyValuesSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asKeyMapSync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/OrderedParallelEnumerable.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asAsyncSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asAsyncKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asSortedKeyValues.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_ordered/asKeyMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/orderBy.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/orderByAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/orderByDescending.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/orderByDescendingAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/partition.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/partitionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/reverse.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_nextIterationWithIndex.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/select.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/_nextIterationWithIndexAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/selectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/selectMany.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/selectManyAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/sequenceEquals.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/sequenceEqualsAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/single.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/singleAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/singleOrDefault.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/singleOrDefaultAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/skip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/skipWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/skipWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/sum.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/sumAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/take.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/takeWhile.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/takeWhileAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toMap.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toMapAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toObject.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toObjectAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/toSet.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/union.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/unionAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/where.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/whereAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/zip.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/parallel/_private/zipAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/initializer.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindLinqAsync.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindLinqParallel.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindArrayEnumerable.js","webpack://lavva.exalushome/./src/Services/Devices/IChannelsGroupsService.ts","webpack://lavva.exalushome/./src/Services/Devices/ChannelsGroupsService.ts","webpack://lavva.exalushome/./src/AsyncLock.ts","webpack://lavva.exalushome/./src/Services/AppStateService.ts","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/initializeLinq.js","webpack://lavva.exalushome/./node_modules/linq-to-typescript/esm/initializer/bindString.js","webpack://lavva.exalushome/./src/Api.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","import { IDIService } from \"./../../IDIService\";\r\n\r\nexport interface ILoggerService extends IDIService {\r\n get LogLevel(): LogLevel;\r\n set LogLevel(level: LogLevel);\r\n\r\n DisableLogsFrom(name: string): void;\r\n EnableLogsFrom(name: string): void;\r\n \r\n Warning(message: string): void;\r\n Warning(contextClassType: string, message: string): void;\r\n\r\n Error(message: string): void;\r\n Error(contextClassType: string, message: string): void;\r\n\r\n Info(message: string): void;\r\n Info(contextClassType: string, message: string): void;\r\n\r\n Debug(message: string): void;\r\n Debug(contextClassType: string, message: string): void;\r\n\r\n Log(message: string): void;\r\n Log(contextClassType: string, message: string): void;\r\n}\r\n\r\nexport enum LogLevel {\r\n Debug = 0,\r\n Info = 1,\r\n Warning = 2,\r\n Error = 3\r\n}","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import { DependencyContainer } from './DependencyContainer';\r\n\r\nexport interface ITypedEvent<T> {\r\n Subscribe(handler: { (data: T): void }): void;\r\n Unsubscribe(handler: { (data: T): void }): void;\r\n}\r\n\r\nexport class TypedEvent<T> implements ITypedEvent<T> {\r\n private handlers: { (data: T): void; }[] = [];\r\n\r\n public Subscribe(handler: { (data: T): void }): void {\r\n this.handlers.push(handler);\r\n }\r\n\r\n public Unsubscribe(handler: { (data: T): void }): void {\r\n this.handlers = this.handlers.filter(h => h !== handler);\r\n }\r\n\r\n public Invoke(data: T) {\r\n this.handlers.slice(0).forEach(h => {\r\n try {\r\n h(data);\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(ex);\r\n }\r\n });\r\n }\r\n}\r\n","import { ILoggerService, LogLevel } from \"./ILoggerService\";\r\n\r\nexport class LoggerService implements ILoggerService {\r\n private _blockedServices: string[] = [];\r\n public static readonly ServiceName: string = \"LoggerService\";\r\n\r\n private IsBlocked<T>(service: string): boolean {\r\n if (service === undefined)\r\n return false;\r\n\r\n return this._blockedServices.any(a => a == service);\r\n }\r\n\r\n DisableLogsFrom(name: string): void {\r\n if (this._blockedServices.all(a => a != name))\r\n this._blockedServices.push(name);\r\n\r\n this.Debug(LoggerService.ServiceName, `Disabling logs from ${name}`);\r\n }\r\n\r\n EnableLogsFrom(name: string): void {\r\n if (this._blockedServices.any(a => a == name))\r\n this._blockedServices = this._blockedServices.where(a => a != name).toArray();\r\n \r\n this.Debug(LoggerService.ServiceName, `Enaabling logs from ${name}`);\r\n }\r\n\r\n private _logLevel: LogLevel = LogLevel.Debug;\r\n\r\n get LogLevel(): LogLevel {\r\n return this._logLevel;\r\n }\r\n\r\n set LogLevel(level: LogLevel) {\r\n this._logLevel = level;\r\n }\r\n\r\n GetServiceName(): string {\r\n return LoggerService.ServiceName;\r\n }\r\n\r\n private GetTimeStamp(): string {\r\n const date = new Date();\r\n return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${date.getMilliseconds()} | `;\r\n }\r\n Warning(message: string): void;\r\n Warning(contextClassType: string, message: string): void;\r\n Warning(contextClassType: unknown, message?: unknown): void {\r\n\r\n switch (this._logLevel) {\r\n case LogLevel.Warning:\r\n case LogLevel.Info:\r\n case LogLevel.Debug:\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n if (contextClassType === undefined || this.IsBlocked(contextClassType as string))\r\n return;\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.warn(`${this.GetTimeStamp()}[WARN] ${contextClassType}`);\r\n else\r\n console.warn(`${this.GetTimeStamp()}[WARN] [${contextClassType}] ${message}`);\r\n }\r\n\r\n Error(message: string): void;\r\n Error(contextClassType: string, message: string): void;\r\n Error(contextClassType: unknown, message?: unknown): void {\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.error(`${this.GetTimeStamp()}[ERROR] ${contextClassType}`);\r\n else\r\n console.error(`${this.GetTimeStamp()}[ERROR] [${contextClassType}] ${message}`);\r\n }\r\n\r\n Info(message: string): void;\r\n Info(contextClassType: string, message: string): void;\r\n Info(contextClassType: unknown, message?: unknown): void {\r\n\r\n switch (this._logLevel) {\r\n case LogLevel.Info:\r\n case LogLevel.Debug:\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n if (contextClassType === undefined || this.IsBlocked(contextClassType as string))\r\n return;\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.info(`${this.GetTimeStamp()}[INFO] ${contextClassType}`);\r\n else\r\n console.info(`${this.GetTimeStamp()}[INFO] [${contextClassType}] ${message}`);\r\n }\r\n\r\n Debug(message: string): void;\r\n Debug(contextClassType: string, message: string): void;\r\n Debug(contextClassType: unknown, message?: unknown): void {\r\n\r\n switch (this._logLevel) {\r\n case LogLevel.Debug:\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n if (contextClassType === undefined || this.IsBlocked(contextClassType as string))\r\n return;\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.debug(`${this.GetTimeStamp()}[DEBUG] ${contextClassType}`);\r\n else\r\n console.debug(`${this.GetTimeStamp()}[DEBUG] [${contextClassType}] ${message}`);\r\n }\r\n\r\n Log(message: string): void;\r\n Log(contextClassType: string, message: string): void;\r\n Log(contextClassType: unknown, message?: unknown): void {\r\n\r\n if (contextClassType === undefined || this.IsBlocked(contextClassType as string))\r\n return;\r\n\r\n if (contextClassType != null)\r\n if (message === null || message === undefined)\r\n console.log(`${this.GetTimeStamp()}[LOG] ${contextClassType}`);\r\n else\r\n console.log(`${this.GetTimeStamp()}[LOG] [${contextClassType}] ${message}`);\r\n }\r\n}","import { IDIService } from \"./IDIService\";\r\nimport { TypedEvent, ITypedEvent } from './TypedEvent';\r\nimport { CancelationTokenSource } from './CancelationTokenSource';\r\nimport { ILoggerService } from './Services/Logging/ILoggerService';\r\nimport { LoggerService } from './Services/Logging/LoggerService';\r\n\r\nexport class DependencyContainer {\r\n private static _instance: DependencyContainer;\r\n private _services: { [key: string]: IDIService } = {};\r\n private _serviceRegistrationEvent: ITypedEvent<IDIService> = new TypedEvent<IDIService>();\r\n public static Log?: ILoggerService;\r\n public static IsInitialized: boolean = false;\r\n\r\n public static get Instance(): DependencyContainer {\r\n if (DependencyContainer._instance != null)\r\n return DependencyContainer._instance;\r\n\r\n DependencyContainer._instance = new DependencyContainer();\r\n this.Log = new LoggerService();\r\n this.Log.Warning(\"Initializing DependencyContainer\");\r\n DependencyContainer._instance.RegisterService(this.Log);\r\n this.IsInitialized = true;\r\n return DependencyContainer._instance;\r\n }\r\n\r\n public RegisterService(service: IDIService): void {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Registering new service: ${service.GetServiceName()}`);\r\n this._services[service.GetServiceName()] = service;\r\n }\r\n\r\n public GetService<T extends IDIService>(serviceName: string): T {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Getting service [${serviceName}] by GetService<T>()`);\r\n return this._services[serviceName] as unknown as T;\r\n }\r\n\r\n public GetServiceAsync<T extends IDIService>(serviceName: string, token?: CancelationTokenSource): Promise<T> {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Waiting for service availability [${serviceName}] by GetServiceAsync<T>()`);\r\n\r\n if (this._services.hasOwnProperty(serviceName)) {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Got service [${serviceName}] by GetServiceAsync<T>()`);\r\n return Promise.resolve(this._services[serviceName] as unknown as T);\r\n }\r\n return new Promise<T>((resolve, reject) => {\r\n var sub = (service: IDIService) => {\r\n if (service?.GetServiceName() === serviceName) {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Got service [${name}] by GetServiceAsync<T>()`);\r\n this._serviceRegistrationEvent.Unsubscribe(sub);\r\n resolve(service as unknown as T);\r\n }\r\n };\r\n\r\n var onCancel = () => {\r\n this._serviceRegistrationEvent.Unsubscribe(sub);\r\n token?.CancellationEvent.Unsubscribe(onCancel);\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Cancelled service [${name}] retrieval by GetServiceAsync<T>()`);\r\n reject(new Error(\"Operation cancelled!\"));\r\n };\r\n\r\n token?.CancellationEvent.Subscribe(onCancel);\r\n this._serviceRegistrationEvent.Subscribe(sub);\r\n });\r\n }\r\n\r\n public GetServiceWithTimeoutAsync<T extends IDIService>(serviceName: string, timeout: number): Promise<T> {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Waiting for service[${serviceName}] availability by GetServiceWithTimeoutAsync<T>()`);\r\n\r\n if (this._services.hasOwnProperty(serviceName)) {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Got service [${serviceName}] by GetServiceWithTimeoutAsync<T>()`);\r\n return Promise.resolve(this._services[serviceName] as unknown as T);\r\n }\r\n\r\n return new Promise<T>((resolve, reject) => {\r\n let timeoutId = 0;\r\n let sub = (service: any) => {\r\n if (service?.GetClassName() === service) {\r\n DependencyContainer.Log?.Debug(\"DependencyContainer\", `Got service [${service}] by GetServiceWithTimeoutAsync<T>()`);\r\n window.clearTimeout(timeoutId);\r\n this._serviceRegistrationEvent.Unsubscribe(sub);\r\n resolve(service as unknown as T);\r\n }\r\n };\r\n\r\n let onTimeout = () => {\r\n window.clearTimeout(timeoutId);\r\n this._serviceRegistrationEvent.Unsubscribe(sub);\r\n DependencyContainer.Log?.Error(\"DependencyContainer\", `Failed to get service [${serviceName}] in time by GetServiceWithTimeoutAsync<T>()`);\r\n reject(new Error(\"Operation cancelled!\"));\r\n };\r\n\r\n timeoutId = window.setTimeout(onTimeout, timeout);\r\n this._serviceRegistrationEvent.Subscribe(sub);\r\n });\r\n }\r\n}","import { ILocalStorageService } from \"./ILocalStorageService\";\r\nimport { DependencyContainer } from \"../DependencyContainer\";\r\nimport { Api } from \"../Api\";\r\n\r\nexport class LocalStorageService implements ILocalStorageService {\r\n public static readonly ServiceName: string = \"LocalStorageService\";\r\n\r\n GetServiceName(): string {\r\n return LocalStorageService.ServiceName;\r\n }\r\n\r\n private GetResourceName(inContextOf: string, objectId: string): string {\r\n return `_exalus_${Api.WorksInContextOf}_${inContextOf}_${objectId}`;\r\n }\r\n\r\n Remove(inContextOf: string, objectId: string): void {\r\n localStorage.removeItem(this.GetResourceName(inContextOf, objectId));\r\n }\r\n\r\n DropStorage(inContextOf: string): void {\r\n let prefix = `_exalus_${inContextOf}`;\r\n\r\n for (const key in localStorage) {\r\n if (key?.startsWith(prefix))\r\n localStorage.removeItem(key);\r\n }\r\n }\r\n\r\n Save(inContextOf: string, objectId: string, data: any): void {\r\n localStorage.setItem(this.GetResourceName(inContextOf, objectId), JSON.stringify(data));\r\n }\r\n\r\n Read<T>(inContextOf: string, objectId: string): T | null {\r\n try {\r\n let name = this.GetResourceName(inContextOf, objectId);\r\n let obj = localStorage.getItem(name);\r\n\r\n if (obj == null)\r\n return null;\r\n\r\n return JSON.parse(obj) as T;\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(LocalStorageService.ServiceName, `Exception has occurred while reading ${this.GetResourceName(inContextOf, objectId)}`);\r\n return null;\r\n }\r\n }\r\n}","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// 0, 2, 10, 30 second delays before reconnect attempts.\r\nconst DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];\r\n/** @private */\r\nexport class DefaultReconnectPolicy {\r\n constructor(retryDelays) {\r\n this._retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;\r\n }\r\n nextRetryDelayInMilliseconds(retryContext) {\r\n return this._retryDelays[retryContext.previousRetryCount];\r\n }\r\n}\r\n//# sourceMappingURL=DefaultReconnectPolicy.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nexport class HeaderNames {\r\n}\r\nHeaderNames.Authorization = \"Authorization\";\r\nHeaderNames.Cookie = \"Cookie\";\r\n//# sourceMappingURL=HeaderNames.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Represents an HTTP response. */\r\nexport class HttpResponse {\r\n constructor(statusCode, statusText, content) {\r\n this.statusCode = statusCode;\r\n this.statusText = statusText;\r\n this.content = content;\r\n }\r\n}\r\n/** Abstraction over an HTTP client.\r\n *\r\n * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.\r\n */\r\nexport class HttpClient {\r\n get(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"GET\",\r\n url,\r\n });\r\n }\r\n post(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"POST\",\r\n url,\r\n });\r\n }\r\n delete(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"DELETE\",\r\n url,\r\n });\r\n }\r\n /** Gets all cookies that apply to the specified URL.\r\n *\r\n * @param url The URL that the cookies are valid for.\r\n * @returns {string} A string containing all the key-value cookie pairs for the specified URL.\r\n */\r\n // @ts-ignore\r\n getCookieString(url) {\r\n return \"\";\r\n }\r\n}\r\n//# sourceMappingURL=HttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HeaderNames } from \"./HeaderNames\";\r\nimport { HttpClient } from \"./HttpClient\";\r\n/** @private */\r\nexport class AccessTokenHttpClient extends HttpClient {\r\n constructor(innerClient, accessTokenFactory) {\r\n super();\r\n this._innerClient = innerClient;\r\n this._accessTokenFactory = accessTokenFactory;\r\n }\r\n async send(request) {\r\n let allowRetry = true;\r\n if (this._accessTokenFactory && (!this._accessToken || (request.url && request.url.indexOf(\"/negotiate?\") > 0))) {\r\n // don't retry if the request is a negotiate or if we just got a potentially new token from the access token factory\r\n allowRetry = false;\r\n this._accessToken = await this._accessTokenFactory();\r\n }\r\n this._setAuthorizationHeader(request);\r\n const response = await this._innerClient.send(request);\r\n if (allowRetry && response.statusCode === 401 && this._accessTokenFactory) {\r\n this._accessToken = await this._accessTokenFactory();\r\n this._setAuthorizationHeader(request);\r\n return await this._innerClient.send(request);\r\n }\r\n return response;\r\n }\r\n _setAuthorizationHeader(request) {\r\n if (!request.headers) {\r\n request.headers = {};\r\n }\r\n if (this._accessToken) {\r\n request.headers[HeaderNames.Authorization] = `Bearer ${this._accessToken}`;\r\n }\r\n // don't remove the header if there isn't an access token factory, the user manually added the header in this case\r\n else if (this._accessTokenFactory) {\r\n if (request.headers[HeaderNames.Authorization]) {\r\n delete request.headers[HeaderNames.Authorization];\r\n }\r\n }\r\n }\r\n getCookieString(url) {\r\n return this._innerClient.getCookieString(url);\r\n }\r\n}\r\n//# sourceMappingURL=AccessTokenHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Error thrown when an HTTP request fails. */\r\nexport class HttpError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n * @param {number} statusCode The HTTP status code represented by this error.\r\n */\r\n constructor(errorMessage, statusCode) {\r\n const trueProto = new.target.prototype;\r\n super(`${errorMessage}: Status code '${statusCode}'`);\r\n this.statusCode = statusCode;\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when a timeout elapses. */\r\nexport class TimeoutError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage = \"A timeout occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when an action is aborted. */\r\nexport class AbortError extends Error {\r\n /** Constructs a new instance of {@link AbortError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage = \"An abort occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport is unsupported by the browser. */\r\n/** @private */\r\nexport class UnsupportedTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'UnsupportedTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport is disabled by the browser. */\r\n/** @private */\r\nexport class DisabledTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'DisabledTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport cannot be started. */\r\n/** @private */\r\nexport class FailedToStartTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'FailedToStartTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the negotiation with the server failed to complete. */\r\n/** @private */\r\nexport class FailedToNegotiateWithServerError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n */\r\n constructor(message) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.errorType = 'FailedToNegotiateWithServerError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when multiple errors have occurred. */\r\n/** @private */\r\nexport class AggregateErrors extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {Error[]} innerErrors The collection of errors this error is aggregating.\r\n */\r\n constructor(message, innerErrors) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.innerErrors = innerErrors;\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n//# sourceMappingURL=Errors.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\r\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\r\nexport var LogLevel;\r\n(function (LogLevel) {\r\n /** Log level for very low severity diagnostic messages. */\r\n LogLevel[LogLevel[\"Trace\"] = 0] = \"Trace\";\r\n /** Log level for low severity diagnostic messages. */\r\n LogLevel[LogLevel[\"Debug\"] = 1] = \"Debug\";\r\n /** Log level for informational diagnostic messages. */\r\n LogLevel[LogLevel[\"Information\"] = 2] = \"Information\";\r\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\r\n LogLevel[LogLevel[\"Warning\"] = 3] = \"Warning\";\r\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\r\n LogLevel[LogLevel[\"Error\"] = 4] = \"Error\";\r\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\r\n LogLevel[LogLevel[\"Critical\"] = 5] = \"Critical\";\r\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\r\n LogLevel[LogLevel[\"None\"] = 6] = \"None\";\r\n})(LogLevel || (LogLevel = {}));\r\n//# sourceMappingURL=ILogger.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\r\n/** Specifies a specific HTTP transport type. */\r\nexport var HttpTransportType;\r\n(function (HttpTransportType) {\r\n /** Specifies no transport preference. */\r\n HttpTransportType[HttpTransportType[\"None\"] = 0] = \"None\";\r\n /** Specifies the WebSockets transport. */\r\n HttpTransportType[HttpTransportType[\"WebSockets\"] = 1] = \"WebSockets\";\r\n /** Specifies the Server-Sent Events transport. */\r\n HttpTransportType[HttpTransportType[\"ServerSentEvents\"] = 2] = \"ServerSentEvents\";\r\n /** Specifies the Long Polling transport. */\r\n HttpTransportType[HttpTransportType[\"LongPolling\"] = 4] = \"LongPolling\";\r\n})(HttpTransportType || (HttpTransportType = {}));\r\n/** Specifies the transfer format for a connection. */\r\nexport var TransferFormat;\r\n(function (TransferFormat) {\r\n /** Specifies that only text data will be transmitted over the connection. */\r\n TransferFormat[TransferFormat[\"Text\"] = 1] = \"Text\";\r\n /** Specifies that binary data will be transmitted over the connection. */\r\n TransferFormat[TransferFormat[\"Binary\"] = 2] = \"Binary\";\r\n})(TransferFormat || (TransferFormat = {}));\r\n//# sourceMappingURL=ITransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Defines the type of a Hub Message. */\r\nexport var MessageType;\r\n(function (MessageType) {\r\n /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */\r\n MessageType[MessageType[\"Invocation\"] = 1] = \"Invocation\";\r\n /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */\r\n MessageType[MessageType[\"StreamItem\"] = 2] = \"StreamItem\";\r\n /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */\r\n MessageType[MessageType[\"Completion\"] = 3] = \"Completion\";\r\n /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */\r\n MessageType[MessageType[\"StreamInvocation\"] = 4] = \"StreamInvocation\";\r\n /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */\r\n MessageType[MessageType[\"CancelInvocation\"] = 5] = \"CancelInvocation\";\r\n /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */\r\n MessageType[MessageType[\"Ping\"] = 6] = \"Ping\";\r\n /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */\r\n MessageType[MessageType[\"Close\"] = 7] = \"Close\";\r\n})(MessageType || (MessageType = {}));\r\n//# sourceMappingURL=IHubProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HandshakeProtocol } from \"./HandshakeProtocol\";\r\nimport { AbortError } from \"./Errors\";\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { Subject } from \"./Subject\";\r\nimport { Arg, getErrorString, Platform } from \"./Utils\";\r\nconst DEFAULT_TIMEOUT_IN_MS = 30 * 1000;\r\nconst DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000;\r\n/** Describes the current state of the {@link HubConnection} to the server. */\r\nexport var HubConnectionState;\r\n(function (HubConnectionState) {\r\n /** The hub connection is disconnected. */\r\n HubConnectionState[\"Disconnected\"] = \"Disconnected\";\r\n /** The hub connection is connecting. */\r\n HubConnectionState[\"Connecting\"] = \"Connecting\";\r\n /** The hub connection is connected. */\r\n HubConnectionState[\"Connected\"] = \"Connected\";\r\n /** The hub connection is disconnecting. */\r\n HubConnectionState[\"Disconnecting\"] = \"Disconnecting\";\r\n /** The hub connection is reconnecting. */\r\n HubConnectionState[\"Reconnecting\"] = \"Reconnecting\";\r\n})(HubConnectionState || (HubConnectionState = {}));\r\n/** Represents a connection to a SignalR Hub. */\r\nexport class HubConnection {\r\n constructor(connection, logger, protocol, reconnectPolicy) {\r\n this._nextKeepAlive = 0;\r\n this._freezeEventListener = () => {\r\n this._logger.log(LogLevel.Warning, \"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep\");\r\n };\r\n Arg.isRequired(connection, \"connection\");\r\n Arg.isRequired(logger, \"logger\");\r\n Arg.isRequired(protocol, \"protocol\");\r\n this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;\r\n this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;\r\n this._logger = logger;\r\n this._protocol = protocol;\r\n this.connection = connection;\r\n this._reconnectPolicy = reconnectPolicy;\r\n this._handshakeProtocol = new HandshakeProtocol();\r\n this.connection.onreceive = (data) => this._processIncomingData(data);\r\n this.connection.onclose = (error) => this._connectionClosed(error);\r\n this._callbacks = {};\r\n this._methods = {};\r\n this._closedCallbacks = [];\r\n this._reconnectingCallbacks = [];\r\n this._reconnectedCallbacks = [];\r\n this._invocationId = 0;\r\n this._receivedHandshakeResponse = false;\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n this._cachedPingMessage = this._protocol.writeMessage({ type: MessageType.Ping });\r\n }\r\n /** @internal */\r\n // Using a public static factory method means we can have a private constructor and an _internal_\r\n // create method that can be used by HubConnectionBuilder. An \"internal\" constructor would just\r\n // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a\r\n // public parameter-less constructor.\r\n static create(connection, logger, protocol, reconnectPolicy) {\r\n return new HubConnection(connection, logger, protocol, reconnectPolicy);\r\n }\r\n /** Indicates the state of the {@link HubConnection} to the server. */\r\n get state() {\r\n return this._connectionState;\r\n }\r\n /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either\r\n * in the disconnected state or if the negotiation step was skipped.\r\n */\r\n get connectionId() {\r\n return this.connection ? (this.connection.connectionId || null) : null;\r\n }\r\n /** Indicates the url of the {@link HubConnection} to the server. */\r\n get baseUrl() {\r\n return this.connection.baseUrl || \"\";\r\n }\r\n /**\r\n * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or\r\n * Reconnecting states.\r\n * @param {string} url The url to connect to.\r\n */\r\n set baseUrl(url) {\r\n if (this._connectionState !== HubConnectionState.Disconnected && this._connectionState !== HubConnectionState.Reconnecting) {\r\n throw new Error(\"The HubConnection must be in the Disconnected or Reconnecting state to change the url.\");\r\n }\r\n if (!url) {\r\n throw new Error(\"The HubConnection url must be a valid url.\");\r\n }\r\n this.connection.baseUrl = url;\r\n }\r\n /** Starts the connection.\r\n *\r\n * @returns {Promise<void>} A Promise that resolves when the connection has been successfully established, or rejects with an error.\r\n */\r\n start() {\r\n this._startPromise = this._startWithStateTransitions();\r\n return this._startPromise;\r\n }\r\n async _startWithStateTransitions() {\r\n if (this._connectionState !== HubConnectionState.Disconnected) {\r\n return Promise.reject(new Error(\"Cannot start a HubConnection that is not in the 'Disconnected' state.\"));\r\n }\r\n this._connectionState = HubConnectionState.Connecting;\r\n this._logger.log(LogLevel.Debug, \"Starting HubConnection.\");\r\n try {\r\n await this._startInternal();\r\n if (Platform.isBrowser) {\r\n // Log when the browser freezes the tab so users know why their connection unexpectedly stopped working\r\n window.document.addEventListener(\"freeze\", this._freezeEventListener);\r\n }\r\n this._connectionState = HubConnectionState.Connected;\r\n this._connectionStarted = true;\r\n this._logger.log(LogLevel.Debug, \"HubConnection connected successfully.\");\r\n }\r\n catch (e) {\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._logger.log(LogLevel.Debug, `HubConnection failed to start successfully because of error '${e}'.`);\r\n return Promise.reject(e);\r\n }\r\n }\r\n async _startInternal() {\r\n this._stopDuringStartError = undefined;\r\n this._receivedHandshakeResponse = false;\r\n // Set up the promise before any connection is (re)started otherwise it could race with received messages\r\n const handshakePromise = new Promise((resolve, reject) => {\r\n this._handshakeResolver = resolve;\r\n this._handshakeRejecter = reject;\r\n });\r\n await this.connection.start(this._protocol.transferFormat);\r\n try {\r\n const handshakeRequest = {\r\n protocol: this._protocol.name,\r\n version: this._protocol.version,\r\n };\r\n this._logger.log(LogLevel.Debug, \"Sending handshake request.\");\r\n await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(handshakeRequest));\r\n this._logger.log(LogLevel.Information, `Using HubProtocol '${this._protocol.name}'.`);\r\n // defensively cleanup timeout in case we receive a message from the server before we finish start\r\n this._cleanupTimeout();\r\n this._resetTimeoutPeriod();\r\n this._resetKeepAliveInterval();\r\n await handshakePromise;\r\n // It's important to check the stopDuringStartError instead of just relying on the handshakePromise\r\n // being rejected on close, because this continuation can run after both the handshake completed successfully\r\n // and the connection was closed.\r\n if (this._stopDuringStartError) {\r\n // It's important to throw instead of returning a rejected promise, because we don't want to allow any state\r\n // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise\r\n // will cause the calling continuation to get scheduled to run later.\r\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\r\n throw this._stopDuringStartError;\r\n }\r\n if (!this.connection.features.inherentKeepAlive) {\r\n await this._sendMessage(this._cachedPingMessage);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Debug, `Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`);\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n // HttpConnection.stop() should not complete until after the onclose callback is invoked.\r\n // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes.\r\n await this.connection.stop(e);\r\n throw e;\r\n }\r\n }\r\n /** Stops the connection.\r\n *\r\n * @returns {Promise<void>} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.\r\n */\r\n async stop() {\r\n // Capture the start promise before the connection might be restarted in an onclose callback.\r\n const startPromise = this._startPromise;\r\n this._stopPromise = this._stopInternal();\r\n await this._stopPromise;\r\n try {\r\n // Awaiting undefined continues immediately\r\n await startPromise;\r\n }\r\n catch (e) {\r\n // This exception is returned to the user as a rejected Promise from the start method.\r\n }\r\n }\r\n _stopInternal(error) {\r\n if (this._connectionState === HubConnectionState.Disconnected) {\r\n this._logger.log(LogLevel.Debug, `Call to HubConnection.stop(${error}) ignored because it is already in the disconnected state.`);\r\n return Promise.resolve();\r\n }\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\r\n return this._stopPromise;\r\n }\r\n this._connectionState = HubConnectionState.Disconnecting;\r\n this._logger.log(LogLevel.Debug, \"Stopping HubConnection.\");\r\n if (this._reconnectDelayHandle) {\r\n // We're in a reconnect delay which means the underlying connection is currently already stopped.\r\n // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and\r\n // fire the onclose callbacks.\r\n this._logger.log(LogLevel.Debug, \"Connection stopped during reconnect delay. Done reconnecting.\");\r\n clearTimeout(this._reconnectDelayHandle);\r\n this._reconnectDelayHandle = undefined;\r\n this._completeClose();\r\n return Promise.resolve();\r\n }\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n this._stopDuringStartError = error || new AbortError(\"The connection was stopped before the hub handshake could complete.\");\r\n // HttpConnection.stop() should not complete until after either HttpConnection.start() fails\r\n // or the onclose callback is invoked. The onclose callback will transition the HubConnection\r\n // to the disconnected state if need be before HttpConnection.stop() completes.\r\n return this.connection.stop(error);\r\n }\r\n /** Invokes a streaming hub method on the server using the specified name and arguments.\r\n *\r\n * @typeparam T The type of the items returned by the server.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {IStreamResult<T>} An object that yields results from the server as they are received.\r\n */\r\n stream(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const invocationDescriptor = this._createStreamInvocation(methodName, args, streamIds);\r\n // eslint-disable-next-line prefer-const\r\n let promiseQueue;\r\n const subject = new Subject();\r\n subject.cancelCallback = () => {\r\n const cancelInvocation = this._createCancelInvocation(invocationDescriptor.invocationId);\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n return promiseQueue.then(() => {\r\n return this._sendWithProtocol(cancelInvocation);\r\n });\r\n };\r\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\r\n if (error) {\r\n subject.error(error);\r\n return;\r\n }\r\n else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n subject.error(new Error(invocationEvent.error));\r\n }\r\n else {\r\n subject.complete();\r\n }\r\n }\r\n else {\r\n subject.next((invocationEvent.item));\r\n }\r\n }\r\n };\r\n promiseQueue = this._sendWithProtocol(invocationDescriptor)\r\n .catch((e) => {\r\n subject.error(e);\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n });\r\n this._launchStreams(streams, promiseQueue);\r\n return subject;\r\n }\r\n _sendMessage(message) {\r\n this._resetKeepAliveInterval();\r\n return this.connection.send(message);\r\n }\r\n /**\r\n * Sends a js object to the server.\r\n * @param message The js object to serialize and send.\r\n */\r\n _sendWithProtocol(message) {\r\n return this._sendMessage(this._protocol.writeMessage(message));\r\n }\r\n /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.\r\n *\r\n * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still\r\n * be processing the invocation.\r\n *\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise<void>} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.\r\n */\r\n send(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const sendPromise = this._sendWithProtocol(this._createInvocation(methodName, args, true, streamIds));\r\n this._launchStreams(streams, sendPromise);\r\n return sendPromise;\r\n }\r\n /** Invokes a hub method on the server using the specified name and arguments.\r\n *\r\n * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise\r\n * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of\r\n * resolving the Promise.\r\n *\r\n * @typeparam T The expected return type.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise<T>} A Promise that resolves with the result of the server method (if any), or rejects with an error.\r\n */\r\n invoke(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const invocationDescriptor = this._createInvocation(methodName, args, false, streamIds);\r\n const p = new Promise((resolve, reject) => {\r\n // invocationId will always have a value for a non-blocking invocation\r\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\r\n if (error) {\r\n reject(error);\r\n return;\r\n }\r\n else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n reject(new Error(invocationEvent.error));\r\n }\r\n else {\r\n resolve(invocationEvent.result);\r\n }\r\n }\r\n else {\r\n reject(new Error(`Unexpected message type: ${invocationEvent.type}`));\r\n }\r\n }\r\n };\r\n const promiseQueue = this._sendWithProtocol(invocationDescriptor)\r\n .catch((e) => {\r\n reject(e);\r\n // invocationId will always have a value for a non-blocking invocation\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n });\r\n this._launchStreams(streams, promiseQueue);\r\n });\r\n return p;\r\n }\r\n on(methodName, newMethod) {\r\n if (!methodName || !newMethod) {\r\n return;\r\n }\r\n methodName = methodName.toLowerCase();\r\n if (!this._methods[methodName]) {\r\n this._methods[methodName] = [];\r\n }\r\n // Preventing adding the same handler multiple times.\r\n if (this._methods[methodName].indexOf(newMethod) !== -1) {\r\n return;\r\n }\r\n this._methods[methodName].push(newMethod);\r\n }\r\n off(methodName, method) {\r\n if (!methodName) {\r\n return;\r\n }\r\n methodName = methodName.toLowerCase();\r\n const handlers = this._methods[methodName];\r\n if (!handlers) {\r\n return;\r\n }\r\n if (method) {\r\n const removeIdx = handlers.indexOf(method);\r\n if (removeIdx !== -1) {\r\n handlers.splice(removeIdx, 1);\r\n if (handlers.length === 0) {\r\n delete this._methods[methodName];\r\n }\r\n }\r\n }\r\n else {\r\n delete this._methods[methodName];\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection is closed.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).\r\n */\r\n onclose(callback) {\r\n if (callback) {\r\n this._closedCallbacks.push(callback);\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection starts reconnecting.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).\r\n */\r\n onreconnecting(callback) {\r\n if (callback) {\r\n this._reconnectingCallbacks.push(callback);\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection successfully reconnects.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.\r\n */\r\n onreconnected(callback) {\r\n if (callback) {\r\n this._reconnectedCallbacks.push(callback);\r\n }\r\n }\r\n _processIncomingData(data) {\r\n this._cleanupTimeout();\r\n if (!this._receivedHandshakeResponse) {\r\n data = this._processHandshakeResponse(data);\r\n this._receivedHandshakeResponse = true;\r\n }\r\n // Data may have all been read when processing handshake response\r\n if (data) {\r\n // Parse the messages\r\n const messages = this._protocol.parseMessages(data, this._logger);\r\n for (const message of messages) {\r\n switch (message.type) {\r\n case MessageType.Invocation:\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._invokeClientMethod(message);\r\n break;\r\n case MessageType.StreamItem:\r\n case MessageType.Completion: {\r\n const callback = this._callbacks[message.invocationId];\r\n if (callback) {\r\n if (message.type === MessageType.Completion) {\r\n delete this._callbacks[message.invocationId];\r\n }\r\n try {\r\n callback(message);\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `Stream callback threw error: ${getErrorString(e)}`);\r\n }\r\n }\r\n break;\r\n }\r\n case MessageType.Ping:\r\n // Don't care about pings\r\n break;\r\n case MessageType.Close: {\r\n this._logger.log(LogLevel.Information, \"Close message received from server.\");\r\n const error = message.error ? new Error(\"Server returned an error on close: \" + message.error) : undefined;\r\n if (message.allowReconnect === true) {\r\n // It feels wrong not to await connection.stop() here, but processIncomingData is called as part of an onreceive callback which is not async,\r\n // this is already the behavior for serverTimeout(), and HttpConnection.Stop() should catch and log all possible exceptions.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.connection.stop(error);\r\n }\r\n else {\r\n // We cannot await stopInternal() here, but subsequent calls to stop() will await this if stopInternal() is still ongoing.\r\n this._stopPromise = this._stopInternal(error);\r\n }\r\n break;\r\n }\r\n default:\r\n this._logger.log(LogLevel.Warning, `Invalid message type: ${message.type}.`);\r\n break;\r\n }\r\n }\r\n }\r\n this._resetTimeoutPeriod();\r\n }\r\n _processHandshakeResponse(data) {\r\n let responseMessage;\r\n let remainingData;\r\n try {\r\n [remainingData, responseMessage] = this._handshakeProtocol.parseHandshakeResponse(data);\r\n }\r\n catch (e) {\r\n const message = \"Error parsing handshake response: \" + e;\r\n this._logger.log(LogLevel.Error, message);\r\n const error = new Error(message);\r\n this._handshakeRejecter(error);\r\n throw error;\r\n }\r\n if (responseMessage.error) {\r\n const message = \"Server returned handshake error: \" + responseMessage.error;\r\n this._logger.log(LogLevel.Error, message);\r\n const error = new Error(message);\r\n this._handshakeRejecter(error);\r\n throw error;\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, \"Server handshake complete.\");\r\n }\r\n this._handshakeResolver();\r\n return remainingData;\r\n }\r\n _resetKeepAliveInterval() {\r\n if (this.connection.features.inherentKeepAlive) {\r\n return;\r\n }\r\n // Set the time we want the next keep alive to be sent\r\n // Timer will be setup on next message receive\r\n this._nextKeepAlive = new Date().getTime() + this.keepAliveIntervalInMilliseconds;\r\n this._cleanupPingTimer();\r\n }\r\n _resetTimeoutPeriod() {\r\n if (!this.connection.features || !this.connection.features.inherentKeepAlive) {\r\n // Set the timeout timer\r\n this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);\r\n // Set keepAlive timer if there isn't one\r\n if (this._pingServerHandle === undefined) {\r\n let nextPing = this._nextKeepAlive - new Date().getTime();\r\n if (nextPing < 0) {\r\n nextPing = 0;\r\n }\r\n // The timer needs to be set from a networking callback to avoid Chrome timer throttling from causing timers to run once a minute\r\n this._pingServerHandle = setTimeout(async () => {\r\n if (this._connectionState === HubConnectionState.Connected) {\r\n try {\r\n await this._sendMessage(this._cachedPingMessage);\r\n }\r\n catch {\r\n // We don't care about the error. It should be seen elsewhere in the client.\r\n // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering\r\n this._cleanupPingTimer();\r\n }\r\n }\r\n }, nextPing);\r\n }\r\n }\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n serverTimeout() {\r\n // The server hasn't talked to us in a while. It doesn't like us anymore ... :(\r\n // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.connection.stop(new Error(\"Server timeout elapsed without receiving a message from the server.\"));\r\n }\r\n async _invokeClientMethod(invocationMessage) {\r\n const methodName = invocationMessage.target.toLowerCase();\r\n const methods = this._methods[methodName];\r\n if (!methods) {\r\n this._logger.log(LogLevel.Warning, `No client method with the name '${methodName}' found.`);\r\n // No handlers provided by client but the server is expecting a response still, so we send an error\r\n if (invocationMessage.invocationId) {\r\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\r\n await this._sendWithProtocol(this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null));\r\n }\r\n return;\r\n }\r\n // Avoid issues with handlers removing themselves thus modifying the list while iterating through it\r\n const methodsCopy = methods.slice();\r\n // Server expects a response\r\n const expectsResponse = invocationMessage.invocationId ? true : false;\r\n // We preserve the last result or exception but still call all handlers\r\n let res;\r\n let exception;\r\n let completionMessage;\r\n for (const m of methodsCopy) {\r\n try {\r\n const prevRes = res;\r\n res = await m.apply(this, invocationMessage.arguments);\r\n if (expectsResponse && res && prevRes) {\r\n this._logger.log(LogLevel.Error, `Multiple results provided for '${methodName}'. Sending error to server.`);\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `Client provided multiple results.`, null);\r\n }\r\n // Ignore exception if we got a result after, the exception will be logged\r\n exception = undefined;\r\n }\r\n catch (e) {\r\n exception = e;\r\n this._logger.log(LogLevel.Error, `A callback for the method '${methodName}' threw error '${e}'.`);\r\n }\r\n }\r\n if (completionMessage) {\r\n await this._sendWithProtocol(completionMessage);\r\n }\r\n else if (expectsResponse) {\r\n // If there is an exception that means either no result was given or a handler after a result threw\r\n if (exception) {\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `${exception}`, null);\r\n }\r\n else if (res !== undefined) {\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, null, res);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\r\n // Client didn't provide a result or throw from a handler, server expects a response so we send an error\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null);\r\n }\r\n await this._sendWithProtocol(completionMessage);\r\n }\r\n else {\r\n if (res) {\r\n this._logger.log(LogLevel.Error, `Result given for '${methodName}' method but server is not expecting a result.`);\r\n }\r\n }\r\n }\r\n _connectionClosed(error) {\r\n this._logger.log(LogLevel.Debug, `HubConnection.connectionClosed(${error}) called while in state ${this._connectionState}.`);\r\n // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet.\r\n this._stopDuringStartError = this._stopDuringStartError || error || new AbortError(\"The underlying connection was closed before the hub handshake could complete.\");\r\n // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it.\r\n // If it has already completed, this should just noop.\r\n if (this._handshakeResolver) {\r\n this._handshakeResolver();\r\n }\r\n this._cancelCallbacksWithError(error || new Error(\"Invocation canceled due to the underlying connection being closed.\"));\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._completeClose(error);\r\n }\r\n else if (this._connectionState === HubConnectionState.Connected && this._reconnectPolicy) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._reconnect(error);\r\n }\r\n else if (this._connectionState === HubConnectionState.Connected) {\r\n this._completeClose(error);\r\n }\r\n // If none of the above if conditions were true were called the HubConnection must be in either:\r\n // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it.\r\n // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt\r\n // and potentially continue the reconnect() loop.\r\n // 3. The Disconnected state in which case we're already done.\r\n }\r\n _completeClose(error) {\r\n if (this._connectionStarted) {\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n if (Platform.isBrowser) {\r\n window.document.removeEventListener(\"freeze\", this._freezeEventListener);\r\n }\r\n try {\r\n this._closedCallbacks.forEach((c) => c.apply(this, [error]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onclose callback called with error '${error}' threw error '${e}'.`);\r\n }\r\n }\r\n }\r\n async _reconnect(error) {\r\n const reconnectStartTime = Date.now();\r\n let previousReconnectAttempts = 0;\r\n let retryError = error !== undefined ? error : new Error(\"Attempting to reconnect due to a unknown error.\");\r\n let nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, 0, retryError);\r\n if (nextRetryDelay === null) {\r\n this._logger.log(LogLevel.Debug, \"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.\");\r\n this._completeClose(error);\r\n return;\r\n }\r\n this._connectionState = HubConnectionState.Reconnecting;\r\n if (error) {\r\n this._logger.log(LogLevel.Information, `Connection reconnecting because of error '${error}'.`);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Information, \"Connection reconnecting.\");\r\n }\r\n if (this._reconnectingCallbacks.length !== 0) {\r\n try {\r\n this._reconnectingCallbacks.forEach((c) => c.apply(this, [error]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onreconnecting callback called with error '${error}' threw error '${e}'.`);\r\n }\r\n // Exit early if an onreconnecting callback called connection.stop().\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.\");\r\n return;\r\n }\r\n }\r\n while (nextRetryDelay !== null) {\r\n this._logger.log(LogLevel.Information, `Reconnect attempt number ${previousReconnectAttempts} will start in ${nextRetryDelay} ms.`);\r\n await new Promise((resolve) => {\r\n this._reconnectDelayHandle = setTimeout(resolve, nextRetryDelay);\r\n });\r\n this._reconnectDelayHandle = undefined;\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state during reconnect delay. Done reconnecting.\");\r\n return;\r\n }\r\n try {\r\n await this._startInternal();\r\n this._connectionState = HubConnectionState.Connected;\r\n this._logger.log(LogLevel.Information, \"HubConnection reconnected successfully.\");\r\n if (this._reconnectedCallbacks.length !== 0) {\r\n try {\r\n this._reconnectedCallbacks.forEach((c) => c.apply(this, [this.connection.connectionId]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`);\r\n }\r\n }\r\n return;\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Information, `Reconnect attempt failed because of error '${e}'.`);\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`);\r\n // The TypeScript compiler thinks that connectionState must be Connected here. The TypeScript compiler is wrong.\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._completeClose();\r\n }\r\n return;\r\n }\r\n retryError = e instanceof Error ? e : new Error(e.toString());\r\n nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);\r\n }\r\n }\r\n this._logger.log(LogLevel.Information, `Reconnect retries have been exhausted after ${Date.now() - reconnectStartTime} ms and ${previousReconnectAttempts} failed attempts. Connection disconnecting.`);\r\n this._completeClose();\r\n }\r\n _getNextRetryDelay(previousRetryCount, elapsedMilliseconds, retryReason) {\r\n try {\r\n return this._reconnectPolicy.nextRetryDelayInMilliseconds({\r\n elapsedMilliseconds,\r\n previousRetryCount,\r\n retryReason,\r\n });\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${previousRetryCount}, ${elapsedMilliseconds}) threw error '${e}'.`);\r\n return null;\r\n }\r\n }\r\n _cancelCallbacksWithError(error) {\r\n const callbacks = this._callbacks;\r\n this._callbacks = {};\r\n Object.keys(callbacks)\r\n .forEach((key) => {\r\n const callback = callbacks[key];\r\n try {\r\n callback(null, error);\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `Stream 'error' callback called with '${error}' threw error: ${getErrorString(e)}`);\r\n }\r\n });\r\n }\r\n _cleanupPingTimer() {\r\n if (this._pingServerHandle) {\r\n clearTimeout(this._pingServerHandle);\r\n this._pingServerHandle = undefined;\r\n }\r\n }\r\n _cleanupTimeout() {\r\n if (this._timeoutHandle) {\r\n clearTimeout(this._timeoutHandle);\r\n }\r\n }\r\n _createInvocation(methodName, args, nonblocking, streamIds) {\r\n if (nonblocking) {\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n else {\r\n const invocationId = this._invocationId;\r\n this._invocationId++;\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n }\r\n _launchStreams(streams, promiseQueue) {\r\n if (streams.length === 0) {\r\n return;\r\n }\r\n // Synchronize stream data so they arrive in-order on the server\r\n if (!promiseQueue) {\r\n promiseQueue = Promise.resolve();\r\n }\r\n // We want to iterate over the keys, since the keys are the stream ids\r\n // eslint-disable-next-line guard-for-in\r\n for (const streamId in streams) {\r\n streams[streamId].subscribe({\r\n complete: () => {\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId)));\r\n },\r\n error: (err) => {\r\n let message;\r\n if (err instanceof Error) {\r\n message = err.message;\r\n }\r\n else if (err && err.toString) {\r\n message = err.toString();\r\n }\r\n else {\r\n message = \"Unknown error\";\r\n }\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId, message)));\r\n },\r\n next: (item) => {\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createStreamItemMessage(streamId, item)));\r\n },\r\n });\r\n }\r\n }\r\n _replaceStreamingParams(args) {\r\n const streams = [];\r\n const streamIds = [];\r\n for (let i = 0; i < args.length; i++) {\r\n const argument = args[i];\r\n if (this._isObservable(argument)) {\r\n const streamId = this._invocationId;\r\n this._invocationId++;\r\n // Store the stream for later use\r\n streams[streamId] = argument;\r\n streamIds.push(streamId.toString());\r\n // remove stream from args\r\n args.splice(i, 1);\r\n }\r\n }\r\n return [streams, streamIds];\r\n }\r\n _isObservable(arg) {\r\n // This allows other stream implementations to just work (like rxjs)\r\n return arg && arg.subscribe && typeof arg.subscribe === \"function\";\r\n }\r\n _createStreamInvocation(methodName, args, streamIds) {\r\n const invocationId = this._invocationId;\r\n this._invocationId++;\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n }\r\n _createCancelInvocation(id) {\r\n return {\r\n invocationId: id,\r\n type: MessageType.CancelInvocation,\r\n };\r\n }\r\n _createStreamItemMessage(id, item) {\r\n return {\r\n invocationId: id,\r\n item,\r\n type: MessageType.StreamItem,\r\n };\r\n }\r\n _createCompletionMessage(id, error, result) {\r\n if (error) {\r\n return {\r\n error,\r\n invocationId: id,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n return {\r\n invocationId: id,\r\n result,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n}\r\n//# sourceMappingURL=HubConnection.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** A logger that does nothing when log messages are sent to it. */\r\nexport class NullLogger {\r\n constructor() { }\r\n /** @inheritDoc */\r\n // eslint-disable-next-line\r\n log(_logLevel, _message) {\r\n }\r\n}\r\n/** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */\r\nNullLogger.instance = new NullLogger();\r\n//# sourceMappingURL=Loggers.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { NullLogger } from \"./Loggers\";\r\n// Version token that will be replaced by the prepack command\r\n/** The version of the SignalR client. */\r\nexport const VERSION = \"7.0.0\";\r\n/** @private */\r\nexport class Arg {\r\n static isRequired(val, name) {\r\n if (val === null || val === undefined) {\r\n throw new Error(`The '${name}' argument is required.`);\r\n }\r\n }\r\n static isNotEmpty(val, name) {\r\n if (!val || val.match(/^\\s*$/)) {\r\n throw new Error(`The '${name}' argument should not be empty.`);\r\n }\r\n }\r\n static isIn(val, values, name) {\r\n // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.\r\n if (!(val in values)) {\r\n throw new Error(`Unknown ${name} value: ${val}.`);\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport class Platform {\r\n // react-native has a window but no document so we should check both\r\n static get isBrowser() {\r\n return typeof window === \"object\" && typeof window.document === \"object\";\r\n }\r\n // WebWorkers don't have a window object so the isBrowser check would fail\r\n static get isWebWorker() {\r\n return typeof self === \"object\" && \"importScripts\" in self;\r\n }\r\n // react-native has a window but no document\r\n static get isReactNative() {\r\n return typeof window === \"object\" && typeof window.document === \"undefined\";\r\n }\r\n // Node apps shouldn't have a window object, but WebWorkers don't either\r\n // so we need to check for both WebWorker and window\r\n static get isNode() {\r\n return !this.isBrowser && !this.isWebWorker && !this.isReactNative;\r\n }\r\n}\r\n/** @private */\r\nexport function getDataDetail(data, includeContent) {\r\n let detail = \"\";\r\n if (isArrayBuffer(data)) {\r\n detail = `Binary data of length ${data.byteLength}`;\r\n if (includeContent) {\r\n detail += `. Content: '${formatArrayBuffer(data)}'`;\r\n }\r\n }\r\n else if (typeof data === \"string\") {\r\n detail = `String data of length ${data.length}`;\r\n if (includeContent) {\r\n detail += `. Content: '${data}'`;\r\n }\r\n }\r\n return detail;\r\n}\r\n/** @private */\r\nexport function formatArrayBuffer(data) {\r\n const view = new Uint8Array(data);\r\n // Uint8Array.map only supports returning another Uint8Array?\r\n let str = \"\";\r\n view.forEach((num) => {\r\n const pad = num < 16 ? \"0\" : \"\";\r\n str += `0x${pad}${num.toString(16)} `;\r\n });\r\n // Trim of trailing space.\r\n return str.substr(0, str.length - 1);\r\n}\r\n// Also in signalr-protocol-msgpack/Utils.ts\r\n/** @private */\r\nexport function isArrayBuffer(val) {\r\n return val && typeof ArrayBuffer !== \"undefined\" &&\r\n (val instanceof ArrayBuffer ||\r\n // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof\r\n (val.constructor && val.constructor.name === \"ArrayBuffer\"));\r\n}\r\n/** @private */\r\nexport async function sendMessage(logger, transportName, httpClient, url, content, options) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n logger.log(LogLevel.Trace, `(${transportName} transport) sending data. ${getDataDetail(content, options.logMessageContent)}.`);\r\n const responseType = isArrayBuffer(content) ? \"arraybuffer\" : \"text\";\r\n const response = await httpClient.post(url, {\r\n content,\r\n headers: { ...headers, ...options.headers },\r\n responseType,\r\n timeout: options.timeout,\r\n withCredentials: options.withCredentials,\r\n });\r\n logger.log(LogLevel.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`);\r\n}\r\n/** @private */\r\nexport function createLogger(logger) {\r\n if (logger === undefined) {\r\n return new ConsoleLogger(LogLevel.Information);\r\n }\r\n if (logger === null) {\r\n return NullLogger.instance;\r\n }\r\n if (logger.log !== undefined) {\r\n return logger;\r\n }\r\n return new ConsoleLogger(logger);\r\n}\r\n/** @private */\r\nexport class SubjectSubscription {\r\n constructor(subject, observer) {\r\n this._subject = subject;\r\n this._observer = observer;\r\n }\r\n dispose() {\r\n const index = this._subject.observers.indexOf(this._observer);\r\n if (index > -1) {\r\n this._subject.observers.splice(index, 1);\r\n }\r\n if (this._subject.observers.length === 0 && this._subject.cancelCallback) {\r\n this._subject.cancelCallback().catch((_) => { });\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport class ConsoleLogger {\r\n constructor(minimumLogLevel) {\r\n this._minLevel = minimumLogLevel;\r\n this.out = console;\r\n }\r\n log(logLevel, message) {\r\n if (logLevel >= this._minLevel) {\r\n const msg = `[${new Date().toISOString()}] ${LogLevel[logLevel]}: ${message}`;\r\n switch (logLevel) {\r\n case LogLevel.Critical:\r\n case LogLevel.Error:\r\n this.out.error(msg);\r\n break;\r\n case LogLevel.Warning:\r\n this.out.warn(msg);\r\n break;\r\n case LogLevel.Information:\r\n this.out.info(msg);\r\n break;\r\n default:\r\n // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug\r\n this.out.log(msg);\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport function getUserAgentHeader() {\r\n let userAgentHeaderName = \"X-SignalR-User-Agent\";\r\n if (Platform.isNode) {\r\n userAgentHeaderName = \"User-Agent\";\r\n }\r\n return [userAgentHeaderName, constructUserAgent(VERSION, getOsName(), getRuntime(), getRuntimeVersion())];\r\n}\r\n/** @private */\r\nexport function constructUserAgent(version, os, runtime, runtimeVersion) {\r\n // Microsoft SignalR/[Version] ([Detailed Version]; [Operating System]; [Runtime]; [Runtime Version])\r\n let userAgent = \"Microsoft SignalR/\";\r\n const majorAndMinor = version.split(\".\");\r\n userAgent += `${majorAndMinor[0]}.${majorAndMinor[1]}`;\r\n userAgent += ` (${version}; `;\r\n if (os && os !== \"\") {\r\n userAgent += `${os}; `;\r\n }\r\n else {\r\n userAgent += \"Unknown OS; \";\r\n }\r\n userAgent += `${runtime}`;\r\n if (runtimeVersion) {\r\n userAgent += `; ${runtimeVersion}`;\r\n }\r\n else {\r\n userAgent += \"; Unknown Runtime Version\";\r\n }\r\n userAgent += \")\";\r\n return userAgent;\r\n}\r\n// eslint-disable-next-line spaced-comment\r\n/*#__PURE__*/ function getOsName() {\r\n if (Platform.isNode) {\r\n switch (process.platform) {\r\n case \"win32\":\r\n return \"Windows NT\";\r\n case \"darwin\":\r\n return \"macOS\";\r\n case \"linux\":\r\n return \"Linux\";\r\n default:\r\n return process.platform;\r\n }\r\n }\r\n else {\r\n return \"\";\r\n }\r\n}\r\n// eslint-disable-next-line spaced-comment\r\n/*#__PURE__*/ function getRuntimeVersion() {\r\n if (Platform.isNode) {\r\n return process.versions.node;\r\n }\r\n return undefined;\r\n}\r\nfunction getRuntime() {\r\n if (Platform.isNode) {\r\n return \"NodeJS\";\r\n }\r\n else {\r\n return \"Browser\";\r\n }\r\n}\r\n/** @private */\r\nexport function getErrorString(e) {\r\n if (e.stack) {\r\n return e.stack;\r\n }\r\n else if (e.message) {\r\n return e.message;\r\n }\r\n return `${e}`;\r\n}\r\n/** @private */\r\nexport function getGlobalThis() {\r\n // globalThis is semi-new and not available in Node until v12\r\n if (typeof globalThis !== \"undefined\") {\r\n return globalThis;\r\n }\r\n if (typeof self !== \"undefined\") {\r\n return self;\r\n }\r\n if (typeof window !== \"undefined\") {\r\n return window;\r\n }\r\n if (typeof global !== \"undefined\") {\r\n return global;\r\n }\r\n throw new Error(\"could not find global\");\r\n}\r\n//# sourceMappingURL=Utils.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { Platform, getGlobalThis, isArrayBuffer } from \"./Utils\";\r\nexport class FetchHttpClient extends HttpClient {\r\n constructor(logger) {\r\n super();\r\n this._logger = logger;\r\n if (typeof fetch === \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n // Cookies aren't automatically handled in Node so we need to add a CookieJar to preserve cookies across requests\r\n this._jar = new (requireFunc(\"tough-cookie\")).CookieJar();\r\n this._fetchType = requireFunc(\"node-fetch\");\r\n // node-fetch doesn't have a nice API for getting and setting cookies\r\n // fetch-cookie will wrap a fetch implementation with a default CookieJar or a provided one\r\n this._fetchType = requireFunc(\"fetch-cookie\")(this._fetchType, this._jar);\r\n }\r\n else {\r\n this._fetchType = fetch.bind(getGlobalThis());\r\n }\r\n if (typeof AbortController === \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n // Node needs EventListener methods on AbortController which our custom polyfill doesn't provide\r\n this._abortControllerType = requireFunc(\"abort-controller\");\r\n }\r\n else {\r\n this._abortControllerType = AbortController;\r\n }\r\n }\r\n /** @inheritDoc */\r\n async send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n throw new AbortError();\r\n }\r\n if (!request.method) {\r\n throw new Error(\"No method defined.\");\r\n }\r\n if (!request.url) {\r\n throw new Error(\"No url defined.\");\r\n }\r\n const abortController = new this._abortControllerType();\r\n let error;\r\n // Hook our abortSignal into the abort controller\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = () => {\r\n abortController.abort();\r\n error = new AbortError();\r\n };\r\n }\r\n // If a timeout has been passed in, setup a timeout to call abort\r\n // Type needs to be any to fit window.setTimeout and NodeJS.setTimeout\r\n let timeoutId = null;\r\n if (request.timeout) {\r\n const msTimeout = request.timeout;\r\n timeoutId = setTimeout(() => {\r\n abortController.abort();\r\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\r\n error = new TimeoutError();\r\n }, msTimeout);\r\n }\r\n if (request.content === \"\") {\r\n request.content = undefined;\r\n }\r\n if (request.content) {\r\n // Explicitly setting the Content-Type header for React Native on Android platform.\r\n request.headers = request.headers || {};\r\n if (isArrayBuffer(request.content)) {\r\n request.headers[\"Content-Type\"] = \"application/octet-stream\";\r\n }\r\n else {\r\n request.headers[\"Content-Type\"] = \"text/plain;charset=UTF-8\";\r\n }\r\n }\r\n let response;\r\n try {\r\n response = await this._fetchType(request.url, {\r\n body: request.content,\r\n cache: \"no-cache\",\r\n credentials: request.withCredentials === true ? \"include\" : \"same-origin\",\r\n headers: {\r\n \"X-Requested-With\": \"XMLHttpRequest\",\r\n ...request.headers,\r\n },\r\n method: request.method,\r\n mode: \"cors\",\r\n redirect: \"follow\",\r\n signal: abortController.signal,\r\n });\r\n }\r\n catch (e) {\r\n if (error) {\r\n throw error;\r\n }\r\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${e}.`);\r\n throw e;\r\n }\r\n finally {\r\n if (timeoutId) {\r\n clearTimeout(timeoutId);\r\n }\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = null;\r\n }\r\n }\r\n if (!response.ok) {\r\n const errorMessage = await deserializeContent(response, \"text\");\r\n throw new HttpError(errorMessage || response.statusText, response.status);\r\n }\r\n const content = deserializeContent(response, request.responseType);\r\n const payload = await content;\r\n return new HttpResponse(response.status, response.statusText, payload);\r\n }\r\n getCookieString(url) {\r\n let cookies = \"\";\r\n if (Platform.isNode && this._jar) {\r\n // @ts-ignore: unused variable\r\n this._jar.getCookies(url, (e, c) => cookies = c.join(\"; \"));\r\n }\r\n return cookies;\r\n }\r\n}\r\nfunction deserializeContent(response, responseType) {\r\n let content;\r\n switch (responseType) {\r\n case \"arraybuffer\":\r\n content = response.arrayBuffer();\r\n break;\r\n case \"text\":\r\n content = response.text();\r\n break;\r\n case \"blob\":\r\n case \"document\":\r\n case \"json\":\r\n throw new Error(`${responseType} is not supported.`);\r\n default:\r\n content = response.text();\r\n break;\r\n }\r\n return content;\r\n}\r\n//# sourceMappingURL=FetchHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\nexport class XhrHttpClient extends HttpClient {\r\n constructor(logger) {\r\n super();\r\n this._logger = logger;\r\n }\r\n /** @inheritDoc */\r\n send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(request.method, request.url, true);\r\n xhr.withCredentials = request.withCredentials === undefined ? true : request.withCredentials;\r\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\r\n if (request.content === \"\") {\r\n request.content = undefined;\r\n }\r\n if (request.content) {\r\n // Explicitly setting the Content-Type header for React Native on Android platform.\r\n if (isArrayBuffer(request.content)) {\r\n xhr.setRequestHeader(\"Content-Type\", \"application/octet-stream\");\r\n }\r\n else {\r\n xhr.setRequestHeader(\"Content-Type\", \"text/plain;charset=UTF-8\");\r\n }\r\n }\r\n const headers = request.headers;\r\n if (headers) {\r\n Object.keys(headers)\r\n .forEach((header) => {\r\n xhr.setRequestHeader(header, headers[header]);\r\n });\r\n }\r\n if (request.responseType) {\r\n xhr.responseType = request.responseType;\r\n }\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = () => {\r\n xhr.abort();\r\n reject(new AbortError());\r\n };\r\n }\r\n if (request.timeout) {\r\n xhr.timeout = request.timeout;\r\n }\r\n xhr.onload = () => {\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = null;\r\n }\r\n if (xhr.status >= 200 && xhr.status < 300) {\r\n resolve(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));\r\n }\r\n else {\r\n reject(new HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));\r\n }\r\n };\r\n xhr.onerror = () => {\r\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${xhr.status}: ${xhr.statusText}.`);\r\n reject(new HttpError(xhr.statusText, xhr.status));\r\n };\r\n xhr.ontimeout = () => {\r\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\r\n reject(new TimeoutError());\r\n };\r\n xhr.send(request.content);\r\n });\r\n }\r\n}\r\n//# sourceMappingURL=XhrHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError } from \"./Errors\";\r\nimport { FetchHttpClient } from \"./FetchHttpClient\";\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { Platform } from \"./Utils\";\r\nimport { XhrHttpClient } from \"./XhrHttpClient\";\r\n/** Default implementation of {@link @microsoft/signalr.HttpClient}. */\r\nexport class DefaultHttpClient extends HttpClient {\r\n /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */\r\n constructor(logger) {\r\n super();\r\n if (typeof fetch !== \"undefined\" || Platform.isNode) {\r\n this._httpClient = new FetchHttpClient(logger);\r\n }\r\n else if (typeof XMLHttpRequest !== \"undefined\") {\r\n this._httpClient = new XhrHttpClient(logger);\r\n }\r\n else {\r\n throw new Error(\"No usable HttpClient found.\");\r\n }\r\n }\r\n /** @inheritDoc */\r\n send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n return this._httpClient.send(request);\r\n }\r\n getCookieString(url) {\r\n return this._httpClient.getCookieString(url);\r\n }\r\n}\r\n//# sourceMappingURL=DefaultHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\r\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\r\n// it's a very new API right now.\r\n// Not exported from index.\r\n/** @private */\r\nexport class AbortController {\r\n constructor() {\r\n this._isAborted = false;\r\n this.onabort = null;\r\n }\r\n abort() {\r\n if (!this._isAborted) {\r\n this._isAborted = true;\r\n if (this.onabort) {\r\n this.onabort();\r\n }\r\n }\r\n }\r\n get signal() {\r\n return this;\r\n }\r\n get aborted() {\r\n return this._isAborted;\r\n }\r\n}\r\n//# sourceMappingURL=AbortController.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortController } from \"./AbortController\";\r\nimport { HttpError, TimeoutError } from \"./Errors\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, sendMessage } from \"./Utils\";\r\n// Not exported from 'index', this type is internal.\r\n/** @private */\r\nexport class LongPollingTransport {\r\n constructor(httpClient, logger, options) {\r\n this._httpClient = httpClient;\r\n this._logger = logger;\r\n this._pollAbort = new AbortController();\r\n this._options = options;\r\n this._running = false;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n // This is an internal type, not exported from 'index' so this is really just internal.\r\n get pollAborted() {\r\n return this._pollAbort.aborted;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._url = url;\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Connecting.\");\r\n // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property)\r\n if (transferFormat === TransferFormat.Binary &&\r\n (typeof XMLHttpRequest !== \"undefined\" && typeof new XMLHttpRequest().responseType !== \"string\")) {\r\n throw new Error(\"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.\");\r\n }\r\n const [name, value] = getUserAgentHeader();\r\n const headers = { [name]: value, ...this._options.headers };\r\n const pollOptions = {\r\n abortSignal: this._pollAbort.signal,\r\n headers,\r\n timeout: 100000,\r\n withCredentials: this._options.withCredentials,\r\n };\r\n if (transferFormat === TransferFormat.Binary) {\r\n pollOptions.responseType = \"arraybuffer\";\r\n }\r\n // Make initial long polling request\r\n // Server uses first long polling request to finish initializing connection and it returns without data\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this._httpClient.get(pollUrl, pollOptions);\r\n if (response.statusCode !== 200) {\r\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n // Mark running as false so that the poll immediately ends and runs the close logic\r\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this._running = false;\r\n }\r\n else {\r\n this._running = true;\r\n }\r\n this._receiving = this._poll(this._url, pollOptions);\r\n }\r\n async _poll(url, pollOptions) {\r\n try {\r\n while (this._running) {\r\n try {\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this._httpClient.get(pollUrl, pollOptions);\r\n if (response.statusCode === 204) {\r\n this._logger.log(LogLevel.Information, \"(LongPolling transport) Poll terminated by server.\");\r\n this._running = false;\r\n }\r\n else if (response.statusCode !== 200) {\r\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n // Unexpected status code\r\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this._running = false;\r\n }\r\n else {\r\n // Process the response\r\n if (response.content) {\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this._options.logMessageContent)}.`);\r\n if (this.onreceive) {\r\n this.onreceive(response.content);\r\n }\r\n }\r\n else {\r\n // This is another way timeout manifest.\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n }\r\n }\r\n }\r\n catch (e) {\r\n if (!this._running) {\r\n // Log but disregard errors that occur after stopping\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) Poll errored after shutdown: ${e.message}`);\r\n }\r\n else {\r\n if (e instanceof TimeoutError) {\r\n // Ignore timeouts and reissue the poll.\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n }\r\n else {\r\n // Close the connection with the error as the result.\r\n this._closeError = e;\r\n this._running = false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Polling complete.\");\r\n // We will reach here with pollAborted==false when the server returned a response causing the transport to stop.\r\n // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent.\r\n if (!this.pollAborted) {\r\n this._raiseOnClose();\r\n }\r\n }\r\n }\r\n async send(data) {\r\n if (!this._running) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this._logger, \"LongPolling\", this._httpClient, this._url, data, this._options);\r\n }\r\n async stop() {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stopping polling.\");\r\n // Tell receiving loop to stop, abort any current request, and then wait for it to finish\r\n this._running = false;\r\n this._pollAbort.abort();\r\n try {\r\n await this._receiving;\r\n // Send DELETE to clean up long polling on the server\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n const deleteOptions = {\r\n headers: { ...headers, ...this._options.headers },\r\n timeout: this._options.timeout,\r\n withCredentials: this._options.withCredentials,\r\n };\r\n await this._httpClient.delete(this._url, deleteOptions);\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) DELETE request sent.\");\r\n }\r\n finally {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stop finished.\");\r\n // Raise close event here instead of in polling\r\n // It needs to happen after the DELETE request is sent\r\n this._raiseOnClose();\r\n }\r\n }\r\n _raiseOnClose() {\r\n if (this.onclose) {\r\n let logMessage = \"(LongPolling transport) Firing onclose event.\";\r\n if (this._closeError) {\r\n logMessage += \" Error: \" + this._closeError;\r\n }\r\n this._logger.log(LogLevel.Trace, logMessage);\r\n this.onclose(this._closeError);\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=LongPollingTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, Platform, sendMessage } from \"./Utils\";\r\n/** @private */\r\nexport class ServerSentEventsTransport {\r\n constructor(httpClient, accessToken, logger, options) {\r\n this._httpClient = httpClient;\r\n this._accessToken = accessToken;\r\n this._logger = logger;\r\n this._options = options;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Trace, \"(SSE transport) Connecting.\");\r\n // set url before accessTokenFactory because this._url is only for send and we set the auth header instead of the query string for send\r\n this._url = url;\r\n if (this._accessToken) {\r\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(this._accessToken)}`;\r\n }\r\n return new Promise((resolve, reject) => {\r\n let opened = false;\r\n if (transferFormat !== TransferFormat.Text) {\r\n reject(new Error(\"The Server-Sent Events transport only supports the 'Text' transfer format\"));\r\n return;\r\n }\r\n let eventSource;\r\n if (Platform.isBrowser || Platform.isWebWorker) {\r\n eventSource = new this._options.EventSource(url, { withCredentials: this._options.withCredentials });\r\n }\r\n else {\r\n // Non-browser passes cookies via the dictionary\r\n const cookies = this._httpClient.getCookieString(url);\r\n const headers = {};\r\n headers.Cookie = cookies;\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n eventSource = new this._options.EventSource(url, { withCredentials: this._options.withCredentials, headers: { ...headers, ...this._options.headers } });\r\n }\r\n try {\r\n eventSource.onmessage = (e) => {\r\n if (this.onreceive) {\r\n try {\r\n this._logger.log(LogLevel.Trace, `(SSE transport) data received. ${getDataDetail(e.data, this._options.logMessageContent)}.`);\r\n this.onreceive(e.data);\r\n }\r\n catch (error) {\r\n this._close(error);\r\n return;\r\n }\r\n }\r\n };\r\n // @ts-ignore: not using event on purpose\r\n eventSource.onerror = (e) => {\r\n // EventSource doesn't give any useful information about server side closes.\r\n if (opened) {\r\n this._close();\r\n }\r\n else {\r\n reject(new Error(\"EventSource failed to connect. The connection could not be found on the server,\"\r\n + \" either the connection ID is not present on the server, or a proxy is refusing/buffering the connection.\"\r\n + \" If you have multiple servers check that sticky sessions are enabled.\"));\r\n }\r\n };\r\n eventSource.onopen = () => {\r\n this._logger.log(LogLevel.Information, `SSE connected to ${this._url}`);\r\n this._eventSource = eventSource;\r\n opened = true;\r\n resolve();\r\n };\r\n }\r\n catch (e) {\r\n reject(e);\r\n return;\r\n }\r\n });\r\n }\r\n async send(data) {\r\n if (!this._eventSource) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this._logger, \"SSE\", this._httpClient, this._url, data, this._options);\r\n }\r\n stop() {\r\n this._close();\r\n return Promise.resolve();\r\n }\r\n _close(e) {\r\n if (this._eventSource) {\r\n this._eventSource.close();\r\n this._eventSource = undefined;\r\n if (this.onclose) {\r\n this.onclose(e);\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=ServerSentEventsTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HeaderNames } from \"./HeaderNames\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, Platform } from \"./Utils\";\r\n/** @private */\r\nexport class WebSocketTransport {\r\n constructor(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor, headers) {\r\n this._logger = logger;\r\n this._accessTokenFactory = accessTokenFactory;\r\n this._logMessageContent = logMessageContent;\r\n this._webSocketConstructor = webSocketConstructor;\r\n this._httpClient = httpClient;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n this._headers = headers;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) Connecting.\");\r\n let token;\r\n if (this._accessTokenFactory) {\r\n token = await this._accessTokenFactory();\r\n }\r\n return new Promise((resolve, reject) => {\r\n url = url.replace(/^http/, \"ws\");\r\n let webSocket;\r\n const cookies = this._httpClient.getCookieString(url);\r\n let opened = false;\r\n if (Platform.isNode || Platform.isReactNative) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n if (token) {\r\n headers[HeaderNames.Authorization] = `Bearer ${token}`;\r\n }\r\n if (cookies) {\r\n headers[HeaderNames.Cookie] = cookies;\r\n }\r\n // Only pass headers when in non-browser environments\r\n webSocket = new this._webSocketConstructor(url, undefined, {\r\n headers: { ...headers, ...this._headers },\r\n });\r\n }\r\n else {\r\n if (token) {\r\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(token)}`;\r\n }\r\n }\r\n if (!webSocket) {\r\n // Chrome is not happy with passing 'undefined' as protocol\r\n webSocket = new this._webSocketConstructor(url);\r\n }\r\n if (transferFormat === TransferFormat.Binary) {\r\n webSocket.binaryType = \"arraybuffer\";\r\n }\r\n webSocket.onopen = (_event) => {\r\n this._logger.log(LogLevel.Information, `WebSocket connected to ${url}.`);\r\n this._webSocket = webSocket;\r\n opened = true;\r\n resolve();\r\n };\r\n webSocket.onerror = (event) => {\r\n let error = null;\r\n // ErrorEvent is a browser only type we need to check if the type exists before using it\r\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\r\n error = event.error;\r\n }\r\n else {\r\n error = \"There was an error with the transport\";\r\n }\r\n this._logger.log(LogLevel.Information, `(WebSockets transport) ${error}.`);\r\n };\r\n webSocket.onmessage = (message) => {\r\n this._logger.log(LogLevel.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this._logMessageContent)}.`);\r\n if (this.onreceive) {\r\n try {\r\n this.onreceive(message.data);\r\n }\r\n catch (error) {\r\n this._close(error);\r\n return;\r\n }\r\n }\r\n };\r\n webSocket.onclose = (event) => {\r\n // Don't call close handler if connection was never established\r\n // We'll reject the connect call instead\r\n if (opened) {\r\n this._close(event);\r\n }\r\n else {\r\n let error = null;\r\n // ErrorEvent is a browser only type we need to check if the type exists before using it\r\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\r\n error = event.error;\r\n }\r\n else {\r\n error = \"WebSocket failed to connect. The connection could not be found on the server,\"\r\n + \" either the endpoint may not be a SignalR endpoint,\"\r\n + \" the connection ID is not present on the server, or there is a proxy blocking WebSockets.\"\r\n + \" If you have multiple servers check that sticky sessions are enabled.\";\r\n }\r\n reject(new Error(error));\r\n }\r\n };\r\n });\r\n }\r\n send(data) {\r\n if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {\r\n this._logger.log(LogLevel.Trace, `(WebSockets transport) sending data. ${getDataDetail(data, this._logMessageContent)}.`);\r\n this._webSocket.send(data);\r\n return Promise.resolve();\r\n }\r\n return Promise.reject(\"WebSocket is not in the OPEN state\");\r\n }\r\n stop() {\r\n if (this._webSocket) {\r\n // Manually invoke onclose callback inline so we know the HttpConnection was closed properly before returning\r\n // This also solves an issue where websocket.onclose could take 18+ seconds to trigger during network disconnects\r\n this._close(undefined);\r\n }\r\n return Promise.resolve();\r\n }\r\n _close(event) {\r\n // webSocket will be null if the transport did not start successfully\r\n if (this._webSocket) {\r\n // Clear websocket handlers because we are considering the socket closed now\r\n this._webSocket.onclose = () => { };\r\n this._webSocket.onmessage = () => { };\r\n this._webSocket.onerror = () => { };\r\n this._webSocket.close();\r\n this._webSocket = undefined;\r\n }\r\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) socket closed.\");\r\n if (this.onclose) {\r\n if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1000)) {\r\n this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason || \"no reason given\"}).`));\r\n }\r\n else if (event instanceof Error) {\r\n this.onclose(event);\r\n }\r\n else {\r\n this.onclose();\r\n }\r\n }\r\n }\r\n _isCloseEvent(event) {\r\n return event && typeof event.wasClean === \"boolean\" && typeof event.code === \"number\";\r\n }\r\n}\r\n//# sourceMappingURL=WebSocketTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AccessTokenHttpClient } from \"./AccessTokenHttpClient\";\r\nimport { DefaultHttpClient } from \"./DefaultHttpClient\";\r\nimport { AggregateErrors, DisabledTransportError, FailedToNegotiateWithServerError, FailedToStartTransportError, HttpError, UnsupportedTransportError, AbortError } from \"./Errors\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { HttpTransportType, TransferFormat } from \"./ITransport\";\r\nimport { LongPollingTransport } from \"./LongPollingTransport\";\r\nimport { ServerSentEventsTransport } from \"./ServerSentEventsTransport\";\r\nimport { Arg, createLogger, getUserAgentHeader, Platform } from \"./Utils\";\r\nimport { WebSocketTransport } from \"./WebSocketTransport\";\r\nconst MAX_REDIRECTS = 100;\r\n/** @private */\r\nexport class HttpConnection {\r\n constructor(url, options = {}) {\r\n this._stopPromiseResolver = () => { };\r\n this.features = {};\r\n this._negotiateVersion = 1;\r\n Arg.isRequired(url, \"url\");\r\n this._logger = createLogger(options.logger);\r\n this.baseUrl = this._resolveUrl(url);\r\n options = options || {};\r\n options.logMessageContent = options.logMessageContent === undefined ? false : options.logMessageContent;\r\n if (typeof options.withCredentials === \"boolean\" || options.withCredentials === undefined) {\r\n options.withCredentials = options.withCredentials === undefined ? true : options.withCredentials;\r\n }\r\n else {\r\n throw new Error(\"withCredentials option was not a 'boolean' or 'undefined' value\");\r\n }\r\n options.timeout = options.timeout === undefined ? 100 * 1000 : options.timeout;\r\n let webSocketModule = null;\r\n let eventSourceModule = null;\r\n if (Platform.isNode && typeof require !== \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n webSocketModule = requireFunc(\"ws\");\r\n eventSourceModule = requireFunc(\"eventsource\");\r\n }\r\n if (!Platform.isNode && typeof WebSocket !== \"undefined\" && !options.WebSocket) {\r\n options.WebSocket = WebSocket;\r\n }\r\n else if (Platform.isNode && !options.WebSocket) {\r\n if (webSocketModule) {\r\n options.WebSocket = webSocketModule;\r\n }\r\n }\r\n if (!Platform.isNode && typeof EventSource !== \"undefined\" && !options.EventSource) {\r\n options.EventSource = EventSource;\r\n }\r\n else if (Platform.isNode && !options.EventSource) {\r\n if (typeof eventSourceModule !== \"undefined\") {\r\n options.EventSource = eventSourceModule;\r\n }\r\n }\r\n this._httpClient = new AccessTokenHttpClient(options.httpClient || new DefaultHttpClient(this._logger), options.accessTokenFactory);\r\n this._connectionState = \"Disconnected\" /* Disconnected */;\r\n this._connectionStarted = false;\r\n this._options = options;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n async start(transferFormat) {\r\n transferFormat = transferFormat || TransferFormat.Binary;\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Debug, `Starting connection with transfer format '${TransferFormat[transferFormat]}'.`);\r\n if (this._connectionState !== \"Disconnected\" /* Disconnected */) {\r\n return Promise.reject(new Error(\"Cannot start an HttpConnection that is not in the 'Disconnected' state.\"));\r\n }\r\n this._connectionState = \"Connecting\" /* Connecting */;\r\n this._startInternalPromise = this._startInternal(transferFormat);\r\n await this._startInternalPromise;\r\n // The TypeScript compiler thinks that connectionState must be Connecting here. The TypeScript compiler is wrong.\r\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\r\n // stop() was called and transitioned the client into the Disconnecting state.\r\n const message = \"Failed to start the HttpConnection before stop() was called.\";\r\n this._logger.log(LogLevel.Error, message);\r\n // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise.\r\n await this._stopPromise;\r\n return Promise.reject(new AbortError(message));\r\n }\r\n else if (this._connectionState !== \"Connected\" /* Connected */) {\r\n // stop() was called and transitioned the client into the Disconnecting state.\r\n const message = \"HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!\";\r\n this._logger.log(LogLevel.Error, message);\r\n return Promise.reject(new AbortError(message));\r\n }\r\n this._connectionStarted = true;\r\n }\r\n send(data) {\r\n if (this._connectionState !== \"Connected\" /* Connected */) {\r\n return Promise.reject(new Error(\"Cannot send data if the connection is not in the 'Connected' State.\"));\r\n }\r\n if (!this._sendQueue) {\r\n this._sendQueue = new TransportSendQueue(this.transport);\r\n }\r\n // Transport will not be null if state is connected\r\n return this._sendQueue.send(data);\r\n }\r\n async stop(error) {\r\n if (this._connectionState === \"Disconnected\" /* Disconnected */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnected state.`);\r\n return Promise.resolve();\r\n }\r\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\r\n return this._stopPromise;\r\n }\r\n this._connectionState = \"Disconnecting\" /* Disconnecting */;\r\n this._stopPromise = new Promise((resolve) => {\r\n // Don't complete stop() until stopConnection() completes.\r\n this._stopPromiseResolver = resolve;\r\n });\r\n // stopInternal should never throw so just observe it.\r\n await this._stopInternal(error);\r\n await this._stopPromise;\r\n }\r\n async _stopInternal(error) {\r\n // Set error as soon as possible otherwise there is a race between\r\n // the transport closing and providing an error and the error from a close message\r\n // We would prefer the close message error.\r\n this._stopError = error;\r\n try {\r\n await this._startInternalPromise;\r\n }\r\n catch (e) {\r\n // This exception is returned to the user as a rejected Promise from the start method.\r\n }\r\n // The transport's onclose will trigger stopConnection which will run our onclose event.\r\n // The transport should always be set if currently connected. If it wasn't set, it's likely because\r\n // stop was called during start() and start() failed.\r\n if (this.transport) {\r\n try {\r\n await this.transport.stop();\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `HttpConnection.transport.stop() threw error '${e}'.`);\r\n this._stopConnection();\r\n }\r\n this.transport = undefined;\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, \"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.\");\r\n }\r\n }\r\n async _startInternal(transferFormat) {\r\n // Store the original base url and the access token factory since they may change\r\n // as part of negotiating\r\n let url = this.baseUrl;\r\n this._accessTokenFactory = this._options.accessTokenFactory;\r\n this._httpClient._accessTokenFactory = this._accessTokenFactory;\r\n try {\r\n if (this._options.skipNegotiation) {\r\n if (this._options.transport === HttpTransportType.WebSockets) {\r\n // No need to add a connection ID in this case\r\n this.transport = this._constructTransport(HttpTransportType.WebSockets);\r\n // We should just call connect directly in this case.\r\n // No fallback or negotiate in this case.\r\n await this._startTransport(url, transferFormat);\r\n }\r\n else {\r\n throw new Error(\"Negotiation can only be skipped when using the WebSocket transport directly.\");\r\n }\r\n }\r\n else {\r\n let negotiateResponse = null;\r\n let redirects = 0;\r\n do {\r\n negotiateResponse = await this._getNegotiationResponse(url);\r\n // the user tries to stop the connection when it is being started\r\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */ || this._connectionState === \"Disconnected\" /* Disconnected */) {\r\n throw new AbortError(\"The connection was stopped during negotiation.\");\r\n }\r\n if (negotiateResponse.error) {\r\n throw new Error(negotiateResponse.error);\r\n }\r\n if (negotiateResponse.ProtocolVersion) {\r\n throw new Error(\"Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.\");\r\n }\r\n if (negotiateResponse.url) {\r\n url = negotiateResponse.url;\r\n }\r\n if (negotiateResponse.accessToken) {\r\n // Replace the current access token factory with one that uses\r\n // the returned access token\r\n const accessToken = negotiateResponse.accessToken;\r\n this._accessTokenFactory = () => accessToken;\r\n // set the factory to undefined so the AccessTokenHttpClient won't retry with the same token, since we know it won't change until a connection restart\r\n this._httpClient._accessToken = accessToken;\r\n this._httpClient._accessTokenFactory = undefined;\r\n }\r\n redirects++;\r\n } while (negotiateResponse.url && redirects < MAX_REDIRECTS);\r\n if (redirects === MAX_REDIRECTS && negotiateResponse.url) {\r\n throw new Error(\"Negotiate redirection limit exceeded.\");\r\n }\r\n await this._createTransport(url, this._options.transport, negotiateResponse, transferFormat);\r\n }\r\n if (this.transport instanceof LongPollingTransport) {\r\n this.features.inherentKeepAlive = true;\r\n }\r\n if (this._connectionState === \"Connecting\" /* Connecting */) {\r\n // Ensure the connection transitions to the connected state prior to completing this.startInternalPromise.\r\n // start() will handle the case when stop was called and startInternal exits still in the disconnecting state.\r\n this._logger.log(LogLevel.Debug, \"The HttpConnection connected successfully.\");\r\n this._connectionState = \"Connected\" /* Connected */;\r\n }\r\n // stop() is waiting on us via this.startInternalPromise so keep this.transport around so it can clean up.\r\n // This is the only case startInternal can exit in neither the connected nor disconnected state because stopConnection()\r\n // will transition to the disconnected state. start() will wait for the transition using the stopPromise.\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, \"Failed to start the connection: \" + e);\r\n this._connectionState = \"Disconnected\" /* Disconnected */;\r\n this.transport = undefined;\r\n // if start fails, any active calls to stop assume that start will complete the stop promise\r\n this._stopPromiseResolver();\r\n return Promise.reject(e);\r\n }\r\n }\r\n async _getNegotiationResponse(url) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n const negotiateUrl = this._resolveNegotiateUrl(url);\r\n this._logger.log(LogLevel.Debug, `Sending negotiation request: ${negotiateUrl}.`);\r\n try {\r\n const response = await this._httpClient.post(negotiateUrl, {\r\n content: \"\",\r\n headers: { ...headers, ...this._options.headers },\r\n timeout: this._options.timeout,\r\n withCredentials: this._options.withCredentials,\r\n });\r\n if (response.statusCode !== 200) {\r\n return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`));\r\n }\r\n const negotiateResponse = JSON.parse(response.content);\r\n if (!negotiateResponse.negotiateVersion || negotiateResponse.negotiateVersion < 1) {\r\n // Negotiate version 0 doesn't use connectionToken\r\n // So we set it equal to connectionId so all our logic can use connectionToken without being aware of the negotiate version\r\n negotiateResponse.connectionToken = negotiateResponse.connectionId;\r\n }\r\n return negotiateResponse;\r\n }\r\n catch (e) {\r\n let errorMessage = \"Failed to complete negotiation with the server: \" + e;\r\n if (e instanceof HttpError) {\r\n if (e.statusCode === 404) {\r\n errorMessage = errorMessage + \" Either this is not a SignalR endpoint or there is a proxy blocking the connection.\";\r\n }\r\n }\r\n this._logger.log(LogLevel.Error, errorMessage);\r\n return Promise.reject(new FailedToNegotiateWithServerError(errorMessage));\r\n }\r\n }\r\n _createConnectUrl(url, connectionToken) {\r\n if (!connectionToken) {\r\n return url;\r\n }\r\n return url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + `id=${connectionToken}`;\r\n }\r\n async _createTransport(url, requestedTransport, negotiateResponse, requestedTransferFormat) {\r\n let connectUrl = this._createConnectUrl(url, negotiateResponse.connectionToken);\r\n if (this._isITransport(requestedTransport)) {\r\n this._logger.log(LogLevel.Debug, \"Connection was provided an instance of ITransport, using that directly.\");\r\n this.transport = requestedTransport;\r\n await this._startTransport(connectUrl, requestedTransferFormat);\r\n this.connectionId = negotiateResponse.connectionId;\r\n return;\r\n }\r\n const transportExceptions = [];\r\n const transports = negotiateResponse.availableTransports || [];\r\n let negotiate = negotiateResponse;\r\n for (const endpoint of transports) {\r\n const transportOrError = this._resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat);\r\n if (transportOrError instanceof Error) {\r\n // Store the error and continue, we don't want to cause a re-negotiate in these cases\r\n transportExceptions.push(`${endpoint.transport} failed:`);\r\n transportExceptions.push(transportOrError);\r\n }\r\n else if (this._isITransport(transportOrError)) {\r\n this.transport = transportOrError;\r\n if (!negotiate) {\r\n try {\r\n negotiate = await this._getNegotiationResponse(url);\r\n }\r\n catch (ex) {\r\n return Promise.reject(ex);\r\n }\r\n connectUrl = this._createConnectUrl(url, negotiate.connectionToken);\r\n }\r\n try {\r\n await this._startTransport(connectUrl, requestedTransferFormat);\r\n this.connectionId = negotiate.connectionId;\r\n return;\r\n }\r\n catch (ex) {\r\n this._logger.log(LogLevel.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);\r\n negotiate = undefined;\r\n transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, HttpTransportType[endpoint.transport]));\r\n if (this._connectionState !== \"Connecting\" /* Connecting */) {\r\n const message = \"Failed to select transport before stop() was called.\";\r\n this._logger.log(LogLevel.Debug, message);\r\n return Promise.reject(new AbortError(message));\r\n }\r\n }\r\n }\r\n }\r\n if (transportExceptions.length > 0) {\r\n return Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${transportExceptions.join(\" \")}`, transportExceptions));\r\n }\r\n return Promise.reject(new Error(\"None of the transports supported by the client are supported by the server.\"));\r\n }\r\n _constructTransport(transport) {\r\n switch (transport) {\r\n case HttpTransportType.WebSockets:\r\n if (!this._options.WebSocket) {\r\n throw new Error(\"'WebSocket' is not supported in your environment.\");\r\n }\r\n return new WebSocketTransport(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});\r\n case HttpTransportType.ServerSentEvents:\r\n if (!this._options.EventSource) {\r\n throw new Error(\"'EventSource' is not supported in your environment.\");\r\n }\r\n return new ServerSentEventsTransport(this._httpClient, this._httpClient._accessToken, this._logger, this._options);\r\n case HttpTransportType.LongPolling:\r\n return new LongPollingTransport(this._httpClient, this._logger, this._options);\r\n default:\r\n throw new Error(`Unknown transport: ${transport}.`);\r\n }\r\n }\r\n _startTransport(url, transferFormat) {\r\n this.transport.onreceive = this.onreceive;\r\n this.transport.onclose = (e) => this._stopConnection(e);\r\n return this.transport.connect(url, transferFormat);\r\n }\r\n _resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat) {\r\n const transport = HttpTransportType[endpoint.transport];\r\n if (transport === null || transport === undefined) {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\r\n return new Error(`Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\r\n }\r\n else {\r\n if (transportMatches(requestedTransport, transport)) {\r\n const transferFormats = endpoint.transferFormats.map((s) => TransferFormat[s]);\r\n if (transferFormats.indexOf(requestedTransferFormat) >= 0) {\r\n if ((transport === HttpTransportType.WebSockets && !this._options.WebSocket) ||\r\n (transport === HttpTransportType.ServerSentEvents && !this._options.EventSource)) {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);\r\n return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, transport);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);\r\n try {\r\n return this._constructTransport(transport);\r\n }\r\n catch (ex) {\r\n return ex;\r\n }\r\n }\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it does not support the requested transfer format '${TransferFormat[requestedTransferFormat]}'.`);\r\n return new Error(`'${HttpTransportType[transport]}' does not support ${TransferFormat[requestedTransferFormat]}.`);\r\n }\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it was disabled by the client.`);\r\n return new DisabledTransportError(`'${HttpTransportType[transport]}' is disabled by the client.`, transport);\r\n }\r\n }\r\n }\r\n _isITransport(transport) {\r\n return transport && typeof (transport) === \"object\" && \"connect\" in transport;\r\n }\r\n _stopConnection(error) {\r\n this._logger.log(LogLevel.Debug, `HttpConnection.stopConnection(${error}) called while in state ${this._connectionState}.`);\r\n this.transport = undefined;\r\n // If we have a stopError, it takes precedence over the error from the transport\r\n error = this._stopError || error;\r\n this._stopError = undefined;\r\n if (this._connectionState === \"Disconnected\" /* Disconnected */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is already in the disconnected state.`);\r\n return;\r\n }\r\n if (this._connectionState === \"Connecting\" /* Connecting */) {\r\n this._logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is still in the connecting state.`);\r\n throw new Error(`HttpConnection.stopConnection(${error}) was called while the connection is still in the connecting state.`);\r\n }\r\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\r\n // A call to stop() induced this call to stopConnection and needs to be completed.\r\n // Any stop() awaiters will be scheduled to continue after the onclose callback fires.\r\n this._stopPromiseResolver();\r\n }\r\n if (error) {\r\n this._logger.log(LogLevel.Error, `Connection disconnected with error '${error}'.`);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Information, \"Connection disconnected.\");\r\n }\r\n if (this._sendQueue) {\r\n this._sendQueue.stop().catch((e) => {\r\n this._logger.log(LogLevel.Error, `TransportSendQueue.stop() threw error '${e}'.`);\r\n });\r\n this._sendQueue = undefined;\r\n }\r\n this.connectionId = undefined;\r\n this._connectionState = \"Disconnected\" /* Disconnected */;\r\n if (this._connectionStarted) {\r\n this._connectionStarted = false;\r\n try {\r\n if (this.onclose) {\r\n this.onclose(error);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `HttpConnection.onclose(${error}) threw error '${e}'.`);\r\n }\r\n }\r\n }\r\n _resolveUrl(url) {\r\n // startsWith is not supported in IE\r\n if (url.lastIndexOf(\"https://\", 0) === 0 || url.lastIndexOf(\"http://\", 0) === 0) {\r\n return url;\r\n }\r\n if (!Platform.isBrowser) {\r\n throw new Error(`Cannot resolve '${url}'.`);\r\n }\r\n // Setting the url to the href propery of an anchor tag handles normalization\r\n // for us. There are 3 main cases.\r\n // 1. Relative path normalization e.g \"b\" -> \"http://localhost:5000/a/b\"\r\n // 2. Absolute path normalization e.g \"/a/b\" -> \"http://localhost:5000/a/b\"\r\n // 3. Networkpath reference normalization e.g \"//localhost:5000/a/b\" -> \"http://localhost:5000/a/b\"\r\n const aTag = window.document.createElement(\"a\");\r\n aTag.href = url;\r\n this._logger.log(LogLevel.Information, `Normalizing '${url}' to '${aTag.href}'.`);\r\n return aTag.href;\r\n }\r\n _resolveNegotiateUrl(url) {\r\n const index = url.indexOf(\"?\");\r\n let negotiateUrl = url.substring(0, index === -1 ? url.length : index);\r\n if (negotiateUrl[negotiateUrl.length - 1] !== \"/\") {\r\n negotiateUrl += \"/\";\r\n }\r\n negotiateUrl += \"negotiate\";\r\n negotiateUrl += index === -1 ? \"\" : url.substring(index);\r\n if (negotiateUrl.indexOf(\"negotiateVersion\") === -1) {\r\n negotiateUrl += index === -1 ? \"?\" : \"&\";\r\n negotiateUrl += \"negotiateVersion=\" + this._negotiateVersion;\r\n }\r\n return negotiateUrl;\r\n }\r\n}\r\nfunction transportMatches(requestedTransport, actualTransport) {\r\n return !requestedTransport || ((actualTransport & requestedTransport) !== 0);\r\n}\r\n/** @private */\r\nexport class TransportSendQueue {\r\n constructor(_transport) {\r\n this._transport = _transport;\r\n this._buffer = [];\r\n this._executing = true;\r\n this._sendBufferedData = new PromiseSource();\r\n this._transportResult = new PromiseSource();\r\n this._sendLoopPromise = this._sendLoop();\r\n }\r\n send(data) {\r\n this._bufferData(data);\r\n if (!this._transportResult) {\r\n this._transportResult = new PromiseSource();\r\n }\r\n return this._transportResult.promise;\r\n }\r\n stop() {\r\n this._executing = false;\r\n this._sendBufferedData.resolve();\r\n return this._sendLoopPromise;\r\n }\r\n _bufferData(data) {\r\n if (this._buffer.length && typeof (this._buffer[0]) !== typeof (data)) {\r\n throw new Error(`Expected data to be of type ${typeof (this._buffer)} but was of type ${typeof (data)}`);\r\n }\r\n this._buffer.push(data);\r\n this._sendBufferedData.resolve();\r\n }\r\n async _sendLoop() {\r\n while (true) {\r\n await this._sendBufferedData.promise;\r\n if (!this._executing) {\r\n if (this._transportResult) {\r\n this._transportResult.reject(\"Connection stopped.\");\r\n }\r\n break;\r\n }\r\n this._sendBufferedData = new PromiseSource();\r\n const transportResult = this._transportResult;\r\n this._transportResult = undefined;\r\n const data = typeof (this._buffer[0]) === \"string\" ?\r\n this._buffer.join(\"\") :\r\n TransportSendQueue._concatBuffers(this._buffer);\r\n this._buffer.length = 0;\r\n try {\r\n await this._transport.send(data);\r\n transportResult.resolve();\r\n }\r\n catch (error) {\r\n transportResult.reject(error);\r\n }\r\n }\r\n }\r\n static _concatBuffers(arrayBuffers) {\r\n const totalLength = arrayBuffers.map((b) => b.byteLength).reduce((a, b) => a + b);\r\n const result = new Uint8Array(totalLength);\r\n let offset = 0;\r\n for (const item of arrayBuffers) {\r\n result.set(new Uint8Array(item), offset);\r\n offset += item.byteLength;\r\n }\r\n return result.buffer;\r\n }\r\n}\r\nclass PromiseSource {\r\n constructor() {\r\n this.promise = new Promise((resolve, reject) => [this._resolver, this._rejecter] = [resolve, reject]);\r\n }\r\n resolve() {\r\n this._resolver();\r\n }\r\n reject(reason) {\r\n this._rejecter(reason);\r\n }\r\n}\r\n//# sourceMappingURL=HttpConnection.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// Not exported from index\r\n/** @private */\r\nexport class TextMessageFormat {\r\n static write(output) {\r\n return `${output}${TextMessageFormat.RecordSeparator}`;\r\n }\r\n static parse(input) {\r\n if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n const messages = input.split(TextMessageFormat.RecordSeparator);\r\n messages.pop();\r\n return messages;\r\n }\r\n}\r\nTextMessageFormat.RecordSeparatorCode = 0x1e;\r\nTextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);\r\n//# sourceMappingURL=TextMessageFormat.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\n/** @private */\r\nexport class HandshakeProtocol {\r\n // Handshake request is always JSON\r\n writeHandshakeRequest(handshakeRequest) {\r\n return TextMessageFormat.write(JSON.stringify(handshakeRequest));\r\n }\r\n parseHandshakeResponse(data) {\r\n let messageData;\r\n let remainingData;\r\n if (isArrayBuffer(data)) {\r\n // Format is binary but still need to read JSON text from handshake response\r\n const binaryData = new Uint8Array(data);\r\n const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));\r\n remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null;\r\n }\r\n else {\r\n const textData = data;\r\n const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = textData.substring(0, responseLength);\r\n remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null;\r\n }\r\n // At this point we should have just the single handshake message\r\n const messages = TextMessageFormat.parse(messageData);\r\n const response = JSON.parse(messages[0]);\r\n if (response.type) {\r\n throw new Error(\"Expected a handshake response from the server.\");\r\n }\r\n const responseMessage = response;\r\n // multiple messages could have arrived with handshake\r\n // return additional data to be parsed as usual, or null if all parsed\r\n return [remainingData, responseMessage];\r\n }\r\n}\r\n//# sourceMappingURL=HandshakeProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { SubjectSubscription } from \"./Utils\";\r\n/** Stream implementation to stream items to the server. */\r\nexport class Subject {\r\n constructor() {\r\n this.observers = [];\r\n }\r\n next(item) {\r\n for (const observer of this.observers) {\r\n observer.next(item);\r\n }\r\n }\r\n error(err) {\r\n for (const observer of this.observers) {\r\n if (observer.error) {\r\n observer.error(err);\r\n }\r\n }\r\n }\r\n complete() {\r\n for (const observer of this.observers) {\r\n if (observer.complete) {\r\n observer.complete();\r\n }\r\n }\r\n }\r\n subscribe(observer) {\r\n this.observers.push(observer);\r\n return new SubjectSubscription(this, observer);\r\n }\r\n}\r\n//# sourceMappingURL=Subject.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nconst JSON_HUB_PROTOCOL_NAME = \"json\";\r\n/** Implements the JSON Hub Protocol. */\r\nexport class JsonHubProtocol {\r\n constructor() {\r\n /** @inheritDoc */\r\n this.name = JSON_HUB_PROTOCOL_NAME;\r\n /** @inheritDoc */\r\n this.version = 1;\r\n /** @inheritDoc */\r\n this.transferFormat = TransferFormat.Text;\r\n }\r\n /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * @param {string} input A string containing the serialized representation.\r\n * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.\r\n */\r\n parseMessages(input, logger) {\r\n // The interface does allow \"ArrayBuffer\" to be passed in, but this implementation does not. So let's throw a useful error.\r\n if (typeof input !== \"string\") {\r\n throw new Error(\"Invalid input for JSON hub protocol. Expected a string.\");\r\n }\r\n if (!input) {\r\n return [];\r\n }\r\n if (logger === null) {\r\n logger = NullLogger.instance;\r\n }\r\n // Parse the messages\r\n const messages = TextMessageFormat.parse(input);\r\n const hubMessages = [];\r\n for (const message of messages) {\r\n const parsedMessage = JSON.parse(message);\r\n if (typeof parsedMessage.type !== \"number\") {\r\n throw new Error(\"Invalid payload.\");\r\n }\r\n switch (parsedMessage.type) {\r\n case MessageType.Invocation:\r\n this._isInvocationMessage(parsedMessage);\r\n break;\r\n case MessageType.StreamItem:\r\n this._isStreamItemMessage(parsedMessage);\r\n break;\r\n case MessageType.Completion:\r\n this._isCompletionMessage(parsedMessage);\r\n break;\r\n case MessageType.Ping:\r\n // Single value, no need to validate\r\n break;\r\n case MessageType.Close:\r\n // All optional values, no need to validate\r\n break;\r\n default:\r\n // Future protocol changes can add message types, old clients can ignore them\r\n logger.log(LogLevel.Information, \"Unknown message type '\" + parsedMessage.type + \"' ignored.\");\r\n continue;\r\n }\r\n hubMessages.push(parsedMessage);\r\n }\r\n return hubMessages;\r\n }\r\n /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string} A string containing the serialized representation of the message.\r\n */\r\n writeMessage(message) {\r\n return TextMessageFormat.write(JSON.stringify(message));\r\n }\r\n _isInvocationMessage(message) {\r\n this._assertNotEmptyString(message.target, \"Invalid payload for Invocation message.\");\r\n if (message.invocationId !== undefined) {\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Invocation message.\");\r\n }\r\n }\r\n _isStreamItemMessage(message) {\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for StreamItem message.\");\r\n if (message.item === undefined) {\r\n throw new Error(\"Invalid payload for StreamItem message.\");\r\n }\r\n }\r\n _isCompletionMessage(message) {\r\n if (message.result && message.error) {\r\n throw new Error(\"Invalid payload for Completion message.\");\r\n }\r\n if (!message.result && message.error) {\r\n this._assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\r\n }\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\r\n }\r\n _assertNotEmptyString(value, errorMessage) {\r\n if (typeof value !== \"string\" || value === \"\") {\r\n throw new Error(errorMessage);\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=JsonHubProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { DefaultReconnectPolicy } from \"./DefaultReconnectPolicy\";\r\nimport { HttpConnection } from \"./HttpConnection\";\r\nimport { HubConnection } from \"./HubConnection\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { JsonHubProtocol } from \"./JsonHubProtocol\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { Arg, ConsoleLogger } from \"./Utils\";\r\nconst LogLevelNameMapping = {\r\n trace: LogLevel.Trace,\r\n debug: LogLevel.Debug,\r\n info: LogLevel.Information,\r\n information: LogLevel.Information,\r\n warn: LogLevel.Warning,\r\n warning: LogLevel.Warning,\r\n error: LogLevel.Error,\r\n critical: LogLevel.Critical,\r\n none: LogLevel.None,\r\n};\r\nfunction parseLogLevel(name) {\r\n // Case-insensitive matching via lower-casing\r\n // Yes, I know case-folding is a complicated problem in Unicode, but we only support\r\n // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse.\r\n const mapping = LogLevelNameMapping[name.toLowerCase()];\r\n if (typeof mapping !== \"undefined\") {\r\n return mapping;\r\n }\r\n else {\r\n throw new Error(`Unknown log level: ${name}`);\r\n }\r\n}\r\n/** A builder for configuring {@link @microsoft/signalr.HubConnection} instances. */\r\nexport class HubConnectionBuilder {\r\n configureLogging(logging) {\r\n Arg.isRequired(logging, \"logging\");\r\n if (isLogger(logging)) {\r\n this.logger = logging;\r\n }\r\n else if (typeof logging === \"string\") {\r\n const logLevel = parseLogLevel(logging);\r\n this.logger = new ConsoleLogger(logLevel);\r\n }\r\n else {\r\n this.logger = new ConsoleLogger(logging);\r\n }\r\n return this;\r\n }\r\n withUrl(url, transportTypeOrOptions) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isNotEmpty(url, \"url\");\r\n this.url = url;\r\n // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed\r\n // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.\r\n if (typeof transportTypeOrOptions === \"object\") {\r\n this.httpConnectionOptions = { ...this.httpConnectionOptions, ...transportTypeOrOptions };\r\n }\r\n else {\r\n this.httpConnectionOptions = {\r\n ...this.httpConnectionOptions,\r\n transport: transportTypeOrOptions,\r\n };\r\n }\r\n return this;\r\n }\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.\r\n *\r\n * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.\r\n */\r\n withHubProtocol(protocol) {\r\n Arg.isRequired(protocol, \"protocol\");\r\n this.protocol = protocol;\r\n return this;\r\n }\r\n withAutomaticReconnect(retryDelaysOrReconnectPolicy) {\r\n if (this.reconnectPolicy) {\r\n throw new Error(\"A reconnectPolicy has already been set.\");\r\n }\r\n if (!retryDelaysOrReconnectPolicy) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy();\r\n }\r\n else if (Array.isArray(retryDelaysOrReconnectPolicy)) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);\r\n }\r\n else {\r\n this.reconnectPolicy = retryDelaysOrReconnectPolicy;\r\n }\r\n return this;\r\n }\r\n /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.\r\n *\r\n * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.\r\n */\r\n build() {\r\n // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one\r\n // provided to configureLogger\r\n const httpConnectionOptions = this.httpConnectionOptions || {};\r\n // If it's 'null', the user **explicitly** asked for null, don't mess with it.\r\n if (httpConnectionOptions.logger === undefined) {\r\n // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.\r\n httpConnectionOptions.logger = this.logger;\r\n }\r\n // Now create the connection\r\n if (!this.url) {\r\n throw new Error(\"The 'HubConnectionBuilder.withUrl' method must be called before building the connection.\");\r\n }\r\n const connection = new HttpConnection(this.url, httpConnectionOptions);\r\n return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol(), this.reconnectPolicy);\r\n }\r\n}\r\nfunction isLogger(logger) {\r\n return logger.log !== undefined;\r\n}\r\n//# sourceMappingURL=HubConnectionBuilder.js.map","export class Helpers {\r\n static GenerateUUID(): string { // Public Domain/MIT\r\n var d = new Date().getTime();//Timestamp\r\n var d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0;//Time in microseconds since page-load or 0 if unsupported\r\n \r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16;//random number between 0 and 16\r\n\r\n if (d > 0) {//Use timestamp until depleted\r\n r = (d + r) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n } \r\n else {//Use microseconds since page-load if supported\r\n r = (d2 + r) % 16 | 0;\r\n d2 = Math.floor(d2 / 16);\r\n }\r\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Type to generate int range types\r\n */\r\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\r\n ? Acc[number]\r\n : Enumerate<N, [...Acc, Acc['length']]>;\r\n\r\nexport type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;","import { Helpers } from \"./Helpers\";\r\n\r\nexport interface IDataFrame<T>\r\n{\r\n Resource?: string;\r\n TransactionId?: string;\r\n Data?: T;\r\n Status?: Status;\r\n Method?: Method;\r\n}\r\n\r\nexport class DataFrame<T> implements IDataFrame<T>\r\n{\r\n Resource?: string;\r\n TransactionId?: string = Helpers.GenerateUUID();\r\n Data?: T;\r\n Status?: Status;\r\n Method?: Method;\r\n}\r\n\r\nexport enum Status\r\n{\r\n /// <summary>\r\n /// Gdy zapytanie się powiodło i nie wystąpiły błędy\r\n /// </summary>\r\n OK = 0,\r\n\r\n /// <summary>\r\n /// Gdy wystąpił nieznany błąd podczas wykonywania zapytania\r\n /// </summary>\r\n UnknownError = 1,\r\n\r\n /// <summary>\r\n /// Gdy wystąpił błąd którego oprogramowanie kontrolera nie mogło rozwiązać\r\n /// </summary>\r\n FatalError = 2,\r\n\r\n /// <summary>\r\n /// Gdy zapytanie zostało wykonane z niepoprawnymi danymi\r\n /// </summary>\r\n WrongData = 3,\r\n\r\n /// <summary>\r\n /// Gdy zostało wykonane zapytanie do zasobu który nie istnieje\r\n /// </summary>\r\n ResourceDoesNotExists = 4,\r\n\r\n /// <summary>\r\n /// Gdy zostało wykonane zapytanie o wykonanie operacji do której zalogowany użytkownik nie ma uprawnień (np. gdy próbuje zmienić dane użytkownika o uprawnieniach wyższych od siebie)\r\n /// </summary>\r\n NoPermissionToPerformThisOperation = 5,\r\n\r\n /// <summary>\r\n /// Gdy zostanie dokonana próba ponownego logowania dla już zalogowanej sesji\r\n /// </summary>\r\n SessionHasAlreadyLoggedOnUser = 6,\r\n\r\n /// <summary>\r\n /// Gdy żądana operacja jest niedozwolona\r\n /// </summary>\r\n OperationNotPermitted = 7,\r\n\r\n /// <summary>\r\n /// Gdy zostanie wykonane zapytanie do zasobu do którego użytkownik nie ma uprawnień\r\n /// </summary>\r\n NoPermissionsToCallGivenResource = 8,\r\n\r\n /// <summary>\r\n /// Gdy zostanie wykonane zapytanie do zasobu aktualnie nie dostępnego (gdy np. zasób został wyłączony)\r\n /// </summary>\r\n ResourceIsNotAvailable = 9,\r\n\r\n /// <summary>\r\n /// Gdy zapytanie do zasobu zakończyło się okreslonym błędem\r\n /// </summary>\r\n Error = 10,\r\n\r\n /// <summary>\r\n /// Gdy w ramach odpowiedzi na zapytanie nie są zwracane dane\r\n /// </summary>\r\n NoData = 11,\r\n\r\n /// <summary>\r\n /// Gdy zostanie wykonane zapytanie do nie wspieranego zasobu (np. dotyczącego okreslonego systemu operacyjnego)\r\n /// </summary>\r\n NotSupportedMethod = 12,\r\n\r\n /// <summary>\r\n /// Gdy zostanie wykonane zapytanie do dowolnego zasobu a żaden użytkownik nie jest zalogowany w ramach sesji\r\n /// </summary>\r\n UserIsNotLoggedIn = 13,\r\n /// <summary>\r\n /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu\r\n /// </summary>\r\n MultiDataResponseStart = 14,\r\n /// <summary>\r\n /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu. Informuje, że dana odpowiedź jest jedną z odpowiedzi\r\n /// </summary>\r\n MultiDataResponse = 15,\r\n /// <summary>\r\n /// Przewidziane dla zapytań które zwracają wiele odpowiedzi, np. postęp w realizacji jakiegoś procesu. Informuje, że dana odpowiedź jest ostatnią odpowiedzią danego zasobu\r\n /// </summary>\r\n MultiDataResponseStop = 16\r\n}\r\n\r\n\r\nexport enum Method\r\n{\r\n Get = 0,\r\n Post = 1,\r\n Delete = 2,\r\n Put = 3,\r\n Options = 4,\r\n Head = 5\r\n}","import { TypedEvent, ITypedEvent } from \"../TypedEvent\";\r\nimport { DataFrame, IDataFrame } from \"../DataFrame\";\r\nimport { IDIService } from \"../IDIService\";\r\n\r\nexport interface IExalusConnectionService extends IDIService {\r\n SetServersBrokerAddress(address: string): void;\r\n SetDefaultPacketsBrokerAddress(address: string): void;\r\n GetServerAddressAsync(): Promise<string | null>;\r\n ConnectAsync(address: string): Promise<ConnectionResult>;\r\n AuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<boolean>;\r\n ConnectAndAuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<ConnectionResult>;\r\n DisconnectAsync(): Promise<void>;\r\n IsConnected(): boolean;\r\n EnablePacketsLogging(): void;\r\n DisablePacketsLogging(): void;\r\n SendAsync(dataFrame: IDataFrame<any>): Promise<boolean>;\r\n SendAndWaitForResponseAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean): Promise<IDataFrame<T>>;\r\n SendAndWaitForResponseAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean, logTransmission: boolean): Promise<IDataFrame<T>>;\r\n OnDataReceivedEvent(): ITypedEvent<IDataFrame<any>>;\r\n OnErrorOccuredEvent(): ITypedEvent<[sender: string, data: string]>;\r\n OnConnectionStateChangedEvent(): ITypedEvent<ConnectionState>;\r\n}\r\n\r\nexport class AuthorizationInfo {\r\n public constructor(public serialNumber: string, public pin: string) {\r\n this.SerialNumber = serialNumber;\r\n this.PIN = pin;\r\n }\r\n\r\n public SerialNumber: string;\r\n public PIN: string;\r\n}\r\n\r\nexport enum ConnectionType {\r\n ByCloud = 0,\r\n LocalNetwork = 1,\r\n P2P = 2,\r\n}\r\n\r\nexport enum ConnectionResult {\r\n FailedToConnect = 0,\r\n AuthorizationFailed = 1,\r\n FailedToConnectToServer = 2,\r\n Connected = 3,\r\n ControllerIsNotConnected = 4\r\n}\r\n\r\nexport enum ConnectionState {\r\n Disconnected = 0,\r\n Connecting = 1,\r\n Connected = 3,\r\n Disconnecting = 4,\r\n Failed = 5,\r\n Reconnecting = 6\r\n}","export interface IUser {\r\n get Guid(): string;\r\n get CloudGuid(): string;\r\n get Name(): string;\r\n get Surname(): string;\r\n get Phone(): string;\r\n get AccessLevel(): AccessLevel;\r\n get Email(): string;\r\n get IsAccountOnline(): boolean;\r\n get IsActive(): boolean;\r\n get IsBanned(): boolean;\r\n get NotificationChannels(): string[];\r\n get Gender(): Gender;\r\n get Localization(): Localization;\r\n}\r\n\r\nexport enum AccessLevel\r\n{\r\n Any = 0,\r\n Guest = 10,\r\n Standard = 20,\r\n Admin = 30,\r\n Installator = 40,\r\n Support = 50\r\n}\r\n\r\nexport enum Gender\r\n{\r\n Unknown = 0,\r\n Men = 1,\r\n Woman = 2,\r\n Other = 3\r\n}\r\n\r\nexport enum Localization\r\n{\r\n En_Us = 0,\r\n Pl_Pl = 1,\r\n}","import { IDIService } from \"../../IDIService\";\r\nimport { ITypedEvent } from \"../../TypedEvent\";\r\nimport { AccessLevel, Gender, IUser } from \"../Users/IUser\";\r\n\r\nexport interface ISessionService extends IDIService {\r\n OnUserLoggedInEvent(): ITypedEvent<IUser>;\r\n OnUserLoggedOutEvent(): ITypedEvent<IUser>;\r\n \r\n get User(): IUser | null;\r\n UserLogOutAsync(): Promise<void>;\r\n UserLogInAsync(email: string, password: string): Promise<IUser | LoginError>;\r\n}\r\n\r\nexport enum LoginError\r\n{\r\n Unknown = 0,\r\n WrongAuthData = 1,\r\n NoResponseFromController = 2,\r\n}\r\n","\r\nimport { Api } from './Api';\r\nimport { ILoggerService } from './Services/Logging/ILoggerService';\r\nimport { LoggerService } from './Services/Logging/LoggerService';\r\n\r\nexport interface IEvent {\r\n Subscribe(handler: { (): void }): void;\r\n Unsubscribe(handler: { (): void }): void;\r\n}\r\n\r\nexport class Event implements IEvent {\r\n private _log: ILoggerService = Api.Get<ILoggerService>(LoggerService.ServiceName);\r\n\r\n private handlers: { (): void; }[] = [];\r\n\r\n public Subscribe(handler: { (): void }): void {\r\n this.handlers.push(handler);\r\n }\r\n\r\n public Unsubscribe(handler: { (): void }): void {\r\n this.handlers = this.handlers.filter(h => h !== handler);\r\n }\r\n\r\n public Invoke() {\r\n this.handlers.slice(0).forEach(h => {\r\n try {\r\n h();\r\n }\r\n catch (ex: any) {\r\n this._log.Error(ex);\r\n }\r\n });\r\n }\r\n}","import { AccessLevel, Gender, IUser, Localization } from \"./IUser\";\r\n\r\nexport class User implements IUser {\r\n private _guid: string = \"\";\r\n private _cloudGuid: string = \"\";\r\n private _name: string = \"\";\r\n private _surname: string = \"\";\r\n private _phone: string = \"\";\r\n private _email: string = \"\";\r\n private _isAccountOnline: boolean = true;\r\n private _isAccountActive: boolean = true;\r\n private _isAccountBanned: boolean = true;\r\n private _notificationChannels: string[] = [];\r\n private _gender: Gender = Gender.Unknown;\r\n private _accessLevel: AccessLevel = AccessLevel.Any;\r\n private _localization: Localization = Localization.En_Us;\r\n\r\n get Guid(): string {\r\n return this._guid;\r\n }\r\n\r\n set Guid(value: string) {\r\n this._guid = value;\r\n }\r\n\r\n get CloudGuid(): string {\r\n return this._cloudGuid;\r\n }\r\n\r\n set CloudGuid(value: string) {\r\n this._cloudGuid = value;\r\n }\r\n\r\n get Name(): string {\r\n return this._name;\r\n }\r\n\r\n set Name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n get Surname(): string {\r\n return this._surname;\r\n }\r\n\r\n set Surname(value: string) {\r\n this._surname = value;\r\n }\r\n\r\n get Phone(): string {\r\n return this._phone;\r\n }\r\n\r\n set Phone(value: string) {\r\n this._phone = value;\r\n }\r\n\r\n get AccessLevel(): AccessLevel {\r\n return this._accessLevel;\r\n }\r\n\r\n set AccessLevel(value: AccessLevel) {\r\n this._accessLevel = value;\r\n }\r\n\r\n get Email(): string {\r\n return this._email;\r\n }\r\n\r\n set Email(value: string) {\r\n this._email = value;\r\n }\r\n\r\n get IsAccountOnline(): boolean {\r\n return this._isAccountOnline;\r\n }\r\n\r\n set IsAccountOnline(value: boolean) {\r\n this._isAccountOnline = value;\r\n }\r\n\r\n get IsActive(): boolean {\r\n return this._isAccountActive;\r\n }\r\n\r\n set IsActive(value: boolean) {\r\n this._isAccountActive = value;\r\n }\r\n\r\n get IsBanned(): boolean {\r\n return this._isAccountBanned;\r\n }\r\n\r\n set IsBanned(value: boolean) {\r\n this._isAccountBanned = value;\r\n }\r\n\r\n get NotificationChannels(): string[] {\r\n return this._notificationChannels;\r\n }\r\n\r\n set NotificationChannels(value: string[]) {\r\n this._notificationChannels = value;\r\n }\r\n\r\n get Gender(): Gender {\r\n return this._gender;\r\n }\r\n\r\n set Gender(value: Gender) {\r\n this._gender = value;\r\n }\r\n\r\n get Localization(): Localization {\r\n return this._localization;\r\n }\r\n\r\n set Localization(value: Localization) {\r\n this._localization = value;\r\n }\r\n}","import { Api } from \"../../Api\";\r\nimport { ExalusConnectionService } from \"../ExalusConnectionService\";\r\nimport { ConnectionState, IExalusConnectionService } from \"../IExalusConnectionService\";\r\nimport { ITypedEvent, TypedEvent } from \"../../TypedEvent\";\r\nimport { IUser, AccessLevel, Gender } from '../Users/IUser';\r\nimport { ISessionService, LoginError } from \"./ISessionService\";\r\nimport { DataFrame, Method, Status } from '../../DataFrame';\r\nimport { DependencyContainer } from \"../../DependencyContainer\";\r\nimport { User } from \"../Users/User\";\r\n\r\nexport class SessionService implements ISessionService {\r\n private _onUserLoggedInEvent: ITypedEvent<IUser> = new TypedEvent<IUser>();\r\n private _onUserLoggedOutEvent: ITypedEvent<IUser> = new TypedEvent<IUser>();\r\n public static readonly ServiceName: string = \"SessionService\";\r\n private _email: string = \"\";\r\n private _password: string = \"\";\r\n private _loginTaskCompletionSource: Promise<void> = this.CreateSessionCompletionSourceAsync();\r\n private _alreadySubsribedToNetworkEvents: boolean = false;\r\n private _user: IUser | null = null;\r\n\r\n public async CreateSessionCompletionSourceAsync(): Promise<void> {\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `Creating _loginTaskCompletionSource`);\r\n \r\n this._loginTaskCompletionSource = new Promise<void>((resolve) => {\r\n \r\n let onUserLoggedIn = (user: IUser) => {\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `Logged in as ${user.Name}, completing CreateSessionCompletionSourceAsync()`);\r\n resolve();\r\n this.OnUserLoggedInEvent().Unsubscribe(onUserLoggedIn);\r\n };\r\n\r\n this.OnUserLoggedInEvent().Subscribe(onUserLoggedIn);\r\n });\r\n }\r\n\r\n private Subscribe(handler: { (data: IUser): void }): void\r\n {\r\n\r\n }\r\n\r\n public async RestoreSessionAsync(): Promise<void> { \r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `Creating RestoreSessionAsync ${this._email} ${this._password}`);\r\n\r\n if (this._user === undefined || this._user === null)\r\n return;\r\n\r\n await this.UserLogInAsync(this._email, this._password);\r\n }\r\n\r\n public async WaitForSessionCreationAsync(): Promise<void> {\r\n return this._loginTaskCompletionSource as Promise<void>;\r\n }\r\n\r\n OnUserLoggedInEvent(): ITypedEvent<IUser> {\r\n return this._onUserLoggedInEvent;\r\n }\r\n\r\n OnUserLoggedOutEvent(): ITypedEvent<IUser> {\r\n return this._onUserLoggedOutEvent;\r\n }\r\n\r\n get User(): IUser | null {\r\n return this._user;\r\n }\r\n\r\n async UserLogOutAsync(): Promise<void> {\r\n var logoutRequest = new DataFrame();\r\n logoutRequest.Resource = \"/users/user/logout\";\r\n logoutRequest.Method = Method.Put;\r\n this._email = \"\";\r\n this._password = \"\";\r\n //var connection = Api.Get<IExalusConnectionService>(ExalusConnectionService);\r\n //connection.OnConnectionStateChangedEvent().Unsubscribe(this.OnConnectionStateChanged);\r\n\r\n const result = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName)\r\n .SendAndWaitForResponseAsync(logoutRequest, 20000, false);\r\n\r\n if (result.Status == Status.OK) {\r\n (this._onUserLoggedOutEvent as TypedEvent<IUser>).Invoke(this._user as IUser);\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, \"User has been logged out.\");\r\n }\r\n else\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, \"Failed to logout user!\");\r\n }\r\n\r\n private async OnConnectionStateChanged(connectionState: ConnectionState) {\r\n switch (connectionState) {\r\n case ConnectionState.Disconnected:\r\n case ConnectionState.Failed:\r\n break;\r\n\r\n case ConnectionState.Connected:\r\n Api.Get<SessionService>(SessionService.ServiceName).RestoreSessionAsync();\r\n break;\r\n }\r\n }\r\n\r\n async UserLogInAsync(email: string, password: string): Promise<IUser | LoginError> {\r\n var connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n const result = await connection.SendAndWaitForResponseAsync<UserData>(new LoginUserRequest(email, password), 20000, false);\r\n\r\n if (result.Status == Status.OK && result.Data != null) {\r\n this._email = email;\r\n this._password = password;\r\n var user = new User();\r\n this._user = user;\r\n user.AccessLevel = result.Data.AccessLevel;\r\n user.Email = result.Data.Email;\r\n user.Gender = result.Data.Gender;\r\n user.Guid = result.Data.Guid;\r\n user.IsAccountOnline = result.Data.IsAccountOnline;\r\n user.Name = result.Data.Name;\r\n user.IsActive = result.Data.IsActive;\r\n user.IsBanned = result.Data.IsBanned;\r\n user.Phone = result.Data.Phone;\r\n user.Surname = result.Data.Surname;\r\n\r\n if (!this._alreadySubsribedToNetworkEvents)\r\n {\r\n this._alreadySubsribedToNetworkEvents = true;\r\n connection.OnConnectionStateChangedEvent().Subscribe(this.OnConnectionStateChanged);\r\n }\r\n\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `Did logging in succeded?: ${result.Status == Status.OK}`);\r\n (this._onUserLoggedInEvent as TypedEvent<IUser>).Invoke(this._user as IUser);\r\n return user;\r\n }\r\n else {\r\n DependencyContainer.Log?.Debug(SessionService.ServiceName, `User login response: ${result.Data}`);\r\n return LoginError.WrongAuthData;\r\n }\r\n }\r\n\r\n GetServiceName(): string {\r\n return SessionService.ServiceName;\r\n }\r\n}\r\n\r\nexport class UserData {\r\n Guid: string = \"\";\r\n Name: string = \"\";\r\n Surname: string = \"\";\r\n Password: string = \"\";\r\n Email: string = \"\";\r\n Phone: string = \"\";\r\n IsActive: boolean = true;\r\n IsBanned: boolean = false;\r\n IsAccountOnline: boolean = false;\r\n AccessLevel: AccessLevel = AccessLevel.Any;\r\n Gender: Gender = Gender.Unknown;\r\n ConfigurationTime: string = \"\";\r\n IsGeolocationSet: boolean = false;\r\n UpdatesChannel: string = \"\";\r\n}\r\n\r\nclass UserLoginData {\r\n constructor(email: string, password: string) {\r\n this.Email = email;\r\n this.Password = password;\r\n }\r\n\r\n Email: string = \"\";\r\n Password: string = \"\";\r\n}\r\n\r\nclass LoginUserRequest extends DataFrame<UserLoginData>\r\n{\r\n constructor(email: string, password: string) {\r\n super();\r\n this.Data = new UserLoginData(email, password);\r\n this.Resource = \"/users/user/login\";\r\n this.Method = Method.Put;\r\n }\r\n}","import { ITypedEvent } from \"../../TypedEvent\";\r\nimport { IEvent, Event } from \"../../Event\";\r\nimport { IControllerConfigurationService } from \"./IControllerConfigurationService\";\r\nimport { TypedEvent } from '../../TypedEvent';\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { Api } from \"../../Api\";\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { ISessionService } from \"../Session/ISessionService\";\r\nimport { SessionService } from '../Session/SessionService';\r\nimport { DataFrame, Method, Status } from \"../../DataFrame\";\r\nimport { ILocalStorageService } from '../ILocalStorageService';\r\nimport { LocalStorageService } from \"../LocalStorageService\";\r\nimport { DependencyContainer } from \"../../DependencyContainer\";\r\n\r\nexport class ControllerConfigurationService implements IControllerConfigurationService {\r\n private _connection: IExalusConnectionService | null = null;\r\n private _session: ISessionService | null = null;\r\n private _localStorage: ILocalStorageService | null = null;\r\n public static readonly ServiceName: string = \"ControllerConfigurationService\";\r\n private _onEnteredConfigurationEvent: IEvent = new Event();\r\n private _onExitedConfigurationEvent: IEvent = new Event();\r\n private _onConfigurationTimeCheckedEvent: ITypedEvent<Date> = new TypedEvent<Date>();\r\n private _configurationTime: Date = new Date();\r\n private _appEnteredConfigurationMode: boolean = false;\r\n private _didConfigurationChange: boolean = false;\r\n private _synchronizationTaskCompletionSource: Promise<void> = new Promise<void>((resolve) => {\r\n Api.Get<ISessionService>(SessionService.ServiceName).OnUserLoggedInEvent().Subscribe(async user => {\r\n this._didConfigurationChange = await this.CheckIfConfigurationHasChangedAsync();\r\n resolve();\r\n });\r\n });\r\n\r\n GetServiceName(): string {\r\n return ControllerConfigurationService.ServiceName;\r\n }\r\n\r\n constructor() {\r\n this._connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n this._session = Api.Get<ISessionService>(SessionService.ServiceName);\r\n this._localStorage = Api.Get<ILocalStorageService>(LocalStorageService.ServiceName);\r\n\r\n this._connection.OnDataReceivedEvent().Subscribe(data => {\r\n if (data.Resource == \"/info/configuration/mode/entry\") {\r\n if (!this._appEnteredConfigurationMode)\r\n (this._onEnteredConfigurationEvent as Event).Invoke();\r\n }\r\n else if (data.Resource == \"/info/configuration/mode/exit\") {\r\n if (!this._appEnteredConfigurationMode)\r\n (this._onExitedConfigurationEvent as Event).Invoke();\r\n }\r\n });\r\n }\r\n\r\n async DidCofigurationChangeAsync(): Promise<boolean> {\r\n let result = await this._synchronizationTaskCompletionSource;\r\n return Promise.resolve(this._didConfigurationChange);\r\n }\r\n\r\n private GetLastKnownConfigurationChangeTime(): Date {\r\n const result = this._localStorage?.Read<string>(this.GetServiceName(), \"last_configuration_time\");\r\n\r\n if (result != null)\r\n return new Date(result);\r\n else\r\n return new Date();\r\n }\r\n\r\n private SaveLastConfigurationChangeTime(time: Date): void {\r\n this._localStorage?.Save(this.GetServiceName(), \"last_configuration_time\", time.toString());\r\n }\r\n\r\n async EnterConfigurationModeAsync(): Promise<void> {\r\n this._appEnteredConfigurationMode = true;\r\n await this._connection?.SendAndWaitForResponseAsync(new EntryConfigurationModeRequest(), 20000, false);\r\n }\r\n\r\n async ExitConfigurationModeAsync(): Promise<void> {\r\n await this._connection?.SendAndWaitForResponseAsync(new ExitConfigurationModeRequest(), 20000, false);\r\n this._appEnteredConfigurationMode = false;\r\n }\r\n\r\n OnEnteredConfigurationEvent(): IEvent {\r\n return this._onEnteredConfigurationEvent;\r\n }\r\n\r\n OnExitedConfigurationEvent(): IEvent {\r\n return this._onExitedConfigurationEvent;\r\n }\r\n\r\n OnConfigurationTimeCheckedEvent(): ITypedEvent<Date> {\r\n return this._onConfigurationTimeCheckedEvent;\r\n }\r\n\r\n async GetLastConfigurationChangeTimeAsync(): Promise<Date> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<string>(new LastChangeTimeRequest(), 20000, false);\r\n\r\n if (result == null || result?.Status != Status.OK)\r\n throw new Error(\"Failed to get last configuration change time\");\r\n\r\n this._configurationTime = new Date(result.Data as string);\r\n return this._configurationTime;\r\n }\r\n\r\n async CheckIfConfigurationHasChangedAsync(): Promise<boolean> {\r\n const result = await this.GetLastConfigurationChangeTimeAsync();\r\n if (this.GetLastKnownConfigurationChangeTime().toString() != result.toString()) {\r\n this.SaveLastConfigurationChangeTime(result);\r\n (this._onConfigurationTimeCheckedEvent as TypedEvent<Date>).Invoke(result);\r\n return true;\r\n }\r\n else\r\n return false;\r\n }\r\n}\r\n\r\nclass EntryConfigurationModeRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/system/configuration/mode/entry\";\r\n this.Method = Method.Put;\r\n }\r\n}\r\n\r\nclass ExitConfigurationModeRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/system/configuration/mode/exit\";\r\n this.Method = Method.Put;\r\n }\r\n}\r\n\r\nclass LastChangeTimeRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/system/configuration/change/time\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\n","import { Api } from '../../Api';\r\nimport { DataFrame, Status } from \"../../DataFrame\";\r\nimport { IWebApiCacheService } from \"./IWebApiCacheService\";\r\nimport { ILocalStorageService } from '../ILocalStorageService';\r\nimport { LocalStorageService } from '../LocalStorageService';\r\nimport { ILoggerService } from '../Logging/ILoggerService';\r\nimport { LoggerService } from '../Logging/LoggerService';\r\n\r\nexport class WebApiCacheService implements IWebApiCacheService {\r\n private static _localStorageService: ILocalStorageService | null = null;\r\n private _log: ILoggerService = Api.Get<ILoggerService>(LoggerService.ServiceName);\r\n public static readonly ServiceName: string = \"WebApiCacheService\";\r\n\r\n constructor() {\r\n WebApiCacheService._localStorageService = Api.Get<ILocalStorageService>(LocalStorageService.ServiceName);\r\n }\r\n\r\n GetServiceName(): string {\r\n return WebApiCacheService.ServiceName;\r\n }\r\n\r\n private GetResourceName(data: DataFrame<any>): string {\r\n return `${data.Resource}_${data.Method}`;\r\n }\r\n\r\n Cache(data: DataFrame<any>): void {\r\n \r\n if (data.Status !== Status.OK)\r\n return;\r\n\r\n this._log.Debug(WebApiCacheService.ServiceName, `Caching request: ${data.Resource} ${data.Method}`);\r\n WebApiCacheService._localStorageService?.Save(this.GetServiceName(), this.GetResourceName(data), data);\r\n }\r\n\r\n GetCache(data: DataFrame<any>): DataFrame<any> | null {\r\n let tmp = WebApiCacheService._localStorageService?.Read<DataFrame<any>>(this.GetServiceName(), this.GetResourceName(data));\r\n\r\n if (tmp != null)\r\n this._log.Debug(WebApiCacheService.ServiceName, `Got request response from cache: ${data.Resource} ${data.Method}`);\r\n\r\n return tmp as DataFrame<any>;\r\n }\r\n\r\n ClearCache(): void {\r\n WebApiCacheService._localStorageService?.DropStorage(this.GetServiceName());\r\n this._log.Debug(WebApiCacheService.ServiceName, `Clearing cache for ${this.GetServiceName()}`);\r\n }\r\n\r\n Remove(data: DataFrame<any>): void {\r\n WebApiCacheService._localStorageService?.Remove(this.GetServiceName(), this.GetResourceName(data));\r\n this._log.Debug(WebApiCacheService.ServiceName, `Clearing cache for cache: ${data.Resource} ${data.Method}`);\r\n }\r\n}","import * as signalR from \"@microsoft/signalr\";\r\nimport { DataFrame, IDataFrame, Method, Status } from \"../DataFrame\";\r\nimport { ConnectionResult, IExalusConnectionService, AuthorizationInfo, ConnectionState } from \"./IExalusConnectionService\";\r\nimport { ITypedEvent, TypedEvent } from \"../TypedEvent\";\r\nimport { Api } from '../Api';\r\nimport { LoggerService } from \"./Logging/LoggerService\";\r\nimport { ILoggerService } from './Logging/ILoggerService';\r\nimport { IEvent, Event } from \"../Event\";\r\nimport { IControllerConfigurationService } from \"./Controller/IControllerConfigurationService\";\r\nimport { ControllerConfigurationService } from \"./Controller/ControllerConfigurationService\";\r\nimport { IWebApiCacheService } from './WebApi/IWebApiCacheService';\r\nimport { WebApiCacheService } from './WebApi/WebApiCacheService';\r\nimport { ISessionService } from \"./Session/ISessionService\";\r\nimport { SessionService } from \"./Session/SessionService\";\r\nimport { AsyncLock } from \"../AsyncLock\";\r\n\r\nexport class ExalusConnectionService implements IExalusConnectionService {\r\n private _logPackets: boolean = false;\r\n private _connection?: signalR.HubConnection;\r\n private _disconnectedOnPurpose: boolean = false;\r\n private _defaultPacketsBrokerAddress?: string = \"br1.tr7.pl\";\r\n private _serversBrokerAddress?: string = \"https://broker.tr7.pl\";\r\n private _address?: string = \"br1.tr7.pl\";\r\n private _serialId?: string;\r\n private _PIN?: string;\r\n private _isEstabilished: boolean = false;\r\n private readonly _timeout: number = 10000;\r\n private _dataReceivedEvent: ITypedEvent<DataFrame<any>> = new TypedEvent<IDataFrame<any>>();\r\n private _pongReceivedEvent: IEvent = new Event();\r\n private _authorizationReceivedEvent: ITypedEvent<boolean> = new TypedEvent<boolean>();\r\n private _registrationReceivedEvent: ITypedEvent<string> = new TypedEvent<string>();\r\n private _connectionStateChangedEvent: ITypedEvent<ConnectionState> = new TypedEvent<ConnectionState>();\r\n private _errorOccuredEvent: ITypedEvent<[sender: string, data: string]> = new TypedEvent<[sender: string, data: string]>();\r\n private _log: ILoggerService = Api.Get<ILoggerService>(LoggerService.ServiceName);\r\n private _controllerConfiguration: IControllerConfigurationService | null = null;\r\n private _cache: IWebApiCacheService | null = null;\r\n private _session: SessionService | null = null;\r\n public static readonly ServiceName: string = \"ExalusConnectionService\";\r\n private _packetsBrokerServers: string[] = [\"br1.tr7.pl\", \"br1.exala.pl\"];\r\n\r\n GetServiceName(): string {\r\n return ExalusConnectionService.ServiceName;\r\n }\r\n\r\n EnablePacketsLogging(): void {\r\n this._logPackets = true;\r\n }\r\n\r\n DisablePacketsLogging(): void {\r\n this._logPackets = false;\r\n }\r\n\r\n private InitializeConnection(): void {\r\n this._controllerConfiguration = Api.Get<IControllerConfigurationService>(ControllerConfigurationService.ServiceName);\r\n this._cache = Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName);\r\n this._session = Api.Get<SessionService>(SessionService.ServiceName);\r\n\r\n if (this._connection) {\r\n try {\r\n this._connection.stop();\r\n }\r\n catch (ex: any) { }\r\n\r\n this._connection = undefined;\r\n }\r\n\r\n if (!this._address)\r\n throw new Error(\"Domain is not set\");\r\n\r\n if (!this._serialId)\r\n throw new Error(\"SerialId is not set\");\r\n\r\n if (!this._PIN)\r\n throw new Error(\"PIN is not set\");\r\n\r\n this._connection = new signalR.HubConnectionBuilder()\r\n .withUrl(`https://${this._address}/broker`)\r\n .build();\r\n }\r\n\r\n SetServersBrokerAddress(address: string): void {\r\n this._serversBrokerAddress = address;\r\n }\r\n\r\n SetDefaultPacketsBrokerAddress(address: string): void {\r\n this._defaultPacketsBrokerAddress = address;\r\n this._address = address;\r\n }\r\n\r\n async GetServerAddressAsync(): Promise<string | null> {\r\n try {\r\n let result = await fetch(`${this._serversBrokerAddress}/api/connections/broker/whichserver/${this._serialId}`);\r\n\r\n if (result.ok) {\r\n let address = await result.text();\r\n\r\n if (!address) {\r\n this._log.Error(ExalusConnectionService.ServiceName, `Failed to get server address, status: ${result.status}`);\r\n return null;\r\n }\r\n\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Got server address: ${address}`);\r\n return address;\r\n }\r\n else {\r\n this._log.Error(ExalusConnectionService.ServiceName, `Failed to get server address, status: ${result.status}`);\r\n return null;\r\n }\r\n }\r\n catch (ex: any) {\r\n this._log.Error(ExalusConnectionService.ServiceName, ex);\r\n return null;\r\n }\r\n }\r\n\r\n async ConnectAsync(address: string): Promise<ConnectionResult> {\r\n this._address = address;\r\n return await this.connectAsync();\r\n }\r\n\r\n AuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<boolean> {\r\n let timeoutTime = 2000;\r\n return new Promise<boolean>(async (resolve, reject) => {\r\n let timeoutId = 0;\r\n\r\n let sub = (result: boolean) => {\r\n window.clearTimeout(timeoutId);\r\n this._authorizationReceivedEvent.Unsubscribe(sub);\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Got authorization result: ${result}`);\r\n resolve(result);\r\n };\r\n\r\n let onTimeout = () => {\r\n window.clearTimeout(timeoutId);\r\n this._authorizationReceivedEvent.Unsubscribe(sub);\r\n resolve(false);\r\n };\r\n\r\n timeoutId = window.setTimeout(onTimeout, timeoutTime);\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Authorizing to cloud using: ${authorizationInfo.SerialNumber} PIN: ${authorizationInfo.PIN}`);\r\n this._authorizationReceivedEvent.Subscribe(sub);\r\n await this._connection?.send(\"AuthorizeTo\", authorizationInfo.SerialNumber, authorizationInfo.PIN);\r\n });\r\n }\r\n\r\n async ConnectAndAuthorizeAsync(authorizationInfo: AuthorizationInfo): Promise<ConnectionResult> {\r\n //if (this._isEstabilished)\r\n // return Promise.resolve(ConnectionResult.Connected);\r\n\r\n //this._isEstabilished = true;\r\n\r\n Api.WorksInContextOf = authorizationInfo.SerialNumber;\r\n this._serialId = authorizationInfo.SerialNumber;\r\n this._PIN = authorizationInfo.PIN;\r\n var packetsBroker = await this.GetServerAddressAsync();\r\n\r\n if (!packetsBroker || packetsBroker == null) {\r\n let result = ConnectionResult.ControllerIsNotConnected;\r\n\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Server did not return packets broker address, trying to connect to known brokers.`);\r\n\r\n for (let server of this._packetsBrokerServers) {\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Testing connection to ${server}`);\r\n this.SetDefaultPacketsBrokerAddress(server);\r\n\r\n try {\r\n await this.DisconnectAsync();\r\n }\r\n catch (ex: any) { }\r\n\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Connecting to server: ${server}`);\r\n let conResult = await this.connectAsync();\r\n\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Connection result: ${conResult}`);\r\n if (conResult == ConnectionResult.Connected)\r\n if (await this.AuthorizeAsync(authorizationInfo)) {\r\n result = ConnectionResult.Connected;\r\n return result;\r\n }\r\n else {\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Failed to authorize in ${server}`);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n else {\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Got packets broker address: ${packetsBroker}`);\r\n this.SetDefaultPacketsBrokerAddress(packetsBroker);\r\n let conResult = await this.connectAsync();\r\n\r\n if (conResult != ConnectionResult.Connected)\r\n return conResult;\r\n\r\n return await this.AuthorizeAsync(authorizationInfo)\r\n ? ConnectionResult.Connected : ConnectionResult.AuthorizationFailed;\r\n }\r\n }\r\n\r\n private async connectAsync(): Promise<ConnectionResult> {\r\n let result = ConnectionResult.FailedToConnect;\r\n\r\n if (!this._address)\r\n return Promise.resolve(ConnectionResult.ControllerIsNotConnected);\r\n\r\n if (this._disconnectedOnPurpose) {\r\n this._disconnectedOnPurpose = false;\r\n }\r\n\r\n const connectionEvent = this._connectionStateChangedEvent as TypedEvent<ConnectionState>;\r\n this.InitializeConnection();\r\n\r\n this._connection?.onclose(async () => {\r\n this._log.Error(ExalusConnectionService.ServiceName, `Connection closed`);\r\n\r\n Api.Get<SessionService>(SessionService.ServiceName).CreateSessionCompletionSourceAsync();\r\n this.FireConnectionStateChanged();\r\n\r\n if (this._connection?.state !== signalR.HubConnectionState.Disconnected)\r\n return;\r\n\r\n if (this._disconnectedOnPurpose)\r\n return;\r\n\r\n await this._connection?.start();\r\n\r\n if (this._connection != null) {\r\n await this.AuthorizeAsync(new AuthorizationInfo(this._serialId as string, this._PIN as string));\r\n this._log.Info(ExalusConnectionService.ServiceName, `Reconnected from onClose`);\r\n return this.FireConnectionStateChanged();\r\n }\r\n\r\n return ConnectionResult.FailedToConnect;\r\n });\r\n\r\n this._connection?.onreconnected(async () => {\r\n await this.AuthorizeAsync(new AuthorizationInfo(this._serialId as string, this._PIN as string));\r\n this._log.Info(ExalusConnectionService.ServiceName, `Reconnected from onreconnected`);\r\n return this.FireConnectionStateChanged();\r\n });\r\n\r\n this._connection?.onreconnecting(() => {\r\n this._log.Warning(ExalusConnectionService.ServiceName, `Reconnecting...`);\r\n return this.FireConnectionStateChanged();\r\n });\r\n\r\n await this._connection?.start();\r\n\r\n this._connection?.on(\"Pong\", () => {\r\n this._log.Debug(ExalusConnectionService.ServiceName, \"Pong received <-\");\r\n (this._pongReceivedEvent as Event).Invoke();\r\n });\r\n\r\n this._connection?.on(\"Registration\", (data: string) => {\r\n (this._registrationReceivedEvent as TypedEvent<string>)?.Invoke(data);\r\n });\r\n\r\n this._connection?.on(\"Authorization\", (data: boolean) => {\r\n (this._authorizationReceivedEvent as TypedEvent<boolean>)?.Invoke(data);\r\n });\r\n\r\n this._connection?.on(\"SendError\", async (sender: string, data: string) => {\r\n if (sender.startsWith(\"NotAuthorized:\")) {\r\n this._log.Error(ExalusConnectionService.ServiceName, \"Failed to authorize!\");\r\n await this.AuthorizeAsync(new AuthorizationInfo(this._serialId as string, this._PIN as string));\r\n }\r\n else {\r\n this._log.Error(ExalusConnectionService.ServiceName, `Server returned error: ${sender} ${data}`);\r\n (this._errorOccuredEvent as TypedEvent<[sender: string, data: string]>).Invoke([sender, data]);\r\n }\r\n });\r\n\r\n let dataReceivedEvent = this._dataReceivedEvent as TypedEvent<IDataFrame<any>>;\r\n\r\n this._connection?.on(\"Data\", (sender: string, data: string) => {\r\n const d = JSON.parse(data);\r\n\r\n if (this._logPackets)\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Received data:\\n${JSON.stringify(d, null, 2)}`);\r\n\r\n dataReceivedEvent.Invoke(d as IDataFrame<any>);\r\n });\r\n\r\n if (this._connection != null)\r\n return this.FireConnectionStateChanged();\r\n\r\n return ConnectionResult.FailedToConnect;\r\n }\r\n\r\n FireConnectionStateChanged(): ConnectionResult {\r\n const connectionEvent = this._connectionStateChangedEvent as TypedEvent<ConnectionState>;\r\n\r\n switch (this._connection?.state) {\r\n case signalR.HubConnectionState.Connected:\r\n connectionEvent.Invoke(ConnectionState.Connected);\r\n return ConnectionResult.Connected;\r\n\r\n case signalR.HubConnectionState.Connecting:\r\n connectionEvent.Invoke(ConnectionState.Connecting);\r\n return ConnectionResult.Connected;\r\n\r\n case signalR.HubConnectionState.Disconnected:\r\n connectionEvent.Invoke(ConnectionState.Disconnected);\r\n return ConnectionResult.FailedToConnect;\r\n\r\n case signalR.HubConnectionState.Disconnecting:\r\n connectionEvent.Invoke(ConnectionState.Disconnecting);\r\n return ConnectionResult.FailedToConnect;\r\n\r\n case signalR.HubConnectionState.Reconnecting:\r\n connectionEvent.Invoke(ConnectionState.Reconnecting);\r\n return ConnectionResult.FailedToConnect;\r\n }\r\n\r\n return ConnectionResult.FailedToConnect;\r\n }\r\n\r\n async DisconnectAsync(): Promise<void> {\r\n this._disconnectedOnPurpose = true;\r\n await this._connection?.stop();\r\n }\r\n\r\n IsConnected(): boolean {\r\n return this._connection?.state === signalR.HubConnectionState.Connected;\r\n }\r\n\r\n SendAndWaitForResponseAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean, logTransmission: boolean = true): Promise<IDataFrame<T>> {\r\n return this.SendAndWaitForResponseWithRepeatAsync(dataFrame, timeout, useCache, logTransmission);\r\n }\r\n\r\n async SendAndWaitForResponseWithRepeatAsync<T>(dataFrame: IDataFrame<any>, timeout: number, useCache: boolean, repeat = true, logTransmission: boolean = true): Promise<IDataFrame<T>> {\r\n if (dataFrame.Method === Method.Get && useCache) {\r\n if (!await this._controllerConfiguration?.DidCofigurationChangeAsync()) {\r\n let res = this._cache?.GetCache(dataFrame) as IDataFrame<T>;\r\n\r\n if (res !== null) {\r\n return Promise.resolve(res);\r\n }\r\n }\r\n }\r\n\r\n let timeoutId = 0;\r\n const startTime = Date.now();\r\n\r\n if (!this.IsConnected())\r\n throw new Error(\"Connection is not established\");\r\n\r\n if (dataFrame.Resource !== \"/users/user/login\")\r\n await this._session?.WaitForSessionCreationAsync();\r\n\r\n return new Promise<IDataFrame<T>>(async (resolve, reject) => {\r\n let onReceivedFrame = async (receivedFrame?: IDataFrame<any>) => {\r\n if (receivedFrame?.TransactionId == dataFrame.TransactionId) {\r\n window.clearTimeout(timeoutId);\r\n this._dataReceivedEvent.Unsubscribe(onReceivedFrame);\r\n const difference = Date.now() - startTime;\r\n\r\n if (logTransmission)\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Received response for: ${receivedFrame?.Resource} ${receivedFrame?.Method} id: ${receivedFrame?.TransactionId} in ${difference}ms`);\r\n\r\n if (dataFrame.Method === Method.Get && useCache)\r\n this._cache?.Cache(receivedFrame as DataFrame<any>);\r\n\r\n if (!useCache && receivedFrame?.Status === Status.UserIsNotLoggedIn && repeat) {\r\n await this._session?.RestoreSessionAsync();\r\n resolve(await this.SendAndWaitForResponseWithRepeatAsync(dataFrame, timeout, useCache, false, logTransmission));\r\n }\r\n\r\n resolve(receivedFrame as IDataFrame<T>);\r\n }\r\n };\r\n\r\n this._dataReceivedEvent.Subscribe(onReceivedFrame);\r\n\r\n timeoutId = window.setTimeout(() => {\r\n this._dataReceivedEvent.Unsubscribe(onReceivedFrame);\r\n let errorMessage = `Response timeout, resource: ${dataFrame.Resource} method: ${dataFrame.Method} transaction id: ${dataFrame.TransactionId}`;\r\n this._log.Error(ExalusConnectionService.ServiceName, errorMessage);\r\n reject(new signalR.TimeoutError(errorMessage));\r\n }, timeout);\r\n\r\n if (!await this.SendAsync(dataFrame, logTransmission)) {\r\n let errorMessage = `Failed to send request, resource: ${dataFrame.Resource} method: ${dataFrame.Method} transaction id: ${dataFrame.TransactionId}`;\r\n reject(new Error(errorMessage));\r\n }\r\n });\r\n }\r\n\r\n SendAsync(dataFrame: IDataFrame<any>, logTransmission: boolean = false): Promise<boolean> {\r\n\r\n if (!this.IsConnected())\r\n throw new Error(\"Connection is not established\");\r\n\r\n return new Promise<boolean>((resolve) => {\r\n\r\n if (this._logPackets)\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Sent DataFrame ${dataFrame.Resource} ${dataFrame.Method} transaction id: ${dataFrame.TransactionId} data:\\n${JSON.stringify(dataFrame, null, 2)}`);\r\n\r\n else if (logTransmission)\r\n this._log.Debug(ExalusConnectionService.ServiceName, `Sent DataFrame ${dataFrame.Resource} ${dataFrame.Method} transaction id: ${dataFrame.TransactionId}`);\r\n\r\n\r\n this._connection?.invoke(\"SendTo\", this._serialId, dataFrame)\r\n .then(() => {\r\n resolve(true);\r\n })\r\n .catch(err => {\r\n this._log.Error(ExalusConnectionService.ServiceName, `${err}`);\r\n resolve(false);\r\n });\r\n });\r\n }\r\n\r\n OnDataReceivedEvent(): ITypedEvent<any> {\r\n return this._dataReceivedEvent;\r\n }\r\n\r\n OnConnectionStateChangedEvent(): ITypedEvent<ConnectionState> {\r\n return this._connectionStateChangedEvent;\r\n }\r\n\r\n OnErrorOccuredEvent(): ITypedEvent<[sender: string, data: string]> {\r\n return this._errorOccuredEvent;\r\n }\r\n}","import { IDeviceState, IDeviceStateData } from './IDeviceState';\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\nimport { IDeviceTask } from './IDeviceTask';\r\nimport { DeviceResponseType, DeviceTaskType, IDevice, IDeviceResponseTypeInfo, IDeviceTaskTypeInfo } from './IDevice';\r\nimport { ITypedEvent } from '../../TypedEvent';\r\nimport { FieldChangeResult, FieldChangeResultType } from '../FieldChangeResult';\r\n\r\nexport interface IDeviceChannel\r\n{\r\n get Number(): number;\r\n set Number(value: number);\r\n\r\n get Name(): string;\r\n set Name(value: string);\r\n\r\n get IconName(): string;\r\n set IconName(value: string);\r\n\r\n get States(): IDeviceState<IDeviceStateData>[];\r\n\r\n get Mode(): ChannelConfigurations;\r\n get ChannelGroups(): string[];\r\n\r\n get IsHidden(): boolean;\r\n \r\n get AvailableTaskTypes(): IDeviceTaskTypeInfo[];\r\n get AvailableResponseTypes(): IDeviceResponseTypeInfo[];\r\n \r\n GetDevice(): IDevice;\r\n HideAsync(): Promise<FieldChangeResult>;\r\n ShowAsync(): Promise<FieldChangeResult>;\r\n ChangeNameAsync(name: string): Promise<FieldChangeResult>;\r\n ChangeIconNameAsync(name: string): Promise<FieldChangeResult>;\r\n ChangeGroupsAsync(groups: string[]): Promise<FieldChangeResult>;\r\n ExecuteTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult>;\r\n OnTasksExecutionChangeEvent(): ITypedEvent<TaskExecution>;\r\n}\r\n\r\nexport enum TaskExecution {\r\n NoTasksExecuting = 0,\r\n ExecutingTasks = 1\r\n}\r\n\r\nexport enum ChannelConfigurations\r\n {\r\n Default = 0,\r\n Monostable = 1,\r\n Bistable = 2,\r\n Gate = 3,\r\n Gateway = 4,\r\n }","import { IDeviceTask } from './IDeviceTask';\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\nimport { ChannelConfigurations, IDeviceChannel, TaskExecution } from './IDeviceChannel';\r\nimport { FieldChangeResult } from '../FieldChangeResult';\r\nimport { ITypedEvent } from '../../TypedEvent';\r\nimport { IDeviceState, IDeviceStateData } from './IDeviceState';\r\n\r\nexport interface IDevice {\r\n OnDeviceStateChangedEvent(): ITypedEvent<IDeviceState<any>>;\r\n OnDeviceTasksExecutionChangedOnChannelsEvent(): ITypedEvent<number[]>;\r\n\r\n get Guid(): string;\r\n get Name(): string;\r\n get SerialNumber(): string | null;\r\n get ModelGuid(): string | null;\r\n get ManufacturerGuid(): string | null;\r\n get IsVirtual(): boolean;\r\n get IsEnabled(): boolean;\r\n get DeviceState(): DeviceState;\r\n get DeviceType(): DeviceType;\r\n get CommunicationWay(): CommunicationWay;\r\n get AvailableTaskTypes(): IDeviceTaskTypeInfo[];\r\n get AvailableResponseTypes(): IDeviceResponseTypeInfo[];\r\n get ChannelsAmount(): number;\r\n get Channels(): IDeviceChannel[];\r\n get States(): IDeviceState<IDeviceStateData>[];\r\n\r\n ChangeDeviceNameAsync(name: string): Promise<FieldChangeResult>;\r\n RemoveDeviceAsync(): Promise<DeviceTaskExecutionResult>;\r\n ExecuteDeviceTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult>;\r\n ExecuteTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult>;\r\n}\r\n\r\nexport interface IDeviceTaskTypeInfo {\r\n get Type(): DeviceTaskType;\r\n get InterfaceType(): string;\r\n}\r\n\r\nexport class DeviceTaskTypeInfo implements IDeviceTaskTypeInfo {\r\n private _type: DeviceTaskType = DeviceTaskType.Unknown;\r\n private _interfaceType: string = \"\";\r\n\r\n get Type(): DeviceTaskType {\r\n return this._type;\r\n }\r\n\r\n get InterfaceType(): string {\r\n return this._interfaceType;\r\n }\r\n\r\n set InterfaceType(value: string) {\r\n this._interfaceType = value;\r\n this._type = value as DeviceTaskType;\r\n }\r\n}\r\n\r\nexport enum DeviceTaskType {\r\n Unknown = \"Unknown\",\r\n SetBlindPosition = \"IBlindPosition\",\r\n SetBlindPositionSimple = \"IBlindPositionSimple\",\r\n SetBlindMicroventilation = \"IMicroventilation\",\r\n TurnOff = \"IChannelOff\",\r\n TurnOn = \"IChannelOn\",\r\n TogleState = \"IChannelSwitchState\",\r\n SetLightBrightnessDynamicly = \"IDynamicLightBrightness\",\r\n SetLightBrightness = \"ILightBrightness\",\r\n SetLightColor = \"ILightColor\",\r\n SetLightTemperature = \"ILightTemperature\",\r\n PairDevice = \"IPair\",\r\n UnpairDevice = \"IUnpair\",\r\n IdentifyDevice = \"IIdentifyDevice\",\r\n GetChannelsState = \"IGetDeviceState\",\r\n GetPowerMeasurements = \"IGetPowerMeasurements\",\r\n GetAvailableData = \"IGetAvailableData\",\r\n MultipleDataRequest = \"IMultipleDataRequest\",\r\n SetBlindOpenCloseTime = \"ISetBlindOpenCloseTime\",\r\n SetTemperature = \"IChangeTemperature\",\r\n //SetGatePosition = \"IGatePosition\",\r\n //SetGatewayPosition = \"IGatewayPosition\",\r\n ChangeGatePositionPulse = \"IGatePulse\",\r\n ChangeGatewayPositionPulse = \"IGatewayPulse\",\r\n SetFacadePosition = \"IFacadePosition\",\r\n GetFacadeType = \"IGetFacadeType\"\r\n}\r\n\r\nexport interface IDeviceResponseTypeInfo {\r\n get Type(): DeviceResponseType;\r\n get InterfaceType(): string;\r\n}\r\n\r\nexport class DeviceResponseTypeInfo implements IDeviceResponseTypeInfo {\r\n private _type: DeviceResponseType = DeviceResponseType.Unknown;\r\n private _interfaceType: string = \"\";\r\n\r\n get Type(): DeviceResponseType {\r\n return this._type;\r\n }\r\n\r\n get InterfaceType(): string {\r\n return this._interfaceType;\r\n }\r\n\r\n set InterfaceType(value: string) {\r\n this._interfaceType = value;\r\n this._type = value as DeviceResponseType;\r\n }\r\n}\r\n\r\nexport enum DeviceResponseType {\r\n Unknown = \"Unknown\",\r\n BatteryState = \"IBatteryState\",\r\n BinarySensorState = \"IBinarySensor\",\r\n BlindOpenCloseTime = \"IBlindOpenCloseTime\",\r\n BlindPosition = \"IBlindPosition\",\r\n BlindRemoteButtonState = \"IBlindsControlButton\",\r\n MeasuredBrightness = \"IBrightness\",\r\n RemoteButtonState = \"IButtonState\",\r\n ChannelOnOffState = \"IChannelOnOff\",\r\n DoorBellState = \"IDoorBell\",\r\n FacadeRemoteButtonState = \"IFacadeControlButton\",\r\n FacadePosition = \"IFacadeState\",\r\n FacadeType = \"IFacadeType\",\r\n FloodSensorState = \"IFloodSensor\",\r\n GatePosition = \"IGatePosition\",\r\n GatewayPosition = \"IGatewayPosition\",\r\n HumiditySensorState = \"IHumiditySensor\",\r\n LightBrightness = \"ILightBrightness\",\r\n LightColor = \"ILightColor\",\r\n LightWarmth = \"ILightTemperature\",\r\n LightTreshold = \"ILightTreshold\",\r\n MovementSensorState = \"IMovementSensor\",\r\n OnlineCamera = \"IOnlineCamera\",\r\n OvercurrentProtectionState = \"IOvercurrentProtection\",\r\n OvercurrentProtectionThreshold = \"IOvercurrentProtectionThreshold\",\r\n ReedState = \"IReedState\",\r\n SignalStrength = \"ISignalStrength\",\r\n SmokeSensorState = \"ISmokeSensor\",\r\n MeasuredTemperature = \"ITemperature\",\r\n VibrationSensorState = \"IVibrationSensor\",\r\n MeasuredWindSpeed = \"IWindSpeed\",\r\n WindThreshold = \"IWindThreshold\",\r\n MeasuredEnergy = \"IEnergy\",\r\n MeasuredDistance = \"DistanceSensor\",\r\n BlindCalibration = \"BlindCalibration\",\r\n ConfigurationState = \"ConfigurationState\",\r\n CurrentWindThreshold = \"CurrentWindThreshold\",\r\n CurrentLightThreshold = \"CurrentLightThreshold\",\r\n WindSpeedState = \"WindSpeed\",\r\n TamperProtectionState = \"ITamperProtection\",\r\n PressureSensorState = \"IPressureSensor\",\r\n}\r\n\r\nexport enum DeviceState {\r\n NotResponding = 0,\r\n Working = 1,\r\n Broken = 2,\r\n FirmareUpgradeMode = 3\r\n}\r\n\r\nexport enum CommunicationWay {\r\n TwoWay = 1,\r\n OneWay = 2,\r\n ConditionalTwoWay = 3\r\n}\r\n\r\nexport enum DeviceType {\r\n Unknown = -1,\r\n Multipurpose = 0,\r\n Controller = 1,\r\n Driver = 2,\r\n Receiver = 3,\r\n Remote = 4,\r\n Sensor = 5,\r\n Scene = 6,\r\n}\r\n\r\nexport class DeviceTasksInfo {\r\n DeviceGuid: string = \"\";\r\n Channel: number = 0;\r\n Status: TaskExecution = TaskExecution.NoTasksExecuting;\r\n}\r\n\r\nexport enum TaskExecutionResult {\r\n Unknown = 0,\r\n Executed = 1,\r\n ResponseTimeout = 2,\r\n TaskRepeatedAndExecuted = 3,\r\n TaskRepeatedResponseTimeout = 4,\r\n FlowControlNotAvailable = 5,\r\n ExecutionError = 6,\r\n}","export enum DeviceTaskExecutionResult {\r\n ControllerResponseTimeout = -4,\r\n DeviceNotFound = -3,\r\n DeviceResponseTimeout = -2,\r\n Failed = -1,\r\n Unknown = 0,\r\n Executed = 1,\r\n}","import { DeviceResponseType } from \"./IDevice\";\r\nimport { DeviceStateChangedObject } from \"./DevicesService\";\r\n\r\nexport class DeviceState<T extends IDeviceStateData> implements IDeviceState<T> {\r\n _type: string = \"\";\r\n _data: T | null = null;\r\n _typeAsEnum: DeviceResponseType = DeviceResponseType.Unknown;\r\n\r\n get Data(): T {\r\n return this._data as T;\r\n }\r\n\r\n set Data(value: T) {\r\n this._data = value;\r\n }\r\n\r\n get Type(): string {\r\n return this._type;\r\n }\r\n\r\n set Type(value: string) {\r\n this._type = value;\r\n }\r\n\r\n get TypeAsEnum(): DeviceResponseType {\r\n return this._typeAsEnum;\r\n }\r\n\r\n set TypeAsEnum(value: DeviceResponseType) {\r\n this._typeAsEnum = value;\r\n }\r\n}\r\n\r\nexport interface IDeviceStateData {\r\n Channel: number;\r\n StateReliability: StateReliability;\r\n Time: string;\r\n}\r\n\r\nexport interface IDeviceState<T extends IDeviceStateData> {\r\n get Type(): string;\r\n get TypeAsEnum(): DeviceResponseType;\r\n get Data(): T;\r\n set Data(value: T);\r\n}\r\n\r\nexport enum StateReliability {\r\n /// <summary>\r\n /// pewny\r\n /// </summary>\r\n Confident = 0,\r\n /// <summary>\r\n /// niepewny\r\n /// </summary>\r\n Unconfident = 1\r\n}\r\n\r\n/// ON/OFF state\r\nexport class ChannelOnOffDeviceState extends DeviceState<ChannelOnOffState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.ChannelOnOffState;\r\n this.Type = \"ChannelOnOffState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class ChannelOnOffState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: ChannelOnOffStateEnum = ChannelOnOffStateEnum.Unknown;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum ChannelOnOffStateEnum {\r\n On = 0,\r\n Off = 1,\r\n Unknown = 2\r\n}\r\n\r\n/// DoorBellState \r\nexport class DoorBellDeviceState extends DeviceState<DoorBellState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.DoorBellState;\r\n this.Type = \"DoorBellState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class DoorBellState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: DoorBellStateEnum = DoorBellStateEnum.Relased;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum DoorBellStateEnum {\r\n Pressed = 0,\r\n Relased = 1,\r\n PressedAndRelased = 2\r\n}\r\n\r\n/// reed position\r\nexport class ReedStateDeviceState extends DeviceState<ReedState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.ReedState;\r\n this.Type = \"ReedState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class ReedState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: boolean = false;\r\n Time: string = \"\";\r\n}\r\n\r\n/// blind position\r\nexport class BlindPositionDeviceState extends DeviceState<BlindPostionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BlindPosition;\r\n this.Type = \"BlindPostionState\";\r\n this.Data = state.state as any;\r\n }\r\n\r\n public GetBlindStatus(): BlindStatusCode {\r\n switch (this.Data.Position) {\r\n case 200:\r\n return BlindStatusCode.UnableToMove;\r\n\r\n case 201:\r\n return BlindStatusCode.MotorOverheatedPleaseWait;\r\n\r\n default:\r\n return BlindStatusCode.Working;\r\n }\r\n }\r\n}\r\n\r\nexport enum BlindStatusCode {\r\n Unknown = 0,\r\n Working = 1,\r\n UnableToMove = 200,\r\n MotorOverheatedPleaseWait = 201,\r\n}\r\n\r\nexport class BlindPostionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Position: number = 0;\r\n RawPosition: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// ButtonState \r\nexport class RemoteButtonDeviceState extends DeviceState<RemoteButtonState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.RemoteButtonState;\r\n this.Type = \"RemoteButtonState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class RemoteButtonState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: RemoteButtonStateEnum = RemoteButtonStateEnum.Relased;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum RemoteButtonStateEnum {\r\n Pressed = 1,\r\n Relased = 2,\r\n PressedAndRelased = 3\r\n}\r\n\r\n/// device light color\r\nexport class LightColorDeviceState extends DeviceState<LightColorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.LightColor;\r\n this.Type = \"LightColorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class LightColorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n R: number = 0;\r\n G: number = 0;\r\n B: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// light warmth\r\nexport class LightWarmthDeviceState extends DeviceState<LightWarmthState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.LightWarmth;\r\n this.Type = \"LightWarmthState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class LightWarmthState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Temperature: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// light brightness\r\nexport class LightBrightnessDeviceState extends DeviceState<LightBrightnessState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.LightBrightness;\r\n this.Type = \"LightBrightnessState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class LightBrightnessState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Brightness: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// MeasuredTemperature\r\nexport class MeasuredTemperatureDeviceState extends DeviceState<MeasuredTemperatureState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MeasuredTemperature;\r\n this.Type = \"MeasuredTemperatureState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MeasuredTemperatureState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Temperature: number = 0;\r\n Type: MeasuredTemperatureTypeEnum = MeasuredTemperatureTypeEnum.InsideTemperature;\r\n Time: string = \"\";\r\n}\r\n\r\nenum MeasuredTemperatureTypeEnum {\r\n AirTemperature = 0,\r\n InsideTemperature = 1,\r\n OutsideTemperature = 2,\r\n FloorTemperature = 3,\r\n SafetyTemperature = 4,\r\n SetTemperature = 5,\r\n}\r\n\r\n/// battery state\r\nexport class BatteryDeviceState extends DeviceState<BatteryState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BatteryState;\r\n this.Type = \"BatteryState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BatteryState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: BatteryStateEnum = BatteryStateEnum.Half;\r\n Percentage: number = -1;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum BatteryStateEnum {\r\n Unknown = -1,\r\n Full = 0,\r\n Empty = 1,\r\n Half = 2,\r\n Percentage = 3,\r\n Low = 4,\r\n ExternalPower = 5\r\n}\r\n\r\n/// measured brightness\r\nexport class MeasuredBrightnessDeviceState extends DeviceState<MeasuredBrightnessState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MeasuredBrightness;\r\n this.Type = \"MeasuredBrightnessState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MeasuredBrightnessState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Brightness: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// measured energy\r\nexport class MeasuredEnergyDeviceState extends DeviceState<MeasuredEnergyState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MeasuredEnergy;\r\n this.Type = \"MeasuredEnergyState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MeasuredEnergyState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Voltage: number = 0;\r\n Current: number = 0;\r\n PhaseShift: number = 0;\r\n ActivePower: number = 0;\r\n ReactivePower: number = 0;\r\n ApparentPower: number = 0;\r\n PowerFactor: number = 0;\r\n ActiveEnergy: number = 0;\r\n ReactiveEnergy: number = 0;\r\n Frequency: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// measured distance\r\nexport class MeasuredDistanceDeviceState extends DeviceState<MeasuredDistanceState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MeasuredDistance;\r\n this.Type = \"MeasuredDistanceState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MeasuredDistanceState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Distance: number = 0;\r\n DetectedObject: DetectedObjectStateEnum = DetectedObjectStateEnum.No;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum DetectedObjectStateEnum {\r\n No = 0,\r\n Yes = 1,\r\n}\r\n\r\n/// movement detection\r\nexport class MovementSensorDeviceState extends DeviceState<MovementSensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.MovementSensorState;\r\n this.Type = \"MovementSensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class MovementSensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n /// <summary>\r\n /// percentage 0% no movement, 100% intense movement\r\n /// </summary>\r\n Intensity: number = 0;\r\n Movement: MovementStateEnum = MovementStateEnum.No;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum MovementStateEnum {\r\n No = 0,\r\n Yes = 1,\r\n}\r\n\r\n/// remote blind control button\r\nexport class BlindRemoteButtonDeviceState extends DeviceState<BlindRemoteButtonState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BlindRemoteButtonState;\r\n this.Type = \"BlindRemoteButtonState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BlindRemoteButtonState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: BlindRemoteButtonStateEnum = BlindRemoteButtonStateEnum.StopReleased;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum BlindRemoteButtonStateEnum {\r\n OpenPressed = 1,\r\n OpenReleased = 2,\r\n StopPressed = 3,\r\n StopReleased = 4,\r\n ClosePressed = 5,\r\n CloseReleased = 6\r\n}\r\n\r\n/// remote facade control button\r\nexport class FacadeRemoteButtonDeviceState extends DeviceState<FacadeRemoteButtonState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.FacadeRemoteButtonState;\r\n this.Type = \"FacadeRemoteButtonState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class FacadeRemoteButtonState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: FacadeRemoteButtonStateEnum = FacadeRemoteButtonStateEnum.StopReleased;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum FacadeRemoteButtonStateEnum {\r\n OpenPressed = 1,\r\n OpenReleased = 2,\r\n StopPressed = 3,\r\n StopReleased = 4,\r\n ClosePressed = 5,\r\n CloseReleased = 6\r\n}\r\n\r\n/// signal strenght\r\nexport class SignalStrenghtDeviceState extends DeviceState<SignalStrenghtState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.SignalStrength;\r\n this.Type = \"SignalStrenghtState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class SignalStrenghtState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Quality: LinkQualityEnum = LinkQualityEnum.Unknown;\r\n MeasurementTime: string = \"\";\r\n DidLastTaskSucceded: boolean = false;\r\n Percentage: number = 0;\r\n SuccededExecutionsPercentage: number = 0;\r\n SuccededTransmissionsPercentage: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum LinkQualityEnum {\r\n Unknown = 0,\r\n Excellent = 1,\r\n Good = 2,\r\n Acceptable = 3,\r\n Low = 4,\r\n Terrible = 5,\r\n NoLink = 6\r\n}\r\n\r\n/// gate position\r\nexport class GatePositionDeviceState extends DeviceState<GatePositionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.GatePosition;\r\n this.Type = \"GatePositionState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class GatePositionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n PositionType: GatePositionTypeEnum = GatePositionTypeEnum.Unknown;\r\n Position: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum GatePositionTypeEnum {\r\n Unknown = 0,\r\n Open = 1,\r\n PartiallyOpen = 2,\r\n Close = 3,\r\n //On = 4,\r\n //Off = 5\r\n}\r\n\r\n/// gateway position\r\nexport class GatewayPositionDeviceState extends DeviceState<GatewayPositionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.GatewayPosition;\r\n this.Type = \"GatewayPositionState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class GatewayPositionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n PositionType: GatewayPositionTypeEnum = GatewayPositionTypeEnum.Unknown;\r\n Position: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum GatewayPositionTypeEnum {\r\n Unknown = 0,\r\n Open = 1,\r\n PartiallyOpen = 2,\r\n Close = 3,\r\n On = 4,\r\n Off = 5\r\n}\r\n\r\n/// blind calibration status\r\nexport class BlindCalibrationDeviceState extends DeviceState<BlindCalibrationState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BlindCalibration;\r\n this.Type = \"BlindCalibrationState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BlindCalibrationState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n CalibrationStatus: BlindCalibrationStatusEnum = BlindCalibrationStatusEnum.AutoLernIdle;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum BlindCalibrationStatusEnum {\r\n AutoLernIdle = 0x00,\r\n AutoLernInProgress = 0x01,\r\n AutoLernSuccessfull = 0x02,\r\n AutoLernCancelled = 0x04,\r\n}\r\n\r\n/// humidity sensor\r\nexport class HumiditySensorDeviceState extends DeviceState<HumiditySensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.HumiditySensorState;\r\n this.Type = \"HumiditySensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class HumiditySensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Type: HumidityTypeEnum = HumidityTypeEnum.AirHumidity;\r\n Humidity: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum HumidityTypeEnum {\r\n AirHumidity = 0,\r\n InsideHumidity = 1,\r\n OutsideHumidity = 2,\r\n SafetyHumidity = 3,\r\n SetHumidity = 4,\r\n}\r\n\r\n\r\n/// Vibration sensor\r\nexport class VibrationSensorDeviceState extends DeviceState<VibrationSensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.VibrationSensorState;\r\n this.Type = \"VibrationSensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class VibrationSensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Vibration: VibrationTypeEnum = VibrationTypeEnum.No;\r\n Acceleration_X: number = 0;\r\n Acceleration_Y: number = 0;\r\n Acceleration_Z: number = 0;\r\n AccelerationModule: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum VibrationTypeEnum {\r\n No = 0,\r\n Yes = 1,\r\n}\r\n\r\n/// binary sensor\r\nexport class BinarySensorStateDeviceState extends DeviceState<BinarySensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BinarySensorState;\r\n this.Type = \"BinarySensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BinarySensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: BinarySensorStateEnum = BinarySensorStateEnum.Low;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum BinarySensorStateEnum {\r\n High = 1,\r\n Low = 0\r\n}\r\n\r\n/// ConfigurationState\r\nexport class ConfigurationDeviceState extends DeviceState<ConfigurationState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.ConfigurationState;\r\n this.Type = \"ConfigurationState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class ConfigurationState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Configuration: ConfigurationStateEnum = ConfigurationStateEnum.Unknown;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum ConfigurationStateEnum {\r\n Unknown = 0,\r\n OngoingConfiguration = 1,\r\n NotConfigured = 2,\r\n Configured = 3,\r\n PartiallyConfigured = 4\r\n}\r\n\r\n/// BlindOpenCloseTime\r\nexport class BlindOpenCloseTimeDeviceState extends DeviceState<BlindOpenCloseTimeState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.BlindOpenCloseTime;\r\n this.Type = \"BlindOpenCloseTimeState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class BlindOpenCloseTimeState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Vibration: VibrationTypeEnum = VibrationTypeEnum.No;\r\n CloseTime: number = 0;\r\n OpenTime: number = 0;\r\n HallCounter: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// OvercurrentProtection\r\nexport class OvercurrentProtectionDeviceState extends DeviceState<OvercurrentProtectionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.OvercurrentProtectionState;\r\n this.Type = \"OvercurrentProtectionState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class OvercurrentProtectionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Triggered: boolean = false;\r\n Time: string = \"\";\r\n}\r\n\r\n/// OvercurrentProtectionThreshold\r\nexport class OvercurrentProtectionThresholdDeviceState extends DeviceState<OvercurrentProtectionThresholdState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.OvercurrentProtectionThreshold;\r\n this.Type = \"OvercurrentProtectionThresholdState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class OvercurrentProtectionThresholdState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Current: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n/// FacadePositionDeviceState\r\nexport class FacadePositionDeviceState extends DeviceState<FacadePositionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.FacadePosition;\r\n this.Type = \"FacadePositionState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class FacadePositionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Position: number = 0;\r\n Tilt: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport class FacadeTypeDeviceState extends DeviceState<FacadeTypeState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.FacadeType;\r\n this.Type = \"FacadeTypeState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class FacadeTypeState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Time: string = \"\";\r\n FType: FacadeType = FacadeType.Facade180;\r\n}\r\n\r\n/// CurrentWindThreshold\r\nexport class CurrentWindThresholdDeviceState extends DeviceState<CurrentWindThresholdState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.CurrentWindThreshold;\r\n this.Type = \"CurrentWindThresholdState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class CurrentWindThresholdState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n WindThreshold: WindThresholdStateEnum = WindThresholdStateEnum.Unknown;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum WindThresholdStateEnum {\r\n Unknown = 0,\r\n Below = 1,\r\n Exceeded = 2,\r\n Inactive = 3\r\n}\r\n\r\n/// CurrentLightThreshold\r\nexport class CurrentLightThresholdDeviceState extends DeviceState<CurrentLightThresholdState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.CurrentLightThreshold;\r\n this.Type = \"CurrentLightThresholdState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class CurrentLightThresholdState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n LightThreshold: LightThresholdStateEnum = LightThresholdStateEnum.Unknown;\r\n Value: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum LightThresholdStateEnum {\r\n Unknown = 0,\r\n Below = 1,\r\n Exceeded = 2\r\n}\r\n\r\n/// WindSpeed\r\nexport class WindSpeedDeviceState extends DeviceState<WindSpeedState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.WindSpeedState;\r\n this.Type = \"WindSpeedState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class WindSpeedState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Value: number = 0;\r\n Time: string = \"\";\r\n}\r\n\r\n//flood sensor\r\nexport class FloodSensorDeviceState extends DeviceState<FloodSensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.FloodSensorState;\r\n this.Type = \"FloodSensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class FloodSensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: FloodSensorStates = FloodSensorStates.NoFloodDetected;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum FloodSensorStates {\r\n FloodDetected = 1,\r\n NoFloodDetected = 0\r\n}\r\n\r\nexport enum HumidityType {\r\n AirHumidity = 0,\r\n InsideHumidity = 1,\r\n OutsideHumidity = 2,\r\n SafetyHumidity = 3,\r\n SetHumidity = 4,\r\n}\r\n\r\n//Pressure\r\nexport class PressureSensorDeviceState extends DeviceState<PressureSensorState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.PressureSensorState;\r\n this.Type = \"PressureSensorState\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class PressureSensorState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n Pressure: number = 0;\r\n Time: string = \"\";\r\n PressureType: PressureType = PressureType.OutsidePressure\r\n}\r\n\r\nexport enum PressureType {\r\n InsidePressure = 0,\r\n OutsidePressure = 1,\r\n SetPressure = 2\r\n}\r\n\r\nexport enum FacadeType\r\n{\r\n Facade90 = 0,\r\n Facade180 = 1\r\n}\r\n\r\n// TamperProtection\r\nexport class TamperProtectionDeviceState extends DeviceState<TamperProtectionState> {\r\n constructor(state: DeviceStateChangedObject) {\r\n super();\r\n this.TypeAsEnum = DeviceResponseType.TamperProtectionState;\r\n this.Type = \"TamperProtection\";\r\n this.Data = state.state as any;\r\n }\r\n}\r\n\r\nexport class TamperProtectionState implements IDeviceStateData {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n State: TamperProtectionStatus = TamperProtectionStatus.OK;\r\n Time: string = \"\";\r\n}\r\n\r\nexport enum TamperProtectionStatus {\r\n OK = 0,\r\n Breach = 1\r\n}","export class FieldChangeResult {\r\n private _type: FieldChangeResultType = FieldChangeResultType.Unknown;\r\n private _data: string = \"\";\r\n constructor(type: FieldChangeResultType, data: string) {\r\n this._type = type;\r\n this._data = data;\r\n }\r\n\r\n get Type(): FieldChangeResultType {\r\n return this._type;\r\n }\r\n\r\n set Type(value: FieldChangeResultType) {\r\n this._type = value;\r\n }\r\n\r\n get Data(): string {\r\n return this._data;\r\n }\r\n\r\n set Data(value: string) {\r\n this._data = value;\r\n }\r\n}\r\n\r\nexport class ResponseResult<T> {\r\n private _type: T | null = null;\r\n private _data: string = \"\";\r\n\r\n constructor(type: T, data: string) {\r\n this._type = type;\r\n this._data = data;\r\n }\r\n\r\n get Type(): T {\r\n return this._type as T;\r\n }\r\n\r\n set Type(value: T) {\r\n this._type = value;\r\n }\r\n\r\n get Data(): string {\r\n return this._data;\r\n }\r\n\r\n set Data(value: string) {\r\n this._data = value;\r\n }\r\n}\r\n\r\nexport enum FieldChangeResultType {\r\n UnknownError = -5,\r\n NoPermissions = -4,\r\n WrongData = -3,\r\n ControllerResponseTimeout = -2,\r\n Failed = -1,\r\n Unknown = 0,\r\n Changed = 1,\r\n}","import { IUsersService } from './IUsersService';\r\nimport { IUser } from './IUser';\r\nimport { Api } from '../../Api';\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { DataFrame, Method, Status } from '../../DataFrame';\r\nimport { UserData } from '../Session/SessionService';\r\nimport { User } from './User';\r\nimport { DependencyContainer } from '../../DependencyContainer';\r\n\r\nexport class UsersService implements IUsersService {\r\n private _connection: IExalusConnectionService | null = null;\r\n public static readonly ServiceName: string = \"UsersService\";\r\n\r\n constructor() {\r\n this._connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n }\r\n\r\n GetServiceName(): string {\r\n return UsersService.ServiceName;\r\n }\r\n\r\n async GetUsersAsync(): Promise<IUser[]> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<UserData[]>(new GetUsersListRequest(), 20000, false);\r\n\r\n if (result === null || result === undefined)\r\n return Promise.resolve([]);\r\n\r\n if (result?.Status == Status.OK) {\r\n if (result.Data != null) {\r\n const users: User[] = [];\r\n\r\n result.Data.forEach(element => {\r\n var user = new User();\r\n user.AccessLevel = element.AccessLevel;\r\n user.Email = element.Email;\r\n user.Gender = element.Gender;\r\n user.Guid = element.Guid;\r\n user.IsAccountOnline = element.IsAccountOnline;\r\n user.Name = element.Name;\r\n user.IsActive = element.IsActive;\r\n user.IsBanned = element.IsBanned;\r\n user.Phone = element.Phone;\r\n user.Surname = element.Surname;\r\n users.push(user);\r\n });\r\n\r\n return users;\r\n }\r\n else\r\n return Promise.resolve([]);\r\n }\r\n else if (result?.Status == Status.NoData)\r\n return Promise.resolve([]);\r\n else {\r\n DependencyContainer.Log?.Debug(UsersService.ServiceName, `Failed to retrieve users, error: ${result.Status}`);\r\n throw new Error(`Failed to retrieve users, error: ${result.Status}`);\r\n }\r\n }\r\n\r\n GetUserAsync(id: string): Promise<IUser | null> {\r\n return new Promise((resolve, reject) => {\r\n resolve(null);\r\n });\r\n }\r\n\r\n CreateUserAsync(user: IUser): Promise<IUser> {\r\n return new Promise((resolve, reject) => {\r\n resolve(user);\r\n });\r\n }\r\n\r\n UpdateUserAsync(user: IUser): Promise<IUser> {\r\n return new Promise((resolve, reject) => {\r\n resolve(user);\r\n });\r\n }\r\n\r\n DeleteUserAsync(id: string): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n resolve();\r\n });\r\n }\r\n}\r\n\r\nclass GetUsersListRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/users/list\";\r\n this.Method = Method.Get;\r\n }\r\n}","import { IDIService } from \"../../IDIService\";\r\nimport { ITypedEvent } from \"../../TypedEvent\";\r\nimport { FieldChangeResult } from \"../FieldChangeResult\";\r\nimport { DeviceTasksInfo, IDevice } from './IDevice';\r\nimport { IDeviceState } from './IDeviceState';\r\nimport { IDeviceTask } from \"./IDeviceTask\";\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\n\r\nexport interface IDevicesService extends IDIService {\r\n OnDeviceRegisteredEvent(): ITypedEvent<IDevice>;\r\n OnDeviceRemovedEvent(): ITypedEvent<IDevice>;\r\n OnDeviceFoundEvent(): ITypedEvent<IDevice>;\r\n OnDeviceStateChangedEvent(): ITypedEvent<{ Device: IDevice, State: IDeviceState<any> }>;\r\n OnDevicesTasksExecutionChangeEvent(): ITypedEvent<DeviceTasksInfo[]>;\r\n\r\n GetDevicesAsync(): Promise<IDevice[]>;\r\n SyncDevicesStatesAsync(): Promise<boolean>;\r\n GetDevice(guid: string): IDevice | undefined;\r\n FindDevicesAsync(): Promise<void>;\r\n GetFoundDevicesAsync(): Promise<IDevice[]>;\r\n StopSearchingForDevices(): Promise<void>;\r\n RegisterDeviceAsync(device: IDevice): Promise<DeviceTaskExecutionResult>;\r\n RemoveDeviceAsync(device: IDevice): Promise<DeviceTaskExecutionResult>;\r\n ExecuteDeviceTaskAsync(device: IDevice, task: IDeviceTask): Promise<DeviceTaskExecutionResult>;\r\n WaitForSynchronizationAsync(): Promise<void>;\r\n WaitForDevicesStatesSynchronizationAsync(): Promise<void>;\r\n ExecuteDevicesTasksAsync(tasks: [Device: IDevice, Task: IDeviceTask][]): Promise<DeviceTaskPairExecutionResult[]>;\r\n}\r\n\r\nexport class DeviceTaskPairExecutionResult {\r\n Device: IDevice | null = null;\r\n Channel: number = 0;\r\n Task: IDeviceTask | null = null;\r\n Result: DeviceTaskExecutionResult = DeviceTaskExecutionResult.Unknown;\r\n}","import { Api } from '../../Api';\r\nimport { DataFrame, Method, Status } from '../../DataFrame';\r\nimport { ITypedEvent, TypedEvent } from '../../TypedEvent';\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { FieldChangeResult, FieldChangeResultType } from '../FieldChangeResult';\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { DevicesService } from './DevicesService';\r\nimport { CommunicationWay, DeviceState, DeviceType, IDevice, IDeviceResponseTypeInfo, IDeviceTaskTypeInfo } from './IDevice';\r\nimport { IDeviceChannel } from './IDeviceChannel';\r\nimport { IDevicesService } from './IDevicesService';\r\nimport { IDeviceState, IDeviceStateData } from './IDeviceState';\r\nimport { IDeviceTask } from './IDeviceTask';\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\n\r\nexport class Device implements IDevice {\r\n private _onDeviceStateChangedEvent: ITypedEvent<IDeviceState<any>> = new TypedEvent<IDeviceState<any>>();\r\n private _onDeviceTasksExecutionChangedOnChannelsEvent: ITypedEvent<number[]> = new TypedEvent<number[]>();\r\n private _guid?: string;\r\n private _name?: string;\r\n private _channelsAmount?: number;\r\n private _serialNumber: string | null = null;\r\n private _model: string | null = null;\r\n private _modelGuid: string | null = null;\r\n private _manufacturerGuid: string | null = null;\r\n private _isVirtual: boolean = false;\r\n private _isEnabled: boolean = false;\r\n private _deviceState: DeviceState = DeviceState.Working;\r\n private _deviceType: DeviceType = DeviceType.Unknown;\r\n private _communicationWay: CommunicationWay = CommunicationWay.OneWay;\r\n private _availableTasksTypes: IDeviceTaskTypeInfo[] = [];\r\n private _availableResponseTypes: IDeviceResponseTypeInfo[] = [];\r\n private _channels: IDeviceChannel[] = [];\r\n private _states: IDeviceState<any>[] = [];\r\n\r\n constructor() {\r\n const devicesApi = Api.Get<IDevicesService>(DevicesService.ServiceName);\r\n const stateChangedEvent = this._onDeviceStateChangedEvent as TypedEvent<IDeviceState<any>>;\r\n const tasksExecutionChangeEvent = this._onDeviceTasksExecutionChangedOnChannelsEvent as TypedEvent<number[]>;\r\n\r\n devicesApi.OnDeviceStateChangedEvent().Subscribe(stateChange => {\r\n if (stateChange.Device.Guid != this._guid)\r\n return;\r\n\r\n this._states = this._states\r\n .where(state => (state.Data as IDeviceStateData).Channel == (stateChange.State.Data as IDeviceStateData).Channel \r\n && state.TypeAsEnum != stateChange.State.TypeAsEnum)\r\n .toArray();\r\n\r\n this._states.push(stateChange.State);\r\n\r\n stateChangedEvent.Invoke(stateChange.State);\r\n });\r\n\r\n devicesApi.OnDevicesTasksExecutionChangeEvent().Subscribe(tasks => {\r\n tasksExecutionChangeEvent.Invoke(tasks.filter(task => task.DeviceGuid == this._guid).map(task => task.Channel));\r\n });\r\n }\r\n\r\n get States(): IDeviceState<IDeviceStateData>[] {\r\n return this._states;\r\n }\r\n \r\n RemoveDeviceAsync(): Promise<DeviceTaskExecutionResult> {\r\n return Api.Get<IDevicesService>(DevicesService.ServiceName).RemoveDeviceAsync(this);\r\n }\r\n\r\n ExecuteDeviceTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult> {\r\n return Api.Get<IDevicesService>(DevicesService.ServiceName).ExecuteDeviceTaskAsync(this, task);\r\n }\r\n\r\n OnDeviceTasksExecutionChangedOnChannelsEvent(): ITypedEvent<number[]> {\r\n return this._onDeviceTasksExecutionChangedOnChannelsEvent;\r\n }\r\n\r\n OnDeviceStateChangedEvent(): ITypedEvent<IDeviceState<any>> {\r\n return this._onDeviceStateChangedEvent;\r\n }\r\n\r\n public get Guid(): string {\r\n return this._guid == null ? \"\" : this._guid;\r\n }\r\n\r\n public set Guid(guid: string) {\r\n this._guid = guid;\r\n }\r\n\r\n public get Name(): string {\r\n return this._name == null ? \"\" : this._name;\r\n }\r\n\r\n public set Name(name: string) {\r\n this._name = name;\r\n }\r\n\r\n get ChannelsAmount(): number {\r\n return this._channelsAmount == null ? 0 : this._channelsAmount;\r\n }\r\n\r\n public set ChannelsAmount(amount: number) {\r\n this._channelsAmount = amount;\r\n }\r\n\r\n get SerialNumber(): string | null {\r\n return this._serialNumber;\r\n }\r\n\r\n public set SerialNumber(serialNumber: string | null) {\r\n this._serialNumber = serialNumber;\r\n }\r\n\r\n get Model(): string | null {\r\n return this._model;\r\n }\r\n\r\n public set Model(model: string | null) {\r\n this._model = model;\r\n }\r\n\r\n get ModelGuid(): string | null {\r\n return this._modelGuid;\r\n }\r\n\r\n public set ModelGuid(model: string | null) {\r\n this._modelGuid = model;\r\n }\r\n\r\n get ManufacturerGuid(): string | null {\r\n return this._manufacturerGuid;\r\n }\r\n\r\n set ManufacturerGuid(manufacturerGuid: string | null) {\r\n this._manufacturerGuid = manufacturerGuid;\r\n }\r\n\r\n get IsVirtual(): boolean {\r\n return this._isVirtual;\r\n }\r\n\r\n set IsVirtual(isVirtual: boolean) {\r\n this._isVirtual = isVirtual;\r\n }\r\n\r\n get IsEnabled(): boolean {\r\n return this._isEnabled;\r\n }\r\n\r\n set IsEnabled(isEnabled: boolean) {\r\n this._isEnabled = isEnabled;\r\n }\r\n\r\n get DeviceState(): DeviceState {\r\n return this._deviceState;\r\n }\r\n\r\n set DeviceState(deviceState: DeviceState) {\r\n this._deviceState = deviceState;\r\n }\r\n\r\n get DeviceType(): DeviceType {\r\n return this._deviceType;\r\n }\r\n\r\n set DeviceType(deviceType: DeviceType) {\r\n this._deviceType = deviceType;\r\n }\r\n\r\n get CommunicationWay(): CommunicationWay {\r\n return this._communicationWay;\r\n }\r\n\r\n set CommunicationWay(communicationWay: CommunicationWay) {\r\n this._communicationWay = communicationWay;\r\n }\r\n\r\n get AvailableTaskTypes(): IDeviceTaskTypeInfo[] {\r\n return this._availableTasksTypes;\r\n }\r\n\r\n set AvailableTaskTypes(availableTasksTypes: IDeviceTaskTypeInfo[]) {\r\n this._availableTasksTypes = availableTasksTypes;\r\n }\r\n\r\n get AvailableResponseTypes(): IDeviceResponseTypeInfo[] {\r\n return this._availableResponseTypes;\r\n }\r\n\r\n set AvailableResponseTypes(availableResponseTypes: IDeviceResponseTypeInfo[]) {\r\n this._availableResponseTypes = availableResponseTypes;\r\n }\r\n\r\n get Channels(): IDeviceChannel[] {\r\n return this._channels;\r\n }\r\n\r\n async ChangeDeviceNameAsync(name: string): Promise<FieldChangeResult> {\r\n try {\r\n const result = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName)\r\n .SendAndWaitForResponseAsync(new DeviceChannelConfigurationRequest(this, name), 20000, false);\r\n\r\n switch (result.Status) {\r\n case Status.OK:\r\n return new FieldChangeResult(FieldChangeResultType.Changed, \"\");\r\n\r\n case Status.WrongData:\r\n if (result.Data == \"DeviceNotFound\")\r\n return new FieldChangeResult(FieldChangeResultType.Failed, \"DeviceNotFound\");\r\n break;\r\n\r\n case Status.NoPermissionsToCallGivenResource:\r\n return new FieldChangeResult(FieldChangeResultType.NoPermissions, \"\");\r\n\r\n\r\n }\r\n }\r\n catch (ex: any) {\r\n if ((ex as Error).message.includes(\"timeout\"))\r\n return new FieldChangeResult(FieldChangeResultType.ControllerResponseTimeout, \"\");\r\n\r\n return new FieldChangeResult(FieldChangeResultType.UnknownError, \"\");\r\n }\r\n\r\n return new FieldChangeResult(FieldChangeResultType.Unknown, \"\");\r\n }\r\n\r\n ExecuteTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult> {\r\n return Api.Get<IDevicesService>(DevicesService.ServiceName).ExecuteDeviceTaskAsync(this, task);\r\n }\r\n}\r\n\r\n\r\nclass DeviceChannelConfigurationRequest extends DataFrame<DeviceNameData>\r\n{\r\n constructor(device: IDevice, name: string) {\r\n super();\r\n this.Resource = \"/devices/device/name\";\r\n this.Method = Method.Put;\r\n const data = new DeviceNameData();\r\n data.DeviceGuid = device.Guid;\r\n data.Name = name;\r\n this.Data = data;\r\n }\r\n}\r\n\r\nclass DeviceNameData {\r\n DeviceGuid: string = \"\";\r\n Name: string = \"\";\r\n}","import { DeviceTaskType } from \"./IDevice\";\r\n\r\nexport interface IDeviceTask {\r\n get TaskType(): DeviceTaskType;\r\n\r\n get Guid(): string;\r\n\r\n get DeviceGuid(): string;\r\n\r\n get Channel(): number;\r\n}\r\n\r\nexport enum DeviceControlFeature {\r\n TurnOn = 0,\r\n TurnOff = 1,\r\n ToggleState = 2,\r\n SetBlindPosition = 3,\r\n SetLightColor = 4,\r\n SetLightTemperature = 5,\r\n SetLightBrightness = 6,\r\n SetTemperature = 7,\r\n GetState = 8,\r\n TurnOnWithTimeout = 9,\r\n SetLightBrightnessDynamicly = 10,\r\n IdentifyDevice = 11,\r\n SetBlindOpenCloseTime = 12,\r\n SetBlindMicroventilation = 13,\r\n //SetGatePosition = 14,\r\n //OpenGate = 15,\r\n //CloseGate = 16,\r\n //SetGatePositionPercentage = 17,\r\n //GateOn = 18,\r\n //GateOff = 19,\r\n //OpenGateway = 20,\r\n //CloseGateway = 21,\r\n //SetGatewayPositionPercentage = 22,\r\n //GatewayOn = 23,\r\n //GatewayOff = 24,\r\n GatewayPulse = 25,\r\n GatePulse = 26,\r\n //SetFacadePosition = 27,\r\n //SetFacadeTilt = 28,\r\n SetFacadePositionAndTilt = 29,\r\n GetFacadeType = 30,\r\n}","import { DeviceTaskType } from \"../IDevice\";\r\nimport { DeviceControlFeature } from \"../IDeviceTask\";\r\nimport { DeviceTask } from \"./DeviceTask\";\r\n\r\nexport class SetTemperature extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetTemperature;\r\n this.TaskType = DeviceTaskType.SetTemperature;\r\n }\r\n\r\n Temperature: number = 0;\r\n}\r\n\r\nexport class TurnOff extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.TurnOff;\r\n this.TaskType = DeviceTaskType.TurnOff;\r\n }\r\n}\r\n\r\nexport class TurnOn extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.TurnOn;\r\n this.TaskType = DeviceTaskType.TurnOn;\r\n }\r\n}\r\n\r\nexport class SetLightBrightness extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetLightBrightness;\r\n this.TaskType = DeviceTaskType.SetLightBrightness;\r\n }\r\n\r\n Brightness: number = 0;\r\n}\r\n\r\nexport class ToggleState extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.ToggleState;\r\n this.TaskType = DeviceTaskType.TogleState;\r\n }\r\n}\r\n\r\nexport class SetLightColor extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetLightColor;\r\n this.TaskType = DeviceTaskType.SetLightColor;\r\n }\r\n\r\n R: number = 0;\r\n G: number = 0;\r\n B: number = 0;\r\n}\r\n\r\nexport class SetLightTemperature extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetLightTemperature;\r\n this.TaskType = DeviceTaskType.SetLightTemperature;\r\n }\r\n\r\n Temperature: number = 0;\r\n}\r\n\r\nexport class SetBlindPosition extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetBlindPosition;\r\n this.TaskType = DeviceTaskType.SetBlindPosition;\r\n }\r\n\r\n Action: BlindActionEnum = BlindActionEnum.Stop;\r\n Position: number = 0;\r\n}\r\n\r\nexport enum BlindActionEnum {\r\n Open = 0,\r\n Close = 1,\r\n Stop = 2,\r\n Percentage = 3\r\n}\r\nexport class SetBlindPositionSimple extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetBlindPosition;\r\n this.TaskType = DeviceTaskType.SetBlindPositionSimple;\r\n }\r\n\r\n Action: BlindActionSimpleEnum = BlindActionSimpleEnum.Stop;\r\n Position: number = 0;\r\n}\r\n\r\nexport enum BlindActionSimpleEnum {\r\n Open = 0,\r\n Close = 1,\r\n Stop = 2,\r\n}\r\n\r\nexport class SetLightBrightnessDynamicly extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetLightBrightnessDynamicly;\r\n this.TaskType = DeviceTaskType.SetLightBrightnessDynamicly;\r\n }\r\n\r\n Brightness: number = 0;\r\n}\r\n\r\nexport class IdentifyDevice extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.IdentifyDevice;\r\n this.TaskType = DeviceTaskType.IdentifyDevice;\r\n }\r\n}\r\n\r\nexport class SetBlindOpenCloseTime extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetBlindOpenCloseTime;\r\n this.TaskType = DeviceTaskType.SetBlindOpenCloseTime;\r\n }\r\n\r\n Data: BlindOpenCloseTimeData = new BlindOpenCloseTimeData();\r\n}\r\n\r\nexport class BlindOpenCloseTimeData {\r\n Channel: number = 0;\r\n CloseTime: number = 0;\r\n OpenTime: number = 0;\r\n}\r\n\r\nexport class GetDeviceState extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.GetState;\r\n this.TaskType = DeviceTaskType.GetChannelsState;\r\n }\r\n}\r\n\r\nexport class SetBlindMicroventilation extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetBlindMicroventilation;\r\n this.TaskType = DeviceTaskType.SetBlindMicroventilation;\r\n }\r\n\r\n Position: number = 0;\r\n}\r\n\r\nexport class ChangeGatePositionPulse extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.GatePulse;\r\n this.TaskType = DeviceTaskType.ChangeGatewayPositionPulse;\r\n }\r\n}\r\n\r\nexport class ChangeGatewayPositionPulse extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.GatewayPulse;\r\n this.TaskType = DeviceTaskType.ChangeGatewayPositionPulse;\r\n }\r\n}\r\n\r\nexport class SetFacadePosition extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.SetFacadePositionAndTilt;\r\n this.TaskType = DeviceTaskType.SetFacadePosition;\r\n }\r\n\r\n FacadeAction: FacadeActionEnum = FacadeActionEnum.Stop;\r\n Tilt: number = 0;\r\n Position: number = 0;\r\n}\r\n\r\nexport class GetFacadeType extends DeviceTask {\r\n constructor() {\r\n super();\r\n this.FeatureType = DeviceControlFeature.GetFacadeType;\r\n this.TaskType = DeviceTaskType.GetFacadeType;\r\n }\r\n}\r\n\r\nexport enum FacadeActionEnum {\r\n Open = 0,\r\n Close = 1,\r\n Stop = 2,\r\n Percentage = 3,\r\n Tilt = 4,\r\n TiltAndPercentage = 5\r\n}","import { Api } from \"../../Api\";\r\nimport { ITypedEvent, TypedEvent } from \"../../TypedEvent\";\r\nimport { FieldChangeResultType, FieldChangeResult } from \"../FieldChangeResult\";\r\nimport { DevicesService } from \"./DevicesService\";\r\nimport { IDeviceTaskTypeInfo, IDeviceResponseTypeInfo, IDevice } from './IDevice';\r\nimport { ChannelConfigurations, IDeviceChannel, TaskExecution } from \"./IDeviceChannel\";\r\nimport { IDevicesService } from \"./IDevicesService\";\r\nimport { IDeviceState, IDeviceStateData } from \"./IDeviceState\";\r\nimport { IDeviceTask } from \"./IDeviceTask\";\r\nimport { DeviceTaskExecutionResult } from \"./TaskExecutionResult\";\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { ExalusConnectionService } from \"../ExalusConnectionService\";\r\nimport { DataFrame, Method, Status } from \"../../DataFrame\";\r\nimport { DependencyContainer } from '../../DependencyContainer';\r\nimport { DeviceTask } from \"./Tasks/DeviceTask\";\r\nimport { Device } from \"./Device\";\r\n\r\nexport class DeviceChannel implements IDeviceChannel {\r\n private _device: IDevice = new Device();\r\n private _number: number = 0;\r\n private _name: string = \"\";\r\n private _iconName: string = \"\";\r\n private _states: IDeviceState<any>[] = [];\r\n private _mode: ChannelConfigurations = ChannelConfigurations.Default;\r\n private _channelGroups: string[] = [];\r\n private _isHidden: boolean = false;\r\n private _availableTasksTypes: IDeviceTaskTypeInfo[] = [];\r\n private _availableResponseTypes: IDeviceResponseTypeInfo[] = [];\r\n private _onTasksExecutionChangedEvent: ITypedEvent<TaskExecution> = new TypedEvent<TaskExecution>();\r\n\r\n SetDevice(device: IDevice): void {\r\n this._device = device;\r\n this._device.OnDeviceStateChangedEvent().Subscribe(newState => {\r\n const channel = (newState.Data as IDeviceStateData).Channel;\r\n\r\n if (channel != this._number)\r\n return;\r\n\r\n this._states = this._states.where(state => state.TypeAsEnum != newState.TypeAsEnum).toArray();\r\n this._states.push(newState);\r\n });\r\n }\r\n\r\n GetDevice(): IDevice {\r\n return this._device;\r\n }\r\n\r\n GetChannelConfigurationData(): ChannelConfigurationData {\r\n const data = new ChannelConfigurationData();\r\n data.Channel = this._number;\r\n data.ChannelName = this._name;\r\n data.Configuration = this._mode;\r\n data.GroupsGuids = this._channelGroups;\r\n data.Hidden = this._isHidden;\r\n data.IconName = this._iconName;\r\n return data;\r\n }\r\n\r\n HideAsync(): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.Hidden = true;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n ShowAsync(): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.Hidden = false;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n ChangeNameAsync(name: string): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.ChannelName = name;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n ChangeIconNameAsync(name: string): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.IconName = name;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n ChangeGroupsAsync(groups: string[]): Promise<FieldChangeResult> {\r\n const data = this.GetChannelConfigurationData();\r\n data.GroupsGuids = groups;\r\n return this.ChangeConfigurationAsync(data);\r\n }\r\n\r\n async ChangeConfigurationAsync(configuration: ChannelConfigurationData): Promise<FieldChangeResult> {\r\n try {\r\n const result = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName)\r\n .SendAndWaitForResponseAsync(new DeviceChannelConfigurationRequest(configuration), 20000, false);\r\n\r\n switch (result.Status) {\r\n case Status.OK:\r\n return new FieldChangeResult(FieldChangeResultType.Changed, \"\");\r\n\r\n case Status.WrongData:\r\n switch (result.Data) {\r\n case \"DeviceNotFound\":\r\n DependencyContainer.Log?.Error(`Failed to change channel configuration, referenced device does not exist!`);\r\n return new FieldChangeResult(FieldChangeResultType.WrongData, \"DeviceNotFound\");\r\n }\r\n break;\r\n\r\n case Status.FatalError:\r\n return new FieldChangeResult(FieldChangeResultType.UnknownError, \"\");\r\n }\r\n }\r\n catch (ex: any) {\r\n if ((ex as Error).message.includes(\"timeout\"))\r\n return new FieldChangeResult(FieldChangeResultType.ControllerResponseTimeout, \"\");\r\n }\r\n\r\n return new FieldChangeResult(FieldChangeResultType.Unknown, \"\");\r\n }\r\n\r\n get Number(): number {\r\n return this._number;\r\n }\r\n\r\n set Number(value: number) {\r\n this._number = value;\r\n }\r\n\r\n get Name(): string {\r\n return this._name;\r\n }\r\n set Name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n get IconName(): string {\r\n return this._iconName;\r\n }\r\n\r\n set IconName(value: string) {\r\n this._iconName = value;\r\n }\r\n\r\n get States(): IDeviceState<IDeviceStateData>[] {\r\n return this._states;\r\n }\r\n\r\n get Mode(): ChannelConfigurations {\r\n return this._mode;\r\n }\r\n\r\n set Mode(value: ChannelConfigurations) {\r\n this._mode = value;\r\n }\r\n\r\n get ChannelGroups(): string[] {\r\n return this._channelGroups;\r\n }\r\n\r\n set ChannelGroups(value: string[]) {\r\n this._channelGroups = value;\r\n }\r\n\r\n get IsHidden(): boolean {\r\n return this._isHidden;\r\n }\r\n\r\n set IsHidden(value: boolean) {\r\n this._isHidden = value;\r\n }\r\n\r\n get AvailableTaskTypes(): IDeviceTaskTypeInfo[] {\r\n return this._availableTasksTypes;\r\n }\r\n\r\n set AvailableTaskTypes(value: IDeviceTaskTypeInfo[]) {\r\n this._availableTasksTypes = value;\r\n }\r\n\r\n get AvailableResponseTypes(): IDeviceResponseTypeInfo[] {\r\n return this._availableResponseTypes;\r\n }\r\n\r\n set AvailableResponseTypes(value: IDeviceResponseTypeInfo[]) {\r\n this._availableResponseTypes = value;\r\n }\r\n\r\n OnTasksExecutionChangeEvent(): ITypedEvent<TaskExecution> {\r\n return this._onTasksExecutionChangedEvent;\r\n }\r\n\r\n ExecuteTaskAsync(task: IDeviceTask): Promise<DeviceTaskExecutionResult> {\r\n if (this._device != null) {\r\n (task as DeviceTask).Channel = this.Number;\r\n (task as DeviceTask).DeviceGuid = this._device.Guid;\r\n return Api.Get<IDevicesService>(DevicesService.ServiceName).ExecuteDeviceTaskAsync(this._device, task);\r\n }\r\n else\r\n return Promise.resolve(DeviceTaskExecutionResult.Failed);\r\n }\r\n}\r\n\r\nexport class ChannelConfigurationData {\r\n Channel: number = 0;\r\n ChannelName: string = \"\";\r\n Configuration: ChannelConfigurations = ChannelConfigurations.Default;\r\n GroupsGuids: string[] = [];\r\n IconName: string = \"\";\r\n Hidden: boolean = false;\r\n}\r\n\r\nclass DeviceChannelConfigurationRequest extends DataFrame<ChannelConfigurationData>\r\n{\r\n constructor(configuration: ChannelConfigurationData) {\r\n super();\r\n this.Resource = \"/devices/device/channel/configuration\";\r\n this.Method = Method.Put;\r\n this.Data = configuration;\r\n }\r\n}","import { Status } from \"../../DataFrame\";\r\nimport { IDIService } from \"../../IDIService\";\r\nimport { ResponseResult } from \"../FieldChangeResult\";\r\n\r\nexport interface IGeolocationService extends IDIService {\r\n\tGetCurrentGeolocationAsync(): Promise<GeolocationPosition | GeolocationPositionError>;\r\n\tSetControllerGeolocationAsync(location: Coordinates | Status): Promise<ResponseResult<SetGeolocationResponseCode>>;\r\n\tGetControlllerGeolocationAsync(): Promise<CoordinatesWithSourceInfo | Status>;\r\n\tIsControllerGeolocationSetAsync(): Promise<boolean | Status>;\r\n}\r\n\r\nexport class Coordinates {\r\n\tLongitude: number = 0;\r\n\tLatitude: number = 0;\r\n}\r\n\r\nexport class CoordinatesWithSourceInfo {\r\n\tLongitude: number = 0;\r\n\tLatitude: number = 0;\r\n\tIsNetworkBased: boolean = false;\r\n}\r\n\r\nexport enum SetGeolocationResponseCode {\r\n\tOK = 0,\r\n\tNoPermissions = 1,\r\n\tUserIsNotLoggedIn = 2,\r\n\tUnknownError = 3,\r\n}","import { IDIService } from '../../IDIService';\r\nimport { ITypedEvent, TypedEvent } from '../../TypedEvent';\r\nimport { DeviceState, IDevice, CommunicationWay, DeviceType, DeviceTaskTypeInfo, DeviceResponseTypeInfo, DeviceTasksInfo, DeviceResponseType } from './IDevice';\r\nimport { DeviceTaskPairExecutionResult, IDevicesService } from './IDevicesService';\r\nimport { BatteryDeviceState, BinarySensorStateDeviceState, BlindCalibrationDeviceState, BlindOpenCloseTimeDeviceState, BlindPositionDeviceState, BlindRemoteButtonDeviceState, ChannelOnOffDeviceState, ConfigurationDeviceState, CurrentLightThresholdDeviceState, CurrentWindThresholdDeviceState, DoorBellDeviceState, FacadePositionDeviceState, FacadeRemoteButtonDeviceState, FacadeTypeDeviceState, FloodSensorDeviceState, GatePositionDeviceState, GatewayPositionDeviceState, HumiditySensorDeviceState, IDeviceState, LightBrightnessDeviceState, LightColorDeviceState, LightWarmthDeviceState, MeasuredBrightnessDeviceState, MeasuredDistanceDeviceState, MeasuredEnergyDeviceState, MeasuredTemperatureDeviceState, MovementSensorDeviceState, OvercurrentProtectionDeviceState, OvercurrentProtectionThresholdDeviceState, PressureSensorDeviceState, ReedStateDeviceState, RemoteButtonDeviceState, SignalStrenghtDeviceState, StateReliability, TamperProtectionDeviceState, VibrationSensorDeviceState, WindSpeedDeviceState } from './IDeviceState';\r\nimport { DeviceChannel } from './DeviceChannel';\r\nimport { ChannelConfigurations, TaskExecution } from './IDeviceChannel';\r\nimport { Api } from '../../Api';\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { DependencyContainer } from '../../DependencyContainer';\r\nimport { DataFrame, Status, Method } from '../../DataFrame';\r\nimport { Device } from './Device';\r\nimport { ConnectionState, IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { DeviceControlFeature, IDeviceTask } from './IDeviceTask';\r\nimport { BlindActionEnum, SetBlindPosition, SetTemperature, SetLightBrightnessDynamicly, SetLightBrightness, SetLightColor, SetLightTemperature, SetBlindOpenCloseTime, SetBlindMicroventilation, SetFacadePosition, FacadeActionEnum, GetFacadeType } from './Tasks/Tasks';\r\nimport { DeviceTask } from './Tasks/DeviceTask';\r\nimport { ISessionService } from '../Session/ISessionService';\r\nimport { SessionService } from '../Session/SessionService';\r\nimport { IControllerConfigurationService } from '../Controller/IControllerConfigurationService';\r\nimport { ControllerConfigurationService } from '../Controller/ControllerConfigurationService';\r\nimport { DeviceTaskExecutionResult } from './TaskExecutionResult';\r\nimport { threadId } from 'worker_threads';\r\n\r\nexport class DevicesService implements IDIService, IDevicesService {\r\n private _devices: IDevice[] = [];\r\n public static readonly ServiceName: string = \"DevicesService\";\r\n private _onDevicesTasksChangedEvent: ITypedEvent<DeviceTasksInfo[]> = new TypedEvent<DeviceTasksInfo[]>();\r\n private _onDeviceFoundEvent: ITypedEvent<IDevice> = new TypedEvent<IDevice>();\r\n private _onDeviceRegisteredEvent: ITypedEvent<IDevice> = new TypedEvent<IDevice>();\r\n private _onDeviceRemovedEvent: ITypedEvent<IDevice> = new TypedEvent<IDevice>();\r\n private _onDeviceStateChangedEvent: ITypedEvent<{ Device: IDevice, State: IDeviceState<any> }> = new TypedEvent<{ Device: IDevice, State: IDeviceState<any> }>();\r\n private _connection: IExalusConnectionService | null = null;\r\n private _session: ISessionService | null = null;\r\n private _controllerConfiguration: IControllerConfigurationService | null = null;\r\n private _fastStatesSync: boolean = false;\r\n private _synchronized: boolean = false;\r\n private _synchronizedDevicesStates: boolean = false;\r\n private _synchronizationTaskCompletionSource: Promise<void> | null = null;\r\n private _deviceStatesSynchronizationTaskCompletionSource: Promise<void> | null = null;\r\n\r\n constructor() {\r\n this._connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n this._session = Api.Get<ISessionService>(SessionService.ServiceName);\r\n this._controllerConfiguration = Api.Get<IControllerConfigurationService>(ControllerConfigurationService.ServiceName);\r\n this._synchronizationTaskCompletionSource = new Promise<void>((resolve) => {\r\n this._session?.OnUserLoggedInEvent().Subscribe(async user => {\r\n try {\r\n this._devices = await this.GetPairedDevicesAsync();\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get paired devices: ${ex}`);\r\n }\r\n this._synchronized = true;\r\n resolve();\r\n });\r\n });\r\n this._deviceStatesSynchronizationTaskCompletionSource = new Promise<void>((resolve) => {\r\n this._session?.OnUserLoggedInEvent().Subscribe(async user => {\r\n try {\r\n await this.WaitForSynchronizationAsync();\r\n await this.SyncDevicesStatesAsync();\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to sync devices states: ${ex}`);\r\n }\r\n this._synchronizedDevicesStates = true;\r\n resolve();\r\n });\r\n });\r\n\r\n this._connection.OnDataReceivedEvent().Subscribe(frame => {\r\n if (frame.Resource === \"/info/devices/tasks\") {\r\n this.ParseDeviceTaskInfo(frame.Data as string[]);\r\n }\r\n else if (frame.Resource === \"/devices/blinds/times\") {\r\n\r\n }\r\n else if (frame.Resource === \"/info/devices/device/found\") {\r\n const foundDevices = this.MapApiDevices(frame.Data);\r\n foundDevices.forEach(device => {\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Found device: ${device.Name} guid: ${device.Guid}`);\r\n (this._onDeviceFoundEvent as TypedEvent<IDevice>).Invoke(device);\r\n });\r\n }\r\n else if (frame.Resource === \"/info/devices/device/state/changed\") {\r\n const state = frame.Data as DeviceStateChangedObject;\r\n const devices = this._devices.filter(a => a.Guid == state.DeviceGuid);\r\n\r\n if (devices.length > 0) {\r\n const device = devices[0];\r\n\r\n const st = this.MapApiDeviceStateToDeviceState(device, state);\r\n\r\n if (st != null) {\r\n (this._onDeviceStateChangedEvent as TypedEvent<{ Device: IDevice, State: IDeviceState<any> }>)\r\n .Invoke({ Device: device, State: st });\r\n\r\n if (st.TypeAsEnum == DeviceResponseType.SignalStrength) {\r\n device.Channels.forEach(channel => {\r\n /// object copy { ...state }\r\n let newState = new SignalStrenghtDeviceState({ ...state });\r\n st.Data.Channel = channel.Number;\r\n \r\n (this._onDeviceStateChangedEvent as TypedEvent<{ Device: IDevice, State: IDeviceState<any> }>)\r\n .Invoke({ Device: device, State: newState });\r\n });\r\n }\r\n\r\n else if (st.TypeAsEnum == DeviceResponseType.BatteryState) {\r\n device.Channels.forEach(channel => {\r\n let newState = new BatteryDeviceState({ ...state });\r\n st.Data.Channel = channel.Number;\r\n \r\n (this._onDeviceStateChangedEvent as TypedEvent<{ Device: IDevice, State: IDeviceState<any> }>)\r\n .Invoke({ Device: device, State: newState });\r\n });\r\n }\r\n }\r\n }\r\n }\r\n else if (frame.Resource === \"/info/devices/device/registered\") {\r\n const registeredDevices = this.MapApiDevices(frame.Data);\r\n registeredDevices.forEach(device => {\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Registered device: ${device.Name} guid: ${device.Guid}`);\r\n (this._onDeviceRegisteredEvent as TypedEvent<IDevice>).Invoke(device);\r\n });\r\n }\r\n else if (frame.Resource === \"/info/devices/device/removed\") {\r\n const removedDevices = this.MapApiDevices(frame.Data);\r\n removedDevices.forEach(device => {\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Removed device: ${device.Name} guid: ${device.Guid}`);\r\n (this._onDeviceRemovedEvent as TypedEvent<IDevice>).Invoke(device);\r\n });\r\n }\r\n });\r\n }\r\n\r\n WaitForSynchronizationAsync(): Promise<void> {\r\n return this._synchronizationTaskCompletionSource as Promise<void>;\r\n }\r\n\r\n WaitForDevicesStatesSynchronizationAsync(): Promise<void> {\r\n return this._deviceStatesSynchronizationTaskCompletionSource as Promise<void>;\r\n }\r\n\r\n async GetCurrentlyRunningTaksAsync() {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<string[]>(new GetRunningDevicesTasksRequest(), 15000, false);\r\n\r\n if (result?.Status == Status.OK && result.Data != null) {\r\n this.ParseDeviceTaskInfo(result.Data);\r\n }\r\n }\r\n\r\n ParseDeviceTaskInfo(tasks: string[]) {\r\n const devicesTasks: DeviceTasksInfo[] = [];\r\n\r\n tasks.forEach(taskChannelPair => {\r\n const pair = taskChannelPair.split(\";\");\r\n const task = new DeviceTasksInfo();\r\n task.DeviceGuid = pair[0];\r\n task.Channel = Number(pair[1]);\r\n task.Status = TaskExecution.ExecutingTasks;\r\n devicesTasks.push(task);\r\n });\r\n\r\n (this._onDevicesTasksChangedEvent as TypedEvent<DeviceTasksInfo[]>).Invoke(devicesTasks);\r\n }\r\n\r\n MapApiDeviceStateToDeviceState(device: IDevice, state: DeviceStateChangedObject): IDeviceState<any> | null {\r\n const st = state.state as any as DeviceState;\r\n\r\n switch (state.DataType) {\r\n case \"ChannelOnOff\":\r\n return new ChannelOnOffDeviceState(state);\r\n\r\n case \"DoorBell\":\r\n return new DoorBellDeviceState(state);\r\n\r\n case \"ReedPosition\":\r\n return new ReedStateDeviceState(state);\r\n\r\n case \"BlindPosition\":\r\n return new BlindPositionDeviceState(state);\r\n\r\n case \"ButtonState\":\r\n return new RemoteButtonDeviceState(state);\r\n\r\n case \"LightColor\":\r\n return new LightColorDeviceState(state);\r\n\r\n case \"LightTemperature\":\r\n return new LightWarmthDeviceState(state);\r\n\r\n case \"LightBrightness\":\r\n return new LightBrightnessDeviceState(state);\r\n\r\n case \"TemperatureSensor\":\r\n case \"TemperatureState\":\r\n case \"MeasuredTemperature\":\r\n return new MeasuredTemperatureDeviceState(state);\r\n\r\n case \"BatteryState\":\r\n return new BatteryDeviceState(state);\r\n\r\n case \"MeasuredBrightness\":\r\n case \"DeviceBrightnessState\":\r\n return new MeasuredBrightnessDeviceState(state);\r\n\r\n case \"EnergyMeasuredPower\":\r\n break;\r\n\r\n case \"EnergyMeasuredCurrent\":\r\n break;\r\n\r\n case \"EnergyMeasuredVoltage\":\r\n break;\r\n\r\n case \"Energy\":\r\n return new MeasuredEnergyDeviceState(state);\r\n\r\n case \"DistanceSensor\":\r\n return new MeasuredDistanceDeviceState(state);\r\n\r\n case \"MovementSensor\":\r\n return new MovementSensorDeviceState(state);\r\n\r\n case \"BlindsControlButton\":\r\n return new BlindRemoteButtonDeviceState(state);\r\n\r\n case \"FacadeControlButton\":\r\n return new FacadeRemoteButtonDeviceState(state);\r\n\r\n case \"SignalStrength\":\r\n return new SignalStrenghtDeviceState(state);\r\n\r\n case \"GatePosition\":\r\n return new GatePositionDeviceState(state);\r\n\r\n case \"GatewayPosition\":\r\n return new GatewayPositionDeviceState(state);\r\n\r\n case \"IBlindCalibrationStatus\":\r\n case \"BlindCalibration\":\r\n return new BlindCalibrationDeviceState(state);\r\n\r\n case \"HumiditySensor\":\r\n case \"HumidityState\":\r\n return new HumiditySensorDeviceState(state);\r\n\r\n case \"VibrationSensor\":\r\n return new VibrationSensorDeviceState(state);\r\n\r\n case \"DigitalInputSensor\":\r\n return new BinarySensorStateDeviceState(state);\r\n\r\n case \"ConfigurationState\":\r\n return new ConfigurationDeviceState(state);\r\n\r\n case \"BlindOpenCloseTime\":\r\n case \"IBlindOpenCloseTime\":\r\n return new BlindOpenCloseTimeDeviceState(state);\r\n\r\n case \"IOvercurrentProtection\":\r\n case \"OvercurrentProtection\":\r\n return new OvercurrentProtectionDeviceState(state);\r\n\r\n case \"IOvercurrentProtectionThreshold\":\r\n case \"OvercurrentProtectionThreshold\":\r\n return new OvercurrentProtectionThresholdDeviceState(state);\r\n\r\n case \"FacadePosition\":\r\n case \"FacadeState\":\r\n return new FacadePositionDeviceState(state);\r\n\r\n case \"FacadeTypeState\":\r\n return new FacadeTypeDeviceState(state);\r\n\r\n case \"CurrentWindThreshold\":\r\n return new CurrentWindThresholdDeviceState(state);\r\n\r\n case \"CurrentLightThreshold\":\r\n return new CurrentLightThresholdDeviceState(state);\r\n\r\n case \"WindSpeed\":\r\n return new WindSpeedDeviceState(state);\r\n\r\n case \"FloodSensor\":\r\n return new FloodSensorDeviceState(state);\r\n\r\n case \"PressureState\":\r\n return new PressureSensorDeviceState(state);\r\n\r\n case \"ITamperProtection\": \r\n case \"TamperProtection\":\r\n return new TamperProtectionDeviceState(state);\r\n\r\n default:\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Not supported device state ${state.DataType}`);\r\n break;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n GetServiceName(): string {\r\n return DevicesService.ServiceName;\r\n }\r\n\r\n async SyncDevicesStatesAsync(): Promise<boolean> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(new GetDevicesStatesRequest(), 15000, false);\r\n\r\n if (this._fastStatesSync) {\r\n return result?.Status == Status.OK;\r\n }\r\n else {\r\n let syncStatesRequest = new SyncDevicesStatesRequest();\r\n syncStatesRequest.Data = true;\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(syncStatesRequest, 35000, false);\r\n return result?.Status == Status.OK;\r\n }\r\n }\r\n\r\n OnDevicesTasksExecutionChangeEvent(): ITypedEvent<DeviceTasksInfo[]> {\r\n return this._onDevicesTasksChangedEvent;\r\n }\r\n\r\n OnDeviceStateChangedEvent(): ITypedEvent<{ Device: IDevice, State: IDeviceState<any> }> {\r\n return this._onDeviceStateChangedEvent;\r\n }\r\n\r\n OnDeviceRegisteredEvent(): ITypedEvent<IDevice> {\r\n return this._onDeviceRegisteredEvent;\r\n }\r\n\r\n OnDeviceRemovedEvent(): ITypedEvent<IDevice> {\r\n return this._onDeviceRemovedEvent;\r\n }\r\n\r\n OnDeviceFoundEvent(): ITypedEvent<IDevice> {\r\n return this._onDeviceFoundEvent;\r\n }\r\n\r\n private MapApiDevices(devicesObjects: DeviceObject[]): IDevice[] {\r\n const devices: IDevice[] = [];\r\n\r\n if (devicesObjects == null)\r\n return [];\r\n\r\n devicesObjects.forEach(element => {\r\n var device = new Device();\r\n device.Guid = element.Guid;\r\n device.Name = element.DeviceName;\r\n device.ChannelsAmount = element.ChannelsNumber;\r\n device.DeviceType = element.DeviceType;\r\n device.CommunicationWay = element.CommunicationWay;\r\n device.DeviceState = element.DeviceState;\r\n device.IsEnabled = element.IsEnabled;\r\n device.IsVirtual = element.IsVirtual;\r\n device.SerialNumber = element.DeviceSerialNumber;\r\n device.ManufacturerGuid = element.ManufacturerGuid;\r\n device.ModelGuid = element.DeviceModelGuid;\r\n device.Model = element.DeviceModel;\r\n device.Name = element.DeviceName;\r\n\r\n try {\r\n element.AvailableTasks?.forEach(task => {\r\n var typeInfo = new DeviceTaskTypeInfo();\r\n\r\n if (device.CommunicationWay == CommunicationWay.OneWay) {\r\n switch (task) {\r\n case \"IBlindPosition\":\r\n typeInfo.InterfaceType = \"IBlindPositionSimple\";\r\n break;\r\n }\r\n }\r\n else\r\n switch (task) {\r\n case \"IGatePosition\":\r\n typeInfo.InterfaceType = \"IGatePulse\";\r\n break;\r\n\r\n case \"IGatewayPosition\":\r\n typeInfo.InterfaceType = \"IGatewayPulse\";\r\n break;\r\n\r\n default:\r\n typeInfo.InterfaceType = task;\r\n break;\r\n }\r\n\r\n device.AvailableTaskTypes.push(typeInfo);\r\n });\r\n\r\n element.AvailableResponses?.forEach(response => {\r\n var typeInfo = new DeviceResponseTypeInfo();\r\n typeInfo.InterfaceType = response;\r\n device.AvailableResponseTypes.push(typeInfo);\r\n });\r\n\r\n element.ChannelsConfiguration?.forEach(configuration => {\r\n try {\r\n var ch = new DeviceChannel();\r\n ch.SetDevice(device);\r\n device.Channels.push(ch);\r\n ch.Number = configuration.Channel;\r\n ch.Name = configuration.ChannelName;\r\n ch.ChannelGroups = configuration.GroupsGuids;\r\n ch.IconName = configuration.IconName;\r\n ch.IsHidden = configuration.Hidden;\r\n\r\n configuration.AvailableResponses?.forEach(response => {\r\n var typeInfo = new DeviceResponseTypeInfo();\r\n typeInfo.InterfaceType = response;\r\n ch.AvailableResponseTypes.push(typeInfo);\r\n });\r\n\r\n configuration.AvailableTasks?.forEach(task => {\r\n var typeInfo = new DeviceTaskTypeInfo();\r\n typeInfo.InterfaceType = task;\r\n ch.AvailableTaskTypes.push(typeInfo);\r\n });\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(ex);\r\n }\r\n });\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(ex);\r\n }\r\n devices.push(device);\r\n });\r\n\r\n this._devices = devices;\r\n return devices;\r\n }\r\n\r\n private async GetPairedDevicesAsync(): Promise<IDevice[]> {\r\n if (this._synchronized && !await this._controllerConfiguration?.DidCofigurationChangeAsync())\r\n return Promise.resolve(this._devices);\r\n\r\n const result = await this._connection?.SendAndWaitForResponseAsync<DeviceObject[]>(new GetDevicesListRequest(), 15000, true);\r\n\r\n if (result == null || result === undefined)\r\n return [];\r\n\r\n if (result.Status == Status.OK && result.Data != null)\r\n return this.MapApiDevices(result.Data);\r\n else {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get devices. ${result.Status} ${result.Data}`);\r\n return [];\r\n }\r\n }\r\n\r\n async GetDevicesAsync(): Promise<IDevice[]> {\r\n await this.WaitForSynchronizationAsync();\r\n\r\n return this.GetPairedDevicesAsync();\r\n }\r\n\r\n async GetFoundDevicesAsync(): Promise<IDevice[]> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<DeviceObject[]>(new GetFoundDevicesRequest(), 15000, false);\r\n\r\n if (result == null)\r\n return [];\r\n\r\n if (result.Status == Status.OK && result.Data != null)\r\n return this.MapApiDevices(result.Data);\r\n else {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get found devices. ${result.Status} ${result.Data}`);\r\n return [];\r\n }\r\n }\r\n\r\n GetDevice(guid: string): IDevice | undefined {\r\n return this._devices.find(a => a.Guid === guid);\r\n }\r\n\r\n async FindDevicesAsync(): Promise<void> {\r\n await this._connection?.SendAndWaitForResponseAsync<any>(new SearchForDevicesRequest(), 35000, false);\r\n }\r\n\r\n async StopSearchingForDevices(): Promise<void> {\r\n await this._connection?.SendAndWaitForResponseAsync<any>(new StopSearchingForDevicesRequest(), 20000, false);\r\n }\r\n\r\n async RegisterDeviceAsync(device: IDevice): Promise<DeviceTaskExecutionResult> {\r\n const req = new DevicePairRequest();\r\n req.Data = device.Guid;\r\n const res = await this._connection?.SendAndWaitForResponseAsync<any>(req, 20000, false);\r\n\r\n if (res?.Status == Status.OK) {\r\n this._devices.push(device);\r\n (this._onDeviceRegisteredEvent as TypedEvent<IDevice>).Invoke(device);\r\n return DeviceTaskExecutionResult.Executed;\r\n }\r\n else\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n\r\n async RemoveDeviceAsync(device: IDevice): Promise<DeviceTaskExecutionResult> {\r\n var req = new DeviceUnpairRequest();\r\n req.Data = device.Guid;\r\n const res = await this._connection?.SendAndWaitForResponseAsync<any>(req, 35000, false);\r\n\r\n if (res?.Status == Status.OK) {\r\n this._devices = this._devices.where(a => a.Guid == device.Guid).toArray();\r\n (this._onDeviceRemovedEvent as TypedEvent<IDevice>).Invoke(device);\r\n return DeviceTaskExecutionResult.Executed;\r\n }\r\n else\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n\r\n private MapDeviceTaskToDeviceTaskInfo(device: IDevice, task: IDeviceTask): DeviceTaskInfo {\r\n let t = new DeviceTaskInfo();\r\n const tsk = task as DeviceTask;\r\n\r\n switch (tsk.FeatureType) {\r\n case DeviceControlFeature.SetTemperature:\r\n t.Data = (tsk as SetTemperature).Temperature;\r\n break;\r\n\r\n case DeviceControlFeature.SetLightBrightness:\r\n t.Data = (tsk as SetLightBrightness).Brightness;\r\n break;\r\n\r\n case DeviceControlFeature.SetLightColor:\r\n t = new LightColorTaskInfo();\r\n const ts = tsk as SetLightColor;\r\n (t as LightColorTaskInfo).R = ts.R;\r\n (t as LightColorTaskInfo).G = ts.G;\r\n (t as LightColorTaskInfo).B = ts.B;\r\n break;\r\n\r\n case DeviceControlFeature.SetLightTemperature:\r\n t.Data = (tsk as SetLightTemperature).Temperature;\r\n break;\r\n\r\n case DeviceControlFeature.SetBlindPosition:\r\n switch ((tsk as SetBlindPosition).Action) {\r\n case BlindActionEnum.Open:\r\n t.Data = 101;\r\n break;\r\n\r\n case BlindActionEnum.Close:\r\n t.Data = 102;\r\n break;\r\n\r\n case BlindActionEnum.Stop:\r\n t.Data = 103;\r\n break;\r\n\r\n case BlindActionEnum.Percentage:\r\n t.Data = (tsk as SetBlindPosition).Position;\r\n break;\r\n }\r\n break;\r\n\r\n case DeviceControlFeature.SetLightBrightnessDynamicly:\r\n t.Data = (tsk as SetLightBrightnessDynamicly).Brightness;\r\n break;\r\n\r\n case DeviceControlFeature.SetBlindOpenCloseTime:\r\n t.Data = (tsk as SetBlindOpenCloseTime).Data;\r\n break;\r\n\r\n case DeviceControlFeature.SetBlindMicroventilation:\r\n t.Data = (tsk as SetBlindMicroventilation).Position;\r\n break;\r\n\r\n case DeviceControlFeature.SetFacadePositionAndTilt:\r\n t = new FacadePositionTaskInfo();\r\n const fp = tsk as SetFacadePosition;\r\n (t as FacadePositionTaskInfo).FacadeAction = fp.FacadeAction;\r\n (t as FacadePositionTaskInfo).Tilt = fp.Tilt;\r\n (t as FacadePositionTaskInfo).Position = fp.Position;\r\n break;\r\n }\r\n\r\n t.Channel = tsk.Channel;\r\n t.DeviceGuid = device.Guid;\r\n t.ControlFeature = tsk.FeatureType;\r\n return t;\r\n }\r\n\r\n async ExecuteDeviceTaskAsync(device: IDevice, task: IDeviceTask): Promise<DeviceTaskExecutionResult> {\r\n try {\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Preparing device task execution, device: ${device.Guid} task: ${task.TaskType} channel: ${task.Channel}`);\r\n let t = this.MapDeviceTaskToDeviceTaskInfo(device, task);\r\n\r\n try {\r\n const req = new ExecuteDeviceTaskRequest(t);\r\n DependencyContainer.Log?.Debug(DevicesService.ServiceName, `Sending device task for execution, device: ${t.DeviceGuid} task: ${t.ControlFeature} channel: ${t.Channel} request: ${JSON.stringify(req)}`);\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n\r\n switch (result?.Status) {\r\n case Status.OK:\r\n return DeviceTaskExecutionResult.Executed;\r\n\r\n case Status.FatalError:\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Fatal error occured when tried to execute task on device. Error code: ${result.Data}`);\r\n return DeviceTaskExecutionResult.Failed;\r\n\r\n case Status.WrongData:\r\n switch (result.Data) {\r\n case \"DeviceNotFound\":\r\n return DeviceTaskExecutionResult.DeviceNotFound;\r\n }\r\n break;\r\n\r\n case Status.Error:\r\n switch (result.Data) {\r\n case \"DeviceResponseTimeout\":\r\n return DeviceTaskExecutionResult.DeviceResponseTimeout;\r\n }\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when trying to execute task on device. Error code: ${result.Data}`);\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n }\r\n catch (ex: any) {\r\n if ((ex as Error).message.includes(\"timeout\")) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get controller response in time.\\n${ex}`);\r\n return DeviceTaskExecutionResult.ControllerResponseTimeout;\r\n }\r\n else {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when tried to execute task on device.\\n${ex}`);\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n }\r\n\r\n return DeviceTaskExecutionResult.Unknown;\r\n }\r\n catch (ex: any) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when tried to execute task on device.\\n${ex}`);\r\n return DeviceTaskExecutionResult.Failed;\r\n }\r\n }\r\n\r\n async ExecuteDevicesTasksAsync(tasks: [Device: IDevice, Task: IDeviceTask][]): Promise<DeviceTaskPairExecutionResult[]> {\r\n let results: DeviceTaskPairExecutionResult[] = [];\r\n let tasksPair: DeviceTaskInfo[] = [];\r\n let devices: IDevice[] = [];\r\n let position = 0;\r\n\r\n for (const [device, task] of tasks) {\r\n const tmp = this.MapDeviceTaskToDeviceTaskInfo(device, task);\r\n tmp.SequnceExecutionOrder = position;\r\n position++;\r\n tasksPair.push(tmp);\r\n }\r\n\r\n const req = new ExecuteDevicesTasksRequest(tasksPair);\r\n try {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<DevicesTaskExecutionApiResult[]>(req, 120000, false);\r\n\r\n let responsePosition = -1;\r\n result?.Data?.forEach(element => {\r\n responsePosition++;\r\n let res: DeviceTaskExecutionResult = DeviceTaskExecutionResult.Unknown;\r\n\r\n switch (element.Status) {\r\n case Status.OK:\r\n return DeviceTaskExecutionResult.Executed;\r\n\r\n case Status.FatalError:\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Fatal error occured when tried to execute task on device. Error code: ${element.Data}`);\r\n res = DeviceTaskExecutionResult.Failed;\r\n break;\r\n\r\n case Status.WrongData:\r\n switch (element.Data) {\r\n case \"DeviceNotFound\":\r\n res = DeviceTaskExecutionResult.DeviceNotFound;\r\n break;\r\n }\r\n break;\r\n\r\n case Status.Error:\r\n switch (element.Data) {\r\n case \"DeviceResponseTimeout\":\r\n res = DeviceTaskExecutionResult.DeviceResponseTimeout;\r\n break;\r\n\r\n default:\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when trying to execute task on device. Error code: ${result.Data}`);\r\n res = DeviceTaskExecutionResult.Failed;\r\n break;\r\n }\r\n break;\r\n }\r\n\r\n let pos = 0;\r\n let info = new DeviceTaskPairExecutionResult();\r\n\r\n for (const [device, task] of tasks) {\r\n if (pos == responsePosition) {\r\n info.Device = device;\r\n info.Task = task;\r\n info.Channel = task.Channel;\r\n results.push(info);\r\n break;\r\n }\r\n else\r\n pos++;\r\n }\r\n });\r\n }\r\n catch (ex: any) {\r\n if ((ex as Error).message.includes(\"timeout\")) {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Failed to get controller response in time.\\n${ex}`);\r\n\r\n for (const [device, task] of tasks) {\r\n let info = new DeviceTaskPairExecutionResult();\r\n results.push(info);\r\n info.Device = device;\r\n info.Task = task;\r\n info.Channel = task.Channel;\r\n info.Result = DeviceTaskExecutionResult.ControllerResponseTimeout;\r\n }\r\n }\r\n else {\r\n DependencyContainer.Log?.Error(DevicesService.ServiceName, `Unknown error occured when tried to execute task on device.\\n${ex}`);\r\n\r\n for (const [device, task] of tasks) {\r\n let info = new DeviceTaskPairExecutionResult();\r\n results.push(info);\r\n info.Device = device;\r\n info.Task = task;\r\n info.Channel = task.Channel;\r\n info.Result = DeviceTaskExecutionResult.Failed;\r\n }\r\n }\r\n }\r\n return results;\r\n }\r\n}\r\n\r\nclass DeviceObject {\r\n Guid: string = \"\";\r\n CloudGuid: string = \"\";\r\n DeviceSerialNumber: string = \"\";\r\n DeviceModelGuid: string = \"\";\r\n ProtocolGuid: string = \"\";\r\n DeviceName: string = \"\";\r\n DeviceModel: string = \"\";\r\n ManufacturerGuid: string = \"\";\r\n ChannelsNumber: number = 0;\r\n IsVirtual: boolean = false;\r\n IsEnabled: boolean = false;\r\n DeviceState: DeviceState = DeviceState.Working;\r\n CommunicationWay: CommunicationWay = CommunicationWay.OneWay;\r\n DeviceType: DeviceType = DeviceType.Unknown;\r\n ChannelsConfiguration: ChannelConfigurationObject[] = [];\r\n Groups: DeviceGroupObject[] = [];\r\n AvailableTasks: string[] = [];\r\n AvailableResponses: string[] = [];\r\n}\r\n\r\nclass DeviceGroupObject {\r\n Guid: string = \"\";\r\n Name: string = \"\";\r\n}\r\n\r\nclass ChannelConfigurationObject {\r\n Channel: number = 0;\r\n ChannelName: string = \"\";\r\n Configuration: ChannelConfigurations = ChannelConfigurations.Default;\r\n IconName: string = \"\";\r\n GroupsGuids: string[] = [];\r\n Hidden: boolean = false;\r\n AvailableTasks: any[] = [];\r\n AvailableResponses: any[] = [];\r\n}\r\n\r\n\r\nclass GetDevicesListRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/list\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\nclass GetDevicesStatesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/channels/states\";\r\n this.Method = Method.Get;\r\n }\r\n Data: boolean = false;\r\n}\r\n\r\nclass SyncDevicesStatesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/channels/states/sync\";\r\n this.Method = Method.Get;\r\n }\r\n Data: boolean = false;\r\n}\r\n\r\nclass SearchForDevicesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/search\";\r\n this.Method = Method.Post;\r\n }\r\n}\r\n\r\nclass StopSearchingForDevicesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/search/stop\";\r\n this.Method = Method.Post;\r\n }\r\n}\r\n\r\nclass GetFoundDevicesRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/found/list\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\n\r\nexport class DeviceStateChangedObject {\r\n DeviceGuid: string = \"\";\r\n state: DeviceStateObject = new DeviceStateObject();\r\n Type: number = 0;\r\n DataType: string = \"\";\r\n}\r\n\r\nexport class DeviceStateObject {\r\n Channel: number = 0;\r\n StateReliability: StateReliability = StateReliability.Unconfident;\r\n}\r\n\r\nclass GetRunningDevicesTasksRequest extends DataFrame<any>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/tasks\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\n\r\nclass DevicePairRequest extends DataFrame<string>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/device/pair\";\r\n this.Method = Method.Put;\r\n }\r\n}\r\n\r\nclass DeviceUnpairRequest extends DataFrame<string>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/device/unpair\";\r\n this.Method = Method.Put;\r\n }\r\n}\r\n\r\nclass ExecuteDeviceTaskRequest extends DataFrame<DeviceTaskInfo>\r\n{\r\n constructor(task: DeviceTaskInfo) {\r\n super();\r\n this.Resource = \"/devices/device/control\";\r\n this.Method = Method.Post;\r\n this.Data = task;\r\n }\r\n}\r\n\r\nclass ExecuteDevicesTasksRequest extends DataFrame<DeviceTaskInfo[]>\r\n{\r\n constructor(tasks: DeviceTaskInfo[]) {\r\n super();\r\n this.Resource = \"/devices/devices/control\";\r\n this.Method = Method.Post;\r\n this.Data = tasks;\r\n }\r\n}\r\n\r\nclass DeviceTaskInfo {\r\n DeviceGuid: string = \"\";\r\n Channel: number = 0;\r\n ControlFeature: DeviceControlFeature = DeviceControlFeature.GetState;\r\n Data: any;\r\n /// does't exist in controller, its is used only by this library to map responses that are returned in order to tasks\r\n SequnceExecutionOrder: number = 0;\r\n}\r\n\r\nclass LightColorTaskInfo extends DeviceTaskInfo {\r\n R: number = 0;\r\n G: number = 0;\r\n B: number = 0;\r\n}\r\n\r\nclass FacadePositionTaskInfo extends DeviceTaskInfo {\r\n FacadeAction: FacadeActionEnum = FacadeActionEnum.Stop;\r\n Tilt: number = 0;\r\n Position: number = 0;\r\n}\r\n\r\nclass DevicesTaskExecutionApiResult {\r\n DeviceGuid: string = \"\";\r\n Data: any;\r\n Status: Status = Status.OK;\r\n}","import { ResponseResult } from '../FieldChangeResult';\r\nimport { Coordinates, CoordinatesWithSourceInfo, IGeolocationService, SetGeolocationResponseCode } from './IGeolocationService';\r\nimport { DataFrame, Method, Status } from '../../DataFrame';\r\nimport { IExalusConnectionService } from '../IExalusConnectionService';\r\nimport { Api } from '../../Api';\r\nimport { ExalusConnectionService } from '../ExalusConnectionService';\r\nimport { DependencyContainer } from '../../DependencyContainer';\r\n\r\nexport class GeolocationService implements IGeolocationService {\r\n\tpublic static readonly ServiceName: string = \"GeolocationService\";\r\n\r\n\tasync IsControllerGeolocationSetAsync(): Promise<boolean | Status> {\t\t\r\n\t\tlet req = new IsGeolocationSetRequest();\r\n\t\tlet response = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName).SendAndWaitForResponseAsync<boolean>(req, 15000, true);\r\n\r\n\t\tswitch (response?.Status) {\r\n\t\t\tcase Status.OK:\r\n\t\t\t\treturn response?.Data as boolean;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\treturn response?.Status as Status;\r\n\t\t}\r\n\t}\r\n\r\n\tasync GetCurrentGeolocationAsync(): Promise<GeolocationPosition | GeolocationPositionError> {\r\n\t\treturn new Promise<GeolocationPosition | GeolocationPositionError>(async (resolve, reject) => {\r\n\t\t\twindow.navigator.geolocation.getCurrentPosition(position => {\r\n\t\t\t\tresolve(position);\r\n\t\t\t}, error => {\r\n\t\t\t\tresolve(error);\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\r\n\tasync SetControllerGeolocationAsync(location: Coordinates): Promise<ResponseResult<SetGeolocationResponseCode>> {\r\n\t\tlet req = new SetCoordinatesRequest();\r\n\t\treq.Data.Latitude = location.Latitude;\r\n\t\treq.Data.Longitude = location.Longitude;\r\n\t\r\n\t\tDependencyContainer.Log?.Warning(GeolocationService.ServiceName, `SetControllerGeolocationAsync() ${JSON.stringify(req)}`);\r\n\t\tlet response = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName).SendAndWaitForResponseAsync<boolean>(req, 15000, false);\t\r\n\t\tDependencyContainer.Log?.Warning(GeolocationService.ServiceName, `${JSON.stringify(response)}`);\r\n\r\n\t\tswitch (response?.Status) {\r\n\t\t\tcase Status.OK:\r\n\t\t\t\treturn new ResponseResult<SetGeolocationResponseCode>(SetGeolocationResponseCode.OK, \"\");\r\n\r\n\t\t\tcase Status.NoPermissionToPerformThisOperation:\r\n\t\t\tcase Status.NoPermissionsToCallGivenResource:\r\n\t\t\t\treturn new ResponseResult<SetGeolocationResponseCode>(SetGeolocationResponseCode.NoPermissions, \"\");\r\n\r\n\t\t\tcase Status.UserIsNotLoggedIn:\r\n\t\t\t\treturn new ResponseResult<SetGeolocationResponseCode>(SetGeolocationResponseCode.UserIsNotLoggedIn, \"\");\r\n\r\n\t\t\tdefault:\r\n\t\t\t\treturn new ResponseResult<SetGeolocationResponseCode>(SetGeolocationResponseCode.UnknownError, \"\");\r\n\t\t}\r\n\t}\r\n\r\n\tasync GetControlllerGeolocationAsync(): Promise<CoordinatesWithSourceInfo | Status> {\r\n\t\tlet req = new GetSetCoordinatesRequest();\r\n\t\tDependencyContainer.Log?.Warning(GeolocationService.ServiceName, `GetControlllerGeolocationAsync(): ${JSON.stringify(req)}`);\r\n\t\tlet response = await Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName).SendAndWaitForResponseAsync<CoordinatesWithSourceInfo>(req, 15000, true);\r\n\t\tDependencyContainer.Log?.Warning(GeolocationService.ServiceName, `${JSON.stringify(response)}`);\r\n\r\n\t\tswitch (response?.Status) {\r\n\t\t\tcase Status.OK:\r\n\t\t\t\tlet c = new CoordinatesWithSourceInfo();\r\n\t\t\t\tc.IsNetworkBased = (response?.Data as CoordinatesWithSourceInfo).IsNetworkBased;\r\n\t\t\t\tc.Latitude = (response?.Data as CoordinatesWithSourceInfo).Latitude;\r\n\t\t\t\tc.Longitude = (response?.Data as CoordinatesWithSourceInfo).Longitude;\r\n\t\t\t\treturn c;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\treturn response?.Status as Status;\r\n\t\t}\r\n\t}\r\n\r\n\tGetServiceName(): string {\r\n\t\treturn GeolocationService.ServiceName;\r\n\t}\r\n\r\n}\r\n\r\nclass IsGeolocationSetRequest extends DataFrame<any>\r\n{\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.Resource = \"/geolocation/isset\";\r\n\t\tthis.Method = Method.Get;\r\n\t}\r\n}\r\n\r\nclass GetSetCoordinatesRequest extends DataFrame<any>\r\n{\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.Resource = \"/geolocation/get\";\r\n\t\tthis.Method = Method.Get;\r\n\t}\r\n}\r\n\r\nclass SetCoordinatesRequest extends DataFrame<any>\r\n{\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.Resource = \"/geolocation/save\";\r\n\t\tthis.Method = Method.Put;\r\n\t}\r\n\r\n\tData: Coordinates = new Coordinates();\r\n}","export class ArgumentOutOfRangeException extends RangeError {\r\n constructor(paramName) {\r\n super(`${paramName} was out of range.` +\r\n \" Must be non-negative and less than the size of the collection.\");\r\n this.paramName = paramName;\r\n this.name = \"ArgumentOutOfRangeException\";\r\n this.stack = this.stack || (new Error()).stack;\r\n }\r\n}\r\n","export const ErrorString = Object.freeze({\r\n MoreThanOneElement: \"Sequence contains more than one element\",\r\n MoreThanOneMatchingElement: \"Sequence contains more than one matching element\",\r\n NoElements: \"Sequence contains no elements\",\r\n NoMatch: \"Sequence contains no matching element\",\r\n});\r\n","export class InvalidOperationException extends Error {\r\n constructor(message) {\r\n super(message);\r\n this.name = \"InvalidOperationException\";\r\n this.stack = this.stack || (new Error()).stack;\r\n }\r\n}\r\n","export const StrictEqualityComparer = (x, y) => x === y;\r\n","export class ArrayEnumerable extends Array {\r\n}\r\n","export class BasicAsyncEnumerable {\r\n constructor(iterator) {\r\n this.iterator = iterator;\r\n }\r\n [Symbol.asyncIterator]() {\r\n return this.iterator();\r\n }\r\n}\r\n","export class BasicParallelEnumerable {\r\n constructor(dataFunc) {\r\n this.dataFunc = dataFunc;\r\n }\r\n [Symbol.asyncIterator]() {\r\n const { dataFunc } = this;\r\n async function* iterator() {\r\n switch (dataFunc.type) {\r\n case 1:\r\n for (const value of dataFunc.generator()) {\r\n yield value;\r\n }\r\n break;\r\n case 2:\r\n for (const value of await dataFunc.generator()) {\r\n yield value;\r\n }\r\n break;\r\n case 0:\r\n default:\r\n for (const value of await dataFunc.generator()) {\r\n yield value;\r\n }\r\n break;\r\n }\r\n }\r\n return iterator();\r\n }\r\n}\r\n","export class BasicEnumerable {\r\n constructor(iterator) {\r\n this.iterator = iterator;\r\n }\r\n [Symbol.iterator]() {\r\n return this.iterator();\r\n }\r\n}\r\n","import { ArrayEnumerable } from \"../sync/ArrayEnumerable.js\";\r\nexport const bindArray = (jsArray) => {\r\n var _a;\r\n const arrayEnumerablePrototype = ArrayEnumerable.prototype;\r\n const bindToPrototype = jsArray.prototype;\r\n const propertyNames = Object\r\n .getOwnPropertyNames(arrayEnumerablePrototype);\r\n for (const prop of propertyNames) {\r\n bindToPrototype[prop] = (_a = bindToPrototype[prop]) !== null && _a !== void 0 ? _a : arrayEnumerablePrototype[prop];\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const aggregate = (source, seedOrFunc, func, resultSelector) => {\r\n if (resultSelector) {\r\n if (!func) {\r\n throw new ReferenceError(\"TAccumulate function is undefined\");\r\n }\r\n return aggregate3(source, seedOrFunc, func, resultSelector);\r\n }\r\n else if (func) {\r\n return aggregate2(source, seedOrFunc, func);\r\n }\r\n else {\r\n return aggregate1(source, seedOrFunc);\r\n }\r\n};\r\nconst aggregate1 = (source, func) => {\r\n let aggregateValue;\r\n for (const value of source) {\r\n if (aggregateValue) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n else {\r\n aggregateValue = value;\r\n }\r\n }\r\n if (aggregateValue === undefined) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate2 = (source, seed, func) => {\r\n let aggregateValue = seed;\r\n for (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate3 = (source, seed, func, resultSelector) => {\r\n let aggregateValue = seed;\r\n for (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return resultSelector(aggregateValue);\r\n};\r\n","export const all = (source, predicate) => {\r\n for (const item of source) {\r\n if (predicate(item) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const allAsync = async (source, predicate) => {\r\n for (const item of source) {\r\n if (await predicate(item) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const any = (source, predicate) => {\r\n if (predicate) {\r\n return any2(source, predicate);\r\n }\r\n else {\r\n return any1(source);\r\n }\r\n};\r\nconst any1 = (source) => {\r\n for (const _ of source) {\r\n return true;\r\n }\r\n return false;\r\n};\r\nconst any2 = (source, predicate) => {\r\n for (const item of source) {\r\n if (predicate(item) === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const anyAsync = async (source, predicate) => {\r\n for (const item of source) {\r\n if (await predicate(item) === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const fromAsync = (promisesOrIterable) => {\r\n if (Array.isArray(promisesOrIterable)) {\r\n if (promisesOrIterable.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return new BasicAsyncEnumerable(async function* () {\r\n for await (const value of promisesOrIterable) {\r\n yield value;\r\n }\r\n });\r\n }\r\n else {\r\n return new BasicAsyncEnumerable(promisesOrIterable);\r\n }\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const asAsync = (source) => {\r\n async function* generator() {\r\n for (const value of source) {\r\n yield value;\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const fromParallel = (type, generator) => {\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type,\r\n });\r\n};\r\n","import { fromParallel } from \"../../parallel/static/fromParallel.js\";\r\nexport const asParallel = (source) => {\r\n const generator = async () => {\r\n const array = [];\r\n for (const value of source) {\r\n array.push(value);\r\n }\r\n return array;\r\n };\r\n return fromParallel(0, generator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const average = (source, selector) => {\r\n let value = 0;\r\n let count = 0;\r\n if (selector) {\r\n for (const item of source) {\r\n value = value + selector(item);\r\n count = count + 1;\r\n }\r\n }\r\n else {\r\n for (const item of source) {\r\n value = value + item;\r\n count = count + 1;\r\n }\r\n }\r\n if (count === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return value / count;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const averageAsync = async (source, selector) => {\r\n let value = 0;\r\n let count = 0;\r\n for (const item of source) {\r\n value = value + await selector(item);\r\n count = count + 1;\r\n }\r\n if (count === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return value / count;\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nimport { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const chunk = (source, size) => {\r\n if (size < 1) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n function* iterator() {\r\n let yieldChunk = [];\r\n for (const value of source) {\r\n yieldChunk.push(value);\r\n if (yieldChunk.length === size) {\r\n yield yieldChunk;\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n yield yieldChunk;\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const concatenate = (first, second) => {\r\n function* iterator() {\r\n yield* first;\r\n yield* second;\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const contains = (source, value, comparer = StrictEqualityComparer) => {\r\n for (const item of source) {\r\n if (comparer(value, item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const containsAsync = async (source, value, comparer) => {\r\n for (const item of source) {\r\n if (await comparer(value, item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const count = (source, predicate) => {\r\n if (predicate) {\r\n return count2(source, predicate);\r\n }\r\n else {\r\n return count1(source);\r\n }\r\n};\r\nconst count1 = (source) => {\r\n let count = 0;\r\n for (const _ of source) {\r\n count++;\r\n }\r\n return count;\r\n};\r\nconst count2 = (source, predicate) => {\r\n let count = 0;\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n};\r\n","export const countAsync = async (source, predicate) => {\r\n let count = 0;\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const defaultIfEmpty = (source, defaultValue) => {\r\n function* generator() {\r\n let found = false;\r\n for (const value of source) {\r\n found = true;\r\n yield value;\r\n }\r\n if (!found) {\r\n yield defaultValue;\r\n }\r\n }\r\n return new BasicEnumerable(generator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const distinct = (source, comparer = StrictEqualityComparer) => {\r\n function* iterator() {\r\n const distinctElements = [];\r\n for (const item of source) {\r\n const foundItem = distinctElements.find((x) => comparer(x, item));\r\n if (!foundItem) {\r\n distinctElements.push(item);\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const distinctAsync = (source, comparer) => {\r\n async function* iterator() {\r\n const distinctElements = [];\r\n outerLoop: for (const item of source) {\r\n for (const distinctElement of distinctElements) {\r\n const found = await comparer(distinctElement, item);\r\n if (found) {\r\n continue outerLoop;\r\n }\r\n }\r\n distinctElements.push(item);\r\n yield item;\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const each = (source, action) => {\r\n function* generator() {\r\n for (const value of source) {\r\n action(value);\r\n yield value;\r\n }\r\n }\r\n return new BasicEnumerable(generator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const eachAsync = (source, action) => {\r\n async function* generator() {\r\n for (const value of source) {\r\n await action(value);\r\n yield value;\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const elementAt = (source, index) => {\r\n if (index < 0) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n let i = 0;\r\n for (const item of source) {\r\n if (index === i++) {\r\n return item;\r\n }\r\n }\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n};\r\n","export const elementAtOrDefault = (source, index) => {\r\n let i = 0;\r\n for (const item of source) {\r\n if (index === i++) {\r\n return item;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const except = (first, second, comparer = StrictEqualityComparer) => {\r\n function* iterator() {\r\n const secondArray = [...second];\r\n for (const firstItem of first) {\r\n let exists = false;\r\n for (let j = 0; j < secondArray.length; j++) {\r\n const secondItem = secondArray[j];\r\n if (comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield firstItem;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const exceptAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const secondArray = [...second];\r\n for (const firstItem of first) {\r\n let exists = false;\r\n for (let j = 0; j < secondArray.length; j++) {\r\n const secondItem = secondArray[j];\r\n if (await comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield firstItem;\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const first = (source, predicate) => {\r\n if (predicate) {\r\n return first2(source, predicate);\r\n }\r\n else {\r\n return first1(source);\r\n }\r\n};\r\nconst first1 = (source) => {\r\n const first = source[Symbol.iterator]().next();\r\n if (first.done === true) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return first.value;\r\n};\r\nconst first2 = (source, predicate) => {\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const firstAsync = async (source, predicate) => {\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","export const firstOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return firstOrDefault2(source, predicate);\r\n }\r\n else {\r\n return firstOrDefault1(source);\r\n }\r\n};\r\nconst firstOrDefault1 = (source) => {\r\n const first = source[Symbol.iterator]().next();\r\n return first.value || null;\r\n};\r\nconst firstOrDefault2 = (source, predicate) => {\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","export const firstOrDefaultAsync = async (source, predicate) => {\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { ArrayEnumerable } from \"./ArrayEnumerable.js\";\r\nexport class Grouping extends ArrayEnumerable {\r\n constructor(key, startingItem) {\r\n super(1);\r\n this.key = key;\r\n this[0] = startingItem;\r\n }\r\n}\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nimport { Grouping } from \"../Grouping.js\";\r\nexport const groupBy_0 = (source, keySelector, comparer) => {\r\n return function* generate() {\r\n const keyMap = new Array();\r\n for (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n for (const keyValue of keyMap) {\r\n yield keyValue;\r\n }\r\n };\r\n};\r\nexport const groupBy_0_Simple = (source, keySelector) => {\r\n return function* iterator() {\r\n const keyMap = {};\r\n for (const value of source) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n };\r\n};\r\nexport const groupBy_1_Simple = (source, keySelector, elementSelector) => {\r\n function* generate() {\r\n const keyMap = {};\r\n for (const value of source) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n const element = elementSelector(value);\r\n if (grouping) {\r\n grouping.push(element);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, element);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return new BasicEnumerable(generate);\r\n};\r\nexport const groupBy_1 = (source, keySelector, elementSelector, comparer) => {\r\n function* generate() {\r\n const keyMap = new Array();\r\n for (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(elementSelector(value));\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n const element = elementSelector(value);\r\n keyMap.push(new Grouping(key, element));\r\n }\r\n }\r\n for (const keyValue of keyMap) {\r\n yield keyValue;\r\n }\r\n }\r\n return new BasicEnumerable(generate);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nimport { groupBy_0, groupBy_0_Simple } from \"./groupByShared.js\";\r\nexport const groupBy = (source, keySelector, comparer) => {\r\n let iterable;\r\n if (comparer) {\r\n iterable = groupBy_0(source, keySelector, comparer);\r\n }\r\n else {\r\n iterable = groupBy_0_Simple(source, keySelector);\r\n }\r\n return new BasicEnumerable(iterable);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nimport { Grouping } from \"../Grouping.js\";\r\nexport const groupByAsync = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupByAsync_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupByAsync_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupByAsync_0_Simple = (source, keySelector) => {\r\n async function* iterator() {\r\n const keyMap = {};\r\n for (const value of source) {\r\n const key = await keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst groupByAsync_0 = (source, keySelector, comparer) => {\r\n async function* generate() {\r\n const keyMap = new Array();\r\n for (const value of source) {\r\n const key = await keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (await comparer(group.key, key) === true) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n for (const keyValue of keyMap) {\r\n yield keyValue;\r\n }\r\n }\r\n return fromAsync(generate);\r\n};\r\n","import { groupBy_1, groupBy_1_Simple } from \"./groupByShared.js\";\r\nexport const groupByWithSel = (source, keySelector, elementSelector, comparer) => {\r\n if (comparer) {\r\n return groupBy_1(source, keySelector, elementSelector, comparer);\r\n }\r\n else {\r\n return groupBy_1_Simple(source, keySelector, elementSelector);\r\n }\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const groupJoin = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicEnumerable(generator);\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return function* () {\r\n var _a;\r\n const innerKeyMap = [];\r\n for (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n for (const outerValue of outer) {\r\n const key = outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n yield resultSelector(outerValue, innerRecord.values);\r\n }\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return function* () {\r\n var _a;\r\n const innerKeyMap = new Map();\r\n for (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n for (const outerValue of outer) {\r\n const key = outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n yield resultSelector(outerValue, values);\r\n }\r\n };\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const groupJoinAsync = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return fromAsync(generator);\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = [];\r\n for (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n for (const outerValue of outer) {\r\n const key = await outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n yield resultSelector(outerValue, innerRecord.values);\r\n }\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = new Map();\r\n for (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n for (const outerValue of outer) {\r\n const key = await outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n yield resultSelector(outerValue, values);\r\n }\r\n };\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const intersect = (first, second, comparer = StrictEqualityComparer) => {\r\n function* iterator() {\r\n const firstResults = [...first.distinct(comparer)];\r\n if (firstResults.length === 0) {\r\n return;\r\n }\r\n const secondResults = [...second];\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (comparer(firstValue, secondValue) === true) {\r\n yield firstValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const intersectAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const firstResults = [];\r\n for await (const item of first.distinctAsync(comparer)) {\r\n firstResults.push(item);\r\n }\r\n if (firstResults.length === 0) {\r\n return;\r\n }\r\n const secondResults = [...second];\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (await comparer(firstValue, secondValue) === true) {\r\n yield firstValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const join = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer = StrictEqualityComparer) => {\r\n function* iterator() {\r\n const innerArray = [...inner];\r\n for (const o of outer) {\r\n const outerKey = outerKeySelector(o);\r\n for (const i of innerArray) {\r\n const innerKey = innerKeySelector(i);\r\n if (comparer(outerKey, innerKey) === true) {\r\n yield resultSelector(o, i);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const last = (source, predicate) => {\r\n if (predicate) {\r\n return last2(source, predicate);\r\n }\r\n else {\r\n return last1(source);\r\n }\r\n};\r\nconst last1 = (source) => {\r\n let lastItem;\r\n for (const value of source) {\r\n lastItem = value;\r\n }\r\n if (!lastItem) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return lastItem;\r\n};\r\nconst last2 = (source, predicate) => {\r\n let lastItem;\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n lastItem = value;\r\n }\r\n }\r\n if (!lastItem) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return lastItem;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const lastAsync = async (source, predicate) => {\r\n let last;\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n if (!last) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return last;\r\n};\r\n","export const lastOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return lastOrDefault2(source, predicate);\r\n }\r\n else {\r\n return lastOrDefault1(source);\r\n }\r\n};\r\nconst lastOrDefault1 = (source) => {\r\n let last = null;\r\n for (const value of source) {\r\n last = value;\r\n }\r\n return last;\r\n};\r\nconst lastOrDefault2 = (source, predicate) => {\r\n let last = null;\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n return last;\r\n};\r\n","export const lastOrDefaultAsync = async (source, predicate) => {\r\n let last = null;\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n return last;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const max = (source, selector) => {\r\n if (selector) {\r\n return max2(source, selector);\r\n }\r\n else {\r\n return max1(source);\r\n }\r\n};\r\nconst max1 = (source) => {\r\n let maxItem = null;\r\n for (const item of source) {\r\n maxItem = Math.max(maxItem || Number.NEGATIVE_INFINITY, item);\r\n }\r\n if (maxItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return maxItem;\r\n }\r\n};\r\nconst max2 = (source, selector) => {\r\n let maxItem = null;\r\n for (const item of source) {\r\n maxItem = Math.max(maxItem || Number.NEGATIVE_INFINITY, selector(item));\r\n }\r\n if (maxItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return maxItem;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const maxAsync = async (source, selector) => {\r\n let max = null;\r\n for (const item of source) {\r\n max = Math.max(max || Number.NEGATIVE_INFINITY, await selector(item));\r\n }\r\n if (max === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return max;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const min = (source, selector) => {\r\n if (selector) {\r\n return min2(source, selector);\r\n }\r\n else {\r\n return min1(source);\r\n }\r\n};\r\nconst min1 = (source) => {\r\n let minItem = null;\r\n for (const item of source) {\r\n minItem = Math.min(minItem || Number.POSITIVE_INFINITY, item);\r\n }\r\n if (minItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return minItem;\r\n }\r\n};\r\nconst min2 = (source, selector) => {\r\n let minItem = null;\r\n for (const item of source) {\r\n minItem = Math.min(minItem || Number.POSITIVE_INFINITY, selector(item));\r\n }\r\n if (minItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return minItem;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const minAsync = async (source, selector) => {\r\n let min = null;\r\n for (const item of source) {\r\n min = Math.min(min || Number.POSITIVE_INFINITY, await selector(item));\r\n }\r\n if (min === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return min;\r\n }\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const ofType = (source, type) => {\r\n const typeCheck = typeof type === \"string\" ?\r\n ((x) => typeof x === type) :\r\n ((x) => x instanceof type);\r\n function* iterator() {\r\n for (const item of source) {\r\n if (typeCheck(item)) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { asAsyncKeyMapSync } from \"./asAsyncKeyMapSync.js\";\r\nexport async function* asAsyncSortedKeyValuesSync(source, keySelector, ascending, comparer) {\r\n const map = await asAsyncKeyMapSync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asAsyncKeyMapSync = async (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMapSync } from \"./asKeyMapSync.js\";\r\nexport function* asSortedKeyValuesSync(source, keySelector, ascending, comparer) {\r\n const map = asKeyMapSync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMapSync = (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asAsyncSortedKeyValues } from \"./_ordered/asAsyncSortedKeyValues.js\";\r\nimport { asAsyncSortedKeyValuesSync } from \"./_ordered/asAsyncSortedKeyValuesSync.js\";\r\nimport { asSortedKeyValues } from \"./_ordered/asSortedKeyValues.js\";\r\nimport { asSortedKeyValuesSync } from \"./_ordered/asSortedKeyValuesSync.js\";\r\nimport { BasicAsyncEnumerable } from \"./BasicAsyncEnumerable.js\";\r\nexport class OrderedAsyncEnumerable extends BasicAsyncEnumerable {\r\n constructor(orderedPairs) {\r\n super(async function* () {\r\n for await (const orderedPair of orderedPairs()) {\r\n yield* orderedPair;\r\n }\r\n });\r\n this.orderedPairs = orderedPairs;\r\n }\r\n static generateAsync(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedAsyncEnumerable) {\r\n orderedPairs = async function* () {\r\n for await (const pair of source.orderedPairs()) {\r\n yield* asAsyncSortedKeyValuesSync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asAsyncSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedAsyncEnumerable(orderedPairs);\r\n }\r\n static generate(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedAsyncEnumerable) {\r\n orderedPairs = async function* () {\r\n for await (const pair of source.orderedPairs()) {\r\n yield* asSortedKeyValuesSync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedAsyncEnumerable(orderedPairs);\r\n }\r\n thenBy(keySelector, comparer) {\r\n return OrderedAsyncEnumerable.generate(this, keySelector, true, comparer);\r\n }\r\n thenByAsync(keySelector, comparer) {\r\n return OrderedAsyncEnumerable.generateAsync(this, keySelector, true, comparer);\r\n }\r\n thenByDescending(keySelector, comparer) {\r\n return OrderedAsyncEnumerable.generate(this, keySelector, false, comparer);\r\n }\r\n thenByDescendingAsync(keySelector, comparer) {\r\n return OrderedAsyncEnumerable.generateAsync(this, keySelector, false, comparer);\r\n }\r\n}\r\n","import { asAsyncKeyMap } from \"./asAsyncKeyMap.js\";\r\nexport async function* asAsyncSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = await asAsyncKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asAsyncKeyMap = async (source, keySelector) => {\r\n const map = new Map();\r\n for await (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMap } from \"./asKeyMap.js\";\r\nexport async function* asSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = await asKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMap = async (source, keySelector) => {\r\n const map = new Map();\r\n for await (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMap } from \"./asKeyMap.js\";\r\nexport function* asSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = asKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMap = (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMapAsync } from \"./asKeyMapAsync.js\";\r\nexport async function* asSortedKeyValuesAsync(source, keySelector, ascending, comparer) {\r\n const map = await asKeyMapAsync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMapAsync = async (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../async/OrderedAsyncEnumerable.js\";\r\nimport { asSortedKeyValues } from \"./_ordered/asSortedKeyValues.js\";\r\nimport { asSortedKeyValuesAsync } from \"./_ordered/asSortedKeyValuesAsync.js\";\r\nimport { BasicEnumerable } from \"./BasicEnumerable.js\";\r\nexport class OrderedEnumerable extends BasicEnumerable {\r\n constructor(orderedPairs) {\r\n super(function* () {\r\n for (const orderedPair of orderedPairs()) {\r\n yield* orderedPair;\r\n }\r\n });\r\n this.orderedPairs = orderedPairs;\r\n }\r\n static generate(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedEnumerable) {\r\n orderedPairs = function* () {\r\n for (const pair of source.orderedPairs()) {\r\n yield* asSortedKeyValues(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedEnumerable(orderedPairs);\r\n }\r\n static generateAsync(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedEnumerable) {\r\n orderedPairs = async function* () {\r\n for (const pair of source.orderedPairs()) {\r\n yield* asSortedKeyValuesAsync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asSortedKeyValuesAsync(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedAsyncEnumerable(orderedPairs);\r\n }\r\n thenBy(keySelector, comparer) {\r\n return OrderedEnumerable.generate(this, keySelector, true, comparer);\r\n }\r\n thenByAsync(keySelector, comparer) {\r\n return OrderedEnumerable.generateAsync(this, keySelector, true, comparer);\r\n }\r\n thenByDescending(keySelector, comparer) {\r\n return OrderedEnumerable.generate(this, keySelector, false, comparer);\r\n }\r\n thenByDescendingAsync(keySelector, comparer) {\r\n return OrderedEnumerable.generateAsync(this, keySelector, false, comparer);\r\n }\r\n}\r\n","import { OrderedEnumerable } from \"../OrderedEnumerable.js\";\r\nexport const orderBy = (source, keySelector, comparer) => {\r\n return OrderedEnumerable.generate(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedEnumerable } from \"../OrderedEnumerable.js\";\r\nexport const orderByAsync = (source, keySelector, comparer) => {\r\n return OrderedEnumerable.generateAsync(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedEnumerable } from \"../OrderedEnumerable.js\";\r\nexport const orderByDescending = (source, keySelector, comparer) => {\r\n return OrderedEnumerable.generate(source, keySelector, false, comparer);\r\n};\r\n","import { OrderedEnumerable } from \"../OrderedEnumerable.js\";\r\nexport const orderByDescendingAsync = (source, keySelector, comparer) => {\r\n return OrderedEnumerable.generateAsync(source, keySelector, false, comparer);\r\n};\r\n","export const partition = (source, predicate) => {\r\n const fail = [];\r\n const pass = [];\r\n for (const value of source) {\r\n if (predicate(value) === true) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","export const partitionAsync = async (source, predicate) => {\r\n const fail = [];\r\n const pass = [];\r\n for (const value of source) {\r\n if (await predicate(value) === true) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const reverse = (source) => {\r\n function* iterator() {\r\n const array = [...source];\r\n for (let i = array.length - 1; i >= 0; i--) {\r\n yield array[i];\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const select = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n const { length } = selector;\r\n if (length === 1) {\r\n return select1(source, selector);\r\n }\r\n else {\r\n return select2(source, selector);\r\n }\r\n }\r\n else {\r\n return select3(source, selector);\r\n }\r\n};\r\nconst select1 = (source, selector) => {\r\n function* iterator() {\r\n for (const value of source) {\r\n yield selector(value);\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst select2 = (source, selector) => {\r\n function* iterator() {\r\n let index = 0;\r\n for (const value of source) {\r\n yield selector(value, index);\r\n index++;\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst select3 = (source, key) => {\r\n function* iterator() {\r\n for (const value of source) {\r\n yield value[key];\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const selectAsync = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n return selectAsync1(source, selector);\r\n }\r\n else {\r\n return selectAsync2(source, selector);\r\n }\r\n }\r\n else {\r\n return selectAsync3(source, selector);\r\n }\r\n};\r\nconst selectAsync1 = (source, selector) => {\r\n async function* iterator() {\r\n for (const value of source) {\r\n yield selector(value);\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst selectAsync2 = (source, selector) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for (const value of source) {\r\n yield selector(value, index);\r\n index++;\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst selectAsync3 = (source, key) => {\r\n async function* iterator() {\r\n for (const value of source) {\r\n yield value[key];\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const selectMany = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n return selectMany1(source, selector);\r\n }\r\n else {\r\n return selectMany2(source, selector);\r\n }\r\n }\r\n else {\r\n return selectMany3(source, selector);\r\n }\r\n};\r\nconst selectMany1 = (source, selector) => {\r\n function* iterator() {\r\n for (const value of source) {\r\n for (const selectorValue of selector(value)) {\r\n yield selectorValue;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst selectMany2 = (source, selector) => {\r\n function* iterator() {\r\n let index = 0;\r\n for (const value of source) {\r\n for (const selectorValue of selector(value, index)) {\r\n yield selectorValue;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst selectMany3 = (source, selector) => {\r\n function* iterator() {\r\n for (const value of source) {\r\n for (const selectorValue of value[selector]) {\r\n yield selectorValue;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const selectManyAsync = (source, selector) => {\r\n if (selector.length === 1) {\r\n return selectManyAsync1(source, selector);\r\n }\r\n else {\r\n return selectManyAsync2(source, selector);\r\n }\r\n};\r\nconst selectManyAsync1 = (source, selector) => {\r\n async function* generator() {\r\n for (const value of source) {\r\n const innerValues = await selector(value);\r\n for (const innerValue of innerValues) {\r\n yield innerValue;\r\n }\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\nconst selectManyAsync2 = (source, selector) => {\r\n async function* generator() {\r\n let index = 0;\r\n for (const value of source) {\r\n const innerValues = await selector(value, index);\r\n for (const innerValue of innerValues) {\r\n yield innerValue;\r\n }\r\n index++;\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const sequenceEquals = (first, second, comparer = StrictEqualityComparer) => {\r\n const firstIterator = first[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n let firstResult = firstIterator.next();\r\n let secondResult = secondIterator.next();\r\n while (!firstResult.done && !secondResult.done) {\r\n if (!comparer(firstResult.value, secondResult.value)) {\r\n return false;\r\n }\r\n firstResult = firstIterator.next();\r\n secondResult = secondIterator.next();\r\n }\r\n return firstResult.done === true && secondResult.done === true;\r\n};\r\n","export const sequenceEqualsAsync = async (first, second, comparer) => {\r\n const firstIterator = first[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n let firstResult = firstIterator.next();\r\n let secondResult = secondIterator.next();\r\n while (!firstResult.done && !secondResult.done) {\r\n if (await comparer(firstResult.value, secondResult.value) === false) {\r\n return false;\r\n }\r\n firstResult = firstIterator.next();\r\n secondResult = secondIterator.next();\r\n }\r\n return firstResult.done === true && secondResult.done === true;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const single = (source, predicate) => {\r\n if (predicate) {\r\n return single2(source, predicate);\r\n }\r\n else {\r\n return single1(source);\r\n }\r\n};\r\nconst single1 = (source) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return singleValue;\r\n};\r\nconst single2 = (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleAsync = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (await predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return singleOrDefault2(source, predicate);\r\n }\r\n else {\r\n return singleOrDefault1(source);\r\n }\r\n};\r\nconst singleOrDefault1 = (source) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n return singleValue;\r\n};\r\nconst singleOrDefault2 = (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleOrDefaultAsync = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of source) {\r\n if (await predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const skip = (source, count) => {\r\n function* iterator() {\r\n let i = 0;\r\n for (const item of source) {\r\n if (i++ >= count) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const skipWhile = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return skipWhile1(source, predicate);\r\n }\r\n else {\r\n return skipWhile2(source, predicate);\r\n }\r\n};\r\nconst skipWhile1 = (source, predicate) => {\r\n function* iterator() {\r\n let skip = true;\r\n for (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (predicate(item) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst skipWhile2 = (source, predicate) => {\r\n function* iterator() {\r\n let index = 0;\r\n let skip = true;\r\n for (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (predicate(item, index) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const skipWhileAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return skipWhileAsync1(source, predicate);\r\n }\r\n else {\r\n return skipWhileAsync2(source, predicate);\r\n }\r\n};\r\nconst skipWhileAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n let skip = true;\r\n for (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (await predicate(item) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst skipWhileAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n let skip = true;\r\n for (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (await predicate(item, index) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n index++;\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","export const sum = (source, selector) => {\r\n if (selector) {\r\n return sum2(source, selector);\r\n }\r\n else {\r\n return sum1(source);\r\n }\r\n};\r\nconst sum1 = (source) => {\r\n let total = 0;\r\n for (const value of source) {\r\n total += value;\r\n }\r\n return total;\r\n};\r\nconst sum2 = (source, selector) => {\r\n let total = 0;\r\n for (const value of source) {\r\n total += selector(value);\r\n }\r\n return total;\r\n};\r\n","export const sumAsync = async (source, selector) => {\r\n let sum = 0;\r\n for (const value of source) {\r\n sum += await selector(value);\r\n }\r\n return sum;\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const take = (source, amount) => {\r\n function* iterator() {\r\n let amountLeft = amount > 0 ? amount : 0;\r\n for (const item of source) {\r\n if (amountLeft-- === 0) {\r\n break;\r\n }\r\n else {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const takeWhile = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return takeWhile1(source, predicate);\r\n }\r\n else {\r\n return takeWhile2(source, predicate);\r\n }\r\n};\r\nconst takeWhile1 = (source, predicate) => {\r\n function* iterator() {\r\n for (const item of source) {\r\n if (predicate(item)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst takeWhile2 = (source, predicate) => {\r\n function* iterator() {\r\n let index = 0;\r\n for (const item of source) {\r\n if (predicate(item, index++)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const takeWhileAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return takeWhileAsync1(source, predicate);\r\n }\r\n else {\r\n return takeWhileAsync2(source, predicate);\r\n }\r\n};\r\nconst takeWhileAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n for (const item of source) {\r\n if (await predicate(item)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\nconst takeWhileAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for (const item of source) {\r\n if (await predicate(item, index++)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","export const toArray = (source) => {\r\n return [...source];\r\n};\r\n","export const toMap = (source, selector) => {\r\n const map = new Map();\r\n for (const value of source) {\r\n const key = selector(value);\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","export const toMapAsync = async (source, selector) => {\r\n const map = new Map();\r\n for (const value of source) {\r\n const key = await selector(value);\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","export const toObject = (source, selector) => {\r\n const map = {};\r\n for (const value of source) {\r\n map[selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","export const toObjectAsync = async (source, selector) => {\r\n const map = {};\r\n for (const value of source) {\r\n map[await selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","export const toSet = (source) => {\r\n return new Set(source);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const union = (first, second, comparer) => {\r\n if (comparer) {\r\n return union2(first, second, comparer);\r\n }\r\n else {\r\n return union1(first, second);\r\n }\r\n};\r\nconst union1 = (first, second) => {\r\n function* iterator() {\r\n const set = new Set();\r\n for (const item of first) {\r\n if (set.has(item) === false) {\r\n yield item;\r\n set.add(item);\r\n }\r\n }\r\n for (const item of second) {\r\n if (set.has(item) === false) {\r\n yield item;\r\n set.add(item);\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst union2 = (first, second, comparer) => {\r\n function* iterator() {\r\n const result = [];\r\n for (const source of [first, second]) {\r\n for (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield value;\r\n result.push(value);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const unionAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const result = [];\r\n for (const source of [first, second]) {\r\n for (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (await comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield value;\r\n result.push(value);\r\n }\r\n }\r\n }\r\n }\r\n return fromAsync(iterator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const where = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return where1(source, predicate);\r\n }\r\n else {\r\n return where2(source, predicate);\r\n }\r\n};\r\nconst where1 = (source, predicate) => {\r\n function* iterator() {\r\n for (const item of source) {\r\n if (predicate(item) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst where2 = (source, predicate) => {\r\n function* iterator() {\r\n let i = 0;\r\n for (const item of source) {\r\n if (predicate(item, i++) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const whereAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return whereAsync1(source, predicate);\r\n }\r\n else {\r\n return whereAsync2(source, predicate);\r\n }\r\n};\r\nconst whereAsync1 = (source, predicate) => {\r\n async function* generator() {\r\n for (const item of source) {\r\n if (await predicate(item) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\nconst whereAsync2 = (source, predicate) => {\r\n async function* generator() {\r\n let i = 0;\r\n for (const item of source) {\r\n if (await predicate(item, i++) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { BasicEnumerable } from \"../BasicEnumerable.js\";\r\nexport const zip = (source, second, resultSelector) => {\r\n if (resultSelector) {\r\n return zip2(source, second, resultSelector);\r\n }\r\n else {\r\n return zip1(source, second);\r\n }\r\n};\r\nconst zip1 = (source, second) => {\r\n function* iterator() {\r\n const firstIterator = source[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n while (true) {\r\n const a = firstIterator.next();\r\n const b = secondIterator.next();\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield [a.value, b.value];\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\nconst zip2 = (source, second, resultSelector) => {\r\n function* iterator() {\r\n const firstIterator = source[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n while (true) {\r\n const a = firstIterator.next();\r\n const b = secondIterator.next();\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield resultSelector(a.value, b.value);\r\n }\r\n }\r\n }\r\n return new BasicEnumerable(iterator);\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const zipAsync = (first, second, resultSelector) => {\r\n async function* generator() {\r\n const firstIterator = first[Symbol.iterator]();\r\n const secondIterator = second[Symbol.iterator]();\r\n while (true) {\r\n const a = firstIterator.next();\r\n const b = secondIterator.next();\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield resultSelector(a.value, b.value);\r\n }\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","import { aggregate } from \"./../sync/_private/aggregate.js\";\r\nimport { all } from \"./../sync/_private/all.js\";\r\nimport { allAsync } from \"./../sync/_private/allAsync.js\";\r\nimport { any } from \"./../sync/_private/any.js\";\r\nimport { anyAsync } from \"./../sync/_private/anyAsync.js\";\r\nimport { asAsync } from \"./../sync/_private/asAsync.js\";\r\nimport { asParallel } from \"./../sync/_private/asParallel.js\";\r\nimport { average } from \"./../sync/_private/average.js\";\r\nimport { averageAsync } from \"./../sync/_private/averageAsync.js\";\r\nimport { chunk } from \"./../sync/_private/chunk.js\";\r\nimport { concatenate } from \"../sync/_private/concatenate.js\";\r\nimport { contains } from \"./../sync/_private/contains.js\";\r\nimport { containsAsync } from \"./../sync/_private/containsAsync.js\";\r\nimport { count } from \"./../sync/_private/count.js\";\r\nimport { countAsync } from \"./../sync/_private/countAsync.js\";\r\nimport { defaultIfEmpty } from \"../sync/_private/defaultIfEmpty.js\";\r\nimport { distinct } from \"./../sync/_private/distinct.js\";\r\nimport { distinctAsync } from \"./../sync/_private/distinctAsync.js\";\r\nimport { each } from \"./../sync/_private/each.js\";\r\nimport { eachAsync } from \"./../sync/_private/eachAsync.js\";\r\nimport { elementAt } from \"./../sync/_private/elementAt.js\";\r\nimport { elementAtOrDefault } from \"./../sync/_private/elementAtOrDefault.js\";\r\nimport { except } from \"./../sync/_private/except.js\";\r\nimport { exceptAsync } from \"./../sync/_private/exceptAsync.js\";\r\nimport { first } from \"./../sync/_private/first.js\";\r\nimport { firstAsync } from \"./../sync/_private/firstAsync.js\";\r\nimport { firstOrDefault } from \"./../sync/_private/firstOrDefault.js\";\r\nimport { firstOrDefaultAsync } from \"./../sync/_private/firstOrDefaultAsync.js\";\r\nimport { groupBy } from \"./../sync/_private/groupBy.js\";\r\nimport { groupByAsync } from \"./../sync/_private/groupByAsync.js\";\r\nimport { groupByWithSel } from \"./../sync/_private/groupByWithSel.js\";\r\nimport { groupJoin } from \"../sync/_private/groupJoin.js\";\r\nimport { groupJoinAsync } from \"../sync/_private/groupJoinAsync.js\";\r\nimport { intersect } from \"./../sync/_private/intersect.js\";\r\nimport { intersectAsync } from \"./../sync/_private/intersectAsync.js\";\r\nimport { join } from \"./../sync/_private/join.js\";\r\nimport { last } from \"./../sync/_private/last.js\";\r\nimport { lastAsync } from \"./../sync/_private/lastAsync.js\";\r\nimport { lastOrDefault } from \"./../sync/_private/lastOrDefault.js\";\r\nimport { lastOrDefaultAsync } from \"./../sync/_private/lastOrDefaultAsync.js\";\r\nimport { max } from \"./../sync/_private/max.js\";\r\nimport { maxAsync } from \"./../sync/_private/maxAsync.js\";\r\nimport { min } from \"./../sync/_private/min.js\";\r\nimport { minAsync } from \"./../sync/_private/minAsync.js\";\r\nimport { ofType } from \"./../sync/_private/ofType.js\";\r\nimport { orderBy } from \"./../sync/_private/orderBy.js\";\r\nimport { orderByAsync } from \"./../sync/_private/orderByAsync.js\";\r\nimport { orderByDescending } from \"./../sync/_private/orderByDescending.js\";\r\nimport { orderByDescendingAsync } from \"./../sync/_private/orderByDescendingAsync.js\";\r\nimport { partition } from \"./../sync/_private/partition.js\";\r\nimport { partitionAsync } from \"./../sync/_private/partitionAsync.js\";\r\nimport { reverse } from \"./../sync/_private/reverse.js\";\r\nimport { select } from \"./../sync/_private/select.js\";\r\nimport { selectAsync } from \"./../sync/_private/selectAsync.js\";\r\nimport { selectMany } from \"./../sync/_private/selectMany.js\";\r\nimport { selectManyAsync } from \"./../sync/_private/selectManyAsync.js\";\r\nimport { sequenceEquals } from \"./../sync/_private/sequenceEquals.js\";\r\nimport { sequenceEqualsAsync } from \"./../sync/_private/sequenceEqualsAsync.js\";\r\nimport { single } from \"./../sync/_private/single.js\";\r\nimport { singleAsync } from \"./../sync/_private/singleAsync.js\";\r\nimport { singleOrDefault } from \"./../sync/_private/singleOrDefault.js\";\r\nimport { singleOrDefaultAsync } from \"./../sync/_private/singleOrDefaultAsync.js\";\r\nimport { skip } from \"./../sync/_private/skip.js\";\r\nimport { skipWhile } from \"./../sync/_private/skipWhile.js\";\r\nimport { skipWhileAsync } from \"./../sync/_private/skipWhileAsync.js\";\r\nimport { sum } from \"./../sync/_private/sum.js\";\r\nimport { sumAsync } from \"./../sync/_private/sumAsync.js\";\r\nimport { take } from \"./../sync/_private/take.js\";\r\nimport { takeWhile } from \"./../sync/_private/takeWhile.js\";\r\nimport { takeWhileAsync } from \"./../sync/_private/takeWhileAsync.js\";\r\nimport { toArray } from \"./../sync/_private/toArray.js\";\r\nimport { toMap } from \"./../sync/_private/toMap.js\";\r\nimport { toMapAsync } from \"./../sync/_private/toMapAsync.js\";\r\nimport { toObject } from \"./../sync/_private/toObject.js\";\r\nimport { toObjectAsync } from \"./../sync/_private/toObjectAsync.js\";\r\nimport { toSet } from \"./../sync/_private/toSet.js\";\r\nimport { union } from \"./../sync/_private/union.js\";\r\nimport { unionAsync } from \"./../sync/_private/unionAsync.js\";\r\nimport { where } from \"./../sync/_private/where.js\";\r\nimport { whereAsync } from \"./../sync/_private/whereAsync.js\";\r\nimport { zip } from \"./../sync/_private/zip.js\";\r\nimport { zipAsync } from \"./../sync/_private/zipAsync.js\";\r\nexport const bindLinq = (object) => {\r\n const prototype = object.prototype;\r\n const bind = (func, key) => {\r\n const wrapped = function (...params) {\r\n return func(this, ...params);\r\n };\r\n Object.defineProperty(wrapped, \"length\", { value: func.length - 1 });\r\n prototype[key] = wrapped;\r\n };\r\n bind(aggregate, \"aggregate\");\r\n bind(all, \"all\");\r\n bind(allAsync, \"allAsync\");\r\n bind(any, \"any\");\r\n bind(anyAsync, \"anyAsync\");\r\n bind(asAsync, \"asAsync\");\r\n bind(asParallel, \"asParallel\");\r\n bind(average, \"average\");\r\n bind(averageAsync, \"averageAsync\");\r\n bind(chunk, \"chunk\");\r\n bind(concatenate, \"concatenate\");\r\n bind(contains, \"contains\");\r\n bind(containsAsync, \"containsAsync\");\r\n bind(count, \"count\");\r\n bind(countAsync, \"countAsync\");\r\n bind(defaultIfEmpty, \"defaultIfEmpty\");\r\n bind(distinct, \"distinct\");\r\n bind(distinctAsync, \"distinctAsync\");\r\n bind(each, \"each\");\r\n bind(eachAsync, \"eachAsync\");\r\n bind(elementAt, \"elementAt\");\r\n bind(elementAtOrDefault, \"elementAtOrDefault\");\r\n bind(except, \"except\");\r\n bind(exceptAsync, \"exceptAsync\");\r\n bind(first, \"first\");\r\n bind(firstAsync, \"firstAsync\");\r\n bind(firstOrDefault, \"firstOrDefault\");\r\n bind(firstOrDefaultAsync, \"firstOrDefaultAsync\");\r\n bind(groupBy, \"groupBy\");\r\n bind(groupByAsync, \"groupByAsync\");\r\n bind(groupByWithSel, \"groupByWithSel\");\r\n bind(groupJoin, \"groupJoin\");\r\n bind(groupJoinAsync, \"groupJoinAsync\");\r\n bind(intersect, \"intersect\");\r\n bind(intersectAsync, \"intersectAsync\");\r\n bind(join, \"joinByKey\");\r\n bind(last, \"last\");\r\n bind(lastAsync, \"lastAsync\");\r\n bind(lastOrDefault, \"lastOrDefault\");\r\n bind(lastOrDefaultAsync, \"lastOrDefaultAsync\");\r\n bind(max, \"max\");\r\n bind(maxAsync, \"maxAsync\");\r\n bind(min, \"min\");\r\n bind(minAsync, \"minAsync\");\r\n bind(ofType, \"ofType\");\r\n bind(orderBy, \"orderBy\");\r\n bind(orderByAsync, \"orderByAsync\");\r\n bind(orderByDescending, \"orderByDescending\");\r\n bind(orderByDescendingAsync, \"orderByDescendingAsync\");\r\n bind(reverse, \"reverse\");\r\n bind(select, \"select\");\r\n bind(selectAsync, \"selectAsync\");\r\n bind(selectMany, \"selectMany\");\r\n bind(selectManyAsync, \"selectManyAsync\");\r\n bind(sequenceEquals, \"sequenceEquals\");\r\n bind(sequenceEqualsAsync, \"sequenceEqualsAsync\");\r\n bind(single, \"single\");\r\n bind(singleAsync, \"singleAsync\");\r\n bind(singleOrDefault, \"singleOrDefault\");\r\n bind(singleOrDefaultAsync, \"singleOrDefaultAsync\");\r\n bind(skip, \"skip\");\r\n bind(skipWhile, \"skipWhile\");\r\n bind(skipWhileAsync, \"skipWhileAsync\");\r\n bind(sum, \"sum\");\r\n bind(sumAsync, \"sumAsync\");\r\n bind(take, \"take\");\r\n bind(takeWhile, \"takeWhile\");\r\n bind(takeWhileAsync, \"takeWhileAsync\");\r\n bind(toArray, \"toArray\");\r\n bind(toMap, \"toMap\");\r\n bind(toMapAsync, \"toMapAsync\");\r\n bind(toObject, \"toObject\");\r\n bind(toObjectAsync, \"toObjectAsync\");\r\n bind(partition, \"partition\");\r\n bind(partitionAsync, \"partitionAsync\");\r\n bind(toSet, \"toSet\");\r\n bind(union, \"union\");\r\n bind(unionAsync, \"unionAsync\");\r\n bind(where, \"where\");\r\n bind(whereAsync, \"whereAsync\");\r\n bind(zip, \"zip\");\r\n bind(zipAsync, \"zipAsync\");\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const aggregate = (source, seedOrFunc, func, resultSelector) => {\r\n if (resultSelector) {\r\n if (!func) {\r\n throw new ReferenceError(\"TAccumulate function is undefined\");\r\n }\r\n return aggregate3(source, seedOrFunc, func, resultSelector);\r\n }\r\n else if (func) {\r\n return aggregate2(source, seedOrFunc, func);\r\n }\r\n else {\r\n return aggregate1(source, seedOrFunc);\r\n }\r\n};\r\nconst aggregate1 = async (source, func) => {\r\n let aggregateValue;\r\n for await (const value of source) {\r\n if (aggregateValue) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n else {\r\n aggregateValue = value;\r\n }\r\n }\r\n if (aggregateValue === undefined) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate2 = async (source, seed, func) => {\r\n let aggregateValue = seed;\r\n for await (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate3 = async (source, seed, func, resultSelector) => {\r\n let aggregateValue = seed;\r\n for await (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return resultSelector(aggregateValue);\r\n};\r\n","export const all = async (source, predicate) => {\r\n for await (const item of source) {\r\n if (predicate(item) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const allAsync = async (source, predicate) => {\r\n for await (const item of source) {\r\n if (await predicate(item) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const any = (source, predicate) => {\r\n if (predicate) {\r\n return any2(source, predicate);\r\n }\r\n else {\r\n return any1(source);\r\n }\r\n};\r\nconst any1 = async (source) => {\r\n for await (const _ of source) {\r\n return true;\r\n }\r\n return false;\r\n};\r\nconst any2 = async (source, predicate) => {\r\n for await (const item of source) {\r\n if (predicate(item) === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const anyAsync = async (source, predicate) => {\r\n for await (const item of source) {\r\n if (await predicate(item) === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","import { fromParallel } from \"../../parallel/static/fromParallel.js\";\r\nexport const asParallel = (source) => {\r\n const generator = async () => {\r\n const data = [];\r\n for await (const value of source) {\r\n data.push(value);\r\n }\r\n return data;\r\n };\r\n return fromParallel(0, generator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const average = async (source, selector) => {\r\n let value = 0;\r\n let count = 0;\r\n if (selector) {\r\n for await (const item of source) {\r\n value = value + selector(item);\r\n count = count + 1;\r\n }\r\n }\r\n else {\r\n for await (const item of source) {\r\n value = value + item;\r\n count = count + 1;\r\n }\r\n }\r\n if (count === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return value / count;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const averageAsync = async (source, selector) => {\r\n let value = 0;\r\n let count = 0;\r\n for await (const item of source) {\r\n value = value + await selector(item);\r\n count = count + 1;\r\n }\r\n if (count === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return value / count;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nimport { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const chunk = (source, size) => {\r\n if (size < 1) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n async function* iterator() {\r\n let yieldChunk = [];\r\n for await (const value of source) {\r\n yieldChunk.push(value);\r\n if (yieldChunk.length === size) {\r\n yield yieldChunk;\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n yield yieldChunk;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const concatenate = (first, second) => {\r\n async function* iterator() {\r\n yield* first;\r\n yield* second;\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const contains = async (source, value, comparer = StrictEqualityComparer) => {\r\n for await (const item of source) {\r\n if (comparer(value, item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const containsAsync = async (source, value, comparer) => {\r\n for await (const item of source) {\r\n if (await comparer(value, item)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n","export const count = (source, predicate) => {\r\n if (predicate) {\r\n return count2(source, predicate);\r\n }\r\n else {\r\n return count1(source);\r\n }\r\n};\r\nconst count1 = async (source) => {\r\n let total = 0;\r\n for await (const _ of source) {\r\n total++;\r\n }\r\n return total;\r\n};\r\nconst count2 = async (source, predicate) => {\r\n let total = 0;\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n total++;\r\n }\r\n }\r\n return total;\r\n};\r\n","export const countAsync = async (source, predicate) => {\r\n let count = 0;\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const defaultIfEmpty = (source, defaultValue) => {\r\n async function* generator() {\r\n let found = false;\r\n for await (const value of source) {\r\n found = true;\r\n yield value;\r\n }\r\n if (!found) {\r\n yield defaultValue;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const distinct = (source, comparer = StrictEqualityComparer) => {\r\n async function* iterator() {\r\n const distinctElements = [];\r\n for await (const item of source) {\r\n const foundItem = distinctElements.find((x) => comparer(x, item));\r\n if (!foundItem) {\r\n distinctElements.push(item);\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const distinctAsync = (source, comparer) => {\r\n async function* iterator() {\r\n const distinctElements = [];\r\n outerLoop: for await (const item of source) {\r\n for (const distinctElement of distinctElements) {\r\n const found = await comparer(distinctElement, item);\r\n if (found) {\r\n continue outerLoop;\r\n }\r\n }\r\n distinctElements.push(item);\r\n yield item;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const each = (source, action) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n action(value);\r\n yield value;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const eachAsync = (source, action) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n await action(value);\r\n yield value;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const elementAt = async (source, index) => {\r\n if (index < 0) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n let i = 0;\r\n for await (const item of source) {\r\n if (index === i++) {\r\n return item;\r\n }\r\n }\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n};\r\n","export const elementAtOrDefault = async (source, index) => {\r\n let i = 0;\r\n for await (const item of source) {\r\n if (index === i++) {\r\n return item;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const except = (first, second, comparer = StrictEqualityComparer) => {\r\n async function* iterator() {\r\n const secondArray = [];\r\n for await (const x of second) {\r\n secondArray.push(x);\r\n }\r\n for await (const firstItem of first) {\r\n let exists = false;\r\n for (let j = 0; j < secondArray.length; j++) {\r\n const secondItem = secondArray[j];\r\n if (comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield firstItem;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const exceptAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const secondArray = [];\r\n for await (const x of second) {\r\n secondArray.push(x);\r\n }\r\n for await (const firstItem of first) {\r\n let exists = false;\r\n for (let j = 0; j < secondArray.length; j++) {\r\n const secondItem = secondArray[j];\r\n if (await comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield firstItem;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const first = (source, predicate) => {\r\n if (predicate) {\r\n return first2(source, predicate);\r\n }\r\n else {\r\n return first1(source);\r\n }\r\n};\r\nconst first1 = async (source) => {\r\n const firstElement = await source[Symbol.asyncIterator]().next();\r\n if (firstElement.done === true) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return firstElement.value;\r\n};\r\nconst first2 = async (source, predicate) => {\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const firstAsync = async (source, predicate) => {\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","export const firstOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return firstOrDefault2(source, predicate);\r\n }\r\n else {\r\n return firstOrDefault1(source);\r\n }\r\n};\r\nconst firstOrDefault1 = async (source) => {\r\n const first = await source[Symbol.asyncIterator]().next();\r\n return first.value || null;\r\n};\r\nconst firstOrDefault2 = async (source, predicate) => {\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","export const firstOrDefaultAsync = async (source, predicate) => {\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupBy = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupBy_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupBy_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupBy_0 = (source, keySelector, comparer) => {\r\n async function* generate() {\r\n const keyMap = new Array();\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n for (const g of keyMap) {\r\n yield g;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generate);\r\n};\r\nconst groupBy_0_Simple = (source, keySelector) => {\r\n async function* iterator() {\r\n const keyMap = {};\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupByAsync = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupByAsync_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupByAsync_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupByAsync_0_Simple = (source, keySelector) => {\r\n async function* iterator() {\r\n const keyMap = {};\r\n for await (const value of source) {\r\n const key = await keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst groupByAsync_0 = (source, keySelector, comparer) => {\r\n async function* generate() {\r\n const keyMap = new Array();\r\n for await (const value of source) {\r\n const key = await keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (await comparer(group.key, key) === true) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n for (const keyValue of keyMap) {\r\n yield keyValue;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generate);\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupByWithSel = (source, keySelector, elementSelector, comparer) => {\r\n if (comparer) {\r\n return groupBy1(source, keySelector, elementSelector, comparer);\r\n }\r\n else {\r\n return groupBy1Simple(source, keySelector, elementSelector);\r\n }\r\n};\r\nconst groupBy1Simple = (source, keySelector, elementSelector) => {\r\n async function* generate() {\r\n const keyMap = {};\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n const element = elementSelector(value);\r\n if (grouping) {\r\n grouping.push(element);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, element);\r\n }\r\n }\r\n for (const value in keyMap) {\r\n yield keyMap[value];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generate);\r\n};\r\nconst groupBy1 = (source, keySelector, elementSelector, comparer) => {\r\n async function* generate() {\r\n const keyMap = new Array();\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(elementSelector(value));\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n const element = elementSelector(value);\r\n keyMap.push(new Grouping(key, element));\r\n }\r\n }\r\n for (const value of keyMap) {\r\n yield value;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generate);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupJoin = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicAsyncEnumerable(generator);\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = [];\r\n for await (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n for await (const outerValue of outer) {\r\n const key = outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n yield resultSelector(outerValue, innerRecord.values);\r\n }\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = new Map();\r\n for await (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n for await (const outerValue of outer) {\r\n const key = outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n yield resultSelector(outerValue, values);\r\n }\r\n };\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const groupJoinAsync = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicAsyncEnumerable(generator);\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = [];\r\n for await (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n for await (const outerValue of outer) {\r\n const key = await outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n yield resultSelector(outerValue, innerRecord.values);\r\n }\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async function* () {\r\n var _a;\r\n const innerKeyMap = new Map();\r\n for await (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n for await (const outerValue of outer) {\r\n const key = await outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n yield resultSelector(outerValue, values);\r\n }\r\n };\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const intersect = (first, second, comparer = StrictEqualityComparer) => {\r\n async function* iterator() {\r\n const firstResults = await first.distinct(comparer).toArray();\r\n if (firstResults.length === 0) {\r\n return;\r\n }\r\n const secondResults = await second.toArray();\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (comparer(firstValue, secondValue) === true) {\r\n yield firstValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const intersectAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const firstResults = await first.distinctAsync(comparer).toArray();\r\n if (firstResults.length === 0) {\r\n return;\r\n }\r\n const secondResults = await second.toArray();\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (await comparer(firstValue, secondValue) === true) {\r\n yield firstValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const join = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer = StrictEqualityComparer) => {\r\n async function* iterator() {\r\n const innerArray = [];\r\n for await (const i of inner) {\r\n innerArray.push(i);\r\n }\r\n for await (const o of outer) {\r\n const outerKey = outerKeySelector(o);\r\n for (const i of innerArray) {\r\n const innerKey = innerKeySelector(i);\r\n if (comparer(outerKey, innerKey) === true) {\r\n yield resultSelector(o, i);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const last = (source, predicate) => {\r\n if (predicate) {\r\n return last2(source, predicate);\r\n }\r\n else {\r\n return last1(source);\r\n }\r\n};\r\nconst last1 = async (source) => {\r\n let lastItem = null;\r\n for await (const value of source) {\r\n lastItem = value;\r\n }\r\n if (!lastItem) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return lastItem;\r\n};\r\nconst last2 = async (source, predicate) => {\r\n let lastItem = null;\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n lastItem = value;\r\n }\r\n }\r\n if (!lastItem) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return lastItem;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const lastAsync = async (source, predicate) => {\r\n let last = null;\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n if (!last) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return last;\r\n};\r\n","export const lastOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return lastOrDefault2(source, predicate);\r\n }\r\n else {\r\n return lastOrDefault1(source);\r\n }\r\n};\r\nconst lastOrDefault1 = async (source) => {\r\n let last = null;\r\n for await (const value of source) {\r\n last = value;\r\n }\r\n return last;\r\n};\r\nconst lastOrDefault2 = async (source, predicate) => {\r\n let last = null;\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n return last;\r\n};\r\n","export const lastOrDefaultAsync = async (source, predicate) => {\r\n let last = null;\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n last = value;\r\n }\r\n }\r\n return last;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const max = (source, selector) => {\r\n if (selector) {\r\n return max2(source, selector);\r\n }\r\n else {\r\n return max1(source);\r\n }\r\n};\r\nconst max1 = async (source) => {\r\n let maxItem = null;\r\n for await (const item of source) {\r\n maxItem = Math.max(maxItem || Number.NEGATIVE_INFINITY, item);\r\n }\r\n if (maxItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return maxItem;\r\n }\r\n};\r\nconst max2 = async (source, selector) => {\r\n let maxItem = null;\r\n for await (const item of source) {\r\n maxItem = Math.max(maxItem || Number.NEGATIVE_INFINITY, selector(item));\r\n }\r\n if (maxItem === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return maxItem;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const maxAsync = async (source, selector) => {\r\n let max = null;\r\n for await (const item of source) {\r\n max = Math.max(max || Number.NEGATIVE_INFINITY, await selector(item));\r\n }\r\n if (max === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return max;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const min = (source, selector) => {\r\n if (selector) {\r\n return min2(source, selector);\r\n }\r\n else {\r\n return min1(source);\r\n }\r\n};\r\nconst min1 = async (source) => {\r\n let minValue = null;\r\n for await (const item of source) {\r\n minValue = Math.min(minValue || Number.POSITIVE_INFINITY, item);\r\n }\r\n if (minValue === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return minValue;\r\n }\r\n};\r\nconst min2 = async (source, selector) => {\r\n let minValue = null;\r\n for await (const item of source) {\r\n minValue = Math.min(minValue || Number.POSITIVE_INFINITY, selector(item));\r\n }\r\n if (minValue === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return minValue;\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const minAsync = async (source, selector) => {\r\n let min = null;\r\n for await (const item of source) {\r\n min = Math.min(min || Number.POSITIVE_INFINITY, await selector(item));\r\n }\r\n if (min === null) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return min;\r\n }\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const ofType = (source, type) => {\r\n const typeCheck = typeof type === \"string\" ?\r\n ((x) => typeof x === type) :\r\n ((x) => x instanceof type);\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (typeCheck(item)) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../OrderedAsyncEnumerable.js\";\r\nexport const orderBy = (source, keySelector, comparer) => {\r\n return OrderedAsyncEnumerable.generate(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../OrderedAsyncEnumerable.js\";\r\nexport const orderByAsync = (source, keySelector, comparer) => {\r\n return OrderedAsyncEnumerable.generateAsync(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../OrderedAsyncEnumerable.js\";\r\nexport const orderByDescending = (source, keySelector, comparer) => {\r\n return OrderedAsyncEnumerable.generate(source, keySelector, false, comparer);\r\n};\r\n","import { OrderedAsyncEnumerable } from \"../OrderedAsyncEnumerable.js\";\r\nexport const orderByDescendingAsync = (source, keySelector, comparer) => {\r\n return OrderedAsyncEnumerable.generateAsync(source, keySelector, false, comparer);\r\n};\r\n","export const partition = async (source, predicate) => {\r\n const fail = [];\r\n const pass = [];\r\n for await (const value of source) {\r\n if (predicate(value) === true) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","export const partitionAsync = async (source, predicate) => {\r\n const fail = [];\r\n const pass = [];\r\n for await (const value of source) {\r\n if (await predicate(value) === true) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const reverse = (source) => {\r\n async function* iterator() {\r\n const values = [];\r\n for await (const value of source) {\r\n values.push(value);\r\n }\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n yield values[i];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const select = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n return select1(source, selector);\r\n }\r\n else {\r\n return select2(source, selector);\r\n }\r\n }\r\n else {\r\n return select3(source, selector);\r\n }\r\n};\r\nconst select1 = (source, selector) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n yield selector(value);\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst select2 = (source, selector) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for await (const value of source) {\r\n yield selector(value, index);\r\n index++;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst select3 = (source, key) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n yield value[key];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const selectAsync = (source, selector) => {\r\n if (typeof selector === \"string\") {\r\n return selectAsync2(source, selector);\r\n }\r\n else {\r\n return selectAsync1(source, selector);\r\n }\r\n};\r\nconst selectAsync1 = (source, selector) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n yield selector(value);\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst selectAsync2 = (source, key) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n yield value[key];\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const selectMany = (source, selector) => {\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n return selectMany1(source, selector);\r\n }\r\n else {\r\n return selectMany2(source, selector);\r\n }\r\n }\r\n else {\r\n return selectMany3(source, selector);\r\n }\r\n};\r\nconst selectMany1 = (source, selector) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n for (const selectorValue of selector(value)) {\r\n yield selectorValue;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst selectMany2 = (source, selector) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for await (const value of source) {\r\n for (const selectorValue of selector(value, index)) {\r\n yield selectorValue;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst selectMany3 = (source, selector) => {\r\n async function* iterator() {\r\n for await (const value of source) {\r\n for (const selectorValue of value[selector]) {\r\n yield selectorValue;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const selectManyAsync = (source, selector) => {\r\n if (selector.length === 1) {\r\n const iterator = async function* () {\r\n for await (const value of source) {\r\n const many = await selector(value);\r\n for (const innerValue of many) {\r\n yield innerValue;\r\n }\r\n }\r\n };\r\n return new BasicAsyncEnumerable(iterator);\r\n }\r\n else {\r\n const iterator = async function* () {\r\n let index = 0;\r\n for await (const value of source) {\r\n const many = await selector(value, index);\r\n for (const innerValue of many) {\r\n yield innerValue;\r\n }\r\n index++;\r\n }\r\n };\r\n return new BasicAsyncEnumerable(iterator);\r\n }\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const sequenceEquals = async (first, second, comparer = StrictEqualityComparer) => {\r\n const firstIterator = first[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n let results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n let firstResult = results[0];\r\n let secondResult = results[1];\r\n while (!firstResult.done && !secondResult.done) {\r\n if (!comparer(firstResult.value, secondResult.value)) {\r\n return false;\r\n }\r\n results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n firstResult = results[0];\r\n secondResult = results[1];\r\n }\r\n return firstResult.done === true && secondResult.done === true;\r\n};\r\n","export const sequenceEqualsAsync = async (first, second, comparer) => {\r\n const firstIterator = first[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n let results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n let firstResult = results[0];\r\n let secondResult = results[1];\r\n while (!firstResult.done && !secondResult.done) {\r\n if (await comparer(firstResult.value, secondResult.value) === false) {\r\n return false;\r\n }\r\n results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n firstResult = results[0];\r\n secondResult = results[1];\r\n }\r\n return firstResult.done === true && secondResult.done === true;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const single = (source, predicate) => {\r\n if (predicate) {\r\n return single2(source, predicate);\r\n }\r\n else {\r\n return single1(source);\r\n }\r\n};\r\nconst single1 = async (source) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return singleValue;\r\n};\r\nconst single2 = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleAsync = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (await predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return singleOrDefault2(source, predicate);\r\n }\r\n else {\r\n return singleOrDefault1(source);\r\n }\r\n};\r\nconst singleOrDefault1 = async (source) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n return singleValue;\r\n};\r\nconst singleOrDefault2 = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const singleOrDefaultAsync = async (source, predicate) => {\r\n let hasValue = false;\r\n let singleValue = null;\r\n for await (const value of source) {\r\n if (await predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const skip = (source, count) => {\r\n async function* iterator() {\r\n let i = 0;\r\n for await (const item of source) {\r\n if (i++ >= count) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const skipWhile = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return skipWhile1(source, predicate);\r\n }\r\n else {\r\n return skipWhile2(source, predicate);\r\n }\r\n};\r\nconst skipWhile1 = (source, predicate) => {\r\n async function* iterator() {\r\n let skip = true;\r\n for await (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (predicate(item) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst skipWhile2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n let skip = true;\r\n for await (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (predicate(item, index) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const skipWhileAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return skipWhileAsync1(source, predicate);\r\n }\r\n else {\r\n return skipWhileAsync2(source, predicate);\r\n }\r\n};\r\nconst skipWhileAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n let skip = true;\r\n for await (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (await predicate(item) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst skipWhileAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n let skip = true;\r\n for await (const item of source) {\r\n if (skip === false) {\r\n yield item;\r\n }\r\n else if (await predicate(item, index) === false) {\r\n skip = false;\r\n yield item;\r\n }\r\n index++;\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","export const sum = (source, selector) => {\r\n if (selector) {\r\n return sum2(source, selector);\r\n }\r\n else {\r\n return sum1(source);\r\n }\r\n};\r\nconst sum1 = async (source) => {\r\n let total = 0;\r\n for await (const value of source) {\r\n total += value;\r\n }\r\n return total;\r\n};\r\nconst sum2 = async (source, selector) => {\r\n let total = 0;\r\n for await (const value of source) {\r\n total += selector(value);\r\n }\r\n return total;\r\n};\r\n","export const sumAsync = async (source, selector) => {\r\n let sum = 0;\r\n for await (const value of source) {\r\n sum += await selector(value);\r\n }\r\n return sum;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const take = (source, amount) => {\r\n async function* iterator() {\r\n let amountLeft = amount > 0 ? amount : 0;\r\n for await (const item of source) {\r\n if (amountLeft-- === 0) {\r\n break;\r\n }\r\n else {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const takeWhile = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return takeWhile1(source, predicate);\r\n }\r\n else {\r\n return takeWhile2(source, predicate);\r\n }\r\n};\r\nconst takeWhile1 = (source, predicate) => {\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (predicate(item)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst takeWhile2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for await (const item of source) {\r\n if (predicate(item, index++)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const takeWhileAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return takeWhileAsync1(source, predicate);\r\n }\r\n else {\r\n return takeWhileAsync2(source, predicate);\r\n }\r\n};\r\nconst takeWhileAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (await predicate(item)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst takeWhileAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let index = 0;\r\n for await (const item of source) {\r\n if (await predicate(item, index++)) {\r\n yield item;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","export const toArray = async (source) => {\r\n const array = [];\r\n for await (const item of source) {\r\n array.push(item);\r\n }\r\n return array;\r\n};\r\n","export const toMap = async (source, selector) => {\r\n const map = new Map();\r\n for await (const value of source) {\r\n const key = selector(value);\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","export const toMapAsync = async (source, selector) => {\r\n const map = new Map();\r\n for await (const value of source) {\r\n const key = await selector(value);\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","export const toObject = async (source, selector) => {\r\n const map = {};\r\n for await (const value of source) {\r\n map[selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","export const toObjectAsync = async (source, selector) => {\r\n const map = {};\r\n for await (const value of source) {\r\n map[await selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","export const toSet = async (source) => {\r\n const set = new Set();\r\n for await (const item of source) {\r\n set.add(item);\r\n }\r\n return set;\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const union = (first, second, comparer) => {\r\n if (comparer) {\r\n return union2(first, second, comparer);\r\n }\r\n else {\r\n return union1(first, second);\r\n }\r\n};\r\nconst union1 = (first, second) => {\r\n async function* iterator() {\r\n const set = new Set();\r\n for await (const item of first) {\r\n if (set.has(item) === false) {\r\n yield item;\r\n set.add(item);\r\n }\r\n }\r\n for await (const item of second) {\r\n if (set.has(item) === false) {\r\n yield item;\r\n set.add(item);\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst union2 = (first, second, comparer) => {\r\n async function* iterator() {\r\n const result = [];\r\n for (const source of [first, second]) {\r\n for await (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield value;\r\n result.push(value);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const unionAsync = (first, second, comparer) => {\r\n async function* iterator() {\r\n const result = [];\r\n for (const source of [first, second]) {\r\n for await (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (await comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n yield value;\r\n result.push(value);\r\n }\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const where = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return where1(source, predicate);\r\n }\r\n else {\r\n return where2(source, predicate);\r\n }\r\n};\r\nconst where1 = (source, predicate) => {\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (predicate(item) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst where2 = (source, predicate) => {\r\n async function* iterator() {\r\n let i = 0;\r\n for await (const item of source) {\r\n if (predicate(item, i++) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const whereAsync = (source, predicate) => {\r\n if (predicate.length === 1) {\r\n return whereAsync1(source, predicate);\r\n }\r\n else {\r\n return whereAsync2(source, predicate);\r\n }\r\n};\r\nconst whereAsync1 = (source, predicate) => {\r\n async function* iterator() {\r\n for await (const item of source) {\r\n if (await predicate(item) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst whereAsync2 = (source, predicate) => {\r\n async function* iterator() {\r\n let i = 0;\r\n for await (const item of source) {\r\n if (await predicate(item, i++) === true) {\r\n yield item;\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const zip = (first, second, resultSelector) => {\r\n if (resultSelector) {\r\n return zip2(first, second, resultSelector);\r\n }\r\n else {\r\n return zip1(first, second);\r\n }\r\n};\r\nconst zip1 = (source, second) => {\r\n async function* iterator() {\r\n const firstIterator = source[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n while (true) {\r\n const [a, b] = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield [a.value, b.value];\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\nconst zip2 = (source, second, resultSelector) => {\r\n async function* iterator() {\r\n const firstIterator = source[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n while (true) {\r\n const [a, b] = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n if (a.done || b.done) {\r\n break;\r\n }\r\n else {\r\n yield resultSelector(a.value, b.value);\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(iterator);\r\n};\r\n","import { BasicAsyncEnumerable } from \"../BasicAsyncEnumerable.js\";\r\nexport const zipAsync = (first, second, resultSelector) => {\r\n async function* generator() {\r\n const firstIterator = first[Symbol.asyncIterator]();\r\n const secondIterator = second[Symbol.asyncIterator]();\r\n while (true) {\r\n const results = await Promise.all([firstIterator.next(), secondIterator.next()]);\r\n const firstNext = results[0];\r\n const secondNext = results[1];\r\n if (firstNext.done || secondNext.done) {\r\n break;\r\n }\r\n else {\r\n yield resultSelector(firstNext.value, secondNext.value);\r\n }\r\n }\r\n }\r\n return new BasicAsyncEnumerable(generator);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const aggregate = (source, seedOrFunc, func, resultSelector) => {\r\n if (resultSelector) {\r\n if (!func) {\r\n throw new ReferenceError(\"TAccumulate function is undefined\");\r\n }\r\n return aggregate3(source, seedOrFunc, func, resultSelector);\r\n }\r\n else if (func) {\r\n return aggregate2(source, seedOrFunc, func);\r\n }\r\n else {\r\n return aggregate1(source, seedOrFunc);\r\n }\r\n};\r\nconst aggregate1 = async (source, func) => {\r\n let aggregateValue;\r\n for await (const value of source) {\r\n if (aggregateValue) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n else {\r\n aggregateValue = value;\r\n }\r\n }\r\n if (aggregateValue === undefined) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate2 = async (source, seed, func) => {\r\n let aggregateValue = seed;\r\n for await (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return aggregateValue;\r\n};\r\nconst aggregate3 = async (source, seed, func, resultSelector) => {\r\n let aggregateValue = seed;\r\n for await (const value of source) {\r\n aggregateValue = func(aggregateValue, value);\r\n }\r\n return resultSelector(aggregateValue);\r\n};\r\n","export const nextIteration = (source, onfulfilled) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = () => dataFunc.generator().then((x) => {\r\n const convValues = new Array(x.length);\r\n for (let i = 0; i < x.length; i++) {\r\n convValues[i] = onfulfilled(x[i]);\r\n }\r\n return convValues;\r\n });\r\n return {\r\n generator,\r\n type: 0,\r\n };\r\n }\r\n case 1: {\r\n const generator = () => {\r\n const previousData = dataFunc.generator();\r\n const newPromises = new Array(previousData.length);\r\n for (let i = 0; i < previousData.length; i++) {\r\n newPromises[i] = previousData[i].then(onfulfilled);\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 1,\r\n };\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const previousData = await dataFunc.generator();\r\n const newPromises = new Array(previousData.length);\r\n for (let i = 0; i < previousData.length; i++) {\r\n newPromises[i] = previousData[i].then(onfulfilled);\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n }\r\n};\r\n","import { nextIteration } from \"./_nextIteration.js\";\r\nexport const all = (source, predicate) => {\r\n const nextIter = nextIteration(source, (x) => {\r\n if (!predicate(x)) {\r\n throw new Error(String(false));\r\n }\r\n return true;\r\n });\r\n switch (nextIter.type) {\r\n case 0:\r\n return nextIter.generator()\r\n .then(() => true, () => false);\r\n case 1:\r\n return Promise.all(nextIter.generator())\r\n .then(() => true, () => false);\r\n case 2:\r\n return nextIter.generator()\r\n .then(Promise.all.bind(Promise))\r\n .then(() => true, () => false);\r\n }\r\n};\r\n","export const nextIterationAsync = (source, onfulfilled) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = async () => {\r\n const results = await dataFunc.generator();\r\n const newPromises = new Array(results.length);\r\n for (let i = 0; i < results.length; i++) {\r\n newPromises[i] = onfulfilled(results[i]);\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n case 1: {\r\n const generator = () => {\r\n const promises = dataFunc.generator();\r\n return promises.map(async (promise) => {\r\n const value = await promise;\r\n return await onfulfilled(value);\r\n });\r\n };\r\n return {\r\n generator,\r\n type: 1,\r\n };\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const promises = await dataFunc.generator();\r\n return promises.map((promise) => promise.then(onfulfilled));\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n }\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const allAsync = (source, predicate) => {\r\n const nextIter = nextIterationAsync(source, async (x) => {\r\n if (await predicate(x) === false) {\r\n throw new Error(String(false));\r\n }\r\n return true;\r\n });\r\n switch (nextIter.type) {\r\n case 1:\r\n return Promise.all(nextIter.generator())\r\n .then(() => true, () => false);\r\n case 2:\r\n return nextIter.generator()\r\n .then(Promise.all.bind(Promise))\r\n .then(() => true, () => false);\r\n }\r\n};\r\n","import { nextIteration } from \"./_nextIteration.js\";\r\nexport const any = (source, predicate) => {\r\n if (predicate) {\r\n return any2(source, predicate);\r\n }\r\n else {\r\n return any1(source);\r\n }\r\n};\r\nconst any1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n let values;\r\n switch (dataFunc.type) {\r\n case 1:\r\n values = dataFunc.generator();\r\n return values.length !== 0;\r\n case 0:\r\n case 2:\r\n values = await dataFunc.generator();\r\n return values.length !== 0;\r\n }\r\n};\r\nconst any2 = async (source, predicate) => {\r\n const dataFunc = nextIteration(source, predicate);\r\n let values;\r\n switch (dataFunc.type) {\r\n case 0:\r\n values = await dataFunc.generator();\r\n return values.includes(true);\r\n case 1:\r\n values = await Promise.all(dataFunc.generator());\r\n return values.includes(true);\r\n case 2:\r\n values = await Promise.all(await dataFunc.generator());\r\n return values.includes(true);\r\n }\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const anyAsync = async (source, predicate) => {\r\n const nextIter = nextIterationAsync(source, predicate);\r\n let promises;\r\n switch (nextIter.type) {\r\n case 1:\r\n promises = nextIter.generator();\r\n if (promises.length === 0) {\r\n return false;\r\n }\r\n return new Promise((resolve, reject) => {\r\n let resolvedCount = 0;\r\n for (const promise of promises) {\r\n promise.then(value => {\r\n resolvedCount++;\r\n if (value) {\r\n resolve(true);\r\n }\r\n else if (resolvedCount === promises.length) {\r\n resolve(false);\r\n }\r\n }, reject);\r\n }\r\n });\r\n case 2:\r\n promises = await nextIter.generator();\r\n if (Promise.length === 0) {\r\n return false;\r\n }\r\n const values = await Promise.all(promises);\r\n return values.includes(true);\r\n }\r\n};\r\n","import { fromAsync } from \"../../async/static/fromAsync.js\";\r\nexport const asAsync = (source) => {\r\n async function* generator() {\r\n for await (const value of source) {\r\n yield value;\r\n }\r\n }\r\n return fromAsync(generator);\r\n};\r\n","export const typeDataToArray = async (dataFunc) => {\r\n switch (dataFunc.type) {\r\n case 0:\r\n return await dataFunc.generator();\r\n case 1:\r\n return await Promise.all(dataFunc.generator());\r\n case 2:\r\n const data = await dataFunc.generator();\r\n return await Promise.all(data);\r\n }\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const average = async (source, selector) => {\r\n let data;\r\n if (selector) {\r\n data = nextIteration(source, selector);\r\n }\r\n else {\r\n data = source.dataFunc;\r\n }\r\n const values = await typeDataToArray(data);\r\n if (values.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n let sum = 0;\r\n for (const item of values) {\r\n sum += item;\r\n }\r\n return sum / values.length;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const averageAsync = async (source, selector) => {\r\n const nextIter = nextIterationAsync(source, selector);\r\n const values = await typeDataToArray(nextIter);\r\n if (values.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n let value = 0;\r\n for (const selectedValue of values) {\r\n value += selectedValue;\r\n }\r\n return value / values.length;\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const chunk = (source, size) => {\r\n if (size < 1) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n let dataFunc;\r\n switch (source.dataFunc.type) {\r\n case 1:\r\n const arrayOfPromises = source.dataFunc.generator;\r\n dataFunc = {\r\n type: 1,\r\n generator: () => {\r\n const chunks = [];\r\n let yieldChunk = [];\r\n for (const promise of arrayOfPromises()) {\r\n yieldChunk.push(promise);\r\n if (yieldChunk.length === size) {\r\n chunks.push(Promise.all(yieldChunk));\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n chunks.push(Promise.all(yieldChunk));\r\n }\r\n return chunks;\r\n }\r\n };\r\n break;\r\n case 2:\r\n const promiseOfPromises = source.dataFunc.generator;\r\n dataFunc = {\r\n type: 2,\r\n generator: async () => {\r\n const chunks = [];\r\n let yieldChunk = [];\r\n for (const promise of await promiseOfPromises()) {\r\n yieldChunk.push(promise);\r\n if (yieldChunk.length === size) {\r\n chunks.push(Promise.all(yieldChunk));\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n chunks.push(Promise.all(yieldChunk));\r\n }\r\n return chunks;\r\n }\r\n };\r\n break;\r\n case 0:\r\n const promiseToArray = source.dataFunc.generator;\r\n dataFunc = {\r\n type: 0,\r\n generator: async () => {\r\n const chunks = [];\r\n let yieldChunk = [];\r\n for (const value of await promiseToArray()) {\r\n yieldChunk.push(value);\r\n if (yieldChunk.length === size) {\r\n chunks.push(yieldChunk);\r\n yieldChunk = [];\r\n }\r\n }\r\n if (yieldChunk.length) {\r\n chunks.push(yieldChunk);\r\n }\r\n return chunks;\r\n }\r\n };\r\n break;\r\n }\r\n return new BasicParallelEnumerable(dataFunc);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const concatenate = (first, second) => {\r\n const generator = async () => {\r\n const [firstData, secondData] = await Promise.all([first.toArray(), second.toArray()]);\r\n return [...firstData, ...secondData];\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nexport const contains = async (source, value, comparer = StrictEqualityComparer) => {\r\n let values;\r\n if (comparer) {\r\n values = nextIteration(source, (x) => comparer(value, x));\r\n }\r\n else {\r\n values = nextIteration(source, (x) => x === value);\r\n }\r\n switch (values.type) {\r\n case 0: {\r\n const data = await values.generator();\r\n return data.some((x) => x);\r\n }\r\n case 1: {\r\n const data = await Promise.all(values.generator());\r\n return data.some((x) => x);\r\n }\r\n case 2: {\r\n const data = await Promise.all(await values.generator());\r\n return data.some((x) => x);\r\n }\r\n }\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const containsAsync = async (source, value, comparer) => {\r\n const values = nextIterationAsync(source, (x) => comparer(value, x));\r\n switch (values.type) {\r\n case 1: {\r\n const data = await Promise.all(values.generator());\r\n return data.some((x) => x);\r\n }\r\n case 2: {\r\n const data = await Promise.all(await values.generator());\r\n return data.some((x) => x);\r\n }\r\n }\r\n};\r\n","export const count = (source, predicate) => {\r\n if (predicate) {\r\n return count2(source, predicate);\r\n }\r\n else {\r\n return count1(source);\r\n }\r\n};\r\nconst count1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0:\r\n case 2:\r\n const arrayData = await source.toArray();\r\n return arrayData.length;\r\n case 1:\r\n const promises = dataFunc.generator();\r\n return promises.length;\r\n }\r\n};\r\nconst count2 = async (source, predicate) => {\r\n const values = await source.toArray();\r\n let totalCount = 0;\r\n for (let i = 0; i < values.length; i++) {\r\n if (predicate(values[i]) === true) {\r\n totalCount++;\r\n }\r\n }\r\n return totalCount;\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const countAsync = async (source, predicate) => {\r\n const data = nextIterationAsync(source, predicate);\r\n let countPromise;\r\n switch (data.type) {\r\n case 1:\r\n countPromise = Promise.all(data.generator());\r\n break;\r\n case 2:\r\n countPromise = Promise.all(await data.generator());\r\n break;\r\n }\r\n let totalCount = 0;\r\n for (const value of await countPromise) {\r\n if (value) {\r\n totalCount++;\r\n }\r\n }\r\n return totalCount;\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const defaultIfEmpty = (source, defaultValue) => {\r\n const dataFunc = source.dataFunc;\r\n const isPromise = defaultValue instanceof Promise;\r\n let typeData;\r\n switch (dataFunc.type) {\r\n case 0:\r\n {\r\n const generator = () => dataFunc\r\n .generator()\r\n .then((values) => {\r\n if (values.length) {\r\n return values;\r\n }\r\n if (isPromise) {\r\n return defaultValue.then(value => [value]);\r\n }\r\n else {\r\n return [defaultValue];\r\n }\r\n });\r\n typeData = {\r\n generator,\r\n type: dataFunc.type\r\n };\r\n }\r\n break;\r\n case 1:\r\n {\r\n const generator = () => {\r\n const promises = dataFunc.generator();\r\n if (promises.length) {\r\n return promises;\r\n }\r\n if (isPromise) {\r\n return [defaultValue];\r\n }\r\n else {\r\n return [Promise.resolve(defaultValue)];\r\n }\r\n };\r\n typeData = {\r\n generator,\r\n type: dataFunc.type\r\n };\r\n }\r\n break;\r\n case 2:\r\n {\r\n const generator = async () => {\r\n const promises = await dataFunc.generator();\r\n if (promises.length) {\r\n return promises;\r\n }\r\n if (isPromise) {\r\n return [defaultValue];\r\n }\r\n else {\r\n return [Promise.resolve(defaultValue)];\r\n }\r\n };\r\n typeData = {\r\n generator,\r\n type: dataFunc.type\r\n };\r\n }\r\n break;\r\n }\r\n return new BasicParallelEnumerable(typeData);\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const distinct = (source, comparer = StrictEqualityComparer) => {\r\n const generator = async () => {\r\n const distinctElements = [];\r\n for (const item of await source.toArray()) {\r\n const foundItem = distinctElements.find((x) => comparer(x, item));\r\n if (!foundItem) {\r\n distinctElements.push(item);\r\n }\r\n }\r\n return distinctElements;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const distinctAsync = (source, comparer) => {\r\n const generator = async () => {\r\n const distinctElements = [];\r\n outerLoop: for (const item of await source.toArray()) {\r\n for (const distinctElement of distinctElements) {\r\n const found = await comparer(distinctElement, item);\r\n if (found) {\r\n continue outerLoop;\r\n }\r\n }\r\n distinctElements.push(item);\r\n }\r\n return distinctElements;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nexport const each = (source, action) => {\r\n return new BasicParallelEnumerable(nextIteration(source, (x) => {\r\n action(x);\r\n return x;\r\n }));\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const eachAsync = (source, action) => {\r\n const dataFunc = nextIterationAsync(source, async (x) => {\r\n await action(x);\r\n return x;\r\n });\r\n return new BasicParallelEnumerable(dataFunc);\r\n};\r\n","import { ArgumentOutOfRangeException } from \"../../shared/index.js\";\r\nexport const elementAt = async (source, index) => {\r\n if (index < 0) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (index >= values.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n else {\r\n return values[index];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (index >= promises.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n else {\r\n return await promises[index];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (index >= promises.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n else {\r\n return await promises[index];\r\n }\r\n }\r\n }\r\n};\r\n","export const elementAtOrDefault = async (source, index) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (index >= values.length) {\r\n return null;\r\n }\r\n else {\r\n return values[index];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (index >= promises.length) {\r\n return null;\r\n }\r\n else {\r\n return await promises[index];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (index >= promises.length) {\r\n return null;\r\n }\r\n else {\r\n return await promises[index];\r\n }\r\n }\r\n }\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const except = (first, second, comparer = StrictEqualityComparer) => {\r\n const generator = async () => {\r\n const [firstValues, secondValues] = await Promise.all([first.toArray(), second.toArray()]);\r\n const resultValues = [];\r\n for (const firstItem of firstValues) {\r\n let exists = false;\r\n for (let j = 0; j < secondValues.length; j++) {\r\n const secondItem = secondValues[j];\r\n if (comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n resultValues.push(firstItem);\r\n }\r\n }\r\n return resultValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const exceptAsync = (first, second, comparer) => {\r\n const generator = async () => {\r\n const [firstValues, secondValues] = await Promise.all([first.toArray(), second.toArray()]);\r\n const resultValues = [];\r\n for (const firstItem of firstValues) {\r\n let exists = false;\r\n for (let j = 0; j < secondValues.length; j++) {\r\n const secondItem = secondValues[j];\r\n if (await comparer(firstItem, secondItem) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n resultValues.push(firstItem);\r\n }\r\n }\r\n return resultValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toArray = (source) => {\r\n return typeDataToArray(source.dataFunc);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const first = (source, predicate) => {\r\n if (predicate) {\r\n return first2(source, predicate);\r\n }\r\n else {\r\n return first1(source);\r\n }\r\n};\r\nconst first1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (values.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return values[0];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (promises.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return await promises[0];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (promises.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return await promises[0];\r\n }\r\n }\r\n }\r\n};\r\nconst first2 = async (source, predicate) => {\r\n const data = await toArray(source);\r\n for (const value of data) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const firstAsync = async (source, predicate) => {\r\n const data = await toArray(source);\r\n for (const value of data) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { toArray } from \"./toArray.js\";\r\nexport const firstOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return firstOrDefault2(source, predicate);\r\n }\r\n else {\r\n return firstOrDefault1(source);\r\n }\r\n};\r\nconst firstOrDefault1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (values.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return values[0];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (promises.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return await promises[0];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (promises.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return await promises[0];\r\n }\r\n }\r\n }\r\n};\r\nconst firstOrDefault2 = async (source, predicate) => {\r\n const data = await toArray(source);\r\n for (const value of data) {\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { toArray } from \"./toArray.js\";\r\nexport const firstOrDefaultAsync = async (source, predicate) => {\r\n const data = await toArray(source);\r\n for (const value of data) {\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const groupBy = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupBy_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupBy_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupBy_0_Simple = (source, keySelector) => {\r\n const generator = async () => {\r\n const keyMap = {};\r\n for (const value of await source.toArray()) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n const results = new Array();\r\n for (const value in keyMap) {\r\n results.push(keyMap[value]);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst groupBy_0 = (source, keySelector, comparer) => {\r\n const generator = async () => {\r\n const keyMap = new Array();\r\n for (const value of await source.toArray()) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n const results = new Array();\r\n for (const g of keyMap) {\r\n results.push(g);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nexport const groupByAsync = (source, keySelector, comparer) => {\r\n if (comparer) {\r\n return groupByAsync_0(source, keySelector, comparer);\r\n }\r\n else {\r\n return groupByAsync_0_Simple(source, keySelector);\r\n }\r\n};\r\nconst groupByAsync_0 = (source, keySelector, comparer) => {\r\n const generator = async () => {\r\n const typedData = nextIterationAsync(source, async (value) => {\r\n const key = await keySelector(value);\r\n return [key, value];\r\n });\r\n let values;\r\n switch (typedData.type) {\r\n case 1:\r\n values = await Promise.all(typedData.generator());\r\n break;\r\n case 2:\r\n values = await Promise.all(await typedData.generator());\r\n break;\r\n }\r\n const keyMap = new Array();\r\n for (const [key, value] of values) {\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (await comparer(group.key, key) === true) {\r\n group.push(value);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n keyMap.push(new Grouping(key, value));\r\n }\r\n }\r\n const results = new Array();\r\n for (const g of keyMap) {\r\n results.push(g);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst groupByAsync_0_Simple = (source, keySelector) => {\r\n const generator = async () => {\r\n const typedData = nextIterationAsync(source, async (value) => {\r\n const key = await keySelector(value);\r\n return [key, value];\r\n });\r\n let values;\r\n switch (typedData.type) {\r\n case 1:\r\n values = await Promise.all(typedData.generator());\r\n break;\r\n case 2:\r\n values = await Promise.all(await typedData.generator());\r\n break;\r\n }\r\n const keyMap = {};\r\n for (const [key, value] of values) {\r\n const grouping = keyMap[key];\r\n if (grouping) {\r\n grouping.push(value);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, value);\r\n }\r\n }\r\n const results = new Array();\r\n for (const value in keyMap) {\r\n results.push(keyMap[value]);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { Grouping } from \"../../sync/Grouping.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const groupByWithSel = (source, keySelector, elementSelector, comparer) => {\r\n if (comparer) {\r\n return groupBy1(source, keySelector, elementSelector, comparer);\r\n }\r\n else {\r\n return groupBy1Simple(source, keySelector, elementSelector);\r\n }\r\n};\r\nconst groupBy1 = (source, keySelector, elementSelector, comparer) => {\r\n const generator = async () => {\r\n const keyMap = new Array();\r\n for await (const value of source) {\r\n const key = keySelector(value);\r\n let found = false;\r\n for (let i = 0; i < keyMap.length; i++) {\r\n const group = keyMap[i];\r\n if (comparer(group.key, key)) {\r\n group.push(elementSelector(value));\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n const element = elementSelector(value);\r\n keyMap.push(new Grouping(key, element));\r\n }\r\n }\r\n const results = new Array();\r\n for (const value of keyMap) {\r\n results.push(value);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst groupBy1Simple = (source, keySelector, elementSelector) => {\r\n const generator = async () => {\r\n const keyMap = {};\r\n for (const value of await source.toArray()) {\r\n const key = keySelector(value);\r\n const grouping = keyMap[key];\r\n const element = elementSelector(value);\r\n if (grouping) {\r\n grouping.push(element);\r\n }\r\n else {\r\n keyMap[key] = new Grouping(key, element);\r\n }\r\n }\r\n const results = new Array();\r\n for (const value in keyMap) {\r\n results.push(keyMap[value]);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const groupJoin = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0\r\n });\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async () => {\r\n const innerKeyMap = [];\r\n for await (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n const outerValues = await outer.toArray();\r\n return outerValues\r\n .map(outerValue => {\r\n var _a;\r\n const key = outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n return resultSelector(outerValue, innerRecord.values);\r\n });\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async () => {\r\n const innerKeyMap = new Map();\r\n for await (const innerValue of inner) {\r\n const key = innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n const outerValues = await outer.toArray();\r\n return outerValues\r\n .map(outerValue => {\r\n var _a;\r\n const key = outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n return resultSelector(outerValue, values);\r\n });\r\n };\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const groupJoinAsync = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n const generator = comparer ?\r\n groupJoinWithComparer(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) :\r\n groupJoinSimple(outer, inner, outerKeySelector, innerKeySelector, resultSelector);\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0\r\n });\r\n};\r\nconst groupJoinWithComparer = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) => {\r\n return async () => {\r\n const innerKeyMap = [];\r\n for await (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const record = innerKeyMap.find(x => comparer(x.key, key));\r\n if (record) {\r\n record.values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.push({ key, values: [innerValue] });\r\n }\r\n }\r\n const outerValues = await outer.toArray();\r\n const resultPromises = outerValues.map(async (outerValue) => {\r\n var _a;\r\n const key = await outerKeySelector(outerValue);\r\n const innerRecord = (_a = innerKeyMap.find(x => comparer(x.key, key))) !== null && _a !== void 0 ? _a : { key, values: [] };\r\n return resultSelector(outerValue, innerRecord.values);\r\n });\r\n return await Promise.all(resultPromises);\r\n };\r\n};\r\nconst groupJoinSimple = (outer, inner, outerKeySelector, innerKeySelector, resultSelector) => {\r\n return async () => {\r\n const innerKeyMap = new Map();\r\n for await (const innerValue of inner) {\r\n const key = await innerKeySelector(innerValue);\r\n const values = innerKeyMap.get(key);\r\n if (values) {\r\n values.push(innerValue);\r\n }\r\n else {\r\n innerKeyMap.set(key, [innerValue]);\r\n }\r\n }\r\n const outerValues = await outer.toArray();\r\n const resultPromises = outerValues.map(async (outerValue) => {\r\n var _a;\r\n const key = await outerKeySelector(outerValue);\r\n const values = (_a = innerKeyMap.get(key)) !== null && _a !== void 0 ? _a : [];\r\n return resultSelector(outerValue, values);\r\n });\r\n return await Promise.all(resultPromises);\r\n };\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const intersect = (first, second, comparer = StrictEqualityComparer) => {\r\n const generator = async () => {\r\n const firstResults = await first.distinct(comparer).toArray();\r\n if (firstResults.length === 0) {\r\n return [];\r\n }\r\n const secondResults = await second.toArray();\r\n const results = new Array();\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (comparer(firstValue, secondValue) === true) {\r\n results.push(firstValue);\r\n break;\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const intersectAsync = (first, second, comparer) => {\r\n const generator = async () => {\r\n const firstResults = await first.distinctAsync(comparer).toArray();\r\n if (firstResults.length === 0) {\r\n return [];\r\n }\r\n const secondResults = await second.toArray();\r\n const results = new Array();\r\n for (let i = 0; i < firstResults.length; i++) {\r\n const firstValue = firstResults[i];\r\n for (let j = 0; j < secondResults.length; j++) {\r\n const secondValue = secondResults[j];\r\n if (await comparer(firstValue, secondValue) === true) {\r\n results.push(firstValue);\r\n break;\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nimport { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const join = (outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer = StrictEqualityComparer) => {\r\n const generator = async () => {\r\n const [innerArray, outerArray] = await Promise.all([inner.toArray(), outer.toArray()]);\r\n const results = new Array();\r\n for (const o of outerArray) {\r\n const outerKey = outerKeySelector(o);\r\n for (const i of innerArray) {\r\n const innerKey = innerKeySelector(i);\r\n if (comparer(outerKey, innerKey) === true) {\r\n results.push(resultSelector(o, i));\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const last = (source, predicate) => {\r\n if (predicate) {\r\n return last2(source, predicate);\r\n }\r\n else {\r\n return last1(source);\r\n }\r\n};\r\nconst last1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (values.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return values[values.length - 1];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (promises.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return await promises[promises.length - 1];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (promises.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n else {\r\n return await promises[promises.length - 1];\r\n }\r\n }\r\n }\r\n};\r\nconst last2 = async (source, predicate) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n const value = values[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nexport const lastAsync = async (source, predicate) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n const value = values[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n};\r\n","export const lastOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return lastOrDefault2(source, predicate);\r\n }\r\n else {\r\n return lastOrDefault1(source);\r\n }\r\n};\r\nconst lastOrDefault1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n if (values.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return values[values.length - 1];\r\n }\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n if (promises.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return await promises[promises.length - 1];\r\n }\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n if (promises.length === 0) {\r\n return null;\r\n }\r\n else {\r\n return await promises[promises.length - 1];\r\n }\r\n }\r\n }\r\n};\r\nconst lastOrDefault2 = async (source, predicate) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n const value = values[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (predicate(value)) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return null;\r\n};\r\n","export const lastOrDefaultAsync = async (source, predicate) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const values = await dataFunc.generator();\r\n for (let i = values.length - 1; i >= 0; i--) {\r\n const value = values[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const promises = dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n const promises = await dataFunc.generator();\r\n for (let i = promises.length - 1; i >= 0; i--) {\r\n const value = await promises[i];\r\n if (await predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return null;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const max = async (source, selector) => {\r\n let dataFunc;\r\n if (selector) {\r\n dataFunc = nextIteration(source, selector);\r\n }\r\n else {\r\n dataFunc = source.dataFunc;\r\n }\r\n const data = await typeDataToArray(dataFunc);\r\n if (data.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return Math.max.apply(null, data);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const maxAsync = async (source, selector) => {\r\n const dataFunc = nextIterationAsync(source, selector);\r\n const maxInfo = await typeDataToArray(dataFunc);\r\n if (maxInfo.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return Math.max.apply(null, maxInfo);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const min = async (source, selector) => {\r\n let dataFunc;\r\n if (selector) {\r\n dataFunc = nextIteration(source, selector);\r\n }\r\n else {\r\n dataFunc = source.dataFunc;\r\n }\r\n const data = await typeDataToArray(dataFunc);\r\n if (data.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return Math.min.apply(null, data);\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const minAsync = async (source, selector) => {\r\n const dataFunc = nextIterationAsync(source, selector);\r\n const maxInfo = await typeDataToArray(dataFunc);\r\n if (maxInfo.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return Math.min.apply(null, maxInfo);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const ofType = (source, type) => {\r\n const typeCheck = typeof type === \"string\" ?\r\n (x) => [typeof x === type, x] :\r\n (x) => [x instanceof type, x];\r\n const generator = async () => {\r\n const dataFunc = nextIteration(source, typeCheck);\r\n const values = await typeDataToArray(dataFunc);\r\n const filteredValues = [];\r\n for (const [pass, value] of values) {\r\n if (pass) {\r\n filteredValues.push(value);\r\n }\r\n }\r\n return filteredValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { asAsyncKeyMapSync } from \"./asAsyncKeyMapSync.js\";\r\nexport async function* asAsyncSortedKeyValuesSync(source, keySelector, ascending, comparer) {\r\n const map = await asAsyncKeyMapSync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asAsyncKeyMapSync = async (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMapSync } from \"./asKeyMapSync.js\";\r\nexport async function* asSortedKeyValuesSync(source, keySelector, ascending, comparer) {\r\n const map = asKeyMapSync(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMapSync = (source, keySelector) => {\r\n const map = new Map();\r\n for (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asAsyncSortedKeyValues } from \"./_ordered/asAsyncSortedKeyValues.js\";\r\nimport { asAsyncSortedKeyValuesSync } from \"./_ordered/asAsyncSortedKeyValuesSync.js\";\r\nimport { asSortedKeyValues } from \"./_ordered/asSortedKeyValues.js\";\r\nimport { asSortedKeyValuesSync } from \"./_ordered/asSortedKeyValuesSync.js\";\r\nimport { BasicParallelEnumerable } from \"./BasicParallelEnumerable.js\";\r\nexport class OrderedParallelEnumerable extends BasicParallelEnumerable {\r\n constructor(orderedPairs) {\r\n super({\r\n generator: async () => {\r\n const asyncVals = orderedPairs();\r\n const array = [];\r\n for await (const val of asyncVals) {\r\n array.push(...val);\r\n }\r\n return array;\r\n },\r\n type: 0,\r\n });\r\n this.orderedPairs = orderedPairs;\r\n }\r\n static generateAsync(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedParallelEnumerable) {\r\n orderedPairs = async function* () {\r\n for await (const pair of source.orderedPairs()) {\r\n yield* asAsyncSortedKeyValuesSync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asAsyncSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedParallelEnumerable(orderedPairs);\r\n }\r\n static generate(source, keySelector, ascending, comparer) {\r\n let orderedPairs;\r\n if (source instanceof OrderedParallelEnumerable) {\r\n orderedPairs = async function* () {\r\n for await (const pair of source.orderedPairs()) {\r\n yield* asSortedKeyValuesSync(pair, keySelector, ascending, comparer);\r\n }\r\n };\r\n }\r\n else {\r\n orderedPairs = () => asSortedKeyValues(source, keySelector, ascending, comparer);\r\n }\r\n return new OrderedParallelEnumerable(orderedPairs);\r\n }\r\n thenBy(keySelector, comparer) {\r\n return OrderedParallelEnumerable.generate(this, keySelector, true, comparer);\r\n }\r\n thenByAsync(keySelector, comparer) {\r\n return OrderedParallelEnumerable.generateAsync(this, keySelector, true, comparer);\r\n }\r\n thenByDescending(keySelector, comparer) {\r\n return OrderedParallelEnumerable.generate(this, keySelector, false, comparer);\r\n }\r\n thenByDescendingAsync(keySelector, comparer) {\r\n return OrderedParallelEnumerable.generateAsync(this, keySelector, false, comparer);\r\n }\r\n}\r\n","import { asAsyncKeyMap } from \"./asAsyncKeyMap.js\";\r\nexport async function* asAsyncSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = await asAsyncKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asAsyncKeyMap = async (source, keySelector) => {\r\n const map = new Map();\r\n for await (const item of source) {\r\n const key = await keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { asKeyMap } from \"./asKeyMap.js\";\r\nexport async function* asSortedKeyValues(source, keySelector, ascending, comparer) {\r\n const map = await asKeyMap(source, keySelector);\r\n const sortedKeys = [...map.keys()].sort(comparer ? comparer : undefined);\r\n if (ascending) {\r\n for (let i = 0; i < sortedKeys.length; i++) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n else {\r\n for (let i = sortedKeys.length - 1; i >= 0; i--) {\r\n yield map.get(sortedKeys[i]);\r\n }\r\n }\r\n}\r\n","export const asKeyMap = async (source, keySelector) => {\r\n const map = new Map();\r\n for await (const item of source) {\r\n const key = keySelector(item);\r\n const currentMapping = map.get(key);\r\n if (currentMapping) {\r\n currentMapping.push(item);\r\n }\r\n else {\r\n map.set(key, [item]);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { OrderedParallelEnumerable } from \"../OrderedParallelEnumerable.js\";\r\nexport const orderBy = (source, keySelector, comparer) => {\r\n return OrderedParallelEnumerable.generate(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedParallelEnumerable } from \"../OrderedParallelEnumerable.js\";\r\nexport const orderByAsync = (source, keySelector, comparer) => {\r\n return OrderedParallelEnumerable.generateAsync(source, keySelector, true, comparer);\r\n};\r\n","import { OrderedParallelEnumerable } from \"../OrderedParallelEnumerable.js\";\r\nexport const orderByDescending = (source, keySelector, comparer) => {\r\n return OrderedParallelEnumerable.generate(source, keySelector, false, comparer);\r\n};\r\n","import { OrderedParallelEnumerable } from \"../OrderedParallelEnumerable.js\";\r\nexport const orderByDescendingAsync = (source, keySelector, comparer) => {\r\n return OrderedParallelEnumerable.generateAsync(source, keySelector, false, comparer);\r\n};\r\n","import { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const partition = async (source, predicate) => {\r\n const dataFunc = nextIteration(source, (value) => {\r\n return [predicate(value), value];\r\n });\r\n const values = await typeDataToArray(dataFunc);\r\n const fail = [];\r\n const pass = [];\r\n for (const [passed, value] of values) {\r\n if (passed) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const partitionAsync = async (source, predicate) => {\r\n const dataFunc = nextIterationAsync(source, async (value) => {\r\n const passed = await predicate(value);\r\n return [passed, value];\r\n });\r\n const values = await typeDataToArray(dataFunc);\r\n const fail = [];\r\n const pass = [];\r\n for (const [passed, value] of values) {\r\n if (passed) {\r\n pass.push(value);\r\n }\r\n else {\r\n fail.push(value);\r\n }\r\n }\r\n return [pass, fail];\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const reverse = (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 1: {\r\n const generator = () => {\r\n return dataFunc.generator().reverse();\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: dataFunc.type,\r\n });\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const array = await dataFunc.generator();\r\n return array.reverse();\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: dataFunc.type,\r\n });\r\n }\r\n case 0: {\r\n const generator = async () => {\r\n const array = await dataFunc.generator();\r\n return array.reverse();\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: dataFunc.type,\r\n });\r\n }\r\n }\r\n};\r\n","export const nextIterationWithIndex = (source, onfulfilled) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = () => dataFunc.generator().then((x) => {\r\n const convValues = new Array(x.length);\r\n for (let i = 0; i < x.length; i++) {\r\n convValues[i] = onfulfilled(x[i], i);\r\n }\r\n return convValues;\r\n });\r\n return {\r\n generator,\r\n type: 0,\r\n };\r\n }\r\n case 1: {\r\n const generator = () => {\r\n const previousData = dataFunc.generator();\r\n const newPromises = new Array(previousData.length);\r\n for (let i = 0; i < previousData.length; i++) {\r\n newPromises[i] = previousData[i].then((value) => {\r\n return onfulfilled(value, i);\r\n });\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 1,\r\n };\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const previousData = await dataFunc.generator();\r\n const newPromises = new Array(previousData.length);\r\n for (let i = 0; i < previousData.length; i++) {\r\n newPromises[i] = previousData[i].then((value) => onfulfilled(value, i));\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n }\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { nextIterationWithIndex } from \"./_nextIterationWithIndex.js\";\r\nexport const select = (source, key) => {\r\n if (typeof key === \"function\") {\r\n if (key.length === 1) {\r\n return new BasicParallelEnumerable(nextIteration(source, key));\r\n }\r\n else {\r\n return new BasicParallelEnumerable(nextIterationWithIndex(source, key));\r\n }\r\n }\r\n else {\r\n return new BasicParallelEnumerable(nextIteration(source, (x) => x[key]));\r\n }\r\n};\r\n","export const nextIterationWithIndexAsync = (source, onfulfilled) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = async () => {\r\n const results = await dataFunc.generator();\r\n const newPromises = new Array(results.length);\r\n for (let i = 0; i < results.length; i++) {\r\n newPromises[i] = onfulfilled(results[i], i);\r\n }\r\n return newPromises;\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n case 1: {\r\n const generator = () => dataFunc\r\n .generator()\r\n .map((promise, index) => promise.then((x) => onfulfilled(x, index)));\r\n return {\r\n generator,\r\n type: 1,\r\n };\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const promises = await dataFunc.generator();\r\n return promises.map((promise, index) => promise.then((x) => onfulfilled(x, index)));\r\n };\r\n return {\r\n generator,\r\n type: 2,\r\n };\r\n }\r\n }\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { nextIterationWithIndexAsync } from \"./_nextIterationWithIndexAsync.js\";\r\nexport const selectAsync = (source, keyOrSelector) => {\r\n let generator;\r\n if (typeof keyOrSelector === \"function\") {\r\n if (keyOrSelector.length === 1) {\r\n generator = nextIterationAsync(source, keyOrSelector);\r\n }\r\n else {\r\n generator = nextIterationWithIndexAsync(source, keyOrSelector);\r\n }\r\n }\r\n else {\r\n generator = nextIterationAsync(source, (x) => (x[keyOrSelector]));\r\n }\r\n return new BasicParallelEnumerable(generator);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIteration } from \"./_nextIteration.js\";\r\nimport { nextIterationWithIndex } from \"./_nextIterationWithIndex.js\";\r\nexport const selectMany = (source, selector) => {\r\n const generator = async () => {\r\n let values;\r\n if (typeof selector === \"function\") {\r\n if (selector.length === 1) {\r\n values = nextIteration(source, selector);\r\n }\r\n else {\r\n values = nextIterationWithIndex(source, selector);\r\n }\r\n }\r\n else {\r\n values = nextIteration(source, (x) => x[selector]);\r\n }\r\n const valuesArray = [];\r\n switch (values.type) {\r\n case 0: {\r\n for (const outer of await values.generator()) {\r\n for (const y of outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n case 1: {\r\n for (const outer of values.generator()) {\r\n for (const y of await outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n for (const outer of await values.generator()) {\r\n for (const y of await outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return valuesArray;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { nextIterationWithIndexAsync } from \"./_nextIterationWithIndexAsync.js\";\r\nexport const selectManyAsync = (source, selector) => {\r\n const generator = async () => {\r\n let values;\r\n if (selector.length === 1) {\r\n values = nextIterationAsync(source, selector);\r\n }\r\n else {\r\n values = nextIterationWithIndexAsync(source, selector);\r\n }\r\n const valuesArray = [];\r\n switch (values.type) {\r\n case 1: {\r\n for (const outer of values.generator()) {\r\n for (const y of await outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n case 2: {\r\n for (const outer of await values.generator()) {\r\n for (const y of await outer) {\r\n valuesArray.push(y);\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return valuesArray;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { StrictEqualityComparer } from \"../../shared/index.js\";\r\nexport const sequenceEquals = async (first, second, comparer = StrictEqualityComparer) => {\r\n const firstArray = await first.toArray();\r\n const secondArray = await second.toArray();\r\n if (firstArray.length !== secondArray.length) {\r\n return false;\r\n }\r\n for (let i = 0; i < firstArray.length; i++) {\r\n const firstResult = firstArray[i];\r\n const secondResult = secondArray[i];\r\n if (comparer(firstResult, secondResult) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","export const sequenceEqualsAsync = async (first, second, comparer) => {\r\n const firstArray = await first.toArray();\r\n const secondArray = await second.toArray();\r\n if (firstArray.length !== secondArray.length) {\r\n return false;\r\n }\r\n for (let i = 0; i < firstArray.length; i++) {\r\n const firstResult = firstArray[i];\r\n const secondResult = secondArray[i];\r\n if (await comparer(firstResult, secondResult) === false) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const single = (source, predicate) => {\r\n if (predicate) {\r\n return single2(source, predicate);\r\n }\r\n else {\r\n return single1(source);\r\n }\r\n};\r\nconst single1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const results = await dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return results[0];\r\n }\r\n case 1: {\r\n const results = dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return results[0];\r\n }\r\n case 2: {\r\n const results = await dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return await results[0];\r\n }\r\n }\r\n};\r\nconst single2 = async (source, predicate) => {\r\n const results = await toArray(source);\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of results) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const singleAsync = async (source, predicate) => {\r\n const results = await toArray(source);\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of results) {\r\n if (await predicate(value) === true) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneMatchingElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n if (hasValue === false) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const singleOrDefault = (source, predicate) => {\r\n if (predicate) {\r\n return singleOrDefault2(source, predicate);\r\n }\r\n else {\r\n return singleOrDefault1(source);\r\n }\r\n};\r\nconst singleOrDefault1 = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const results = await dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n return null;\r\n }\r\n return results[0];\r\n }\r\n case 1: {\r\n const results = dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n return null;\r\n }\r\n return results[0];\r\n }\r\n case 2: {\r\n const results = await dataFunc.generator();\r\n if (results.length > 1) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else if (results.length === 0) {\r\n return null;\r\n }\r\n return await results[0];\r\n }\r\n }\r\n};\r\nconst singleOrDefault2 = async (source, predicate) => {\r\n const results = await toArray(source);\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of results) {\r\n if (predicate(value)) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { ErrorString, InvalidOperationException } from \"../../shared/index.js\";\r\nimport { toArray } from \"./toArray.js\";\r\nexport const singleOrDefaultAsync = async (source, predicate) => {\r\n const results = await toArray(source);\r\n let hasValue = false;\r\n let singleValue = null;\r\n for (const value of results) {\r\n if (await predicate(value) === true) {\r\n if (hasValue === true) {\r\n throw new InvalidOperationException(ErrorString.MoreThanOneElement);\r\n }\r\n else {\r\n hasValue = true;\r\n singleValue = value;\r\n }\r\n }\r\n }\r\n return singleValue;\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const skip = (source, count) => {\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 0: {\r\n const generator = async () => (await dataFunc.generator()).slice(count);\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n }\r\n case 1: {\r\n const generator = () => dataFunc.generator().slice(count);\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 1,\r\n });\r\n }\r\n case 2: {\r\n const generator = async () => {\r\n const dataInner = await dataFunc.generator();\r\n return dataInner.slice(count);\r\n };\r\n const dataFuncNew = {\r\n generator,\r\n type: 2,\r\n };\r\n return new BasicParallelEnumerable(dataFuncNew);\r\n }\r\n }\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const skipWhile = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n let i = 0;\r\n for (; i < values.length; i++) {\r\n const value = values[i];\r\n if (predicate(value, i) === false) {\r\n break;\r\n }\r\n }\r\n const returnedValues = [];\r\n for (; i < values.length; i++) {\r\n returnedValues.push(values[i]);\r\n }\r\n return returnedValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const skipWhileAsync = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n let i = 0;\r\n for (; i < values.length; i++) {\r\n const value = values[i];\r\n if (await predicate(value, i) === false) {\r\n break;\r\n }\r\n }\r\n const returnedValues = [];\r\n for (; i < values.length; i++) {\r\n returnedValues.push(values[i]);\r\n }\r\n return returnedValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","export const sum = (source, selector) => {\r\n if (selector) {\r\n return sum2(source, selector);\r\n }\r\n else {\r\n return sum1(source);\r\n }\r\n};\r\nconst sum1 = async (source) => {\r\n let totalSum = 0;\r\n for (const value of await source.toArray()) {\r\n totalSum += value;\r\n }\r\n return totalSum;\r\n};\r\nconst sum2 = async (source, selector) => {\r\n let total = 0;\r\n for (const value of await source.toArray()) {\r\n total += selector(value);\r\n }\r\n return total;\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const sumAsync = async (source, selector) => {\r\n const dataFunc = nextIterationAsync(source, selector);\r\n const values = await typeDataToArray(dataFunc);\r\n let sum = 0;\r\n for (const value of values) {\r\n sum += value;\r\n }\r\n return sum;\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const take = (source, amount) => {\r\n const amountLeft = amount > 0 ? amount : 0;\r\n const dataFunc = source.dataFunc;\r\n switch (dataFunc.type) {\r\n case 1:\r\n const generator1 = () => dataFunc.generator().splice(0, amountLeft);\r\n return new BasicParallelEnumerable({\r\n generator: generator1,\r\n type: 1,\r\n });\r\n case 2:\r\n const generator2 = () => dataFunc.generator().then((x) => x.splice(0, amountLeft));\r\n return new BasicParallelEnumerable({\r\n generator: generator2,\r\n type: 2,\r\n });\r\n case 0:\r\n default:\r\n const generator3 = () => dataFunc.generator().then((x) => x.splice(0, amountLeft));\r\n return new BasicParallelEnumerable({\r\n generator: generator3,\r\n type: 0,\r\n });\r\n }\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const takeWhile = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n const results = new Array();\r\n if (predicate.length === 1) {\r\n for (const value of values) {\r\n if (predicate(value) === true) {\r\n results.push(value);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < values.length; i++) {\r\n const value = values[i];\r\n if (predicate(value, i) === true) {\r\n results.push(value);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const takeWhileAsync = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n const results = new Array();\r\n if (predicate.length === 1) {\r\n const sPredicate = predicate;\r\n for (const value of values) {\r\n if (await sPredicate(value) === true) {\r\n results.push(value);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < values.length; i++) {\r\n const value = values[i];\r\n if (await predicate(value, i) === true) {\r\n results.push(value);\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { nextIteration } from \"./_nextIteration.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toMap = async (source, selector) => {\r\n const map = new Map();\r\n const dataFunc = nextIteration(source, (value) => {\r\n const key = selector(value);\r\n return [key, value];\r\n });\r\n const keyValues = await typeDataToArray(dataFunc);\r\n for (const [key, value] of keyValues) {\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toMapAsync = async (source, selector) => {\r\n const map = new Map();\r\n const dataFunc = nextIterationAsync(source, async (value) => {\r\n const key = await selector(value);\r\n return [key, value];\r\n });\r\n const keyValues = await typeDataToArray(dataFunc);\r\n for (const [key, value] of keyValues) {\r\n const array = map.get(key);\r\n if (array === undefined) {\r\n map.set(key, [value]);\r\n }\r\n else {\r\n array.push(value);\r\n }\r\n }\r\n return map;\r\n};\r\n","import { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toObject = async (source, selector) => {\r\n const dataFunc = source.dataFunc;\r\n const values = await typeDataToArray(dataFunc);\r\n const map = {};\r\n for (const value of values) {\r\n map[selector(value)] = value;\r\n }\r\n return map;\r\n};\r\n","import { nextIterationAsync } from \"./_nextIterationAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toObjectAsync = async (source, selector) => {\r\n const dataFunc = nextIterationAsync(source, async (value) => {\r\n const key = await selector(value);\r\n return [key, value];\r\n });\r\n const keyValues = await typeDataToArray(dataFunc);\r\n const map = {};\r\n for (const [key, value] of keyValues) {\r\n map[key] = value;\r\n }\r\n return map;\r\n};\r\n","import { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const toSet = async (source) => {\r\n const dataFunc = source.dataFunc;\r\n const values = await typeDataToArray(dataFunc);\r\n return new Set(values);\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const union = (first, second, comparer) => {\r\n if (comparer) {\r\n return union2(first, second, comparer);\r\n }\r\n else {\r\n return union1(first, second);\r\n }\r\n};\r\nconst union1 = (first, second) => {\r\n const generator = async () => {\r\n const set = new Set();\r\n const secondPromise = second.toArray();\r\n for await (const item of first) {\r\n if (set.has(item) === false) {\r\n set.add(item);\r\n }\r\n }\r\n const secondValues = await secondPromise;\r\n for (const item of secondValues) {\r\n if (set.has(item) === false) {\r\n set.add(item);\r\n }\r\n }\r\n return [...set.keys()];\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst union2 = (first, second, comparer) => {\r\n const generator = async () => {\r\n const result = [];\r\n const values = await Promise.all([first.toArray(), second.toArray()]);\r\n for (const source of values) {\r\n for (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n result.push(value);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const unionAsync = (first, second, comparer) => {\r\n const generator = async () => {\r\n const result = [];\r\n const values = await Promise.all([first.toArray(), second.toArray()]);\r\n for (const source of values) {\r\n for (const value of source) {\r\n let exists = false;\r\n for (const resultValue of result) {\r\n if (await comparer(value, resultValue) === true) {\r\n exists = true;\r\n break;\r\n }\r\n }\r\n if (exists === false) {\r\n result.push(value);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const where = (source, predicate) => {\r\n const generator = async () => {\r\n const values = await source.toArray();\r\n return values.filter(predicate);\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nimport { nextIterationWithIndexAsync } from \"./_nextIterationWithIndexAsync.js\";\r\nimport { typeDataToArray } from \"./_typeDataToArray.js\";\r\nexport const whereAsync = (source, predicate) => {\r\n const generator = async () => {\r\n const dataFunc = nextIterationWithIndexAsync(source, async (value, index) => {\r\n const keep = await predicate(value, index);\r\n return [keep, value];\r\n });\r\n const valuesAsync = await typeDataToArray(dataFunc);\r\n const filteredValues = [];\r\n for (const [keep, value] of valuesAsync) {\r\n if (keep) {\r\n filteredValues.push(value);\r\n }\r\n }\r\n return filteredValues;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const zip = (first, second, resultSelector) => {\r\n if (resultSelector) {\r\n return zip2(first, second, resultSelector);\r\n }\r\n else {\r\n return zip1(first, second);\r\n }\r\n};\r\nconst zip1 = (source, second) => {\r\n const generator = async () => {\r\n const [left, right] = await Promise.all([source.toArray(), second.toArray()]);\r\n const minLength = left.length < right.length ? left.length : right.length;\r\n const results = new Array(minLength);\r\n for (let i = 0; i < minLength; i++) {\r\n const a = left[i];\r\n const b = right[i];\r\n results[i] = [a, b];\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\nconst zip2 = (source, second, resultSelector) => {\r\n const generator = async () => {\r\n const [left, right] = await Promise.all([source.toArray(), second.toArray()]);\r\n const minLength = left.length < right.length ? left.length : right.length;\r\n const results = new Array(minLength);\r\n for (let i = 0; i < minLength; i++) {\r\n const a = left[i];\r\n const b = right[i];\r\n results[i] = resultSelector(a, b);\r\n }\r\n return results;\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicParallelEnumerable } from \"../BasicParallelEnumerable.js\";\r\nexport const zipAsync = (first, second, resultSelector) => {\r\n const generator = async () => {\r\n const [left, right] = await Promise.all([first.toArray(), second.toArray()]);\r\n const minLength = left.length < right.length ? left.length : right.length;\r\n const resultPromises = new Array(minLength);\r\n for (let i = 0; i < minLength; i++) {\r\n const a = left[i];\r\n const b = right[i];\r\n resultPromises[i] = resultSelector(a, b);\r\n }\r\n return Promise.all(resultPromises);\r\n };\r\n return new BasicParallelEnumerable({\r\n generator,\r\n type: 0,\r\n });\r\n};\r\n","import { BasicAsyncEnumerable } from \"../async/BasicAsyncEnumerable.js\";\r\nimport { BasicParallelEnumerable } from \"../parallel/BasicParallelEnumerable.js\";\r\nimport { BasicEnumerable } from \"../sync/BasicEnumerable.js\";\r\nimport { bindArray } from \"./bindArray.js\";\r\nimport { bindArrayEnumerable } from \"./bindArrayEnumerable.js\";\r\nimport { bindLinq } from \"./bindLinq.js\";\r\nimport { bindLinqAsync } from \"./bindLinqAsync.js\";\r\nimport { bindLinqParallel } from \"./bindLinqParallel.js\";\r\nimport { bindString } from \"./bindString.js\";\r\nbindLinq(BasicEnumerable);\r\nbindLinqAsync(BasicAsyncEnumerable);\r\nbindLinqParallel(BasicParallelEnumerable);\r\nbindArrayEnumerable();\r\nexport { bindLinq, bindLinqAsync, bindArray, bindString };\r\nexport { initializeLinq } from \"./initializeLinq.js\";\r\n","import { aggregate } from \"./../async/_private/aggregate.js\";\r\nimport { all } from \"./../async/_private/all.js\";\r\nimport { allAsync } from \"./../async/_private/allAsync.js\";\r\nimport { any } from \"./../async/_private/any.js\";\r\nimport { anyAsync } from \"./../async/_private/anyAsync.js\";\r\nimport { asParallel } from \"./../async/_private/asParallel.js\";\r\nimport { average } from \"./../async/_private/average.js\";\r\nimport { averageAsync } from \"./../async/_private/averageAsync.js\";\r\nimport { chunk } from \"./../async/_private/chunk.js\";\r\nimport { concatenate } from \"../async/_private/concatenate.js\";\r\nimport { contains } from \"./../async/_private/contains.js\";\r\nimport { containsAsync } from \"./../async/_private/containsAsync.js\";\r\nimport { count } from \"./../async/_private/count.js\";\r\nimport { countAsync } from \"./../async/_private/countAsync.js\";\r\nimport { defaultIfEmpty } from \"../async/_private/defaultIfEmpty.js\";\r\nimport { distinct } from \"./../async/_private/distinct.js\";\r\nimport { distinctAsync } from \"./../async/_private/distinctAsync.js\";\r\nimport { each } from \"./../async/_private/each.js\";\r\nimport { eachAsync } from \"./../async/_private/eachAsync.js\";\r\nimport { elementAt } from \"./../async/_private/elementAt.js\";\r\nimport { elementAtOrDefault } from \"./../async/_private/elementAtOrDefault.js\";\r\nimport { except } from \"./../async/_private/except.js\";\r\nimport { exceptAsync } from \"./../async/_private/exceptAsync.js\";\r\nimport { first } from \"./../async/_private/first.js\";\r\nimport { firstAsync } from \"./../async/_private/firstAsync.js\";\r\nimport { firstOrDefault } from \"./../async/_private/firstOrDefault.js\";\r\nimport { firstOrDefaultAsync } from \"./../async/_private/firstOrDefaultAsync.js\";\r\nimport { groupBy } from \"./../async/_private/groupBy.js\";\r\nimport { groupByAsync } from \"./../async/_private/groupByAsync.js\";\r\nimport { groupByWithSel } from \"./../async/_private/groupByWithSel.js\";\r\nimport { groupJoin } from \"./../async/_private/groupJoin.js\";\r\nimport { groupJoinAsync } from \"./../async/_private/groupJoinAsync.js\";\r\nimport { intersect } from \"./../async/_private/intersect.js\";\r\nimport { intersectAsync } from \"./../async/_private/intersectAsync.js\";\r\nimport { join } from \"./../async/_private/join.js\";\r\nimport { last } from \"./../async/_private/last.js\";\r\nimport { lastAsync } from \"./../async/_private/lastAsync.js\";\r\nimport { lastOrDefault } from \"./../async/_private/lastOrDefault.js\";\r\nimport { lastOrDefaultAsync } from \"./../async/_private/lastOrDefaultAsync.js\";\r\nimport { max } from \"./../async/_private/max.js\";\r\nimport { maxAsync } from \"./../async/_private/maxAsync.js\";\r\nimport { min } from \"./../async/_private/min.js\";\r\nimport { minAsync } from \"./../async/_private/minAsync.js\";\r\nimport { ofType } from \"./../async/_private/ofType.js\";\r\nimport { orderBy } from \"./../async/_private/orderBy.js\";\r\nimport { orderByAsync } from \"./../async/_private/orderByAsync.js\";\r\nimport { orderByDescending } from \"./../async/_private/orderByDescending.js\";\r\nimport { orderByDescendingAsync } from \"./../async/_private/orderByDescendingAsync.js\";\r\nimport { partition } from \"./../async/_private/partition.js\";\r\nimport { partitionAsync } from \"./../async/_private/partitionAsync.js\";\r\nimport { reverse } from \"./../async/_private/reverse.js\";\r\nimport { select } from \"./../async/_private/select.js\";\r\nimport { selectAsync } from \"./../async/_private/selectAsync.js\";\r\nimport { selectMany } from \"./../async/_private/selectMany.js\";\r\nimport { selectManyAsync } from \"./../async/_private/selectManyAsync.js\";\r\nimport { sequenceEquals } from \"./../async/_private/sequenceEquals.js\";\r\nimport { sequenceEqualsAsync } from \"./../async/_private/sequenceEqualsAsync.js\";\r\nimport { single } from \"./../async/_private/single.js\";\r\nimport { singleAsync } from \"./../async/_private/singleAsync.js\";\r\nimport { singleOrDefault } from \"./../async/_private/singleOrDefault.js\";\r\nimport { singleOrDefaultAsync } from \"./../async/_private/singleOrDefaultAsync.js\";\r\nimport { skip } from \"./../async/_private/skip.js\";\r\nimport { skipWhile } from \"./../async/_private/skipWhile.js\";\r\nimport { skipWhileAsync } from \"./../async/_private/skipWhileAsync.js\";\r\nimport { sum } from \"./../async/_private/sum.js\";\r\nimport { sumAsync } from \"./../async/_private/sumAsync.js\";\r\nimport { take } from \"./../async/_private/take.js\";\r\nimport { takeWhile } from \"./../async/_private/takeWhile.js\";\r\nimport { takeWhileAsync } from \"./../async/_private/takeWhileAsync.js\";\r\nimport { toArray } from \"./../async/_private/toArray.js\";\r\nimport { toMap } from \"./../async/_private/toMap.js\";\r\nimport { toMapAsync } from \"./../async/_private/toMapAsync.js\";\r\nimport { toObject } from \"./../async/_private/toObject.js\";\r\nimport { toObjectAsync } from \"./../async/_private/toObjectAsync.js\";\r\nimport { toSet } from \"./../async/_private/toSet.js\";\r\nimport { union } from \"./../async/_private/union.js\";\r\nimport { unionAsync } from \"./../async/_private/unionAsync.js\";\r\nimport { where } from \"./../async/_private/where.js\";\r\nimport { whereAsync } from \"./../async/_private/whereAsync.js\";\r\nimport { zip } from \"./../async/_private/zip.js\";\r\nimport { zipAsync } from \"./../async/_private/zipAsync.js\";\r\nexport const bindLinqAsync = (object) => {\r\n const prototype = object.prototype;\r\n const bind = (func, key) => {\r\n const wrapped = function (...params) {\r\n return func(this, ...params);\r\n };\r\n Object.defineProperty(wrapped, \"length\", { value: func.length - 1 });\r\n prototype[key] = wrapped;\r\n };\r\n bind(aggregate, \"aggregate\");\r\n bind(all, \"all\");\r\n bind(allAsync, \"allAsync\");\r\n bind(any, \"any\");\r\n bind(anyAsync, \"anyAsync\");\r\n bind(asParallel, \"asParallel\");\r\n bind(average, \"average\");\r\n bind(averageAsync, \"averageAsync\");\r\n bind(chunk, \"chunk\");\r\n bind(concatenate, \"concatenate\");\r\n bind(contains, \"contains\");\r\n bind(containsAsync, \"containsAsync\");\r\n bind(count, \"count\");\r\n bind(countAsync, \"countAsync\");\r\n bind(defaultIfEmpty, \"defaultIfEmpty\");\r\n bind(distinct, \"distinct\");\r\n bind(distinctAsync, \"distinctAsync\");\r\n bind(each, \"each\");\r\n bind(eachAsync, \"eachAsync\");\r\n bind(elementAt, \"elementAt\");\r\n bind(elementAtOrDefault, \"elementAtOrDefault\");\r\n bind(except, \"except\");\r\n bind(exceptAsync, \"exceptAsync\");\r\n bind(first, \"first\");\r\n bind(firstAsync, \"firstAsync\");\r\n bind(firstOrDefault, \"firstOrDefault\");\r\n bind(firstOrDefaultAsync, \"firstOrDefaultAsync\");\r\n bind(groupBy, \"groupBy\");\r\n bind(groupByAsync, \"groupByAsync\");\r\n bind(groupByWithSel, \"groupByWithSel\");\r\n bind(groupJoin, \"groupJoin\");\r\n bind(groupJoinAsync, \"groupJoinAsync\");\r\n bind(intersect, \"intersect\");\r\n bind(intersectAsync, \"intersectAsync\");\r\n bind(join, \"joinByKey\");\r\n bind(last, \"last\");\r\n bind(lastAsync, \"lastAsync\");\r\n bind(lastOrDefault, \"lastOrDefault\");\r\n bind(lastOrDefaultAsync, \"lastOrDefaultAsync\");\r\n bind(max, \"max\");\r\n bind(maxAsync, \"maxAsync\");\r\n bind(min, \"min\");\r\n bind(minAsync, \"minAsync\");\r\n bind(ofType, \"ofType\");\r\n bind(orderBy, \"orderBy\");\r\n bind(orderByAsync, \"orderByAsync\");\r\n bind(orderByDescending, \"orderByDescending\");\r\n bind(orderByDescendingAsync, \"orderByDescendingAsync\");\r\n bind(partition, \"partition\");\r\n bind(partitionAsync, \"partitionAsync\");\r\n bind(reverse, \"reverse\");\r\n bind(select, \"select\");\r\n bind(selectAsync, \"selectAsync\");\r\n bind(selectMany, \"selectMany\");\r\n bind(selectManyAsync, \"selectManyAsync\");\r\n bind(sequenceEquals, \"sequenceEquals\");\r\n bind(sequenceEqualsAsync, \"sequenceEqualsAsync\");\r\n bind(single, \"single\");\r\n bind(singleAsync, \"singleAsync\");\r\n bind(singleOrDefault, \"singleOrDefault\");\r\n bind(singleOrDefaultAsync, \"singleOrDefaultAsync\");\r\n bind(skip, \"skip\");\r\n bind(skipWhile, \"skipWhile\");\r\n bind(skipWhileAsync, \"skipWhileAsync\");\r\n bind(sum, \"sum\");\r\n bind(sumAsync, \"sumAsync\");\r\n bind(take, \"take\");\r\n bind(takeWhile, \"takeWhile\");\r\n bind(takeWhileAsync, \"takeWhileAsync\");\r\n bind(toArray, \"toArray\");\r\n bind(toMap, \"toMap\");\r\n bind(toMapAsync, \"toMapAsync\");\r\n bind(toObject, \"toObject\");\r\n bind(toObjectAsync, \"toObjectAsync\");\r\n bind(toSet, \"toSet\");\r\n bind(union, \"union\");\r\n bind(unionAsync, \"unionAsync\");\r\n bind(where, \"where\");\r\n bind(whereAsync, \"whereAsync\");\r\n bind(zip, \"zip\");\r\n bind(zipAsync, \"zipAsync\");\r\n};\r\n","import { aggregate } from \"./../parallel/_private/aggregate.js\";\r\nimport { all } from \"./../parallel/_private/all.js\";\r\nimport { allAsync } from \"./../parallel/_private/allAsync.js\";\r\nimport { any } from \"./../parallel/_private/any.js\";\r\nimport { anyAsync } from \"./../parallel/_private/anyAsync.js\";\r\nimport { asAsync } from \"./../parallel/_private/asAsync.js\";\r\nimport { average } from \"./../parallel/_private/average.js\";\r\nimport { averageAsync } from \"./../parallel/_private/averageAsync.js\";\r\nimport { chunk } from \"./../parallel/_private/chunk.js\";\r\nimport { concatenate } from \"../parallel/_private/concatenate.js\";\r\nimport { contains } from \"./../parallel/_private/contains.js\";\r\nimport { containsAsync } from \"./../parallel/_private/containsAsync.js\";\r\nimport { count } from \"./../parallel/_private/count.js\";\r\nimport { countAsync } from \"./../parallel/_private/countAsync.js\";\r\nimport { defaultIfEmpty } from \"./../parallel/_private/defaultIfEmpty.js\";\r\nimport { distinct } from \"./../parallel/_private/distinct.js\";\r\nimport { distinctAsync } from \"./../parallel/_private/distinctAsync.js\";\r\nimport { each } from \"./../parallel/_private/each.js\";\r\nimport { eachAsync } from \"./../parallel/_private/eachAsync.js\";\r\nimport { elementAt } from \"./../parallel/_private/elementAt.js\";\r\nimport { elementAtOrDefault } from \"./../parallel/_private/elementAtOrDefault.js\";\r\nimport { except } from \"./../parallel/_private/except.js\";\r\nimport { exceptAsync } from \"./../parallel/_private/exceptAsync.js\";\r\nimport { first } from \"./../parallel/_private/first.js\";\r\nimport { firstAsync } from \"./../parallel/_private/firstAsync.js\";\r\nimport { firstOrDefault } from \"./../parallel/_private/firstOrDefault.js\";\r\nimport { firstOrDefaultAsync } from \"./../parallel/_private/firstOrDefaultAsync.js\";\r\nimport { groupBy } from \"./../parallel/_private/groupBy.js\";\r\nimport { groupByAsync } from \"./../parallel/_private/groupByAsync.js\";\r\nimport { groupByWithSel } from \"./../parallel/_private/groupByWithSel.js\";\r\nimport { groupJoin } from \"./../parallel/_private/groupJoin.js\";\r\nimport { groupJoinAsync } from \"./../parallel/_private/groupJoinAsync.js\";\r\nimport { intersect } from \"./../parallel/_private/intersect.js\";\r\nimport { intersectAsync } from \"./../parallel/_private/intersectAsync.js\";\r\nimport { join } from \"./../parallel/_private/join.js\";\r\nimport { last } from \"./../parallel/_private/last.js\";\r\nimport { lastAsync } from \"./../parallel/_private/lastAsync.js\";\r\nimport { lastOrDefault } from \"./../parallel/_private/lastOrDefault.js\";\r\nimport { lastOrDefaultAsync } from \"./../parallel/_private/lastOrDefaultAsync.js\";\r\nimport { max } from \"./../parallel/_private/max.js\";\r\nimport { maxAsync } from \"./../parallel/_private/maxAsync.js\";\r\nimport { min } from \"./../parallel/_private/min.js\";\r\nimport { minAsync } from \"./../parallel/_private/minAsync.js\";\r\nimport { ofType } from \"./../parallel/_private/ofType.js\";\r\nimport { orderBy } from \"./../parallel/_private/orderBy.js\";\r\nimport { orderByAsync } from \"./../parallel/_private/orderByAsync.js\";\r\nimport { orderByDescending } from \"./../parallel/_private/orderByDescending.js\";\r\nimport { orderByDescendingAsync } from \"./../parallel/_private/orderByDescendingAsync.js\";\r\nimport { partition } from \"./../parallel/_private/partition.js\";\r\nimport { partitionAsync } from \"./../parallel/_private/partitionAsync.js\";\r\nimport { reverse } from \"./../parallel/_private/reverse.js\";\r\nimport { select } from \"./../parallel/_private/select.js\";\r\nimport { selectAsync } from \"./../parallel/_private/selectAsync.js\";\r\nimport { selectMany } from \"./../parallel/_private/selectMany.js\";\r\nimport { selectManyAsync } from \"./../parallel/_private/selectManyAsync.js\";\r\nimport { sequenceEquals } from \"./../parallel/_private/sequenceEquals.js\";\r\nimport { sequenceEqualsAsync } from \"./../parallel/_private/sequenceEqualsAsync.js\";\r\nimport { single } from \"./../parallel/_private/single.js\";\r\nimport { singleAsync } from \"./../parallel/_private/singleAsync.js\";\r\nimport { singleOrDefault } from \"./../parallel/_private/singleOrDefault.js\";\r\nimport { singleOrDefaultAsync } from \"./../parallel/_private/singleOrDefaultAsync.js\";\r\nimport { skip } from \"./../parallel/_private/skip.js\";\r\nimport { skipWhile } from \"./../parallel/_private/skipWhile.js\";\r\nimport { skipWhileAsync } from \"./../parallel/_private/skipWhileAsync.js\";\r\nimport { sum } from \"./../parallel/_private/sum.js\";\r\nimport { sumAsync } from \"./../parallel/_private/sumAsync.js\";\r\nimport { take } from \"./../parallel/_private/take.js\";\r\nimport { takeWhile } from \"./../parallel/_private/takeWhile.js\";\r\nimport { takeWhileAsync } from \"./../parallel/_private/takeWhileAsync.js\";\r\nimport { toArray } from \"./../parallel/_private/toArray.js\";\r\nimport { toMap } from \"./../parallel/_private/toMap.js\";\r\nimport { toMapAsync } from \"./../parallel/_private/toMapAsync.js\";\r\nimport { toObject } from \"./../parallel/_private/toObject.js\";\r\nimport { toObjectAsync } from \"./../parallel/_private/toObjectAsync.js\";\r\nimport { toSet } from \"./../parallel/_private/toSet.js\";\r\nimport { union } from \"./../parallel/_private/union.js\";\r\nimport { unionAsync } from \"./../parallel/_private/unionAsync.js\";\r\nimport { where } from \"./../parallel/_private/where.js\";\r\nimport { whereAsync } from \"./../parallel/_private/whereAsync.js\";\r\nimport { zip } from \"./../parallel/_private/zip.js\";\r\nimport { zipAsync } from \"./../parallel/_private/zipAsync.js\";\r\nexport const bindLinqParallel = (object) => {\r\n const prototype = object.prototype;\r\n const bind = (func, key) => {\r\n const wrapped = function (...params) {\r\n return func(this, ...params);\r\n };\r\n Object.defineProperty(wrapped, \"length\", { value: func.length - 1 });\r\n prototype[key] = wrapped;\r\n };\r\n bind(aggregate, \"aggregate\");\r\n bind(all, \"all\");\r\n bind(allAsync, \"allAsync\");\r\n bind(any, \"any\");\r\n bind(anyAsync, \"anyAsync\");\r\n bind(asAsync, \"asAsync\");\r\n bind(average, \"average\");\r\n bind(averageAsync, \"averageAsync\");\r\n bind(chunk, \"chunk\");\r\n bind(concatenate, \"concatenate\");\r\n bind(contains, \"contains\");\r\n bind(containsAsync, \"containsAsync\");\r\n bind(count, \"count\");\r\n bind(countAsync, \"countAsync\");\r\n bind(defaultIfEmpty, \"defaultIfEmpty\");\r\n bind(distinct, \"distinct\");\r\n bind(distinctAsync, \"distinctAsync\");\r\n bind(each, \"each\");\r\n bind(eachAsync, \"eachAsync\");\r\n bind(elementAt, \"elementAt\");\r\n bind(elementAtOrDefault, \"elementAtOrDefault\");\r\n bind(except, \"except\");\r\n bind(exceptAsync, \"exceptAsync\");\r\n bind(first, \"first\");\r\n bind(firstAsync, \"firstAsync\");\r\n bind(firstOrDefault, \"firstOrDefault\");\r\n bind(firstOrDefaultAsync, \"firstOrDefaultAsync\");\r\n bind(groupBy, \"groupBy\");\r\n bind(groupByAsync, \"groupByAsync\");\r\n bind(groupByWithSel, \"groupByWithSel\");\r\n bind(groupJoin, \"groupJoin\");\r\n bind(groupJoinAsync, \"groupJoinAsync\");\r\n bind(groupJoin, \"groupJoin\");\r\n bind(groupJoinAsync, \"groupJoinAsync\");\r\n bind(intersect, \"intersect\");\r\n bind(intersectAsync, \"intersectAsync\");\r\n bind(join, \"joinByKey\");\r\n bind(last, \"last\");\r\n bind(lastAsync, \"lastAsync\");\r\n bind(lastOrDefault, \"lastOrDefault\");\r\n bind(lastOrDefaultAsync, \"lastOrDefaultAsync\");\r\n bind(max, \"max\");\r\n bind(maxAsync, \"maxAsync\");\r\n bind(min, \"min\");\r\n bind(minAsync, \"minAsync\");\r\n bind(ofType, \"ofType\");\r\n bind(orderBy, \"orderBy\");\r\n bind(orderByAsync, \"orderByAsync\");\r\n bind(orderByDescending, \"orderByDescending\");\r\n bind(orderByDescendingAsync, \"orderByDescendingAsync\");\r\n bind(partition, \"partition\");\r\n bind(partitionAsync, \"partitionAsync\");\r\n bind(reverse, \"reverse\");\r\n bind(select, \"select\");\r\n bind(selectAsync, \"selectAsync\");\r\n bind(selectMany, \"selectMany\");\r\n bind(selectManyAsync, \"selectManyAsync\");\r\n bind(sequenceEquals, \"sequenceEquals\");\r\n bind(sequenceEqualsAsync, \"sequenceEqualsAsync\");\r\n bind(single, \"single\");\r\n bind(singleAsync, \"singleAsync\");\r\n bind(singleOrDefault, \"singleOrDefault\");\r\n bind(singleOrDefaultAsync, \"singleOrDefaultAsync\");\r\n bind(skip, \"skip\");\r\n bind(skipWhile, \"skipWhile\");\r\n bind(skipWhileAsync, \"skipWhileAsync\");\r\n bind(sum, \"sum\");\r\n bind(sumAsync, \"sumAsync\");\r\n bind(take, \"take\");\r\n bind(takeWhile, \"takeWhile\");\r\n bind(takeWhileAsync, \"takeWhileAsync\");\r\n bind(toArray, \"toArray\");\r\n bind(toMap, \"toMap\");\r\n bind(toMapAsync, \"toMapAsync\");\r\n bind(toObject, \"toObject\");\r\n bind(toObjectAsync, \"toObjectAsync\");\r\n bind(toSet, \"toSet\");\r\n bind(union, \"union\");\r\n bind(unionAsync, \"unionAsync\");\r\n bind(where, \"where\");\r\n bind(whereAsync, \"whereAsync\");\r\n bind(zip, \"zip\");\r\n bind(zipAsync, \"zipAsync\");\r\n};\r\n","import { ArgumentOutOfRangeException, ErrorString, InvalidOperationException } from \"../shared/index.js\";\r\nimport { ArrayEnumerable } from \"../sync/ArrayEnumerable.js\";\r\nimport { BasicEnumerable } from \"../sync/BasicEnumerable.js\";\r\nexport const bindArrayEnumerable = () => {\r\n var _a;\r\n const { prototype } = ArrayEnumerable;\r\n const propertyNames = Object.getOwnPropertyNames(BasicEnumerable.prototype);\r\n for (const prop of propertyNames) {\r\n prototype[prop] = (_a = prototype[prop]) !== null && _a !== void 0 ? _a : BasicEnumerable.prototype[prop];\r\n }\r\n prototype.all = function (predicate) {\r\n return this.every(predicate);\r\n };\r\n prototype.any = function (predicate) {\r\n if (predicate) {\r\n return this.some(predicate);\r\n }\r\n else {\r\n return this.length !== 0;\r\n }\r\n };\r\n prototype.count = function (predicate) {\r\n if (predicate) {\r\n let count = 0;\r\n for (let i = 0; i < this.length; i++) {\r\n if (predicate(this[i]) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n }\r\n else {\r\n return this.length;\r\n }\r\n };\r\n prototype.elementAt = function (index) {\r\n if (index < 0 || index >= this.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n return this[index];\r\n };\r\n prototype.elementAtOrDefault = function (index) {\r\n return this[index] || null;\r\n };\r\n prototype.first = function (predicate) {\r\n if (predicate) {\r\n const value = this.find(predicate);\r\n if (value === undefined) {\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n else {\r\n return value;\r\n }\r\n }\r\n else {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return this[0];\r\n }\r\n };\r\n prototype.firstOrDefault = function (predicate) {\r\n if (predicate) {\r\n const value = this.find(predicate);\r\n if (value === undefined) {\r\n return null;\r\n }\r\n else {\r\n return value;\r\n }\r\n }\r\n else {\r\n return this.length === 0 ? null : this[0];\r\n }\r\n };\r\n prototype.last = function (predicate) {\r\n if (predicate) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n else {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return this[this.length - 1];\r\n }\r\n };\r\n prototype.lastOrDefault = function (predicate) {\r\n if (predicate) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n }\r\n else {\r\n return this.length === 0 ? null : this[this.length - 1];\r\n }\r\n };\r\n prototype.max = function (selector) {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n if (selector) {\r\n let max = Number.NEGATIVE_INFINITY;\r\n for (let i = 0; i < this.length; i++) {\r\n max = Math.max(selector(this[i]), max);\r\n }\r\n return max;\r\n }\r\n else {\r\n return Math.max.apply(null, this);\r\n }\r\n };\r\n prototype.min = function (selector) {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n if (selector) {\r\n let min = Number.POSITIVE_INFINITY;\r\n for (let i = 0; i < this.length; i++) {\r\n min = Math.min(selector(this[i]), min);\r\n }\r\n return min;\r\n }\r\n else {\r\n return Math.min.apply(null, this);\r\n }\r\n };\r\n prototype.reverse = function () {\r\n Array.prototype.reverse.apply(this);\r\n return this;\r\n };\r\n};\r\n","import { Api } from \"../../Api\";\r\nimport { Status } from \"../../DataFrame\";\r\nimport { IDIService } from \"../../IDIService\";\r\nimport { FieldChangeResult, ResponseResult } from \"../FieldChangeResult\";\r\nimport { ChannelsGroupsService } from \"./ChannelsGroupsService\";\r\nimport { DeviceChannel } from \"./DeviceChannel\";\r\nimport { DevicesService } from \"./DevicesService\";\r\nimport { IDevice } from \"./IDevice\";\r\nimport { IDeviceChannel } from \"./IDeviceChannel\";\r\nimport { IDevicesService } from \"./IDevicesService\";\r\n\r\nexport interface IChannelsGroupsService extends IDIService {\r\n WaitForSynchronizationAsync(): Promise<void>;\r\n RemoveGroupAsync(group: IChannelsGroup): Promise<Status>;\r\n RemoveGroupByGuidAsync(groupGuid: string): Promise<Status>;\r\n GetGroupByGuid(guid: string): IChannelsGroup | null;\r\n GetGroupsAsync(): Promise<IChannelsGroup[]>;\r\n\r\n AddDeviceChannelToGroupAsync(channel: IDeviceChannel, group: IChannelsGroup): Promise<Status>;\r\n AddDeviceChannelToGroupByGuidAsync(channel: IDeviceChannel, groupGuid: string): Promise<Status>;\r\n\r\n RemoveDeviceChannelFromGroupAsync(channel: IDeviceChannel, group: IChannelsGroup): Promise<Status>;\r\n RemoveDeviceChannelFromGroupByGuidAsync(channel: IDeviceChannel, groupGuid: string): Promise<Status>;\r\n\r\n AddNewGroupAsync(name: string): Promise<IChannelsGroup | ResponseResult<AddNewGroupErrorCode>>;\r\n UpsertGroupWithDevicesChannelsAsync(group: IChannelsGroup, deviceChannels: IDeviceChannel[]): Promise<IChannelsGroup | ResponseResult<AddNewGroupErrorCode>>;\r\n UpdateGroupWithDevicesChannelsAsync(groupGuid: string, deviceChannels: IDeviceChannel[]): Promise<Status>;\r\n\r\n ChangeGroupNameAsync(group: IChannelsGroup, name: string): Promise<ResponseResult<AddNewGroupErrorCode>>;\r\n ChangeGroupNameByGuidAsync(groupGuid: string, name: string): Promise<ResponseResult<AddNewGroupErrorCode>>;\r\n}\r\n\r\nexport enum AddNewGroupErrorCode\r\n{\r\n Success = \"Success\",\r\n NoPermissions = \"NoPermissions\",\r\n NameToShort = \"NameToShort\",\r\n NameAlreadyExists = \"NameAlreadyExists\",\r\n OtherError = \"OtherError\",\r\n UnknownError = \"UnknownError\"\r\n}\r\n\r\nexport interface IChannelsGroup {\r\n get Guid(): string;\r\n get Name(): string;\r\n GetDevicesChannelsInGroupAsync(): Promise<IDeviceChannel[]>;\r\n ChangeNameAsync(name: string): Promise<ResponseResult<AddNewGroupErrorCode>>;\r\n}\r\n\r\nexport class ChannelsGroup implements IChannelsGroup {\r\n\r\n async GetDevicesChannelsInGroupAsync(): Promise<IDeviceChannel[]> {\r\n let channels: IDeviceChannel[] = [];\r\n\r\n for (let device of await Api.Get<IDevicesService>(DevicesService.ServiceName).GetDevicesAsync()) {\r\n for (let channel of device.Channels.where(channel => channel.ChannelGroups.any(group => group === this._guid))) {\r\n channels.push(channel);\r\n }\r\n }\r\n \r\n return channels;\r\n }\r\n private _guid: string = \"\";\r\n private _name: string = \"\";\r\n\r\n get Guid(): string {\r\n return this._guid;\r\n }\r\n\r\n set Guid(value: string) {\r\n this._guid = value;\r\n }\r\n\r\n get Name(): string {\r\n return this._name;\r\n }\r\n\r\n set Name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n ChangeNameAsync(name: string): Promise<ResponseResult<AddNewGroupErrorCode>> {\r\n return Api.Get<IChannelsGroupsService>(ChannelsGroupsService.ServiceName).ChangeGroupNameAsync(this, name);\r\n }\r\n}","import { Api } from \"../../Api\";\r\nimport { DataFrame, Method, Status } from \"../../DataFrame\";\r\nimport { ExalusConnectionService } from \"../ExalusConnectionService\";\r\nimport { FieldChangeResult, FieldChangeResultType, ResponseResult } from \"../FieldChangeResult\";\r\nimport { IExalusConnectionService } from \"../IExalusConnectionService\";\r\nimport { ISessionService } from \"../Session/ISessionService\";\r\nimport { SessionService } from \"../Session/SessionService\";\r\nimport { IWebApiCacheService } from \"../WebApi/IWebApiCacheService\";\r\nimport { WebApiCacheService } from \"../WebApi/WebApiCacheService\";\r\nimport { DeviceChannel } from \"./DeviceChannel\";\r\nimport { AddNewGroupErrorCode, ChannelsGroup, IChannelsGroup, IChannelsGroupsService } from \"./IChannelsGroupsService\";\r\nimport { IDeviceChannel } from \"./IDeviceChannel\";\r\nimport { ILoggerService } from '../Logging/ILoggerService';\r\nimport { LoggerService } from \"../Logging/LoggerService\";\r\nimport { DevicesService } from './DevicesService';\r\nimport { IDevicesService } from './IDevicesService';\r\n\r\nexport class ChannelsGroupsService implements IChannelsGroupsService {\r\n public static readonly ServiceName: string = \"ChannelsGroupsService\";\r\n private _connection: IExalusConnectionService | null = null;\r\n private _synchronized: boolean = false;\r\n private _synchronizationTaskCompletionSource: Promise<void> | null = null;\r\n private _groups: IChannelsGroup[] = [];\r\n\r\n public constructor() {\r\n this._connection = Api.Get<IExalusConnectionService>(ExalusConnectionService.ServiceName);\r\n this._synchronizationTaskCompletionSource = new Promise<void>((resolve) => {\r\n Api.Get<ISessionService>(SessionService.ServiceName).OnUserLoggedInEvent().Subscribe(async user => {\r\n await this.SyncGroups();\r\n resolve();\r\n this._synchronized = true;\r\n });\r\n });\r\n }\r\n\r\n private async SyncGroups() {\r\n this._groups = await this.GetGroupsAsync();\r\n }\r\n\r\n async AddDeviceChannelToGroupByGuidAsync(channel: IDeviceChannel, groupGuid: string): Promise<Status> {\r\n const req = new AddDeviceChannelToGroupRequest();\r\n (req.Data as AddRemoveDeviceChannelToGroup).Channel = channel.Number;\r\n let device = (channel as DeviceChannel).GetDevice();\r\n\r\n if (device == null)\r\n throw new Error(\"Device is not set on this channel!\");\r\n\r\n (req.Data as AddRemoveDeviceChannelToGroup).DeviceGuid = (channel as DeviceChannel).GetDevice()?.Guid as string;\r\n (req.Data as AddRemoveDeviceChannelToGroup).GroupGuid = groupGuid;\r\n\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n\r\n if (result != null && result.Status != null) {\r\n if (result.Status == Status.OK)\r\n channel.ChannelGroups.push(groupGuid);\r\n\r\n return result.Status;\r\n }\r\n\r\n return Status.Error;\r\n }\r\n\r\n async RemoveDeviceChannelFromGroupByGuidAsync(channel: IDeviceChannel, groupGuid: string): Promise<Status> {\r\n const req = new RemoveDeviceChannelToGroupRequest();\r\n\r\n let device = (channel as DeviceChannel).GetDevice();\r\n\r\n if (device == null)\r\n throw new Error(\"Device is not set on this channel!\");\r\n\r\n (req.Data as AddRemoveDeviceChannelToGroup).DeviceGuid = (channel as DeviceChannel).GetDevice()?.Guid as string;\r\n (req.Data as AddRemoveDeviceChannelToGroup).Channel = channel.Number;\r\n (req.Data as AddRemoveDeviceChannelToGroup).GroupGuid = groupGuid;\r\n\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n\r\n if (result != null && result.Status != null) {\r\n if (result.Status == Status.OK)\r\n (channel as DeviceChannel).ChannelGroups = channel.ChannelGroups.where(a => a != groupGuid).toArray();\r\n\r\n return result.Status;\r\n }\r\n\r\n return Status.Error;\r\n }\r\n\r\n async UpsertGroupWithDevicesChannelsAsync(group: IChannelsGroup, deviceChannels: IDeviceChannel[]): Promise<ResponseResult<AddNewGroupErrorCode> | IChannelsGroup> {\r\n if (this._groups.all(g => g.Guid != group.Guid)) {\r\n let result = await this.AddNewGroupAsync(group.Name);\r\n\r\n if (result instanceof ChannelsGroup)\r\n group = result as ChannelsGroup;\r\n else if (result instanceof ResponseResult)\r\n return result;\r\n else\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, \"\");\r\n }\r\n\r\n /// add devices channels to groups that are not already in groups\r\n for (let channel of deviceChannels.where(a => a.ChannelGroups.all(b => b !== group.Guid))) {\r\n let status = await this.AddDeviceChannelToGroupAsync(channel, group);\r\n\r\n if (status !== Status.OK) {\r\n Api.Get<ILoggerService>(LoggerService.ServiceName).Error(ChannelsGroupsService.ServiceName, `Failed to add device channel ${channel.Name} to group ${group.Name}, controller responded with error ${status}`);\r\n\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, `Failed to add device channel ${channel.Name} to group ${group.Name}, controller responded with error ${status}`);\r\n }\r\n }\r\n\r\n let devices = await Api.Get<IDevicesService>(DevicesService.ServiceName).GetDevicesAsync();\r\n\r\n for (let device of devices) {\r\n for (let channel of device.Channels.except(deviceChannels, (a, b) => a.GetDevice().Guid == b.GetDevice().Guid && a.Number == b.Number)) {\r\n for (var gr of channel.ChannelGroups.where(gr => group.Guid == gr)) {\r\n let status = await this.RemoveDeviceChannelFromGroupAsync(channel, group);\r\n\r\n if (status !== Status.OK) {\r\n Api.Get<ILoggerService>(LoggerService.ServiceName).Error(ChannelsGroupsService.ServiceName, `Failed to remove device channel ${channel.Name} from group ${group.Name}, controller responded with error ${status}`);\r\n\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, `Failed to remove device channel ${channel.Name} from group ${group.Name}, controller responded with error ${status}`);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return group;\r\n }\r\n\r\n async UpdateGroupWithDevicesChannelsAsync(groupGuid: string, deviceChannels: IDeviceChannel[]): Promise<Status> {\r\n /// add devices channels to groups that are not already in groups\r\n for (let channel of deviceChannels.where(a => a.ChannelGroups.all(b => b !== groupGuid))) {\r\n let status = await this.AddDeviceChannelToGroupByGuidAsync(channel, groupGuid);\r\n if (status !== Status.OK) {\r\n Api.Get<ILoggerService>(LoggerService.ServiceName).Error(ChannelsGroupsService.ServiceName, `Failed to add device channel ${channel.Name} to group ${groupGuid}, controller responded with error ${status}`);\r\n return Status.FatalError;\r\n }\r\n }\r\n\r\n let devices = await Api.Get<IDevicesService>(DevicesService.ServiceName).GetDevicesAsync();\r\n\r\n for (let device of devices) {\r\n for (let channel of device.Channels.except(deviceChannels, (a, b) => a.GetDevice().Guid == b.GetDevice().Guid && a.Number == b.Number)) {\r\n for (var gr of channel.ChannelGroups.where(gr => groupGuid == gr)) {\r\n let status = await this.RemoveDeviceChannelFromGroupByGuidAsync(channel, groupGuid);\r\n if (status !== Status.OK) {\r\n Api.Get<ILoggerService>(LoggerService.ServiceName).Error(ChannelsGroupsService.ServiceName, `Failed to add device channel ${channel.Name} to group ${groupGuid}, controller responded with error ${status}`);\r\n return Status.FatalError;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return Status.OK;\r\n }\r\n\r\n async ChangeGroupNameByGuidAsync(groupGuid: string, name: string): Promise<ResponseResult<AddNewGroupErrorCode>> {\r\n let req = new AddUpdateChannelsGroupsRequest();\r\n let gr = new ApiGroupObject();\r\n gr.Guid = groupGuid;\r\n gr.Name = name;\r\n req.Data?.push(gr);\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n this._groups = await this.GetGroupsAsync();\r\n\r\n if (result != null && result.Status != null) {\r\n switch (result.Status) {\r\n case Status.OK:\r\n return new ResponseResult(AddNewGroupErrorCode.Success, \"\");\r\n\r\n case Status.WrongData:\r\n switch (result.Data) {\r\n case \"NameToShort\":\r\n return new ResponseResult(AddNewGroupErrorCode.NameToShort, \"At least 3 characters required\");\r\n\r\n case \"NameAlreadyExists\":\r\n return new ResponseResult(AddNewGroupErrorCode.NameAlreadyExists, \"Group with this name already exists\");\r\n\r\n default:\r\n return new ResponseResult(AddNewGroupErrorCode.OtherError, `Response error: ${result.Status} data: ${result.Data}`);\r\n }\r\n\r\n default:\r\n return new ResponseResult(AddNewGroupErrorCode.OtherError, `Response error: ${result.Status} data: ${result.Data}`);\r\n }\r\n }\r\n\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, \"\");\r\n }\r\n\r\n GetServiceName(): string {\r\n return ChannelsGroupsService.ServiceName;\r\n }\r\n\r\n WaitForSynchronizationAsync(): Promise<void> {\r\n return this._synchronizationTaskCompletionSource as Promise<void>;\r\n }\r\n\r\n GetGroupByGuid(guid: string): IChannelsGroup | null {\r\n return this._groups.first(a => a.Guid === guid);\r\n }\r\n\r\n ChangeGroupNameAsync(group: IChannelsGroup, name: string): Promise<ResponseResult<AddNewGroupErrorCode>> {\r\n return this.ChangeGroupNameByGuidAsync(group.Guid, name);\r\n }\r\n\r\n RemoveGroupAsync(group: IChannelsGroup): Promise<Status> {\r\n return this.RemoveGroupByGuidAsync(group.Guid);\r\n\r\n }\r\n\r\n async RemoveGroupByGuidAsync(groupGuid: string): Promise<Status> {\r\n let req = new RemoveGroupRequest();\r\n req.Data = groupGuid;\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n await this.SyncGroups();\r\n\r\n for (let device of await Api.Get<IDevicesService>(DevicesService.ServiceName).GetDevicesAsync()) {\r\n for (let channel of device.Channels) {\r\n if (channel.ChannelGroups.any(a => a === groupGuid)) {\r\n (channel as DeviceChannel).ChannelGroups = channel.ChannelGroups.except(groupGuid, (a, b) => a === b).toArray();\r\n }\r\n }\r\n }\r\n\r\n if (result != null && result.Status != null)\r\n return result?.Status;\r\n\r\n return Status.Error;\r\n }\r\n\r\n async GetGroupsAsync(): Promise<IChannelsGroup[]> {\r\n const result = await this._connection?.SendAndWaitForResponseAsync<ApiGroupObject[]>(new GetGroupsRequest(), 15000, false);\r\n let groups: ChannelsGroup[] = [];\r\n\r\n switch (result?.Status) {\r\n case Status.OK:\r\n let log = Api.Get<ILoggerService>(LoggerService.ServiceName);\r\n result.Data?.forEach(group => {\r\n let gr = new ChannelsGroup();\r\n gr.Guid = group.Guid;\r\n gr.Name = group.Name;\r\n log.Info(ChannelsGroupsService.ServiceName, `Got group: ${group.Name} ${group.Guid}`);\r\n groups.push(gr);\r\n\r\n });\r\n return groups;\r\n\r\n default:\r\n throw new Error(`Failed to get groups, API responded with status ${result?.Status} data: ${result?.Data}`);\r\n }\r\n }\r\n\r\n AddDeviceChannelToGroupAsync(channel: IDeviceChannel, group: IChannelsGroup): Promise<Status> {\r\n return this.AddDeviceChannelToGroupByGuidAsync(channel, group.Guid);\r\n }\r\n\r\n RemoveDeviceChannelFromGroupAsync(channel: IDeviceChannel, group: IChannelsGroup): Promise<Status> {\r\n return this.RemoveDeviceChannelFromGroupByGuidAsync(channel, group.Guid);\r\n }\r\n\r\n async AddNewGroupAsync(name: string): Promise<IChannelsGroup | ResponseResult<AddNewGroupErrorCode>> {\r\n let req = new AddUpdateChannelsGroupsRequest();\r\n let gr = new ApiGroupObject();\r\n gr.Name = name;\r\n req.Data?.push(gr);\r\n const result = await this._connection?.SendAndWaitForResponseAsync<any>(req, 15000, false);\r\n Api.Get<IWebApiCacheService>(WebApiCacheService.ServiceName).ClearCache();\r\n this._groups = await this.GetGroupsAsync();\r\n\r\n if (result != null && result.Status != null) {\r\n switch (result.Status) {\r\n case Status.OK:\r\n return this._groups.first(a => a.Name === name);\r\n break;\r\n\r\n case Status.WrongData:\r\n switch (result.Data) {\r\n case \"NameToShort\":\r\n return new ResponseResult(AddNewGroupErrorCode.NameToShort, \"At least 3 characters required\");\r\n\r\n case \"NameAlreadyExists\":\r\n return new ResponseResult(AddNewGroupErrorCode.NameAlreadyExists, \"Group with this name already exists\");\r\n\r\n default:\r\n return new ResponseResult(AddNewGroupErrorCode.OtherError, `Response error: ${result.Status} data: ${result.Data}`);\r\n }\r\n\r\n default:\r\n return new ResponseResult(AddNewGroupErrorCode.OtherError, `Response error: ${result.Status} data: ${result.Data}`);\r\n }\r\n }\r\n\r\n return new ResponseResult(AddNewGroupErrorCode.UnknownError, \"\");\r\n }\r\n}\r\n\r\nclass RemoveGroupRequest extends DataFrame<string>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/groups/group\";\r\n this.Method = Method.Delete;\r\n }\r\n}\r\n\r\nclass GetGroupsRequest extends DataFrame<string>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/groups/\";\r\n this.Method = Method.Get;\r\n }\r\n}\r\n\r\nclass AddUpdateChannelsGroupsRequest extends DataFrame<ApiGroupObject[]>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/groups/group\";\r\n this.Method = Method.Put;\r\n this.Data = [];\r\n }\r\n}\r\n\r\nclass AddDeviceChannelToGroupRequest extends DataFrame<AddRemoveDeviceChannelToGroup>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/device/channel/groups/group/\";\r\n this.Method = Method.Put;\r\n this.Data = new AddRemoveDeviceChannelToGroup();\r\n }\r\n}\r\n\r\nclass RemoveDeviceChannelToGroupRequest extends DataFrame<AddRemoveDeviceChannelToGroup>\r\n{\r\n constructor() {\r\n super();\r\n this.Resource = \"/devices/device/channel/groups/group/\";\r\n this.Method = Method.Delete;\r\n this.Data = new AddRemoveDeviceChannelToGroup();\r\n }\r\n}\r\n\r\nclass ApiGroupObject {\r\n Id: number = 0;\r\n Guid: string = \"\";\r\n Name: string = \"\";\r\n}\r\n\r\nclass AddRemoveDeviceChannelToGroup {\r\n GroupGuid: string = \"\";\r\n DeviceGuid: string = \"\";\r\n Channel: number = 0;\r\n}","export class AsyncLock {\r\n\tprivate _promise: Promise<void> = Promise.resolve();\r\n\tprivate _disable = () => { };\r\n\r\n\tpublic Lock(): void {\r\n\t\tthis._promise = new Promise(resolve => this._disable = resolve);\r\n\t}\r\n\r\n\tpublic Unlock(): void {\r\n\t\tthis._disable();\r\n\t}\r\n\r\n\tpublic WaitForLockAsync(): Promise<void> {\r\n\t\treturn this._promise;\r\n\t}\r\n}","import { AsyncLock } from \"../AsyncLock\";\r\nimport { DependencyContainer } from \"../DependencyContainer\";\r\nimport { Event, IEvent } from \"../Event\";\r\nimport { IAppStateService } from \"./IAppStateService\";\r\n\r\nexport class AppStateService implements IAppStateService {\r\n\t//// BLOCK DISCONNECTION WHEN PENDING REQUESTS\r\n\tprivate _syncLock: AsyncLock = new AsyncLock();\r\n\tprivate _isInFouces: boolean = true;\r\n\tprivate _canHibernate: boolean = true;\r\n\tprivate _returnedFromSuspension: boolean = false;\r\n\tpublic static readonly ServiceName: string = \"AppStateService\";\r\n\tprivate _onReturnedFromSuspensionEvent: Event = new Event();\r\n\tprivate _onSuspendedEvent: Event = new Event();\r\n\tprivate _onEnterLowPowerModeEvent: Event = new Event();\r\n\tprivate _onExitLowPowerModeEvent: Event = new Event();\r\n\tprivate _onBackButtonPressedEvent: Event = new Event();\r\n\tprivate _onForwardButtonPressedEvent: Event = new Event();\r\n\r\n\r\n\tpublic _constructor() {\r\n\t\tif (navigator.userAgent.match(/Safari/i) != null && !navigator.mediaDevices) {\r\n\t\t\twindow.addEventListener(\"onblur\", () => {\r\n\t\t\t\tif (!this._isInFouces)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tthis._isInFouces = false;\r\n\t\t\t\tthis.Suspend();\r\n\t\t\t});\r\n\r\n\t\t\twindow.addEventListener(\"onfocus\", () => {\r\n\t\t\t\tif (this._isInFouces)\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\tthis._isInFouces = true;\r\n\t\t\t\tthis.ReturnFromSuspension();\r\n\t\t\t})\r\n\t\t}\r\n\t\telse {\r\n\t\t\twindow.addEventListener(\"visibilitychange\", async () => {\r\n\t\t\t\tawait this._syncLock.WaitForLockAsync();\r\n\t\t\t\tthis._syncLock.Lock();\r\n\r\n\t\t\t\tif (this.IsHidden())\r\n\t\t\t\t\tthis.Suspend();\r\n\t\t\t\telse\r\n\t\t\t\t\tthis.ReturnFromSuspension();\r\n\r\n\t\t\t\tthis._syncLock.Unlock();\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tSuspend(): void {\r\n\t\tif (!this.IsHibernationAllowed())\r\n\t\t\treturn;\r\n\r\n\t\tthis._returnedFromSuspension = false;\r\n\t\tthis._onSuspendedEvent.Invoke();\r\n\r\n\t\tDependencyContainer.Log?.Warning(AppStateService.ServiceName, \"App switched to background\");\r\n\t}\r\n\r\n\tReturnFromSuspension(): void {\r\n\t\tif (!this.IsHibernationAllowed())\r\n\t\t\treturn;\r\n\r\n\t\tthis._returnedFromSuspension = true;\r\n\t\tthis._onReturnedFromSuspensionEvent.Invoke();\r\n\r\n\t\tDependencyContainer.Log?.Warning(AppStateService.ServiceName, \"App switched to foreground\");\r\n\t}\r\n\r\n\tEnterLowPowerMode(): void {\r\n\t\tthis._onEnterLowPowerModeEvent.Invoke();\r\n\t}\r\n\r\n\tExitLowPowerMode(): void {\r\n\t\tthis._onExitLowPowerModeEvent.Invoke();\r\n\t}\r\n\r\n\tIsWorkingInWebView(): boolean {\r\n\t\t/// for apple devices\r\n\t\tif (navigator.userAgent.match(/Safari/i) != null) {\r\n\t\t\t/// normally iOS WebView does not support mediaDevices like in Safari or other browsers\r\n\t\t\tif (navigator.mediaDevices)\r\n\t\t\t\treturn false;\r\n\t\t\telse\r\n\t\t\t\treturn true;\r\n\t\t}\r\n\t\t/// for Android WebView\r\n\t\telse if (window.hasOwnProperty('Android ')) {\r\n\t\t\t// is android web view\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\t// is not android web view\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tprivate IsHidden(): boolean {\r\n\t\treturn document.hidden;\r\n\t}\r\n\r\n\tIsActive(): boolean {\r\n\t\treturn !this.IsHidden();\r\n\t}\r\n\r\n\tIsInBackground(): boolean {\r\n\t\treturn this.IsHidden();\r\n\t}\r\n\r\n\tReturnedFromSuspension(): boolean {\r\n\t\treturn this._returnedFromSuspension;\r\n\t}\r\n\r\n\tIsHibernationAllowed(): boolean {\r\n\t\treturn this._canHibernate;\r\n\t}\r\n\r\n\tDisallowHibernation(): void {\r\n\t\tthis._canHibernate = false;\r\n\t}\r\n\r\n\tAllowHibernation(): void {\r\n\t\tthis._canHibernate = true;\r\n\t}\r\n\r\n\tOnReturnedFromSuspension(): IEvent {\r\n\t\treturn this._onReturnedFromSuspensionEvent;\r\n\t}\r\n\r\n\tOnSuspended(): IEvent {\r\n\t\treturn this._onSuspendedEvent;\r\n\t}\r\n\r\n\tOnEnterLowPowerMode(): IEvent {\r\n\t\treturn this._onEnterLowPowerModeEvent;\r\n\t}\r\n\r\n\tOnExitLowPowerMode(): IEvent {\r\n\t\treturn this._onExitLowPowerModeEvent;\r\n\t}\r\n\r\n\tOnBackButtonPressed(): IEvent {\r\n\t\treturn this._onBackButtonPressedEvent;\r\n\t}\r\n\r\n\tOnForwardButtonPressed(): IEvent {\r\n\t\treturn this._onForwardButtonPressedEvent;\r\n\t}\r\n\r\n\tGetServiceName(): string {\r\n\t\treturn AppStateService.ServiceName;\r\n\t}\r\n}","import { bindArray } from \"./bindArray.js\";\r\nimport { bindString } from \"./bindString.js\";\r\nimport { bindLinq } from \"./bindLinq.js\";\r\nexport const initializeLinq = () => {\r\n bindLinq(Map);\r\n bindLinq(Set);\r\n bindString();\r\n bindArray(Array);\r\n bindArray(Int8Array);\r\n bindArray(Int16Array);\r\n bindArray(Int32Array);\r\n bindArray(Uint8Array);\r\n bindArray(Uint8ClampedArray);\r\n bindArray(Uint16Array);\r\n bindArray(Uint32Array);\r\n bindArray(Float32Array);\r\n bindArray(Float64Array);\r\n};\r\n","import { ArgumentOutOfRangeException, ErrorString, InvalidOperationException } from \"../shared/index.js\";\r\nimport { BasicEnumerable } from \"../sync/BasicEnumerable.js\";\r\nexport const bindString = () => {\r\n var _a;\r\n const prototype = String.prototype;\r\n const propertyNames = Object.getOwnPropertyNames(BasicEnumerable.prototype);\r\n for (const prop of propertyNames) {\r\n prototype[prop] = (_a = prototype[prop]) !== null && _a !== void 0 ? _a : BasicEnumerable.prototype[prop];\r\n }\r\n prototype.first = function (predicate) {\r\n if (predicate) {\r\n for (let i = 0; i < this.length; i++) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return this[0];\r\n };\r\n prototype.firstOrDefault = function (predicate) {\r\n if (predicate) {\r\n for (let i = 0; i < this.length; i++) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n }\r\n return this.length === 0 ? null : this[0];\r\n };\r\n prototype.count = function (predicate) {\r\n if (predicate) {\r\n let count = 0;\r\n for (let i = 0; i < this.length; i++) {\r\n if (predicate(this[i]) === true) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n }\r\n else {\r\n return this.length;\r\n }\r\n };\r\n prototype.elementAt = function (index) {\r\n if (index < 0 || index >= this.length) {\r\n throw new ArgumentOutOfRangeException(\"index\");\r\n }\r\n return this[index];\r\n };\r\n prototype.elementAtOrDefault = function (index) {\r\n return this[index] || null;\r\n };\r\n prototype.last = function (predicate) {\r\n if (predicate) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n throw new InvalidOperationException(ErrorString.NoMatch);\r\n }\r\n else {\r\n if (this.length === 0) {\r\n throw new InvalidOperationException(ErrorString.NoElements);\r\n }\r\n return this[this.length - 1];\r\n }\r\n };\r\n prototype.lastOrDefault = function (predicate) {\r\n if (predicate) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n const value = this[i];\r\n if (predicate(value) === true) {\r\n return value;\r\n }\r\n }\r\n return null;\r\n }\r\n else {\r\n return this.length === 0 ? null : this[this.length - 1];\r\n }\r\n };\r\n prototype.reverse = function () {\r\n const outer = this;\r\n function* generator() {\r\n for (let i = outer.length - 1; i >= 0; i--) {\r\n yield outer[i];\r\n }\r\n }\r\n return new BasicEnumerable(generator);\r\n };\r\n};\r\n","import { DependencyContainer } from \"./DependencyContainer\";\r\nimport { IDIService } from \"./IDIService\";\r\nimport { CancelationTokenSource } from './CancelationTokenSource';\r\nimport { LocalStorageService } from \"./Services/LocalStorageService\";\r\nimport { ExalusConnectionService } from './Services/ExalusConnectionService';\r\nimport { WebApiCacheService } from \"./Services/WebApi/WebApiCacheService\";\r\nimport { UsersService } from \"./Services/Users/UsersService\";\r\nimport { DevicesService } from \"./Services/Devices/DevicesService\";\r\nimport { SessionService } from \"./Services/Session/SessionService\";\r\nimport { GeolocationService } from \"./Services/Controller/GeolocationService\";\r\nimport { ControllerConfigurationService } from \"./Services/Controller/ControllerConfigurationService\";\r\n// 0. Import Module\r\nimport { initializeLinq, IEnumerable } from \"linq-to-typescript\"\r\nimport { ChannelsGroupsService } from \"./Services/Devices/ChannelsGroupsService\";\r\nimport { AppStateService } from \"./Services/AppStateService\";\r\n// 1. Declare that the JS types implement the IEnumerable interface\r\ndeclare global {\r\n interface Array<T> extends IEnumerable<T> { }\r\n interface Uint8Array extends IEnumerable<number> { }\r\n interface Uint8ClampedArray extends IEnumerable<number> { }\r\n interface Uint16Array extends IEnumerable<number> { }\r\n interface Uint32Array extends IEnumerable<number> { }\r\n interface Int8Array extends IEnumerable<number> { }\r\n interface Int16Array extends IEnumerable<number> { }\r\n interface Int32Array extends IEnumerable<number> { }\r\n interface Float32Array extends IEnumerable<number> { }\r\n interface Float64Array extends IEnumerable<number> { }\r\n interface Map<K, V> extends IEnumerable<[K, V]> { }\r\n interface Set<T> extends IEnumerable<T> { }\r\n interface String extends IEnumerable<string> { }\r\n}\r\n// 2. Bind Linq Functions to Array, Map, etc\r\ninitializeLinq();\r\n\r\nexport class Api {\r\n static WorksInContextOf: string = \"\";\r\n static Version: number = 1.0;\r\n\r\n static Init(): void {\r\n if (DependencyContainer.IsInitialized)\r\n return;\r\n\r\n let dep = DependencyContainer.Instance;\r\n\r\n try {\r\n dep.RegisterService(new LocalStorageService());\r\n dep.RegisterService(new AppStateService());\r\n dep.RegisterService(new WebApiCacheService());\r\n dep.RegisterService(new SessionService());\r\n dep.RegisterService(new ExalusConnectionService());\r\n dep.RegisterService(new GeolocationService());\r\n dep.RegisterService(new ControllerConfigurationService());\r\n dep.RegisterService(new UsersService());\r\n dep.RegisterService(new DevicesService());\r\n dep.RegisterService(new ChannelsGroupsService());\r\n }\r\n catch (ex: any) {\r\n console.error(ex);\r\n }\r\n }\r\n\r\n static GetAsync<T extends IDIService>(classType: string, cancelationToken?: CancelationTokenSource): Promise<T> {\r\n return DependencyContainer.Instance.GetServiceAsync<T>(classType, cancelationToken);\r\n }\r\n\r\n static GetWithTimeoutAsync<T extends IDIService>(classType: string, timeout: number): Promise<T> {\r\n return DependencyContainer.Instance.GetServiceWithTimeoutAsync<T>(classType, timeout);\r\n }\r\n\r\n static Get<T extends IDIService>(classType: string): T {\r\n return DependencyContainer.Instance.GetService<T>(classType);\r\n }\r\n\r\n static SleepForAsync(miliseconds: number): Promise<void> {\r\n return new Promise(resolve => setTimeout(resolve, miliseconds));\r\n }\r\n}"],"names":["LogLevel","__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","this","Function","e","window","obj","prop","prototype","hasOwnProperty","call","TypedEvent","handlers","Subscribe","handler","push","Unsubscribe","filter","h","Invoke","data","slice","forEach","ex","DependencyContainer","Error","LoggerService","_blockedServices","_logLevel","Debug","IsBlocked","service","undefined","any","a","DisableLogsFrom","name","all","ServiceName","EnableLogsFrom","where","toArray","level","GetServiceName","GetTimeStamp","date","Date","getHours","getMinutes","getSeconds","getMilliseconds","Warning","contextClassType","message","Info","console","warn","error","info","debug","Log","log","_services","_serviceRegistrationEvent","Instance","_instance","RegisterService","IsInitialized","GetService","serviceName","GetServiceAsync","token","Promise","resolve","reject","sub","onCancel","CancellationEvent","GetServiceWithTimeoutAsync","timeout","timeoutId","GetClassName","clearTimeout","setTimeout","LocalStorageService","GetResourceName","inContextOf","objectId","Api","WorksInContextOf","Remove","localStorage","removeItem","DropStorage","prefix","startsWith","Save","setItem","JSON","stringify","Read","getItem","parse","DEFAULT_RETRY_DELAYS_IN_MILLISECONDS","DefaultReconnectPolicy","constructor","retryDelays","_retryDelays","nextRetryDelayInMilliseconds","retryContext","previousRetryCount","HeaderNames","Authorization","Cookie","HttpResponse","statusCode","statusText","content","HttpClient","url","options","send","method","post","delete","getCookieString","AccessTokenHttpClient","innerClient","accessTokenFactory","super","_innerClient","_accessTokenFactory","async","request","allowRetry","_accessToken","indexOf","_setAuthorizationHeader","response","headers","HttpError","errorMessage","trueProto","__proto__","TimeoutError","AbortError","UnsupportedTransportError","transport","errorType","DisabledTransportError","FailedToStartTransportError","FailedToNegotiateWithServerError","AggregateErrors","innerErrors","HttpTransportType","TransferFormat","MessageType","HubConnectionState","NullLogger","_message","instance","Arg","static","val","match","values","Platform","isBrowser","document","isWebWorker","self","isReactNative","isNode","getDataDetail","includeContent","detail","isArrayBuffer","byteLength","view","Uint8Array","str","num","toString","substr","length","formatArrayBuffer","ArrayBuffer","sendMessage","logger","transportName","httpClient","value","getUserAgentHeader","logMessageContent","responseType","withCredentials","SubjectSubscription","subject","observer","_subject","_observer","dispose","index","observers","splice","cancelCallback","catch","_","ConsoleLogger","minimumLogLevel","_minLevel","out","logLevel","msg","toISOString","userAgentHeaderName","constructUserAgent","getOsName","getRuntimeVersion","version","os","runtime","runtimeVersion","userAgent","majorAndMinor","split","process","platform","versions","node","getErrorString","stack","FetchHttpClient","_logger","fetch","requireFunc","_jar","CookieJar","_fetchType","bind","getGlobalThis","AbortController","_abortControllerType","abortSignal","aborted","abortController","onabort","abort","msTimeout","body","cache","credentials","mode","redirect","signal","ok","deserializeContent","status","payload","cookies","getCookies","c","join","arrayBuffer","text","XhrHttpClient","xhr","XMLHttpRequest","open","setRequestHeader","keys","header","onload","responseText","onerror","ontimeout","DefaultHttpClient","_httpClient","_isAborted","LongPollingTransport","_pollAbort","_options","_running","onreceive","onclose","pollAborted","transferFormat","isRequired","isIn","_url","Binary","pollOptions","pollUrl","now","_closeError","_receiving","_poll","_raiseOnClose","deleteOptions","logMessage","ServerSentEventsTransport","accessToken","encodeURIComponent","eventSource","opened","Text","EventSource","onmessage","_close","onopen","_eventSource","stop","close","WebSocketTransport","webSocketConstructor","_logMessageContent","_webSocketConstructor","_headers","webSocket","replace","binaryType","_event","_webSocket","event","ErrorEvent","readyState","OPEN","_isCloseEvent","wasClean","code","reason","HttpConnection","_stopPromiseResolver","features","_negotiateVersion","baseUrl","_resolveUrl","webSocketModule","eventSourceModule","WebSocket","_connectionState","_connectionStarted","_startInternalPromise","_startInternal","_stopPromise","_sendQueue","TransportSendQueue","_stopInternal","_stopError","_stopConnection","skipNegotiation","WebSockets","_constructTransport","_startTransport","negotiateResponse","redirects","_getNegotiationResponse","ProtocolVersion","_createTransport","inherentKeepAlive","negotiateUrl","_resolveNegotiateUrl","negotiateVersion","connectionToken","connectionId","_createConnectUrl","requestedTransport","requestedTransferFormat","connectUrl","_isITransport","transportExceptions","transports","availableTransports","negotiate","endpoint","transportOrError","_resolveTransportOrError","ServerSentEvents","LongPolling","connect","actualTransport","transportMatches","transferFormats","map","s","lastIndexOf","aTag","createElement","href","substring","_transport","_buffer","_executing","_sendBufferedData","PromiseSource","_transportResult","_sendLoopPromise","_sendLoop","_bufferData","promise","transportResult","_concatBuffers","arrayBuffers","totalLength","b","reduce","result","offset","item","set","buffer","_resolver","_rejecter","TextMessageFormat","output","RecordSeparator","input","messages","pop","RecordSeparatorCode","String","fromCharCode","HandshakeProtocol","writeHandshakeRequest","handshakeRequest","write","parseHandshakeResponse","messageData","remainingData","binaryData","separatorIndex","responseLength","apply","Array","textData","type","Subject","next","err","complete","subscribe","HubConnection","connection","protocol","reconnectPolicy","_nextKeepAlive","_freezeEventListener","serverTimeoutInMilliseconds","keepAliveIntervalInMilliseconds","_protocol","_reconnectPolicy","_handshakeProtocol","_processIncomingData","_connectionClosed","_callbacks","_methods","_closedCallbacks","_reconnectingCallbacks","_reconnectedCallbacks","_invocationId","_receivedHandshakeResponse","Disconnected","_cachedPingMessage","writeMessage","Ping","state","Reconnecting","start","_startPromise","_startWithStateTransitions","Connecting","addEventListener","Connected","_stopDuringStartError","handshakePromise","_handshakeResolver","_handshakeRejecter","_sendMessage","_cleanupTimeout","_resetTimeoutPeriod","_resetKeepAliveInterval","_cleanupPingTimer","startPromise","Disconnecting","_reconnectDelayHandle","_completeClose","stream","methodName","args","streams","streamIds","_replaceStreamingParams","invocationDescriptor","_createStreamInvocation","promiseQueue","cancelInvocation","_createCancelInvocation","invocationId","then","_sendWithProtocol","invocationEvent","Completion","_launchStreams","sendPromise","_createInvocation","invoke","on","newMethod","toLowerCase","off","removeIdx","callback","onreconnecting","onreconnected","_processHandshakeResponse","parseMessages","Invocation","_invokeClientMethod","StreamItem","Close","allowReconnect","responseMessage","getTime","_timeoutHandle","serverTimeout","_pingServerHandle","nextPing","invocationMessage","target","methods","_createCompletionMessage","methodsCopy","expectsResponse","res","exception","completionMessage","m","prevRes","arguments","_cancelCallbacksWithError","_reconnect","removeEventListener","reconnectStartTime","previousReconnectAttempts","retryError","nextRetryDelay","_getNextRetryDelay","elapsedMilliseconds","retryReason","callbacks","nonblocking","streamId","_createStreamItemMessage","i","argument","_isObservable","arg","StreamInvocation","id","CancelInvocation","JsonHubProtocol","hubMessages","parsedMessage","_isInvocationMessage","_isStreamItemMessage","_isCompletionMessage","_assertNotEmptyString","LogLevelNameMapping","trace","information","warning","critical","none","HubConnectionBuilder","configureLogging","logging","mapping","parseLogLevel","withUrl","transportTypeOrOptions","isNotEmpty","httpConnectionOptions","withHubProtocol","withAutomaticReconnect","retryDelaysOrReconnectPolicy","isArray","build","create","Helpers","d","d2","performance","r","Math","random","floor","DataFrame","TransactionId","GenerateUUID","Method","ConnectionType","ConnectionResult","ConnectionState","Localization","LoginError","Status","Gender","AccessLevel","AuthorizationInfo","serialNumber","pin","SerialNumber","PIN","Event","_log","Get","User","_guid","_cloudGuid","_name","_surname","_phone","_email","_isAccountOnline","_isAccountActive","_isAccountBanned","_notificationChannels","_gender","_accessLevel","_localization","En_Us","Guid","CloudGuid","Name","Surname","Phone","Email","IsAccountOnline","IsActive","IsBanned","NotificationChannels","SessionService","_onUserLoggedInEvent","_onUserLoggedOutEvent","_password","_loginTaskCompletionSource","CreateSessionCompletionSourceAsync","_alreadySubsribedToNetworkEvents","_user","onUserLoggedIn","user","OnUserLoggedInEvent","RestoreSessionAsync","UserLogInAsync","WaitForSessionCreationAsync","OnUserLoggedOutEvent","UserLogOutAsync","logoutRequest","Resource","Put","ExalusConnectionService","SendAndWaitForResponseAsync","OnConnectionStateChanged","connectionState","Failed","email","password","LoginUserRequest","Data","OnConnectionStateChangedEvent","WrongAuthData","UserLoginData","Password","ControllerConfigurationService","_connection","_session","_localStorage","_onEnteredConfigurationEvent","_onExitedConfigurationEvent","_onConfigurationTimeCheckedEvent","_configurationTime","_appEnteredConfigurationMode","_didConfigurationChange","_synchronizationTaskCompletionSource","CheckIfConfigurationHasChangedAsync","OnDataReceivedEvent","DidCofigurationChangeAsync","GetLastKnownConfigurationChangeTime","SaveLastConfigurationChangeTime","time","EnterConfigurationModeAsync","EntryConfigurationModeRequest","ExitConfigurationModeAsync","ExitConfigurationModeRequest","OnEnteredConfigurationEvent","OnExitedConfigurationEvent","OnConfigurationTimeCheckedEvent","GetLastConfigurationChangeTimeAsync","LastChangeTimeRequest","WebApiCacheService","_localStorageService","Cache","GetCache","tmp","ClearCache","_logPackets","_disconnectedOnPurpose","_defaultPacketsBrokerAddress","_serversBrokerAddress","_address","_isEstabilished","_timeout","_dataReceivedEvent","_pongReceivedEvent","_authorizationReceivedEvent","_registrationReceivedEvent","_connectionStateChangedEvent","_errorOccuredEvent","_controllerConfiguration","_cache","_packetsBrokerServers","EnablePacketsLogging","DisablePacketsLogging","InitializeConnection","_serialId","_PIN","SetServersBrokerAddress","address","SetDefaultPacketsBrokerAddress","GetServerAddressAsync","ConnectAsync","connectAsync","AuthorizeAsync","authorizationInfo","ConnectAndAuthorizeAsync","packetsBroker","conResult","AuthorizationFailed","ControllerIsNotConnected","server","DisconnectAsync","FailedToConnect","FireConnectionStateChanged","sender","dataReceivedEvent","connectionEvent","IsConnected","dataFrame","useCache","logTransmission","SendAndWaitForResponseWithRepeatAsync","repeat","startTime","onReceivedFrame","receivedFrame","difference","SendAsync","OnErrorOccuredEvent","TaskExecution","DeviceResponseType","TaskExecutionResult","DeviceTaskExecutionResult","ChannelOnOffStateEnum","DoorBellStateEnum","BlindStatusCode","RemoteButtonStateEnum","MeasuredTemperatureTypeEnum","BatteryStateEnum","DetectedObjectStateEnum","MovementStateEnum","BlindRemoteButtonStateEnum","FacadeRemoteButtonStateEnum","LinkQualityEnum","GatePositionTypeEnum","GatewayPositionTypeEnum","BlindCalibrationStatusEnum","HumidityTypeEnum","VibrationTypeEnum","BinarySensorStateEnum","ConfigurationStateEnum","WindThresholdStateEnum","LightThresholdStateEnum","FloodSensorStates","HumidityType","PressureType","FacadeType","TamperProtectionStatus","FieldChangeResultType","ChannelConfigurations","DeviceTaskType","DeviceType","CommunicationWay","DeviceState","StateReliability","UsersService","GetUsersAsync","GetUsersListRequest","users","element","GetUserAsync","CreateUserAsync","UpdateUserAsync","DeleteUserAsync","DeviceTaskTypeInfo","_type","Unknown","_interfaceType","Type","InterfaceType","DeviceResponseTypeInfo","DeviceTasksInfo","DeviceGuid","Channel","NoTasksExecuting","DeviceTaskPairExecutionResult","Device","Task","Result","_data","_typeAsEnum","TypeAsEnum","ChannelOnOffDeviceState","ChannelOnOffState","DoorBellDeviceState","DoorBellState","ReedStateDeviceState","ReedState","BlindPositionDeviceState","BlindPosition","GetBlindStatus","Position","UnableToMove","MotorOverheatedPleaseWait","Working","RemoteButtonDeviceState","RemoteButtonState","LightColorDeviceState","LightColor","LightWarmthDeviceState","LightWarmth","LightBrightnessDeviceState","LightBrightness","MeasuredTemperatureDeviceState","MeasuredTemperature","BatteryDeviceState","BatteryState","MeasuredBrightnessDeviceState","MeasuredBrightness","MeasuredEnergyDeviceState","MeasuredEnergy","MeasuredDistanceDeviceState","MeasuredDistance","MovementSensorDeviceState","MovementSensorState","BlindRemoteButtonDeviceState","BlindRemoteButtonState","FacadeRemoteButtonDeviceState","FacadeRemoteButtonState","SignalStrenghtDeviceState","SignalStrength","GatePositionDeviceState","GatePosition","GatewayPositionDeviceState","GatewayPosition","BlindCalibrationDeviceState","BlindCalibration","HumiditySensorDeviceState","HumiditySensorState","VibrationSensorDeviceState","VibrationSensorState","BinarySensorStateDeviceState","BinarySensorState","ConfigurationDeviceState","ConfigurationState","BlindOpenCloseTimeDeviceState","BlindOpenCloseTime","OvercurrentProtectionDeviceState","OvercurrentProtectionState","OvercurrentProtectionThresholdDeviceState","OvercurrentProtectionThreshold","FacadePositionDeviceState","FacadePosition","FacadeTypeDeviceState","CurrentWindThresholdDeviceState","CurrentWindThreshold","CurrentLightThresholdDeviceState","CurrentLightThreshold","WindSpeedDeviceState","WindSpeedState","FloodSensorDeviceState","FloodSensorState","PressureSensorDeviceState","PressureSensorState","TamperProtectionDeviceState","TamperProtectionState","FieldChangeResult","ResponseResult","_onDeviceStateChangedEvent","_onDeviceTasksExecutionChangedOnChannelsEvent","_serialNumber","_model","_modelGuid","_manufacturerGuid","_isVirtual","_isEnabled","_deviceState","_deviceType","_communicationWay","_availableTasksTypes","_availableResponseTypes","_channels","_states","devicesApi","DevicesService","stateChangedEvent","tasksExecutionChangeEvent","OnDeviceStateChangedEvent","stateChange","State","OnDevicesTasksExecutionChangeEvent","tasks","task","States","RemoveDeviceAsync","ExecuteDeviceTaskAsync","OnDeviceTasksExecutionChangedOnChannelsEvent","guid","ChannelsAmount","_channelsAmount","amount","Model","model","ModelGuid","ManufacturerGuid","manufacturerGuid","IsVirtual","isVirtual","IsEnabled","isEnabled","deviceState","deviceType","communicationWay","AvailableTaskTypes","availableTasksTypes","AvailableResponseTypes","availableResponseTypes","Channels","ChangeDeviceNameAsync","DeviceChannelConfigurationRequest","Changed","NoPermissions","includes","ControllerResponseTimeout","UnknownError","ExecuteTaskAsync","device","DeviceNameData","BlindActionEnum","BlindActionSimpleEnum","FacadeActionEnum","DeviceControlFeature","DeviceChannel","_device","_number","_iconName","_mode","_channelGroups","_isHidden","_onTasksExecutionChangedEvent","SetDevice","newState","GetDevice","GetChannelConfigurationData","ChannelConfigurationData","ChannelName","Configuration","GroupsGuids","Hidden","IconName","HideAsync","ChangeConfigurationAsync","ShowAsync","ChangeNameAsync","ChangeIconNameAsync","ChangeGroupsAsync","groups","configuration","WrongData","Number","Mode","ChannelGroups","IsHidden","OnTasksExecutionChangeEvent","SetGeolocationResponseCode","_devices","_onDevicesTasksChangedEvent","_onDeviceFoundEvent","_onDeviceRegisteredEvent","_onDeviceRemovedEvent","_fastStatesSync","_synchronized","_synchronizedDevicesStates","_deviceStatesSynchronizationTaskCompletionSource","GetPairedDevicesAsync","WaitForSynchronizationAsync","SyncDevicesStatesAsync","frame","ParseDeviceTaskInfo","MapApiDevices","devices","st","MapApiDeviceStateToDeviceState","channel","WaitForDevicesStatesSynchronizationAsync","GetCurrentlyRunningTaksAsync","GetRunningDevicesTasksRequest","devicesTasks","taskChannelPair","pair","ExecutingTasks","DataType","GetDevicesStatesRequest","syncStatesRequest","SyncDevicesStatesRequest","OnDeviceRegisteredEvent","OnDeviceRemovedEvent","OnDeviceFoundEvent","devicesObjects","DeviceName","ChannelsNumber","DeviceSerialNumber","DeviceModelGuid","DeviceModel","AvailableTasks","typeInfo","AvailableResponses","ChannelsConfiguration","ch","GetDevicesListRequest","GetDevicesAsync","GetFoundDevicesAsync","GetFoundDevicesRequest","find","FindDevicesAsync","SearchForDevicesRequest","StopSearchingForDevices","StopSearchingForDevicesRequest","RegisterDeviceAsync","req","DevicePairRequest","Executed","DeviceUnpairRequest","MapDeviceTaskToDeviceTaskInfo","t","DeviceTaskInfo","tsk","FeatureType","Temperature","Brightness","LightColorTaskInfo","ts","R","G","B","Action","Open","Stop","Percentage","FacadePositionTaskInfo","fp","FacadeAction","Tilt","ControlFeature","TaskType","ExecuteDeviceTaskRequest","DeviceNotFound","DeviceResponseTimeout","ExecuteDevicesTasksAsync","results","tasksPair","position","SequnceExecutionOrder","ExecuteDevicesTasksRequest","responsePosition","pos","Post","Coordinates","Longitude","Latitude","CoordinatesWithSourceInfo","IsNetworkBased","GeolocationService","IsControllerGeolocationSetAsync","IsGeolocationSetRequest","GetCurrentGeolocationAsync","navigator","geolocation","getCurrentPosition","SetControllerGeolocationAsync","location","SetCoordinatesRequest","OK","UserIsNotLoggedIn","GetControlllerGeolocationAsync","GetSetCoordinatesRequest","RangeError","paramName","ErrorString","freeze","MoreThanOneElement","MoreThanOneMatchingElement","NoElements","NoMatch","InvalidOperationException","StrictEqualityComparer","x","y","iterator","Symbol","asyncIterator","dataFunc","generator","bindArray","jsArray","_a","arrayEnumerablePrototype","bindToPrototype","propertyNames","getOwnPropertyNames","aggregate","source","seedOrFunc","func","resultSelector","ReferenceError","aggregate3","aggregate2","aggregate1","aggregateValue","seed","predicate","allAsync","any2","any1","anyAsync","fromAsync","promisesOrIterable","asAsync","fromParallel","asParallel","array","average","selector","count","averageAsync","chunk","size","yieldChunk","concatenate","first","second","contains","comparer","containsAsync","count2","count1","countAsync","defaultIfEmpty","defaultValue","found","distinct","distinctElements","distinctAsync","outerLoop","distinctElement","each","action","eachAsync","elementAt","elementAtOrDefault","except","secondArray","firstItem","exists","j","exceptAsync","secondItem","first2","first1","done","firstAsync","firstOrDefault","firstOrDefault2","firstOrDefault1","firstOrDefaultAsync","Grouping","startingItem","groupBy","keySelector","iterable","keyMap","group","keyValue","groupBy_0","grouping","groupBy_0_Simple","groupByAsync","groupByAsync_0","groupByAsync_0_Simple","groupByWithSel","elementSelector","groupBy_1","groupBy_1_Simple","groupJoin","outer","inner","outerKeySelector","innerKeySelector","groupJoinWithComparer","groupJoinSimple","innerKeyMap","innerValue","record","outerValue","innerRecord","Map","groupJoinAsync","intersect","firstResults","secondResults","firstValue","intersectAsync","secondValue","innerArray","outerKey","innerKey","last","last2","last1","lastItem","lastAsync","lastOrDefault","lastOrDefault2","lastOrDefault1","lastOrDefaultAsync","max","max2","max1","maxItem","NEGATIVE_INFINITY","maxAsync","min","min2","min1","minItem","POSITIVE_INFINITY","minAsync","ofType","typeCheck","asAsyncSortedKeyValuesSync","ascending","currentMapping","asAsyncKeyMapSync","sortedKeys","sort","asSortedKeyValuesSync","asKeyMapSync","OrderedAsyncEnumerable","orderedPairs","orderedPair","asAsyncKeyMap","asAsyncSortedKeyValues","asKeyMap","asSortedKeyValues","thenBy","generate","thenByAsync","generateAsync","thenByDescending","thenByDescendingAsync","asSortedKeyValuesAsync","asKeyMapAsync","OrderedEnumerable","orderBy","orderByAsync","orderByDescending","orderByDescendingAsync","partition","fail","pass","partitionAsync","reverse","select1","select2","select3","selectAsync","selectAsync1","selectAsync2","selectAsync3","selectMany","selectMany1","selectMany2","selectMany3","selectorValue","selectManyAsync","selectManyAsync1","selectManyAsync2","innerValues","sequenceEquals","firstIterator","secondIterator","firstResult","secondResult","sequenceEqualsAsync","single","single2","single1","hasValue","singleValue","singleAsync","singleOrDefault","singleOrDefault2","singleOrDefault1","singleOrDefaultAsync","skip","skipWhile","skipWhile1","skipWhile2","skipWhileAsync","skipWhileAsync1","skipWhileAsync2","sum","sum2","sum1","total","sumAsync","take","amountLeft","takeWhile","takeWhile1","takeWhile2","takeWhileAsync","takeWhileAsync1","takeWhileAsync2","toMap","toMapAsync","toObject","toObjectAsync","toSet","Set","union","union2","union1","has","add","resultValue","unionAsync","where1","where2","whereAsync","whereAsync1","whereAsync2","zip","zip2","zip1","zipAsync","bindLinq","object","wrapped","params","firstElement","groupBy1","groupBy1Simple","minValue","many","firstNext","secondNext","nextIteration","onfulfilled","convValues","previousData","newPromises","nextIter","nextIterationAsync","promises","resolvedCount","typeDataToArray","selectedValue","arrayOfPromises","chunks","promiseOfPromises","promiseToArray","firstData","secondData","some","totalCount","countPromise","isPromise","typeData","firstValues","secondValues","resultValues","typedData","resultPromises","outerArray","maxInfo","filteredValues","OrderedParallelEnumerable","asyncVals","passed","nextIterationWithIndex","nextIterationWithIndexAsync","keyOrSelector","valuesArray","firstArray","returnedValues","totalSum","sPredicate","keyValues","secondPromise","valuesAsync","keep","left","right","minLength","bindLinqAsync","bindLinqParallel","every","bindArrayEnumerable","AddNewGroupErrorCode","ChannelsGroup","GetDevicesChannelsInGroupAsync","channels","ChannelsGroupsService","ChangeGroupNameAsync","_groups","SyncGroups","GetGroupsAsync","AddDeviceChannelToGroupByGuidAsync","groupGuid","AddDeviceChannelToGroupRequest","GroupGuid","RemoveDeviceChannelFromGroupByGuidAsync","RemoveDeviceChannelToGroupRequest","UpsertGroupWithDevicesChannelsAsync","deviceChannels","AddNewGroupAsync","AddDeviceChannelToGroupAsync","gr","RemoveDeviceChannelFromGroupAsync","UpdateGroupWithDevicesChannelsAsync","ChangeGroupNameByGuidAsync","AddUpdateChannelsGroupsRequest","ApiGroupObject","Success","NameToShort","NameAlreadyExists","OtherError","GetGroupByGuid","RemoveGroupAsync","RemoveGroupByGuidAsync","RemoveGroupRequest","GetGroupsRequest","Delete","AddRemoveDeviceChannelToGroup","Id","AsyncLock","_promise","_disable","Lock","Unlock","WaitForLockAsync","AppStateService","_syncLock","_isInFouces","_canHibernate","_returnedFromSuspension","_onReturnedFromSuspensionEvent","_onSuspendedEvent","_onEnterLowPowerModeEvent","_onExitLowPowerModeEvent","_onBackButtonPressedEvent","_onForwardButtonPressedEvent","_constructor","mediaDevices","Suspend","ReturnFromSuspension","IsHibernationAllowed","EnterLowPowerMode","ExitLowPowerMode","IsWorkingInWebView","hidden","IsInBackground","ReturnedFromSuspension","DisallowHibernation","AllowHibernation","OnReturnedFromSuspension","OnSuspended","OnEnterLowPowerMode","OnExitLowPowerMode","OnBackButtonPressed","OnForwardButtonPressed","bindString","Int8Array","Int16Array","Int32Array","Uint8ClampedArray","Uint16Array","Uint32Array","Float32Array","Float64Array","dep","classType","cancelationToken","miliseconds","Version"],"sourceRoot":""}
|