File Manager

Path: /home/liffinac1/domains/fxinvestcapital.us/public_html/db_files/a_data/

Viewing File: 217.js

(window.webpackJsonp=window.webpackJsonp||[]).push([[217],{"+SlM":function(t,e,i){"use strict";(function(e,s,o,n){i("TdlR"),i("/VKo");var a=i("ovEV"),r=i("debi"),h=i("eF4M"),d=i("OqB+"),l=i("sklT").getUsernameHintList,c=i("7KDR").Action,u=i("5VQP").ContextMenuManager,p=i("hp/T"),m=i("PQvG"),g=i("QcGJ").newPrivateChatDialog,_=i("sFgq").SidebarCustomScroll,f=i("bR4N").bindPopupMenu,v=i("Wz41"),b=i("fZEr"),w=b.showConfirm,y=b.showRename,C=b.showWarning,R=i("hWl2"),M=i("VPmY"),S=i("qjxE"),T=i("vBL9"),x=i("FBuY").TVXWindowEvents,k=i("XhdI").trackChatEvent,I=i("PT1i").linking;i("pay7");function B(t){this._bridge=t,this._container=t.$body,this._visible=!1,this._notificationCount=0,this._init_history_loaded=!1,this._unreadFlag=!1,this._model=v.makePrivateModel(),this._model.roomAdded().subscribe(this,this._onRoomAdded),this._model.roomChanged().subscribe(this,this._onRoomChanged),this._model.roomDeleted().subscribe(this,this._onRoomDeleted),this._model.roomsChanged().subscribe(this,this._onRoomsChanged),this._model.otherRoomMessagesRead().subscribe(this,this._onRoomMessagesRead),this._model.messageReceivedInOtherRoom().subscribe(this,this._onChatMessage),this._chatMaximized=new e,this.layoutWithSelect()||this._chatMaximized.subscribe((function(t){TVSettings.setValue("privatemessages.chatmaximized",t)})),this._standalone=!!t.standalone||!!(t.options||{}).standalone,this._layoutWithSelect=!!t.layoutWithSelect||!!(t.options||{}).layoutWithSelect,this._chatNotificationControl=new d.ChatNotificationControl(!0),this.layoutWithSelect()?(r.prototype.prepareLayoutWithSelect.call(this,!0,this._$notAuthMessage()),this.roomChange=new s):this.prepareLayout(),0!==this._model.getRooms().length&&this._onRoomsChanged(this._model.getRooms(),[]),this.connect(),this.resize(),t.onMessage&&t.onMessage(this.onBridgeMessage.bind(this)),t.visible.subscribe(function(e){if(this._visible=e,e){this._bridge.postMessage("private_chat_visible"),this.resize();var i=TVSettings.getValue("privatemessages.activechat","");this._visibilityToggled?this._visibilityToggled=!1:i&&this.getRoomById(i)&&this.openChat(i),this._model.getRooms().forEach(function(t){t._notifyFired&&($("#msg-item-"+t.room_id).highlight(1),this.isCurrentRoom(t.room_id)&&$("#msg-item-"+t.room_id+" .counter").text("0").removeClass("active")),t._notifyFired=!1}.bind(this)),t.notify(null,{stopHighlightTab:!0,force:!0}),this.updateNotifications()}else this._bridge.postMessage("private_chat_hidden")}.bind(this),{callWithLast:!0}),t.height&&t.height.subscribe(this.onWindowResize.bind(this)),t.width&&t.width.subscribe(this.resizeChat.bind(this)),TradingView.messagesWidget=this,setInterval(this.checkUnreadRooms.bind(this),1e3)}B.prototype._emitXWindowOnNewMessagesRead=function(t){this._xWindowNewMessagesReadBuffer?this._xWindowNewMessagesReadBuffer.push(t):(this._xWindowNewMessagesReadBuffer=[t],setTimeout(function(){var t=this._xWindowNewMessagesReadBuffer.join(":");x.emit("messages.newmessagesread",t),delete this._xWindowNewMessagesReadBuffer}.bind(this),500))},
B.prototype.onBridgeMessage=function(t,e){"private_message_read"===t&&this._emitXWindowOnNewMessagesRead(e.id)},B.prototype.updateNotifications=function(){var t=this._$data.find(".counter.active").length;0===t&&(this._notificationCount=0),this._bridge.notify(1,{notificationValue:t,clear:!t,force:!0,highlightTab:!1})},B.prototype.checkUnreadRooms=function(){this._$data.find(".counter.active").length?this._unreadFlag||(this._unreadFlag=!0,R.setTabIcon(R.TAB_ICON_URLS.UNREAD_MESSAGES)):this._unreadFlag&&(this._unreadFlag=!1,R.setTabIcon(R.TAB_ICON_URLS.DEFAULT))},B.prototype.prepareLayout=function(){var t=this;this._$widget=$('<div class="tv-messages">').appendTo(this._container),this._$addChatButton=$('<a class="button apply-common-tooltip" title="'+$.t("Select user to start new chat with")+'" data-role="button" data-name="new-chat">').append($(i("oHcy")).attr({width:17,height:17})).click((function(t){runOrSignIn(g,{source:"Private message dialog",verifiedPhoneRequired:!0})})).appendTo(this._bridge.$headerspace),this._searchFilter=new d.ChatRoomListSearchFilter(this,!0),this._searchFilter.appendButton(this._bridge.$headerspace),this._searchFilter.appendInput(this._$widget),this._$dataWrap=$('<div class="msg-data-wrap">').appendTo(this._$widget),this._$dataWrap.on("contextmenu",(function(t){t.target.classList.contains("msg-data-wrap")&&t.preventDefault()})),this._$data=$('<div class="msg-data">').appendTo(this._$dataWrap),this._$data.on("click",".msg-item",(function(e){t._searchFilter&&t._searchFilter.isOpen()&&t._searchFilter.setNewRoom($("#msg-item-"+$(this).data("room"))),t.openChat($(this).data("room")),e.preventDefault()})).on("contextmenu",".msg-item",(function(e){e.preventDefault(),t.showRoomContextMenu(e,$(this).data("room"))})),this._searchFilter.setRoomList(this._$data),this._searchFilter.setOpenCallback((function(){t._model.loadMoreRooms(1e3)})),is_authenticated||this._$notAuthMessage().appendTo(this._$data),this._scroll=new _(this._$dataWrap,this._$data),this._scroll.scrolltoend.subscribe(this,(function(){this._model.loadMoreRooms()}))},B.prototype._onRoomAdded=function(t){if(!(t.user_id in this._model.ignoredUsers())){this.addRoom(t,!0);var e=t.room_id;this._roomToBeOpenedWhenAdded&&this._roomToBeOpenedWhenAdded===e&&(this._roomToBeOpenedWhenAdded=null,this._scroll.animateTo($("#msg-item-"+e).position().top),this.openChat(e)),this.isStandalone()&&this._bridge.notify(null,{roomsCount:this._model.getRooms().length})}},B.prototype._onRoomChanged=function(t){t.user_id in this._model.ignoredUsers()||this.setRoomTitleById(t.room_id,this.roomTitle(t))},B.prototype._onRoomDeleted=function(t){$("#msg-item-"+t.room_id).remove()},B.prototype._onRoomsChanged=function(t,e){if(window.is_authenticated)if(this._$data.empty(),t.length){this.isStandalone()&&this._bridge.notify(null,{roomsCount:t.length});var i=0===e.length&&0!==t.length,s=0;if(t.forEach((function(t){s+=this.addRoom(t,!1,i)}),this),s){
var o=this.layoutWithSelect()&&this._bridge.activeRoom?this._bridge.activeRoom:TVSettings.getValue("privatemessages.activechat","");i&&this._visible&&o&&this.getRoomById(o)&&this.openChat(o),i||!o||this.getRoomById(o)||this.closeChat()}else this.appendPlaceholder("hidden")}else this.isStandalone()?this._bridge.notify(null,{roomsCount:0}):this.appendPlaceholder("empty");else this.isStandalone()&&this._bridge.notify(null,{roomsCount:0})},B.prototype._onChatMessage=function(t,e,i){var s=this;if(!(t.user_id in this._model.ignoredUsers())){var o=$("#msg-item-"+e);o.prependTo(this._$data),!t.type&&this._model.isRoomHidden(e)&&o.hasClass("js-hidden")&&this._showRoom(e,o);var n=o.find(".desc");n.find(".last-message").text(t.username+": "+T.removeBBCodes(t.text));var a=n.find("time");a.length?S.jQueryCompatibleDestroy(a):(a=$("<time>")).insertAfter(o.find(".js-last-message")),S.jQueryCompatibleAgoDateFormatter(a,new Date(t.time));var r=t.user_id!==window.user.id,h=this._model.getRoomById(e),d=new M;d.ready.then((function(){var n=d.data.notification_popup;if(r&&(!s.isCurrentRoom(e)||!s._visible)){var a,l;if(r&&!i&&!t.type&&!s.isStandalone()&&!s.layoutWithSelect()&&n&&document.hidden)h.members_info.length>2?(l=s.roomTitle(h),a=t.username+": "+T.removeBBCodes(t.text)):(l=t.username,a=T.removeBBCodes(t.text)),m.show(l,a,t.user_pic);var c=s._$data.find('a[data-room="'+e+'"] .counter'),u=parseInt(c.text(),10);c.addClass("active").text(u+1),s._notificationCount++,o.highlight(1),s.updateNotifications();var g=TVSettings.getJSON("privatemessages.sound",null),_=t.text&&T.removeBBCodes(t.text).indexOf("@"+window.user.username)>-1;r&&!i&&(!g||g.onMessage||_&&g.onMessageForUser)&&p.play("chat/popup")}h._notifyFired||s._visible||(s.updateNotifications(),h._notifyFired=!0)}))}},B.prototype.connect=function(){this._onXWindowChatOpen=this.onXWindowChatOpen.bind(this),this._onXWindowChatStatus=this.onXWindowChatStatus.bind(this),this._onXWindowChatVisibility=this.onXWindowChatVisibility.bind(this),this._onXWindowNewMessagesRead=this.onXWindowNewMessagesRead.bind(this),x.on("messages.newmessagesread",this._onXWindowNewMessagesRead),this.isStandalone()||(x.on("messages.openchat",this._onXWindowChatOpen),x.on("messages.chatstatus",this._onXWindowChatStatus),x.on("messages.chatvisibility",this._onXWindowChatVisibility))},B.prototype.onXWindowNewMessagesRead=function(t){this._bridge.postMessage("private_chat_msgs_read",{idString:t})},B.prototype.onXWindowChatOpen=function(t){if(this._model.getRooms().length){var e=t.indexOf(":"),i=t.indexOf("@"),s=t.substr(e+1,i-e-1);this.openChat(s,!0)}},B.prototype.onXWindowChatStatus=function(t){if(this._model.getRooms().length){var e=t.split(":")[1];$("#msg-item-"+e+" .counter").text("0").removeClass("active"),this.updateNotifications()}},B.prototype.onXWindowChatVisibility=function(t){if(this._model.getRooms().length){var e=t.split(":")[0],i=t.split(":")[1];this.getRoomById(e)&&"hide"===i&&this._hideRoom(e,!0)}},B.prototype.destroy=function(){this._chatWidget&&(this._chatWidget.destroy(),this._chatWidget=null),
this._model.roomAdded().unsubscribe(this,this._onRoomAdded),this._model.roomChanged().unsubscribe(this,this._onRoomChanged),this._model.roomDeleted().unsubscribe(this,this._onRoomDeleted),this._model.roomsChanged().unsubscribe(this,this._onRoomsChanged),this._model.otherRoomMessagesRead().unsubscribe(this,this._onRoomMessagesRead),this._model.messageReceivedInOtherRoom().unsubscribe(this,this._onChatMessage),this._model.destroy(),this._model=null,x.off("messages.openchat",this._onXWindowChatOpen),x.off("messages.chatstatus",this._onXWindowChatStatus),x.off("messages.chatvisibility",this._onXWindowChatVisibility),x.off("messages.newmessagesread",this._onXWindowNewMessagesRead)},B.prototype.removePlaceholder=function(t){t&&t.find(".js-placeholder-message").remove(),this.isStandalone()?(this._bridge.$header.show(),this._bridge.$body.find(".js-placeholder-message").remove()):this._$data.find(".js-placeholder-message").remove()},B.prototype.appendPlaceholder=function(t,e){var i,s;e?s=e:this.isStandalone()?(this._bridge.$header.hide(),s=this._bridge.$body):s=this._$data,"empty"===t?i=$.t("You have no private messages yet"):"hidden"===t&&(s.is(".chat-body")&&$(document.body).addClass("no-chats"),i=$.t("You have no new messages!")),s.append('<div class="msg-empty tv-widget-empty-message js-placeholder-message">'+i+"</div>")},B.prototype.getRoomById=function(t){return this._model.getRoomById(t)},B.prototype.roomTitle=function(t,e){if(!t)return"";if(t.title){var i=TradingView.clean(t.title);return e?"<strong>"+i+"</strong>":i}var s,o=[];t.members_info.forEach((function(t){t.username!==window.user.username&&o.push(t.username)}));var n=o.slice(0,4);return e&&(n=n.map((function(t){return"<strong>"+TradingView.clean(t)+"</strong>"}))),s=n.join(", "),o.length>4&&(s+=", +"+(o.length-4)),s},B.prototype.getRoomTitleById=function(t,e){return this.roomTitle(this.getRoomById(t),e)},B.prototype.setRoomTitleById=function(t,e){e=TradingView.clean(e),this._bridge.setTitle(e),$("#msg-item-"+t+" .title").text(e)},B.prototype.addRoom=function(t,e,i){var s=this._model.isRoomHidden(t.room_id);s&&t.new_msgs&&(this._model.removeHiddenRoom(t.room_id),s=!1);var n=t.last_message?T.removeBBCodes(TradingView.clean(t.last_message)):"",a={roomId:t.room_id,isHidden:s,title:TradingView.clean(this.roomTitle(t)),lastMessage:n},r=$(o.render('<a href="#" data-room="{{roomId}}"{{#isHidden}} data-hidden-conversation="true"{{/isHidden}} id="msg-item-{{roomId}}" class="msg-item{{#isHidden}} js-hidden{{/isHidden}}"><div class="title">{{title}}</div><div class="desc"><span class="last-message js-last-message">{{lastMessage}}</span></div><div class="counter">0</div></a>',a));if(n.length){var h=$("<time>");h.insertAfter(r.find(".js-last-message")),S.jQueryCompatibleAgoDateFormatter(h,new Date(1e3*t.updated||Date.now()))}this.isCurrentRoom(t.room_id)&&r.addClass("active");for(var d,l=$('<div class="userpics"></div>').prependTo(r),c=0,u=0;u<t.members_info.length;u++)(d=t.members_info[u]).username!==window.user.username&&c<4&&(c++,
$('<i class="userpic userpic-'+c+(d.online?" online":"")+'"><img src="'+d.user_pic+'"/></i>').appendTo(l));return l.addClass("layout-"+c),e?r.prependTo(this._$data).highlight(1):r.appendTo(this._$data),t.new_msgs&&!this.isCurrentRoom(t.room_id)&&(r.find(".counter").addClass("active").text(t.new_msgs),this._notificationCount+=t.new_msgs,i&&(t._notifyFired=!0),this.updateNotifications()),this._$data.find(".js-placeholder-message").remove(),s?0:1},B.prototype._onRoomMessagesRead=function(t){this.markChatAsRead(t.room_id),this.updateNotifications()},B.prototype.markChatAsRead=function(t){var e=$("#msg-item-"+t+" .counter"),i=parseInt(e.text(),10);return e.text("0").removeClass("active"),i&&(this._notificationCount=Math.max(0,this._notificationCount-i)),i},B.prototype.openChat=function(t,e){this._$data.find("a").removeClass("active"),$("#msg-item-"+t).addClass("active"),this.markChatAsRead(t),(this._visible||e)&&this.updateNotifications(),this.isCurrentRoom(t)||(this.layoutWithSelect()||this.flipWidgets(),this.isStandalone()&&x.emit("messages.chatstatus",+new Date+":"+t),this._bridge.setTitle(this.getRoomTitleById(t)),this.layoutWithSelect()&&this._$select&&this._$select.html(this.getRoomTitleById(t,!0)),this.removePlaceholder(this._$chat),this.closeChat(),this._createChatWidget(t,e),this._chatWidget.resize(),this.resize(),this.isStandalone()||TVSettings.setValue("privatemessages.activechat",t),this.layoutWithSelect()||this.toggleMaximize(TVSettings.getBool("privatemessages.chatmaximized")),this.layoutWithSelect()&&this.roomChange.fire(t))},B.prototype.membersFilter=function(t){return t.username!==window.user.username},B.prototype._membersCount=function(t){var e=this._model.getRoomById(t);return e?e.members_info.length>2?e.members_info.filter(this.membersFilter).length:"":0},B.prototype._createChatWidget=function(t,e){var i=this.layoutWithSelect()&&this._bridge.$body?this._bridge.$body:this._$chat;this._$chatWidgetContainer=$('<div class="msg-window" id="msg-window-'+t+'" data-room="'+t+'"></div>').appendTo(i),this._$chatBody=$('<div class="msg-window-body chat-page"></div>').appendTo(this._$chatWidgetContainer),this.layoutWithSelect()&&this._$chatBody.css("height","100%"),this._createUsernameHint(t),this.symbolLinking=I.symbol.spawn(),this.intervalLinking=I.interval.spawn();var s=this._model.getRoomById(t),o=$.extend(!0,{},this._bridge.options);o.hideMaximize=o.hideMaximize||this.layoutWithSelect(),this._chatBridge={$body:this._$chatBody,_room:t,properties:{value:function(){return{room:t}}},options:o,visible:this._bridge.visible,$headerspace:this._bridge.$headerspace,$header:this._bridge.$header,private_chat:!0,privateMenuItems:function(){return this.getPrivateRoomActions(s)}.bind(this),getChartWidget:this._bridge.getChartWidget,postMessage:this._bridge.postMessage,onMessage:this._bridge.onMessage,chatNotificationControl:this._chatNotificationControl,getChartWidgetCollection:this._bridge.getChartWidgetCollection,addPeople:this.addPeople.bind(this),membersCount:this._membersCount.bind(this,t),
hideDetach:this._standalone||n.enabled("browser_extension"),standalone:this._standalone||this.layoutWithSelect(),toggleMaximize:this.toggleMaximize.bind(this),maximized:this._chatMaximized.readonly(),symbol:this.symbolLinking,interval:this.intervalLinking,isAuthor:s.is_author},this.isStandalone()||e||(this._chatBridge.xWindowDataSync=function(e){x.emit("messages.openchat",+new Date+":"+t+"@"+JSON.stringify(e))}),this._chatWidget=new h(this._chatBridge),Modernizr.mobiletouch||this.layoutWithSelect()||this._$chat.find(".message-input").focus()},B.prototype.toggleMaximize=function(t){if("boolean"!=typeof t)t=!this._chatMaximized.value();else if(t===this._chatMaximized.value())return;this._$chat.toggleClass("msg-chat-maximized",t),this._chatMaximized.setValue(t),this._chatWidget.resize()},B.prototype._isCurrentUserAuthor=function(t){var e=this.getRoomById(t||this._currentRoom());return window.is_authenticated&&e&&e.is_author},B.prototype._getHintListOptions=function(){return{container:this._$chatWidgetContainer.parent().parent()[0],input:this._$inputText[0],fullBorder:!0,simpleMode:!0,className:a.userNameHintList,closeOnMouseOutClick:!0,onMouseDownOutside:function(){this._$inputText.val("")}.bind(this),onItemSelected:function(t){this.addNewRecipient(t)}.bind(this)}},B.prototype._createUsernameHint=function(t){var e=this._isCurrentUserAuthor(t)||window.user.is_moderator||window.user.is_staff;if(this._$chatMembers=$(o.render('<div class="msg-members">{{#canEditMembers}}<div class="msg-input-wrap js-hidden"><div class="msg-input"><textarea placeholder="{{ placeholderText }}"></textarea></div></div>{{/canEditMembers}}<div class="msg-chat-members{{#canEditMembers}} msg-chat-members--height_decreased{{/canEditMembers}}"></div><div class="msg-username-hint-actions{{^canEditMembers}} msg-username-hint-actions--one-button{{/canEditMembers}}">{{#canEditMembers}}<a class="_tv-button cancel">'+$.t("Cancel")+'</a><a class="_tv-button ok">'+$.t("OK")+'</a>{{/canEditMembers}}{{^canEditMembers}}<a class="_tv-button cancel">'+$.t("Close",{context:"input"})+"</a>{{/canEditMembers}}</div></div>",{canEditMembers:e,placeholderText:$.t("Add people to this chat...")})),this._$chatMembers.appendTo(this._$chatBody),this._$inputWrap=this._$chatMembers.find(".msg-input-wrap"),this._$input=this._$chatMembers.find(".msg-input"),this._$inputText=this._$chatMembers.find("textarea"),this._$chatMembersContent=this._$chatMembers.find(".msg-chat-members"),this._$membersActions=this._$chatMembers.find(".msg-username-hint-actions"),this._$chatHeadingHeaderspace=this._bridge.$headerspace,e){var i=this;l(this._getHintListOptions()).then((function(t){var e=i._$chatWidgetContainer.parent().parent();$(t).appendTo(e)}))}if(e){var s=this;this._$chatMembersContent.on("click",".remove",(function(t){return t.stopPropagation(),t.preventDefault(),s.removeNewRecipient($(this).parent().data("id")),s.syncDeleteButtonVisibility(),!1}))}this._$membersActions.on("click",".ok",function(){var t=this._$membersActions.find(".ok")
;t.hasClass("i-disabled")||(t.addClass("i-disabled"),this.saveRecipients(this.getCurrentRecipients()).then((function(){t.removeClass("i-disabled")})))}.bind(this)),this._$membersActions.on("click",".cancel",function(){this._$chatHeadingHeaderspace.find("#add-people").removeClass("active"),this._$inputWrap.addClass("js-hidden"),this._$chatMembers.hide()}.bind(this))},B.prototype.addPeople=function(){var t=this._$chatHeadingHeaderspace.find("#add-people");t.hasClass("active")?(t.removeClass("active"),this._$inputWrap.addClass("js-hidden"),this._$chatMembers.hide()):(t.addClass("active"),this._$inputWrap.removeClass("js-hidden"),this._$chatMembers.show(),this._$inputText.val("").focus(),this._showMembersList())},B.prototype._showMembersList=function(){var t=this;this._$chatMembersContent.empty().css("height",""),this._model.updateRoomInfo(this._currentRoom(),function(){var e=this._model.getRoomById(this._currentRoom()).members_info.sort((function(t,e){return t.online?-1:1})).filter(this.membersFilter).map((function(t){return{username:t.username,online:t.online,userpic:t.user_pic,id:t.user_id}})),i=t.renderRecipients(e);this._$chatMembersContent.append(i),t.syncDeleteButtonVisibility()}.bind(this))},B.prototype.syncDeleteButtonVisibility=function(){var t=this._$chatMembersContent.find(".recipient").length,e=this._$chatMembersContent.find(".remove");t>1?e.show():e.hide()},B.prototype.addNewRecipient=function(t){if(this._$inputText.val("").focus(),-1===this.getCurrentRecipients().indexOf(t.id)){var e=$.extend({},t);this.renderRecipients([e]).prependTo(this._$chatMembersContent),this.syncDeleteButtonVisibility()}else C({title:$.t("Notice"),text:$.t("{name} is already in this chat.").format({name:t.username})})},B.prototype.renderRecipients=function(t){var e=this._isCurrentUserAuthor();return $(o.render('{{#recipients}}<a href="/u/{{ username }}/" target="_blank" class="recipient{{#online}} online{{/online}}" data-id="{{ id }}"><img src="{{ userpic }}"/><span class="recipient-username">{{ username }}</span>{{#showDeleteButton}}<i class="remove"></i>{{/showDeleteButton}}</a>{{/recipients}}',{recipients:t,showDeleteButton:e||window.user.is_moderator||window.user.is_staff}))},B.prototype.removeNewRecipient=function(t){$('.recipient[data-id="'+t+'"]').remove(),this._$inputText.focus()},B.prototype.saveRecipients=function(t){return new Promise(function(e){if(t.length){var i=this._currentRoom();new Promise(function(e){this._model.getRoomInfo(i,(function(i){2===i.members_info.length&&t.length>2?w({title:$.t("Create new chat room?"),text:$.t("You're adding members to a one-on-one chat. Do you want to create a new chat room, or add new members to the existing chat?"),mainButtonText:$.t("Create new chat"),cancelButtonText:$.t("Add to existing chat"),onConfirm:function(t){e(!1),t.dialogClose()},onCancel:function(t){e(!0),t.dialogClose()}}):e(!0)}))}.bind(this)).then(function(s){this.saveRecipientsImpl(i,t,s,e)}.bind(this))}else e()}.bind(this))},B.prototype.saveRecipientsImpl=function(t,e,i,s){
this._model.updateRoomUsers(t,e,function(t){if(t.error)return C({title:$.t("Error"),html:t.error}),void s();this._$inputWrap.addClass("js-hidden"),this._$chatHeadingHeaderspace.find("#add-people").removeClass("active"),this._$chatMembers.hide();var e=t.room;if(e.existing)return this.openChat(e.room_id),void s();this.isCurrentRoom(e.room_id)||this.isStandalone()||(this._roomToBeOpenedWhenAdded=e.room_id),s()}.bind(this),{updateExistingRoom:i})},B.prototype.flipWidgets=function(){if(!this._flipped){var t=this._container.height(),e=parseFloat(TVSettings.getValue("privatemessages.paneratio","0.5")),s=Math.round(e*t);this._bridge.visible.value()||this._bridge.visible.subscribe(function(i){t=this._container.height(),s=Math.round(e*t),this._$chat.height(s),this._$widget.height(t-s),this.resize()}.bind(this),{once:!0}),this._$headerWrap=$('<div class="tv-messages-header">').prependTo(this._$widget),this._$headerWrap.on("contextmenu",(function(t){t.preventDefault()}));var o=$('<div class="widgetbar-widgetheader"><div class="widgetbar-widgettitle">'+$.t("Recent Chats")+"</div></div>").appendTo(this._$headerWrap),n=$('<div class="widgetbar-headerspace">').append(this._$addChatButton).append(this._searchFilter.getButton()).prependTo(o);this._$settingsButton=$('<a class="button apply-common-tooltip" title="'+$.t("Settings")+'" data-role="button" data-name="settings">').append($(i("RsxI")).attr({width:17,height:17})).appendTo(n),this._$settingsButton.on("click",function(t){this._chatWidget&&this._chatWidget._showSettingsDialog(t,this._model.getRooms())}.bind(this)),f(this._$settingsButton,null,{event:"show-popup",addClass:"ch-popup ch-settings-popup",careBottomBorder:!0,careRightBorder:!0,viewportSpacing:2,reverse:!0}),this._$chat=$('<div class="msg-chat-wrap">').insertBefore(this._$widget),this._$chat.height(s),this._$widget.height(t-s),this._$chat.data("heightRatio",e),this._$resizeHandle=$('<div class="msg-window-handle"></div>').on("mousedown touchstart",this.onWidgetResizeHandleMousedown.bind(this)).appendTo(this._$widget),this._flipped=!0}},B.prototype.onWidgetResizeHandleMousedown=function(t){if(!t.isDefaultPrevented()){t.preventDefault();var e,i=this,s=this._$chat,o=this._$widget;e=t.originalEvent.touches?t.originalEvent.touches[0].clientY:t.pageY;var n,a=s.height(),r=this._container.height(),h=function(t){var h=(t.originalEvent.touches?t.originalEvent.touches[0].clientY:t.pageY)-e,d=Math.max(0,Math.min(a+h,r-i._$headerWrap.outerHeight()));n!==d&&(n=d,s.data("heightRatio",(d/r).toFixed(2)),s.height(d),o.height(r-d),i.resize())},d=function(t){$(document.documentElement).off("mousemove touchmove",h).off("mouseup touchend",d),n!==a&&TVSettings.setValue("privatemessages.paneratio",s.data("heightRatio"))};$(document.documentElement).on("mousemove touchmove",h).one("mouseup touchend",d)}},B.prototype.resize=function(){if(!this.layoutWithSelect()){var t=this._$widget.height();t-=this._searchFilter.getInputHeight(),this._$headerWrap&&(t-=this._$headerWrap.outerHeight()),this._$dataWrap.height(t),this._scroll.resize()}
this.resizeChat()},B.prototype.resizeChat=function(){this._chatWidget&&this._chatWidget.resize()},B.prototype.onWindowResize=function(){if(this._chatWidget)if(this.layoutWithSelect())this._chatWidget.resize();else{var t=this._$chat.data("heightRatio"),e=this._container.height();this._$chat.height(e*t),this._$widget.height(e*(1-t)),this.resize()}},B.prototype.closeChat=function(t){this._chatWidget&&(this._chatWidget.destroy(),this._chatWidget=null),this._$chatWidgetContainer&&(this._$chatWidgetContainer.remove(),this._$chatWidgetContainer=null),this._$chatHeadingHeaderspace&&this._$chatHeadingHeaderspace.empty(),t&&(this._bridge.setTitle($.t("Select Conversation...")),this.appendPlaceholder("hidden",this._$chat)),this.isStandalone()||TVSettings.setValue("privatemessages.activechat","")},B.prototype.sendMessageToUser=function(t,e){if(e!==window.user.id){var i=this.getFaceToFaceChat(e),s=function(e){this._model.getRoomInfo(e,function(i){k(i,t),this._model.sendMessageToRoom(e,t,{},null,function(t){var i=t.error||t.warning;if(i){var s=t.title;C({title:t.error?s||window.t("Error"):s||window.t("Warning"),html:i})}this.openChat(e),window.widgetbar&&window.widgetbar.setPage("pm_chats"),this._scroll&&this._scroll.scrollToStart()}.bind(this),(function(){C({title:$.t("Error"),text:$.t("Unexpected error")})}))}.bind(this))}.bind(this);this._visibilityToggled=!0,i?s(i.room_id):this._model.createRoom("","",[e],(function(t){t.error?C({title:t.errorTitle||$.t("Error"),text:t.error}):s(t.room.room_id)}))}},B.prototype._currentRoom=function(){return this._chatWidget&&this._chatWidget.currentRoom()||""},B.prototype.isCurrentRoom=function(t){return this._currentRoom()===t},B.prototype.isStandalone=function(){return this._standalone},B.prototype.layoutWithSelect=function(){return this._layoutWithSelect},B.prototype._$notAuthMessage=function(){var t=$('<div class="ch-item-empty">'+$.t("If you want to use private messages - please __signInLink__!",{signInLink:'<a href="#signin">'+$.t("sign in or register")+"</a>"})+"</div>");return t.on("click",(function(){return runOrSignIn((function(){}),{source:"Private messages widget placeholder",sourceMeta:"Chart"}),!1})),t},B.prototype.setRoomTitle=function(t){var e=this;y({title:$.t("Set chat title"),initValue:this.getRoomTitleById(t),maxLength:128,onRename:function(i){return new Promise((function(s){var o=i.newValue;o?e._model.editRoom(t,o,"",(function(t){t.error&&C({title:t.errorTitle||$.t("Error"),text:t.error}),s(),i.dialogClose()})):s()}))}})},B.prototype._showRoom=function(t,e){e.removeClass("js-hidden"),e.data("hidden-conversation",!1),this.removePlaceholder(),this._model.removeHiddenRoom(t)},B.prototype._hideRoom=function(t,e){if(!this._model.isRoomHidden(t)){var i=this._$data.find("#msg-item-"+t),s=this.isCurrentRoom(t),o=this._$data.find(".msg-item").not(".js-hidden");i.addClass("js-hidden"),i.removeClass("active"),i.data("hidden-conversation",!0),1===o.length&&this.appendPlaceholder("hidden"),s&&(this.closeChat(!0),this._scroll.scrollToStart()),this._model.addHiddenRoom(t),
e||x.emit("messages.chatvisibility",t+":hide")}},B.prototype.showRoomContextMenu=function(t,e){var i=this.getRoomById(e),s=this.getPrivateRoomActions(i),o=[s.hideConversation];(o=o.concat(s.multiUserActions)).push(h.getLaunchInSeparateWindowAction(e,(function(){return!0}))),u.createMenu(o.map((function(t){return new c({label:t.title,onExecute:t.action})}))).then((function(e){e.show(t)}))},B.prototype.getPrivateRoomActions=function(t){var e=this,i={},s=t.room_id;return i.hideConversation={title:$.t("Hide Conversation"),action:function(){e._hideRoom(s)}},i.multiUserActions=[],t.members_info.length>2&&i.multiUserActions.push({title:$.t("Set Chat Title..."),action:function(){e.setRoomTitle(s)}},{title:$.t("Leave This Chat"),action:function(){w({text:$.t("Are you sure you want to leave this chat?"),onConfirm:function(t){return new Promise((function(i){e._model.leaveFromRoom(s,(function(o){if(i(),o.error)return C({title:o.errorTitle||$.t("Error"),text:o.error}),void t.dialogClose();e.isCurrentRoom(s)&&e.closeChat(!0),e.resize(),t.dialogClose()}))}))}})}}),i},B.prototype.getFaceToFaceChat=function(t){var e=this._model.getRooms();for(var i in e){var s=e[i].members_info;if(2===s.length&&(s[0].user_id===t||s[1].user_id===t))return e[i]}return null},B.prototype.getCurrentRecipients=function(){var t=this._$chatMembersContent.find(".recipient").toArray().map((function(t){return Number(t.getAttribute("data-id"))}));return t.push(window.user.id),t},t.exports={Widget:B}}).call(this,i("hY0g"),i("aIyQ"),i("nbsC"),i("Kxc7"))},"+WOZ":function(t,e,i){},"/VKo":function(t,e,i){},"0XzO":function(t,e,i){"use strict";i("TdlR");var s={smiliesMap:{":agree:":[0,0],":disagree:":[1,0],":okay:":[2,0],":peace:":[3,0],":wait:":[4,0],":wave:":[5,0],":buy:":[0,1],":sell:":[1,1],":profit:":[2,1],":loss:":[3,1],":uptrend:":[4,1],":downtrend:":[5,1],":\\)":[0,2],":D":[1,2],";\\)":[2,2],":\\(":[3,2],o_O:[4,2],":\\|":[5,2],":P":[0,3],":cry:":[1,3],":panic:":[2,3],":halo:":[3,3],":sarcasm:":[4,3],":shades:":[5,3],":sleepy:":[0,4],":love:":[1,4],":rage:":[2,4],"\\]:-\\)":[3,4],":bear:":[4,4],":bull:":[5,4],":tip:":[0,5],":dollar:":[1,5],":euro:":[2,5],":pound:":[3,5],":yen:":[4,5],":bitcoin:":[5,5],":idea:":[0,6],":rip:":[1,6],":popcorn:":[2,6],":coffee:":[3,6],":poop:":[4,6],":hot:":[5,6],":bullseye:":[0,7],":stop:":[1,7],":sun:":[2,7],":moon:":[3,7],":heart:":[4,7],":heartbroken:":[5,7],":spades:":[0,8],":clubs:":[1,8],":hearts:":[2,8],":diamonds:":[3,8],":star:":[4,8],":!:":[5,8],":ok:":[0,9],":no:":[1,9],":sos:":[2,9],":top:":[3,9],":cool:":[4,9],":free:":[5,9]},getSmileByCoords:function(t,e){t=Math.floor(t/25),e=Math.floor(e/25);var i="";return $.each(s.smiliesMap,(function(s,o){if(o[0]===t&&o[1]===e)return i=s.replace(/\\/g,""),!1})),i},highlightNewMessages:function(t,e,i){var s=0,o=$(t.find(".ch-item").toArray().reverse().slice(0,e));if(!(!o.length||e<1||i<1)){for(;e>0;){e-=o.eq(s).find(".ch-item-text").length,s++}o.slice(0,s).highlight(i)}},getChatHistoryMessageURL:function(t,e){
var i=new Date(t),s=i.getMonth()+1,o=i.getDate(),n=i.getHours(),a=i.getMinutes();return"/chat/history/?room="+e+"&date="+(i.getFullYear()+"-"+(s<10?"0":"")+s+"-"+(o<10?"0":"")+o)+"&timefrom="+((n<10?"0":"")+n+"%3A"+(a<10?"0":"")+a)+"&timeto=00%3A00&usernames=&order=asc&tzoffset="+i.getTimezoneOffset()}};t.exports=s},"0gOL":function(t,e,i){"use strict";i.r(e),i.d(e,"template",(function(){return o}));var s=i("yr01"),o='<div data-id="{{chartId}}" class="tv-widget-chart-like-button apply-common-tooltip {{typeClass}}" title="{{titleTooltip}}"><span class="tv-widget-chart-like-button__icon-place">'+s+'</span><span class="js-likes-counter"></span></div>'},"1viN":function(t,e,i){"use strict";function s(){return new Promise((function(t){Promise.all([i.e(143),i.e(139),i.e("ban-user-dialog")]).then(function(e){t(i("1b6U"))}.bind(null,i)).catch(void 0)}))}function o(t,e,i,o){s().then((function(s){new s.BanUserDialog(t,e,i,o).show()}))}function n(t,e,i){s().then((function(s){new s.UnbanUserDialog(t,e,i).show()}))}i.r(e),i.d(e,"showBanUserDialog",(function(){return o})),i.d(e,"showUnbanUserDialog",(function(){return n}))},"4AmR":function(t,e,i){t.exports=i.p+"683e7a8e04465dc3fac39ed37f0789b8.png"},"4QoS":function(t,e,i){"use strict";i.r(e),i.d(e,"takeChartSnapshot",(function(){return r})),i.d(e,"makeSnapshotRequest",(function(){return h}));var s=i("mrSG"),o=(i("HbRj"),i("YFKU"),i("Kxc7")),n=i("Gvuy"),a=i("BHQF");function r(t,e,i,o){var n;return void 0===o&&(o={}),Object(s.b)(this,void 0,void 0,(function(){var a,r,d,l,c,u,p,m;return Object(s.d)(this,(function(s){if(a=new FormData,void 0!==o.previews)for(r=0,d=o.previews;r<d.length;r++)l=d[r],a.append("previews[]",l);return void 0!==o.cme&&a.append("cme",String(o.cme)),void 0!==o.wl&&a.append("wl",String(o.wl)),void 0!==o.onWidget&&a.append("onWidget",String(o.onWidget)),o.isReport&&a.append("isReport",String(o.isReport)),(c=window.urlParams)&&c.locale&&a.append("language",c.locale),u=t.activeChartWidget.value(),void 0!==(p=u.widgetCustomer())&&a.append("customer",p),"exchange"===(m=u.properties().childs().timezone.value())&&(m=(null===(n=u.model().mainSeries().symbolInfo())||void 0===n?void 0:n.timezone)||m),a.append("timezone",m),a.append("images",JSON.stringify(t.images(),(function(t,e){return e instanceof HTMLCanvasElement?null:e}))),h(a,e,i,o),[2]}))}))}function h(t,e,r,h){return void 0===h&&(h={}),Object(s.b)(this,void 0,void 0,(function(){var d,l,c,u;return Object(s.d)(this,(function(s){switch(s.label){case 0:d=o.enabled("charting_library_base")?h.snapshotUrl||"https://www.tradingview.com/snapshot/":"/snapshot/",s.label=1;case 1:return s.trys.push([1,4,,5]),[4,Object(a.fetch)(d,{body:t,method:"POST",credentials:"same-origin"})];case 2:return[4,(l=s.sent()).text()];case 3:if(c=s.sent(),l.ok)e(c);else{if("suspicious_chart_snapshots_error"===c)return u=window.t("Snapshot seems to contain prohibited content. Please contact {start_link}our support team{end_link} if you have received this by mistake.").format({
start_link:'<a class="tv-dialog__link js-send-report-link" href="#" data-issue-type="other">',end_link:"</a>"}),h.onInvalidSnapshotImage&&h.onInvalidSnapshotImage(),[2,Object(n.createErrorDialog)({title:window.t("Your snapshot was flagged as suspicious"),content:u,btnType:"danger"}).then((function(t){t.on("afterOpen",(function(){i.e("bug-dialog-creation-handler").then(function(e){(0,i("k2ji").bugDialogCreationHandler)(),t.$el.find(".js-send-report-link").click((function(){t.close()}))}.bind(null,i)).catch(void 0)})),t.open()}))];r()}return[3,5];case 4:return s.sent(),r(),[3,5];case 5:return[2]}}))}))}},"4Tc7":function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" width="12" height="12"><path d="M5 .7C3 .7 2 3 2 5c0 4 0 4-2 5h12c-2-1-2-1-2-5C10 3 9 .7 7 .7c0-.9-2-.9-2 0zM4 11c0 1 1 1 2 1s2 0 2-1z"/></svg>'},"5Ucj":function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 586.70002 595.19999" width="586.7" height="595.2" enable-background="new 0 0 595.3 841.9"><path d="M293.4 0C131.8 0 0 131.8 0 297.6s131.8 297.6 293.4 297.6 293.3-131.8 293.3-297.6S454.9 0 293.4 0zm68 182.8h85v93.5h-85v-93.5zm-212.6 0h85v93.5h-85v-93.5zm148.8 306.1c-136 0-187.1-106.3-187.1-106.3h378.4s-55.2 106.3-191.3 106.3z"/></svg>'},"78iq":function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 24" width="32px" height="24px"><path d="M32 24V0L20 12v12zm-20 0V0L0 12v12z"/></svg>'},GDPI:function(t,e,i){"use strict";i.r(e),i.d(e,"getViolations",(function(){return o}));i("YFKU");var s=null;function o(){if(null===s){var t=window.location.protocol+"//"+window.location.host,e=t+"/house-rules/",i=t+"/advertising-info/";s=[{name:window.t("Multiple accounts"),text:window.t("Use only one account - registering with multiple accounts is not allowed."),id:"multi_acc"},{name:window.t("Suspicious links"),text:window.t("No posting links or reference to content / sites that contain viruses or malware."),id:"links"},{name:window.t("Hate speech"),text:window.t("No defamatory, threatening or discriminatory remarks, hate speech or personal attacks."),id:"hate_speech"},{name:window.t("English only"),text:window.t("English only for main public chatrooms and public ideas - so that everyone can understand. Any language can be spoken in the custom chat rooms. Later we may introduce main public chatrooms for other languages."),id:"language"},{name:window.t("Personal information"),text:window.t("Do not post offline personal contact information."),id:"personal_info"},{name:window.t("Illicit content"),text:window.t("No links / posts with illegal content, pornography, or nudity."),id:"illicit_content"},{name:window.t("Rights infringement"),text:window.t("Do not publish content that is not your original work, or infringes the copyright of any third party."),id:"copyright"},{name:window.t("Unsolicited advertising"),text:window.t("No advertising, direct marketing, or solicitation! To engage our audience please go to {link}").format({link:i}),id:"ads"},{name:window.t("Violation of chat & comment etiquette"),
text:window.t("Violation of chat etiquette. For more information on this etiquette please go to __link__",{link:e}),id:"recidive"},{name:window.t("Violation of script publishing"),text:window.t("Violation of script publishing. For more information on this please go to {link}").format({link:e}),id:"script_publishing"}]}return s}},GjsM:function(t,e,i){},HHbT:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" width="14" height="14"><path d="M10.893 9.512l.458 3.624c.014.105-.006.16-.02.176-.028.03-.109.005-.182-.03L7.812 11.73a1.973 1.973 0 0 0-.811-.16c-.302 0-.59.057-.81.16l-3.338 1.552c-.118.056-.164.051-.182.03-.014-.016-.034-.07-.02-.178L3.11 9.51c.06-.503-.162-1.18-.505-1.54L.087 5.302c-.085-.091-.09-.148-.086-.158.003-.01.04-.053.16-.077l3.621-.689c.491-.09 1.069-.506 1.315-.948L7.004 0l1.902 3.43c.246.442.824.859 1.312.947l3.617.69c.123.024.162.068.164.077.003.01-.003.066-.089.157L11.4 7.97c-.348.367-.57 1.045-.506 1.543z"/></svg>'},IRk6:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50" height="50"><path d="M20 17.995c0-1.102.753-1.51 1.69-.91l10.62 6.83c.934.6.937 1.57 0 2.17l-10.62 6.83c-.934.6-1.69.192-1.69-.91v-14.01z"/></svg>'},Inbj:function(t,e,i){"use strict";var s,o=[];function n(){for(var t=!1,e=o.length;e--;){var i=o[e].onclose;o[e].wnd.closed?(i&&i.call(o[e].wnd),o.splice(e,1)):i&&(t=!0)}!t&&s&&(clearInterval(s),s=void 0)}t.exports={open:function(t){"string"==typeof t?t={url:t}:null==t&&(t={}),null!=t.url&&""!==t.url||(t.url="about:blank"),null==t.name&&(t.name=void 0);var e=window.open(t.url,t.name,function(t){if(null==t)return"";if("object"==typeof t){var e="";for(var i in t){var s=t[i];if("boolean"==typeof s)s=s?"yes":"no";else if(null==s)continue;e+=(e?",":"")+i+"="+s}return e}return t+""}(t.parameters)),i=void 0!==t.data,a={wnd:e,data:t.data};return"function"==typeof t.onclose&&(a.onclose=t.onclose,i=!0),"function"==typeof t.onbound&&(a.onbound=t.onbound,i=!0),i&&(o.push(a),!s&&a.onclose&&(s=setInterval(n,1e3))),e},getData:function(t){for(var e=o.length;e--;)if(o[e].wnd===t)return o[e].onbound&&(o[e].onbound.call(t),o[e].onbound=null),o[e].data}}},JTGx:function(t,e){
t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.888672 15.336914" width="14.889" height="15.337" enable-background="new 0 0 32 32"><path d="M14.062 7.54q0 1.085-.32 2.1-.313 1.017-.9 1.853H9.406l-.21-.907q-.58.47-1.11.72-.53.25-1.22.25-1.31 0-2.1-.993-.782-.992-.782-2.773 0-1.774.96-2.83.962-1.053 2.298-1.053.572 0 1.01.133.437.125.944.382v-.375h1.243v6.578h1.89q.33-.585.49-1.46.17-.883.17-1.58 0-1.28-.36-2.327-.35-1.047-1.04-1.797-.686-.75-1.7-1.14-1.014-.41-2.3-.41-1.25 0-2.29.457-1.03.454-1.775 1.22-.75.765-1.18 1.836-.42 1.06-.42 2.265 0 1.29.402 2.36.404 1.063 1.146 1.82.775.79 1.814 1.188 1.04.41 2.267.41.67 0 1.383-.085.72-.086 1.376-.274v1.11q-.76.163-1.416.217-.656.06-1.35.06-1.454 0-2.697-.5-1.242-.49-2.132-1.38-.9-.898-1.4-2.156-.5-1.26-.5-2.78 0-1.448.526-2.69.525-1.25 1.43-2.164.908-.914 2.15-1.438 1.244-.53 2.66-.53 1.53 0 2.733.484 1.2.484 2.03 1.36.83.874 1.26 2.11.445 1.225.445 2.733zM9.18 9.532V5.485q-.493-.227-.884-.32-.39-.102-.836-.102-1.008 0-1.578.703-.57.703-.57 2 0 1.274.453 1.93.453.648 1.414.648.52 0 1.04-.242t.95-.57z" font-family="Arial-BoldMT" font-size="16"/></svg>'},KE2E:function(t,e,i){"use strict";i.r(e),i.d(e,"ChatMessageTypeCustomizer",(function(){return s}));var s=function(){function t(t,e){this._types=t,this._onChangeCb=e}return t.prototype.add=function(t){this._types=Object.assign(this._types,t),this._onChangeCb()},t.prototype.remove=function(t){delete this._types[t],this._onChangeCb()},t.prototype.getTypeNames=function(){return Object.keys(this._types)},t.prototype.getHandler=function(t){return this._types[t].handler},t.prototype.onMessage=function(t){var e,i=null===(e=this._types[t.type])||void 0===e?void 0:e.onMessage;i&&i(t)},t.prototype.getHandlers=function(t){var e=this,i={};return Object.keys(this._types).forEach((function(s){i[s]=e.getHandler(s)||t})),i},t.prototype.onCreateMessage=function(t,e){var i=this._types[e.type].onCreateMessage;i&&i(t,e)},t.prototype.isTypeExists=function(t){return Boolean(this._types[t])},t}()},Ky3Q:function(t,e,i){},Lmvx:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 17" width="17px" height="17px"><circle cx="10" cy="6" r="3"/><path d="M10 10c-4.575 0-6 3.333-6 3.333V15h12v-1.667S14.575 10 10 10zM2 5v6h2V5zm4 2v2H0V7z"/></svg>'},"OqB+":function(t,e,i){"use strict";var s=i("brCa").createNoticeDialog,o=i("Z9Tc").whenVerified,n=i("Wz41"),a=i("dTSQ").regExpEscape,r=i("FBuY").TVXWindowEvents,h=i("2uTr").appendEllipsis;function d(t,e,i,s,o){this._$bar=t,this._value=0,this._state="off",this._halt=i,this._tick=s,this._step=this._halt*this._tick/e,this._animations=o}function l(t,e,s){var o=i("debi");this._bridge=t,this._handler=e,this._rooms=s,this.favoritesSettings=o.prototype.getLocalizedJsonSetting("publiccharts.favorites",{}),this._handler(this.getMenu())}function c(t){this._title=$.t("Onsite Notifications"),this._settingsKey="messages.show_onsite_notifications",this._eventKey="messages.toggleonsitenotifications",t?(this._emailKey="privatemessages.send_email_notifications",
this._emailTitle=$.t("Email Notifications")):(this._emailKey="publicchats.send_email_notifications",this._emailTitle=$.t("Email Notifications When I'm Mentioned")),this._isOn=TVSettings.getBool(this._settingsKey,!0),this._isOnEmail=TVSettings.getBool(this._emailKey,!0),r.on(this._eventKey,this._toggle.bind(this))}function u(t){this._settingsKey=t,this.state=this._getState(),this._updateSettingsListener=this._setFromAnother.bind(this),r.on("chat-sound-control-changed",this._updateSettingsListener),loginStateChange.subscribe(null,this._updateSettingsListener)}function p(t,e){this.parentWidget=t,this.isParentDependent=e,this.isOn=!1}function m(t){this.voteSender=t,this.ideas=[]}d.prototype.start=function(t){"running"===this._state&&this.stop(),this._transaction=t,this._$bar.css("opacity","1"),this._$bar.css("background-color","#18BE8A"),this._state="running",this._intervalID=setInterval(this.update.bind(this),this._tick)},d.prototype.stop=function(){clearInterval(this._intervalID),this._value=0},d.prototype.update=function(){this._value>=this._halt?this.stop():"running"===this._state&&(this._value+=this._step,this._$bar.width(this._value+"%"))},d.prototype.finish=function(t,e){"off"!==this._state&&this._transaction===t&&(this.stop(),this.transaction=-1,e&&this._$bar.css("background-color","red"),this._state="off",this._$bar.animate({width:"100%"},this._animations[0]),this._$bar.animate({opacity:"0"},e?this._animations[2]:this._animations[1],function(){this._$bar.width(0)}.bind(this)))},d.prototype.finishOnError=function(t){this.finish(t,!0)},l.prototype.soundSettings=[{title:$.t("Sound on Every Message"),state:{onMessage:!0,onMessageForUser:!0}},{title:$.t("Sound on Addressed to Me Messages"),state:{onMessage:!1,onMessageForUser:!0}},{title:$.t("No Sound Notifications"),state:{onMessage:!1,onMessageForUser:!1}}],l.prototype.getMenu=function(){var t=[],e=this,s=i("eF4M"),o=i("debi");if(this._bridge.private_chat&&!this._bridge.standalone&&(t=t.concat(this._bridge.privateMenuItems().multiUserActions)).length&&t.push({separator:!0}),(t=t.concat(this.soundMenuItems(this.soundSettings,TVSettings.getJSON(this._bridge.private_chat?"privatemessages.sound":"chat.sound",u.prototype._default_state)))).push({separator:!0}),this._bridge.standalone||this._bridge.options&&this._bridge.options.layoutWithSelect||(this._bridge.private_chat||t.push(this._bridge.chatNotificationControl.onsiteMenuItem()),t.push(this._bridge.chatNotificationControl.emailMenuItem()),t.push({separator:!0})),t.push({title:$.t("Show Chart Snapshot Preview"),icon:{image:"url('/static/images/dialogs/checkbox.png')",offset:TVSettings.getBool("chat.show_snapshot_preview")?"0 -16px":void 0},action:function(t){this._bridge.postMessage("toggle_snaphot_preview")}.bind(this)}),this._bridge.private_chat||this._bridge.standalone||t.push({title:$.t("Show Only Favorite Rooms"),icon:{image:"url('/static/images/dialogs/checkbox.png')",offset:TVSettings.getBool("chat.show_only_favorites")?"0 -16px":void 0},action:function(t){this._bridge.postMessage("toggle_show_only_favorites")
}.bind(this)}),t.push({separator:!0}),this._bridge.private_chat&&!this._bridge.standalone&&t.push(this._bridge.privateMenuItems().hideConversation),t.push({title:h($.t("Ignored Users")),action:function(t){this.showIgnoreList()}.bind(this)}),!this._bridge.standalone){for(var n,a=(!this._bridge.private_chat&&this._bridge._room in this.favoritesSettings),r=0;r<this._rooms.length;r++)if(this._rooms[r].room_id===this._bridge._room){n=this._rooms[r];break}if(n){t.push({separator:!0});var d=s.getLaunchInSeparateWindowAction(e._bridge._room,(function(){return!!e._bridge.private_chat}));this._bridge.private_chat?t.push(d):(n.pinned||t.push({title:a?$.t("Remove This Room from Favorites"):$.t("Add This Room to Favorites"),action:function(t){this._bridge.postMessage("toggle_favorite_room",t)}.bind(this,this._bridge._room)}),(t=t.concat(o.publicMenuItems(this._bridge._room,this._bridge,this))).push(d),n.pinned||((n.user_id===user.id||window.user.permissions.can_moderate_public_chats)&&t.push({title:h($.t("Edit Room")),action:function(t){this._bridge.postMessage("chat_edit_room",this._bridge._room)}.bind(this)}),window.user.permissions.can_moderate_public_chats&&t.push({title:$.t("Delete Room"),action:function(t){this._bridge.postMessage("chat_delete_room",this._bridge._room)}.bind(this)})))}}return t},l.prototype.update=function(){this._handler(this.getMenu(),!0)},l.prototype._radioIcon="data:image/gif;base64,R0lGODlhBgAGAMIGAIuMjo+QkpOUlrS1tra2uLe4uf///////yH5BAEKAAcALAAAAAAGAAYAAAMQeCVSRyACEiQIVYZhx2NOAgA7",l.prototype.soundMenuItems=function(t,e){return"boolean"==typeof e&&(e=$.extend(u.prototype._default_state,{onMessage:e})),t.map(function(t){var i=!0;for(var s in e)if((s in t.state||!e[s])&&t.state[s]!==e[s]){i=!1;break}return t.icon={image:"url("+this._radioIcon+")"},t.icon.offset=i?{x:5,y:5}:{x:-30,y:-30},t.action=function(e){this._bridge.postMessage("chat_set_sound_state",{isPrivate:!!this._bridge.private_chat,state:t.state})}.bind(this),t}.bind(this))},l.prototype.showIgnoreList=function(){var t="",e=400,i=$('<span class="tv-text__font--italic i-align_center"></span>').html($.t("You have no ignored users")+".").css("display","block");for(var o in user.ignore_list)t+='<div class="ch-ignore-list-item"><span>'+user.ignore_list[o]+'</span><a href="#" class="delete" data-id="'+o+'">'+$.t("Delete")+"</a></div>";t||(t=i,e=""),s({title:$.t("Ignored Users List"),content:t,actionsWrapTemplate:"",actions:"",height:e}).then((function(t){t.open();var e=t.$content;e.on("click",".delete",(function(t){var s=$(this).data("id");return delete user.ignore_list[s],window.crossTabSyncUserAttr("ignore_list"),$.post("/conversation-ignore/",{user_id:s,action:"remove"}),$(this).parent().remove(),Object.keys(user.ignore_list).length||e.html(i),!1}))}))},c.prototype.destroy=function(){r.off(this._eventKey,this._toggle.bind(this))},c.prototype._toggle=function(t){this._isOn="true"===t},c.prototype.onsiteMenuItem=function(){var t=TVSettings.getBool(this._settingsKey);return t=void 0!==t?t:this._isOn,{title:this._title,icon:{
image:"url('"+i("4AmR")+"')",offset:t?"0 -16px":void 0},action:function(e){this._isOn=!t,TradingView.profile&&TradingView.profile.$settings.find('input[name="notification_mention_in_chat_onsite"]').prop("checked",this._isOn),TVSettings.setValue(this._settingsKey,this._isOn,{forceFlush:!0})}.bind(this)}},c.prototype.emailMenuItem=function(){var t=TVSettings.getBool(this._emailKey);return t=void 0!==t?t:this._isOnEmail,{title:this._emailTitle,icon:{image:"url('"+i("4AmR")+"')",offset:t?"0 -16px":void 0},action:function(e){this._isOnEmail=!t,TradingView.profile&&"privatemessages.send_email_notifications"!==this._emailKey&&TradingView.profile.$settings.find('input[name="notification_mention_in_chat_email"]').prop("checked",this._isOnEmail),TVSettings.setValue(this._emailKey,this._isOnEmail,{forceFlush:!0})}.bind(this)}},u.prototype._default_state={onMessage:!1,onMessageForUser:!0},u.prototype._getState=function(t){var e=$.extend({},this._default_state),i=TVSettings.getJSON(this._settingsKey,null,t);return null!==i&&("boolean"==typeof i?$.extend(e,{onMessage:i}):$.extend(e,i)),e},u.prototype.set=function(t){this._set(t),TVSettings.setJSON(this._settingsKey,this.state),r.emit("chat-sound-control-changed")},u.prototype._setFromAnother=function(){this._set(this._getState(!0))},u.prototype._set=function(t){this.state=$.extend({},this._default_state,t)},u.prototype.destroy=function(){this._updateSettingsListener&&(r.off("chat-sound-control-changed",this._updateSettingsListener),loginStateChange.unsubscribe(null,this._updateSettingsListener))},p.prototype.appendInput=function(t){this._$searchInputWrap=$('<div class="msg-input-wrap js-hidden">').appendTo(t),this._$searchInput=$('<div class="msg-input">').appendTo(this._$searchInputWrap),this._$searchInputText=$('<input type="text" placeholder="'+$.t("Find existing chat")+'"></textarea>').appendTo(this._$searchInput),this._$searchInputReset=$('<a class="input-reset js-hidden">').appendTo(this._$searchInput);var e=this;this._$searchInputText.on("keydown",(function(t){if(13===t.which||38===t.which||40===t.which)return!1})).on("keyup",(function(t){var i=e._$searchInputText.val(),s=new RegExp(i.split("").map(a).join(".*"),"i");if(27===t.which)""===e._$searchInputText.val()&&(e.isOn=!1,e._$searchInputWrap.addClass("js-hidden"),e.parentWidget.resize(),e._$searchButton.removeClass("active"),e.newRoom?(e.parentWidget._scroll.animateTo(e.newRoom.position().top),delete e.newRoom):e.parentWidget._scroll.restore()),e._$searchInputText.val(""),e.showRooms(),e._$searchInputReset.addClass("js-hidden");else{if(e.hideRooms(),0===e._$searchInputText.val().length)return e._$searchInputReset.addClass("js-hidden"),void e.showRooms();e._$searchInputReset.removeClass("js-hidden"),e.parentWidget._scroll.scrollToStart(),e._$data.find(".title").each((function(){s.test($(this).text())&&e.canShowRoom($(this).parent())&&$(this).parent().removeClass("js-hidden")}))}})),this._$searchInputReset.on("click",(function(t){e._$searchInputText.val(""),e._$searchInputReset.addClass("js-hidden"),e.showRooms(),
e._$searchInputText.focus()}))},p.prototype.appendButton=function(t){var e=this;this._$searchButton=$('<a class="button apply-common-tooltip" title="'+$.t("Find existing chat")+'" data-role="button" data-name="search">').append($(i("gCS/")).attr({width:17,height:17})).appendTo(t),this._$searchButton.on("click",(function(t){e.isOn?(e.isOn=!1,e._$searchButton.removeClass("active"),e._$searchInputWrap.addClass("js-hidden"),e._$searchInputText.val(""),e._$searchInputReset.addClass("js-hidden"),e.showRooms(),e.parentWidget.resize(),e.newRoom?(e.parentWidget._scroll.animateTo(e.newRoom.position().top),e.newRoom=""):e.parentWidget._scroll.restore()):(e.isOn=!0,e._$searchButton.addClass("active"),e.parentWidget._scroll.save(),e._$searchInputWrap.removeClass("js-hidden"),e.parentWidget.resize(),e._$searchInputText.focus(),e._onOpenCallback&&e._onOpenCallback())}))},p.prototype.setRoomList=function(t){this._$data=t},p.prototype.setOpenCallback=function(t){this._onOpenCallback=t},p.prototype.hideRooms=function(){this._$data.children().addClass("js-hidden")},p.prototype.showRooms=function(){var t=this;this._$data.children().each((function(){t.canShowRoom($(this))&&$(this).removeClass("js-hidden")}))},p.prototype.canShowRoom=function(t){return!t.data("hidden-conversation")},p.prototype.getButton=function(){return this._$searchButton},p.prototype.hideInput=function(){this._$searchButton.removeClass("active"),this._$searchInputWrap.addClass("js-hidden"),this._$searchInputText.val(""),this._$searchInputReset.removeClass("js-hidden"),this.showRooms(),this.parentWidget.resize()},p.prototype.getInputHeight=function(){return this._$searchInputWrap.hasClass("js-hidden")?0:this._$searchInputWrap.outerHeight()},p.prototype.isOpen=function(){return this.isOn},p.prototype.setNewRoom=function(t){this.newRoom=t},m._likesMonitoringModel=null,m._createLikesMonitoringModelIfNeeded=function(){null===m._likesMonitoringModel&&(m._likesMonitoringModel=n.makePublicModel())},m.getChartsHandler=function(){m._createLikesMonitoringModelIfNeeded();var t=m._likesMonitoringModel;return new m(t.voteForChart.bind(t))},m.getMessagesSnapshotsHandler=function(){m._createLikesMonitoringModelIfNeeded();var t=m._likesMonitoringModel;return new m(t.voteForMessageWithSnapshot.bind(t))},m.prototype.getIdeaByID=function(t,e){for(var i=0;i<this.ideas.length;i++)if(this.ideas[i].id===t)return e?i:this.ideas[i];return!1},m.prototype.addIdea=function(t,e,i,s,o){var n=this.getIdeaByID(e);n?n.elements.push(t):(n=new m.Idea(e,i,s,t,o),this.ideas.push(n)),$(t).on("click",this.onClickUpdateVote.bind(this,n)),n.updateView()},m.prototype.onClickUpdateVote=function(t){if(window.user.id){var e=this;o({showDialog:!0,source:"Widgetbar vote"}).done((function(){if(!(t.blocked||t.voteStatus<0)){t.blocked=!0;var i=1-t.voteStatus;e.voteSender(t,i,(function(s){e.onData(t,i,s.score)}))}}))}else runOrSignIn(function(){this.voteSender(t,1)}.bind(this),{source:"Widgetbar vote",verifiedPhoneRequired:!0})},m.prototype.onData=function(t,e,i){t.likes=i,t.voteStatus>=0&&(t.voteStatus=e,
t.blocked=!1),t.updateView(!1)},m.prototype.destroy=function(){},m.Idea=function(t,e,i,s){this.id=t,this.likes=e,this.voteStatus=i,this.elements=[s]},m.Idea.prototype.updateView=function(t){var e=$(this.elements);e.toggleClass("js-has-likes",!!this.likes),setTimeout(function(){e.find(".js-likes-counter").text(this.likes?this.likes:"")}.bind(this),75),e.toggleClass("active",!!this.voteStatus),t&&(e.removeClass("js-like-highlight"),setTimeout((function(){e.addClass("js-like-highlight")}),10))},e.ChatProgressBar=d,e.ChatSettingsDialog=l,e.ChatNotificationControl=c,e.ChatSoundControl=u,e.ChatRoomListSearchFilter=p,e.ChatLikesHandler=m},OyD6:function(t,e,i){"use strict";i.r(e),i.d(e,"convertToBadgeAccountProps",(function(){return r}));i("HbRj");var s=i("YFKU"),o=i("C1zv"),n=i("FfBj"),a=Object(s.t)("Moderator");function r(t){var e,i,s,r;if(Array.isArray(t.badges))return t.badges;var h=[];return t.top_user_info&&t.top_user_info.badge&&(t.top_user_info.title=t.top_user_info.badge.title),t.is_featured&&h.push({name:o.a.BrokerExtraFeatured,verbose_name:""}),t.broker_plan&&h.push({name:"broker:"+t.broker_plan,verbose_name:""}),t.top_user_info&&!t.hide_top_badge&&h.push({name:"top:"+(null===(e=null==t?void 0:t.top_user_info)||void 0===e?void 0:e.period),verbose_name:(null===(i=null==t?void 0:t.top_user_info)||void 0===i?void 0:i.title)||(null===(r=null===(s=null==t?void 0:t.top_user_info)||void 0===s?void 0:s.badge)||void 0===r?void 0:r.title)}),t.is_moderator&&!t.hide_mod_badge&&h.push({name:"moderator",verbose_name:a}),t.is_pro&&t.pro_plan&&h.push({name:"pro:"+t.pro_plan,verbose_name:Object(n.getPlanName)(t.pro_plan)}),h}},RsxI:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 16"><path d="M15.09 6.857s-.571 0-.724-.533c-.114-.457-.305-.876-.533-1.295-.229-.495.152-.876.152-.876l.571-.571c.229-.229.229-.61 0-.876l-.762-.762c-.229-.229-.61-.229-.876 0l-.571.571s-.381.381-.876.152c-.419-.229-.838-.419-1.295-.533-.533-.152-.533-.724-.533-.724v-.8a.602.602 0 0 0-.61-.61H7.966a.602.602 0 0 0-.61.61v.8s0 .571-.533.724c-.457.114-.876.305-1.295.533-.495.229-.876-.152-.876-.152l-.571-.571c-.229-.229-.61-.229-.876 0l-.762.762c-.229.229-.229.61 0 .876l.571.571s.381.381.152.876c-.229.419-.419.838-.533 1.295-.152.495-.724.533-.724.533h-.8a.602.602 0 0 0-.61.61v1.067c0 .343.267.61.61.61h.8s.571 0 .724.533c.114.457.305.876.533 1.295.229.495-.152.876-.152.876l-.571.571c-.229.229-.229.61 0 .876l.762.762c.229.229.61.229.876 0l.571-.571s.381-.381.876-.152c.419.229.838.419 1.295.533.495.152.533.724.533.724v.8c0 .343.267.61.61.61h1.067c.343 0 .61-.267.61-.61v-.8s0-.571.533-.724c.457-.114.876-.305 1.295-.533.495-.229.876.152.876.152l.571.571c.229.229.61.229.876 0l.762-.762c.229-.229.229-.61 0-.876l-.571-.571s-.381-.381-.152-.876c.229-.419.419-.838.533-1.295.152-.495.724-.533.724-.533h.8c.343 0 .61-.267.61-.61V7.467a.602.602 0 0 0-.61-.61h-.8zM8.5 11.555a3.541 3.541 0 0 1-3.556-3.556A3.541 3.541 0 0 1 8.5 4.443a3.541 3.541 0 0 1 3.556 3.556A3.561 3.561 0 0 1 8.5 11.555z"/></svg>'},SmzL:function(t,e){
t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 5" width="9" height="5"><path fill="currentColor" d="M0 0h9L4.5 5z"/></svg>'},UxRG:function(t,e,i){},VPmY:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i("BHQF");var o=!1,n={data:{},ready:null};e.default=function t(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),window.is_authenticated?!1===o&&(o=!0,n.ready=(0,s.fetch)("/notifications-data/?widget_type=user",{credentials:"same-origin"}).then((function(t){t.json().then((function(t){n.data=t.settings}))}))):(o=!1,n.ready=Promise.resolve()),n},t.exports=e.default},Wz41:function(t,e,i){"use strict";i.r(e);var s=i("mrSG"),o=i("aIyQ"),n=i.n(o),a=i("0UyP"),r=i("TxTq"),h=i.n(r),d=i("P5fv"),l=i.n(d),c=i("nmNo"),u=function(){function t(t){this._statInterval="",this._statSymbol="",this._historyRequest=null,this._room="",this._isActive=!0,this._messageReceivedDelegate=new n.a,this._messageDeletedDelegate=new n.a,this._messageReceivedInOtherRoomDelegate=new n.a,this._messageDeletedInOtherRoomDelegate=new n.a,this._unknownEventDelegate=new n.a,this._pendingMessages={},this._newRoomInfoRequests={},this._onRoomDataHandler=this._pushStreamRoomDataHandler.bind(this),this._chatRooms=t,this._getChatRooms().startListenPushstream(),this._getChatRooms().roomsChanged().subscribe(this,this._flushPendingMessages),this._getChatRooms().otherEventReceived().subscribe(this,this._onOtherRoomEventReceived)}return t.prototype.destroy=function(){this.setRoom(""),this._getChatRooms().roomsChanged().unsubscribe(this,this._flushPendingMessages),this._getChatRooms().otherEventReceived().unsubscribe(this,this._onOtherRoomEventReceived),this._getChatRooms().stopListenPushstream(),this._historyRequest&&this._historyRequest.abort()},t.prototype.roomAdded=function(){return this._getChatRooms().roomAdded()},t.prototype.roomChanged=function(){return this._getChatRooms().roomChanged()},t.prototype.roomDeleted=function(){return this._getChatRooms().roomDeleted()},t.prototype.roomsChanged=function(){return this._getChatRooms().roomsChanged()},t.prototype.messageReceived=function(){return this._messageReceivedDelegate},t.prototype.messageDeleted=function(){return this._messageDeletedDelegate},t.prototype.messageReceivedInOtherRoom=function(){return this._messageReceivedInOtherRoomDelegate},t.prototype.messageDeletedInOtherRoom=function(){return this._messageDeletedInOtherRoomDelegate},t.prototype.otherEventReceived=function(){return this._unknownEventDelegate},t.prototype.createRoom=function(t,e,i,s){this._getChatRooms().createRoom(t,e,i,s)},t.prototype.editRoom=function(t,e,i,s){return this._getChatRooms().editRoom(t,e,i,s)},t.prototype.getRooms=function(){return this._getChatRooms().rooms()},t.prototype.getRoomById=function(t){return this._getChatRooms().getRoomById(t)},t.prototype.getRoomInfo=function(t,e,i,s){return this._getChatRooms().getRoomInfo(t,e,i,s)},t.prototype.setActive=function(t){this._isActive=t},t.prototype.isActive=function(){
return this._isActive},t.prototype.room=function(){return this._room},t.prototype.isHistoryLoading=function(){return null!==this._historyRequest},t.prototype.setStatSymbol=function(t){this._statSymbol=t},t.prototype.setStatInterval=function(t){this._statInterval=t},t.prototype.loadHistory=function(t,e){this._loadHistoryInternal(t,e)},t.prototype.setRoom=function(t,e){var i=this;this._room!==t&&(this._historyRequest&&(this._historyRequest.abort(),this._historyRequest=null),this._room&&h.a.off(this._getChannel(),this._onRoomDataHandler),this._room=t,this._room&&(this._historyRequest=this._loadHistoryInternal(0,(function(t,s,o){e&&e(t,s,o),h.a.on(i._getChannel(),i._onRoomDataHandler)})),this._historyRequest.always((function(){i._historyRequest=null}))))},t.prototype.getBanStatus=function(t,e){window.user.is_moderator&&window.user.id!==t.user_id&&!t.is_moderator?l.a.get("/ban-status/",{user_id:t.user_id},(function(t){e(!0,!t.error)})):e(!1)},t.prototype.ignoredUsers=function(){return window.user.ignore_list},t.prototype.ignoreUser=function(t,e,i,s){var o={action:e?"add":"remove",user_id:t.user_id,username:t.username};l.a.post("/conversation-ignore/",o,(function(s){s.error||(e?window.user.ignore_list[t.user_id]=t.username:delete window.user.ignore_list[t.user_id],window.crossTabSyncUserAttr&&window.crossTabSyncUserAttr("ignore_list")),i&&i(s)})).fail(s)},t.prototype.sendMessageToRoom=function(t,e,i,s,o,n){if((i=i||{}).interval=this._statInterval,!(e=e.trim())&&!i.text)return!1;var r=window.TradingView.onChartPage?this._statSymbol:"",h={meta:JSON.stringify(i),room_id:t,symbol:r,text:e};s&&s.messageType&&(h.type=s.messageType,s.warningType&&(i.warning_type=s.warningType)),this._extendCommonRequestData(h),l.a.post("/conversation-post/",h).done(o).fail(n);var d="1"===h.is_private;return Object(a.getTracker)().then((function(e){null!==e&&e.trackChat(t,!1,d,window.locale)})),!0},t.prototype.sendMessage=function(t,e,i,s,o){return""!==this._room&&this.sendMessageToRoom(this._room,t,e,i,s,o)},t.prototype.reportMessage=function(t){new c.ReportSendingAgent({entityText:t.text,entityType:"message",entityURL:t.id.replace(/-/g,""),username:t.username},this._reportMessageOptions()).send()},t.prototype.deleteMessage=function(t,e,i){l.a.post("/conversation-delete/",{ids:t}).done(e).fail(i)},t.prototype._getChatRooms=function(){return this._chatRooms},t.prototype._reportMessageOptions=function(){return{}},t.prototype._pushStreamRoomDataHandler=function(t,e,i,s){switch(t.action){case"message":this._messageReceivedDelegate.fire(t.data,t.data.room_id,s);break;case"message-delete":this._messageDeletedDelegate.fire(t.data,t.data.room_id,s);break;default:throw new Error("AbstractChatModel._pushStreamRoomDataHandler: unknown action "+t.action)}},t.prototype._onOtherRoomEventReceived=function(t,e,i,s){var o=this,n=t.data.room_id
;n!==this.room()&&("message"===t.action||"message-delete"===t.action?this.getRoomById(n)?"message"===t.action?this._messageReceivedInOtherRoomDelegate.fire(t.data,n,s):this._messageDeletedInOtherRoomDelegate.fire(t.data,n,s):(this._pendingMessages[n]=this._pendingMessages[n]||[],this._pendingMessages[n].push({external:s,message:t}),this._newRoomInfoRequests[n]||(this._newRoomInfoRequests[n]=!0,this._getChatRooms().getRoomInfo(n,(function(){delete o._newRoomInfoRequests[n],o._flushPendingMessages()}),(function(){delete o._newRoomInfoRequests[n],o._getChatRooms().updateRooms()})))):this._unknownEventDelegate.fire(t,e,i,s))},t.prototype._flushPendingMessages=function(){var t=this;Object.keys(this._pendingMessages).forEach((function(e){var i;t._pendingMessages[e]&&t.getRoomById(e)&&(i=e===t.room()?{message:t._messageReceivedDelegate,"message-delete":t._messageDeletedDelegate}:{message:t._messageReceivedInOtherRoomDelegate,"message-delete":t._messageDeletedInOtherRoomDelegate},t._pendingMessages[e].forEach((function(t){i[t.message.action].fire(t.message.data,e,t.external)})),delete t._pendingMessages[e])}))},t.prototype._loadHistoryInternal=function(t,e){var i={_rand:Math.random(),offset:t,room_id:this._room,stat_interval:this._statInterval,stat_symbol:this._statSymbol};return this._extendCommonRequestData(i),l.a.get("/conversation-status/",i,(function(t){e&&e(t,0===t.messages.length,!1)}))},t}(),p=i("txPx"),m=Object(p.getLogger)("Chat.PrivateChatModel"),g=function(t){function e(e){var i=t.call(this,e)||this;return i._roomMessagesReadDelegate=new n.a,i._otherRoomMessagesReadDelegate=new n.a,i}return Object(s.c)(e,t),e.prototype.roomMessagesRead=function(){return this._roomMessagesReadDelegate},e.prototype.otherRoomMessagesRead=function(){return this._otherRoomMessagesReadDelegate},e.prototype.setMessagesRead=function(){this._updateRoomLastVisitedTime()},e.prototype.loadHistory=function(e,i){var s=this;t.prototype.loadHistory.call(this,e,(function(t,e,o){s.setMessagesRead(),i&&i(t,e,o)}))},e.prototype.loadMoreRooms=function(t){return this._getChatRooms().loadMoreRooms(t)},e.prototype.leaveFromRoom=function(t,e){return this._getChatRooms().leaveFromRoom(t,e)},e.prototype.updateRoomUsers=function(t,e,i,s){return this._getChatRooms().updateRoomUsers(t,e,i,s)},e.prototype.updateRoomInfo=function(t,e){this._getChatRooms().getRoomInfo(t,e,void 0,!0)},e.prototype.hiddenRooms=function(){return this._getChatRooms().hiddenRooms()},e.prototype.addHiddenRoom=function(t){this._getChatRooms().addHiddenRoom(t),this._updateRoomLastVisitedTime(t)},e.prototype.removeHiddenRoom=function(t){this._getChatRooms().removeHiddenRoom(t)},e.prototype.isRoomHidden=function(t){return this._getChatRooms().isRoomHidden(t)},e.prototype.searchUsers=function(t,e){d.get("/username_hint/",{s:t},e)},e.prototype._extendCommonRequestData=function(t){t.is_private="1"},e.prototype._getChannel=function(){return this.room()},e.prototype._pushStreamRoomDataHandler=function(e,i,s,o){switch(e.action){case"message":this.setMessagesRead();break;case"messages-read":
var n=this.getRoomById(e.data.room_id);return void(n?this._roomMessagesReadDelegate.fire(n):m.logError("Received messages-read event for unknown room "+e.data.room_id))}t.prototype._pushStreamRoomDataHandler.call(this,e,i,s,o)},e.prototype._onOtherRoomEventReceived=function(e,i,s,o){var n=e.data.room_id;if(n!==this.room())if("messages-read"!==e.action)t.prototype._onOtherRoomEventReceived.call(this,e,i,s,o);else{var a=this.getRoomById(n);a&&this._otherRoomMessagesReadDelegate.fire(a)}},e.prototype._updateRoomLastVisitedTime=function(t){(t&&t!==this.room()||this.isActive())&&(t=t||this.room(),d.post("/chats/status/",{room_id:t}))},e}(u),_=(i("YFKU"),i("BHQF")),f=function(t){function e(e,i){void 0===i&&(i=!0);var s=t.call(this,e)||this;return s._activeReconnect=!0,s._activeReconnect=i,s}return Object(s.c)(e,t),e.prototype.deleteRoom=function(t,e){return this._getChatRooms().deleteRoom(t,e)},e.prototype.voteForChart=function(t,e,i){return Object(s.b)(this,void 0,void 0,(function(){return Object(s.d)(this,(function(s){return Object(_.fetch)("/api/v1/ideas/"+t.id+"/like/",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:e?1:0})}).then((function(t){return t.json()})).then(i),[2]}))}))},e.prototype.voteForMessageWithSnapshot=function(t,e,i){d.post("/conversation-vote/",{id:t.id,vote:e?1:0},i)},e.prototype.favoriteRooms=function(){return this._getChatRooms().favoriteRooms()},e.prototype.isRoomFavorite=function(t){return this._getChatRooms().isRoomFavorite(t)},e.prototype.addFavoriteRoom=function(t){this._getChatRooms().addFavoriteRoom(t)},e.prototype.removeFavoriteRoom=function(t){this._getChatRooms().removeFavoriteRoom(t)},e.prototype.isShownOnlyFavorites=function(){return this._getChatRooms().isShownOnlyFavorites()},e.prototype.toggleShownOnlyFavorites=function(){this._getChatRooms().toggleShownOnlyFavorites()},e.prototype._reportMessageOptions=function(){var t=this.getRoomById(this.room());return t?{additionalText:d.t("Posted in {0}").format(t.title)}:{}},e.prototype._extendCommonRequestData=function(t){t.is_private=""},e.prototype._getChannel=function(){return"chat_"+this.room()},e}(u),v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(s.c)(e,t),e.prototype.setActive=function(e){t.prototype.setActive.call(this,e),e?h.a.addChannel("chat"):this._activeReconnect&&h.a.removeChannel("chat")},e}(f),b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(s.c)(e,t),e.prototype.setActive=function(e){t.prototype.setActive.call(this,e);var i=this.getRooms()[0].room_id;e?h.a.addChannel(i):this._activeReconnect&&h.a.removeChannel(i)},e}(f),w=function(){function t(t){var e=this;this._roomAddedDelegate=new n.a,this._roomChangedDelegate=new n.a,this._roomDeletedDelegate=new n.a,this._roomsChangedDelegate=new n.a,this._otherEventReceivedDelegate=new n.a,this._subscribersCount=0,this._rooms=t||[],setTimeout((function(){0===e._rooms.length&&e.updateRooms()}),0)}return t.prototype.getRoomInfo=function(t,e,i,s){
var o=this.getRoomById(t);e&&o&&e(o)},t.prototype.startListenPushstream=function(){++this._subscribersCount,1===this._subscribersCount&&(this._multiplexerCallback=this._pushStreamBroadcastHandler.bind(this),h.a.on(this._multiplexerEvent(),this._multiplexerCallback))},t.prototype.stopListenPushstream=function(){--this._subscribersCount,0===this._subscribersCount&&h.a.off(this._multiplexerEvent(),this._multiplexerCallback)},t.prototype.rooms=function(){return this._rooms},t.prototype.getRoomById=function(t){var e=this._getRoomIndex(t);return-1===e?null:this._rooms[e]},t.prototype.roomAdded=function(){return this._roomAddedDelegate},t.prototype.roomChanged=function(){return this._roomChangedDelegate},t.prototype.roomDeleted=function(){return this._roomDeletedDelegate},t.prototype.roomsChanged=function(){return this._roomsChangedDelegate},t.prototype.otherEventReceived=function(){return this._otherEventReceivedDelegate},t.prototype._onRoomAdded=function(t){t&&(this._rooms.push(t),this._roomAddedDelegate.fire(t))},t.prototype._onRoomChanged=function(t){if(t){var e=this._getRoomIndex(t.room_id);-1!==e&&(this._rooms[e]=t,this._roomChangedDelegate.fire(t))}},t.prototype._onRoomDeleted=function(t){if(t){var e=this._getRoomIndex(t.room_id);-1!==e&&(this._rooms.splice(e,1),this._roomDeletedDelegate.fire(t))}},t.prototype._onRoomsChanged=function(t){var e=this._rooms;this._rooms=t,this._roomsChangedDelegate.fire(t,e)},t.prototype._pushStreamBroadcastHandler=function(t,e,i,s){this._otherEventReceivedDelegate.fire(t,e,i,s)},t.prototype._getRoomIndex=function(t){for(var e=this._rooms.length-1;e>=0;--e)if(this._rooms[e].room_id===t)return e;return-1},t}(),y=i("Vdly"),C=Object(p.getLogger)("Chat.PrivateChatRooms"),$=function(t){function e(e){void 0===e&&(e=!0);var i=t.call(this,null)||this;return i._updateRoomRequest=null,i._withPagination=!0,i._withPagination=e,window.loginStateChange.subscribe(i,i._onLoginStateChanged),i._onLoginStateChanged(),i}return Object(s.c)(e,t),e.prototype.updateRooms=function(t){var e=this;if(void 0===t&&(t=30),!this._updateRoomRequest){this._withPagination||(t=0);var i=window;i.user&&i.is_authenticated?(this._updateRoomRequest=d.get("/chats/get/",{limit:t},this._onRoomsChanged.bind(this)),this._updateRoomRequest.always((function(){e._updateRoomRequest=null}))):this._onRoomsChanged([])}},e.prototype.loadMoreRooms=function(t){void 0===t&&(t=30),this.updateRooms(this.rooms().length+t)},e.prototype.createRoom=function(t,e,i,s){var o=this;d.post("/chats/create/",{members:i},(function(t){t.error||t.room.existing||o._onRoomAdded(t.room),s&&s(t),Object(a.getTracker)().then((function(e){null!==e&&e.trackChat(t.room.room_id,!0,!0,window.locale)}))}))},e.prototype.editRoom=function(t,e,i,s){var o=this,n=this.getRoomById(t);if(!n)return!1;var a={room_id:t,room_title:e};return d.post("/chats/title/",a,(function(t){t.error||(n.title=e,o._onRoomChanged(n)),s&&s(t)})),!0},e.prototype.getRoomInfo=function(t,e,i,s){var o=this,n=this.getRoomById(t);!n||s?d.get("/chats/info/",{room_id:t},(function(n){if(n.error)i&&i();else{
var a=o.getRoomById(t);s&&a?o._onRoomChanged(n.room):a||o._onRoomAdded(n.room),e&&e(n.room)}})).fail(i):e&&e(n)},e.prototype.leaveFromRoom=function(t,e){var i=this;return!!this.getRoomById(t)&&(d.post("/chats/leave/",{room_id:t},(function(s){if(!s.error){var o=i.getRoomById(t);o?i._onRoomDeleted(o):C.logError("We are already left the room "+t)}e&&e(s)})),!0)},e.prototype.updateRoomUsers=function(t,e,i,s){var o=this;if(!this.getRoomById(t))return!1;var n={members:e,room_id:t,update_existing:null==s?void 0:s.updateExistingRoom};return d.post("/chats/update/",n,(function(e){var s=o.getRoomById(t);s&&(e.room&&e.room.members_info&&e.room.room_id===s.room_id&&(s.members_info=e.room.members_info),o._onRoomChanged(s)),i&&i(e)})),!0},e.prototype.hiddenRooms=function(){return this._hiddenRooms},e.prototype.addHiddenRoom=function(t){this.isRoomHidden(t)||(this._hiddenRooms.push(t),this._flushHiddenRooms())},e.prototype.removeHiddenRoom=function(t){if(this.isRoomHidden(t)){var e=this._hiddenRooms.indexOf(t);this._hiddenRooms.splice(e,1),this._flushHiddenRooms()}},e.prototype.isRoomHidden=function(t){return-1!==this._hiddenRooms.indexOf(t)},e.prototype._multiplexerEvent=function(){return"pm_*"},e.prototype._pushStreamBroadcastHandler=function(e,i,s,o){var n=e.data.type;if("join"===n||"leave"===n){if("leave"===n&&window.user.id===e.data.user_id)return;this.getRoomInfo(e.data.room_id,void 0,void 0,!0)}t.prototype._pushStreamBroadcastHandler.call(this,e,i,s,o)},e.prototype._flushHiddenRooms=function(){Object(y.setJSON)("privatemessages.hiddenrooms",this._hiddenRooms,{forceFlush:!0})},e.prototype._onLoginStateChanged=function(){this._hiddenRooms=Object(y.getJSON)("privatemessages.hiddenrooms",[]),this.updateRooms()},e}(w);function R(t){return"en"!==window.language&&(t=t+"."+window.locale),t}var M=function(t){function e(e){var i=t.call(this,e)||this;return i._favoriteRooms=Object(y.getJSON)(R("publiccharts.favorites"),{}),i._showOnlyFavorites=!!Object(y.getBool)("chat.show_only_favorites"),i}return Object(s.c)(e,t),e.prototype.updateRooms=function(){d.get("/chats/public/get/",this._onRoomsChanged.bind(this))},e.prototype.createRoom=function(t,e,i,s){var o={desc:e,title:t};d.post("/chats/public/create/",o,(function(t){t.error||d.post("/chats/public/createpingback/",{room_id:t.room.room_id}),s&&s(t),Object(a.getTracker)().then((function(e){null!==e&&e.trackChat(t.room.room_id,!0,!1,window.locale)}))}))},e.prototype.editRoom=function(t,e,i,s){if(!this.getRoomById(t))return!1;var o={desc:i,room_id:t,title:e};return d.post("/chats/public/edit/",o,s),!0},e.prototype.deleteRoom=function(t,e){return!!this.getRoomById(t)&&(d.post("/chats/public/delete/",{room_id:t},e),!0)},e.prototype.favoriteRooms=function(){return Object.keys(this._favoriteRooms)},e.prototype.isRoomFavorite=function(t){return t in this._favoriteRooms},e.prototype.addFavoriteRoom=function(t){this._favoriteRooms[t]=!0,this._saveFavorires()},e.prototype.removeFavoriteRoom=function(t){delete this._favoriteRooms[t],this._saveFavorires()},
e.prototype.isShownOnlyFavorites=function(){return this._showOnlyFavorites},e.prototype.toggleShownOnlyFavorites=function(){this._showOnlyFavorites=!this._showOnlyFavorites,Object(y.setValue)("chat.show_only_favorites",this._showOnlyFavorites)},e.prototype._multiplexerEvent=function(){return"chat_*"},e.prototype._pushStreamBroadcastHandler=function(e,i,s,o){if("create_room"!==e.data.type||e.data.meta.lang!==window.locale){var n=this.getRoomById(e.data.room_id);if(n)switch(n.last_message_time=Date.now(),e.data.type){case"edit_room":return n.title=e.data.meta.room_title,n.description=e.data.meta.room_desc,void this._onRoomChanged(n);case"delete_room":return void this._onRoomDeleted(n)}t.prototype._pushStreamBroadcastHandler.call(this,e,i,s,o)}else this._onRoomAdded(e.data.meta.room)},e.prototype._saveFavorires=function(){Object(y.setJSON)(R("publiccharts.favorites"),this._favoriteRooms)},e}(w);i.d(e,"makePrivateModel",(function(){return I})),i.d(e,"makePublicModel",(function(){return B})),i.d(e,"setPublicInitialRooms",(function(){return E})),i.d(e,"makeLiveSeparateModel",(function(){return D}));var S=Object(p.getLogger)("Chat.ChatModelsFactory"),T=null,x=null,k=null;function I(t){if(void 0===t&&(t=!0),function(t){void 0===t&&(t=!0),x||(x=new $(t))}(t),!x)throw new Error("Unable to create private chat model");return new g(x)}function B(t){if(void 0===t&&(t=!0),k||(k=new M(T)),!k)throw new Error("Unable to create public chat model");return new v(k,t)}function E(t){k?S.logError("Trying set initial rooms after creating"):T=t}function D(t){var e=new M(t);return new b(e)}},XJ8t:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return!/(?:[\u0370-\u1FFF\u2E80-\uD7FF\uE000-\uFDFF\uFE20-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g.test(t)},t.exports=e.default},XhdI:function(t,e,i){"use strict";i.r(e),i.d(e,"trackChatEvent",(function(){return c}));var s=i("JWMC"),o=i("PHun"),n=/((https?:\/\/)|(www\.))(-\.)?([^\s/?.#]+\.)+([^\s<>]*)?/g,a=/^(https?:\/\/).*tradingview.com/,r=/tradingview.com\/(chart|script)\//,h=/(image|i)\/([0-9a-zA-Z]{8})\/$/,d=/x\/([0-9a-zA-Z]{8})\/(.+?)?\/?$/,l=/^pm_.{16}/;function c(t,e,i){var c=l.test(t.room_id),u=c?"pm":"public chat",p=function(t){var e=[];return o.emoji.each((function(i){t.search(i.re)>=0&&e.push(i.code)})),e}(e),m=p.length>0,g=function(t){var e={snapshot:0,chart:0,internal:0,external:0},i=t.match(n);return null!==i&&i.forEach((function(t){a.test(t)?d.test(t)||h.test(t)?e.snapshot++:r.test(t)?e.chart++:e.internal++:e.external++})),e}(e);e&&c?Object(s.trackEvent)("Chat","Send message to "+u):e&&!c&&Object(s.trackEvent)("Chat","Send message to "+u,String(t.title)),(i&&"snapshot"===i.type||g.snapshot>0)&&Object(s.trackEvent)("Chat","Send chart snapshot",u),g.chart>0&&Object(s.trackEvent)("Chat","Send chart link",u),g.internal>0&&Object(s.trackEvent)("Chat","Send internal link",u),g.external>0&&Object(s.trackEvent)("Chat","Send external link",u),m&&p.forEach((function(t){
Object(s.trackEvent)("Chat","Send emoji",t)}))}},YDhE:function(t,e,i){"use strict";i.r(e),i.d(e,"createDialog",(function(){return n}));var s=i("6aJD"),o=i("tKRU");function n(t){var e=t.type||"popup";return delete t.type,"modal"===e?new s.TVModal(t):new o.TVPopup(t)}},ZLE0:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 18" width="8" height="18"><path d="M3 8V4H-.5L4-.5 8.5 4H5v4zM3 10h2v4h3.5L4 18.5-.5 14H3z"/></svg>'},bxEH:function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.showDialog=function(e,i,o,n){var a=(0,s.createDialog)({type:"modal",width:500,title:e?$.t("Edit chat room"):$.t("Create New Public Chat"),
content:t.render('\n\n\t\t\t\t<div class="tv-control-fieldset js-room-title-wrap">\n\t\t\t\t\t<label class="tv-control-fieldset__label tv-control-fieldset__label--color_dark tv-control-fieldset__label--width_small">\n\t\t\t\t\t\t'+$.t("Room title")+'*:\n\t\t\t\t\t</label>\n\t\t\t\t\t<span class="tv-control-fieldset__value tv-control-fieldset__value--width_big">\n\t\t\t\t\t\t<input name="room-title" type="text" value="'+(e?TradingView.clean(e.title):"")+'" class="tv-control-fieldset__value-control tv-control-input" required>\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t\t<div class="tv-control-fieldset js-room-purpose-wrap">\n\t\t\t\t\t<label class="tv-control-fieldset__label tv-control-fieldset__label--color_dark tv-control-fieldset__label--width_small">\n\t\t\t\t\t\t'+$.t("Room purpose")+'*:\n\t\t\t\t\t</label>\n\t\t\t\t\t<span class="tv-control-fieldset__value tv-control-fieldset__value--width_big">\n\t\t\t\t\t\t<textarea name="room-desc" type="text" class="tv-control-fieldset__value-control tv-control-textarea" required>'+(e?TradingView.clean(e.description):"")+'</textarea>\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t\t<div class="tv-control-fieldset tv-control-fieldset__hint" style="text-align: justify;">\n\t\t\t\t\t<p class="tv-control-fieldset__text">\n\t\t\t\t\t\t'+$.t("IMPORTANT: You are about to create a chat that will be visible to all users. Before you continue, please note these 5 requirements to avoid your chat getting deleted and -in severe cases- you getting banned:")+'\n\t\t\t\t\t</p>\n\t\t\t\t\t<ol class="tv-list tv-list--font-popup tv-list--numeric">\n\t\t\t\t\t\t<li>'+$.t("Provide a clear Search the existing chats and make sure you are not creating a duplicate")+"</li>\n\t\t\t\t\t\t<li>"+$.t("Title and Purpose that makes sense and is related to trading")+"</li>\n\t\t\t\t\t\t<li>"+$.t("Avoid contentious or offensive language when describing your chat")+"</li>\n\t\t\t\t\t\t<li>"+$.t("Use the correct language for the chat, it should align with the language version of TradingView")+"</li>\n\t\t\t\t\t\t<li>"+$.t("Chats should attract at least 5 users and 1 daily message continuously")+'</li>\n\t\t\t\t\t</ol>\n\t\t\t\t\t<p class="tv-control-fieldset__text">\n\t\t\t\t\t\t'+$.t("These are the minimal requirements for viable chats. For tips on how to create truly awesome ones, please read {link_start}this article{link_end} carefully.").format({link_start:'<a href="http://blog.tradingview.com/?p=2113" target="_blank">',link_end:"</a> "})+"\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t"),destroyOnClose:!0,actions:[{name:"ok",type:"success",text:$.t("Ok"),key:13},{name:"cancel",type:"default",text:$.t("Cancel"),method:"close"}]}).on("action:ok",(function(t){var s=function(e){e.error?t.$content.find('[name="'+e.input_name+'"]').tvControlError("add",{id:e.id,message:e.error}).tvControlError("render"):(t.close(),n(e))},a=r.val(),d=h.val(),l=!1;a.length||(r.tvControlError("add",{id:"room-title",message:$.t("Room title is required")}).tvControlError("render"),l=!0),d.length||(h.tvControlError("add",{id:"room-desc",
message:$.t("Room purpose is required")}).tvControlError("render"),l=!0),l||(e?o(e.room_id,a,d,s):i(a,d,null,s))})).open(),r=a.$content.find('[name="room-title"]'),h=a.$content.find('[name="room-desc"]');r.tvControlError(),h.tvControlError(),r.on("input",(function(){return r.tvControlError("remove",{id:"room-title"}).tvControlError("render")})),h.on("input",(function(){return h.tvControlError("remove",{id:"room-desc"}).tvControlError("render")}))};var s=i("YDhE");i("Uupk"),i("UxRG"),i("Q+5U"),i("+WOZ")}).call(this,i("nbsC"))},debi:function(t,e,i){"use strict";i("TdlR");var s=i("eF4M"),o=i("OqB+"),n=i("7KDR").Action,a=i("5VQP").ContextMenuManager,r=i("hp/T"),h=i("PQvG"),d=i("sFgq").SidebarCustomScroll,l=i("bR4N").bindPopupMenu,c=i("Wz41"),u=i("bxEH").showDialog,p=i("VPmY"),m=i("qjxE"),g=i("vBL9"),_=i("2uTr").appendEllipsis,f=i("NP3r").enabled,v=i("bKsZ").ProductFeatures,b=i("oOPW").createGoProDialog;function w(t){this._bridge=t,this._container=t.$body,this._rooms_obj={},this._visible=!1,this._notificationCount=0,this.SORT_ROOMS_INTERVAL=5e3,this._model=c.makePublicModel(),this._model.roomAdded().subscribe(this,this._onRoomAdded),this._model.roomChanged().subscribe(this,this._onRoomChanged),this._model.roomDeleted().subscribe(this,this._onRoomDeleted),this._model.roomsChanged().subscribe(this,this._onRoomsChanged),this._model.messageReceivedInOtherRoom().subscribe(this,this._onEventInOtherRooms),this._standalone=!!t.standalone,this._layoutWithSelect=!!t.layoutWithSelect||!!(t.options||{}).layoutWithSelect,this._bridge.chatNotificationControl=this._chatNotificationControl=new o.ChatNotificationControl(!1),t.visible&&(this._visible=t.visible.value(),t.visible.subscribe(this.onVisibilityChange.bind(this))),t.height&&t.height.subscribe(this.resize.bind(this)),t.width&&t.width.subscribe(this.resize.bind(this)),this._bridge.onMessage(function(t,e){switch(t){case"toggle_favorite_room":this.toggleFavoriteForRoom(e);break;case"toggle_room_notifications":this.toggleNotificationsForRoom(e)}}.bind(this)),this.layoutWithSelect()?this.prepareLayoutWithSelect():this.prepareLayout(),this.layoutWithSelect()&&this._createChatWidget(),this.setSortRoomsInterval(),loginStateChange.subscribe(this,function(){this._sortRoomsIntervalID&&clearInterval(this._sortRoomsIntervalID)}.bind(this)),0!==this._model.getRooms().length&&this._onRoomsChanged(this._model.getRooms(),[]),this.connect(),this.resize()}i("lNJX"),w.prototype._onRoomAddedBySelf=function(t){return!!this._model.getRoomById(t)&&(this.scrollToRoom(t),this.openChat(t),!0)},w.prototype._onRoomAdded=function(t){this.sortRooms(),t.user_id===window.user.id&&this._needScrollToAddedRoom&&(this._onRoomAddedBySelf(t.room_id),this._needScrollToAddedRoom=!1)},w.prototype._onRoomChanged=function(t){this.updateRoomCounter(t.room_id);var e=$("#pc-item-"+t.room_id);e.find(".title-text").text(t.title),e.find(".desc span").text(t.description)},w.prototype._onRoomDeleted=function(t){var e=$("#pc-item-"+t.room_id);m.jQueryCompatibleDestroy(e),e.remove(),this.resize(),
this._bridge._room===t.room_id&&this.openChat(this.getDefaultRoom())},w.prototype._onRoomsChanged=function(t,e){var i,s=0===e.length&&0!==t.length;this._notificationCount=0,s&&(this._$data.empty(),this._rooms_obj={}),this.initNotificationsSettings(),i=this.layoutWithSelect()&&this._bridge.activeRoom?this._bridge.activeRoom:this.getActiveRoom(),this.sortRooms(s,i),this.toggleFavoritesVisibility(),s&&i&&(this.layoutWithSelect()&&this._rooms_obj[i]&&this._$select.html("<strong>"+TradingView.clean(this._rooms_obj[i].title)+"</strong>"+(this._rooms_obj[i].description?": "+TradingView.clean(this._rooms_obj[i].description):"")),!this.isStandAlone()&&this._model.getRoomById(i)&&setTimeout(function(){this.openChat(i)}.bind(this),0))},w.prototype._onEventInOtherRooms=function(t,e,i){var s=this,n=this._rooms_obj[t.room_id];if(n){var a=$("#pc-item-"+n.room_id);if(this.updateRoomCounter(t.room_id),t.type||this.updateRoomDescMsg(n.room_id,t.username,t.text),t.user_id!==window.user.id&&this.roomNotificationsOn(n)){var d,l,c=TVSettings.getJSON("chat.sound",o.ChatSoundControl.prototype._default_state,!0);t.text&&(l=g.removeBBCodes(t.text),d=l.indexOf("@"+user.username)>-1),!i&&(!0===c||c.onMessage||d&&c.onMessageForUser)&&r.play("chat/message");var u=new p;u.ready.then((function(){var e=u.data.notification_popup;if(d&&!i&&!s._standalone&&!s.layoutWithSelect()&&e&&document.hidden&&h.show(n.title,t.username+": "+l,t.user_pic),!s.isCurrentRoom(n.room_id)||!s._visible){var o=s._$data.find('a[data-room="'+n.room_id+'"] .counter'),r=parseInt(o.text(),10);o.addClass("active").text(r+1),s._notificationCount++,a.highlight(1)}s.updateNotifications()}))}}},w.prototype.settingsKey=function(t){return"en"!==window.language&&(t+="."+window.locale),t},w.prototype.getLocalizedSetting=function(t,e){return TVSettings.getValue(this.settingsKey(t),e)},w.prototype.getLocalizedJsonSetting=function(t,e){return TVSettings.getJSON(this.settingsKey(t),e)},w.prototype.setTVSettings=function(t,e){return"en"!==window.language&&(t+="."+window.locale),TVSettings.setValue(t,e)},w.prototype.setJsonSetting=function(t,e){return TVSettings.setJSON(this.settingsKey(t),e)},w.prototype.onVisibilityChange=function(t){this._visible=t,t&&this._bridge._room&&$("#pc-item-"+this._bridge._room+" .counter").text("0").removeClass("active"),this.updateNotifications()},w.prototype.initNotificationsSettings=function(){this.notificationsSettings=this.getLocalizedJsonSetting("publiccharts.notifications"),this.notificationsSettings||(this.notificationsSettings=this._model.getRooms().reduce((function(t,e){return e.pinned&&(t[e.room_id]=1),t}),{}))},w.prototype.setupDataEvents=function(){var t=this;this._$data.on("click touchend",".pc-item, .msg-item",(function(e){t._touch_scroll||(t._searchFilter&&t._searchFilter.isOpen()&&t._searchFilter.setNewRoom($("#pc-item-"+$(this).data("room"))),t.openChat($(this).data("room")),e.preventDefault())})).on("touchstart",(function(){t._touch_scroll=!1})).on("touchmove",(function(e){t._touch_scroll=!0})).on("contextmenu",".pc-item",(function(e){
e.preventDefault(),t.showRoomContextMenu(e,$(this).data("room"))})),this.isStandAlone&&!this.isStandAlone()&&this._$data.on("click touchend",".pc-item .fav",(function(e){t.toggleFavoriteForRoom($(this).data("room")),e.stopPropagation(),e.preventDefault()})).on("click touchend",".pc-item .notifications-toggle",(function(e){t.toggleNotificationsForRoom($(this).data("room")),e.stopPropagation(),e.preventDefault()}))},w.prototype.showRoomContextMenu=function(t,e){var i=w.publicMenuItems(e,this._bridge,this);i.push(s.getLaunchInSeparateWindowAction(e,(function(){return!1}))),a.createMenu(i.map((function(t){return new n({label:t.title,onExecute:t.action})}))).then((function(e){e.show(t)}))},w.prototype.prepareLayout=function(){var t=this;this._$widget=$('<div class="tv-publicchats">').appendTo(this._container),t._touch_scroll=!1,this._searchFilter=new o.ChatRoomListSearchFilter(this,!1),this._searchFilter.appendInput(this._$widget),this._$dataWrap=$('<div class="pc-data-wrap">').appendTo(this._$widget),this._$dataWrap.on("contextmenu",(function(t){t.target.classList.contains("pc-data-wrap")&&t.preventDefault()})),this._$data=$('<div class="pc-data">').appendTo(this._$dataWrap),this._$noFavoritesMessage=$("<div>"),this._$noFavoritesMessage.addClass("tv-widget-empty-message js-hidden"),this._$noFavoritesMessage.text($.t("You haven't added a chat room to favorites.")),this._$noFavoritesMessage.appendTo(this._$dataWrap),this._searchFilter.setRoomList(this._$data),this.setupDataEvents(),this._$addButton=$('<a class="button apply-common-tooltip" title="'+$.t("Create new public chat")+'" data-role="button" data-name="create">').append($(i("drLC")).attr({width:17,height:17})).appendTo(this._bridge.$headerspace),this._$addButton.on("click",(function(e){e.preventDefault(),t.showEditRoomDialog()})),this._searchFilter.appendButton(this._bridge.$headerspace),this._$settingsButton=$('<a class="button apply-common-tooltip" title="'+$.t("Settings")+'" data-role="button" data-name="settings">').append($(i("RsxI")).attr({width:17,height:17})).appendTo(this._bridge.$headerspace),this._$settingsButton.on("click",s.prototype._showSettingsDialog.bind(this)),l(this._$settingsButton,null,{event:"show-popup",hideEvent:"hide-popup",addClass:"ch-popup ch-settings-popup",careBottomBorder:!0,careRightBorder:!0,viewportSpacing:2,reverse:!0}),this._scroll=new d(this._$dataWrap,this._$data)},w.prototype.prepareLayoutWithSelect=function(t,e){var o=this,n=!1;if(t&&!is_authenticated)return this._bridge.$header.hide(),void(this._$data=this._bridge.$body.append(e instanceof $?e:'<div>Please <a href="#signin" onclick="runOrSignIn(function(){}, { source: "Public chat widget" }); return false;">'+$.t("sign in or register")+"</a></div>"));function a(t){var e=$(t.target).parents().andSelf();e.is(o._$select)||e.is(o._$data)||o._toggleList()}this._bridge.$header.show(),this._bridge.$body.empty(),this._bridge.$header.addClass("chat-select-container"),this._$select=$('<div class="standalone-chat-select">').appendTo(this._bridge.$header),this._toggleList=function(){
if(n)o._$data.stop().height("auto").removeClass("sliding open");else{o._$data.height("auto").addClass("sliding");var t=Math.min($(window).height()-o._$data.offset().top-5,o._$data.height());o._$data.height(0).animate({height:t},{duration:200,height:t,complete:function(){o._$data.addClass("open").removeClass("sliding")}})}o._$select[n?"removeClass":"addClass"]("active"),$(document)[n?"off":"on"]("mousedown touchstart",a),n=!n},this._$select.click((function(t){t.preventDefault(),t.stopPropagation(),o._toggleList()})),this._$settingsButton=$('<a class="button apply-common-tooltip" title="'+$.t("Settings")+'"></a>').append($(i("uafl")).attr({width:17,height:17})).appendTo(this._bridge.$header).click((function(t){o instanceof i("+SlM").Widget&&o._chatWidget?o._chatWidget._showSettingsDialog(t):o instanceof w&&s.prototype._showSettingsDialog.call(o,t)})),l(this._$settingsButton,null,{event:"show-popup",addClass:"ch-popup ch-settings-popup",careBottomBorder:!0,careRightBorder:!0,viewportSpacing:2,reverse:!0}),this._$data=$('<div class="standalone-chat-list msg-data pc-data">').appendTo(this._bridge.$header).on("click touchend",(function(t){o._touch_scroll||o._toggleList()})),w.prototype.setupDataEvents.call(this)},w.prototype.connect=function(){this._bridge.onMessage(function(t,e){"toggle_show_only_favorites"===t&&(this._model.toggleShownOnlyFavorites(),this.toggleFavoritesVisibility(),this.resize())}.bind(this))},w.prototype.destroy=function(){clearInterval(this._roomUpdateInterval),clearInterval(this._roomStatusInterval),this._model.roomAdded().unsubscribe(this,this._onRoomAdded),this._model.roomChanged().unsubscribe(this,this._onRoomChanged),this._model.roomDeleted().unsubscribe(this,this._onRoomDeleted),this._model.roomsChanged().unsubscribe(this,this._onRoomsChanged),this._model.messageReceivedInOtherRoom().unsubscribe(this,this._onEventInOtherRooms),this._model.destroy(),this._model=null},w.prototype.getDefaultRoom=function(){for(var t,e=this._model.getRooms(),i=e.length-1;i>=0;i--)e[i].is_default&&(t=e[i].room_id);return t=t||("en"!==window.language?"general_"+window.locale:"general")},w.prototype.getActiveRoom=function(){var t=this.getLocalizedSetting("publicchats.activechat");return t||(t=this.getDefaultRoom()),t},w.prototype.updateRoomCounter=function(t,e){var i=this._rooms_obj[t],s=(new Date).getDate();if(i){!0!==e?(i.msgs_total++,i.msgs_date!==s?(i.msgs_date=s,i.msgs_days++,i.msgs_today=1,i.msgs_average=Math.round((i.msgs_total-1)/i.msgs_days)):i.msgs_today++):i.msgs_date=s;var o=function(t){if(t<1e3)return String(t);var e=Math.floor(Math.log(t)/Math.log(1e3));return Math.round(t/Math.pow(1e3,e)*Math.pow(10,1))/Math.pow(10,1)+"KMGTPE".charAt(e-1)}(~~i.msgs_total),n=this._$data.find("#pc-item-"+t);n.find(".title-total").text(o),this.layoutWithSelect()||n.find(".title-text, .title-total").addClass("apply-common-tooltip common-tooltip-html").attr("title",TradingView.clean(i.description)+"<br><small>"+window.t("{messagesCount} all time messages").format({messagesCount:i.msgs_total
})+"<br>"+window.t("{messagesCount} messages today").format({messagesCount:i.msgs_today})+"<br>"+(0===i.msgs_average?window.t("< 1 message average per day"):window.t("{messagesCount} average per day").format({messagesCount:i.msgs_average}))+"</small>")}},w.prototype.addRoom=function(t,e){if($('<a href="#" data-room="'+t.room_id+'" id="pc-item-'+t.room_id+'" class="pc-item'+(e?" active":"")+(t.pinned?" pinned":"")+(this._model.isRoomFavorite(t.room_id)?" favorite":"")+'"><div class="title"><span class="title-text">'+TradingView.clean(t.title)+'</span> <span class="title-total">0</span></div><div class="desc"><span>'+TradingView.clean(t.description)+'</span></div><div class="counter">0</div>'+(this.isStandAlone()?"":'<div class="notifications-toggle'+(this.roomNotificationsOn(t)?" active":"")+'" data-room="'+t.room_id+'" title="'+$.t("Toggle notifications for this room")+'">'+i("4Tc7")+'</div><i class="fav'+(this._model.isRoomFavorite(t.room_id)?" active":"")+'" data-room="'+t.room_id+'" title="'+$.t("Toggle favorite")+'">'+i("HHbT")+"</i>")+"</div></a>").appendTo(this._$data),this.updateRoomCounter(t.room_id,!0),t.msgs_last_ts&&(t.last_message_time=1e3*+t.msgs_last_ts),t.msgs_last_text){var s=t.msgs_last_text.split(": ");this.updateRoomDescMsg(t.room_id,s[0],s[1])}},w.prototype.updateRoom=function(t){$("#pc-item-"+t.room_id).appendTo(this._$data)},w.prototype.updateRoomDescMsg=function(t,e,i){var s=this._rooms_obj[t];if(s){var o=$("#pc-item-"+t).find(".desc");m.jQueryCompatibleDestroy(o);var n=o.find("time");n.length||(n=$("<time>").appendTo(o)),o.find("span").text(e+": "+g.removeBBCodes(i)),m.jQueryCompatibleAgoDateFormatter(n,new Date(s.last_message_time||Date.now()))}},w.prototype.updateNotifications=function(){var t=this._$data.find(".counter.active").length;this._bridge.notify(1,{notificationValue:t,clear:!t,force:!0,room:this._model.getRoomById(this._bridge._room)})},w.prototype.openChat=function(t,e){if(!this._bridge._room||t!==this._bridge._room){this._$data.find("a").removeClass("active"),$("#pc-item-"+t).addClass("active");var i=$("#pc-item-"+t+" .counter"),s=parseInt(i.text(),10);if(i.text("0").removeClass("active"),this._bridge.postMessage("chat_select_channel",{room_id:t,new_msgs:s}),s&&(this._notificationCount=Math.max(0,this._notificationCount-s)),this._bridge._room=t,this.isStandAlone()||this.setTVSettings("publicchats.activechat",t),this.layoutWithSelect()){var o=this._model.getRoomById(t);this._$select.html("<strong>"+TradingView.clean(o.title)+"</strong>"+(o.description?": "+TradingView.clean(o.description):""))}this.updateNotifications()}},w.prototype.resize=function(){this.layoutWithSelect()?this.chatWidget.resize():this._scroll.resize()},w.prototype.isCurrentRoom=function(t){return this._bridge._room===t},w.prototype.scrollToRoom=function(t){this._scroll.animateTo($("#pc-item-"+t).position().top-10)},w.prototype.toggleFavoritesVisibility=function(){if(!this.isStandAlone()){this._$data.toggleClass("js-only-favorites",this._model.isShownOnlyFavorites())
;var t=this._model.isShownOnlyFavorites()&&0===this._$data.find(".favorite").length;this.layoutWithSelect()||this._$noFavoritesMessage.toggleClass("js-hidden",!t)}},w.prototype.toggleFavoriteForRoom=function(t){var e=!1;this._model.isRoomFavorite(t)?(this._model.removeFavoriteRoom(t),e=!1):(this._model.addFavoriteRoom(t),e=!0);var i=$("#pc-item-"+t);i.toggleClass("favorite",e),i.find(".fav").toggleClass("active",e),this.toggleFavoritesVisibility()},w.prototype.setSortRoomsInterval=function(){if(!this._sortRoomsIntervalID){var t=this;(this._$dataWrap||this._$data).on("mouseenter",(function(){t._pointerInsideData=!0})).on("mouseleave",(function(){t._pointerInsideData=!1})),this._sortRoomsIntervalID=setInterval((function(){t._pointerInsideData||t._bridge&&t._bridge.visible&&!t._bridge.visible.value()||t.sortRooms()}),this.SORT_ROOMS_INTERVAL)}},w.prototype.sortRooms=function(t,e){e||(e=this.getActiveRoom()),this._model.getRooms().sort(this.sortRoomsFilter.bind(this)).forEach((function(i){t||!(i.room_id in this._rooms_obj)?(this._rooms_obj[i.room_id]=i,this.addRoom(i,e===i.room_id)):this.updateRoom(i)}),this)},w.prototype.sortRoomsFilter=function(t,e){return t.pinned&&!e.pinned?-1:!t.pinned&&e.pinned?1:t.pinned&&e.pinned?t.title.toLowerCase()>e.title.toLowerCase()?1:-1:this._model.isRoomFavorite(t.room_id)&&!this._model.isRoomFavorite(e.room_id)?-1:!this._model.isRoomFavorite(t.room_id)&&this._model.isRoomFavorite(e.room_id)?1:"number"==typeof t.last_message_time&&"number"!=typeof e.last_message_time?-1:"number"!=typeof t.last_message_time&&"number"==typeof e.last_message_time?1:"number"==typeof t.last_message_time&&"number"==typeof e.last_message_time&&t.last_message_time>e.last_message_time?-1:"number"==typeof t.last_message_time&&"number"==typeof e.last_message_time&&t.last_message_time<e.last_message_time||t.title.toLowerCase()>e.title.toLowerCase()?1:-1},w.prototype.toggleNotificationsForRoom=function(t){t in this.notificationsSettings?delete this.notificationsSettings[t]:this.notificationsSettings[t]=1,this.setJsonSetting("publiccharts.notifications",this.notificationsSettings),$("#pc-item-"+t+" .notifications-toggle").toggleClass("active",t in this.notificationsSettings)},w.prototype.roomNotificationsOn=function(t){return t.room_id in this.notificationsSettings},w.prototype.showEditRoomDialog=function(t){var e=this;runOrSignIn((function(){window.user.permissions.can_moderate_public_chats||f(v.CAN_EDIT_PUBLIC_CHATS)?u(t,e._model.createRoom.bind(e._model),e._model.editRoom.bind(e._model),(function(i){t||e._onRoomAddedBySelf(i.room.room_id)||(e._needScrollToAddedRoom=!0)})):b({feature:"editCreatePublicChat",isTrialAvailable:!0,upgradeMessage:$.t("Upgrade now")})}),{source:"Public chat widget",verifiedPhoneRequired:!0})},w.prototype.isStandAlone=function(){return this._standalone},w.prototype.layoutWithSelect=function(){return this._layoutWithSelect},w.prototype._createChatWidget=function(){var t=$.extend(!0,{},this._bridge,{$header:null,publicMenuItems:this.publicMenuItems,
hideMaximize:(this._bridge.options||{}).hideMaximize||this._layoutWithSelect,standalone:this.isStandAlone()||this.layoutWithSelect()});this.chatWidget=new s(t)},w.publicMenuItems=function(t,e,i){var s=[];return s.push({title:$.t("Toggle Notifications for This Room"),action:function(){e.postMessage("toggle_room_notifications",t)}}),s.push({title:_($.t("Link to This Room")),action:function(){e.postMessage("chat_show_link",t)}}),s.push({title:_($.t("Room Archives")),action:function(){var e=new Date,i=e.getMonth()+1,s=e.getDate(),o=e.getFullYear()+"-"+(i<10?"0":"")+i+"-"+(s<10?"0":"")+s;window.open("/chat/history/?room="+t+"&date="+o+"&tzoffset="+e.getTimezoneOffset())}}),s},t.exports=w},drLC:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 17"><path d="M7 2h3v13H7M2 7h13v3H2z"/></svg>'},eF4M:function(t,e,i){"use strict";(function(e,s){i("TdlR"),i("Ky3Q"),i("xNaP");var o=i("ovEV"),n=i("fZEr").showWarning,a=i("9tJu").getUserProfilePath,r=i("OqB+"),h=i("sklT").getUsernameHintList,d=i("sklT").getUserChatSuggestListHandler,l=i("sklT").destroyUsernameHintList,c=i("0XzO"),u=i("L7u7").pushChartPage,p=i("7KDR"),m=p.Action,g=p.Separator,_=i("5VQP").ContextMenuManager,f=i("4QoS").takeChartSnapshot,v=i("hp/T"),b=i("Inbj"),w=i("UPgO"),y=i("1viN"),C=y.showBanUserDialog,R=y.showUnbanUserDialog,M=i("GDPI").getViolations,S=i("QcGJ").openPMDialog,T=i("h6Z7").showReportModal,x=i("sFgq").SidebarCustomScroll,k=i("bR4N").bindPopupMenu,I=i("PHun").emoji,B=i("brCa").showNoticeDialog,E=i("fZEr").showConfirm,D=i("Wz41"),A=i("XJ8t"),O=i("c2JX").Spinner,W=i("JWMC").trackEvent,z=i("XhdI").trackChatEvent,F=i("qjxE"),H=i("l3JW"),P=i("vBL9"),L=i("Y4QI").parseBBCode,j=i("e45J").buildUtmQueryStringFromUrlParams,N=i("0gOL").template,U=i("wr2L").lazyFancybox;i("xict");var V=i("Ialn").detectAutoDirection,q=i("GAqT").TVOldDialogs,Q=i("OyD6").convertToBadgeAccountProps,J=i("IhIr").Size,K=i("6RdN").renderBadgeAccountWithoutFeaturedBroker,G=i("EhHS").getBadgeAccountTitle,X=i("HKz3").getBadgeAccountLink,Y=i("KE2E").ChatMessageTypeCustomizer,Z=i("+GxX").isFeatureEnabled,tt=i("fF31"),et=i("25b6").htmlEscape,it=i("wuAJ").validateUrlsInText,st=i("/3z9").hashFromEvent,ot=i("/3z9").Modifiers,nt=i("wmOI"),at=window.t("Like",{context:"like_button"});function rt(t){var e=function(){window.user._chatInputs||(window.user._chatInputs={})};e(),loginStateChange.subscribe(this,e),this._bridge=t;var i=t.$body;this._model=null;var s=this._bridge.visible.value();this.isPrivate()?this._model=D.makePrivateModel():this._bridge.live&&this._bridge.rooms?this._model=D.makeLiveSeparateModel(this._bridge.rooms):(this._model=D.makePublicModel("en"===window.language),"en"!==window.language&&(s=!0)),this._model.messageReceived().subscribe(this,this._onMessageWrapper),this._model.messageDeleted().subscribe(this,this._onMessageDeleted),this._model.roomChanged().subscribe(this,this._onRoomChanged),this._model.setActive(s),this._isHistoryEnded=!1,this._markNewMessagesAsUnread=!1,this._invisibleMessagesNumber=0,this._inputDisabled=!1,
this.MESSAGES_CONCATENATION_TIMEOUT=12e4,this.MAX_MESSAGES=100,this.MAX_HIGHLIGHTED_MESSAGES=10,this.USERLINK_POPUP_TIMEOUT=1e3,this.META_VERSION="0.2",this._init_history_loading=!0,this._init_history_loaded=!1,this._onBridgeVisibleChange=null,this._onSymbolChanged=null,this._onIntervalChanged=null,this._onResize=null,this._onMaximized=null,this._standalone=!t||!!t.standalone,this._embedded=!t||!!t.embedded,this._noAutoFocus=!!t.noAutoFocus,this.utm=j(!1),this.isPrivate()||(this._updateMessageBatches(),this.updateLikesHandlers(),this.canHandleLikes=!0),this._hintListElement=null,this.prepareLayout(i),this.toggleSnaphotPreview(TVSettings.getBool("chat.show_snapshot_preview",!0));var o=null;this._standalone&&t.activeRoom?o=t.activeRoom:t&&t.properties&&(o=(t.properties.value()||{}).room||o),this.likeButtonTemplate=N,this._messageTypeCustomizer=new Y(this._bridge.typeHandlers||{},this._updateMessageContext),this._updateMessageContext(),(this.isPrivate()||this._standalone&&this._model.getRoomById(o)||this._bridge.live)&&this.selectChannel(o),t&&(t.symbol&&(this._onSymbolChanged=this.update.bind(this),t.symbol.subscribe(this._onSymbolChanged,{callWithLast:!0})),t.interval&&(this._onIntervalChanged=this.update.bind(this),t.interval.subscribe(this._onIntervalChanged,{callWithLast:!0})),this._onResize=this.resize.bind(this),t.height&&t.height.subscribe(this._onResize),t.width&&t.width.subscribe(this._onResize),t.onMessage&&!t.live&&t.onMessage(this.onBridgeMessage.bind(this)))}rt.prototype._onMessageWrapper=function(t,e,i){this.onMessage(t,i)},rt.prototype.currentRoom=function(){return this._model.room()},rt.prototype.enablePosting=function(){this._postingDisabled&&(this._hiddenElements&&this._hiddenElements.forEach((function(t){t.css("display","")})),this._$inputNoPostingMessage&&this._$inputNoPostingMessage.remove(),this.resizeHeader(),this._postingDisabled=!1)},rt.prototype.onBridgeMessage=function(t,e){"chat_set_sound_state"===t?e.isPrivate===this.isPrivate()&&this.sound.set(e.state):"toggle_snaphot_preview"===t&&this.toggleSnaphotPreview(),this.isPrivate()?"private_chat_hidden"===t?this._markMessagesAsUnread(!0):"private_chat_visible"===t?(this._scroll.checkContentVisibility(),this._markMessagesAsUnread(!1)):"private_chat_msgs_read"===t&&this._markAsRead(e.idString):"chat_select_channel"===t?(this._newMessagesToHighlight=e.new_msgs,this.selectChannel(e.room_id)):"chat_edit_room"===t?this.editRoom(this._model.getRoomById(e)):"chat_delete_room"===t?this.deleteRoom(this._model.getRoomById(e)):"chat_show_link"===t&&this.showLinkToChat(this._model.getRoomById(e))},rt.prototype.playSound=function(t){this.sound.state[t]&&(this.isPrivate()?v.play("chat/popup"):v.play("chat/message"))},rt.prototype._clearExcessiveMessages=function(){var t=this._$data.find(".ch-item");return t.length>this.MAX_MESSAGES&&((t=t.slice(0,t.length-this.MAX_MESSAGES)).add(".ch-item-empty"),F.jQueryCompatibleDestroy(t),t.remove()),this._history_hide_timeout&&(clearTimeout(this._history_hide_timeout),this._history_hide_timeout=null),!!t.length},
rt.prototype._markAsRead=function(t){var e=t.split(":");this._scroll.triggerVisibilityCallbacks((function(t){var i=e.indexOf(t.id);return i>=0&&(e.splice(i,1),!0)}))},rt.prototype._markMessagesAsUnread=function(t){t&&this._markNewMessagesAsUnread!==t&&(this._prepareUnreadMarker=!0),this._markNewMessagesAsUnread=t},rt.prototype._shouldPlaceUnreadMarkerNow=function(){var t=this._prepareUnreadMarker;return this._prepareUnreadMarker=!1,this._markNewMessagesAsUnread&&t},rt.prototype.onMessage=function(t,e){if(!(t.user_id in this._model.ignoredUsers()||t.id&&this._lastMessageId===t.id)){this._lastMessageId=t.id;var i=t.user_id!==window.user.id,s=i&&this._shouldPlaceUnreadMarkerNow();s&&this._$data.append(this._getNewUnreadMarker()),this.isPrivate()&&this._bridge.visible.value()&&this._bridge.postMessage("private_message_read",{id:"marker"}),(this._isMessageFromIgnoredUser(t)||dt(t))&&this._invisibleMessagesNumber++;var o=this.createMessage(t,{markAsUnread:this._markNewMessagesAsUnread,forceFullMessage:s,batch:1}),n=o[0].querySelector(".js-badge-wrapper");if(null!==n&&K(n,{badges:Q(t),size:J.Small,getTitle:G,getLink:X}),o.data("short")){var a=this.getLastMessages(1);o.insertAfter(a.find(".ch-item-text:last"))}else this._$data.removeClass("no-messages"),o.appendTo(this._$data);this._scroll.atEnd(2*o.height())&&this._clearExcessiveMessages.apply(this),i&&this._bridge&&(t.meta.service_msg||(!this.isStandalone()&&!this.isPrivate()||e||this.playSound(o.data("is_reply")?"onMessageForUser":"onMessage"),this.highlightMessage(o,t.id))),this._scroll.atEnd(2*o.height())&&this._scroll.scrollToEnd(),this._messageTypeCustomizer.onMessage(t)}},rt.prototype.highlightMessage=function(t,e){var i=this;this._bridge.visible.value()?this.isPrivate()&&this._bridge.postMessage("private_message_read",{id:e}):this.isPrivate()||(this._messagesToHighlight?this._messagesToHighlight=this._messagesToHighlight.concat(t.attr("id")).slice(-this.MAX_HIGHLIGHTED_MESSAGES):(this._messagesToHighlight=[t.attr("id")],this._bridge.visible.when((function(){var t=i._messagesToHighlight;delete i._messagesToHighlight,i._$data.find("#"+t.join(", #")).highlight(5)})),t=null))},rt.prototype._onMessageDeletedBySelf=function(t){this._slidingUp||(this._slidingUp=[]),this._slidingUp.length||this._scroll.fixBottom(),this._slidingUp.push(t),t.slideUp({queue:!1,complete:function(){this._slidingUp.splice(this._slidingUp.indexOf(t),1),this._slidingUp.length||(delete this._slidingUp,this._scroll.releaseBottom()),this.removeMessage(t)}.bind(this)})},rt.prototype._onMessageDeleted=function(t){var e=$("#ch-item-"+t.id);if(e.hasClass("ch-item-text")&&(e=e.closest(".ch-item")),e.length>0&&this._messagesIdsToBeDeletedBySelf&&this.getMessagesData(e)[0]===this._messagesIdsToBeDeletedBySelf[0])return this._messagesIdsToBeDeletedBySelf=null,this._onMessageDeletedBySelf(e);e.length>0&&(window.is_authenticated&&window.user.id===t.user_id?this.highlightAsModerated(e):this.removeMessage(e),this._scroll.resize())},rt.prototype._onRoomChanged=function(){
this.isPrivate()&&this._$addButton.find(".msg-window-members-count").text(this._bridge.membersCount())},rt.prototype.removeMessage=function(t){F.jQueryCompatibleDestroy(t),t.remove()},rt.prototype.highlightAsModerated=function(t){t.prepend('<div class="ch-message-moderated-layout"><div class="ch-overlap">'+window.t("MODERATED")+"</div></div>").addClass("ch-message-moderated")},rt.prototype.getLastMessages=function(t,e){var i=e instanceof DocumentFragment?$(e.childNodes).filter(".ch-item"):(e||this._$data).find(".ch-item");return i.slice(i.length-t)},rt.prototype.getFirstMessages=function(t,e){return(e instanceof DocumentFragment?$(e.childNodes).filter(".ch-item"):(e||this._$data).find(".ch-item")).slice(0,t)},rt.prototype.update=function(){this._bridge&&this._bridge.symbol&&this._model.setStatSymbol(this._bridge.symbol.value()||void 0),this._bridge&&this._bridge.interval&&this._model.setStatInterval(this._bridge.interval.value()||void 0)},rt.prototype._clearMessageBatch=function(t){this._messageBatches[t].count>0&&(this._messageBatches[t]=ht(t))},rt.prototype._putMessageInBatch=function(t,e){this._messageBatches[t].clearAfterTriggering&&this._messageBatches[t].visibilityCallbacksFired&&this._clearMessageBatch(t),this._messageBatches[t].messages[e]=!0,this._messageBatches[t].count++},rt.prototype._checkMessageBatchQuantity=function(t){return this._messageBatches[t].visibilityCallbacksFired||this._onMessagesVisibility(t),this._messageBatches[t].fireAlt};function ht(t){var e={messages:{},count:0,visibilityCallbacksFired:!1,fireAlt:!1};return 1===t&&(e.clearAfterTriggering=!0),e}function dt(t){return"create_room"===t.type||"edit_room"===t.type}function lt(t){return JSON.parse(t).id}function ct(t){if(window.getSelection().toString())return!0;var e=$(t);if(e.is("img, a, path"))return!0;var i=e.closest("div");return i.hasClass("js-snapshot-like")||i.hasClass("js-chart-like")}rt.prototype._onMessagesVisibility=function(t){this._messageBatches[t].visibilityCallbacksFired=!0,this._messageBatches[t].count<=5&&(this._messageBatches[t].fireAlt=!0)},rt.prototype._updateMessageBatches=function(){this._messageBatches&&delete this._messageBatches,this._messageBatches=[ht(0),ht(1)]},rt.prototype._canLoadHistoryMessages=function(){return this._scroll.isContentShort()&&!this._isHistoryEnded&&this._bridge.visible.value()},rt.prototype._loadChatHistory=function(){this._history_loading=!0,this._$data.addClass("loading");var t=this;this._model.loadHistory(this._$data.find(".ch-item-text").length+this._invisibleMessagesNumber,(function(e,i){t._scroll.save(),t.prependMessages(e.messages,(function(){t._scroll.restore(),t._history_loading=!1,t._isHistoryEnded=i,t._$data.removeClass("loading"),t._history_hide_timeout&&clearTimeout(t._history_hide_timeout),t._history_hide_timeout=setTimeout((function(){t._clearExcessiveMessages.apply(t)&&(t._scroll.scrollToEnd(),t._isHistoryEnded=!1)}),24e5),t._canLoadHistoryMessages()&&t._loadChatHistory()}))}))},rt.prototype.updateRoom=function(t){this._invisibleMessagesNumber=0,this._isHistoryEnded=!1,
this._$data.addClass("loading"),this._spinner||(this._spinner=new O("mini").spin(this._$scrollContainer.get(0))),this._init_history_loading=!0,this.isPrivate()&&(this.updateLikesHandlers(),this._updateMessageBatches()),this._$inputDisabledMessage.hide(),this._$invalidLinkMessage.hide();this._model.setRoom(t,function(t,e,i){this.isPrivate()&&this._bridge.xWindowDataSync&&"function"==typeof this._bridge.xWindowDataSync&&this._bridge.xWindowDataSync(t),F.jQueryCompatibleDestroy(this._$data),this._$data.empty(),this.resizeHeader(),this.isPrivate()&&!i&&(this._lastVisited=1e3*t.last_visited),this._isHistoryEnded=e,t.messages.length&&(this._lastMessageId=t.messages[0].id);var s=this;this.prependMessages(t.messages,(function(){if(s.updateTitle(),s._$data.removeClass("loading"),s._spinner&&(s._spinner.stop(),delete s._spinner),s._scroll.scrollToEnd(),s._newMessagesToHighlight&&t.messages.length>0){var e=Math.min(s._newMessagesToHighlight,s.MAX_HIGHLIGHTED_MESSAGES);c.highlightNewMessages(s._$data,e,5),s._newMessagesToHighlight=0}s._init_history_loading=!1,s.isPrivate()&&s.restoreInputText(),s._init_history_loaded&&s.inputEditFocus(),s._init_history_loaded=!0,s._canLoadHistoryMessages()&&s._loadChatHistory()}))}.bind(this))},rt.prototype.getRoomTitle=function(t){var e=this._model.getRoomById(t);return e?e.title:""},rt.prototype.isStandalone=function(){return!!this._standalone},rt.prototype.isEmbedded=function(){return!!this._embedded},rt.prototype.isPrivate=function(){return this._bridge&&!!this._bridge.private_chat},rt.prototype._updateMessageContext=function(){this.messageContext=this.getMessageContext()},rt.prototype.getMessageContext=function(){var t=this;return Object.assign({join:function(t){return{text:"<i>"+window.t("__username__ has entered the chat",{username:et(t.username)})+"</i>",isService:!0}},leave:function(t){return{text:"<i>"+window.t("__username__ has left the chat",{username:et(t.username)})+"</i>",isService:!0}},delete_room:function(t){return{text:"<i>"+window.t("Room __title__ was deleted",{title:et(t.meta.room_title)})+"</i>",isService:!0}},warning:function(e){return $.extend(t.normalMessageContext(e),{isService:!0,isWarning:!0})},normal:t.normalMessageContext,get:function(e){return e.type&&this[e.type]?this[e.type](e):t.normalMessageContext(e)}},this._messageTypeCustomizer.getHandlers(t.normalMessageContext))},rt.prototype.normalMessageContext=function(t){var i,s=t.meta&&"snapshot"===t.meta.type,o=this.META_VERSION===t.meta.version,n=t.meta.temp;return i=o?this.renderText(t).replace(/\n/g,"<br/>"):w.urlizeAndParseQuotesAndClean(t.text||"",w.smilies).replace(/\n/g,"<br/>"),s&&(i&&(i+="<br/>"),i+=e.render('<div class="ch-item-preview-wrap"><div class="ch-item-snapshot-link"><i class="icon icon-snapshot-small" title="{{title}}"></i> <a href="{{url}}" target="_blank">{{metaText}}</a></div><div class="ch-item-snapshot-preview"><a href="{{url}}" target="_blank"><img src="{{previewURL}}" loading="lazy" class = "snapshot-preview" alt=""/></a></div>{{#chartId}}{{> ideaLikesButton }}{{/chartId}}</div>',{
title:window.t("Chart Snapshot"),url:TradingView.clean(t.meta.url),metaText:window.t("Chart Snapshot"),previewURL:TradingView.clean(t.meta.preview_url?t.meta.preview_url:t.meta.url),chartId:!(this.isPrivate()||!n)&&t.id,typeClass:"js-snapshot-like",titleTooltip:at},{ideaLikesButton:this.likeButtonTemplate})),{text:i,showAuthor:!t.meta.service_msg,isAuthor:user.id===t.user_id,isReport:t.meta.report_type,isModNotification:t.meta.mod_notification,isBanNotification:t.meta.ban_notification,newMeta:o,tempMeta:n,snapshotAttached:s}},rt.prototype.renderText=function(t){var s=this.utm?"?"+this.utm:"",o=new w.UrlizeBuffer(TradingView.clean(t.text),t.utm);if(o=w.obsceneWords(o),t.meta.links.charts){var n=t.meta.links.charts.occurences,a=t.meta.links.charts.data;n.forEach((function(t){var n=a[t.id],r=TradingView.clean(t.match);o.text.indexOf(r)>=0&&(o.text=o.text.replace(r,"<"+o.count+++">"),o.values.push(e.render('{{#showLikesButton}}<div class="ch-item-preview-wrap">{{/showLikesButton}}<div class="ch-item-chart-link"><i class="icon icon-snapshot-small" title="{{publishedIdea}}"></i> <a href="{{href}}" target="_blank" data-id="{{chartId}}" data-symbol="{{symbol}}" data-title="{{title}}" data-url="{{href}}">{{publishedIdea}}</a></div><div class="ch-item-chart-preview"><a  href="{{href}}" target="_blank" data-id="{{chartId}}" data-symbol="{{symbol}}" data-title="{{title}}" data-url="{{href}}"><img src="{{imageUrl}}" loading="lazy" alt="" class="idea-preview"/>{{#isVideo}}<div class="tv-idea-preview-button__play-icon">'+i("IRk6")+'</div>{{/isVideo}}{{#videoCam}}<div class="tv-idea-preview-button__video-cam">'+i("n5P/")+"</div>{{/videoCam}}</a></div>{{#showLikesButton}}{{> ideaLikesButton }}{{/showLikesButton}}{{#showLikesButton}}</div>{{/showLikesButton}}",{href:n.published_chart_url+s,publishedIdea:window.t("Published Idea"),title:n.name,symbol:n.symbol.split(":")[1],imageUrl:H.createPublishedChartImageUrl(n.image_url),showLikesButton:!this.isPrivate(),chartId:n.image_url,typeClass:"js-chart-like",titleTooltip:at,isVideo:n.is_video,videoCam:n.video_cam},{ideaLikesButton:this.likeButtonTemplate})))}),this)}o.text=P.parseQuotes(o.text),o.text=L(o.text);var r=w.chainedUrlize(o,w.commonFunctors);return r=I.parseNativeEmoji(r)},rt.prototype._isMessageFromIgnoredUser=function(t){return t.user_id in this._model.ignoredUsers()},rt.prototype.createMessage=function(t,s,o){if(this._isMessageFromIgnoredUser(t)||dt(t))return $();var n,r=this.messageContext.get(t),h=t.meta.interval?" "+t.meta.interval:"",l=document.createElement("div");l.innerHTML=r.text;for(var c=0;c<l.childNodes.length&&(l.childNodes[c].nodeType!==Node.TEXT_NODE||!(n=V(l.childNodes[c].textContent)));c+=1);
var p=$(e.render('<div class="ch-item ch-item-user-{{userID}} js-userlink-popup-anchor" id="ch-item-{{messageID}}"><a class="ch-item-userpic ch-item-userpic-{{userID}}" href="{{profileUrl}}" data-username="{{username}}" data-userlinkpopup-timeout="{{userlinkPopupTimeout}}" target="_blank"><img src="{{userPic}}" loading="lazy" alt="Avatar"/></a><div class="ch-item-content">{{#showHeader}}<div class="ch-item-header">{{#showAuthor}}<span class="ch-item-author"><a href="{{profileUrl}}" target="_blank" class="ch-userlink selectable js-chat-suggest" data-username="{{username}}" data-userlinkpopup-timeout="{{userlinkPopupTimeout}}">{{username}}</a><span class="ch-userlink__badge-wrapper js-badge-wrapper"></span></span>{{/showAuthor}}<span class="ch-item-info">{{{symbolInterval}}}<span class="ch-item-time"><time></time></span></span>{{#showActions}}<div class="ch-item-actions js-actions"></div>{{/showActions}}</div>{{/showHeader}}<div class="ch-item-text selectable {{^showHeader}}ch-item-text-no-header{{/showHeader}} js-text"{{#autoDirection}}dir={{autoDirection}}{{/autoDirection}}>{{{text}}}</div></div></div>',{userID:t.user_id,messageID:t.id,username:t.username,userPic:t.user_pic,userlinkPopupTimeout:this.USERLINK_POPUP_TIMEOUT,showHeader:!("join"===t.type),showAuthor:r.showAuthor,symbolInterval:""!==t.symbol?'<span class="ch-item-symbol">'+et(t.symbol.substring(t.symbol.indexOf(":")+1)+h)+",</span>":"",showActions:!r.isService,text:r.text,autoDirection:n,profileUrl:a({username:t.username,is_broker:t.is_broker},{query:this.utm})})),f=this;if(p.find(".ch-item-userpic img").one("error",(function(){this.src=tt})),s.markAsUnread&&!r.isAuthor&&(this._putMessageInBatch(s.batch,t.id),p.addClass("js-unread-message"),this._scroll.subscribeToContentVisible(t.id,p,(function(e){if(e||f._bridge.postMessage("private_message_read",{id:t.id}),f._checkMessageBatchQuantity(s.batch))return p.removeClass("js-unread-message"),void p.highlight(5);p.addClass("js-read-message"),p.removeClass("js-unread-message"),setTimeout((function(){p.removeClass("js-read-message")}),2500)}))),r.isService)return p.addClass("ch-message-service"),r.isWarning&&p.addClass("ch-message-type-warning"),p;this._messageTypeCustomizer.isTypeExists(t.type)&&this._messageTypeCustomizer.onCreateMessage(p[0],t);var v=p.find(".js-text");if(0===v.text().length&&1===v.children().length&&(v.children().hasClass("emoji")||v.children().hasClass("tv-emoji-wrapper"))&&v.addClass("ch-item-text-emoji"),this.canHandleLikes&&r.tempMeta){if(r.snapshotAttached){var b=t.meta.temp.message_likes;b&&this._snapshotMessagesLikesHandler.addIdea(p.find(".js-snapshot-like")[0],t.id,b.count,b.voted)}if(r.newMeta&&t.meta.links.charts&&t.meta.temp.chart_likes){c=0;var w=t.meta.temp.chart_likes;p.find(".js-chart-like").each((function(){var e=$(this).data("id");e===t.meta.links.charts.occurences[c++].id&&f._chartLikesHandler.addIdea(this,e,w[e].count,w[e].voted)}))}}var y,C=p.find(".js-actions")
;if(C.append($('<a class="ch-item-action" title="'+window.t("Quote this message")+'">')).children().last().append($(i("78iq")).attr({width:12,height:12})).on("click",(function(e){e.stopPropagation(),f.insertQuote(p,t)})),r.isAuthor||C.append($('<a class="ch-item-action ch-item-action-report" title="'+window.t("Report this message")+'">')).children().last().append($(i("ZI66")).attr({width:12,height:12})).on("click",(function(e){e.preventDefault(),f.showReportDialog(p,t)})),C.append($('<a class="ch-item-action js-settings" title="'+window.t("Message settings")+'">')).children().last().append($(i("JpHp")).attr({width:12,height:12})),C.on("contextmenu",(function(t){t.preventDefault(),t.stopPropagation()})),this.bindMessageMenu(p,t),this.isEmbedded()||p.find(".js-chat-suggest").on("click",function(e){e.preventDefault(),e.stopPropagation(),d().then((function(e){e.onUserSelect({id:t.user_id,username:t.username,userpic:t.user_pic})})),this.insertAtCursorPosition("@"+t.username.replace(/\s/g," ")+" ")}.bind(this)),!this.isStandalone()){var R=p.find(".ch-item-snapshot-link a, .ch-item-snapshot-preview a");U({$elem:R,type:"image",live:!1}),p.find(".ch-item-chart-link a, .ch-item-chart-preview a").click((function(){var t=$(this).data("url"),e=$(this).data("id"),i=$(this).data("symbol"),s=f._bridge.getChartWidgetCollection();if(t)u({chartId:e,chartName:window.t("Published Idea"),publishedUrl:t,shortSymbol:i,chartWidgetCollection:s});else if(i){var o=$(this).data("title"),n=H.createPublishedChartUrl(e,i,o);u({chartId:e,chartName:window.t("Published Idea"),publishedUrl:n,shortSymbol:i,chartWidgetCollection:s})}else u({chartId:e,chartName:window.t("Published Idea"),chartWidgetCollection:s});return!1}))}this.isStandalone()||this.isEmbedded()||p.on("contextmenu",(function(e){ct(e.target)||(e.preventDefault(),f._model.getBanStatus(t,(function(i,s){t.is_banned=i&&s;var o=f.prepareMessageMenu(p,t).map((function(t){return t.separator?new g:new m({label:t.title,onExecute:t.action})}));_.createMenu(o).then((function(t){t.show(e)}))})))})),F.jQueryCompatibleAgoDateFormatter(p.find(".ch-item-time time"),this._parseMessageTime(t.time)),p.data("message",JSON.stringify(t)).data("alive",!0),this.isStandalone()&&p.data("ch-is-standalone",!0),is_authenticated&&(!f.isEmbedded()&&r.isAuthor?p.addClass("ch-is-author"):r.isReport?(p.addClass("ch-is-report"),s.forceFullMessage=!0):r.isModNotification?(p.addClass("ch-mod-notification"),s.forceFullMessage=!0,r.isBanNotification&&p.addClass("ch-ban-notification")):t.text&&p.text().indexOf("@"+user.username.replace(/\s/g," "))>-1&&(p.addClass("ch-is-reply").data("is_reply",!0),y=!0));var M=this.getLastMessages(1,o),S=M&&!M.hasClass("ch-message-moderated")&&M.data("message");if(S)try{S=JSON.parse(S)}catch(T){S=null}
return!s.forceFullMessage&&S&&t.username===S.username&&!S.type&&t.symbol===S.symbol&&t.interval===S.interval&&y===M.data("is_reply")&&new Date(t.time)-new Date(S.time)<this.MESSAGES_CONCATENATION_TIMEOUT&&!this._messageTypeCustomizer.getTypeNames().includes(t.type)?(M.find(".ch-item-symbol").replaceWith(p.find(".ch-item-symbol")),M.find(".ch-item-time time").replaceWith(p.find(".ch-item-time time")),p.find(".ch-item-text").data(p.data()).data("short",!0).addClass("js-message-concatenated").attr("id",p.attr("id"))):p},rt.prototype.getMessagesData=function(t){var e=[lt(t.data("message"))];return t.find(".ch-item-text[id]").each((function(t,i){var s=$(i).data("message");s&&e.push(lt(s))})),e},rt.prototype.insertQuote=function(t,e){var i=this._$inputEdit.val().trim();this._$inputEdit.focus(),this._$inputEdit.val(i+(i.length?"\n":"")+'[quote="'+e.username.replace(/\s/g," ")+'"]'+this.getFullMessage(t,e)+"[/quote]\n"),this._$inputEdit.trigger("autosize.resize")},rt.prototype.getFullMessage=function(t,e,i){var s=[],o=i?P.removeBBCodes:P.removeQuotes;return s.push(o(e.text)),"snapshot"===e.meta.type&&s.push(e.meta.url),t.find(".js-message-concatenated").each((function(){var t=JSON.parse($(this).data("message"));s.push(o(t.text)),"snapshot"===t.meta.type&&s.push(t.meta.url)})),s.filter((function(t){return t})).join("\n")},rt.prototype.bindMessageMenu=function(t,e){var i=this,s=t.find(".js-settings");s.on("click",(function(o){o.stopPropagation(),s.hasClass("open")?s.trigger("hide-popup"):i.createMessageMenu(t,e,(function(t){s.trigger("show-popup",[t,!0])}))})),k(s,null,{event:"show-popup",hideEvent:"hide-popup",addClass:"ch-popup ch-item-settings-popup",careBottomBorder:!0,careRightBorder:!0})},rt.prototype.showReportDialog=function(t,e){var i=this.getFullMessage(t,e,!0),s={};this.isPrivate()||(s.additionalText=window.t("Posted in {0}.").format(this._roomTitle)),runOrSignIn(T.bind(null,e.username,"message",e.id.replace(/-/g,""),i,e.id,s),{source:"Chat report message",verifiedPhoneRequired:!0})},rt.prototype.prepareMessageMenu=function(t,e){var i,s=[],o=this;if(s.push({title:window.t("Quote this message"),action:function(){o.insertQuote(t,e)}}),s.push({title:window.t("Permanent link to this message"),action:function(){window.open("/chat/m/"+e.id.replace(/-/g,"")+"/")}}),user.id===e.user_id||this.isPrivate()||o.isStandalone()||s.push({title:window.t("Report this message"),action:this.showReportDialog.bind(this,t,e)}),(user.permissions.can_moderate_public_chats||user.id===e.user_id)&&s.push({title:window.t("Delete message"),action:function(){var e=o.getMessagesData(t);o._messagesIdsToBeDeletedBySelf=e,o._model.deleteMessage(e,null,(function(){o._messagesIdsToBeDeletedBySelf=null}))}}),s.push({separator:!0}),user.permissions.can_ban_people&&user.id!==e.user_id&&!e.is_moderator){var n=!!e.is_banned,a={unban:window.t("Unban __username__",{username:e.username}),ban:window.t("Ban __username__",{username:e.username})},r={title:n?a.unban:a.ban,action:function(){n?R(e.user_id,e.username,(function(){r.title=a.ban,n=!1
})):C(o.getFullMessage(t,e,!0),e,{modal:!0},(function(){r.title=a.unban,n=!0}))}};s.push(r),t.find(".ch-userlink, ch-item-userpic").on("userbanchange",(function(t,e){n=e,r.title=n?a.unban:a.ban}))}if(window.user.id!==e.user_id&&!e.is_moderator){var h=!!this._model.ignoredUsers()[e.user_id],d={ignore:window.t("Ignore __username__",{username:e.username}),unignore:window.t("Unignore __username__",{username:e.username})},l={title:h?d.unignore:d.ignore,action:function(){h?o._model.ignoreUser(e,!1,(function(t){t.error?B({title:window.t("Error"),content:t.error}):(l.title=d.ignore,h=!1)})):E({text:window.t("Are you sure you want to ignore messages from __username__?",{username:e.username}),onConfirm:function(t){return new Promise((function(i){o._model.ignoreUser(e,!0,(function(e){i(),t.dialogClose(),e.error?B({title:window.t("Error"),content:e.error}):(l.title=d.unignore,h=!0)}))}))}})}};s.push(l),t.find(".ch-userlink, ch-item-userpic").on("userignorechange",(function(t,e){h=e,l.title=h?d.unignore:d.ignore}))}(o.isStandalone()||o.isPrivate()||user.id===e.user_id||s.push({title:window.t("Send private message to __username__",{username:e.username}),action:function(){runOrSignIn(S.bind(this,e.user_id,e.username),{source:"Chat send private message",verifiedPhoneRequired:!0,doNotCheckSuspicious:!0})}}),o.isPrivate())||(i=user.id===e.user_id?window.t("Show all my messages"):window.t("Show all messages from __username__",{username:e.username}),s.push({title:i,action:function(){var t=new Date,i=t.getMonth()+1,s=t.getDate(),n=t.getFullYear()+"-"+(i<10?"0":"")+i+"-"+(s<10?"0":"")+s;window.open("/chat/history/?room="+o._model.room()+"&date="+n+"&tzoffset="+t.getTimezoneOffset()+"&usernames="+e.username)}}));return s[s.length-1].separator&&s.pop(),s},rt.prototype.createMessageMenu=function(t,e,i){var s=this;this._model.getBanStatus(e,(function(o,n){e.type&&!s._messageTypeCustomizer.getTypeNames().includes(e.type)||(e.is_banned=o&&n,i(s.prepareMessageMenu(t,e)))}))},rt.prototype._messageUnread=function(t){return new Date(t)>new Date(this._lastVisited)},rt.prototype.prependMessages=function(t,e){if(t.length){var i,s=this.getFirstMessages(1),o=s&&s.data("message");if(o)try{i=(o=JSON.parse(o)).username}catch(w){}var n,a,r,h=document.createDocumentFragment(),d=!1,l=!!this._lastVisited,c=t.reverse();if(c.forEach((function(t){var e=l&&this._messageUnread(t.time);if(e){var i=this._updateUnreadMarker(0);h.appendChild(i.get(0)),d=!0,l=!1}(this._isMessageFromIgnoredUser(t)||dt(t))&&this._invisibleMessagesNumber++;var s=this.createMessage(t,{markAsUnread:d,forceFullMessage:e,batch:0},h);if(s.length)if(s.data("short")){var o=this.getLastMessages(1,h).find(".ch-item-text:last");s.insertAfter(o)}else h.appendChild(s.get(0)),n=s}),this),this._messageUnread(c[0].time)||delete this._lastVisited,i&&n&&(a=n.data("message"))){try{r=(a=JSON.parse(a)).username}catch(w){}if(r&&r===i&&new Date(o.time)-new Date(a.time)<this.MESSAGES_CONCATENATION_TIMEOUT){var u=s.find(".ch-item-text");u.eq(0).attr("id",s.attr("id")),u.eq(0).data(s.data()),
u.insertAfter(n.find(".ch-item-text:last")),s.remove()}}for(var p=Object.values(h.childNodes),m=0;m<p.length;m++){var g=p[m],_=g.querySelector(".js-badge-wrapper");if(null!==_){var f=$(g).data("message");if(f&&0!==f.length){var v=JSON.parse(f);K(_,{badges:Q(v),size:J.Small,getTitle:G,getLink:X})}}}var b=this._$data.get(0);b.insertBefore(h,b.firstChild),e()}else e()},rt.prototype._getNewUnreadMarker=function(){return this._$unreadMarker?$():this._updateUnreadMarker(1)},rt.prototype._resetUnreadMarker=function(){this._$unreadMarker&&(this._$unreadMarker.remove(),delete this._$unreadMarker)},rt.prototype._updateUnreadMarker=function(t){return this._resetUnreadMarker(),this._$unreadMarker=$('<div class="js-unread-marker ch-unread-marker">'),this._scroll.subscribeToContentVisible("__marker__",this._$unreadMarker,function(e){if(e||this._bridge.postMessage("private_message_read",{id:"__marker__"}),this._checkMessageBatchQuantity(t))this._$unreadMarker.remove();else{this._$unreadMarker.addClass("js-vanish");var i=this._$unreadMarker;setTimeout((function(){i.remove()}),2500)}delete this._$unreadMarker}.bind(this)),this._$unreadMarker},rt.prototype._parseMessageTime=function(t){return s.utc(t,"ddd MMM DD hh:mm:ss YYYY","en").toDate()},rt.prototype.insertAtCursorPosition=function(t){var e=this._$inputEdit.val(),i=this._$inputEdit.prop("selectionStart");this._$inputEdit.val(e.slice(0,i)+t+e.slice(i)),this._$inputEdit.putCursorAtPosition(i+t.length).focus().trigger("autosize.resize")},rt.prototype.prepareLayout=function(t){var e=this;if(this._$container=t,this._$widget=$('<div class="tv-chat">').appendTo(t),this._$scrollContainer=$('<div class="tv-chat-scroll-container">').appendTo(this._$widget),this._$scrollContainer.on("contextmenu",(function(t){t.target.classList.contains("tv-chat-scroll-container")&&t.preventDefault()})),this._$data=$('<div class="ch-data no-messages">').appendTo(this._$scrollContainer),this._$data.on("click",".ch-item",(function(t){ct(t.target)||e.toggleHighlightUserMessages($(t.currentTarget))})).on("mouseenter",".ch-item",(function(){var t=$(this),e=t.find(".ch-item-info");t.find(".ch-item-header").width()-(t.find(".ch-item-author").width()+e.width())<t.find(".js-actions").width()&&e.addClass("js-hidden")})).on("mouseleave",".ch-item",(function(){$(this).find(".ch-item-info").removeClass("js-hidden")})),this._$input=$(),!this.isEmbedded()){if(this._bridge&&this._bridge.$headerspace)if(this.isPrivate()||this.isStandalone()||(this._$mentionsButton=$('<a class="button apply-common-tooltip" title="'+window.t("Show only my sent and received messages")+'" data-role="button" data-name="mentions"></a>').append($(i("JTGx")).attr({width:17,height:17})).appendTo(this._bridge.$headerspace),this._$mentionsButton.on("click",(function(t){return e.toggleMentionsOnly(),!1}))),
this._bridge.hideMaximize||(this._bridge.options||{}).hideMaximize||"function"!=typeof this._bridge.toggleMaximize||(this._$maximizeButton=$('<a class="button apply-common-tooltip" title="'+window.t("Maximize Chat")+'" data-role="button" data-name="maximize"></a>').append($(i("ZLE0")).attr({width:8,height:18})).appendTo(this._bridge.$headerspace),this._$maximizeButton.on("click",(function(t){e._bridge.toggleMaximize(),t.preventDefault()})),this._bridge.hideDetach||this._$maximizeButton.addClass("button-half"),this._bridge.maximized&&(this._onMaximized=function(t){e._$maximizeButton.toggleClass("active",!!t),e.resizeHeader(),e.resize()},this._bridge.maximized.subscribe(this._onMaximized),this._bridge.maximized.value()&&this._$maximizeButton.addClass("active"))),this._bridge.hideDetach||(this._$detachButton=$('<a class="button apply-common-tooltip svg-detach" title="'+window.t("Detach Chat")+'" data-role="button" data-name="detach"></a>').append($(i("zZbU")).attr({width:10,height:10})).appendTo(this._bridge.$headerspace),this._$detachButton.on("click touchend",(function(t){t.preventDefault(),rt.openBoundWindow({roomId:e.currentRoom(),isPrivate:function(){return e.isPrivate()}})})),this._$maximizeButton&&this._$detachButton.addClass("button-half button-nomarginleft")),this.isPrivate()){var s=this._bridge.isAuthor?window.t("Add/Remove people to this chat"):window.t("See the members of this chat");this._$addButton=$('<a class="button apply-common-tooltip" id="add-people" title="'+s+'" data-role="button" data-name="add-people">').append($(i("Lmvx")).attr({width:17,height:17})).append($('<span class="msg-window-members-count">').text(e._bridge.membersCount())).prependTo(this._bridge.$headerspace),this._$addButton.on("click",(function(t){t.preventDefault(),e._bridge.addPeople()}))}this._$inputWrap=$('<div class="ch-input">').appendTo(this._$widget),this._$progressBarWrap=$('<div class="progress-bar-wrap">').appendTo(this._$inputWrap),this._$progressBar=$('<div class="progress-bar">').appendTo(this._$progressBarWrap),this._$input=$('<div class="wrap">').appendTo(this._$inputWrap),this._$inputDisabledMessage=$('<div class="ch-disabled-message">'+window.t("Please use English for chatting. Check local versions to see if your language is supported.")+".</div>").prependTo(this._$inputWrap),this._$invalidLinkMessage=$('<div class="ch-disabled-message">'+window.t("Invalid link")+"</div>").prependTo(this._$inputWrap),this._$inputSnapshotLink=$('<div class="ch-snapshot-link"><a><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="Screenshot preview"></a><i class="icon icon-snapshot-small" title="Chart Snapshot"></i> <a target="_blank">'+window.t("Chart snapshot")+'</a><i class="icon icon-snapshot-delete" title="'+window.t("Delete")+'"></i> </div>').prependTo(this._$inputWrap),this._$inputSnapshotLink.find(".icon-snapshot-delete").on("click",this.attachSnapshot.bind(this)),this._$inputEditSizer=$('<div class="ch-textarea-sizer"></div>').appendTo(this._$input)
;var o=this.isPrivate()?window.t("Type your message here"):window.t("Have something to say?");this._$inputEdit=$('<textarea class="message-input" autocomplete="off" enterkeyhint="send"></textarea>'),this._$inputEdit.appendTo(this._$inputEditSizer).autosize({append:""}),this._$inputEdit.on("autosize.resized",(function(){var t=e._$inputEdit.height();if(t!==e._header_height){var i=e._$inputEdit.outerHeight();e._header_height=t,e._$input.height(i),e.resizeHeader()}})),this._$inputEdit.attr("placeholder",o),h(this._getHintListOptions()).then((function(t){e._hintListElement=t;var i=e._$container.parent().parent();$(e._hintListElement).appendTo(i),e._$inputEdit[0].addEventListener("keydown",(function(t){var i=st(t);if(i!==nt.ENTER||t.defaultPrevented||(t.preventDefault(),e.post()),i===nt.ENTER+ot.Mod||i===nt.ENTER+ot.Shift){t.preventDefault();var s=e._$inputEdit.val(),o=e._$inputEdit.prop("selectionStart");e._$inputEdit.val(s.slice(0,o)+"\n"+s.slice(o)).putCursorAtPosition(o+1).trigger("autosize.resize")}})),e._$inputEdit[0].addEventListener("paste",(function(){setTimeout((function(){e.checkInput()}),0)}))})),this._$snapshotButton=$('<span class="ch-snapshot-button" title="'+window.t("Attach chart snapshot")+'"></span>').append($(i("fitB")).attr({width:16,height:13})).on("click",this.attachSnapshot.bind(this)).on("contextmenu",(function(t){t.preventDefault()})).appendTo(this._$inputEditSizer),this._$smilesButton=$('<span class="ch-smiles-button" title="'+window.t("Insert emoticon")+'"></span>').append($(i("5Ucj")).attr({width:15,height:14})).on("click",this.showSmilesPopup.bind(this)).on("contextmenu",(function(t){t.preventDefault()})).appendTo(this._$inputEditSizer),this._bridge&&this._bridge.getChartWidget&&this._bridge.getChartWidget()||(this._$snapshotButton.hide(),this._$smilesButton.addClass("off-chart")),this._scroll=new x(this._$scrollContainer,this._$data,{vAlignBottom:!0,headerHeight:0}),this._onBridgeVisibleChange=function(t){if(t){if(setTimeout((function(){e._model&&e._model.setActive(t)}),1e3),!e.isPrivate()){var i=e._model.room();e._model.setRoom(""),e.updateRoom(i)}}else e._model.setActive(t);t&&e.isPrivate()&&e._model.setMessagesRead(),t&&(e._$inputEdit&&e._$inputEdit.trigger("autosize.resize"),e.resizeHeader(),e._notInitialVisible||(e._scroll.scrollToEnd(),e._notInitialVisible=!0),e.inputEditFocus())},this._bridge.visible.subscribe(this._onBridgeVisibleChange),$(window).on("visibilitychange",(function(t,i){i&&e.inputEditBlur()})),this._bridge.visible.value()&&(this._notInitialVisible=!0),this._scroll.scrolltostart.subscribe(this,(function(){e._model.isHistoryLoading()||e._isHistoryEnded||e._init_history_loading||e._loadChatHistory()})),is_authenticated&&user&&user.is_moderator&&this.prepareModeratorLayout(),this.sound=new r.ChatSoundControl(this.isPrivate()?"privatemessages.sound":"chat.sound"),this.progressBar=new r.ChatProgressBar(this._$progressBar,200,90,5,[200,200,400])}},rt.prototype._getHintListOptions=function(){
var t=this,e=this.isStandalone()?this._$container.parent()[0]:this._$container.parent().parent().parent()[0];return{fullBorder:!0,maxItems:5,suggestLimit:5,className:o.userNameHintList,closeOnMouseOutClick:!0,input:this._$inputEdit[0],container:e,onItemSelected:function(e,i,s){t._$inputEdit.val(i).putCursorAtPosition(s).trigger("autosize.resize")}}},rt.prototype.prepareModeratorLayout=function(){this._$warningTemplates=$('<a class="ch-button ch-warning-templates-button" title="'+window.t("Moderators Warning Messages")+'"><i>'+i("SmzL")+"</i></a>").on("click",this.warningTemplatesPopup.bind(this)).insertBefore(this._$inputEditSizer),this._$widget.addClass("moderator-layout"),this._$inputEdit.on("autosize.resized",function(){this._$inputEdit&&this._$warningTemplates.height(this._$inputEdit.height()+2)}.bind(this)),k(this._$warningTemplates,null,{event:"show-popup",hideEvent:"hide-popup",addClass:"ch-popup ch-warning-templates-popup",careRightBorder:!0,viewportSpacing:2,reverse:!0,popupDrift:68})},rt.prototype.warningTemplatesPopup=function(t){var e=M().map(function(t){return{title:t.name,action:this.initMessageTypeWarning.bind(this,t.text,t.id)}}.bind(this));e.push({title:window.t("Custom..."),action:this.initMessageTypeWarning.bind(this,"",null)}),e.push({separator:!0}),e.push({title:window.t("Cancel"),action:this.resetMessageType.bind(this)}),$(t.target).trigger("show-popup",[e]),t.stopPropagation()},rt.prototype.initMessageTypeWarning=function(t,e){(t=(this._$inputEdit.val()?this._$inputEdit.val()+" ":"")+t)&&this._$inputEdit.val(t).trigger("autosize.resize").putCursorAtEnd(),this._$inputWrap.addClass("custom-message-warning"),setTimeout(function(){this._$warningTemplates.addClass("active")}.bind(this),0),this._messageType="warning",this._warningType=e},rt.prototype.resetMessageType=function(t){this._$inputWrap[0].className=this._$inputWrap[0].className.replace(/\bcustom-message-.*?\b/g,""),this._$warningTemplates.removeClass("active"),delete this._messageType,delete this._warningType},rt.prototype._showSettingsDialog=function(t,e){return $(t.delegateTarget).hasClass("open")?($(t.delegateTarget).trigger("hide-popup"),!1):(new r.ChatSettingsDialog(this._bridge,(function(e,i){$(t.delegateTarget).trigger("show-popup",[e,i])}),e||this._model.getRooms()),t.preventDefault(),!1)},rt.prototype.editRoom=function(t){i("debi").prototype.showEditRoomDialog.call(this,t)},rt.prototype.deleteRoom=function(t){var e=this;E({text:window.t("Are you sure you want to delete room '{name}' ?").format({name:t.title}),onConfirm:function(i){return new Promise((function(s){e._model.deleteRoom(t.room_id,(function(t){s(),i.dialogClose(),t.error&&B({title:window.t("Error"),content:t.error})}))}))}})},rt.prototype.saveInputText=function(){var t=this._$inputEdit.val().trim();t&&(window.user._chatInputs[this.currentRoom()]=t)},rt.prototype.restoreInputText=function(){this.currentRoom()in window.user._chatInputs&&(this._$inputEdit.val(window.user._chatInputs[this.currentRoom()]),this._$inputEdit.trigger("autosize.resize"),
delete window.user._chatInputs[this.currentRoom()])},rt.prototype.selectChannel=function(t){if(!this._checkRoom(t))throw new Error("Chat room not found");if(this._roomTitle=this.getRoomTitle(t),this._bridge&&this._bridge.properties&&this._bridge.properties.setValue){var e=this._bridge.properties.value()||{};e.room=t,this._bridge.properties.setValue(e)}this.updateRoom(t)},rt.prototype._checkRoom=function(t){return!!(this._model.getRoomById(t)||t.match(/pm_*/)||t.match(/live_*/))},rt.prototype.getText=function(t){return this._$inputEdit.val()||t},rt.prototype.clearInput=function(){this._$inputEdit.val("")},rt.prototype.post=function(t){var e=this,i=e._postMeta||{text:""};if(this.checkInput(),!this._inputDisabled){var s=this.currentRoom(),o=this._model.getRoomById(s);e._sheduledSending=function(){var a=t||e._$inputEdit.val();if(!a&&!i.text)return!1;e._$inputEdit.val("").trigger("autosize.resize"),"snapshot"!==i.type&&a&&e.inputEditFocus();var r={};e._messageType&&(r.messageType=e._messageType,e._warningType&&(r.warningType=e._warningType),e.resetMessageType());var h=(new Date).getTime();e.progressBar.start(h),e._model.sendMessageToRoom(s,a,i,r,(function(t){var s=t.error||t.warning;if(s){var r=t.title;n({title:t.error?r||window.t("Error"):r||window.t("Warning"),html:s,onClose:function(){e.inputEditFocus()}}).then((function(){e.inputEditBlur(),e._$inputEdit.val(a).trigger("autosize.resize"),e.progressBar.finishOnError(h)}))}else e.progressBar.finish(h),z(o,a,i)}),(function(){e.progressBar.finishOnError(h),B({title:window.t("Error"),content:window.t("There was an error posting your message.")}),e._$inputEdit.val(a).trigger("autosize.resize")})),e._postMeta=null,e._$snapshotButton.removeClass("active"),e._$inputSnapshotLink.hide(),e.resizeHeader()};var a={source:"Chat post message",sourceMeta:this.getChartWidgetCollection()?"Chart":null,verifiedPhoneRequired:!0,doNotCheckSuspicious:!0,customPhoneCheck:function(){if(!e.currentRoom().startsWith("live_"))return!1;return(!Z("check_chat_rep_all_locales")&&"en"!==window.language||!(user.max_user_language_reputation<4.5))&&!user.has_phone}};return runOrSignIn((function(){e._sheduledSending&&e._sheduledSending(),e._sheduledSending=null}),a),!1}},rt.prototype.resize=function(t){this._scroll.resize(),this._$inputEdit&&this._$inputEdit.trigger("autosize.resize")},rt.prototype.updateTitle=function(t){this._bridge&&this._bridge.setTitle&&this._bridge.setTitle(this._roomTitle)},rt.prototype.validateLanguageCheck=function(t){var e=!1;if("en"===window.language){var i=this._model.getRoomById(this.currentRoom());e=!!i&&!!i.pinned&&!A(t)}return e},rt.prototype.checkInput=function(){var t=this._$inputEdit.val(),e=this.validateLanguageCheck(t),i=it(t);this._$inputEdit.toggleClass("disabled",e||!i),this._$inputDisabledMessage.toggle(e),this._$invalidLinkMessage.toggle(!i),e!==this._inputDisabled&&this.resizeHeader(),this._inputDisabled=e||!i},rt.prototype.resizeHeader=function(){this._$scrollContainer.css("bottom",this._$inputWrap.outerHeight()),this._scroll.resize()},
rt.prototype.getChartWidgetCollection=function(){return this._bridge&&this._bridge.getChartWidgetCollection&&this._bridge.getChartWidgetCollection()},rt.prototype.attachSnapshot=function(){var t=this,e=this.getChartWidgetCollection();if(e){if(t._postMeta)t._postMeta=null,t._$snapshotButton.removeClass("active"),t._$inputSnapshotLink.hide(),t.resizeHeader();else{var i=function(){t._$snapshotButton.removeClass("loading")},s={previews:["thumb"],onInvalidSnapshotImage:i};t._$snapshotButton.addClass("loading"),f(e,(function(e){var i=H.createSnapshotImageUrls(e);t._postMeta={text:window.t("Chart Snapshot"),url:i.url,preview_url:i.preview,type:"snapshot"},t._$snapshotButton.removeClass("loading").addClass("active");var s=t._$inputSnapshotLink.show().find("a");s.attr("href",i.url),U({$elem:s,type:"image",live:!1}),t._$inputSnapshotLink.find("img").attr("src",i.url).on("load",t.resizeHeader.bind(t)),t.inputEditFocus()}),i,s)}return!1}},rt.prototype.toggleSnaphotPreview=function(t){this._showSnapshotPreview=void 0!==t?t:!this._showSnapshotPreview,TVSettings.setValue("chat.show_snapshot_preview",this._showSnapshotPreview),this._$widget.toggleClass("show-snapshot-preview",this._showSnapshotPreview),this.resize()},rt.prototype.toggleHighlightUserMessages=function(t){var e=t.attr("class").match(/ch-item-user-(\d+)/)[1],i=!t.hasClass("ch-highlight-user");$(".ch-item").removeClass("ch-highlight-user"),e&&i&&this._$data.find(".ch-item-user-"+e).addClass("ch-highlight-user")},rt.prototype.destroy=function(){this._isHistoryEnded=!0,this.isPrivate()&&this.saveInputText(),this._sheduledSending&&(this._sheduledSending(),this._sheduledSending=null),this._model.messageReceived().unsubscribe(this,this._onMessageWrapper),this._model.messageDeleted().unsubscribe(this,this._onMessageDeleted),this._model.roomChanged().unsubscribe(this,this._onRoomChanged),this._model.destroy(),this._model=null,window.loginStateChange.unsubscribeAll(this),this._scroll.scrolltostart.unsubscribeAll(this),this._bridge.visible.unsubscribe(this._onBridgeVisibleChange),this._bridge.symbol&&this._onSymbolChanged&&this._bridge.symbol.unsubscribe(this._onSymbolChanged),this._bridge.interval&&this._onIntervalChanged&&this._bridge.interval.unsubscribe(this._onIntervalChanged),this._bridge.height&&this._onResize&&this._bridge.height.unsubscribe(this._onResize),this._bridge.width&&this._onResize&&this._bridge.width.unsubscribe(this._onResize),this._bridge.maximized&&this._onMaximized&&this._bridge.maximized.unsubscribe(this._onMaximized),this.destroyLikesHandlers(),F.jQueryCompatibleDestroy(this._$data),this.sound.destroy(),this._bridge&&this._bridge.$headerspace&&this._bridge.$headerspace.empty(),l(this._hintListElement)},rt.prototype.showLinkToChat=function(t){var e=window.location.protocol+"//"+window.location.host+"/chat/#"+t.room_id;q.showCustomDialog({width:300,title:window.t("Link to __room__ chat",{room:TradingView.clean(t.title)}),html:'<form><input type="text" value="'+e+'"/></form>'})},rt.openBoundWindow=function(t){var e=""
;e=t.isPrivate()?"/chat/"+t.roomId+"/":"/chat/#"+t.roomId,b.open({url:e,parameters:{menubar:!1,location:!1,status:!1,directories:!1,width:470,height:600}}),W("GUI","Chat Detached")},rt.prototype.toggleMentionsOnly=function(){this._mentionsOnly=!this._mentionsOnly,this._$data.toggleClass("mentions-only"),this._scroll.scrollToEnd(),this._$mentionsButton.toggleClass("active")},rt.prototype.showSmilesPopup=function(t){var e=this,i=$('<div class="ch-smiles-popup">').appendTo(document.body);I.each((function(t){if(t.showInPopUp){var e=$('<div class="emoji-container js-emoji" title="'+t.code+'">');e.data("code",t.code),e.append(I.getElement(t)),e.appendTo(i)}})),i.on("click",".js-emoji",(function(t){var s=e._$inputEdit.val(),o=e._$inputEdit.prop("selectionStart"),n=o>0&&" "!==s.charAt(o-1)?" ":"",a=o<s.length&&" "!==s.charAt(o)?" ":"";e.insertAtCursorPosition(n+$(t.target).closest(".js-emoji").data("code")+a),i.remove()}));var s=this._$smilesButton.offset(),o=this._$smilesButton.outerWidth(),n=this._$smilesButton.outerHeight(),a=s.top+n/2,r=s.left+o/2,h=15,d=i.outerHeight(),l=i.outerWidth(),c="top",u=!0,p=r-l/2,m=$(document).width(),g=$(window).width();p+l+10>g&&(p=g-(l+10),m-r<20&&(u=!1,h=10));var _=a+h,f=$(window).height(),v=$(window).scrollTop(),b=$(window).scrollLeft();_-v+d+h>f&&(_=a-d-h,c="bottom"),u&&$('<div class="ch-smiles-caret ch-smiles-caret-'+c+'">').css("left",r-p-b).prependTo(i),i.css({left:p+b,top:_}).on("mousedownoutside",(function(){i.remove()}))},rt.prototype.inputEditFocus=function(){Modernizr.mobiletouch||this._noAutoFocus||this._$inputEdit&&this._$inputEdit.focus()},rt.prototype.inputEditBlur=function(){this._$inputEdit&&this._$inputEdit.blur()},rt.getLaunchInSeparateWindowAction=function(t,e){return{title:window.t("Launch Chat in a Separate Window"),action:function(){rt.openBoundWindow({roomId:t,isPrivate:e})}}},rt.prototype.destroyLikesHandlers=function(){this._chartLikesHandler&&this._chartLikesHandler.destroy(),this._snapshotMessagesLikesHandler&&this._snapshotMessagesLikesHandler.destroy()},rt.prototype.updateLikesHandlers=function(){this.destroyLikesHandlers(),this._chartLikesHandler=r.ChatLikesHandler.getChartsHandler(),this._snapshotMessagesLikesHandler=r.ChatLikesHandler.getMessagesSnapshotsHandler()},t.exports=rt}).call(this,i("nbsC"),i("ldgD"))},fF31:function(t,e,i){t.exports=i.p+"4d973dad10589f7ebe1b822250d26eb8.png"},fitB:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 11.5" width="20" height="16"><path d="M7.5 4.8c-1.1 0-1.9.9-1.9 1.9s.9 1.9 1.9 1.9c1.1 0 1.9-.9 1.9-1.9s-.9-1.9-1.9-1.9zM13 1.9h-2.2c0-1-.9-1.9-2-1.9H6.1C5 0 4.2.9 4.2 1.9H1.9c-1 0-1.9.9-1.9 2v5.7c0 1.1.9 1.9 1.9 1.9H13c1.1 0 1.9-.9 1.9-1.9V3.9c.1-1.1-.8-2-1.9-2zm-5.5 8.3C5.6 10.2 4 8.6 4 6.7s1.5-3.4 3.4-3.4 3.4 1.5 3.4 3.4c.1 1.9-1.4 3.5-3.3 3.5z"/></svg>'},"gCS/":function(t,e){
t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 973.125"><path d="M960 832L710.875 582.875C746.438 524.812 768 457.155 768 384 768 171.97 596 0 384 0 171.97 0 0 171.97 0 384c0 212 171.97 384 384 384 73.156 0 140.812-21.562 198.875-57L832 960c17.5 17.5 46.5 17.375 64 0l64-64c17.5-17.5 17.5-46.5 0-64zM384 640c-141.375 0-256-114.625-256-256s114.625-256 256-256 256 114.625 256 256-114.625 256-256 256z"/></svg>'},hWl2:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setTabIcon=function(t){$('link[rel="shortcut icon"]').attr("href",t)};e.TAB_ICON_URLS={UNREAD_MESSAGES:"/static/images/favicon/unread_messages/favicon.ico",DEFAULT:"/favicon.ico"}},lNJX:function(t,e,i){},"n5P/":function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" width="27" height="16"><g fill="none"><rect width="27" height="16" fill="#2196F3" rx="8"/><path stroke="#FFF" stroke-linejoin="round" d="M8.5 3.5h6a2 2 0 0 1 2 2v1l4-2v7l-4-2v1a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2z"/><path fill="#FFF" fill-rule="nonzero" d="M20 5.309l-3.276 1.638A.5.5 0 0 1 16 6.5v-1A1.5 1.5 0 0 0 14.5 4h-6A1.5 1.5 0 0 0 7 5.5v5A1.5 1.5 0 0 0 8.5 12h6a1.5 1.5 0 0 0 1.5-1.5v-1a.5.5 0 0 1 .724-.447L20 10.69V5.309zM17 10.5a2.5 2.5 0 0 1-2.5 2.5h-6A2.5 2.5 0 0 1 6 10.5v-5A2.5 2.5 0 0 1 8.5 3h6A2.5 2.5 0 0 1 17 5.5v.191l3.276-1.638A.5.5 0 0 1 21 4.5v7a.5.5 0 0 1-.724.447L17 10.31v.191z"/></g></svg>'},oHcy:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34 34" width="34px" height="34px"><path d="M21.197 2.06c-7.07 0-12.8 5.83-12.8 13.027 0 7.14 5.644 12.934 12.638 13.024v5.545l8.747-8.902A13.208 13.208 0 0 0 34 15.03C34 7.832 28.267 2 21.197 2zM10.463 27.674v-1.58l-1.275-.017c-3.642-.046-6.606-3.1-6.606-6.806 0-3.052 1.986-5.643 4.71-6.504.16-.984.417-1.935.764-2.844C3.518 10.52 0 14.45 0 19.246c0 4.7 3.433 8.64 7.88 9.33V34l6.377-6.49a14.307 14.307 0 0 1-2.146-1.533l-1.643 1.674z"/></svg>'},ovEV:function(t,e,i){t.exports={userNameHintList:"userNameHintList-TTHSrMMH"}},pay7:function(t,e,i){},uafl:function(t,e){
t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><g fill="currentColor" fill-rule="evenodd"><path fill-rule="nonzero" d="M14 17a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/><path d="M5.005 16A1.003 1.003 0 0 1 4 14.992v-1.984A.998.998 0 0 1 5 12h1.252a7.87 7.87 0 0 1 .853-2.06l-.919-.925c-.356-.397-.348-1 .03-1.379l1.42-1.42a1 1 0 0 1 1.416.007l.889.882A7.96 7.96 0 0 1 12 6.253V5c0-.514.46-1 1-1h2c.557 0 1 .44 1 1v1.253a7.96 7.96 0 0 1 2.06.852l.888-.882a1 1 0 0 1 1.416-.006l1.42 1.42a.999.999 0 0 1 .029 1.377s-.4.406-.918.926a7.87 7.87 0 0 1 .853 2.06H23c.557 0 1 .447 1 1.008v1.984A.998.998 0 0 1 23 16h-1.252a7.87 7.87 0 0 1-.853 2.06l.882.888a1 1 0 0 1 .006 1.416l-1.42 1.42a1 1 0 0 1-1.415-.007l-.889-.882a7.96 7.96 0 0 1-2.059.852v1.248c0 .56-.45 1.005-1.008 1.005h-1.984A1.004 1.004 0 0 1 12 22.995v-1.248a7.96 7.96 0 0 1-2.06-.852l-.888.882a1 1 0 0 1-1.416.006l-1.42-1.42a1 1 0 0 1 .007-1.415l.882-.888A7.87 7.87 0 0 1 6.252 16H5.005zm3.378-6.193l-.227.34A6.884 6.884 0 0 0 7.14 12.6l-.082.4H5.005C5.002 13 5 13.664 5 14.992c0 .005.686.008 2.058.008l.082.4c.18.883.52 1.71 1.016 2.453l.227.34-1.45 1.46c-.004.003.466.477 1.41 1.422l1.464-1.458.34.227a6.959 6.959 0 0 0 2.454 1.016l.399.083v2.052c0 .003.664.005 1.992.005.005 0 .008-.686.008-2.057l.399-.083a6.959 6.959 0 0 0 2.454-1.016l.34-.227 1.46 1.45c.003.004.477-.466 1.422-1.41l-1.458-1.464.227-.34A6.884 6.884 0 0 0 20.86 15.4l.082-.4h2.053c.003 0 .005-.664.005-1.992 0-.005-.686-.008-2.058-.008l-.082-.4a6.884 6.884 0 0 0-1.016-2.453l-.227-.34 1.376-1.384.081-.082-1.416-1.416-1.465 1.458-.34-.227a6.959 6.959 0 0 0-2.454-1.016L15 7.057V5c0-.003-.664-.003-1.992 0-.005 0-.008.686-.008 2.057l-.399.083a6.959 6.959 0 0 0-2.454 1.016l-.34.227-1.46-1.45c-.003-.004-.477.466-1.421 1.408l1.457 1.466z"/></g></svg>'},wGB7:function(t,e,i){},wr2L:function(t,e,i){"use strict";i.r(e),i.d(e,"lazyFancybox",(function(){return s}));i("P5fv"),i("xMPI");function s(t){var e=function(i){var s=$(i.currentTarget);i.preventDefault(),i.stopPropagation(),o((function(){void 0!==t.$elem&&(t.$elem.off({click:e}),t.$elem.fancybox(t)),s.click()}))};"function"!=typeof $.fancybox?void 0!==t.$elem?t.$elem.one({click:e}):o((function(){$.fancybox(t)})):void 0!==t.$elem?t.$elem.fancybox(t):$.fancybox(t)}function o(t){i.e(385).then(function(e){i("rQie"),t()}.bind(null,i)).catch(i.oe)}},xMPI:function(t,e,i){},xNaP:function(t,e,i){},yr01:function(t,e){
t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 670 745"><path d="M417.91 738.04c-118.64-22.82-190.57-47.072-218.92-73.807-22.734-21.44-24.27-32.633-24.27-176.81 0-88.1 1.86-140.31 5.373-150.86 11.138-33.44 36.66-57.735 133.93-127.5 67.296-48.267 90.59-69.93 140.55-130.72C509.177 11.903 521.965.078 539.24.046c16.013-.03 25.43 13.07 32.622 45.373 7.83 35.164-3.512 82.774-30.952 129.93-40.764 70.052-39.008 75.19 31.705 92.733 49.08 12.178 81.767 30 91.884 50.097 8.98 17.844 7.335 39.84-7.633 102.04-7.523 31.264-15.156 66.454-16.962 78.203-1.806 11.748-11.588 46.504-21.738 77.236s-18.454 58.25-18.454 61.152c0 8.677-33.212 71.96-44.153 84.13-22.217 24.715-68.287 30.435-137.65 17.093zm-345.68-25.9c-5.722-2.5-22.273-14.2-36.78-26.03-14.506-11.88-28.418-21.59-30.914-21.59-2.82 0-4.538-65.6-4.538-173.26 0-95.29 1.752-173.25 3.893-173.25 2.144 0 17.104-11.498 33.248-25.552 30.614-26.65 49.608-34.114 68.466-26.907 16.703 6.386 18.065 16.296 7.704 56.06-8.34 32-9.423 51.51-9.423 169.55 0 131.23.62 138.49 16.636 194.72 5.75 20.178-24.144 36.41-48.29 26.22z"/></svg>'},zZbU:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 586.09999 586.09996" width="586.1" height="586.1" enable-background="new 0 0 595.3 841.9"><path d="M0 586.1h117.2l351.7-351.7 117.2 117.3V0H234.4l117.3 117.2L0 468.9z"/></svg>'}}]);