import _Object$assign from "@babel/runtime-corejs2/core-js/object/assign";
import "core-js/modules/es6.function.name";
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/objectWithoutPropertiesLoose";
import { getRestProps } from '../utils';
export default function (obj, _Vdt, blocks, $callee) {
  var _classNameObj;

  _Vdt || (_Vdt = Vdt);
  obj || (obj = {});
  blocks || (blocks = {});
  var h = _Vdt.miss.h,
      hc = _Vdt.miss.hc,
      hu = _Vdt.miss.hu,
      widgets = this && this.widgets || {},
      _blocks = {},
      __blocks = {},
      __u = _Vdt.utils,
      extend = __u.extend,
      _e = __u.error,
      _className = __u.className,
      __slice = __u.slice,
      __noop = __u.noop,
      __m = __u.map,
      __o = __u.Options,
      _getModel = __o.getModel,
      _setModel = __o.setModel,
      _setCheckboxModel = __u.setCheckboxModel,
      _detectCheckboxChecked = __u.detectCheckboxChecked,
      _setSelectModel = __u.setSelectModel,
      self = this.data,
      $this = this,
      scope = obj,
      Animate = self && self.Animate,
      parent = ($callee || {})._super;

  var _self$get = self.get(),
      className = _self$get.className,
      disabled = _self$get.disabled,
      trueValue = _self$get.trueValue,
      style = _self$get.style,
      children = _self$get.children,
      value = _self$get.value,
      ref = _self$get.ref,
      key = _self$get.key,
      rest = _objectWithoutPropertiesLoose(_self$get, ["className", "disabled", "trueValue", "style", "children", "value", "ref", "key"]);

  var classNameObj = (_classNameObj = {
    'k-radio': true,
    'k-disabled': disabled,
    'k-checked': self.isChecked()
  }, _classNameObj[className] = className, _classNameObj);
  var evClick;
  var events = ['ev-click', 'ev-mouseenter', 'ev-mouseleave'].reduce(function (memo, name) {
    if (rest[name]) {
      if (name === 'ev-click') {
        // do not bind click to label, otherwise it will trigger click event twice
        evClick = rest[name];
      } else {
        memo[name] = rest[name];
      }

      delete rest[name];
    }

    return memo;
  }, {});
  return h('label', _Object$assign({
    'style': function () {
      try {
        return style;
      } catch (e) {
        _e(e);
      }
    }.call($this),
    'tabindex': function () {
      try {
        return disabled ? "-1" : "0";
      } catch (e) {
        _e(e);
      }
    }.call($this)
  }, function () {
    try {
      return events;
    } catch (e) {
      _e(e);
    }
  }.call($this), {
    'ev-keypress': function () {
      try {
        return self._onKeypress;
      } catch (e) {
        _e(e);
      }
    }.call($this)
  }), [h('span', null, h('input', _Object$assign({
    'type': 'radio',
    'disabled': function () {
      try {
        return disabled;
      } catch (e) {
        _e(e);
      }
    }.call($this),
    'value': function () {
      try {
        return trueValue;
      } catch (e) {
        _e(e);
      }
    }.call($this),
    'tabindex': '-1'
  }, function () {
    try {
      return getRestProps(self, rest);
    } catch (e) {
      _e(e);
    }
  }.call($this), {
    'checked': function () {
      try {
        return value === trueValue;
      } catch (e) {
        _e(e);
      }
    }.call($this),
    'ev-click': function () {
      try {
        return function (e) {
          _setCheckboxModel(self, 'value', trueValue, false, e, $this);

          evClick && evClick(e);
        };
      } catch (e) {
        _e(e);
      }
    }.call($this)
  }), null, null, null, function (i) {
    widgets['input'] = i;
  }), 'k-wrapper'), function () {
    try {
      return children;
    } catch (e) {
      _e(e);
    }
  }.call($this) ? h('span', null, function () {
    try {
      return children;
    } catch (e) {
      _e(e);
    }
  }.call($this), 'k-text') : undefined], _className(function () {
    try {
      return classNameObj;
    } catch (e) {
      _e(e);
    }
  }.call($this)));
}