/*! For license information please see dll.VideoChatButton.js.LICENSE.txt */
(window.webpackJsonp_name_hash_=window.webpackJsonp_name_hash_||[]).push([[118],{1068:function(t,e,o){"use strict";o.r(e);var n=o(13),s=o.n(n),a=o(12),i=o.n(a),r=o(7),p=o.n(r),c=o(14),l=o.n(c),u=o(15),h=o.n(u),f=o(8),d=o.n(f),b=o(5),m=o.n(b),v=o(0),y=o.n(v),E=o(1),V=o.n(E),C=o(23),_=o.n(C),g=o(26),T=o(58),w=o(137),D=o(19),R=o(71);function S(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 o,n=d()(t);if(e){var s=d()(this).constructor;o=Reflect.construct(n,arguments,s)}else o=n.apply(this,arguments);return h()(this,o)}}var k=_()("isle:video-chat-button"),j=function(t){l()(o,t);var e=S(o);function o(t){var n;return s()(this,o),n=e.call(this,t),m()(p()(n),"toggleVideoChat",(function(t){var e=!n.state.opened;n.props.onClick(t,e),n.setState({opened:e},(function(){var t=n.context;e?(k("Should join chat for component with id '".concat(n.props.for,"'...")),t.joinVideoChat({name:n.props.for,subject:n.props.subject||n.props.for})):(k("Should leave chat for component with id '".concat(n.props.for,"'...")),t.leaveVideoChat(n.props.for))}))})),n.state={opened:!1},n}return i()(o,[{key:"componentDidMount",value:function(){var t=this,e=this.context;this.unsubscribe=e.subscribe((function(e,o){e===R.VIDEO_CHAT_STARTED&&o===t.props.for?t.setState({opened:!0}):e===R.VIDEO_CHAT_ENDED&&o===t.props.for?t.setState({opened:!1}):e!==R.RECEIVED_JITSI_TOKEN&&e!==R.RECEIVED_USER_RIGHTS||t.forceUpdate()}))}},{key:"componentWillUnmount",value:function(){this.unsubscribe()}},{key:"render",value:function(){var t,e,o,n=this.context;if(t=this.props.buttonLabel?this.props.buttonLabel:this.state.opened?"Leave Video":"Join Video",e=this.props.buttonVariant?this.props.buttonVariant:this.state.opened?"success":"secondary",!n.jitsi)return y.a.createElement(g.default,{disabled:!0,name:"Video Chat",variant:e,size:this.props.size,className:this.props.className,style:this.props.style,"aria-disabled":"true","aria-label":"Disabled Video Chat"},t);o=this.props.tooltip?this.props.tooltip:"".concat(this.state.opened?"Leave":"Join"," video chat with ID ").concat(this.props.for);var s=y.a.createElement(g.default,{name:"Video Chat",variant:e,size:this.props.size,className:this.props.className,onClick:this.toggleVideoChat,style:this.props.style,"aria-label":"Toggle Video Chat"},y.a.createElement("span",{style:{pointerEvents:"none"}},t));return this.props.showTooltip&&(s=y.a.createElement(T.default,{tooltip:o,placement:this.props.tooltipPlacement},s)),y.a.createElement(w.default,{user:!0},s)}}]),o}(v.Component);j.propTypes={for:V.a.string.isRequired,subject:V.a.string,buttonLabel:V.a.node,showTooltip:V.a.bool,size:V.a.string,buttonVariant:V.a.string,tooltipPlacement:V.a.oneOf(["left","top","right","bottom"]),onClick:V.a.func,className:V.a.string,style:V.a.object},j.defaultProps={subject:null,buttonLabel:null,showTooltip:!0,size:"sm",buttonVariant:null,tooltipPlacement:"top",onClick:function(){},className:"",style:{}},j.contextType=D.default,e.default=j}}]);