webpackJsonp([20],{1074:function(t,e,i){"use strict";var n=i(5);t.exports.displayedExchangesFilter=function(t){return n.enabled("symbol_search_limited_exchanges")&&(t=t.filter(function(t){return!("bitcoin"===t.flag||t.hideInSymbolSearch)})),t},t.exports.sortExchangesListByFlagIfNeeded=function(t){return t}},1075:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),i.d(e,"types",function(){return n});var n={ECONOMIC:"economic",QUANDL:"quandl"}},332:function(t,e,i){"use strict";(function(e){function n(){if("undefined"==typeof tradingService)return null;var t=tradingService();return t&&t.connectStatus()===CONNECTSTATUSES.CONNECTED?t.activeBroker():null}function o(){var t=n();if(t&&t.metainfo().configFlags.supportSymbolSearch)return t.metainfo().symbolSearchId||t.metainfo().id.toLowerCase()}function s(t){d(t),u.interval.setValue(t)}function a(t){return S[t.prefix||t.exchange]||t.exchange||""}function l(){var t=TVSettings.getValue("symboledit.exchangefilter");return/_MINI$/.test(t)?"":t}function r(t,e){return e in t||(t[e]="bitcoin"===e?window.t("crypto"):window.t(e)),t[e]}var c=i(61),d=c.setLastUsedResolution,u=i(62).linking,p=i(1074),h=i(307),g=i(305).Spinner,f=i(132),m=i(322).regExpEscape,_=i(1075),v=i(192),y=i(106).isFeatureEnabled,b=i(883).TVOldDialogs,C=i(311).globalKeypressMatches,x=i(311).sanitizeIntervalValue,k=i(311).canShowSpreadActions,w=y("futures-descriptions"),I=1e3,T='
',S={},E=/^(\w{3,4}) (\d{4})$/,D=function(){function t(i){var n,o,s,a;if(!(this instanceof t))throw new TypeError("SymbolSearch is a constructor");if(i=i||{},n=!i.dontUseInputParser&&e.enabled("symbol_search_parser_mixin")&&k(),this._inputParserMixin=n?new SymbolSearchInputParserMixin(this):void 0,this._inputElement=$(i.input).get(0),!this._inputElement)throw new TypeError("options.input must be a DOM element, jQuery object or selector");if(this.$list=$(i.list).eq(0),0===this.$list.size()&&delete this.$list,void 0!==i.callback){if("function"!=typeof i.callback)throw new TypeError("options.callback must be function");this._callback=i.callback}if(void 0!==i.onValueChanged){if("function"!=typeof i.onValueChanged)throw new TypeError("options.onValueChanged must be function");this._onValueChanged=i.onValueChanged}if(void 0!==i.onEmptyApply){if("function"!=typeof i.onEmptyApply)throw new TypeError("options.onEmptyApply must be function");this._onEmptyApply=i.onEmptyApply}if(i.ignoreInterval&&(this._ignoreInterval=!0),t.resetStoredInterval(),i.hidePro&&(this._hidePro=!0),i.allowMultipleSymbols&&(this._allowMultipleSymbols=!0),void 0!==i.onParse){if("function"!=typeof i.onParse)throw new TypeError("options.onParse must be function");this._onParse=i.onParse}for(this._state={},this._resolveViaSymbolSearchId=null,this.acceptEmpty=!!i.acceptEmpty,$(this._inputElement).data("symbol-search-instance",this), o=this._boundListener=this._eventListener.bind(this),s=this.boundTimeoutListener=function(t){setTimeout(function(){o(t)},0)},a=0;a0&&(i=n[0].value),0!==n.length&&(n.forEach(function(n){var o=n.value,s=$('').attr("href","#"+o).text($.t(n.name));o===i&&s.addClass("active"),s.on("click",function(i){i.preventDefault(),e.find(".type-filter").removeClass("active"),$(this).addClass("active"),t.typeFilter(o),TVSettings.setValue("symboledit.filter",o)}),s.appendTo(e)}),t.typeFilter(i),!0)}function c(t,e){var i,n,o=ChartApiInstance.supportedExchangesList();if(o.reduce(function(t,e){return t[e.value]=e.name,t},S),i=l(),"bovespa"!==TradingView.widgetCustomer)return 0!==o.length&&(n=$('
').appendTo(e),F(t,o,i,n),t.setExchangeFilter(i),!0)}function d(t){var e=c(t,t.$filterContainer);return t.selectExchangeFilter(),e}function I(t){var e,n,o,s,a,l,r,c,u,p,h=$('
').appendTo(document.body),g=$('
').appendTo(h);return t.$filterContainer=g,i(t,g),d(t,g),e=$('
').appendTo(h),n=$(t._inputElement),o=n.offset(),s=0,a=Math.max(0,Math.min(o.left+s,$(window).width()-h.outerWidth())),h.css("left",a+"px"),h.css("top",o.top+n.outerHeight()+1),l=g.outerHeight(),r=$(window).scrollTop(),c=n.height(),u=TradingView.isMobile.any()?parseInt(window.screen.height,10):parseInt($(window).height(),10),p=u-(o.top-r)-c/2,e.css("maxHeight",p-c-l+"px"),{popup:h,listWrapper:e}}function D(t,e,i){this._container=t,this._tickerRegExp=e,this._translationCache=i,this._exchangeNameCache=this._roots={},this._itemsByTicker={}}var O,A,F,L=[{name:"input",immediate:!0},{name:"sync",immediate:!0},{name:"keypress"},{name:"keydown"},{name:"keyup"},{name:"mousedown"},{name:"mouseup"},{name:"cut"},{name:"paste"}],M=!0;return M=!1,O=[/^e\-m/i],A=/<\/?[^>]+(>|$)/g,t.registerAutoFocus=function(e){if(e instanceof jQuery&&(e=e.data("symbol-search-instance")),!(e instanceof t))throw new TypeError("arg must be an SymbolSearch instance of jQuery input with bound SymbolSearch object");h.registerListener("symbolEdit",function(t){if(C(t)){t.preventDefault(),this.resetState(),this._skipAutoFocus=!0,this._inputElement.focus();var e=String.fromCharCode(t.charCode);"function"==typeof this._setInputValue?this._setInputValue(e):this._inputElement.value=e,this._eventListener()}}.bind(e))},t.prototype.searchRequestDelay=0,t.setSearchRequestDelay=function(e){ t.prototype.searchRequestDelay=e},t.prototype.resetState=function(){this._state={}},t.prototype.typeFilter=function(t){if(!(arguments.length>0))return this._state.typeFilter;t!==this._state.typeFilter&&(null==t?delete this._state.typeFilter:this._state.typeFilter=t+"",delete this._state.keepListFor,this._onSelectionChanged(),this.selectExchangeFilter())},t.prototype.setExchangeFilter=function(t){t!==this._state.exchangeFilter&&(null==t?delete this._state.exchangeFilter:this._state.exchangeFilter=t+"",delete this._state.keepListFor,this._onSelectionChanged())},t.prototype.setTradableFilter=function(t){t!==this._state.tradableFilter&&(this._state.tradableFilter=t,this._onSelectionChanged())},t.prototype.getExchangeFilter=function(){return this._state.exchangeFilter},t.prototype.destroy=function(){$(this._inputElement).off(),$(this._inputElement).removeData("symbol-search-instance")},t.prototype._moveSelection=function(t,e){var i,n,o,s,a,l,r,c,d;this.$list&&(i=this.$list.find("table.symbol-edit-popup"),n=i.find("tr:not(.hidden)"),o=i.find("tr.symbol-edit-popup-active").removeClass("symbol-edit-popup-active"),s=0!==o.length?n.index(o):-1,a=1===t?o.get(0)===n.get(-1)?0:s+t:Math.max(-1,s+t),s!==a&&(l=n.get(a))&&(r=this._getItemByElement(l),c=D.isRoot(r),c?(d=l.getAttribute("data-root"),l.classList.add("symbol-edit-popup-active"),this._scrollHighlightIntoView(),d?(this._state.highlightedItem=null,this._selectedGroupRoot=d):(this._state.highlightedItem=r,this._replaceCurrentSymbol(e))):(delete this._selectedGroupRoot,this._highlightItem(r,!0,e))))},t.prototype._groupToggleCollapsed=function(t,e){this._groupListHandler&&this._groupListHandler.toggleCollapsed(t,e)},t.prototype._onKeyDown=function(t){t.keyCode!==v.DOWN_ARROW&&t.keyCode!==v.UP_ARROW||(this._moveSelection(t.keyCode===v.DOWN_ARROW?1:-1,!0),t.preventDefault(),t.stopPropagation()),t.keyCode===v.ENTER&&t.stopPropagation(),!this._selectedGroupRoot||t.keyCode!==v.LEFT_ARROW&&t.keyCode!==v.RIGHT_ARROW||(this._groupToggleCollapsed(this._selectedGroupRoot,t.keyCode===v.LEFT_ARROW),t.preventDefault())},t.prototype._onKeyPress=function(t){if(t.keyCode===v.DOWN_ARROW||t.keyCode===v.UP_ARROW){if(t.charCode)return;if(this._boundOnKeyDown)return $(this._inputElement).off("keydown",this._boundOnKeyDown),delete this._boundOnKeyDown,void t.preventDefault();this._moveSelection(t.keyCode===v.DOWN_ARROW?1:-1),t.preventDefault()}t.keyCode===v.ENTER&&(this._selectedGroupRoot?(this._groupToggleCollapsed(this._selectedGroupRoot,!1),t.preventDefault()):this.acceptTypeIn())},t.prototype._eventListener=function(t,i){var n,o,s,a,l,r=this._inputElement,c=this._getInputValue();e.enabled("uppercase_instrument_names")&&(c=c.toUpperCase()),n=!1,o=!1,this._state.value!==c&&(this._state.hasOwnProperty("value")&&this._onValueChanged&&this._onValueChanged(c),this._state.value=c,n=!0,this._inputParserMixin&&this._inputParserMixin.parse()),this._fixIntervalCase(),s=this._limitInputSelectionValue("selectionStart"),this._state.selectionStart!==s&&(this._state.selectionStart=s,o=!0), a=this._limitInputSelectionValue("selectionEnd"),this._state.selectionEnd!==a&&(this._state.selectionEnd=a,o=!0),this._state.selectionDirection!==r.selectionDirection&&(this._state.selectionDirection=r.selectionDirection,o=!0),(n||o&&this._inputParserMixin)&&(this._onSelectionChanged(void 0,i),l=!1,this._getInputValue()!==this._state.value&&(this._setInputValue(this._state.value),l=!0),(l||this._state.selectionStart!==this._limitInputSelectionValue("selectionStart")||this._state.selectionEnd!==this._limitInputSelectionValue("selectionEnd"))&&r.setSelectionRange&&r.setSelectionRange(this._state.selectionStart,this._state.selectionEnd,this._state.selectionDirection))},t.prototype._fixIntervalCase=function(){if(this._selectionInsideInterval()){var e=t.detachInterval(this._inputElement.value);/[a-z]/.test(e.detached)&&(this._inputElement.value=e.rest+e.detached.toUpperCase())}},t.prototype._selectionInsideInterval=function(e){if(this._ignoreInterval)return!1;var i=t.detachInterval(this._inputElement.value);return!!i&&("string"==typeof e?this._inputElement[e]>i.rest.length:this._inputElement.selectionStart>i.rest.length&&this._inputElement.selectionEnd>i.rest.length)},t.prototype._limitInputSelectionValue=function(e){return this._selectionInsideInterval(e)?t.detachInterval(this._inputElement.value).rest.length:e in this._inputElement?this._inputElement[e]:this._inputElement.value.length},t.prototype._getInputValue=function(){if(this._ignoreInterval)return this._inputElement.value;var e=t.detachStoreInterval(this._inputElement.value);return $(this._inputElement).toggleClass("interval-error",t.intervalError()),e},t.prototype._setInputValue=function(e){this._ignoreInterval?this._inputElement.value=e:this._inputElement.value=t.recallAttachInterval(e)},t.prototype._onSelectionChanged=function(t,e){function i(t,e,i,n,s){o._state.contextTicker=t,o._state.contextExchange=e,o._state.contextType=i,o._state.contextTradable=s,o._state.keepListFor&&o._state.keepListFor===n||(o._getSuggestList(),delete o._state.keepListFor)}var n,o=this;!O.some(function(t){return t.test(o._state.value)})&&(this._isSpreadInInput()||this._inputParserMixin&&!0!==e)?this._inputParserMixin.onSelectionChanged(i):this.$list&&(this._state._selectedTicker=null,n=this._state.value,this._isSpreadInInput()&&this._state.contextToken&&(n=this._state.contextToken.value),i(n,this.getExchangeFilter(),this._state.typeFilter,n,this._state.tradableFilter))},t.prototype._clearSelectionState=function(){delete this._state.contextTicker,delete this._state.contextExchange,delete this._state.contextType,delete this._state.contextToken,delete this._state.keepListFor},t.prototype._clearSearchTimeout=function(){this._searchTimeout&&(clearTimeout(this._searchTimeout),this._searchTimeout=null)},t.prototype._doGetSuggestList=function(){var t,e,i,s,a,l,r,c,d;this._clearSearchTimeout(),t=o(),e=this._state.contextTicker||"",i=this._state.contextExchange||this.getExchangeFilter()||"",s=this._state.typeFilter||"",a=t&&this._state.tradableFilter, l=t&&n().metainfo().unhideSymbolSearchGroups,r=l&&l.join(","),t&&tradingService().trackEvent("Symbol Search Tradable checkbox",a?"on":"off"),c=window.language||"",this._showLoading(),d=this,ChartApiInstance.searchSymbols(e,i,s,c,M,!1,t,a,r,function(t){e!==(d._state.contextTicker||"")||i!==(d._state.contextExchange||d.getExchangeFilter()||"")||s!==(d._state.typeFilter||"")||(s===_.types.QUANDL&&(t=d._processQuandlResponse(t)),d._renderSuggestList(t),d._onResponse(t))})},t.prototype._getSuggestList=function(){this._clearSearchTimeout(),this._searchTimeout=setTimeout(this._doGetSuggestList.bind(this),t.prototype.searchRequestDelay)},t.prototype._showLoading=function(){if(this.$list&&!this._spinner){this._clearSuggestList();var t=$('
').appendTo(this.$list);this._spinner=new g("medium").spin(t.get(0))}},t.prototype._groupContracts=function(t){var e,i,n,o,s,a=ChartApiInstance.futuresRegex(),l={},r=[];for(e=0;e1?"g":"")),delete o.highlightedItem,this._hidePro&&(i=i.filter(function(t){return!t.params||-1===t.params.indexOf("pro")})),0===i.length)return void this.$list.html('
'+$.t("No symbols matched your criteria")+"
");for(l=document.createElement("table"),l.setAttribute("class","symbol-edit-popup"),r={},c=new t.GroupListHandler(l,a,r),d=null,this._renderedResponse=[],u=0;u1},t.prototype._getItemByElement=function(t){return this._renderedResponse&&this._groupListHandler?this._groupListHandler.getItemByTicker(t.getAttribute("data-item-ticker")):null},t.prototype._getElementByItem=function(t){return this._renderedResponse&&this.$list?this.$list.get(0).querySelector('tr[data-item-ticker="'+(t.ticker||t.full_name)+'"]'):null},t.prototype._highlightItem=function(t,e,i){var n,o,s=this._state ;s.highlightedItem&&(n=this._getElementByItem(s.highlightedItem))&&$(n).removeClass("symbol-edit-popup-active"),s.highlightedItem=t,o=this._getElementByItem(s.highlightedItem),o&&($(o).addClass("symbol-edit-popup-active"),this._scrollHighlightIntoView()),e&&this._replaceCurrentSymbol(i)},t.prototype._scrollHighlightIntoView=function(){var t=this.$list.find("tr.symbol-edit-popup-active");t.length&&(t.offset().topthis.$list.offset().top+this.$list.outerHeight()&&this.$list.scrollTop(this.$list.scrollTop()+(t.offset().top+t.outerHeight()-(this.$list.offset().top+this.$list.outerHeight()))))},t.prototype._clearSuggestList=function(){this._renderedResponse=null,this._spinner&&(this._spinner.stop(),delete this._spinner),this.$list&&this.$list.empty()},t.prototype._showErrorNotice=function(){this.$list&&(this._clearSuggestList(),this.$list.text("Invalid expression"))},t.prototype._replaceCurrentSymbol=function(t){var e,i,n,o,s=this._state;if(s.highlightedItem){if(e=s.highlightedItem,i="",n=0,this._isSpreadInInput()||this._inputParserMixin&&!0!==t){if(o=this._inputParserMixin.replaceCurrentSymbol(e),!o.ok)return;i=o.newValue,n=o.newCaretPos,s.keepListFor=o.keepListFor}else this._state._selectedTicker=e.ticker||e.symbol,s.keepListFor=this._state._selectedTicker,i=!0===t&&e.full_name&&this._inputParserMixin?e.full_name:e.symbol,n=i.length;this._setInputValue(M?i.replace(A,""):i),this._inputElement.setSelectionRange?this._inputElement.setSelectionRange(n,n):this._inputElement.select(),this._eventListener(void 0,t)}},t.prototype.splitAndAcceptUserInput=function(){var t,e=this._getInputValue().split(",");for(t=0;t0){this._state.typeFilter===_.types.QUANDL&&this._showNotification()}},t.prototype._showNotification=function(){var t,e,i;TVSettings.getBool("symboledit.show_quandl_notification",!0)&&(t=$.t("Quandl is a huge financial database that we have connected to TradingView. Most of its data is EOD and is not updated in real-time, however the information may be extremely useful for fundamental analysis.")+'
'+$.t("Read our blog for more info!")+"",e=$('
').prependTo(this.$list),e.html(t),e.find("a").click(function(t){t.preventDefault();var e=$(this).attr("href");window.open(e,"_blank")}),i=$('').appendTo(e),i.click(function(){TVSettings.setValue("symboledit.show_quandl_notification",!1),e.remove()}))},t.prototype._processQuandlResponse=function(t){return t.datasets.filter(function(t){return!t.premium}).map(function(t){return{description:t.name,exchange:t.database_code,full_name:"QUANDL:"+t.database_code+"/"+t.dataset_code,params:["eod"],symbol:t.dataset_code,type:"quandl"}})},t.prototype.forceFocus=function(){this._inputElement.focus()},t.createSuggestListRow=function(e,i,n,o){var s,l,c,d,u,p,h,g,f,m,_,v,y,b;return o||(o={}),s=document.createElement("tr"),l="symbol-edit-popup",o.addClass&&(l+=" "+o.addClass),s.setAttribute("class",l),c=!M||"quandl"===e.type,d=document.createElement("td"),d.setAttribute("class","symbol-edit-popup-td name apply-overflow-tooltip apply-overflow-tooltip--allow-text"),u=c?e.symbol.replace(i,"$&"):e.symbol,p=o.nameContent||u,e.broker_symbol&&(p=p+" ("+(c?e.broker_symbol.replace(i,"$&"):e.broker_symbol)+")"),d.innerHTML=p,h=document.createElement("td"),h.setAttribute("class","symbol-edit-popup-td desc apply-overflow-tooltip"),g=e.description.toUpperCase(),w&&e.contractDescription&&(f=E.exec(e.contractDescription),g+=f?" ("+r(n,f[1])+" "+f[2]+")":" ("+r(n,e.contractDescription)+")"),h.innerHTML=!c||i.test(e.symbol)?g:g.replace(i,"$&"),m=document.createElement("td"),m.setAttribute("class","symbol-edit-popup-td type apply-overflow-tooltip"),_="",o.typeContent?_=o.typeContent:(e.params&&~e.params.indexOf("eod")&&(_='eod '),v=r(n,e.type),e.exchange?e.exchange.startsWith("CHXEUR_")?_+=v+" - "+e.exchange.split("_")[0]:_+=v+" - "+a(e):_+=v),m.innerHTML=_,y=document.createElement("td"),y.setAttribute("class","symbol-edit-popup-td flag apply-overflow-tooltip"),y.innerHTML=t.getItemFlag(e),b=y.getElementsByTagName("svg")[0],b&&b.setAttribute("class","flag"),s.appendChild(d),s.appendChild(h),s.appendChild(m),s.appendChild(y),s},t.getItemFlag=function(t){return""},F=function(t,i,n,o){i=p.displayedExchangesFilter(i),!i.some(function(t){return t.value===n})&&i.length>0&&(n=i[0].value);var s=$("
{{/removeOkButton}}
',{captionClassName:c,classSuffix:i.classSuffix||"",text:e,removeOkButton:i&&i.removeOkButton})),o.modalDialog.find("._tv-button.ok").on("click",function(){o.destroy(),i.onOkButtonClick&&i.onOkButtonClick()}),o.positionDialog(),o.applyHandlers(!1,{doNotCloseOnBgClickIfShadowbox:s,beforeDestroy:i.onClose}),o.modalDialog},showCustomDialog:function(t){function e(t){o.destroy(),t.preventDefault()}return o.createModalDialog(t.title||$.t("Dialog"),{addClass:""}),o.modalDialog.find("._tv-dialog").css("width",t.width||"400px"),o.modalDialog.find("._tv-dialog-content").html('
'+(t.html||$.t("Content"))+"
"),o.modalDialog.find(".ok").click(e),o.modalDialog.find("form").submit(e), o.modalDialog.find(".cancel").click(e),o.modalDialog.find("._tv-dialog-title-close").click(e),o.positionDialog(),o.applyHandlers(),o.modalDialog},createModalDialog:function(t,e){var i,n;return e=e||{},null!==o.modalDialog&&o.destroy(),o.modalDialog=$('
').appendTo($("body")).data("title",t),o._addMessageCloseButton(o.modalDialog.find("._tv-dialog-error")),o._addMessageCloseButton(o.modalDialog.find("._tv-dialog-message")),e.noShadowBox&&o.modalDialog.addClass("transparent"),e.addClass&&o.modalDialog.addClass(e.addClass),e.width&&o.modalDialog.find("._tv-dialog").css({width:e.width}),e.content&&o.modalDialog.find("._tv-dialog-content").html(e.content),i=$(".fancybox-overlay"),i.length&&(n=i.css("z-index"),$("._tv-dialog-shadowbox").css("z-index",n+1)),e.draggable&&a(o.modalDialog).draggable(o._constrainDraggableOptionsIfNeeded({handle:o.modalDialog.find("._tv-dialog-title")})),e.zIndex&&o.modalDialog.css("z-index",e.zIndex),o.modalDialog},_addMessageCloseButton:function(t){var e=$(i(884)).attr({class:"close",title:$.t("Close message")});t.append(e),$(e).on("click",function(){t.animate({marginTop:o.NOTIFICATION_ANIMATION_START_OFFSET,opacity:0},"fast",function(){t.hide()})})},createDialog:function(t,e){var i,l,r,c;return o.isOpen(t)?(i=o.get(t),i.find("._tv-dialog-content").html(""),i.data("new",!1),i):(e=e||{},l=e.ownerDocument||document,i=$(n.render('
{{^hideTitle}} {{&title}}{{/hideTitle}}{{^hideCloseCross}}{{/hideCloseCross}}
',{addClass:e.addClass||"",hideTitle:e.hideTitle,hideCloseCross:e.hideCloseCross,title:t}),l).appendTo(l.body),o._addMessageCloseButton(i.find("._tv-dialog-error")),o._addMessageCloseButton(i.find("._tv-dialog-message")),e.width&&i.css({width:e.width}),e.content&&i.find("._tv-dialog-content").html(e.content),r=0,r=e.zIndex?e.zIndex:o.dialogs&&o.dialogs.length?s($.map(o.dialogs,function(t){return parseInt((t.dialog||t).css("z-index"),10)}))+1:110,i.css("z-index",r),i.data("new",!0),i.data("title",t),i.data("id",o.dialogs.length+1),o.dialogs.push({title:t,dialog:i,id:o.dialogs.length+1}),c={start:function(t,e){var i,n,s=e.helper.css("z-index"),a=0,l=null;for(i=0;ia&&(a=n, l=o.dialogs[i].dialog);e.helper.css("z-index",a),l.css("z-index",s)}},e.dragHandle?c.handle=e.dragHandle:e.hideTitle||(c.handle="._tv-dialog-title"),e.dragOptions&&$.extend(c,e.dragOptions),a(i).draggable(o._constrainDraggableOptionsIfNeeded(c)),i)},positionDialog:function(t,e,i){function n(){s.css("margin-left",-Math.round(s.outerWidth()/2)+"px"),s.css("margin-top",-Math.round(s.outerHeight()/2)+"px")}var s,a,l,r,c,d,u,p,h,g;i=i||{},e=e||i.position,t?(a=t.prop("ownerDocument"),l=a.defaultView,r=t.width(),c=t.height(),d=$(l).width(),u=$(l).height(),e&&e.top&&e.left?(h=i.forcePosition?e.left:Math.max(2,Math.min(d-r-4,e.left))+"px",p=i.forcePosition?e.top:Math.max(2,Math.min(u-c-4,e.top))+"px"):e&&e.considerScroll?(g=$(a),h=Math.round((d-r)/2+g.scrollLeft())+"px",p=Math.round((u-c)/2+g.scrollTop())+"px"):(h=Math.round((d-r)/2)+"px",p=Math.round((u-c)/2)+"px"),i.fadeIn?t.css({left:h,top:p}).hide().fadeIn("fast"):i.smooth?t.animate({left:h,top:p}):t.css({left:h,top:p})):(t=o.modalDialog,s=t.find("._tv-dialog"),n(),s.resize(n))},applyHandlers:function(t,e){var i,n,s,a=!t||t===this.modalDialog;e=e||{},i=a?function(){o.destroy()}:function(){o.destroy(t.data("title"))},t=t||o.modalDialog.find("._tv-dialog"),n=t.prop("ownerDocument"),e.beforeDestroy&&t.on("destroy",e.beforeDestroy),t.find("._tv-dialog-title ._tv-dialog-title-close, .js-dialog-close").on("click",function(t){e.closeHandler&&"function"==typeof e.closeHandler?e.closeHandler(t):i()}),e.doNotCloseOnBgClick||setTimeout(function(){$(n).on("mousedown.closeDialog",function(o){var s=$(o.target).parents().andSelf();s.is(t)||e.doNotCloseOnBgClickIfShadowbox&&s.is("._tv-dialog-shadowbox, .tv-dialog__modal-wrap")||s.is(".colorpicker, .charts-popup-list, ._tv-dialog, .tvcolorpicker-popup, .symbol-edit-popup, .ui-datepicker, .clockpicker-popover, .pac-container")||($(n).off("mousedown.closeDialog"),i())})},0),t.find('input[type="checkbox"]').change(function(){var t=$(this);t.next("._tv-dialog-checkbox-mask").toggleClass("disabled",t.prop("disabled")).toggleClass("_tv-dialog-checkbox-mask-active",t.is(":checked"))}),s=t.find('input[type="text"]').focus(function(){$(this).addClass("_tv-dialog-content-textactive")}).blur(function(){$(this).removeClass("_tv-dialog-content-textactive")}).first(),Modernizr.touch||e.notFocusFirst||s.focus(),t.find('input[type="password"]').focus(function(){$(this).addClass("_tv-dialog-content-textactive")}).blur(function(){$(this).removeClass("_tv-dialog-content-textactive")}),t.find("textarea").focus(function(){$(this).addClass("_tv-dialog-content-textareaactive")}).blur(function(){$(this).removeClass("_tv-dialog-content-textareaactive")}),t.find("._tv-dialog-checkbox-mask").click(function(){var t=$(this).prev();t.prop("disabled")||(t.prop("checked",!t[0].checked),t.change())}),e.doNotCloseOnEsc||$(n).bind("keyup.hideDialog",function(e){if(27===e.keyCode)return t?o.destroy(t.data("title")):o.destroy(),!1}),e.processEnterButton&&$(n).bind("keyup.confirmAndCloseDialog",function(t){ 13===t.keyCode&&"textarea"!==t.target.tagName.toLowerCase()&&(e.processEnterButton.click(),$(n).unbind("keyup.confirmAndCloseDialog"))})},showError:function(t,e,i){o.showMessage(t,e,$.extend(i||{},{isError:!0}))},showMessage:function(t,e,i){var n,s,a;e||(e=$("._tv-dialog")),i=i||{},n=i.isError&&"_tv-dialog-error"||"_tv-dialog-message",s=e.find("."+n),a=s.find(".message"),i.html?a.html("string"==typeof i.html?i.html:t):a.text(t),a.css("width",e.width()).toggleClass("selectable",!!i.selectable),s.toggleClass("with-close",!!i.withClose).css({marginTop:o.NOTIFICATION_ANIMATION_START_OFFSET,opacity:"0"}).show().animate({marginTop:0,opacity:1},"fast"),i.withClose||(i.hideWithoutAnimation?s.on("touchstartoutside mousedownoutside keydownoutside",function t(){s.hide(),s.off("touchstartoutside mousedownoutside keydownoutside",t)}):s.on("touchstartoutside mousedownoutside keydownoutside",function t(){s.animate({marginTop:o.NOTIFICATION_ANIMATION_START_OFFSET,opacity:0},"fast",function(){s.hide()}),s.off("touchstartoutside mousedownoutside keydownoutside",t)}))},isOpen:function(t){for(var e=0;en&&(o-=t-n,o=Math.max(0,o),e.height(o))}},t.exports.TVOldDialogs=o}).call(e,i(5),i(126))},884:function(t,e){t.exports=''}});