/*! For license information please see dll.ChatButton.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[24],{1037:function(t,e,n){"use strict";n.r(e);var o=n(13),s=n.n(o),a=n(12),i=n.n(a),r=n(6),p=n.n(r),l=n(14),c=n.n(l),u=n(15),h=n.n(u),f=n(8),m=n.n(f),d=n(5),b=n.n(d),v=n(0),y=n.n(v),S=n(1),C=n.n(S),g=n(25),T=n.n(g),E=n(175),w=n(24),_=n(39),k=n(141),A=n(20),M=n(73);function L(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=m()(t);if(e){var s=m()(this).constructor;n=Reflect.construct(o,arguments,s)}else n=o.apply(this,arguments);return h()(this,n)}}var H=T()("isle:chat-button"),R=function(t){c()(n,t);var e=L(n);function n(t){var o;return s()(this,n),o=e.call(this,t),b()(p()(o),"hideAnimation",(function(){o.setState({showAnimation:!1})})),b()(p()(o),"handleClick",(function(t){H("Handle click to join chat...");var e=!o.state.opened;o.props.onClick(t,e),o.setState({opened:e},(function(){var t=o.context;e?(H("Should join chat for component with id '".concat(o.props.for,"'...")),t.joinChat({name:o.props.for,anonymousSubmissions:o.props.anonymousSubmissions})):(H("Should leave chat for component with id '".concat(o.props.for,"'...")),t.leaveChat(o.props.for))}))})),o.state={opened:!1,nMessages:0,nMembers:0},o}return i()(n,[{key:"componentDidMount",value:function(){var t=this,e=this.context;this.unsubscribe=e.subscribe((function(n,o){if(n!==M.SELF_HAS_JOINED_CHAT&&n!==M.RECEIVED_CHAT_HISTORY||!o||o.name!==t.props.for){if(n===M.CHAT_STATISTICS&&o.name===t.props.for){var s={nMessages:o.nMessages,nMembers:o.nMembers};o.nMessages>t.state.nMessages&&(s.showAnimation=!0),t.setState(s),setTimeout(t.hideAnimation,4e3)}else if(o===t.props.for){e.getChat(t.props.for)&&n!==M.SELF_HAS_LEFT_CHAT?n===M.REMOVED_CHAT&&t.setState({opened:!1}):t.setState({opened:!1}),t.forceUpdate()}}else t.setState({opened:!0})}))}},{key:"componentWillUnmount",value:function(){this.unsubscribe()}},{key:"render",value:function(){var t,e,n=this.state.nMessages;t=this.props.buttonLabel?this.props.buttonLabel:this.state.opened?"Leave Chat":"Join Chat",e=this.props.buttonVariant?this.props.buttonVariant:this.state.nMembers>0?"success":"secondary";var o,s=y.a.createElement(w.default,{className:this.props.className,variant:e,size:this.props.size,onClick:this.handleClick,style:this.props.style,"aria-label":"Toggle Chat"},y.a.createElement("span",{style:{pointerEvents:"none"}},t),n?y.a.createElement(E.default,{variant:"dark",style:{marginLeft:"5px",fontSize:"10px",pointerEvents:"none",animation:this.state.showAnimation?"ping 0.7s 3":"none"}},n):null);return o=this.props.tooltip?this.props.tooltip:"".concat(this.state.opened?"Leave":"Join"," chat with ID ").concat(this.props.for),this.props.showTooltip&&(s=y.a.createElement(_.default,{tooltip:o,placement:this.props.tooltipPlacement},s)),y.a.createElement(k.default,{user:!0},s)}}]),n}(v.Component);R.propTypes={for:C.a.string.isRequired,anonymousSubmissions:C.a.bool,buttonLabel:C.a.node,showTooltip:C.a.bool,tooltip:C.a.string,size:C.a.string,buttonVariant:C.a.string,tooltipPlacement:C.a.oneOf(["left","top","right","bottom"]),onClick:C.a.func,className:C.a.string,style:C.a.object},R.defaultProps={anonymousSubmissions:!1,buttonLabel:null,showTooltip:!0,tooltip:null,size:"sm",buttonVariant:null,tooltipPlacement:"top",onClick:function(){},className:"",style:{}},R.contextType=A.default,e.default=R}}]);