function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var getStringAtPosition = function getStringAtPosition(str, pos) {
  if (pos < 0 || pos >= str.length) {
    return undefined;
  }
  return str.charAt(pos);
};
var getNum1 = function getNum1(arr, str) {
  var num1 = getStringAtPosition(str, 0);
  // 第一位
  if (Number(num1) < 3) {
    arr[0] = num1;
    return arr;
  }
  arr[0] = "0";
  arr[1] = num1;
  return arr;
};
var getNum2 = function getNum2(arr, num2) {
  var num1 = arr[0];
  // 0 1 2
  if (arr.length < 2) {
    // 0 1
    if (Number(num1) < 2) {
      arr[1] = num2;
      return arr;
    } else {
      // 2
      if (Number(num1) === 2) {
        if (Number(num2) < 4) {
          arr[1] = num2;
          return arr;
        } else {
          if (Number(num2) <= 5) {
            arr[1] = "0";
            arr[2] = num2;
            return arr;
          }
          arr[1] = "0";
          arr[2] = "0";
          arr[3] = num2;
          return arr;
        }
      }
    }
  }

  // 03  04 05 06
  if (Number(num2) < 6) {
    arr[2] = num2;
    return arr;
  } else {
    arr[2] = "0";
    arr[3] = num2;
    return arr;
  }
};
var getNum3 = function getNum3(arr, num3) {
  // 01 02 10 12 22 23
  if (arr.length === 2) {
    if (Number(num3) < 6) {
      arr[2] = num3;
      return arr;
    } else {
      arr[2] = "0";
      arr[3] = num3;
      return arr;
    }
  }
  // 010 012 123 234
  arr[3] = num3;
  return arr;
};
var getNum4 = function getNum4(arr, num4) {
  arr[3] = num4;
  return arr;
};
var formatArray = function formatArray(arr) {
  var _arr = _toConsumableArray(arr);
  while (_arr.length < 4) {
    _arr.push("0");
  }
  _arr.splice(2, "0", ":");
  return _arr;
};
var formatRes = function formatRes(arr) {
  var valueArray = _toConsumableArray(arr);
  var previewValueArray = formatArray(arr);
  var previewValueArrayDom = null;
  if (valueArray.length > 2) {
    valueArray.splice(2, "0", ":");
  }
  previewValueArrayDom = previewValueArray.map(function (d, i) {
    if (valueArray[i]) {
      return /*#__PURE__*/React.createElement("span", null, d);
    } else {
      return /*#__PURE__*/React.createElement("span", {
        style: {
          color: "#98A2B3"
        }
      }, d);
    }
  });
  return {
    valueArray: valueArray,
    valueString: arr.join(""),
    previewValueArray: formatArray(arr),
    previewValueArrayDom: previewValueArrayDom,
    previewValueString: formatArray(arr).join(""),
    disabled: []
  };
};

// 将字符串自动转换成Time
export var formatStringToTime = function formatStringToTime(value) {
  var arr = [];
  var str = value.replace(":", "");
  if (str.length >= 5) {
    str = "";
  }
  var num2 = getStringAtPosition(str, 1);
  var num3 = getStringAtPosition(str, 2);
  var num4 = getStringAtPosition(str, 3);
  if (!str.length) {
    return formatRes(arr);
  }
  arr = getNum1(arr, str);
  // 第二位

  if (num2 !== undefined) {
    arr = getNum2(arr, num2);
    if (arr.length === 4) {
      return formatRes(arr);
    }
  }
  if (num3 !== undefined) {
    arr = getNum3(arr, num3);
    if (arr.length === 4) {
      return formatRes(arr);
    }
  }
  if (num4 !== undefined) {
    arr = getNum4(arr, num4);
    return formatRes(arr);
  }
  return formatRes(arr);
};
export var fn = function fn() {};