Liferay.Loader.define("data-engine-js-components-web@1.0.79/js/utils/ReactComponentAdapter.es",["module","exports","require","frontend-js-metal-web$metal-incremental-dom","frontend-js-metal-web$metal-jsx","frontend-js-metal-web$metal-state","liferay!frontend-js-react-web$react","liferay!frontend-js-react-web$react-dom","./Observer.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.getConnectedReactComponentAdapter=m,t.default=void 0;var n=f(r("frontend-js-metal-web$metal-incremental-dom")),o=f(r("frontend-js-metal-web$metal-jsx")),a=r("frontend-js-metal-web$metal-state"),s=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),c=f(r("liferay!frontend-js-react-web$react-dom")),l=f(r("./Observer.es"));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function f(e){return e&&e.__esModule?e:{default:e}}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e=["children","events","ref","visible"],j=["displayErrors"];function m(t){class r extends o.default{constructor(t,r){const n={};Object.keys(t).concat(j).forEach((r=>{e.includes(r)||(n[r]=a.Config.any().value(t[r]))})),super(t,r);o.default.DATA_MANAGER.getManagerData(this).props_.configState(b(b({},o.default.DATA),n))}created(){this.observer=new l.default,this.reactComponentRef=s.default.createRef()}disposed(){this.instance_&&(c.default.unmountComponentAtNode(this.instance_),this.instance_=null)}willReceiveProps(t){if(delete t.events,delete t.children,t&&Object.keys(t).length){const r={};Object.keys(t).forEach((n=>{e.includes(n)||(r[n]=t[n].newVal)})),this.observer.dispatch(r)}}shouldUpdate(){return!1}syncVisible(e){this.observer.dispatch({visible:e})}render(){const e=this.props,{events:r,ref:n,store:o}=e,a=d(e,["events","ref","store"]);IncrementalDOM.elementOpen("div",n,[],"class","react-component-adapter");const l=IncrementalDOM.currentElement();IncrementalDOM.skip(),IncrementalDOM.elementClose("div"),c.default.render(s.default.createElement(v,{observer:this.observer},s.default.createElement(t,u({},a,r,o,{instance:this,ref:this.reactComponentRef}))),l),this.instance_=l}}return r.RENDERER=n.default,r}const v=({children:e,observer:t})=>{const[r,n]=(0,s.useState)({});return(0,s.useEffect)((()=>{const e=e=>n(b(b({},r),e));return t.subscribe(e),()=>{t.unsubscribe(e)}}),[r,n,t]),s.default.cloneElement(e,b(b({},e.props),r))};var y=m;t.default=y}}));
//# sourceMappingURL=ReactComponentAdapter.es.js.map