import*as e from"../../../frontend-js-metal-web/__liferay__/exports/metal-component.js";import*as t from"../../../frontend-js-metal-web/__liferay__/exports/metal-dom.js";import*as r from"../../../frontend-js-metal-web/__liferay__/exports/metal-state.js";import*as a from"../../../frontend-js-metal-web/__liferay__/exports/metal.js";var n={2:u=>{u.exports=e},476:u=>{u.exports=t},408:u=>{u.exports=r},877:u=>{u.exports=a}},o={};function __webpack_require__(u){var f=o[u];if(void 0!==f)return f.exports;var c=o[u]={exports:{}};return n[u](c,c.exports,__webpack_require__),c.exports}var i={};(()=>{var u=i;Object.defineProperty(u,"X$",{value:!0}),u.rU=void 0;var f=function(){function defineProperties(u,f){for(var c=0;c<f.length;c++){var _=f[c];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(u,_.key,_)}}return function(u,f,c){return f&&defineProperties(u.prototype,f),c&&defineProperties(u,c),u}}(),c=function get(u,f,c){null===u&&(u=Function.prototype);var _=Object.getOwnPropertyDescriptor(u,f);if(void 0===_){var d=Object.getPrototypeOf(u);return null===d?void 0:get(d,f,c)}if("value"in _)return _.value;var y=_.get;return void 0!==y?y.call(c):void 0},_=function _interopRequireDefault(u){return u&&u.__esModule?u:{default:u}}(__webpack_require__(2)),d=__webpack_require__(408),y=__webpack_require__(476),h=__webpack_require__(877),v=function(u){function ClayComponent(){return function _classCallCheck(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}(this,ClayComponent),function _possibleConstructorReturn(u,f){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!f||"object"!=typeof f&&"function"!=typeof f?u:f}(this,(ClayComponent.__proto__||Object.getPrototypeOf(ClayComponent)).apply(this,arguments))}return function _inherits(u,f){if("function"!=typeof f&&null!==f)throw new TypeError("Super expression must either be null or a function, not "+typeof f);u.prototype=Object.create(f&&f.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(u,f):u.__proto__=f)}(ClayComponent,u),f(ClayComponent,[{key:"attached",value:function attached(){for(var u,f=this,_=arguments.length,d=Array(_),v=0;v<_;v++)d[v]=arguments[v];if((u=c(ClayComponent.prototype.__proto__||Object.getPrototypeOf(ClayComponent.prototype),"attached",this)).call.apply(u,[this].concat(d)),!(0,h.isServerSide)()&&this.element){var m=this.element.getAttribute.bind(this.element);for(var b in this.element.getAttribute=function(u){var c=m(u);return f.element&&!c&&(c=y.domData.get(f.element,u)),h.core.isDefAndNotNull(c)?c:""},this.data)this.data.hasOwnProperty(b)&&y.domData.get(this.element,"data-"+b,this.data[b])}}},{key:"rendered",value:function rendered(){for(var u,f=arguments.length,_=Array(f),d=0;d<f;d++)_[d]=arguments[d];(u=c(ClayComponent.prototype.__proto__||Object.getPrototypeOf(ClayComponent.prototype),"rendered",this)).call.apply(u,[this].concat(_)),this._renderDataAttributes()}},{key:"syncData",value:function syncData(u,f){u!=f&&this._renderDataAttributes()}},{key:"buildFacade_",value:function buildFacade_(u,f,c){if(this.getShouldUseFacade()){var _={data:f,preventDefault:function preventDefault(){_.preventedDefault=!0,!c||!c.preventDefault||c.preventDefault&&c.defaultPrevented||c.preventDefault()},stopInmediatePropagation:function stopInmediatePropagation(){c&&c.stopInmediatePropagation&&c.stopInmediatePropagation()},stopPropagation:function stopPropagation(){c&&c.stopPropagation&&c.stopPropagation()},target:this,type:u};return _}}},{key:"emit",value:function emit(u){for(var f=arguments.length,c=Array(f>1?f-1:0),_=1;_<f;_++)c[_-1]=arguments[_];var d=(0,h.isObject)(u)?u.name:u,y=this.buildFacade_(d,u.data,u.originalEvent);c=(0,h.isObject)(u)?[y]:c;var v=this.getRawListeners_(d),m="handle"+d.charAt(0).toUpperCase()+d.slice(1);return this.runListeners_(v,c,y,this.defaultEventHandler,m),!0}},{key:"runListeners_",value:function runListeners_(u,f,c,_,d){c&&f.push(c);for(var y=[],h=0;h<u.length;h++){var v=u[h].fn||u[h];u[h].default?y.push(v):v.apply(this,f)}if(_&&_[d]&&_[d].apply(_,function _toConsumableArray(u){if(Array.isArray(u)){for(var f=0,c=Array(u.length);f<u.length;f++)c[f]=u[f];return c}return Array.from(u)}(f)),!c||!c.preventedDefault)for(var m=0;m<y.length;m++)y[m].apply(this,f)}},{key:"_renderDataAttributes",value:function _renderDataAttributes(){for(var u in this.data)Object.prototype.hasOwnProperty.call(this.data,u)&&this.element.setAttribute("data-"+u,this.data[u])}}]),ClayComponent}(_.default);v.STATE={data:d.Config.object(),defaultEventHandler:d.Config.object()},u.rU=v,u.ZP=v})();var p=i.rU,s=i.X$,l=i.ZP;export{p as ClayComponent,s as __esModule,l as default};
//# sourceMappingURL=clay-component.js.map