@c8y/ng1-modules 1018.347.0 → 1018.348.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (558) hide show
  1. package/NOTICES +0 -34
  2. package/aclManagement/controllers/permissionEditorCtrl.js +1 -1
  3. package/actilityProviderSettings/actilityProviderSettings.module.js +1 -1
  4. package/administration-alarmMapping/controllers/alarmMapping.js +1 -1
  5. package/administration-applicationSettings/controllers/applicationSettings.js +1 -1
  6. package/administration-applications/appWizard/appWizardExternalStep.component.js +1 -1
  7. package/administration-applications/appWizard/appWizardSmartAppStep.component.js +1 -1
  8. package/administration-applications/appWizard/appWizardUploadStep.component.js +1 -1
  9. package/administration-applications/appWizard/context-path.directive.js +1 -1
  10. package/administration-applications/application-detail/application-detail.component.js +1 -1
  11. package/administration-applications/application-list-view/application-list-view.component.js +1 -1
  12. package/administration-applications/controllers/applicationAccessEditor.js +1 -1
  13. package/administration-archivesEditor/list.controller.js +1 -1
  14. package/administration-auditLogs/filter.directive.js +1 -1
  15. package/administration-deviceUsers/controllers/deviceUserDetail.js +1 -1
  16. package/administration-homeAdministration/home-administration.component.js +1 -1
  17. package/administration-statistics/controllers/statistics.js +1 -1
  18. package/administration-storageLimitEmail/controllers/storageLimitCtrl.js +1 -1
  19. package/alarms/widget-config.controller.js +1 -1
  20. package/alarms/widget.controller.js +1 -1
  21. package/alarmsEventsExplorer/alarmsEventsTimelinesChart/alarmsEventsTimelinesChart.component.js +1 -1
  22. package/alarmsEventsExplorer/alarmsEventsTimelinesChart/alarmsEventsTimelinesChart.service.js +1 -1
  23. package/alarmsEventsExplorer/alarmsEventsTimelinesConfig/alarmsEventsTimelinesConfigModal.controller.js +1 -1
  24. package/app-logs/app-instance-logs/app-instance-logs.component.js +1 -1
  25. package/app-logs/app-logs/app-logs.component.js +1 -1
  26. package/app-logs/app-logs.service.js +1 -1
  27. package/app-status/app-status/app-status.component.js +1 -1
  28. package/app-status/app-tenant-subscriptions-list/app-tenant-subscriptions-list.component.js +1 -1
  29. package/app-status/index.js +1 -1
  30. package/app-status-ui/index.js +1 -1
  31. package/applicationLinks/applications.controller.js +1 -1
  32. package/asset-notes/assetNotes.service.js +1 -1
  33. package/assetPropertyWidget/main.controller.js +1 -1
  34. package/assetTable/assetTable2/assets.controller.js +1 -1
  35. package/assetTable/assetTable2/assets.service.js +1 -1
  36. package/assetTable/assetTable2/index.js +1 -1
  37. package/assetTable/assetTable2/rendererButton.controller.js +1 -1
  38. package/assetTable/assetTable2/rendererButtonConfig.controller.js +1 -1
  39. package/assetTable/assetTable2/rendererIcon.controller.js +1 -1
  40. package/assetTable/assetTable2/sort.directive.js +1 -1
  41. package/assetTable/assets.controller.js +1 -1
  42. package/assetTable/assetsConfig.controller.js +1 -1
  43. package/assetTable/comparisons.service.js +1 -1
  44. package/assetTable/counterColumns.service.js +1 -1
  45. package/binary-file-download/binary-file-download.component.js +1 -1
  46. package/binary-file-download/binary-file-download.config.js +1 -1
  47. package/binaryArtefactsManagement/controllers/list.js +1 -1
  48. package/binaryArtefactsManagement/index.js +1 -1
  49. package/cell-id-information-activator/cell-id-information-activator.config.js +1 -1
  50. package/cell-id-information-activator/cell-id-information-activator.service.js +1 -1
  51. package/cell-id-usage-statistics/cell-id-usage-statistics.component.js +1 -1
  52. package/cell-id-usage-statistics/cell-id-usage-statistics.service.js +1 -1
  53. package/cockpit-assetCount/services/assetCount.js +1 -1
  54. package/cockpit-cockpitConfig/services/navigator.js +1 -1
  55. package/cockpit-reports/reports.service.js +1 -1
  56. package/cockpit-smartRulesUI/index.js +1 -1
  57. package/commandTemplates/controllers/commandTemplates.js +1 -1
  58. package/configurationRepository/configurationRepository.service.js +1 -1
  59. package/configurationRepository/list.controller.js +1 -1
  60. package/connectivityV2/connectivityV2.component.js +1 -1
  61. package/connectivityV2/connectivityV2.module.js +1 -1
  62. package/connectivityV2/connectivityV2.service.js +1 -1
  63. package/connectivityV2/sms.component.js +1 -1
  64. package/connectivityV2/status.component.js +1 -1
  65. package/core/angularStart.js +1 -1
  66. package/core/bootstrap.js +1 -1
  67. package/core/core/index.js +1 -1
  68. package/core/core/locales.js +1 -1
  69. package/core/core/services/actility.js +1 -1
  70. package/core/core/services/alarms.js +1 -1
  71. package/core/core/services/application.js +1 -1
  72. package/core/core/services/audits.js +1 -1
  73. package/core/core/services/auth.js +1 -1
  74. package/core/core/services/base.js +1 -1
  75. package/core/core/services/binary.js +1 -1
  76. package/core/core/services/binaryCommon.js +1 -1
  77. package/core/core/services/combain.js +1 -1
  78. package/core/core/services/connectivity.js +1 -1
  79. package/core/core/services/counter.js +1 -1
  80. package/core/core/services/deviceBulkControl.js +1 -1
  81. package/core/core/services/deviceControl.js +1 -1
  82. package/core/core/services/deviceGroup.js +1 -1
  83. package/core/core/services/deviceShell.js +1 -1
  84. package/core/core/services/deviceStatus.js +1 -1
  85. package/core/core/services/devices.js +1 -1
  86. package/core/core/services/dynamicGroups.js +1 -1
  87. package/core/core/services/events.js +1 -1
  88. package/core/core/services/geo.js +1 -1
  89. package/core/core/services/groupTypesConfig.js +1 -1
  90. package/core/core/services/groups.js +1 -1
  91. package/core/core/services/identity.js +1 -1
  92. package/core/core/services/inventory.js +1 -1
  93. package/core/core/services/jsonSchemas.js +1 -1
  94. package/core/core/services/kpi.js +1 -1
  95. package/core/core/services/license.js +1 -1
  96. package/core/core/services/loginOptions.js +1 -1
  97. package/core/core/services/measurements.js +1 -1
  98. package/core/core/services/messaging.js +1 -1
  99. package/core/core/services/notifications.js +1 -1
  100. package/core/core/services/permissions.js +1 -1
  101. package/core/core/services/promise.js +1 -1
  102. package/core/core/services/queriesUtil.js +1 -1
  103. package/core/core/services/realtime.js +1 -1
  104. package/core/core/services/realtimeLongPollingTransport.js +1 -1
  105. package/core/core/services/retentions.js +1 -1
  106. package/core/core/services/roles.js +1 -1
  107. package/core/core/services/settings.js +1 -1
  108. package/core/core/services/simulator.js +1 -1
  109. package/core/core/services/smartRestTemplates.js +1 -1
  110. package/core/core/services/statement.js +1 -1
  111. package/core/core/services/statistics.js +1 -1
  112. package/core/core/services/tenant.js +1 -1
  113. package/core/core/services/tfaSettings.js +1 -1
  114. package/core/core/services/tracker.js +1 -1
  115. package/core/core/services/user.js +1 -1
  116. package/core/core/services/userGroup.js +1 -1
  117. package/core/core/services/userPreferences.js +1 -1
  118. package/core/core/services/util.js +1 -1
  119. package/core/index.js +1 -1
  120. package/core/sdk/directives/repeat.js +1 -1
  121. package/core/sdk/providers/cumulocity.js +1 -1
  122. package/core/ui/components/battery/battery.js +1 -1
  123. package/core/ui/components/errorFeedback.js +1 -1
  124. package/core/ui/components/passwordStrengthChecklist.js +1 -1
  125. package/core/ui/components/signalStrength/signal.js +1 -1
  126. package/core/ui/components/timelinesChart.js +1 -1
  127. package/core/ui/configurable-device-list-columns/configurable-columns.service.js +1 -1
  128. package/core/ui/configurable-device-list-columns/modal-columns-configure.component.js +1 -1
  129. package/core/ui/configurable-device-list-columns/unique-by.directive.js +1 -1
  130. package/core/ui/containers/header.component.js +1 -1
  131. package/core/ui/containers/wizard.component.js +1 -1
  132. package/core/ui/containers/wizardSlide.jquery.js +1 -1
  133. package/core/ui/controllers/deviceList.js +1 -1
  134. package/core/ui/controllers/editRetentionRule.js +1 -1
  135. package/core/ui/controllers/eventList.js +1 -1
  136. package/core/ui/controllers/listPagination/listPagination.controller.js +1 -1
  137. package/core/ui/controllers/loginCtrl.js +1 -1
  138. package/core/ui/controllers/radialGauge.js +1 -1
  139. package/core/ui/csvExporter/csv-escape-formulas-option.decorator.js +1 -1
  140. package/core/ui/csvExporter/csvExporter.controller.js +1 -1
  141. package/core/ui/csvExporter/csvExporter.directive.js +1 -1
  142. package/core/ui/csvExporter/csvExporter.service.js +1 -1
  143. package/core/ui/directives/aggregation.js +1 -1
  144. package/core/ui/directives/alarmList.js +1 -1
  145. package/core/ui/directives/appIcon.js +1 -1
  146. package/core/ui/directives/auditList.js +1 -1
  147. package/core/ui/directives/autocomplete.js +1 -1
  148. package/core/ui/directives/binaryInput.js +1 -1
  149. package/core/ui/directives/binaryOut.js +1 -1
  150. package/core/ui/directives/codeEditor.js +1 -1
  151. package/core/ui/directives/dateTimePicker.js +1 -1
  152. package/core/ui/directives/deviceGroupSelector.js +1 -1
  153. package/core/ui/directives/downloadButton.js +1 -1
  154. package/core/ui/directives/editRetentionRule.js +1 -1
  155. package/core/ui/directives/filePicker.js +1 -1
  156. package/core/ui/directives/icon.js +1 -1
  157. package/core/ui/directives/ifAllowed.js +1 -1
  158. package/core/ui/directives/interval.js +1 -1
  159. package/core/ui/directives/linearGauge.js +1 -1
  160. package/core/ui/directives/loadMore.js +1 -1
  161. package/core/ui/directives/map-plugins/geofence-layer.js +1 -1
  162. package/core/ui/directives/map.js +1 -1
  163. package/core/ui/directives/map2.js +1 -1
  164. package/core/ui/directives/max.js +1 -1
  165. package/core/ui/directives/min.js +1 -1
  166. package/core/ui/directives/number.js +1 -1
  167. package/core/ui/directives/phoneNumber.js +1 -1
  168. package/core/ui/directives/pieChart.js +1 -1
  169. package/core/ui/directives/rdbDump.js +1 -1
  170. package/core/ui/directives/realtimeButton.js +1 -1
  171. package/core/ui/directives/renderer.js +1 -1
  172. package/core/ui/directives/scrollLoad.js +1 -1
  173. package/core/ui/directives/silo.js +1 -1
  174. package/core/ui/directives/sunburstChart.js +1 -1
  175. package/core/ui/directives/textOut.js +1 -1
  176. package/core/ui/directives/validateUniqueExternalId.js +1 -1
  177. package/core/ui/fieldbus/fieldbus.service.js +1 -1
  178. package/core/ui/filteringSorting/filteredSortedList.controller.js +1 -1
  179. package/core/ui/filteringSorting/filteringSortingCollections.service.js +1 -1
  180. package/core/ui/filteringSorting/filteringSortingColumns.service.js +1 -1
  181. package/core/ui/filteringSorting/filteringSortingInventoryQueries.service.js +1 -1
  182. package/core/ui/filters/absoluteDate.js +1 -1
  183. package/core/ui/filters/bytes.js +1 -1
  184. package/core/ui/filters/capitalizestring.js +1 -1
  185. package/core/ui/filters/checkForDate.js +1 -1
  186. package/core/ui/filters/dateParts.js +1 -1
  187. package/core/ui/filters/distance.js +1 -1
  188. package/core/ui/filters/duration.js +1 -1
  189. package/core/ui/filters/filter-translate.decorator.js +1 -1
  190. package/core/ui/filters/filterByFields.js +1 -1
  191. package/core/ui/filters/hex.filter.js +1 -1
  192. package/core/ui/filters/humanize2.js +1 -1
  193. package/core/ui/filters/humanizeAppName.js +1 -1
  194. package/core/ui/filters/orderBy-translate.decorator.js +1 -1
  195. package/core/ui/filters/relativedate.js +1 -1
  196. package/core/ui/filters/safeLinks.js +1 -1
  197. package/core/ui/forms/checkDirty.directive.js +1 -1
  198. package/core/ui/forms/hex-input.directive.js +1 -1
  199. package/core/ui/forms/host-address.validator.js +1 -1
  200. package/core/ui/forms/http-protocol.validator.js +1 -1
  201. package/core/ui/forms/model-options.directive.js +1 -1
  202. package/core/ui/forms/regular-expression.validator.js +1 -1
  203. package/core/ui/forms/required-input-placeholder.directive.js +1 -1
  204. package/core/ui/forms/saveButtonFooter.component.js +1 -1
  205. package/core/ui/forms/search.component.js +1 -1
  206. package/core/ui/forms/ssh-key-input.js +1 -1
  207. package/core/ui/forms/uib-dropdown-dropup.directive.js +1 -1
  208. package/core/ui/forms/uib-dropdown.decorator.js +1 -1
  209. package/core/ui/forms/validate-url-segment.validator.js +1 -1
  210. package/core/ui/groups/group-create-and-assign.component.js +1 -1
  211. package/core/ui/header/action-bar.service.js +1 -1
  212. package/core/ui/header/actions.provider.js +1 -1
  213. package/core/ui/index.js +1 -1
  214. package/core/ui/inputDirectives/colorpicker.js +1 -1
  215. package/core/ui/itemSelector/itemSelector.component.js +1 -1
  216. package/core/ui/leaflet/leaflet-directive.decorator.js +1 -1
  217. package/core/ui/lists/list-display-control.component.js +1 -1
  218. package/core/ui/lists/quickLinksList.service.js +1 -1
  219. package/core/ui/locales/locales.provider.js +1 -1
  220. package/core/ui/navigation/breadcrumbs.component.js +1 -1
  221. package/core/ui/navigation/breadcrumbs.provider.js +1 -1
  222. package/core/ui/navigation/tabs.component.js +1 -1
  223. package/core/ui/navigation/tabs.provider.js +1 -1
  224. package/core/ui/notifications/accessDenied.service.js +1 -1
  225. package/core/ui/notifications/alert.controller.js +1 -1
  226. package/core/ui/notifications/alert.service.js +1 -1
  227. package/core/ui/operations/operations-timeline.component.js +1 -1
  228. package/core/ui/properties/children.computedProperty.js +1 -1
  229. package/core/ui/properties/computedProperties.provider.js +1 -1
  230. package/core/ui/properties/configurationSnapshot.computedProperty.js +1 -1
  231. package/core/ui/properties/counters.computedProperty.js +1 -1
  232. package/core/ui/properties/lastDeviceMessage.computedProperty.js +1 -1
  233. package/core/ui/properties/lastMeasurement.computedProperty.js +1 -1
  234. package/core/ui/properties/propertiesLibrary.service.js +1 -1
  235. package/core/ui/properties/propertySelector.controller.js +1 -1
  236. package/core/ui/properties/schemaProperties.service.js +1 -1
  237. package/core/ui/properties/schemaPropertySelector.controller.js +1 -1
  238. package/core/ui/providers/beta.js +1 -1
  239. package/core/ui/providers/httpCache.js +1 -1
  240. package/core/ui/providers/navigator.js +1 -1
  241. package/core/ui/providers/objectActions.js +1 -1
  242. package/core/ui/providers/renderers.js +1 -1
  243. package/core/ui/providers/search.js +1 -1
  244. package/core/ui/providers/views.js +1 -1
  245. package/core/ui/providers/zip.js +1 -1
  246. package/core/ui/roles/roles-matrix.component.js +1 -1
  247. package/core/ui/sanitize-html/sanitize-html.js +1 -1
  248. package/core/ui/sanitize-html/sanitize-html.service.js +1 -1
  249. package/core/ui/schemaForm/deviceGroupIdPicker.config.js +1 -1
  250. package/core/ui/schemaForm/fileUpload.config.js +1 -1
  251. package/core/ui/schemaForm/fileUpload.directive.js +1 -1
  252. package/core/ui/schemaForm/overrides/decorators/decorators.decorator.js +1 -1
  253. package/core/ui/schemaForm/schemaEditor.component.js +1 -1
  254. package/core/ui/schemaForm/schemaForm.component.js +1 -1
  255. package/core/ui/schemaForm/schemaForm.run.js +1 -1
  256. package/core/ui/schemaForm/schemaFormHelper.service.js +1 -1
  257. package/core/ui/schemaForm/schemaPropertyEditor.component.js +1 -1
  258. package/core/ui/services/contextDetailsShared.service.js +1 -1
  259. package/core/ui/services/deviceListColumns.js +1 -1
  260. package/core/ui/services/docs.js +1 -1
  261. package/core/ui/services/groupsHierarchyNavigator.js +1 -1
  262. package/core/ui/services/groupsHierarchySvc.js +1 -1
  263. package/core/ui/services/loginService.js +1 -1
  264. package/core/ui/services/measurementsReport.js +1 -1
  265. package/core/ui/services/modal.js +1 -1
  266. package/core/ui/services/passwordStrengthCheckerFactory.js +1 -1
  267. package/core/ui/services/support.js +1 -1
  268. package/core/ui/services/uiconfig.js +1 -1
  269. package/core/ui/services/util.js +1 -1
  270. package/core/ui/smartrules/smartRulesAvailability.service.js +1 -1
  271. package/core/ui/title/title.controller.js +1 -1
  272. package/core/ui/title/title.provider.js +1 -1
  273. package/core/ui/user/editUser.controller.js +1 -1
  274. package/core/ui/user/editUser.directive.js +1 -1
  275. package/core/ui/user/measurementUnitPreference.component.js +1 -1
  276. package/core/ui/user/rolesUiStrings.constant.js +1 -1
  277. package/core/ui/user/userPicker.component.js +1 -1
  278. package/core/ui/user/userSettingsBlocks.provider.js +1 -1
  279. package/core/ui/user/userUtil.service.js +1 -1
  280. package/core/ui/utils/copyToClipboard.directive.js +1 -1
  281. package/core/ui/utils/guide-docs.directive.js +1 -1
  282. package/core/ui/utils/uiComponent.directive.js +1 -1
  283. package/core/update-query-params.js +1 -1
  284. package/dashboard2/dashboard/dashboardSelect.controller.js +1 -1
  285. package/dashboard2/dashboard.service.js +1 -1
  286. package/dashboard2/dashboardInventory.service.js +1 -1
  287. package/dataBroker/connectors/connectorEditor.component.js +1 -1
  288. package/dataBroker/connectors/connectors.service.js +1 -1
  289. package/dataBroker/connectorsAlarms/connectorAlarms.component.js +1 -1
  290. package/dataBroker/dataBroker.config.js +1 -1
  291. package/dataBroker/subscriptions/subscriptions.component.js +1 -1
  292. package/dataPointExplorer/controllers/dataPointAdd.js +1 -1
  293. package/dataPointExplorer/controllers/dataPointExplorer.js +1 -1
  294. package/dataPointExplorer/controllers/dataPointItem.js +1 -1
  295. package/dataPointExplorer/controllers/dataPointList.js +1 -1
  296. package/dataPointExplorer/controllers/dataPointWidget.js +1 -1
  297. package/dataPointExplorer/controllers/dataPointWidgetConfig.js +1 -1
  298. package/dataPointExplorer/directives/dataPointValidator.js +1 -1
  299. package/dataPointExplorer/services/dataPoints.js +1 -1
  300. package/dataPointTable/dataPointTable.controller.js +1 -1
  301. package/dataPointTable/dataPointTable.directive.js +1 -1
  302. package/dataPointTable/dataPointTable.service.js +1 -1
  303. package/dataPointTable/realtimeRadioButton.directive.js +1 -1
  304. package/dataPointTable/widget.controller.js +1 -1
  305. package/device-protocol-actility/actility-device.provider.js +1 -1
  306. package/device-protocol-canbus/canbus-device.provider.js +1 -1
  307. package/device-protocol-canopen/canopen-device.provider.js +1 -1
  308. package/device-protocol-deviceDatabase4/device-type-create-step.component.js +1 -1
  309. package/device-protocol-deviceDatabase4/device-type-protocol-base.provider.js +1 -1
  310. package/device-protocol-deviceDatabase4/device-type-row-info.component.js +1 -1
  311. package/device-protocol-impact/impact-detail.component.js +1 -1
  312. package/device-protocol-impact/impact.provider.js +1 -1
  313. package/device-protocol-lora/lora-device.provider.js +1 -1
  314. package/device-protocol-lpwan/lpwan-device.provider.js +1 -1
  315. package/device-protocol-lwm2m/lwm2m.provider.js +1 -1
  316. package/device-protocol-lwm2m/lwm2mFinalStep.component.js +1 -1
  317. package/device-protocol-lwm2m/lwm2mUploadStep.component.js +1 -1
  318. package/device-protocol-lwm2m/lwm2mValidationRules/lwm2mValidationRule.component.js +1 -1
  319. package/device-protocol-lwm2m/lwm2mValidationRules/lwm2mValidationRules.component.js +1 -1
  320. package/device-protocol-modbus/modbus-device.provider.js +1 -1
  321. package/device-protocol-opcua/opcua-device.provider.js +1 -1
  322. package/device-protocol-opcua-v2/opcua-device-v2.provider.js +1 -1
  323. package/device-protocol-opcua-v2/opcua-v2-row-info.component.js +1 -1
  324. package/device-protocol-profibus/profibus-device.provider.js +1 -1
  325. package/device-protocol-sigfox/sigfox-device.provider.js +1 -1
  326. package/device-protocol-snmp/snmp-device.provider.js +1 -1
  327. package/device-protocols/device-protocol-import-button.component.js +1 -1
  328. package/device-protocols/deviceProtocolList.component.js +1 -1
  329. package/device-protocols/deviceProtocolSelect.component.js +1 -1
  330. package/device-protocols/deviceProtocolUi.provider.js +1 -1
  331. package/device-protocols/object-mapping.component.js +1 -1
  332. package/device-protocols/object-mappings.service.js +1 -1
  333. package/deviceActility/actilityUI.provider.js +1 -1
  334. package/deviceActility/deviceActility.module.js +1 -1
  335. package/deviceConfiguration/index.js +1 -1
  336. package/deviceControlMessage/controllers/deviceControlMessageWidget.js +1 -1
  337. package/deviceControlRelay/relayControl/relayControl.controller.js +1 -1
  338. package/deviceControlRelay/relayControl/relayControl.directive.js +1 -1
  339. package/deviceControlRelay/widget.controller.js +1 -1
  340. package/deviceControlRelayArray/relayArrayControl/relayArrayControl.controller.js +1 -1
  341. package/deviceControlRelayArray/widget.controller.js +1 -1
  342. package/deviceDatabase4/detail/device-type-detail.component.js +1 -1
  343. package/deviceDatabase4/detail/holding-registers.component.js +1 -1
  344. package/deviceDatabase4/detail/message-id-configuration-description.component.js +1 -1
  345. package/deviceDatabase4/device-database.service.js +1 -1
  346. package/deviceDatabase4/device-type-list.component.js +1 -1
  347. package/deviceDatabase4/modals/configure-discrete-io.component.js +1 -1
  348. package/deviceDatabase4/modals/configure-register.component.js +1 -1
  349. package/deviceDatabase4/modals/import-device-type.component.js +1 -1
  350. package/deviceDatabase4/modals/select-fieldbus-property.component.js +1 -1
  351. package/deviceDatabase4/parsers/device-type-parser-eds.service.js +1 -1
  352. package/deviceDatabase4/parsers/device-type-parser-json.service.js +1 -1
  353. package/deviceDatabase4/parsers/device-type-parser-mib.service.js +1 -1
  354. package/deviceDatabase4/property-generator.service.js +1 -1
  355. package/deviceDatabase4/unique.directive.js +1 -1
  356. package/deviceDatabase4/validate-value-in-register-range.directive.js +1 -1
  357. package/deviceDatabase4/vendor/ini-legacy.js +1 -1
  358. package/deviceDetail/index.js +1 -1
  359. package/deviceDetailIdentity/controllers/identity.js +1 -1
  360. package/deviceDetailIdentity/index.js +1 -1
  361. package/deviceGroupAssignment/groupAssignment.component.js +1 -1
  362. package/devicePropertyWidget/controllers/config.js +1 -1
  363. package/devicePropertyWidget/controllers/widget.js +1 -1
  364. package/devicePropertyWidget/directives/fragmentCheckboxList.js +1 -1
  365. package/devicePropertyWidget/services/moRealTimeDetails.js +1 -1
  366. package/deviceSelector/controllers/deviceSelectorComboCtrl.js +1 -1
  367. package/deviceSelector/controllers/deviceSelectorCtrl.js +1 -1
  368. package/deviceSelector/controllers/deviceSelectorListCtrl.js +1 -1
  369. package/deviceSelector/directives/deviceSelectorCombo.js +1 -1
  370. package/deviceSelector/directives/deviceSelectorList.js +1 -1
  371. package/deviceStatusWidget/ownerStatus.component.js +1 -1
  372. package/deviceStatusWidget/requiredAvailabilityIntervalSetting.component.js +1 -1
  373. package/devicemanagement-aclManagement/controllers/aclManagementCtrl.js +1 -1
  374. package/devicemanagement-aclManagement/index.js +1 -1
  375. package/devicemanagement-alarmList/controllers/alarmList.js +1 -1
  376. package/devicemanagement-availability/controllers/availability.js +1 -1
  377. package/devicemanagement-deviceNetwork/controllers/network.js +1 -1
  378. package/devicemanagement-deviceNetwork/index.js +1 -1
  379. package/devicemanagement-eventList/controllers/eventList.js +1 -1
  380. package/devicemanagement-location/controllers/location.js +1 -1
  381. package/devicemanagement-location/index.js +1 -1
  382. package/devicemanagement-logViewer/controllers/logViewer.js +1 -1
  383. package/devicemanagement-logViewer/directives/logViewer.js +1 -1
  384. package/devicemanagement-logViewer/providers/logViewer.js +1 -1
  385. package/devicemanagement-measurements/index.js +1 -1
  386. package/devicemanagement-restartDevice/index.js +1 -1
  387. package/devicemanagement-tixiDeviceControl/index.js +1 -1
  388. package/devicemanagement-tracking/controllers/config.js +1 -1
  389. package/devicemanagement-tracking/controllers/tracking.js +1 -1
  390. package/devicemanagement-tracking/index.js +1 -1
  391. package/devicemanagement-vendMeDeviceControl/controllers/vendMeDeviceControl.js +1 -1
  392. package/devicemanagement-vendMeDeviceControl/index.js +1 -1
  393. package/enterpriseEdition/createFile.js +1 -1
  394. package/enterpriseEdition/customBranding/brandingConfigurationForm.component.js +1 -1
  395. package/enterpriseEdition/customBranding/brandingConfigurationUi.provider.js +1 -1
  396. package/enterpriseEdition/customBranding/brandingDeploy.service.js +1 -1
  397. package/enterpriseEdition/customBranding/brandingProcessExecution.component.js +1 -1
  398. package/enterpriseEdition/enterpriseEdition.module.js +1 -1
  399. package/enterpriseEdition/sslCertificate/certificateActivation.component.js +1 -1
  400. package/enterpriseEdition/sslCertificate/manageCertificate.component.js +1 -1
  401. package/enterpriseEdition/sslCertificate/manageCertificate.service.js +1 -1
  402. package/enterpriseEdition/ui-assets/public-options.service.js +1 -1
  403. package/enterpriseEdition/ui-assets/static-assets.service.js +1 -1
  404. package/eventList/eventList.controller.js +1 -1
  405. package/eventsBinary/components/eventBinaryActions/eventBinaryActions.js +1 -1
  406. package/eventsBinary/services/eventsBinary.service.js +1 -1
  407. package/export/controllers/detail.js +1 -1
  408. package/export/services/api.js +1 -1
  409. package/export/services/config.js +1 -1
  410. package/export/services/export.js +1 -1
  411. package/export/services/filters.js +1 -1
  412. package/generic-ui/config-audit/config-audit-diff.component.js +1 -1
  413. package/generic-ui/config-audit/config-audit-modal.component.js +1 -1
  414. package/generic-ui/config-audit/config-audit.component.js +1 -1
  415. package/generic-ui/generic-ui-config.provider.js +1 -1
  416. package/generic-ui/generic-ui-inventory-property.component.js +1 -1
  417. package/generic-ui/generic-ui-inventory.component.js +1 -1
  418. package/generic-ui/generic-ui-operation-list-button.component.js +1 -1
  419. package/generic-ui/generic-ui.component.js +1 -1
  420. package/generic-ui/generic-ui.service.js +1 -1
  421. package/groupsHierarchy/controllers/assetSearchCtrl.js +1 -1
  422. package/groupsHierarchy/controllers/groupDevicesCtrl.js +1 -1
  423. package/groupsHierarchy/controllers/groupsListCtrl.js +1 -1
  424. package/groupsHierarchy/groupsHierarchyUi.provider.js +1 -1
  425. package/htmlWidget/htmlWidget.controller.js +1 -1
  426. package/htmlWidget/htmlWidget.directive.js +1 -1
  427. package/infoGauge/infoGauge.controller.js +1 -1
  428. package/infoGauge/infoGaugeConfig.controller.js +1 -1
  429. package/kpi/controllers/deprecated/edit.js +1 -1
  430. package/kpi/controllers/deprecated/graph.js +1 -1
  431. package/kpi/controllers/deprecated/multipleKpiConfig.js +1 -1
  432. package/kpi/controllers/deprecated/setup.js +1 -1
  433. package/kpi/controllers/gauge.js +1 -1
  434. package/kpi/controllers/kpiConfig.js +1 -1
  435. package/kpi/controllers/list.js +1 -1
  436. package/kpi/controllers/pieChart.js +1 -1
  437. package/kpi/controllers/pieChartConfig.js +1 -1
  438. package/kpi/services/baseWidget.js +1 -1
  439. package/kpi/services/kpi.js +1 -1
  440. package/kpi/services/mostRecentKpi.js +1 -1
  441. package/map/controllers/geofenceEdit.js +1 -1
  442. package/measurements/controllers/lineChart.js +1 -1
  443. package/measurements/controllers/measurements.js +1 -1
  444. package/measurements/directives/lineChart.js +1 -1
  445. package/measurements/directives/timeIntervalChoice.js +1 -1
  446. package/measurements/fragmentChart/fragmentChart.component.js +1 -1
  447. package/measurements/measurements2/axisX.service.js +1 -1
  448. package/measurements/measurements2/axisY.service.js +1 -1
  449. package/measurements/measurements2/chart.controller.js +1 -1
  450. package/measurements/measurements2/chart.service.js +1 -1
  451. package/measurements/measurements2/hoverInfo.service.js +1 -1
  452. package/measurements/measurements2/rtAutoMove.service.js +1 -1
  453. package/measurements/measurements2/series.service.js +1 -1
  454. package/measurements/services/lineChartService.js +1 -1
  455. package/modbusConfiguration4/fieldbus-config.component.js +1 -1
  456. package/modbusConfiguration4/fieldbus-device-list.component.js +1 -1
  457. package/modbusConfiguration4/modbus-configuration-4.config.js +1 -1
  458. package/modbusWidget4/modbus-widget.service.js +1 -1
  459. package/modbusWidget4/widget-config.component.js +1 -1
  460. package/modbusWidget4/widget.component.js +1 -1
  461. package/modbusWidgets/controllers/widget.js +1 -1
  462. package/modbusWidgets/controllers/widgetConfig.js +1 -1
  463. package/modbusWidgets/services/modbusWidget.js +1 -1
  464. package/newsletter/downloadEmailsList.component.js +1 -1
  465. package/oauth/controllers/oauth.js +1 -1
  466. package/package.json +2 -2
  467. package/platformConfiguration/platformConfigurationForm.component.js +1 -1
  468. package/platformConfiguration/platformConfigurationUi.provider.js +1 -1
  469. package/propertiesLibrary/index.js +1 -1
  470. package/propertiesLibrary/jsonSchemaObjectEditor.component.js +1 -1
  471. package/propertiesLibrary/jsonSchemaObjectsList.component.js +1 -1
  472. package/qrCode/controllers/qrCode.js +1 -1
  473. package/qrCode/services/qrCodePrinter.js +1 -1
  474. package/qrCode/services/qrCodeTemplate.js +1 -1
  475. package/relayWidget/relay.service.js +1 -1
  476. package/remoteAccess/clients/remoteAccessClients.service.js +1 -1
  477. package/remoteAccess/clients/terminal/index.js +1 -1
  478. package/remoteAccess/clients/terminal/shell-adapter.js +1 -1
  479. package/remoteAccess/clients/terminal/telnet-negotiator.js +1 -1
  480. package/remoteAccess/clients/vnc/vncClient.js +1 -1
  481. package/remoteAccess/remoteAccess.service.js +1 -1
  482. package/remoteAccess/remoteAccessEndpointCard/remoteAccessEndpointCard.component.js +1 -1
  483. package/remoteAccess/remoteAccessEndpointModal/remoteAccessEndpointModal.component.js +1 -1
  484. package/remoteAccess/remoteAccessEndpointsList/remoteAccessEndpointsList.component.js +1 -1
  485. package/remoteAccess/remoteAccessSettings/remoteAccessSettings.component.js +1 -1
  486. package/remoteAccess/remoteAccessUI.provider.js +1 -1
  487. package/roles/detail/roleDetailGlobal.component.js +1 -1
  488. package/roles/detail/roleInventoryPermissionList.component.js +1 -1
  489. package/roles/list/rolesOverview.controller.js +1 -1
  490. package/roles/rolesUi.provider.js +1 -1
  491. package/scada/config.controller.js +1 -1
  492. package/scada/mapping.directive.js +1 -1
  493. package/scada/svg.directive.js +1 -1
  494. package/scada/util.service.js +1 -1
  495. package/scada/widget.controller.js +1 -1
  496. package/sigfox-provider-settings/sigfox-settings.service.js +1 -1
  497. package/simulators/add/simulatorAdd.component.js +1 -1
  498. package/simulators/detail/detail.controller.js +1 -1
  499. package/simulators/detail/instructionDetail.component.js +1 -1
  500. package/simulators/detail/instructionList.component.js +1 -1
  501. package/simulators/list/list.component.js +1 -1
  502. package/simulators/simulators.service.js +1 -1
  503. package/smartRestEditor/details.controller.js +1 -1
  504. package/smartRestEditor/importTemplate/importTemplate.component.js +1 -1
  505. package/smartRestEditor/requestEditor/requestEditor.component.js +1 -1
  506. package/smartRestEditor/responseEditor/responseEditor.component.js +1 -1
  507. package/smartRestEditor/validators/validateCustomFieldKeyInRequestTemplate.directive.js +1 -1
  508. package/smartRestEditor/validators/validateUniqueMsgIdInTemplate.directive.js +1 -1
  509. package/smartRestEditorUI/index.js +1 -1
  510. package/smartRules/controllers/add.js +1 -1
  511. package/smartRules/controllers/edit.js +1 -1
  512. package/smartRules/controllers/list.js +1 -1
  513. package/smartRules/controllers/smartRuleParamInput.js +1 -1
  514. package/smartRules/directives/smartRuleParamInput.js +1 -1
  515. package/smartRules/directives/smartRuleParamInputAlarmType.js +1 -1
  516. package/smartRules/directives/smartRuleParamInputEscalationSteps.js +1 -1
  517. package/smartRules/directives/smartRuleParamInputFrequency.js +1 -1
  518. package/smartRules/directives/smartRuleParamInputGeofence.js +1 -1
  519. package/smartRules/directives/smartRuleParamInputKpi.js +1 -1
  520. package/smartRules/directives/smartRuleParamInputTimeInterval.js +1 -1
  521. package/smartRules/list/smartRulesList.component.js +1 -1
  522. package/smartRules/services/smartRuleTemplates.js +1 -1
  523. package/smartRules/services/smartRules.js +1 -1
  524. package/switchDisplay/controller/switchDisplayCtrl.js +1 -1
  525. package/tenantApplications/controllers/main.js +1 -1
  526. package/tenantApplications/subscribed-applications/subscribed-applications.component.js +1 -1
  527. package/tenantLicenses/licenseManagement.component.js +1 -1
  528. package/tenantPolicies/retentionRule/retentionRuleRow.component.js +1 -1
  529. package/tenantPolicies/tenantPolicies.service.js +1 -1
  530. package/tenantPolicies/tenantPoliciesConfig.provider.js +1 -1
  531. package/tenantPolicies/tenantPolicyDetail/tenantPolicyDetail.component.js +1 -1
  532. package/tenantStatistics/tenant-statistics-columns.service.js +1 -1
  533. package/tenantStatistics/tenant-statistics.component.js +1 -1
  534. package/tenants/controllers/customProperties.js +1 -1
  535. package/tenants/controllers/detail.js +1 -1
  536. package/tenants/index.js +1 -1
  537. package/trackerConfiguration/controllers/trackerConfiguration.controller.js +1 -1
  538. package/trackerConfiguration/index.js +1 -1
  539. package/trackerConfiguration/services/realtimeLockup.service.js +1 -1
  540. package/trackerConfiguration/services/trackerLocation.service.js +1 -1
  541. package/trackerModels/trackerModels.service.js +1 -1
  542. package/trackerRegistration/index.js +1 -1
  543. package/trackerRegistration/trackerRegistration.controller.js +1 -1
  544. package/trackerRegistration/trackerRegistrationHistory.service.js +1 -1
  545. package/trackingAppConfig/index.js +1 -1
  546. package/trafficLightWidget/states-mapping.component.js +1 -1
  547. package/trafficLightWidget/traffic-light.component.js +1 -1
  548. package/userRoles/inventoryRoleSelector/inventoryRoleSelector.component.js +1 -1
  549. package/userRoles/inventoryRolesTab/inventoryRolesTab.component.js +1 -1
  550. package/userRoles/rolesAssetTree/rolesAssetTree.component.js +1 -1
  551. package/userRoles/userRoles.service.js +1 -1
  552. package/userRoles/userRolesUi.service.js +1 -1
  553. package/users/aclEditor/aclEditor.directive.js +1 -1
  554. package/users/applicationAccess/applicationAccess.directive.js +1 -1
  555. package/users/userDetailView/userApplicationAccess.component.js +1 -1
  556. package/users/userDetailView/userDetailView.component.js +1 -1
  557. package/users/userListView/userListView.component.js +1 -1
  558. package/users/usersUi.provider.js +1 -1
@@ -1 +1 @@
1
- "use strict";!function(){function t(o,t,a,n,e){var i,s,l,c,m,r=_.debounce(D,300,{leading:!1,trailing:!0}),d=12e4,u=!1,f=e("Realtime is active. Deactivate it to edit date and time.");function D(){s&&l.dateFrom&&l.dateTo&&(u=!0,s.loadData(l.dateFrom,l.dateTo,o.aggregation).then(h).finally(function(){u=!1,o.onDataChange({chart:s})}))}function p(t){s.realtimeMeasurement(t)&&(g(),h(),o.selectable()&&($(i),o.selected&&s.setSelectPoint(o.selected)))}function h(){i=moment()}function g(){!u&&moment().diff(i)>d&&D()}function $(t,e){var a=e||{},n=moment(t),o=moment.duration(moment(l.dateTo).diff(l.dateFrom)),i=moment(n).subtract(o);l.dateFrom=i.toDate(),l.dateTo=n.toDate();var c=l,r=c.dateFrom,d=c.dateTo;a.notrigger&&(m=!0),s.axisX.updateDates(r,d,!1),a.loadData&&D()}var T={dateFrom:!1,dateTo:!1,aggregation:!1,datapoints:!1};function v(t){t&&(T[t]=!0),_.every(T,function(t){return!0===t})&&r()}function F(){g(),moment(s.axisX._to).isBefore(moment())&&!s.allowSelectFocusTime&&$(moment(),{notrigger:1})}function w(){return _.map(o.datapoints,function(t,e){return{id:e,name:t.label,datapoint:t,datapointActive:t.__active}})}function S(t){o.seriesSelected=t;var e=_.map(o.seriesSelected,"datapoint");s.updateSeries(e,!0)}t.$on("c8yRealtime::connected",function(){D()}),this.init=function(t){s=t,o.chart=s,l={},o.internalDates=l,c=n(F),s.axisX.onUpdateDates=function(t,e){l.dateFrom=t,l.dateTo=e},o.$watch("dateFrom",function(t){moment(o.internalDates.dateFrom).isSame(t)||(o.internalDates.dateFrom=new Date(t),s.axisX.updateDates(t,o.dateTo,!1),v("dateFrom"))}),o.$watch("dateTo",function(t){moment(o.internalDates.dateTo).isSame(t)||(o.internalDates.dateTo=new Date(t),s.axisX.updateDates(o.dateFrom,t,!1),v("dateTo"))}),o.$watch("internalDates",function(t,e){var a=t.dateFrom&&moment(t.dateFrom).toDate(),n=t.dateTo&&moment(t.dateTo).toDate();o.datesValid=a&&n&&a<=n,o.datesValid&&(o.onUpdateDisplayedDates&&o.onUpdateDisplayedDates({$dateFrom:a,$dateTo:n}),m?m=!1:t!==e&&o.onUpdateDates&&(o.onUpdateDates({$dateFrom:a,$dateTo:n}),s.axisX.updateDates(a,n,!1),o.realtime||r()))},!0),o.$watch("aggregation",function(){return v("aggregation")}),o.$watch("datapoints",function(){o.seriesAvailable=w(),o.seriesSelected?S(_.filter(o.seriesAvailable,"datapointActive")):S(function(){var t=_.filter(w(),"datapointActive"),e=o.datapointsInitialDisplayLimit;return _.isUndefined(e)?t:_.take(t,e)}())},!0),o.$watchCollection("datapoints",function(){return v("datapoints")}),o.$watch("realtime",function(t){t&&!o.selectable()?($(moment(),{notrigger:1,loadData:1}),c.start()):c.cancel()}),o.$watch("selected",function(t){t?s.setSelectPoint(t):s.clearSelectPoint()}),s.onSelectPoint=function(t){a(function(){o.selected=t})},o.$watch(function(){return o.selectable()},function(t){(s.allowSelectFocusTime=t)&&c.cancel()}),o.$watch("chart.chartBox",function(t,e){_.isEqual(t,e)||o.onBoxChanged({box:t})});var e=_.throttle(s.render.bind(s),500);o.$on("dashboardResize",function(){return e()}),o.$watch("showTime()",function(t){t?s.showDateSelection():s.hideDateSelection()}),o.onData=p,o.$on("$destroy",function(){return c.cancel()}),o.onSeriesSelectionChanged=S},o.data={},o.realtimeActiveInfo=f}t.$inject=["$scope","$rootScope","$timeout","RTAutoMove","gettext"],angular.module("c8y.core.measurements2").controller("c8yChartCtrl",t)}();
1
+ "use strict";!function(){function t(o,t,a,n,e){var i,c,r,d,s,l=_.debounce(f,300,{leading:!1,trailing:!0}),m=12e4,u=!1,e=e("Realtime is active. Deactivate it to edit date and time.");function f(){c&&r.dateFrom&&r.dateTo&&(u=!0,c.loadData(r.dateFrom,r.dateTo,o.aggregation).then(p).finally(function(){u=!1,o.onDataChange({chart:c})}))}function D(t){c.realtimeMeasurement(t)&&(h(),p(),o.selectable())&&(g(i),o.selected)&&c.setSelectPoint(o.selected)}function p(){i=moment()}function h(){!u&&moment().diff(i)>m&&f()}function g(t,e){var e=e||{},t=moment(t),a=moment.duration(moment(r.dateTo).diff(r.dateFrom)),a=moment(t).subtract(a),a=(r.dateFrom=a.toDate(),r.dateTo=t.toDate(),r),t=a.dateFrom,a=a.dateTo;e.notrigger&&(s=!0),c.axisX.updateDates(t,a,!1),e.loadData&&f()}var $={dateFrom:!1,dateTo:!1,aggregation:!1,datapoints:!1};function T(t){t&&($[t]=!0),_.every($,function(t){return!0===t})&&l()}function F(){h(),moment(c.axisX._to).isBefore(moment())&&!c.allowSelectFocusTime&&g(moment(),{notrigger:1})}function v(){return _.map(o.datapoints,function(t,e){return{id:e,name:t.label,datapoint:t,datapointActive:t.__active}})}function w(t){o.seriesSelected=t;t=_.map(o.seriesSelected,"datapoint");c.updateSeries(t,!0)}t.$on("c8yRealtime::connected",function(){f()}),this.init=function(t){c=t,o.chart=c,r={},o.internalDates=r,d=n(F),c.axisX.onUpdateDates=function(t,e){r.dateFrom=t,r.dateTo=e},o.$watch("dateFrom",function(t){moment(o.internalDates.dateFrom).isSame(t)||(o.internalDates.dateFrom=new Date(t),c.axisX.updateDates(t,o.dateTo,!1),T("dateFrom"))}),o.$watch("dateTo",function(t){moment(o.internalDates.dateTo).isSame(t)||(o.internalDates.dateTo=new Date(t),c.axisX.updateDates(o.dateFrom,t,!1),T("dateTo"))}),o.$watch("internalDates",function(t,e){var a=t.dateFrom&&moment(t.dateFrom).toDate(),n=t.dateTo&&moment(t.dateTo).toDate();o.datesValid=a&&n&&a<=n,o.datesValid&&(o.onUpdateDisplayedDates&&o.onUpdateDisplayedDates({$dateFrom:a,$dateTo:n}),s?s=!1:t!==e&&o.onUpdateDates&&(o.onUpdateDates({$dateFrom:a,$dateTo:n}),c.axisX.updateDates(a,n,!1),o.realtime||l()))},!0),o.$watch("aggregation",function(){return T("aggregation")}),o.$watch("datapoints",function(){o.seriesAvailable=v(),o.seriesSelected?w(_.filter(o.seriesAvailable,"datapointActive")):w(function(){var t=_.filter(v(),"datapointActive"),e=o.datapointsInitialDisplayLimit;if(_.isUndefined(e))return t;return _.take(t,e)}())},!0),o.$watchCollection("datapoints",function(){return T("datapoints")}),o.$watch("realtime",function(t){!t||o.selectable()?d.cancel():(g(moment(),{notrigger:1,loadData:1}),d.start())}),o.$watch("selected",function(t){t?c.setSelectPoint(t):c.clearSelectPoint()}),c.onSelectPoint=function(t){a(function(){o.selected=t})},o.$watch(function(){return o.selectable()},function(t){(c.allowSelectFocusTime=t)&&d.cancel()}),o.$watch("chart.chartBox",function(t,e){_.isEqual(t,e)||o.onBoxChanged({box:t})});var e=_.throttle(c.render.bind(c),500);o.$on("dashboardResize",function(){return e()}),o.$watch("showTime()",function(t){t?c.showDateSelection():c.hideDateSelection()}),o.onData=D,o.$on("$destroy",function(){return d.cancel()}),o.onSeriesSelectionChanged=w},o.data={},o.realtimeActiveInfo=e}t.$inject=["$scope","$rootScope","$timeout","RTAutoMove","gettext"],angular.module("c8y.core.measurements2").controller("c8yChartCtrl",t)}();
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(h,l,e,c,t,n,i,r,u,o){var d,m=r,f=t,a=n,v=i,s=[{val:"min",text:o("Minimum")},{val:"max",text:o("Maximum")},{val:"area",text:o("Minimum and maximum")}],p=[{val:"line",text:o("Line")},{val:"points",text:o("Points")},{val:"linePoints",text:o("Line and points")},{val:"bars",text:o("Bars")},{val:"step-before",text:o("Step before")},{val:"step-after",text:o("Step after")}],g=[{val:void 0,text:o("Auto")},{val:"left",text:o("Left")},{val:"right",text:o("Right")}];function y(e,t){var n,i=this,r=$(e),o=r.find(".chart-container").length,a=function(){n||(n=setTimeout(function(){n=void 0,i._render()},300))},s=function e(){return e.result||(e.result=i._dimensions()),e.timerId||(e.timerId=setTimeout(function(){delete e.result,delete e.timerId},700)),e.result};i._hasContainer=o,i.el=o?r.find(".chart-container"):r,i.parentEl=i.el.parent(),i.items=[],i.dimensions=s,i.render=function(){return a()},d&&(i.dimensions=function(){return d.runOutsideAngular(s)},i.render=function(){return d.runOutsideAngular(function(){return a()})}),i.init(t)}return d3.selection.prototype.dblTap=function(n){var i=0;return this.each(function(){d3.select(this).on("touchstart",function(e){var t=function(){};return d3.event.timeStamp-i<500?(d3.event.preventDefault(),d3.event.stopPropagation(),t=n):i=d3.event.timeStamp,t(e)})})},e.has("ngZone")&&(d=e.get("ngZone")),y.prototype={sizes:{yAxisWidth:50},margins:{t:20,r:10,b:20,l:10},init:function(e){var t=this,n=t.parentEl,i=t.el,r=t._hasContainer?"25px":0,o=t._hasContainer?{position:"absolute",top:0,right:0,bottom:0,left:0}:{position:"relative"},a=i.parents(".panel-body"),s=i.parents(".grid-stack-item-content").length;if(a.length&&!s&&a.height("320px"),n.css(o),t._hasContainer){var l=n.parent().css("position");"absolute"!==l&&"fixed"!==l&&n.parent().css({position:"relative"})}i.addClass("c8y-chart"),i.css({display:"block",position:"absolute",top:e.showTime?"55px":r,right:0,bottom:"5px",left:0}),t._id=String(Math.random()).substr(2),t.svg=t.createSvg(),t.hoverBox(),t.svgSeries=t.createSeriesContainer(),t.axisX=new v(t),t.series=[],t.allowSelectPoint=e.allowSelectPoint,t.hoverInfo=new m(t),t.hoverItems=t.renderVerticalLine().concat([t.hoverInfo.el]),t.addEvents()},destroy:function(){this.hoverInfo.destroy()},renderVerticalLine:function(){var r=this,e=r.overline,t=r.selectLine,n=r.box().height-r.margins.t-r.margins.b,i=function(e,t,n,i){return r.svg.append("g").attr("transform",u.translate(r.margins.l,r.margins.t)).append("line").style({visibility:"hidden",stroke:e,"stroke-dasharray":t,opacity:i,"pointer-events":"none"}).attr({class:n})};e||(r.overline=i("#999999","3,3","overline",.5),e=r.overline),t||(r.selectLine=i("#333333",void 0,"selectline",0),t=r.selectLine);var o=[e,t];return _.forEach(o,function(e){e.attr({y1:0,y2:n})}),o},createSeriesContainer:function(){var e=this,t=e.svg,n=e.margins,i=e.box(),r=i.height-n.b-n.t;return e._clipPath=t.append("defs").append("svg:clipPath").attr({id:"clipmask".concat(e._id)}).append("svg:rect").attr({id:"clip-rect".concat(e._id),x:n.l,y:n.t,width:i.axisXwidth,height:0<r?r:0}),t.append("g").style({"z-index":10}).attr({class:"seriesContainer","clip-path":"url(#clipmask".concat(e._id,")")})},hoverBox:function(){var e=this,t=e.box(),n=e._hoverBox,i=t.height-e.margins.b-e.margins.t;return n||(e._hoverBox=e.svg.append("rect").style({fill:"transparent",opacity:.3,"z-index":void 0,"pointer-events":"all"}),n=e._hoverBox),n.attr({width:t.axisXwidth,height:0<i?i:0,transform:u.translate(t.leftSpace,e.margins.t)}),n},selectionBox:function(e){var t=this,n=t.box(),i=t._selBox,r=n.height-t.margins.b-t.margins.t,o=t._mouseSelectStart;if(r=0<r?r:0,i||(t._selBox=t.svg.append("rect").attr({"pointer-events":"none",fill:"rgba(200,200,200, 0.5)"}),i=t._selBox),o&&e){var a=_slicedToArray(o,1)[0],s=e[0]-n.leftSpace,l=a<s?a:s,c=s<a?a:s;i.attr({transform:u.translate(n.leftSpace+l,t.margins.t),height:r,width:c-l}).style({visibility:"visible"})}else i.style({visibility:"hidden"})},realtimeMeasurement:function(n){var i=!1;return _.forEach(this.series,function(e){var t=e.realtimeMeasurement(n);i=i||t}),i},getHoverItems:function(){var t=_.clone(this.hoverItems);return _.forEach(this.series,function(e){t=_.union(t,e.hoverItems)}),t},showHoverItems:function(e){var t=this.getHoverItems();this.hoverItemsVisible=!0,t="nolines"===e?_.without(t,this.overline):_.without(t,this.selectLine),_.forEach(t,function(e){e.style&&e.style("visibility","visible"),e.show&&e.show()})},showHoverItemsExceptLine:function(){this.showHoverItems("nolines")},hideHoverItems:function(){this.hoverItemsVisible=!1,_.forEach(this.getHoverItems(),function(e){e.style&&e.style("visibility","hidden"),e.hide&&e.hide()})},addEvents:function(){var t=this,n=this.hoverBox();n.on("mouseenter",function(){t.mouseIn=!0,t.showHoverItems()}),n.on("mouseleave",function(){var e=d3.event.relatedTarget;e&&"circle"===e.tagName||(t.hideHoverItems(),t.resetSelectLine(),_.invokeMap(t.series,"mouseleave"),t.mouseIn=!1)});var e=d3.behavior.drag();function i(){var e=d3.mouse(n.node());t.zoomOut(e[0])}e.call(n),e.on("dragstart",function(){t._mouseSelectStart=d3.mouse(n.node())}),e.on("dragend",function(){var e=d3.mouse(n.node());t._mouseSelectStart&&e[0]!==t._mouseSelectStart[0]&&t.makeSelection(t._mouseSelectStart,e),t.selectionBox()}),e.on("drag",_.bind(t.onDragSelection,t)),n.on("mousemove",_.bind(t.onMove,t)),n.on("dblclick",i),n.dblTap(i),window.addEventListener("resize",function(){t.render(!0)})},zoomOut:function(e){var t=this.box(),n=this.margins,i=this.axisX,r=i.scale(),o=i._from,a=i._to,s=moment(r.invert(e+t.leftSpace-n.l)),l=Math.round(2*s.diff(o)),c=Math.round(2*moment(a).diff(s)),u=moment(new Date(Math.max(Date.now(),a)));u=moment.min(u,s.clone().add(c,"ms")),i.updateDates(s.clone().subtract(l,"ms"),u,!0),h.$apply()},moveToCenter:function(e){var t=this.axisX,n=t._from,i=t._to,r=moment(i).diff(n)/2,o=moment(e).subtract(r),a=moment(e).add(r);t.updateDates(o,a),this.render()},makeSelection:function(e,t){var n=this.axisX,i=this.box(),r=n.scale(),o=this.margins,a=moment(r.invert(e[0]+i.leftSpace-o.l)),s=moment(r.invert(t[0]+i.leftSpace-o.l)),l=a.isBefore(s)?a:s,c=l===a?s:a;n.updateDates(l,c,!0),h.$apply()},onDragSelection:function(){this._mouseSelectStart&&this.selectionBox([d3.event.x,d3.event.y])},onMove:function(e){var t,n=this,i=n.box(),r=n.hoverBox().node(),o=n.margins;try{t=d3.mouse(r),n.axisX._xDragStart&&n.axisX.updateScaleOnDrag(d3.mouse(r)[0])}catch(e){t=n.__cachedMouse||[0,0]}finally{n.__cachedMouse=t}var a=i.leftSpace+t[0]-o.l;n.overline.attr({transform:u.translate(1+a,0)}),n.currentHoverTime=n.axisX.scale().invert(a);var s=n.currentHoverTime;if(n._selectTime&&"moveToNow"===e)n.resetSelectLine();else{_.forEach(n.series,function(e){e.onMove(s,a)});var l=_slicedToArray(t,2)[1];_.forEach(n.items,function(e){e.onMove&&e.onMove(s,a,l)})}},setSelectTimeWithMouse:function(e){var t=this.axisX.scale().invert(e);return this.setSelectLine(t),t},setSelectPoint:function(e){var t=this;(t.selectedPoint=e).date?(t.setSelectLine(moment(e.date).toDate()),t.onSelectPoint&&t.onSelectPoint(t.selectedPoint)):t.clearSelectPoint()},clearSelectPoint:function(){var e=this;e.onSelectPoint&&e.selectedPoint&&e.selectedPoint.date&&(delete e.selectedPoint,e.onSelectPoint({})),e.clearSelectLine()},setSelectLine:function(t,e){var n=this,i=n.box(),r=n.axisX.scale(),o=n.selectLine,a=r(t),s=!(!n._selectTime||!moment(n._selectTime).isSame(t)),l=a<i.rangeMin||a>i.rangeMax;n._selectTime=t,l?s?n.hideSelectLine():n.moveToCenter(t):(o.attr({transform:u.translate(a,0)}),o.style("visibility","visible"),o.style("opacity",.5),!0!==e&&(n.showHoverItemsExceptLine(),setTimeout(function(){_.forEach(n.series,function(e){e.onMove(t,a)}),_.forEach(n.items,function(e){e.onMove&&e.onMove(t,a)})})))},clearSelectLine:function(){this.hideSelectLine(),delete this._selectTime},hideSelectLine:function(){var e=this.selectLine;"hidden"!==e.style("visibility")&&(e.style("visibility","hidden"),this.hideHoverItems())},resetSelectLine:function(){return!!this._selectTime&&(this.setSelectLine(this._selectTime),!0)},createSvg:function(){return d3.select(this.el[0]).append("svg").style({position:"absolute",top:0,right:0,bottom:0,left:0})},_dimensions:function(){return{h:this.el.height(),w:this.el.width()}},box:function(){var e=this,t=e.dimensions(),n=t.h,i=t.w,r=e.getAxisYByOrientation("left"),o=e.getAxisYByOrientation("right"),a=r.length*e.sizes.yAxisWidth||0,s=o.length*e.sizes.yAxisWidth||0,l=e.margins.r+s||0,c=e.margins.l+a||0,u=i-(c+l);return u<0&&(u=0),e.chartBox={height:0<n?n:0,width:0<i?i:0,axisXwidth:u,leftSpace:c,rightSpace:l,rangeMin:a,rangeMax:i-e.margins.l-l},e.chartBox},_render:function(){var e=this;e.updateYaxis();var t=e.box(),n=e.margins;e.renderVerticalLine(),e.selectionBox(),e.hoverBox(),e.axisX.render(),_.invokeMap(e.items,"render"),_.invokeMap(e.series,"render");var i=t.height-n.b-n.t;e._clipPath.attr({x:t.leftSpace,width:t.axisXwidth,height:0<i?i:0}),e.resetSelectLine()||e.onMove()},addItem:function(e){_.isObjectLike(e)&&-1===this.items.indexOf(e)&&this.items.push(e)},removeItem:function(e){this.items=_.without(this.items,e)},updateSeries:function(t,i){var r=this,o=r.axisX._to,a=r.axisX._from,s=r._aggregation,e=_.remove(r.series,function(e){return-1===t.indexOf(e.dataPoint)});_.invokeMap(e,"destroy");var n=_.map(t,function(t){var e;if(!_.find(r.series,function(e){return e.dataPoint===t})){var n=new f(r,t);r.series.push(n),i&&a&&o&&(e=n.loadDataAndRender(a,o,s))}return e}).filter(_.identity);return(n.length?l.all(n):c()).finally(function(){r.render()})},loadData:function(t,n,i){var r=this;return r._aggregation=i,r.loading=!0,l.all(_.map(r.series,function(e){return e.loadData(t,n,i)})).then(function(e){r.truncated=_.some(e,{truncated:!0})}).finally(function(){r.loading=!1,r.render(!0)})},scaleY:function(){var e=this.box().height-this.margins.t-this.margins.b,t=this.margins.t;return d3.scale.linear().range([e,t]).nice()},getAxisY:function(){return _.filter(this.items,function(e){return e instanceof n})},getAxisYByOrientation:function(t){return _.filter(this.items,function(e){return e instanceof n&&e.orientation()===t})},updateYaxis:function(){var n=this,e=n.series,i=[],r=n.getAxisY();_.forEach(r,function(e){e.series.length=0}),_.forEach(e,function(t){var e=_.find(i,function(e){return _.find(e.series,function(e){return function(e,t){var n=e.dataPoint,i=t.dataPoint,r=e.scale().domain(),o=t.scale().domain();return n.yAxisType===i.yAxisType&&r[0]===o[0]&&r[1]===o[1]}(t,e)})});e||(e=r.length?r.shift():new a(n),i.push(e)),e.addSerie(t)}),_.invokeMap(r,"remove")},showDateSelection:function(){this.el.css({top:"55px"})},hideDateSelection:function(){this.el.css({top:"25px"})}},{Chart:y,renderTypes:s,lineTypes:p,axisTypes:g}}e.$inject=["$rootScope","$q","$injector","$timeout","c8ySeries","c8yAxisY","c8yAxisX","c8yHoverInfo","c8yChartCommon","gettext"],angular.module("c8y.core.measurements2").factory("c8yChart",e)}();
1
+ "use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(a.push(i.value),a.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw r}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(a,l,e,n,t,i,r,o,c,s){var u,h=o,d=t,m=i,f=r,o=[{val:"min",text:s("Minimum")},{val:"max",text:s("Maximum")},{val:"area",text:s("Minimum and maximum")}],t=[{val:"line",text:s("Line")},{val:"points",text:s("Points")},{val:"linePoints",text:s("Line and points")},{val:"bars",text:s("Bars")},{val:"step-before",text:s("Step before")},{val:"step-after",text:s("Step after")}],r=[{val:void 0,text:s("Auto")},{val:"left",text:s("Left")},{val:"right",text:s("Right")}];function v(e,t){function n(){r=r||setTimeout(function(){r=void 0,o._render()},300)}function i(){return i.result||(i.result=o._dimensions()),i.timerId||(i.timerId=setTimeout(function(){delete i.result,delete i.timerId},700)),i.result}var r,o=this,e=$(e),s=e.find(".chart-container").length;o._hasContainer=s,o.el=s?e.find(".chart-container"):e,o.parentEl=o.el.parent(),o.items=[],o.dimensions=i,o.render=n,u&&(o.dimensions=function(){return u.runOutsideAngular(i)},o.render=function(){return u.runOutsideAngular(n)}),o.init(t)}return d3.selection.prototype.dblTap=function(n){var i=0;return this.each(function(){d3.select(this).on("touchstart",function(e){var t=function(){};return d3.event.timeStamp-i<500?(d3.event.preventDefault(),d3.event.stopPropagation(),t=n):i=d3.event.timeStamp,t(e)})})},e.has("ngZone")&&(u=e.get("ngZone")),v.prototype={sizes:{yAxisWidth:50},margins:{t:20,r:10,b:20,l:10},init:function(e){var t=this,n=t.parentEl,i=t.el,r=t._hasContainer?"25px":0,o=t._hasContainer?{position:"absolute",top:0,right:0,bottom:0,left:0}:{position:"relative"},s=i.parents(".panel-body"),a=i.parents(".grid-stack-item-content").length;s.length&&!a&&s.height("320px"),n.css(o),t._hasContainer&&"absolute"!==(a=n.parent().css("position"))&&"fixed"!==a&&n.parent().css({position:"relative"}),i.addClass("c8y-chart"),i.css({display:"block",position:"absolute",top:e.showTime?"55px":r,right:0,bottom:"5px",left:0}),t._id=String(Math.random()).substr(2),t.svg=t.createSvg(),t.hoverBox(),t.svgSeries=t.createSeriesContainer(),t.axisX=new f(t),t.series=[],t.allowSelectPoint=e.allowSelectPoint,t.hoverInfo=new h(t),t.hoverItems=t.renderVerticalLine().concat([t.hoverInfo.el]),t.addEvents()},destroy:function(){this.hoverInfo.destroy()},renderVerticalLine:function(){function e(e,t,n,i){return r.svg.append("g").attr("transform",c.translate(r.margins.l,r.margins.t)).append("line").style({visibility:"hidden",stroke:e,"stroke-dasharray":t,opacity:i,"pointer-events":"none"}).attr({class:n})}var r=this,t=r.overline,n=r.selectLine,i=r.box().height-r.margins.t-r.margins.b,t=(t||(r.overline=e("#999999","3,3","overline",.5),t=r.overline),n||(r.selectLine=e("#333333",void 0,"selectline",0),n=r.selectLine),[t,n]);return _.forEach(t,function(e){e.attr({y1:0,y2:i})}),t},createSeriesContainer:function(){var e=this,t=e.svg,n=e.margins,i=e.box(),r=i.height-n.b-n.t;return e._clipPath=t.append("defs").append("svg:clipPath").attr({id:"clipmask".concat(e._id)}).append("svg:rect").attr({id:"clip-rect".concat(e._id),x:n.l,y:n.t,width:i.axisXwidth,height:0<r?r:0}),t.append("g").style({"z-index":10}).attr({class:"seriesContainer","clip-path":"url(#clipmask".concat(e._id,")")})},hoverBox:function(){var e=this,t=e.box(),n=e._hoverBox,i=t.height-e.margins.b-e.margins.t;return n||(e._hoverBox=e.svg.append("rect").style({fill:"transparent",opacity:.3,"z-index":void 0,"pointer-events":"all"}),n=e._hoverBox),n.attr({width:t.axisXwidth,height:0<i?i:0,transform:c.translate(t.leftSpace,e.margins.t)}),n},selectionBox:function(e){var t,n=this,i=n.box(),r=n._selBox,o=i.height-n.margins.b-n.margins.t,s=n._mouseSelectStart,o=0<o?o:0;r||(n._selBox=n.svg.append("rect").attr({"pointer-events":"none",fill:"rgba(200,200,200, 0.5)"}),r=n._selBox),s&&e?(s=_slicedToArray(s,1)[0],t=(e=e[0]-i.leftSpace)<s?s:e,r.attr({transform:c.translate(i.leftSpace+(i=s<e?s:e),n.margins.t),height:o,width:t-i}).style({visibility:"visible"})):r.style({visibility:"hidden"})},realtimeMeasurement:function(t){var n=!1;return _.forEach(this.series,function(e){e=e.realtimeMeasurement(t);n=n||e}),n},getHoverItems:function(){var t=_.clone(this.hoverItems);return _.forEach(this.series,function(e){t=_.union(t,e.hoverItems)}),t},showHoverItems:function(e){var t=this.getHoverItems();this.hoverItemsVisible=!0,t="nolines"===e?_.without(t,this.overline):_.without(t,this.selectLine),_.forEach(t,function(e){e.style&&e.style("visibility","visible"),e.show&&e.show()})},showHoverItemsExceptLine:function(){this.showHoverItems("nolines")},hideHoverItems:function(){this.hoverItemsVisible=!1,_.forEach(this.getHoverItems(),function(e){e.style&&e.style("visibility","hidden"),e.hide&&e.hide()})},addEvents:function(){var t=this,n=this.hoverBox(),e=(n.on("mouseenter",function(){t.mouseIn=!0,t.showHoverItems()}),n.on("mouseleave",function(){var e=d3.event.relatedTarget;e&&"circle"===e.tagName||(t.hideHoverItems(),t.resetSelectLine(),_.invokeMap(t.series,"mouseleave"),t.mouseIn=!1)}),d3.behavior.drag());function i(){var e=d3.mouse(n.node());t.zoomOut(e[0])}e.call(n),e.on("dragstart",function(){t._mouseSelectStart=d3.mouse(n.node())}),e.on("dragend",function(){var e=d3.mouse(n.node());t._mouseSelectStart&&e[0]!==t._mouseSelectStart[0]&&t.makeSelection(t._mouseSelectStart,e),t.selectionBox()}),e.on("drag",_.bind(t.onDragSelection,t)),n.on("mousemove",_.bind(t.onMove,t)),n.on("dblclick",i),n.dblTap(i),window.addEventListener("resize",function(){t.render(!0)})},zoomOut:function(e){var t=this.box(),n=this.margins,i=this.axisX,r=i.scale(),o=i._from,s=i._to,r=moment(r.invert(e+t.leftSpace-n.l)),e=Math.round(2*r.diff(o)),t=Math.round(2*moment(s).diff(r)),n=moment(new Date(Math.max(Date.now(),s))),n=moment.min(n,r.clone().add(t,"ms"));i.updateDates(r.clone().subtract(e,"ms"),n,!0),a.$apply()},moveToCenter:function(e){var t=this.axisX,n=t._from,i=t._to,i=moment(i).diff(n)/2,n=moment(e).subtract(i),e=moment(e).add(i);t.updateDates(n,e),this.render()},makeSelection:function(e,t){var n=this.axisX,i=this.box(),r=n.scale(),o=this.margins,e=moment(r.invert(e[0]+i.leftSpace-o.l)),r=moment(r.invert(t[0]+i.leftSpace-o.l)),t=e.isBefore(r)?e:r;n.updateDates(t,t===e?r:e,!0),a.$apply()},onDragSelection:function(){this._mouseSelectStart&&this.selectionBox([d3.event.x,d3.event.y])},onMove:function(e){var t,n=this,i=n.box(),r=n.hoverBox().node(),o=n.margins;try{t=d3.mouse(r),n.axisX._xDragStart&&n.axisX.updateScaleOnDrag(d3.mouse(r)[0])}catch(e){t=n.__cachedMouse||[0,0]}finally{n.__cachedMouse=t}var s,a=i.leftSpace+t[0]-o.l,l=(n.overline.attr({transform:c.translate(1+a,0)}),n.currentHoverTime=n.axisX.scale().invert(a),n.currentHoverTime);n._selectTime&&"moveToNow"===e?n.resetSelectLine():(_.forEach(n.series,function(e){e.onMove(l,a)}),s=_slicedToArray(t,2)[1],_.forEach(n.items,function(e){e.onMove&&e.onMove(l,a,s)}))},setSelectTimeWithMouse:function(e){e=this.axisX.scale().invert(e);return this.setSelectLine(e),e},setSelectPoint:function(e){var t=this;(t.selectedPoint=e).date?(t.setSelectLine(moment(e.date).toDate()),t.onSelectPoint&&t.onSelectPoint(t.selectedPoint)):t.clearSelectPoint()},clearSelectPoint:function(){var e=this;e.onSelectPoint&&e.selectedPoint&&e.selectedPoint.date&&(delete e.selectedPoint,e.onSelectPoint({})),e.clearSelectLine()},setSelectLine:function(t,e){var n=this,i=n.box(),r=n.axisX.scale(),o=n.selectLine,s=r(t),r=!(!n._selectTime||!moment(n._selectTime).isSame(t)),i=s<i.rangeMin||s>i.rangeMax;n._selectTime=t,i?r?n.hideSelectLine():n.moveToCenter(t):(o.attr({transform:c.translate(s,0)}),o.style("visibility","visible"),o.style("opacity",.5),!0!==e&&(n.showHoverItemsExceptLine(),setTimeout(function(){_.forEach(n.series,function(e){e.onMove(t,s)}),_.forEach(n.items,function(e){e.onMove&&e.onMove(t,s)})})))},clearSelectLine:function(){this.hideSelectLine(),delete this._selectTime},hideSelectLine:function(){var e=this.selectLine;"hidden"!==e.style("visibility")&&(e.style("visibility","hidden"),this.hideHoverItems())},resetSelectLine:function(){return!!this._selectTime&&(this.setSelectLine(this._selectTime),!0)},createSvg:function(){return d3.select(this.el[0]).append("svg").style({position:"absolute",top:0,right:0,bottom:0,left:0})},_dimensions:function(){return{h:this.el.height(),w:this.el.width()}},box:function(){var e=this,t=e.dimensions(),n=t.h,t=t.w,i=e.getAxisYByOrientation("left"),r=e.getAxisYByOrientation("right"),i=i.length*e.sizes.yAxisWidth||0,r=r.length*e.sizes.yAxisWidth||0,r=e.margins.r+r||0,o=e.margins.l+i||0,s=t-(o+r);return e.chartBox={height:0<n?n:0,width:0<t?t:0,axisXwidth:s=s<0?0:s,leftSpace:o,rightSpace:r,rangeMin:i,rangeMax:t-e.margins.l-r},e.chartBox},_render:function(){var e=this,t=(e.updateYaxis(),e.box()),n=e.margins,n=(e.renderVerticalLine(),e.selectionBox(),e.hoverBox(),e.axisX.render(),_.invokeMap(e.items,"render"),_.invokeMap(e.series,"render"),t.height-n.b-n.t);e._clipPath.attr({x:t.leftSpace,width:t.axisXwidth,height:0<n?n:0}),e.resetSelectLine()||e.onMove()},addItem:function(e){_.isObjectLike(e)&&-1===this.items.indexOf(e)&&this.items.push(e)},removeItem:function(e){this.items=_.without(this.items,e)},updateSeries:function(t,i){var r=this,o=r.axisX._to,s=r.axisX._from,a=r._aggregation,e=_.remove(r.series,function(e){return-1===t.indexOf(e.dataPoint)}),e=(_.invokeMap(e,"destroy"),_.map(t,function(t){var e,n;return _.find(r.series,function(e){return e.dataPoint===t})||(n=new d(r,t),r.series.push(n),i&&s&&o&&(e=n.loadDataAndRender(s,o,a))),e}).filter(_.identity));return(e.length?l.all(e):n()).finally(function(){r.render()})},loadData:function(t,n,i){var r=this;return r._aggregation=i,r.loading=!0,l.all(_.map(r.series,function(e){return e.loadData(t,n,i)})).then(function(e){r.truncated=_.some(e,{truncated:!0})}).finally(function(){r.loading=!1,r.render(!0)})},scaleY:function(){var e=this.box().height-this.margins.t-this.margins.b,t=this.margins.t;return d3.scale.linear().range([e,t]).nice()},getAxisY:function(){return _.filter(this.items,function(e){return e instanceof i})},getAxisYByOrientation:function(t){return _.filter(this.items,function(e){return e instanceof i&&e.orientation()===t})},updateYaxis:function(){var t=this,e=t.series,n=[],i=t.getAxisY();_.forEach(i,function(e){e.series.length=0}),_.forEach(e,function(r){var e=_.find(n,function(e){return _.find(e.series,function(e){return e=e,n=(t=r).dataPoint,i=e.dataPoint,t=t.scale().domain(),e=e.scale().domain(),n.yAxisType===i.yAxisType&&t[0]===e[0]&&t[1]===e[1];var t,n,i})});e||(e=i.length?i.shift():new m(t),n.push(e)),e.addSerie(r)}),_.invokeMap(i,"remove")},showDateSelection:function(){this.el.css({top:"55px"})},hideDateSelection:function(){this.el.css({top:"25px"})}},{Chart:v,renderTypes:o,lineTypes:t,axisTypes:r}}e.$inject=["$rootScope","$q","$injector","$timeout","c8ySeries","c8yAxisY","c8yAxisX","c8yHoverInfo","c8yChartCommon","gettext"],angular.module("c8y.core.measurements2").factory("c8yChart",e)}();
@@ -1 +1 @@
1
- "use strict";angular.module("c8y.core.measurements2").factory("c8yHoverInfo",function(){function e(e){var t=this;t._id=String(Math.random()).substr(2),e.addItem(t),t.chart=e,t.init()}function n(e,t){var a=moment(t);return"HOURLY"===e._aggregation?"".concat(a.format("ll")," ").concat(a.format("HH[:00]"),"-").concat(a.add(1,"hour").format("HH[:00]")):"MINUTELY"===e._aggregation?"".concat(a.format("ll")," ").concat(a.format("LT"),"-").concat(a.add(1,"minute").format("LT")):"DAILY"===e._aggregation?a.format("ll"):a.format("ll LTS")}return e.prototype={tplMain:$('<div class="c8y-chart-hover-box"></div>'),tplTime:$('<div class="clock"><i class="dlt-c8y-icon-clock-o"></i><span class="time"></span></div>'),tplRow:$('\n <div class="series">\n <div class="value-holder"><i class="dlt-c8y-icon-circle"></i><span class="label"></span><span class="value"></span></div>\n <div class="time-holder"><i class="dlt-c8y-icon-clock-o"></i><span class="time"></span></div>\n </div>\n '),init:function(){var t=this,e=$("body");t.el=$("<div>").append(t.tplMain.clone()).find(".c8y-chart-hover-box");var a=t.el;t.el.append(t.tplTime.clone()),t.clock=a.find(".clock .time"),t.el.hide(),e.append(a),t.mouseMove=function(e){t._mx=e.pageX,t._my=e.pageY},t.chart.el.on("mousemove",t.mouseMove)},destroy:function(){this.el.remove()},render:function(e){var o=this,t=o.chart.series,i=o.el;if(!i.is(":hidden")){if(e){var a=n(o.chart,e);o.clock.text(a)}_.forEach(t,function(e){var t=e._hoverRow;if(!t){var a=o.tplRow.clone();e._hoverRow={el:a,circle:a.find(".dlt-c8y-icon-circle"),label:a.find(".label"),value:a.find(".value"),time:a.find(".time")},t=e._hoverRow,a.data("seriedata",e),i.append(a)}t.circle.css({color:e.dataPoint.color}),t.label.text(e.dataPoint.label),t.value.text(e.hoverValue()),"--"!==e.hoverTime()?t.time.text(n(o.chart,e.hoverTime())):t.time.text(e.hoverTime())}),i.find(".series").filter(function(){return!_.includes(t,$(this).data("seriedata"))}).remove()}},onMove:function(e,t){var a=this,o=a.chart;if(_.get(o,"selectedPoint.date")&&!o.mouseIn){var i=$(o.el).offset();a._mx=i.left+t+10,a._my=i.top}var n=a.el.width(),c=o.box().width<t+o.margins.l+n,r=window.scrollY+window.innerHeight,l=this.el.outerHeight(),s="auto",d=c?-($("body").width()-a._mx):a._mx+1,m=a._my+20;r<m+l&&(m=r-l);var v={left:c?s:0,right:c?0:s,transform:"translate(".concat(d,"px,").concat(m,"px)")};a.render(e),a.el.css(v)}},e});
1
+ "use strict";angular.module("c8y.core.measurements2").factory("c8yHoverInfo",function(){function e(e){var t=this;t._id=String(Math.random()).substr(2),e.addItem(t),t.chart=e,t.init()}function n(e,t){t=moment(t);return"HOURLY"===e._aggregation?"".concat(t.format("ll")," ").concat(t.format("HH[:00]"),"-").concat(t.add(1,"hour").format("HH[:00]")):"MINUTELY"===e._aggregation?"".concat(t.format("ll")," ").concat(t.format("LT"),"-").concat(t.add(1,"minute").format("LT")):"DAILY"===e._aggregation?t.format("ll"):t.format("ll LTS")}return e.prototype={tplMain:$('<div class="c8y-chart-hover-box"></div>'),tplTime:$('<div class="clock"><i class="dlt-c8y-icon-clock-o"></i><span class="time"></span></div>'),tplRow:$('\n <div class="series">\n <div class="value-holder"><i class="dlt-c8y-icon-circle"></i><span class="label"></span><span class="value"></span></div>\n <div class="time-holder"><i class="dlt-c8y-icon-clock-o"></i><span class="time"></span></div>\n </div>\n '),init:function(){var t=this,e=$("body"),o=(t.el=$("<div>").append(t.tplMain.clone()).find(".c8y-chart-hover-box"),t.el);t.el.append(t.tplTime.clone()),t.clock=o.find(".clock .time"),t.el.hide(),e.append(o),t.mouseMove=function(e){t._mx=e.pageX,t._my=e.pageY},t.chart.el.on("mousemove",t.mouseMove)},destroy:function(){this.el.remove()},render:function(e){var a=this,t=a.chart.series,i=a.el;i.is(":hidden")||(e&&(e=n(a.chart,e),a.clock.text(e)),_.forEach(t,function(e){var t,o=e._hoverRow;o||(t=a.tplRow.clone(),e._hoverRow={el:t,circle:t.find(".dlt-c8y-icon-circle"),label:t.find(".label"),value:t.find(".value"),time:t.find(".time")},o=e._hoverRow,t.data("seriedata",e),i.append(t)),o.circle.css({color:e.dataPoint.color}),o.label.text(e.dataPoint.label),o.value.text(e.hoverValue()),"--"!==e.hoverTime()?o.time.text(n(a.chart,e.hoverTime())):o.time.text(e.hoverTime())}),i.find(".series").filter(function(){return!_.includes(t,$(this).data("seriedata"))}).remove())},onMove:function(e,t){var o=this,a=o.chart,i=(_.get(a,"selectedPoint.date")&&!a.mouseIn&&(i=$(a.el).offset(),o._mx=i.left+t+10,o._my=i.top),o.el.width()),t=a.box().width<t+a.margins.l+i,a=window.scrollY+window.innerHeight,i=this.el.outerHeight(),n="auto",c=t?-($("body").width()-o._mx):o._mx+1,l=o._my+20,a=(a<l+i&&(l=a-i),{left:t?n:0,right:t?0:n,transform:"translate(".concat(c,"px,").concat(l,"px)")});o.render(e),o.el.css(a)}},e});
@@ -1 +1 @@
1
- "use strict";!function(){function n(n,t){var e,r=[],o=c;if(t.has("ngZone")){var u=t.get("ngZone");o=function(){return u.runOutsideAngular(c)}}return function(n){return{start:function(){r.push(n),o()},refresh:_.noop,cancel:function(){_.pull(r,n),!r.length&&e&&(clearInterval(e),e=void 0)}}};function c(){!e&&r.length&&(e=setInterval(function(){_.forEach(r,function(n){return n()}),n.$applyAsync()},1e3))}}n.$inject=["$rootScope","$injector"],angular.module("c8y.core.measurements2").factory("RTAutoMove",n)}();
1
+ "use strict";!function(){function n(n,t){var e,r,o=[],u=c;return t.has("ngZone")&&(r=t.get("ngZone"),u=function(){return r.runOutsideAngular(c)}),function(n){return{start:function(){o.push(n),u()},refresh:_.noop,cancel:function(){_.pull(o,n),!o.length&&e&&(clearInterval(e),e=void 0)}}};function c(){!e&&o.length&&(e=setInterval(function(){_.forEach(o,function(n){return n()}),n.$applyAsync()},1e3))}}n.$inject=["$rootScope","$injector"],angular.module("c8y.core.measurements2").factory("RTAutoMove",n)}();
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(e,r,s,c){var a;function i(e,t,n,r,i){var a=i,o="NONE"!==r?r:void 0;return s.listForDataPoint(e,t,n,o,a)}function t(e,t){var n=this;return n.chart=e,n.dataPoint=t,n.hoverItems=[],n.values=[],n.implicitDomain={},n.bisect=d3.bisector(function(e){return e.time}).right,n.loadSeriesData=r.latest(i),n}return a=e.has("ngZone")?e.get("ngZone"):{runOutsideAngular:function(e){return e()}},t.prototype={defaultRenderType:"min",defaultLineType:"line",loadDataAndRender:function(e,t,n){var r=this;r.loadData(e,t,n).finally(function(){r.chart.render()})},loadData:function(e,t,n){var r=this,i=r.dataPoint,a=r._aggregation;return this.loadSeriesData(i,e,t,n,r.chart).then(function(e){return a!==n&&(r.values.length=0,r._aggregation=n,r.resetImplicitDomain()),r.appendValues(e.values),e})},appendValues:function(e){var a=this,o=a.values,s=a.implicitDomain;return _.forEach(e,function(e){if(_.isFinite(e.min)&&_.isFinite(e.max)){var t=new Date(e.time),n=t.getTime(),r=_.find(o,function(e){return n===e.time.getTime()}),i={time:t,val:{min:e.min,max:e.max}};o.length&&_.last(o).time.getTime()>n&&(a._valuesSortingNeeded=!0),r?_.assign(r,i):o.push(i),(_.isUndefined(s.min)||e.min<s.min)&&(s.min=e.min),(_.isUndefined(s.max)||e.max>s.max)&&(s.max=e.max)}}),o},destroy:function(){this.svg&&this.svg.remove(),this.hoverItems=[],delete this.svg},resetImplicitDomain:function(){this.implicitDomain.min=void 0,this.implicitDomain.max=void 0},domain:function(){var e=this.dataPoint,t=this.implicitDomain,n=_.isUndefined(e.min)||""===e.min||_.isNull(e.min)?t.min:Number(e.min),r=_.isUndefined(e.max)||""===e.max||_.isNull(e.max)?t.max:Number(e.max);return(_.isUndefined(n)||Number.isNaN(n))&&(n=d3.min(this.values,function(e){return e.val.min}),_.isUndefined(n)||(t.min=n),n=n||0),(_.isUndefined(r)||Number.isNaN(r))&&(r=d3.max(this.values,function(e){return e.val.max}),_.isUndefined(r)||(t.max=r),r=r||0),n===r&&(n-=1,r+=1),[n,r]},scale:function(){return this.chart.scaleY().domain(this.domain())},getRenderType:function(){return this.dataPoint.renderType||this.renderType||this.defaultRenderType},getLineType:function(){return this.dataPoint.lineType||this.lineType||this.defaultLineType},render:function(){var e=this,t=e.chart.svgSeries,n=e.getRenderType(),r=e.getLineType(),i=e.values,a=e.svg;if(!a||a.minOrMax===n&&a.chartType===n||e.destroy(),!e.svg){var o=e.chart.margins;e.svg=t.append("g").attr("transform",c.translate(o.l,o.t)).attr("class","series"),(a=e.svg).minOrMax=n,a.chartType=r}e._valuesSortingNeeded&&(delete e._valuesSortingNeeded,i.sort(function(e,t){return e.time>t.time?1:e.time<t.time?-1:0})),e.chart.allowSelectFocusTime||e.removeOldHiddenValues(),"bars"===r?e._render_bars():"area"!==n?e._render_path(n):e._render_area()},removeOldHiddenValues:function(){var e=this.values,n=this.chart.axisX._from,r=0;_.forEach(e,function(e,t){return!moment(e.time).isSameOrAfter(n)||(r=t-1,!1)}),r&&e.splice(0,r)},_render_path:function(t){var n=this,e=n.svg._path;function r(e){return n.chart.axisX.scale()(e.time)}function i(e){return n.scale()(e.val[t])}function a(){return n.dataPoint.color}e||(n.svg._path=n.svg.append("path"),(e=n.svg._path).style({"pointer-events":"none"})),n._create_update_focusPoint(1),n._render_path_line(e,r,i,a),n._render_path_points(r,i,a)},_render_path_line:function(e,t,n,r){var i=this,a=i.getLineType()||"linear",o=d3.svg.line().interpolate(a).x(t).y(n);_.includes(["bars","points"],i.getLineType())?(e.remove(),i.svg._path=void 0):e.attr("d",function(){return o(i.values)}).style({fill:"transparent",stroke:r})},_render_path_points:function(e,t,n){if(_.includes(["points","linePoints"],this.getLineType())){var r=this.svg.selectAll("circle.point").data(this.values);r.enter().append("circle").attr("class","point"),r.exit().remove(),r.attr("cx",e).attr("cy",t).attr("r",4).attr("fill","transparent").attr("stroke",n)}else this.svg.selectAll("circle.point").remove()},_render_bars:function(){var i=this,e=_.filter(i.chart.series,function(e){return e.getLineType()===i.getLineType()}),r=e.length,a=_.findIndex(e,function(e){return e===i}),o=i.svg.minOrMax,t=function(){var n=i.chart.axisX.scale();if(i._aggregation)return function(e){var t=n(e.time)-r*c()/2;return t+a*c()};return function(e){return n(e.time)}}(),n=l(),s=m(n),c=function(){var e=1;if(i._aggregation){var t=function(e){var t=i.chart.axisX.scale(),n=_slicedToArray(t.domain(),1)[0],r=moment(n).add(1,{MINUTELY:"minute",HOURLY:"hour",DAILY:"day"}[e]).toDate();return t(r)-t(n)}(i._aggregation);20<(e=t/(r+1))&&(e=20),e<1&&(e=1)}return _.constant(e)}();function l(e){var t=i.scale(),n=e;return n||(n="area"===o?"max":o),function(e){return t(e.val[n])}}function u(n){var r=_.max(i.scale().range());return function(e){var t=n(e);return r<t?r:t}}function m(t){var n=i.scale().range();return function(e){return Math.abs(_.max(n)-t(e))}}var d={x:t,y:u(n),width:c,height:s,fill:function(){return i.dataPoint.color}},v=i.svg.selectAll(".bars").data(i.values),f=v.enter().append("g").style("pointer-events","none").attr("class",function(e,t){return"bar index".concat(t)});if(f.append("rect").attr("class","barmain"),v.exit().remove(),v.select(".barmain").attr(d),"area"===o&&i._aggregation){f.append("rect").attr("class","barmin").style("opacity","0.2");var p=l("min"),h=_.defaults({fill:"#000",y:u(p),height:m(p)},d);v.select(".barmin").attr(h)}i._aggregation||i._create_update_focusPoint(1)},hover:function(e){var t=this,n=t.getRenderType(),r=t.getLineType(),i=t.values[e];(t.overPoint=i)&&(t._focusPointTime=i.time,"bars"===r&&this._hover_bars(e)),t._render_focusPoint(1,"area"!==n?n:"max"),t._render_focusPoint(2,"area"!==n?n:"min")},_hover_bars:function(e){this.svg.select(".hover").classed("hover",!1).style({opacity:1}),this.svg.select(".index".concat(e," .barmain")).classed("hover",!0).style({opacity:.5})},mouseleave:function(){"bars"===this.getLineType()&&this.svg.select(".hover").classed("hover",!1).style({opacity:1})},_create_update_focusPoint:function(e){var t=this,n="focusPoint".concat(e),r=t.svg[n];r||(t.svg[n]=t.svg.append("circle").style({visibility:t.chart.hoverItemsVisible?"visible":"hidden","pointer-events":"all"}).attr({cx:0,cy:0,r:3}),r=t.svg[n],t.addFocusPointEvent(r),t.hoverItems.push(r)),r.attr({fill:function(){return t.dataPoint.color}})},_render_focusPoint:function(e,t){var n=this.chart.axisX.scale(),r=this.scale(),i=this.svg,a=this.overPoint,o=i&&i["focusPoint".concat(e)];if(o)if(a){var s=i.xFocusScale?i.xFocusScale(a):n(a.time),c=r(a.val[t]);o.attr({cx:s,cy:c})}else o.style("visibility","hidden")},_render_area:function(){var t=this,e=t.getLineType()||"linear";function n(e){return t.chart.axisX.scale()(e.time)}function r(e){return t.scale()(e.val.max)}function i(e){return t.scale()(e.val.min)}function a(){return t.dataPoint.color}var o=d3.svg.area().interpolate(e).x(n).y0(r).y1(i),s=t.svg._path;s||(t.svg._path=t.svg.append("path").style({"pointer-events":"none",opacity:.8})),s=t.svg._path,t._create_update_focusPoint(1),t._create_update_focusPoint(2),s.attr("d",function(){return o(t.values)}).style({"pointer-events":"none",stroke:a,fill:a}),_.includes(["points","linePoints"],t.getLineType())?(t.svg.selectAll("circle.point.max").data(t.values).enter().append("circle").attr("class","point max"),t.svg.selectAll("circle.point.min").data(t.values).enter().append("circle").attr("class","point min"),t.svg.selectAll("circle.point.max").attr("cx",n).attr("cy",r).attr("r",4).attr("fill","transparent").attr("stroke",a),t.svg.selectAll("circle.point.min").attr("cx",n).attr("cy",i).attr("r",4).attr("fill","transparent").attr("stroke",a)):t.svg.selectAll("circle.point").remove()},onMove:function(e,t){var n=this.getNearIndex(e);this.hover(n,e,t)},hoverValue:function(){var e=this.getRenderType(),t=this.overPoint,n=this.dataPoint.unit||"",r=" -- ";if(t){var i=t.val,a=i.min,o=i.max;"min"===e&&(r="".concat(a," ").concat(n)),"max"===e&&(r="".concat(o," ").concat(n)),"area"===e&&(r="".concat(a," ").concat(n," — ").concat(o," ").concat(n))}return r},hoverTime:function(){var e=this.overPoint;return e?moment(e.time):"--"},getNearIndex:function(e){var t=e,n=this.values,r=n.length-1,i=this.bisect(n,e,1,r),a=n[i-1]&&n[i-1].time,o=n[i]&&n[i].time;return _.isUndefined(a)?i:_.isUndefined(o)?i-1:t-a<o-t?i-1:i},measurementFits:function(e){return s.rtMeasurementForDatapoint(this.dataPoint)(e)},addFocusPointEvent:function(e){var n=this,r=n.chart;e.on("click",function(){if(r.allowSelectFocusTime){var e={target:(n.dataPoint.__target||{}).id,date:moment(n._focusPointTime).format("YYYY-MM-DDTHH:mm:ss.SSSZ")},t=r.selectedPoint;t&&moment(e.date).isSame(moment(t.date))?r.clearSelectPoint():r.setSelectPoint(e)}}),e.on("mouseenter",function(){r.allowSelectFocusTime&&e.style({cursor:"pointer"}).attr({r:6})}),e.on("mouseleave",function(){r.allowSelectFocusTime&&e.style({cursor:"default"}).attr({r:3})})},realtimeMeasurement:function(e){var t=this,n=t.measurementFits(e),r=function(){t.appendValues(_.flattenDeep(t.__realtimeToAppend)),t.__realtimeToAppend=[],t.__realtimeToAppendTimout=void 0,t.chart.render()};if(n){t.__realtimeToAppend||(t.__realtimeToAppend=[]),t.__realtimeToAppend.push(n.values);var i=t.chart.axisX.getDebouncePreference();i.reset?(clearTimeout(t.__realtimeToAppendTimout),r()):t.__realtimeToAppendTimout||a.runOutsideAngular(function(){t.__realtimeToAppendTimout=setTimeout(r,i.debounceTime)})}return n}},t}e.$inject=["$injector","c8yBase","c8yMeasurements","c8yChartCommon"],angular.module("c8y.core.measurements2").factory("c8ySeries",e)}();
1
+ "use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(e,r,a,s){var i;function o(e,t,n,r,i){return a.listForDataPoint(e,t,n,"NONE"!==r?r:void 0,i)}function t(e,t){var n=this;return n.chart=e,n.dataPoint=t,n.hoverItems=[],n.values=[],n.implicitDomain={},n.bisect=d3.bisector(function(e){return e.time}).right,n.loadSeriesData=r.latest(o),n}return i=e.has("ngZone")?e.get("ngZone"):{runOutsideAngular:function(e){return e()}},t.prototype={defaultRenderType:"min",defaultLineType:"line",loadDataAndRender:function(e,t,n){var r=this;r.loadData(e,t,n).finally(function(){r.chart.render()})},loadData:function(e,t,n){var r=this,i=r.dataPoint,a=r._aggregation;return this.loadSeriesData(i,e,t,n,r.chart).then(function(e){return a!==n&&(r.values.length=0,r._aggregation=n,r.resetImplicitDomain()),r.appendValues(e.values),e})},appendValues:function(e){var i=this,a=i.values,o=i.implicitDomain;return _.forEach(e,function(e){var t,n,r;_.isFinite(e.min)&&_.isFinite(e.max)&&(r=new Date(e.time),t=r.getTime(),n=_.find(a,function(e){return t===e.time.getTime()}),r={time:r,val:{min:e.min,max:e.max}},a.length&&_.last(a).time.getTime()>t&&(i._valuesSortingNeeded=!0),n?_.assign(n,r):a.push(r),(_.isUndefined(o.min)||e.min<o.min)&&(o.min=e.min),_.isUndefined(o.max)||e.max>o.max)&&(o.max=e.max)}),a},destroy:function(){this.svg&&this.svg.remove(),this.hoverItems=[],delete this.svg},resetImplicitDomain:function(){this.implicitDomain.min=void 0,this.implicitDomain.max=void 0},domain:function(){var e=this.dataPoint,t=this.implicitDomain,n=_.isUndefined(e.min)||""===e.min||_.isNull(e.min)?t.min:Number(e.min),e=_.isUndefined(e.max)||""===e.max||_.isNull(e.max)?t.max:Number(e.max);return(_.isUndefined(n)||Number.isNaN(n))&&(n=d3.min(this.values,function(e){return e.val.min}),_.isUndefined(n)||(t.min=n),n=n||0),(_.isUndefined(e)||Number.isNaN(e))&&(e=d3.max(this.values,function(e){return e.val.max}),_.isUndefined(e)||(t.max=e),e=e||0),n===e&&(--n,e+=1),[n,e]},scale:function(){return this.chart.scaleY().domain(this.domain())},getRenderType:function(){return this.dataPoint.renderType||this.renderType||this.defaultRenderType},getLineType:function(){return this.dataPoint.lineType||this.lineType||this.defaultLineType},render:function(){var e,t=this,n=t.chart.svgSeries,r=t.getRenderType(),i=t.getLineType(),a=t.values,o=t.svg;!o||o.minOrMax===r&&o.chartType===r||t.destroy(),t.svg||(e=t.chart.margins,t.svg=n.append("g").attr("transform",s.translate(e.l,e.t)).attr("class","series"),(o=t.svg).minOrMax=r,o.chartType=i),t._valuesSortingNeeded&&(delete t._valuesSortingNeeded,a.sort(function(e,t){return e.time>t.time?1:e.time<t.time?-1:0})),t.chart.allowSelectFocusTime||t.removeOldHiddenValues(),"bars"===i?t._render_bars():"area"!==r?t._render_path(r):t._render_area()},removeOldHiddenValues:function(){var e=this.values,n=this.chart.axisX._from,r=0;_.forEach(e,function(e,t){return!moment(e.time).isSameOrAfter(n)||(r=t-1,!1)}),r&&e.splice(0,r)},_render_path:function(t){var n=this,e=n.svg._path;function r(e){return n.chart.axisX.scale()(e.time)}function i(e){return n.scale()(e.val[t])}function a(){return n.dataPoint.color}e||(n.svg._path=n.svg.append("path"),(e=n.svg._path).style({"pointer-events":"none"})),n._create_update_focusPoint(1),n._render_path_line(e,r,i,a),n._render_path_points(r,i,a)},_render_path_line:function(e,t,n,r){var i=this,a=i.getLineType()||"linear",o=d3.svg.line().interpolate(a).x(t).y(n);_.includes(["bars","points"],i.getLineType())?(e.remove(),i.svg._path=void 0):e.attr("d",function(){return o(i.values)}).style({fill:"transparent",stroke:r})},_render_path_points:function(e,t,n){var r;_.includes(["points","linePoints"],this.getLineType())?((r=this.svg.selectAll("circle.point").data(this.values)).enter().append("circle").attr("class","point"),r.exit().remove(),r.attr("cx",e).attr("cy",t).attr("r",4).attr("fill","transparent").attr("stroke",n)):this.svg.selectAll("circle.point").remove()},_render_bars:function(){var r=this,e=_.filter(r.chart.series,function(e){return e.getLineType()===r.getLineType()}),n=e.length,i=_.findIndex(e,function(e){return e===r}),a=r.svg.minOrMax,e=function(){var t=r.chart.axisX.scale();if(r._aggregation)return function(e){return t(e.time)-n*s()/2+i*s()};return function(e){return t(e.time)}}(),t=c(),o=u(t),s=function(){var e=1;{var t;r._aggregation&&(t=function(e){var t=r.chart.axisX.scale(),n=_slicedToArray(t.domain(),1)[0],e=moment(n).add(1,{MINUTELY:"minute",HOURLY:"hour",DAILY:"day"}[e]).toDate();return t(e)-t(n)}(r._aggregation),(e=20<(e=t/(n+1))?20:e)<1)&&(e=1)}return _.constant(e)}();function c(e){var t=r.scale(),n=(n=e)||("area"===a?"max":a);return function(e){return t(e.val[n])}}function l(t){var n=_.max(r.scale().range());return function(e){e=t(e);return n<e?n:e}}function u(t){var n=r.scale().range();return function(e){return Math.abs(_.max(n)-t(e))}}var e={x:e,y:l(t),width:s,height:o,fill:function(){return r.dataPoint.color}},t=r.svg.selectAll(".bars").data(r.values),o=t.enter().append("g").style("pointer-events","none").attr("class",function(e,t){return"bar index".concat(t)});o.append("rect").attr("class","barmain"),t.exit().remove(),t.select(".barmain").attr(e),"area"===a&&r._aggregation&&(o.append("rect").attr("class","barmin").style("opacity","0.2"),o=c("min"),o=_.defaults({fill:"#000",y:l(o),height:u(o)},e),t.select(".barmin").attr(o)),r._aggregation||r._create_update_focusPoint(1)},hover:function(e){var t=this,n=t.getRenderType(),r=t.getLineType(),i=t.values[e];(t.overPoint=i)&&(t._focusPointTime=i.time,"bars"===r)&&this._hover_bars(e),t._render_focusPoint(1,"area"!==n?n:"max"),t._render_focusPoint(2,"area"!==n?n:"min")},_hover_bars:function(e){this.svg.select(".hover").classed("hover",!1).style({opacity:1}),this.svg.select(".index".concat(e," .barmain")).classed("hover",!0).style({opacity:.5})},mouseleave:function(){"bars"===this.getLineType()&&this.svg.select(".hover").classed("hover",!1).style({opacity:1})},_create_update_focusPoint:function(e){var t=this,e="focusPoint".concat(e),n=t.svg[e];n||(t.svg[e]=t.svg.append("circle").style({visibility:t.chart.hoverItemsVisible?"visible":"hidden","pointer-events":"all"}).attr({cx:0,cy:0,r:3}),n=t.svg[e],t.addFocusPointEvent(n),t.hoverItems.push(n)),n.attr({fill:function(){return t.dataPoint.color}})},_render_focusPoint:function(e,t){var n=this.chart.axisX.scale(),r=this.scale(),i=this.svg,a=this.overPoint,e=i&&i["focusPoint".concat(e)];e&&(a?(i=i.xFocusScale?i.xFocusScale(a):n(a.time),n=r(a.val[t]),e.attr({cx:i,cy:n})):e.style("visibility","hidden"))},_render_area:function(){var t=this,e=t.getLineType()||"linear";function n(e){return t.chart.axisX.scale()(e.time)}function r(e){return t.scale()(e.val.max)}function i(e){return t.scale()(e.val.min)}function a(){return t.dataPoint.color}var o=d3.svg.area().interpolate(e).x(n).y0(r).y1(i),e=t.svg._path;e||(t.svg._path=t.svg.append("path").style({"pointer-events":"none",opacity:.8})),e=t.svg._path,t._create_update_focusPoint(1),t._create_update_focusPoint(2),e.attr("d",function(){return o(t.values)}).style({"pointer-events":"none",stroke:a,fill:a}),_.includes(["points","linePoints"],t.getLineType())?(t.svg.selectAll("circle.point.max").data(t.values).enter().append("circle").attr("class","point max"),t.svg.selectAll("circle.point.min").data(t.values).enter().append("circle").attr("class","point min"),t.svg.selectAll("circle.point.max").attr("cx",n).attr("cy",r).attr("r",4).attr("fill","transparent").attr("stroke",a),t.svg.selectAll("circle.point.min").attr("cx",n).attr("cy",i).attr("r",4).attr("fill","transparent").attr("stroke",a)):t.svg.selectAll("circle.point").remove()},onMove:function(e,t){var n=this.getNearIndex(e);this.hover(n,e,t)},hoverValue:function(){var e,t=this.getRenderType(),n=this.overPoint,r=this.dataPoint.unit||"",i=" -- ";return i=n&&(e=(n=n.val).min,n=n.max,"min"===t&&(i="".concat(e," ").concat(r)),"max"===t&&(i="".concat(n," ").concat(r)),"area"===t)?"".concat(e," ").concat(r," — ").concat(n," ").concat(r):i},hoverTime:function(){var e=this.overPoint;return e?moment(e.time):"--"},getNearIndex:function(e){var t=e,n=this.values,r=n.length-1,e=this.bisect(n,e,1,r),r=n[e-1]&&n[e-1].time,n=n[e]&&n[e].time;return!_.isUndefined(r)&&(_.isUndefined(n)||t-r<n-t)?e-1:e},measurementFits:function(e){return a.rtMeasurementForDatapoint(this.dataPoint)(e)},addFocusPointEvent:function(e){var n=this,r=n.chart;e.on("click",function(){var e,t;r.allowSelectFocusTime&&(e={target:(n.dataPoint.__target||{}).id,date:moment(n._focusPointTime).format("YYYY-MM-DDTHH:mm:ss.SSSZ")},(t=r.selectedPoint)&&moment(e.date).isSame(moment(t.date))?r.clearSelectPoint():r.setSelectPoint(e))}),e.on("mouseenter",function(){r.allowSelectFocusTime&&e.style({cursor:"pointer"}).attr({r:6})}),e.on("mouseleave",function(){r.allowSelectFocusTime&&e.style({cursor:"default"}).attr({r:3})})},realtimeMeasurement:function(e){function t(){r.appendValues(_.flattenDeep(r.__realtimeToAppend)),r.__realtimeToAppend=[],r.__realtimeToAppendTimout=void 0,r.chart.render()}var n,r=this,e=r.measurementFits(e);return e&&(r.__realtimeToAppend||(r.__realtimeToAppend=[]),r.__realtimeToAppend.push(e.values),(n=r.chart.axisX.getDebouncePreference()).reset?(clearTimeout(r.__realtimeToAppendTimout),t()):r.__realtimeToAppendTimout||i.runOutsideAngular(function(){r.__realtimeToAppendTimout=setTimeout(t,n.debounceTime)})),e}},t}e.$inject=["$injector","c8yBase","c8yMeasurements","c8yChartCommon"],angular.module("c8y.core.measurements2").factory("c8ySeries",e)}();
@@ -1 +1 @@
1
- "use strict";!function(){function t(i,r,n,u,a,c){function s(t){return _.map(t.matchKpi,function(t){return t.c8y_Kpi})}function o(t){o.cache[t]=o.cache[t]||n.listKpiForDevice(t).then(s);var e=o.cache[t];return e=e.catch(function(t){var e=t.data||{},n=c.getString(e.message);return a.add({type:"danger",text:n,detailedData:t}),i.reject(t)})}function f(t){var e=t.values,n=_.map(t.series,function(t){return t.fragment=t.type,t.values=[],t.timelist=[],t.dataPoints=[],t}),r=[];return _.forEach(e,function(i,t){var a=moment(t).toDate();r.push(a),_.forEach(n,function(t,e){var n=i[e];!_.isObjectLike(n)||_.isUndefined(n.min)||_.isUndefined(n.max)||(t.values.push(n),t.timelist.push(a),t.dataPoints.push({val:n,time:a}))})}),n=_.filter(n,function(t){return t.values.length}),(n=_.map(n,m)).truncated=t.truncated||!1,n}function m(t){return _.assign(t,{getNearIndex:function(t){return function(t,e){var n=e,i=t.timelist,a=d3.bisect(i,n,1,i.length-1),r=i[a-1],u=i[a],c=a;return _.isUndefined(r)||(_.isUndefined(u)?c=a-1:n-r<u-n&&(c=a-1)),c}(this,t)}})}function d(t,e,n){return _.find(n,{fragment:t,series:e})}return o.cache={},{getKpi:o,getSeries:function(t,c,e,n,i){var a={source:t,dateFrom:e?moment(e).format(u.dateFullFormat):e,dateTo:n?moment(n).format(u.dateFullFormat):n,aggregationType:"NONE"!==i?i:void 0};return r.listSeries(a).then(f).then(function(t){var e=_.isString(c),n=_.isArray(c),i=t.truncated,a=t;if(e){var r=c;a=_.filter(t,{type:r})}else if(n){var u=c;a=_.filter(t,function(t){return _.find(u,{fragment:t.fragment,series:t.name})}),_.forEach(a,function(t){t.kpi=d(t.type,t.name,u)})}return a.truncated=i,a})},getMaxTimeFromSeries:function(t){return d3.max(_.flattenDeep(_.map(t,"timelist")))},getKpiOfSerie:function(t,e){return d(t.fragment,t.name,e)},appendMeasurement:function(t,e,n){var r=_.isString(t),u=r?[t]:_.uniq(_.map(n,"fragment")),c=!1,s=_.isArray(e)?e:[e];return _.forEach(s,function(t){var i=moment(t.time).toDate(),a=_.flattenDeep(_.map(u,function(t){return function(c,t){var s=_.reduce(t,function(n,t){return _.forEach(t[c],function(t,e){n[e]||(n[e]={unit:t.unit}),n[e].unit||(n[e].unit=t.unit)}),n},{}),e=_.keys(s),o=[],n=[];return _.forEach(t,function(t){var r=t[c],u=moment(t.time).toDate();_.forEach(e,function(t,e){o[e]=o[e]||{fragment:c,name:t,unit:s[t].unit,values:[],timelist:[],dataPoints:[]};var n=o[e];if(r[t]){var i=r[t].value,a={min:i,max:i};n.values.push(a),n.timelist.push(u),n.dataPoints.push({time:u,val:a})}}),n.push(u)}),{timeList:n,series:o}}(t,s).series}));c=c||a.length,_.forEach(n,function(t){var e=_.find(a,{fragment:t.fragment,name:t.name});if(e){var n=d3.bisect(t.timelist,i);t.timelist.splice(n,0,i),t.values.splice(n,0,_.head(e.values)),t.dataPoints.splice(n,0,_.head(e.dataPoints)),e.found=!0}}),r&&_.forEach(_.filter(a,function(t){return!t.found}),function(t){n.push(t)})}),{hasNew:c,series:n}},getDOMId:function(t,e){var n=[t.kpi&&t.kpi.__target?"target".concat(t.kpi.__target.id):"",t.fragment,e,t.name].join("");return"id".concat(window.btoa(n).replace(/[/=]/gi,"_"))}}}t.$inject=["$q","c8yMeasurements","c8yKpi","c8yBase","c8yAlert","gettextCatalog"],angular.module("c8y.core.measurements2").service("c8yLineChartSvc",t)}();
1
+ "use strict";!function(){function t(n,a,e,r,i,u){function c(t){return _.map(t.matchKpi,function(t){return t.c8y_Kpi})}function o(t){return o.cache[t]=o.cache[t]||e.listKpiForDevice(t).then(c),o.cache[t].catch(function(t){var e=t.data||{},e=u.getString(e.message);return i.add({type:"danger",text:e,detailedData:t}),n.reject(t)})}function s(t){var e=t.values,a=_.map(t.series,function(t){return t.fragment=t.type,t.values=[],t.timelist=[],t.dataPoints=[],t}),r=[];return _.forEach(e,function(n,t){var i=moment(t).toDate();r.push(i),_.forEach(a,function(t,e){e=n[e];!_.isObjectLike(e)||_.isUndefined(e.min)||_.isUndefined(e.max)||(t.values.push(e),t.timelist.push(i),t.dataPoints.push({val:e,time:i}))})}),a=_.filter(a,function(t){return t.values.length}),(a=_.map(a,f)).truncated=t.truncated||!1,a}function f(t){return _.assign(t,{getNearIndex:function(t){return t=t,e=(e=this).timelist,n=d3.bisect(e,t,1,e.length-1),i=e[n-1],e=e[n],a=n,_.isUndefined(i)||(_.isUndefined(e)||t-i<e-t)&&(a=n-1),a;var e,n,i,a}})}function m(t,e,n){return _.find(n,{fragment:t,series:e})}return o.cache={},{getKpi:o,getSeries:function(t,u,e,n,i){return t={source:t,dateFrom:e&&moment(e).format(r.dateFullFormat),dateTo:n&&moment(n).format(r.dateFullFormat),aggregationType:"NONE"!==i?i:void 0},a.listSeries(t).then(s).then(function(t){var e,n=_.isString(u),i=_.isArray(u),a=t.truncated,r=t;return n?r=_.filter(t,{type:u}):i&&(e=u,r=_.filter(t,function(t){return _.find(e,{fragment:t.fragment,series:t.name})}),_.forEach(r,function(t){t.kpi=m(t.type,t.name,e)})),r.truncated=a,r})},getMaxTimeFromSeries:function(t){return d3.max(_.flattenDeep(_.map(t,"timelist")))},getKpiOfSerie:function(t,e){return m(t.fragment,t.name,e)},appendMeasurement:function(t,e,n){var r=_.isString(t),u=r?[t]:_.uniq(_.map(n,"fragment")),c=!1,o=_.isArray(e)?e:[e];return _.forEach(o,function(t){var i=moment(t.time).toDate(),a=_.flattenDeep(_.map(u,function(t){return a=t,t=o,r=_.reduce(t,function(n,t){return _.forEach(t[a],function(t,e){n[e]||(n[e]={unit:t.unit}),n[e].unit||(n[e].unit=t.unit)}),n},{}),e=_.keys(r),u=[],c=[],_.forEach(t,function(t){var n=t[a],i=moment(t.time).toDate();_.forEach(e,function(t,e){u[e]=u[e]||{fragment:a,name:t,unit:r[t].unit,values:[],timelist:[],dataPoints:[]};e=u[e];n[t]&&(t=n[t].value,e.values.push(t={min:t,max:t}),e.timelist.push(i),e.dataPoints.push({time:i,val:t}))}),c.push(i)}),u;var a,r,e,u,c}));c=c||a.length,_.forEach(n,function(t){var e,n=_.find(a,{fragment:t.fragment,name:t.name});n&&(e=d3.bisect(t.timelist,i),t.timelist.splice(e,0,i),t.values.splice(e,0,_.head(n.values)),t.dataPoints.splice(e,0,_.head(n.dataPoints)),n.found=!0)}),r&&_.forEach(_.filter(a,function(t){return!t.found}),function(t){n.push(t)})}),{hasNew:c,series:n}},getDOMId:function(t,e){return e=[t.kpi&&t.kpi.__target?"target".concat(t.kpi.__target.id):"",t.fragment,e,t.name].join(""),"id".concat(window.btoa(e).replace(/[/=]/gi,"_"))}}}t.$inject=["$q","c8yMeasurements","c8yKpi","c8yBase","c8yAlert","gettextCatalog"],angular.module("c8y.core.measurements2").service("c8yLineChartSvc",t)}();
@@ -1 +1 @@
1
- "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,a,o,s=[],u=!0,c=!1;try{if(a=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=a.call(i)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);var n=i.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,a,i,t,d,o,n,r,s,u,c,l,y,f,p,v){var g,m=this,b=i.deviceId,A={types:[]},I={IS_REQUIRED:"required",ADDRESS_IN_USE:"address-in-use",ADDRESSES_IN_USE:"addresses-in-use",ADDRESS_INVALID:"address-invalid",POLLING_RATE_LARGER_THAN_TRANSMIT_RATE:"polling-rate-larger-than-transmit-rate",ONLY_NATURAL_NUMBERS_ALLOWED:"only-natural-numbers-allowed",IPADDRESS_INVALID_FORMAT:"ip",INVALID_URL:"invalid-url",NODE_IN_USE:"node-in-use",NODE_OUT_OF_RANGE:"node-out-of-range",IP_RANGE:"ip-range",PORT_INVALID:"port-invalid",IP_RANGE_MAXLIMIT:"ip-range-maxlimit",ENGINEID_IN_USE:"engineid-in-use",IS_MIN:"min"},S=(_defineProperty(g={},I.IS_REQUIRED,p("This field is required.")),_defineProperty(g,I.ADDRESS_IN_USE,p("This address is already in use.")),_defineProperty(g,I.ADDRESSES_IN_USE,p("These addresses are already in use.")),_defineProperty(g,I.ADDRESS_INVALID,p("Addresses from 248 up to 254 are not allowed.")),_defineProperty(g,I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,p("Polling rate must be equal to or smaller than transmit rate.")),_defineProperty(g,I.ONLY_NATURAL_NUMBERS_ALLOWED,p("Only natural numbers allowed.")),_defineProperty(g,I.IPADDRESS_INVALID_FORMAT,p("The IP address format is invalid.")),_defineProperty(g,I.INVALID_URL,p("The URL format is invalid. The only supported protocols are http, https and opc.tcp.")),_defineProperty(g,I.NODE_IN_USE,p("This node id is already in use.")),_defineProperty(g,I.IP_RANGE,p("Invalid IP address range.")),_defineProperty(g,I.PORT_INVALID,p("Invalid port number.")),_defineProperty(g,I.IP_RANGE_MAXLIMIT,p("Max. 30 IP addresses in total allowed.")),_defineProperty(g,I.NODE_OUT_OF_RANGE,p("Only node ID(s) between 1 and 127 are allowed.")),_defineProperty(g,I.ENGINEID_IN_USE,p("This engine ID is already in use.")),_defineProperty(g,I.IS_MIN,p("Value cannot be lower than minimum.")),g);function P(){var i=m.device,e={};_.assign(m,{hasSerialConfigOperation:r.supportsOperation(i,"c8y_SerialConfiguration"),hasFieldBusConfigOperation:function(e){return L()&&r.supportsOperation(e,"c8y_CanConfiguration")||O()&&r.supportsOperation(e,"c8y_ModbusConfiguration")||M()&&r.supportsOperation(e,"c8y_OPCUAConfiguration")||U()&&r.supportsOperation(e,"c8y_ProfibusConfiguration")||w()&&r.supportsOperation(e,"c8y_CANopenConfiguration")||V()&&r.supportsOperation(e,"c8y_SNMPConfiguration")}(i),serialConfiguration:function(e){return _.get(e,"c8y_SerialConfiguration",{})}(i),fieldbusConfiguration:function(e){var t={};e&&(O()?t=e.c8y_ModbusConfiguration:L()?t=e.c8y_CanConfiguration:M()?(e.c8y_OPCUAGateway&&(e.c8y_OPCUAGateway.transmitRate=e.c8y_OPCUAGateway.transmitRate||0,_.unset(e,"c8y_OPCUAGateway.userIdentityPassword")),t=e.c8y_OPCUAGateway):U()?(_.defaultsDeep(e,{c8y_ProfibusConfiguration:{baudRate:p("automatic")}}),t=e.c8y_ProfibusConfiguration):w()?t=e.c8y_CANopenConfiguration:V()&&(e.c8y_SNMPGateway&&(e.c8y_SNMPGateway.transmitRate=e.c8y_SNMPGateway.transmitRate||0,_.unset(e,"c8y_SNMPGateway.userIdentityPassword")),t=e.c8y_SNMPGateway));return t}(i)}),(V()||O())&&(e={pageSize:2e3});var t=m.tab;return c.getAvailableDeviceTypes({fieldbusType:t},e).then(function(e){var t=c.getFieldbusVersionFromDevice(i);_.set(m.fieldbusConfiguration,"maxFieldbusVersion",t),A.types=_.filter(e,function(e){return e.fieldbusVersion<=t})})}function D(){var e=function(e){var t=n.timeOrderFilter(e||{});return _.assign(t,_.pick(i,"deviceId")),t.revert=!0,t}({pageSize:1,fragmentType:"c8y_SnmpAutoDiscovery",status:"EXECUTING"});return o.list(e).then(N).then(h)}function N(e){var i=_slicedToArray(e,1)[0];if(i){m.autoDiscoveryInProgress=!0;var n=a.defer(),t="operation".concat(i.id),r="/operations/".concat(i.deviceId);return l.getStatus(t,r)&&l.destroySubscription(t,r),l.addListener(t,r,"UPDATE",function(e,t){t.id===i.id&&(t.status===o.status.SUCCESSFUL||t.status===o.status.FAILED?n.resolve(t):n.notify(t))}),l.start(t,r),a.when({completed:n.promise})}return!1}function R(){return r.childDevices(b).then(function(e){var t=V()?_.orderBy(e,["name"],["asc"]):e;m.devices=_.map(t,function(e){var t;return O()&&e.c8y_ModbusDevice?t=function(e){var t=C({device:e,fieldbusDeviceFragment:"c8y_ModbusDevice"});return{id:e.id,name:e.name,deviceType:_.get(t,"name"),address:e.c8y_ModbusDevice.address,ipAddress:e.c8y_ModbusDevice.ipAddress,protocol:e.c8y_ModbusDevice.protocol}}(e):L()&&e.c8y_CanDevice?t=function(e){var t=C({device:e,fieldbusDeviceFragment:"c8y_CanDevice"});return{id:e.id,name:e.name,deviceType:_.get(t,"name")}}(e):M()&&e.c8y_OPCUADevice?t=function(e){var t=C({device:e,fieldbusDeviceFragment:"c8y_OPCUADevice"});return{id:e.id,name:e.name,deviceType:_.get(t,"name"),directoryPath:e.c8y_OPCUADevice.browsePath}}(e):U()&&e.c8y_ProfibusDevice?t=function(e){var t=C({device:e,fieldbusDeviceFragment:"c8y_ProfibusDevice"});return{id:e.id,name:e.name,deviceType:_.get(t,"name")}}(e):w()&&e.c8y_CANopenDevice?t=function(e){var t=C({device:e,fieldbusDeviceFragment:"c8y_CANopenDevice"});return{id:e.id,name:e.name,deviceType:_.get(t,"name"),nodeId:e.c8y_CANopenDevice.nodeId}}(e):V()&&e.c8y_SNMPDevice&&(t=function(e){var t=C({device:e,fieldbusDeviceFragment:"c8y_SNMPDevice"});return{id:e.id,name:e.name,deviceType:_.get(t,"name"),ipAddress:e.c8y_SNMPDevice.ipAddress,port:e.c8y_SNMPDevice.port,version:e.c8y_SNMPDevice.version,auth:_.get(e.c8y_SNMPDevice,"auth",{})}}(e)),t})})}function C(e){var i=e.device,n=e.fieldbusDeviceFragment;return _(A.types).find(function(e){var t=e.id;return _.get(i,"".concat(n,".type"))==="/inventory/managedObjects/".concat(t)})}function E(){var e=m.fieldbusCommunicationForm;e.$setPristine(),e.$setUntouched()}function T(e){var t,i=e.split("-").map(function(e){return e.trim()}),n=f.validation.ip.pattern,r=f.validation.ipV6.pattern;if(2===i.length){var a=_slicedToArray(i,2),o=a[0],s=a[1],u=n.test(o)&&n.test(s),c=r.test(o)&&r.test(s);if(u||c)try{t=new d.Ip.Range(o,s)}catch(e){}}return t}function h(e){e.completed.then(function(e){e.status===o.status.SUCCESSFUL?(u.success(p("Autodiscovery completed.")),m.autoDiscoveryInProgress=!1):e.status===o.status.FAILED&&(e.failureReason?u.danger(v.getString('Autodiscovery failed due to: "{{ failureReason | translate }}".',e)):u.danger(p("Autodiscovery failed.")),m.autoDiscoveryInProgress=!1)},_.noop,function(){u.success(p("Autodiscovery in progress."))}).then(R)}function O(){return"modbus"===m.tab}function L(){return"canbus"===m.tab}function M(){return"opcua"===m.tab}function U(){return"profibus"===m.tab}function w(){return"canopen"===m.tab}function V(){return"snmp"===m.tab}_.assign(m,{$onInit:function(){r.detail(b).then(n.getResData).then(function(e){O()?_.defaults(e.c8y_SerialConfiguration,{baudRate:19200,dataBits:8,parity:"E",stopBits:1}):L()&&(m.serialConfigurationOptions.baudRates=[1e5,125e3,25e4,5e5,1e6]),m.device=e}).then(P).then(R).then(D)},shouldShowSerialPanel:function(){return O()&&_.get(m,"device.c8y_SerialConfiguration")},isModbusTab:O,isCanBusTab:L,isOPCUATab:M,isProfibusTab:U,isCanOpenTab:w,isSNMPTab:V,getFieldValidationHints:_.curryRight(n.validationHints)(S),serialConfigurationOptions:{baudRates:[110,300,600,1200,2400,4800,9600,14400,19200,38400,57600,115200,25e4,460800,5e5,921600,1e6],dataBits:[8],parities:["N","E","O"],stopBits:[1,2]},fieldbusConfigurationOptions:{baudRates:[{value:1e3,label:"1 Mbit/s"},{value:800,label:"800 kbit/s"},{value:500,label:"500 kbit/s"},{value:250,label:"250 kbit/s"},{value:125,label:"125 kbit/s"},{value:50,label:"50 kbit/s"},{value:20,label:"20 kbit/s"},{value:10,label:"10 kbit/s"}]},deviceConfigurationOptions:A,fieldErrors:I,fieldErrorsToMessages:S,saveSerialConfig:function(){(function(e){return o.create({deviceId:e.id,description:p("Set serial configuration"),c8y_SerialConfiguration:e.c8y_SerialConfiguration})})(m.device).then(function(){return u.success(p("Settings will be applied."))})},saveFieldbusConfig:function(){(function(e){var t=a.resolve();O()&&e.c8y_ModbusConfiguration?t=function(e){return o.create({deviceId:e.id,description:p("Set modbus configuration"),c8y_ModbusConfiguration:_.omit(e.c8y_ModbusConfiguration,["maxFieldbusVersion"])})}(e):L()?t=function(e){return o.create({deviceId:e.id,description:p("Set CAN Bus configuration"),c8y_CanConfiguration:_.omit(e.c8y_CanConfiguration,["maxFieldbusVersion"])})}(e):M()?t=function(e){var t=e.c8y_OPCUAGateway.transmitRate,i=_.merge(_.cloneDeep(e),{c8y_OPCUAGateway:{transmitRate:0===t?void 0:t}});return r.update(_.pick(i,["id","c8y_OPCUAGateway"]))}(e):U()?t=function(e){return o.create({deviceId:e.id,description:p("Set Profibus configuration"),c8y_ProfibusConfiguration:_.pick(e.c8y_ProfibusConfiguration,["transmitRate","slaveAddress"])})}(e):w()?t=function(e){return o.create({deviceId:e.id,description:p("Set CAN Open configuration"),c8y_CANopenConfiguration:_.omit(e.c8y_CANopenConfiguration,["maxFieldbusVersion"])})}(e):V()&&(t=function(e){var t=e.c8y_SNMPGateway.transmitRate,i=_.merge(_.cloneDeep(e),{c8y_SNMPGateway:{transmitRate:0===t?void 0:t}});return r.update(_.pick(i,["id","c8y_SNMPGateway"])).then(E)}(e));return t})(m.device).then(function(){return u.success(p("Settings will be applied."))})},invalid:function(e,t){(O()||M())&&function(e){var t=m[e],i=t.pollingRate;if(i){var n=t.transmitRate,r=!0,a=!0,o=i.$modelValue<=n.$modelValue;M()&&0===n.$modelValue&&(o=!0),(!_.isInteger(n.$modelValue)||n.$modelValue<=0)&&(r=!1),(!_.isInteger(i.$modelValue)||i.$modelValue<=0)&&(a=!1),n.$setValidity(I.ONLY_NATURAL_NUMBERS_ALLOWED,r),n.$setValidity(I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,o),i.$setValidity(I.ONLY_NATURAL_NUMBERS_ALLOWED,a),i.$setValidity(I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,o)}}(e);M()&&function(e){var t=m[e].OPCUAUrl,i=f.validation.opcuaBrowsePath.pattern,n=t.$modelValue;t.$setValidity(I.INVALID_URL,!n||i.test(n))}(e);V()&&function(e){var t=m[e].ipRange,i=t.$modelValue;if(i){var n=i.split(",").map(function(e){return e.trim()}),r=_.every(n,T);t.$setValidity(I.IP_RANGE,r),r&&function(e){var t=e.$modelValue,i=!0,n=!0,r=BigInt(30);if(t){var a=BigInt(0),o=t.split(",");_.forEach(o,function(e){var t=T(e);t||(i=!1),a+=BigInt(t.countIps())}),(r<a||a<-r)&&(n=!1)}e.$setValidity(I.IP_RANGE,i),e.$setValidity(I.IP_RANGE_MAXLIMIT,n)}(t)}}(e);return n.invalid(m,e,t)},reloadDevices:R,onClickDelete:function(e){s({title:p("Delete device"),body:v.getString('You are about to delete device "{{name}}". Do you want to proceed?',e),size:"sm",labels:{ok:p("Delete")},status:"danger"}).then(function(){return r.remove(e)}).then(function(){return w()?y.onRemove(m.device,e):a.resolve()}).then(function(){m.devices=_.without(m.devices,e),r.update({id:m.device.id}),u.success(p("Device deleted."))}).catch(function(e){e&&u.danger(e)})},navigateToDetail:function(e){t.url("device/".concat(e.id))},triggerAutodiscovery:function(e){m.autoDiscoveryInProgress=!0;var t=e.ipRange.$modelValue;if(t){var i={deviceId:b,description:p("Autodiscovery request"),c8y_SnmpAutoDiscovery:{ipRange:t}};o.createWithNotifications(i).then(h)}},autoDiscoveryInProgress:!1,canTriggerAutodiscovery:function(e){return m.autoDiscoveryInProgress||e.ipRange.$dirty||_.isEmpty(e.ipRange.$modelValue)}})}e.$inject=["$rootScope","$q","$routeParams","$location","$window","c8yDeviceControl","c8yBase","c8yDevices","c8yModal","c8yAlert","c8yDeviceDatabase","c8yRealtime","c8yCanopenDevice","c8yConfig","gettext","gettextCatalog"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusConfig",{templateUrl:":::PLUGIN_PATH:::/fieldbus-config.html",bindings:{tab:"@"},controllerAs:"vm",controller:e})}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var i;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,r,o,a,s=[],u=!0,c=!1;try{if(o=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{if(!u&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!==_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,r,t,i,o,a,n,s,u,c,d,l,y,f,p,v){var g,m=this,b=t.deviceId,A={types:[]},I={IS_REQUIRED:"required",ADDRESS_IN_USE:"address-in-use",ADDRESSES_IN_USE:"addresses-in-use",ADDRESS_INVALID:"address-invalid",POLLING_RATE_LARGER_THAN_TRANSMIT_RATE:"polling-rate-larger-than-transmit-rate",ONLY_NATURAL_NUMBERS_ALLOWED:"only-natural-numbers-allowed",IPADDRESS_INVALID_FORMAT:"ip",INVALID_URL:"invalid-url",NODE_IN_USE:"node-in-use",NODE_OUT_OF_RANGE:"node-out-of-range",IP_RANGE:"ip-range",PORT_INVALID:"port-invalid",IP_RANGE_MAXLIMIT:"ip-range-maxlimit",ENGINEID_IN_USE:"engineid-in-use",IS_MIN:"min"};_defineProperty(g={},I.IS_REQUIRED,p("This field is required.")),_defineProperty(g,I.ADDRESS_IN_USE,p("This address is already in use.")),_defineProperty(g,I.ADDRESSES_IN_USE,p("These addresses are already in use.")),_defineProperty(g,I.ADDRESS_INVALID,p("Addresses from 248 up to 254 are not allowed.")),_defineProperty(g,I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,p("Polling rate must be equal to or smaller than transmit rate.")),_defineProperty(g,I.ONLY_NATURAL_NUMBERS_ALLOWED,p("Only natural numbers allowed.")),_defineProperty(g,I.IPADDRESS_INVALID_FORMAT,p("The IP address format is invalid.")),_defineProperty(g,I.INVALID_URL,p("The URL format is invalid. The only supported protocols are http, https and opc.tcp.")),_defineProperty(g,I.NODE_IN_USE,p("This node id is already in use.")),_defineProperty(g,I.IP_RANGE,p("Invalid IP address range.")),_defineProperty(g,I.PORT_INVALID,p("Invalid port number.")),_defineProperty(g,I.IP_RANGE_MAXLIMIT,p("Max. 30 IP addresses in total allowed.")),_defineProperty(g,I.NODE_OUT_OF_RANGE,p("Only node ID(s) between 1 and 127 are allowed.")),_defineProperty(g,I.ENGINEID_IN_USE,p("This engine ID is already in use.")),_defineProperty(g,I.IS_MIN,p("Value cannot be lower than minimum."));function S(){var i=m.device,e={},t=(_.assign(m,{hasSerialConfigOperation:s.supportsOperation(i,"c8y_SerialConfiguration"),hasFieldBusConfigOperation:(t=i,O()&&s.supportsOperation(t,"c8y_CanConfiguration")||h()&&s.supportsOperation(t,"c8y_ModbusConfiguration")||L()&&s.supportsOperation(t,"c8y_OPCUAConfiguration")||M()&&s.supportsOperation(t,"c8y_ProfibusConfiguration")||U()&&s.supportsOperation(t,"c8y_CANopenConfiguration")||w()&&s.supportsOperation(t,"c8y_SNMPConfiguration")),serialConfiguration:_.get(i,"c8y_SerialConfiguration",{}),fieldbusConfiguration:function(e){var t={};e&&(h()?t=e.c8y_ModbusConfiguration:O()?t=e.c8y_CanConfiguration:L()?(e.c8y_OPCUAGateway&&(e.c8y_OPCUAGateway.transmitRate=e.c8y_OPCUAGateway.transmitRate||0,_.unset(e,"c8y_OPCUAGateway.userIdentityPassword")),t=e.c8y_OPCUAGateway):M()?(_.defaultsDeep(e,{c8y_ProfibusConfiguration:{baudRate:p("automatic")}}),t=e.c8y_ProfibusConfiguration):U()?t=e.c8y_CANopenConfiguration:w()&&(e.c8y_SNMPGateway&&(e.c8y_SNMPGateway.transmitRate=e.c8y_SNMPGateway.transmitRate||0,_.unset(e,"c8y_SNMPGateway.userIdentityPassword")),t=e.c8y_SNMPGateway));return t}(i)}),(w()||h())&&(e={pageSize:2e3}),m.tab);return d.getAvailableDeviceTypes({fieldbusType:t},e).then(function(e){var t=d.getFieldbusVersionFromDevice(i);_.set(m.fieldbusConfiguration,"maxFieldbusVersion",t),A.types=_.filter(e,function(e){return e.fieldbusVersion<=t})})}function P(){e={pageSize:1,fragmentType:"c8y_SnmpAutoDiscovery",status:"EXECUTING"},e=n.timeOrderFilter(e||{}),_.assign(e,_.pick(t,"deviceId")),e.revert=!0;var e;return a.list(e).then(D).then(T)}function D(e){var i,t,n=_slicedToArray(e,1)[0];return!!n&&(m.autoDiscoveryInProgress=!0,i=r.defer(),e="operation".concat(n.id),t="/operations/".concat(n.deviceId),l.getStatus(e,t)&&l.destroySubscription(e,t),l.addListener(e,t,"UPDATE",function(e,t){t.id===n.id&&(t.status===a.status.SUCCESSFUL||t.status===a.status.FAILED?i.resolve(t):i.notify(t))}),l.start(e,t),r.when({completed:i.promise}))}function N(){return s.childDevices(b).then(function(e){e=w()?_.orderBy(e,["name"],["asc"]):e;m.devices=_.map(e,function(e){var t,i,n,r,o,a;return h()&&e.c8y_ModbusDevice?(a=R({device:o=e,fieldbusDeviceFragment:"c8y_ModbusDevice"}),a={id:o.id,name:o.name,deviceType:_.get(a,"name"),address:o.c8y_ModbusDevice.address,ipAddress:o.c8y_ModbusDevice.ipAddress,protocol:o.c8y_ModbusDevice.protocol}):O()&&e.c8y_CanDevice?(r=R({device:o=e,fieldbusDeviceFragment:"c8y_CanDevice"}),a={id:o.id,name:o.name,deviceType:_.get(r,"name")}):L()&&e.c8y_OPCUADevice?(n=R({device:r=e,fieldbusDeviceFragment:"c8y_OPCUADevice"}),a={id:r.id,name:r.name,deviceType:_.get(n,"name"),directoryPath:r.c8y_OPCUADevice.browsePath}):M()&&e.c8y_ProfibusDevice?(i=R({device:n=e,fieldbusDeviceFragment:"c8y_ProfibusDevice"}),a={id:n.id,name:n.name,deviceType:_.get(i,"name")}):U()&&e.c8y_CANopenDevice?(t=R({device:i=e,fieldbusDeviceFragment:"c8y_CANopenDevice"}),a={id:i.id,name:i.name,deviceType:_.get(t,"name"),nodeId:i.c8y_CANopenDevice.nodeId}):w()&&e.c8y_SNMPDevice&&(e=R({device:t=e,fieldbusDeviceFragment:"c8y_SNMPDevice"}),a={id:t.id,name:t.name,deviceType:_.get(e,"name"),ipAddress:t.c8y_SNMPDevice.ipAddress,port:t.c8y_SNMPDevice.port,version:t.c8y_SNMPDevice.version,auth:_.get(t.c8y_SNMPDevice,"auth",{})}),a})})}function R(e){var t=e.device,i=e.fieldbusDeviceFragment;return _(A.types).find(function(e){e=e.id;return _.get(t,"".concat(i,".type"))==="/inventory/managedObjects/".concat(e)})}function C(){var e=m.fieldbusCommunicationForm;e.$setPristine(),e.$setUntouched()}function E(e){var t,e=e.split("-").map(function(e){return e.trim()}),i=f.validation.ip.pattern,n=f.validation.ipV6.pattern;if(2===e.length){var e=_slicedToArray(e,2),r=e[0],e=e[1],i=i.test(r)&&i.test(e),n=n.test(r)&&n.test(e);if(i||n)try{t=new o.Ip.Range(r,e)}catch(e){}}return t}function T(e){e.completed.then(function(e){e.status===a.status.SUCCESSFUL?(c.success(p("Autodiscovery completed.")),m.autoDiscoveryInProgress=!1):e.status===a.status.FAILED&&(e.failureReason?c.danger(v.getString('Autodiscovery failed due to: "{{ failureReason | translate }}".',e)):c.danger(p("Autodiscovery failed.")),m.autoDiscoveryInProgress=!1)},_.noop,function(){c.success(p("Autodiscovery in progress."))}).then(N)}function h(){return"modbus"===m.tab}function O(){return"canbus"===m.tab}function L(){return"opcua"===m.tab}function M(){return"profibus"===m.tab}function U(){return"canopen"===m.tab}function w(){return"snmp"===m.tab}_.assign(m,{$onInit:function(){s.detail(b).then(n.getResData).then(function(e){h()?_.defaults(e.c8y_SerialConfiguration,{baudRate:19200,dataBits:8,parity:"E",stopBits:1}):O()&&(m.serialConfigurationOptions.baudRates=[1e5,125e3,25e4,5e5,1e6]),m.device=e}).then(S).then(N).then(P)},shouldShowSerialPanel:function(){return h()&&_.get(m,"device.c8y_SerialConfiguration")},isModbusTab:h,isCanBusTab:O,isOPCUATab:L,isProfibusTab:M,isCanOpenTab:U,isSNMPTab:w,getFieldValidationHints:_.curryRight(n.validationHints)(g),serialConfigurationOptions:{baudRates:[110,300,600,1200,2400,4800,9600,14400,19200,38400,57600,115200,25e4,460800,5e5,921600,1e6],dataBits:[8],parities:["N","E","O"],stopBits:[1,2]},fieldbusConfigurationOptions:{baudRates:[{value:1e3,label:"1 Mbit/s"},{value:800,label:"800 kbit/s"},{value:500,label:"500 kbit/s"},{value:250,label:"250 kbit/s"},{value:125,label:"125 kbit/s"},{value:50,label:"50 kbit/s"},{value:20,label:"20 kbit/s"},{value:10,label:"10 kbit/s"}]},deviceConfigurationOptions:A,fieldErrors:I,fieldErrorsToMessages:g,saveSerialConfig:function(){!function(e){return a.create({deviceId:e.id,description:p("Set serial configuration"),c8y_SerialConfiguration:e.c8y_SerialConfiguration})}(m.device).then(function(){return c.success(p("Settings will be applied."))})},saveFieldbusConfig:function(){!function(e){var t=r.resolve();h()&&e.c8y_ModbusConfiguration?t=function(e){return a.create({deviceId:e.id,description:p("Set modbus configuration"),c8y_ModbusConfiguration:_.omit(e.c8y_ModbusConfiguration,["maxFieldbusVersion"])})}(e):O()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Bus configuration"),c8y_CanConfiguration:_.omit(e.c8y_CanConfiguration,["maxFieldbusVersion"])})}(e):L()?t=function(e){var t=e.c8y_OPCUAGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_OPCUAGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_OPCUAGateway"]))}(e):M()?t=function(e){return a.create({deviceId:e.id,description:p("Set Profibus configuration"),c8y_ProfibusConfiguration:_.pick(e.c8y_ProfibusConfiguration,["transmitRate","slaveAddress"])})}(e):U()?t=function(e){return a.create({deviceId:e.id,description:p("Set CAN Open configuration"),c8y_CANopenConfiguration:_.omit(e.c8y_CANopenConfiguration,["maxFieldbusVersion"])})}(e):w()&&(t=function(e){var t=e.c8y_SNMPGateway.transmitRate,e=_.merge(_.cloneDeep(e),{c8y_SNMPGateway:{transmitRate:0===t?void 0:t}});return s.update(_.pick(e,["id","c8y_SNMPGateway"])).then(C)}(e));return t}(m.device).then(function(){return c.success(p("Settings will be applied."))})},invalid:function(e,t){(h()||L())&&!function(e){var e=m[e],t=e.pollingRate;{var i,n,r;t&&(e=e.transmitRate,n=i=!0,r=t.$modelValue<=e.$modelValue,L()&&0===e.$modelValue&&(r=!0),(!_.isInteger(e.$modelValue)||e.$modelValue<=0)&&(i=!1),(!_.isInteger(t.$modelValue)||t.$modelValue<=0)&&(n=!1),e.$setValidity(I.ONLY_NATURAL_NUMBERS_ALLOWED,i),e.$setValidity(I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r),t.$setValidity(I.ONLY_NATURAL_NUMBERS_ALLOWED,n),t.$setValidity(I.POLLING_RATE_LARGER_THAN_TRANSMIT_RATE,r))}}(e);L()&&!function(e){var e=m[e].OPCUAUrl,t=f.validation.opcuaBrowsePath.pattern,i=e.$modelValue;e.$setValidity(I.INVALID_URL,!i||t.test(i))}(e);w()&&!function(e){var e=m[e].ipRange,t=e.$modelValue;t&&(t=t.split(",").map(function(e){return e.trim()}),t=_.every(t,E),e.$setValidity(I.IP_RANGE,t),t)&&!function(e){var t=e.$modelValue,i=!0,n=!0,r=BigInt(30);{var o;t&&(o=BigInt(0),t=t.split(","),_.forEach(t,function(e){e=E(e);e||(i=!1),o+=BigInt(e.countIps())}),r<o||o<-r)&&(n=!1)}e.$setValidity(I.IP_RANGE,i),e.$setValidity(I.IP_RANGE_MAXLIMIT,n)}(e)}(e);return n.invalid(m,e,t)},reloadDevices:N,onClickDelete:function(e){u({title:p("Delete device"),body:v.getString('You are about to delete device "{{name}}". Do you want to proceed?',e),size:"sm",labels:{ok:p("Delete")},status:"danger"}).then(function(){return s.remove(e)}).then(function(){return U()?y.onRemove(m.device,e):r.resolve()}).then(function(){m.devices=_.without(m.devices,e),s.update({id:m.device.id}),c.success(p("Device deleted."))}).catch(function(e){e&&c.danger(e)})},navigateToDetail:function(e){i.url("device/".concat(e.id))},triggerAutodiscovery:function(e){m.autoDiscoveryInProgress=!0;e=e.ipRange.$modelValue;e&&(e={deviceId:b,description:p("Autodiscovery request"),c8y_SnmpAutoDiscovery:{ipRange:e}},a.createWithNotifications(e).then(T))},autoDiscoveryInProgress:!1,canTriggerAutodiscovery:function(e){return m.autoDiscoveryInProgress||e.ipRange.$dirty||_.isEmpty(e.ipRange.$modelValue)}})}e.$inject=["$rootScope","$q","$routeParams","$location","$window","c8yDeviceControl","c8yBase","c8yDevices","c8yModal","c8yAlert","c8yDeviceDatabase","c8yRealtime","c8yCanopenDevice","c8yConfig","gettext","gettextCatalog"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusConfig",{templateUrl:":::PLUGIN_PATH:::/fieldbus-config.html",bindings:{tab:"@"},controllerAs:"vm",controller:e})}();
@@ -1 +1 @@
1
- "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},e=Object.prototype,d=e.hasOwnProperty,c=Object.defineProperty||function(e,t,n){e[t]=n.value},t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",n=t.asyncIterator||"@@asyncIterator",r=t.toStringTag||"@@toStringTag";function i(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(e){i=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof f?t:f,i=Object.create(o.prototype),a=new D(r||[]);return c(i,"_invoke",{value:function(i,a,c){var u="suspendedStart";return function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return S()}for(c.method=e,c.arg=t;;){var n=c.delegate;if(n){var r=w(n,c);if(r){if(r===s)continue;return r}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=l(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}}(e,n,a)}),i}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}a.wrap=u;var s={};function f(){}function v(){}function p(){}var h={};i(h,o,function(){return this});var y=Object.getPrototypeOf,m=y&&y(y(N([])));m&&m!==e&&d.call(m,o)&&(h=m);var g=p.prototype=f.prototype=Object.create(h);function _(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function b(u,s){var t;c(this,"_invoke",{value:function(n,r){function e(){return new s(function(e,t){!function t(e,n,r,o){var i=l(u[e],u,n);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&d.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,r,o)},function(e){t("throw",e,r,o)}):s.resolve(c).then(function(e){a.value=e,r(a)},function(e){return t("throw",e,r,o)})}o(i.arg)}(n,r,e,t)})}return t=t?t.then(e,e):e()}})}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),s;var o=l(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,s;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function N(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(d.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:S}}function S(){return{value:void 0,done:!0}}return c(g,"constructor",{value:v.prototype=p,configurable:!0}),c(p,"constructor",{value:v,configurable:!0}),v.displayName=i(p,r,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,i(e,r,"GeneratorFunction")),e.prototype=Object.create(g),e},a.awrap=function(e){return{__await:e}},_(b.prototype),i(b.prototype,n,function(){return this}),a.AsyncIterator=b,a.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var i=new b(u(e,t,n,r),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},_(g),i(g,r,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(e){var n=Object(e),r=[];for(var t in n)r.push(t);return r.reverse(),function e(){for(;r.length;){var t=r.pop();if(t in n)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=N,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&d.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function e(e,t){return i.type="throw",i.arg=n,r.next=e,t&&(r.method="next",r.arg=void 0),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=d.call(o,"catchLoc"),c=d.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&d.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,s):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},a}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,n){var r=c.apply(e,a);function o(e){asyncGeneratorStep(r,t,n,o,i,"next",e)}function i(e){asyncGeneratorStep(r,t,n,o,i,"throw",e)}o(void 0)})}}!function(){function e(o,r,t,i,a,c,u,s,d,l,n){var e,h=this,f=d.snmpVersions,v=d.snmpAuthPrivProtocols,p=d.snmpAuthProtocols,y=d.snmpSecurityLevels;function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var n,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.mode,r=h.device,t.adding=!0,t.protocol=n,e.prev=3,T())return e.next=7,d.update(r,t);e.next=7;break;case 7:g(),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),b(t);case 13:o.$apply();case 14:case"end":return e.stop()}},e,null,[[3,10]])}))).apply(this,arguments)}function g(){h.expandedId="",h.reloadDevices(),t.success(n("Child device changes saved."))}function b(e){e.adding=!1,t.danger(n("Failed to change child device."))}function w(){return(w=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t,n,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.mode,n=h.device,(r=h.newDevice).adding=!0,r.protocol=t,e.prev=3,N())return e.next=7,i.create(n,r);e.next=9;break;case 7:e.next=32;break;case 9:if(S())return e.next=12,a.create(n,r);e.next=14;break;case 12:e.next=32;break;case 14:if(I())return e.next=17,c.create(n,r);e.next=19;break;case 17:e.next=32;break;case 19:if(O())return e.next=22,u.create(n,r);e.next=24;break;case 22:e.next=32;break;case 24:if(L())return e.next=27,s.create(n,r);e.next=29;break;case 27:e.next=32;break;case 29:if(T())return e.next=32,d.create(n,r);e.next=32;break;case 32:E(),e.next=38;break;case 35:e.prev=35,e.t0=e.catch(3),x();case 38:o.$apply();case 39:case"end":return e.stop()}},e,null,[[3,35]])}))).apply(this,arguments)}function E(){D(),h.reloadDevices(),t.success(n("New child device added."))}function x(){h.newDevice.adding=!1,t.danger(n("Failed to add new child device."))}function D(){h.expandedId="",_.unset(h,"newDevice"),h[e].$setPristine(),document.getElementsByName("vm.".concat(e))[0].reset()}function N(){return"modbus"===h.tab}function S(){return"canbus"===h.tab}function I(){return"opcua"===h.tab}function O(){return"profibus"===h.tab}function L(){return"canopen"===h.tab}function T(){return"snmp"===h.tab}_.assign(h,{$onInit:function(){e="new".concat(h.mode,"DeviceForm"),h.expandedId=""},shouldShowSection:function(){var e=h.device,t=h.mode,n=!1;N()?"TCP"===t?n=l.supportsOperation(e,"c8y_ModbusDevice"):"RTU"===t&&(n=l.supportsOperation(e,"c8y_ModbusDevice")&&e.c8y_SerialConfiguration):S()&&"CAN"===t?n=l.supportsOperation(e,"c8y_CanDevice"):O()&&"Profibus"===t?n=l.supportsOperation(e,"c8y_ProfibusDevice"):L()&&"CANopen"===t&&(n=l.supportsOperation(e,"c8y_CANopenAddDevice"));return n},isModbusTab:N,isCanBusTab:S,isOPCUATab:I,isProfibusTab:O,isCanOpenTab:L,isSNMPTab:T,invalid:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"new".concat(h.mode,"DeviceForm");return function(e){var t=h.mode,n=h.fieldErrors;if("TCP"===t||"RTU"===t){var r=h[e],o=r.address;if(o){var i=o.$modelValue;if("TCP"===t){var a=r.ipAddress,c=a.$modelValue;_.isUndefined(i)||o.$setValidity(n.ADDRESS_INVALID,function(e){return e<=247||255===e}(i));var u=i&&c&&_.some(h.devices,{address:i,ipAddress:c,protocol:"TCP"});o.$setValidity(n.ADDRESSES_IN_USE,!u),a.$setValidity(n.ADDRESSES_IN_USE,!u)}else if("RTU"===t){var s=i&&_.some(h.devices,{address:i,protocol:"RTU"});o.$setValidity(n.ADDRESS_IN_USE,!s)}}}else if("CANopen"===t){var d=h[e],l=d.nodeId;if(l){var f=l.$modelValue;if(f){var v=function(e){return 1<=e&&e<=127}(f),p=function(t){return h.devices.find(function(e){return!(!e||!e.nodeId)&&e.nodeId===t})}(f);v?p?(l.$setValidity(n.NODE_OUT_OF_RANGE,!0),l.$setValidity(n.NODE_IN_USE,!1)):(l.$setValidity(n.NODE_OUT_OF_RANGE,!0),l.$setValidity(n.NODE_IN_USE,!0)):(l.$setValidity(n.NODE_OUT_OF_RANGE,!1),l.$setValidity(n.NODE_IN_USE,!0))}}}else"SNMP"===t&&function(e){var t,n=h[e];e&&(t=function(e){return _.toNumber(e.replace("form",""))}(e)),function(e,t){var n=h.fieldErrors;if(e.snmpVersionEngineId){var r=e.snmpVersionEngineId,o=r.$modelValue;o&&r.$setValidity(n.ENGINEID_IN_USE,!function(t,n){return n?_.some(h.devices,function(e){return(_.toNumber(e.id)!==n||t!==e.auth.engineId)&&e.engineId===t}):_.some(h.devices,function(e){return e.auth.engineId===t})}(o,t))}}(n,t),function(e,t){var n=h.fieldErrors,r=e.ipAddress,o=r.$modelValue;r.$setValidity(n.ADDRESS_IN_USE,!function(t,n){return n?_.some(h.devices,function(e){return(_.toNumber(e.id)!==n||t!==e.ipAddress)&&e.ipAddress===t}):_.some(h.devices,{ipAddress:t})}(o,t))}(n,t),function(e){var t=h.fieldErrors,n=e.port,r=n.$modelValue;n.$setValidity(t.PORT_INVALID,!_.isNaN(_.toNumber(r)))}(n)}(e)}(t),r.invalid(h,t,e)},getFieldValidationHints:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"new".concat(h.mode,"DeviceForm"),n=_.get(h,"".concat(t,".").concat(e));if(n)return r.validationHints(n,h.fieldErrorsToMessages);return""},isFormInvalid:function(){return _.get(h,"".concat(e,".$invalid"))||_.get(h,"newDevice.adding")},startAddingNewDevice:function(){h.newDevice={name:null,deviceType:null,address:null},T()&&(h.newDevice=_.extend(h.newDevice,{version:null,port:null,auth:{}}),h.toggle("newDevice"))},addNewDevice:function(){return w.apply(this,arguments)},clearNewDevice:D,filterByMode:function(){if(N())return function(e){var t=_.get(e,"protocol");return t===h.mode};if(L())return function(e){return e.nodeId};return function(){return!0}},snmpVersions:f,snmpAuthPrivProtocols:v,snmpAuthProtocols:p,snmpSecurityLevels:y,updateDevice:function(e){return m.apply(this,arguments)},startEditDevice:function(e){var t=_.cloneDeep(e);if(t.adding=!1,!_.isUndefined(t.deviceType)){var n=h.deviceConfigurationOptions;t.deviceType=_.find(n.types,function(e){return e.name===t.deviceType})}return t},isEditFormInvalid:function(e,t){return _.get(h,"".concat(e,".$invalid"))||_.get(t,"adding")},toggle:function(e){h.expandedId===e?h.expandedId="":h.expandedId=e},clearEditDevice:function(){h.expandedId=""},getSnmpVersionLabel:function(e){var t=_.find(f,{value:e});return _.get(t,"label")},getFormName:function(e){if(e){var t=e.id;return"vm.form".concat(_.toString(t))}return"vm.form"},getDeviceFormName:function(e){return"form".concat(e.id)},expandedId:void 0})}e.$inject=["$rootScope","c8yBase","c8yAlert","c8yModbusDevice","c8yCanbusDevice","c8yOPCUADevice","c8yProfibusDevice","c8yCanopenDevice","c8ySNMPDevice","c8yDevices","gettext"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusDeviceList",{templateUrl:":::PLUGIN_PATH:::/fieldbus-device-list.html",bindings:{tab:"@",mode:"@",fieldErrors:"<",fieldErrorsToMessages:"<",deviceConfigurationOptions:"<",device:"<",devices:"<",reloadDevices:"<",onClickDelete:"<",navigateToDetail:"<"},controllerAs:"vm",controller:e})}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},e=Object.prototype,u=e.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",n=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function i(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(e){i=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o,i,a,c,t=t&&t.prototype instanceof f?t:f,t=Object.create(t.prototype),r=new w(r||[]);return s(t,"_invoke",{value:(o=e,i=n,a=r,c="suspendedStart",function(e,t){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===e)throw t;return x()}for(a.method=e,a.arg=t;;){var n=a.delegate;if(n){n=function e(t,n){var r=n.method,o=t.iterator[r];if(void 0===o)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;r=d(o,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,l;o=r.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,l):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,l)}(n,a);if(n){if(n===l)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===c)throw c="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c="executing";n=d(o,i,a);if("normal"===n.type){if(c=a.done?"completed":"suspendedYield",n.arg===l)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(c="completed",a.method="throw",a.arg=n.arg)}})}),t}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}a.wrap=c;var l={};function f(){}function p(){}function v(){}var t={},h=(i(t,r,function(){return this}),Object.getPrototypeOf),h=h&&h(h(E([]))),y=(h&&h!==e&&u.call(h,r)&&(t=h),v.prototype=f.prototype=Object.create(t));function m(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function g(a,c){var t;s(this,"_invoke",{value:function(n,r){function e(){return new c(function(e,t){!function t(e,n,r,o){var i,e=d(a[e],a,n);if("throw"!==e.type)return(n=(i=e.arg).value)&&"object"==_typeof(n)&&u.call(n,"__await")?c.resolve(n.__await).then(function(e){t("next",e,r,o)},function(e){t("throw",e,r,o)}):c.resolve(n).then(function(e){i.value=e,r(i)},function(e){return t("throw",e,r,o)});o(e.arg)}(n,r,e,t)})}return t=t?t.then(e,e):e()}})}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function E(t){if(t){var n,e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return n=-1,(e=function e(){for(;++n<t.length;)if(u.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e}).next=e}return{next:x}}function x(){return{value:void 0,done:!0}}return s(y,"constructor",{value:p.prototype=v,configurable:!0}),s(v,"constructor",{value:p,configurable:!0}),p.displayName=i(v,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,i(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},a.awrap=function(e){return{__await:e}},m(g.prototype),i(g.prototype,n,function(){return this}),a.AsyncIterator=g,a.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var i=new g(c(e,t,n,r),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},m(y),i(y,o,"Generator"),i(y,r,function(){return this}),i(y,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,n=Object(e),r=[];for(t in n)r.push(t);return r.reverse(),function e(){for(;r.length;){var t=r.pop();if(t in n)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=E,w.prototype={constructor:w,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&u.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function e(e,t){return i.type="throw",i.arg=n,r.next=e,t&&(r.method="next",r.arg=void 0),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),c=u.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&u.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,o=this.tryEntries[t];if(o.tryLoc===e)return"throw"===(n=o.completion).type&&(r=n.arg,b(o)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},a}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,n){var r=c.apply(e,a);function o(e){asyncGeneratorStep(r,t,n,o,i,"next",e)}function i(e){asyncGeneratorStep(r,t,n,o,i,"throw",e)}o(void 0)})}}!function(){function e(o,n,i,a,c,u,s,d,l,r,f){var e,p=this,t=l.snmpVersions,v=l.snmpAuthPrivProtocols,h=l.snmpAuthProtocols,y=l.snmpSecurityLevels;function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var n,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=p.mode,r=p.device,t.adding=!0,t.protocol=n,e.prev=3,S())return e.next=7,l.update(r,t);e.next=7;break;case 7:p.expandedId="",p.reloadDevices(),i.success(f("Child device changes saved.")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),t.adding=!1,i.danger(f("Failed to change child device."));case 13:o.$apply();case 14:case"end":return e.stop()}},e,null,[[3,10]])}))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t,n,r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.mode,n=p.device,(r=p.newDevice).adding=!0,r.protocol=t,e.prev=3,w())return e.next=7,a.create(n,r);e.next=9;break;case 7:e.next=32;break;case 9:if(E())return e.next=12,c.create(n,r);e.next=14;break;case 12:e.next=32;break;case 14:if(x())return e.next=17,u.create(n,r);e.next=19;break;case 17:e.next=32;break;case 19:if(D())return e.next=22,s.create(n,r);e.next=24;break;case 22:e.next=32;break;case 24:if(N())return e.next=27,d.create(n,r);e.next=29;break;case 27:e.next=32;break;case 29:if(S())return e.next=32,l.create(n,r);e.next=32;break;case 32:b(),p.reloadDevices(),i.success(f("New child device added.")),e.next=38;break;case 35:e.prev=35,e.t0=e.catch(3),p.newDevice.adding=!1,i.danger(f("Failed to add new child device."));case 38:o.$apply();case 39:case"end":return e.stop()}},e,null,[[3,35]])}))).apply(this,arguments)}function b(){p.expandedId="",_.unset(p,"newDevice"),p[e].$setPristine(),document.getElementsByName("vm.".concat(e))[0].reset()}function w(){return"modbus"===p.tab}function E(){return"canbus"===p.tab}function x(){return"opcua"===p.tab}function D(){return"profibus"===p.tab}function N(){return"canopen"===p.tab}function S(){return"snmp"===p.tab}_.assign(p,{$onInit:function(){e="new".concat(p.mode,"DeviceForm"),p.expandedId=""},shouldShowSection:function(){var e=p.device,t=p.mode,n=!1;w()?"TCP"===t?n=r.supportsOperation(e,"c8y_ModbusDevice"):"RTU"===t&&(n=r.supportsOperation(e,"c8y_ModbusDevice")&&e.c8y_SerialConfiguration):E()&&"CAN"===t?n=r.supportsOperation(e,"c8y_CanDevice"):D()&&"Profibus"===t?n=r.supportsOperation(e,"c8y_ProfibusDevice"):N()&&"CANopen"===t&&(n=r.supportsOperation(e,"c8y_CANopenAddDevice"));return n},isModbusTab:w,isCanBusTab:E,isOPCUATab:x,isProfibusTab:D,isCanOpenTab:N,isSNMPTab:S,invalid:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"new".concat(p.mode,"DeviceForm");return function(e){var t=p.mode,n=p.fieldErrors;{var r,o,i,a;"TCP"===t||"RTU"===t?(a=p[e],(i=a.address)&&(o=i.$modelValue,"TCP"===t?(a=a.ipAddress,r=a.$modelValue,_.isUndefined(o)||i.$setValidity(n.ADDRESS_INVALID,function(e){return e<=247||255===e}(o)),r=o&&r&&_.some(p.devices,{address:o,ipAddress:r,protocol:"TCP"}),i.$setValidity(n.ADDRESSES_IN_USE,!r),a.$setValidity(n.ADDRESSES_IN_USE,!r)):"RTU"===t&&(a=o&&_.some(p.devices,{address:o,protocol:"RTU"}),i.$setValidity(n.ADDRESS_IN_USE,!a)))):"CANopen"===t?(r=p[e].nodeId)&&(o=r.$modelValue)&&(i=function(e){return 1<=e&&e<=127}(o),a=function(t){return p.devices.find(function(e){return!(!e||!e.nodeId)&&e.nodeId===t})}(o),i?a?(r.$setValidity(n.NODE_OUT_OF_RANGE,!0),r.$setValidity(n.NODE_IN_USE,!1)):(r.$setValidity(n.NODE_OUT_OF_RANGE,!0),r.$setValidity(n.NODE_IN_USE,!0)):(r.$setValidity(n.NODE_OUT_OF_RANGE,!1),r.$setValidity(n.NODE_IN_USE,!0))):"SNMP"===t&&function(e){var t,n=p[e];e&&(t=function(e){return _.toNumber(e.replace("form",""))}(e));(function(e,t){var n=p.fieldErrors;{var r;e.snmpVersionEngineId&&(e=e.snmpVersionEngineId,r=e.$modelValue)&&e.$setValidity(n.ENGINEID_IN_USE,!function(t,n){if(n)return _.some(p.devices,function(e){return(_.toNumber(e.id)!==n||t!==e.auth.engineId)&&e.engineId===t});return _.some(p.devices,function(e){return e.auth.engineId===t})}(r,t))}})(n,t),function(e,t){var n=p.fieldErrors,e=e.ipAddress,r=e.$modelValue;e.$setValidity(n.ADDRESS_IN_USE,!function(t,n){if(n)return _.some(p.devices,function(e){return(_.toNumber(e.id)!==n||t!==e.ipAddress)&&e.ipAddress===t});return _.some(p.devices,{ipAddress:t})}(r,t))}(n,t),function(e){var t=p.fieldErrors,e=e.port,n=e.$modelValue;e.$setValidity(t.PORT_INVALID,!_.isNaN(_.toNumber(n)))}(n)}(e)}}(t),n.invalid(p,t,e)},getFieldValidationHints:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"new".concat(p.mode,"DeviceForm"),t=_.get(p,"".concat(t,".").concat(e));if(t)return n.validationHints(t,p.fieldErrorsToMessages);return""},isFormInvalid:function(){return _.get(p,"".concat(e,".$invalid"))||_.get(p,"newDevice.adding")},startAddingNewDevice:function(){p.newDevice={name:null,deviceType:null,address:null},S()&&(p.newDevice=_.extend(p.newDevice,{version:null,port:null,auth:{}}),p.toggle("newDevice"))},addNewDevice:function(){return g.apply(this,arguments)},clearNewDevice:b,filterByMode:function(){if(w())return function(e){return _.get(e,"protocol")===p.mode};if(N())return function(e){return e.nodeId};return function(){return!0}},snmpVersions:t,snmpAuthPrivProtocols:v,snmpAuthProtocols:h,snmpSecurityLevels:y,updateDevice:function(e){return m.apply(this,arguments)},startEditDevice:function(e){var t=_.cloneDeep(e);t.adding=!1,_.isUndefined(t.deviceType)||(e=p.deviceConfigurationOptions,t.deviceType=_.find(e.types,function(e){return e.name===t.deviceType}));return t},isEditFormInvalid:function(e,t){return _.get(p,"".concat(e,".$invalid"))||_.get(t,"adding")},toggle:function(e){p.expandedId===e?p.expandedId="":p.expandedId=e},clearEditDevice:function(){p.expandedId=""},getSnmpVersionLabel:function(e){e=_.find(t,{value:e});return _.get(e,"label")},getFormName:function(e){if(e)return e=e.id,"vm.form".concat(_.toString(e));return"vm.form"},getDeviceFormName:function(e){return"form".concat(e.id)},expandedId:void 0})}e.$inject=["$rootScope","c8yBase","c8yAlert","c8yModbusDevice","c8yCanbusDevice","c8yOPCUADevice","c8yProfibusDevice","c8yCanopenDevice","c8ySNMPDevice","c8yDevices","gettext"],angular.module("c8y.modbusConfiguration4").component("c8yFieldbusDeviceList",{templateUrl:":::PLUGIN_PATH:::/fieldbus-device-list.html",bindings:{tab:"@",mode:"@",fieldErrors:"<",fieldErrorsToMessages:"<",deviceConfigurationOptions:"<",device:"<",devices:"<",reloadDevices:"<",onClickDelete:"<",navigateToDetail:"<"},controllerAs:"vm",controller:e})}();
@@ -1 +1 @@
1
- "use strict";!function(){function e(c,i,e,s){e.getFeaturesManifestsAsync().then(function(e){_.forEach(e,function(e){var n=e.fieldbusType,a=e.label,t=e.deviceConfiguration;t&&s.when("/device/:deviceId",{name:t.label||a,icon:t.icon||"microchip",template:'<c8y-fieldbus-config tab="'.concat(n,'"></c8y-fieldbus-config>'),showIf:function(t){return["$routeParams","c8yDeviceDatabase","c8yDevices",function(e,n,a){return c.all({hasFeatures:n.areAnyFeaturesManifestsRegistered(),hasFragment:a.detailCached(e.deviceId).then(i.getResData).then(function(e){return _.has(e,t)})}).then(function(e){var n=e.hasFeatures,a=e.hasFragment;return n&&a})}]}(t.fragment)})})})}e.$inject=["$q","c8yBase","c8yDeviceDatabase","c8yViews"],angular.module("c8y.modbusConfiguration4").run(e)}();
1
+ "use strict";!function(){function e(c,i,e,s){e.getFeaturesManifestsAsync().then(function(e){_.forEach(e,function(e){var t,a=e.fieldbusType,n=e.label,e=e.deviceConfiguration;e&&s.when("/device/:deviceId",{name:e.label||n,icon:e.icon||"microchip",template:'<c8y-fieldbus-config tab="'.concat(a,'"></c8y-fieldbus-config>'),showIf:(t=e.fragment,["$routeParams","c8yDeviceDatabase","c8yDevices",function(e,a,n){return c.all({hasFeatures:a.areAnyFeaturesManifestsRegistered(),hasFragment:n.detailCached(e.deviceId).then(i.getResData).then(function(e){return _.has(e,t)})}).then(function(e){var a=e.hasFeatures,e=e.hasFragment;return a&&e})}])})})})}e.$inject=["$q","c8yBase","c8yDeviceDatabase","c8yViews"],angular.module("c8y.modbusConfiguration4").run(e)}();
@@ -1 +1 @@
1
- "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},e=Object.prototype,l=e.hasOwnProperty,c=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",n=t.toStringTag||"@@toStringTag";function i(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(e){i=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new S(n||[]);return c(i,"_invoke",{value:function(i,a,c){var u="suspendedStart";return function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return L()}for(c.method=e,c.arg=t;;){var r=c.delegate;if(r){var n=w(r,c);if(n){if(n===s)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=f(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===s)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}}(e,r,a)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=u;var s={};function p(){}function y(){}function d(){}var g={};i(g,o,function(){return this});var m=Object.getPrototypeOf,h=m&&m(m(x([])));h&&h!==e&&l.call(h,o)&&(g=h);var v=d.prototype=p.prototype=Object.create(g);function b(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function _(u,s){var t;c(this,"_invoke",{value:function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i=f(u[e],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?s.resolve(c.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(c).then(function(e){a.value=e,n(a)},function(e){return t("throw",e,n,o)})}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function w(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),s;var o=f(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,s;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function x(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(l.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:L}}function L(){return{value:void 0,done:!0}}return c(v,"constructor",{value:y.prototype=d,configurable:!0}),c(d,"constructor",{value:y,configurable:!0}),y.displayName=i(d,n,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,n,"GeneratorFunction")),e.prototype=Object.create(v),e},a.awrap=function(e){return{__await:e}},b(_.prototype),i(_.prototype,r,function(){return this}),a.AsyncIterator=_,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new _(u(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},b(v),i(v,n,"Generator"),i(v,o,function(){return this}),i(v,"toString",function(){return"[object Generator]"}),a.keys=function(e){var r=Object(e),n=[];for(var t in r)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=x,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&l.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return i.type="throw",i.arg=r,n.next=e,t&&(n.method="next",n.arg=void 0),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=l.call(o,"catchLoc"),c=l.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,s):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},a}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,t,r,o,i,"next",e)}function i(e){asyncGeneratorStep(n,t,r,o,i,"throw",e)}o(void 0)})}}!function(){function e(p,e,t,y,d,c){var o=e.MODBUS_DEVICE_FRAGMENT,i=e.PROFIBUS_DEVICE_FRAGMENT;return{getConfigModel:function(e){return r.apply(this,arguments)},updateConfigModel:function(e,t){_.set(e,"categoriesConfig",_.map(t,function(e){return{name:e.name,label:e.label,elements:_.compact(_.map(e.elements,function(e){return e.show?_.pick(e,["refId","label","type"]):void 0}))}})),_.unset(e,"coils"),_.unset(e,"registers")},getWidgetModel:function(e){return m.apply(this,arguments)},isAtLeastOneElementSelected:function(e){return _.some(e,function(e){return _.some(e.elements,"show")})},isDiscreteIOSelectedInConfig:window.c8y_testing&&g,isRegisterSelectedInConfig:window.c8y_testing&&f};function r(){return(r=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=_.get(t,"device"))return e.next=4,E(r);e.next=6;break;case 4:return n=e.sent,e.abrupt("return",a({fieldbusDevice:n,widgetConfig:t}));case 6:return e.abrupt("return",p.resolve([]));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function a(e){return n.apply(this,arguments)}function n(){return(n=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.fieldbusDevice,n=t.widgetConfig,e.next=3,T(r);case 3:if(o=e.sent,i=b({fieldbusDevice:r,deviceType:o}),_.isEmpty(i))return e.abrupt("return",[]);e.next=7;break;case 7:return a=_.groupBy(i,S),e.abrupt("return",_(n).chain().get("categoriesConfig",[]).map(function(e){var t=_.get(a,e.name);_.defaults(e,{label:e.name||c("Uncategorized")});var r=_.flow([u,s])({categoryConfigElements:e.elements,deviceType:o,elements:i,categoryElements:t,widgetConfig:n}).categoryConfigElements;return e.elements=r,e}).thru(function(e){return x({categoriesConfig:e,categories:a,deviceType:o,widgetConfig:n})}).value());case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function u(e){var t=e.categoryConfigElements,o=e.deviceType,i=e.elements,r=e.categoryElements,n=e.widgetConfig;return{categoryConfigElements:_.map(t,function(e){var t=e.refId,r=e.type,n=d.findElementBestMatchingRefId(i,t,r);if(n)return _.defaults(e,{name:n.name,type:n.meta.type.value,typeLabel:d.getElementTypeLabel(n,o),show:!0,label:n.name})}),deviceType:o,elements:i,categoryElements:r,widgetConfig:n}}function s(e){var t=e.categoryConfigElements,r=e.deviceType,n=e.elements,o=e.categoryElements,i=e.widgetConfig;return{categoryConfigElements:[].concat(_toConsumableArray(t),_toConsumableArray(_(o).filter(function(e){return!_.find(t,{refId:d.getElementRefId(e)})}).map(function(e){return{refId:d.getElementRefId(e),label:e.name,show:l(e,i),name:e.name,type:e.meta.type.value,typeLabel:d.getElementTypeLabel(e,r)}}).value())),deviceType:r,elements:n,categoryElements:o,widgetConfig:i}}function l(e,t){return function(e){return e.meta.type===d.ElementType.REGISTER}(e)?f(e,t):g(e,t)}function f(e,t){var r=e.id,n=e.input,o=e.number,i=e.startBit,a=t.registers;return _.includes(a,r)||_.includes(a,[n,o,i].join(","))||_.includes(a,o)||!!_.find(a,{number:o,startBit:i})}function g(e,t){var r=e.id,n=e.input,o=e.number,i=t.coils;return _.includes(i,r)||_.includes(i,[n,o].join(","))||_.includes(i,o)}function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a,c,u,s,l,f;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=_.get(t,"device.id"),n=y.detailRealtime(r),o=n.then(T),i=h(r,t).then(function(e){return _.get(t,"categoriesConfig",e)}),e.next=6,p.all({fieldbusDevice:n,deviceType:o,categoriesConfig:i});case 6:return a=e.sent,c=a.fieldbusDevice,u=a.deviceType,s=a.categoriesConfig,l=b({fieldbusDevice:c,deviceType:u}),f=_.map(s,function(e){return _.defaults(_objectSpread(_objectSpread({},e),{},{elements:_(e.elements).map(function(e){var t=d.findElementBestMatchingRefId(l,e.refId,e.type);return t?_.defaults(_objectSpread(_objectSpread({},e),t),{label:t.name,show:!0}):e}).filter("show").value()}),{label:e.name})}),e.abrupt("return",{device:c,categories:f});case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function h(e,t){return v.apply(this,arguments)}function v(){return(v=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E(t);case 2:return n=e.sent,e.next=5,T(n);case 5:return o=e.sent,i=b({fieldbusDevice:n,deviceType:o}),a=_.groupBy(i,S),e.abrupt("return",x({categoriesConfig:[],categories:a,deviceType:o,widgetConfig:r}));case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function b(e){var t=e.fieldbusDevice,r=e.deviceType,n=d.getElementsWithMeta(r);return _.has(t,o)||_.has(t,i)?n:_.filter(n,w)}function w(e){return e.meta.type===d.ElementType.REGISTER&&!e.input}function E(e){return d.isFieldbusDevice(e)?p.resolve(e):y.detail(t.getId(e)).then(t.getResData)}function T(e){return d.getDeviceTypeFromDevice(e)}function S(e){return _.get(e,"category","")}function x(e){var r=e.categoriesConfig,t=e.categories,n=e.deviceType,o=e.widgetConfig;return[].concat(_toConsumableArray(r),_toConsumableArray(_(t).pickBy(function(e,t){return!_.find(r,{name:t})}).map(function(e,t){return{name:t,label:t||c("Uncategorized"),elements:_.map(e,function(e){return{refId:d.getElementRefId(e),label:e.name,show:l(e,o),name:e.name,type:e.meta.type.value,typeLabel:d.getElementTypeLabel(e,n)}})}}).value()))}}e.$inject=["$q","fieldbusConstants","c8yBase","c8yDevices","c8yDeviceDatabase","gettext"],angular.module("c8y.modbusWidget4").factory("modbusWidgetSvc",e)}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},e=Object.prototype,u=e.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function i(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(e){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o,i,a,c,t=t&&t.prototype instanceof p?t:p,t=Object.create(t.prototype),n=new w(n||[]);return s(t,"_invoke",{value:(o=e,i=r,a=n,c="suspendedStart",function(e,t){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===e)throw t;return T()}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r){r=function e(t,r){var n=r.method,o=t.iterator[n];if(void 0===o)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;n=l(o,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}(r,a);if(r){if(r===f)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===c)throw c="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c="executing";r=l(o,i,a);if("normal"===r.type){if(c=a.done?"completed":"suspendedYield",r.arg===f)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c="completed",a.method="throw",a.arg=r.arg)}})}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=c;var f={};function p(){}function y(){}function d(){}var t={},g=(i(t,n,function(){return this}),Object.getPrototypeOf),g=g&&g(g(E([]))),m=(g&&g!==e&&u.call(g,n)&&(t=g),d.prototype=p.prototype=Object.create(t));function h(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function v(a,c){var t;s(this,"_invoke",{value:function(r,n){function e(){return new c(function(e,t){!function t(e,r,n,o){var i,e=l(a[e],a,r);if("throw"!==e.type)return(r=(i=e.arg).value)&&"object"==_typeof(r)&&u.call(r,"__await")?c.resolve(r.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):c.resolve(r).then(function(e){i.value=e,n(i)},function(e){return t("throw",e,n,o)});o(e.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function E(t){if(t){var r,e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return r=-1,(e=function e(){for(;++r<t.length;)if(u.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e}).next=e}return{next:T}}function T(){return{value:void 0,done:!0}}return s(m,"constructor",{value:y.prototype=d,configurable:!0}),s(d,"constructor",{value:y,configurable:!0}),y.displayName=i(d,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e},a.awrap=function(e){return{__await:e}},h(v.prototype),i(v.prototype,r,function(){return this}),a.AsyncIterator=v,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new v(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},h(m),i(m,o,"Generator"),i(m,n,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,r=Object(e),n=[];for(t in r)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=E,w.prototype={constructor:w,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!e)for(var t in this)"t"===t.charAt(0)&&u.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return i.type="throw",i.arg=r,n.next=e,t&&(n.method="next",n.arg=void 0),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),c=u.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),_(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,o=this.tryEntries[t];if(o.tryLoc===e)return"throw"===(r=o.completion).type&&(n=r.arg,_(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},a}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,t,r,o,i,"next",e)}function i(e){asyncGeneratorStep(n,t,r,o,i,"throw",e)}o(void 0)})}}!function(){function e(c,e,t,u,s,l){var r=e.MODBUS_DEVICE_FRAGMENT,n=e.PROFIBUS_DEVICE_FRAGMENT;return{getConfigModel:function(e){return o.apply(this,arguments)},updateConfigModel:function(e,t){_.set(e,"categoriesConfig",_.map(t,function(e){return{name:e.name,label:e.label,elements:_.compact(_.map(e.elements,function(e){return e.show?_.pick(e,["refId","label","type"]):void 0}))}})),_.unset(e,"coils"),_.unset(e,"registers")},getWidgetModel:function(e){return g.apply(this,arguments)},isAtLeastOneElementSelected:function(e){return _.some(e,function(e){return _.some(e.elements,"show")})},isDiscreteIOSelectedInConfig:window.c8y_testing&&d,isRegisterSelectedInConfig:window.c8y_testing&&y};function o(){return(o=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=_.get(t,"device"))return e.next=4,b(r);e.next=6;break;case 4:return r=e.sent,e.abrupt("return",function(){return i.apply(this,arguments)}({fieldbusDevice:r,widgetConfig:t}));case 6:return e.abrupt("return",c.resolve([]));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.fieldbusDevice,n=t.widgetConfig,e.next=3,w(r);case 3:if(o=e.sent,i=h({fieldbusDevice:r,deviceType:o}),_.isEmpty(i))return e.abrupt("return",[]);e.next=7;break;case 7:return a=_.groupBy(i,E),e.abrupt("return",_(n).chain().get("categoriesConfig",[]).map(function(e){var t=_.get(a,e.name);_.defaults(e,{label:e.name||l("Uncategorized")});t=_.flow([f,p])({categoryConfigElements:e.elements,deviceType:o,elements:i,categoryElements:t,widgetConfig:n}).categoryConfigElements;return e.elements=t,e}).thru(function(e){return T({categoriesConfig:e,categories:a,deviceType:o,widgetConfig:n})}).value());case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function f(e){var t=e.categoryConfigElements,n=e.deviceType,o=e.elements,r=e.categoryElements,e=e.widgetConfig;return{categoryConfigElements:_.map(t,function(e){var t=e.refId,r=e.type,t=s.findElementBestMatchingRefId(o,t,r);if(t)return _.defaults(e,{name:t.name,type:t.meta.type.value,typeLabel:s.getElementTypeLabel(t,n),show:!0,label:t.name})}),deviceType:n,elements:o,categoryElements:r,widgetConfig:e}}function p(e){var t=e.categoryConfigElements,r=e.deviceType,n=e.elements,o=e.categoryElements,i=e.widgetConfig;return{categoryConfigElements:[].concat(_toConsumableArray(t),_toConsumableArray(_(o).filter(function(e){return!_.find(t,{refId:s.getElementRefId(e)})}).map(function(e){return{refId:s.getElementRefId(e),label:e.name,show:a(e,i),name:e.name,type:e.meta.type.value,typeLabel:s.getElementTypeLabel(e,r)}}).value())),deviceType:r,elements:n,categoryElements:o,widgetConfig:i}}function a(e,t){return(e.meta.type===s.ElementType.REGISTER?y:d)(e,t)}function y(e,t){var r=e.id,n=e.input,o=e.number,e=e.startBit,t=t.registers;return _.includes(t,r)||_.includes(t,[n,o,e].join(","))||_.includes(t,o)||!!_.find(t,{number:o,startBit:e})}function d(e,t){var r=e.id,n=e.input,e=e.number,t=t.coils;return _.includes(t,r)||_.includes(t,[n,e].join(","))||_.includes(t,e)}function g(){return(g=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=_.get(t,"device.id"),r=u.detailRealtime(o),n=r.then(w),o=function(){return m.apply(this,arguments)}(o,t).then(function(e){return _.get(t,"categoriesConfig",e)}),e.next=6,c.all({fieldbusDevice:r,deviceType:n,categoriesConfig:o});case 6:return r=e.sent,n=r.fieldbusDevice,o=r.deviceType,a=r.categoriesConfig,i=h({fieldbusDevice:n,deviceType:o}),a=_.map(a,function(e){return _.defaults(_objectSpread(_objectSpread({},e),{},{elements:_(e.elements).map(function(e){var t=s.findElementBestMatchingRefId(i,e.refId,e.type);return t?_.defaults(_objectSpread(_objectSpread({},e),t),{label:t.name,show:!0}):e}).filter("show").value()}),{label:e.name})}),e.abrupt("return",{device:n,categories:a});case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n,o,i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b(t);case 2:return n=e.sent,e.next=5,w(n);case 5:return o=e.sent,i=h({fieldbusDevice:n,deviceType:o}),i=_.groupBy(i,E),e.abrupt("return",T({categoriesConfig:[],categories:i,deviceType:o,widgetConfig:r}));case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function h(e){var t=e.fieldbusDevice,e=e.deviceType,e=s.getElementsWithMeta(e);return _.has(t,r)||_.has(t,n)?e:_.filter(e,v)}function v(e){return e.meta.type===s.ElementType.REGISTER&&!e.input}function b(e){return s.isFieldbusDevice(e)?c.resolve(e):u.detail(t.getId(e)).then(t.getResData)}function w(e){return s.getDeviceTypeFromDevice(e)}function E(e){return _.get(e,"category","")}function T(e){var r=e.categoriesConfig,t=e.categories,n=e.deviceType,o=e.widgetConfig;return[].concat(_toConsumableArray(r),_toConsumableArray(_(t).pickBy(function(e,t){return!_.find(r,{name:t})}).map(function(e,t){return{name:t,label:t||l("Uncategorized"),elements:_.map(e,function(e){return{refId:s.getElementRefId(e),label:e.name,show:a(e,o),name:e.name,type:e.meta.type.value,typeLabel:s.getElementTypeLabel(e,n)}})}}).value()))}}e.$inject=["$q","fieldbusConstants","c8yBase","c8yDevices","c8yDeviceDatabase","gettext"],angular.module("c8y.modbusWidget4").factory("modbusWidgetSvc",e)}();
@@ -1 +1 @@
1
- "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,l=t.hasOwnProperty,c=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new E(n||[]);return c(i,"_invoke",{value:function(i,a,c){var u="suspendedStart";return function(t,e){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return O()}for(c.method=t,c.arg=e;;){var r=c.delegate;if(r){var n=L(r,c);if(n){if(n===f)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===u)throw u="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u="executing";var o=s(i,a,c);if("normal"===o.type){if(u=c.done?"completed":"suspendedYield",o.arg===f)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u="completed",c.method="throw",c.arg=o.arg)}}}(t,r,a)}),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var f={};function h(){}function p(){}function y(){}var d={};i(d,o,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(S([])));g&&g!==t&&l.call(g,o)&&(d=g);var m=y.prototype=h.prototype=Object.create(d);function w(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function b(u,f){var e;c(this,"_invoke",{value:function(r,n){function t(){return new f(function(t,e){!function e(t,r,n,o){var i=s(u[t],u,r);if("throw"!==i.type){var a=i.arg,c=a.value;return c&&"object"==_typeof(c)&&l.call(c,"__await")?f.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):f.resolve(c).then(function(t){a.value=t,n(a)},function(t){return e("throw",t,n,o)})}o(i.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function L(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function S(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(l.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:O}}function O(){return{value:void 0,done:!0}}return c(m,"constructor",{value:p.prototype=y,configurable:!0}),c(y,"constructor",{value:p,configurable:!0}),p.displayName=i(y,n,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,i(t,n,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},w(b.prototype),i(b.prototype,r,function(){return this}),a.AsyncIterator=b,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new b(u(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},w(m),i(m,n,"Generator"),i(m,o,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var r=Object(t),n=[];for(var e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=S,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=l.call(o,"catchLoc"),c=l.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}!function(){function t(e,r){var t,n,o=this;function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.getConfigModel(o.config);case 2:o.categoriesConfig=t.sent,e.$apply();case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}_.assign(o,{$doCheck:function(){_.isEqual(t,o.config.device)||(t=o.config.device,function(){i.apply(this,arguments)}());_.isEqual(n,o.categoriesConfig)||(n=_.cloneDeep(o.categoriesConfig),function(){if(n){var t=r.isAtLeastOneElementSelected(n);return o.modbusWidgetConfigForm.modbusWidgetValidation.$setValidity("at-least-one-field-selected",t),o.atLeastOneElementSelected=t}return!1}()&&r.updateConfigModel(o.config,n))}})}t.$inject=["$rootScope","modbusWidgetSvc"],angular.module("c8y.modbusWidget4").component("c8yModbusWidgetConfig",{templateUrl:":::PLUGIN_PATH:::/widget-config.html",bindings:{config:"<"},controllerAs:"vm",controller:t})}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,u=t.hasOwnProperty,f=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof h?e:h,e=Object.create(e.prototype),n=new L(n||[]);return f(e,"_invoke",{value:(o=t,i=r,a=n,c="suspendedStart",function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return _()}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(void 0===o)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=void 0,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),s;n=l(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,s;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,s):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,s)}(r,a);if(r){if(r===s)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===c)throw c="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c="executing";r=l(o,i,a);if("normal"===r.type){if(c=a.done?"completed":"suspendedYield",r.arg===s)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c="completed",a.method="throw",a.arg=r.arg)}})}),e}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var s={};function h(){}function p(){}function y(){}var e={},d=(i(e,n,function(){return this}),Object.getPrototypeOf),d=d&&d(d(x([]))),g=(d&&d!==t&&u.call(d,n)&&(e=d),y.prototype=h.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function m(a,c){var e;f(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=l(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&u.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function x(e){if(e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(u.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:_}}function _(){return{value:void 0,done:!0}}return f(g,"constructor",{value:p.prototype=y,configurable:!0}),f(y,"constructor",{value:p,configurable:!0}),p.displayName=i(y,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,i(t,o,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},v(m.prototype),i(m.prototype,r,function(){return this}),a.AsyncIterator=m,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new m(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},v(g),i(g,o,"Generator"),i(g,n,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=x,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),c=u.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,s):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),s},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),s}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,b(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}!function(){function t(e,r){var t,n,o=this;function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.getConfigModel(o.config);case 2:o.categoriesConfig=t.sent,e.$apply();case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}_.assign(o,{$doCheck:function(){_.isEqual(t,o.config.device)||(t=o.config.device,function(){i.apply(this,arguments)}());!_.isEqual(n,o.categoriesConfig)&&(n=_.cloneDeep(o.categoriesConfig),function(){{var t;if(n)return t=r.isAtLeastOneElementSelected(n),o.modbusWidgetConfigForm.modbusWidgetValidation.$setValidity("at-least-one-field-selected",t),o.atLeastOneElementSelected=t}return}())&&r.updateConfigModel(o.config,n)}})}t.$inject=["$rootScope","modbusWidgetSvc"],angular.module("c8y.modbusWidget4").component("c8yModbusWidgetConfig",{templateUrl:":::PLUGIN_PATH:::/widget-config.html",bindings:{config:"<"},controllerAs:"vm",controller:t})}();
@@ -1 +1 @@
1
- "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,s=t.hasOwnProperty,u=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",r=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new L(r||[]);return u(i,"_invoke",{value:function(i,a,u){var c="suspendedStart";return function(t,e){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return O()}for(u.method=t,u.arg=e;;){var n=u.delegate;if(n){var r=E(n,u);if(r){if(r===l)continue;return r}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===c)throw c="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c="executing";var o=f(i,a,u);if("normal"===o.type){if(c=u.done?"completed":"suspendedYield",o.arg===l)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c="completed",u.method="throw",u.arg=o.arg)}}}(t,n,a)}),i}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var l={};function h(){}function p(){}function d(){}var v={};i(v,o,function(){return this});var y=Object.getPrototypeOf,m=y&&y(y(S([])));m&&m!==t&&s.call(m,o)&&(v=m);var g=d.prototype=h.prototype=Object.create(v);function w(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function b(c,l){var e;u(this,"_invoke",{value:function(n,r){function t(){return new l(function(t,e){!function e(t,n,r,o){var i=f(c[t],c,n);if("throw"!==i.type){var a=i.arg,u=a.value;return u&&"object"==_typeof(u)&&s.call(u,"__await")?l.resolve(u.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):l.resolve(u).then(function(t){a.value=t,r(a)},function(t){return e("throw",t,r,o)})}o(i.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function E(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),l;var o=f(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,l;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function S(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(s.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:O}}function O(){return{value:void 0,done:!0}}return u(g,"constructor",{value:p.prototype=d,configurable:!0}),u(d,"constructor",{value:p,configurable:!0}),p.displayName=i(d,r,"GeneratorFunction"),a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,i(t,r,"GeneratorFunction")),t.prototype=Object.create(g),t},a.awrap=function(t){return{__await:t}},w(b.prototype),i(b.prototype,n,function(){return this}),a.AsyncIterator=b,a.async=function(t,e,n,r,o){void 0===o&&(o=Promise);var i=new b(c(t,e,n,r),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},w(g),i(g,r,"Generator"),i(g,o,function(){return this}),i(g,"toString",function(){return"[object Generator]"}),a.keys=function(t){var n=Object(t),r=[];for(var e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=S,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return i.type="throw",i.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),u=s.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},a}function asyncGeneratorStep(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function _asyncToGenerator(u){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=u.apply(t,a);function o(t){asyncGeneratorStep(r,e,n,o,i,"next",t)}function i(t){asyncGeneratorStep(r,e,n,o,i,"throw",t)}o(void 0)})}}!function(){function t(r,e,t,o,n,i,a,u,c,l,s){var f,h,p=this,d=t.PROFIBUS_DEVICE_FRAGMENT,v=t.CANOPEN_DEVICE_FRAGMENT,y=i.isElementChangePending,m=i.canUpdateElement,g=i.getCurrentElementValue,w=l("Value out of range. Allowed values from {{min | number}} to {{max | number}}."),b=[];function E(){return(E=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var n;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e)return t.next=3,c.getWidgetModel(e);t.next=6;break;case 3:n=t.sent,_.assign(p,n),r.$apply();case 6:case"end":return t.stop()}},t)}))).apply(this,arguments)}function x(t){e(L,t)}function L(){_.forEach(p.categories,function(t){_.forEach(t.elements,function(t){(function(t){return p.isElementChangePending(t)||_.includes(b,t)})(t)||(t.meta.type===n.ElementType.DISCRETE_IO&&(t.valueObj=_.find(t.meta.enumValues,{value:g(p.device,t)})),t.meta.type===n.ElementType.REGISTER&&(t.meta.enumType?t.valueObj=_.find(t.meta.enumValues,{value:g(p.device,t)}):_.set(t,"valueObj.value",g(p.device,t))))})})}_.assign(p,{$onChanges:function(t){t.config&&function(t){E.apply(this,arguments)}(p.config)},$doCheck:function(){var t=!1;_.isEqual(f,p.categories)||(f=_.cloneDeep(p.categories),t=!0);_.isEqual(h,p.device)||(h=_.cloneDeep(p.device),t=!0);t&&x()},isElementChangePending:y,canUpdateElement:m,updateElement:function(t,e,n){var r=i.updateElement;_.has(t,d)?r=a.updateElement:_.has(t,v)&&(r=u.updateElement);return r(t,e,n).then(function(){b=_.without(b,e),x(500)})},shouldShowSwitch:function(t){return t.meta.enumType&&t.meta.enumValues&&2===t.meta.enumValues.length},shouldShowEnumSelect:function(t){return t.meta.enumType&&t.meta.enumValues&&(1===t.meta.enumValues.length||2<t.meta.enumValues.length)},shouldShowNumberInput:function(t){return!t.meta.enumType},validationHints:function(t,e){var n=[];e.meta.valuesRange.possiblePrecisionLoss&&n.push(s.getString("Precision loss may occur, check Cloud Fieldbus specification for details."));if(p.canUpdateElement(p.device,e)){var r=_.get(e,"meta.valuesRange.custom");n.push(o.validationHints(t,{required:l("This field is required."),"value-in-register-range":s.getString(w,r)}))}return n.join(" ")},focus:function(t){b.push(t)},blur:_.debounce(function(t){b=_.without(b,t),x(500)},500)})}t.$inject=["$rootScope","$timeout","fieldbusConstants","c8yBase","c8yDeviceDatabase","c8yModbusDevice","c8yProfibusDevice","c8yCanopenDevice","modbusWidgetSvc","gettext","gettextCatalog"],angular.module("c8y.modbusWidget4").component("c8yModbusWidget",{templateUrl:":::PLUGIN_PATH:::/widget.html",bindings:{config:"<"},controllerAs:"vm",controller:t})}();
1
+ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},t=Object.prototype,c=t.hasOwnProperty,l=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(t){i=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o,i,a,u,e=e&&e.prototype instanceof h?e:h,e=Object.create(e.prototype),r=new E(r||[]);return l(e,"_invoke",{value:(o=t,i=n,a=r,u="suspendedStart",function(t,e){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return x()}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,o=e.iterator[r];if(void 0===o)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;r=s(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,f;o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,f):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,f)}(n,a);if(n){if(n===f)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===u)throw u="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);u="executing";n=s(o,i,a);if("normal"===n.type){if(u=a.done?"completed":"suspendedYield",n.arg===f)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(u="completed",a.method="throw",a.arg=n.arg)}})}),e}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var f={};function h(){}function p(){}function d(){}var e={},y=(i(e,r,function(){return this}),Object.getPrototypeOf),y=y&&y(y(_([]))),m=(y&&y!==t&&c.call(y,r)&&(e=y),d.prototype=h.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function g(a,u){var e;l(this,"_invoke",{value:function(n,r){function t(){return new u(function(t,e){!function e(t,n,r,o){var i,t=s(a[t],a,n);if("throw"!==t.type)return(n=(i=t.arg).value)&&"object"==_typeof(n)&&c.call(n,"__await")?u.resolve(n.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):u.resolve(n).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)});o(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function _(e){if(e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++n<e.length;)if(c.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:x}}function x(){return{value:void 0,done:!0}}return l(m,"constructor",{value:p.prototype=d,configurable:!0}),l(d,"constructor",{value:p,configurable:!0}),p.displayName=i(d,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,i(t,o,"GeneratorFunction")),t.prototype=Object.create(m),t},a.awrap=function(t){return{__await:t}},v(g.prototype),i(g.prototype,n,function(){return this}),a.AsyncIterator=g,a.async=function(t,e,n,r,o){void 0===o&&(o=Promise);var i=new g(u(t,e,n,r),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},v(m),i(m,o,"Generator"),i(m,r,function(){return this}),i(m,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,n=Object(t),r=[];for(e in n)r.push(e);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=_,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&c.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return i.type="throw",i.arg=n,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=c.call(o,"catchLoc"),u=c.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&c.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),b(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,r,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(n=o.completion).type&&(r=n.arg,b(o)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:_(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},a}function asyncGeneratorStep(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function _asyncToGenerator(u){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=u.apply(t,a);function o(t){asyncGeneratorStep(r,e,n,o,i,"next",t)}function i(t){asyncGeneratorStep(r,e,n,o,i,"throw",t)}o(void 0)})}}!function(){function t(r,e,t,o,n,i,a,u,c,l,s){var f,h,p=this,d=t.PROFIBUS_DEVICE_FRAGMENT,y=t.CANOPEN_DEVICE_FRAGMENT,t=i.isElementChangePending,m=i.canUpdateElement,v=i.getCurrentElementValue,g=l("Value out of range. Allowed values from {{min | number}} to {{max | number}}."),w=[];function b(){return(b=_asyncToGenerator(_regeneratorRuntime().mark(function t(e){var n;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e)return t.next=3,c.getWidgetModel(e);t.next=6;break;case 3:n=t.sent,_.assign(p,n),r.$apply();case 6:case"end":return t.stop()}},t)}))).apply(this,arguments)}function E(t){e(x,t)}function x(){_.forEach(p.categories,function(t){_.forEach(t.elements,function(t){var e;e=t,p.isElementChangePending(e)||_.includes(w,e)||(t.meta.type===n.ElementType.DISCRETE_IO&&(t.valueObj=_.find(t.meta.enumValues,{value:v(p.device,t)})),t.meta.type===n.ElementType.REGISTER&&(t.meta.enumType?t.valueObj=_.find(t.meta.enumValues,{value:v(p.device,t)}):_.set(t,"valueObj.value",v(p.device,t))))})})}_.assign(p,{$onChanges:function(t){t.config&&!function(){b.apply(this,arguments)}(p.config)},$doCheck:function(){var t=!1;_.isEqual(f,p.categories)||(f=_.cloneDeep(p.categories),t=!0);_.isEqual(h,p.device)||(h=_.cloneDeep(p.device),t=!0);t&&E()},isElementChangePending:t,canUpdateElement:m,updateElement:function(t,e,n){var r=i.updateElement;_.has(t,d)?r=a.updateElement:_.has(t,y)&&(r=u.updateElement);return r(t,e,n).then(function(){w=_.without(w,e),E(500)})},shouldShowSwitch:function(t){return t.meta.enumType&&t.meta.enumValues&&2===t.meta.enumValues.length},shouldShowEnumSelect:function(t){return t.meta.enumType&&t.meta.enumValues&&(1===t.meta.enumValues.length||2<t.meta.enumValues.length)},shouldShowNumberInput:function(t){return!t.meta.enumType},validationHints:function(t,e){var n=[];e.meta.valuesRange.possiblePrecisionLoss&&n.push(s.getString("Precision loss may occur, check Cloud Fieldbus specification for details."));p.canUpdateElement(p.device,e)&&(e=_.get(e,"meta.valuesRange.custom"),n.push(o.validationHints(t,{required:l("This field is required."),"value-in-register-range":s.getString(g,e)})));return n.join(" ")},focus:function(t){w.push(t)},blur:_.debounce(function(t){w=_.without(w,t),E(500)},500)})}t.$inject=["$rootScope","$timeout","fieldbusConstants","c8yBase","c8yDeviceDatabase","c8yModbusDevice","c8yProfibusDevice","c8yCanopenDevice","modbusWidgetSvc","gettext","gettextCatalog"],angular.module("c8y.modbusWidget4").component("c8yModbusWidget",{templateUrl:":::PLUGIN_PATH:::/widget.html",bindings:{config:"<"},controllerAs:"vm",controller:t})}();