"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.multiSelectCheckboxUniDriverFactory = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _InputWithOptionsUni = require("../InputWithOptions/InputWithOptions.uni.driver");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var multiSelectCheckboxUniDriverFactory = (base, body) => {
  var {
    driver,
    inputDriver,
    dropdownLayoutDriver
  } = (0, _InputWithOptionsUni.inputWithOptionsUniDriverFactory)(base, body);
  var _getLabels = /*#__PURE__*/function () {
    var _ref = (0, _asyncToGenerator2.default)(function* () {
      var delimiter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ", ";
      return (yield inputDriver.getValue()).split(delimiter);
    });
    return function getLabels() {
      return _ref.apply(this, arguments);
    };
  }();
  return {
    exists: function () {
      var _exists = (0, _asyncToGenerator2.default)(function* () {
        return base.exists();
      });
      function exists() {
        return _exists.apply(this, arguments);
      }
      return exists;
    }(),
    driver: _objectSpread(_objectSpread({}, driver), {}, {
      getNumOfLabels: function () {
        var _getNumOfLabels = (0, _asyncToGenerator2.default)(function* () {
          return (yield _getLabels()).length;
        });
        function getNumOfLabels() {
          return _getNumOfLabels.apply(this, arguments);
        }
        return getNumOfLabels;
      }(),
      getLabels: function () {
        var _getLabels2 = (0, _asyncToGenerator2.default)(function* (delimiter) {
          return _getLabels(delimiter);
        });
        function getLabels(_x) {
          return _getLabels2.apply(this, arguments);
        }
        return getLabels;
      }(),
      getLabelAt: function () {
        var _getLabelAt = (0, _asyncToGenerator2.default)(function* (index, delimiter) {
          return (yield _getLabels(delimiter))[index];
        });
        function getLabelAt(_x2, _x3) {
          return _getLabelAt.apply(this, arguments);
        }
        return getLabelAt;
      }()
    }),
    inputDriver,
    dropdownLayoutDriver
  };
};
exports.multiSelectCheckboxUniDriverFactory = multiSelectCheckboxUniDriverFactory;
//# sourceMappingURL=MultiSelectCheckbox.uni.driver.js.map