import e from"react";import{init as t}from"useblocks";function n(e){"@babel/helpers - typeof";return n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n(e)}function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}function a(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=class extends e.Component{constructor(...e){super(...e),a(this,`_instancePromise`,Promise.resolve(void 0)),a(this,`_element`,null),a(this,`setElement`,e=>{this._element=e,this._reset()})}_reset(){let{props:e,_element:n}=this;this._instancePromise=this._instancePromise.then(r=>{if(e===this.props&&n===this._element){if(n)return r?r.reset({...e,element:n}):t({...e,element:n});r&&r.destroy()}},e=>void 0)}componentDidUpdate(){this._reset()}render(){let{id:t,className:n,style:r,container:i}=this.props,a={id:t,className:n,style:r,...i};return e.createElement(`div`,{...a,ref:this.setElement})}};export{o as default};