text: "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-dom"),r=require("hassanreact/core"),n=require("hassanreact/dialog"),o=require("hassanreact/button"),c=require("hassanreact/api");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(e),s=i(t);function l(){return(l=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 u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function O(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 g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){v(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var w=function(t){d(g,e.Component);var i,s,b,h,v,O=(i=g,s=j(),function(){var e,t=y(i);if(s){var r=y(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return m(this,e)});function g(e){var t;return u(this,g),(t=O.call(this,e)).state={visible:e.visible},t.reject=t.reject.bind(f(t)),t.accept=t.accept.bind(f(t)),t.hide=t.hide.bind(f(t)),t}return b=g,(h=[{key:"acceptLabel",value:function(){return this.props.acceptLabel||c.localeOption("accept")}},{key:"rejectLabel",value:function(){return this.props.rejectLabel||c.localeOption("reject")}},{key:"accept",value:function(){this.props.accept&&this.props.accept(),this.hide("accept")}},{key:"reject",value:function(){this.props.reject&&this.props.reject(),this.hide("reject")}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(e){var t=this;this.setState({visible:!1},(function(){t.props.onHide&&t.props.onHide(e)}))}},{key:"componentDidUpdate",value:function(e){e.visible!==this.props.visible&&this.setState({visible:this.props.visible})}},{key:"renderFooter",value:function(){var e=r.classNames("p-confirm-dialog-accept",this.props.acceptClassName),t=r.classNames("p-confirm-dialog-reject",{"p-button-text":!this.props.rejectClassName},this.props.rejectClassName),n=a.default.createElement(a.default.Fragment,null,a.default.createElement(o.Button,{label:this.rejectLabel(),icon:this.props.rejectIcon,className:t,onClick:this.reject}),a.default.createElement(o.Button,{label:this.acceptLabel(),icon:this.props.acceptIcon,className:e,onClick:this.accept,autoFocus:!0}));if(this.props.footer){var c={accept:this.accept,reject:this.reject,acceptClassName:e,rejectClassName:t,acceptLabel:this.acceptLabel(),rejectLabel:this.rejectLabel(),element:n,props:this.props};return r.ObjectUtils.getJSXElement(this.props.footer,c)}return n}},{key:"renderElement",value:function(){var e=r.classNames("p-confirm-dialog",this.props.className),t=r.classNames("p-confirm-dialog-icon",this.props.icon),o=r.ObjectUtils.findDiffKeys(this.props,g.defaultProps),c=r.ObjectUtils.getJSXElement(this.props.message,this.props),i=this.renderFooter();return a.default.createElement(n.Dialog,l({visible:this.state.visible},o,{className:e,footer:i,onHide:this.hide,breakpoints:this.props.breakpoints}),a.default.createElement("i",{className:t}),a.default.createElement("span",{className:"p-confirm-dialog-message"},c))}},{key:"render",value:function(){var e=this.renderElement();return a.default.createElement(r.Portal,{element:e,appendTo:this.props.appendTo})}}])&&p(b.prototype,h),v&&p(b,v),g}();v(w,"defaultProps",{visible:!1,message:null,rejectLabel:null,acceptLabel:null,icon:null,rejectIcon:null,acceptIcon:null,rejectClassName:null,acceptClassName:null,className:null,appendTo:null,footer:null,breakpoints:null,onHide:null,accept:null,reject:null}),exports.ConfirmDialog=w,exports.confirmDialog=function(e){var t=e.appendTo||document.body,n=document.createDocumentFragment();r.DomHandler.appendChild(n,t),e=g(g({},e),{visible:void 0===e.visible||e.visible});var o=a.default.createElement(w,e);s.default.render(o,n);var c=function(t){e=g(g({},e),t),s.default.render(a.default.cloneElement(o,e),n)};return{_destroy:function(){s.default.unmountComponentAtNode(n)},show:function(){c({visible:!0,onHide:function(){c({visible:!1})}})},hide:function(){c({visible:!1})},update:function(e){c(e)}}};
  