'use strict';
Object.defineProperty(exports, '__esModule', {
    value: true
});
exports.default = void 0;
var _computedBehavior = _interopRequireDefault(require('./computedBehavior'));
var _relationsBehavior = _interopRequireDefault(require('./relationsBehavior'));
var _safeAreaBehavior = _interopRequireDefault(require('./safeAreaBehavior'));
var _safeSetDataBehavior = _interopRequireDefault(require('./safeSetDataBehavior'));
var _funcBehavior = _interopRequireDefault(require('./funcBehavior'));
var _compareVersion = _interopRequireDefault(require('./compareVersion'));
function _interopRequireDefault(e) {
    return e && e.__esModule
        ? e
        : {
              default: e
          };
}
function ownKeys(r, e) {
    var t = Object.keys(r);
    if (Object.getOwnPropertySymbols) {
        var o = Object.getOwnPropertySymbols(r);
        if (e) {
            o = o.filter(function (e) {
                return Object.getOwnPropertyDescriptor(r, e).enumerable;
            });
        }
        t.push.apply(t, o);
    }
    return t;
}
function _objectSpread(r) {
    for (var e = 1; e < arguments.length; e++) {
        if (null != arguments[e]) {
            var t = arguments[e];
        } else {
        }
        e % 2
            ? ownKeys(t, true).forEach(function (e) {
                  _defineProperty(r, e, t[e]);
              })
            : Object.getOwnPropertyDescriptors
            ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t))
            : ownKeys(t).forEach(function (e) {
                  Object.defineProperty(r, e, Object.getOwnPropertyDescriptor(t, e));
              });
    }
    return r;
}
function _defineProperty(e, r, t) {
    r in e
        ? Object.defineProperty(e, r, {
              value: t,
              enumerable: true,
              configurable: true,
              writable: true
          })
        : (e[r] = t);
    return e;
}
function _toConsumableArray(e) {
    return _arrayWithoutHoles(e) || _iterableToArray(e) || _nonIterableSpread();
}
function _nonIterableSpread() {
    throw new TypeError('Invalid attempt to spread non-iterable instance');
}
function _iterableToArray(e) {
    if (Symbol.iterator in Object(e) || '[object Arguments]' === Object.prototype.toString.call(e)) {
        return Array.from(e);
    }
}
function _arrayWithoutHoles(e) {
    if (Array.isArray(e)) {
        for (r = 0, t = new Array(e.length), void 0; r < e.length; r++) {
            var r;
            var t;
            t[r] = e[r];
        }
        return t;
    }
}
var _wx$getSystemInfoSync = uni.getSystemInfoSync();
var platform = _wx$getSystemInfoSync.platform;
var SDKVersion = _wx$getSystemInfoSync.SDKVersion;
var libVersion = '2.6.6';
if ('devtools' === platform && (0, _compareVersion.default)(SDKVersion, libVersion) < 0 && wx && uni.showModal) {
    uni.showModal({
        title: '提示',
        content: '当前基础库版本（'.concat(SDKVersion, '）过低，无法使用 Wux Weapp 组件库，请更新基础库版本 >=').concat(libVersion, ' 后重试。')
    });
}
var baseComponent = function (e) {
    if (0 < arguments.length && void 0 !== e) {
        var t = e;
    } else {
    }
    t.externalClasses = ['wux-class', 'wux-hover-class'].concat(_toConsumableArray((t.externalClasses = t.externalClasses || [])));
    t.behaviors = [_relationsBehavior.default, _safeSetDataBehavior.default].concat(_toConsumableArray((t.behaviors = t.behaviors || [])), [_computedBehavior.default]);
    if (t.useSafeArea) {
        t.behaviors = [].concat(_toConsumableArray(t.behaviors), [_safeAreaBehavior.default]);
        delete t.useSafeArea;
    }
    if (t.useFunc) {
        t.behaviors = [].concat(_toConsumableArray(t.behaviors), [_funcBehavior.default]);
        delete t.useFunc;
    }
    if (t.useField) {
        t.behaviors = [].concat(_toConsumableArray(t.behaviors), ['wx://form-field']);
        delete t.useField;
    }
    if (t.useExport) {
        t.behaviors = [].concat(_toConsumableArray(t.behaviors), ['wx://component-export']);
        t.methods = _objectSpread(
            {
                export: function () {
                    return this;
                }
            },
            t.methods
        );
        delete t.useExport;
    }
    t.options = _objectSpread(
        {
            multipleSlots: true,
            addGlobalClass: true
        },
        t.options
    );
    if (t.properties) {
        Object.keys(t.properties).forEach(function (e) {
            var r = t.properties[e];
            if (Array.isArray(r.type)) {
                r.optionalTypes = r.type;
            }
        });
    }
    return Component(t);
};
var _default = baseComponent;
exports.default = _default;
