"use strict";var _baseComponent=_interopRequireDefault(require("../helpers/baseComponent"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_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(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}(0,_baseComponent.default)({relations:{"../accordion/index":{type:"child",observer:function(){this.callDebounceFn(this.updated)}}},properties:{prefixCls:{type:String,value:"wux-accordion-group"},cellGroupPrefixCls:{type:String,value:"wux-cell-group"},defaultCurrent:{type:Array,value:[]},current:{type:Array,value:[],observer:function(e){this.data.controlled&&this.updated(e)}},controlled:{type:Boolean,value:!1},accordion:{type:Boolean,value:!1},title:{type:String,value:""},label:{type:String,value:""},mode:{type:String,value:"default"},bodyStyle:{type:[String,Object],value:""}},data:{activeKey:"",keys:[]},methods:{updated:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.data.activeKey;this.data.activeKey!==e&&this.setData({activeKey:e}),this.changeCurrent(e)},changeCurrent:function(a){var n=this,e=this.getRelationsByName("../accordion/index");0<e.length&&e.forEach(function(e,t){var t=e.data.key||String(t),r=n.data.accordion?a[0]===t:-1!==a.indexOf(t);e.changeCurrent(r,t)}),this.data.keys.length!==e.length&&this.setData({keys:e.map(function(e){return e.data})})},emitEvent:function(e){this.triggerEvent("change",{key:e,keys:this.data.keys})},setActiveKey:function(e){this.data.controlled||this.updated(e),this.emitEvent(this.data.accordion?e[0]:e)},onClickItem:function(t){var e=_toConsumableArray(this.data.activeKey),e=this.data.accordion?e[0]===t?[]:[t]:-1!==e.indexOf(t)?e.filter(function(e){return e!==t}):[].concat(_toConsumableArray(e),[t]);this.setActiveKey(e)}},ready:function(){var e=this.data,t=e.defaultCurrent,r=e.current,e=e.controlled;this.updated(e?r:t)}});