"use strict";(self.webpackChunkLHCReactAPP=self.webpackChunkLHCReactAPP||[]).push([[806],{9806:function(e,t,a){a.r(t);var n,s=a(8168),c=a(3029),r=a(2901),i=a(6822),o=a(3954),u=a(5361),l=a(4467),d=a(6540),h=a(1225),f=(a(7912),a(900)),v=a(5580);function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(g=function(){return!!e})()}var m=(0,h.Ng)((function(e){return{chatwidget:e.chatwidget}}))(n=function(e){function t(e){var a,n,s,r;return(0,c.A)(this,t),n=this,s=t,r=[e],s=(0,o.A)(s),a=(0,i.A)(n,g()?Reflect.construct(s,r||[],(0,o.A)(n).constructor):s.apply(n,r)),(0,l.A)(a,"state",{preg_match_rules:[]}),a.listenerAdded=!1,a.js_execute=null,a}return(0,u.A)(t,e),(0,r.A)(t,[{key:"handleParentMessage",value:function(e,t){if(e.data.event==t.target){var a=[];a[e.data.event]=e.data.value,this.setState(a)}}},{key:"abstractClick",value:function(e,t){var a=this;JSON.parse(e["data-action"]).forEach((function(e){if("add_css_class"==e.action){var t=document.querySelector(e.target);t&&t.classList.add(e.value)}else if("remove_css_class"==e.action){var n=document.querySelector(e.target);n&&n.classList.remove(e.value)}else if("chat_attr_global"==e.action)window.lhcChat[e.target]=e.value;else if("set_state"==e.action){var s={};s[e.target]=e.value,a.props.setStateParent(s)}else"post_message"==e.action?document.getElementById(e.target).contentWindow.postMessage(e.value,"*"):"listen_post_message"==e.action&&(window.addEventListener?window.addEventListener("message",(function(t){a.handleParentMessage(t,e)}),!1):window.attachEvent?window.attachEvent("onmessage",(function(t){a.handleParentMessage(t,e)})):document.attachEvent&&document.attachEvent("onmessage",(function(t){a.handleParentMessage(t,e)})))}))}},{key:"componentDidMount",value:function(){null!==this.js_execute&&(0,v.tl)(this.js_execute,this)}},{key:"render",value:function(){var e=this,t=this.props.chatwidget.getIn(["chat_ui",this.props.attr]);return this.props.has_new||(t=t.replace(/<newmessages>(.*)<\/newmessages>/gi,"")),this.state.preg_match_rules.forEach((function(e){t=t.replace(e.search,e.replace,"")})),d.createElement(d.Fragment,null,(0,f.Ay)(t,{replace:function(t){var a=Object.assign({},t.attribs);if(t.attribs){if(t.name&&"button"===t.name)return d.createElement("button",(0,s.A)({type:"button"},t.attribs,{onClick:function(t){return e.abstractClick(a,t)}}),(0,f.zd)(t.children));if(t.name&&"lhcaction"===t.name)return 0==e.listenerAdded&&(e.abstractClick(a,null),e.listenerAdded=!0),"";if(t.name&&"script"===t.name&&t.attribs["data-bot-action"])return e.js_execute=t,d.createElement(d.Fragment,null)}}}))}}])}(d.Component))||n;t.default=m}}]);
//# sourceMappingURL=806.12706780f867038187f2.js.map