softphone-vendor-headsets 1.0.1 → 2.0.0-develop.8

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 (250) hide show
  1. package/dist/1.softhphone-vendor-headsets.js +1 -1
  2. package/dist/1.softhphone-vendor-headsets.js.map +1 -1
  3. package/dist/2.softhphone-vendor-headsets.js +1 -1
  4. package/dist/2.softhphone-vendor-headsets.js.map +1 -1
  5. package/dist/3.softhphone-vendor-headsets.js +1 -1
  6. package/dist/3.softhphone-vendor-headsets.js.map +1 -1
  7. package/dist/deploy-info.json +3 -723
  8. package/dist/softhphone-vendor-headsets.js +4 -19
  9. package/dist/softhphone-vendor-headsets.js.map +1 -1
  10. package/package.json +82 -88
  11. package/dist/cjs/src/config/i18n.d.ts +0 -2
  12. package/dist/cjs/src/config/i18n.js +0 -27
  13. package/dist/cjs/src/config/i18n.js.map +0 -1
  14. package/dist/cjs/src/library/index.d.ts +0 -9
  15. package/dist/cjs/src/library/index.js +0 -26
  16. package/dist/cjs/src/library/index.js.map +0 -1
  17. package/dist/cjs/src/library/services/headset.d.ts +0 -41
  18. package/dist/cjs/src/library/services/headset.js +0 -181
  19. package/dist/cjs/src/library/services/headset.js.map +0 -1
  20. package/dist/cjs/src/library/services/headset.test.d.ts +0 -1
  21. package/dist/cjs/src/library/services/headset.test.js +0 -487
  22. package/dist/cjs/src/library/services/headset.test.js.map +0 -1
  23. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-commands.d.ts +0 -13
  24. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-commands.js +0 -18
  25. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-commands.js.map +0 -1
  26. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-event-translation.d.ts +0 -12
  27. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-event-translation.js +0 -16
  28. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-event-translation.js.map +0 -1
  29. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-requested-events.d.ts +0 -5
  30. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-requested-events.js +0 -10
  31. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-requested-events.js.map +0 -1
  32. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.d.ts +0 -38
  33. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.js +0 -251
  34. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.js.map +0 -1
  35. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.test.d.ts +0 -1
  36. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.test.js +0 -573
  37. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.test.js.map +0 -1
  38. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-commands.d.ts +0 -13
  39. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-commands.js +0 -18
  40. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-commands.js.map +0 -1
  41. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-commands.d.ts +0 -6
  42. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-commands.js +0 -11
  43. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-commands.js.map +0 -1
  44. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-heaset-state.d.ts +0 -4
  45. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-heaset-state.js +0 -3
  46. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-heaset-state.js.map +0 -1
  47. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-types.d.ts +0 -23
  48. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-types.js +0 -13
  49. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-types.js.map +0 -1
  50. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.d.ts +0 -45
  51. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.js +0 -236
  52. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.js.map +0 -1
  53. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.test.d.ts +0 -1
  54. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.test.js +0 -567
  55. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.test.js.map +0 -1
  56. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra.d.ts +0 -48
  57. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra.js +0 -341
  58. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra.js.map +0 -1
  59. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra.test.d.ts +0 -1
  60. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra.test.js +0 -844
  61. package/dist/cjs/src/library/services/vendor-implementations/jabra/jabra.test.js.map +0 -1
  62. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-call-events.d.ts +0 -37
  63. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-call-events.js +0 -51
  64. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-call-events.js.map +0 -1
  65. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-call-events.test.d.ts +0 -1
  66. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-call-events.test.js +0 -111
  67. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-call-events.test.js.map +0 -1
  68. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-test-responses.d.ts +0 -260
  69. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-test-responses.js +0 -273
  70. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics-test-responses.js.map +0 -1
  71. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics.d.ts +0 -58
  72. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics.js +0 -374
  73. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics.js.map +0 -1
  74. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics.test.d.ts +0 -2
  75. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics.test.js +0 -796
  76. package/dist/cjs/src/library/services/vendor-implementations/plantronics/plantronics.test.js.map +0 -1
  77. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-event-types.d.ts +0 -5
  78. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-event-types.js +0 -10
  79. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-event-types.js.map +0 -1
  80. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-events.d.ts +0 -21
  81. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-events.js +0 -26
  82. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-events.js.map +0 -1
  83. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-payload.d.ts +0 -16
  84. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-payload.js +0 -3
  85. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser-payload.js.map +0 -1
  86. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.d.ts +0 -44
  87. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.js +0 -303
  88. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.js.map +0 -1
  89. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.d.ts +0 -1
  90. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js +0 -801
  91. package/dist/cjs/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js.map +0 -1
  92. package/dist/cjs/src/library/services/vendor-implementations/vendor-implementation.d.ts +0 -69
  93. package/dist/cjs/src/library/services/vendor-implementations/vendor-implementation.js +0 -99
  94. package/dist/cjs/src/library/services/vendor-implementations/vendor-implementation.js.map +0 -1
  95. package/dist/cjs/src/library/services/vendor-implementations/vendor-implemntation.test.d.ts +0 -1
  96. package/dist/cjs/src/library/services/vendor-implementations/vendor-implemntation.test.js +0 -106
  97. package/dist/cjs/src/library/services/vendor-implementations/vendor-implemntation.test.js.map +0 -1
  98. package/dist/cjs/src/library/test-utils.test.d.ts +0 -16
  99. package/dist/cjs/src/library/test-utils.test.js +0 -40
  100. package/dist/cjs/src/library/test-utils.test.js.map +0 -1
  101. package/dist/cjs/src/library/types/call-info.d.ts +0 -4
  102. package/dist/cjs/src/library/types/call-info.js +0 -3
  103. package/dist/cjs/src/library/types/call-info.js.map +0 -1
  104. package/dist/cjs/src/library/types/consumed-headset-events.d.ts +0 -45
  105. package/dist/cjs/src/library/types/consumed-headset-events.js +0 -18
  106. package/dist/cjs/src/library/types/consumed-headset-events.js.map +0 -1
  107. package/dist/cjs/src/library/types/device-info.d.ts +0 -8
  108. package/dist/cjs/src/library/types/device-info.js +0 -3
  109. package/dist/cjs/src/library/types/device-info.js.map +0 -1
  110. package/dist/cjs/src/library/types/emitted-headset-events.d.ts +0 -31
  111. package/dist/cjs/src/library/types/emitted-headset-events.js +0 -3
  112. package/dist/cjs/src/library/types/emitted-headset-events.js.map +0 -1
  113. package/dist/cjs/src/library/types/jabra-request.d.ts +0 -3
  114. package/dist/cjs/src/library/types/jabra-request.js +0 -3
  115. package/dist/cjs/src/library/types/jabra-request.js.map +0 -1
  116. package/dist/cjs/src/library/utils.d.ts +0 -14
  117. package/dist/cjs/src/library/utils.js +0 -80
  118. package/dist/cjs/src/library/utils.js.map +0 -1
  119. package/dist/cjs/src/library/utils.test.d.ts +0 -1
  120. package/dist/cjs/src/library/utils.test.js +0 -46
  121. package/dist/cjs/src/library/utils.test.js.map +0 -1
  122. package/dist/cjs/src/mocks/call.d.ts +0 -11
  123. package/dist/cjs/src/mocks/call.js +0 -54
  124. package/dist/cjs/src/mocks/call.js.map +0 -1
  125. package/dist/cjs/src/mocks/device-service.d.ts +0 -8
  126. package/dist/cjs/src/mocks/device-service.js +0 -43
  127. package/dist/cjs/src/mocks/device-service.js.map +0 -1
  128. package/dist/cjs/src/setupTests.d.ts +0 -1
  129. package/dist/cjs/src/setupTests.js +0 -8
  130. package/dist/cjs/src/setupTests.js.map +0 -1
  131. package/dist/es/src/config/i18n.d.ts +0 -2
  132. package/dist/es/src/config/i18n.js +0 -22
  133. package/dist/es/src/config/i18n.js.map +0 -1
  134. package/dist/es/src/library/index.d.ts +0 -9
  135. package/dist/es/src/library/index.js +0 -10
  136. package/dist/es/src/library/index.js.map +0 -1
  137. package/dist/es/src/library/services/headset.d.ts +0 -41
  138. package/dist/es/src/library/services/headset.js +0 -175
  139. package/dist/es/src/library/services/headset.js.map +0 -1
  140. package/dist/es/src/library/services/headset.test.d.ts +0 -1
  141. package/dist/es/src/library/services/headset.test.js +0 -482
  142. package/dist/es/src/library/services/headset.test.js.map +0 -1
  143. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-commands.d.ts +0 -13
  144. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-commands.js +0 -15
  145. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-commands.js.map +0 -1
  146. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-event-translation.d.ts +0 -12
  147. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-event-translation.js +0 -13
  148. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-event-translation.js.map +0 -1
  149. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-requested-events.d.ts +0 -5
  150. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-requested-events.js +0 -7
  151. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome-requested-events.js.map +0 -1
  152. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.d.ts +0 -38
  153. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.js +0 -248
  154. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.js.map +0 -1
  155. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.test.d.ts +0 -1
  156. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.test.js +0 -568
  157. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-chrome/jabra-chrome.test.js.map +0 -1
  158. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-commands.d.ts +0 -13
  159. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-commands.js +0 -15
  160. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-commands.js.map +0 -1
  161. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-commands.d.ts +0 -6
  162. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-commands.js +0 -8
  163. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-commands.js.map +0 -1
  164. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-heaset-state.d.ts +0 -4
  165. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-heaset-state.js +0 -2
  166. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-heaset-state.js.map +0 -1
  167. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-types.d.ts +0 -23
  168. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-types.js +0 -10
  169. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native-types.js.map +0 -1
  170. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.d.ts +0 -45
  171. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.js +0 -233
  172. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.js.map +0 -1
  173. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.test.d.ts +0 -1
  174. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.test.js +0 -543
  175. package/dist/es/src/library/services/vendor-implementations/jabra/jabra-native/jabra-native.test.js.map +0 -1
  176. package/dist/es/src/library/services/vendor-implementations/jabra/jabra.d.ts +0 -48
  177. package/dist/es/src/library/services/vendor-implementations/jabra/jabra.js +0 -338
  178. package/dist/es/src/library/services/vendor-implementations/jabra/jabra.js.map +0 -1
  179. package/dist/es/src/library/services/vendor-implementations/jabra/jabra.test.d.ts +0 -1
  180. package/dist/es/src/library/services/vendor-implementations/jabra/jabra.test.js +0 -839
  181. package/dist/es/src/library/services/vendor-implementations/jabra/jabra.test.js.map +0 -1
  182. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-call-events.d.ts +0 -37
  183. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-call-events.js +0 -48
  184. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-call-events.js.map +0 -1
  185. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-call-events.test.d.ts +0 -1
  186. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-call-events.test.js +0 -109
  187. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-call-events.test.js.map +0 -1
  188. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-test-responses.d.ts +0 -260
  189. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-test-responses.js +0 -271
  190. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics-test-responses.js.map +0 -1
  191. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics.d.ts +0 -58
  192. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics.js +0 -368
  193. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics.js.map +0 -1
  194. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics.test.d.ts +0 -2
  195. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics.test.js +0 -791
  196. package/dist/es/src/library/services/vendor-implementations/plantronics/plantronics.test.js.map +0 -1
  197. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-event-types.d.ts +0 -5
  198. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-event-types.js +0 -7
  199. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-event-types.js.map +0 -1
  200. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-events.d.ts +0 -21
  201. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-events.js +0 -23
  202. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-events.js.map +0 -1
  203. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-payload.d.ts +0 -16
  204. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-payload.js +0 -2
  205. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser-payload.js.map +0 -1
  206. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.d.ts +0 -44
  207. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.js +0 -281
  208. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.js.map +0 -1
  209. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.d.ts +0 -1
  210. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js +0 -777
  211. package/dist/es/src/library/services/vendor-implementations/sennheiser/sennheiser.test.js.map +0 -1
  212. package/dist/es/src/library/services/vendor-implementations/vendor-implementation.d.ts +0 -69
  213. package/dist/es/src/library/services/vendor-implementations/vendor-implementation.js +0 -95
  214. package/dist/es/src/library/services/vendor-implementations/vendor-implementation.js.map +0 -1
  215. package/dist/es/src/library/services/vendor-implementations/vendor-implemntation.test.d.ts +0 -1
  216. package/dist/es/src/library/services/vendor-implementations/vendor-implemntation.test.js +0 -104
  217. package/dist/es/src/library/services/vendor-implementations/vendor-implemntation.test.js.map +0 -1
  218. package/dist/es/src/library/test-utils.test.d.ts +0 -16
  219. package/dist/es/src/library/test-utils.test.js +0 -36
  220. package/dist/es/src/library/test-utils.test.js.map +0 -1
  221. package/dist/es/src/library/types/call-info.d.ts +0 -4
  222. package/dist/es/src/library/types/call-info.js +0 -2
  223. package/dist/es/src/library/types/call-info.js.map +0 -1
  224. package/dist/es/src/library/types/consumed-headset-events.d.ts +0 -45
  225. package/dist/es/src/library/types/consumed-headset-events.js +0 -15
  226. package/dist/es/src/library/types/consumed-headset-events.js.map +0 -1
  227. package/dist/es/src/library/types/device-info.d.ts +0 -8
  228. package/dist/es/src/library/types/device-info.js +0 -2
  229. package/dist/es/src/library/types/device-info.js.map +0 -1
  230. package/dist/es/src/library/types/emitted-headset-events.d.ts +0 -31
  231. package/dist/es/src/library/types/emitted-headset-events.js +0 -2
  232. package/dist/es/src/library/types/emitted-headset-events.js.map +0 -1
  233. package/dist/es/src/library/types/jabra-request.d.ts +0 -3
  234. package/dist/es/src/library/types/jabra-request.js +0 -2
  235. package/dist/es/src/library/types/jabra-request.js.map +0 -1
  236. package/dist/es/src/library/utils.d.ts +0 -14
  237. package/dist/es/src/library/utils.js +0 -69
  238. package/dist/es/src/library/utils.js.map +0 -1
  239. package/dist/es/src/library/utils.test.d.ts +0 -1
  240. package/dist/es/src/library/utils.test.js +0 -44
  241. package/dist/es/src/library/utils.test.js.map +0 -1
  242. package/dist/es/src/mocks/call.d.ts +0 -11
  243. package/dist/es/src/mocks/call.js +0 -51
  244. package/dist/es/src/mocks/call.js.map +0 -1
  245. package/dist/es/src/mocks/device-service.d.ts +0 -8
  246. package/dist/es/src/mocks/device-service.js +0 -40
  247. package/dist/es/src/mocks/device-service.js.map +0 -1
  248. package/dist/es/src/setupTests.d.ts +0 -1
  249. package/dist/es/src/setupTests.js +0 -6
  250. package/dist/es/src/setupTests.js.map +0 -1
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SoftphoneVendorHeadsets=t():e.SoftphoneVendorHeadsets=t()}(window,(function(){return function(e){function t(t){for(var n,i,o=t[0],s=t[1],a=0,u=[];a<o.length;a++)i=o[a],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&u.push(r[i][0]),r[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(c&&c(t);u.length;)u.shift()()}var n={},r={0:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=o);var s,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+e+".softhphone-vendor-headsets.js"}(e);var c=new Error;s=function(t){a.onerror=a.onload=null,clearTimeout(u);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",c.name="ChunkLoadError",c.type=i,c.request=o,n[1](c)}r[e]=void 0}};var u=setTimeout((function(){s({type:"timeout",target:a})}),12e4);a.onerror=a.onload=s,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var o=window.webpackJsonpSoftphoneVendorHeadsets=window.webpackJsonpSoftphoneVendorHeadsets||[],s=o.push.bind(o);o.push=t,o=o.slice();for(var a=0;a<o.length;a++)t(o[a]);var c=s;return i(i.s=12)}([function(e,t,n){"use strict";(function(e,r,i){
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SoftphoneVendorHeadsets=t():e.SoftphoneVendorHeadsets=t()}(window,(function(){return function(e){function t(t){for(var n,i,o=t[0],s=t[1],a=0,u=[];a<o.length;a++)i=o[a],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&u.push(r[i][0]),r[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(c&&c(t);u.length;)u.shift()()}var n={},r={0:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=o);var s,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+""+e+".softhphone-vendor-headsets.js"}(e);var c=new Error;s=function(t){a.onerror=a.onload=null,clearTimeout(u);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",c.name="ChunkLoadError",c.type=i,c.request=o,n[1](c)}r[e]=void 0}};var u=setTimeout((function(){s({type:"timeout",target:a})}),12e4);a.onerror=a.onload=s,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var o=window.webpackJsonpSoftphoneVendorHeadsets=window.webpackJsonpSoftphoneVendorHeadsets||[],s=o.push.bind(o);o.push=t,o=o.slice();for(var a=0;a<o.length;a++)t(o[a]);var c=s;return i(i.s=11)}([function(e,t,n){"use strict";(function(e,r,i){
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -27,7 +27,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
27
27
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
28
28
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
29
29
  PERFORMANCE OF THIS SOFTWARE.
30
- ***************************************************************************** */}n.d(t,"a",(function(){return lr})),n.d(t,"b",(function(){return je})),n.d(t,"c",(function(){return kn})),n.d(t,"d",(function(){return dt})),n.d(t,"e",(function(){return Ue})),n.d(t,"f",(function(){return F})),n.d(t,"g",(function(){return G})),n.d(t,"h",(function(){return Be})),n.d(t,"i",(function(){return Pn})),n.d(t,"j",(function(){return o})),n.d(t,"k",(function(){return Se})),n.d(t,"l",(function(){return xe})),n.d(t,"m",(function(){return De})),n.d(t,"n",(function(){return J})),n.d(t,"o",(function(){return Nn})),n.d(t,"p",(function(){return Yn})),n.d(t,"q",(function(){return He})),n.d(t,"r",(function(){return Me})),n.d(t,"s",(function(){return U})),n.d(t,"t",(function(){return Dn})),n.d(t,"u",(function(){return Ln})),n.d(t,"v",(function(){return pt})),n.d(t,"w",(function(){return Ae})),n.d(t,"x",(function(){return R})),n.d(t,"y",(function(){return j})),n.d(t,"z",(function(){return Ge})),n.d(t,"A",(function(){return et})),n.d(t,"B",(function(){return Vt})),n.d(t,"C",(function(){return Sn})),n.d(t,"D",(function(){return Vn}));var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function l(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function d(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}function p(e){return this instanceof p?(this.v=e,this):new p(e)}function v(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof p?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function g(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=f(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,i,(t=e[n](t)).done,t.value)}))}}}function y(e){return"function"==typeof e}function m(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var b=m((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function E(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var w=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._teardowns=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=f(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(y(c))try{c()}catch(e){i=e instanceof b?e.errors:[e]}var u=this._teardowns;if(u){this._teardowns=null;try{for(var l=f(u),p=l.next();!p.done;p=l.next()){var v=p.value;try{O(v)}catch(e){i=null!=i?i:[],e instanceof b?i=d(d([],h(i)),h(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new b(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)O(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._teardowns=null!==(n=this._teardowns)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&E(t,e)},e.prototype.remove=function(t){var n=this._teardowns;n&&E(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),_=w.EMPTY;function C(e){return e instanceof w||e&&"closed"in e&&y(e.remove)&&y(e.add)&&y(e.unsubscribe)}function O(e){y(e)?e():e.unsubscribe()}var T=void 0,k=!1;function I(e){!function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];setTimeout.apply(void 0,d([],h(e)))}((function(){throw e}))}function R(){}var A=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,C(t)&&t.add(n)):n.destination=D,n}return u(t,e),t.create=function(e,t,n){return new S(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(w),S=function(e){function t(t,n,r){var i,o=e.call(this)||this;if(y(t))i=t;else if(t){var s;i=t.next,n=t.error,r=t.complete,o&&k?(s=Object.create(t)).unsubscribe=function(){return o.unsubscribe()}:s=t,i=null==i?void 0:i.bind(s),n=null==n?void 0:n.bind(s),r=null==r?void 0:r.bind(s)}return o.destination={next:i?P(i):R,error:P(null!=n?n:N),complete:r?P(r):R},o}return u(t,e),t}(A);function P(e,t){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{e.apply(void 0,d([],h(t)))}catch(e){I(e)}}}function N(e){throw e}var D={closed:!0,next:R,error:N,complete:R},L="function"==typeof Symbol&&Symbol.observable||"@@observable";function x(e){return e}function H(e){return 0===e.length?x:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var U=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=(r=e)&&r instanceof A||function(e){return e&&y(e.next)&&y(e.error)&&y(e.complete)}(r)&&C(r)?e:new S(e,t,n),o=this.operator,s=this.source;return i.add(o?o.call(i,s):s?this._subscribe(i):this._trySubscribe(i)),i},e.prototype._deprecatedSyncErrorSubscribe=function(e){var t=e;t._syncErrorHack_isSubscribing=!0;var n=this.operator;if(n)e.add(n.call(e,this.source));else try{e.add(this._subscribe(e))}catch(e){t.__syncError=e}for(var r=t;r;){if("__syncError"in r)try{throw r.__syncError}finally{e.unsubscribe()}r=r.destination}t._syncErrorHack_isSubscribing=!1},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=M(t))((function(t,r){var i;i=n.subscribe((function(t){try{e(t)}catch(e){r(e),null==i||i.unsubscribe()}}),r,t)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[L]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length?H(e)(this):this},e.prototype.toPromise=function(e){var t=this;return new(e=M(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function M(e){var t;return null!==(t=null!=e?e:T)&&void 0!==t?t:Promise}function j(e){return function(t){if(function(e){return y(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}var F=function(e){function t(t,n,r,i,o){var s=e.call(this,t)||this;return s.onFinalize=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return u(t,e),t.prototype.unsubscribe=function(){var t,n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))},t}(A),B=m((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),G=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return u(t,e),t.prototype.lift=function(e){var t=new Y(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new B},t.prototype.next=function(e){var t,n;if(this._throwIfClosed(),!this.isStopped){var r=this.observers.slice();try{for(var i=f(r),o=i.next();!o.done;o=i.next())o.value.next(e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}},t.prototype.error=function(e){if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=e;for(var t=this.observers;t.length;)t.shift().error(e)}},t.prototype.complete=function(){if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;for(var e=this.observers;e.length;)e.shift().complete()}},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=t.hasError,r=t.isStopped,i=t.observers;return n||r?_:(i.push(e),new w((function(){return E(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new U;return e.source=this,e},t.create=function(e,t){return new Y(e,t)},t}(U),Y=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return u(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:_},t}(G),V=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return u(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(G),W={now:function(){return(W.delegate||Date).now()},delegate:void 0},K=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=W);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return u(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,c=1;c<r.length&&r[c]<=s;c+=2)a=c;a&&r.splice(0,a+1)}},t}(G),q=function(e){function t(t,n){return e.call(this)||this}return u(t,e),t.prototype.schedule=function(e,t){return this},t}(w),z=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return u(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return setInterval.apply(void 0,d([],h(e)))}(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;!function(e){clearInterval(e)}(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=!!e&&e||new Error(e)}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,E(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(q),$=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=W.now,e}(),J=new(function(e){function t(t,n){void 0===n&&(n=$.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r._scheduled=void 0,r}return u(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}($))(z),X=J,Q=new U((function(e){return e.complete()}));function Z(e,t){return new U((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}var ee=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function te(e){return y(null==e?void 0:e.then)}var ne="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function re(e,t,n,r){void 0===r&&(r=0);var i=t.schedule((function(){try{n.call(this)}catch(t){e.error(t)}}),r);return e.add(i),i}function ie(e,t){if(!e)throw new Error("Iterable cannot be null");return new U((function(n){var r=new w;return r.add(t.schedule((function(){var i=e[Symbol.asyncIterator]();r.add(t.schedule((function(){var e=this;i.next().then((function(t){t.done?n.complete():(n.next(t.value),e.schedule())}))})))}))),r}))}function oe(e){return y(e[L])}function se(e){return y(null==e?void 0:e[ne])}function ae(e){return Symbol.asyncIterator&&y(null==e?void 0:e[Symbol.asyncIterator])}function ce(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ue(e){return v(this,arguments,(function(){var t,n,r;return l(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,p(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,p(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,p(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function le(e){return y(null==e?void 0:e.getReader)}function fe(e,t){return t?function(e,t){if(null!=e){if(oe(e))return function(e,t){return new U((function(n){var r=new w;return r.add(t.schedule((function(){var i=e[L]();r.add(i.subscribe({next:function(e){r.add(t.schedule((function(){return n.next(e)})))},error:function(e){r.add(t.schedule((function(){return n.error(e)})))},complete:function(){r.add(t.schedule((function(){return n.complete()})))}}))}))),r}))}(e,t);if(ee(e))return Z(e,t);if(te(e))return function(e,t){return new U((function(n){return t.schedule((function(){return e.then((function(e){n.add(t.schedule((function(){n.next(e),n.add(t.schedule((function(){return n.complete()})))})))}),(function(e){n.add(t.schedule((function(){return n.error(e)})))}))}))}))}(e,t);if(ae(e))return ie(e,t);if(se(e))return function(e,t){return new U((function(n){var r;return n.add(t.schedule((function(){r=e[ne](),re(n,t,(function(){var e=r.next(),t=e.value;e.done?n.complete():(n.next(t),this.schedule())}))}))),function(){return y(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(le(e))return function(e,t){return ie(ue(e),t)}(e,t)}throw ce(e)}(e,t):he(e)}function he(e){if(e instanceof U)return e;if(null!=e){if(oe(e))return r=e,new U((function(e){var t=r[L]();if(y(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ee(e))return de(e);if(te(e))return n=e,new U((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,I)}));if(ae(e))return pe(e);if(se(e))return t=e,new U((function(e){var n,r;try{for(var i=f(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()}));if(le(e))return pe(ue(e))}var t,n,r;throw ce(e)}function de(e){return new U((function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()}))}function pe(e){return new U((function(t){(function(e,t){var n,r,i,o;return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){var s,a;return l(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=g(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function ve(e,t){return t?Z(e,t):de(e)}function ge(e){return e&&y(e.schedule)}function ye(e){return e[e.length-1]}function me(e){return y(ye(e))?e.pop():void 0}function be(e){return ge(ye(e))?e.pop():void 0}function Ee(e,t){return"number"==typeof ye(e)?e.pop():t}function we(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=be(e);return n?Z(e,n):ve(e)}function _e(e,t){var n=y(e)?e:function(){return e},r=function(e){return e.error(n())};return new U(t?function(e){return t.schedule(r,0,e)}:r)}var Ce=m((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Oe(e,t){var n="object"==typeof t;return new Promise((function(r,i){var o=new S({next:function(e){r(e),o.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new Ce)}});e.subscribe(o)}))}function Te(e){return e instanceof Date&&!isNaN(e)}var ke=m((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function Ie(e,t){var n=Te(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?Re:o,a=n.scheduler,c=void 0===a?null!=t?t:J:a,u=n.meta,l=void 0===u?null:u;if(null==r&&null==i)throw new TypeError("No timeout provided.");return j((function(e,t){var n,o,a=null,u=0,f=function(e){o=re(t,c,(function(){n.unsubscribe(),he(s({meta:l,lastValue:a,seen:u})).subscribe(t)}),e)};n=e.subscribe(new F(t,(function(e){null==o||o.unsubscribe(),u++,t.next(a=e),i>0&&f(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),a=null}))),f(null!=r?"number"==typeof r?r:+r-c.now():i)}))}function Re(e){throw new ke(e)}function Ae(e,t){return j((function(n,r){var i=0;n.subscribe(new F(r,(function(n){r.next(e.call(t,n,i++))})))}))}function Se(e,t,n){return void 0===n&&(n=1/0),y(t)?Se((function(n,r){return Ae((function(e,i){return t(n,e,r,i)}))(he(e(n,r)))}),n):("number"==typeof t&&(n=t),j((function(t,r){return function(e,t,n,r,i,o,s,a){var c=[],u=0,l=0,f=!1,h=function(){!f||c.length||u||t.complete()},d=function(e){return u<r?p(e):c.push(e)},p=function(e){u++;var i=!1;he(n(e,l++)).subscribe(new F(t,(function(e){t.next(e)}),(function(){i=!0}),void 0,(function(){if(i)try{u--;for(var e=function(){var e=c.shift();p(e)};c.length&&u<r;)e();h()}catch(e){t.error(e)}})))};return e.subscribe(new F(t,d,(function(){f=!0,h()}))),function(){}}(t,r,e,n)})))}function Pe(e){return void 0===e&&(e=1/0),Se(x,e)}function Ne(){return Pe(1)}function De(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ne()(ve(e,be(e)))}function Le(e){return new U((function(t){he(e()).subscribe(t)}))}function xe(e,t,n){void 0===e&&(e=0),void 0===n&&(n=X);var r=-1;return null!=t&&(ge(t)?n=t:r=t),new U((function(t){var i=Te(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule((function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())}),i)}))}function He(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=be(e),r=Ee(e,1/0),i=e;return i.length?1===i.length?he(i[0]):Pe(r)(ve(i,n)):Q}var Ue,Me,je,Fe,Be,Ge,Ye=new U(R),Ve=Array.isArray;function We(e){return 1===e.length&&Ve(e[0])?e[0]:e}function Ke(e,t){return function(n,r){return!e.call(t,n,r)}}function qe(e,t){return j((function(n,r){var i=0;n.subscribe(new F(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function ze(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===(e=We(e)).length?he(e[0]):new U($e(e))}function $e(e){return function(t){for(var n=[],r=function(r){n.push(he(e[r]).subscribe(new F(t,(function(e){if(n){for(var i=0;i<n.length;i++)i!==r&&n[i].unsubscribe();n=null}t.next(e)}))))},i=0;n&&!t.closed&&i<e.length;i++)r(i)}}function Je(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=me(e),r=We(e);return r.length?new U((function(e){var t=r.map((function(){return[]})),i=r.map((function(){return!1}));e.add((function(){t=i=null}));for(var o=function(o){he(r[o]).subscribe(new F(e,(function(r){if(t[o].push(r),t.every((function(e){return e.length}))){var s=t.map((function(e){return e.shift()}));e.next(n?n.apply(void 0,d([],h(s))):s),t.some((function(e,t){return!e.length&&i[t]}))&&e.complete()}}),(function(){i[o]=!0,!t[o].length&&e.complete()})))},s=0;!e.closed&&s<r.length;s++)o(s);return function(){t=i=null}})):Q}function Xe(e){return j((function(t,n){var r,i=null,o=!1;i=t.subscribe(new F(n,void 0,void 0,(function(s){r=he(e(s,Xe(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):o=!0}))),o&&(i.unsubscribe(),i=null,r.subscribe(n))}))}function Qe(e,t){return y(t)?Se(e,t,1):Se(e,1)}function Ze(e){return j((function(t,n){var r=!1;t.subscribe(new F(n,(function(e){r=!0,n.next(e)}),(function(){r||n.next(e),n.complete()})))}))}function et(e){return e<=0?function(){return Q}:j((function(t,n){var r=0;t.subscribe(new F(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function tt(e){return void 0===e&&(e=nt),j((function(t,n){var r=!1;t.subscribe(new F(n,(function(e){r=!0,n.next(e)}),(function(){return r?n.complete():n.error(e())})))}))}function nt(){return new Ce}function rt(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?qe((function(t,n){return e(t,n,r)})):x,et(1),n?Ze(t):tt((function(){return new Ce})))}}function it(e){return e<=0?function(){return Q}:j((function(t,n){var r=[];t.subscribe(new F(n,(function(t){r.push(t),e<r.length&&r.shift()}),(function(){var e,t;try{for(var i=f(r),o=i.next();!o.done;o=i.next()){var s=o.value;n.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}n.complete()}),void 0,(function(){r=null})))}))}function ot(e){return j((function(t,n){var r,i,o=!1,s=function(){r=t.subscribe(new F(n,void 0,void 0,(function(t){i||(i=new G,e(i).subscribe(new F(n,(function(){return r?s():o=!0})))),i&&i.next(t)}))),o&&(r.unsubscribe(),r=null,o=!1,s())};s()}))}function st(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new G}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t=null,r=null,o=null,a=0,u=!1,l=!1,f=function(){null==r||r.unsubscribe(),r=null},h=function(){f(),t=o=null,u=l=!1},d=function(){var e=t;h(),null==e||e.unsubscribe()};return j((function(e,p){a++,l||u||f();var v=o=null!=o?o:n();p.add((function(){0!=--a||l||u||(r=at(d,c))})),v.subscribe(p),t||(t=new S({next:function(e){return v.next(e)},error:function(e){l=!0,f(),r=at(h,i,e),v.error(e)},complete:function(){u=!0,f(),r=at(h,s),v.complete()}}),fe(e).subscribe(t))}))(e)}}function at(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return!0===t?(e(),null):!1===t?null:t.apply(void 0,d([],h(n))).pipe(et(1)).subscribe((function(){return e()}))}function ct(e,t,n){var r,i,o,s=!1;return e&&"object"==typeof e?(o=null!==(r=e.bufferSize)&&void 0!==r?r:1/0,t=null!==(i=e.windowTime)&&void 0!==i?i:1/0,s=!!e.refCount,n=e.scheduler):o=null!=e?e:1/0,st({connector:function(){return new K(o,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}function ut(e){return qe((function(t,n){return e<=n}))}function lt(){return e=x,j((function(t,n){var r=null,i=0,o=!1,s=function(){return o&&!r&&n.complete()};t.subscribe(new F(n,(function(t){null==r||r.unsubscribe();var o=i++;he(e(t,o)).subscribe(r=new F(n,(function(e){return n.next(e)}),(function(){r=null,s()})))}),(function(){o=!0,s()})))}));var e}function ft(e){return j((function(t,n){he(e).subscribe(new F(n,(function(){return n.complete()}),R)),!n.closed&&t.subscribe(n)}))}function ht(e,t,n){var r=y(e)||t||n?{next:e,error:t,complete:n}:e;return r?j((function(e,t){e.subscribe(new F(t,(function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)}),(function(){var e;null===(e=r.complete)||void 0===e||e.call(r),t.complete()}),(function(e){var n;null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)})))})):x}class dt extends Error{constructor(e,t){super(e),this.type=t,this.type=t,Object.setPrototypeOf(this,new.target.prototype)}}function pt(e,t,n=Ue.ERROR,r=Me.JS_LIB){t?null==t||t.write({level:n,layer:r,message:e}):t||n!==Ue.ERROR||console.error(e)}function vt(e){return void 0!==e}!function(e){e.ERROR="error",e.WARNING="warning",e.INFO="info"}(Ue||(Ue={})),function(e){e.CHROME_EXTENSION="chrome-extension",e.NATIVE_CONSOLE="native-console",e.JS_LIB="js-lib"}(Me||(Me={})),function(e){e.SDK_USAGE_ERROR="sdk-usage-error",e.FEATURE_NOT_SUPPORTED="feature-not-supported",e.DEVICE_ERROR="device-error",e.UNEXPECTED_ERROR="unexpected-error",e.INIT_ERROR="init-error"}(je||(je={}));class gt{constructor(e,t){this.compare=t,this.remove=new G,this.itemRemoved=this.remove,this.items=new V([]),this.itemList=this.items,this.itemAdded=e.pipe(Ae(e=>(this.addItem(e),e)),st()),this.itemAdded.subscribe({next:e=>{e.onDisconnect.pipe(rt(),Ae(()=>this.removeItem(e.id)),qe(vt)).subscribe(e=>this.remove.next(e))},error:R}),this.itemRemoved.subscribe({error:R})}getValue(){return[...this.items.getValue()]}addItem(e){if(this.items.getValue().filter(t=>t.id.equals(e.id)).length>0)throw new dt("This item has already been added.",je.UNEXPECTED_ERROR);const t=this.items.getValue().concat([e]);t.sort(this.compare),this.items.next(t)}removeItem(e){const t=this.getValue(),n=t.findIndex(t=>t.id.equals(e));if(-1===n)throw new dt("Item not found and therefore cannot be removed.",je.UNEXPECTED_ERROR);const r=t.splice(n,1)[0];return this.items.next(t),r}}class yt{constructor(t,n){this.sdkVersion="4.1.0",this.consoleAppVersion=t.pipe(rt(e=>"ready"===e.event),Ae(e=>e.version),Ie(1e3),ct(1),Xe(()=>we(null))),this.chromeExtensionVersion=t.pipe(rt(e=>"chrome-extension-ready"===e.event),Ae(e=>e.version),Ie(1e3),ct(1),Xe(()=>we(null))),Je(this.consoleAppVersion,this.chromeExtensionVersion).subscribe(t=>{const r=`sdkVersion: ${this.sdkVersion} | chromeHostVersion: ${t[0]}`;let i;i=void 0!==e?`${r} | nodeVersion: ${e.version} | platform: ${e.platform}`:`${r} | chromeExtensionVersion: ${t[1]} | browserUserAgent: ${window.navigator.userAgent}`,pt(i,n,Ue.INFO)})}}class mt{constructor(e,t,n){this.deviceDetector=e,this.deviceAdded=this.deviceDetector.deviceObservables.itemAdded,this.deviceRemoved=this.deviceDetector.deviceObservables.itemRemoved,this.deviceList=this.deviceDetector.deviceObservables.itemList,Fe.set(this,void 0),this._transport=t,this._readyEvents=t.consoleAppEvent.pipe(qe(e=>"ready"===e.event||"chrome-extension-ready"===e.event),ct(2)),this._readyEvents.subscribe(),this._config=n,this.transportContext=t.context,a(this,Fe,new yt(this._readyEvents,null==n?void 0:n.logger),"f")}getVersion(){return s(this,Fe,"f").sdkVersion}getChromehostVersion(){return Oe(s(this,Fe,"f").consoleAppVersion)}getChromeExtensionVersion(){return Oe(s(this,Fe,"f").chromeExtensionVersion)}}Fe=new WeakMap,function(e){e.NODE="node",e.CHROME_EXTENSION="chrome-extension",e.WEB_HID="web-hid"}(Be||(Be={})),function(e){e.CHROME_EXTENSION="chrome-extension",e.WEB_HID="web-hid",e.CHROME_EXTENSION_WITH_WEB_HID_FALLBACK="chrome-extension-with-web-hid-fallback"}(Ge||(Ge={}));const bt="Failed to dynamically import file. Please contact a Jabra representative as we would love to learn about scenarios where this could happen!";function Et(e,t=Ge.CHROME_EXTENSION,r){return o(this,void 0,void 0,(function*(){if(t!==Ge.WEB_HID){const i=yield n.e(1).then(n.bind(null,19)).catch(()=>{throw new dt(bt,je.UNEXPECTED_ERROR)}),o=yield i.TransportChromeExtension.checkInstallation();if(o.ok)return pt("Using Chrome extension for transport.",e,Ue.INFO),new i.TransportChromeExtension(e,r);if(t===Ge.CHROME_EXTENSION)throw new dt(o.message,je.INIT_ERROR);t===Ge.CHROME_EXTENSION_WITH_WEB_HID_FALLBACK&&pt(o.message,e,Ue.INFO)}return pt("Using WebHID for transport.",e,Ue.INFO),function(e,t){return o(this,void 0,void 0,(function*(){const r=yield n.e(2).then(n.bind(null,20)).catch(()=>{throw new dt(bt,je.UNEXPECTED_ERROR)}),i=yield n.e(3).then(n.bind(null,21)).catch(()=>{throw new dt(bt,je.UNEXPECTED_ERROR)}),o=r.initHandler(e);return new i.WebHidTransport(o,e,t)}))}(e,r)}))}class wt{constructor(e,t){this.log=e.consoleAppEvent.pipe(qe(e=>"log"===e.event),Ae(e=>({message:e.message,level:e.level,layer:e.layer}))),this.log.subscribe(e=>pt(e.message,t,e.level,e.layer))}}const _t=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];class Ct{constructor(e){this.config=e,this.messageShown=!1}validateOrganizationKey(){var e;(null===(e=this.config)||void 0===e?void 0:e.partnerKey)?this.validateCrc(this.config.partnerKey)||this.logWarning("Invalid partner key."):this.logWarning("No partner key provided.")}validateAppId(){var e;(null===(e=this.config)||void 0===e?void 0:e.appId)?this.config.appId.length<3?this.logWarning("The appId should be minimum 3 characters.",!1):this.config.appId.length>100?this.logWarning("The appId should be less than 100 characters.",!1):/^[A-Za-z0-9\-_]+$/.test(this.config.appId)||this.logWarning("The appId is invalid. Should consist of letters, numbers, underscores or dashes",!1):this.logWarning("No app identifier provided.")}validateAppName(){var e;(null===(e=this.config)||void 0===e?void 0:e.appName)?/^[\x20-\x7F]*$/.test(this.config.appName)?this.config.appName.length>100?this.logWarning("The app name should be less than 100 characters.",!1):/^[\p{L}\p{N}]+[\p{L}\p{N}\u0020&-]*$/gu.test(this.config.appName)||this.logWarning("The appName is invalid. Name should consist of numbers, spaces, ampersands and dashes. Name should not begin with spaces, ampersands or dashes.",!1):this.logWarning("The app name can only contain ASCII characters",!1):this.logWarning("No app name provided. Will fallback to use appId as name.",!1)}logWarning(e,t=!0){this.messageShown||(this.messageShown=!0,t?console.warn(`\n ${e}\n \n Add keys to the config object on initialization.\n E.g. await init({\n partnerKey: 'my-partner-key-from-developer-zone',\n appId: 'my-self-chosen-app-id',\n appName: 'My App Name'\n });\n\n Please obtain a valid partner key from https://developer.jabra.com.\n The key will ensure interoperability with other Jabra apps and services, and mitigate\n some co-existence issues with other softphone applications.\n\n The package will continue to work without the keys, but we do not recommend production release\n without it. Read more on the Developer Zone.\n \n `):console.warn(e))}validateCrc(e){const[t,...n]=e.split("-"),r=function(e){let t,n,r=65535;for(n=0;n<e.length;n+=1){const i=e.charCodeAt(n);if(i>255)throw new RangeError;t=255&(i^r>>8),r=_t[t]^r<<8}return 65535&(0^r)}(n.join("-")).toString(16).padStart(4,"0");return t===r}}var Ot,Tt,kt,It,Rt,At,St;!function(e){e[e.MS_OC=0]="MS_OC",e[e.CISCO=1]="CISCO",e[e.AVAYA=2]="AVAYA",e[e.SIEMENS=3]="SIEMENS",e[e.ALCATEL=4]="ALCATEL",e[e.IBM=5]="IBM",e[e.AASTRA=6]="AASTRA",e[e.SKYPE=7]="SKYPE",e[e.GENERIC=8]="GENERIC",e[e.NORTEL=9]="NORTEL",e[e.JABRA=10]="JABRA",e[e.NEC=11]="NEC",e[e.SHORETEL=12]="SHORETEL",e[e.OTHER=255]="OTHER"}(Ot||(Ot={}));class Pt{constructor(e,t){this.gnpReadCommand=e,this.serialize=t,this.command=e.command,this.subCommand=e.subCommand}deserialize(e){return this.gnpReadCommand.deserialize(e)}}!function(e){e[e.GN_PROTOCOL=65280]="GN_PROTOCOL"}(Tt||(Tt={})),function(e){e[e.DATA=1]="DATA"}(kt||(kt={}));class Nt{constructor(e,t,n,r,i,o=new Uint8Array,s=0){this.destination=e,this.source=t,this.type=n,this.command=r,this.subCommand=i,this.payload=o,this.sequenceNumber=s}}!function(e){e[e.PC_ADDR=0]="PC_ADDR",e[e.BASE_ADDR=1]="BASE_ADDR",e[e.HS1_ADDR=4]="HS1_ADDR",e[e.HS_BT_USB_ADDR=8]="HS_BT_USB_ADDR",e[e.HS_CRADLE_ADDR=10]="HS_CRADLE_ADDR",e[e.CRADLE_ADDR=21]="CRADLE_ADDR"}(It||(It={})),function(e){e[e.EVENT=0]="EVENT",e[e.READ=1]="READ",e[e.WRITE=2]="WRITE",e[e.REPLY=3]="REPLY"}(Rt||(Rt={})),function(e){e[e.IDENT=2]="IDENT",e[e.DFU=7]="DFU",e[e.DEVICE=13]="DEVICE",e[e.FWU=15]="FWU",e[e.STATUS=18]="STATUS",e[e.CONFIG=19]="CONFIG",e[e.NACK=254]="NACK",e[e.ACK=255]="ACK"}(At||(At={})),function(e){e[e.CONFIG_PREFERRED_SOFTPHONE=34]="CONFIG_PREFERRED_SOFTPHONE",e[e.ID=1]="ID",e[e.IDENT_GET_AVAILABLE_SOFTPHONES=16]="IDENT_GET_AVAILABLE_SOFTPHONES",e[e.TYPE=2]="TYPE",e[e.NAME=0]="NAME",e[e.PID=17]="PID",e[e.ATTACH_EVENT=1]="ATTACH_EVENT",e[e.DETACH_EVENT=2]="DETACH_EVENT"}(St||(St={}));const Dt={command:At.DEVICE,subCommand:St.ATTACH_EVENT,serialize:e=>Uint8Array.from([5,0])};function Lt(e){const t=e.payload,n=t[0],r=t.length-1;if(r!==n)throw new dt(`Invalid response. Expected length: ${n}, actual: ${r}`,je.DEVICE_ERROR);const i=t.slice(1);return String.fromCharCode(...Array.from(i))}class xt{constructor(){this.command=At.IDENT,this.subCommand=St.IDENT_GET_AVAILABLE_SOFTPHONES,this.deserialize=(e=>e,e=>{const t=e.payload,n=t[0],r=t.length-1;if(r!==n)throw new dt(`Invalid response. Expected length: ${n}, actual: ${r}`,je.DEVICE_ERROR);const i=[];return t.slice(1).forEach(e=>{i.push(e)}),i})}}const Ht={command:At.IDENT,subCommand:St.NAME,deserialize:Lt},Ut={command:At.IDENT,subCommand:St.PID,deserialize:function(e){const t=e instanceof Nt?e.payload:e;return new DataView(t.buffer).getUint16(0,!0)}};class Mt{constructor(){this.command=At.CONFIG,this.subCommand=St.CONFIG_PREFERRED_SOFTPHONE,this.deserialize=e=>e.payload[0],this.serialize=e=>Uint8Array.of(e)}}class jt{constructor(){this.command=At.IDENT,this.subCommand=St.TYPE,this.deserialize=e=>e.source}}const Ft={command:At.IDENT,subCommand:St.ID,deserialize:Lt};function Bt(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r||"undefined"!=typeof self&&self;var Gt,Yt,Vt=Bt((function(e){
30
+ ***************************************************************************** */}n.d(t,"a",(function(){return hr})),n.d(t,"b",(function(){return Fe})),n.d(t,"c",(function(){return Sn})),n.d(t,"d",(function(){return vt})),n.d(t,"e",(function(){return Me})),n.d(t,"f",(function(){return F})),n.d(t,"g",(function(){return G})),n.d(t,"h",(function(){return Ge})),n.d(t,"i",(function(){return xn})),n.d(t,"j",(function(){return o})),n.d(t,"k",(function(){return Pe})),n.d(t,"l",(function(){return He})),n.d(t,"m",(function(){return De})),n.d(t,"n",(function(){return J})),n.d(t,"o",(function(){return Dn})),n.d(t,"p",(function(){return Wn})),n.d(t,"q",(function(){return Ue})),n.d(t,"r",(function(){return je})),n.d(t,"s",(function(){return U})),n.d(t,"t",(function(){return Ln})),n.d(t,"u",(function(){return Hn})),n.d(t,"v",(function(){return yt})),n.d(t,"w",(function(){return Ae})),n.d(t,"x",(function(){return S})),n.d(t,"y",(function(){return j})),n.d(t,"z",(function(){return Ye})),n.d(t,"A",(function(){return tt})),n.d(t,"B",(function(){return Kt})),n.d(t,"C",(function(){return Nn})),n.d(t,"D",(function(){return Kn}));var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function l(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function d(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}function p(e){return this instanceof p?(this.v=e,this):new p(e)}function v(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof p?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function y(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=f(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,i,(t=e[n](t)).done,t.value)}))}}}function g(e){return"function"==typeof e}function m(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var b=m((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function w(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var E=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._teardowns=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=f(o),a=s.next();!a.done;a=s.next())a.value.remove(this)}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(g(c))try{c()}catch(e){i=e instanceof b?e.errors:[e]}var u=this._teardowns;if(u){this._teardowns=null;try{for(var l=f(u),p=l.next();!p.done;p=l.next()){var v=p.value;try{O(v)}catch(e){i=null!=i?i:[],e instanceof b?i=d(d([],h(i)),h(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new b(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)O(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._teardowns=null!==(n=this._teardowns)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&w(t,e)},e.prototype.remove=function(t){var n=this._teardowns;n&&w(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),_=E.EMPTY;function C(e){return e instanceof E||e&&"closed"in e&&g(e.remove)&&g(e.add)&&g(e.unsubscribe)}function O(e){g(e)?e():e.unsubscribe()}var I=void 0,k=!1;function T(e){!function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];setTimeout.apply(void 0,d([],h(e)))}((function(){throw e}))}function S(){}var R=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,C(t)&&t.add(n)):n.destination=x,n}return u(t,e),t.create=function(e,t,n){return new A(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(E),A=function(e){function t(t,n,r){var i,o=e.call(this)||this;if(g(t))i=t;else if(t){var s;i=t.next,n=t.error,r=t.complete,o&&k?(s=Object.create(t)).unsubscribe=function(){return o.unsubscribe()}:s=t,i=null==i?void 0:i.bind(s),n=null==n?void 0:n.bind(s),r=null==r?void 0:r.bind(s)}return o.destination={next:i?P(i):S,error:P(null!=n?n:N),complete:r?P(r):S},o}return u(t,e),t}(R);function P(e,t){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{e.apply(void 0,d([],h(t)))}catch(e){T(e)}}}function N(e){throw e}var x={closed:!0,next:S,error:N,complete:S},D="function"==typeof Symbol&&Symbol.observable||"@@observable";function L(e){return e}function H(e){return 0===e.length?L:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var U=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=(r=e)&&r instanceof R||function(e){return e&&g(e.next)&&g(e.error)&&g(e.complete)}(r)&&C(r)?e:new A(e,t,n),o=this.operator,s=this.source;return i.add(o?o.call(i,s):s?this._subscribe(i):this._trySubscribe(i)),i},e.prototype._deprecatedSyncErrorSubscribe=function(e){var t=e;t._syncErrorHack_isSubscribing=!0;var n=this.operator;if(n)e.add(n.call(e,this.source));else try{e.add(this._subscribe(e))}catch(e){t.__syncError=e}for(var r=t;r;){if("__syncError"in r)try{throw r.__syncError}finally{e.unsubscribe()}r=r.destination}t._syncErrorHack_isSubscribing=!1},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=M(t))((function(t,r){var i;i=n.subscribe((function(t){try{e(t)}catch(e){r(e),null==i||i.unsubscribe()}}),r,t)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[D]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length?H(e)(this):this},e.prototype.toPromise=function(e){var t=this;return new(e=M(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function M(e){var t;return null!==(t=null!=e?e:I)&&void 0!==t?t:Promise}function j(e){return function(t){if(function(e){return g(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}var F=function(e){function t(t,n,r,i,o){var s=e.call(this,t)||this;return s.onFinalize=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return u(t,e),t.prototype.unsubscribe=function(){var t,n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))},t}(R),B=m((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),G=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return u(t,e),t.prototype.lift=function(e){var t=new Y(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new B},t.prototype.next=function(e){var t,n;if(this._throwIfClosed(),!this.isStopped){var r=this.observers.slice();try{for(var i=f(r),o=i.next();!o.done;o=i.next())o.value.next(e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}},t.prototype.error=function(e){if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=e;for(var t=this.observers;t.length;)t.shift().error(e)}},t.prototype.complete=function(){if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;for(var e=this.observers;e.length;)e.shift().complete()}},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=t.hasError,r=t.isStopped,i=t.observers;return n||r?_:(i.push(e),new E((function(){return w(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new U;return e.source=this,e},t.create=function(e,t){return new Y(e,t)},t}(U),Y=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return u(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:_},t}(G),V=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return u(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(G),W={now:function(){return(W.delegate||Date).now()},delegate:void 0},K=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=W);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return u(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,c=1;c<r.length&&r[c]<=s;c+=2)a=c;a&&r.splice(0,a+1)}},t}(G),q=function(e){function t(t,n){return e.call(this)||this}return u(t,e),t.prototype.schedule=function(e,t){return this},t}(E),z=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return u(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return setInterval.apply(void 0,d([],h(e)))}(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;!function(e){clearInterval(e)}(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=!!e&&e||new Error(e)}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,w(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(q),$=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=W.now,e}(),J=new(function(e){function t(t,n){void 0===n&&(n=$.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r._scheduled=void 0,r}return u(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}($))(z),X=J,Q=new U((function(e){return e.complete()}));function Z(e,t){return new U((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}var ee=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function te(e){return g(null==e?void 0:e.then)}var ne="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function re(e,t,n,r){void 0===r&&(r=0);var i=t.schedule((function(){try{n.call(this)}catch(t){e.error(t)}}),r);return e.add(i),i}function ie(e,t){if(!e)throw new Error("Iterable cannot be null");return new U((function(n){var r=new E;return r.add(t.schedule((function(){var i=e[Symbol.asyncIterator]();r.add(t.schedule((function(){var e=this;i.next().then((function(t){t.done?n.complete():(n.next(t.value),e.schedule())}))})))}))),r}))}function oe(e){return g(e[D])}function se(e){return g(null==e?void 0:e[ne])}function ae(e){return Symbol.asyncIterator&&g(null==e?void 0:e[Symbol.asyncIterator])}function ce(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ue(e){return v(this,arguments,(function(){var t,n,r;return l(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,p(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,p(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,p(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function le(e){return g(null==e?void 0:e.getReader)}function fe(e,t){return t?function(e,t){if(null!=e){if(oe(e))return function(e,t){return new U((function(n){var r=new E;return r.add(t.schedule((function(){var i=e[D]();r.add(i.subscribe({next:function(e){r.add(t.schedule((function(){return n.next(e)})))},error:function(e){r.add(t.schedule((function(){return n.error(e)})))},complete:function(){r.add(t.schedule((function(){return n.complete()})))}}))}))),r}))}(e,t);if(ee(e))return Z(e,t);if(te(e))return function(e,t){return new U((function(n){return t.schedule((function(){return e.then((function(e){n.add(t.schedule((function(){n.next(e),n.add(t.schedule((function(){return n.complete()})))})))}),(function(e){n.add(t.schedule((function(){return n.error(e)})))}))}))}))}(e,t);if(ae(e))return ie(e,t);if(se(e))return function(e,t){return new U((function(n){var r;return n.add(t.schedule((function(){r=e[ne](),re(n,t,(function(){var e=r.next(),t=e.value;e.done?n.complete():(n.next(t),this.schedule())}))}))),function(){return g(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(le(e))return function(e,t){return ie(ue(e),t)}(e,t)}throw ce(e)}(e,t):he(e)}function he(e){if(e instanceof U)return e;if(null!=e){if(oe(e))return r=e,new U((function(e){var t=r[D]();if(g(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ee(e))return de(e);if(te(e))return n=e,new U((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,T)}));if(ae(e))return pe(e);if(se(e))return t=e,new U((function(e){var n,r;try{for(var i=f(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()}));if(le(e))return pe(ue(e))}var t,n,r;throw ce(e)}function de(e){return new U((function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()}))}function pe(e){return new U((function(t){(function(e,t){var n,r,i,o;return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){var s,a;return l(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=y(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function ve(e,t){return t?Z(e,t):de(e)}function ye(e){return e&&g(e.schedule)}function ge(e){return e[e.length-1]}function me(e){return g(ge(e))?e.pop():void 0}function be(e){return ye(ge(e))?e.pop():void 0}function we(e,t){return"number"==typeof ge(e)?e.pop():t}function Ee(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=be(e);return n?Z(e,n):ve(e)}function _e(e,t){var n=g(e)?e:function(){return e},r=function(e){return e.error(n())};return new U(t?function(e){return t.schedule(r,0,e)}:r)}var Ce=m((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Oe(e,t){var n="object"==typeof t;return new Promise((function(r,i){var o,s=!1;e.subscribe({next:function(e){o=e,s=!0},error:i,complete:function(){s?r(o):n?r(t.defaultValue):i(new Ce)}})}))}function Ie(e,t){var n="object"==typeof t;return new Promise((function(r,i){var o=new A({next:function(e){r(e),o.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new Ce)}});e.subscribe(o)}))}function ke(e){return e instanceof Date&&!isNaN(e)}var Te=m((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function Se(e,t){var n=ke(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?Re:o,a=n.scheduler,c=void 0===a?null!=t?t:J:a,u=n.meta,l=void 0===u?null:u;if(null==r&&null==i)throw new TypeError("No timeout provided.");return j((function(e,t){var n,o,a=null,u=0,f=function(e){o=re(t,c,(function(){n.unsubscribe(),he(s({meta:l,lastValue:a,seen:u})).subscribe(t)}),e)};n=e.subscribe(new F(t,(function(e){null==o||o.unsubscribe(),u++,t.next(a=e),i>0&&f(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),a=null}))),f(null!=r?"number"==typeof r?r:+r-c.now():i)}))}function Re(e){throw new Te(e)}function Ae(e,t){return j((function(n,r){var i=0;n.subscribe(new F(r,(function(n){r.next(e.call(t,n,i++))})))}))}function Pe(e,t,n){return void 0===n&&(n=1/0),g(t)?Pe((function(n,r){return Ae((function(e,i){return t(n,e,r,i)}))(he(e(n,r)))}),n):("number"==typeof t&&(n=t),j((function(t,r){return function(e,t,n,r,i,o,s,a){var c=[],u=0,l=0,f=!1,h=function(){!f||c.length||u||t.complete()},d=function(e){return u<r?p(e):c.push(e)},p=function(e){u++;var i=!1;he(n(e,l++)).subscribe(new F(t,(function(e){t.next(e)}),(function(){i=!0}),void 0,(function(){if(i)try{u--;for(var e=function(){var e=c.shift();p(e)};c.length&&u<r;)e();h()}catch(e){t.error(e)}})))};return e.subscribe(new F(t,d,(function(){f=!0,h()}))),function(){}}(t,r,e,n)})))}function Ne(e){return void 0===e&&(e=1/0),Pe(L,e)}function xe(){return Ne(1)}function De(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe()(ve(e,be(e)))}function Le(e){return new U((function(t){he(e()).subscribe(t)}))}function He(e,t,n){void 0===e&&(e=0),void 0===n&&(n=X);var r=-1;return null!=t&&(ye(t)?n=t:r=t),new U((function(t){var i=ke(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule((function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())}),i)}))}function Ue(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=be(e),r=we(e,1/0),i=e;return i.length?1===i.length?he(i[0]):Ne(r)(ve(i,n)):Q}var Me,je,Fe,Be,Ge,Ye,Ve=new U(S),We=Array.isArray;function Ke(e){return 1===e.length&&We(e[0])?e[0]:e}function qe(e,t){return function(n,r){return!e.call(t,n,r)}}function ze(e,t){return j((function(n,r){var i=0;n.subscribe(new F(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function $e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===(e=Ke(e)).length?he(e[0]):new U(Je(e))}function Je(e){return function(t){for(var n=[],r=function(r){n.push(he(e[r]).subscribe(new F(t,(function(e){if(n){for(var i=0;i<n.length;i++)i!==r&&n[i].unsubscribe();n=null}t.next(e)}))))},i=0;n&&!t.closed&&i<e.length;i++)r(i)}}function Xe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=me(e),r=Ke(e);return r.length?new U((function(e){var t=r.map((function(){return[]})),i=r.map((function(){return!1}));e.add((function(){t=i=null}));for(var o=function(o){he(r[o]).subscribe(new F(e,(function(r){if(t[o].push(r),t.every((function(e){return e.length}))){var s=t.map((function(e){return e.shift()}));e.next(n?n.apply(void 0,d([],h(s))):s),t.some((function(e,t){return!e.length&&i[t]}))&&e.complete()}}),(function(){i[o]=!0,!t[o].length&&e.complete()})))},s=0;!e.closed&&s<r.length;s++)o(s);return function(){t=i=null}})):Q}function Qe(e){return j((function(t,n){var r,i=null,o=!1;i=t.subscribe(new F(n,void 0,void 0,(function(s){r=he(e(s,Qe(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):o=!0}))),o&&(i.unsubscribe(),i=null,r.subscribe(n))}))}function Ze(e,t){return g(t)?Pe(e,t,1):Pe(e,1)}function et(e){return j((function(t,n){var r=!1;t.subscribe(new F(n,(function(e){r=!0,n.next(e)}),(function(){r||n.next(e),n.complete()})))}))}function tt(e){return e<=0?function(){return Q}:j((function(t,n){var r=0;t.subscribe(new F(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function nt(e){return void 0===e&&(e=rt),j((function(t,n){var r=!1;t.subscribe(new F(n,(function(e){r=!0,n.next(e)}),(function(){return r?n.complete():n.error(e())})))}))}function rt(){return new Ce}function it(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?ze((function(t,n){return e(t,n,r)})):L,tt(1),n?et(t):nt((function(){return new Ce})))}}function ot(e){return e<=0?function(){return Q}:j((function(t,n){var r=[];t.subscribe(new F(n,(function(t){r.push(t),e<r.length&&r.shift()}),(function(){var e,t;try{for(var i=f(r),o=i.next();!o.done;o=i.next()){var s=o.value;n.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}n.complete()}),void 0,(function(){r=null})))}))}function st(e){return j((function(t,n){var r,i,o=!1,s=function(){r=t.subscribe(new F(n,void 0,void 0,(function(t){i||(i=new G,e(i).subscribe(new F(n,(function(){return r?s():o=!0})))),i&&i.next(t)}))),o&&(r.unsubscribe(),r=null,o=!1,s())};s()}))}function at(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new G}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t=null,r=null,o=null,a=0,u=!1,l=!1,f=function(){null==r||r.unsubscribe(),r=null},h=function(){f(),t=o=null,u=l=!1},d=function(){var e=t;h(),null==e||e.unsubscribe()};return j((function(e,p){a++,l||u||f();var v=o=null!=o?o:n();p.add((function(){0!=--a||l||u||(r=ct(d,c))})),v.subscribe(p),t||(t=new A({next:function(e){return v.next(e)},error:function(e){l=!0,f(),r=ct(h,i,e),v.error(e)},complete:function(){u=!0,f(),r=ct(h,s),v.complete()}}),fe(e).subscribe(t))}))(e)}}function ct(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return!0===t?(e(),null):!1===t?null:t.apply(void 0,d([],h(n))).pipe(tt(1)).subscribe((function(){return e()}))}function ut(e,t,n){var r,i,o,s=!1;return e&&"object"==typeof e?(o=null!==(r=e.bufferSize)&&void 0!==r?r:1/0,t=null!==(i=e.windowTime)&&void 0!==i?i:1/0,s=!!e.refCount,n=e.scheduler):o=null!=e?e:1/0,at({connector:function(){return new K(o,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}function lt(e){return ze((function(t,n){return e<=n}))}function ft(e,t){return j((function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(new F(r,(function(n){null==i||i.unsubscribe();var s=0,c=o++;he(e(n,c)).subscribe(i=new F(r,(function(e){return r.next(t?t(n,e,c,s++):e)}),(function(){i=null,a()})))}),(function(){s=!0,a()})))}))}function ht(){return ft(L)}function dt(e){return j((function(t,n){he(e).subscribe(new F(n,(function(){return n.complete()}),S)),!n.closed&&t.subscribe(n)}))}function pt(e,t,n){var r=g(e)||t||n?{next:e,error:t,complete:n}:e;return r?j((function(e,t){e.subscribe(new F(t,(function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)}),(function(){var e;null===(e=r.complete)||void 0===e||e.call(r),t.complete()}),(function(e){var n;null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)})))})):L}class vt extends Error{constructor(e,t){super(e),this.type=t,this.type=t,Object.setPrototypeOf(this,new.target.prototype)}}function yt(e,t,n=Me.ERROR,r=je.JS_LIB){t?null==t||t.write({level:n,layer:r,message:e}):t||n!==Me.ERROR||console.error(e)}function gt(e){return void 0!==e}!function(e){e.ERROR="error",e.WARNING="warning",e.INFO="info"}(Me||(Me={})),function(e){e.CHROME_EXTENSION="chrome-extension",e.NATIVE_CONSOLE="native-console",e.JS_LIB="js-lib"}(je||(je={})),function(e){e.SDK_USAGE_ERROR="sdk-usage-error",e.FEATURE_NOT_SUPPORTED="feature-not-supported",e.DEVICE_ERROR="device-error",e.UNEXPECTED_ERROR="unexpected-error",e.INIT_ERROR="init-error"}(Fe||(Fe={}));class mt{constructor(e,t){this.compare=t,this.remove=new G,this.itemRemoved=this.remove,this.items=new V([]),this.itemList=this.items,this.itemAdded=e.pipe(Ae(e=>(this.addItem(e),e)),at()),this.itemAdded.subscribe({next:e=>{e.onDisconnect.pipe(it(),Ae(()=>this.removeItem(e.id)),ze(gt)).subscribe(e=>this.remove.next(e))},error:S}),this.itemRemoved.subscribe({error:S})}getValue(){return[...this.items.getValue()]}addItem(e){if(this.items.getValue().filter(t=>t.id.equals(e.id)).length>0)throw new vt("This item has already been added.",Fe.UNEXPECTED_ERROR);const t=this.items.getValue().concat([e]);t.sort(this.compare),this.items.next(t)}removeItem(e){const t=this.getValue(),n=t.findIndex(t=>t.id.equals(e));if(-1===n)throw new vt("Item not found and therefore cannot be removed.",Fe.UNEXPECTED_ERROR);const r=t.splice(n,1)[0];return this.items.next(t),r}}class bt{constructor(t,n){this.sdkVersion="4.1.2",this.consoleAppVersion=t.pipe(it(e=>"ready"===e.event),Ae(e=>e.version),Se(1e3),ut(1),Qe(()=>Ee(null))),this.chromeExtensionVersion=t.pipe(it(e=>"chrome-extension-ready"===e.event),Ae(e=>e.version),Se(1e3),ut(1),Qe(()=>Ee(null))),Xe(this.consoleAppVersion,this.chromeExtensionVersion).subscribe(t=>{const r=`sdkVersion: ${this.sdkVersion} | chromeHostVersion: ${t[0]}`;let i;i=void 0!==e?`${r} | nodeVersion: ${e.version} | platform: ${e.platform}`:`${r} | chromeExtensionVersion: ${t[1]} | browserUserAgent: ${window.navigator.userAgent}`,yt(i,n,Me.INFO)})}}class wt{constructor(e,t,n){this.deviceDetector=e,this.deviceAdded=this.deviceDetector.deviceObservables.itemAdded,this.deviceRemoved=this.deviceDetector.deviceObservables.itemRemoved,this.deviceList=this.deviceDetector.deviceObservables.itemList,Be.set(this,void 0),this._transport=t,this._readyEvents=t.consoleAppEvent.pipe(ze(e=>"ready"===e.event||"chrome-extension-ready"===e.event),ut(2)),this._readyEvents.subscribe(),this._config=n,this.transportContext=t.context,a(this,Be,new bt(this._readyEvents,null==n?void 0:n.logger),"f")}getVersion(){return s(this,Be,"f").sdkVersion}getChromehostVersion(){return Ie(s(this,Be,"f").consoleAppVersion)}getChromeExtensionVersion(){return Ie(s(this,Be,"f").chromeExtensionVersion)}}Be=new WeakMap,function(e){e.NODE="node",e.CHROME_EXTENSION="chrome-extension",e.WEB_HID="web-hid"}(Ge||(Ge={})),function(e){e.CHROME_EXTENSION="chrome-extension",e.WEB_HID="web-hid",e.CHROME_EXTENSION_WITH_WEB_HID_FALLBACK="chrome-extension-with-web-hid-fallback"}(Ye||(Ye={}));const Et="Failed to dynamically import file. Please contact a Jabra representative as we would love to learn about scenarios where this could happen!";function _t(e,t=Ye.CHROME_EXTENSION,r){return o(this,void 0,void 0,(function*(){if(t!==Ye.WEB_HID){const i=yield n.e(1).then(n.bind(null,18)).catch(()=>{throw new vt(Et,Fe.UNEXPECTED_ERROR)}),o=yield i.TransportChromeExtension.checkInstallation();if(o.ok)return yt("Using Chrome extension for transport.",e,Me.INFO),new i.TransportChromeExtension(e,r);if(t===Ye.CHROME_EXTENSION)throw new vt(o.message,Fe.INIT_ERROR);t===Ye.CHROME_EXTENSION_WITH_WEB_HID_FALLBACK&&yt(o.message,e,Me.INFO)}return yt("Using WebHID for transport.",e,Me.INFO),function(e,t){return o(this,void 0,void 0,(function*(){const r=yield n.e(2).then(n.bind(null,19)).catch(()=>{throw new vt(Et,Fe.UNEXPECTED_ERROR)}),i=yield n.e(3).then(n.bind(null,20)).catch(()=>{throw new vt(Et,Fe.UNEXPECTED_ERROR)}),o=r.initHandler(e);return new i.WebHidTransport(o,e,t)}))}(e,r)}))}class Ct{constructor(e,t){this.log=e.consoleAppEvent.pipe(ze(e=>"log"===e.event),Ae(e=>({message:e.message,level:e.level,layer:e.layer}))),this.log.subscribe(e=>yt(e.message,t,e.level,e.layer))}}const Ot=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];class It{constructor(e){this.config=e,this.messageShown=!1}validateOrganizationKey(){var e;(null===(e=this.config)||void 0===e?void 0:e.partnerKey)?this.validateCrc(this.config.partnerKey)||this.logWarning("Invalid partner key."):this.logWarning("No partner key provided.")}validateAppId(){var e;(null===(e=this.config)||void 0===e?void 0:e.appId)?this.config.appId.length<3?this.logWarning("The appId should be minimum 3 characters.",!1):this.config.appId.length>100?this.logWarning("The appId should be no longer than 100 characters.",!1):/^[A-Za-z0-9\-_]+$/.test(this.config.appId)||this.logWarning("The appId is invalid. Should consist of letters, numbers, underscores or dashes",!1):this.logWarning("No app identifier provided.")}validateAppName(){var e;(null===(e=this.config)||void 0===e?void 0:e.appName)?/^[\x20-\x7F]*$/.test(this.config.appName)?this.config.appName.length>100?this.logWarning("The app name should be no longer than 100 characters.",!1):/^[A-Za-z0-9]+[A-Za-z0-9 &-]*$/g.test(this.config.appName)||this.logWarning("The appName is invalid. Name should consist of letters, numbers, spaces, ampersands and dashes. Name should not begin with spaces, ampersands or dashes.",!1):this.logWarning("The app name can only contain ASCII characters",!1):this.logWarning("No app name provided. Will fallback to use appId as name.",!1)}logWarning(e,t=!0){this.messageShown||(this.messageShown=!0,t?console.warn(`\n ${e}\n \n Add keys to the config object on initialization.\n E.g. await init({\n partnerKey: 'my-partner-key-from-developer-zone',\n appId: 'my-self-chosen-app-id',\n appName: 'My App Name'\n });\n\n Please obtain a valid partner key from https://developer.jabra.com.\n The key will ensure interoperability with other Jabra apps and services, and mitigate\n some co-existence issues with other softphone applications.\n\n The package will continue to work without the keys, but we do not recommend production release\n without it. Read more on the Developer Zone.\n \n `):console.warn(e))}validateCrc(e){const[t,...n]=e.split("-"),r=function(e){let t,n,r=65535;for(n=0;n<e.length;n+=1){const i=e.charCodeAt(n);if(i>255)throw new RangeError;t=255&(i^r>>8),r=Ot[t]^r<<8}return 65535&(0^r)}(n.join("-")).toString(16).padStart(4,"0");return t===r}}var kt,Tt,St,Rt,At,Pt,Nt;!function(e){e[e.MS_OC=0]="MS_OC",e[e.CISCO=1]="CISCO",e[e.AVAYA=2]="AVAYA",e[e.SIEMENS=3]="SIEMENS",e[e.ALCATEL=4]="ALCATEL",e[e.IBM=5]="IBM",e[e.AASTRA=6]="AASTRA",e[e.SKYPE=7]="SKYPE",e[e.GENERIC=8]="GENERIC",e[e.NORTEL=9]="NORTEL",e[e.JABRA=10]="JABRA",e[e.NEC=11]="NEC",e[e.SHORETEL=12]="SHORETEL",e[e.OTHER=255]="OTHER"}(kt||(kt={}));class xt{constructor(e,t){this.gnpReadCommand=e,this.serialize=t,this.command=e.command,this.subCommand=e.subCommand}deserialize(e){return this.gnpReadCommand.deserialize(e)}}!function(e){e[e.GN_PROTOCOL=65280]="GN_PROTOCOL"}(Tt||(Tt={})),function(e){e[e.DATA=1]="DATA"}(St||(St={}));class Dt{constructor(e,t,n,r,i,o=new Uint8Array,s=0){this.destination=e,this.source=t,this.type=n,this.command=r,this.subCommand=i,this.payload=o,this.sequenceNumber=s}}!function(e){e[e.PC_ADDR=0]="PC_ADDR",e[e.BASE_ADDR=1]="BASE_ADDR",e[e.HS1_ADDR=4]="HS1_ADDR",e[e.HS_BT_USB_ADDR=8]="HS_BT_USB_ADDR",e[e.HS_CRADLE_ADDR=10]="HS_CRADLE_ADDR",e[e.CRADLE_ADDR=21]="CRADLE_ADDR"}(Rt||(Rt={})),function(e){e[e.EVENT=0]="EVENT",e[e.READ=1]="READ",e[e.WRITE=2]="WRITE",e[e.REPLY=3]="REPLY"}(At||(At={})),function(e){e[e.IDENT=2]="IDENT",e[e.DFU=7]="DFU",e[e.DEVICE=13]="DEVICE",e[e.FWU=15]="FWU",e[e.STATUS=18]="STATUS",e[e.CONFIG=19]="CONFIG",e[e.NACK=254]="NACK",e[e.ACK=255]="ACK"}(Pt||(Pt={})),function(e){e[e.CONFIG_PREFERRED_SOFTPHONE=34]="CONFIG_PREFERRED_SOFTPHONE",e[e.ID=1]="ID",e[e.IDENT_GET_AVAILABLE_SOFTPHONES=16]="IDENT_GET_AVAILABLE_SOFTPHONES",e[e.TYPE=2]="TYPE",e[e.NAME=0]="NAME",e[e.PID=17]="PID",e[e.ATTACH_EVENT=1]="ATTACH_EVENT",e[e.DETACH_EVENT=2]="DETACH_EVENT"}(Nt||(Nt={}));const Lt={command:Pt.DEVICE,subCommand:Nt.ATTACH_EVENT,serialize:e=>Uint8Array.from([5,0])};function Ht(e){const t=e.payload,n=t[0],r=t.length-1;if(r!==n)throw new vt(`Invalid response. Expected length: ${n}, actual: ${r}`,Fe.DEVICE_ERROR);const i=t.slice(1);return String.fromCharCode(...Array.from(i))}class Ut{constructor(){this.command=Pt.IDENT,this.subCommand=Nt.IDENT_GET_AVAILABLE_SOFTPHONES,this.deserialize=(e=>e,e=>{const t=e.payload,n=t[0],r=t.length-1;if(r!==n)throw new vt(`Invalid response. Expected length: ${n}, actual: ${r}`,Fe.DEVICE_ERROR);const i=[];return t.slice(1).forEach(e=>{i.push(e)}),i})}}const Mt={command:Pt.IDENT,subCommand:Nt.NAME,deserialize:Ht},jt={command:Pt.IDENT,subCommand:Nt.PID,deserialize:function(e){const t=e instanceof Dt?e.payload:e;return new DataView(t.buffer).getUint16(0,!0)}};class Ft{constructor(){this.command=Pt.CONFIG,this.subCommand=Nt.CONFIG_PREFERRED_SOFTPHONE,this.deserialize=e=>e.payload[0],this.serialize=e=>Uint8Array.of(e)}}class Bt{constructor(){this.command=Pt.IDENT,this.subCommand=Nt.TYPE,this.deserialize=e=>e.source}}const Gt={command:Pt.IDENT,subCommand:Nt.ID,deserialize:Ht};function Yt(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r||"undefined"!=typeof self&&self;var Vt,Wt,Kt=Yt((function(e){
31
31
  /*!
32
32
  ** Pure-UUID -- Pure JavaScript Based Universally Unique Identifier (UUID)
33
33
  ** Copyright (c) 2004-2020 Dr. Ralf S. Engelschall <rse@engelschall.com>
@@ -51,29 +51,14 @@ PERFORMANCE OF THIS SOFTWARE.
51
51
  ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
52
52
  ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
53
53
  */
54
- e.exports=function(){var e=function(e,t,n,r,i,o){for(var s=function(e,t){var n=e.toString(16);return n.length<2&&(n="0"+n),t&&(n=n.toUpperCase()),n},a=t;a<=n;a++)i[o++]=s(e[a],r);return i},t=function(e,t,n,r,i){for(var o=t;o<=n;o+=2)r[i++]=parseInt(e.substr(o,2),16)},n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#".split(""),r=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,77,0,78,67,0,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,79,0,80,0,0],o=function(e,t){if(t%4!=0)throw new Error("z85_encode: invalid input length (multiple of 4 expected)");for(var r="",i=0,o=0;i<t;)if(o=256*o+e[i++],i%4==0){for(var s=52200625;s>=1;){var a=Math.floor(o/s)%85;r+=n[a],s/=85}o=0}return r},s=function(e,t){var n=e.length;if(n%5!=0)throw new Error("z85_decode: invalid input length (multiple of 5 expected)");void 0===t&&(t=new Array(4*n/5));for(var i=0,o=0,s=0;i<n;){var a=e.charCodeAt(i++)-32;if(a<0||a>=r.length)break;if(s=85*s+r[a],i%5==0){for(var c=16777216;c>=1;)t[o++]=Math.trunc(s/c%256),c/=256;s=0}}return t},a=function(e,t){var n={ibits:8,obits:8,obigendian:!0};for(var r in t)void 0!==n[r]&&(n[r]=t[r]);for(var i,o,s,a=[],c=0,u=0,l=0,f=e.length;0===u&&(o=e.charCodeAt(c++)),i=o>>n.ibits-(u+8)&255,u=(u+8)%n.ibits,n.obigendian?0===l?s=i<<n.obits-8:s|=i<<n.obits-8-l:0===l?s=i:s|=i<<l,!(0==(l=(l+8)%n.obits)&&(a.push(s),c>=f)););return a},c=function(e,t){var n={ibits:32,ibigendian:!0};for(var r in t)void 0!==n[r]&&(n[r]=t[r]);var i="",o=4294967295;n.ibits<32&&(o=(1<<n.ibits)-1);for(var s=e.length,a=0;a<s;a++)for(var c=e[a]&o,u=0;u<n.ibits;u+=8)n.ibigendian?i+=String.fromCharCode(c>>n.ibits-8-u&255):i+=String.fromCharCode(c>>u&255);return i},u=256,l=function(e,t,n,r,i,o,s,a){return[a,s,o,i,r,n,t,e]},f=function(){return l(0,0,0,0,0,0,0,0)},h=function(e){return e.slice(0)},d=function(e){for(var t=f(),n=0;n<8;n++)t[n]=Math.floor(e%u),e/=u;return t},p=function(e){for(var t=0,n=7;n>=0;n--)t*=u,t+=e[n];return Math.floor(t)},v=function(e,t){for(var n=0,r=0;r<8;r++)n+=e[r]+t[r],e[r]=Math.floor(n%u),n=Math.floor(n/u);return n},g=function(e,t){for(var n=0,r=0;r<8;r++)n+=e[r]*t,e[r]=Math.floor(n%u),n=Math.floor(n/u);return n},y=function(e,t){for(var n=0;n<8;n++)e[n]&=t[n];return e},m=function(e,t){var n=f();if(t%8!=0)throw new Error("ui64_rorn: only bit rotations supported with a multiple of digit bits");for(var r=Math.floor(t/8),i=0;i<r;i++){for(var o=6;o>=0;o--)n[o+1]=n[o];for(n[0]=e[0],o=0;o<7;o++)e[o]=e[o+1];e[o]=0}return p(n)},b=function(e,t){if(t>64)throw new Error("ui64_ror: invalid number of bits to shift");var n,r=new Array(16);for(n=0;n<8;n++)r[n+8]=e[n],r[n]=0;var i=Math.floor(t/8),o=t%8;for(n=i;n<15;n++)r[n-i]=255&(r[n]>>>o|r[n+1]<<8-o);for(r[15-i]=r[15]>>>o&255,n=15-i+1;n<16;n++)r[n]=0;for(n=0;n<8;n++)e[n]=r[n+8];return r.slice(0,8)},E=function(e,t){for(var n=0;n<8;n++)e[n]^=t[n]},w=function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},_=function(e,t){return e<<t&4294967295|e>>>32-t&4294967295},C=function(e){return c(function(e,t){function n(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function r(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var i=Array(80),o=1732584193,s=-271733879,a=-1732584194,c=271733878,u=-1009589776,l=0;l<e.length;l+=16){for(var f=o,h=s,d=a,p=c,v=u,g=0;g<80;g++){i[g]=g<16?e[l+g]:_(i[g-3]^i[g-8]^i[g-14]^i[g-16],1);var y=w(w(_(o,5),n(g,s,a,c)),w(w(u,i[g]),r(g)));u=c,c=a,a=_(s,30),s=o,o=y}o=w(o,f),s=w(s,h),a=w(a,d),c=w(c,p),u=w(u,v)}return[o,s,a,c,u]}(a(e,{ibits:8,obits:32,obigendian:!0}),8*e.length),{ibits:32,ibigendian:!0})},O=function(e){return c(function(e,t){function n(e,t,n,r,i,o){return w(_(w(w(t,e),w(r,o)),i),n)}function r(e,t,r,i,o,s,a){return n(t&r|~t&i,e,t,o,s,a)}function i(e,t,r,i,o,s,a){return n(t&i|r&~i,e,t,o,s,a)}function o(e,t,r,i,o,s,a){return n(t^r^i,e,t,o,s,a)}function s(e,t,r,i,o,s,a){return n(r^(t|~i),e,t,o,s,a)}e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var a=1732584193,c=-271733879,u=-1732584194,l=271733878,f=0;f<e.length;f+=16){var h=a,d=c,p=u,v=l;a=r(a,c,u,l,e[f+0],7,-680876936),l=r(l,a,c,u,e[f+1],12,-389564586),u=r(u,l,a,c,e[f+2],17,606105819),c=r(c,u,l,a,e[f+3],22,-1044525330),a=r(a,c,u,l,e[f+4],7,-176418897),l=r(l,a,c,u,e[f+5],12,1200080426),u=r(u,l,a,c,e[f+6],17,-1473231341),c=r(c,u,l,a,e[f+7],22,-45705983),a=r(a,c,u,l,e[f+8],7,1770035416),l=r(l,a,c,u,e[f+9],12,-1958414417),u=r(u,l,a,c,e[f+10],17,-42063),c=r(c,u,l,a,e[f+11],22,-1990404162),a=r(a,c,u,l,e[f+12],7,1804603682),l=r(l,a,c,u,e[f+13],12,-40341101),u=r(u,l,a,c,e[f+14],17,-1502002290),a=i(a,c=r(c,u,l,a,e[f+15],22,1236535329),u,l,e[f+1],5,-165796510),l=i(l,a,c,u,e[f+6],9,-1069501632),u=i(u,l,a,c,e[f+11],14,643717713),c=i(c,u,l,a,e[f+0],20,-373897302),a=i(a,c,u,l,e[f+5],5,-701558691),l=i(l,a,c,u,e[f+10],9,38016083),u=i(u,l,a,c,e[f+15],14,-660478335),c=i(c,u,l,a,e[f+4],20,-405537848),a=i(a,c,u,l,e[f+9],5,568446438),l=i(l,a,c,u,e[f+14],9,-1019803690),u=i(u,l,a,c,e[f+3],14,-187363961),c=i(c,u,l,a,e[f+8],20,1163531501),a=i(a,c,u,l,e[f+13],5,-1444681467),l=i(l,a,c,u,e[f+2],9,-51403784),u=i(u,l,a,c,e[f+7],14,1735328473),a=o(a,c=i(c,u,l,a,e[f+12],20,-1926607734),u,l,e[f+5],4,-378558),l=o(l,a,c,u,e[f+8],11,-2022574463),u=o(u,l,a,c,e[f+11],16,1839030562),c=o(c,u,l,a,e[f+14],23,-35309556),a=o(a,c,u,l,e[f+1],4,-1530992060),l=o(l,a,c,u,e[f+4],11,1272893353),u=o(u,l,a,c,e[f+7],16,-155497632),c=o(c,u,l,a,e[f+10],23,-1094730640),a=o(a,c,u,l,e[f+13],4,681279174),l=o(l,a,c,u,e[f+0],11,-358537222),u=o(u,l,a,c,e[f+3],16,-722521979),c=o(c,u,l,a,e[f+6],23,76029189),a=o(a,c,u,l,e[f+9],4,-640364487),l=o(l,a,c,u,e[f+12],11,-421815835),u=o(u,l,a,c,e[f+15],16,530742520),a=s(a,c=o(c,u,l,a,e[f+2],23,-995338651),u,l,e[f+0],6,-198630844),l=s(l,a,c,u,e[f+7],10,1126891415),u=s(u,l,a,c,e[f+14],15,-1416354905),c=s(c,u,l,a,e[f+5],21,-57434055),a=s(a,c,u,l,e[f+12],6,1700485571),l=s(l,a,c,u,e[f+3],10,-1894986606),u=s(u,l,a,c,e[f+10],15,-1051523),c=s(c,u,l,a,e[f+1],21,-2054922799),a=s(a,c,u,l,e[f+8],6,1873313359),l=s(l,a,c,u,e[f+15],10,-30611744),u=s(u,l,a,c,e[f+6],15,-1560198380),c=s(c,u,l,a,e[f+13],21,1309151649),a=s(a,c,u,l,e[f+4],6,-145523070),l=s(l,a,c,u,e[f+11],10,-1120210379),u=s(u,l,a,c,e[f+2],15,718787259),c=s(c,u,l,a,e[f+9],21,-343485551),a=w(a,h),c=w(c,d),u=w(u,p),l=w(l,v)}return[a,c,u,l]}(a(e,{ibits:8,obits:32,obigendian:!1}),8*e.length),{ibits:32,ibigendian:!1})},T=function(e){this.mul=l(88,81,244,45,76,149,127,45),this.inc=l(20,5,123,126,247,103,129,79),this.mask=l(0,0,0,0,255,255,255,255),this.state=h(this.inc),this.next(),y(this.state,this.mask),e=d(void 0!==e?e>>>0:4294967295*Math.random()>>>0),function(e,t){for(var n=0;n<8;n++)e[n]|=t[n]}(this.state,e),this.next()};T.prototype.next=function(){var e=h(this.state);(function(e,t){var n,r,i,o=new Array(16);for(n=0;n<16;n++)o[n]=0;for(n=0;n<8;n++){for(i=0,r=0;r<8;r++)i+=e[n]*t[r]+o[n+r],o[n+r]=i%u,i/=u;for(;r<16-n;r++)i+=o[n+r],o[n+r]=i%u,i/=u}for(n=0;n<8;n++)e[n]=o[n];o.slice(8,8)})(this.state,this.mul),v(this.state,this.inc);var t=h(e);b(t,18),E(t,e),b(t,27);var n=h(e);b(n,59),y(t,this.mask);var r=p(n),i=h(t);return function(e,t){if(t>64)throw new Error("ui64_rol: invalid number of bits to shift");var n,r=new Array(16);for(n=0;n<8;n++)r[n+8]=0,r[n]=e[n];var i=Math.floor(t/8),o=t%8;for(n=7-i;n>0;n--)r[n+i]=255&(r[n]<<o|r[n-1]>>>8-o);for(r[0+i]=r[0]<<o&255,n=0+i-1;n>=0;n--)r[n]=0;for(n=0;n<8;n++)e[n]=r[n];r.slice(8,8)}(i,32-r),b(t,r),E(t,i),p(t)};var k=new T,I=function(e,t){for(var n=[],r=0;r<e;r++)n[r]=k.next()%t;return n},R=0,A=0,S=function(){if(1===arguments.length&&"string"==typeof arguments[0])this.parse.apply(this,arguments);else if(arguments.length>=1&&"number"==typeof arguments[0])this.make.apply(this,arguments);else{if(arguments.length>=1)throw new Error("UUID: constructor: invalid arguments");for(var e=0;e<16;e++)this[e]=0}};return(S.prototype="undefined"!=typeof Uint8Array?new Uint8Array(16):i?i.alloc(16):new Array(16)).constructor=S,S.prototype.make=function(e){var t,n=this;if(1===e){var r=(new Date).getTime();r!==R?A=0:A++,R=r;var i,o=d(r);g(o,1e4),v(o,l(1,178,29,210,19,129,64,0)),A>0&&v(o,d(A)),i=m(o,8),n[3]=255&i,i=m(o,8),n[2]=255&i,i=m(o,8),n[1]=255&i,i=m(o,8),n[0]=255&i,i=m(o,8),n[5]=255&i,i=m(o,8),n[4]=255&i,i=m(o,8),n[7]=255&i,i=m(o,8),n[6]=15&i;var s=I(2,255);n[8]=s[0],n[9]=s[1];var a=I(6,255);for(a[0]|=1,a[0]|=2,t=0;t<6;t++)n[10+t]=a[t]}else if(4===e){var c=I(16,255);for(t=0;t<16;t++)this[t]=c[t]}else{if(3!==e&&5!==e)throw new Error("UUID: make: invalid version");var u="",f="object"==typeof arguments[1]&&arguments[1]instanceof S?arguments[1]:(new S).parse(arguments[1]);for(t=0;t<16;t++)u+=String.fromCharCode(f[t]);u+=arguments[2];var h=3===e?O(u):C(u);for(t=0;t<16;t++)n[t]=h.charCodeAt(t)}return n[6]&=15,n[6]|=e<<4,n[8]&=63,n[8]|=128,n},S.prototype.format=function(t){var n,r;return"z85"===t?n=o(this,16):"b16"===t?(r=Array(32),e(this,0,15,!0,r,0),n=r.join("")):void 0!==t&&"std"!==t||(r=new Array(36),e(this,0,3,!1,r,0),r[8]="-",e(this,4,5,!1,r,9),r[13]="-",e(this,6,7,!1,r,14),r[18]="-",e(this,8,9,!1,r,19),r[23]="-",e(this,10,15,!1,r,24),n=r.join("")),n},S.prototype.toString=function(e){return this.format(e)},S.prototype.toJSON=function(){return this.format("std")},S.prototype.parse=function(e,n){if("string"!=typeof e)throw new Error("UUID: parse: invalid argument (type string expected)");if("z85"===n)s(e,this);else if("b16"===n)t(e,0,35,this,0);else if(void 0===n||"std"===n){var r={nil:"00000000-0000-0000-0000-000000000000","ns:DNS":"6ba7b810-9dad-11d1-80b4-00c04fd430c8","ns:URL":"6ba7b811-9dad-11d1-80b4-00c04fd430c8","ns:OID":"6ba7b812-9dad-11d1-80b4-00c04fd430c8","ns:X500":"6ba7b814-9dad-11d1-80b4-00c04fd430c8"};if(void 0!==r[e])e=r[e];else if(!e.match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/))throw new Error('UUID: parse: invalid string representation (expected "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")');t(e,0,7,this,0),t(e,9,12,this,4),t(e,14,17,this,6),t(e,19,22,this,8),t(e,24,35,this,10)}return this},S.prototype.export=function(){for(var e=Array(16),t=0;t<16;t++)e[t]=this[t];return e},S.prototype.import=function(e){if(!("object"==typeof e&&e instanceof Array))throw new Error("UUID: import: invalid argument (type Array expected)");if(16!==e.length)throw new Error("UUID: import: invalid argument (Array of length 16 expected)");for(var t=0;t<16;t++){if("number"!=typeof e[t])throw new Error("UUID: import: invalid array element #"+t+" (type Number expected)");if(!isFinite(e[t])||Math.floor(e[t])!==e[t])throw new Error("UUID: import: invalid array element #"+t+" (Number with integer value expected)");if(!(e[t]>=0&&e[t]<=255))throw new Error("UUID: import: invalid array element #"+t+" (Number with integer value in range 0...255 expected)");this[t]=e[t]}return this},S.prototype.compare=function(e){if("object"!=typeof e)throw new Error("UUID: compare: invalid argument (type UUID expected)");if(!(e instanceof S))throw new Error("UUID: compare: invalid argument (type UUID expected)");for(var t=0;t<16;t++){if(this[t]<e[t])return-1;if(this[t]>e[t])return 1}return 0},S.prototype.equal=function(e){return 0===this.compare(e)},S.prototype.fold=function(e){if(void 0===e)throw new Error("UUID: fold: invalid argument (number of fold operations expected)");if(e<1||e>4)throw new Error("UUID: fold: invalid argument (1-4 fold operations expected)");for(var t=16/Math.pow(2,e),n=new Array(t),r=0;r<t;r++){for(var i=0,o=0;r+o<16;o+=t)i^=this[r+o];n[r]=i}return n},S.PCG=T,S}(),e.exports.default=e.exports}));class Wt{constructor(e){this.transport=e,this.gnpLockAcquired=e.consoleAppEvent.pipe(qe(e=>"response-gnp-lock"===e.event),Ae(e=>e.token),ct(1)),this.gnpLockAcquired.subscribe()}acquireGnpLock(e){const t=new Vt(4).toString(),n={action:"request-gnp-lock",id:e,token:t},r=this.gnpLockAcquired.pipe(rt(e=>e===t));return this.transport.writeAction(n),r}releaseGnpLock(e,t){const n={action:"release-gnp-lock",id:e,token:t};this.transport.writeAction(n)}}!function(e){e[e.INPUT=0]="INPUT",e[e.OUTPUT=1]="OUTPUT",e[e.FEATURE=2]="FEATURE"}(Gt||(Gt={})),function(e){e.ABSOLUTE="absolute",e.RELATIVE="relative"}(Yt||(Yt={}));class Kt{constructor(e){this.id=e}equals(e){return this.id===e.id}startsWith(e){return this.id.startsWith(e.id)}toString(){return this.id}}function qt(e,t,n){const r=e.toString(16).padStart(4,"0"),i=t.toString(16).padStart(4,"0");return new Kt(`${r}:${i}:${n}`)}class zt{constructor(e,t,n,r){this.id=e,this.usagePage=t,this.usage=n,this.value=r}isArray(){return Array.isArray(this.value)}static deserialize(e,t){return new zt(new Kt(e),t.usagePage,t.usage,t.value)}}class $t{constructor(e,t,n){this.descriptor=t,this.transport=n,this.transportId=e.transportId,this.input=n.consoleAppEvent.pipe(qe(e=>e.id===this.transportId),$t.inputReportsFilter)}output(e,t,n){const r={action:"hid-output",id:this.transportId,usagePage:e,usage:t,value:n};this.transport.writeAction(r)}getFeatureReport(e,t){const n=new Vt(4).toString(),r={action:"request-hid-feature",id:this.transportId,token:n,usagePage:e,usage:t};return this.transport.writeAction(r),this.transport.consoleAppEvent.pipe(rt(e=>"response-hid-feature"===e.event&&e.token===n),Ae(e=>e.value))}setFeatureReport(e,t,n){const r={action:"set-hid-feature",id:this.transportId,usagePage:e,usage:t,value:n};this.transport.writeAction(r)}findDescriptor(e,t,n){return this.descriptor.find(r=>r.usagePage===e&&r.usage===t&&r.reportType===n)}}$t.inputReportsFilter=e=>e.pipe(qe(e=>"hid-input"===e.event),Ae(e=>zt.deserialize(e.id,e)));class Jt{static typeFromAttr(e){return e>>6}static packetLengthFromAttr(e){return e&this.lengthMask}static deserialize(e){const t=e[0],n=e[1],r=e[2],i=this.typeFromAttr(e[3]),o=e[4],s=e[5],a=this.packetLengthFromAttr(e[3]),c=e.slice(6,a);return new Nt(t,n,i,o,s,c,r)}}Jt.lengthMask=63;class Xt{constructor(){this.data=[]}hasHeader(){return this.data.length>=Xt.gnpPacketHeaderLength}expectedPacketLength(){if(!this.hasHeader())throw new dt("Unable to get expected packet length without a full header",je.UNEXPECTED_ERROR);return Jt.packetLengthFromAttr(this.data[3])}appendData(e){this.hasHeader()&&this.expectedPacketLength()>Xt.gnpPacketMaxLength&&(this.data=[]),this.data=this.data.concat(e)}hasFullPacket(){if(!this.hasHeader())return!1;const e=this.expectedPacketLength();return this.data.length>=e}getPacketAndReset(){if(!this.hasFullPacket())throw new dt("Trying to get packet but buffer is not complete",je.UNEXPECTED_ERROR);const e=Jt.deserialize(Uint8Array.from(this.data));return this.data=[],e}}Xt.gnpPacketHeaderLength=6,Xt.gnpPacketMaxLength=63;const Qt=()=>{};function Zt(e){return ht(t=>e(),t=>e(),()=>Qt)}const en=()=>{return e=e=>e.command===At.NACK,t=e=>new dt("Got NACK response. Reason: "+e.subCommand,je.DEVICE_ERROR),n=>n.pipe(Ae(n=>e(n)?_e(t(n)):we(n)),lt());var e,t},tn=e=>rt(t=>t.type===Rt.REPLY&&t.sequenceNumber===e.sequenceNumber&&t.destination===e.source&&t.source===e.destination);class nn{constructor(e,t,n,r,i=0){this.hidChannel=e,this.gnpLock=t,this.transportId=n,this.primaryAddress=r,this.lockQueue=[],this.packets=e.input.pipe(nn.inputFilter),this.events=this.packets.pipe(nn.eventsFilter),this.nextSequenceNumber=i}static get inputFilter(){return e=>{const t=e.pipe(qe(e=>e.usagePage===Tt.GN_PROTOCOL&&e.usage===kt.DATA&&e.isArray())),n=new Xt;return t.pipe(Se(e=>{const t=e.value;return n.appendData(t),n.hasFullPacket()?we(n.getPacketAndReset()):Ye}),st())}}static supportsGnpOverHid(e){return void 0!==e.findDescriptor(Tt.GN_PROTOCOL,kt.DATA,Gt.OUTPUT)}getNextSequenceNumber(){const e=this.nextSequenceNumber;return this.nextSequenceNumber=(this.nextSequenceNumber+1)%255,e}doWithGnpLockHeld(e){this.lockQueue.push(e),this.lockQueue.length>1||this.processLockQueue()}processLockQueue(){this.gnpLock.acquireGnpLock(this.transportId).subscribe(e=>{(0,this.lockQueue[0])(e=>{var t;const n=null===(t=this.hidChannel.findDescriptor(Tt.GN_PROTOCOL,kt.DATA,Gt.OUTPUT))||void 0===t?void 0:t.reportSize;if(!n)throw new dt("Cannot send GNP packets to this device.",je.DEVICE_ERROR);const r=class{static attrFromTypeAndPayloadLength(e,t){return(e<<6)+(t+6)}static serialize(e){const t=new Uint8Array(6);t[0]=e.destination,t[1]=e.source,t[2]=e.sequenceNumber,t[3]=this.attrFromTypeAndPayloadLength(e.type,e.payload.length),t[4]=e.command,t[5]=e.subCommand;const n=new Uint8Array(t.length+e.payload.length);return n.set(t),n.set(e.payload,t.length),n}}.serialize(e);let i=0;do{const e=Math.min(r.length-i,n),t=r.subarray(i,i+e);i+=t.length,this.hidChannel.output(Tt.GN_PROTOCOL,kt.DATA,Array.from(t))}while(i<r.length)},this.packets,()=>{this.gnpLock.releaseGnpLock(this.transportId,e),this.lockQueue.splice(0,1),this.lockQueue.length>0&&this.processLockQueue()})})}sendEvent(e,t,n=this.primaryAddress){const r=new Nt(n,It.PC_ADDR,Rt.EVENT,e.command,e.subCommand,e.serialize(t),0);this.doWithGnpLockHeld((e,t,n)=>{e(r),n()})}read(e,t=this.primaryAddress,n=2500){const r=new Pt(e,e=>new Uint8Array);return this.readWithParams(r,null,t,n)}readWithParams(e,t,n=this.primaryAddress,r=2500){const i=new Nt(n,It.PC_ADDR,Rt.READ,e.command,e.subCommand,e.serialize(t),this.getNextSequenceNumber()),o=new G;return this.doWithGnpLockHeld((t,n,s)=>{n.pipe(tn(i),en(),rt(e=>e.command===i.command&&e.subCommand===i.subCommand),Ie(r),Zt(s),Ae(t=>e.deserialize(t))).subscribe(o),t(i)}),o}write(e,t,n=this.primaryAddress,r=2500){const i=new Nt(n,It.PC_ADDR,Rt.WRITE,e.command,e.subCommand,e.serialize(t),this.getNextSequenceNumber()),o=new G;return this.doWithGnpLockHeld((e,t,n)=>{t.pipe(tn(i),en(),rt(e=>e.command===At.ACK),Ie(r),Zt(n),Ae(()=>!0)).subscribe(o),e(i)}),o}}nn.eventsFilter=e=>e.pipe(qe(e=>e.type===Rt.EVENT));class rn{constructor(e,t){this.parentGnpChannel=e,this.primaryAddress=t,this.events=e.events.pipe(qe(e=>e.source===this.primaryAddress))}sendEvent(e,t,n){this.parentGnpChannel.sendEvent(e,t,this.primaryAddress)}read(e,t,n){return this.parentGnpChannel.read(e,this.primaryAddress,n)}readWithParams(e,t,n,r){return this.parentGnpChannel.readWithParams(e,t,this.primaryAddress,r)}write(e,t,n,r){return this.parentGnpChannel.write(e,t,this.primaryAddress,r)}}function on(e,t,n,r){if(!nn.supportsGnpOverHid(e))return _e(()=>new dt("Device does not support GNP commands.",je.DEVICE_ERROR));const i=we(It.HS_BT_USB_ADDR,It.BASE_ADDR,It.CRADLE_ADDR,It.HS1_ADDR,It.HS_CRADLE_ADDR).pipe(Ae((r,i)=>Le(()=>{const o=new nn(e,new Wt(t),n,r,i),s=new jt;return o.read(s,r,500).pipe(Ae(e=>o),Xe(()=>Q))})),Ne(),et(1),tt(()=>new dt("GNP probe failed.",je.DEVICE_ERROR)));return ze(r.pipe(Se(e=>_e(()=>new dt("Device was suddenly disconnected.",je.DEVICE_ERROR)))),i).pipe(st())}function sn(e,t){return new rn(e,t)}class an{constructor(){this.primaryAddress=It.BASE_ADDR,this.events=Ye}subscribeToEvent(e,t){return _e(()=>new dt("This device does not support GNP commands.",je.FEATURE_NOT_SUPPORTED))}sendEvent(e,t,n){throw new dt("This device does not support GNP commands.",je.FEATURE_NOT_SUPPORTED)}read(e,t,n){return _e(()=>new dt("This device does not support GNP commands.",je.FEATURE_NOT_SUPPORTED))}readWithParams(e,t,n,r){return _e(()=>new dt("This device does not support GNP commands.",je.FEATURE_NOT_SUPPORTED))}write(e,t,n,r){return _e(()=>new dt("This device does not support GNP commands.",je.FEATURE_NOT_SUPPORTED))}}class cn{constructor(e){this.transportId=e,this.isChild=!1}equals(e){return this.isChild===e.isChild&&this.transportId===e.transportId}toString(){return this.transportId}}class un{constructor(e,t){this.parentId=e,this.gnpAddress=t,this.isChild=!0,this.transportId=e.transportId}equals(e){if(this.isChild===e.isChild){const t=e;return this.parentId.equals(t.parentId)&&this.gnpAddress===t.gnpAddress}return!1}toString(){return`0x${e=this.gnpAddress,e.toString(16).padStart(2,"0").toUpperCase()}@${this.transportId}`;var e}}var ln,fn,hn;!function(e){e.NO_TRACKING="no-tracking",e.TRACK_ERRORS="track-errors",e.TRACK_USAGE="track-usage",e.TRACK_ALL="track-all"}(ln||(ln={})),function(e){e[e.BLUETOOTH=0]="BLUETOOTH",e[e.INDIRECT=1]="INDIRECT",e[e.USB=2]="USB"}(fn||(fn={})),function(e){e[e.BASE=0]="BASE",e[e.HEADSET=1]="HEADSET",e[e.DESKSTAND=2]="DESKSTAND",e[e.OTHER=3]="OTHER",e[e.DONGLE=4]="DONGLE",e[e.PC=5]="PC",e[e.EHS=6]="EHS",e[e.USB=7]="USB",e[e.SPEAKER_PHONE=8]="SPEAKER_PHONE",e[e.INDICATOR=9]="INDICATOR",e[e.MOBILE=10]="MOBILE",e[e.NONE=11]="NONE",e[e.LOCAL=12]="LOCAL",e[e.DISPLAY=13]="DISPLAY",e[e.HS_CRADLE=14]="HS_CRADLE",e[e.HS_CRADLE2=15]="HS_CRADLE2",e[e.MOBILE_IAP=16]="MOBILE_IAP",e[e.CRADLE=17]="CRADLE",e[e.VIDEO=18]="VIDEO",e[e.NOT_GN=252]="NOT_GN",e[e.ANY_GN=253]="ANY_GN",e[e.NOT_INIT=254]="NOT_INIT",e[e.ANY=255]="ANY"}(hn||(hn={}));class dn{constructor(e,t,n,r,i,o,s,a,c,u,l){this.id=e,this.type=t,this.hidChannel=n,this.events=r,this.primaryAddress=i,this.sendEvent=o,this.read=s,this.readWithParams=a,this.write=c,this.onDisconnect=u,this.parentConnectionId=l,this.onDisconnect.subscribe({error:R})}static createConnection(e,t,n,r,i,o){const s=r.sendEvent.bind(r),a=r.read.bind(r),c=r.readWithParams.bind(r),u=r.write.bind(r);return new dn(e,t,n,r.events,r.primaryAddress,s,a,c,u,i,o)}}const pn=(e=3,t=500)=>n=>n.pipe(Se((n,r)=>{const i=r+1;return i>e?_e(()=>n):xe(i*i*t)}));function vn(e,t,n,r=1e3,i=3,o=100){return Le(()=>e.read(t,n,r)).pipe(ot(pn(i,o)))}function gn(e,t,n){const{deviceType:r,address:i}=n;return{transportId:t.transportId,vid:t.vid,pid:vn(e,Ut,i),name:vn(e,Ht,i),serialNumber:vn(e,Ft,i),capabilities:t.capabilities,deviceType:r,connectionGnpAddress:i}}class yn{constructor(e,t,n=gn,r=dn.createConnection,i=sn){this.parentConnection=t,this.connectionCreator=r,this.createChildGnpChannel=i;const o=t.events.pipe(qe(e=>e.command===At.DEVICE&&e.subCommand===St.ATTACH_EVENT),Ae(e=>({deviceType:e.payload[0],address:e.payload[1]}))).pipe(Ae(n.bind(null,t,e)));this.connectionEvents=o.pipe(Ae(e=>{const n=ze(t.events.pipe(rt(t=>t.command===At.DEVICE&&t.subCommand===St.DETACH_EVENT&&t.payload[1]===e.connectionGnpAddress),Ae(R)),t.onDisconnect);return{attach:e,detach:n}}),Se(e=>Je(we(e.attach),this.createConnection(e.attach,e.detach))),Ae(([e,t])=>({event:e,connection:t})),ft(t.onDisconnect)),t.sendEvent(Dt,[])}createConnection(e,t){const n=e.connectionGnpAddress,r=this.createChildGnpChannel(this.parentConnection,n),i=new un(this.parentConnection.id,n);return we(this.connectionCreator(i,fn.INDIRECT,this.parentConnection.hidChannel,r,t,this.parentConnection.id))}}const mn={command:At.IDENT,subCommand:St.TYPE,deserialize:e=>{const{payload:t}=e,n=t[0];if(n<1||n>=t.length)throw new dt("Cannot get device type.",je.DEVICE_ERROR);return t[1]}};function bn(e,t,n,r=Ue.ERROR,i=Me.JS_LIB){pt(`${e} ${function(e){if(e instanceof dt){const t=e;return`JabraError: ${t.message} (type: ${t.type})`}if(e instanceof Error){const t=e;return`Error: ${t.message} (name: ${t.name})`}return"Unknown error: "+e}(t)}`,n,r,i)}function En(e){return new yn(e.event,e.connection).connectionEvents}class wn{constructor(e,t,n=((e,t,n)=>new $t(e,t,n)),r=on,i=En,o=dn.createConnection){this.transport=e,this.logger=t,this.createHidChannel=n,this.createRootGnpChannel=r,this.connectionCreator=o;const s=this.transport.consoleAppEvent.pipe(qe(e=>"attach"===e.event),Ae(wn.createAttachEvent),Xe((e,t)=>(bn("",e,this.logger),t))).pipe(Ae(e=>{const t=this.transport.consoleAppEvent.pipe(qe(e=>"detach"===e.event),rt(t=>wn.getTransportId(t)===e.transportId),Ae(R),ct());return t.subscribe(),{attach:e,detach:t}}),Se(e=>this.createConnection(e.attach,e.detach)),st()),a=s.pipe(qe(e=>e.event.deviceType===hn.DONGLE),qe(e=>nn.supportsGnpOverHid(e.connection.hidChannel)),Se(e=>i(e)));this.connectionEvents=He(s,a).pipe(st())}static convertToReportType(e){switch(e){case"input":return Gt.INPUT;case"output":return Gt.OUTPUT;case"feature":return Gt.FEATURE;default:throw new dt(e+" is not a valid ReportType",je.UNEXPECTED_ERROR)}}static convertToValueType(e){switch(e){case"absolute":return Yt.ABSOLUTE;case"relative":return Yt.RELATIVE;default:throw new dt(e+" Not a valid ValueType",je.UNEXPECTED_ERROR)}}static createDescriptor(e){return e.map(e=>({reportType:wn.convertToReportType(e.reportType),usagePage:e.usagePage,usage:e.usage,valueType:wn.convertToValueType(e.valueType),reportSize:e.reportSize}))}static getMandatoryField(e,t){const n=e[t];if(void 0===n)throw new dt(`JSON event lacks required field "${t}: ${JSON.stringify(e)}`,je.UNEXPECTED_ERROR);return n}static getTransportId(e){return wn.getMandatoryField(e,"id")}static createAttachEvent(e){return{transportId:wn.getTransportId(e),vid:wn.getMandatoryField(e,"vid"),pid:we(wn.getMandatoryField(e,"pid")),name:we(wn.getMandatoryField(e,"name")),serialNumber:we(wn.getMandatoryField(e,"serialNumber")),capabilities:wn.createDescriptor(wn.getMandatoryField(e,"descriptor"))}}createConnection(e,t,n=3,r=100){const{capabilities:i,transportId:o}=e,s=new cn(o),a=this.createHidChannel(s,i,this.transport),c=this.createRootGnpChannel(a,this.transport,o,t).pipe(Xe((e,t)=>(e.type&&e.type===je.DEVICE_ERROR&&this.transport.context===Be.WEB_HID&&pt("Child devices are not yet supported when using WebHID.",this.logger,Ue.WARNING,Me.JS_LIB),we(new an))),st()),u=c.pipe(Se(e=>e.read(mn)),ot(pn(n,r)),Xe(e=>we(hn.ANY)));return Je(c,u).pipe(ft(t),Ae(([n,r])=>({event:Object.assign(Object.assign({},e),{deviceType:r,connectionGnpAddress:n.primaryAddress}),connection:this.connectionCreator(s,fn.USB,a,n,t)})))}}var _n,Cn,On,Tn,kn;class In{constructor(e,t,n,r,i,o){this.vendorId=e,this.productId=t,this.serialNumber=n,this.name=r,this.type=i,Cn.set(this,void 0),a(this,Cn,new gt(o,s(In,_n,"m",Tn)),"f"),this.connectionAdded=s(this,Cn,"f").itemAdded,this.connectionRemoved=s(this,Cn,"f").itemRemoved,this.connectionList=s(this,Cn,"f").itemList,this.onDisconnect=s(this,Cn,"f").itemList.pipe(ut(1),rt(e=>0===e.length),Ae(R),st())}get id(){return qt(this.vendorId,this.productId,this.serialNumber)}get currentConnections(){return s(this,Cn,"f").getValue()}get browserLabel(){return`${this.vendorId.toString(16).padStart(4,"0")}:${this.productId.toString(16).padStart(4,"0")}`}}_n=In,Cn=new WeakMap,Tn=function(e,t){return s(In,_n,"f",On).indexOf(e.type)-s(In,_n,"f",On).indexOf(t.type)},On={value:[fn.USB,fn.INDIRECT,fn.BLUETOOTH]};class Rn{constructor(e){this.deviceObservables=new gt(e)}static exceptionToUndefined(e){try{return e()}catch(e){if(e instanceof dt)return;throw e}}connectionExists(e){return void 0!==Rn.exceptionToUndefined(()=>this.findConnectionById(e))}findConnectionById(e){for(const t of this.deviceObservables.getValue())for(const n of t.currentConnections)if(n.id.equals(e))return n;throw new dt("Could not find connection with id "+e.toString(),je.UNEXPECTED_ERROR)}findDeviceByDeviceId(e){return this.deviceObservables.getValue().find(t=>t.id.startsWith(e)||e.startsWith(t.id))}}class An{constructor(e,t){this.logger=t;const[n,r]=(i=e.pipe(qe(e=>!this.deviceCollection.connectionExists(e.connection.id)),Qe(e=>this.force(e))),[qe(o=({event:e,pid:t,serialNumber:n})=>!this.deviceCollection.findDeviceByDeviceId(qt(e.event.vid,t,n)),s)(he(i)),qe(Ke(o,s))(he(i))]);var i,o,s;const a=n.pipe(Ae(e=>An.createDevice(e,r)));this.deviceCollection=new Rn(a),this.deviceObservables=this.deviceCollection.deviceObservables}force(e){const{name:t,pid:n,serialNumber:r}=e.event,i=e.connection.onDisconnect.pipe((o=_e(()=>new Error(`Connection with ID ${e.connection.id} disconnected`)),y(s)?Qe((function(){return o}),s):Qe((function(){return o}))));var o,s;return Je(t,n,r).pipe(Ae(([t,n,r])=>({event:e,name:t,pid:n,serialNumber:r})),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length?j((function(t,n){$e(d([t],h(e)))(n)})):x}(i),Xe(e=>(pt("Failed to retrieve child connection information. Error: "+e,this.logger,Ue.WARNING,Me.JS_LIB),Q)))}static createDevice(e,t){const{event:n,pid:r,name:i,serialNumber:o}=e,{vid:s,deviceType:a}=n.event,c=t.pipe(qe(t=>An.isSameDevice(e,t)),Ae(e=>e.event.connection)),u=De(we(n.connection),c);return new In(s,r,o,i,a,u)}static isSameDevice(e,t){const n=qt(e.event.event.vid,e.pid,e.serialNumber),r=qt(t.event.event.vid,t.pid,t.serialNumber);return n.startsWith(r)||r.startsWith(n)}static create(e,t){const n=new wn(e,t);return new An(n.connectionEvents)}}function Sn(e){var t,n,r;return o(this,void 0,void 0,(function*(){const i=null==e?void 0:e.logger;pt("Jabra SDK JS starting up...",i,Ue.INFO);const o=new Ct(e);o.validateOrganizationKey(),o.validateAppId(),o.validateAppName();const s=null!==(n=null===(t=null==e?void 0:e.internal)||void 0===t?void 0:t.testDeviceTransport)&&void 0!==n?n:yield Et(i,null==e?void 0:e.transport,null===(r=null==e?void 0:e.internal)||void 0===r?void 0:r.recorder);new wt(s,i);const a=An.create(s,i),c=new mt(a,s,e);return yield s.connect(),c}))}class Pn{constructor(e,t,n,r){this.deviceId=e,this.usagePage=t,this.usage=n,this.value=r}}class Nn{constructor(e,t){this.token=e,this.value=t}}!function(e){e.UsageReport=class{constructor(e,t){this.usage=e,this.value=t}}}(kn||(kn={}));var Dn,Ln,xn,Hn,Un,Mn,jn,Fn,Bn,Gn,Yn=Bt((function(e){!function(t){var n=function(e,t,n){if(!(e instanceof ArrayBuffer||void 0!==i&&e instanceof i))throw new Error("Must specify a valid ArrayBuffer or Buffer.");t=t||0,n=n||e.byteLength||e.length,this._view=new Uint8Array(e.buffer||e,t,n),this.bigEndian=!1};n._scratch=new DataView(new ArrayBuffer(8)),Object.defineProperty(n.prototype,"buffer",{get:function(){return void 0!==i?i.from(this._view.buffer):this._view.buffer},enumerable:!0,configurable:!1}),Object.defineProperty(n.prototype,"byteLength",{get:function(){return this._view.length},enumerable:!0,configurable:!1}),n.prototype._setBit=function(e,t){t?this._view[e>>3]|=1<<(7&e):this._view[e>>3]&=~(1<<(7&e))},n.prototype.getBits=function(e,t,n){var r=8*this._view.length-e;if(t>r)throw new Error("Cannot get "+t+" bit(s) from offset "+e+", "+r+" available");for(var i=0,o=0;o<t;){var s=t-o,a=7&e,c=this._view[e>>3],u=Math.min(s,8-a);this.bigEndian?(i<<=u,i|=c>>8-u-a&~(255<<u)):i|=(c>>a&~(255<<u))<<o,e+=u,o+=u}return n?(32!==t&&i&1<<t-1&&(i|=-1^(1<<t)-1),i):i>>>0},n.prototype.setBits=function(e,t,n){var r=8*this._view.length-e;if(n>r)throw new Error("Cannot set "+n+" bit(s) from offset "+e+", "+r+" available");for(var i=0;i<n;){var o,s,a,c=n-i,u=7&e,l=e>>3,f=Math.min(c,8-u);if(this.bigEndian){s=t>>n-i-f&(o=~(-1<<f));var h=8-u-f;a=~(o<<h),this._view[l]=this._view[l]&a|s<<h}else s=t&(o=~(255<<f)),t>>=f,a=~(o<<u),this._view[l]=this._view[l]&a|s<<u;e+=f,i+=f}},n.prototype.getBoolean=function(e){return 0!==this.getBits(e,1,!1)},n.prototype.getInt8=function(e){return this.getBits(e,8,!0)},n.prototype.getUint8=function(e){return this.getBits(e,8,!1)},n.prototype.getInt16=function(e){return this.getBits(e,16,!0)},n.prototype.getUint16=function(e){return this.getBits(e,16,!1)},n.prototype.getInt32=function(e){return this.getBits(e,32,!0)},n.prototype.getUint32=function(e){return this.getBits(e,32,!1)},n.prototype.getFloat32=function(e){return n._scratch.setUint32(0,this.getUint32(e)),n._scratch.getFloat32(0)},n.prototype.getFloat64=function(e){return n._scratch.setUint32(0,this.getUint32(e)),n._scratch.setUint32(4,this.getUint32(e+32)),n._scratch.getFloat64(0)},n.prototype.setBoolean=function(e,t){this.setBits(e,t?1:0,1)},n.prototype.setInt8=n.prototype.setUint8=function(e,t){this.setBits(e,t,8)},n.prototype.setInt16=n.prototype.setUint16=function(e,t){this.setBits(e,t,16)},n.prototype.setInt32=n.prototype.setUint32=function(e,t){this.setBits(e,t,32)},n.prototype.setFloat32=function(e,t){n._scratch.setFloat32(0,t),this.setBits(e,n._scratch.getUint32(0),32)},n.prototype.setFloat64=function(e,t){n._scratch.setFloat64(0,t),this.setBits(e,n._scratch.getUint32(0),32),this.setBits(e+32,n._scratch.getUint32(4),32)},n.prototype.getArrayBuffer=function(e,t){for(var n=new Uint8Array(t),r=0;r<t;r++)n[r]=this.getUint8(e+8*r);return n};var r=function(e,t){return function(){if(this._index+t>this._length)throw new Error("Trying to read past the end of the stream");var n=this._view[e](this._index);return this._index+=t,n}},o=function(e,t){return function(n){this._view[e](this._index,n),this._index+=t}};function s(e,t,n){if(0===t)return"";var r=0,i=[],o=!0,s=!!t;for(t||(t=Math.floor((e._length-e._index)/8));r<t;){var a=e.readUint8();if(0===a&&(o=!1,!s))break;o&&i.push(a),r++}var c=String.fromCharCode.apply(null,i);if(!n)return c;try{return decodeURIComponent(escape(c))}catch(e){return c}}var a=function(e,t,r){var o=e instanceof ArrayBuffer||void 0!==i&&e instanceof i;if(!(e instanceof n||o))throw new Error("Must specify a valid BitView, ArrayBuffer or Buffer");this._view=o?new n(e,t,r):e,this._index=0,this._startIndex=0,this._length=8*this._view.byteLength};Object.defineProperty(a.prototype,"index",{get:function(){return this._index-this._startIndex},set:function(e){this._index=e+this._startIndex},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"length",{get:function(){return this._length-this._startIndex},set:function(e){this._length=e+this._startIndex},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"bitsLeft",{get:function(){return this._length-this._index},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"byteIndex",{get:function(){return Math.ceil(this._index/8)},set:function(e){this._index=8*e},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"buffer",{get:function(){return this._view.buffer},enumerable:!0,configurable:!1}),Object.defineProperty(a.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!1}),Object.defineProperty(a.prototype,"bigEndian",{get:function(){return this._view.bigEndian},set:function(e){this._view.bigEndian=e},enumerable:!0,configurable:!1}),a.prototype.readBits=function(e,t){var n=this._view.getBits(this._index,e,t);return this._index+=e,n},a.prototype.writeBits=function(e,t){this._view.setBits(this._index,e,t),this._index+=t},a.prototype.readBoolean=r("getBoolean",1),a.prototype.readInt8=r("getInt8",8),a.prototype.readUint8=r("getUint8",8),a.prototype.readInt16=r("getInt16",16),a.prototype.readUint16=r("getUint16",16),a.prototype.readInt32=r("getInt32",32),a.prototype.readUint32=r("getUint32",32),a.prototype.readFloat32=r("getFloat32",32),a.prototype.readFloat64=r("getFloat64",64),a.prototype.writeBoolean=o("setBoolean",1),a.prototype.writeInt8=o("setInt8",8),a.prototype.writeUint8=o("setUint8",8),a.prototype.writeInt16=o("setInt16",16),a.prototype.writeUint16=o("setUint16",16),a.prototype.writeInt32=o("setInt32",32),a.prototype.writeUint32=o("setUint32",32),a.prototype.writeFloat32=o("setFloat32",32),a.prototype.writeFloat64=o("setFloat64",64),a.prototype.readASCIIString=function(e){return function(e,t){return s(e,t,!1)}(this,e)},a.prototype.readUTF8String=function(e){return function(e,t){return s(e,t,!0)}(this,e)},a.prototype.writeASCIIString=function(e,t){!function(e,t,n){for(var r=n||t.length+1,i=0;i<r;i++)e.writeUint8(i<t.length?t.charCodeAt(i):0)}(this,e,t)},a.prototype.writeUTF8String=function(e,t){!function(e,t,n){for(var r=function(e){var t,n,r=[];for(t=0;t<e.length;t++)(n=e.charCodeAt(t))<=127?r.push(n):n<=2047?(r.push(n>>6|192),r.push(63&n|128)):n<=65535?(r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)):(r.push(n>>18|240),r.push(n>>12&63|128),r.push(n>>6&63|128),r.push(63&n|128));return r}(t),i=n||r.length+1,o=0;o<i;o++)e.writeUint8(o<r.length?r[o]:0)}(this,e,t)},a.prototype.readBitStream=function(e){var t=new a(this._view);return t._startIndex=this._index,t._index=this._index,t.length=e,this._index+=e,t},a.prototype.writeBitStream=function(e,t){var n;for(t||(t=e.bitsLeft);t>0;)n=Math.min(t,32),this.writeBits(e.readBits(n),n),t-=n},a.prototype.readArrayBuffer=function(e){var t=this._view.getArrayBuffer(this._index,e);return this._index+=8*e,t},a.prototype.writeArrayBuffer=function(e,t){this.writeBitStream(new a(e),8*t)},e.exports&&(e.exports={BitView:n,BitStream:a})}()}));function Vn(){return o(this,void 0,void 0,(function*(){const{hid:e}=window.navigator;if(!e)throw new dt("WebHID not supported",je.INIT_ERROR);yield e.requestDevice({filters:[{vendorId:Dn.VENDOR_ID}]}),new BroadcastChannel(Dn.PAIRING_CHANNEL).postMessage(null)}))}!function(e){e[e.VENDOR_ID=2830]="VENDOR_ID",e.PAIRING_CHANNEL="jabra-webhid-pairing-channel"}(Dn||(Dn={})),function(e){e[e.HOOK_SWITCH=32]="HOOK_SWITCH",e[e.FLASH=33]="FLASH",e[e.ALT_HOLD=35]="ALT_HOLD",e[e.REDIAL=36]="REDIAL",e[e.ONLINE=42]="ONLINE",e[e.SPEAKER_PHONE=43]="SPEAKER_PHONE",e[e.PHONE_MUTE=47]="PHONE_MUTE",e[e.SEND=49]="SEND",e[e.SPEED_DIAL=80]="SPEED_DIAL",e[e.VOICE_MAIL=112]="VOICE_MAIL",e[e.ANSWER_ON_OFF=116]="ANSWER_ON_OFF",e[e.LINE_BUSY=151]="LINE_BUSY",e[e.RINGER=158]="RINGER",e[e.PHONE_KEY_0=176]="PHONE_KEY_0",e[e.PHONE_KEY_1=177]="PHONE_KEY_1",e[e.PHONE_KEY_2=178]="PHONE_KEY_2",e[e.PHONE_KEY_3=179]="PHONE_KEY_3",e[e.PHONE_KEY_4=180]="PHONE_KEY_4",e[e.PHONE_KEY_5=181]="PHONE_KEY_5",e[e.PHONE_KEY_6=182]="PHONE_KEY_6",e[e.PHONE_KEY_7=183]="PHONE_KEY_7",e[e.PHONE_KEY_8=184]="PHONE_KEY_8",e[e.PHONE_KEY_9=185]="PHONE_KEY_9",e[e.PHONE_KEY_STAR=186]="PHONE_KEY_STAR",e[e.PHONE_KEY_POUND=187]="PHONE_KEY_POUND",e[e.ALT_VOLUME_UP=233]="ALT_VOLUME_UP",e[e.ALT_VOLUME_DOWN=234]="ALT_VOLUME_DOWN",e[e.REJECT_CALL=65533]="REJECT_CALL"}(Ln||(Ln={}));class Wn{constructor(e,t,n){this.type=e,this.value=t,this.valueType=n}toString(){return void 0===Ln[this.type]?`Unknown signal: type: ${this.type}, value: ${this.value}, valueType: ${this.valueType}`:`Signal: type: ${Ln[this.type]}, value: ${this.value}, valueType: ${this.valueType}`}}!function(e){e[e.BUTTON=9]="BUTTON",e[e.CONSUMER=12]="CONSUMER",e[e.LED=8]="LED",e[e.TELEPHONY=11]="TELEPHONY",e[e.GN_CONSUMER=65312]="GN_CONSUMER",e[e.GN_EXT_BUTTONS=65360]="GN_EXT_BUTTONS",e[e.GN_LED=65344]="GN_LED",e[e.GN_MISC=65376]="GN_MISC",e[e.GN_TELEPHONY=65328]="GN_TELEPHONY"}(xn||(xn={})),function(e){e[e.MUTE=9]="MUTE",e[e.OFF_HOOK=23]="OFF_HOOK",e[e.RING=24]="RING",e[e.MESSAGE_WAIT=25]="MESSAGE_WAIT",e[e.HOLD=32]="HOLD",e[e.MIC_MUTE=33]="MIC_MUTE",e[e.ONLINE=42]="ONLINE",e[e.HID_OFFLINE=43]="HID_OFFLINE"}(Hn||(Hn={})),function(e){e[e.HOOK_SWITCH=32]="HOOK_SWITCH",e[e.FLASH=33]="FLASH",e[e.HOLD=35]="HOLD",e[e.REDIAL=36]="REDIAL",e[e.ONLINE=42]="ONLINE",e[e.SPEAKER_PHONE=43]="SPEAKER_PHONE",e[e.MUTE=47]="MUTE",e[e.HID_SEND=49]="HID_SEND",e[e.SPEED_DIAL=80]="SPEED_DIAL",e[e.VOICE_MAIL=112]="VOICE_MAIL",e[e.ANSWER_ON_OFF=116]="ANSWER_ON_OFF",e[e.LINE_BUSY=151]="LINE_BUSY",e[e.RINGER=158]="RINGER",e[e.PHONE_KEY_0=176]="PHONE_KEY_0",e[e.PHONE_KEY_1=177]="PHONE_KEY_1",e[e.PHONE_KEY_2=178]="PHONE_KEY_2",e[e.PHONE_KEY_3=179]="PHONE_KEY_3",e[e.PHONE_KEY_4=180]="PHONE_KEY_4",e[e.PHONE_KEY_5=181]="PHONE_KEY_5",e[e.PHONE_KEY_6=182]="PHONE_KEY_6",e[e.PHONE_KEY_7=183]="PHONE_KEY_7",e[e.PHONE_KEY_8=184]="PHONE_KEY_8",e[e.PHONE_KEY_9=185]="PHONE_KEY_9",e[e.PHONE_KEY_STAR=186]="PHONE_KEY_STAR",e[e.PHONE_KEY_POUND=187]="PHONE_KEY_POUND",e[e.HID_ALT_VOLUME_UP=233]="HID_ALT_VOLUME_UP",e[e.HID_ALT_VOLUME_DOWN=234]="HID_ALT_VOLUME_DOWN",e[e.GN_PSEUDO_HOOK_SWITCH=65531]="GN_PSEUDO_HOOK_SWITCH",e[e.GN_OUT_OF_RANGE=65532]="GN_OUT_OF_RANGE",e[e.GN_REJECT_CALL=65533]="GN_REJECT_CALL",e[e.GN_TELEPHONY_CONT_SET=65535]="GN_TELEPHONY_CONT_SET"}(Un||(Un={}));class Kn{constructor(e,t,n,r,i){this.hidChannel=e,this.onDisconnect=t,this.isSoftphoneInFocus=n,this.lockHeld=r,this.logger=i,this.cachedSignals=new Map}setup(){const e=this.filter().pipe(st());return e.subscribe(),e}filter(){const e=this.hidChannel.input.pipe(qe(e=>e.usagePage===xn.GN_TELEPHONY&&!e.isArray()),Se(e=>{const t=this.hidChannel.descriptor.find(t=>t.usagePage===e.usagePage&&t.usage===e.usage);return(null==t?void 0:t.valueType)?we(Object.assign(Object.assign({},e),{valueType:t.valueType})):(bn("",new dt(`Unable to find value-type in descriptor for UsagePage: ${e.usagePage} and Usage: ${e.usage}`,je.FEATURE_NOT_SUPPORTED),this.logger),Q)}),qe(e=>e.valueType===Yt.RELATIVE?Boolean(e.value):this.cachedSignals.get(e.usage)!==e.value),ht(e=>{this.cachedSignals.set(e.usage,e.value)}),ft(this.onDisconnect),st()),t=[Ln.HOOK_SWITCH,Ln.REDIAL],n=e.pipe(function(e){return t=>t.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=me(e);return j((function(t,r){for(var i=e.length,o=new Array(i),s=e.map((function(){return!1})),a=!1,c=function(t){he(e[t]).subscribe(new F(r,(function(e){o[t]=e,a||s[t]||(s[t]=!0,(a=s.every(x))&&(s=null))}),R))},u=0;u<i;u++)c(u);t.subscribe(new F(r,(function(e){if(a){var t=d([e],h(o));r.next(n?n.apply(void 0,d([],h(t))):t)}})))}))}(e),qe(([e,t])=>t),Ae(([e,t])=>e))}(this.isSoftphoneInFocus),qe(e=>t.includes(e.usage)&&!this.lockHeld.getValue()));return He(e.pipe(qe(e=>this.lockHeld.getValue())),n).pipe(Ae(e=>new Wn(e.usage,0!==e.value,e.valueType)),Xe(e=>(pt(e.message,this.logger),Q)))}}class qn{constructor(e,t,n,r,i,o){this.device=e,this.onDisconnect=n,Mn.set(this,void 0),jn.set(this,new V(!1)),Fn.set(this,void 0),Bn.set(this,!1),this.deviceSignals=new G,a(this,Mn,r,"f"),s(this,Mn,"f").lockHeld.subscribe(s(this,jn,"f")),a(this,Fn,t,"f"),this.onDisconnect.pipe(rt(),Ae(()=>!0)).subscribe(e=>{a(this,Bn,e,"f")});const c=new Kn(s(this,Fn,"f"),this.onDisconnect,i,s(this,jn,"f"),o);this.deviceSignals=c.setup()}checkCallLockHeld(e){if(!s(this,jn,"f").getValue())throw new dt(e,je.SDK_USAGE_ERROR)}checkCallLockNotHeld(e){if(s(this,jn,"f").getValue())throw new dt(e,je.SDK_USAGE_ERROR)}checkHasDisconnected(){if(s(this,Bn,"f"))throw new dt("CallControl cannot be performed as the connection has disconnected.",je.SDK_USAGE_ERROR)}takeCallLock(){return this.checkHasDisconnected(),this.checkCallLockNotHeld("Trying to take the call lock, but it is already held!"),function(e,t){return new Promise((function(t,n){var r,i=!1;e.subscribe({next:function(e){r=e,i=!0},error:n,complete:function(){i?t(r):n(new Ce)}})}))}(s(this,Mn,"f").tryTakeCallLock())}releaseCallLock(){this.checkHasDisconnected(),this.checkCallLockHeld("Trying to release the call lock, but it is not held!"),s(this,Mn,"f").releaseCallLock()}offHook(e){this.checkHasDisconnected(),this.checkCallLockHeld("Calls can only be started and stopped when the call lock is held.");const t=s(this,Fn,"f").findDescriptor(xn.GN_LED,Hn.OFF_HOOK,Gt.OUTPUT);if(!t)throw new dt(`Device ${this.device.name} does not support any offHook functionality.`,je.FEATURE_NOT_SUPPORTED);const n=e?1:0;s(this,Fn,"f").output(t.usagePage,t.usage,n)}ring(e){this.checkHasDisconnected(),this.checkCallLockHeld("The ringer state can only be modified when the call lock is held.");const t=s(this,Fn,"f").findDescriptor(xn.GN_LED,Hn.RING,Gt.OUTPUT),n=s(this,Fn,"f").findDescriptor(xn.GN_TELEPHONY,Un.RINGER,Gt.OUTPUT);if(!t&&!n)throw new dt(`Device ${this.device.name} does not support any ring functionality.`,je.FEATURE_NOT_SUPPORTED);if(t){const n=e?1:0;s(this,Fn,"f").output(t.usagePage,t.usage,n)}if(n){const t=e?1:0;s(this,Fn,"f").output(n.usagePage,n.usage,t)}}mute(e){this.checkHasDisconnected(),this.checkCallLockHeld("The mute state can only be modified when the call lock is held.");let t=s(this,Fn,"f").findDescriptor(xn.GN_LED,Hn.MIC_MUTE,Gt.OUTPUT);if(t||(t=s(this,Fn,"f").findDescriptor(xn.GN_LED,Hn.MUTE,Gt.OUTPUT)),!t)throw new dt(`Device ${this.device.name} does not support any mute functionality.`,je.FEATURE_NOT_SUPPORTED);const n=e?1:0;s(this,Fn,"f").output(t.usagePage,t.usage,n)}hold(e){this.checkHasDisconnected(),this.checkCallLockHeld("The hold state can only be modified when the call lock is held.");const t=s(this,Fn,"f").findDescriptor(xn.GN_LED,Hn.HOLD,Gt.OUTPUT);if(!t)throw new dt(`Device ${this.device.name} does not support hold functionality.`,je.FEATURE_NOT_SUPPORTED);const n=e?1:0;s(this,Fn,"f").output(t.usagePage,t.usage,n)}}Mn=new WeakMap,jn=new WeakMap,Fn=new WeakMap,Bn=new WeakMap,function(e){e[e.STD_TELEPHONY=0]="STD_TELEPHONY",e[e.GN_TELEPHONY=1]="GN_TELEPHONY"}(Gn||(Gn={}));const zn={[Ot.SKYPE]:Gn.GN_TELEPHONY,[Ot.CISCO]:Gn.GN_TELEPHONY,[Ot.AVAYA]:Gn.GN_TELEPHONY,[Ot.SIEMENS]:Gn.GN_TELEPHONY,[Ot.IBM]:Gn.GN_TELEPHONY,[Ot.AASTRA]:Gn.GN_TELEPHONY,[Ot.JABRA]:Gn.GN_TELEPHONY,[Ot.NEC]:Gn.GN_TELEPHONY,[Ot.SHORETEL]:Gn.GN_TELEPHONY,[Ot.MS_OC]:Gn.STD_TELEPHONY,[Ot.ALCATEL]:Gn.STD_TELEPHONY,[Ot.OTHER]:Gn.STD_TELEPHONY,[Ot.NORTEL]:null,[Ot.GENERIC]:null};class $n{constructor(e,t,n){this.connectionCallLock=e,this.device=t,this.logger=n,this.lockHeld=new V(!1),this.currentLocks=new V([]),this.lockReleaseEvent=new G,this.lockReleaseEvent.subscribe(()=>this.lockHeld.next(!1))}tryTakeCallLock(){const{currentConnections:e}=this.device,t=[],n=Le(()=>fe(e).pipe(Qe(e=>this.takeSingleCallLock(e)),ht(e=>t.push(e)))).pipe(function(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?qe((function(t,n){return e(t,n,r)})):x,it(1),n?Ze(t):tt((function(){return new Ce})))}}(),Xe(e=>we("")),Ae(n=>(this.currentLocks.next(t),t.length!==e.length?(this.releaseCallLock(),!1):(this.lockHeld.next(!0),!0))),st());return n.subscribe(e=>{e&&(this.device.connectionAdded.pipe(ft(this.lockReleaseEvent)).subscribe(e=>{this.takeSingleCallLock(e).pipe(Ae(e=>{this.currentLocks.getValue().push(e),this.currentLocks.next(this.currentLocks.getValue())}),ot(pn())).subscribe({error:e=>{pt("Failed to acquire the call lock on a new connection.\n Another softphone running an old SDK has most likely acquired this lock.\n Full error: "+e,this.logger,Ue.WARNING,Me.JS_LIB)}})}),this.device.connectionRemoved.pipe(ft(this.lockReleaseEvent)).subscribe(e=>this.releaseSingleCallLock(e.id.transportId)))}),n}takeSingleCallLock(e){return Le(()=>this.connectionCallLock.tryTakeCallLock(e.id.transportId)).pipe(Ae(t=>t.acquired?we(t.transportId):_e(()=>new dt("Failed to acquire call lock on connection "+e.id.transportId,je.SDK_USAGE_ERROR))),lt())}releaseCallLock(){this.lockReleaseEvent.next(),[...this.currentLocks.getValue()].forEach(e=>{try{this.releaseSingleCallLock(e)}catch(e){}}),this.currentLocks.next([])}releaseSingleCallLock(e){this.connectionCallLock.releaseCallLock(e);const t=this.currentLocks.getValue().findIndex(t=>t===e);if(t>-1){const e=this.currentLocks.getValue();e.splice(t,1),this.currentLocks.next(e)}0!==this.currentLocks.getValue().length&&0!==this.device.currentConnections.length||this.lockReleaseEvent.next()}}class Jn{constructor(e){this.transport=e,this.callLockAcquiredResponse=this.transport.consoleAppEvent.pipe(qe(e=>"response-call-lock"===e.event),Ae(e=>({transportId:e.id,acquired:e.acquired})))}tryTakeCallLock(e){const t={action:"request-call-lock",id:e};return this.transport.writeAction(t),this.callLockAcquiredResponse.pipe(rt(t=>t.transportId===e))}releaseCallLock(e){const t={action:"release-call-lock",id:e};this.transport.writeAction(t)}}const Xn=[{usagePage:xn.GN_LED,usage:Hn.OFF_HOOK,reportType:Gt.OUTPUT},{usagePage:xn.GN_LED,usage:Hn.RING,reportType:Gt.OUTPUT},{usagePage:xn.GN_TELEPHONY,usage:Un.RINGER,reportType:Gt.OUTPUT},{usagePage:xn.GN_LED,usage:Hn.MIC_MUTE,reportType:Gt.OUTPUT},{usagePage:xn.GN_LED,usage:Hn.MUTE,reportType:Gt.OUTPUT},{usagePage:xn.GN_LED,usage:Hn.HOLD,reportType:Gt.OUTPUT}],Qn=[fn.USB,fn.INDIRECT,fn.BLUETOOTH];function Zn(e){const{currentConnections:t,type:n}=e;var r;return(r=t,[...r].sort((e,t)=>Qn.indexOf(e.type)-Qn.indexOf(t.type))).find(e=>function(e,t){const{hidChannel:n}=e;return!!function(e){return Xn.some(({usagePage:t,usage:n,reportType:r})=>e.findDescriptor(t,n,r))}(n)&&(!nn.supportsGnpOverHid(n)||t!==hn.DONGLE&&t!==hn.OTHER)}(e,n))}function er(e,t,n,r,i){const o=Zn(e),{hidChannel:s,onDisconnect:a}=o,c=new $n(new Jn(r),e,i);return t||r.context===Be.WEB_HID?we(new qn(e,s,a,c,n.softphoneInFocus,i)):function(e,t){return e.findDescriptor(xn.GN_TELEPHONY,Un.GN_TELEPHONY_CONT_SET,Gt.FEATURE)?Le(()=>(e.setFeatureReport(xn.GN_TELEPHONY,Un.GN_TELEPHONY_CONT_SET,1),we(!0))):t?function(e,t){const n=e.read(new Mt).pipe(Ae(e=>zn[e]===t)),r=e.read(new xt).pipe(Ae(e=>e.find(e=>zn[e]===t))).pipe(Ae(t=>t?e.write(new Mt,t):we(!1)),lt());return n.pipe((i=we(!0),o=r,e=>e.pipe(Ae(e=>e?i:o),lt())));var i,o}(t,Gn.GN_TELEPHONY):we(!1)}(s,o).pipe(Ae(t=>new qn(e,s,a,c,n.softphoneInFocus,i)))}class tr{constructor(e){this.devComm=e,this.softphoneInFocus=new U,this.softphoneInFocus=this.devComm.consoleAppEvent.pipe(qe(e=>"softphone-in-focus"===e.event),Ae(e=>e.infocus),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=be(e);return j((function(t,r){(n?De(e,t,n):De(e,t)).subscribe(r)}))}(!1),ct(1)),this.softphoneInFocus.subscribe(()=>{})}setSharedSoftphoneInfo(e){if(!(null==e?void 0:e.partnerKey)||!(null==e?void 0:e.appId))return void pt("Unable to register with Jabra Direct: partnerKey or appId missing in config",null==e?void 0:e.logger,Ue.WARNING);const t=e.partnerKey+e.appId,n=new Vt(5,"ns:OID",t);let{appName:r}=e;if((!e.appName||e.appName.length<3)&&(pt("App name missing in config. Fall back to use appId as app name.",null==e?void 0:e.logger,Ue.WARNING),r=e.appId),r.length>100)return void pt("Unable to register with Jabra Direct: appName must be below 100 characters.",null==e?void 0:e.logger,Ue.WARNING);const i={action:"set-softphone-info",name:r,id:n.toString()};this.devComm.writeAction(i)}}var nr,rr,ir,or,sr,ar,cr,ur;class lr{constructor(e){var t;nr.set(this,void 0),rr.set(this,void 0),ir.set(this,void 0),or.set(this,void 0),a(this,rr,new tr(e._transport),"f"),s(this,rr,"f").setSharedSoftphoneInfo(e._config),a(this,nr,e._transport,"f"),a(this,ir,null===(t=e._config)||void 0===t?void 0:t.logger,"f"),a(this,or,e._readyEvents.pipe(rt(e=>"ready"===e.event),Ae(e=>e.jabraDirectInstalled)),"f")}createCallControl(e){return this.supportsCallControl(e)?Oe(s(this,or,"f").pipe(Se(t=>er(e,t,s(this,rr,"f"),s(this,nr,"f"),s(this,ir,"f"))))):Promise.reject(new dt(`Device ${e.name} does not support call control.`,je.FEATURE_NOT_SUPPORTED))}supportsCallControl(e){return void 0!==Zn(e)}}nr=new WeakMap,rr=new WeakMap,ir=new WeakMap,or=new WeakMap,function(e){e.HOLD_CURRENT="hold-current",e.END_CURRENT="end-current"}(sr||(sr={})),function(e){e.MUTED="muted",e.UNMUTED="unmuted",e.NO_ONGOING_CALLS="no-ongoing-calls"}(ar||(ar={})),function(e){e.ON_HOLD="on-hold",e.NOT_ON_HOLD="not-on-hold",e.NO_ONGOING_CALLS="no-ongoing-calls"}(cr||(cr={})),function(e){e.NO_INCOMING="no-incoming",e.AWAITING_RESPONSE="awaiting-response",e.RESOLVING_RESPONSE="resolving-response",e.RESOLVING_RESPONSE_FROM_DEVICE="resolving-response-from-device",e.ACCEPTED="accepted",e.REJECTED="rejected"}(ur||(ur={}));new WeakMap,new WeakMap,new WeakMap,new WeakMap;new WeakMap;ar.NO_ONGOING_CALLS,cr.NO_ONGOING_CALLS,ur.NO_INCOMING;new WeakMap,new WeakMap;new WeakMap,new WeakMap}).call(this,n(14),n(5),n(15).Buffer)},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.implementationChanged="implementationChanged",e.deviceHoldStatusChanged="deviceHoldStatusChanged",e.deviceMuteStatusChanged="deviceMuteStatusChanged",e.deviceAnsweredCall="deviceAnsweredCall",e.deviceEndedCall="deviceEndedCall",e.deviceRejectedCall="deviceRejectedCall",e.loggableEvent="loggableEvent",e.webHidPermissionRequested="webHidPermissionRequested",e.deviceConnectionStatusChanged="deviceConnectionStatusChanged",e.deviceMuteChanged="deviceMuteChanged",e.deviceEventLogs="deviceEventLogs"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var r=n(4);function i(e){return(i="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 o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=h(e);if(t){var i=h(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&c(e,t)}(l,e);var t,n,i,o=u(l);function l(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),d(f(t=o.call(this)),"vendorName","Not Specified"),d(f(t),"isConnecting",!1),d(f(t),"isConnected",!1),d(f(t),"isMuted",!1),d(f(t),"errorCode",null),d(f(t),"disableRetry",!1),d(f(t),"logger",void 0),d(f(t),"config",void 0);var n=new r.EventEmitter;return Object.keys(n.__proto__).forEach((function(e){t[e]=n[e]})),t.config=e,t.vendorName=e.vendorName,t.logger=e.logger,t}return t=l,(n=[{key:"isDeviceAttached",get:function(){throw new Error("".concat(this.vendorName," - isDeviceAttatched getter not implemented"))}},{key:"isSupported",value:function(){return!0}},{key:"deviceLabelMatchesVendor",value:function(e){throw new Error("".concat(this.vendorName," - deviceLabelMatchesVendor() not implemented"))}},{key:"connect",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - connect() not implemented")))}},{key:"disconnect",value:function(){return Promise.reject(new Error("".concat(this.vendorName," - disconnect() not implemented")))}},{key:"incomingCall",value:function(e,t){return Promise.reject(new Error("".concat(this.vendorName," - incomingCall() not implemented")))}},{key:"outgoingCall",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - outgoingCall() not implemented")))}},{key:"answerCall",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - answerCall() not implemented")))}},{key:"rejectCall",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - rejectCall() not implemented")))}},{key:"endCall",value:function(e,t){return Promise.reject(new Error("".concat(this.vendorName," - endCall() not implemented")))}},{key:"endAllCalls",value:function(){return Promise.reject(new Error("".concat(this.vendorName," - endAllCalls() not implemented")))}},{key:"setMute",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - setMute() not implemented")))}},{key:"setHold",value:function(e,t){return Promise.reject(new Error("".concat(this.vendorName," - setHold() not implemented")))}},{key:"emitEvent",value:function(e,t){this.emit(e,{vendor:this,body:s({},t)})}},{key:"requestWebHidPermissions",value:function(e){this.logger.debug("Emitting premission request event"),this.emitEvent("webHidPermissionRequested",{callback:e})}},{key:"deviceAnsweredCall",value:function(e){this.emitEvent("deviceAnsweredCall",e)}},{key:"deviceRejectedCall",value:function(e){this.emitEvent("deviceRejectedCall",e)}},{key:"deviceEndedCall",value:function(e){this.emitEvent("deviceEndedCall",e)}},{key:"deviceMuteChanged",value:function(e,t){this.emitEvent("deviceMuteChanged",s({isMuted:e},t))}},{key:"deviceHoldStatusChanged",value:function(e,t,n){this.emitEvent("deviceHoldStatusChanged",s(s({holdRequested:e},t),{},{toggle:n}))}},{key:"deviceEventLogs",value:function(e){this.emitEvent("deviceEventLogs",e)}},{key:"changeConnectionStatus",value:function(e){this.isConnected=e.isConnected,this.isConnecting=e.isConnecting,this.emitEvent("deviceConnectionStatusChanged",s({currentVendor:this},e))}}])&&a(t.prototype,n),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(r.EventEmitter)},function(e,t,n){e.exports=function(){"use strict";var e="undefined"==typeof window,t=!1,n=!1,r=!1,i=!1,o=!1,s=!1,a=!1,c=!1,u=!1,l=!1;return e||(t="undefined"!=typeof InstallTrigger,n=!!window.chrome,r=!(!window.chrome||!window.navigator||!window.navigator.plugins||!window.navigator.plugins.namedItem("Chrome PDF Plugin")&&!window.chrome.runtime),i=n&&!window.chrome.webstore&&!window.chrome.runtime,o=0<Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")||window.safari&&window.safari.pushNotification,s=!!window.opr&&!!window.opr.addons||!!window.opera,a=!!window.StyleMedia,c=n&&!!navigator.userAgent.match(/edg/i),u=(r||s)&&!!window.CSS,l=!(n||o||t||s||!document.documentMode)),{get isChrome(){return r},get isChromeOrChromium(){return n},get isChromium(){return i},get isFirefox(){return t},get isSafari(){return o},get isOpera(){return s},get isEdge(){return a},get isEdgeChromium(){return c},get isIE(){return l},get isBlink(){return u}}}()},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(e,"error",t,n)}(e,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){var i,o,s,a;if(u(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):g(i,i.length)}function v(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function y(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var u=c.length,l=g(c,u);for(n=0;n<u;++n)o(l[n],this,t)}return!0},a.prototype.addListener=function(e,t){return f(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return f(this,e,t,!0)},a.prototype.once=function(e,t){return u(t),this.on(e,d(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,d(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,o,s;if(u(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},a.prototype.listenerCount=v,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){},function(e,t){},function(e,t,n){},function(e,t){},function(e,t,n){var r,i,o;i=[t,e],void 0===(o="function"==typeof(r=function(e,t){"use strict";var n=5e3,r="callback";function i(){return"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random())}function o(e){try{delete window[e]}catch(t){window[e]=void 0}}function s(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=e,c=t.timeout||n,u=t.jsonpCallback||r,l=void 0;return new Promise((function(n,r){var f=t.jsonpCallbackFunction||i(),h=u+"_"+f;window[f]=function(e){n({ok:!0,json:function(){return Promise.resolve(e)}}),l&&clearTimeout(l),s(h),o(f)},a+=-1===a.indexOf("?")?"?":"&";var d=document.createElement("script");d.setAttribute("src",""+a+u+"="+f),t.charset&&d.setAttribute("charset",t.charset),t.nonce&&d.setAttribute("nonce",t.nonce),t.referrerPolicy&&d.setAttribute("referrerPolicy",t.referrerPolicy),d.id=h,document.getElementsByTagName("head")[0].appendChild(d),l=setTimeout((function(){r(new Error("JSONP request to "+e+" timed out")),o(f),s(h),window[f]=function(){o(f)}}),c),d.onerror=function(){r(new Error("JSONP request to "+e+" failed")),o(f),s(h),l&&clearTimeout(l)}}))}})?r.apply(t,i):r)||(e.exports=o)},function(e,t,n){"use strict";n.d(t,"a",(function(){return rt}));
55
- /*! *****************************************************************************
56
- Copyright (c) Microsoft Corporation.
57
-
58
- Permission to use, copy, modify, and/or distribute this software for any
59
- purpose with or without fee is hereby granted.
60
-
61
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
62
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
63
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
64
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
65
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
66
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
67
- PERFORMANCE OF THIS SOFTWARE.
68
- ***************************************************************************** */
69
- var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.create;function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function a(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}Object.create;function c(e){return"function"==typeof e}function u(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var l=u((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function f(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var h=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._teardowns=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var f=o(u),h=f.next();!h.done;h=f.next()){h.value.remove(this)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}else u.remove(this);var d=this.initialTeardown;if(c(d))try{d()}catch(e){i=e instanceof l?e.errors:[e]}var p=this._teardowns;if(p){this._teardowns=null;try{for(var g=o(p),y=g.next();!y.done;y=g.next()){var m=y.value;try{v(m)}catch(e){i=null!=i?i:[],e instanceof l?i=a(a([],s(i)),s(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}}if(i)throw new l(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)v(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._teardowns=null!==(n=this._teardowns)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&f(t,e)},e.prototype.remove=function(t){var n=this._teardowns;n&&f(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),d=h.EMPTY;function p(e){return e instanceof h||e&&"closed"in e&&c(e.remove)&&c(e.add)&&c(e.unsubscribe)}function v(e){c(e)?e():e.unsubscribe()}var g={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},y={setTimeout:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=y.delegate;return((null==n?void 0:n.setTimeout)||setTimeout).apply(void 0,a([],s(e)))},clearTimeout:function(e){var t=y.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function m(e){y.setTimeout((function(){var t=g.onUnhandledError;if(!t)throw e;t(e)}))}function b(){}var E=w("C",void 0,void 0);function w(e,t,n){return{kind:e,value:t,error:n}}var _=null;function C(e){if(g.useDeprecatedSynchronousErrorHandling){var t=!_;if(t&&(_={errorThrown:!1,error:null}),e(),t){var n=_,r=n.errorThrown,i=n.error;if(_=null,r)throw i}}else e()}function O(e){g.useDeprecatedSynchronousErrorHandling&&_&&(_.errorThrown=!0,_.error=e)}var T=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,p(t)&&t.add(n)):n.destination=S,n}return i(t,e),t.create=function(e,t,n){return new k(e,t,n)},t.prototype.next=function(e){this.isStopped?A(function(e){return w("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?A(w("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?A(E,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(h),k=function(e){function t(t,n,r){var i,o=e.call(this)||this;if(c(t))i=t;else if(t){var s;i=t.next,n=t.error,r=t.complete,o&&g.useDeprecatedNextContext?(s=Object.create(t)).unsubscribe=function(){return o.unsubscribe()}:s=t,i=null==i?void 0:i.bind(s),n=null==n?void 0:n.bind(s),r=null==r?void 0:r.bind(s)}return o.destination={next:i?I(i,o):b,error:I(null!=n?n:R,o),complete:r?I(r,o):b},o}return i(t,e),t}(T);function I(e,t){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{e.apply(void 0,a([],s(t)))}catch(e){g.useDeprecatedSynchronousErrorHandling?O(e):m(e)}}}function R(e){throw e}function A(e,t){var n=g.onStoppedNotification;n&&y.setTimeout((function(){return n(e,t)}))}var S={closed:!0,next:b,error:R,complete:b},P="function"==typeof Symbol&&Symbol.observable||"@@observable";function N(e){return e}function D(e){return 0===e.length?N:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var L=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof T||function(e){return e&&c(e.next)&&c(e.error)&&c(e.complete)}(r)&&p(r)?e:new k(e,t,n);return C((function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=x(t))((function(t,r){var i;i=n.subscribe((function(t){try{e(t)}catch(e){r(e),null==i||i.unsubscribe()}}),r,t)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[P]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return D(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=x(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function x(e){var t;return null!==(t=null!=e?e:g.Promise)&&void 0!==t?t:Promise}var H,U=u((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),M=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(t,e),t.prototype.lift=function(e){var t=new j(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new U},t.prototype.next=function(e){var t=this;C((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){var i=t.observers.slice();try{for(var s=o(i),a=s.next();!a.done;a=s.next()){a.value.next(e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;C((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;C((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this.hasError,n=this.isStopped,r=this.observers;return t||n?d:(r.push(e),new h((function(){return f(r,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,n=this.thrownError,r=this.isStopped;t?e.error(n):r&&e.complete()},t.prototype.asObservable=function(){var e=new L;return e.source=this,e},t.create=function(e,t){return new j(e,t)},t}(L),j=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return i(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:d},t}(M),F=n(10),B=n.n(F),G=n(2);!function(e){e[e.Unknown=0]="Unknown",e[e.AcceptCall=1]="AcceptCall",e[e.TerminateCall=2]="TerminateCall",e[e.HoldCall=3]="HoldCall",e[e.ResumeCall=4]="ResumeCall",e[e.Flash=5]="Flash",e[e.CallInProgress=6]="CallInProgress",e[e.CallRinging=7]="CallRinging",e[e.CallEnded=8]="CallEnded",e[e.TransferToHeadset=9]="TransferToHeadset",e[e.TransferToSpeaker=10]="TransferToSpeaker",e[e.Mute=11]="Mute",e[e.Unmute=12]="Unmute",e[e.MobileCallRinging=13]="MobileCallRinging",e[e.MobileCallInProgress=14]="MobileCallInProgress",e[e.MobileCallEnded=15]="MobileCallEnded",e[e.DOn=16]="DOn",e[e.DOff=17]="DOff",e[e.CallIdle=18]="CallIdle",e[e.Play=19]="Play",e[e.Pause=20]="Pause",e[e.Stop=21]="Stop",e[e.DTMLKey=22]="DTMLKey",e[e.RejectCall=23]="RejectCall",e[e.MakeCall=24]="MakeCall",e[e.Hook=25]="Hook",e[e.HookIdle=26]="HookIdle",e[e.HookDocked=27]="HookDocked",e[e.HookUndocked=28]="HookUndocked",e[e.BaseEvent=29]="BaseEvent",e[e.CallAnsweredAndEnded=30]="CallAnsweredAndEnded",e[e.CallUnansweredAndEnded=31]="CallUnansweredAndEnded",e[e.DeviceChange=32]="DeviceChange",e[e.DeviceArrived=33]="DeviceArrived",e[e.DeviceRemoved=34]="DeviceRemoved"}(H||(H={}));var Y=n(3),V=n.n(Y);function W(e){return(W="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 K(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function q(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){K(o,r,i,s,a,"next",e)}function a(e){K(o,r,i,s,a,"throw",e)}s(void 0)}))}}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function J(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Z(e);if(t){var i=Z(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return X(this,n)}}function X(e,t){if(t&&("object"===W(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Q(e)}function Q(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var te,ne,re=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&$(e,t)}(v,e);var t,n,r,i,o,s,a,c,u,l,f,h,d,p=J(v);function v(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,v),ee(Q(t=p.call(this,e)),"activePollingInterval",2e3),ee(Q(t),"connectedDeviceInterval",6e3),ee(Q(t),"disconnectedDeviceInterval",2e3),ee(Q(t),"deviceIdRetryInterval",2e3),ee(Q(t),"vendorName","Plantronics"),ee(Q(t),"pluginName","genesys-cloud-headset-library"),ee(Q(t),"apiHost","https://127.0.0.1:32018/Spokes"),ee(Q(t),"isActive",!1),ee(Q(t),"disableEventPolling",!1),ee(Q(t),"config",void 0),ee(Q(t),"deviceStatusTimer",null),ee(Q(t),"isRetry",!1),ee(Q(t),"_deviceInfo",void 0),ee(Q(t),"callEventsTimerId",void 0),ee(Q(t),"deviceStatusTimerId",void 0),ee(Q(t),"incomingConversationId",void 0),t.config=e,t._deviceInfo=null,t.callEventsTimerId=null,t.deviceStatusTimerId=null,t.incomingConversationId="",t}return t=v,n=[{key:"clearTimeouts",value:function(){clearTimeout(this.callEventsTimerId),clearTimeout(this.deviceStatusTimerId)}},{key:"deviceLabelMatchesVendor",value:function(e){var t=e.toLowerCase();return["plantronics","plt","poly","(047f:"].some((function(e){return t.includes(e)}))}},{key:"deviceName",get:function(){var e;return null===(e=this._deviceInfo)||void 0===e?void 0:e.ProductName}},{key:"deviceInfo",get:function(){return this._deviceInfo}},{key:"isDeviceAttached",get:function(){return!!this.deviceInfo}},{key:"pollForCallEvents",value:function(){var e=this;this.callEventsTimerId&&(clearTimeout(this.callEventsTimerId),this.callEventsTimerId=null),this.isConnected&&!this.disableEventPolling&&(this.logger.debug("**** POLLING FOR CALL EVENTS ****"),this.getCallEvents()),this.callEventsTimerId=setTimeout((function(){e.pollForCallEvents()}),this.activePollingInterval)}},{key:"pollForDeviceStatus",value:function(){var e=this;this.deviceStatusTimerId&&(clearTimeout(this.deviceStatusTimerId),this.deviceStatusTimerId=null),!this.isConnected||this.isConnecting||this.disableEventPolling||(this.logger.debug("**** POLLING FOR DEVICE STATUS ****"),this.getDeviceStatus()),this.deviceStatusTimerId=setTimeout((function(){e.pollForDeviceStatus()}),this.isDeviceAttached?this.connectedDeviceInterval:this.disconnectedDeviceInterval)}},{key:"_makeRequestTask",value:(d=q(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._makeRequest(t,n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_fetch",value:function(e){return B()(e)}},{key:"_makeRequest",value:(h=q(regeneratorRuntime.mark((function e(t,n){var r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.instance,e.abrupt("return",this._fetch("".concat(this.apiHost).concat(t)).then((function(e){return e.json()})).then((function(e){if(!1===e.ok||"Error"===e.Type_Name){if(404===e.status){if(n){i.isConnected&&i.changeConnectionStatus({isConnected:!1,isConnecting:i.isConnecting}),i.disconnect();var o=new Error("Headset: Failed connection to middleware. Headset features unavailable.");return o.handled=!0,i.logger.info(o),Promise.reject(o)}return i._makeRequestTask(t,!0)}return V.a.isFirefox&&(i.errorCode="browser",i.disableRetry=!0),Promise.reject(e)}return r?(!i.isConnected&&i.changeConnectionStatus({isConnected:!0,isConnecting:i.isConnecting}),e):Promise.reject(new Error("Application destroyed."))})).catch((function(e){return Promise.reject(e)})));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"_checkIsActiveTask",value:(f=q(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getActiveCalls();case 2:t=e.sent,this.isActive=!!t.length;case 4:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"_getActiveCalls",value:(l=q(regeneratorRuntime.mark((function e(){var t,n,r,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._makeRequestTask("/CallServices/CallManagerState?");case 3:i=e.sent,r=i,e.next=11;break;case 7:return e.prev=7,e.t0=e.catch(0),this.logger.info("Error making request for active calls",e.t0),e.abrupt("return",[]);case 11:if(Array.isArray(null===(t=r)||void 0===t||null===(n=t.Result)||void 0===n?void 0:n.Calls)){e.next=13;break}return e.abrupt("return",[]);case 13:return e.abrupt("return",r.Result.Calls.filter((function(e){return e.Source===o.pluginName})));case 14:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return l.apply(this,arguments)})},{key:"getCallEvents",value:(u=q(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._makeRequestTask("/CallServices/CallEvents?name=".concat(this.pluginName));case 3:t=e.sent,e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(0),this.logger.info("Error making request for call events",e.t0),e.abrupt("return");case 10:t.Result&&t.Result.forEach((function(e){var t=H[e.Action];if(!t)return n.logger.info("Unknown call event from headset",{event:e});var r={name:t,code:e.Action,event:e};n.logger.debug("headset info",r),n.callCorrespondingFunction(r)}));case 11:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(){return u.apply(this,arguments)})},{key:"getDeviceStatus",value:(c=q(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._makeRequestTask("/DeviceServices/Info").then((function(e){t._deviceInfo=e.Result})).catch((function(e){e.Err&&e.Err.Description.includes("no supported devices")||t.logger.info("Error making request for device status",e)}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"callCorrespondingFunction",value:function(e){switch(e.name){case"AcceptCall":this.deviceAnsweredCall(e);break;case"RejectCall":this.deviceRejectedCall(this.incomingConversationId);break;case"TerminateCall":this.deviceEndedCall(e);break;case"CallEnded":this._checkIsActiveTask();break;case"Mute":this.deviceMuteChanged(!0,e);break;case"Unmute":this.deviceMuteChanged(!1,e);break;case"HoldCall":this.deviceHoldStatusChanged(!0,e);break;case"ResumeCall":this.deviceHoldStatusChanged(!1,e);break;default:this.logger.info("A headset event has occurred",e),this.deviceEventLogs(e)}}},{key:"connect",value:function(){var e=this;return!this.isConnecting&&this.changeConnectionStatus({isConnected:this.isConnected,isConnecting:!0}),this.pollForDeviceStatus(),this.pollForCallEvents(),this._makeRequestTask("/SessionManager/Register?name=".concat(this.pluginName)).catch((function(t){return t.Err&&"Plugin exists"===t.Err.Description?e.logger.debug("Plugin already exists",t):Promise.reject(t)})).then((function(){return e._makeRequestTask("/SessionManager/IsActive?name=".concat(e.pluginName,"&active=true"))})).catch((function(t){return t.Err&&!t.isError?e.logger.debug("Is Active",t):Promise.reject(t)})).then((function(t){return!0!==(null==t?void 0:t.Result)?Promise.reject(t):e._makeRequestTask("/UserPreference/SetDefaultSoftPhone?name=".concat(e.pluginName))})).then((function(){e.getDeviceStatus()})).then((function(){return e._getActiveCalls()})).then((function(t){return t.length?(e.isActive=!0,e.logger.info("Currently active calls in the session")):e.getCallEvents()})).catch((function(t){return null!=t&&t.handled?e.logger.error("Unable to properly connect headset"):Promise.reject(t)})).finally((function(){e.isConnecting&&e.changeConnectionStatus({isConnected:e.isConnected,isConnecting:!1})}))}},{key:"disconnect",value:function(){var e=this;return(this.isConnected?this._makeRequestTask("/SessionManager/UnRegister?name=".concat(this.pluginName)):Promise.resolve()).then((function(){e.clearTimeouts(),e._deviceInfo=null,e.isConnected&&e.changeConnectionStatus({isConnected:!1,isConnecting:e.isConnecting}),e.isActive=!1}))}},{key:"incomingCall",value:function(e){this.logger.info("Inside incomingCall of selected implementation (Plantronics/Poly)");var t=e.conversationId,n=e.contactName;if(!t)throw new Error("Must provide conversationId");this.incomingConversationId=t;var r="?name=".concat(this.pluginName,"&tones=Unknown&route=ToHeadset"),i='"Id":"'.concat(t,'"');if(r+="&callID={".concat(encodeURI(i),"}"),n){var o='"Name":"'.concat(n,'"');r+="&contact={".concat(encodeURI(o),"}")}return this.logger.info("params of endpoint",r),this.isActive=!0,this._makeRequestTask("/CallServices/IncomingCall".concat(encodeURI(r)))}},{key:"outgoingCall",value:function(e){var t=e.conversationId,n=e.contactName;if(!t)throw new Error("Must provide conversationId");var r="?name=".concat(this.pluginName,"&tones=Unknown&route=ToHeadset"),i='"Id":"'.concat(t,'"');if(r+="&callID={".concat(encodeURI(i),"}"),n){var o='"Name":"'.concat(n,'"');r+="&contact={".concat(encodeURI(o),"}")}return this.isActive=!0,this._makeRequestTask("/CallServices/OutgoingCall".concat(encodeURI(r)))}},{key:"answerCall",value:function(e){var t='"Id":"'.concat(e,'"'),n="?name=".concat(this.pluginName,"&callID={").concat(encodeURI(t),"}");return this.isActive=!0,this.incomingConversationId="",this._makeRequestTask("/CallServices/AnswerCall".concat(encodeURI(n)))}},{key:"rejectCall",value:function(e){return this.incomingConversationId="",this.endCall(e)}},{key:"endCall",value:(a=q(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="?name=".concat(this.pluginName),r='"Id":"'.concat(t,'"'),n+="&callID={".concat(encodeURI(r),"}"),e.next=5,this._makeRequestTask("/CallServices/TerminateCall".concat(encodeURI(n)));case 5:return i=e.sent,e.next=8,this.getCallEvents();case 8:return this._checkIsActiveTask(),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"endAllCalls",value:(s=q(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getActiveCalls();case 2:e.sent.forEach((function(e){return t.endCall(e.CallId)}));case 4:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"setMute",value:(o=q(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._makeRequestTask("/CallServices/MuteCall?name=".concat(this.pluginName,"&muted=").concat(t));case 2:return n=e.sent,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"setHold",value:(i=q(regeneratorRuntime.mark((function e(t,n){var r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r='"Id":"'.concat(t,'"'),i="?name=".concat(this.pluginName,"&callID={").concat(encodeURI(r),"}"),e.next=4,this._makeRequestTask("/CallServices/".concat(n?"HoldCall":"ResumeCall").concat(encodeURI(i)));case 4:return o=e.sent,e.abrupt("return",o);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})}],r=[{key:"getInstance",value:function(e){return v.instance||(v.instance=new v(e)),v.instance}}],n&&z(t.prototype,n),r&&z(t,r),Object.defineProperty(t,"prototype",{writable:!1}),v}(G.a);function ie(){return!!window._HostedContextFunctions}function oe(e){return new Promise((function(t,n){try{var r=JSON.stringify(e);window.cefQuery({request:r,persistent:!1,onSuccess:function(e){try{var n=JSON.parse(e);t(n)}catch(e){t({})}},onFailure:function(e){n(e)}})}catch(e){console.error("Error requesting desktop promise",e),n(e)}}))}function se(e){return(se="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 ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ce(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ue(e,t){return(ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function le(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=de(e);if(t){var i=de(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fe(this,n)}}function fe(e,t){if(t&&("object"===se(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return he(e)}function he(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function de(e){return(de=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}ee(re,"instance",void 0),function(e){e.SocketConnected="SocketConnected",e.EstablishConnection="EstablishConnection",e.SPLogin="SPLoggedIn",e.SPLogout="SPLoggedOut",e.TerminateConnection="TerminateConnection",e.IncomingCall="IncomingCall",e.IncomingCallRejected="InCallRejected",e.IncomingCallAccepted="InCallAccepted",e.OutgoingCall="OutgoingCall",e.CallEnded="CallEnded",e.SystemInformation="SystemInformation",e.HeadsetConnected="HeadsetConnected",e.HeadsetDisconnected="HeadsetDisconnected",e.Hold="CallHold",e.Resume="HeldCallResumed",e.MuteFromApp="MuteHeadset",e.UnmuteFromApp="UnmuteHeadset",e.MuteFromHeadset="MuteSoftphone",e.UnmuteFromHeadset="UnmuteSoftphone"}(te||(te={})),function(e){e.Request="Request",e.Notification="Notification",e.Ack="Acknowledgement"}(ne||(ne={}));var ve=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&ue(e,t)}(o,e);var t,n,r,i=le(o);function o(){var e;ae(this,o);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return pe(he(e=i.call.apply(i,[this].concat(n))),"connectTimeout",5e3),pe(he(e),"vendorName","Sennheiser"),pe(he(e),"isActive",!1),pe(he(e),"devices",null),pe(he(e),"activeDeviceId",null),pe(he(e),"websocketConnected",!1),pe(he(e),"callMappings",{}),pe(he(e),"websocket",null),pe(he(e),"deviceInfo",null),pe(he(e),"webSocketOnOpen",(function(){e.websocketConnected=!0,e.logger.info("websocket open the sennheiser software")})),e}return t=o,r=[{key:"getInstance",value:function(e){return o.instance||(o.instance=new o(e)),o.instance}}],(n=[{key:"deviceLabelMatchesVendor",value:function(e){var t=e.toLowerCase();return["senn","epos"].some((function(e){return t.includes(e)}))}},{key:"deviceName",get:function(){return this.deviceInfo&&this.deviceInfo.ProductName}},{key:"isDeviceAttached",get:function(){return!!this.deviceInfo}},{key:"_handleError",value:function(e){this.logger.error("Non-zero return code from sennheiser",e)}},{key:"_handleAck",value:function(e){this.logger.debug("Received Ack for ".concat(e.Event))}},{key:"_sendMessage",value:function(e){this.logger.debug("sending sennheiser message",e),this.websocket.send(JSON.stringify(e))}},{key:"_registerSoftphone",value:function(){var e={Event:te.EstablishConnection,EventType:ne.Request,SPName:"Genesys Cloud Softphone",SPIconImage:"SPImage.ico",RedialSupport:"No",OffHookSupport:"No",MuteSupport:"Yes",DNDOption:"No"};this._sendMessage(e)}},{key:"connect",value:function(){!this.isConnecting&&this.changeConnectionStatus({isConnected:!1,isConnecting:!0});var e=new WebSocket("wss://127.0.0.1:41088");return e.onopen=this.webSocketOnOpen.bind(this),e.onclose=this.webSocketOnClose.bind(this),e.onmessage=this._handleMessage.bind(this),this.websocket=e,Promise.resolve()}},{key:"webSocketOnClose",value:function(e){this.websocketConnected=!1,e.wasClean||this.logger.error(e),this.isConnected||(this.logger.error(new Error("Failed to connect to sennheiser software. Make sure it is installed")),V.a.isFireFox&&(this.errorCode="browser",this.disableRetry=!0)),(this.isConnected||this.isConnecting)&&this.changeConnectionStatus({isConnected:!1,isConnecting:!1})}},{key:"disconnect",value:function(){return this.isConnected?(this._sendMessage({Event:te.TerminateConnection,EventType:ne.Request}),Promise.resolve()):Promise.resolve()}},{key:"_createCallMapping",value:function(e){var t,n=Math.round(Math.random()*Math.pow(10,7));return this.callMappings=(pe(t={},e,n),pe(t,n,e),t),this.logger.info("Created callId mapping for sennheiser headset",{conversationId:e,sennheiserCallId:n}),n}},{key:"setMute",value:function(e){return this._sendMessage({Event:e?te.MuteFromApp:te.UnmuteFromApp,EventType:ne.Request}),Promise.resolve()}},{key:"setHold",value:function(e,t){return this._sendMessage({Event:t?te.Hold:te.Resume,EventType:ne.Request,CallID:this.callMappings[e]}),Promise.resolve()}},{key:"incomingCall",value:function(e){var t=e.conversationId,n=this._createCallMapping(t);return this._sendMessage({Event:te.IncomingCall,EventType:ne.Request,CallID:n}),Promise.resolve()}},{key:"answerCall",value:function(e){return this._sendMessage({Event:te.IncomingCallAccepted,EventType:ne.Request,CallID:this.callMappings[e]}),Promise.resolve()}},{key:"rejectCall",value:function(e){return this._sendMessage({Event:te.IncomingCallRejected,EventType:ne.Request,CallID:this.callMappings[e]}),Promise.resolve()}},{key:"outgoingCall",value:function(e){var t=e.conversationId,n=this._createCallMapping(t);return this._sendMessage({Event:te.OutgoingCall,EventType:ne.Request,CallID:n}),Promise.resolve()}},{key:"endCall",value:function(e){var t=this.callMappings[e];return t?(this._sendMessage({Event:te.CallEnded,EventType:ne.Request,CallID:t}),Promise.resolve()):(this.logger.info("Failed to find sennheiser callId, assuming call was already ended"),Promise.resolve())}},{key:"endAllCalls",value:function(){return this.logger.warn("There is no functionality defined for SennheiserService.endAllCalls()"),Promise.resolve()}},{key:"_handleMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(t){return this.logger.error(t),void this.logger.error("Failed to parse sennheiser payload",{message:e})}if(this.logger.debug("incoming sennheiser message",t),t.ReturnCode)this._handleError(t);else{var n,r=t.CallID;switch(r&&(n=this.callMappings[r]),t.Event){case te.SocketConnected:this._registerSoftphone();break;case te.EstablishConnection:this._sendMessage({Event:te.SPLogin,EventType:ne.Request});break;case te.SPLogin:this.isConnected&&!this.isConnecting||this.changeConnectionStatus({isConnected:!0,isConnecting:!1}),this._sendMessage({Event:te.SystemInformation,EventType:ne.Request});break;case te.HeadsetConnected:t.HeadsetName&&(this.deviceInfo={deviceName:t.HeadsetName,headsetType:t.HeadsetType});break;case te.HeadsetDisconnected:t.HeadsetName===this.deviceName&&(this.deviceInfo=null);break;case te.IncomingCallAccepted:t.EventType===ne.Notification&&this.deviceAnsweredCall({name:t.Event});break;case te.Hold:if(t.EventType===ne.Ack){this._handleAck(t);break}this.deviceHoldStatusChanged(!0,{name:t.Event});break;case te.Resume:if(t.EventType===ne.Ack){this._handleAck(t);break}this.deviceHoldStatusChanged(!1,{name:t.Event});break;case te.MuteFromHeadset:this.deviceMuteChanged(!0,{name:t.Event});break;case te.UnmuteFromHeadset:this.deviceMuteChanged(!1,{name:t.Event});break;case te.CallEnded:delete this.callMappings[r],delete this.callMappings[n],t.EventType===ne.Notification&&this.deviceEndedCall({name:t.Event});break;case te.IncomingCallRejected:this.deviceRejectedCall(n);break;case te.TerminateConnection:1===this.websocket.readyState&&this.websocket.close(),this.websocket=null;break;default:t.EventType===ne.Ack&&this._handleAck(t)}}}}])&&ce(t.prototype,n),r&&ce(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(G.a);pe(ve,"instance",void 0);var ge=n(0),ye=u((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function me(e,t){var n="object"==typeof t;return new Promise((function(r,i){var o=new k({next:function(e){r(e),o.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new ye)}});e.subscribe(o)}))}function be(e){return function(t){if(function(e){return c(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}var Ee=function(e){function t(t,n,r,i,o){var s=e.call(this,t)||this;return s.onFinalize=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return i(t,e),t.prototype.unsubscribe=function(){var t,n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))},t}(T);function we(e,t){return be((function(n,r){var i=0;n.subscribe(new Ee(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}var _e=new L((function(e){return e.complete()}));function Ce(e){return e<=0?function(){return _e}:be((function(t,n){var r=0;t.subscribe(new Ee(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function Oe(e){return be((function(t,n){var r=!1;t.subscribe(new Ee(n,(function(e){r=!0,n.next(e)}),(function(){r||n.next(e),n.complete()})))}))}function Te(e){return void 0===e&&(e=ke),be((function(t,n){var r=!1;t.subscribe(new Ee(n,(function(e){r=!0,n.next(e)}),(function(){return r?n.complete():n.error(e())})))}))}function ke(){return new ye}function Ie(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?we((function(t,n){return e(t,n,r)})):N,Ce(1),n?Oe(t):Te((function(){return new ye})))}}function Re(e){return(Re="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 Ae(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Se(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){Ae(o,r,i,s,a,"next",e)}function a(e){Ae(o,r,i,s,a,"throw",e)}s(void 0)}))}}function Pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ne(e,t){return(Ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function De(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=He(e);if(t){var i=He(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Le(this,n)}}function Le(e,t){if(t&&("object"===Re(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return xe(e)}function xe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function He(e){return(He=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Me,je=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&Ne(e,t)}(y,e);var t,n,r,i,o,s,a,c,u,l,f,h,d,p,v,g=De(y);function y(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,y),Ue(xe(t=g.call(this,e)),"headsetEventSubscription",void 0),Ue(xe(t),"isActive",!1),Ue(xe(t),"devices",void 0),Ue(xe(t),"activeDeviceId",null),Ue(xe(t),"isMuted",!1),Ue(xe(t),"isHeld",!1),Ue(xe(t),"version",null),Ue(xe(t),"_connectDeferred",void 0),Ue(xe(t),"device",null),Ue(xe(t),"jabraSdk",void 0),Ue(xe(t),"easyCallControlFactory",void 0),Ue(xe(t),"callControlFactory",void 0),Ue(xe(t),"multiCallControl",void 0),Ue(xe(t),"callControl",void 0),Ue(xe(t),"ongoingCalls",0),Ue(xe(t),"callLock",!1),Ue(xe(t),"incomingConversationId",""),t.vendorName="Jabra",t.devices=new Map,t}return t=y,n=[{key:"isSupported",value:function(){return window.navigator.hid&&!ie()}},{key:"deviceLabelMatchesVendor",value:function(e){var t=e.toLowerCase();return!!["jabra"].some((function(e){return t.includes(e)}))&&(this.jabraSdk=this.initializeJabraSdk(),!0)}},{key:"deviceInfo",get:function(){return null===this.activeDeviceId||0===this.devices.size?null:this.devices.get(this.activeDeviceId)}},{key:"deviceName",get:function(){return this.deviceInfo.deviceName}},{key:"isDeviceAttached",get:function(){return!!this.deviceInfo}},{key:"resetState",value:function(){this.setHold(null,!1),this.setMute(!1)}},{key:"_processEvents",value:(v=Se(regeneratorRuntime.mark((function e(t){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.headsetEventSubscription=t.deviceSignals.subscribe(function(){var e=Se(regeneratorRuntime.mark((function e(r){var i,o,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.callLock){e.next=3;break}return n.logger.debug("Currently not in possession of the Call Lock; Cannot react to Device Actions"),e.abrupt("return");case 3:e.t0=ge.u[r.type],e.next="HOOK_SWITCH"===e.t0?6:"FLASH"===e.t0||"ALT_HOLD"===e.t0?8:"PHONE_MUTE"===e.t0?12:"REJECT_CALL"===e.t0?16:19;break;case 6:if(r.value)t.offHook(!0),t.ring(!1),n.deviceAnsweredCall({name:"CallOffHook",code:r.type});else{t.mute(!1),t.hold(!1),t.offHook(!1),n.deviceEndedCall({name:"CallOnHook",code:r.type});try{t.releaseCallLock()}catch(e){i=e.message,o=e.type,n.checkForCallLockError(i,o)?n.logger.info(i):n.logger.error(o,i)}finally{n.callLock=!1}}return e.abrupt("break",19);case 8:return n.isHeld=!n.isHeld,t.hold(n.isHeld),n.deviceHoldStatusChanged(n.isHeld,{name:n.isHeld?"OnHold":"ResumeCall",code:r.type}),e.abrupt("break",19);case 12:return n.isMuted=!n.isMuted,t.mute(n.isMuted),n.deviceMuteChanged(n.isMuted,{name:n.isMuted?"CallMuted":"CallUnmuted",code:r.type}),e.abrupt("break",19);case 16:t.ring(!1),n.deviceRejectedCall(n.incomingConversationId);try{t.releaseCallLock()}catch(e){s=e.message,a=e.type,n.checkForCallLockError(s,a)?n.logger.info(s):n.logger.error(a,s)}finally{n.callLock=!1}case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"setMute",value:(p=Se(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.callLock){e.next=2;break}return e.abrupt("return");case 2:this.isMuted=t,this.callControl.mute(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"setHold",value:(d=Se(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.callLock){e.next=2;break}return e.abrupt("return");case 2:this.isHeld=n,this.callControl.hold(n);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"incomingCall",value:(h=Se(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=16;break}return this.incomingConversationId=t.conversationId,e.prev=2,e.next=5,this.callControl.takeCallLock();case 5:if(this.callLock=e.sent,!this.callLock){e.next=9;break}return this.callControl.ring(!0),e.abrupt("return",Promise.resolve());case 9:e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),n=e.t0.message,r=e.t0.type,this.checkForCallLockError(n,r)?(this.logger.info(n),this.callControl.ring(!0)):this.logger.error(r,n);case 16:case"end":return e.stop()}}),e,this,[[2,11]])}))),function(e){return h.apply(this,arguments)})},{key:"answerCall",value:(f=Se(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.callLock){e.next=2;break}return e.abrupt("return");case 2:this.incomingConversationId="",this.callControl.offHook(!0);case 4:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"rejectCall",value:(l=Se(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.callLock){e.next=3;break}return e.abrupt("return",this.logger.info("Currently not in possession of the Call Lock; Cannot react to Device Actions"));case 3:this.callControl.ring(!1),this.callControl.releaseCallLock(),e.next=12;break;case 7:e.prev=7,e.t0=e.catch(0),t=e.t0.message,n=e.t0.type,this.checkForCallLockError(t,n)?this.logger.info(t):this.logger.error(n,t);case 12:return e.prev=12,this.incomingConversationId="",this.callLock=!1,this.resetState(),e.finish(12);case 17:case"end":return e.stop()}}),e,this,[[0,7,12,17]])}))),function(){return l.apply(this,arguments)})},{key:"outgoingCall",value:(u=Se(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.callControl.takeCallLock();case 3:if(this.callLock=e.sent,!this.callLock){e.next=7;break}return this.callControl.offHook(!0),e.abrupt("return",Promise.resolve());case 7:e.next=14;break;case 9:e.prev=9,e.t0=e.catch(0),t=e.t0.message,n=e.t0.type,this.checkForCallLockError(t,n)?(this.logger.info(t),this.callControl.offHook(!0)):this.logger.error(n,t);case 14:case"end":return e.stop()}}),e,this,[[0,9]])}))),function(){return u.apply(this,arguments)})},{key:"endCall",value:(c=Se(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=2;break}return e.abrupt("return");case 2:if(e.prev=2,this.callLock){e.next=5;break}return e.abrupt("return",this.logger.info("Currently not in possession of the Call Lock; Cannot react to Device Actions"));case 5:this.callControl.offHook(!1),this.callControl.releaseCallLock(),e.next=14;break;case 9:e.prev=9,e.t0=e.catch(2),r=e.t0.message,i=e.t0.type,this.checkForCallLockError(r,i)?this.logger.info(r):this.logger.error(i,r);case 14:return e.prev=14,this.callLock=!1,this.resetState(),e.finish(14);case 18:case"end":return e.stop()}}),e,this,[[2,9,14,18]])}))),function(e,t){return c.apply(this,arguments)})},{key:"endAllCalls",value:(a=Se(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.callLock){e.next=3;break}return e.abrupt("return",this.logger.info("Currently not in possession of the Call Lock; Cannot react to Device Actions"));case 3:this.callControl.offHook(!1),this.callControl.releaseCallLock(),e.next=12;break;case 7:e.prev=7,e.t0=e.catch(0),t=e.t0.message,n=e.t0.type,this.checkForCallLockError(t,n)?this.logger.info(t):this.logger.error(n,t);case 12:return e.prev=12,this.callLock=!1,this.resetState(),e.finish(12);case 16:case"end":return e.stop()}}),e,this,[[0,7,12,16]])}))),function(){return a.apply(this,arguments)})},{key:"isDeviceInList",value:function(e,t){var n;return t.includes(null==e||null===(n=e.name)||void 0===n?void 0:n.toLowerCase())}},{key:"connect",value:(s=Se(regeneratorRuntime.mark((function e(t){var n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.toLowerCase(),this.isConnecting||this.changeConnectionStatus({isConnected:this.isConnected,isConnecting:!0}),e.next=4,this.jabraSdk;case 4:n=e.sent,this.callControlFactory=this.createCallControlFactory(n),r=setTimeout(Se(regeneratorRuntime.mark((function e(){var o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,me(n.deviceList);case 2:if(o=e.sent,s=o.find((function(e){return i.isDeviceInList(e,t)}))){e.next=16;break}return e.prev=5,e.next=8,new Promise((function(e,r){var o,s,a=setTimeout(r,3e4);i.requestWebHidPermissions(ge.D),n.deviceList.pipe((o=function(e){return e.find((function(e){return i.isDeviceInList(e,t)}))},be((function(e,t){var n=0;e.subscribe(new Ee(t,(function(e){t.next(o.call(s,e,n++))})))}))),we(Boolean),Ie()).subscribe((function(t){clearTimeout(a),e(t)}))}));case 8:s=e.sent,e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(5),i.isConnecting&&i.changeConnectionStatus({isConnected:i.isConnected,isConnecting:!1}),i.logger.error("The selected device was not granted WebHID permissions"),e.abrupt("return");case 16:return e.next=18,i.callControlFactory.createCallControl(s);case 18:i.callControl=e.sent,i._processEvents(i.callControl),i.isConnecting&&!i.isConnected&&i.changeConnectionStatus({isConnected:!0,isConnecting:!1}),clearTimeout(r);case 22:case"end":return e.stop()}}),e,null,[[5,11]])}))),2e3);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"initializeJabraSdk",value:(o=Se(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(ge.C)({appId:"softphone-vendor-headsets",appName:"Softphone Headset Library",transport:ge.z.CHROME_EXTENSION_WITH_WEB_HID_FALLBACK});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{key:"createCallControlFactory",value:function(e){return new ge.a(e)}},{key:"checkForCallLockError",value:function(e,t){return t===ge.b.SDK_USAGE_ERROR&&e.includes("call lock")}},{key:"disconnect",value:(i=Se(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.headsetEventSubscription&&this.headsetEventSubscription.unsubscribe(),(this.isConnected||this.isConnecting)&&this.changeConnectionStatus({isConnected:!1,isConnecting:!1});case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})}],r=[{key:"getInstance",value:function(e){return y.instance||(y.instance=new y(e)),y.instance}}],n&&Pe(t.prototype,n),r&&Pe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),y}(G.a);Ue(je,"instance",void 0),Ue(je,"connectTimeout",5e3),function(e){e.Ring="ringer",e.Offhook="offhook",e.Mute="mute",e.Hold="hold"}(Me||(Me={}));var Fe;function Be(e){return(Be="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 Ge(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ve(e,t){return(Ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function We(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ze(e);if(t){var i=ze(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Ke(this,n)}}function Ke(e,t){if(t&&("object"===Be(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return qe(e)}function qe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ze(e){return(ze=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.OffHook="OffHook",e.Mute="Mute",e.Hold="Flash",e.RejectCall="RejectCall"}(Fe||(Fe={}));var Je=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),t&&Ve(e,t)}(a,e);var t,n,r,i,o,s=We(a);function a(e){var t,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),$e(qe(n=s.call(this,e)),"isActive",!1),$e(qe(n),"devices",null),$e(qe(n),"activeDeviceId",null),$e(qe(n),"headsetState",null),$e(qe(n),"ignoreNextOffhookEvent",!1),$e(qe(n),"_connectionInProgress",void 0),$e(qe(n),"cefSupportsJabra",!0),$e(qe(n),"incomingConversationId",""),n.vendorName="Jabra",n.headsetState={ringing:!1,offHook:!1},n.devices=new Map;var r={assetURL:window.location.origin+window.location.pathname,callback:n.handleCefEvent.bind(qe(n)),supportsTerminationRequest:!0,supportsUnifiedPreferences:!0},i=null===(t=window._HostedContextFunctions)||void 0===t?void 0:t.register(r);return n.cefSupportsJabra=null==i?void 0:i.supportsJabra,n}return t=a,n=[{key:"deviceInfo",get:function(){return null===this.activeDeviceId||null===this.devices||this.devices&&!this.devices.size?null:this.devices.get(this.activeDeviceId)}},{key:"deviceName",get:function(){return this.deviceInfo&&this.deviceInfo.deviceName}},{key:"isDeviceAttached",get:function(){return!!this.deviceInfo}},{key:"isHeadsetEvent",value:function(e){return"JabraEvent"===e.msg}},{key:"isDeviceEvent",value:function(e){return"JabraDeviceAttached"===e.msg}},{key:"handleCefEvent",value:function(e){this.isConnected&&(this.isDeviceEvent(e)?this.handleJabraDeviceAttached(e):this.isHeadsetEvent(e)&&this.handleJabraEvent(e))}},{key:"handleJabraDeviceAttached",value:function(e){this.logger.debug("handling jabra attach/detach event",e),this.updateDevices()}},{key:"handleJabraEvent",value:function(e){this.logger.debug("Jabra event received",e),this._processEvent(e.event,e.value)}},{key:"_handleOffhookEvent",value:function(e){e?this.headsetState.ringing&&(this.deviceAnsweredCall(),this._sendCmd(Me.Offhook,e),this._setRinging(!1)):(this._sendCmd(Me.Offhook,e),this._getHeadsetIntoVanillaState(),this.deviceEndedCall())}},{key:"_handleMuteEvent",value:function(e){this._sendCmd(Me.Mute,e),this.deviceMuteChanged(e)}},{key:"_handleHoldEvent",value:function(e){this._sendCmd(Me.Hold,!!e),this.deviceHoldStatusChanged(!!e)}},{key:"_getHeadsetIntoVanillaState",value:function(){this.setHold(null,!1),this.setMute(!1)}},{key:"_sendCmd",value:function(e,t){var n=this.activeDeviceId;this.logger.debug("Sending command to headset",{deviceId:n,cmd:e,value:t}),window._HostedContextFunctions.sendEventToDesktop("jabraEvent",{deviceID:n,event:e,value:t})}},{key:"_setRinging",value:function(e){this._sendCmd(Me.Ring,e),this.headsetState.ringing=e}},{key:"isSupported",value:function(){return ie()&&this.cefSupportsJabra}},{key:"deviceLabelMatchesVendor",value:function(e){var t=e.toLowerCase();return["jabra"].some((function(e){return t.includes(e)}))}},{key:"setMute",value:function(e){return this._sendCmd(Me.Mute,e),Promise.resolve()}},{key:"setHold",value:function(e,t){return this._sendCmd(Me.Hold,t),Promise.resolve()}},{key:"incomingCall",value:function(e){return e&&(this.incomingConversationId=e.conversationId),this._setRinging(!0),Promise.resolve()}},{key:"answerCall",value:function(){return this.ignoreNextOffhookEvent=!0,this.incomingConversationId="",this._sendCmd(Me.Offhook,!0),Promise.resolve()}},{key:"rejectCall",value:function(){return this._setRinging(!1),this.incomingConversationId="",Promise.resolve()}},{key:"outgoingCall",value:function(){return this._sendCmd(Me.Offhook,!0),Promise.resolve()}},{key:"endCall",value:function(e,t){return this._setRinging(!1),t||this._sendCmd(Me.Offhook,!1),Promise.resolve()}},{key:"endAllCalls",value:function(){return this._setRinging(!1),this._sendCmd(Me.Offhook,!1),Promise.resolve()}},{key:"updateDevices",value:(i=regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,oe({cmd:"requestJabraDevices"});case 3:if(t=e.sent,this._connectionInProgress&&this._connectionInProgress.resolve(),this.changeConnectionStatus({isConnected:!0,isConnecting:!1}),t&&t.length){e.next=11;break}return this.devices.clear(),this.activeDeviceId=null,this.logger.error(new Error("No attached jabra devices")),e.abrupt("return");case 11:this.logger.info("connected jabra devices",t),this.devices.clear(),t.forEach((function(e){return n.devices.set(e.deviceID,e)})),this.activeDeviceId=t[0].deviceID,this._setRinging(!1),this.setMute(!1),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(0),this.logger.error("Failed to connect to jabra",e.t0),this.disconnect();case 23:case"end":return e.stop()}}),e,this,[[0,19]])})),o=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=i.apply(e,t);function s(e){Ge(o,n,r,s,a,"next",e)}function a(e){Ge(o,n,r,s,a,"throw",e)}s(void 0)}))},function(){return o.apply(this,arguments)})},{key:"_processEvent",value:function(e,t){var n,r,i,o=this;switch(e){case Fe.OffHook:(n=function(){return o._handleOffhookEvent(t)},r=500,i=null,function(){clearTimeout(i),i=setTimeout((function(){n()}),r)})();break;case Fe.RejectCall:this.deviceRejectedCall(this.incomingConversationId);break;case Fe.Mute:this._handleMuteEvent(t);break;case Fe.Hold:this._handleHoldEvent(t)}}},{key:"connect",value:function(){var e,t,n,r,i,o=this;return this.changeConnectionStatus({isConnected:!1,isConnecting:!0}),(e=this.updateDevices(),t=5e3,i=new Promise((function(e,i){r=setTimeout((function(){clearTimeout(r),i(n||"Timed out in "+t+"ms")}),t)})).then((function(e){return clearTimeout(r),e})),Promise.race([e,i])).catch((function(e){o.logger.error("Failed to connect to Jabra",e)}))}},{key:"disconnect",value:function(){return this.changeConnectionStatus({isConnected:!1,isConnecting:!1}),Promise.resolve()}}],r=[{key:"getInstance",value:function(e){return a.instance&&!e.createNew||(a.instance=new a(e)),a.instance}}],n&&Ye(t.prototype,n),r&&Ye(t,r),Object.defineProperty(t,"prototype",{writable:!1}),a}(G.a);$e(Je,"instance",void 0);var Xe=n(1);function Qe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(n),!0).forEach((function(t){nt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function et(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function tt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rt=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),nt(this,"plantronics",void 0),nt(this,"jabraNative",void 0),nt(this,"jabra",void 0),nt(this,"sennheiser",void 0),nt(this,"selectedImplementation",void 0),nt(this,"headsetEvents$",void 0),nt(this,"_headsetEvents$",void 0),nt(this,"logger",void 0),this._headsetEvents$=new M,this.headsetEvents$=this._headsetEvents$.asObservable(),this.logger=t.logger||console,this.plantronics=re.getInstance({logger:this.logger}),this.jabraNative=Je.getInstance({logger:this.logger}),this.jabra=je.getInstance({logger:this.logger}),this.sennheiser=ve.getInstance({logger:this.logger}),[this.plantronics,this.jabra,this.jabraNative,this.sennheiser].forEach((function(e){return n.subscribeToHeadsetEvents(e)}))}var t,n,r,i,o;return t=e,n=[{key:"implementations",get:function(){return[this.sennheiser,this.plantronics,this.jabra,this.jabraNative].filter((function(e){return e.isSupported()}))}},{key:"activeMicChange",value:function(e){if(e){var t=this.implementations.find((function(t){return t.deviceLabelMatchesVendor(e)}));t?this.changeImplementation(t,e):this.clearSelectedImplementation()}else this.clearSelectedImplementation()}},{key:"changeImplementation",value:(i=regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==this.selectedImplementation){e.next=2;break}return e.abrupt("return");case 2:if(!this.selectedImplementation){e.next=5;break}return e.next=5,this.selectedImplementation.disconnect();case 5:if(this.selectedImplementation=t,!t){e.next=9;break}return e.next=9,t.connect(n);case 9:this._headsetEvents$.next({event:Xe.a.implementationChanged,payload:t});case 10:case"end":return e.stop()}}),e,this)})),o=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=i.apply(e,t);function s(e){et(o,n,r,s,a,"next",e)}function a(e){et(o,n,r,s,a,"throw",e)}s(void 0)}))},function(e,t){return o.apply(this,arguments)})},{key:"incomingCall",value:function(e,t){return this.performActionIfConnected("incomingCall",(function(n){return n.incomingCall(e,t)}))}},{key:"outgoingCall",value:function(e){return this.performActionIfConnected("outgoingCall",(function(t){return t.outgoingCall(e)}))}},{key:"answerCall",value:function(e){return this.performActionIfConnected("answerCall",(function(t){return t.answerCall(e)}))}},{key:"rejectCall",value:function(e){return this.performActionIfConnected("rejectCall",(function(t){return t.rejectCall(e)}))}},{key:"setMute",value:function(e){return this.performActionIfConnected("setMute",(function(t){return t.setMute(e)}))}},{key:"setHold",value:function(e,t){return this.performActionIfConnected("setHold",(function(n){return n.setHold(e,t)}))}},{key:"endCall",value:function(e,t){return this.performActionIfConnected("endCall",(function(n){return n.endCall(e,t)}))}},{key:"endAllCalls",value:function(){return this.performActionIfConnected("endAllCalls",(function(e){return e.endAllCalls()}))}},{key:"retryConnection",value:function(e){return this.selectedImplementation?this.selectedImplementation.connect(e):Promise.reject(new Error("No active headset implementation"))}},{key:"connectionStatus",value:function(){return this.selectedImplementation?this.selectedImplementation.isConnected||this.selectedImplementation.isConnecting?this.selectedImplementation.isConnected?"running":"checking":"notRunning":"noVendor"}},{key:"performActionIfConnected",value:function(e,t){var n=this.selectedImplementation;return n&&n.isConnected?t(n):(this.logger.info("Headset: No vendor headset connected [".concat(e,"]")),Promise.resolve())}},{key:"subscribeToHeadsetEvents",value:function(e){e.on(Xe.a.deviceAnsweredCall,this.handleDeviceAnsweredCall.bind(this)),e.on(Xe.a.deviceRejectedCall,this.handleDeviceRejectedCall.bind(this)),e.on(Xe.a.deviceEndedCall,this.handleDeviceEndedCall.bind(this)),e.on(Xe.a.deviceMuteChanged,this.handleDeviceMuteStatusChanged.bind(this)),e.on(Xe.a.deviceHoldStatusChanged,this.handleDeviceHoldStatusChanged.bind(this)),e.on(Xe.a.deviceEventLogs,this.handleDeviceLogs.bind(this)),e.on(Xe.a.deviceConnectionStatusChanged,this.handleDeviceConnectionStatusChanged.bind(this)),e.on(Xe.a.webHidPermissionRequested,this.handleWebHidPermissionRequested.bind(this))}},{key:"clearSelectedImplementation",value:function(){this.selectedImplementation&&this.selectedImplementation.disconnect(),this.selectedImplementation=null,this.handleDeviceConnectionStatusChanged()}},{key:"handleDeviceAnsweredCall",value:function(e){e.vendor===this.selectedImplementation&&(this.logger.info("Headset: device answered the call"),this._headsetEvents$.next({event:Xe.a.deviceAnsweredCall,payload:Ze({},e.body)}))}},{key:"handleDeviceRejectedCall",value:function(e){e.vendor===this.selectedImplementation&&(this.logger.info("Headset: device rejected the call"),this._headsetEvents$.next({event:Xe.a.deviceRejectedCall,payload:{conversationId:e.body.conversationId}}))}},{key:"handleDeviceEndedCall",value:function(e){this.logger.info("Headset: device ended the call"),this._headsetEvents$.next({event:Xe.a.deviceEndedCall,payload:Ze({},e.body)})}},{key:"handleDeviceMuteStatusChanged",value:function(e){this.logger.info("Headset: device mute status changed: ",e.body.isMuted),this._headsetEvents$.next({event:Xe.a.deviceMuteStatusChanged,payload:Ze({},e.body)})}},{key:"handleDeviceHoldStatusChanged",value:function(e){this.logger.info("Headset: device hold status changed",e.body.holdRequested),this._headsetEvents$.next({event:Xe.a.deviceHoldStatusChanged,payload:Ze({},e.body)})}},{key:"handleDeviceConnectionStatusChanged",value:function(){this._headsetEvents$.next({event:Xe.a.deviceConnectionStatusChanged,payload:this.connectionStatus()})}},{key:"handleWebHidPermissionRequested",value:function(e){this.logger.debug("Requesting Webhid Permissions"),this._headsetEvents$.next({event:Xe.a.webHidPermissionRequested,payload:Ze({},e.body)})}},{key:"handleDeviceLogs",value:function(e){this._headsetEvents$.next({event:Xe.a.loggableEvent,payload:Ze({},e.body)})}}],r=[{key:"getInstance",value:function(t){return e.instance&&!t.createNew||(e.instance=new e(t)),e.instance}}],n&&tt(t.prototype,n),r&&tt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();nt(rt,"instance",void 0)},function(e,t,n){"use strict";n.r(t);var r=n(11),i=n(2);n.d(t,"VendorImplementation",(function(){return i.a}));var o=n(6);for(var s in o)["default","VendorImplementation"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);var a=n(1);n.d(t,"HeadsetEvents",(function(){return a.a}));var c=n(7);for(var s in c)["default","VendorImplementation","HeadsetEvents"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return c[e]}))}(s);n(8);var u=n(9);for(var s in u)["default","VendorImplementation","HeadsetEvents"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return u[e]}))}(s);t.default=r.a},,function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],l=!1,f=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&d())}function d(){if(!l){var e=a(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||l||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";(function(e){
54
+ e.exports=function(){var e=function(e,t,n,r,i,o){for(var s=function(e,t){var n=e.toString(16);return n.length<2&&(n="0"+n),t&&(n=n.toUpperCase()),n},a=t;a<=n;a++)i[o++]=s(e[a],r);return i},t=function(e,t,n,r,i){for(var o=t;o<=n;o+=2)r[i++]=parseInt(e.substr(o,2),16)},n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#".split(""),r=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,77,0,78,67,0,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,79,0,80,0,0],o=function(e,t){if(t%4!=0)throw new Error("z85_encode: invalid input length (multiple of 4 expected)");for(var r="",i=0,o=0;i<t;)if(o=256*o+e[i++],i%4==0){for(var s=52200625;s>=1;){var a=Math.floor(o/s)%85;r+=n[a],s/=85}o=0}return r},s=function(e,t){var n=e.length;if(n%5!=0)throw new Error("z85_decode: invalid input length (multiple of 5 expected)");void 0===t&&(t=new Array(4*n/5));for(var i=0,o=0,s=0;i<n;){var a=e.charCodeAt(i++)-32;if(a<0||a>=r.length)break;if(s=85*s+r[a],i%5==0){for(var c=16777216;c>=1;)t[o++]=Math.trunc(s/c%256),c/=256;s=0}}return t},a=function(e,t){var n={ibits:8,obits:8,obigendian:!0};for(var r in t)void 0!==n[r]&&(n[r]=t[r]);for(var i,o,s,a=[],c=0,u=0,l=0,f=e.length;0===u&&(o=e.charCodeAt(c++)),i=o>>n.ibits-(u+8)&255,u=(u+8)%n.ibits,n.obigendian?0===l?s=i<<n.obits-8:s|=i<<n.obits-8-l:0===l?s=i:s|=i<<l,!(0==(l=(l+8)%n.obits)&&(a.push(s),c>=f)););return a},c=function(e,t){var n={ibits:32,ibigendian:!0};for(var r in t)void 0!==n[r]&&(n[r]=t[r]);var i="",o=4294967295;n.ibits<32&&(o=(1<<n.ibits)-1);for(var s=e.length,a=0;a<s;a++)for(var c=e[a]&o,u=0;u<n.ibits;u+=8)n.ibigendian?i+=String.fromCharCode(c>>n.ibits-8-u&255):i+=String.fromCharCode(c>>u&255);return i},u=256,l=function(e,t,n,r,i,o,s,a){return[a,s,o,i,r,n,t,e]},f=function(){return l(0,0,0,0,0,0,0,0)},h=function(e){return e.slice(0)},d=function(e){for(var t=f(),n=0;n<8;n++)t[n]=Math.floor(e%u),e/=u;return t},p=function(e){for(var t=0,n=7;n>=0;n--)t*=u,t+=e[n];return Math.floor(t)},v=function(e,t){for(var n=0,r=0;r<8;r++)n+=e[r]+t[r],e[r]=Math.floor(n%u),n=Math.floor(n/u);return n},y=function(e,t){for(var n=0,r=0;r<8;r++)n+=e[r]*t,e[r]=Math.floor(n%u),n=Math.floor(n/u);return n},g=function(e,t){for(var n=0;n<8;n++)e[n]&=t[n];return e},m=function(e,t){var n=f();if(t%8!=0)throw new Error("ui64_rorn: only bit rotations supported with a multiple of digit bits");for(var r=Math.floor(t/8),i=0;i<r;i++){for(var o=6;o>=0;o--)n[o+1]=n[o];for(n[0]=e[0],o=0;o<7;o++)e[o]=e[o+1];e[o]=0}return p(n)},b=function(e,t){if(t>64)throw new Error("ui64_ror: invalid number of bits to shift");var n,r=new Array(16);for(n=0;n<8;n++)r[n+8]=e[n],r[n]=0;var i=Math.floor(t/8),o=t%8;for(n=i;n<15;n++)r[n-i]=255&(r[n]>>>o|r[n+1]<<8-o);for(r[15-i]=r[15]>>>o&255,n=15-i+1;n<16;n++)r[n]=0;for(n=0;n<8;n++)e[n]=r[n+8];return r.slice(0,8)},w=function(e,t){for(var n=0;n<8;n++)e[n]^=t[n]},E=function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},_=function(e,t){return e<<t&4294967295|e>>>32-t&4294967295},C=function(e){return c(function(e,t){function n(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function r(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var i=Array(80),o=1732584193,s=-271733879,a=-1732584194,c=271733878,u=-1009589776,l=0;l<e.length;l+=16){for(var f=o,h=s,d=a,p=c,v=u,y=0;y<80;y++){i[y]=y<16?e[l+y]:_(i[y-3]^i[y-8]^i[y-14]^i[y-16],1);var g=E(E(_(o,5),n(y,s,a,c)),E(E(u,i[y]),r(y)));u=c,c=a,a=_(s,30),s=o,o=g}o=E(o,f),s=E(s,h),a=E(a,d),c=E(c,p),u=E(u,v)}return[o,s,a,c,u]}(a(e,{ibits:8,obits:32,obigendian:!0}),8*e.length),{ibits:32,ibigendian:!0})},O=function(e){return c(function(e,t){function n(e,t,n,r,i,o){return E(_(E(E(t,e),E(r,o)),i),n)}function r(e,t,r,i,o,s,a){return n(t&r|~t&i,e,t,o,s,a)}function i(e,t,r,i,o,s,a){return n(t&i|r&~i,e,t,o,s,a)}function o(e,t,r,i,o,s,a){return n(t^r^i,e,t,o,s,a)}function s(e,t,r,i,o,s,a){return n(r^(t|~i),e,t,o,s,a)}e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var a=1732584193,c=-271733879,u=-1732584194,l=271733878,f=0;f<e.length;f+=16){var h=a,d=c,p=u,v=l;a=r(a,c,u,l,e[f+0],7,-680876936),l=r(l,a,c,u,e[f+1],12,-389564586),u=r(u,l,a,c,e[f+2],17,606105819),c=r(c,u,l,a,e[f+3],22,-1044525330),a=r(a,c,u,l,e[f+4],7,-176418897),l=r(l,a,c,u,e[f+5],12,1200080426),u=r(u,l,a,c,e[f+6],17,-1473231341),c=r(c,u,l,a,e[f+7],22,-45705983),a=r(a,c,u,l,e[f+8],7,1770035416),l=r(l,a,c,u,e[f+9],12,-1958414417),u=r(u,l,a,c,e[f+10],17,-42063),c=r(c,u,l,a,e[f+11],22,-1990404162),a=r(a,c,u,l,e[f+12],7,1804603682),l=r(l,a,c,u,e[f+13],12,-40341101),u=r(u,l,a,c,e[f+14],17,-1502002290),a=i(a,c=r(c,u,l,a,e[f+15],22,1236535329),u,l,e[f+1],5,-165796510),l=i(l,a,c,u,e[f+6],9,-1069501632),u=i(u,l,a,c,e[f+11],14,643717713),c=i(c,u,l,a,e[f+0],20,-373897302),a=i(a,c,u,l,e[f+5],5,-701558691),l=i(l,a,c,u,e[f+10],9,38016083),u=i(u,l,a,c,e[f+15],14,-660478335),c=i(c,u,l,a,e[f+4],20,-405537848),a=i(a,c,u,l,e[f+9],5,568446438),l=i(l,a,c,u,e[f+14],9,-1019803690),u=i(u,l,a,c,e[f+3],14,-187363961),c=i(c,u,l,a,e[f+8],20,1163531501),a=i(a,c,u,l,e[f+13],5,-1444681467),l=i(l,a,c,u,e[f+2],9,-51403784),u=i(u,l,a,c,e[f+7],14,1735328473),a=o(a,c=i(c,u,l,a,e[f+12],20,-1926607734),u,l,e[f+5],4,-378558),l=o(l,a,c,u,e[f+8],11,-2022574463),u=o(u,l,a,c,e[f+11],16,1839030562),c=o(c,u,l,a,e[f+14],23,-35309556),a=o(a,c,u,l,e[f+1],4,-1530992060),l=o(l,a,c,u,e[f+4],11,1272893353),u=o(u,l,a,c,e[f+7],16,-155497632),c=o(c,u,l,a,e[f+10],23,-1094730640),a=o(a,c,u,l,e[f+13],4,681279174),l=o(l,a,c,u,e[f+0],11,-358537222),u=o(u,l,a,c,e[f+3],16,-722521979),c=o(c,u,l,a,e[f+6],23,76029189),a=o(a,c,u,l,e[f+9],4,-640364487),l=o(l,a,c,u,e[f+12],11,-421815835),u=o(u,l,a,c,e[f+15],16,530742520),a=s(a,c=o(c,u,l,a,e[f+2],23,-995338651),u,l,e[f+0],6,-198630844),l=s(l,a,c,u,e[f+7],10,1126891415),u=s(u,l,a,c,e[f+14],15,-1416354905),c=s(c,u,l,a,e[f+5],21,-57434055),a=s(a,c,u,l,e[f+12],6,1700485571),l=s(l,a,c,u,e[f+3],10,-1894986606),u=s(u,l,a,c,e[f+10],15,-1051523),c=s(c,u,l,a,e[f+1],21,-2054922799),a=s(a,c,u,l,e[f+8],6,1873313359),l=s(l,a,c,u,e[f+15],10,-30611744),u=s(u,l,a,c,e[f+6],15,-1560198380),c=s(c,u,l,a,e[f+13],21,1309151649),a=s(a,c,u,l,e[f+4],6,-145523070),l=s(l,a,c,u,e[f+11],10,-1120210379),u=s(u,l,a,c,e[f+2],15,718787259),c=s(c,u,l,a,e[f+9],21,-343485551),a=E(a,h),c=E(c,d),u=E(u,p),l=E(l,v)}return[a,c,u,l]}(a(e,{ibits:8,obits:32,obigendian:!1}),8*e.length),{ibits:32,ibigendian:!1})},I=function(e){this.mul=l(88,81,244,45,76,149,127,45),this.inc=l(20,5,123,126,247,103,129,79),this.mask=l(0,0,0,0,255,255,255,255),this.state=h(this.inc),this.next(),g(this.state,this.mask),e=d(void 0!==e?e>>>0:4294967295*Math.random()>>>0),function(e,t){for(var n=0;n<8;n++)e[n]|=t[n]}(this.state,e),this.next()};I.prototype.next=function(){var e=h(this.state);(function(e,t){var n,r,i,o=new Array(16);for(n=0;n<16;n++)o[n]=0;for(n=0;n<8;n++){for(i=0,r=0;r<8;r++)i+=e[n]*t[r]+o[n+r],o[n+r]=i%u,i/=u;for(;r<16-n;r++)i+=o[n+r],o[n+r]=i%u,i/=u}for(n=0;n<8;n++)e[n]=o[n];o.slice(8,8)})(this.state,this.mul),v(this.state,this.inc);var t=h(e);b(t,18),w(t,e),b(t,27);var n=h(e);b(n,59),g(t,this.mask);var r=p(n),i=h(t);return function(e,t){if(t>64)throw new Error("ui64_rol: invalid number of bits to shift");var n,r=new Array(16);for(n=0;n<8;n++)r[n+8]=0,r[n]=e[n];var i=Math.floor(t/8),o=t%8;for(n=7-i;n>0;n--)r[n+i]=255&(r[n]<<o|r[n-1]>>>8-o);for(r[0+i]=r[0]<<o&255,n=0+i-1;n>=0;n--)r[n]=0;for(n=0;n<8;n++)e[n]=r[n];r.slice(8,8)}(i,32-r),b(t,r),w(t,i),p(t)};var k=new I,T=function(e,t){for(var n=[],r=0;r<e;r++)n[r]=k.next()%t;return n},S=0,R=0,A=function(){if(1===arguments.length&&"string"==typeof arguments[0])this.parse.apply(this,arguments);else if(arguments.length>=1&&"number"==typeof arguments[0])this.make.apply(this,arguments);else{if(arguments.length>=1)throw new Error("UUID: constructor: invalid arguments");for(var e=0;e<16;e++)this[e]=0}};return(A.prototype="undefined"!=typeof Uint8Array?new Uint8Array(16):i?i.alloc(16):new Array(16)).constructor=A,A.prototype.make=function(e){var t,n=this;if(1===e){var r=(new Date).getTime();r!==S?R=0:R++,S=r;var i,o=d(r);y(o,1e4),v(o,l(1,178,29,210,19,129,64,0)),R>0&&v(o,d(R)),i=m(o,8),n[3]=255&i,i=m(o,8),n[2]=255&i,i=m(o,8),n[1]=255&i,i=m(o,8),n[0]=255&i,i=m(o,8),n[5]=255&i,i=m(o,8),n[4]=255&i,i=m(o,8),n[7]=255&i,i=m(o,8),n[6]=15&i;var s=T(2,255);n[8]=s[0],n[9]=s[1];var a=T(6,255);for(a[0]|=1,a[0]|=2,t=0;t<6;t++)n[10+t]=a[t]}else if(4===e){var c=T(16,255);for(t=0;t<16;t++)this[t]=c[t]}else{if(3!==e&&5!==e)throw new Error("UUID: make: invalid version");var u="",f="object"==typeof arguments[1]&&arguments[1]instanceof A?arguments[1]:(new A).parse(arguments[1]);for(t=0;t<16;t++)u+=String.fromCharCode(f[t]);u+=arguments[2];var h=3===e?O(u):C(u);for(t=0;t<16;t++)n[t]=h.charCodeAt(t)}return n[6]&=15,n[6]|=e<<4,n[8]&=63,n[8]|=128,n},A.prototype.format=function(t){var n,r;return"z85"===t?n=o(this,16):"b16"===t?(r=Array(32),e(this,0,15,!0,r,0),n=r.join("")):void 0!==t&&"std"!==t||(r=new Array(36),e(this,0,3,!1,r,0),r[8]="-",e(this,4,5,!1,r,9),r[13]="-",e(this,6,7,!1,r,14),r[18]="-",e(this,8,9,!1,r,19),r[23]="-",e(this,10,15,!1,r,24),n=r.join("")),n},A.prototype.toString=function(e){return this.format(e)},A.prototype.toJSON=function(){return this.format("std")},A.prototype.parse=function(e,n){if("string"!=typeof e)throw new Error("UUID: parse: invalid argument (type string expected)");if("z85"===n)s(e,this);else if("b16"===n)t(e,0,35,this,0);else if(void 0===n||"std"===n){var r={nil:"00000000-0000-0000-0000-000000000000","ns:DNS":"6ba7b810-9dad-11d1-80b4-00c04fd430c8","ns:URL":"6ba7b811-9dad-11d1-80b4-00c04fd430c8","ns:OID":"6ba7b812-9dad-11d1-80b4-00c04fd430c8","ns:X500":"6ba7b814-9dad-11d1-80b4-00c04fd430c8"};if(void 0!==r[e])e=r[e];else if(!e.match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/))throw new Error('UUID: parse: invalid string representation (expected "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")');t(e,0,7,this,0),t(e,9,12,this,4),t(e,14,17,this,6),t(e,19,22,this,8),t(e,24,35,this,10)}return this},A.prototype.export=function(){for(var e=Array(16),t=0;t<16;t++)e[t]=this[t];return e},A.prototype.import=function(e){if(!("object"==typeof e&&e instanceof Array))throw new Error("UUID: import: invalid argument (type Array expected)");if(16!==e.length)throw new Error("UUID: import: invalid argument (Array of length 16 expected)");for(var t=0;t<16;t++){if("number"!=typeof e[t])throw new Error("UUID: import: invalid array element #"+t+" (type Number expected)");if(!isFinite(e[t])||Math.floor(e[t])!==e[t])throw new Error("UUID: import: invalid array element #"+t+" (Number with integer value expected)");if(!(e[t]>=0&&e[t]<=255))throw new Error("UUID: import: invalid array element #"+t+" (Number with integer value in range 0...255 expected)");this[t]=e[t]}return this},A.prototype.compare=function(e){if("object"!=typeof e)throw new Error("UUID: compare: invalid argument (type UUID expected)");if(!(e instanceof A))throw new Error("UUID: compare: invalid argument (type UUID expected)");for(var t=0;t<16;t++){if(this[t]<e[t])return-1;if(this[t]>e[t])return 1}return 0},A.prototype.equal=function(e){return 0===this.compare(e)},A.prototype.fold=function(e){if(void 0===e)throw new Error("UUID: fold: invalid argument (number of fold operations expected)");if(e<1||e>4)throw new Error("UUID: fold: invalid argument (1-4 fold operations expected)");for(var t=16/Math.pow(2,e),n=new Array(t),r=0;r<t;r++){for(var i=0,o=0;r+o<16;o+=t)i^=this[r+o];n[r]=i}return n},A.PCG=I,A}(),e.exports.default=e.exports}));class qt{constructor(e){this.transport=e,this.gnpLockAcquired=e.consoleAppEvent.pipe(ze(e=>"response-gnp-lock"===e.event),Ae(e=>e.token),ut(1)),this.gnpLockAcquired.subscribe()}acquireGnpLock(e){const t=new Kt(4).toString(),n={action:"request-gnp-lock",id:e,token:t},r=this.gnpLockAcquired.pipe(it(e=>e===t));return this.transport.writeAction(n),r}releaseGnpLock(e,t){const n={action:"release-gnp-lock",id:e,token:t};this.transport.writeAction(n)}}!function(e){e[e.INPUT=0]="INPUT",e[e.OUTPUT=1]="OUTPUT",e[e.FEATURE=2]="FEATURE"}(Vt||(Vt={})),function(e){e.ABSOLUTE="absolute",e.RELATIVE="relative"}(Wt||(Wt={}));class zt{constructor(e){this.id=e}equals(e){return this.id===e.id}startsWith(e){return this.id.startsWith(e.id)}toString(){return this.id}}function $t(e,t,n){const r=e.toString(16).padStart(4,"0"),i=t.toString(16).padStart(4,"0");return new zt(`${r}:${i}:${n}`)}class Jt{constructor(e,t,n,r){this.id=e,this.usagePage=t,this.usage=n,this.value=r}isArray(){return Array.isArray(this.value)}static deserialize(e,t){return new Jt(new zt(e),t.usagePage,t.usage,t.value)}}class Xt{constructor(e,t,n){this.descriptor=t,this.transport=n,this.transportId=e.transportId,this.input=n.consoleAppEvent.pipe(ze(e=>e.id===this.transportId),Xt.inputReportsFilter)}output(e,t,n){const r={action:"hid-output",id:this.transportId,usagePage:e,usage:t,value:n};this.transport.writeAction(r)}getFeatureReport(e,t){const n=new Kt(4).toString(),r={action:"request-hid-feature",id:this.transportId,token:n,usagePage:e,usage:t};return this.transport.writeAction(r),this.transport.consoleAppEvent.pipe(it(e=>"response-hid-feature"===e.event&&e.token===n),Ae(e=>e.value))}setFeatureReport(e,t,n){const r={action:"set-hid-feature",id:this.transportId,usagePage:e,usage:t,value:n};this.transport.writeAction(r)}findDescriptor(e,t,n){return this.descriptor.find(r=>r.usagePage===e&&r.usage===t&&r.reportType===n)}}Xt.inputReportsFilter=e=>e.pipe(ze(e=>"hid-input"===e.event),Ae(e=>Jt.deserialize(e.id,e)));class Qt{static typeFromAttr(e){return e>>6}static packetLengthFromAttr(e){return e&this.lengthMask}static deserialize(e){const t=e[0],n=e[1],r=e[2],i=this.typeFromAttr(e[3]),o=e[4],s=e[5],a=this.packetLengthFromAttr(e[3]),c=e.slice(6,a);return new Dt(t,n,i,o,s,c,r)}}Qt.lengthMask=63;class Zt{constructor(){this.data=[]}hasHeader(){return this.data.length>=Zt.gnpPacketHeaderLength}expectedPacketLength(){if(!this.hasHeader())throw new vt("Unable to get expected packet length without a full header",Fe.UNEXPECTED_ERROR);return Qt.packetLengthFromAttr(this.data[3])}appendData(e){this.hasHeader()&&this.expectedPacketLength()>Zt.gnpPacketMaxLength&&(this.data=[]),this.data=this.data.concat(e)}hasFullPacket(){if(!this.hasHeader())return!1;const e=this.expectedPacketLength();return this.data.length>=e}getPacketAndReset(){if(!this.hasFullPacket())throw new vt("Trying to get packet but buffer is not complete",Fe.UNEXPECTED_ERROR);const e=Qt.deserialize(Uint8Array.from(this.data));return this.data=[],e}}Zt.gnpPacketHeaderLength=6,Zt.gnpPacketMaxLength=63;const en=()=>{};function tn(e){return pt(t=>e(),t=>e(),()=>en)}const nn=()=>{return e=e=>e.command===Pt.NACK,t=e=>new vt("Got NACK response. Reason: "+e.subCommand,Fe.DEVICE_ERROR),n=>n.pipe(Ae(n=>e(n)?_e(t(n)):Ee(n)),ht());var e,t},rn=e=>it(t=>t.type===At.REPLY&&t.sequenceNumber===e.sequenceNumber&&t.destination===e.source&&t.source===e.destination);class on{constructor(e,t,n,r,i=0){this.hidChannel=e,this.gnpLock=t,this.transportId=n,this.primaryAddress=r,this.lockQueue=[],this.packets=e.input.pipe(on.inputFilter),this.events=this.packets.pipe(on.eventsFilter),this.nextSequenceNumber=i}static get inputFilter(){return e=>{const t=e.pipe(ze(e=>e.usagePage===Tt.GN_PROTOCOL&&e.usage===St.DATA&&e.isArray())),n=new Zt;return t.pipe(Pe(e=>{const t=e.value;return n.appendData(t),n.hasFullPacket()?Ee(n.getPacketAndReset()):Ve}),at())}}static supportsGnpOverHid(e){return void 0!==e.findDescriptor(Tt.GN_PROTOCOL,St.DATA,Vt.OUTPUT)}getNextSequenceNumber(){const e=this.nextSequenceNumber;return this.nextSequenceNumber=(this.nextSequenceNumber+1)%255,e}doWithGnpLockHeld(e){this.lockQueue.push(e),this.lockQueue.length>1||this.processLockQueue()}processLockQueue(){this.gnpLock.acquireGnpLock(this.transportId).subscribe(e=>{(0,this.lockQueue[0])(e=>{var t;const n=null===(t=this.hidChannel.findDescriptor(Tt.GN_PROTOCOL,St.DATA,Vt.OUTPUT))||void 0===t?void 0:t.reportSize;if(!n)throw new vt("Cannot send GNP packets to this device.",Fe.DEVICE_ERROR);const r=class{static attrFromTypeAndPayloadLength(e,t){return(e<<6)+(t+6)}static serialize(e){const t=new Uint8Array(6);t[0]=e.destination,t[1]=e.source,t[2]=e.sequenceNumber,t[3]=this.attrFromTypeAndPayloadLength(e.type,e.payload.length),t[4]=e.command,t[5]=e.subCommand;const n=new Uint8Array(t.length+e.payload.length);return n.set(t),n.set(e.payload,t.length),n}}.serialize(e);let i=0;do{const e=Math.min(r.length-i,n),t=r.subarray(i,i+e);i+=t.length,this.hidChannel.output(Tt.GN_PROTOCOL,St.DATA,Array.from(t))}while(i<r.length)},this.packets,()=>{this.gnpLock.releaseGnpLock(this.transportId,e),this.lockQueue.splice(0,1),this.lockQueue.length>0&&this.processLockQueue()})})}sendEvent(e,t,n=this.primaryAddress){const r=new Dt(n,Rt.PC_ADDR,At.EVENT,e.command,e.subCommand,e.serialize(t),0);this.doWithGnpLockHeld((e,t,n)=>{e(r),n()})}read(e,t=this.primaryAddress,n=2500){const r=new xt(e,e=>new Uint8Array);return this.readWithParams(r,null,t,n)}readWithParams(e,t,n=this.primaryAddress,r=2500){const i=new Dt(n,Rt.PC_ADDR,At.READ,e.command,e.subCommand,e.serialize(t),this.getNextSequenceNumber()),o=new G;return this.doWithGnpLockHeld((t,n,s)=>{n.pipe(rn(i),nn(),it(e=>e.command===i.command&&e.subCommand===i.subCommand),Se(r),tn(s),Ae(t=>e.deserialize(t))).subscribe(o),t(i)}),o}write(e,t,n=this.primaryAddress,r=2500){const i=new Dt(n,Rt.PC_ADDR,At.WRITE,e.command,e.subCommand,e.serialize(t),this.getNextSequenceNumber()),o=new G;return this.doWithGnpLockHeld((e,t,n)=>{t.pipe(rn(i),nn(),it(e=>e.command===Pt.ACK),Se(r),tn(n),Ae(()=>!0)).subscribe(o),e(i)}),o}}on.eventsFilter=e=>e.pipe(ze(e=>e.type===At.EVENT));class sn{constructor(e,t){this.parentGnpChannel=e,this.primaryAddress=t,this.events=e.events.pipe(ze(e=>e.source===this.primaryAddress))}sendEvent(e,t,n){this.parentGnpChannel.sendEvent(e,t,this.primaryAddress)}read(e,t,n){return this.parentGnpChannel.read(e,this.primaryAddress,n)}readWithParams(e,t,n,r){return this.parentGnpChannel.readWithParams(e,t,this.primaryAddress,r)}write(e,t,n,r){return this.parentGnpChannel.write(e,t,this.primaryAddress,r)}}function an(e,t,n,r){if(!on.supportsGnpOverHid(e))return _e(()=>new vt("Device does not support GNP commands.",Fe.DEVICE_ERROR));const i=Ee(Rt.HS_BT_USB_ADDR,Rt.BASE_ADDR,Rt.CRADLE_ADDR,Rt.HS1_ADDR,Rt.HS_CRADLE_ADDR).pipe(Ae((r,i)=>Le(()=>{const o=new on(e,new qt(t),n,r,i),s=new Bt;return o.read(s,r,500).pipe(Ae(e=>o),Qe(()=>Q))})),xe(),tt(1),nt(()=>new vt("GNP probe failed.",Fe.DEVICE_ERROR)));return $e(r.pipe(Pe(e=>_e(()=>new vt("Device was suddenly disconnected.",Fe.DEVICE_ERROR)))),i).pipe(at())}function cn(e,t){return new sn(e,t)}class un{constructor(){this.primaryAddress=Rt.BASE_ADDR,this.events=Ve}subscribeToEvent(e,t){return _e(()=>new vt("This device does not support GNP commands.",Fe.FEATURE_NOT_SUPPORTED))}sendEvent(e,t,n){throw new vt("This device does not support GNP commands.",Fe.FEATURE_NOT_SUPPORTED)}read(e,t,n){return _e(()=>new vt("This device does not support GNP commands.",Fe.FEATURE_NOT_SUPPORTED))}readWithParams(e,t,n,r){return _e(()=>new vt("This device does not support GNP commands.",Fe.FEATURE_NOT_SUPPORTED))}write(e,t,n,r){return _e(()=>new vt("This device does not support GNP commands.",Fe.FEATURE_NOT_SUPPORTED))}}class ln{constructor(e){this.transportId=e,this.isChild=!1}equals(e){return this.isChild===e.isChild&&this.transportId===e.transportId}toString(){return this.transportId}}class fn{constructor(e,t){this.parentId=e,this.gnpAddress=t,this.isChild=!0,this.transportId=e.transportId}equals(e){if(this.isChild===e.isChild){const t=e;return this.parentId.equals(t.parentId)&&this.gnpAddress===t.gnpAddress}return!1}toString(){return`0x${e=this.gnpAddress,e.toString(16).padStart(2,"0").toUpperCase()}@${this.transportId}`;var e}}var hn,dn,pn;!function(e){e.NO_TRACKING="no-tracking",e.TRACK_ERRORS="track-errors",e.TRACK_USAGE="track-usage",e.TRACK_ALL="track-all"}(hn||(hn={})),function(e){e[e.BLUETOOTH=0]="BLUETOOTH",e[e.INDIRECT=1]="INDIRECT",e[e.USB=2]="USB"}(dn||(dn={})),function(e){e[e.BASE=0]="BASE",e[e.HEADSET=1]="HEADSET",e[e.DESKSTAND=2]="DESKSTAND",e[e.OTHER=3]="OTHER",e[e.DONGLE=4]="DONGLE",e[e.PC=5]="PC",e[e.EHS=6]="EHS",e[e.USB=7]="USB",e[e.SPEAKER_PHONE=8]="SPEAKER_PHONE",e[e.INDICATOR=9]="INDICATOR",e[e.MOBILE=10]="MOBILE",e[e.NONE=11]="NONE",e[e.LOCAL=12]="LOCAL",e[e.DISPLAY=13]="DISPLAY",e[e.HS_CRADLE=14]="HS_CRADLE",e[e.HS_CRADLE2=15]="HS_CRADLE2",e[e.MOBILE_IAP=16]="MOBILE_IAP",e[e.CRADLE=17]="CRADLE",e[e.VIDEO=18]="VIDEO",e[e.NOT_GN=252]="NOT_GN",e[e.ANY_GN=253]="ANY_GN",e[e.NOT_INIT=254]="NOT_INIT",e[e.ANY=255]="ANY"}(pn||(pn={}));class vn{constructor(e,t,n,r,i,o,s,a,c,u,l){this.id=e,this.type=t,this.hidChannel=n,this.events=r,this.primaryAddress=i,this.sendEvent=o,this.read=s,this.readWithParams=a,this.write=c,this.onDisconnect=u,this.parentConnectionId=l,this.onDisconnect.subscribe({error:S})}static createConnection(e,t,n,r,i,o){const s=r.sendEvent.bind(r),a=r.read.bind(r),c=r.readWithParams.bind(r),u=r.write.bind(r);return new vn(e,t,n,r.events,r.primaryAddress,s,a,c,u,i,o)}}const yn=(e=3,t=500)=>n=>n.pipe(Pe((n,r)=>{const i=r+1;return i>e?_e(()=>n):He(i*i*t)}));function gn(e,t,n,r=1e3,i=3,o=100){return Le(()=>e.read(t,n,r)).pipe(st(yn(i,o)))}function mn(e,t,n){const{deviceType:r,address:i}=n;return{transportId:t.transportId,vid:t.vid,pid:gn(e,jt,i),name:gn(e,Mt,i),serialNumber:gn(e,Gt,i),capabilities:t.capabilities,deviceType:r,connectionGnpAddress:i}}class bn{constructor(e,t,n=mn,r=vn.createConnection,i=cn){this.parentConnection=t,this.connectionCreator=r,this.createChildGnpChannel=i;const o=t.events.pipe(ze(e=>e.command===Pt.DEVICE&&e.subCommand===Nt.ATTACH_EVENT),Ae(e=>({deviceType:e.payload[0],address:e.payload[1]}))).pipe(Ae(n.bind(null,t,e)));this.connectionEvents=o.pipe(Ae(e=>{const n=$e(t.events.pipe(it(t=>t.command===Pt.DEVICE&&t.subCommand===Nt.DETACH_EVENT&&t.payload[1]===e.connectionGnpAddress),Ae(S)),t.onDisconnect);return{attach:e,detach:n}}),Pe(e=>Xe(Ee(e.attach),this.createConnection(e.attach,e.detach))),Ae(([e,t])=>({event:e,connection:t})),dt(t.onDisconnect)),t.sendEvent(Lt,[])}createConnection(e,t){const n=e.connectionGnpAddress,r=this.createChildGnpChannel(this.parentConnection,n),i=new fn(this.parentConnection.id,n);return Ee(this.connectionCreator(i,dn.INDIRECT,this.parentConnection.hidChannel,r,t,this.parentConnection.id))}}const wn={command:Pt.IDENT,subCommand:Nt.TYPE,deserialize:e=>{const{payload:t}=e,n=t[0];if(n<1||n>=t.length)throw new vt("Cannot get device type.",Fe.DEVICE_ERROR);return t[1]}};function En(e,t,n,r=Me.ERROR,i=je.JS_LIB){yt(`${e} ${function(e){if(e instanceof vt){const t=e;return`JabraError: ${t.message} (type: ${t.type})`}if(e instanceof Error){const t=e;return`Error: ${t.message} (name: ${t.name})`}return"Unknown error: "+e}(t)}`,n,r,i)}function _n(e){return new bn(e.event,e.connection).connectionEvents}class Cn{constructor(e,t,n=((e,t,n)=>new Xt(e,t,n)),r=an,i=_n,o=vn.createConnection){this.transport=e,this.logger=t,this.createHidChannel=n,this.createRootGnpChannel=r,this.connectionCreator=o;const s=this.transport.consoleAppEvent.pipe(ze(e=>"attach"===e.event),Ae(Cn.createAttachEvent),Qe((e,t)=>(En("",e,this.logger),t))).pipe(Ae(e=>{const t=this.transport.consoleAppEvent.pipe(ze(e=>"detach"===e.event),it(t=>Cn.getTransportId(t)===e.transportId),Ae(S),ut());return t.subscribe(),{attach:e,detach:t}}),Pe(e=>this.createConnection(e.attach,e.detach)),at()),a=s.pipe(ze(e=>e.event.deviceType===pn.DONGLE),ze(e=>on.supportsGnpOverHid(e.connection.hidChannel)),Pe(e=>i(e)));this.connectionEvents=Ue(s,a).pipe(at())}static convertToReportType(e){switch(e){case"input":return Vt.INPUT;case"output":return Vt.OUTPUT;case"feature":return Vt.FEATURE;default:throw new vt(e+" is not a valid ReportType",Fe.UNEXPECTED_ERROR)}}static convertToValueType(e){switch(e){case"absolute":return Wt.ABSOLUTE;case"relative":return Wt.RELATIVE;default:throw new vt(e+" Not a valid ValueType",Fe.UNEXPECTED_ERROR)}}static createDescriptor(e){return e.map(e=>({reportType:Cn.convertToReportType(e.reportType),usagePage:e.usagePage,usage:e.usage,valueType:Cn.convertToValueType(e.valueType),reportSize:e.reportSize}))}static getMandatoryField(e,t){const n=e[t];if(void 0===n)throw new vt(`JSON event lacks required field "${t}: ${JSON.stringify(e)}`,Fe.UNEXPECTED_ERROR);return n}static getTransportId(e){return Cn.getMandatoryField(e,"id")}static createAttachEvent(e){return{transportId:Cn.getTransportId(e),vid:Cn.getMandatoryField(e,"vid"),pid:Ee(Cn.getMandatoryField(e,"pid")),name:Ee(Cn.getMandatoryField(e,"name")),serialNumber:Ee(Cn.getMandatoryField(e,"serialNumber")),capabilities:Cn.createDescriptor(Cn.getMandatoryField(e,"descriptor"))}}createConnection(e,t,n=3,r=100){const{capabilities:i,transportId:o}=e,s=new ln(o),a=this.createHidChannel(s,i,this.transport),c=this.createRootGnpChannel(a,this.transport,o,t).pipe(Qe((e,t)=>(e.type&&e.type===Fe.DEVICE_ERROR&&this.transport.context===Ge.WEB_HID&&yt("Child devices are not yet supported when using WebHID.",this.logger,Me.WARNING,je.JS_LIB),Ee(new un))),at()),u=c.pipe(Pe(e=>e.read(wn)),st(yn(n,r)),Qe(e=>Ee(pn.ANY)));return Xe(c,u).pipe(dt(t),Ae(([n,r])=>({event:Object.assign(Object.assign({},e),{deviceType:r,connectionGnpAddress:n.primaryAddress}),connection:this.connectionCreator(s,dn.USB,a,n,t)})))}}var On,In,kn,Tn,Sn;class Rn{constructor(e,t,n,r,i,o){this.vendorId=e,this.productId=t,this.serialNumber=n,this.name=r,this.type=i,In.set(this,void 0),a(this,In,new mt(o,s(Rn,On,"m",Tn)),"f"),this.connectionAdded=s(this,In,"f").itemAdded,this.connectionRemoved=s(this,In,"f").itemRemoved,this.connectionList=s(this,In,"f").itemList,this.onDisconnect=s(this,In,"f").itemList.pipe(lt(1),it(e=>0===e.length),Ae(S),at())}get id(){return $t(this.vendorId,this.productId,this.serialNumber)}get currentConnections(){return s(this,In,"f").getValue()}get browserLabel(){return`${this.vendorId.toString(16).padStart(4,"0")}:${this.productId.toString(16).padStart(4,"0")}`}}On=Rn,In=new WeakMap,Tn=function(e,t){return s(Rn,On,"f",kn).indexOf(e.type)-s(Rn,On,"f",kn).indexOf(t.type)},kn={value:[dn.USB,dn.INDIRECT,dn.BLUETOOTH]};class An{constructor(e){this.deviceObservables=new mt(e)}static exceptionToUndefined(e){try{return e()}catch(e){if(e instanceof vt)return;throw e}}connectionExists(e){return void 0!==An.exceptionToUndefined(()=>this.findConnectionById(e))}findConnectionById(e){for(const t of this.deviceObservables.getValue())for(const n of t.currentConnections)if(n.id.equals(e))return n;throw new vt("Could not find connection with id "+e.toString(),Fe.UNEXPECTED_ERROR)}findDeviceByDeviceId(e){return this.deviceObservables.getValue().find(t=>t.id.startsWith(e)||e.startsWith(t.id))}}class Pn{constructor(e,t){this.logger=t;const[n,r]=(i=e.pipe(ze(e=>!this.deviceCollection.connectionExists(e.connection.id)),Ze(e=>this.force(e))),[ze(o=({event:e,pid:t,serialNumber:n})=>!this.deviceCollection.findDeviceByDeviceId($t(e.event.vid,t,n)),s)(he(i)),ze(qe(o,s))(he(i))]);var i,o,s;const a=n.pipe(Ae(e=>Pn.createDevice(e,r)));this.deviceCollection=new An(a),this.deviceObservables=this.deviceCollection.deviceObservables}force(e){const{name:t,pid:n,serialNumber:r}=e.event,i=e.connection.onDisconnect.pipe((o=_e(()=>new Error(`Connection with ID ${e.connection.id} disconnected`)),g(s)?Ze((function(){return o}),s):Ze((function(){return o}))));var o,s;return Xe(t,n,r).pipe(Ae(([t,n,r])=>({event:e,name:t,pid:n,serialNumber:r})),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length?j((function(t,n){Je(d([t],h(e)))(n)})):L}(i),Qe(e=>(yt("Failed to retrieve child connection information. Error: "+e,this.logger,Me.WARNING,je.JS_LIB),Q)))}static createDevice(e,t){const{event:n,pid:r,name:i,serialNumber:o}=e,{vid:s,deviceType:a}=n.event,c=t.pipe(ze(t=>Pn.isSameDevice(e,t)),Ae(e=>e.event.connection)),u=De(Ee(n.connection),c);return new Rn(s,r,o,i,a,u)}static isSameDevice(e,t){const n=$t(e.event.event.vid,e.pid,e.serialNumber),r=$t(t.event.event.vid,t.pid,t.serialNumber);return n.startsWith(r)||r.startsWith(n)}static create(e,t){const n=new Cn(e,t);return new Pn(n.connectionEvents)}}function Nn(e){var t,n,r;return o(this,void 0,void 0,(function*(){const i=null==e?void 0:e.logger;yt("Jabra SDK JS starting up...",i,Me.INFO);const o=new It(e);o.validateOrganizationKey(),o.validateAppId(),o.validateAppName();const s=null!==(n=null===(t=null==e?void 0:e.internal)||void 0===t?void 0:t.testDeviceTransport)&&void 0!==n?n:yield _t(i,null==e?void 0:e.transport,null===(r=null==e?void 0:e.internal)||void 0===r?void 0:r.recorder);new Ct(s,i);const a=Pn.create(s,i),c=new wt(a,s,e);return yield s.connect(),c}))}class xn{constructor(e,t,n,r){this.deviceId=e,this.usagePage=t,this.usage=n,this.value=r}}class Dn{constructor(e,t){this.token=e,this.value=t}}!function(e){e.UsageReport=class{constructor(e,t){this.usage=e,this.value=t}}}(Sn||(Sn={}));var Ln,Hn,Un,Mn,jn,Fn,Bn,Gn,Yn,Vn,Wn=Yt((function(e){!function(t){var n=function(e,t,n){if(!(e instanceof ArrayBuffer||void 0!==i&&e instanceof i))throw new Error("Must specify a valid ArrayBuffer or Buffer.");t=t||0,n=n||e.byteLength||e.length,this._view=new Uint8Array(e.buffer||e,t,n),this.bigEndian=!1};n._scratch=new DataView(new ArrayBuffer(8)),Object.defineProperty(n.prototype,"buffer",{get:function(){return void 0!==i?i.from(this._view.buffer):this._view.buffer},enumerable:!0,configurable:!1}),Object.defineProperty(n.prototype,"byteLength",{get:function(){return this._view.length},enumerable:!0,configurable:!1}),n.prototype._setBit=function(e,t){t?this._view[e>>3]|=1<<(7&e):this._view[e>>3]&=~(1<<(7&e))},n.prototype.getBits=function(e,t,n){var r=8*this._view.length-e;if(t>r)throw new Error("Cannot get "+t+" bit(s) from offset "+e+", "+r+" available");for(var i=0,o=0;o<t;){var s=t-o,a=7&e,c=this._view[e>>3],u=Math.min(s,8-a);this.bigEndian?(i<<=u,i|=c>>8-u-a&~(255<<u)):i|=(c>>a&~(255<<u))<<o,e+=u,o+=u}return n?(32!==t&&i&1<<t-1&&(i|=-1^(1<<t)-1),i):i>>>0},n.prototype.setBits=function(e,t,n){var r=8*this._view.length-e;if(n>r)throw new Error("Cannot set "+n+" bit(s) from offset "+e+", "+r+" available");for(var i=0;i<n;){var o,s,a,c=n-i,u=7&e,l=e>>3,f=Math.min(c,8-u);if(this.bigEndian){s=t>>n-i-f&(o=~(-1<<f));var h=8-u-f;a=~(o<<h),this._view[l]=this._view[l]&a|s<<h}else s=t&(o=~(255<<f)),t>>=f,a=~(o<<u),this._view[l]=this._view[l]&a|s<<u;e+=f,i+=f}},n.prototype.getBoolean=function(e){return 0!==this.getBits(e,1,!1)},n.prototype.getInt8=function(e){return this.getBits(e,8,!0)},n.prototype.getUint8=function(e){return this.getBits(e,8,!1)},n.prototype.getInt16=function(e){return this.getBits(e,16,!0)},n.prototype.getUint16=function(e){return this.getBits(e,16,!1)},n.prototype.getInt32=function(e){return this.getBits(e,32,!0)},n.prototype.getUint32=function(e){return this.getBits(e,32,!1)},n.prototype.getFloat32=function(e){return n._scratch.setUint32(0,this.getUint32(e)),n._scratch.getFloat32(0)},n.prototype.getFloat64=function(e){return n._scratch.setUint32(0,this.getUint32(e)),n._scratch.setUint32(4,this.getUint32(e+32)),n._scratch.getFloat64(0)},n.prototype.setBoolean=function(e,t){this.setBits(e,t?1:0,1)},n.prototype.setInt8=n.prototype.setUint8=function(e,t){this.setBits(e,t,8)},n.prototype.setInt16=n.prototype.setUint16=function(e,t){this.setBits(e,t,16)},n.prototype.setInt32=n.prototype.setUint32=function(e,t){this.setBits(e,t,32)},n.prototype.setFloat32=function(e,t){n._scratch.setFloat32(0,t),this.setBits(e,n._scratch.getUint32(0),32)},n.prototype.setFloat64=function(e,t){n._scratch.setFloat64(0,t),this.setBits(e,n._scratch.getUint32(0),32),this.setBits(e+32,n._scratch.getUint32(4),32)},n.prototype.getArrayBuffer=function(e,t){for(var n=new Uint8Array(t),r=0;r<t;r++)n[r]=this.getUint8(e+8*r);return n};var r=function(e,t){return function(){if(this._index+t>this._length)throw new Error("Trying to read past the end of the stream");var n=this._view[e](this._index);return this._index+=t,n}},o=function(e,t){return function(n){this._view[e](this._index,n),this._index+=t}};function s(e,t,n){if(0===t)return"";var r=0,i=[],o=!0,s=!!t;for(t||(t=Math.floor((e._length-e._index)/8));r<t;){var a=e.readUint8();if(0===a&&(o=!1,!s))break;o&&i.push(a),r++}var c=String.fromCharCode.apply(null,i);if(!n)return c;try{return decodeURIComponent(escape(c))}catch(e){return c}}var a=function(e,t,r){var o=e instanceof ArrayBuffer||void 0!==i&&e instanceof i;if(!(e instanceof n||o))throw new Error("Must specify a valid BitView, ArrayBuffer or Buffer");this._view=o?new n(e,t,r):e,this._index=0,this._startIndex=0,this._length=8*this._view.byteLength};Object.defineProperty(a.prototype,"index",{get:function(){return this._index-this._startIndex},set:function(e){this._index=e+this._startIndex},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"length",{get:function(){return this._length-this._startIndex},set:function(e){this._length=e+this._startIndex},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"bitsLeft",{get:function(){return this._length-this._index},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"byteIndex",{get:function(){return Math.ceil(this._index/8)},set:function(e){this._index=8*e},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"buffer",{get:function(){return this._view.buffer},enumerable:!0,configurable:!1}),Object.defineProperty(a.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!1}),Object.defineProperty(a.prototype,"bigEndian",{get:function(){return this._view.bigEndian},set:function(e){this._view.bigEndian=e},enumerable:!0,configurable:!1}),a.prototype.readBits=function(e,t){var n=this._view.getBits(this._index,e,t);return this._index+=e,n},a.prototype.writeBits=function(e,t){this._view.setBits(this._index,e,t),this._index+=t},a.prototype.readBoolean=r("getBoolean",1),a.prototype.readInt8=r("getInt8",8),a.prototype.readUint8=r("getUint8",8),a.prototype.readInt16=r("getInt16",16),a.prototype.readUint16=r("getUint16",16),a.prototype.readInt32=r("getInt32",32),a.prototype.readUint32=r("getUint32",32),a.prototype.readFloat32=r("getFloat32",32),a.prototype.readFloat64=r("getFloat64",64),a.prototype.writeBoolean=o("setBoolean",1),a.prototype.writeInt8=o("setInt8",8),a.prototype.writeUint8=o("setUint8",8),a.prototype.writeInt16=o("setInt16",16),a.prototype.writeUint16=o("setUint16",16),a.prototype.writeInt32=o("setInt32",32),a.prototype.writeUint32=o("setUint32",32),a.prototype.writeFloat32=o("setFloat32",32),a.prototype.writeFloat64=o("setFloat64",64),a.prototype.readASCIIString=function(e){return function(e,t){return s(e,t,!1)}(this,e)},a.prototype.readUTF8String=function(e){return function(e,t){return s(e,t,!0)}(this,e)},a.prototype.writeASCIIString=function(e,t){!function(e,t,n){for(var r=n||t.length+1,i=0;i<r;i++)e.writeUint8(i<t.length?t.charCodeAt(i):0)}(this,e,t)},a.prototype.writeUTF8String=function(e,t){!function(e,t,n){for(var r=function(e){var t,n,r=[];for(t=0;t<e.length;t++)(n=e.charCodeAt(t))<=127?r.push(n):n<=2047?(r.push(n>>6|192),r.push(63&n|128)):n<=65535?(r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)):(r.push(n>>18|240),r.push(n>>12&63|128),r.push(n>>6&63|128),r.push(63&n|128));return r}(t),i=n||r.length+1,o=0;o<i;o++)e.writeUint8(o<r.length?r[o]:0)}(this,e,t)},a.prototype.readBitStream=function(e){var t=new a(this._view);return t._startIndex=this._index,t._index=this._index,t.length=e,this._index+=e,t},a.prototype.writeBitStream=function(e,t){var n;for(t||(t=e.bitsLeft);t>0;)n=Math.min(t,32),this.writeBits(e.readBits(n),n),t-=n},a.prototype.readArrayBuffer=function(e){var t=this._view.getArrayBuffer(this._index,e);return this._index+=8*e,t},a.prototype.writeArrayBuffer=function(e,t){this.writeBitStream(new a(e),8*t)},e.exports&&(e.exports={BitView:n,BitStream:a})}()}));function Kn(){return o(this,void 0,void 0,(function*(){const{hid:e}=window.navigator;if(!e)throw new vt("WebHID not supported",Fe.INIT_ERROR);const t=yield e.requestDevice({filters:[{vendorId:Ln.VENDOR_ID}]});return new BroadcastChannel(Ln.PAIRING_CHANNEL).postMessage(null),t}))}!function(e){e[e.VENDOR_ID=2830]="VENDOR_ID",e.PAIRING_CHANNEL="jabra-webhid-pairing-channel"}(Ln||(Ln={})),function(e){e[e.HOOK_SWITCH=32]="HOOK_SWITCH",e[e.GN_PSEUDO_HOOK_SWITCH=65531]="GN_PSEUDO_HOOK_SWITCH",e[e.FLASH=33]="FLASH",e[e.ALT_HOLD=35]="ALT_HOLD",e[e.REDIAL=36]="REDIAL",e[e.ONLINE=42]="ONLINE",e[e.SPEAKER_PHONE=43]="SPEAKER_PHONE",e[e.PHONE_MUTE=47]="PHONE_MUTE",e[e.SEND=49]="SEND",e[e.SPEED_DIAL=80]="SPEED_DIAL",e[e.VOICE_MAIL=112]="VOICE_MAIL",e[e.ANSWER_ON_OFF=116]="ANSWER_ON_OFF",e[e.LINE_BUSY=151]="LINE_BUSY",e[e.RINGER=158]="RINGER",e[e.PHONE_KEY_0=176]="PHONE_KEY_0",e[e.PHONE_KEY_1=177]="PHONE_KEY_1",e[e.PHONE_KEY_2=178]="PHONE_KEY_2",e[e.PHONE_KEY_3=179]="PHONE_KEY_3",e[e.PHONE_KEY_4=180]="PHONE_KEY_4",e[e.PHONE_KEY_5=181]="PHONE_KEY_5",e[e.PHONE_KEY_6=182]="PHONE_KEY_6",e[e.PHONE_KEY_7=183]="PHONE_KEY_7",e[e.PHONE_KEY_8=184]="PHONE_KEY_8",e[e.PHONE_KEY_9=185]="PHONE_KEY_9",e[e.PHONE_KEY_STAR=186]="PHONE_KEY_STAR",e[e.PHONE_KEY_POUND=187]="PHONE_KEY_POUND",e[e.ALT_VOLUME_UP=233]="ALT_VOLUME_UP",e[e.ALT_VOLUME_DOWN=234]="ALT_VOLUME_DOWN",e[e.REJECT_CALL=65533]="REJECT_CALL"}(Hn||(Hn={}));class qn{constructor(e,t,n){this.type=e,this.value=t,this.valueType=n}toString(){return void 0===Hn[this.type]?`Unknown signal: type: ${this.type}, value: ${this.value}, valueType: ${this.valueType}`:`Signal: type: ${Hn[this.type]}, value: ${this.value}, valueType: ${this.valueType}`}}!function(e){e[e.BUTTON=9]="BUTTON",e[e.CONSUMER=12]="CONSUMER",e[e.LED=8]="LED",e[e.TELEPHONY=11]="TELEPHONY",e[e.GN_CONSUMER=65312]="GN_CONSUMER",e[e.GN_EXT_BUTTONS=65360]="GN_EXT_BUTTONS",e[e.GN_LED=65344]="GN_LED",e[e.GN_MISC=65376]="GN_MISC",e[e.GN_TELEPHONY=65328]="GN_TELEPHONY"}(Un||(Un={})),function(e){e[e.MUTE=9]="MUTE",e[e.OFF_HOOK=23]="OFF_HOOK",e[e.RING=24]="RING",e[e.MESSAGE_WAIT=25]="MESSAGE_WAIT",e[e.HOLD=32]="HOLD",e[e.MIC_MUTE=33]="MIC_MUTE",e[e.ONLINE=42]="ONLINE",e[e.HID_OFFLINE=43]="HID_OFFLINE"}(Mn||(Mn={})),function(e){e[e.HOOK_SWITCH=32]="HOOK_SWITCH",e[e.FLASH=33]="FLASH",e[e.HOLD=35]="HOLD",e[e.REDIAL=36]="REDIAL",e[e.ONLINE=42]="ONLINE",e[e.SPEAKER_PHONE=43]="SPEAKER_PHONE",e[e.MUTE=47]="MUTE",e[e.HID_SEND=49]="HID_SEND",e[e.SPEED_DIAL=80]="SPEED_DIAL",e[e.VOICE_MAIL=112]="VOICE_MAIL",e[e.ANSWER_ON_OFF=116]="ANSWER_ON_OFF",e[e.LINE_BUSY=151]="LINE_BUSY",e[e.RINGER=158]="RINGER",e[e.PHONE_KEY_0=176]="PHONE_KEY_0",e[e.PHONE_KEY_1=177]="PHONE_KEY_1",e[e.PHONE_KEY_2=178]="PHONE_KEY_2",e[e.PHONE_KEY_3=179]="PHONE_KEY_3",e[e.PHONE_KEY_4=180]="PHONE_KEY_4",e[e.PHONE_KEY_5=181]="PHONE_KEY_5",e[e.PHONE_KEY_6=182]="PHONE_KEY_6",e[e.PHONE_KEY_7=183]="PHONE_KEY_7",e[e.PHONE_KEY_8=184]="PHONE_KEY_8",e[e.PHONE_KEY_9=185]="PHONE_KEY_9",e[e.PHONE_KEY_STAR=186]="PHONE_KEY_STAR",e[e.PHONE_KEY_POUND=187]="PHONE_KEY_POUND",e[e.HID_ALT_VOLUME_UP=233]="HID_ALT_VOLUME_UP",e[e.HID_ALT_VOLUME_DOWN=234]="HID_ALT_VOLUME_DOWN",e[e.GN_PSEUDO_HOOK_SWITCH=65531]="GN_PSEUDO_HOOK_SWITCH",e[e.GN_OUT_OF_RANGE=65532]="GN_OUT_OF_RANGE",e[e.GN_REJECT_CALL=65533]="GN_REJECT_CALL",e[e.GN_TELEPHONY_CONT_SET=65535]="GN_TELEPHONY_CONT_SET"}(jn||(jn={}));class zn{constructor(e,t,n,r,i){this.hidChannel=e,this.onDisconnect=t,this.isSoftphoneInFocus=n,this.lockHeld=r,this.logger=i,this.cachedSignals=new Map}setup(){const e=this.filter().pipe(at());return e.subscribe(),e}filter(){const e=this.hidChannel.input.pipe(ze(e=>e.usagePage===Un.GN_TELEPHONY&&!e.isArray()),Pe(e=>{const t=this.hidChannel.findDescriptor(e.usagePage,e.usage,Vt.INPUT);return(null==t?void 0:t.valueType)?Ee(Object.assign(Object.assign({},e),{valueType:t.valueType})):(En("",new vt(`Unable to find value-type in descriptor for UsagePage: ${e.usagePage} and Usage: ${e.usage}`,Fe.FEATURE_NOT_SUPPORTED),this.logger),Q)}),ze(e=>e.valueType===Wt.RELATIVE?Boolean(e.value):this.cachedSignals.get(e.usage)!==e.value),pt(e=>{this.cachedSignals.set(e.usage,e.value)}),dt(this.onDisconnect),at()),t=[Hn.HOOK_SWITCH,Hn.REDIAL],n=e.pipe(function(e){return t=>t.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=me(e);return j((function(t,r){for(var i=e.length,o=new Array(i),s=e.map((function(){return!1})),a=!1,c=function(t){he(e[t]).subscribe(new F(r,(function(e){o[t]=e,a||s[t]||(s[t]=!0,(a=s.every(L))&&(s=null))}),S))},u=0;u<i;u++)c(u);t.subscribe(new F(r,(function(e){if(a){var t=d([e],h(o));r.next(n?n.apply(void 0,d([],h(t))):t)}})))}))}(e),ze(([e,t])=>t),Ae(([e,t])=>e))}(this.isSoftphoneInFocus),ze(e=>t.includes(e.usage)&&!this.lockHeld.getValue()));return Ue(e.pipe(ze(e=>this.lockHeld.getValue())),n).pipe(Ae(e=>new qn(e.usage,0!==e.value,e.valueType)),Qe(e=>(yt(e.message,this.logger),Q)))}}class $n{constructor(e,t,n,r,i,o){this.device=e,this.onDisconnect=n,Fn.set(this,void 0),Bn.set(this,new V(!1)),Gn.set(this,void 0),Yn.set(this,!1),this.deviceSignals=new G,a(this,Fn,r,"f"),s(this,Fn,"f").lockHeld.subscribe(s(this,Bn,"f")),a(this,Gn,t,"f"),this.onDisconnect.pipe(it(),Ae(()=>!0)).subscribe(e=>{a(this,Yn,e,"f")});const c=new zn(s(this,Gn,"f"),this.onDisconnect,i,s(this,Bn,"f"),o);this.deviceSignals=c.setup()}checkCallLockHeld(e){if(!s(this,Bn,"f").getValue())throw new vt(e,Fe.SDK_USAGE_ERROR)}checkCallLockNotHeld(e){if(s(this,Bn,"f").getValue())throw new vt(e,Fe.SDK_USAGE_ERROR)}checkHasDisconnected(){if(s(this,Yn,"f"))throw new vt("CallControl cannot be performed as the connection has disconnected.",Fe.SDK_USAGE_ERROR)}takeCallLock(){return this.checkHasDisconnected(),this.checkCallLockNotHeld("Trying to take the call lock, but it is already held!"),Oe(s(this,Fn,"f").tryTakeCallLock())}releaseCallLock(){this.checkHasDisconnected(),this.checkCallLockHeld("Trying to release the call lock, but it is not held!"),s(this,Fn,"f").releaseCallLock()}offHook(e){this.checkHasDisconnected(),this.checkCallLockHeld("Calls can only be started and stopped when the call lock is held.");const t=s(this,Gn,"f").findDescriptor(Un.GN_LED,Mn.OFF_HOOK,Vt.OUTPUT);if(!t)throw new vt(`Device ${this.device.name} does not support any offHook functionality.`,Fe.FEATURE_NOT_SUPPORTED);const n=e?1:0;s(this,Gn,"f").output(t.usagePage,t.usage,n)}ring(e){this.checkHasDisconnected(),this.checkCallLockHeld("The ringer state can only be modified when the call lock is held.");const t=s(this,Gn,"f").findDescriptor(Un.GN_LED,Mn.RING,Vt.OUTPUT),n=s(this,Gn,"f").findDescriptor(Un.GN_TELEPHONY,jn.RINGER,Vt.OUTPUT);if(!t&&!n)throw new vt(`Device ${this.device.name} does not support any ring functionality.`,Fe.FEATURE_NOT_SUPPORTED);if(n){const t=e?1:0;s(this,Gn,"f").output(n.usagePage,n.usage,t)}if(t){const n=e?1:0;s(this,Gn,"f").output(t.usagePage,t.usage,n)}}mute(e){this.checkHasDisconnected(),this.checkCallLockHeld("The mute state can only be modified when the call lock is held.");let t=s(this,Gn,"f").findDescriptor(Un.GN_LED,Mn.MIC_MUTE,Vt.OUTPUT);if(t||(t=s(this,Gn,"f").findDescriptor(Un.GN_LED,Mn.MUTE,Vt.OUTPUT)),!t)throw new vt(`Device ${this.device.name} does not support any mute functionality.`,Fe.FEATURE_NOT_SUPPORTED);const n=e?1:0;s(this,Gn,"f").output(t.usagePage,t.usage,n)}hold(e){this.checkHasDisconnected(),this.checkCallLockHeld("The hold state can only be modified when the call lock is held.");const t=s(this,Gn,"f").findDescriptor(Un.GN_LED,Mn.HOLD,Vt.OUTPUT);if(!t)throw new vt(`Device ${this.device.name} does not support hold functionality.`,Fe.FEATURE_NOT_SUPPORTED);const n=e?1:0;s(this,Gn,"f").output(t.usagePage,t.usage,n)}}Fn=new WeakMap,Bn=new WeakMap,Gn=new WeakMap,Yn=new WeakMap,function(e){e[e.STD_TELEPHONY=0]="STD_TELEPHONY",e[e.GN_TELEPHONY=1]="GN_TELEPHONY"}(Vn||(Vn={}));const Jn={[kt.SKYPE]:Vn.GN_TELEPHONY,[kt.CISCO]:Vn.GN_TELEPHONY,[kt.AVAYA]:Vn.GN_TELEPHONY,[kt.SIEMENS]:Vn.GN_TELEPHONY,[kt.IBM]:Vn.GN_TELEPHONY,[kt.AASTRA]:Vn.GN_TELEPHONY,[kt.JABRA]:Vn.GN_TELEPHONY,[kt.NEC]:Vn.GN_TELEPHONY,[kt.SHORETEL]:Vn.GN_TELEPHONY,[kt.MS_OC]:Vn.STD_TELEPHONY,[kt.ALCATEL]:Vn.STD_TELEPHONY,[kt.OTHER]:Vn.STD_TELEPHONY,[kt.NORTEL]:null,[kt.GENERIC]:null};class Xn{constructor(e,t,n){this.connectionCallLock=e,this.device=t,this.logger=n,this.lockHeld=new V(!1),this.currentLocks=new V(new Set),this.lockReleaseEvent=new G}tryTakeCallLock(){const{currentConnections:e}=this.device,t=new Set,n=Le(()=>fe(e).pipe(Ze(e=>this.takeSingleCallLock(e).pipe(Qe(e=>(En("DeviceCallLock:",e,this.logger),Ee(""))))),pt(e=>t.add(e)))).pipe(function(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?ze((function(t,n){return e(t,n,r)})):L,ot(1),n?et(t):nt((function(){return new Ce})))}}(),Ae(n=>(t.delete(""),this.currentLocks.next(t),t.size!==e.length?(this.releaseCallLock(),!1):(this.lockHeld.next(!0),!0))),ut());return n.subscribe(e=>{e&&(this.acquireLockOnNextConnectionEmit(),this.releaseLockOnRemovedConnectionEmit())}),n}acquireLockOnNextConnectionEmit(){this.device.connectionAdded.pipe(dt(this.lockReleaseEvent)).subscribe(e=>{this.takeSingleCallLock(e).pipe(dt(this.lockReleaseEvent),Ae(e=>(this.currentLocks.getValue().add(e),this.currentLocks.next(this.currentLocks.getValue()),S)),st(yn())).subscribe({error:e=>{yt("Failed to acquire the call lock on a new connection.\n Another softphone running an old SDK has most likely acquired this lock.\n Full error: "+e,this.logger,Me.WARNING,je.JS_LIB)}})})}releaseLockOnRemovedConnectionEmit(){this.device.connectionRemoved.pipe(dt(this.lockReleaseEvent)).subscribe(e=>this.releaseSingleCallLock(e.id.transportId))}takeSingleCallLock(e){return Le(()=>this.connectionCallLock.tryTakeCallLock(e.id.transportId)).pipe(Ae(t=>t.acquired?Ee(t.transportId):_e(()=>new vt("Failed to acquire call lock on connection "+e.id.transportId,Fe.SDK_USAGE_ERROR))),ht())}releaseCallLock(){this.lockReleaseEvent.next(),[...this.currentLocks.getValue()].forEach(e=>{this.releaseSingleCallLock(e)}),this.currentLocks.getValue().clear(),this.currentLocks.next(this.currentLocks.getValue())}releaseSingleCallLock(e){this.connectionCallLock.releaseCallLock(e),this.currentLocks.getValue().delete(e),this.currentLocks.next(this.currentLocks.getValue()),0!==this.currentLocks.getValue().size&&0!==this.device.currentConnections.length||(this.lockReleaseEvent.next(),this.lockHeld.next(!1))}}class Qn{constructor(e){this.transport=e}tryTakeCallLock(e){const t={action:"request-call-lock",id:e};return this.transport.writeAction(t),this.transport.consoleAppEvent.pipe(ze(t=>"response-call-lock"===t.event&&t.id===e),Ae(e=>({transportId:e.id,acquired:e.acquired})),it())}releaseCallLock(e){const t={action:"release-call-lock",id:e};this.transport.writeAction(t)}}const Zn=[{usagePage:Un.GN_LED,usage:Mn.OFF_HOOK,reportType:Vt.OUTPUT},{usagePage:Un.GN_LED,usage:Mn.RING,reportType:Vt.OUTPUT},{usagePage:Un.GN_TELEPHONY,usage:jn.RINGER,reportType:Vt.OUTPUT},{usagePage:Un.GN_LED,usage:Mn.MIC_MUTE,reportType:Vt.OUTPUT},{usagePage:Un.GN_LED,usage:Mn.MUTE,reportType:Vt.OUTPUT},{usagePage:Un.GN_LED,usage:Mn.HOLD,reportType:Vt.OUTPUT}],er=[dn.USB,dn.INDIRECT,dn.BLUETOOTH];function tr(e){const{currentConnections:t,type:n}=e;var r;return(r=t,[...r].sort((e,t)=>er.indexOf(e.type)-er.indexOf(t.type))).find(e=>function(e,t){const{hidChannel:n}=e;return!!function(e){return Zn.some(({usagePage:t,usage:n,reportType:r})=>e.findDescriptor(t,n,r))}(n)&&(!on.supportsGnpOverHid(n)||t!==pn.DONGLE&&t!==pn.OTHER)}(e,n))}function nr(e,t,n,r,i){const o=tr(e),{hidChannel:s,onDisconnect:a}=o,c=new Xn(new Qn(r),e,i);return t||r.context===Ge.WEB_HID?Ee(new $n(e,s,a,c,n.softphoneInFocus,i)):function(e,t){return e.findDescriptor(Un.GN_TELEPHONY,jn.GN_TELEPHONY_CONT_SET,Vt.FEATURE)?Le(()=>(e.setFeatureReport(Un.GN_TELEPHONY,jn.GN_TELEPHONY_CONT_SET,1),Ee(!0))):t?function(e,t){const n=e.read(new Ft).pipe(Ae(e=>Jn[e]===t)),r=e.read(new Ut).pipe(Ae(e=>e.find(e=>Jn[e]===t))).pipe(Ae(t=>t?e.write(new Ft,t):Ee(!1)),ht());return n.pipe((i=Ee(!0),o=r,e=>e.pipe(Ae(e=>e?i:o),ht())));var i,o}(t,Vn.GN_TELEPHONY):Ee(!1)}(s,o).pipe(Ae(t=>new $n(e,s,a,c,n.softphoneInFocus,i)))}class rr{constructor(e){this.devComm=e,this.softphoneInFocus=new U,this.softphoneInFocus=this.devComm.consoleAppEvent.pipe(ze(e=>"softphone-in-focus"===e.event),Ae(e=>e.infocus),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=be(e);return j((function(t,r){(n?De(e,t,n):De(e,t)).subscribe(r)}))}(!1),ut(1)),this.softphoneInFocus.subscribe(()=>{})}setSharedSoftphoneInfo(e){if(!(null==e?void 0:e.partnerKey)||!(null==e?void 0:e.appId))return void yt("Unable to register with Jabra Direct: partnerKey or appId missing in config",null==e?void 0:e.logger,Me.WARNING);const t=e.partnerKey+e.appId,n=new Kt(5,"ns:OID",t);let{appName:r}=e;if((!e.appName||e.appName.length<3)&&(yt("App name missing in config. Fall back to use appId as app name.",null==e?void 0:e.logger,Me.WARNING),r=e.appId),r.length>100)return void yt("Unable to register with Jabra Direct: appName must be below 100 characters.",null==e?void 0:e.logger,Me.WARNING);const i={action:"set-softphone-info",name:r,id:n.toString()};this.devComm.writeAction(i)}}var ir,or,sr,ar,cr,ur,lr,fr;class hr{constructor(e){var t;ir.set(this,void 0),or.set(this,void 0),sr.set(this,void 0),ar.set(this,void 0),a(this,or,new rr(e._transport),"f"),s(this,or,"f").setSharedSoftphoneInfo(e._config),a(this,ir,e._transport,"f"),a(this,sr,null===(t=e._config)||void 0===t?void 0:t.logger,"f"),a(this,ar,e._readyEvents.pipe(it(e=>"ready"===e.event),Ae(e=>e.jabraDirectInstalled)),"f")}createCallControl(e){return this.supportsCallControl(e)?Ie(s(this,ar,"f").pipe(Pe(t=>nr(e,t,s(this,or,"f"),s(this,ir,"f"),s(this,sr,"f"))))):Promise.reject(new vt(`Device ${e.name} does not support call control.`,Fe.FEATURE_NOT_SUPPORTED))}supportsCallControl(e){return void 0!==tr(e)}}ir=new WeakMap,or=new WeakMap,sr=new WeakMap,ar=new WeakMap,function(e){e.HOLD_CURRENT="hold-current",e.END_CURRENT="end-current"}(cr||(cr={})),function(e){e.MUTED="muted",e.UNMUTED="unmuted",e.NO_ONGOING_CALLS="no-ongoing-calls"}(ur||(ur={})),function(e){e.ON_HOLD="on-hold",e.NOT_ON_HOLD="not-on-hold",e.NO_ONGOING_CALLS="no-ongoing-calls"}(lr||(lr={})),function(e){e.NO_INCOMING="no-incoming",e.AWAITING_RESPONSE="awaiting-response",e.RESOLVING_RESPONSE="resolving-response",e.ACCEPTED="accepted",e.REJECTED="rejected"}(fr||(fr={}));new WeakMap;new WeakMap;ur.NO_ONGOING_CALLS,lr.NO_ONGOING_CALLS,fr.NO_INCOMING;new WeakMap,new WeakMap;new WeakMap,new WeakMap}).call(this,n(13),n(5),n(14).Buffer)},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.implementationChanged="implementationChanged",e.deviceHoldStatusChanged="deviceHoldStatusChanged",e.deviceMuteStatusChanged="deviceMuteStatusChanged",e.deviceAnsweredCall="deviceAnsweredCall",e.deviceEndedCall="deviceEndedCall",e.deviceRejectedCall="deviceRejectedCall",e.loggableEvent="loggableEvent",e.webHidPermissionRequested="webHidPermissionRequested",e.deviceConnectionStatusChanged="deviceConnectionStatusChanged",e.deviceMuteChanged="deviceMuteChanged",e.deviceEventLogs="deviceEventLogs"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var r=n(4);function i(e){return(i="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 o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=h(e);if(t){var i=h(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(l,e);var t,n,i,o=u(l);function l(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),d(f(t=o.call(this)),"vendorName","Not Specified"),d(f(t),"isConnecting",!1),d(f(t),"isConnected",!1),d(f(t),"isMuted",!1),d(f(t),"errorCode",null),d(f(t),"disableRetry",!1),d(f(t),"logger",void 0),d(f(t),"config",void 0);var n=new r.EventEmitter;return Object.keys(n.__proto__).forEach((function(e){t[e]=n[e]})),t.config=e,t.vendorName=e.vendorName,t.logger=e.logger,t}return t=l,(n=[{key:"isDeviceAttached",get:function(){throw new Error("".concat(this.vendorName," - isDeviceAttatched getter not implemented"))}},{key:"isSupported",value:function(){return!0}},{key:"deviceLabelMatchesVendor",value:function(e){throw new Error("".concat(this.vendorName," - deviceLabelMatchesVendor() not implemented"))}},{key:"connect",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - connect() not implemented")))}},{key:"disconnect",value:function(){return Promise.reject(new Error("".concat(this.vendorName," - disconnect() not implemented")))}},{key:"incomingCall",value:function(e,t){return Promise.reject(new Error("".concat(this.vendorName," - incomingCall() not implemented")))}},{key:"outgoingCall",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - outgoingCall() not implemented")))}},{key:"answerCall",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - answerCall() not implemented")))}},{key:"rejectCall",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - rejectCall() not implemented")))}},{key:"endCall",value:function(e,t){return Promise.reject(new Error("".concat(this.vendorName," - endCall() not implemented")))}},{key:"endAllCalls",value:function(){return Promise.reject(new Error("".concat(this.vendorName," - endAllCalls() not implemented")))}},{key:"setMute",value:function(e){return Promise.reject(new Error("".concat(this.vendorName," - setMute() not implemented")))}},{key:"setHold",value:function(e,t){return Promise.reject(new Error("".concat(this.vendorName," - setHold() not implemented")))}},{key:"emitEvent",value:function(e,t){this.emit(e,{vendor:this,body:s({},t)})}},{key:"requestWebHidPermissions",value:function(e){this.logger.debug("Emitting premission request event"),this.emitEvent("webHidPermissionRequested",{callback:e})}},{key:"deviceAnsweredCall",value:function(e){this.emitEvent("deviceAnsweredCall",e)}},{key:"deviceRejectedCall",value:function(e){this.emitEvent("deviceRejectedCall",e)}},{key:"deviceEndedCall",value:function(e){this.emitEvent("deviceEndedCall",e)}},{key:"deviceMuteChanged",value:function(e){this.emitEvent("deviceMuteChanged",s({},e))}},{key:"deviceHoldStatusChanged",value:function(e){this.emitEvent("deviceHoldStatusChanged",s({},e))}},{key:"deviceEventLogs",value:function(e){this.emitEvent("deviceEventLogs",e)}},{key:"changeConnectionStatus",value:function(e){this.isConnected=e.isConnected,this.isConnecting=e.isConnecting,this.emitEvent("deviceConnectionStatusChanged",s({currentVendor:this},e))}}])&&a(t.prototype,n),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(r.EventEmitter)},function(e,t,n){e.exports=function(){"use strict";var e="undefined"==typeof window,t=!1,n=!1,r=!1,i=!1,o=!1,s=!1,a=!1,c=!1,u=!1,l=!1;return e||(t="undefined"!=typeof InstallTrigger,n=!!window.chrome,r=!!window.chrome,i=n&&!window.chrome.webstore&&!window.chrome.runtime,o=0<Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")||window.safari&&window.safari.pushNotification,s=!!window.opr&&!!window.opr.addons||!!window.opera,a=!!window.StyleMedia,c=n&&!!navigator.userAgent.match(/edg/i),u=(r||s)&&!!window.CSS,l=!(n||o||t||s||!document.documentMode)),{get isChrome(){return r},get isChromeOrChromium(){return n},get isChromium(){return i},get isFirefox(){return t},get isSafari(){return o},get isOpera(){return s},get isEdge(){return a},get isEdgeChromium(){return c},get isIE(){return l},get isBlink(){return u}}}()},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&g(e,"error",t,n)}(e,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){var i,o,s,a;if(u(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):y(i,i.length)}function v(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function y(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var u=c.length,l=y(c,u);for(n=0;n<u;++n)o(l[n],this,t)}return!0},a.prototype.addListener=function(e,t){return f(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return f(this,e,t,!0)},a.prototype.once=function(e,t){return u(t),this.on(e,d(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,d(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,o,s;if(u(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},a.prototype.listenerCount=v,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){},function(e,t){},function(e,t,n){},function(e,t,n){var r,i,o;i=[t,e],void 0===(o="function"==typeof(r=function(e,t){"use strict";var n=5e3,r="callback";function i(){return"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random())}function o(e){try{delete window[e]}catch(t){window[e]=void 0}}function s(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=e,c=t.timeout||n,u=t.jsonpCallback||r,l=void 0;return new Promise((function(n,r){var f=t.jsonpCallbackFunction||i(),h=u+"_"+f;window[f]=function(e){n({ok:!0,json:function(){return Promise.resolve(e)}}),l&&clearTimeout(l),s(h),o(f)},a+=-1===a.indexOf("?")?"?":"&";var d=document.createElement("script");d.setAttribute("src",""+a+u+"="+f),t.charset&&d.setAttribute("charset",t.charset),t.nonce&&d.setAttribute("nonce",t.nonce),t.referrerPolicy&&d.setAttribute("referrerPolicy",t.referrerPolicy),d.id=h,document.getElementsByTagName("head")[0].appendChild(d),l=setTimeout((function(){r(new Error("JSONP request to "+e+" timed out")),o(f),s(h),window[f]=function(){o(f)}}),c),d.onerror=function(){r(new Error("JSONP request to "+e+" failed")),o(f),s(h),l&&clearTimeout(l)}}))}})?r.apply(t,i):r)||(e.exports=o)},function(e,t,n){"use strict";n.d(t,"a",(function(){return Rt}));var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function o(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function s(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}Object.create;function a(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function u(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function l(e){return this instanceof l?(this.v=e,this):new l(e)}function f(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof l?Promise.resolve(n.value.v).then(c,u):f(o[0][2],n)}catch(e){f(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function f(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function h(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=a(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}Object.create;function d(e){return"function"==typeof e}function p(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var v=p((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function y(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var g=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=a(o),l=s.next();!l.done;l=s.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var f=this.initialTeardown;if(d(f))try{f()}catch(e){i=e instanceof v?e.errors:[e]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var p=a(h),y=p.next();!y.done;y=p.next()){var g=y.value;try{w(g)}catch(e){i=null!=i?i:[],e instanceof v?i=u(u([],c(i)),c(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new v(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)w(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&y(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&y(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),m=g.EMPTY;function b(e){return e instanceof g||e&&"closed"in e&&d(e.remove)&&d(e.add)&&d(e.unsubscribe)}function w(e){d(e)?e():e.unsubscribe()}var E={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},_={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=_.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,u([e,t],c(n))):setTimeout.apply(void 0,u([e,t],c(n)))},clearTimeout:function(e){var t=_.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function C(e){_.setTimeout((function(){var t=E.onUnhandledError;if(!t)throw e;t(e)}))}function O(){}var I=k("C",void 0,void 0);function k(e,t,n){return{kind:e,value:t,error:n}}var T=null;function S(e){if(E.useDeprecatedSynchronousErrorHandling){var t=!T;if(t&&(T={errorThrown:!1,error:null}),e(),t){var n=T,r=n.errorThrown,i=n.error;if(T=null,r)throw i}}else e()}var R=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,b(t)&&t.add(n)):n.destination=H,n}return i(t,e),t.create=function(e,t,n){return new x(e,t,n)},t.prototype.next=function(e){this.isStopped?L(function(e){return k("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?L(k("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?L(I,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(g),A=Function.prototype.bind;function P(e,t){return A.call(e,t)}var N=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){D(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){D(e)}else D(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){D(e)}},e}(),x=function(e){function t(t,n,r){var i,o,s=e.call(this)||this;d(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&E.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&P(t.next,o),error:t.error&&P(t.error,o),complete:t.complete&&P(t.complete,o)}):i=t;return s.destination=new N(i),s}return i(t,e),t}(R);function D(e){var t;E.useDeprecatedSynchronousErrorHandling?(t=e,E.useDeprecatedSynchronousErrorHandling&&T&&(T.errorThrown=!0,T.error=t)):C(e)}function L(e,t){var n=E.onStoppedNotification;n&&_.setTimeout((function(){return n(e,t)}))}var H={closed:!0,next:O,error:function(e){throw e},complete:O},U="function"==typeof Symbol&&Symbol.observable||"@@observable";function M(e){return e}function j(e){return 0===e.length?M:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var F=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof R||function(e){return e&&d(e.next)&&d(e.error)&&d(e.complete)}(r)&&b(r)?e:new x(e,t,n);return S((function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=B(t))((function(t,r){var i=new x({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[U]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return j(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=B(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function B(e){var t;return null!==(t=null!=e?e:E.Promise)&&void 0!==t?t:Promise}var G,Y=p((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),V=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(t,e),t.prototype.lift=function(e){var t=new W(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Y},t.prototype.next=function(e){var t=this;S((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=a(t.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;S((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;S((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this.hasError,r=this.isStopped,i=this.observers;return n||r?m:(this.currentObservers=null,i.push(e),new g((function(){t.currentObservers=null,y(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,n=this.thrownError,r=this.isStopped;t?e.error(n):r&&e.complete()},t.prototype.asObservable=function(){var e=new F;return e.source=this,e},t.create=function(e,t){return new W(e,t)},t}(F),W=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return i(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:m},t}(V),K=n(9),q=n.n(K),z=n(2);!function(e){e[e.Unknown=0]="Unknown",e[e.AcceptCall=1]="AcceptCall",e[e.TerminateCall=2]="TerminateCall",e[e.HoldCall=3]="HoldCall",e[e.ResumeCall=4]="ResumeCall",e[e.Flash=5]="Flash",e[e.CallInProgress=6]="CallInProgress",e[e.CallRinging=7]="CallRinging",e[e.CallEnded=8]="CallEnded",e[e.TransferToHeadset=9]="TransferToHeadset",e[e.TransferToSpeaker=10]="TransferToSpeaker",e[e.Mute=11]="Mute",e[e.Unmute=12]="Unmute",e[e.MobileCallRinging=13]="MobileCallRinging",e[e.MobileCallInProgress=14]="MobileCallInProgress",e[e.MobileCallEnded=15]="MobileCallEnded",e[e.DOn=16]="DOn",e[e.DOff=17]="DOff",e[e.CallIdle=18]="CallIdle",e[e.Play=19]="Play",e[e.Pause=20]="Pause",e[e.Stop=21]="Stop",e[e.DTMLKey=22]="DTMLKey",e[e.RejectCall=23]="RejectCall",e[e.MakeCall=24]="MakeCall",e[e.Hook=25]="Hook",e[e.HookIdle=26]="HookIdle",e[e.HookDocked=27]="HookDocked",e[e.HookUndocked=28]="HookUndocked",e[e.BaseEvent=29]="BaseEvent",e[e.CallAnsweredAndEnded=30]="CallAnsweredAndEnded",e[e.CallUnansweredAndEnded=31]="CallUnansweredAndEnded",e[e.DeviceChange=32]="DeviceChange",e[e.DeviceArrived=33]="DeviceArrived",e[e.DeviceRemoved=34]="DeviceRemoved"}(G||(G={}));var $=n(3),J=n.n($);function X(e){return(X="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 Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ee(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function te(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){ee(o,r,i,s,a,"next",e)}function a(e){ee(o,r,i,s,a,"throw",e)}s(void 0)}))}}function ne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function re(e,t){return(re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ae(e);if(t){var i=ae(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return oe(this,n)}}function oe(e,t){if(t&&("object"===X(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return se(e)}function se(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ue,le,fe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&re(e,t)}(y,e);var t,n,r,i,o,s,a,c,u,l,f,h,d,p,v=ie(y);function y(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,y),ce(se(t=v.call(this,e)),"activePollingInterval",2e3),ce(se(t),"connectedDeviceInterval",6e3),ce(se(t),"disconnectedDeviceInterval",2e3),ce(se(t),"deviceIdRetryInterval",2e3),ce(se(t),"vendorName","Plantronics"),ce(se(t),"pluginName","genesys-cloud-headset-library"),ce(se(t),"apiHost","https://127.0.0.1:32018/Spokes"),ce(se(t),"isActive",!1),ce(se(t),"disableEventPolling",!1),ce(se(t),"config",void 0),ce(se(t),"deviceStatusTimer",null),ce(se(t),"isRetry",!1),ce(se(t),"_deviceInfo",void 0),ce(se(t),"callEventsTimerId",void 0),ce(se(t),"deviceStatusTimerId",void 0),ce(se(t),"incomingConversationId",void 0),ce(se(t),"callMappings",{}),t.config=e,t._deviceInfo=null,t.callEventsTimerId=null,t.deviceStatusTimerId=null,t.incomingConversationId=null,t}return t=y,n=[{key:"_createCallMapping",value:function(e){var t=Math.round(Math.random()*Math.pow(10,8));return this.callMappings[e]=t,this.callMappings[t]=e,this.logger.info("Created callId mapping for plantronics headset",{conversationId:e,plantronicsCallId:t}),t}},{key:"clearTimeouts",value:function(){clearTimeout(this.callEventsTimerId),clearTimeout(this.deviceStatusTimerId)}},{key:"deviceLabelMatchesVendor",value:function(e){var t=e.toLowerCase();return["plantronics","plt","poly","(047f:"].some((function(e){return t.includes(e)}))}},{key:"deviceName",get:function(){var e;return null===(e=this._deviceInfo)||void 0===e?void 0:e.ProductName}},{key:"deviceInfo",get:function(){return this._deviceInfo}},{key:"isDeviceAttached",get:function(){return!!this.deviceInfo}},{key:"pollForCallEvents",value:function(){var e=this;this.callEventsTimerId&&(clearTimeout(this.callEventsTimerId),this.callEventsTimerId=null),this.isConnected&&!this.disableEventPolling&&(this.logger.debug("**** POLLING FOR CALL EVENTS ****"),this.getCallEvents()),this.callEventsTimerId=setTimeout((function(){e.pollForCallEvents()}),this.activePollingInterval)}},{key:"pollForDeviceStatus",value:function(){var e=this;this.deviceStatusTimerId&&(clearTimeout(this.deviceStatusTimerId),this.deviceStatusTimerId=null),!this.isConnected||this.isConnecting||this.disableEventPolling||(this.logger.debug("**** POLLING FOR DEVICE STATUS ****"),this.getDeviceStatus()),this.deviceStatusTimerId=setTimeout((function(){e.pollForDeviceStatus()}),this.isDeviceAttached?this.connectedDeviceInterval:this.disconnectedDeviceInterval)}},{key:"_makeRequestTask",value:(p=te(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._makeRequest(t,n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"_fetch",value:function(e){return q()(e)}},{key:"_makeRequest",value:(d=te(regeneratorRuntime.mark((function e(t,n){var r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=y.instance,e.abrupt("return",this._fetch("".concat(this.apiHost).concat(t)).then((function(e){return e.json()})).then((function(e){if(!1===e.ok||"Error"===e.Type_Name){if(404===e.status){if(n){i.isConnected&&i.changeConnectionStatus({isConnected:!1,isConnecting:i.isConnecting}),i.disconnect();var o=new Error("Headset: Failed connection to middleware. Headset features unavailable.");return o.handled=!0,i.logger.info(o),Promise.reject(o)}return i._makeRequestTask(t,!0)}return J.a.isFirefox&&(i.errorCode="browser",i.disableRetry=!0),Promise.reject(e)}return r?(!i.isConnected&&i.changeConnectionStatus({isConnected:!0,isConnecting:i.isConnecting}),e):Promise.reject(new Error("Application destroyed."))})).catch((function(e){return Promise.reject(e)})));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_checkIsActiveTask",value:(h=te(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getActiveCalls();case 2:t=e.sent,this.isActive=!!t.length;case 4:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"_getActiveCalls",value:(f=te(regeneratorRuntime.mark((function e(){var t,n,r,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._makeRequestTask("/CallServices/CallManagerState?");case 3:i=e.sent,r=i,e.next=11;break;case 7:return e.prev=7,e.t0=e.catch(0),this.logger.info("Error making request for active calls",e.t0),e.abrupt("return",[]);case 11:if(Array.isArray(null===(t=r)||void 0===t||null===(n=t.Result)||void 0===n?void 0:n.Calls)){e.next=13;break}return e.abrupt("return",[]);case 13:return e.abrupt("return",r.Result.Calls.filter((function(e){return e.Source===o.pluginName})));case 14:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return f.apply(this,arguments)})},{key:"getCallEvents",value:(l=te(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._makeRequestTask("/CallServices/CallEvents?name=".concat(this.pluginName));case 3:t=e.sent,e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(0),this.logger.info("Error making request for call events",e.t0),e.abrupt("return");case 10:t.Result&&t.Result.forEach((function(e){var t=G[e.Action];if(!t)return n.logger.info("Unknown call event from headset",{event:e});var r={name:t,event:e};n.logger.debug("headset info",r),n.callCorrespondingFunction(r)}));case 11:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(){return l.apply(this,arguments)})},{key:"getDeviceStatus",value:(u=te(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._makeRequestTask("/DeviceServices/Info").then((function(e){t._deviceInfo=e.Result})).catch((function(e){e.Err&&e.Err.Description.includes("no supported devices")||t.logger.info("Error making request for device status",e)}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"callCorrespondingFunction",value:function(e){var t=e.event.CallId.Id,n=this.callMappings[t];switch(e.name){case"AcceptCall":this.deviceAnsweredCall(Z(Z({},e),{},{conversationId:n}));break;case"RejectCall":this.deviceRejectedCall({name:e.name,conversationId:this.incomingConversationId});break;case"TerminateCall":this.deviceEndedCall(Z(Z({},e),{},{conversationId:n}));break;case"CallEnded":delete this.callMappings[t],delete this.callMappings[n],this._checkIsActiveTask();break;case"Mute":this.deviceMuteChanged(Z(Z({isMuted:!0},e),{},{conversationId:n}));break;case"Unmute":this.deviceMuteChanged(Z(Z({isMuted:!1},e),{},{conversationId:n}));break;case"HoldCall":this.deviceHoldStatusChanged(Z(Z({holdRequested:!0},e),{},{conversationId:n}));break;case"ResumeCall":this.deviceHoldStatusChanged(Z(Z({holdRequested:!1},e),{},{conversationId:n}));break;default:this.logger.info("A headset event has occurred",Z(Z({},e),{},{conversationId:n})),this.deviceEventLogs(Z(Z({},e),{},{conversationId:n}))}}},{key:"connect",value:function(){var e=this;return!this.isConnecting&&this.changeConnectionStatus({isConnected:this.isConnected,isConnecting:!0}),this.pollForDeviceStatus(),this.pollForCallEvents(),this._makeRequestTask("/SessionManager/Register?name=".concat(this.pluginName)).catch((function(t){return t.Err&&"Plugin exists"===t.Err.Description?e.logger.debug("Plugin already exists",t):Promise.reject(t)})).then((function(){return e._makeRequestTask("/SessionManager/IsActive?name=".concat(e.pluginName,"&active=true"))})).catch((function(t){return t.Err&&!t.isError?e.logger.debug("Is Active",t):Promise.reject(t)})).then((function(t){return!0!==(null==t?void 0:t.Result)?Promise.reject(t):e._makeRequestTask("/UserPreference/SetDefaultSoftPhone?name=".concat(e.pluginName))})).then((function(){e.getDeviceStatus()})).then((function(){return e._getActiveCalls()})).then((function(t){return t.length?(e.isActive=!0,e.logger.info("Currently active calls in the session")):e.getCallEvents()})).catch((function(t){return null!=t&&t.handled?e.logger.error("Unable to properly connect headset"):Promise.reject(t)})).finally((function(){e.isConnecting&&e.changeConnectionStatus({isConnected:e.isConnected,isConnecting:!1})}))}},{key:"disconnect",value:(c=te(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isConnected){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._makeRequestTask("/SessionManager/UnRegister?name=".concat(this.pluginName));case 4:this.clearTimeouts(),this._deviceInfo=null,this.isConnected&&this.changeConnectionStatus({isConnected:!1,isConnecting:this.isConnecting}),this.isActive=!1;case 8:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"incomingCall",value:function(e){this.logger.info("Inside incomingCall of selected implementation (Plantronics/Poly)");var t=e.conversationId,n=e.contactName;if(!t)throw new Error("Must provide conversationId");var r=this._createCallMapping(t);this.incomingConversationId=t;var i="?name=".concat(this.pluginName,"&tones=Unknown&route=ToHeadset"),o='"Id":"'.concat(r,'"');if(i+="&callID={".concat(encodeURI(o),"}"),n){var s='"Name":"'.concat(n,'"');i+="&contact={".concat(encodeURI(s),"}")}return this.logger.info("params of endpoint",i),this.isActive=!0,this._makeRequestTask("/CallServices/IncomingCall".concat(i))}},{key:"outgoingCall",value:function(e){var t=e.conversationId,n=e.contactName;if(!t)throw new Error("Must provide conversationId");var r=this._createCallMapping(t),i="?name=".concat(this.pluginName,"&tones=Unknown&route=ToHeadset"),o='"Id":"'.concat(r,'"');if(i+="&callID={".concat(encodeURI(o),"}"),n){var s='"Name":"'.concat(n,'"');i+="&contact={".concat(encodeURI(s),"}")}return this.isActive=!0,this._makeRequestTask("/CallServices/OutgoingCall".concat(i))}},{key:"answerCall",value:function(e){var t=this.callMappings[e],n='"Id":"'.concat(t,'"'),r="?name=".concat(this.pluginName,"&callID={").concat(encodeURI(n),"}");return this.isActive=!0,this.incomingConversationId=null,this._makeRequestTask("/CallServices/AnswerCall".concat(r))}},{key:"rejectCall",value:function(e){return this.incomingConversationId=null,this.endCall(e)}},{key:"endCall",value:(a=te(regeneratorRuntime.mark((function e(t){var n,r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="?name=".concat(this.pluginName),r=this.callMappings[t],i='"Id":"'.concat(r,'"'),n+="&callID={".concat(encodeURI(i),"}"),e.next=6,this._makeRequestTask("/CallServices/TerminateCall".concat(n));case 6:return o=e.sent,e.next=9,this.getCallEvents();case 9:return this._checkIsActiveTask(),e.abrupt("return",o);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"endAllCalls",value:(s=te(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getActiveCalls();case 2:e.sent.forEach((function(e){return t.endCall(t.callMappings[e.CallId])}));case 4:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"setMute",value:(o=te(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._makeRequestTask("/CallServices/MuteCall?name=".concat(this.pluginName,"&muted=").concat(t));case 2:return n=e.sent,e.abrupt("return",n);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"setHold",value:(i=te(regeneratorRuntime.mark((function e(t,n){var r,i,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.callMappings[t],i='"Id":"'.concat(r,'"'),o="?name=".concat(this.pluginName,"&callID={").concat(encodeURI(i),"}"),e.next=5,this._makeRequestTask("/CallServices/".concat(n?"HoldCall":"ResumeCall").concat(o));case 5:return s=e.sent,e.abrupt("return",s);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})}],r=[{key:"getInstance",value:function(e){return y.instance&&!e.createNew||(y.instance=new y(e)),y.instance}}],n&&ne(t.prototype,n),r&&ne(t,r),Object.defineProperty(t,"prototype",{writable:!1}),y}(z.a);function he(){return!!window._HostedContextFunctions}function de(e){return new Promise((function(t,n){try{var r=JSON.stringify(e);window.cefQuery({request:r,persistent:!1,onSuccess:function(e){try{var n=JSON.parse(e);t(n)}catch(e){t({})}},onFailure:function(e){n(e)}})}catch(e){console.error("Error requesting desktop promise",e),n(e)}}))}function pe(e){return(pe="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 ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return(ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function me(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ee(e);if(t){var i=Ee(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return be(this,n)}}function be(e,t){if(t&&("object"===pe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return we(e)}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ee(e){return(Ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}ce(fe,"instance",void 0),function(e){e.SocketConnected="SocketConnected",e.EstablishConnection="EstablishConnection",e.SPLogin="SPLoggedIn",e.SPLogout="SPLoggedOut",e.TerminateConnection="TerminateConnection",e.IncomingCall="IncomingCall",e.IncomingCallRejected="InCallRejected",e.IncomingCallAccepted="InCallAccepted",e.OutgoingCall="OutgoingCall",e.CallEnded="CallEnded",e.SystemInformation="SystemInformation",e.HeadsetConnected="HeadsetConnected",e.HeadsetDisconnected="HeadsetDisconnected",e.Hold="CallHold",e.Resume="HeldCallResumed",e.MuteFromApp="MuteHeadset",e.UnmuteFromApp="UnmuteHeadset",e.MuteFromHeadset="MuteSoftphone",e.UnmuteFromHeadset="UnmuteSoftphone"}(ue||(ue={})),function(e){e.Request="Request",e.Notification="Notification",e.Ack="Acknowledgement"}(le||(le={}));var Ce=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ge(e,t)}(o,e);var t,n,r,i=me(o);function o(){var e;ve(this,o);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return _e(we(e=i.call.apply(i,[this].concat(n))),"connectTimeout",5e3),_e(we(e),"vendorName","Sennheiser"),_e(we(e),"isActive",!1),_e(we(e),"devices",null),_e(we(e),"activeDeviceId",null),_e(we(e),"websocketConnected",!1),_e(we(e),"websocket",null),_e(we(e),"deviceInfo",null),_e(we(e),"webSocketOnOpen",(function(){e.websocketConnected=!0,e.logger.info("websocket open the sennheiser software")})),e}return t=o,r=[{key:"getInstance",value:function(e){return o.instance&&!e.createNew||(o.instance=new o(e)),o.instance}}],(n=[{key:"deviceLabelMatchesVendor",value:function(e){var t=e.toLowerCase();return["senn","epos"].some((function(e){return t.includes(e)}))}},{key:"deviceName",get:function(){return this.deviceInfo&&this.deviceInfo.ProductName}},{key:"isDeviceAttached",get:function(){return!!this.deviceInfo}},{key:"_handleError",value:function(e){this.logger.error("Non-zero return code from sennheiser",e)}},{key:"_handleAck",value:function(e){this.logger.debug("Received Ack for ".concat(e.Event))}},{key:"_sendMessage",value:function(e){this.logger.debug("sending sennheiser message",e),this.websocket.send(JSON.stringify(e))}},{key:"_registerSoftphone",value:function(){var e={Event:ue.EstablishConnection,EventType:le.Request,SPName:"Genesys Cloud Softphone",SPIconImage:"SPImage.ico",RedialSupport:"No",OffHookSupport:"No",MuteSupport:"Yes",DNDOption:"No"};this._sendMessage(e)}},{key:"connect",value:function(){!this.isConnecting&&this.changeConnectionStatus({isConnected:!1,isConnecting:!0});var e=new WebSocket("wss://127.0.0.1:41088");return e.onopen=this.webSocketOnOpen.bind(this),e.onclose=this.webSocketOnClose.bind(this),e.onmessage=this._handleMessage.bind(this),this.websocket=e,Promise.resolve()}},{key:"webSocketOnClose",value:function(e){this.websocketConnected=!1,e.wasClean||this.logger.error(e),this.isConnected||(this.logger.error(new Error("Failed to connect to sennheiser software. Make sure it is installed")),J.a.isFireFox&&(this.errorCode="browser",this.disableRetry=!0)),(this.isConnected||this.isConnecting)&&this.changeConnectionStatus({isConnected:!1,isConnecting:!1})}},{key:"disconnect",value:function(){return this.isConnected?(this._sendMessage({Event:ue.TerminateConnection,EventType:le.Request}),Promise.resolve()):Promise.resolve()}},{key:"setMute",value:function(e){return this._sendMessage({Event:e?ue.MuteFromApp:ue.UnmuteFromApp,EventType:le.Request}),Promise.resolve()}},{key:"setHold",value:function(e,t){return this._sendMessage({Event:t?ue.Hold:ue.Resume,EventType:le.Request,CallID:e}),Promise.resolve()}},{key:"incomingCall",value:function(e){return this._sendMessage({Event:ue.IncomingCall,EventType:le.Request,CallID:e.conversationId}),Promise.resolve()}},{key:"answerCall",value:function(e){return this._sendMessage({Event:ue.IncomingCallAccepted,EventType:le.Request,CallID:e}),Promise.resolve()}},{key:"rejectCall",value:function(e){return this._sendMessage({Event:ue.IncomingCallRejected,EventType:le.Request,CallID:e}),Promise.resolve()}},{key:"outgoingCall",value:function(e){var t=e.conversationId;return this._sendMessage({Event:ue.OutgoingCall,EventType:le.Request,CallID:t}),Promise.resolve()}},{key:"endCall",value:function(e){return this._sendMessage({Event:ue.CallEnded,EventType:le.Request,CallID:e}),Promise.resolve()}},{key:"endAllCalls",value:function(){return this.logger.warn("There is no functionality defined for SennheiserService.endAllCalls()"),Promise.resolve()}},{key:"_handleMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(t){return this.logger.error(t),void this.logger.error("Failed to parse sennheiser payload",{message:e})}if(this.logger.debug("incoming sennheiser message",t),t.ReturnCode)this._handleError(t);else{var n=t.CallID;switch(t.Event){case ue.SocketConnected:this._registerSoftphone();break;case ue.EstablishConnection:this._sendMessage({Event:ue.SPLogin,EventType:le.Request});break;case ue.SPLogin:this.isConnected&&!this.isConnecting||this.changeConnectionStatus({isConnected:!0,isConnecting:!1}),this._sendMessage({Event:ue.SystemInformation,EventType:le.Request});break;case ue.HeadsetConnected:t.HeadsetName&&(this.deviceInfo={deviceName:t.HeadsetName,headsetType:t.HeadsetType});break;case ue.HeadsetDisconnected:t.HeadsetName===this.deviceName&&(this.deviceInfo=null);break;case ue.IncomingCallAccepted:t.EventType===le.Notification&&this.deviceAnsweredCall({name:t.Event,conversationId:n});break;case ue.Hold:if(t.EventType===le.Ack){this._handleAck(t);break}this.deviceHoldStatusChanged({holdRequested:!0,name:t.Event,conversationId:n});break;case ue.Resume:if(t.EventType===le.Ack){this._handleAck(t);break}this.deviceHoldStatusChanged({holdRequested:!1,name:t.Event,conversationId:n});break;case ue.MuteFromHeadset:this.deviceMuteChanged({isMuted:!0,name:t.Event});break;case ue.UnmuteFromHeadset:this.deviceMuteChanged({isMuted:!1,name:t.Event});break;case ue.CallEnded:t.EventType===le.Notification&&this.deviceEndedCall({name:t.Event,conversationId:n});break;case ue.IncomingCallRejected:this.deviceRejectedCall({name:t.Event,conversationId:n});break;case ue.TerminateConnection:1===this.websocket.readyState&&this.websocket.close(),this.websocket=null;break;default:t.EventType===le.Ack&&this._handleAck(t)}}}}])&&ye(t.prototype,n),r&&ye(t,r),Object.defineProperty(t,"prototype",{writable:!1}),o}(z.a);_e(Ce,"instance",void 0);var Oe=n(0),Ie=p((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function ke(e,t){var n="object"==typeof t;return new Promise((function(r,i){var o=new x({next:function(e){r(e),o.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new Ie)}});e.subscribe(o)}))}var Te=function(e){function t(t,n){return e.call(this)||this}return i(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(g),Se={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=Se.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,u([e,t],c(n))):setInterval.apply(void 0,u([e,t],c(n)))},clearInterval:function(e){var t=Se.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},Re=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return i(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(r,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),Se.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;Se.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,y(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Te),Ae={now:function(){return(Ae.delegate||Date).now()},delegate:void 0},Pe=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=Ae.now,e}(),Ne=new(function(e){function t(t,n){void 0===n&&(n=Pe.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r._scheduled=void 0,r}return i(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(Pe))(Re);function xe(e){return function(t){if(function(e){return d(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}var De="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Le(e){if(e instanceof F)return e;if(null!=e){if(function(e){return d(e[U])}(e))return c=e,new F((function(e){var t=c[U]();if(d(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if((o=e)&&"number"==typeof o.length&&"function"!=typeof o)return i=e,new F((function(e){for(var t=0;t<i.length&&!e.closed;t++)e.next(i[t]);e.complete()}));if(d(null==(r=e)?void 0:r.then))return n=e,new F((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,C)}));if(function(e){return Symbol.asyncIterator&&d(null==e?void 0:e[Symbol.asyncIterator])}(e))return He(e);if(function(e){return d(null==e?void 0:e[De])}(e))return t=e,new F((function(e){var n,r;try{for(var i=a(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()}));if(function(e){return d(null==e?void 0:e.getReader)}(e))return He(function(e){return f(this,arguments,(function(){var t,n,r;return s(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,l(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,l(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,l(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e))}var t,n,r,i,o,c;throw function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(e)}function He(e){return new F((function(t){(function(e,t){var n,r,i,a;return o(this,void 0,void 0,(function(){var o,c;return s(this,(function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),n=h(e),s.label=1;case 1:return[4,n.next()];case 2:if((r=s.sent()).done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=s.sent(),i={error:c},[3,11];case 6:return s.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function Ue(e,t,n,r,i){return new Me(e,t,n,r,i)}var Me=function(e){function t(t,n,r,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return i(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(R);var je=p((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function Fe(e,t){var n,r=(n=e)instanceof Date&&!isNaN(n)?{first:e}:"number"==typeof e?{each:e}:e,i=r.first,o=r.each,s=r.with,a=void 0===s?Be:s,c=r.scheduler,u=void 0===c?null!=t?t:Ne:c,l=r.meta,f=void 0===l?null:l;if(null==i&&null==o)throw new TypeError("No timeout provided.");return xe((function(e,t){var n,r,s=null,c=0,l=function(e){r=function(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule((function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(o),!i)return o}(t,u,(function(){try{n.unsubscribe(),Le(a({meta:f,lastValue:s,seen:c})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(Ue(t,(function(e){null==r||r.unsubscribe(),c++,t.next(s=e),o>0&&l(o)}),void 0,void 0,(function(){(null==r?void 0:r.closed)||null==r||r.unsubscribe(),s=null}))),!c&&l(null!=i?"number"==typeof i?i:+i-u.now():o)}))}function Be(e){throw new je(e)}function Ge(e){return xe((function(t,n){var r=!1;t.subscribe(Ue(n,(function(e){r=!0,n.next(e)}),(function(){r||n.next(e),n.complete()})))}))}function Ye(e,t){return xe((function(n,r){var i=0;n.subscribe(Ue(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}var Ve=new F((function(e){return e.complete()}));function We(e){return e<=0?function(){return Ve}:xe((function(t,n){var r=0;t.subscribe(Ue(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function Ke(e){return void 0===e&&(e=qe),xe((function(t,n){var r=!1;t.subscribe(Ue(n,(function(e){r=!0,n.next(e)}),(function(){return r?n.complete():n.error(e())})))}))}function qe(){return new Ie}function ze(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?Ye((function(t,n){return e(t,n,r)})):M,We(1),n?Ge(t):Ke((function(){return new Ie})))}}function $e(e,t){return xe((function(n,r){var i=0;n.subscribe(Ue(r,(function(n){r.next(e.call(t,n,i++))})))}))}function Je(e){return(Je="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 Xe(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Qe(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){Xe(o,r,i,s,a,"next",e)}function a(e){Xe(o,r,i,s,a,"throw",e)}s(void 0)}))}}function Ze(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function et(e,t){return(et=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=it(e);if(t){var i=it(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return nt(this,n)}}function nt(e,t){if(t&&("object"===Je(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return rt(e)}function rt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function it(e){return(it=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var st,at=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&et(e,t)}(b,e);var t,n,r,i,o,s,a,c,u,l,f,h,d,p,v,y,g,m=tt(b);function b(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,b),ot(rt(t=m.call(this,e)),"headsetEventSubscription",void 0),ot(rt(t),"isActive",!1),ot(rt(t),"_deviceInfo",void 0),ot(rt(t),"isMuted",!1),ot(rt(t),"isHeld",!1),ot(rt(t),"version",null),ot(rt(t),"_connectDeferred",void 0),ot(rt(t),"jabraSdk",void 0),ot(rt(t),"callControlFactory",void 0),ot(rt(t),"callControl",void 0),ot(rt(t),"ongoingCalls",0),ot(rt(t),"callLock",!1),ot(rt(t),"pendingConversationId",void 0),ot(rt(t),"activeConversationId",void 0),t.vendorName="Jabra",t}return t=b,n=[{key:"isSupported",value:function(){return window.navigator.hid&&!he()}},{key:"deviceLabelMatchesVendor",value:function(e){var t=e.toLowerCase();return!!["jabra"].some((function(e){return t.includes(e)}))}},{key:"deviceInfo",get:function(){return this._deviceInfo}},{key:"deviceName",get:function(){var e;return null===(e=this.deviceInfo)||void 0===e?void 0:e.deviceName}},{key:"isDeviceAttached",get:function(){return!!this.deviceInfo}},{key:"resetState",value:function(){this.setHold(null,!1),this.setMute(!1)}},{key:"_processEvents",value:function(e){var t=this;this.headsetEventSubscription=e.deviceSignals.subscribe(function(){var n=Qe(regeneratorRuntime.mark((function n(r){var i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.callLock){n.next=3;break}return t.logger.debug("Currently not in possession of the Call Lock; Cannot react to Device Actions"),n.abrupt("return");case 3:n.t0=r.type,n.next=n.t0===Oe.u.HOOK_SWITCH?6:n.t0===Oe.u.FLASH||n.t0===Oe.u.ALT_HOLD?8:n.t0===Oe.u.PHONE_MUTE?12:n.t0===Oe.u.REJECT_CALL?16:19;break;case 6:if(r.value)e.offHook(!0),e.ring(!1),t.activeConversationId=t.pendingConversationId,t.deviceAnsweredCall({name:"CallOffHook",code:r.type,conversationId:t.pendingConversationId});else{e.mute(!1),e.hold(!1),e.offHook(!1),t.deviceEndedCall({name:"CallOnHook",code:r.type,conversationId:t.activeConversationId});try{e.releaseCallLock()}catch(e){i=e.message,o=e.type,t.checkForCallLockError(i,o)?t.logger.info(i):t.logger.error(o,i)}finally{t.activeConversationId=null,t.callLock=!1}}return n.abrupt("break",19);case 8:return t.isHeld=!t.isHeld,e.hold(t.isHeld),t.deviceHoldStatusChanged({holdRequested:t.isHeld,name:t.isHeld?"OnHold":"ResumeCall",code:r.type,conversationId:t.activeConversationId}),n.abrupt("break",19);case 12:return t.isMuted=!t.isMuted,e.mute(t.isMuted),t.deviceMuteChanged({isMuted:t.isMuted,name:t.isMuted?"CallMuted":"CallUnmuted",code:r.type,conversationId:t.activeConversationId}),n.abrupt("break",19);case 16:e.ring(!1),t.deviceRejectedCall({name:Oe.u[r.type],conversationId:t.pendingConversationId});try{e.releaseCallLock()}catch(e){s=e.message,a=e.type,t.checkForCallLockError(s,a)?t.logger.info(s):t.logger.error(a,s)}finally{t.pendingConversationId=null,t.callLock=!1}case 19:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}())}},{key:"setMute",value:(g=Qe(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.callLock){e.next=2;break}return e.abrupt("return");case 2:this.isMuted=t,this.callControl.mute(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"setHold",value:(y=Qe(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.callLock){e.next=2;break}return e.abrupt("return");case 2:this.isHeld=n,this.callControl.hold(n);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"incomingCall",value:(v=Qe(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.pendingConversationId=t.conversationId,e.prev=1,e.next=4,this.callControl.takeCallLock();case 4:this.callLock=e.sent,this.callLock&&this.callControl.ring(!0),e.next=13;break;case 8:e.prev=8,e.t0=e.catch(1),n=e.t0.message,r=e.t0.type,this.checkForCallLockError(n,r)?(this.logger.info(n),this.callControl.ring(!0)):this.logger.error(r,n);case 13:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e){return v.apply(this,arguments)})},{key:"answerCall",value:(p=Qe(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.callLock){e.next=2;break}return e.abrupt("return");case 2:this.callControl.ring(!1),this.callControl.offHook(!0),this.activeConversationId=this.pendingConversationId,this.pendingConversationId=null;case 6:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"rejectCall",value:(d=Qe(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.callLock){e.next=3;break}return e.abrupt("return",this.logger.info("Currently not in possession of the Call Lock; Cannot react to Device Actions"));case 3:this.callControl.ring(!1),this.callControl.releaseCallLock(),e.next=12;break;case 7:e.prev=7,e.t0=e.catch(0),t=e.t0.message,n=e.t0.type,this.checkForCallLockError(t,n)?this.logger.info(t):this.logger.error(n,t);case 12:return e.prev=12,this.pendingConversationId=null,this.callLock=!1,this.resetState(),e.finish(12);case 17:case"end":return e.stop()}}),e,this,[[0,7,12,17]])}))),function(){return d.apply(this,arguments)})},{key:"outgoingCall",value:(h=Qe(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.callControl.takeCallLock();case 3:if(this.callLock=e.sent,!this.callLock){e.next=8;break}return this.activeConversationId=t.conversationId,this.callControl.offHook(!0),e.abrupt("return",Promise.resolve());case 8:e.next=15;break;case 10:e.prev=10,e.t0=e.catch(0),n=e.t0.message,r=e.t0.type,this.checkForCallLockError(n,r)?(this.logger.info(n),this.callControl.offHook(!0)):this.logger.error(r,n);case 15:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(e){return h.apply(this,arguments)})},{key:"endCall",value:(f=Qe(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=2;break}return e.abrupt("return");case 2:if(t===this.activeConversationId&&(this.activeConversationId=null),e.prev=3,this.callLock){e.next=6;break}return e.abrupt("return",this.logger.info("Currently not in possession of the Call Lock; Cannot react to Device Actions"));case 6:this.callControl.offHook(!1),this.callControl.releaseCallLock(),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(3),r=e.t0.message,i=e.t0.type,this.checkForCallLockError(r,i)?this.logger.info(r):this.logger.error(i,r);case 15:return e.prev=15,this.callLock=!1,this.resetState(),e.finish(15);case 19:case"end":return e.stop()}}),e,this,[[3,10,15,19]])}))),function(e,t){return f.apply(this,arguments)})},{key:"endAllCalls",value:(l=Qe(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.callLock){e.next=3;break}return e.abrupt("return",this.logger.info("Currently not in possession of the Call Lock; Cannot react to Device Actions"));case 3:this.activeConversationId=null,this.callControl.offHook(!1),this.callControl.releaseCallLock(),e.next=13;break;case 8:e.prev=8,e.t0=e.catch(0),t=e.t0.message,n=e.t0.type,this.checkForCallLockError(t,n)?this.logger.info(t):this.logger.error(n,t);case 13:return e.prev=13,this.callLock=!1,this.resetState(),e.finish(13);case 17:case"end":return e.stop()}}),e,this,[[0,8,13,17]])}))),function(){return l.apply(this,arguments)})},{key:"isDeviceInList",value:function(e,t){var n;return t.toLowerCase().includes(null==e||null===(n=e.name)||void 0===n?void 0:n.toLowerCase())}},{key:"connect",value:(u=Qe(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isConnecting){e.next=2;break}return e.abrupt("return");case 2:if(this.changeConnectionStatus({isConnected:this.isConnected,isConnecting:!0}),this.jabraSdk){e.next=8;break}return e.next=6,this.initializeJabraSdk();case 6:this.jabraSdk=e.sent,this.callControlFactory=this.createCallControlFactory(this.jabraSdk);case 8:return n=t.toLocaleLowerCase(),this._deviceInfo=null,e.next=12,this.getPreviouslyConnectedDevice(n);case 12:if(r=e.sent){e.next=24;break}return e.prev=14,e.next=17,this.getDeviceFromWebhid(n);case 17:r=e.sent,e.next=24;break;case 20:return e.prev=20,e.t0=e.catch(14),this.isConnecting&&this.changeConnectionStatus({isConnected:this.isConnected,isConnecting:!1}),e.abrupt("return");case 24:return e.next=26,this.callControlFactory.createCallControl(r);case 26:return this.callControl=e.sent,e.next=29,this.resetHeadsetState();case 29:this._processEvents(this.callControl),this._deviceInfo={ProductName:r.name,deviceName:r.name,attached:!0,deviceId:r.id.toString()},this.changeConnectionStatus({isConnected:!0,isConnecting:!1});case 32:case"end":return e.stop()}}),e,this,[[14,20]])}))),function(e){return u.apply(this,arguments)})},{key:"getPreviouslyConnectedDevice",value:(c=Qe(regeneratorRuntime.mark((function e(t){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.jabraSdk.deviceList.pipe(Ge(null),ze((function(e){return!!e.length})),$e((function(e){return e.find((function(e){return r.isDeviceInList(e,t)}))})),Ye((function(e){return!!e})),Fe(3e3)),e.abrupt("return",ke(n).catch((function(e){return e instanceof je||e instanceof Ie?null:Promise.reject(e)})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"getDeviceFromWebhid",value:(a=Qe(regeneratorRuntime.mark((function e(t){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.requestWebHidPermissions(Oe.D),e.abrupt("return",ke(this.jabraSdk.deviceList.pipe($e((function(e){return e.find((function(e){return n.isDeviceInList(e,t)}))})),Ye((function(e){return!!e})),ze(),Fe(3e4))).catch((function(e){return e instanceof je&&(e=new Error("The selected device was not granted WebHID permissions")),n.logger.error(e),Promise.reject(e)})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"initializeJabraSdk",value:(s=Qe(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object(Oe.C)({appId:"softphone-vendor-headsets",appName:"Softphone Headset Library",transport:Oe.z.CHROME_EXTENSION_WITH_WEB_HID_FALLBACK}));case 1:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"createCallControlFactory",value:function(e){return new Oe.a(e)}},{key:"checkForCallLockError",value:function(e,t){return t===Oe.b.SDK_USAGE_ERROR&&e.includes("call lock")}},{key:"resetHeadsetState",value:(o=Qe(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.callControl){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.callControl.takeCallLock();case 4:this.callControl.hold(!1),this.callControl.mute(!1),this.callControl.offHook(!1),this.callControl.releaseCallLock();case 8:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"disconnect",value:(i=Qe(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.headsetEventSubscription&&this.headsetEventSubscription.unsubscribe(),(this.isConnected||this.isConnecting)&&this.changeConnectionStatus({isConnected:!1,isConnecting:!1});case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})}],r=[{key:"getInstance",value:function(e){return b.instance&&!e.createNew||(b.instance=new b(e)),b.instance}}],n&&Ze(t.prototype,n),r&&Ze(t,r),Object.defineProperty(t,"prototype",{writable:!1}),b}(z.a);ot(at,"instance",void 0),ot(at,"connectTimeout",5e3),function(e){e.Ring="ringer",e.Offhook="offhook",e.Mute="mute",e.Hold="hold"}(st||(st={}));var ct;function ut(e){return(ut="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 lt(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function ft(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){lt(o,r,i,s,a,"next",e)}function a(e){lt(o,r,i,s,a,"throw",e)}s(void 0)}))}}function ht(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function dt(e,t){return(dt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=gt(e);if(t){var i=gt(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return vt(this,n)}}function vt(e,t){if(t&&("object"===ut(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return yt(e)}function yt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gt(e){return(gt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function mt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.OffHook="OffHook",e.Mute="Mute",e.Hold="Flash",e.RejectCall="RejectCall"}(ct||(ct={}));var bt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dt(e,t)}(p,e);var t,n,r,i,o,s,a,c,u,l,f,h,d=pt(p);function p(e){var t,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),mt(yt(n=d.call(this,e)),"isActive",!1),mt(yt(n),"devices",null),mt(yt(n),"activeDeviceId",null),mt(yt(n),"headsetState",null),mt(yt(n),"ignoreNextOffhookEvent",!1),mt(yt(n),"cefSupportsJabra",!0),mt(yt(n),"pendingConversationId",void 0),mt(yt(n),"activeConversationId",void 0),n.vendorName="Jabra",n.headsetState={ringing:!1,offHook:!1},n.devices=new Map;var r={assetURL:window.location.origin+window.location.pathname,callback:n.handleCefEvent.bind(yt(n)),supportsTerminationRequest:!0,supportsUnifiedPreferences:!0},i=null===(t=window._HostedContextFunctions)||void 0===t?void 0:t.register(r);return n.cefSupportsJabra=null==i?void 0:i.supportsJabra,n}return t=p,n=[{key:"deviceInfo",get:function(){return null===this.activeDeviceId||null===this.devices||this.devices&&!this.devices.size?null:this.devices.get(this.activeDeviceId)}},{key:"deviceName",get:function(){return this.deviceInfo&&this.deviceInfo.deviceName}},{key:"isDeviceAttached",get:function(){return!!this.deviceInfo}},{key:"isHeadsetEvent",value:function(e){return"JabraEvent"===e.msg}},{key:"isDeviceEvent",value:function(e){return"JabraDeviceAttached"===e.msg}},{key:"handleCefEvent",value:function(e){this.isConnected&&(this.isDeviceEvent(e)?this.handleJabraDeviceAttached(e):this.isHeadsetEvent(e)&&this.handleJabraEvent(e))}},{key:"handleJabraDeviceAttached",value:function(e){this.logger.debug("handling jabra attach/detach event",e),this.updateDevices()}},{key:"handleJabraEvent",value:function(e){this.logger.debug("Jabra event received",e),this._processEvent(e.event,e.value)}},{key:"_handleOffhookEvent",value:function(e){e?this.headsetState.ringing&&(this.deviceAnsweredCall({name:"CallOffHook",conversationId:this.pendingConversationId}),this.activeConversationId=this.pendingConversationId,this._sendCmd(st.Offhook,e),this._setRinging(!1),this.pendingConversationId=null):(this._sendCmd(st.Offhook,e),this._getHeadsetIntoVanillaState(),this.deviceEndedCall({name:"CallOnHook",conversationId:this.activeConversationId}),this.activeConversationId=null)}},{key:"_handleMuteEvent",value:function(e){this._sendCmd(st.Mute,e),this.isMuted=e,this.deviceMuteChanged({isMuted:e,name:e?"CallMuted":"CallUnmuted",conversationId:this.activeConversationId})}},{key:"_handleHoldEvent",value:function(e){this._sendCmd(st.Hold,!!e),this.deviceHoldStatusChanged({holdRequested:!!e,name:e?"OnHold":"ResumeCall",conversationId:this.activeConversationId})}},{key:"_getHeadsetIntoVanillaState",value:function(){this.setHold(null,!1),this.setMute(!1)}},{key:"_sendCmd",value:function(e,t){var n=this.activeDeviceId;this.logger.debug("Sending command to headset",{deviceId:n,cmd:e,value:t}),window._HostedContextFunctions.sendEventToDesktop("jabraEvent",{deviceID:n,event:e,value:t})}},{key:"_setRinging",value:function(e){this._sendCmd(st.Ring,e),this.headsetState.ringing=e}},{key:"isSupported",value:function(){return he()&&this.cefSupportsJabra}},{key:"deviceLabelMatchesVendor",value:function(e){var t=e.toLowerCase();return["jabra"].some((function(e){return t.includes(e)}))}},{key:"setMute",value:(h=ft(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._sendCmd(st.Mute,t);case 1:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"setHold",value:(f=ft(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._sendCmd(st.Hold,n);case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"incomingCall",value:(l=ft(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.pendingConversationId=t.conversationId,this._setRinging(!0);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"answerCall",value:(u=ft(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.ignoreNextOffhookEvent=!0,this.activeConversationId=this.pendingConversationId,this.pendingConversationId=null,this._sendCmd(st.Offhook,!0);case 4:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"rejectCall",value:(c=ft(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._setRinging(!1),this.pendingConversationId=null;case 2:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"outgoingCall",value:(a=ft(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.activeConversationId=t.conversationId,this._sendCmd(st.Offhook,!0);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"endCall",value:(s=ft(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._setRinging(!1),n||this._sendCmd(st.Offhook,!1),this.activeConversationId=null;case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"endAllCalls",value:(o=ft(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._setRinging(!1),this._sendCmd(st.Offhook,!1),this.activeConversationId=null;case 3:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"updateDevices",value:(i=ft(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,de({cmd:"requestJabraDevices"});case 3:if(t=e.sent,this.changeConnectionStatus({isConnected:!0,isConnecting:!1}),t&&t.length){e.next=10;break}return this.devices.clear(),this.activeDeviceId=null,this.logger.error(new Error("No attached jabra devices")),e.abrupt("return");case 10:this.logger.info("connected jabra devices",t),this.devices.clear(),t.forEach((function(e){return n.devices.set(e.deviceID,e)})),this.activeDeviceId=t[0].deviceID,this._setRinging(!1),this.setMute(!1),e.next=22;break;case 18:e.prev=18,e.t0=e.catch(0),this.logger.error("Failed to connect to jabra",e.t0),this.disconnect();case 22:case"end":return e.stop()}}),e,this,[[0,18]])}))),function(){return i.apply(this,arguments)})},{key:"_processEvent",value:function(e,t){var n,r,i,o=this;switch(e){case ct.OffHook:(n=function(){return o._handleOffhookEvent(t)},r=500,i=null,function(){clearTimeout(i),i=setTimeout((function(){n()}),r)})();break;case ct.RejectCall:this.deviceRejectedCall({name:ct.RejectCall,conversationId:this.pendingConversationId});break;case ct.Mute:this._handleMuteEvent(t);break;case ct.Hold:this._handleHoldEvent(t)}}},{key:"connect",value:function(){var e,t,n,r,i,o=this;return this.changeConnectionStatus({isConnected:!1,isConnecting:!0}),(e=this.updateDevices(),t=5e3,i=new Promise((function(e,i){r=setTimeout((function(){clearTimeout(r),i(n||"Timed out in "+t+"ms")}),t)})).then((function(e){return clearTimeout(r),e})),Promise.race([e,i])).catch((function(e){o.logger.error("Failed to connect to Jabra",e)}))}},{key:"disconnect",value:function(){return this.changeConnectionStatus({isConnected:!1,isConnecting:!1}),Promise.resolve()}}],r=[{key:"getInstance",value:function(e){return p.instance&&!e.createNew||(p.instance=new p(e)),p.instance}}],n&&ht(t.prototype,n),r&&ht(t,r),Object.defineProperty(t,"prototype",{writable:!1}),p}(z.a);mt(bt,"instance",void 0);var wt=n(1);function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _t(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Et(Object(n),!0).forEach((function(t){St(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ct(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function Ot(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){Ct(o,r,i,s,a,"next",e)}function a(e){Ct(o,r,i,s,a,"throw",e)}s(void 0)}))}}function It(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kt(e,t)}(e,t)||function(){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 kt(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 Tt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Rt=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),St(this,"plantronics",void 0),St(this,"jabraNative",void 0),St(this,"jabra",void 0),St(this,"sennheiser",void 0),St(this,"selectedImplementation",void 0),St(this,"headsetEvents$",void 0),St(this,"headsetConversationStates",{}),St(this,"_headsetEvents$",void 0),St(this,"logger",void 0),this._headsetEvents$=new V,this.headsetEvents$=this._headsetEvents$.asObservable(),this.logger=t.logger||console,this.plantronics=fe.getInstance({logger:this.logger}),this.jabraNative=bt.getInstance({logger:this.logger}),this.jabra=at.getInstance({logger:this.logger}),this.sennheiser=Ce.getInstance({logger:this.logger}),[this.plantronics,this.jabra,this.jabraNative,this.sennheiser].forEach((function(e){return n.subscribeToHeadsetEvents(e)}))}var t,n,r,i,o,s,a,c,u,l,f,h;return t=e,n=[{key:"implementations",get:function(){return[this.sennheiser,this.plantronics,this.jabra,this.jabraNative].filter((function(e){return e.isSupported()}))}},{key:"isDifferentState",value:function(e){var t=this.headsetConversationStates[e.conversationId];return!t||Object.entries(e.state).some((function(e){var n=It(e,2),r=n[0],i=n[1];return t[r]!==i}))}},{key:"updateHeadsetState",value:function(e){if(this.isDifferentState(e)){var t=this.headsetConversationStates[e.conversationId];return Object.assign(t,e.state),!0}return!1}},{key:"activeMicChange",value:function(e){if(e){var t=this.implementations.find((function(t){return t.deviceLabelMatchesVendor(e)}));t?this.changeImplementation(t,e):this.clearSelectedImplementation()}else this.clearSelectedImplementation()}},{key:"changeImplementation",value:(h=Ot(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==this.selectedImplementation){e.next=2;break}return e.abrupt("return");case 2:if(!this.selectedImplementation){e.next=6;break}return this.headsetConversationStates={},e.next=6,this.selectedImplementation.disconnect();case 6:if(this.selectedImplementation=t,this._headsetEvents$.next({event:wt.a.implementationChanged,payload:t}),!t){e.next=11;break}return e.next=11,t.connect(n);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"incomingCall",value:(f=Ot(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getConnectedImpl()){e.next=3;break}return e.abrupt("return");case 3:return this.headsetConversationStates[t.conversationId]={conversationId:t.conversationId,held:!1,muted:!1,offHook:!1,ringing:!0},e.abrupt("return",r.incomingCall(t,n));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"outgoingCall",value:(l=Ot(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.getConnectedImpl()){e.next=3;break}return e.abrupt("return");case 3:return this.headsetConversationStates[t.conversationId]={conversationId:t.conversationId,held:!1,muted:!1,offHook:!0,ringing:!1},e.abrupt("return",n.outgoingCall(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"answerCall",value:(u=Ot(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.getConnectedImpl()){e.next=3;break}return e.abrupt("return");case 3:if(r={ringing:!1,offHook:!0},!this.updateHeadsetState({conversationId:t,state:r})){e.next=6;break}return e.abrupt("return",n.answerCall(t));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"rejectCall",value:(c=Ot(regeneratorRuntime.mark((function e(t){var n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.getConnectedImpl()){e.next=3;break}return e.abrupt("return");case 3:if(r={ringing:!1},!this.updateHeadsetState({conversationId:t,state:r})){e.next=8;break}return this.headsetConversationStates[t].removeTimer=setTimeout((function(){i.headsetConversationStates[t].removeTimer&&delete i.headsetConversationStates[t]}),2e3),e.abrupt("return",n.rejectCall(t));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"setMute",value:(a=Ot(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.getConnectedImpl()){e.next=3;break}return e.abrupt("return");case 3:if(!Object.values(this.headsetConversationStates).some((function(e){return e.muted!==t}))){e.next=6;break}return Object.values(this.headsetConversationStates).forEach((function(e){return e.muted=t})),e.abrupt("return",n.setMute(t));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"setHold",value:(s=Ot(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getConnectedImpl()){e.next=3;break}return e.abrupt("return");case 3:if(i={held:n},!this.updateHeadsetState({conversationId:t,state:i})){e.next=6;break}return e.abrupt("return",r.setHold(t,n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"endCall",value:(o=Ot(regeneratorRuntime.mark((function e(t,n){var r,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getConnectedImpl()){e.next=3;break}return e.abrupt("return");case 3:if(i={offHook:!1},!this.updateHeadsetState({conversationId:t,state:i})){e.next=8;break}return this.headsetConversationStates[t].removeTimer=setTimeout((function(){o.headsetConversationStates[t].removeTimer&&delete o.headsetConversationStates[t]}),2e3),e.abrupt("return",r.endCall(t,n));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"endAllCalls",value:(i=Ot(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.getConnectedImpl()){e.next=3;break}return e.abrupt("return");case 3:return Object.values(this.headsetConversationStates).forEach((function(e){e.removeTimer||(e.removeTimer=setTimeout((function(){n.headsetConversationStates[e.conversationId].removeTimer&&delete n.headsetConversationStates[e.conversationId]}),2e3))})),e.abrupt("return",t.endAllCalls());case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"retryConnection",value:function(e){return this.selectedImplementation?this.selectedImplementation.connect(e):Promise.reject(new Error("No active headset implementation"))}},{key:"connectionStatus",value:function(){return this.selectedImplementation?this.selectedImplementation.isConnected||this.selectedImplementation.isConnecting?this.selectedImplementation.isConnected?"running":"checking":"notRunning":"noVendor"}},{key:"getConnectedImpl",value:function(){var e=this.selectedImplementation;return e&&e.isConnected?e:null}},{key:"subscribeToHeadsetEvents",value:function(e){e.on(wt.a.deviceAnsweredCall,this.handleDeviceAnsweredCall.bind(this)),e.on(wt.a.deviceRejectedCall,this.handleDeviceRejectedCall.bind(this)),e.on(wt.a.deviceEndedCall,this.handleDeviceEndedCall.bind(this)),e.on(wt.a.deviceMuteChanged,this.handleDeviceMuteStatusChanged.bind(this)),e.on(wt.a.deviceHoldStatusChanged,this.handleDeviceHoldStatusChanged.bind(this)),e.on(wt.a.deviceEventLogs,this.handleDeviceLogs.bind(this)),e.on(wt.a.deviceConnectionStatusChanged,this.handleDeviceConnectionStatusChanged.bind(this)),e.on(wt.a.webHidPermissionRequested,this.handleWebHidPermissionRequested.bind(this))}},{key:"clearSelectedImplementation",value:function(){this.selectedImplementation&&this.selectedImplementation.disconnect(),this.selectedImplementation=null,this.handleDeviceConnectionStatusChanged()}},{key:"handleDeviceAnsweredCall",value:function(e){e.vendor===this.selectedImplementation&&(this.logger.info("Headset: device answered the call"),this._headsetEvents$.next({event:wt.a.deviceAnsweredCall,payload:_t({},e.body)}))}},{key:"handleDeviceRejectedCall",value:function(e){e.vendor===this.selectedImplementation&&(this.logger.info("Headset: device rejected the call"),this._headsetEvents$.next({event:wt.a.deviceRejectedCall,payload:_t({},e.body)}))}},{key:"handleDeviceEndedCall",value:function(e){this.logger.info("Headset: device ended the call"),this._headsetEvents$.next({event:wt.a.deviceEndedCall,payload:_t({},e.body)})}},{key:"handleDeviceMuteStatusChanged",value:function(e){this.logger.info("Headset: device mute status changed: ",e.body.isMuted),this._headsetEvents$.next({event:wt.a.deviceMuteStatusChanged,payload:_t({},e.body)})}},{key:"handleDeviceHoldStatusChanged",value:function(e){this.logger.info("Headset: device hold status changed",e.body.holdRequested),this._headsetEvents$.next({event:wt.a.deviceHoldStatusChanged,payload:_t({},e.body)})}},{key:"handleDeviceConnectionStatusChanged",value:function(){this._headsetEvents$.next({event:wt.a.deviceConnectionStatusChanged,payload:this.connectionStatus()})}},{key:"handleWebHidPermissionRequested",value:function(e){this.logger.debug("Requesting Webhid Permissions"),this._headsetEvents$.next({event:wt.a.webHidPermissionRequested,payload:_t({},e.body)})}},{key:"handleDeviceLogs",value:function(e){this._headsetEvents$.next({event:wt.a.loggableEvent,payload:_t({},e.body)})}}],r=[{key:"getInstance",value:function(t){return e.instance&&!t.createNew||(e.instance=new e(t)),e.instance}}],n&&Tt(t.prototype,n),r&&Tt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();St(Rt,"instance",void 0)},function(e,t,n){"use strict";n.r(t);var r=n(10),i=n(2);n.d(t,"VendorImplementation",(function(){return i.a}));var o=n(6);for(var s in o)["default","VendorImplementation"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);var a=n(1);n.d(t,"HeadsetEvents",(function(){return a.a}));var c=n(7);for(var s in c)["default","VendorImplementation","HeadsetEvents"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return c[e]}))}(s);n(8);t.default=r.a},,function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],l=!1,f=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&d())}function d(){if(!l){var e=a(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||l||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";(function(e){
70
55
  /*!
71
56
  * The buffer module from node.js, for the browser.
72
57
  *
73
58
  * @author Feross Aboukhadijeh <http://feross.org>
74
59
  * @license MIT
75
60
  */
76
- var r=n(16),i=n(17),o=n(18);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return u(this,e,t,n)}function u(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=h(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(t,n),i=(e=a(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|d(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|d(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function h(e,t){var n=t.length<0?0:0|d(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function d(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var f=!0,h=0;h<c;h++)if(u(e,o+h)!==u(t,h)){f=!1;break}if(f)return o}return-1}function b(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function E(e,t,n,r){return G(F(t,e.length-n),e,n,r)}function w(e,t,n,r){return G(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return w(e,t,n,r)}function C(e,t,n,r){return G(B(t),e,n,r)}function O(e,t,n,r){return G(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function k(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,c,u=e[i],l=null,f=u>239?4:u>223?3:u>191?2:1;if(i+f<=n)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return u(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return f(null,e)},c.allocUnsafeSlow=function(e){return f(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?k(this,0,e):v.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n),f=0;f<a;++f)if(u[f]!==l[f]){o=u[f],s=l[f];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function R(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function A(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=j(e[o]);return i}function S(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function P(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function x(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,o){return o||x(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||x(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;n=new c(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return H(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return H(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=c.isBuffer(e)?e:F(new c(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function j(e){return e<16?"0"+e.toString(16):e.toString(16)}function F(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function B(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(5))},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),s=r[0],a=r[1],c=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
61
+ var r=n(15),i=n(16),o=n(17);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return u(this,e,t,n)}function u(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=h(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(t,n),i=(e=a(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|d(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|d(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function h(e,t){var n=t.length<0?0:0|d(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function d(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return S(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var f=!0,h=0;h<c;h++)if(u(e,o+h)!==u(t,h)){f=!1;break}if(f)return o}return-1}function b(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function w(e,t,n,r){return G(F(t,e.length-n),e,n,r)}function E(e,t,n,r){return G(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return E(e,t,n,r)}function C(e,t,n,r){return G(B(t),e,n,r)}function O(e,t,n,r){return G(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function k(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,c,u=e[i],l=null,f=u>239?4:u>223?3:u>191?2:1;if(i+f<=n)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return u(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return f(null,e)},c.allocUnsafeSlow=function(e){return f(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?k(this,0,e):v.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),l=e.slice(t,n),f=0;f<a;++f)if(u[f]!==l[f]){o=u[f],s=l[f];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function S(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function R(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=j(e[o]);return i}function A(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function P(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function x(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function D(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,n,r,o){return o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;n=new c(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return H(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return H(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=c.isBuffer(e)?e:F(new c(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function j(e){return e<16?"0"+e.toString(16):e.toString(16)}function F(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function B(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(5))},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),s=r[0],a=r[1],c=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
77
62
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
78
63
  t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,f=n?i-1:0,h=n?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=u}return(d?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+d]=255&s,d+=p,s/=256,u-=8);e[n+d-p]|=128*v}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}}])}));
79
64
  //# sourceMappingURL=softhphone-vendor-headsets.js.map