define(['jquery','jquery-ui-modules/widget'],function($){'use strict';$.widget('mage.fieldsetControls',{original:undefined,options:{inputSelector:'[data-reset="true"]'},_create:function(){this.original=this.element.find(this.options.inputSelector).clone(true);this._bind();},_bind:function(){this._on({'fieldsetReset':'_onReset'});},_onReset:function(e){var items;e.stopPropagation();items=this.element.find(this.options.inputSelector);items.each($.proxy(function(index,item){if($(item).attr('type')=='file'){$(item).replaceWith($(this.original[index]).clone(true));}else if($(item).attr('type')=='checkbox'||$(item).attr('type')=='radio'){if($(this.original[index]).attr('checked')===undefined){$(item).removeAttr('checked');}else{$(item).attr('checked',$(this.original[index]).attr('checked'));}}else{$(item).val($(this.original[index]).val());}},this));}});$.widget('mage.fieldsetResetControl',{_create:function(){this._bind();},_bind:function(){this._on({click:'_onClick'});},_onClick:function(e){e.stopPropagation();$(this.element).trigger('fieldsetReset');}});return{fieldsetControls:$.mage.fieldsetControls,fieldsetResetControl:$.mage.fieldsetResetControl};});