"use strict";
(self["webpackChunkGenesysCloudWebrtcSdk"] = self["webpackChunkGenesysCloudWebrtcSdk"] || []).push([["vendors-node_modules_gnaudio_jabra-js_browser-esm_init-handler-BkKnFG4X_js"],{

/***/ "./node_modules/rxjs/dist/esm5/internal/operators/delay.js"
/*!*****************************************************************!*\
  !*** ./node_modules/rxjs/dist/esm5/internal/operators/delay.js ***!
  \*****************************************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   delay: () => (/* binding */ delay)
/* harmony export */ });
/* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/dist/esm5/internal/scheduler/async.js");
/* harmony import */ var _delayWhen__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./delayWhen */ "./node_modules/rxjs/dist/esm5/internal/operators/delayWhen.js");
/* harmony import */ var _observable_timer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../observable/timer */ "./node_modules/rxjs/dist/esm5/internal/observable/timer.js");



function delay(due, scheduler) {
  if (scheduler === void 0) {
    scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_0__.asyncScheduler;
  }
  var duration = (0,_observable_timer__WEBPACK_IMPORTED_MODULE_2__.timer)(due, scheduler);
  return (0,_delayWhen__WEBPACK_IMPORTED_MODULE_1__.delayWhen)(function () {
    return duration;
  });
}

/***/ },

/***/ "./node_modules/rxjs/dist/esm5/internal/operators/delayWhen.js"
/*!*********************************************************************!*\
  !*** ./node_modules/rxjs/dist/esm5/internal/operators/delayWhen.js ***!
  \*********************************************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   delayWhen: () => (/* binding */ delayWhen)
/* harmony export */ });
/* harmony import */ var _observable_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/concat */ "./node_modules/rxjs/dist/esm5/internal/observable/concat.js");
/* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./take */ "./node_modules/rxjs/dist/esm5/internal/operators/take.js");
/* harmony import */ var _ignoreElements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ignoreElements */ "./node_modules/rxjs/dist/esm5/internal/operators/ignoreElements.js");
/* harmony import */ var _mapTo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mapTo */ "./node_modules/rxjs/dist/esm5/internal/operators/mapTo.js");
/* harmony import */ var _mergeMap__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./mergeMap */ "./node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js");
/* harmony import */ var _observable_innerFrom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../observable/innerFrom */ "./node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js");






function delayWhen(delayDurationSelector, subscriptionDelay) {
  if (subscriptionDelay) {
    return function (source) {
      return (0,_observable_concat__WEBPACK_IMPORTED_MODULE_0__.concat)(subscriptionDelay.pipe((0,_take__WEBPACK_IMPORTED_MODULE_1__.take)(1), (0,_ignoreElements__WEBPACK_IMPORTED_MODULE_2__.ignoreElements)()), source.pipe(delayWhen(delayDurationSelector)));
    };
  }
  return (0,_mergeMap__WEBPACK_IMPORTED_MODULE_4__.mergeMap)(function (value, index) {
    return (0,_observable_innerFrom__WEBPACK_IMPORTED_MODULE_5__.innerFrom)(delayDurationSelector(value, index)).pipe((0,_take__WEBPACK_IMPORTED_MODULE_1__.take)(1), (0,_mapTo__WEBPACK_IMPORTED_MODULE_3__.mapTo)(value));
  });
}

/***/ },

/***/ "./node_modules/rxjs/dist/esm5/internal/operators/ignoreElements.js"
/*!**************************************************************************!*\
  !*** ./node_modules/rxjs/dist/esm5/internal/operators/ignoreElements.js ***!
  \**************************************************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ignoreElements: () => (/* binding */ ignoreElements)
/* harmony export */ });
/* harmony import */ var _util_lift__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/lift */ "./node_modules/rxjs/dist/esm5/internal/util/lift.js");
/* harmony import */ var _OperatorSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OperatorSubscriber */ "./node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js");
/* harmony import */ var _util_noop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/noop */ "./node_modules/rxjs/dist/esm5/internal/util/noop.js");



function ignoreElements() {
  return (0,_util_lift__WEBPACK_IMPORTED_MODULE_0__.operate)(function (source, subscriber) {
    source.subscribe((0,_OperatorSubscriber__WEBPACK_IMPORTED_MODULE_1__.createOperatorSubscriber)(subscriber, _util_noop__WEBPACK_IMPORTED_MODULE_2__.noop));
  });
}

/***/ },

/***/ "./node_modules/rxjs/dist/esm5/internal/operators/mapTo.js"
/*!*****************************************************************!*\
  !*** ./node_modules/rxjs/dist/esm5/internal/operators/mapTo.js ***!
  \*****************************************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   mapTo: () => (/* binding */ mapTo)
/* harmony export */ });
/* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./map */ "./node_modules/rxjs/dist/esm5/internal/operators/map.js");

function mapTo(value) {
  return (0,_map__WEBPACK_IMPORTED_MODULE_0__.map)(function () {
    return value;
  });
}

/***/ },

/***/ "./node_modules/@gnaudio/jabra-js/browser-esm/init-handler-BkKnFG4X.js"
/*!*****************************************************************************!*\
  !*** ./node_modules/@gnaudio/jabra-js/browser-esm/init-handler-BkKnFG4X.js ***!
  \*****************************************************************************/
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   initHandler: () => (/* binding */ P)
/* harmony export */ });
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/map */ "./node_modules/@babel/runtime-corejs3/core-js-stable/map.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/promise */ "./node_modules/@babel/runtime-corejs3/core-js-stable/promise.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/for-each */ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/for-each.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_array_from__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/array/from */ "./node_modules/@babel/runtime-corejs3/core-js-stable/array/from.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_instance_entries__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/entries */ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/entries.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_instance_filter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/filter */ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_instance_some__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/some */ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/some.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_instance_pad_start__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/pad-start */ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/pad-start.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_set_timeout__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/set-timeout */ "./node_modules/@babel/runtime-corejs3/core-js-stable/set-timeout.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_instance_concat__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/concat */ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_array_is_array__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/array/is-array */ "./node_modules/@babel/runtime-corejs3/core-js-stable/array/is-array.js");
/* harmony import */ var _babel_runtime_corejs3_core_js_stable_set__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/set */ "./node_modules/@babel/runtime-corejs3/core-js-stable/set.js");
/* harmony import */ var _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./index-t1Gt7dja.js */ "./node_modules/@gnaudio/jabra-js/browser-esm/index-t1Gt7dja.js");
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/dist/esm5/internal/Observable.js");
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/dist/esm5/internal/Subject.js");
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/dist/esm5/internal/observable/merge.js");
/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/dist/esm5/internal/operators/delay.js");
/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/dist/esm5/internal/operators/map.js");















class R {
  static rawUsageFrom(e, t) {
    return (e << 16 | t) >>> 0;
  }
  static usagePageFromRaw(e) {
    return e >>> 16;
  }
  static usageFromRaw(e) {
    return e << 16 >>> 16;
  }
}
class f {
  constructor(t) {
    this.devices = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__(), this.deviceInputSubscriptions = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__(), this.onHidInput = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject(), this.onGetFeatureReportResponse = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject();
    const s = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject();
    this.deviceAdded = s;
    const o = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject();
    this.deviceRemoved = o, t.deviceAdded.subscribe(t => {
      if (!this.devices.has(t.id)) {
        this.devices.set(t.id, t);
        const o = t.inputHandler.inputReports.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_17__.map)(s => new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.W(t.id, R.usagePageFromRaw(s.usage), R.usageFromRaw(s.usage), s.value))).subscribe(e => this.onHidInput.next(e));
        this.deviceInputSubscriptions.set(t.id, o), s.next(t);
      }
    }), t.deviceRemoved.subscribe(e => {
      var t;
      const s = this.devices.get(e);
      s && (this.devices.delete(e), null === (t = this.deviceInputSubscriptions.get(e)) || void 0 === t || t.unsubscribe(), this.deviceInputSubscriptions.delete(e), o.next(s));
    });
  }
  sendOutputUsage(e, t, s, o) {
    var r, i;
    const n = R.rawUsageFrom(t, s);
    return null !== (i = null === (r = this.devices.get(e)) || void 0 === r ? void 0 : r.outputHandler.sendOutputUsage(n, o)) && void 0 !== i ? i : _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_1__.resolve();
  }
  setFeatureUsage(e, t, s, o) {
    var r;
    const i = R.rawUsageFrom(t, s);
    null === (r = this.devices.get(e)) || void 0 === r || r.featureHandler.setFeatureUsage(i, o);
  }
  getFeatureUsage(e, o, r, i) {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      var t;
      const n = R.rawUsageFrom(r, i),
        a = yield null === (t = this.devices.get(e)) || void 0 === t ? void 0 : t.featureHandler.getFeatureUsage(n);
      void 0 !== a && this.onGetFeatureReportResponse.next(new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.a(o, a));
    });
  }
}
class w {
  constructor(e) {
    this.data = new Uint8Array(e);
  }
  get buffer() {
    return new DataView(this.data.buffer);
  }
  getBits(e, t) {
    if (t > 8 * this.data.length - e) throw new Error("Not enough bits to read from the buffer");
    let s = e,
      o = 0;
    for (let e = 0; e < t;) {
      const r = t - e,
        i = 7 & s,
        n = this.data[s >> 3],
        a = Math.min(r, 8 - i);
      o |= (n >> i & ~(255 << a)) << e, s += a, e += a;
    }
    return o >>> 0;
  }
  setBits(e, t, s) {
    if (s > 8 * this.data.length - e) throw new Error("Not enough bits to read from the buffer");
    let o = e,
      r = t;
    for (let e = 0; e < s;) {
      const t = s - e,
        i = 7 & o,
        n = o >> 3,
        a = Math.min(t, 8 - i),
        u = ~(255 << a),
        c = r & u;
      r >>= a;
      const d = ~(u << i);
      this.data[n] = this.data[n] & d | c << i, o += a, e += a;
    }
  }
}
const b = 9;
class I {
  constructor(e, t) {
    var _context;
    this.device = e, this.inputReportDescriptors = t;
    const s = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__();
    _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(_context = this.inputReportDescriptors).call(_context, e => {
      var _context2;
      _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(_context2 = e.usages).call(_context2, (e, t) => {
        s.set(t, [0]);
      });
    });
    const o = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject();
    this.inputReports = o, this.device.oninputreport = e => {
      var _context3;
      if (e.currentTarget !== this.device) return;
      const t = this.inputReportDescriptors.get(e.reportId);
      if (!t) return;
      const r = new w(e.data.buffer);
      let i = _babel_runtime_corejs3_core_js_stable_array_from__WEBPACK_IMPORTED_MODULE_3__(_babel_runtime_corejs3_core_js_stable_instance_entries__WEBPACK_IMPORTED_MODULE_4__(_context3 = t.usages).call(_context3), e => I.makeWebHidInputReport(r, e));
      e.reportId !== b && (i = _babel_runtime_corejs3_core_js_stable_instance_filter__WEBPACK_IMPORTED_MODULE_5__(i).call(i, e => I.compareReportToCachedValue(e, s)), _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(i).call(i, e => {
        s.set(e.usage, e.value);
      })), _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(i).call(i, e => {
        o.next(e);
      });
    };
  }
  static makeWebHidInputReport(e, [t, s]) {
    let r = s.offset,
      i = s.size * s.count,
      n = [];
    for (; i > 0;) n.push(e.getBits(r, Math.min(i, 8))), r += 8, i -= 8;
    return n = s.onInput(n), new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.I.UsageReport(t, n);
  }
  static compareReportToCachedValue(e, t) {
    const s = t.get(e.usage);
    if (!s) return !0;
    if (s.length !== e.value.length) return !0;
    return _babel_runtime_corejs3_core_js_stable_instance_some__WEBPACK_IMPORTED_MODULE_6__(s).call(s, (t, s) => e.value[s] !== t);
  }
}
class E {
  constructor(e) {
    this.report = e;
  }
  reportSizeInBits() {
    return this.report.fullReportSize;
  }
  reportSizeInBytes() {
    return Math.ceil(this.reportSizeInBits() / 8);
  }
  createBitViewIfNeeded() {
    if (!this.bitView) {
      const e = this.reportSizeInBytes(),
        t = new ArrayBuffer(e);
      this.bitView = new w(t);
    }
    return this.bitView;
  }
  getUsageInformationOrThrow(e) {
    var _context4;
    if (!this.report.usages.has(e)) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Unable to write usage (0x${_babel_runtime_corejs3_core_js_stable_instance_pad_start__WEBPACK_IMPORTED_MODULE_7__(_context4 = e.toString(16)).call(_context4, 8, "0")}). It is not known by the device.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return this.report.usages.get(e);
  }
  writeUsage(e, t) {
    const s = this.getUsageInformationOrThrow(e);
    let o = this.createBitViewIfNeeded();
    if (!s.absolute) {
      const e = function (e) {
        const t = new ArrayBuffer(e.byteLength);
        return new Uint8Array(t).set(new Uint8Array(e.buffer)), t;
      }(o.buffer);
      o = new w(e);
    }
    let r = s.offset,
      i = s.size * s.count;
    return _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(t).call(t, e => {
      o.setBits(r, e, i), r += 8, i -= 8;
    }), new Uint8Array(o.buffer.buffer);
  }
}
class U {
  constructor(e, t, s) {
    this.device = e, this.outputReports = t, this.outputUsages = s, this.outputCacheByReportId = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__();
  }
  getReportIdForUsage(e) {
    var _context5;
    if (!this.outputUsages.has(e)) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Unknown usagePage: 0x${_babel_runtime_corejs3_core_js_stable_instance_pad_start__WEBPACK_IMPORTED_MODULE_7__(_context5 = e.toString(16)).call(_context5, 8, "0")}.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return this.outputUsages.get(e);
  }
  getReportLayoutForReportId(e) {
    if (!this.outputReports.has(e)) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Unknown reportId: ${e}.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return this.outputReports.get(e);
  }
  getUsageInReportForUsage(e) {
    const t = this.getReportIdForUsage(e),
      s = this.getReportLayoutForReportId(t);
    if (!s.usages.has(e)) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Unknown rawUsage inside ReportLayout: ${e}.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return s.usages.get(e);
  }
  getOrCreateCacheForReportId(e) {
    if (!this.outputCacheByReportId.has(e)) {
      const t = this.getReportLayoutForReportId(e),
        s = new E(t);
      this.outputCacheByReportId.set(e, s);
    }
    return this.outputCacheByReportId.get(e);
  }
  sendOutputUsage(e, s) {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      const t = this.getReportIdForUsage(e),
        o = this.getOrCreateCacheForReportId(t),
        n = this.getUsageInReportForUsage(e).onOutput(s),
        a = o.writeUsage(e, n);
      try {
        yield this.device.sendReport(t, a);
      } catch (e) {
        if ("NotAllowedError" === e.name) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J("The request could not be sent to the device. The device may have been disconnected.", _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.DEVICE_ERROR);
        throw e;
      }
    });
  }
}
class m {
  constructor(e = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__(), t = 0) {
    this.usages = e, this.fullReportSize = t;
  }
}
class k {
  constructor(e, t, s, o) {
    this.offset = e, this.size = t, this.count = s, this.absolute = o;
  }
  onInput(e) {
    return e;
  }
  onOutput(e) {
    return e;
  }
}
class y {
  constructor(e, t, s, o, r) {
    this.offset = e, this.size = t, this.count = s, this.absolute = o, this.rangeIndex = r;
  }
  onInput(e) {
    if (e.length > 1) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Usages of type ${y.name} should not hold more than 1 byte of information.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return e[0] === this.rangeIndex ? [1] : [0];
  }
  onOutput(e) {
    if (e.length > 1) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Usages of type ${y.name} should not hold more than 1 byte of information.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return e[0] > 0 ? [this.rangeIndex] : e;
  }
}
class L {
  constructor(e) {
    const t = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__();
    this.buildReportLayouts(e.collections, "input", t), this.inputReports = t, this.inputUsages = L.buildUsageMap(t);
    const s = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__();
    this.buildReportLayouts(e.collections, "output", s), this.outputReports = s, this.outputUsages = L.buildUsageMap(s);
    const o = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__();
    this.buildReportLayouts(e.collections, "feature", o), this.featureReports = o, this.featureUsages = L.buildUsageMap(o);
  }
  static buildUsageMap(e) {
    const t = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__();
    return _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(e).call(e, (e, s) => {
      var _context6;
      _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(_context6 = e.usages).call(_context6, (e, o) => {
        t.set(o, s);
      });
    }), t;
  }
  buildReportLayouts(e, t, s) {
    _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(e).call(e, e => {
      var o;
      null === (o = L.reportsOfType(e, t)) || void 0 === o || _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(o).call(o, e => {
        var t;
        const o = e.reportId;
        s.has(o) || s.set(o, new m());
        const r = s.get(o);
        let i = 0;
        null === (t = e.items) || void 0 === t || _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(t).call(t, e => {
          let t = e.usages;
          if (e.isRange) {
            t = [];
            for (let s = e.usageMinimum; s <= e.usageMaximum; s += 1) t.push(s);
          }
          let s,
            o = i;
          if (e.isRange && e.isArray && (s = 1), t.length > 0) {
            if (_babel_runtime_corejs3_core_js_stable_instance_filter__WEBPACK_IMPORTED_MODULE_5__(t).call(t, e => r.usages.has(e)).length === t.length) return;
          }
          _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(t).call(t, i => {
            let n;
            const a = t.length > 1 ? e.reportCount / t.length : e.reportCount;
            n = s ? new y(o, e.reportSize, a, e.isAbsolute, s) : new k(o, e.reportSize, a, e.isAbsolute), r.usages.set(i, n), s ? s += 1 : o += e.reportSize;
          });
          const n = e.reportCount * e.reportSize;
          r.fullReportSize += n, i += n;
        });
      }), e.children && this.buildReportLayouts(e.children, t, s);
    });
  }
  static reportsOfType(e, t) {
    if ("input" === t) return e.inputReports;
    if ("output" === t) return e.outputReports;
    if ("feature" === t) return e.featureReports;
    throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Unexpected report type: ${t}!`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
  }
}
class D {
  constructor(e, t, s) {
    this.device = e, this.featureReports = t, this.featureUsages = s, this.outputCacheByReportId = new _babel_runtime_corejs3_core_js_stable_map__WEBPACK_IMPORTED_MODULE_0__();
  }
  getReportIdForUsage(e) {
    var _context7;
    if (!this.featureUsages.has(e)) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Unknown usagePage: 0x${_babel_runtime_corejs3_core_js_stable_instance_pad_start__WEBPACK_IMPORTED_MODULE_7__(_context7 = e.toString(16)).call(_context7, 8, "0")}.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return this.featureUsages.get(e);
  }
  getReportLayoutForReportId(e) {
    if (!this.featureReports.has(e)) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Unknown reportId: ${e}.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return this.featureReports.get(e);
  }
  getUsageInReportForUsage(e) {
    const t = this.getReportIdForUsage(e),
      s = this.getReportLayoutForReportId(t);
    if (!s.usages.has(e)) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Unknown rawUsage inside ReportLayout: ${e}.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
    return s.usages.get(e);
  }
  getOrCreateCacheForReportId(e) {
    if (!this.outputCacheByReportId.has(e)) {
      const t = this.getReportLayoutForReportId(e),
        s = new E(t);
      this.outputCacheByReportId.set(e, s);
    }
    return this.outputCacheByReportId.get(e);
  }
  getFeatureUsage(e) {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      const t = this.getReportIdForUsage(e),
        s = yield this.device.receiveFeatureReport(t),
        o = this.getUsageInReportForUsage(e),
        r = [];
      for (let e = 1; e <= Math.ceil(o.size / 8); e += 1) r.push(s.getUint8(e));
      return r;
    });
  }
  setFeatureUsage(e, s) {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      const t = this.getReportIdForUsage(e),
        o = this.getOrCreateCacheForReportId(t),
        r = this.getUsageInReportForUsage(e).onOutput(s),
        i = o.writeUsage(e, r);
      yield this.device.sendFeatureReport(t, i);
    });
  }
}
class F {
  constructor(e, t, s, o) {
    this.name = e, this.vid = t, this.pid = s, this.id = o.sessionId;
    const r = new L(o);
    this.inputReports = r.inputReports, this.outputReports = r.outputReports, this.featureReports = r.featureReports, this.inputHandler = new I(o, r.inputReports), this.outputHandler = new U(o, r.outputReports, r.outputUsages), this.featureHandler = new D(o, r.featureReports, r.featureUsages);
  }
}
class C {
  constructor(e, t) {
    this.hid = e, this.broadcastChannel = t, this.deviceAddedSubject = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject(), this.deviceAdded = this.deviceAddedSubject, this.deviceRemovedSubject = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject(), this.deviceRemoved = this.deviceRemovedSubject;
  }
  setupListeners() {
    this.hid.onconnect = e => this.onConnect(e), this.hid.ondisconnect = e => this.onDisconnect(e), this.broadcastChannel.onmessage = () => this.getPairedDevices();
  }
  addNewDevice(e) {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      if (C.hasGeneratedDeviceId(e)) return;
      C.getOrGenerateDeviceId(e);
      const t = new F(e.productName, e.vendorId, e.productId, e);
      e.opened || (yield e.open()), this.deviceAddedSubject.next(t);
    });
  }
  onConnect(e) {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      _babel_runtime_corejs3_core_js_stable_set_timeout__WEBPACK_IMPORTED_MODULE_8__(() => (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
        yield this.addNewDevice(e.device);
      }), 1e3);
    });
  }
  onDisconnect(e) {
    const t = C.getOrGenerateDeviceId(e.device);
    this.deviceRemovedSubject.next(t);
  }
  getPairedDevices() {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      var _context8, _context9;
      _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(_context8 = _babel_runtime_corejs3_core_js_stable_instance_filter__WEBPACK_IMPORTED_MODULE_5__(_context9 = yield this.hid.getDevices()).call(_context9, e => e.vendorId === _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.b.VENDOR_ID)).call(_context8, e => (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
        yield this.addNewDevice(e);
      }));
    });
  }
  static hasGeneratedDeviceId(e) {
    return void 0 !== e.sessionId;
  }
  static getOrGenerateDeviceId(e) {
    if (!C.hasGeneratedDeviceId(e)) {
      const t = new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.U(4).toString();
      return e.sessionId = t, t;
    }
    return e.sessionId;
  }
}
class O {
  constructor(e, t, s, o, r) {
    this.usagePage = e, this.usage = t, this.valueType = s, this.reportType = o, this.reportSize = r;
  }
}
class N {
  constructor(e) {
    this.deviceManagement = e, this.events = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject(), this.setupDeviceHandler();
  }
  setupDeviceHandler() {
    this.deviceManagement.deviceAdded.subscribe(e => {
      this.events.next({
        event: "attach",
        id: e.id,
        vid: e.vid,
        pid: e.pid,
        name: e.name,
        serialNumber: e.id,
        descriptor: N.generateDescriptors(e)
      });
    }), this.deviceManagement.deviceRemoved.subscribe(e => {
      this.events.next({
        event: "detach",
        id: e.id
      });
    }), this.deviceManagement.onHidInput.subscribe(e => {
      const t = 1 === e.value.length ? e.value[0] : e.value;
      this.events.next({
        event: "hid-input",
        id: e.deviceId,
        usagePage: e.usagePage,
        usage: e.usage,
        value: t
      });
    }), this.deviceManagement.onGetFeatureReportResponse.subscribe(e => {
      const t = 1 === e.value.length ? e.value[0] : e.value;
      this.events.next({
        event: "response-hid-feature",
        token: e.token,
        value: t
      });
    });
  }
  static generateDescriptors(e) {
    let t = N.convertReportLayoutsToDescriptors(e.inputReports, "input");
    return t = _babel_runtime_corejs3_core_js_stable_instance_concat__WEBPACK_IMPORTED_MODULE_9__(t).call(t, N.convertReportLayoutsToDescriptors(e.outputReports, "output")), t = _babel_runtime_corejs3_core_js_stable_instance_concat__WEBPACK_IMPORTED_MODULE_9__(t).call(t, N.convertReportLayoutsToDescriptors(e.featureReports, "feature")), t;
  }
  static convertReportLayoutsToDescriptors(e, t) {
    const s = [];
    return _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(e).call(e, e => {
      var _context0;
      _babel_runtime_corejs3_core_js_stable_instance_for_each__WEBPACK_IMPORTED_MODULE_2__(_context0 = e.usages).call(_context0, (e, o) => {
        const r = R.usagePageFromRaw(o);
        65280 === r && "output" === t || s.push(new O(r, R.usageFromRaw(o), e.absolute ? "absolute" : "relative", t, Math.ceil(e.size * e.count / 8)));
      });
    }), s;
  }
}
class S {
  constructor(e, t, s) {
    this.deviceManagement = e, this.callLockManagement = t, this.logger = s, this.gnpLockAcquired = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject(), this.callLockAcquired = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject(), this.softphoneInFocus = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject(), this.events = (0,rxjs__WEBPACK_IMPORTED_MODULE_15__.merge)(this.gnpLockAcquired.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_16__.delay)(0)), this.callLockAcquired.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_16__.delay)(0)), this.softphoneInFocus);
  }
  onNewSdkInput(e) {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      if (!e.action) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J("Provided input has no action property.", _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
      switch (e.action) {
        case "hid-output":
          {
            const t = _babel_runtime_corejs3_core_js_stable_array_is_array__WEBPACK_IMPORTED_MODULE_10__(e.value) ? e.value : [e.value];
            yield this.deviceManagement.sendOutputUsage(e.id, e.usagePage, e.usage, t);
            break;
          }
        case "request-hid-feature":
          this.deviceManagement.getFeatureUsage(e.id, e.token, e.usagePage, e.usage);
          break;
        case "set-hid-feature":
          {
            const t = _babel_runtime_corejs3_core_js_stable_array_is_array__WEBPACK_IMPORTED_MODULE_10__(e.value) ? e.value : [e.value];
            this.deviceManagement.setFeatureUsage(e.id, e.usagePage, e.usage, t);
            break;
          }
        case "request-gnp-lock":
          this.gnpLockAcquired.next({
            event: "response-gnp-lock",
            token: e.token
          }), (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.l)("GNP lock requested with WebHID backend. This should not happen!", this.logger, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.L.ERROR, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.S.NATIVE_CONSOLE);
          break;
        case "release-gnp-lock":
          break;
        case "request-call-lock":
          this.callLockManagement.tryAcquireCallLock(e.id).then(t => {
            this.callLockAcquired.next({
              event: "response-call-lock",
              id: e.id,
              acquired: t
            });
          });
          break;
        case "release-call-lock":
          this.callLockManagement.releaseCallLock(e.id);
          break;
        case "set-softphone-info":
          this.softphoneInFocus.next({
            event: "softphone-in-focus",
            infocus: !1
          }), this.softphoneInFocus.complete();
          break;
        default:
          throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J(`Provided action is not recognized - ${e.action}.`, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.UNEXPECTED_ERROR);
      }
    });
  }
}
class A {
  constructor(e, t, s) {
    this.navigatorLocks = e, this.logger = s, this.releaseGlobalLock = null, this.localLockedDevices = new _babel_runtime_corejs3_core_js_stable_set__WEBPACK_IMPORTED_MODULE_11__(), t.deviceRemoved.subscribe(e => {
      this.localLockedDevices.has(e.id) && this.releaseCallLock(e.id);
    });
  }
  tryAcquireCallLock(e) {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      return !(yield this.checkWebLocksSupport()) || (this.localLockedDevices.size > 0 && !this.localLockedDevices.has(e) ? (this.localLockedDevices.add(e), !0) : new _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_1__(t => {
        this.navigatorLocks.request("jabra-call-lock", {
          ifAvailable: !0
        }, s => s ? (this.localLockedDevices.add(e), t(!0), new _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_1__(e => {
          this.releaseGlobalLock = e;
        })) : (t(!1), _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_1__.resolve()));
      }));
    });
  }
  releaseCallLock(e) {
    this.localLockedDevices.delete(e), this.releaseGlobalLock && 0 === this.localLockedDevices.size && this.releaseGlobalLock();
  }
  checkWebLocksSupport() {
    return (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__._)(this, void 0, void 0, function* () {
      const e = yield this.navigatorLocks.query().catch(() => {
        (0,_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.l)("WebLocks unsupported. The cross-tab call lock is disabled.", this.logger, _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.L.WARNING);
      });
      return Boolean(e);
    });
  }
}
class M {
  constructor(e, t, s, o) {
    this.scanner = e, this.deviceEventHandler = t, this.sdkInputEventHandler = s, this.logger = o, this.readyEvent = new rxjs__WEBPACK_IMPORTED_MODULE_14__.Subject(), this.events = new rxjs__WEBPACK_IMPORTED_MODULE_13__.Observable(), this.events = (0,rxjs__WEBPACK_IMPORTED_MODULE_15__.merge)(this.readyEvent, this.deviceEventHandler.events, this.sdkInputEventHandler.events);
  }
  start() {
    this.readyEvent.next({
      event: "ready",
      version: null,
      jabraDirectInstalled: !1
    }), this.readyEvent.complete(), this.scanner.getPairedDevices(), this.scanner.setupListeners();
  }
  sendMessage(e) {
    var t, s;
    return null !== (s = null === (t = this.sdkInputEventHandler) || void 0 === t ? void 0 : t.onNewSdkInput(e)) && void 0 !== s ? s : _babel_runtime_corejs3_core_js_stable_promise__WEBPACK_IMPORTED_MODULE_1__.resolve();
  }
}
function P(e) {
  if ("undefined" == typeof window) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J("WebHID is not supported outside of a browser environment.", _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.INIT_ERROR);
  if (void 0 === window.navigator || void 0 === window.navigator.hid) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J("WebHID is not supported on this platform/browser.", _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.INIT_ERROR);
  if (void 0 === window.navigator.locks) throw new _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.J("WebLocks is not supported on this platform/browser.", _index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.E.INIT_ERROR);
  const t = window.navigator.hid,
    s = window.navigator.locks,
    o = new BroadcastChannel(_index_t1Gt7dja_js__WEBPACK_IMPORTED_MODULE_12__.b.PAIRING_CHANNEL),
    a = new C(t, o),
    u = new f(a),
    c = new N(u),
    d = new S(u, new A(s, u, e));
  return new M(a, c, d, e);
}


/***/ }

}]);
//# sourceMappingURL=vendors-node_modules_gnaudio_jabra-js_browser-esm_init-handler-BkKnFG4X_js.genesys-cloud-webrtc-sdk.bundle.js.map