"use strict";var _baseComponent=_interopRequireDefault(require("../helpers/baseComponent")),_classNames2=_interopRequireDefault(require("../helpers/libs/classNames"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(0,_baseComponent.default)({properties:{prefixCls:{type:String,value:"wux-segment"},theme:{type:String,value:"balanced"},defaultCurrent:{type:Number,value:0},current:{type:Number,value:0,observer:function(e){this.data.controlled&&this.setData({activeKey:e})}},values:{type:Array,value:[]},disabled:{type:Boolean,value:!1},controlled:{type:Boolean,value:!1}},data:{activeKey:0},computed:{classes:["prefixCls, theme, disabled",function(e,t,r){return{wrap:(0,_classNames2.default)(e,_defineProperty(_defineProperty({},"".concat(e,"--").concat(t),t),"".concat(e,"--disabled"),r)),item:"".concat(e,"__item")}}]},methods:{onTap:function(e){this.data.disabled||this.setActiveKey(e.currentTarget.dataset.index)},emitEvent:function(e){this.triggerEvent("change",{key:e,values:this.data.values})},setActiveKey:function(e){this.data.activeKey===e||this.data.controlled||this.setData({activeKey:e}),this.emitEvent(e)}},attached:function(){var e=this.data,t=e.defaultCurrent,r=e.current,e=e.controlled?r:t;this.data.activeKey!==e&&this.setData({activeKey:e})}});