Files
ai/charting_library/static/bundles/library.427a624a7f11698cb3d4.js
2016-10-13 01:32:11 -05:00

71 lines
2.2 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

webpackJsonp([0],[function(t,e,i){(function(t){"use strict";var e,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x=i(3);i(4),i(73),i(239),e=i(37),o=i(141).Action,n=i(61).ChartSaver,s=i(240),r=i(42),a=i(38),l=i(82),h=l.PriceFormatter,c=i(241),i(243),d=i(244),p=i(449),u=i(475),_=i(478),f=i(499),g=i(248).UndoHistory,m=i(511),v=i(512),i(506),i(516),y=i(39),b=!!urlParams.indicatorsFile,w=$.Deferred(),S=$.Deferred(),$.when(w,S).done(function(){ChartApiInstance.start()}),b?$.getScript(urlParams.indicatorsFile).done(function(){void 0!==window.__customIndicators&&window.isArray(window.__customIndicators)&&(window.PineJS=i(500),JSServer.studyLibrary=JSServer.studyLibrary.concat(window.__customIndicators),console.log("{0} custom indicators loaded.".format(window.__customIndicators.length)),w.resolve())}).fail(function(t){console.warn("Error loading custom indicators @ `{0}`: {1} ({2}) ".format(urlParams.indicatorsFile,t.statusText,t.status)),w.resolve()}):w.resolve(),window.widgetReady=function(t){a.subscribe("onChartReady",t)},window.customizeUI=function(t){var e,i;if(t.studiesOverrides){e=t.studiesOverrides;for(i in e)m.setProperty(i,e[i])}window.__defaultsOverrides=t.defaultsOverrides},window.applyOverrides=function(t){$.extend(!0,window.__defaultsOverrides,t),window.applyDefaultsOverrides(TradingView.defaultProperties.chartproperties),window.applyDefaultOverridesToLinetools(),window.chartWidgetCollection.applyOverrides(t)},window.is_authenticated=!1,T=function(){var i,o,g,m,b,w,T,C,x,P,L,k,E,I;if(!Modernizr.canvas||!Modernizr.canvastext)throw Error("Charting library cannot be running under this browser");t.setEnabled("charting_library_debug_mode","true"===urlParams.debug),i=window.headerChartPanel=$(".header-chart-panel"),o=$("#library-container"),g=$(".tv-header"),t.enabled("remove_library_container_border")&&(o.css("border","0px"),o.css("padding","1px")),window.customizeUI({studiesOverrides:urlParams.studiesOverrides?JSON.parse(urlParams.studiesOverrides):void 0,defaultsOverrides:JSON.parse(urlParams.overrides)}),urlParams.numeric_formatting=urlParams.numeric_formatting&&JSON.parse(urlParams.numeric_formatting),urlParams.numeric_formatting&&"string"==typeof urlParams.numeric_formatting.decimal_sign&&(h.prototype.decimalSign=urlParams.numeric_formatting.decimal_sign[0]),t.enabled("saveload_storage_customization")&&(void 0!==urlParams.chartsStorageUrl&&urlParams.chartsStorageUrl&&void 0!==urlParams.clientId&&urlParams.clientId?e.initialize(urlParams.clientId,urlParams.userId,urlParams.chartsStorageUrl,urlParams.chartsStorageVer||"1.0"):(t.setEnabled("saveload_storage_customization",!1),t.setEnabled("header_saveload",!1))),window.ChartApiInstance=new f(window.parent[urlParams.uid].datafeed),window.parent[urlParams.uid].customFormatters&&(window.parent[urlParams.uid].customFormatters.timeFormatter&&(l.customFormatters.timeFormatter=window.parent[urlParams.uid].customFormatters.timeFormatter),window.parent[urlParams.uid].customFormatters.dateFormatter&&(l.customFormatters.dateFormatter=window.parent[urlParams.uid].customFormatters.dateFormatter)),urlParams.autoSaveDelay&&ChartApiInstance.setAutoSaveDelay(urlParams.autoSaveDelay),ChartApiInstance.setTimeFramesList(JSON.parse(urlParams.timeFrames)),ChartApiInstance.setStudiesAccessController(ChartApiInstance.createStudiesAccessController(urlParams.studiesAccess)),t.enabled("narrow_chart_enabled")&&$(".chart-page").css("min-width","240px"),t.enabled("use_localstorage_for_settings")&&TVSettings.sync(),m=urlParams.chartContent?JSON.parse(urlParams.chartContent).json:void 0,b=urlParams.interval||"D",w={jqParent:$("#chart-area"),onResize:function(e){var n,s,r,a,l,h,c=$(document.body).height()-2;o.height(c),n=$("#footer-chart-panel"),s=n&&n.is(":visible")?n.outerHeight():0,r=$("#bottom-area"),a=r&&r.is(":visible")?r.outerHeight():0,l=t.enabled("header_widget")&&i.is(":visible")?i.outerHeight():0,h=c-l-g.outerHeight()-a-s,h=Math.max(50,h),e.height(h)},padding:t.enabled("border_around_the_chart")?5:0,edge:t.enabled("border_around_the_chart")?5:0,content:m,widgetOptions:{hideIdeas:!0,addVolume:!0,handleSessionErrors:!0,muteSessionErrors:!0,timezone:urlParams.timezone,defSymbol:urlParams.symbol,defInterval:b,defTimeframe:urlParams.timeframe&&urlParams.timeframe.toLowerCase()},globalEvents:!0,snapshotUrl:urlParams.snapshotUrl},m&&void 0!==m.extendedData&&(T=m.extendedData,w.metaInfo={id:T.uid,name:T.name,description:T.description,uid:T.uid,username:"",tags:""}),C=window.chartWidgetCollection=new d(w),C.activeChartWidget.subscribe(function(t){a.emit("activeChartChanged",C.getAll().indexOf(t))}),window.saver=new n(C),window.chartWidget=C.activeChartWidget.value(),window.pro=new TradingView.Pro,window.tradingViewApi=new v(C,window.saver,ChartApiInstance),x=JSON.parse(urlParams.favorites),x.intervals=x.intervals.map(function(t){var e=""+t;return e.match(/1[DWMYdwmy]/)&&(e=e.slice(1)),e}),t.enabled("study_templates")&&(window.studyTemplates=new s({chartWidgetCollection:C,notShowQuicks:!t.enabled("items_favoriting")})),window.headerWidget=new p({chartWidgetCollection:C,headerChartPanel:i,hideStudyTemplates:!0,favoriteIntervals:x.intervals,interval_options:{interval:b},favoriteChartTypes:x.chartTypes}),r.bindToChartWidgetCollection(C),P=function(){},L=JSON.parse(urlParams.logo),P=L.image?function(e,i,o){var n,s,r,a,l,h,c,d;i=i||chartWidget._jqMainDiv,$(i).find(".onchart-custom-logo").remove(),n=$('<img src="'+L.image+'">'),s=L.link?$('<a href="'+L.link+'" target="_blank"/>').append(n):n,r=$('<span class="text">Powered&nbsp;by&nbsp;<span><a href="https://www.tradingview.com/" target="_blank"><span class="text logo-highlighted">TradingView</span></a>'),a=$('<div class="onchart-custom-logo"/>').appendTo(i),l=$('<div class="wrapper"/>').appendTo(a),h=$('<table class="inner">').appendTo(l),c=$("<tr>").appendTo(h),$('<td class="custom-logo">').append(s).appendTo(c),d=$("<tr>").appendTo(h),t.enabled("link_to_tradingview")&&$('<td class="tv-link">').append(r).appendTo(d),o&&a.addClass("on-pane")}:function(e,i,o){if(t.enabled("link_to_tradingview")){i=i||chartWidget._jqMainDiv,$(i).find(".onchart-tv-logo").remove();var n=$('<div class="onchart-tv-logo wrapper"><div class="wrapper"><a class="inner" href="https://www.tradingview.com/" target="_blank"><img class="solid" src="images/charting_library/logo-widget-copyright.png" alt="TradingView Logo"><img class="faded" src="images/charting_library/logo-widget-copyright-faded.png" alt="TradingView Logo"><span class="text"><span id="logo-symbol"></span>&nbsp;charts&nbsp;by&nbsp;<span class="logo-highlighted">TradingView</span></span></a></div></div>').appendTo(i);t.enabled("minimalistic_logo")?n.on("mouseenter",function(){$(this).addClass("expanded")}).on("mouseleave",function(){$(this).removeClass("expanded")}):n.addClass("expanded"),o&&n.addClass("on-pane")}},k=t.enabled("widget_logo"),k&&(chartWidget.createLogo=P,t.enabled("show_logo_on_all_charts")&&(C.createLogo=P.bind(this)),t.enabled("move_logo_to_main_pane")||chartWidget.withModel(null,P)),urlParams.toolbarbg&&(E="#"+urlParams.toolbarbg,$(".tv-side-toolbar").css("background-color",E),$(".chart-controls-bar").css("background-color",E),$("#chart-area").css("background-color",E),i.css("background-color",E),$("#footer-chart-panel").css("background-color",E)),TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),TradingView.isNaN(urlParams.ssreqdelay)||y.setSearchRequestDelay(Math.max(0,+urlParams.ssreqdelay)),I=new u({container:$(".tv-side-toolbar"),chartWidgetCollection:C,onWidget:!0,drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,forceVisible:!!t.enabled("left_toolbar")}),window.sideToolbar=I,window.quoteSessionMultiplexerInstance={},window.quoteSessionMultiplexerInstance.simple=new c("simple"),window.quoteSessionMultiplexerInstance.full=new c,window.lineToolPropertiesToolbar=new _(C),chartWidget.onDisconnected().subscribe(null,function(t){t&&window.showCriticalErrorMessage()}),$(".tv-content").bind("contextmenu",function(t){var e=$(t.originalEvent.target);if(!e.is("input")&&!e.is("textarea"))return!1}),S.resolve(),chartWidget.withModel(null,function(){chartWidget.model().mainSeries().onSymbolResolved().subscribe(null,function(){var t=chartWidget.model().mainSeries().symbolInfo(),e=chartWidget.model().mainSeries().properties().interval.value(),i={name:t.name,exchange:t.exchange,description:t.description,type:t.type,interval:e};a.emit("onSymbolChange",i)}),r.interval.subscribe(function(t){a.emit("onIntervalChange",t)}),ChartApiInstance.on("realtime_tick",function(t){a.emit("onTick",t)}),ChartApiInstance.on("onAutoSaveNeeded",function(){a.emit("onAutoSaveNeeded")}),t.enabled("charting_library_debug_mode")&&a.subscribeToAll(function(){var t=Array.prototype.slice.call(arguments);console.log('Event "{0}", arguments: {1}'.format(t[0],JSON.stringify(t.slice(1))))})}),a.subscribe("chart_load_requested",function(t){window.tradingViewApi.loadChart({json:JSON.parse(t.content),extendedData:t})})},window.destroyChart=function(){window.chartWidgetCollection&&(window.chartWidgetCollection.destroy(),window.chartWidgetCollection=null),window.quoteSessionMultiplexerInstance&&(window.quoteSessionMultiplexerInstance.simple&&window.quoteSessionMultiplexerInstance.simple.destroy(),window.quoteSessionMultiplexerInstance.full&&window.quoteSessionMultiplexerInstance.full.destroy(),window.quoteSessionMultiplexerInstance=null),ChartApiInstance&&(ChartApiInstance.destroy(),ChartApiInstance=null)},C=$.Deferred(),$.when(x,C).done(function(){if(JSON.parse(urlParams.disabledFeatures).forEach(function(e){t.setEnabled(e,!1)}),JSON.parse(urlParams.enabledFeatures).forEach(function(e){t.setEnabled(e,!0)}),setTimeout(T,0),t.enabled("14851")){!function(t,e,i,o,n,s,r){t.GoogleAnalyticsObject=n,t[n]=t[n]||function(){(t[n].q=t[n].q||[]).push(arguments)},t[n].l=1*new Date,s=e.createElement(i),r=e.getElementsByTagName(i)[0],s.async=1,s.src=o,r.parentNode.insertBefore(s,r)}(window,document,"script","//www.google-analytics.com/analytics.js","ga");var e=document.URL.match(RegExp("(:?.*://)([^/]+)/.*"))[2];ga("create","UA-53174009-1","auto"),ga("set",{hostname:e,page:e,referrer:e}),ga("send","pageview")}}),function(){var t=!0;window.parent[urlParams.uid].datafeed.onReady(function(e){t&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),window.configurationData=e,C.resolve()}),t=!1}(),window.getFunctionFromArguments=function(t){return window.parent[urlParams.uid][t]},window.createShortcutAction=function(){var t={};return function(e,i){void 0===t[e]&&(t[e]=new o({shortcut:e})),t[e].callbacks().subscribe(null,i)}}(),window.addCustomCSSFile=function(t){var e=document.createElement("link");document.getElementsByTagName("head")[0].appendChild(e),e.setAttribute("type","text/css"),e.setAttribute("rel","stylesheet"),e.setAttribute("href",t)},urlParams.customCSS&&window.addCustomCSSFile(urlParams.customCSS),window._initializationFinished=function(){g.clearStack()},window.resizeWindow=function(){$(window).resize()}}).call(e,i(1))},function(t,e,i){(function(t){var e=function(){var t,i,o,n,s,r,a,l,h,c,d={};if(void 0!==e)return e;t={custom_items_in_context_menu:{},websocket_connection:{},countdown:{},extended_hours:{},symbol_search_parser_mixin:{},show_pro_features:{},daily_timeframe_suffix:{},symbollist_context_menu:{},pay_attention_to_ticker_not_symbol:{},graying_disabled_tools_enabled:{},update_study_formatter_on_symbol_resolve:{},constraint_dialogs_movement:{},same_data_requery:{},phone_verification:{},show_interval_dialog_on_key_press:{},header_interval_dialog_button:{subsets:["show_interval_dialog_on_key_press"]},header_fullscreen_button:{},header_symbol_search:{},header_resolutions:{subsets:["header_interval_dialog_button"]},header_chart_type:{},header_settings:{},header_indicators:{},header_compare:{},header_undo_redo:{},header_screenshot:{},header_saveload:{},header_saveload_to_the_right:{},header_widget:{subsets:["header_widget_dom_node","header_symbol_search","header_resolutions","header_chart_type","header_settings","header_indicators","header_compare","header_undo_redo","header_fullscreen_button","compare_symbol"]},compare_symbol:{subsets:["header_compare"]},chart_property_page:{subsets:["chart_property_page_style","chart_property_page_scales","chart_property_page_background","chart_property_page_timezone_sessions","chart_property_page_evetns_alerts","chart_property_page_trading","chart_property_page_template_button"]},disable_userlink_popup:{},left_toolbar:{},control_bar:{},widget_logo:{},timeframes_toolbar:{},edit_buttons_in_legend:{subsets:["show_hide_button_in_legend","format_button_in_legend","study_buttons_in_legend","delete_button_in_legend"]},show_hide_button_in_legend:{},format_button_in_legend:{},study_buttons_in_legend:{},delete_button_in_legend:{},pane_context_menu:{},scales_context_menu:{},legend_context_menu:{},context_menus:{subsets:["pane_context_menu","scales_context_menu","legend_context_menu","objects_tree_context_menu"]},items_favoriting:{},save_chart_properties_to_local_storage:{},use_localstorage_for_settings:{subsets:["items_favoriting","save_chart_properties_to_local_storage"]},plain_studymarket:{},trading_watch_positions:{},disable_resolution_rebuild:{},border_around_the_chart:{},narrow_chart_enabled:{},charting_library_debug_mode:{},log_data_request_time:{},saveload_requires_authentication:{},saveload_storage_customization:{},new_chart_creation_available:{},volume_force_overlay:{},create_volume_indicator_by_default:{},saved_charts_count_restriction:{},lean_chart_load:{},stop_study_on_restart:{},star_some_intervals_by_default:{},predefined_items_only_may_be_starred:{},move_logo_to_main_pane:{},show_logo_on_all_charts:{},link_to_tradingview:{},right_bar_stays_on_scroll:{},chart_content_overrides_by_deafults:{},14851:{},show_dialog_on_snapshot_ready:{},snapshot_trading_drawings:{},allow_supported_resolutions_set_only:{},study_market_minimized:{},widgetbar_tabs:{},collapsible_header:{},show_extension_popup:{},study_templates:{},side_toolbar_in_fullscreen_mode:{},remove_library_container_border:{},whotrades_auth_only:{},support_multicharts:{},display_market_status:{},datasource_copypaste:{},line_tool_templates:{},expand_symbolsearch_items:{},symbol_search_three_columns_exchanges:{},symbol_search_flags:{},symbol_search_limited_exchanges:{},symbol_search_quandl:{},footer_share_buttons:{},footer_bugreport_button:{},footer_publish_idea_button:{},text_notes:{},symbol_info:{},no_bars_status:{},clear_bars_on_series_error:{},hide_loading_screen_on_series_error:{},seconds_resolution:{},dont_show_boolean_study_arguments:{},hide_last_na_study_output:{},price_scale_always_last_bar_value:{},study_dialog_search_control:{},cqg_trading_confirm_risks:{},trading_notifications:{},chart_crosshair_menu:{},linetoolpropertieswidget_template_button:{},use_overrides_for_overlay:{},timezone_menu:{},main_series_scale_menu:{},onchart_messages:{},custom_resolutions_box:{},referral_program_for_widget_owners:{},referral_program_policy_aggressive:{subsets:["referral_program_policy_passive","referral_program_policy_normal"]},referral_program_policy_normal:{subsets:["referral_program_policy_passive","header_fake_features_buttons","custom_resolutions_box"]},tv_production:{subsets:["show_pro_features","countdown","extended_hours","symbol_search_parser_mixin","symbollist_context_menu","websocket_connection","header_fullscreen_button","header_widget","left_toolbar","control_bar","timeframes_toolbar","context_menus","edit_buttons_in_legend","use_localstorage_for_settings","saveload_requires_authentication","volume_force_overlay","new_chart_creation_available","saved_charts_count_restriction","create_volume_indicator_by_default","charts_auto_save","right_bar_stays_on_scroll","save_old_chart_before_save_as","chart_property_page_trading","chart_content_overrides_by_deafults","alerts","show_dialog_on_snapshot_ready","show_extension_popup","header_saveload","header_saveload_to_the_right","header_layouttoggle","datasource_copypaste","alerts","show_saved_watchlists","watchlists_from_to_file","chart_property_page","show_chart_property_page","support_multicharts","display_market_status","support_manage_drawings","widgetbar_tabs","study_templates","collapsible_header","line_tool_templates","caption_buttons_text_if_possible","footer_share_buttons","footer_publish_idea_button","text_notes","trading_watch_positions","symbol_info","linetoolpropertieswidget_template_button","cqg_trading_confirm_risks","trading_notifications","symbol_search_three_columns_exchanges","symbol_search_flags","symbol_search_limited_exchanges","symbol_search_quandl","phone_verification","chart_events","onchart_messages","custom_resolutions_box","compare_symbol","timezone_menu","main_series_scale_menu","chart_crosshair_menu"]},browser_extension:{subsets:["disable_userlink_popup","show_pro_features","show_saved_watchlists","display_market_status","widgetbar_tabs"]},widget:{subsets:["show_pro_features","countdown","extended_hours","symbol_search_parser_mixin","symbollist_context_menu","websocket_connection","left_toolbar","control_bar","timeframes_toolbar","context_menus","edit_buttons_in_legend","use_localstorage_for_settings","saveload_requires_authentication","volume_force_overlay","create_volume_indicator_by_default","right_bar_stays_on_scroll","show_dialog_on_snapshot_ready","header_widget_dom_node","header_symbol_search","header_resolutions","header_chart_type","header_compare","header_indicators","header_resolutions","header_symbol_search","header_widget_dom_node","left_toolbar","saveload_requires_authentication","show_dialog_on_snapshot_ready","star_some_intervals_by_default","symbol_search_parser_mixin","symbollist_context_menu","timeframes_toolbar","use_localstorage_for_settings","volume_force_overlay","websocket_connection","display_market_status","symbol_info","linetoolpropertieswidget_template_button","symbol_search_three_columns_exchanges","symbol_search_flags","symbol_search_limited_exchanges","widgetbar_tabs","force_quandl_search","compare_symbol","timezone_menu","main_series_scale_menu","chart_crosshair_menu"]},bovespa_widget:{subsets:["widget","header_settings","extended_hours","chart_property_page_timezone_sessions","linetoolpropertieswidget_template_button"]},charting_library_base:{subsets:["14851","adapt_onchart_logo_background","allow_supported_resolutions_set_only","border_around_the_chart","collapsible_header","constraint_dialogs_movement","context_menus","control_bar","create_volume_indicator_by_default","custom_items_in_context_menu","datasource_copypaste","daily_timeframe_suffix","display_market_status","edit_buttons_in_legend","graying_disabled_tools_enabled","narrow_chart_enabled","header_widget","header_saveload","header_saveload_to_the_right","lean_chart_load","left_toolbar","trading_watch_positions","link_to_tradingview","pay_attention_to_ticker_not_symbol","plain_studymarket","predefined_items_only_may_be_starred","refresh_saved_charts_list_on_dialog_show","right_bar_stays_on_scroll","saveload_storage_customization","show_dialog_on_snapshot_ready","stop_study_on_restart","study_market_minimized","timeframes_toolbar","update_study_formatter_on_symbol_resolve","update_timeframes_set_on_symbol_resolve","use_localstorage_for_settings","volume_force_overlay","widget_logo","countdown","use_overrides_for_overlay","trading_notifications","compare_symbol","symbol_info","timezone_menu","main_series_scale_menu","study_dialog_search_control","chart_crosshair_menu","show_chart_property_page","chart_property_page_style","chart_property_page_scales","chart_property_page_background","chart_property_page_timezone_sessions","chart_property_page_evetns_alerts"]},charting_library:{subsets:["charting_library_base","header_screenshot"]},static_charts_service:{subsets:["charting_library","disable_resolution_rebuild","log_data_request_time","same_data_requery"]},trading_terminal:{subsets:["charting_library_base","support_multicharts","header_layouttoggle","chart_property_page_trading"]},cqg_terminal:{subsets:["charting_library_base","chart_property_page_trading","expand_symbolsearch_items","caption_buttons_text_if_possible","clear_bars_on_series_error","no_bars_status","hide_loading_screen_on_series_error","support_multicharts","header_layouttoggle","same_data_requery","footer_bugreport_button"]},amp_terminal:{subsets:["cqg_terminal"]}},i={};for(o in t){for(n=t[o].subsets||[],s=0;s<n.length;++s)i[n[s]]=1;i[o]=1}r={};for(o in i)for(a in i)l=t[a],void 0!==l&&l.subsets&&l.subsets.indexOf(o)>=0&&(r.hasOwnProperty(o)||(r[o]=[]),r[o].push(a));return h={},c=function(t){return h[t]},d.enabled=function(t){var i,o,n=r.hasOwnProperty(t)?r[t]:[];if(0==c(t))return!1;for(i=c(t),o=0;o<n.length;++o)i|=e.enabled(n[o]);return i},d._uniqueSets=function(){return Object.keys(i)},d.enable=function(t){h[t]=!0},d.setEnabled=function(t,e){h[t]=e},"undefined"!=typeof __initialDisabledFeaturesets&&__initialDisabledFeaturesets&&__initialDisabledFeaturesets.forEach(function(t){d.setEnabled(t,!1)}),"undefined"!=typeof __initialEnabledFeaturesets&&__initialEnabledFeaturesets&&__initialEnabledFeaturesets.forEach(function(t){d.enable(t)}),d}();window.Featuresets=e,void 0!==t&&t&&t.exports&&(t.exports=e)}).call(e,i(2)(t))},,function(t,e){var i=$.Deferred();$.i18n.init({lng:urlParams.locale,load:"unspecific",resGetPath:"localization/translations/__lng__.json",keyseparator:"@",nsseparator:"@",fallbackLng:"en"},function(t){i.resolve(),$(window).resize(),$(".loading-indicator").hide()}),t.exports=i},function(t,e,i){"use strict";function o(t){return t.keys().map(t)}window.TradingView=window.TradingView||{},window.requireAll=o,i(5),i(11),i(12),i(13),i(14),i(15),i(16),i(17),i(18),i(19),i(20),i(23),i(24),i(25),i(26),i(27),i(66),i(67),i(68),i(71),i(72),i(35)},function(t,e,i){"use strict";var o=i(6);window.language&&(o.locale(window.language,{months:[$.t("January"),$.t("February"),$.t("March"),$.t("April"),$.t("May"),$.t("June"),$.t("July"),$.t("August"),$.t("September"),$.t("October"),$.t("November"),$.t("December")],monthsShort:[$.t("Jan"),$.t("Feb"),$.t("Mar"),$.t("Apr"),$.t("May"),$.t("Jun"),$.t("Jul"),$.t("Aug"),$.t("Sep"),$.t("Oct"),$.t("Nov"),$.t("Dec")],weekdays:[$.t("Sunday"),$.t("Monday"),$.t("Tuesday"),$.t("Wednesday"),$.t("Thursday"),$.t("Friday"),$.t("Saturday")],weekdaysShort:[$.t("Sun"),$.t("Mon"),$.t("Tue"),$.t("Wed"),$.t("Thu"),$.t("Fri"),$.t("Sat")],weekdaysMin:[$.t("Su",{context:"day_of_week"}),$.t("Mo",{context:"day_of_week"}),$.t("Tu",{context:"day_of_week"}),$.t("We",{context:"day_of_week"}),$.t("Th",{context:"day_of_week"}),$.t("Fr",{context:"day_of_week"}),$.t("Sa",{context:"day_of_week"})],longDateFormat:{LT:$.t("HH:mm"),LTS:$.t("HH:mm:ss"),L:$.t("MM/DD/YYYY"),l:$.t("M/D/YYYY"),LL:$.t("D MMMM YYYY"),ll:$.t("D MMM LT"),LLL:$.t("D MMMM YYYY LT"),lll:$.t("D MMM YYYY LT"),LLLL:$.t("ddd D MMMM YYYY LT"),llll:$.t("ddd D MMM YYYY LT")},calendar:{sameDay:$.t("[Today at] LT"),nextDay:$.t("[Tomorrow at] LT"),nextWeek:$.t("dddd [at] LT"),lastDay:$.t("[Yesterday at] LT"),lastWeek:$.t("[Last] dddd [at] LT"),sameElse:"L"},relativeTime:{future:function(t){return t===$.t("just now")?t:$.t("in %s",{context:"time_range"}).replace("%s",t)},past:function(t){return t===$.t("just now")?t:$.t("%s ago",{context:"time_range"}).replace("%s",t)},s:$.t("just now"),m:function(t){return $.t("%d minute",{count:t}).replace("%d",t)},mm:function(t){return $.t("%d minute",{count:t}).replace("%d",t)},h:$.t("an hour"),hh:function(t){return $.t("%d hour",{count:t}).replace("%d",t)},d:$.t("a day"),dd:function(t){return $.t("%d day",{count:t}).replace("%d",t)},M:$.t("a month"),MM:function(t){return $.t("%d month",{count:t}).replace("%d",t)},y:$.t("a year"),yy:function(t){return $.t("%d year",{count:t}).replace("%d",t)}},week:{dow:1,doy:4}}),o.locale(window.language))},,,,,,function(t,e){"use strict";!function(t){t.fn.contextMenu=function(e){t(this).bind("contextmenu",function(t){return e(t),!1})}}(jQuery)},function(t,e){"use strict";!function(t){t.fn.selectable=function(e){return this.each(function(){var i=t(this);i.css("user-select",e?"text":"none"),i.css("-moz-user-select",e?"text":"-moz-none"),i.css("-webkit-user-select",e?"auto":"none"),(t.browser.msie||t.browser.opera)&&i.attr("unselectable",e?"off":"on")})}}(jQuery)},function(module,exports){(function(){"use strict";this.JSON||(this.JSON={}),function(){function f(t){return t<10?"0"+t:t}function quote(t){return escapable.lastIndex=0,escapable.test(t)?'"'+t.replace(escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var i,o,n,s,r,a=gap,l=e[t];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(t)),"function"==typeof rep&&(l=rep.call(e,t,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?l+"":"null";case"boolean":case"null":return l+"";case"object":if(!l)return"null";if(gap+=indent,r=[],"[object Array]"===Object.prototype.toString.apply(l)){for(s=l.length,i=0;i<s;i+=1)r[i]=str(i,l)||"null";return n=0===r.length?"[]":gap?"[\n"+gap+r.join(",\n"+gap)+"\n"+a+"]":"["+r.join(",")+"]",gap=a,n}if(rep&&"object"==typeof rep)for(s=rep.length,i=0;i<s;i+=1)o=rep[i],"string"==typeof o&&(n=str(o,l),n&&r.push(quote(o)+(gap?": ":":")+n));else for(o in l)Object.hasOwnProperty.call(l,o)&&(n=str(o,l),n&&r.push(quote(o)+(gap?": ":":")+n));return n=0===r.length?"{}":gap?"{\n"+gap+r.join(",\n"+gap)+"\n"+a+"}":"{"+r.join(",")+"}",gap=a,n}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(t){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(t){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(t,e,i){var o;if(gap="",indent="","number"==typeof i)for(o=0;o<i;o+=1)indent+=" ";else"string"==typeof i&&(indent=i);if(rep=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw Error("JSON.stringify");return str("",{"":t})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(t,e){var i,o,n=t[e];if(n&&"object"==typeof n)for(i in n)Object.hasOwnProperty.call(n,i)&&(o=walk(n,i),void 0!==o?n[i]=o:delete n[i]);return reviver.call(t,e,n)}var j;if(text+="",cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()}).call(window)},function(t,e,i){(function(t){var e=window.TradingView=window.TradingView||{};window.PineAddons={},e.className=function(t){for(var i in this)if(e[i]===t)return i;return null},e.isMobileView=/mobile=1/i.test(window.location.search),e.isOnFeaturePage=/on-features-page=1/i.test(window.location.search),e.wrapUrl=function(e){return t.enabled("charting_library_base")&&(e=e.replace("","")),e},e.RESOURCES_ROOT=e.wrapUrl("chart-client/css/"),e.THEME_RESOURCES_ROOT=e.wrapUrl("chart-client/css/images/"),e.resourceFullPath=function(t){return e.RESOURCES_ROOT+t},e.themeResourceFullPath=function(t){return e.THEME_RESOURCES_ROOT+t},e.isMobile=function(){var t=/Android/i.test(navigator.userAgent),i=/BlackBerry/i.test(navigator.userAgent),o=/iPhone|iPad|iPod/i.test(navigator.userAgent),n=/Opera Mini/i.test(navigator.userAgent),s=e.winMobileMode,r=e.isMobileView||t||i||o||n||s;return{Android:function(){return t},BlackBerry:function(){return i},iOS:function(){return o},Opera:function(){return n},Windows:function(){return s},any:function(){return r}}}(),e.supportTouch=function(){return Modernizr.touch||e.isMobile.any()},e.onWidget=function(){return/widgetembed|widgetpopup|idea-popup/.test(window.location.pathname)},e.onOrder=function(){return"/order/"===window.location.pathname},"undefined"!=typeof jQuery&&(e.debugReady=$.Deferred())}).call(e,i(1))},function(t,e){"use strict";!function(t,e,i){"$:nomunge";function o(o,n){function s(e){t(r).each(function(){var i=t(this);this===e.target||i.has(e.target).length||i.triggerHandler(n,[e.target])})}n=n||o+i;var r=t(),a=o+"."+n+"-special-event";t.event.special[n]={setup:function(){r=r.add(this),delete r.prevObject,1===r.length&&t(e).bind(a,s)},teardown:function(){r=r.not(this),delete r.prevObject,0===r.length&&t(e).unbind(a)},add:function(t){var e=t.handler;t.handler=function(t,i){t.target=i,e.apply(this,arguments)}}}}t.map("click dblclick mousemove mousedown mouseup mouseover mouseout change select submit keydown keypress keyup".split(" "),function(t){o(t)}),o("focusin","focus"+i),o("focusout","blur"+i),Modernizr.touch&&(o("touchstart","mousedown"+i),o("touchmove","mousemove"+i),o("touchend","mouseup"+i)),t.addOutsideEvent=o}(jQuery,document,"outside")},function(t,e){"use strict";!function(t){t.fn.mousecapture=function(e){var i=t(document);return this.each(function(){var o=t(this),n={};o.mousedown(function(t){var s,r,a;return e.move&&(s=function(t){e.move.call(o,t,n)},i.mousemove(s)),a=function(){e.move&&i.unbind("mousemove",s),i.unbind("mouseup",r)},r=e.up?function(t){return a(),e.up.call(o,t,n)}:a,i.mouseup(r),e.down.call(o,t,n)})}),this}}(jQuery)},function(t,e){"use strict";!function(t){function e(t,e){if(!(t.originalEvent.touches.length>1)){t.preventDefault();var i=t.originalEvent.changedTouches[0],o=document.createEvent("MouseEvents");o.initMouseEvent(e,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(o)}}if(t.support.touch="ontouchend"in document,t.support.touch){var i,o=t.ui.mouse.prototype,n=o._mouseInit,s=o._mouseDestroy;o._touchStart=function(t){var o=this;!i&&o._mouseCapture(t.originalEvent.changedTouches[0])&&(i=!0,o._touchMoved=!1,e(t,"mouseover"),e(t,"mousemove"),e(t,"mousedown"))},o._touchMove=function(t){i&&(this._touchMoved=!0,e(t,"mousemove"))},o._touchEnd=function(t){i&&(e(t,"mouseup"),e(t,"mouseout"),this._touchMoved||e(t,"click"),i=!1)},o._mouseInit=function(){var e=this;e.element.bind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")}),n.call(e)},o._mouseDestroy=function(){var e=this;e.element.unbind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")}),s.call(e)}}}(jQuery)},function(t,e){TradingView.guid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,i="x"===t?e:3&e|8;return i.toString(16)})},TradingView.randomHash=function(){return TradingView.randomHashN(12)},TradingView.randomHashN=function(t){var e,i,o="0123456789abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n="";for(e=0;e<t;e++)i=Math.round(Math.random()*(o.length-1)),n+=o[i];return n}},function(t,e,i){(function(t){function e(t){return"number"==typeof t&&isFinite(t)}function i(t){return null!==t&&void 0!==t&&t.constructor===Function}function o(t,e){t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),t.prototype.superclass=e}var n,s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};"undefined"!=typeof window?(n=window.TradingView=window.TradingView||{},
window.isNumber=e,window.isFunction=i,window.inherit=o,window.isArray=s):n=this.TradingView=this.TradingView||{},n.isNaN=function(t){return!(t<=0||t>0)},n.isAbsent=function(t){return null===t||void 0===t},n.isExistent=function(t){return null!==t&&void 0!==t},Number.isNaN=Number.isNaN||function(t){return t!=t},n.isSameType=function(t,e){return Number.isNaN(t)||Number.isNaN(e)?Number.isNaN(t)===Number.isNaN(e):{}.toString.call(t)==={}.toString.call(e)},n.isInteger=function(t){return"number"==typeof t&&t%1===0},n.parseBool=function(t){return t===!0||"true"===t},n.isBoolean=function(t){return t===!0||t===!1},n.isString=function(t){return null!==t&&void 0!==t&&t.constructor===String},n.declareClassAsPureInterface=function(t,e){for(var i in t.prototype)"function"==typeof t.prototype[i]&&t.prototype.hasOwnProperty(i)&&(t.prototype[i]=function(){throw Error(e+"::"+i+" is an interface member declaration and must be overloaded in order to be called")})},n.requireFullInterfaceImplementation=function(t,e,i,o){for(var n in i.prototype)if("function"==typeof i.prototype[n]&&!t.prototype[n])throw Error("Interface implementation assertion failed: "+e+" does not implement "+o+"::"+n+" function")},n.isInherited=function(t,e){return t===e||!(!t||!t.prototype)&&(void 0!==t.prototype.superclass&&null!==t.prototype.superclass&&(t.prototype.superclass===e||n.isInherited(t.prototype.superclass,e)))},n.TypeValidator=function(t){this.m_type=t},n.TypeValidator.prototype.check=function(t){return t.constructor===this.m_type||n.isInherited(t.constructor,this.m_type)},n.PredicateValidator=function(t){this.m_predicate=t},n.PredicateValidator.prototype.check=function(t){return this.m_predicate(t)},n.clone=function(t){var e,i,o;if(!t||"object"!=typeof t)return t;e="function"==typeof t.pop?[]:{};for(i in t)t.hasOwnProperty(i)&&(o=t[i],o&&"object"==typeof o?e[i]=n.clone(o):e[i]=o);return e},n.deepEquals=function(t,e,o){var r,a,l,h,c;if(o||(o=""),t===e)return[!0,o];if(i(t)&&(t=void 0),i(e)&&(e=void 0),void 0===t&&void 0!==e)return[!1,o];if(void 0===e&&void 0!==t)return[!1,o];if(null===t&&null!==e)return[!1,o];if(null===e&&null!==t)return[!1,o];if(n.isString(t)&&n.isString(e))return[t===e,o];if(Array.isArray(t)&&Array.isArray(e)){if(r=t.length,a=e.length,r!==a)return[!1,o];for(l=0;l<r;l++)if(h=n.deepEquals(t[l],e[l],o+"["+l+"]"),!h[0])return h;return[!0,o]}if(s(t)||s(e))return[!1,o];for(c in t)if(h=n.deepEquals(t[c],e[c],o+"["+c+"]"),!h[0])return h;return[!0,o]},n.merge=function(t,e){for(var i in e)"object"==typeof e[i]&&t.hasOwnProperty(i)?n.merge(t[i],e[i]):t[i]=e[i];return t},n.mergeObj=function(t,e){for(var i in e)e[i].constructor===Object&&t.hasOwnProperty(i)?n.mergeObj(t[i],e[i]):t[i]=e[i];return t},n.mergeWithRules=function(t,e,i,o){var s,r;for(s in e)r=o?o+"."+s:s,i&&r in i?t[s]=i[r](t[s],e[s]):"object"==typeof e[s]&&t.hasOwnProperty(s)?n.merge(t[s],e[s],i,r):t[s]=e[s]},n.sortMultipleFunction=function(){var t=[].slice.call(arguments),e=t.length;return function(i,o){var n,s,r,a,l,h,c;for(c=0;c<e&&(h=0,r=t[c],a="string"==typeof r?r:r.name,n=i[a],s=o[a],"function"==typeof r.fn&&(n=r.fn(n),s=r.fn(s)),l=r.reverse?-1:1,n<s&&(h=l*-1),n>s&&(h=1*l),0===h);c++);return h}},void 0!==t&&t&&t.exports&&(t.exports={inherit:o,merge:n.merge,isNumber:e,isInteger:n.isInteger,isBoolean:n.isBoolean,isString:n.isString,isNaN:n.isNaN,isAbsent:n.isAbsent,isExistent:n.isExistent,isSameType:n.isSameType})}).call(e,i(2)(t))},function(t,e,i){(function(e){var o=window.CanvasEx=i(22);TradingView.resizeCanvas=function(t,e,i){var o,n,s,r,a,l=t.prop("height"),h=t.prop("width");l&&h&&(l/=window.hidpiCanvasRatio||1,h/=window.hidpiCanvasRatio||1,o=$("<canvas>").prop("width",h).prop("height",l),n=o.get(0).getContext("2d"),s=Math.min(h,e),r=Math.min(l,i),s&&r&&n.drawImage(t.get(0),0,0,s,r,0,0,s,r),t.prop("height",i).prop("width",e),a=t.get(0).getContext("2d"),s&&r&&a.drawImage(o.get(0),0,0,s,r,0,0,s,r),o.remove())},o.computeDashPattern=function(t){var e=[[t.lineWidth,2*t.lineWidth],[3*t.lineWidth,2*t.lineWidth],[6*t.lineWidth,6*t.lineWidth]];return e[t.lineStyle-1]},o.drawLine=function(t,e,i,n,s){isFinite(e)&&isFinite(n)&&isFinite(i)&&isFinite(s)&&(t.lineStyle===o.LINESTYLE_DASHED||t.lineStyle===o.LINESTYLE_DOTTED?t.drawDashedLine(t,e,i,n,s):o.drawSolidLine(t,e,i,n,s))},o.drawArrow=function(t,e,i,o,n){isFinite(e)&&isFinite(o)&&isFinite(i)&&isFinite(n)&&(t.beginPath(),t.moveTo(o,n),t.lineTo(e,i),t.moveTo(e+2,i+2),t.lineTo(e-2,i+2),t.moveTo(e-1,i+1),t.lineTo(e+1,i+1),t.stroke())},o.drawSolidLine=function(t,e,i,o,n){t.beginPath(),t.moveTo(e,i),t.lineTo(o,n),t.stroke()},o.setLineStyle=function(t,e){t.lineStyle=e;var i=[];e!==o.LINESTYLE_SOLID&&(i=o.computeDashPattern(t)),"function"==typeof t.setLineDash?t.setLineDash(i):void 0!==t.mozDash?t.mozDash=i:void 0!==t.webkitLineDash&&(t.webkitLineDash=i)},o.drawPoly=function(t,e,i){var o,n;for(t.beginPath(),t.moveTo(e[0].x,e[0].y),o=0;o<e.length;o++)n=e[o],t.lineTo(n.x,n.y);t.closePath(),t.stroke(),i&&t.fill()},o.lineStyles=[],"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.setFont=function(t){if(this.font!==t)try{this.font=t}catch(t){}},CanvasRenderingContext2D.prototype.lineStyle=o.LINESTYLE_SOLID,o.originalSave=CanvasRenderingContext2D.prototype.save,o.originalRestore=CanvasRenderingContext2D.prototype.restore,CanvasRenderingContext2D.prototype.save=function(){o.lineStyles.push(this.lineStyle),o.originalSave.call(this)},CanvasRenderingContext2D.prototype.restore=function(){o.lineStyles.length>0&&(this.lineStyle=o.lineStyles.pop(),o.originalRestore.call(this))},CanvasRenderingContext2D.prototype.drawDashedLine=function(t,e,i,n,s){t.save();var r=o.computeDashPattern(t);if(t.beginPath(),"function"==typeof t.setLineDash)t.setLineDash(r);else if(void 0!==t.mozDash)t.mozDash=r;else{if(void 0===t.webkitLineDash)return t.dashedLineTo(e,i,n,s,r),t.stroke(),void t.restore();t.webkitLineDash=r}t.moveTo(e,i),t.lineTo(n,s),t.stroke(),t.restore()},CanvasRenderingContext2D.prototype.dashedLineTo=function(t,i,o,n,s){var r,a,l,h,c,d,p={thereYet:e.greaterThan,cap:Math.min},u={thereYet:e.greaterThan,cap:Math.min};for(i-n>0&&(u.thereYet=e.lessThan,u.cap=Math.max),t-o>0&&(p.thereYet=e.lessThan,p.cap=Math.max),this.moveTo(t,i),r=t,a=i,l=0,h=!0;!p.thereYet(r,o)||!u.thereYet(a,n);)c=Math.atan2(n-i,o-t),d=s[l],r=p.cap(o,r+Math.cos(c)*d),a=u.cap(n,a+Math.sin(c)*d),h?this.lineTo(r,a):this.moveTo(r,a),l=(l+1)%s.length,h=!h},CanvasRenderingContext2D.prototype.roundRect=function(t,e,i,o,n){this.beginPath(),this.moveTo(t+n,e),this.lineTo(t+i-n,e),this.arcTo(t+i,e,t+i,e+n,n),this.lineTo(t+i,e+o-n),this.arcTo(t+i,e+o,t+i-n,e+o,n),this.lineTo(t+n,e+o),this.arcTo(t,e+o,t,e+o-n,n),this.lineTo(t,e+n),this.arcTo(t,e,t+n,e,n)}),t.exports=o}).call(e,i(21))},function(t,e){"use strict";var i={};i.lessThan=function(t,e){return t<=e},i.greaterThan=function(t,e){return t>=e},i.clamp=function(t,e,i){return Math.min(Math.max(t,e),i)},i.sign=function(t){return t<0?-1:t>0?1:0},i.isBaseDecimal=function(t){if(t<0)return TradingView.logDebugChart("MathEx.isBaseDecimal: argument less zero"),!1;for(var e=t;e>1;e/=10)if(e%10!==0)return!1;return!0},i.greaterOrEqual=function(t,e,i){return e-t<=i},i.equal=function(t,e,i){return Math.abs(t-e)<i},i.log10=function(t){return t<=0?void TradingView.logDebugChart("MathEx.log10: argument less or equal zero"):Math.log(t)/Math.log(10)},i.defComparator=function(t,e){return t<e?-1:t>e?1:0},i.min=function(t,e){var o,n;if(!Array.isArray(t))throw Error("argument is not array");if(t.length<1)throw Error("array is empty");for(e||(e=i.defComparator),o=t[0],n=0;n<t.length;++n)e(t[n],o)<0&&(o=t[n]);return o},i.max=function(t,e){var o,n;if(!Array.isArray(t))throw Error("argument is not array");if(t.length<1)throw Error("array is empty");for(e||(e=i.defComparator),o=t[0],n=0;n<t.length;++n)e(t[n],o)>0&&(o=t[n]);return o},i.Point=function(t,e){this.x=t,this.y=e},i.Point.prototype.add=function(t){return new i.Point(this.x+t.x,this.y+t.y)},i.Point.prototype.addScaled=function(t,e){return new i.Point(this.x+e*t.x,this.y+e*t.y)},i.Point.prototype.substract=function(t){return new i.Point(this.x-t.x,this.y-t.y)},i.Point.prototype.dotProduct=function(t){return this.x*t.x+this.y*t.y},i.Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.Point.prototype.scaled=function(t){return new i.Point(this.x*t,this.y*t)},i.Point.prototype.normalized=function(){return this.scaled(1/this.length())},i.Point.prototype.transponed=function(){return new i.Point(-this.y,this.x)},i.Point.prototype.clone=function(){return new i.Point(this.x,this.y)},i.Matrix=function(){this._rows=[[1,0,0],[0,1,0],[0,0,1]]},i.Matrix.prototype.mult=function(t){var e,o,n,s,r;if(t instanceof i.Matrix){for(e=new i.Matrix,o=0;o<3;o++)for(n=0;n<3;n++)for(e._rows[o][n]=0,s=0;s<3;s++)e._rows[o][n]+=this._rows[o][s]*t._rows[s][n];return e}if(t instanceof i.Point){for(r=[t.x,t.y,1],e=[0,0,0],o=0;o<3;o++)for(n=0;n<3;n++)e[o]+=r[n]*this._rows[o][n];return new i.Point(e[0],e[1])}throw Error("unsupported type")},i.Matrix.rotate=function(t){var e=new i.Matrix;return e._rows[0][0]=Math.cos(t),e._rows[1][1]=Math.cos(t),e._rows[0][1]=-Math.sin(t),e._rows[1][0]=Math.sin(t),e},i.Matrix.scale=function(t,e){var o=new i.Matrix;return o._rows[0][0]=t,o._rows[1][1]=e,o},i.Matrix.translate=function(t,e){var o=new i.Matrix;return o._rows[0][2]=t,o._rows[1][2]=e,o},i.distanceToLine=function(t,e,i){var o=e.substract(t),n=i.substract(t),s=n.dotProduct(o)/o.dotProduct(o),r=t.addScaled(o,s);return{distance:r.substract(i).length(),coeff:s}},i.distanceToSegment=function(t,e,o){var n,s,r=i.distanceToLine(t,e,o);return 0<=r.coeff&&r.coeff<=1?r:(n=t.substract(o).length(),s=e.substract(o).length(),n<s?{distance:n,coeff:0}:{distance:s,coeff:1})},i.intersectLines=function(t,e,i,o){var n,s,r,a=e.substract(t),l=o.substract(i),h=a.x*l.y-a.y*l.x;return Math.abs(h)<1e-6?null:(n=t.substract(i),s=n.y*l.x-n.x*l.y,r=s/h)},i.intersectSegment=function(t,e,o,n){var s,r,a,l=i.intersectLines(t,e,o,n);return null===l?null:(s=e.substract(t),r=s.scaled(l).add(t),a=i.distanceToSegment(o,n,r),Math.abs(a.distance)<1e-6?l:null)},i.pointInRect=function(t,e,i){return t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y},i.pointInTriangle=function(t,e,o,n){var s=t.add(e).scaled(.5),r=s.add(o).scaled(.5),a=i.intersectSegment(t,e,r,n);return null===a&&(a=i.intersectSegment(e,o,r,n),null===a&&(a=i.intersectSegment(o,t,r,n),null===a))},i.intersectRayWithRect=function(t,e,o,n){var s,r,a=i.intersectLines(t,e,o,new i.Point(n.x,o.y)),l=i.intersectLines(t,e,new i.Point(n.x,o.y),n),h=i.intersectLines(t,e,n,new i.Point(o.x,n.y)),c=i.intersectLines(t,e,new i.Point(o.x,n.y),o),d=[];return a&&a>=0&&d.push(a),l&&l>=0&&d.push(l),h&&h>=0&&d.push(h),c&&c>=0&&d.push(c),0===d.length?null:(d.sort(function(t,e){return t-e}),s=i.pointInRect(t,o,n)?d[0]:d[d.length-1],r=t.addScaled(e.substract(t),s))},i.isInPolygon=function(t,e){var i,o,n=0,s=t.length-1,r=!1,a=e.x,l=e.y;for(n=0;n<t.length;n++)i=t[n],o=t[s],(i.y<l&&o.y>=l||o.y<l&&i.y>=l)&&i.x+(l-i.y)/(o.y-i.y)*(o.x-i.x)<a&&(r=!r),s=n;return r},i.isInCircle=function(t,e,i){var o=(i.x-t.x)*(i.x-t.x)+(i.y-t.y)*(i.y-t.y),n=e*e;return o<=n},i.optionalCorner=function(t,e,o,n){return Math.abs(t.x-e.x)>1e-6&&Math.abs(t.y-e.y)>1e-6?0===Math.round(t.x)||0===Math.round(e.x)?0===Math.round(t.y)||0===Math.round(e.y)?new i.Point(0,0):new i.Point(0,n):0===Math.round(t.y)||0===Math.round(e.y)?new i.Point(o,0):new i.Point(o,n):null},t.exports=i},function(t,e,i){(function(t){var e={};e.LINESTYLE_SOLID=0,e.LINESTYLE_DOTTED=1,e.LINESTYLE_DASHED=2,e.LINESTYLE_LARGE_DASHED=3,e.TEXTPOS_TOPLEFT=0,e.TEXTPOS_TOPCENTER=1,e.TEXTPOS_TOPRIGHT=2,e.TEXTPOS_MIDDLELEFT=3,e.TEXTPOS_MIDDLECENTER=4,e.TEXTPOS_MIDDLERIGHT=5,e.TEXTPOS_BOTTOMLEFT=6,e.TEXTPOS_BOTTOMCENTER=7,e.TEXTPOS_BOTTOMRIGHT=8,e.SIZE_AUTO="auto",e.SIZE_TINY="tiny",e.SIZE_SMALL="small",e.SIZE_NORMAL="normal",e.SIZE_LARGE="large",e.SIZE_HUGE="huge",e.MARKLOC_ABOVEBAR="AboveBar",e.MARKLOC_BELOWBAR="BelowBar",e.MARKLOC_TOP="Top",e.MARKLOC_BOTTOM="Bottom",e.MARKLOC_RIGHT="Right",e.MARKLOC_LEFT="Left",e.MARKLOC_ABSOLUTE="Absolute",e.MARKLOC_ABSOLUTEUP="AbsoluteUp",e.MARKLOC_ABSOLUTEDOWN="AbsoluteDown",e.HHISTLOC_RELATIVE="relative",e.HHISTLOC_ABSOLUTE="absolute",e.HHISTDIR_LEFTTORIGHT="left_to_right",e.HHISTDIR_RIGHTTOLEFT="right_to_left",void 0!==t&&t&&t.exports&&(t.exports=e)}).call(e,i(2)(t))},function(t,e){String.prototype.left=function(t){if(!TradingView.isInteger(t))throw Error("invalid length");if(t>this.length)throw Error("invalid length");return this.substring(0,t)},String.prototype.right=function(t){if(!TradingView.isInteger(t))throw Error("invalid length");if(t>this.length)throw Error("invalid length");return this.substring(this.length-t,this.length)},String.prototype.trimmed=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"")},String.prototype.startsWith=function(t){return!(t.length>this.length)&&this.left(t.length)===t}},function(t,e){"use strict";var i,o=function(){try{this.isAvailable=!0,this.localStorage=window.localStorage,this.localStorage.setItem("tvlocalstorage.available","true")}catch(t){delete this.isAvailable,delete this.localStorage}this._updateLength()};o.prototype.length=0,o.prototype.isAvailable=!1,o.prototype.localStorage={"tvlocalstorage.available":"false"},o.prototype._updateLength=function(){var t,e;if(this.isAvailable)this.length=this.localStorage.length;else{t=0;for(e in this.localStorage)this.localStorage.hasOwnProperty(e)&&t++;this.length=t}},o.prototype.key=function(t){return this.isAvailable?this.localStorage.key(t):Object.keys(this.localStorage)[t]},o.prototype.getItem=function(t){return this.isAvailable?this.localStorage.getItem(t):this.localStorage[t]},o.prototype.setItem=function(t,e){this.isAvailable?this.localStorage.setItem(t,e):this.localStorage[t]=e,this._updateLength()},o.prototype.removeItem=function(t){this.isAvailable?this.localStorage.removeItem(t):delete this.localStorage[t],this._updateLength()},o.prototype.clear=function(){this.isAvailable?this.localStorage.clear():this.localStorage={},this._updateLength()},i=function(t){this.storage=t},i.prototype.getItem=function(t){return Promise.resolve(this.storage.getItem(t))},i.prototype.setItem=function(t,e){return Promise.resolve(this.storage.setItem(t,e))},window.TVLocalStorage=new o,window.TVLocalStorageAsync=new i(window.TVLocalStorage),t.exports={TVLocalStorage:window.TVLocalStorage,TVLocalStorageAsync:window.TVLocalStorageAsync}},function(t,e,i){(function(t){"use strict";var e,i="tvxwevents.",o={},n=$.browser.msie||/\btrident\b/i.test(navigator.userAgent);$(window).on("storage",function(t){if(null!==t.originalEvent.newValue){var s=t.originalEvent.key;if(s.startsWith(i))return s=s.substr(i.length),n&&e._emitting?void(e._emitting=!1):void(o[s]&&o[s].forEach(function(e){e.call(t.originalEvent.newValue,t.originalEvent.newValue)}))}}),e=window.TVXWindowEvents={on:function(t,e){o[t]||(o[t]=[]),o[t].push(e)},off:function(t,e){if(o[t]){var i=o[t].indexOf(e);i!==-1&&(1===o[t].length?delete o[t]:o[t].splice(i,1))}},current:function(t){return TVLocalStorage.getItem(i+t)},emit:function(t,o){void 0===o&&(o=+new Date),o!==TVLocalStorage.getItem(i+t)&&(n&&(e._emitting=!0),TVLocalStorage.setItem(i+t,o))}},void 0!==t&&t&&t.exports&&(t.exports=e)}).call(e,i(2)(t))},function(t,e,i){(function(t){TradingView.cleanButAmpersand=function(t,e){var i=e?["&amp;"]:["&"];return TradingView.clean(t,e,i)},TradingView.strip_tags=function(t){return t&&t.replace?t.replace(/(<([^>]+)>)/gi,""):t},TradingView.encodeSpread=function(t){return encodeURIComponent(t)},TradingView.clean=function(t,e,i){var o,n,s,r=[["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#039;"],["'","&#39;"]],a=t;if(!t||!t.replace)return a;for(o=0;o<r.length;o++)n=r[o][0],s=r[o][1],i&&i.indexOf&&i.indexOf(e?s:n)!==-1||(a=e?a.replace(RegExp(s,"g"),n):a.replace(RegExp(n,"g"),s));return a},void 0!==t&&t&&t.exports&&(t.exports={clean:TradingView.clean,cleanButAmpersand:TradingView.cleanButAmpersand})}).call(e,i(2)(t))},function(module,exports,__webpack_require__){(function(Featuresets,Delegate,Mustache,ZeroClipboard,moment,process,PineJsCalendar,Spinner){"use strict";function loginUser(t){function e(){"function"==typeof TVDialogs.onSigninSuccess&&(TVDialogs.onSigninSuccess(),TVDialogs.onSigninSuccess=void 0)}window.iframeAuthWidget&&t.is_first_login&&(window.iframeAuthWidget.preventClose=!0),user=$.extend(!0,{},t),TradingView.changeLoginState(!0),TVDialogs.modalDialog&&"Log in"===TVDialogs.modalDialog.data("title")&&TVDialogs.destroy(),t.is_first_login?setTimeout(function(){var t={user:user,afterLoginFunction:e};TradingView.phoneVerification.isRequired()&&(t.buttonCaption=$.t("Next")),window.iframeAuthWidget&&(window.iframeAuthWidget.preventClose=!1,t.onDestroy=window.iframeAuthWidget.postClose),TradingView.trackRegistrationEvent("Social"),TVDialogs.showAfterSocialSign(t)},0):e()}function showDisabledAccountError(){TVDialogs.showError($.t("Error: Account is disabled"))}function followButtonsHandler(t){t.on("click",".follow-big",function(){var t=$(this);t.hasClass("unfollow")?window.relationChange(t,0,t.data("userid")):(window.relationChange(t,1,t.data("userid")),t.hover())}).on("mouseenter",".follow-big",function(){$(this).hasClass("unfollow")&&$(this).text($.t("Unfollow"))}).on("mouseleave",".follow-big",function(){$(this).hasClass("unfollow")&&$(this).text($.t("Following"))})}function updateSuggestedView(t,e){var i=$(".chart-"+t+"-suggested-button");i.toggleClass("active",!!e)}function onLoginStateChange(is_initial){$("html").toggleClass("is-authenticated",is_authenticated).toggleClass("is-not-authenticated",!is_authenticated).toggleClass("is-pro",is_authenticated&&user&&!!user.is_pro).toggleClass("is-not-pro",!(is_authenticated&&user&&user.is_pro)).toggleClass("is-trial",is_authenticated&&user&&"pro_realtime_trial"===user.pro_plan).toggleClass("is-not-trial",!(is_authenticated&&user&&"pro_realtime_trial"===user.pro_plan)).toggleClass("is-mobile",!!TradingView.isMobileView),TVSettings.sync(user.settings),is_initial||TradingView.dropPrerenderCache(),is_authenticated?(is_initial||($(".header-item-profile strong.user-badge").remove(),$(".header-item-profile > a").append(TradingView.userBadge(user,!0,"strong")),$('input[name="csrfmiddlewaretoken"]').val($.cookie("csrftoken")||"")),$(".user-info-username").html(user.username),$(".following_count").html(user.following),$(".followers_count").html(user.followers),$(".saved_charts_count").html(user.saved_charts),$(".published_charts_count").html(user.published_charts),$(".treated_charts_count").html(user.treated_charts_count),$("img.user-picture, .user-picture img").attr("src",user.userpic),$(".trial-days-left").html(user.trial_days_left||""),$(".header-item-profile").find("a").each(function(t,e){e=$(e);var i=e.attr("rel");i&&e.attr("href",i.replace("%u",user.username))}),user.fastpass_script&&eval(user.fastpass_script),user.is_first_login&&(TradingView.trackEvent("Conversion","First login"),user.prort_trial_started&&(TVDialogs.showTrialMessageSuccess(),delete user.prort_trial_started),delete user.is_first_login),TradingView.setTrialAvailiable(user.trial_availiable)):(user={username:"Guest",following:"0",followers:"0",ignore_list:{}},$(".user-info-username").html(user.username),TVLocalStorage.removeItem("trial_availiable")),window.studyTemplates&&(window.studyTemplates.refreshStudyTemplateList(),window.studyTemplates.refreshFavoriteDropdownMenu())}function userlink(t,e){var i=__webpack_require__(46);return Mustache.render(i.userlink,{username:t,is_pro:function(){return!!e},is_realtime:function(){return"pro_realtime"===e},is_premium:function(){return"pro_premium"===e},is_trial:function(){return"pro_realtime_trial"===e}},i)}function proBadge(t,e){var i=__webpack_require__(46);return void 0===t||t?Mustache.render(i.proBadge,{is_realtime:"pro_realtime"===t,is_premium:"pro_premium"===t,is_trial:"pro_realtime_trial"===t,large_badge:!!e}):""}var loginStateChange,assert,availableTimezones,i,backend=__webpack_require__(36),GlobalEventsStorage=__webpack_require__(38);$(document).ajaxSend(function(t,e,i){"POST"!==i.type||i.crossDomain||(e.setRequestHeader("X-CSRFToken",$.cookie("csrftoken")),e.setRequestHeader("sessionid",$.cookie("sessionid"))),i.crossDomain&&!i.forceLanguageHeader||(window.language?e.setRequestHeader("X-Language",window.language):console.warn("window.language is not defined"))}),String.prototype.format||(String.prototype.format=function(){var t=arguments;return this.replace(/{(\d+)}/g,function(e,i){return void 0!==t[i]?t[i]:e})}),"string"==typeof $.cookie("csrftoken")&&""!==$.cookie("csrftoken")?$("#update-status-li").append('<a href="#" onclick="TradingView.showChangeUserStatusDialog(); return false;">'+$.t("Update Status")+"</a>"):$("#update-status-li").empty(),!TradingView||!TradingView.onChartPage||Modernizr.canvas&&Modernizr.canvastext&&Modernizr.websockets||(window.location="/badbrowser/"),$(document).ready(function(){$(".tv-select").selectbox({speed:100,classHolder:"tv-select-container"}),Modernizr.canvas&&Modernizr.canvastext&&Modernizr.websockets||TVDialogs.showNotice($.t("Oops, your browser is not supported!"),{html:$.t("Please update your browser to the latest version, or use one of the following:")+'<ul><li><a href="http://www.google.com/chrome/" target="_blank">Chrome</a></li><li><a href="http://www.mozilla.com" target="_blank">Firefox</a></li><li><a href="http://www.apple.com/safari/" target="_blank">Safari</a></li><li><a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home" target="_blank">Internet Explorer 11</a></li><li><a href="http://www.microsoft.com/en-us/windows/microsoft-edge" target="_blank">Microsoft Edge</a></li></ul>',classSuffix:"slim",doNotCloseOnBgClick:!0}),!Featuresets.enabled("websocket_connection")||"WebSocket"in window||swfobject.hasFlashPlayerVersion("9.0.0")||TVDialogs.showNotice($.t("TradingView Notice"),{html:$.t("It appears that your browser does not support <strong>WebSocket</strong> technology and does not have <strong>Adobe Flash</strong> plugin installed, one of which is essential for our portal.<br/>")+$.t('Please, <a href="http://get.adobe.com/flashplayer/" target="_blank">install Flash plugin</a> or consider updating to one of these modern browsers with WebSocket support:')+'<ul><li><a href="http://www.google.com/chrome/" target="_blank">Chrome</a></li><li><a href="http://www.apple.com/safari/" target="_blank">Safari</a></li></ul>',classSuffix:"slim",doNotCloseOnBgClick:!0}),TradingView.onWidget()||$(".chart-description").TVEmbeds()}),loginStateChange=window.loginStateChange=new Delegate,loginStateChange.subscribe(null,onLoginStateChange),TVXWindowEvents.on("loginStateChange",function(){var t=JSON.parse(this);window.user=t.user,window.is_authenticated=!!t.is_authenticated,loginStateChange.fire()}),function(){var t="user-obj-changed",e={};window.crossTabSyncUserAttr=function(e){var i={};e instanceof Array?e.forEach(function(t){i[t]=window.user[t]}):i[e]=window.user[e],TVXWindowEvents.emit(t,JSON.stringify(i))},window.onChangeUserAttrInAnotherTab=function(t){var i=new Delegate;return e[t]||(e[t]=[]),e[t].push(i),i},TVXWindowEvents.on(t,function(t){var i,o;t=JSON.parse(t);for(i in t)if(window.user[i]=t[i],e[i])for(o=0;o<e[i].length;o++)e[i][o].fire(t[i])})}(),TradingView.trackEvent=function(t,e,i){var o,n,s,r,a;if(Featuresets.enabled("charting_library_base")){for(e=e||t||i||"",o=[/Study_(Drawing)_(.*)/,/(Study)_(.*)@tv-basicstudies/,/(Study)_(.*)/,/(Chart Style) (.*)/],n="",s=0;s<o.length;s++)if(r=e.match(o[s]),r&&3===r.length){e=r[1],n=r[2];break}return void GlobalEventsStorage.emit(e.toLowerCase().replace(" ","_"),{category:t,value:n,label:i})}window._UNIT_TESTS||"undefined"==typeof _gaq||(a=["_trackEvent",t,e],void 0!==i&&a.push(i),_gaq.push(a))},TradingView.trackRegistrationEvent=function(t){var e,i;t&&TradingView.signupSource&&(e="Registration",i=TradingView.signupSourceParameters,i&&(i.additionalCategories&&i.additionalCategories.forEach(function(t){TradingView.trackEvent(t+" "+e,TradingView.signupSource)}),TradingView.signupSourceParameters=null),TradingView.trackEvent(e,TradingView.signupSource),TradingView.trackEvent("Registration medium",t),TradingView.signupSource=null)},TradingView.eventsTracking={filterNamesMap:{script_type:"Indicators and Strategies","script_type-indicators":"Indicators","script_type-strategies":"Strategies",stream:"All Markets","stream-stocks":"Stocks","stream-indices":"Indices","stream-commodities":"Commodities","stream-currencies":"Currencies","stream-bitcoin":"Bitcoin","interval-all":"All Intervals","interval-m":"Short Term","interval-h":"Medium Term","interval-dwm":"Long Term","sort-unmoderated":"Unmoderated","sort-trending":"Trending","sort-discussed":"Most Discussed","sort-viewed":"Most Viewed","sort-agreed":"Most Agreed","sort-suggested":"Suggested","sort-recent":"All Ideas","time-day":"Today","time-week":"This Week","time-month":"This Month","time-all":"All Time","by-everyone":"Everyone","by-following":"Following","by-me":"My Ideas"},goProFeaturesMap:{customIntervals:"Add Custom Interval",intradaySpread:"Inraday Spread",kagiRenko:"Japanese Intraday Chart",extendedHours:"Timezones Extended Hours",alerts:{prefix:"New Alerts Limit",widget:"Widget",chart:"Chart Header"},multipleCharts:"Multiple Charts Layout",savedChartsLimit:"Save Chart Limit",studyLimit:"Studies Limit",multipleWatchLists:{prefix:"Watchlists",new:"Create New List",rename:"Rename List",saveAs:"Save List As"},importWatchlist:"Watchlists Import Watchlist",exportWatchlist:"Watchlists Export Watchlist",BATSExchangePopup:"BATS Exchange Popup",DataQualityPopup:"Data Quality Popup",CHXEURExchangePopup:"CHXEUR Exchange Popup",FreeDelayPopup:"Free Delay Popup",proRTProduct:"Volume Profile"},trackFeature:{savedChartsLimit:!0,BATSExchangePopup:!0,CHXEURExchangePopup:!0,FreeDelayPopup:!0,DataQualityPopup:!0,intradaySpread:!0},trackGoPro:function(t,e,i){i&&!e&&(e=i,i=null);var o=TradingView.eventsTracking.goProFeaturesMap[e];if(o){if(i){if("string"==typeof o)return;o="{0} {1}".format(o.prefix,o[i])}TradingView.trackEvent(t,o)}}},TradingView.trackStreamFilterChangeEvent=function(t,e,i){var o,n,s=t+(e?"-"+e:"");s in TradingView.eventsTracking.filterNamesMap&&(o=i?"Script Filters":"Idea Filters",n=TradingView.eventsTracking.filterNamesMap[s],"sort-recent"===s&&i&&(n="All Scripts"),"by-me"===s&&i&&(n="My Scripts"),TradingView.trackEvent(o,n))},TradingView.tryTrackGoProFeature=function(t,e){t in TradingView.eventsTracking.trackFeature&&TradingView.trackGoProFeature(t,e)},TradingView.trackGoProFeature=function(t,e){TradingView.eventsTracking.trackGoPro("Gopro Features",t,e)},TradingView.trackGoProPageTransition=function(t,e){TradingView.eventsTracking.trackGoPro("Gopro",t,e)},assert=function(t,e){if(!t)throw Error("Assertion failed"+(e?": "+e:""))},window.assert=assert,TradingView.changeLoginState=function(t){window.is_authenticated=!!t,TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:is_authenticated,user:user})),loginStateChange.fire()},window.loginUser=loginUser,window.showDisabledAccountError=showDisabledAccountError,TradingView.signOut=function(){$.ajax({type:"POST",url:"/accounts/logout/",dataType:"html"}).done(function(){TradingView.changeLoginState(!1)})},window.runOrSignIn=function(t,e){if(e||(e={}),e.verifiedPhoneRequired===!0){var i=t;t=function(){TradingView.phoneVerification.whenVerified({showDialog:!0,source:e.source,verifyPhoneByFeature:!0,verifyPhoneMessage:e.verifyPhoneMessage,noVerifyDelay:e.noVerifyDelay,doNotCheckSuspicious:e.doNotCheckSuspicious}).done(i)}}is_authenticated||Featuresets.enabled("charting_library_base")?t():TVDialogs.showSignInDialog(t,{source:e.source,sourceMeta:e.sourceMeta,feature:e.feature})},TradingView.runOrGoPro=function(t,e){user&&user.is_pro?t():TVDialogs.showGoProDialog(e)},TradingView.handleIfNotError=function(t,e){t.error?console.log(t.error):e(t)},TradingView.handleIfNotErrorFunc=function(t){return function(e){TradingView.handleIfNotError(e,t)}},window.relationChange=function(t,e,i){var o=$(t);runOrSignIn(function(){var t;t=void 0===o.data("type")?e:o.data("type"),$.post("/social/follow-the-user/",{targetId:i,follow:t},function(e){t?(o.addClass("unfollow").removeClass("follow"),user.following++):(o.removeClass("unfollow").addClass("follow"),user.following--),o.mouseleave(),o.hasClass("follow-big")||window.followButtonTooltip(o),$(".following_count").text(user.following),o.data("type",1-t)},"json")},{source:"Follow user"})},window.followButtonsHandler=followButtonsHandler,TradingView.bindIdeasStreamFilter=function(t,e){e=e||{};var i=t.find(".filter").map(function(){function t(t,s){var l,h,c,d,f,m=$(this),v=m.data("name");return a===!0||a[v]?void(t&&t.preventDefault()):(_&&r.find(".temp").remove(),!is_authenticated&&m.hasClass("authorization-required")?(TVDialogs.showSignInDialog(null,{source:"Ideas stream filter"}),!1):(l=v?p.filter("[name="+v+"]"):p,h=m.data("value"),(l&&l.val()!==h||e.forceChange)&&(c=n.filter(".active").filter(v?"[data-name="+v+"]":"*").removeClass("active"),c.find(".active-underline").remove(),m.addClass("active"),l.val(h).change(),s||"function"!=typeof e.onChange||setTimeout(function(){e.onChange(t,l.attr("name"),h)},0)),d=m.data("hook"),d&&Object.keys(d).forEach(function(t){i.forEach(function(e){e.inputs.indexOf(t)>-1&&e.obj.setValue(d[t],t)})}),_&&0===r.find("a[data-value="+h+"]").length&&m.clone(!0).addClass("temp item").append('<span class="active-underline"></span>').appendTo(r),!e.notPreventDefault&&e.onChange&&t&&t.preventDefault(),_||(f=n.filter(".active[data-filter-title]:first").data("filter-title")||g,f?n.filter(".active").each(function(){f=f.replace("%"+$(this).data("name")+"%",$(this).contents(":first").text())}):f=m.contents(":first").text(),u.text(f)),void o(!0)))}function o(t){"boolean"!=typeof t&&(t=d),t?(c.stop(!0,!1).fadeOut(f),h.unbind("clickoutside").removeClass("active"),d=!1):(c.stop(!0,!1).fadeIn(f),h.one("clickoutside",o).addClass("active"),d=!0)}var n,s,r,a,l,h=$(this),c=h.find(".dropdown"),d=!1,p=h.find("input"),u=h.find(".selected"),_=!1,f=void 0===e.speed?50:e.speed,g=h.data("filter-title");return h.find(".selected").on("click",o),c.on("click","a",t),n=c.find("a"),s=h.parent(".filter-tabbed"),s.length&&(_=!0,r=s.find(".tabs"),n=n.add(r.find("a:not(.temp)")),r.on("click","a",t)),a={},h.find(".sub-group.inactive").find("a:first").each(function(t,e){a[$(e).data("name")]=!0}),l={setValue:function(e,i){var o=n.filter("a[data-value="+e+"]"+(p.length>1&&i?"[data-name="+i+"]":""));t.apply(o,[void 0,!0])},getActiveTitle:function(){return u.text()},disabled:function(t,e){e?$("[data-name="+e+"]",h).closest(".sub-group").addClass("inactive"):_?s.addClass("inactive "):h.addClass("inactive "),t||(e?("object"!=typeof a&&(a={}),a[e]=!0):a=!0)},enabled:function(t){t?($("[data-name="+t+"]",h).closest(".sub-group").removeClass("inactive"),"object"==typeof a&&(a[t]=!1)):(_?s.removeClass("inactive "):h.removeClass("inactive "),a=!1)}},h.data("interface",l),{inputs:p.map(function(t,e){return $(e).attr("name")}).get(),obj:l}}).get()},TradingView.bindIdeasStreamFilter.noTimePeriodsFilters=["suggested","recent","best","unmoderated"],TradingView.bindProfileTabsFilter=TradingView.bindIdeasStreamFilter,TradingView.GoToChartField=function(t,e){function i(t,e){var i,n={};(t||o.options&&o.options.defaultSymbol)&&(n.symbol=((t||o.options.defaultSymbol)+"").toUpperCase()),e&&(n.interval=e),i="/chart/",Object.keys(n).length&&(i+="?"+$.param(n)),location.href=i}var o,n=__webpack_require__(39);this.$element=t,this.$field=this.$element.find("input"),this.$button=this.$element.find("span"),this.options=e,this.$button.on("click",function(){if(!this.$field.val()){var t=(o.options||{}).defaultSymbol||"";t&&this.$field.val((t+"").toUpperCase())}this.symbolSearch.acceptTypeIn()}.bind(this)),this.$element.on("keyup",function(){this.$element.toggleClass("not-empty",!!this.$field.val().length)}.bind(this)),this.symbolSearch=n.bindToInput(this.$field,$.extend((this.options||{}).symbolSearch,{
callback:i,onEmptyApply:i})),o=this},TradingView.GoToChartField.prototype.updateOptions=function(t){$.extend(this.options,t)},TradingView.SearchChartField=function(t){function e(t){t&&(t=t.toUpperCase(),location.href="/chart/"+TradingView.encodeSpread(t)+"/")}var i=__webpack_require__(39);this.$element=t,this.$field=this.$element.find("input"),this.$button=this.$element.find(".button"),this.symbolSearch=i.bindToInput(this.$field,{callback:e}),this.$field.placeholder(),this.$field.on("focus",function(){this.$element.addClass("active")}.bind(this)).on("blur",function(){this.$element.removeClass("active")}.bind(this)).on("keyup",function(){this.$element.toggleClass("not-empty",!!this.$field.val().length)}.bind(this)),this.$button.on("click",function(){this.symbolSearch.acceptTypeIn()}.bind(this))},TradingView.applyReadMoreToChart=function(t){var e=111,i=!1,o=t.find(".desc");o.html(o.html().replace(/<br>/g," ")).ellipsis(e,i,function(e){var i=t.find(".chart-read-more-container");i.css("display","block"),i.is(i.parent().children(":visible").last())&&t.css("padding-bottom","0px")})},window.chartWithCover=function(t){t.find(".date").each(function(){var t=$(this),e=new Date(t.text());TradingView.agoDateFormatter(t,e)}),t.find(".desc").each(function(){var t=$(this);t.height(t.parent().outerHeight()-t.position().top-5)}).ellipsis()},TradingView.deleteChart=function(t,e){TVDialogs.showConfirm($.t("Confirmation"),$.t("Are you sure you want to delete this chart?"),function(){return backend.removeChart(t,e)},null,{addClass:"delete-chart-dialog"})},TradingView.saveChart=function(t,e,i,o,n){var s=i,r=o;return s=function(t){e.id.value()||(e.id.setValue(t),e.uid.setValue(t)),"function"==typeof i&&i()},backend.saveChart(t.name,t.short_name,t.resolution,t,e,s,r)},TradingView.deletePublishedChart=function(t,e){var i;i=e.isScript?$.t("Are you sure you want to delete this script?"):$.t("Are you sure you want to delete this chart?"),TVDialogs.showConfirm($.t("Confirmation"),i,function(){e.onConfirm&&e.onConfirm(),$.post("/idea-delete/",{id:t},function(i){i.error?(e.onError&&e.onError(),TVDialogs.showNotice($.t("Error"),i.error)):(e.onSuccess&&e.onSuccess(),e.trigger&&$(window).trigger("delete-private-idea",[t]))})})},window.recommendChart=function(t,e){var i=e?$(e):$("#chart-recommend-button");i.hasClass("active")?i.removeClass("active"):i.addClass("active"),$.post("/recommend/",{id:t,type:"recommend"},function(e){i.toggleClass("active",!!e.state),$("#chart-"+t).toggleClass("hidden-idea",!e.state)})},window.suggestChart=function(t,e){var i=!$(e).hasClass("active");updateSuggestedView(t,i),$.post("/recommend/",{id:t,type:"hot",state:""+!!i},function(e){updateSuggestedView(t,e.state)})},window.chartTogglePublic=function(t,e){var i=e?$(e):$("#chart-public-button");i.toggleClass("active"),$.post("/togglepublic/",{id:t},function(t){i.toggleClass("active",!!t.state)})},window.chartRepostSTTW=function(t,e){var i=$(e);i.addClass("active"),$.post("/repoststtw/",{id:t},function(t){i.toggleClass("active",!!t.state)})},window.chartToggleIOTD=function(t,e){function i(){n.toggleClass("active",o)}var o,n=e?$(e):$("#chart-iotd-button");n.is(".disabled")||(o=n.hasClass("active"),n.toggleClass("active",!o),$.post("/toggle-iotd/",{id:t},function(e){e.state&&updateSuggestedView(t,!0)}).done(function(t){return t.error?(TVDialogs.showNotice($.t("Error"),t.error),i()):void n.toggleClass("active",!!t.state).toggleClass("disabled",!!t.disabled)}).fail(i))},TradingView.promoteIdea=function(t,e,i){function o(e,o){return o&&o.length>300?(a.removeClass("process"),TVDialogs.showError($.t("Maximum length of comment is 300 characters")),void l.focus()):void $.post("/promote/"+t+"/",{id:e,comment:o||""},function(t){t.error||"error"===t.status?TVDialogs.showError(t.error):($(i).addClass("active"),TVDialogs.destroy())}).fail(function(){TVDialogs.showError("Something went wrong.")}).always(function(){a.removeClass("process")})}var n,s,r,a,l,h=__webpack_require__(46);$(i).hasClass("active")||("pick_of_the_day"==t?(n=$.t("Comment:"),s=TVDialogs.createModalDialog(n,{addClass:"dialog-highlight"}),r=s.find("._tv-dialog-content").append(Mustache.render(h.dialogs.highlightCommentDialog)),a=s.find(".dialog-buttons ._tv-button.ok"),l=s.find(".message textarea"),a.on("click",function(t){var i=l.val().trim();i.length>0?(a.addClass("process"),o(e,i)):(TVDialogs.showError($.t("Comment required")),l.focus())}),TVDialogs.positionDialog(),TVDialogs.applyHandlers(null,{doNotCloseOnBgClick:!0})):(a=$(i),a.addClass("process"),o(e)))},window.trendingPeople=function(t){t.on("click",".column-trending-people .tabs a",function(e){var i=$(this);return!i.hasClass("active")&&(i.addClass("active").siblings("a").removeClass("active"),t.find(".top-user-group").hide().filter("."+i.attr("href").slice(1)).show(),void e.preventDefault())})},$.fn.TVTicker=function(t){function e(t){var e,i;return t=Math.abs(t),e=1,!TradingView.isInteger(t)&&t>1&&(t=parseFloat((""+t).replace(/^.+\./,"0."))),0<t&&t<1&&(i=(""+t).length-2,e=Math.pow(10,i)),e}return t=t||{},this.each(function(){function i(t){var i,o,n,s,r,l;a.trigger("tvticker-beforechange"),i=a.data("TVTicker"),o=i&&i.step,n=i.parser?i.parser(a.val()):TradingView.isInteger(o)?parseInt(a.val(),10):parseFloat(a.val()),isNaN(n)&&(n=0),s=e(n),r=e(o),s=Math.max(r,s),l=t(n,s),i.formatter&&(l=i.formatter(l)),a.val(l),a.change()}function o(){var t=a.data("TVTicker"),e=t&&t.step,o=t&&t.max;i(function(t,i){var n=(Math.round(t*i)+Math.round(e*i))/i;return void 0!==o&&null!==o&&o<n&&(n=t),n})}function n(){var t=a.data("TVTicker"),e=t&&t.step,o=t&&t.min;i(function(t,i){var n=(Math.round(t*i)-Math.round(e*i))/i;return void 0!==o&&null!==o&&n<o&&(n=t),n})}var s,r=!1,a=$(this),l=a.data("TVTicker");l?r=!0:l={step:+a.data("step")||1},"step"in t&&(l.step=+t.step||l.step),"min"in t&&(l.min=t.min),"max"in t&&(l.max=t.max),"formatter"in t&&(l.formatter=t.formatter),"parser"in t&&(l.parser=t.parser),a.data("TVTicker",l),r||(s=$('<div class="tv-ticker">').appendTo(a.parent()),$('<div class="icon up">').appendTo(s),$('<div class="icon down">').appendTo(s),a.next().find(".up, .down").on("mousedown",function(t){t.preventDefault(),a.focus()}),a.next().find(".up").click(function(){a.is(":disabled")||o()}),a.next().find(".down").click(function(){a.is(":disabled")||n()}),a.keydown(function(t){a.is(":disabled")||(38===t.keyCode?a.next().find(".up").addClass("active"):40===t.keyCode&&a.next().find(".down").addClass("active"))}),a.keyup(function(t){a.is(":disabled")||(38===t.keyCode?(o(),a.next().find(".up").removeClass("active")):40===t.keyCode&&(n(),a.next().find(".down").removeClass("active")))}),a.mousewheel(function(t,e){e>0?a.next().find(".up").click():a.next().find(".down").click()}))}),this},function(){function t(t){var e=0;t===!0&&(ChartApiInstance.disconnect(),e=500),setTimeout(ChartApiInstance.connect.bind(ChartApiInstance),e)}function e(e,i){var o=$('<div class="buttons">').appendTo(e.find("._tv-dialog-content .main"));$('<input type="button" class="_tv-button ok" value="'+$.t("Report a data issue")+'">').css("margin-right",15).click(function(){TVDialogs.destroy(),runOrSignIn(function(){new TradingView.UserBugReportDialog({modal:!0}).show().on("destroy",function(){t(i)})},{source:"Report data issue from disconnect dialog"})}).appendTo(o),$('<input type="button" class="_tv-button ok" value="'+$.t("Reconnect")+'">').click(function(){TVDialogs.destroy(),t(i)}).appendTo(o)}function i(){TradingView.trackEvent("System","Disconnect");var t="<p>"+$.t("Connection to server was lost")+"</p><p>"+$.t("How to fix:")+"</p><ol><li>"+$.t("Check firewall settings and make sure access to websocket ({0} port {1}) is open. Then click Reconnect or press F5.").format(window.WEBSOCKET_HOST,window.WEBSOCKET_PORT)+"</li><li>"+$.t('Your browser doesnt support <strong>WebSocket</strong> technology and does not have <strong>Adobe Flash</strong> plugin installed.<br>Please, <a href="http://get.adobe.com/flashplayer/" target="_blank">install Flash plugin</a> or consider updating to one of these modern browsers with WebSocket support:')+'<ul><li><a href="http://www.google.com/chrome/" target="_blank">Chrome</a></li><li><a href="https://www.mozilla.org/en-US/firefox/new/" target="_blank">Firefox</a></li></ul></li><li>'+$.t("Server broke the connection. Click Reconnect or press F5.")+"</li></ol>";e(TVDialogs.showNotice($.t("Connection is lost"),{html:t,classSuffix:"disconnect",removeOkButton:!0,doNotCloseOnBgClick:!0,width:"500px"}))}window.showDisconnectedMessage=function(){"MozWebSocket"in window&&TradingView.WEB_SOCKET_WAS_CONNECTED?setTimeout(i,15e3):i()},window.showCriticalErrorMessage=function(){TradingView.trackEvent("System","Critical Error"),e(TVDialogs.showNotice($.t("Oops, something went wrong"),{html:$.t("Please report the issue or click Reconnect."),classSuffix:"critical",removeOkButton:!0,doNotCloseOnBgClick:!0,width:"500px"}),!0)}}(),window.toggleUserSavedCharts=function t(e){var i=$(e).toggleClass("active");$(".my-saved-charts").toggle(),i.is(".active")?$(document).bind("click.toggleUserSavedCharts",function(i){$(i.target).is(".saved-charts-button")||t(e)}):$(document).unbind("click.toggleUserSavedCharts")},window.makeDirectionName=function(){return function(t,e){var i=e(t);return"0"===i?$.t("Neutral"):"1"===i?$.t("Long"):$.t("Short")}},window.gotochart=function(t){location.href="/v/"+t+"/"},$.fn.ellipsis=function(){return this.each(function(t,e,i){var o,n,s,r=$(this),a=r.text(),l=a,h=$(this.cloneNode(!0)).hide().css({position:"absolute",overflow:"visible",height:"auto",width:r.width()});for(t=t||r.height(),r.after(h),o=h.height()-t,s=0;o>0;)if(l=l.substr(0,l.length-o/2),h.text(l+"…"),o=h.height()-t,n=!0,s++>500){console.warn($.t("Error: too long text"));break}r.text(h.text()),n&&"function"==typeof i&&i(r),e&&a!==h.text()&&r.attr("title",a),h.remove()},arguments)},function(t){var e=t('<div class="blue-tooltip-icon icon" />'),i=t('<div class="blue-tooltip-text" />'),o=t('<div class="blue-tooltip blue-tooltip-hidden" />').append(e).append(i);t.fn.blueTooltip=function(n,s,r){return o.parent().length||o.appendTo(document.body),this.each(function(){var a=t(this);a.data("tooltip",n),a.off("mouseenter.tooltip").on("mouseenter.tooltip",function(){var n,l,h,c,d,p,u,_,f;Modernizr.touch||(n=5,r=r||"",i.html(a.data("tooltip")),o.attr("class","blue-tooltip"),o.addClass("blue-tooltip-"+s).addClass(r),l=(a.outerWidth()-o.outerWidth())/2,h=0,c=l+a.offset().left+o.outerWidth(),d=l+a.offset().left,p=t(window).width()-n,d<n?h=n-d:c>p&&(h=p-c),u=a.offset().left+l+h,_=0,f="","top"===s?(_=a.offset().top-o.outerHeight()-10,f="-=10"):"bottom"===s&&(_=a.offset().top+a.outerHeight()+10,f="+=10"),o.css({left:u,top:_,opacity:0}),e.css({left:Math.round(o.width()/2)-h}),o.stop().animate({top:f,opacity:1},200))}).off("mouseleave.tooltip").on("mouseleave.tooltip",function(t){o.addClass("blue-tooltip-hidden").removeClass(r)})})}}(jQuery),TradingView.Tooltip=function(){function t(){clearTimeout(r),clearTimeout(a),jQuery.contains(document.body,c[0])&&(c.css("opacity","0"),a=setTimeout(c.detach.bind(c),l/2))}function e(t,e){var i,o=t.data("commonTooltipText")||"",n=t.attr("title");if(o||n||e)return n&&(o=$("<div/>").html(n).text(),t.data("commonTooltipText",o),t.removeAttr("title")),i={y:t.offset().top-$(window).scrollTop(),x:t.offset().left-$(window).scrollLeft(),w:t.outerWidth(),h:t.outerHeight()},{text:o,rect:i,vertical:t.hasClass("common-tooltip-vertical"),otl:t.hasClass("common-tooltip-otl"),otr:t.hasClass("common-tooltip-otr"),below:t.hasClass("common-tooltip-below"),above:t.hasClass("common-tooltip-above")}}function i(t,i){var n,s=$(t);return i=i||{},0!==s.size()&&(n=!(!i.text&&!i.$inner),i=$.extend({},e(s,n),i),void($.isEmptyObject(i)||o(i)))}function o(t){var e=jQuery.contains(document.body,c[0]);return clearTimeout(r),clearTimeout(a),e?(t.$inner?d.empty().append(t.$inner):d.text(t.text),s(t),n(t.colorTheme||"default"),c.addClass(t.addClass),void c.css("opacity","1")):void(r=setTimeout(function(){c.appendTo(document.body),o(t)},l))}function n(t){var e={white:"theme-white",default:""},i=Object.keys(e),o=i.indexOf(t)!==-1?e[t]:"";c.removeClass(i.filter(function(t){return!!t}).map(function(t){return e[t]}).join(" ")),o&&!c.hasClass(o)&&c.addClass(o)}function s(t){var e,i,o,n,s=t.rect;c.attr("class","common-tooltip-wrapper").css({top:"auto",right:"auto",bottom:"auto",left:"auto"}),Modernizr.pointerevents||c.addClass("no-pointer-events"),d.css({left:"0",width:"auto"}),d.width(d.width()+2),e=$(window).width(),i=$(window).height(),o=t.vertical,(o&&s.w<20||!o&&s.h<20)&&c.addClass("farther"),o?(c.addClass("vertical").css({left:s.x+s.w,top:s.y-(c.outerHeight()-s.h)/2}),n=t.otr?"otr":t.otl||d.offset().left+d.outerWidth()+h>e?"otl":"otr","otl"===n?c.addClass("otl").css({left:"auto",right:e-s.x}):c.addClass("otr")):(c.css({bottom:i-s.y,left:s.x-(c.outerWidth()-s.w)/2}),n=t.above?"above":t.below||d.offset().top-$(window).scrollTop()<h?"below":"above","below"===n?c.addClass("below").css({bottom:"auto",top:s.y+s.h}):c.addClass("above"),d.offset().left-h<0?d.css("left",Math.abs(d.offset().left)+h):d.offset().left+d.outerWidth()+h>e&&d.css("left",e-(d.offset().left+d.outerWidth()+h)))}var r,a,l=500,h=10,c=$("<div />").css("opacity","0"),d=$('<div class="common-tooltip-body" />').appendTo(c);return Modernizr.touch||$(document).on("mouseenter",".apply-common-tooltip",function(e){function o(){n.off("mouseleave mousedown",o),t()}if("buttons"in e){if(1&e.buttons)return}else if(1===e.which)return;var n=$(this);i(n),n.on("mouseleave mousedown",o)}),{show:o,showOnElement:i,hide:t}}(),$(function(){function t(t){$(t).attr("title")||t.offsetWidth+e>=t.scrollWidth||$(t).attr("title",$(t).text())}var e=$.browser.msie||/\btrident\b/i.test(navigator.userAgent)?1:0;$(document).on("mouseenter",".apply-overflow-title",function(){t(this)}),$(document).on("mouseenter",".apply-overflow-tooltip",function(){function t(){TradingView.Tooltip.hide(),i.off("mouseleave mousedown",t)}var i=$(this);i[0].offsetWidth+e>=i[0].scrollWidth||(TradingView.Tooltip.showOnElement(i[0],{text:i.text()}),i.on("mouseleave mousedown",t))})}),TradingView.GlobalNotification=function(t,e){var i,o,n=__webpack_require__(46);return this._options=e||{},i=this,this.id=t.id,(o=this._lastId())?void(this.id<=o||(i=this,this.container=$(Mustache.render(n.globalNotification,t)).prependTo($("body")),i.container.show(),this._options.addClass&&this.container.addClass(this._options.addClass),i.container.css("top",0),this._options.notShiftBody||$("body").addClass("padding-animate").css({paddingTop:i.container.outerHeight()}),TradingView.trackEvent("Global notification","Show notification "+t.id),this.container.find(".global-notification-close").on("click",function(){i.close()}),$.browser.msie||TVXWindowEvents.on(this.KEY+"-close",this._onCloseInAnotherTab.bind(this)))):void this._setLastId(this.id)},TradingView.GlobalNotification.prototype.KEY="globalNotification",TradingView.GlobalNotification.prototype._lastId=function(){var t=TVSettings.getInt(this.KEY,0,!0),e=TVSettings.getInt(this.KEY,0),i=Math.max(e,t);return t!==e&&TVSettings.setValue(this.KEY,i),!i&&$.cookie("notification_id")&&(i=~~$.cookie("notification_id"),TVSettings.setValue(this.KEY,i),$.cookie("notification_id",0,{expires:-1,path:"/"})),i},TradingView.GlobalNotification.prototype._setLastId=function(t){TVSettings.setValue(this.KEY,t)},TradingView.GlobalNotification.prototype.close=function(t){var e=this;this.container&&(t?(this.container.remove(),this.container=null):(e.container.css("top",-1*this.container.outerHeight()+"px"),setTimeout(function(){e.container.remove(),e.container=null,$(window).resize(),e._options.notShiftBody||$("body").removeClass("padding-animate")},1500),TVXWindowEvents.emit(e.KEY+"-close",JSON.stringify([e.id,+new Date])),this._setLastId(e.id)),this._options.notShiftBody||$("body").css({paddingTop:0}))},TradingView.GlobalNotification.prototype._onCloseInAnotherTab=function(t){t=JSON.parse(t),this.id<=t[0]&&this.close(!0)},window.closeGlobalNotification=function(t){$.cookie("notification_id",t,{expires:365,path:"/"}),$(".tv-global-notification").slideUp(400,function(){$(window).resize()})},TradingView.showThemeSaveDialog=function(t){var e=__webpack_require__(55).showChartNameDialog;e(function(e){e&&$.get("/theme/"+e+"/").success(function(i){var o,n=!!i.content;i={name:e,content:JSON.stringify(t.model().theme())},n?(o=$.t("Do you realy want to replace")+' "'+e+'"?',TVDialogs.showConfirm($.t("Confirm replacing"),o,function(){$.post("/save-theme/",i).error(function(t){console.error(t.responseText)}),t._lastLoadedTheme=e})):($.post("/save-theme/",i).error(function(t){console.error(t.responseText)}),TradingView.getThemesList.invalidate(),t._lastLoadedTheme=e)})},{title:$.t("Save theme as..."),label:$.t("Theme name"),error:$.t("Please enter theme name")},128)},TradingView.applySearchResetHandler=function(t){return t.on("change keyup",function(){$(this).val()?$(this).siblings(".input-reset").show():$(this).siblings(".input-reset").hide()}).change().siblings(".input-reset").on("click",function(){t.val("").change()})},TradingView.getImageOfChart=function(t,e,i){function o(i){var o,n,s;n=Featuresets.enabled("charting_library_base")?(e.snapshotUrl?"":"https://www.tradingview.com/x/")+i:window.location.protocol+"//"+window.location.host+"/x/"+i+"/",l.attr({href:n}),h.attr("data-clipboard-text",n),c.val(n),r.stop(),a.css({visibility:"visible"}),setTimeout(function(){var t=c.get(0);t.focus&&t.focus(),t.select&&t.select()},0),o=TradingView.ShareTwitterSnapshot.getStatus(t.activeChartWidget.value().symbolProperty().value(),n),$('<a class="twitter-share-button _tv-dialog-social _tv-dialog-social-twitter"></a>').attr({href:"https://twitter.com/share?count=none&text="+encodeURIComponent(o)+"&url=%20",rel:"nofollow"}).appendTo(p),$('<script src="//platform.twitter.com/widgets.js"></script>').appendTo(p),s=new ZeroClipboard(h),s.on("ready",function(t){s.on("aftercopy",function(t){TradingView.trackEvent("GUI","Copied Image Link"),TVDialogs.showMessage($.t("Copied to clipboard"))})})}var n,s,r,a,l,h,c,d,p,u;return e=e||{},TVDialogs.createModalDialog($.t("Image URL"),{addClass:"_tv-dialog-min-width"}),n=TVDialogs.modalDialog,s=n.find("._tv-dialog-content"),r=TradingView.unifiedSpinner("mini").spin(s.get(0)),a=$('<div class="main">').css({visibility:"hidden"}).appendTo(s),l=$("<a>").text($.t("Save image")).attr({target:"_blank"}).css("text-decoration","underline"),h=$('<span class="copy-clipboard-button _tv-button">'+$.t("Copy link")+"</span>"),c=$("<input>").attr({type:"text",readonly:!0}).bind("click focus",function(){this.select&&this.select()}),$("<p>").appendTo(a).append(l," "+$.t("or copy url:")),d=$('<form class="copy-image-url">').append(h,c),$("<p>").css({position:"relative"}).appendTo(a).append(d),ZeroClipboard.isFlashUnusable()&&d.addClass("copy-unavailable"),p=$('<p class="_tv-dialog-socials">').appendTo(a),TVDialogs.positionDialog(),TVDialogs.applyHandlers(),TradingView.trackEvent("GUI","Get image button"),ZeroClipboard.config({swfPath:TradingView.wrapUrl("images/ZeroClipboard.swf")}),u=__webpack_require__(61).takeSnapshot,u(t,function(t){i&&i(t),o(t)},function(){r.stop(),TVDialogs.showError($.t("URL cannot be received"),n)},{snapshotUrl:e.snapshotUrl}),!1},TradingView.getImageOfChartSilently=function(t,e,i){var o=__webpack_require__(61).takeSnapshot;return o(t,function(t){i&&i(t)},function(){console.warn($.t("Error while trying to create snapshot."))},{snapshotUrl:e.snapshotUrl}),!1},TradingView.dropPrerenderCache=function(){$('link[rel="prerender"]').remove()},window.onLoginStateChange=onLoginStateChange,window.markNewsAsRead=function(){$(".user-picture .notifications-counter").hide().addClass("hide"),$(".notifications-counter.counter").removeClass("new").text("0"),TVXWindowEvents.emit("zero-notification-counter")},window.followButtonTooltip=function(t){var e=t.hasClass("unfollow")?$.t("Unfollow"):$.t("Follow");t.attr("title",e)},TradingView.followButtonToolipAll=function(){$(".follow-link").each(function(t,e){e=$(e),e.data("tv_tooltip")||window.followButtonTooltip(e)})},window.isOnChartEditPage=function(){var t=RegExp(TradingView.urlRegExp.publishedChartOld),e=RegExp(TradingView.urlRegExp.publishedChart),i=RegExp(TradingView.urlRegExp.publishedScript);return t.test(location.pathname)||e.test(location.pathname)||i.test(location.pathname)},window.refreshChartMenuState=function(){function t(){s.hide(),n.show()}function e(){n.hide(),s.show()}function i(){is_authenticated&&user.saved_charts?e():t()}function o(e){var i,o=__webpack_require__(46),n=__webpack_require__(62).SidebarCustomScroll;return e={charts:e},e.charts&&e.charts.length?(r.empty(),r.append(Mustache.render(o.lists.savedCharts,e)),i=new n(r,r.find("ul").eq(0),{additionalClass:"gray",alwaysVisible:!0}),r.parent().one("hover",function(){i.updateScrollBar()}),void r.find("li").each(function(e,i){i=$(i);var o=i.find(".name").text();o.length>20&&i.attr("title",o),$("span.icon",i).click(function(e){var i=$(this).data("id");return r.mouseleave(),TradingView.deleteChart(i,function(){user.saved_charts--;var i=$(e.target).parent().attr("href");$(e.target).parent().parent().remove(),user.saved_charts||t(),!window.isOnChartEditPage()||user.saved_charts&&"/chart/"+chartWidget.metaInfo().uid+"/"!==i||(location.href="/chart/")}),!1})})):void t()}var n=$(".header-button.header-item-chart"),s=$(".header-menu.header-item-chart"),r=s.find(".popup-subblock");s.length&&r.length&&(s.on("closeMenu",function(){r.empty()}),s.on("openMenu",function(){backend.getCharts(o)}),i())},function(t){jQuery.fn.putCursorAtEnd=function(){return this.each(function(){if(t(this).focus(),this.setSelectionRange){var e=2*t(this).val().length;this.setSelectionRange(e,e)}else t(this).val(t(this).val());this.scrollTop=999999})},jQuery.fn.putCursorAtPosition=function(e){return this.each(function(){t(this).focus(),this.setSelectionRange&&this.setSelectionRange(e,e)})}}(jQuery),TradingView.ShareTwitterSnapshot=function(t){function e(t){return window.location.protocol+"//"+window.location.host+"/x/"+t+"/"}function i(t,i){return"https://twitter.com/intent/tweet?&status="+encodeURIComponent(TradingView.ShareTwitterSnapshot.getStatus(t,e(i)))}var o,n,s,r=__webpack_require__(63);TradingView.winMobileMode?(this.onSuccess=function(e){try{r.sendEvent(i(t,e),"sharing_ready")}catch(t){}},this.onFailure=function(){try{r.sendEvent("sharing_error")}catch(t){}}):(o=550,n=420,s=open("about:blank","snapshot_tweet","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width="+o+",height="+n+",left="+Math.round(screen.width/2-o/2)+",top="+Math.round(screen.height/2-n/2)),this.onSuccess=function(e){s.location.href=i(t,e)},this.onFailure=function(){s.close()})},TradingView.ShareTwitterSnapshot.getStatus=function(t,e){var i;return i=TradingView.isCmeWidget?e+" from cmegroup.com via @tradingview $"+t:"$"+t+" chart "+e+" via http://www.tradingview.com"},TradingView.ShareStocktwitsSnapshot=function(t){function e(t){return window.location.protocol+"//"+window.location.host+"/x/"+t+"/"}function i(t,i){return"https://stocktwits.com/widgets/share?body="+encodeURIComponent(TradingView.ShareStocktwitsSnapshot.getStatus(t,e(i)))}var o,n,s,r=__webpack_require__(63);TradingView.winMobileMode?(this.onSuccess=function(e){try{r.sendEvent(i(t,e),"sharing_ready")}catch(t){}},this.onFailure=function(){try{r.sendEvent("sharing_error")}catch(t){}}):(o=550,n=420,s=open("about:blank","snapshot_tweet","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width="+o+",height="+n+",left="+Math.round(screen.width/2-o/2)+",top="+Math.round(screen.height/2-n/2)),this.onSuccess=function(e){s.location.href=i(t,e)},this.onFailure=function(){s.close()})},TradingView.ShareStocktwitsSnapshot.getStatus=function(t,e){return"$"+t+" chart "+e+" via http://www.tradingview.com"},TradingView.authInStocktwits=function(t){runOrSignIn(function(){if(user.has_stocktwits)"function"==typeof t&&t();else{"function"==typeof t&&(user.on_stocktwits_auth_success=function(){var e=this;t.apply(e,Array.prototype.slice.call(arguments)),e.user.on_stocktwits_auth_success&&delete e.user.on_stocktwits_auth_success}.bind(window));var e=window.open("https://api.stocktwits.com/api/2/oauth/authorize?client_id="+window.stocktwits_consumer_key+"&response_type=code&redirect_uri="+location.protocol+"//"+location.host+"/accounts/return/stocktwits/&scope=publish_messages","stocktwits_permission_request","scrollbars=yes,height=400,width=700");e.focus()}},{source:"StockTwits auth"})},TradingView.agoDateFormatter=function(t,e,i){var o,n,s,r,a;i?(s=i(new Date-e),o=s.text,n=s.timeout):(r=moment(new Date).diff(e),o=moment(e).fromNow(),n=TradingView.agoDateFormatter.getUpdateTimeout(r),t.parent().toggleClass("just-now",r<45e3)),t.attr("title",e.toLocaleString()).text(o),a=null,n&&(t.attr("data-ago-date-timer")&&clearTimeout(+t.attr("data-ago-date-timer")),a=setTimeout(function(){TradingView.agoDateFormatter(t,e,i)},n)),t.attr("data-ago-date-timer",a)},TradingView.agoDateFormatter.destroy=function(t){$(t).find("*").andSelf().filter("[data-ago-date-timer]").each(function(){clearTimeout(+$(this).attr("data-ago-date-timer"))})},TradingView.agoDateFormatter.nextMinuteThrough=function(t){var e=6e4;return e-t%e},TradingView.agoDateFormatter.nextHourThrough=function(t){var e=36e5;return e-t%e},TradingView.agoDateFormatter.nextDayThrough=function(t){var e=864e5;return e-t%e},TradingView.agoDateFormatter.getUpdateTimeout=function(t){var e=200;if(t=Math.floor(t/6e4),t<60)e+=TradingView.agoDateFormatter.nextMinuteThrough(t);else if(t<1440)e+=TradingView.agoDateFormatter.nextHourThrough(t);else{if(!(t<43200))return!1;e+=TradingView.agoDateFormatter.nextDayThrough(t)}return e},TradingView.agoDateFormatter.fullFormat=function(t){var e,i=Math.floor(t/6e4),o=!1;return i<60?o=TradingView.agoDateFormatter.nextMinuteThrough(t):i<1440?o=TradingView.agoDateFormatter.nextHourThrough(t):i<43200&&(o=TradingView.agoDateFormatter.nextDayThrough(t)),o&&(o+=200),e=new Date-t,{text:moment(e).fromNow(),timeout:o}},TradingView.agoDateFormatter.shortFormat=function(t){var e=Math.floor(t/6e4),i="",o=!1;return e<60?(i=(e<1?0:e)+$.t("m"),o=TradingView.agoDateFormatter.nextMinuteThrough(t)):e<1440?(e=Math.floor(e/60),i=e+$.t("h"),o=TradingView.agoDateFormatter.nextHourThrough(t)):e<43200?(e=Math.floor(e/1440),i=e+$.t("d"),o=TradingView.agoDateFormatter.nextDayThrough(t)):e<15768e3?(e=Math.floor(e/43200),i=e+$.t("mn")):(e=Math.floor(e/15768e3),i=e+$.t("y")),o&&(o+=200),{text:i,timeout:o}},window.userlink=userlink,window.proBadge=proBadge,TradingView.userBadge=function(t,e,i){var o="",n="",s=__webpack_require__(46);if(t.top_user_info){if(o=t.top_user_info.badge?t.top_user_info.badge.title:"",n=t.top_user_info.badge?t.top_user_info.badge.class:"",t.is_pro)switch(o+=" | ",t.pro_plan){case"pro_realtime_trial":o+=$.t("Pro Trial");break;case"pro_premium":o+=$.t("Premium");break;default:o+=$.t("Pro")}t.is_moderator&&(o+=" | "+$.t("Moderator"))}return Mustache.render(t.userBadgeTmpl||s.userBadge,{is_moderator:t.is_moderator,is_pro:t.is_pro,is_realtime:"pro_realtime"===t.pro_plan,is_premium:"pro_premium"===t.pro_plan,is_trial:"pro_realtime_trial"===t.pro_plan,is_top:!!t.top_user_info,badge_class:n,badge_title:o,large_badge:!!e,badge_tag:i},s)},function(){function t(){var t=$(".publish-chart-button");t.size()&&(t.addClass("process"),o=setTimeout(e,3e4))}function e(){clearTimeout(o),$(".publish-chart-button").removeClass("process")}function i(i,o){function n(){o===!0?window.saver.publishChart(i):TVDialogs.showPublishIntroDialog().done(window.saver.publishChart.bind(window.saver,i))}runOrSignIn(function(){var i=function(){var t=TradingView.getUrlParams();return!(!t.publishsource||!~t.publishsource.toLowerCase().indexOf("dailyfx"))}();i?n():(t(),TradingView.phoneVerification.whenVerified({showDialog:!0,source:"Publish chart"}).done(n).always(e))},{source:"Publish chart",sourceMeta:"Chart"})}var o;TradingView.Common={publishChartWidget:function(t){i(t,!0)},publishChart:i}}(),TradingView.symbol2id=function(t){return t.replace(/[^a-z0-9]/gi,"_")},TradingView.isPro=function(){return is_authenticated&&user.is_pro},TradingView.isProRealtime=function(){return this.isPro()&&("pro_realtime"===user.pro_plan||"pro_realtime_trial"===user.pro_plan)},window.updateChartActiveLabel=function(t,e){null==t&&(t=$(".chart-activity-label")),t=$(t),t.each(function(){var t,i=$(this);null==e?t=i.hasClass("chart-activity-label-active"):(t=e,i.toggleClass("chart-activity-label-active",t)),i.find(".chart-activity-label-plate").text(t?$.t("Active"):$.t("Closed"))})},TradingView.centerBlock=function(t){var e=$(window),i=t.width(),o=t.height(),n=e.width(),s=e.height();t.css({left:Math.round((n-i)/2)+"px",top:Math.round((s-o)/2)+"px"})},TradingView.visitPaymentPageSwreg=function(t,e){if(!t.product_ids.hasOwnProperty(e))throw new TypeError("Unknown product");runOrSignIn(function(){var i,o;e in{pro:1,pro_yearly:1,pro_realtime:1,pro_realtime_yearly:1}&&user.is_pro&&user.pro_plan===e||(i={s:t.shop_id,q:1,d:0,v:0,bb:1,clr:1,clro:1,a:user.id,fn:user.first_name,sn:user.last_name,em:user.email,p:t.product_ids[e]},o=Object.keys(i).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(i[t])}),location.href=t.shop_url.replace(/(\?.*|$)/,"?"+o.join("&")))},{source:"Swreg payment"})},TradingView.visitPaymentPage=function(t,e,i){e=e||"y",i=i||{};var o="/order/";"bitcoin"===i.paymentMethod&&(o="/coinbase/begin/"),runOrSignIn(function(){var n=$('<form action="'+o+'" method="post"'+(i.newWindow?' target="_blank"':"")+'><input type="hidden" name="product" value="'+t+'"/><input type="hidden" name="billing_cycle" value="'+e+'"/><input type="hidden" name="fixed_billing_cycle" value="'+(i.fixedCycle?"true":"")+'"/><input type="hidden" name="exchanges_only" value="'+(i.exchangesOnly?"true":"")+'"/><input type="hidden" name="is_upgrade_from_m" value="'+(i.upgradeFromM?"true":"")+'"/></form>').appendTo(document.body);n.submit()},{source:"Paypal payment"})},TradingView.hash=function(t){var e,i,o=0;if(0===t.length)return o;for(i=0;i<t.length;i++)e=t.charCodeAt(i),o=(o<<5)-o+e,o&=o;return o},TradingView.uniq=function(t){return t.reduce(function(t,e,i){return~t.indexOf(e)?null:t.push(e),t},[])},window.bindLate=function(t,e){return function(){return t[e].apply(t,arguments)}},TradingView.memoize=function(t,e){var i=function(o){var n=i.cache,s=""+(e?e.apply(this,arguments):o);return n.hasOwnProperty(s)||(n[s]=t.apply(this,arguments)),n[s]};return i.cache={},i},TradingView.debounce=function(t,e){var i;return function(){clearTimeout(i),i=setTimeout(t.bind.apply(t,[this].concat(Array.prototype.slice.call(arguments))),e)}},TradingView.throttle=function(t,e,i){var o,n,s,r,a=null,l=0;return i||(i={}),r=function(){l=i.leading===!1?0:Date.now(),a=null,s=t.apply(o,n),a||(o=n=null)},function(){var h,c=Date.now();return l||i.leading!==!1||(l=c),h=e-(c-l),o=this,n=arguments,h<=0||h>e?(a&&(clearTimeout(a),a=null),l=c,s=t.apply(o,n),a||(o=n=null)):a||i.trailing===!1||(a=setTimeout(r,h)),s}},TradingView.isLatin=function(t){return!/[^\u0000-\u00FF\u00A0\u2013-\u2122\u2200-\u23FF]/g.test(t)},TradingView.isASCII=function(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)},TradingView.RegExpEscape=function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},window.follow=function(t){runOrSignIn(function(){var e,i=$(t.currentTarget),o=i.data("id");i.is(".self")||(e=i.is(".active")?0:1,$.ajax({url:"/social/follow-the-user/",type:"POST",data:{targetId:o,follow:e}}).done(function(t){return!t||t.error?void TVDialogs.showNotice($.t("Oops, something went wrong"),{html:t.error}):void $(".follow-user-"+o).toggleClass("active").attr("title",e?$.t("Unfollow"):$.t("Follow"))}))},{source:"Follow user",verifiedPhoneRequired:!0})},$("body").on("click","button.follow-user",window.follow),TradingView.keyboardBinder=function(){function t(t){n.forEach(function(e,i){e.name===t&&n.splice(i,1)})}function e(t){
for(var e=0;e<n.length;e++)if(n[e].name===t)return e}function i(t){var i=e(t.name);i?n[i]=t:n.push(t)}function o(t){var i=e(t.name);i&&n.splice(i,1),n.unshift(t)}var n=[];return $(window).on("keypress",function(t){for(var e=n.length-1;e>=0&&n[e].func(t)!==!0;e--);}),{registerListener:function(t,e){i({name:t,func:e})},removeListener:function(e){t(e)},pushBackListener:function(t,e){o({name:t,func:e})}}}(),window.chartRelationButtons=function(t){var e=t.closest("[data-chart-id]").data("chart-id");if(!e)throw Error("chartRelationButtons can`t find data-chart-id attribute");t.on("click",".agree",function(t){function i(){o.toggleClass("active",n)}var o,n;t.preventDefault(),o=$(this),n=o.hasClass("active"),runOrSignIn(function(){o.toggleClass("active",!n),$.post("/vote-for-chart/",{id:e,vote:1}).done(function(t){return t.error?(TVDialogs.showNotice("Error",t.error),i()):void(void 0!==t.result_score&&o.text(t.result_score||"").toggleClass("with-counter",0!==t.result_score))}).fail(i)},{source:"Chart agree"})}),t.on("click",".fav",function(t){function i(){o.toggleClass("active",n)}var o,n;t.preventDefault(),o=$(this),n=o.hasClass("active"),runOrSignIn(function(){o.toggleClass("active",!n);var t=n?"/remove-from-favorites/":"/add-to-favorites/";$.post(t,{id:e}).done(function(t){return t.error?i():void(void 0!==t.followers&&o.text(t.followers||"").toggleClass("with-counter",0!==t.followers))}).fail(i)},{source:"Chart favorite"})})},TradingView.makeTextContainerEditable=function(t,e,i){function o(e){t.removeClass("tv-editable-active").on("click",function(){a(i)}).off("mousedownoutside"),e&&t.empty().text(e)}function n(e){var e=e;t.addClass("tv-editable-active").off("click").on("mousedownoutside",function(){o(e)})}function s(){l&&l.remove()}function r(e){s(),e&&(l=$('<div class="settings"><div class="error"><p></p></div></div>').find("p").text(e).end(),t.before(l))}function a(i){var a,l,h,c,d,p,u,_,f={okButtonText:$.t("OK"),okButtonClass:"_tv-button ok",cancelButtonText:$.t("Cancel"),cancelButtonClass:"_tv-button cancel"};i=$.extend({},f,i),a=t.text(),l=Modernizr.touch?"":a,h="textarea"===i.replaceWith?$("<textarea "+(i.inputClass?'class="'+i.inputClass+'" ':"")+(i.maxLength?'maxlength="'+i.maxLength+'" ':"")+"></textarea>"):$('<input type="text" '+(i.inputClass?'class="'+i.inputClass+'" ':"")+(i.maxLength?'maxlength="'+i.maxLength+'" ':"")+'value="">'),h.val(l),c=$('<div class="buttons"></div>'),d=$('<div class="'+i.okButtonClass+'">'+i.okButtonText+"</div>").appendTo(c),p=$('<div class="'+i.cancelButtonClass+'">'+i.cancelButtonText+"</div>").appendTo(c),n(a),u="function"==typeof i.onCancel?function(){i.onCancel(),o()}:function(){o(a)},_=function(t,i,n){/^\s+$/.test(i)&&(i=""),h.attr("disabled","disabled"),d.addClass("process"),e(t,i,n,function(){o()},s,r)},d.click(function(e){e.preventDefault(),e.stopPropagation(),_(t,h.val(),a)}),p.click(function(t){t.preventDefault(),t.stopPropagation(),u()}),h.keyup(function(e){e.preventDefault(),e.stopPropagation(),13!==e.keyCode||e.shiftKey?27===e.keyCode&&u():_(t,h.val(),a)}),t.empty().append(h,c),h.select()}var l;return!t instanceof $?void console.error("$container should be jQuery object"):e?"function"!=typeof e?void console.error("onOk should be function"):(t.addClass("tv-editable"),void o()):void console.error("onOk required")},TradingView.changeUserProfileField=function(t){function e(t){var e=Array.prototype.slice.call(arguments);e.shift(),"function"==typeof t&&t.apply(this,e)}var i,o;return t&&t.name&&void 0!==t.value?(i={},i[t.name]=t.value,o="status"!==t.name?"/accounts/change_data_json/":"/accounts/change_status/",void $.post(o,i,function(i){if(!i.errors||$.isEmptyObject(i.errors)){var o=i[t.name];user[t.name]=o,e(t.onSuccess,o)}else e(t.onError,i.errors[t.name])}).error(function(i){var o=__webpack_require__(64);403===i.status?e(t.onError,$.t("Please, try to reload page to edit user data")):e(t.onError,o.isProd()?$.t("Sorry, an error has occurred"):i.responseText)}).always(function(){e(t.onComplete)})):void console.warn("Required options.name and options.value")},TradingView.inputOnTyping=function(t,e,i){function o(){var t=$(this),o=t.val(),n=e(o);t.removeClass("_tv-dialog-text-input-error"),"function"==typeof i&&i(o),o!==n&&t.val(n)}function n(t){if(t.ctrlKey)return!1;if(t.metaKey)return!1;if(!t.charCode)return!1;var e=t.keyCode||t.which;return 9!==e&&(13!==e&&(16!==e&&(17!==e&&(18!==e&&(19!==e&&(20!==e&&(27!==e&&!(33<=e&&e<=40))))))))}return t instanceof $?("function"!=typeof e&&(e=function(t){return t}),void t.each(function(t,e){var i=$(e);i.on("keypress",function(t){if(n(t)){var e=function(){o.call(this),$(this).off("keyup",e)}.bind(this);$(this).on("keyup",e)}}),i.change(o)})):void console.warn("'$inputs' should be instance of jQuery")},TradingView.makeInputNumberOnly=function(t,e){var i,o;e=e||{},i=e.integerOnly,o=e.positiveOnly,TradingView.inputOnTyping(t,function(t){var n=t.replace(/\,/g,".").replace(/[^0-9\.-]/g,"").replace(/^-/,o?"":"__minus__").replace(/\./,"__point__").replace(/^__point__/,"0__point__").replace(/[\.-]/g,"").replace("__minus__","-").replace("__point__",".").replace(/^0+/,"0");return i&&/\d+/.test(n)&&(n=parseInt(n),TradingView.isInteger(e.minValue)&&(n=Math.max(e.minValue,n)),TradingView.isInteger(e.maxValue)&&(n=Math.min(e.maxValue,n))),!i&&/^0\d/.test(n)&&(n=""+n,n=n.substring(0,1)+"."+n.substring(1,n.length)),n},e.inputOnTypingCallback)},TradingView.makeInputDateOnly=function(t,e){function i(t){return 4!==t.length&&7!==t.length||(t+="-"),t=t.substr(0,10)}var e=e||{};TradingView.inputOnTyping(t,i,e.inputOnTypingCallback)},TradingView.makeInputTimeOnly=function(t,e){function i(t){return 2===t.length&&(t+=":"),t=t.substr(0,5)}var e=e||{};TradingView.inputOnTyping(t,i,e.inputOnTypingCallback)},TradingView.timezoneIsAvailable=function(t){var e,i=__webpack_require__(45).availableTimezones;for(e=0;e<i.length;e++)if(t===i[e].id)return!0;return!1},TradingView.parseSessionHours=function(t,e){function i(t,i,n){var s,r,a,l,h,c,d,p,u,_,f,g=[];if(n.openEveryDay)g=[0,1,2,3,4,5,6];else if(n.openOnDays)for(s=n.openOnDays,r=0;r<s.length;r++)g.push(parseInt(s[r])-1);else g=[1,2,3,4,5];for(a=function(t){return 60*parseInt(t[0],10)+parseInt(t[1],10)},l=a(t),h=a(i),c=l&&l>=h,c&&0!==g[0]&&g.unshift(0),d="",p=[],u=g[0]-1,_=g.length,r=0;r<_;r++)u+1<g[r]||r+1===_?(d+=o+moment.weekdaysMin(g[r]),p.push(d),d=""):d||(d=moment.weekdaysMin(g[r])),u=g[r];return f="{0}:{1}{2}{3}:{4}".format(t[0],t[1],o,i[0],i[1]),p.map(function(t){return t+e+f})}var o,n,s,r,a;return e=e||" ",o="-",t?"24x7"===t?i(["00","00"],["00","00"],{openEveryDay:!0}):(n=/([0-2]\d)([0-5]\d)-([0-2]\d)([0-5]\d)(?:\:(\d+))?/,(s=n.exec(t))?(r=[s[1],s[2]],a=[s[3],s[4]],i(r,a,{openOnDays:s[5]})):{}):{}},TradingView.parseTzOffset=function(t){var e=PineJsCalendar.get_timezone(t).offset_utc(Date.now()),i="",o=e/1e3/60/60;return o%1&&(i=":"+60*(o%1)),o=o>0?"+"+(o-o%1)+i:0===o?"":""+(o-o%1)+i,{offset:e,string:"UTC"+o}},TradingView.getTzByObsoleteName=function(t){return{UTC:"Etc/UTC",EST:"America/New_York",CST:"America/Chicago",PST:"America/Los_Angeles"}[t]||"exchange"},availableTimezones=__webpack_require__(45).availableTimezones;for(i=0;i<availableTimezones.length;i++)["Etc/UTC","exchange"].indexOf(availableTimezones[i].id)===-1&&(availableTimezones[i].title="("+TradingView.parseTzOffset(availableTimezones[i].id).string+") "+availableTimezones[i].title);TradingView.showChangeUserStatusDialog=function(){return runOrSignIn(function(){TVDialogs.showChangeUserStatusDialog()},{source:"Change status"}),!1},TradingView.getUrlParams=function(){for(var t=/\+/g,e=/([^&=]+)=?([^&]*)/g,i=function(e){return decodeURIComponent(e.replace(t," "))},o=window.location.search.substring(1),n={},s=e.exec(o);s;)n[i(s[1])]=i(s[2]),s=e.exec(o);return n},TradingView.createUrlParams=function(t){var e,i=[];for(e in t)t.hasOwnProperty(e)&&null!=t[e]&&i.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return i.join("&")},TradingView.setTrialAvailiable=function(t){TVLocalStorage.setItem("trial_availiable",t?1:0)},TradingView.translatedIntervalString=function(t){var e=(""+t).match(/(.*)([DWM])/);return e?e[1]+$.t(e[2],{context:"dates"}):t},TradingView.capitalizeFirstLetter=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},TradingView.generateColor=function(t,e,i){var o,n,s=__webpack_require__(65).RGBColor;if(!TradingView.isHexColor(t))return i?(e=e||0,TradingView.rgbaComp(TradingView.rgbDecomp(t),1-e/100)):t;if(e>=0&&e<=100)return o=new s(t),n=1-e/100,"rgba("+o.r+", "+o.g+", "+o.b+", "+n.toFixed(2)+")";throw Error("invalid transparency")},TradingView.decompNamedColor=function(t){switch(t){case"white":return[255,255,255];case"black":return[0,0,0];case"red":return[255,0,0];case"blue":return[0,255,0];case"green":return[0,0,255]}},TradingView.rgbComp=function(t,e,i){return 2 in arguments||(i=t[2],e=t[1],t=t[0]),"rgb("+[~~t,~~e,~~i].join(", ")+")"},TradingView.resetTransparency=function(t){return TradingView.isHexColor(t)?t:TradingView.rgbaComp(TradingView.rgbDecomp(t),1)},TradingView.rgbDecomp=function(t){return TradingView.decompNamedColor(t)||t.match(/[0-9]+/g).splice(0,3)},TradingView.isHexColor=function(t){return!!~t.indexOf("#")},TradingView.hexRgbDecomp=function(t){return 7===t.length?[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)]:4===t.length?[parseInt(t.slice(1,2)+t.slice(1,2),16),parseInt(t.slice(2,3)+t.slice(2,3),16),parseInt(t.slice(3,4)+t.slice(3,4),16)]:void 0},TradingView.rgbaComp=function(t,e,i,o){return 2 in arguments||(o=e,i=t[2],e=t[1],t=t[0]),null==o&&(o=1),"rgba("+[~~t,~~e,~~i,o].join(", ")+")"},TradingView.generateLowBrightnessColor=function(t){var e,i;return e=TradingView.isHexColor(t)?TradingView.hexRgbDecomp(t):TradingView.rgbDecomp(t),i=e.map(function(t){return t>50?t-50:0}),TradingView.rgbComp(i)},TradingView.defaultColorPickersBorder="#727272",TradingView.pow10Increment=function(t,e,i){var o,n=1;return t<0&&(n=-1,e=!e),i=Math.abs(i),isFinite(i)||(i=1),t=Math.abs(t),o=Math.pow(10,Math.floor(Math.log(t)/Math.LN10))||i||0,10*o<=t&&(o*=10),e&&t===o&&(o/=10),o<i&&(o=i),e?Math.ceil(t/o-1)*o*n:Math.floor(t/o+1)*o*n},TradingView.abbreviatedNumber=function(t){var e,i=0,o=+t;if(isFinite(o))for(;o>=1e3&&o%100===0;)i++,o/=1e3;return e=["","K","M","G","T","Y"][i],null==e&&(e="e"+3*i),o+e},TradingView.makeFont=function(t,e,i){return i&&(i+=" "),i+t+"px "+e},$.fn.appendUtm=function(t,e){return this.each(function(){var i=$(this);null!=t&&($("<input>").attr("type","hidden").attr("name","utm_source").val(t).appendTo(i),$("<input>").attr("type","hidden").attr("name","utm_medium").val(e).appendTo(i))}),this},$.fn.filterByData=function(t,e){return this.filter(function(){return $(this).data(t)===e})},$.fn.reverse=[].reverse,window.showExtensionPopup=function(){$(function(){function t(t){TVDialogs.modalDialog?TVDialogs.modalDialog.find("._tv-dialog").on("destroy",function(){setTimeout(t,0)}):t()}var e,i,o;window.is_authenticated&&TradingView.isFeatureEnabled("show_extension_popup")&&Featuresets.enabled("show_extension_popup")&&!TradingView.isOnFeaturePage&&(i=function(){var t=window.chrome,e=window.navigator.vendor;return null!==t&&void 0!==t&&"Google Inc."===e}(),i&&(e="chrome"),e&&(o="notShowExtensionPopup."+e,TVSettings.getBool(o,!1)||t(function(){var t=TVDialogs.showBrowserExtensionDialog(e);t.find("._tv-dialog").on("destroy",function(){TVSettings.setValue(o,!0)})})))})},$.fn.TVEmbeds=function(){return this},TradingView.removeBBCodes=function(t){return t.replace(RegExp(TradingView.quotesRe.openingTag,"gi"),$.t("@$1 wrote")+":\n").replace(RegExp(TradingView.quotesRe.closingTag,"gi"),"")},TradingView.quotesRe={openingTag:'\\[quote=(?:"|&quot;)([a-z0-9\\._\\-\\u00A0]+)(?:"|&quot;)\\]',closingTag:"\\[\\/quote\\]"},TradingView.quotesRe.quotedArea=TradingView.quotesRe.openingTag+"([^]*)"+TradingView.quotesRe.closingTag,TradingView.removeQuotes=function(t){return t.replace(RegExp(TradingView.quotesRe.quotedArea,"ig"),"").trim()},TradingView.parseQuotes=function(t){function e(t){var e,i=RegExp(TradingView.quotesRe.openingTag,"ig"),o=RegExp(TradingView.quotesRe.closingTag,"ig"),n=i.exec(t),s=o.exec(t);return!n||!s||s.index<n.index?null:(e='<div class="ch-item-quote">'+$.t("@__username__ wrote",{username:n[1]})+":<br/>"+TradingView.removeQuotes(t.substring(i.lastIndex,s.index))+"</div>",{start:n.index,end:o.lastIndex,converted:e})}function i(t){var o=e(t);return o?t.substring(0,o.start)+o.converted+i(t.substring(o.end).trim()):t}return i(t)},TradingView.getInnerTextContent=function(t){var e=function(t){return t.childElementCount?$.map(t.childNodes,e).join("")+("DIV"===t.tagName?"\n":""):"BR"===t.tagName?"\n":t.textContent};return e(t)},TradingView.trimWords=function(t,e){var i,o,n,s;if(t.length<e)return t.trim();for(t+=" ",i=/\s+/g,n="",s=0;null!=(o=i.exec(t));){if(o.index>=e){n=t.substring(0,s).trim()+"...";break}s=o.index}return n||t.substring(0,e)+"..."},TradingView.urlRegExp={imageUrl:"^[0-9a-zA-Z]{8}$",publishedImage:"/(?:i|x)/([0-9a-zA-Z]{8})/?",publishedChartOld:"/v/([0-9a-zA-Z]{8})/?",publishedChart:"/chart/([0-9a-zA-Z!_:+*()-]+?)/([0-9a-zA-Z]{8})(?:-([^/]+))?/?",publishedScript:"/script/([0-9a-zA-Z]{8})(?:-([^/]+))?/?",amazonawsLinks:"(?:https://|http://)(s3\\.amazonaws\\.com\\/tradingview?(\\w*?)\\/snapshots)\\/(?:\\S*?)\\.(png|bmp|jpg|jpeg)"},TradingView.createPublishedChartUrl=function(t,e,i){return t&&/[0-9a-zA-Z]{8}/.test(t)?t&&e?"/chart/"+e+"/"+t+(i?"-"+i:"")+"/":"/v/"+t+"/":""},TradingView.parsePublishedChartUrl=function(t){var e,i={},o=RegExp(TradingView.urlRegExp.publishedChartOld),n=RegExp(TradingView.urlRegExp.publishedChart),s=RegExp(TradingView.urlRegExp.publishedScript),r=RegExp(TradingView.urlRegExp.imageUrl);return o.test(t)?(e=t.match(o)||{},i={image_url:e[1]}):n.test(t)?(e=t.match(n)||{},i={symbol:e[1],image_url:e[2],title:e[3]}):s.test(t)?(e=t.match(s)||{},i={image_url:e[1],title:e[2]}):r.test(t)&&(i={image_url:t}),i},TradingView.createPublishedChartImageUrl=function(t){var e,i;return t&&/[0-9a-zA-Z]{8}/.test(t)?TradingView.Environment()in{battle:1,staging:1}?(e=t.charAt(0).toLowerCase(),i="battle"===TradingView.Environment()?"tradingview":"tradingview_staging","https://s3.amazonaws.com/"+i+"/"+e+"/"+t+".png"):"/i/"+t+"/":""},TradingView.createSnapshotImageUrls=function(t){var e,i,o;return t&&/[0-9a-zA-Z]{8}/.test(t)?TradingView.Environment()in{battle:1,staging:1}?(e=t.charAt(0).toLowerCase(),i="battle"===TradingView.Environment()?"tradingview":"tradingview_staging",o="https://s3.amazonaws.com/"+i+"/snapshots/"+e,{url:o+"/"+t+".png",preview:o+"/"+t+"_thumb.png"}):(o=window.location.protocol+"//"+window.location.host,{url:o+"/x/"+t+"/",preview:o+"/x/"+t+"/s/"}):""},TradingView.openNewChart=function(t){var e,i,o;t=t||{},is_authenticated?(e='<form method="POST" target="_blank" action="/chart/" style="display: none;"><input type="text" name="new" value="1">',Object.keys(t).forEach(function(i){e+='<input type="text" name="'+i+'" value="'+t[i]+'">'}),e+='<input type="submit"></form>',i=$(e),$("body").append(i),i.submit()):(o=$.param(t),window.open("/chart/"+(o?"?"+o:""),"_blank"))},TradingView.checkUserLanguage=function(){is_authenticated||$.post("/",{check_language:1},function(t){t&&!TVDialogs.modalDialog&&TVDialogs.showLanguagePopup(t)})},TradingView.unifiedSpinner=function(t,e){var i,o={lines:17,length:0,width:3,radius:20,corners:1,color:"#00A2E2",opacity:.3,rotate:0,direction:1,speed:1.5,trail:60,fps:20,className:"spinner",zIndex:2e9,top:"50%",left:"50%",shadow:!1,hwaccel:!1},n=TradingView.unifiedSpinner.presets[t];return n&&(o=$.extend(o,n)),i=$.extend({},o,e),new Spinner(i)},TradingView.unifiedSpinner.presets={mini:{radius:8,width:2,lines:14},micro:{radius:4,width:2,lines:12}},TradingView.parseJSONorNot=function(t){return"string"==typeof t?JSON.parse(t):t},$(window).load(function(){window.loaded=!0}),TradingView.overrideGitHubLink=function(t,e){return e.preventDefault(),window.location.href=t,!1},window.setCookie=function(t,e,i,o){var n,s;o=o?"; path="+o:"",i?(s=new Date,s.setTime(s.getTime()+24*i*60*60*1e3),n="; expires="+s.toGMTString()):n="",document.cookie=t+"="+e+n+o},window.getCookie=function(t){var e,i,o,n=t+"=",s=document.cookie.split(";");for(e=0,i=s.length;e<i;e++){for(o=s[e];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(n))return o.substring(n.length,o.length)}return null},TradingView.goRegistrateAfterThreeClicks=function(){var t=window.getCookie("unregistrateClicksOnIdeas");null===t&&(t=0),t++,t>=3?(TVDialogs.goRegistrate({from:"ideas"}),window.setCookie("unregistrateClicksOnIdeas",0)):window.setCookie("unregistrateClicksOnIdeas",t)},jQuery.event.special.middleclick={setup:function(t,e){$(this).bind("mousedown mouseup mouseout",jQuery.event.special.middleclick.handler)},teardown:function(t){$(this).unbind("mousedown mouseup mouseout",jQuery.event.special.middleclick.handler)},handler:function(t){var e=$(this);"mousedown"===t.type&&2===t.which?e.data("mouseTrigger",1):"mouseout"===t.type?e.data("mouseTrigger",0):"mouseup"===t.type&&(2===t.which&&e.data("mouseTrigger")&&(t.type="middleclick",jQuery.event.handle.apply(this,arguments)),e.data("mouseTrigger",0))}},TradingView.handleClickOnLogo=function(t,e){if(TradingView.isFeatureEnabled("advertisement-rotation")){var i=+new Date;$(this).data("lastClick")&&i-$(this).data("lastClick")<300||($(this).data("lastClick",i),$.post("/advertisement/click-on-logo/",{target:t,sponsor_name:e}))}},$(function(){TradingView.isFeatureEnabled("test_new_design")&&($.cookie("backend","prod"),"undefined"!=typeof _gaq&&_gaq.push(["_setCustomVar",4,"design","old",1]),$(".js-try-new-design-link").click(function(t){TradingView.trackEvent("design","try_new"),$.cookie("backend","test_backend"),location.reload()}))})}).call(exports,__webpack_require__(1),__webpack_require__(28),__webpack_require__(29),__webpack_require__(31),__webpack_require__(6),__webpack_require__(32),__webpack_require__(33),__webpack_require__(35))},function(t,e,i){(function(t){"use strict";function e(){this._listeners=[]}e.prototype.subscribe=function(t,e,i){var o={object:t,member:e,singleshot:!!i};this._listeners.push(o)},e.prototype.unsubscribe=function(t,e){var i,o;for(i=0;i<this._listeners.length;++i)if(o=this._listeners[i],o.object===t&&o.member.prototype===e.prototype){this._listeners.splice(i,1);break}},e.prototype.fire=function(){var t,e,i=this._listeners.slice();for(t=0;t<i.length;++t)e=i[t],e.member.apply(e.object||null,arguments);for(t=this._listeners.length-1;t>=0;t--)this._listeners[t].singleshot&&this._listeners.splice(t,1)},"undefined"!=typeof window&&(window.Delegate=e),void 0!==t&&t&&t.exports&&(t.exports=e)}).call(e,i(2)(t))},,,,,function(t,e,i){"use strict";function o(t){var e,i,o,n,s,r;if(this._name=t,e=d[t],e||("UTC"!==t&&"Etc/UTC"!==t&&TradingView.logError("unknown timezone: "+t),e={time:[],offset:[]},this._invalid=!0),e.time.length!==e.offset.length&&(TradingView.logError("timezone transition table doesn't match offset table"),e={time:[],offset:[]},this._invalid=!0),!e.time_utc){for(i=e.time,o=e.offset,n=i.length,s=Array(n),r=0;r<n;r++)i[r]*=1e3,o[r]*=1e3,s[r]=i[r]-o[r];e.time_utc=s}this.tz=e}function n(t,e){var i,o,n,r=t.length;if(0===r)return-1;if(isNaN(e))throw Error("Key is NaN");for(i=0,o=r-1,n=s((i+o)/2);;){if(t[n]>e){if(o=n-1,o<i)return n}else if(i=n+1,o<i)return n<r-1?n+1:-1;n=s((i+o)/2)}}var s,r,a,l,h,c,d=i(34);o.prototype.offset_utc=function(t){return o._offset(this.tz.time_utc,this.tz.offset,t)},o.prototype.offset_loc=function(t){return o._offset(this.tz.time,this.tz.offset,t)},o.prototype.is_valid=function(){return!this._invalid},o._offset=function(t,e,i){var o=n(t,i);return o===-1?0:e[o]},s=function(t){return 0|t},r=function(t){return 60*t*1e3},a=function(t){return 1e3*t},l=function(t,e){return s((s(t/1e3)-s(e/1e3))/60)},h=function(t,e){return s(s(t/1e3)-s(e/1e3))},c={SUNDAY:1,MONDAY:2,TUESDAY:3,WEDNESDAY:4,THURSDAY:5,FRIDAY:6,SATURDAY:7,JANUARY:0,DECEMBER:11,YEAR:1,MONTH:2,WEEK_OF_YEAR:3,DAY_OF_MONTH:5,DAY_OF_YEAR:6,DAY_OF_WEEK:7,HOUR_OF_DAY:11,MINUTE:12,SECOND:13,minutesPerDay:1440,secondsPerDay:r(1440),get_year:function(t){return t.getUTCFullYear()},get_month:function(t){return t.getUTCMonth()},get_hours:function(t){return t.getUTCHours()},get_minutes:function(t){return t.getUTCMinutes()},get_seconds:function(t){return t.getUTCSeconds()},get_day_of_month:function(t){return t.getUTCDate()},get_day_of_week:function(t){return t.getUTCDay()+1},get_day_of_year:function(t){var e=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0);return s((t.getTime()-e)/c.secondsPerDay)+1},get_week_of_year:function(t){var e=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),i=c.clone(t);return c.set_hms(i,0,0,0,0),i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7)),s(((i.getTime()-e)/c.secondsPerDay+1)/7)},get_minutes_from_midnight:function(t){return 60*c.get_hours(t)+c.get_minutes(t)},set_hms:function(t,e,i,o,n){t.setUTCHours(e),t.setUTCMinutes(i),t.setUTCSeconds(o),t.setUTCMilliseconds(n)},add_days_considering_dst:function(t,e,i){var o,n=t.offset_utc(e),s=this.clone(e);return this.add_date(s,i),o=t.offset_utc(s),s.setTime(s.getTime()+n-o),s},add_date:function(t,e){t.setTime(t.getTime()+e*c.secondsPerDay)},clone:function(t){return new Date(t.getTime())},get_days_per_year:function(t){var e=t.getUTCFullYear();return this.days_per_year(e)},days_per_year:function(t){return t%4!==0||t%100===0&&t%400!==0?365:366},get_part:function(t,e){switch(e){case c.YEAR:return c.get_year(t);case c.MONTH:return c.get_month(t);case c.DAY_OF_MONTH:return c.get_day_of_month(t);case c.WEEK_OF_YEAR:return c.get_week_of_year(t);case c.DAY_OF_WEEK:return c.get_day_of_week(t);case c.HOUR_OF_DAY:return c.get_hours(t);case c.MINUTE:return c.get_minutes(t);case c.DAY_OF_YEAR:return c.get_day_of_year(t);case c.SECOND:return c.get_seconds(t);default:return t.getTime()}},time_minutes:r,time_seconds:a,time_minutes_diff:l,time_seconds_diff:h,utc_to_cal:function(t,e){var i=t.offset_utc(e);return new Date(e+i)},get_cal:function(t,e,i,o){var n=new Date(Date.UTC(e,i,o)),s=t.offset_utc(+n);return new Date(n.valueOf()-s)},get_cal_utc:function(t,e,i){return new Date(Date.UTC(t,e,i))},cal_to_utc:function(t,e){var i=e.getTime(),o=t.offset_loc(i);return i-o},get_timezone:function(t){return new o(t)},shift_day:function(t,e){var i=t-1;return i+=e,i>6?i%=7:i<0&&(i=(7+i%7)%7),i+1}},t.exports=c},function(t,e){!function(){var e={"America/New_York":{time:[-2717668562,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1536530400,-1523224800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-76941e4,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-17762,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Los_Angeles":{time:[-2717668378,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-769420800,-765410400,-687996e3,-662680800,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-386805600,-368661600,-355356e3,-337212e3,-323906400,-305762400,-292456800,-273708e3,-261007200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-28378,-28800,-25200,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Chicago":{time:[-2717668236,-1633298400,-1615154400,-1601848800,-1583704800,-1563746400,-1551650400,-1538949600,-1520200800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1067810400,-1045432800,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-769413600,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-21036,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600]
},"America/Phoenix":{time:[-2717670498,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-820540740,-812678340,-796867140,-84405600,-68680800,1924966800],offset:[-26898,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200]},"America/Toronto":{time:[-2366755200,-1632088800,-1615154400,-1601771400,-1583712e3,-1567375200,-1554681600,-1534716e3,-1524088800,-1503266400,-149238e4,-1471816800,-1460930400,-1440972e3,-1428876e3,-1409522400,-1397426400,-1378072800,-1365976800,-1346623200,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1188770400,-1176069600,-1157320800,-1144015200,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-880232400,-76941e4,-765410400,-747266400,-733960800,-715824e3,-702518400,-684374400,-671068800,-652924800,-634176e3,-620863200,-602719200,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,136346400,152071200,167796e3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-19052,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Vancouver":{time:[-2713910400,-1632088800,-1615154400,-880236e3,-769420800,-765410400,-747266400,-732751200,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-386805600,-368661600,-355356e3,-337212e3,-323906400,-305762400,-292456800,-273708e3,-261007200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,136346400,152071200,167796e3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-29548,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Argentina/Buenos_Aires":{time:[-2372112e3,-1567468800,-1233446400,-1222992e3,-1205971200,-1194048e3,-117288e4,-1162512e3,-1141344e3,-1130976e3,-1109808e3,-109944e4,-1078272e3,-1067817600,-1046649600,-1036281600,-1015113600,-1004745600,-983577600,-973209600,-952041600,-941587200,-931046400,-900892800,-890352e3,-83376e4,-82728e4,-752284800,-733795200,-197337600,-190857600,-184204800,-164505600,-152668800,-132969600,-121132800,-101433600,-86832e3,-71107200,-54777600,-39052800,-23328e3,-7603200,128131200,136598400,596937600,605059200,624412800,636508800,656467200,667958400,687916800,699408e3,719366400,731462400,938912400,952041600,1198972800,1205625600,1224374400,1237075200,1924981200],offset:[-14028,-15408,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-10800,-10800,-7200,-10800,-7200,-10800]},"America/El_Salvador":{time:[-1546300800,546998400,559699200,578448e3,591148800,1924970400],offset:[-21408,-21600,-18e3,-21600,-18e3,-21600]},"America/Sao_Paulo":{time:[-1767225600,-1206968400,-1191369600,-1175385600,-1159833600,-633830400,-622076400,-602294400,-59184e4,-570758400,-560217600,-539136e3,-53136e4,-195436800,-184204800,-155174400,-150076800,-128908800,-121132800,-99964800,-89596800,-68428800,-57974400,499737600,511228800,530582400,540259200,562118400,571190400,592963200,602035200,624412800,634694400,656467200,666748800,687916800,697593600,719971200,728438400,750816e3,761702400,782265600,793152e3,813715200,823996800,84456e4,856051200,876096e3,888710400,908064e3,919555200,938908800,951609600,970963200,982454400,1003017600,1013904e3,1036281600,1045353600,1066521600,1076803200,1099353600,1108857600,1129420800,1140307200,1162684800,1172361600,119232e4,1203206400,1224374400,1234656e3,1255824e3,1266710400,1287273600,129816e4,1318723200,1330214400,1350777600,1361059200,1382227200,1392508800,1413676800,1424563200,1445126400,1456012800,1476576e3,1487462400,1508025600,1518912e3,154008e4,1550361600,1571529600,1581811200,1602979200,1613865600,1634428800,1645315200,1665878400,1677369600,1697328e3,1708214400,1729382400,1739664e3,1760832e3,1771718400,1792281600,1803168e3,1823731200,1834617600,1855180800,1866067200,1887235200,1897516800,1918684800,1928966400],offset:[-11188,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200]},"America/Bogota":{time:[-2707689600,-1739059200,704851200,733881600,1924974e3],offset:[-17776,-17776,-18e3,-14400,-18e3]},"Europe/Moscow":{time:[-2840140800,-1688256e3,-165681e4,-1641340800,-1627956e3,-1618700400,-1596416400,-1593813600,-1589846400,-1542416400,-1539478800,-1525305600,-1522713600,-1491177600,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670388400,686113200,695786400,701823600,717548400,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1414288800,1925002800],offset:[9017,9017,9079,12679,9079,16279,12679,16279,14400,10800,14400,18e3,14400,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800]},"Europe/Athens":{time:[-2344636800,-1686095940,-1182988800,-1178150400,-906854400,-904867200,-85725e4,-844473600,-828230400,-812419200,-552355200,-541641600,166492800,186195600,198036e3,213764400,228880800,244090800,260330400,275457600,291805200,307418400,323395200,338947200,354682800,370411200,386132400,401860800,417582e3,433310400,449031600,465364800,481086e3,496814400,512535600,528264e3,543985200,559713600,575434800,591163200,606884400,622612800,638334e3,654667200,670388400,686116800,701838e3,717566400,733287600,749016e3,764737200,780465600,796186800,811915200,828241200,846388800,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5692,5692,7200,10800,7200,10800,7200,3600,7200,3600,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Berlin":{time:[-2422051200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-776552400,-765925200,-761173200,-748476e3,-733266e3,-717627600,-714603600,-71037e4,-701902800,-684972e3,-670453200,-654127200,-639003600,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3208,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/London":{time:[-3852662400,-1691964e3,-1680469200,-1664143200,-1650142800,-1633903200,-1617483600,-1601848800,-1586034e3,-1570399200,-1552165200,-1538344800,-152253e4,-15075e5,-1490562e3,-1473631200,-1460926800,-1442786400,-1428872400,-1410732e3,-1396213200,-1379282400,-1364763600,-1348437600,-1333314e3,-1315778400,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-118998e4,-1175461200,-1159135200,-1143406800,-1126476e3,-1111957200,-1095631200,-1080507600,-1063576800,-1049058e3,-1032127200,-1017608400,-1001282400,-986158800,-969228e3,-950475600,-942012e3,-904514400,-896043600,-875484e3,-864594e3,-844034400,-832539600,-812584800,-798066e3,-781048800,-772059600,-764802e3,-748476e3,-733352400,-719445600,-717026400,-706741200,-699483600,-687996e3,-668034e3,-654732e3,-636584400,-622072800,-605739600,-590623200,-57429e4,-558568800,-542235600,-527119200,-512600400,-496274400,-481150800,-46422e4,-449701200,-432165600,-417646800,-401320800,-386197200,-369266400,-354747600,-337816800,-323298e3,-306972e3,-291848400,-276732e3,-257979600,-245282400,-22653e4,-213228e3,-195080400,-182383200,-163630800,-150933600,-132181200,-119484e3,-100731600,-88034400,-68677200,-59004e3,57726e3,69818400,89175600,101268e3,120625200,132717600,152074800,164167200,183524400,196221600,214974e3,227671200,246423600,259120800,278478e3,290570400,309927600,32202e4,341377200,354675600,372823200,386125200,404272800,417574800,435722400,449024400,467776800,481078800,499226400,512528400,530676e3,543978e3,562125600,575427600,593575200,606877200,625629600,638326800,657079200,670381200,688528800,701830800,719978400,733280400,751428e3,76473e4,782877600,796179600,814327200,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],offset:[-75,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Madrid":{time:[-2177452800,-1661734800,-1648425600,-1631926800,-1616889600,-1601254800,-1585353600,-1442451600,-1427673600,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301270400,-1284339600,-1269820800,-1029114e3,-1017619200,-1002848400,-986169600,-969238800,-954115200,-940208400,-873075600,-862531200,-842835600,-828230400,-811386e3,-796003200,-779936400,-765414e3,-748486800,-733881600,-652323600,-639183600,135126e3,150253200,167180400,181702800,196815600,212547600,22887e4,243997200,260406e3,276051600,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[-884,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Paris":{time:[-2486678340,-1855958340,-1689814800,-1680393600,-1665363600,-1648339200,-1635123600,-1616889600,-1604278800,-158544e4,-1574038800,-1552262400,-1539997200,-1520553600,-1507510800,-1490572800,-1470618e3,-1459123200,-1444006800,-1427673600,-1411952400,-1396224e3,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301270400,-1284339600,-1269820800,-1253494800,-1238371200,-1221440400,-1206921600,-1191200400,-1175472e3,-1160355600,-1143417600,-1127696400,-1111968e3,-1096851600,-1080518400,-1063587600,-1049068800,-1033347600,-1017619200,-1002502800,-986169600,-969238800,-950486400,-942012e3,-932432400,-85725e4,-844552800,-828219600,-812498400,-800064e3,-796258800,-781048800,-766616400,196822800,212547600,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[561,561,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Warsaw":{time:[-2840140800,-1717027200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1600466400,-1587157200,-1501718400,-931730400,-85725e4,-844552800,-828219600,-812498400,-796600800,-778723200,-762652800,-748483200,-733266e3,-715212e3,-701902800,-684972e3,-670453200,-654127200,-639003600,-397090800,-386805600,-371084400,-355356e3,-334191600,-323301600,-307580400,-291852e3,-271292400,-260402400,-239842800,-228952800,-208393200,-197503200,-176338800,-166053600,228877200,244000800,260326800,276055200,291776400,307504800,323830800,338954400,354675600,370404e3,386125200,401853600,417574800,433303200,449024400,465357600,481078800,496807200,512528400,528256800,543978e3,559706400,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[5040,5040,3600,7200,3600,7200,3600,7200,7200,10800,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Australia/Sydney":{time:[-2364076800,-1672531140,-1665352800,-883605600,-876088800,-860364e3,-844639200,-828309600,-813189600,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[36292,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600]},"Australia/Brisbane":{time:[-2366755200,-1672531140,-1665352800,-883605600,-876088800,-860364e3,-844639200,-828309600,-813189600,57722400,68007600,625629600,636519600,657079200,667969200,688528800,699418800,1925028e3],offset:[36728,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3]},"Australia/Adelaide":{time:[-2364076800,-2230156800,-1672531140,-1665352800,-883605600,-876088800,-860364e3,-844639200,-828309600,-813189600,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,384318e3,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,637729200,657079200,667969200,688528800,701233200,719978400,731473200,752032800,764132400,783482400,796186800,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,972784800,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[33260,32400,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800]},"Australia/ACT":{time:[-2364076800,-1672531140,-1665352800,-883605600,-876088800,-860364e3,-844639200,-828309600,-813189600,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],
offset:[36292,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600]},"Asia/Almaty":{time:[-1441152e3,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,701823600,717548400,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1925013600],offset:[18468,18e3,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600]},"Asia/Ashkhabad":{time:[-1441152e3,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670388400,686113200,688521600,695786400,192501e4],offset:[14012,14400,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,18e3,14400,14400,18e3]},"Asia/Tokyo":{time:[-2587678861,-2335219200,-1017792e3,-683762400,-672357600,-654732e3,-640908e3,-620258400,-609458400,-588808800,-578008800,1925024400],offset:[33539,32400,32400,32400,36e3,32400,36e3,32400,36e3,32400,36e3,32400]},"Asia/Taipei":{time:[-2335219200,-1017792e3,-766191600,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-639100800,-620784e3,-607564800,-589248e3,-576028800,-562896e3,-541728e3,-528681600,-510192e3,-497145600,-478656e3,-465609600,-449798400,-433987200,-418176e3,-402451200,-38664e4,-370915200,-355104e3,-339379200,-323568e3,-302486400,-291945600,-270950400,-260409600,134006400,149817600,165542400,181353600,299635200,307584e3,1925020800],offset:[29160,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Singapore":{time:[-2177452800,-2038176e3,-1167609600,-1073001600,-894153600,-879638400,-766972800,-138758400,378691200,1925020800],offset:[24925,24925,25200,26400,26400,27e3,32400,27e3,27e3,28800]},"Asia/Shanghai":{time:[-2177452800,-933465600,-923097600,-908755200,-891561600,515548800,52704e4,545184e3,558489600,576633600,589939200,608688e3,621993600,640137600,653443200,671587200,684892800,1925020800],offset:[29143,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Seoul":{time:[-1948752e3,-1830384e3,-1017792e3,-767318400,-498096e3,-462672e3,-451699200,-429753600,-418262400,-399513600,-387417600,-368064e3,-355968e3,-336614400,-324518400,-305164800,-293068800,-264902400,547610400,560919600,57906e4,592369200,1925024400],offset:[30472,30600,32400,32400,32400,30600,34200,30600,34200,30600,34200,30600,34200,30600,34200,30600,34200,30600,32400,36e3,32400,36e3,32400]},"Asia/Tehran":{time:[-1704153600,-757382400,247190400,259286400,277776e3,283996800,290822400,306547200,322444800,338515200,673228800,685497600,701222400,71712e4,732758400,748656e3,764294400,780192e3,795830400,811728e3,827366400,843264e3,858988800,874886400,890524800,906422400,922060800,937958400,953596800,969494400,985219200,1001116800,1016755200,1032652800,1048291200,1064188800,1079827200,1095724800,1111449600,1127347200,1206057600,1221955200,123768e4,1253577600,1269216e3,1285113600,1300752e3,1316649600,1332288e3,1348185600,1363910400,1379808e3,1395446400,1411344e3,1426982400,144288e4,1458518400,1474416e3,1490140800,1506038400,1521676800,1537574400,1553212800,1569110400,1584748800,1600646400,1616371200,1632268800,1647907200,1663804800,1679443200,1695340800,1710979200,1726876800,1742601600,1758499200,1774137600,1790035200,1805673600,1821571200,1837209600,1853107200,1868745600,1884643200,1900368e3,1916265600,1931904e3],offset:[12344,12344,12600,14400,18e3,14400,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600]},"Asia/Dubai":{time:[-1577923200,1925006400],offset:[13272,14400]},"Asia/Kolkata":{time:[-2840140800,-891561600,-872035200,-862617600,-764121600,1925011800],offset:[21208,21200,23400,19800,23400,19800]},"Asia/Hong_Kong":{time:[-2056665600,-907360200,-891635400,-884217600,-766713600,-747952200,-728512200,-717021e3,-694470600,-683757e3,-668032200,-654726600,-636582600,-623277e3,-605133e3,-591827400,-573683400,-559773e3,-542320200,-528323400,-510179400,-498083400,-478729800,-466633800,-446675400,-435184200,-415225800,-403129800,-383776200,-371680200,-352326600,-340230600,-320877e3,-308781e3,-288822600,-277331400,-257373e3,-245881800,-225923400,-213827400,-194473800,-182377800,-163024200,-148509e3,-132784200,-117059400,-101334600,-85609800,-69280200,-53555400,-37830600,-22105800,-6381e3,9343800,25068600,40793400,56518200,72243e3,88572600,104297400,120022200,126070200,151471800,167196600,182921400,198646200,214371e3,295414200,309324600,1925020800],offset:[27402,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Bangkok":{time:[-2840140800,-1570060800,1925017200],offset:[24124,24124,25200]},"Pacific/Auckland":{time:[-3192393600,-1330293600,-1320012e3,-1300658400,-1287352800,-1269208800,-1255903200,-1237759200,-1224453600,-1206309600,-1192399200,-117486e4,-1160949600,-1143410400,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,152676e3,162356400,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,384318e3,404877600,415767600,436327200,447217200,467776800,478666800,499226400,510116400,530676e3,541566e3,562125600,573620400,59418e4,60507e4,623815200,637729200,655264800,669178800,686714400,700628400,718164e3,732682800,749613600,764132400,781063200,795582e3,812512800,827031600,844567200,858481200,876016800,889930800,907466400,921985200,938916e3,953434800,970365600,984884400,100242e4,1016334e3,1033869600,1047783600,1065319200,1079838e3,1096768800,1111287600,1128218400,1142737200,1159668e3,1174186800,1191117600,1207450800,1222567200,1238900400,1254016800,127035e4,1285466400,1301799600,1316916e3,1333249200,1348970400,1365303600,138042e4,1396753200,1411869600,1428202800,1443319200,1459652400,1474768800,1491102e3,1506218400,1522551600,1538272800,1554606e3,1569722400,1586055600,1601172e3,1617505200,1632621600,1648954800,1664071200,1680404400,1695520800,1712458800,1727575200,1743908400,1759024800,1775358e3,1790474400,1806807600,1821924e3,1838257200,1853373600,1869706800,1885428e3,1901761200,1916877600,1933210800],offset:[41944,41400,45e3,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800]},"Pacific/Chatham":{time:[-3192393600,-757382400,152678700,162359100,183523500,195018300,215577900,226467900,247027500,257917500,278477100,289367100,309926700,320816700,341376300,352266300,372825900,384320700,404880300,415770300,436329900,447219900,467779500,478669500,499229100,510119100,530678700,541568700,562128300,573623100,594182700,605072700,623817900,637731900,655267500,669181500,686717100,700631100,718166700,732685500,749616300,764135100,781065900,795584700,812515500,827034300,844569900,858483900,876019500,889933500,907469100,921987900,938918700,953437500,970368300,984887100,1002422700,1016336700,1033872300,1047786300,1065321900,1079840700,1096771500,1111290300,1128221100,1142739900,1159670700,1174189500,1191120300,1207453500,1222569900,1238903100,1254019500,1270352700,1285469100,1301802300,1316918700,1333251900,1348973100,1365306300,1380422700,1396755900,1411872300,1428205500,1443321900,1459655100,1474771500,1491104700,1506221100,1522554300,1538275500,1554608700,1569725100,1586058300,1601174700,1617507900,1632624300,1648957500,1664073900,1680407100,1695523500,1712461500,1727577900,1743911100,1759027500,1775360700,1790477100,1806810300,1821926700,1838259900,1853376300,1869709500,1885430700,1901763900,1916880300,1933213500],offset:[44028,44100,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500]},"Pacific/Fakaofo":{time:[-2177452800,1325203200,1925038800],offset:[-41096,-39600,46800]},"Pacific/Honolulu":{time:[-2334139200,-1157320800,-1155470400,-880236e3,-765410400,-712188e3,1924956e3],offset:[-37886,-37800,-34200,-37800,-34200,-37800,-36e3]},"America/Mexico_City":{time:[-1514763396,-1343091600,-1234828800,-1220317200,-1207180800,-1191369600,-975283200,-963187200,-917136e3,-907372800,-821923200,-810086400,-627523200,-613008e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,989114400,1001815200,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1175392800,1193536800,1207447200,1224986400,1238896800,1256436e3,1270346400,1288490400,1301796e3,131994e4,1333245600,1351389600,13653e5,1382839200,1396749600,1414288800,1428199200,1445738400,1459648800,1477792800,1491098400,1509242400,1522548e3,1540692e3,1554602400,1572141600,1586052e3,1603591200,1617501600,1635645600,1648951200,1667095200,1680400800,1698544800,1712455200,1729994400,1743904800,1761444e3,1775354400,1792893600,1806804e3,1824948e3,1838253600,1856397600,1869703200,1887847200,1901757600,1919296800,1933207200],offset:[-23796,-25200,-21600,-25200,-21600,-25200,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600]},"Africa/Johannesburg":{time:[-2458166400,-2109283200,-860968800,-845244e3,-829519200,-813794400,1924999200],offset:[6720,5400,7200,10800,7200,10800,7200]},"Asia/Kathmandu":{time:[-1577923200,504921600,1925012700],offset:[20476,19800,20700]},"US/Mountain":{time:[-2717668796,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1538949600,-1534111200,-880236e3,-769417200,-765410400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-25196,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200]}};void 0!==t&&t.exports?t.exports=e:window.TzData=e}()},function(t,e,i){var o,n;!function(s,r){"object"==typeof t&&t.exports?t.exports=r():(o=r,n="function"==typeof o?o.call(e,i,e,t):o,!(void 0!==n&&(t.exports=n)))}(this,function(){"use strict";function t(t,e){var i,o=document.createElement(t||"div");for(i in e)o[i]=e[i];return o}function e(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}function i(t,e,i,o){var n=["opacity",e,~~(100*t),i,o].join("-"),s=.01+i/o*100,r=Math.max(1-(1-t)/e*(100-s),t),a=h.substring(0,h.indexOf("Animation")).toLowerCase(),l=a&&"-"+a+"-"||"";return u[n]||(c.insertRule("@"+l+"keyframes "+n+"{0%{opacity:"+r+"}"+s+"%{opacity:"+t+"}"+(s+.01)+"%{opacity:1}"+(s+e)%100+"%{opacity:"+t+"}100%{opacity:"+r+"}}",c.cssRules.length),u[n]=1),n}function o(t,e){var i,o,n=t.style;if(e=e.charAt(0).toUpperCase()+e.slice(1),void 0!==n[e])return e;for(o=0;o<p.length;o++)if(i=p[o]+e,void 0!==n[i])return i}function n(t,e){for(var i in e)t.style[o(t,i)||i]=e[i];return t}function s(t){var e,i,o;for(e=1;e<arguments.length;e++){i=arguments[e];for(o in i)void 0===t[o]&&(t[o]=i[o])}return t}function r(t,e){return"string"==typeof t?t:t[e%t.length]}function a(t){this.opts=s(t||{},a.defaults,_)}function l(){function i(e,i){return t("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',i)}c.addRule(".spin-vml","behavior:url(#default#VML)"),a.prototype.lines=function(t,o){function s(){return n(i("group",{coordsize:c+" "+c,coordorigin:-h+" "+-h}),{width:c,height:c})}function a(t,a,l){e(p,e(n(s(),{rotation:360/o.lines*t+"deg",left:~~a}),e(n(i("roundrect",{arcsize:o.corners}),{width:h,height:o.scale*o.width,left:o.scale*o.radius,top:-o.scale*o.width>>1,filter:l}),i("fill",{color:r(o.color,t),opacity:o.opacity}),i("stroke",{opacity:0}))))}var l,h=o.scale*(o.length+o.width),c=2*o.scale*h,d=-(o.width+o.length)*o.scale*2+"px",p=n(s(),{position:"absolute",top:d,left:d});if(o.shadow)for(l=1;l<=o.lines;l++)a(l,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(l=1;l<=o.lines;l++)a(l);return e(t,p)},a.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0,n&&e+o<n.childNodes.length&&(n=n.childNodes[e+o],n=n&&n.firstChild,n=n&&n.firstChild,n&&(n.opacity=i))}}var h,c,d,p=["webkit","Moz","ms","O"],u={},_={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",opacity:.25,rotate:0,direction:1,speed:1,trail:100,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:!1,hwaccel:!1,position:"absolute"};return a.defaults={},s(a.prototype,{spin:function(e){var i,o,s,r,a,l,c,d,p,u;return this.stop(),i=this,o=i.opts,s=i.el=t(null,{className:o.className}),n(s,{position:o.position,width:0,zIndex:o.zIndex,left:o.left,top:o.top}),e&&e.insertBefore(s,e.firstChild||null),s.setAttribute("role","progressbar"),i.lines(s,i.opts),h||(r=0,a=(o.lines-1)*(1-o.direction)/2,c=o.fps,d=c/o.speed,p=(1-o.opacity)/(d*o.trail/100),u=d/o.lines,function t(){r++;for(var e=0;e<o.lines;e++)l=Math.max(1-(r+(o.lines-e)*u)%d*p,o.opacity),i.opacity(s,e*o.direction+a,l,o);i.timeout=i.el&&setTimeout(t,~~(1e3/c))}()),i},stop:function(){var t=this.el;return t&&(clearTimeout(this.timeout),t.parentNode&&t.parentNode.removeChild(t),this.el=void 0),this},lines:function(o,s){function a(e,i){return n(t(),{position:"absolute",width:s.scale*(s.length+s.width)+"px",height:s.scale*s.width+"px",background:e,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/s.lines*c+s.rotate)+"deg) translate("+s.scale*s.radius+"px,0)",borderRadius:(s.corners*s.scale*s.width>>1)+"px"})}for(var l,c=0,d=(s.lines-1)*(1-s.direction)/2;c<s.lines;c++)l=n(t(),{position:"absolute",top:1+~(s.scale*s.width/2)+"px",transform:s.hwaccel?"translate3d(0,0,0)":"",opacity:s.opacity,animation:h&&i(s.opacity,s.trail,d+c*s.direction,s.lines)+" "+1/s.speed+"s linear infinite"}),s.shadow&&e(l,n(a("#000","0 0 4px #000"),{top:"2px"})),e(o,e(l,a(r(s.color,c),"0 0 1px rgba(0,0,0,.1)")));return o},opacity:function(t,e,i){e<t.childNodes.length&&(t.childNodes[e].style.opacity=i)}}),"undefined"!=typeof document&&(c=function(){var i=t("style",{type:"text/css"});return e(document.getElementsByTagName("head")[0],i),i.sheet||i.styleSheet}(),d=n(t("group"),{behavior:"url(#default#VML)"}),!o(d,"transform")&&d.adj?l():h=o(d,"animation")),a})},function(t,e,i){"use strict";t.exports=i(37)},function(t,e,i){"use strict";var o=i(38),n=function(){var t,e,i,n,s={};return s.initialize=function(o,s,r,a){t=o,e=s,i=r,n=a},s.updateUser=function(t){e=t},s.getCharts=function(o){var s=$.ajax({url:"{0}/{1}/charts?client={2}&user={3}".format(i,encodeURIComponent(n),encodeURIComponent(t),encodeURIComponent(e)),type:"GET",crossDomain:!0}).done(function(t){var e,i=TradingView.parseJSONorNot(t);"ok"!==i.status&&console.warn("Charts list request failed: "+i.message),e=i.data.map(function(t){return{id:t.id,name:t.name,image_url:t.id,modified_iso:t.timestamp,short_symbol:t.symbol,interval:t.resolution}}),o(e)});return s},s.removeChart=function(o,s){$.ajax({url:"{0}/{1}/charts?client={2}&user={3}&chart={4}".format(i,encodeURIComponent(n),encodeURIComponent(t),encodeURIComponent(e),encodeURIComponent(o)),type:"DELETE",crossDomain:!0}).done(function(t){var e=TradingView.parseJSONorNot(t);"ok"!==e.status&&console.warn("Chart delete request failed: "+e.message),s()})},s.saveChart=function(o,s,r,a,l,h,c){var d=l.id.value(),p="{0}/{1}/charts?client={2}&user={3}".format(i,encodeURIComponent(n),encodeURIComponent(t),encodeURIComponent(e));void 0!==d&&(p+="&chart="+encodeURIComponent(d)),$.ajax({url:p,data:{name:o,content:JSON.stringify(a),symbol:s,resolution:r},type:"POST",crossDomain:!0}).done(function(t){var e=TradingView.parseJSONorNot(t);return"ok"!==e.status?(console.warn("Chart save request failed: "+e.message),void c()):void h(e.id)}).fail(function(){c()})},s.loadChart=function(s){$.ajax({url:"{0}/{1}/charts?client={2}&user={3}&chart={4}".format(i,encodeURIComponent(n),encodeURIComponent(t),encodeURIComponent(e),encodeURIComponent(s.id)),type:"GET",crossDomain:!0}).done(function(t){var e,i=TradingView.parseJSONorNot(t);return"ok"!==i.status?void console.warn("Chart load request failed: "+i.message):(e=JSON.parse(i.data.content),e.uid=s.id,void o.emit("chart_load_requested",e))}).fail(function(){console.warn("Error loading chart")})},s.removeStudyTemplate=function(o,s){$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}&template={4}".format(i,encodeURIComponent(n),encodeURIComponent(t),encodeURIComponent(e),encodeURIComponent(o)),type:"DELETE",crossDomain:!0}).done(function(t){var e=TradingView.parseJSONorNot(t);"ok"!==e.status&&console.warn("Chart delete request failed: "+e.message),s()})},s.getStudyTemplateContent=function(o,s){$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}&template={4}".format(i,encodeURIComponent(n),encodeURIComponent(t),encodeURIComponent(e),encodeURIComponent(o)),type:"GET",crossDomain:!0}).done(function(t){s(TradingView.parseJSONorNot(t).data)})},s.saveStudyTemplate=function(o,s){$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}".format(i,encodeURIComponent(n),encodeURIComponent(t),encodeURIComponent(e)),type:"POST",crossDomain:!0,data:{name:o.name,content:o.content}}).done(function(t){var e=TradingView.parseJSONorNot(t);"ok"!==e.status&&console.warn("Template save request failed: "+e.message),s({error:"ok"===e.status?"":e.status})})},s._templatesCache=null,s.getStudyTemplatesList=function(o){return s._templatesCache?void o(s._templatesCache):(s._templatesCache=[],void $.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}".format(i,encodeURIComponent(n),encodeURIComponent(t),encodeURIComponent(e)),type:"GET",crossDomain:!0}).done(function(t){var e,i;if(null!==s._templatesCache){if(e=TradingView.parseJSONorNot(t),"ok"!==e.status)return void console.warn("Templates list request failed: "+e.message);i=e.data.map(function(t){return{is_default:!1,name:t.name}}),s._templatesCache=i,o(i)}}))},s.invalidateStudyTemplatesList=function(){s._templatesCache=null},s}();t.exports=n},function(t,e,i){(function(e){"use strict";var i=function(){var t={},i={},o=[],n={};return t.unsubscribe=function(t,e,o){i[t].unsubscribe(o,e)},t.on=function(e,i,o){return t.subscribe(e,i,o)},t.subscribe=function(t,o,s,r){return i.hasOwnProperty(t)||(i[t]=new e),n[t]?void o.call(s):void i[t].subscribe(s,o,r)},t.subscribeToAll=function(t){o.push(t)},t.emit=function(t){var n=Array.prototype.slice.call(arguments);o.forEach(function(t){t.apply(null,n)}),i.hasOwnProperty(t)&&(n=n.slice(1),e.prototype.fire.apply(i[t],n))},t.emitOnce=function(e){n[e]&&console.warn("Something went wrong: emitOnce called multiple times with same event"),n[e]=!0,t.emit.apply(t,arguments)},t}();t.exports=i}).call(e,i(28))},function(t,e,i){(function(e){"use strict";var o=i(40),n=i(42),s=function(){function t(i){var o,n,s;if(!(this instanceof t))throw new TypeError("SymbolSearch is a constructor");if(this._inputParserMixin=e.enabled("symbol_search_parser_mixin")&&t.canShowSpreadActions()?new SymbolSearchInputParserMixin(this):void 0,i=i||{},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._inputElement).data("symbol-search-instance",this),o=this._boundListener=this._eventListener.bind(this),n=this.boundTimeoutListener=function(t){setTimeout(function(){o(t)},0)},s=0;s<p.length;s++)p[s].immediate?$(this._inputElement).on(p[s].name,o):$(this._inputElement).on(p[s].name,n);this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnKeyPress=this._onKeyPress.bind(this),$(this._inputElement).on("keydown",this._boundOnKeyDown).on("keypress",this._boundOnKeyPress),this._eventListener(),i.autoFocus&&t.registerAutoFocus(this)}function s(t,e){var i=ChartApiInstance.supportedSymbolsTypes(),o=TVSettings.getValue("symboledit.filter");return!i.some(function(t){return t.value===o})&&i.length>0&&(o=i[0].value),0!==i.length&&(i.forEach(function(i){var n=i.value,s=$('<a class="type-filter">').attr("href","#"+n).text($.t(i.name));n===o&&s.addClass("active"),s.on("click",function(i){i.preventDefault(),e.find(".type-filter").removeClass("active"),$(this).addClass("active"),t.typeFilter(n),TVSettings.setValue("symboledit.filter",n)}),s.appendTo(e)}),t.typeFilter(o),!0)}function r(){var t=ChartApiInstance.supportedExchangesList(),e={BMFBOVESPA:"brasil"};return t.filter(function(t){return t.flag}).forEach(function(t){e[t.value]=t.flag,t.value!==t.name&&(e[t.name]=t.flag)}),e}function a(t,e){function i(t){var e=o[t];e&&(n=n.concat(e.sort(function(t,e){return t.name.localeCompare(e.name)})),delete o[t])}var o,n,s=RegExp("country-([a-z*]+)","i"),r=Object.keys(_).filter(function(t){return"forex"!==t&&"bitcoin"!==t}).sort(),a=["forex","country-usa","country-canada","country-uk","country-europe","country-austria","country-germany","country-ireland","country-italy","country-norway","country-spain","country-sweden","country-switzerland","country-turkey","country-brasil","country-*","country-japan","country-russia","bitcoin"];return e&&e.order&&(a=e.order),o={},$.each(_,function(t){o[t]=[]}),n=[],t.forEach(function(t){t.flag&&o[t.flag].push(t),t.value||n.push(t)}),a.forEach(function(t){var e,o;"forex"===t||"bitcoin"===t?i(t):(e=s.exec(t),o=e&&e[1],"*"===o?r.forEach(function(t){i(t)}):i(o))}),$.each(o,function(t){i(t)}),n}function l(t,i){var o,n,s,r=e.enabled("symbol_search_flags")?a(ChartApiInstance.supportedExchangesList()):ChartApiInstance.supportedExchangesList();if(e.enabled("symbol_search_limited_exchanges")&&(r=r.filter(function(t){return!("bitcoin"===t.flag||t.hideInSymbolSearch)})),o=TVSettings.getValue("symboledit.exchangefilter"),"bovespa"!==TradingView.widgetCustomer)return!r.some(function(t){return t.value===o})&&r.length>0&&(o=r[0].value),0!==r.length&&(n=$('<div id="exchange-filter" class="exchange-filter">').appendTo(i),s=$("<select>").appendTo(n),r.forEach(function(t){var e=t.value,i=t.name||e,n=t.desc||i,r=$("<option>").addClass("filter-item").attr("value",e).text($.t(i)).data("custom-option-text",$.t(n)).appendTo(s),a=_[t.flag];a&&r.data("custom-option-prepend",$(f[a]).attr({class:"flag sbIcon"})),t.value===o&&r.attr("selected",!0)}),s.change(function(){var e=$(this).val()||"";TVSettings.setValue("symboledit.exchangefilter",e),t.setExchangeFilter(e)}),s.selectbox({speed:0,useCustomPrependWithSelector:"after",customPrependSelectorClass:"exchange-with-flag",classHolder:"tv-unstyled-select-container tv-symbol-select",classOptions:e.enabled("symbol_search_three_columns_exchanges")?"sbOptions three-column-filter":"sbOptions"}),t.setExchangeFilter(o),!0)}function h(t){var e=l(t,t.$filterContainer);return t.selectExchangeFilter(),e}function c(t){var e,i,o,n,r,a,l,c,d,p,u=$('<div class="symbol-edit-popup">').appendTo(document.body),_=$('<div class="filter">').appendTo(u);return t.$filterContainer=_,s(t,_),h(t,_),e=$('<div class="table-wrapper">').appendTo(u),i=$(t._inputElement),o=i.offset(),n=0,r=Math.max(0,Math.min(o.left+n,$(window).width()-u.outerWidth())),u.css("left",r+"px"),u.css("top",o.top+i.outerHeight()+1),a=parseInt($(window).height(),10),l=_.outerHeight(),c=$(window).scrollTop(),d=i.height(),p=a-(o.top-c)-d/2,e.css("maxHeight",p-d-l+"px"),{popup:u,listWrapper:e}}function d(t){return!t.ctrlKey&&(!t.metaKey&&(!!t.charCode&&(!(!t.which||t.which<=32)&&(!/^(input|textarea)$/i.test(t.target.tagName)&&!TVDialogs.modalDialog))))}var p=[{name:"input",immediate:!0},{name:"sync",immediate:!0},{name:"keypress"},{name:"keydown"},{name:"keyup"},{name:"mousedown"},{name:"mouseup"},{name:"cut"},{name:"paste"}],u=[/^e\-m/i],_={canada:"flag-ca",bitcoin:"flag-btc",uk:"flag-uk",usa:"flag-us",europe:"flag-eu",russia:"flag-ru",japan:"flag-jp",india:"flag-in",forex:"flag-fx",brasil:"flag-br",germany:"flag-de",switzerland:"flag-ch",turkey:"flag-tr",italy:"flag-it",spain:"flag-es",ireland:"flag-ie",sweden:"flag-se",norway:"flag-no",austria:"flag-at"},f={},g=null;return 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");TradingView.keyboardBinder.registerListener("symbolEdit",function(t){if(d(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.serachRequestDelay=0,t.setSearchRequestDelay=function(e){t.prototype.serachRequestDelay=e},t.prototype.resetState=function(){this._state={}},t.prototype.typeFilter=function(t){return arguments.length>0?void(t!==this._state.typeFilter&&(null==t?delete this._state.typeFilter:this._state.typeFilter=t+"",delete this._state.keepListFor,this._onSelectionChanged(),this.selectExchangeFilter())):this._state.typeFilter},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.getExchangeFilter=function(){return this._state.exchangeFilter},t.prototype._moveSelection=function(t,e){var i,o,n,s,r,a,l;this._state.suggestOptions&&0!==this._state.suggestOptions.length&&(i=this.$list.find("tbody tr:not(.group-close):not(.hidden)"),o=this.$list.find("tr.symbol-edit-popup-active"),
n=-1,o.size()?(n=i.index(o),s=Math.max(0,Math.min(n+t,i.size()-1))):s=0,n!==s&&(r=i.eq(s),a=r.data("item"),o.length&&o.removeClass("symbol-edit-popup-active"),a.groupTitle?(r.addClass("symbol-edit-popup-active"),this._selectedGroupItem=a,delete this._state.highlightIndex,this._scrollHighlightIntoView()):(this._selectedGroupItem&&(this._selectedGroupItem=null),l=this._state.suggestOptions.indexOf(a),this._highlightOption(~l&&l||0,!0,e))))},t.prototype._groupSetCollapsed=function(t,e){t.groupTitle&&this._groupListHandler&&this._groupListHandler.setCollapsed(t.root,e)},t.prototype._onKeyDown=function(t){40!==t.keyCode&&38!==t.keyCode||(this._moveSelection(40===t.keyCode?1:-1,!0),t.preventDefault()),!this._selectedGroupItem||37!==t.keyCode&&39!==t.keyCode||(this._groupSetCollapsed(this._selectedGroupItem,37===t.keyCode),t.preventDefault())},t.prototype._onKeyPress=function(t){if(40===t.keyCode||38===t.keyCode){if(t.charCode)return;if(this._boundOnKeyDown)return $(this._inputElement).off("keydown",this._boundOnKeyDown),delete this._boundOnKeyDown,void t.preventDefault();this._moveSelection(40===t.keyCode?1:-1),t.preventDefault()}13===t.keyCode&&(this._selectedGroupItem?(this._groupSetCollapsed(this._selectedGroupItem,!1),t.preventDefault()):this.acceptTypeIn())},t.prototype._eventListener=function(t,e){var i,o,n,s=this._inputElement,r=this._getInputValue().toUpperCase(),a=!1,l=!1;this._state.value!==r&&(ChartApiInstance._symbolSearchRequest&&ChartApiInstance._symbolSearchRequest.abort(),this._state.hasOwnProperty("value")&&this._onValueChanged&&this._onValueChanged(r),this._state.value=r,a=!0,this._inputParserMixin&&this._inputParserMixin.parse()),this._fixIntervalCase(),i=this._limitInputSelectionValue("selectionStart"),this._state.selectionStart!==i&&(this._state.selectionStart=i,l=!0),o=this._limitInputSelectionValue("selectionEnd"),this._state.selectionEnd!==o&&(this._state.selectionEnd=o,l=!0),this._state.selectionDirection!==s.selectionDirection&&(this._state.selectionDirection=s.selectionDirection,l=!0),(a||l&&this._inputParserMixin)&&(this._onSelectionChanged(void 0,e),n=!1,this._getInputValue()!==this._state.value&&(this._setInputValue(this._state.value),n=!0),(n||this._state.selectionStart!==this._limitInputSelectionValue("selectionStart")||this._state.selectionEnd!==this._limitInputSelectionValue("selectionEnd"))&&s.setSelectionRange&&s.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,o){n._state.contextTicker=t,n._state.contextExchange=e,n._state.contextType=i,n._state.keepListFor&&n._state.keepListFor===o||(n._getSuggestList(),delete n._state.keepListFor)}var o,n=this,s=u.some(function(t){return t.test(n._state.value)});!s&&this._inputParserMixin&&e!==!0?this._inputParserMixin.onSelectionChanged(i):this.$list&&(o=this._state.value,i(o,this.getExchangeFilter(),this._state.typeFilter,this._state._selectedTicker||o))},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 e,i,o,n;this._clearSearchTimeout(),e=this._state.contextTicker||"",i=this._state.contextExchange||this.getExchangeFilter()||"",o=this._state.typeFilter||"",this._showLoading(),n=this,ChartApiInstance.searchSymbols(e,i,o,"undefined"!=typeof chartWidget?chartWidget:void 0,function(s){var r=e!==(n._state.contextTicker||"")||i!==(n._state.contextExchange||n.getExchangeFilter()||"")||o!==(n._state.typeFilter||"");r||(o===t.QUANDL&&(s=n._processQuandlResponse(s)),n._renderSuggestList(s),n._onResponse(s))})},t.prototype._getSuggestList=function(){this._clearSearchTimeout(),this._searchTimeout=setTimeout(this._doGetSuggestList.bind(this),t.prototype.serachRequestDelay)},t.prototype._showLoading=function(){if(this.$list){this._clearSuggestList();var t=$('<div class="symbol-search-loading">').appendTo(this.$list);this._spinner=TradingView.unifiedSpinner("mini").spin(t.get(0))}},t.prototype._renderSuggestList=function(i){var o,n,s,r,a,l,h,c,d,p,u,_;if(this.$list){if(o=this,n=this._state,this._clearSuggestList(),s=n.suggestOptions=[],r=TradingView.RegExpEscape(n.contextTicker).trim(),a=RegExp(r.replace(" ","|"),"i"+(r.length>1?"g":"")),delete n.highlightIndex,this._hidePro&&(i=i.filter(function(t){return!t.params||t.params.indexOf("pro")===-1})),0===i.length)return void this.$list.html('<div style="text-align: center; padding: 7px 0; font-style: italic;">'+$.t("No symbols matched your criteria")+"</div>");for(l=$('<table class="symbol-edit-popup">'),h=new t.GroupListHandler(l,a),i.forEach(function(t){var e,i,n;switch(t.ticker||(t.ticker=t.full_name),e=$('<tr class="symbol-edit-popup">'),i=$('<td class="symbol-edit-popup-td name apply-overflow-tooltip">'),i.html(t.symbol.replace(a,"<strong>$&</strong>")),i.appendTo(e),$('<td class="symbol-edit-popup-td desc apply-overflow-tooltip">').html(a.test(t.symbol)?t.description:t.description.replace(a,"<strong>$&</strong>")).appendTo(e),n=$('<td class="symbol-edit-popup-td type apply-overflow-tooltip">').appendTo(e),void 0!==t.params&&~t.params.indexOf("eod")&&($("<i>").text("eod").addClass("eod").prependTo(n),n.append("&nbsp;")),t.type){case"index":n.append($.t(t.type));break;default:n.append($.t(t.type)+" - "+t.exchange)}n.appendTo(e),$('<td class="symbol-edit-popup-td flag apply-overflow-tooltip">').append(o._getItemFlag(t)).appendTo(e),"futures"===t.type?h.append(t,e):e.appendTo(l),t._$tr=e,e.data("item",t)}),e.enabled("expand_symbolsearch_items")||h.collapse(),this._groupListHandler=h,c=0,d=l.find("tr:not(.group-close)");c<d.size();c++)p=d.eq(c),u=p.data("item"),s.push(u),u.ticker===n.contextTicker&&u.exchange===n.contextExchange&&void 0===_&&(_=c);"number"==typeof _&&this._highlightOption(_),l.on("click","tr",function(t){if(!t.isDefaultPrevented()&&(t.preventDefault(),o._state.suggestOptions)){var e=$(this).data("item");e&&e.full_name&&o.accept(e.full_name,e.ticker)}}),l.appendTo(this.$list)}},t.prototype._highlightOption=function(t,e,i){var o,n=this._state;n.highlightIndex!==t&&(void 0!==n.highlightIndex&&n.suggestOptions[this._state.highlightIndex]._$tr&&n.suggestOptions[this._state.highlightIndex]._$tr.removeClass("symbol-edit-popup-active"),n.highlightIndex=t,o=n.suggestOptions[t]._$tr,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().top<this.$list.offset().top?this.$list.scrollTop(this.$list.scrollTop()-(this.$list.offset().top-t.offset().top)):t.offset().top+t.outerHeight()>this.$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(){delete this._state.suggestOptions,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._getItemFlag=function(t){var e="";return"forex"===t.type||"FXCM"===t.exchange?e="forex":(g=g||r(),e=g[t.full_name.split(":")[0]]),$(f[_[e]]).attr({class:"flag"})},t.prototype._replaceCurrentSymbol=function(t){var e,i,o,n,s=this._state;if(s.suggestOptions&&void 0!==s.highlightIndex){if(e=s.suggestOptions[s.highlightIndex],i="",o=0,this._inputParserMixin&&t!==!0){if(n=this._inputParserMixin.replaceCurrentSymbol(e),!n.ok)return;i=n.newValue,o=n.newCaretPos,s.keepListFor=n.keepListFor}else i=t===!0&&e.full_name&&this._inputParserMixin?e.full_name:e.symbol,o=i.length,this._state._selectedTicker=s.keepListFor=e.ticker||e.symbol;this._setInputValue(i),this._inputElement.setSelectionRange?this._inputElement.setSelectionRange(o,o):this._inputElement.select(),this._eventListener(void 0,t)}},t.prototype.splitAndAcceptUserInput=function(){var t,e=this._getInputValue().split(",");for(t=0;t<e.length;t++)this.acceptSymbolIn(e[t])},t.prototype.acceptSymbolIn=function(t){var e,i;this._inputParserMixin?e=this._inputParserMixin.parseSymbol(t):(e=t,i=this._state._selectedTicker||t),this.accept(e,i)},t.prototype.acceptTypeIn=function(){this._allowMultipleSymbols?this.splitAndAcceptUserInput():this.acceptSymbolIn(this._getInputValue())},t.prototype.accept=function(e,i){if(i=i||e){delete this._state.keepListFor;var o=this._ignoreInterval?void 0:t.getInterval(!0);this._inputElement.value=e,this._eventListener(),this._callback&&this._callback(i,o),$(this._inputElement).trigger("accept-symbol",[i])}},t.prototype.bindListWrapper=function(t){if(t=$(t).eq(0),0===t.size())throw new TypeError("element must be a DOM element, jQuery object or selector");this.$list=t,this._clearSelectionState(),this._eventListener()},t.prototype.removeListWrapper=function(){delete this.$list,this._clearSuggestList(),this._clearSelectionState(),this._eventListener()},t.prototype.selectExchangeFilter=function(){this.$filterContainer.find(".exchange-filter").hide(),this._state.typeFilter===t.QUANDL?this.$filterContainer.find("#quandl-filter").show():this._state.typeFilter!==t.ECONOMIC&&this.$filterContainer.find("#exchange-filter").show()},t.prototype._onResponse=function(e){if(e.length>0){var i=this._state.typeFilter;i===t.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.")+' <a target="_blank" href="'+("ru"===window.language?"http://blog.tradingview.com/?p=1530&lang=ru":"http://blog.tradingview.com/?p=1530")+'">'+$.t("Read our blog for more info!")+"</a>",e=$('<div class="symbol-edit-notification">').prependTo(this.$list),e.html(t),e.find("a").click(function(t){t.preventDefault();var e=$(this).attr("href");window.open(e,"_blank")}),i=$('<a class="close">').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.showDialog=function(e){var o,n,r,a,l,c,d,p,u,_,f,g,m=i(46);if(e=e||{},o="Symbol Search",!TVDialogs.get(o))return n=TVDialogs.createDialog(o,{hideTitle:!0,hideCloseCross:!0,dragHandle:".filter",width:"750px",dragOptions:{cancel:".sbOptions"},content:m.dialogs.symbolSearch}),TVDialogs.positionDialog(n),r=n.find("._tv-dialog-content").addClass("symbol-search-dialog"),a=r.find(".results"),a.mousewheel(function(t,e){var i=$(this);e>0?i.scrollTop(i.scrollTop()-15):i.scrollTop(i.scrollTop()+15)}),l=r.find("input").get(0),e.initialValue&&(l.value=e.initialValue),"selectionStart"in l&&(l.selectionStart=l.selectionEnd=l.value.length),l.focus(),this.canShowSpreadActions()&&(e.ignoreInterval||(d=t.getInputValueGetter(l),p=t.getInputValueSetter(l)),c=SymbolSearchInputParserMixin.addSpreadActions(r.find(".spread-actions"),l,d,p)),u=new t({input:l,list:r.find(".results").get(0),callback:function(t,i){e.callback&&e.callback(t,i),TVDialogs.destroy(o)},onParse:c,ignoreInterval:e.ignoreInterval}),_=r.find(".filter"),u.$filterContainer=_,f=s(u,_),g=h(u,_),f||g||_.attr("style","display: none"),TVDialogs.resizeContent(n.height(),a),TVDialogs.applyHandlers(n),TVDialogs.positionDialog(n),n.on("destroy",function(){TVSettings.setValue("symboledit.dialog_last_entry",l.value)}),n},t.bindToInput=function(i,o){function s(){_&&(y.removeListWrapper(),_.off(),_.remove(),_=null,TradingView.Tooltip.hide())}function r(t){t.preventDefault()}function a(){var t,i,o,n;if(_||(t=c(y),_=t.popup,y.bindListWrapper(t.listWrapper),_.on("focus","*",r),_.on("click","*",r),_.on("mousedown","*",r)),e.enabled("charting_library_base")&&(i=this._state,i.keepListFor)){if(!i.suggestOptions||void 0===i.highlightIndex)return void delete this._state.keepListFor;o=i.suggestOptions[i.highlightIndex],n=this._getInputValue().toUpperCase(),o.symbol!==n&&delete this._state.keepListFor}}function l(e,i){var o;return i?(RegExp("^"+t.QUANDL,"i").test(e)?(o=e.split(/\//),o.length&&(e=o[o.length-1])):e=n.seriesShortSymbol.value()||e,e):e}function h(t){var e=n.symbol.value()||"";e=l(e,t),i.val(e),y.resetState()}var d,p,u,_,f,g,m,v,y,b,w;return o=o||{},i=$(i).eq(0),d=o.callback,p=null,u=null,_=null,g=o.spreadActions&&$(o.spreadActions).eq(0),g&&g.size()&&this.canShowSpreadActions()&&(o.ignoreInterval||(m=t.getInputValueGetter(i.get(0)),v=t.getInputValueSetter(i.get(0))),f=SymbolSearchInputParserMixin.addSpreadActions(g,i.get(0),m,v)),y=new t({input:i,onValueChanged:a,callback:function(t,e){s(),"function"==typeof u&&u(t,e)||("function"==typeof d&&d(t,e),"function"==typeof p&&p(t,e)),o.clearAfterAccept&&i.val(""),o.keepFocus?i.get(0).focus():i.get(0).blur(),y.resetState()},hidePro:o.hidePro,autoFocus:o.autoFocus,onEmptyApply:o.onEmptyApply,onParse:f,allowMultipleSymbols:o.allowMultipleSymbols,ignoreInterval:o.ignoreInterval}),b=!1,i.on("focus",function(t,e){b=!0,y._skipAutoFocus?delete y._skipAutoFocus:setTimeout(function(){b&&i.get(0).select()},0)}),i.on("blur",function(t){var e,o,n,r;return _&&(e=document.activeElement,o=_.is(e),n=_.has(e).length>0,r=navigator.userAgent.indexOf("Trident")!==-1||navigator.userAgent.indexOf("MSIE")!==-1,r&&(o||n))?(t.preventDefault(),t.stopImmediatePropagation(),void setTimeout(function(){i.focus()},0)):(b=!1,void setTimeout(function(){b||s()},0))}),o.syncWithChartWidget&&(h(!0),n.seriesShortSymbol.subscribe(function(){h(!0)}),p=function(t,e){t&&n.symbol.setValue(t),e&&n.interval.setValue(e)},u=function(t,e){return!e&&(t===n.symbol.value()||(t===n.seriesShortSymbol.value()||void 0))},w=function(){i.get(0).blur(),h(!1)},i.on("keypress",function(t){27===t.keyCode&&w()}),i.on("keydown",function(t){27===t.keyCode&&w()})),y},t.GroupListHandler=function(t,e){this._$container=t,this._tickerRegExp=e,this._roots={}},t.GroupListHandler.prototype.addRoot=function(t,e,i,o){var n,s=this,r=o.clone().addClass("group-title").click(function(e){e.preventDefault(),s[r.hasClass("collapsed")?"expand":"collapse"](t)});r.find("td.name").html("<div>"+e.replace(this._tickerRegExp,"<strong>$&</strong>")+"</div>"),r.find("td.type").html(i.type+(i.exchange&&" - "+i.exchange||"")),r.appendTo(this._$container),r.data("item",{groupTitle:!0,root:t}),n=$('<tr class="group-close"><td colspan="3"></td></tr>').appendTo(this._$container),this._roots[t]={titleRow:r,closeRow:n}},t.GroupListHandler.prototype.append=function(t,e){var i,o,n=ChartApiInstance.futuresRegex(),s=n.exec(t.symbol+"");return s?(i=s[1],o=(t.exchange||"unknown")+"_"+i,this._roots[o]||this.addRoot(o,i,t,e),void e.addClass("root-"+o).insertBefore(this._roots[o].closeRow)):void e.appendTo(this._$container)},t.GroupListHandler.prototype.setCollapsed=function(t,e){var i;if(t)this._roots[t]&&(i=e===!0?"addClass":"removeClass",this._roots[t].titleRow[i]("collapsed"),this._$container.find("tr.root-"+t)[i]("hidden"));else for(t in this._roots)this.setCollapsed(t,e)},t.GroupListHandler.prototype.collapse=function(t){this.setCollapsed(t,!0)},t.GroupListHandler.prototype.expand=function(t){this.setCollapsed(t,!1)},t.isIntervalInit=function(t){return/[\d,]/.test(t)&&e.enabled("show_interval_dialog_on_key_press")},t.isIntervalChar=function(t){return e.enabled("seconds_resolution")?/[\dhdwms]/i.test(t):/[\dhdwm]/i.test(t)},t.parseIntervalValue=function(t){var e=/^[,\s]*(\d*)\s*([hdwms]?)\s*$/i.exec(t)||[],i=~~e[1],o=e[2]&&e[2].toUpperCase(),n={qty:!i&&o?1:i,unit:o||null};return n.error=!i&&!o,n.intraday=!(n.error||n.unit&&"H"!==n.unit),n},t.sanitizeIntervalValue=function(e){var i=t.parseIntervalValue(e),o=i.qty,n=i.unit;return i.error?null:("H"===n&&(o*=60,n=null),o&&!n?o+"":n&&(!o||1===o&&"S"!==n)?n:o+n)},t.detachInterval=function(t){var e=/,[^,]*$/i.exec(t)||[];if(e[0])return{rest:t.substr(0,t.length-e[0].length),detached:e[0]}},t.intervalIsSupported=function(i){var s,r,a;return e.enabled("allow_supported_resolutions_set_only")?(s=this.sanitizeIntervalValue(i),null!==s&&o.isAvailable(s)):(r=t.parseIntervalValue(i),!r.error&&(r.intraday?n.intraday.value():(a=n.supportedResolutions.value(),!a||!!~a.indexOf(r.unit))))},function(){var e="",i=null;t.resetStoredInterval=function(){e="",i=null},t.detachStoreInterval=function(o){var n=t.detachInterval(o);return n?(e=n.detached,i=t.sanitizeIntervalValue(e),n.rest):(t.resetStoredInterval(),o)},t.recallAttachInterval=function(t){return t+e},t.getInterval=function(e){var o=i;return e===!0&&t.resetStoredInterval(),o},t.getInputValueGetter=function(e){return function(){return t.detachStoreInterval(e.value)}},t.getInputValueSetter=function(e){return function(i){e.value=t.recallAttachInterval(i)}},t.intervalError=function(){return!(!e||/^,\s*$/.test(e))&&!i}}(),t.registerDialogKeypressHandler=function(e){if(!e)throw new TypeError("chartWidget is required");TradingView.keyboardBinder.pushBackListener("symbolEdit",function(e){var o,s=i(54);d(e)&&(e.preventDefault(),o=String.fromCharCode(e.charCode),t.isIntervalInit(o)?new s({callback:function(t){n.interval.setValue(t)}}).show(o):t.showDialog({initialValue:o,callback:function(t,e){n.symbol.setValue(t),e&&n.interval.setValue(e)}}))})},t.canShowSpreadActions=function(){return"undefined"!=typeof SymbolSearchInputParserMixin&&"cme"!==TradingView.widgetCustomer&&"bovespa"!==TradingView.widgetCustomer},t.QUANDL="quandl",t.ECONOMIC="economic",t.QUANDL_API_KEY="qehT7XPzZvLj-wmBB7Gk",t}();t.exports=s}).call(e,i(1))},function(t,e,i){"use strict";function o(){}var n=i(41),s=i(42);o.isAvailable=function(t){var e,i=s.supportedResolutions.value(),o=!1;return o=void 0===i||i.indexOf(t)!==-1,e=s.intraday.value(),e?o:n.isDWM(t)&&o},t.exports=o},function(t,e){(function(e){"use strict";function i(t,e){return void 0===e&&t!==i.INVALID?i.parse(t):(this._kind=t,void(this._multiplier=e))}"undefined"==typeof window&&(e.TradingView={}),i.SECONDS="seconds",i.MINUTES="minutes",i.HOURS="hours",i.DAYS="days",i.WEEKS="weeks",i.MONTHS="months",i.INVALID="invalid",i.KIND_TO_MS={},i.KIND_TO_MS[i.SECONDS]=1e3,i.KIND_TO_MS[i.MINUTES]=60*i.KIND_TO_MS[i.SECONDS],i.KIND_TO_MS[i.HOURS]=60*i.KIND_TO_MS[i.MINUTES],i.KIND_TO_MS[i.DAYS]=24*i.KIND_TO_MS[i.HOURS],i.KIND_TO_MS[i.WEEKS]=7*i.KIND_TO_MS[i.DAYS],i.IntadayRegExp=RegExp("^([0-9]*)$"),i.DWMSRegExp=RegExp("^(\\d*)([DWMS])$"),i.prototype.kind=function(){return this._kind},i.prototype.multiplier=function(){return this._multiplier},i.prototype.isValid=function(){return this.kind()!==i.INVALID},i.prototype.isDWM=function(){return this.isValid()&&!this.isIntraday()},i.prototype.isIntraday=function(){return[i.SECONDS,i.MINUTES,i.HOURS].indexOf(this.kind())!==-1},i.prototype.letter=function(){return this.isValid()&&this.kind()!==i.MINUTES?this.kind()[0].toUpperCase():""},i.prototype.value=function(){return this.isValid()?this.kind()===i.MINUTES?this.multiplier()+"":this.multiplier()+this.letter():""},i.prototype.isEqualTo=function(t){if(!(t instanceof i))throw Error("Argument is not an Interval");return this.kind()!==i.INVALID&&t.kind()!==i.INVALID&&(this.kind()===t.kind()&&this.multiplier()===t.multiplier())},i.prototype.inMilliseconds=function(){if(this.isValid()&&this.kind()!==i.MONTHS)return i.KIND_TO_MS[this.kind()]*this.multiplier()},i.isEqual=function(t,e){return i.parse(t).isEqualTo(i.parse(e))},i.parse=function(t){var e,o;return t=(t+"").toUpperCase(),e={D:i.DAYS,W:i.WEEKS,M:i.MONTHS,H:i.HOURS,S:i.SECONDS},(o=i.IntadayRegExp.exec(t))?new i(i.MINUTES,parseInt(t,10)):(o=i.DWMSRegExp.exec(t),o?new i(e[o[2]],parseInt(o[1],10)?parseInt(o[1],10):1):new i(i.INVALID))},i.isDWM=function(t){return i.parse(t).isDWM()},i.kind=function(t){return i.parse(t).kind()},i.isValid=function(t){return i.parse(t).isValid()},t.exports=i}).call(e,function(){return this}())},function(t,e,i){(function(e,o){"use strict";var n=(i(44),function(){function t(t,e){function i(n){function u(i){(o.enabled("same_data_requery")||w.value()!==i)&&(e?e.setSymbol(i):t.setSymbol(i))}function _(){s.setValue(w.value())}function f(t){a.setValue(t.pro_name||window.tradingController&&(t.full_name||t.name))}function g(){r.setValue(b.shortName.value());var t=y.symbolInfo();t?(f(t),t.hasOwnProperty("supported_resolutions")?c.setValue(t.supported_resolutions):c.setValue(void 0),h.setValue(!!t.has_intraday)):(h.deleteValue(),a.deleteValue())}function m(i){(o.enabled("same_data_requery")||S.value()!==i)&&(e?e.setResolution(i):t.setResolution(i))}function v(){l.setValue(S.value())}var y,b,w,S;t.modelCreated().unsubscribe(null,i),y=t.model().mainSeries(),b=y.properties(),w=b.symbol,w.subscribe(null,_),s.setValue(w.value()),s.subscribe(u),y.onSymbolResolved().subscribe(null,f),s.hook=function(t){return y.symbolSameAsCurrent(t)&&(t=y.actualSymbol()),t},y.onSymbolResolved().subscribe(null,g),y.onSymbolError().subscribe(null,g),g(),S=b.interval,S.subscribe(null,v),l.setValue(S.value()),l.subscribe(m),t.readOnly()&&(s.writeLock=!0),d=function(){w.unsubscribe(null,_),s.unsubscribe(u),y.onSymbolResolved().unsubscribe(null,g),y.onSymbolError().unsubscribe(null,g),S.unsubscribe(null,v),l.unsubscribe(m),delete s.hook,delete s.writeLock,d=function(){},p=function(){}}}var n,u;d(),p=function(){return t},n=t.model(),n?i(n):(t.modelCreated().subscribe(null,i),d=function(){t.modelCreated().unsubscribe(null,i),d=function(){},p=function(){}},u=t.properties().mainSeriesProperties,s.setValue(u.symbol.value()),l.setValue(u.interval.value()))}function i(t){function e(t){o=!0,s.setValue(t.resolved_symbol),o=!1}function i(e){o||t.search(e)}u();var o=!1;t.onSearchBySymbol.subscribe(null,e),s.subscribe(i),u=function(){t.onSearchBySymbol.unsubscribe(null,e),s.unsubscribe(i),u=function(){}}}function n(e){d(),e.activeChartWidget.subscribe(function(i){d(),t(i,e)},{callWithLast:!0})}var s=new e,r=new e,a=new e,l=new e,h=new e,c=new e,d=function(){},p=function(){},u=function(){};return{symbol:s,proSymbol:a,seriesShortSymbol:r.readonly(),interval:l,intraday:h.readonly(),supportedResolutions:c.readonly(),bindToChartWidget:t,unbindFromChartWidget:function(){d()},getChartWidget:function(){return p()},bindToSearchCharts:i,unbindFromSearchCharts:function(){u()},bindToChartWidgetCollection:n}}());TradingView.Linking=n,t.exports=n}).call(e,i(43),i(1))},function(t,e,i){(function(t){"use strict";function e(){}function i(t){return this instanceof i?(arguments.length>0&&(this._value=t),void(this._listeners=[])):new i(t)}i.prototype.value=function(){return this._owner?this._owner._value:this._value},i.prototype.setValue=function(t,e){var i,o,n,s=this._owner?this._owner:this;if("function"==typeof s.hook&&(t=s.hook(t)),s.writeLock)return s._value;if(!e&&s._value===t&&s.hasOwnProperty("_value"))return t;for(s._value=t,i=s._listeners.slice(),o=0,n=0;n<i.length;n++)i[n].once&&(s._listeners.splice(n-o,1),o++),i[n].cb(t);return t},i.prototype.deleteValue=function(){var t,e,i,o=this._owner?this._owner:this;if(o.hasOwnProperty("_value")){if(o.writeLock)return o._value;for(delete o._value,t=o._listeners.slice(),e=0,i=0;i<t.length;i++)t[i].once&&(o._listeners.splice(i-e,1),e++),t[i].cb()}},i.prototype.subscribe=function(t,e){var i,o,n;if("function"!=typeof t)throw new TypeError("callback must be a function");i=!!e&&!!e.once,o=!!e&&!!e.callWithLast,n=this._owner?this._owner:this,o&&n.hasOwnProperty("_value")&&(t(n._value),i)||n._listeners.push({cb:t,owner:this,once:!!e&&!!e.once})},i.prototype.unsubscribe=function(t){var e,i,o=this._owner?this._owner:this;for(void 0===t&&(t=null),e=o._listeners,i=e.length;i--;)e[i].owner!==this&&o!==this||e[i].cb!==t&&null!==t||e.splice(i,1)},i.prototype.readonly=function(){if(this._readonlyInstance)return this._readonlyInstance;var t=this._readonlyInstance=new e;return t.subscribe=this.subscribe.bind(this),t.unsubscribe=this.unsubscribe.bind(this),t.value=this.value.bind(this),t.when=this.when.bind(this),t},i.prototype.spawn=function(){var t=new i;return delete t._listeners,t._owner=this._owner||this,t.destroy=function(){this.unsubscribe(),delete this._owner},t},i.prototype.when=function(t){var e,i=this;return this.value()?void t():(e=function(o){o&&(i.unsubscribe(e),t())},void i.subscribe(e))},i.prototype.opposite=function(){var t,e;return this._opposite||(t=this,e=new i(!this.value()),this.subscribe(function(t){e.setValue(!t)}),e.subscribe(function(e){t.setValue(!e)}),this._opposite=e),this._opposite},"undefined"!=typeof window&&(window.WatchedValue=i),void 0!==t&&t&&t.exports&&(t.exports=i)}).call(e,i(2)(t))},function(t,e,i){(function(e){"use strict";var o=i(45).futuresRoots,n=function(){function t(t,e){var i=function(){};return i.prototype=e.prototype,t.prototype=new i,t}function i(t){return t.replace(/[\^\$\(\)\[\]\{\}\*\+\?\|\\]/g,"\\$&")}function n(){}function s(t){this.value=t}function r(){}function a(){}function l(){}function h(){}function c(){}function d(){}function p(){}function u(){}function _(t){this.value=t}function f(t){this.value=t}function g(t){this.value=t}function m(){_.apply(this,arguments)}function v(){f.apply(this,arguments)}function y(t,e){var i,o,n,r,a,l,h,c,d=[];t:for(;i=B.exec(t);){for(o=R.length;o--;)if(i[o+1]){R[o].ctor&&(n=new R[o].ctor(i[o+1]),n._offset=i.index,d.push(n));continue t}r=new g(i[0]),r._offset=i.index,d.push(r)}if(e&&e.recover)for(o=d.length;o--;)l=d[o],l instanceof f||l instanceof _?(void 0!==a&&(h=new _(""),c=d.splice(o,a-o+1,h),h.value=c.map(function(t){return t.value}).join("")),a=o):l instanceof s||(a=void 0);return d}function b(t){var i,o,n,h,c,d,p,u,m,v;if(e.enabled("charting_library_base"))return{currentState:"var"};for(i="init",o="var",n="operator",h=i,c={warnings:[],errors:[],isEmpty:!0},d=[],p=0;p<t.length;p++)if(u=t[p],!(u instanceof s))if(delete c.isEmpty,u.isIncomplete&&(m={status:"incomplete",reason:"incomplete_token",offset:u._offset,token:u},u.incompleteSuggest&&(m.recover={append:u.incompleteSuggest()}),c.warnings.push(m),p!==t.length-1))m.status="error";else if(u instanceof _||u instanceof f){if(h===o){c.errors.push({status:"error",reason:"unexpected_token",offset:u._offset,token:u});continue}h=o}else if(u instanceof l){if(h!==o){c.errors.push({status:"error",reason:"unexpected_token",offset:u._offset,token:u});continue}h=n}else if(u instanceof r){if(h===o){c.errors.push({status:"error",reason:"unexpected_token",offset:u._offset,token:u});continue}d.push(u),h=i}else if(u instanceof a){if(h!==o){c.errors.push({status:"error",reason:"unexpected_token",offset:u._offset,token:u});continue}v=d.pop(),v||c.errors.push({status:"error",reason:"unbalanced_brace",offset:u._offset,token:u,recover:{prepend:new r}}),h=o}else u instanceof g&&c.errors.push({status:"error",reason:"unparsed_entity",offset:u._offset,token:u});for(c.braceBalance=d.length,h!==o&&c.warnings.push({status:"incomplete"}),v=null;d.length;)u=d.pop(),m={status:"incomplete",reason:"unbalanced_brace",offset:u._offset,token:u},h===o&&(m.recover={append:new a}),c.warnings.push(m);return c.currentState=h,0===c.warnings.length&&delete c.warnings,0===c.errors.length&&delete c.errors,c}function w(t){var e,i=[];for(e=0;e<t.length;e++)t[e]instanceof s||i.push(t[e]);return i}function S(t){var e,i,o,n,s,h,c;for(t=w(t),e=[],i=[],n=0;n<t.length;n++)s=t[n],s instanceof l?i.length&&i[i.length-1].minPrecedence>s.precedence&&(i[i.length-1].minPrecedence=s.precedence):s instanceof r?i.push(o={minPrecedence:1/0,openBraceIndex:n}):s instanceof a&&(o=i.pop(),h=t[o.openBraceIndex-1],c=t[n+1],c instanceof l&&!(c.precedence<=o.minPrecedence)||!(!(h instanceof l)||h.precedence<o.minPrecedence||h.precedence===o.minPrecedence&&h.commutative)||(e.unshift(o.openBraceIndex),e.push(n),i.length&&i[i.length-1].minPrecedence>o.minPrecedence&&(i[i.length-1].minPrecedence=o.minPrecedence)));for(n=e.length;n--;)t.splice(e[n],1);return t}function T(t){for(var e=0;e<t.length;e++)t[e].parse&&t[e].parse();return t}function C(t){var e=x(t);return S(e?e:[new f("1"),new p,new r].concat(t).concat(new a))}function x(t){var e,i,o,n=0,h=1,c=2,d=3,u=n,_=0;for(i=0;i<t.length;i++)if(o=t[i],!(o instanceof s))switch(u){case n:if(!(o instanceof f&&1===+o.value))return!1;u=h;break;case h:if(!(u===h&&o instanceof p))return!1;u=c,e=i+1;break;case c:if(o instanceof r)u=d,_=1;else if(o instanceof l)return!1;break;case d:o instanceof r?_++:o instanceof a&&(_--,_<=0&&(u=c))}return t.slice(e)}function P(t){return new _(t).ticker()}function L(t){if("string"==typeof t)t=y(t);else if(!Array.isArray(t))throw new TypeError("expression must be a string or token array");return t.some(function(t){return t instanceof _&&"BATS"===(t.exchange()||"").toUpperCase()})}function k(t){if("string"==typeof t)t=y(t);else if(!Array.isArray(t))throw new TypeError("expression must be a string or token array");return t.some(function(t){return t instanceof _&&(t.exchange()||"").toUpperCase().indexOf("_EOD")!==-1})}function E(t){if("string"==typeof t)t=y(t);else if(!Array.isArray(t))throw new TypeError("expression must be a string or token array");return t.some(function(t){return t instanceof _&&"CHXEUR"===(t.exchange()||"").toUpperCase()})}function I(t){var e=["MOEX_DLY","LSE_DLY","LSIN_DLY","BSE_DLY","CME_DL","CME_MINI_DL","CBOT_DL","CBOT_MINI_DL","COMEX_DL","COMEX_MINI_DL","NYMEX_DL","NYMEX_MINI_DL"];if("string"==typeof t)t=y(t);else if(!Array.isArray(t))throw new TypeError("expression must be a string or token array");return t.some(function(t){return t instanceof _&&e.indexOf((t.exchange()||"").toUpperCase())!==-1})}function A(t,e){if("string"!=typeof t)throw new TypeError("expression must be a string");return t=y(t),1===t.length&&t[0].exchange().substr(0,e.length)===e}function V(t){if("string"!=typeof t)throw new TypeError("expression must be a string");var e=S(w(y(t)));return e.forEach(function(t){t instanceof _&&t.exchange(null)}),M(e)}function $(t){if("string"!=typeof t)throw new TypeError("expression must be a string");var e=S(w(y(t)));return M(e)}function M(t){return t.join("")}var D,O,B,R=[{pattern:"(",ctor:r},{pattern:")",ctor:a},{pattern:"+",ctor:h},{pattern:"-",ctor:c},{pattern:"*",ctor:d},{pattern:"/",ctor:p},{pattern:"^",ctor:u},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:\.&]))|\.\d+/,ctor:f},{pattern:/\./,ctor:v},{pattern:e.enabled("charting_library_base")?/[a-zA-Z0-9_\u4e00-\u9fa5^][a-zA-Z0-9_\u4e00-\u9fa5_!:\.&]*|'.+?'/:/[a-zA-Z0-9][a-zA-Z0-9_!|:\.&]*|'.+?'/,ctor:_},{pattern:/'[^']*/,ctor:m},{pattern:/[\0-\x20\s]+/,
ctor:s}];return n.prototype.toString=function(){return this.value},t(s,n),t(r,n),r.prototype.value="(",t(a,n),a.prototype.value=")",t(l,n),t(h,l),h.prototype.value="+",h.prototype.precedence=0,h.prototype.commutative=!0,t(c,l),c.prototype.value="-",c.prototype.precedence=0,c.prototype.commutative=!1,t(d,l),d.prototype.value="*",d.prototype.precedence=1,d.prototype.commutative=!0,t(p,l),p.prototype.value="/",p.prototype.precedence=1,p.prototype.commutative=!1,t(u,l),u.prototype.value="^",u.prototype.precedence=2,u.prototype.commutative=!1,D=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,O=/[\+\-\/\*]/,t(_,n),_.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var t=O.test(this._ticker)?"'":"";return t+(this._exchange?this._exchange+":":"")+this._ticker+t}return this.value},_.prototype.parse=function(){var t=D.exec(this.value);t[1]&&(this._exchange=t[1]),this._ticker=t[2]},_.prototype.parseAsFutures=function(){var t,e,i;if(o)for(this.hasOwnProperty("_ticker")||this.parse(),t=function(t){return o.some(function(e){return e.t===t})},e=2;e>=1;--e)if(i=this._ticker.slice(0,e),t(i)){this._root=i,this._contract=this._ticker.slice(e);break}},_.prototype.exchange=function(t){return this.hasOwnProperty("_ticker")||this.parse(),arguments.length>0?void(null===t||void 0===t?delete this._exchange:this._exchange=t+""):this._exchange},_.prototype.ticker=function(t){return this.hasOwnProperty("_ticker")||this.parse(),arguments.length>0?(null===t||void 0===t?delete this._ticker:this._ticker=t+"",delete this._root,delete this._contract,void 0):this._ticker},_.prototype.root=function(t){return this.hasOwnProperty("_root")||this.parseAsFutures(),arguments.length>0?void(null===t||void 0===t?delete this._root:(this._root=t+"",this._root&&(this._ticker=this._root+(this._contract||"")))):this._root},_.prototype.contract=function(t){return this.hasOwnProperty("_contract")||this.parseAsFutures(),arguments.length>0?void(null===t||void 0===t?delete this._contract:(this._contract=t+"",this._root&&(this._ticker=this._root+this._contract))):this._root},t(f,n),f.prototype.toString=function(){return this.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},f.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},g.prototype.toString=function(){return this.value},t(m,_),m.prototype.isIncomplete=!0,m.prototype.incompleteSuggest=function(){if("'"!==this.value)return"'"},t(v,f),v.prototype.isIncomplete=!0,B=RegExp(R.map(function(t){return"("+("string"==typeof t.pattern?i(t.pattern):t.pattern.source)+")"}).concat(".").join("|"),"g"),{tokenize:y,validate:b,factorOutBraces:S,normalizeTokens:T,flip:C,hasBatsSymbols:L,hasEodSymbols:k,hasChxeurSymbols:E,hasFreeDelaySymbols:I,isExchange:A,SymbolToken:_,IncompleteSymbolToken:m,NumberToken:f,BinaryOperatorToken:l,OpenBraceToken:r,CloseBraceToken:a,ticker:P,shortName:V,normalize:$}}();t.exports=n}).call(e,i(1))},function(t,e){"use strict";e.availableTimezones=TradingView.availableTimezones=[{id:"Etc/UTC",title:$.t("UTC")},{id:"exchange",title:$.t("Exchange")},{id:"Pacific/Honolulu",title:$.t("Honolulu")},{id:"America/Vancouver",title:$.t("Vancouver")},{id:"America/Los_Angeles",title:$.t("Los Angeles")},{id:"America/Phoenix",title:$.t("Phoenix")},{id:"America/Chicago",title:$.t("Chicago")},{id:"America/El_Salvador",title:$.t("San Salvador")},{id:"America/Toronto",title:$.t("Toronto")},{id:"America/New_York",title:$.t("New York")},{id:"America/Bogota",title:$.t("Bogota")},{id:"America/Argentina/Buenos_Aires",title:$.t("Buenos Aires")},{id:"America/Sao_Paulo",title:$.t("Sao Paulo")},{id:"Europe/London",title:$.t("London")},{id:"Europe/Madrid",title:$.t("Madrid")},{id:"Europe/Paris",title:$.t("Paris")},{id:"Europe/Berlin",title:$.t("Berlin")},{id:"Europe/Warsaw",title:$.t("Warsaw")},{id:"Europe/Athens",title:$.t("Athens")},{id:"Europe/Moscow",title:$.t("Moscow")},{id:"Asia/Tehran",title:$.t("Tehran")},{id:"Asia/Dubai",title:$.t("Dubai")},{id:"Asia/Ashkhabad",title:$.t("Ashkhabad")},{id:"Asia/Kolkata",title:$.t("Kolkata")},{id:"Asia/Almaty",title:$.t("Almaty")},{id:"Asia/Bangkok",title:$.t("Bangkok")},{id:"Asia/Taipei",title:$.t("Taipei")},{id:"Asia/Singapore",title:$.t("Singapore")},{id:"Asia/Shanghai",title:$.t("Shanghai")},{id:"Asia/Hong_Kong",title:$.t("Hong Kong")},{id:"Asia/Seoul",title:$.t("Seoul")},{id:"Asia/Tokyo",title:$.t("Tokyo")},{id:"Australia/Brisbane",title:$.t("Brisbane")},{id:"Australia/Adelaide",title:$.t("Adelaide")},{id:"Australia/Sydney",title:$.t("Sydney")},{id:"Pacific/Auckland",title:$.t("New Zealand")},{id:"Pacific/Fakaofo",title:$.t("Tokelau")},{id:"Pacific/Chatham",title:$.t("Chatham Islands")}],e.monthsShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],e.futuresRoots=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}]},function(t,e,i){"use strict";t.exports=TradingView.templates={index:{chartsSection:'<div class="index-charts-tab active" id="index-charts-tab-{{index}}"><div class="index-charts-tab-sizer"><div class="index-charts-tab-container"><div class="clear"></div></div><div class="index-charts-spinner"></div></div><div class="show-more"><a href="/chart/?q=&sort={{url}}" id="show-more-button">'+$.t("More {{sectionName}} Ideas")+"</a></div></div>",chartsSectionItem:'<div class="item" id="chart-{{id}}"><a href="{{published_chart_url}}"><img class="chart-img" src="{{image_mid_url}}" alt="" /></a><div class="caption">{{>iconedFollowSymbolButton}} <a href="/chart/{{short_name}}/{{#full_name_required}}?exg={{exchange}}{{/full_name_required}}" class="symbol" data-symbol="{{symbol}}">{{short_name}}</a>, <span class="interval">{{interval}}</span> <span class="count views"><span class="icon icon-eye" title="'+$.t("Views")+'"></span> {{views_count}}</span><span class="count comments"><span class="icon icon-comment" title="'+$.t("Comments")+'"></span> {{comment_count}}</span></div><a class="cover{{#is_online}} online{{/is_online}}" href="{{published_chart_url}}"><img class="avatar-pic" src="{{user_picture}}" alt="{{full_name}}"/><div class="user-info">{{full_name}}{{#is_moderator}}<sup class="user-badge mod" title="'+$.t("Moderator")+'}">'+$.t("mod")+'</sup>{{/is_moderator}} {{^is_moderator}}{{#is_pro}}<sup class="user-badge pro{{#is_realtime}} realtime{{/is_realtime}}{{#is_trial}} trial{{/is_trial}}" title="'+$.t("Pro")+"{{#is_realtime}} "+$.t("Realtime")+"{{/is_realtime}}{{#is_trial}} "+$.t("Trial")+'{{/is_trial}}">'+$.t("Pro")+'</sup>{{/is_pro}} {{/is_moderator}}<br/><span class="icon icon-charts" title="'+$.t("Charts")+'"></span> {{user_charts}} <span class="icon icon-rating-small" title="'+$.t("Rating")+'"></span> {{followers_count}}</div><div class="clear"></div><div class="name">{{name}}</div><div class="desc">{{desc}}</div><div class="date">{{created_time}}</div><div class="icons">{{> chartBadges}}<span class="chart-direction-label direction-{{direction}}">{{#direction_name}}{{direction}}{{/direction_name}}</span></div></a></div>'},addressInputsRows:'<tr><td colspan="12"><p>'+$.t("Address")+'</p><input class="address-autocomplete" type="text" value="" placeholder="{{#addressPlaceholder}}{{addressPlaceholder}}{{/addressPlaceholder}}{{^addressPlaceholder}}'+$.t("Enter your ZIP code")+'{{/addressPlaceholder}}"/></td></tr><tr><td colspan="12"><input type="text" autocomplete-name="route" name="STREET" value="{{#reference_transaction_billing_address.STREET}}{{reference_transaction_billing_address.STREET}}{{/reference_transaction_billing_address.STREET}}{{^reference_transaction_billing_address.STREET}}{{ user.billing_street }}{{/reference_transaction_billing_address.STREET}}" placeholder="'+$.t("Street")+'" disabled="true"/></td></tr><tr><td colspan="6"><input type="text" autocomplete-name="locality" name="CITY" value="{{#reference_transaction_billing_address.CITY}}{{reference_transaction_billing_address.CITY}}{{/reference_transaction_billing_address.CITY}}{{^reference_transaction_billing_address.CITY}}{{ user.billing_city }}{{/reference_transaction_billing_address.CITY}}" placeholder="'+$.t("City")+'" disabled="true"/></td><td colspan="6"><input type="text" autocomplete-name="administrative_area_level_1" name="STATE" value="{{#reference_transaction_billing_address.STATE}}{{reference_transaction_billing_address.STATE}}{{/reference_transaction_billing_address.STATE}}{{^reference_transaction_billing_address.STATE}}{{ user.billing_state }}{{/reference_transaction_billing_address.STATE}}" placeholder="'+$.t("State/Region")+'" disabled="true"/></td></tr><tr><td colspan="6"><input type="text" autocomplete-name="country" name="COUNTRY" value="{{#reference_transaction_billing_address.COUNTRY}}{{reference_transaction_billing_address.COUNTRY}}{{/reference_transaction_billing_address.COUNTRY}}{{^reference_transaction_billing_address.COUNTRY}}{{ user.billing_country }}{{/reference_transaction_billing_address.COUNTRY}}" placeholder="'+$.t("Country")+'" disabled="true"/><input type="hidden" autocomplete-name="country_code" name="COUNTRYCODE" value="{{#reference_transaction_billing_address.COUNTRYCODE}}{{reference_transaction_billing_address.COUNTRYCODE}}{{/reference_transaction_billing_address.COUNTRYCODE}}{{^reference_transaction_billing_address.COUNTRYCODE}}{{ user.billing_countrycode }}{{/reference_transaction_billing_address.COUNTRYCODE}}" /></td><td colspan="6"><input type="text" autocomplete-name="postal_code" name="ZIP" value="{{#reference_transaction_billing_address.ZIP}}{{reference_transaction_billing_address.ZIP}}{{/reference_transaction_billing_address.ZIP}}{{^reference_transaction_billing_address.ZIP}}{{ user.billing_zip }}{{/reference_transaction_billing_address.ZIP}}" placeholder="'+$.t("Zip Code")+'" disabled="true"/></td></tr>',dialogs:{},lists:{savedCharts:"<ul>{{#charts}}<li><a href='/chart/{{url}}/'><span class='name'>{{name}}</span> <span class='subscript'>{{modified}}{{#short_symbol}} | {{short_symbol}}{{#interval}}, {{interval}}{{/interval}}{{/short_symbol}}</span> <span class='icon icon-carousel-item-delete-dark' title='"+$.t("Delete")+"' data-id='{{url}}'></span></a></li>{{/charts}}</ul>"},billingUpgradeForYear:'<div class="tv-billing-upgrade tv-profile-area"><h3 class="no-border billing-upgrade-header">'+$.t("GET 6 MONTHS FREE")+'</h3><div class="tv-billing-upgrade-body"><span>'+$.t("You already spent ${0}, and if you continue to pay every month, the year will cost you ${1}. Don't let your money go to waste - upgrade now to an annual plan for just ${2}. It's time to stop spending and start investing, get 6 months free!").format("{{spent}}","{{year_cost}}","{{cost}}")+'</span><p><input type="button" class="btn light-blue js-upgrade-for-year tv-upgrade-for-year" value="'+$.t("GET 6 MONTHS FREE!")+'"</p></div></div>',userlink:"<a href='/u/{{username}}/' class='userlink'>{{username}}</a>{{> userBadge}}",userBadge:"{{#is_top}}{{> topBadge}}{{/is_top}}{{^is_top}}{{#is_moderator}}{{> modBadge}}{{/is_moderator}}{{^is_moderator}}{{#is_pro}}{{> proBadge}}{{/is_pro}}{{/is_moderator}}{{/is_top}}",userBadgeChat:"{{#is_top}}{{#is_moderator}}{{> modBadge}}{{/is_moderator}}{{^is_moderator}}{{> topBadge}}{{/is_moderator}}{{/is_top}}{{^is_top}}{{#is_moderator}}{{> modBadge}}{{/is_moderator}}{{^is_moderator}}{{#is_pro}}{{> proBadge}}{{/is_pro}}{{/is_moderator}}{{/is_top}}",proBadge:'<{{badge_tag}}{{^badge_tag}}a href="/gopro/"{{/badge_tag}} class="apply-common-tooltip user-badge pro{{#is_realtime}} realtime{{/is_realtime}}{{#is_premium}} premium{{/is_premium}}{{#is_trial}} trial{{/is_trial}}{{#large_badge}} large{{/large_badge}}" title="{{#is_realtime}}'+$.t("Pro Realtime")+"{{/is_realtime}}{{#is_premium}}"+$.t("Premium")+"{{/is_premium}}{{#is_trial}}"+$.t("Pro Trial")+'{{/is_trial}}{{^is_realtime}}{{^is_premium}}{{^is_trial}}Pro{{/is_trial}}{{/is_premium}}{{/is_realtime}}">'+$.t("pro")+"</{{badge_tag}}{{^badge_tag}}a{{/badge_tag}}>",modBadge:"<{{badge_tag}}{{^badge_tag}}a href='/house-rules/'{{/badge_tag}} class='user-badge mod{{#large_badge}} large{{/large_badge}} apply-common-tooltip' title='"+$.t("Moderator")+"'>mod</{{badge_tag}}{{^badge_tag}}a{{/badge_tag}}>",topBadge:"<{{badge_tag}}{{^badge_tag}}a href='/people/'{{/badge_tag}} class='user-badge top{{#large_badge}} large{{/large_badge}} {{badge_class}} apply-common-tooltip' title='{{badge_title}}'>top</{{badge_tag}}{{^badge_tag}}a{{/badge_tag}}>",chartBadges:"",iconedFollowSymbolButton:'{{#pro_symbol}}<button class="follow-symbol iconed{{#current_user_follows_symbol}} active{{/current_user_follows_symbol}}" data-symbol="{{pro_symbol}}" title="'+$.t("Follow {{pro_symbol}}")+'"></button>{{/pro_symbol}}',globalNotification:'<div class="tv-global-notification" id="global-notification-{{ id }}"><div class="tv-layout-width"><span class="icon icon-notification-info"></span>{{{ text }}}</div><span class="global-notification-close"><i class="icon icon-notification-close"></i></span></div>',actionsLog:'<div class="entry"><b>{{#is_system}}<img src="images/small-logo.png" class="log-system-message"/>system{{/is_system}}{{^is_system}}<a href="/u/{{username}}" target="_blank">{{username}}</a>{{/is_system}}</b><div class="entry-time time-upd">{{ created_timestamp }}</div> <div class="message">{{{text}}}</div></div>',onChartMessage:'<div class="onchart-message"><span class="onchart-message-close"></span><div class="onchart-message-top"><div class="onchart-message-copy"></div></div><div class="onchart-message-bottom"><div class="onchart-message-ear"></div></div></div>',userlinkPopup:'<div class="msg-userlink-popup" data-id="{{ id }}"><div class="msg-userlink-popup-container"><a class="userpic" href="/u/{{ username }}/"><img class="userpic" src="{{#has_picture}}{{big_picture_url}}{{/has_picture}}{{^has_picture}}{{mid_picture_url}}{{/has_picture}}"/></a><div class="content"><div class="username">{{> userlink}}<span class="btc-tip"></span></div><div class="user-stats-small"><span class="user-stats-followers" title="'+$.t("Followers")+'">{{followers_count}}</span><span class="user-stats-charts" title="'+$.t("Charts")+'">{{charts_count}}</span><span class="user-stats-reputation" title="'+$.t("Reputation")+'">{{reputation}}</span></div>{{^is_self}}{{#show_buttons}}<div class="action-buttons"><button class="follow-user follow-user-{{ id }}{{#follow_status}} active{{/follow_status}}" title="{{#follow_status}}'+$.t("Unfollow")+"{{/follow_status}}{{^follow_status}}"+$.t("Follow")+'{{/follow_status}}" data-id="{{ id }}"><span class="follow">'+$.t("Follow")+'</span><span class="following">'+$.t("Followed")+'</span><span class="unfollow">'+$.t("Unfollow")+'</span></button> <button class="message-user message active" title="'+$.t("Send message")+'" data-username="{{ username }}" data-id="{{ id }}"><span class="message">'+$.t("Message")+'</span></button></div>{{/show_buttons}}{{/is_self}}</div><div class="clear"></div>{{#status}}<div class="user-status">{{status}}</div>{{/status}}<div class="send-form"><p>'+$.t("To:")+' <strong>{{ username }}</strong></p><p><textarea name="message-text"></textarea></p><p class="actions"><button class="message-user active send">'+$.t("Send")+'</button><button class="message-user cancel">'+$.t("Cancel")+"</button></p></div></div></div>",miniWidgetWizardAddSymbol:'<tr class="symbol-item"><td>{{symbol}}</td><td>{{description}}</td><td>{{timeframe}}</td><td><div class="remove-symbol"></div></td></tr>',userInfoWidgetButtons1:'<div class="buttons layout-2-buttons"><button class="profile-action profile-edit" data-id="{{ id }}" data-username="{{ username }}" title="'+$.t("Edit profile")+'"><span class="">'+$.t("Edit")+'</span></button><button class="profile-action profile-signout" title="'+$.t("Sign out")+'" onclick="TradingView.signOut(); return false;"><span class="">'+$.t("Sign out")+'</span></button><div class="clear"></div></div>',userInfoWidgetButtons2:'<div class="buttons layout-1-buttons"><button class="follow-user {{ is_followed_css }} follow-user-{{ id }}" data-id="{{ id }}"><span class="follow" title="'+$.t("Follow")+'"></span><span class="following" title="'+$.t("Following")+'"></span><span class="unfollow" title="'+$.t("Unfollow")+'"></span></button><div class="clear"></div></div>',userInfoWidgetButtons3:'<div class="buttons layout-1-buttons"><button class="profile-action profile-signin" title="'+$.t("Sign in")+'" onclick="runOrSignIn(function() {}, { source: "User info widget sign in" }); return false;"><span class="">'+$.t("Sign in")+'</span></button><div class="clear"></div></div>',textNotesWidgetLayout:'<div class="notes-block"><div class="textnotes-search-header"><div class="search-input-block">'+i(47)+'<div class="search-clean"></div><input type="text" class="search-input" placeholder="'+$.t("Search Note")+'" maxlength="1000" autocomplete="off"></div><div class="new-note-btn">'+i(48)+$.t("NEW")+'</div></div><div class="notes-wrapper"><div class="notes"></div></div></div><div class="notes-desc-block"><div class="notes-desc-wrapper"><div class="notes-desc-inner"><div class="remove-note-btn">'+i(49)+'</div><div class="title-wrap"><input type="text" maxlength="40" value="" class="title"></div><div class="date"><span class="created">'+$.t("Created ")+'<span class="created-val"></span>. </span><span class="modified">'+$.t("Last edited ")+'<span class="modified-val"></span></span></div><textarea></textarea></div></div></div>',textNotesWidgetItem:'<div class="note"><div class="note-header"><div {{#symbol}}title="'+$.t("Open")+" {{symbol}} "+$.t("Text Note")+'"{{/symbol}} class="title {{#symbol}}title_with-badge{{/symbol}}">{{title}}</div>{{#symbol}}<div class="symbol-badge">'+i(50)+'<span class="symbol">{{symbol}}</span></div>{{/symbol}}</div><div class="note-desc">{{description}}</div><span class="favorite"></span></div>',tvDataTable:'<table class="tv-data-table {{className}}"><thead class="tv-data-table__thead"><tr class="tv-data-table__stroke">{{#columns}}<th class="tv-data-table__cell tv-data-table__cell--bold {{className}}">{{#notSortable}}{{label}}{{/notSortable}}{{^notSortable}}<span class="tv-data-table__cell-text tv-data-table__sortable {{#help}}apply-common-tooltip{{/help}}" {{#help}}title="{{help}}"{{/help}}>{{label}}</span>{{/notSortable}}</th>{{/columns}}</tr></thead>{{#bodys}}<tbody class="tv-data-table__tbody {{className}}">{{#strokes}}<tr class="tv-data-table__stroke">{{#cells}}<td class="tv-data-table__cell {{className}}"{{#colspan}}colspan="{{colspan}}"{{/colspan}}>{{#contain}}{{{contain}}}{{/contain}}</td>{{/cells}}</tr>{{/strokes}}</tbody>{{/bodys}}</table>',tvDataTableRow:'<tr class="tv-data-table__stroke">{{#columns}}<td class="tv-data-table__cell {{className}}">{{#contain}}{{{contain}}}{{/contain}}</td>{{/columns}}</tr>',tvDataTableCell:'<td class="tv-data-table__cell {{className}}">{{#contain}}{{{contain}}}{{/contain}}</td>',tvWidgetChartLikeButton:'<div data-id="{{chartId}}" class="tv-widget-chart-like-button {{typeClass}}"><span class="tv-widget-chart-like-button__icon-place">'+i(51)+'</span><span class="js-likes-counter"></span></div>',widgetReferrals:{features:{alerts:$.t("Stay on top of market moves! Alerts are immediate notifications when markets meet your custom criteria. Pick from visual popups, audio signals & email alerts."),pinescript:$.t("Create your own indicators and strategies! Pine Script is a flexible and efficient language for doing just that."),saveload:$.t("Save the analysis you do! Your custom settings, indicator setups and so on are saved onsite as individual charts for later access from anywhere."),customIntervals:$.t("Customize how you look at the markets! View charts in custom timeframes, such as 7 minutes, 12 minutes, or even 8 hours per bar."),kagiRenko:$.t("Get a new look at the markets with advanced chart types! Use Kagi and Renko charts with intraday resolutions for a complete picture."),plusMenu:$.t("Stay on top of market moves. Set alerts and place orders in one click!")}},cmeOfferDialog:{stage1:"<p>"+$.t("Don't pay extra to get real-time US futures data on TradingView!")+"</p><p>"+$.t("If you have a live trading account with a __blink__CQG-powered broker__elink__, and you qualified for non-pro data fees with your broker, log in with your live account to view real-time futures data.",{blink:'<a href="http://www.cqg.com/partners/fcms" target="_blank">',elink:"</a>"})+"</p><p>"+$.t("We perform a check that you indeed have a live account and your existing data entitlements (the one your broker gave you) apply here, free of extra charges.")+"</p><p><b>"+$.t("GLOBEX, NYMEX, CBOT and COMEX for $0 extra.")+'</b></p><ul class="cme-offer-dialog__list"><li><p>'+$.t("Offer available only to upgraded plan holders")+";</p></li><li><p>"+$.t("Data is enabled for 30 days")+";</p></li><li><p>"+$.t("You need to log in with your live account once a month to renew the data.")+'</p></li></ul><div class="cme-offer-dialog__button-wrapper"><span class="tv-button tv-button--default _tv-dialog-title-close">'+$.t("Cancel")+'</span><span class="tv-button tv-button--primary js-next">'+$.t("Next")+"</span></div>",stage2:'<form class="cme-offer-dialog__form" id="cme-connect-form"><img src="'+TradingView.wrapUrl("images/brokers/cqg.png")+'" class="cme-offer-dialog__cqg-logo"><div class="cme-offer-dialog__input-wrapper"><input name="login" type="text" class="tv-control-input" placeholder="'+$.t("Login")+'"></div><div class="cme-offer-dialog__input-wrapper"><input name="password" type="password" class="tv-control-input cme-offer-dialog__input" placeholder="'+$.t("Password")+'"></div><table class="cme-offer-dialog__table"><tr class="cme-offer-dialog__stroke"><td class="cme-offer-dialog__cell"><span class="cme-offer-dialog__options">'+$.t('By clicking "Test Connection" I confirm I\'ve read the <a href="https://www.tradingview.com/risk-warning/" target="_blank">warning</a> and <a href="https://www.tradingview.com/policies/" target="_blank">terms of use</a> and accept all risks.')+'</span></td><td class="cme-offer-dialog__cell"><div class="cme-offer-dialog__button-wrapper"><button class="tv-button tv-button--primary tv-button--loader js-connect" type="submit">'+$.t("Test Connection")+"</button></div></td></tr></table></form>",stage3:'<div class="cme-offer-dialog__status {{#okStatus}}cme-offer-dialog__status--ok{{/okStatus}}{{^okStatus}}cme-offer-dialog__status--fail{{/okStatus}}">{{#okStatus}}'+i(52)+"{{/okStatus}}{{^okStatus}}"+i(53)+"{{/okStatus}}</div>{{#okStatus}}<p>"+$.t("Congrats! Your live trading account is verified. Real-time futures data for GLOBEX, NYMEX, CBOT and COMEX is now enabled, you can close this window and enjoy!")+"</p>{{/okStatus}}{{^okStatus}}<p>"+$.t("Oops, something went wrong!")+'</p><ul class="cme-offer-dialog__list"><li><p>'+$.t('Check your login and password, and <a href="/" class="js-try-again">try again</a>.')+"</p></li><li><p>"+$.t("Your account may not be a live trading account. Check with your broker that you have a live trading account.")+"</p></li><li><p>"+$.t('If don\'t have a live trading account, you can <a href="http://www.cqg.com/partners/fcms/" target="_blank" rel="nofollow">open one with a CQG-powered broker</a>.')+"</p></li><li><p>"+$.t("You can buy real-time data access to GLOBEX, NYMEX, CBOT and COMEX at the full exchange price from TradingView.")+'</p></li></ul>{{/okStatus}}<div class="cme-offer-dialog__button-wrapper">{{#okStatus}}<span class="tv-button tv-button--primary _tv-dialog-title-close js-ok">'+$.t("Ok")+'</span>{{/okStatus}}{{^okStatus}}<span class="tv-button tv-button--primary js-try-again">'+$.t("Try Again")+'</span><span class="tv-button tv-button--primary _tv-dialog-title-close">'+$.t("Close")+"</span>{{/okStatus}}</div>"}}},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>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path fill="#ffffff" d="M18 10V0h-8v10H0v8h10v10h8V18h10v-8"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 18" width="14" height="18"><path fill-rule="evenodd" d="M1 16c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V4H1v12zM14 1h-3.5l-1-1h-5l-1 1H0v2h14V1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 14" width="25" height="14" style="position:relative;top:3px"><path d="M10.43 8.683L9.345 8.68c-.943-.005-1.712-.774-1.716-1.717-.003-.452.172-.877.49-1.195.32-.32.744-.493 1.196-.492l4.002.016c.83.004 2.22.18 2.225 1.316.002.522.427.943.95.942.52-.002.942-.427.94-.95-.007-1.932-1.62-3.188-4.107-3.198l-4.003-.016c-.96-.003-1.862.368-2.54 1.045-.677.68-1.048 1.58-1.044 2.54.003.99.41 1.887 1.06 2.54.652.65 1.55 1.056 2.54 1.06l1.086.004c.522.002.947-.42.948-.942.002-.52-.42-.946-.942-.947zm13.832-1.655c-.008-2.076-1.41-3.59-3.33-3.597l-1.357-.003c-.522-.002-.947.42-.948.942-.002.52.42.946.94.947l1.356.006c.996.003 1.445.863 1.448 1.714.004.453-.17.878-.49 1.196-.317.32-.742.493-1.195.492l-4.27-.017c-1.952-.008-1.955-.924-1.957-1.315-.002-.522-.426-.943-.948-.942-.523.003-.945.428-.943.95.004.896.296 1.63.834 2.17.66.66 1.69 1.023 3.01 1.028l4.27.017c.96.003 1.86-.368 2.54-1.046.675-.678 1.046-1.58 1.043-2.54z"/></svg>'},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>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 98" width="98" height="98"><g fill="none" fill-rule="evenodd" stroke="#000" transform="translate(1 1)"><circle stroke-width="2" cx="48" cy="48" r="48"/><path stroke-width="4" d="M27 49l14 14 28-29"/></g></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 98" width="98" height="98"><g fill="none" fill-rule="evenodd" stroke="#000"><circle stroke-width="2" cx="48" cy="48" r="48" transform="translate(1 1)"/><g stroke-width="4"><path d="M34.517 34.775l28.868 28.867M34.517 63.642l28.868-28.867"/></g></g></svg>'},function(t,e,i){"use strict";function o(t){this._options=t||{},this._setInput(),this._caption=$('<i class="interval-caption">').html("&nbsp;"),this._helpTooltipTrigger=$('<i class="help-tooltip-trigger apply-common-tooltip common-tooltip-below">').text("?").attr("title",$.t("interval_dialog_description")),this._dialogTitle=$.t("Change Interval")}var n=i(42),s=i(39);o.prototype._setInput=function(){this._input=$('<input type="text" class="change-interval-input" autocomplete="off" maxlength="4">'),this._input.on("keypress",this._handleInput.bind(this)).on("input",function(){this._validate(),this._updateCaption()}.bind(this)).on("blur",function(){setTimeout(this._submit.bind(this),0)}.bind(this))},o.prototype._validate=function(){var t,e=this._input.val();this._parsed=s.parseIntervalValue(e),this._valid=!this._parsed.error,this._supported=!this._parsed.error&&s.intervalIsSupported(e),!this._supported||this._parsed.unit&&"H"!==this._parsed.unit||(t=this._parsed.qty*("H"===this._parsed.unit?60:1),t>1440&&(this._supported=!1))},o.prototype._updateCaption=function(){var t,e,i;this._valid&&this._supported?(e=this._parsed.qty||1,i=this._parsed.unit?{H:"hour",D:"day",W:"week",M:"month",S:"second"}[this._parsed.unit]:"minute",t=e+" "+$.t(i,{count:e}),this._input.add(this._caption).removeClass("error")):(t=this._parsed.error?"&nbsp;":$.t("Not applicable"),this._input.add(this._caption).addClass("error")),this._caption.html(t)},o.prototype._handleInput=function(t){return 13===t.which?void this._submit():void(t.ctrlKey||t.metaKey||!t.charCode||!t.which||t.which<=32||s.isIntervalChar(String.fromCharCode(t.charCode))||t.preventDefault())},o.prototype._submit=function(){var t,e;TVDialogs.isOpen(this._dialogTitle)&&(this._valid&&this._supported&&(t=s.sanitizeIntervalValue(this._input.val()),e=n.interval.value(),t&&e!==t&&"function"==typeof this._options.callback&&this._options.callback(t)),TVDialogs.destroy(this._dialogTitle))},o.prototype._setInitialValue=function(t){var e,i;t=t||this._options.initialValue,e="",i=!1,t&&","!==t?e=s.sanitizeIntervalValue(t)||"":(t=n.interval.value(),e=t,i=!0),this._input.val(e),i&&this._input.select()},o.prototype.isValid=function(){return!!this._valid},o.prototype.show=function(t){var e=TVDialogs.createDialog(this._dialogTitle,{hideCloseCross:!0,addClass:"change-interval-dialog"}),i=e.find("._tv-dialog-content");return e.css("min-width",0),i.css("min-width",0).mousedown(function(t){this._input.is(t.target)||t.preventDefault()}.bind(this)).append(this._input.add(this._caption).add(this._helpTooltipTrigger)),TVDialogs.applyHandlers(e),TVDialogs.positionDialog(e),this._setInitialValue(t),this._validate(),this._updateCaption(),e},t.exports=o},function(t,e,i){(function(t,o){"use strict";var n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V,M,D,O,B,R;"undefined"!=typeof FlashCanvas&&FlashCanvas.setOptions({disableContextMenu:!0}),n=function(t,e){if(t.width=e.w,t.height=e.h,"undefined"==typeof FlashCanvas){var i=t.getContext("2d");i.translate(.5,.5)}},e.setCanvasSize=n,s=function(t,e,i,o,n,s){t.save(),"undefined"==typeof FlashCanvas&&t.translate(-.5,-.5),t.fillStyle=s,t.fillRect(e,i,o,n),t.restore()},e.clearRect=s,r=function(t,e){var i=document.createElement("canvas");return t.append(i),"undefined"!=typeof FlashCanvas&&FlashCanvas.initElement(i),n(i,e),i},e.addCanvasTo=r,a=function(t,e,i,o){this.x=t,this.y=e,this.w=i,this.h=o},e.Rect=a,l=function(t,e){this.w=t,this.h=e},e.Size=l,l.prototype.equals=function(t){return this.w===t.w&&this.h===t.h},h=function(t,e){this.x=t,this.y=e},e.Point=h,c=function(t,e){t.css("position","absolute"),t.css("left",e.x+"px"),t.css("top",e.y+"px"),t.width(e.w),t.height(e.h)},e.setAbsoluteRect=c,d=function(t,e){t.css("position","absolute"),t.css("left",e.x+"px"),t.css("top",e.y+"px")},e.setAbsolutePos=d,p=function(t,e){var i=t.offset();e.localX=e.pageX-i.left,e.localY=e.pageY-i.top},e.addLocalCoordsToMouseEvent=p,u=function(t,e,i,o,n){o&&(n||p(e,t),o.call(i,t,e))},e.processEvent=u,_=2,f=function(t,e,i){var o,n,s,r,a,l,h,c,d,p,f,g,m,v,y=function(o){t.off("mousemove.chartgui");var n=function(o){TradingView.mousePressed&&!Modernizr.touch||(u(o,t,e,e.mouseMoveEvent),i&&o.preventDefault())};t.on("mousemove.chartgui",n),Modernizr.touch&&n(o),u(o,t,e,e.mouseEnterEvent),i&&o.preventDefault()};t.mouseenter(y),o=0,n=null,s=500,r=function(){window.clearTimeout(n),o=0,n=null},a={x:0,y:0},l=null,h=500,c=function(c){var d,p;
if(void 0===c.button&&(c.button=0),(Modernizr.touch||c.originalEvent.touches)&&(c.pageX=c.originalEvent.touches[0].pageX,c.pageY=c.originalEvent.touches[0].pageY,c.localX=c.originalEvent.touches[0].pageX,c.localY=c.originalEvent.touches[0].pageY,y(c)),d=function(o){void 0===o.button&&(o.button=0),(Modernizr.touch||o.originalEvent.touches)&&(o.pageX=o.originalEvent.touches[0].pageX,o.pageY=o.originalEvent.touches[0].pageY,o.localX=o.originalEvent.touches[0].pageX,o.localY=o.originalEvent.touches[0].pageY,o.clientX=o.originalEvent.touches[0].pageX,o.clientY=o.originalEvent.touches[0].pageY,a.x=o.pageX,a.y=o.pageY,clearTimeout(l)),o.button!==_&&u(o,t,e,e.pressedMouseMoveEvent),i&&o.preventDefault()},p=function(s){void 0===s.button&&(s.button=0),(Modernizr.touch||s.originalEvent.touches)&&(s.pageX=a.x,s.pageY=a.y,s.localX=a.x,s.localY=a.y,clearTimeout(l)),TradingView.mousePressed=!1,$(document.body).off("mousemove.chartgui"),$(document.body).off("mouseup.chartgui"),Modernizr.touch||s.originalEvent.touches?($(document.body).off("touchmove.chartgui"),$(document.body).off("touchend.chartgui"),m(s)):($(document.body).off("mousemove.chartgui touchmove.chartgui"),$(document.body).off("mouseup.chartgui touchend.chartgui")),s.button!==_&&(u(s,t,e,e.mouseUpEvent),++o,n&&o>1?(u(s,t,e,e.mouseDoubleClickEvent),r()):u(s,t,e,e.mouseClickEvent)),i&&s.preventDefault(),Modernizr.touch&&m(s)},Modernizr.touch?($(document.body).off("touchmove.chartgui"),$(document.body).off("touchend.chartgui"),$(document.body).on("touchmove.chartgui",d),$(document.body).on("touchend.chartgui",p),l=setTimeout(function(){v(c)},h)):($(document.body).off("mousemove.chartgui touchmove.chartgui"),$(document.body).off("mouseup.chartgui touchend.chartgui"),$(document.body).on("mousemove.chartgui touchmove.chartgui",d),$(document.body).on("mouseup.chartgui touchend.chartgui",p)),TradingView.mousePressed=!0,c.button!==_&&(u(c,t,e,e.mouseDownEvent),n||(o=0,n=window.setTimeout(r,s))),i){c.preventDefault();try{window.focus()}catch(t){}}},t.on("touchcancel",function(){clearTimeout(l)}),Modernizr.touch?(t.on("touchstart.chartgui",c),t.on("touchstartoutside mousedownoutside",function(i){u(i,t,e,e.mouseDownOutsideEvent,!0)}),t.on("gesturestart",function(i){u(i,t,e,e.gestureStartEvent),clearTimeout(l)}),t.on("gesturechange",function(i){i.scale=i.originalEvent.scale,u(i,t,e,e.gestureChangeEvent)}),t.on("gestureend",function(i){u(i,t,e,e.gestureEndEvent)})):(t.on("mousedown.chartgui touchstart.chartgui",c),t.on("touchstartoutside mousedownoutside",function(i){u(i,t,e,e.mouseDownOutsideEvent,!0)}),navigator.msPointerEnabled&&window.MSGesture&&(d=new MSGesture,p=!1,f=1,g=t.get(0),d.target=g,g.gesture=d,g.gesture.pointerType=null,g.pointers=[],d.pointerType=null,t.on("pointerdown",function(t){if(t.target===this)if(null===this.gesture.pointerType)this.gesture.target=g,this.gesture.addPointer(t.originalEvent.pointerId),this.gesture.pointerType=t.originalEvent.pointerType;else if(t.originalEvent.pointerType===this.gesture.pointerType)this.gesture.addPointer(t.originalEvent.pointerId);else{var e=new MSGesture;e.target=t.originalEvent.target,t.originalEvent.target.gesture=e,t.originalEvent.target.gesture.pointerType=t.originalEvent.pointerType,t.originalEvent.target.gesture.addPointer(t.originalEvent.pointerId)}}),t.on("MSGestureChange",function(i){var o=1*(i.originalEvent.scale-1)+1;i.scale=f*=o,p||1===i.originalEvent.scale||(p=!0,u(i,t,e,e.gestureStartEvent)),p&&u(i,t,e,e.gestureChangeEvent)}),t.on("MSGestureEnd",function(i){p=!1,f=1,u(i,t,e,e.gestureEndEvent)}))),m=function(o){t.off("mousemove.chartgui touchmove.chartgui"),u(o,t,e,e.mouseLeaveEvent),i&&o.preventDefault()},t.mouseleave(m),v=function(o){u(o,t,e,e.contextMenuEvent),i&&o.preventDefault()},t.contextMenu&&t.contextMenu(v)},e.setMouseEventHandler=f,g=function(t){var e=t.offset(),i=t.width(),o=t.height(),n=new a(e.left,e.top,i,o);return n},e.clientRect=g,m=function(t){var e=0,i=0;do e+=t.offsetLeft,i+=t.offsetTop,t=t.offsetParent;while(t);return{left:e,top:i}},e.offsetPosition=m,v=function(t){var e,i=$("<span class='tvcolorpicker-container'>").appendTo(t);return $("<div class='tvcolorpicker-transparency'>").appendTo(i),e=$("<input>").appendTo(i).tvcolorpicker(),e.on("change",function(){$(this).css("border-color",TradingView.generateLowBrightnessColor($(this).val()||TradingView.defaultColorPickersBorder))}),TVSettings&&(e.tvcolorpicker.setCustomColors=TVSettings.setJSON("pickerCustomColors",[]),e.bind("customcolorchange",function(t,e){TVSettings.setJSON("pickerCustomColors",e)})),i},e.addColorPicker=v,y=function(){var t=i(56).Combobox;return new t([{value:CanvasEx.LINESTYLE_SOLID,html:'<div class="linestyle solidline"/>'},{value:CanvasEx.LINESTYLE_DOTTED,html:'<div class="linestyle dottedline"/>'},{value:CanvasEx.LINESTYLE_DASHED,html:'<div class="linestyle dashedline"/>'}])},e.createLineStyleEditor=y,b=function(){return $('<select><option value="'+CanvasEx.MARKLOC_ABOVEBAR+'">'+$.t("Above Bar")+'</option><option value="'+CanvasEx.MARKLOC_BELOWBAR+'">'+$.t("Below Bar")+'</option><option value="'+CanvasEx.MARKLOC_TOP+'">'+$.t("Top")+'</option><option value="'+CanvasEx.MARKLOC_BOTTOM+'">'+$.t("Bottom")+'</option><option value="'+CanvasEx.MARKLOC_ABSOLUTE+'">'+$.t("Absolute")+"</option></select>")},e.createShapeLocationEditor=b,w=function(){var t,e,o,n=i(59).StudyPlotShapes,s="<select>",r=Object.keys(n.Data);for(t=0;t<r.length;++t)e=r[t],o=n.Data[e],s+='<option value="'+o.id+'">'+o.guiName+"</option>";return s+="</select>",$(s)},e.createShapeStyleEditor=w,S=function(){return $('<div class="linewidth-slider">').slider({min:1,max:4,step:1})},e.createLineWidthEditor=S,T=function(){var t=$("<input type='checkbox' class='visibility-switch'/>");return t},e.createVisibilityEditor=T,C=function(){var t=$("<input/>");return t.attr("type","text"),t},e.createTextEditor=C,x=function(){var t=i(56).Combobox;return new t([{value:CanvasEx.TEXTPOS_TOPLEFT,html:$.t("Top Left")},{value:CanvasEx.TEXTPOS_TOPCENTER,html:$.t("Top Center")},{value:CanvasEx.TEXTPOS_TOPRIGHT,html:$.t("Top Right")},{value:CanvasEx.TEXTPOS_MIDDLELEFT,html:$.t("Middle Left")},{value:CanvasEx.TEXTPOS_MIDDLECENTER,html:$.t("Middle Center")},{value:CanvasEx.TEXTPOS_MIDDLERIGHT,html:$.t("Middle Right")},{value:CanvasEx.TEXTPOS_BOTTOMLEFT,html:$.t("Bottom Left")},{value:CanvasEx.TEXTPOS_BOTTOMCENTER,html:$.t("Bottom Center")},{value:CanvasEx.TEXTPOS_BOTTOMRIGHT,html:$.t("Bottom Right")}])},e.createTextPosEditor=x,P=function(){var t=$("<select />");return $("<option value='"+CanvasEx.HHISTDIR_LEFTTORIGHT+"'>"+$.t("Left")+"</option>").appendTo(t),$("<option value='"+CanvasEx.HHISTDIR_RIGHTTOLEFT+"'>"+$.t("Right")+"</option>").appendTo(t),t},e.createHHistDirectionEditor=P,L=function(t){var e=$('<div class="transparency-slider"><div class="gradient"></div></div>').slider({min:0,max:100,step:1}),i=["-moz-linear-gradient(left, %COLOR 0%, transparent 100%)","-webkit-gradient(linear, left top, right top, color-stop(0%,%COLOR), color-stop(100%,transparent))","-webkit-linear-gradient(left, %COLOR 0%,transparent 100%)","-o-linear-gradient(left, %COLOR 0%,transparent 100%)","linear-gradient(to right, %COLOR 0%,transparent 100%)"];return e.updateColor=function(t){var o=e.find(".gradient");$.browser.msie?o.css("filter","progid:DXImageTransform.Microsoft.gradient(startColorstr='"+t+"', EndColor=0, GradientType=1)"):i.forEach(function(e){o.css("background-image",e.replace(/%COLOR/,t))})},t?(e.updateColor(t.val()||"black"),t.on("change",function(t){e.updateColor(t.target.value)})):e.updateColor("black"),e},e.createTransparencyEditor=L,k=function(){function t(t,e){this.mouseFlag=!1,this.accuracy=2,this.value=1,this.colorInput=t,this.$el=$('<div class="transparency-slider wide-slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">'),e&&this.$el.hide(),this.$gradient=$('<div class="gradient">').appendTo(this.$el),this.$roller=$('<a href="#" class="ui-slider-handle ui-state-default ui-corner-all without-shift-handle-left">').appendTo(this.$gradient)}return t.prototype.calculateRollerPosition=function(t){var e=t.pageX,i=this.$gradient.offset().left,o=e-i,n=this.$gradient.width();return o>n?100:o<0?0:~~(o/n*100)},t.prototype.toRgb=function(t){var e;return~t.indexOf("#")?t:(e=t.match(/[0-9.]+/g),e?"rgb("+e.slice(0,3).join(", ")+")":"rgb(127, 127, 127)")},t.prototype.setValue=function(t){return 1===t?void(this.value=t):void(this.value=t.toFixed(this.accuracy))},t.prototype.updateRoller=function(){this.$roller.css("left",100-100*this.value+"%")},t.prototype.rollerMoveHandler=function(t){if(this.mouseFlag){var e=this.calculateRollerPosition(t);this.setValue((100-e)/100),$(this).trigger("change",[this.val()]),this.$roller.css("left",e+"%")}t.preventDefault()},t.prototype.mouseupHandler=function(t){this.mouseFlag&&(this.mouseFlag=!1,$(this).trigger("afterChange",[this.val()]))},t.prototype.initEvents=function(){var t=function(t){return this.rollerMoveHandler(t)}.bind(this),e=function(i){return $(document).off("mousemove mouseup",t),$(document).off("mouseup",e),this.mouseupHandler(i)}.bind(this);this.$el.on("mousedown",function(i){this.mouseFlag=!0,$(document).on("mousemove mouseup",t),$(document).on("mouseup",e),i.preventDefault()}.bind(this)),this.colorInput.on("change",function(t){this.updateColor()}.bind(this))},t.prototype.removeEvents=function(){},t.prototype.updateColor=function(){var t=this.colorInput.val()||"black",e=this.toRgb(t),i=["-moz-linear-gradient(left, %COLOR 0%, transparent 100%)","-webkit-gradient(linear, left top, right top, color-stop(0%,%COLOR), color-stop(100%,transparent))","-webkit-linear-gradient(left, %COLOR 0%,transparent 100%)","-o-linear-gradient(left, %COLOR 0%,transparent 100%)","linear-gradient(to right, %COLOR 0%,transparent 100%)"];$.browser.msie?this.$gradient.css("filter","progid:DXImageTransform.Microsoft.gradient(startColorstr='"+e+"', EndColor=0, GradientType=1)"):i.forEach(function(t){this.$gradient.css("background-image",t.replace(/%COLOR/,e))}.bind(this))},t.prototype.val=function(t){return t&&(this.setValue(+t),this.updateRoller()),this.value},function(e,i){return new t(e,i)}}(),TradingView.getTransparencySlider=k,e.getTransparencySlider=k,E=function(){var t=$("<select />"),e=i(59).StudyConsts;return $("<option value='"+e.PLOT_LINE+"'>"+$.t("Line")+"</option>").appendTo(t),$("<option value='"+e.PLOT_LINE_WITH_BREAKS+"'>"+$.t("Line With Breaks")+"</option>").appendTo(t),$("<option value='"+e.PLOT_HISTOGRAM+"'>"+$.t("Histogram")+"</option>").appendTo(t),$("<option value='"+e.PLOT_CROSS+"'>"+$.t("Cross",{context:"chart_type"})+"</option>").appendTo(t),$("<option value='"+e.PLOT_AREA+"'>"+$.t("Area")+"</option>").appendTo(t),$("<option value='"+e.PLOT_AREA_WITH_BREAKS+"'>"+$.t("Area With Breaks")+"</option>").appendTo(t),$("<option value='"+e.PLOT_COLUMNS+"'>"+$.t("Columns")+"</option>").appendTo(t),$("<option value='"+e.PLOT_CIRCLES+"'>"+$.t("Circles")+"</option>").appendTo(t),t},e.createPlotEditor=E,I=function(){var t=$("<select>");return $("<option value='open'>"+$.t("Open")+"</option>").appendTo(t),$("<option value='high'>"+$.t("High")+"</option>").appendTo(t),$("<option value='low'>"+$.t("Low")+"</option>").appendTo(t),$("<option value='close'>"+$.t("Close")+"</option>").appendTo(t),$("<option value='hl2'>"+$.t("(H + L)/2")+"</option>").appendTo(t),$("<option value='hlc3'>"+$.t("(H + L + C)/3")+"</option>").appendTo(t),$("<option value='ohlc4'>"+$.t("(O + H + L + C)/4")+"</option>").appendTo(t),t},e.createPriceSourceEditor=I,A=function(t){$("<img>").attr("src",t)},e.cacheUrl=A,V=function(t){var e=TradingView.themeResourceFullPath(t);return"<img src='"+e+"' style='display:block'/>"},e.themeImageHTML=V,M=function(t,e,i,o,n){var s=o||250,r=$.easing[n]||$.easing.easeOutCubic,a=0,l=Date.now(),h=function(o){var n=o?o<1e12?Date.now():o:Date.now(),c=n-l,d=Math.min(t,r(null,c,0,t,s)),p=d-a;a=d,e(p),c>=s?"function"==typeof i&&i():requestAnimationFrame(h)};requestAnimationFrame(h)},e.animate=M,D=function(e,i,o){return this._options=o=o||{},this._name=e,this._container=$('<div class="favored-list-container" />'),o.addClass&&this._container.addClass(o.addClass),this._quick_container=$('<div class="quick" />').appendTo(this._container),this._submenu=$('<span class="submenu">'+(this._options.submenuHtml||"")+"<i></i></span>").appendTo(this._container),o.tooltip&&(this._submenu.attr("title",o.tooltip),o.addTooltipClass&&this._submenu.addClass(o.addTooltipClass)),this._activeButton=null,this._onChange=new t,this._onSelect=new t,this._onResize=new t,this._onOpen=new t,this._load(i),O(this._container,null,{direction:"down",svg:null==o.svg||o.svg,reverse:!0,addClass:"narrow favored-list"+(o.popupAddClass?" "+o.popupAddClass:""),event:"popup-menu",popupSpacing:o.popupSpacing}),this._submenu.on("click",this._openMenu.bind(this)),$.browser.msie||TVXWindowEvents.on(e+"-change",$.proxy(this,"_onChangeInAnotherTab")),this},e.FavoredList=D,D.prototype._openMenu=function(){this._submenu.parent().hasClass("active")||this._onOpen.fire(),this._submenu.trigger("popup-menu",[this._data])},D.prototype._onChangeInAnotherTab=function(){this.reload(this._data)},D.prototype.reload=function(t){this._quick_container.empty(),this._load(t)},D.prototype._convertQuicksToData=function(t){return this._quicks.forEach(function(e){var i=!1;t.forEach(function(t){if(t.id===e)return i=!0,!1}),i||t.push({id:e,title:e,favoriteButton:{icon:{},title:e,addClass:"apply-common-tooltip"}})}),t},D.prototype._load=function(t){var e=this;this._options.showJustDefaultQuicks?this._quicks=this._options.defaultFavorites||[]:this._options.notShowQuicks?this._quicks=[]:this._quicks=TVSettings.getJSON(this._name+".quicks",this._options.defaultFavorites||[],!0),this._list=[],o.enabled("charting_library_base")||(t=this._convertQuicksToData(t)),$.grep(t,function(t,e){return!t.separator}).forEach(function(t,o){var n,s,r={index:o,data:t,svg:t.svg&&$(t.svg).clone(),toQuickButton:$('<span class="to-quick" title=""></span>').append($(i(60)).attr({width:16,height:16})),toggleFavorite:function(t,i){var o=void 0!==t?t:!this.isFavorite();o?this.markFavorite():this.unmarkFavorite(),e._toggleFavorite(r,o,i)},markFavorite:function(){this.toQuickButton&&this.toQuickButton.attr("title",$.t("Remove from favorites")).addClass("quicked")},unmarkFavorite:function(){this.toQuickButton&&this.toQuickButton.attr("title",$.t("Add to favorites")).removeClass("quicked")},isFavorite:function(){return e._quicks.indexOf(t.id)>-1},active:function(){return this.data.active()},drop:function(){return this.data.drop()}};e._options.notShowQuicks&&$.extend(r,{toQuickButton:null}),r.data.toQuickButtonStyle&&r.toQuickButton&&r.toQuickButton.css(r.data.toQuickButtonStyle),e._list.push(r),n={action:function(){e._change(r)},buttons:[],active:e._options.notShowActive?function(){return!1}:function(){return e._active&&r===e._active}},e._options.notShowQuicks||n.buttons.push({el:r.toQuickButton,handler:function(t){r.toggleFavorite(),t.preventDefault(),t.stopPropagation()}}),"function"==typeof r.data.drop&&(s=e._options.notShowQuicks?' style="right: 7px;"':"",n.buttons.push({el:$('<span class="delete" title="'+$.t("Delete")+'"'+s+"></span>"),handler:function(t){r.drop(),t.stopPropagation()}})),$.extend(t,n),r.toggleFavorite(r.isFavorite(),!0)}),this._data=t,this._options.notShowActive||this._addActive(this._list[0]),this._onResize.fire()},D.prototype._toggleFavorite=function(t,e,i){if(!this._options.notShowQuicks||this._options.showJustDefaultQuicks){if(e){t.favorite_button=this._createButton(t,this._quick_container);var o=this._lastFavoriteButton(t);o?t.favorite_button.insertAfter(o.favorite_button):t.favorite_button.prependTo(this._quick_container)}else i||this._removeButton(t);i||(e?this._quicks.indexOf(t.data.id)===-1&&this._quicks.push(t.data.id):this._quicks.indexOf(t.data.id)>-1&&this._quicks.splice(this._quicks.indexOf(t.data.id),1),this._saveFavorite(),this._markActive(),this._onResize.fire())}},D.prototype._lastFavoriteButton=function(t){for(var e=t.index-1;e>=0;e--)if(this._list[e]&&this._list[e].favorite_button)return this._list[e]},D.prototype._saveFavorite=function(){this._options.notShowQuicks||(TVSettings.setJSON(this._name+".quicks",this._quicks),TVXWindowEvents.emit(this._name+"-change"))},D.prototype._createButton=function(t){var e=this,i=t.data.favoriteButton,o=$("<span></span>").data("item",t);return i.addClass&&o.addClass(i.addClass),i.text&&o.text(t.text),i.title&&o.prop("title",TradingView.clean(i.title,!0)),t.svg&&$(t.svg).clone().appendTo(o),o.on("click",function(i){e._change(t),0===e._quicks.length&&e._openMenu(),i.preventDefault()}),o},D.prototype._removeButton=function(t){t.favorite_button&&(t.favorite_button.remove(),t.favorite_button=null)},D.prototype._markActive=function(t){var e,i,o;this._options.notShowActive||(e=this,this._active&&(t=this._active,t.isFavorite()?(o=e._quick_container.find(".just_active"),this._btnToggleActiveView(o,!1)):(i=this._addActive(t),0!==this._quicks.length&&this._btnToggleActiveView(i,!0))),$.map(this._list,function(i){t!==i||0===e._quicks.length?e._btnToggleActiveView(i.favorite_button,!1):i.favorite_button&&e._btnToggleActiveView(t.favorite_button,!0)}),i&&i.hasClass("selected")?this._container.addClass("not-favored-active"):this._container.removeClass("not-favored-active"))},D.prototype._btnToggleActiveView=function(t,e){t&&(e?t.addClass("selected"):t.removeClass("selected"))},D.prototype._addActive=function(t){return this._quick_container.find(".just_active").remove(),this._createButton(t).appendTo(this._quick_container).addClass("just_active")},D.prototype._clearActive=function(){this._quick_container.find(".just_active").remove()},D.prototype._clearActive=function(){},D.prototype._setActive=function(t){return this._active!==t&&(this._active=t,this._markActive(),!0)},D.prototype._change=function(t){return this._onSelect.fire(t.data.id),!!this._setActive(t)&&void this._onChange.fire(t.data.id)},D.prototype.element=function(){return this._container},D.prototype._getItemByValue=function(t){for(var e in this._list)if(this._list[e].data.id===t)return this._list[e];throw Error("undefined value "+t+" in FavoredList")},D.prototype.onChange=function(){return this._onChange},D.prototype.onSelect=function(){return this._onSelect},D.prototype.onResize=function(){return this._onResize},D.prototype.onOpen=function(){return this._onOpen},D.prototype.setValue=function(t){var e=this._getItemByValue(t);this._setActive(e)},D.prototype.value=function(t){return this._active?this._active.data.value:void 0},D.prototype.removeById=function(t,e){var i=$.grep(this._data,function(e){return e.id!==t});this._list.forEach(function(e){e.data.id===t&&this._toggleFavorite(e,!1)},this),this.reload(i),"function"==typeof e&&e()},O=function(t,e,i){var o,n,s,r,a,l;t=$(t),i=i||{},o=(i.event||"click")+".popup-menu",i.hideEvent&&(n=i.hideEvent+".popup-menu"),s=function(){},r=s,a={},l=function(o,n,l){function h(e){var i=$(e.target).parents().andSelf();i.is(u)||i.is(t)||i.is(".charts-popup-tab-headers, .charts-popup-itemheader")||r()}function c(t){var e=$(t.target).parents().andSelf();e.is(".charts-popup-tab-headers, .charts-popup-itemheader")||i.notCloseOnButtons&&e.is(".icon-save, .icon-delete")||r()}function d(e,o,n){var s,r,a,l,h,c,p,_,f,g,m,v,y,b,w,S,T;if(e instanceof O.TabGroup){if(!e.tabs||!e.tabs.length)return;return 1!==e.tabs.length||e.tabs[0].title?(s=$('<div class="charts-popup-tab-group"></div>').appendTo(n),r=$('<div class="charts-popup-tab-headers"></div>').appendTo(s),a=null,void $.each(e.tabs||[],function(t,i){var o,n;i.items&&i.items.length&&(o=$('<div class="charts-popup-tab"></div>').hide().appendTo(s),$.each(i.items,function(){d(this,void 0,o)}),n=$('<span class="charts-popup-tab-header">').append($('<a href="javascript://" class="charts-popup-tab-header-label">').text(i.name)).appendTo(r),n.on("click",function(t){n.is(".active")||(r.find(".charts-popup-tab-header.active").removeClass("active"),n.addClass("active"),s.find(".charts-popup-tab").hide(),o.show(),t&&t.preventDefault(),"function"==typeof e.onChange&&e.onChange.call(e,i.name))}),a&&!i.active||(a=n,r.find(".charts-popup-tab-header.active").removeClass("active"),n.addClass("active"),s.find(".charts-popup-tab").hide(),o.show()))})):void $.each(e.tabs[0].items,function(){d(this,void 0,n)})}return e instanceof O.Group?(l=$('<div class="charts-popup-group"></div>').appendTo(n),e.title&&(h=$('<div class="charts-popup-itemheader"></div>').text(e.title).prepend($('<span class="charts-popup-itemheader-icon"></span>')),e.collapsible&&(l.addClass("charts-popup-group-collapsible"),l.toggleClass("collapsed",e.collapsed),h.on("click",function(){l.toggleClass("collapsed"),"function"==typeof e.onChange&&e.onChange(l.hasClass("collapsed")),u.height()===parseInt(u.css("max-height"))?u.addClass("popup-menu-scroll-y"):u.height()<parseInt(u.css("max-height"))&&u.removeClass("popup-menu-scroll-y")})),l.append(h)),void $.each(e.items,function(t){d(this,1,l)})):e instanceof O.Header?void n.append($('<div class="charts-popup-itemheader"></div>').text(e.title)):e.separator?(c=$('<span class="separator"></span>'),void n.append(c)):(c=$('<a class="item" href="#">'),"function"==typeof e.deleteAction&&"function"==typeof e.saveAction&&c.addClass("item-twobuttons"),e.url&&c.attr("href",e.url),e.target&&c.attr("target",e.target),o||c.addClass("first"),"function"==typeof e.active?e.active(e)&&c.addClass("active"):e.active&&c.addClass("active"),e.addClass&&c.addClass(e.addClass),e.addData&&c.data(e.addData),e.disabled&&c.addClass("disabled"),"function"==typeof e.action&&(p=e.action,_=function(t){var i=$(t.target).parents().andSelf();i.is(b)||i.is(S)||(p.apply(c,arguments),!e.url&&t&&"function"==typeof t.preventDefault&&t.preventDefault())},i.upAction?c.bind("mouseup",_):c.bind("click",_)),e.date?(f=$('<span class="title"></span>').appendTo(c),$('<span class="date"></span>').text(e.date||"").appendTo(c)):e.icon&&!i.svg?(g=$('<span class="icon"></span>').appendTo(c),g.css("background-image",e.icon.image||""),e.icon.offset&&g.css("background-position","string"==typeof e.icon.offset?e.icon.offset:e.icon.offset.x+"px "+e.icon.offset.y+"px"),f=$('<span class="title"></span>').appendTo(c)):i.svg===!0&&e.svg?(i.wrapIcon?c.append($('<span class="icon-wrap">').append(e.svg)):c.append(e.svg),f=$('<span class="title"></span>').appendTo(c)):e.iconClass?(c.append($('<span class="icon"></span>').addClass(e.iconClass)),f=$('<span class="title"></span>').appendTo(c)):f=$('<span class="title-expanded"></span>').appendTo(c),e.html?f.html(e.html):f.text(TradingView.clean(e.title,!0)||""),m=$('<span class="shortcut"></span>').appendTo(c),e.shortcut&&m.text(e.shortcut.keys),"function"==typeof e.deleteAction&&(v=e.deleteAction,y=e.deleteAction.title||$.t("Delete"),b=$('<span class="icon-delete">'),b.attr("title",y),b.on("click",function(t){v.apply(c,arguments),t.preventDefault()}),c.append(b)),"function"==typeof e.saveAction&&(w=e.saveAction,y=e.saveAction.title||$.t("Save"),S=$('<span class="icon-save">'),S.attr("title",y),S.on("click",function(t){w.apply(c,arguments),t.preventDefault()}),c.append(S)),e.buttons instanceof Array&&e.buttons.length&&e.buttons.forEach(function(t){t.el instanceof $||(t.el=$(t.el)),t.el.appendTo(c),t.handler&&t.el.on("click",function(e){t.handler.apply(c,arguments)})}),void 0!==e.counter&&(T=e.counterBlue?"blue":"",$('<span class="counter"></span>').text(e.counter+"").addClass(T).appendTo(c)),n.append(c),void t.data("popup-menu",n))}var p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V,M,D,B,R=n||e;if("function"==typeof R&&(R=R()),$(this).hasClass("open")||$(this).hasClass("active"))return o.preventDefault(),r(),void(p=a.scrollTop);switch(r=function(){a.scrollTop=u.scrollTop(),u.remove(),t.removeClass("active open"),t.data("popup-menu",null),$(document).off("click",c),$(document).off("mousedown",h),Modernizr.touch&&$(document).off("touchstart.chartgui",h),$(document).off("selectstart.popup-menu"),r=s,i.onRemove&&i.onRemove()},t.addClass("active open"),u=$('<div class="charts-popup-list">'),i.addClass&&u.addClass(i.addClass),_=u,i.listInner&&(_=$('<div class="list-inner">').appendTo(_)),i.listTable&&(_=$('<div class="list-table">').appendTo(_)),$.each(R,function(t){d(this,t,_)}),setTimeout(function(){$(document).on("click",c),$(document).on("mousedown",h),Modernizr.touch&&$(document).on("touchstart.chartgui",h)},0),i.upAction&&$(document).on("selectstart.popup-menu",function(){return!1}),u.appendTo(document.body),f=$(window).width(),g=Math.min($(window).height(),$("body").height()),m=t.outerWidth(),v=t.outerHeight(),y=t.offset(),p=$(window).scrollTop()||0,y.top-=p,y.top=Math.round(y.top),y.left=Math.round(y.left),b=u.outerWidth(),w=u.outerHeight(),S=void 0!==i.viewportSpacing?i.viewportSpacing:10,T=i.popupSpacing?~~i.popupSpacing:1,C=i.popupDrift?~~i.popupDrift:0,x=w-u.height(),P=i.direction?i.direction:"down",L=!!i.reverse,"down"===P&&(k=g-y.top-v-T-S-x,E=y.top-T-S-x,k<Math.max(w||0,100)&&E>k&&(P="up")),P){case"down":case"up":"down"===P?u.css("top",y.top+v+T+"px"):u.css("bottom",g-y.top+T+"px").css("top","auto"),L?u.css("left",Math.max(y.left+C+m-b,S)+"px").css("right","auto"):u.css("left",y.left+C+"px").css("right","auto");break;case"right":case"left":T=Math.max(T,4),"right"===P?u.css("left",Math.floor(y.left+m+T)+"px").css("right","auto"):u.css("left",Math.floor(Math.max(y.left-b-T,S))+"px").css("right","auto"),L?u.css("top",Math.floor(Math.max(y.top+C+v-w,S))+"px"):u.css("top",Math.floor(y.top+C)+"px")}for(u.show(),I=y.top,"up"===P||{left:1,right:1}[P]&&L?"up"!==P?I+=v:I-=v+T+x+S:I=g-I-v-2*T-x,u.height()>I&&u.addClass("popup-menu-scroll-y"),u.css("max-height",I+"px"),i.careRightBorder&&(A=f+$(window).scrollLeft(),parseInt(u.css("left"))+u.width()+S>A&&u.css("left",A-u.width()-S+"px").css("right","auto")),i.careBottomBorder&&parseInt(u.css("top"))+u.height()+S>g+p&&u.css("top",g-u.height()-S+p+"px"),M=t.parents().andSelf(),D=M.size();D--;)if("fixed"===M.eq(D).css("position")){V=M.eq(D);break}V&&(B=u.offset(),u.css({position:"fixed",left:B.left-$(document).scrollLeft(),right:"auto"})),u[0].scrollHeight>u.height()&&u.addClass("popup-with-scroll"),o&&o.preventDefault()},o&&t.bind(o,l),n&&t.bind(n,function(){r()}),i.runOpened&&l()},O.TabGroup=function t(e){return this instanceof t?(e=e||{},this.tabs=[],void("function"==typeof e.onChange&&(this.onChange=e.onChange))):new t(e)},O.TabGroup.prototype.appendTab=function(t,e,i){if(null==t?t="":t+="",e||(e=[]),i||(i={}),!Array.isArray(e))throw new TypeError("items must be an array");return this.tabs.push({name:t,items:e,active:!!i.active}),e},O.Header=function t(e){return this instanceof t?void(this.title=e):new t(e)},O.Group=function t(e){return this instanceof t?(e=e||{},this.items=[],this.title=null==e.title?"":e.title+"",this.collapsible=!!e.collapsible,this.collapsed=!!e.collapsed,void("function"==typeof e.onChange&&(this.onChange=e.onChange))):new t(e)},O.Group.prototype.push=function(){this.items.push.apply(this.items,arguments)},e.bindPopupMenu=O,B=function(t){t=$(t),t.unbind(".popup-menu"),t.removeData("popup-menu")},e.unbindPopupMenu=B,R=function(t,e,i,o,n,s){var r,a,l,h,c,d=e.title?e.title:$.t("Save New Chart Layout"),p=TVDialogs.createDialog(d),u=function(){var i,n,s=p.find('input[name="name"]'),r=s.val(),a=[];if(o)for(i=0;i<o.length;i++)"bool"===o[i].type&&(n=p.find('input[name="'+o[i].name+'"]'),a.push(n[0].checked));return r?(t(r,a),TVDialogs.destroy(d)):(TVDialogs.showError(e.error||$.t("Please enter chart name"),TVDialogs.get(d)),s.focus()),!1};if(i=i||"",s=s||{},s.inputValue=s.inputValue?s.inputValue:"",p.css("width","400px"),p.find("._tv-dialog-content").html('<div class="main"><form><p>'+(e.label?$.t(e.label):$.t("Chart name"))+':</p><p class="_tv-dialogs-name"><input type="text" name="name" maxlength="'+i+'"/></p><p class="_tv-dialog-right"></p></form></div>').find("input").val(s.inputValue),s.inputSelectEnable&&"boolean"==typeof s.inputSelectEnable&&p.find('input[name="name"]').select(),o)for(r=p.find("._tv-dialog-right"),a=0;a<o.length;a++)"bool"===o[a].type&&(l=$('<p class="_tv-dialogs-name"></p>'),h=o[a].hint?$('<div class="_tv-dialogs-label-hint"></div>').blueTooltip($.t(o[a].hint),"bottom"):null,c=$('<label><input type="checkbox" style="vertical-align:top;margin-top:2px" name="'+o[a].name+'"/> '+$.t(o[a].title)+"</label>"),l.append(c,h).insertBefore(r));p.find("form").submit(u),$('<a class="_tv-button wide ok">'+$.t("OK")+"</a>").click(u).css({"margin-right":"5px"}).appendTo(p.find("._tv-dialog-right")),$('<a class="_tv-button wide cancel">'+$.t("Cancel")+"</a>").click(function(){TVDialogs.destroy(d)}).appendTo(p.find("._tv-dialog-right")),"function"==typeof n&&n(p),TVDialogs.positionDialog(p,{left:$(window).width()/2-p.width()/2,top:$(window).height()/2-p.height()/2}),TVDialogs.applyHandlers(p),p.find('input[name="name"]').focus()},e.showChartNameDialog=R}).call(e,i(28),i(1))},function(t,e,i){"use strict";function o(t){return this.jqObj=null,this.data=t,this.init(),this._prepareValue(),this._prepareCallback(),this._prepareChildren(),this._applyAttributes(),this.jqObj}function n(t,e){this.value=t,this.html=e||"",this.jqItem=this._render()}function s(t){this._value=null,this.items=[],this.width=0,this.jqWrapper=null,this.jqSwitcher=null,this.jqTitle=null,this.jqIcon=null,this.jqItems=null,this.callback=null,this._init(),this.addItems(t),this.joinParts()}var r=i(57);o.selectOptions={type:"option",value:null,html:null},o.optionsData={radiogroup:{type:"radio",name:null,value:null,label:null},select:o.selectOptions,"select-one":o.selectOptions,"select-multiple":o.selectOptions},o.customTypes=["radiogroup","fontpicker","colorpicker","combobox"],o.prototype._tagIsInput=function(t){return jQuery.inArray(this.data.type,["text","radio","checkbox","hidden","reset","image","file"])!==-1},o.prototype.init=function(){this._tagIsInput()?this.jqObj=r.create("input",{name:this.data.name,type:this.data.type}):this.jqObj=r.create(this.data.type,{name:this.data.name})},o.prototype._eventIsKeyUp=function(){return jQuery.inArray(this.data.type,["text","textarea"])!==-1},o.prototype._eventIsClick=function(){return jQuery.inArray(this.data.type,["checkbox","radio","option"])!==-1},o.prototype._eventIsChange=function(){return jQuery.inArray(this.data.type,["select","select-one","select-multiple","radiogroup"])!==-1},o.prototype._prepareCallback=function(){this.data.callback&&(this._eventIsKeyUp()?this.jqObj.keyup(this.data.callback):this._eventIsClick()?this.jqObj.click(this.data.callback):this._eventIsChange()&&this.jqObj.bind("change",this.data.callback),delete this.data.callback)},o.prototype._childTag=function(){return{select:"option","select-one":"option","select-multiple":"option",radiogroup:"radio"}[this.data.type]},o.prototype._inheritedProperties=function(){var t={type:this._childTag()};return"radiogroup"===this.data.type&&(t.name=this.data.name),t},o.prototype._extendChildProps=function(t){var e=jQuery.extend(this._inheritedProperties(),t);return this.data.value===t.value&&(e.selected=!0),e},o.prototype._prepareChildren=function(){if(this.data.options){var t=this;jQuery.each(this.data.options,function(e,i){t.jqObj.append(new o(t._extendChildProps(i)))})}},o.prototype.isCustom=function(){return jQuery.inArray(this.data.type,this.customTypes)!==-1},o.prototype._isStoringValue=function(){return jQuery.inArray(this.data.type,["text","textarea","option","radio","checkbox"])!==-1},o.prototype._htmlAsValue=function(){return"textarea"===this.data.type},o.prototype._valAsValue=function(){return jQuery.inArray(this.data.type,["text","checkbox","radio","option","select","select-one","select-multiple"])},o.prototype._getControlValue=function(){return{checkbox:1}[this.data.type]||this.data.value},o.prototype._setControlValue=function(){this._valAsValue()?this.jqObj.val(this._getControlValue()):this._htmlAsValue()&&this.jqObj.html(this.data.value)},o.prototype._getCheckedAttr=function(){return{option:"selected",
radio:"checked",checkbox:"checked"}[this.data.type]},o.prototype._setChecked=function(){this.data.selected&&this.jqObj.attr(this._getCheckedAttr(),!0)},o.prototype._setValue=function(){this._setControlValue(),o.isCheckable(this.data.type)&&this._setChecked()},o.prototype._prepareValue=function(){this._isStoringValue()&&this._setValue()},o.prototype._applyAttributes=function(){this.jqObj.attr(r.cleanAttributes(this.data))},o.value=function(t){return o.controlCheckable(t)?t.checked:t.value},o.isCheckable=function(t){return jQuery.inArray(t,["checkbox","radio","option"])!==-1},o.controlType=function(t){var e,i;return"string"==typeof t?t:(e=jQuery(t),i=null,e.attr("type")&&(i=e.attr("type"),jQuery.inArray(i,["textarea","text","select","select-one","select-multiple","submit"]))?i:e.attr("tagName"))},o.controlCheckable=function(t){return o.isCheckable(o.controlType(t))},o.controlToggleChecked=function(t,e){var o=i(58);return o.setAttr(t,"checked",e)},o.controlSetValue=function(t,e){if(o.controlCheckable(t))return o.controlToggleChecked(t,e);var n=i(58);return n.setAttr(t,"value",e)},o.currentOption=function(t){return t.options[t.selectedIndex]},o.currentOptionInnerHTML=function(t){var e=o.currentOption(t);return e.innerHTML},n.prototype.eq=function(t){return this.value===t},n.prototype.width=function(t){return this.jqItem.width()},n.prototype._render=function(t){var e=$("<span/>").append($(this.html).clone());return $('<div class="item"></div>').append(e)},n.prototype.render=function(t){return this.jqItem},n.prototype.select=function(t){t?this.jqItem.addClass("selected"):this.jqItem.removeClass("selected")},n.prototype.selectAndReturnIfValueMatch=function(t){return this.eq(t)?(this.select(!0),this):(this.select(!1),null)},s.prototype._init=function(){this._initWrapper(),this._initSwitcher(),this._initOptions()},s.prototype._initTitle=function(){this.jqTitle=$('<span class="title" />')},s.prototype._initIcon=function(){this.jqIcon=$('<span class="icon" />')},s.prototype._initOptions=function(){var t=i(58);this.jqItems=t.createPopup({class:"items"})},s.prototype._initWrapper=function(){this.jqWrapper=$('<div class="custom-select" />'),this.jqWrapper.data({disable:this.disable.bind(this),enable:this.enable.bind(this)})},s.prototype._initSwitcher=function(){var t=this;this._initTitle(),this._initIcon(),this.jqSwitcher=$('<div class="switcher" />'),this.jqSwitcher.append(this.jqTitle),this.jqSwitcher.append($(this.jqIcon).clone()),this.opened=!1,this.jqSwitcher.click(function(e){t.toggleItems()}),t=this,$(document).click(function(e){$(e.target).closest(t.jqSwitcher).length||(!t.jqSwitcher.is(e.target)&&0===t.jqSwitcher.has(e.target).length||!t.jqItems.is(e.target)&&0===!t.jqItems.has(e.target).length)&&t.opened&&(t.jqItems.hide(),t.opened=!1,t.jqSwitcher.removeClass("open"),e.stopPropagation())})},s.prototype.toggleItems=function(){this.disabled()||(this.opened?(this.jqItems.hide(),this.jqSwitcher.removeClass("open"),this.opened=!1):(this.jqItems.show(),this.jqSwitcher.addClass("open"),this.opened=!0))},s.prototype.setWidth=function(){this.jqWrapper.width(this.width)},s.prototype.joinParts=function(){this.jqWrapper.append(this.jqSwitcher),this.jqWrapper.append(this.jqItems),this.jqWrapper.selectable(!1)},s.prototype.render=function(){return this.jqWrapper},s.prototype.selectItemByValue=function(t){var e=null;return $(this.items).each(function(i,o){var n=o.selectAndReturnIfValueMatch(t);n&&(e=n)}),e},s.prototype.setValue=function(t){if(this._value!==t){var e=this.selectItemByValue(t);this._value=t,this.jqTitle.html(e.html),this.change()}},s.prototype.change=function(t){return t?void(this.callback=t):void(this.callback&&this.callback.call(this))},s.prototype.value=function(){return this._value},s.prototype.val=function(t){return void 0!==t?void this.setValue(t):this.value()},s.prototype.addItems=function(t){var e=this;$(t).each(function(t,i){e.addItem(i.value,i.html)})},s.prototype.addItem=function(t,e){var i,o=this,s=new n(t,e);this.items.push(s),i=s.render(),i.click(function(){o.setValue(t),o.toggleItems()}),this.jqItems.append(i),null===this.value()&&this.setValue(t)},s.prototype.disable=function(){this._disabled=!0},s.prototype.enable=function(){this._disabled=!1},s.prototype.disabled=function(){return this._disabled},e.Input=o,e.Combobox=s},function(t,e){"use strict";var i={};i.renderAttributes=function(t){var e,i="";for(e in t)t[e]&&(i+=" "+e+'="'+t[e]+'"');return i},i.create=function(t,e){var i=$(document.createElement(t));return e&&(e.html&&(i.html(e.html),delete e.html),i.attr(e)),i},i.validAttributes=["abbr","accept-charset","accept","accesskey","action","align","alink","alt","archive","axis","background","bgcolor","border","cellpadding","cellspacing","char","charoff","charset","checked","cite","class","classid","clear","code","codebase","codetype","color","cols","colspan","compact","content","coords","data","datetime","declare","defer","dir","disabled","enctype","face","for","frame","frameborder","headers","height","href","hreflang","hspace","http-equiv","id","ismap","label","lang","language","link","longdesc","marginheight","marginwidth","maxlength","media","method","multiple","name","nohref","noresize","noshade","nowrap","object","onblur","onchange","onclick","ondblclick","onfocus","onkeydown","onkeypress","onkeyup","onload","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onreset","onselect","onsubmit","onunload","profile","prompt","readonly","rel","rev","rows","rowspan","rules","scheme","scope","scrolling","selected","shape","size","span","src","standby","start","style","summary","tabindex","target","text","title","type","usemap","valign","value","valuetype","version","vlink","vspace","width"],i.validAttribute=function(t){return jQuery.inArray(t,i.validAttributes)!==-1},i.cleanAttributes=function(t){return jQuery.each(t,function(e,o){i.validAttribute(e)||delete t[e]}),t},t.exports=i},function(t,e,i){"use strict";var o=i(57),n=i(55).setMouseEventHandler,s={};s.createLabel=function(t,e,i){return o.create("label",$.extend(i,{html:e,for:t}))},s.unbindContextMenu=function(t){t.contextMenu(function(t){return!1})},s.offsetX=function(t,e){return t.width()+e.pageX},s.offsetY=function(t,e){return t.height()+e.pageY},s.checkObjIsOutOfWindowX=function(t,e){var i,o=$(window).width()-s.offsetX(t,e);return o<0?(i=e.pageX+o,i>0?i:0):e.pageX},s.checkObjIsOutOfWindowY=function(t,e){var i,o=$(window).height()-s.offsetY(t,e);return o<0?(i=e.pageY+o,i>0?i:0):e.pageY},s.checkObjIsOutOfWindow=function(t,e){return{left:s.checkObjIsOutOfWindowX(t,e),top:s.checkObjIsOutOfWindowY(t,e)}},s.setAttr=function(t,e,i){return t.attr?t.attr(e,i):t[e]=i,t},s.removeAttr=function(t,e){return t.removeAttr?t.removeAttr(e):t.removeAttribute(e),t},s.notNull=function(t){return $.inArray(t,[null,void 0,"false","null","undefined",0])===-1},s.hideControl=function(t){return t.css({position:"absolute",top:-1e3,left:-1e3})},s.createPopup=function(t,e,i){var o=new s.Popup(t,e,i);return o.render()},s.Popup=function(t,e,i){if(void 0!==t.selector?this.jqDiv=t:t.nodeType?this.jqDiv=$(t):this.jqDiv=o.create("div",t),i){var s=this;$.each(i,function(t,e){s[t]=e})}n(this.jqDiv,this),this._callback=e},s.Popup.prototype.render=function(){return this.jqDiv},s.Popup.prototype.show=function(){this.jqDiv.show()},s.Popup.prototype.hide=function(){this.jqDiv.hide()},s.Popup.prototype.setVisible=function(t){t?this.show():this.hide()},s.Popup.prototype.isVisible=function(){return this.jqDiv.is(":visible")},s.Popup.prototype.contextMenuEvent=function(t){return!1},s.Popup.prototype.mouseDownOutsideEvent=function(t){if(this.isVisible()){if(this._callback&&!this._callback())return;this.hide()}},t.exports=s},function(t,e,i){var o={PLOT_TYPE_LINE:"line",PLOT_TYPE_COLORER:"colorer",PLOT_TYPE_BAR_COLORER:"bar_colorer",PLOT_TYPE_BG_COLORER:"bg_colorer",PLOT_TYPE_TEXT_COLORER:"text_colorer",PLOT_TYPE_OHLC_COLORER:"ohlc_colorer",PLOT_TYPE_SHAPES:"shapes",PLOT_TYPE_CHARS:"chars",PLOT_TYPE_ARROWS:"arrows",PLOT_TYPE_DATAOFFSET:"dataoffset",PLOT_TYPE_OHLC_OPEN:"ohlc_open",PLOT_TYPE_OHLC_HIGH:"ohlc_high",PLOT_TYPE_OHLC_LOW:"ohlc_low",PLOT_TYPE_OHLC_CLOSE:"ohlc_close",OHLC_TYPE_BARS:"ohlc_bars",OHLC_TYPE_CANDLES:"ohlc_candles",PLOT_LINE:0,PLOT_HISTOGRAM:1,PLOT_CROSS:3,PLOT_AREA:4,PLOT_COLUMNS:5,PLOT_CIRCLES:6,PLOT_LINE_WITH_BREAKS:7,PLOT_AREA_WITH_BREAKS:8,SCALE_RIGHT:0,SCALE_LEFT:1,SCALE_NONE:2},n={};n.Data={},n.registerPlotShape=function(t,e,i,o){if(t in n.Data)throw Error("Plot shape "+t+" already registered!");n.Data[t]={id:t,pineName:e,guiName:i,paneRendererClass:o}},n.SHAPE_CROSS="shape_cross",n.SHAPE_XCROSS="shape_xcross",n.SHAPE_CIRCLE="shape_circle",n.SHAPE_TRIANGLE_UP="shape_triangle_up",n.SHAPE_TRIANGLE_DOWN="shape_triangle_down",n.SHAPE_FLAG="shape_flag",n.SHAPE_ARROW_UP="shape_arrow_up",n.SHAPE_ARROW_DOWN="shape_arrow_down",n.SHAPE_SQUARE="shape_square",n.SHAPE_DIAMOND="shape_diamond",n.SHAPE_LABEL_UP="shape_label_up",n.SHAPE_LABEL_DOWN="shape_label_down",n.registerPlotShape(n.SHAPE_CROSS,"shape.cross","Cross","PaneRendererCrossShape"),n.registerPlotShape(n.SHAPE_XCROSS,"shape.xcross","X Cross","PaneRendererXCross"),n.registerPlotShape(n.SHAPE_CIRCLE,"shape.circle","Circle","PaneRendererCircleShape"),n.registerPlotShape(n.SHAPE_TRIANGLE_UP,"shape.triangleup","Triangle Up","PaneRendererTriangleApexUp"),n.registerPlotShape(n.SHAPE_TRIANGLE_DOWN,"shape.triangledown","Triangle Down","PaneRendererTriangleApexDown"),n.registerPlotShape(n.SHAPE_FLAG,"shape.flag","Flag","PaneRendererFlagShape"),n.registerPlotShape(n.SHAPE_ARROW_UP,"shape.arrowup","Arrow Up","PaneRendererArrowUp"),n.registerPlotShape(n.SHAPE_ARROW_DOWN,"shape.arrowdown","Arrow Down","PaneRendererArrowDown"),n.registerPlotShape(n.SHAPE_SQUARE,"shape.square","Square","PaneRendererSquare"),n.registerPlotShape(n.SHAPE_DIAMOND,"shape.diamond","Diamond","PaneRendererDiamond"),n.registerPlotShape(n.SHAPE_LABEL_UP,"shape.labelup","Label Up","PaneRendererLabelUp"),n.registerPlotShape(n.SHAPE_LABEL_DOWN,"shape.labeldown","Label Down","PaneRendererLabelDown"),TradingView.StudyConsts=o,TradingView.StudyPlotShapes=n,e.StudyConsts=o,e.StudyPlotShapes=n},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 582.90004 554.7" width="582.9" height="554.7" enable-background="new 0 0 595.3 841.9"><path d="M438.2 353.7l32.1 201-176.9-96.5-180.8 96.5 32.1-201L0 209l201-28.1L293.4 0l88.5 180.9 201 28.1z"/></svg>'},function(t,e,i){(function(t,i,o){"use strict";function n(e){this._chartWidgetCollection=e,this._chartAboutToBeSavedDelegate=new t,this._chartSavedDelegate=new t}function s(t,e,i,n){var s,r;n=n||{},s={wl:n.wl,images:JSON.stringify(t.images()),previews:n.previews},(n.cme||"cme"===t.activeChartWidget.value().widgetCustomer())&&(s.cme=!0),s.timezone=t.activeChartWidget.value()._properties.timezone.value(),window.urlParams&&window.urlParams.locale&&(s.language=urlParams.locale),r=o.enabled("charting_library_base")?n.snapshotUrl||"https://www.tradingview.com/snapshot/":"/snapshot/",$.post(r,s,function(t){t?e(t):i()}).fail(function(){i()})}n.prototype.chartAboutToBeSaved=function(){return this._chartAboutToBeSavedDelegate},n.prototype.chartSaved=function(){return this._chartSavedDelegate},n.prototype.whenReadyToSave=function(t){var e,i,o=this._chartWidgetCollection,n=o.activeChartWidget.value(),s=n.model().mainSeries();s.symbolInfo()&&!s.hasDelayedSymbolIntervalChange()?t():(e=null,i=null,e=function(){s.onSymbolError().unsubscribe(null,i,!0),t()},i=function(){s.onSymbolResolved().unsubscribe(null,e,!0)},s.onSymbolResolved().subscribe(null,e,!0),s.onSymbolError().subscribe(null,i,!0))},n.prototype.saveToJSON=function(){return this._fillSavingInfo(!1,!0)},n.prototype._fillAsyncInfo=function(t,e,i){function o(e){t.content=JSON.stringify($.extend(!0,s,e)),n.resolve(t)}var n,s=JSON.parse(t.content),r=this._chartWidgetCollection;return e||(i=!0),n=$.Deferred(),i?r.asyncState(!!e).then(o):r.activeChartWidget.value().asyncState(!!e).then(o),n.promise()},n.prototype._fillSavingInfo=function(t,e,i){var o,n,s,r,a,l,h,c,d,p,u,_,f,g;if(t||(e=!0),o={publish_request_id:Math.random().toString(36).substring(2)},n=this._chartWidgetCollection,s=n.activeChartWidget.value(),r=n.metaInfo,a=s.model().mainSeries(),l=a.properties(),h=a.symbolInfo(),!a||!r||!h)throw new ReferenceError("Missed required data");for(r.id.value()&&(o.id=r.id.value()),o.name=r.name.value()||"",o.description=r.description.value()||"",o.resolution=a.properties().interval.value(),o.symbol_type=h.type||"",o.exchange=h.exchange||"",o.listed_exchange=h.listed_exchange||"",a.isSpread()?(c=h.legs[0],d=h.base_name[0],d=d.split(":")[1],o.symbol=c,o.short_name=d,o.expression=h.full_name):(p=h.ticker||l.symbol.value(),u=l.shortName.value(),o.symbol=p,o.short_name=u),_=[],f=0,g=h.legs.length;f<g;f++)_.push({symbol:h.legs[f],pro_symbol:h.base_name[f]});return o.legs=JSON.stringify(_),e?o.content=JSON.stringify(n.state(!!t,i)):o.content=JSON.stringify(s.state(!!t,i)),t&&(o.image=JSON.stringify(n.images({onlyActiveChart:!e}))),o.is_realtime=t?"0":"1",o},n.prototype.publishChart=function(t){},n.prototype.onPublish=function(t,e){function o(o){var n,s,r,l,h,c,d;a.publishInProgress=!1,n=o.responseText,"ok:"===n.substr(0,3)?(e.savePrivacySetting&&(s=!t.is_public,TVSettings.setValue("publishchart.private",s)),r=n.substr(3),l=JSON.parse(r),a._chartWidgetCollection.metaInfo.id.value()||a._chartWidgetCollection.metaInfo.id.setValue(l.id),e.closeForm&&e.closeForm(),a._lastPublishUrl=l.publishUrl,a.hWnd&&(h=l.publishUrl,e.ideaUrl&&(h=i.render(e.ideaUrl,{idea:l.idea})),a.hWnd.location=h)):(e.showError&&(n=TradingView.strip_tags(n),(413===o.status||/^[\d\s]*request.+large/i.test(n.trim()))&&(c="support@tradingview.com",n=$.t("This chart layout has a lot of objects and can't be published! Please report to {0} for further&nbsp;details.").format('<a href="mailto:'+c+'">'+c+"</a>"),d={html:!0}),e.showError(n||$.t("Error occured while publishing"),d)),a.hWnd&&(a.hWnd.close(),a.hWnd=null))}var n,s,r,a=this;a.publishInProgress||(n=a._fillSavingInfo(!0,e&&e.publishAllLayout,!0),a._fillAsyncInfo(n,!0,e&&e.publishAllLayout).then(function(e){$.ajax({url:"/publishchart/",type:"post",dataType:"text",data:$.extend({},e,t),complete:o})}),a.publishInProgress=!0,e.onWidget&&!e.ideaUrl||""!==t.name&&""!==t.description&&t.description.length<=4e3&&t.name.length<=64&&($.cookie("publish_request_id",n.publish_request_id,{path:"/"}),s="/loading/",e.ideaUrl&&(r=TradingView.createUrlParams({ideaUrl:e.ideaUrl}),s="/loading?"+r),a.hWnd=window.open(s,"_blank")))},n.prototype.saveChartSilently=function(t,e,i,o){var n=this._chartWidgetCollection.metaInfo,s=this._fillSavingInfo(e);return o=o||{},o.chartName&&(s.name=o.chartName),s.name?($(window).on("beforeunload.savechart",function(){return $.t("Your chart is being saved, please wait a moment before you leave this page.")}),this._chartAboutToBeSavedDelegate.fire(),TradingView.saveChart(s,n,function(){this._chartWidgetCollection.metaInfo.name.setValue(s.name),this._chartSavedDelegate.fire(!0),t&&t()}.bind(this),function(){this._chartSavedDelegate.fire(!1),i&&i()}.bind(this),o),void $(window).off("beforeunload.savechart")):void console.warn("Saving chart with empty name is not allowed")},e.ChartSaver=n,e.takeSnapshot=s}).call(e,i(28),i(29),i(1))},function(t,e,i){(function(t){"use strict";function i(t,e,i,o){var n=this;this._options=o||{},this._readonly=!!this._options.readonly,this._container=t,this._chart=e,this._panes=i,this._pane_header_height=34,this._hidden_panes_count=0,this.prepareLayout(),setInterval(function(){n.paint()},66)}function o(e,i,o){var n,s,r,a,l,h,c=this;return this._options=$.extend({},this._defaultOptions,o||{}),this._$wrapper=e,this._$content=i,this._scroll_speed=40,this._shadow_offset=10,this._header_height=this._options.headerHeight,this._scroll_margin_top=this._options.scrollMarginTop,this.scrolled=new t,this.scrolltoend=new t,this.scrolltostart=new t,this.visibilityCallbacks=[],n=navigator.platform.toLowerCase(),s=navigator.userAgent.toLowerCase(),r=s.indexOf("firefox")>-1,a=n.indexOf("android")>-1||s.indexOf("android")>-1,this._touch=Modernizr.touch||navigator.msMaxTouchPoints||r&&a,this._touch?(this._$content.css("position","relative"),void this._$wrapper.css({"overflow-y":"scroll","-webkit-overflow-scrolling":"touch","-ms-overflow-style":"-ms-autohiding-scrollbar"}).scroll(this._onScroll.bind(this))):(this._$wrapper.css("overflow","hidden"),this._$wrapper.mouseenter(function(){c._bottomFixed||c._dragging||(c._options.alwaysVisible||c._$scrollBar.addClass("active"),c._onScroll())}).mouseleave(function(){c._bottomFixed||c._dragging||(c._options.alwaysVisible||c._$scrollBar.removeClass("active"),c._onScroll())}).mousewheel(function(t,e){if(!t.isDefaultPrevented())return c.scroll(e)}),this._options.showTopShadow!==!1&&(this._$shadowTop=$('<div class="sb-inner-shadow top">').appendTo(this._$wrapper),this._$shadowTop.addClass("js-hidden")),this._options.showBottomShadow!==!1&&(this._$shadowBottom=$('<div class="sb-inner-shadow">').appendTo(this._$wrapper)),this._$shadowTop&&this._header_height&&this._$shadowTop.css("top",this._header_height-this._shadow_offset),l=this._options.additionalClass?" "+this._options.additionalClass:"",h=this._options.alwaysVisible?" active-always":"",this._$scrollBarWrapper=$('<div class="sb-scrollbar-wrap">').appendTo(this._$wrapper),this._$scrollBar=$('<div class="sb-scrollbar sb-scrollbar-body'+l+h+'"></div>').appendTo(this._$scrollBarWrapper),void this._onScroll())}i.prototype.prepareLayout=function(){var t=this;this._widget=$('<div class="chart-sidebar">').appendTo(this._container),this._widget.toggleClass("js-hidden",void 0!==this._options.hidden?this._options.hidden:TVSettings.getBool("sidebar.hidden",!1)),this._separator=$('<div class="separator"><div class="separator-bar"><div class="separator-icon"></div></div></div>').appendTo(this._widget),this._separator.click(function(){t._widget.toggleClass("js-hidden"),t._readonly||TVSettings.setValue("sidebar.hidden",t._widget.is(".hidden")),$(window).resize()}),this._panes.forEach(function(e,i){void 0===e.ratio&&(e.ratio=TVSettings.getFloat("sidebar.pane."+e.id+".ratio",1)),void 0===e.state&&(e.state=TVSettings.getBool("sidebar.pane."+e.id+".state",!0),this._hidden_panes_count+=e.state?0:1),e.$pane=$('<div class="chart-sidebar-pane">').addClass("tv-"+e.id).appendTo(this._widget),e.$header=$('<div class="header"><span class="icon"></span><span class="title">'+e.title+"</span></div>").click(function(){e.state=!e.state,t._readonly||TVSettings.setValue("sidebar.pane."+e.id+".state",e.state),t._hidden_panes_count+=e.state?-1:1,t.resize()}).appendTo(e.$pane),e.index=i,e.$container=$('<div class="container">').appendTo(e.$pane),e.widgetObject=new e.widget(e.$container,this._chart,e.options),i<this._panes.length-1&&$('<div class="chart-sidebar-vseparator"><div class="handle"></div></div>').on("mousedown touchstart",function(e){var i=$(this),o=i.prevAll(".chart-sidebar-pane:not(.minimized)").first(),n=i.nextAll(".chart-sidebar-pane:not(.minimized)").first();return!(!o.length||!n.length)&&(t._drag_start=e.pageY||e.originalEvent.pageY||e.originalEvent.touches&&e.originalEvent.touches[0].pageY||0,t._drag_prev_h=o.height(),t._drag_next_h=n.height(),$(window).on("mousemove.sidebarDrag touchmove.sidebarDrag",function(e){var i=(e.pageY||e.originalEvent.pageY||e.originalEvent.touches&&e.originalEvent.touches[0].pageY||0)-t._drag_start;o.height(t._drag_prev_h+i).data("paneObj").widgetObject.resize(),n.height(t._drag_next_h-i).data("paneObj").widgetObject.resize()}),$(window).one("mouseup touchend",function(e){var o,n,s,r,a,l,h;$(window).unbind("mousemove.sidebarDrag touchmove.sidebarDrag"),o=i.prevAll(".chart-sidebar-pane:not(.minimized)").first(),n=i.nextAll(".chart-sidebar-pane:not(.minimized)").first(),s=t._widget.height()-t._hidden_panes_count*t._pane_header_height-(t._panes.length-1),r=s/(t._panes.length-t._hidden_panes_count),a=(o.height()+t._pane_header_height)/r,l=o.data("paneObj"),l.ratio=a,h=(n.height()+t._pane_header_height)/r,l=n.data("paneObj"),l.ratio=h,t.resize()}),void e.preventDefault())}).appendTo(this._widget),e.$pane.data("paneObj",e)},this),$(window).resize(function(){t.resize()}),this.resize()},i.prototype.normalizeRatios=function(){var t=this,e=this._panes.length-this._hidden_panes_count,i=0,o=0;this._panes.forEach(function(t){t.state&&(i+=t.ratio)}),o=(i-e)/e,this._panes.forEach(function(e){e.state&&(e.ratio-=o,t._readonly||TVSettings.setValue("sidebar.pane."+e.id+".ratio",e.ratio.toFixed(2)))})},i.prototype.resize=function(){var t,e;this.normalizeRatios(),t=this._widget.height()-this._hidden_panes_count*this._pane_header_height-(this._panes.length-1),e=t/(this._panes.length-this._hidden_panes_count),this._panes.forEach(function(t,i){t.state?t.$pane.height(e*t.ratio-this._pane_header_height):t.$pane.height(0),t.widgetObject.resize(!0),t.$pane.toggleClass("minimized",!t.state),t.$container.trigger("paneStateChange",[t.state])},this)},i.prototype.getPaneIndexById=function(t){for(var e=0;e<this._panes.length;e++)if(this._panes[e].id===t)return e;return null},i.prototype.getPaneById=function(t){var e=this.getPaneIndexById(t);return null===e?null:this._panes[e]},i.prototype.highlightPane=function(t,e,i){this._panes[t].$header.highlight(e,i)},i.prototype.highlightWidget=function(t,e,i){this.highlightPane(this.getPaneIndexById(t),e,i)},i.prototype.paint=function(){this._panes.forEach(function(t,e){t.widgetObject.paint&&t.widgetObject.paint()},this)},i.prototype.setPaneState=function(t,e,i){if(t){t.state=!!e;var o=i&&i.doNotSave;this._readonly||o||TVSettings.setValue("sidebar.pane."+t.id+".state",t.state),this._hidden_panes_count=this._panes.filter(function(t){return!t.state}).length,this.resize()}},o.prototype._defaultOptions={headerHeight:0,additionalClass:"",alwaysVisible:!1,showBottomShadow:!0,scrollMarginTop:1},o.prototype.initDraggable=function(){if(this._dragInitialized)return this;var t=this;return this._$scrollBar.draggable({axis:"y",containment:this._$scrollBarWrapper,start:function(){t._dragging=!0},stop:function(){t._dragging=!1},drag:function(e,i){t.updateScroll()}}),this._dragInitialized=!0,this},o.prototype.updateScroll=function(){var t,e,i,o,n;return this._touch?this:(t=1,e=Math.ceil(this._$scrollBar.position().top-this._scroll_margin_top-this._header_height),i=this._$wrapper.height()-this._header_height,o=this._$content.height(),n=o-i-t,i<=0?this:(n<=0?this._scroll_target_top=this._header_height:this._scroll_target_top=Math.min(-e*o/i+this._header_height,this._header_height),e+this._$scrollBar.height()+2>=i?this.scrollToEnd():(this._$content.css("top",this._scroll_target_top+"px"),this._onScroll()),this))},o.prototype.updateScrollBar=function(){var t,e,i,o,n,s,r,a,l;return this._touch?this:(t=1,e=this._$content.position().top,i=this._$content.height(),o=this._$wrapper.height(),n=o-this._header_height,s=t+this._header_height,r=n-2*t,a=(Math.abs(e)-this._header_height)*r/i,l=o*o/i,i<n?(this._$scrollBar.addClass("js-hidden"),this._$wrapper.removeClass("sb-scroll-active")):(this._$scrollBar.removeClass("js-hidden").height(l).css("top",s+a),this._$wrapper.addClass("sb-scroll-active"),this.initDraggable()),this)},o.prototype.scroll=function(t,e){var i,o,n,s,r;return this._touch?this:(i=this._$content.position().top,o=this._$content.height(),n=this._$wrapper.height()-this._header_height,s=o-n-1,r=e||this._scroll_speed,s<=0||(this._scroll_target_top=Math.max(-s+this._header_height,Math.min(this._header_height,i+t*r)),this.setContentTop(this._scroll_target_top),this._onScroll(),!1))},o.prototype.animateTo=function(t){var e,i,o;return this._touch?this:(e=this._$content.height(),i=this._$wrapper.height()-this._header_height,o=e-i-1,o<=0||(this._scroll_target_top=Math.max(-o+this._header_height,Math.min(this._header_height,-t)),void this._$content.animate({top:this._scroll_target_top},500,function(){this._onScroll()}.bind(this))))},o.prototype.resize=function(){var t,e;if(!this._bottomFixed)return t=this._$content.height(),e=this._$wrapper.height(),!this._options.vAlignBottom&&t<e?void(this.atStart()||this.scrollToStart()):void(this.atEnd()?this.scrollToEnd():"number"==typeof this._stickyBottom&&this.setContentTop(Math.min(0,this._stickyBottom+this._$wrapper.height()-this._$content.height())))},o.prototype.resizeHeader=function(t){var e=t-this._header_height;this._header_height=t,this._scroll_target_top+=e,this._$shadowTop&&this._$shadowTop.css("top",this._header_height-this._shadow_offset),this.resize()},o.prototype.scrollTo=function(t,e){var i,o,n,s,r,a,l;if(e=$.extend({position:"visible",areaHeight:t instanceof $?t.height():0},e),t instanceof $&&(t=t.position().top),i=this._$content.position().top,o=this._$content.height(),n=this._$wrapper.height()-this._header_height,s=o-n-1,s<=0)return!0;if(r=-1*(i-this._header_height),a=r+n,l=0,"visible"===e.position){if(t>r&&t+e.areaHeight<a)return!1;l=t+e.areaHeight>a?a-t-e.areaHeight:r-t}else"top"===e.position&&(l=r-t);return this.scroll(l,1),this._onScroll(),!1},o.prototype.scrollToEnd=function(){var t=1,e=this._$content.position().top,i=this._$content.height(),o=this._$wrapper.height(),n=i+e;return this.setContentTop(e+(o-n)+t),this._onScroll(),this},o.prototype.scrollToStart=function(){return this.setContentTop(this._header_height),this._onScroll(),this},o.prototype.currentPosition=function(){return Math.round(this._$content.position().top)},o.prototype.atStart=function(){return Math.round(this._$content.position().top)>=this._header_height},o.prototype.atEnd=function(t){var e,i,o,n,s;return"number"==typeof t&&isFinite(t)||(t=0),e=1,i=this._$content.position().top,o=this._$content.height(),n=this._$wrapper.height(),s=o-Math.abs(i)-e,s<=n+t},o.prototype._onScroll=function(t){var e,i;this._touch||this._$content.css("bottom","auto"),this.scrolled.fire(),this._dragging&&t!==!0||this.updateScrollBar(),e=this.atStart(),i=this.atEnd(),this._$shadowTop&&this._$shadowTop.toggleClass("js-hidden",!!e),this._$shadowBottom&&this._$shadowBottom.toggleClass("js-hidden",!!i),this._onContentVisible(),!this._atStart&&e?(this._atStart=!0,this.scrolltostart.fire()):this._atStart&&!e&&delete this._atStart,!this._atEnd&&i?(this._atEnd=!0,this.scrolltoend.fire()):this._atEnd&&!i&&delete this._atEnd,this._options.vAlignBottom&&(this._stickyBottom=this._$content.height()-Math.abs(this._$content.position().top)-this._$wrapper.height())},o.prototype.checkContentVisibility=function(){this._onContentVisible()},o.prototype.subscribeToContentVisible=function(t,e,i){this.visibilityCallbacks.push({id:t,$el:e,callback:i})},o.prototype.triggerVisibilityCallbacks=function(t){this._onContentVisible(t)},o.prototype._contentIsVisible=function(t){return t.$el.position().top>-1*this.currentPosition()},o.prototype._onContentVisible=function(t){var e,i,o;this.visibilityCallbacks.length&&(e=t||this._contentIsVisible.bind(this),i=[],o=this.visibilityCallbacks.filter(function(t,o){if(!$.contains(this._$content,t.$el[0]))return!1;var n=e(t);return n&&i.push(o),!n},this),i.forEach(function(e){this.visibilityCallbacks[e].callback(!!t)},this),delete this.visibilityCallbacks,this.visibilityCallbacks=o)},o.prototype.save=function(){return this._saved={top:this._$content.position().top,height:this._$content.height()},this},o.prototype.restore=function(){if(this._saved){if(this._saved.top===this._$content.position().top&&this._saved.height===this._$content.height())return delete this._saved,this;this._options.vAlignBottom&&(this._saved.top-=this._$content.height()-this._saved.height,this._saved.top>this._header_height&&(this._saved.top=this._header_height)),this.setContentTop(this._saved.top),delete this._saved,this._onScroll(!0)}return this},o.prototype.fixBottom=function(){var t,e;return this._bottomFixed?this:(this._touch?(t=this._$content.height(),e=this._$wrapper.scrollTop(),this._tempIntervalID=setInterval(function(){this._$wrapper.scrollTop(e+(this._$content.height()-t))}.bind(this),0)):this._$content.css({top:"auto",bottom:this._$wrapper.height()-this._$content.position().top-this._$content.height()}),this._bottomFixed=!0,this)},o.prototype.releaseBottom=function(){return this._bottomFixed?(this._touch?clearInterval(this._tempIntervalID):this._$content.css({top:this._$content.position().top,bottom:"auto"}),delete this._bottomFixed,this._onScroll(),this):this},o.prototype.setContentTop=function(t){return this._touch?this._options.vAlignBottom&&this._$content.height()<this._$wrapper.height()?(this._$wrapper.css("overflow-y","visible"),this._$content.css({position:"absolute",bottom:0})):(this._$content.css({position:"relative",bottom:"auto"}),this._$wrapper.css("overflow-y","scroll"),this._$wrapper.scrollTop(-t)):this._$content.css("top",t),this},e.SidebarCustomScroll=o,e.SidebarWidget=i}).call(e,i(28))},function(t,e,i){(function(t){"use strict";var e=function(){this.type="test_call",this.content=""},i={wrapValue:function(t){return""+t},sendEvent:function(t,i){var o=new e;o.type=i||"event",o.content=t,window.external.notify(JSON.stringify(o))}};void 0!==t&&t&&t.exports&&(t.exports=i)}).call(e,i(2)(t))},function(t,e,i){(function(t){"use strict";var e=function(){return"www.tradingview.com"===location.host||"dwq4do82y8xi7.cloudfront.net"===location.host||"i18n.tradingview.com"===location.host||"ru.tradingview.com"===location.host||location.host.match(/proxy\d.tradingview.com/)||location.host.match(/prod-[^.]+.tradingview.com/)?"battle":location.href.indexOf("tradingview.com")!==-1?"staging":location.host.match(/webcharts/)?"staging_local":(""===location.host.match(/^localhost(:\d+)?$/),"local")};e.isLocal=function(){return"local"===this()},e.isProd=function(){return"battle"===this()},e.isDebug=function(){return!this.isProd()},TradingView.Environment=e,void 0!==t&&t&&t.exports&&(t.exports=e)}).call(e,i(2)(t))},function(t,e){"use strict";function i(t){this.ok=!1,"#"===t.charAt(0)&&(t=t.substr(1,6)),t=t.replace(/ /g,""),t=t.toLowerCase(),this.parseColor(t)||(this.simple_colors[t]&&(t=this.simple_colors[t]),this.parseColor(t)),this.cleanupRGB()}function o(t,e,i){var o,n,s,r,a,l;if(t/=255,e/=255,i/=255,o=Math.max(t,e,i),n=Math.min(t,e,i),a=(o+n)/2,o===n)s=r=0;else{switch(l=o-n,r=a>.5?l/(2-o-n):l/(o+n),o){case t:s=(e-i)/l+(e<i?6:0);break;case e:s=(i-t)/l+2;break;case i:s=(t-e)/l+4}s/=6}return[s,r,a]}function n(t,e,i){function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}var n,s,r,a,l;return 0===e?n=s=r=i:(a=i<.5?i*(1+e):i+e-i*e,l=2*i-a,n=o(l,a,t+1/3),s=o(l,a,t),r=o(l,a,t-1/3)),[Math.round(255*n),Math.round(255*s),Math.round(255*r)]}function s(t,e){var i=parseInt(t.substring(1,3),16),o=parseInt(t.substring(3,5),16),n=parseInt(t.substring(5,7),16),s=parseInt(e.substring(1,3),16),r=parseInt(e.substring(3,5),16),a=parseInt(e.substring(5,7),16),l=s-i,h=o-r,c=n-a,d=Math.sqrt(l*l+h*h+c*c);return d<16}function r(t){var e,i=parseInt(t.substring(1,3),16),o=parseInt(t.substring(3,5),16),n=parseInt(t.substring(5,7),16);return i=255-i,o=255-o,n=255-n,e=function(t){return("0"+t.toString(16)).right(2)},"#"+e(i)+e(o)+e(n)}i.prototype.color_defs=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/^rgba\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*([\d]{0,1})(\.{1}\d{1,4})*\)$/,example:["rgba(123, 234, 45, 1)","rgba(255,234,245,0.1)"],process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}}],i.prototype.simple_colors={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",
blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},i.prototype.parseColor=function(t){var e,i,o,n,s;for(e=0;e<this.color_defs.length;e++)if(i=this.color_defs[e].re,o=this.color_defs[e].process,n=i.exec(t))return s=o(n),this.r=s[0],this.g=s[1],this.b=s[2],this.ok=!0,!0;return!1},i.prototype.cleanupRGB=function(){this.r=this.r<0||TradingView.isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||TradingView.isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||TradingView.isNaN(this.b)?0:this.b>255?255:this.b},i.prototype.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},i.prototype.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),i=this.b.toString(16);return 1===t.length&&(t="0"+t),1===e.length&&(e="0"+e),1===i.length&&(i="0"+i),"#"+t+e+i},i.prototype.grayChannel=function(){var t=[.199,.687,.114],e=t[0]*this.r+t[1]*this.g+t[2]*this.b;return e},i.prototype.blackWhiteContrast=function(){return this.grayChannel()<150?"white":"black"},i.prototype.darken=function(t){var e=o(this.r,this.g,this.b),i=n(e[0],e[1],e[2]-t/100);return this.r=i[0],this.g=i[1],this.b=i[2],this.cleanupRGB(),this},e.RGBColor=i,e.rgbToHsl=o,e.hslToRgb=n,e.colorsAreSimilar=s,e.invertColor=r},function(t,e,i){(function(t,e){"use strict";var i=window.TVSettings=function(){function e(t){return x+"."+t}function o(t,e){var i;return i=P[t],window.is_authenticated&&!A||null!=i||(i=P[t]),null==i?e:i}function n(t,e){var i=o(t,void 0);if(null==i)return e;try{return JSON.parse(i)}catch(i){return c(t),e}}function s(t,e){var i=o(t);return null==i?e:!(!i||"false"===i||0===+i)}function r(t,e,i){var n,s=o(t,void 0,i);if(null==s)return e;if(n=parseFloat(s),!isFinite(n))throw new TypeError('"'+s+'" is not float (key: "'+t+'")');return n}function a(t,e,i){var n,s=o(t,void 0,i);if(null==s)return e;if(n=parseInt(s,10),!isFinite(n))throw new TypeError('"'+s+'" is not int (key: "'+t+'")');return n}function l(t,e,o){o=o||{};var n=""+e;return P[t]!==n&&(P[t]=n,p(t)),o.forceFlush&&u(),i}function h(t,e,o){var n=JSON.stringify(e);return l(t,n,o),i}function c(t){return null!=P[t]&&(delete P[t],p(t),TradingView.trackEvent("Settings debug",t,user.username)),i}function d(){k=void 0,L.length&&u()}function p(t){if(!window.is_authenticated||A)try{null==P[t]?TVLocalStorage.removeItem(e(t)):TVLocalStorage.setItem(e(t),P[t])}catch(t){}else L.push(t),k||(k=setTimeout(d,C));TVXWindowEvents.emit("settings",JSON.stringify({key:t,value:P[t]}))}function u(t){var e,i,o,n,s;if(!TradingView.onWidget()&&window.is_authenticated&&!A&&0!==L.length){for(e=L,L=[],i={},o=e.length;o--;)n=e[o],s=P[n],void 0===s&&(s=null),i[n]=s;$.ajax({url:"/savesettings/",type:"POST",data:{delta:JSON.stringify(i)},async:!t})}}function _(){var t,e,i;for(t=0;t<TVLocalStorage.length;t++)e=TVLocalStorage.key(t),i=x.length,e.substring(0,i+1)===x+"."&&(L=[],TVLocalStorage.removeItem(e));$.post("/restoredefaults/",{},function(t){TVDialogs.showNotice("Success","Defaults has been successfully restored")}).error(function(t){})}function f(){return Object.keys(P)}function g(t,e){var i,o=f(e),n=[];for(t=RegExp("^"+TradingView.RegExpEscape(t).replace(/\\\*\\\*/gi,".+").replace(/\\\*/gi,"[^.]+")+"$","gi"),i=o.length-1;i>=0;i--)t.test(o[i])&&n.push(o[i]),t.lastIndex=0;return n}function m(t){for(var e=0;e<E.length;++e)if(E[e].exec(t))return!0;return!1}function v(){var e,i,o,n,s;for(P=[],e=x+".",i=!t.enabled("save_chart_properties_to_local_storage"),o=TVLocalStorage.length;o--;)n=TVLocalStorage.key(o),n&&n.substring(0,e.length)===e&&(s=n.substring(e.length),i&&!m(s)||(P[s]=TVLocalStorage.getItem(n)))}function y(t){var e,i,o,n,s;for(P=[],e=0===Object.keys(t).length,i=x+".",o=TVLocalStorage.length;o--;)n=TVLocalStorage.key(o),n&&n.substring(0,i.length)===i&&(e&&(s=n.substring(i.length),l(s,TVLocalStorage.getItem(n))),TVLocalStorage.removeItem(n));for(o in t)P[o]=t[o]+""}function b(t){window.is_authenticated&&!A?y(t||{}):v()}var w,S,T,C,x,P,L,k,E,I=!1,A=t.enabled("cqg_terminal");try{I=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(t){}return I?(w={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},S=function(t,e,i){var o=w[t];return null==o?e:o},T=function(){},{loaded:!1,loadedModel:!1,getValue:S,getJSON:S,getBool:S,getFloat:S,getInt:S,setValue:T,setJSON:T,remove:T,restoreDefaults:T,keys:function(){return Object.keys(w)},keysMask:function(){return[]},sync:T}):(C=12e4,"local"===window.environment&&(C=5e3),x="tradingview",P={},L=[],E=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist^/],TVXWindowEvents.on("settings",function(t){var e=JSON.parse(t);null==e.value?delete P[e.key]:P[e.key]=e.value}),$(window).on("visibilitychange",function(t,e){e||u()}),$(window).on("unload",function(){u(!0)}),{loaded:!1,loadedModel:!1,getValue:o,getJSON:n,getBool:s,getFloat:r,getInt:a,setValue:l,setJSON:h,remove:c,restoreDefaults:_,keys:f,keysMask:g,sync:b})}();void 0!==e&&e&&e.exports&&(e.exports=i)}).call(e,i(1),i(2)(t))},function(t,e,i){"use strict";function o(){}function n(t,e,i,o){var n,s;y[i]||(y[i]={persistent:[],truncated:[]}),n=y[i][o===!0?"truncated":"persistent"],s={timestamp:+t,message:e},n.unshift(s),o===!0&&n.length>m&&(n.length=m)}function s(t,e){for(var i=0;i<t.length;i++)t[i].subsystem=e;return t}function r(t){function e(e,i,o,n){P(t,e,i,o,n)}function i(t){return function(i,o,n){e(i,t,o,n)}}return e.withinSubsystem=i,e}var a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L;a=i(64),l=window,h="undefined"!=typeof TradingView&&TradingView||{},c="undefined"!=typeof TVSettings&&TVSettings||{getInt:function(t,e){return e},setValue:function(){}},d=l.console||{},["debug","log","warn","error"].forEach(function(t){if(void 0===d[t])try{d[t]=o}catch(t){}}),p=h.LOGLEVEL_ERROR=1,u=h.LOGLEVEL_WARNING=2,_=h.LOGLEVEL_NORMAL=3,f=h.LOGLEVEL_DEBUG=4,g=u,m=300,v="loglevel",y={},b="general",w={general:"color: #099",chart:"color: #606",quote:"color: #660"},setInterval(function(){S=null,T=null},1e3),C=h.getLogLevel=function(){return c.getInt(v)},x=l.llev=h.setLogLevel=function(t){t="number"==typeof t?Math.max(p,Math.min(f,t)):g,c.setValue(v,t)},l.lon=h.loggingOn=function(){x(f),P(_,"Debug logging enabled")},l.lno=h.loggingNormal=function(){x(_),P(_,"Logging set to normal level")},l.loff=h.loggingOff=function(){x(u),P(_,"Debug logging disabled",null,!0)},h.getLogHistory=function(t,e,i,o){var n=[];return Object.keys(y).forEach(function(e){e===b&&i===!0||t&&e!==t||o&&~o.indexOf(e)||(n=n.concat(s(y[e].persistent.concat(y[e].truncated),e)))}),n.sort(function(t,e){return t.timestamp-e.timestamp}),"number"==typeof e&&(n=n.slice(-e)),n.map(function(t){return new Date(t.timestamp).toISOString()+":"+t.subsystem+":"+t.message})},P=h.log=function(t,e,i,o,s){var r,a;if((e!==S||i!==T)&&(i=i||b,r=new Date,"\n"!==e&&t<=_&&n(r,e,i,s),o===!0||t<=C())){if("\n"!==e)switch(a=r.toISOString()+":"+i+":"+e,t){case f:d.debug(a);break;case _:w[i]?d.log("%c"+a,w[i]):d.log(a);break;case u:d.warn(a);break;case p:d.error(a)}S=e,T=i}},h.logError=r(p),h.logWarn=r(u),h.logNormal=r(_),h.logDebug=r(f),h.logNormalChart=r(_).withinSubsystem("chart"),h.logNormalQuote=r(_).withinSubsystem("quote"),h.logDebugChart=r(f).withinSubsystem("chart"),h.logDebugQuote=r(f).withinSubsystem("quote"),L=h.remoteDebug=function(){var t={arguments:JSON.stringify(Array.prototype.slice.call(arguments))};$.ajax("/remote_debug/",{data:t})},h.remoteDebugTouch=function(){Modernizr.touch&&L.apply(this,arguments)},a.isProd()&&void 0!==d&&(h.remoteDebug=o),h.debugReady&&h.debugReady.resolve()},function(t,e,i){(function(t,e,o,n,s){"use strict";var r=window.TVDialogs={modalDialog:null,dialogs:[],messageInterval:null,messageDelay:4e3,NOTIFICATION_ANIMATION_START_OFFSET:"-33px",_constrainDraggableOptionsIfNeeded:function(e){return t.enabled("constraint_dialogs_movement")&&(e.containment=".chart-page"),e},validateHelpers:{isErrorListening:function(t){t.on("keyup.error-checker",r.validateHelpers.isError(t.val(),t))},isError:function(t,e){return function(){e.val()!==t&&(e.removeClass("error"),e.off("keyup.error-checker"))}},makeValidator:function(t,e,i,o,n){return function(s){var a,l,h;if(t.removeClass("error"),$("._tv-dialog-field-error").hide(),""!==s.errors)if("object"==typeof s.errors){for(a in s.errors)l=t.filter("input[name^="+a+"]"),l.addClass("error").data("error",s.errors[a][0]),r.validateHelpers.isErrorListening(l);h=t.filter(".error").first().focus(),r.showError(h.data("error"),n)}else r.showError($.t("Error:")+s.errors,n);else"function"==typeof o&&o(s,i);e.removeClass("process")}}},applyMQMatcher:function(t){var e,i;t||(t=r.modalDialog),e=function(){r.positionDialog()},window.matchMedia&&(i=["(max-height: 645px)","(max-width: 460px)"].map(function(t){var i=matchMedia(t);return i.addListener(e),i}),t.on("destroy",function(){i.forEach(function(t){t.removeListener(e)})}))},showLineToolsWarning:function(t,e,i){function o(){r.destroy()}var n,s,a,l;e.readOnly()||(n=$.t("Warning"),r.createModalDialog(n,{addClass:"line-tools-warning"}),s=r.modalDialog,s.addClass("trading-dialog"),a=s.find("._tv-dialog-content"),$("<div class='message'>").append($.t("This chart layout has more than 1000 drawings, which is a lot! This may negatively affect performance, storage and publishing. We recommend to remove some drawings to avoid potential performance issues.")).appendTo(a),l=$("<div>").addClass("buttons").appendTo(a),$("<button class='select button flat'>").append($.t("Open Manage Drawings")).appendTo(l).click(function(){$(this).addClass("process"),new TradingView.ObjectTreeDialog({chartWidget:e,activeTab:1},i).show(function(){o()})}),$("<button class='button flat not-now'>").append($.t("Not Now")).appendTo(l).click(function(){o()}),r.applyHandlers(s),r.positionDialog())},showBrowserExtensionDialog:function(t){var o,n;if(t)return o={chrome:{logo:"images/svg/google-chrome-logo.svg",name:"Google Chrome",href:"https://chrome.google.com/webstore/detail/tradingview-free-quotes-a/ommjfbdmijjlbhlhnnnfkmbnkpnjpipj"}},n=i(46),r.createModalDialog("Browser Extension",{noHeader:!0,width:"730px",content:e.render(n.dialogs.browserExtension,{browser:o[t]})}),r.modalDialog.find(".install-extension, ._tv-dialog-title-close").click(function(t){r.destroy()}),r.positionDialog(),r.modalDialog},showIntervalMismatchDialog:function(t){var e,i,o,n,s,a,l=!1;l=l||!1,r.createModalDialog($.t("Interval is not applicable"),{addClass:"tv-interval-is-not-applicable-dialog"}),e=r.modalDialog,e.css({zIndex:1e3}),e.find("._tv-dialog").css("width","400px"),i=r.modalDialog.find("._tv-dialog-content"),i.html('<div class="main"><div class="caption-big">'+$.t("<p>Only <b>D, W, M</b> intervals are supported for this symbol/exchange. You will be automatically switched to a D interval. Intraday intervals are not available because of exchange policies.</p>")+'</div><div class="main-properties"></div></div>'),o=i.find(".main-properties"),n=$('<div class="dialog-buttons"></div>').appendTo(o),t&&(s=$('<label class="dialog-trail-checkbox"><input type="checkbox" /> '+$.t("Do not show this message again")+"</label>").appendTo(n),a=s.find("input"),a.attr("checked",t.silentIntervalChange.value()),a.bind("click",function(){t.silentIntervalChange.setValue(this.checked)})),$('<a class="_tv-button ok">OK</a>').appendTo(n).bind("click",function(){r.destroy()}),r.positionDialog(),r.applyHandlers(!1,{doNotCloseOnBgClickIfShadowbox:l})},showCMEdataOffer:function(t,o){function n(){c.html(d.cmeOfferDialog.stage1),c.find("._tv-dialog-title-close").on("click",function(){r.destroy()}),c.find(".js-next").on("click",s),l()}function s(){c.html(d.cmeOfferDialog.stage2),c.find("form").on("submit",function(t){t.preventDefault(),c.find(".js-connect").addClass("process"),$.ajax({method:"GET",url:"/cqg-credentials/",data:{password:$(this).find('input[name="password"]').val(),login:$(this).find('input[name="login"]').val()}}).done(function(t){c.find(".js-connect").removeClass("process"),a("ok"===t.status?{okStatus:!0}:{okStatus:!1})})}),l()}function a(t){c.html(e.render(d.cmeOfferDialog.stage3,t)),c.find("._tv-dialog-title-close").on("click",function(){r.destroy()}),c.find(".js-try-again").on("click",function(t){t.preventDefault(),s()}),c.find(".js-ok").on("click",function(t){t.preventDefault(),TradingView.onChartPage&&window.saver&&window.saver.saveChartSilently&&window.saver.saveChartSilently(function(){window.location.reload()},!1)}),t.okStatus===!0&&o(),l()}function l(){r.applyMQMatcher(h),r.positionDialog(),r.applyHandlers(null,{doNotCloseOnBgClick:!0,doNotCloseOnEsc:!0})}var h,c,d;return is_authenticated||r.showSignInDialog(),t=$.extend({},t),h=r.createModalDialog("CME Group Non-Professional User Fees",{addClass:"cme-offer-dialog"}),c=r.modalDialog.find("._tv-dialog-content"),d=i(46),n(),h},showSignInDialog:function(t,e){},showAfterSocialSign:function(t){},goRegistrate:function(t){},showPublishIntroDialog:function(t){},showGoProDialog:function(t){},showTrialStartDialog:function(t){},showGoToTradingViewReferralDialog:function(t){},showAddSymbolDialog:function(t,o){function n(t){var e,i=a.find("#_tv-dialog-addsymbol-overlay-checkbox").is(":checked");t&&(e=o.callback,e(t,i),$(window).off("keyup.addOverlay"),r.destroy(a.data("title")))}var s,a,l,h,c,d;o=$.extend({},{title:$.t("Add Symbol"),callback:function(t,e){},overlayOption:!1,overlayOptionChecked:TVSettings.getBool("showAddSymbolDialog.checkboxState",!0),okButtonTitle:$.t("Add Symbol")},o||{}),s=i(46),a=r.createDialog(o.title),a.css("min-width",0),a.find("._tv-dialog-content").html(e.render(s.dialogs.addSymbol,o)).css("min-width",0),r.applyHandlers(a),l=$('<div class="symbol-edit-widget"></div>'),h=$('<input type="text" class="symbol-edit single" placeholder="'+$.t("Symbol")+'" maxlength="30" style="text-transform: none; font-weight: normal;" autocomplete="off">').appendTo(l),c=i(39),d=c.bindToInput(h,{callback:function(t){n(t)}}),a.find("div.symbol-edit-place").replaceWith(l),a.find("._tv-dialog").draggable(r._constrainDraggableOptionsIfNeeded({handle:"._tv-dialog-title"})),a.find("input[type=checkbox]").on("change",function(t){TVSettings.setJSON("showAddSymbolDialog.checkboxState",t.target.checked)}),a.find(".ok").on("click",function(){d.acceptTypeIn()}),a.show(),r.positionDialog(a),h.focus()},makeDraggable:function(t){t.draggable({handle:"._tv-dialog-title"})},showConfirmInputsDialog:function(t,e,i){function n(t){var e=i.callback,o=t.state();e(o),r.destroy(s.data("title"))}var s,a,l,h,c,d,p,u,_,f;for(i=$.extend({},{title:$.t("Confirm Inputs"),callback:function(t){},okButtonTitle:$.t("Apply")},i||{}),s=r.createDialog(i.title,{content:"<div class='main'></div>"}),s.css("min-width",0),r.applyHandlers(s,{beforeDestroy:function(){$(window).unbind("keyup.hideInputsConfirmDialog")}}),a=TradingView.merge({},e.defaults.inputs),l=0;l<e.inputs.length;++l)h=e.inputs[l],h.confirm||delete a[h.id];c=new o({inputs:a}),d={metaInfo:function(){return e}},p=new TradingView.StudyInputsPropertyPage(c,t.model(),d,!0),u=p.widget(),_=s.find(".main"),_.append(u),$(window).bind("keyup.hideInputsConfirmDialog",function(t){13===t.keyCode&&"textarea"!==t.target.tagName.toLowerCase()&&(n(c),$(window).unbind("keyup.hideInputsConfirmDialog"))}),$("select",_).each(function(){var t=$(this),e="tv-select-container dialog";t.hasClass("tv-select-container-fontsize")&&(e+=" tv-select-container-fontsize"),t.selectbox({speed:100,classHolder:e})}),$('input[type="text"]',_).addClass("tv-text-input inset dialog"),$("input.ticker",_).TVTicker(),f="<div class='_tv-dialogs-bottom-button'><span class='_tv-button tv-right tv-uppercase ok'>Apply</span></div>",s.find(".main").append(f),s.find(".ok").on("click",function(){n(c)}),s.show(),r.positionDialog(s),_.find("input,select").first().focus()},showAlertTextNotesDialog:function(){r.showNotice($.t("Oops!"),{html:$.t('Text Notes are available only on chart page. Please <a href="/chart/">open a chart</a> and then try again.')})},showNotice:function(t,i,o){var n,s,a,l,h,c;return"object"==typeof i&&(o=i,i=""),o=o||{},n=o.doNotCloseOnBgClick||!1,s=o.html||"",a=o.width||"400px",l={},l.noClose=o.noClose||null,r.createModalDialog(t,l),h=o.centerCaption?"caption-big-center":"caption-big",r.modalDialog.find("._tv-dialog").css("width",a),c=o.customButtonCaption?o.customButtonCaption:$.t("OK"),r.modalDialog.find("._tv-dialog-content").html(e.render('<div class="main"><div class="{{captionClassName}} {{classSuffix}}">{{text}}'+s+'</div>{{^removeOkButton}}<div class="buttons"><input type="button" class="_tv-button ok" value="'+c+'"/></div>{{/removeOkButton}}</div>',{captionClassName:h,classSuffix:o.classSuffix||"",text:i,removeOkButton:o&&o.removeOkButton})),r.modalDialog.find("._tv-button.ok").on("click",function(){r.destroy(),o.onOkButtonClick&&o.onOkButtonClick()}),r.positionDialog(),r.applyHandlers(!1,{doNotCloseOnBgClickIfShadowbox:n,beforeDestroy:o.onClose}),r.modalDialog},showTooManyStudiesNotice:function(t){return"number"!=typeof t&&(t=TradingView.STUDY_COUNT_LIMIT),r.showNotice($.t("Warning"),{html:$.t("Studies limit exceeded: {0} studies per layout.<br>\nPlease, remove some studies.",{count:t}).format(t)})},showConfirm:function(t,i,o,n,s){if(s=s||{},s.dontAskSetting&&TVSettings.getBool(s.dontAskSetting))return void o();var a=r.createModalDialog(t,s);return r.modalDialog.find("._tv-dialog").css("width",s.customWidth?s.customWidth:"400px"),r.modalDialog.find("._tv-dialog-content").html(e.render('<div class="main"><div class="caption-big">{{{text}}}</div>{{#dontAskSetting}}<input type="checkbox" id="confirm-dialog-checkbox" style="margin: 0; vertical-align: middle;"> <label for="confirm-dialog-checkbox" style="font-size: 11px;">'+$.t("Do not ask again")+'</label>{{/dontAskSetting}}</div><div class="_tv-dialogs-bottom _tv-dialog-center"><input class="_tv-button wide ok" type="button" value="'+$.t("YES")+'" style="margin-right: 10px;"/><input class="_tv-button wide cancel" type="button" value="'+$.t("NO")+'"/></div>',{text:i,dontAskSetting:!!s.dontAskSetting})),s.okButtonText&&r.modalDialog.find(".ok").val(s.okButtonText),s.cancelButtonText&&r.modalDialog.find(".cancel").val(s.cancelButtonText),r.modalDialog.find(".ok").click(function(){s.dontAskSetting&&$("#confirm-dialog-checkbox").is(":checked")&&TVSettings.setValue(s.dontAskSetting,!0),o(),s.manualClose||r.destroy()}),r.modalDialog.find(".cancel").click(function(){n&&n(),s.manualCloseOnCancel||r.destroy()}),r.positionDialog(),r.applyHandlers(),a},showPrompt:function(t,i,o,n,s){function a(){var t,e=l.val();return c&&(t=c(e))?(t===!0&&(t=$.t("Wrong value")),void r.showError(t,r.modalDialog)):(r.destroy(),void(o&&o(e)))}var l,h=s&&s.defaultValue,c=s&&s.validate;r.createModalDialog(t,s),r.modalDialog.find("._tv-dialog").css("width","400px"),r.modalDialog.find("._tv-dialog-content").html(e.render('<div class="main"><form><div class="caption-big-center slim">{{text}}: <input type="text" name="prompt-value" class="prompt-value"/></div></form></div><div class="_tv-dialogs-bottom _tv-dialog-{{bottomAlign}}"><input class="_tv-button wide ok" type="button" value="'+$.t("OK")+'" style="margin-right: 10px;"/><input class="_tv-button wide cancel" type="button" value="'+$.t("Cancel")+'"/></div>',{text:i,bottomAlign:s.bottomAlign?s.bottomAlign:"center"})),l=r.modalDialog.find('[name="prompt-value"]'),h&&l.val(h),r.modalDialog.find("form").submit(function(t){a(),t.preventDefault()}),r.modalDialog.find(".ok").click(function(t){a(),t.preventDefault()}),r.modalDialog.find(".cancel").click(function(){r.destroy(),n&&n()}),r.positionDialog(),r.applyHandlers(),setTimeout(function(){l.focus().select()},0)},showCustomDialog:function(t){function e(e){var i=t.action(r.modalDialog),o=i&&!i.error,n=void 0===i,s=i&&i.notClose;!o&&!n||s?i.error&&r.showError(i.error):r.destroy(),e.preventDefault()}function i(e){"function"==typeof t.onCancel?t.onCancel():r.destroy()}return r.createModalDialog(t.title||$.t("Dialog"),{addClass:t.addClass||""}),r.modalDialog.find("._tv-dialog").css("width",t.width||"400px"),r.modalDialog.find("._tv-dialog-content").html('<div class="main">'+(t.html||$.t("Content"))+"</div>"+(t.noButtons?"":'<div class="_tv-dialogs-bottom _tv-dialog-center">'+(t.noButtonOk?"":'<input class="_tv-button wide ok" type="button" value="'+$.t("OK")+'" style="margin-right: 10px;"/>')+(t.noButtonCancel?"":'<input class="_tv-button wide cancel" type="button" value="'+$.t("Cancel")+'"/>')+"</div>")),t.okButtonText&&r.modalDialog.find(".ok").val(t.okButtonText),t.cancelButtonText&&r.modalDialog.find(".cancel").val(t.cancelButtonText),r.modalDialog.find(".ok").click(e),r.modalDialog.find("form").submit(e),r.modalDialog.find(".cancel").click(i),r.modalDialog.find("._tv-dialog-title-close").click(i),r.positionDialog(),r.applyHandlers(),r.modalDialog},createModalDialog:function(t,e){var i,o;return e=e||{},null!==r.modalDialog&&r.destroy(),r.modalDialog=$('<div class="_tv-dialog-shadowbox"><div class="_tv-dialog _tv-dialog-modal'+(e.addClass?" "+e.addClass:"")+'">'+(e.noHeader?"":'<div class="_tv-dialog-title">'+(e.noClose?"":'<a class="_tv-dialog-title-close"></a>')+'<span class="_tv-dialog-title-text">'+t+"</span></div>")+'<div class="_tv-dialog-error"><span class="message"></span></div><div class="_tv-dialog-message"><span class="message"></span></div><div class="_tv-dialog-content"></div></div></div>').appendTo($("body")).data("title",t),r._addMessageCloseButton(r.modalDialog.find("._tv-dialog-error")),r._addMessageCloseButton(r.modalDialog.find("._tv-dialog-message")),e.noShadowBox&&r.modalDialog.addClass("transparent"),e.addClass&&r.modalDialog.addClass(e.addClass),e.width&&r.modalDialog.find("._tv-dialog").css({width:e.width}),e.content&&r.modalDialog.find("._tv-dialog-content").html(e.content),i=$(".fancybox-overlay"),i.length&&(o=i.css("z-index"),$("._tv-dialog-shadowbox").css("z-index",o+1)),e.draggable&&r.modalDialog.draggable(r._constrainDraggableOptionsIfNeeded({handle:r.modalDialog.find("._tv-dialog-title")})),e.zIndex&&r.modalDialog.css("z-index",e.zIndex),r.modalDialog},_addMessageCloseButton:function(t){var e=$(i(70)).attr({class:"close",title:$.t("Close message")});t.append(e),$(e).on("click",function(){t.animate({marginTop:r.NOTIFICATION_ANIMATION_START_OFFSET,opacity:0},"fast",function(){t.hide()})})},createDialog:function(t,i){var o,s,a;return r.isOpen(t)?(o=r.get(t),o.find("._tv-dialog-content").html(""),o.data("new",!1),o):(i=i||{},o=$(e.render('<div class="_tv-dialog _tv-dialog-nonmodal {{&addClass}}"><div class="_tv-dialog-title{{#hideTitle}} _tv-dialog-title-hidden{{/hideTitle}}{{#hideCloseCross}} _tv-dialog-title-no-close{{/hideCloseCross}}">{{^hideTitle}} {{&title}}{{/hideTitle}}{{^hideCloseCross}}<a class="_tv-dialog-title-close"></a>{{/hideCloseCross}}</div><div class="_tv-dialog-error"><span class="message"></span></div><div class="_tv-dialog-message"><span class="message"></span></div><div class="_tv-dialog-content"></div></div>',{addClass:i.addClass||"",hideTitle:i.hideTitle,hideCloseCross:i.hideCloseCross,title:t})).appendTo($("body")),r._addMessageCloseButton(o.find("._tv-dialog-error")),r._addMessageCloseButton(o.find("._tv-dialog-message")),i.width&&o.css({width:i.width}),i.content&&o.find("._tv-dialog-content").html(i.content),s=0,s=r.dialogs&&r.dialogs.length?n.max($.map(r.dialogs,function(t){return parseInt((t.dialog||t).css("z-index"),10)}))+1:110,o.css("z-index",s),o.data("new",!0),o.data("title",t),o.data("id",r.dialogs.length+1),r.dialogs.push({title:t,dialog:o,id:r.dialogs.length+1}),a={start:function(t,e){var i,o,n=e.helper.css("z-index"),s=0,a=null;for(i=0;i<r.dialogs.length;i++)o=r.dialogs[i].dialog.css("z-index"),o>s&&(s=o,a=r.dialogs[i].dialog);e.helper.css("z-index",s),a.css("z-index",n)}},i.dragHandle?a.handle=i.dragHandle:i.hideTitle||(a.handle="._tv-dialog-title"),i.dragOptions&&$.extend(a,i.dragOptions),o.draggable(r._constrainDraggableOptionsIfNeeded(a)),o)},positionDialog:function(t,e,i){function o(){n.css("margin-left",-Math.round(n.outerWidth()/2)+"px"),n.css("margin-top",-Math.round(n.outerHeight()/2)+"px")}var n,s,a,l,h,c,d,p;i=i||{},e=e||i.position,t?(s=t.width(),a=t.height(),l=$(window).width(),h=$(window).height(),e&&e.top&&e.left?(d=i.forcePosition?e.left:Math.max(2,Math.min(l-s-4,e.left))+"px",c=i.forcePosition?e.top:Math.max(2,Math.min(h-a-4,e.top))+"px"):e&&e.considerScroll?(p=$(document),d=Math.round((l-s)/2+p.scrollLeft())+"px",c=Math.round((h-a)/2+p.scrollTop())+"px"):(d=Math.round((l-s)/2)+"px",c=Math.round((h-a)/2)+"px"),i.fadeIn?t.css({left:d,top:c}).hide().fadeIn("fast"):i.smooth?t.animate({left:d,top:c}):t.css({left:d,top:c})):(t=r.modalDialog,n=t.find("._tv-dialog"),o(),n.resize(o))},applyHandlers:function(t,e){var i,o,n=!t||t===this.modalDialog;e=e||{},i=n?function(){r.destroy()}:function(){r.destroy(t.data("title"))},t=t||r.modalDialog.find("._tv-dialog"),e.beforeDestroy&&t.on("destroy",e.beforeDestroy),t.find("._tv-dialog-title ._tv-dialog-title-close").on("click",i),e.doNotCloseOnBgClick||setTimeout(function(){t.on("mousedownoutside",function(o){var n=$(o.target).parents().andSelf();e.doNotCloseOnBgClickIfShadowbox&&n.is("._tv-dialog-shadowbox")||n.is(".colorpicker, .charts-popup-list, ._tv-dialog, .tvcolorpicker-popup, .symbol-edit-popup, .ui-datepicker, .clockpicker-popover, .pac-container, #global-zeroclipboard-html-bridge")||(t.unbind("mousedownoutside"),i())})},0),t.find('input[type="checkbox"]').change(function(){var t=$(this),e=t.next("._tv-dialog-checkbox-mask");e.toggleClass("disabled",t.prop("disabled")).toggleClass("_tv-dialog-checkbox-mask-active",t.is(":checked"))}),o=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||o.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||$(window).bind("keyup.hideDialog",function(e){if(27===e.keyCode)return t?r.destroy(t.data("title")):r.destroy(),!1}),e.processEnterButton&&$(window).bind("keyup.confirmAndCloseDialog",function(t){13===t.keyCode&&"textarea"!==t.target.tagName.toLowerCase()&&(e.processEnterButton.click(),$(window).unbind("keyup.confirmAndCloseDialog"))})},showError:function(t,e,i){r.showMessage(t,e,$.extend(i||{},{isError:!0}))},showMessage:function(t,e,i){var o,n,s;e||(e=$("._tv-dialog")),i=i||{},o=i.isError&&"_tv-dialog-error"||"_tv-dialog-message",n=e.find("."+o),s=n.find(".message"),i.html?s.html("string"==typeof i.html?i.html:t):s.text(t),s.css("width",e.width()).toggleClass("selectable",!!i.selectable),n.toggleClass("with-close",!!i.withClose).css({marginTop:r.NOTIFICATION_ANIMATION_START_OFFSET,opacity:"0"}).show().animate({marginTop:0,opacity:1},"fast"),i.withClose||n.on("touchstartoutside mousedownoutside keydownoutside",function t(){n.animate({marginTop:r.NOTIFICATION_ANIMATION_START_OFFSET,opacity:0},"fast",function(){n.hide()}),n.off("touchstartoutside mousedownoutside keydownoutside",t)})},isOpen:function(t){for(var e=0;e<r.dialogs.length;e++)if(r.dialogs[e].title===t)return!0;return!1},get:function(t){for(var e=0;e<r.dialogs.length;e++)if(r.dialogs[e].title===t)return r.dialogs[e].dialog},submit:function(t,e){var i=e?$(e):$("._tv-dialog form").first(),o=i.serialize(),n=i.attr("action");$.post(n,o,function(e){void 0!==t&&t(e)},"json")},destroy:function(t,e){if(void 0!==r.chart&&(r.chart.destroy(),delete r.chart),$(window).unbind("keyup.hideDialog"),$(window).unbind("keyup.confirmAndCloseDialog"),t&&"string"==typeof t)for(var i=0;i<r.dialogs.length;i++)r.dialogs[i].title===t&&(r.dialogs[i].dialog.trigger("destroy",e),$(document).unbind("mouseup.hideDialog"+r.dialogs[i].id),$("input",r.dialogs[i].dialog).blur(),r.dialogs[i].dialog.remove(),r.dialogs.splice(i,1));else r.modalDialog&&(r.modalDialog.find("._tv-dialog").trigger("destroy"),r.modalDialog.remove(),r.modalDialog=null)},changeTitle:function(t,e){t&&r.dialogs.forEach(function(i){var o,n;if(i.title===t)return o=i.dialog,n=o.find("._tv-dialog-title"),i.title=e,o.data("title",e),n.html(n.html().replace(t,e)),n.find("a").on("click",function(){r.destroy(e)}),!0})},calcHeight:function(t,e,i){null==i&&(i=20),t+=i;var o=parseInt($("body").height(),10);return t>o&&(e-=t-o,e=Math.max(0,e)),e},resizeContent:function(t,e,i){var o,n;null==i&&(i=20),t+=i,o=parseInt($("body").height(),10),n=e.height(),t>o&&(n-=t-o,n=Math.max(0,n),e.height(n))},resizeContentWidth:function(t,e,i){var o,n;null==i&&(i=20),t+=i,o=parseInt($(window).width(),10),n=e.width(),t>o&&(n-=t-o,n=Math.max(0,n),e.width(n))}};void 0!==s&&s&&s.exports&&(s.exports=r)}).call(e,i(1),i(29),i(69),i(21),i(2)(t))},function(t,e,i){(function(e){"use strict";function i(t){if(this._listeners=new e,this._childs=[],void 0!==t&&null!==t)if(this.isPrimitiveType(t))this._value=t;else for(var i in t)this.addProperty(i,t[i])}i.prototype.merge=function(t){var e,i;if(null!=t)if(this.isPrimitiveType(t))this._value=t;else if(Array.isArray(t))for(e=0;e<t.length;e++)this[e]?this[e].merge(t[e]):this.addProperty(e,t[e]);else for(i in t)this[i]?this[i].merge(t[i]):this.addProperty(i,t[i]);
},i.prototype.state=function(t){var e,i,o,n,s,r=this._value;for(void 0===r&&(r={}),e=0;e<this._childs.length;e++)if(i=this._childs[e],!t||t.indexOf(i)===-1)if(t){for(o=[],n=0;n<t.length;n++)s=t[n],s.startsWith(i+".")&&o.push(s.substr(i.length+1));r[i]=this[i].state(o)}else r[i]=this[i].state();return r},i.prototype.clone=function(t){return new i(this.state())},i.prototype.isPrimitiveType=function(t){return!!isNumber(t)||(!!new TradingView.TypeValidator(String).check(t)||TradingView.isBoolean(t))},i.prototype.value=function(){return this._value},i.prototype.listeners=function(){return this._listeners},i.prototype.childCount=function(){return this._childs.length},i.prototype.setValue=function(t,e){(this._value!==t||e)&&(this._value=t,this._listeners.fire(this))},i.prototype.setValueSilently=function(t){this._value=t},i.prototype.addProperty=function(t,e){var o=new i(e);this[t]=o,this._childs.push(t),o.listeners().subscribe(this,i.prototype.childChanged)},i.prototype.removeProperty=function(t){this[t].listeners().unsubscribe(this,i.prototype.childChanged),delete this[t],this._childs=this._childs.filter(function(e){return e!==t})},i.prototype.addChild=function(t,e){this[t]=e,$.inArray(t,this._childs)===-1&&this._childs.push(t),e.listeners().subscribe(this,i.prototype.childChanged)},i.prototype.childChanged=function(t,e){this.listeners().fire(this)},i.prototype.subscribe=function(t,e){this.listeners().subscribe(t,e)},i.prototype.unsubscribe=function(t,e){this.listeners().unsubscribe(t,e)},t.exports=i}).call(e,i(28))},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 9"><path d="M2 1L1 2l2.5 2.5L1 7l1 1 2.5-2.5L7 8l1-1-2.5-2.5L8 2 7 1 4.5 3.5z"/></svg>'},function(t,e,i){"use strict";TradingView.FeatureToggle={force_prefix:"forcefeaturetoggle.",enableFeature:function(t){TVLocalStorage.setItem(this.force_prefix+t,"true")},disableFeature:function(t){TVLocalStorage.removeItem(this.force_prefix+t)}},TradingView.isFeatureEnabled=function(t){function e(e){return TVLocalStorage.setItem(o+e,Math.random()<=t[e]),TVLocalStorage.getItem(o+e)}function i(t){var e=["alerts-maintenance","backtesting","phone_verification","widgetbar.old-my-ideas","japanese_alerts"];return e.indexOf(t)===-1}var o="featuretoggle.";return TradingView.pushStreamMultiplexer&&TradingView.pushStreamMultiplexer.on("featuretoggle",function(i){t[i.name]=i.state,e(i.name)}),function(n){if("local"===window.environment&&i(n))return!0;if(t[n]&&t[n]===-1)return!1;if("true"===TVLocalStorage.getItem(TradingView.FeatureToggle.force_prefix+n)||window.is_authenticated&&"undefined"!=typeof user&&user&&user.settings&&user.settings[TradingView.FeatureToggle.force_prefix+n])return!0;if(!t[n])return!1;if(1===t[n])return!0;var s=TVLocalStorage.getItem(o+n);return void 0===s||null===s?e(n):"true"===s}}(window.featureToggleState||{}),e.FeatureToggle=TradingView.FeatureToggle,e.isFeatureEnabled=TradingView.isFeatureEnabled},function(t,e){"use strict";!function(t){if(document.createElement("canvas")&&document.createElement("canvas").getContext){var e=function(e){var i=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/i}(document.createElement("canvas").getContext("2d"));e<2||(t.hidpiCanvasRatio=e,function(t){var i=function(t,e){for(var i in t)t.hasOwnProperty(i)&&e(t[i],i)},o={fillRect:"all",clearRect:"all",strokeRect:"all",moveTo:"all",lineTo:"all",arc:[0,1,2],arcTo:"all",bezierCurveTo:"all",isPointinPath:"all",isPointinStroke:"all",quadraticCurveTo:"all",rect:"all",translate:"all",createRadialGradient:"all",createLinearGradient:"all",drawImagePatchedSource:[1,2,3,4],drawImagePatchedSourceAndDest:[1,2,3,4,5,6,7,8]};t.drawImagePatchedSource=t.drawImage,t.drawImagePatchedSourceAndDest=t.drawImage,i(o,function(i,o){var n=t[o];t[o]=function(){var t,o;if("all"===i)for(o=[],t=arguments.length;0<t--;)o[t]=arguments[t]*e;else for(o=Array.prototype.slice.call(arguments),t=i.length;0<t--;)o[i[t]]&&(o[i[t]]=o[i[t]]*e);return n.apply(this,o)}}),t.drawImage=function(t){return function(){return arguments[0]instanceof HTMLCanvasElement?t.drawImagePatchedSourceAndDest.apply(this,arguments):t.drawImagePatchedSource.apply(this,arguments)}}(t),t.fillText=function(t){return function(){var i=Array.prototype.slice.call(arguments);i[1]*=e,i[2]*=e,this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(t,i,o){return i*e+o}),t.apply(this,i),this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(t,i,o){return i/e+o})}}(t.fillText),t.strokeText=function(t){return function(){var i=Array.prototype.slice.call(arguments);i[1]*=e,i[2]*=e,this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(t,i,o){return i*e+o}),t.apply(this,i),this.font=this.font.replace(/(\d+)(px|em|rem|pt)/g,function(t,i,o){return i/e+o})}}(t.strokeText)}(CanvasRenderingContext2D.prototype),function(t){t.getContext=function(t){return function(i){var o=t.call(this,i);return"2d"===i&&this.width!=Math.floor(parseInt(this.style.width)*e)&&(this.style.height=this.height+"px",this.style.width=this.width+"px",this.width*=e,this.height*=e),o}}(t.getContext)}(HTMLCanvasElement.prototype))}}(window)},function(t,e,i){(function(t){"use strict";function o(t,e,i,o,n){function s(t,i,o,n){var r,a=i.split("."),l=a[0];if(e&&e[l]&&(l=e[l]),!t.hasOwnProperty(l)&&n&&n===l)return r=a.splice(1).join("."),void s(t,r,o);if(!t.hasOwnProperty(l))throw Error("illegal path");a.length>1?(r=a.splice(1).join("."),s(t[l],r,o)):t[l]&&t[l].setValue?t[l].setValue(o):t[l]=o}if(void 0!==o&&o)for(var r in o)try{s(t,r,o[r],n)}catch(t){void 0!==i&&i||TradingView.logWarn("Path `"+r+"` does not exist.")}}function n(t,e,i,n){"undefined"!=typeof __defaultsOverrides&&__defaultsOverrides&&o(t,e,i,__defaultsOverrides,n)}function s(){var t=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach(function(e){t.test(e)&&n(TradingView.defaultProperties[e],null,!1,e)})}function r(t,e){return e?l(t,e):a(t)}function a(t){var e,i=g(t);return window._UNIT_TESTS||(e=TradingView.clone(TVSettings.getJSON(t,null)),e&&TradingView.merge(i,e)),i}function l(t,e){var i,o,n=g(t);return window._UNIT_TESTS||(i=TradingView.clone(TVSettings.getJSON(t,null)),t.startsWith("study_")&&i&&u.isVersionHead(i.version)&&(o=e.updateStudyState(i,i),i=o),TradingView.merge(n,i)),n}var h=i(74).LineDataSource,c=i(84),d=i(161),p=i(172).LineToolPitchfork,u=i(148),_=i(114),f=i(59).StudyConsts,g=function(e){var i,o,r,a,l,u,_,g,m={a:function(t,e){return{color:t,visible:e}},b:function(t,e,i){return{coeff:t,color:e,visible:i}},c:function(t,e,i,o,n){return{coeff:t,color:e,visible:i,linestyle:void 0===o?CanvasEx.LINESTYLE_SOLID:o,linewidth:void 0===n?1:n}},d:function(t,e,i){return{color:t,width:i,visible:e}},e:function(t,e,i,o,n){return{color:t,visible:e,width:i,x:o,y:n}},f:function(t,e,i,o,n,s){return{coeff1:t,coeff2:e,color:i,visible:o,linestyle:void 0===n?CanvasEx.LINESTYLE_SOLID:n,linewidth:void 0===s?1:s}}};if(void 0===TradingView.defaultProperties){switch(window.language){case"ru":i="Europe/Moscow";break;case"ja":i="Asia/Tokyo";break;default:i="Etc/UTC"}TradingView.defaultProperties={chartproperties:{timezone:i,timeScale:{barSpacing:TradingView.DEFAULT_BAR_SPACING,rightOffset:TradingView.DEFAULT_RIGHT_OFFSET},dataWindowProperties:{background:"rgba( 255, 254, 206, 0.2)",border:"rgba( 96, 96, 144, 1)",font:"Verdana",fontBold:!1,fontItalic:!1,fontSize:10,transparency:80,visible:!0},paneProperties:{background:"rgba( 255, 255, 255, 1)",gridProperties:{color:"#E6E6E6",style:CanvasEx.LINESTYLE_SOLID},vertGridProperties:{color:"rgba( 230, 230, 230, 1)",style:CanvasEx.LINESTYLE_SOLID},horzGridProperties:{color:"rgba( 230, 230, 230, 1)",style:CanvasEx.LINESTYLE_SOLID},crossHairProperties:{color:"rgba( 183, 183, 183, 1)",style:CanvasEx.LINESTYLE_DASHED,transparency:0,width:1},topMargin:5,bottomMargin:5,leftAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!0},rightAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!0},overlayPropreties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!0},legendProperties:{showStudyArguments:!0,showStudyTitles:!0,showStudyValues:!0,showSeriesTitle:!0,showSeriesOHLC:!0,showLegend:!0}},scalesProperties:{showLeftScale:!1,showRightScale:!0,backgroundColor:"rgba( 255, 255, 255, 1)",lineColor:"rgba( 85, 85, 85, 1)",textColor:"rgba( 85, 85, 85, 1)",fontSize:11,scaleSeriesOnly:!1,showSeriesLastValue:!0,showStudyLastValue:!1,showSymbolLabels:!1,showStudyPlotLabels:!1},mainSeriesProperties:{style:c.STYLE_CANDLES,esdShowDividends:!0,esdShowSplits:!0,esdShowEarnings:!0,esdShowBreaks:!1,esdBreaksStyle:{color:"rgba( 226, 116, 91, 1)",style:CanvasEx.LINESTYLE_DASHED,width:1},esdFlagSize:2,showCountdown:!0,showInDataWindow:!0,visible:!0,silentIntervalChange:!1,showPriceLine:!0,priceLineWidth:1,lockScale:!1,minTick:"default",extendedHours:!1,sessVis:!1,candleStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 115, 115, 117, 1)",wickDownColor:"rgba( 115, 115, 117, 1)",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 115, 115, 117, 1)",wickDownColor:"rgba( 115, 115, 117, 1)"},haStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 115, 115, 117, 1)",wickDownColor:"rgba( 115, 115, 117, 1)",showRealLastPrice:!1,barColorsOnPrevClose:!1},barStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",barColorsOnPrevClose:!1,dontDrawOpen:!1},lineStyle:{color:"rgba( 60, 120, 216, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",styleType:c.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:"rgba( 96, 96, 144, 0.5)",color2:"rgba( 1, 246, 245, 0.5)",linecolor:"rgba( 0, 148, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",transparency:50},priceAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1},renkoStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",upColorProjection:"rgba( 74, 214, 190, 1)",downColorProjection:"rgba( 214, 73, 207, 1)",borderUpColorProjection:"rgba( 34, 84, 55, 1)",borderDownColorProjection:"rgba( 91, 26, 19, 1)",inputs:{source:"close",boxSize:3,style:"ATR",atrLength:14},inputInfo:{source:{name:"Source"},boxSize:{name:"Box size"},style:{name:"Style"},atrLength:{name:"ATR Length"}}},pbStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",upColorProjection:"rgba( 74, 214, 190, 1)",downColorProjection:"rgba( 214, 73, 207, 1)",borderUpColorProjection:"rgba( 34, 84, 55, 1)",borderDownColorProjection:"rgba( 91, 26, 19, 1)",inputs:{source:"close",lb:3},inputInfo:{source:{name:"Source"},lb:{name:"Number of line"}}},kagiStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",upColorProjection:"rgba( 74, 214, 190, 1)",downColorProjection:"rgba( 214, 73, 207, 1)",inputs:{source:"close",style:"Traditional",atrLength:14,reversalAmount:1},inputInfo:{source:{name:"Source"},style:{name:"Style"},atrLength:{name:"ATR Length"},reversalAmount:{name:"Reversal amount"}}},pnfStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",upColorProjection:"rgba( 74, 214, 190, 1)",downColorProjection:"rgba( 214, 73, 207, 1)",inputs:{sources:"HL",reversalAmount:3,boxSize:1,style:"ATR",atrLength:14},inputInfo:{sources:{name:"Source"},boxSize:{name:"Box size"},reversalAmount:{name:"Reversal amount"},style:{name:"Style"},atrLength:{name:"ATR Length"}}}},symbolWatermarkProperties:{color:"rgba( 85, 85, 85, 0.15)",transparency:85},chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"rgba(85, 85, 85, 1)",visible:!1,style:CanvasEx.LINESTYLE_DASHED,width:1}},tradingProperties:{showPositions:!0,showOrders:!0,showExecutions:!0,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:CanvasEx.LINESTYLE_DASHED},alertsProperties:{labels:{visible:!0,color:"rgba( 215, 84, 66, 1)",highlightColor:"rgba( 255, 255, 51, 1)",hoverColor:"rgba( 245, 227, 135, 1)",line:{visible:!0,style:CanvasEx.LINESTYLE_DASHED,width:1}},fakeLabels:{visible:!0,color:"rgba( 119, 119, 119, 1)",line:{visible:!0,style:CanvasEx.LINESTYLE_DASHED,width:1}},drawingIcon:{color:"rgba( 170, 170, 170, 1)"}},editorFontsList:["Verdana","Courier New","Times New Roman","Arial"],volumePaneSize:"large"},drawings:{magnet:!1,stayInDrawingMode:!1,drawOnAllCharts:!0,crossHairColor:"rgba( 183, 183, 183, 1)",crossHairStyle:CanvasEx.LINESTYLE_DASHED,crossHairWidth:1},linetoolorder:{singleChartOnly:!0,extendLeft:"inherit",lineLength:"inherit",lineColor:"rgba( 255, 0, 0, 1)",lineTransparency:0,lineStyle:"inherit",lineWidth:"inherit",bodyBorderColor:"rgba( 255, 0, 0, 0)",bodyBorderTransparency:0,bodyBackgroundColor:"rgba( 255, 255, 255, 0.75)",bodyBackgroundTransparency:25,bodyTextColor:"rgba( 255, 0, 0, 0)",bodyTextTransparency:0,bodyFontFamily:"Verdana",bodyFontSize:7,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderColor:"rgba( 255, 0, 0, 0)",quantityBorderTransparency:0,quantityBackgroundColor:"rgba( 255, 0, 0, 0.75)",quantityBackgroundTransparency:25,quantityTextColor:"rgba( 255, 255, 255, 1)",quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:7,quantityFontBold:!0,quantityFontItalic:!1,cancelButtonBorderColor:"rgba( 255, 0, 0, 1)",cancelButtonBorderTransparency:0,cancelButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",cancelButtonBackgroundTransparency:25,cancelButtonIconColor:"rgba( 255, 0, 0, 1)",cancelButtonIconTransparency:0,tooltip:""},linetoolposition:{singleChartOnly:!0,extendLeft:"inherit",lineLength:"inherit",lineColor:"rgba( 0, 113, 224, 1)",lineTransparency:0,lineStyle:"inherit",lineWidth:"inherit",bodyBorderColor:"rgba( 0, 113, 224, 1)",bodyBorderTransparency:0,bodyBackgroundColor:"rgba( 255, 255, 255, 0.75)",bodyBackgroundTransparency:25,bodyTextColor:"rgba( 0, 113, 224, 1)",bodyTextTransparency:0,bodyFontFamily:"Verdana",bodyFontSize:7,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderColor:"rgba( 0, 113, 224, 1)",quantityBorderTransparency:0,quantityBackgroundColor:"rgba( 0, 113, 224, 0.75)",quantityBackgroundTransparency:25,quantityTextColor:"rgba( 255, 255, 255, 1)",quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:7,quantityFontBold:!0,quantityFontItalic:!1,reverseButtonBorderColor:"rgba( 0, 113, 224, 1)",reverseButtonBorderTransparency:0,reverseButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",reverseButtonBackgroundTransparency:25,reverseButtonIconColor:"rgba( 0, 113, 224, 1)",reverseButtonIconTransparency:0,closeButtonBorderColor:"rgba( 0, 113, 224, 1)",closeButtonBorderTransparency:0,closeButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",closeButtonBackgroundTransparency:25,closeButtonIconColor:"rgba( 0, 113, 224, 1)",closeButtonIconTransparency:0,tooltip:""},linetoolexecution:{singleChartOnly:!0,direction:"buy",arrowHeight:8,arrowSpacing:1,arrowColor:"rgba( 0, 0, 255, 1)",arrowTransparency:0,text:"",textColor:"rgba( 0, 0, 0, 1)",textTransparency:0,fontFamily:"Verdana",fontSize:8,fontBold:!1,fontItalic:!1,tooltip:""},linetoolicon:{singleChartOnly:!0,clonable:!0,color:"rgba( 61, 133, 198, 1)",snapTo45Degrees:!0,size:40,icon:9786,angle:.5*Math.PI,scale:1},linetoolbezierquadro:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,fillBackground:!1,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_NORMAL},linetoolbeziercubic:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,fillBackground:!1,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_NORMAL},linetooltrendline:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,snapTo45Degrees:!0,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1},linetooltimecycles:{clonable:!0,linecolor:"rgba(21, 153, 128, 1)",linewidth:1,fillBackground:!0,backgroundColor:"rgba(106, 168, 79, 0.5)",transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID},linetoolsineline:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetooltrendangle:{singleChartOnly:!0,clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,snapTo45Degrees:!0,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!0,italic:!1,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,extendRight:!1,extendLeft:!1},linetooldisjointangle:{clonable:!0,linecolor:"rgba( 18, 159, 92, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"rgba( 106, 168, 79, 0.5)",transparency:50,extendLeft:!1,extendRight:!1,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 18, 159, 92, 1)",fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1},linetoolflatbottom:{clonable:!0,linecolor:"rgba( 73, 133, 231, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,extendLeft:!1,extendRight:!1,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 73, 133, 231, 1)",fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1},linetoolfibspiral:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetooldaterange:{clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 91, 133, 191, 0.9)",labelBackgroundTransparency:30,fillBackground:!0,backgroundColor:"rgba( 186, 218, 255, 0.4)",backgroundTransparency:60,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetoolpricerange:{clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 91, 133, 191, 0.9)",labelBackgroundTransparency:30,fillBackground:!0,backgroundColor:"rgba( 186, 218, 255, 0.4)",backgroundTransparency:60,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetooldateandpricerange:{clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 91, 133, 191, 0.9)",labelBackgroundTransparency:30,fillBackground:!0,backgroundColor:"rgba( 186, 218, 255, 0.4)",backgroundTransparency:60,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetoolriskrewardshort:{isShort:!0,clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba(255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 88, 88, 88, 1)",labelBackgroundTransparency:0,fillBackground:!0,stopBackground:"rgba( 255, 0, 0, 0.2)",profitBackground:"rgba( 0, 160, 0, 0.2)",stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetoolriskrewardlong:{isShort:!1,clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba(255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 88, 88, 88, 1)",labelBackgroundTransparency:0,fillBackground:!0,stopBackground:"rgba( 255, 0, 0, 0.2)",profitBackground:"rgba( 0, 160, 0, 0.2)",stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetoolarrow:{clonable:!0,linecolor:"rgba( 111, 136, 198, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_ARROW,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1},linetoolray:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!0,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1},linetoolextended:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!0,extendRight:!0,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1},linetoolhorzline:{clonable:!0,linecolor:"rgba( 128, 204, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showLabel:!1,text:"",font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolhorzray:{clonable:!0,linecolor:"rgba( 128, 204, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showLabel:!1,text:"",font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{clonable:!0,linecolor:"rgba( 128, 204, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showTime:!0},linetoolcirclelines:{clonable:!0,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},linecolor:"rgba( 128, 204, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetoolfibtimezone:{horzLabelsAlign:"right",vertLabelsAlign:"bottom",clonable:!0,baselinecolor:"rgba( 128, 128, 128, 1)",linecolor:"rgba( 0, 85, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showLabels:!0,font:"Verdana",fillBackground:!1,transparency:80,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:m.c(0,"rgba( 128, 128, 128, 1)",!0),level2:m.c(1,"rgba( 0, 85, 219, 1)",!0),level3:m.c(2,"rgba( 0, 85, 219, 1)",!0),level4:m.c(3,"rgba( 0, 85, 219, 1)",!0),level5:m.c(5,"rgba( 0, 85, 219, 1)",!0),level6:m.c(8,"rgba( 0, 85, 219, 1)",!0),level7:m.c(13,"rgba( 0, 85, 219, 1)",!0),level8:m.c(21,"rgba( 0, 85, 219, 1)",!0),level9:m.c(34,"rgba( 0, 85, 219, 1)",!0),level10:m.c(55,"rgba( 0, 85, 219, 1)",!0),level11:m.c(89,"rgba( 0, 85, 219, 1)",!0),__collectibleLines:["trendline","level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11"]},linetooltext:{clonable:!0,color:"rgba( 102, 123, 139, 1)",text:$.t("Text"),font:"Verdana",fontsize:20,fillBackground:!1,backgroundColor:"rgba( 91, 133, 191, 0.9)",backgroundTransparency:70,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)",bold:!1,italic:!1,locked:!1,fixedSize:!0,wordWrap:!1,wordWrapWidth:400},linetooltextabsolute:{singleChartOnly:!0,clonable:!0,color:"rgba( 102, 123, 139, 1)",text:$.t("Text"),font:"Verdana",fontsize:20,fillBackground:!1,backgroundColor:"rgba( 155, 190, 213, 0.3)",backgroundTransparency:70,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)",bold:!1,italic:!1,locked:!0,wordWrap:!1,wordWrapWidth:400},linetoolballoon:{clonable:!0,color:"rgba( 102, 123, 139, 1)",backgroundColor:"rgba( 255, 254, 206, 0.7)",borderColor:"rgba( 140, 140, 140, 1)",fontWeight:"bold",fontsize:12,font:"Arial",transparency:30,text:$.t("Comment")},linetoolbrush:{clonable:!0,linecolor:"rgba( 53, 53, 53, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,smooth:5,fillBackground:!1,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,leftEnd:h.LINEEND_NORMAL,rightEnd:h.LINEEND_NORMAL},linetoolpolyline:{clonable:!0,linecolor:"rgba( 53, 53, 53, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,filled:!1},linetoolarrowmark:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkleft:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkup:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkright:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkdown:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolflagmark:{clonable:!0,color:"rgba( 255, 0, 0, 1)"},linetoolnote:{clonable:!0,markerColor:"rgba( 46, 102, 255, 1)",textColor:"rgba( 0, 0, 0, 1)",backgroundColor:"rgba( 255, 255, 255, 1)",backgroundTransparency:0,text:$.t("Text"),font:"Arial",fontSize:12,bold:!1,italic:!1,locked:!1,fixedSize:!0},linetoolnoteabsolute:{singleChartOnly:!0,clonable:!0,markerColor:"rgba( 46, 102, 255, 1)",textColor:"rgba( 0, 0, 0, 1)",backgroundColor:"rgba( 255, 255, 255, 1)",backgroundTransparency:0,text:$.t("Text"),font:"Arial",fontSize:12,bold:!1,italic:!1,locked:!0,fixedSize:!0},linetoolthumbup:{clonable:!0,color:"rgba( 0, 128, 0, 1)"},linetoolthumbdown:{clonable:!0,color:"rgba( 255, 0, 0, 1)"},linetoolpricelabel:{clonable:!0,color:"rgba( 102, 123, 139, 1)",backgroundColor:"rgba( 255, 255, 255, 0.7)",borderColor:"rgba( 140, 140, 140, 1)",fontWeight:"bold",fontsize:11,font:"Arial",transparency:30},linetoolrectangle:{clonable:!0,color:"rgba( 21, 56, 153, 1)",fillBackground:!0,backgroundColor:"rgba( 21, 56, 153, 0.5)",linewidth:1,snapTo45Degrees:!0,transparency:50},linetoolrotatedrectangle:{clonable:!0,color:"rgba( 152, 0, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 142, 124, 195, 0.5)",transparency:50,linewidth:1,snapTo45Degrees:!0},linetoolellipse:{clonable:!0,color:"rgba( 153, 153, 21, 1)",fillBackground:!0,backgroundColor:"rgba( 153, 153, 21, 0.5)",transparency:50,linewidth:1},linetoolarc:{clonable:!0,color:"rgba( 153, 153, 21, 1)",fillBackground:!0,backgroundColor:"rgba( 153, 153, 21, 0.5)",transparency:50,linewidth:1},linetoolprediction:{singleChartOnly:!0,linecolor:"rgba( 28, 115, 219, 1)",linewidth:2,sourceBackColor:"rgba( 241, 241, 241, 1)",sourceTextColor:"rgba( 110, 110, 110, 1)",sourceStrokeColor:"rgba( 110, 110, 110, 1)",targetStrokeColor:"rgba( 47, 168, 255, 1)",targetBackColor:"rgba( 11, 111, 222, 1)",targetTextColor:"rgba( 255, 255, 255, 1)",successBackground:"rgba( 54, 160, 42, 0.9)",successTextColor:"rgba( 255, 255, 255, 1)",failureBackground:"rgba( 231, 69, 69, 0.5)",failureTextColor:"rgba( 255, 255, 255, 1)",intermediateBackColor:"rgba( 234, 210, 137, 1)",intermediateTextColor:"rgba( 109, 77, 34, 1)",transparency:10,centersColor:"rgba( 32, 32, 32, 1)"},linetooltriangle:{clonable:!0,color:"rgba( 153, 21, 21, 1)",fillBackground:!0,backgroundColor:"rgba( 153, 21, 21, 0.5)",transparency:50,linewidth:1},linetoolcallout:{clonable:!0,color:"rgba( 255, 255, 255, 1)",backgroundColor:"rgba( 153, 21, 21, 0.5)",transparency:50,linewidth:2,fontsize:12,font:"Verdana",text:$.t("Text"),bordercolor:"rgba( 153, 21, 21, 1)",bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:400},linetoolparallelchannel:{clonable:!0,linecolor:"rgba( 119, 52, 153, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:"rgba( 180, 167, 214, 0.5)",transparency:50,showMidline:!1,midlinecolor:"rgba( 119, 52, 153, 1)",midlinewidth:1,midlinestyle:CanvasEx.LINESTYLE_DASHED},linetoolelliottimpulse:{degree:7,clonable:!0,showWave:!0,color:"rgba( 61, 133, 198, 1)",linewidth:1},linetoolelliotttriangle:{degree:7,clonable:!0,showWave:!0,color:"rgba( 255, 152, 0, 1)",linewidth:1},linetoolelliotttriplecombo:{degree:7,clonable:!0,showWave:!0,color:"rgba( 106, 168, 79, 1)",linewidth:1},linetoolelliottcorrection:{degree:7,clonable:!0,showWave:!0,color:"rgba( 61, 133, 198, 1)",linewidth:1},linetoolelliottdoublecombo:{degree:7,clonable:!0,showWave:!0,color:"rgba( 106, 168, 79, 1)",linewidth:1},linetoolbarspattern:{singleChartOnly:!0,color:"rgba( 80, 145, 204, 1)",clonable:!0,mode:d.BARS_MODE,mirrored:!1,flipped:!1},linetoolghostfeed:{singleChartOnly:!0,clonable:!0,averageHL:20,variance:50,candleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375"},transparency:50},study:{inputs:{},styles:{},palettes:{},bands:{},area:{},graphics:{},showInDataWindow:!0,visible:!0,showStudyArguments:!0,precision:"default"},linetoolpitchfork:{clonable:!0,fillBackground:!0,transparency:80,style:p.STYLE_ORIGINAL,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:m.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:m.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:m.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:m.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:m.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:m.c(1,"rgba( 0, 0, 153, 1)",!0),level6:m.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:m.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:m.c(2,"rgba( 165, 0, 0, 1)",!1),__collectibleLines:["median","level0","level1","level2","level3","level4","level5","level6","level7","level8"]},linetoolpitchfan:{clonable:!0,fillBackground:!0,transparency:80,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:m.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:m.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:m.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:m.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:m.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:m.c(1,"rgba( 0, 0, 153, 1)",!0),level6:m.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:m.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:m.c(2,"rgba( 165, 0, 0, 1)",!1),__collectibleLines:["median","level0","level1","level2","level3","level4","level5","level6","level7","level8"]},linetoolgannfan:{clonable:!0,showLabels:!0,font:"Verdana",fillBackground:!0,transparency:80,level1:m.f(1,8,"rgba( 160, 107, 0, 1)",!0),level2:m.f(1,4,"rgba( 105, 158, 0, 1)",!0),level3:m.f(1,3,"rgba( 0, 155, 0, 1)",!0),level4:m.f(1,2,"rgba( 0, 153, 101, 1)",!0),level5:m.f(1,1,"rgba( 128, 128, 128, 1)",!0),level6:m.f(2,1,"rgba( 0, 101, 153, 1)",!0),level7:m.f(3,1,"rgba( 0, 0, 153, 1)",!0),level8:m.f(4,1,"rgba( 102, 0, 153, 1)",!0),level9:m.f(8,1,"rgba( 165, 0, 0, 1)",!0),__collectibleLines:["level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11"]},linetoolganncomplex:{clonable:!0,fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},levels:[m.d("rgba( 128, 128, 128, 1)",!0,1),m.d("rgba( 160, 107, 0, 1)",!0,1),m.d("rgba( 105, 158, 0, 1)",!0,1),m.d("rgba( 0, 155, 0, 1)",!0,1),m.d("rgba( 0, 153, 101, 1)",!0,1),m.d("rgba( 128, 128, 128, 1)",!0,1)],fanlines:[m.e("rgba( 165, 0, 255, 1)",!1,1,8,1),m.e("rgba( 165, 0, 0, 1)",!1,1,5,1),m.e("rgba( 128, 128, 128, 1)",!1,1,4,1),m.e("rgba( 160, 107, 0, 1)",!1,1,3,1),m.e("rgba( 105, 158, 0, 1)",!0,1,2,1),m.e("rgba( 0, 155, 0, 1)",!0,1,1,1),m.e("rgba( 0, 153, 101, 1)",!0,1,1,2),m.e("rgba( 0, 153, 101, 1)",!1,1,1,3),m.e("rgba( 0, 0, 153, 1)",!1,1,1,4),m.e("rgba( 102, 0, 153, 1)",!1,1,1,5),m.e("rgba( 165, 0, 255, 1)",!1,1,1,8)],
arcs:[m.e("rgba( 160, 107, 0, 1)",!0,1,1,0),m.e("rgba( 160, 107, 0, 1)",!0,1,1,1),m.e("rgba( 160, 107, 0, 1)",!0,1,1.5,0),m.e("rgba( 105, 158, 0, 1)",!0,1,2,0),m.e("rgba( 105, 158, 0, 1)",!0,1,2,1),m.e("rgba( 0, 155, 0, 1)",!0,1,3,0),m.e("rgba( 0, 155, 0, 1)",!0,1,3,1),m.e("rgba( 0, 153, 101, 1)",!0,1,4,0),m.e("rgba( 0, 153, 101, 1)",!0,1,4,1),m.e("rgba( 0, 0, 153, 1)",!0,1,5,0),m.e("rgba( 0, 0, 153, 1)",!0,1,5,1)],__collectibleLines:["trendline","levels.0","levels.1","levels.2","levels.3","levels.4","levels.5","fanlines.0","fanlines.1","fanlines.2","fanlines.3","fanlines.4","fanlines.5","fanlines.6","fanlines.7","fanlines.8","fanlines.9","fanlines.10","arcs.0","arcs.1","arcs.2","arcs.3","arcs.4","arcs.5","arcs.6","arcs.7","arcs.8","arcs.9","arcs.10"]},linetoolgannsquare:{clonable:!0,color:"rgba( 21, 56, 153, 0.8)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,font:"Verdana",showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,hlevel1:m.b(0,"rgba( 128, 128, 128, 1)",!0),hlevel2:m.b(.25,"rgba( 160, 107, 0, 1)",!0),hlevel3:m.b(.382,"rgba( 105, 158, 0, 1)",!0),hlevel4:m.b(.5,"rgba( 0, 155, 0, 1)",!0),hlevel5:m.b(.618,"rgba( 0, 153, 101, 1)",!0),hlevel6:m.b(.75,"rgba( 0, 101, 153, 1)",!0),hlevel7:m.b(1,"rgba( 128, 128, 128, 1)",!0),vlevel1:m.b(0,"rgba( 128, 128, 128, 1)",!0),vlevel2:m.b(.25,"rgba( 160, 107, 0, 1)",!0),vlevel3:m.b(.382,"rgba( 105, 158, 0, 1)",!0),vlevel4:m.b(.5,"rgba( 0, 155, 0, 1)",!0),vlevel5:m.b(.618,"rgba( 0, 153, 101, 1)",!0),vlevel6:m.b(.75,"rgba( 0, 101, 153, 1)",!0),vlevel7:m.b(1,"rgba( 128, 128, 128, 1)",!0),__collectibleLines:["hlevel1","hlevel2","hlevel3","hlevel4","hlevel5","hlevel6","hlevel7","vlevel1","vlevel2","vlevel3","vlevel4","vlevel5","vlevel6","vlevel7"]},linetoolfibspeedresistancefan:{clonable:!0,fillBackground:!0,transparency:80,grid:{color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,visible:!0},linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,font:"Verdana",showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,snapTo45Degrees:!0,hlevel1:m.b(0,"rgba( 128, 128, 128, 1)",!0),hlevel2:m.b(.25,"rgba( 160, 107, 0, 1)",!0),hlevel3:m.b(.382,"rgba( 105, 158, 0, 1)",!0),hlevel4:m.b(.5,"rgba( 0, 155, 0, 1)",!0),hlevel5:m.b(.618,"rgba( 0, 153, 101, 1)",!0),hlevel6:m.b(.75,"rgba( 0, 101, 153, 1)",!0),hlevel7:m.b(1,"rgba( 128, 128, 128, 1)",!0),vlevel1:m.b(0,"rgba( 128, 128, 128, 1)",!0),vlevel2:m.b(.25,"rgba( 160, 107, 0, 1)",!0),vlevel3:m.b(.382,"rgba( 105, 158, 0, 1)",!0),vlevel4:m.b(.5,"rgba( 0, 155, 0, 1)",!0),vlevel5:m.b(.618,"rgba( 0, 153, 101, 1)",!0),vlevel6:m.b(.75,"rgba( 0, 101, 153, 1)",!0),vlevel7:m.b(1,"rgba( 128, 128, 128, 1)",!0),__collectibleLines:["trendline","hlevel1","hlevel2","hlevel3","hlevel4","hlevel5","hlevel6","hlevel7","vlevel1","vlevel2","vlevel3","vlevel4","vlevel5","vlevel6","vlevel7"]},linetoolfibretracement:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,transparency:80,extendLines:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",reverse:!1,coeffsAsPercents:!1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:m.b(0,"rgba( 128, 128, 128, 1)",!0),level2:m.b(.236,"rgba( 204, 40, 40, 1)",!0),level3:m.b(.382,"rgba( 149, 204, 40, 1)",!0),level4:m.b(.5,"rgba( 40, 204, 40, 1)",!0),level5:m.b(.618,"rgba( 40, 204, 149, 1)",!0),level6:m.b(.786,"rgba( 40, 149, 204, 1)",!0),level7:m.b(1,"rgba( 128, 128, 128, 1)",!0),level8:m.b(1.618,"rgba( 40, 40, 204, 1)",!0),level9:m.b(2.618,"rgba( 204, 40, 40, 1)",!0),level10:m.b(3.618,"rgba( 149, 40, 204, 1)",!0),level11:m.b(4.236,"rgba( 204, 40, 149, 1)",!0),level12:m.b(1.272,"rgba( 149, 204, 40, 1)",!1),level13:m.b(1.414,"rgba( 204, 40, 40, 1)",!1),level16:m.b(2,"rgba( 40, 204, 149, 1)",!1),level14:m.b(2.272,"rgba( 149, 204, 40, 1)",!1),level15:m.b(2.414,"rgba( 40, 204, 40, 1)",!1),level17:m.b(3,"rgba( 40, 149, 204, 1)",!1),level18:m.b(3.272,"rgba( 128, 128, 128, 1)",!1),level19:m.b(3.414,"rgba( 40, 40, 204, 1)",!1),level20:m.b(4,"rgba( 204, 40, 40, 1)",!1),level21:m.b(4.272,"rgba( 149, 40, 204, 1)",!1),level22:m.b(4.414,"rgba( 204, 40, 149, 1)",!1),level23:m.b(4.618,"rgba( 149, 204, 40, 1)",!1),level24:m.b(4.764,"rgba( 40, 204, 149, 1)",!1),__collectibleLines:["trendline","level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11","level12","level13","level14","level15","level16","level17","level18","level19","level20","level21","level22","level23","level24"]},linetoolfibchannel:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,transparency:80,extendLeft:!1,extendRight:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",coeffsAsPercents:!1,levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:m.b(0,"rgba( 128, 128, 128, 1)",!0),level2:m.b(.236,"rgba( 204, 40, 40, 1)",!0),level3:m.b(.382,"rgba( 149, 204, 40, 1)",!0),level4:m.b(.5,"rgba( 40, 204, 40, 1)",!0),level5:m.b(.618,"rgba( 40, 204, 149, 1)",!0),level6:m.b(.786,"rgba( 40, 149, 204, 1)",!0),level7:m.b(1,"rgba( 128, 128, 128, 1)",!0),level8:m.b(1.618,"rgba( 40, 40, 204, 1)",!0),level9:m.b(2.618,"rgba( 204, 40, 40, 1)",!0),level10:m.b(3.618,"rgba( 149, 40, 204, 1)",!0),level11:m.b(4.236,"rgba( 204, 40, 149, 1)",!0),level12:m.b(1.272,"rgba( 149, 204, 40, 1)",!1),level13:m.b(1.414,"rgba( 204, 40, 40, 1)",!1),level16:m.b(2,"rgba( 40, 204, 149, 1)",!1),level14:m.b(2.272,"rgba( 149, 204, 40, 1)",!1),level15:m.b(2.414,"rgba( 40, 204, 40, 1)",!1),level17:m.b(3,"rgba( 40, 149, 204, 1)",!1),level18:m.b(3.272,"rgba( 128, 128, 128, 1)",!1),level19:m.b(3.414,"rgba( 40, 40, 204, 1)",!1),level20:m.b(4,"rgba( 204, 40, 40, 1)",!1),level21:m.b(4.272,"rgba( 149, 40, 204, 1)",!1),level22:m.b(4.414,"rgba( 204, 40, 149, 1)",!1),level23:m.b(4.618,"rgba( 149, 204, 40, 1)",!1),level24:m.b(4.764,"rgba( 40, 204, 149, 1)",!1),__collectibleLines:["level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11","level12","level13","level14","level15","level16","level17","level18","level19","level20","level21","level22","level23","level24"]},linetoolprojection:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,color1:"rgba( 0, 128, 0, 0.2)",color2:"rgba( 255, 0, 0, 0.2)",linewidth:1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linestyle:CanvasEx.LINESTYLE_SOLID},level1:m.c(1,"rgba( 128, 128, 128, 1)",!0)},linetool5pointspattern:{clonable:!0,color:"rgba( 204, 40, 149, 1)",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 204, 40, 149, 0.5)",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:1},linetoolcypherpattern:{clonable:!0,color:"#CC2895",textcolor:"#FFFFFF",fillBackground:!0,backgroundColor:"#CC2895",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:1},linetooltrianglepattern:{clonable:!0,color:"rgba( 149, 40, 255, 1)",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 149, 40, 204, 0.5)",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:1},linetoolabcd:{clonable:!0,color:"rgba( 0, 155, 0, 1)",textcolor:"rgba( 255, 255, 255, 1)",font:"Verdana",fontsize:12,bold:!1,italic:!1,linewidth:2},linetoolthreedrivers:{clonable:!0,color:"rgba( 149, 40, 255, 1)",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 149, 40, 204, 0.5)",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolheadandshoulders:{clonable:!0,color:"rgba( 69, 104, 47, 1)",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 69, 168, 47, 0.5)",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolfibwedge:{singleChartOnly:!0,clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:m.c(.236,"rgba( 204, 40, 40, 1)",!0),level2:m.c(.382,"rgba( 149, 204, 40, 1)",!0),level3:m.c(.5,"rgba( 40, 204, 40, 1)",!0),level4:m.c(.618,"rgba( 40, 204, 149, 1)",!0),level5:m.c(.786,"rgba( 40, 149, 204, 1)",!0),level6:m.c(1,"rgba( 128, 128, 128, 1)",!0),level7:m.c(1.618,"rgba( 40, 40, 204, 1)",!1),level8:m.c(2.618,"rgba( 204, 40, 40, 1)",!1),level9:m.c(3.618,"rgba( 149, 40, 204, 1)",!1),level10:m.c(4.236,"rgba( 204, 40, 149, 1)",!1),level11:m.c(4.618,"rgba( 204, 40, 149, 1)",!1),__collectibleLines:["trendline","level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11"]},linetoolfibcircles:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,snapTo45Degrees:!0,coeffsAsPercents:!1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:m.c(.236,"rgba( 204, 40, 40, 1)",!0),level2:m.c(.382,"rgba( 149, 204, 40, 1)",!0),level3:m.c(.5,"rgba( 40, 204, 40, 1)",!0),level4:m.c(.618,"rgba( 40, 204, 149, 1)",!0),level5:m.c(.786,"rgba( 40, 149, 204, 1)",!0),level6:m.c(1,"rgba( 128, 128, 128, 1)",!0),level7:m.c(1.618,"rgba( 40, 40, 204, 1)",!0),level8:m.c(2.618,"rgba( 204, 40, 40, 1)",!0),level9:m.c(3.618,"rgba( 149, 40, 204, 1)",!0),level10:m.c(4.236,"rgba( 204, 40, 149, 1)",!0),level11:m.c(4.618,"rgba( 204, 40, 149, 1)",!0),__collectibleLines:["trendline","level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11"]},linetoolfibspeedresistancearcs:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,fullCircles:!1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:m.c(.236,"rgba( 204, 40, 40, 1)",!0),level2:m.c(.382,"rgba( 149, 204, 40, 1)",!0),level3:m.c(.5,"rgba( 40, 204, 40, 1)",!0),level4:m.c(.618,"rgba( 40, 204, 149, 1)",!0),level5:m.c(.786,"rgba( 40, 149, 204, 1)",!0),level6:m.c(1,"rgba( 128, 128, 128, 1)",!0),level7:m.c(1.618,"rgba( 40, 40, 204, 1)",!0),level8:m.c(2.618,"rgba( 204, 40, 40, 1)",!0),level9:m.c(3.618,"rgba( 149, 40, 204, 1)",!0),level10:m.c(4.236,"rgba( 204, 40, 149, 1)",!0),level11:m.c(4.618,"rgba( 204, 40, 149, 1)",!0),__collectibleLines:["trendline","level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11"]},linetooltrendbasedfibextension:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,transparency:80,extendLines:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",reverse:!1,coeffsAsPercents:!1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:m.b(0,"rgba( 128, 128, 128, 1)",!0),level2:m.b(.236,"rgba( 204, 40, 40, 1)",!0),level3:m.b(.382,"rgba( 149, 204, 40, 1)",!0),level4:m.b(.5,"rgba( 40, 204, 40, 1)",!0),level5:m.b(.618,"rgba( 40, 204, 149, 1)",!0),level6:m.b(.786,"rgba( 40, 149, 204, 1)",!0),level7:m.b(1,"rgba( 128, 128, 128, 1)",!0),level8:m.b(1.618,"rgba( 40, 40, 204, 1)",!0),level9:m.b(2.618,"rgba( 204, 40, 40, 1)",!0),level10:m.b(3.618,"rgba( 149, 40, 204, 1)",!0),level11:m.b(4.236,"rgba( 204, 40, 149, 1)",!0),level12:m.b(1.272,"rgba( 149, 204, 40, 1)",!1),level13:m.b(1.414,"rgba( 204, 40, 40, 1)",!1),level16:m.b(2,"rgba( 40, 204, 149, 1)",!1),level14:m.b(2.272,"rgba( 149, 204, 40, 1)",!1),level15:m.b(2.414,"rgba( 40, 204, 40, 1)",!1),level17:m.b(3,"rgba( 40, 149, 204, 1)",!1),level18:m.b(3.272,"rgba( 128, 128, 128, 1)",!1),level19:m.b(3.414,"rgba( 40, 40, 204, 1)",!1),level20:m.b(4,"rgba( 204, 40, 40, 1)",!1),level21:m.b(4.272,"rgba( 149, 40, 204, 1)",!1),level22:m.b(4.414,"rgba( 204, 40, 149, 1)",!1),level23:m.b(4.618,"rgba( 149, 204, 40, 1)",!1),level24:m.b(4.764,"rgba( 40, 204, 149, 1)",!1),__collectibleLines:["trendline","level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11","level12","level13","level14","level15","level16","level17","level18","level19","level20","level21","level22","level23","level24"]},linetooltrendbasedfibtime:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:m.c(0,"rgba( 128, 128, 128, 1)",!0),level2:m.c(.382,"rgba( 204, 40, 40, 1)",!0),level3:m.c(.5,"rgba( 149, 204, 40, 1)",!1),level4:m.c(.618,"rgba( 40, 204, 40, 1)",!0),level5:m.c(1,"rgba( 40, 204, 149, 1)",!0),level6:m.c(1.382,"rgba( 40, 149, 204, 1)",!0),level7:m.c(1.618,"rgba( 128, 128, 128, 1)",!0),level8:m.c(2,"rgba( 40, 40, 204, 1)",!0),level9:m.c(2.382,"rgba( 204, 40, 40, 1)",!0),level10:m.c(2.618,"rgba( 149, 40, 204, 1)",!0),level11:m.c(3,"rgba( 204, 40, 149, 1)",!0),__collectibleLines:["trendline","level1","level2","level3","level4","level5","level6","level7","level8","level9","level10","level11"]},linetoolschiffpitchfork:{clonable:!0,fillBackground:!0,transparency:80,style:p.STYLE_SCHIFF,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:m.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:m.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:m.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:m.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:m.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:m.c(1,"rgba( 0, 0, 153, 1)",!0),level6:m.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:m.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:m.c(2,"rgba( 165, 0, 0, 1)",!1),__collectibleLines:["median","level0","level1","level2","level3","level4","level5","level6","level7","level8"]},linetoolschiffpitchfork2:{clonable:!0,fillBackground:!0,transparency:80,style:p.STYLE_SCHIFF2,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:m.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:m.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:m.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:m.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:m.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:m.c(1,"rgba( 0, 0, 153, 1)",!0),level6:m.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:m.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:m.c(2,"rgba( 165, 0, 0, 1)",!1),__collectibleLines:["median","level0","level1","level2","level3","level4","level5","level6","level7","level8"]},linetoolinsidepitchfork:{clonable:!0,fillBackground:!0,transparency:80,style:p.STYLE_INSIDE,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:m.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:m.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:m.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:m.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:m.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:m.c(1,"rgba( 0, 0, 153, 1)",!0),level6:m.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:m.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:m.c(2,"rgba( 165, 0, 0, 1)",!1),__collectibleLines:["median","level0","level1","level2","level3","level4","level5","level6","level7","level8"]},linetool:{frozen:!1,visible:!0},linetoolvisibilities:{intervalsVisibilities:{seconds:!0,secondsFrom:1,secondsTo:59,minutes:!0,minutesFrom:1,minutesTo:59,hours:!0,hoursFrom:1,hoursTo:24,days:!0,daysFrom:1,daysTo:366,weeks:!0,months:!0}}},n(TradingView.defaultProperties.chartproperties),s()}for(void 0===TradingView.defaultProperties["study_MA@tv-basicstudies"]&&(TradingView.defaultProperties["study_MA@tv-basicstudies"]={description:"Moving Average",shortDescription:"MA",inputs:{length:9,source:"close"},styles:{MovAvg:{visible:!0,color:"rgba( 4, 150, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:f.PLOT_LINE,histogramBase:0,title:"MA"}}}),void 0===TradingView.defaultProperties["study_ErrorOnUpdate@tv-basicstudies"]&&(TradingView.defaultProperties["study_ErrorOnUpdate@tv-basicstudies"]={description:"Error On Update",styles:{ErrorOnUpdate:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:f.PLOT_LINE,histogramBase:0}}}),void 0===TradingView.defaultProperties["study_ErrorOnCreate@tv-basicstudies"]&&(TradingView.defaultProperties["study_ErrorOnCreate@tv-basicstudies"]={description:"Error On Create",styles:{ErrorOnUpdate:{visible:!0,color:"rgba( 0, 255, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:f.PLOT_LINE,histogramBase:0}}}),void 0===TradingView.defaultProperties["study_ErrorOnNewBar@tv-basicstudies"]&&(TradingView.defaultProperties["study_ErrorOnNewBar@tv-basicstudies"]={description:"Error On New Bar",styles:{ErrorOnUpdate:{visible:!0,color:"rgba( 0, 0, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:f.PLOT_LINE,histogramBase:0}}}),void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={font:"Arial",fontsize:10,borderColor:"rgba( 83, 143, 31, 1)",backColor:"rgba( 240, 255, 204, 1)",textColor:"rgba( 0, 0, 0, 1)"}),void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]&&(o="rgba( 212, 121, 40, 1)",r=!0,a=1,TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,font:"Arial",fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:r,"S1/R1":r,"S2/R2":r,"S3/R3":r,"S4/R4":r,"S5/R5":r},colors:{P:o,"S1/R1":o,"S2/R2":o,"S3/R3":o,"S4/R4":o,"S5/R5":o},widths:{P:a,"S1/R1":a,"S2/R2":a,"S3/R3":a,"S4/R4":a,"S5/R5":a}}}),void 0===TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]&&(TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]={color:"rgba( 86, 135, 29, 1)",linewidth:2}),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:m.a("rgba( 255, 0, 0, 1)",!1),level1:m.a("rgba( 0, 128, 0, 1)",!1),level2:m.a("rgba( 0, 0, 255, 1)",!1),level3:m.a("rgba( 255, 0, 255, 1)",!1),level4:m.a("rgba( 0, 128, 255, 1)",!0),level5:m.a("rgba( 255, 0, 0, 1)",!0),level6:m.a("rgba( 0, 128, 0, 1)",!0),level7:m.a("rgba( 0, 0, 255, 1)",!0),level8:m.a("rgba( 255, 0, 255, 1)",!0)}),void 0===TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]&&(TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]={styles:{upLine:{visible:!0,color:"rgba( 0, 0, 255, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:"rgba( 0, 0, 255, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:"rgba( 255, 0, 0, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"rgba( 153, 21, 21, 0.3)",transparency:70}}),void 0===TradingView.defaultProperties["study_RegressionTrend@tv-basicstudies"]&&(TradingView.defaultProperties["study_RegressionTrend@tv-basicstudies"]={linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,styles:{upLine:{visible:!0,color:"rgba( 0, 0, 255, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:"rgba( 0, 0, 255, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:"rgba( 255, 0, 0, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}}),void 0===TradingView.defaultProperties["study_Compare@tv-basicstudies"]&&(TradingView.defaultProperties["study_Compare@tv-basicstudies"]={minTick:"default"}),void 0===TradingView.defaultProperties["study_Overlay@tv-basicstudies"]&&(l="study_Overlay@tv-basicstudies",TradingView.defaultProperties[l]={style:c.STYLE_BARS,showPriceLine:!1,minTick:"default",candleStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 115, 115, 117, 1)",wickDownColor:"rgba( 115, 115, 117, 1)",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 115, 115, 117, 1)",wickDownColor:"rgba( 115, 115, 117, 1)",barColorsOnPrevClose:!1},barStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",barColorsOnPrevClose:!1,dontDrawOpen:!1},lineStyle:{color:"rgba( 3, 3, 247, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",styleType:c.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:"rgba( 96, 96, 144, 0.5)",color2:"rgba( 1, 246, 245, 0.5)",linecolor:"rgba( 0, 148, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",transparency:50},styles:{open:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:f.PLOT_LINE,histogramBase:0,title:"open"},high:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:f.PLOT_LINE,histogramBase:0,title:"high"},low:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:f.PLOT_LINE,histogramBase:0,title:"low"},close:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:f.PLOT_LINE,histogramBase:0,title:"close"}}},t.enabled("use_overrides_for_overlay")&&n(TradingView.defaultProperties[l],null,!1,l)),u=e.split("."),_=TradingView.defaultProperties,g=0;g<u.length;g++)_&&(_=_[u[g]]);return _?TradingView.clone(_):{}};r.create=function(t,e){var i,o;e&&(i=_.parseIdString(t),o=g(i.id),TradingView.defaultProperties[i.id]=$.extend(e,o))},r.createOrReplace=function(t,e){if(e){var i=_.parseIdString(t);TradingView.defaultProperties[i.id]=e}},r.remove=function(t){TradingView.defaultProperties[t]=void 0},TradingView.saveDefaults=function(t,e){TVSettings.setJSON(t,e)},TradingView.factoryDefaults=g,window.defaults=r,window.applyDefaultsOverrides=n,window.applyPropertiesOverrides=o,window.applyDefaultOverridesToLinetools=s,e.factoryDefaults=g,e.applyDefaultsOverrides=n,e.applyPropertiesOverrides=o,e.applyDefaultOverridesToLinetools=s,e.defaults=r}).call(e,i(1))},function(t,e,i){(function(t,o){"use strict";function n(t,e){a.call(this,t,e),this._linetool=t,this._pointIndex=e,this._text="",this._coordinate=0,this._background="#5592C9",this._activeBackground="#0F6DBF",this._borderColor="#2E84A6",this._color="white",this._invalidated=!0,this._model=t._model}function s(t,e){h.call(this),this._linetool=t,this._pointindex=e,this._model=t._model,this._text="",this._coordinate=0,this._background="#5592C9",this._activeBackground="#0F6DBF",this._borderColor="#2E84A6",this._color="white",this._visible=!1,this._invalidated=!0}function r(t,e,i){var o,n,a;if(d.call(this),this._model=t,this._properties=i,i.visible&&i.frozen||this._properties.merge(defaults("linetool")),o=defaults("linetoolvisibilities"),i.intervalsVisibilities)for(n in o.intervalsVisibilities)this._properties.intervalsVisibilities[n]||this._properties.intervalsVisibilities.addProperty(n,o.intervalsVisibilities[n]);else this._properties.merge(o);if($.isArray(e)?this._paneViews=e:this._paneViews=[e],this._points=[],this._fixedPoints=[],this._timePoint=[],this._properties.symbol||this._properties.merge({symbol:t.mainSeries().symbol()}),this._properties.interval||this._properties.merge({interval:t.mainSeries().interval()}),this._properties.addExclusion&&(this._properties.addExclusion("symbol"),this._properties.addExclusion("symbolInfo"),this._properties.addExclusion("points"),this._properties.addExclusion("interval"),this._properties.addExclusion("visible"),this._properties.addExclusion("lastUpdateTime")),this.calcIsActualSymbol(),this._properties.intervalsVisibilities.listeners().subscribe(this,r.prototype.calcIsActualSymbol),this._properties.listeners().subscribe(this,r.prototype.propertiesChanged),this._createPointsProperties(),"_tooltipFieldsHash"in this&&!this.hasOwnProperty("_tooltipFieldsHash")&&(this._tooltipFieldsHash=$.extend(!0,{},this._tooltipFieldsHash)),this.m_priceAxisViews=[],this.m_timeAxisViews=[],this.pointsCount()>0)for(a=0;a<this.pointsCount();a++)this.m_priceAxisViews.push(this.createPriceAxisView(a)),this.m_timeAxisViews.push(new s(this,a));this._properties.visible.listeners().subscribe(this,function(t){t.value()||this._model.selectedSource()!==this||this._model.setSelectedSource(null)}),this.customization=this.customization||{forcePriceAxisLabel:!1,disableSelection:!1,disableErasing:!1,disableSave:!1,showInObjectsTree:!0},$(window).resize(function(){this.isFixed()&&this.restoreFixedPoints()}.bind(this)),this._properties.lastUpdateTime||this._properties.addProperty("lastUpdateTime",0)}var a=i(75),l=i(76),h=i(77),c=i(78),d=i(79).DataSource,p=i(81),u=i(41),_=i(82).DateTimeFormatter,f=i(83);inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.setActive=function(t){this._active=t},n.prototype._updateImpl=function(){var t,e,i,o,n;if(this._visible=!1,this._text="",this._model.timeScale()&&!this._model.timeScale().isEmpty()&&this._linetool.priceScale()&&!this._linetool.priceScale().isEmpty()&&(this._model.selectedSource()===this._linetool||this._linetool.customization.forcePriceAxisLabel)&&(t=this._model.timeScale().visibleBars(),!t.isEmpty()&&(e=this._linetool.axisPoints(),!(e.length<=this._pointIndex)&&(i=e[this._pointIndex],isFinite(i.price))))){if(o=this._linetool.priceScale(),o.isPercent()){if(n=this._linetool.ownerSource().firstValue(),!isNumber(n))return;i.price=o.priceRange().convertToPercent(i.price,n)}this._text=o.formatter().format(i.price),this._coordinate=o.priceToCoordinate(i.price),this._visible=!0}},n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var t={text:this._text,coordinate:this._coordinate,color:this._color,borderColor:this._borderColor,background:this._active?this._activeBackground:this._background,visible:this._visible};return new l(t)},n.prototype.text=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),a.prototype.text.call(this)},inherit(s,h),s.prototype.setActive=function(t){this._active=t},s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){var t,e,i;this._visible=!1,this._model.timeScale().isEmpty()||(t=this._linetool.axisPoints(),t.length<=this._pointindex||this._linetool===this._model.selectedSource()&&(this._text="",e=t[this._pointindex].index,this._coordinate=this._model.timeScale().indexToCoordinate(e),i=this._model.timeScale().indexToUserTime(e),i&&(this._text=new _(this._model.mainSeries().isDWM()).format(i)),this._visible=!0,this._invalidated=!1))},s.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var t={text:this._text,coordinate:this._coordinate,color:this._color,background:this._active?this._activeBackground:this._background,borderColor:this._borderColor,visible:this._visible};return new c(t)},inherit(r,d),r.LINEEND_NORMAL=0,r.LINEEND_ARROW=1,r.LINEEND_CIRCLE=2,r.PointPriceProperty=function(e,i){t.call(this),this._lineSource=e,this._pointIndex=i},inherit(r.PointPriceProperty,t),r.prototype.enableCurrentIntervalVisibility=function(){var t,e,i,o,n,s,r,a=u.parse(this._model.mainSeries().interval());a.kind()===u.SECONDS&&(a.multiplier()<60?(this.properties().intervalsVisibilities.seconds.setValue(!0),t=Math.min(this.properties().intervalsVisibilities.secondsFrom.value(),a.multiplier()),this.properties().intervalsVisibilities.secondsFrom.setValue(t),e=Math.max(this.properties().intervalsVisibilities.secondsTo.value(),a.multiplier()),this.properties().intervalsVisibilities.secondsTo.setValue(e)):a=new u(u.MINUTES,a.multiplier()/60)),a.kind()===u.MINUTES&&(a.multiplier()<60?(this.properties().intervalsVisibilities.minutes.setValue(!0),t=Math.min(this.properties().intervalsVisibilities.minutesFrom.value(),a.multiplier()),this.properties().intervalsVisibilities.minutesFrom.setValue(t),e=Math.max(this.properties().intervalsVisibilities.minutesTo.value(),a.multiplier()),this.properties().intervalsVisibilities.minutesTo.setValue(e)):(i=Math.floor(a.multiplier()/60),this.properties().intervalsVisibilities.hours.setValue(!0),o=Math.min(this.properties().intervalsVisibilities.hoursFrom.value(),i),this.properties().intervalsVisibilities.hoursFrom.setValue(o),n=Math.max(this.properties().intervalsVisibilities.hoursTo.value(),i),this.properties().intervalsVisibilities.hoursTo.setValue(n))),a.kind()===u.DAYS&&(this.properties().intervalsVisibilities.days.setValue(!0),s=Math.min(this.properties().intervalsVisibilities.daysFrom.value(),a.multiplier()),this.properties().intervalsVisibilities.daysFrom.setValue(s),r=Math.max(this.properties().intervalsVisibilities.daysTo.value(),a.multiplier()),this.properties().intervalsVisibilities.daysTo.setValue(r)),a.kind()===u.WEEKS&&this.properties().intervalsVisibilities.weeks.setValue(!0),a.kind()===u.MONTHS&&this.properties().intervalsVisibilities.months.setValue(!0)},r.prototype.getType=function(){return TradingView.className(this.constructor)},r.prototype.getConstructor=function(){return this._constructor||null},r.prototype.isActualSymbol=function(){return this._isActualSymbol},r.prototype.isActualInterval=function(){return this._isActualInterval},r.prototype.isSavedInChart=function(t){return!this.customization.disableSave},r.prototype.showInObjectTree=function(){return this.customization.showInObjectsTree},r.prototype.visibilityKeyByInterval=function(t){var e,i=u.parse(t);return r.IntervalsVisibilities.forEach(function(t){t.kind===i.kind()&&t.from<=i.multiplier()&&t.to>=i.multiplier()&&(e=t.key)}),e},r.prototype.calcIsActualSymbol=function(){var t=this._properties.symbol,e=this._model.mainSeries();this._isActualSymbol=e.symbolSameAsCurrent(t.value()),this._isActualSymbol&&t.setValue(e.symbol()),this.calcIsActualInterval()},r.prototype.calcIsActualInterval=function(){var t,e,i,o,n=this._properties,s=this._model.mainSeries(),r=u.parse(s.interval()),a=n.intervalsVisibilities;this._isActualInterval=!1,r.kind()===u.SECONDS&&(t=a.seconds.value(),e=a.secondsFrom.value(),i=a.secondsTo.value(),this._isActualInterval=t&&r.multiplier()>=e&&r.multiplier()<=i),r.kind()===u.MINUTES&&r.multiplier()<60&&(t=a.minutes.value(),e=a.minutesFrom.value(),i=a.minutesTo.value(),this._isActualInterval=t&&r.multiplier()>=e&&r.multiplier()<=i),r.kind()===u.MINUTES&&r.multiplier()>=60&&(o=Math.floor(r.multiplier()/60),t=a.hours.value(),e=a.hoursFrom.value(),i=a.hoursTo.value(),this._isActualInterval=t&&o>=e&&o<=i),r.kind()===u.DAYS&&(t=a.days.value(),e=a.daysFrom.value(),i=a.daysTo.value(),this._isActualInterval=t&&r.multiplier()>=e&&r.multiplier()<=i),r.kind()===u.WEEKS&&(this._isActualInterval=a.weeks.value()),r.kind()===u.MONTHS&&(this._isActualInterval=a.months.value()),this._isActualInterval||this._model.selectedSource()!==this||this._model.setSelectedSource(null)},r.PointPriceProperty.prototype.value=function(){var t=this._lineSource.points()[this._pointIndex].price,e=this._lineSource.ownerSource().formatter(),i=e.parse(e.format(t));return i.price?i.price:i.value},r.PointPriceProperty.prototype.setValue=function(t){var e,i,o=this._lineSource.points()[this._pointIndex];o.price=parseFloat(t),e=this._lineSource.priceScale(),e.isPercent()&&(i=this._lineSource.ownerSource().firstValue(),o.price=e.priceRange().convertToPercent(o.price,i)),this._lineSource.setPoint(this._pointIndex,o),this._lineSource._model.updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging(!0),this._lineSource._syncMultichartState(),this._lineSource._properties.lastUpdateTime.setValue((new Date).valueOf())},r.PointIndexProperty=function(e,i){t.call(this),this._lineSource=e,this._pointIndex=i},inherit(r.PointIndexProperty,t),r.PointIndexProperty.prototype.value=function(){return this._lineSource.points()[this._pointIndex].index},r.PointIndexProperty.prototype.setValue=function(t){
var e,i,o=this._lineSource.points()[this._pointIndex];o.index=t,e=this._lineSource.priceScale(),e.isPercent()&&(i=this._lineSource.ownerSource().firstValue(),o.price=e.priceRange().convertToPercent(o.price,i)),this._lineSource.setPoint(this._pointIndex,o),this._lineSource._model.updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging(!0),this._lineSource._syncMultichartState(),this._lineSource._properties.lastUpdateTime.setValue((new Date).valueOf())},r.prototype._syncMultichartState=function(){var t={points:this._timePoint,interval:this._model.mainSeries().interval()};this.linkKey&&!this.properties().singleChartOnly&&p.finishChangingLineTool({model:this._model,linkKey:this.linkKey,symbol:this._model.mainSeries().symbol(),finalState:t})},r.prototype._createPointProperty=function(t){var e,i=this._properties.points;i.addProperty(t),e=i[t],e.addProperty("price"),e.price=new r.PointPriceProperty(this,t),e.addProperty("bar"),e.bar=new r.PointIndexProperty(this,t)},r.prototype._createPointsProperties=function(){this._properties.addProperty("points");for(var t=0;t<this.pointsCount();t++)this._createPointProperty(t)},r.prototype.priceScale=function(){return this._ownerSource?this._ownerSource.m_priceScale:null},r.prototype.symbol=function(){return this._properties.symbol.value()},r.prototype.properties=function(){return this._properties},r.prototype.isSavedInStudyTemplates=function(){return!1},r.prototype.state=function(t){var e=TradingView.className(this.constructor),i={type:e,id:this.id(),state:this.properties().state(),points:this._timePoint,zorder:this.zorder(),linkKey:this.linkKey};return i.state._isActualInterval=this.isActualInterval(),delete i.state.points,t&&(i.indexes=this._points),this.ownerSource()&&(i.ownerSource=this.ownerSource().id()),this.isFixed()&&(i.positionPercents=this._positionPercents||this.calcPositionPercents()),"version"in this&&1!==this.version&&(i.version=this.version),this.hasAlert.value()&&(i.alertId=this._alertId),i},r.prototype.template=function(){var t=this.properties().state();return delete t.points,delete t.symbol,delete t.symbolInfo,t},r.prototype.restoreTemplate=function(t){delete t.symbolInfo,this._model._undoModel.drawingLoadTemplate(this,t)},r.prototype.clearData=function(){this._points=[]},r.prototype.currentPointsetId=function(){return"pointset_"+this._currentPointsetId},r.prototype.stop=function(){this._currentPointsetId&&(this._model.chartApi().removePointset(this.currentPointsetId()),this._currentPointsetId=null),this.hasAlert.value()&&TradingView.alertsDispatcher&&TradingView.alertsDispatcher.deleteAlert(this._alertId)},r.prototype.isStarted=function(){return!!this._currentPointsetId},r.prototype.restart=function(){this.isFixed()||(this._currentPointsetId=0,this.createServerPoints())},r.prototype.tryCreateServerPoints=function(){this.isFixed()||this._currentPointsetId||this.createServerPoints()},r.prototype.normalizePoint=function(t){var e=this._model.timeScale().normalizeBarIndex(t.index);return e.price=t.price,e},r.prototype.normalizePoints=function(){var t,e;for(this._timePoint=[],t=0;t<this._points.length;t++){if(e=this._model.timeScale().normalizeBarIndex(this._points[t].index),!e.time_t){this._timePoint=[];break}e.price=this._points[t].price,this._timePoint.push(e)}},r.prototype.denormalizeTimePoints=function(){var t,e,i=[];for(t=0;t<this._timePoint.length;t++){if(e=this._model.timeScale().denormalizeTimePoint(this._timePoint[t]),void 0===e){i=[];break}i.push({index:e,price:this._timePoint[t].price})}i.length>0&&(this._points=i)},r.prototype.restorePoints=function(t,e,i){this._timePoint=t,this._points=e,i||this.denormalizeTimePoints()},r.prototype.restoreExternalPoints=function(t){this.properties().interval.setValue(t.interval),this._timePoint=t.points,this.denormalizeTimePoints(),this.createServerPoints()},r.prototype.restorePositionPercents=function(t){this._positionPercents=t},r.prototype.updateAllViewsAndRedraw=function(){this.updateAllViews(),this._model.updateSource(this)},r.prototype.propertiesChanged=function(){if(this.calcIsActualSymbol(),this.updateAllViewsAndRedraw(),this.linkKey){var t=this.properties().state();delete t.interval,p.changeLineStyle({linkKey:this.linkKey,state:t,model:this._model})}},r.prototype.points=function(){var t,e,i=[];for(t=0;t<this._points.length;t++)e=this._points[t],i.push({index:e.index,price:e.price,time:e.time});return this._lastPoint&&i.push({index:this._lastPoint.index,price:this._lastPoint.price,time:this._lastPoint.time}),this._currentMovingPoint&&this._startMovingPoint&&this.correctPoints(i),i},r.prototype.axisPoints=function(){return this.points()},r.prototype.fixedPoints=function(){var t,e,i,n,s=[];if(this._positionPercents&&!this.priceScale().isEmpty())for(t=0;t<this._positionPercents.length;t++)e=this._positionPercents[t],i=this._model.timeScale().width()*e.x,n=this.priceScale().height()*e.y,s.push(new o.Point(i,n));else for(t=0;t<this._fixedPoints.length;t++)s.push(this._fixedPoints[t].clone());return this._lastPoint&&s.push(this._lastPoint.clone()),this._currentMovingPoint&&this._startMovingPoint&&this.correctFixedPoints(s),s},r.prototype._convertPriceFromPercentIfNeeded=function(t){var e,i=this.priceScale();i.isPercent()&&(e=this.ownerSource().firstValue(),t.price=i.priceRange().convertFromPercent(t.price,e))},r.prototype._preparePoint=function(t,e){var i=t;return e&&e.shift&&this.points().length>=2&&this._properties.snapTo45Degrees&&this._snapPoint45Degree(i,this.points()[this.points().length-2]),this._convertPriceFromPercentIfNeeded(i),i},r.prototype.addPoint=function(t,e,i){var o=this._preparePoint(t,e);return this._addPointIntenal(o,e,i)},r.prototype._addPointIntenal=function(t,e,i){this._points.push(t);var o=this._points.length===this.pointsCount();return o?(this._lastPoint=null,i||(this.normalizePoints(),this.createServerPoints())):this._lastPoint=t,o},r.prototype.addFixedPoint=function(t){this._fixedPoints.push(t);var e=this._fixedPoints.length===this.pointsCount();return e&&this.calcPositionPercents(),e},r.prototype.calcPositionPercents=function(){var t,e,i,o;if(!this.priceScale()||this.priceScale().isEmpty())return[];for(this._positionPercents=[],t=0;t<this._fixedPoints.length;t++)e=this._fixedPoints[0],i=e.x/this._model.timeScale().width(),o=e.y/this.priceScale().height(),this._positionPercents.push({x:i,y:o});return this._positionPercents},r.prototype.restoreFixedPoints=function(){this._fixedPoints=this.fixedPoints()},r.prototype.onData=function(t){var e,i,o,n,s,r;if(t.params.customId===this.currentPointsetId()&&0!==t.params.plots.length){for(e=0;e<t.params.plots.length;e++)i=t.params.plots[e],o=this._timePoint[i.index],n=i.value[0],s=new Date(1e3*i.value[1]),r={index:n,time:s,price:o.price},this._points.length<=i.index?this._points.push(r):this._points[i.index]=r;this.checkAlert&&this.checkAlert(),this.updateAllViewsAndRedraw()}},r.prototype.correctPricesToPercents=function(){var t,e,i=this.priceScale(),o=this.ownerSource().firstValue();for(t=0;t<this._points.length;t++)e=this._points[t],e.price=i.priceRange().convertFromPercent(e.price,o)},r.prototype.startChanging=function(t,e){t<this.m_priceAxisViews.length&&this.m_priceAxisViews[t].setActive(!0),t<this.m_timeAxisViews.length&&this.m_timeAxisViews[t].setActive(!0),this._properties.lastUpdateTime.setValue((new Date).valueOf())},r.prototype.setPoint=function(t,e,i){if(i&&i.shift&&this._properties.snapTo45Degrees){var o=0===t?1:t-1;this._snapPoint45Degree(e,this.points()[o])}this._convertPriceFromPercentIfNeeded(e),this._points[t]=e,this.normalizePoints()},r.prototype.startMoving=function(t){this.isFixed()&&this.restoreFixedPoints(),this._convertPriceFromPercentIfNeeded(t),this._startMovingPoint=t,this._properties.lastUpdateTime.setValue((new Date).valueOf())},r.prototype.move=function(t){this._convertPriceFromPercentIfNeeded(t),this._currentMovingPoint=t,this.updateAllViews()},r.prototype.correctPoints=function(t){var e,i,o=this._currentMovingPoint.index-this._startMovingPoint.index,n=this._currentMovingPoint.price-this._startMovingPoint.price;for(e=0;e<t.length;e++)i=t[e],i.index+=o,i.price+=n,t[e]=i},r.prototype.correctFixedPoints=function(t){var e,i=this._currentMovingPoint.substract(this._startMovingPoint);for(e=0;e<t.length;e++)t[e]=t[e].add(i)},r.prototype.endMoving=function(t){var e,i;return this._properties.interval.setValue(this._model.mainSeries().interval()),e=!1,i=!1,this._currentMovingPoint&&this._startMovingPoint&&(e=this._currentMovingPoint.index!==this._startMovingPoint.index,i=this._currentMovingPoint.price!==this._startMovingPoint.price,this.isFixed()?this.correctFixedPoints(this._fixedPoints):this.correctPoints(this._points),this._startMovingPoint=null,this._currentMovingPoint=null),this.isFixed()?(this.calcPositionPercents(),void this.updateAllViews()):(this.normalizePoints(),this.updateAllViews(),e&&!t&&this.createServerPoints(),void((i||e)&&this.synchronizeAlert(!this._alertUndoMode)))},r.prototype.endChanging=function(t,e){var i;for(this._properties.interval.setValue(this._model.mainSeries().interval()),e||(this.normalizePoints(),this.createServerPoints()),i=0;i<this.m_priceAxisViews.length;i++)this.m_priceAxisViews[i].setActive(!1);for(i=0;i<this.m_timeAxisViews.length;i++)this.m_timeAxisViews[i].setActive(!1);this.synchronizeAlert(!t)},r.prototype.paneViews=function(t){var e,i;if(!this._isActualSymbol||!this._isActualInterval)return null;if(!this._properties.visible.value())return null;if(p.hideAllDrawings().value()&&this.userEditEnabled())return null;for(e=[],i=this._paneViews.length-1;i>=0;--i)e.push(this._paneViews[i]);return e},r.prototype.dataWindowView=function(){return null},r.prototype.statusView=function(){return null},r.prototype.priceAxisViews=function(t,e){var i,o,n;return this._isActualSymbol&&t.dataSources().indexOf(this)!==-1&&e===this.priceScale()?this._model.lineBeingEdited()===this?(i=this._model.linePointBeingEdited(),i<this.m_priceAxisViews.length?(o=this.m_priceAxisViews.slice(),n=o[i],o.splice(i,1),o.push(n),o):this.m_priceAxisViews):this.m_priceAxisViews:null},r.prototype.timeAxisViews=function(){var t,e,i;return this._model.lineBeingEdited()===this?(t=this._model.linePointBeingEdited(),t<this.m_timeAxisViews.length?(e=this.m_timeAxisViews.slice(),i=e[t],e.splice(t,1),e.push(i),e):this.m_timeAxisViews):this.m_timeAxisViews},r.prototype.updateAllViews=function(){var t,e,i;if(!this._isActualSymbol)return null;if(!this._properties.visible.value())return null;if(t=this.paneViews(),null!==t)for(e=t,i=0;i<e.length;i++)e[i].update();for(e=this.m_priceAxisViews,i=0;i<e.length;i++)e[i].update();for(e=this.m_timeAxisViews,i=0;i<e.length;i++)e[i].update()},r.prototype.setLastPoint=function(t,e){this._lastPoint=this._preparePoint(t,e),this.updateAllViews()},r.prototype.setLastFixedPoint=function(t){this._lastFixedPoint=t,this.updateAllViews()},r.prototype.title=function(){return"Line Tool"},r._pointSetId=1,r.prototype.start=function(){this.createServerPoints()},r.prototype.createServerPoints=function(){var t,e,i,o,n,s;if(!this._recursiveGuard&&this._isActualSymbol&&this._model.chartApi().connected()&&(this._currentPointsetId&&(this._model.chartApi().removePointset(this.currentPointsetId()),this._currentPointsetId=null),!this._model.timeScale().isEmpty()&&(0===this._timePoint.length&&this.normalizePoints(),0!==this._timePoint.length))){for(this._currentPointsetId=++r._pointSetId,t=this._model.mainSeries().symbolId(),e=this.properties().interval.value(),i=[],o=0;o<this._timePoint.length;o++)n=this._timePoint[o],i.push([n.time_t,n.offset]);s=this,this._model.chartApi().createPointset(this.currentPointsetId(),"turnaround",t,e,i,function(t){s.onData(t)})}},r.prototype.isBeingEdited=function(){return this===this._model.lineBeingEdited()||this===this._model.sourceBeingMoved},r.prototype.isFixed=function(){return this.properties().locked&&this.properties().locked.value()},r.prototype.isLocked=r.prototype.isFrozen=function(){return this.properties().frozen&&this.properties().frozen.value()},r.prototype._tooltipFieldsHash={},r.prototype._tooltipFieldsOrder=["time","price","index","time0","price0","time1","price1","time2","price2","time3","price3","time4","price4","distance","term","pointsPerBar"],r.prototype._tooltipFieldsOrdered=null,r.prototype._formatTooltip=function(){return null===this._tooltipFieldsOrdered&&(this._tooltipFieldsOrdered=new f(this._tooltipFieldsHash,f.byOrder(this._tooltipFieldsOrder))),this._tooltipFieldsOrdered.array.filter(function(t){return null!==t.value&&""!==t.value}).map(function(t){return"<span>"+t.title+":</span> "+t.value}).join("<br />")},r.prototype.pointToScreenPoint=function(t){var e,i,n,s,r,a,l=this._model.timeScale(),h=this.priceScale();if(!h||h.isEmpty()||l.isEmpty())return[new o.Point(0,0),new o.Point(0,0)];if(e=null,h.isPercent()){if(!this.ownerSource())return;if(e=this.ownerSource().firstValue(),null===e||!isFinite(e))return}return i=l.indexToCoordinate(t.index,!0),n=t.price,h.isPercent()&&(n=h.priceRange().convertToPercent(n,e)),s=h.priceToCoordinate(n,!0),r=new o.Point(i,s),i=l.indexToCoordinate(t.index,!1),s=h.priceToCoordinate(n,!1),a=new o.Point(i,s),[r,a]},r.prototype.screenPointToPoint=function(t){var e=this._model.timeScale(),i=this.priceScale(),o=e.coordinateToIndex(t.x),n=i.coordinateToPrice(t.y),s=null;if(i.isPercent()){if(!this.ownerSource())return;if(s=this.ownerSource().firstValue(),null===s||!isFinite(s))return}return i.isPercent()&&(n=i.priceRange().convertFromPercent(n,s)),{price:n,index:o}},r.prototype.tags=function(){return[this._constructor]},r.prototype._snapPoint45Degree=function(t,e,i){var o,n,s,r,a,l,h,c,d,p,u,_,f=this._model.timeScale(),g=f.indexToCoordinate(e.index),m=f.indexToCoordinate(t.index)-g,v=this.m_priceScale,y=e.price,b=t.price,w=this.ownerSource().firstValue();v.isPercent()&&(y=v.priceRange().convertToPercent(y,w)),o=v.priceToCoordinate(y),n=v.priceToCoordinate(b)-o,s=Math.round(Math.atan2(m,n)/Math.PI*4),2===Math.abs(s)?i||(t.price=y):0===Math.abs(s)||4===Math.abs(s)?i||(t.index=e.index):0===Math.abs(s)||4===Math.abs(s)?i||(t.index=e.index):(r=Math.sqrt(m*m+n*n),a=m<0?-1:1,l=n<0?-1:1,h=Math.max(Math.abs(n),Math.abs(m)),c=h*Math.sqrt(2),d=c/r,h/=d,p=Math.round(f.coordinateToIndex(g+h*a)),u=Math.abs(f.indexToCoordinate(p)-g),_=v.coordinateToPrice(o+u*l),t.index=p,t.price=_)},r.prototype.createPriceAxisView=function(t){return new n(this,t)},r.prototype.version=1,r.isLineTool=function(t){var e=TradingView[t];return!!e&&TradingView.isInherited(e,r)},r.prototype.alertId=function(){return this._alertId},r.prototype.setAlert=function(t,e){},r.prototype._flushAlert=function(t){delete this._alertId,delete this._alert,this.hasAlert.setValue(!1),window.saver&&window.saver.saveChartSilently(null,!1)},r.prototype._processAlertHanders=function(t){var e,i,o,n=this;t="subscribe"===t?"subscribe":"unsubscribe",("unsubscribe"!==t||n._alertCallbacks)&&(i="subscribe"===t?"on":"off",e=n.properties(),o=n._alertCallbacks||{flush:n._flushAlert.bind(n),hovered:function(t,e){e?n._model.setHoveredSource(n):n._model.hoveredSource()===n&&n._model.setHoveredSource(null)},selected:function(t,e){e&&n._model.setSelectedSource(n)},synchronizeSilently:function(t){n.synchronizeAlert(!1)}},n._alertCallbacks||(n._alertCallbacks=o),n.getAlert().done(function(s){s&&(s[i]("destroy",o.flush),s[i]("change:hovered",o.hovered),s[i]("change:selected",o.selected),e.extendLeft&&e.extendLeft[t](n,o.synchronizeSilently),e.extendRight&&e.extendRight[t](n,o.synchronizeSilently))}))},r.prototype.editAlert=function(){},r.prototype.getAlert=function(t){var e,i=this;return t=t||{},e=$.Deferred(),TradingView.alertsDispatcher?TradingView.alertsDispatcher.requestAlert(i._alertId,{success:e.resolve.bind(e),error:e.reject.bind(e),fromCache:t.fromCache}):TradingView.logError("[Alerts] Can't get alert without alerts dispatcher"),e.promise()},r.prototype.synchronizeAlert=function(t){var e=this;e.hasAlert.value()&&setTimeout(function(){function i(){e._alertUndoMode=!0,r.undoToCheckpoint(e._undoCheckpointAlert),setTimeout(function(){e._alertUndoMode=!1,e.localAndServerAlersMismatch=!1},0)}function o(t){t.set("resolution",e.properties().interval.value()),t.get("extra").drawing(e),e.localAndServerAlersMismatch=!0}function n(t){TradingView.alertsDispatcher.restartAlert(t,{success:function(){e.localAndServerAlersMismatch=!1},error:i,complete:function(){delete e._undoCheckpointAlert}})}var s,r=e._model._undoModel;e._undoCheckpointAlert||e._alertUndoMode||(s=r.undoStack().pop(),e._undoCheckpointAlert=r.createUndoCheckpoint(),r.undoStack().push(s)),e.getAlert().done(function(e){o(e),t&&n(e)}).fail(i)},0)},r.prototype.stateForAlert=function(){var t,e;if(this.canHasAlert())return t=this.state(),t.uniqueId=this.uniqueId(),t.title=this.title(),e=this._getAlertPlots(),e&&(t.plots=e),t},r.prototype._getAlertPlots=function(){return null},r.prototype._linePointsToAlertPlot=function(t,e,i,o){if(2!==t.length)return TradingView.logError("[Drawing Alert] Wrong points"),null;var n=this._model.timeScale();return!n||n.isEmpty()?null:{type:"LinePlot",title:e||this.title(),timestamp:Math.round(n.indexToTimePoint(0).getTime()/1e3),offset1:t[0].index,offset2:t[1].index,price1:t[0].price,price2:t[1].price,extendBackward:i||!1,extendForward:o||!1}},r.prototype.getAlertIsActive=function(t){this.getAlert({fromCache:!0}).done(function(e){t(!!e&&e.get("active"))}).fail(function(){t(!1)})},r.prototype.geometry=function(){var t=this,e=function(e){var i=e.x/t._model.timeScale().width(),n=e.y/t.priceScale().height();return new o.Point(i,n)},i=this.points().map(function(i){var o=t.pointToScreenPoint(i)[0];return e(o)});return i},r.prototype.onlyYMoving=function(){return!1},e.LineToolPriceAxisView=n,e.LineDataSource=r}).call(e,i(69),i(21))},function(t,e,i){"use strict";function o(){this._text="",this._background="#585858",this._coordinate=0}var n=i(65).RGBColor;o.prototype.text=function(){return this._text},o.prototype.background=function(){return this._background},o.prototype.color=function(){return new n(this._background).blackWhiteContrast()},o.prototype.coordinate=function(){return this._coordinate},o.prototype.floatCoordinate=function(){return this._floatCoordinate||this._coordinate},t.exports=o},function(t,e){"use strict";function i(t){this._data=t}i.prototype.draw=function(t,e){var i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w;this._data.visible&&(i=e.fontSize,t.font=e.font,o=e.tickLength,n=e.borderSize,s=e.paddingTop,r=e.paddingBottom,a=e.paddingInner,l=e.paddingOuter,h=Math.ceil(e.widthCache.measureText(t,this._data.text)),c=e.baselineOffset,t.strokeStyle=this._data.borderColor,t.fillStyle=this._data.background,t.lineWidth=1,d=e.fontSize+s+r,p=n+h+a+l+o,u=this._data.coordinate,_=u-Math.floor(i/2)-s-.5,f=_+d,g=e.isLeft?e.width-n-.5:.5,m=g,this._data.text&&(e.isLeft?(m=g-p,v=g-o,y=m+l):(m=g+p,v=g+o,y=g+n+o+a),t.beginPath(),t.moveTo(g,_),t.lineTo(m,_),t.lineTo(m,f),t.lineTo(g,f),t.fill(),t.beginPath(),t.strokeStyle=this._data.color,t.moveTo(g,u),t.lineTo(v,u),t.stroke(),t.textAlign="left",t.fillStyle=this._data.color,t.fillText(this._data.text,y,f-r-c)),this._data.secondLine&&(b=Math.ceil(e.widthCache.measureText(t,this._data.secondLine)),w=b+a+l,t.fillStyle=this._data.background,this._data.text&&(_+=d+1,f+=d+1),e.isLeft?(m=Math.min(m,e.width-o),g=m+w,y=m+l):(g=Math.max(m-w,n),m=g+w,y=g+a),t.beginPath(),t.moveTo(g,_),t.lineTo(m,_),t.lineTo(m,f),t.lineTo(g,f),t.fill(),t.textAlign="left",t.fillStyle=this._data.color,t.fillText(this._data.secondLine,y,f-r-c)))},i.prototype.height=function(t,e){var i=t.fontSize+t.paddingTop+t.paddingBottom;return this._data.secondLine&&e?2*i+1:i},t.exports=i},function(t,e,i){"use strict";function o(){this._text="",this._background="#585858",this._coordinate=0}var n=i(65).RGBColor;o.prototype.text=function(){return this._text},o.prototype.background=function(){return this._background},o.prototype.color=function(){return new n(this._background).blackWhiteContrast()},o.prototype.coordinate=function(){return this._coordinate},t.exports=o},function(t,e){"use strict";function i(t){this._data=t}i.prototype.draw=function(t,e){var i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m;this._data.visible!==!1&&(t.font=e.font,i=e.paddingHorizontal,o=e.widthCache.measureText(t,this._data.text),o<=0||(n=o+2*i,s=Math.floor(this._data.coordinate-n/2)+.5,r=s,a=r+n,l=a,h=Math.round(this._data.coordinate+1),c=h,d=.5,p=d+e.borderSize+e.tickLength+e.paddingTop+e.fontSize+e.paddingBottom,u=p,_=d,f=_,g=f+e.borderSize+e.tickLength,m=p-e.baselineOffset-e.paddingBottom,t.fillStyle=this._data.background,t.lineWidth=1,t.beginPath(),t.strokeStyle=this._data.color,t.moveTo(s,d),t.lineTo(r,p),t.lineTo(a,u),t.lineTo(l,_),t.fill(),t.beginPath(),t.moveTo(h,f),t.lineTo(c,g),t.stroke(),t.textAlign="left",t.fillStyle=this._data.color,t.fillText(this._data.text,s+i,m)))},t.exports=i},function(t,e,i){(function(t){"use strict";function o(){this._zorder=0,this.m_priceScale=null,this._id=TradingView.randomHashN(6),this._ownerSource=null,this._userEditEnabled=!0,this.hasAlert=new t(!1)}function n(t){o.call(this),this._isOverlay=null,this._model=t}var s=i(80).DefaultProperty;o.prototype.createPropertiesObject=function(t,e,i){return new s(t,e,i)},o.prototype.id=function(){return this._id},o.prototype.uniqueId=function(){return this._id},o.prototype.setId=function(t){this._id=t},o.prototype.zorder=function(){return this._zorder},o.prototype.setZorder=function(t){"number"==typeof t&&this._zorder!==t&&(this._zorder=t)},o.prototype.title=function(){throw Error("Implement this fun in a subclass")},o.prototype.priceScale=function(){return this.m_priceScale},o.prototype.setPriceScale=function(t){this.m_priceScale=t},o.prototype.ownerSource=function(){return this._ownerSource},o.prototype.setOwnerSource=function(t){this._ownerSource=t,t&&this.setPriceScale(t.priceScale())},o.prototype.isSavedInChart=function(t){return!0},o.prototype.isSavedInStudyTemplates=function(){return!0},o.prototype.isRemovedByStudyTemplates=function(){return!0},o.prototype.hasContextMenu=function(){return!0},o.prototype.showInObjectTree=function(){return!0},o.prototype.setUserEditEnabled=function(t){this._userEditEnabled=t},o.prototype.userEditEnabled=function(){return this._userEditEnabled},o.prototype.isUserDeletable=function(){return this.userEditEnabled()},o.prototype.canHasAlert=function(){return!1},o.prototype.properties=function(){throw Error("Implement this fun in a subclass")},o.prototype.statusView=function(){return null},o.prototype.dataWindowView=function(){return null},o.prototype.priceAxisViews=function(t,e){return null},o.prototype.updateAllViews=function(){},o.prototype.paneViews=function(t){return null},inherit(n,o),n.prototype.isNoScale=function(){return!!this._isOverlay},n.prototype.base=function(){return 0},n.prototype.formatter=function(){return null},n.prototype.model=function(){return this._model},n.prototype.priceRange=function(t,e){return null},n.prototype.isDraggable=function(){return!0},e.DataSource=o,e.PriceDataSource=n}).call(e,i(43))},function(t,e,i){"use strict";function o(t,e,i){this._defaultName=t;var n;i?n=e:(n=TradingView.clone(defaults(t)),e&&TradingView.merge(n,e)),s.call(this,n),this._defaultName=t,this.listeners().subscribe(this,o.prototype.onPropertyChanged),this._exclusions=[]}function n(t){o._saveDefaults=t}var s=i(69);inherit(o,s),o._saveDefaults=!1,o.prototype.addExclusion=function(t){this._exclusions.push(t)},o.prototype.restoreFactoryDefaults=function(){var t,e={};this._defaultName.startsWith("study_")&&(e=TradingView.clone(TradingView.factoryDefaults("study"))),this._defaultName.startsWith("linetool")&&(e=TradingView.clone(TradingView.factoryDefaults("linetoolvisibilities"))),t=TradingView.clone(TradingView.factoryDefaults(this._defaultName)),this._defaultName.startsWith("study_")&&t.inputs&&delete t.inputs.symbol,"linetoolicon"===this._defaultName&&(t.icon=defaults(this._defaultName).icon),~["linetooltext","linetooltextabsolute","linetoolnote","linetoolnoteabsolute","linetoolcallout","linetoolballoon","linetoolarrowmark","linetoolarrowmarkleft","linetoolarrowmarkup","linetoolarrowmarkright","linetoolarrowmarkdown","linetoolhorzline","linetoolhorzray"].indexOf(this._defaultName)&&delete t.text,this._exclusions.forEach(function(e){delete t[e]}),TradingView.merge(e,t),this.merge(e),this._defaultName.startsWith("study_")||TradingView.saveDefaults(this._defaultName,this.state(this._exclusions)),this.listeners().fire(this)},o.prototype.cleanupFactoryDefaults=function(){var t={};TradingView.saveDefaults(this._defaultName,t),this.listeners().fire(this)},o.prototype.onPropertyChanged=function(){o._saveDefaults&&!this._defaultName.startsWith("study_")&&this.saveDefaults()},o.prototype.saveDefaults=function(){TradingView.saveDefaults(this._defaultName,this.state(this._exclusions))},o.prototype.clone=function(t){return new o(this._defaultName,this.state(),t&&t.replaceByState)},e.DefaultProperty=o,e.saveDefaultProperties=n},function(t,e,i){(function(e,o,n){"use strict";function s(t){return"cursor"===t||"arrow"===t||"dot"===t}function r(t){!t&&d&&d.stayInDrawingMode.value()||this.tool.setValue(this.cursorTool.value())}function a(t,e){return function(e){t.inFire||(t.inFire=!0,t.fire(e),t.inFire=!1)}}function l(){K||(m.setValue(TVSettings.getValue("chart.cursorPreference","cursor")),m.subscribe(function(t){s(t)&&v.setValue(t)},{callWithLast:!0}),v.subscribe(function(t){t&&TVSettings.setValue("chart.cursorPreference",t)}),d=new h("drawings"),p=new n,u=new n,_=new n,f=new n,p.setValue(!1),u.setValue(!1),_.setValue(!1),f.setValue(!1),m.subscribe(function(){c.emit("onSelectedLineToolChanged")}),K=!0)}var h=i(80).DefaultProperty,c=i(38),d=null,p=null,u=null,_=null,f=null,g=new e,m=new e,v=new e,y=new o,b=new o,w=new o,S=new o,T=new o,C=new o,x=new o,P=new o,L=new o,k=new o,E=new o,I=new o,A=new o,V=new o,$=new o,M=a(y),D=a(b),O=a(w),B=a(S),R=a(T),N=a(C),F=a(x),z=a(P),W=a(L),H=a(k),U=a(E),q=a(I),j=a(A),Y=a(V),G=a($),K=!1;t.exports={tool:m,cursorTool:v,toolIsCursor:s,resetToCursor:r,init:l,createdLineTool:y,continuedLineTool:b,cancelledLineTool:w,createLineTool:M,continueLineTool:D,cancelLineTool:O,startedMovingLineTool:S,movedLineTool:T,finishedMovingLineTool:C,startMovingLineTool:B,moveLineTool:R,finishMovingLineTool:N,startedChangingLineTool:x,changedLineTool:P,finishedChangingLineTool:L,startChangingLineTool:F,changeLineTool:z,finishChangingLineTool:W,removedLineTool:k,removeLineTool:H,restoredLineTool:V,restoreLineTool:Y,restoredLineToolState:$,restoreLineToolState:G,finishedLineTool:E,finishLineTool:U,changedLineStyle:I,changeLineStyle:q,copiedLineTool:A,copyLineTool:j,properties:function(){return d},hideAllDrawings:function(){return p},hideMarksOnBars:function(){return _},lockDrawings:function(){return u},drawOnAllCharts:function(){return d.drawOnAllCharts},lockTimeAxis:function(){return f},lockTimeAxisTime:g}}).call(e,i(43),i(28),i(69))},function(t,e){"use strict";function i(t,e,i,o){if(e||(e=1),TradingView.isInteger(t)||(t=100),t<0)throw new TypeError("invalid base");return this._priceScale=t,this._minMove=e,this._minMove2=o,o>0&&2!==o&&4!==o?void TradingView.logDebugChart("invalid minmove2"):(this._fractional=i,void this.calculateDecimal())}function o(t,e){var i,o;if(!isNumber(t))return"n/a";if(!TradingView.isInteger(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return 0===e?""+t:(i="0000000000000000",o=(i+(""+t)).right(e))}function n(){i.call(this,100)}function s(){}function r(t){this._format_str=t||"%h:%m:%s"}function a(t){this._dwm=t}function l(t){this._precision=t}function h(t){this._numericFormatter=new l(t),this._fractionalValues=t>0}function c(){}function d(){this._prev=null}var p={timeFormatter:null,dateFormatter:null};i.prototype.isFractional=function(){return this._fractional},i.prototype.decimalSign=".",i.prototype.decimalSignFractional="'",i.prototype.southandDelimeter="`",i.prototype.fullPrecision=!1,i.prototype.state=function(){return{minMove:this._minMove,minMove2:this._minMove2,fractional:this._fractional,fractionalLength:this._fractionalLength}},i.prototype.calculateDecimal=function(){if(this._fractionalLength=0,this._priceScale>0&&this._minMove>0){var t=this._priceScale;for(this._minMove2&&(t/=this._minMove2);t>1;)t/=10,this._fractionalLength++}},i.prototype.format=function(t,e,i){var o="";return t<0?(o=e===!0?"":"-",t=-t):t&&e===!0&&(o="+"),this._fractional?o+this.formatAsFractional(t,i):o+this.formatAsDecimal(t,i)},i.prototype._removeEndingZeros=function(t,e){for(var i=0;i<e&&"0"===t[t.length-1];i++)t=t.substr(0,t.length-1);return t},i.prototype.formatAsDecimal=function(t,e){var i,n,s,r,a;return e=e||0,i=this._fractional?Math.pow(10,this._fractionalLength||0):Math.pow(10,e)*this._priceScale/this._minMove,n=Math.floor(t),s=+(Math.round(t*i)-n*i).toFixed(this._fractionalLength),s>=i&&(s-=i,n+=1),r="",1!==i&&(r=this.decimalSign+o(s.toFixed(this._fractionalLength)*this._minMove,this._fractionalLength+e),r=this._removeEndingZeros(r,e)),a=""+n+r},i.prototype.formatAsFractional=function(t,e){var i,n,s,r,a,l,h,c,d,p=this._priceScale/this._minMove,u=Math.floor(t),_=e?Math.floor(t*p)-u*p:Math.round(t*p)-u*p;return _===p&&(_=0,u+=1),i="",e&&(n=(t-u-_/p)*p,n=Math.round(n*Math.pow(10,e)),i=o(n,e),i=this._removeEndingZeros(i,e)),s="",this._minMove2?(r=["0","5"],a=["0","2","5","7"],l=_%this._minMove2,_=(_-l)/this._minMove2,h=o(_,this._fractionalLength),c=2===this._minMove2?r[l]:a[l],s=h+this.decimalSignFractional+c):s=o(_*this._minMove,this._fractionalLength),d=""+u+this.decimalSignFractional+s+i},i.prototype._parseAsDecimal=function(t){var e,o,n=RegExp(/^(\-?)[0-9]+$/),s=n.exec(t);return s?(e=parseFloat(t),{res:!0,suggest:this.format(e),price:e}):(o=RegExp("^(-?)[0-9]+\\"+i.prototype.decimalSign+"[0-9]+$"),s=o.exec(t),s?(e=parseFloat(t.replace(i.prototype.decimalSign,".")),{res:!0,suggest:this.format(e),price:e}):{res:!1,error:"not a number"})},i.prototype._patchFractPart=function(t,e){var i={0:0,5:1},o={0:0,2:1,5:2,7:3};return 2===e?void 0===i[t]?-1:i[t]:4===e?void 0===o[t]?-1:o[t]:t},i.prototype._parseAsSingleFractional=function(t){var e,i,o,n,s,r=RegExp(/^[0-9]+$/),a=r.exec(t);return a?(e=parseFloat(t),{res:!0,suggest:this.format(e),price:e}):(i=RegExp("^([0-9]+)\\"+this.decimalSignFractional+"([0-9]+)$"),a=i.exec(t),a?(o=parseInt(a[1]),n=this._priceScale,s=this._patchFractPart(parseInt(a[2]),n),s>=n||s<0?{res:!1,error:"fraction part is invalid"}:(e=o+s/n,{res:!0,suggest:this.format(e),price:e})):{res:!1,error:"not a number"})},i.prototype._parseAsDoubleFractional=function(t){var e,i,o,n,s,r,a,l=RegExp(/^[0-9]+$/),h=l.exec(t);return h?(e=parseFloat(t),{res:!0,suggest:this.format(e),price:e}):(i=RegExp("^([0-9]+)\\"+this.decimalSignFractional+"([0-9]+)\\"+this.decimalSignFractional+"([0-9]+)$"),h=i.exec(t),h?(o=parseInt(h[1]),n=this._priceScale/this._minMove2,s=this._minMove2,r=this._patchFractPart(parseInt(h[2]),n),a=this._patchFractPart(parseInt(h[3]),s),r>=n||r<0?{res:!1,error:"fraction part is invalid"}:a>=s||a<0?{res:!1,error:"second fraction part is invalid"}:(e=o+r/n+a/(n*s),{res:!0,suggest:this.format(e),price:e})):{res:!1,error:"not a number"})},i.prototype.parse=function(t){return this._fractional?this._minMove2?this._parseAsDoubleFractional(t):this._parseAsSingleFractional(t):this._parseAsDecimal(t)},inherit(n,i),n.prototype.state=function(){var t=i.prototype.state.call(this);t.percent=!0},n.prototype.format=function(t,e){return i.prototype.format.call(this,t,e)+"%"},s.prototype.format=function(t){return p.dateFormatter?p.dateFormatter.format(t):o(t.getUTCFullYear(),4)+"-"+o(t.getUTCMonth()+1,2)+"-"+o(t.getUTCDate(),2)},r.prototype.format=function(t){return p.timeFormatter?p.timeFormatter.format(t):this._format_str.replace("%h",o(t.getUTCHours(),2)).replace("%m",o(t.getUTCMinutes(),2)).replace("%s",o(t.getUTCSeconds(),2))},a.prototype.format=function(t){var e=(new s).format(t);return this._dwm||(e+=" "+(new r).format(t)),e},l.prototype.format=function(t){var e=this._precision?t.toFixed(this._precision):t+"";
return e.replace(".",i.prototype.decimalSign)},l.prototype.parse=function(t){var e=t.replace(i.prototype.decimalSign,"."),o=parseFloat(e);return this._precision&&(o=o.toFixed(this._precision)),o},h.prototype.format=function(t){function e(t){return i._numericFormatter.format(t).replace(/(\.[1-9]*)0+$/,function(t,e){return e})}var i,o;return isNumber(t)?(i=this,o="",t<0&&(o="-",t=-t),t>=1e100?"N/A":((!this._fractionalValues||t>=995)&&(t=Math.round(t)),t<995?o+e(t):t<999995?o+e(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),o+e(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),o+e(t/1e9)+"B"))):"---"},h.prototype.parse=function(t){var e,i,o;return"---"===t?{res:!1,value:NaN,error:"not a number"}:(e={K:1e3,M:1e6,B:1e9},i=t.slice(-1),e.hasOwnProperty(i)?(o=this._numericFormatter.parse(t.slice(0,-1)),isNumber(o)?{res:!0,value:o*e[i]}:{res:!1,value:NaN,error:"not a number"}):(o=this._numericFormatter.parse(t),isNumber(o)?{res:!0,value:o}:{res:!1,value:NaN,error:"not a number"}))},c.prototype.format=function(t){var e,i,o,n,s=t<0;return t=Math.abs(t),e=Math.floor(t/86400),t-=86400*e,i=Math.floor(t/3600),t-=3600*i,o=Math.floor(t/60),t-=60*o,n="",e&&(n+=e+$.t("d",{context:"dates"})+" "),i&&(n+=i+$.t("h",{context:"dates"})+" "),o&&(n+=o+$.t("m",{context:"dates"})+" "),t&&(n+=t+$.t("s",{context:"dates"})+" "),s&&(n="-"+n),n.trimmed()},d.formatSign=function(t,e){return e=e||{},0===t?e.neutral||"#5A5D66":t>0?e.up||"#27AC66":e.down||"#DA563E"},d.formatDiff=function(t,e){d.signFormat(e-t)},d.prototype.format=function(t){try{return null===this._prev?d.formatSign(t):d.formatDiff(this._prev,t)}finally{this._prev=t}},e.PriceFormatter=i,e.numberToStringWithLeadingZero=o,e.PercentageFormatter=n,e.DateFormatter=s,e.TimeFormatter=r,e.DateTimeFormatter=a,e.NumericFormatter=l,e.TimeSpanFormatter=c,e.PriceColorer=d,e.VolumeFormatter=h,e.customFormatters=p},function(t,e){"use strict";function i(t,e){this.array=[];for(var i in t)t[i].key=i,this.array.push(t[i]);this.rearrange(e)}i.prototype.rearrange=function(t){if("function"!=typeof t)throw Error("sort param is not a function");return this.array.sort(t)},i.byValue=function(t){return function(t,e){return t-e}},i.byField=function(t){return function(e,i){return e[t]>i[t]?1:e[t]<i[t]?-1:e[t]===i[t]?0:void 0}},i.byOrder=function(t){return function(e,i){var o=t.indexOf(e.key),n=t.indexOf(i.key);return o-n}},t.exports=i},function(t,e,i){(function(e,o,n,s,r,a){"use strict";function l(t){this._series=t,this._model=t.m_model,this._points=[new e.Point(0,0)],this._invalidated=!0}function h(){return{count:TradingView.DEFAULT_BAR_COUNT}}function c(t,e,s){var r,a=i(117);P.call(this,t),this._boxSizeChanged=new o,this._tagsChanged=new o,this._symbolIntervalChanged=new o,this._symbolResolved=new o,this._symbolError=new o,this._symbolNotPermitted=new o,this._intervalChanged=new o,this._extendedHoursChanged=new o,this._extendedHoursNotPermitted=new o,this.chartTypeNotPermitted=new o,this.intradaySpreadNotPermitted=new o,this.intradayExchangeNotPermitted=new o,this.customIntervalNotPermitted=new o,this.chartWidgetInitialized=new o,this._startLoading=new o,this._dataLoaded=new o,this._tickmarksRangeChanged=new o,this._barReceived=new o,this._onChangedStyle=new o,this._onCompleted=new o,this._onStatusChanged=new o,this._onRestarted=new o,this._onSessionsStudyCreated=new o,this.requestingIntradayWhenNotSupported=new o,this.requestingResolutionWhenNotSupported=new o,this.priceScaleChanged=new o,this._requestOptions=s||h(),this.m_model=t,this._chartApi=t._chartApi,this.m_data=new V(this,t),this.setProperties(e),this._prevChartStyle=e.style.value(),this.createPaneView(),this._dataWindowView=new _(this,t),this._statusView=new d(this,t.properties()),this._priceAxisViews=[new u(this,t),new p(this,t)],this._symbolInfo=null,this._status=c.STATUS_OFFLINE,this._syncModel=null,r=this,this._turnaroundCounter=1,this._turnaround="s"+this._turnaroundCounter,this._handler=function(t){r.onData(t)},this._properties.addExclusion&&this._properties.addExclusion("visible"),this._base=100,this._formatter=new B(this._base),this._predictBars=0,this._futureBarsPaneView=null,this._properties.showInDataWindow.listeners().subscribe(t,a.prototype.fullUpdate),this.marketStatus=new n,this._seriesLoaded=!1,this.properties().minTick.listeners().subscribe(this,c.prototype._recreateFormatter),r=this,this.properties().minTick.listeners().subscribe(null,function(){r.m_model.invalidate(new M(M.FULL_UPDATE))}),this._priceLineView=new l(this),this._gotoDateView=new x(this),this.bindStyleChange(),this.bindJapChartsInputs(),this.createExtendedHoursProperty(),this.extendedHours.listeners().subscribe(this,function(){this._extendedHoursChanged.fire()}),this._extendedHoursNotPermitted.subscribe(this,function(){this._properties.extendedHours.setValue(!1)}),this._extendedHoursChanged.subscribe(this,function(){this._status!==c.STATUS_SNAPSHOT&&this.restart()}),this._symbolIntervalChanged.subscribe(this,this.checkInterval),this.properties().showCountdown.listeners().subscribe(this,c.prototype._onChangeShowCountdown),this._onChangeShowCountdown(this.properties().showCountdown),this._recreateFormatter(),this._isDWMCached=null}var d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V,M,D,O,B,R,N,F;TradingView.DEFAULT_BAR_COUNT=300,TradingView.TIME_PLOT=0,TradingView.OPEN_PLOT=1,TradingView.HIGH_PLOT=2,TradingView.LOW_PLOT=3,TradingView.CLOSE_PLOT=4,TradingView.ADT_PLOT=6,TradingView.STYLE_PLOT=7,TradingView.SEARCH_FROM_LEFT=-1,TradingView.SEARCH_FROM_RIGHT=1,d=i(86),p=i(88),u=i(89),_=i(90),f=i(92),g=f.SeriesAreaPaneView,m=f.SeriesLinePaneView,v=f.SeriesHollowCandlesPaneView,y=f.SeriesCandlesPaneView,b=f.SeriesBarsPaneView,w=f.SeriesHeikenAshiPaneView,S=i(100),T=i(101).SeriesBarColorer,C=i(102).HorzLineRenderer,x=i(105),P=i(79).PriceDataSource,L=i(106),k=i(108).FutureBarsPaneView,E=i(41),I=i(94),A=i(110),V=i(111),M=i(113),D=i(44),O=i(82),B=O.PriceFormatter,R=i(112),N=i(114),F=i(115).SyncModel,l.prototype.update=function(){this._invalidated=!0},l.prototype.updateImpl=function(){if(this._visible=!1,this._series.properties().showPriceLine.value()){var t=this._series.lastValueData(TradingView.CLOSE_PLOT,!0);t.noData||(this._visible=!0,this._points=[new e.Point(0,t.coordinate)],this._color=t.color)}},l.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var t={};return t.points=this._points,t.color=this._color,t.linewidth=this._series.properties().priceLineWidth.value(),t.linestyle=CanvasEx.LINESTYLE_DOTTED,t.hitTestResult=I.REGULAR,t.visible=this._visible,new C(t)},inherit(c,P),c.prototype.endOfData=function(){return this._endOfData},c.prototype.serverTimeOffset=function(){return this._chartApi.serverTimeOffset()},c.prototype._onChangeShowCountdown=function(t){var e=this;t.value()?this._countdownUpdateTimer=this.m_model.setInterval(function(){e.isDWM()||(e._priceAxisViews[0].update(),e.m_model.invalidate(new M(M.LIGHT_UPDATE)))},500):(this.m_model.clearInterval(this._countdownUpdateTimer),delete this._countdownUpdateTimer)},c.prototype.lastValueData=function(t,e,i){var o,n,s,r,a,l,h,c,d,p,u={noData:!0};if(this.m_model.timeScale().isEmpty()||this.priceScale().isEmpty()||this.data().isEmpty())return u;if(o=this.m_model.timeScale().visibleBars(),o.isEmpty())return u;if(e){if(r=this.data().bars().last(),null===r||void 0===r)return u;n=r.value,s=parseInt(r)}else{if(a=this.data().bars().search(o.lastBar(),TradingView.SEARCH_NEAREST_LEFT),null===a||void 0===a)return u;n=this.data().bars().valueAt(a.index),s=a.index}return l={noData:!1},h=n[TradingView.CLOSE_PLOT],i&&(l.price=h),this.priceScale().properties().percentage.value()&&(c=this.firstValue(),h=this.priceScale().priceRange().convertToPercent(h,c)),l.text=this.priceScale().formatter().format(h),d=this.barColorer(),p=d.barStyle(s,!1),l.color=p.barColor,l.floatCoordinate=this.priceScale().priceToCoordinate(h,!0),l.coordinate=Math.round(l.floatCoordinate),l.index=s,l},c.prototype._prepareChartApiParams=function(){return this._requestOptions.startDate?!this._requestOptions.startDate||this._requestOptions.endDate||this._requestOptions.count?this._requestOptions.startDate&&this._requestOptions.endDate?["from_to",this._requestOptions.startDate,this._requestOptions.endDate]:["from_to",this._requestOptions.startDate,this._requestOptions.count]:["from_to",this._requestOptions.startDate]:this._requestOptions.count||TradingView.DEFAULT_BAR_COUNT},c.prototype._nextSymbolId=1,c.prototype._nextSeriesId=1,c.STYLE_BARS=0,c.STYLE_CANDLES=1,c.STYLE_LINE=2,c.STYLE_LINE_TYPE_MARKERS=0,c.STYLE_LINE_TYPE_STEP=1,c.STYLE_LINE_TYPE_SIMPLE=2,c.STYLE_AREA=3,c.STYLE_RENKO=4,c.STYLE_KAGI=5,c.STYLE_PNF=6,c.STYLE_PB=7,c.STYLE_HEIKEN_ASHI=8,c.STYLE_HOLLOW_CANDLES=9,c.STATUS_OFFLINE=0,c.STATUS_RESOLVING=1,c.STATUS_LOADING=2,c.STATUS_READY=3,c.STATUS_INVALID_SYMBOL=4,c.STATUS_SNAPSHOT=5,c.STATUS_EOD=6,c.STATUS_PULSE=7,c.STATUS_DELAYED=8,c.STATUS_DELAYED_STREAMING=9,c.STATUS_NO_BARS=10,c.PERMISSION_DENIED="permission denied",c.PD_REASON_SYMBOL="symbol",c.PD_REASON_EXTENDED_HOURS="extended_hours",c.STUDY_NOT_AUTH="study_not_auth",c.STYLE_SHORT_NAMES={},c.STYLE_SHORT_NAMES[c.STYLE_BARS]="bar",c.STYLE_SHORT_NAMES[c.STYLE_CANDLES]="candle",c.STYLE_SHORT_NAMES[c.STYLE_HOLLOW_CANDLES]="hollowCandle",c.STYLE_SHORT_NAMES[c.STYLE_LINE]="line",c.STYLE_SHORT_NAMES[c.STYLE_AREA]="area",c.STYLE_SHORT_NAMES[c.STYLE_RENKO]="renko",c.STYLE_SHORT_NAMES[c.STYLE_PB]="pb",c.STYLE_SHORT_NAMES[c.STYLE_KAGI]="kagi",c.STYLE_SHORT_NAMES[c.STYLE_PNF]="pnf",c.STYLE_SHORT_NAMES[c.STYLE_HEIKEN_ASHI]="ha",c._SYMBOL_STRING_DATA={},c._SYMBOL_STRING_DATA[c.STYLE_RENKO]={type:"BarSetRenko@tv-prostudies-1!",inputNames:["source","style","boxSize","atrLength"]},c._SYMBOL_STRING_DATA[c.STYLE_PB]={type:"BarSetPriceBreak@tv-prostudies-1!",inputNames:["source","lb"]},c._SYMBOL_STRING_DATA[c.STYLE_KAGI]={type:"BarSetKagi@tv-prostudies-1!",inputNames:["source","style","atrLength","reversalAmount"]},c._SYMBOL_STRING_DATA[c.STYLE_PNF]={type:"BarSetPnF@tv-prostudies-1!",inputNames:["sources","style","boxSize","atrLength","reversalAmount"]},c._SYMBOL_STRING_DATA[c.STYLE_HEIKEN_ASHI]={type:"BarSetHeikenAshi@tv-basicstudies-1!",inputNames:[]},c.prototype.model=function(){return this.m_model},c.prototype.fixLastBar=function(t){this._futureBarsPaneView||(this._futureBarsPaneView=new k(this,this.data().bars().lastTimeIndex()+1,t))},c.prototype.clearData=function(){this.data().clear()},c.prototype.data=function(){return this.m_data},c.prototype.symbolId=function(){return this._symbolId},c.prototype.isPulse=function(){return this._symbolInfo&&this._symbolInfo.resolutions.length>0},c.prototype.onTagsChanged=function(){return this._tagsChanged},c.prototype.onSymbolIntervalChanged=function(){return this._symbolIntervalChanged},c.prototype.onSymbolResolved=function(){return this._symbolResolved},c.prototype.onSymbolError=function(){return this._symbolError},c.prototype.onSymbolNotPermitted=function(){return this._symbolNotPermitted},c.prototype.onIntervalChanged=function(){return this._intervalChanged},c.prototype.onExtendedHoursNotPermitted=function(){return this._extendedHoursNotPermitted},c.prototype.onStartLoading=function(){return this._startLoading},c.prototype.onDataLoaded=function(){return this._dataLoaded},c.prototype.onStatusChanged=function(){return this._onStatusChanged},c.prototype.onTickmarksRangeChanged=function(){return this._tickmarksRangeChanged},c.prototype.onBarReceived=function(){return this._barReceived},c.prototype.onChangedStyle=function(){return this._onChangedStyle},c.prototype.onCompleted=function(){return this._onCompleted},c.prototype.onRestarted=function(){return this._onRestarted},c.prototype.onBoxSizeChanged=function(){return this._boxSizeChanged},c.prototype.status=function(){return this._status},c.prototype.isDWM=function(){var t,e;return null!==this._isDWMCached?this._isDWMCached:(t=new E(this._properties.interval.value()),t.isDWM()?this._isDWMCached=!0:(e=t.kind()===E.SECONDS?t.multiplier():60*t.multiplier(),this._isDWMCached=!(e<216e3)),this._isDWMCached)},c.prototype.lastPriceLabelFixedCoordinate=function(){return this._priceAxisViews[0]._fixedCoordinate},c.prototype.createPaneView=function(){this._paneView=null,this._projectionBarsPaneView=null,this._symbolLabelView=new L(this.m_model,this,TradingView.CLOSE_PLOT,"firstShortName","showSymbolLabels");var t=this._properties.style.value();switch(t){case c.STYLE_BARS:this._paneView=new b(this,this.m_model);break;case c.STYLE_CANDLES:this._paneView=new y(this,this.m_model);break;case c.STYLE_LINE:this._paneView=new m(this,this._properties.lineStyle.priceSource.value(),this.m_model);break;case c.STYLE_AREA:this._paneView=new g(this,this._properties.areaStyle.priceSource.value(),this.m_model);break;case c.STYLE_HEIKEN_ASHI:this._paneView=new w(this,this.m_model);break;case c.STYLE_HOLLOW_CANDLES:this._paneView=new v(this,this.m_model);break;default:throw Error("Unknown chart style assigned: "+t)}},c.prototype._clearStylePlot=function(t,e){var i,o;t.size()&&(i=e||+t.first(),o=+t.last()+1,t.range(i,o).each(function(t,e){e[TradingView.STYLE_PLOT]=null}))},c.prototype.invalidateBarStylesCache=function(t){TradingView.logDebugChart("Invalidate style cache starting from "+t),this._clearStylePlot(this.m_data.m_bars,t),this._clearStylePlot(this.m_data.m_nsBars)},c.prototype.invalidateBarColorerCache=function(){delete this._barColorerCache,this.invalidateBarStylesCache()},c.prototype.barColorer=function(){var t,e,i,o;if(this._barColorerCache)return this._barColorerCache;for(t=null,e=this.m_model.dataSources().length-1;e>=0;e--)i=this.m_model.dataSources()[e],i.metaInfo&&TradingView.isInherited(i.constructor,TradingView.Study)&&i.hasBarColorer()&&i.properties().visible.value()&&(o=i.barColorer(),null===t?t=o:t.pushBackBarColorer(o));return null===t?t=new T(this):t.pushBackBarColorer(new T(this)),this._barColorerCache=t,this._barColorerCache},c.prototype.properties=function(){return this._properties},c.prototype._barsState=function(t){var e=t.state();return e.columns=e.columns.filter(function(t){return"style"!==t}),e.data.forEach(function(t){t.value.splice(7,1)}),e},c.prototype.state=function(t){var e=this===this.m_model.mainSeries()?"MainSeries":TradingView.className(this.constructor),i={type:e,id:this.id(),state:this.properties().state(),zorder:this.zorder()};return this._symbolInfo&&this._symbolInfo.ticker&&(i.state.symbol=this._symbolInfo.ticker),t&&(i.bars=this._barsState(this.m_data.m_bars),i.nsBars=this._barsState(this.m_data.m_nsBars),i.symbolInfo=this._symbolInfo,i.rtPrice=this.data().lastProjectionPrice),i.boxSize=this.data().boxSize,i.reversalAmount=this.data().reversalAmount,i},c.prototype.stateForAlert=function(){var t=this===this.m_model.mainSeries()?"MainSeries":TradingView.className(this.constructor);return{id:this.id(),uniqueId:this.uniqueId(),type:t,proSymbol:this.proSymbol(),actualSymbol:this.actualSymbol(),interval:this.interval(),style:this.properties().style.value(),styleInputs:this.getInputsProperties().state(),extendedHours:this.extendedHours.value(),boxSize:this.data().boxSize,reversalAmount:this.data().reversalAmount}},c.prototype.uniqueId=function(){return this.actualSymbol()+"|"+this.interval()},c.prototype.restoreData=function(t,e,i,o,n,s){this._status=c.STATUS_SNAPSHOT,this.m_data.m_bars.restoreState(t),this.m_data.m_nsBars.restoreState(e),this.updateSymbolInfo(i),this.m_data.lastProjectionPrice=o,this.m_data.boxSize=n,n||(this.properties().style.value()===c.STYLE_PNF?this.m_data.boxSize=this.properties().pnfStyle.inputs.boxSize.value():this.properties().style.value()===c.STYLE_RENKO&&(this.m_data.boxSize=this.properties().renkoStyle.inputs.boxSize.value())),this.m_data.reversalAmount=s,s||this.properties().style.value()===c.STYLE_KAGI&&(this.m_data.reversalAmount=this.properties().kagiStyle.inputs.reversalAmount.value())},c.prototype.setProperties=function(t){t.timeframe||t.merge({timeframe:""}),t.shortName||t.merge({shortName:""}),this._properties=t,this._properties.symbol.listeners().subscribe(this,c.prototype.changeSymbol),this._properties.interval.listeners().subscribe(this,c.prototype.changeInterval),this._properties.timeframe.listeners().subscribe(this,c.prototype.changeTimeFrame),this._properties.listeners().subscribe(this,c.prototype.changeProperties)},c.prototype.changeSymbol=function(){this.setSymbolIntervalDelayed(),this.m_model.checkLineToolSelection()},c.prototype.changeInterval=function(){this.setSymbolIntervalDelayed()},c.prototype.changeTimeFrame=function(){TradingView.trackEvent("GUI","Change timeframe")},c.prototype.title=function(){return this.properties().symbol.value()+", "+TradingView.translatedIntervalString(this.properties().interval.value())},c.generateTitleForGui=function(t){function e(t,e){var i=Math.round(t*Math.pow(10,e))/Math.pow(10,e);return i||""}var i,o,n,s=t||{},r="QUANDL"===s.exchange,a="",l={symbolDescription:"",interval:"",exchange:"",chartStyle:""};switch(s.description&&r?2===s.description.split("/").length?l.symbolDescription=s.description.split("/")[1]:(i=s.description.split("'").filter(function(t){return t.length}),i.forEach(function(t){t=t&&("/"===t[0]||/\d+\/\(?/.test(t))?[t]:t.split("/").filter(function(t){return t.length}),l.symbolDescription+=t[2===t.length?1:0]})):s.description?l.symbolDescription=s.description:l.symbolDescription=s.symbol,s.interval&&(l.interval=TradingView.translatedIntervalString(s.interval)),r&&s.description&&(o=/[\w_]+\/[\w_]+/.exec(s.description),o&&o[0]?l.provider=o[0].split("/")[0]:l.provider=s.description.split("/")[0]),s.exchange&&(l.exchange=s.exchange),s.style){case c.STYLE_RENKO:n=s.inputs.style+("ATR"===s.inputs.style?"("+s.inputs.atrLength+")":""),l.chartStyle=$.t("Renko")+" ["+s.inputs.source+", "+n+", "+e(s.boxSize,4)+"]";break;case c.STYLE_PB:l.chartStyle=$.t("Line Break")+" ["+s.inputs.source+", "+s.inputs.lb+"]";break;case c.STYLE_KAGI:n=s.inputs.style+("ATR"===s.inputs.style?"("+s.inputs.atrLength+")":""),l.chartStyle=$.t("Kagi")+" ["+s.inputs.source+", "+n+", "+e(s.reversalAmount,4)+"]";break;case c.STYLE_PNF:n=s.inputs.style+("ATR"===s.inputs.style?"("+s.inputs.atrLength+")":""),l.chartStyle=$.t("PnF")+" ["+s.inputs.sources+", "+n+", "+e(s.boxSize,4)+", "+s.inputs.reversalAmount+"]";break;case c.STYLE_HEIKEN_ASHI:l.chartStyle=$.t("Heikin Ashi")}return a=l.symbolDescription+(l.interval?", "+l.interval:"")+(l.provider?", "+l.provider:"")+(l.exchange?", "+l.exchange:"")+(l.chartStyle?", "+l.chartStyle:""),a=a.replace(/\'/g,"")},c.prototype.changeProperties=function(t){t!==this._properties.symbol&&t!==this._properties.interval&&t!==this._properties.timeframe&&(this._tagsChanged.fire(),this.createPaneView(),this.updateAllViews(),this.m_model.updateSource(this))},c.prototype._makeNextSymbolId=function(){return"symbol_"+this._nextSymbolId++},c.prototype._makeNextSeriesId=function(){return"s"+this._nextSeriesId++},c.prototype._clearLoadingTimer=function(){this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null)},c.prototype.onData=function(t){var e,i,o,n,r,a,l,h,d,p,u,_,f,g,m,v,y,b,w=this;switch(t.method){case"symbol_resolved":if(t.params[0]!==this._symbolId){TradingView.logNormalChart("command for old symbol. Expected:"+this._symbolId+", actual"+t.params[0]);break}this.updateSymbolInfo(t.params[1]),this.m_model.updateSource(this),this._symbolResolved.fire(this._symbolInfo),this.m_model.realignLineTools(),TradingView.onWidget()||TradingView.trackEvent("Symbol",t.params[1].listed_exchange,t.params[1].name),e=this.symbolInfo().minmov/this.symbolInfo().pricescale,i=this.properties(),i.style.value()===c.STYLE_RENKO&&i.renkoStyle.inputs.boxSize.value()<e?i.renkoStyle.inputs.merge({boxSize:e}):i.style.value()===c.STYLE_PNF&&i.pnfStyle.inputs.boxSize.value()<e?i.pnfStyle.inputs.merge({boxSize:e}):i.style.value()===c.STYLE_KAGI&&i.kagiStyle.inputs.reversalAmount.value()<e&&i.kagiStyle.inputs.merge({reversalAmount:e});break;case"symbol_error":if(t.params[0]!==this._symbolId){TradingView.logNormalChart("command for old symbol. Expected:"+this._symbolId+", actual"+t.params[0]);break}if(this._clearLoadingTimer(),this._setStatus(c.STATUS_INVALID_SYMBOL),this._properties.shortName.setValue(this._properties.symbol.value()),this.m_model.clearAllStudies(),this.updateAllViews(),this.m_model.updateSource(this),t.params[1]===c.PERMISSION_DENIED)switch(t.params[2]){case c.PD_REASON_EXTENDED_HOURS:this._extendedHoursNotPermitted.fire();break;case c.PD_REASON_SYMBOL:this._symbolNotPermitted.fire(t.params[3]);break;default:this._symbolNotPermitted.fire(t.params[2])}else this.m_model.resetTimeScale(),this._symbolError.fire(),Telemetry.sendReport("symbol_error",{chartSession:w._chartApi._sessionid,symbol:w.getSymbolString()});this.m_model.realignLineTools();break;case"series_timeframe":if(t.params[1]!==this._turnaround)break;o=t.params[2],n=t.params[3],r=t.params[4],a=void 0!==r&&r?n:n+10,this.m_model.setTimeViewport(o,a);break;case"series_error":l=t.params[2],this._clearLoadingTimer(),delete this._loadingStartTime,s.enabled("charting_library_debug_mode")&&TradingView.logNormal("Error reason: "+l),this._setStatus(s.enabled("no_bars_status")&&this._symbolInfo?c.STATUS_NO_BARS:c.STATUS_INVALID_SYMBOL),l&&l.startsWith("study_not_auth:")?(h=l.split(":",2)[1].split("@",2)[0],h in{BarSetRenko:!0,BarSetPriceBreak:!0,BarSetKagi:!0,BarSetPnF:!0}?this.chartTypeNotPermitted.fire(h):"BarSetSpread"===h&&this.intradaySpreadNotPermitted.fire()):"resolution_not_entitled"===l?this.intradayExchangeNotPermitted.fire():"custom_resolution"===l&&this.customIntervalNotPermitted.fire(),this._seriesLoaded=!0;break;case"series_loading":if(t.params[1]!==this._turnaround)break;if(t.params[0]!==this._seriesId){TradingView.logNormalChart("command for old series. Expected:"+this._seriesId+", actual"+t.params.customId);break}this._setStatus(c.STATUS_LOADING),w._loadingStartTime=(new Date).getTime(),w.loadingTimer=setTimeout(function(){var t={chartSession:w._chartApi._sessionid,symbol:w.getSymbolString(),interval:w.interval()};Telemetry.sendReport("series_loading",t)},15e3);break;case"series_completed":if(t.params[2]!==this._turnaround)break;if(t.params[0]!==this._seriesId){TradingView.logNormalChart("command for old series. Expected:"+this._seriesId+", actual"+t.params.customId);break}switch(d="chartSession:"+w._chartApi._sessionid,TradingView.logDebugChart(d+", Series loading took "+((new Date).getTime()-this._loadingStartTime)+" ms, eod:"+this._endOfData),delete this._loadingStartTime,p=t.params[1],"pulsed"===p&&(p="delayed"),p){case"streaming":this._setStatus(c.STATUS_READY);break;case"endofday":this._setStatus(c.STATUS_EOD);break;case"delayed":this._setStatus(c.STATUS_DELAYED);break;case"pulsed":this._setStatus(c.STATUS_PULSE)}p.match(/delayed_streaming/)&&this._setStatus(c.STATUS_DELAYED_STREAMING),u=this.m_model.paneForSource(this),u.recalculatePriceScale(this.priceScale()),this.m_model.invalidate(new M(M.FULL_UPDATE)),this.m_data.size()&&this._tickmarksRangeChanged.fire({start:this.data().first().value[TradingView.TIME_PLOT],end:this.data().last().value[TradingView.TIME_PLOT]}),this.model().recalcVisibleRangeStudy(this.model().dataSources(),!0),this.model().recalcStudyBasedLineTools(),!this.isLockScale()||this.model().timeScale().isEmpty()||this._seriesLoaded||(this.model().timeScale()._correctOffset(),this.model().timeScale().correctBarSpacing(),_=this.model().timeScale().visibleBars(),this.priceScale().setPriceRange(this.priceRange(_.firstBar(),_.lastBar()))),this._seriesLoaded=!0,this._onCompleted.fire(this._endOfData),this.requestMoreData();break;case"series_deleted":break;case"data_update":if(t.params.customId!==this._seriesId){TradingView.logNormalChart("command for old series. Expected:"+this._seriesId+", actual"+t.params.customId);break}if(this.status()===c.STATUS_INVALID_SYMBOL)break;this._clearLoadingTimer(),t.params.plots.length>0&&(this._endOfData=!1),t.params.plots.length?(f=this.m_data.m_bars.size(),g=this.m_data.m_bars.merge(t.params.plots),m="Merge bars. Changes:{length:"+g.length+", earliestRow:"+g.earliestRow.index+"} ",m+="bars state:{firstBar:"+this.m_data.m_bars.first()+",lastBar:"+this.m_data.m_bars.last()+",size:"+this.m_data.m_bars.size()+"}",TradingView.logDebugChart(m),f!==this.bars().size()&&(this._barReceived.fire(this.m_data.m_bars.size()),this.model().recalcVisibleRangeStudy(this.model().dataSources(),!0))):(this.m_data.clear(),this._startLoading.fire()),v=this.properties().style.value(),!t.params.nonseries||v!==c.STYLE_RENKO&&v!==c.STYLE_KAGI&&v!==c.STYLE_PNF&&v!==c.STYLE_HEIKEN_ASHI&&v!==c.STYLE_PB?t.params.nonseries||(this.m_data.m_nsBars.clear(),this.m_data.lastProjectionPrice=void 0):(y=this.parseJapProjBars(t.params.nonseries),this.m_data.m_nsBars=y.nsBars,this.m_data.lastProjectionPrice=y.lastPrice,b=this.m_data.boxSize!==y.boxSize,this.m_data.boxSize=y.boxSize,this.m_data.reversalAmount=y.reversalAmount,b&&this._boxSizeChanged.fire(this.m_data.boxSize)),u=this.m_model.paneForSource(this),this.m_model.updateAllVolumeStudies(),this.m_model.recalculatePane(u),this.m_model.updateSource(this),this.m_model.updateLineTools(),this.m_model.updateCrossHair()}this._dataLoaded.fire(t)},c.prototype.fixBoxSize=function(){var t=this.model().timeScale(),e=this.priceScale();e.isEmpty()||t.isEmpty()||(this.m_data.boxSize=Math.abs(e.coordinateToPrice(t.barSpacing())-e.coordinateToPrice(0)))},c.prototype.parseJapProjBars=function(t){var e,i,o,n,s,r,a,l,h=new R(["time","open","high","low","close","adt","style"]),d=this.model().timeScale(),p=this.properties().style.value();if(t.d&&""!==t.d)for(n=TradingView.Study.prototype._makeJSONForNSData.call(this,{params:{nonseries:t}}).data,e=n.price,i=n.boxSize,o=n.reversalAmount,s=n.bars,r=0;s&&r<s.length;r++)a=[],l=t.indexes[s[r].time],a.push(d.points().valueAt(l)),a.push(s[r].open),a.push(s[r].high),a.push(s[r].low),a.push(s[r].close),a.push(s[r].volume),p===c.STYLE_KAGI?a.push(s[r].additionalPrice):p===c.STYLE_PNF&&a.push(s[r].factor),h.add(l,a);return{nsBars:h,lastPrice:e,boxSize:i,reversalAmount:o}},c.prototype.disconnect=function(){this._symbolId=null,this._seriesId=null,this._predictBars=0,this._status=c.STATUS_OFFLINE},c.prototype.isStarted=function(){return!!this._symbolId},c.prototype.restart=function(){var t,e=i(117);this._onRestarted.fire(),this._setStatus(c.STATUS_RESOLVING),this.m_data=new V(this,this.model()),this._prevSymbolId=this._symbolId,this._symbolId=this._makeNextSymbolId(),t=this._properties.interval.value(),this._pendingTimeRange&&(t=this._generateTimeframe(t,this._pendingTimeRange),delete this._pendingTimeRange),this._chartApi.resolveSymbol(this._symbolId,this.getSymbolString(),this._handler),this._seriesId?(this._turnaround="s"+ ++this._turnaroundCounter,this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,t,this._handler,this._prevSymbolId)):(this._seriesId=this._makeNextSeriesId(),this._chartApi.createSeries(this._seriesId,this._turnaround,this._symbolId,t,this._prepareChartApiParams(),this._handler)),this._properties.showInDataWindow.listeners().subscribe(this.m_model,e.prototype.fullUpdate),this.m_symbol=this._properties.symbol.value(),this.m_interval=this._properties.interval.value()},c.prototype._generateTimeframe=function(t,e){var i,o=e.right(1),n=t;return"ytd"===e?n+=",YTD":"d"===o?(i=e.left(e.length-1),n+=","+i,s.enabled("daily_timeframe_suffix")&&(n+="D")):"m"===o?(i=e.left(e.length-1),n+=","+i+"M"):"all"===e&&(n+=",ALL"),n},c.prototype.hasDelayedSymbolIntervalChange=function(){return!!this._setSymbolIntervalDelay},c.prototype.setSymbolIntervalDelayed=function(){this._isDWMCached=null,(this._checkSymbolWillChanged(this._properties.symbol.value())||this._checkIntervalWillChanged(this._parseInterval(this._properties.interval.value()).interval))&&(this._setSymbolIntervalDelay&&clearTimeout(this._setSymbolIntervalDelay),this._setSymbolIntervalDelay=setTimeout(function(){delete this._setSymbolIntervalDelay,this.setSymbolInterval(this._properties.symbol.value(),this._properties.interval.value())}.bind(this),30))},c.prototype._checkSymbolWillChanged=function(t){return!this.symbolSameAsCurrent(t)||s.enabled("same_data_requery")},c.prototype._checkIntervalWillChanged=function(t){return this.m_interval!==t||s.enabled("same_data_requery")},c.prototype._parseInterval=function(t){var e=(t+"").split(",");return{interval:2===e.length?e[0]:t,timeframe:2===e.length?e[1]:0}},c.prototype.setSymbolInterval=function(t,e){var i,o,n,s,r,a,l;delete this._gotoDateResult,i=this._parseInterval(e),o=i.interval,n=i.timeframe,s=this._checkSymbolWillChanged(t),r=this._checkIntervalWillChanged(o),(s||r)&&(this._syncModel=null,this.m_symbol=t,this.m_interval=o,this.m_timeframe=n,this._symbolId&&!s||this.updateSymbolInfo(null),this.m_model.realignLineTools(),this._status!==c.STATUS_SNAPSHOT&&(this._setStatus(c.STATUS_RESOLVING),this._symbolIntervalChanged.fire(),r&&(a={timeframe:this._pendingTimeRange},this._intervalChanged.fire(this.m_interval,a),this._pendingTimeRange=a.timeframe&&a.timeframe.toLowerCase()),this._onRestarted.fire(),this._seriesLoaded=!1,this._chartApi&&this._chartApi.connected()&&(this._symbolId&&!s||(this._prevSymbolId=this._symbolId,this._symbolId=this._makeNextSymbolId(),l=this.getSymbolString(),this._chartApi.resolveSymbol(this._symbolId,l,this._handler)),this._seriesId?(this._turnaround="s"+ ++this._turnaroundCounter,this._pendingTimeRange&&(e=this._generateTimeframe(e,this._pendingTimeRange),delete this._pendingTimeRange),this._predictBars=0,this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,e,this._handler,this._prevSymbolId)):(this._seriesId=this._makeNextSeriesId(),this._chartApi.createSeries(this._seriesId,this._turnaround,this._symbolId,e,this._prepareChartApiParams(),this._handler)))))},c.prototype.setDefaultTimeframe=function(t){this._pendingTimeRange=t},c.prototype.actualSymbol=function(){return this.symbolInfo()?this.symbolInfo().full_name:this.symbol()},c.prototype.proSymbol=function(){return this.symbolInfo()?this.symbolInfo().pro_name:this.symbol()},c.prototype.symbol=function(){return this.properties().symbol.value()},c.prototype.interval=function(){return this.properties().interval.value()},c.prototype.isIntradayInterval=function(){return!!/^\d*$/.test(this.interval())&&this.interval()<=1440},c.prototype.bars=function(){return this.m_data.m_bars},c.prototype.nsBars=function(){return this.m_data.m_nsBars},c.prototype.open=function(t){return this.m_data.valueAt(t)[TradingView.OPEN_PLOT]},c.prototype.high=function(t){return this.m_data.valueAt(t)[TradingView.HIGH_PLOT]},c.prototype.low=function(t){return this.m_data.valueAt(t)[TradingView.LOW_PLOT]},c.prototype.close=function(t){return this.m_data.valueAt(t)[TradingView.CLOSE_PLOT]},c.prototype.hl2=function(t){return(this.high(t)+this.low(t))/2},c.prototype.hlc3=function(t){return(this.high(t)+this.low(t)+this.close(t))/3},c.prototype.ohlc4=function(t){return(this.open(t)+this.high(t)+this.low(t)+this.close(t))/4},c.prototype.priceRange=function(t,e){var i,o,n,s,a,l,h,c;return TradingView.isInteger(t)?TradingView.isInteger(e)?this.data().isEmpty()?null:(o=this.data().boxSize,this.isLockScale()?(void 0===o&&this.fixBoxSize(),n=this.priceScale().internalHeight()/(this.model().timeScale().barSpacing()/this.data().boxSize),s=this.data().search(e,TradingView.SEARCH_NEAREST_LEFT),a=(s.value[TradingView.HIGH_PLOT]+s.value[TradingView.LOW_PLOT])/2,i=new r(a-.5*n,a+.5*n),l=this.data().search(t,TradingView.SEARCH_NEAREST_RIGHT),this.priceScale().properties().percentage.value()&&i?i.convertToPercents(l.value[TradingView.CLOSE_PLOT]):i):(h=this.data().bars().minMaxOnRange2(t,e,[{index:TradingView.LOW_PLOT,offset:0},{index:TradingView.HIGH_PLOT,offset:0}]),c=this.data().nsBars().minMaxOnRange(t,e,[{index:TradingView.LOW_PLOT,offset:0},{index:TradingView.HIGH_PLOT,offset:0}]),null!=c.min&&(h.min=Math.min(h.min,c.min)),null!=c.max&&(h.max=Math.max(h.max,c.max)),i=new r(h.min,h.max),i&&i.minValue()===i.maxValue()&&(i=new r(i.minValue()-.5,i.maxValue()+.5)),
this.priceScale().properties().percentage.value()&&i?(l=this.data().search(t,TradingView.SEARCH_NEAREST_RIGHT),i.convertToPercents(l.value[TradingView.CLOSE_PLOT])):this.priceScale().isLog()&&i?new r(this.priceScale().priceToLogical(i.minValue()),this.priceScale().priceToLogical(i.maxValue())):i)):(TradingView.logDebugChart("Series.priceRange: incorrect endBar"),null):(TradingView.logDebugChart("Series.priceRange: incorrect startBar"),null)},c.prototype.nearestData=function(t,e){if(!TradingView.isInteger(t))return void TradingView.logDebugChart("Series.nearestData: incorrect logicalPoint");var i=this.data().search(t,e);return i||void 0},c.prototype.nearestIndex=function(t,e){var i=this.nearestData(t,e);return i?i.index:void 0},c.prototype.paneViews=function(t){if(!this.properties().visible.value())return null;var e=[this._paneView];return this._futureBarsPaneView&&e.push(this._futureBarsPaneView),this._projectionBarsPaneView&&e.push(this._projectionBarsPaneView),e.push(this._priceLineView),e.push(this._symbolLabelView),e.push(this._gotoDateView),e},c.prototype.dataWindowView=function(){return this._dataWindowView},c.prototype.statusView=function(){return this._statusView},c.prototype.priceAxisViews=function(t,e){return this.m_model.paneForSource(this)===t&&e===this.priceScale()&&(this.m_model.properties().scalesProperties.showSeriesLastValue.value()||this.properties().showCountdown.value())?this._priceAxisViews:null},c.prototype.base=function(){return this._base},c.prototype.formatter=function(){return this._formatter},c.prototype.purgeSymbolInfo=function(){this._symbolInfo=null},c.prototype.symbolInfo=function(){return this._symbolInfo},c.prototype._recreateFormatter=function(){var t,e,i,o;"default"===this.properties().minTick.value()?this._formatter=new B(this._symbolInfo?this._symbolInfo.pricescale:100,this._symbolInfo?this._symbolInfo.minmov:1,!!this._symbolInfo&&this._symbolInfo.fractional,this._symbolInfo?this._symbolInfo.minmove2:void 0):(t=this.properties().minTick.value().split(","),e=parseInt(t[0]),i=parseInt(t[1]),o="true"===t[2],this._formatter=new B(e,i,o)),this.priceScale()&&this.priceScale().updateFormatter()},c.prototype.updateSymbolInfo=function(t){var e=this,i=t&&(t.pro_name||t.full_name||t.name);s.enabled("charting_library_base")&&this.m_symbol?i=this.m_symbol:s.enabled("pay_attention_to_ticker_not_symbol")&&t&&t.ticker&&(i=t.ticker),this._symbolInfo=t,t&&(this._properties.shortName.setValue(t.name),i&&this._properties.symbol.value().toUpperCase()!==i.toUpperCase()&&this._properties.symbol.setValue(i)),this._base=t?t.pricescale/t.minmov:100,this._recreateFormatter(),this._statusView.update(),this.priceScale().updateFormatter(),"undefined"!=typeof quoteSessionMultiplexerInstance&&this._quoteSessionSymbol!==i&&(this._quoteSessionClientId||(this._quoteSessionClientId="series-"+TradingView.guid()),this._quoteSessionSymbol&&(quoteSessionMultiplexerInstance.simple.unsubscribe(this._quoteSessionClientId,this._quoteSessionSymbol),this._quoteSessionSymbol=void 0),i&&(this._quoteSessionSymbol=i,quoteSessionMultiplexerInstance.simple.subscribe(this._quoteSessionClientId,this._quoteSessionSymbol,function(t,i){e.quoteData=t&&t.values||null,i&&i.values&&i.values.current_session&&e.marketStatus.setValue(i.values.current_session)}))),this.checkInterval(),this.dataPoweredBy=A(t)},c.prototype.symbolSameAsCurrent=function(t){if(this.m_symbol===t)return!0;var e=this._symbolInfo;if(e){if(e.full_name===t||e.pro_name===t)return!0;if(e.ticker===t)return!0;if(e.aliases&&e.aliases.indexOf(t)!==-1)return!0;if(e.alternatives&&e.alternatives.indexOf(t)!==-1)return!0}return!1},c.prototype.updateAllViews=function(){this._paneView.update(),this._dataWindowView.update(),this._statusView.update(),this._priceAxisViews[0].update(),this._priceAxisViews[1].update(),this._futureBarsPaneView&&this._futureBarsPaneView.update(),this._projectionBarsPaneView&&this._projectionBarsPaneView.update(),this._priceLineView.update(),this._gotoDateView.update(),this._symbolInfo&&this._symbolLabelView.update()},c.prototype._setStatus=function(t){this._status=t,this._statusView.update(),this.m_model.updateSource(this),this._onStatusChanged.fire()},c.prototype.requestMoreData=function(t){var e,i,o,n;this._status!==c.STATUS_READY&&this._status!==c.STATUS_PULSE&&this._status!==c.STATUS_DELAYED&&this._status!==c.STATUS_DELAYED_STREAMING&&this._status!==c.STATUS_EOD||this.m_model.timeScale().isEmpty()||(e=this.m_model.timeScale().visibleBars(),e.isEmpty()||0!==this.bars().size()&&(i=t||e.lastBar()-this.data().last(),this._predictBars<i&&(this._predictBars=i,this._chartApi&&this._chartApi.connected()&&this._chartApi.requestMoreTickmarks(this._seriesId,i,this._handler)),this._endOfData||(o=this.bars()._indexAt(0),n=t||o-e.firstBar(),n<=0||(this._endOfData=!0,this._chartApi&&this._chartApi.connected()&&(this._chartApi.requestMoreData(this._seriesId,n,this._handler),s.enabled("charting_library_base")&&(this._predictBars=0)),this._setStatus(c.STATUS_LOADING)))))},c.prototype.bindStyleChange=function(){var t=this;["candleStyle","hollowCandleStyle","haStyle","barStyle","lineStyle","areaStyle","renkoStyle","pbStyle","kagiStyle","pnfStyle"].forEach(function(e){t._properties[e].listeners().subscribe(t,c.prototype.invalidateBarStylesCache)})},c.prototype.bindJapChartsInputs=function(){this._properties.style.listeners().subscribe(this,this.onChartStyleChanged),this._properties.renkoStyle.inputs.boxSize.listeners().subscribe(this,this.onInputChanged),this._properties.renkoStyle.inputs.source.listeners().subscribe(this,this.onInputChanged),this._properties.renkoStyle.inputs.style.listeners().subscribe(this,this.onInputChanged),this._properties.renkoStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged),this._properties.pbStyle.inputs.lb.listeners().subscribe(this,this.onInputChanged),this._properties.pbStyle.inputs.source.listeners().subscribe(this,this.onInputChanged),this._properties.kagiStyle.inputs.reversalAmount.listeners().subscribe(this,this.onInputChanged),this._properties.kagiStyle.inputs.style.listeners().subscribe(this,this.onInputChanged),this._properties.kagiStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged),this._properties.kagiStyle.inputs.source.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.boxSize.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.reversalAmount.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.sources.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.style.listeners().subscribe(this,this.onInputChanged),this._properties.pnfStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged);var t=this;this._properties.lockScale.listeners().subscribe(this,function(e){e.value()&&t.model().timeScale().recalcLockedScale()})},c.prototype.createExtendedHoursProperty=function(){function t(){var t=!!window.user&&!!user.extended_session,i=e.model().readOnly(),o=e._properties.extendedHours.value(),n=s.enabled("widget");!o||n||i||t||(e._extendedHoursNotPermitted.fire(),o=!1),o&&!e.isIntradayInterval()&&(o=!1),e.extendedHours.setValue(o)}var e=this;e.extendedHours=new a,e._properties.extendedHours.listeners().subscribe(null,t),e._properties.interval.listeners().subscribe(null,t),e.chartWidgetInitialized.subscribe(null,t),t()},c.prototype.isNeedRestart=function(t){if(void 0===t&&(t=this.properties().style.value()),this._prevChartStyle!==t){var e=[c.STYLE_BARS,c.STYLE_CANDLES,c.STYLE_HOLLOW_CANDLES,c.STYLE_LINE,c.STYLE_AREA];if(!(e.indexOf(this._prevChartStyle)>-1&&e.indexOf(t)>-1))return!0}return!1},c.prototype.onChartStyleChanged=function(){this.isNeedRestart()&&(this.data().clear(),this.model().timeScale().scrollToRealtime(!1),this.restart()),this._prevChartStyle=this.properties().style.value(),this._onChangedStyle.fire(this.properties().style.value()),this.invalidateBarStylesCache()},c.prototype.onInputChanged=function(){this.restart()},c.prototype.onExtendedHoursChanged=function(){return this._extendedHoursChanged},c.prototype.getSymbolString=function(){var t,e,i;return t=s.enabled("pay_attention_to_ticker_not_symbol")&&this._symbolInfo?this._symbolInfo.ticker:this.actualSymbol(),this.extendedHours.value()&&(t={symbol:t,session:"extended"}),c._SYMBOL_STRING_DATA.hasOwnProperty(this._properties.style.value())&&(e=this.getInputsProperties(),i=c._SYMBOL_STRING_DATA[this._properties.style.value()],t={symbol:t,type:i.type,inputs:i.inputNames.map(function(t){return e[t].value()})}),"string"!=typeof t&&(t="="+JSON.stringify(t)),t},c.parseSymbolString=function(t){var e,i,o,n,s,r,a,l=Object.keys(c._SYMBOL_STRING_DATA),h={symbol:null,style:null,extendedHours:null,inputs:null};if(t&&0===t.indexOf("=")){if(e=t.slice(1),e=JSON.parse(e),h.symbol=e.symbol,e.type)for(r=0;r<l.length;r++)if(o=l[r],i=c._SYMBOL_STRING_DATA[o],i.type===e.type){for(h.style=parseInt(o),h.inputs={},a=0;a<i.inputNames.length;a++)s=e.inputs[a],n=i.inputNames[a],h.inputs[n]=s;break}"extended"===h.symbol.session&&(h.extendedHours=!0,h.symbol=h.symbol.symbol)}else h.symbol=t;return h},c.prototype.getStyleShortName=function(){var t=this._properties.style.value();if(c.STYLE_SHORT_NAMES.hasOwnProperty(t))return c.STYLE_SHORT_NAMES[t];throw Error("Missed short name for style "+t)},c.prototype.getInputsProperties=function(){var t=this._properties[this.getStyleShortName()+"Style"];return t.inputs||new a},c.prototype.getRealVisibleRange=function(){var t=this.model().timeScale().visibleBars(),e=this.data().search(t.m_firstBar,TradingView.SEARCH_NEAREST_RIGHT),i=this.data().search(t.m_lastBar,TradingView.SEARCH_NEAREST_LEFT);return void 0===e||void 0===i?null:new S(e.index,i.index)},c.prototype.isLockScale=function(){return this.properties().lockScale.value()},c.prototype.firstValue=function(){return this.data().firstValue()};c.prototype.firstBar=function(){return this.data().firstBar()};c.prototype.sessionsStudy=function(){var t,e,i,o;if(this._sessionsStudy)return this._sessionsStudy;for(t=this.model().paneForSource(this),e=t.dataSources(),i=0;i<e.length;i++)if(o=e[i],o instanceof TradingView.Study&&"Sessions"===o.metaInfo().shortId)return this._sessionsStudy=o,this._sessionsStudy;return!1},c.prototype.createSessStudy=function(){if(!s.enabled("charting_library_base")&&!this.sessionsStudy()){var t=N.findStudyMetaInfo(this.model().studiesMetaData(),"Sessions@tv-basicstudies");this.model().insertStudy(t,!1,!0),this._onSessionsStudyCreated.fire()}},c.prototype.checkSessStudy=function(){s.enabled("charting_library_base")||(this.sessionsStudy()||this.createSessStudy(),this.sessionsStudy().start())},c.prototype.isSpread=function(){return"spread"===this._symbolInfo.type},c.prototype.firstSymbol=function(){return this._symbolInfo?this._symbolInfo.legs[0]:""},c.prototype.firstShortName=function(){return D.ticker(this.firstSymbol())},c.prototype.onSessionsStudyCreated=function(){return this._onSessionsStudyCreated},c.prototype.loadDataTo=function(t){this._turnaround="s"+ ++this._turnaroundCounter;var e=this._properties.interval.value();e=this._generateTimeframe(e,t),this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,e,this._handler)},c.prototype.checkInterval=function(){if(this._symbolInfo&&(E.kind(this.interval())!==E.MINUTES||this._symbolInfo.has_intraday||this.requestingIntradayWhenNotSupported.fire(),this._symbolInfo.hasOwnProperty("supported_resolutions"))){var t=this._properties.interval.value();this._symbolInfo.supported_resolutions.indexOf(t)===-1&&this.requestingResolutionWhenNotSupported.fire(this._symbolInfo.supported_resolutions[0])}},c.prototype.setPriceScale=function(t){this.m_priceScale!==t&&(this.m_priceScale=t,this.priceScaleChanged.fire(t))},c.prototype.setGotoDateResult=function(t){this._gotoDateResult=t},c.prototype.gotoDateResult=function(){return this._gotoDateResult},c.prototype.syncModel=function(){var t,e;if(!this._syncModel){if(t=this.symbolInfo(),e=this.interval(),!t||!e)return null;this._syncModel=new F(t,e)}return this._syncModel},TradingView.Series=c,t.exports=c}).call(e,i(21),i(28),i(43),i(1),i(85),i(69))},function(t,e){"use strict";function i(t,e){this.m_minValue=t,this.m_maxValue=e}i.prototype.equals=function(t){return this.m_minValue===t.m_minValue&&this.m_maxValue===t.m_maxValue},i.prototype.clone=function(){return new i(this.m_minValue,this.m_maxValue)},i.prototype.minValue=function(){return this.m_minValue},i.prototype.maxValue=function(){return this.m_maxValue},i.prototype.length=function(){return this.m_maxValue-this.m_minValue},i.prototype.isEmpty=function(){return this.m_maxValue===this.m_minValue||this.m_maxValue!==this.m_maxValue||this.m_minValue!==this.m_minValue},i.prototype.state=function(){return{min:this.m_minValue,max:this.m_maxValue}},i.prototype.merge=function(t){return new i(Math.min(this.minValue(),t.minValue()),Math.max(this.maxValue(),t.maxValue()))},i.prototype.apply=function(t,e){this.m_minValue=Math.min(this.m_minValue,t),this.m_maxValue=Math.max(this.m_maxValue,e)},i.prototype.scaleAroundCenter=function(t){var e,i,o,n;return isNumber(t)?(e=this.m_maxValue-this.m_minValue,void(0!==e&&(i=.5*(this.m_maxValue+this.m_minValue),o=this.m_maxValue-i,n=this.m_minValue-i,o*=t,n*=t,this.m_maxValue=i+o,this.m_minValue=i+n))):void TradingView.logDebugChart("PriceRange.scaleAroundCenter: invalid coeff")},i.prototype.shift=function(t){return isNumber(t)?(this.m_maxValue+=t,void(this.m_minValue+=t)):void TradingView.logDebugChart("PriceRange.shift: invalid coeff")},i.prototype.convertToPercent=function(t,e){return 100*(t-e)/e},i.prototype.convertFromPercent=function(t,e){return t/100*e+e},i.prototype.convertToPercents=function(t){var e=100*(this.m_minValue-t)/t,o=100*(this.m_maxValue-t)/t;return new i(e,o)},i.prototype.convertFromPercents=function(t){var e=this.m_minValue/100*t+t,o=this.m_maxValue/100*t+t;return new i(e,o)},t.exports=i},function(t,e,i){"use strict";function o(t,e){n.call(this,e),this._series=t,this._series.onRestarted().subscribe(this,o.prototype.invalidate),this._series.onSymbolResolved().subscribe(this,o.prototype.invalidate),this._series.onCompleted().subscribe(this,o.prototype.invalidate),this._series.onBoxSizeChanged().subscribe(this,o.prototype.invalidate)}var n=i(87);inherit(o,n),o.prototype.invalidate=function(){delete this._text,this.update()},o.prototype.getSeriesPrecision=function(){var t=4;return this._series._symbolInfo&&this._series._symbolInfo.pricescale&&(t=Math.round(Math.log(this._series._symbolInfo.pricescale)/Math.log(10))),t},o.prototype.round=function(t){var e=this.getSeriesPrecision(),i=Math.round(t*Math.pow(10,e))/Math.pow(10,e);return i?i:""},o.prototype.update=function(){if(!("_text"in this)){var t=this._series.symbolInfo()||{};this._bold=!1,this._size="17px",this._text=this._series.constructor.generateTitleForGui({description:t.description,exchange:t.exchange,symbol:this._series.symbol(),interval:this._series.interval(),style:this._series._properties.style.value(),inputs:this._series.getInputsProperties().state(),boxSize:this._series.data().boxSize,reversalAmount:this._series.data().reversalAmount,precision:this.getSeriesPrecision()})}},t.exports=o},function(t,e){"use strict";function i(t){this._props=t,this._text="",this._size="12px",this._bold=!1}i.prototype.text=function(){return this._text},i.prototype.setText=function(t){this._text=t},i.prototype.color=function(){return this._props?this._props.scalesProperties.textColor.value():"#444"},i.prototype.bold=function(){return this._bold},i.prototype.size=function(){return this._size},t.exports=i},function(t,e,i){(function(e){"use strict";function o(t,e){n.call(this,t,e)}var n=i(89);inherit(o,n),o.prototype.lastPrice=function(){return this._series.data().lastProjectionPrice},o.prototype._updateImpl=function(t){var i,o,n,s,r,a,l,h,c,d,p,u=this._rendererData;u.visible=!1,u.text="",this._model.properties().scalesProperties.showSeriesLastValue.value()&&(this._model.timeScale().isEmpty()||this._series.priceScale().isEmpty()||!this.lastPrice()||(t=this._model.timeScale().visibleBars(),t.isEmpty()||(i=this._series.data().search(t.lastBar(),TradingView.SEARCH_NEAREST_LEFT),void 0!==i&&(u.visible=!0,o=this._series.nearestIndex(t.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),n=this._series.data().valueAt(o)[TradingView.CLOSE_PLOT],s=this.lastPrice(),this._series.priceScale().properties().percentage.value()&&(s=100*(s-n)/n),u.text=this._series.priceScale().formatter().format(s),r=this._series.properties().style.value()===TradingView.Series.STYLE_HEIKEN_ASHI,r?this._series.properties().haStyle.showRealLastPrice.value()?(a=this._series.lastValueData(TradingView.CLOSE_PLOT,!0),a.noData||a.color===this._background||(this._background=a.color),e.enabled("countdown")&&this._series.properties().showCountdown.value()&&(u.secondLine=this._countdownInfo()),l=this._series.lastValueData(TradingView.CLOSE_PLOT,!1).index,h=a.index,c=l===h,u.visible=c):u.visible=!1:(d=this._series.barColorer(),p=d.barStyle(i.index,!0),this._background=p.barColor),this._background!==u.background&&(u.background=this._background,u.color=this.color()),u.coordinate=this._series.priceScale().priceToCoordinate(s)))))},t.exports=o}).call(e,i(1))},function(t,e,i){(function(e){"use strict";function o(t,e){this._series=t,this._model=e,this._text="",this._coordinate=0,this._background="black",this._color="white",this._invalidated=!0,this._rendererData={text:"",coordinate:null,color:"#FFF",background:"#000",visible:!1,secondLine:null}}var n=i(75),s=i(76),r=i(41);inherit(o,n),o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(t){var i,o,n,s,r,a=this._rendererData;a.visible=!1,a.text="",this._model.properties().scalesProperties.showSeriesLastValue.value()&&(i=this._series.lastValueData(null,e.enabled("price_scale_always_last_bar_value")),!i.noData&&i.text&&(o=this._series.properties().style.value()===TradingView.Series.STYLE_HEIKEN_ASHI,o&&this._series.properties().haStyle.showRealLastPrice.value()&&(n=this._series.lastValueData(TradingView.CLOSE_PLOT,!1).index,s=this._series.lastValueData(TradingView.CLOSE_PLOT,!0).index,n===s)||(a.visible=!0,a.text=i.text,i.color!==this._background&&(this._background=i.color,a.color=this.color(),a.background=this._background),a.coordinate=i.coordinate,this._floatCoordinate=i.floatCoordinate,this._coordinate=i.coordinate,a.secondLine=null,e.enabled("countdown")&&this._series.properties().showCountdown.value()&&(r=[TradingView.Series.STYLE_BARS,TradingView.Series.STYLE_CANDLES,TradingView.Series.STYLE_LINE,TradingView.Series.STYLE_AREA,TradingView.Series.STYLE_HOLLOW_CANDLES,TradingView.Series.STYLE_HEIKEN_ASHI],r.indexOf(this._series.properties().style.value())!==-1&&(a.secondLine=this._countdownInfo())))))},o.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),n.prototype.coordinate.call(this)},o.prototype.renderer=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer||(this._renderer=new s(this._rendererData)),this._renderer},o.prototype.dump=function(){return{text:this._rendererData.text,coordinate:this._rendererData.coordinate,color:this._rendererData.color,background:this._rendererData.background,visible:this._rendererData.visible}},o.prototype.text=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._rendererData.text},o.prototype._countdownInfo=function(){var t,e,i,o,n,s,a,l,h,c,d=null;return this._series.isDWM()?d:(t=1e3*this._series.data().bars().last().value[0],e=1e3*this._series.serverTimeOffset(),i=r.parse(this._series.interval()),o=i.kind()===r.SECONDS?i.multiplier():60*i.multiplier(),n=t.valueOf()+1e3*o,s=(new Date).valueOf()+e,a=Math.round((n-s)/1e3),a>0&&(a=Math.min(a,o),l="",a>=3600&&(l=""+Math.floor(a/3600)+":"),a%=3600,h=("0"+Math.floor(a/60)).right(2),a%=60,c=("0"+Math.floor(a)).right(2),d=l+h+":"+c),d)},t.exports=o}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e){s.call(this),this._series=t,this._model=e,this._items.push(new r($.t("Open",{context:"in_legend"}),"")),this._items.push(new r($.t("High",{context:"in_legend"}),"")),this._items.push(new r($.t("Low",{context:"in_legend"}),"")),this._items.push(new r($.t("Close",{context:"in_legend"}),"")),this._invalidated=!0,this.update()}var n=i(91),s=n.DataWindowView,r=n.DataWindowItem,a=i(65),l=a.invertColor,h=a.colorsAreSimilar,c=a.RGBColor;inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){var t,e,i,o,n,s,r,a,d,p,u,_;if(this._series.symbolInfo()?(this._header=[this._series.symbolInfo().name,TradingView.translatedIntervalString(this._series.interval()),this._series.symbolInfo().exchange].join(", "),this._title=this._series.symbolInfo().description):this._header=this._series.symbol(),this._items[0].setValue($.t("n/a")),this._items[1].setValue($.t("n/a")),this._items[2].setValue($.t("n/a")),this._items[3].setValue($.t("n/a")),!this._model.timeScale().isEmpty()&&0!==this._series.bars().size()&&(t=this._series.barColorer(),e=this._series.data().size()-1,i=this._model.crossHairSource().appliedIndex(),o=isNumber(i)?this._series.nearestIndex(i,TradingView.SEARCH_NEAREST_LEFT):this._series.nearestIndex(e,TradingView.SEARCH_NEAREST_LEFT),void 0!==o))for(n=this._series.data().valueAt(o),s=this._series.formatter(),this._items[0].setValue(s.format(n[TradingView.OPEN_PLOT])),this._items[1].setValue(s.format(n[TradingView.HIGH_PLOT])),this._items[2].setValue(s.format(n[TradingView.LOW_PLOT])),this._items[3].setValue(s.format(n[TradingView.CLOSE_PLOT])),r=t.barStyle(o,!1),a=r.barColor,d=this._series.model().paneForSource(this._series),p=d._properties.background.value(),u=new c(a).toHex(),h(u,p)&&(a=l(u)),_=0;_<4;_++)this._items[_].setColor(a)},o.prototype.items=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items},o.prototype.dump=function(){return{header:this._header,items:this._items}},o.prototype.additional=function(){if(this._series.dataPoweredBy)return"(Data Provided by "+this._series.dataPoweredBy+")"},t.exports=o},function(t,e){"use strict";function i(t,e){this.m_title=t,this.m_value=e,this._visible=!0,this._color=void 0}function o(){this._header="",this._title="",this._items=[]}i.prototype.title=function(){return this.m_title},i.prototype.text=function(){return this.m_value},i.prototype.visible=function(){return this._visible},i.prototype.color=function(){return this._color},i.prototype.setVisible=function(t){this._visible=t},i.prototype.setValue=function(t){this.m_value=t},i.prototype.setColor=function(t){this._color=t},i.prototype.value=function(){return this.m_value},o.prototype.header=function(){return this._header},o.prototype.title=function(){return this._title},o.prototype.items=function(){return this._items},o.prototype.update=function(){},e.DataWindowItem=i,e.DataWindowView=o},function(t,e,i){(function(t){"use strict";function o(t,e){this.m_series=t,this.m_model=e,this.m_bars=[],this._invalidated=!0}function n(t,e){o.call(this,t,e)}function s(t,e){o.call(this,t,e)}function r(t,e){o.call(this,t,e)}function a(t,e){o.call(this,t,e)}function l(t,e,i){this.m_series=t,this.m_priceSource=e,this.m_model=i,this.m_items=[],this._barGetter={open:function(t){return t[TradingView.OPEN_PLOT]},high:function(t){return t[TradingView.HIGH_PLOT]},low:function(t){return t[TradingView.LOW_PLOT]},close:function(t){return t[TradingView.CLOSE_PLOT]},hl2:function(t){return(t[TradingView.HIGH_PLOT]+t[TradingView.LOW_PLOT])/2},hlc3:function(t){return(t[TradingView.HIGH_PLOT]+t[TradingView.LOW_PLOT]+t[TradingView.CLOSE_PLOT])/3},ohlc4:function(t){return(t[TradingView.OPEN_PLOT]+t[TradingView.HIGH_PLOT]+t[TradingView.LOW_PLOT]+t[TradingView.CLOSE_PLOT])/4}}[this.m_priceSource]}function h(t,e,i){l.call(this,t,e,i),this._invaidated=!0}function c(t,e,i){l.call(this,t,e,i),this._invaidated=!0}var d=i(93).SelectionRenderer,p=i(94),u=i(95),_=u.PaneRendererBars,f=u.PaneRendererLine,g=u.PaneRendererArea,m=u.PaneRendererCandles,v=i(98),y=i(99);o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){var e,i,o,n,s,r,a,l,h,c,d,u,_,f,g,m,v=this;if(this.m_bars=[],!this.m_model.timeScale().isEmpty()&&!this.m_series.priceScale().isEmpty()&&(e=this.m_model.timeScale().visibleBars(),!e.isEmpty()&&0!==this.m_series.bars().size())){for(i=this.m_series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),o=this.m_series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT);i<=o&&(n=this.m_series.bars().valueAt(i),void 0===n);i++);if(!(i>o)&&(e=this.m_series.bars().range(i,o),r=this.m_series.priceScale(),a=r.properties().percentage.value(),l=this.m_series.barColorer(),h={},e.each(function(t,e){var i,o;void 0!==e[TradingView.OPEN_PLOT]&&void 0!==e[TradingView.HIGH_PLOT]&&void 0!==e[TradingView.LOW_PLOT]&&void 0!==e[TradingView.CLOSE_PLOT]&&(void 0===s&&(s=e[TradingView.CLOSE_PLOT]),i={},i.time=Math.round(t),a?(i.open=100*(e[TradingView.OPEN_PLOT]-s)/s,i.high=100*(e[TradingView.HIGH_PLOT]-s)/s,i.low=100*(e[TradingView.LOW_PLOT]-s)/s,i.close=100*(e[TradingView.CLOSE_PLOT]-s)/s):(i.open=e[TradingView.OPEN_PLOT],i.high=e[TradingView.HIGH_PLOT],i.low=e[TradingView.LOW_PLOT],i.close=e[TradingView.CLOSE_PLOT]),h.value=e,o=e[TradingView.STYLE_PLOT]?e[TradingView.STYLE_PLOT]:l.barStyle(t,!1,h),e[TradingView.STYLE_PLOT]=o,h.previousValue=e,i.color=o.barColor,i.borderColor=o.barBorderColor,i.wickColor=o.barWickColor,i.hollow=o.isBarHollow,v.m_bars.push(i))},this),r.barPricesToCoordinates(this.m_bars),this.m_model.timeScale().barIndexesToCoordinates(this.m_bars),this.m_series===this.m_model.selectedSource()))for(c=y(i,o),this._selectionData={points:[]},this._selectionData.hittestResult=p.REGULAR,d=0;d<c.length;d++)u=c[d],_=this.m_series.bars().valueAt(u),_&&(f=.5*(_[TradingView.OPEN_PLOT]+_[TradingView.CLOSE_PLOT]),r.properties().percentage.value()&&(f=100*(f-s)/s),g=this.m_model.timeScale().indexToCoordinate(u),m=this.m_series.priceScale().priceToCoordinate(f),this._selectionData.points.push(new t.Point(g,m)))}},o.prototype.items=function(){return this.m_bars},o.prototype.dump=function(){var t={};return t.bars=this.m_bars,t},inherit(n,o),n.prototype.renderer=function(){var t,e;return this._invalidated&&(this._updateImpl(),this._invalidated=!1),t={},t.bars=this.m_bars,t.barSpacing=this.m_model.timeScale().barSpacing(),t.dontDrawOpen=this.m_series.properties().barStyle.dontDrawOpen.value(),e=new v,e.append(new _(t)),this.m_series===this.m_model.selectedSource()&&e.append(new d(this._selectionData)),e},inherit(s,o),s.prototype.renderer=function(){var t,e;return this._invalidated&&(this._updateImpl(),this._invalidated=!1),t={},t.bars=this.m_bars,t.barSpacing=this.m_model.timeScale().barSpacing(),t.drawWick=this.m_series.properties().candleStyle.drawWick.value(),t.drawBorder=this.m_series.properties().candleStyle.drawBorder.value(),t.borderColor=this.m_series.properties().candleStyle.borderColor.value(),t.wickColor=this.m_series.properties().candleStyle.wickColor.value(),e=new v,e.append(new m(t)),this.m_series===this.m_model.selectedSource()&&e.append(new d(this._selectionData)),e},inherit(r,o),r.prototype.renderer=function(){var t,e;return this._invalidated&&(this._updateImpl(),this._invalidated=!1),t={},t.bars=this.m_bars,t.barSpacing=this.m_model.timeScale().barSpacing(),t.drawWick=this.m_series.properties().haStyle.drawWick.value(),t.drawBorder=this.m_series.properties().haStyle.drawBorder.value(),t.borderColor=this.m_series.properties().haStyle.borderColor.value(),t.wickColor=this.m_series.properties().haStyle.wickColor.value(),e=new v,e.append(new m(t)),this.m_series===this.m_model.selectedSource()&&e.append(new d(this._selectionData)),e},inherit(a,o),a.prototype.renderer=function(){var t,e;return this._invalidated&&(this._updateImpl(),this._invalidated=!1),t={},t.bars=this.m_bars,t.barSpacing=this.m_model.timeScale().barSpacing(),t.drawWick=this.m_series.properties().hollowCandleStyle.drawWick.value(),t.drawBorder=this.m_series.properties().hollowCandleStyle.drawBorder.value(),t.borderColor=this.m_series.properties().hollowCandleStyle.borderColor.value(),t.wickColor=this.m_series.properties().hollowCandleStyle.wickColor.value(),e=new v,e.append(new m(t)),this.m_series===this.m_model.selectedSource()&&e.append(new d(this._selectionData)),e},l.prototype.update=function(){var e,i,o,n,s,r,a,l,h,c,d,u,_,f,g,m,v;if(this.m_items=[],!this.m_model.timeScale().isEmpty()&&this.m_series.priceScale()&&!this.m_series.priceScale().isEmpty()&&(e=this.m_model.timeScale().visibleBars(),!e.isEmpty()&&0!==this.m_series.bars().size())){for(i=this.m_series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),o=this.m_series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT),e=this.m_series.bars().range(i,o),n=this,r=n.m_series.priceScale(),a={color:this.m_series.properties().lineStyle.color.value()},l=r.properties().percentage.value(),h=e._start;h<e._end;++h)c=e._indexAt(h),d=e._valueAt(h),u=this._barGetter(d),void 0!==u&&null!==u&&(void 0===s&&(s=u),l&&(u=100*(u-s)/s),_=new t.Point(c,u),_.style=a,n.m_items.push(_));if(r.pointsArrayToCoordinates(n.m_items),n.m_model.timeScale().indexesToCoordinates(n.m_items),this.m_series===this.m_model.selectedSource())for(f=y(i,o),this._selectionData={points:[]},this._selectionData.hittestResult=p.REGULAR,h=0;h<f.length;h++)c=f[h],g=this.m_series.data().valueAt(c),u=this._barGetter(g),r.properties().percentage.value()&&(u=100*(u-s)/s),m=this.m_model.timeScale().indexToCoordinate(c),v=this.m_series.priceScale().priceToCoordinate(u),this._selectionData.points.push(new t.Point(m,v))}},inherit(h,l),h.prototype.update=function(){this._invalidated=!0},h.prototype.renderer=function(){var t,e,i,o;return this._invalidated&&(l.prototype.update.call(this),this._invalidated=!1),t=this.m_series.properties().lineStyle,e={barSpacing:this.m_model.timeScale().barSpacing(),items:this.m_items,lineColor:t.color.value(),lineStyle:t.linestyle.value(),withMarkers:t.styleType.value()===TradingView.Series.STYLE_LINE_TYPE_MARKERS,withSteps:t.styleType.value()===TradingView.Series.STYLE_LINE_TYPE_STEP,lineWidth:t.linewidth.value(),simpleMode:!0},i=new f(e),this.m_series===this.m_model.selectedSource()?(o=new v,o.append(i),o.append(new d(this._selectionData))):o=i,o},inherit(c,l),c.prototype.update=function(){this._invalidated=!0},c.prototype.renderer=function(){var t,e,i;return this._invalidated&&(l.prototype.update.call(this),this._invalidated=!1),t={},t.simpleMode=!1,t.barSpacing=this.m_model.timeScale().barSpacing(),t.items=this.m_items,t.lineColor=this.m_series.properties().areaStyle.linecolor.value(),t.lineStyle=this.m_series.properties().areaStyle.linestyle.value(),t.lineWidth=this.m_series.properties().areaStyle.linewidth.value(),e=this.m_series.properties().areaStyle.transparency.value(),t.isSeries=!0,t.color1=TradingView.generateColor(this.m_series.properties().areaStyle.color1.value(),e),t.color2=TradingView.generateColor(this.m_series.properties().areaStyle.color2.value(),e),t.bottom=this.m_series.priceScale().height(),i=new v,i.append(new g(t)),this.m_series===this.m_model.selectedSource()&&i.append(new d(this._selectionData)),i},e.SeriesBarsPaneView=n,e.SeriesCandlesPaneView=s,e.SeriesHollowCandlesPaneView=a,e.SeriesLinePaneView=h,e.SeriesAreaPaneView=c,e.SeriesHeikenAshiPaneView=r}).call(e,i(21))},function(t,e,i){"use strict";function o(t){this._data=t}function n(t,e){this._data=t,this._model=e,this.radius=this._data.radius||n.OUTER_RADIUS}function s(t){o.call(this,t)}var r=i(94),a=i(95).PaneRendererArrowsUpDown;o.RADIUS=3.5,o.prototype.tolerance=2,o.prototype.draw=function(t){function e(t){return void 0===t.x||TradingView.isNaN(t.x)||null===t.x||void 0===t.y||TradingView.isNaN(t.y)||null===t.y}var i,o,n;if(this._data)for(t.strokeStyle="#6B6B6B",t.fillStyle="#D6D6D6",i=this._data.vertOffset||0,o=0;o<this._data.points.length;o++)n=this._data.points[o],e(n)||this._drawMarker(t,n,i);
},o.prototype._drawMarker=function(t,e,i){t.beginPath(),t.arc(e.x+.5,e.y+.5+i,o.RADIUS,0,2*Math.PI,!0),t.closePath(),t.fill(),t.stroke()},o.prototype.hitTest=function(t){var e,i,n;if(!this._data)return null;for(e=0;e<this._data.points.length;e++)if(i=this._data.points[e],n=i.substract(t).length(),n<=o.RADIUS+this.tolerance)return new r(this._data.hittestResult,i.data);return null},n.OUTER_RADIUS=TradingView.isMobile.any()?16:8,n.prototype.tolerance=2,n.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c=this._data.currentPoint,d=this._data.outerStrokeWidth||1;for(e=0;e<this._data.points.length;e++)i=this._data.points[e],o=i.substract(c).length(),n=TradingView.isInteger(i.data)&&this._data.linePointBeingEdited===i.data,s=this.radius,r=this._data.strokeWidth||2,a=o<=s+this.tolerance,l=a?1:0,s+=l,r+=l,n||(i.square?(t.fillStyle=this._data.backgroundColor,t.fillRect(i.x-s,i.y-s,2*s,2*s),t.fillStyle=this._data.color,h=s-d,t.fillRect(i.x-h,i.y-h,2*h,2*h),h=s-d-r,t.fillStyle=this._data.backgroundColor,t.fillRect(i.x-h,i.y-h,2*h,2*h)):(t.beginPath(),t.arc(i.x,i.y,s,0,2*Math.PI,!0),t.closePath(),t.fillStyle=this._data.backgroundColor,t.fill(),t.beginPath(),t.arc(i.x,i.y,s-d,0,2*Math.PI,!0),t.closePath(),t.fillStyle=this._data.color,t.fill(),t.beginPath(),t.arc(i.x,i.y,s-d-r,0,2*Math.PI,!0),t.closePath(),t.fillStyle=this._data.backgroundColor,t.fill()))},n.prototype.hitTest=function(t){var e,i,o,n;for(e=0;e<this._data.points.length;e++)if(i=this._data.points[e],o=i.substract(t).length(),n=o<=this.radius+this.tolerance)return new r(this._data.hittestResult,i.data);return null},inherit(s,o),s.prototype._drawMarker=function(t,e,i){var n=e.isUp?1:-1,s=a.prototype._calculateVerticalOffset(this._data.barSpacing),r=a.prototype._calculateMinHeight(this._data.barSpacing),l=i+n*s+n*r;t.beginPath(),t.arc(e.x+.5,e.y+.5+l,o.RADIUS,0,2*Math.PI,!0),t.closePath(),t.fill(),t.stroke()},e.SelectionRenderer=o,e.LineAnchor=n,e.SelectionRendererArrowsUpDown=s},function(t,e){"use strict";function i(t,e,i){this._result=t,this._data=e,this._eraseMarker=i}i.MOVEPOINT_BACKGROUND=1,i.REGULAR=2,i.MOVEPOINT=3,i.CHANGEPOINT=4,i.CUSTOM=5,i.prototype.result=function(){return this._result},i.prototype.data=function(){return this._data},i.prototype.eraseMarker=function(){return this._eraseMarker},t.exports=i},function(t,e,i){(function(t){"use strict";function o(t){this.bars=t.bars,this.barSpacing=t.barSpacing,this.barWidth=R.optimalBarWidth(t.barSpacing),this.barLineWidth=Math.max(1,Math.round(this.barWidth)),this.dontDrawOpen=t.dontDrawOpen}function n(t){this.bars=t.bars,this.barWidth=t.barWidth,this.barLineWidth=1}function s(t){this.bars=t.bars,this.barSpacing=t.barSpacing,this.barLineWidth=Math.max(1,R.optimalBarWidth(t.barSpacing))}function r(t){this.bars=t.bars,this.barSpacing=t.barSpacing,this.blockSize=t.blockSize,this.barWidth=t.barSpacing}function a(t){this.items=t.items,this.barSpacing=t.barSpacing,this.histogramBase=t.histogramBase,this.lineColor=t.lineColor,this.lineWidth=t.lineWidth}function l(t){this.items=t.items,this.barSpacing=t.barSpacing,this.histogramBase=t.histogramBase,this.lineColor=t.lineColor,this.lineWidth=t.lineWidth}function h(t){this.items=t.items,this._simpleMode=t.simpleMode,this.barSpacing=t.barSpacing,this.lineColor=t.lineColor,this.lineWidth=t.lineWidth,this.lineStyle=t.lineStyle,this.withMarkers=t.withMarkers,this.withSteps=t.withSteps,this.hittest=t.hittest,this.ignorePaletteLineWidth=t.ignorePaletteLineWidth,this.forceLineColor=!!t.forceLineColor}function c(t){t.forceLineColor=!1,h.call(this,t),this.color1=t.color1,this.color2=t.color2,this.bottom=t.bottom,this.isSeries=!!t.isSeries,this._simpleMode=t.simpleMode}function d(t){this._data=t,this.bars=t.bars,this._barWidth=R.optimalBarWidth(t.barSpacing),this._barBorderWidth=1}function p(t){this.items=t.items,this.barSpacing=t.barSpacing,this.lineColor=t.lineColor,this.lineWidth=t.lineWidth,this.lineStyle=t.lineStyle}function u(t){this.items=t.items,this.barSpacing=t.barSpacing,this.lineColor=t.lineColor||t.color,this.radius=t.lineWidth||t.height/2,this.vertOffset=t.vertOffset||0}function _(t,e,i,o){this.x=t,this.y=e,this.height=i,this.isUp=o}function f(t){this.items=t.items,this.barSpacing=t.barSpacing,this.colorUp=t.colorup,this.colorDn=t.colordown,this.colorBorder=t.colorBorder,this.width=this._calculateWidth(t.barSpacing),this.minHeight=t.minHeight,this.vertOffset=this._calculateVerticalOffset(t.barSpacing)}function g(t){this.items=t.items,this.height=t.height||t.width,this.width=t.width||t.height,this._color=t.color,this._borderColor=t.borderColor,this._vertOffset=t.vertOffset||0,t.textCache&&(this._textCache=t.textCache,this._textColor=t.textColor,this._textVertOffset=this._vertOffset>0?this.height:-this.height,this._textImageWidth=this._textCache.textImageWidth,this._textImageHeight=this._textCache.textImageHeight)}function m(t){g.call(this,t),this.ch=t.char[0]||" ",this.fontFamily=t.fontFamily||"Arial",this._charCache=new F(this.ch,!1,!1,this.fontFamily,this.height)}function v(t){g.call(this,t)}function y(t){g.call(this,t)}function b(t){g.call(this,t)}function w(t){g.call(this,t)}function S(t){g.call(this,t)}function T(t){g.call(this,t)}function C(t){g.call(this,t)}function x(t){g.call(this,t),this.width=this._calculateWidth(t.barSpacing),this._isUp=!1}function P(t){x.call(this,t),this._isUp=!0}function L(t){x.call(this,t),this._isUp=!1}function k(t,e){g.call(this,t),this._isUp=e,this._stepX=Math.round(this.height/2*.65)+.5,this._stepY=Math.round(this.height/2)+.5,this._textCache?(this._padding=this._stepX/2,this._shapeWidth=this._textImageWidth+2*this._stepX,this._shapeHeight=this._textImageHeight+2*this._padding+this._stepY,0===this._vertOffset?this._isUp?this._textVertOffset=this._stepY+this._padding+this._textImageHeight:this._textVertOffset=-this._stepY-this._padding:this._textVertOffset=this._vertOffset>0?this._stepY+this._padding:-this._stepY-this._padding):(this._padding=0,this._shapeWidth=2*this._stepX,this._shapeHeight=2.5*this._stepY)}function E(t){k.call(this,t,!0)}function I(t){k.call(this,t,!1)}function A(t){g.call(this,t)}function V(t){g.call(this,t)}function $(t){this._items=t.items,this._y=t.y,this._h=t.h,this._w=t.w}function M(e){var i,o,n,s,r,a,l,h,c,d;e.point2||(e.point2=e.point1),i=e.point1.x,o=e.point1.y,n=e.point2.x,s=e.point2.y,r=16,a=r-6,l=r-6,h=i<=n?i-a:i+a,c=o<=s?o+l:o-l,h-=1,c-=3,d={items:[new t.Point(h,c)],char:[String.fromCharCode("0xF017").toUpperCase()],color:e.color,vertOffset:0,height:r,fontFamily:"FontAwesome"},m.call(this,d)}function D(t,e){this._items=t.items,this._color=t.color,this._orderArrow=t.orderArrow,this._exitLineWidth=t.exitLineWidth,this._priceArrow=t.priceArrow,this._text=t.text,this._textWidths=e}function O(t){this.data=t}function B(t){this._data=t}var R=i(96),N=i(94),F=i(97);o.prototype.draw=function(t){var e,i,o;for(t.save(),t.translate(.5,.5),i=0;i<this.bars.length;++i)o=this.bars[i],e!==o.color&&(t.fillStyle=o.color,e=o.color),t.fillRect(Math.round(o.time-this.barLineWidth/2),Math.round(o.high-this.barWidth/2),Math.round(this.barLineWidth),Math.round(o.low-o.high+this.barWidth)),this.barLineWidth<this.barSpacing-1&&(this.dontDrawOpen||t.fillRect(Math.round(o.time-1.5*this.barWidth),Math.round(o.open-this.barWidth/2),Math.round(1.5*this.barWidth),Math.round(this.barWidth)),t.fillRect(Math.round(o.time),Math.round(o.close-this.barWidth/2),Math.round(1.5*this.barWidth),Math.round(this.barWidth)));t.restore()},o.prototype.hitTest=function(t){var e,i,o,n,s=this.bars,r=.5*this.barSpacing;if(0===s.length)return null;if(t.x<s[0].time-r)return null;if(t.x>s[s.length-1].time+r)return null;for(e=null,i=0;i<s.length;++i)if(o=s[i],t.x<=o.time+r){e=o;break}return n=R.selectionTolerance(this.barLineWidth),e&&e.high-n<=t.y&&t.y<=e.low+n?new N(N.REGULAR):null},n.prototype.draw=function(t){var e,i,o,n,s,r,a;for(t.save(),t.lineCap="butt",t.translate(.5,.5),t.lineWidth=this.barLineWidth,e=this.barWidth/2,i=0;i<this.bars.length;++i)o=this.bars[i],n=o.exactTime-e,s=o.exactTime+e-n,r=Math.round(o.high),a=o.low-o.high===0?1:Math.round(o.low-o.high),t.fillStyle=o.borderColor,t.fillRect(n,r,s,a),t.fillStyle=o.color,t.fillRect(n+this.barLineWidth,r+this.barLineWidth,s-2*this.barLineWidth,a-2*this.barLineWidth);t.restore()},n.prototype.hitTest=function(t){var e,i,o,n,s=this.bars,r=.5*this.barWidth;if(0===s.length)return null;if(t.x<s[0].time-r)return null;if(t.x>s[s.length-1].time+r)return null;for(e=null,i=0;i<s.length;++i)if(o=s[i],t.x<=o.time+r){e=o;break}return n=R.selectionTolerance(this.barLineWidth),e&&e.high-n<=t.y&&t.y<=e.low+n?new N(N.REGULAR):null},s.prototype.draw=function(t){var e,i,o;for(t.save(),t.lineCap="square",t.translate(.5,.5),e=0;e<this.bars.length;++e)i=this.bars[e],o=Math.round(.5*this.barLineWidth),i.isTwoColorBar?(t.fillStyle=i.upColor,t.fillRect(Math.round(i.exactTime-o),Math.round(i.high-o),Math.round(2*o),Math.round(i.additionalPrice-i.high+o)),t.fillStyle=i.downColor,t.fillRect(Math.round(i.exactTime-o),Math.round(i.additionalPrice),Math.round(2*o),Math.round(i.low-i.additionalPrice+o))):(t.fillStyle=i.color,t.fillRect(Math.round(i.exactTime-o),Math.round(i.high-o),Math.round(2*o),Math.round(i.low-i.high)+2*o)),i.combinedWithProjection||(i.isTwoColorBar?t.fillStyle=i.isUp?i.downColor:i.upColor:t.fillStyle=i.color,t.fillRect(Math.round(i.exactTime-this.barSpacing+o),Math.round(i.open-o),Math.round(this.barSpacing-2*o+1),Math.round(2*o)));t.restore()},s.prototype.hitTest=function(t){var e,i,o,n,s=this.bars,r=.5*this.barLineWidth;if(0===s.length)return null;if(t.x<s[0].time-r)return null;if(t.x>s[s.length-1].time+r)return null;for(e=null,i=0;i<s.length;++i)if(o=s[i],t.x<=o.time+r){e=o;break}return n=R.selectionTolerance(.5*this.barLineWidth),e&&e.high-n<=t.y&&t.y<=e.low+n?new N(N.REGULAR):null},r.prototype.draw=function(t){var e,i,o,n;for(t.save(),t.lineCap="butt",t.translate(.5,.5),e=0;e<this.bars.length;++e){for(i=this.bars[e],o=(i.low-i.high)/i.additionalNum,t.beginPath(),n=0;n<i.additionalNum;n++)i.isUp?(t.moveTo(Math.round(i.time-.5*this.barWidth)+.5,i.high+n*o),t.lineTo(Math.round(i.time+.5*this.barWidth)-.5,i.high+(n+1)*o),t.moveTo(Math.round(i.time+.5*this.barWidth)-.5,i.high+n*o),t.lineTo(Math.round(i.time-.5*this.barWidth)+.5,i.high+(n+1)*o)):this.drawEllipse(t,i.time-.45*this.barWidth+.5,i.high+n*o,Math.round(.9*this.barWidth),Math.round(o));t.strokeStyle=i.color,t.lineWidth=1,t.stroke()}t.restore()},r.prototype.drawEllipse=function(t,e,i,o,n){t.save(),t.translate(e+o/2,i+n/2),t.scale(o/2,n/2),t.moveTo(1,0),t.arc(0,0,.95,0,2*Math.PI,!1),t.restore()},r.prototype.hitTest=function(t){var e,i,o,n,s=this.bars,r=.5*this.barSpacing;if(0===s.length)return null;if(t.x<s[0].time-r)return null;if(t.x>s[s.length-1].time+r)return null;for(e=null,i=0;i<s.length;++i)if(o=s[i],t.x<=o.time+r){e=o;break}return n=R.selectionTolerance(this.barWidth),e&&e.high-n<=t.y&&t.y<=e.low+n?new N(N.REGULAR):null},a.prototype.draw=function(t){var e,i,o,n,s;for(t.translate(.5,.5),t.fillStyle=this.lineColor,e=this.lineWidth,i=0;i<this.items.length;++i)o=this.items[i],n=o.x,s=o.y,o.style&&(t.fillStyle=o.style.color,e=o.style.width),t.fillRect(Math.round(n-.5*e),s,e,this.histogramBase-s)},a.prototype.hitTest=function(e){var i,o,n,s,r,a=R.selectionTolerance(this.lineWidth);for(r=0;r<this.items.length;++r)if(i=this.items[r],o=i.x,n=i.y,s=t.distanceToSegment(new t.Point(o,n),new t.Point(o,this.histogramBase),new t.Point(e.x,e.y)),s.distance<=a)return new N(N.REGULAR);return null},l.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d,p,u;if(0!==this.items.length){for(e=this.barSpacing,i=this.lineColor,o=this.histogramBase,t.translate(.5,.5),n={},s=this.items,r=0;r<s.length;++r)a=s[r],l=0===r?null:s[r-1],h=a.style?a.style.color:i,c=n[h]||[],c.push({item:a,prev:l}),n[h]=c;for(h in n){for(c=n[h],t.fillStyle=h,t.strokeStyle=h,t.lineWidth=1,t.beginPath(),r=0;r<c.length;r++)a=c[r].item,d=Math.ceil(a.x-.5*e),p=Math.ceil(d+e),u=a.y,t.rect(d,u,p-d,o-u);for(t.fill(),t.beginPath(),r=0;r<c.length;r++)a=c[r].item,d=Math.ceil(a.x-.5*e),p=Math.ceil(d+e),u=a.y,l=c[r].prev,t.moveTo(p-.5,o),t.lineTo(p-.5,u+.5),t.lineTo(d+.5,u+.5),l&&l.y>u&&t.lineTo(d+.5,l.y);t.stroke()}}},l.prototype.hitTest=function(t){var e,i,o,n=.5*this.barSpacing+this.lineWidth,s=t.x-n,r=t.x+n,a=this.items;for(e=a.length;e--;)if(i=a[e].x,i>=s&&i<=r&&(o=a[e].y,t.y>=Math.min(o,this.histogramBase)&&t.y<=Math.max(o,this.histogramBase)))return new N(N.REGULAR);return null},h.prototype.draw=function(t){t.lineCap="square",t.lineJoin=this.withMarkers?"round":"miter",t.strokeStyle=this.lineColor,t.fillStyle=this.lineColor,t.lineWidth=this.lineWidth,t.lineStyle=this.lineStyle,this._simpleMode?this._drawSimpleMode(t):this._drawLines(t)},h.prototype._drawSimpleMode=function(t){var e,i,o,n;if(t.beginPath(),this.walkLine(t,this.items),t.stroke(),this.withMarkers){for(e=this.lineWidth+2,i=2*Math.PI,t.beginPath(),n=this.items.length;n--;)o=this.items[n],o&&(t.moveTo(o.x,o.y),t.arc(o.x,o.y,e,0,i));t.fill()}},h.prototype.walkLine=function(t,e,i,o){var n,s,r,a,l,h,c,d,p,u,_;if(e){for(n=.25*this.barSpacing,c=R.paneRendererCoordinateIsValid,d=0,p=e.length;d<p;d++)if(u=e[d],c(u.y)){r=u,s=d;break}if(void 0!==s&&r)for(_=this.withSteps&&this.lineWidth&&this.lineWidth%2===0?.5:0,d=s,p=e.length;d<p;d++){if(l=e[d],h=e[d+1]||{},c(l.y))if(a&&c(a.y))this.withSteps&&t.lineTo(a.x+_,l.y+_),t.lineTo(l.x+_,l.y+_),i&&!c(h.y)&&t.lineTo(l.x+_,o);else if(h&&c(h.y))i?(d!==s&&t.lineTo(l.x+_,o),t.lineTo(l.x+_,l.y+_)):t.moveTo(l.x+_,l.y+_);else if(i){if(0===d)continue;d!==s&&t.lineTo(l.x-n+_,o),t.lineTo(l.x-n+_,l.y+_),t.lineTo(l.x+n+_,l.y+_),t.lineTo(l.x+n+_,o)}else t.moveTo(l.x-n+_,l.y+_),t.lineTo(l.x+n+_,l.y+_);a=l}}},h.prototype._drawLines=function(t){function e(e,i,o){r(i.y)&&(r(e.y)?t.lineTo(i.x,i.y):o&&r(o.y)?t.moveTo(i.x,i.y):(t.moveTo(i.x-s,i.y),t.lineTo(i.x+s,i.y)))}var i,o,n,s,r,a,l,h,c,d,p,u,_,f;if(this.items.length){for(s=.25*this.barSpacing,r=R.paneRendererCoordinateIsValid,t.beginPath(),a=this.items[0],a&&t.moveTo(a.x,a.y),l=t.strokeStyle,h=t.lineWidth,c=t.lineStyle,d=1;d<this.items.length;++d)i=this.items[d-1],o=this.items[d],n=this.items[d+1],o.style&&!this.forceLineColor?(p=o.style.color,u=o.style.width,_=o.style.style):(p=this.lineColor,u=this.lineWidth,_=this.lineStyle),this.ignorePaletteLineWidth&&(u=this.lineWidth),f=p!==l||u!==h||_!==c,f?(l=p,h=u,c=_,t.stroke(),t.beginPath(),t.strokeStyle=p,t.lineWidth=u,t.lineStyle=_,_===CanvasEx.LINESTYLE_SOLID?(t.moveTo(i.x,i.y),e(i,o,n)):CanvasEx.drawLine(t,i.x,i.y,o.x,o.y)):e(i,o,n);t.stroke()}},h.prototype.hitTest=function(e){for(var i,o,n,s,r,a,l,h,c=R.selectionTolerance(this.lineWidth),d=0,p=this.items.length-1;p-d>2;)a=Math.round((p+d)/2),l=this.items[a],l.x<=e.x?d=a:p=a;for(d=Math.max(1,d-1),p=Math.min(this.items.length-1,p+1),h=d;h<=p;++h)if(i=this.items[h-1],o=this.items[h],n=i.x,s=o.x,r=t.distanceToSegment(new t.Point(n,i.y),new t.Point(s,o.y),new t.Point(e.x,e.y)),r.distance<=c)return this.hittest?this.hittest:new N(N.REGULAR);return null},inherit(c,h),c.prototype.draw=function(t){var e,i,o,n,s,r,a,l,c,d,p,u;if(0!==this.items.length){for(t.lineCap="square",t.strokeStyle=this.lineColor,t.lineWidth=this.lineWidth,t.lineStyle=this.lineStyle,t.lineWidth=1,e=0;e<this.items.length&&!R.paneRendererCoordinateIsValid(this.items[e].y);)e++;for(i=this.items.length-1;i>=0&&!R.paneRendererCoordinateIsValid(this.items[i].y);)i--;if(!(e>=i)){for(t.translate(.5,.5),o={},n=this.items,s=e;s<=i;s++)r=n[s],a=r.style?r.style.color:this.lineColor,s<i&&n[s+1].style&&(l=n[s+1].style.color,a!==l&&(c=o[l]||[],c.push(r),o[l]=c)),d=o[a]||[],d.push(r),o[a]=d;for(a in o){for(d=o[a],t.beginPath(),p=0,s=0;s<d.length;s++)d[s].style&&d[s].style.color!==a&&(t.moveTo(d[p].x,this.bottom),this.walkLine(t,d.slice(p,s),!0,this.bottom),p=s);t.moveTo(d[p].x,this.bottom),this.walkLine(t,d.slice(p,d.length),!0,this.bottom),t.closePath(),this.isSeries?(u=t.createLinearGradient(0,0,0,this.bottom),u.addColorStop(0,this.color1),u.addColorStop(1,this.color2),t.fillStyle=u,this._simpleMode=!0):t.fillStyle=a,t.fill()}t.lineWidth=this.lineWidth,h.prototype.draw.call(this,t)}}},d.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d,p,u,_,f=this.bars,g=this._data.barSpacing,m=this._data.drawWick,v=this._data.drawBorder,y=this._data.wickColor,b=this._barBorderWidth,w=this._barWidth;if(t.lineCap="square",t.lineStyle=this._data.lineStyle,g<1){if(m){for(t.strokeStyle=y,t.lineWidth=1,t.beginPath(),c=f.length;c-- >0;)d=f[c],t.moveTo(d.time,d.low),t.lineTo(d.time,d.high);t.stroke()}for(t.lineWidth=1,p="",u=!1,t.beginPath(),c=f.length;c-- >0;)d=f[c],h=d.time,p!==d.color&&(u&&(t.stroke(),t.beginPath(),u=!1),t.strokeStyle=d.color,p=d.color),t.moveTo(d.time,d.open),t.lineTo(d.time,d.close),u=!0;u&&t.stroke()}else{if(f=f.slice().sort(function(t,e){return t.color>e.color?-1:t.color<e.color?1:0}),t.translate(.5,.5),t.lineWidth=b,m)for(_=y,t.fillStyle=y,c=f.length;c--;)d=f[c],h=d.time,e=d.open,i=d.high,o=d.low,n=d.close,d.wickColor&&d.wickColor!==_&&(t.fillStyle=d.wickColor,_=d.wickColor),a=Math.min(e,n),l=Math.max(e,n),d.hollow?(t.fillRect(h,i,1,a-i),t.fillRect(h,l,1,o-l)):t.fillRect(h,i,1,o-i);if(v)for(c=f.length;c--;)d=f[c],f[c+1]&&d.borderColor===f[c+1].borderColor||(t.fillStyle=d.borderColor),d.hollow||(h=d.time,e=d.open,n=d.close,s=Math.round(h-w),r=Math.round(h+w),a=Math.min(e,n),l=Math.max(e,n),t.fillRect(s,a,r-s+1,l-a+1));for(c=f.length;c--;)d=f[c],h=d.time,e=d.open,i=d.high,o=d.low,n=d.close,s=Math.round(h-w),r=Math.round(h+w),a=Math.min(e,n),l=Math.max(e,n),f[c+1]&&d.color===f[c+1].color||(t.fillStyle=d.color,t.strokeStyle=d.color),d.hollow?(t.translate(-.5,-.5),t.strokeRect(s+1,a+1,r-s,l-a),t.translate(.5,.5)):(v&&(s+=1,a+=1,r-=1,l-=1),t.fillRect(s,a,r-s+1,l-a+1))}},d.prototype.hitTest=function(t){var e,i,o,n,s=this.bars,r=.5*this._data.barSpacing;if(0===s.length)return null;if(t.x<s[0].time-r)return null;if(t.x>s[s.length-1].time+r)return null;for(e=null,i=0;i<s.length;++i)if(o=s[i],t.x<=o.time+r){e=o;break}return n=R.selectionTolerance(this._barBorderWidth),e&&e.high-n<=t.y&&t.y<=e.low+n?this._data.hittest||new N(N.REGULAR):null},p.prototype.draw=function(t){var e,i,o,n,s,r,a=this.lineWidth,l=3*this.lineWidth,h=!1;for(i=0;i<this.items.length;++i)o=this.items[i],n=o.x,s=o.y,TradingView.isNaN(n)||TradingView.isNaN(s)||(r=null!=o.style?o.style.color:this.lineColor,r!==e&&(e=r,h&&t.fill(),t.beginPath(),t.fillStyle=r),t.rect(n-l/2,s-a/2,l,a),t.rect(n-a/2,s-l/2,a,l),h=!0);h&&t.fill()},p.prototype.hitTest=function(e){var i,o,n,s,r,a,l=R.selectionTolerance(this.lineWidth);for(a=1;a<this.items.length;++a)if(i=this.items[a-1],o=this.items[a],n=i.x,s=o.x,r=t.distanceToSegment(new t.Point(n,i.y),new t.Point(s,o.y),new t.Point(e.x,e.y)),r.distance<=l)return new N(N.REGULAR);return null},u.prototype.draw=function(t){var e,i,o,n,s,r,a=2*Math.PI,l=this.radius,h=!1;for(i=0;i<this.items.length;++i)o=this.items[i],n=o.x,s=o.y+this.vertOffset,TradingView.isNaN(n)||TradingView.isNaN(s)||(r=null!=o.style?o.style.color:this.lineColor,r!==e&&(e=r,h&&t.fill(),t.beginPath(),t.fillStyle=r),t.moveTo(n+l,s),t.arc(n,s,l,0,a,!1),h=!0);h&&t.fill()},u.prototype.hitTest=function(e){var i,o,n,s,r=2*this.radius,a=this.vertOffset,l=R.selectionTolerance(r);for(i=0;i<this.items.length;++i)if(o=this.items[i],o&&(n=new t.Point(o.x,o.y+a),s=n.substract(e).length(),s+this.radius<=l))return new N(N.REGULAR);return null},inherit(_,t.Point),f.prototype._calculateVerticalOffset=function(t){return Math.round((t||0)/4)},f.prototype._calculateMinHeight=function(t){var e=this.width||this._calculateWidth(t);return e},f.prototype._calculateWidth=function(t){var t=t||this.barSpacing;return Math.round(t/2)},f.prototype.draw=function(t){var e,i,o,n,s,r,a=this.width,l=a<4,h=Math.max(parseInt(a/2),1),c=Math.round(this.width/2),d=Math.round(this.width);for(t.translate(1,1),e=0,i=this.items.length;e<i;e++)o=this.items[e],n=o.isUp?-1:1,s=Math.abs(o.height),r=o.y-n*this.vertOffset,t.beginPath(),t.translate(o.x,r),l?(t.moveTo(0,0),t.lineTo(-c,-c*n),t.moveTo(0,0),t.lineTo(c,-c*n),t.moveTo(0,0),t.lineTo(0,-s*n),t.moveTo(-c,-s*n),t.lineTo(c,-s*n),t.lineWidth=h,t.strokeStyle=o.isUp?this.colorUp:this.colorDn,t.stroke()):(t.moveTo(0,0),s<d?(t.lineTo(a,-s*n),t.lineTo(-a,-s*n)):(t.lineTo(a,-d*n),t.lineTo(c,-d*n),t.lineTo(c,-s*n),t.lineTo(-c,-s*n),t.lineTo(-c,-d*n),t.lineTo(-a,-d*n)),t.lineTo(0,0),t.strokeStyle=this.colorBorder,t.stroke(),t.fillStyle=o.isUp?this.colorUp:this.colorDn,t.fill()),t.translate(-o.x,-r);t.translate(-1,-1)},f.prototype.hitTest=function(t){var e,i,o,n,s,r,a,l,h,c,d=Math.round(this.width/2),p=Math.round(this.width);for(e=0;e<this.items.length;++e)if(i=this.items[e],i&&void 0!==i.x&&null!==i.x&&!TradingView.isNaN(i.x)&&void 0!==i.y&&null!==i.y&&!TradingView.isNaN(i.y)&&(o=Math.abs(i.height),n=i.isUp?-1:1,s=o+p,r=i.y-n*this.vertOffset,a=r-n*s,l=i.x-d,h=i.x+d,c=l<t.x&&t.x<h&&(i.isUp?r<t.y&&t.y<a:a<t.y&&t.y<r)))return new N(N.REGULAR)},g.prototype.draw=function(t){this.drawShape(t),this.drawText(t)},g.prototype.drawShape=function(t){throw Error("Not implemented")},g.prototype.drawText=function(t){var e,i,o,n,s,r;if(this._textCache)for(e=0,i=this.items.length;e<i;e++)o=this.items[e],n=o.x,s=o.y+this._vertOffset+this._textVertOffset,r=o.style&&null!=o.style.textColor?o.style.textColor:this._textColor,this._textCache.paintTo(t,r,n,s,"center",this._vertOffset>0?"top":"bottom")},g.prototype.hitTest=function(e,i){var o,n,s,r,a,l,h,c,d,p,u,_,f,g,m=Math.max(this.height,this.width),v=this._vertOffset,y=this._textVertOffset;for(i=i||N.REGULAR,s=0;s<this.items.length;++s)if(r=this.items[s]){if(o=new t.Point(r.x,r.y+v),n=o.substract(e).length(),n<=m)return new N(i,{});if(this._textCache&&(a=this._textImageWidth/2,l=r.y+v+y,h=v>0?0:-this._textImageHeight,c=v>0?this._textImageHeight:0,d=e.x,p=e.y,u=r.x-a,_=l+h,f=r.x+a,g=l+c,d>u&&d<f&&p>_&&p<g))return new N(i,{})}return null},inherit(m,g),m.prototype.drawShape=function(t){var e,i,o,n,s,r,a=this._vertOffset>0?1:-1;for(e=0,i=this.items.length;e<i;e++)o=this.items[e],n=o.x,s=o.y+this._vertOffset-a*Math.round(this.height/2),r=o.style&&null!=o.style.color?o.style.color:this._color,this._charCache.paintTo(t,r,n,s,"center",this._vertOffset>0?"middle":"bottom")},m.prototype.hitTest=function(e){var i,o,n,s,r=this._vertOffset,a=R.selectionTolerance(this.height);for(i=0;i<this.items.length;++i)if(o=this.items[i],o&&(n=new t.Point(o.x,o.y+r),s=n.substract(e).length(),s<=a))return new N(N.REGULAR);return null},inherit(v,g),v.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h,c,d;for(t.lineWidth=2,e=this.width,i=this.height,o=this._vertOffset,s=!1,r=0,a=this.items.length;r<a;r++)l=this.items[r],h=l.style&&null!=l.style.color?l.style.color:this._color,h!==n&&(n=h,s&&t.stroke(),t.beginPath(),t.strokeStyle=h),c=l.x-e/2,d=l.y-i/2+o,t.moveTo(c,d),t.lineTo(c+e,d+i),t.moveTo(c,d+i),t.lineTo(c+e,d),s=!0;s&&t.stroke()},inherit(y,g),y.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h=this.width,c=this.height,d=Math.round(c/3),p=this._vertOffset-2*d,u=!1;for(i=0,o=this.items.length;i<o;i++)n=this.items[i],n.style&&null!=n.style.color?(s=n.style.color,r=n.style.borderColor):(s=this._color,r=this._borderColor),s!==e&&(e=s,u&&(t.fill(),t.stroke()),t.beginPath(),t.fillStyle=s,t.strokeStyle=r),a=n.x,l=n.y+p,t.moveTo(a,l),t.lineTo(a+h/2,l+c),t.lineTo(a-h/2,l+c),t.lineTo(a,l),u=!0;u&&(t.fill(),t.stroke())},inherit(b,g),b.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h=this.width,c=this.height,d=Math.round(c/3),p=this._vertOffset-d,u=!1;for(i=0,o=this.items.length;i<o;i++)n=this.items[i],n.style&&null!=n.style.color?(s=n.style.color,r=n.style.borderColor):(s=this._color,r=this._borderColor),s!==e&&(e=s,u&&(t.fill(),t.stroke()),t.beginPath(),t.fillStyle=s,t.strokeStyle=r),a=n.x-h/2,l=n.y+p,t.moveTo(a,l),t.lineTo(a+h,l),t.lineTo(a+h/2,l+c),t.lineTo(a,l),u=!0;u&&(t.fill(),t.stroke())},inherit(w,g),w.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l=this.width,h=this.height,c=this._vertOffset,d=!1;for(i=0,o=this.items.length;i<o;i++)n=this.items[i],s=n.style&&null!=n.style.color?n.style.color:this._color,s!==e&&(e=s,d&&t.fill(),t.beginPath(),t.fillStyle=s),r=n.x+l/2,a=n.y-h/2+c,t.moveTo(r,a),t.lineTo(r,a+h),t.lineTo(r-l,a+h/2),t.lineTo(r,a),d=!0;d&&t.fill()},inherit(S,g),S.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h=this.width,c=this.height,d=c/2,p=this._vertOffset,u=3,_=(h-u)/3,f=!1;for(i=0,o=this.items.length;i<o;i++)n=this.items[i],n.style&&null!=n.style.color?(s=n.style.color,r=n.style.borderColor):(s=this._color,r=this._borderColor),s!==e&&(e=s,f&&(t.fill(),t.stroke()),t.beginPath(),t.fillStyle=s,t.strokeStyle=r),a=n.x-h/2,l=n.y-d+p,t.moveTo(a,l),t.lineTo(a+u,l),t.bezierCurveTo(a+_,l-_,a+2*_,l+_,a+h,l),t.lineTo(a+h,l+d),t.bezierCurveTo(a+h-_,l+d+_,a+h-2*_,l+d-_,a+u,l+d),t.lineTo(a+u,l+c),t.lineTo(a,l+c),t.lineTo(a,l),f=!0;f&&(t.fill(),t.stroke())},inherit(T,g),T.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h,c,d;for(t.lineWidth=2,e=this.width,i=this.height,o=this._vertOffset,s=!1,r=0,a=this.items.length;r<a;r++)l=this.items[r],h=l.style&&null!=l.style.color?l.style.color:this._color,h!==n&&(n=h,s&&t.stroke(),t.beginPath(),t.strokeStyle=h),c=l.x-e/2,d=l.y-i/2+o,t.moveTo(c+e/2,d),t.lineTo(c+e/2,d+i),t.moveTo(c,d+i/2),t.lineTo(c+e,d+i/2),s=!0;s&&t.stroke()},inherit(C,g),C.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h=Math.max(this.width,this.height)/2,c=this._vertOffset,d=2*Math.PI,p=!1;for(i=0,o=this.items.length;i<o;i++)n=this.items[i],n.style&&null!=n.style.color?(s=n.style.color,r=n.style.borderColor):(s=this._color,r=this._borderColor),s!==e&&(e=s,p&&(t.fill(),t.stroke()),t.beginPath(),t.fillStyle=s,t.strokeStyle=r),a=n.x,l=n.y+c,t.moveTo(a+h,l),t.arc(a,l,h,0,d,!1),p=!0;p&&(t.fill(),t.stroke())},inherit(x,g),x.prototype._calculateWidth=function(t){return t=t||this.barSpacing,Math.round(t/4)},x.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h=!1,c=this.width,d=Math.abs(this.height),p=c<4,u=Math.max(parseInt(c/2),1),_=Math.round(this.width/2),f=Math.round(this.width),g=this._isUp?-1:1;for(i=0,o=this.items.length;i<o;i++)n=this.items[i],s=n.x,r=n.y+this._vertOffset+g*Math.round(d/2),n.style&&null!=n.style.color?(a=n.style.color,l=n.style.borderColor):(a=this._color,l=this._borderColor),a!==e&&(e=a,h&&(t.fill(),t.stroke()),t.beginPath(),t.fillStyle=a,t.strokeStyle=l),t.translate(s,r),p?(t.moveTo(0,0),t.lineTo(-_,-_*g),t.moveTo(0,0),t.lineTo(_,-_*g),t.moveTo(0,0),t.lineTo(0,-d*g),t.moveTo(-_,-d*g),t.lineTo(_,-d*g),t.lineWidth=u):(t.moveTo(0,0),d<f?(t.lineTo(c,-d*g),t.lineTo(-c,-d*g)):(t.lineTo(c,-f*g),t.lineTo(_,-f*g),t.lineTo(_,-d*g),t.lineTo(-_,-d*g),t.lineTo(-_,-f*g),t.lineTo(-c,-f*g)),t.lineTo(0,0)),t.translate(-s,-r),h=!0;h&&(t.fill(),t.stroke())},inherit(P,x),inherit(L,x),inherit(k,g),k.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h=!1,c=this._isUp?1:-1,d=Math.round(this._shapeWidth/2)-.5,p=Math.round(this._shapeHeight)-.5,u=0;for(0!==this._vertOffset&&this._vertOffset<0===this._isUp&&(u=-c*Math.round(p+this._stepY)),i=0,o=this.items.length;i<o;i++)n=this.items[i],s=n.x+.5,r=n.y+this._vertOffset+u+.5,n.style&&null!=n.style.color?(a=n.style.color,l=n.style.borderColor):(a=this._color,l=this._borderColor),a!==e&&(e=a,h&&(t.fill(),t.stroke()),t.beginPath(),t.fillStyle=a,t.strokeStyle=l),t.translate(s,r),t.moveTo(0,0),t.lineTo(this._stepX,this._stepY*c),t.lineTo(d,this._stepY*c),t.lineTo(d,p*c),t.lineTo(-d,p*c),t.lineTo(-d,this._stepY*c),t.lineTo(-this._stepX,this._stepY*c),t.lineTo(0,0),t.translate(-s,-r),h=!0;h&&(t.fill(),t.stroke())},k.prototype.hitTest=function(e,i){var o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v=this._stepY/2,y=this._vertOffset,b=this._isUp?1:-1;for(s=0;s<this.items.length;++s)if(r=this.items[s]){if(a=b*v,0!==this._vertOffset&&this._vertOffset<0===this._isUp&&(a=-b*(this._shapeHeight+v)),o=new t.Point(r.x,r.y+y+a),n=o.substract(e).length(),n<=v)return new N(N.REGULAR);if(l=this._shapeWidth/2,a=0,0!==this._vertOffset&&this._vertOffset<0===this._isUp&&(a=-b*(this._shapeHeight+this._stepY)),h=r.y+y+a,c=this._isUp?this._stepY:-this._shapeHeight,d=this._isUp?this._shapeHeight:-this._stepY,p=e.x,u=e.y,_=r.x-l,f=h+c,g=r.x+l,m=h+d,p>_&&p<g&&u>f&&u<m)return new N(N.REGULAR)}return null},inherit(E,k),inherit(I,k),inherit(A,g),A.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h=!1,c=Math.round(this.height/2);for(i=0,o=this.items.length;i<o;i++)n=this.items[i],n.style&&null!=n.style.color?(s=n.style.color,r=n.style.borderColor):(s=this._color,r=this._borderColor),s!==e&&(e=s,h&&(t.fill(),t.stroke()),t.beginPath(),t.fillStyle=s,t.strokeStyle=r),a=n.x-c,l=n.y+this._vertOffset-c,t.rect(a,l,this.height,this.height),h=!0;h&&(t.fill(),t.stroke())},inherit(V,g),V.prototype.drawShape=function(t){var e,i,o,n,s,r,a,l,h=!1,c=Math.round(this.height/2);for(i=0,o=this.items.length;i<o;i++)n=this.items[i],n.style&&null!=n.style.color?(s=n.style.color,r=n.style.borderColor):(s=this._color,r=this._borderColor),s!==e&&(e=s,h&&(t.fill(),t.stroke()),t.beginPath(),t.fillStyle=s,t.strokeStyle=r),a=n.x,l=n.y+this._vertOffset,t.moveTo(a,l-c),t.lineTo(a+c,l),t.lineTo(a,l+c),t.lineTo(a-c,l),t.lineTo(a,l-c),h=!0;h&&(t.fill(),t.stroke())},$.prototype.draw=function(t){},$.prototype.drawBackground=function(t){var e,i,o;for(t.save(),"undefined"==typeof FlashCanvas&&t.translate(-.5,-.5),e=0;e<this._items.length;++e)i=this._items[e],null!=i.color&&(t.fillStyle=i.color,o=e===this._items.length-1?this._w:this._items[e+1].x-i.x,t.fillRect(i.x,this._y,o,this._h));t.restore()},$.prototype.hitTest=function(t){return null},inherit(M,m),D.prototype._drawOrderArrow=function(t,e,i,o){var n,s=e.x,r=e.y;o?(t.rotate(Math.PI),s=-s-this._orderArrow.width/2,r=-r-this._orderArrow.height):(s-=this._orderArrow.width/2,r-=this._orderArrow.height),i&&(r-=i),n=o?"floor":"ceil",s=Math[n](s)+(o?-.5:.5),r=Math[n](r)+.5,t.translate(s,r),t.moveTo(.25*this._orderArrow.width,0),t.lineTo(.75*this._orderArrow.width,0),t.lineTo(.75*this._orderArrow.width,.45*this._orderArrow.height),t.lineTo(this._orderArrow.width,.45*this._orderArrow.height),t.lineTo(.5*this._orderArrow.width,this._orderArrow.height),i&&(t.lineTo(this._orderArrow.width,this._orderArrow.height),t.lineTo(this._orderArrow.width,this._orderArrow.height+i),t.lineTo(0,this._orderArrow.height+i),t.lineTo(0,this._orderArrow.height),t.lineTo(.5*this._orderArrow.width,this._orderArrow.height)),t.lineTo(0,.45*this._orderArrow.height),t.lineTo(.25*this._orderArrow.width,.45*this._orderArrow.height)},D.prototype._drawPriceArrow=function(t,e,i){var o=e.x,n=e.y;i?(t.rotate(Math.PI),o=-o-this._priceArrow.width,n=-n-this._priceArrow.height/2):(o-=this._priceArrow.width,n-=this._priceArrow.height/2),o=Math.round(o)+(i?-1.5:.5),n=Math.floor(n)+.5,t.translate(o,n),t.moveTo(0,0),t.lineTo(this._priceArrow.width,.5*this._priceArrow.height),t.lineTo(0,this._priceArrow.height)},D.prototype.draw=function(t){t.beginPath();for(var e,i,o=0;o<this._items.length;o++)e=this._items[o],i="lower"===e.pos,t.save(),t.translate(0,i?this._orderArrow.vMargin:-this._orderArrow.vMargin),this._drawOrderArrow(t,e.orderPoint,this._exitLineWidth,i),t.restore(),t.save(),this._drawPriceArrow(t,e.pricePoint,!i),t.restore();if(t.closePath(),t.fillStyle=this._color,t.fill(),this._text)for(t.font=this._text.fontSize+"px "+this._text.font,t.textAlign="center",t.textBaseline="top",o=0;o<this._items.length;o++)e=this._items[o],i="lower"===e.pos,t.save(),t.translate(0,i?this._orderArrow.vMargin:-this._orderArrow.height-this._orderArrow.vMargin),e.label&&(t.translate(0,i?this._text.fontSize+this._text.vMargin+this._exitLineWidth:-this._text.fontSize-this._text.vMargin-this._exitLineWidth),t.fillText(e.label,Math.ceil(e.orderPoint.x),e.orderPoint.y),"number"!=typeof this._textWidths[e.label]&&(this._textWidths[e.label]=t.measureText(e.label).width)),e.qty&&(t.translate(0,i?this._text.fontSize+this._text.vMargin+this._exitLineWidth:-this._text.fontSize-this._text.vMargin-this._exitLineWidth),t.fillText(e.qty,Math.ceil(e.orderPoint.x),e.orderPoint.y),"number"!=typeof this._textWidths[e.qty]&&(this._textWidths[e.qty]=t.measureText(e.qty).width)),
t.restore()},D.prototype._testOrderArrows=function(t){for(var e,i,o,n,s,r,a,l=0,h=this._orderArrow.width/2;l<this._items.length;l++)if(e=this._items[l].orderPoint,!(t.x<e.x-h||t.x>e.x+h||(i=this._items[l],o="lower"===i.pos,n=this._orderArrow.height+this._exitLineWidth,o||(n=-n),s=e.y+(o?this._orderArrow.vMargin:-this._orderArrow.vMargin),r=Math.min(s,s+n),a=Math.max(s,s+n),t.y<r||t.y>a)))return!0;return!1},D.prototype._testText=function(t){for(var e,i,o,n,s,r,a,l,h,c,d,p=0;p<this._items.length;p++)if(e=this._items[p],i=e.orderPoint,o="lower"===e.pos,n=this._orderArrow.vMargin+this._orderArrow.height+this._exitLineWidth,o||(n=-n),s=i.y+n,r=this._text.vMargin+this._text.fontSize*(!!e.label+!!e.qty),o||(r=-r),a=Math.min(s,s+r),l=Math.max(s,s+r),!(t.y<a||t.y>l||(h=e.label&&e.qty?o&&t.y<s+this._text.fontSize||!o&&t.y>s-this._text.fontSize?e.label:e.qty:e.label||e.qty,c=this._textWidths[h],d=c&&c/2,!c||t.x<i.x-d||t.x>i.x+d)))return!0;return!1},D.prototype.hitTest=function(t){var e=this._testOrderArrows(t),i=!e&&this._text&&this._testText(t);if(e||i)return new N(N.REGULAR)},O.prototype.draw=function(t){var e,i,o,n,s,r=this.data.vertLinesVisible,a=this.data.horzLinesVisible;(r||a)&&this.data&&(t.lineStyle=this.data.lineStyle,t.lineWidth=this.data.lineWidth,t.strokeStyle=this.data.color,e=this.data.lineWidth%2===0?.5:0,i=this.data.x+1+e,o=this.data.y+e,n=this.data.w,s=this.data.h,r&&i>=0&&CanvasEx.drawLine(t,i,0,i,s),a&&o>=0&&CanvasEx.drawLine(t,0,o,n,o),this.data.drawCenter&&(t.beginPath(),t.arc(i,o,3,0,2*Math.PI,!0),t.fillStyle=this.data.color,t.fill()))},B.prototype._drawShackle=function(t){var e=this._data.width-3,i=e/2,o=this._data.height-this._data.bodyHeight;t.moveTo(1.5,i),t.arc(this._data.width/2,i,i,Math.PI,2*Math.PI),o>i&&(t.moveTo(1.5,i),t.lineTo(1.5,o),t.moveTo(this._data.width-1.5,i),t.lineTo(this._data.width-1.5,o))},B.prototype.draw=function(t){var e,i,o,n;t.translate(this._data.x-this._data.width/2,this._data.y-this._data.height/2),e="rgba(153,153,153,.3)",i="rgba(153,153,153,.7)",o="#777",n="rgba(255,255,255,.7)",t.strokeStyle=e,t.lineWidth=2,t.beginPath(),this._drawShackle(t),t.stroke(),t.closePath(),t.strokeStyle=i,t.lineWidth=1,t.beginPath(),t.rect(0,this._data.height-this._data.bodyHeight+.5,this._data.width,this._data.bodyHeight),t.closePath(),t.stroke(),t.translate(0,-1),t.strokeStyle=o,t.beginPath(),this._drawShackle(t),t.stroke(),t.closePath(),t.fillStyle=n,t.beginPath(),t.rect(1,this._data.height-this._data.bodyHeight+1.5,this._data.width-2,this._data.bodyHeight-2),t.fill(),t.beginPath(),t.rect(.5,this._data.height-this._data.bodyHeight+1,this._data.width-1,this._data.bodyHeight-1),t.stroke(),t.closePath(),t.fillStyle=o,t.fillRect(this._data.width/2-.5,this._data.height-this._data.bodyHeight/2,1,2)},e.PaneRendererBars=TradingView.PaneRendererBars=o,e.PaneRendererRenkoPB=TradingView.PaneRendererRenkoPB=n,e.PaneRendererKagi=TradingView.PaneRendererKagi=s,e.PaneRendererPnF=TradingView.PaneRendererPnF=r,e.PaneRendererHistogram=TradingView.PaneRendererHistogram=a,e.PaneRendererColumns=TradingView.PaneRendererColumns=l,e.PaneRendererLine=TradingView.PaneRendererLine=h,e.PaneRendererArea=TradingView.PaneRendererArea=c,e.PaneRendererCandles=TradingView.PaneRendererCandles=d,e.PaneRendererCross=TradingView.PaneRendererCross=p,e.PaneRendererCircles=TradingView.PaneRendererCircles=u,e.PaneRendererCrossShape=TradingView.PaneRendererCrossShape=T,e.PaneRendererCrossHair=TradingView.PaneRendererCrossHair=O,e.PaneRendererCrossHairLock=TradingView.PaneRendererCrossHairLock=B,e.PaneRendererArrowsUpDownItem=TradingView.PaneRendererArrowsUpDownItem=_,e.PaneRendererArrowsUpDown=TradingView.PaneRendererArrowsUpDown=f,e.PaneRendererAbstractShape=TradingView.PaneRendererAbstractShape=g,e.PaneRendererUnicodeChar=TradingView.PaneRendererUnicodeChar=m,e.PaneRendererXCross=TradingView.PaneRendererXCross=v,e.PaneRendererTriangleApexUp=TradingView.PaneRendererTriangleApexUp=y,e.PaneRendererTriangleApexDown=TradingView.PaneRendererTriangleApexDown=b,e.PaneRendererTriangleApexLeft=TradingView.PaneRendererTriangleApexLeft=w,e.PaneRendererFlagShape=TradingView.PaneRendererFlagShape=S,e.PaneRendererCircleShape=TradingView.PaneRendererCircleShape=C,e.PaneRendererArrowsBase=TradingView.PaneRendererArrowsBase=x,e.PaneRendererArrowUp=TradingView.PaneRendererArrowUp=P,e.PaneRendererArrowDown=TradingView.PaneRendererArrowDown=L,e.PaneRendererLabelsBase=TradingView.PaneRendererLabelsBase=k,e.PaneRendererLabelUp=TradingView.PaneRendererLabelUp=E,e.PaneRendererLabelDown=TradingView.PaneRendererLabelDown=I,e.PaneRendererSquare=TradingView.PaneRendererSquare=A,e.PaneRendererDiamond=TradingView.PaneRendererDiamond=V,e.PaneRendererBackground=TradingView.PaneRendererBackground=$,e.PaneRendererClockIcon=TradingView.PaneRendererClockIcon=M,e.PaneRendererStudyStrategyOrders=TradingView.PaneRendererStudyStrategyOrders=D}).call(e,i(21))},function(t,e){"use strict";e.optimalBarWidth=function(t){return.3*t},e.selectionTolerance=function(t){return 2+.5*t},e.paneRendererCoordinateIsValid=function(t){return null!==t&&void 0!==t&&!TradingView.isNaN(t)}},function(t,e){"use strict";function i(t,e,i,o,n){var s,r,a,l,h;for(this._canvasesMap={},this._lines=t.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=this._fontStyle(e,i,o,n),this._fontSize=n,s=$("<canvas>"),r=s.get(0).getContext("2d"),r.font=this._font,a=0,l=0;l<this._lines.length;l++)h=r.measureText(this._lines[l]).width,a=Math.max(a,h);this.textImageWidth=a+1,this.textImageHeight=this._lines.length*n}i.prototype.paintTo=function(t,e,i,o,n,s){var r=this._getTextImage(e),a=this._x(i,n,this.textImageWidth),l=this._y(o,s,this.textImageHeight);t.drawImage(r,a-.5,l-.5)},i.prototype._getTextImage=function(t){var e,i,o,n,s;if(this._canvasesMap[t])return this._canvasesMap[t].get(0);for(e=$("<canvas>").attr("width",this.textImageWidth).attr("height",this.textImageHeight),i=e.get(0).getContext("2d"),i.textBaseline="top",i.font=this._font,i.textAlign="center",i.fillStyle=t,o=Math.round(this.textImageWidth/2),n=0,s=0;s<this._lines.length;s++)i.fillText(this._lines[s],o,n),n+=this._fontSize;return this._canvasesMap[t]=e,e.get(0)},i.prototype._x=function(t,e,i){var o=t;switch(e){case"left":break;case"right":o-=i;break;case"center":o-=i/2}return Math.round(o)},i.prototype._y=function(t,e,i){var o=t;switch(e){case"top":break;case"bottom":o-=i;break;case"middle":o-=i/2}return Math.round(o)},i.prototype._fontStyle=function(t,e,i,o){return(t?"bold ":"")+(e?"italic ":"")+o+"px "+i},t.exports=i},function(t,e){"use strict";function i(){this._renderers=[],this._globalAlpha=1}i.prototype.setGlobalAlpha=function(t){this._globalAlpha=t},i.prototype.append=function(t){this._renderers.push(t)},i.prototype.insert=function(t,e){this._renderers.splice(e,0,t)},i.prototype.draw=function(t){for(var e=0;e<this._renderers.length;e++)t.save(),t.globalAlpha=this._globalAlpha,this._renderers[e].draw(t),t.restore()},i.prototype.drawBackground=function(t){t.save(),t.globalAlpha=this._globalAlpha;for(var e=0;e<this._renderers.length;e++)this._renderers[e].drawBackground&&this._renderers[e].drawBackground(t);t.restore()},i.prototype.hitTest=function(t){var e,i,o=null;for(e=this._renderers.length-1;e>=0;e--)i=this._renderers[e].hitTest(t),i&&(null==o||i.result()>o.result())&&(o=i);return o},t.exports=i},function(t,e){"use strict";t.exports=function(t,e){var i,o=10,n=t%o;for(n&&(t=t-n+o),i=[];t<=e;t+=o)i.push(t);return i}},function(t,e){"use strict";function i(t,e){return null===t||TradingView.isInteger(t)?null===e||TradingView.isInteger(e)?(this.m_firstBar=t,void(this.m_lastBar=e)):void TradingView.logDebugChart("BarsRange: incorrect lastBar"):void TradingView.logDebugChart("BarsRange: incorrect firstBar")}i.prototype.isEmpty=function(){return null===this.m_firstBar||null===this.m_lastBar||void 0===this.m_firstBar||void 0===this.m_lastBar},i.prototype.clone=function(){return new i(this.m_firstBar,this.m_lastBar)},i.prototype.firstBar=function(){return this.m_firstBar},i.prototype.lastBar=function(){return this.m_lastBar},i.prototype.count=function(){return this.m_lastBar-this.m_firstBar+1},i.prototype.resizeRight=function(t){return!TradingView.isInteger(t)||t<0?void TradingView.logDebugChart("BarsRange: incorrect newWidth"):void(this.m_firstBar=this.m_lastBar-t+1)},i.prototype.shift=function(t){return isNumber(t)?(this.m_firstBar=Math.round(this.m_firstBar+t),void(this.m_lastBar=Math.round(this.m_lastBar+t))):void TradingView.logDebugChart("BarsRange.shift: incorrect coeff")},i.prototype.contains=function(t){return this.m_firstBar<=t&&this.m_lastBar>=t},t.exports=i},function(t,e){"use strict";function i(){this.backColorers=[]}function o(t){i.call(this),this._series=t}function n(t,e){i.call(this),this._study=t,this._plotIndex=e}i.prototype.barStyle=function(t,e,i){var o,n={};for(o=this.backColorers.length-1;o>=0;o--)this.backColorers[o].applyBarStyle(t,e,n,i);return this.applyBarStyle(t,e,n,i),n},i.prototype.pushBackBarColorer=function(t){this.backColorers.push(t)},i.prototype.applyBarStyle=function(t,e,i){throw Error("This function is supposed to be reimplemented in a subclass")},inherit(o,i),o.prototype.applyBarStyle=function(t,e,i,o){var n,s,r,a,l,h,c,d,p,u,_;switch(i||(i={}),i.barColor=null,i.barBorderColor=null,i.barWickColor=null,i.isBarHollow=null,i.isBarUp=null,i.upColor=null,i.downColor=null,i.isTwoColorBar=null,n=this._series.properties(),n.style.value()){case TradingView.Series.STYLE_LINE:i.barColor=n.lineStyle.color.value();break;case TradingView.Series.STYLE_AREA:i.barColor=n.areaStyle.linecolor.value();break;case TradingView.Series.STYLE_BARS:s=n.barStyle.upColor.value(),r=n.barStyle.downColor.value(),a=s,l=r,h=this.findBar(t,!1,o),n.barStyle.barColorsOnPrevClose.value()?(c=this.findPrevBar(t,!1,o),i.barColor=c[TradingView.CLOSE_PLOT]<=h[TradingView.CLOSE_PLOT]?s:r,i.barBorderColor=c[TradingView.CLOSE_PLOT]<=h[TradingView.CLOSE_PLOT]?a:l):(i.barColor=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT]?s:r,i.barBorderColor=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT]?a:l);break;case TradingView.Series.STYLE_CANDLES:s=n.candleStyle.upColor.value(),r=n.candleStyle.downColor.value(),a=n.candleStyle.borderUpColor?n.candleStyle.borderUpColor.value():n.candleStyle.borderColor.value(),l=n.candleStyle.borderDownColor?n.candleStyle.borderDownColor.value():n.candleStyle.borderColor.value(),d=n.candleStyle.wickUpColor?n.candleStyle.wickUpColor.value():n.candleStyle.wickColor.value(),p=n.candleStyle.wickDownColor?n.candleStyle.wickDownColor.value():n.candleStyle.wickColor.value(),h=this.findBar(t,!1,o),n.candleStyle.barColorsOnPrevClose.value()?(c=this.findPrevBar(t,!1,o),u=c[TradingView.CLOSE_PLOT]<=h[TradingView.CLOSE_PLOT]):u=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT],i.barColor=u?s:r,i.barBorderColor=u?a:l,i.barWickColor=u?d:p;break;case TradingView.Series.STYLE_HOLLOW_CANDLES:s=n.hollowCandleStyle.upColor.value(),r=n.hollowCandleStyle.downColor.value(),a=n.hollowCandleStyle.borderUpColor?n.hollowCandleStyle.borderUpColor.value():n.hollowCandleStyle.borderColor.value(),l=n.hollowCandleStyle.borderDownColor?n.hollowCandleStyle.borderDownColor.value():n.hollowCandleStyle.borderColor.value(),d=n.hollowCandleStyle.wickUpColor?n.hollowCandleStyle.wickUpColor.value():n.hollowCandleStyle.wickColor.value(),p=n.hollowCandleStyle.wickDownColor?n.hollowCandleStyle.wickDownColor.value():n.hollowCandleStyle.wickColor.value(),h=this.findBar(t,!1,o),c=this.findPrevBar(t,!1,o),c[TradingView.CLOSE_PLOT]<=h[TradingView.CLOSE_PLOT]?(i.barColor=s,i.barBorderColor=a,i.barWickColor=d):(i.barColor=r,i.barBorderColor=l,i.barWickColor=p),h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT]?i.isBarHollow=!0:i.isBarHollow=!1;break;case TradingView.Series.STYLE_HEIKEN_ASHI:s=n.haStyle.upColor.value(),r=n.haStyle.downColor.value(),a=n.haStyle.borderUpColor.value(),l=n.haStyle.borderDownColor.value(),d=n.haStyle.wickUpColor.value(),p=n.haStyle.wickDownColor.value(),h=this.findBar(t,e,o),n.haStyle.barColorsOnPrevClose.value()?(c=this.findPrevBar(t,e,o),u=c[TradingView.CLOSE_PLOT]<=h[TradingView.CLOSE_PLOT]):u=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT],i.barColor=u?s:r,i.barBorderColor=u?a:l,i.barWickColor=u?d:p;break;case TradingView.Series.STYLE_RENKO:h=this.findBar(t,e,o),u=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT],s=e?n.renkoStyle.upColorProjection.value():n.renkoStyle.upColor.value(),r=e?n.renkoStyle.downColorProjection.value():n.renkoStyle.downColor.value(),a=e?n.renkoStyle.borderUpColorProjection.value():n.renkoStyle.borderUpColor.value(),l=e?n.renkoStyle.borderDownColorProjection.value():n.renkoStyle.borderDownColor.value(),i.barColor=u?s:r,i.barBorderColor=u?a:l,i.isBarUp=u;break;case TradingView.Series.STYLE_PB:h=this.findBar(t,e,o),u=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT],s=e?n.pbStyle.upColorProjection.value():n.pbStyle.upColor.value(),r=e?n.pbStyle.downColorProjection.value():n.pbStyle.downColor.value(),a=e?n.pbStyle.borderUpColorProjection.value():n.pbStyle.borderUpColor.value(),l=e?n.pbStyle.borderDownColorProjection.value():n.pbStyle.borderDownColor.value(),i.barColor=u?s:r,i.barBorderColor=u?a:l,i.isBarUp=u;break;case TradingView.Series.STYLE_KAGI:i.upColor=e?n.kagiStyle.upColorProjection.value():n.kagiStyle.upColor.value(),i.downColor=e?n.kagiStyle.downColorProjection.value():n.kagiStyle.downColor.value(),_=null,h=this.findBar(t,e,o),h[TradingView.LOW_PLOT]<h[TradingView.ADT_PLOT]&&h[TradingView.ADT_PLOT]<h[TradingView.HIGH_PLOT]?(_=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT],i.isTwoColorBar=!0):(_=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT]?h[TradingView.OPEN_PLOT]===h[TradingView.ADT_PLOT]:h[TradingView.OPEN_PLOT]!==h[TradingView.ADT_PLOT],i.isTwoColorBar=!1),i.barColor=_?i.upColor:i.downColor,i.isBarUp=h[TradingView.OPEN_PLOT]<=h[TradingView.CLOSE_PLOT];break;case TradingView.Series.STYLE_PNF:h=this.findBar(t,e,o),u=h[TradingView.ADT_PLOT]>0,s=e?n.pnfStyle.upColorProjection.value():n.pnfStyle.upColor.value(),r=e?n.pnfStyle.downColorProjection.value():n.pnfStyle.downColor.value(),i.isBarUp=u,i.barColor=u?s:r}return i},o.prototype.getSeriesBars=function(t){return t?this._series.nsBars():this._series.bars()},o.prototype._findBarFieldValue=function(t,e,i){var o=this.getSeriesBars(i).valueAt(t);if(void 0!==o)return o[e]},o.prototype.findBar=function(t,e,i){return i?i.value:this.getSeriesBars(e).valueAt(t)||[]},o.prototype.findPrevBar=function(t,e,i){var o,n;return i&&i.previousValue?i.previousValue:(o=this._series.bars(),n=o._search(t,TradingView.SEARCH_EXACT),n>0?this._series.bars()._valueAt(n-1):[])},inherit(n,i),n.prototype.applyBarStyle=function(t,e,i){var o,n,s,r,a,l,h,c,d,p,u,_,f;return i||(i={}),e?i:(o=this._study.properties(),o.visible.value()?(n=this._study.metaInfo(),s=this._study.data(),s&&0!==s.size()?(r=n.plots[this._plotIndex],a=o.styles[r.id],a.visible&&!a.visible.value()?i:(l=this._study.offset(r.id),(h=s.valueAt(t-l))?(c=h[this._plotIndex+1],null==c?i:(c=Math.round(c),d=n.plots[this._plotIndex].palette,p=o.palettes,u=p[d],_=n.palettes[d].valToIndex?n.palettes[d].valToIndex[c]:c,f=u.colors[_].color.value(),i.barColor=f,i.upColor=f.color,i.downColor=f.color,i)):i)):i):i)},e.SeriesBarColorer=o,e.StudyBarColorer=n},function(t,e,i){(function(t){"use strict";function o(t){this._data=t}function n(t,e){l.call(this,t,e),this._rendererCache={}}function s(t,e){this._source=t,this._model=e,this._text="",this._coordinate=0,this._background="black",this._color="white",this._invaildated=!0}function r(t,e){this._constructor="LineToolHorzLine";var i=e||new _("linetoolhorzline");this._priceAxisView=new s(this,t),a.call(this,t,new n(this,t),i)}var a=i(74).LineDataSource,l=i(103),h=i(75),c=i(76),d=i(104).TextRenderer,p=i(94),u=i(98),_=i(80).DefaultProperty;o.prototype.draw=function(t){var e,i;return 0===this._data.points.length?null:void(this._data.visible!==!1&&(e=this._data.points[0].y,i=t.canvas.width,t.lineCap="square",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,CanvasEx.drawLine(t,0,e,i,e)))},o.prototype.hitTest=function(t){if(this._data.visible===!1)return null;if(0===this._data.points.length)return null;var e=3;return Math.abs(t.y-this._data.points[0].y)<=e?new p(this._data.hitTestResult):null},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this)},n.prototype.renderer=function(){var e,i,n,s,r,a,l,h,c,_,f;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),e=new u,i={},i.points=this._points,i.color=this._source.properties().linecolor.value(),i.linewidth=this._source.properties().linewidth.value(),i.linestyle=this._source.properties().linestyle.value(),i.hitTestResult=p.MOVEPOINT,n=this._source.properties(),e.append(new o(i)),this._source.properties().showLabel.value()&&1===this._points.length&&(s=n.vertLabelsAlign.value(),r=n.horzLabelsAlign.value(),a=this._points[0],l=0,h=0,"left"===r?a.x=3:"right"===r?(a.x=this._model.timeScale().width(),h=-5):a.x=this._model.timeScale().width()/2,"middle"===s?l=-this._source.properties().fontsize.value()/6:"bottom"===s&&(l=-4),c={points:[a],text:n.text.value(),color:n.textcolor.value(),vertAlign:s,horzAlign:r,font:n.font.value(),offsetX:h,offsetY:l,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value()},e.append(new d(c,this._rendererCache))),1===this._points.length&&this.isAnchorsRequired()&&(_=new t.Point(this._model.timeScale().width()/2,this._points[0].y),_.data=0,e.append(this.createLineAnchor({points:[_]}))),TradingView.printing||!this._source.hasAlert.value()||this._model.readOnly()||1!==this._points.length||(f=new t.Point(this._model.timeScale().width()/2,this._points[0].y),this._source.getAlertIsActive(function(t){e.append(new TradingView.PaneRendererClockIcon({point1:f,color:t?i.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))})),e},inherit(s,h),s.prototype.update=function(){this._invaildated=!0},s.prototype.updateImpl=function(){var t,e,i;if(0!==this._source.points().length&&this._source.priceScale()&&!this._source.priceScale().isEmpty()){if(t=this._source.properties().linecolor.value(),t!==this._background&&(this._background=t,this._color=this.color()),e=this._source.points()[0].price,this._source.priceScale().isPercent()){if(i=this._source.ownerSource().firstValue(),null===i)return;e=this._source.priceScale().priceRange().convertToPercent(e,i)}this._floatCoordinate=this._source.priceScale().priceToCoordinate(e,!0),this._coordinate=Math.round(this._floatCoordinate),this._source.priceScale().formatter()&&(this._text=this._source.priceScale().formatter().format(e))}},s.prototype.renderer=function(){this._invaildated&&(this.updateImpl(),this._invaildated=!1);var t={text:this._text,coordinate:this._coordinate,color:this._color,background:this._background,visible:!0};return new c(t)},s.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),h.prototype.coordinate.call(this)},inherit(r,a),r.prototype.state=function(t){var e=a.prototype.state.call(this,t);return e.points&&0!==e.points.length&&(e.points[0].offset=0),e},r.prototype.pointsCount=function(){return 1},r.prototype.title=function(){return"Horizontal Line"},r.prototype.priceAxisViews=function(t,e){return this.isActualSymbol()&&e===this.priceScale()&&this.properties().showPrice.value()&&this._model.paneForSource(this)===t?[this._priceAxisView]:null},r.prototype.updateAllViews=function(){a.prototype.updateAllViews.call(this),this._priceAxisView.update()},r.prototype.canHasAlert=function(){return!0},r.prototype._getAlertPlots=function(){return[this.points()[0].price]},e.HorzLineRenderer=o,e.LineToolHorzLine=r}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){this._source=t,this._model=e,this._points=[],this._floatPoints=[]}var n=i(94),s=i(93).LineAnchor;o.prototype.priceToCoordinate=function(t){var e,i=this._source.priceScale();return i.isPercent()&&(e=this._source.ownerSource().firstValue(),t=i.priceRange().convertToPercent(t,e)),i.priceToCoordinate(t)},o.prototype.addAnchors=function(t){if(this.isAnchorsRequired()){var e=this._points;this._model.lineBeingCreated()===this._source&&(e=e.slice(0,-1)),t.append(this.createLineAnchor({points:e}))}},o.prototype.update=function(){var t,e,i,o,n,s,r,a;if(this._points=[],t=this._source.priceScale(),e=this._model.timeScale(),t&&!t.isEmpty()&&!e.isEmpty())for(this._floatPoints=[],i=this._source.points(),o=0;o<i.length;o++){if(n=i[o],s=this._source.pointToScreenPoint(n),!s)return;r=s[0],r.data=o,a=s[1],a.data=o,this._floatPoints.push(r),this._points.push(a)}},o.prototype.currentPoint=function(){var t=this._model.crossHairSource();return new e.Point(t.x,t.y)},o.prototype.anchorColor=function(){return this._source.isBeingEdited()?"#D61AD3":this._model.isDark()?"#FFFFFF":"#606060"},o.prototype.isHoveredSource=function(){return this._source===this._model.hoveredSource()},o.prototype.isSelectedSource=function(){return this._source===this._model.selectedSource()},o.prototype.isAnchorsRequired=function(){return(this.isHoveredSource()||this.isSelectedSource())&&!this._model.isSnapshot()},o.prototype.createLineAnchor=function(t){return new s($.extend({color:this.anchorColor(),backgroundColor:this._model.backgroundColor(),currentPoint:this.currentPoint(),linePointBeingEdited:this._model.linePointBeingEdited(),hittestResult:n.CHANGEPOINT,radius:(TradingView.isMobile.any()?15:7)+(this.isSelectedSource()?1:0),strokeWidth:(TradingView.isMobile.any()?3:1)+(this.isSelectedSource()?1:0)},t))},t.exports=o}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(t,e,i){this._textSizeCache=e,this._data=t,this._fontSize=t.fontsize?t.fontsize:t.fontSize?t.fontSize:20,t.lines=this._lines=this.wordWrap(t.text,t.wordWrapWidth),this._hittest=i||new c(c.MOVEPOINT)}function n(t,e,i,o,n,s){a.call(this,t,e),this._offsetX=i,this._offsetY=o,this._vertAlign=n,this._horzAlign=s,this._rendererCache={},this._renderer=null,this._invalidated=!0}function s(t,e){this._constructor="LineToolText";var i=e||new p("linetooltext");l.call(this,t,new n(this,t),i),this._timeScale=t.timeScale(),this._barSpacing=t.timeScale().barSpacing()}function r(t,e){var i=e||new p("linetooltextabsolute");i.locked.value()||i.locked.setValue(!0),s.call(this,t,i)}var a=i(103),l=i(74).LineDataSource,h=i(79).DataSource,c=i(94),d=i(98),p=i(80).DefaultProperty;!function(){function t(){var t=document.createElement("canvas");t.width=0,t.height=0,e=t.getContext("2d"),t=null}var e;o.prototype.setPoints=function(t,e){this._data.points=t,this._hittest=e||new c(c.MOVEPOINT)},o.prototype._calcLinesWidths=function(){var i,o,n,s;if(e||t(),e.textBaseline="alphabetic",e.font=this.fontStyle(),i=[],this._data.wordWrapWidth)for(o=this._data.wordWrapWidth,n=0;n<this._lines.length;n++)i.push(this._data.wordWrapWidth);else for(o=0,n=0;n<this._lines.length;n++)s=e.measureText(this._lines[n]).width,i.push(s),o=Math.max(o,s);return{widths:i,maxWidth:o}},o.prototype.measure=function(){var t=this._fontSize,e=this._calcLinesWidths().maxWidth,i=t*this._lines.length,o=~~(t/6);return this._data.backgroundHorzInflate&&(e+=2*this._data.backgroundHorzInflate),this._data.backgroundVertInflate&&(i+=2*this._data.backgroundVertInflate),e=Math.ceil(e+2*o),i=Math.ceil(i+2*o),e%2!==0&&e++,this._data.padding&&(i+=this._data.padding),{width:e,height:i,textBgPadding:o}},o.prototype.wordWrap=function(i,o,n){var s,r,a,l,h,c,d,p,u;if(e||t(),o=+o,i+="",s=i.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/),s[s.length-1]||s.pop(),!isFinite(o)||o<=0)return s;for(e.font=n||this.fontStyle(),r=[],a=0;a<s.length;a++)if(l=s[a],h=e.measureText(l).width,h<=o)r.push(l);else for(c=l.split(/([-\)\]\},.!?:;])|(\s+)/);c.length;){if(d=~~(o/h*(c.length+2)/3),d<=0||e.measureText(c.slice(0,3*d-1).join("")).width<=o)for(;e.measureText(c.slice(0,3*(d+1)-1).join("")).width<=o;)d++;else for(;d>0&&e.measureText(c.slice(0,3*--d-1).join("")).width>o;);if(d>0)r.push(c.slice(0,3*d-1).join("")),c.splice(0,3*d);else{if(p=c[0]+(c[1]||""),u=1===u?1:~~(o/e.measureText(p)*p.length),e.measureText(p.substr(0,u)).width<=o)for(;e.measureText(p.substr(0,u+1)).width<=o;)u++;else for(;u>1&&e.measureText(p.substr(0,--u)).width>o;);u<1&&(u=1),r.push(p.substr(0,u)),c[0]=p.substr(u),c[1]=""}if(h=e.measureText(c.join("")).width,h<=o){r.push(c.join(""));break}}return r}}(),o.prototype._x=function(){var t=this._data.points[0].x+this._data.offsetX;return t},o.prototype._y=function(){var t,e=this._fontSize*this._lines.length;switch(this._data.scaleY&&(e*=this._data.scaleY),t=this._data.points[0].y+this._data.offsetY+e,this._data.vertAlign){case"top":break;case"bottom":t-=e;break;case"middle":t-=e/2}return t},o.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._fontSize+"px "+this._data.font},o.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g;if(0!==this._data.points.length){switch(e=this._x(),i=this._y(),o=this._fontSize,this._data.scaleY&&(o*=this._data.scaleY),i-=o*(this._lines.length-1),t.textBaseline="alphabetic",t.font=this.fontStyle(),this._data.horzAlign){case"left":t.textAlign="start";break;case"right":t.textAlign="end";break;case"center":t.textAlign="center"}if(t.translate(e+.5,i+.5),e=0,i=0,o=this._fontSize,this._data.scaleX&&this._data.scaleY&&(n=Math.min(this._data.scaleX,this._data.scaleY),t.scale(n,n)),s=this._calcLinesWidths(),r=s.maxWidth,a=0,this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){switch(l=e,this._data.horzAlign){case"left":break;case"right":l-=r;break;case"center":l-=r/2}h=o*this._lines.length,c=~~(o/6),this._data.backgroundHorzInflate&&(r+=2*this._data.backgroundHorzInflate,l-=this._data.backgroundHorzInflate),this._data.backgroundVertInflate&&(h+=2*this._data.backgroundVertInflate,i+=this._data.backgroundVertInflate),d={x:Math.floor(l-c),y:Math.floor(i-o),w:Math.ceil(r+2*c),h:Math.ceil(h+2*c)},d.w%2!==0&&d.w++,this._data.padding&&(d.h+=this._data.padding,a=this._data.padding),this._data.backgroundVertInflate&&(i+=this._data.backgroundVertInflate),this._data.backgroundRoundRect?(t.roundRect(d.x,d.y,d.w,d.h,this._data.backgroundRoundRect),this._data.backgroundColor&&(t.fillStyle=this._data.backgroundColor,t.fill()),this._data.borderColor&&(p=~~Math.max(o/12,1),t.strokeStyle=this._data.borderColor,t.lineWidth=p,t.stroke())):(this._data.backgroundColor&&(t.fillStyle=this._data.backgroundColor,t.fillRect(d.x,d.y,d.w,d.h)),this._data.borderColor?(p=~~Math.max(o/12,1),t.strokeStyle=this._data.borderColor,t.lineWidth=p,t.strokeRect(d.x-p/2,d.y-p/2,d.w+p,d.h+p)):this._data.highlightBorder&&(t.strokeStyle=this._data.color,t.lineWidth=1,t.beginPath(),f=[3,1],t.dashedLineTo(d.x-.5,_=d.y-.5,u=d.x+d.w+.5,_,f),t.dashedLineTo(u,_,u,_=d.y+d.h+.5,f),t.dashedLineTo(u=d.x-.5,_,d.x+d.w+.5,_,f),t.dashedLineTo(u,d.y-.5,u,_,f),t.stroke()))}for(this._data.backgroundVertInflate&&!this._data.backgroundColor&&(i+=2*this._data.backgroundVertInflate),t.fillStyle=this._data.color,g=0;g<this._lines.length;g++)t.fillText(this._lines[g],e,i),i+=o+a;this._textSizeCache&&(this._textSizeCache.widths=s.widths)}},o.prototype.hitTest=function(t){var e,i,o,n,s,r,a,l;if(0===this._data.points.length)return null;if(e=this._fontSize,this._data.scaleY&&(e*=this._data.scaleY),i=this._textSizeCache.widths,!i)return null;for(o=0,n=0;n<i.length;n++)o=Math.max(o,i[n]);return this._data.scaleX&&(o*=this._data.scaleX),s=this._data.points[0].x+this._data.offsetX,r=this._data.points[0].y+this._data.offsetY,"bottom"===this._data.vertAlign&&(r-=this._lines.length*this._fontSize),"middle"===this._data.vertAlign&&(r-=this._lines.length*this._fontSize/2),"right"===this._data.horzAlign?s-=o:"center"===this._data.horzAlign&&(s-=o/2),a=this._data.backgroundColor||this._data.borderColor?~~(e/6):0,l=this._data.borderColor?~~Math.max(e/12,1):0,t.x>=s-a-l&&t.x<=s+o+a+l&&t.y>=r-l&&t.y<=r+this._lines.length*this._fontSize+2*a+l?this._hittest:null},inherit(n,a),n.prototype.update=function(){this._renderer=null,this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var e,i,n,s,r,a,l,h,c,p,u,_;return this._invalidated&&this.updateImpl(),this._renderer?this._renderer:(e=this._source.priceScale(),!e||e.isEmpty()?(this._renderer=new d,this._renderer):(i={},n=this._source.properties(),s=n.locked&&n.locked.value(),s?i.points=this._source.fixedPoints():i.points=this._points,i.text=n.text.value(),i.color=n.color.value(),i.font=n.font.value(),i.offsetX=this._offsetX?this._offsetX:0,i.offsetY=this._offsetY?this._offsetY:0,i.vertAlign=this._vertAlign?this._vertAlign:"top",i.horzAlign=this._horzAlign?this._horzAlign:"left",i.fontsize=n.fontsize.value(),n.fillBackground&&n.fillBackground.value()&&(i.backgroundColor=n.backgroundColor.value(),i.backgroundTransparency=1-n.backgroundTransparency.value()/100||0),n.drawBorder&&n.drawBorder.value()&&(i.borderColor=n.borderColor.value()),n.wordWrap&&n.wordWrap.value()&&(i.wordWrapWidth=n.wordWrapWidth.value()),i.bold=n.bold&&n.bold.value(),i.italic=n.italic&&n.italic.value(),i.highlightBorder=this._model.selectedSource()===this._source,s||!n.fixedSize||n.fixedSize.value()||(i.scaleX=this._source._model.timeScale().barSpacing()/this._source._barSpacing,r=e.height()/e.priceRange().length(),this._source._isPriceDencityLog&&!e.isLog()&&(a=e.priceRange().minValue(),l=e.priceRange().maxValue(),a=e._toLog(a),l=e._toLog(l),h=l-a,r=e.height()/h),!this._source._isPriceDencityLog&&e.isLog()&&(a=e.priceRange().minValue(),l=e.priceRange().maxValue(),a=e._fromLog(a),l=e._fromLog(l),h=l-a,r=e.height()/h),i.scaleY=r/this._source._priceDencity,(!isFinite(i.scaleY)||i.scaleY<=0)&&delete i.scaleY),c=new o(i,this._rendererCache),this.isAnchorsRequired()&&1===i.points.length&&!this._noSelection?(p=i.points[0],u=new d,u.append(c),i.wordWrapWidth&&(_=new t.Point(p.x+i.wordWrapWidth+~~(i.fontsize/6),p.y+(i.lines?i.lines.length*i.fontsize/2+~~(i.fontsize/6):0)),_.data=0,u.append(this.createLineAnchor({points:[_]}))),this._renderer=u,this._renderer):(this._renderer=c,this._renderer)))},inherit(s,l),s.MIN_WIDTH=100,s.prototype.setPoint=function(t,e){var i,o,n=this.properties();if(0===t&&n.wordWrapWidth&&n.wordWrapWidth.value()){if(i=n.locked&&n.locked.value()?this.fixedPoints()[0].x:this._timeScale.indexToCoordinate(this.points()[0].index),o=this._timeScale.indexToCoordinate(e.index)-i-~~(n.fontsize.value()/6),!isFinite(o))return;n.wordWrapWidth.setValue(Math.max(s.MIN_WIDTH,o))}},s.prototype.pointsCount=function(){return 1},s.prototype.title=function(){return $.t("Text")},s.prototype.setPriceScale=function(t){h.prototype.setPriceScale.call(this,t),t&&t.priceRange()&&(this._priceDencity=t.height()/t.priceRange().length(),this._isPriceDencityLog=t.isLog())},s.prototype.restoreSize=function(){this._barSpacing=this._model.timeScale().barSpacing(),this._priceDencity=this.priceScale().height()/this.priceScale().priceRange().length(),this.updateAllViews(),this._model.updateSource(this)},s.prototype.restoreTemplate=function(t){delete t.locked,delete t.text,l.prototype.restoreTemplate.call(this,t)},inherit(r,s),r.prototype.title=function(){return $.t("Anchored Text")},s.prototype.state=function(t){var e=l.prototype.state.call(this,t);return t&&(e.state.fixedSize=!1),e},e.TextRenderer=o,e.TextPaneView=n,e.LineToolText=s,e.LineToolTextAbsolute=r}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._data=t}function n(t){this._series=t,this._invalidated=!0}var s=i(98),r=i(82),a=r.DateFormatter,l=r.TimeFormatter;o.prototype.hittest=function(){},o.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d=5,p=12,u=5,_=8,f=13,g=0;t.save(),t.setFont(f+"px Arial"),o=$.t("Last available bar"),this._data.eod?g=t.measureText(o).width:(e=t.measureText(this._data.dateString||"").width,i=t.measureText(this._data.timeString||"").width,
g=Math.max(e,i)),n=this._data.timeString?2:1,t.fillStyle=this._data.eod?"#FF4040":"#58A3CD",t.translate(this._data.point.x+.5,this._data.point.y+.5),s=Math.round(-g/2)-_,r=-(f+d)*n-d-p-u,a=Math.round(s+g+2*_),l=-p-u,t.beginPath(),t.moveTo(s,r),t.lineTo(a,r),t.lineTo(a,l),t.lineTo(p,l),t.lineTo(0,l+p),t.lineTo(-p,l),t.lineTo(s,l),t.fill(),t.fillStyle="#FFFFFF",t.textBaseline="top",this._data.eod?t.fillText(o,s+_,r+d):(h=s+_+(g-e)/2,t.fillText(this._data.dateString,h,r+d),this._data.timeString&&(c=s+_+(g-i)/2,t.fillText(this._data.timeString,c,r+2*d+f))),t.restore()},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){var t,i,o,n,s,r;delete this._point,delete this._dateString,delete this._timeString,delete this._eod,t=this._series.gotoDateResult(),void 0!==t&&(i=t.index,o=this._series.bars().valueAt(i),o&&(n=this._series.priceScale().priceToCoordinate(o[TradingView.HIGH_PLOT]),s=this._series.model().timeScale().indexToCoordinate(i),this._point=new e.Point(s,n),t.eod?this._eod=!0:(r=this._series.model().timeScale().indexToUserTime(i),this._dateString=(new a).format(r),this._series.isDWM()||(this._timeString=(new l).format(r)))))},n.prototype.renderer=function(){return this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._point?new o({point:this._point,dateString:this._dateString,timeString:this._timeString,eod:this._eod}):new s},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._data=t,this._textWidthCache=new s}function n(t,e,i,o,n){this._model=t,this._source=e,this._plotIndex=i,this._getterName=o||"symbol",this._propertyName=n,this._cache={},this._invalidated=!0,this._rendererData={}}var s=i(107),r=i(98),a=i(65).RGBColor;o.prototype.hitTest=function(t){return null},o.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c;this._data.visible&&(this._textWidthCache.font!==this._data.font&&(this._textWidthCache.reset(),this._textWidthCache.font=this._data.font),t.font=this._data.font,e=this._data.fontSize,i=Math.floor(e/4.5),o=Math.ceil(e/4.5),n=Math.ceil(e/3),s=Math.ceil(this._textWidthCache.measureText(t,this._data.text)),r=Math.round(e/10),a=e+i+o,l=s+2*n,h=this._data.x-.5,"right"===this._data.align&&(h-=l),c=this._data.y-Math.floor(e/2)-i-.5,t.fillStyle=this._data.backColor,t.fillRect(h,c,l,a),t.fillStyle=this._data.color,t.textAlign="left",t.fillText(this._data.text,h+n,c+i+e-r))},n.prototype.isPropertyEnabled=function(){return this._model.properties().scalesProperties[this._propertyName].value()},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){var t,i,o,n,s,l,h=this._rendererData;if(h.visible=!1,h.text="",this.isPropertyEnabled()&&this._source.properties().visible.value()&&(t=this._source.lastValueData(this._plotIndex,e.enabled("price_scale_always_last_bar_value")),!t.noData)){if(i=this._model.paneForSource(this._source),o="right",i.leftPriceScale()===this._source.priceScale()&&(o="left"),n=this._model.properties(),s=!i.leftPriceScale().mainSource()||!i.rightPriceScale().mainSource(),s&&n.scalesProperties.showLeftScale.value()&&!n.scalesProperties.showRightScale.value()&&(o="left"),!s){if("left"===o&&!n.scalesProperties.showLeftScale.value())return new r;if("right"===o&&!n.scalesProperties.showRightScale.value())return new r}l=t.coordinate,this._source.lastPriceLabelFixedCoordinate&&(l=this._source.lastPriceLabelFixedCoordinate(this._plotIndex)||l),h.visible=!0,t.color!==h.backColor&&(h.backColor=t.color,h.color=new a(t.color).blackWhiteContrast()),h.text=this._source[this._getterName](this._plotIndex),h.align=o,"right"===o?h.x=this._model.timeScale().width():h.x=0,h.y=l,h.fontSize=this._model.properties().scalesProperties.fontSize.value(),h.font=TradingView.makeFont(h.fontSize,"Arial","")}},n.prototype.renderer=function(){return this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._renderer||(this._renderer=new o(this._rendererData)),this._renderer},t.exports=n}).call(e,i(1))},function(t,e){"use strict";function i(t){this._maxSize=t||50,this.reset()}i.prototype.measureText=function(t,e){var i,o,n=(e+"").replace(this._re,"0");return this._cache[n]?this._cache[n].width:(this._actualSize===this._maxSize&&(i=this._tick2Labels[this._oldestTick],delete this._tick2Labels[this._oldestTick],delete this._cache[i],this._oldestTick++,this._actualSize--),o=t.measureText(n).width,0===o&&e.length?0:(this._cache[n]={width:o,tick:this._usageTick},this._tick2Labels[this._usageTick]=n,this._actualSize++,this._usageTick++,o))},i.prototype.reset=function(){this._actualSize=0,this._cache={},this._usageTick=1,this._oldestTick=1,this._tick2Labels={}},i.prototype._re=/[2-9]/g,t.exports=i},function(t,e,i){"use strict";function o(t,e){this._data=t,this._colors=this.getBackgroundColor(e)}function n(t,e,i){this._series=t,this._lastBar=e,this._direction=i}i(109);o.prototype.hitTest=function(){return null},o.prototype.getBackgroundColor=function(t){var e=[{background:"rgba(255, 158, 171, 0.3)",line:"#7E202F"},{background:"rgba(244, 255, 158, 0.3)",line:"#EBFF3F"},{background:"rgba(195, 255, 160, 0.3)",line:"#308020"}];return e[t+1]},o.prototype.draw=function(t){t.fillStyle=this._colors.background,t.fillRect(Math.max(0,this._data.x),0,this._data.width,this._data.height),t.strokeStyle=this._colors.line,t.beginPath(),t.lineWidth=1;var e=Math.round(this._data.x);t.moveTo(e,0),t.lineTo(e,this._data.height),t.stroke()},n.prototype.update=function(){this._x=this._series.m_model.timeScale().indexToCoordinate(this._lastBar)-.5*this._series.m_model.timeScale().barSpacing()+1},n.prototype.renderer=function(){var t={x:this._x,height:this._series.priceScale().height(),width:this._series.m_model.timeScale().width()},e=this._series.data().bars(),i=e.last().value[TradingView.CLOSE_PLOT]>e.valueAt(this._lastBar)[TradingView.CLOSE_PLOT]?1:-1,n=0;return 1===this._direction?n=i:2===this._direction&&(n=-1*i),new o(t,n)},e.FutureBarsPaneView=n},function(t,e){"use strict";function i(t,e){this._chartApi=t,this.generateSessionId(),this._sessionDisabled=!1,this._disableStatistics=!!e}i.prototype.destroy=function(){this._sessionDisabled||this.stopSession()},i.prototype.generateSessionId=function(){this._sessionid="cs_"+TradingView.randomHash()},i.prototype.serverTimeOffset=function(){return this._chartApi.serverTimeOffset()},i.prototype.connected=function(){return this._chartApi.connected()&&!this._sessionDisabled},i.prototype.disconnected=function(){var t=this;this.restartSession(),Object.keys(this).forEach(function(e){/^(s|st|symbol_)\d+$/.test(e)&&delete t[e]})},i.prototype.initSession=function(){this._chartApi.createSession(this._sessionid,this)},i.prototype.stopSession=function(){this._chartApi.removeSession(this._sessionid)},i.prototype.restartSession=function(){this.stopSession(),this.generateSessionId(),this.initSession()},i.prototype.setHandler=function(t){this._globalHandler=t},i.prototype.sessionId=function(){return this._sessionid},i.prototype.connect=function(t){this._globalHandler=t,this.initSession(),this._chartApi.connect()},i.prototype.disconnect=function(){this._chartApi.disconnect()},i.prototype.switchTimezone=function(t){this._chartApi.switchTimezone(this._sessionid,t)},i.prototype.resolveSymbol=function(t,e,i){this._chartApi.resolveSymbol(this._sessionid,t,e,i)},i.prototype.createSeries=function(t,e,i,o,n,s){this._chartApi.createSeries(this._sessionid,t,e,i,o,n,s)},i.prototype.removeSeries=function(t,e){this._chartApi.removeSeries(this._sessionid,t,e)},i.prototype.modifySeries=function(t,e,i,o,n){this._chartApi.modifySeries(this._sessionid,t,e,i,o,n)},i.prototype.requestMoreData=function(t,e,i){this._chartApi.requestMoreData(this._sessionid,t,e,i)},i.prototype.requestMetadata=function(t,e){this._chartApi.requestMetadata(this._sessionid,t,e)},i.prototype.createStudy=function(t,e,i,o,n,s){this._chartApi.createStudy(this._sessionid,t,e,i,o,n,s)},i.prototype.removeStudy=function(t,e){this._chartApi.removeStudy(this._sessionid,t,e)},i.prototype.modifyStudy=function(t,e,i,o){this._chartApi.modifyStudy(this._sessionid,t,e,i,o)},i.prototype.createPointset=function(t,e,i,o,n,s){this._chartApi.createPointset(this._sessionid,t,e,i,o,n,s)},i.prototype.modifyPointset=function(t,e,i,o){this._chartApi.modifyPointset(this._sessionid,t,e,i,o)},i.prototype.removePointset=function(t,e){this._chartApi.removePointset(this._sessionid,t,e)},i.prototype.requestMoreTickmarks=function(t,e,i){this._chartApi.requestMoreTickmarks(this._sessionid,t,e,i)},i.prototype.requestFirstBarTime=function(t,e,i){this._chartApi.requestFirstBarTime(this._sessionid,t,e,i)},i.prototype.setVisibleTimeRange=function(t,e,i,o){this._chartApi.setVisibleTimeRange(t,this._sessionid,e,i,o)},i.prototype.onMessage=function(t){switch(t.method){case"connected":this._chartApi.chartCreateSession(this._sessionid,this._disableStatistics);break;case"disconnected":this.disconnected();break;case"critical_error":}this._globalHandler&&this._globalHandler(t)},i.prototype.disable=function(){this._sessionDisabled=!0},t.exports=i},function(t,e){"use strict";function i(t){if(t)return"QUANDL"===t.exchange?"Quandl.com":void 0}t.exports=i},function(t,e,i){"use strict";function o(t,e){this.m_bars=new n(["time","open","high","low","close","adt","style"]),this.m_nsBars=new n(["time","open","high","low","close","adt","style"]),this.m_series=t,this.m_model=e,this.lastProjectionPrice=void 0,this.boxSize=void 0,this.reversalAmount=void 0}var n=i(112);o.prototype.bars=function(){return this.m_bars},o.prototype.nsBars=function(){return this.m_nsBars},o.prototype.size=function(){return this.m_nsBars._end-this.m_nsBars._start+(this.m_bars._end-this.m_bars._start)},o.prototype.each=function(t){var e;for(e=this.m_bars._start;e<this.m_bars._end&&!t(this.m_bars._indexAt(e),this.m_bars._valueAt(e));++e);for(e=this.m_nsBars._start;e<this.m_nsBars._end&&!t(this.m_nsBars._indexAt(e),this.m_nsBars._valueAt(e));++e);},o.prototype.clear=function(){this.m_bars=new n(["time","open","high","low","close","adt","style"]),this.m_nsBars=new n(["time","open","high","low","close","adt","style"]),this.lastProjectionPrice=void 0},o.prototype.first=function(){return this.m_bars.isEmpty()?this.m_nsBars._items[0]:this.m_bars._items[0]},o.prototype.isEmpty=function(){return this.m_bars.isEmpty()&&this.m_nsBars.isEmpty()},o.prototype.last=function(){return this.m_nsBars.isEmpty()?this.m_bars._items[this.m_bars._end-1]:this.m_nsBars._items[this.m_nsBars._end-1]},o.prototype.search=function(t,e){return this.nsBars().isEmpty()?this.bars().search(t,e):this.bars().isEmpty()?this.nsBars().search(t,e):this.nsBars().firstTimeIndex()<=t?this.nsBars().search(t,e):this.bars().search(t,e)},o.prototype.valueAt=function(t){var e=this.search(t);if(e)return e.value},o.prototype.firstBar=function(){var t,e,i;return this.m_model.timeScale().isEmpty()?null:(t=this.m_model.timeScale().visibleBars(),e=t.firstBar(),i=this.search(e,TradingView.SEARCH_NEAREST_RIGHT),i?i.value:null)},o.prototype.firstValue=function(){var t=this.firstBar();return t?t[TradingView.CLOSE_PLOT]:null},o.prototype.calculateATR=function(){var t,e,i,o=[];for(t=this.m_bars.lastIndex();t>=this.m_bars.firstIndex();t--)e=this.m_bars._valueAt(t),o.push(e[TradingView.HIGH_PLOT]-e[TradingView.LOW_PLOT]);return i=0===o.length?0:o.reduce(function(t,e){return t+e},0)/o.length,i*=this.m_series.base()},o.prototype.timeToBarIndex=function(t,e){var i,o;if(null===t)return TradingView.logDebugChart("SeriesData.timeToBarIndex: time should be a number of seconds since 1970. But it is null"),0;if(e===TradingView.SEARCH_FROM_RIGHT){for(i=this.m_bars.lastIndex();i>=this.m_bars.firstIndex();i--)if(o=this.m_bars._valueAt(i),t>=o[TradingView.TIME_PLOT])return i;for(i=this.m_nsBars.lastIndex();i>=this.m_nsBars.firstIndex();i--)if(o=this.m_nsBars._valueAt(i),t>=o[TradingView.TIME_PLOT])return i;return this.m_bars.firstIndex()}if(e===TradingView.SEARCH_FROM_LEFT){for(i=this.m_bars.firstIndex();i<=this.m_bars.lastIndex();i++)if(o=this.m_bars._valueAt(i),t<=o[TradingView.TIME_PLOT])return i;for(i=this.m_nsBars.firstIndex();i<=this.m_nsBars.lastIndex();i++)if(o=this.m_nsBars._valueAt(i),t<=o[TradingView.TIME_PLOT])return i;return this.m_bars.lastIndex()}return TradingView.logDebugChart("SeriesData.timeToBarIndex: Incorrect options value"),0},t.exports=o},function(t,e){"use strict";function i(){this._chunks={}}function o(t){var e,o;for(this._items=[],this._columns=t||[],this._start=0,this._end=0,this._shareread=!1,this._plotCaches={},this._itemsSearchCache={},e=0;e<this._columns.length;e++)o=this._columns[e],this._plotCaches[o]=new i}i.CHUNK_SIZE=30,o.prototype.clear=function(){this._items=[],this._itemsSearchCache={},this._columns=[],this._start=0,this._end=0,this._shareread=!1,this._plotCaches={}},o.prototype.columns=function(){return this._columns},o.prototype.last=function(){return this._items[this._end-this._start-1]},o.prototype.first=function(){return this._items[0]},o.prototype.firstIndex=function(){return this._start},o.prototype.lastIndex=function(){return this._end-this._start-1},o.prototype.size=function(){return this._end-this._start},o.prototype.isEmpty=function(){return 0===this.size()},o.prototype.contains=function(t){return-1!==this._search(t)},o.prototype.valueAt=function(t){var e=this.search(t);if(e)return e.value},o.prototype.add=function(t,e){var i,o;return this._shareread?(TradingView.logDebugChart("PlotList.add: readonly collection modification attempt"),!1):(i=this._createPair(t,e),o=this._search(t),this._itemsSearchCache={},o<0?(o=this._lowerbound(t,-1),this._items.splice(o,0,i),this._start=0,this._end=this._items.length,!0):(this._items[o]=i,!1))},TradingView.SEARCH_NEAREST_LEFT=-1,TradingView.SEARCH_EXACT=0,TradingView.SEARCH_NEAREST_RIGHT=1,o.prototype.search=function(t,e){var i,o;return this._itemsSearchCache[t]&&this._itemsSearchCache[t][e]?this._itemsSearchCache[t][e]:(i=this._search(t,e),i<0?void 0:(o={index:this._indexAt(i),value:this._valueAt(i)},this._itemsSearchCache[t]=this._itemsSearchCache[t]||{},this._itemsSearchCache[t][e]=o,o))},o.prototype.fold=function(t,e){var i,o=e;for(i=this._start;i<this._end;++i)o=t(this._indexAt(i),this._valueAt(i),o);return o},o.prototype.each=function(t){for(var e=this._start;e<this._end&&!t(this._indexAt(e),this._valueAt(e));++e);},o.prototype.reduce=function(t,e){var i,o=e;for(i=this._start;i<this._end;++i)o=t(o,this._indexAt(i),this._valueAt(i));return o},o.prototype.range=function(t,e){var i=new o;return i._items=this._items,i._start=this._lowerbound(t),i._end=Math.min(this._lowerbound(e)+1,i._items.length),i._shareread=!0,i},o.prototype.minMaxOnRange2=function(t,e,o){var n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b=null,w=null;if(0===this._items.length)return{min:b,max:w};for(n=this._items[0],s=0;s<o.length;s++){for(r=o[s],a=t-r.offset,l=e-r.offset,a=Math.max(a,n),l=Math.min(l,n+this._items.length-1),h=Math.ceil(a/i.CHUNK_SIZE)*i.CHUNK_SIZE,c=Math.max(h,Math.floor(l/i.CHUNK_SIZE)*i.CHUNK_SIZE),this._plotCaches[r.index]||(this._plotCaches[r.index]={}),d=this._plotCaches[r.index],p=a;p<=Math.min(l,h)&&p<=e;p++)u=this._items[p-n].value,_=u[r.index],void 0!==_&&null!==_&&((null===b||_<b)&&(b=_),(null==w||_>w)&&(w=_));for(f=Math.max(h+1,a);f<c;f+=i.CHUNK_SIZE)g=Math.floor(f/i.CHUNK_SIZE),m=d[g],m||(v=g*i.CHUNK_SIZE,y=(g+1)*i.CHUNK_SIZE-1,m=this.minMaxOnRange(v,y,[r]),d[g]=m),null!==m.min&&(m.min<b||null===b)&&(b=m.min),null!==m.max&&(m.max>w||null===w)&&(w=m.max);for(p=c;p<=l;p++)u=this._items[p-n].value,_=u[r.index],void 0!==_&&null!==_&&((null===b||_<b)&&(b=_),(null==w||_>w)&&(w=_));void 0!==r.baseValue&&(b=Math.min(r.baseValue,b),w=Math.max(r.baseValue,w))}return{min:b,max:w}},o.prototype.minMaxOnRange=function(t,e,i){var o,n,s,r,a,l,h,c=this._lowerbound(t),d=Math.min(this._lowerbound(e)+1,this._items.length);for(this._items[this._end-1]>e&&(d=c),o=null,n=null,s=0;s<i.length;s++){for(r=i[s],c=this._lowerbound(t-r.offset),d=Math.min(this._lowerbound(e-r.offset)+1,this._items.length),this._items[d-1]>e-r.offset&&(d=c),a=c;a<d;a++)l=this._items[a].value,h=l[r.index],void 0!==h&&null!==h&&((null===o||h<o)&&(o=h),(null==n||h>n)&&(n=h));void 0!==r.baseValue&&(o=Math.min(r.baseValue,o),n=Math.max(r.baseValue,n))}return{min:o,max:n}},o.prototype.merge=function(t){var e,o,n,s,r;if(this._shareread)return TradingView.logDebugChart("PlotList.merge: shared collection modification attempt"),[];for(e=[],e.earliestRow=null,o=0;o<t.length;++o){for(n=t[o],s=Math.floor(n.index/i.CHUNK_SIZE),r=0;r<this._columns.length;r++)this._plotCaches[r]&&delete this._plotCaches[r][s];(null===e.earliestRow||e.earliestRow>n)&&(e.earliestRow=n),this.add(n.index,n.value)?e.push({insert:n}):e.push({update:n})}return e},o.prototype.addTail=function(t,e){var i,o,n=0;for(e&&this._end-this._start>0&&(n=1,this._items[this._end-this._start-1].value=t[0].value),i=n;i<t.length;++i)o=t[i],this.add(parseInt(this.last(),10)+1,o.value);this._itemsSearchCache={}},o.prototype._createPair=function(t,e){var i=new Number(t);return i.value=e,i},o.prototype._valueAt=function(t){return this._items[t].value},o.prototype._length=function(t){return this._items.length},o.prototype._indexAt=function(t){return this._items[t].valueOf()},o.prototype._search=function(t,e){var i=this._bsearch(t);return i===-1&&e?e<0?(i=this._lowerbound(t),i>this._start&&(i-=1),i!==this._end&&this._indexAt(i)<t?i:-1):(i=this._upperbound(t),i!==this._end&&t<this._indexAt(i)?i:-1):i},o.prototype._bsearch=function(t){var e=this._lowerbound(t);return e===this._end||t<this._items[e]?-1:e},o.prototype._lowerbound=function(t){for(var e,i,o=this._start,n=this._end,s=n-o;0<s;)e=s>>1,i=o+e,this._items[i]<t?(o=i+1,s-=e+1):s=e;return o},o.prototype._upperbound=function(t){for(var e,i,o=this._start,n=this._end,s=n-o;0<s;)e=s>>1,i=o+e,t<this._items[i]?s=e:(o=i+1,s-=e+1);return o},o.prototype.state=function(){var t,e={};e.columns=this._columns,e.start=this._start,e.end=this._end,e.shareread=this._shareread,e.data=[];for(t in this._items)e.data.push({index:new Number(this._items[t]),value:this._items[t].value});return e},o.prototype.restoreState=function(t){var e,i;if(!t)return void this.clear();for(this._columns=t.columns,this._start=t.start,this._end=t.end,this._shareread=t.shareread,this._items=[],this._itemsSearchCache={},e=0;e<t.data.length;e++)i=new Number(t.data[e].index),i.value=t.data[e].value,this._items.push(i)},o.prototype.firstTimeIndex=function(){return this._indexAt(this._start)},o.prototype.lastTimeIndex=function(){return this._indexAt(this._end-1)},t.exports=o},function(t,e){"use strict";function i(t){this._invalidationLevel=t||i.UPDATE_CURSOR_ONLY,this._invalidatedPanes={}}i.UPDATE_CURSOR_ONLY=1,i.LIGHT_UPDATE=2,i.FULL_UPDATE=3,i.prototype.invalidatePane=function(t,e){this._invalidatedPanes[t]?this._invalidatedPanes[t]=Math.max(this._invalidatedPanes[t],e):this._invalidatedPanes[t]=e},i.prototype.invalidateAll=function(t){this._invalidationLevel=Math.max(this._invalidationLevel,t)},i.prototype.fullInvalidation=function(){return this._invalidationLevel},i.prototype.invalidateForPane=function(t){return this._invalidatedPanes[t]?Math.max(this._invalidatedPanes[t],this._invalidationLevel):this._invalidationLevel},i.prototype.merge=function(t){this.force=this.force||t.force,this._invalidationLevel=Math.max(this._invalidationLevel,t._invalidationLevel);for(var e in t._invalidatedPanes)this._invalidatedPanes[e]?this._invalidatedPanes[e]=Math.max(this._invalidatedPanes[e],t._invalidatedPanes[e]):this._invalidatedPanes[e]=t._invalidatedPanes[e]},i.prototype.exclude=function(t){this._invalidationLevel<=t&&(this._invalidationLevel=0);for(var e in this._invalidatedPanes)this._invalidatedPanes[e]<=t&&(this._invalidatedPanes[e]=0)},i.prototype.start=function(){this._timeStart=window.performance.now()},i.prototype.end=function(){this._timeEnd=window.performance.now()},t.exports=i},function(t,e,i){(function(t){function e(t){TradingView.merge(this,{palettes:{},inputs:[],plots:[],graphics:{},defaults:{}}),TradingView.merge(this,t);var i=t.fullId||t.id;TradingView.merge(this,e.parseIdString(i)),this.name=this.id}e.CURRENT_METAINFO_FORMAT_VERSION=40,e.FilledArea={},e.FilledArea.TYPE_PLOTS="plot_plot",e.FilledArea.TYPE_HLINES="hline_hline",e.versionOf=function(t){var i="_metainfoVersion"in t&&isNumber(t._metainfoVersion)?t._metainfoVersion:0;return i<0&&TradingView.logError("Metainfo format version cannot be negative: "+i),i>e.CURRENT_METAINFO_FORMAT_VERSION&&TradingView.logWarn("Client doesn't support this version of metainfo format: "+i),i},e.parseIdString=function(t){var e,i,o,n,s={};if(t.indexOf("@")===-1)s.shortId=t,s.packageId="tv-basicstudies",s.id=t+"@"+s.packageId,s.version=1;else if(e=t.split("@"),s.shortId=e[0],i=e[1].split("-"),3===i.length)s.packageId=i.slice(0,2).join("-"),s.id=s.shortId+"@"+s.packageId,s.version=i[2];else if(1===i.length&&"decisionbar"===i[0])s.packageId="les-"+i[0],s.id=s.shortId+"@"+s.packageId,s.version=1;else{if(1!==i.length)throw Error("unexpected study id:"+t);s.packageId="tv-"+i[0],s.id=s.shortId+"@"+s.packageId,s.version=1}return s.fullId=s.id+"-"+s.version,"tv-scripting"===s.packageId?(o=s.shortId,0===o.indexOf("Script$")||0===o.indexOf("StrategyScript$")?(n=o.indexOf("_"),n>=0?s.productId=o.substring(0,n):s.productId=s.packageId):s.productId=s.packageId):s.productId=s.packageId,s},e.getPackageName=function(t){return(/^[^@]+@([^-]+-[^-]+)/.exec(t||"")||[0,"tv-basicstudies"])[1]},e.cutFullId=function(t){return t.replace(/(@[^-]+-[^-]+).*$/,"$1")},e.cutDollarHash=function(t){var e,i,o=t.indexOf("$"),n=t.indexOf("@");return o===-1?t:(e=t.substr(0,o),i=n>=0?t.substr(n):"",e+i)},e.prototype.parseValue=function(t,e){return"bool"===t?TradingView.parseBool(e):e},e.prototype.defaultInputs=function(){var t,e=[];for(t=0;t<this.inputs.length;t++)e.push(this.inputs[t].defval);return e},e.prototype.state=function(){var t,e={};for(t in this)this.hasOwnProperty(t)&&(e[t]=this[t],"id"===t&&(e[t]+="-"+this.version));return e},e.findStudyMetaInfoByDescription=function(t,e){if(t){for(var i=0;i<t.length;++i)if(t[i].description.toLowerCase()===e.toLowerCase())return t[i];throw Error("unexpected study id:"+e)}throw Error("There is no studies metainfo")},e.findStudyMetaInfo=function(t,e){if(t){for(var i=0;i<t.length;++i)if(t[i].id===e)return t[i];throw Error("unexpected study id:"+e)}throw Error("There is no studies metainfo")},e.removeStudyMetaInfo=function(t,e){if(t){for(var i=0;i<t.length;++i)if(t[i].id===e)return t.splice(i,1),defaults.remove("study_"+e),!0;return!1}throw Error("There are no studies metainfo")},e.addStudyMetaInfo=function(t,i){var o,n,s;return 0===i.id.indexOf("ElliottWave@tv-basicstudies-")?null:(o=new e(i),n=e.removeStudyMetaInfo(t,o.id),n&&TradingView.logWarn("Study with id="+o.id+" already exists in the model, this could be a sign of a problem!"),t.push(o),o.defaults&&(s=TradingView.clone(o.defaults),s.precision="default",defaults.create("study_"+o.fullId,s)),o)},e.addOrReplaceStudyMetaInfo=function(t,i){var o,n=new e(i);return e.removeStudyMetaInfo(t,n.id),t.push(n),n.defaults&&(o=TradingView.clone(n.defaults),o.precision="default",defaults.createOrReplace("study_"+n.fullId,o)),n},e.setStudyHidden=function(t,e){if(!t)throw Error("There is no studies metainfo");for(var i=0;i<t.length;++i)if(t[i].id===e)return t[i].is_hidden_study=!0,!0;return!1},e.createMetaInfoStub=function(t,e){var i=TVScript.createScriptStudyId(t.scriptIdPart,e),o={isTVScriptStubToCompile:!0,id:i,scriptIdPart:t.scriptIdPart,description:t.scriptName,TVScriptSourceCode:t.scriptSource,version:e};return t.isTVScriptStrategy===!0&&(o.isTVScriptStrategy=!0),o},e.isScriptStrategy=function(t){if(t.isTVScriptStrategy===!0)return!0;var e=t.TVScriptSourceCode||t.scriptSource;return!!e&&TVScript.isStrategy(e)},e.replaceWithFullStudyMetaInfoAsync=function(t,e){var i=$.Deferred();return e.isTVScriptStubToCompile||i.resolve(e),i.promise()},e.getOrderedInputIds=function(t){var e,i,o=[],n=t.inputs;for(e=0;e<n.length;++e)i=n[e],o.push(i.id);return o},TradingView.StudyMetaInfo=e,void 0!==t&&t&&t.exports&&(t.exports=e)}).call(e,i(2)(t))},function(t,e,i){"use strict";function o(t){return t+"("+new Date(1e3*t).toUTCString()+")"}function n(t){var e,i,o,n;return t+="",e=t.slice(0),i=!1,o=e[e.length-1],"DWM".indexOf(o)===-1&&"S"!==o&&(i=!0,o=""),n=parseInt(i?e:e.length>1?e.slice(0,e.length-1):1),{resolution:o,interval:n}}var s,r=i(116),a=i(33),l=i(41),h=!1,c=null,d=0,p=function(t,e){this._session=new r.Session,this._session.init(t.timezone,t.session),this._symbolInfo=t,this._resolution=e,this._extrapolatedData=[],this._modelId=d++,this._valid=!!t.timezone&&!!t.session,h&&console.log('Created model "{0}", interval "{1}", session "{2}", tz "{3}"'.format(this._modelId,this._resolution,t.session,t.timezone))};p.prototype.uniqueId=function(){return this._modelId},p.prototype.isValid=function(){return this._valid},p.prototype._barBuilder=function(){if(!this._builderCache){var t=n(this._resolution);this._builderCache=r.newBarBuilder(t.resolution,t.interval,this._session,this._session)}return this._builderCache},p.prototype.distance=function(t,e){var i,n,s,a,l;return isNumber(t)&&isNumber(e)&&this.isValid()?(i=this._extrapolatedData.length>0?this._extrapolatedData[0]:null,n=i&&this._extrapolatedData[this._extrapolatedData.length-1],1e3*t!==i&&(this._extrapolatedData=[1e3*t],i=null,n=null),(null===i||1e3*e>n)&&(s=500,a=r.extrapolateBarsFrontToTime(this._barBuilder(),n||1e3*t,1e3*e,s),this._extrapolatedData=this._extrapolatedData.concat(a)),n=this._extrapolatedData[this._extrapolatedData.length-1],n<1e3*e?{success:!1}:(l=this._extrapolatedData.indexOf(1e3*e),l!==-1?(h&&console.log('Model "{0}" "{1}", distance between "{2}" and "{3}" is "{4}"'.format(this._modelId,this._resolution,o(t),o(e),l)),{success:!0,result:l}):{success:!1})):{success:!1}},p.prototype.projectTime=function(t,e){var i,n,s,a;return isNumber(t)&&isNumber(e)&&this.isValid()?(i=this._extrapolatedData.length>0?this._extrapolatedData[0]:null,n=i&&this._extrapolatedData[this._extrapolatedData.length-1],1e3*t!==i&&(this._extrapolatedData=[1e3*t],i=null,n=null),(null===i||e>=this._extrapolatedData.length)&&(s=r.extrapolateBarsFrontByCount(this._barBuilder(),n||1e3*t,e-this._extrapolatedData.length+1),this._extrapolatedData=this._extrapolatedData.concat(s)),e<this._extrapolatedData.length?(a=this._extrapolatedData[e]/1e3,h&&console.log('Model "{0}" "{1}", proj.time from "{2}" offset "{3}" is "{4}"'.format(this._modelId,this._resolution,o(t),e,o(a))),a):t):t},s=function(t,e){this._source=t,this._target=e,this._isSessionTheSame=t._symbolInfo.timezone===e._symbolInfo.timezone&&t._symbolInfo.session===e._symbolInfo.session,this._isResolutionTheSame=t._resolution===e._resolution,this._shouldCorrectTradingDay=l.isDWM(t._resolution)&&!this._isSessionTheSame,this._cache={},null===c&&(c=new r.Session,c.init("UTC","24x7"))},s.prototype._sourceTargetBuilder=function(){var t,e;return this._sourceTargetBuilderCache||(t=n(this._target._resolution),e=this._isSessionTheSame?this._target._session:c,this._sourceTargetBuilderCache=r.newBarBuilder(t.resolution,t.interval,this._target._session,e)),this._sourceTargetBuilderCache},s.prototype.sourceTimeToTargetTime=function(t){var e,i,n,s,r,l;return this._isSessionTheSame&&this._isResolutionTheSame?t:isNumber(t)&&this._source.isValid()&&this._target.isValid()?(e=this._cache[t],e||(i=1e3*t,this._shouldCorrectTradingDay&&(n=a.utc_to_cal(this._source._session.timezone,i),n=this._source._session.spec.correctTradingDay(n,this._source._session.timezone),s=new Date(n),a.set_hms(s,0,0,0,0),i=s.valueOf()),r=this._sourceTargetBuilder(),r.moveTo(i),l=r.indexOfBar(i),e=r.startOfBar(Math.max(0,l))/1e3,this._cache[t]=e),h&&console.log('Model "{0}" "{1}" sourceTime "{2}" => model "{3}" "{4}" targetTime "{5}"'.format(this._source.uniqueId(),this._source._resolution,o(t),this._target.uniqueId(),this._target._resolution,o(e))),e):t},t.exports.SyncPoint=s,t.exports.SyncModel=p},function(t,e,i){(function(e){"use strict";var o=function(){function t(t,e,i,n){return""===t?new h(60*e,i):"S"===t?new h(e,i):new c(i,n,e,o(t,i))}function o(t,e){switch(t){case"D":return new S(e);case"W":return new T(e);case"M":return new C(e)}return console.error("unknown dwm resolution: "+t),null}function n(t,e,i,o,n){var s,r,a,l,h,c,d,p=(new A).init("UTC",t),u=""!==e;return u?(r=i*z[e],s=z.D):(r=60*i*1e3,s=60*p.spec.findSession(0,0)._length*1e3),a=s/r,l=u?7:7-p.spec.weekEndsCount(),h=l*a,o<h?(c=o/a,n-c*z.D):(d=o/h,n-d*z.W)}function s(t,e,i,o){if("number"!=typeof i||"number"!=typeof e||isNaN(i)||isNaN(e))throw Error("Cannot extrapolate from "+e+" to "+i);return a(t,e,function(t,e){return e>i||o&&t.length>o})}function r(t,e,i){return a(t,e,function(t,e){return t.length>=i})}function a(t,e,i){var o,n,s,r,a,l=e;for(t.moveTo(l),o=[],n=0,s=0;!i(o,l);){if(n>5)throw console.trace(["0x10",new Date(e),"->",new Date(l)]),Error("Internal error 0x10 while extrapolating.");if(r=t.indexOfBar(l),r===O)l=t.startOfBar(0);else if(r===B)l=t.startOfBar(B);else{if(a=t.startOfBar(r),a!==e){if(s&&s===a)throw console.trace(["0x11",new Date(e),"->",new Date(a)]),Error("Internal error 0x11 while extrapolating.");s=a,n=0,o.push(a)}l=t.startOfBar(r+1)}t.moveTo(l),n++}return o}function l(t){if(isNaN(t))return NaN;var e=this.indexOfBar(t);return e===B&&(this.moveTo(t),e=this.indexOfBar(t)),e<0?NaN:this.startOfBar(e)}function h(t,e){this.period=t,this.session=e,this.sessionStart=Number.MIN_VALUE,this.sessionEnd=Number.MIN_VALUE}function c(t,e,i,o){this.period=i,this.sessionTgt=t,this.sessionSrc=e||t,this.builder=o,this.periodStart=-Number.MAX_VALUE,this.periodEnd=-Number.MAX_VALUE,this.periodLastBarStart=-Number.MAX_VALUE}function d(t,e,i){var o=6e4,n=new Date(e.valueOf()+t*o),s=i.offset_loc(e)/o,r=i.offset_loc(n)/o,a=s-r,l=t+a;return l}function p(t,e,i){var o=F.clone(i);return e.alignToSessionStart(o,t),F.cal_to_utc(t,o)}function u(t){return t.firstDayOfWeek}function _(t,e){var i=F.get_day_of_week(e)-u(t);return i<0?i+7:i}function f(t,e){var i=e+u(t);return i>F.SATURDAY?i-F.SATURDAY:i}function g(t,e){var i=F.get_day_of_year(e)-1,o=_(t,e)-i%7;return 0===o?x(i/7):(o>=0&&(o-=7),x((o+i)/7))}function m(t,e,i){var o,n=0;for(o=e;o<i;++o)n+=t.isWeekEnd(f(t,o))?1:0;return n}function v(t,e){var i=new Date(Date.UTC(e,11,31,23,59)),o=F.days_per_year(e)-y(t,i);return F.get_day_of_week(i)!==F.SUNDAY&&F.get_day_of_week(i)!==F.SATURDAY||o--,o}function y(t,e){var i,o,n=F.get_day_of_year(e)-1,s=_(t,e),r=s-n%7;return r<0&&(r+=7),i=0,n<7-r?i+=m(t,r,s):(o=0===r?0:m(t,r,7),i+=m(t,0,s)+o),i+g(t,e)*t.weekEndsCount()}function b(){}function w(t){this.sessionsSpec=t}function S(t){this.session=t}function T(t){this.session=t}function C(t){this.session=t}function x(t){return 0|t}function P(t){return t%100+60*x(t/100)}function L(t,e,i){this._dayOfWeek=t,this._start=e,this._length=i}function k(t,e){return t.compareTo(e)}function E(t){function e(t){var e,i,o,s=t.split(";");return s.length>2?(console.error("Only one `first day` specification expected @ session "+t),t):1===s.length?t:(e=1,i=s[0].indexOf("-")>=0,o=i?NaN:parseInt(s[0]),isNaN(o)&&(e=0,o=parseInt(s[1])),o<F.SUNDAY||o>F.SATURDAY?(console.error("Unexpected day index @ session: "+t+"; day index "+o),t):(n.firstDayOfWeek=o,s[e]))}var i,o,n=this;t=t||"0000-0000",this.entries=[],this.firstDayOfWeek=F.MONDAY,"24x7"===t.toLowerCase()?D.forEach(function(t){this.addSessionEntry(t,0,0)},this):(t=e(t),i=!1,o={},t.split("|").forEach(function(t){var e,n,s=t.split(":");1!==s.length&&2!==s.length&&console.error("bad session section: "+t),e=1===s.length,e&&(i&&console.error("duplicated default section: "+t),i=!0),n=e?M:I(s[1]),n.forEach(function(t){e&&o[t]||(o[t]=s[0])},this)},this),D.forEach(function(e){var i=o[e];i&&i.split(",").forEach(function(i){var o,n,s=i.split("-");2!==s.length&&(console.error("bad sessions spec: "+t),s=["0000","0000"]),o=parseInt(s[0]),n=parseInt(s[1]),this.addSessionEntry(e,P(o),P(n))},this)},this)),this.entries.sort(k)}function I(t){var e,i,o=[];for(e=0;e<t.length;e++)i=t.charAt(e)-"0",
-1===o.indexOf(i)&&o.push(i);return o}function A(){}function V(t,e,i){var o,n,s,r,a=t.length;if(0===a)return-1;for(o=0,n=a-1,s=x((o+n)/2);;){if(r=i(t[s],e),0===r||r>0){if(n=s-1,n<o)return s}else if(o=s+1,n<o)return s<a-1?s+1:-1;s=x((o+n)/2)}}function $(t,e){var i=F.utc_to_cal(e.timezone,+t),o=F.get_day_of_week(i),n=F.get_minutes_from_midnight(i),s=e.spec.findSession(o,n);return s.isOvernight()&&n>s._start+s._length&&o===s._dayOfWeek-1&&(o++,n-=1440),o===s._dayOfWeek&&n>=s._start&&n<s._start+s._length}var M,D,O=-1,B=-2,R=-3,N="undefined"!=typeof window?window:e,F=N.PineJsCalendar?N.PineJsCalendar:i(33),z={S:1e3,D:864e5,W:6048e5,M:2592e6};return h.prototype.alignTime=l,h.prototype.indexOfBar=function(t){return t<this.sessionStart?O:t>=this.sessionEnd?B:x(F.time_seconds_diff(t,this.sessionStart)/this.period)},h.prototype.startOfBar=function(t){if(t===B)return this.sessionEnd;if(t<0)throw Error("Negative offset is not supported");return this.sessionStart+F.time_seconds(this.period*t)},h.prototype.isLastBar=function(t,e){var i=this.sessionStart+F.time_seconds(this.period*(t+1)-1);return e>=i},h.prototype.moveTo=function(t){var e=this.session.timezone,i=F.utc_to_cal(e,t),o=this.session.spec,n=o.alignToSessionStart(i,this.session.timezone);this.sessionStart=F.cal_to_utc(e,i),this.sessionEnd=this.sessionStart+F.time_minutes(n)},c.prototype.alignTime=l,c.prototype.tradingDayToSessionStart=function(t){return this.moveTo(t),this.startOfBar(0)},c.prototype.indexOfBar=function(t){return t<this.periodStart?O:t>=this.periodEnd?B:0},c.prototype.startOfBar=function(t){if(t===B||t>0)return this.periodEnd;if(t===O)throw Error("PRE_SESSION is not supported");return this.periodStart},c.prototype.isLastBar=function(t,e){return e>=this.periodLastBarStart},c.prototype.moveTo=function(t){var e,i,o,n,s,r,a,l,h=F.utc_to_cal(this.sessionSrc.timezone,t);h=this.sessionSrc.spec.correctTradingDay(h,this.sessionSrc.timezone),e=this.sessionTgt.timezone,i=this.builder.indexOfPeriod(h,e),o=x(i/this.period)*this.period,n=F.get_year(h),s=this.sessionTgt.spec,r=this.builder.startOfPeriod(e,o,n),this.periodStart=p(e,s,r),a=o+this.period,l=this.builder.startOfPeriod(e,a,n),this.periodEnd=p(e,s,l)},c.prototype.moveToPrevWorkDay=function(t,e){for(;t.isWeekEnd(F.get_day_of_week(e));)F.add_date(e,-1)},b.prototype.indexOfPeriod=function(t){return F.get_day_of_year(t)-1},b.prototype.startOfPeriod=function(t,e,i){var o=F.get_cal(t,i,F.JANUARY,1),n=F.add_days_considering_dst(t,o,e);return F.utc_to_cal(t,+n)},w.prototype.uber=new b,w.prototype.indexOfPeriod=function(t){var e=this.uber.indexOfPeriod(t);return e-y(this.sessionsSpec,t)},w.prototype.startOfPeriod=function(t,e,i){function o(t,e){this.weekEnds=m(t,e,7),this.calendarDays=7-e,this.businessDays=this.calendarDays-this.weekEnds}function n(t,e){var i,o=0;for(i=t;i<7&&(r.sessionsSpec.isWeekEnd(f(r.sessionsSpec,i))||!(--e<0));++i)o++;return o}function s(t,e,i){var o,n,s,a,l,h,c=0,d=i%(7-r.sessionsSpec.weekEndsCount());for(o=0,n=d-(0===t?0:e.businessDays);o<7&&n>0;++o)s=r.sessionsSpec.isWeekEnd(f(r.sessionsSpec,o)),c+=s?1:0,n-=s?0:1;return a=e.weekEnds+c,l=x((i-e.businessDays)/(7-r.sessionsSpec.weekEndsCount())),h=a+r.sessionsSpec.weekEndsCount()*l,i+h}var r,a,l,h,c,d=v(this.sessionsSpec,i);return e>=d&&(i++,e=0),r=this,a=new Date(Date.UTC(i,F.JANUARY,1)),l=_(this.sessionsSpec,a),h=new o(this.sessionsSpec,l),c=e<h.businessDays?n(l,e):s(l,h,e),this.uber.startOfPeriod(t,c,i)},S.prototype.indexOfPeriod=function(t){return this.builder().indexOfPeriod(t)},S.prototype.startOfPeriod=function(t,e,i){return this.builder().startOfPeriod(t,e,i)},S.prototype.builder=function(){return this._builder||(this._builder=this.session.spec.hasWeekEnds()?new w(this.session.spec):new b),this._builder},T.prototype.indexOfPeriod=function(t,e){var i=g(this.session.spec,t);return 0===i&&t<this.startOfPeriod(e,0,F.get_year(t))&&(i=-1),i},T.prototype.startOfPeriod=function(t,e,i){var o,n,s=new Date(Date.UTC(i,F.JANUARY,1)),r=_(this.session.spec,s),a=0===r?7*e:7*(e+1)-r,l=F.get_days_per_year(s);return a>l?this.startOfPeriod(t,0,i+x(a/l)):(o=F.get_cal(t,i,F.JANUARY,1),n=F.add_days_considering_dst(t,o,a),F.utc_to_cal(t,+n))},C.prototype.indexOfPeriod=function(t){return F.get_month(t)},C.prototype.startOfPeriod=function(t,e,i){var o,n,s,r;return e<0?(o=x((-e+11)/12),i-=o,e+=12*o):e>F.DECEMBER&&(i++,e=F.JANUARY),n=F.get_cal_utc(i,e,1),s=_(this.session.spec,n),s>4&&(r=7-s,F.add_date(n,r)),n},L.prototype.start=function(){return this._start<0?this._start+F.minutesPerDay:this._start},L.prototype.isOvernight=function(){return this._start<0},L.prototype.dayOfWeek=function(){return this._dayOfWeek},L.prototype.length=function(){return this._length},L.prototype.weight=function(){return this._dayOfWeek*F.minutesPerDay+this._start},L.prototype.compareTo=function(t){var e=this.weight(),i=e+this._length,o=t.weight();return e<=o&&o<i?0:e>o?1:-1},M=[F.MONDAY,F.TUESDAY,F.WEDNESDAY,F.THURSDAY,F.FRIDAY],D=[F.SUNDAY,F.MONDAY,F.TUESDAY,F.WEDNESDAY,F.THURSDAY,F.FRIDAY,F.SATURDAY],E.prototype.addSessionEntry=function(t,e,i){i<=e&&0!==e&&(e-=F.minutesPerDay);var o=i===e?F.minutesPerDay:i-e;this.entries.push(new L(t,e,o))},E.prototype.isWeekEnd=function(t){var e=V(this.entries,new L(t,0,0),function(t,e){return t.dayOfWeek()-e.dayOfWeek()});return e<0||this.entries[e].dayOfWeek()!==t},E.prototype.hasWeekEnds=function(){return this.weekEndsCount()>0},E.prototype.weekEndsCount=function(){if(void 0===this._weekEndsCount){var t=[];this.entries.forEach(function(e){t[e.dayOfWeek()]=1},this),this._weekEndsCount=7-t.reduce(function(t,e){return t+(e||0)},0)}return this._weekEndsCount},E.prototype.indexOfSession=function(t,e){var i=V(this.entries,new L(t,e,0),k);return-1===i?0:i},E.prototype.findSession=function(t,e){return this.entries[this.indexOfSession(t,e)]},E.prototype.correctTradingDay=function(t,e){var i=F.get_day_of_week(t),o=60*F.get_hours(t)+F.get_minutes(t),n=this.findSession(i,o),s=n.dayOfWeek(),r=(s-i+7)%7;return 0!==r?F.add_days_considering_dst(e,t,r):t},E.prototype.alignToSessionStart=function(t,e){var i,o=F.get_day_of_week(t),n=F.get_minutes_from_midnight(t),s=this.findSession(o,n),r=s.dayOfWeek(),a=s.isOvernight(),l=(r-o+7)%7-(a?1:0);return 0!==l&&F.add_date(t,l),i=s.start(),F.set_hms(t,x(i/60),i%60,0,0),d(s.length(),t,e)},A.prototype.init=function(t,e){return this.timezone="string"==typeof t?F.get_timezone(t):t,this.spec=new E(e),this},{PRE_SESSION:O,POST_SESSION:B,LASTBAR_SESSION:R,newBarBuilder:t,Session:A,alignPeriodsBack:n,extrapolateBarsFrontByCount:r,extrapolateBarsFrontToTime:s,lower_bound:V,isTradingNow:$,numberOfFullWeeks:g,numberOfWeekEndsSinceYearStart:y,BusinessDaysBuilder:w,alignExchangeTimeToSessionStartAndReturnUTC:p}}();t.exports=o}).call(e,function(){return this}())},function(t,e,i){(function(e,o){"use strict";var n=i(123),s=i(238),r=i(124),a=i(74).LineDataSource,l=i(145).StudyLineDataSource,h=i(161),c=i(196),d=i(150),p=d.Study,u=d.prepareStudyPropsStateForLoadChart,_=d.prepareStudyPropertiesForLoadChart,f=d.createStudy,g=i(84),m=i(80).DefaultProperty,v=i(114),y=i(134).LineToolParallelChannel,b=i(168),w=i(202),S=i(139).LineToolElliott,T=i(79).PriceDataSource,C=i(120),x=i(113);n.version=2,n.prototype.state=function(t,e){var i,o,s,r={};for(r.panes=[],i=0;i<this.panes().length;i++)r.panes.push(this.panes()[i].state(!0,t,!1,e));return r.timeScale=this.m_timeScale.state(t),o=null,s=this.properties(),r.chartProperties={paneProperties:s.paneProperties.state(),scalesProperties:s.scalesProperties.state(),publishedChartsTimelineProperties:o?o.state(t):void 0,chartEventsSourceProperties:s.chartEventsSourceProperties.state()},s.chartEventsSourceProperties&&(r.chartProperties.chartEventsSourceProperties=s.chartEventsSourceProperties.state()),r.version=n.version,r.timezone=this.timezone(),r},n.prototype.chartPropertiesTransparencyMigrate=function(t){var e,i,o;t.chartProperties.paneProperties.crossHairProperties&&(o=t.chartProperties.paneProperties.crossHairProperties,TradingView.isHexColor(o.color)&&(i=o.transparency/100,e=TradingView.hexRgbDecomp(o.color),o.color=TradingView.rgbaComp(e,i))),t.chartProperties.paneProperties.dataWindowProperties&&(o=t.chartProperties.paneProperties.dataWindowProperties,TradingView.isHexColor(o.color)&&(i=o.transparency/100,e=TradingView.hexRgbDecomp(o.color),o.color=TradingView.rgbaComp(e,i)))},n.prototype.restoreState=function(t,e){var i,o,n,s,r,l,h,c,d={};if(!t.panes)return void TradingView.logDebugChart("ChartModel.restoreState: invalid state");if(!Array.isArray(t.panes))return void TradingView.logDebugChart("ChartModel.restoreState: invalid state");if(t.panes.length<1)return void TradingView.logDebugChart("ChartModel.restoreState: invalid state");t.chartProperties&&!t.chartProperties.timezone&&(t.chartProperties.timezone=t.timezone),t.chartProperties&&(i=TradingView.factoryDefaults("chartproperties").scalesProperties,TradingView.merge(i,t.chartProperties.scalesProperties),!("showLastValue"in i)||"showSeriesLastValue"in i||"showStudyLastValue"in i||(i.showSeriesLastValueProperty=i.showLastValue,i.showStudyLastValueProperty=i.showLastValue),"showSeriesLastValue"in i&&(d.showSeriesLastValueProperty=!0),"showStudyLastValue"in i&&(d.showStudyLastValueProperty=!0),t.chartProperties.paneProperties.vertGridProperties=t.chartProperties.paneProperties.vertGridProperties||TradingView.clone(t.chartProperties.paneProperties.gridProperties),t.chartProperties.paneProperties.horzGridProperties=t.chartProperties.paneProperties.horzGridProperties||TradingView.clone(t.chartProperties.paneProperties.gridProperties),this._properties.paneProperties.merge(t.chartProperties.paneProperties),this._properties.scalesProperties.merge(i),t.chartProperties.timezone&&this._properties.timezone.setValue(t.chartProperties.timezone),t.chartProperties.chartEventsSourceProperties&&this._properties.chartEventsSourceProperties&&this._properties.chartEventsSourceProperties.merge(t.chartProperties.chartEventsSourceProperties),this.m_timeScale.restoreState(t.timeScale,e)),t.timeScale&&this.m_timeScale.restoreState(t.timeScale,e),o=t.panes,this.panes()[0].restoreState(o[0],e,t.version,d);for(n=1;n<t.panes.length;n++)s=this.panes()[n]||this.createPane(),s.restoreState(t.panes[n],e,t.version,d);for(this._invalidateBarColorerCaches(),r=this.dataSources(),l=0,n=0;n<r.length;n++)h=r[n],TradingView.isInherited(h.constructor,a)&&(l++,h.calcIsActualSymbol());return this._version=t.version,this.timeScale().recalcLockedScale(),this.recalculateAllPanes(),this.invalidate(new x(x.FULL_UPDATE)),window.saver&&window.is_authenticated&&this.isJustClonedChart()&&this.mainSeries().onSymbolResolved().subscribe(this,function(){window.saver.saveChartSilently()},!0),c=TVLocalStorage.getItem("linetools_limit")||1e3,window.is_authenticated&&window.user&&window.user.settings&&(c=window.user.settings.linetools_limit||c),l>c?{lines_limit_exceeded:!0,line_tools_count:l}:{}},n.prototype.restoreAxisState=function(t){var e,i;if(!t.panes)return void TradingView.logDebugChart("ChartModel.restoreAxisState: invalid state");if(!Array.isArray(t.panes))return void TradingView.logDebugChart("ChartModel.restoreAxisState: invalid state");if(t.panes.length<1)return void TradingView.logDebugChart("ChartModel.restoreAxisState: invalid state");for(this.m_timeScale.restoreState(t.timeScale,!1,!0),e=0;e<t.panes.length;e++)i=this.panes()[e],i.m_leftPriceScale.restoreState(t.panes[e].leftAxisState),i.m_rightPriceScale.restoreState(t.panes[e].rightAxisState);this.recalculateAllPanes(),this.invalidate(new x(x.FULL_UPDATE))},C.prototype.state=function(t,e,i,o){function n(t){return i&&!t.isSavedInStudyTemplates()||!t.state||!t.state()||!t.isSavedInChart(e)||o&&t.isActualSymbol&&!t.isActualSymbol()}var s,r,a={};if(t)for(a.sources=[],s=0;s<this.m_dataSources.length;s++)n(this.m_dataSources[s])||a.sources.push(this.m_dataSources[s].state(e));for(a.leftAxisState=this.m_leftPriceScale.state(),a.leftAxisSources=[],s=0;s<this.m_leftPriceScale.dataSources().length;s++)n(this.m_leftPriceScale.dataSources()[s])||a.leftAxisSources.push(this.m_leftPriceScale.dataSources()[s].id());for(a.rightAxisState=this.m_rightPriceScale.state(),a.rightAxisSources=[],s=0;s<this.m_rightPriceScale.dataSources().length;s++)n(this.m_rightPriceScale.dataSources()[s])||a.rightAxisSources.push(this.m_rightPriceScale.dataSources()[s].id());for(a.overlayPriceScales={},s=0;s<this.m_dataSources.length;s++)r=this.m_dataSources[s],this.isOverlay(r)&&r.isSavedInChart(e)&&(a.overlayPriceScales[r.id()]=r.priceScale().state());return a.stretchFactor=this._stretchFactor,this.m_mainDataSource&&(a.mainSourceId=this.m_mainDataSource.id()),a},C.prototype.sourceById=function(t){for(var e=0;e<this.m_dataSources.length;e++)if(this.m_dataSources[e].id()===t)return this.m_dataSources[e];return null},C.prototype.isESDStudy=function(t){return"Script$TV_EARNINGS@tv-scripting"===t.id||"Script$TV_DIVIDENDS@tv-scripting"===t.id||"Script$TV_SPLITS@tv-scripting"===t.id||"ESD$TV_EARNINGS@tv-scripting"===t.id||"ESD$TV_DIVIDENDS@tv-scripting"===t.id||"ESD$TV_SPLITS@tv-scripting"===t.id},C.prototype.restoreState=function(t,i,o,n){var s,r,l,h,c,d,u,_,f,m,v,y;if(n=n||{},!t.leftAxisState||!t.rightAxisState)throw Error("invalid state");if(!t.leftAxisSources||!t.rightAxisSources)throw Error("invalid state");if(t.stretchFactor&&(this._stretchFactor=t.stretchFactor),s={},t.sources)for(r=this.m_dataSources.indexOf(this._model.mainSeries())!==-1,this.clearSeries(),this.m_mainDataSource=null,r&&this.m_dataSources.push(this._model.mainSeries()),l=0;l<t.sources.length;l++)h=t.sources[l],Math.abs(h.zorder)>1e200&&(c=-1,TradingView.logWarn("Datasource zorder has bad value: "+h.zorder+" Resetting it to "+c),h.zorder=c),d=h.id,s[d]=h.ownerSource,u=h.type,u&&("MainSeries"===u?this._restoreMainSeries(h,i,r,n):u.toLowerCase().startsWith("study")?this._restoreStudy(h,i,n):TradingView.isInherited(TradingView[u],a)?this._restoreLineTool(h,i):TradingView[u]&&TradingView[u].createFromState&&this._restoreSpecialSource(h,i));for(this.m_leftPriceScale.dataSources().splice(0,1/0),this.m_leftPriceScale._hasSeries=!1,_=defaults("chartproperties").paneProperties.leftAxisProperties,TradingView.merge(_,t.leftAxisState),this.m_leftPriceScale.restoreState(_),l=0;l<t.leftAxisSources.length;l++)f=this.dataSourceForId(t.leftAxisSources[l]),f&&(void 0!==_.m_showSymbolLabels&&f instanceof g&&this.model().properties().scalesProperties.showSymbolLabels.setValue(_.m_showSymbolLabels),f.setPriceScale(this.m_leftPriceScale),this.m_leftPriceScale.addDataSource(f));for(this.m_rightPriceScale.dataSources().splice(0,1/0),this.m_rightPriceScale._hasSeries=!1,_=defaults("chartproperties").paneProperties.rightAxisProperties,TradingView.merge(_,t.rightAxisState),this.m_rightPriceScale.restoreState(_),l=0;l<t.rightAxisSources.length;l++)f=this.dataSourceForId(t.rightAxisSources[l]),f&&(void 0!==_.m_showSymbolLabels&&f instanceof g&&this.model().properties().scalesProperties.showSymbolLabels.setValue(_.m_showSymbolLabels),f.setPriceScale(this.m_rightPriceScale),this.m_rightPriceScale.addDataSource(f));for(l=0;l<this.m_dataSources.length;l++)f=this.m_dataSources[l],this.m_rightPriceScale.dataSources().indexOf(f)===-1&&this.m_leftPriceScale.dataSources().indexOf(f)===-1?(f._isOverlay=!0,m=new e(this._properties.overlayPropreties,this._model.properties().scalesProperties),m.setHeight(this.m_height),m.setTopMargin(this.m_rightPriceScale.topMargin()),m.setBottomMargin(this.m_rightPriceScale.bottomMargin()),m.addDataSource(f),t.overlayPriceScales&&t.overlayPriceScales[f.id()]&&(_=t.overlayPriceScales[f.id()],_.m_isAutoScale=!0,_.m_isLog=!1,_.m_isPercentage=!1,m.restoreState(_)),f.setPriceScale(m)):f._isOverlay=!1;for(d in s)v=s[d],v&&(f=this.sourceById(d),f&&this.sourceById(d).setOwnerSource(this.sourceById(v)));if(t.mainSourceId&&!this.m_mainDataSource&&(this.m_mainDataSource=this.dataSourceForId(t.mainSourceId)),!this.m_mainDataSource)for(l=0;l<this.m_dataSources.length;l++)if(f=this.m_dataSources[l],TradingView.isInherited(f.constructor,T)){this.m_mainDataSource=f;break}for(l=0;l<this.m_dataSources.length;l++)f=this.m_dataSources[l],TradingView.isInherited(f.constructor,a)?(f.ownerSource()||f.setOwnerSource(this.mainDataSource()),f.isFixed()&&f.restoreFixedPoints(),1===o&&f.priceScale().isPercent()&&!f.isFixed()&&f.correctPricesToPercents(),f.fixAfterRestorePriceAxis&&f.fixAfterRestorePriceAxis()):TradingView.isInherited(f.constructor,p)&&(y=f.properties(),y.linkedToSeries&&y.linkedToSeries.value()&&(f.ownerSource()||f.setOwnerSource(this.model().mainSeries())));this._updateMargins(),this._cachedOrderedSoruces=null,this._cachedHitTestSources=null},C.prototype._restoreMainSeries=function(t,e,i,o){var n,s,r,a,l=t.id,h=t.state,c=t.zorder;h&&["candleStyle","hollowCandleStyle","haStyle"].forEach(function(t){h[t]&&(h[t].wickUpColor=h[t].wickUpColor||h[t].wickColor,h[t].wickDownColor=h[t].wickDownColor||h[t].wickColor)}),i||(n=this._model.paneForSource(this._model.mainSeries()),n.removeDataSource(this._model.mainSeries()),this.m_dataSources.push(this._model.mainSeries())),this.m_mainDataSource=this._model.mainSeries(),s=h&&h.style?h.style:void 0,r=s===g.STYLE_PNF&&h.pnfStyle.lockScale,h&&!h.lockScale&&(h.lockScale=r),s===g.STYLE_PNF&&"ATR"===this._model.mainSeries().properties().pnfStyle.inputs.style.value()?this._model.mainSeries().properties().pnfStyle.inputs.style._value="Traditional":s===g.STYLE_RENKO&&"ATR"===this._model.mainSeries().properties().renkoStyle.inputs.style.value()&&(this._model.mainSeries().properties().renkoStyle.inputs.style._value="Traditional"),h&&!h.hasOwnProperty("showSessions")&&(h.showSessions=!1),h&&!h.extendedHours&&(h.extendedHours=!1),h&&e&&(h.showCountdown=!1),h&&(e&&!("showSeriesLastValueProperty"in o)&&"showLastValue"in h&&this._model.properties().scalesProperties.showSeriesLastValue.setValue(h.showLastValue),delete h.showLastValue),this._model.mainSeries().properties().merge(h),this._model.mainSeries()._prevChartStyle=this._model.mainSeries().properties().style.value(),this._model.mainSeries().createPaneView(),this._model.mainSeries().setId(l),e&&this._model.mainSeries().restoreData(t.bars,t.nsBars,t.symbolInfo,t.rtPrice,t.boxSize,t.reversalAmount),void 0!==c&&this._model.mainSeries().setZorder(c),this._model.mainSeries().properties().extendedHours.listeners().fire(this._model.mainSeries().properties().extendedHours),a=this._model.mainSeries().symbolInfo(),a&&this._model.mainSeries().onSymbolResolved().fire(this._model.mainSeries().symbolInfo())},C.prototype._restoreStudy=function(t,e,i){var o,n,r,a,l,h,c,d;return e&&void 0===t.data&&void 0===t.nonSeriesData&&void 0===t.indexes?void TradingView.logError("Cannot restore (skipping) study without data "+t.id+", "+t.metaInfo.id):(o=t.id,n=t.state,r=t.zorder,a=TradingView.clone(t.metaInfo),$.extend(a,v.parseIdString(a.id)),this.isESDStudy(a)&&!e||!TradingView.isFeatureEnabled("backtesting")&&a.isTVScriptStrategy&&!e?void 0:(l=n,h=this._model.studyVersioning(),c=h.patchPropsStateAndMetaInfo(l,a,{oldShowStudyLastValueProperty:e&&!i.showStudyLastValueProperty}),l=c.propsState,a=c.metaInfo,d=new s(this._model,t,a.shortDescription),d.setId(o),h.updateMetaInfoAsync(a,e).done(function(i){var n,s,r,c;d.setStatus(""),n=i||a,s=_(a,i,l,null,h),r=f(this._model,s,this._model.mainSeries(),n),r.setId(o),e&&(c=h.patchStudyData(a,t.data,t.nonSeriesData,t.indexes),r.restoreData(c.data,c.nsData,c.indexes)),this._model.replaceStudyStub(d,r)||(d=r)}.bind(this)).fail(function(t){TradingView.logError(t),d.setStatus("error: "+t)}),this.m_dataSources.push(d),delete this._cachedOrderedSoruces,delete this._cachedHitTestSources,void 0!==r&&d.setZorder(r),d))},C.prototype._restoreLineTool=function(t,e,i){var n,d,p,_,f,g,T,C,x,P,L,k,E,I,A,V,M,D,O,B,R,N,F;for(i=void 0===i||i,S.migrateState(t),n=t.type,d=t.id,p=t.state,_=i?t.zorder:this._newZOrderForLineTool(),f=TradingView[n],assert(TradingView.isInherited(f,a),"invalid data source type:"+n+" (expected to be a Line Tool)"),g=t.points,T=!1,C=0;C<g.length;C++)if(Math.abs(g[C].offset)>1e4){T=!0;break}if(!T){if(x=null,P=TradingView.factoryDefaults("linetool"),TradingView.isInherited(f,l)){if(x=this._model.studyVersioning(),t=x.patchPointsBasedStudyState(t),TradingView.merge(P,p),E=t.metaInfo,$.extend(E,v.parseIdString(E.fullId)),!e&&(I=E.productId,!pro.hasPackage(I)))return A=new s(this._model,t,E.shortDescription),A.setId(d),this.m_dataSources.push(A),void 0!==_&&A.setZorder(_),A.setStatus($.t("not authorized")),void A.setFailed(!0);V=x.updateMetaInfo(E),M=V||E,P=u(M,E,P,null,x),e?TradingView.merge(P,{fixedSize:!1}):TradingView.merge(P,{fixedSize:!0}),k=new m("study_"+M.id,P,!0),L=r.create(n,this._model,k,M,this.mainDataSource())}else D=n.toLowerCase(),TradingView.merge(P,TradingView.factoryDefaults(D)),k=TradingView[n].prototype.createPropertiesObject(D,P),k.merge(p),e?k.merge({fixedSize:!1}):k.merge({fixedSize:!0}),L=new TradingView[n](this._model,k,!0);return L.setId(d),L.linkKey=t.linkKey,O=t.alertId,O&&"function"==typeof L.setAlert&&o.enabled("alerts")&&!this._model.readOnly()&&!this._model.isJustClonedChart()&&L.setAlert(O,{noChartSave:!0}),B=t.indexes?t.indexes:[],B=B.slice(0,t.points.length),L.isFixed()?L.restorePositionPercents(t.positionPercents):L.restorePoints(t.points,B,e),L instanceof h||L instanceof c||L instanceof b||L instanceof w||L instanceof y?L.restoreData(t):e&&L.restoreData&&(R=t,x&&(R.graphics=x.patchPointsBasedStudyData(R.metaInfo,R.graphics)),L.restoreData(R)),N=null==t.version?1:t.version,F=null==L.version?1:L.version,N!==F&&"function"==typeof L.migrateVersion&&L.migrateVersion(N,F,{pane:this,model:this._model,properties:k}),this.m_dataSources.push(L),delete this._cachedOrderedSoruces,delete this._cachedHitTestSources,void 0!==_&&L.setZorder(_),L}},C.prototype._restoreSpecialSource=function(t,e){var i,o=TradingView[t.type];o&&o.createFromState&&(i=o.createFromState(t,e,this._model),i&&(i.setId(t.id),this.m_dataSources.push(i),i.zorder&&i.setZorder(i.zorder)))},n.prototype.studyTemplate=function(t){var e,i,o,s,r={};for(r.panes=[],e=0;e<this.panes().length;e++)i=!0,o=!1,s=!0,r.panes.push(this.panes()[e].state(i,o,s));return t&&(r.interval=this.mainSeries().interval()),r.version=n.version,r},n.prototype.restoreStudyTemplate=function(t,e){this._undoModel.studyLoadTemplate(this._undoModel,this.studyTemplate(),t,e)},n.prototype.theme=function(){var t={};return t.chartProperties={paneProperties:this.properties().paneProperties.state(),scalesProperties:this.properties().scalesProperties.state(),symbolWatermarkProperties:this.properties().symbolWatermarkProperties.state()},t.mainSourceProperties=this.mainSeries().state().state,delete t.mainSourceProperties.symbol,delete t.mainSourceProperties.interval,delete t.chartProperties.paneProperties.topMargin,delete t.chartProperties.paneProperties.bottomMargin,t.version=n.version,t},n.prototype.restoreTheme=function(t){var e,i,o={hollowCandle:{related:"candle"}};for(e in o)t.mainSourceProperties[e+"Style"]||(i=t.mainSourceProperties[o[e].related+"Style"],t.mainSourceProperties[e+"Style"]=TradingView.clone(i));this._undoModel.chartLoadTheme(this,t)},t.exports=n}).call(e,i(118),i(1))},function(t,e,i){(function(e,o,n){"use strict";function s(t,i){if(this.m_base=t,this.m_integralDividers=i,this.m_fractionalDividers=[],e.isBaseDecimal(this.m_base))this.m_fractionalDividers=[2,2.5,2];else for(var o=this.m_base;1!==o;){if(o%2===0)this.m_fractionalDividers.push(2),o/=2;else{if(o%5!==0)throw new RangeError("unexpected base");this.m_fractionalDividers.push(2),this.m_fractionalDividers.push(2.5),o/=5}if(this.m_fractionalDividers.length>100)throw Error("something wrong with base")}}function r(t,e,i){this.m_marks=[],this.m_base=e,this.m_priceScale=t,this._formatter=i,i&&(this._cache=new h(function(t){return i.format(t)})),this._currentFormatBase=0}function a(t){for(var e=1;t*e!==Math.round(t*e);)e*=10;return e}function l(t,e){function i(){var t,e,i=s.m_dataSources;for(t=0;t<i.length;t++)e=i[t],e.priceScaleChanged&&e.priceScaleChanged.fire(s)}this._properties=t,this._scalesProperties=e,this.m_height=0,this.m_priceRange=null,this.m_dataSources=[],this.m_topMargin=0,this.m_bottomMargin=0,this._studyTopMargin=0,this._studyBottomMargin=0,this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_priceRangeSnapshot=null,this._invalidatedForRange={isValid:!0},this.onMarksChanged=new o,this.m_markBuilder=new r(this,100,new _(100)),this._properties.percentage.listeners().subscribe(this,l.prototype.updateFormatter);var s=this;this._properties.log.listeners().subscribe(null,function(t){if(s.m_priceRange){var e=s.m_priceRange;t.value()?s.m_priceRange=new n(s._toLog(e.minValue()),s._toLog(e.maxValue())):s.m_priceRange=new n(s._fromLog(e.minValue()),s._fromLog(e.maxValue()))}}),this._properties.percentage.listeners().subscribe(null,function(){s._properties.autoScale.setValue(!0)}),this._properties.percentage.listeners().subscribe(null,function(){var t,e,i;s._properties.autoScaleDisabled.setValue(s._properties.percentage.value()),t=s.priceRange(),!s.mainSource()||s.mainSource().model().timeScale().isEmpty()||s.mainSource().data().isEmpty()||s.mainSource()instanceof p&&!s.mainSource().properties().lockScale.value()||!t||(e=s.mainSource().model().timeScale().visibleBars(),i=s.mainSource().data().search(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT).value[TradingView.CLOSE_PLOT],null!=t&&void 0!==i&&(s._properties.percentage.value()?s.setPriceRange(t.convertToPercents(i)):s.setPriceRange(t.convertFromPercents(i))))}),this._sourcesForAutoscale=null,this._sourcesToUpdateViews=null,this._hasSeries=!1,this._properties.percentage.listeners().subscribe(null,i),this._properties.log.listeners().subscribe(null,i),this._properties.listeners().subscribe(null,function(){s.mainSource()&&s.mainSource().model()&&s.mainSource().model().fullUpdate()})}var h=i(119),c=i(74).LineDataSource,d=i(79).PriceDataSource,p=i(84),u=i(82),_=u.PriceFormatter,f=u.PercentageFormatter;s.prototype.TICK_SPAN_EPSILON=1e-9,s.prototype.tickSpan=function(t,i,o){var n,s=0===this.m_base?0:1/this.m_base,r=this.TICK_SPAN_EPSILON,a=Math.pow(10,Math.max(0,Math.ceil(e.log10(t-i)))),l=0;for(l=0,n=this.m_integralDividers[0];a>s+r&&e.greaterOrEqual(a,s,r)&&e.greaterOrEqual(a,o*n,r)&&e.greaterOrEqual(a,1,r);++l,n=this.m_integralDividers[l%this.m_integralDividers.length])a/=n;if(a<=s+r&&(a=s),a=Math.max(1,a),this.m_fractionalDividers.length>0&&e.equal(a,1,r))for(l=0,n=this.m_fractionalDividers[0];a>s+r&&e.greaterOrEqual(a,o*n,r);++l,n=this.m_fractionalDividers[l%this.m_fractionalDividers.length])a/=n;return a},r.prototype.TICK_DENSITY=2.5,r.prototype.base=function(){return this.m_base},r.prototype.setBase=function(t){if(t<0)throw new RangeError("base < 0");this.m_base=t},r.prototype.fontHeight=function(){return this.m_priceScale.fontSize()},r.prototype.tickSpan=function(t,i){var o,n,r,a,l,h,c,d;if(t<i)throw new RangeError("high < low");return o=this.m_priceScale.height(),n=this.tickMarkHeight(),r=(t-i)*n/o,a=new s(this.m_base,[2,2.5,2]),l=new s(this.m_base,[2,2,2.5]),h=new s(this.m_base,[2.5,2,2]),c=[],c.push(a.tickSpan(t,i,r)),c.push(l.tickSpan(t,i,r)),c.push(h.tickSpan(t,i,r)),d=e.min(c)},r.prototype.tickMarkHeight=function(){return Math.ceil(this.fontHeight()*this.TICK_DENSITY)},r.prototype.rebuildTickMarks=function(){var t,e,i,o,n,s,r,l,c,d,p,u,f;if(null===this.m_priceScale)throw new TypeError("scale is null");if(this.m_priceScale.isEmpty())return void(this.m_marks=[]);if(t=this.m_priceScale.height(),e=this.m_priceScale.coordinateToPrice(t-1),i=this.m_priceScale.coordinateToPrice(0),o=i>=e?1:-1,n=Math.max(i,e),s=Math.min(i,e),i=n,e=s,i!==e)for(r=this.tickSpan(i,e),l=i%r,l+=l<0?r:0,this.m_marks=[],this._formatter||(c=a(r),this._cache&&this._currentFormatBase===c||(d=new _(c),this._cache=new h(function(t){return d.format(t)}))),p=null,u=i-l;u>e;u-=r)f=this.m_priceScale.priceToCoordinate(u),null!==p&&Math.abs(f-p)<this.tickMarkHeight()||(this.m_marks.push({coord:f,label:this._cache.format(u)}),p=f,this.m_priceScale.isLog()&&(r=this.tickSpan(u*o,e)))},r.prototype.marks=function(){return this.m_marks},l.prototype.isLog=function(){return this._properties.log.value()},l.prototype.isPercent=function(){return this._properties.percentage.value()},l.prototype.properties=function(){return this._properties},l.prototype.fontSize=function(){return this._scalesProperties.fontSize.value()},l.prototype.height=function(){return this.m_height},l.prototype.setHeight=function(t){var e=this.m_height;this.m_height=t,this._internalHeightCache=void 0,this._marksCache=null,e!==t&&this.mainSource()instanceof p&&this.mainSource().isLockScale()&&this.mainSource().model().timeScale().recalcLockedScale()},l.prototype.topMargin=function(){return Math.max(this.m_topMargin,this._studyTopMargin)},l.prototype.setTopMargin=function(t){if(!isNumber(t))throw new TypeError("invalid margin");if(t<0||t>30)throw new RangeError("invalid margin");this.m_topMargin=t,this._internalHeightCache=void 0,this._marksCache=null},l.prototype.bottomMargin=function(){return Math.max(this.m_bottomMargin,this._studyBottomMargin)},l.prototype.setBottomMargin=function(t){if(!isNumber(t))throw new TypeError("invalid margin");if(t<0||t>30)throw new RangeError("invalid margin");this.m_bottomMargin=t,this._internalHeightCache=void 0,this._marksCache=null},l.prototype.internalHeight=function(){if(this._internalHeightCache)return this._internalHeightCache;var t=this.height()*(1-this.topMargin()-this.bottomMargin());return this._internalHeightCache=t,t},l.prototype.priceRange=function(){return this.makeSureItIsValid(),this.m_priceRange},l.prototype.setPriceRange=function(t){if(!t instanceof n)throw new TypeError("incorrect price range");this.m_priceRange&&this.m_priceRange.equals(t)||(this.m_priceRange=t,this._marksCache=null)},l.prototype.isEmpty=function(){return this.makeSureItIsValid(),0===this.m_height||!this.m_priceRange||this.m_priceRange.isEmpty()},l.prototype.invertedCoordinate=function(t){return this.height()-1-t},l._logicalOffset=4,l._coordOffset=1e-4,l.prototype.log10=function(t){return Math.log(t)/Math.log(10)},l.prototype._toLog=function(t){var e,i=Math.abs(t);return i<1e-6?0:(e=this.log10(i+l._coordOffset)+l._logicalOffset,t<0?-e:e)},l.prototype.priceToLogical=function(t){return this.isLog()&&t?this._toLog(t):t},l.prototype._fromLog=function(t){var e,i=Math.abs(t);return i<1e-6?0:(e=Math.pow(10,i-l._logicalOffset)-l._coordOffset,t<0?-e:e)},l.prototype.logicalToPrice=function(t){return this.isLog()?this._fromLog(t):t},l.prototype.priceToCoordinate=function(t,e){var i,o;return this.makeSureItIsValid(),this.isEmpty()?0:(t=this.priceToLogical(t),i=this.bottomMargin()*this.height()+(this.internalHeight()-1)*(t-this.priceRange().minValue())/(this.priceRange().maxValue()-this.priceRange().minValue()),o=this.invertedCoordinate(i),e?o:Math.round(o))},l.prototype.pricesToCoordinates=function(t){this.pricesToCoordinatesEx(t,function(t){return t.y},function(t,e){t.y=e})},l.prototype.pricesToCoordinatesEx=function(t,e,i){var o,n,s,r,a,l,h,c,d;if(this.makeSureItIsValid(),o=this.bottomMargin()*this.height(),n=this.priceRange().minValue(),s=this.priceRange().maxValue(),r=this.internalHeight()-1,a=r/(s-n),this.isLog())for(l=0;l<t.length;l++)h=e(t[l]),i(t[l],this.priceToLogical(h));for(l=0;l<t.length;l++)h=e(t[l]),TradingView.isNaN(h)||void 0===h||null===h||(c=o+a*(h-n),d=this.m_height-1-c,i(t[l],Math.round(d)))},l.prototype.pointsArrayToCoordinates=function(t){var e,i,o,n,s,r,a,l,h;if(this.makeSureItIsValid(),e=this.bottomMargin()*this.height(),i=this.priceRange().minValue(),o=this.priceRange().maxValue(),n=this.internalHeight()-1,s=n/(o-i),this.isLog())for(r=0;r<t.length;r++)t[r].y=this.priceToLogical(t[r].y);for(r=0;r<t.length;r++)a=t[r].y,TradingView.isNaN(a)||void 0===a||null===a||(l=e+s*(a-i),h=this.m_height-1-l,t[r].y=Math.round(h))},l.prototype.pricesArrayToCoordinates=function(t){var e,i,o,n,s,r,a,l,h;if(this.makeSureItIsValid(),e=this.bottomMargin()*this.height(),i=this.priceRange().minValue(),
o=this.priceRange().maxValue(),n=this.internalHeight()-1,s=n/(o-i),this.isLog())for(r=0;r<t.length;r++)t[r]=this.priceToLogical(t[r]);for(r=0;r<t.length;r++)a=t[r],void 0!==a&&null!==a&&(l=e+s*(a-i),h=this.m_height-1-l,t[r]=Math.round(h))},l.prototype.barPricesToCoordinates=function(t){var e,i,o,n,s,r,a,l,h,c,d;if(this.makeSureItIsValid(),e=t,i=this.bottomMargin()*this.height(),o=this.priceRange().minValue(),n=this.priceRange().maxValue(),s=this.internalHeight()-1,r=s/(n-o),this.isLog())for(a=0;a<e.length;a++)e[a]&&(e[a].open=this.priceToLogical(e[a].open),e[a].high=this.priceToLogical(e[a].high),e[a].low=this.priceToLogical(e[a].low),e[a].close=this.priceToLogical(e[a].close),e[a].additionalPrice&&(e[a].additionalPrice=this.priceToLogical(e[a].additionalPrice)));for(a=0;a<e.length;a++)l=e[a],l&&(h=l.open,c=i+r*(h-o),d=this.m_height-1-c,l.open=Math.round(d),h=l.high,c=i+r*(h-o),d=this.m_height-1-c,l.high=Math.round(d),h=l.low,c=i+r*(h-o),d=this.m_height-1-c,l.low=Math.round(d),h=l.close,c=i+r*(h-o),d=this.m_height-1-c,l.close=Math.round(d),l.additionalPrice&&(h=l.additionalPrice,c=i+r*(h-o),d=this.m_height-1-c,l.additionalPrice=Math.round(d)))},l.prototype.coordinateToPrice=function(t){var e,i;return this.makeSureItIsValid(),this.isEmpty()?0:(e=this.invertedCoordinate(t),i=this.priceRange().minValue()+(this.priceRange().maxValue()-this.priceRange().minValue())*((e-this.bottomMargin()*this.height())/(this.internalHeight()-1)),this.logicalToPrice(i))},l.prototype.isAutoScale=function(){return this._properties.autoScale.value()&&!(this.mainSource()instanceof p&&this.mainSource().isLockScale())},l.prototype.isPercentage=function(){return this._properties.percentage.value()},l.prototype.dataSources=function(){return this.m_dataSources},l.prototype.orderedSources=function(){var t,e,o,n;if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;for(t=[],e=0;e<this.m_dataSources.length;e++)o=this.m_dataSources[e],null==o.zorder()&&o.setZorder(e+1),t.push(o);return n=i(120),t=n.sortSources(t),this._cachedOrderedSoruces=t,this._cachedOrderedSoruces},l.prototype.invalidateSourcesCache=function(){this._cachedOrderedSoruces=null},l.prototype.hasSeries=function(){return this._hasSeries},l.prototype.addDataSource=function(t){if(this.m_dataSources.indexOf(t)===-1){TradingView.isInherited(t.constructor,p)&&(this._hasSeries=!0);var e=this;t.properties().visible.listeners().subscribe(null,function(){e._sourcesForAutoscale=null}),this.m_dataSources.push(t),this._mainSource=void 0,this._sourcesForAutoscale=null,this._sourcesToUpdateViews=null,this.updateFormatter(),this.initScaleProperties(),this.invalidateSourcesCache()}},l.prototype.initScaleProperties=function(){var t=this.mainSource()instanceof p&&this.mainSource().properties().lockScale.value();t&&(this.properties().percentage.setValue(!1),this.properties().log.setValue(!1),this.properties().autoScale.setValue(!1)),this.properties().percentageDisabled.setValue(t),this.properties().logDisabled.setValue(t),this.properties().autoScaleDisabled.setValue(this.properties().percentage.value()),this.properties().percentage.value()&&this.properties().log.setValue(!1)},l.prototype.removeDataSource=function(t){var e=this.m_dataSources.indexOf(t);if(e===-1)throw Error("source is not attached to scale");this.m_dataSources.splice(e,1),TradingView.isInherited(t.constructor,p)&&(this._hasSeries=!1),this.mainSource()||this.setAutoScale(!0),this._mainSource=void 0,this._sourcesForAutoscale=null,this._sourcesToUpdateViews=null,this.updateFormatter(),this.invalidateSourcesCache()},l.prototype.setAutoScale=function(t){this._properties.autoScale.setValue(t)},l.prototype.isScaled=function(){return"number"==typeof this.m_scaleStartPoint},l.prototype.startScale=function(t){this.isPercentage()||null===this.m_scaleStartPoint&&null===this.m_priceRangeSnapshot&&(this.isEmpty()||(this.m_scaleStartPoint=this.m_height-t,this.m_priceRangeSnapshot=this.priceRange().clone()))},l.prototype.marks=function(){return this._marksCache?this._marksCache:(this.m_markBuilder.rebuildTickMarks(),this._marksCache=this.m_markBuilder.marks(),this.onMarksChanged.fire(),this._marksCache)},l.prototype.scaleTo=function(t){var e,i;this.isPercentage()||(this._marksCache=null,null!==this.m_scaleStartPoint&&(this.setAutoScale(!1),e=this.m_priceRange.clone(),t=this.m_height-t,t<0&&(t=0),i=(this.m_scaleStartPoint+.2*(this.m_height-1))/(t+.2*(this.m_height-1)),i=Math.max(i,.1),this.m_priceRange=this.m_priceRangeSnapshot.clone(),this.m_priceRange.scaleAroundCenter(i),this.recalcLockedScale(e)))},l.prototype.recalcLockedScale=function(t){var e,i,o,s;if(this.mainSource()instanceof p&&this.mainSource().properties().lockScale.value()){if(e=this.mainSource().model().timeScale(),i=this.mainSource().data().boxSize,void 0===i&&this.mainSource().fixBoxSize(),void 0===i)return;this.properties().percentage.value()&&(o=this.mainSource().data().search(this.mainSource().getRealVisibleRange().m_firstBar).value[TradingView.CLOSE_PLOT],i=n.prototype.convertToPercent.call(null,o+i,o)-n.prototype.convertToPercent.call(null,o,o)),s=this.internalHeight()/this.priceRange().length()*i,s<.5||s>50?this.m_priceRange=t:(e.setBarSpacing(s),e._correctOffset()),this.mainSource().model().mainSeries().requestMoreData()}},l.prototype.endScale=function(){this.isPercentage()||null!==this.m_scaleStartPoint&&(this.m_scaleStartPoint=null,this.m_priceRangeSnapshot=null)},l.prototype.startScroll=function(t){this.isAutoScale()||null===this.m_scrollStartPoint&&null===this.m_priceRangeSnapshot&&(this.isEmpty()||(this.m_scrollStartPoint=t,this.m_priceRangeSnapshot=this.priceRange().clone()))},l.prototype.scrollTo=function(t){var e,i,o;this._marksCache=null,this.isAutoScale()||null!==this.m_scrollStartPoint&&(e=this.priceRange().length()/(this.height()-1),i=t-this.m_scrollStartPoint,o=i*e,this.m_priceRange=this.m_priceRangeSnapshot.clone(),this.m_priceRange.shift(o))},l.prototype.endScroll=function(){this.isAutoScale()||null!==this.m_scrollStartPoint&&(this.m_scrollStartPoint=null,this.m_priceRangeSnapshot=null)},l.prototype.state=function(){var t={};return t.m_priceRange=this.priceRange()?this.priceRange().clone():null,t.m_isAutoScale=this.isAutoScale(),t.m_isPercentage=this._properties.percentage.value(),t.m_isLog=this._properties.log.value(),t.m_height=this.m_height,t.m_topMargin=this.m_topMargin,t.m_bottomMargin=this.m_bottomMargin,t},l.prototype.restoreState=function(t){var e=t.m_priceRange;if(void 0===e)throw new TypeError("invalid state");if(void 0===t.m_isAutoScale)throw new TypeError("invalid state");void 0!==t.m_isPercentage&&this._properties.percentage.setValue(t.m_isPercentage),void 0!==t.m_isLog&&this._properties.log.setValue(t.m_isLog),this.m_priceRange=e?new n(e.m_minValue,e.m_maxValue):null,void 0!==t.m_height&&(this.m_height=t.m_height),this.setAutoScale(t.m_isAutoScale),void 0!==t.m_topMargin&&(this.m_topMargin=t.m_topMargin),void 0!==t.m_bottomMargin&&(this.m_bottomMargin=t.m_bottomMargin),this._mainSource=void 0,this._scaleSeriesOnly=!1},l.prototype.mainSource=function(){var t,e;if(void 0!==this._mainSource)return this._mainSource;for(t=void 0,e=0;e<this.m_dataSources.length;e++){if(TradingView.isInherited(this.m_dataSources[e].constructor,p)){t=this.m_dataSources[e];break}!t&&TradingView.isInherited(this.m_dataSources[e].constructor,d)&&(t=this.m_dataSources[e])}return this._mainSource=t,this._mainSource||null},l.prototype.formatter=function(){return this._formatter||this.updateFormatter(),this._formatter},l.prototype.updateFormatter=function(){var t,e;this._marksCache=null,t=this.mainSource(),e=100,t&&(e=t.base()),this._formatter=null,this.properties().percentage.value()?this._formatter=new f:t?this._formatter=t.formatter():this._formatter=new _(100,1),this.m_markBuilder=new r(this,e,this._formatter),this.m_markBuilder.rebuildTickMarks()},l.prototype._recalculateSourcesForAutoscale=function(){var t,e;this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.scaleSeriesOnly.value()),t=this._scaleSeriesOnly&&this._hasSeries,e=function(e){return!!(e.properties().visible.value()||e instanceof p)&&(t?TradingView.isInherited(e.constructor,p):TradingView.isInherited(e.constructor,d))},this._sourcesForAutoscale=this.m_dataSources.filter(e)},l.prototype.sourcesForAutoscale=function(){return this._mainSource&&this._scaleSeriesOnly!==this._scalesProperties.scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||this._recalculateSourcesForAutoscale(),this._sourcesForAutoscale},l.prototype.recalculatePriceRange=function(t){this._invalidatedForRange={visibleBars:t,isValid:!1}},l.prototype.makeSureItIsValid=function(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this.recalculatePriceRangeImpl())},l.prototype.recalculatePriceRangeImpl=function(){var t,e,i,o,s,r,a,l,h,c,d=this._invalidatedForRange.visibleBars;if(d){for(t=null,e=this.sourcesForAutoscale(),i=0,o=0,s=0;s<e.length;s++)r=e[s],r.properties().visible.value()&&(a=d.firstBar(),l=d.lastBar(),h=r.priceRange(a,l),null===t&&h?t=h:h&&(t=t.merge(h)),r.margins&&(c=r.margins(),i=Math.max(c[0],i),o=Math.max(c[1],o)));(Math.abs(o-this._studyBottomMargin)>.01||Math.abs(i-this._studyTopMargin)>.01)&&(this._studyBottomMargin=o,this._studyTopMargin=i,this._marksCache=null,this._internalHeightCache=null),t?(t.minValue()===t.maxValue()&&(t=new n(t.minValue()-.5,t.maxValue()+.5)),this.setPriceRange(t)):this.m_priceRange||this.setPriceRange(new n(-.5,.5)),this._invalidatedForRange.isValid=!0}},l.prototype.sourcesToUpdateViews=function(){var t,e;if(!this._sourcesToUpdateViews)for(this._sourcesToUpdateViews=[],t=0;t<this.m_dataSources.length;t++)e=this.m_dataSources[t],TradingView.isInherited(e.constructor,c)&&!e.isActualSymbol()||this._sourcesToUpdateViews.push(e);return this._sourcesToUpdateViews},l.prototype.updatePaneViews=function(){var t,e=this.sourcesToUpdateViews();for(t=0;t<e.length;t++)e[t].updateAllViews()},l.prototype.priceRangeInPrice=function(){var t,e,i,o,n,s;return this.isEmpty()?null:this.isPercent()?(t=this.mainSource().model().timeScale().visibleBars(),e=this.mainSource().data().search(t.firstBar(),TradingView.SEARCH_NEAREST_RIGHT).value[TradingView.CLOSE_PLOT],i=this.priceRange().convertFromPercents(e),{from:i.minValue(),to:i.maxValue()}):(o=this.height(),n=this.coordinateToPrice(o-1),s=this.coordinateToPrice(0),{from:n,to:s})},t.exports=l}).call(e,i(21),i(28),i(85))},function(t,e){"use strict";function i(t,e){this._formatter=t,this._maxSize=e||50,this._actualSize=0,this._cache={},this._usageTick=1,this._oldestTick=1,this._tick2Labels={}}i.prototype.format=function(t){var e,i;return this._cache[t]?this._cache[t].string:(this._actualSize===this._maxSize&&(e=this._tick2Labels[this._oldestTick],delete this._tick2Labels[this._oldestTick],delete this._cache[e],this._oldestTick++,this._actualSize--),i=this._formatter(t),this._cache[t]={string:i,tick:this._usageTick},this._tick2Labels[this._usageTick]=t,this._actualSize++,this._usageTick++,i)},t.exports=i},function(t,e,i){(function(e,o){"use strict";function n(t,i,s){var r,a;this.m_timeScale=t,r=i.rightAxisProperties.state(),r.autoScale=!0,this.m_rightPriceScale=new l(new e(r),s.properties().scalesProperties),a=i.leftAxisProperties.state(),a.autoScale=!0,this.m_leftPriceScale=new l(new e(a),s.properties().scalesProperties),this.m_dataSources=[],this.m_height=0,this.m_width=0,this.m_mainDataSource=null,this._properties=i,this._model=s,this._tagsChanged=new o,i.topMargin.listeners().subscribe(this,n.prototype._updateMargins),i.bottomMargin.listeners().subscribe(this,n.prototype._updateMargins),this._updateMargins(),this._stretchFactor=n.DEFAULT_STRETCH_FACTOR}var s=i(121).ExecutionsPositionController,r=i(74).LineDataSource,a=i(79).PriceDataSource,l=i(118);n.DEFAULT_STRETCH_FACTOR=1e3,n.PANE_ANIMATION_DURATION=500,n.sortSourcesPreOrdered={"Volume@tv-basicstudies":0,ChartEventsSource:1,"ESD$TV_DIVIDENDS@tv-scripting":2,"ESD$TV_SPLITS@tv-scripting":3,"ESD$TV_EARNINGS@tv-scripting":4,LineToolOrder:5,LineToolPosition:6,LineToolExecution:7},n.prototype.destroy=function(){this._properties.topMargin.listeners().unsubscribe(this,n.prototype._updateMargins),this._properties.bottomMargin.listeners().unsubscribe(this,n.prototype._updateMargins)},n.prototype.setPaneSize=function(t){var e={large:1,medium:.6,small:.3,tiny:.15};if(!e[t])throw Error("Unknown size enum value: "+t);this._stretchFactor=e[t]*n.DEFAULT_STRETCH_FACTOR},n.sortSources=function(t){return t.map(function(t){var e,i,o=t._constructor;return isFunction(t.metaInfo)&&(o=t.metaInfo().id),i=n.sortSourcesPreOrdered[o]||0,e=i>0?+(1/0):i<0?-(1/0):t.zorder(),[t,i,e]}).sort(function(t,e){return t[1]-e[1]||t[2]-e[2]}).map(function(t){return t[0]})},n.prototype._updateMargins=function(){var t,e,i=.01*this._properties.topMargin.value(),o=.01*this._properties.bottomMargin.value();for(this.m_leftPriceScale.setTopMargin(i),this.m_leftPriceScale.setBottomMargin(o),this.m_rightPriceScale.setTopMargin(i),this.m_rightPriceScale.setBottomMargin(o),t=0;t<this.m_dataSources.length;t++)e=this.m_dataSources[t],e instanceof TradingView.Study&&this.isOverlay(e)&&"Volume"!==e.metaInfo().shortId&&e.priceScale()&&e.priceScale()!==this.m_leftPriceScale&&e.priceScale()===this.m_rightPriceScale&&(e.priceScale().setTopMargin(i),e.priceScale().setBottomMargin(o),this.recalculatePriceScale(e.priceScale()));this.recalculatePriceScale(this.m_leftPriceScale),this.recalculatePriceScale(this.m_rightPriceScale),this.updateAllViews()},n.prototype.model=function(){return this._model},n.prototype.width=function(){return this.m_width},n.prototype.height=function(){return this.m_height},n.prototype.setWidth=function(t){this.m_width=t,this.updateAllViews()},n.prototype.setHeight=function(t){var e,i;for(this.m_height=t,this.m_leftPriceScale.setHeight(t),this.m_rightPriceScale.setHeight(t),e=0;e<this.m_dataSources.length;e++)i=this.m_dataSources[e],this.isOverlay(i)&&i.priceScale()&&i.priceScale().setHeight(t);this.updateAllViews()},n.prototype.leftPriceScale=function(){return this.m_leftPriceScale},n.prototype.rightPriceScale=function(){return this.m_rightPriceScale},n.prototype.timeScale=function(){return this.m_timeScale},n.prototype.dataSources=function(){return this.m_dataSources},n.prototype.isOverlay=function(t){return t._isOverlay},n.prototype._processMainSourceChange=function(){var t,e,i,o,s,l,h;if(null===this.m_mainDataSource)for(e=0;e<this.m_dataSources.length;e++)if(i=this.m_dataSources[e],TradingView.isInherited(i.constructor,a)&&!this.isOverlay(i)&&(!i.properties().linkedToSeries||!i.properties().linkedToSeries.value())){this.m_mainDataSource=i,t=!0;break}if(this.m_mainDataSource&&t){for(o=[],e=0;e<this.m_dataSources.length;e++)i=this.m_dataSources[e],TradingView.isInherited(i.constructor,r)&&o.push(i);for(o=n.sortSources(o),e=0;e<o.length;e++)this.move(o[e],this.m_mainDataSource.priceScale(),!0)}else if(!this.m_mainDataSource)for(e=0;e<this.m_dataSources.length;e++)if(i=this.m_dataSources[e],TradingView.isInherited(i.constructor,a)&&this.isOverlay(i)&&i.showInObjectTree()){for(this.m_mainDataSource=i,this.m_rightPriceScale.addDataSource(i),i.setPriceScale(this.m_rightPriceScale),s=this._model.children(i),h=0;h<s.length;h++)l=s[h],this.m_rightPriceScale.addDataSource(l),l.setPriceScale(this.m_rightPriceScale);this.recalculatePriceScale(this.m_rightPriceScale),i._isOverlay=!1;break}},n.prototype._newZOrderForLineTool=function(){var t=this.m_dataSources.reduce(function(t,e){return e instanceof r?Math.max(t,e.zorder()):t},this.getZOrderMinMax().minZOrder-1);return this.m_dataSources.forEach(function(e){e.zorder()>t&&e.setZorder(e.zorder()+1)}),t+1},n.prototype.addDataSource=function(t,e,i){var o;o=t instanceof r&&!i?this._newZOrderForLineTool():this.getZOrderMinMax().minZOrder-1,this.insertDataSource(t,e,o)},n.prototype.insertDataSource=function(t,i,o){var s,r,h;this.m_dataSources.push(t),s=!1,t===this._model.mainSeries()?(this.m_mainDataSource=t,s=!0):null===this.m_mainDataSource&&(this.m_mainDataSource=t,s=!0),t._isOverlay=!1,null===i&&(r=this.m_rightPriceScale.topMargin(),h=this.m_rightPriceScale.bottomMargin(),t.metaInfo&&"Volume@tv-basicstudies"===t.metaInfo().id&&(r=.75,h=0),i=new l(new e(this._properties.overlayPropreties.state()),this._model.properties().scalesProperties),i.setHeight(this.m_height),i.setTopMargin(r),i.setBottomMargin(h),t._isOverlay=!0),i.addDataSource(t),t.setPriceScale(i),t.onTagsChanged&&t.onTagsChanged().subscribe(this,n.prototype.onSourceTagsChanged),t.setZorder(o),s&&this._processMainSourceChange(),this._tagsChanged.fire(),TradingView.isInherited(t.constructor,a)&&this.recalculatePriceScale(i),this.invalidateSourcesCache()},n.prototype.removeDataSource=function(t,e){var i,o=this.m_dataSources.indexOf(t);return o===-1?void TradingView.logDebugChart("removeDataSource: invalid data source"):(t._isOverlay=!1,this.m_dataSources.splice(o,1),t!==this.m_mainDataSource||e||(this.m_mainDataSource=null),i=null,this.m_leftPriceScale.dataSources().indexOf(t)!==-1?(this.m_leftPriceScale.removeDataSource(t),i=this.m_leftPriceScale):this.m_rightPriceScale.dataSources().indexOf(t)!==-1&&(this.m_rightPriceScale.removeDataSource(t),i=this.m_rightPriceScale),t.onTagsChanged&&t.onTagsChanged().unsubscribe(this,n.prototype.onSourceTagsChanged),TradingView.isInherited(t.constructor,a)&&this._processMainSourceChange(),this._tagsChanged.fire(),i&&TradingView.isInherited(t.constructor,a)&&this.recalculatePriceScale(i),void this.invalidateSourcesCache())},n.prototype.startScalePrice=function(t,e){t.startScale(e)},n.prototype.scalePriceTo=function(t,e){t.scaleTo(e),this.updateAllViews()},n.prototype.endScalePrice=function(t){t.endScale()},n.prototype.startScrollPrice=function(t,e){t.startScroll(e)},n.prototype.scrollPriceTo=function(t,e){t.scrollTo(e),this.updateAllViews()},n.prototype.endScrollPrice=function(t){t.endScroll()},n.prototype.setPriceAutoScale=function(t,e){return t.setAutoScale(e),this.timeScale().isEmpty()?void t.setPriceRange(null):void this.recalculatePriceScale(t)},n.prototype.restorePriceScaleState=function(t,e){t.restoreState(e),this.updateAllViews()},n.prototype.updateAllViews=function(){for(var t=0;t<this.m_dataSources.length;t++)this.m_dataSources[t].updateAllViews()},n.prototype.defaultPriceScale=function(){var t=this.m_mainDataSource?this.m_mainDataSource.priceScale():this.rightPriceScale();return void 0===t&&(t=new l(new e(this._properties.overlayPropreties.state()),this._model.properties().scalesProperties)),t},n.prototype._priceScaleIsPrice=function(t){var e=t.mainSource();return!!e&&(!!TradingView.isInherited(e.constructor,TradingView.Series)||!!TradingView.isInherited(e.constructor,TradingView.Study)&&e.metaInfo().is_price_study)},n.prototype.findSuitableScale=function(t){if(TradingView.isInherited(t.constructor,TradingView.Study)&&"Volume@tv-basicstudies"===t.metaInfo().id)return this.m_rightPriceScale.mainSource()||this.m_leftPriceScale.mainSource()?null:this.m_rightPriceScale;var e=!1;if(TradingView.isInherited(t.constructor,TradingView.Study)?e=t.metaInfo().is_price_study:TradingView.isInherited(t.constructor,TradingView.Series)&&(e=!0),e){if(this._priceScaleIsPrice(this.m_rightPriceScale))return this.m_rightPriceScale;if(this._priceScaleIsPrice(this.m_leftPriceScale))return this.m_leftPriceScale}return this.m_rightPriceScale.mainSource()?this.m_leftPriceScale.mainSource()?null:this.m_leftPriceScale:this.m_rightPriceScale},n.prototype.mainDataSource=function(){return this.m_mainDataSource},n.prototype.recalculatePriceScale=function(t){if(t){if(t.isAutoScale()&&!this.timeScale().isEmpty()){var e=this.timeScale().visibleBars();t.recalculatePriceRange(e)}t.updatePaneViews()}},n.prototype.resetPriceScale=function(t){var e=this.timeScale().visibleBars();t.mainSource()instanceof TradingView.Series&&t.mainSource().isLockScale()||t.setAutoScale(!0),t.recalculatePriceRange(e),this.updateAllViews()},n.prototype.recalculate=function(){var t,e;for(this.recalculatePriceScale(this.m_rightPriceScale),this.recalculatePriceScale(this.m_leftPriceScale),t=0;t<this.m_dataSources.length;t++)e=this.m_dataSources[t],!this.isOverlay(e)||e instanceof r||this.recalculatePriceScale(e.priceScale());this.updateAllViews(),this._model.updatePane(this)},n.prototype.isEmpty=function(){return null===this.m_mainDataSource},n.prototype.move=function(t,e,i){var o=this.m_dataSources.slice(),n=null!==e;this.removeDataSource(t,n),this.addDataSource(t,e,i),this.m_dataSources=o,this.invalidateSourcesCache()},n.prototype.dataSourceForId=function(t){for(var e=0;e<this.m_dataSources.length;e++)if(this.m_dataSources[e].id()===t)return this.m_dataSources[e];return null},n.prototype.priceScaleForSource=function(t){return this.rightPriceScale().dataSources().indexOf(t)!==-1?this.rightPriceScale():this.leftPriceScale().dataSources().indexOf(t)!==-1?this.leftPriceScale():null},n.prototype.sourceById=function(t){for(var e=0;e<this.m_dataSources.length;e++)if(this.m_dataSources[e].id()===t)return this.m_dataSources[e];return null},n.prototype.containsMainSeries=function(){return this.m_dataSources.indexOf(this._model.mainSeries())!==-1},n.prototype.priceScaleByName=function(t){return"left"===t?this.m_leftPriceScale:"right"===t?this.m_rightPriceScale:null},n.prototype.priceScaleName=function(t){return t===this.m_leftPriceScale?"left":t===this.m_rightPriceScale?"right":""},n.prototype.hitTestSources=function(){var t,e,i,o,n;if(this._cachedHitTestSources)return this._cachedHitTestSources;for(t=this.orderedSources(),e=[],i=[],o=0;o<t.length;o++)n=t[o],TradingView.isInherited(n.constructor,r)?e.push(n):i.push(n);return this._cachedHitTestSources=i.concat(e),this._cachedHitTestSources},n.prototype.orderedSources=function(){var t,e,i,o;if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;for(t=[],e=0,i=this.m_dataSources.length;e<i;e++)o=this.m_dataSources[e],TradingView.isInherited(o.constructor,r)&&!o.isActualSymbol()||t.push(o);return t=n.sortSources(t),this._cachedOrderedSoruces=t,t},n.prototype.createDrawingsCaches=function(){s.recreateOrderedByBarsSourcesCache(this)},n.prototype.clearDrawingCaches=function(){s.clearOrderedByBarsSourcesCache()},n.prototype.invalidateSourcesCache=function(){this._cachedOrderedSoruces=null,this._cachedHitTestSources=null,this.m_leftPriceScale.invalidateSourcesCache(),this.m_rightPriceScale.invalidateSourcesCache()},n.prototype.getZOrderMinMax=function(){var t,e,i,o,n=this.orderedSources();if(0===n.length)return{minZOrder:0,maxZOrder:0};for(t=n[0].zorder(),e=n[0].zorder(),i=1;i<n.length;i++)o=n[i],o.zorder()<t&&(t=o.zorder()),o.zorder()>e&&(e=o.zorder());return{minZOrder:t,maxZOrder:e}},n.prototype.sendToBack=function(t){var e,i=this.getZOrderMinMax().minZOrder,o=Math.abs(t.zorder()-i);for(e=0;e<o;e++)this.changeZOrder(t,-1)},n.prototype.bringToFront=function(t){var e,i=this.getZOrderMinMax().maxZOrder,o=Math.abs(t.zorder()-i);for(e=0;e<o;e++)this.changeZOrder(t,1)},n.prototype.changeZOrder=function(t,e){var i,o,n,s,r,a=this.orderedSources().filter(function(t){return t.showInObjectTree()}),l=0;for(i=0,o=a.length;i<o;i++)if(a[i]===t){l=i;break}l>0&&e<0?(n=a[l-1].zorder(),s=t.zorder(),a[l-1].setZorder(s),t.setZorder(n)):l<a.length-1&&e>0&&(r=a[l+1].zorder(),s=t.zorder(),a[l+1].setZorder(s),t.setZorder(r)),this.invalidateSourcesCache()},n.prototype.onSourceTagsChanged=function(){this._tagsChanged.fire()},n.prototype.onTagsChanged=function(){return this._tagsChanged},n.prototype.dumpPriceScale=function(t){var e,i,o,n=t.dataSources(),s=[];for(e=0;e<n.length;e++)if(i=n[e].priceAxisViews(this,t))for(o=0;o<i.length;o++)s.push(i[o].dump());return s},n.prototype.dumpViews=function(){var t,e,i,o,n,s={};for(s.paneViews={},t=this.orderedSources(),e=0;e<t.length;e++)if(i=t[e],s.paneViews[e]=[],o=i.paneViews())for(n=0;n<o.size();n++)s.paneViews[e].push(o.item(e).dump());return s.leftAxis=this.dumpPriceScale(this.m_leftPriceScale),s.rightAxis=this.dumpPriceScale(this.m_rightPriceScale),s},n.prototype.clearSeries=function(){for(var t=this.m_dataSources.length-1;t>=0;t--)TradingView.isInherited(this.m_dataSources[t].constructor,TradingView.Series)&&this.m_dataSources.splice(t,1)},n.prototype.actionNoScaleIsEnabled=function(t){return!(!this.isOverlay(t)&&TradingView.isInherited(t.constructor,a))||this.m_dataSources.filter(function(t){return(!t.properties().linkedToSeries||!t.properties().linkedToSeries.value())&&(TradingView.isInherited(t.constructor,a)&&t.showInObjectTree()&&!t.isNoScale())}).length>1},n.prototype.executionsPositionController=function(){return this._executionsPositionController||(this._executionsPositionController=new s(this,this._model.timeScale())),this._executionsPositionController},t.exports=n}).call(e,i(69),i(28))},function(t,e,i){(function(t,o){"use strict";function n(t,e){this._pane=t,this._timeScale=e}function s(t){this._line=t}function r(t,e){this._data=t,this._adapter=e}function a(t,e){h.call(this,t,e),this._invalidated=!0}function l(t,e){this._adapter=new s(this),this._constructor="LineToolExecution";var i=e||new _("linetoolexecution");this.customization={forcePriceAxisLabel:!1,disableSelection:!0,disableErasing:!0},c.call(this,t,new a(this,t),i)}var h=i(103),c=i(74).LineDataSource,d=i(122),p=i(94),u=i(55).Rect,_=i(80).DefaultProperty;n.prototype._cachedByBarIndexOrderedExecutions={},n.recreateOrderedByBarsSourcesCache=function(t){var e,i,o,s,r;for(n.clearOrderedByBarsSourcesCache(),e=n.prototype,i=t.orderedSources(),o=0;o<i.length;++o)s=i[o],s._adapter&&void 0!==s._adapter._index&&(r=e._cachedByBarIndexOrderedExecutions[s._adapter._index],e._cachedByBarIndexOrderedExecutions[s._adapter._index]=r||[],e._cachedByBarIndexOrderedExecutions[s._adapter._index].push(s))},n.clearOrderedByBarsSourcesCache=function(){n.prototype._cachedByBarIndexOrderedExecutions={}},n.prototype.getXYCoordinate=function(t,e,i){var o,n,s,r,a,h,c,d,p,u,_=0,f=t.getDirection(),g="buy"===f,m=this._pane.model().mainSeries();if(m.bars&&(o=g?10:-10,n=m.bars().search(i,TradingView.SEARCH_NEAREST_LEFT),n&&(i=n.index,s=g?n.value[TradingView.LOW_PLOT]:n.value[TradingView.HIGH_PLOT],r=m.priceScale(),r.isPercent()&&(a=m.firstValue(),s=r.priceRange().convertToPercent(s,a)),_=r.priceToCoordinate(s)+o)),t._index=i,h=e.visibleBars(),!isFinite(i)||!h||i>h.lastBar()||i<h.firstBar())return{x:-1,y:-1};for(c=this._cachedByBarIndexOrderedExecutions[i]||this._pane.orderedSources(),d=c.length-1;d>=0;--d)if(p=c[d],p instanceof l&&p._adapter._index===i&&p._adapter.getDirection()===f){if(p===t._line)break;u=p._adapter._height(),_=g?_+u:_-u}return{x:e.indexToCoordinate(i),y:_}},s.prototype._height=function(){var t,e=this.getArrowHeight(),i=this.getArrowSpacing(),o=0;return this.getText()&&d.fontHeight(this.getFont()),t=10,e+i+o+t},s.prototype.getIndex=function(){var t=this._line._model.timeScale(),e=t.m_points.lastTimePointIndex(),i=this._line.points()[0].index;return e-i},s.prototype.setIndex=function(t){var e,i=this._line._model.timeScale(),o=i.m_points.lastTimePointIndex(),n=o-Math.abs(t);return this._line.startMoving(this._line.points()[0]),e=TradingView.merge({},this._line.points()[0]),e.index=n,this._line.move(e),this._line.endMoving(),this},s.prototype.getTime=function(){return this._unixtime},s.prototype.setTime=function(t){var e=this._line._model.mainSeries();return this._unixtime=ChartApiInstance.alignTimePoint?ChartApiInstance.alignTimePoint(t,e.interval(),e.symbolInfo()):t,this._line.restorePoints([{offset:0,price:this.getPrice(),time_t:this._unixtime}],[]),this._line.createServerPoints(),this},s.prototype.getPrice=function(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0},s.prototype.setPrice=function(t){return this._line.points().length>0&&(this._line.points()[0].price=t),this._line._timePoint.length>0&&(this._line._timePoint[0].price=t),this},s.prototype.getText=function(){return this._line.properties().text.value()},s.prototype.setText=function(t){return this._line.properties().text.setValue(t||""),this._line.updateAllViewsAndRedraw(),this},s.prototype.getArrowHeight=function(){return this._line.properties().arrowHeight.value()},s.prototype.setArrowHeight=function(t){return this._line.properties().arrowHeight.setValue(t||5),this},s.prototype.getArrowSpacing=function(){return this._line.properties().arrowSpacing.value()},s.prototype.setArrowSpacing=function(t){return this._line.properties().arrowSpacing.setValue(t||1),this},s.prototype.getDirection=function(){return this._line.properties().direction.value()},s.prototype.setDirection=function(t){return this._line.properties().direction.setValue(t||"buy"),this},s.prototype.getArrowColor=function(){return d.getColorFromProperties(this._line.properties().arrowColor,this._line.properties().arrowTransparency)},s.prototype.setArrowColor=function(t){return d.setColorToProperties(t,this._line.properties().arrowColor,this._line.properties().arrowTransparency),this},s.prototype.getTextColor=function(){return d.getColorFromProperties(this._line.properties().textColor,this._line.properties().textTransparency)},s.prototype.setTextColor=function(t){return d.setColorToProperties(t,this._line.properties().textColor,this._line.properties().textTransparency),this},s.prototype.getFont=function(){return d.getFontFromProperties(this._line.properties().fontFamily,this._line.properties().fontSize,this._line.properties().fontBold,this._line.properties().fontItalic)},s.prototype.setFont=function(t){return d.setFontToProperties(t,this._line.properties().fontFamily,this._line.properties().fontSize,this._line.properties().fontBold,this._line.properties().fontItalic),this},s.prototype.setTooltip=function(t){return null==t?t="":t+="",this._line.properties().tooltip.setValue(t),this},s.prototype.getTooltip=function(){return this._line.properties().tooltip.value()},s.prototype.remove=function(){this._line._model.removeSource(this._line),delete this._line},r.prototype._textWidth=function(t){var e,i;return 0===this._adapter.getText().length?0:(t.save(),t.font=this._adapter.getFont(),e=5,i=t.measureText(this._adapter.getText()).width,t.restore(),e+i)},r.prototype._drawArrow=function(t,e,i){var o,n;t.save(),t.strokeStyle=this._adapter.getArrowColor(),t.fillStyle=this._adapter.getArrowColor(),o=this._adapter.getArrowHeight(),n=this._adapter.getDirection(),t.translate(e,i),"buy"!==n&&t.rotate(Math.PI),CanvasEx.drawArrow(t,0,0,0,o),t.restore()},r.prototype._drawText=function(t,e,i){var o,n,s=this._adapter.getText();s&&(t.save(),t.textAlign="center",t.textBaseline="middle",t.font=this._adapter.getFont(),t.fillStyle=this._adapter.getTextColor(),o=e+this._textWidth(t)/2,n=i+d.fontHeight(this._adapter.getFont())/2,t.fillText(s,o,n-1),t.restore())},r.prototype.draw=function(t){var e,i,o,n,s,r,a,h;!this._data.points||this._data.points.length<l.POINTS_COUNT||(e=Math.round(this._data.points[0].x+.5),i=Math.round(this._data.points[0].y),this._drawArrow(t,e,i),o=this._textWidth(t),0!==o&&(n=this._adapter.getArrowHeight(),s=this._adapter.getArrowSpacing(),r=d.fontHeight(this._adapter.getFont()),a=this._adapter.getDirection(),h="buy"===a?i+n+s:i-n-s-r,this._drawText(t,Math.round(e-o/2),h)))},r.prototype.hitTest=function(t){var e,i,o,n,s,r;if(this._data.points&&!(this._data.points.length<l.POINTS_COUNT))return e=Math.round(this._data.points[0].x),i=Math.round(this._data.points[0].y),o=this._adapter.getArrowHeight(),"buy"===this._adapter.getDirection()?(n=i,s=i+o):(n=i-o,s=i),t.x>=e-2&&t.x<=e+2&&t.y>=n&&t.y<=s?(r=this._adapter.getTooltip(),new p(p.CUSTOM,{mouseDownHandler:function(){TradingView.TradingWidget&&TradingView.TradingWidget.journalDialog()},tooltip:""!==r?{text:r,rect:new u(e,n,2,s-n)}:null})):void 0},inherit(a,h),a.prototype._renderer=null,a.prototype._rendererCached=!1,a.prototype.update=function(){this._invalidated=!0},a.prototype.updateImpl=function(){h.prototype.update.call(this),this._renderer=null,this._rendererCached=!1,this._invalidated=!1},a.prototype.renderer=function(e){
var i,o,n,s,a,l,h,c;return this._invalidated&&this.updateImpl(),this._rendererCached?this._renderer:(this._rendererCached=!0,i=this._source,o=i.points(),0===o.length?null:(n=i._adapter,s=i._model.timeScale(),a=this._source._model.paneForSource(this._source).executionsPositionController(),l=a.getXYCoordinate(n,s,o[0].index),!isFinite(l.y)||l.y<0||l.y>e||l.x<0?(this._renderer=null,null):(h=[new t.Point(l.x,l.y)],c={points:h},this._renderer=new r(c,n),this._renderer)))},inherit(l,c),l.POINTS_COUNT=1,l.skipMagnetting=!0,l.prototype.pointsCount=function(){return l.POINTS_COUNT},l.prototype.title=function(){return"Execution"},l.prototype.hasContextMenu=function(){return!1},l.prototype.state=function(){return null},l.prototype.paneViews=function(t){return TradingView.printing&&!o.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showExecutions.value()?c.prototype.paneViews.call(this,t):null},l.prototype.userEditEnabled=function(){return!1},l.prototype.showInObjectTree=function(){return!1},e.ExecutionsPositionController=n,e.LineToolExecution=l}).call(e,i(21),i(1))},function(t,e,i){"use strict";var o=i(113),n={_fontHeightCache:{},_parsedColorCache:{}};n._parseColor=function(t){var e,i,o;return this._parsedColorCache[t]?this._parsedColorCache[t]:(e=document.createElement("div"),e.style.color=t,i=e.style.color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i)||e.style.color.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\,\s*(\d*\.?\d+)\s*\)$/i),o={r:i[1],g:i[2],b:i[3],a:i[4]||"1"},this._parsedColorCache[t]=o,o)},n.getColorFromProperties=function(t,e){var i=1-e.value()/100,o=this._parseColor(t.value());return"rgba("+o.r+","+o.g+","+o.b+","+i+")"},n.setColorToProperties=function(t,e,i){var o,n=this._parseColor(t);e.setValue("rgb("+n.r+","+n.g+","+n.b+")"),o=100*(1-n.a),i.setValue(Math.max(0,Math.min(o,100)))},n._parseFont=function(t){var e,i,o,n=document.createElement("div");return n.style.font=t,e=n.style.fontSize.match(/(\d+)pt/),i=e&&e[0]===n.style.fontSize,o={family:n.style.fontFamily,size:i?e[1]:"",bold:"bold"===n.style.fontWeight,italic:"italic"===n.style.fontStyle}},n.getFontFromProperties=function(t,e,i,o){var n=i.value()?"bold":"",s=o.value()?"italic":"",r=e.value()+"pt",a=t.value();return[n,s,r,a].join(" ")},n.setFontToProperties=function(t,e,i,o,n){var s=this._parseFont(t);s.family.length>0&&e.setValue(s.family),s.size.length>0&&i.setValue(s.size),o.setValue(s.bold),n.setValue(s.italic)},n.fontHeight=function(t){var e,i;return this._fontHeightCache[t]||(e=document.createElement("span"),e.appendChild(document.createTextNode("height")),document.body.appendChild(e),e.style.cssText="font: "+t+"; white-space: nowrap; display: inline;",i=e.offsetHeight,document.body.removeChild(e),this._fontHeightCache[t]=Math.ceil(i)),this._fontHeightCache[t]},n.drawPolyHoverOrPress=function(t,e,i,o){o?(t.save(),t.fillStyle="rgba(0, 0, 0, 0.15)",CanvasEx.drawPoly(t,e,!0),t.restore()):i&&(t.save(),t.fillStyle="rgba(0, 0, 0, 0.1)",CanvasEx.drawPoly(t,e,!0),t.restore())},n.repaint=function(t){var e=new o(o.LIGHT_UPDATE);e.force=!0,t.invalidate(e)},n.roundToMinTick=function(t,e){var i=t.mainSource().base(),o=1/i;return o*Math.round(e/o)},t.exports=n},function(t,e,i){(function(e,o,n,s,r,a){"use strict";function l(t,i,s,r,a,h,c,v,b){var w,S,T,C;this._version=l.version,this._readOnly=r,this._undoModel=v,this._properties=s,this._isSnapshot=b,this._studiesMetaData=h,this._studyVersioning=new P(this._studiesMetaData,c),this.m_timeScale=new g(this),this.m_panes=[],this.m_gridSource=new _,this.m_crossHairSource=new d(this,A.properties()),this.m_width=0,this._tagsChanged=new e,this._lineCancelled=new e,this._magnet=new f(A.properties().magnet,this.m_timeScale,s.paneProperties.magnetSensivity),w=new V("chartproperties.mainSeriesProperties"),w.addExclusion("lockScale"),w.addExclusion("minTick"),w.addExclusion("priceAxisProperties.percentage"),w.addExclusion("priceAxisProperties.log"),this.createPane(void 0,!1,{rightAxisProperties:w.priceAxisProperties.state(["autoScale"])}),this.m_panes[0]._stretchFactor=2*p.DEFAULT_STRETCH_FACTOR,this.m_panes[0]._isMainPane=!0,this.m_selectedSource=null,this._selectedSourceChanged=new e,this._chartApi=t,this._invalidateHandler=i,this.m_hoveredSource=null,this._properties.listeners().subscribe(this,l.prototype.propertyChangeHandler),S=this,this._properties.timezone.listeners().subscribe(null,function(){S._chartApi&&S._chartApi.connected()&&S._chartApi.switchTimezone(S.timezone())}),this._properties.timeScale.rightOffset.listeners().subscribe(null,function(){S.m_timeScale.setOffset(S._properties.timeScale.rightOffset.value()),S.recalculateAllPanes()}),w.merge(s.mainSeriesProperties.state()),this.m_mainSeries=new I(this,w,a),this.m_panes[0].addDataSource(this.m_mainSeries,this.m_panes[0].rightPriceScale()),this.m_mainSeries.onCompleted().subscribe(this,function(){S.clearCurrentPosition(),S._scrollingState&&S.gotoTime()}),r||(w.addChild("priceAxisProperties",this.m_mainSeries.m_priceScale.properties()),w.lockScale.listeners().subscribe(this,function(t){var e=t.value();e&&(w.priceAxisProperties.percentage.setValue(!1),w.priceAxisProperties.logDisabled.setValue(!1)),w.priceAxisProperties.percentageDisabled.setValue(e),w.priceAxisProperties.logDisabled.setValue(e)}),this._properties.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,function(t){t.value()||S._properties.paneProperties.legendProperties.showStudyArguments.setValue(!1)})),this._barsMarksSources=[],this._syncPointCache={},o.enabled("charting_library_base")&&(T=new y(this),T.setOwnerSource(this.m_mainSeries),this._barsMarksSources.push(T),C=new m(this),C.setOwnerSource(this.m_mainSeries),this._barsMarksSources.push(C)),this.m_watermarkSource=new u(this.m_mainSeries),this.strategySources=[],this.strategySources.change=new e,this._activeStrategySource=new n(null),this._oldStartVisibleIndex=-1,this._oldEndVisibleIndex=-1,this._currentTool="",A.hideAllDrawings().subscribe(this,l.prototype.visibilityChangeHandler),this._properties.scalesProperties.listeners().subscribe(this,l.prototype.fullUpdate),this._id=TradingView.guid()}var h=i(124),c=i(74).LineDataSource,d=i(224),p=i(120),u=i(228),_=i(229),f=i(230),g=i(231),m=i(234),v=i(236).BarsMarksContainer,y=i(237),b=i(113),w=i(65).RGBColor,S=i(150),T=S.Study,C=S.createStudy,x=S.prepareStudyProperties,P=i(148),L=i(238),k=i(145).StudyLineDataSource,E=i(59).StudyConsts,I=i(84),A=i(81),V=i(80).DefaultProperty,M=i(115).SyncPoint;l.prototype.isSnapshot=function(){return this._isSnapshot},l.prototype.currentTool=function(){return this._currentTool},l.prototype.setCurrentTool=function(t){this._currentTool=t},l.prototype.timezone=function(){return this._properties.timezone.value()},l.prototype.version=function(){return this._version},l.prototype.initConnection=function(){this._chartApi.switchTimezone(this.timezone())},l.prototype.dumpViews=function(){var t,e,i,o,n={};for(n.panes=[],t=0;t<this.m_panes.length;t++)n.panes.push(this.m_panes[t].dumpViews());for(n.dataWindow=[],e=this.dataSources(),t=0;t<e.length;t++)i=e[t],o=i.dataWindowView(),o&&n.dataWindow.push(o.dump());return n},l.prototype._paneInvalidationMask=function(t,e){var i=new b,o=this.m_panes.indexOf(t);return void 0===e&&(e=b.LIGHT_UPDATE),i.invalidatePane(o,e),i},l.prototype.updatePane=function(t){var e=this._paneInvalidationMask(t);this.invalidate(e)},l.prototype.fullUpdate=function(){this.invalidate(new b(b.FULL_UPDATE))},l.prototype.updateSource=function(t){var e=this.paneForSource(t),i=this._paneInvalidationMask(e);this.invalidate(i)},l.prototype.studiesMetaData=function(){return this._studiesMetaData},l.prototype.studyVersioning=function(){return this._studyVersioning},l.prototype.disconnect=function(){var t,e=this.dataSources();for(t=0;t<e.length;t++)e[t].disconnect&&e[t].disconnect()},l.prototype.restart=function(){var t,e,i;for(this.initConnection(),this.m_timeScale.reset(),this.m_mainSeries.restart(),t=this.dataSources(),e=0;e<t.length;e++)i=t[e],i.restart&&i!==this.m_mainSeries&&i.restart()},l.prototype.startNotStartedStudies=function(){var t,e;if(!this.m_mainSeries.isStarted())throw Error("Cannot start studies: main series is not started");for(t=this.dataSources(),e=0;e<t.length;e++)t[e]instanceof T&&!t[e].isStarted()&&t[e].restart&&t[e]!==this.m_mainSeries&&t[e].restart()},l.prototype.updateLineTools=function(){var t,e,i=this.dataSources();for(t=0;t<i.length;t++)TradingView.isInherited(i[t].constructor,c)&&(e=i[t],e.tryCreateServerPoints(),e.checkAlert&&e.checkAlert())},l.prototype.realignLineTools=function(){var t,e,i=this.dataSources();for(t=0;t<i.length;t++)TradingView.isInherited(i[t].constructor,c)&&(e=i[t],e.calcIsActualSymbol());for(t=0;t<this.m_panes.length;t++)this.m_panes[t].invalidateSourcesCache()},l.prototype.readOnly=function(){return this._readOnly},l.prototype.properties=function(){return this._properties},l.prototype.lineCancelled=function(){return this._lineCancelled},l.prototype.crossHairMoved=function(){return this.m_crossHairSource.moved()},l.prototype.chartApi=function(){return this._chartApi},l.prototype.propertyChangeHandler=function(){this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.visibilityChangeHandler=function(){this.setSelectedSource(),this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.updateAllPaneViews=function(){var t,e;for(t=0;t<this.m_panes.length;t++)e=this.m_panes[t],e.updateAllViews()},l.prototype.mainSeries=function(){return this.m_mainSeries},l.prototype.timeScale=function(){return this.m_timeScale},l.prototype.panes=function(){return this.m_panes},l.prototype.gridSource=function(){return this.m_gridSource},l.prototype.watermarkSource=function(){return this.m_watermarkSource},l.prototype.crossHairSource=function(){return this.m_crossHairSource},l.prototype.barsMarksSources=function(){return this._barsMarksSources},l.prototype.width=function(){return this.m_width},l.prototype.setPaneHeight=function(t,e){t.setHeight(e),this.recalculateAllPanes(),this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.setWidth=function(t){var e,i;for(this.m_width=t,this.m_timeScale.setWidth(this.m_width),e=0;e<this.m_panes.length;++e)i=this.m_panes[e],i.setWidth(t);this.recalculateAllPanes()},l.prototype.createPane=function(t,e,i){var o,n;if(this._undoModel._chartWidget.isMaximizedPane()&&this._undoModel._chartWidget.toggleMaximizePane(),o=this._properties.paneProperties,i&&o.merge(i),n=new p(this.m_timeScale,o,this,e),"number"==typeof t&&isFinite(t)){if(t<0||t>this.m_panes.length)return void TradingView.logDebugChart("ChartModel.createPane: invalid index: "+t);this.m_panes.splice(t,0,n)}else this.m_panes.push(n);return n.onTagsChanged().subscribe(this,l.prototype.onPaneTagsChanged),n},l.prototype.removePane=function(t){this._undoModel._chartWidget.isMaximizedPane()&&this._undoModel._chartWidget.toggleMaximizePane(),t.destroy();var e=this.m_panes.indexOf(t);e!==-1&&this.m_panes.splice(e,1),this.invalidate(new b(b.FULL_UPDATE))},l.prototype.startScalePrice=function(t,e,i){t.startScalePrice(e,i)},l.prototype.scalePriceTo=function(t,e,i){t.scalePriceTo(e,i),this.mainSeries().properties().lockScale.value()?this.invalidate(new b(b.LIGHT_UPDATE)):this.invalidate(this._paneInvalidationMask(t,b.LIGHT_UPDATE))},l.prototype.endScalePrice=function(t,e){t.endScalePrice(e),this.invalidate(this._paneInvalidationMask(t,b.LIGHT_UPDATE))},l.prototype.startScrollPrice=function(t,e,i){t.startScrollPrice(e,i)},l.prototype.scrollPriceTo=function(t,e,i){t.scrollPriceTo(e,i),this.invalidate(this._paneInvalidationMask(t,b.LIGHT_UPDATE))},l.prototype.endScrollPrice=function(t,e){t.endScrollPrice(e),this.invalidate(this._paneInvalidationMask(t,b.LIGHT_UPDATE))},l.prototype.setPriceAutoScale=function(t,e,i){t.setPriceAutoScale(e,i),this.invalidate(this._paneInvalidationMask(t,b.LIGHT_UPDATE))},l.prototype.restorePriceScaleState=function(t,e,i){t.restorePriceScaleState(e,i),this.invalidate(this._paneInvalidationMask(t,b.LIGHT_UPDATE))},l.prototype.resetPriceScale=function(t,e){t.resetPriceScale(e),this.invalidate(this._paneInvalidationMask(t,b.LIGHT_UPDATE))},l.prototype.updateScales=function(t,e){this._undoModel._chartWidget._updateScalesActions()},l.prototype.startScaleTime=function(t){this.m_timeScale.startScale(t)},l.prototype.scaleTimeTo=function(t){this.m_timeScale.scaleTo(t),this.recalculateAllPanes(),this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.endScaleTime=function(){this.m_timeScale.endScale(),this.invalidate(new b(b.LIGHT_UPDATE)),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.dataSources())},l.prototype.startScrollTime=function(t){this.m_timeScale.startScroll(t),this._isTimeScrolling=!0},l.prototype.scrollTimeTo=function(t){this.m_timeScale.scrollTo(t),this.recalculateAllPanes(),this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.endScrollTime=function(){this.m_timeScale.endScroll(),this.invalidate(new b(b.LIGHT_UPDATE)),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.dataSources()),this._isTimeScrolling=!1},l.prototype.recalcStudyBasedLineTools=function(){this.dataSources().forEach(function(t){t instanceof k&&t.recalcStudyIfNeeded&&t.recalcStudyIfNeeded()})},l.prototype.recalcVisibleRangeStudy=function(t,e){void 0!==this._recalcVRTimerId&&clearTimeout(this._recalcVRTimerId);var i=this;this._recalcVRTimerId=setTimeout(function(){i._recalcVisibleRangeStudy(t,e)},500)},l.prototype._recalcVisibleRangeStudy=function(t,e){var i,o,n,s,r,a,l,h,c,d,p,u,_,f,g;if(!this.timeScale().isEmpty()&&(i=this.timeScale().visibleBars(),o=this.mainSeries().nearestData(i.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),n=this.mainSeries().nearestData(i.lastBar(),TradingView.SEARCH_NEAREST_LEFT),s=o?o.index:void 0,r=n?n.index:void 0,a=s===this._oldStartVisibleIndex,l=r===this._oldEndVisibleIndex,!a||!l||e))for(this._oldStartVisibleIndex=s,this._oldEndVisibleIndex=r,h=0;h<t.length;h++)if(t[h]instanceof T){for(c=t[h],d=c.metaInfo().inputs,p=null,u=null,_=0;_<d.length;_++)"first_visible_bar_time"===d[_].id?(f=o&&o.value?o.value[TradingView.TIME_PLOT]:0,p=1e3*Math.floor(f)):"last_visible_bar_time"===d[_].id&&(f=n&&n.value?n.value[TradingView.TIME_PLOT]:0,u=1e3*Math.floor(f));g=c.properties().inputs,p&&(u?g.first_visible_bar_time.setValueSilently(p):g.first_visible_bar_time.setValue(p,!0)),u&&g.last_visible_bar_time.setValue(u,!0)}},l.prototype.resetTimeScale=function(){this.m_timeScale.restoreDefault(),this.recalculateAllPanes(),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.dataSources()),this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.restoreTimeScaleState=function(t){this.m_timeScale.restoreState(t),this.recalculateAllPanes(),this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.restoreFactoryDefaults=function(t){t.restoreFactoryDefaults(),this.recalcVisibleRangeStudy(this.dataSources(),!0),this.mainSeries().onChartStyleChanged()},l.prototype.setSelectedSource=function(t,e){if(!(this.m_selectedSource===t&&this._lastHittestData===e||t&&t.customization&&t.customization.disableSelection)){this._lastHittestData=e;var i=new b;this.m_selectedSource&&(this.m_selectedSource.updateAllViews(),TradingView.alertsDispatcher&&this.m_selectedSource.hasAlert.value()&&this.m_selectedSource.getAlert({fromCache:!0}).done(function(t){t&&t.set("selected",!1)})),this.m_selectedSource=t,this._selectedSourceChanged.fire(t),t&&(t.updateAllViews(),TradingView.alertsDispatcher&&t.hasAlert.value()&&t.getAlert({fromCache:!0}).done(function(t){t&&t.set("selected",!0)})),i.force=!0,this.invalidate(new b(b.LIGHT_UPDATE)),this.setHoveredSource(t,e)}},l.prototype.checkLineToolSelection=function(){this.m_selectedSource&&this.m_selectedSource instanceof c&&(this.m_selectedSource.calcIsActualSymbol(),this.m_selectedSource.isActualSymbol()||this.setSelectedSource(null))},l.prototype.onSelectedSourceChanged=function(){return this._selectedSourceChanged},l.prototype.setHoveredSource=function(t,e){if(this.m_hoveredSource!==t||this._lastHittestData!==e){this._lastHittestData=e;var i=null;this.m_hoveredSource&&(this.m_hoveredSource.updateAllViews(),i||(i=new b),TradingView.alertsDispatcher&&this.m_hoveredSource.hasAlert.value()&&this.m_hoveredSource.getAlert({fromCache:!0}).done(function(t){t&&t.set("hovered",!1)}),i.merge(this._paneInvalidationMask(this.paneForSource(this.m_hoveredSource),b.LIGHT_UPDATE))),this.m_hoveredSource=t,t&&(t.updateAllViews(),i||(i=new b),i.merge(this._paneInvalidationMask(this.paneForSource(t),b.LIGHT_UPDATE)),TradingView.alertsDispatcher&&t.hasAlert.value()&&t.getAlert({fromCache:!0}).done(function(t){t&&t.set("hovered",!0)})),i&&this.invalidate(i)}},l.prototype.selectedSource=function(){return this.m_selectedSource},l.prototype.hoveredSource=function(){return this.m_hoveredSource},l.prototype.lastHittestData=function(){return this._lastHittestData},l.prototype.invalidate=function(t){this._invalidateHandler&&this._invalidateHandler(t)},l.prototype.dataSources=function(){var t,e,i,o=[];for(o.push(this.m_crossHairSource),t=0;t<this.m_panes.length;++t)for(e=this.m_panes[t].dataSources(),i=0;i<e.length;i++)o.push(e[i]);return o},l.prototype.dataSourceForId=function(t){var e,i;for(i=0;i<this.m_panes.length;++i)if(e=this.m_panes[i].dataSourceForId(t))return e;return null},l.prototype.children=function(t){var e,i,o=this.dataSources(),n=[];for(e=0;e<o.length;e++)i=o[e],i.ownerSource()===t&&n.push(i);return n},l.prototype.setCurrentPosition=function(t,e,i,o){var n,s,r,a,l,h,d,p,u,_,f,g,m,v=NaN,y=Math.round(this.m_timeScale.coordinateToIndex(t));if(i&&(n=i.defaultPriceScale(),n.isEmpty()||(v=n.coordinateToPrice(e))),(this._lineBeingCreated||c.isLineTool(this.currentTool()))&&(v=this._magnet.align(v,y,i)),this._isTimeScrolling)return void this.m_crossHairSource.setPosition(this.m_crossHairSource.index,v,i);for(this.m_crossHairSource.setPosition(y,v,i),this.m_crossHairSource.dataWindowView().update(),s=this.m_panes,r=s.length;r--;)for(a=s[r].dataSources(),l=a.length;l--;)h=a[l].dataWindowView(),h&&h.update();this._lineBeingCreated?(this._lineBeingCreated.setLastPoint({index:y,price:v},o),this._lineBeingCreated.updateAllViews(),this.invalidate(new b(b.LIGHT_UPDATE))):this.crossHairSource().startMeasurePoint()?this.invalidate(new b(b.LIGHT_UPDATE)):this.invalidate(new b(b.UPDATE_CURSOR_ONLY)),this._isSettingsExternalPosition||(d=this._undoModel._chartWidget,d._chartWidgetCollection&&(p=this.mainSeries(),u=p.syncModel(),u&&(_=this.m_timeScale.points().roughTime(y,u.projectTime.bind(u)),f={timeStamp:_},g=i.mainDataSource(),g instanceof I&&(f.price=v,f.symbol=g.symbol()),f.syncModel=u,m=this._lineBeingCreated||this._linePointBeingEdited||this._sourceBeingMoved,m=m&&A.drawOnAllCharts().value(),d._chartWidgetCollection.syncCrosshair(f,d,m,o))))},l.prototype.clearCurrentPosition=function(){var t,e,i,o,n,s,r=this.crossHairSource();for(r.clearPosition(),r.dataWindowView().update(),t=this.m_panes,e=t.length;e--;)for(i=t[e].dataSources(),o=i.length;o--;)n=i[o].dataWindowView(),n&&n.update();this.invalidate(new b(b.UPDATE_CURSOR_ONLY)),s=this._undoModel._chartWidget,s._chartWidgetCollection&&s._chartWidgetCollection.syncCrosshair(NaN,s)},l.prototype.onSyncScrollNeeded=function(){var t,e,i,o=this.m_crossHairSource.index,n=this._undoModel._chartWidget;n._chartWidgetCollection&&(t=this.mainSeries(),e=t.syncModel(),e&&(i=1e3*this.m_timeScale.points().roughTime(o,e.projectTime.bind(e)),n._chartWidgetCollection.syncScroll(i,this)))},l.prototype.gotoTime=function(t,e){function i(){var e=p.tickMarks().indexToTime(p.tickMarks().minIndex),i=e.valueOf();return i-t}function o(e){var o,n,s,r,a;if(i()<0){for(o=p.tickMarks().nearestIndex(t),n=+u.bars().last(),o=Math.min(o,n),s=p.tickMarks().indexToTime(o).valueOf();s<t&&o<n;)o++,s=p.tickMarks().indexToTime(o).valueOf();return r=p.visibleBars(),a=r.lastBar()-r.firstBar(),!e&&r.contains(o)||(p.zoomToBarsRange(o-a/2,o+a/2),u.requestMoreData()),{index:o}}}var n,s,r,a,l,h,c,d,p=this.timeScale(),u=this.mainSeries();if(e&&e.model&&(n=u.syncModel(),n&&(s=this._createSyncPoint(e.model.mainSeries().syncModel(),n),t=1e3*s.sourceTimeToTargetTime(t/1e3))),e=e||{centerIfVisible:!0},t)this._scrollingState&&this._scrollingState.deferred.reject(),r=$.Deferred(),this._scrollingState={targetDate:t,deferred:r,centerIfVisible:e.centerIfVisible};else{if(!this._scrollingState)return TradingView.logError("scrollTo called without an argument"),$.Deferred().reject().promise();t=this._scrollingState.targetDate,r=this._scrollingState.deferred}return a=o(this._scrollingState.centerIfVisible),a||(l=p.tickMarks().minIndex,h=p.visibleBars(),c=h.lastBar()-h.firstBar(),u.endOfData()?(p.zoomToBarsRange(l-c/2,l+c/2),a={index:l,eod:!0}):(d=this.timeScale().tickMarks().estimateLeft(t),u.requestMoreData(Math.ceil(d+c/2)))),a&&(this.fullUpdate(),this._scrollingState=null,r.resolve(a)),r.promise()},l.prototype._createSyncPoint=function(t,e){var i,o,n=this._syncPointCache[t.uniqueId()];if(n){if(i=n[e.uniqueId()])return i}else this._syncPointCache[t.uniqueId()]={};return o=new M(t,e),this._syncPointCache[t.uniqueId()][e.uniqueId()]=o,o},l.prototype.setExternalPosition=function(t,e){var i,o,n,s,r,a,l,h,c,d,p,u,_;if(!Number.isNaN(t)&&isNumber(t.timeStamp)&&(o=this.mainSeries(),n=o.syncModel(),n&&(s=this._createSyncPoint(t.syncModel,n),r=s.sourceTimeToTargetTime(t.timeStamp),i=this.m_timeScale.points().roughIndex(r,n.distance.bind(n)))),a=this.mainSeries().symbol(),a===t.symbol)return this._isSettingsExternalPosition=!0,l=this.paneForSource(this.mainSeries()),h=this.m_timeScale.indexToCoordinate(i),c=this.mainSeries().priceScale().priceToCoordinate(t.price,!0),this.setCurrentPosition(h,c,l,e||{}),void delete this._isSettingsExternalPosition;for(isFinite(i)?this.crossHairSource().setPosition(i,NaN,null):(d=this.crossHairSource(),d.clearPosition(),d.dataWindowView().update()),p=this.dataSources(),u=p.length;u--;)_=p[u].dataWindowView(),_&&_.update();this.invalidate(new b(b.UPDATE_CURSOR_ONLY))},l.prototype.updateCrossHair=function(){this.m_crossHairSource.updateIndex()},l.prototype.updateTimeScale=function(t,e,i,o,n){var s,r,a;if(n)for(this.m_timeScale.reset(),s=this.dataSources(),r=0;r<s.length;r++)s[r].clearData&&s[r].clearData();this.m_timeScale.update(t,e,i,o),a="ChartModel.prototype.updateTimeScale("+t+","+e+","+i.length+","+o.length+","+n+")",a+="TimeScale: {first:"+this.m_timeScale.m_points.firstTimePointIndex()+",last:"+this.m_timeScale.m_points.lastTimePointIndex()+"}",TradingView.logDebugChart(a),this.recalculateAllPanes(),this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.recalculatePane=function(t){t&&t.recalculate()},l.prototype.paneForSource=function(t){for(var e=this.m_panes.length-1;e>=0;e--)if(this.m_panes[e].dataSources().indexOf(t)!==-1)return this.m_panes[e];return t instanceof v?this.paneForSource(this.m_mainSeries):null},l.prototype.recalculateAllPanes=function(){for(var t=0;t<this.m_panes.length;++t)this.m_panes[t].recalculate();this.timeScale().recalcLockedScale(),this.updateAllPaneViews()},l.prototype._invalidateBarColorerCaches=function(){var t,e,i=this.dataSources();for(t=0;t<i.length;++t)e=i[t],e instanceof I&&e.invalidateBarColorerCache()},l.prototype.addStrategySource=function(t){~this.strategySources.indexOf(t)||(this.strategySources.push(t),this.strategySources.change.fire())},l.prototype.removeStrategySource=function(t){var e=this.strategySources.indexOf(t);~e&&(this.strategySources.splice(e,1),this.strategySources.change.fire())},l.prototype.setActiveStrategySource=function(t){~this.strategySources.indexOf(t)&&this._activeStrategySource.setValue(t)},l.prototype.unsetActiveStrategySource=function(){this._activeStrategySource.setValue(null)},l.prototype.activeStrategySource=function(){return this._activeStrategySource},l.prototype.insertStudy=function(t,e,i){var o,n,s,r,a=null,l=["Study_ESD$TV_SPLITS@tv-scripting","Study_ESD$TV_DIVIDENDS@tv-scripting","Study_ESD$TV_SPLITS@tv-scripting","Volume@tv-basicstudies","Sessions@tv-basicstudies"];return l.indexOf(t.id)===-1&&TradingView.trackEvent("studies","Study_"+t.id),i||t.is_price_study?a=this.paneForSource(this.m_mainSeries):(a=this.createPane(void 0,!0),e&&e.paneSize&&a.setPaneSize(e.paneSize)),"Compare@tv-basicstudies"===t.id&&(TradingView.trackEvent("compare","symbol:"+e.inputs.symbol),this.m_mainSeries.priceScale().properties().log.setValue(!1),this.m_mainSeries.priceScale().properties().percentage.setValue(!0)),o=x(t,e,a,this.studyVersioning()),n=C(this,o,this.mainSeries(),t),n.start(),s=n.metaInfo().priceScale||E.SCALE_RIGHT,s===E.SCALE_RIGHT?r=a.rightPriceScale():s===E.SCALE_LEFT?r=a.leftPriceScale():t.is_price_study?r=null:(TradingView.logWarn("Cannot add study "+n.metaInfo().id+" with 'No Scale' setting, because study is not a price study. Using right price scale."),r=a.rightPriceScale()),i?a.addDataSource(n,null):a.addDataSource(n,r),n.properties().linkedToSeries&&n.properties().linkedToSeries.value()&&n.setOwnerSource(this.mainSeries()),this.recalculatePane(a),this.invalidate(new b(b.FULL_UPDATE)),this._invalidateBarColorerCaches(),this.recalcVisibleRangeStudy(this.dataSources(),!0),n},l.prototype.replaceStudyStub=function(t,e){var i,o,n,s=this.paneForSource(t);return null!==s&&(i=t.isNoScale()?null:t.priceScale(),o=t.zorder(),n=t.ownerSource(),s.insertDataSource(e,i,o),e.setOwnerSource(n),this.removeSource(t),e.start(),this.recalculatePane(s),this.invalidate(new b(b.FULL_UPDATE)),!0)},l.prototype.insertStudyStub=function(t){var e=this.mainSeries(),i=this.paneForSource(e),o=new L(this,null,t);return i.addDataSource(o,null),this.recalculatePane(i),this.invalidate(new b(b.FULL_UPDATE)),o},l.prototype.removeStudyStub=function(t){var e=this.dataSourceForId(t);return void 0===e?(TradingView.logNormal("StudyStub id="+t+" is not found in chart model"),!1):(this.removeSource(e),!0)},l.prototype.detachSource=function(t,e){var i=this.paneForSource(t);if(i)return i.removeDataSource(t),i.isEmpty()?(this._lineBeingCreated&&i===this._paneBeingCreatedLineOn&&this.cancelCreatingLine(),this.removePane(i,e),!0):(this.invalidate(new b(b.FULL_UPDATE)),!1)},l.prototype.removeSource=function(t,e){var i,o,n,s;if(t===this.m_selectedSource&&this.setSelectedSource(null),t===this._sourceBeingMoved&&(this._sourceBeingMoved=null,this._linePointBeingMoved=null),t.stop&&t.stop(),i=this.detachSource(t,e),t.metaInfo&&t.metaInfo()&&"Compare@tv-basicstudies"===t.metaInfo().id){for(o=this.paneForSource(this.m_mainSeries),n=o.dataSources(),s=0;s<n.length;s++)if(n[s].metaInfo&&"Compare@tv-basicstudies"===n[s].metaInfo().id)return;this.m_mainSeries.priceScale().properties().percentage.setValue(!1)}return this.invalidate(new b(b.FULL_UPDATE)),this._invalidateBarColorerCaches(),t.linkKey&&A.removeLineTool({model:this,linkKey:t.linkKey}),i},l.prototype.move=function(t,e,i){var o,n,s,r,a=this.children(t),l=this.paneForSource(t),h=e?e.priceScaleName(i):"right",c=l===e;if(c){for(o=e.priceScaleByName(h),n=0;n<a.length;n++)e.move(a[n],o);e.move(t,o)}else{for(s=e||this.createPane(),r=s.priceScaleByName(h),n=0;n<a.length;n++)this.detachSource(a[n]);for(n=0;n<a.length;n++)s.addDataSource(a[n],r);this.detachSource(t),s.addDataSource(t,r)}this.invalidate(new b(b.FULL_UPDATE))},l.prototype.isSingleInstanceLineTool=function(t){return"LineStudyMtpRiskReward"===t||"LineStudyMtpAnalysis"===t},l.prototype._externalTimeStamp=function(t){var e=this.mainSeries().syncModel();return this.m_timeScale.points().roughTime(t,e&&e.projectTime.bind(e))},l.prototype.createLineTool=function(t,e,i,o,n){var r,a,l,c,d,p,u,_;return h.isValid(i)?(this.isSingleInstanceLineTool(i)&&this._undoModel.removeAllDrawingTools(i),TradingView.trackEvent("drawings","Study_Drawing_"+i),r=h.create(i,this,o,null,t.mainDataSource()),a=!r.linkKey&&!n,A.drawOnAllCharts().value()?r.linkKey=n||TradingView.randomHash():r.linkKey=n,r.toolname=i,r.setOwnerSource(t.mainDataSource()),l=t.defaultPriceScale(),t.addDataSource(r,l),d=this.m_timeScale.indexToCoordinate(e.index),p=l.priceToCoordinate(e.price),r.isFixed()?c=r.addFixedPoint(new s.Point(d,p)):(u=r.constructor,u.skipMagnetting||(e.price=this._magnet.align(e.price,e.index,t)),c=r.addPoint(e)),c||(this._lineBeingCreated=r,this._paneBeingCreatedLineOn=t),a&&r.enableCurrentIntervalVisibility(),this.invalidate(new b(b.FULL_UPDATE)),n||!A.drawOnAllCharts().value()||r.properties().singleChartOnly||(_=this._externalTimeStamp(e.index),A.createLineTool({point:{price:e.price,timeStamp:_},linetool:i,properties:r.properties(),symbol:this.mainSeries().symbol(),model:this,linkKey:r.linkKey})),r):null},l.prototype.lineBeingCreated=function(){return this._lineBeingCreated},l.prototype.paneBeingCreatedLineOn=function(){return this._paneBeingCreatedLineOn},l.prototype.coninueCreatingLine=function(t,e,i,o){var n,s,r,a,l,h=this.paneForSource(this._lineBeingCreated);return t.price=this._magnet.align(t.price,t.index,h),n=this._lineBeingCreated.addPoint(t,e,i),s=this._lineBeingCreated,this._lineBeingCreated.updateAllViews(),r=new b(b.LIGHT_UPDATE),a=null,n&&(a={points:this._lineBeingCreated._timePoint,interval:this.mainSeries().interval()},this._paneBeingCreatedLineOn=null,this._lineBeingCreated=null,r.force=!0),this.invalidate(r),o||!A.drawOnAllCharts().value()||s.properties().singleChartOnly||(l=this._externalTimeStamp(t.index),A.continueLineTool({point:{price:t.price,timeStamp:l},envState:e,finalState:a,model:this})),n},l.prototype.cancelCreatingLine=function(){if(this._lineBeingCreated){var t=this._lineBeingCreated;this.removeSource(this._lineBeingCreated),this._lineBeingCreated=null,this._lineCancelled.fire(),A.drawOnAllCharts().value()&&!t.properties().singleChartOnly&&A.cancelLineTool({model:this})}},l.prototype.startChangingLinetool=function(t,e,i,o){var n,s,r;this._lineBeingEdited=t,this._linePointBeingEdited=i,this._lineBeingEdited.startChanging(i,e),n=this.paneForSource(t),e.price=this._magnet.align(e.price,e.index,n),this._lineBeingEdited.startDragPoint&&this._lineBeingEdited.startDragPoint(i,e),this._lineBeingEdited.setPoint(i,e,o),this._lineBeingEdited.updateAllViews(),s=this._paneInvalidationMask(n,b.LIGHT_UPDATE),s.force=!0,this.invalidate(s),t.linkKey&&!t.properties().singleChartOnly&&(r=this._externalTimeStamp(e.index),A.startChangingLineTool({linkKey:t.linkKey,model:this,symbol:this.mainSeries().symbol(),point:{price:e.price,timeStamp:r},pointIndex:i,envState:o}))},l.prototype.lineBeingEdited=function(){return this._lineBeingEdited},l.prototype.linePointBeingEdited=function(){return this._linePointBeingEdited},l.prototype.changeLinePoint=function(t,e){var i,o,n,s,r=this.paneForSource(this._lineBeingEdited);void 0!==t.x&&void 0!==t.y?(n=this._lineBeingEdited.priceScale(),i=n.coordinateToPrice(t.y),o=Math.round(this.timeScale().coordinateToIndex(t.x)),i=this._magnet.align(i,o,r),this._lineBeingEdited.setPoint(this._linePointBeingEdited,{price:i,index:o},e)):this._lineBeingEdited.setPoint(this._linePointBeingEdited,t,e),this._lineBeingEdited.updateAllViews(),this.invalidate(new b(b.LIGHT_UPDATE)),this._lineBeingEdited.linkKey&&!this._lineBeingEdited.properties().singleChartOnly&&(s=this._externalTimeStamp(o),A.changeLineTool({linkKey:this._lineBeingEdited.linkKey,model:this,symbol:this.mainSeries().symbol(),point:{price:i,timeStamp:s},envState:e}))},l.prototype.endChangingLinetool=function(t){var e,i,o=this._lineBeingEdited;this._lineBeingEdited.endChanging(!1,t),this._lineBeingEdited=null,this._linePointBeingEdited=null,e=new b(b.LIGHT_UPDATE),e.force=!0,this.invalidate(e),i={points:o._timePoint,interval:this.mainSeries().interval()},o.linkKey&&!o.properties().singleChartOnly&&A.finishChangingLineTool({model:this,linkKey:o.linkKey,symbol:this.mainSeries().symbol(),finalState:i})},l.prototype.startMovingSource=function(t,e,i){var o,n,s;this._sourceBeingMoved=t,this._linePointBeingMoved=i,this._sourceBeingMoved.startMoving(e,i),o=this.paneForSource(this._sourceBeingMoved),n=this._paneInvalidationMask(o,b.LIGHT_UPDATE),n.force=!0,this.invalidate(n),t.linkKey&&!t.properties().singleChartOnly&&(s=this._externalTimeStamp(e.index),
A.startMovingLineTool({linkKey:t.linkKey,model:this,symbol:this.mainSeries().symbol(),point:{price:e.price,timeStamp:s}}))},l.prototype.sourceBeingMoved=function(){return this._sourceBeingMoved},l.prototype.moveSource=function(t){if(this._sourceBeingMoved.move(t,this._linePointBeingMoved),this.invalidate(new b(b.LIGHT_UPDATE)),this._sourceBeingMoved.linkKey&&!this._sourceBeingMoved.properties().singleChartOnly){var e=this._externalTimeStamp(t.index);A.moveLineTool({linkKey:this._sourceBeingMoved.linkKey,model:this,point:{price:t.price,timeStamp:e}})}},l.prototype.endMovingSource=function(t){var e,i,o=this._sourceBeingMoved,n=this.paneForSource(this._sourceBeingMoved);this._sourceBeingMoved.endMoving(t),this._sourceBeingMoved=null,this._linePointBeingMoved=null,e=this._paneInvalidationMask(n,b.LIGHT_UPDATE),e.invalidateAll(b.LIGHT_UPDATE),e.force=!0,this.invalidate(e),o instanceof c&&(i={points:o._timePoint,interval:this.mainSeries().interval()},o.linkKey&&!o.properties().singleChartOnly&&A.finishMovingLineTool({linkKey:o.linkKey,model:this,finalState:i}))},l.prototype.finishLineTool=function(t){var e=this.lineBeingCreated();e&&(e.finish&&e.finish(),!t&&A.drawOnAllCharts().value()&&e.linkKey&&!e.properties().singleChartOnly&&A.finishLineTool({linkKey:e.linkKey,model:this}))},l.prototype.calculateDefaultTags=function(){var t,e,i=[],o=this.dataSources();for(t=0;t<o.length;t++)e=o[t],e.tags&&(i=i.concat(e.tags()));return i},l.prototype.changeZOrder=function(t,e){var i=this.paneForSource(t);i.changeZOrder(t,e),this.invalidate(new b(b.FULL_UPDATE))},l.prototype.sendToBack=function(t){var e=this.paneForSource(t);e.sendToBack(t),this.invalidate(new b(b.FULL_UPDATE))},l.prototype.bringToFront=function(t){var e=this.paneForSource(t);e.bringToFront(t),this.invalidate(new b(b.FULL_UPDATE))},l.prototype.onTagsChanged=function(){return this._tagsChanged},l.prototype.onPaneTagsChanged=function(){this._tagsChanged.fire()},l.prototype.setTimeViewport=function(t,e){this.timeScale().zoomToBarsRange(t,e),this.recalculateAllPanes(),this.invalidate(new b(b.LIGHT_UPDATE))},l.prototype.zoomToViewport=function(t,e,i,o,n){var s,a,l;this.setTimeViewport(t,e),s=Math.min(i,o),a=Math.max(i,o),l=n.defaultPriceScale(),l.setAutoScale(!1),l.isLog()&&(s=l.priceToLogical(s),a=l.priceToLogical(a)),l.setPriceRange(new r(s,a)),this.recalculateAllPanes(),this.invalidate(this._paneInvalidationMask(n,b.LIGHT_UPDATE))},l.prototype.clearAllStudies=function(){var t,e=this.dataSources();for(t=0;t<e.length;t++)e[t].clearData&&e[t].clearData()},l.prototype.allStudies=function(){var t,e,i,o,n,s,r=[],a=this.m_panes,l=a.length;for(t=0;t<l;++t)for(e=a[t],i=e.dataSources(),o=i.length,n=0;n<o;++n)s=i[n],s instanceof T&&r.push(s);return r},l.prototype.allLineTools=function(){var t,e,i,o,n,s,r=[],a=this.m_panes,l=a.length;for(t=0;t<l;++t)for(e=a[t],i=e.dataSources(),o=i.length,n=0;n<o;++n)s=i[n],TradingView.isInherited(s.constructor,c)&&r.push(s);return r},l.prototype.backgroundColor=function(){return this._properties.paneProperties.background._value},l.prototype.backgroundCounterColor=function(){return new w(this.backgroundColor()).blackWhiteContrast()},l.prototype.isDark=function(){return"white"===this.backgroundCounterColor()},l.prototype.canZoomIn=function(){return this.m_timeScale.canZoomIn()},l.prototype.canZoomOut=function(){return this.m_timeScale.canZoomOut()},l.prototype.updateAllVolumeStudies=function(){var t,e,i,o,n,s,r=this.m_panes;for(t=r.length;t--;)for(e=!1,i=r[t],o=i.dataSources(),n=o.length;n--;)s=o[n],s instanceof T&&"Volume"===s.metaInfo().shortId&&(s.updateAllViews(),e||(this.updatePane(i),e=!0))},l.prototype.alertsList=function(){return this._alertsList},l.prototype._modelIntervals=[],l.prototype.setInterval=function(t,e){var i=setInterval(t,e);return this._modelIntervals.push(i),i},l.prototype.clearInterval=function(t){clearInterval(t);var e=this._modelIntervals.indexOf(t);e>-1&&this._modelIntervals.splice(e,1)},l.prototype.clearIntervals=function(){for(var t=0;t<this._modelIntervals.length;t++)clearInterval(this._modelIntervals[t]);this._modelIntervals=[]},l.prototype.destroy=function(){this.clearIntervals()},l.prototype.countUserStudies=function(){var t,e,i,o,n=0;for(t=0;t<this.m_panes.length;t++)for(e=this.m_panes[t].dataSources(),i=0;i<e.length;i++)o=e[i],o instanceof T&&o.showInObjectTree()&&n++;return n},l.prototype.isJustClonedChart=function(){return this._undoModel.isJustClonedChart()},l.prototype.copyToOtherCharts=function(t){var e,i,o,n;t.linkKey=t.linkKey||TradingView.randomHash(),e=this,i=t.state(),o=this.mainSeries(),n=o.syncModel(),n&&(i.points=t._timePoint.map(function(t){var i=e.timeScale().timePointToIndex(t.time_t)+t.offset;return{price:t.price,timeStamp:e._externalTimeStamp(i)}}),i.linetool=t.getType(),i.model=this,i.symbol=this.mainSeries().symbol(),A.copyLineTool(i))},l.prototype.restoreSource=function(t,e,i,o,n){var s,r,l,h,c,d,p,u;return s=t?this.createPane(e):this.panes()[e],l=o.type,r=l.toLowerCase().startsWith("study")?s._restoreStudy(o):s._restoreLineTool(o),h=r.ownerSource()?r.ownerSource().priceScale():s.priceScaleByName(n),h?(r.setPriceScale(h),h.addDataSource(r)):(h=new a(s._properties.overlayPropreties,this.properties().scalesProperties),h.setHeight(s.m_height),c=r.metaInfo&&"Volume@tv-basicstudies"===r.metaInfo().id,d=c?.75:s.m_rightPriceScale.topMargin(),p=c?0:s.m_rightPriceScale.bottomMargin(),h.setTopMargin(d),h.setBottomMargin(p),h.addDataSource(r),r.setPriceScale(h),r._isOverlay=!0),u=null,o.ownerSource&&(u=s.dataSourceForId(o.ownerSource)),r.setOwnerSource(u),r.setPriceScale(h),r.start(),r.restore&&r.restore(),t&&s.restoreState(i),this.recalculateAllPanes(),this.mainSeries().invalidateBarColorerCache(),this.invalidate(new b(b.FULL_UPDATE,!0)),r.linkKey&&A.restoreLineTool({model:this,linkKey:r.linkKey,state:{restorePane:t,paneIndex:e,paneState:i,sourceState:o,priceScaleName:n}}),r},l.prototype.restoreLineToolState=function(t,e){t.restorePoints(e.points,e.indexes||[]),t.properties().merge(e.state),t.restoreData&&t.restoreData(e),t.createServerPoints(),this.invalidate(new b(b.FULL_UPDATE)),t.linkKey&&A.restoreLineToolState({model:this,linkKey:t.linkKey,state:e})},t.exports=l}).call(e,i(28),i(1),i(43),i(21),i(85),i(118))},function(t,e,i){"use strict";function o(){}var n=i(125),s=i(213);o.isValid=function(t){var e=n[t]||s[t];return!!e},o.create=function(t,e,i,r,a){var l,h;return assert(o.isValid(t),"Unknown line tool: "+t),l=n[t]||s[t],h="LineToolVbPFixed"===t?new l(e,i,r,a):"LineToolRegressionTrend"===t?new l(e,i,r):["LineStudyMtpAnalysis","LineStudyMtpDecisionPoint","LineStudyMtpRiskReward","LineStudyMtpElliotWaveMain","LineStudyMtpElliotWaveMajor","LineStudyMtpElliotWaveMinor","LineStudyMtpDownWave1OrA","LineStudyMtpDownWave2OrB","LineStudyMtpDownWave3","LineStudyMtpDownWave4","LineStudyMtpDownWave5","LineStudyMtpDownWaveC","LineStudyMtpUpWave1OrA","LineStudyMtpUpWave2OrB","LineStudyMtpUpWave3","LineStudyMtpUpWave4","LineStudyMtpUpWave5","LineStudyMtpUpWaveC"].indexOf(t)>=0?new l(e,i,r):new l(e,i)},t.exports=o},function(t,e,i){"use strict";for(var o={LineToolFibRetracement:i(126),LineToolFibChannel:i(133),LineToolFibSpeedResistanceArcs:i(135),LineToolProjection:i(136),LineToolTrendBasedFibExtension:i(138),LineToolElliott:i(139).LineToolElliott,LineToolFibCircles:i(140).LineToolFibCircles,LineToolTrading:i(143),LineToolVbPFixed:i(144),LineStudyMtp:i(160),LineToolVertLine:i(146).LineToolVertLine,LineToolBarsPattern:i(161),LineToolTrendBasedFibTime:i(162),LineToolFibTimeZone:i(163),LineToolCircleLines:i(164),LineToolDateRange:i(165),LineToolPriceRange:i(166),LineToolDateAndPriceRange:i(167),LineToolParallelChannel:i(134).LineToolParallelChannel,LineToolTrendAngle:i(168),LineToolTrendLine:i(131).LineToolTrendLine,LineToolArrowMark:i(169).LineToolArrowMark,LineToolExecution:i(121).LineToolExecution,LineToolPitchfan:i(171),LineToolGannSquare:i(173),LineToolFibSpeedResistanceFan:i(174),LineToolGannComplex:i(175),LineToolGannFan:i(176),LineToolFibWedge:i(137).LineToolFibWedge,LineToolPitchfork:i(172).LineToolPitchfork,LineToolDisjointAngle:i(177),LineToolFlatBottom:i(178),LineToolIcon:i(179),LineToolRotatedRectangle:i(180),LineToolFibSpiral:i(181),LineToolHeadAndShoulders:i(182),LineToolTriangle:i(183).LineToolTriangle,LineToolTrianglePattern:i(184),LineTool5PointsPattern:i(185).LineTool5PointsPattern,LineToolThreeDrivers:i(186),LineToolABCD:i(187),LineToolRiskReward:i(188).LineToolRiskReward,LineToolPolyline:i(189),LineToolPrediction:i(190),LineToolPriceLabel:i(192),LineToolNote:i(193).LineToolNote,LineToolNoteAbsolute:i(193).LineToolNoteAbsolute,LineToolBrush:i(194),LineToolArc:i(195),LineToolCallout:i(196),LineToolBalloon:i(197),LineToolText:i(104).LineToolText,LineToolHorzLine:i(102).LineToolHorzLine,LineToolHorzRay:i(198),LineToolRectangle:i(129).LineToolRectangle,LineToolEllipse:i(199),LineToolTimeCycles:i(200),LineToolSineLine:i(201),LineToolGhostFeed:i(202),LineToolBezierQuadro:i(203).LineToolBezierQuadro,LineToolBezierCubic:i(203).LineToolBezierCubic,LineToolArrow:i(204),LineToolRay:i(205),LineToolExtended:i(206),LineToolSchiffPitchfork:i(207),LineToolSchiffPitchfork2:i(208),LineToolInsidePitchfork:i(209),LineToolTextAbsolute:i(104).LineToolTextAbsolute,LineToolArrowMarkLeft:i(169).LineToolArrowMarkLeft,LineToolArrowMarkRight:i(169).LineToolArrowMarkRight,LineToolArrowMarkUp:i(169).LineToolArrowMarkUp,LineToolArrowMarkDown:i(169).LineToolArrowMarkDown,LineToolFlagMark:i(210),LineToolCypherPattern:i(185).LineToolCypherPattern,LineToolElliottImpulse:i(139).LineToolElliottImpulse,LineToolElliottTriangle:i(139).LineToolElliottTriangle,LineToolElliottTripleCombo:i(139).LineToolElliottTripleCombo,LineToolElliottCorrection:i(139).LineToolElliottCorrection,LineToolElliottDoubleCombo:i(139).LineToolElliottDoubleCombo,LineToolRiskRewardLong:i(188).LineToolRiskRewardLong,LineToolRiskRewardShort:i(188).LineToolRiskRewardShort,LineToolPosition:i(211),LineToolOrder:i(212)},n=Object.keys(o),s=n.length;s--;)TradingView[n[s]]=o[n[s]];t.exports=o},function(t,e,i){(function(e){"use strict";function o(){l.call(this)}function n(t,e){c.call(this,t,e),this._rendererCache={},this._invalidated=!0}function s(t,e){this._constructor="LineToolFibRetracement";var i=e||this.createPropertiesObject("linetoolfibretracement");h.call(this,t,new n(this,t),i),this.version=s.version,this._properties._stateVersion=1,t._fibRetracementLabelsCache||(t._fibRetracementLabelsCache=new o)}var r=i(127),a=i(129).RectangleTransparencyRenderer,l=i(130),h=i(74).LineDataSource,c=i(103),d=i(131).TrendLineRenderer,p=i(132),u=i(94),_=i(98);inherit(o,l),o.prototype.levelsCount=function(){return s.LevelsCount},inherit(n,c),n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){var t,e,i,o,n,r,a,l,h,d,p,u,_,f;if(c.prototype.update.call(this),this._cacheState=this._model._fibRetracementLabelsCache.updateSource(this._source),!(this._source.points().length<2)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty()&&(t=this._source.points()[0],e=this._source.points()[1],i=!1,o=this._source.properties(),o.reverse&&o.reverse.value()&&(i=o.reverse.value()),this._levels=[],n=i?e.price-t.price:t.price-e.price,r=i?t.price:e.price,!this._source.priceScale().isPercent()||(a=this._source.ownerSource().firstValue(),null!==a)))for(l=1;l<=s.LevelsCount;l++)h="level"+l,d=o[h],d.visible.value()&&(p=d.coeff.value(),u=d.color.value(),_=r+p*n,this._source.priceScale().isPercent()&&(_=this._source.priceScale().priceRange().convertToPercent(_,a)),f=this._source.priceScale().priceToCoordinate(_),this._levels.push({color:u,y:f,linewidth:o.levelsStyle.linewidth.value(),linestyle:o.levelsStyle.linestyle.value(),index:l}))},n.prototype.renderer=function(){var t,i,o,n,s,r,l,c,f,g,m,v,y,b,w,S,T,C,x,P,L,k;if(this._invalidated&&(this._updateImpl(),this._invalidated=!1),t=new _,this._points.length<2)return t;for(i=this._points[0],o=this._points[1],n=Math.min(i.x,o.x),s=Math.max(i.x,o.x),r=this._source.properties(),l=r.fillBackground.value(),c=r.transparency.value(),f=r.extendLines.value()?this._model.timeScale().width():s,g=this._model._fibRetracementLabelsCache,m=g.canvas().get(0),v=0;v<this._levels.length;v++)if(v>0&&l&&(y=this._levels[v-1],i=new e.Point(n,this._levels[v].y),o=new e.Point(f,y.y),b={},b.points=[i,o],b.color=this._levels[v].color,b.linewidth=0,b.backcolor=this._levels[v].color,b.fillBackground=!0,b.transparency=c,t.append(new a(b))),i=new e.Point(n,this._levels[v].y),o=new e.Point(s,this._levels[v].y),w={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._levels[v].color,linewidth:this._levels[v].linewidth,linestyle:this._levels[v].linestyle,extendleft:!1,extendright:r.extendLines.value(),leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},S=new u(u.MOVEPOINT,null,this._levels[v].index),t.append(new d(w,S)),r.showCoeffs.value()||r.showPrices.value()){if(!this._cacheState.preparedCells)continue;if(T=this._cacheState.preparedCells.cells[this._levels[v].index-1],!T)continue;switch(r.horzLabelsAlign.value()){case"left":C=i;break;case"center":C=i.add(o).scaled(.5),C.x+=T.width/2,C.x=Math.round(C.x);break;case"right":r.extendLines.value()?C=new e.Point(f-4,this._levels[v].y):(C=new e.Point(f+4,this._levels[v].y),C.x+=T.width,C.x=Math.round(C.x))}x={left:T.left,top:g.topByRow(this._cacheState.row),width:T.width,height:g.rowHeight(this._cacheState.row)},P={left:C.x-x.width,top:C.y,width:T.width,height:x.height},L=r.vertLabelsAlign.value(),"middle"===L&&(P.top-=P.height/2),"bottom"===L&&(P.top-=P.height),k=new p(m,x,P),t.append(k)}return r.trendline.visible.value()&&(w={points:[this._points[0],this._points[1]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:r.trendline.color.value(),linewidth:r.trendline.linewidth.value(),linestyle:r.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},t.append(new d(w))),this.addAnchors(t),t},inherit(s,h),s.version=2,s.LevelsCount=24,s.prototype.stop=function(){h.prototype.stop.call(this),this._model._fibRetracementLabelsCache.removeSource(this.id())},s.prototype.pointsCount=function(){return 2},s.prototype.title=function(){return"Fib Retracement"},s.prototype.migrateVersion=function(t,e,i){1===t&&this.properties().extendLines.setValue(!0)},s.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},s.prototype.createPropertiesObject=function(t,e,i){return new r(t,e,i,{range:[1,24],names:["coeff","color","visible"]})},t.exports=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e,i,o){this._map=$.extend({},this._map,o),e&&(e=this.unpackLevels(e)),s.call(this,t,e,i),this.updateCollectibleProperty()}var n=i(19).isSameType,s=i(80).DefaultProperty,r=i(128);inherit(o,s),o.prototype.state=function(t,i){t=t||[],t.push("__collectibleLines");var o=e.prototype.state.call(this,t);return i?o:this.packLevels(o)},o.prototype.clone=function(){var t=this.state();return this.__collectibleLines&&(t.__collectibleLines=this.__collectibleLines.state()),new o(this._defaultName,t)},o.prototype.merge=function(t){e.prototype.merge.call(this,this.unpackLevels(t)),this.updateCollectibleProperty()},o.prototype._map={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:Object,unpack:Array}},o.prototype._packLvlTpl=function(){return[]},o.prototype._unpackLvlTpl=function(){return{}},o.prototype._packLvlFill=function(t,e,i,o){return o.push(i[e]),o},o.prototype._unpackLvlFill=function(t,e,i,o){return o[e]=i[t],o},o.prototype._iterateLevels=function(t,e){var i,o,s,r,a;for(i in this._map.prefixes)for(o=(this._map.prefixes[i]||"")+"level",s=this._map.range[0];s<=this._map.range[1];s++)if(t[o+s]&&n(t[o+s],e.typecheck())){r=e.tpl();for(a in this._map.names)r=e.fill(a,this._map.names[a],t[o+s],r);t[o+s]=r}return t},o.prototype.packLevels=function(t){return this._iterateLevels(t,{tpl:this._packLvlTpl,fill:this._packLvlFill,typecheck:this._map.typecheck.pack})},o.prototype.unpackLevels=function(t){return this._iterateLevels(t,{tpl:this._unpackLvlTpl,fill:this._unpackLvlFill,typecheck:this._map.typecheck.unpack})},o.prototype.saveDefaults=function(){TradingView.saveDefaults(this._defaultName,this.state(this._exclusions,!0))},o.prototype.updateCollectibleProperty=function(){var t,e;this.__collectibleLines&&(t=this,e=[],this.__collectibleLines._childs.forEach(function(i){var o,n=t.__collectibleLines[i].value(),s=n.split("."),r=t[s[0]];for(o=1;o<s.length&&r;++o)r=r[s[o]];r&&e.push({property:r.color,defaultValue:r.color.value()})}),this.collectibleColors?this.collectibleColors.reloadProperties(e):this.collectibleColors=new r(e))},t.exports=o}).call(e,i(69))},function(t,e,i){(function(e){"use strict";function i(t){e.call(this,""),this.subscribe(this,i.prototype.checkSelfColor),this.reloadProperties(t)}inherit(i,e),i.prototype.reloadProperties=function(t){for(;this._childs.length>0;)this.removeProperty(this._childs[0]);this._initValues=[];for(var e=0;e<t.length;++e)this._initValues.push(t[e].defaultValue),this.addChild(e,t[e].property);this.checkSelfColor()},i.prototype.setValue=function(t,i){if(this._value!==t||i){var o=this;this._childs.forEach(function(e){o[e].setValue(t||o._initValues[e])}),e.prototype.setValue.call(this,t,i)}},i.prototype.checkSelfColor=function(){var t,i=!0;for(t=0;t<this._initValues.length;++t)if(this[t].value()!==this[0].value()){i=!1;break}e.prototype.setValue.call(this,i?this[0].value():"")},t.exports=i}).call(e,i(69))},function(t,e,i){(function(t){"use strict";function o(t,e,i){this._data=t,this._hittestResult=e||new h(h.MOVEPOINT),this._backHittestResult=i||new h(h.MOVEPOINT_BACKGROUND)}function n(t,e){l.call(this,t,e),this._invalidated=!0}function s(t,e){this._constructor="LineToolRectangle";var i=e||new d("linetoolrectangle");a.call(this,t,new n(this,t),i)}function r(t,e,i){o.call(this,t,e,i)}var a=i(74).LineDataSource,l=i(103),h=i(94),c=i(98),d=i(80).DefaultProperty;o.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency)},o.prototype.draw=function(t){var e,i,o;this._data.points.length<2||(t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,e=this._data.points[0],i=this._data.points[1],o=i.substract(e),t.beginPath(),t.rect(e.x,e.y,o.x,o.y),this._data.linewidth>0&&t.stroke(),this._data.fillBackground&&(t.fillStyle=this.getColor(),t.fill()))},o.prototype.hitTest=function(e){var i,o,n,s,r,a,l,h,c,d;return this._data.points.length<2||this._data.nohittest?null:(i=3,o=this._data.points[0],n=this._data.points[1],s=new t.Point(n.x,o.y),r=new t.Point(o.x,n.y),a=t.distanceToSegment(o,s,e),a.distance<=i?this._hittestResult:(a=t.distanceToSegment(s,n,e),a.distance<=i?this._hittestResult:(a=t.distanceToSegment(n,r,e),a.distance<=i?this._hittestResult:(a=t.distanceToSegment(r,o,e),a.distance<=i?this._hittestResult:this._data.fillBackground&&(l=Math.min(o.x,n.x),h=Math.max(o.x,n.x),c=Math.min(o.y,n.y),d=Math.max(o.y,n.y),o=new t.Point(l,c),n=new t.Point(h,d),t.pointInRect(e,o,n))?this._backHittestResult:null))))},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var e,i,n,s,r,a;return this._invalidated&&this.updateImpl(),e={},e.points=this._points,e.color=this._source.properties().color.value(),e.linewidth=this._source.properties().linewidth.value(),e.backcolor=this._source.properties().backgroundColor.value(),e.fillBackground=this._source.properties().fillBackground.value(),e.transparency=this._source.properties().transparency.value(),this.isAnchorsRequired()?(i=new c,i.append(new o(e)),n=this._points[0],s=this._points[1],r=new t.Point(n.x,s.y),r.data=2,a=new t.Point(s.x,n.y),a.data=3,i.append(this.createLineAnchor({points:[n,s,r,a]})),i):new o(e)},inherit(s,a),s.prototype.pointsCount=function(){return 2},s.prototype.title=function(){return"Rectangle"},s.prototype.setPoint=function(t,e,i){var o,n,s;return t<2?void a.prototype.setPoint.call(this,t,e,i):(i&&i.shift&&this._properties.snapTo45Degrees&&(o=this.points()[0],n=this.points()[1],s={price:2===t?o.price:n.price,index:2===t?n.index:o.index},this._snapPoint45Degree(e,s)),this._convertPriceFromPercentIfNeeded(e),3===t?(this._points[0].price=e.price,this._points[1].index=e.index):(this._points[1].price=e.price,this._points[0].index=e.index),void this.normalizePoints())},inherit(r,o),r.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency,!0)},e.RectangleRenderer=o,e.RectangleTransparencyRenderer=r,e.LineToolRectangle=s}).call(e,i(21))},function(t,e,i){"use strict";function o(){this._registeredSources={},this._sourcesToRow={},this._rowsToSources={},this._currentSymbol="",this._actualCapacity=0,this._actualWidth=1,this._numericFormatter=new r,this._percentageFormatter=new s}var n=i(82),s=n.PercentageFormatter,r=n.NumericFormatter;o.prototype.levelsCount=function(){return 0},o.prototype.topByRow=function(t){return t*o.ROW_HEIGHT},o.prototype.rowHeight=function(t){return o.ROW_HEIGHT},o.prototype.canvas=function(){if(!this._canvas){this._canvas=$("<canvas>"),this._cache=this._canvas.get(0).getContext("2d"),this._canvas.prop("width",100).css("position","absolute").css("top",0).css("z-index",1e3).css("left",0);var t=this._canvas.get(0).getContext("2d");t.font="12px Verdana"}return this._canvas},o.ROW_HEIGHT=14,o.prototype.points=function(t){return[t.points()[0],t.points()[1]]},o.prototype.startPoint=function(t,e){var i=e?t.points()[0]:t.points()[1];return i},o.prototype.priceRange=function(t,e){var i=this.points(t),o=i[0],n=i[1],s=e?n.price-o.price:o.price-n.price;return s},o.prototype.sourceIsReady=function(t){return t.points().length>=2},o.prototype._calculateWidth=function(t){var e,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T;if(!this.sourceIsReady(t))return null;if(e=this.canvas().get(0).getContext("2d"),e.font="12px Verdana",i=!!t.properties().showPrices&&t.properties().showPrices.value(),o=!!t.properties().coeffsAsPercents&&t.properties().coeffsAsPercents.value(),n=t.properties().showCoeffs.value(),s=t.priceScale().formatter(),r=this.points(t),a=r[0],l=r[1],!a||!l)return null;if(h=!1,c=t.properties(),c.reverse&&c.reverse.value()&&(h=c.reverse.value()),d=this.priceRange(t,h),p=this.startPoint(t,h).price,t.priceScale().isPercent()&&(u=t.ownerSource().firstValue(),null===u))return 0;for(_=0,f=[],g=1;g<=this.levelsCount();g++)m="level"+g,v=c[m],y=v.coeff.value(),b=p+y*d,t.priceScale().isPercent()&&(b=t.priceScale().priceRange().convertToPercent(b,u)),w="",n&&(w+=o?this._percentageFormatter.format(Math.round(1e4*y)/100):this._numericFormatter.format(y)),i&&(w+="("+s.format(b)+")"),S=e.measureText(w).width,T={text:w,left:_,width:S+4},f.push(T),_+=T.width;return{totalWidth:_,cells:f}},o.prototype._effectiveState=function(t){var e,i,o,n,s,r,a={},l=t.properties();for(l.showPrices&&(a.showPrices=l.showPrices.value()),l.coeffsAsPercents&&(a.coeffsAsPercents=l.coeffsAsPercents.value()),a.showCoeffs=l.showCoeffs.value(),t.priceScale()&&t.priceScale().formatter().state&&(a.formatter=t.priceScale().formatter().state()),l.reverse&&(a.reverse=l.reverse.value()),a.p1=t.points()[0],a.p2=t.points()[1],3===t.points().length&&(a.p3=t.points()[2]),a.items=[],e=1;e<=this.levelsCount();e++)i="level"+e,o=l[i],n=o.coeff.value(),s=o.color.value(),r={coeff:n,color:s},a.items.push(r);return a},o.prototype._findEmptyRow=function(t){for(var e,i=0;this._rowsToSources[i];)i++;return this._rowsToSources[i]=t,i>=this._actualCapacity&&(this._actualCapacity++,e=this.canvas(),TradingView.resizeCanvas(e,this._actualWidth,o.ROW_HEIGHT*this._actualCapacity)),i},o.prototype._repaintSource=function(t,e,i){var n,s,r=o.ROW_HEIGHT*i.row,a=this.canvas().get(0).getContext("2d");for(a.clearRect(0,r,this._actualWidth,o.ROW_HEIGHT),a.textBaseline="bottom",a.font="12px Verdana",r+=o.ROW_HEIGHT,n=0;n<t.cells.length;n++)s=t.cells[n],a.fillStyle=e.items[n].color,a.fillText(s.text,s.left,r)},o.prototype.removeSource=function(t){var e,i;this._sourcesToRow[t]&&(e=this._sourcesToRow[t].row,i=this.canvas().get(0).getContext("2d"),i.save(),i.clearRect(0,this.topByRow(e),this._actualWidth,o.ROW_HEIGHT),i.restore(),delete this._sourcesToRow[t],delete this._rowsToSources[e])},o.prototype._effectiveStatesEquals=function(t,e){var i,o=function(t,e){return!(!t&&!e)&&(!(!t||e)||(!(t||!e)||(t.minMove!==e.minMove||(t.minMove2!==e.minMove2||(t.fractional!==e.fractional||t.fractionalLength!==e.fractionalLength)))))},n=function(t,e){return!(!t&&!e)&&(!(!t||e)||(!(t||!e)||(t.index!==e.index||t.price!==e.price)))},s=function(t,e){return t.coeff!==e.coeff||t.color!==e.color};if(t&&!e)return!1;if(!t&&e)return!1;if(t.showPrices!==e.showPrices)return!1;if(t.coeffsAsPercents!==e.coeffsAsPercents)return!1;if(t.showCoeffs!==e.showCoeffs)return!1;if(t.reverse!==e.reverse)return!1;if(o(t.formatter,e.formatter))return!1;if(n(t.p1,e.p1))return!1;if(n(t.p2,e.p2))return!1;if(n(t.p3,e.p3))return!1;if(t.items.length!==e.items.length)return!1;for(i=0;i<t.items.length;i++)if(s(t.items[i],e.items[i]))return!1;return!0},o.prototype.updateSource=function(t){var e,i,n,s,r=t.properties().symbol.value();return this._currentSymbol!==r&&(this._currentSymbol=r,this._sourcesToRow={},this._rowsToSources={}),this._sourcesToRow[t.id()]||(e=this._findEmptyRow(t.id()),this._sourcesToRow[t.id()]={effectiveState:null,row:e}),i=this._sourcesToRow[t.id()].effectiveState,n=this._effectiveState(t),this._effectiveStatesEquals(i,n)||(s=this._calculateWidth(t),s?(this._sourcesToRow[t.id()].effectiveState=n,s.totalWidth>this._actualWidth&&(TradingView.resizeCanvas(this.canvas(),s.totalWidth,o.ROW_HEIGHT*this._actualCapacity),this._actualWidth=s.totalWidth),e=this._sourcesToRow[t.id()],this._repaintSource(s,n,e),this._sourcesToRow[t.id()].effectiveState=n,this._sourcesToRow[t.id()].preparedCells=s):this._sourcesToRow[t.id()].effectiveState=null),this._sourcesToRow[t.id()]},t.exports=o},function(t,e,i){(function(t){"use strict";function o(){var t,e,i,o;this._registeredSources={},this._sourcesToRow={},this._rowsToSources={},this._currentSymbol="",this._actualCapacity=0,this._actualWidth=0,this._canvas=$("<canvas>"),this._cache=this._canvas.get(0).getContext("2d"),this._currentWidth=400,this._canvas.prop("width",this._currentWidth).prop("height",1).css("position","absolute").css("top",0).css("z-index",1e3).css("left",0),this._ctx=this._canvas.get(0).getContext("2d"),this._ctx.font=l.LABEL_FONTSIZE+"px"+l.LABEL_FONT,t=l.LABEL_FONTSIZE,e=l.LABEL_LINESPACING,i=t+e,o=3,this._padding=8,this._rowHeight=i*o-e+2*this._padding+2}function n(t,e,i){this._textSizeCache=e,this._data=t,this._fontSize=t.fontsize?t.fontsize:t.fontSize?t.fontSize:12,this._lineSpacing="number"==typeof this._data.lineSpacing&&this._data.lineSpacing?this._data.lineSpacing:0,t.lines=this._lines=y.prototype.wordWrap.call(this,t.text,t.wordWrapWidth),this._hittest=i||new w(w.MOVEPOINT)}function s(){var t=document.createElement("canvas");t.width=0,t.height=0,c=t.getContext("2d"),t=null}function r(t,e){this._data=t,this._hittest=e||new w(w.MOVEPOINT)}function a(t,e){m.call(this,t,e),this._label=null,this._rendererCache={},this._invalidated=!0,this._labelDataInvalidated=!0,this._percentageFormatter=new P,this._numericFormatter=new L}function l(t,e){this._constructor="LineToolTrendLine";var i=e||new C("linetooltrendline");v.call(this,t,new a(this,t),i),t._trendLineStatsCache||(t._trendLineStatsCache=new o)}function h(t,e,i,o,n,s){var r=p;return t<i?r|=u:t>n&&(r|=_),e<o?r|=f:e>s&&(r|=g),r}var c,d,p,u,_,f,g,m=i(103),v=i(74).LineDataSource,y=i(104).TextRenderer,b=i(132),w=i(94),S=i(95).PaneRendererClockIcon,T=i(98),C=i(80).DefaultProperty,x=i(82),P=x.PercentageFormatter,L=x.NumericFormatter,k=x.TimeSpanFormatter;o.prototype.canvas=function(){return this._canvas},o.prototype.topByRow=function(t){return t*this._rowHeight},o.prototype.rowHeight=function(t){return this._rowHeight},o.prototype.rowWidth=function(t){var e=this._rowsToSources[t];return this._sourcesToRow[e].width},o.prototype.currentWidth=function(){return this._currentWidth},o.prototype._findEmptyRow=function(t){for(var e=0;this._rowsToSources[e];)e++;return this._rowsToSources[e]=t,e>=this._actualCapacity&&(this._actualCapacity++,TradingView.resizeCanvas(this._canvas,this._currentWidth,this._rowHeight*this._actualCapacity),this._ctx=this._canvas.get(0).getContext("2d"),TradingView.logDebugChart("TrendLineCache. Expanging cache to "+this._actualCapacity+" items")),e},o.prototype._effectiveState=function(t){var e,i={};return i.p1=$.extend({},t.points()[0]),i.p2=$.extend({},t.points()[1]),e=t.properties(),i.showBars=e.showBarsRange.value(),i.showTimeRange=e.showDateTimeRange.value(),i.showDistance=e.showDistance.value(),i.showPriceRange=e.showPriceRange.value(),i.showAngle=e.showAngle.value(),i.color=e.textcolor.value(),i.showAngle&&(i.priceRange=t.priceScale().priceRange().state(),i.barSpacing=t._model.timeScale().barSpacing()),i},o.prototype._effectiveStatesEquals=function(t,e){var i=function(t,e){return!(!t&&!e)&&(!(!t||e)||(!(t||!e)||(t.index!==e.index||t.price!==e.price)))};if(t&&!e)return!1;if(!t&&e)return!1;if(i(t.p1,e.p1))return!1;if(i(t.p2,e.p2))return!1;if(t.color!==e.color)return!1;if(t.showBars!==e.showBars)return!1;if(t.showTimeRange!==e.showTimeRange)return!1;if(t.showDistance!==e.showDistance)return!1;if(t.showPriceRange!==e.showPriceRange)return!1;if(t.showAngle!==e.showAngle)return!1;if(t.showAngle){if(t.priceRange.min!==e.priceRange.min)return!1;if(t.priceRange.max!==e.priceRange.max)return!1;if(t.barSpacing!==e.barSpacing)return!1}return!0},o.prototype.removeSource=function(t){if(this._sourcesToRow[t]){var e=this._sourcesToRow[t].row;this._ctx.save(),this._ctx.clearRect(0,this.topByRow(e),this._currentWidth,this.rowHeight(e)),this._ctx.restore(),delete this._sourcesToRow[t],delete this._rowsToSources[e]}},o.prototype._repaintSource=function(e,i,o){var s,r;this._ctx.save(),this._ctx.translate(0,this.topByRow(i)+.5),o.points[0]=new t.Point(0,0),o.offsetX=0,o.offsetY=0,delete o.horzAlign,delete o.vertAlign,this._ctx.clearRect(0,0,this._currentWidth,this.rowHeight(i)),s=new n(o,{}),r=s.draw(this._ctx),this._sourcesToRow[e].width=r.width,this._ctx.restore()},o.prototype.updateSource=function(t,e){var i,o,n,s,r,a=t.properties().symbol.value();return this._currentSymbol!==a&&(TradingView.logDebugChart("TrendLineCache. Clearing canvas because of changing symbol from "+this._currentSymbol+" to "+a),this._currentSymbol=a,this._sourcesToRow={},this._rowsToSources={}),i=t.id(),this._sourcesToRow[i]||(o=this._findEmptyRow(i),this._sourcesToRow[i]={effectiveState:null,row:o}),n=this._sourcesToRow[t.id()].effectiveState,s=this._effectiveState(t),this._effectiveStatesEquals(n,s)||(o=this._sourcesToRow[t.id()],r=e(),this._repaintSource(i,o.row,r),this._sourcesToRow[i].effectiveState=s),this._sourcesToRow[i]},d={priceRange:{width:15,height:14,data:[134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255]
},barsRange:{width:16,height:15,data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,136,136,136,56,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,136,136,136,56,134,134,138,255,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,136,136,136,56,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,137,137,137,74,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,137,137,137,74,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},angle:{width:14,height:12,data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255]}},n.prototype._preRender=function(){var e,i,o,n,r,a,l,h,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x;if(!this._preRendered){if(c||s(),e=this._data.points[0].x+(this._data.offsetX||0),i=e,o=this._data.points[0].y+(this._data.offsetY||0),n=o,r=this._fontSize,a=this._lineSpacing,l=r+a,h=l*this._lines.length-a,c.textBaseline="top",c.font=this.fontStyle(),d=[],this._data.wordWrapWidth)for(p=this._data.wordWrapWidth,u=0;u<this._lines.length;u++)d.push(this._data.wordWrapWidth);else for(p=0,u=0;u<this._lines.length;u++)_=c.measureText(this._lines[u]).width,d.push(_),p=Math.max(p,_);if(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){f={top:this._data.paddingTop||0,right:this._data.paddingRight||0,bottom:this._data.paddingBottom||0,left:this._data.paddingLeft||0},g={x:0,y:0},this._data.backgroundHorzInflate&&(m=this._data.backgroundHorzInflate/2,f.left+=m,f.right+=m,g.x=-m),this._data.backgroundVertInflate&&(v=this._data.backgroundVertInflate/2,f.top+=v,f.bottom+=v,g.y=-v),y="number"==typeof this._data.padding?this._data.padding:~~(r/6);for(u in f)f[u]||(f[u]=y);b={x:Math.floor(e+g.x),y:Math.floor(o+g.y),w:Math.ceil(p+f.left+f.right),h:Math.ceil(h+f.top+f.bottom)},i+=f.left+g.x,n+=f.top+g.y,"bottom"!==this._data.vertAlign&&"middle"!==this._data.vertAlign||(w="middle"===this._data.vertAlign?o-b.h/2:o-b.h-(b.y-o),S=w-b.y,n+=S,b.y=w),"right"!==this._data.horzAlign&&"center"!==this._data.horzAlign||(T="center"===this._data.horzAlign?e-b.w/2:e-b.w-(b.x-e),C=T-b.x,i+=C,b.x=T,this._data.doNotAlignText!==!0&&("right"===this._data.horzAlign?(c.textAlign="end",i+=p):(c.textAlign="center",i+=p/2))),b.w%2!==0&&b.w++,b.x+=.5,b.y+=.5,this._boundingRect=[new t.Point(b.x,b.y),new t.Point(b.x+b.w,b.y+b.h)],this._rect=b,this._padding=f,this._defaultPadding=y}else"bottom"!==this._data.vertAlign&&"middle"!==this._data.vertAlign||(n-=Math.round(h*("middle"===this._data.vertAlign?.5:1))),x=i,"right"!==this._data.horzAlign&&"center"!==this._data.horzAlign||(x-=Math.round(p*("center"===this._data.horzAlign?.5:1))),this._boundingRect=[new t.Point(x,n),new t.Point(x+p,n+h)];this._textPoint={x:i,y:n},this._textSizeCache&&(this._textSizeCache.widths=d),this._preRendered=!0,this._maxWidth=p}},n.prototype._drawIcon=function(t,e,i,o){var n,s,r,a;if(d.hasOwnProperty(o)){if(n=d[o],!n.src){for(n.src=document.createElement("canvas"),n.src.width=n.width,n.src.height=n.height,s=n.src.getContext("2d"),r=s.createImageData(n.width,n.height),a=0;a<n.data.length;a++)r.data[a]=n.data[a];s.putImageData(r,0,0)}t.drawImage(n.src,e,i)}},n.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._fontSize+"px "+this._data.font},n.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d;if(0!==this._data.points.length){for(this._preRender(),e=this._fontSize,i=this._lineSpacing,o=e+i,t.textBaseline="top",t.font=this.fontStyle(),n=this._rect,(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth)&&this._rect?("right"!==this._data.horzAlign&&"center"!==this._data.horzAlign||this._data.doNotAlignText!==!0&&(t.textAlign="right"===this._data.horzAlign?"end":"center"),this._data.backgroundRoundRect?(t.roundRect(n.x,n.y,n.w,n.h,this._data.backgroundRoundRect),this._data.backgroundColor&&(t.fillStyle=this._data.backgroundColor,t.globalAlpha=this._data.backgroundTransparency,t.fill(),t.globalAlpha=1),this._data.borderColor&&(s="number"==typeof this._data.borderWidth?this._data.borderWidth:~~Math.max(e/12,1),t.strokeStyle=this._data.borderColor,t.lineWidth=s,t.stroke())):(this._data.backgroundColor&&(t.fillStyle=this._data.backgroundColor,t.globalAlpha=this._data.backgroundTransparency,t.fillRect(n.x,n.y,n.w,n.h),t.globalAlpha=1),this._data.borderColor?(s="number"==typeof this._data.borderWidth?this._data.borderWidth:~~Math.max(e/12,1),t.strokeStyle=this._data.borderColor,t.lineWidth=s,t.strokeRect(n.x-s/2,n.y-s/2,n.w+s,n.h+s)):this._data.highlightBorder&&(t.strokeStyle=this._data.color,t.lineWidth=1,t.beginPath(),l=[3,1],t.dashedLineTo(n.x-.5,a=n.y-.5,r=n.x+n.w+.5,a,l),t.dashedLineTo(r,a,r,a=n.y+n.h+.5,l),t.dashedLineTo(r=n.x-.5,a,n.x+n.w+.5,a,l),t.dashedLineTo(r,n.y-.5,r,a,l),t.globalAlpha=.5,t.stroke(),t.globalAlpha=1)),this._data.icons&&this._data.icons.forEach(function(e,i){var s=n.x+this._defaultPadding,r=n.y+this._padding.top+o*i;this._drawIcon(t,s,r,e)},this)):"right"===this._data.horzAlign?t.textAlign="end":"center"===this._data.horzAlign&&(t.textAlign="center"),h=this._textPoint.x,c=this._textPoint.y,t.fillStyle=this._data.color,d=0;d<this._lines.length;d++)t.fillText(this._lines[d],h,c),c+=o;return{width:n.w+2}}},n.prototype.hitTest=function(e){return 0===this._data.points.length?null:(this._preRender(),this._boundingRect&&t.pointInRect(e,this._boundingRect[0],this._boundingRect[1])?this._hittest:null)},r.prototype.drawArrow=function(t,e,i,o){var n,s,r,a,l,h,c,d,p;e.substract(t).length()<1||(n=e.substract(t).normalized(),s=5*o,r=n.scaled(s),a=e.substract(r),l=n.transponed(),h=3*o,c=l.scaled(h),d=a.add(c),p=a.substract(c),CanvasEx.drawLine(i,Math.round(d.x),Math.round(d.y),e.x,e.y),CanvasEx.drawLine(i,Math.round(p.x),Math.round(p.y),e.x,e.y))},r.prototype.lineClipping=function(t,e,i,o){var n=window.cohenSutherland(t.x,t.y,e.x,e.y,0,0,i,o);return!!n&&[{x:n[0],y:n[1]},{x:n[2],y:n[3]}]},r.prototype.expandPoints=function(e,i,o,n){var s,r,a=new t.Point(0,0),l=new t.Point(o,n);return this._data.extendleft&&(s=e.substract(i),r=t.intersectRayWithRect(e,e.add(s),a,l),r&&(e=r)),this._data.extendright&&(s=i.substract(e),r=t.intersectRayWithRect(i,i.add(s),a,l),r&&(i=r)),[e,i]},r.prototype.drawCircle=function(t,e,i,o){o=$.extend({fillStyle:"#000000"},o),e.save(),e.fillStyle=o.fillStyle,e.beginPath(),e.arc(t.x,t.y,i,0,2*Math.PI,!1),e.fill(),o.strokeWidth&&(e.lineWidth=o.strokeWidth,e.stroke()),e.restore()},r.prototype.draw=function(t){var e,i,o,n,s,r;this._data.points&&this._data.points.length<2||this._data.floatPoints&&this._data.floatPoints.length<2||(t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,e=this._data.floatPoints||this._data.points,i=e[0],o=e[1],this._data.overlayLineEndings?n=[$.extend(!0,{},i),$.extend(!0,{},o)]:this.drawEnds(t,[i,o]),s=this.expandPoints(i,o,this._data.width,this._data.height),r=this.lineClipping(s[0],s[1],this._data.width,this._data.height),r&&this._data.linewidth>0&&CanvasEx.drawLine(t,Math.round(r[0].x),Math.round(r[0].y),Math.round(r[1].x),Math.round(r[1].y)),this._data.overlayLineEndings&&this.drawEnds(t,n))},r.prototype.drawEnds=function(t,e){var i=e[0],o=e[1];switch(this._data.leftend){case v.LINEEND_ARROW:this.drawArrow(o,i,t,t.lineWidth);break;case v.LINEEND_CIRCLE:this.drawCircle(i,t,t.lineWidth,this._data.endstyle)}switch(this._data.rightend){case v.LINEEND_ARROW:this.drawArrow(i,o,t,t.lineWidth);break;case v.LINEEND_CIRCLE:this.drawCircle(o,t,t.lineWidth,this._data.endstyle)}},r.prototype.hitTest=function(e){var i,o,n,s,r,a;return this._data.points&&this._data.points.length<2?null:this._data.floatPoints&&this._data.floatPoints.length<2?null:(i=TradingView.isMobile.any()?24:3,o=this._data.floatPoints||this._data.points,n=o[0],s=o[1],r=this.expandPoints(n,s,this._data.width,this._data.height),a=t.distanceToSegment(r[0],r[1],e),a.distance<=i?this._hittest:null)},inherit(a,m),a.prototype.update=function(){this._invalidated=!0,this._labelDataInvalidated=!0},a.prototype.updateImpl=function(){var t,e,i,o,n,s,r,a,l,h,c=this._source.points();c.length<2||(t=c[0],e=c[1],i=this._model.timeScale().visibleBars(),void 0===i||i.isEmpty()||(i=i.clone(),o=this._source.properties(),t.index<i.firstBar()&&e.index<i.firstBar()&&!o.extendLeft.value()&&!o.extendRight.value()||(m.prototype.update.call(this),this._points.length<2||(n=o.showBarsRange.value(),s=o.showDateTimeRange.value(),r=o.showDistance.value(),a=o.showPriceRange.value(),l=o.showAngle.value(),a||n||s||r||l?(h=this,this._statCache=this._model._trendLineStatsCache.updateSource(this._source,function(){return h._statLabelData()})):(this._model._trendLineStatsCache.removeSource(this._source.id()),this._label=null,this._labelData&&(this._labelData.text="",this._labelData.lines=[])),this._invalidated=!1))))},a.prototype._statLabelData=function(){var e,i,o,n,s,r,a,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,E,I;return this._labelDataInvalidated&&(e=this._source.points(),i=e[0],o=e[1],n=this._source.properties(),s=[],p=n.showPriceRange.value(),p&&this._source.priceScale()&&(c=o.price-i.price,u=c/i.price,r=this._source.priceScale().formatter().format(c)+" ("+this._percentageFormatter.format(100*u)+")",_=this._model.mainSeries().base(),_&&(f=Math.round(c*_),r+=", "+f),s.push("priceRange")),g=n.showBarsRange.value(),m=n.showDateTimeRange.value(),v=n.showDistance.value(),(g||m||v)&&(a="",g&&(d=o.index-i.index,a+=$.t("{0} bars").format(d)),m&&(y=this._model.timeScale().indexToUserTime(i.index),b=this._model.timeScale().indexToUserTime(o.index),y&&b&&(w=(b.valueOf()-y.valueOf())/1e3,S=(new k).format(w),S&&(a+=g?" ("+S+")":S))),v&&(a&&(a+=", "),void 0===c&&(c=o.price-i.price),void 0===d&&(d=o.index-i.index),T=Math.round(1e5*Math.sqrt(c*c+d*d))/1e5,a+=$.t("distance: {0}").format(this._numericFormatter.format(T))),a&&s.push("barsRange")),C=n.showAngle.value(),C&&(x=this._source.pointToScreenPoint(i),P=this._source.pointToScreenPoint(o),x=x instanceof Array?x[0]:x instanceof t.Point?x:null,P=P instanceof Array?P[0]:P instanceof t.Point?P:null,x instanceof t.Point&&P instanceof t.Point&&(E=P.substract(x),E.length()>0&&(E=E.normalized(),L=Math.acos(E.x),E.y>0&&(L=-L))),"number"!=typeof L||TradingView.isNaN(L)||(h=Math.round(180*L/Math.PI)+"º",s.push("angle"))),this._label=[r,a,h].filter(function(t){return t}).join("\n")||null,this._icons=s,this._labelDataInvalidated=!1),I={points:[this._points[1]],text:this._label,color:this._source.properties().textcolor.value(),font:l.LABEL_FONT,fontsize:l.LABEL_FONTSIZE,lineSpacing:l.LABEL_LINESPACING,backgroundColor:l.LABEL_BGCOLOR,borderColor:l.LABEL_BORDERCOLOR,borderWidth:1,padding:l.LABEL_PADDING,paddingLeft:30,doNotAlignText:!0,icons:this._icons},this._points[1].y<this._points[0].y&&(I.vertAlign="bottom"),this._points[1].x<this._points[0].x&&(I.horzAlign="right"),this._labelData=I,I},a.prototype.renderer=function(){var t,e,i,o,n,s,a,h,c;return this._invalidated&&this.updateImpl(),t=new T,this._invalidated?t:this._source.priceScale()?(e={},e.points=this._points,e.floatPoints=this._floatPoints,e.width=this._model.timeScale().width(),e.height=this._source.priceScale().height(),e.color=this._source.properties().linecolor.value(),e.linewidth=this._source.properties().linewidth.value(),e.linestyle=this._source.properties().linestyle.value(),e.extendleft=this._source.properties().extendLeft.value(),e.extendright=this._source.properties().extendRight.value(),e.leftend=this._source.properties().leftEnd.value(),e.rightend=this._source.properties().rightEnd.value(),t.append(new r(e)),i=this.isAnchorsRequired(),o=i||this._source.properties().alwaysShowStats.value(),o&&this._label&&2===this._points.length&&(n=this._points[1],s={left:0,top:this._model._trendLineStatsCache.topByRow(this._statCache.row),width:this._model._trendLineStatsCache.rowWidth(this._statCache.row),height:this._model._trendLineStatsCache.rowHeight(this._statCache.row)},a={left:n.x,top:n.y,width:s.width,height:s.height},"right"===this._labelData.horzAlign?a.left-=l.LABEL_PADDING+a.width:a.left+=l.LABEL_PADDING,"bottom"===this._labelData.vertAlign?a.top-=l.LABEL_PADDING+a.height:a.top+=l.LABEL_PADDING,h=this._model._trendLineStatsCache.canvas(),c=new b(h.get(0),s,a),t.append(c)),this.addAnchors(t),!TradingView.printing&&this._source.hasAlert.value()&&!this._model.readOnly()&&e.points.length>=2&&this._source.getAlertIsActive(function(i){t.append(new S({point1:e.points[0],point2:e.points[1],color:i?e.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),t):t},inherit(l,v),l.LABEL_OFFSET=8,l.LABEL_FONT="Arial",l.LABEL_FONTSIZE=12,l.LABEL_LINESPACING=10,l.LABEL_BGCOLOR="rgba(255,255,255,.8)",l.LABEL_BORDERCOLOR="#e3e3e3",l.LABEL_PADDING=8,l.prototype.stop=function(){v.prototype.stop.call(this),this._model._trendLineStatsCache.removeSource(this.id())},l.prototype.pointsCount=function(){return 2},l.prototype.title=function(){return"Trend Line"},l.prototype.canHasAlert=function(){return!0},l.prototype._getAlertPlots=function(){return[this._linePointsToAlertPlot(this._points,null,this.properties().extendLeft.value(),this.properties().extendRight.value())]},p=0,u=1,_=2,f=4,g=8,window.cohenSutherland=function(t,e,i,o,n,s,r,a){for(var l,c,d,p=h(t,e,n,s,r,a),u=h(i,o,n,s,r,a),m=!1,v=0;;){if(v>1e3)throw Error("Cohen - Sutherland algorithm: infinity loop");if(v++,!(p|u)){m=!0;break}if(p&u)break;d=p||u,d&g?(l=t+(i-t)*(a-e)/(o-e),c=a):d&f?(l=t+(i-t)*(s-e)/(o-e),c=s):d&_?(c=e+(o-e)*(r-t)/(i-t),l=r):(c=e+(o-e)*(n-t)/(i-t),l=n),d===p?(t=l,e=c,p=h(t,e,n,s,r,a)):(i=l,o=c,u=h(i,o,n,s,r,a))}return!!m&&[t,e,i,o]},e.TrendLineStatsRenderer=n,e.LineToolTrendLine=l,e.TrendLineRenderer=r}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e,i){this._cache=t,this._cacheRect=e,this._targetRect=i}var n=i(94);o.prototype.draw=function(t){t.translate(.5,.5),t.drawImage(this._cache,this._cacheRect.left,this._cacheRect.top,this._cacheRect.width,this._cacheRect.height,this._targetRect.left,this._targetRect.top,this._targetRect.width,this._targetRect.height),t.translate(-.5,-.5)},o.prototype.hitTest=function(t){var i=new e.Point(this._targetRect.left,this._targetRect.top),o=i.add(new e.Point(this._targetRect.width,this._targetRect.height));return e.pointInRect(t,i,o)?new n(n.REGULAR):null},t.exports=o}).call(e,i(21))},function(t,e,i){"use strict";function o(){p.call(this)}function n(t,e,i){l.call(this,t,e,i)}function s(t,e){c.call(this,t,e),this._rendererCache={},this._invalidated=!0}function r(t,e){this._constructor="LineToolFibChannel";var i=e||this.createPropertiesObject("linetoolfibchannel");h.call(this,t,new s(this,t),i),this.version=r.version,t._fibChannelLabelsCache||(t._fibChannelLabelsCache=new o)}var a=i(126),l=i(134).ParallelChannelRenderer,h=i(74).LineDataSource,c=i(103),d=i(127),p=i(130),u=i(131).TrendLineRenderer,_=i(132),f=i(98);inherit(o,p),o.prototype.levelsCount=function(){return r.LevelsCount},inherit(n,l),n.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency,!0)},inherit(s,c),s.prototype.update=function(){this._invalidated=!0},s.prototype._updateImpl=function(){c.prototype.update.call(this),this._cacheState=this._model._fibChannelLabelsCache.updateSource(this._source),this._floatPoints.length<3||this._source.points().length<3||(this.norm=this._floatPoints[2].substract(this._floatPoints[0]))},s.prototype.renderer=function(){function t(t,o,n){var s,r,a,h,p;switch(i.horzLabelsAlign.value()){case"left":s=t;break;case"center":s=t.add(o).scaled(.5),s.x+=n.width/2,s.x=Math.round(s.x);break;case"right":s=o.clone(),s.x+=n.width,s.x=Math.round(s.x)}r={left:n.left,top:l.topByRow(d._cacheState.row),width:n.width,height:l.rowHeight(d._cacheState.row)},a={left:Math.round(s.x-r.width),top:Math.round(s.y),width:n.width,height:r.height},h=i.vertLabelsAlign.value(),"middle"===h&&(a.top-=a.height/2),"bottom"===h&&(a.top-=a.height),p=new _(c,r,a),e.append(p)}var e,i,o,s,r,l,c,d,p,g,m,v,y,b,w,S,T,C,x,P,L,k;if(this._invalidated&&(this._updateImpl(),this._invalidated=!1),e=new f,this._floatPoints.length<2)return this.addAnchors(e),e;if(i=this._source.properties(),o=this._floatPoints[0],s=this._floatPoints[1],this._floatPoints.length<3)return r={points:[o,s],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:i.level1.color.value(),linewidth:i.levelsStyle.linewidth.value(),linestyle:i.levelsStyle.linestyle.value(),extendleft:i.extendLeft.value(),extendright:i.extendRight.value(),leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},e.append(new u(r)),this.addAnchors(e),e;for(l=this._model._fibChannelLabelsCache,c=l.canvas().get(0),d=this,p=1;p<a.LevelsCount;p++)if(g=i["level"+p],g.visible.value()){for(m=null,v=p+1;v<=a.LevelsCount;v++)if(y=i["level"+v],y.visible.value()){m=y;break}if(!m)break;b=this.norm.scaled(g.coeff.value()),w=o.add(b),S=s.add(b),T=this.norm.scaled(m.coeff.value()),C=o.add(T),x=s.add(T),P={},P.points=[w,S,C,x],P.color=g.color.value(),P.width=this._model.timeScale().width(),P.height=this._source.priceScale().height(),P.linewidth=i.levelsStyle.linewidth.value(),P.linestyle=i.levelsStyle.linestyle.value(),P.extendleft=i.extendLeft.value(),P.extendright=i.extendRight.value(),P.backcolor=g.color.value(),P.transparency=i.transparency.value(),P.skipTopLine=!0,P.fillBackground=i.fillBackground.value(),P.hittestOnBackground=!0,e.append(new n(P)),(i.showCoeffs.value()||i.showPrices.value())&&(L=this._cacheState.preparedCells.cells[p-1],t(w,S,L))}for(k=null,p=a.LevelsCount;p>=1;p--)if(g=i["level"+p],g.visible.value()){k=p;break}return null!=k&&(g=i["level"+k],g.visible.value()&&(b=this.norm.scaled(g.coeff.value()),w=o.add(b),S=s.add(b),r={points:[w,S],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:g.color.value(),linewidth:i.levelsStyle.linewidth.value(),linestyle:i.levelsStyle.linestyle.value(),extendleft:i.extendLeft.value(),extendright:i.extendRight.value(),leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},e.append(new u(r)),(i.showCoeffs.value()||i.showPrices.value())&&t(w,S,this._cacheState.preparedCells.cells[k-1]))),this.addAnchors(e),e},inherit(r,h),r.LevelsCount=24,r.version=2,r.prototype.migrateVersion=function(t,e,i){i.properties.removeProperty("reverse")},r.prototype.pointsCount=function(){return 3},r.prototype.title=function(){return"Fib Channel"},r.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},r.prototype.createPropertiesObject=function(t,e,i){return new d(t,e,i,{range:[1,24],names:["coeff","color","visible"]})},t.exports=r},function(t,e,i){(function(t){"use strict";function o(t,e,i){this._data=t,this._hittestResult=e||new h(h.MOVEPOINT),this._backHittestResult=i||new h(h.MOVEPOINT_BACKGROUND)}function n(t,e){r.call(this,t,e),this._invalidated=!0}function s(t,e){this._constructor="LineToolParallelChannel";var i=e||new p("linetoolparallelchannel");a.call(this,t,new n(this,t),i)}var r=i(103),a=i(74).LineDataSource,l=i(131).TrendLineRenderer,h=i(94),c=i(95).PaneRendererClockIcon,d=i(98),p=i(80).DefaultProperty;o.prototype.extendPoints=function(e,i,o,n){var s,r,a=new t.Point(0,0),l=new t.Point(o,n);return this._data.extendleft&&(s=e.substract(i),r=t.intersectRayWithRect(e,e.add(s),a,l),r&&(e=r)),this._data.extendright&&(s=i.substract(e),r=t.intersectRayWithRect(i,i.add(s),a,l),r&&(i=r)),this._data.extendleft&&!t.pointInRect(e,a,l)&&t.pointInRect(i,a,l)&&(r=t.intersectRayWithRect(i,e,a,l),r&&(e=r)),this._data.extendright&&!t.pointInRect(i,a,l)&&t.pointInRect(e,a,l)&&(r=t.intersectRayWithRect(e,i,a,l),r&&(i=r)),[e,i]},o.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency)},o.prototype.draw=function(e){var i,o,n,s,r,a,h,c,d,p,u,_,f,g,m;if(!(this._data.points.length<2)&&(e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle,i=this._data.points[0],o=this._data.points[1],n=this.extendPoints(i,o,this._data.width,this._data.height),this._data.skipLines||CanvasEx.drawLine(e,n[0].x,n[0].y,n[1].x,n[1].y),4===this._data.points.length)){if(s=this._data.points[2],r=this._data.points[3],!s||!r)return;if(a=this.extendPoints(s,r,this._data.width,this._data.height),this._data.skipLines||this._data.skipTopLine||CanvasEx.drawLine(e,a[0].x,a[0].y,a[1].x,a[1].y),this._data.fillBackground){if(h=Math.max(n[1].x,a[1].x),c=Math.max(n[1].y,a[1].y),d=Math.min(a[0].x,n[0].x),p=Math.min(a[0].y,n[0].y),!(isFinite(h)&&isFinite(c)&&isFinite(d)&&isFinite(p)))return;e.fillStyle=this.getColor(),e.beginPath(),e.moveTo(n[0].x,n[0].y),e.lineTo(n[1].x,n[1].y),this._data.extendright&&(u=t.optionalCorner(n[1],a[1],this._data.width,this._data.height),u&&e.lineTo(u.x,u.y)),e.lineTo(a[1].x,a[1].y),e.lineTo(a[0].x,a[0].y),this._data.extendleft&&(_=t.optionalCorner(a[0],n[0],this._data.width,this._data.height),_&&e.lineTo(_.x,_.y)),e.lineTo(n[0].x,n[0].y),e.fill()}this._data.showMidline&&!this._data.skipLines&&(e.strokeStyle=this._data.midcolor,e.lineWidth=this._data.midlinewidth,e.lineStyle=this._data.midlinestyle,f=this._data.points[0].add(this._data.points[2]).scaled(.5),g=this._data.points[1].add(this._data.points[3]).scaled(.5),a=this.extendPoints(f,g,this._data.width,this._data.height),m=l.prototype.lineClipping(a[0],a[1],this._data.width,this._data.height),m&&CanvasEx.drawLine(e,Math.round(m[0].x),Math.round(m[0].y),Math.round(m[1].x),Math.round(m[1].y)))}},o.prototype.hitTest=function(e){var i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v;if(this._data.points.length<2)return null;if(i=3,o=this._data.floatPoints||this._data.points,n=o[0],s=o[1],r=o[2],a=o[3],l=this.extendPoints(n,s,this._data.width,this._data.height),h=t.distanceToSegment(l[0],l[1],e),h.distance<=i)return this._hittestResult;if(4===this._data.points.length&&!this._data.skipTopLine){if(!r||!a)return null;if(l=this.extendPoints(r,a,this._data.width,this._data.height),h=t.distanceToSegment(l[0],l[1],e),h.distance<=i)return this._hittestResult;if(this._data.showMidline&&!this._data.skipLines&&(c=n.add(r).scaled(.5),d=s.add(a).scaled(.5),l=this.extendPoints(c,d,this._data.width,this._data.height),h=t.distanceToSegment(l[0],l[1],e),h.distance<=i))return this._hittestResult}if(this._data.hittestOnBackground&&this._data.fillBackground&&4===this._data.points.length){if(p=(s.y-n.y)/(s.x-n.x),u=n.y+p*(e.x-n.x),_=r.y+p*(e.x-r.x),f=Math.max(u,_),g=Math.min(u,_),m=Math.min(n.x,s.x),v=Math.max(n.x,s.x),!this._data.extendleft&&e.x<m)return null;if(!this._data.extendright&&e.x>v)return null;if(e.y>=g&&e.y<=f)return this._backHittestResult}return null},inherit(n,r),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){var t,e,i,o,n,s,a,l,h,c,d;r.prototype.update.call(this),this._source.priceScale()&&!this._source.priceScale().isEmpty()&&0!==this._source.points().length&&(this._source._priceOffset||this._source.calculatePriceDiff(),3===this._points.length&&this._source._priceOffset&&(t=this._points[0],e=this._points[1],i=this._source._priceOffset+this._source.points()[0].price,o=this._source._priceOffset+this._source.points()[1].price,this._p3=t.clone(),this._p4=e.clone(),n=this._source.priceScale(),n.isLog()?(s=.5*(i+o)-this._source._priceOffset,a=.5*(i+o),l=this._source.priceScale().priceToCoordinate(s),h=this._source.priceScale().priceToCoordinate(a),c=h-l,this._p3.y+=c,this._p4.y+=c):(n.isPercent()&&(d=this._source.ownerSource().firstValue(),i=n.priceRange().convertToPercent(i,d),o=n.priceRange().convertToPercent(o,d)),this._p3.y=this._source.priceScale().priceToCoordinate(i),this._p4.y=this._source.priceScale().priceToCoordinate(o))))},n.prototype.renderer=function(){var t,e,i,n,s,r;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t={},t.points=[],this._points.length>1&&(t.points.push(this._points[0]),t.points.push(this._points[1])),this._points.length>2&&(t.points.push(this._p3),t.points.push(this._p4)),t.color=this._source.properties().linecolor.value(),t.width=this._model.timeScale().width(),t.height=this._source.priceScale().height(),e=this._source.properties(),t.linewidth=e.linewidth.value(),t.linestyle=e.linestyle.value(),t.extendleft=e.extendLeft.value(),t.extendright=e.extendRight.value(),t.fillBackground=e.fillBackground.value(),t.backcolor=e.backgroundColor.value(),t.transparency=e.transparency.value(),t.showMidline=e.showMidline.value(),t.midlinewidth=e.midlinewidth.value(),t.midlinestyle=e.midlinestyle.value(),t.midcolor=e.midlinecolor.value(),t.fillBackground=e.fillBackground.value(),t.hittestOnBackground=!0,i=new d,i.append(new o(t)),this.isAnchorsRequired()&&(n=[],n.push(this._points[0]),this._points[1]&&n.push(this._points[1]),this._p3&&(n.push(this._p3.add(this._p4).scaled(.5)),n[2].data=2),s=3===this._points.length&&!this._p3,this._model.lineBeingCreated()!==this._source||s||n.pop(),i.append(this.createLineAnchor({points:n}))),!TradingView.printing&&this._source.hasAlert.value()&&!this._model.readOnly()&&this._points.length>=2&&(r=this._points,this._source.getAlertIsActive(function(t){i.append(new c({point1:r[0],point2:r[1],color:t?e.linecolor.value():defaults("chartproperties.alertsProperties.drawingIcon.color")}))})),i},inherit(s,a),s.prototype.addPoint=function(t){var e,i=a.prototype.addPoint.call(this,t);return i&&(e=this.points()[0],this._points[2].index=e.index,this._points[2].price=e.price+this._priceOffset),i},s.prototype.calculatePriceDiff=function(){var t,e,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v;if(3===this.points().length){if(t=this.points()[0],e=this.points()[1],i=this.points()[2],t.index===e.index)return;if(o=this.priceScale(),null===o)return;if(o.isLog()){if(n=this._model.timeScale(),n.isEmpty())return;s=n.indexToCoordinate(t.index),r=n.indexToCoordinate(e.index),a=o.priceToCoordinate(t.price),l=o.priceToCoordinate(e.price),h=n.indexToCoordinate(i.index),c=(l-a)/(r-s),d=a+c*(h-s),p=o.priceToCoordinate(i.price),u=p-d,_=.5*(a+l),f=o.coordinateToPrice(_),g=_+u,m=o.coordinateToPrice(g),this._priceOffset=m-f}else c=(e.price-t.price)/(e.index-t.index),v=t.price+c*(i.index-t.index),this._priceOffset=i.price-v}},s.prototype.setLastPoint=function(t,e){e&&e.shift&&2===this.points().length&&this._snapPoint45Degree(t,this.points()[0]),a.prototype.setLastPoint.call(this,t),this.calculatePriceDiff()},s.prototype.restorePoints=function(t,e,i){a.prototype.restorePoints.call(this,t,e,i),t&&t.length>=3&&(this._priceOffset=t[2].price-t[0].price)},s.prototype.setPoint=function(t,e,i){i&&i.shift&&t<2&&this._snapPoint45Degree(e,this.points()[1-t]),a.prototype.setPoint.call(this,t,e,i),2===t&&this.calculatePriceDiff();var o=this.points()[0];this._points[2].index=o.index,this._points[2].price=o.price+this._priceOffset},s.prototype.pointsCount=function(){return 3},s.prototype.title=function(){return"Parallel Channel"},s.prototype.addPoint=function(t,e){return e&&e.shift&&2===this.points().length&&this._snapPoint45Degree(t,this.points()[0]),a.prototype.addPoint.call(this,t,e)},s.prototype.fixAfterRestorePriceAxis=function(){this.priceScale().isLog()||delete this._priceOffset},s.prototype.cloneData=function(t){this._priceOffset=t._priceOffset},s.prototype.restoreData=function(t){t.priceOffset&&(this._priceOffset=t.priceOffset)},s.prototype.state=function(t){var e=a.prototype.state.call(this,t);return e.priceOffset=this._priceOffset,e},s.prototype.canHasAlert=function(){return!0},s.prototype._getAlertPlots=function(){function t(t,e){return t.index<=e.index?[t,e]:[e,t]}var e,i,o,n,s,r,a,l,h=[].concat(this._points).splice(0,2);return h=h.concat([{price:h[0].price+this._priceOffset,time:h[0].time,index:h[0].index},{price:h[1].price+this._priceOffset,time:h[1].time,index:h[1].index}]),e=t(h[0],h[1]),i=t(h[2],h[3]),this._priceOffset<0?(n=i,o=e):(n=e,o=i),a=this.properties().extendLeft.value(),l=this.properties().extendRight.value(),h[0].index<=h[1].index?(s=a,r=l):(s=l,r=a),[this._linePointsToAlertPlot(o,"Upper",s,r),this._linePointsToAlertPlot(n,"Lower",s,r)]},e.LineToolParallelChannel=s,e.ParallelChannelRenderer=o}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(){c.call(this)}function n(t,e,i){this._data=t,this._hittest=e||new u(u.MOVEPOINT),this._backHittest=i||new u(u.MOVEPOINT_BACKGROUND)}function s(t,e){l.call(this,t,e),this._rendererCache={},this._invalidated=!0;
}function r(t,e){this._constructor="LineToolFibSpeedResistanceArcs";var i=e||this.createPropertiesObject("linetoolfibspeedresistancearcs");a.call(this,t,new s(this,t),i),t._fibSpeedResistanceArcsLabelsCache||(t._fibSpeedResistanceArcsLabelsCache=new o)}var a=i(74).LineDataSource,l=i(103),h=i(127),c=i(130),d=i(131).TrendLineRenderer,p=i(132),u=i(94),_=i(98);inherit(o,c),o.prototype.levelsCount=function(){return r.LevelsCount},n.prototype.draw=function(t){t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.translate(this._data.center.x,this._data.center.y),t.beginPath(),this._data.fullCircles?t.arc(0,0,this._data.radius,2*Math.PI,0,!1):this._data.dir>0?t.arc(0,0,this._data.radius,0,Math.PI,!1):t.arc(0,0,this._data.radius,Math.PI,0,!1),t.stroke(),this._data.fillBackground&&(this._data.radius2&&(this._data.fullCircles?t.arc(0,0,this._data.radius2,2*Math.PI,0,!0):this._data.dir>0?t.arc(0,0,this._data.radius2,Math.PI,0,!0):t.arc(0,0,this._data.radius2,0,Math.PI,!0)),t.fillStyle=TradingView.generateColor(this._data.color,this._data.transparency,!0),t.fill())},n.prototype.hitTest=function(t){var i,o,n,s=e.sign(t.y-this._data.center.y);return s===this._data.dir||this._data.fullCircles?(i=t.substract(this._data.center),o=i.length(),n=3,Math.abs(o-this._data.radius)<n?this._hittest:this._data.hittestOnBackground&&Math.abs(o)<=this._data.radius+n?this._backHittest:null):null},inherit(s,l),s.prototype.update=function(){this._invalidated=!0},s.prototype._updateImpl=function(){var t,i,o,n,s,a,h,c,d,p,u,_;if(l.prototype.update.call(this),this._cacheState=this._model._fibSpeedResistanceArcsLabelsCache.updateSource(this._source),!(this._floatPoints.length<2)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty())for(t=this._floatPoints[0],i=this._floatPoints[1],o=t.substract(i).length(),this._levels=[],n=this._source.properties(),s=1;s<=r.LevelsCount;s++)a="level"+s,h=n[a],h.visible.value()&&(c=h.coeff.value(),d=h.color.value(),p=i.substract(t).length()*c,u=e.sign(i.y-t.y),_=new e.Point(t.x,t.y+u*o*c),this._levels.push({color:d,radius:p,dir:u,labelPoint:_,linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),index:s}))},s.prototype.renderer=function(){var t,e,i,o,s,r,l,h,c,f,g,m,v,y,b,w;if(this._invalidated&&(this._updateImpl(),this._invalidated=!1),t=new _,this._floatPoints.length<2)return t;for(e=this._floatPoints[0],i=this._source.properties(),o=i.fillBackground.value(),s=i.transparency.value(),r=this._model._fibSpeedResistanceArcsLabelsCache,l=r.canvas().get(0),h=0;h<this._levels.length;h++)if(c=this._levels[h],f={},f.center=e,f.color=c.color,f.linewidth=c.linewidth,f.radius=c.radius,f.dir=c.dir,f.transparency=s,f.fillBackground=o,f.hittestOnBackground=!0,f.fullCircles=i.fullCircles.value(),h>0&&(f.radius2=this._levels[h-1].radius),g=new u(u.MOVEPOINT,null,c.index),t.append(new n(f,g)),i.showCoeffs.value()){if(m=this._cacheState.preparedCells.cells[this._levels[h].index-1],!m)continue;v={left:m.left,top:r.topByRow(this._cacheState.row),width:m.width,height:r.rowHeight(this._cacheState.row)},y={left:Math.round(c.labelPoint.x-v.width),top:Math.round(c.labelPoint.y-v.height/2),width:m.width,height:v.height},b=new p(l,v,y),t.append(b)}return i.trendline.visible.value()&&(w={points:[this._floatPoints[0],this._floatPoints[1]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:i.trendline.color.value(),linewidth:i.trendline.linewidth.value(),linestyle:i.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},t.append(new d(w))),this.addAnchors(t),t},inherit(r,a),r.LevelsCount=11,r.prototype.pointsCount=function(){return 2},r.prototype.title=function(){return"Fib Speed Resistance Arcs"},r.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},r.prototype.createPropertiesObject=function(t,e,i){return new h(t,e,i,{range:[1,11]})},t.exports=r}).call(e,i(21))},function(t,e,i){"use strict";function o(){d.call(this)}function n(t,e){h.call(this,t,e)}function s(t,e){this._constructor="LineToolProjection";var i=e||this.createPropertiesObject("linetoolprojection");p.call(this,t,new n(this,t),i)}var r=i(127),a=i(137),l=a.ArcWedgeRenderer,h=a.FibWedgePaneView,c=a.LineToolFibWedge,d=i(130),p=i(74).LineDataSource,u=i(131).TrendLineRenderer,_=i(98);inherit(o,d),o.prototype.levelsCount=function(){return 1},inherit(n,h),n.prototype.update=function(){h.prototype.update.call(this)},n.prototype._levelsCount=function(){return 1},n.prototype.renderer=function(){var t,e,i,o,n,s,r,a,h,c,d,f;return this._invalidated&&(this._updateImpl(),this._invalidated=!1),t=new _,this._points.length<2?t:(e=this._source.properties(),i=this._points,o=i[0],n=i[1],s={points:[o,n],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:e.trendline.color.value(),linewidth:e.linewidth.value(),linestyle:e.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:p.LINEEND_NORMAL,rightend:p.LINEEND_NORMAL},t.append(new u(s)),this._points.length<3?(this.addAnchors(t),t):(r=i[2],a=r.data,h=n.substract(o).length(),c=r.substract(o).normalized(),r=o.add(c.scaled(h)),r.data=a,s={points:[o,r],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:e.trendline.color.value(),linewidth:e.linewidth.value(),linestyle:e.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:p.LINEEND_NORMAL,rightend:p.LINEEND_NORMAL},t.append(new u(s)),d=this._levels[0],f={},f.center=this._points[0],f.radius=d.radius,f.prevRadius=0,f.edge=this._edge,f.color=e.trendline.color.value(),f.color1=e.color1.value(),f.color2=e.color2.value(),f.linewidth=e.linewidth.value(),f.edge1=this._edge1,f.edge2=this._edge2,f.p1=d.p1,f.p2=d.p2,f.fillBackground=e.fillBackground.value(),f.transparency=e.transparency.value(),f.gradient=!0,t.append(new l(f)),this.addAnchors(t),t))},inherit(s,c),s.prototype.title=function(){return"Projection"},s.prototype.getCache=function(){return this._model._projectionLabelsCache||(this._model._projectionLabelsCache=new o),this._model._projectionLabelsCache},s.prototype.createPropertiesObject=function(t,e,i){return new r(t,e,i,{range:[1,1]})},t.exports=s},function(t,e,i){(function(t){"use strict";function o(){c.call(this)}function n(t,e,i){this._data=t,this._hittest=e||new u(u.MOVEPOINT),this._backHittest=i||new u(u.MOVEPOINT_BACKGROUND),this._rendererCache={}}function s(t,e){l.call(this,t,e),this._rendererCache={},this._levels=[],this._invalidated=!0}function r(t,e){this._constructor="LineToolFibSpeedResistanceArcs";var i=e||this.createPropertiesObject("linetoolfibwedge");a.call(this,t,new s(this,t),i),t._fibWedgeLabelsCache||(t._fibWedgeLabelsCache=new o)}var a=i(74).LineDataSource,l=i(103),h=i(127),c=i(130),d=i(131).TrendLineRenderer,p=i(132),u=i(94),_=i(98);inherit(o,c),o.prototype.levelsCount=function(){return r.LevelsCount},n.prototype.draw=function(t){if(t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.beginPath(),t.arc(this._data.center.x,this._data.center.y,this._data.radius,this._data.edge1,this._data.edge2,!0),t.stroke(),this._data.fillBackground){if(t.arc(this._data.center.x,this._data.center.y,this._data.prevRadius,this._data.edge2,this._data.edge1,!1),this._data.gradient){var e=t.createRadialGradient(this._data.center.x,this._data.center.y,this._data.prevRadius,this._data.center.x,this._data.center.y,this._data.radius);e.addColorStop(0,TradingView.generateColor(this._data.color1,this._data.transparency)),e.addColorStop(1,TradingView.generateColor(this._data.color2,this._data.transparency)),t.fillStyle=e}else t.fillStyle=TradingView.generateColor(this._data.color,this._data.transparency,!0);t.fill()}},n.prototype.hitTest=function(t){var e,i,o,n,s,r,a,l,h,c=4,d=t.substract(this._data.center).length();return Math.abs(d-this._data.radius)<=c&&(e=t.substract(this._data.p1).length(),i=t.substract(this._data.p2).length(),o=Math.max(e,i),n=this._data.p1.substract(this._data.p2).length(),o<=n)?this._hittest:this._data.fillBackground&&d<=this._data.radius&&(s=this._data.p1.substract(this._data.center).normalized(),r=this._data.p2.substract(this._data.center).normalized(),d=t.substract(this._data.center).normalized(),a=s.dotProduct(r),l=d.dotProduct(s),h=d.dotProduct(r),l>=a&&h>=a)?this._backHittest:null},inherit(s,l),s.prototype.update=function(){this._invalidated=!0},s.prototype._updateImpl=function(){var e,i,o,n,s,r,a,h,c,d,p,u,_,f,g,m,v,y,b;if(l.prototype.update.call(this),this._cacheState=this._source.getCache().updateSource(this._source),this._levels=[],!(this._points.length<3))for(e=this._points,i=e[0],o=e[1],n=e[2],s=o.substract(i).normalized(),r=n.substract(i).normalized(),a=new t.Point(1,0),h=new t.Point(0,1),c=Math.acos(s.dotProduct(a)),s.dotProduct(h)<0&&(c=2*Math.PI-c),this._edge1=c,d=Math.acos(r.dotProduct(a)),r.dotProduct(h)<0&&(d=2*Math.PI-d),this._edge2=d,c<d&&(this._edge1=Math.max(c,d),this._edge2=Math.min(c,d)+2*Math.PI),Math.abs(c-d)>Math.PI&&(this._edge1=Math.min(c,d),this._edge2=Math.max(c,d)-2*Math.PI),p=this._source.properties(),u=1;u<=this._source.getCache().levelsCount();u++)_="level"+u,f=p[_],f.visible.value()&&(g=f.coeff.value(),m=f.color.value(),v=o.substract(i).length()*g,y=s.add(r).scaled(.5).normalized().scaled(v),b=i.add(y),this._levels.push({coeff:g,color:m,radius:v,labelPoint:b,p1:i.add(s.scaled(v)),p2:i.add(r.scaled(v)),linewidth:f.linewidth.value(),linestyle:f.linestyle.value(),index:u}))},s.prototype.renderer=function(){var t,e,i,o,s,r,l,h,c,f,g,m,v,y,b,w,S,T,C,x;if(this._invalidated&&(this._updateImpl(),this._invalidated=!1),t=new _,this._points.length<2)return t;if(e=this._source.properties(),i=this._points,o=i[0],s=i[1],r={points:[o,s],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:e.trendline.color.value(),linewidth:e.trendline.visible.value()?e.trendline.linewidth.value():0,linestyle:e.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},t.append(new d(r)),this._points.length<3)return this.addAnchors(t),t;for(l=i[2],h=l.data,c=s.substract(o).length(),f=l.substract(o).normalized(),l=o.add(f.scaled(c)),l.data=h,r={points:[o,l],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:e.trendline.color.value(),linewidth:e.trendline.visible.value()?e.trendline.linewidth.value():0,linestyle:e.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},t.append(new d(r)),g=this._model._fibWedgeLabelsCache,m=g.canvas().get(0),v=this._levels.length-1;v>=0;v--)if(y=this._levels[v],b={},b.center=this._points[0],b.radius=y.radius,v>0?b.prevRadius=this._levels[v-1].radius:b.prevRadius=0,b.edge=this._edge,b.color=y.color,b.linewidth=y.linewidth,b.edge1=this._edge1,b.edge2=this._edge2,b.p1=y.p1,b.p2=y.p2,b.fillBackground=e.fillBackground.value(),b.transparency=e.transparency.value(),w=new u(u.MOVEPOINT,null,y.index),t.append(new n(b,w)),e.showCoeffs.value()){if(S=this._cacheState.preparedCells.cells[this._levels[v].index-1],!S)continue;T={left:S.left,top:g.topByRow(this._cacheState.row),width:S.width,height:g.rowHeight(this._cacheState.row)},C={left:Math.round(y.labelPoint.x-T.width),top:Math.round(y.labelPoint.y-T.height/2),width:S.width,height:T.height},x=new p(m,T,C),t.append(x)}return this.isAnchorsRequired()&&(i=[o,s],this._model.lineBeingCreated()!==this._source&&i.push(l),t.append(this.createLineAnchor({points:i}))),t},inherit(r,a),r.LevelsCount=11,r.prototype.getCache=function(){return this._model._fibWedgeLabelsCache||(this._model._fibWedgeLabelsCache=new o),this._model._fibWedgeLabelsCache},r.prototype.pointsCount=function(){return 3},r.prototype.title=function(){return"Fib Wedge"},r.prototype.setPoint=function(t,e){var i,o,n,s,r,l,h;a.prototype.setPoint.call(this,t,e),this._recursiveGuard||(this._recursiveGuard=!0,2===t?(i=this.pointToScreenPoint(this._points[0])[0],o=this.pointToScreenPoint(this._points[1])[0],n=this.pointToScreenPoint(this._points[2])[0],s=n.substract(i).length(),r=o.substract(i).normalized(),o=i.add(r.scaled(s)),l=this.screenPointToPoint(o),this._properties.points[1].price.setValue(l.price),this._properties.points[1].bar.setValue(l.index)):(i=this.pointToScreenPoint(this._points[0])[0],o=this.pointToScreenPoint(this._points[1])[0],n=this.pointToScreenPoint(this._points[2])[0],h=o.substract(i).length(),r=n.substract(i).normalized(),n=i.add(r.scaled(h)),l=this.screenPointToPoint(n),this._properties.points[2].price.setValue(l.price),this._properties.points[2].bar.setValue(l.index)),this._recursiveGuard=!1)},r.prototype.addPoint=function(t){var e,i,o,n,s,r,l,h;return 2===this._points.length&&(e=this.pointToScreenPoint(this._points[0])[0],i=this.pointToScreenPoint(this._points[1])[0],this.priceScale().isPercent()&&(o=this.ownerSource().firstValue(),t.price=this.priceScale().priceRange().convertFromPercent(t.price,o)),n=this.pointToScreenPoint(t)[0],s=i.substract(e).length(),r=n.substract(e).normalized(),n=e.add(r.scaled(s)),l=this.priceScale().coordinateToPrice(n.y),h=Math.round(this._model.timeScale().coordinateToIndex(n.x)),t={index:h,price:l}),a.prototype.addPoint.call(this,t)},r.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},r.prototype.createPropertiesObject=function(t,e,i){return new h(t,e,i,{range:[1,11]})},e.ArcWedgeRenderer=n,e.FibWedgePaneView=s,e.LineToolFibWedge=r}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(){c.call(this)}function n(t,e){r.call(this,t,e),this._rendererCache={}}function s(t,e){this._constructor="LineToolTrendBasedFibExtension";var i=e||new this.createPropertiesObject("linetooltrendbasedfibextension");a.call(this,t,new n(this,t),i),this.version=s.version,t._trendBasedFibExtensionLabelsCache||(t._trendBasedFibExtensionLabelsCache=new o)}var r=i(103),a=i(74).LineDataSource,l=i(127),h=i(129).RectangleTransparencyRenderer,c=i(130),d=i(131).TrendLineRenderer,p=i(132),u=i(94),_=i(98);inherit(o,c),o.prototype.levelsCount=function(){return s.LevelsCount},o.prototype.points=function(t){return[t.points()[0],t.points()[1]]},o.prototype.startPoint=function(t,e){return t.points()[2]},o.prototype.priceRange=function(t,e){var i=this.points(t),o=i[0],n=i[1],s=e?o.price-n.price:n.price-o.price;return s},o.prototype.sourceIsReady=function(t){return t.points().length>=3},inherit(n,r),n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){var t,e,i,o,n,a,l,h,c,d,p,u,_,f;if(r.prototype.update.call(this),this._cacheState=this._model._trendBasedFibExtensionLabelsCache.updateSource(this._source),!(this._source.points().length<3)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty())for(t=this._source.points()[0],e=this._source.points()[1],i=this._source.points()[2],o=!1,n=this._source.properties(),n.reverse&&n.reverse.value()&&(o=n.reverse.value()),this._levels=[],a=o?t.price-e.price:e.price-t.price,this._source.priceScale().isPercent()&&(l=this._source.ownerSource().firstValue()),h=1;h<=s.LevelsCount;h++)c="level"+h,d=n[c],d.visible.value()&&(p=d.coeff.value(),u=d.color.value(),_=i.price+p*a,this._source.priceScale().isPercent()&&(_=this._source.priceScale().priceRange().convertToPercent(_,l)),f=this._source.priceScale().priceToCoordinate(_),this._levels.push({color:u,y:f,linewidth:n.levelsStyle.linewidth.value(),linestyle:n.levelsStyle.linestyle.value(),index:h}))},n.prototype.renderer=function(){var t,i,o,n,s,r,l,c,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E;if(this._invalidated&&(this._updateImpl(),this._invalidated=!1),t=new _,this._points.length<2)return t;if(i=this._points[0],o=this._points[1],n=this._source.properties(),n.trendline.visible.value()&&(s={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:n.trendline.color.value(),linewidth:n.trendline.linewidth.value(),linestyle:n.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},t.append(new d(s))),this._points.length<3)return this.addAnchors(t),t;for(r=this._points[2],n.trendline.visible.value()&&(s={points:[o,r],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:n.trendline.color.value(),linewidth:n.trendline.linewidth.value(),linestyle:n.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},t.append(new d(s))),l=Math.min(r.x,o.x),c=Math.max(r.x,o.x),f=n.fillBackground.value(),g=n.transparency.value(),m=n.extendLines.value()?this._model.timeScale().width():c,v=this._model._trendBasedFibExtensionLabelsCache,y=v.canvas().get(0),b=0;b<this._levels.length;b++)if(b>0&&f&&(w=this._levels[b-1],i=new e.Point(l,this._levels[b].y),o=new e.Point(m,w.y),S={},S.points=[i,o],S.color=this._levels[b].color,S.linewidth=0,S.backcolor=this._levels[b].color,S.fillBackground=!0,S.transparency=g,t.append(new h(S))),i=new e.Point(l,this._levels[b].y),o=new e.Point(c,this._levels[b].y),s={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._levels[b].color,linewidth:this._levels[b].linewidth,linestyle:this._levels[b].linestyle,extendleft:!1,extendright:n.extendLines.value(),leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},T=new u(u.MOVEPOINT,null,this._levels[b].index),t.append(new d(s,T)),n.showCoeffs.value()||n.showPrices.value()){if(C=this._cacheState.preparedCells.cells[this._levels[b].index-1],!C)continue;switch(n.horzLabelsAlign.value()){case"left":x=i;break;case"center":x=i.add(o).scaled(.5),x.x+=C.width/2,x.x=Math.round(x.x);break;case"right":n.extendLines.value()?x=new e.Point(m-4,this._levels[b].y):(x=new e.Point(m+4,this._levels[b].y),x.x+=C.width,x.x=Math.round(x.x))}P={left:C.left,top:v.topByRow(this._cacheState.row),width:C.width,height:v.rowHeight(this._cacheState.row)},L={left:x.x-P.width,top:x.y,width:C.width,height:P.height},k=n.vertLabelsAlign.value(),"middle"===k&&(L.top-=L.height/2),"bottom"===k&&(L.top-=L.height),E=new p(y,P,L),t.append(E)}return this.addAnchors(t),t},inherit(s,a),s.version=2,s.LevelsCount=24,s.prototype.stop=function(){a.prototype.stop.call(this),this._model._trendBasedFibExtensionLabelsCache.removeSource(this.id())},s.prototype.pointsCount=function(){return 3},s.prototype.title=function(){return"Trend-Based Fib Extension"},s.prototype.migrateVersion=function(t,e,i){1===t&&this.properties().extendLines.setValue(!0)},s.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},s.prototype.createPropertiesObject=function(t,e,i){return new l(t,e,i,{range:[0,8]})},TradingView.LineToolTrendBasedFibExtension=s,t.exports=s}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(t,e){f.call(this,t,e),this._rendererCache=[{},{},{},{},{},{}],this._invalidated=!0}function n(t,e){var i=e||new w("linetoolelliott");_.call(this,t,new o(this,t),i)}function s(t,e){var i=e||new w("linetoolelliott");_.call(this,t,new o(this,t),i),this.version=s.version}function r(t,e){this._constructor="LineToolElliottImpulse";var i=e||new w("linetoolelliottimpulse");s.call(this,t,i)}function a(t,e){this._constructor="LineToolElliottTriangle";var i=e||new w("linetoolelliotttriangle");s.call(this,t,i)}function l(t,e){this._constructor="LineToolElliottTripleCombo";var i=e||new w("linetoolelliotttriplecombo");s.call(this,t,i)}function h(t,e){var i=e||new w("linetoolelliott");_.call(this,t,new o(this,t),i),this.version=h.version}function c(t,e){this._constructor="LineToolElliottCorrection";var i=e||new w("linetoolelliottcorrection");h.call(this,t,i)}function d(t,e){this._constructor="LineToolElliottLineToolElliottDoubleCombo";var i=e||new w("linetoolelliottdoublecombo");h.call(this,t,i)}var p=i(140).EllipseRendererSimple,u=i(104).TextRenderer,_=i(74).LineDataSource,f=i(103),g=i(131).TrendLineRenderer,m=i(141).Action,v=i(94),y=i(98),b=i(65).RGBColor,w=i(80).DefaultProperty;inherit(o,f),o.prototype.renderer=function(){var e,i,o,n,s,r,a,l,h,c,d,_,f,m,w,S,T,C,x,P,L;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),!this._wave)return null;for(e=this.isAnchorsRequired()?0:1,i=new y,o=this._source.properties(),n=0;n<this._wave.length;n++)i.append(new g(this._wave[n]));for(s=1,this._points.length>2&&(r=this._points[2],a=this._points[1],s=t.sign(r.y-a.y)),l=[],h=0,this._model.lineBeingCreated()===this._source&&(h=1),c=new b(this._model.backgroundColor()).blackWhiteContrast(),d=o.color.value(),n=0;n<this._points.length-h;n++,s=-s)n<e||(_=this._source.label(n),f=_.label,"circle"===_.decoration&&(m=this._points[n].clone(),1===s?m.y+=13+_.fontIncrease/2:m.y-=14+_.fontIncrease/2,w=(12+_.fontIncrease)/2+2,r=m.substract(new t.Point(w,w)),a=m.add(new t.Point(w,w)),S={points:[r,a],color:new b(d).darken("black"===c?15:-15).toHex(),linewidth:1,fillBackground:!1},T=new p(S),i.append(T)),"brackets"===_.decoration&&(f="("+f+")"),C={points:[this._points[n]],text:f,color:new b(d).darken("black"===c?15:-15).toHex(),vertAlign:1===s?"top":"bottom",horzAlign:"center",font:"Arial",offsetX:0,offsetY:1===s?5:-10,fontsize:12+_.fontIncrease,bold:_.bold},l.push(C),""!==_&&i.append(new u(C,this._rendererCache[n],new v(v.CHANGEPOINT,n))));if(this.isAnchorsRequired()){for(x=[],P=0;P<l.length;P++)L=this._points[P].clone(),L.y=l[P].points[0].y,L.data=P,x.push(L);this._model.lineBeingCreated()===this._source&&x.pop(),i.append(this.createLineAnchor({points:x}))}return i},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var e,i,o,n,s,r,a,l,h,c,d,p,u,g,m,v;if(f.prototype.update.call(this),this._wave=[],e=this._source.properties(),i=this._source.priceScale(),o=this._model.timeScale(),i&&!i.isEmpty()&&!o.isEmpty()&&(this._source.priceScale().isPercent()&&(n=this._source.ownerSource().firstValue()),s=e.color.value(),e.showWave.value()))for(r=this._source.points(),a=1;a<r.length;a++)l=r[a-1],h=r[a],c=o.indexToCoordinate(l.index),d=o.indexToCoordinate(h.index),p=l.price,u=h.price,this._source.priceScale().isPercent()&&(p=this._source.priceScale().priceRange().convertToPercent(p,n),u=this._source.priceScale().priceRange().convertToPercent(u,n)),g=i.priceToCoordinate(p),m=i.priceToCoordinate(u),v={points:[new t.Point(c,g),new t.Point(d,m)],width:o.width(),height:i.height(),color:TradingView.generateColor(s,0),linewidth:e.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:_.LINEEND_CIRCLE,rightend:_.LINEEND_CIRCLE,endstyle:{strokeWidth:1,fillStyle:this._model.backgroundColor()},overlayLineEndings:!0},this._wave.push(v)},inherit(n,_),n.migrateState=function(t){var e={0:11,1:10,2:9,3:8,4:7,5:6,6:5,7:4,8:3},i={0:11,1:8};"LineToolElliottSubminuette"===t.type&&(t.type="LineToolElliottImpulse",t.state.degree=e[t.state.wavesize]),"LineToolElliottMinor"===t.type&&(t.type="LineToolElliottImpulse",t.state.degree=e[t.state.wavesize]),"LineToolElliottCircle"===t.type&&(t.type="LineToolElliottImpulse",t.state.degree=e[t.state.wavesize]),"LineToolElliottMinorRetr"===t.type&&(t.type="LineToolElliottCorrection",t.state.degree=i[t.state.wavesize]),"LineToolElliottMajorRetr"===t.type&&(t.type="LineToolElliottCorrection",t.state.degree=i[t.state.wavesize])},n.prototype.title=function(){return"Elliott Labels"},n.degrees=[$.t("Supermillennium"),$.t("Millennium"),$.t("Submillennium"),$.t("Grand Supercycle"),$.t("Supercycle"),$.t("Cycle"),$.t("Primary"),$.t("Intermediate"),$.t("Minor"),$.t("Minute"),$.t("Minuette"),$.t("Subminuette"),$.t("Micro"),$.t("Submicro"),$.t("Miniscule")],n.prototype.additionalActions=function(t){var e=new m({text:$.t("Degree")}),i=this;return e.subActions=n.degrees.map(function(e,o){var n=new m({text:e,checkable:!0,checked:i.properties().degree.value()===o});return n.callbacks().subscribe(null,function(){t.setProperty(i.properties().degree,o,"Change Elliott Degree")}),n}),[e]},n.prototype.label=function(t){var e=n.degrees.length-this.properties().degree.value()-1,i=Math.floor(e/3),o=e%3,s=4*Math.floor(i),r=!!(i%2),a=["","brackets","circle"][o],l=this.labelsGroup(),h=l[i][t];return{fontIncrease:s,bold:r,decoration:a,label:h}},inherit(s,n),s.version=3,s.prototype.pointsCount=function(){return 6},s.prototype.migrateVersion=function(t,e,i){if(1===t){var o=$.extend({},this._timePoint[0]);this._timePoint.unshift(o),this._points.length>0&&(o=$.extend({},this._points[0]),this._points.unshift(o))}},inherit(r,s),r._labelsGroups=[["0","1","2","3","4","5"],["0","i","ii","iii","iv","v"],["0","1","2","3","4","5"],["0","I","II","III","IV","V"],["0","1","2","3","4","5"]],r.prototype.labelsGroup=function(){return r._labelsGroups},inherit(a,s),a._labelsGroups=[["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"]],a.prototype.labelsGroup=function(){return a._labelsGroups},inherit(l,s),l._labelsGroups=[["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"]],l.prototype.labelsGroup=function(){return l._labelsGroups},inherit(h,n),h.version=3,h.prototype.pointsCount=function(){return 4},h.prototype.migrateVersion=function(t,e,i){if(1===t){var o=$.extend({},this._timePoint[0]);this._timePoint.insert(o,0),this._points.length>0&&(o=$.extend({},this._points[0]),this._points.insert(o,0))}},inherit(c,h),c._labelsGroups=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]],c.prototype.labelsGroup=function(){return c._labelsGroups},inherit(d,h),d._labelsGroups=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]],d.prototype.labelsGroup=function(){return d._labelsGroups},e.LineToolElliott=n,e.LineToolElliottImpulse=r,e.LineToolElliottTriangle=a,e.LineToolElliottTripleCombo=l,e.LineToolElliottCorrection=c,e.LineToolElliottDoubleCombo=d}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(){c.call(this)}function n(t,e,i){this._data=t,this._hittest=e||new u(u.MOVEPOINT),this._backHittest=i||new u(u.MOVEPOINT_BACKGROUND)}function s(t,e){a.call(this,t,e),this._rendererCache={},this._invalidated=!0,this._numericFormatter=new g}function r(t,e){this._constructor="LineToolFibCircles";var i=e||this.createPropertiesObject("linetoolfibcircles");l.call(this,t,new s(this,t),i),t._fibCirclesLabelsCache||(t._fibCirclesLabelsCache=new o)}var a=i(103),l=i(74).LineDataSource,h=i(127),c=i(130),d=i(131).TrendLineRenderer,p=i(132),u=i(94),_=i(98),f=i(82),g=f.NumericFormatter;inherit(o,c),o.prototype.levelsCount=function(){return r.LevelsCount},n.prototype.draw=function(t){var e,i,o,n,s,r,a,l;t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,e=this._data.points[0],i=this._data.points[1],o=Math.abs(e.x-i.x),n=Math.abs(e.y-i.y),s=e.add(i).scaled(.5),o<1||n<1||(this._data.wholePoints&&(a=this._data.wholePoints[0],l=this._data.wholePoints[1],r=Math.abs(a.x-l.x)),t.save(),t.translate(s.x,s.y),t.scale(1,n/o),t.beginPath(),t.arc(0,0,o/2,0,2*Math.PI,!1),t.restore(),t.stroke(),this._data.fillBackground&&(this._data.wholePoints&&(t.translate(s.x,s.y),t.scale(1,n/o),t.arc(0,0,r/2,0,2*Math.PI,!0)),t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency,!0),t.fill()))},n.prototype.hitTest=function(e){var i,o,n,s,r,a,l,h,c,d,p;return this._data.points.length<2?null:(i=this._data.points[0],o=this._data.points[1],n=.5*Math.abs(i.x-o.x),s=Math.abs(i.x-o.x),r=Math.abs(i.y-o.y),a=i.add(o).scaled(.5),l=e.substract(a),s<1||r<1?null:(h=(o.y-i.y)/(o.x-i.x),l.y/=h,c=l.x*l.x+l.y*l.y,d=c-n*n,d=t.sign(d)*Math.sqrt(Math.abs(d/n)),p=3,Math.abs(d)<p?this._hittest:this._data.fillBackground&&!this._data.noHitTestOnBackground&&d<p?this._backHittest:null))},inherit(s,a),s.prototype.update=function(){this._invalidated=!0},s.prototype._updateImpl=function(){var e,i,o,n,s,l,h,c,d,p,u,_;if(a.prototype.update.call(this),this._cacheState=this._model._fibCirclesLabelsCache.updateSource(this._source),!(this._source.points().length<2)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty())for(e=this._points[0],i=this._points[1],this._center=e.add(i).scaled(.5),o=Math.abs(i.x-e.x),n=Math.abs(i.y-e.y),this._levels=[],s=this._source.properties(),l=1;l<=r.LevelsCount;l++)h="level"+l,c=s[h],c.visible.value()&&(d=c.coeff.value(),p=c.color.value(),u=[],u.push(new t.Point(this._center.x-.5*o*d,this._center.y-.5*n*d)),u.push(new t.Point(this._center.x+.5*o*d,this._center.y+.5*n*d)),_=new t.Point(this._center.x,this._center.y+.5*n*d),this._levels.push({color:p,points:u,labelPoint:_,linewidth:c.linewidth.value(),linestyle:c.linestyle.value(),index:l}))},s.prototype.renderer=function(){var t,e,i,o,s,r,a,h,c,f,g,m,v,y,b;if(this._invalidated&&(this._updateImpl(),this._invalidated=!1),t=new _,this._points.length<2)return t;for(e=this._source.properties(),i=e.fillBackground.value(),o=e.transparency.value(),s=this._model._fibCirclesLabelsCache,r=s.canvas().get(0),a=0;a<this._levels.length;a++)if(h=this._levels[a],c={},c.points=h.points,c.color=h.color,c.linewidth=h.linewidth,c.backcolor=h.color,a>0&&(c.wholePoints=this._levels[a-1].points),c.fillBackground=i,c.transparency=o,f=new u(u.MOVEPOINT,null,h.index),t.append(new n(c,f)),e.showCoeffs.value()){if(g=this._cacheState.preparedCells.cells[this._levels[a].index-1],!g)continue;m={left:g.left,top:s.topByRow(this._cacheState.row),width:g.width,height:s.rowHeight(this._cacheState.row)},v={left:Math.round(h.labelPoint.x-m.width),top:Math.round(h.labelPoint.y-m.height/2),width:g.width,height:m.height},y=new p(r,m,v),t.append(y)}return e.trendline.visible.value()&&(b={points:[this._points[0],this._points[1]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:e.trendline.color.value(),linewidth:e.trendline.linewidth.value(),linestyle:e.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:l.LINEEND_NORMAL,rightend:l.LINEEND_NORMAL},t.append(new d(b))),this.addAnchors(t),t},inherit(r,l),r.LevelsCount=11,r.prototype.pointsCount=function(){return 2},r.prototype.title=function(){return"Fib Circles"},r.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},r.prototype.createPropertiesObject=function(t,e,i){return new h(t,e,i,{range:[1,11]})},e.EllipseRendererSimple=n,e.LineToolFibCircles=r}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(e){e||(e={}),this.checkable=e.checkable||!1,this.checked=e.checked||null,this.enabled=void 0===e.enabled||e.enabled,this.visible=e.visible||!0,this.active=!0,this.font=e.font||"Arial",this.icon=e.icon||null,this.iconText=e.iconText||null,this.iconVisibleInMenu=e.iconVisibleMenu||!0,this.deleteButton=e.deleteButton||null,this.shortcut=null,this.setShortCut(e.shortcut,e.doNotBindShortcut),this.statusTip=e.statusTip||null,this.text=e.text||null,this.toolTip=e.toolTip||null,this.htmlclass=e.htmlclass||null,this._callbackContext=e.callbackContext||this,this._callbacks=new t,this.subActions=e.subActions||[]}function n(){o.call(this),this.font=null,this.subActions=null,this.htmlclass="action-separator"}function s(t){o.call(this),this.deferred=t}var r=i(142);o.prototype.callbacks=function(){return this._callbacks},o.prototype.callbackContext=function(){return this._callbackContext},o.prototype.setCallbackContext=function(t){this._callbackContext=t},o.prototype.hasSubActions=function(){return this.subActions&&this.subActions.length},o.prototype.setChecked=function(t){this.checked=t},o.prototype._toggleChecked=function(){this.checked=!this.checked},o.prototype.setVisible=function(t){this.visible=t},o.prototype.setEnabled=function(t){this.enabled=t},o.prototype.disable=function(){this.setEnabled(!1);
},o.prototype.enable=function(){this.setEnabled(!0)},o.prototype.setActive=function(t){this.active!==t&&(this.active=t,this.shortcut&&!this.doNotBindShortcut&&(t?this._bindShortCut():this._unbindShortCut()))},o.prototype.setShortCut=function(t,e){t&&(this.shortcut=t,e!==!0&&this._bindShortCut())},o.prototype._bindShortCut=function(){r.bind(this.shortcut,function(t){if(t.preventDefault(),this.enabled)return this.executeCallback(),!1}.bind(this))},o.prototype._unbindShortCut=function(){r.unbind(this.shortcut)},o.prototype.setIconVisible=function(t){this.iconVisibleInMenu=t},o.prototype.executeCallback=function(t){this._lastEvent=t,this._toggleChecked(),this._callbacks.fire(this)},inherit(n,o),inherit(s,o),e.Action=o,e.ActionSeparator=n,e.ActionPlaceholder=s}).call(e,i(28))},function(t,e){"use strict";function i(){return this.bindings={},this.$doc=$(document),this}i.prototype.parseName=function(t){return"."+t.replace("+","")},i.prototype.bind=function(t,e){var i=this.parseName(t);this.$doc.unbind("keydown"+i).bind("keydown"+i,t,e),this.bindings[t]=e},i.prototype.unbind=function(t){this.$doc.unbind("keydown"+this.parseName(t)),delete this.bindings[t]},t.exports=new i},function(t,e,i){"use strict";function o(t,e,i){this.customization={forcePriceAxisLabel:!0,disableSelection:!0,disableErasing:!0},n.call(this,t,e,i)}var n=i(74).LineDataSource;inherit(o,n),o.POINTS_COUNT=1,o.prototype.pointsCount=function(){return o.POINTS_COUNT},o.prototype.hasContextMenu=function(){return!1},o.prototype.state=function(){return null},o.prototype.startMoving=function(){n.prototype.startMoving.apply(this,arguments),this._cursorMoved=!1},o.prototype.endMoving=function(){n.prototype.endMoving.apply(this,arguments),this._cursorMoved=!1},o.prototype.correctPoints=function(t){var e,i,o,n,s;for(this._currentMovingPoint&&this._startMovingPoint?this._currentMovingPoint.price-this._startMovingPoint.price&&(this._cursorMoved=!0):this._cursorMoved=!1,e=this.priceScale(),i=e.mainSource().base(),o=1/i,n=0;n<t.length;n++)s=t[n],this._cursorMoved&&(s.price=this._currentMovingPoint.price),s.price=o*Math.round(s.price/o),t[n]=s},o.prototype.userEditEnabled=function(){return!0},o.prototype.isUserDeletable=function(){return!1},o.prototype.showInObjectTree=function(){return!1},t.exports=o},function(t,e,i){"use strict";function o(t,e,i,o){var n,s,l,g,m,v,y,b,w,S,T,C,x,P,L,k="VbPFixed@tv-volumebyprice",E=h.lineToolNameForPointsBasedStudy(k);if(i=i||f.findStudyMetaInfo(t.studiesMetaData(),k),n=t.studyVersioning(),s=e||c(i,null,null,n),this._metaInfo=i,this.m_data=new _,this._plotOffsets={},this._plotOffsetsMetaInfoOverride={},l=this,g=new a(l,t),m=new h.StudyPaneView_hhists(l,t),v=new h.StudyPaneView_horizlines(l,t),y=new h.StudyPaneView_polygons(l,t),b=[g,m,v,y],o=t.mainSeries(),i.plots.length>0&&(w=new d(l,o,t,i.plots[0].id),b.push(w)),i.plots.length>1&&(S=new d(l,o,t,i.plots[1].id),b.push(S)),i.plots.length>2&&(T=new d(l,o,t,i.plots[2].id),b.push(T)),r.call(this,t,b,s,E),this._turnaroundCounter=1,this._turnaround="vbpfixed_"+this._turnaroundCounter,this._metaInfo=i,this._graphics=new p(i),this._plotFields=[],C=this.metaInfo().plots)for(x=0,P=C.length;x<P;x++)L=C[x].id,this._plotFields.push(L);this.clearData(),this._formatter=new u}var n=i(145),s=i(74).LineDataSource,r=n.StudyLineDataSource,a=n.StudyLineDataSourcePaneView,l=i(150),h=l.Study,c=l.prepareStudyProperties,d=i(153).StudyPaneView,p=i(147),u=i(82).VolumeFormatter,_=i(112),f=i(114);inherit(o,r),o.prototype.pointsCount=function(){return 2},o.prototype._requestStudy=function(){var t,e,i,o,n,s,r=this.points()[0],a=this.points()[1],l=Math.min(r.index,a.index),c=Math.max(r.index,a.index);return l===c?void this.clearData():(t=this._model.mainSeries().bars().valueAt(l),e=this._model.mainSeries().bars().valueAt(c),void(t&&e&&(i=1e3*t[TradingView.TIME_PLOT],o=1e3*e[TradingView.TIME_PLOT],n=[],void 0!==this.properties().inputs.rowsLayout&&n.push(this.properties().inputs.rowsLayout.value()),n.push(this.properties().inputs.rows.value()),n.push(this.properties().inputs.volume.value()),n.push(i),n.push(o),n.push(this.properties().inputs.vaVolume.value()),s=this,this._studyId?(this._turnaround="vbpfixed_"+ ++this._turnaroundCounter,this._model.chartApi().modifyStudy(this._studyId,this._turnaround,n,function(t){s.onData(t)})):(this._studyId=h.makeNextStudyId(),this._model.chartApi().createStudy(this._studyId,this._turnaround,this._model.mainSeries()._seriesId,this._metaInfo.id+"-1!",n,function(t){s.onData(t)})))))},o.prototype.onData=function(t){if("data_update"===t.method&&t.params.customId==="pointset_"+this._currentPointsetId)s.prototype.onData.call(this,t),2===this._points.length&&this._requestStudy();else if("data_update"===t.method&&t.params.customId===this._studyId){if(!this._checkTurnaround(t.params.turnaround))return;t.params.nonseries.d=h.prototype._makeJSONForNSData.call(this,t),this._processPlotOffsets(t.params),this._mergeData(t.params.plots),""!==t.params.nonseries.d&&(this._graphics.process(t.params.nonseries),this._correctPoints(this._graphics.graphics())),t.params.nonseries.indexes.length>0&&(this._indexes=t.params.nonseries.indexes),this.updateAllViews(),this._model.updateSource(this)}},o.prototype._correctPoints=function(t){var e,i,o,n,s,r;if(t&&(void 0===t.indexes||0!==t.indexes.length)&&t.hhists){for(e=t.hhists[0].data,i=null,o=null,n=0;n<e.length;++n)s=e[n].priceLow,r=e[n].priceHigh,(!i||s<i)&&(i=s),(!o||r>o)&&(o=r);this._points[0].price=o,this._points[1].price=i}},o.prototype.calcIsActualSymbol=function(){this._isActualSymbol=!0,this.calcIsActualInterval()},o.prototype.formatter=function(){return this._formatter},o.prototype.isSelfColorerPlot=function(t){return h.isSelfColorerPlot(this,t)},o.prototype.offset=function(t){return h.offset(this,t)},o.prototype.data=function(){return this.m_data},o.prototype._processPlotOffsets=function(t){h.processPlotOffsets(this,t)},o.prototype._mergeData=function(t){this.m_data.merge(t)},t.exports=o},function(t,e,i){"use strict";function o(t,e,i,s){var a=new n(this,t);e.push(a),r.call(this,t,e,i),this.properties().listeners().subscribe(this,o.prototype.changeStyles),this._constructor=s,this._studyId=null,this._nonseriesdata=null,this._indexes=null,this._metaInfo=null,this._graphics=null,this._inputs=null}function n(t,e){a.call(this,t,e)}function s(t,e){a.call(this,t,e)}var r=i(74).LineDataSource,a=i(103),l=i(146).VertLineRenderer,h=i(131).TrendLineRenderer,c=i(93).SelectionRenderer,d=i(98),p=i(147),u=i(112),_=i(114);inherit(o,r),o.prototype.pointsCount=function(){throw Error("Reimplement this in a child class")},o.prototype.title=function(){return this._metaInfo.description},o.prototype.studyId=function(){return this._metaInfo.id},o.prototype._requestStudy=function(){throw Error("Reimplement this in a child class")},o.prototype.changeStyles=function(){var t,e,o,n=i(148);if(this._inputs){t=n.splitInputs(this.properties().inputs.state()),e=t.obj;for(o in e)if(e[o]!==this._inputs[o]){this._inputs=e,this._requestStudy(),this._properties.lastUpdateTime.setValue((new Date).valueOf());break}}else t=n.splitInputs(this.properties().inputs.state()),this._inputs=TradingView.clone(t.obj),this._requestStudy(),this._properties.lastUpdateTime.setValue((new Date).valueOf())},o.prototype._checkTurnaround=function(t){return t===this._turnaround||t===this._model.mainSeries()._turnaround||t===this._model.mainSeries()._turnaround+"_"+this._turnaround},o.prototype.stop=function(){r.prototype.stop.call(this),this._studyId&&this._model.chartApi().removeStudy(this._studyId)},o.prototype.onData=function(t){throw Error("Reimplement this in a child class")},o.prototype._correctedPoint=function(t){var e=parseInt(this._model.mainSeries().bars().first(),10),i=parseInt(this._model.mainSeries().bars().last(),10);return t.index=Math.max(t.index,e),t.index=Math.min(t.index,i),t},o.prototype.addPoint=function(t){var e=r.prototype.addPoint.call(this,this._correctedPoint(t));return e},o.prototype.setLastPoint=function(t){return r.prototype.setLastPoint.call(this,this._correctedPoint(t))},o.prototype.move=function(t){},o.prototype.clearData=function(){void 0!==this.m_data&&(this.m_data=new u(this._plotFields)),this._nonseriesdata=null,this._indexes=null,this._graphics=new p(this._metaInfo),this.updateAllViews()},o.prototype.state=function(t){var e=r.prototype.state.call(this,t);return t&&(void 0!==this.m_data&&(e.data=this.m_data.state()),e.nonseriesdata=this._nonseriesdata,e.nonseriesindexes=this._indexes,e.graphics=this._graphics.graphics()),this.metaInfo()instanceof _?e.metaInfo=this.metaInfo().state():(e.metaInfo=$.extend({},this.metaInfo()),e.metaInfo.id=_.parseIdString(e.metaInfo.id+(e.metaInfo.version?"-"+e.metaInfo.version:"")).fullId),e},o.prototype.restoreData=function(t){void 0!==this.m_data&&void 0!==t.data&&this.m_data.restoreState(t.data),this._nonseriesdata=t.nonseriesdata?t.nonseriesdata:null,this._indexes=t.nonseriesindexes?t.nonseriesindexes:null,this._graphics.setGraphics(t.graphics?t.graphics:p.emptyGraphics())},o.prototype.setPoint=function(t,e){this._nonseriesdata=null,this._indexes=null,r.prototype.setPoint.call(this,t,this._correctedPoint(e))},o.prototype.disconnect=function(){this._studyId=0},o.prototype.graphics=function(){return this._graphics.graphics()},o.prototype.firstValue=function(){return this._model.mainSeries().data().firstValue()},o.prototype.formatter=function(){return this._model.mainSeries().data().formatter()},o.prototype.metaInfo=function(){return this._metaInfo},inherit(n,a),n.prototype.renderer=function(){var t,e,i,o,n,s=new d;return this._points.length<2?s:this._source._nonseriesdata?s:this._source._graphics&&!this._source._graphics.isEmpty()?s:(t=this._points[0],e=this._points[1],i={},i.points=[t],i.color="#808080",i.linewidth=this._source._doNotNeedLine?0:1,i.linestyle=CanvasEx.LINESTYLE_SOLID,s.append(new l(i)),o={},o.points=[e],o.color="#808080",o.linewidth=this._source._doNotNeedLine?0:1,o.linestyle=CanvasEx.LINESTYLE_SOLID,s.append(new l(o)),n={points:[t,e],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:"#808080",linewidth:this._source._doNotNeedLine?0:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},s.append(new h(n)),s)},inherit(s,a),s.prototype.renderer=function(){var t=new d;return this.isAnchorsRequired()&&(t.append(new c({points:this._points})),t.append(this.createLineAnchor({points:this._points}))),t},e.StudyLineDataSource=o,e.StudyLineDataSourcePaneView=s},function(t,e,i){(function(t){"use strict";function o(t,e){this._data=t,this._hittest=e}function n(t,e){a.call(this,t,e),this._invalidated=!0}function s(t,e){h.call(this),this._source=t,this._model=e,this._invalidated=!0}function r(t,e){this._constructor="LineToolVertLine";var i=e||new _("linetoolvertline");this._timeAxisView=new s(this,t),l.call(this,t,new n(this,t),i)}var a=i(103),l=i(74).LineDataSource,h=i(77),c=i(78),d=i(94),p=i(95).PaneRendererClockIcon,u=i(98),_=i(80).DefaultProperty,f=i(82).DateTimeFormatter;o.prototype.draw=function(t){var e,i;0!==this._data.points.length&&(this._data.linewidth<=0||(e=this._data.points[0].x,t.translate(1,0),i=t.canvas.height,t.lineCap="square",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,CanvasEx.drawLine(t,e,0,e,i)))},o.prototype.hitTest=function(t){var e,i;return 0===this._data.points.length?null:(e=3,i=this._hittest||new d(d.MOVEPOINT),Math.abs(t.x-this._data.points[0].x)<=e?i:null)},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var e,i,n;return this._invalidated&&this.updateImpl(),e={},e.points=this._points,e.color=this._source.properties().linecolor.value(),e.linewidth=this._source.properties().linewidth.value(),e.linestyle=this._source.properties().linestyle.value(),i=new u,i.append(new o(e)),this.addAnchors(i),TradingView.printing||!this._source.hasAlert.value()||this._model.readOnly()||1!==e.points.length||(n=new t.Point(this._points[0].x,this._source.priceScale().height()/2),this._source.getAlertIsActive(function(t){i.append(new p({point1:n,color:t?e.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))})),i},inherit(s,h),s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){var t,e;this._model.timeScale().isEmpty()||0!==this._source.points().length&&(this._text="",this._background=this._source.properties().linecolor.value(),t=this._source.points()[0].index,this._coordinate=this._model.timeScale().indexToCoordinate(t),e=this._model.timeScale().indexToUserTime(t),e&&(this._text=new f(this._model.mainSeries().isDWM()).format(e)),this._invalidated=!1)},s.prototype.renderer=function(){this._invalidated&&this.updateImpl();var t={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background};return new c(t)},inherit(r,l),r.prototype.pointsCount=function(){return 1},r.prototype.title=function(){return"Vertical Line"},r.prototype.timeAxisViews=function(){return this.symbol()!==this._model.mainSeries().symbol()?null:this.properties().showTime.value()?[this._timeAxisView]:null},r.prototype.updateAllViews=function(){l.prototype.updateAllViews.call(this),this._timeAxisView.update()},r.prototype.canHasAlert=function(){return!0},r.prototype._getAlertPlots=function(){var t=this._points[0],e={index:t.index,price:t.price+1};return[this._linePointsToAlertPlot([t,e],null,!0,!0)]},e.VertLineRenderer=o,e.LineToolVertLine=r}).call(e,i(21))},function(t,e){"use strict";function i(t){this._graphics=i.emptyGraphics(),assert(!!t,"Study metaInfo is absent!"),this._metaInfo=t}i.emptyGraphics=function(){return{indexes:[]}},i.prototype.isEmpty=function(){var t=Object.keys(this._graphics).length>1;return 0===this._graphics.indexes.length&&!t},i.prototype.graphics=function(){return this._graphics},i.prototype.setGraphics=function(t){this._graphics=t,this._postProcessGraphicsData()},i.prototype.process=function(t){if(""!==t.d)return t.d.indexes_replace?void this.replaceIndexes(t):void(t.d.graphicsCmds&&(this.processEraseCmds(t.d.graphicsCmds.erase),this.processCreateCmds(t.d.graphicsCmds.create,t.indexes)))},i.prototype.replaceIndexes=function(t){""!==t.d&&(assert(!!t.d.indexes_replace),this._graphics.indexes=t.indexes)},i.prototype.processEraseCmds=function(t){var e,o,n,s,r;if(t)for(assert(!!this._graphics,"_graphics object doesn't exist in the study!"),assert(!!this._graphics.indexes,"_graphics.indexes array doesn't exist in the study!"),e=0;e<t.length;++e)if(o=t[e],"all"===o.action)this._graphics=i.emptyGraphics();else{if("one"!==o.action)throw Error("Unknown graphics command "+o.action);for(n in this._graphics[o.type])s=this._graphics[o.type][n],r=i._findGraphicsObjIndexById(s.data,o.id),r>=0&&s.data.splice(r,1)}},i._findGraphicsObjIndexById=function(t,e){for(var i=0;i<t.length;++i)if(t[i].id===e)return i;return-1},i.prototype.processCreateCmds=function(t,e){var i,o,n,s,r,a;if(t){assert(!!e,"indexes are missing in the study nonseries response!"),assert(!!this._graphics,"_graphics object doesn't exist in the study!"),assert(!!this._graphics.indexes,"_graphics.indexes array doesn't exist in the study!");for(i in t){assert(i in this._metaInfo.graphics,"There is a '"+i+"' in study response, but it doesn't present in metaInfo!");for(o=0;o<t[i].length;++o){n=t[i][o],s=n.styleId,assert(s in this._metaInfo.graphics[i]),this._graphics[i]||(this._graphics[i]=[]),r=null;for(a=0;a<this._graphics[i].length;++a)if(this._graphics[i][a].styleId===s){r=this._graphics[i][a];break}null===r&&(r={styleId:s,data:[]},this._graphics[i].push(r)),r.data=r.data.concat(n.data)}}"nochange"===e||(assert(Array.isArray(e)),this._graphics.indexes=e),this._postProcessGraphicsData()}},i.prototype._postProcessGraphicsData=function(){var t,e,o;if(this._graphics)for(t in this._graphics.hhists)e=this._graphics.hhists[t],i._sortHHistItemsByPrice(e.data),o=this._graphics.indexes,e.dataObj=i._splitHHistItemsBySession(e.data,o)},i._sortHHistItemsByPrice=function(t){t.sort(function(t,e){return t.priceLow-e.priceLow})},i._splitHHistItemsBySession=function(t,e){var i,o,n,s={};for(i=0;i<t.length;++i)o=t[i],n=e[o.firstBarTime],void 0!==n?(n in s||(s[n]=[]),s[n].push(o)):TradingView.logError("Cannot find index "+o.firstBarTime+" in study timescale indexes");return s},t.exports=i},function(t,e,i){"use strict";function o(t,e){var o,n,s,r,a,l,h,c,d,p,u;if(!t)throw Error("No studies metainfo");if(o=i(149),this._studiesMetainfo=t,!e)throw Error("No studies migrations");for(this._studiesMigrations=e,this._migrations={},n=0;n<this._studiesMigrations.length;n++)for(s=this._studiesMigrations[n],r=0;r<s.length;r++)for(a=s[r],l=a.versFrom,h=a.versTo,c=0;c<a.studyMigrations.length;c++){if(d=a.studyMigrations[c],p=d.studyId,0===d.rules.length)throw Error("Study Migration should have at least one convertion rule");u=p in this._migrations?this._migrations[p]:new o(p),u.addMigration(l,h,d.rules),this._migrations[p]=u}this._clientMigrations=[function(t,e){var i,o,n,s,r;if(0===this._studiesMetainfo.length||!t.isTVScript||t.version>=22)return e;for(i={},o=0,n=0;s=e[n],void 0!==s;)r=e[s.id],s.isFake&&(s.id="in_"+o++),i[n]=s,i[s.id]=r,n++;return i}]}var n=i(64),s=i(114);o.prototype.updateMetaInfo=function(t){var e,i,o;if(!t)return t;for(assert(!t.isTVScript,"This method should update only built-in java indicators metaInfo. For Pine indicators use updateMetaInfoAsync"),e=null,i=this._studiesMetainfo,o=0;o<i.length;o++)if(i[o].id===t.id){e=i[o];break}return TradingView.clone(e)},o.prototype.updateMetaInfoAsync=function(t,e){var i,o,n,s=$.Deferred(),r=s.promise();if(!t)return s.reject("No old metaInfo was given"),r;if(e)return s.resolve(null),r;if(t.isTVScript&&void 0!==t.TVScriptSourceCode);else{for(i=null,o=this._studiesMetainfo,n=0;n<o.length;n++)if(o[n].id===t.id){i=o[n];break}i?s.resolve(TradingView.clone(i)):s.resolve(null)}return r},o.prototype.updateStudyState=function(t,e,i){var n,r,a,l,h,c,d,p,u,_,f,g,m,v,y;if(t){t=TradingView.clone(t),n=e.id,n in this._migrations&&(r=this._migrations[n].updateInputs(e.version,t.inputs),t.inputs=r);for(a=0;a<this._clientMigrations.length;++a)r=this._clientMigrations[a].call(this,e,t.inputs),Object.keys(r).length===Object.keys(t.inputs).length?t.inputs=r:TradingView.logWarn("StudyVersioning._clientMigrations application returned bad result. Skipping it...")}if(l=i,l&&t&&(h={},o.mergeInputs(h,l.inputs),o.mergeInputs(h,l.defaults.inputs),o.mergeInputs(h,t.inputs),t.inputs=h,c=s.versionOf(e),e.isTVScript&&e.TVScriptSourceCode&&c>=12&&c<=26)){for(d={},a=0;a<e.plots.length;++a)p=e.plots[a],u=l.plots[a],d[p.id]=u.id;for(_=Object.keys(t.styles),a=0;a<_.length;++a)f=_[a],g=t.styles[f],delete t.styles[f],m=d[f],t.styles[m]=g;for(v=Object.keys(t.plots),a=0;a<v.length;++a)y=v[a],f=t.plots[y].id,t.plots[y].id=d[f]}return t},o.prototype.patchPointsBasedStudyState=function(t){return o._fixInputsMaxValue(t.state,t.metaInfo),t},o.prototype.patchPointsBasedStudyData=function(t,e){if("battle"!==n())return e;if(!t||!e)return e;var i=TradingView.clone(e);return"VbPFixed@tv-volumebyprice"===t.id&&t.version&&t.version<=4&&o._patchOldVolumeProfiles(0,i),i},o.prototype.patchStudyData=function(t,e,i,r){var a,l,h,c,d,p,u;if("battle"!==n())return{data:e,nsData:i,indexes:r};if(a=TradingView.clone(e),l=TradingView.clone(i),h=TradingView.clone(r),"VbPVisible@tv-volumebyprice"===t.id&&t.version&&t.version<=4&&o._patchOldVolumeProfiles(0,a.graphics),"VbPSessions@tv-volumebyprice"===t.id&&t.version&&t.version<=4&&o._patchOldVolumeProfiles(0,a.graphics),c=s.versionOf(t),t.isTVScript&&t.TVScriptSourceCode&&c>=12&&c<=26)for(d=a.columns,a.columns=[],p=0;p<d.length;++p)u="plot_"+p,a.columns.push(u);return{data:a,nsData:l,indexes:h}},o._patchOldVolumeProfiles=function(t,e){var i,o=e.hhists[t].data,n=[];for(i in o)n=n.concat(o[i]);e.hhists[0].data=n},o._fixInputsOrder=function(t,e){var i,n,r,a,l=s.getOrderedInputIds(e),h=o.splitInputs(t.inputs),c=h.arr,d=h.obj,p=TradingView.merge({},d);for(i=0;i<l.length;++i)n=l[i],r=o.findInputKeyById(c,n),null!==r&&(a=c[r],p[i]=a);t.inputs=p},o.INPUT_MAX_VALUE=253370764800,o._verifyInputsMaxValue=function(t){var e,i,n=o.INPUT_MAX_VALUE;if(t.inputs)for(e=0;e<t.inputs.length;e++)i=t.inputs[e],"integer"===i.type&&i.max&&i.max>n&&TradingView.logWarn("Bad integer input max value in metaInfo id="+t.id+" title="+t.description)},o._fixInputsMaxValue=function(t,e){var i,n,s,r,a,l;if(!TradingView.isAbsent(e)){if(i=o.INPUT_MAX_VALUE,e.inputs)for(n=0;n<e.inputs.length;n++)s=e.inputs[n],"integer"===s.type&&s.max&&s.max>i&&(s.max=i);if(t&&t.inputs){r=o.splitInputs(t.inputs),a=r.arr;for(l in a)s=a[l],"integer"===s.type&&s.max&&s.max>i&&(s.max=i);t.inputs=TradingView.merge(r.obj,r.arr)}}},o.prototype.patchPropsStateAndMetaInfo=function(t,e,i){var n,r,a,l,h,c,d,p,u,_;if(o._fixInputsOrder(t,e),o._fixInputsMaxValue(t,e),e.isTVScript&&"undefined"!=typeof TVScript&&TVScript.createScriptIdPart&&(e.scriptIdPart=e.scriptIdPart||TVScript.createScriptIdPart()),n=60,e.isTVScript&&e.version<n&&("Script$TV_EARNINGS@tv-scripting"!==e.id&&"Script$TV_DIVIDENDS@tv-scripting"!==e.id&&"Script$TV_SPLITS@tv-scripting"!==e.id||delete e.TVScriptSourceCode),"Volume"!==e.id&&"Volume@tv-basicstudies"!==e.id||0!==e.inputs.length||(e.inputs=[{id:"length",type:"integer",defval:20,min:1,max:1e3}],e.plots.push({id:"vol_ma",type:"line"})),"Volume@tv-basicstudies"===e.id&&e.version&&e.version<=46&&(t.styles.vol.transparency=t.transparency||87),"PivotPointsStandard@tv-basicstudies"===e.id&&(0===e.inputs.length?(t.inputs={kind:"Traditional",showHistoricalPivots:!0},e.inputs=[{defval:"Traditional",id:"kind",type:"text",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla"]},{id:"showHistoricalPivots",type:"bool",defval:!0}]):1===e.inputs.length&&(t.inputs={kind:"Traditional"},e.inputs=[{defval:"Traditional",id:"kind",type:"text",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla"]},{id:"showHistoricalPivots",type:"bool",defval:!0}]),void 0===t._hardCodedDefaultsVersion&&(t._hardCodedDefaultsVersion=1,r=t.color,delete t.color,t.levelsStyle={colors:{P:r,"S1/R1":r,"S2/R2":r,"S3/R3":r,"S4/R4":r,"S5/R5":r}})),"CMF"===e.shortId&&2===e.inputs.length&&(t.inputs={length:t.inputs["length fast"]},e.inputs=e.inputs.splice(0,1),e.inputs[0].id="length"),e.defaults&&void 0===e.defaults.precision&&(["Volume@tv-basicstudies","VbPVisible@tv-volumebyprice","VbPSessions@tv-volumebyprice"].indexOf(e.id)!==-1?e.defaults.precision=0:e.defaults.precision=4),a=60,e.version<a)for(l=["DIVIDENDS","SPLITS","EARNINGS"],h=6,c=0;c<l.length;c++)e.id.startsWith("Script$TV_"+l[c]+"@tv-scripting")&&(e.fullId="ESD"+e.fullId.substring(h),e.id="ESD"+e.id.substring(h),e.name="ESD"+e.name.substring(h),e.shortId="ESD"+e.shortId.substring(h),e.productId="ESD"+e.productId.substring(h));if("MA"===e.id){switch(d=new s({id:"MAExp",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgExp",type:"line"}],palettes:{}}),p=new s({id:"MASimple",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgSimple",type:"line"}],palettes:{}}),u=new s({id:"MAVolumeWeighted",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgVolumeWeighted",type:"line"}],palettes:{}}),_=new s({id:"MAWeighted",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgWeighted",type:"line"}],palettes:{}}),t.inputs.type){case"exp":e=d;break;case"simple":e=p;break;case"weighted":e=_;break;case"volume weighted":e=u}t.styles[e.plots[0].id]=t.styles.MovAvg,delete t.styles.MovAvg,delete t.inputs.type}return i.oldShowStudyLastValueProperty&&(t.oldShowLastValue=t.showLastValue),delete t.showLastValue,delete t.showStudyArguments,{propsState:t,metaInfo:e}},o.compareStudyVersions=function(t,e){var i,o,n,s,r,a;return t=""+t,e=""+e,i=t.split("."),o=i[0],o=parseInt(o,10),n=i.length>1?i[1]:"0",n=parseInt(n,10),s=e.split("."),r=s[0],r=parseInt(r,10),a=s.length>1?s[1]:"0",a=parseInt(a,10),o<r?-1:o>r?1:n<a?-1:n>a?1:0},o.isLess=function(t,e){var i=o.compareStudyVersions(t,e);return i<0},o.isLessOrEqual=function(t,e){var i=o.compareStudyVersions(t,e);return i<=0},o.isEqual=function(t,e){var i=o.compareStudyVersions(t,e);return 0===i},o.isGreater=function(t,e){var i=o.compareStudyVersions(t,e);return i>0},o.isGreaterOrEqual=function(t,e){var i=o.compareStudyVersions(t,e);return i>=0},o.isVersionTesting=function(t){var e,i;return!!t&&(t=""+t,e=RegExp("\\d+.\\d+"),i=e.exec(t)===t)},o.isVersionHead=function(t){var e,i;return!!t&&(t=""+t,e=RegExp("\\d+"),i=e.exec(t)===t)},o.mergeInputs=function(t,e){o.mergeInputsArrPart(t,e),o.mergeInputsObjPart(t,e)},o.mergeInputsArrPart=function(t,e){var i,n,s=o.splitInputs(e);for(i in s.arr)n=o.findInputKeyById(t,s.arr[i].id),n?TradingView.merge(t[n],s.arr[i]):o.appendInputInfoToArr(t,s.arr[i])},o.mergeInputsObjPart=function(t,e){var i=o.splitInputs(e);TradingView.merge(t,i.obj)},o.appendInputInfoToArr=function(t,e){var i,o,n=-1;for(i in t)o=parseInt(i,10),isNumber(o)&&o>n&&(n=o);t[n+1]=e},o.splitInputs=function(t){var e,i={},o={};for(e in t)isNumber(parseInt(e,10))?i[e]=t[e]:o[e]=t[e];return{arr:i,obj:o}},o.findInputKeyById=function(t,e){var i,o=null;for(i in t)if(isNumber(parseInt(i,10))&&t[i].id===e){o=i;break}return o},o.getInputKeyById=function(t,e){var i=o.findInputKeyById(t,e);if(!i)throw Error("Cannot find input with id: "+e);return i},t.exports=o},function(t,e,i){"use strict";function o(t){this._studyId=t,this._maxToVers="0",this._maxFromVers="0",this._migrs=[]}var n=i(148);o.prototype.addMigration=function(t,e,i){n.isGreater(t,this._maxFromVers)&&(this._maxFromVers=t),n.isGreater(e,this._maxToVers)&&(this._maxToVers=e),this._migrs.push({fromVers:t,toVers:e,rules:i})},o.prototype.updateInputs=function(t,e){var i,o,s;if(!e)return e;for(i=TradingView.clone(e),o=t;n.isLess(o,this._maxToVers);){if(s=this._findMigration(o),i=this._applyMigration(i,s),!n.isLess(o,s.toVers))throw Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");o=s.toVers,TradingView.logDebugChart("Applied migration rule to study: "+this._studyId+" from vers: "+s.fromVers+" to vers: "+s.toVers)}return i},o.prototype._findMigration=function(t){var e,i,o=-1,s=this._maxFromVers;for(e=0;e<this._migrs.length;e++)i=this._migrs[e],n.isLess(i.fromVers,t)||n.isLessOrEqual(i.fromVers,s)&&(s=i.fromVers,o=e);if(o<0)throw Error("Could not find matching migration for study: "+this._studyId+" vers: "+t);return this._migrs[o]},o.prototype._applyMigration=function(t,e){var i,o,n,s=t;for(i=0;i<e.rules.length;i++)o=e.rules[i],n=this._getApplyRuleFun(o.type),s=n(s,o);return s},o.prototype._getApplyRuleFun=function(t){if("inputRemoved"===t)return o._applyInputRemovedRule;if("inputChangedType"===t)return o._applyInputChangedTypeRule;throw Error("Unknown migration rule type: "+t)},o._applyInputRemovedRule=function(t,e){var i,o,s,r;if(!(e.inputId in t))return t;if(i=n.findInputKeyById(t,e.inputId),!i)return t;delete t[i],delete t[e.inputId],o={},s=0;for(r in t)isNumber(parseInt(r,10))?(o[s]=t[r],s++):o[r]=t[r];return o},o._applyInputChangedTypeRule=function(t,e){var i=n.getInputKeyById(t,e.inputId);if("resetToDefVal"!==e.action)throw Error("Unknown action "+e.action+" for rule with type "+e.type);return t[e.inputId]=e.defVal,t[i].defval=e.defVal,t[i].type=e.inputType,t},t.exports=o},function(t,e,i){(function(e,o,n,s,r){"use strict";function a(t,i,o,n){this._study=t,this.m_series=i,this.m_model=o,this._plotName=n,this._visible=!1,this._points=[new e.Point(0,0)],this._invalidated=!0}function l(){return{visible:!0,color:"#0496FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,plottype:rt.PLOT_LINE,histogramBase:0,transparency:50,trackPrice:!1,joinPoints:!1}}function h(t,e,i,o){var n,s;return o.isTVScriptStrategy?n="StudyStrategy":(s="study_"+(o.classId||o.shortId),n=s in TradingView?s:"Study"),new TradingView[n](t,e,i,o)}function c(t,e,i,o){return d(t,e,i,o,"study_"+t.id)}function d(t,e,i,o,n){var s,r,a=_(t,e,i,o),l=new Q(n,a,!0);for(l.addExclusion("visible"),l.addExclusion("precision"),l.addExclusion("minTick"),s=0;s<t.inputs.length;++s)r=t.inputs[s],r.isHidden&&(l.addExclusion("inputs."+s),l.addExclusion("inputs."+r.id));return l}function p(t,e,i,o,n){return u(t,e,i,o,n,"study_"+t.id)}function u(t,e,i,o,n,s){var r,a,l,h=f(t,e,i,o,n),c=new Q(s,h,!0);for(c.addExclusion("visible"),c.addExclusion("precision"),c.addExclusion("minTick"),r=e||t,a=0;a<r.inputs.length;++a)l=r.inputs[a],l.isHidden&&(c.addExclusion("inputs."+a),c.addExclusion("inputs."+l.id));return c}function _(t,e,n,s){var r,a,l,h,c,d,p=i(148),u=st.versionOf(t);if(u<1)throw Error("This function cannot work with metainfo of the old format version. Required format version >= 1");return r=TradingView.clone(defaults("study")),m(r,t),a=TradingView.clone(defaults("study_"+t.id,s)),t.isTVScript&&t.TVScriptSourceCode!==a.TVScriptSourceCode&&(a=TradingView.clone(TradingView.factoryDefaults("study_"+t.id,s))),TradingView.merge(r,a),e&&(assert(!(e instanceof o),"propsState should not be an instance of Property"),TradingView.merge(r,e)),l=v(t),h={},p.mergeInputs(h,l.defaults.inputs),p.mergeInputsObjPart(h,r.inputs),p.mergeInputsArrPart(h,l.inputs),r.inputs=h,delete l.inputs,delete l.defaults.inputs,c={},TradingView.merge(c,l.defaults),TradingView.merge(c,TradingView.factoryDefaults("study_"+l.id)),TradingView.merge(c,r),TradingView.merge(c,l),delete c.defaults,r=c,d=y(n,t),TradingView.merge(r,b(r,d)),e&&TradingView.merge(r.styles,e.styles),r}function f(t,e,o,n,s){var r,a,l,h,c,d,p=i(148),u=st.versionOf(t);return t.version&&o.version&&t.version!==o.version&&TradingView.logWarn("Serialized metaInfo version "+t.version+" is not equal to the saved state version "+o.version),r=TradingView.clone(defaults("study")),0===u?(TradingView.merge(r,TradingView.clone(t)),a=v(t),TradingView.merge(r.inputs,a.inputs)):u>=1&&TradingView.merge(r,TradingView.clone(t.defaults)),TradingView.merge(r,TradingView.factoryDefaults("study_"+t.id)),m(r,t),TradingView.merge(r,o),u>=1&&(TradingView.merge(r,TradingView.clone(t)),delete r.defaults),r=s.updateStudyState(r,t,e),l=e||t,l&&st.versionOf(l)>=1&&(l=v(l),h={},p.mergeInputs(h,l.defaults.inputs),p.mergeInputs(h,r.inputs),p.mergeInputsArrPart(h,l.inputs),r.inputs=h,delete l.inputs,delete l.defaults.inputs,c={},TradingView.merge(c,l.defaults),TradingView.merge(c,TradingView.factoryDefaults("study_"+l.id)),TradingView.merge(c,r),TradingView.merge(c,l),delete c.defaults,r=c),d=y(n,l),TradingView.merge(r,b(r,d)),r}function g(t,e){function i(t){if(!t)return"_none_";var t=t||{};return t=JSON.stringify(t),t=t.replace(/'/g,"\\'")}var o,n,s,r,a,l={};if(e.isTVScript)o=e.defaults.inputs.text,l.text=TVScript.patchILTemplate(o,e,t);else for(n=Object.keys(t),s=n.length-1;s>=0;s--)r=n[s],a=t[r]?t[r].id:null,a&&t[a]&&(l[a]=t[a]);return i(l)}function m(t,e){var i,o,n,s;if(e.plots)for(i=0;i<e.plots.length;i++)o=e.plots[i].id,n=e.plots[i].type,n!==rt.PLOT_TYPE_COLORER&&(s=l(),n===rt.PLOT_TYPE_BAR_COLORER&&(s.transparency=0),s.plottype=n,s.title=o,t.styles&&o in t.styles&&TradingView.merge(s,t.styles[o]),t.styles[o]=s)}function v(t){var e,i,o=TradingView.clone(t);if(o.inputs={},t.inputs)for(e=0;e<t.inputs.length;e++)i=t.inputs[e].id,o.inputs[i]=t.inputs[e].defval,o.inputs[e]=t.inputs[e];return o;
}function y(t,e){var i,o,n=0;if(t)for(i=0;i<t.dataSources().length;i++)o=t.dataSources()[i],o.metaInfo&&o.metaInfo()&&o.metaInfo().id===e.id&&n++;return n}function b(t,e){var i,o;if(!e)return t;for(i in t.styles)o=t.styles[i].color,o&&(t.styles[i].color=w(o,e));return t}function w(t,e){var i,o,n;return t=new X(t),i=Z(t.r,t.g,t.b),o=i[0]+.05*e,i[0]=o-Math.floor(o),n=J(i[0],i[1],i[2]),t.r=n[0],t.g=n[1],t.b=n[2],t.toHex()}function S(t,e,o,r){var a,l,h,c,d,p,u,_,f=i(117);this._titleCache={},this._resolvedSymbols={},this._priceAxisViewsBase=[],this._paneViews=[],this._hlinesPriceAsisViews=[],this._horizlinesPriceAsisViews=[],W.call(this,t),this.m_data=new nt,this._graphics=new Y(r),this._plotOffsets={},this._plotOffsetsMetaInfoOverride={},this._model=t,this._chartApi=t._chartApi,this._series=o,this._numericFormatter=new ot,this._metaInfo=r,this._properties=e,this._properties.listeners().subscribe(this,S.prototype.changeStyles),this._properties.visible.listeners().subscribe(this,S.prototype.visibleChanged),this._properties.visible.listeners().subscribe(this,this.processHibernate);for(a in this._metaInfo.graphics)for(l in this._metaInfo.graphics[a])h=this._properties.graphics[a][l],h.visible&&h.visible.listeners().subscribe(this,S.prototype.processHibernate);if(this._showStudyArgumentsProperty=this.model().properties().paneProperties.legendProperties.showStudyArguments,this._turnaroundCounter=1,this._turnaround="st"+this._turnaroundCounter,this._status="",this._plotFields=[],c=this.metaInfo().plots)for(d=0,p=c.length;d<p;d++)l=c[d].id,this._plotFields.push(l);this.clearData(),this._studyModified=!1,this._tagsChanged=new n,this.createViews(),u=this,this._handler=function(t){u.onData(t)},this._createFormatter(),u=this,this._properties.precision.listeners().subscribe(null,function(){u._createFormatter(),u._model.invalidate(new G(G.FULL_UPDATE))}),this._showStudyArgumentsProperty.listeners().subscribe(null,function(){u._titleCache={}}),this._properties.description.listeners().subscribe(null,function(){u._titleCache={}}),this._properties.shortDescription&&this._properties.shortDescription.listeners().subscribe(null,function(){u._titleCache={}}),s.enabled("update_study_formatter_on_symbol_resolve")&&t.mainSeries().onSymbolResolved().subscribe(this,S.prototype._createFormatter),u=this,_={},this._simplePlotsCount=r.plots.filter(function(t,e){if(u.isLinePlot(e))return!0;if(u.isOHLCSeriesPlot(e)){var i=u.metaInfo().plots[e].target;return!_[i]&&(_[i]=i,!0)}return!1}).length,this._properties.showInDataWindow.listeners().subscribe(t,f.prototype.fullUpdate),this.hasBarColorer()&&this._properties.visible.listeners().subscribe(t.mainSeries(),TradingView.Series.prototype.invalidateBarStylesCache)}var T=i(101).StudyBarColorer,C=i(102).HorzLineRenderer,x=i(151),P=x.BandPaneView,L=x.BandBackgroundPaneView,k=x.HlineFillPaneView,E=i(152),I=i(153),A=I.StudyPaneView,V=I.StudyBackgroundPaneView,M=I.StudyPlotShapesPaneView,D=I.StudyPlotCharsPaneView,O=I.StudyPlotArrowsPaneView,B=I.StudyPlotBarsPaneView,R=I.StudyPlotCandlesPaneView,N=i(154),F=N.PlotFillPaneView,z=N.AreaBackgroundPaneView,W=i(79).PriceDataSource,H=i(106),U=i(155).StudyDataWindowView,q=i(156),j=i(94),Y=i(147),G=i(113),K=i(65),X=K.RGBColor,Z=K.rgbToHsl,J=K.hslToRgb,Q=i(80).DefaultProperty,tt=i(82),et=tt.PriceFormatter,it=tt.VolumeFormatter,ot=tt.NumericFormatter,nt=i(112),st=i(114),rt=i(59).StudyConsts;a.prototype.update=function(){this._invalidated=!0},a.prototype.updateImpl=function(){this._visible=!1;var t=this._study.lastValueData(this._plotName,!0);t.noData||(this._visible=!0,this._points=[new e.Point(0,t.coordinate)],this._color=t.color)},a.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var t={};return t.points=this._points,t.color=this._color,t.linewidth=this._study.properties().styles[this._plotName].linewidth.value(),t.linestyle=CanvasEx.LINESTYLE_DOTTED,t.hitTestResult=j.REGULAR,t.visible=this._visible,new C(t)},inherit(S,W),TradingView.Study=S,i(157),S.prototype.lastValueData=function(t,e,i){var o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S={noData:!0};if(this._model.timeScale().isEmpty()||null==this.priceScale()||this.priceScale().isEmpty()||this.data().isEmpty())return S;if(o=this._model.timeScale().visibleBars(),o.isEmpty())return S;if(!this.properties().visible.value())return S;if(n=this.properties().styles,s=this.properties().ohlcPlots,n&&n[t]&&(r=n[t]),s&&s[t]&&(r=s[t]),!r||!r.visible.value())return S;if(a=this.offset(t),l=this.nearestIndex(o.lastBar()-a,TradingView.SEARCH_NEAREST_LEFT),null==l||void 0===l)return S;for(c=this.metaInfo().plots,h=0;h<c.length&&!(c[h].id===t||this.isOHLCClosePlot(h)&&c[h].target===t);h++);if(d=e?this.data().last().value:this.data().valueAt(l),!d||!isNumber(d[h+1]))return S;for(p={noData:!1},u=null,_=null,g=0;g<c.length;g++)c[g].target===t&&(this.isSelfColorerPlot(g)||this.isOHLCColorerPlot(g))&&(u=g,_=this.metaInfo().palettes[c[g].palette],f=this.properties().palettes[c[g].palette]);if(m=d[h+1],i&&(p.price=m),this.priceScale().properties().percentage.value()){if(v=this.firstValue(!0),!v)return S;m=this.priceScale().priceRange().convertToPercent(m,v)}return p.text=this.priceScale().formatter().format(m),y=r.color.value(),u&&d.length>u+1?(b=d[u+1],void 0!==b&&null!==b?(w=_.valToIndex?_.valToIndex[b]:b,p.color=f.colors[w].color.value()):p.color=y):p.color=y,p.floatCoordinate=this.priceScale().priceToCoordinate(m,!0),p.coordinate=Math.round(p.floatCoordinate),p.item=d,p},S.prototype.series=function(){return this._series},S.prototype.model=function(){return this._model},S.prototype.clearData=function(){this.m_data=new nt(this._plotFields),this._graphics=new Y(this._metaInfo),this._plotOffsets={}},S.prototype.onTagsChanged=function(){return this._tagsChanged},S.prototype.properties=function(){return this._properties},S.prototype.state=function(t){var e,i,o,n,s=TradingView.className(this.constructor),r={type:s,id:this.id(),state:this.properties().state(),zorder:this.zorder()};for(this.metaInfo()instanceof st?r.metaInfo=this.metaInfo().state():(r.metaInfo=$.extend({},this.metaInfo()),r.metaInfo.id=st.parseIdString(r.metaInfo.id+(r.metaInfo.version?"-"+r.metaInfo.version:"")).fullId),t&&(r.data=this.m_data.state(),r.data.symbols=this._resolvedSymbols,r.data.graphics=this._graphics.graphics(),r.data.plotOffsets=this._plotOffsets),this.ownerSource()&&(r.ownerSource=this.ownerSource().id()),e=0;e<this._metaInfo.inputs.length;e++)"bar_time"===this._metaInfo.inputs[e].type&&(i=this._metaInfo.inputs[e].id,o=r.state.inputs[i],o<0&&(n=this._rightOffsetToUnixTime(-o),r.state.inputs[i]=n&&n>=0?n:0));return r},S.prototype.stateForAlert=function(){var t=this,e=this._metaInfo,i=this.state().state.inputs,o=[rt.PLOT_TYPE_LINE,rt.PLOT_TYPE_SHAPES,rt.PLOT_TYPE_CHARS,rt.PLOT_TYPE_ARROWS,rt.PLOT_TYPE_OHLC_OPEN,rt.PLOT_TYPE_OHLC_HIGH,rt.PLOT_TYPE_OHLC_LOW,rt.PLOT_TYPE_OHLC_CLOSE],n=e.plots.map(function(t,e){return t.pinePlotIndex=e,t}).filter(function(t){return o.indexOf(t.type)!==-1}).map(function(i){var o={id:i.id,type:i.type,pinePlotIndex:i.pinePlotIndex,offset:t.offset(i.id)};return e.styles&&void 0!==e.styles[i.id]&&(o.title=e.styles[i.id].title||""),i.target&&e.ohlcPlots&&e.ohlcPlots[i.target]&&(o.ohlcTitle=e.ohlcPlots[i.target].title),o});return{id:this.id(),uniqueId:this.uniqueId(),type:TradingView.className(this.constructor),title:TradingView.clean(this.title(),!0),shortDescription:TradingView.clean(e.shortDescription||"Study",!0),fullId:e.fullId,isTVScript:e.isTVScript,plots:n,inputs:i,alerts:e.alerts,callStudyArgs:g(i,e)}},S.prototype.uniqueId=function(){var t=this.inputsForAlert();return t=JSON.stringify(t).replace(/\W/g,""),this.id()+"|"+t},S.prototype.isSavedInStudyTemplates=function(){for(var t=0;t<this._metaInfo.inputs.length;t++)if("bar_time"===this._metaInfo.inputs[t].type)return!1;return!0},S.prototype.restoreData=function(t){this.m_data.restoreState(t),this._resolvedSymbols=t.symbols,this._graphics.setGraphics(t.graphics),this._postProcessGraphics(),this._plotOffsets=t.plotOffsets},S.prototype.restart=function(){this.clearData(),this._restarting=!0,s.enabled("stop_study_on_restart")&&this.stop(),this._clearLoadingTimer(),this.start()},S.prototype._clearLoadingTimer=function(){this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null)},S.prototype.stop=function(){this._clearLoadingTimer(),this._chartApi&&this._chartApi.connected()&&this._studyId&&this._chartApi.removeStudy(this._studyId,this._handler),s.enabled("update_study_formatter_on_symbol_resolve")&&this._model.mainSeries().onSymbolResolved().unsubscribe(this,S.prototype._createFormatter),this._studyId=null,this.clearData(),this._unsubscribeExtendedHours(),this.recalculate()},S.prototype._resolveSymbol=function(t){var e=function e(i,o){this._chartApi.resolveSymbol(this._makeNextSymbolId(),i,function(i){switch(i.method){case"symbol_resolved":this._resolvedSymbols[t]=i.params[1],this._titleCache={},o.resolve(t);break;case"symbol_error":if("permission denied"===i.params[1]&&i.params[2])switch(i.params[2]){case TradingView.Series.PD_REASON_EXTENDED_HOURS:break;case TradingView.Series.PD_REASON_SYMBOL:if(i.params[3])return void e(i.params[3],o);break;default:return void e(i.params[2],o)}o.reject(t)}}.bind(this))}.bind(this),i=$.Deferred();return e(t,i),i.promise()},S.prototype._allSymbolsAreResolved=function(){var t,e,i,o,n=$.Deferred(),s=[];for(t=0;t<this._metaInfo.inputs.length;t++)"symbol"===this._metaInfo.inputs[t].type&&(e=this._metaInfo.inputs[t].id,i=this._properties.inputs[e].value(),this._resolvedSymbols[i]||(o=this._resolveSymbol(i),s.push(o)));return s.length>0?$.when.apply($,s).done(function(){0!==this._studyId&&this.stop(),this.start(),n.resolve("All symbols are resolved now")}.bind(this)).fail(function(t){this._status=$.t("Invalid Symbol"),this.stop(),this._model.updateSource(this),n.reject("Invalid symbol, "+t)}.bind(this)):n.resolve("There are no symbols to resolve"),n.promise()},S.prototype._allInputsAreValid=function(){var t,e,i;for(t=0;t<this._metaInfo.inputs.length;t++)if("bar_time"===this._metaInfo.inputs[t].type&&(e=this._metaInfo.inputs[t].id,i=this._properties.inputs[e].value(),void 0===i||null==i))return!1;return!0},S.prototype.sourceId=function(){return this._studyId},S.prototype._debugId=function(){var t=[];return this._studyId&&t.push(this._studyId),t.push(this._metaInfo.fullId),t.push(this._metaInfo.description),JSON.stringify({study:t})},S.prototype.isStarted=function(){return!!this._studyId},S.prototype.isVisible=function(){var t,e,i,o;if(!this.properties().visible.value())return!1;if(this._metaInfo.plots.length>0)for(t=0;t<this._metaInfo.plots.length;t++)if(e=this.properties().plots[t].visible,!e||e.value())return!0;for(i in this._metaInfo.graphics)for(o in this._metaInfo.graphics[i])if(e=this.properties().graphics[i][o],!e.visible||e.visible.value())return!0;return!!this._metaInfo.isTVScriptStrategy},S.prototype.start=function(){var t=TradingView.isFeatureEnabled("tv5176_HibernateStudies")&&!this.isVisible();this._chartApi&&this._chartApi.connected()&&!t&&this._allSymbolsAreResolved().done(function(t){this._startAfterSymbolsResolved()}.bind(this)).fail(function(t){TradingView.logNormalChart("ERROR: "+this._debugId()+" start failed, "+t)}.bind(this))},S.prototype._startAfterSymbolsResolved=function(){var t,e;if((!this.isStarted()||this._restarting)&&(this._studyId=S.makeNextStudyId(),this._restarting=!1,this._allInputsAreValid())){if(this._inputs=this.inputs(),t=this._metaInfo.id,"MA"===this._metaInfo.id)switch(e=this._inputs[2]){case"exp":t="MAExp@tv-basicstudies";break;case"simple":t="MASimple@tv-basicstudies";break;case"weighted":t="MAWeighted@tv-basicstudies";break;case"volume weighted":t="MAVolumeWeighted@tv-basicstudies"}t+="-"+(this._metaInfo.version||"1"),t=st.cutDollarHash(t),(t.startsWith("Script@tv-scripting")||t.startsWith("StrategyScript@tv-scripting")||t.startsWith("ESD@tv-scripting"))&&(t+="!"),this._chartApi.createStudy(this._studyId,this._turnaround,this._series._seriesId,t,this._inputs,this._handler),this._subscribeExtendedHours()}},S._nextSymbolId=0,S.prototype._makeNextSymbolId=function(){return S._nextSymbolId++,"ss_"+S._nextSymbolId},S._nextStudyId=0,S.makeNextStudyId=function(){return S._nextStudyId++,"st"+S._nextStudyId},S.prototype._rightOffsetToUnixTime=function(t){var e=null;return this._series.bars().size()>=t&&(e=this._series.bars()._valueAt(this._series.bars().lastIndex()-t)[TradingView.TIME_PLOT]),e},S.prototype.getSymbolString=function(t){return this._series&&this._series.extendedHours.value()?"="+JSON.stringify({symbol:t,session:"extended"}):t},S.prototype.inputsForGUI=function(){return this.inputs({symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1})},S.prototype.inputsForAlert=function(){var t=this.offset(),e=this.inputs({symbolsForDisplay:!0,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1});return t&&e.push(t),e},S.prototype.inputs=function(t){var e={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!0};return TradingView.merge(e,t),this._buildInputs(e)},S.prototype._buildInputs=function(t){var e,i,o,n;assert(!!t,"options not set"),e={};try{e=this._prepareInputs(t)}catch(t){TradingView.logWarn("Failed to prepare study inputs: "+t)}return!t.symbolsForDisplay&&this._metaInfo.isTVScript?0===Object.keys(e).length||this._metaInfo.isTVScriptStub?[this._metaInfo.defaults.inputs.text]:(i=this._metaInfo.defaults.inputs.text,o=TVScript.patchILTemplate(i,this._metaInfo,e),[o]):t.asObject?(n={},Object.keys(e).forEach(function(t){null!=e[t]&&(n[t]=e[t])}),n=$.isEmptyObject(n)?null:n):(n=[],Object.keys(e).forEach(function(t){null!=e[t]&&n.push(e[t])}),n)},S.prototype._prepareInputs=function(t){var e,i,o,n;for(assert(!!t,"options not set"),e={},i=0;i<this._metaInfo.inputs.length;i++)o=this._metaInfo.inputs[i],o.isFake&&t.skipFakeInputs&&!this._metaInfo.isTVScript||o.isHidden&&t.skipHiddenInputs||"bool"===o.type&&t.skipHiddenInputs&&s.enabled("dont_show_boolean_study_arguments")||(n=this._prepareInput(o,t),e[o.id]=n);return e},S.prototype._prepareInput=function(t,e){var i,o,n,s,r=t.id;return"symbol"===t.type?(i=this._properties.inputs[r].value(),e&&e.symbolsForDisplay?this._resolvedSymbols&&this._resolvedSymbols[i]&&(i=this._resolvedSymbols[i].name+", "+this._resolvedSymbols[i].exchange):(this._resolvedSymbols&&this._resolvedSymbols[i]&&(o=this._resolvedSymbols[i],i=o.ticker||o.full_name),e&&e.symbolsForChartApi&&(i=this.getSymbolString(i))),i):"bar_time"===t.type?(n=this._properties.inputs[r].value(),n<0&&(s=this._rightOffsetToUnixTime(-n),n=s&&s>=0?s:n),n):this._properties.inputs[r].value()},S.prototype._changeInputs=function(t){this._studyId&&this._chartApi.connected()?(this._turnaround="st"+ ++this._turnaroundCounter,this._allInputsAreValid()?this._allSymbolsAreResolved().done(function(e){this._studyModified=!0,this._chartApi.modifyStudy(this._studyId,this._turnaround,t,this._handler)}.bind(this)).fail(function(t){TradingView.logNormalChart("ERROR: "+this._debugId()+" _changeInputs: cannot modify study, "+t)}.bind(this)):this.stop()):(this.stop(),this.start()),this._inputs=t,this._tagsChanged.fire(),this._titleCache={}},S.prototype.changeStyles=function(){var t,e;if(this._inputs){for(t=this.inputs(),e=0;e<t.length;e++)if(t[e]!==this._inputs[e]){this._changeInputs(t);break}}else this._chartApi&&this._chartApi.connected()&&this.restart();this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),"Overlay@tv-basicstudies"===this._metaInfo.name&&this.invalidateBarStylesCache(),this.createViews(),this.recalculate(!0),this.updateAllViews()},S.prototype._isModifiedStudyInputs=function(t){if(void 0===this._oldStudyInputs)return this._oldStudyInputs=t,!0;var e=Object.keys(this._oldStudyInputs);return assert(e.length===Object.keys(t).length,"keys quantity should be equal"),e.forEach(function(e){assert(t.hasOwnProperty(e),"key '"+e+"' should existing in studyInputs"),this._oldStudyInputs[e]!==t[e]&&(this._oldStudyInputs=t)},this),this._oldStudyInputs===t},S.prototype.visibleChanged=function(){this._series instanceof TradingView.Series&&this._series.invalidateBarColorerCache()},S.prototype.invalidateBarStylesCache=function(){var t,e,i=this.m_data;0!==i.size()&&(t=+i.first(),e=+i.last()+1,i.range(t,e).each(function(t,e){e[TradingView.STYLE_PLOT]=null}))},S.prototype.processHibernate=function(){TradingView.isFeatureEnabled("tv5176_HibernateStudies")&&(!this._studyId&&this.isVisible()&&this.start(),this._studyId&&!this.isVisible()&&this.stop())},S.prototype.lastPriceLabelFixedCoordinate=function(t){var e=this._priceAxisViewsCache[t];return e._fixedCoordinate},S.prototype.priceLabelText=function(t){var e,i,o,n;return 1===this._simplePlotsCount?this._metaInfo.shortDescription:(e=this._metaInfo.styles,i=this._metaInfo.ohlcPlots,e&&e[t]&&(o=e[t]),i&&i[t]&&(o=i[t]),n=o.title,this._metaInfo.is_price_study?this._metaInfo.shortDescription+":"+n:n)},S.prototype.createPlotLabels=function(t){for(var e=0;e<t.length;e++)this._paneViews.push(new H(this._model,this,t[e],"priceLabelText","showStudyPlotLabels"))},S.prototype.createViews=function(){var t,e,i,o,n,s,r,l,h,c,d,p,u;if(this._priceAxisViewsBase=[],this._paneViews=[],t={},this._priceAxisViewsCache={},e=[],this.metaInfo().plots)for(i=0;i<this.metaInfo().plots.length;i++)if(!(this.isSelfColorerPlot(i)||this.isBarColorerPlot(i)||this.isBarColorerPlot(i)||this.isOHLCColorerPlot(i)))if(o=this.metaInfo().plots[i].id,this.isBgColorerPlot(i))this._paneViews.push(new V(this,this._series,this._model,o));else if(this.isPlotShapesPlot(i))this._paneViews.push(new M(this,this._series,this._model,o));else if(this.isPlotCharsPlot(i))this._paneViews.push(new D(this,this._series,this._model,o));else if(this.isPlotArrowsPlot(i))this._paneViews.push(new O(this,this._series,this._model,o));else if(this.isOHLCSeriesPlot(i)){if(n=this.metaInfo().plots[i].target,t[n])continue;t[n]=n,this.isOHLCBarsPlot(i)?this._paneViews.push(new B(this,this._series,this._model,n)):this.isOHLCCandlesPlot(i)&&this._paneViews.push(new R(this,this._series,this._model,n)),s=new E(this,this._model,n),this._priceAxisViewsCache[n]=s,this._priceAxisViewsBase.push(s),e.push(n)}else s=new E(this,this._model,o),this._priceAxisViewsCache[o]=s,this._priceAxisViewsBase.push(s),this._paneViews.push(new A(this,this._series,this._model,o)),this.properties().styles[o].trackPrice.value()&&this._paneViews.push(new a(this,this._series,this._model,o)),e.push(o);if(this._properties.bands)for(i=0;i<this._properties.bands.childCount();i++)this._properties.bands[i].visible.value()&&this._paneViews.push(new P(this._properties.bands[i],this));this._properties.bandsBackground&&this._paneViews.push(new L(this)),r=[],this.metaInfo().graphics&&(r=Object.keys(this.metaInfo().graphics),r.sort(function(t,e){return S.graphicsZOrderPriority(t)-S.graphicsZOrderPriority(e)}));for(l in r)h=r[l],c="_paneView"+h,d="StudyPaneView_"+h,TradingView.Study[d]&&(this[c]=new TradingView.Study[d](this,this._model),this._paneViews.push(this[c])),this._dataWindowView||"hhists"!==h||(this._dataWindowView=new TradingView.StudyHHistsDataWindowView(this,this._model));if(this._properties.areaBackground&&this._paneViews.push(new z(this)),this._properties.filledAreas&&this._metaInfo.filledAreas)for(i=0;i<this._metaInfo.filledAreas.length;++i)p=this._metaInfo.filledAreas[i],u=this._properties.filledAreasStyle[p.id],p.type===st.FilledArea.TYPE_PLOTS?this._paneViews.push(new F(this,p,u)):p.type===st.FilledArea.TYPE_HLINES?this._paneViews.push(new k(this,p,u)):TradingView.logWarn("Unsupported filledArea type: "+p.type);this.createPlotLabels(e),this._dataWindowView||(this._dataWindowView=new U(this,this._model)),this._statusView||(this._statusView=new q(this,this._model.properties())),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews)},S.prototype.recalculate=function(t){var e=this._model.paneForSource(this);this._model.recalculatePane(e,t),this._model.updateSource(this)},S.prototype.data=function(){return this.m_data},S.prototype.metaInfo=function(){return this._metaInfo},S.prototype.status=function(){return this._status},S.prototype.title=function(t,e){var i,o,n,s,r=JSON.stringify([t,e]);return this._titleCache[r]?this._titleCache[r]:(i=t?this._metaInfo.shortDescription||this._properties.shortDescription&&this._properties.shortDescription.value()||"Study":this._metaInfo.description||this._properties.description&&this._properties.description.value()||"Study",i=$.t(i),o=this._showStudyArgumentsProperty.value(),n=this.inputsForGUI()||[],s=this,e&&"object"==typeof e||(e={}),o&&n.length>0&&(n=n.map(function(t){var i=isNumber(t)?s._numericFormatter.format(t):t;return e[i]&&(i=e[i]),i}),i+=" ("+n.join(", ")+")"),this._titleCache[r]=i,i)},S.prototype.graphics=function(){return this._graphics.graphics()},S.prototype._checkTurnaround=function(t){return t===this._turnaround||t===this._model.mainSeries()._turnaround||t===this._model.mainSeries()._turnaround+"_"+this._turnaround},S.prototype._makeJSONForNSData=function(t,e){var i,o=""!==t.params.nonseries.d?TradingView.parseJSONorNot(t.params.nonseries.d):e||"";return o.dataCompressed&&(i=new JSZip(o.dataCompressed,{base64:!0}).file("").asText(),delete o.dataCompressed,o.data=TradingView.parseJSONorNot(i)),o.graphicsCmdsCompressed&&(i=new JSZip(o.graphicsCmdsCompressed,{base64:!0}).file("").asText(),delete o.graphicsCmdsCompressed,o.graphicsCmds=TradingView.parseJSONorNot(i)),o},S.prototype.onData=function(t){var e,i,o,n,s=this;switch(t.method){case"study_loading":this._status=$.t("loading..."),this._failed=!1,this._statusView.update(),this._model.updateSource(this),this._clearLoadingTimer(),["Plot splits","Plot earnings","Plot dividends"].indexOf(s._metaInfo.description)===-1&&(s._loadingStartTime=(new Date).getTime(),s.loadingTimer=setTimeout(function(){var t={chartSession:s._chartApi._sessionid,studyName:s._metaInfo.description,arguments:s.inputs()};Telemetry.sendReport("study_loading",t)},15e3));break;case"study_error":this._clearLoadingTimer(),delete this._loadingStartTime,this._failed=!0,this.clearData(),t.params[2]?this._status=$.t(t.params[2].split(":",2)[0]):this._status="",["Sessions"].indexOf(s._metaInfo.description)===-1&&Telemetry.sendReport("study_error",{chartSession:s._chartApi._sessionid,studyName:s._metaInfo.description,arguments:s.inputs()}),this._statusView.update(),this._model.updateSource(this);break;case"study_completed":if(!this._checkTurnaround(t.params[1]))return;e="chartSession:"+s._chartApi._sessionid,TradingView.logDebugChart(e+", Study "+this._metaInfo.description+" loading took "+((new Date).getTime()-this._loadingStartTime)+" ms"),this._clearLoadingTimer(),delete this._loadingStartTime,this._status="",this._statusView.update(),i=this._model.paneForSource(this),this._model.recalculatePane(i),this._updateSources(),this._model.invalidate(new G(G.FULL_UPDATE));break;case"study_deleted":break;case"data_update":if(!this._checkTurnaround(t.params.turnaround))return;s._clearLoadingTimer(),this._studyModified&&(this.clearData(),this._studyModified=!1),o=0===this.m_data.size()&&this._metaInfo.plots.length>0,assert(!!t.params.nonseries,"data.params.nonseries is missing"),t.params.nonseries.d=this._makeJSONForNSData(t),this._processPlotOffsets(t.params),this.transformData(t.params.plots),n=this._mergeData(t.params.plots).earliestRow,this.hasBarColorer()&&(null!==n?this._model.mainSeries().invalidateBarStylesCache(n.index):TradingView.logNormalChart("ERROR: No earliestRow in studies plots, "+this._debugId())),this._graphics.process(t.params.nonseries),this._postProcessGraphics(),i=this._model.paneForSource(this),this._model.recalculatePane(i,o),this._updateSources()}},S.prototype.transformData=function(t){},S.prototype._updateSources=function(){this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())},S.processPlotOffsets=function(t,e){if(!e.nonseries||"nochange"!==e.nonseries.indexes){var i=e.nonseries.d;if(!i||!i.indexes_replace)return i&&i.offsets?void(t._plotOffsets=i.offsets):void(t._plotOffsets={})}},S.prototype._processPlotOffsets=function(t){S.processPlotOffsets(this,t)},S.prototype._mergeData=function(t){return this.m_data.merge(t)},S.prototype._postProcessGraphics=function(){var t=this,e=function(e){var i,o,n,s=t._graphics.graphics(),r=[];if(s&&s[e])for(n=s[e],i=0;i<n.length;i+=1)if(n[i].data)for(o=0;o<n[i].data.length;o+=1)r.push(new S.StudyPriceAxisView_hlines(t,t._model,n[i].data[o],n[i].styleId,e));return r};this._hlinesPriceAsisViews=e("hlines"),this._horizlinesPriceAsisViews=e("horizlines"),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews)},S.prototype.firstValue=function(t){var e,i,o,n,s;return this._metaInfo.is_price_study&&"Compare@tv-basicstudies"!==this._metaInfo.id?this._series.data().firstValue():(e=this._model.timeScale().visibleBars(),i=e.firstBar(),o=e.lastBar(),0===this.m_data.size()?null:(s=this,this.m_data.range(i,o).each(function(e,i){var o,r,a;for(o=1;o<i.length;++o)if(!s.isSelfColorerPlot(o-1)&&(r=s._metaInfo.plots[o-1].id,a=s.properties().styles[r],a.visible&&a.visible.value()&&!(t&&Math.abs(i[o])<1e-10||void 0===i[o]||null===i[o]||n)))return n=i[o],!0}),n))},S.offset=function(t,e){var i=0;return t._plotOffsets&&void 0!==t._plotOffsets[e]&&(i+=t._plotOffsets[e]),void 0!==t._plotOffsetsMetaInfoOverride[e]?i+=t._plotOffsetsMetaInfoOverride[e]:t.properties().offsets&&void 0!==t.properties().offsets[e]&&(i+=t.properties().offsets[e].val.value()),t.properties().offset&&(i+=t.properties().offset.val.value()),i},S.prototype.offset=function(t){return S.offset(this,t)},S.prototype.priceRange=function(t,e){var i,o,n,s,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T;if(!TradingView.isInteger(t))return void TradingView.logDebugChart("Study.priceRange: incorrect startBar");if(!TradingView.isInteger(e))return void TradingView.logDebugChart("Study.priceRange: incorrect endBar");if(0===this.m_data.size())return null;if(i=null,o=this,n=o._metaInfo,0===n.plots.length)return null;for(a=[],h=0;h<n.plots.length;++h)if(!(o.isSelfColorerPlot(h)||o.isTextColorerPlot(h)||o.isBarColorerPlot(h)||o.isBgColorerPlot(h)||o.isOHLCColorerPlot(h))&&(c=n.plots[h].id,o.isOHLCSeriesPlot(h)?(p=n.plots[h].target,d=o.properties().ohlcPlots[p]):d=o.properties().styles[c],d.visible.value()&&(l=null,d.location&&(l=d.location.value()),s||(u=[CanvasEx.MARKLOC_ABSOLUTE,CanvasEx.MARKLOC_TOP,CanvasEx.MARKLOC_BOTTOM].indexOf(l)<0,_=o.isPlotShapesPlot(h)||o.isPlotCharsPlot(h),s=_&&u||o.isPlotArrowsPlot(h)),f=o.isLinePlot(h)||(o.isPlotShapesPlot(h)||o.isPlotCharsPlot(h))&&d.location.value()===CanvasEx.MARKLOC_ABSOLUTE||o.isOHLCSeriesPlot(h)))){if(g={index:h+1,offset:o.offset(c)},m=o.properties().styles[c].plottype.value(),!o.properties().skipHistogramBaseOnAutoScale&&[rt.PLOT_HISTOGRAM,rt.PLOT_COLUMNS,rt.PLOT_AREA].indexOf(m)>=0){if(v=o.properties().styles[c].histogramBase.value(),!isNumber(v))continue;g.baseValue=v}a.push(g)}if(y=o.m_data.minMaxOnRange2(t,e,a),s&&(a=[{index:TradingView.LOW_PLOT,offset:0},{index:TradingView.HIGH_PLOT,offset:0}],b=o.series().data().bars().minMaxOnRange2(t,e,a),y.min=null==y.min||void 0===y.min?b.min:Math.min(y.min,b.min),y.max=null==y.max||void 0===y.max?b.max:Math.max(y.max,b.max)),null!==y.min&&(i=new r(y.min,y.max)),n.bands)for(h=0;h<n.bands.length;h++)if(o.properties().bands[h].visible.value()){if(v=o.properties().bands[h].value.value(),!isNumber(v))continue;i?i.apply(v,v):i=new r(v,v)}return i&&i.minValue()===i.maxValue()&&(w=.005*i.minValue(),i=new r(i.minValue()-w,i.maxValue()+w)),S=this.priceScale(),S&&S.properties().percentage.value()&&i?(T=this.firstValue(),T?i.convertToPercents(T):null):S&&S.isLog()&&i?new r(o.priceScale().priceToLogical(i.minValue()),o.priceScale().priceToLogical(i.maxValue())):i},S.prototype.paneViews=function(t){return this.properties().visible.value()?this._paneViews:null},S.prototype.dataWindowView=function(){return this._dataWindowView},S.prototype.statusView=function(){return this._statusView},S.prototype.priceAxisViews=function(t,e){return this._model.paneForSource(this)===t&&e===this.priceScale()&&(this._model.properties().scalesProperties.showStudyLastValue.value()||this.properties().oldShowLastValue&&this.properties().oldShowLastValue.value())?this._priceAxisViews:null},S.prototype.isLinePlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_LINE},S.isSelfColorerPlot=function(t,e){var i=t._metaInfo.plots[e];return i.type===rt.PLOT_TYPE_COLORER},S.prototype.isSelfColorerPlot=function(t){return S.isSelfColorerPlot(this,t)},S.prototype.isTextColorerPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_TEXT_COLORER},S.prototype.isBarColorerPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_BAR_COLORER},S.prototype.isBgColorerPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_BG_COLORER},S.prototype.isPlotShapesPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_SHAPES},S.prototype.isPlotCharsPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_CHARS},S.prototype.isPlotArrowsPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_ARROWS},S.prototype.isOHLCBarsPlot=function(t){var e=this._metaInfo.plots[t].target,i=this.metaInfo().defaults.ohlcPlots[e];return i&&this.isOHLCSeriesPlot(t)&&i.plottype===rt.OHLC_TYPE_BARS},S.prototype.isOHLCCandlesPlot=function(t){var e=this._metaInfo.plots[t].target,i=this.metaInfo().defaults.ohlcPlots[e];return i&&this.isOHLCSeriesPlot(t)&&i.plottype===rt.OHLC_TYPE_CANDLES},S.prototype.isOHLCSeriesPlot=function(t){var e=this._metaInfo.plots[t].type;return e===rt.PLOT_TYPE_OHLC_OPEN||e===rt.PLOT_TYPE_OHLC_HIGH||e===rt.PLOT_TYPE_OHLC_LOW||e===rt.PLOT_TYPE_OHLC_CLOSE},S.prototype.isOHLCOpenPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_OHLC_OPEN},S.prototype.isOHLCHighPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_OHLC_HIGH},S.prototype.isOHLCLowPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_OHLC_LOW},S.prototype.isOHLCClosePlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_OHLC_CLOSE},S.prototype.isOHLCColorerPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_OHLC_COLORER},S.prototype.isDataOffsetPlot=function(t){var e=this._metaInfo.plots[t];return e.type===rt.PLOT_TYPE_DATAOFFSET},S.prototype.hasBarColorer=function(){for(var t=0;t<this._metaInfo.plots.length;++t)if(this.isBarColorerPlot(t))return!0;return!1},S.prototype.barColorer=function(){var t,e,i=null;for(t=0;t<this._metaInfo.plots.length;++t)this.isBarColorerPlot(t)&&(e=new T(this,t),null==i?i=e:i.pushBackBarColorer(e));if(null==i)throw Error("Cannot create BarColorer: study doesn't have a bar_colorer plot!");return i},S.prototype.base=function(){return"Volume"===this._metaInfo.id?1:0},S.prototype._createFormatter=function(){var t,e,i;"default"===this.properties().precision.value()?this.metaInfo().defaults&&(t=parseInt(this.metaInfo().defaults.precision)):t=parseInt(this.properties().precision.value()),isFinite(t)||(t=["Volume@tv-basicstudies","VbPVisible@tv-volumebyprice","VbPSessions@tv-volumebyprice"].indexOf(this._metaInfo.id)!==-1?0:1e4),e=this.series().symbolInfo(),0===t?(i=0,e&&(i=e.volume_precision?e.volume_precision:e.has_fractional_volume?2:0),this._formatter=new it(i)):this._formatter=new et(Math.pow(10,t)),this.priceScale()&&this.priceScale().updateFormatter()},S.prototype.formatter=function(){return this._formatter},S.prototype.nearestIndex=function(t,e){if(!TradingView.isInteger(t))return void TradingView.logDebugChart("Study.nearestIndex: incorrect logicalPoint");var i=this._series.data().bars().search(t,e);return i?i.index:void 0},S.prototype.updateAllViews=function(){var t;for(t=0;t<this._paneViews.length;t++)this._paneViews[t].update();
for(this._dataWindowView.update(),this._statusView.update(),t=0;t<this._priceAxisViews.length;t++)this._priceAxisViews[t].update()},S.prototype.tags=function(){return!this._metaInfo||!this._metaInfo.description||this._metaInfo.isTVScriptStub||this._metaInfo.is_hidden_study||this._metaInfo.isTVScript&&"tv-scripting"===this._metaInfo.productId?[]:[this._metaInfo.description]},S.isPointsBasedStudy=function(t){switch(t){case"VbPFixed@tv-volumebyprice":case"mtp_tsanalysis@mtp-mtpredictor":case"mtp_riskreward@mtp-mtpredictor":case"mtp_decisionpoint@mtp-mtpredictor":case"mtp_ew_main@mtp-mtpredictor":case"mtp_ew_major@mtp-mtpredictor":case"mtp_ew_minor@mtp-mtpredictor":case"mtp_wpt_down1ora@mtp-mtpredictor":case"mtp_wpt_down2orb@mtp-mtpredictor":case"mtp_wpt_down3@mtp-mtpredictor":case"mtp_wpt_down4@mtp-mtpredictor":case"mtp_wpt_down5@mtp-mtpredictor":case"mtp_wpt_downc@mtp-mtpredictor":case"mtp_wpt_up1ora@mtp-mtpredictor":case"mtp_wpt_up2orb@mtp-mtpredictor":case"mtp_wpt_up3@mtp-mtpredictor":case"mtp_wpt_up4@mtp-mtpredictor":case"mtp_wpt_up5@mtp-mtpredictor":case"mtp_wpt_upc@mtp-mtpredictor":return!0;default:return!1}},S.lineToolNameForPointsBasedStudy=function(t){switch(t){case"VbPFixed@tv-volumebyprice":return"LineToolVbPFixed";case"RegressionTrend@tv-basicstudies":return"LineToolRegressionTrend";case"mtp_tsanalysis@mtp-mtpredictor":return"LineStudyMtpAnalysis";case"mtp_riskreward@mtp-mtpredictor":return"LineStudyMtpRiskReward";case"mtp_decisionpoint@mtp-mtpredictor":return"LineStudyMtpDecisionPoint";case"mtp_ew_main@mtp-mtpredictor":return"LineStudyMtpElliotWaveMain";case"mtp_ew_major@mtp-mtpredictor":return"LineStudyMtpElliotWaveMajor";case"mtp_ew_minor@mtp-mtpredictor":return"LineStudyMtpElliotWaveMinor";case"mtp_wpt_down1ora@mtp-mtpredictor":return"LineStudyMtpDownWave1OrA";case"mtp_wpt_down2orb@mtp-mtpredictor":return"LineStudyMtpDownWave2OrB";case"mtp_wpt_down3@mtp-mtpredictor":return"LineStudyMtpDownWave3";case"mtp_wpt_down4@mtp-mtpredictor":return"LineStudyMtpDownWave4";case"mtp_wpt_down5@mtp-mtpredictor":return"LineStudyMtpDownWave5";case"mtp_wpt_downc@mtp-mtpredictor":return"LineStudyMtpDownWaveC";case"mtp_wpt_up1ora@mtp-mtpredictor":return"LineStudyMtpUpWave1OrA";case"mtp_wpt_up2orb@mtp-mtpredictor":return"LineStudyMtpUpWave2OrB";case"mtp_wpt_up3@mtp-mtpredictor":return"LineStudyMtpUpWave3";case"mtp_wpt_up4@mtp-mtpredictor":return"LineStudyMtpUpWave4";case"mtp_wpt_up5@mtp-mtpredictor":return"LineStudyMtpUpWave5";case"mtp_wpt_upc@mtp-mtpredictor":return"LineStudyMtpUpWaveC";default:throw Error("There is no line tool name, associated with study id "+t)}},S.isStudyLineTool=function(t){var e=i(145).StudyLineDataSource,o=TradingView[t];return"function"==typeof o&&o.prototype instanceof e},S.prototype.onExtendedHoursChanged=function(){this.restart()},S.prototype.hasSymbolInputs=function(){for(var t=this._metaInfo.inputs.length;t--;)if("symbol"===this._metaInfo.inputs[t].type)return!0;return!1},S.prototype._subscribeExtendedHours=function(){!this._isSubscribedToExtendedHours&&this.hasSymbolInputs()&&(this._series.extendedHours.listeners().subscribe(this,this.onExtendedHoursChanged),this._isSubscribedToExtendedHours=!0)},S.prototype._unsubscribeExtendedHours=function(){this._isSubscribedToExtendedHours&&(this._series.extendedHours.listeners().unsubscribe(this,this.onExtendedHoursChanged),delete this._isSubscribedToExtendedHours)},S.prototype.removeByRemoveAllStudies=function(){return!0},t.exports={Study:S,createStudy:h,prepareCallStudyArgs:g,prepareStudyProperties:c,prepareStudyPropertiesForLoadChart:p,prepareStudyPropsStateForLoadChart:f,shiftColor:w}}).call(e,i(21),i(69),i(28),i(1),i(85))},function(t,e,i){(function(t){"use strict";function o(e,i){this._source=i,this._properties=e,this._points=[new t.Point(-1,-1)],this._invalidated=!0}function n(t){this._data=t}function s(t){this._source=t,this._points=[]}function r(t,e,i){this._source=t,this._points=[],assert(e.type===h.FilledArea.TYPE_HLINES,"Wrong filledArea type: "+e.type),this._initBandIndexes(e.objAId,e.objBId),this._fillStyleProps=i}var a=i(102).HorzLineRenderer,l=i(94),h=i(114);o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var e,i=this._source.priceScale();return!i||i.isEmpty()?void(this._points[0]=new t.Point(-1,-1)):(e=this._properties.value.value(),void(isNumber(e)?this._points[0]=new t.Point(-1,i.priceToCoordinate(e)):this._points[0]=new t.Point(-1,NaN)))},o.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var t={};return t.points=this._points,t.color=this._properties.color.value(),t.linewidth=this._properties.linewidth.value(),t.linestyle=this._properties.linestyle.value(),t.hitTestResult=l.REGULAR,new a(t)},n.prototype.draw=function(t){var e,i,o;0!==this._data.points.length&&(e=t.canvas.width,t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),i=Math.min(this._data.points[0],this._data.points[1]),o=Math.max(this._data.points[0],this._data.points[1]),t.fillRect(0,i,e,o-i))},n.prototype.hitTest=function(t){return null},s.prototype.update=function(){var t,e,i,o;this._points=[],t=this._source.properties().bandsBackground,t.fillBackground.value()&&(e=this._source.properties().bands[0],i=this._source.properties().bands[1],o=this._source.priceScale(),o&&!o.isEmpty()&&(this._points.push(o.priceToCoordinate(e.value.value())),this._points.push(o.priceToCoordinate(i.value.value()))))},s.prototype.renderer=function(){var t={};return t.points=this._points,t.backcolor=this._source.properties().bandsBackground.backgroundColor.value(),t.transparency=this._source.properties().bandsBackground.transparency.value(),new n(t)},r.prototype._initBandIndexes=function(t,e){var i,o;for(this._bandAKey=null,this._bandBKey=null,i=0;i<this._source.metaInfo().bands.length;++i)o=this._source.metaInfo().bands[i],null!==this._bandAKey||o.id!==t?null!==this._bandBKey||o.id!==e||(this._bandBKey=i):this._bandAKey=i},r.prototype.update=function(){var t,e,i;this._points=[],this._fillStyleProps.visible.value()&&(t=this._source.properties().bands[this._bandAKey],e=this._source.properties().bands[this._bandBKey],i=this._source.priceScale(),i&&!i.isEmpty()&&(this._points.push(i.priceToCoordinate(t.value.value())),this._points.push(i.priceToCoordinate(e.value.value()))))},r.prototype.renderer=function(){var t={};return t.points=this._points,t.backcolor=this._fillStyleProps.color.value(),t.transparency=this._fillStyleProps.transparency.value(),new n(t)},e.BandPaneView=o,e.BandBackgroundPaneView=s,e.HlineFillPaneView=r}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e,i){this._study=t,this._model=e,this._plotIndex=i,this._text="",this._coordinate=0,this._background="black",this._color="white",this._invalidated=!0,this._cache=new n}var n=i(107),s=i(75),r=i(76);inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){this._visible=!1,this._text="";var t=this._study.lastValueData(this._plotIndex);t.noData||(this._visible=!0,this._text=t.text,this._coordinate=t.coordinate,this._floatCoordinate=t.floatCoordinate,this._background!==t.color&&(this._background=t.color,this._color=this.color()))},o.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),s.prototype.coordinate.call(this)},o.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var t={text:this._text,coordinate:this._coordinate,color:this._color,background:this._background,visible:this._visible};return new r(t,this._cache)},o.prototype.text=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),s.prototype.text.call(this)},t.exports=o},function(t,e,i){(function(t){"use strict";function o(t,e,i,o){var n,s;for(this.m_study=t,this.m_series=e,this.m_model=i,this._plotName=o,this.m_items=[],this._invalidated=!0,n=this.m_study.metaInfo().plots,this._colorer=null,this._palette=null,this._paletterProps=null,this._plotIndex=0,s=0;s<n.length;s++)n[s].id===this._plotName&&(this._plotIndex=s),this.m_study.isSelfColorerPlot(s)&&n[s].target===this._plotName&&(this._colorer=s,this._palette=this.m_study.metaInfo().palettes[n[s].palette],this._paletterProps=this.m_study.properties().palettes[n[s].palette])}function n(t,e,i,o){var n,s;for(this._study=t,this._series=e,this._model=i,this._plotName=o,this._items=[],this._invalidated=!0,n=this._study.metaInfo().plots,s=0;s<n.length;s++)n[s].id===this._plotName&&(this._plotIndex=s,assert(this._study.isBgColorerPlot(s),"Plot '"+this._plotName+"' is not a background colorer!"))}function s(t,e,i,o){var n,s;for(this.m_study=t,this.m_series=e,this.m_model=i,this.m_plotName=o,this.m_items=[],this.m_invalidated=!0,this.m_plotIndex=null,n=this.m_study.metaInfo().plots,s=0;s<n.length;s++)if(n[s].id===this.m_plotName){this.m_plotIndex=s;break}for(n=this.m_study.metaInfo().plots,this._colorer=null,this._textColorer=null,this._palette=null,this._textPalette=null,this._paletterProps=null,this._textPaletterProps=null,this._plotIndex=0,s=0;s<n.length;s++)n[s].id===this.m_plotName&&(this._plotIndex=s),this.m_study.isSelfColorerPlot(s)&&n[s].target===this.m_plotName&&(this._colorer=s,this._palette=this.m_study.metaInfo().palettes[n[s].palette],this._paletterProps=this.m_study.properties().palettes[n[s].palette]),this.m_study.isTextColorerPlot(s)&&n[s].target===this.m_plotName&&(this._textColorer=s,this._textPalette=this.m_study.metaInfo().palettes[n[s].palette],this._textPaletterProps=this.m_study.properties().palettes[n[s].palette])}function r(t,e,i,o){s.call(this,t,e,i,o)}function a(t,e,i,o){r.call(this,t,e,i,o)}function l(t,e,i,o){s.call(this,t,e,i,o),this._maxAbsValue=0}function h(t,e,i,o){var n,s;for(this.m_study=t,this.m_series=e,this.m_model=i,this.m_plotName=o,this.m_bars=[],this._invalidated=!0,n=this.m_study.metaInfo().plots,this._colorer=null,this._palette=null,this._paletterProps=null,this._ohlcPlotIndexes={},s=0;s<n.length;s++)n[s].target===this.m_plotName&&(this.m_study.isOHLCOpenPlot(s)&&(this._ohlcPlotIndexes[TradingView.OPEN_PLOT]=s),this.m_study.isOHLCHighPlot(s)&&(this._ohlcPlotIndexes[TradingView.HIGH_PLOT]=s),this.m_study.isOHLCLowPlot(s)&&(this._ohlcPlotIndexes[TradingView.LOW_PLOT]=s),this.m_study.isOHLCClosePlot(s)&&(this._ohlcPlotIndexes[TradingView.CLOSE_PLOT]=s),this.m_study.isOHLCColorerPlot(s)&&(this._colorer=s,this._palette=this.m_study.metaInfo().palettes[n[s].palette],this._paletterProps=this.m_study.properties().palettes[n[s].palette]))}function c(t,e,i,o){h.call(this,t,e,i,o)}function d(t,e,i,o){h.call(this,t,e,i,o)}var p=i(94),u=i(93),_=u.SelectionRenderer,f=u.SelectionRendererArrowsUpDown,g=i(95),m=g.PaneRendererBars,v=g.PaneRendererHistogram,y=g.PaneRendererColumns,b=g.PaneRendererLine,w=g.PaneRendererArea,S=g.PaneRendererCandles,T=g.PaneRendererCross,C=g.PaneRendererCircles,x=g.PaneRendererArrowsUpDownItem,P=g.PaneRendererArrowsUpDown,L=g.PaneRendererUnicodeChar,k=g.PaneRendererBackground,E=i(97),I=i(98),A=i(99),V=i(65),$=V.RGBColor,M=V.rgbToHsl,D=V.hslToRgb,O=i(59).StudyConsts,B=i(59).StudyPlotShapes;o.isIndexValid=function(t,e){return t>=0&&t<e._length()},o.prototype.items=function(){return this.m_items},o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){var e,i,n,s,r,a,l,h,c,d,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,V,$,M,D,B,R;if(this._histogramBase=null,this.m_items=[],!this.m_model.timeScale().isEmpty()&&!this.m_study.priceScale().isEmpty()&&(e=this.m_model.timeScale().visibleBars().clone(),!e.isEmpty())){if(i=this.m_series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),n=this.m_series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT),s=this.m_study.offset(this._plotName),s>0?(i-=s,n+=s):(i+=s,n-=s),r=this.m_study.properties().styles[this._plotName].plottype.value(),a=[O.PLOT_LINE,O.PLOT_AREA,O.PLOT_CIRCLES,O.PLOT_CROSS].indexOf(r)>=0,l=this.m_study.data(),h=this.m_study.firstValue(),a&&l._length()>0){for(c=l._bsearch(i);o.isIndexValid(c,l)&&void 0===l._valueAt(c)[this._plotIndex+1];)c-=1;for(i=o.isIndexValid(c,l)?l._indexAt(c):i,d=l._bsearch(n);o.isIndexValid(d,l)&&void 0===l._valueAt(d)[this._plotIndex+1];)d+=1;n=o.isIndexValid(d,l)?l._indexAt(d):n}for(u=l.range(i,n),_=this.m_study.priceScale(),f=_.properties().percentage.value(),g=this._getTranspValue(),m={},v=function(t,e){var i=t+"@"+e;return m[i]||(this._plotName&&"vol"===this._plotName?m[i]=TradingView.generateColor(t,e):m[i]=TradingView.generateColor(t,e,!0)),m[i]}.bind(this),y=u._start;y<u._end;++y)b=u._indexAt(y),b+=s,b=Math.floor(b),w=u._valueAt(y),S=w[this._plotIndex+1],T=void 0===S||null===S,S=T?NaN:S,f&&!T&&(S=100*(S-h)/h),a&&T||(C=new t.Point(b,S),x=void 0!==w[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&x&&(S=w[this._colorer+1],C.style={},P=this.m_study.properties().styles[this._plotName],void 0!==S&&null!==S?(L=this._palette.valToIndex?this._palette.valToIndex[S]:S,k=this._paletterProps.colors[L],E=k.color.value(),C.style.color=TradingView.isHexColor(E)?v(E,g):E):(E=P.color.value(),C.style.color=v(E,100)),I=void 0!==L?k.width.value():P.linewidth.value(),V=void 0!==L?k.style.value():P.linestyle.value(),C.style.width=I,C.style.style=V),this.m_items.push(C));if(_.pricesToCoordinates(this.m_items),this.m_model.timeScale().indexesToCoordinates(this.m_items),this.m_study.properties().styles[this._plotName].histogramBase&&(this._histogramBase=this.m_study.priceScale().priceToCoordinate(this.m_study.properties().styles[this._plotName].histogramBase.value())),this.m_study===this.m_model.selectedSource())for($=A(i,n),this._selectionData={points:[]},this._selectionData.hittestResult=p.REGULAR,y=0;y<$.length;y++)b=$[y],w=this.m_study.data().valueAt(b),b+=s,void 0!==w&&(S=w[this._plotIndex+1],_.properties().percentage.value()&&(S=100*(S-h)/h),M=this.m_model.timeScale().indexToCoordinate(Math.floor(b)),D=this.m_study.priceScale().priceToCoordinate(S),this._selectionData.points.push(new t.Point(M,D)));B=this.m_study.properties().styles[this._plotName],this._lineColor=TradingView.generateColor(B.color.value(),g),this._lineWidth=B.linewidth.value(),R=B.color.value(),this._colorer&&(R=this._paletterProps.colors[0].color.value(),this._lineWidth=this._paletterProps.colors[0].width.value(),this._lineColor=TradingView.generateColor(this._paletterProps.colors[0].color.value(),g)),this._color2=TradingView.generateColor(R,g),this._color1=TradingView.generateColor(o.addHueForColor(R),g)}},o.addHueForColor=TradingView.memoize(function(t){var e,i=new $(t),o=M(i.r,i.g,i.b),n=o[0]+.05;return o[0]=n-Math.floor(n),e=D(o[0],o[1],o[2]),i.r=e[0],i.g=e[1],i.b=e[2],i.toHex()}),o.prototype._getTranspValue=function(){var t=this.m_study.properties(),e=t.styles[this._plotName],i=0,o=0,n=this.m_study.metaInfo();return"Volume@tv-basicstudies"===n.id&&n.version<=46&&"transparency"in t?(i=t.transparency.value(),i=isNumber(i)?i:o):(e.transparency&&(i=e.transparency.value(),i=isNumber(i)?i:o),i)},o.prototype.renderer=function(){var t,e,i,o,n=this.m_study.properties().styles[this._plotName];if(n.visible.value()&&this.m_study.priceScale()){switch(this._invalidated&&(this._updateImpl(),this._invalidated=!1),t={},t.barSpacing=this.m_model.timeScale().barSpacing(),t.items=this.m_items,t.histogramBase=this._histogramBase?this._histogramBase:this.m_study.priceScale().height(),t.lineIndex=0,t.lineStyle=n.linestyle.value(),t.lineColor=this._lineColor,t.lineWidth=this._lineWidth,t.lineWidth=isNumber(t.lineWidth)?t.lineWidth:1,t.color1=this._color1,t.color2=this._color2,t.bottom=t.histogramBase,this._colorer||(t.simpleMode=!0),e=new I,i=!!n.joinPoints&&n.joinPoints.value(),n.plottype.value()){case O.PLOT_LINE:case O.PLOT_LINE_WITH_BREAKS:e.append(new b(t));break;case O.PLOT_AREA:case O.PLOT_AREA_WITH_BREAKS:e.append(new w(t));break;case O.PLOT_HISTOGRAM:e.append(new v(t));break;case O.PLOT_COLUMNS:e.append(new y(t));break;case O.PLOT_CROSS:e.append(new T(t)),i&&(o=TradingView.merge({},t),o.lineWidth=1,o.forceLineWidth=!0,e.append(new b(o)));break;case O.PLOT_CIRCLES:e.append(new C(t)),i&&(o=TradingView.merge({},t),o.lineWidth=1,o.ignorePaletteLineWidth=!0,e.append(new b(o)));break;default:e.append(new b(t))}return this.m_study===this.m_model.selectedSource()&&e.append(new _(this._selectionData)),e}},n.prototype.items=function(){return this._items},n.prototype.update=function(){this._invalidated=!0},n.prototype._scalesReady=function(){var t=this._model.timeScale(),e=this._study.priceScale();return t&&e&&!t.isEmpty()&&!e.isEmpty()},n.prototype._updateImpl=function(){var e,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y;if(this._items=[],assert(this._scalesReady(),"Scales must be ready!"),e=this._model.timeScale().visibleBars().clone(),!e.isEmpty()){for(i=this._study.metaInfo().plots,o=i[this._plotIndex].palette,n=this._study.properties().palettes[o],s=n.colors,r=this._study.metaInfo().palettes[o],a=this._study.properties().styles[this._plotName].transparency.value(),l=this._series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),h=this._series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT),c=this._study.offset(this._plotName),c>0?(l-=c,h+=c):(l+=c,h-=c),d=this._study.data(),p=d.range(l,h),u=p._start;u<p._end;++u)_=p._indexAt(u),_+=c,f=p._valueAt(u),g=f[this._plotIndex+1],m=new t.Point(Math.floor(_)-.5),v=isNumber(a)?a:50,v=Math.min(v,100),v=Math.max(v,0),void 0!==g&&null!==g?(y=r.valToIndex?r.valToIndex[g]:g,m.color=TradingView.generateColor(s[y].color.value(),v)):m.color=null,this._items.push(m);this._model.timeScale().indexesToCoordinates(this._items)}},n.prototype.renderer=function(){var t,e;if(this._study.properties().styles[this._plotName].visible&&this._study.properties().styles[this._plotName].visible.value()&&this._scalesReady())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),t={items:this._items,y:0,h:this._study.priceScale().height(),w:Math.ceil(this._model.timeScale().barSpacing())},e=new I,e.append(new k(t)),e},s.prototype.items=function(){return this.m_items},s.prototype.update=function(){this.m_invalidated=!0},s.prototype._scalesReady=function(){var t=this.m_model.timeScale(),e=this.m_study.priceScale();return t&&e&&!t.isEmpty()&&!e.isEmpty()},s.prototype._updateImpl=function(){var t,e,i,o,n,s,r,a,l,h,c,d,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E;if(this.m_items=[],this._scalesReady()&&(t=this.m_model.timeScale(),e=this.m_study.priceScale(),i=t.visibleBars().clone(),!i.isEmpty())){for(o=this.m_series.nearestIndex(i.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),n=this.m_series.nearestIndex(i.lastBar(),TradingView.SEARCH_NEAREST_LEFT),s=this.m_study.offset(this.m_plotName),s>0?(o-=s,n+=s):(o+=s,n-=s),r=this.m_study.data(),a=this.m_study.firstValue(),l=r.range(o,n),h=e.properties().percentage.value(),c=this._getTranspValue(),d=A(o,n),u=this.m_study===this.m_model.selectedSource(),u&&(this.m_selectionData={points:[],hittestResult:p.REGULAR,vertOffset:0}),_=this.m_series.properties().style.value(),f=_===TradingView.Series.STYLE_LINE?"lineStyle":_===TradingView.Series.STYLE_AREA?"areaStyle":null,f?(g=this.m_series.properties()[f].priceSource.value(),m=g):(g="high",m="low"),this._topCoord=e.coordinateToPrice(e.height()*e.topMargin()),this._bottomCoord=e.coordinateToPrice(e.height()*(1-e.bottomMargin())),v=l._start;v<l._end;++v)y=l._indexAt(v),b=Math.floor(y+s),w=l._valueAt(v),S=w[this.m_plotIndex+1],null!==S&&void 0!==S&&(T=this._createItem(b,S,g,m,h,a),void 0!==T&&null!==T&&(C=void 0!==w[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&C&&(S=w[this._colorer+1],T.style={},void 0!==S&&null!==S?(P=this._palette.valToIndex?this._palette.valToIndex[S]:S,x=this._paletterProps.colors[P].color.value(),T.style.color=TradingView.generateColor(x,c)):(x=this.m_study.properties().styles[this.m_plotName].color.value(),T.style.color=TradingView.generateColor(x,100)),L=c>9?c-10:0,T.style.borderColor=TradingView.generateColor(x,L)),k=void 0!==w[this._textColorer+1]||this._textPalette&&this._textPalette.addDefaultColor,this._textColorer&&k&&(S=w[this._textColorer+1],T.style||(T.style={}),void 0!==S&&null!==S?(P=this._textPalette.valToIndex?this._textPalette.valToIndex[S]:S,E=this._textPaletterProps.colors[P].color.value(),T.style.textColor=TradingView.generateColor(E,c)):(E=this.m_study.properties().styles[this.m_plotName].textColor.value(),T.style.textColor=TradingView.generateColor(E,100))),u&&d.indexOf(y)!==-1&&this.m_selectionData.points.push(T),this.m_items.push(T)));this._convertItemsToCoordinates()}},s.prototype._getSeriesVal=function(t,e){var i;t=t||"close",i=null;try{i=this.m_series[t](e)}catch(t){}return i},s.prototype._getTranspValue=function(){var t,e=0;return this.m_study.properties().transparency&&(e=this.m_study.properties().transparency.value(),e=isNumber(e)?e:50),t=this.m_study.properties().styles[this.m_plotName],t.transparency&&(e=t.transparency.value(),e=isNumber(e)?e:50),e},s.prototype._createItem=function(e,i,o,n,s,r){var a,l,h,c,d=this.m_study.properties().styles[this.m_plotName].location.value();if(!i&&d!==CanvasEx.MARKLOC_ABSOLUTE)return null;switch(d){case CanvasEx.MARKLOC_ABOVEBAR:if(a=this._getSeriesVal(o,e),void 0===a||null==a)return null;l=a;break;case CanvasEx.MARKLOC_BELOWBAR:if(h=this._getSeriesVal(n,e),void 0===h||null==h)return null;l=h;break;case CanvasEx.MARKLOC_TOP:l=this._topCoord;break;case CanvasEx.MARKLOC_BOTTOM:l=this._bottomCoord;break;case CanvasEx.MARKLOC_ABSOLUTE:l=i;break;default:throw Error("Bad value: "+d)}return s&&d!==CanvasEx.MARKLOC_TOP&&d!==CanvasEx.MARKLOC_BOTTOM&&(l=100*(l-r)/r),c=new t.Point(e,l)},s.prototype._convertItemsToCoordinates=function(){var t=this.m_model.timeScale(),e=this.m_study.priceScale();t.indexesToCoordinates(this.m_items),e.pricesToCoordinatesEx(this.m_items,function(t){return t.y},function(t,e){t.y=e})},s.prototype._calculateVerticalOffset=function(t,e){var i=0;switch(t){case CanvasEx.MARKLOC_ABOVEBAR:case CanvasEx.MARKLOC_BOTTOM:i=-e;break;case CanvasEx.MARKLOC_BELOWBAR:case CanvasEx.MARKLOC_TOP:i=e}return i},s.prototype._calculateShapeHeight=function(t,e){var i=t;switch(e){case CanvasEx.SIZE_TINY:i=.3*t;break;case CanvasEx.SIZE_SMALL:i=.6*t;break;case CanvasEx.SIZE_NORMAL:i=t;break;case CanvasEx.SIZE_LARGE:i=1.5*t;break;case CanvasEx.SIZE_HUGE:i=2*t}return i},s.prototype.renderer=function(){var t,e,i,o,n,s,r,a,l,h;if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady())return t=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),e={},i=this._getTranspValue(),o=t.barSpacing(),n=this._calculateShapeHeight(o),s=this.m_study.properties().styles[this.m_plotName].location.value(),r=this._calculateVerticalOffset(s,n+n/2),e.barSpacing=o,e.items=this.m_items,e.color=TradingView.generateColor(this.m_study.properties().styles[this.m_plotName].color.value(),i),e.height=n,e.vertOffset=r,a=this.m_study.properties().styles[this.m_plotName].plottype.value(),l=B.Data[a],void 0===l&&TradingView.logError("Unknown style "+a),h=new I,h.append(new TradingView[l.paneRendererClass](e)),this.m_study===this.m_model.selectedSource()&&(this.m_selectionData.vertOffset=r,h.append(new _(this.m_selectionData))),h},inherit(r,s),r.prototype.renderer=function(){var t,e,i,o,n,s,r,a,l,h,c,d,p,u,f,g,m,v,y,b,w=this.m_study.properties().styles[this.m_plotName];if(w.visible&&w.visible.value()&&this._scalesReady())return t=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),e={},i=this._getTranspValue(),o=t.barSpacing(),w.size?(s=w.size.value(),n=this._calculateShapeHeight(25,s)):n=Math.round(o/2),r=w.location.value(),a=TradingView.generateColor(w.color.value(),i),l=i>19?i-10:0,h=this._calculateVerticalOffset(r,Math.round(1.5*n)),e.barSpacing=o,e.items=this.items(),e.color=a,e.borderColor=TradingView.generateColor(w.color.value(),l),e.height=n,e.vertOffset=h,c=w.plottype.value(),d=B.Data[c],void 0===d&&TradingView.logError("Unknown style "+c),p=new I,u=w.text?w.text.value():void 0,void 0!==u&&""!==u.trim()&&(f=u.trim().replace(/\\n/gm,"\n"),f=TradingView.cleanButAmpersand(f,!0),g=!1,m=!1,v="Arial",y=12,e.textCache=new E(f,g,m,v,y),b=w.textColor?w.textColor.value():void 0,e.textColor=b?TradingView.generateColor(b,i):a),p.append(new TradingView[d.paneRendererClass](e)),this.m_study===this.m_model.selectedSource()&&(this.m_selectionData.vertOffset=h,p.append(new _(this.m_selectionData))),p},inherit(a,r),a.prototype.renderer=function(){var t,e,i,o,n,s,r,a,l,h,c,d,p,u,f,g,m,v=this.m_study.properties().styles[this.m_plotName];if(v.visible&&v.visible.value()&&this._scalesReady())return t=this.m_model.timeScale(),this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),e={},i=this._getTranspValue(),o=t.barSpacing(),v.size?(s=v.size.value(),n=this._calculateShapeHeight(50,s)):n=Math.round(o),r=v.location.value(),a=TradingView.generateColor(v.color.value(),i),l=this._calculateVerticalOffset(r,n),e.items=this.items(),e.char=v.char.value(),e.height=n,e.vertOffset=l,e.color=a,h=new I,c=v.text?v.text.value():void 0,void 0!==c&&""!==c.trim()&&(d=c.trim().replace(/\\n/gm,"\n"),d=TradingView.cleanButAmpersand(d,!0),p=!1,u=!1,f="Arial",g=12,e.textCache=new E(d,p,u,f,g),m=v.textColor?v.textColor.value():void 0,e.textColor=m?TradingView.generateColor(m,i):a),h.append(new L(e)),this.m_study===this.m_model.selectedSource()&&(this.m_selectionData.vertOffset=l,h.append(new _(this.m_selectionData))),h},inherit(l,s),l.prototype.renderer=function(){var t,e,i,o,n;if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady())return this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1),t={},e=this._getTranspValue(),i=this.m_model.timeScale().barSpacing(),t.items=this.m_items,t.barSpacing=i,t.colorup=TradingView.generateColor(this.m_study.properties().styles[this.m_plotName].colorup.value(),e),t.colordown=TradingView.generateColor(this.m_study.properties().styles[this.m_plotName].colordown.value(),e),t.colorBorder=TradingView.generateColor("#000000",e),t.minHeight=this.m_study.properties().styles[this.m_plotName].minHeight.value(),t.maxHeight=this.m_study.properties().styles[this.m_plotName].maxHeight.value(),o=new I,o.append(new P(t)),this.m_study===this.m_model.selectedSource()&&(n=this.m_selectionData,n.barSpacing=i,o.append(new f(n))),o},l.prototype._createItem=function(t,e,i,o,n,s){var r,a,l,h,c;if(0!==e){if(Math.abs(e)>this._maxAbsValue&&(this._maxAbsValue=Math.abs(e)),r=e>0){if(l=this._getSeriesVal(o,t),void 0===l||null==l)return null;a=l}else{if(h=this._getSeriesVal(i,t),void 0===h||null==h)return null;a=h}return n&&(a=100*(a-s)/s),c=new x(t,a,e,r)}},l.prototype._convertItemsToCoordinates=function(){var t,e,i,o,n,s,r,a,l,h=this.m_model.timeScale(),c=this.m_study.priceScale();for(h.indexesToCoordinates(this.m_items),c.pricesToCoordinatesEx(this.m_items,function(t){return t.y},function(t,e){t.y=e}),t=Math.abs(this.m_study.properties().styles[this.m_plotName].minHeight.value()),e=Math.abs(this.m_study.properties().styles[this.m_plotName].maxHeight.value()),t>e&&(i=t,t=e,e=i),o=e-t,n=o/this._maxAbsValue,s=this.m_items,r=0;r<s.length;r++)a=s[r],l=Math.abs(a.height),a.height=l*n+t},h.prototype.update=function(){this._invalidated=!0},h.prototype._updateImpl=function(){var e,i,o,n,s,r,a,l,h,c,d,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,V,O,B,R,N,F;if(this.m_bars.length=0,!this.m_model.timeScale().isEmpty()&&!this.m_study.priceScale().isEmpty()&&(e=this.m_model.timeScale().visibleBars().clone(),!e.isEmpty())){for(i=this.m_series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),o=this.m_series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT),n=this.m_study.data(),s=this.m_study.firstValue(),r=n.range(i,o),a=this.m_study.priceScale(),l=a.properties().percentage.value(),h=0,c=this.m_study.properties().ohlcPlots[this.m_plotName],d={},u=function(t,e){var i=t+"@"+e;return d[i]||(d[i]=TradingView.generateColor(t,e)),d[i]},_=r._start;_<r._end;++_){for(f=r._indexAt(_),f=Math.floor(f),g=r._valueAt(_),m=!0,v={},y=TradingView.OPEN_PLOT;y<=TradingView.CLOSE_PLOT;++y){if(b=g[this._ohlcPlotIndexes[y]+1],void 0===b||null===b){m=!1;break}v[y]=b}m&&(w=v[TradingView.OPEN_PLOT],S=v[TradingView.CLOSE_PLOT],T=Math.max(w,v[TradingView.HIGH_PLOT],v[TradingView.LOW_PLOT],S),C=Math.min(w,v[TradingView.HIGH_PLOT],v[TradingView.LOW_PLOT],S),x={},x.time=Math.round(f),l?(x.open=100*(w-s)/s,x.high=100*(T-s)/s,x.low=100*(C-s)/s,x.close=100*(S-s)/s):(x.open=w,x.high=T,x.low=C,x.close=S),P=c.color.value(),L=void 0!==g[this._colorer+1]||this._palette&&this._palette.addDefaultColor,this._colorer&&L&&(b=g[this._colorer+1],void 0!==b&&null!==b&&(k=this._palette.valToIndex?this._palette.valToIndex[b]:b,E=this._paletterProps.colors[k],P=E.color.value())),x.color=u(P,h),I=new $(P),V=M(I.r,I.g,I.b),O=V[2]>.25?V[2]-.26:V[2]+.75,B=D(V[0],V[1],O),I.r=B[0],I.g=B[1],I.b=B[2],x.borderColor=u(I.toHex(),h),x.hollow=null,this.m_bars.push(x))}if(a.barPricesToCoordinates(this.m_bars),this.m_model.timeScale().barIndexesToCoordinates(this.m_bars),this.m_study===this.m_model.selectedSource())for(R=A(i,o),this._selectionData={points:[],hittestResult:p.REGULAR},_=0;_<R.length;_++)f=R[_],g=this.m_study.data().valueAt(f),void 0!==g&&(b=g[this._plotIndex+1],a.properties().percentage.value()&&(b=100*(b-s)/s),N=this.m_model.timeScale().indexToCoordinate(Math.floor(f)),F=this.m_study.priceScale().priceToCoordinate(b),this._selectionData.points.push(new t.Point(N,F)))}},h.prototype.items=function(){return this.m_bars},inherit(c,h),c.prototype.renderer=function(){var t,e,i=this.m_study.properties().ohlcPlots[this.m_plotName];if(i.visible.value())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),t={},t.bars=this.m_bars,t.barSpacing=this.m_model.timeScale().barSpacing(),t.dontDrawOpen=this.m_series.properties().barStyle.dontDrawOpen.value(),e=new I,e.append(new m(t)),this.m_series===this.m_model.selectedSource()&&e.append(new _(this._selectionData)),e},inherit(d,h),d.prototype.renderer=function(){var t,e,i,o=this.m_study.properties().ohlcPlots[this.m_plotName];if(o.visible.value())return this._invalidated&&(this._updateImpl(),this._invalidated=!1),t={},t.bars=this.m_bars,t.barSpacing=this.m_model.timeScale().barSpacing(),t.drawWick=o.drawWick.value(),t.drawBorder=o.drawBorder.value(),e=o.wickColor.value(),t.borderColor=e,t.wickColor=e,i=new I,i.append(new S(t)),this.m_series===this.m_model.selectedSource()&&i.append(new _(this._selectionData)),i},e.StudyPaneView=o,e.StudyBackgroundPaneView=n,e.StudyPlotShapesPaneView=r,e.StudyPlotCharsPaneView=a,e.StudyPlotArrowsPaneView=l,e.StudyPlotCandlesPaneView=d,e.StudyPlotBarsPaneView=c}).call(e,i(21))},function(t,e,i){"use strict";function o(t){this._data=t}function n(t){this._source=t,this._points1=[],this._points2=[],this._timePoints=[],this._getBarSpacing=t.model().timeScale().barSpacing.bind(t.model().timeScale()),this._invalidated=!0}function s(t){n.call(this,t)}function r(t,e,i){n.call(this,t),assert(e.type===h.FilledArea.TYPE_PLOTS,"Wrong filledArea type: "+e.type),this._fillMetaInfo=e,this._fillStyleProps=i}var a=i(94),l=i(96),h=i(114);o.prototype.hitTest=function(t){var e,i,o,n;for(n=1;n<this._data.points1.length;++n)if(e=this._data.points1[n],i=this._data.points2[n],o=this._data.timePoints[n],o===t.x&&(t.y>=e&&t.y<=i||t.y<=e&&t.y>=i))return new a(a.REGULAR);return null},o.prototype.draw=function(t){var e,i,o,n,s,r,a,h,c,d,p,u,_,f,g;if(0!==this._data.points1.length&&0!==this._data.points2.length)for(e=this._data.timePoints,i=this._data.points1,o=this._data.points2,n=this._data.getBarSpacing()/24,s=l.paneRendererCoordinateIsValid,r=isNumber(this._data.transparency)?this._data.transparency:50,r=Math.min(r,100),r=Math.max(r,0),a=TradingView.generateColor(this._data.backcolor,r),f=0;f<this._data.timePoints.length;f++)if(c=e[f],d=i[f],p=o[f],u=i[f+1],_=o[f+1],s(d)&&s(p)&&(h||(h={
points1:[],points2:[],timePoints:[]}),h.points1.push(d),h.points2.push(p),h.timePoints.push(c)),h&&(!s(u)||!s(_))){for(1===h.timePoints.length&&(h.timePoints=[h.timePoints[0]-n,h.timePoints[0]+n],h.points1.push(h.points1[0]),h.points2.push(h.points2[0])),t.beginPath(),t.moveTo(h.timePoints[0],h.points1[0]),g=1;g<h.timePoints.length;g++)t.lineTo(h.timePoints[g],h.points1[g]);for(h.timePoints.length>0&&h.points2.length>0&&t.lineTo(h.timePoints[h.timePoints.length-1],h.points2[h.timePoints.length-1]),g=h.timePoints.length-2;g>=0;g--)t.lineTo(h.timePoints[g],h.points2[g]);t.closePath(),t.fillStyle=a,t.fill(),h=null}},n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){var t,e,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C;if(this._points1=[],this._points2=[],this._timePoints=[],this._visible()&&(t=this._source.priceScale(),e=this._source._model.timeScale(),t&&!t.isEmpty()&&!this._source._model.timeScale().isEmpty()&&!this._source._series.bars().isEmpty()&&(i=this._source.data()._columns.indexOf(this._plotAId())+1,o=this._source.data()._columns.indexOf(this._plotBId())+1,n=this._source._model.timeScale().visibleBars(),!n.isEmpty()))){if(s=this._source._series.nearestIndex(n.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),r=this._source._series.nearestIndex(n.lastBar(),TradingView.SEARCH_NEAREST_LEFT),a=this._source.data().range(s,r),this._source.data()._items.length>0)for(l=this._source.firstValue(),h=a._start,c=a._end,d=this._source.offset(this._plotAId()),p=this._source.offset(this._plotBId()),u=Math.max(d,p),_=Math.min(d,p),f=h+u,g=0,h>g&&(f=h<u?u:h),m=c+_,v=a._items.length,c>v+_&&c<v&&(m=v+_),_<0&&c<=v+_&&(m=c),y=a._indexAt(h),f<h?y+=u:f>c?y+=u:y=a._indexAt(f),b=f;b<m;++b)w=a._valueAt(b-d),S=a._valueAt(b-p),T=w[i],C=S[o],t.properties().percentage.value()&&(T=100*(T-l)/l,C=100*(C-l)/l),this._points1.push(T),this._points2.push(C),this._timePoints.push(e.indexToCoordinate(y++));t.pricesArrayToCoordinates(this._points1),t.pricesArrayToCoordinates(this._points2)}},n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var t={};return t.points1=this._points1,t.points2=this._points2,t.timePoints=this._timePoints,t.getBarSpacing=this._getBarSpacing,t.backcolor=this._color(),t.transparency=this._transparency(),new o(t)},n.prototype._plotAId=function(){assert(!1,"Pure virtual call!")},n.prototype._plotBId=function(){assert(!1,"Pure virtual call!")},n.prototype._color=function(){assert(!1,"Pure virtual call!")},n.prototype._transparency=function(){assert(!1,"Pure virtual call!")},n.prototype._visible=function(){assert(!1,"Pure virtual call!")},inherit(s,n),s.prototype._plotAId=function(){var t=this._source.properties().area[0];return t.name.value()},s.prototype._plotBId=function(){var t=this._source.properties().area[1];return t.name.value()},s.prototype._color=function(){return this._source.properties().areaBackground.backgroundColor.value()},s.prototype._transparency=function(){return this._source.properties().areaBackground.transparency.value()},s.prototype._visible=function(){return this._source.properties().areaBackground.fillBackground.value()},inherit(r,n),r.prototype._plotAId=function(){return this._fillMetaInfo.objAId},r.prototype._plotBId=function(){return this._fillMetaInfo.objBId},r.prototype._color=function(){return this._fillStyleProps.color.value()},r.prototype._transparency=function(){return this._fillStyleProps.transparency.value()},r.prototype._visible=function(){return this._fillStyleProps.visible.value()},e.PlotFillPaneView=r,e.AreaBackgroundPaneView=s},function(t,e,i){(function(t){"use strict";function o(t,e){var i,o,n,s,l;if(r.call(this),this._study=t,this._model=e,i=t.metaInfo().plots){for(o=0;o<i.length;++o)if(!(this._study.isSelfColorerPlot(o)||this._study.isBarColorerPlot(o)||this._study.isBgColorerPlot(o)||this._study.isDataOffsetPlot(o)||this._study.isOHLCColorerPlot(o))){if(n=i[o].id,"Compare@tv-basicstudies"===this._study.metaInfo().id)s=new a(this._study.inputsForGUI()[1],"");else{l=this._study.title();try{l=this._study.properties().styles[n].title.value()}catch(t){}s=new a(l,"")}s.plotId=n,s.plotIndex=o,this._items.push(s)}this.update(),this._invalidated=!0}}function n(t,e){o.call(this,t,e)}var s=i(91),r=s.DataWindowView,a=s.DataWindowItem,l=i(110);inherit(o,r),o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){var e,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b=!0;for(this._header=this._study.title(b),this._title=this._study.title(),e=this._study.isVisible()?$.t("n/a"):"",i=0;i<this._items.length;++i)this._items[i].setValue(e);if(t.enabled("hide_last_na_study_output")&&this._items.length&&this._items[this._items.length-1].setValue(""),!this._model.timeScale().isEmpty()){if(o=this._study.metaInfo().plots,n=null,s={},o)for(i=0;i<o.length;i++)(this._study.isSelfColorerPlot(i)||this._study.isOHLCColorerPlot(i))&&(s[o[i].target]={index:i},s[o[i].target].palette=this._study.metaInfo().palettes[o[i].palette],s[o[i].target].paletterProps=this._study.properties().palettes[o[i].palette]);for(r=this._study.data().size()-1,a=this._model.crossHairSource().appliedIndex(),l=this._study.formatter(),i=0;i<this._items.length;++i)h=this._items[i],c=h.plotId,d=h.plotIndex,p=this._study.offset(c),u=isNumber(a)?this._study.nearestIndex(a-p,TradingView.SEARCH_NEAREST_LEFT):r,void 0!==u&&(_=this._study.data().valueAt(u)||this._study.data().last(),_&&(f=_[d+1],isNumber(f)&&(h.setValue(l.format(f)),g=this._study.properties().styles[c].color.value(),this._study.isOHLCSeriesPlot(d)&&(c=o[d].target,g=this._study.properties().ohlcPlots[c].color.value()),s[c]&&_.length>s[c].index+1?(m=_[s[c].index+1],void 0!==m&&null!==m?(n=s[c].palette,v=s[c].paletterProps,y=n.valToIndex?n.valToIndex[m]:m,this._items[i].setColor(v.colors[y].color.value())):this._items[i].setColor(g)):this._items[i].setColor(g))))}},o.prototype.items=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items},inherit(n,o),n.prototype.additional=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._additional},n.prototype._updateImpl=function(){var t=l(this._study.symbolInfo());return t?this._additional="(Data Provided by "+t+")":this._additional=void 0,o.prototype._updateImpl.call(this)},e.StudyDataWindowView=o,e.DataVendorStudyDataWindowView=n}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e){n.call(this,e),this._study=t,this._inputValueReplacements={NONE:"Default"}}var n=i(87);inherit(o,n),o.prototype.color=function(){return this._study._failed||this._study.metaInfo&&this._study.metaInfo().isTVScriptStub?"#ff0000":n.prototype.color.call(this)},o.prototype.update=function(){this._study._failed?this._text=this._study.title(!0,this._inputValueReplacements)+": "+this._study.status():this._text=this._study.title(!0,this._inputValueReplacements)+" "+this._study.status()},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t){this._data=t}function n(t){this._data=t}function s(t,e){for(var i,o,n,s=0,r=t.length-1;s<=r;)if(i=s+r>>>1,o=t[i].y1,n=t[i].y2,o>e)s=i+1;else{if(!(n<e))return t[i+1]&&o===t[i+1].y1?i+1:i;r=i-1}return-1}var r=i(104).TextRenderer,a=i(102).HorzLineRenderer,l=i(131).TrendLineRenderer,h=i(75),c=i(76),d=i(158),p=TradingView.Study,u=i(159),_=i(94),f=i(98),g=i(55),m=g.clearRect;p.graphicsZOrderPriority=function(t){switch(t){case"polygons":return-100;case"trendchannels":return-90;default:return 0}},p.StudyPaneView_horizlines=function(t,e){this._study=t,this._model=e,this._data=[]},p.StudyPaneView_horizlines.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_horizlines.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)t.append(new l(this._data[e],new _(_.REGULAR)));return t},p.StudyPaneView_horizlines.prototype._updateViewInternal=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S;if(this._data=[],t=this._study.graphics().horizlines,t&&(i=this._study.priceScale(),o=this._study._model.timeScale(),i&&!i.isEmpty()&&o&&!o.isEmpty()))for(n=this._study.graphics().indexes,s=this._model.timeScale().visibleBars(),r=s.firstBar(),a=s.lastBar(),l=0;l<t.length;l++)if(h=t[l],h.data&&(c=this._study.properties().graphics.horizlines[h.styleId],c.visible.value()))for(d=0;d<h.data.length;d++)p=h.data[d],u=n[p.startIndex],_=n[p.endIndex],!p.extendRight&&Math.max(u,_)<r||!p.extendLeft&&Math.min(u,_)>a||(f={},g=o.indexToCoordinate(u),m=o.indexToCoordinate(_),v=p.level,i.isPercent()&&(y=this._study.firstValue(),v=i.priceRange().convertToPercent(v,y)),b=i.priceToCoordinate(v),w=new e.Point(g,b),S=new e.Point(m,b),f.points=[w,S],f.extendleft=p.extendLeft,f.extendright=p.extendRight,f.width=o.width(),f.height=i.height(),f.color=c.color.value(),f.linewidth=c.width.value(),f.linestyle=c.style.value(),this._data.push(f))},p.StudyPaneView_vertlines=function(t,e){this._study=t,this._model=e,this._data=[]},p.StudyPaneView_vertlines.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_vertlines.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)t.append(new l(this._data[e],new _(_.REGULAR)));return t},p.StudyPaneView_vertlines.prototype._updateViewInternal=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w;if(this._data=[],t=this._study.graphics().vertlines,t&&(i=this._study.priceScale(),o=this._study._model.timeScale(),i&&!i.isEmpty()&&o&&!o.isEmpty()))for(n=this._study.graphics().indexes,s=this._model.timeScale().visibleBars(),r=s.firstBar(),a=s.lastBar(),l=0;l<t.length;l++)if(h=t[l],h.data&&(c=this._study.properties().graphics.vertlines[h.styleId],c.visible.value()))for(d=0;d<h.data.length;d++)p=h.data[d],u={},n[p.index]<r||n[p.index]>a||(_=o.indexToCoordinate(n[p.index])+1,f=null,p.extendBottom?g=i.height():(v=p.startPrice,i.isPercent()&&(f=f||this._study.firstValue(),v=i.priceRange().convertToPercent(v,f)),g=i.priceToCoordinate(v)),p.extendTop?m=0:(y=p.endPrice,i.isPercent()&&(f=f||this._study.firstValue(),y=i.priceRange().convertToPercent(y,f)),m=i.priceToCoordinate(y)),b=new e.Point(_,g),w=new e.Point(_,m),u.points=[b,w],u.extendleft=p.extendBottom,u.extendright=p.extendTop,u.width=o.width(),u.height=i.height(),u.color=c.color.value(),u.linewidth=c.width.value(),u.linestyle=c.style.value(),this._data.push(u))},p.StudyPaneView_lines=function(t,e){this._study=t,this._model=e,this._data=[]},p.StudyPaneView_lines.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_lines.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)t.append(new l(this._data[e],new _(_.REGULAR)));return t},p.StudyPaneView_lines.prototype._updateViewInternal=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C;if(this._data=[],t=this._study.graphics().lines,t&&(i=this._study.priceScale(),o=this._study._model.timeScale(),i&&!i.isEmpty()&&o&&!o.isEmpty()))for(n=this._study.graphics().indexes,s=this._model.timeScale().visibleBars(),r=s.firstBar(),a=s.lastBar(),l=0;l<t.length;l++)if(h=t[l],h.data&&(c=this._study.properties().graphics.lines[h.styleId],c.visible.value()))for(d=0;d<h.data.length;d++)p=h.data[d],u=n[p.startIndex]+(p.startOffset||0),_=n[p.endIndex]+(p.endOffset||0),!p.extendRight&&Math.max(u,_)<r||!p.extendLeft&&Math.min(u,_)>a||(f={},g=o.indexToCoordinate(u),m=o.indexToCoordinate(_),v=p.startPrice,y=p.endPrice,i.isPercent()&&(b=this._study.firstValue(),v=i.priceRange().convertToPercent(v,b),y=i.priceRange().convertToPercent(y,b)),w=i.priceToCoordinate(v),S=i.priceToCoordinate(y),T=new e.Point(g,w),C=new e.Point(m,S),f.points=[T,C],f.color=c.color.value(),f.linewidth=c.width.value(),f.linestyle=c.style.value(),this._data.push(f))},p.StudyPaneView_hlines=function(t,e){this._study=t,this._model=e,this._data=[],this._textData=[],this._textRendererCache={}},p.StudyPaneView_hlines.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_hlines.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)t.append(new a(this._data[e]));for(e=0;e<this._textData.length;e++)t.append(new r(this._textData[e],this._textRendererCache,new _(_.REGULAR)));return t},p.StudyPaneView_hlines.prototype._updateViewInternal=function(){this._calcHorzLinesData(),this._calcTextData()},p.StudyPaneView_hlines.prototype._calcTextData=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f;if(this._textData=[],t=this._study.graphics().hlines,t&&(i=this._study.priceScale(),o=this._study._model.timeScale(),i&&!i.isEmpty()&&o&&!o.isEmpty()))for(n=0;n<t.length;n++)if(s=t[n],s.data&&(r=this._study.properties().graphics.hlines[s.styleId],r.enableText.value()&&r.showText.value()))for(a=0;a<s.data.length;a++)l=s.data[a],h={},h.text=void 0===l.text?"":l.text,h.color=r.color.value(),h.font="arial",h.fontsize=r.fontSize.value(),c=l.level,i.isPercent()&&(d=this._study.firstValue(),c=i.priceRange().convertToPercent(c,d)),p=i.priceToCoordinate(c),u=r.textPos.value(),u===CanvasEx.TEXTPOS_TOPLEFT||u===CanvasEx.TEXTPOS_MIDDLELEFT||u===CanvasEx.TEXTPOS_BOTTOMLEFT?(_=4,h.horzAlign="left"):u===CanvasEx.TEXTPOS_TOPCENTER||u===CanvasEx.TEXTPOS_MIDDLECENTER||u===CanvasEx.TEXTPOS_BOTTOMCENTER?(_=o.width()/2,h.horzAlign="center"):u!==CanvasEx.TEXTPOS_TOPRIGHT&&u!==CanvasEx.TEXTPOS_MIDDLERIGHT&&u!==CanvasEx.TEXTPOS_BOTTOMRIGHT||(_=o.width(),h.horzAlign="right"),u===CanvasEx.TEXTPOS_TOPLEFT||u===CanvasEx.TEXTPOS_TOPCENTER||u===CanvasEx.TEXTPOS_TOPRIGHT?(h.vertAlign="bottom",p-=4):u===CanvasEx.TEXTPOS_MIDDLELEFT||u===CanvasEx.TEXTPOS_MIDDLECENTER||u===CanvasEx.TEXTPOS_MIDDLERIGHT?(h.vertAlign="middle",p-=2):u!==CanvasEx.TEXTPOS_BOTTOMLEFT&&u!==CanvasEx.TEXTPOS_BOTTOMCENTER&&u!==CanvasEx.TEXTPOS_BOTTOMRIGHT||(h.vertAlign="top"),f=new e.Point(_,p),h.points=[f],h.offsetX=0,h.offsetY=0,this._textData.push(h)},p.StudyPaneView_hlines.prototype._calcHorzLinesData=function(){var t,i,o,n,s,r,a,l,h,c,d,p;if(this._data=[],t=this._study.graphics().hlines,t&&(i=this._study.priceScale(),i&&!i.isEmpty()))for(o=0;o<t.length;o++)if(n=t[o],n.data&&(s=this._study.properties().graphics.hlines[n.styleId],s.visible.value()))for(r=0;r<n.data.length;r++)a=n.data[r],l={},h=0,c=a.level,i.isPercent()&&(d=this._study.firstValue(),c=i.priceRange().convertToPercent(c,d)),p=i.priceToCoordinate(c),l.points=[new e.Point(h,p)],l.color=s.color.value(),l.linewidth=s.width.value(),l.linestyle=s.style.value(),l.hitTestResult=_.REGULAR,this._data.push(l)},p.StudyPriceAxisView_hlines=function(t,e,i,o,n){this._study=t,this._model=e,this._line=i,this._styleId=o,this._data={},this._lineType=n,this._invalidated=!0},inherit(p.StudyPriceAxisView_hlines,h),p.StudyPriceAxisView_hlines.prototype.update=function(){this._invalidated=!0},p.StudyPriceAxisView_hlines.prototype.updateImpl=function(){var t,e,i,o,n;if(this._data={},this._data.visible=!1,t=this._study.priceScale(),t&&!t.isEmpty()&&(e=this._study.properties().visible.value(),e&&(i=this._study.properties().graphics[this._lineType][this._styleId],i.visible&&i.visible.value()&&i.showPrice&&i.showPrice.value()))){if(this._data.visible=!0,this._data.color="white",this._data.background=i.color.value(),o=this._line.level,t.isPercent()){if(n=this._study.firstValue(),!isNumber(n))return;o=t.priceRange().convertToPercent(o,n)}this._data.coordinate=t.priceToCoordinate(o),this._data.text=t.formatter().format(o)}},p.StudyPriceAxisView_hlines.prototype.renderer=function(){return this._invalidated&&(this.updateImpl(),this._invalidated=!1),new c(this._data)},TradingView.TriangleTextMarkRenderer=function(t,e){this._data=t,this._textCache=e},TradingView.TriangleTextMarkRenderer.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font},TradingView.TriangleTextMarkRenderer.prototype.draw=function(t){var e,i,o,n,s,r,a;if(this._data){switch(e="up"===this._data.direction?1:-1,i=this._data.point.x,"left"===this._data.halign?i-=this._data.size:"right"===this._data.halign&&(i+=this._data.size),o=this._data.point.y,t.font=this.fontStyle(),n=t.measureText(this._data.text).width,this._textCache.textWidth=n,s=this._data.fontSize,r=.65*s,a=1*s,t.save(),t.translate(i+.5,o+.5),t.beginPath(),t.moveTo(0,0),this._data.direction){case"up":case"down":t.lineTo(r,a*e),t.lineTo(.5*n+r,a*e),t.lineTo(.5*n+r,(a+1.75*s)*e),t.lineTo(.5*-n-r,(a+1.75*s)*e),t.lineTo(.5*-n-r,a*e),t.lineTo(-r,a*e),t.lineTo(0,0),t.strokeStyle=this._data.borderColor,t.stroke(),t.fillStyle=this._data.color,t.fill(),t.fillStyle=this._data.fontColor,t.fillText(this._data.text,.5*-n,e<0?e*a-.5*s:a+1.25*s);break;default:throw Error(this._data.direction+" doesn't supported by TradingView.TriangleTextMarkRenderer")}t.restore()}},TradingView.TriangleTextMarkRenderer.prototype.hitTest=function(t){var i,o,n,s,r,a,l,h,c,d,p,u=this._textCache.textWidth,f=this._data.fontSize;switch(this._data.direction){case"up":case"down":if(i="up"===this._data.direction?1:-1,o=.65*f,n=1*f,s=this._data.point.x,"left"===this._data.halign?s-=this._data.size:"right"===this._data.halign&&(s+=this._data.size),r=this._data.point.y,a=s-.5*u-o,l=s+.5*u+o,h=r+n*i,c=r+(n+1.75*f)*i,c<h&&(r=h,h=c,c=r),e.pointInRect(t,new e.Point(a,h),new e.Point(l,c)))return new _(_.REGULAR);if(d=[],d[0]={},d[0].x=this._data.point.x,d[0].y=this._data.point.y,d[1]={},d[1].x=this._data.point.x+.65*f,d[1].y=this._data.point.y+f*i,d[2]={},d[2].x=this._data.point.x-.65*f,d[2].y=this._data.point.y+f*i,p=(t.x-d[0].x)*(d[1].y-d[0].y)-(t.y-d[0].y)*(d[1].x-d[0].x),((t.x-d[1].x)*(d[2].y-d[1].y)-(t.y-d[1].y)*(d[2].x-d[1].x))*p>0&&((t.x-d[2].x)*(d[0].y-d[2].y)-(t.y-d[2].y)*(d[0].x-d[2].x))*p>0)return new _(_.REGULAR);break;default:throw Error(this._data.direction+" doesn't supported by TradingView.TriangleTextMarkRenderer")}return null},TradingView.RectangleTextMarkRenderer=function(t,e){this._data=t,this._textCache=e},TradingView.RectangleTextMarkRenderer.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font},TradingView.RectangleTextMarkRenderer.prototype.draw=function(t){var e,i,o,n,s;if(this._data){switch(e=this._data.point.x,i=this._data.point.y,t.font=this.fontStyle(),o=t.measureText(this._data.text).width,this._textCache.textWidth=o,t.save(),t.translate(e+.5,i+.5),t.beginPath(),t.moveTo(0,0),n=this._data.halign,s=this._data.valign,t.textAlign=n,s){case"middle":t.textBaseline="middle";break;case"top":t.textBaseline="bottom";break;case"bottom":t.textBaseline="hanging"}t.fillStyle=this._data.fontColor,t.fillText(this._data.text,0,0),t.restore()}},TradingView.RectangleTextMarkRenderer.prototype.hitTest=function(t){var i,o,n=this._data.point.x+.5,s=this._data.point.y+.5,r=this._textCache.textWidth,a=this._data.fontSize,l=this._data.halign,h=this._data.valign;switch(h){case"middle":s-=a/2;break;case"bottom":s-=a}switch(l){case"right":n-=r;break;case"center":n-=r/2}return i=new e.Point(n,s),o=new e.Point(n+r,s+a),e.pointInRect(t,i,o)?new _(_.REGULAR):null},TradingView.CircleShapeMarkRenderer=function(t,e){this._data=t,this._textCache=e},TradingView.CircleShapeMarkRenderer.prototype.draw=function(t){var e,i,o;this._data&&(e="down"===this._data.direction?1:"up"===this._data.direction?-1:0,i=this._data.point.x,o=this._data.point.y,t.save(),t.fillStyle=this._data.color,t.beginPath(),t.arc(i+1,o+2*this._data.size*e+.5,this._data.size,0,2*Math.PI),t.closePath(),t.fill(),t.stroke())},TradingView.CircleShapeMarkRenderer.prototype.hitTest=function(t){var e="down"===this._data.direction?1:"up"===this._data.direction?-1:0;return Math.pow(this._data.point.x+.5-t.x,2)+Math.pow(this._data.point.y+.5+2*this._data.size*e-t.y,2)<=Math.pow(this._data.size,2)?new _(_.REGULAR):null},TradingView.SquareShapeMarkRenderer=function(t,e){this._data=t,this._textCache=e},TradingView.SquareShapeMarkRenderer.prototype.draw=function(t){var i,o,n,s,r;this._data&&(i="down"===this._data.direction?1:"up"===this._data.direction?-1:0,o=parseInt(this._data.size),n=new e.Point(this._data.point.x-o/2,this._data.point.y-o/2+i*o),s=new e.Point(this._data.point.x+o/2,this._data.point.y+o/2+i*o),r=s.substract(n),t.beginPath(),t.fillStyle=this._data.color,t.rect(n.x,n.y,r.x,r.y),t.stroke(),t.fill())},TradingView.SquareShapeMarkRenderer.prototype.hitTest=function(t){var i="down"===this._data.direction?1:"up"===this._data.direction?-1:0,o=parseInt(this._data.size),n=new e.Point(this._data.point.x-o/2,this._data.point.y-o/2+i*o),s=new e.Point(this._data.point.x+o/2,this._data.point.y+o/2+i*o),r=new e.Point(Math.min(n.x,s.x),Math.min(n.y,s.y)),a=new e.Point(Math.max(n.x,s.x),Math.max(n.y,s.y));return e.pointInRect(t,r,a)?new _(_.REGULAR):null},TradingView.ArrowShapeMarkRenderer=function(t,e,i){this._data=t,this._textCache=e,this._arrowDirection=i},TradingView.ArrowShapeMarkRenderer.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d;if(this._data){switch(e=this._arrowDirection,i=1*this._data.size,o=this._data.color,n=this._data.point.x+1,s=this._data.point.y,r=1.1*i,e){case"up":s-=r;break;case"down":s+=r}switch(a=i/6,l=i/4,h=i/3,c=i/2,d=.6666666*i,t.save(),t.fillStyle=o,t.beginPath(),e){case"up":t.moveTo(n,s),t.lineTo(n-c,s+d),t.lineTo(n-l,s+d),t.lineTo(n,s+h),t.lineTo(n+l,s+d),t.lineTo(n+c,s+d),t.lineTo(n,s);break;case"down":t.moveTo(n,s+i),t.lineTo(n-c,s+h),t.lineTo(n-l,s+h),t.lineTo(n,s+d),t.lineTo(n+l,s+h),t.lineTo(n+c,s+h),t.lineTo(n,s+i);break;case"right":t.moveTo(n+a,s),t.lineTo(n-a,s-l),t.lineTo(n-a,s+l),t.lineTo(n+a,s);break;case"left":t.moveTo(n-a,s),t.lineTo(n+a,s-l),t.lineTo(n+a,s+l),t.lineTo(n-a,s)}t.closePath(),t.fill(),t.stroke()}},TradingView.ArrowShapeMarkRenderer.prototype.hitTest=function(t){var i,o,n,s,r,a,l,h=this._data.point.x,c=this._data.point.y,d=this._arrowDirection,p=1*this._data.size,u=p/2,f=1.1*p;switch(d){case"up":c-=f;break;case"down":c+=f}switch(i=p/6,o=p/4,n=p/3,u=p/2,s=.6666666*p,d){case"up":r=new e.Point(h,c),a=new e.Point(h+u,c+s),l=new e.Point(h-u,c+s);break;case"down":r=new e.Point(h,c+p),a=new e.Point(h+u,c+n),l=new e.Point(h-u,c+n);break;case"right":r=new e.Point(h+i,c),a=new e.Point(h-i,c-o),l=new e.Point(h-i,c+o);break;case"left":r=new e.Point(h-i,c),a=new e.Point(h+i,c-o),l=new e.Point(h+i,c+o)}return e.pointInTriangle(r,a,l,t)?new _(_.REGULAR):null},p.StudyPaneView_textmarks=function(t,e){this._study=t,this._model=e,this._data=[],this._textCache=[]},inherit(p.StudyPaneView_textmarks,u),p.StudyPaneView_textmarks.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_textmarks.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)switch(this._data[e].shape){case"triangle":t.append(new TradingView.TriangleTextMarkRenderer(this._data[e],this._textCache[e]));break;case"rectangle":t.append(new TradingView.RectangleTextMarkRenderer(this._data[e],this._textCache[e]))}return t},p.StudyPaneView_textmarks.prototype._updateViewInternal=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S;if(this._data=[],t=this._study.graphics().textmarks,t&&(i=this._study.priceScale(),o=this._model.timeScale(),i&&!i.isEmpty()&&o&&!o.isEmpty()))for(n=this._study.graphics().indexes,s=this._model.timeScale().visibleBars(),r=s.firstBar(),a=s.lastBar(),l=0;l<t.length;l++)if(h=t[l],h.data&&(c=this._study.properties().graphics.textmarks[h.styleId],c.visible.value()))for(d=h.data,p=0;p<d.length;p++)if(u=d[p],_={},f=c.location.value(),g=c.shape.value(),m=n[u.time],!(m<r||m>a)&&(v=this._study.series().bars().valueAt(m))){switch(m=n[u.time]+(u.offset||0),_.font=c.fontFamily.value(),_.color=TradingView.generateColor(c.color.value(),c.transparency.value()),_.bold=c.fontBold.value(),_.fontColor=TradingView.generateColor(c.fontColor.value(),c.transparency.value()),_.italic=c.fontItalic.value(),_.fontSize=c.fontSize.value(),_.text=u.text?u.text:"",_.halign=c.halign.value(),_.valign=void 0!==c.valign?c.valign.value():"middle",_.shape=c.shape.value(),_.size=.5*o.barSpacing(),_.borderColor="rgb(0, 0, 0)",y=50,g){case"triangle":S=this._calcCoordsForTriangleShape(f,m,y,u.price,i),_.direction=S.direction,b=Math.round(o.indexToCoordinate(m)),w=S.y;break;case"rectangle":S=this._calcCoordsForRectangleShape(f,m,u.price,i,o),b=S.x,w=S.y}_.point=new e.Point(b,w),this._data.push(_),this._textCache.push({})}},p.StudyPaneView_textmarks.prototype._calcCoordsForTriangleShape=function(t,e,i,o,n){var s,r,a;switch(t){case CanvasEx.MARKLOC_TOP:s=n.height()-i,r="down";break;case CanvasEx.MARKLOC_BOTTOM:s=i,r="up";break;case CanvasEx.MARKLOC_ABSOLUTEDOWN:n.isPercent()&&(a=this._study.firstValue(),o=n.priceRange().convertToPercent(o,a)),s=n.priceToCoordinate(o),r="down";break;case CanvasEx.MARKLOC_ABSOLUTEUP:n.isPercent()&&(a=this._study.firstValue(),o=n.priceRange().convertToPercent(o,a)),s=n.priceToCoordinate(o),r="up";break;case CanvasEx.MARKLOC_ABOVEBAR:s=this._locationToY(t,e),r="down";break;case CanvasEx.MARKLOC_BELOWBAR:s=this._locationToY(t,e),r="up";break;default:s=this._locationToY(t,e),r="up"}return{y:s,direction:r}},p.StudyPaneView_textmarks.prototype._calcCoordsForRectangleShape=function(t,e,i,o,n){var s,r,a=Math.round(n.indexToCoordinate(e));switch(t){case CanvasEx.MARKLOC_ABSOLUTEDOWN:case CanvasEx.MARKLOC_ABSOLUTEUP:case CanvasEx.MARKLOC_ABSOLUTE:o.isPercent()&&(r=this._study.firstValue(),i=o.priceRange().convertToPercent(i,r)),s=o.priceToCoordinate(i);break;case CanvasEx.MARKLOC_ABOVEBAR:s=this._locationToY(t,e);break;case CanvasEx.MARKLOC_BELOWBAR:s=this._locationToY(t,e);break;case CanvasEx.MARKLOC_RIGHT:a=n.width(),o.isPercent()&&(r=this._study.firstValue(),i=o.priceRange().convertToPercent(i,r)),s=o.priceToCoordinate(i);break;case CanvasEx.MARKLOC_LEFT:a=n.width(),o.isPercent()&&(r=this._study.firstValue(),i=o.priceRange().convertToPercent(i,r)),s=o.priceToCoordinate(i);break;default:s=this._locationToY(t,e)}return{x:a,y:s}},p.StudyPaneView_shapemarks=function(t,e){this._study=t,this._model=e,this._data=[],this._textCache=[]},inherit(p.StudyPaneView_shapemarks,u),p.StudyPaneView_shapemarks.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_shapemarks.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)switch(this._data[e].shape){case"circle":t.append(new TradingView.CircleShapeMarkRenderer(this._data[e],this._textCache[e]));break;case"square":t.append(new TradingView.SquareShapeMarkRenderer(this._data[e],this._textCache[e]));break;case"arrowUp":t.append(new TradingView.ArrowShapeMarkRenderer(this._data[e],this._textCache[e],"up"));break;case"arrowDown":t.append(new TradingView.ArrowShapeMarkRenderer(this._data[e],this._textCache[e],"down"));break;case"arrowRight":t.append(new TradingView.ArrowShapeMarkRenderer(this._data[e],this._textCache[e],"right"));break;case"arrowLeft":t.append(new TradingView.ArrowShapeMarkRenderer(this._data[e],this._textCache[e],"left"))}return t},p.StudyPaneView_shapemarks.prototype._updateViewInternal=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S;if(this._data=[],t=this._study.graphics().shapemarks,t&&(i=this._study.priceScale(),o=this._model.timeScale(),i&&!i.isEmpty()&&o&&!o.isEmpty()))for(n=this._study.graphics().indexes,s=this._model.timeScale().visibleBars(),r=s.firstBar(),a=s.lastBar(),l=0;l<t.length;l++)if(h=t[l],h.data&&(c=this._study.properties().graphics.shapemarks[h.styleId],c.visible.value()))for(d=h.data,p=0;p<d.length;p++)if(u=d[p],_=n[u.time],!(_<r||_>a)&&(f={},null!=u.time&&(g=this._study.series().bars().valueAt(_)))){switch(f.color=TradingView.generateColor(c.color.value(),c.transparency.value()),m=0,"left"===c.halign.value()?m-=o.barSpacing()/2+1:"right"===c.halign.value()&&(m+=o.barSpacing()/2+1),f.size=c.size.value(),f.shape=c.shape.value(),v=Math.round(o.indexToCoordinate(_))+m,y=u.price,i.isPercent()&&(b=this._study.firstValue(),y=i.priceRange().convertToPercent(y,b)),w=i.priceToCoordinate(y),S=c.location.value()){case CanvasEx.MARKLOC_ABSOLUTE:f.direction="";break;case CanvasEx.MARKLOC_ABSOLUTEDOWN:f.direction="down";break;case CanvasEx.MARKLOC_ABSOLUTEUP:f.direction="up";break;case CanvasEx.MARKLOC_ABOVEBAR:w=this._locationToY(S,_,Math.floor(2*f.size/o.barSpacing())+1),f.direction="up";break;case CanvasEx.MARKLOC_BELOWBAR:w=this._locationToY(S,_,Math.floor(2*f.size/o.barSpacing())+1),f.direction="down";break;default:TradingView.logWarn("Bad location value: "+S),w=this._locationToY(CanvasEx.MARKLOC_ABSOLUTEUP,_),f.direction="up"}f.point=new e.Point(v,w),this._data.push(f),this._textCache.push({})}},o.prototype.draw=function(t){},o.prototype.drawBackground=function(t){var e=this._data;m(t,e.x1,e.y1,e.x2-e.x1,e.y2-e.y1,TradingView.generateColor(this._data.color,this._data.transparency))},o.prototype.hitTest=function(t){return null},p.StudyPaneView_backgrounds=function(t,e){this._study=t,this._model=e,this._data=[]},p.StudyPaneView_backgrounds.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_backgrounds.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)t.append(new o(this._data[e]));return t},p.StudyPaneView_backgrounds.prototype._hideExtendedHours=function(t){return("inSession"===t||"outOfSession"===t)&&!this._study._series.properties().extendedHours.value()},p.StudyPaneView_backgrounds.prototype._updateViewInternal=function(){var t,e,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b;if(this._data=[],t=this._study.graphics().backgrounds,t&&(e=this._model.timeScale(),i=this._study.priceScale(),i&&!i.isEmpty()&&e&&!e.isEmpty()))for(o=this._study.graphics().indexes,n=this._model.timeScale().visibleBars(),s=n.firstBar(),r=n.lastBar(),a=0;a<t.length;a++)if(l=t[a],h=l.styleId,c=l.data,d=this._study.properties().graphics.backgrounds[h],!this._hideExtendedHours(h)&&d.visible.value())for(_=0;_<c.length;_++)f=c[_],g={},m=o[f.start],v=o[f.stop],v<s||m>r||null!=f.start&&null!=f.stop&&(y=Math.ceil(e.indexToCoordinate(m,!0)-.5*e.barSpacing()),b=Math.ceil(e.indexToCoordinate(v,!0)+.5*e.barSpacing()),u===m-1&&(y=p),p=b,u=v,y<0&&b<0||y>e.width()&&b>e.width()||(g.x1=y,g.x2=b,g.y1=0,g.y2=i.height(),g.color=d.color.value(),g.transparency=d.transparency.value(),this._data.push(g)))},p.StudyPaneView_polygons=function(t,e){this._study=t,this._model=e,this._data=[]},p.StudyPaneView_polygons.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_polygons.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)t.append(new d(this._data[e],new _(_.REGULAR)));return t},p.StudyPaneView_polygons.prototype._updateViewInternal=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T;if(this._data=[],t=this._study.graphics().polygons,t&&(i=this._study.priceScale(),o=this._study._model.timeScale(),i&&!i.isEmpty()&&o&&!o.isEmpty()))for(n=this._study.graphics().indexes,s=this._model.timeScale().visibleBars(),r=s.firstBar(),a=s.lastBar(),l=0;l<t.length;l++)if(h=t[l],h.data&&(c=this._study.properties().graphics.polygons[h.styleId],100!==c.transparency.value()))for(d=0;d<h.data.length;d++){for(p=h.data[d],u=1/0,_=-(1/0),f=0;p.points&&f<p.points.length;f++)g=n[p.points[f].index]+(p.points[f].offset||0),u=Math.min(u,g),_=Math.max(_,g);if(!(_<r||u>a)){for(m={},m.points=[],f=0;p.points&&f<p.points.length;f++)v=p.points[f],y=o.indexToCoordinate(n[v.index]+(v.offset||0)),b=v.level,i.isPercent()&&(w=this._study.firstValue(),b=i.priceRange().convertToPercent(b,w)),S=i.priceToCoordinate(b),T=new e.Point(y,S),T.data=f,m.points.push(T);m.color=c.color.value(),m.backcolor=c.color.value(),m.linewidth=void 0!==c.showBorder&&c.showBorder.value()?1:0,m.linestyle=CanvasEx.LINESTYLE_SOLID,m.filled=!0,m.fillBackground=!0,
m.transparency=c.transparency.value(),m.mouseTouchable=c.mouseTouchable.value(),this._data.push(m)}}},p.StudyPaneView_trendchannels=function(t,e){this._study=t,this._model=e,this._data=[]},p.StudyPaneView_trendchannels.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_trendchannels.prototype.renderer=function(){var t,e;for(this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f,e=0;e<this._data.length;e++)t.append(new d(this._data[e],new _(_.REGULAR)));return t},p.StudyPaneView_trendchannels.prototype._convertToYCoord=function(t){var e=this._study.priceScale(),i=this._study.firstValue();return e.isPercent()&&(t=e.priceRange().convertToPercent(t,i)),e.priceToCoordinate(t)},p.StudyPaneView_trendchannels.prototype._updateViewInternal=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I;if(this._data=[],t=this._study.graphics().trendchannels,t&&(i=this._study.priceScale(),o=this._study._model.timeScale(),i&&!i.isEmpty()&&o&&!o.isEmpty()))for(n=function(t,i,o,n,s,r){var a,l,h=new e.Point(0,0),c=new e.Point(o,n);return s&&(a=t.substract(i),l=e.intersectRayWithRect(t,t.add(a),h,c),l?t=l:i.x=o),r&&(a=i.substract(t),l=e.intersectRayWithRect(i,i.add(a),h,c),l?i=l:i.x=o),[t,i]},s=this._study.graphics().indexes,r=this._model.timeScale().visibleBars(),a=r.firstBar(),l=r.lastBar(),h=0;h<t.length;h++)if(c=t[h],c.data)for(d=this._study.properties().graphics.trendchannels[c.styleId],p=0;p<c.data.length;p++)u=c.data[p],_=s[u.startIndex],f=s[u.endIndex],Math.max(_,f)<a&&!u.extendRight||Math.min(_,f)>l&&!u.extendLeft||(g=this._convertToYCoord(u.startHighPrice),m=this._convertToYCoord(u.startLowPrice),v=this._convertToYCoord(u.endHighPrice),y=g-m,b=v-y,w=o.indexToCoordinate(_),S=o.indexToCoordinate(f),T=new e.Point(w,g),C=new e.Point(w,m),x=new e.Point(S,v),P=new e.Point(S,b),L=n(T,x,o.width(),i.height(),u.extendLeft,u.extendRight),k=n(C,P,o.width(),i.height(),u.extendLeft,u.extendRight),T=L[0],x=L[1],C=k[0],P=k[1],E={},E.points=[T,C,P,x],E.color=d.color.value(),E.backcolor=d.color.value(),E.linewidth=void 0!==d.borderWidth?d.borderWidth.value():0,E.linestyle=CanvasEx.LINESTYLE_SOLID,E.filled=!0,E.fillBackground=!0,u.transparency?(I=u.transparency+d.transparency.value(),E.transparency=Math.min(I,100)):E.transparency=d.transparency.value(),E.mouseTouchable=!0,this._data.push(E))},p.StudyPaneView_hhists=function(t,e){this._study=t,this._model=e,this._data=[],this._textData=[],this._textRendererCache={}},p.StudyPaneView_hhists.prototype.update=function(){this._invalidated=!0},p.StudyPaneView_hhists.prototype.renderer=function(){var t,e;this._invalidated&&(this._updateViewInternal(),this._invalidated=!1),t=new f;for(e in this._data)t.append(new n(this._data[e]));for(e=0;e<this._textData.length;e++)t.append(new r(this._textData[e],this._textRendererCache,new _(_.REGULAR)));return t},p.StudyPaneView_hhists.prototype._updateViewInternal=function(){var t,e,i,o,n,s,r,a,l,h,c,d,p,u,_,f;if(this._data=[],this._textData=[],t=this._study.priceScale(),e=this._model.timeScale(),t&&!t.isEmpty()&&e&&!e.isEmpty()&&(i=this._study.graphics().hhists))for(o=this._study.graphics().indexes,n=this._model.timeScale().visibleBars(),s=n.firstBar(),r=n.lastBar(),a=0;a<i.length;a++)if(l=i[a],h=this._study.properties().graphics.hhists[l.styleId],h.visible.value()){c=l.dataObj;for(d in c){for(p=c[d],u=1/0,_=-(1/0),f=p.length;f--;)u=Math.min(u,o[p[f].firstBarTime]),_=Math.max(_,o[p[f].lastBarTime]);_<s||u>r||this._updateDataForRenderers(p,h,t,e,o)}}},p.StudyPaneView_hhists.prototype._updateDataForRenderers=function(t,o,n,s,r){var a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I=[],A=this._findMaxRate(t),V=null,$=null,M=null,D={},O=i(150).shiftColor,B=function(t,e,i){if(i===CanvasEx.HHISTDIR_LEFTTORIGHT)return t+e;if(i===CanvasEx.HHISTDIR_RIGHTTOLEFT)return e+t;throw Error("Unknown direction value: "+i)};for(p=0;p<t.length;p++)for(u=t[p],null==$&&($=this._findActualRateLength(u.rate)),null==V&&(_=Math.abs(s.indexToCoordinate(r[u.firstBarTime])-s.indexToCoordinate(r[u.lastBarTime])),V=o.percentWidth.value()*_/100,V-=$,V=Math.max(V,0)),f=!1,v=0;v<$;v++)if(0!==u.rate[v]){if(void 0===D[v]?D[v]=u.rate[v]:D[v]+=u.rate[v],n.isPercent()?(y=this._study.firstValue(),a=n.priceRange().convertToPercent(u.priceHigh,y),l=n.priceRange().convertToPercent(u.priceLow,y)):(a=u.priceHigh,l=u.priceLow),b={},b.y1=n.priceToCoordinate(a)+1,b.y2=n.priceToCoordinate(l)-1,0===p&&(g=b.y2,m=b.y2-b.y1),w=o.location.value(),S=o.direction.value(),w===CanvasEx.HHISTLOC_ABSOLUTE&&S===CanvasEx.HHISTDIR_LEFTTORIGHT)c=s.indexToCoordinate(r[u.firstBarTime]),h=1,d="left";else if(w===CanvasEx.HHISTLOC_ABSOLUTE&&S===CanvasEx.HHISTDIR_RIGHTTOLEFT)c=s.indexToCoordinate(r[u.lastBarTime]),h=-1,d="right";else if(w===CanvasEx.HHISTLOC_RELATIVE&&S===CanvasEx.HHISTDIR_LEFTTORIGHT)c=0,h=1,d="left";else{if(w!==CanvasEx.HHISTLOC_RELATIVE||S!==CanvasEx.HHISTDIR_RIGHTTOLEFT)throw Error("Unknown location/direction values: "+w+"/"+S);c=s.width(),h=-1,d="right"}if(0===v?b.x1=c:b.x1=c+h*(V*u.rate[v-1]/A+$),b.x2=b.x1+h*(V*u.rate[v]/A),b.colorBg=o.colors[v].value(),b.transparency=o.transparencies[v].value(),b.blendedColor=TradingView.generateColor(b.colorBg,b.transparency),b.x0=c,I.push(b),M||(M=.6*(b.y2-b.y1)),!f&&o.showValues.value()&&M>=7.5){for(f=!0,T={},C=this._study.formatter(),T.text="",x=0;x<$;x++)T.text=B(T.text,C.format(u.rate[x]),S),x!==$-1&&(T.text=B(T.text,"x",S));if(T.color=o.valuesColor.value(),T.font="arial",T.fontsize=M,T.horzAlign=d,T.vertAlign="middle",P=new e.Point(c+3*h,b.y2-.61*(b.y2-b.y1)),T.points=[P],T.offsetX=0,T.offsetY=0,this._textData.push(T),p===t.length-1){for(L=c+3*h,k=g+.39*m,E={text:"",color:O(o.valuesColor.value(),1.5),font:"arial",fontsize:M,horzAlign:d,vertAlign:"middle",points:[new e.Point(L,k)],offsetX:0,offsetY:0},x=0;x<$;x++)E.text=B(E.text,C.format(D[x]),S),x!==$-1&&(E.text=B(E.text,"x",S));this._textData.push(E)}}}I.length>0&&this._data.push(I)},p.StudyPaneView_hhists.prototype._findMaxRate=function(t){var e,i,o=0,n=0;for(e=0;e<t.length;e++){for(n=0,i=0;i<t[e].rate.length;i++)n+=t[e].rate[i];o=Math.max(o,n)}return o},p.StudyPaneView_hhists.prototype._findActualRateLength=function(t){var e,i,o=0;for(e=0;e<t.length&&(i=t[e],null!==i&&void 0!==i);++e)o++;return o},n.prototype.hitTest=function(t){var e,i,o=s(this._data,t.y);return o<0?null:(e=Math.min(this._data[o].x0,this._data[o].x2),i=Math.max(this._data[o].x0,this._data[o].x2),e<=t.x&&t.x<=i?new _(_.REGULAR):null)},n.prototype.draw=function(t){var e,i,o,n,s,r,a;for(t.save(),e={},i=[],n=0;n<this._data.length;n++)s=this._data[n],e[s.blendedColor]?e[s.blendedColor].push(s):(i.push(s.blendedColor),e[s.blendedColor]=[s]);for(r=0;r<i.length;r++){for(a=i[r],t.fillStyle=a,t.strokeStyle=a,t.beginPath(),o=e[a],n=0;n<o.length;n++)s=o[n],t.rect(s.x1,s.y1,s.x2-s.x1,s.y2-s.y1);t.stroke(),t.fill()}t.restore()},t.exports=p}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e,i){this._data=t,this._hittest=e||new r(r.MOVEPOINT),this._backHittest=i||new r(r.MOVEPOINT_BACKGROUND),this._points=t.points}var n=i(74).LineDataSource,s=i(131).TrendLineRenderer,r=i(94);o.prototype.draw=function(t){var e,i,o;if(0!==this._points.length){for(t.beginPath(),t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,e=this._points[0],t.moveTo(e.x,e.y),i=0;i<this._points.length;i++)o=this._points[i],t.lineTo(o.x,o.y);this._data.filled&&this._data.fillBackground&&(t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),t.fill()),this._data.filled&&!this._data.skipClosePath&&t.closePath(),this._data.linewidth>0&&t.stroke(),this._points.length>1&&(this._data.leftend===n.LINEEND_ARROW&&s.prototype.drawArrow(this._points[1],this._points[0],t,t.lineWidth),this._data.rightend===n.LINEEND_ARROW&&s.prototype.drawArrow(this._points[this._points.length-2],this._points[this._points.length-1],t,t.lineWidth))}},o.prototype.hitTest=function(t){var i,o,n,s,r;if(void 0!==this._data.mouseTouchable&&!this._data.mouseTouchable)return null;for(i=TradingView.isMobile.any()?24:3,o=1;o<this._points.length;o++)if(n=this._points[o-1],s=this._points[o],r=e.distanceToSegment(n,s,t),r.distance<=i)return this._hittest;return this._data.filled&&this._data.fillBackground&&this._points.length>0&&(n=this._points[0],s=this._points[this._points.length-1],r=e.distanceToSegment(n,s,t),r.distance<=i)?this._hittest:this._data.filled&&this._data.fillBackground&&e.isInPolygon(this._data.points,t)?this._backHittest:null},t.exports=o}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function i(){}i.prototype._locationToY=function(t,i,o){var n,s,r,a,l,h,c;switch(o||(o=0),n=[],s=this._study.priceScale(),t){case CanvasEx.MARKLOC_ABOVEBAR:r=TradingView.HIGH_PLOT;break;case CanvasEx.MARKLOC_BELOWBAR:r=TradingView.LOW_PLOT}for(a=this._study.firstValue(),o>=1&&(o-=1),l=-o;l<=o;l++)h=this._study.series().bars().valueAt(i+l),h&&(c=h[r],s.isPercent()&&(c=s.priceRange().convertToPercent(c,a)),n.push(s.priceToCoordinate(c)));switch(t){case CanvasEx.MARKLOC_ABOVEBAR:return e.min(n)-15;case CanvasEx.MARKLOC_BELOWBAR:return e.max(n)+15}},t.exports=i}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e,i){var o=this._mtpStudyId()+"@mtp-mtpredictor",n=i||p.findStudyMetaInfo(t.studiesMetaData(),o),r=e||l(n,null,null,t.studyVersioning()),a=TradingView.Study.lineToolNameForPointsBasedStudy(o);s.call(this,t,this.createPaneViews(t),r,a),this._doNotNeedLine=!0,this._turnaroundCounter=0,this._nextTurnaround(),this._metaInfo=n,this._graphics=new c(n),this._formatter=new d}var n=i(145),s=n.StudyLineDataSource,r=n.StudyLineDataSourcePaneView,a=i(150),l=a.prepareStudyProperties,h=i(74).LineDataSource,c=i(147),d=i(82).VolumeFormatter,p=i(114);inherit(o,s),o.prototype.series=function(){return TradingView.isInherited(this._ownerSource.constructor,TradingView.Series)?this._ownerSource:this._ownerSource.series()},o.prototype.calcIsActualSymbol=function(){return h.prototype.calcIsActualSymbol.call(this)},o.prototype._nextTurnaround=function(){this._turnaround=this._mtpStudyId()+"_"+ ++this._turnaroundCounter},o.prototype.createPaneViews=function(t){return[new r(this,t),new TradingView.Study.StudyPaneView_textmarks(this,t),new TradingView.Study.StudyPaneView_polygons(this,t),new TradingView.Study.StudyPaneView_lines(this,t)]},o.prototype.onData=function(t){if("data_update"===t.method&&t.params.customId==="pointset_"+this._currentPointsetId)h.prototype.onData.call(this,t),this._points.length===this.pointsCount()&&this._requestStudy();else if("data_update"===t.method&&t.params.customId===this._studyId){if(!this._checkTurnaround(t.params.turnaround))return;t.params.nonseries.d=TradingView.Study.prototype._makeJSONForNSData.call(this,t),""!==t.params.nonseries.d&&this._graphics.process(t.params.nonseries),t.params.nonseries.indexes.length>0&&(this._indexes=t.params.nonseries.indexes),this.updateAllViews(),this._model.updateSource(this)}},o.prototype._requestStudy=function(){var t=this,e=function(e){t.onData(e)},i=this._studyInputs();i&&(this._studyId?(this._nextTurnaround(),this._model.chartApi().modifyStudy(this._studyId,this._turnaround,i,e)):(this._studyId=TradingView.Study.makeNextStudyId(),this._model.chartApi().createStudy(this._studyId,this._turnaround,this._model.mainSeries()._seriesId,this._metaInfo.id+"-1!",i,e)))},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._invalidated=!0}function n(t,e){this._constructor="LineToolBarsPattern";var i=e||new _("linetoolbarspattern");r.call(this,t,new o(this,t),i),i.mirrored.listeners().subscribe(this,n.prototype.mirror),i.flipped.listeners().subscribe(this,n.prototype.flip),i.addExclusion("mirrored"),i.addExclusion("flipped"),this._scaleCoeff=1,this.version=n.version,this._pattern=[],this._properties.mode.listeners().subscribe(this,n.prototype.onModeChanged)}var s=i(103),r=i(74).LineDataSource,a=i(146).VertLineRenderer,l=i(129).RectangleRenderer,h=i(131).TrendLineRenderer,c=i(141).Action,d=i(94),p=i(95).PaneRendererLine,u=i(98),_=i(80).DefaultProperty;inherit(o,s),o.prototype.renderer=function(){var t,i,o,s,c,_,f,g,m,v,y,b,w,S,T,C,x,P,L;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._pattern&&2===this._source.points().length){if(t=this._source.points()[0].index,i=this._source.points()[1].index,o=t<i?this._points[0]:this._points[1],!o)return new u;if(s=parseInt(this._source.properties().mode.value(),10),c=Math.abs((this._points[0].x-this._points[1].x)/(this._pattern.length-1)),s===n.BARS_MODE||s===n.OPENCLOSE_MODE){for(_=new u,f=s===n.BARS_MODE?["high","low"]:["open","close"],g=f[0],m=f[1],v=0;v<this._pattern.length;v++)y=Math.round(o.x+v*c+.5),b=o.y+Math.round(this._pattern[v][g]),w=o.y+Math.round(this._pattern[v][m]),S={},S.points=[new e.Point(y-1,b),new e.Point(y+1,w)],S.color=this._source.properties().color.value(),S.linewidth=1,S.backcolor=this._source.properties().color.value(),S.fillBackground=!0,S.transparency=10,_.append(new l(S));return this.isAnchorsRequired()&&_.append(this.createLineAnchor({points:this._points})),_}return _=new u,S={},S.barSpacing=c,S.items=this._pattern,S.histogramBase=0,S.lineIndex=0,S.lineColor=TradingView.generateColor(this._source.properties().color.value(),10),S.lineStyle=CanvasEx.LINESTYLE_SOLID,S.lineWidth=2,S.hittest=new d(d.MOVEPOINT),_.append(new p(S)),this.isAnchorsRequired()&&_.append(this.createLineAnchor({points:this._points})),_}return _=new u,this._points.length<2?_:(T=this._points[0],C=this._points[1],x={},x.points=[T],x.color="#808080",x.linewidth=1,x.linestyle=CanvasEx.LINESTYLE_SOLID,_.append(new a(x)),P={},P.points=[C],P.color="#808080",P.linewidth=1,P.linestyle=CanvasEx.LINESTYLE_SOLID,_.append(new a(P)),L={points:[T,C],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},_.append(new h(L)),_)},o.prototype.update=function(){s.prototype.update.call(this),this._invalidated=!0},o.prototype.updateImpl=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g;!this._source.priceScale()||this._source.priceScale().isEmpty()||this._points.length<2||(this._source._pattern&&this._source._pattern.length>0&&2===this._source.points().length?(t=this._source.priceScale(),i=this._source.firstPatternPrice(),o=this._source.pressCoeff(),t=this._source.priceScale(),n=this._source.ownerSource().firstValue(),s=t.priceRange(),t.isPercent()?(a=s.convertToPercent(i,n),r=t.priceToCoordinate(a)):r=t.priceToCoordinate(i),l=function(e){var a,l=(e-i)*o+i;return t.isPercent()&&(l=s.convertToPercent(l,n)),a=t.priceToCoordinate(l)-r},h=parseInt(this._source.properties().mode.value()),c=this._source.points()[0].index,d=this._source.points()[1].index,p=c>d?1:0,u=this._points[p],_=u.x,f=Math.abs((this._points[0].x-this._points[1].x)/(this._source._pattern.length-1)),g={0:function(t){return{high:l(t[TradingView.HIGH_PLOT]),low:l(t[TradingView.LOW_PLOT])}},1:function(t,i){return new e.Point(_+i*f,l(t[TradingView.CLOSE_PLOT])+u.y)},2:function(t){return{open:l(t[TradingView.OPEN_PLOT]),close:l(t[TradingView.CLOSE_PLOT])}},3:function(t,i){return new e.Point(_+i*f,l(t[TradingView.OPEN_PLOT])+u.y)},4:function(t,i){return new e.Point(_+i*f,l(t[TradingView.HIGH_PLOT])+u.y)},5:function(t,i){return new e.Point(_+i*f,l(t[TradingView.LOW_PLOT])+u.y)},6:function(t,i){return new e.Point(_+i*f,l((t[TradingView.HIGH_PLOT]+t[TradingView.LOW_PLOT])/2)+u.y)}},this._pattern=this._source._pattern.map(g[h])):delete this._pattern)},inherit(n,r),n.version=2,n.BARS_MODE=0,n.LINE_MODE=1,n.OPENCLOSE_MODE=2,n.LINEOPEN_MODE=3,n.LINEHIGH_MODE=4,n.LINELOW_MODE=5,n.LINEHL2_MODE=6,n.prototype.onModeChanged=function(){var t=this.patternPriceDiff();t*=this._pressCoeff,this._points[1].price=this._timePoint[1].price=this._points[0].price+t},n.prototype.additionalActions=function(t){var e,i,o=new c({checked:this.properties().mirrored.value(),checkable:!0,text:$.t("Mirrored"),callbackContext:{target:this}}),n=new c({checked:this.properties().flipped.value(),checkable:!0,text:$.t("Flipped"),callbackContext:{target:this}});return o.callbacks().subscribe(null,function(e){var i=e.callbackContext(),o=i.target;t.setProperty(o.properties().mirrored,!o.properties().mirrored.value(),"Bats Pattern Mirroring"),o.updateAllViews(),o._model.updateSource(o)}),n.callbacks().subscribe(null,function(e){var i=e.callbackContext(),o=i.target;t.setProperty(o.properties().flipped,!o.properties().flipped.value(),"Bats Pattern Flipping"),o.updateAllViews(),o._model.updateSource(o)}),e=new c({checkable:!0,text:$.t("Restore Size")}),i=this,e.callbacks().subscribe(null,function(e){var o=i.points()[0],n=i.patternPriceDiff(),s=o.price+n,r=o.index+i._pattern.length-1;t.startChangingLinetool(i,{price:s,index:r},1,{}),t.changeLinePoint({price:s,index:r},{}),t.endChangingLinetool()}),[o,n,e]},n.prototype.pointsCount=function(){return 2},n.prototype.state=function(t){var e=r.prototype.state.call(this,t);return e.pattern=this._pattern,e},n.prototype.restoreData=function(t){t.pattern&&(this._pattern=t.pattern)},n.prototype.title=function(){return"Bars Pattern"},n.prototype.cloneData=function(t){this._pattern=TradingView.clone(t._pattern)},n.prototype.mirror=function(){var t,e,i,o,n,s=this._pattern,r=s[0][TradingView.HIGH_PLOT],a=Math.min(s[0][TradingView.LOW_PLOT],s[0][TradingView.HIGH_PLOT]),l=Math.max(s[0][TradingView.LOW_PLOT],s[0][TradingView.HIGH_PLOT]);for(t=1;t<s.length;t++)a=Math.min(a,s[t][TradingView.LOW_PLOT]),l=Math.max(l,s[t][TradingView.HIGH_PLOT]);if(a<l)for(e=(a+l)/2,i=function(t){var i=t-e,o=e-i;return o},t=0;t<s.length;t++)s[t][TradingView.HIGH_PLOT]=i(s[t][TradingView.HIGH_PLOT]),s[t][TradingView.LOW_PLOT]=i(s[t][TradingView.LOW_PLOT]),s[t][TradingView.OPEN_PLOT]=i(s[t][TradingView.OPEN_PLOT]),s[t][TradingView.CLOSE_PLOT]=i(s[t][TradingView.CLOSE_PLOT]);o=s[0][TradingView.HIGH_PLOT]-r,n=s[s.length-1][TradingView.LOW_PLOT]-s[0][TradingView.HIGH_PLOT],this._points[0].price+=o,this._points[1].price=this._points[0].price+n,this.updateAllViews()},n.prototype.flip=function(){var t,e,i;for(this._points[0].price=this._points[1].price,t=0;t<this._pattern.length/2;t++)e=this._pattern[t],this._pattern[t]=this._pattern[this._pattern.length-t-1],this._pattern[this._pattern.length-t-1]=e;i=this._pattern[this._pattern.length-1][TradingView.LOW_PLOT]-this._pattern[0][TradingView.HIGH_PLOT],this._points[1].price=this._points[0].price+i,this.updateAllViews()},n.prototype.firstPatternPrice=function(){var t,e,i,o=parseInt(this.properties().mode.value(),10);return o===n.LINEHL2_MODE?t=(this._pattern[0][TradingView.HIGH_PLOT]+this._pattern[0][TradingView.LOW_PLOT])/2:(e={0:TradingView.HIGH_PLOT,1:TradingView.CLOSE_PLOT,2:TradingView.OPEN_PLOT,3:TradingView.OPEN_PLOT,4:TradingView.HIGH_PLOT,5:TradingView.LOW_PLOT},i=e[o],t=this._pattern[0][i])},n.prototype.lastPatternPrice=function(){var t,e,i,o=parseInt(this.properties().mode.value(),10);return o===n.LINEHL2_MODE?t=(this._pattern[this._pattern.length-1][TradingView.HIGH_PLOT]+this._pattern[this._pattern.length-1][TradingView.LOW_PLOT])/2:(e={0:TradingView.LOW_PLOT,1:TradingView.CLOSE_PLOT,2:TradingView.CLOSE_PLOT,3:TradingView.OPEN_PLOT,4:TradingView.HIGH_PLOT,5:TradingView.LOW_PLOT},i=e[o],t=this._pattern[this._pattern.length-1][i])},n.prototype.patternPriceDiff=function(){return this.lastPatternPrice()-this.firstPatternPrice()},n.prototype.pressCoeff=function(){var t=this.patternPriceDiff(),e=this.points()[0].price,i=this.points()[1].price,o=i-e,n=o/t;return this._pressCoeff=n,n},n.prototype.addPoint=function(t,e){var i,o,s,a,l,h,c,d,p,u,_=this._model.mainSeries(),f=_.nearestIndex(t.index,TradingView.SEARCH_NEAREST_RIGHT);if(this.properties().mode.value()===n.BARS_MODE?t.price=_.bars().valueAt(f)[TradingView.HIGH_PLOT]:t.price=_.bars().valueAt(f)[TradingView.CLOSE_PLOT],i=this.priceScale().priceRange().length(),t.price+=.05*i,o=_.priceScale(),o.isPercent()&&(s=_.firstValue(),t.price=o.priceRange().convertToPercent(t.price,s)),a=r.prototype.addPoint.call(this,t,e,!0)){for(l=Math.min(this.points()[0].index,this.points()[1].index),h=Math.max(this.points()[0].index,this.points()[1].index),f=this._model.mainSeries().nearestIndex(l,TradingView.SEARCH_NEAREST_RIGHT),c=this._model.mainSeries().nearestIndex(h,TradingView.SEARCH_NEAREST_LEFT),this.points()[0].index>this.points()[1].index&&(this._points[0].price=this._points[1].price),this._pattern=[],d=f;d<=c;d++)p=this._model.mainSeries().data().valueAt(d),this._pattern.push(TradingView.clone(p));this._pattern.length>0&&(u=this.patternPriceDiff(),this._points[1].price=this._points[0].price+u,this._points[1].index=this._points[0].index+(c-f),this.normalizePoints(),this.createServerPoints())}return a},n.prototype.setPoint=function(t,e,i){var o=this._points[0].price-this._points[1].price;1===t&&e.index<=this._points[0].index&&(e.index=this._points[0].index+1),0===t&&e.index>=this._points[1].index&&(e.index=this._points[1].index-1),r.prototype.setPoint.call(this,t,e,i),1===t?this._points[0].price=this._points[1].price+o:this._points[1].price=this._points[0].price-o},n.prototype.migrateVersion=function(t,e,i){if(1===t&&this._pattern.length>0){var o=this.patternPriceDiff();2===this._timePoint.length&&(this._timePoint[1].price=this._timePoint[0].price+o),2===this._points.length&&(this._points[1].price=this._points[0].price+o)}},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){r.call(this,t,e),this._rendererCache={},this._invalidated=!0}function n(t,e){this._constructor="LineToolTrendBasedFibTime";var i=e||new this.createPropertiesObject("linetooltrendbasedfibtime");a.call(this,t,new o(this,t),i),this.version=n.version}var s=i(146).VertLineRenderer,r=i(103),a=i(74).LineDataSource,l=i(127),h=i(104).TextRenderer,c=i(129).RectangleTransparencyRenderer,d=i(131).TrendLineRenderer,p=i(94),u=i(98);inherit(o,r),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n,s,a,l,h,c,d,p,u,_,f;if(r.prototype.update.call(this),!(this._source.points().length<3)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty()&&(t=this._source.points()[0],e=this._source.points()[1],i=this._source.points()[2],this._levels=[],e.index!==t.index&&(o=e.index-t.index,n=this._source.properties(),s=i.index,a=this._model.timeScale().visibleBars(),!a.isEmpty())))for(l=1;l<=11;l++)h="level"+l,c=n[h],c.visible.value()&&(d=c.coeff.value(),p=c.color.value(),u=Math.round(s+d*o),_=this._model.timeScale().indexToCoordinate(u),f={x:_,coeff:d,color:p,linewidth:c.linewidth.value(),linestyle:c.linestyle.value(),index:l},n.showCoeffs.value()&&(f.text=d,f.y=this._source.priceScale().height()),this._levels.push(f))},o.prototype.renderer=function(){var t,i,o,n,r,l,_,f,g,m,v,y,b,w,S,T,C,x;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new u,this._points.length<2)return t;if(i=this._points[0],o=this._points[1],n=this._source.properties(),n.trendline.visible.value()&&(r={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:n.trendline.color.value(),linewidth:n.trendline.linewidth.value(),linestyle:n.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},t.append(new d(r))),this._points.length<3)return this.addAnchors(t),t;for(l=this._points[2],n.trendline.visible.value()&&(r={points:[o,l],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:n.trendline.color.value(),linewidth:n.trendline.linewidth.value(),linestyle:n.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},t.append(new d(r))),_=n.fillBackground.value(),f=n.transparency.value(),g=0;g<this._levels.length;g++){if(g>0&&_&&(m=this._levels[g-1],i=new e.Point(m.x,0),o=new e.Point(this._levels[g].x,this._source.priceScale().height()),v={},v.points=[i,o],v.color=this._levels[g].color,v.linewidth=0,v.backcolor=this._levels[g].color,v.fillBackground=!0,v.transparency=f,t.append(new c(v))),void 0!==this._levels[g].text){switch(S=n.horzLabelsAlign.value(),S="left"===S?"right":"right"===S?"left":"center"){case"left":b=3;break;case"center":b=0;break;case"right":b=-3}switch(n.vertLabelsAlign.value()){case"top":y=new e.Point(this._levels[g].x,0),w=5;break;case"middle":y=new e.Point(this._levels[g].x,.5*this._levels[g].y),w=0;break;case"bottom":y=new e.Point(this._levels[g].x,this._levels[g].y),w=-10}T={points:[y],text:""+this._levels[g].text,color:this._levels[g].color,vertAlign:"middle",horzAlign:S,font:n.font.value(),offsetX:b,offsetY:w,fontsize:12},t.append(new h(T,this._rendererCache))}C={},C.points=[new e.Point(this._levels[g].x,0)],C.color=this._levels[g].color,C.linewidth=this._levels[g].linewidth,C.linestyle=this._levels[g].linestyle,x=new p(p.MOVEPOINT,null,this._levels[g].index),t.append(new s(C,x))}return this.addAnchors(t),t},inherit(n,a),n.version=1,n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Trend-Based Fib Time"},n.prototype.migrateVersion=function(t,e,i){},n.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},n.prototype.createPropertiesObject=function(t,e,i){return new l(t,e,i,{range:[1,11]})},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._levels=[],this._rendererCache={},this._invalidated=!0}function n(t,e){this._constructor="LineToolFibTimeZone";var i=e||this.createPropertiesObject("linetoolfibtimezone");r.call(this,t,new o(this,t),i),this.version=n.version}var s=i(103),r=i(74).LineDataSource,a=i(146).VertLineRenderer,l=i(127),h=i(104).TextRenderer,c=i(129).RectangleTransparencyRenderer,d=i(131).TrendLineRenderer,p=i(94),u=i(98);inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n,r,a,l,h,c,d;if(s.prototype.update.call(this),!(this._source.points().length<1)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty()&&(t=this._source.points()[0],2===this._source.points().length&&(e=this._source.points()[1]),i=this._source.properties(),o=this._source.points()[0].index,n=this._model.timeScale().visibleBars(),!n.isEmpty()))for(this._levels=[],r=e?e.index-t.index:1,a=1;a<=11;a++)l=i["level"+a],l.visible.value()&&(h=Math.round(o+l.coeff.value()*r),c=this._model.timeScale().indexToCoordinate(h),d={index:a,x:c,color:l.color.value(),width:l.linewidth.value(),style:l.linestyle.value()},i.showLabels.value()&&(d.text=l.coeff.value(),d.y=this._source.priceScale().height()),this._levels.push(d))},o.prototype.renderer=function(){var t,i,o,n,s,l,_,f,g,m,v,y,b,w,S;for(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new u,i=this._source.properties(),o=0;o<this._levels.length;o++)if(n={},n.points=[new e.Point(this._levels[o].x,0)],n.color=this._levels[o].color,n.linewidth=this._levels[o].width,n.linestyle=this._levels[o].style,s=new p(p.MOVEPOINT,null,this._levels[o].index),t.append(new a(n,s)),o>0&&i.fillBackground.value()&&(l=this._levels[o-1],_=new e.Point(this._levels[o].x,0),f=new e.Point(l.x,this._source.priceScale().height()),g={},g.points=[_,f],g.color=this._levels[o].color,g.linewidth=0,g.backcolor=this._levels[o].color,g.fillBackground=!0,g.transparency=i.transparency.value(),t.append(new c(g))),void 0!==this._levels[o].text){switch(b=i.horzLabelsAlign.value(),b="left"===b?"right":"right"===b?"left":"center"){case"left":v=3;break;case"center":v=0;break;case"right":v=-3}switch(i.vertLabelsAlign.value()){case"top":m=new e.Point(this._levels[o].x,0),y=5;break;case"middle":m=new e.Point(this._levels[o].x,.5*this._levels[o].y),y=0;break;case"bottom":m=new e.Point(this._levels[o].x,this._levels[o].y),y=-10}w={points:[m],text:""+this._levels[o].text,color:n.color,vertAlign:"middle",horzAlign:b,font:i.font.value(),offsetX:v,offsetY:y,fontsize:12},t.append(new h(w,this._rendererCache))}return 2===this._points.length&&(S={points:[this._points[0],this._points[1]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:i.trendline.color.value(),linewidth:i.trendline.linewidth.value(),linestyle:i.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},t.append(new d(S))),this.isAnchorsRequired()&&(2===this._source.points().length?t.append(this.createLineAnchor({points:this._points})):this._points.length>0&&t.append(this.createLineAnchor({points:[new e.Point(this._points[0].x,this._source.priceScale().height()/2)],hittestResult:p.MOVEPOINT}))),t},inherit(n,r),n.version=2,n.prototype.migrateVersion=function(t,e,i){var o;if(1===t){for(i.properties.level1.color.setValue(i.properties.baselinecolor.value()),o=2;o<=11;o++)i.properties["level"+o].color.setValue(i.properties.linecolor.value());for(o=1;o<=11;o++)i.properties["level"+o].linewidth.setValue(i.properties.linewidth.value()),i.properties["level"+o].linestyle.setValue(i.properties.linestyle.value())}},n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Fib Time Zone"},n.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},n.prototype.createPropertiesObject=function(t,e,i){return new l(t,e,i,{range:[1,11]})},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._lines=[],this._invalidated=!0}function n(t,e){this._constructor="LineToolCircleLines";var i=e||new d("linetoolcirclelines");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(146).VertLineRenderer,l=i(131).TrendLineRenderer,h=i(94),c=i(98),d=i(80).DefaultProperty;inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n,r,a;if(s.prototype.update.call(this),!(this._source.points().length<2)&&(t=this._model.timeScale(),this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!t.isEmpty()&&(e=this._source.points()[0],i=this._source.points()[1],o=i?i.index-e.index:1,this._lines=[],0!==o)))if(n=t.visibleBars(),o>0)for(r=e.index,a=r;a<=n.lastBar();a+=o)this._lines.push({x:t.indexToCoordinate(a)});else for(r=e.index,a=r;a>=n.firstBar();a+=o)this._lines.push({x:t.indexToCoordinate(a)})},o.prototype.renderer=function(){var t,i,o,n,s,d,p,u;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new c,this._points.length<2)return t;for(i=this._points[0],o=this._points[1],n=this._source.properties(),s={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:n.trendline.color.value(),linewidth:n.trendline.linewidth.value(),linestyle:n.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},t.append(new l(s)),n=this._source.properties(),d=0;d<this._lines.length;d++)p={points:[new e.Point(this._lines[d].x,0)],color:n.linecolor.value(),linewidth:n.linewidth.value(),linestyle:n.linestyle.value()},t.append(new a(p));return this.isAnchorsRequired()&&(2===this._source.points().length?(u=[].concat(this._points),t.append(this.createLineAnchor({points:u}))):t.append(this.createLineAnchor({points:[new e.Point(this._points[0].x,this._source.priceScale().height()/2)],hittestResult:h.MOVEPOINT}))),t},inherit(n,r),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Cyclic Lines"},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){r.call(this,t,e),this._rendererCache={},this._invalidated=!0}function n(t,e){this._constructor="LineToolDateRange";var i=e||new d("linetooldaterange");s.call(this,t,new o(this,t),i)}var s=i(74).LineDataSource,r=i(103),a=i(104).TextRenderer,l=i(129).RectangleRenderer,h=i(131).TrendLineRenderer,c=i(98),d=i(80).DefaultProperty,p=i(82).TimeSpanFormatter;
inherit(o,r),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){r.prototype.update.call(this),this._invalidated=!1},o.prototype.renderer=function(){var t,i,o,n,r,d,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A;return this._invalidated&&this.updateImpl(),t=new c,this._points.length<2||this._source.points().length<2?t:(i=this._source.properties(),i.fillBackground&&i.fillBackground.value()&&(o={},o.points=this._points,o.color="white",o.linewidth=0,o.backcolor=i.backgroundColor.value(),o.fillBackground=!0,o.transparency=i.backgroundTransparency.value(),t.append(new l(o))),n=this,r=function(e,i){var o={};o.points=[e,i],o.width=n._model.timeScale().width(),o.height=n._source.priceScale().height(),o.color=n._source.properties().linecolor.value(),o.linewidth=n._source.properties().linewidth.value(),o.linestyle=CanvasEx.LINESTYLE_SOLID,o.extendleft=!1,o.extendright=!1,o.leftend=s.LINEEND_NORMAL,o.rightend=s.LINEEND_NORMAL,t.append(new h(o))},d=this._points[0],u=this._points[1],r(d,new e.Point(d.x,u.y)),r(new e.Point(u.x,d.y),u),_=(d.y+u.y)/2,f=new e.Point(d.x,_),g=new e.Point(u.x,_),o={},o.points=[f,g],o.width=n._model.timeScale().width(),o.height=n._source.priceScale().height(),o.color=n._source.properties().linecolor.value(),o.linewidth=n._source.properties().linewidth.value(),o.linestyle=CanvasEx.LINESTYLE_DASHED,o.extendleft=!1,o.extendright=!1,o.leftend=s.LINEEND_NORMAL,o.rightend=s.LINEEND_ARROW,t.append(new h(o)),m=this._source.points()[0].index,v=this._source.points()[1].index,y=v-m,b=this._model.timeScale().indexToUserTime(m),w=this._model.timeScale().indexToUserTime(v),S="",b&&w&&(T=(w.valueOf()-b.valueOf())/1e3,S=", "+(new p).format(T)),C=$.t("{0} bars").format(y)+S,o={},x={x:0,y:10},o.text=C,o.color=i.textcolor.value(),o.height=n._source.priceScale().height(),o.font=i.font.value(),o.offsetX=x.x,o.offsetY=x.y,o.vertAlign="middle",o.horzAlign="center",o.fontsize=i.fontsize.value(),o.backgroundRoundRect=4,o.backgroundHorzInflate=.4*i.fontsize.value(),o.backgroundVertInflate=.2*i.fontsize.value(),i.fillLabelBackground&&i.fillLabelBackground.value()&&(o.backgroundColor=i.labelBackgroundColor.value(),o.backgroundTransparency=1-i.labelBackgroundTransparency.value()/100||0),i.drawBorder&&i.drawBorder.value()&&(o.borderColor=i.borderColor.value()),P=.5*(d.x+u.x),L=u.y,k=new e.Point(P,L),E=new a(o,this._rendererCache),I=E.measure(),A={x:P+o.backgroundHorzInflate+I.textBgPadding-I.width/I.textBgPadding,y:d.y>u.y?k.y-I.height-2*I.textBgPadding-x.y>0?L-I.height-x.y-2*I.textBgPadding:x.y-2*I.textBgPadding:k.y+I.height+I.textBgPadding+x.y>o.height?o.height-I.height-x.y:L+I.textBgPadding},E.setPoints([new e.Point(P,A.y)]),t.append(E),this.addAnchors(t),t)},inherit(n,s),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Date Range"},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._rendererCache={},this._invalidated=!0,this._percentageFormatter=new p}function n(t,e){this._constructor="LineToolPriceRange";var i=e||new d("linetoolpricerange");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(104).TextRenderer,l=i(129).RectangleRenderer,h=i(131).TrendLineRenderer,c=i(98),d=i(80).DefaultProperty,p=i(82).PercentageFormatter;inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){s.prototype.update.call(this)},o.prototype.renderer=function(){var t,i,o,n,s,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new c,this._points.length<2||this._source.points().length<2?t:(i=this._source.properties(),i.fillBackground&&i.fillBackground.value()&&(s={},s.points=this._points,s.color="white",s.linewidth=0,s.backcolor=i.backgroundColor.value(),s.fillBackground=!0,s.transparency=i.backgroundTransparency.value(),t.append(new l(s))),d=this,p=function(e,i){var o={};o.points=[e,i],o.width=d._model.timeScale().width(),o.height=d._source.priceScale().height(),o.color=d._source.properties().linecolor.value(),o.linewidth=d._source.properties().linewidth.value(),o.linestyle=CanvasEx.LINESTYLE_SOLID,o.extendleft=!1,o.extendright=!1,o.leftend=r.LINEEND_NORMAL,o.rightend=r.LINEEND_NORMAL,t.append(new h(o))},o=this._points[0],n=this._points[1],n=new e.Point(n.x,o.y),p(o,n),o=this._points[0],n=this._points[1],o=new e.Point(o.x,n.y),p(o,n),o=this._points[0],n=this._points[1],u=(o.x+n.x)/2,_=new e.Point(u,o.y),f=new e.Point(u,n.y),s={},s.points=[_,f],s.width=d._model.timeScale().width(),s.height=d._source.priceScale().height(),s.color=d._source.properties().linecolor.value(),s.linewidth=d._source.properties().linewidth.value(),s.linestyle=CanvasEx.LINESTYLE_DASHED,s.extendleft=!1,s.extendright=!1,s.leftend=r.LINEEND_NORMAL,s.rightend=r.LINEEND_ARROW,t.append(new h(s)),g=this._source.points()[0].price,m=this._source.points()[1].price,v=m-g,y=100*v/g,b=this._source.priceScale().formatter().format(v)+" ("+this._percentageFormatter.format(y)+")",s={},m>g?(w=n.clone(),w.y-=2*i.fontsize.value(),w.x=.5*(o.x+n.x),s.points=[w]):(w=n.clone(),w.x=.5*(o.x+n.x),w.y+=.7*i.fontsize.value(),s.points=[w]),S={x:0,y:10},s.text=b,s.color=i.textcolor.value(),s.height=d._source.priceScale().height(),s.font=i.font.value(),s.offsetX=S.x,s.offsetY=S.y,s.vertAlign="middle",s.horzAlign="center",s.fontsize=i.fontsize.value(),s.backgroundRoundRect=4,s.backgroundHorzInflate=.4*i.fontsize.value(),s.backgroundVertInflate=.2*i.fontsize.value(),i.fillLabelBackground&&i.fillLabelBackground.value()&&(s.backgroundColor=i.labelBackgroundColor.value(),s.backgroundTransparency=1-i.labelBackgroundTransparency.value()/100||0),i.drawBorder&&i.drawBorder.value()&&(s.borderColor=i.borderColor.value()),T=.5*(o.x+n.x),C=n.y,x=new e.Point(T,C),P=new a(s,this._rendererCache),L=P.measure(),k={x:T+s.backgroundHorzInflate+L.textBgPadding-L.width/L.textBgPadding,y:o.y>n.y?x.y-L.height-2*L.textBgPadding-S.y>0?C-L.height-S.y-2*L.textBgPadding:S.y-2*L.textBgPadding:x.y+L.height+L.textBgPadding+S.y>s.height?s.height-L.height-S.y:C+L.textBgPadding},P.setPoints([new e.Point(T,k.y)]),t.append(P),this.addAnchors(t),t)},inherit(n,r),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Price Range"},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._rendererCache={},this._percentageFormatter=new u,this._invalidated=!0}function n(t,e){this._constructor="LineToolDateAndPriceRange";var i=e||new d("linetooldateandpricerange");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(104).TextRenderer,l=i(129).RectangleRenderer,h=i(131).TrendLineRenderer,c=i(98),d=i(80).DefaultProperty,p=i(82),u=p.PercentageFormatter,_=p.TimeSpanFormatter;inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},o.prototype.renderer=function(){var t,i,o,n,s,d,p,u,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V,M,D,O,B,R;return this._invalidated&&this.updateImpl(),t=new c,this._points.length<2||this._source.points().length<2?t:(i=this._source.properties(),i.fillBackground&&i.fillBackground.value()&&(o={},o.points=this._points,o.color="white",o.linewidth=0,o.backcolor=i.backgroundColor.value(),o.fillBackground=!0,o.transparency=i.backgroundTransparency.value(),t.append(new l(o))),n=this,s=function(e,i){var o={};o.points=[e,i],o.width=n._model.timeScale().width(),o.height=n._source.priceScale().height(),o.color=n._source.properties().linecolor.value(),o.linewidth=n._source.properties().linewidth.value(),o.linestyle=CanvasEx.LINESTYLE_SOLID,o.extendleft=!1,o.extendright=!1,o.leftend=r.LINEEND_NORMAL,o.rightend=r.LINEEND_NORMAL,t.append(new h(o))},d=this._points[0],p=this._points[1],s(d,new e.Point(p.x,d.y)),s(new e.Point(d.x,p.y),p),s(d,new e.Point(d.x,p.y)),s(new e.Point(p.x,d.y),p),u=(d.y+p.y)/2,f=new e.Point(d.x,u),g=new e.Point(p.x,u),o={},o.points=[f,g],o.width=n._model.timeScale().width(),o.height=n._source.priceScale().height(),o.color=n._source.properties().linecolor.value(),o.linewidth=n._source.properties().linewidth.value(),o.linestyle=CanvasEx.LINESTYLE_DASHED,o.extendleft=!1,o.extendright=!1,o.leftend=r.LINEEND_NORMAL,o.rightend=r.LINEEND_ARROW,t.append(new h(o)),d=this._points[0],p=this._points[1],m=(d.x+p.x)/2,f=new e.Point(m,d.y),g=new e.Point(m,p.y),o={},o.points=[f,g],o.width=n._model.timeScale().width(),o.height=n._source.priceScale().height(),o.color=n._source.properties().linecolor.value(),o.linewidth=n._source.properties().linewidth.value(),o.linestyle=CanvasEx.LINESTYLE_DASHED,o.extendleft=!1,o.extendright=!1,o.leftend=r.LINEEND_NORMAL,o.rightend=r.LINEEND_ARROW,t.append(new h(o)),v=this._source.points()[0].price,y=this._source.points()[1].price,b=y-v,w=100*b/v,S=this._source.points()[0].index,T=this._source.points()[1].index,C=T-S,x=this._model.timeScale().indexToUserTime(S),P=this._model.timeScale().indexToUserTime(T),L="",x&&P&&(k=(P.valueOf()-x.valueOf())/1e3,L=", "+(new _).format(k)),E=this._source.priceScale().formatter().format(b)+" ("+this._percentageFormatter.format(Math.round(100*w)/100)+")\n"+$.t("{0} bars").format(C)+L,o={},y>v?(I=p.clone(),I.y-=2*i.fontsize.value(),I.x=.5*(d.x+p.x),o.points=[I]):(I=p.clone(),I.x=.5*(d.x+p.x),I.y+=.7*i.fontsize.value(),o.points=[I]),A={x:0,y:10},o.text=E,o.color=i.textcolor.value(),o.height=n._source.priceScale().height(),o.font=i.font.value(),o.offsetX=A.x,o.offsetY=A.y,o.padding=5,o.vertAlign="middle",o.horzAlign="center",o.fontsize=i.fontsize.value(),o.backgroundRoundRect=4,o.backgroundHorzInflate=.4*i.fontsize.value(),o.backgroundVertInflate=.2*i.fontsize.value(),i.fillLabelBackground&&i.fillLabelBackground.value()&&(o.backgroundColor=i.labelBackgroundColor.value(),o.backgroundTransparency=1-i.labelBackgroundTransparency.value()/100||0),i.drawBorder&&i.drawBorder.value()&&(o.borderColor=i.borderColor.value()),V=.5*(d.x+p.x),M=p.y,D=new e.Point(V,M),O=new a(o,this._rendererCache),B=O.measure(),R={x:V+o.backgroundHorzInflate+B.textBgPadding-B.width/B.textBgPadding,y:d.y>p.y?D.y-B.height-2*B.textBgPadding-A.y>0?M-B.height-A.y+B.textBgPadding:A.y-2*B.textBgPadding:D.y+B.height+B.textBgPadding+A.y>o.height?o.height-B.height-A.y:M+B.textBgPadding},window.t1=n._source.priceScale().height(),window.t2=D.y+B.height+2*B.textBgPadding+A.y,O.setPoints([new e.Point(V,R.y)]),t.append(O),this.addAnchors(t),t)},inherit(n,r),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Date and Price Range"},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e,o){"use strict";function n(t){this._data=t}function s(t,e){a.call(this,t,e),this._label=null,this._rendererCache={},this._invalidated=!0}function r(t,e){this._constructor="LineToolTrendAngleLine";var i=e||new f("linetooltrendangle");l.call(this,t,new s(this,t),i),this._properties.addProperty("angle"),this._properties.angle=new r.AngleProperty(this)}var a=i(103),l=i(74).LineDataSource,h=i(131),c=h.TrendLineStatsRenderer,d=h.LineToolTrendLine,p=i(104).TextRenderer,u=i(131).TrendLineRenderer,_=i(98),f=i(80).DefaultProperty,g=i(82),m=g.PercentageFormatter;n.prototype.hitTest=function(){return null},n.prototype.draw=function(t){var e,i;t.save(),t.translate(this._data.point.x,this._data.point.y),t.strokeStyle=this._data.color,e=[1,2],"function"==typeof t.setLineDash?t.setLineDash(e):void 0!==t.mozDash?t.mozDash=e:void 0!==t.webkitLineDash&&(t.webkitLineDash=e),i=this._data.size,t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.arc(0,0,i,0,-this._data.angle,this._data.angle>0),t.stroke(),t.restore()},inherit(s,a),s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){var t,i,o,n,s,r,l,h,c,d,p,u,_,f;a.prototype.update.call(this),this._points.length>0&&void 0!==this._source._angle&&(t=this._points[0],i=Math.cos(this._source._angle),o=-Math.sin(this._source._angle),n=new e.Point(i,o),this._secondPoint=t.addScaled(n,this._source._distance),this._secondPoint.data=1),this._label=null,this._source.points().length<2||(t=this._source.points()[0],s=this._source.points()[1],r=[],this._source.properties().showPriceRange.value()&&this._source.priceScale()&&(c=s.price-t.price,d=c/t.price,l=this._source.priceScale().formatter().format(c)+" ("+(new m).format(100*d)+")",p=this._model.mainSeries().base(),p&&(u=Math.round(c*p),l+=", "+u),r.push("priceRange")),_=this._source.properties().showBarsRange.value(),_&&(h="",f=s.index-t.index,h+=$.t("{0} bars").format(f),r.push("barsRange")),this._label=[l,h].filter(function(t){return t}).join("\n")||null,this._icons=r)},s.prototype.renderer=function(){var t,e,i,o,s,r,a,h,f,g;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new _,e={},i=this.isAnchorsRequired(),o=i||this._source.properties().alwaysShowStats.value(),this._secondPoint&&this._points.length>0&&(e.points=[this._points[0],this._secondPoint],e.width=this._model.timeScale().width(),e.height=this._source.priceScale().height(),e.color=this._source.properties().linecolor.value(),e.linewidth=this._source.properties().linewidth.value(),e.linestyle=this._source.properties().linestyle.value(),e.extendleft=this._source.properties().extendLeft.value(),e.extendright=this._source.properties().extendRight.value(),e.leftend=l.LINEEND_NORMAL,e.rightend=l.LINEEND_NORMAL,t.append(new u(e)),o&&this._label&&2===this._points.length&&(s={points:[this._secondPoint],text:this._label,color:this._source.properties().textcolor.value(),font:d.LABEL_FONT,fontsize:d.LABEL_FONTSIZE,lineSpacing:d.LABEL_LINESPACING,backgroundColor:d.LABEL_BGCOLOR,borderColor:d.LABEL_BORDERCOLOR,borderWidth:1,padding:d.LABEL_PADDING,paddingLeft:30,doNotAlignText:!0,icons:this._icons},r=d.LABEL_OFFSET,this._points[1].y<this._points[0].y?(s.vertAlign="bottom",s.offsetY=-r):s.offsetY=r,this._points[1].x<this._points[0].x?(s.horzAlign="right",s.offsetX=-r):s.offsetX=r,t.append(new c(s,this._rendererCache))),a={},a.point=this._points[0],a.angle=this._source._angle,a.color=this._source.properties().linecolor.value(),a.size=50,t.append(new n(a)),h=Math.round(180*a.angle/Math.PI)+"º",f=this._points[0].clone(),f.x=f.x+50,g={points:[f],text:h,color:this._source.properties().textcolor.value(),horzAlign:"left",font:this._source.properties().font.value(),offsetX:5,offsetY:0,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value(),vertAlign:"middle"},t.append(new p(g,this._rendererCache))),!TradingView.printing&&this._source.hasAlert.value()&&!this._model.readOnly()&&e&&e.points&&e.points.length>=2&&this._source.getAlertIsActive(function(i){t.append(new TradingView.PaneRendererClockIcon({point1:e.points[0],point2:e.points[1],color:i?e.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),this._secondPoint&&this._points.length>0&&i&&t.append(this.createLineAnchor({points:[this._points[0],this._secondPoint]})),t},inherit(r,l),r.AngleProperty=function(t){o.call(this),this._lineSource=t},inherit(r.AngleProperty,o),r.AngleProperty.prototype.value=function(){var t=this._lineSource._angle,e=180*t/Math.PI;return Math.round(e)},r.AngleProperty.prototype.setValue=function(t){var i,o,n,s,r,a,l=t*Math.PI/180;this._lineSource._angle=l,i=this._lineSource.pointToScreenPoint(this._lineSource.points()[0])[0],o=Math.cos(this._lineSource._angle),n=-Math.sin(this._lineSource._angle),s=new e.Point(o,n),r=i.addScaled(s,this._lineSource._distance),a=this._lineSource.screenPointToPoint(r),this._lineSource._points[1]=a,this._lineSource._model.updateSource(this._lineSource),this._lineSource.updateAllViews(),this._lineSource._model.updateSource(this._lineSource)},r.prototype.pointsCount=function(){return 2},r.prototype.title=function(){return"Trend Angle"},r.prototype._calculateAngle=function(){var t,e=this.pointToScreenPoint(this.points()[0])[0],i=this.pointToScreenPoint(this.points()[1])[0],o=i.substract(e);o.length()>0?(o=o.normalized(),this._angle=Math.acos(o.x),o.y>0&&(this._angle=-this._angle),this._distance=i.substract(e).length()):delete this._angle,t=this.properties(),t.hasOwnProperty("angle")&&this.properties().angle.listeners().fire(this.properties().angle)},r.prototype.addPoint=function(t,e){var i=l.prototype.addPoint.call(this,t,e);return i&&this._calculateAngle(),i},r.prototype.setLastPoint=function(t,e){l.prototype.setLastPoint.call(this,t,e),this.points().length>1&&this._calculateAngle()},r.prototype.axisPoints=function(){var t,i,o,n,s,r,a=this.points();return a.length<2?[]:(t=[this.points()[0]],i=this.pointToScreenPoint(this.points()[0])[1],o=Math.cos(this._angle)*this._distance,n=-Math.sin(this._angle)*this._distance,s=i.add(new e.Point(o,n)),r=this.screenPointToPoint(s),t.push(r),t)},r.prototype.setPoint=function(t,e,i){l.prototype.setPoint.call(this,t,e,i),this.points().length>1&&1===t&&this._calculateAngle()},r.prototype.restoreData=function(t){this._angle=t.angle,this._distance=t.distance},r.prototype.state=function(t){var e=l.prototype.state.call(this,t);return e.angle=this._angle,e.distance=this._distance,e},r.prototype.cloneData=function(t){this._angle=t._angle,this._distance=t._distance},r.prototype.canHasAlert=function(){return!0},r.prototype._getAlertPlots=function(){return[this._linePointsToAlertPlot(this._points,null,this.properties().extendLeft.value(),this.properties().extendRight.value())]},t.exports=r}).call(e,i(21),i(69))},function(t,e,i){(function(t){"use strict";function o(t,e){var i=e||new d("linetoolarrowmark");l.call(this,t,new c(this,t,this.image,this.width,this.height,this.offsetX,this.offsetY),i)}function n(t,e){this._constructor="LineToolArrowMarkLeft",o.call(this,t,e),this._textPaneView=new h(this,t,22,-3,"middle","left"),this._textPaneView._noSelection=!0}function s(t,e){this._constructor="LineToolArrowMarkUp",o.call(this,t,e),this._textPaneView=new h(this,t,0,18,"top","center"),this._textPaneView._noSelection=!0}function r(t,e){this._constructor="LineToolArrowMarkRight",o.call(this,t,e),this._textPaneView=new h(this,t,-22,-3,"middle","right"),this._textPaneView._noSelection=!0}function a(t,e){this._constructor="LineToolArrowMarkDown",o.call(this,t,e),this._textPaneView=new h(this,t,0,-23,"bottom","center"),this._textPaneView._noSelection=!0}var l=i(74).LineDataSource,h=i(104).TextPaneView,c=i(170),d=i(80).DefaultProperty;inherit(o,l),o.prototype.width=21,o.prototype.height=21,o.prototype.offsetX=0,o.prototype.offsetY=0,o.prototype.paneViews=function(t){var e=l.prototype.paneViews.call(this,t);return null!==e&&this._textPaneView&&e.push(this._textPaneView),e},o.prototype.pointsCount=function(){return 1},o.prototype.title=function(){return"Arrow Mark"},inherit(n,o),n.prototype.image=new Image,n.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB50lEQVR4AWMgETAKKAgIAGkQ5mCgAmCWdtTWV4yxvgFkWwKxOKUGssr5Gccrx9t+Vk6w+w/kxwKxIrmGMTKIivIohFvONKsI+e/cl/ofamgGECuTYyCTqJ2mqlK01Vnr+uj/HjNy/1v1J8AMzSTHUBYZP6MgpTjb97bNsf9dpmf9N++J/W/UEQEztAiIbUEGo2EpIObE8C4oVuVDzLuBmv869aT8t5+c+t+0K/q/YXs4GGsWeIAMRscwy/yhBiO8K2ijJKcYZXXYuj7qv/u0nP/W/Yn/jTsjQYYRwliDhUXKy8BVKdbmuW1T7H+3Gdn/LXrjQN4FaSDLUBa5MItyoOAvp67k/45T0pC9S56hSrHWhY4tif9D5pUDXZjz36w7Blkx+S5VDLNoBUWMY3fKfwdExMAw+WEq7Wvkoxhn+waUhFwRSYhcQxGxL26jpqQYbX3CBpjY3aeDYj+BothHpFNxcW75cIvJpmXB/516Uv/bT0r5b9IVRUY6xQSssr6GkcAc9dGuNe6/y7RMMnMUJmCWcNTSBgbHZeuG6P+eM/P+W/VRlPcRwSGoJMgvH265yKIq/L9LfzqKoZSXp0Em6cDy9BvU0Dhyy1PM4PAwMFWKs7kFZFsBsQQDlQAjr4a0MJAWxFdHAQAcI3sGHsO1dgAAAABJRU5ErkJggg==",n.prototype.offsetX=1,n.prototype.offsetY=-10,n.prototype.title=function(){return"Arrow Mark Left"},inherit(s,o),s.prototype.image=new Image,s.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAACBklEQVR4AWMgErAoxVoXgmgGKgEWxTCLVseWxP9yYRbl1DCYSdrXyEc5we5vyLzy/0D6l5SXgStInFwDGcVt1JQU42zfOHan/HebkfPfqSv5v1KszXNBGyU5kDzpRoqLcytGW5+wbY797zA59b9Zd8x/xylp/22bYv8rRlkdBqrgINVIVvlwi8k29dH/Xadn/Tftiv5v2B4Opt1mZP+3ro/6Lx9i3k1K+DLL+hpGmpYF/3efnvPfvCcWZCAcW/TG/XeflvMfFM4yfkZBxIQvo4SjlrZSnO1Hp57U/9b9Cf+NOiKQDQXxgeKJ/516Uv4D1b0XtdNUxRu+gkqC/MBwvGzXGvffflLKf+POSISBCAwWtweGMyi8laKtzjKIivLgCUfLRdYN0f9dpmX+N+mKghiCieHh6wIMb2tguCuEW84E6ccIR7kgk3SLqvD/njPzYOFICIPVeczI/W9WEfJfzs84HmQOIhw9DEyV422/ufSn/7fqg4cjIQxWZwUMd+e+1P9A/Z+lHbX1weHLqyEtrBRncwsYm/+RsWaBBz4DwfLoehRjrG8IKAgIgOMHiK2AOA6IM6G4CKgIr6EgeZA6qPoMII4FYksgFmCA5gwJIFYEYmUotiXSUFuYHqh+cXw5TZlIQ5WxaR4mhuLBZBkqBcT+oJjFg/3B6kgAnFANyniwFEQdJgAAOuN7Bp7MBuYAAAAASUVORK5CYII=",s.prototype.offsetX=-9,s.prototype.offsetY=0,s.prototype.title=function(){return"Arrow Mark Up"},inherit(r,o),r.prototype.image=new Image,r.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB60lEQVR4AWPAAziAWJBXQ1oYSDMyUAlIALGVUpzNLQkPA1Mgm5kahioCcZxygt1/5Xjbb3JBJulAPiulhioDcSbIUJf+9P8WVeH/5cMtFwkqCfKDgoNiQ636Ev57zsz7b90Q/V8x2vqyhKOWNqHg4ARiKZAhaNgWiItAhhp1RPw374n97zIt879da9x/pTjbj7K+hpE4gwNqoD9IMzasWeDx37A9HIxNuqL+209K+e/Uk/rftCwYGBwWkxnExbkRwYHpTZBGgti4M/K/dX/Cf/fpOf9t6sHBcULcRk0JaAYT6YYiMDw4XKdn/bdtjv2vGGf7RtrXyAdoDguZhiKwaVf0f4fJqf8du1NAQfVXMcyiFWQwmYYisFl3zH+3GTn/Q+aV/3dsSfyvFGtdSLFLHaek/XfqSga59JdcmEU5yKVkh6lFbxzQhdn/bZtiga6zeS7lZeAKMpCC2E/87z4t5791fdR/xSirw4I2SnKg2CcxnSK8aw+MGKceSMTIh5h3Q0szRvJzFCQJgXLUexk/oyCQd8nP+8DE7jEjF+jd6P9K0VZnRe00VWHeJcfQDJChzn2p/80qQv4rhFvOZBAV5QF5l5LyNBZann6W8zOOp0Z5Kg7Eloox1jekHbX1qVLyQ2NVQEBBQIBU7wIAOFZ7BmG7RzYAAAAASUVORK5CYII=",r.prototype.offsetX=-19,r.prototype.offsetY=-10,r.prototype.title=function(){return"Arrow Mark Right"},inherit(a,o),a.prototype.image=new Image,a.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB/UlEQVR4AWPAATj3Wij8J4RB6hhIAFIgTS9a8nBhmKFSpBiqDNJ0P80PF4YZqkyyobfD7HDh4WJolaKY+G5zhXvoMXva2xifoWB5dD07zeTvFKvxioDMFY6RFUgEGvzzQVk8OGafVib9v5fkhc9QkDxIHVj9vaKY/7vM5b+HS/JFA80TAhnKA8TGZSoiS057GYFiFqzhTpQTPkNB8iB1YPUnPQz+5ykKzQGaYwjE3CBDmUCuBWKHabqSZ0656oI0EY1B6idoSx4F6reDupIJFrTMQCwtxsYcvNZY5uU5T0OiDDwLdOFKI9knvMzM/kD9kmBz0AAbEKs6iHAX7zSX/3nF3xyvgZd8Tf9vM5P/ZiXAmQdNBazYEgIjEHOBwiVHXmjWcSctnAbeDLH5f8xR83+SjNBEoHo9sD4owGWwIBDb9mtJHMIVviDxDg3x3UB11kDMD9ZHADCDwkeAmdlvhZHMI2C4oRh4xl3//1IDmbvszAxeQHXiUPWEATR8lE0EubJB4QYMP7CBF31M/m82k/usy8uRCpRXAKsjEXCCwiteVqD/qIPG/+tBVv/3WCj8C5Pi7wCKawMxBwMZgBEaXlbtGuI7T7ro/G9QFdsI5JsDMR/+cCQcvuLsLAzubRoSa4FsJyAWBSdwsgEifKVBXoYmcBYGagCoQZzEGggAoyq6zKXuV5gAAAAASUVORK5CYII=",a.prototype.offsetX=-9,a.prototype.offsetY=-18,a.prototype.title=function(){return"Arrow Mark Down"},r.prototype.version=n.prototype.version=a.prototype.version=s.prototype.version=2,a.prototype.migrateVersion=function(e){1===e&&(this.version=1,this._paneViews[0]._offsetX=-10,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new t.Point(0,21)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=-4)},s.prototype.migrateVersion=function(e){1===e&&(this.version=1,this._paneViews[0]._offsetX=-10,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new t.Point(0,0)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=18)},r.prototype.migrateVersion=function(e){1===e&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new t.Point(0,0)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=10)},n.prototype.migrateVersion=function(e){1===e&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new t.Point(0,0)),this._textPaneView._offsetX=21,this._textPaneView._offsetY=10)},e.LineToolArrowMark=o,e.LineToolArrowMarkLeft=n,e.LineToolArrowMarkRight=r,e.LineToolArrowMarkUp=s,e.LineToolArrowMarkDown=a}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._data=t}function n(t,e,i,o,n,r,a){s.call(this,t,e),this._image=i,this._offsetX=r||0,this._offsetY=a||0,this._width=o,this._height=n,this._invalidated=!0}var s=i(103),r=i(94),a=i(93).SelectionRenderer,l=i(98);o.prototype.draw=function(t){var e,i;0!==this._data.points.length&&(e=this._data.points[0].x+this._data.offsetX,i=this._data.points[0].y+this._data.offsetY,t.translate(-.5,-.5),t.drawImage(this._data.image,e,i,this._data.width,this._data.height))},o.prototype.hitTest=function(t){if(0===this._data.points.length)return null;var i=this._data.points[0].clone();return this._data.offsetX&&(i.x+=this._data.offsetX),this._data.offsetY&&(i.y+=this._data.offsetY),e.pointInRect(t,i,i.add(new e.Point(this._data.width,this._data.height)))?new r(r.MOVEPOINT):null},inherit(n,s),n.prototype.setAnchors=function(t){this._anchorsOffset=t},n.prototype.renderer=function(){var t,e,i,n;if(this._invalidated&&this.updateImpl(),t={},t.points=this._points,t.color=this._source.properties().color.value(),t.image=this._image,t.offsetX=this._offsetX,t.offsetY=this._offsetY,t.width=this._width,t.height=this._height,this.isAnchorsRequired()&&1===t.points.length){if(e=new l,e.append(new o(t)),this._anchorsOffset){for(i=[],n=0;n<t.points.length;n++)i.push(t.points[n].clone().add(this._anchorsOffset));e.append(new a({points:i}))}else e.append(new a({points:t.points}));return e}return new o(t)},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},t.exports=n}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e){s.call(this,t,e),this._invalidated=!0}function n(t,e){this._constructor="LineToolPitchfan";var i=e||this.createPropertiesObject("linetoolpitchfan");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(127),l=i(172).ChannelRenderer,h=i(131).TrendLineRenderer,c=i(94),d=i(98);inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){s.prototype.update.call(this),0!==this._floatPoints.length&&(3===this._floatPoints.length?(this._medianPoint=this._floatPoints[1].add(this._floatPoints[2]).scaled(.5),this._medianPoint.data=3):2===this._floatPoints.length?(this._medianPoint=this._floatPoints[1],this._medianPoint.data=3):(this._medianPoint=this._floatPoints[0],this._medianPoint.data=3))},o.prototype.renderer=function(){var t,e,i,o,n,s,a,p,u,_,f,g,m,v,y,b;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new d,this._floatPoints.length<2)return t;if(!this._medianPoint)return t;if(e={points:[this._floatPoints[0],this._medianPoint],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},t.append(new h(e)),this._floatPoints.length<3)return this.addAnchors(t),t;for(i={points:[this._floatPoints[1],this._floatPoints[2]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},t.append(new h(i)),o=0,n=this._floatPoints[2].substract(this._floatPoints[1]).scaled(.5),s=this._source.properties().fillBackground.value(),a=this._source.properties().transparency.value(),p=0;p<=8;p++)u="level"+p,_=this._source.properties()[u],_.visible.value()&&(f=this._medianPoint.addScaled(n,_.coeff.value()),g=this._medianPoint.addScaled(n,-_.coeff.value()),s&&(m={},m.width=this._model.timeScale().width(),m.p1=this._floatPoints[0],m.p2=f,m.p3=this._floatPoints[0],m.p4=this._medianPoint.addScaled(n,o),m.color=_.color.value(),m.transparency=a,m.hittestOnBackground=!0,t.append(new l(m)),m={},m.width=this._model.timeScale().width(),m.p1=this._floatPoints[0],m.p2=g,m.p3=this._floatPoints[0],m.p4=this._medianPoint.addScaled(n,-o),m.color=_.color.value(),m.transparency=a,m.hittestOnBackground=!0,t.append(new l(m))),o=_.coeff.value(),v={points:[this._floatPoints[0],f],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:_.color.value(),linewidth:_.linewidth.value(),linestyle:_.linestyle.value(),extendleft:!1,extendright:!0,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},y=new c(c.MOVEPOINT,null,p),t.append(new h(v,y)),b={points:[this._floatPoints[0],g],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:_.color.value(),linewidth:_.linewidth.value(),linestyle:_.linestyle.value(),extendleft:!1,extendright:!0,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},y=new c(c.MOVEPOINT,null,p),t.append(new h(b,y)));return this.addAnchors(t),t},inherit(n,r),n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Pitchfan"},n.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},n.prototype.createPropertiesObject=function(t,e,i){return new a(t,e,i,{range:[0,8]})},t.exports=n},function(t,e,i){(function(t){"use strict";function o(t){this._data=t}function n(t,e){h.call(this,t,e),this._invalidated=!0}function s(t,e){n.call(this,t,e),this._invalidated=!0}function r(t,e){s.call(this,t,e),this._invalidated=!0}function a(t,e){n.call(this,t,e),this._invalidated=!0}function l(t,e){this._constructor="LineToolPitchfork";var i=e||this.createPropertiesObject("linetoolpitchfork");c.call(this,t,new n(this,t),i),this._properties.style.listeners().subscribe(this,l.prototype._recreatePaneView),this._recreatePaneView()}var h=i(103),c=i(74).LineDataSource,d=i(127),p=i(131).TrendLineRenderer,u=i(141).Action,_=i(94),f=i(98);o.prototype.extendPoints=function(e,i,o){var n=new t.Point(0,-5e3),s=new t.Point(o,5e3),r=i.substract(e),a=t.intersectRayWithRect(i,i.add(r),n,s);return a&&(i=a),!t.pointInRect(e,n,s)&&t.pointInRect(i,n,s)&&(a=t.intersectRayWithRect(i,e,n,s),a&&(e=a)),!t.pointInRect(i,n,s)&&t.pointInRect(e,n,s)&&(a=t.intersectRayWithRect(e,i,n,s),a&&(i=a)),[e,i]},o.prototype.draw=function(t){var e=t.canvas.width,i=this.extendPoints(this._data.p1,this._data.p2,e),o=this.extendPoints(this._data.p3,this._data.p4,e);t.beginPath(),t.moveTo(i[0].x,i[0].y),t.lineTo(i[1].x,i[1].y),i[1].x<o[1].x&&t.lineTo(o[1].x,i[1].y),t.lineTo(o[1].x,o[1].y),t.lineTo(o[0].x,o[0].y),t.lineTo(i[0].x,i[0].y),t.fillStyle=TradingView.generateColor(this._data.color,this._data.transparency,!0),t.fill()},o.prototype.hitTest=function(e){var i,o,n,s;return this._data.hittestOnBackground?(i=this._data.width,o=this.extendPoints(this._data.p1,this._data.p2,i),n=this.extendPoints(this._data.p3,this._data.p4,i),s=[new t.Point(o[0].x,o[0].y),new t.Point(o[1].x,o[1].y)],o[1].x<n[1].x&&s.push(new t.Point(n[1].x,o[1].y)),s.push(new t.Point(n[1].x,n[1].y)),s.push(new t.Point(n[0].x,n[0].y)),s.push(new t.Point(o[0].x,o[0].y)),t.isInPolygon(s,e)?new _(_.MOVEPOINT_BACKGROUND):null):null},inherit(n,h),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){h.prototype.update.call(this),0!==this._floatPoints.length&&(3===this._floatPoints.length?(this._medianPoint=this._floatPoints[1].add(this._floatPoints[2]).scaled(.5),this._medianPoint.data=3):2===this._floatPoints.length?(this._medianPoint=this._floatPoints[1],this._medianPoint.data=3):(this._medianPoint=this._floatPoints[0],this._medianPoint.data=3))},n.prototype.renderer=function(){var t,e,i,n,s,r,a,l,h,d,u,g,m,v,y,b,w,S,T;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new f,this._floatPoints.length<2)return t;if(!this._medianPoint)return t;if(e={points:[this._floatPoints[0],this._medianPoint],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(e)),this._floatPoints.length<3)return this.addAnchors(t),t;for(i={points:[this._floatPoints[1],this._floatPoints[2]],width:this._model.timeScale().width(),
height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(i)),n=this._floatPoints[2].substract(this._floatPoints[1]).scaled(.5),s=this._medianPoint.substract(this._floatPoints[0]),r=0,a=this._source.properties().fillBackground.value(),l=this._source.properties().transparency.value(),h=0;h<=8;h++)d="level"+h,u=this._source.properties()[d],u.visible.value()&&(g=this._medianPoint.addScaled(n,u.coeff.value()),m=g.add(s),v=this._medianPoint.addScaled(n,-u.coeff.value()),y=v.add(s),a&&(b={},b.width=this._model.timeScale().width(),b.p1=g,b.p2=m,b.p3=this._medianPoint.addScaled(n,r),b.p4=b.p3.add(s),b.color=u.color.value(),b.width=this._model.timeScale().width(),b.transparency=l,b.hittestOnBackground=!0,t.append(new o(b)),b={},b.width=this._model.timeScale().width(),b.p1=v,b.p2=y,b.p3=this._medianPoint.addScaled(n,-r),b.p4=b.p3.add(s),b.color=u.color.value(),b.width=this._model.timeScale().width(),b.transparency=l,b.hittestOnBackground=!0,t.append(new o(b))),r=u.coeff.value(),w={points:[g,m],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:u.color.value(),linewidth:u.linewidth.value(),linestyle:u.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},S=new _(_.MOVEPOINT,null,h),t.append(new p(w,S)),T={points:[v,y],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:u.color.value(),linewidth:u.linewidth.value(),linestyle:u.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},S=new _(_.MOVEPOINT,null,h),t.append(new p(T,S)));return this.addAnchors(t),t},inherit(s,n),s.prototype.renderer=function(){var t,e,i,n,s,r,a,l,h,d,u,g,m,v,y,b,w,S,T;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new f,this._floatPoints.length<2)return t;if(e={points:[this._floatPoints[0],this._floatPoints[1]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(e)),!this._medianPoint||!this._modifiedBase)return this.addAnchors(t),t;if(i={points:[this._modifiedBase,this._medianPoint],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(i)),this._floatPoints.length<3)return this.addAnchors(t),t;for(n={points:[this._floatPoints[1],this._floatPoints[2]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(n)),s=this._floatPoints[2].substract(this._floatPoints[1]).scaled(.5),r=this._medianPoint.substract(this._modifiedBase),a=0,l=this._source.properties().fillBackground.value(),h=this._source.properties().transparency.value(),d=0;d<=8;d++)u="level"+d,g=this._source.properties()[u],g.visible.value()&&(m=this._medianPoint.addScaled(s,g.coeff.value()),v=m.add(r),y=this._medianPoint.addScaled(s,-g.coeff.value()),b=y.add(r),l&&(e={},e.p1=m,e.p2=v,e.p3=this._medianPoint.addScaled(s,a),e.p4=e.p3.add(r),e.color=g.color.value(),e.width=this._model.timeScale().width(),e.transparency=h,e.hittestOnBackground=!0,t.append(new o(e)),e={},e.p1=y,e.p2=b,e.p3=this._medianPoint.addScaled(s,-a),e.p4=e.p3.add(r),e.color=g.color.value(),e.width=this._model.timeScale().width(),e.transparency=h,e.hittestOnBackground=!0,t.append(new o(e))),a=g.coeff.value(),w={points:[m,v],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:g.color.value(),linewidth:g.linewidth.value(),linestyle:g.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},S=new _(_.MOVEPOINT,null,d),t.append(new p(w,S)),T={points:[y,b],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:g.color.value(),linewidth:g.linewidth.value(),linestyle:g.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},S=new _(_.MOVEPOINT,null,d),t.append(new p(T,S)));return this.addAnchors(t),t},s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){n.prototype.updateImpl.call(this),this._floatPoints.length>1&&(this._modifiedBase=this._floatPoints[0].add(this._floatPoints[1]).scaled(.5))},inherit(r,s),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){var e,i,o;n.prototype.updateImpl.call(this),this._floatPoints.length>2&&(e=this._floatPoints[0].x,i=.5*(this._floatPoints[0].y+this._floatPoints[1].y),o=new t.Point(e,i),this._modifiedBase=o)},inherit(a,n),a.prototype.update=function(){this._invalidated=!0},a.prototype.updateImpl=function(){n.prototype.updateImpl.call(this),this._floatPoints.length>1&&(this._modifiedBase=this._floatPoints[0].add(this._floatPoints[1]).scaled(.5))},a.prototype.renderer=function(){var t,e,i,n,s,r,a,l,h,d,u,g,m,v,y,b,w,S,T,C;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new f,this._floatPoints.length<2)return t;if(!this._medianPoint||!this._modifiedBase)return this.addAnchors(t),t;if(3===this._floatPoints.length&&(e={points:[this._modifiedBase,this._floatPoints[2]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(e))),i={points:[this._floatPoints[0],this._floatPoints[1]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(i)),this._floatPoints.length<3)return this.addAnchors(t),t;for(n={points:[this._floatPoints[1],this._floatPoints[2]],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(n)),s=this._floatPoints[2].substract(this._floatPoints[1]).scaled(.5),r=this._floatPoints[2].substract(this._modifiedBase),a=0,l=this._source.properties().fillBackground.value(),h=this._source.properties().transparency.value(),d={points:[this._medianPoint,this._medianPoint.add(r)],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._source.properties().median.color.value(),linewidth:this._source.properties().median.linewidth.value(),linestyle:this._source.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},t.append(new p(d)),u=0;u<=8;u++)g="level"+u,m=this._source.properties()[g],m.visible.value()&&(v=this._medianPoint.addScaled(s,m.coeff.value()),y=v.add(r),b=this._medianPoint.addScaled(s,-m.coeff.value()),w=b.add(r),l&&(i={},i.p1=v,i.p2=y,i.p3=this._medianPoint.addScaled(s,a),i.p4=i.p3.add(r),i.color=m.color.value(),i.width=this._model.timeScale().width(),i.transparency=h,i.hittestOnBackground=!0,t.append(new o(i)),i={},i.p1=b,i.p2=w,i.p3=this._medianPoint.addScaled(s,-a),i.p4=i.p3.add(r),i.color=m.color.value(),i.width=this._model.timeScale().width(),i.transparency=h,i.hittestOnBackground=!0,t.append(new o(i))),a=m.coeff.value(),S={points:[v,y],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:m.color.value(),linewidth:m.linewidth.value(),linestyle:m.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},T=new _(_.MOVEPOINT,null,u),t.append(new p(S,T)),C={points:[b,w],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:m.color.value(),linewidth:m.linewidth.value(),linestyle:m.linestyle.value(),extendleft:!1,extendright:!0,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},T=new _(_.MOVEPOINT,null,u),t.append(new p(C,T)));return this.addAnchors(t),t},inherit(l,c),l.STYLE_ORIGINAL=0,l.STYLE_SCHIFF=1,l.STYLE_INSIDE=2,l.STYLE_SCHIFF2=3,l.prototype.additionalActions=function(){var t,e,i=[],o=["Original","Modified Schiff","Inside","Schiff"];for(t=0;t<4;t++)e=new u({checked:this.properties().style.value()===t,checkable:!0,text:$.t(o[t]),callbackContext:{target:this,value:t}}),e.callbacks().subscribe(null,function(t){var e=t.callbackContext(),i=e.target,o=e.value;i.properties().style.setValue(o),i.updateAllViews(),i._model.updateSource(i)}),i.push(e);return[i[0],i[3],i[1],i[2]]},l.prototype._recreatePaneView=function(){this._properties.style.value()===l.STYLE_ORIGINAL?this._paneViews=[new n(this,this._model)]:this._properties.style.value()===l.STYLE_SCHIFF?this._paneViews=[new s(this,this._model)]:this._properties.style.value()===l.STYLE_SCHIFF2?this._paneViews=[new r(this,this._model)]:this._properties.style.value()===l.STYLE_INSIDE&&(this._paneViews=[new a(this,this._model)])},l.prototype.pointsCount=function(){return 3},l.prototype.title=function(){return $.t("Pitchfork")},l.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},l.prototype.createPropertiesObject=function(t,e,i){return new d(t,e,i,{range:[0,8]})},e.ChannelRenderer=o,e.LineToolPitchfork=l}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._rendererCache={},this._numericFormatter=new p,this._invalidated=!0}function n(t,e){this._constructor="LineToolGannSquare";var i=e||this.createPropertiesObject("linetoolgannsquare");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(127),l=i(104).TextRenderer,h=i(129).RectangleTransparencyRenderer,c=i(131).TrendLineRenderer,d=i(98),p=i(82).NumericFormatter;inherit(o,s),o.prototype.renderer=function(){var t,i,o,n,s,a,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new d,this._points.length<2)return this.addAnchors(t),t;for(i=this._points[0],o=this._points[1],n=Math.min(i.x,o.x),s=Math.min(i.y,o.y),a=Math.max(i.x,o.x),p=Math.max(i.y,o.y),u=this._source.properties(),_=this._source.properties().fillHorzBackground.value(),f=this._source.properties().horzTransparency.value(),g=this._source.properties().fillVertBackground.value(),m=this._source.properties().vertTransparency.value(),v=0;v<this._hlevels.length;v++)v>0&&_&&(y=this._hlevels[v-1],i=new e.Point(n,this._hlevels[v].y),o=new e.Point(a,y.y),b={},b.points=[i,o],b.color=this._hlevels[v].color,b.linewidth=0,b.backcolor=this._hlevels[v].color,b.fillBackground=!0,b.transparency=f,t.append(new h(b))),i=new e.Point(n,this._hlevels[v].y),o=new e.Point(a,this._hlevels[v].y),w={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._hlevels[v].color,linewidth:u.linewidth.value(),linestyle:u.linestyle.value(),extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},t.append(new c(w)),u.showLeftLabels.value()&&(S={points:[i],text:this._numericFormatter.format(this._hlevels[v].coeff),color:this._hlevels[v].color,vertAlign:"middle",horzAlign:"right",font:u.font.value(),offsetX:-5,offsetY:0,fontsize:12},t.append(new l(S,this._rendererCache))),u.showRightLabels.value()&&(T={points:[o],text:this._numericFormatter.format(this._hlevels[v].coeff),color:this._hlevels[v].color,vertAlign:"middle",horzAlign:"left",font:u.font.value(),offsetX:5,offsetY:0,fontsize:12},t.append(new l(T,this._rendererCache)));for(v=0;v<this._vlevels.length;v++)i=new e.Point(this._vlevels[v].x,s),o=new e.Point(this._vlevels[v].x,p),v>0&&g&&(y=this._vlevels[v-1],C=new e.Point(y.x,s),b={},b.points=[C,o],b.color=this._vlevels[v].color,b.linewidth=0,b.backcolor=this._vlevels[v].color,b.fillBackground=!0,b.transparency=m,t.append(new h(b))),w={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._vlevels[v].color,linewidth:u.linewidth.value(),linestyle:u.linestyle.value(),extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},t.append(new c(w)),u.showTopLabels.value()&&(x={points:[i],text:this._numericFormatter.format(this._vlevels[v].coeff),color:this._vlevels[v].color,vertAlign:"bottom",horzAlign:"center",font:u.font.value(),offsetX:0,offsetY:-5,fontsize:12},t.append(new l(x,this._rendererCache))),u.showBottomLabels.value()&&(P={points:[o],text:this._numericFormatter.format(this._vlevels[v].coeff),color:this._vlevels[v].color,vertAlign:"top",horzAlign:"center",font:u.font.value(),offsetX:0,offsetY:5,fontsize:12},t.append(new l(P,this._rendererCache)));return this.addAnchors(t),t},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n,r,a,l,h,c,d,p,u,_;if(s.prototype.update.call(this),!(this._source.points().length<2)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty()){for(t=this._source.points()[0],e=this._source.points()[1],this._hlevels=[],i=e.price-t.price,this._source.priceScale().isPercent()&&(o=this._source.ownerSource().firstValue()),n=1;n<=7;n++)r="hlevel"+n,a=this._source.properties()[r],a.visible.value()&&(l=a.coeff.value(),h=a.color.value(),c=t.price+l*i,this._source.priceScale().isPercent()&&(c=this._source.priceScale().priceRange().convertToPercent(c,o)),d=this._source.priceScale().priceToCoordinate(c),this._hlevels.push({coeff:l,color:h,y:d}));for(this._vlevels=[],p=e.index-t.index,n=1;n<=7;n++)r="vlevel"+n,a=this._source.properties()[r],a.visible.value()&&(l=a.coeff.value(),h=a.color.value(),u=Math.round(t.index+l*p),_=this._model.timeScale().indexToCoordinate(u),this._vlevels.push({coeff:l,color:h,x:_}))}},inherit(n,r),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Gann Box"},n.prototype.createPropertiesObject=function(t,e,i){return new a(t,e,i,{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]})},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._rendererCache={},this._numericFormatter=new u,this._invalidated=!0}function n(t,e){this._constructor="LineToolFibSpeedResistanceFan";var i=e||this.createPropertiesObject("linetoolfibspeedresistancefan");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(127),l=i(172).ChannelRenderer,h=i(104).TextRenderer,c=i(131).TrendLineRenderer,d=i(94),p=i(98),u=i(82).NumericFormatter;inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n,r,a,l,h,c,d,p,u,_;if(s.prototype.update.call(this),!(this._source.points().length<2)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty()){for(t=this._source.points()[0],e=this._source.points()[1],this._hlevels=[],i=e.price-t.price,this._source.priceScale().isPercent()&&(o=this._source.ownerSource().firstValue()),n=1;n<=7;n++)r="hlevel"+n,a=this._source.properties()[r],a.visible.value()&&(l=a.coeff.value(),h=a.color.value(),c=t.price+l*i,this._source.priceScale().isPercent()&&(c=this._source.priceScale().priceRange().convertToPercent(c,o)),d=this._source.priceScale().priceToCoordinate(c,!0),this._hlevels.push({coeff:l,color:h,y:d,index:n}));for(this._vlevels=[],p=e.index-t.index,n=1;n<=7;n++)r="vlevel"+n,a=this._source.properties()[r],a.visible.value()&&(l=a.coeff.value(),h=a.color.value(),u=Math.round(t.index+l*p),_=this._model.timeScale().indexToCoordinate(u,!0),this._vlevels.push({coeff:l,color:h,x:_,index:n}))}},o.prototype.renderer=function(){var t,i,o,n,s,a,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new p,this._floatPoints.length<2)return t;for(i=this._floatPoints[0],o=this._floatPoints[1],n=Math.min(i.x,o.x),s=Math.min(i.y,o.y),a=Math.max(i.x,o.x),u=Math.max(i.y,o.y),_=this._source.properties(),f=_.grid.color.value(),g=_.grid.linewidth.value(),m=_.grid.linestyle.value(),v=0;v<this._hlevels.length;v++)i=new e.Point(n,this._hlevels[v].y),o=new e.Point(a,this._hlevels[v].y),_.grid.visible.value()&&(y={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:f,linewidth:g,linestyle:m,extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},t.append(new c(y))),_.showLeftLabels.value()&&(b={points:[i],text:this._numericFormatter.format(this._hlevels[v].coeff),color:this._hlevels[v].color,vertAlign:"middle",horzAlign:"right",font:_.font.value(),offsetX:-5,offsetY:0,fontsize:12},t.append(new h(b,this._rendererCache))),_.showRightLabels.value()&&(w={points:[o],text:this._numericFormatter.format(this._hlevels[v].coeff),color:this._hlevels[v].color,vertAlign:"middle",horzAlign:"left",font:_.font.value(),offsetX:5,offsetY:0,fontsize:12},t.append(new h(w,this._rendererCache)));for(v=0;v<this._vlevels.length;v++)i=new e.Point(this._vlevels[v].x,s),o=new e.Point(this._vlevels[v].x,u),_.grid.visible.value()&&(y={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:f,linewidth:g,linestyle:m,extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},t.append(new c(y))),_.showTopLabels.value()&&(S={points:[i],text:this._numericFormatter.format(this._vlevels[v].coeff),color:this._vlevels[v].color,vertAlign:"bottom",horzAlign:"center",font:_.font.value(),offsetX:0,offsetY:-5,fontsize:12},t.append(new h(S,this._rendererCache))),_.showBottomLabels.value()&&(T={points:[o],text:this._numericFormatter.format(this._vlevels[v].coeff),color:this._vlevels[v].color,vertAlign:"top",horzAlign:"center",font:_.font.value(),offsetX:0,offsetY:5,fontsize:12},t.append(new h(T,this._rendererCache)));for(C=_.fillBackground.value(),x=_.transparency.value(),i=this._floatPoints[0],o=this._floatPoints[1],v=0;v<this._hlevels.length;v++)P=new e.Point(o.x,this._hlevels[v].y),v>0&&C&&(L=new e.Point(o.x,this._hlevels[v-1].y),k={},k.width=this._model.timeScale().width(),k.p1=i,k.p2=P,k.p3=i,k.p4=L,k.color=this._hlevels[v].color,k.transparency=x,k.hittestOnBackground=!0,t.append(new l(k))),y={points:[i,P],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._hlevels[v].color,linewidth:_.linewidth.value(),linestyle:_.linestyle.value(),extendleft:!1,extendright:!0,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},E=new d(d.MOVEPOINT,null,{type:"h",index:this._hlevels[v].index}),t.append(new c(y,E));for(v=0;v<this._vlevels.length;v++)I=new e.Point(this._vlevels[v].x,o.y),v>0&&C&&(L=new e.Point(this._vlevels[v-1].x,o.y),k={},k.width=this._model.timeScale().width(),k.p1=i,k.p2=I,k.p3=i,k.p4=L,k.color=this._vlevels[v].color,k.transparency=x,k.hittestOnBackground=!0,t.append(new l(k))),y={points:[i,I],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._vlevels[v].color,linewidth:_.linewidth.value(),linestyle:_.linestyle.value(),extendleft:!1,extendright:!0,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL},E=new d(d.MOVEPOINT,null,{type:"v",index:this._vlevels[v].index}),t.append(new c(y,E));return this.addAnchors(t),t},inherit(n,r),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Fib Speed Resistance Fan"},n.prototype.processErase=function(t,e){var i="h"===e.type?"hlevel"+e.index:"vlevel"+e.index,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},n.prototype.createPropertiesObject=function(t,e,i){return new a(t,e,i,{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]})},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._data=t}function n(t,e){l.call(this,t,e),this._rendererCache={},this._invalidated=!0}function s(t,e){this._constructor="LineToolGannComplex";var i=e||this.createPropertiesObject("linetoolganncomplex");a.call(this,t,new n(this,t),i)}function r(t,e,i){h.call(this,t,e,i,{names:["width","color","visible"]})}var a=i(74).LineDataSource,l=i(103),h=i(127),c=i(131).TrendLineRenderer,d=i(19).isSameType,p=i(94),u=i(98);o.prototype.draw=function(t){var e,i,o,n,s,r;t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.translate(this._data.center.x,this._data.center.y),e=this._data.edge.substract(this._data.center),i=e.y/e.x,o=this._data.point.substract(this._data.center),o.y/=i,n=o.length(),s=this._data.prevPoint.substract(this._data.center),s.y/=i,r=s.length(),t.scale(1,i),this._data.fillBack&&(this._data.point.x<this._data.center.x&&(n=-n,r=-r),t.beginPath(),t.moveTo(r,0),t.lineTo(n,0),t.arcTo(n,n,0,n,Math.abs(n)),t.lineTo(0,r),t.arcTo(r,r,r,0,Math.abs(r)),t.fillStyle=TradingView.generateColor(this._data.color,this._data.transparency,!0),t.fill()),t.beginPath(),this._data.point.x>this._data.center.x?t.arc(0,0,Math.abs(n),0,Math.PI/2,!1):t.arc(0,0,Math.abs(n),-Math.PI/2,-Math.PI,!0),t.scale(1,1/i),t.stroke()},o.prototype.hitTest=function(t){var e,i,o,n,s,r=t.substract(this._data.center),a=this._data.edge.substract(this._data.center),l=a.y/a.x;return r.y/=l,e=this._data.point.substract(this._data.center),e.y/=l,i=e.length(),o=r.length(),n=this._data.prevPoint.substract(this._data.center),n.y/=l,s=n.length(),Math.abs(o-i)<5&&a.x*r.x>=0&&a.y*r.y>=0?new p(p.MOVEPOINT):this._data.fillBack&&o>=s&&o<=i&&a.x*r.x>=0&&a.y*r.y>=0?new p(p.MOVEPOINT_BACKGROUND):null},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this),this._source._cornerPoint&&this._points.push(this._source.pointToScreenPoint(this._source._cornerPoint)[0])},n.prototype.renderer=function(){var t,i,n,s,r,l,h,d,p,_,f,g,m,v,y,b,w,S,T,C,x,P;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=this._source.properties(),i=new u,this._points.length<2)return this.addAnchors(i),i;for(n=this._points[0],s=3===this._points.length?this._points[2]:this._points[1],r=this._points[1],d=0;d<6;d++)p=t.levels[d],p.visible.value()&&(_=d/5,l=n.x+_*(s.x-n.x),f=n.y,g=s.y,m={points:[new e.Point(l,f),new e.Point(l,g)],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:p.color.value(),linewidth:p.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},i.append(new c(m)),h=n.y+_*(s.y-n.y),v=n.x,y=s.x,m={points:[new e.Point(v,h),new e.Point(y,h)],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:p.color.value(),linewidth:p.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},i.append(new c(m)));for(d in t.fanlines._childs)b=t.fanlines[d],b.visible.value()&&(w=b.x.value(),S=b.y.value(),w>S?(l=s.x,_=S/w,h=n.y+_*(s.y-n.y)):(h=s.y,_=w/S,l=n.x+_*(s.x-n.x)),m={points:[n,new e.Point(l,h)],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:b.color.value(),linewidth:b.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},i.append(new c(m)));T=n;for(d in t.arcs._childs)C=t.arcs[d],C.visible.value()&&(w=C.x.value()/5,S=C.y.value()/5,l=n.x+w*(s.x-n.x),h=n.y+S*(s.y-n.y),x={center:n,point:new e.Point(l,h),edge:s,color:C.color.value(),linewidth:C.width.value(),fillBack:t.arcsBackground.fillBackground.value(),transparency:t.arcsBackground.transparency.value(),prevPoint:T},i.append(new o(x)),T=x.point);return this.isAnchorsRequired()&&(P=[n,r],this._model.lineBeingCreated()===this._source&&P.pop(),i.append(this.createLineAnchor({points:P}))),i},inherit(s,a),s.prototype._recalcSecondPoint=function(){var t,e,i,o,n,s=this._model.mainSeries().properties().style.value(),r=this._model.mainSeries().interval();s===this._currentStyle&&r===this._currentInterval||(t=this.pointToScreenPoint(this.points()[0])[0],e=this.pointToScreenPoint(this.points()[2])[0],i=e.substract(t),o=t.add(i.scaled(.2/Math.sqrt(2))),n=this.screenPointToPoint(o),this._points[1]=n)},s.prototype.pointsCount=function(){return 2},s.prototype.title=function(){return"Gann Square"},s.prototype._fixThirdPoint=function(t){var i,o,n,s,r,a,l,h;this.points().length<2||(i=this.pointToScreenPoint(this.points()[0])[0],o=this.pointToScreenPoint(this.points()[1])[0],n=o.substract(i),t?(s=i.add(n.scaled(5*Math.sqrt(2))),this._cornerPoint=this.screenPointToPoint(s)):(r=n.x<0?-1:1,a=n.y<0?-1:1,l=o.substract(i).length(),s=i.add(new e.Point(5*l*r,5*l*a)),h=this.screenPointToPoint(s),this._cornerPoint=h))},s.prototype.setPoint=function(t,e,i){var o,n,s=a.prototype.setPoint.call(this,t,e,i),r=i&&i.shift;return this._fixThirdPoint(r),this._points[2]=this._cornerPoint,delete this._cornerPoint,o=this._model.mainSeries().properties().style.value(),n=this._model.mainSeries().interval(),this._currentStyle=o,this._currentInterval=n,s},s.prototype.setLastPoint=function(t,e){var i=a.prototype.setLastPoint.call(this,t,e),o=e&&e.shift;return this._fixThirdPoint(o),i},s.prototype.addPoint=function(t,e){var i,o,n,s,r=$.extend({},t),a=this._model.mainSeries().properties().style.value(),l=this._model.mainSeries().interval();return this._currentStyle=a,this._currentInterval=l,i=this.priceScale(),i.isPercent()&&(o=this.ownerSource().firstValue(),r.price=i.priceRange().convertFromPercent(r.price,o)),n=e&&e.shift,this._points.push(r),this._lastPoint=null,s=this._points.length===this.pointsCount(),s?(this._fixThirdPoint(n),this._points.push(this._cornerPoint),delete this._cornerPoint,this.normalizePoints(),this.createServerPoints()):this._lastPoint=r,s},s.prototype.onData=function(t){a.prototype.onData.call(this,t),this._recalcSecondPoint()},inherit(r,h),r.prototype._iterateLevels=function(t,e){var i,o,n;for(i in t.levels)if(t.levels[i]&&d(t.levels[i],e.typecheck())){o=e.tpl();for(n in this._map.names)o=e.fill(n,this._map.names[n],t.levels[i],o);t.levels[i]=o}return t},s.prototype.createPropertiesObject=function(t,e,i){return new r(t,e,i)},t.exports=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){r.call(this,t,e),this._rendererCache={},this._invalidated=!0}function n(t,e){this._constructor="LineToolGannFan";var i=e||this.createPropertiesObject("linetoolgannfan");s.call(this,t,new o(this,t),i)}var s=i(74).LineDataSource,r=i(103),a=i(127),l=i(172).ChannelRenderer,h=i(104).TextRenderer,c=i(131).TrendLineRenderer,d=i(94),p=i(98);inherit(o,r),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n,s,a,l,h,c,d,p,u,_;if(r.prototype.update.call(this),!(this._source.points().length<2)&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&!this._model.timeScale().isEmpty())for(t=this._floatPoints[0],e=this._floatPoints[1],this._fans=[],i=e.x-t.x,o=e.y-t.y,a=1;a<=9;a++)l="level"+a,h=this._source.properties()[l],h.visible.value()&&(c=h.coeff1.value(),d=h.coeff2.value(),p=c/d,u=h.color.value(),_=""+c+"/"+d,c>d?(n=e.x,s=t.y+o/p):(n=t.x+i*p,s=e.y),this._fans.push({label:_,color:u,x:n,y:s,linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),index:a}))},o.prototype.renderer=function(){var t,i,o,n,r,a,u,_,f,g,m,v;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new p,this._floatPoints.length<2)return t;for(i=this._floatPoints[0],o=this._source.properties(),n=this._source.properties().fillBackground.value(),r=this._source.properties().transparency.value(),a=0;a<this._fans.length;a++)u=new e.Point(this._fans[a].x,this._fans[a].y),n&&(this._fans[a].index<4?(_=new e.Point(this._fans[a+1].x,this._fans[a+1].y),f={},f.width=this._model.timeScale().width(),f.p1=i,f.p2=u,f.p3=i,f.p4=_,f.color=this._fans[a].color,f.transparency=r,f.hittestOnBackground=!0,t.append(new l(f))):this._fans[a].index>4&&a>0&&(_=new e.Point(this._fans[a-1].x,this._fans[a-1].y),f={},f.width=this._model.timeScale().width(),f.p1=i,f.p2=u,f.p3=i,f.p4=_,f.color=this._fans[a].color,f.transparency=r,f.hittestOnBackground=!0,t.append(new l(f)))),g={points:[i,u],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:this._fans[a].color,linewidth:this._fans[a].linewidth,linestyle:this._fans[a].linestyle,extendleft:!1,extendright:!0,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL},m=new d(d.MOVEPOINT,null,this._fans[a].index),t.append(new c(g,m)),o.showLabels.value()&&(v={points:[u],text:this._fans[a].label,color:this._fans[a].color,vertAlign:"middle",horzAlign:"left",font:o.font.value(),offsetX:0,offsetY:-5,fontsize:12},t.append(new h(v,this._rendererCache)));return this.addAnchors(t),t},inherit(n,s),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Gann Fan"},n.prototype.processErase=function(t,e){var i="level"+e,o=this.properties()[i].visible;t.setProperty(o,!1,"Erase level line")},n.prototype.createPropertiesObject=function(t,e,i){return new a(t,e,i,{range:[1,9]})},t.exports=n}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e){a.call(this,t,e),this._label=null,this._rendererCache={},this._invalidated=!0}function n(t,e){this._constructor="LineToolDisjointAngle";var i=e||new p("linetooldisjointangle");l.call(this,t,new o(this,t),i),this.version=n.version}var s=i(131).TrendLineRenderer,r=i(172).ChannelRenderer,a=i(103),l=i(74).LineDataSource,h=i(104).TextRenderer,c=i(158),d=i(98),p=i(80).DefaultProperty;inherit(o,a),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o;a.prototype.update.call(this),this._label=null,this._source.points().length<2||this._source.priceScale()&&(t=this._source.points()[0],e=this._source.points()[1],this._price1=this._source.priceScale().formatter().format(t.price),this._price2=this._source.priceScale().formatter().format(e.price),3===this._source.points().length&&(i=this._source.points()[2],this._price3=this._source.priceScale().formatter().format(i.price),o=e.price-t.price,this._price4=this._source.priceScale().formatter().format(i.price+o)))},o.prototype.renderer=function(){var t,e,i,o,n,a,l,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new d,this._points.length<2?t:(e=this._points[0],i=this._points[1],a=this._source.properties(),l=this._model,p=this._source,a=p.properties(),this._points.length>=3&&(o=this._points[2],o.x=i.x,u=i.y-e.y,n=e.clone(),n.y=o.y+u,n.data=3,a.fillBackground.value()&&(_={},f=l.timeScale().width(),g=a.extendLeft.value(),m=a.extendRight.value(),g||m?!g&&m?(v={},v.width=f,v.p1=e,v.p2=i,v.p3=n,v.p4=o,v.color=a.backgroundColor.value(),v.transparency=a.transparency.value(),v.hittestOnBackground=TradingView.isMobile.any(),t.append(new r(v))):g&&!m?(v={},v.width=f,v.p1=i,v.p2=e,v.p3=o,v.p4=n,v.color=a.backgroundColor.value(),v.transparency=a.transparency.value(),v.hittestOnBackground=TradingView.isMobile.any(),t.append(new r(v))):(y=e.add(i).scaled(.5),b=n.add(o).scaled(.5),
w={},w.width=f,w.p1=y,w.p2=i,w.p3=b,w.p4=o,w.color=a.backgroundColor.value(),w.transparency=a.transparency.value(),w.hittestOnBackground=TradingView.isMobile.any(),t.append(new r(w)),S={},S.width=f,S.p1=y,S.p2=e,S.p3=b,S.p4=n,S.color=a.backgroundColor.value(),S.transparency=a.transparency.value(),S.hittestOnBackground=TradingView.isMobile.any(),t.append(new r(S))):(_.points=[e,i,o,n],_.color="rgba(0,0,0,0)",_.linewidth=0,_.linestyle=CanvasEx.LINESTYLE_SOLID,_.filled=!0,_.backcolor=a.backgroundColor.value(),_.fillBackground=!0,_.transparency=a.transparency.value(),t.append(new c(_))))),T=function(t,e){var i={points:[t,e],width:l.timeScale().width(),height:p.priceScale().height(),color:a.linecolor.value(),linewidth:a.linewidth.value(),linestyle:a.linestyle.value(),extendleft:a.extendLeft.value(),extendright:a.extendRight.value(),leftend:a.leftEnd.value(),rightend:a.rightEnd.value()};return i},t.append(new s(T(e,i))),C=this,x=function(e,i,o,n){var s;C._source.properties().showPrices.value()&&(s={points:[e],text:o,color:C._source.properties().textcolor.value(),horzAlign:e.x>i.x?"left":"right",vertAlign:"middle",font:C._source.properties().font.value(),offsetX:e.x>i.x?-5:5,offsetY:-5,bold:C._source.properties().bold.value(),italic:C._source.properties().italic.value(),fontsize:C._source.properties().fontsize.value()},t.append(new h(s,C._rendererCache)),s={points:[i],text:n,color:C._source.properties().textcolor.value(),horzAlign:e.x<i.x?"left":"right",vertAlign:"middle",font:C._source.properties().font.value(),offsetX:e.x>i.x?-5:5,offsetY:-5,bold:C._source.properties().bold.value(),italic:C._source.properties().italic.value(),fontsize:C._source.properties().fontsize.value()},t.append(new h(s,C._rendererCache)))},t.append(new s(T(e,i))),x(e,i,this._price1,this._price2),2===this._points.length?(this.addAnchors(t),t):(t.append(new s(T(n,o))),x(o,n,this._price3,this._price4),this.isAnchorsRequired()&&(P=[e,i,o,n],this._model.lineBeingCreated()===this._source&&P.pop(),t.append(this.createLineAnchor({points:P}))),!TradingView.printing&&this._source.hasAlert.value()&&!this._model.readOnly()&&e&&i&&this._source.getAlertIsActive(function(o){t.append(new TradingView.PaneRendererClockIcon({point1:e,point2:i,color:o?a.linecolor.value():defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),t))},inherit(n,l),n.version=1,n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Disjoint Angle"},n.prototype.addPoint=function(t,e){return e&&e.shift&&2===this.points().length&&this._snapPoint45Degree(t,this.points()[this.points().length-2]),l.prototype.addPoint.call(this,t)},n.prototype.setLastPoint=function(t,e){return e&&e.shift&&2===this.points().length&&this._snapPoint45Degree(t,this.points()[this.points().length-2]),l.prototype.setLastPoint.call(this,t)},n.prototype.setPoint=function(t,e,i){var o,n,s,r,a,h=.5*(this._points[1].price+this._points[2].price);i&&i.shift&&1===t&&(o=0,this._snapPoint45Degree(e,this.points()[o])),t<3&&l.prototype.setPoint.call(this,t,e),0!==t&&2!==t&&(1===t?(n=this._points[1].price-h,this._points[2].price=this._points[1].price-2*n):3===t&&(s=this.priceScale(),r=e.price,s.isPercent()&&(a=this.ownerSource().firstValue(),r=s.priceRange().convertFromPercent(r,a)),n=r-this._points[2].price,this._points[0].price=this._points[1].price-n,this._points[0].index=e.index))},n.prototype.canHasAlert=function(){return!0},n.prototype._getAlertPlots=function(){var t,e,i,o,n,s,r,a,l,h=this._points[0],c=this._points[1],d=[];return h.index<=c.index?(d.push(h),d.push(c)):(d.push(c),d.push(h)),t=this._points[2],t.time=c.time,t.index=c.index,e={price:t.price+(c.price-h.price),time:h.time,index:h.index},i=[],t.index<=e.index?(i.push(t),i.push(e)):(i.push(e),i.push(t)),d[0].price>i[0].price?(o=d,n=i):i[0].price>d[0].price?(o=i,n=d):i[1].price>d[1].price?(o=i,n=d):(o=d,n=i),a=this.properties().extendLeft.value(),l=this.properties().extendRight.value(),h.index<=c.index?(s=a,r=l):(s=l,r=a),[this._linePointsToAlertPlot(o,"Upper",s,r),this._linePointsToAlertPlot(n,"Lower",s,r)]},t.exports=n},function(t,e,i){"use strict";function o(t,e){s.call(this,t,e),this._label1=null,this._label2=null,this._rendererCache={},this._invalidated=!0}function n(t,e){this._constructor="LineToolFlatBottom";var i=e||new p("linetoolflatbottom");r.call(this,t,new o(this,t),i),this.version=n.version}var s=i(103),r=i(74).LineDataSource,a=i(172).ChannelRenderer,l=i(131).TrendLineRenderer,h=i(104).TextRenderer,c=i(158),d=i(98),p=i(80).DefaultProperty;inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i;s.prototype.update.call(this),this._label1=null,this._label2=null,this._source.points().length<2||this._source.priceScale()&&(t=this._source.points()[0],e=this._source.points()[1],this._price1=this._source.priceScale().formatter().format(t.price),this._price2=this._source.priceScale().formatter().format(e.price),3===this._source.points().length&&(i=this._source.points()[2],this._price3=this._source.priceScale().formatter().format(i.price)))},o.prototype.renderer=function(){var t,e,i,o,n,s,r,p,u,_,f,g,m,v,y,b,w,S,T,C,x;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new d,this._points.length<2?t:(e=this._points[0],i=this._points[1],s=this._source.properties(),r=this._model,p=this._source,3===this._points.length&&(o=this._points[2],o.x=i.x,n=e.clone(),n.y=o.y,n.data=3,s.fillBackground.value()&&(u={},_=r.timeScale().width(),f=s.extendLeft.value(),g=s.extendRight.value(),f||g?!f&&g?(m={},m.width=_,m.p1=e,m.p2=i,m.p3=n,m.p4=o,m.color=s.backgroundColor.value(),m.transparency=s.transparency.value(),m.hittestOnBackground=TradingView.isMobile.any(),t.append(new a(m))):f&&!g?(m={},m.width=_,m.p1=i,m.p2=e,m.p3=o,m.p4=n,m.color=s.backgroundColor.value(),m.transparency=s.transparency.value(),m.hittestOnBackground=TradingView.isMobile.any(),t.append(new a(m))):(v=e.add(i).scaled(.5),y=n.add(o).scaled(.5),b={},b.width=_,b.p1=v,b.p2=i,b.p3=y,b.p4=o,b.color=s.backgroundColor.value(),b.transparency=s.transparency.value(),b.hittestOnBackground=TradingView.isMobile.any(),t.append(new a(b)),w={},w.width=_,w.p1=v,w.p2=e,w.p3=y,w.p4=n,w.color=s.backgroundColor.value(),w.transparency=s.transparency.value(),w.hittestOnBackground=TradingView.isMobile.any(),t.append(new a(w))):(u.points=[e,i,o,n],u.color="rgba(0,0,0,0)",u.linewidth=0,u.linestyle=CanvasEx.LINESTYLE_SOLID,u.filled=!0,u.backcolor=s.backgroundColor.value(),u.fillBackground=!0,u.transparency=s.transparency.value(),t.append(new c(u))))),S=function(t,e){var i={points:[t,e],width:r.timeScale().width(),height:p.priceScale().height(),color:s.linecolor.value(),linewidth:s.linewidth.value(),linestyle:s.linestyle.value(),extendleft:s.extendLeft.value(),extendright:s.extendRight.value(),leftend:s.leftEnd.value(),rightend:s.rightEnd.value()};return i},t.append(new l(S(e,i))),2===this._points.length?(this.addAnchors(t),t):(T=this,C=function(e,i,o,n){var s;T._source.properties().showPrices.value()&&(s={points:[e],text:o,color:T._source.properties().textcolor.value(),horzAlign:e.x>i.x?"left":"right",vertAlign:"middle",font:T._source.properties().font.value(),offsetX:e.x>i.x?-5:5,offsetY:-5,bold:T._source.properties().bold.value(),italic:T._source.properties().italic.value(),fontsize:T._source.properties().fontsize.value()},t.append(new h(s,T._rendererCache)),s={points:[i],text:n,color:T._source.properties().textcolor.value(),horzAlign:e.x<i.x?"left":"right",vertAlign:"middle",font:T._source.properties().font.value(),offsetX:e.x>i.x?-5:5,offsetY:-5,bold:T._source.properties().bold.value(),italic:T._source.properties().italic.value(),fontsize:T._source.properties().fontsize.value()},t.append(new h(s,T._rendererCache)))},t.append(new l(S(e,i))),C(e,i,this._price1,this._price2),2===this._points.length?t:(t.append(new l(S(n,o))),C(o,n,this._price3,this._price3),this.isAnchorsRequired()&&(x=[e,i,o,n],this._model.lineBeingCreated()===this._source&&x.pop(),t.append(this.createLineAnchor({points:x}))),!TradingView.printing&&this._source.hasAlert.value()&&!this._model.readOnly()&&e&&i&&this._source.getAlertIsActive(function(o){t.append(new TradingView.PaneRendererClockIcon({point1:e,point2:i,color:o?s.linecolor.value():defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),t)))},inherit(n,r),n.version=1,n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Flat Bottom"},n.prototype.addPoint=function(t,e){return e&&e.shift&&2===this.points().length&&this._snapPoint45Degree(t,this.points()[this.points().length-2]),r.prototype.addPoint.call(this,t)},n.prototype.setLastPoint=function(t,e){return e&&e.shift&&2===this.points().length&&this._snapPoint45Degree(t,this.points()[this.points().length-2]),r.prototype.setLastPoint.call(this,t)},n.prototype.setPoint=function(t,e,i){if(i&&i.shift&&1===t){var o=0;this._snapPoint45Degree(e,this.points()[o])}t<3?r.prototype.setPoint.call(this,t,e):this._points[0].index=e.index},n.prototype.canHasAlert=function(){return!0},n.prototype._getAlertPlots=function(){var t,e,i,o,n,s,r,a,l,h=this._points[0],c=this._points[1],d=[];return h.index<=c.index?(d.push(h),d.push(c)):(d.push(c),d.push(h)),t=this._points[2],t.time=c.time,t.index=c.index,e={price:t.price,time:h.time,index:h.index},i=[],t.index<=e.index?(i.push(t),i.push(e)):(i.push(e),i.push(t)),d[0].price>i[0].price?(o=d,n=i):i[0].price>d[0].price?(o=i,n=d):i[1].price>d[1].price?(o=i,n=d):(o=d,n=i),a=this.properties().extendLeft.value(),l=this.properties().extendRight.value(),h.index<=c.index?(s=a,r=l):(s=l,r=a),[this._linePointsToAlertPlot(o,"Upper",s,r),this._linePointsToAlertPlot(n,"Lower",a,r)]},t.exports=n},function(t,e,i){(function(e){"use strict";function o(t,e){this._data=t,this._cache=e}function n(t,e){r.call(this,t,e),this._cache={},this._invalidated=!0}function s(t,e){this._constructor="LineToolIcon";var i=e||new d("linetoolicon");i.addExclusion("angle"),i.addExclusion("scale"),a.call(this,t,new n(this,t),i),this.version=s.version}var r=i(103),a=i(74).LineDataSource,l=i(131).TrendLineRenderer,h=i(94),c=i(98),d=i(80).DefaultProperty;o.prototype.draw=function(t){var e,i,o,n=String.fromCharCode(this._data.icon);t.font=this._data.size+"px FontAwesome",e=t.measureText(n).width,t.textBaseline="middle",i=this._data.point,t.translate(i.x,i.y),t.rotate(this._data.angle-Math.PI/2),t.scale(this._data.scale,1),o=65536*this._data.icon+this._data.size,this._cache[o]=e,this._data.selected&&(t.fillStyle="rgba(80, 80, 80, 0.2)",t.fillRect(-this._cache[o]/2,-this._data.size/2,this._cache[o],this._data.size)),t.fillStyle=this._data.color,t.fillText(n,-this._cache[o]/2,0)},o.prototype.hitTest=function(t){var i=65536*this._data.icon+this._data.size,o=this._cache[i]*this._data.scale,n=e.Matrix.rotate(-this._data.angle),s=t.substract(this._data.point);return s=n.mult(s),Math.abs(s.y)<=o/2&&Math.abs(s.x)<=this._data.size/2?new h(h.MOVEPOINT):null},inherit(n,r),n.anchorLimit=80,n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){r.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var t,i,s,r,h,d,p,u,_,f,g,m,v,y,b,w,S,T;return this._invalidated&&this.updateImpl(),t=new c,this._points.length<1?t:(i=this._source.properties(),s={point:this._points[0],color:i.color.value(),size:i.size.value(),icon:i.icon.value(),angle:i.angle.value(),scale:i.scale.value(),selected:this.isAnchorsRequired()},r=this._model,h=this._source,t.append(new o(s,this._cache)),this.isAnchorsRequired()&&(d=65536*s.icon+s.size,p=this._cache[d],u=s.size,_=this._points[0],f=i.scale.value(),g=new e.Point(Math.max(n.anchorLimit,u)/2,0),m=new e.Point(0,Math.max(n.anchorLimit,f*p)/2),v=e.Matrix.rotate(i.angle.value()),g=v.mult(g),m=v.mult(m),y=_.add(g),y.data=0,b=_.substract(g),b.data=1,w=_.add(m),w.data=2,w.square=!0,S=_.substract(m),S.data=3,S.square=!0,s={points:[y,b],width:r.timeScale().width(),height:h.priceScale().height(),color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},T=new l(s),T._hittest=null,t.append(T),t.append(this.createLineAnchor({points:[y,b,w,S]}))),t)},s._getAvailIcons=function(){var t,e,i=[];for(i=i.concat([61536,61537,61538,61539]),i=i.concat([61725,61726]),i=i.concat([61575,61576,61796,61797]),i=i.concat([61779,61780,61781,61782,61783,61784,61785,61786]),t=i.slice(0),e=61440;e<=61846;e++)$.inArray(e,i)===-1&&(e%16===15&&61487!==e||e>=61620&&e<=61630||61718!==e&&61719!==e&&61472!==e&&61619!==e&&t.push(e));return t},s.availIcons=s._getAvailIcons(),inherit(s,a),s.version=1,s.prototype.pointsCount=function(){return 1},s.prototype.title=function(){return"Icon"},s.prototype.startChanging=function(t,e){var i,o;a.prototype.startChanging.call(this,t,e),i=this.properties(),o=65536*i.icon.value()+i.size.value(),this._startChangeWidth=this._paneViews[0]._cache[o],i.size.value()<n.anchorLimit?this._sizeScale=i.size.value()/n.anchorLimit:this._sizeScale=1,this._origScale=i.scale.value(),this._startChangeWidth*this._origScale<n.anchorLimit?this._resizeRatio=this._startChangeWidth/n.anchorLimit:this._resizeRatio=1},s.prototype.endChanging=function(){a.prototype.endChanging.call(this),delete this._startChangeWidth,delete this._sizeScale,delete this._resizeRatio},s.prototype.setPoint=function(t,e,i){var o,s,r,a,l,h,c,d,p,u,_=$.extend({},e),f=this.priceScale();f.isPercent()&&(o=this.ownerSource().firstValue(),_.price=f.priceRange().convertFromPercent(_.price,o)),i&&i.shift&&this._properties.snapTo45Degrees&&this._snapPoint45Degree(_,this.points()[0]),s=this.pointToScreenPoint(this.points()[0])[1],r=this.pointToScreenPoint(_)[1],0===t||1===t?(a=r.substract(s).normalized(),l=2*r.substract(s).length(),l*=this._sizeScale,this._properties.size.setValue(l),h=-a.x,c=Math.acos(h),Math.asin(a.y)>0&&(c=2*Math.PI-c),0===t&&(c+=Math.PI),this._properties.angle.setValue(c)):(d=this._startChangeWidth,p=r.substract(s).length(),this._origScale*d<n.anchorLimit?(u=n.anchorLimit/2,this._properties.scale.setValue(this._origScale*p/u)):(u=d/2,this._properties.scale.setValue(p/u)))},t.exports=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){r.call(this,t,e),this._invalidated=!0}function n(t,e){this._constructor="LineToolRotatedRectangle";var i=e||new c("linetoolrotatedrectangle");s.call(this,t,new o(this,t),i)}var s=i(74).LineDataSource,r=i(103),a=i(131).TrendLineRenderer,l=i(158),h=i(98),c=i(80).DefaultProperty;inherit(o,r),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){r.prototype.update.call(this),this._distance=0,3===this._points.length&&(this._distance=e.distanceToLine(this._points[0],this._points[1],this._points[2]).distance)},o.prototype.renderer=function(){var t,i,o,n,r,c,d,p,u,_,f,g,m;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new h,i=this._source.properties(),o=this._points[0],n=this._points[1],2===this._points.length?(u={},u.points=this._points,u.floatPoints=this._floatPoints,u.width=this._model.timeScale().width(),u.height=this._source.priceScale().height(),u.color=i.color.value(),u.linewidth=1,u.linestyle=CanvasEx.LINESTYLE_SOLID,u.extendleft=!1,u.extendright=!1,u.leftend=s.LINEEND_NORMAL,u.rightend=s.LINEEND_NORMAL,t.append(new a(u))):3===this._points.length&&(_=n.substract(o),f=new e.Point(_.y,-_.x).normalized().scaled(this._distance),g=f.scaled(-1),r=o.add(f),c=n.add(f),d=o.add(g),p=n.add(g),u={},u.points=[r,c,p,d],u.color=i.color.value(),u.linewidth=this._source.properties().linewidth.value(),u.linestyle=CanvasEx.LINESTYLE_SOLID,u.filled=!0,u.backcolor=i.backgroundColor.value(),u.fillBackground=i.fillBackground.value(),u.transparency=i.transparency.value(),t.append(new l(u))),this.isAnchorsRequired()&&(m=[],m.push(o),this._points.length>=2&&m.push(n),3===this._points.length&&(r.data=2,d.data=2,c.data=2,p.data=2,m.push(r),m.push(d),m.push(c),m.push(p)),t.append(this.createLineAnchor({points:m}))),t},inherit(n,s),n.prototype.startChanging=function(t,i){var o,n,r,a;s.prototype.startChanging.call(this,t,i),0!==t&&1!==t||(o=this._paneViews[0],n=o._points[0],r=o._points[1],a=o._points[2],this._distance=e.distanceToLine(n,r,a).distance)},n.prototype.setPoint=function(t,i,o){var n,r,a,l,h,c,d;s.prototype.setPoint.call(this,t,i,o),0!==t&&1!==t||(n=this._paneViews[0],n.update(),r=n._points[0],a=n._points[1],l=a.substract(r),h=new e.Point(l.y,-l.x).normalized().scaled(this._distance),c=r.add(h),d=this.screenPointToPoint(c),this._points[2]=d)},n.prototype.endChanging=function(){delete this._distance},n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Rotated Rectangle"},t.exports=n}).call(e,i(21))},function(t,e,i){"use strict";function o(t){this._data=t}function n(t,e){a.call(this,t,e),this._invalidated=!0}function s(t,e){this._constructor="LineToolFibSpiral";var i=e||new d("linetoolfibspiral");r.call(this,t,new n(this,t),i)}var r=i(74).LineDataSource,a=i(103),l=i(131).TrendLineRenderer,h=i(94),c=i(98),d=i(80).DefaultProperty;o.prototype._fibNumbers=function(){return[0,1,2,3,5,8,13,21,34,55,89]},o.prototype._continiusFib=function(t){var e,i,o,n=this._fibNumbers(),s=Math.floor(t),r=Math.ceil(t);return r>=n.length?null:(e=t-s,e=Math.pow(e,1.15),i=n[r]-n[s],o=n[s]+i*e)},o.prototype.hitTest=function(t){var e,i,o,n,s=this._data.points[0],r=this._data.points[1],a=r.substract(s),l=t.substract(s),c=a.normalized(),d=c.transponed(),p=l.normalized(),u=Math.acos(c.dotProduct(p)),_=Math.asin(d.dotProduct(p));for(_<0&&(u=2*Math.PI-u),e=l.length(),i=0;i<4;i++)if(o=u/(.5*Math.PI),n=this._continiusFib(o+4*i),n=n*a.length()/5,null!==n&&Math.abs(n-e)<5)return new h(h.MOVEPOINT);return null},o.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d,p;for(t.lineCap="round",t.strokeStyle=this._data.color,e=this._data.points[0],i=this._data.points[1],t.translate(e.x,e.y),o=i.substract(e),n=o.length(),o=o.normalized(),s=Math.acos(o.x),Math.asin(o.y)<0&&(s=2*Math.PI-s),t.rotate(s),t.scale(n/5,n/5),t.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(t,this._data.linestyle),r=50,a=Math.PI/(2*r),t.moveTo(0,0),l=0;l<(this._fibNumbers().length-1)*r;l++)h=l*a,c=this._continiusFib(l/r),d=Math.cos(h)*c,p=Math.sin(h)*c,t.lineTo(d,p);t.scale(5/n,5/n),t.rotate(-s),t.stroke()},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var t,e;return this._invalidated&&this.updateImpl(),t=new c,this._floatPoints.length<2?t:(e={},e.points=this._floatPoints,e.width=this._model.timeScale().width(),e.height=this._source.priceScale().height(),e.color=this._source.properties().linecolor.value(),e.linewidth=this._source.properties().linewidth.value(),e.linestyle=this._source.properties().linestyle.value(),e.extendleft=!1,e.extendright=!0,e.leftend=r.LINEEND_NORMAL,e.rightend=r.LINEEND_NORMAL,t.append(new l(e)),e={},e.points=this._floatPoints,e.width=this._model.timeScale().width(),e.height=this._source.priceScale().height(),e.color=this._source.properties().linecolor.value(),e.linewidth=this._source.properties().linewidth.value(),e.linestyle=this._source.properties().linestyle.value(),t.append(new o(e)),this.isAnchorsRequired()&&this.addAnchors(t),t)},inherit(s,r),s.prototype.pointsCount=function(){return 2},s.prototype.title=function(){return"Fib Spiral"},t.exports=s},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._rendererCache={},this._invalidated=!0}function n(t,e){this._constructor="LineToolHeadAndShoulders";var i=e||new d("linetoolheadandshoulders");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(131).TrendLineRenderer,l=i(183).TriangleRenderer,h=i(104).TextRenderer,c=i(98),d=i(80).DefaultProperty;inherit(o,s),o.prototype.renderer=function(){var t,e,i,o,n,s,d,p,u,_,f,g,m,v,y;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2)return null;for(t=this._source.properties(),e=new c,i=this,o=function(e,o){var n={points:[e],text:$.t(o),color:t.textcolor.value(),horzAlign:"center",font:t.font.value(),offsetX:0,offsetY:0,bold:t.bold&&t.bold.value(),italic:t.italic&&t.italic.value(),fontsize:t.fontsize.value(),backgroundColor:i._source.properties().color.value(),backgroundRoundRect:4};return n},n=function(e,o,n,s){var a={points:[e,o],width:i._model.timeScale().width(),height:i._source.priceScale().height(),color:TradingView.generateColor(i._source.properties().color.value(),n),linewidth:s||t.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL};return a},s=function(e,i,o){var n=[e,i,o],s={};return s.points=n,s.color=t.color.value(),s.linewidth=0,s.backcolor=t.backgroundColor.value(),s.fillBackground=t.fillBackground.value(),s.transparency=t.transparency.value(),s},d=1;d<this._points.length;d++)p=n(this._points[d-1],this._points[d],0),e.append(new a(p));return this._points.length>=5&&(f=!1,g=!1,this._intersect1?u=this._intersect1:(u=this._points[2],f=!0),this._intersect2?_=this._intersect2:(_=this._points[4],g=!0),p=n(u,_,0),p.extendleft=f,p.extendright=g,e.append(new a(p)),m=s(this._points[2],this._points[3],this._points[4]),e.append(new l(m))),this._intersect1&&(m=s(this._intersect1,this._points[1],this._points[2]),e.append(new l(m))),this._intersect2&&(m=s(this._points[4],this._points[5],this._intersect2),e.append(new l(m))),this._points.length>=2&&(v=this._points[1],y=o(v,"Left Shoulder"),this._points[1].y<this._points[0].y?(y.vertAlign="bottom",y.offsetY=-10):(y.vertAlign="top",y.offsetY=5),e.append(new h(y,this._rendererCache))),this._points.length>=4&&(v=this._points[3],y=o(v,"Head"),this._points[3].y<this._points[2].y?(y.vertAlign="bottom",y.offsetY=-10):(y.vertAlign="top",y.offsetY=5),e.append(new h(y,this._rendererCache))),this._points.length>=6&&(v=this._points[5],y=o(v,"Right Shoulder"),this._points[5].y<this._points[4].y?(y.vertAlign="bottom",y.offsetY=-10):(y.vertAlign="top",y.offsetY=5),e.append(new h(y,this._rendererCache))),this.addAnchors(e),e},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,i,o,n,r,a,l,h;s.prototype.update.call(this),delete this._intersect1,delete this._intersect2,this._points.length>=5&&(t=this._points[0],i=this._points[1],o=this._points[2],n=this._points[4],r=e.intersectSegment(o,n,t,i),null!==r&&(a=n.substract(o),this._intersect1=o.add(a.scaled(r))),7===this._points.length&&(l=this._points[5],h=this._points[6],r=e.intersectSegment(o,n,l,h),null!==r&&(a=n.substract(o),this._intersect2=o.add(a.scaled(r)))))},inherit(n,r),n.prototype.pointsCount=function(){return 7},n.prototype.title=function(){return"Head & Shoulders"},t.exports=n}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(t){this._data=t}function n(t,e){a.call(this,t,e),this._invalidated=!0}function s(t,e){this._constructor="LineToolTriangle";var i=e||new c("linetooltriangle");r.call(this,t,new n(this,t),i)}var r=i(74).LineDataSource,a=i(103),l=i(94),h=i(98),c=i(80).DefaultProperty;o.prototype.draw=function(t){var e,i,o;this._data.points.length<2||(t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,e=this._data.points[0],i=this._data.points[1],o=2===this._data.points.length?i:this._data.points[2],t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(i.x,i.y),t.lineTo(o.x,o.y),t.lineTo(e.x,e.y),this._data.fillBackground&&(t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),t.fill()),t.stroke())},o.prototype.hitTest=function(e){var i,o,n,s,r;return this._data.points.length<2?null:(i=this._data.points[0],o=this._data.points[1],n=this._data.points[2],s=3,r=t.distanceToSegment(i,o,e),r.distance<=s?new l(l.MOVEPOINT):(r=t.distanceToSegment(o,n,e),r.distance<=s?new l(l.MOVEPOINT):(r=t.distanceToSegment(n,i,e),r.distance<=s?new l(l.MOVEPOINT):this._data.fillBackground&&t.pointInTriangle(i,o,n,e)?new l(l.MOVEPOINT_BACKGROUND):null)))},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var t,e;return this._invalidated&&this.updateImpl(),t={},t.points=this._points,t.color=this._source.properties().color.value(),t.linewidth=this._source.properties().linewidth.value(),t.backcolor=this._source.properties().backgroundColor.value(),t.fillBackground=this._source.properties().fillBackground.value(),t.transparency=this._source.properties().transparency.value(),this.isAnchorsRequired()?(e=new h,e.append(new o(t)),this.addAnchors(e),e):new o(t)},inherit(s,r),s.prototype.pointsCount=function(){return 3},s.prototype.title=function(){return"Triangle"},e.TriangleRenderer=o,e.LineToolTriangle=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._rendererCache={},this._invalidated=!0}function n(t,e){this._constructor="LineToolTrianglePattern";var i=e||new p("linetooltrianglepattern");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(183).TriangleRenderer,l=i(131).TrendLineRenderer,h=i(104).TextRenderer,c=i(158),d=i(98),p=i(80).DefaultProperty;inherit(o,s),o.prototype.renderer=function(){var t,e,i,o,n,s,p,u,_;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2?null:(t=this._source.properties(),e=new d,i=this,o=function(e,o){var n={points:[e],text:o,color:t.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:t.font.value(),offsetX:0,offsetY:0,bold:t.bold&&t.bold.value(),italic:t.italic&&t.italic.value(),fontsize:t.fontsize.value(),backgroundColor:i._source.properties().color.value(),backgroundRoundRect:4};return n},n=function(e,o){var n={points:[e,o],width:i._model.timeScale().width(),height:i._source.priceScale().height(),color:i._source.properties().color.value(),linewidth:t.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL};return n},s=n(this._points[0],this._points[1]),e.append(new l(s)),this._points.length>=3&&(s=n(this._points[1],this._points[2]),e.append(new l(s))),4===this._points.length&&(s=n(this._points[2],this._points[3]),e.append(new l(s)),this._intersectPoint?(p=[this._startPoint1,this._startPoint2,this._intersectPoint],u={},u.points=p,u.color=t.color.value(),u.linewidth=t.linewidth.value(),u.backcolor=t.backgroundColor.value(),u.fillBackground=t.fillBackground.value(),u.transparency=t.transparency.value(),e.append(new a(u))):this._intersectPoint1&&this._intersectPoint2&&(p=[this._startPoint1,this._startPoint2,this._intersectPoint2,this._intersectPoint1],u={},u.filled=!0,u.fillBackground=!0,u.points=p,u.color=t.color.value(),u.linewidth=t.linewidth.value(),u.backcolor=t.backgroundColor.value(),u.transparency=t.transparency.value(),e.append(new c(u)))),_=o(this._points[0],"A"),this._points[1].y>this._points[0].y?(_.vertAlign="bottom",_.offsetY=-10):(_.vertAlign="top",_.offsetY=5),e.append(new h(_,this._rendererCache)),_=o(this._points[1],"B"),this._points[1].y<this._points[0].y?(_.vertAlign="bottom",_.offsetY=-10):(_.vertAlign="top",_.offsetY=5),e.append(new h(_,this._rendererCache)),this._points.length>2&&(_=o(this._points[2],"C"),this._points[2].y<this._points[1].y?(_.vertAlign="bottom",_.offsetY=-10):(_.vertAlign="top",_.offsetY=5),e.append(new h(_,this._rendererCache))),this._points.length>3&&(_=o(this._points[3],"D"),this._points[3].y<this._points[2].y?(_.vertAlign="bottom",_.offsetY=-10):(_.vertAlign="top",_.offsetY=5),e.append(new h(_,this._rendererCache))),this.addAnchors(e),e)},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,i,o,n,r,a,l,h,c,d,p,u;if(s.prototype.update.call(this),this._valid=!1,delete this._intersectPoint,delete this._intersectPoint1,delete this._intersectPoint2,4===this._points.length){if(t=this._points[0],i=this._points[1],o=this._points[2],n=this._points[3],Math.abs(o.x-t.x)<1||Math.abs(n.x-i.x)<1)return;if(r=Math.min(t.x,i.x),r=Math.min(r,o.x),r=Math.min(r,n.x),a=(o.y-t.y)/(o.x-t.x),l=t.y+(r-t.x)*a,h=(n.y-i.y)/(n.x-i.x),c=i.y+(r-i.x)*h,Math.abs(a-h)<1e-6)return;this._startPoint1=new e.Point(r,l),this._startPoint2=new e.Point(r,c),d=(i.y-t.y+(t.x*a-i.x*h))/(a-h),this._valid=!0,d<r&&(p=Math.max(t.x,i.x),p=Math.max(p,o.x),p=Math.max(p,n.x),l=t.y+(p-t.x)*a,c=i.y+(p-i.x)*h,this._startPoint1=new e.Point(p,l),this._startPoint2=new e.Point(p,c)),u=t.y+(d-t.x)*a,this._intersectPoint=new e.Point(d,u)}},inherit(n,r),n.prototype.pointsCount=function(){return 4},n.prototype.title=function(){return"Triangle Pattern"},t.exports=n}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e){a.call(this,t,e),this._rendererCache={},this._numericFormatter=new g,this._invalidated=!0}function n(t,e){this._constructor="LineTool5PointsPattern";var i=e||new u("linetool5pointspattern");l.call(this,t,new o(this,t),i)}function s(t,e){this._constructor="LineToolCypherPattern";var i=e||new u("linetoolcypherpattern");l.call(this,t,new r(this,t),i)}function r(t,e){a.call(this,t,e),this._rendererCache={},this._numericFormatter=new g,this._invalidated=!0}var a=i(103),l=i(74).LineDataSource,h=i(131).TrendLineRenderer,c=i(183).TriangleRenderer,d=i(104).TextRenderer,p=i(98),u=i(80).DefaultProperty,_=i(82),f=_.DateTimeFormatter,g=_.NumericFormatter;inherit(o,a),o.prototype.renderer=function(){var t,e,i,o,n,s,r,a,u,_;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2?null:(t=this._source.properties(),e=new p,i=[this._points[0],this._points[1],this._points.length<3?this._points[1]:this._points[2]],o=this,n=function(e,i){var n={points:[e],text:i,color:t.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:t.font.value(),offsetX:0,offsetY:0,bold:t.bold&&t.bold.value(),italic:t.italic&&t.italic.value(),fontsize:t.fontsize.value(),backgroundColor:o._source.properties().color.value(),backgroundRoundRect:4};return n},s=function(t,e){var i={points:[t,e],width:o._model.timeScale().width(),height:o._source.priceScale().height(),color:o._source.properties().color.value(),linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:l.LINEEND_NORMAL,rightend:l.LINEEND_NORMAL};return i},r={},r.points=i,r.color=t.color.value(),r.linewidth=t.linewidth.value(),r.backcolor=t.backgroundColor.value(),r.fillBackground=t.fillBackground.value(),r.transparency=t.transparency.value(),e.append(new c(r)),this._points.length>3&&(i=[this._points[2],this._points[3],5===this._points.length?this._points[4]:this._points[3]],r={},r.points=i,r.color=t.color.value(),r.linewidth=t.linewidth.value(),r.backcolor=t.backgroundColor.value(),r.fillBackground=t.fillBackground.value(),r.transparency=t.transparency.value(),e.append(new c(r))),this._points.length>=3&&(a=this._points[0].add(this._points[2]).scaled(.5),u=n(a,this._numericFormatter.format(this._ABRetracement)),e.append(new d(u,this._rendererCache))),this._points.length>=4&&(a=this._points[1].add(this._points[3]).scaled(.5),_=s(this._points[1],this._points[3]),e.append(new h(_)),u=n(a,this._numericFormatter.format(this._BCRetracement)),e.append(new d(u,this._rendererCache))),this._points.length>=5&&(a=this._points[2].add(this._points[4]).scaled(.5),u=n(a,this._numericFormatter.format(this._CDRetracement)),e.append(new d(u,this._rendererCache)),_=s(this._points[0],this._points[4]),e.append(new h(_)),a=this._points[0].add(this._points[4]).scaled(.5),u=n(a,this._numericFormatter.format(this._XDRetracement)),e.append(new d(u,this._rendererCache))),u=n(this._points[0],"X"),this._points[1].y>this._points[0].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),e.append(new d(u,this._rendererCache)),u=n(this._points[1],"A"),this._points[1].y<this._points[0].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),e.append(new d(u,this._rendererCache)),this._points.length>2&&(u=n(this._points[2],"B"),
this._points[2].y<this._points[1].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),e.append(new d(u,this._rendererCache))),this._points.length>3&&(u=n(this._points[3],"C"),this._points[3].y<this._points[2].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),e.append(new d(u,this._rendererCache))),this._points.length>4&&(u=n(this._points[4],"D"),this._points[4].y<this._points[3].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),e.append(new d(u,this._rendererCache))),this.addAnchors(e),e)},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n;a.prototype.update.call(this),this._source.points().length>=3&&(t=this._source.points()[0],e=this._source.points()[1],i=this._source.points()[2],this._ABRetracement=Math.round(1e3*Math.abs((i.price-e.price)/(e.price-t.price)))/1e3),this._source.points().length>=4&&(o=this._source.points()[3],this._BCRetracement=Math.round(1e3*Math.abs((o.price-i.price)/(i.price-e.price)))/1e3),this._source.points().length>=5&&(n=this._source.points()[4],this._CDRetracement=Math.round(1e3*Math.abs((n.price-o.price)/(o.price-i.price)))/1e3,this._XDRetracement=Math.round(1e3*Math.abs((n.price-e.price)/(e.price-t.price)))/1e3)},inherit(n,l),n.prototype.pointsCount=function(){return 5},n.prototype.title=function(){return"XABCD Pattern"},n.prototype._tooltipFieldsHash={time0:{title:"Date 1",value:null},price0:{title:"Price 1",value:null},time1:{title:"Date 2",value:null},price1:{title:"Price 2",value:null},time2:{title:"Date 3",value:null},price2:{title:"Price 3",value:null},time3:{title:"Date 4",value:null},price3:{title:"Price 4",value:null},time4:{title:"Date 5",value:null},price4:{title:"Price 5",value:null}},n.prototype._updateTooltip=function(){var t,e,i,o,n,s=this._tooltipFieldsHash,r=this.points().m_values;r[0]&&(e=this._model.timeScale().indexToUserTime(r[0].index),s.time0.value=e?new f(this._model.mainSeries().isDWM()).format(e):0,s.price0.value=this._model.mainSeries()._formatter.format(r[0].price)),r[1]&&(t=this._model.timeScale().indexToUserTime(r[1].index),s.time1.value=t?new f(this._model.mainSeries().isDWM()).format(t):0,s.price1.value=this._model.mainSeries()._formatter.format(r[1].price)),r[2]&&(i=this._model.timeScale().indexToUserTime(r[2].index),s.time2.value=i?new f(this._model.mainSeries().isDWM()).format(i):0,s.price2.value=this._model.mainSeries()._formatter.format(r[2].price)),r[3]&&(o=this._model.timeScale().indexToUserTime(r[3].index),s.time3.value=o?new f(this._model.mainSeries().isDWM()).format(o):0,s.price3.value=this._model.mainSeries()._formatter.format(r[3].price)),r[4]&&(n=this._model.timeScale().indexToUserTime(r[4].index),s.time4.value=t?new f(this._model.mainSeries().isDWM()).format(n):0,s.price4.value=this._model.mainSeries()._formatter.format(r[4].price))},n.prototype.tooltip=function(){return this._updateTooltip(),this._formatTooltip()},inherit(s,n),inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){var t,e,i,o,n;a.prototype.update.call(this),this._source.points().length>=3&&(t=this._source.points()[0],e=this._source.points()[1],i=this._source.points()[2],this._ABRetracement=Math.round(1e3*Math.abs((i.price-e.price)/(e.price-t.price)))/1e3),this._source.points().length>=4&&(o=this._source.points()[3],this._BCRetracement=Math.round(1e3*Math.abs((o.price-t.price)/(e.price-t.price)))/1e3),this._source.points().length>=5&&(n=this._source.points()[4],this._CDRetracement=Math.round(1e3*Math.abs((n.price-o.price)/(o.price-i.price)))/1e3,this._XDRetracement=Math.round(1e3*Math.abs((n.price-o.price)/(t.price-o.price)))/1e3)},e.LineTool5PointsPattern=n,e.LineToolCypherPattern=s},function(t,e,i){"use strict";function o(t,e){s.call(this,t,e),this._rendererCache={},this._numericFormatter=new d,this._invalidated=!0}function n(t,e){this._constructor="LineToolThreeDrivers";var i=e||new c("linetoolthreedrivers");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(131).TrendLineRenderer,l=i(104).TextRenderer,h=i(98),c=i(80).DefaultProperty,d=i(82).NumericFormatter;inherit(o,s),o.prototype.renderer=function(){var t,e,i,o,n,s,c,d,p;if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2)return null;for(t=this._source.properties(),e=new h,i=this,o=function(e,o){var n={points:[e],text:o,color:t.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:t.font.value(),offsetX:0,offsetY:0,bold:t.bold&&t.bold.value(),italic:t.italic&&t.italic.value(),fontsize:t.fontsize.value(),backgroundColor:i._source.properties().color.value(),backgroundRoundRect:4};return n},n=function(e,o,n,s){var a={points:[e,o],width:i._model.timeScale().width(),height:i._source.priceScale().height(),color:TradingView.generateColor(i._source.properties().color.value(),n),linewidth:s||t.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL};return a},s=1;s<this._points.length;s++)c=n(this._points[s-1],this._points[s],0),e.append(new a(c));return this._retrace1&&(c=n(this._points[1],this._points[3],70,1),e.append(new a(c)),d=this._points[1].add(this._points[3]).scaled(.5),p=o(d,this._numericFormatter.format(this._retrace1)),e.append(new l(p,this._rendererCache))),this._retrace2&&(c=n(this._points[3],this._points[5],70,1),e.append(new a(c)),d=this._points[5].add(this._points[3]).scaled(.5),p=o(d,this._numericFormatter.format(this._retrace2)),e.append(new l(p,this._rendererCache))),this.addAnchors(e),e},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n;s.prototype.update.call(this),delete this._retrace1,delete this._retrace2,this._source.points().length>=4&&(t=this._source.points()[1],e=this._source.points()[2],i=this._source.points()[3],this._retrace1=Math.round(100*Math.abs((i.price-e.price)/(e.price-t.price)))/100),this._source.points().length>=6&&(i=this._source.points()[3],o=this._source.points()[4],n=this._source.points()[5],this._retrace2=Math.round(100*Math.abs((n.price-o.price)/(o.price-i.price)))/100)},inherit(n,r),n.prototype.pointsCount=function(){return 7},n.prototype.title=function(){return"Three Drives Pattern"},t.exports=n},function(t,e,i){"use strict";function o(t,e){s.call(this,t,e),this._rendererCache={},this._numericFormatter=new u,this._invalidated=!0}function n(t,e){this._constructor="LineToolABCD";var i=e||new c("linetoolabcd");r.call(this,t,new o(this,t),i)}var s=i(103),r=i(74).LineDataSource,a=i(131).TrendLineRenderer,l=i(104).TextRenderer,h=i(98),c=i(80).DefaultProperty,d=i(82),p=d.DateTimeFormatter,u=d.NumericFormatter;inherit(o,s),o.prototype.renderer=function(){var t,e,i,o,n,s,c,d,p;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2?null:(t=this._source.properties(),e=new h,i=this._points,o=this,n=function(e,i){var n={points:[e],text:i,color:t.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:t.font.value(),offsetX:0,offsetY:0,bold:t.bold&&t.bold.value(),italic:t.italic&&t.italic.value(),fontsize:t.fontsize.value(),backgroundColor:o._source.properties().color.value(),backgroundRoundRect:4};return n},s=function(e,i,n,s){var a={points:[e,i],width:o._model.timeScale().width(),height:o._source.priceScale().height(),color:TradingView.generateColor(o._source.properties().color.value(),n),linewidth:s||t.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:r.LINEEND_NORMAL,rightend:r.LINEEND_NORMAL};return a},c=s(i[0],i[1],0),e.append(new a(c)),i.length>=3&&(c=s(i[1],i[2],0),e.append(new a(c))),4===i.length&&(c=s(i[2],i[3],0),e.append(new a(c))),d=n(this._points[0],"A"),this._points[1].y>this._points[0].y?(d.vertAlign="bottom",d.offsetY=-10):(d.vertAlign="top",d.offsetY=5),e.append(new l(d,this._rendererCache)),d=n(this._points[1],"B"),this._points[1].y<this._points[0].y?(d.vertAlign="bottom",d.offsetY=-10):(d.vertAlign="top",d.offsetY=5),e.append(new l(d,this._rendererCache)),this._points.length>2&&(d=n(this._points[2],"C"),this._points[2].y<this._points[1].y?(d.vertAlign="bottom",d.offsetY=-10):(d.vertAlign="top",d.offsetY=5),e.append(new l(d,this._rendererCache))),this._points.length>3&&(d=n(this._points[3],"D"),this._points[3].y<this._points[2].y?(d.vertAlign="bottom",d.offsetY=-10):(d.vertAlign="top",d.offsetY=5),e.append(new l(d,this._rendererCache))),this._points.length>=3&&(p=this._points[0].add(this._points[2]).scaled(.5),c=s(this._points[0],this._points[2],70,1),e.append(new a(c)),d=n(p,this._numericFormatter.format(this._ABRetracement)),e.append(new l(d,this._rendererCache))),this._points.length>=4&&(p=this._points[1].add(this._points[3]).scaled(.5),c=s(this._points[1],this._points[3],70,1),e.append(new a(c)),d=n(p,this._numericFormatter.format(this._CDRetracement)),e.append(new l(d,this._rendererCache))),this.addAnchors(e),e)},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o;s.prototype.update.call(this),this._source.points().length>=3&&(t=this._source.points()[0],e=this._source.points()[1],i=this._source.points()[2],this._ABRetracement=Math.round(1e3*Math.abs((i.price-e.price)/(e.price-t.price)))/1e3),4===this._source.points().length&&(o=this._source.points()[3],this._CDRetracement=Math.round(1e3*Math.abs((o.price-i.price)/(i.price-e.price)))/1e3)},inherit(n,r),n.prototype.pointsCount=function(){return 4},n.prototype.title=function(){return"ABCD Pattern"},n.prototype._tooltipFieldsHash={time0:{title:"Date 1",value:null},price0:{title:"Price 1",value:null},time1:{title:"Date 2",value:null},price1:{title:"Price 2",value:null},time2:{title:"Date 3",value:null},price2:{title:"Price 3",value:null},time3:{title:"Date 4",value:null},price3:{title:"Price 4",value:null}},n.prototype._updateTooltip=function(){var t,e,i,o,n=this._tooltipFieldsHash,s=this.points().m_values;s[0]&&(t=this._model.timeScale().indexToUserTime(s[0].index),n.time0.value=t?new p(this._model.mainSeries().isDWM()).format(t):0,n.price0.value=this._model.mainSeries()._formatter.format(s[0].price)),s[1]&&(e=this._model.timeScale().indexToUserTime(s[1].index),n.time1.value=e?new p(this._model.mainSeries().isDWM()).format(e):0,n.price1.value=this._model.mainSeries()._formatter.format(s[1].price)),s[2]&&(i=this._model.timeScale().indexToUserTime(s[2].index),n.time2.value=i?new p(this._model.mainSeries().isDWM()).format(i):0,n.price2.value=this._model.mainSeries()._formatter.format(s[2].price)),s[3]&&(o=this._model.timeScale().indexToUserTime(s[3].index),n.time3.value=o?new p(this._model.mainSeries().isDWM()).format(o):0,n.price3.value=this._model.mainSeries()._formatter.format(s[3].price))},n.prototype.tooltip=function(){return this._updateTooltip(),this._formatTooltip()},t.exports=n},function(t,e,i){(function(t,o){"use strict";function n(t,e){h.call(this,t,e),this._rendererCache={},this._invalidated=!0,this._percentageFormatter=new w,this._numericFormatter=new S}function s(t,e,i,o){this._source=t,this._model=e,this._text="",this._invalidated=!0,this._coordinate=0,this._background="black",this._pricePropName=i,this._colorPropName=o}function r(t,e){var i,a,l,h,d,p,u,_,f,g,m=e||new y("linetoolriskreward");this._entryPriceAxisView=new s(this,t,"entryPrice","linecolor"),this._stopPriceAxisView=new s(this,t,"stopPrice","stopBackground"),this._profitPriceAxisView=new s(this,t,"targetPrice","profitBackground"),c.call(this,t,new n(this,t),m),this._properties.addExclusion&&(this._properties.addExclusion("stopLevel"),this._properties.addExclusion("profitLevel")),e.stopLevel||e.profitLevel||(i=t.timeScale().visibleBars(),a=i.firstBar(),l=i.lastBar(),h=t.mainSeries().priceRange(a,l),d=t.mainSeries().priceScale(),d.isLog()&&(p=d.logicalToPrice(h.minValue()),u=d.logicalToPrice(h.maxValue()),h=new o(p,u)),d.isPercent()&&(_=t.mainSeries().firstValue(),p=d.priceRange().convertFromPercent(h.minValue(),_),u=d.priceRange().convertFromPercent(h.maxValue(),_),h=new o(p,u)),h&&!h.isEmpty()&&(f=Math.round(.2*h.length()*t.mainSeries().base()),m.merge({stopLevel:f,profitLevel:f}))),g=this,m.stopLevel.listeners().subscribe(this,r.prototype.recalculate),m.stopLevel.listeners().subscribe(null,function(){g.properties().stopPrice._listeners.fire(g.properties().stopPrice)}),m.profitLevel.listeners().subscribe(this,r.prototype.recalculate),m.profitLevel.listeners().subscribe(null,function(){g.properties().targetPrice._listeners.fire(g.properties().targetPrice)}),m.addProperty("entryPrice"),m.entryPrice=new r.PriceProperty(this,0),m.addProperty("stopPrice"),m.stopPrice=new r.StopPriceProperty(this),m.addProperty("targetPrice"),m.targetPrice=new r.TargetPriceProperty(this),this.version=r.version}function a(t,e){this._constructor="LineToolRiskRewardShort";var i=e||new y("linetoolriskrewardshort");r.call(this,t,i)}function l(t,e){this._constructor="LineToolRiskRewardLong";var i=e||new y("linetoolriskrewardlong");r.call(this,t,i)}var h=i(103),c=i(74).LineDataSource,d=i(131).TrendLineRenderer,p=i(75),u=i(76),_=i(104).TextRenderer,f=i(129).RectangleRenderer,g=i(81),m=i(94),v=i(98),y=i(80).DefaultProperty,b=i(82),w=b.PercentageFormatter,S=b.NumericFormatter;inherit(n,h),n.prototype.i18nCache={pnl:$.t("{0} P&L: {1}"),open:$.t("Open",{context:"line_tool_position"}),closed:$.t("Closed",{context:"line_tool_position"}),ratio:$.t("Risk/Reward Ratio: {0}"),stop:$.t("Stop: {0} ({1})"),target:$.t("Target: {0} ({1})")},n.prototype._formatInTicks=function(t){var e=this._model.mainSeries().base();return Math.round(t*e)},n.INDEX_ENTRY=0,n.INDEX_CLOSE=1,n.INDEX_ACTUALENTRY=2,n.INDEX_ACTUALCLOSE=3,n.prototype.isLabelVisible=function(){return this.isHoveredSource()||this.isSelectedSource()},n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){var t,e,i,o,s,r,a,l,c;if(h.prototype.update.call(this),this._stopLevel=null,this._profitLevel=null,t=this._model.timeScale(),e=this._source.priceScale(),e&&!e.isEmpty()&&!t.isEmpty()&&0!==this._source.points().length&&0!==this._points.length&&this._model.mainSeries().bars().last()&&!(this._source.points().length<2)&&0!==this._model.mainSeries().bars().length){if(this._isClosed=4===this._source.points().length,this._isClosed){if(i=this._source.points()[n.INDEX_ACTUALCLOSE].price,this._source.points()[n.INDEX_ACTUALCLOSE].index<parseInt(this._source._model.mainSeries().bars().first()))return;o=Math.min(parseInt(this._source._model.mainSeries().bars().last()),this._source.points()[n.INDEX_ACTUALCLOSE].index),this._closeBar=this._source._model.timeScale().indexToCoordinate(o)}else{if(this._source.points()[n.INDEX_CLOSE].index<parseInt(this._source._model.mainSeries().bars().first()))return;o=Math.min(parseInt(this._source._model.mainSeries().bars().last()),this._source.points()[n.INDEX_CLOSE].index),s=this._model.mainSeries().bars().valueAt(o),i=s[TradingView.CLOSE_PLOT],this._closeBar=this._source._model.timeScale().indexToCoordinate(o)}r=this._source.priceScale(),a=this._source.stopPrice(),l=this._source.profitPrice(),this._pl=this._source.points().length>1?this._source.calculatePL(i):0,r.isPercent()&&(c=this._source.ownerSource().firstValue(),a=r.priceRange().convertToPercent(a,c),l=r.priceRange().convertToPercent(l,c),i=r.priceRange().convertToPercent(i,c)),this._entryLevel=this._points[n.INDEX_ENTRY].y,this._stopLevel=e.priceToCoordinate(a),this._profitLevel=e.priceToCoordinate(l),this._closeLevel=e.priceToCoordinate(i),this._closeBar=this._source._model.timeScale().indexToCoordinate(o)}},n.prototype.renderer=function(){var e,i,o,s,r,a,l,h,p,u,g,y,b,w,S,T,C,x,P,L,k,E,I,A,V,$,M,D,O,B,R,N,F;return this._invalidated&&(this._updateImpl(),this._invalidated=!1),e=new v,this._points.length<2||this._source.points().length<2?e:(i=this,o=this._source.properties(),s=this._points[n.INDEX_ENTRY].x,r=this._points[n.INDEX_ACTUALENTRY]?this._points[n.INDEX_ACTUALENTRY].x:this._points[n.INDEX_CLOSE].x,a=this._points[n.INDEX_ACTUALCLOSE]?this._points[n.INDEX_ACTUALCLOSE].x:this._points[n.INDEX_CLOSE].x,l=this._points[n.INDEX_CLOSE].x,h=new t.Point(s,this._entryLevel),p=new t.Point(l,this._stopLevel),u={},u.points=[h,p],u.color="white",u.linewidth=0,u.backcolor=o.stopBackground.value(),u.fillBackground=!0,u.transparency=o.stopBackgroundTransparency.value(),e.append(new f(u,new m(m.MOVEPOINT),new m(m.MOVEPOINT))),this._pl<0&&(h=new t.Point(r,this._entryLevel),p=new t.Point(a,this._closeLevel),u={},u.points=[h,p],u.color="white",u.linewidth=0,u.backcolor=o.stopBackground.value(),u.fillBackground=!0,g=.01*o.stopBackgroundTransparency.value(),y=100*(1-g*g*g),b=100-y,u.transparency=b,e.append(new f(u,new m(m.MOVEPOINT),new m(m.MOVEPOINT)))),h=new t.Point(s,this._entryLevel),p=new t.Point(l,this._profitLevel),u={},u.points=[h,p],u.color="white",u.linewidth=0,u.backcolor=o.profitBackground.value(),u.fillBackground=!0,u.transparency=o.profitBackgroundTransparency.value(),e.append(new f(u,new m(m.MOVEPOINT),new m(m.MOVEPOINT))),this._pl>0&&(h=new t.Point(r,this._entryLevel),p=new t.Point(a,this._closeLevel),u={},u.points=[h,p],u.color="white",u.linewidth=0,u.backcolor=o.profitBackground.value(),u.fillBackground=!0,g=.01*o.profitBackgroundTransparency.value(),w=100*(1-g*g*g),S=100-w,u.transparency=S,e.append(new f(u,new m(m.MOVEPOINT),new m(m.MOVEPOINT)))),T=function(t,o,n){var s={};s.points=[t,o],s.width=i._model.timeScale().width(),s.height=i._source.priceScale().height(),s.color=n||i._source.properties().linecolor.value(),s.linewidth=i._source.properties().linewidth.value(),s.linestyle=CanvasEx.LINESTYLE_SOLID,s.extendleft=!1,s.extendright=!1,s.leftend=c.LINEEND_NORMAL,s.rightend=c.LINEEND_NORMAL,e.append(new d(s))},this._points[n.INDEX_ACTUALENTRY]&&(h=this._points[n.INDEX_ACTUALENTRY],p=this._isClosed?this._points[n.INDEX_ACTUALCLOSE]:new t.Point(this._closeBar,this._closeLevel),u={},u.points=[h,p],u.width=i._model.timeScale().width(),u.height=i._source.priceScale().height(),u.color=i._source.properties().linecolor.value(),u.linewidth=1,u.linestyle=CanvasEx.LINESTYLE_DASHED,u.extendleft=!1,u.extendright=!1,u.leftend=c.LINEEND_NORMAL,u.rightend=c.LINEEND_ARROW,e.append(new d(u))),i=this,C=function(t,n,s,r,a,l){if(i.isLabelVisible()||TradingView.printing){var h={};h.points=[t],h.text=n,h.color=o.textcolor.value(),h.font=o.font.value(),h.offsetX=3,h.offsetY=a,h.vertAlign=r,h.horzAlign="center",h.backgroundRoundRect=4,h.backgroundColor=TradingView.resetTransparency(s),h.fontsize=o.fontsize.value(),h.backgroundHorzInflate=4,h.backgroundVertInflate=2,l&&(h.borderColor=l),e.append(new _(h,i._rendererCache))}},x=this._source.entryPrice(),P=this._source.stopPrice(),L=this._source.profitPrice(),k=Math.abs(P-x),E=Math.round(1e4*k/x)/100,I=Math.abs(L-x),A=Math.round(1e4*I/x)/100,V=Math.abs(x-L)/Math.abs(x-P),h=new t.Point(s,this._points[n.INDEX_ENTRY].y),p=new t.Point(l,this._points[n.INDEX_ENTRY].y),T(h,p),$=new t.Point((s+l)/2,Math.round(this._points[0].y)+.5),M="",this._points[1]&&void 0!==this._pl&&(D=this._isClosed?this.i18nCache.closed:this.i18nCache.open,M=this.i18nCache.pnl.format(D,this._source.priceScale().formatter().format(this._pl))+"\n"),M+=this.i18nCache.ratio.format(this._numericFormatter.format(Math.round(100*V)/100))+" ",O=o.linecolor.value(),this._pl<0?O=o.stopBackground.value():this._pl>0&&(O=o.profitBackground.value()),C($,M,O,"middle",0,"white"),h=new t.Point(s,this._stopLevel),p=new t.Point(l,this._stopLevel),T(h,p,o.stopBackground.value()),$=new t.Point((s+l)/2,this._stopLevel),M=this.i18nCache.stop.format(this._source.priceScale().formatter().format(k),this._percentageFormatter.format(E)),C($,M,o.stopBackground.value(),x<P?"bottom":"top",x<P?-12:-1),h=new t.Point(s,this._profitLevel),p=new t.Point(l,this._profitLevel),T(h,p,o.profitBackground.value()),$=new t.Point((s+l)/2,this._profitLevel),M=this.i18nCache.target.format(this._source.priceScale().formatter().format(I),this._percentageFormatter.format(A)),C($,M,o.profitBackground.value(),x<P?"top":"bottom",x<P?-1:-12),this.isAnchorsRequired()&&(B=this._points[0].clone(),B.data=0,R=new t.Point(s,this._stopLevel),R.data=1,N=new t.Point(s,this._profitLevel),N.data=2,F=new t.Point(l,B.y),F.data=3,e.append(this.createLineAnchor({points:[B,R,N,F]}))),e)},inherit(s,p),s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){if(0!==this._source.points().length&&this._source.priceScale()&&!this._source.priceScale().isEmpty()){var t=this._source.properties()[this._pricePropName].value();this._background=this._source.properties()[this._colorPropName].value(),this._coordinate=this._source.priceScale().priceToCoordinate(t),this._text=this._source.priceScale()?this._source.priceScale().formatter().format(t):""}},s.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var t={text:this._text,coordinate:this._coordinate,color:this.color(),background:TradingView.resetTransparency(this._background),visible:!0};return new u(t)},inherit(r,c),r.version=2,r.prototype.i18nCache={title:$.t("Risk/Reward")},r.prototype.migrateVersion=function(t,e,i){var o,n,s,r;1===t&&this._points.length>=1&&(o=[],o.push(this._points[0]),n=this._points[0],n={price:n.price,index:n.index+50},o.push(n),this._points[1]&&o.push(this._points[1]),this._points[2]&&o.push(this._points[2]),this._points=o,this._timePoint.length>=1&&(s=[],n=this._timePoint[0],s.push(n),r={price:n.price,time_t:n.time_t,offset:n.offset+50},s.push(r),this._timePoint[1]&&o.push(this._points[1]),this._timePoint[2]&&o.push(this._points[2]),this._timePoint=s))},r.prototype.checkAlert=function(){this.recalculate()},r.prototype.priceAxisViews=function(t,e){return this._isActualSymbol?e!==this.priceScale()||this._model.paneForSource(this)!==t?null:[this._entryPriceAxisView,this._stopPriceAxisView,this._profitPriceAxisView]:null},r.prototype.updateAllViews=function(){this._isActualSymbol&&this._properties.visible.value()&&(g.hideAllDrawings().value()&&this.userEditEnabled()||(c.prototype.updateAllViews.call(this),this._entryPriceAxisView.update(),this._stopPriceAxisView.update(),this._profitPriceAxisView.update()))},r.prototype.setPoint=function(t,e){var i,o=this.priceScale();switch(o.isPercent()&&(i=this.ownerSource().firstValue(),e.price=o.priceRange().convertFromPercent(e.price,i)),t){case 0:e.price=this._roundPrice(e.price),o.isPercent()&&(e.price=o.priceRange().convertToPercent(e.price,i)),c.prototype.setPoint.call(this,t,e),this.recalculate();break;case 1:this.properties().stopPrice.setValue(this.preparseStopPrice(e.price));break;case 2:this.properties().targetPrice.setValue(this.preparseProfitPrice(e.price));break;case 3:e.price=this._roundPrice(e.price),o.isPercent()&&(e.price=o.priceRange().convertToPercent(e.price,i)),c.prototype.setPoint.call(this,1,e),this.recalculate()}},r.PriceProperty=function(t,e){c.PointPriceProperty.call(this,t,e)},inherit(r.PriceProperty,c.PointPriceProperty),r.PriceProperty.prototype.setValue=function(t){var e=this._lineSource.points()[this._pointIndex];e.price=parseFloat(t),this._lineSource.setPoint(this._pointIndex,e),this._lineSource.recalculate(),this._lineSource._model.updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging()},r.StopPriceProperty=function(t){r.PriceProperty.call(this,t,1)},inherit(r.StopPriceProperty,r.PriceProperty),r.StopPriceProperty.prototype.value=function(){var t=this._lineSource.stopPrice(),e=this._lineSource.ownerSource().formatter(),i=e.parse(e.format(t));return i.price?i.price:i.value},r.StopPriceProperty.prototype.setValue=function(t){var e=Math.round(Math.abs(t-this._lineSource.entryPrice())*this._lineSource._model.mainSeries().base());this._lineSource.properties().stopLevel.setValue(e),this._lineSource.properties().stopLevel.listeners().fire(this._lineSource.properties().stopLevel)},r.TargetPriceProperty=function(t){r.PriceProperty.call(this,t,2)},inherit(r.TargetPriceProperty,r.PriceProperty),r.TargetPriceProperty.prototype.value=function(){var t=this._lineSource.profitPrice(),e=this._lineSource.ownerSource().formatter(),i=e.parse(e.format(t));return i.price?i.price:i.value},r.TargetPriceProperty.prototype.setValue=function(t){var e=Math.round(Math.abs(t-this._lineSource.entryPrice())*this._lineSource._model.mainSeries().base());this._lineSource.properties().profitLevel.setValue(e),this._lineSource.properties().profitLevel.listeners().fire(this._lineSource.properties().profitLevel)},r.prototype.pointsCount=function(){return 1},r.prototype.title=function(){return this.i18nCache.title},r.prototype.addPoint=function(t){var e,i,o,n=$.extend({},t),s=this.priceScale();return s.isPercent()&&(e=this.ownerSource().firstValue(),n.price=s.priceRange().convertFromPercent(n.price,e)),n.price=this._roundPrice(n.price),this._points.push(n),i={price:n.price,index:n.index+50},this._points.push(i),o=this.calculateActualEntry(n,i),o&&(this._points.push(o),i=this.findClosePoint(o,i),i&&this._points.push(i)),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0},r.prototype._roundPrice=function(t){var e=this._model.mainSeries().base(),i=Math.round(t*e);return i/e},r.prototype.recalculate=function(){var t,e,i,o,n;this.properties().interval.value()===this._model.mainSeries().interval()&&0!==this.points().length&&(t=this.properties().targetPrice.value(),e=this.properties().stopPrice.value(),i=[this._points[0],this._points[1]],o=this.calculateActualEntry(this.points()[0],this.points()[1]),o&&(i.push(o),n=this.findClosePoint(o,this.points()[1]),n&&i.push(n)),this._points=i,t!==this.properties().targetPrice.value()&&this.properties().targetPrice._listeners.fire(this.properties().targetPrice),e!==this.properties().stopPrice.value()&&this.properties().stopPrice._listeners.fire(this.properties().stopPrice))},r.prototype.startMoving=function(t){t.price=this._roundPrice(t.price),c.prototype.startMoving.call(this,t)},r.prototype.move=function(t){t.price=this._roundPrice(t.price),c.prototype.move.call(this,t),this.recalculate(),this._entryPriceAxisView.update()},r.prototype.correctPoints=function(t){c.prototype.correctPoints.call(this,[t[0],t[1]])},r.prototype.entryPrice=function(){return this.points()[0].price},r.prototype.findClosePoint=function(t,e){var i,o,n,s=this._model.mainSeries().bars(),r=parseInt(s.first(),10),a=Math.max(t.index,r),l=parseInt(s.last(),10);for(i=a;i<=Math.min(l,e.index);i++)if(o=s.valueAt(i),n=this.checkStopPrice(o),null!=n)return{index:i,price:n};return null},r.prototype.calculateActualEntry=function(t,e){var i,o,n=this._model.mainSeries().bars(),s=parseInt(n.first(),10),r=Math.max(t.index,s),a=t.price,l=parseInt(n.last(),10);for(i=r;i<=Math.min(l,e.index);i++)if(o=n.valueAt(i),o[TradingView.HIGH_PLOT]>=a&&o[TradingView.LOW_PLOT]<=a)return{index:i,price:a};return null},inherit(a,r),a.prototype.i18nCache={title:$.t("Risk/Reward short")},a.prototype.title=function(){return this.i18nCache.title},a.prototype.stopPrice=function(){return this.entryPrice()+this.properties().stopLevel.value()/this._model.mainSeries().base()},a.prototype.profitPrice=function(){return this.entryPrice()-this.properties().profitLevel.value()/this._model.mainSeries().base()},a.prototype.calculatePL=function(t){return this.entryPrice()-t},a.prototype.preparseStopPrice=function(t){t=this._roundPrice(t);var e=this.entryPrice()+1/this._model.mainSeries().base();return Math.max(t,e)},a.prototype.preparseProfitPrice=function(t){t=this._roundPrice(t);var e=this.entryPrice()-1/this._model.mainSeries().base();return Math.min(t,e)},a.prototype.checkStopPrice=function(t){var e=this.stopPrice(),i=this.profitPrice();return t[TradingView.HIGH_PLOT]>=e?this.stopPrice():t[TradingView.LOW_PLOT]<=i?this.profitPrice():null},l.prototype.i18nCache={title:$.t("Risk/Reward long")},inherit(l,r),l.prototype.stopPrice=function(){return this.entryPrice()-this.properties().stopLevel.value()/this._model.mainSeries().base()},l.prototype.profitPrice=function(){return this.entryPrice()+this.properties().profitLevel.value()/this._model.mainSeries().base()},l.prototype.calculatePL=function(t){return t-this.entryPrice()},l.prototype.preparseStopPrice=function(t){t=this._roundPrice(t);var e=this.entryPrice()-1/this._model.mainSeries().base();return Math.min(t,e)},l.prototype.preparseProfitPrice=function(t){t=this._roundPrice(t);var e=this.entryPrice()+1/this._model.mainSeries().base();return Math.max(t,e)},l.prototype.checkStopPrice=function(t){var e=this.stopPrice(),i=this.profitPrice();return t[TradingView.LOW_PLOT]<=e?this.stopPrice():t[TradingView.HIGH_PLOT]>=i?this.profitPrice():null},l.prototype.title=function(){return this.i18nCache.title},e.LineToolRiskReward=r,e.LineToolRiskRewardLong=l,e.LineToolRiskRewardShort=a}).call(e,i(21),i(85))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._invalidated=!0}function n(t,e){this._constructor="LineToolPolyline";var i;e?i=e:(i=new h("linetoolpolyline"),i.filled.setValue(!1)),r.call(this,t,new o(this,t),i),i.addExclusion("filled")}var s=i(103),r=i(74).LineDataSource,a=i(158),l=i(98),h=i(80).DefaultProperty;inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},o.prototype.renderer=function(){var t,e;return this._invalidated&&this.updateImpl(),t={},t.points=this._points,t.color=this._source.properties().linecolor.value(),t.linewidth=this._source.properties().linewidth.value(),t.linestyle=this._source.properties().linestyle.value(),t.filled=this._source.properties().filled.value(),t.backcolor=this._source.properties().backgroundColor.value(),t.fillBackground=this._source.properties().fillBackground.value(),t.transparency=this._source.properties().transparency.value(),this.isAnchorsRequired()?(e=new l,e.append(new a(t)),this.addAnchors(e),e):new a(t)},inherit(n,r),n.prototype.pointsCount=function(){return-1},n.prototype.title=function(){return"Polyline"},n.prototype.addPoint=function(t){var i,o,n,s,a,l,h,c,d,p,u,_,f=this._model.timeScale().indexToCoordinate(t.index),g=t.price,m=null;if(this.priceScale().isPercent()&&(m=this.ownerSource().firstValue()),i=this.priceScale().priceToCoordinate(g),o=5,this._points.length>0){if(n=this._points[this._points.length-1],s=this._model.timeScale().indexToCoordinate(n.index),a=n.price,this.priceScale().isPercent()&&(a=this.priceScale().priceRange().convertToPercent(a,m)),l=this.priceScale().priceToCoordinate(a),h=new e.Point(f,i).substract(new e.Point(s,l)).length(),h<o)return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0;if(c=this._points[0],d=this._model.timeScale().indexToCoordinate(c.index),p=c.price,this.priceScale().isPercent()&&(p=this.priceScale().priceRange().convertToPercent(p,m)),u=this.priceScale().priceToCoordinate(p),_=new e.Point(f,i).substract(new e.Point(d,u)).length(),_<o)return this._properties.filled.setValue(!0),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}return r.prototype.addPoint.call(this,t)},n.prototype.setPoint=function(t,i){var o,n,s,a,l,h,c;r.prototype.setPoint.call(this,t,i),this._model.timeScale().isEmpty()||this.priceScale().isEmpty()||t!==this._points.length-1&&0!==t||(o=5,n=this._model.timeScale().indexToCoordinate(i.index),s=this.priceScale().priceToCoordinate(i.price),a=t===this._points.length-1?this._points[0]:this._points[this._points.length-1],l=this._model.timeScale().indexToCoordinate(a.index),h=this.priceScale().priceToCoordinate(a.price),c=new e.Point(n,s).substract(new e.Point(l,h)).length(),c<o&&this._properties.filled.setValue(!0))},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._data=t,this._targetFontSize1=11,this._targetFontSize2=11,this._targetFontSize3=14,this._font="Arial",this._sourceFontSize1=12,this._sourceFontSize2=10}function n(t,e){r.call(this,t,e),this._clockWhite=d("prediction-clock-white",TradingView.wrapUrl("images/prediction-clock-white.png")),this._clockBlack=d("prediction-clock-black",TradingView.wrapUrl("images/prediction-clock-black.png")),
this._successIcon=d("prediction-success-white",TradingView.wrapUrl("images/prediction-success-white.png")),this._failureIcon=d("prediction-failure-white",TradingView.wrapUrl("images/prediction-failure-white.png")),this._percentageFormatter=new f,this._invalidated=!0}function s(t,e){this._constructor="LineToolPrediction";var i=e||new u("linetoolprediction");i.merge({status:s.ALERT_STATUS_WAITING}),a.call(this,t,new n(this,t),i)}var r=i(103),a=i(74).LineDataSource,l=i(41),h=i(94),c=i(98),d=i(191),p=i(65).RGBColor,u=i(80).DefaultProperty,_=i(82),f=_.PercentageFormatter,g=_.DateFormatter,m=_.TimeFormatter,v=_.TimeSpanFormatter;o.prototype.drawBalloon=function(t,i,o,n,s,r){var a,l,h=6,c=5,d=5,p=r||20,u=3;return t.beginPath(),"down"===s?(a=new e.Point(i.x-p,i.y-h-d-n),t.moveTo(a.x+u,a.y),t.lineTo(a.x+o-u,a.y),t.arcTo(a.x+o,a.y,a.x+o,a.y+u,u),t.lineTo(a.x+o,a.y+n-u),t.arcTo(a.x+o,a.y+n,a.x+o-u,a.y+n,u),t.lineTo(a.x+p+c,a.y+n),t.lineTo(a.x+p,a.y+n+d),t.lineTo(a.x+p-c,a.y+n),t.lineTo(a.x+u,a.y+n),t.arcTo(a.x,a.y+n,a.x,a.y+n-u,u),t.lineTo(a.x,a.y+u),t.arcTo(a.x,a.y,a.x+u,a.y,u),a):(l=new e.Point(i.x-p,i.y+h+d+n),t.moveTo(l.x+u,l.y),t.lineTo(l.x+o-u,l.y),t.arcTo(l.x+o,l.y,l.x+o,l.y-u,u),t.lineTo(l.x+o,l.y-n+u),t.arcTo(l.x+o,l.y-n,l.x+o-u,l.y-n,u),t.lineTo(l.x+p+c,l.y-n),t.lineTo(l.x+p,l.y-n-d),t.lineTo(l.x+p-c,l.y-n),t.lineTo(l.x+u,l.y-n),t.arcTo(l.x,l.y-n,l.x,l.y-n+u,u),t.lineTo(l.x,l.y-u),t.arcTo(l.x,l.y,l.x+u,l.y,u),new e.Point(l.x,l.y-n))},o.prototype.drawTargetLabel=function(t){var e,i,o,n,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C=this._data.points[1];if(t.save(),t.translate(.5,.5),t.font="normal "+this._targetFontSize3+"px "+this._font,e=1.5*this._targetFontSize1+1.5*this._targetFontSize2+3,i=t.measureText(this._data.targetLine1).width,o=t.measureText(this._data.targetLine2).width,t.font="normal "+this._targetFontSize2+"px "+this._font,n=t.measureText(this._data.targetLine3).width,r=t.measureText(this._data.targetLine4).width,a=Math.max(i+o,n+r+10)+20,l="up"===this._data.direction?"down":"up",h=C.x+a-t.canvas.width+5,h=Math.max(20,Math.min(a-15,h)),c=this.drawBalloon(t,C,a,e,l,h),t.save(),t.fillStyle=TradingView.generateColor(this._data.targetBackColor,this._data.transparency),t.fill(),t.restore(),t.save(),t.lineWidth=2,t.strokeStyle=TradingView.generateColor(this._data.targetStrokeColor,this._data.transparency),t.stroke(),t.restore(),d=3,t.beginPath(),t.arc(C.x,C.y,d,0,2*Math.PI,!1),t.fillStyle=this._data.centersColor,t.fill(),t.textAlign="left",p=6,u=4,t.fillStyle=this._data.targetTextColor,t.font="normal "+this._targetFontSize3+"px "+this._font,t.fillText(this._data.targetLine1,c.x+p,c.y+this._targetFontSize1+u),_=13,f=5,t.fillText(this._data.targetLine2,c.x+p+i+f,c.y+this._targetFontSize1+u),t.font="normal "+this._targetFontSize2+"px "+this._font,g=c.y+this._targetFontSize1+2*u+this._targetFontSize2,t.fillText(this._data.targetLine3,c.x+p,g),t.drawImage(this._data.clockWhite,c.x+p+n+6,g-this._targetFontSize2+3),t.fillText(this._data.targetLine4,c.x+p+n+_+5,g),!this._data.status)return void t.restore();switch(m=this._targetFontSize1+4,t.font="bold "+this._targetFontSize1+"px "+this._font,this._data.status){case s.ALERT_STATUS_SUCCESS:v=$.t("SUCCESS"),y=TradingView.generateColor(this._data.successBackground,this._data.transparency),b=this._data.successTextColor,w=this._data.successIcon;break;case s.ALERT_STATUS_FAILURE:v=$.t("FAILURE"),y=TradingView.generateColor(this._data.failureBackground,this._data.transparency),b=this._data.failureTextColor,w=this._data.failureIcon}S=t.measureText(v).width,T=Math.round((a-S)/2),t.fillStyle=y,"up"===this._data.direction?(t.roundRect(c.x-1,c.y-m-2,a+2,m,5),t.fill(),t.fillStyle=b,t.fillText(v,c.x+T,c.y-5),t.drawImage(w,c.x+T-13,c.y-14)):(t.roundRect(c.x-1,c.y+e+3,a+2,m,5),t.fill(),t.fillStyle=b,t.fillText(v,c.x+T,c.y+e+m-1),t.drawImage(w,c.x+T-13,c.y+e+5)),t.restore()},o.prototype.drawStartLabel=function(t){var e,i,o,n,s,r,a,l,h;t.save(),t.translate(.5,.5),t.font="normal "+this._sourceFontSize1+"px "+this._font,e=1.5*this._sourceFontSize1+1.5*this._sourceFontSize2,i=t.measureText(this._data.sourceLine1).width,t.font="normal "+this._fontsize2+"px "+this._font,o=t.measureText(this._data.sourceLine2).width,n=Math.max(i,o)-5,s=this._data.points[0],r=this.drawBalloon(t,s,n,e,this._data.direction),t.fillStyle=TradingView.generateColor(this._data.sourceBackColor,this._data.transparency),t.fill(),t.lineWidth=2,t.strokeStyle=TradingView.generateColor(this._data.sourceStrokeColor,this._data.transparency),t.stroke(),a=3,t.beginPath(),t.arc(s.x,s.y,a,0,2*Math.PI,!1),t.fillStyle=this._data.centersColor,t.fill(),t.textAlign="left",l=3,h=2,t.fillStyle=this._data.sourceTextColor,t.font="normal "+this._sourceFontSize1+"px "+this._font,t.fillText(this._data.sourceLine1,r.x+l,r.y+this._sourceFontSize1+h),t.font="normal "+this._sourceFontSize2+"px "+this._font,t.fillText(this._data.sourceLine2,r.x+l,r.y+this._sourceFontSize1+2*h+this._sourceFontSize2),t.restore()},o.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d,p,u,_;if(!(this._data.points.length<2)){if(t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,e=this._data.points[0],i=this._data.points[1],o=i.substract(e),Math.abs(o.x)<1||Math.abs(o.y)<1?(t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(i.x,i.y),t.stroke()):(t.save(),t.beginPath(),t.translate(e.x,e.y),t.scale(1,o.y/o.x),t.moveTo(0,0),t.arcTo(o.x,0,o.x,o.x,Math.abs(o.x)),t.lineTo(o.x,o.x),t.restore(),t.stroke()),this.drawTargetLabel(t),this.drawStartLabel(t),n=Math.max(8,4*this._data.linewidth),t.fillStyle=this._data.color,s=o.y<0?1:-1,Math.abs(o.x)<1||Math.abs(o.y)<1)r=Math.atan(o.x/o.y);else{if(a=Math.abs(o.x),l=Math.abs(o.y),h=0,c=Math.PI/2,d=(h+c)/2,o.length()>n)for(;;){if(p=a*Math.sin(d),u=l*(1-Math.cos(d)),_=Math.sqrt((p-a)*(p-a)+(u-l)*(u-l)),Math.abs(_-n)<1)break;_>n?h=d:c=d,d=(h+c)/2}r=Math.atan((a-p)/(l-u)),o.x*o.y<0&&(r=-r)}t.save(),t.beginPath(),t.translate(i.x,i.y),t.rotate(-r),t.moveTo(0,0),t.lineTo(-n/2,s*n),t.lineTo(n/2,s*n),t.lineTo(0,0),t.restore(),t.fill()}},o.prototype.targetLabelHitTest=function(t){var e,i,o,n,s,r,a,l,c,d=this._data.points[1],p=1.5*this._targetFontSize1+1.5*this._targetFontSize2,u=this._targetFontSize1*this._data.targetLine1.length,_=this._targetFontSize1*this._data.targetLine2.length,f=this._targetFontSize2*this._data.targetLine3.length,g=this._targetFontSize2*this._data.targetLine4.length;return this._data.status&&(p+=1.5*this._targetFontSize1),e=Math.max(u+_,f+g)-20,i=20,o=5,n="up"===this._data.direction?-1:1,s=d.x-i,r=d.y+o*n,a=d.y+(o+p)*n,l=Math.min(r,a),c=Math.max(r,a),t.x>=s&&t.x<=s+e&&t.y>=l&&t.y<=c?new h(h.MOVEPOINT):null},o.prototype.sourceLabelHitTest=function(t){var e=1.5*this._sourceFontSize1+1.5*this._sourceFontSize2,i=this._sourceFontSize1*this._data.sourceLine1.length,o=this._sourceFontSize2*this._data.sourceLine2.length,n=Math.max(i,o),s=this._data.points[0],r=20,a=5,l="up"===this._data.direction?1:-1,c=s.x-r,d=s.y+a*l,p=s.y+(a+e)*l,u=Math.min(d,p),_=Math.max(d,p);return t.x>=c&&t.x<=c+n&&t.y>=u&&t.y<=_?new h(h.MOVEPOINT):null},o.prototype.hitTest=function(t){var i,o,n,s,r,a,l,c,d;return this._data.points.length<2?null:(i=this._data.points[0],o=this._data.points[1],n=o.substract(i),n=o.substract(i),s=t.substract(i),r=Math.abs(n.x),a=Math.abs(n.y),l=e.sign(n.y)*(a-a*Math.sqrt(1-s.x*s.x/(r*r))),c=3,Math.abs(l-s.y)<c?new h(h.MOVEPOINT):(d=this.targetLabelHitTest(t),d?d:this.sourceLabelHitTest(t)))},inherit(n,r),n.prototype.renderer=function(){var t,e;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t={},t.points=this._points,t.color=this._source.properties().linecolor.value(),t.linewidth=this._source.properties().linewidth.value(),t.targetLine1=this._targetLine1,t.targetLine2=this._targetLine2,t.targetLine3=this._targetLine3,t.targetLine4=this._targetLine4,t.status=this._source.properties().status.value(),t.transparency=this._source.properties().transparency.value(),t.targetBackColor=this._source.properties().targetBackColor.value(),t.targetStrokeColor=this._source.properties().targetStrokeColor.value(),t.targetTextColor=this._source.properties().targetTextColor.value(),t.sourceBackColor=this._source.properties().sourceBackColor.value(),t.sourceStrokeColor=this._source.properties().sourceStrokeColor.value(),t.sourceTextColor=this._source.properties().sourceTextColor.value(),t.successBackground=this._source.properties().successBackground.value(),t.successTextColor=this._source.properties().successTextColor.value(),t.failureBackground=this._source.properties().failureBackground.value(),t.failureTextColor=this._source.properties().failureTextColor.value(),t.intermediateBackColor=this._source.properties().intermediateBackColor.value(),t.intermediateTextColor=this._source.properties().intermediateTextColor.value(),t.sourceLine1=this._sourceLine1,t.sourceLine2=this._sourceLine2,t.direction=this._direction,t.clockWhite=this._clockWhite,t.clockBlack=this._clockBlack,t.successIcon=this._successIcon,t.failureIcon=this._failureIcon,t.finished=this._finished,t.centersColor=new p(this._model._properties.paneProperties.background._value).blackWhiteContrast(),this.isAnchorsRequired()?(e=new c,e.append(new o(t)),this.addAnchors(e),e):new o(t)},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){var t,e,i,o,n,a,h,c,d,p,u,_;r.prototype.update.call(this),this._targetLine1="",this._targetLine2="",this._targetLine3="",this._targetLine4="",this._source.points().length<2||this._source.priceScale()&&(t=this._source.points()[1],e=this._source.points()[0],this._targetLine3=this._source.priceScale().formatter().format(t.price),i=t.price-e.price,o=i<0?"-":"+",this._targetLine1=this._source.priceScale().formatter().format(Math.abs(i)),n=Math.abs(Math.round(1e4*(i/e.price))/100),this._targetLine1=o+this._targetLine1+" ("+o+this._percentageFormatter.format(n)+")",a=this._model.timeScale().indexToUserTime(e.index),h=this._model.timeScale().indexToUserTime(t.index),c=e.time&&t.time,c&&(a=TradingView.isString(e.time)?new Date(Date.parse(e.time)):e.time,h=TradingView.isString(t.time)?new Date(Date.parse(t.time)):t.time),d=this._model.mainSeries().isDWM(),p=l.kind(this._model.mainSeries().interval())===l.SECONDS,h&&a&&(this._targetLine4=(new g).format(h),d||(this._targetLine4=this._targetLine4+" "+new m(p?"%h:%m:%s":"%h:%m").format(h)),u=(h.valueOf()-a.valueOf())/1e3,this._targetLine2=$.t("in",{context:"dates"})+" "+(new v).format(u)),this._sourceLine1=this._source.priceScale().formatter().format(e.price),this._sourceLine2="",_=this._model.timeScale().indexToUserTime(e.index),_&&(this._sourceLine2=(new g).format(_),d||(this._sourceLine2=this._sourceLine2+" "+new m(p?"%h:%m:%s":"%h:%m").format(_))),this._direction=this._source.direction()===s.DIRECTION_UP?"up":"down",this._finished=this._model.lineBeingCreated()!==this._source&&this._model.lineBeingEdited()!==this._source&&this._model.sourceBeingMoved()!==this._source)},s.ALERT_STATUS_WAITING=0,s.ALERT_STATUS_SUCCESS=1,s.ALERT_STATUS_FAILURE=2,s.DIRECTION_UP=1,s.DIRECTION_DOWN=2,inherit(s,a),s.prototype.status=function(){return this._properties.status.value()},s.prototype.setStatus=function(t){return this._properties.status.setValue(t)},s.prototype.pointsCount=function(){return 2},s.prototype.title=function(){return"Forecast"},s.prototype.restorePoints=function(t,e,i){a.prototype.restorePoints.call(this,t,e,i),this.checkAlert()},s.prototype.checkAlert=function(){var t,e,i,o,n;if(!(this._points.length<2||this._model.mainSeries().bars().isEmpty())){if(t=this._points[1],this.status())return void(t.index>this._model.timeScale().points().lastTimePointIndex()&&this.setStatus(s.ALERT_STATUS_WAITING));e=this._model.timeScale().indexToTimePoint(t.index),e&&(i=this._model.mainSeries().bars().valueAt(t.index),o=this.direction(),o===s.DIRECTION_UP&&i[TradingView.HIGH_PLOT]>=t.price?this.setStatus(s.ALERT_STATUS_SUCCESS):o===s.DIRECTION_DOWN&&i[TradingView.LOW_PLOT]<=t.price?this.setStatus(s.ALERT_STATUS_SUCCESS):(n=this._model.mainSeries().bars().last().value,i[TradingView.TIME_PLOT]!==n[TradingView.TIME_PLOT]&&this.setStatus(s.ALERT_STATUS_FAILURE)))}},s.prototype.addPoint=function(t){var e=a.prototype.addPoint.call(this,t);return e&&this.checkAlert(),e},s.prototype.endChanging=function(){a.prototype.endChanging.call(this),this.setStatus(s.ALERT_STATUS_WAITING),this.checkAlert()},s.prototype.onData=function(t){a.prototype.onData.call(this,t),this.checkAlert()},s.prototype.endMoving=function(){a.prototype.endMoving.call(this),this.setStatus(s.ALERT_STATUS_WAITING),this.checkAlert()},s.prototype.direction=function(){var t,e;return this.points().length<2?s.DIRECTION_UP:(t=this.points()[0],e=this.points()[1],e.price>t.price?s.DIRECTION_UP:s.DIRECTION_DOWN)},t.exports=s}).call(e,i(21))},function(t,e){"use strict";t.exports=function(t,e){var i=document.body,o=i[t];return o||(o=document.createElement("img"),o.src=e,i[t]=o),o}},function(t,e,i){(function(e){"use strict";function o(t,e,i){this._data=t,this._measureCache=e,this._chartModel=i,this._points=t.points}function n(t,e,i){r.call(this,t,e),this._image=d("price_label",TradingView.wrapUrl("images/price_label.png")),this._rendererCache={},this._invalidated=!0}function s(t,e){this._constructor="LineToolPriceLabel";var i=e||new p("linetoolpricelabel");a.call(this,t,new n(this,t),i)}var r=i(103),a=i(74).LineDataSource,l=i(93).SelectionRenderer,h=i(94),c=i(98),d=i(191),p=i(80).DefaultProperty;o.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h;0!==this._points.length&&(t.font=[this._data.fontWeight,this._data.fontSize+"px",this._data.fontFamily].join(" "),e=t.measureText(this._data.label),e.height=this._data.fontSize,i=3,o=15,n=-9,s={left:10,top:5},r=e.width+2*s.left,a=e.height+2*s.top,l=this._points[0].x-n,h=this._points[0].y-(a+o),this._measureCache&&$.extend(this._measureCache,{innerWidth:r,innerHeight:a,tailLeft:n,tailHeight:o}),t.translate(.5+l,.5+h),t.beginPath(),t.moveTo(12,a),t.lineTo(n,a+o),t.lineTo(n-1,a+o-1),t.lineTo(5,a),t.lineTo(i,a),t.arcTo(0,a,0,0,i),t.lineTo(0,i),t.arcTo(0,0,r,0,i),t.lineTo(r-i,0),t.arcTo(r,0,r,a,i),t.lineTo(r,a-i),t.arcTo(r,a,0,a,i),t.lineTo(12,a),t.fillStyle=TradingView.generateColor(this._data.backgroundColor,this._data.transparency),t.fill(),t.strokeStyle=this._data.borderColor,t.lineWidth=2,t.stroke(),t.closePath(),t.textBaseline="top",t.fillStyle=this._data.color,t.fillText(this._data.label,s.left,s.top-1),t.translate(-.5,-.5),t.beginPath(),t.arc(n,a+o,2.5,0,2*Math.PI,!1),t.fillStyle=TradingView.generateColor(this._data.borderColor,this._data.transparency),t.fill(),t.strokeStyle=this._chartModel.backgroundColor(),t.lineWidth=1,t.stroke(),t.closePath())},o.prototype.hitTest=function(t){var i,o;return 0===this._points.length?null:(i=this._points[0].x-this._measureCache.tailLeft,o=this._points[0].y-(this._measureCache.innerHeight+this._measureCache.tailHeight),e.pointInRect(t,new e.Point(i,o),new e.Point(i+this._measureCache.innerWidth,o+this._measureCache.innerHeight))?new h(h.MOVEPOINT):null)},inherit(n,r),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){var t,e,i;if(r.prototype.update.call(this),this._source.points().length>0){if(t=this._source.points()[0].price,e=this._source.priceScale(),!e||e.isEmpty())return;e.isPercent()&&(i=this._source.ownerSource().firstValue(),t=e.priceRange().convertToPercent(t,i)),this._priceLabel=e.formatter().format(t)}},n.prototype.renderer=function(){var t,e;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t={},t.points=this._points,t.borderColor=this._source.properties().borderColor.value(),t.backgroundColor=this._source.properties().backgroundColor.value(),t.color=this._source.properties().color.value(),t.fontWeight=this._source.properties().fontWeight.value(),t.fontSize=this._source.properties().fontsize.value(),t.fontFamily=this._source.properties().font.value(),t.transparency=this._source.properties().transparency.value(),t.label=this._priceLabel,t.image=this._image,this.isAnchorsRequired()&&1===t.points.length?(e=new c,e.append(new o(t,this._rendererCache,this._model)),e.append(new l({points:t.points})),e):new o(t,this._rendererCache,this._model)},inherit(s,a),s.prototype.pointsCount=function(){return 1},s.prototype.title=function(){return"Price Label"},t.exports=s}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(){}function n(t,e){this._source=t,this._data=e}function s(t,e){l.call(this,t,e),this._rendererSource=new o,this._invalidated=!0}function r(t,e){this._constructor="LineToolNote";var i=e||new _("linetoolnote");h.call(this,t,new s(this,t),i),this.version=r.version}function a(t,e){var i=e||new _("linetoolnoteabsolute");i.locked.value()||i.locked.setValue(!0),r.call(this,t,i)}var l=i(103),h=i(74).LineDataSource,c=i(104).TextRenderer,d=i(93).SelectionRenderer,p=i(94),u=i(98),_=i(80).DefaultProperty;o.prototype.update=function(t){this._data&&(!this._data||t.markerColor===this._data.markerColor&&t.width===this._data.width&&t.height===this._data.height)||this._createSource(t.width,t.height,t.markerColor),this._data=t},o.prototype._createSource=function(e,i,o){var n,s;this._sourceCanvas=document.createElement("canvas"),this._sourceCanvas.width=e,this._sourceCanvas.height=i,this._translate=new t.Point(-e/2,-i+.5),this._translate.x%1===0&&(this._translate.x+=.5),n=this._sourceCanvas.getContext("2d"),s=.6*e,n.fillStyle=o,n.beginPath(),n.moveTo(e/2,i),n.quadraticCurveTo(e,e/1.15,e,e/2),n.arc(e/2,e/2,e/2,0,Math.PI,!0),n.quadraticCurveTo(0,e/1.15,e/2,i),n.fill(),n.globalCompositeOperation="destination-out",n.beginPath(),n.moveTo((e-s)/2,e/2),n.arc(e/2,e/2,s/2,0,2*Math.PI),n.fill()},o.prototype.drawOn=function(e){var i=new t.Point(Math.round(this._data.point.x),Math.round(this._data.point.y)).add(this._translate);e.drawImage(this._sourceCanvas,i.x,i.y)},o.prototype.hasPoint=function(e){var i=this._data.point.add(this._translate),o=new t.Point(this._data.point.x-this._translate.x,this._data.point.y);return t.pointInRect(e,i,o)},n.prototype.draw=function(t){this._source.drawOn(t),this._data.tooltipVisible&&this.drawTooltipOn(t)},n.prototype.drawTooltipOn=function(t){var e,i,o,n,s,a,l,h,d,p,u,_,f,g,m;for(t.save(),e=(this._data.text+"").replace(/^\s+|\s+$/g,"").replace(/[\r\n]+/g,"\n"),t.font=(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font,i=r.TOOLTIP_WIDTH-2*r.TOOLTIP_PADDING,o=c.prototype.wordWrap(e,i,t.font),n=this._data.point,s=r.TOOLTIP_LINESPACING,a=r.TOOLTIP_WIDTH,l=o.length*this._data.fontSize+2*r.TOOLTIP_PADDING,o.length>1&&(l+=(o.length-1)*s),h=Math.round(n.x-a/2),d=Math.round(n.y-this._data.height-l-8),p=n.x<20||n.x+20>this._data.vpWidth,u=p?null:"top",_=p?null:Math.round(n.x),d<10?d=n.y+13:u="bottom",h<10?h+=Math.abs(h-10):h+a+10>this._data.vpWidth&&(h-=h+a+10-this._data.vpWidth),t.fillStyle=TradingView.generateColor(this._data.backgroundColor,this._data.backgroundTransparency),t.strokeStyle=this._data.markerColor,t.lineWidth=1,t.beginPath(),t.moveTo(h,d),p||"top"!==u||(t.lineTo(_-7,d),t.lineTo(_,d-7),t.lineTo(_+7,d)),t.lineTo(h+a,d),t.lineTo(h+a,d+l),p||"bottom"!==u||(t.lineTo(_+7,d+l),t.lineTo(_,d+l+7),t.lineTo(_-7,d+l)),t.lineTo(h,d+l),t.closePath(),t.fill(),t.stroke(),t.textBaseline="middle",t.fillStyle=this._data.textColor,f=h+r.TOOLTIP_PADDING,g=d+r.TOOLTIP_PADDING+this._data.fontSize/2,m=0;m<o.length;m++)t.fillText(o[m].replace(/^\s+/,""),f,g),g+=this._data.fontSize+s;t.restore()},n.prototype.hitTest=function(t){if(this._source.hasPoint(t))return new p(p.MOVEPOINT)},inherit(s,l),s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){l.prototype.update.call(this),this._invalidated=!1},s.prototype.isLabelVisible=function(){return this.isHoveredSource()||this.isSelectedSource()},s.prototype.renderer=function(){var t,e,i,o,s,r,a;return this._invalidated&&this.updateImpl(),t=new u,e=this._source.properties(),i=e.locked&&e.locked.value(),o=i?this._source.fixedPoints():this._points,o.length<1?t:(s=this.isLabelVisible(),r=s,a=$.extend(e.state(),{point:o[0],width:24,height:32,tooltipVisible:r,vpWidth:this._model.m_timeScale.m_width,vpHeight:this._source.m_priceScale.m_height}),this._rendererSource.update(a),t.append(new n(this._rendererSource,a)),s&&t.append(new d({points:o})),t)},inherit(r,h),r.TOOLTIP_WIDTH=300,r.TOOLTIP_PADDING=10,r.TOOLTIP_LINESPACING=5,r.version=1,r.prototype.pointsCount=function(){return 1},r.prototype.title=function(){return $.t("Note")},r.prototype.restoreTemplate=function(t){delete t.locked,delete t.text,h.prototype.restoreTemplate.call(this,t)},inherit(a,r),a.prototype.title=function(){return $.t("Anchored Note")},r.prototype.state=function(t){var e=h.prototype.state.call(this,t);return t&&(e.state.fixedSize=!1),e},e.LineToolNote=r,e.LineToolNoteAbsolute=a}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){s.call(this,t,e),this._invalidated=!0,this._model=e,this._source=t}function n(t,e){this._constructor="LineToolBrush";var i=e||new c("linetoolbrush");r.call(this,t,new o(this,t),i),this._finished=!1}var s=i(103),r=i(74).LineDataSource,a=i(158),l=i(93).SelectionRenderer,h=i(98),c=i(80).DefaultProperty;inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype._smoothArray=function(t,i){var o,n,s,r,a,l=Array(t.length);for(o=0;o<t.length;o++){for(n=new e.Point(0,0),s=0;s<i;s++)r=Math.max(o-s,0),a=Math.min(o+s,t.length-1),n=n.add(t[r]),n=n.add(t[a]);l[o]=n.scaled(.5/i)}return l.push(t[t.length-1]),l},o.prototype._updateInternal=function(){var t,e,i,o,n,r,a,l,h;if(s.prototype.update.call(this),t=Math.max(1,this._source.properties().smooth.value()),e=this._points,0!==e.length){for(i=[e[0]],o=1;o<e.length;o++){for(n=e[o].substract(e[o-1]),r=n.length(),a=Math.min(5,Math.floor(r/t)),l=n.normalized().scaled(r/a),h=0;h<a-1;h++)i.push(e[o-1].add(l.scaled(h)));i.push(e[o])}this._points=this._smoothArray(i,t)}},o.prototype.renderer=function(){var t,e,i,o;return this._invalidated&&(this._updateInternal(),this._invalidated=!1),t={},e=this._source.properties(),t.points=this._points,t.color=e.linecolor.value(),t.linewidth=e.linewidth.value(),t.linestyle=e.linestyle.value(),t.skipClosePath=!0,t.leftend=this._source.properties().leftEnd.value(),t.rightend=this._source.properties().rightEnd.value(),e.fillBackground.value()&&this._model.lineBeingCreated()!==this._source&&(t.filled=!0,t.fillBackground=!0,t.backcolor=e.backgroundColor.value(),t.transparency=e.transparency.value()),this.isAnchorsRequired()&&this._source.finished()?(i=new h,i.append(new a(t)),t.points.length>0&&(o=[t.points[0],t.points[t.points.length-1]],i.append(new l({points:o}))),i):new a(t)},inherit(n,r),n.prototype.pointsCount=function(){return-1},n.prototype.finished=function(){return this._finished},n.prototype.finish=function(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()},n.prototype.title=function(){return"Brush"},n.prototype.percentDistance=function(t,e){return Math.abs((e-t)/t)},n.prototype.addPoint=function(t){var e,i,o,n;return!!this._finished||(this._lastPoint=null,this._points.length>0&&(e=this._points[this._points.length-1],i=this.pointToScreenPoint(e)[1],o=this.pointToScreenPoint(t)[1],n=o.substract(i).length(),n<2)?this._finished:(r.prototype.addPoint.call(this,t),this._finished))},n.prototype.restorePoints=function(t,e,i){r.prototype.restorePoints.call(this,t,e,i),this._finished=!0},t.exports=n}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._data=t,this._data.angleFrom=0,this._data.angleTo=Math.PI,this._data.clockwise=!1}function n(t,e){r.call(this,t,e),this._invalidated=!0}function s(t,e){this._constructor="LineToolArc";var i=e||new c("linetoolarc");a.call(this,t,new n(this,t),i),this.version=s.version}var r=i(103),a=i(74).LineDataSource,l=i(94),h=i(98),c=i(80).DefaultProperty;o.prototype.draw=function(t){var i,o,n,s,r,a,l,h,c,d,p,u,_,f;if(!(this._data.points.length<2)){if(i=this._data.points[0],o=this._data.points[1],this._data.points.length<3)return t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.beginPath(),t.moveTo(i.x,i.y),t.lineTo(o.x,o.y),void t.stroke();if(n=this._data.points[2],s=e.distanceToLine(i,o,n).distance,s<1)return t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.beginPath(),t.moveTo(i.x,i.y),t.lineTo(o.x,o.y),void t.stroke();r=o.substract(i),a=i.add(o).scaled(.5),l=new e.Point(-r.y,r.x),l=l.normalized(),n=a.add(l.scaled(s)),t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,h=r.length(),c=r.x/h,d=r.y/h,p=Math.acos(c),d<0&&(p=-p),u=this._data.points[2],_=e.Matrix.translate(-a.x,-a.y),u=_.mult(u),_=e.Matrix.rotate(-p),u=_.mult(u),_=e.Matrix.scale(1,h/(2*s)),u=_.mult(u),u.y<0?this._data.clockwise=!0:this._data.clockwise=!1,t.save(),t.beginPath(),t.translate(i.x,i.y),t.rotate(p),f=1-Math.sqrt(3)/2,t.scale(1,s/(h*f)),this._data.clockwise?t.arc(.5*h,h*Math.sqrt(3)/2,h,-2*Math.PI/3,-Math.PI/3,!1):t.arc(.5*h,-h*Math.sqrt(3)/2,h,Math.PI/3,2*Math.PI/3,!1),t.restore(),t.stroke(),this._data.fillBackground&&(t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),t.fill())}},o.prototype.hitTest=function(t){var i,o,n,s,r,a,h,c,d,p,u,_,f,g,m,v,y;return this._data.points.length<3?null:(i=5,o=this._data.points[0],n=this._data.points[1],s=this._data.points[2],r=e.distanceToLine(o,n,s).distance,r<1?(r=e.distanceToLine(o,n,t).distance,r<i?new l(l.MOVEPOINT):null):(a=n.substract(o),h=a.length(),c=o.add(n).scaled(.5),d=s.substract(c),d=d.normalized(),s=c.add(d.scaled(r)),p=a.x/h,u=a.y/h,_=Math.acos(p),u<0&&(_=-_),f=e.Matrix.translate(-o.x,-o.y),t=f.mult(t),f=e.Matrix.rotate(-_),t=f.mult(t),d=f.mult(d),g=1-Math.sqrt(3)/2,f=e.Matrix.scale(1,h*g/r),t=f.mult(t),d=f.mult(d),t.y*d.y<0?null:(m=t.y<0?new e.Point(.5*h,h*Math.sqrt(3)/2):new e.Point(.5*h,-h*Math.sqrt(3)/2),v=t.substract(m),y=v.length(),Math.abs(y-h)<=i?new l(l.MOVEPOINT):null)))},inherit(n,r),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){r.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var t,i,n,s,r,a,l,c,d,p,u,_,f,g,m,v,y,b,w,S;return this._invalidated&&this.updateImpl(),t={},t.points=this._points,t.color=this._source.properties().color.value(),t.linewidth=this._source.properties().linewidth.value(),t.backcolor=this._source.properties().backgroundColor.value(),t.fillBackground=this._source.properties().fillBackground.value(),t.transparency=this._source.properties().transparency.value(),this.isAnchorsRequired()?(i=new h,i.append(new o(t)),n=[],s=t.points[0],r=new e.Point(s.x,s.y),r.data=0,n.push(r),1===t.points.length?i:(a=t.points[1],l=new e.Point(a.x,a.y),l.data=1,2===t.points.length?(this.addAnchors(i),i):(n.push(l),c=t.points[2],d=e.distanceToLine(s,a,c).distance,p=a.substract(s),u=s.add(a).scaled(.5),_=new e.Point(-p.y,p.x),_=_.normalized(),c=u.add(_.scaled(d)),f=u.add(_.scaled(-d)),g=p.length(),m=p.x/g,v=p.y/g,y=Math.acos(m),v<0&&(y=-y),b=t.points[2],w=e.Matrix.translate(-u.x,-u.y),b=w.mult(b),w=e.Matrix.rotate(-y),b=w.mult(b),w=e.Matrix.scale(1,g/(2*d)),b=w.mult(b),S=b.y>=0?new e.Point(c.x,c.y):new e.Point(f.x,f.y),S.data=2,n.push(S),i.append(this.createLineAnchor({points:n})),i))):new o(t)},inherit(s,a),s.prototype.startChanging=function(t,i){var o,n,s,r,l,h,c,d;a.prototype.startChanging.call(this,t,i),0!==t&&1!==t||(o=this.pointToScreenPoint(this._points[0])[0],n=this.pointToScreenPoint(this._points[1])[0],s=this.pointToScreenPoint(this._points[2])[0],this._dist=e.distanceToLine(o,n,s).distance,r=n.substract(o),l=new e.Point(-r.y,r.x),h=o.add(n).scaled(.5),c=s.substract(h),d=c.dotProduct(l),d<0&&(this._dist=-this._dist))},s.prototype.pointsCount=function(){return 3},s.prototype.title=function(){return"Arc"},s.prototype.setPoint=function(t,i){var o,n,s,r,a,l,h,c,d,p,u,_,f,g=$.extend({},i),m=this.pointToScreenPoint(this._points[0])[0],v=this.pointToScreenPoint(this._points[1])[0],y=this.pointToScreenPoint(this._points[2])[0],b=this.priceScale();switch(b.isPercent()&&(o=this.ownerSource().firstValue(),g.price=b.priceRange().convertFromPercent(g.price,o)),t){case 0:m=this.pointToScreenPoint(g)[0],n=v.substract(m),s=m.add(v).scaled(.5),r=new e.Point(-n.y,n.x),r=r.normalized(),y=s.add(r.scaled(this._dist)),y=this.screenPointToPoint(y),this._points[0]=g,this._points[2]=y;break;case 1:a=e.distanceToLine(m,v,y).distance,v=this.pointToScreenPoint(g)[0],n=v.substract(m),s=m.add(v).scaled(.5),r=new e.Point(-n.y,n.x),r=r.normalized(),y=s.add(r.scaled(this._dist)),y=this.screenPointToPoint(y),this._points[1]=g,this._points[2]=y;break;case 2:g=this.pointToScreenPoint(g)[0],a=e.distanceToLine(m,v,g).distance,n=v.substract(m),s=m.add(v).scaled(.5),r=new e.Point(-n.y,n.x),r=r.normalized(),y=s.add(r.scaled(a)),l=s.add(r.scaled(-a)),h=n.length(),c=n.x/h,d=n.y/h,p=Math.acos(c),d<0&&(p=-p),u=e.Matrix.translate(-s.x,-s.y),g=u.mult(g),_=u.mult(y),u=e.Matrix.rotate(-p),g=u.mult(g),_=u.mult(_),u=e.Matrix.scale(1,h/(2*a)),g=u.mult(g),_=u.mult(_),f=g.y*_.y>=0?new e.Point(y.x,y.y):new e.Point(l.x,l.y),f=this.screenPointToPoint(f),this._points[2]=f}this.normalizePoints()},s.version=2,s.prototype.migrateVersion=function(t,e,i){var o,n;1===t&&2===this._points.length&&(o=(2*this._points[0].price+3*this._points[1].price)/5,this._points.append({price:o,index:this._points[1].index})),1===t&&2===this._timePoint.length&&(o=(2*this._timePoint[0].price+3*this._timePoint[1].price)/5,n={price:o,offset:this._timePoint[1].offset,time_t:this._timePoint[1].time_t},this._timePoint.append(n))},t.exports=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){this._data=t,t.lines=this.wordWrap(t.text,t.wordWrapWidth),this._textSizeCache=e}function n(t,e){r.call(this,t,e),this._textSizeCache={},this._invalidated=!0}function s(t,e){this._constructor="LineToolCallout";var i=e||new d("linetoolcallout");a.call(this,t,new n(this,t),i),this._barOffset=0,this._timeScale=t.timeScale()}var r=i(103),a=i(74).LineDataSource,l=i(79).DataSource,h=i(94),c=i(98),d=i(80).DefaultProperty;o.ROUND_RADIUS=8,o.TEXT_MARGINS=2,function(){function t(){var t=document.createElement("canvas");t.width=0,t.height=0,e=t.getContext("2d"),t=null}var e;o.prototype.wordWrap=function(i,o){var n,s,r,a,l,h,c,d,p;if(e||t(),o=+o,i+="",n=i.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/),n[n.length-1]||n.pop(),!isFinite(o)||o<=0)return n;for(e.font=this.fontStyle(),s=[],r=0;r<n.length;r++)if(a=n[r],l=e.measureText(a).width,l<=o)s.push(a);else for(h=a.split(/([-\)\]\},.!?:;])|(\s+)/);h.length;){if(c=~~(o/l*(h.length+2)/3),c<=0||e.measureText(h.slice(0,3*c-1).join("")).width<=o)for(;e.measureText(h.slice(0,3*(c+1)-1).join("")).width<=o;)c++;else for(;c>0&&e.measureText(h.slice(0,3*--c-1).join("")).width>o;);if(c>0)s.push(h.slice(0,3*c-1).join("")),h.splice(0,3*c);else{if(d=h[0]+(h[1]||""),p=1===p?1:~~(o/e.measureText(d)*d.length),e.measureText(d.substr(0,p)).width<=o)for(;e.measureText(d.substr(0,p+1)).width<=o;)p++;else for(;p>1&&e.measureText(d.substr(0,--p)).width>o;);p<1&&(p=1),s.push(d.substr(0,p)),h[0]=d.substr(p),h[1]=""}if(l=e.measureText(h.join("")).width,l<=o){s.push(h.join(""));break}}return s}}(),o.prototype.hitTest=function(t){var e,i,o,n,s;return this._data.points.length<2?null:(e=this._data.points[0],i=this._data.points[1],o=3,e.substract(t).length()<o?new h(h.CHANGEPOINT,0):(n=i.x-this._textSizeCache.totalWidth/2,s=i.y-this._textSizeCache.totalHeight/2,t.x>=n&&t.x<=n+this._textSizeCache.totalWidth&&t.y>=s&&t.y<=s+this._textSizeCache.totalHeight?new h(h.MOVEPOINT):null))},o.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font},o.prototype.draw=function(t){var e,i,n,s,r,a,l,h,c,d,p,u,_,f;if(!(this._data.points.length<2)){for(e=this._data.points[0].clone(),i=this._data.points[1].clone(),t.lineCap="butt",t.strokeStyle=this._data.bordercolor,t.lineWidth=this._data.linewidth,
t.textBaseline="bottom",t.font=this.fontStyle(),n=this._data.fontSize*this._data.lines.length,s=this._data.wordWrapWidth||this._data.lines.reduce(function(e,i){return Math.max(e,t.measureText(i).width)},0),this._textSizeCache.textHeight=n,this._textSizeCache.textHeight=s,r=o.ROUND_RADIUS,a=o.TEXT_MARGINS,l=s+2*a+2*r,h=n+2*a+2*r,this._textSizeCache.totalWidth=l,this._textSizeCache.totalHeight=h,c=i.x-l/2,d=i.y-h/2,p=0,u=s+2*a>2*r,_=n+2*a>2*r,e.x>c+l?p=20:e.x>c&&(p=10),e.y>d+h?p+=2:e.y>d&&(p+=1),t.save(),t.translate(c,d),e.x-=c,e.y-=d,i.x-=c,i.y-=d,t.beginPath(),t.moveTo(r,0),10===p?u?(t.lineTo(i.x-r,0),t.lineTo(e.x,e.y),t.lineTo(i.x+r,0),t.lineTo(l-r,0)):(t.lineTo(e.x,e.y),t.lineTo(l-r,0)):t.lineTo(l-r,0),20===p?(t.lineTo(e.x,e.y),t.lineTo(l,r)):t.arcTo(l,0,l,r,r),21===p?_?(t.lineTo(l,i.y-r),t.lineTo(e.x,e.y),t.lineTo(l,i.y+r),t.lineTo(l,h-r)):(t.lineTo(e.x,e.y),t.lineTo(l,h-r)):t.lineTo(l,h-r),22===p?(t.lineTo(e.x,e.y),t.lineTo(l-r,h)):t.arcTo(l,h,l-r,h,r),12===p?u?(t.lineTo(i.x+r,h),t.lineTo(e.x,e.y),t.lineTo(i.x-r,h),t.lineTo(r,h)):(t.lineTo(e.x,e.y),t.lineTo(r,h)):t.lineTo(r,h),2===p?(t.lineTo(e.x,e.y),t.lineTo(0,h-r)):t.arcTo(0,h,0,h-r,r),1===p?_?(t.lineTo(0,i.y+r),t.lineTo(e.x,e.y),t.lineTo(0,i.y-r),t.lineTo(0,r)):(t.lineTo(e.x,e.y),t.lineTo(0,r)):t.lineTo(0,r),0===p?(t.lineTo(e.x,e.y),t.lineTo(r,0)):t.arcTo(0,0,r,0,r),t.stroke(),t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),t.fill(),t.fillStyle=this._data.color,d=r+a+this._data.fontSize,c=r+a,f=0;f<this._data.lines.length;f++)t.fillText(this._data.lines[f],c,d),d+=this._data.fontSize;t.restore()}},inherit(n,r),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){r.prototype.update.call(this),this._source._calculatePoint2()},n.prototype.renderer=function(){var t,i,n,s,r,a,l,h;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points[0]?this._points.length<2?void 0:(t=this._source.properties(),i={},i.points=[],i.points.push(this._points[0]),n=this._points[1].clone(),n.x=this._points[0].x+this._source._barOffset*this._model.timeScale().barSpacing(),i.points.push(n),i.color=t.color.value(),i.linewidth=t.linewidth.value(),i.backcolor=t.backgroundColor.value(),i.transparency=t.transparency.value(),i.text=t.text.value(),i.font=t.font.value(),i.fontSize=t.fontsize.value(),i.bordercolor=t.bordercolor.value(),t.wordWrap&&t.wordWrap.value()&&(i.wordWrapWidth=t.wordWrapWidth.value()),i.bold=t.bold&&t.bold.value(),i.italic=t.italic&&t.italic.value(),s=new o(i,this._textSizeCache),this.isAnchorsRequired()?(r=new c,r.append(s),a=i.points[1],l=[].concat(i.points),l.splice(l.length-1,1),r.append(this.createLineAnchor({points:l})),i.wordWrapWidth&&(h=new e.Point(a.x+(i.wordWrapWidth>>1)+o.ROUND_RADIUS+o.TEXT_MARGINS,a.y),h.data=1,r.append(this.createLineAnchor({points:[h]}))),r):s):new c},inherit(s,a),s.MIN_WIDTH=100,s.prototype.pointsCount=function(){return 2},s.prototype.title=function(){return"Callout"},s.prototype.correctPoints=function(t){var e=this._currentMovingPoint.index-this._startMovingPoint.index,i=this._currentMovingPoint.price-this._startMovingPoint.price,o=t[1];o.index+=e,o.price+=i,t[1]=o},s.prototype.addPoint=function(t){var e=a.prototype.addPoint.call(this,t);return e&&this._calculateBarOffset(),e},s.prototype._calculateBarOffset=function(){this.points().length>1&&(this._barOffset=this.points()[1].index-this.points()[0].index)},s.prototype.setLastPoint=function(t){a.prototype.setLastPoint.call(this,t),2===this.points().length&&this._calculateBarOffset()},s.prototype.setPoint=function(t,e){var i,n,r,l,h;switch(t){case 0:a.prototype.setPoint.call(this,t,e),this._calculateBarOffset();break;case 1:if(i=this.properties(),!i.wordWrapWidth)return;if(n=this._points,r=this._dragStartLeftEdgeIndex,l=Math.round((e.index-r)/2),isFinite(r)&&isFinite(l)){if(n[1]={index:r+l,price:n[1].price},this._calculateBarOffset(),this.normalizePoints(),h=this._timeScale.indexToCoordinate(r+2*l)-this._timeScale.indexToCoordinate(r)-o.ROUND_RADIUS-o.TEXT_MARGINS,!isFinite(h))return;i.wordWrapWidth.setValue(Math.max(s.MIN_WIDTH,h));break}n[1]=e,this._calculateBarOffset(),this.normalizePoints()}},s.prototype.startDragPoint=function(t,e){var i=this.properties();1===t&&i.wordWrap&&i.wordWrap.value()&&(this._dragStartLeftEdgeIndex=2*this.points()[1].index-e.index)},s.prototype.move=function(t){a.prototype.move.call(this,t),this._calculateBarOffset()},s.prototype.state=function(t){var e=a.prototype.state.call(this,t);return e.barOffset=this._barOffset,e},s.prototype.restoreData=function(t){t.barOffset?this._barOffset=t.barOffset:this._calculateBarOffset(),this._calculatePoint2()},s.prototype.setPriceScale=function(t){l.prototype.setPriceScale.call(this,t),t&&t.priceRange()&&this._calculatePoint2()},s.prototype._calculatePoint2=function(){var t,e;this._model.lineBeingEdited()!==this&&this._model.sourceBeingMoved()!==this&&(this._points.length<2||(t=this.points()[0],e=this.points()[1],this._points[1]={price:e.price,index:t.index+this._barOffset}))},t.exports=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){this._measureCache=e,this._data=t}function n(t,e){r.call(this,t,e),this._rendererCache={},this._invalidated=!0}function s(t,e){this._constructor="LineToolBalloon";var i=e||new d("linetoolballoon");a.call(this,t,new n(this,t),i)}var r=i(103),a=i(74).LineDataSource,l=i(93).SelectionRenderer,h=i(94),c=i(98),d=i(80).DefaultProperty;o.prototype.draw=function(t){var e,i,o,n,s,r,a;0!==this._data.points.length&&(t.font=[this._data.fontWeight,this._data.fontSize+"px",this._data.fontFamily].join(" "),e=t.measureText(this._data.label),e.height=this._data.fontSize,i=15,o={left:i,top:(2*i-e.height)/2},n=e.width+2*o.left,s=2*i,r=this._data.points[0].x-(o.left+20),a=this._data.points[0].y-(s+9),this._measureCache&&$.extend(this._measureCache,{innerWidth:n,innerHeight:s,padding:o}),t.translate(.5+r,.5+a),t.beginPath(),t.moveTo(i+9,s),t.lineTo(i,s),t.arcTo(-1e3,0,1e3,0,i),t.lineTo(n-i,0),t.arcTo(1e3,s,-1e3,s,i),t.lineTo(i+18,s),t.quadraticCurveTo(i+18,s+4,i+20,s+9),t.quadraticCurveTo(i+12,s+6,i+9,s),t.fillStyle=TradingView.generateColor(this._data.backgroundColor,this._data.transparency),t.fill(),t.strokeStyle=this._data.borderColor,t.lineWidth=2,t.stroke(),t.closePath(),t.textBaseline="top",t.fillStyle=this._data.color,t.fillText(this._data.label,o.left,o.top-1))},o.prototype.hitTest=function(t){var i,o;return 0!==this._data.points.length&&this._measureCache.padding?(i=this._data.points[0].x-(this._measureCache.padding.left+20),o=this._data.points[0].y-(this._measureCache.innerHeight+9),e.pointInRect(t,new e.Point(i,o),new e.Point(i+this._measureCache.innerWidth,o+this._measureCache.innerHeight))?new h(h.MOVEPOINT):null):null},inherit(n,r),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){r.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var t,e;return this._invalidated&&this.updateImpl(),t={},t.points=this._points,t.color=this._source.properties().color.value(),t.borderColor=this._source.properties().borderColor.value(),t.backgroundColor=this._source.properties().backgroundColor.value(),t.transparency=this._source.properties().transparency.value(),t.fontWeight=this._source.properties().fontWeight.value(),t.fontSize=this._source.properties().fontsize.value(),t.fontFamily=this._source.properties().font.value(),t.label=this._source.properties().text.value(),this.isAnchorsRequired()&&1===t.points.length?(e=new c,e.append(new o(t,this._rendererCache)),e.append(new l({points:t.points})),e):new o(t,this._rendererCache)},inherit(s,a),s.prototype.pointsCount=function(){return 1},s.prototype.title=function(){return"Balloon"},t.exports=s}).call(e,i(21))},function(t,e,i){"use strict";function o(t){this._data=t}function n(t,e){l.call(this,t,e),this._rendererCache={},this._invalidated=!0}function s(t,e){this._source=t,this._model=e,this._text="",this._coordinate=0,this._background="black"}function r(t,e){this._constructor="LineToolHorzRay";var i=e||new _("linetoolhorzray");this._priceAxisView=new s(this,t),a.call(this,t,new n(this,t),i)}var a=i(74).LineDataSource,l=i(103),h=i(75),c=i(104).TextRenderer,d=i(76),p=i(94),u=i(98),_=i(80).DefaultProperty;o.prototype.draw=function(t){var e,i,o,n;return 0===this._data.points.length?null:(e=t.canvas.width,i=this._data.points[0].y,o=Math.max(0,this._data.points[0].x),n=Math.max(e,this._data.points[0].x),t.lineCap="square",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineStyle=this._data.linestyle,void CanvasEx.drawLine(t,o,i,n,i))},o.prototype.hitTest=function(t){if(0===this._data.points.length)return null;if(t.x<this._data.points[0].x)return null;var e=3;return Math.abs(t.y-this._data.points[0].y)<=e?new p(this._data.hitTestResult):null},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this)},n.prototype.renderer=function(){var t,e,i,n,s,r,a,l,h;return this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=new u,e={},e.points=this._points,e.color=this._source.properties().linecolor.value(),e.linewidth=this._source.properties().linewidth.value(),e.linestyle=this._source.properties().linestyle.value(),e.hitTestResult=p.MOVEPOINT,i=this._source.properties(),t.append(new o(e)),this._source.properties().showLabel.value()&&1===this._points.length&&(n=i.vertLabelsAlign.value(),s=i.horzLabelsAlign.value(),r=this._points[0].clone(),a=0,l=0,"right"===s?(r.x=this._model.timeScale().width(),l=-5):"center"===s&&(r.x=(r.x+this._model.timeScale().width())/2),"middle"===n?a=-this._source.properties().fontsize.value()/6:"bottom"===n&&(a=-4),h={points:[r],text:i.text.value(),color:i.textcolor.value(),vertAlign:n,horzAlign:s,font:i.font.value(),offsetX:l,offsetY:a,bold:this._source.properties().bold.value(),italic:this._source.properties().italic.value(),fontsize:this._source.properties().fontsize.value()},t.append(new c(h,this._rendererCache))),this.addAnchors(t),TradingView.printing||!this._source.hasAlert.value()||this._model.readOnly()||1!==this._points.length||this._source.getAlertIsActive(function(i){t.append(new TradingView.PaneRendererClockIcon({point1:e.points[0],color:i?e.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),t},inherit(s,h),s.prototype.update=function(){this._invaildated=!0},s.prototype.updateImpl=function(){0!==this._source.points().length&&this._source.priceScale()&&!this._source.priceScale().isEmpty()&&(this._background=this._source.properties().linecolor.value(),this._coordinate=this._source.priceScale().priceToCoordinate(this._source.points()[0].price),this._text=this._source.priceScale().formatter().format(this._source.points()[0].price))},s.prototype.renderer=function(){this._invaildated&&(this.updateImpl(),this._invaildated=!1);var t={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,visible:!0};return new d(t)},inherit(r,a),r.prototype.pointsCount=function(){return 1},r.prototype.title=function(){return"Horizontal Ray"},r.prototype.priceAxisViews=function(t,e){return this.isActualSymbol()&&e===this.priceScale()&&this.properties().showPrice.value()&&this._model.paneForSource(this)===t?[this._priceAxisView]:null},r.prototype.updateAllViews=function(){a.prototype.updateAllViews.call(this),this._priceAxisView.update()},r.prototype.canHasAlert=function(){return!0},r.prototype._getAlertPlots=function(){var t=this._points[0],e={index:t.index+1,price:t.price};return[this._linePointsToAlertPlot([t,e],null,!1,!0)]},t.exports=r},function(t,e,i){(function(e){"use strict";function o(t){this._data=t,this._data.angleFrom=0,this._data.angleTo=2*Math.PI,this._data.clockwise=!1}function n(t,e){a.call(this,t,e),this._invalidated=!0}function s(t,e){this._constructor="LineToolEllipse";var i=e||new c("linetoolellipse");r.call(this,t,new n(this,t),i),this.version=s.version}var r=i(74).LineDataSource,a=i(103),l=i(94),h=i(98),c=i(80).DefaultProperty;o.prototype.draw=function(t){var i,o,n,s,r,a,l,h,c,d,p,u,_;if(!(this._data.points.length<2)){if(i=this._data.points[0],o=this._data.points[1],this._data.points.length<3)return t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.beginPath(),t.moveTo(i.x,i.y),t.lineTo(o.x,o.y),void t.stroke();if(n=this._data.points[2],s=e.distanceToLine(i,o,n).distance,s<1)return t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.beginPath(),t.moveTo(i.x,i.y),t.lineTo(o.x,o.y),void t.stroke();r=o.substract(i),a=i.add(o).scaled(.5),l=new e.Point(-r.y,r.x),l=l.normalized(),n=a.add(l.scaled(s)),t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,h=r.length(),c=r.x/h,d=r.y/h,p=Math.acos(c),d<0&&(p=-p),u=this._data.points[2],_=e.Matrix.translate(-a.x,-a.y),u=_.mult(u),_=e.Matrix.rotate(-p),u=_.mult(u),_=e.Matrix.scale(1,h/(2*s)),u=_.mult(u),u.y<0?this._data.clockwise=!0:this._data.clockwise=!1,t.save(),t.beginPath(),t.translate(a.x,a.y),t.rotate(p),t.scale(1,2*s/h),t.arc(0,0,.5*h,this._data.angleFrom,this._data.angleTo,this._data.clockwise),t.restore(),t.stroke(),this._data.fillBackground&&(t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),t.fill())}},o.prototype._additionalPointTest=function(t,e){return!0},o.prototype.hitTest=function(t){var i,o,n,s,r,a,h,c,d,p,u,_,f,g,m;return this._data.points.length<3?null:(i=this._data.points[0],o=this._data.points[1],n=this._data.points[2],s=e.distanceToLine(i,o,n).distance,r=o.substract(i),a=i.add(o).scaled(.5),h=new e.Point(-r.y,r.x),h=h.normalized(),n=a.add(h.scaled(s)),c=r.length(),d=r.x/c,p=r.y/c,u=Math.acos(d),p<0&&(u=-u),_=e.Matrix.translate(-a.x,-a.y),t=_.mult(t),f=_.mult(this._data.points[2]),_=e.Matrix.rotate(-u),t=_.mult(t),f=_.mult(f),_=e.Matrix.scale(1,c/(2*s)),t=_.mult(t),f=_.mult(f),g=t.length(),m=3,this._additionalPointTest(t,f)?Math.abs(g-.5*c)<=m?new l(l.MOVEPOINT):this._data.fillBackground&&!this._data.noHitTestOnBackground&&g<=.5*c?new l(l.MOVEPOINT_BACKGROUND):null:null)},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var t,i,n,s,r,a,l,c,d,p,u,_,f,g;return this._invalidated&&this.updateImpl(),t=new h,this._points.length<2?t:(i={},i.points=this._points,i.color=this._source.properties().color.value(),i.linewidth=this._source.properties().linewidth.value(),i.backcolor=this._source.properties().backgroundColor.value(),i.fillBackground=this._source.properties().fillBackground.value(),i.transparency=this._source.properties().transparency.value(),t.append(new o(i)),this.isAnchorsRequired()?(n=i.points[0],s=i.points[1],2===this._points.length?(this.addAnchors(t),t):(r=i.points[2],a=e.distanceToLine(n,s,r).distance,l=s.substract(n),c=n.add(s).scaled(.5),d=new e.Point(-l.y,l.x),d=d.normalized(),r=c.add(d.scaled(a)),p=c.add(d.scaled(-a)),u=new e.Point(n.x,n.y),u.data=0,_=new e.Point(s.x,s.y),_.data=1,f=new e.Point(r.x,r.y),f.data=2,g=new e.Point(p.x,p.y),g.data=3,t.append(this.createLineAnchor({points:[u,_,f,g]})),t)):t)},inherit(s,r),s.prototype.startChanging=function(t,i){var o,n,s;r.prototype.startChanging.call(this,t,i),0!==t&&1!==t||(o=this.pointToScreenPoint(this._points[0])[0],n=this.pointToScreenPoint(this._points[1])[0],s=this.pointToScreenPoint(this._points[2])[0],this._dist=e.distanceToLine(o,n,s).distance||0)},s.prototype._preparePoint=function(t,e){var i=this._preparePointInternal(t,e,!1);return e&&e.shift&&this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[1],this._points[0],i),i},s.prototype._preparePointInternal=function(t,i,o){var n,s,a,l,h,c,d,p,u,_,f;if(this._convertPriceFromPercentIfNeeded(t),n=$.extend({},t),i&&i.shift){if(s=this.points().length,!this._fakePointAdded&&3===s&&!o)return n;(this._fakePointAdded||2===s||o)&&(this._snapPoint45Degree(t,this._points[0]),this._fakePointAdded?this._points[1]=t:o||(this._fakePointAdded=!0,r.prototype._addPointIntenal.call(this,t)),a=this.pointToScreenPoint(this._points[0])[0],l=this.pointToScreenPoint(this._points[1])[0],h=l.x-a.x,c=l.y-a.y,d=Math.sqrt(h*h+c*c)/2,p=l.substract(a),u=a.add(l).scaled(.5),_=new e.Point(-p.y,p.x),_=_.normalized(),f=u.add(_.scaled(d)),n=this.screenPointToPoint(f),(TradingView.isNaN(n.price)||TradingView.isNaN(n.index))&&(n=this.screenPointToPoint(u)))}else this._fakePointAdded&&(this._points.splice(1,1),this._fakePointAdded=!1);return n},s.prototype._fixVerticalDiameterPoints=function(t,e,i){var o=this.pointToScreenPoint(t)[0],n=this.pointToScreenPoint(e)[0],s=this._model.timeScale(),r=s.indexToCoordinate(t.index),a=s.indexToCoordinate(i.index),l=2*Math.abs(r-a);l*=e.price>t.price?1:-1,t.price=this.screenPointToPoint({x:o.x,y:n.y+l}).price},s.prototype.addPoint=function(t,e,i){var o=r.prototype.addPoint.call(this,t,e,i);return o&&(this._fakePointAdded=!1),o},s.prototype.setPoint=function(t,i,o){var n,s,r,a,l=$.extend({},i),h=this.pointToScreenPoint(this._points[0])[0],c=this.pointToScreenPoint(this._points[1])[0],d=this.pointToScreenPoint(this._points[2])[0];switch(this._convertPriceFromPercentIfNeeded(l),t){case 0:if(o&&o.shift){this._snapPoint45Degree(l,this._points[1]),this._points[0]=l,this._points[2]=this._preparePointInternal(this._points[2],o,!0),this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[0],this._points[1],this._points[2]);break}h=this.pointToScreenPoint(l)[0],n=c.substract(h),s=h.add(c).scaled(.5),r=new e.Point(-n.y,n.x),r=r.normalized(),d=s.add(r.scaled(this._dist)),d=this.screenPointToPoint(d),this._points[0]=l,this._points[2]=d;break;case 1:if(o&&o.shift){this._snapPoint45Degree(l,this._points[0]),this._points[1]=l,this._points[2]=this._preparePointInternal(this._points[2],o,!0),this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[1],this._points[0],this._points[2]);break}c=this.pointToScreenPoint(l)[0],n=c.substract(h),s=h.add(c).scaled(.5),r=new e.Point(-n.y,n.x),r=r.normalized(),d=s.add(r.scaled(this._dist)),d=this.screenPointToPoint(d),this._points[1]=l,this._points[2]=d;break;case 2:l=this.pointToScreenPoint(l)[0],a=e.distanceToLine(h,c,l).distance,n=c.substract(h),s=h.add(c).scaled(.5),r=new e.Point(-n.y,n.x),r=r.normalized(),d=s.add(r.scaled(a)),d=this.screenPointToPoint(d),this._points[2]=d;break;case 3:l=this.pointToScreenPoint(l)[0],a=e.distanceToLine(h,c,l).distance,n=c.substract(h),s=h.add(c).scaled(.5),r=new e.Point(-n.y,n.x),r=r.normalized(),d=s.add(r.scaled(a)),d=this.screenPointToPoint(d),this._points[2]=d}this.normalizePoints()},s.prototype.pointsCount=function(){return 3},s.prototype.title=function(){return"Ellipse"},s.version=2,s.prototype.migrateVersion=function(t,e,i){var o,n,s;1===t&&2===this._points.length&&(o=this._points[0].price,n=.5*(this._points[0].price+this._points[1].price),this._points[0]={price:n,index:this._points[0].index},this._points[1]={price:n,index:this._points[1].index},this._points.push({price:o,index:this._points[0].index})),1===t&&2===this._timePoint.length&&(o=this._timePoint[0].price,n=.5*(this._timePoint[0].price+this._timePoint[1].price),this._timePoint[0].price=n,this._timePoint[1].price=n,s={price:o,offset:this._timePoint[0].offset,time_t:this._timePoint[0].time_t},this._timePoint.push(s))},t.exports=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._data=t}function n(t,e){a.call(this,t,e),this._invalidated=!0}function s(t,e){this._constructor="LineToolTimeCycles";var i;i=e?e:new c("linetooltimecycles"),r.call(this,t,new n(this,t),i)}var r=i(74).LineDataSource,a=i(103),l=i(94),h=i(98),c=i(80).DefaultProperty;o.prototype.draw=function(t){t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(t,this._data.linestyle),t.save(),t.translate(this._data.point.x+1,this._data.point.y),t.scale(this._data.width,this._data.height),t.beginPath(),t.arc(.5,0,.5,Math.PI,0,!1),t.restore(),t.stroke(),this._data.fillBackground&&(t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),t.fill())},o.prototype.hitTest=function(t){var i,o,n,s,r;return t.y>this._data.point.y?null:t.x<this._data.point.x||t.x>this._data.point.x+this._data.width?null:(i=new e.Point(this._data.point.x+this._data.width/2,this._data.point.y),o=t.substract(i),n=this._data.height/this._data.width,o.y/=n,s=o.length(),r=3,Math.abs(s-this._data.width/2)<r?new l(l.MOVEPOINT):null)},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var t,i,n,s,r,a,l,c,d,p,u,_,f,g,m,v,y,b,w;if(this._invalidated&&this.updateImpl(),this._points.length<2)return null;if(t=this._source.points(),i=t[0],n=t[1],s=Math.min(i.index,n.index),r=Math.max(i.index,n.index),a=r-s,l=this._points[0],c=this._points[1],d=Math.abs(l.x-c.x),p=new h,u=this._source.properties(),_=this._model.timeScale(),0===a)return null;for(f=Math.min(l.x,c.x),g=[],m=s;f>-d;m-=a)f=_.indexToCoordinate(m),g.push(f);for(f=Math.max(l.x,c.x),m=r;f<_.width();m+=a)f=_.indexToCoordinate(m),g.push(f);for(v=0;v<g.length;v++)y=new e.Point(g[v],l.y),b={point:y,width:d,height:d,color:u.linecolor.value(),linewidth:u.linewidth.value(),linestyle:u.linestyle.value(),fillBackground:u.fillBackground.value(),backcolor:u.backgroundColor.value(),transparency:u.transparency.value()},w=new o(b),p.append(w);return this.addAnchors(p),p},inherit(s,r),s.prototype.pointsCount=function(){return 2},s.prototype.title=function(){return"Time Cycles"},s.prototype.setPoint=function(t,e,i){var o,n=$.extend({},e),s=this._points[0],r=this._points[1],a=this.priceScale();a.isPercent()&&(o=this.ownerSource().firstValue(),n.price=a.priceRange().convertFromPercent(n.price,o)),s.price=n.price,r.price=n.price,this._points[t]=n,this.normalizePoints()},s.prototype.addPoint=function(t,e,i){var o,n,s=r.prototype.addPoint.call(this,t,e,!0);return s&&(o=this._points[0],n=this._points[1],n.price=o.price,i||(this.normalizePoints(),this.createServerPoints())),s},t.exports=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._data=t}function n(t,e){a.call(this,t,e),this._invalidated=!0}function s(t,e){this._constructor="LineToolSineLine";var i;i=e?e:new c("linetoolsineline"),r.call(this,t,new n(this,t),i)}var r=i(74).LineDataSource,a=i(103),l=i(94),h=i(98),c=i(80).DefaultProperty;o.prototype.draw=function(t){var e,i,o;for(t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(t,this._data.linestyle),t.beginPath(),t.moveTo(this._data.point.x,this._data.point.y),e=1;e<=2*this._data.width;e++)i=e*Math.PI/this._data.width,o=Math.sin(i-Math.PI/2)*this._data.height/2,t.lineTo(this._data.point.x+e,this._data.point.y+o+this._data.height/2);t.stroke()},o.prototype.hitTest=function(t){var e,i,o,n;return t.x<this._data.point.x||t.x>this._data.point.x+2*this._data.width?null:(e=t.x-this._data.point.x,i=e*Math.PI/this._data.width,o=Math.sin(i-Math.PI/2)*this._data.height/2,o=this._data.point.y+o+this._data.height/2,n=3,Math.abs(o-t.y)<=n?new l(l.MOVEPOINT):null)},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){var t,i,n,s,r,a,l,c,d,p,u,_,f,g,m,v,y,b,w,S;if(this._invalidated&&this.updateImpl(),this._points.length<2)return null;if(t=this._source.points(),i=t[0],n=t[1],s=Math.min(i.index,n.index),r=Math.max(i.index,n.index),a=2*(r-s),l=this._points[0],c=this._points[1],d=Math.abs(l.x-c.x),p=c.y-l.y,u=new h,_=this._source.properties(),f=this._model.timeScale(),0===a)return null;for(g=f.indexToCoordinate(s),m=[],v=s;g>-d;v-=a)g=f.indexToCoordinate(v),m.push(g);for(g=g=f.indexToCoordinate(s+a),v=s+a;g<f.width();v+=a)g=f.indexToCoordinate(v),m.push(g);for(y=0;y<m.length;y++)b=new e.Point(m[y],l.y),w={point:b,width:d,height:p,color:_.linecolor.value(),linewidth:_.linewidth.value(),linestyle:_.linestyle.value()},S=new o(w),u.append(S);return this.addAnchors(u),u},inherit(s,r),s.prototype.pointsCount=function(){return 2},s.prototype.title=function(){return"Sine Line"},t.exports=s}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t,e){l.call(this,t,e),this._invalidated=!0}function n(t,e,i){this._source=t,this._index=e,this._bars=i||[]}function s(t,e,i){this._source=t,u.call(this,"linetoolghostfeed",e,i)}function r(t,e,i){var n,l;this._constructor="LineToolGhostFeed",e?(n=e,n._source=this):n=new s(this),i||(l=Math.round(t.mainSeries().data().calculateATR()),n.averageHL.setValue(l)),a.call(this,t,new o(this,t),n),this._segments=[],n.averageHL.listeners().subscribe(this,r.prototype.regenerate),n.variance.listeners().subscribe(this,r.prototype.regenerate),n.points||n.addProperty("points"),this._currentAverageHL=this._properties.averageHL.value(),this._currentVariance=this._properties.variance.value(),this._currentInterval=t.mainSeries().interval()}var a=i(74).LineDataSource,l=i(103),h=i(131).TrendLineRenderer,c=i(94),d=i(95).PaneRendererCandles,p=i(98),u=i(80).DefaultProperty;inherit(o,l),o.prototype.update=function(){l.prototype.update.call(this),this._invalidated=!0},o.prototype.udpateImpl=function(){var t=this;this._segments=[],t._points.length<2||(this._segments=this._source.segments().map(function(i,o){var n,s,r,a,l,h,c,d,p,u,_,f=t._source.points();return o>=t._points.length-1?null:(n=t._points[o].x,s=f[o].price,r=f[o+1].price,a=f[o+1].index-f[o].index,l=t._model.timeScale().barSpacing()*e.sign(a),h=(r-s)/(i.bars().length-1),c=t._source.properties(),d=c.candleStyle.upColor.value(),p=c.candleStyle.downColor.value(),u=c.candleStyle.borderUpColor.value(),_=c.candleStyle.borderDownColor.value(),{bars:i.bars().map(function(e,i){var o=e.c>=e.o;return{time:n+i*l,open:t.priceToCoordinate(e.o+s+i*h),high:t.priceToCoordinate(e.h+s+i*h),low:t.priceToCoordinate(e.l+s+i*h),close:t.priceToCoordinate(e.c+s+i*h),color:o?d:p,borderColor:o?u:_,hollow:!1}})})}).filter(function(t){return!!t}))},o.prototype.renderer=function(){var t,e,i,o,n,s,r,l,u,_,f,g,m;for(this._invalidated&&(this.udpateImpl(),this._invalidated=!1),t=new p,e=1;e<this._points.length;e++)i=this._points[e-1],o=this._points[e],n={points:[i,o],width:this._model.timeScale().width(),height:this._source.priceScale().height(),color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},s=new c(c.MOVEPOINT,null),t.append(new h(n,s));for(r=this._source.properties(),l=r.candleStyle.drawWick.value(),u=r.candleStyle.drawBorder.value(),_=r.candleStyle.borderColor.value(),f=r.candleStyle.wickColor.value(),g=new p,g.setGlobalAlpha(1-r.transparency.value()/100),e=0;e<this._segments.length;e++)m={bars:this._segments[e].bars,barSpacing:this._model.timeScale().barSpacing(),drawWick:l,drawBorder:u,borderColor:_,wickColor:f,hittest:new c(c.MOVEPOINT,null)},g.append(new d(m));return t.append(g),this.addAnchors(t),t},n.prototype.setBars=function(t){this._bars=t||[]},n.prototype.clone=function(t){return new n(t,this._index,TradingView.clone(this._bars))},n.prototype.createBar=function(){var t,e,i,o,n,s,r=this._source.properties().averageHL.value(),a=this._source.properties().variance.value()/100,l=this._source._model.mainSeries().base(),h=Math.random(),c=r*(1-2*h)*a;return h=Math.random(),t=r*(1+(.5-h)*a),e=c-t/2,i=e+t,o=e+Math.random()*t,n=e+Math.random()*t,s={o:o/l,h:i/l,l:e/l,c:n/l}},n.prototype.generate=function(){var t,i,o,n,s,r;if(this._bars=[],t=this._source.points(),i=t[this._index],o=t[this._index+1],i&&o&&i.index!==o.index)for(this._avgHL=this._source.properties().averageHL.value(),this._variance=this._source.properties().variance.value()/100,n=this._index?i.index+1:i.index,s=e.sign(o.index-i.index),r=n;r!==o.index;r+=s)this._bars.push(this.createBar())},n.prototype.bars=function(){return this._bars},n.prototype.setSize=function(t){if(t<this._bars.length)this._bars.splice(t,this._bars.length-t);else for(;this._bars.length<t;)this._bars.push(this.createBar())},inherit(s,u),s.prototype.restoreFactoryDefaults=function(){var t,e;u.prototype.restoreFactoryDefaults.call(this),t=this._source._model,e=Math.round(t.mainSeries().data().calculateATR()),this.averageHL.setValue(e)},inherit(r,a),r.prototype.createPropertiesObject=function(t,e,i){return new s(null,e,i)},r.prototype.regenerate=function(){this._currentAverageHL=this._properties.averageHL.value(),this._currentVariance=this._properties.variance.value(),this._segments.forEach(function(t){t.generate()}),this.updateAllViews(),this._model.updateSource(this)},r.prototype.propertiesChanged=function(){a.prototype.propertiesChanged.call(this),this._currentAverageHL===this._properties.averageHL.value()&&this._currentVariance===this._properties.variance.value()||this.regenerate()},r.prototype.pointsCount=function(){return-1},r.prototype.title=function(){return"Ghost Feed"},r.prototype.segmentBars=function(t){return this._segments[t].bars()},r.prototype.segments=function(){return this._segments},r.prototype.generateBars=function(t){this._segments.length<=t&&this._segments.push(new n(this,t)),this._segments[t].generate()},r.prototype.addPoint=function(t){var e,i,o;if(this._points.length>0&&(e=this._points[this._points.length-1],e.index===t.index)){for(this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),i=0;i<this._points.length;i++)this._createPointProperty(i);return!0}return o=a.prototype.addPoint.call(this,t),this._finished&&(this._lastPoint=null),this._points.length>1&&this.generateBars(this._points.length-2),o||this._finished},r.prototype.finish=function(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()},r.prototype.setPoint=function(t,e,i){var o,n,s;a.prototype.setPoint.call(this,t,e,i),t>0&&(o=this.points()[t-1],n=e.index-o.index,this._segments[t-1].setSize(Math.abs(n))),t<this.points().length-1&&(s=this.points()[t+1],n=s.index-e.index,this._segments[t].setSize(Math.abs(n)))},r.prototype.state=function(t){var e=a.prototype.state.call(this,t);return e.segments=this._segments.map(function(t){return{bars:t.bars()}}),e},r.prototype.restoreData=function(t){var e=this;t.segments&&(this._segments=t.segments.map(function(t,i){return new n(e,i,[].concat(t.bars))})),this._currentAverageHL=this._properties.averageHL.value(),this._currentVariance=this._properties.variance.value()},r.prototype.onData=function(t){if(a.prototype.onData.call(this,t),0===this.properties().points._childs.length)for(var e=0;e<this._points.length;e++)this._createPointProperty(e);this._currentInterval!==this._model.mainSeries().interval()&&(this.regenerate(),this._currentInterval=this._model.mainSeries().interval())},r.prototype.cloneData=function(t){var e=this;this._segments=t._segments.map(function(t){return t.clone(e)})},t.exports=r}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(t,e,i,o){var n,s,r,a,l,h=i.substract(t).length()+i.substract(e).length(),c=3/h,d=5;for(n=0;n<=1;n+=c)if(s=t.scaled((1-n)*(1-n)),r=i.scaled(2*n*(1-n)),a=e.scaled(n*n),l=s.add(r).add(a),l.substract(o).length()<d)return!0;return null}function n(t,e,i,o,n){var s,r,a,l,h,c,d=i.substract(t).length()+o.substract(i).length()+e.substract(o).length(),p=3/d,u=5;for(s=0;s<=1;s+=p)if(r=t.scaled((1-s)*(1-s)*(1-s)),a=i.scaled(3*(1-s)*(1-s)*s),l=o.scaled(3*(1-s)*s*s),h=e.scaled(s*s*s),c=r.add(a).add(l).add(h),c.substract(n).length()<u)return!0}function s(t,e,i,o,n){var s,r,a,l,h,c,d,p,u,_,f=i.substract(t).length()+i.substract(e).length();if(!f)return[];for(s=3/f,r=500,a=[],l=1;l<=r*s;l+=s)h=t.scaled((1-l)*(1-l)),c=i.scaled(2*l*(1-l)),d=e.scaled(l*l),p=h.add(c).add(d),a.length>0&&(u=a[a.length-1],_=u.substract(p).length(),_<2&&(s*=2)),a.push(p);return a}function r(t){this._data=t}function a(t,e){u.call(this,t,e),this._invalidated=!0}function l(t,e){this._constructor="LineToolBezierQuadro";
var i;i=e?e:new m("linetoolbezierquadro"),p.call(this,t,new a(this,t),i)}function h(t){this._data=t}function c(t,e){u.call(this,t,e),this._invalidated=!0}function d(t,e){this._constructor="LineToolBezierCubic";var i;i=e?e:new m("linetoolbeziercubic"),p.call(this,t,new c(this,t),i)}var p=i(74).LineDataSource,u=i(103),_=i(131).TrendLineRenderer,f=i(94),g=i(98),m=i(80).DefaultProperty;r.prototype.draw=function(t){var e,i,o,n,s,r,a,l=this._data.points[0],h=this._data.points[1];if(t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(t,this._data.linestyle),2===this._data.points.length)t.beginPath(),t.moveTo(l.x,l.y),t.lineTo(h.x,h.y),t.stroke();else{if(e=this._data.points[2],i=h.substract(l),o=e.substract(i.scaled(.25)),n=e.add(i.scaled(.25)),this._data.fillBack&&this._data.points.length>2&&(t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),t.beginPath(),t.moveTo(l.x,l.y),t.quadraticCurveTo(o.x,o.y,e.x,e.y),t.quadraticCurveTo(n.x,n.y,h.x,h.y),t.fill()),t.beginPath(),t.moveTo(l.x,l.y),this._data.extendLeftPoints.length>0)for(s=this._data.extendLeftPoints[this._data.extendLeftPoints.length-1],t.moveTo(s.x,s.y),r=this._data.extendLeftPoints.length-2;r>=0;r--)a=this._data.extendLeftPoints[r],t.lineTo(a.x,a.y);for(t.quadraticCurveTo(o.x,o.y,e.x,e.y),t.quadraticCurveTo(n.x,n.y,h.x,h.y),r=0;r<this._data.extendRightPoints.length;r++)a=this._data.extendRightPoints[r],t.lineTo(a.x,a.y);t.stroke(),this._data.leftend===p.LINEEND_ARROW&&_.prototype.drawArrow(o,l,t,t.lineWidth),this._data.rightend===p.LINEEND_ARROW&&_.prototype.drawArrow(n,h,t,t.lineWidth)}},r.prototype.hitTest=function(e){var i,n,s,r,a,l,h,c,d,p;if(3===this._data.points.length){if(i=this._data.points[0],n=this._data.points[1],s=this._data.points[2],r=n.substract(i),a=s.substract(r.scaled(.25)),l=s.add(r.scaled(.25)),h=o(s,i,a,e)||o(s,n,l,e))return new f(f.MOVEPOINT);for(c=3,d=1;d<this._data.extendLeftPoints.length;d++)if(i=this._data.extendLeftPoints[d-1],n=this._data.extendLeftPoints[d],p=t.distanceToSegment(i,n,e).distance,p<c)return new f(f.MOVEPOINT);for(d=1;d<this._data.extendRightPoints.length;d++)if(i=this._data.extendRightPoints[d-1],n=this._data.extendRightPoints[d],p=t.distanceToSegment(i,n,e).distance,p<c)return new f(f.MOVEPOINT)}return null},inherit(a,u),a.prototype.update=function(){u.prototype.update.call(this),this._invalidated=!0},a.prototype.updateImpl=function(){var t,e,i,o,n,r,a,l;this._extendLeftPoints=[],this._extendRightPoints=[],this._source.points().length<3||(t=this._source.pointToScreenPoint(this._source.points()[0])[1],e=this._source.pointToScreenPoint(this._source.points()[1])[1],i=this._source.pointToScreenPoint(this._source.points()[2])[1],o=e.substract(t),n=i.substract(o.scaled(.25)),r=i.add(o.scaled(.25)),a=this._model.timeScale().width(),l=this._source.priceScale().height(),this._source.properties().extendLeft.value()&&(this._extendLeftPoints=s(i,t,n,a,l)),this._source.properties().extendRight.value()&&(this._extendRightPoints=s(i,e,r,a,l)))},a.prototype.renderer=function(){var t,e,i,o;return this._points.length<2?new g:(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=[].concat(this._points),this._source._controlPoint&&t.push(this._source.pointToScreenPoint(this._source._controlPoint)[0]),e={},i=this._source.properties(),e.points=t,e.color=i.linecolor.value(),e.linewidth=i.linewidth.value(),e.linestyle=i.linestyle.value(),e.leftend=i.leftEnd.value(),e.rightend=i.rightEnd.value(),e.fillBack=i.fillBackground.value(),e.backcolor=i.backgroundColor.value(),e.transparency=i.transparency.value(),e.extendLeftPoints=this._extendLeftPoints,e.extendRightPoints=this._extendRightPoints,o=new g,o.append(new r(e)),this.addAnchors(o),o)},inherit(l,p),l.prototype.pointsCount=function(){return 2},l.prototype.title=function(){return"Curve"},l.prototype.controlPoint=function(){var t=this.pointToScreenPoint(this.points()[0])[0],e=this.pointToScreenPoint(this.points()[1])[0],i=e.substract(t).scaled(.5),o=i.transponed().scaled(.3),n=t.add(e).scaled(.5),s=n.add(o),r=this.screenPointToPoint(s);return r},l.prototype.setLastPoint=function(t,e){p.prototype.setLastPoint.call(this,t,e),this._controlPoint=this.controlPoint()},l.prototype.addPoint=function(t,e,i){var o,n=p.prototype.addPoint.call(this,t,e,!0);return n&&(o=this.controlPoint(),this._points.push(o),delete this._controlPoint,i||(this.normalizePoints(),this.createServerPoints()),this._createPointProperty(2)),n},l.prototype.restorePoints=function(t,e,i){p.prototype.restorePoints.call(this,t,e,i),this._createPointProperty(2)},h.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d,u,f;if(t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(t,this._data.linestyle),e=this._data.points[0],i=this._data.points[1],2===this._data.points.length)t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(i.x,i.y),t.stroke(),this._data.leftend===p.LINEEND_ARROW&&_.prototype.drawArrow(i,e,t,t.lineWidth),this._data.rightend===p.LINEEND_ARROW&&_.prototype.drawArrow(e,i,t,t.lineWidth);else{if(o=this._data.points[2],n=this._data.points[3],s=n.substract(e),r=o.substract(s.scaled(.25)),a=o.add(s.scaled(.25)),l=i.substract(o),h=n.substract(l.scaled(.25)),c=n.add(l.scaled(.25)),this._data.fillBack&&this._data.points.length>2&&(t.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),t.beginPath(),t.moveTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,o.x,o.y),t.bezierCurveTo(a.x,a.y,h.x,h.y,n.x,n.y),t.quadraticCurveTo(c.x,c.y,i.x,i.y),t.fill()),t.beginPath(),this._data.extendLeftPoints.length>0)for(d=this._data.extendLeftPoints[this._data.extendLeftPoints.length-1],t.moveTo(d.x,d.y),u=this._data.extendLeftPoints.length-2;u>=0;u--)f=this._data.extendLeftPoints[u],t.lineTo(f.x,f.y);for(t.moveTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,o.x,o.y),t.bezierCurveTo(a.x,a.y,h.x,h.y,n.x,n.y),t.quadraticCurveTo(c.x,c.y,i.x,i.y),u=0;u<this._data.extendRightPoints.length;u++)f=this._data.extendRightPoints[u],t.lineTo(f.x,f.y);t.stroke(),this._data.leftend===p.LINEEND_ARROW&&_.prototype.drawArrow(r,e,t,t.lineWidth),this._data.rightend===p.LINEEND_ARROW&&_.prototype.drawArrow(c,i,t,t.lineWidth)}},h.prototype.hitTest=function(e){var i,s,r,a,l,h,c,d,p,u,_,g,m,v;if(4===this._data.points.length){if(i=this._data.points[0],s=this._data.points[1],r=this._data.points[2],a=this._data.points[3],l=a.substract(i),h=r.substract(l.scaled(.25)),c=r.add(l.scaled(.25)),d=s.substract(r),p=a.substract(d.scaled(.25)),u=a.add(d.scaled(.25)),_=o(r,i,h,e)||n(r,a,c,p,e)||o(a,s,u,e))return new f(f.MOVEPOINT);for(g=3,m=1;m<this._data.extendLeftPoints.length;m++)if(i=this._data.extendLeftPoints[m-1],s=this._data.extendLeftPoints[m],v=t.distanceToSegment(i,s,e).distance,v<g)return new f(f.MOVEPOINT);for(m=1;m<this._data.extendRightPoints.length;m++)if(i=this._data.extendRightPoints[m-1],s=this._data.extendRightPoints[m],v=t.distanceToSegment(i,s,e).distance,v<g)return new f(f.MOVEPOINT)}return null},inherit(c,u),c.prototype.update=function(){u.prototype.update.call(this),this._invalidated=!0},c.prototype.updateImpl=function(){var t,e,i,o,n,r,a,l,h,c;this._extendLeftPoints=[],this._extendRightPoints=[],this._source.points().length<4||(t=this._source.pointToScreenPoint(this._source.points()[0])[1],e=this._source.pointToScreenPoint(this._source.points()[1])[1],i=this._source.pointToScreenPoint(this._source.points()[2])[1],o=this._source.pointToScreenPoint(this._source.points()[3])[1],n=o.substract(t),r=i.substract(n.scaled(.25)),a=e.substract(i),l=o.add(a.scaled(.25)),h=this._model.timeScale().width(),c=this._source.priceScale().height(),this._source.properties().extendLeft.value()&&(this._extendLeftPoints=s(i,t,r,h,c)),this._source.properties().extendRight.value()&&(this._extendRightPoints=s(o,e,l,h,c)))},c.prototype.renderer=function(){var t,e,i,o;return this._points.length<2?new g:(this._invalidated&&(this.updateImpl(),this._invalidated=!1),t=[].concat(this._points),this._source._controlPoints&&(t.push(this._source.pointToScreenPoint(this._source._controlPoints[0])[0]),t.push(this._source.pointToScreenPoint(this._source._controlPoints[1])[0])),e={},i=this._source.properties(),e.points=t,e.color=i.linecolor.value(),e.linewidth=i.linewidth.value(),e.linestyle=i.linestyle.value(),e.leftend=i.leftEnd.value(),e.rightend=i.rightEnd.value(),e.fillBack=i.fillBackground.value(),e.backcolor=i.backgroundColor.value(),e.transparency=i.transparency.value(),e.extendLeftPoints=this._extendLeftPoints,e.extendRightPoints=this._extendRightPoints,o=new g,o.append(new h(e)),this.addAnchors(o),o)},inherit(d,p),d.prototype.pointsCount=function(){return 2},d.prototype.title=function(){return"Double Curve"},d.prototype.controlPoints=function(){var t=this.pointToScreenPoint(this.points()[0])[0],e=this.pointToScreenPoint(this.points()[1])[0],i=e.substract(t).scaled(.5),o=i.transponed().scaled(.3),n=t.add(e).scaled(.33),s=t.add(e).scaled(.67),r=n.add(o),a=s.substract(o);return[this.screenPointToPoint(r),this.screenPointToPoint(a)]},d.prototype.setLastPoint=function(t,e){p.prototype.setLastPoint.call(this,t,e),this._controlPoints=this.controlPoints()},d.prototype.addPoint=function(t,e,i){var o,n=p.prototype.addPoint.call(this,t,e,!0);return n&&(o=this.controlPoints(),delete this._controlPoints,this._points.push(o[0]),this._points.push(o[1]),i||(this.normalizePoints(),this.createServerPoints()),this._createPointProperty(2),this._createPointProperty(3)),n},d.prototype.restorePoints=function(t,e,i){p.prototype.restorePoints.call(this,t,e,i),this._createPointProperty(2),this._createPointProperty(3)},e.LineToolBezierQuadro=l,e.LineToolBezierCubic=d}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e){this._constructor="LineToolArrow";var i=e||new s("linetoolarrow");n.call(this,t,i)}var n=i(131).LineToolTrendLine,s=i(80).DefaultProperty;inherit(o,n),o.prototype.title=function(){return"Arrow"},t.exports=o},function(t,e,i){"use strict";function o(t,e){this._constructor="LineToolRay";var i=e||new s("linetoolray");n.call(this,t,i)}var n=i(131).LineToolTrendLine,s=i(80).DefaultProperty;inherit(o,n),o.prototype.title=function(){return"Ray"},t.exports=o},function(t,e,i){"use strict";function o(t,e){this._constructor="LineToolExtended";var i=e||new s("linetoolextended");n.call(this,t,i)}var n=i(131).LineToolTrendLine,s=i(80).DefaultProperty;inherit(o,n),o.prototype.title=function(){return"Extended Line"},t.exports=o},function(t,e,i){"use strict";function o(t,e){var i=e||this.createPropertiesObject("linetoolschiffpitchfork");s.call(this,t,i),this._constructor="LineToolSchiffPitchfork"}var n=i(127),s=i(172).LineToolPitchfork;inherit(o,s),o.prototype.title=function(){return $.t("Modified Schiff Pitchfork")},o.prototype.createPropertiesObject=function(t,e,i){return new n(t,e,i,{range:[0,8]})},t.exports=o},function(t,e,i){"use strict";function o(t,e){var i=e||this.createPropertiesObject("linetoolschiffpitchfork2");s.call(this,t,i),this._constructor="LineToolSchiffPitchfork2"}var n=i(127),s=i(172).LineToolPitchfork;inherit(o,s),o.prototype.title=function(){return $.t("Schiff Pitchfork")},o.prototype.createPropertiesObject=function(t,e,i){return new n(t,e,i,{range:[0,8]})},t.exports=o},function(t,e,i){"use strict";function o(t,e){var i=e||this.createPropertiesObject("linetoolinsidepitchfork");s.call(this,t,i),this._constructor="LineToolInsidePitchfork"}var n=i(127),s=i(172).LineToolPitchfork;inherit(o,s),o.prototype.title=function(){return $.t("Inside Pitchfork")},o.prototype.createPropertiesObject=function(t,e,i){return new n(t,e,i,{range:[0,8]})},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,i){this._constructor="LineToolFlagMark";var o=i||new r("linetoolflagmark");n.call(this,t,new s(this,t,this.image,25,25,-8,-21),o),this._paneViews[0].setAnchors(new e.Point(0,0))}var n=i(74).LineDataSource,s=i(170),r=i(80).DefaultProperty;inherit(o,n),o.prototype.image=new Image,o.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAsElEQVR4AWMYWcDExOS/YUd4hWF7+H90bNAePpO2liDwJTxyi2htyVXLvlBOWlry2bAtVIumwWXQERFF4zgJ20iPiP8JDCpLeqSuJ6ZdoRJ0SMIRx7QbQtmItgSXnGFbRCzMEnIzK8ISWgL6WzJqibGxsYaFhYUC7SxBWMQPNMjazMxMjebBZWhoKAq00NHc3FyL5nFiaWkpDTTYz8jISI/mEW9qaqoExGFgS+gFRgEAaE0hWxrw50oAAAAASUVORK5CYII=",o.prototype.pointsCount=function(){return 1},o.prototype.title=function(){return"Flag Mark"},o.prototype.version=2,o.prototype.migrateVersion=function(t){1===t&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new e.Point(9,21)))},t.exports=o}).call(e,i(21))},function(t,e,i){(function(e){"use strict";function o(t){this._line=t,this._data={bodyText:"position",quantityText:"0"}}function n(t,e){c.call(this,t,e)}function s(t,e){h.call(this,t,e),this._rendererCache={}}function r(t,e){this._adapter=new o(this),this._constructor="LineToolPosition";var i=e||new _("linetoolposition");a.call(this,t,new s(this,t),i)}var a=i(143),l=i(74).LineDataSource,h=i(103),c=i(74).LineToolPriceAxisView,d=i(122),p=i(94),u=i(55).Rect,_=i(80).DefaultProperty;o.prototype.getPrice=function(){return this._line.points()[0].price},o.prototype.setPrice=function(t){var e=this._line.points()[0];return e.price=t,this._line._points[0]=e,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw(),this},o.prototype.getText=function(){return this._data.bodyText},o.prototype.setText=function(t){return this._data.bodyText=t||"",this._line.updateAllViewsAndRedraw(),this},o.prototype.setTooltip=function(t){return null==t?t="":t+="",this._line.properties().tooltip.setValue(t),this},o.prototype.getTooltip=function(){return this._line.properties().tooltip.value()},o.prototype.getQuantity=function(){return this._data.quantityText},o.prototype.setQuantity=function(t){return this._data.quantityText=t||"",this._line.updateAllViewsAndRedraw(),this},o.prototype.getExtendLeft=function(){var t=this._line.properties().extendLeft.value();return"inherit"===t?this._line._model.properties().tradingProperties.extendLeft.value():t},o.prototype.setExtendLeft=function(t){return this._line.properties().extendLeft.setValue(t),this},o.prototype.getLineLength=function(){var t=this._line.properties().lineLength.value();return"inherit"===t?this._line._model.properties().tradingProperties.lineLength.value():t},o.prototype.setLineLength=function(t){return this._line.properties().lineLength.setValue(Math.max(0,Math.min(t,100))),this},o.prototype.getLineColor=function(){return d.getColorFromProperties(this._line.properties().lineColor,this._line.properties().lineTransparency)},o.prototype.setLineColor=function(t){return d.setColorToProperties(t,this._line.properties().lineColor,this._line.properties().lineTransparency),this},o.prototype.getLineStyle=function(){var t=this._line.properties().lineStyle.value();return"inherit"===t?this._line._model.properties().tradingProperties.lineStyle.value():t},o.prototype.setLineStyle=function(t){return this._line.properties().lineStyle.setValue(t),this},o.prototype.getLineWidth=function(){var t=this._line.properties().lineWidth.value();return"inherit"===t?this._line._model.properties().tradingProperties.lineWidth.value():t},o.prototype.setLineWidth=function(t){return this._line.properties().lineWidth.setValue(t),this},o.prototype.getBodyBorderColor=function(){return d.getColorFromProperties(this._line.properties().bodyBorderColor,this._line.properties().bodyBorderTransparency)},o.prototype.setBodyBorderColor=function(t){return d.setColorToProperties(t,this._line.properties().bodyBorderColor,this._line.properties().bodyBorderTransparency),this},o.prototype.getBodyBackgroundColor=function(){return d.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)},o.prototype.setBodyBackgroundColor=function(t){return d.setColorToProperties(t,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this},o.prototype.getBodyTextColor=function(){return d.getColorFromProperties(this._line.properties().bodyTextColor,this._line.properties().bodyTextTransparency)},o.prototype.setBodyTextColor=function(t){return d.setColorToProperties(t,this._line.properties().bodyTextColor,this._line.properties().bodyTextTransparency),this},o.prototype.getBodyFont=function(){return d.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)},o.prototype.setBodyFont=function(t){return d.setFontToProperties(t,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this},o.prototype.getQuantityBorderColor=function(){return d.getColorFromProperties(this._line.properties().quantityBorderColor,this._line.properties().quantityBorderTransparency)},o.prototype.setQuantityBorderColor=function(t){return d.setColorToProperties(t,this._line.properties().quantityBorderColor,this._line.properties().quantityBorderTransparency),this},o.prototype.getQuantityBackgroundColor=function(){return d.getColorFromProperties(this._line.properties().quantityBackgroundColor,this._line.properties().quantityBackgroundTransparency)},o.prototype.setQuantityBackgroundColor=function(t){return d.setColorToProperties(t,this._line.properties().quantityBackgroundColor,this._line.properties().quantityBackgroundTransparency),this},o.prototype.getQuantityTextColor=function(){return d.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)},o.prototype.setQuantityTextColor=function(t){return d.setColorToProperties(t,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this},o.prototype.getQuantityFont=function(){return d.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)},o.prototype.setQuantityFont=function(t){return d.setFontToProperties(t,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this},o.prototype.getReverseButtonBorderColor=function(){return d.getColorFromProperties(this._line.properties().reverseButtonBorderColor,this._line.properties().reverseButtonBorderTransparency)},o.prototype.setReverseButtonBorderColor=function(t){return d.setColorToProperties(t,this._line.properties().reverseButtonBorderColor,this._line.properties().reverseButtonBorderTransparency),this},o.prototype.getReverseButtonBackgroundColor=function(){return d.getColorFromProperties(this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency)},o.prototype.setReverseButtonBackgroundColor=function(t){return d.setColorToProperties(t,this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency),this},o.prototype.getReverseButtonIconColor=function(){return d.getColorFromProperties(this._line.properties().reverseButtonIconColor,this._line.properties().reverseButtonIconTransparency)},o.prototype.setReverseButtonIconColor=function(t){return d.setColorToProperties(t,this._line.properties().reverseButtonIconColor,this._line.properties().reverseButtonIconTransparency),this},o.prototype.getCloseButtonBorderColor=function(){return d.getColorFromProperties(this._line.properties().closeButtonBorderColor,this._line.properties().closeButtonBorderTransparency)},o.prototype.setCloseButtonBorderColor=function(t){return d.setColorToProperties(t,this._line.properties().closeButtonBorderColor,this._line.properties().closeButtonBorderTransparency),this},o.prototype.getCloseButtonBackgroundColor=function(){return d.getColorFromProperties(this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency)},o.prototype.setCloseButtonBackgroundColor=function(t){return d.setColorToProperties(t,this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency),this},o.prototype.getCloseButtonIconColor=function(){return d.getColorFromProperties(this._line.properties().closeButtonIconColor,this._line.properties().closeButtonIconTransparency)},o.prototype.setCloseButtonIconColor=function(t){return d.setColorToProperties(t,this._line.properties().closeButtonIconColor,this._line.properties().closeButtonIconTransparency),this},o.prototype.block=function(){this._blocked=!0,this._line.updateAllViewsAndRedraw()},o.prototype.unblock=function(){this._blocked=!1,this._line.updateAllViewsAndRedraw()},o.prototype.isFunction=function(t){return"function"==typeof t},o.prototype.onReverse=function(t,e){return e?this.isFunction(e)&&(this._onReverseData=t,this._onReverseCallback=e):this.isFunction(t)&&(this._onReverseCallback=t),this},o.prototype.callOnReverse=function(){this.isFunction(this._onReverseCallback)&&this._onReverseCallback.call(this,this._onReverseData)},o.prototype.isOnReverseCallbackPresent=function(){return this.isFunction(this._onReverseCallback)},o.prototype.onClose=function(t,e){return e?this.isFunction(e)&&(this._onCloseData=t,this._onCloseCallback=e):this.isFunction(t)&&(this._onCloseCallback=t),this},o.prototype.callOnClose=function(){this.isFunction(this._onCloseCallback)&&this._onCloseCallback.call(this,this._onCloseData)},o.prototype.isOnCloseCallbackPresent=function(){return this.isFunction(this._onCloseCallback)},o.prototype.onModify=function(t,e){return e?this.isFunction(e)&&(this._onModifyData=t,this._onModifyCallback=e):this.isFunction(t)&&(this._onModifyCallback=t),this},o.prototype.callOnModify=function(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)},o.prototype.onContextMenu=function(t,e){return e?this.isFunction(e)&&(this._onContextMenuData=t,this._onContextMenuCallback=e):this.isFunction(t)&&(this._onContextMenuCallback=t),this},o.prototype.callOnContextMenu=function(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)},o.prototype.remove=function(){this._line._model.removeSource(this._line),delete this._line},TradingView.PositionRenderer=function(t,e,i){this._data=t,this._cache=e,this._adapter=i},TradingView.PositionRenderer.prototype._height=function(){var t=1;return Math.max(20,t+Math.max(d.fontHeight(this._adapter.getBodyFont()),d.fontHeight(this._adapter.getQuantityFont())))},TradingView.PositionRenderer.prototype._bodyWidth=function(t){var e,i;return 0===this._adapter.getText().length?0:(t.save(),t.font=this._adapter.getBodyFont(),e=10,i=t.measureText(this._adapter.getText()).width,t.restore(),Math.round(e+i))},TradingView.PositionRenderer.prototype._quantityWidth=function(t){var e,i;return 0===this._adapter.getQuantity().length?0:(t.save(),t.font=this._adapter.getQuantityFont(),e=10,i=t.measureText(this._adapter.getQuantity()).width,t.restore(),Math.round(Math.max(this._height(),e+i)))},TradingView.PositionRenderer.prototype._reverseButtonWidth=function(){return this._adapter.isOnReverseCallbackPresent()?this._height():0},TradingView.PositionRenderer.prototype._closeButtonWidth=function(){return this._adapter.isOnCloseCallbackPresent()?this._height():0},TradingView.PositionRenderer.prototype._drawLines=function(t,e,i,o,n){t.save(),t.strokeStyle=this._adapter.getLineColor(),t.lineStyle=this._adapter.getLineStyle(),t.lineWidth=this._adapter.getLineWidth(),CanvasEx.drawLine(t,i,o,n,o),this._adapter.getExtendLeft()&&CanvasEx.drawLine(t,0,o,e,o),t.restore()},TradingView.PositionRenderer.prototype._drawBody=function(t,e,i){var o,n;t.strokeStyle=this._adapter.getBodyBorderColor(),t.fillStyle=this._adapter.getBodyBackgroundColor(),o=this._bodyWidth(t),n=this._height(),t.fillRect(e+.5,i+.5,o-1,n-1),t.strokeRect(e,i,o,n)},TradingView.PositionRenderer.prototype._drawBodyText=function(t,e,i){var o,n;t.save(),t.textAlign="center",t.textBaseline="middle",t.font=this._adapter.getBodyFont(),t.fillStyle=this._adapter.getBodyTextColor(),o=e+this._bodyWidth(t)/2,n=i+this._height()/2,t.fillText(this._adapter.getText(),o,n),t.restore()},TradingView.PositionRenderer.prototype._drawQuantity=function(t,e,i){var o,n;t.strokeStyle=this._adapter.getQuantityBorderColor(),t.fillStyle=this._adapter.getQuantityBackgroundColor(),o=this._quantityWidth(t),n=this._height(),t.fillRect(e+.5,i+.5,o-1,n-1),t.strokeRect(e,i,o,n)},TradingView.PositionRenderer.prototype._drawQuantityText=function(t,e,i){var o,n;t.save(),t.textAlign="center",t.textBaseline="middle",t.font=this._adapter.getQuantityFont(),t.fillStyle=this._adapter.getQuantityTextColor(),o=e+this._quantityWidth(t)/2,n=i+this._height()/2,t.fillText(this._adapter.getQuantity(),o,n),t.restore()},TradingView.PositionRenderer.prototype._drawReverseButton=function(t,e,i){var o,n,s,r,a,l,h;t.save(),t.strokeStyle=this._adapter.getReverseButtonBorderColor(),t.fillStyle=this._adapter.getReverseButtonBackgroundColor(),o=this._reverseButtonWidth(),n=this._height(),t.fillRect(e+.5,i+.5,o-1,n-1),t.strokeRect(e,i,o,n),t.strokeStyle=this._adapter.getReverseButtonIconColor(),s=function(t,e){CanvasEx.drawLine(t,0,0,0,e),CanvasEx.drawLine(t,-1,1,1,1),CanvasEx.drawLine(t,-2,2,2,2)},r=6,a=10,l=e+Math.round((this._reverseButtonWidth()-r)/2),h=i+5,t.save(),t.translate(l,h),s(t,a),t.translate(r,a),t.rotate(Math.PI),s(t,a),t.restore(),this._adapter._blocked&&(t.fillStyle="rgba(140, 140, 140, 0.75)",t.fillRect(e+.5,i+.5,o-1,n-1)),t.restore()},TradingView.PositionRenderer.prototype._drawCloseButton=function(t,e,i){var o,n,s,r,a,l,h;t.save(),t.strokeStyle=this._adapter.getCloseButtonBorderColor(),t.fillStyle=this._adapter.getCloseButtonBackgroundColor(),o=this._closeButtonWidth(),n=this._height(),t.fillRect(e+.5,i+.5,o-1,n-1),t.strokeRect(e,i,o,n),s=e+o,r=i+n,t.strokeStyle=this._adapter.getCloseButtonIconColor(),a=8,l=(this._closeButtonWidth()-a)/2,h=(this._height()-a)/2,CanvasEx.drawPoly(t,[{x:e+l,y:i+h},{x:s-l,y:r-h}],!0),CanvasEx.drawPoly(t,[{x:s-l,y:i+h},{x:e+l,y:r-h}],!0),this._adapter._blocked&&(t.fillStyle="rgba(140, 140, 140, 0.75)",t.fillRect(e+.5,i+.5,o-1,n-1)),t.restore()},TradingView.PositionRenderer.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d;!this._data.points||this._data.points.length<1||(e=this._data.width,i=this._bodyWidth(t),o=this._quantityWidth(t),n=this._reverseButtonWidth(t),s=i+o+n+this._closeButtonWidth(),r=e-s,a=Math.max(this._adapter.getLineLength()/100*e,1),l=Math.round(e-Math.min(r,a)),h=l-s,c=Math.round(this._data.points[0].y),d=Math.round(c-(this._height()+1)/2),this._cache.bodyRight=h+i,this._cache.quantityRight=this._cache.bodyRight+o,this._cache.reverseButtonRight=this._cache.quantityRight+n,this._cache.top=d,this._cache.bottom=d+this._height(),this._cache.left=h,this._cache.right=l,this._drawLines(t,h,l,c,e),0!==i&&(this._drawBody(t,h,d),this._drawBodyText(t,h,d)),0!==o&&(this._drawQuantity(t,this._cache.bodyRight,d),this._drawQuantityText(t,this._cache.bodyRight,d)),0!==n&&this._drawReverseButton(t,this._cache.quantityRight,d),0!==this._closeButtonWidth()&&this._drawCloseButton(t,this._cache.reverseButtonRight,d))},TradingView.PositionRenderer.prototype.hitTest=function(t){return 0===this._data.points.length?null:t.y<this._cache.top||t.y>this._cache.bottom||t.x<this._cache.left||this._cache.right<t.x?null:this._adapter._blocked?new p(p.CUSTOM,{}):t.x>=this._cache.bodyRight&&t.x<this._cache.quantityRight&&this._adapter._onModifyCallback?new p(p.CUSTOM,{mouseDownHandler:this._adapter.callOnModify.bind(this._adapter),tooltip:{text:$.t("Edit Position"),rect:new u(this._cache.bodyRight,this._cache.top,this._cache.quantityRight-this._cache.bodyRight,this._cache.bottom-this._cache.top)}}):t.x>=this._cache.quantityRight&&t.x<this._cache.reverseButtonRight?new p(p.CUSTOM,{mouseDownHandler:this._adapter.callOnReverse.bind(this._adapter),tooltip:{text:$.t("Reverse Position"),rect:new u(this._cache.quantityRight,this._cache.top,this._cache.reverseButtonRight-this._cache.quantityRight,this._cache.bottom-this._cache.top)}}):t.x>=this._cache.reverseButtonRight&&t.x<this._cache.right?new p(p.CUSTOM,{mouseDownHandler:this._adapter.callOnClose.bind(this._adapter),tooltip:{text:$.t("Close Position"),rect:new u(this._cache.reverseButtonRight,this._cache.top,this._cache.right-this._cache.reverseButtonRight,this._cache.bottom-this._cache.top)}}):new p(p.REGULAR,{mouseDownHandler:function(){}})},inherit(n,c),n.prototype._updateImpl=function(){c.prototype._updateImpl.call(this),this._background=this._linetool.properties().lineColor.value()},inherit(s,h),s.prototype.renderer=function(){var t={points:this._points,width:this._model.timeScale().width()};return new TradingView.PositionRenderer(t,this._rendererCache,this._source._adapter)},inherit(r,a),r.prototype.setPoint=function(t,e,i){this._points[t]=e,this.normalizePoints()},r.prototype.addPoint=function(t,e){return this._points.push(t),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0},r.skipMagnetting=!0,r.prototype.title=function(){return"Position"},r.prototype.createPriceAxisView=function(t){return this._priceAxisView=new n(this,t),this._priceAxisView},r.prototype.paneViews=function(t){return TradingView.printing&&!e.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?l.prototype.paneViews.call(this,t):null},r.prototype.priceAxisViews=function(t,i){return TradingView.printing&&!e.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?l.prototype.priceAxisViews.call(this,t,i):null},r.prototype.hasContextMenu=function(){return!0},r.prototype.contextMenuItems=function(){return this._adapter.callOnContextMenu()},t.exports=r}).call(e,i(1))},function(t,e,i){(function(e){"use strict";function o(t){this._line=t,this._data={bodyText:"order",quantityText:"0"},this._editable=!0}function n(t,e,i){this._data=t,this._cache=e,this._adapter=i}function s(t,e){h.call(this,t,e)}function r(t,e){p.call(this,t,e),this._rendererCache={}}function a(t,e){this._adapter=new o(this),this._constructor="LineToolOrder";var i=e||new f("linetoolorder");l.call(this,t,new r(this,t),i)}var l=i(143),h=i(74).LineToolPriceAxisView,c=i(122),d=i(74).LineDataSource,p=i(103),u=i(94),_=i(55).Rect,f=i(80).DefaultProperty;o.prototype.setEditable=function(t){return this._editable=t,this},o.prototype.getPrice=function(){return this._line.points()[0].price},o.prototype.setPrice=function(t){var e=this._line.points()[0];return e.price=t,this._line._points[0]=e,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw(),this},o.prototype.getText=function(){return this._data.bodyText},o.prototype.setText=function(t){return this._data.bodyText=t||"",this._line.updateAllViewsAndRedraw(),this},o.prototype.setTooltip=function(t){return null==t?t="":t+="",this._line.properties().tooltip.setValue(t),this},o.prototype.getTooltip=function(){return this._line.properties().tooltip.value()},o.prototype.getQuantity=function(){return this._data.quantityText},o.prototype.setQuantity=function(t){return this._data.quantityText=t||"",this._line.updateAllViewsAndRedraw(),this},o.prototype.getExtendLeft=function(){var t=this._line.properties().extendLeft.value();return"inherit"===t?this._line._model.properties().tradingProperties.extendLeft.value():t},o.prototype.setExtendLeft=function(t){return this._line.properties().extendLeft.setValue(t),this},o.prototype.getLineLength=function(){var t=this._line.properties().lineLength.value();return"inherit"===t?this._line._model.properties().tradingProperties.lineLength.value():t},o.prototype.setLineLength=function(t){return this._line.properties().lineLength.setValue(Math.max(0,Math.min(t,100))),this},o.prototype.getLineColor=function(){return c.getColorFromProperties(this._line.properties().lineColor,this._line.properties().lineTransparency);
},o.prototype.setLineColor=function(t){return c.setColorToProperties(t,this._line.properties().lineColor,this._line.properties().lineTransparency),this},o.prototype.getLineStyle=function(){var t=this._line.properties().lineStyle.value();return"inherit"===t?this._line._model.properties().tradingProperties.lineStyle.value():t},o.prototype.setLineStyle=function(t){return this._line.properties().lineStyle.setValue(t),this},o.prototype.getLineWidth=function(){var t=this._line.properties().lineWidth.value();return"inherit"===t?this._line._model.properties().tradingProperties.lineWidth.value():t},o.prototype.setLineWidth=function(t){return this._line.properties().lineWidth.setValue(t),this},o.prototype.getBodyBorderColor=function(){return c.getColorFromProperties(this._line.properties().bodyBorderColor,this._line.properties().bodyBorderTransparency)},o.prototype.setBodyBorderColor=function(t){return c.setColorToProperties(t,this._line.properties().bodyBorderColor,this._line.properties().bodyBorderTransparency),this},o.prototype.getBodyBackgroundColor=function(){return c.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)},o.prototype.setBodyBackgroundColor=function(t){return c.setColorToProperties(t,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this},o.prototype.getBodyTextColor=function(){return c.getColorFromProperties(this._line.properties().bodyTextColor,this._line.properties().bodyTextTransparency)},o.prototype.setBodyTextColor=function(t){return c.setColorToProperties(t,this._line.properties().bodyTextColor,this._line.properties().bodyTextTransparency),this},o.prototype.getBodyFont=function(){return c.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)},o.prototype.setBodyFont=function(t){return c.setFontToProperties(t,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this},o.prototype.getQuantityBorderColor=function(){return c.getColorFromProperties(this._line.properties().quantityBorderColor,this._line.properties().quantityBorderTransparency)},o.prototype.setQuantityBorderColor=function(t){return c.setColorToProperties(t,this._line.properties().quantityBorderColor,this._line.properties().quantityBorderTransparency),this},o.prototype.getQuantityBackgroundColor=function(){return c.getColorFromProperties(this._line.properties().quantityBackgroundColor,this._line.properties().quantityBackgroundTransparency)},o.prototype.setQuantityBackgroundColor=function(t){return c.setColorToProperties(t,this._line.properties().quantityBackgroundColor,this._line.properties().quantityBackgroundTransparency),this},o.prototype.getQuantityTextColor=function(){return c.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)},o.prototype.setQuantityTextColor=function(t){return c.setColorToProperties(t,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this},o.prototype.getQuantityFont=function(){return c.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)},o.prototype.setQuantityFont=function(t){return c.setFontToProperties(t,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this},o.prototype.getCancelButtonBorderColor=function(){return c.getColorFromProperties(this._line.properties().cancelButtonBorderColor,this._line.properties().cancelButtonBorderTransparency)},o.prototype.setCancelButtonBorderColor=function(t){return c.setColorToProperties(t,this._line.properties().cancelButtonBorderColor,this._line.properties().cancelButtonBorderTransparency),this},o.prototype.getCancelButtonBackgroundColor=function(){return c.getColorFromProperties(this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency)},o.prototype.setCancelButtonBackgroundColor=function(t){return c.setColorToProperties(t,this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency),this},o.prototype.getCancelButtonIconColor=function(){return c.getColorFromProperties(this._line.properties().cancelButtonIconColor,this._line.properties().cancelButtonIconTransparency)},o.prototype.setCancelButtonIconColor=function(t){return c.setColorToProperties(t,this._line.properties().cancelButtonIconColor,this._line.properties().cancelButtonIconTransparency),this},o.prototype.block=function(){this._blocked=!0,this._line.updateAllViewsAndRedraw()},o.prototype.unblock=function(){this._blocked=!1,this._line.updateAllViewsAndRedraw()},o.prototype.isFunction=function(t){return"function"==typeof t},o.prototype.onCancel=function(t,e){return e?this.isFunction(e)&&(this._onCancelData=t,this._onCancelCallback=e):this.isFunction(t)&&(this._onCancelCallback=t),this},o.prototype.callOnCancel=function(){this.isFunction(this._onCancelCallback)&&this._onCancelCallback.call(this,this._onCancelData)},o.prototype.isOnCancelCallbackPresent=function(){return this.isFunction(this._onCancelCallback)},o.prototype.onModify=function(t,e){return e?this.isFunction(e)&&(this._onModifyData=t,this._onModifyCallback=e):this.isFunction(t)&&(this._onModifyCallback=t),this},o.prototype.callOnModify=function(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)},o.prototype.onMove=function(t,e){return e?this.isFunction(e)&&(this._onMoveData=t,this._onMoveCallback=e):this.isFunction(t)&&(this._onMoveCallback=t),this},o.prototype.callOnMove=function(){this.isFunction(this._onMoveCallback)&&this._onMoveCallback.call(this,this._onMoveData)},o.prototype.onContextMenu=function(t,e){return e?this.isFunction(e)&&(this._onContextMenuData=t,this._onContextMenuCallback=e):this.isFunction(t)&&(this._onContextMenuCallback=t),this},o.prototype.callOnContextMenu=function(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)},o.prototype.remove=function(){this._line._model.removeSource(this._line),delete this._line},n.prototype._height=function(){var t=1;return Math.max(20,t+Math.max(c.fontHeight(this._adapter.getBodyFont()),c.fontHeight(this._adapter.getQuantityFont())))},n.prototype._bodyWidth=function(t){var e,i,o;return 0===this._adapter.getText().length?0:(t.save(),t.font=this._adapter.getBodyFont(),e=10,i=10,o=t.measureText(this._adapter.getText()).width,t.restore(),Math.round(e+i+o))},n.prototype._quantityWidth=function(t){var e,i;return 0===this._adapter.getQuantity().length?0:(t.save(),t.font=this._adapter.getQuantityFont(),e=10,i=t.measureText(this._adapter.getQuantity()).width,t.restore(),Math.round(Math.max(this._height(),e+i)))},n.prototype._cancelButtonWidth=function(){return this._adapter.isOnCancelCallbackPresent()?this._height():0},n.prototype._drawLines=function(t,e,i,o,n){t.save(),t.strokeStyle=this._adapter.getLineColor(),t.lineStyle=this._adapter.getLineStyle(),t.lineWidth=this._adapter.getLineWidth(),CanvasEx.drawLine(t,i,o,n,o),this._adapter.getExtendLeft()&&CanvasEx.drawLine(t,0,o,e,o),t.restore()},n.prototype._drawMovePoints=function(t,e,i){var o,n,s,r,a,l,h,c;for(t.save(),t.strokeStyle=this._adapter.getBodyBorderColor(),t.fillStyle=this._adapter.getBodyBorderColor(),o=2,n=4,s=5,r=e+n,a=r+o,l=Math.floor((this._height()-2*s)/2)+1,h=0;h<l;++h)c=i+s+2*h,CanvasEx.drawLine(t,r,c,a,c);t.restore()},n.prototype._drawBody=function(t,e,i){var o,n;t.strokeStyle=this._adapter.getBodyBorderColor(),t.fillStyle=this._adapter.getBodyBackgroundColor(),o=this._bodyWidth(t),n=this._height(),t.fillRect(e+.5,i+.5,o-1,n-1),t.strokeRect(e,i,o,n)},n.prototype._drawBodyText=function(t,e,i){var o,n,s;t.textAlign="center",t.textBaseline="middle",t.font=this._adapter.getBodyFont(),t.fillStyle=this._adapter.getBodyTextColor(),o=5,n=e+this._bodyWidth(t)/2,s=i+this._height()/2,t.fillText(this._adapter.getText(),o+n-2,s)},n.prototype._drawQuantity=function(t,e,i,o){var n,s;t.save(),t.strokeStyle=this._adapter.getQuantityBorderColor(),t.fillStyle=this._adapter.getQuantityBackgroundColor(),n=this._quantityWidth(t),s=this._height(),t.fillRect(e+.5,i+.5,n-1,s-1),o&&t.clip&&(t.beginPath(),t.rect(e+.5,i-.5,n+1,s+1),t.clip()),t.strokeRect(e,i,n,s),t.restore()},n.prototype._drawQuantityText=function(t,e,i){var o,n;t.save(),t.textAlign="center",t.textBaseline="middle",t.font=this._adapter.getQuantityFont(),t.fillStyle=this._adapter.getQuantityTextColor(),o=e+this._quantityWidth(t)/2,n=i+this._height()/2,t.fillText(this._adapter.getQuantity(),o,n),t.restore()},n.prototype._drawCancelButton=function(t,e,i,o){var n,s,r,a,l,h,c;t.strokeStyle=this._adapter.getCancelButtonBorderColor(),t.fillStyle=this._adapter.getCancelButtonBackgroundColor(),n=this._cancelButtonWidth(),s=this._height(),t.fillRect(e+.5,i+.5,n-1,s-1),this._adapter._blocked&&(t.fillStyle="rgba(140, 140, 140, 0.75)",t.fillRect(e+.5,i+.5,n-1,s-1)),t.save(),o&&t.clip&&(t.beginPath(),t.rect(e+.5,i-.5,n+1,s+1),t.clip()),t.strokeRect(e,i,n,s),t.restore(),r=e+n,a=i+s,t.strokeStyle=this._adapter.getCancelButtonIconColor(),l=8,h=(this._cancelButtonWidth()-l)/2,c=(this._height()-l)/2,CanvasEx.drawPoly(t,[{x:e+h,y:i+c},{x:r-h,y:a-c}],!0),CanvasEx.drawPoly(t,[{x:r-h,y:i+c},{x:e+h,y:a-c}],!0)},n.prototype.draw=function(t){var e,i,o,n,s,r,a,l,h,c,d;!this._data.points||this._data.points.length<1||(e=this._data.width,i=this._bodyWidth(t),o=this._quantityWidth(t),n=i+o+this._cancelButtonWidth(),s=e-n,r=Math.max(this._adapter.getLineLength()/100*e,1),a=Math.round(e-Math.min(s,r)),l=a-n,h=Math.round(this._data.points[0].y),c=Math.round(h-(this._height()+1)/2),this._cache.bodyRight=l+i,this._cache.quantityRight=l+i+o,this._cache.top=c,this._cache.bottom=c+this._height(),this._cache.left=l,this._cache.right=a,this._drawLines(t,l,a,h,e),d=!1,0!==i&&(this._drawBody(t,l,c),this._drawMovePoints(t,l,c),this._drawBodyText(t,l,c),d=!0),0!==o&&(this._drawQuantity(t,l+i,c,d),this._drawQuantityText(t,l+i,c),d=!0),0!==this._cancelButtonWidth()&&this._drawCancelButton(t,l+i+o,c,d))},n.prototype.hitTest=function(t){return 0===this._data.points.length?null:t.y<this._cache.top||t.y>this._cache.bottom?null:this._adapter._blocked&&t.x>=this._cache.left&&t.x<this._cache.right?new u(u.CUSTOM,{}):this._adapter._editable&&t.x>=this._cache.left&&t.x<this._cache.bodyRight?0===this._adapter.getTooltip().length?new u(u.MOVEPOINT):new u(u.MOVEPOINT,{tooltip:{text:this._adapter.getTooltip(),rect:new _(this._cache.left,this._cache.top,this._cache.bodyRight-this._cache.left,this._cache.bottom-this._cache.top)}}):this._adapter._editable&&t.x>=this._cache.bodyRight&&t.x<this._cache.quantityRight?new u(u.CUSTOM,{mouseDownHandler:this._adapter.callOnModify.bind(this._adapter),tooltip:{text:$.t("Edit Order"),rect:new _(this._cache.bodyRight,this._cache.top,this._cache.quantityRight-this._cache.bodyRight,this._cache.bottom-this._cache.top)}}):this._adapter._editable&&t.x>=this._cache.quantityRight&&t.x<this._cache.right?new u(u.CUSTOM,{mouseDownHandler:this._adapter.callOnCancel.bind(this._adapter),tooltip:{text:$.t("Cancel Order"),rect:new _(this._cache.quantityRight,this._cache.top,this._cache.right-this._cache.quantityRight,this._cache.bottom-this._cache.top)}}):null},inherit(s,h),s.prototype._updateImpl=function(){h.prototype._updateImpl.call(this),this._background=this._linetool.properties().lineColor.value()},inherit(r,p),r.prototype.renderer=function(){var t={points:this._points,width:this._model.timeScale().width()};return new n(t,this._rendererCache,this._source._adapter)},inherit(a,l),a.skipMagnetting=!0,a.prototype.setPoint=function(t,e,i){this._points[t]=e,this.normalizePoints()},a.prototype.addPoint=function(t,e){return this._points.push(t),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0},a.prototype.title=function(){return"Order"},a.prototype.endMoving=function(t){var e=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.price!==this._currentMovingPoint.price;l.prototype.endMoving.call(this),!t&&e&&this._adapter.callOnMove()},a.prototype.createPriceAxisView=function(t){return this._priceAxisView=new s(this,t),this._priceAxisView},a.prototype.paneViews=function(t){return TradingView.printing&&!e.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?d.prototype.paneViews.call(this,t):null},a.prototype.priceAxisViews=function(t,i){return TradingView.printing&&!e.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?d.prototype.priceAxisViews.call(this,t,i):null},a.prototype.hasContextMenu=function(){return!0},a.prototype.contextMenuItems=function(){return this._adapter.callOnContextMenu()},a.prototype.onlyYMoving=function(){return!0},t.exports=a}).call(e,i(1))},function(t,e,i){"use strict";for(var o={StudyStrategy:i(214),StatusView:i(156),StudyLineDataSource:i(145).StudyLineDataSource,StudyLineDataSourcePaneView:i(145).StudyLineDataSourcePaneView,StudyVersioning:i(148),StudyMigration:i(149),study_Overlay:i(216).study_Overlay,study_Compare:i(217),study_ScriptWithDataOffset:i(218),StudyPaneView:i(153).StudyPaneView,StudyBackgroundPaneView:i(153).StudyBackgroundPaneView,StudyPlotShapesPaneView:i(153).StudyPlotShapesPaneView,StudyPlotCharsPaneView:i(153).StudyPlotCharsPaneView,StudyPlotArrowsPaneView:i(153).StudyPlotArrowsPaneView,StudyPlotCandlesPaneView:i(153).StudyPlotCandlesPaneView,StudyStrategyOrdersPaneView:i(215),StudyPriceAxisView:i(152),StudyDataWindowView:i(155).StudyDataWindowView,DataVendorStudyDataWindowView:i(155).DataVendorStudyDataWindowView,LineStudyMtpAnalysis:i(219),LineStudyMtpDecisionPoint:i(220),LineStudyMtpRiskReward:i(221),LineStudyMtpElliotWaveMain:i(222).LineStudyMtpElliotWaveMain,LineStudyMtpElliotWaveMajor:i(222).LineStudyMtpElliotWaveMajor,LineStudyMtpElliotWaveMinor:i(222).LineStudyMtpElliotWaveMinor,LineStudyMtpDownWave1OrA:i(223).LineStudyMtpDownWave1OrA,LineStudyMtpDownWave2OrB:i(223).LineStudyMtpDownWave2OrB,LineStudyMtpDownWave3:i(223).LineStudyMtpDownWave3,LineStudyMtpDownWave4:i(223).LineStudyMtpDownWave4,LineStudyMtpDownWave5:i(223).LineStudyMtpDownWave5,LineStudyMtpDownWaveC:i(223).LineStudyMtpDownWaveC,LineStudyMtpUpWave1OrA:i(223).LineStudyMtpUpWave1OrA,LineStudyMtpUpWave2OrB:i(223).LineStudyMtpUpWave2OrB,LineStudyMtpUpWave3:i(223).LineStudyMtpUpWave3,LineStudyMtpUpWave4:i(223).LineStudyMtpUpWave4,LineStudyMtpUpWave5:i(223).LineStudyMtpUpWave5,LineStudyMtpUpWaveC:i(223).LineStudyMtpUpWaveC},n=Object.keys(o),s=n.length;s--;)TradingView[n[s]]=o[n[s]];t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,i,o,s){n.call(this,t,i,o,s),this._barsIndexes=[],this._reportDataBuffer=null,this._reportData=null,this.watchedData=new e,this.model().addStrategySource(this)}var n=i(150).Study,s=i(215);inherit(o,n),o.prototype.stop=function(){return n.prototype.stop.call(this),this._avoidRemoveStrategySource?void delete this._avoidRemoveStrategySource:void this.model().removeStrategySource(this)},o.prototype.start=function(){this.model().addStrategySource(this),n.prototype.start.call(this)},o.prototype.processHibernate=function(){this._studyId&&!this.isVisible()&&(this._avoidRemoveStrategySource=!0),n.prototype.processHibernate.call(this)},o.prototype.onData=function(t){var e,i,o,s;n.prototype.onData.call(this,t),t.method&&"data_update"===t.method&&(e=t.params&&t.params.nonseries&&t.params.nonseries.d,i=e&&e.data&&e.data.report,i?(e.isUpdate&&this._reportDataBuffer&&(i=$.extend(this._reportDataBuffer,i)),this._reportDataBuffer=this._reportData=$.extend(this._reportDataBuffer||{},i)):(o=$.extend({},t),$.extend(!0,o,{params:{nonseries:{d:{data:{report:this._reportDataBuffer}}}}}),t=o),s=t.params&&t.params.nonseries&&t.params.nonseries.indexes,"nochange"!==s&&s instanceof Array&&s.length&&this._collateBarsIndexes(s)),this.watchedData.setValue(t)},o.prototype._collateBarsIndexes=function(t){var e,i;if(Array.isArray(t)&&(e=this._reportData&&this._reportData.filledOrders,e&&e.length))for(this._barsIndexes.length=0,i=0;i<e.length;i++)this._barsIndexes[i]=t[e[i].tm]},o.prototype.reportData=function(){return this._reportData},o.prototype.ordersData=function(){return this._reportData&&this._reportData.filledOrders},o.prototype.barsIndexes=function(){return this._barsIndexes},o.prototype.clearData=function(){n.prototype.clearData.call(this),this._strategyOrdersPaneView&&this._strategyOrdersPaneView.clearItems()},o.prototype.restoreData=function(t){n.prototype.restoreData.apply(this,arguments),this.model().addStrategySource(this),t.reportData&&t.barsIndexes&&(this._reportData=t.reportData,this._barsIndexes=t.barsIndexes,this.watchedData.setValue({method:"data_update",params:{nonseries:{d:{data:{report:this._reportData}}}}})),t.activeState&&(this._activeState=!0)},o.prototype.activeState=function(){return this._activeState},o.prototype.updateAllViews=function(){n.prototype.updateAllViews.call(this),this._strategyOrdersPaneView&&this._strategyOrdersPaneView.update()},o.prototype.createViews=function(){n.prototype.createViews.call(this),this._strategyOrdersPaneView=new s(this,this._series,this._model)},o.prototype.state=function(t){var e=n.prototype.state.apply(this,arguments);return t&&this._reportData&&this._barsIndexes&&(e.data||(e.data={}),e.data.reportData=this._reportData,e.data.barsIndexes=this._barsIndexes,e.data.activeState=this.model().activeStrategySource().value()===this),e},t.exports=o}).call(e,i(43))},function(t,e,i){(function(e){"use strict";function o(t,e,i){this._study=t,this._series=e,this._model=i,this._invalidated=!0,this._orderArrow={vMargin:o.DEFAULT_ORDER_ARROW_VMARGIN,width:o.DEFAULT_ORDER_ARROW_WIDTH,height:o.DEFAULT_ORDER_ARROW_HEIGHT},this._exitLineWidth=o.DEFAULT_ORDER_ARROW_EXIT_LINE_WIDTH,this._priceArrow={width:o.DEFAULT_PRICE_ARROW_WIDTH,height:o.DEFAULT_PRICE_ARROW_HEIGHT},this._text={vMargin:o.DEFAULT_TEXT_VMARGIN,font:o.DEFAULT_FONT,fontSize:o.DEFAULT_FONT_SIZE},this._checkHideTextIfBarSpacingLT=o.DEFAULT_CHECK_HIDE_TEXT_IF_BARSPACING_LT,this._textIsVisible=!0,this._colors={entryBuy:o.DEFAULT_ENTRY_BUY_COLOR,entrySell:o.DEFAULT_ENTRY_SELL_COLOR,exit:o.DEFAULT_EXIT_COLOR},this._items={entryBuy:[],entrySell:[],exit:[]},this._textWidths={},this._study.properties().strategy.orders.subscribe(this,this.update)}var n=i(95).PaneRendererStudyStrategyOrders,s=i(98);o.DEFAULT_ORDER_ARROW_VMARGIN=7,o.DEFAULT_ORDER_ARROW_WIDTH=9,o.DEFAULT_ORDER_ARROW_HEIGHT=11,o.DEFAULT_ORDER_ARROW_EXIT_LINE_WIDTH=2,o.DEFAULT_PRICE_ARROW_WIDTH=5,o.DEFAULT_PRICE_ARROW_HEIGHT=9,o.DEFAULT_TEXT_VMARGIN=2,o.DEFAULT_FONT="Arial",o.DEFAULT_FONT_SIZE=10,o.DEFAULT_CHECK_HIDE_TEXT_IF_BARSPACING_LT=10,o.DEFAULT_ENTRY_BUY_COLOR="#008fff",o.DEFAULT_ENTRY_SELL_COLOR="#f00",o.DEFAULT_EXIT_COLOR="#cc47ed",o.prototype._updateImpl=function(){var t,i,o,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P;if(this.clearItems(),t=this._study.ordersData(),t&&t.length&&(i=this._model.timeScale(),o=this._series.priceScale(),!(!i||!o||i&&i.isEmpty()||o&&o.isEmpty()||(n=i.visibleBars().clone(),n.isEmpty())))){for(s=this._study.barsIndexes(),r=this._series.nearestIndex(n.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),a=this._series.nearestIndex(n.lastBar(),TradingView.SEARCH_NEAREST_LEFT),l=r,h=[],c=[];l<=a;l++)for(d=-1;(d=s.indexOf(l,d+1))!==-1;)p=t[d],p&&(h.push(p),c.push(l));for(u=this._study.properties(),_=u.strategy.orders.showLabels.value(),f=u.strategy.orders.showQty.value(),g=_||f,g&&i.barSpacing()<this._checkHideTextIfBarSpacingLT&&this._orderArrow.width*h.length*2>i.width()&&(g=!1),m=g&&this._text.fontSize+this._text.vMargin||0,v=m&&m*(_+f),y=0,b={upper:[],lower:[]};y<h.length;y++)p=h[y],d=c[y],w=i.indexToCoordinate(d,!0),S=o.priceToCoordinate(this._series[p.b?"low":"high"](d),!0),T=p.b?"lower":"upper",C="number"==typeof b[T][d]&&b[T][d]||0,S+=p.b?C:-C,"number"!=typeof b[T][d]&&(b[T][d]=0),b[T][d]+=(p.e?0:this._exitLineWidth)+this._orderArrow.vMargin+this._orderArrow.height+v,x=o.priceToCoordinate(p.p,!0),P=p.e?!p.b&&p.e?"entrySell":"entryBuy":"exit",this._items[P].push({orderPoint:new e.Point(w,S),pricePoint:new e.Point(w,x),label:_&&(p.c||p.id||"Untitled")||null,qty:f&&(p.b?"+":"-")+~~p.q||null,pos:T});this._textLabelIsVisible=_,this._textQtyIsVisible=f,this._textIsVisible=g}},o.prototype.update=function(){this._invalidated=!0},o.prototype.clearItems=function(){this._items.entryBuy.length=this._items.entrySell.length=this._items.exit.length=0},o.prototype.renderer=function(){var t,e,i,o=this._study.properties();if(o.visible.value()&&o.strategy.orders.visible.value()&&(t=this._series.priceScale(),(this._invalidated||t&&t.isScaled())&&(this._updateImpl(),this._invalidated=!1),this._items.entryBuy.length||this._items.entrySell.length||this._items.exit.length)){e=new s;for(i in this._items)this._items[i].length&&e.append(new n({items:this._items[i],color:this._colors[i],orderArrow:this._orderArrow,exitLineWidth:"exit"===i&&this._exitLineWidth||0,priceArrow:this._priceArrow,text:this._textIsVisible&&this._text||null},this._textWidths));return e}},t.exports=o}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(e,i){this._source=e,this._model=i,this._points=[new t.Point(0,0)]}function n(t,e){this._source=t,this._model=e,this._invalidated=!0,this._text="",this._coordinate=0,this._background="black",this._color="white"}function s(t,e){y.call(this),this._study=t,this._model=e,this._items.push(new b("Open","")),this._items.push(new b("High","")),this._items.push(new b("Low","")),this._items.push(new b("Close","")),this._invalidated=!0,this.update()}function r(t,e,i,o){this._symbolLabelView=new T(t,this,"close","symbol","showSymbolLabels"),l.call(this,t,e,i,o),this._formatter=null,this._paneView=null;var n=this;this.properties().minTick.listeners().subscribe(null,function(){n._createFormatter(),n.updateAllViews(),n._model.invalidate(new P(P.FULL_UPDATE))})}var a=i(84),l=i(150).Study,h=i(75),c=i(76),d=i(92),p=d.SeriesAreaPaneView,u=d.SeriesLinePaneView,_=d.SeriesHollowCandlesPaneView,f=d.SeriesCandlesPaneView,g=d.SeriesBarsPaneView,m=i(156),v=i(91),y=v.DataWindowView,b=v.DataWindowItem,w=i(101).SeriesBarColorer,S=i(102).HorzLineRenderer,T=i(106),C=i(94),x=i(110),P=i(113),L=i(82),k=L.PriceFormatter;o.prototype.update=function(){if(this._visible=!1,this._source.properties().showPriceLine.value()){var e=this._source.lastValueData("close",!0);e.noData||(this._visible=!0,this._points=[new t.Point(0,e.coordinate)],this._color=e.color)}},o.prototype.renderer=function(){var t={};return t.points=this._points,t.color=this._color,t.linewidth=1,t.linestyle=CanvasEx.LINESTYLE_DOTTED,t.hitTestResult=C.REGULAR,t.visible=this._visible,new S(t)},inherit(n,h),n.prototype.update=function(){this._invalidated=!0},n.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),h.prototype.coordinate.call(this)},n.prototype._updateImpl=function(){this._visible=!1,this._text="";var t=this._source.lastValueData("close",!1);t.noData||(this._text=t.text,this._floatCoordinate=t.floatCoordinate,this._coordinate=t.coordinate,this._background=t.color,this._visible=!0)},n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var t={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,visible:this._visible};return new c(t)},inherit(s,y),s.prototype._updateImpl=function(){var t,e,i,o,n,s,r,l,h,c,d,p;if(this._header=this._study.title(),!this._model.timeScale().isEmpty()&&0!==this._study.data().length){if(i=!1,this._study.properties().style.value()===a.STYLE_BARS?(t=this._study.properties().barStyle.upColor.value(),e=this._study.properties().barStyle.downColor.value(),i=this._study.properties().barStyle.barColorsOnPrevClose.value()):this._study.properties().style.value()===a.STYLE_CANDLES?(t=this._study.properties().candleStyle.upColor.value(),e=this._study.properties().candleStyle.downColor.value(),i=this._study.properties().candleStyle.barColorsOnPrevClose.value()):this._study.properties().style.value()===a.STYLE_HOLLOW_CANDLES?(t=this._study.properties().hollowCandleStyle.upColor.value(),e=this._study.properties().hollowCandleStyle.downColor.value(),i=!0):this._study.properties().style.value()===a.STYLE_LINE?t=e=this._study.properties().lineStyle.color.value():this._study.properties().style.value()===a.STYLE_AREA&&(t=e=this._study.properties().areaStyle.linecolor.value()),o=this._study.series(),n=this._model.crossHairSource().appliedIndex(),s=o.nearestIndex(n,TradingView.SEARCH_NEAREST_LEFT),void 0!==s){if(r=this._study.data().valueAt(s),!(r&&r[TradingView.OPEN_PLOT]&&r[TradingView.HIGH_PLOT]&&r[TradingView.LOW_PLOT]&&r[TradingView.CLOSE_PLOT]))return;for(l=this._study.formatter(),this._items[0].setValue(l.format(r[TradingView.OPEN_PLOT])),this._items[1].setValue(l.format(r[TradingView.HIGH_PLOT])),this._items[2].setValue(l.format(r[TradingView.LOW_PLOT])),this._items[3].setValue(l.format(r[TradingView.CLOSE_PLOT])),i&&s>=1?(c=this._study.data().valueAt(s-1),h=c[TradingView.CLOSE_PLOT]<=r[TradingView.CLOSE_PLOT]?t:e):h=r[TradingView.OPEN_PLOT]<=r[TradingView.CLOSE_PLOT]?t:e,d=0;d<4;d++)this._items[d].setColor(h)}p=x(this._study.symbolInfo()),p?this._additional="(Data Provided by "+p+")":this._additional=void 0}},s.prototype.items=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items},s.prototype.update=function(){this._invalidated=!0},s.prototype.additional=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._additional},inherit(r,l),r.prototype.createPlotLabels=function(t){},r.prototype.symbol=function(){var t,e=this.properties().inputs.symbol.value(),i=this._resolvedSymbols?this._resolvedSymbols[e]:null;return t=i?i.name:e,t.toUpperCase()},r.prototype.lastValueData=function(t,e){var i,o,n=l.prototype.lastValueData.call(this,"close",e);if(n.noData)return n;switch(i=this.properties(),o=n.item,i.style.value()){case a.STYLE_BARS:n.color=o[TradingView.OPEN_PLOT]<=o[TradingView.CLOSE_PLOT]?i.barStyle.upColor.value():i.barStyle.downColor.value();break;case a.STYLE_CANDLES:n.color=o[TradingView.OPEN_PLOT]<=o[TradingView.CLOSE_PLOT]?i.candleStyle.upColor.value():i.candleStyle.downColor.value();break;case a.STYLE_HOLLOW_CANDLES:n.color=o[TradingView.OPEN_PLOT]<=o[TradingView.CLOSE_PLOT]?i.candleStyle.upColor.value():i.candleStyle.downColor.value();break;case a.STYLE_LINE:n.color=i.lineStyle.color.value();break;case a.STYLE_AREA:n.color=i.areaStyle.color1.value()}return n},r.prototype.createViews=function(){this._priceAxisViews=[],this._priceAxisViewsBase=[new n(this,this._model)],this._paneViews=[];var t=null;switch(this._properties.style.value()){case a.STYLE_BARS:t=new g(this,this._model);break;case a.STYLE_CANDLES:t=new f(this,this._model);break;case a.STYLE_HOLLOW_CANDLES:t=new _(this,this._model);break;case a.STYLE_LINE:t=new u(this,this._properties.lineStyle.priceSource.value(),this._model);break;case a.STYLE_AREA:t=new p(this,this._properties.areaStyle.priceSource.value(),this._model)}t&&this._paneViews.push(t),this._paneViews.push(new o(this,this._model)),this._paneViews.push(this._symbolLabelView),this._dataWindowView||(this._dataWindowView=new s(this,this._model)),this._statusView||(this._statusView=new m(this)),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews)},r.prototype.barColorer=function(){return new w(this)},r.prototype.start=function(){this._formatter=null,l.prototype.start.call(this),this.priceScale()&&this.priceScale().updateFormatter()},r.prototype._createFormatter=function(){var t,e,i,o,n,s,r;"default"===this.properties().minTick.value()?(t=this.properties().inputs.symbol.value(),e=this._resolvedSymbols[t],this._formatter=new k(e?e.pricescale:100,e?e.minmov:1,!!e&&e.fractional)):(i=this.properties().minTick.value(),o=isNumber(i)?["100","1","false"]:i.split(","),n=parseInt(o[0]),s=parseInt(o[1]),r="true"===o[2],this._formatter=new k(n,s,r)),this.priceScale()&&this.priceScale().updateFormatter()},r.prototype.formatter=function(){return this._formatter||this._createFormatter(),this._formatter},r.prototype._changeInputs=function(){l.prototype._changeInputs.call(this,this.inputs()),this.m_formatter=null,this.priceScale().updateFormatter()},r.prototype.title=function(){var t,e=this.properties().inputs.symbol.value(),i=this._resolvedSymbols[e];return t=i?i.name+", "+i.exchange:e,t.toUpperCase()},r.prototype.bars=function(){return this.m_data},r.prototype.open=function(t){return this.bars().valueAt(t)[TradingView.OPEN_PLOT]},r.prototype.high=function(t){return this.bars().valueAt(t)[TradingView.HIGH_PLOT]},r.prototype.low=function(t){return this.bars().valueAt(t)[TradingView.LOW_PLOT]},r.prototype.close=function(t){return this.bars().valueAt(t)[TradingView.CLOSE_PLOT]},r.prototype.hl2=function(t){return(this.high(t)+this.low(t))/2},r.prototype.hlc3=function(t){return(this.high(t)+this.low(t)+this.close(t))/3},r.prototype.ohlc4=function(t){return(this.open(t)+this.high(t)+this.low(t)+this.close(t))/4},r.prototype.symbolInfo=function(){if(!this._resolvedSymbols)return null;var t=this._properties.inputs.symbol.value();return t?this._resolvedSymbols[t]:null},r.prototype.lastPriceLabelFixedCoordinate=function(){return this._priceAxisViews[0]._fixedCoordinate},r.prototype.tags=function(){var t=[],e=this.symbolInfo();return e?t.push(e.name):this._properties.inputs.symbol.value()&&t.push(this._properties.inputs.symbol.value()),t},e.OverlayDataWindowView=s,e.study_Overlay=r}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e,i,o){this._symbolLabelView=new s(t,this,"compare","symbol","showSymbolLabels"),TradingView.Study.call(this,t,e,i,o);var n=this;this._properties.minTick.listeners().subscribe(null,function(){n._createFormatter()}),this.properties().minTick.listeners().subscribe(null,function(){n._model.invalidate(new r(r.FULL_UPDATE))}),this._properties.merge({skipHistogramBaseOnAutoScale:!0})}var n=i(155).DataVendorStudyDataWindowView,s=i(106),r=i(113),a=i(82),l=a.PriceFormatter;inherit(o,TradingView.Study),o.prototype.createPlotLabels=function(t){},o.prototype.createViews=function(){this._dataWindowView||(this._dataWindowView=new n(this,this._model)),TradingView.Study.prototype.createViews.call(this),this._paneViews.push(this._symbolLabelView)},o.prototype._createFormatter=function(){var t,e,i,o,n,s=this.properties().inputs.symbol.value(),r=this._resolvedSymbols?this._resolvedSymbols[s]:null;"default"===this.properties().minTick.value()?this._formatter=new l(r?r.pricescale:100,r?r.minmov:1,!!r&&r.fractional):(t=this.properties().minTick.value(),e=isNumber(t)?["100","1","false"]:t.split(","),i=parseInt(e[0]),o=parseInt(e[1]),n="true"===e[2],this._formatter=new l(i,o,n)),this.priceScale()&&this.priceScale().updateFormatter()},o.prototype.symbol=function(){var t,e=this.properties().inputs.symbol.value(),i=this._resolvedSymbols?this._resolvedSymbols[e]:null;return t=i?i.name:e,t.toUpperCase()},o.prototype.title=function(t){var e,i=this.properties().inputs.symbol.value(),o=this._resolvedSymbols?this._resolvedSymbols[i]:null;return e=o?o.name+", "+o.exchange:i,e.toUpperCase()},o.prototype.symbolInfo=function(){if(!this._resolvedSymbols)return null;var t=this._properties.inputs.symbol.value();return t?this._resolvedSymbols[t]:null},o.prototype.lastPriceLabelFixedCoordinate=function(){return this._priceAxisViews[0]._fixedCoordinate},o.prototype.tags=function(){var t=this.symbol();return t?[t]:[]},t.exports=o},function(t,e,i){"use strict";function o(t,e,i,o){
n.call(this,t,e,i,o)}var n=i(150).Study,s=i(112);inherit(o,n),o.prototype.clearData=function(){n.prototype.clearData.call(this),this._underlyingData=new s(this._plotFields)},o.prototype._mergeData=function(t){var e,i,o,n=0===this._underlyingData._length()?null:this._underlyingData._indexAt(0);for(this._underlyingData.merge(t),n!==this._underlyingData._indexAt(0)&&(this.m_data=new s(this._underlyingData.columns())),this.m_data._start=this._underlyingData._start,this.m_data._end=this._underlyingData._end,e=this.m_data._length(),i=e;i<this._underlyingData._length();++i)o=TradingView.merge({},this._underlyingData._valueAt(i)),this.m_data.add(this._underlyingData._indexAt(i),o);return this._plotsForStrategyProcessing().forEach(function(t){var i=this._createStrategy(t.strategy,t.strategyIndex,t.targetIndex,e);i.rebuildData(this.m_data)},this),this.m_data},o.prototype._plotsForStrategyProcessing=function(){var t=["dataoffset"],e=[];return this._metaInfo.plots.forEach(function(i,o){var n,s,r=t.indexOf(i.type)>-1;r&&(n=null,this._metaInfo.plots.forEach(function(t,e){t.id===i.target&&(n=e)}),assert(n>=0,"target plot not found for strategy plot "+i.id),s={strategy:i.type,strategyIndex:o,targetIndex:n},e.push(s))},this),e},o.prototype._createStrategy=function(t,e,i,n){var s="Strategy_"+t;return new o[s](e,i,n)},o.Strategy_dataoffset=function(t,e,i){this._strategyPlotIndex=t,this._targetPlotIndex=e,this._startIndex=i},o.Strategy_dataoffset.prototype.rebuildData=function(t){var e,i,o,n,s,r,a,l=this._targetPlotIndex+1,h=this._strategyPlotIndex+1,c=null,d=null;for(e=this._startIndex;e<t._length();++e)i=t._valueAt(e),o=i[l],n=i[h]?Math.round(i[h]):null,i[l]=null,i[h]=null,!n||n>0||(s=e+n,r={pointIndex:s,value:o},d?d.pointIndex!==r.pointIndex&&(s>=0&&(t._items[s].value[l]=o),a=!1,c&&(a=c.value<=d.value&&d.value<=o||c.value>=d.value&&d.value>=o),a?d.pointIndex>=0&&(t._items[d.pointIndex].value[l]=null):c=d,d=r):d=r)},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i)}var n=i(160);inherit(o,n),o.prototype._mtpStudyId=function(){return"mtp_tsanalysis"},o.prototype.pointsCount=function(){return 1},o.prototype._studyInputs=function(){var t=this.points()[0].index,e=this._model.mainSeries().bars().valueAt(t);return e?[this.properties().inputs.displayZoneLabels.value(),1e3*e[TradingView.TIME_PLOT],this.properties().inputs.account_size.value(),this.properties().inputs.percent_risk.value(),this.properties().inputs.tickEntryOffset.value(),this.properties().inputs.tickStopOffset.value(),this.properties().inputs.minRRRatio.value(),this.properties().inputs.shouldFilterWPTZones.value(),this.properties().inputs.shouldFilterSTFTrends.value()]:null},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this._symbolIntervalChanged=!1,this._model.mainSeries().onSymbolIntervalChanged().subscribe(this,this.onSymbolIntervalChanged)}var n=i(160);inherit(o,n),o.prototype._mtpStudyId=function(){return"mtp_decisionpoint"},o.prototype.onSymbolIntervalChanged=function(){this._symbolIntervalChanged=!0},o.prototype.pointsCount=function(){return 1},o.prototype._studyInputs=function(){var t=this.points()[0].index,e=this._model.mainSeries().bars().valueAt(t);return e?[this.properties().inputs.displayZoneLabels.value(),this._symbolIntervalChanged,1e3*e[TradingView.TIME_PLOT]]:null},o.prototype.onData=function(t){n.prototype.onData.call(this,t),this._symbolIntervalChanged=!1},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i)}var n=i(160);inherit(o,n),o.prototype._mtpStudyId=function(){return"mtp_riskreward"},o.prototype.pointsCount=function(){return 3},o.getTooltipText=function(t){return t&&0!==t._points.length?1===t._points.length?"Select Stop Bar":2===t._points.length?"Select Target Point":null:"Select Entry Setup Bar"},o.prototype._studyInputs=function(){var t=this.points()[0].index,e=this.points()[1].index,i=this.points()[2].index,o=this._model.mainSeries().bars().valueAt(t),n=this._model.mainSeries().bars().valueAt(e),s=this._model.mainSeries().bars().valueAt(i);return o&&n&&s?[1e3*o[TradingView.TIME_PLOT],1e3*n[TradingView.TIME_PLOT],1e3*s[TradingView.TIME_PLOT],this.points()[2].price,this.properties().inputs.account_size.value(),this.properties().inputs.percent_risk.value(),this.properties().inputs.tickEntryOffset.value(),this.properties().inputs.tickStopOffset.value()]:null},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){a.call(this,t,e,i)}function n(t,e,i){o.call(this,t,e,i)}function s(t,e,i){o.call(this,t,e,i)}function r(t,e,i){o.call(this,t,e,i)}var a=i(160);inherit(o,a),o.prototype.pointsCount=function(){return 1},o.prototype._studyInputs=function(){var t=this.points()[0].index,e=this._model.mainSeries().bars().valueAt(t);return e?[this.properties().inputs.displayZoneLabels.value(),1e3*e[TradingView.TIME_PLOT]]:null},inherit(n,o),n.prototype._mtpStudyId=function(){return"mtp_ew_main"},inherit(s,o),s.prototype._mtpStudyId=function(){return"mtp_ew_major"},inherit(r,o),r.prototype._mtpStudyId=function(){return"mtp_ew_minor"},e.LineStudyMtpElliotWaveMinor=r,e.LineStudyMtpElliotWaveMajor=s,e.LineStudyMtpElliotWaveMain=n,e.LineStudyMtpElliotWave=o},function(t,e,i){"use strict";function o(t,e,i,o,n){this._wptStudyId=o,this._pointsCount=n,g.call(this,t,e,i)}function n(t,e,i){o.call(this,t,e,i,"mtp_wpt_down1ora",2)}function s(t,e,i){o.call(this,t,e,i,"mtp_wpt_down2orb",2)}function r(t,e,i){o.call(this,t,e,i,"mtp_wpt_down3",3)}function a(t,e,i){o.call(this,t,e,i,"mtp_wpt_down4",2)}function l(t,e,i){o.call(this,t,e,i,"mtp_wpt_down5",5)}function h(t,e,i){o.call(this,t,e,i,"mtp_wpt_downc",3)}function c(t,e,i){o.call(this,t,e,i,"mtp_wpt_up1ora",2)}function d(t,e,i){o.call(this,t,e,i,"mtp_wpt_up2orb",2)}function p(t,e,i){o.call(this,t,e,i,"mtp_wpt_up3",3)}function u(t,e,i){o.call(this,t,e,i,"mtp_wpt_up4",2)}function _(t,e,i){o.call(this,t,e,i,"mtp_wpt_up5",5)}function f(t,e,i){o.call(this,t,e,i,"mtp_wpt_upc",3)}var g=i(160);inherit(o,g),o.prototype._studyInputs=function(){var t,e,i,o=[this.properties().inputs.displayZoneLabels.value()];for(t=0;t<this.pointsCount();++t){if(e=this.points()[t].index,i=this._model.mainSeries().bars().valueAt(e),!i)return null;o.push(1e3*i[TradingView.TIME_PLOT])}return o},o.prototype._mtpStudyId=function(){return this._wptStudyId},o.prototype.pointsCount=function(){return this._pointsCount},inherit(n,o),n.getTooltipText=function(t){var e=t?t._points.length:0;return"Down Wave 1 or A: Select Point "+(e+1)},inherit(s,o),s.getTooltipText=function(t){var e=t?t._points.length:0;return"Down Wave 2 or B: Select Point "+(e+1)},inherit(r,o),r.getTooltipText=function(t){var e=t?t._points.length:0;return"Down Wave 3: Select Point "+(e+1)},inherit(a,o),a.getTooltipText=function(t){var e=t?t._points.length:0;return"Down Wave 4: Select Point "+(e+1)},inherit(l,o),l.getTooltipText=function(t){var e=t?t._points.length:0;return"Down Wave 5: Select Point "+(e+1)},inherit(h,o),h.getTooltipText=function(t){var e=t?t._points.length:0;return"Down Wave C: Select Point "+(e+1)},inherit(c,o),c.getTooltipText=function(t){var e=t?t._points.length:0;return"Up Wave 1 or A: Select Point "+(e+1)},inherit(d,o),d.getTooltipText=function(t){var e=t?t._points.length:0;return"Up Wave 2 or B: Select Point "+(e+1)},inherit(p,o),p.getTooltipText=function(t){var e=t?t._points.length:0;return"Up Wave 3: Select Point "+(e+1)},inherit(u,o),u.getTooltipText=function(t){var e=t?t._points.length:0;return"Up Wave 4: Select Point "+(e+1)},inherit(_,o),_.getTooltipText=function(t){var e=t?t._points.length:0;return"Up Wave 5: Select Point "+(e+1)},inherit(f,o),f.getTooltipText=function(t){var e=t?t._points.length:0;return"Up Wave C: Select Point "+(e+1)},e.LineStudyMtpDownWave1OrA=n,e.LineStudyMtpDownWave2OrB=s,e.LineStudyMtpDownWave3=r,e.LineStudyMtpDownWave4=a,e.LineStudyMtpDownWave5=l,e.LineStudyMtpDownWaveC=h,e.LineStudyMtpUpWave1OrA=c,e.LineStudyMtpUpWave2OrB=d,e.LineStudyMtpUpWave3=p,e.LineStudyMtpUpWave4=u,e.LineStudyMtpUpWave5=_,e.LineStudyMtpUpWaveC=f},function(t,e,i){(function(e,o){"use strict";function n(t,i){var o=this;f.call(this),this._properties=i,this._model=t,this._dataWindowView=new c(this,t),this._priceAxisView=new h(this,t),this._startMeasurePriceAxisView=new h(this,t,"measureStartY"),this._endMeasurePriceAxisView=new h(this,t,"measureEndY"),this._timeAxisView=new d(this,t),this._startMeasureTimeAxisView=new d(this,t,"measureStartX"),this._endMeasureTimeAxisView=new d(this,t,"measureEndX"),this.visible=!0,t.readOnly()?this.areLinesVisible=!0:g.cursorTool.subscribe(function(t){o.areLinesVisible="arrow"!==t},{callWithLast:!0}),this._movedDelegate=new e,this._subscribed=!1,this._model.readOnly()&&(this.visibleTrap=!0)}function s(t,e){this._source=t,this._pane=e,this._rendererCache={}}function r(t,e,i){this.source=t,this.pane=e,this._horzVisible=i}function a(t,e,i){this.source=t,this.pane=e,this._axis=i||"x"}var l=i(74).LineDataSource,h=i(225),c=i(226),d=i(227),p=i(131).TrendLineRenderer,u=i(104).TextRenderer,_=i(129).RectangleRenderer,f=i(79).DataSource,g=i(81),m=i(95),v=m.PaneRendererCrossHair,y=m.PaneRendererCrossHairLock,b=i(98),w=i(113),S=i(82),T=S.PercentageFormatter,C=S.TimeSpanFormatter;inherit(n,f),n.prototype.index=0,n.prototype.price=NaN,n.prototype.pane=null,n.prototype.color="white",n.prototype.style="",n.prototype.properties=function(){return this._properties},n.prototype.moved=function(){return this._movedDelegate},n.prototype.setPosition=function(t,e,i){if(this._subscribed||(this._model.mainSeries().onRestarted().subscribe(this,n.prototype.clearMeasure),this._subscribed=!0),this.setLockedPosition(i),this.index=t,this.x=this._model.timeScale().indexToCoordinate(t),i&&!i.defaultPriceScale().isEmpty()){this.price=e;var o=i.defaultPriceScale();this.y=o.priceToCoordinate(e),this.pane=i}else this.price=NaN,this.y=NaN,this.pane=null;this.visible=!0,this.updateAllViews(),this._movedDelegate.fire({time:this._model.timeScale().points().roughTime(t),price:this.price})},n.prototype.updateIndex=function(){var t=this.index;this.index=this._model.timeScale().coordinateToIndex(this.x),this.index!==t&&this.updateAllViews()},n.prototype.setLockedPosition=function(t){delete this.lockedIndex,delete this.lockedX,t!==this._measurePane&&g.lockTimeAxis().value()&&(this.lockedIndex=this._model.timeScale().points().roughIndex(g.lockTimeAxisTime.value()),this.lockedX=this._model.timeScale().indexToCoordinate(this.lockedIndex))},n.prototype.clearPosition=function(){this.visible=!1,this.index=parseInt(this._model.mainSeries().data().bars().last()),this.price=NaN,this.y=NaN,this.pane=null},n.prototype.measureStartY=function(){var t,e=this._startMeasurePoint.price,i=this._measurePane;return i.defaultPriceScale().isPercent()&&(t=i.mainDataSource().firstValue(),e=i.defaultPriceScale().priceRange().convertToPercent(e,t)),i.defaultPriceScale().priceToCoordinate(e)},n.prototype.measureStartX=function(){return this._model.timeScale().indexToCoordinate(this._startMeasurePoint.index)},n.prototype.measureEndY=function(){var t,e=this._endMeasurePoint.price,i=this._measurePane;return i.defaultPriceScale().isPercent()&&(t=i.mainDataSource().firstValue(),e=i.defaultPriceScale().priceRange().convertToPercent(e,t)),i.defaultPriceScale().priceToCoordinate(e)},n.prototype.measureEndX=function(){return this._model.timeScale().indexToCoordinate(this._endMeasurePoint.index)},n.prototype.paneViews=function(t){var e=[new r(this,t,t===this.pane)];return t===this._measurePane&&(this._measurePaneView||(this._measurePaneView=new s(this,t)),this._measurePaneView.update(),e.push(this._measurePaneView)),g.lockTimeAxis().value()&&e.push(this._timeLockPaneView=this._timeLockPaneView||new a(this,t)),e},n.prototype.dataWindowView=function(){return this._dataWindowView},n.prototype.priceAxisViews=function(t,e){if(!this.visibleTrap||!this.visible||this.pane!==t||e!==t.defaultPriceScale())return null;var i=[this._priceAxisView];return this._startMeasurePoint&&i.push(this._startMeasurePriceAxisView),this._endMeasurePoint&&i.push(this._endMeasurePriceAxisView),i},n.prototype.timeAxisView=function(){if(!this.visibleTrap||!this.visible&&!g.lockTimeAxis().value())return null;var t=[this._timeAxisView];return this._startMeasurePoint&&t.push(this._startMeasureTimeAxisView),this._endMeasurePoint&&t.push(this._endMeasureTimeAxisView),t},n.prototype.updateAllViews=function(){this._priceAxisView.update(),this._startMeasurePoint&&(this._startMeasurePriceAxisView.update(),this._startMeasureTimeAxisView.update()),this._endMeasurePoint&&(this._endMeasurePriceAxisView.update(),this._endMeasureTimeAxisView.update()),this._timeAxisView.update()},n.prototype.startMeasurePoint=function(){return this._startMeasurePoint},n.prototype.startMeasuring=function(t,e){if(e.defaultPriceScale().isPercent()){var i=e.mainDataSource().firstValue();t.price=e.defaultPriceScale().priceRange().convertFromPercent(t.price,i)}this._startMeasurePoint=t,this._measurePane=e},n.prototype.finishMeasure=function(t){var e,i=this._measurePane;i.defaultPriceScale().isPercent()&&(e=i.mainDataSource().firstValue(),t.price=i.defaultPriceScale().priceRange().convertFromPercent(t.price,e)),this._endMeasurePoint=t},n.prototype.endMeasurePoint=function(){return this._endMeasurePoint},n.prototype.clearMeasure=function(t){delete this._measurePane,delete this._startMeasurePoint,delete this._endMeasurePoint,delete this._lastValidMeasurePoint,this._model.invalidate(new w(w.LIGHT_UPDATE))},n.prototype.measurePoints=function(){var t,e,i,o,n;return this.updateAllViews(),t=[this._startMeasurePoint],this._endMeasurePoint?t.push(this._endMeasurePoint):(this._measurePane===this.pane&&(this._lastValidMeasurePoint={x:this.x,y:this.y,rawPrice:this.price,price:this.price,index:this.index}),e=this._lastValidMeasurePoint.rawPrice,i=this._measurePane,o=i.defaultPriceScale(),o.isPercent()&&!o.isEmpty()&&(n=i.mainDataSource().firstValue(),this._lastValidMeasurePoint.price=o.priceRange().convertFromPercent(e,n)),t.push(this._lastValidMeasurePoint)),t},n.prototype.currentPoint=function(){return new o.Point(this.x,this.y)},n.prototype.appliedIndex=function(){return isFinite(this.lockedIndex)&&this.lockedIndex||this.index},n.prototype.appliedX=function(){return isFinite(this.lockedX)&&this.lockedX||this.x},s.prototype.update=function(){var t,e,i,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v;if(this._source._endMeasurePoint)t=this._source._endMeasurePoint.price,e=this._source._endMeasurePoint.index;else if(this._source._measurePane===this._source.pane)t=this._source.price,e=this._source.index;else{if(!this._source._lastValidMeasurePoint)return;t=this._source._lastValidMeasurePoint.rawPrice,e=this._source._lastValidMeasurePoint.index}i=t-this._source._startMeasurePoint.price,n=e-this._source._startMeasurePoint.index,s=this._source._startMeasurePoint.price,r=this._source._measurePane,r.defaultPriceScale().isPercent()&&(a=r.mainDataSource().firstValue(),this._source._endMeasurePoint&&(t=r.defaultPriceScale().priceRange().convertToPercent(t,a)),s=r.defaultPriceScale().priceRange().convertToPercent(s,a)),l=this._source._measurePane.defaultPriceScale().formatter().format(i),this._source._startMeasurePoint.price&&(h=i/this._source._startMeasurePoint.price,l+=" ("+(new T).format(100*h)+")"),this._label=""+l+"\n"+$.t("{0} bars").format(n),s=this._source._model._magnet.align(s,this._source._startMeasurePoint.index,this._source._measurePane),t=this._source._model._magnet.align(t,e,this._source._measurePane),c=this._source._model.timeScale().indexToCoordinate(this._source._startMeasurePoint.index),d=this._source._model.timeScale().indexToCoordinate(e),p=this._source._measurePane.defaultPriceScale().priceToCoordinate(s),u=this._source._measurePane.defaultPriceScale().priceToCoordinate(t),this._p1=new o.Point(c,p),this._p2=new o.Point(d,u),_=this._source._model.timeScale().indexToUserTime(this._source._startMeasurePoint.index),f=this._source._model.timeScale().indexToUserTime(e),g=this._source._measurePane.mainDataSource().base(),(_&&f||g)&&(m=(f.valueOf()-_.valueOf())/1e3,v=Math.round(i*g),this._label=""+l+" , "+v+"\n"+$.t("{0} bars").format(n)+", "+(new C).format(m))},s.prototype.renderer=function(){var t,e,i,n,s,r,a,h,c,d,f,g,m,v=new b,y={};return y.points=[this._p1,this._p2],y.width=this._source._model.timeScale().width(),y.height=this._source._measurePane.defaultPriceScale().height(),y.color="#D3E7FF",y.linewidth=0,y.fillBackground=!0,y.transparency=60,y.backcolor="#BADAFF",v.append(new _(y)),t=this._p1.add(this._p2).scaled(.5),e=new o.Point(this._p1.x,t.y),i=new o.Point(this._p2.x,t.y),n={points:[e,i],width:y.width,height:y.height,color:"#646668",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:l.LINEEND_NORMAL,rightend:l.LINEEND_ARROW},v.append(new p(n)),e=new o.Point(t.x,this._p1.y),i=new o.Point(t.x,this._p2.y),n={points:[e,i],width:y.width,height:y.height,color:"#646668",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:l.LINEEND_NORMAL,rightend:l.LINEEND_ARROW},v.append(new p(n)),s={x:0,y:10},r=function(t,e){return{points:[e],text:t,color:"#FFFFFF",horzAlign:"left",vertAlign:"middle",font:"Arial",offsetX:s.x,offsetY:s.y,bold:!1,italic:!1,fontsize:12,padding:5,highlightBorder:!1,backgroundColor:TradingView.generateColor("#5b85bf",10),backgroundTransparency:10,backgroundVertInflate:5,backgroundHorzInflate:5,backgroundRoundRect:4}},a=.5*(this._p1.x+this._p2.x),h=this._p2.y,c=new o.Point(a,h),d=r(this._label,c),f=new u(d,this._rendererCache),g=f.measure(),m={x:a+d.backgroundHorzInflate+g.textBgPadding-g.width/g.textBgPadding,y:this._p1.y>this._p2.y?c.y-g.height-2*g.textBgPadding-s.y>0?h-g.height-s.y+g.textBgPadding:s.y-2*g.textBgPadding:c.y+g.height+g.textBgPadding+s.y>y.height?y.height-g.height-s.y:h+g.textBgPadding},f.setPoints([new o.Point(m.x,m.y)]),v.append(f),v},r.prototype.update=function(){},r.prototype.renderer=function(){var t,e,i,o,n,s={},r=this.source.visible&&this.source.areLinesVisible,a=g.lockTimeAxis().value();return s.horzLinesVisible=r&&this._horzVisible,s.vertLinesVisible=r||a,t=this.pane._model.readOnly(),e=t?defaults("chartproperties.paneProperties.crossHairProperties"):null,i=TradingView.isMobile.any()&&l.isLineTool(this.source._model.currentTool()),o=i?"#a000a0":t?e.color:this.pane._model.properties().paneProperties.crossHairProperties.color.value(),n=t?e.transparency:this.pane._model.properties().paneProperties.crossHairProperties.transparency.value(),!i&&n>0&&(o=TradingView.generateColor(o,n)),s.color=o,s.lineWidth=t?e.width:this.pane._model.properties().paneProperties.crossHairProperties.width.value(),s.lineStyle=t?e.style:this.pane._model.properties().paneProperties.crossHairProperties.style.value(),s.drawCenter=i&&this.pane===this.source.pane,s.w=this.pane.width(),s.h=this.pane.height(),s.x=isFinite(this.source.lockedX)&&this.source.lockedX||this.source.x,s.y=this.source.y,new v(s)},a.prototype.update=function(){},a.prototype.renderer=function(){var t,e,i,o,n=this.source.visible&&this.source.areLinesVisible,s=g.lockTimeAxis().value(),r=n&&this._horzVisible,a=n||s;if(("y"!==this._axis||r)&&a)return t=9,e=11,i="y"===this._axis?this.pane.width()-t/2:this.source.lockedX+1,o="y"===this._axis?this.source.y:this.pane.height()-e/2-1,new y({x:i,y:o,width:t,height:e,bodyHeight:7})},t.exports=n}).call(e,i(28),i(21))},function(t,e,i){"use strict";function o(t,e){this._crossHair=t,this._model=e,this._rendererData={background:"#585858",color:"white",visible:!0},this._defaultFormatter=new a(100)}var n=i(76),s=i(75),r=i(82),a=r.PriceFormatter;inherit(o,s),o.prototype.update=function(){var t,e,i,o=this._rendererData,n=this._crossHair.pane;o.coordinate=this._crossHair.y,this.text="",n&&this._crossHair.visible&&(t=n.defaultPriceScale(),t.isEmpty()||(i=t.mainSource(),e=i?i.formatter():this._defaultFormatter,o.text=e.format(this._crossHair.price)))},o.prototype.renderer=function(){return this._renderer||(this._renderer=new n(this._rendererData)),this._renderer},t.exports=o},function(t,e,i){"use strict";function o(t,e){s.call(this),this._header=null,this._crossHair=t,this._model=e,this._items.push(new r("Date","")),this._items.push(new r("Time","")),this._items.push(new r("Price","")),this._defaultFormatter=new l(100)}var n=i(91),s=n.DataWindowView,r=n.DataWindowItem,a=i(82),l=a.PriceFormatter,h=a.DateFormatter,c=a.TimeFormatter;inherit(o,s),o.prototype.update=function(){var t,e,i,o,n,s,r=this._model.mainSeries().isDWM();this._items[1].setVisible(!r),this._items[0].setValue("n/a"),this._items[1].setValue("n/a"),this._items[2].setValue("n/a"),this._model.timeScale().isEmpty()||(t=this._crossHair.appliedIndex(),e=this._model.timeScale().indexToUserTime(t),null===e?(this._items[0].setValue("n/a"),r||this._items[1].setValue("n/a")):(this._items[0].setValue((new h).format(e)),r||this._items[1].setValue((new c).format(e))),i=this._crossHair.pane,i&&(o=i.defaultPriceScale(),o.isEmpty()||(n=o.mainSource(),s=n?n.formatter():this._defaultFormatter,this._items[2].setValue(s.format(this._crossHair.price)))))},t.exports=o},function(t,e,i){"use strict";function o(t,e){n.call(this),this._crosshair=t,this._model=e,this._rendererData={visible:!1,background:"#585858",color:"white",text:""}}var n=i(77),s=i(78),r=i(82).DateTimeFormatter;inherit(o,n),o.prototype.update=function(){var t,e=this._rendererData,i=this._model.timeScale();e.coordinate=this._crosshair.appliedX(),t=i.indexToUserTime(this._crosshair.appliedIndex()),t?(e.visible=!0,e.text=new r(this._model.mainSeries().isDWM()).format(t)):(e.visible=!1,e.text="")},o.prototype.renderer=function(){var t=this._rendererData;return this._renderer||(this._renderer=new s(t)),this._renderer},t.exports=o},function(t,e){"use strict";function i(t){function e(t,e){var i=t.font;return n.hasOwnProperty(i)||(n[i]={}),n[i].hasOwnProperty(e)||(n[i][e]=t.measureText(e).width),n[i][e]}function i(){var i=o.width(),n=o.height();return{draw:function(o){var r,a,l,h,c,d,p,u=t.symbolInfo();if(u){for(o.fillStyle=TradingView.generateColor(s.color.value(),s.transparency.value()),r=u.name,/QUANDL/.test(u.exchange)&&(a=r.split(/\//),a.length&&(r=a[a.length-1])),l=[{text:r?r+", "+TradingView.translatedIntervalString(t.interval()):"",font:"96px Verdana, Arial, sans-serif",lineHeight:114,baselineOffset:87},{text:u.description||"",font:"48px Verdana, Arial, sans-serif",lineHeight:57,baselineOffset:43.5}],h=0,c=0;c<l.length;c++)d=l[c],d.text&&(o.font=d.font,p=e(o,d.text),p>i?(d.zoom=i/p,p=i):d.zoom=1,d.offsetLeft=(i-p)/2,h+=d.lineHeight*d.zoom);for(h=Math.max((n-h)/2,0),c=0;c<l.length;c++)d=l[c],d.text&&(o.save(),o.font=d.font,o.translate(d.offsetLeft,h),o.scale(d.zoom,d.zoom),o.fillText(d.text,0,d.baselineOffset),o.restore(),h+=d.lineHeight*d.zoom)}}}}var o=null,n={},s=t.model().properties().symbolWatermarkProperties,r={renderer:i,update:function(){}};this.paneViews=function(t){return t.containsMainSeries()?(o=t,[r]):[]}}t.exports=i},function(t,e){"use strict";function i(){this.visible=!0,this.horzLinesVisible=!0,this.horzLinesColor="white",this.horzLinesStyle="",this.vertLinesVisible=!0,this.vertLinesColor="white",this.vertLinesStyle=""}function o(t,e){this.source=t,this.pane=e}function n(t){this.data=t}i.prototype.paneViews=function(t){return[new o(this,t)]},o.prototype.update=function(){},o.prototype.renderer=function(){var t={};return this.pane.defaultPriceScale().isEmpty()||this.pane.timeScale().isEmpty()?null:(t.horzLinesVisible=!0,t.vertLinesVisible=!0,t.horzLinesColor=this.pane._model.properties().paneProperties.horzGridProperties.color.value(),t.vertLinesColor=this.pane._model.properties().paneProperties.vertGridProperties.color.value(),t.horzLineStyle=this.pane._model.properties().paneProperties.horzGridProperties.style.value(),t.vertLineStyle=this.pane._model.properties().paneProperties.vertGridProperties.style.value(),t.priceMarks=this.pane.defaultPriceScale().marks(),t.timeMarks=this.pane.timeScale().marks(),t.w=this.pane.width(),t.h=this.pane.height(),new n(t))},n.prototype.draw=function(t){var e;if(t.lineWidth=1,this.data.vertLinesVisible){for(t.strokeStyle=this.data.vertLinesColor,CanvasEx.setLineStyle(t,this.data.vertLineStyle),t.beginPath(),e=0;e<this.data.timeMarks.length;e++)t.moveTo(this.data.timeMarks[e].coord+1,0),t.lineTo(this.data.timeMarks[e].coord+1,this.data.h);t.stroke()}if(this.data.horzLinesVisible){for(t.strokeStyle=this.data.horzLinesColor,CanvasEx.setLineStyle(t,this.data.horzLineStyle),t.beginPath(),e=0;e<this.data.priceMarks.length;e++)t.moveTo(0,this.data.priceMarks[e].coord),t.lineTo(this.data.w,this.data.priceMarks[e].coord);t.stroke()}},t.exports=i},function(t,e,i){"use strict";function o(t,e,i){this._magnetProperty=t,this._timeScale=e}var n=i(84);o.prototype.align=function(t,e,i){var o,s,r,a,l,h,c,d,p,u=50,_=i.defaultPriceScale(),f=_.priceToCoordinate(t),g=t;if(!this._magnetProperty.value())return g;for(o=_.dataSources(),s=null,r=0;r<o.length;r++)if(o[r]instanceof n){s=o[r];break}if(s&&(a=s.bars(),a.contains(e)&&(l=a.valueAt(e),h=[l[TradingView.OPEN_PLOT],l[TradingView.HIGH_PLOT],l[TradingView.LOW_PLOT],l[TradingView.CLOSE_PLOT]],_=s.priceScale(),!_.isEmpty()))){if(c=[],_.isPercent())for(d=s.firstValue(),r=0;r<h.length;r++)h[r]=_.priceRange().convertToPercent(h[r],d);for(r=0;r<h.length;r++)c.push({y:_.priceToCoordinate(h[r]),price:h[r]});c.sort(function(t,e){var i=Math.abs(t.y-f),o=Math.abs(e.y-f);return i-o}),p=c[0],Math.abs(p.y-f)<u&&(g=p.price)}return g},t.exports=o},function(t,e,i){(function(e,o){"use strict";function n(){return[$.t("Jan"),$.t("Feb"),$.t("Mar"),$.t("Apr"),$.t("May"),$.t("Jun"),$.t("Jul"),$.t("Aug"),$.t("Sep"),$.t("Oct"),$.t("Nov"),$.t("Dec")]}function s(t){this._model=t,this._properties=t.properties().timeScale,this._scalesProperties=t.properties().scalesProperties,this.m_width=0,this._defaultRightOffset=this._properties.rightOffset.value(),this.m_rightOffset=this._properties.rightOffset.value(),this.m_points=new p,this.m_barSpacing=this._properties.barSpacing.value(),this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.m_tickmarks=new l,this._locked=!1,this._formattedBySpan={}}var r=i(100),a=i(119),l=i(232),h=i(113),c=i(80).saveDefaultProperties,d=i(82).numberToStringWithLeadingZero,p=i(233);TradingView.MONTH_NAMES=null,TradingView.MINUTE_SPAN=20,TradingView.HOUR_SPAN=30,TradingView.DAY_SPAN=40,TradingView.WEEK_SPAN=50,TradingView.MONTH_SPAN=60,TradingView.YEAR_SPAN=70,TradingView.DEFAULT_BAR_SPACING=6,TradingView.MAX_BAR_SPACING=50,TradingView.MIN_BAR_SPACING=.5,TradingView.DEFAULT_RIGHT_OFFSET=5,s.prototype.tickMarks=function(){return this.m_tickmarks},s.prototype.reset=function(){this._visibleBarsCache=null,this.m_points=new p,this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.m_tickmarks.reset()},s.prototype.restoreDefault=function(){this._visibleBarsCache=null,this.m_barSpacing=TradingView.DEFAULT_BAR_SPACING,this.m_rightOffset=this._properties.rightOffset.value(),this.saveDefault("barSpacing"),this._correctOffset(),this.recalcLockedScale()},s.prototype.rightOffset=function(){return this.m_rightOffset},s.prototype.scrollToRealtime=function(t){var e,i,o,n,s=this._properties.rightOffset.value();return t?(e=this,i=this.m_rightOffset,o=this.m_width/this.m_barSpacing-10,o>0&&s>o&&(s=o),n=this._model,void $({offset:i}).animate({offset:s},{duration:1e3,easing:"easeInOutQuint",step:function(t){e._visibleBarsCache=null,e.m_rightOffset=t,n.recalculateAllPanes(),n.invalidate(new h(h.LIGHT_UPDATE)),n.recalcVisibleRangeStudy(n.dataSources())}})):(this._visibleBarsCache=null,this.m_rightOffset=s,void this._correctOffset())},s.prototype.points=function(){return this.m_points},s.prototype.width=function(){return this.m_width},s.prototype.barSpacing=function(){return this.m_barSpacing},s.prototype.setWidth=function(t){this._visibleBarsCache=null,!isFinite(t)||t<=0||(this._locked&&this.m_width&&(this.m_barSpacing*=t/this.m_width),this.m_width=t,this._correctOffset())},s.prototype.visibleBars=function(){var t,e,i,o;if(this._visibleBarsCache)return this._visibleBarsCache;if(!this.isEmpty())return t=Math.ceil(this.m_width/this.m_barSpacing)-1,e=Math.round(this.m_rightOffset+this.m_points.lastTimePointIndex()),i=e-t,o=new r(i,e),this._visibleBarsCache=o,o},s.prototype.isEmpty=function(){return 0===this.m_width||0===this.m_points.size()},s.prototype.indexToCoordinate=function(t,e){var i,o;return this.isEmpty()?0:TradingView.isInteger(t)?(i=this.m_points.lastTimePointIndex()+this.m_rightOffset-t,o=this.m_width-(i+.5)*this.m_barSpacing,e?o:Math.round(o)):0},s.prototype.barIndexesToCoordinates=function(t){var e,i,o,n;for(e=0;e<t.length;e++)i=t[e].time,o=this.m_points.lastTimePointIndex()+this.m_rightOffset-i,n=this.m_width-(o+.5)*this.m_barSpacing,t[e].time=Math.round(n),t[e].exactTime=n},s.prototype.indexesToCoordinates=function(t){var e,i,o,n=this.m_points.lastTimePointIndex()+this.m_rightOffset,s=this.m_width-n*this.m_barSpacing-.5*this.m_barSpacing;for(e=0;e<t.length;e++)i=t[e].x,o=s+i*this.m_barSpacing,t[e].x=Math.round(o)},s.prototype.coordinateToIndex=function(t){var e=(this.m_width+1-t)/this.m_barSpacing,i=this.m_points.lastTimePointIndex(),o=i+this.m_rightOffset-e,n=Math.round(1e6*o)/1e6;return Math.ceil(n)},s.prototype.timeToCoordinate=function(t){function e(t){return t<=0||t>=l.m_width}var i,o,n,s=this.m_points.closestIndexLeft(t),r=this.m_points.valueAt(s),a=this.indexToCoordinate(s,!0),l=this;return e(a)?null:(i=this.barSpacing(),o=function(){var t=this.m_points.lastTimePointIndex();return this.m_points.valueAt(t)-this.m_points.valueAt(t-1)}.bind(this)(),n=Math.round(a+(t-r)/o*i)+1,e(n)?null:n)},s.prototype.alignCoordinate=function(t){if(this.isEmpty())return t;var e=this.coordinateToIndex(t);return this.indexToCoordinate(e)},s.prototype.timePointToIndex=function(t){return this.m_points.indexOf(t,!0)},s.prototype.indexToTimePoint=function(t){var e=this.m_points.valueAt(t);return e?new Date(1e3*e):null},s.prototype.indexToUserTime=function(t){return this.m_tickmarks.indexToTime(t)},s.prototype.marks=function(){var t,e,i,o,n,s,r,a,l,h,c,d;if(this.isEmpty())return null;for(t=this.m_barSpacing,e=this._scalesProperties.fontSize.value()||0,i=5*(e+4),o=Math.round(i/t),n=this.visibleBars(),s=Math.max(n.firstBar(),n.firstBar()-o),r=Math.max(n.lastBar(),n.lastBar()-o),a=this.m_tickmarks.build(t,i),l=[],h=0;h<a.length;++h)c=a[h],s<=c.index&&c.index<=r&&(d=this.m_tickmarks.indexToTime(c.index),null!==d&&l.push({coord:this.indexToCoordinate(c.index),label:this.formatLabel(d,c.span),span:c.span,major:c.label>=TradingView.DAY_SPAN?1:0}));return l},s.prototype.state=function(t){var e={};return e.m_barSpacing=this.barSpacing(),e.m_rightOffset=this.m_rightOffset,t&&(this.m_points.size()>0&&(e.m_lastVisibleBar=this.m_points.valueAt(this.m_points.lastTimePointIndex())),e.points=this.m_points.state(),e.tickmarks=this.m_tickmarks.state(),e.width=this.m_width),e},s.prototype.restoreState=function(t,e,i){var o,n,s;return this._visibleBarsCache=null,void 0===t.m_barSpacing?void TradingView.logDebugChart("TimeScale.restoreState: invalid state"):void 0===t.m_rightOffset?void TradingView.logDebugChart("TimeScale.restoreState: invalid state"):(this.m_barSpacing=t.m_barSpacing,this.m_rightOffset=t.m_rightOffset,this.m_restoredLastTimePoint=t.m_lastVisibleBar,i&&this.m_restoredLastTimePoint&&(o=this.m_points.indexOf(this.m_restoredLastTimePoint),n=this.m_points.lastTimePointIndex(),s=n-o,this.m_rightOffset=-s+t.m_rightOffset),e&&(this.m_points.restoreState(t.points),this.m_tickmarks.restoreState(t.tickmarks),t.width&&(this._locked=!0,this.m_width>0&&(this.m_barSpacing*=this.m_width/t.width))),void this._correctOffset())},s.prototype.setOffset=function(t){return this._visibleBarsCache=null,void 0===t?void TradingView.logDebugChart("TimeScale.setOffset: invalid state"):(this.m_rightOffset=t,void this._correctOffset())},s.prototype.setBarSpacing=function(t){return this._visibleBarsCache=null,void 0===t?void TradingView.logDebugChart("TimeScale.setBarSpacing: invalid state"):void(this.m_barSpacing=t);
},s.prototype._correctOffset=function(){if(!this.isEmpty()){var t=this.m_width/this.m_barSpacing-10;t>0&&this.m_rightOffset>t&&(this.m_rightOffset=t,this._visibleBarsCache=null),t=this.m_points.size()-10,this.m_rightOffset<-t&&(this.m_rightOffset=-t,this._visibleBarsCache=null)}},s.prototype.maxOffset=function(){return this.m_width/this.m_barSpacing-10},s.prototype.startScale=function(t){this.m_scrollStartPoint&&this.endScroll(),null===this.m_scaleStartPoint&&null===this.m_stateSnapshot&&(this.isEmpty()||(this.m_scaleStartPoint=t,this.m_stateSnapshot=this.state()))},s.prototype.scaleTo=function(t){var i,o;this._visibleBarsCache=null,delete this.m_restoredLastTimePoint,null!==this.m_stateSnapshot&&(i=e.clamp(this.m_width-t,0,this.m_width),o=e.clamp(this.m_width-this.m_scaleStartPoint,0,this.m_width),0!==i&&0!==o&&(this.m_barSpacing=this.m_stateSnapshot.m_barSpacing*i/o,this.m_barSpacing<TradingView.MIN_BAR_SPACING?this.m_barSpacing=TradingView.MIN_BAR_SPACING:this.m_barSpacing>TradingView.MAX_BAR_SPACING&&(this.m_barSpacing=TradingView.MAX_BAR_SPACING),this._correctOffset(),this.recalcLockedScale()))},s.prototype.endScale=function(){null!==this.m_scaleStartPoint&&(this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.saveDefault("barSpacing"))},s.prototype.saveDefault=function(t){c(!0),this._properties[t].setValue(this["m_"+t]),c(!1)},s.prototype.startScroll=function(t){null===this.m_scrollStartPoint&&null===this.m_stateSnapshot&&(this.isEmpty()||(this.m_scrollStartPoint=t,this.m_stateSnapshot=this.state()))},s.prototype.scrollTo=function(t){if(this._visibleBarsCache=null,delete this.m_restoredLastTimePoint,null!==this.m_scrollStartPoint){var e=(this.m_scrollStartPoint-t)/this.barSpacing();this.m_rightOffset=this.m_stateSnapshot.m_rightOffset+e,this._correctOffset(),this._model.mainSeries().priceScale().properties().percentage.value()&&this.recalcLockedScale()}},s.prototype.scrollToOffsetAnimated=function(t,e){var i,o,n,s;if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(void 0===e&&(e=400),!isFinite(e)||e<=0)throw new RangeError("animationDuration (optional) must be finite positive number");i=this,o=this.m_rightOffset,n=+new Date,s=this._model,function r(){i._visibleBarsCache=null;var a=(new Date-n)/e;return a>=1?(i.m_rightOffset=t,i._visibleBarsCache=null,s.recalculateAllPanes(),void s.invalidate(new h(h.LIGHT_UPDATE))):(i.m_rightOffset=o+(t-o)*a,s.recalculateAllPanes(),void setTimeout(r,20))}()},s.prototype.endScroll=function(){null!==this.m_scrollStartPoint&&(this.m_scrollStartPoint=null,this.m_stateSnapshot=null)},s.prototype._currentSavedPosition=function(){var t,e,i;this.isEmpty()||(t=this.m_points.indexOf(this.m_restoredLastTimePoint,!0),TradingView.isInteger(t)&&(e=this.m_points.lastTimePointIndex(),i=e-t,this.m_rightOffset-=i),delete this.m_restoredLastTimePoint)},s.prototype.update=function(t,e,i,o){this._visibleBarsCache=null,this.m_tickmarks.merge(o),this.m_points.merge(t,e,i),this.m_restoredLastTimePoint&&this._currentSavedPosition()},s.prototype.addTail=function(t,e,i){var o,n,s;for(this.m_tickmarks.removeTail(e),o=t.params,n=this.m_tickmarks.maxIndex+(i?0:1),s=0;s<o.marks.length;s++)o.marks[s].index=n+s;this.m_tickmarks.addTail(o.marks),this.m_points.addTail(o.changes,i),this.m_rightOffset-=o.changes.length},s.prototype.formatLabel=function(t,e){if(this._formattedBySpan[e])return this._formattedBySpan[e].format(t.valueOf());var i=this;return this._formattedBySpan[e]=new a(function(t){return i.formatLabelImpl(new Date(t),e)}),this._formattedBySpan[e].format(t)},s.prototype.formatLabelImpl=function(t,e){if(!(t&&t instanceof Date))return"incorrect time";var i=this._model.mainSeries().isDWM();return e<TradingView.MINUTE_SPAN&&!i?d(t.getUTCHours(),2)+":"+d(t.getUTCMinutes(),2)+":"+d(t.getUTCSeconds(),2):e<TradingView.DAY_SPAN&&!i?d(t.getUTCHours(),2)+":"+d(t.getUTCMinutes(),2):e<TradingView.WEEK_SPAN?t.getUTCDate():e<TradingView.MONTH_SPAN?t.getUTCDate():e<TradingView.YEAR_SPAN?(TradingView.MONTH_NAMES||(TradingView.MONTH_NAMES=n()),TradingView.MONTH_NAMES[t.getUTCMonth()]):t.getUTCFullYear()},s.prototype.normalizeBarIndex=function(t){var e=0,i=0;return t<this.m_points.firstTimePointIndex()?(e=this.m_points.valueAt(this.m_points.firstTimePointIndex()),i=t-this.m_points.firstTimePointIndex()):t>this.m_points.lastTimePointIndex()?(e=this.m_points.valueAt(this.m_points.lastTimePointIndex()),i=t-this.m_points.lastTimePointIndex()):(e=this.m_points.valueAt(t),i=0),{time_t:e,offset:i}},s.prototype.denormalizeTimePoint=function(t){var e=this.m_points.indexOf(t.time_t);if(void 0!==e)return e+t.offset},s.prototype.zoomToBarsRange=function(t,e){if(!(e<=t)){var i=this.m_points.lastTimePointIndex();i&&(this.m_rightOffset=e-i),this.m_barSpacing=this.width()/(e-t+1),this._visibleBarsCache=null}},s.prototype.recalcLockedScale=function(){var t,e,i,n,s,r,a,l;this._model.m_mainSeries.properties().lockScale.value()&&!this.isEmpty()&&(t=this._model.m_mainSeries.priceScale(),e=this._model.m_mainSeries,i=e.data().boxSize,i||(e.fixBoxSize(),i=e.data().boxSize),i&&(t.properties().percentage.value()&&(n=e.data().search(e.getRealVisibleRange().m_firstBar).value[TradingView.CLOSE_PLOT],i=o.prototype.convertToPercent.call(null,n+i,n)-o.prototype.convertToPercent.call(null,n,n)),s=t.internalHeight()/(this.barSpacing()/i),r=e.priceScale().priceRange(),r&&s===r.length()||(!r||r.isEmpty()?(a=this.visibleBars(),r=e.priceRange(a.firstBar(),a.lastBar())):(l=(s-r.length())/2,r.m_minValue-=l,r.m_maxValue+=l),e.priceScale().setPriceRange(r))))},s.prototype.correctBarSpacing=function(){this.isEmpty()||this.points().size()<this.width()/this.barSpacing()&&(this.setOffset(TradingView.DEFAULT_RIGHT_OFFSET),this.setBarSpacing(Math.min(this.width()/(this.points().size()+this.rightOffset()),TradingView.MAX_BAR_SPACING)))},s.prototype.canZoomIn=function(){return this.m_barSpacing<TradingView.MAX_BAR_SPACING},s.prototype.canZoomOut=function(){return this.m_barSpacing>TradingView.MIN_BAR_SPACING},t.exports=s}).call(e,i(21),i(85))},function(t,e,i){(function(e){"use strict";function i(){this._marksByIndex={},this._marksBySpan=[],this.changed=new e}i.prototype.reset=function(){this._marksByIndex={},this._marksBySpan=[],delete this.minIndex,delete this.maxIndex,delete this._cache,this.changed.fire()},i.prototype.minIndex=void 0,i.prototype.maxIndex=void 0,i.prototype.merge=function(t){var e,i,o,n,s,r=this._marksBySpan,a={};for(e=0;e<t.length;e++){if(i=t[e],o=i.index,n=i.span,s=this._marksByIndex[i.index]){if(s.index===i.index&&s.span===i.span){s.time=i.time;continue}this._removeTickmark(s)}this._marksByIndex[o]=i,this.minIndex<=o||(this.minIndex=o),this.maxIndex>=o||(this.maxIndex=o),r[n]||(r[n]=[]),r[n].push(i),a[n]=!0}for(n=r.length;n--;)r[n]&&(r[n].length||delete r[n],a[n]&&r[n].sort(this._sortByIndexAsc));delete this._cache,this.changed.fire()},i.prototype._removeTickmark=function(t){var e,i,o=t.index;this._marksByIndex[o]===t&&(delete this._marksByIndex[o],o<=this.minIndex&&this.minIndex++,o>=this.maxIndex&&this.maxIndex--,this.maxIndex<this.minIndex&&(delete this.minIndex,delete this.maxIndex),e=this._marksBySpan[t.span],i=e.indexOf(t),i!==-1&&e.splice(i,1))},i.prototype._sortByIndexAsc=function(t,e){return t.index-e.index},i.prototype.removeTail=function(t){var e,i={};this.maxIndex=0;for(e in this._marksByIndex)this._marksByIndex[e].time<t&&(i[e]=this._marksByIndex[e],this.maxIndex=Math.max(this.maxIndex,e));this._marksByIndex=i},i.prototype.addTail=function(t){for(var e=0;e<t.length;e++)t[e].index=this.maxIndex+e+1;this.merge(t)},i.prototype.indexToTime=function(t){var e=this._marksByIndex[t];return e?new Date(1e3*e.time):null},i.prototype.density=function(){var t,e,i=this.maxIndex-this.minIndex;if(0!==i)return t=this._marksByIndex[this.maxIndex].time-this._marksByIndex[this.minIndex].time,e=1e3*t/i},i.prototype.estimateLeft=function(t){var e,i,o=this.density();if(o)return e=1e3*this._marksByIndex[this.minIndex].time-t,i=e/o},i.prototype.nearestIndex=function(t){for(var e,i=this.minIndex,o=this.maxIndex;o-i>2;){if(1e3*this._marksByIndex[i].time===t)return i;if(1e3*this._marksByIndex[o].time===t)return o;e=Math.round((i+o)/2),1e3*this._marksByIndex[e].time>t?o=e:i=e}return i},i.prototype.build=function(t,e){var i,o,n,s,r,a,l,h,c,d,p,u,_,f,g=Math.ceil(e/t);if(this._maxbar===g&&this._cache)return this._cache;for(this._maxbar=g,i=[],o=this._marksBySpan.length;o--;)if(this._marksBySpan[o]){for(n=i,i=[],s=n.length,r=0,a=this._marksBySpan[o],l=a.length,h=1/0,c=-(1/0),d=0;d<l;d++){for(p=a[d],u=p.index;r<s;){if(_=n[r],f=_.index,!(f<u)){h=f;break}r++,i.push(_),c=f,h=1/0}h-u>=g&&u-c>=g&&(i.push(p),c=u)}for(;r<s;r++)i.push(n[r])}return this._cache=i,this._cache},i.prototype.state=function(){var t,e=[];for(t=this._marksBySpan.length;t--;)this._marksBySpan[t]&&(e=e.concat(this._marksBySpan[t]));return e=e.map(function(t){return[t.span,t.time,t.index]}),{marks:e,version:2}},i.prototype.restoreState=function(t){if(this._marksByIndex={},this._marksBySpan=[],delete this.maxIndex,delete this.minIndex,t&&t.marks&&t.marks.length)if(2===t.version){var e=t.marks.map(function(t){return{span:t[0],time:t[1],index:t[2]}});this.merge(e)}else this.merge(t.marks)},t.exports=i}).call(e,i(28))},function(t,e){"use strict";function i(){this._zoffset=0,this._items=[],this._lastTimePointIndex=null}i.prototype.clear=function(){this._zoffset=0,this._items=[],this._lastTimePointIndex=null},i.prototype.items=function(){return this._items},i.prototype.size=function(){return this._items.length},i.prototype.firstTimePointIndex=function(){return this.offsetToIndex(0)},i.prototype.lastTimePointIndex=function(){return null!==this._lastTimePointIndex&&void 0!==this._lastTimePointIndex?this._lastTimePointIndex:(this._lastTimePointIndex=this.offsetToIndex(this.size()-1),this._lastTimePointIndex)},i.prototype.merge=function(t,e,i){var o,n,s,r,a,l,h;if(0===this._items.length)return this._items=i,this._zoffset=e,[{change:"rebuild",index:0}];if(o=t+this._zoffset,o<0){for(n=Math.abs(o),this._items=Array(n).concat(this._items),this._zoffset=e,s=0;s<i.length;++s)this._items[t+s+e]=i[s];return[{change:"rebuild",index:0}]}for(r=[],s=o;s<this._items.length&&s-o<i.length;++s)this._items[s]=i[s-o],r.push({change:"update",index:s-this._zoffset,value:i[s-o]});if(a=o+i.length,a>this._items.length)for(n=a-this._items.length,l=s;l<s+n;++l)h=this._items.length,this._items.push(i[l-o]),r.push({change:"append",index:h-this._zoffset,value:i[l-o]});return this._zoffset=e,this._lastTimePointIndex=null,r},i.prototype.addTail=function(t,e){for(var i=e?1:0;i<t.length;i++)this._items.push(t[i]),this._lastTimePointIndex++},i.prototype.valueAt=function(t){var e=this.indexToOffset(t);if(void 0!==e)return this._items[e]},i.prototype.indexOf=function(t,e){if(e&&t>this._items[this._items.length-1])return this.offsetToIndex(this._items.length-1);for(var i=0;i<this._items.length&&!(t<this._items[i]);++i)if(!(t>this._items[i]))return this.offsetToIndex(i);return e?this.offsetToIndex(i):void 0},i.prototype.offsetToIndex=function(t){if(0<=t&&t<this.size())return t-this._zoffset},i.prototype.indexToOffset=function(t){var e=t+this._zoffset;if(0<=e&&e<this.size())return e},i.prototype.state=function(){var t={};return t.zoffset=this._zoffset,t.items=this._items,t},i.prototype.restoreState=function(t){t&&(this._zoffset=t.zoffset,this._items=t.items,this._lastTimePointIndex=null)},i.prototype.roughTime=function(t,e){var i,o,n,s,r,a,l,h,c,d=this.valueAt(t);if(void 0===d){if(i=this._items,!i.length||i.length<2)return;if(o=this.firstTimePointIndex(),n=this.lastTimePointIndex(),s=this.valueAt(o),r=this.valueAt(n),a=(r-s)/(n-o),t<o)return l=o-t,h=l*a,d=s-h;if(c=500,t>n)return l=t-n,l<c&&e?e(r,l):(h=l*a,d=r+h)}return d},i.prototype.roughIndex=function(t,e){var i,o,n,s,r,a,l,h,c,d,p=this._items;if(p.length&&!(p.length<2))return i=this.firstTimePointIndex(),o=this.lastTimePointIndex(),n=this.valueAt(i),s=this.valueAt(o),t>=n&&t<=s?this.closestIndexLeft(t):(r=(s-n)/(o-i),t<n?(a=n-t,l=Math.round(a/r),h=i-l):(c=500,t>s?(a=t-s,l=Math.trunc(a/r),l<c&&e&&(d=e(s,t),d.success&&(l=d.result)),h=o+l):void 0))},i.prototype.closestIndexLeft=function(t){var e,i,o,n,s,r,a=this._items;if(a.length&&t===t){if(e=a.length-1,i=a[e],t>=i)return e-this._zoffset;if(o=0,n=a[o],!(t<n)){if(t===n)return o-this._zoffset;for(;e>o+1;)if(s=o+e>>1,r=a[s],r>t)e=s;else{if(!(r<t))return r===t?s-this._zoffset:void 0;o=s}return o-this._zoffset}}},t.exports=i},function(t,e,i){(function(e){"use strict";function o(t){r.call(this,t);var e=this;a.hideMarksOnBars().subscribe(this,function(){e._properties.visible.setValue(!a.hideMarksOnBars().value())}),this._paneView=new n(this)}function n(t,e){this.source=t,this._rendererFactory=e,this.stylesCache={},this.templatesCache={},this._createLollipops()}var s=i(235).ESDPaneView,r=i(236).BarsMarksContainer,a=i(81),l=i(38);inherit(o,r),o.prototype._initialize=function(t){this._properties.visible.setValue(!0)},o.prototype.userEditEnabled=function(){return!1},o.prototype._constructor="UserDefinedTimescaleMarks",o.prototype._plateViewData=function(t){return{text:t.text}},o.prototype.onClicked=function(){var t=this._model.lastHittestData().id;l.emit("onTimescaleMarkClick",t)},o.prototype.clearMarks=function(){r.prototype.clearMarks.call(this),this.onNeedRepaint.fire()},o.prototype._getData=function(t){var e,i,o,n=this._model.mainSeries().symbolInfo();n&&(e=this.roundRange(this._rangeDifference(t)),i=this,o=this._model.mainSeries().properties().interval.value(),ChartApiInstance.getTimescaleMarks(n,e.start,e.end,function(e){e.forEach(function(t){i._marks[t.id]=t},i),i._loadedRange=i._rangeUnion(t,i._loadedRange),i.onNeedRepaint.fire()},o))},o.prototype.updatePlateData=function(t,e){return e.barWidth=this.barWidth(),e.text=t.text,e.tooltipMargin=Math.max(t.minSize/2,.4*this.barWidth())*-1,e},o.prototype.hasContextMenu=function(){return!1},o.prototype.paneViews=function(t){return this._properties.visible.value()?[this._paneView]:[]},inherit(n,s),n.prototype._createLollipops=function(){var t,i,o,n;this.lollipops=[],t=this.source._model.timeScale(),i=s.prototype._getY.call(this.source),o=this.source._model.lastHittestData(),n=this,$.each(this.source._marks,function(s,r){var a={id:r.id,basePoint:new e.Point(t.indexToCoordinate(t.timePointToIndex(r.tickmark))+1,i),hovered:o&&o.id===r.id,barY:null,label:r.label,color:r.color,tooltip:r.tooltip};n.lollipops.push(a)})},n.prototype.update=function(){this._createLollipops()},n.prototype.renderer=function(){return this.update(),s.prototype.renderer.call(this)},n.prototype._generateTemplateStyle=function(t,e,i){var o,n,s=t+e+i;return s in this.stylesCache||(o={strokeStyle:e,lineWidth:1,fillStyle:"white",barLine:{lineStyle:CanvasEx.LINESTYLE_DASHED},lollipop:{width:32,height:64,circleHeight:35,radius:11,lineWidth:2,fillStyle:"white",strokeStyle:"#E2745B",text:{label:i,strokeStyle:e,font:"normal 12px Verdana, Arial, sans-serif"}}},n={lollipop:{fillStyle:e,text:{strokeStyle:"white"}}},this.stylesCache[s]="default"===t?o:$.extend(!0,{},o,n)),this.stylesCache[s]},n.prototype.getTemplate=function(t,e){var i=t+e.color+e.label;return i in this.templatesCache||(this.templatesCache[i]=this.createTemplate(this._generateTemplateStyle(t,e.color,e.label))),this.templatesCache[i]},n.prototype.getStyle=function(t,e){return this._generateTemplateStyle(t,e.color,e.label)},n.prototype.createText=function(t,e){t.tooltip.forEach(function(t){e.addTextLine(t)})},n.prototype.hasTooltip=function(t){return!!t.tooltip&&t.tooltip.length},t.exports=o}).call(e,i(21))},function(t,e,i){(function(t){"use strict";function o(t,e){this._model=t,this._study=e,this._metaInfo=e.metaInfo(),this.lollipops=[],this._textCache={},this.templatesCache={},this._invalidated=!0,this.templatesCache.hovered=this.createTemplate(this.hoveredStyle),this.templatesCache.default=this.createTemplate(this.defaultStyle)}function n(t){this.data=t}function s(t){this.data=t,this._hittest=new a(a.REGULAR,t)}function r(t){this._data=t,this.textRenderer=new r.TextRenderer}var a=i(94),l=i(98);o.prototype._setStackStudies=function(){this._stackStudies=[]},o.prototype._getY=function(){var t,e,i=0,o=this._model.panes();for(t=o.length;t--;)e=o[t],e.containsMainSeries()&&(i+=e.height());return i},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){var t,e,i,o,n,s,r,a,l,h;this._setStackStudies(),this.lollipops=[],t=this,e=this._study.data(),i=this._model.timeScale(),o=i.visibleBars(),n=this._model.mainSeries().bars(),s=this._study.priceScale(),r=this._model.mainSeries(),a=r.firstBar(),s&&!s.isEmpty()&&!i.isEmpty()&&a&&e&&(l=this._getY(),h=e.range(o.firstBar(),o.lastBar()),h.each(function(e,o){var r,a=0;for(r=0;r<t._stackStudies.length;++r)t._stackStudies[r].data().contains(e)&&++a;t.addLollipop(l,n,i,s,e,o,a)}),this.afterUpdate(l,n,i,s))},o.prototype.addLollipop=function(e,i,o,n,s,r,a){var l,h,c,d,p=r[0],u=null,_=this._study.metaInfo().id+"_"+p,f=this._model.lastHittestData(),g=f&&f.id===_;g&&(l=i.valueAt(s),l&&(h=l[TradingView.LOW_PLOT],n.isPercent()&&(c=this._model.mainSeries().firstValue(),h=n.priceRange().convertToPercent(h,c)),u=n.priceToCoordinate(h))),d=$.extend({id:_,basePoint:new t.Point(o.indexToCoordinate(s)+1,e),hovered:g,barY:u,stack:a},this.extraData(r)),this.lollipops.push(d)},o.prototype.afterUpdate=function(t,e,i){},o.prototype.extraData=function(t){throw Error("Not Implemented")},o.prototype.createText=function(t,e){throw Error("Not Implemented")},o.prototype.showBarLine=function(){return!0},o.prototype.getStyle=function(t,e){var i,o=t;return e.stack&&(o+="_stack:"+e.stack),"hovered"===o?this.hoveredStyle:"default"===o?this.defaultStyle:(this._stylesCache||(this._stylesCache={}),this._stylesCache[o]||(i=TradingView.clone("hovered"===t?this.hoveredStyle:this.defaultStyle),e.stack&&(i.lollipop.incHeight=24*e.stack),this._stylesCache[o]=i),this._stylesCache[o])},o.prototype.hasTooltip=function(t){return!0},o.prototype.renderer=function(){var e,i,o,a,h,c,d,p,u;for(this._invalidated&&(this.updateImpl(),this._invalidated=!1),e=new l,i=0;i<this.lollipops.length;i++)o=this.lollipops[i],a=15,h=this.getStyle(o.hovered?"hovered":"default",o),o.hovered&&this.hasTooltip(o)&&(o.barY&&this.showBarLine()&&(c={style:{lineStyle:h.barLine.lineStyle,strokeStyle:h.strokeStyle,lineWidth:h.lineWidth},startPoint:new t.Point(o.basePoint.x,o.basePoint.y-h.lollipop.circleHeight),endPoint:new t.Point(o.basePoint.x,o.barY)},e.append(new n(c))),d=$.extend({tooltipPoint:new t.Point(o.basePoint.x,o.basePoint.y-h.lollipop.circleHeight-a-(h.lollipop.incHeight||0)),style:h,createText:this.createText},o),e.append(new r(d))),p=this.getTemplate(o.hovered?"hovered":"default",o),u={circlePoint:new t.Point(o.basePoint.x,o.basePoint.y-h.lollipop.circleHeight-(h.lollipop.incHeight||0)),style:h,template:p,basePoint:o.basePoint,id:o.id},e.append(new s(u));return e},o.prototype.getTemplate=function(t,e){var i=t;return e.stack&&(i+="_stack:"+e.stack),this.templatesCache[i]||(this.templatesCache[i]=this.createTemplate(this.getStyle(t,e))),this.templatesCache[i]},o.prototype.createTemplate=function(e){var i=document.createElement("canvas"),o=i.getContext("2d"),n=new t.Point(e.lollipop.width/2,e.lollipop.height),s=new t.Point(e.lollipop.width/2,e.lollipop.height-e.lollipop.circleHeight-(e.lollipop.incHeight||0));return this.drawStick(o,e,n,s),this.drawCircle(o,e,s),this.drawLabel(o,e,s),i},o.prototype.drawCircle=function(t,e,i){t.fillStyle=e.lollipop.fillStyle,t.lineWidth=e.lollipop.lineWidth,CanvasEx.setLineStyle(t,CanvasEx.LINESTYLE_SOLID),t.beginPath(),t.arc(i.x,i.y,e.lollipop.radius,0,2*Math.PI,!1),t.closePath(),t.stroke(),t.fill()},o.prototype.drawLabel=function(t,e,i){t.textAlign="center",t.textBaseline="middle",t.fillStyle=e.lollipop.text.strokeStyle,t.font=e.lollipop.text.font,t.fillText(e.lollipop.text.label,i.x,i.y)},o.prototype.drawStick=function(t,e,i,o){t.strokeStyle=e.strokeStyle,t.lineWidth=e.lineWidth,CanvasEx.setLineStyle(t,CanvasEx.LINESTYLE_DASHED),CanvasEx.drawLine(t,i.x,i.y,o.x,o.y)},n.prototype.draw=function(t){t.strokeStyle=this.data.style.strokeStyle,t.lineWidth=this.data.style.lineWidth,CanvasEx.setLineStyle(t,this.data.style.lineStyle),CanvasEx.drawLine(t,this.data.startPoint.x,this.data.startPoint.y,this.data.endPoint.x,this.data.endPoint.y)},n.prototype.hitTest=function(t){return null},s.prototype.hitTest=function(e){return t.isInCircle(this.data.circlePoint,this.data.style.lollipop.radius,e)?this._hittest:null},s.prototype.draw=function(t){var e=this.data.template;t.drawImage(e,this.data.basePoint.x-(.5+this.data.style.lollipop.width/2<<0)+.5,this.data.basePoint.y-this.data.style.lollipop.height+.5)},r.prototype.draw=function(t){var e=this._data.tooltipPoint;this._data.createText(this._data,this.textRenderer),this.drawFrame(t,e),this.drawTip(t,e)},r.prototype.hitTest=function(t){return null},r.prototype.drawTip=function(t,e){var i=5,o=this.calcMarginX(t,e.x,i),n=e.x+o;t.lineWidth=this._data.style.lineWidth,t.strokeStyle=this._data.style.fillStyle,t.fillStyle=this._data.style.fillStyle,t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(n-i,e.y-i),t.lineTo(n+i,e.y-i),t.fill(),t.closePath(),t.stroke(),t.strokeStyle=this._data.style.strokeStyle,t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(n-i,e.y-i),t.moveTo(e.x,e.y),t.lineTo(n+i,e.y-i),t.closePath(),t.stroke()},r.prototype.drawFrame=function(e,i){var o,n,s=200,r=5,a=16,l=7,h=12,c=this.textRenderer.measure()+h+l,d=this.calcMarginX(e,i.x,s/2);e.lineWidth=this._data.style.lineWidth,CanvasEx.setLineStyle(e,CanvasEx.LINESTYLE_SOLID),e.strokeStyle=this._data.style.strokeStyle,e.fillStyle=this._data.style.fillStyle,e.beginPath(),e.rect(i.x-s/2+d,i.y-r-c,s,c),e.closePath(),e.stroke(),e.fill(),o=i.x-s/2+a+d,n=i.y-r-c+l+this.textRenderer.fontHeight,this.textRenderer.draw(e,new t.Point(o,n))},r.prototype.calcMarginX=function(t,e,i){var o=5,n=5,s=0,r=t.canvas.clientWidth;return e-i<o?s=Math.abs(e-(i+o)):e+i>r-n&&(s=-Math.abs(r-(i+e+n))),s},r.TextRenderer=function(){this.lines=[],this.fontHeight=12,this.font=this.fontHeight+"px Arial, sans-serif",this.lineSpacing=8,this.fillStyle="black"},r.TextRenderer.prototype.draw=function(t,e){var i,o,n=e.y;for(i=0;i<this.lines.length;i++)o=this.lines[i],t.font=this.font,o.options.fontWeight&&(t.font=o.options.fontWeight+" "+this.font),t.fillStyle=this.fillStyle,o.renderer(t,o.line,{x:e.x,y:n}),n+=this.lineSpacing+this.fontHeight},r.TextRenderer.prototype.measure=function(){return this.lines.length*(this.fontHeight+this.lineSpacing)-this.lineSpacing},r.TextRenderer.prototype.basicRenderer=function(t,e,i){t.fillText(e,i.x,i.y)},r.TextRenderer.prototype.addMulticolorTextLine=function(t,e){this.addTextLine(t,e,this.multicolorRenderer)},r.TextRenderer.prototype.addTextLine=function(t,e,i){i||(i=this.basicRenderer),e||(e={}),this.lines.push({line:t,renderer:i,options:e})},r.TextRenderer.prototype.multicolorRenderer=function(t,e,i){var o,n,s=i.x;for(o=0;o<e.length;++o)n=e[o],t.fillStyle=n.color,t.fillText(n.text,s,i.y),s+=t.measureText(n.text).width},e.ESDPaneView=o}).call(e,i(21))},function(t,e,i){(function(t,o,n){"use strict";function s(e,i){var n,s=e._undoModel._chartWidget,r=s.onWidget(),a=!1;a=r?s._options&&!s._options.hideIdeas:TVSettings.getBool("BarsMarksContainer.visibile",!1),i?i.merge({visible:a,frozen:!1}):i=new t({visible:a,frozen:!1}),n=this,i.visible.listeners().subscribe(null,function(t){r||s._containsData||TVSettings.setValue("BarsMarksContainer.visibile",!!t.value()),n._tooltip&&n._tooltip.removeAll()}),d.call(this,e,null,i),this.onNeedRepaint=new o,this._requests=[],this._marks={},this._loadedRange=null,this._getDataTimeout=null,this._collectedRange=null,this._model.mainSeries().onSymbolIntervalChanged().subscribe(this,this.clearMarks),this._model.mainSeries().onSymbolResolved().subscribe(this,this.clearMarks),this._model.mainSeries().onTickmarksRangeChanged().subscribe(this,this.getData),this._initialize(),this.pinnedTooltips={},this._tooltip=new h(this._createTooltip.bind(this),this)}function r(t,e,i){this.source=t,this.pane=e,this._rendererFactory=i}function a(t,e){this._barWidth=t.barWidth,this._plates=t.plates,this._tooltip=t.tooltip,this._model=e}function l(){this._layout=[],this._currentId=void 0,this.tooltipHovered=!1}function h(t,e){this.tooltips={},this.tooltipFactory=t,this.source=e}function c(t,e){this.renderer=t,this._tooltip=e,this.visible=!1}var d=i(74).LineDataSource,p=i(94);inherit(s,d),s.prototype._constructor="Child class must override this member",s.prototype._initialize=function(t){throw Error("Child class must override this member")},s.prototype.onClicked=function(){throw Error("Child class must override this member")},s.prototype._getData=function(t){throw Error("Child class must override this member")},s.prototype._createTooltip=function(){throw Error("Child class must override this member")},s.prototype.updateDotData=function(t,e){return e},s.prototype.updatePlateData=function(t,e){},s.prototype._plateViewData=function(t){return{}},s.prototype.pinTooltip=function(t,e){this.pinnedTooltips[t]=e},s.prototype.timeScale=function(){return this._model.timeScale()},s.prototype.getIntervalInTicks=function(){function t(t){if(t=parseInt(t),t!=t)throw new TypeError("Unexpected interval");return 60*t}var e=t(1440),i=7*e,o=31*e,n=this._model.mainSeries().properties().interval.value();switch(n){case"M":return o;case"W":return i;case"D":return e;default:return t(n)}},s.prototype._maxDate=new Date(2037,0,1),s.prototype.getVisibleTickmarksRange=function(){var t,e;return this.timeScale().isEmpty()?{start:0,end:0}:(t=this.timeScale().visibleBars(),t.lastBar()>this.timeScale().points().firstTimePointIndex()&&t.firstBar()<this.timeScale().points().lastTimePointIndex()?(e=t.lastBar()<this.timeScale().points().lastTimePointIndex()?this.timeScale().indexToTimePoint(t.lastBar()):this._maxDate,t={start:this.timeScale().indexToTimePoint(Math.max(t.firstBar(),this.timeScale().points().firstTimePointIndex())),end:e},{start:t.start?t.start.getTime()/1e3:void 0,end:t.end?t.end.getTime()/1e3:void 0}):{start:0,end:0})},s.prototype.getVisibleRangePlates=function(){var t=[],e=this.getVisibleTickmarksRange(),i=this.getIntervalInTicks();return $.each(this._marks,function(o,n){var s=n.tickmark;s>=e.start&&s<=e.end+i&&t.push(n)}),t},s.prototype.getPublishedPlates=function(){var t={},e=this;return is_authenticated?($.each(this.getVisibleRangePlates(),function(i,o){o.is_public&&(e.pinnedTooltips[o.id]||o.user__id===user.id)&&(t[o.id]=o)}),t):t},s.prototype._maxPlatesPerBar=10,s.prototype.filterDisplayedPlates=function(t){return t=t.reduce(function(t,e){var i=this._getIndex(e.tickmark);return t[i]=t[i]||[],t[i].push(e),t}.bind(this),{}),t=Object.keys(t).reduce(function(e,i){var o=t[i];return o=o.sort(function(t,e){return e.views_count-t.views_count}),o=o.slice(0,this._maxPlatesPerBar),e.concat(o)}.bind(this),[])},s.prototype._layout=function(t){switch(t){default:case 0:return"up";case 1:return"down";case 2:return"up";case 3:case 4:case 5:case 6:return"up"}},s.prototype._theme=function(t){switch(t){default:case 0:return"neutral";case 1:return"green";case 2:return"red";case 3:return"yellow";case 4:return"blue";case 5:return"green";case 6:return"red"}},s.prototype._offset=function(t,e){var i;switch(t){default:case"up":i=e[TradingView.HIGH_PLOT];break;case"down":i=e[TradingView.LOW_PLOT]}return this.priceScale().isPercent()&&(i=this.priceScale().priceRange().convertToPercent(i,this.ownerSource().firstValue())),this.priceScale().priceToCoordinate(i)},s.prototype._getIndex=function(t){return this.timeScale().timePointToIndex(t)},s.prototype.getViewData=function(){return{barWidth:this.barWidth(),plates:this.getPlatesViewData(),tooltip:this._tooltip}},s.prototype.barWidth=function(){return this.timeScale().barSpacing()},s.prototype.getPlatesViewData=function(){var t,e,i,o,n,s;if(this._model.mainSeries().data().isEmpty())return[];t=this.filterDisplayedPlates(this.getVisibleRangePlates()),e=this,i={},o=this._model.lastHittestData(),t=t.map(function(t){var n,s,r,a,l,h,c=this._getIndex(t.tickmark),d=this._getBar(c);return!!d&&(n=this._layout(t.direction),s=this._theme(t.direction),r=o&&o.id===t.id,a=this.timeScale().indexToCoordinate(c),l=this._offset(n,d),h=0,c in i||(i[c]={up:0,down:0}),h=i[c][n]++,TradingView.merge({id:t.id,x:a,y:l,order:h,direction:n,theme:s,hovered:r,pinned:e.pinnedTooltips[t.id]===!0,user__id:t.user__id,label:t.label,labelFontColor:t.labelFontColor||"#444",minSize:t.minSize||0},this._plateViewData(t)))}.bind(this)),t=t.filter(function(t){return!!t}),n=t.filter(function(t){return t.hovered===!0});for(s=0;s<t.length;s++)null!=n[0]&&t[s].user__id===n[0].user__id&&(t[s].highlightByAuthor=!0);return t.sort(function(t,e){return t.hovered&&!e.hovered?1:0}),t},s.prototype._getBar=function(t){return this._model.mainSeries().data().valueAt(t)},s.prototype.paneViews=function(t){var e=this;return this._properties.visible.value()?[new r(this,t,function(t){return new a(t.getViewData(),e)})]:[]},s.prototype.dataWindowView=function(){return null},s.prototype.priceAxisViews=function(){return null},s.prototype.statusView=function(){return null},s.prototype.updateAllViews=function(){},s.prototype.pointsCount=function(){return 0},s.prototype.properties=function(){return this._properties},s.prototype._rangeDifference=function(t){return t=$.extend({},t),this._loadedRange&&(t.start<this._loadedRange.start?t.end=this._loadedRange.start:t.end>this._loadedRange.end&&(t.start=this._loadedRange.end)),t},s.prototype._rangeUnion=function(t,e){return t=$.extend({},t),e&&(t.start=Math.min(e.start,t.start),t.end=Math.max(e.end,t.end)),t},s.prototype._pushGetDataStack=function(t){if(!t.end||!t.start)throw new TypeError("Wrong tickmark range");this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._collectedRange=this._rangeUnion(t,this._collectedRange),this._getDataTimeout=setTimeout(function(){this._getData(this._collectedRange),this._getDataTimeout=this._collectedRange=null}.bind(this),300)},s.prototype.roundRange=function(t){return{start:Math.round(t.start),end:Math.round(t.end)}},s.prototype.refreshData=function(){this.getData(this._lastRange)},s.prototype.getData=function(t){if(!t.start||!t.end)throw new TypeError("Wrong range");this._lastRange=t;var t=$.extend({},t);t.end=this._maxDate/1e3,this._pushGetDataStack(t)},s.prototype._abortAllRequests=function(){this._requests.forEach(function(t){t.abort()}),this._requests=[],this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._getDataTimeout=this._collectedRange=null},s.prototype.clearMarks=function(){this._abortAllRequests(),this._marks={},this._loadedRange=null},r.prototype.update=function(){},r.prototype.renderer=function(){return this._rendererFactory(this.source)},a.prototype.draw=function(t){t.save();for(var e=0;e<this._plates.length;e++)if(this._plates[e].highlightByAuthor){this._highlightByAuthor=!0;break}this._plates.forEach(this._drawItem.bind(this,t)),this._tooltip.draw(this._plates.map(function(t){return this._plateTransform(t)}.bind(this)),t),this._tooltip.endDraw(),t.restore()},a.prototype._drawItem=function(t,e){t.save(),this._highlightByAuthor&&!e.highlightByAuthor&&(t.globalAlpha=.4);var i=this._dotTransform(e);i.mine?this._drawTriangle(t,i):this._drawDot(t,i),t.restore()},a.prototype._commonTransform=function(t){var e=Math.max(1.4*t.minSize,this._barWidth+4),i=t.y+{up:-1,down:1}[t.direction]*(e*(t.order+.6)+.25*e),o=TradingView.clone(t.overridedTheme||this.themes[t.theme]);return o.dotBorderWidth=t.hovered||t.highlightByAuthor?4:2,{id:t.id,theme:o,themeName:t.theme,x:Math.round(t.x+1),y:Math.round(i),pinned:t.pinned,hovered:t.hovered}},a.prototype._dotTransform=function(t){var e=this._commonTransform(t);return e.radius=Math.max(t.minSize/2,.4*this._barWidth),e.label=t.label,e.labelFontColor=t.labelFontColor,e.labelFontSize=Math.ceil(Math.max(10,Math.min(e.radius,20))),this._model.updateDotData(t,e)},a.prototype._plateTransform=function(t){var e=this._commonTransform(t);
return this._model.updatePlateData(t,e)},a.THEMES=["green","red","neutral","yellow","blue"],a.prototype.themes={green:{border:"#78C143",background:"#8DDD54"},red:{border:"#CC4545",background:"#ED5A5A"},neutral:{border:"#EAC300",background:"#FFD400"},yellow:{border:"#EAC300",background:"#FFD400"},blue:{border:"#047ACE",background:"#0496FF"}},a.prototype._drawTriangle=function(t,e){var i,o,n,s;t.strokeStyle=e.theme.border,t.fillStyle=e.theme.background,t.lineWidth=e.theme.dotBorderWidth,i=e,o=e.radius,n=Math.cos(Math.PI/6)*o,s=Math.sin(Math.PI/6)*o,t.translate(i.x,i.y),"up"===e.direction&&t.rotate(Math.PI),e.public||(t.lineWidth/=2),t.beginPath(),t.moveTo(0,-o),t.lineTo(n,s),t.lineTo(-n,s),t.lineTo(0,-o),t.closePath(),t.stroke(),e.public&&t.fill()},a.prototype._drawDot=function(t,e){t.strokeStyle=e.theme.border,t.fillStyle=e.theme.background,t.lineWidth=e.theme.dotBorderWidth,t.beginPath(),t.arc(e.x,e.y,e.radius,0,2*Math.PI,!0),t.closePath(),t.stroke(),t.fill(),e.label&&e.radius>6&&(t.textAlign="center",t.textBaseline="middle",t.font="bold "+e.labelFontSize+"px Arial",t.fillStyle=e.labelFontColor,t.fillText(e.label,e.x,e.y))},a.prototype.hitTest=function(t){var e,i;for(i=this._plates.length-1;i>=0;--i)if(e=this._hitTestDot(this._plates[i],t))return e;return null},a.prototype._hitTestDot=function(t,e){var i=this._dotTransform(t),o=new n.Point(i.x,i.y);return n.isInCircle(o,Math.max(i.radius,8),e)?new p(p.REGULAR,t):null},l.prototype._createLayout=function(){throw Error("Child class must override this member")},l.prototype._updatePlate=function(t){throw Error("Child class must override this member")},l.prototype._getContainer=function(t){return this._container&&this._context===t||(this._context=t,this._container=$(t.canvas).parent()),this._container},l.prototype._plateArrowSize=14,l.prototype.showPlate=function(t,e){var i,o,n,s,r,a,l;this._currentId===t.id&&this._layout&&0!==this._layout.length&&null!=this._layout[0].parentNode||(this._currentId=t.id,this._createLayout(),this._getContainer(e).append(this._layout),i=this,this._layout.hover(function(){i.tooltipHovered=!0,$(this).stop(!0).fadeTo(0,1)},function(){i.tooltipHovered=!1})),o=Math.round(t.barWidth/2),o>15&&(o=15),o<10&&(o=10),this._updatePlate(t),n=t.x-this._layout.outerWidth()<this._plateArrowSize,s=e.canvas.width-t.x+Math.round(t.barWidth/2+o),n&&(s-=this._layout.outerWidth()+2*this._plateArrowSize),r=e.canvas.height,a=20,l=10,this._layout.toggleClass("right",n),this._layout.css({top:Math.min(Math.max(t.y,a),r-this._layout.outerHeight()-l),right:s,fontSize:o+"px",display:"block"})},l.prototype._removeLayout=function(){this.tooltipHovered||(this._layout.stop(!0),this._layout.remove())},l.prototype._toggleLayout=function(t){this._layout.toggle(t)},l.prototype.hide=function(t){this.tooltipHovered?this._layout.stop(!0).fadeTo(0,1):this._layout.fadeOut(400,function(){$(this).remove(),t()})},l.prototype.setSource=function(t){this.source=t},h.prototype.findOrCreateTooltip=function(t){var e=this.tooltips[t.id];return null==e&&(t.hovered||t.pinned)&&(e=this._createTooltip(),this.tooltips[t.id]=e),e},h.prototype.showPlate=function(t,e){var i=this.findOrCreateTooltip(t);null!=i&&(i._drawPlate(t,e),i.plateData=t)},h.prototype.draw=function(t,e){this.hoveredId=null;for(var i=0;i<t.length;i++)t[i].hovered&&(this.hoveredId=t[i].id);t.forEach(function(t){this.showPlate(t,e)}.bind(this))},h.prototype.endDraw=function(){var t,e,i=this;for(t in this.tooltips)this.tooltips.hasOwnProperty(t)&&(e=this.tooltips[t],e.toggleVisibility(),i.hoveredId&&e.plateData.id!==i.hoveredId&&!e.plateData.pinned&&(e.remove(),delete this.tooltips[t]))},h.prototype.removeAll=function(){var t,e;for(t in this.tooltips)this.tooltips.hasOwnProperty(t)&&(e=this.tooltips[t],e.remove());this.tooltips={}},h.prototype.removeTooltip=function(t){delete this.tooltips[t]},h.prototype._createTooltip=function(){return new c(this,this.tooltipFactory())},c.prototype._drawPlate=function(t,e){var i=this;this.visible=!0,this._tooltip.setSource(this.renderer.source),this._tooltip.showPlate(t,e),t.hovered||t.pinned||this._tooltip.hide(function(){i.renderer.removeTooltip(t.id)})},c.prototype.remove=function(){this._tooltip._removeLayout()},c.prototype.toggleVisibility=function(){this._tooltip._toggleLayout(this.visible),this.visible=!1},e.BarsMarksContainer=s,e.BarsMarksContainerRenderer=a,e.BarMarkTooltip=l}).call(e,i(69),i(28),i(21))},function(t,e,i){"use strict";function o(t){r.call(this,t);var e=this;l.hideMarksOnBars().subscribe(this,function(){e._properties.visible.setValue(!l.hideMarksOnBars().value())})}function n(t){a.call(this)}var s=i(236),r=s.BarsMarksContainer,a=s.BarMarkTooltip,l=i(81);inherit(o,r),o.prototype._initialize=function(t){this._properties.visible.setValue(!0)},o.prototype.userEditEnabled=function(){return!1},o.prototype._constructor="UserDefinedBarsMarks",o.prototype._plateViewData=function(t){var e={text:t.text};return"object"==typeof t.color&&(e.theme="user_defined_theme",e.overridedTheme={},e.overridedTheme.border=t.color.border,e.overridedTheme.background=t.color.background),e},o.prototype.onClicked=function(){var t=this._model.lastHittestData().id;this._marks[t].onClicked()},o.prototype.clearMarks=function(){r.prototype.clearMarks.call(this),this.onNeedRepaint.fire()},o.prototype._getData=function(t){var e,i,o,n=this._model.mainSeries().symbolInfo();n&&(e=this.roundRange(this._rangeDifference(t)),i=this,o=this._model.mainSeries().properties().interval.value(),ChartApiInstance.getMarks(n,e.start,e.end,function(e){e.forEach(function(t){i._marks[t.id]=t},i),i._loadedRange=i._rangeUnion(t,i._loadedRange),i.onNeedRepaint.fire()},o))},o.prototype._createTooltip=function(){return new n},o.prototype.updatePlateData=function(t,e){return e.barWidth=this.barWidth(),e.text=t.text,e.tooltipMargin=Math.max(t.minSize/2,.4*this.barWidth())*-1,e},o.prototype.hasContextMenu=function(){return!1},inherit(n,a),n.prototype._createLayout=function(){this._layout=$('<div class="bar-mark-tooltip"></div>'),this._layout_text=$('<div class="text"></div>').appendTo(this._layout)},n.prototype._updatePlate=function(t){this._currentId=t.id,this._layout.css("border-color",t.theme.border),this._layout.css("margin-top",t.tooltipMargin+"px"),this._layout_text.html(t.text),this._layout.append(this._layout_text)},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,i,o){s.call(this,t),this._origState=i,this._title=o;var r={visible:!0};this._properties=new e(r),this._statusView=new n(this,t.properties()),this._status=$.t("compiling..."),this._statusView.setText(this._title+" "+this._status),this._formatter=new a(Math.pow(10,2)),this._failed=!1}var n=i(156),s=i(79).PriceDataSource,r=i(82),a=r.PriceFormatter;inherit(o,s),o.prototype.properties=function(){return this._properties},o.prototype.statusView=function(){return this._statusView},o.prototype.state=function(t){return this._origState},o.prototype.setStatus=function(t){this._status=t,this._statusView.setText(this._title+" "+this._status)},o.prototype.formatter=function(){return this._formatter},o.prototype.title=function(){return this._title},o.prototype.setFailed=function(t){this._failed=t},t.exports=o}).call(e,i(69))},function(t,e,i){"use strict";TradingView.PublishedChartsTimeline=function(){},TradingView.LinearRegressionPaneView=function(){},TradingView.study_PivotPointsStandard=function(){},TradingView.study_PivotPointsHighLow=function(){},TradingView.study_ZigZag=function(){},TradingView.study_LinearRegression=function(){},TradingView.study_ElliottWave=function(){},TradingView.ESDStudyBase=function(){},TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.getStudies=function(){return[]},TradingView.Pro.prototype.getProduct=function(){return{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]},TradingView.LineToolRegressionTrend=function(){},TradingView.templates=i(46),TradingView.templates.dialogs={addSymbol:' <div class="main"> <div class="symbol-edit-place"></div>{{#overlayOption}} <div class="_tv-dialog-relative">\t<input id="_tv-dialog-addsymbol-overlay-checkbox" type="checkbox" name="addsymbol-overlay" {{#overlayOptionChecked}}checked="checked"{{/overlayOptionChecked}} />\t<span class="_tv-dialog-checkbox-mask _tv-dialog-checkbox-mask{{#overlayOptionChecked}}-active{{/overlayOptionChecked}}"></span>\t<label for="_tv-dialog-addsymbol-overlay-checkbox"> Overlay the main chart</label> </div>{{/overlayOption}} <div class="_tv-dialogs-bottom-button"> <span class="_tv-button tv-right tv-uppercase ok">{{okButtonTitle}}</span> </div> </div>',symbolSearch:'<div class="symbol-block"><div class="spread-actions"></div><div class="symbol-block-inputspacer"><input maxlength="'+TradingView.SYMBOL_SEARCH_MAX_LENGTH+'" /><div class="search-cion"></div></div></div><div class="filter"></div><div class="results"></div>'},TradingView.AlertLabel=function(){},TradingView.getDataVendorString=function(){},window.Telemetry={sendReport:function(){}},TradingView.study_VbPVisible=function(){},TradingView.study_VbPSessions=function(){},TradingView.LineToolVbPFixed=function(){},TradingView.study_ESD$TV_DIVIDENDS=function(){},TradingView.study_ESD$TV_SPLITS=function(){},TradingView.study_ESD$TV_EARNINGS=function(){},TradingView.MockupRequestedCache=function(t){t&&t([])},TradingView.MockupRequestedCache.invalidate=function(){},TradingView.getThemesList=TradingView.MockupRequestedCache,TradingView.StudyStrategy=function(){},TradingView.LinetoolTemplatesList=function(){},window.PublishedScript={suggest:function(){var t=$.Deferred();return t.resolve(null),t}}},function(t,e,i){(function(e){"use strict";function o(t,e){l.invalidateStudyTemplatesList(),l.removeStudyTemplate(t,e)}function n(t){this._options=t||{},this._chartWidgetCollection=this._options.chartWidgetCollection,this._SAVE_AS_TITLE=$.t("Save Study Template As..."),this._list=[],this._$wrapper=null,this._favoredList=null,this._loaded=!1,this._onFirstLoad=new e,this.onFavoriteListResize=new e}var s=i(55),r=s.FavoredList,a=s.showChartNameDialog,l=i(36);n.prototype.appendMenuButtonTo=function(t){t&&(this._$wrapper=t,this._generateFavoriteList())},n.prototype.refreshStudyTemplateList=function(t){var e=this;l.getStudyTemplatesList(function(i){e._list=i||[],"function"==typeof t&&t()})},n.prototype._generateFavoriteList=function(){var t=this;this._favoredList=new r("StudyTemplates",t._listPreparedForFavorite(),{addClass:"study-template-widget",popupAddClass:"study-template-popup",notShowActive:!0,svg:!1,popupSpacing:this._options.popupSpacing,notShowQuicks:this._options.notShowQuicks,tooltip:$.t("Study Templates"),addTooltipClass:"apply-common-tooltip"}),t.refreshFavoriteDropdownMenu(),this._favoredList.element().appendTo(this._$wrapper),this._favoredList.onSelect().subscribe(t,function(t){t!==this._SAVE_AS_TITLE&&this.applyStudyTemplate(t)}),this._favoredList.onSelect().subscribe(t,function(t){t===this._SAVE_AS_TITLE&&this.showSaveAsDiaolg()}),this._favoredList.onResize().subscribe(t._chartWidgetCollection,t._chartWidgetCollection.updateLayout),this._favoredList.onResize().subscribe(this.onFavoriteListResize,this.onFavoriteListResize.fire),this._favoredList.onOpen().subscribe(t,function(){t.refreshFavoriteDropdownMenu()})},n.prototype._listPreparedForFavorite=function(t){var e,o,n,s,r;return t=t||this._list,e=this,o=this.plainList("default"),n=this.plainList("custom"),s=[{id:e._SAVE_AS_TITLE,title:e._SAVE_AS_TITLE,addClass:"special",toQuickButtonStyle:{display:"none"}},{separator:!0}],r=function(t,o){return $.map(t,function(t){var n={id:t,title:$.t(t),svg:$(i(60)).attr({width:13,height:13}),favoriteButton:{icon:{},title:t,addClass:"apply-common-tooltip"}};return o&&(n.drop=function(){this.deleteStudyTemplate(t)}.bind(e)),n})},n.length&&(s=s.concat(r(n,!0)).concat([{separator:!0}])),s=s.concat(r(o))},n.prototype.applyStudyTemplate=function(t){function e(e){TradingView.trackEvent("GUI","Load Study Template"),i.model().model().restoreStudyTemplate(JSON.parse(e.content),t),i.updateSeriesControlUI()}var i=this._chartWidgetCollection.activeChartWidget.value();TVSettings.setValue("defaultStudyTemplate",t),l.getStudyTemplateContent(t,e)},n.prototype.showSaveAsDiaolg=function(){var t=this,e=this._chartWidgetCollection.activeChartWidget.value(),i=function(i,o){var n,s,r,a,h,c,d,p;i=TradingView.clean(i),n=o[0],s=JSON.stringify(e.model().model().studyTemplate(n)),r={name:i,content:s},a=$.inArray(i,t.plainList())!==-1,h=function(){var e=function(e){e.error||(TVSettings.setValue("defaultStudyTemplate",i),l.invalidateStudyTemplatesList(),t.refreshFavoriteDropdownMenu())};l.saveStudyTemplate(r,e)},a?(c=$.t("Confirm replace"),d=$.t("Do you realy want to replace")+' "'+i+'"?<br><small>'+$.t("Note: default study templates won't be removed permanently")+"</small>",p=h,TVDialogs.showConfirm(c,d,p)):h()},o=function(e){t.refreshStudyTemplateList(function(){e.find('[name="name"]').inputselectable({list:t.plainList().sort(),closeHandle:e})})};runOrSignIn(function(){a(i,{title:$.t("Save new study template"),label:$.t("Template name"),error:$.t("Please enter template name")},255,[{title:$.t("Save Interval"),name:"save_interval",type:"bool",hint:$.t('When selecting this checkbox the study template will set "__interval__" interval on a chart',{interval:e.model().model().mainSeries().interval()})}],o)},{source:"Study templates save as",sourceMeta:"Chart"})},n.prototype.refreshFavoriteDropdownMenu=function(){var t=this,e=this._favoredList;e&&t.refreshStudyTemplateList(function(){e.reload(t._listPreparedForFavorite()),e._container.hasClass("active")&&(e._container.trigger("click"),e._openMenu.call(e))})},n.prototype.deleteStudyTemplate=function(t){var e=this,i=$.t("Do you really want to delete {0} study template?").format(t?'"'+t+'"':"");runOrSignIn(function(){TVDialogs.showConfirm($.t("Study Template"),i,function(){e._favoredList.removeById(t),o(t,function(){setTimeout(function(){e.refreshFavoriteDropdownMenu()},0)})})},{source:"Study templates delete"})},n.prototype.container=function(){return this._favoredList?this._favoredList._container:null},n.prototype.list=function(){return this._list},n.prototype.plainList=function(t){return"default"===t?$.map(jQuery.grep(this._list,function(t){return!!t.is_default}),function(t){return t.name}):"custom"===t?$.map(jQuery.grep(this._list,function(t){return!t.is_default}),function(t){return t.name}):$.map(this._list,function(t){return t.name})},t.exports=n}).call(e,i(28))},function(t,e,i){(function(t,e){"use strict";function o(e,i){this.options=$.extend({throttleTimeout:125},i),this._connected=!1,this._symbol_data={},this._subscriptions={},this._delayed_subscriptions=[],this.onConnect=new t,this.onDisconnect=new t,this._quoteApi=new n(ChartApiInstance),this._type=e||"full",this.connect(),this._delayUpdateFastSymbols=TradingView.debounce(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this.fieldsSent=new $.Deferred}var n,s=i(82).PriceFormatter;n=i(242),o.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},o.prototype.type_fields={minichart:["lp","open_time","series_data","description"],simple:["ch","chp","lp","fractional","minmov","minmove2","original_name","pricescale","pro_name","update_mode","volume","symbol_status","description","exchange","short_name","current_session","type","is_tradable"],"simple-detailed":["ch","chp","lp","fractional","minmov","minmove2","original_name","pricescale","pro_name","update_mode","symbol_status","description","exchange","short_name","current_session","type","volume","open_price","high_price","low_price","market_cap_basic","prev_close_price","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year"],full:[]},o.prototype.connect=function(t){this._quoteApi.connect(this.quoteHandler.bind(this))},o.prototype.quoteHandler=function(t){var e=t.method,i=t.params;switch(e){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},o.prototype.onConnected=function(){this.setFields();var t=Object.keys(this._symbol_data);t.length&&this._quoteApi.quoteAddSymbols(t,{forcePermission:!0}),this._delayed_subscriptions.forEach(function(t){this.subscribe.apply(this,t)},this),this._delayed_subscriptions=[],this.onConnect.fire()},o.prototype.setFields=function(){var t=o.prototype.type_fields[this._type];t&&t.length&&this._quoteApi.quoteSetFields(t),this.fieldsSent.resolve()},o.prototype.onSymbolData=function(t){var e=t.symbolname,i=this._throttledSymbolData[e];i||(i=this._throttledSymbolData[e]={fnDispatch:TradingView.throttle(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?$.extend(!0,i.cache,t):i.cache=t,i.fnDispatch(e)},o.prototype._parseUpdateMode=function(t){var e=t.update_mode;e&&(e=e.match(/(delayed_streaming){1}(?:_([\d]+))?/),e&&e[1]&&(e[2]&&(t.update_mode_seconds=+e[2]),t.update_mode=e[1]))},o.prototype.dipatchSymbolData=function(t){var e,i,o=this._symbol_data[t],n=this._throttledSymbolData[t].cache;if(delete this._throttledSymbolData[t].cache,this._symbol_data[t]){$.extend(!0,o,n),o.values&&this._parseUpdateMode(o.values);for(e in this._subscriptions)i=this._subscriptions[e],i[t]&&i[t].forEach(function(t){t(o,n)})}},o.prototype.subscribe=function(t,e,i){var o,n;return this._connected?(this._subscriptions[t]=this._subscriptions[t]||{},o=this._subscriptions[t],e=[].concat(e),n=[],e.forEach(function(t){this._symbol_data[t]?o&&o[t]||this._symbol_data[t].subscribers_count++:(this._symbol_data[t]={subscribers_count:1},n.push(t)),o[t]=o[t]||[],o[t].push(i),o[t].fast=!0,this._symbol_data[t]&&this._symbol_data[t].values&&i(this._symbol_data[t],this._symbol_data[t])},this),void(n.length&&(this._quoteApi.quoteAddSymbols(n,{forcePermission:!0}),this._delayUpdateFastSymbols()))):void this._delayed_subscriptions.push(arguments)},o.prototype.unsubscribe=function(t,e,i){var o,n=this._subscriptions[t];n&&(n[e]&&i?(o=n[e].indexOf(i),~o&&n[e].splice(o,1),n[e].length||delete n[e]):delete n[e]),n&&0===Object.keys(n).length&&delete this._subscriptions[t],this._symbol_data.hasOwnProperty(e)&&(n&&!n[e]&&this._symbol_data[e].subscribers_count--,this._symbol_data[e].subscribers_count||(delete this._symbol_data[e],this._quoteApi.quoteRemoveSymbols([e]),this._delayUpdateFastSymbols()))},o.prototype.setFastSymbols=function(t,e){var i,o;if(this._subscriptions[t]){i=this._subscriptions[t];for(o in i)i[o].fast=e.indexOf(o)!==-1}this._delayUpdateFastSymbols()},o.prototype._updateFastSymbols=function(){if(this._connected){var t=this._fastSymbols();0===t.length?this._quoteApi.quoteHibernateAll():this._quoteApi.quoteFastSymbols(t)}},o.prototype._delayUpdateFastSymbols=o.prototype._updateFastSymbols,o.prototype._fastSymbols=function(){var t,e,i,o=[];for(t in this._subscriptions){e=this._subscriptions[t];for(i in e)e[i].fast&&o.push(i)}return o=TradingView.uniq(o)},o.prototype.formatter=function(t){function e(t){var e=new s(t.pricescale,t.minmov,t.fractional,t.minmove2);return"forex"===t.type&&(e.lastCharSup=!0),e}function i(t){return t&&null!=t.pricescale&&null!=t.minmov&&null!=t.fractional&&null!=t.minmove2}var o,n=this;return this._waitingForFormatters[t]?this._waitingForFormatters[t]:(o=new Promise(function(o,s){if(n._formatterValuesCache[t])o(e(n._formatterValuesCache[t]));else{var r=TradingView.guid();n.subscribe(r,[t],function(a){a.error&&(n._waitingForFormatters[t]=null,s(a.error)),i(a.values)&&(n._waitingForFormatters[t]=null,n._formatterValuesCache[t]=a.values,o(e(a.values)),n.unsubscribe(r,t))})}}),this._waitingForFormatters[t]=o,o)},TradingView.QuoteSessionMultiplexer=o,void 0!==e&&e&&e.exports&&(e.exports=o)}).call(e,i(28),i(2)(t))},function(t,e,i){(function(t){"use strict";function e(t){this._chartApi=t,this._sessionid="qs_"+TradingView.randomHash(),this._sessionstarted=!1}e.prototype.destroy=function(){this._sessionstarted&&(this._chartApi.quoteDeleteSession(this._sessionid),this._sessionid=null,this._sessionstarted=!1)},e.prototype.connected=function(){return this._chartApi.connected()},e.prototype.connect=function(t){this._globalHandler=t,this._chartApi.createSession(this._sessionid,this),this._chartApi.connect()},e.prototype.disconnect=function(){this._chartApi.disconnect()},e.prototype.quoteAddSymbols=function(t,e){t=[].concat(t),e&&e.forcePermission&&(t=t.concat({flags:["force_permission"]})),this._chartApi.quoteAddSymbols(this._sessionid,t)},e.prototype.quoteRemoveSymbols=function(t){this._chartApi.quoteRemoveSymbols(this._sessionid,t)},e.prototype.quoteFastSymbols=function(t){this._chartApi.quoteFastSymbols(this._sessionid,t)},e.prototype.quoteSetFields=function(t){this._chartApi.quoteSetFields(this._sessionid,t)},e.prototype.onMessage=function(t){switch(t.method){case"connected":this._sessionstarted||(this._chartApi.quoteCreateSession(this._sessionid),this._sessionstarted=!0);break;case"disconnected":this._sessionstarted=!1;break;case"critical_error":}this._globalHandler(t)},e.prototype.quoteHibernateAll=function(t){this._chartApi.quoteHibernateAll(this._sessionid)},TradingView.QuoteSession=e,void 0!==t&&t&&t.exports&&(t.exports=e)}).call(e,i(2)(t))},function(t,e){"use strict";window.onload=function(){function t(){function t(t){function e(t){return t.height>10&&t.width>10}function i(t){function e(t,e){return t>=0&&t<=e}var i=t[0].getBoundingClientRect(),o=t.position(),n=[o.top,o.left,o.top+i.height,o.left+i.width],s=$(window);return e(n[0],s.height())&&e(n[1],s.width())&&e(n[2],s.height())&&e(n[3],s.width())}return 1!==t.length?1:t.is(":visible")?"visible"!==t.css("visibility")?3:"none"===t.css("display")?4:1!==t.css("opacity")?5:t.css("z-index")<0?6:e(t[0].getBoundingClientRect())?i(t)?0:8:7:2}function e(t){var e,i=t.find("a");return 1===i.length&&(e=i.attr("href"),e.indexOf("tradingview.com")>=0)}function i(i){var o=i.find(".tv-link"),n=t(o);return 0===n&&e(o)}function o(e){var i=e.find(".text"),o=t(i);return 0===o&&i.text().indexOf("TradingView")>=0}var n,s=$(".onchart-tv-logo"),r=t(s);if(1===r)s=$(".onchart-custom-logo"),r=t(s),0!==r||i(s)||(r=9);else if(0===r){if(n=s.find("img.solid"),1!==n.length)return 1;r=t(n),0!==r||e(s)?0!==r||o(s)||(r="B"):r="A"}return r}function e(){try{var t=/^(192|172|10)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/;return t.test(location.hostname)||/^.*((?:\.local)|localhost)$/.test(location.hostname)}catch(t){return!1}}location.hostname.indexOf(".")>=0&&!e()&&setTimeout(function(){try{var e=t();window.ga&&0!==e&&ga("send","event","s",e)}catch(t){}},3e4)}},function(t,e,i){(function(e,o){"use strict";function n(t){function i(t,e){var i,o,n=[],r=s[mt].count;for(i=0;i<r;i++)n.push(dt[i].chartWidget.state(t,e));return o={layout:mt,charts:n},bt.value()&&(o.symbolLock=1),wt.value()&&(o.intervalLock=1),St.value()&&(o.trackTimeLock=1),l.hideAllDrawings().value()&&(o.hideAllDrawings=!0),o}function n(t){var e,i=$.Deferred(),o=[],n=s[mt].count;for(e=0;e<n;e++)o.push(dt[e].chartWidget.asyncState(t));return $.when.apply($,o).then(function(){var t,e={charts:[]};for(t=0;t<arguments.length;t++)e.charts.push(arguments[t]);i.resolve(e)}),i}function p(){var t,e,i,o,n,s;if(tt&&tt(Q),t=ft||{},ft={width:Q.width(),height:Q.height()},e=Q[0],window.self!==window.top&&e.offsetWidth<e.clientWidth&&e.getBoundingClientRect().width<100&&(i=Math.round(100*e.getBoundingClientRect().width),o=Math.round(100*e.getBoundingClientRect().height),ft={width:i,height:o}),n=!1,t.height===ft.height&&t.width===ft.width&&gt||(n=!0),n)if(G)u(_t);else for(s=0;s<gt.count;s++)u(s)}function u(t){var e,i=dt[t];i&&(e=G?s.s.sizer(0,ft,at,lt):gt.sizer(t,ft,at,lt),dt[t].wrap.css({width:Math.max(e.width||0,0),height:Math.max(e.height||0,0),top:Math.max(e.top||0,0),left:Math.max(e.left||0,0)}),i.metrics&&i.metrics.width===e.width&&i.metrics.height===e.height||(i.metrics=e,i.chartWidget&&i.chartWidget.resize()))}function _(){for(var t=0;t<dt.length;t++)dt[t].chartWidget.resizeSeriesControlUI()}function f(){for(var t=0;t<dt.length;t++)dt[t].chartWidget.tickSeriesControlClock()}function g(t){var e,i,n,s;return t=$.extend({chartWidgetCollection:rt,isActive:0===dt.length},t||{}),i=$(document.createElement("div")).addClass("chart-container").appendTo(Q).css({position:"absolute",overflow:"hidden"}),i.on("mousedown touchstart",function(){ht.setValue(e)}),n=dt.length,s={wrap:i},dt.push(s),u(n),t.jqParent=i,s.chartWidget=e=new r(t),rt.firstWidgetInitialized||e.chartWidgetInitialized.subscribe(null,function(){try{d.sendEvent("chart_widget_initialized")}catch(t){}rt.firstWidgetInitialized=!0,_()},!0),rt.createLogo&&(e.createLogo=rt.createLogo,o.enabled("move_logo_to_main_pane")||e.withModel(e,function(){e.createLogo(null,e._jqMainDiv),e.adaptOnChartLogo()})),t.containsData?e.finishInitWithoutConnect():e.connect(),v(),y(),e}function m(t,e){var i,o,n,r;h.emit("layout_about_to_be_changed",t),mt=t,G=e,K.setValue(G),t in s||(t="s"),gt=s[t],i=gt.count,ft={width:Q.width(),height:Q.height()};for(o=0;o<i||o<dt.length;o++)n=e?_t===o:o<i,n?(dt[o]?(Q.append(dt[o].wrap),dt[o].chartWidget.isDetached=!1,r=vt.shift(),r&&(yt=!0,dt[o].chartWidget.loadContent(r.content),yt=!1)):g($.extend({},X,vt.shift()||(ht.value()?{content:ht.value().state()}:null)||{},0===o||bt.value()?{}:{defSymbol:null})),dt[o].wrap.toggleClass("multiple",i>1),u(o)):dt[o]&&(dt[o].chartWidget.isDetached=!0,dt[o].wrap.detach());v(),h.emit("layout_changed")}function v(){var t,e=Math.min(gt.count,dt.length)-1;return e<0?void ht.deleteValue():(t=_t,t<0&&(t=0),t>e&&(t=e),void ht.setValue(dt[t].chartWidget))}function y(){var t,e;for(t=dt.length;t--;)e=t===_t,dt[t].wrap.toggleClass("active",e).toggleClass("inactive",!e)}function b(){return $.grep(dt,function(t){return!t.chartWidget.isDetached}).sort(function(t,e){var i=t.metrics.top,o=e.metrics.top,n=t.metrics.left,s=e.metrics.left;return i===o?n<s?-1:n>s?1:0:i<o?-1:1})}function w(){var t,e,i,o,n=rt.layout.value();"s"!==n&&(t=s[n].count,K.value()||(pt=b()),e=ut+1,i=pt[e],!i||e>t?(i=pt[0],ut=0):ut=e,ht.setValue(i.chartWidget),o=K.value(),o&&m(n,!0))}function S(t){var e,i,o,n;nt!==t&&(nt&&(nt.modelCreated().unsubscribe(null,T),e=nt.model(),e&&(i=e.mainSeries().properties(),i.style.unsubscribe(null,C),o=e.model(),o.onSelectedSourceChanged().unsubscribe(null,x),nt=null)),t&&(n=t.model(),n?T(n):t.modelCreated().subscribe(null,T),nt=t))}function T(t){var e,i=t.mainSeries().properties();i.style.subscribe(null,C),C(i.style),e=t.model(),e.onSelectedSourceChanged().subscribe(null,x),x(t.selectedSource())}function C(t){it.setValue(t.value())}function x(t){ot.setValue(t)}function P(t){var e,i,o,n;if(t!==bt.value()){if(a.UndoHistory.beginUndoMacro("Symbol Lock"),t)for(e=ht.value(),i=e.getSymbol(),o=0;o<dt.length;o++)n=dt[o].chartWidget,n!==e&&n.getSymbol()!==i&&n.setSymbol(i);a.UndoHistory.setWatchedValue(bt,t,"Symbol Lock"),a.UndoHistory.endUndoMacro()}}function L(t){var e,i,o,n;if(t!==wt.value()){if(a.UndoHistory.beginUndoMacro("Interval Lock"),t)for(e=ht.value(),i=e.getResolution(),o=0;o<dt.length;o++)n=dt[o].chartWidget,n!==e&&n.getResolution()!==i&&n.setResolution(i);a.UndoHistory.setWatchedValue(wt,t,"Resolution Lock"),a.UndoHistory.endUndoMacro()}}function k(t){St.value()!==t&&a.UndoHistory.setWatchedValue(St,t,"Track Time")}function E(t){bt.value()?I(t):ht.value().setSymbol(t)}function I(t){var e,i,n=!1;for(e=0;e<dt.length;e++)i=dt[e].chartWidget,(i.model().mainSeries().properties().symbol.value()!==t||o.enabled("same_data_requery"))&&(n||(a.UndoHistory.beginUndoMacro("Change Symbol"),n=!0),i.setSymbol(t));n&&a.UndoHistory.endUndoMacro()}function A(t){var e,i,o;if(!yt)if(wt.value()){for(e=!1,i=0;i<dt.length;i++)o=dt[i].chartWidget,o.model().mainSeries().properties().interval.value()!==t&&(e||(a.UndoHistory.beginUndoMacro("Change Resolution"),e=!0),o.setResolution(t));e&&a.UndoHistory.endUndoMacro()}else ht.value().setResolution(t)}function V(t){var e,i,o;if(t&&t.onlyActiveChart||G)return{layout:"s",hidpiRatio:window.hidpiCanvasRatio||1,charts:[ht.value().images()]};for(e=[],i=gt.count,o=0;o<dt.length&&o<i;o++)e.push(dt[o].chartWidget.images());return{layout:mt,hidpiRatio:window.hidpiCanvasRatio||1,charts:e}}function M(){var t,e=[];for(t=0;t<dt.length&&t<gt.count;t++)e=e.concat(dt[t].chartWidget.tags());return e=$.unique(e),e=$.map(e,function(t){return t.toLowerCase().replace(/\W+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")})}function D(t,e,i,o){var n,s,r,a;if(i||xt&&!G)for(n=gt.count,s=0;s<dt.length&&s<n;s++)r=dt[s].chartWidget,r!==e&&(a=r.model(),a&&a.model().setExternalPosition(t,o))}function O(t,e){var i,o,n,s,r;if(St.value()){for(i=gt.count,a.UndoHistory.beginUndoMacro("Sync Time"),o=0;o<dt.length&&o<i;o++)if(n=dt[o].chartWidget,s=n.model()){if(r=s.model(),r===e)continue;s.gotoTime(t,{centerIfVisible:!1,model:e})}a.UndoHistory.endUndoMacro()}}function B(){return et.resolve(),dt.forEach(function(t){t.chartWidget.destroy()})}function R(){return et.promise()}function N(){J.id.setValue(void 0),J.uid.setValue(void 0),J.name.setValue(void 0)}function F(){var e={snapshotUrl:t.snapshotUrl},i=o.enabled("show_dialog_on_snapshot_ready")?TradingView.getImageOfChart:TradingView.getImageOfChartSilently;i(this,e,function(t){h.emit("onScreenshotReady",t)})}function z(){for(var t=s[mt].count;t<dt.length;t++)dt[t].chartWidget.destroy();dt.splice(s[mt].count)}function W(t){for(var e=0;e<dt.length;e++)dt[e].chartWidget.applyOverrides(t)}function H(){return Q}function U(t){return o.enabled("charting_library_base")?t:("s"!==t&&TradingView.trackGoProFeature("multipleCharts"),"s"===t||window.user&&user.is_pro||X.containsData||ct?t:(TVDialogs.showGoProDialog({feature:"multipleCharts"}),"s"))}function q(t){if(vt=[],t){t.charts||(t={layout:"s",charts:[t]}),mt=U(t.layout||"s");for(var e=0;e<t.charts.length;e++)vt.push({content:t.charts[e]});t.symbolLock&&bt.setValue(!0),t.intervalLock&&wt.setValue(!0),t.trackTimeLock&&St.setValue(!0),t.hideAllDrawings&&Tt.setValue(!0)}Y.setValue(mt),m(mt,G),l.hideAllDrawings().setValue(Tt.value()),vt.splice(0,vt.length)}function j(){--st,0===st&&h.emitOnce("onChartReady")}var Y,G,K,X,Z,J,Q,tt,et,it,ot,nt,st,rt=this,at=2,lt=0,ht=new e,ct=!1,dt=[],pt=[],ut=0,_t=0,ft=null,gt=null,mt="s",vt=[],yt=!1,bt=new e(!1),wt=new e(!1),St=new e(!1),Tt=new e(!1),Ct=new e(TVSettings.getBool("chart.syncCrosshair",!0)),xt=Ct.value();Ct.subscribe(function(t){t=!!t,xt=t,TVSettings.setValue("chart.syncCrosshair",t)}),Y=new e(mt),G=!1,K=new e(G),t=t||{},"padding"in t&&(at=t.padding),"edge"in t&&(lt=t.edge),X=t.widgetOptions||{},X.readOnly&&(ct=!0),Z=t.metaInfo||{},J={id:new e(Z.id),name:new e(Z.name),description:new e(Z.description),username:new e(Z.username),uid:new e(Z.uid)},Q=$(t.jqParent).eq(0),tt=t.onResize,et=$.Deferred(),this.updateLayout=p,it=new e,ot=new e,it.subscribe(function(t){var e,i,o=ht.value();o&&(e=o.model(),e&&(i=e.mainSeries().properties().style,i.value()!==t&&e.setChartStyleProperty(i,t,"Change Series Style")))}),nt=null,ht.subscribe(function(t){var e,i;if(t){for(i=dt.length;i--;)if(dt[i].chartWidget===t){e=i;break}if(!isFinite(e))throw Error("Cannot make detached ChartWidget active");if(_t!==e){for(_t=e,y(),pt.length&&(ut=pt.indexOf(dt[_t])),i=dt.length;i--;)dt[i].chartWidget.setActive(!1);t.setActive(!0)}S(t)}},{callWithLast:!0}),$.extend(this,{createChartWidget:g,getAll:function(){return dt.map(function(t){return t.chartWidget})},destroy:B,layout:Y,maximizeCurrentChart:K,activeChartWidget:ht,activeChartStyle:it,selectedSource:ot.readonly(),metaInfo:J,state:i,asyncState:n,readOnly:function(){return ct},lock:{symbol:bt,setSymbolLockWithUndo:P,interval:wt,setIntervalLockWithUndo:L,crosshair:Ct,trackTime:St,setTrackTimeWithUndo:k},setSymbol:E,setResolution:A,updateLayout:p,resizeWidgetsUI:_,images:V,tags:M,syncCrosshair:D,syncScroll:O,setSymbolAll:I,clearChartMetaInfo:N,
onfeatures:t.onfeatures,takeScreenshot:F,loadContent:q,purgeUnusedWidgets:z,applyOverrides:W,switchChart:w,createLogo:null,destroyPromise:R,getContainer:H}),q(t.onfeatures?void 0:t.content),Y.subscribe(function(t){y(),m(t,!1),pt=b(),ut=pt.indexOf(dt[_t])}),Y.hook=function(t){return t===this.value()?t:U(t)},ct&&(Y.writeLock=!0),K.subscribe(function(t){t!==G&&(pt=b(),m(mt,t))}),setInterval(f,1e3),$(window).on("resize",p),$(document).on("onUpdate",p),o.enabled("datasource_copypaste")&&(c.init(),t.globalEvents&&($(window).on("appclip:paste",function(t){ht.value().onAppClipboardPaste(),t.preventDefault()}),$(window).on("appclip:copy",function(t){ht.value().onAppClipboardCopy(),t.preventDefault()}),$(window).on("appclip:cut",function(t){ht.value().onAppClipboardCut(),t.preventDefault()}))),st=0,dt.forEach(function(t){if(t){st++;var e=t.chartWidget;e.withModel(null,function(){if(e.model().mainSeries().bars().size()>0)j();else{var t=function(){j(),e.model().mainSeries().onBarReceived().unsubscribe(null,t)};e.model().mainSeries().onBarReceived().subscribe(null,t)}})}})}var s=i(245),r=i(246),a=i(248),l=i(81),h=i(38),c=i(250),d=i(63);h=i(38),t.exports=n}).call(e,i(43),i(1))},function(t,e){"use strict";t.exports={s:{title:"1 chart",count:1,sizer:function(t,e,i,o){return{width:e.width-o-o,height:e.height-o-o,top:o,left:o}}}}},function(t,e,i){(function(e,o,n){"use strict";function s(t){var i,n,s,r,a,l,h,c,d,p,u,_,g,m,y,b,w,S,x,P,L,k=this;this._startSpinner(t.jqParent),T.init(),i=this,T.tool.subscribe(function(t){var e,o,n,s;i._model&&(e=t,i._model.model().setCurrentTool(e),TradingView.isMobile.any()&&(o=i._paneWidgets[0],v.isLineTool(e)&&"LineToolBrush"!==e?(n=.5*i._model.model().timeScale().width(),s=.5*o._state.defaultPriceScale().height(),i._model.model().setCurrentPosition(n,s,o._state),o._updateTooltip(n,s)):o._hideTooltip()),i._model&&TradingView.isMobile.any()&&i._model.model().crossHairSource().updateAllViews())}),n=function(t,e,i){var o,n=e.mainSeries().syncModel(),s=t.mainSeries().syncModel(),r=i;return n&&s&&(o=t._createSyncPoint(n,s),r=o.sourceTimeToTargetTime(i)),t.timeScale().points().roughIndex(r,s&&s.distance.bind(s))},s=function(t,e,i){var o,n=e.mainSeries().syncModel(),s=i.mainSeries().syncModel(),r=n&&s&&i._createSyncPoint(n,s);return r?(o=e.timeScale(),t.map(function(t){var e=$.extend({},t),a=o.timePointToIndex(e.time_t),l=t.timeStamp||o.points().roughTime(a+e.offset,n.projectTime.bind(n));return e.time_t=r.sourceTimeToTargetTime(l),e.index=i.timeScale().points().roughIndex(e.time_t,s&&s.distance.bind(s)),e.offset=0,e})):t},T.createdLineTool.subscribe(null,function(t){var e,i,o,s=k._model.model();t.model!==s&&(e=k._model.model().mainSeries().symbol(),e===t.symbol&&(i=s.paneForSource(k._model.model().mainSeries()),o={index:n(s,t.model,t.point.timeStamp),price:t.point.price},k._model.createLineTool(i,o,t.linetool,t.properties,t.linkKey)))}),T.continuedLineTool.subscribe(null,function(t){var e,i,o,r,a=k._model.model();t.model!==a&&(e={index:n(a,t.model,t.point.timeStamp),price:t.point.price},i=k._model.lineBeingCreated(),i&&(o=k._model.model().coninueCreatingLine(e,t.envState,!!t.finalState),o&&t.finalState&&(r=$.extend({},t.finalState),r.points=s(t.finalState.points,t.model,a),i.restoreExternalPoints(r))))}),T.cancelledLineTool.subscribe(null,function(t){var e=k._model.model();t.model!==e&&k._model.model().cancelCreatingLine()}),T.startedMovingLineTool.subscribe(null,function(t){var e,i,o,s=k._model.model();t.model!==s&&(e=k._model.model().mainSeries().symbol(),e===t.symbol&&(i=s.dataSources().filter(function(e){return e.linkKey===t.linkKey})[0],i&&i.isActualSymbol()&&(o={index:n(s,t.model,t.point.timeStamp),price:t.point.price},k._model.model().startMovingSource(i,o))))}),T.movedLineTool.subscribe(null,function(t){var e,i=k._model.model();t.model!==i&&i.sourceBeingMoved()&&i.sourceBeingMoved().linkKey===t.linkKey&&(e={index:n(i,t.model,t.point.timeStamp),price:t.point.price},k._model.model().moveSource(e))}),T.finishedMovingLineTool.subscribe(null,function(t){var e,i,o=k._model.model();t.model!==o&&(e=o.sourceBeingMoved(),e&&(k._model.model().endMovingSource(!!t.finalState),t.finalState&&(i=$.extend({},t.finalState),i.points=s(t.finalState.points,t.model,o),e.restoreExternalPoints(i))))}),T.startedChangingLineTool.subscribe(null,function(t){var e,i,o,s=k._model.model();t.model!==s&&(e=k._model.model().mainSeries().symbol(),e===t.symbol&&(i=s.dataSources().filter(function(e){return e.linkKey===t.linkKey})[0],i&&i.isActualSymbol()&&(o={index:n(s,t.model,t.point.timeStamp),price:t.point.price},k._model.model().startChangingLinetool(i,o,t.pointIndex,t.envState))))}),T.changedLineTool.subscribe(null,function(t){var e,i=k._model.model();t.model!==i&&i.lineBeingEdited()&&i.lineBeingEdited().linkKey===t.linkKey&&(e={index:n(i,t.model,t.point.timeStamp),price:t.point.price},k._model.model().changeLinePoint(e,t.envState))}),T.finishedChangingLineTool.subscribe(null,function(t){var e,i,o=k._model.model();t.model!==o&&(e=o.dataSources().filter(function(e){return e.linkKey===t.linkKey})[0],o.lineBeingEdited()&&k._model.model().endChangingLinetool(!!t.finalState),e&&e.isActualSymbol()&&t.finalState&&(i=$.extend({},t.finalState),i.points=s(t.finalState.points,t.model,o),e.restoreExternalPoints(i)))}),T.removedLineTool.subscribe(null,function(t){var e,i=k._model.model();t.model!==i&&(e=i.dataSources().filter(function(e){return e.linkKey===t.linkKey})[0],e&&k._model.model().removeSource(e))}),T.finishedLineTool.subscribe(null,function(t){var e,i=k._model.model();t.model!==i&&(e=i.dataSources().filter(function(e){return e.linkKey===t.linkKey})[0],e&&k._model.model().finishLineTool())}),T.changedLineStyle.subscribe(null,function(t){var e,i=k._model.model();t.model!==i&&(e=i.dataSources().filter(function(e){return e.linkKey===t.linkKey})[0],e&&(e.properties().merge(t.state),e.propertiesChanged()))}),T.restoredLineToolState.subscribe(null,function(t){var e,i,o=k._model.model();t.model!==o&&(e=o.dataSources().filter(function(e){return e.linkKey===t.linkKey})[0],e&&(i=$.extend({},t.state),i.points=s(t.state.points,t.model,o),i.indexes=i.points.map(function(t){return{index:t.index,price:t.price}}),o.restoreLineToolState(e,i)))}),T.restoredLineTool.subscribe(null,function(t){var e=k._model.model();t.model!==e&&e.restoreSource(t.state.restorePane,t.state.paneIndex,t.state.paneState,t.state.sourceState,t.state.priceScaleName)}),T.copiedLineTool.subscribe(null,function(t){var e,i,o,n,r,a,l=k._model.model();if(t.model!==l&&(e=k._model.model().mainSeries().symbol(),e===t.symbol)){if(t.model.mainSeries().syncModel(),l.mainSeries().syncModel(),i=l.paneForSource(k._model.model().mainSeries()),o=s(t.points,t.model,l),n=o[0],r=l.createLineTool(i,n,t.linetool,null,t.linkKey),l.lineBeingCreated())for(a=1;a<o.length;a++)a!==o.length-1||"LineToolBrush"!==t.linetool&&"LineToolGhostFeed"!==t.linetool||l.finishLineTool(!0),l.coninueCreatingLine(o[a],{},a<o.length-1,!0);r.properties().interval.setValue(t.state.interval),r.properties().merge(t.state),r.restoreData&&r.restoreData(t),r.propertiesChanged()}}),this._options=t=t||{},r=t.jqParent,a=t.sizeFunc,l=t.content,h=t.readOnly,c=t.containsData,d=t.onWidget,p=t.onCmeWidget,p&&TradingView.logWarn("[ChartWidget] 'onCmeWidget' option is depricated"),u=t.widgetCustomer,_=t.timezone,g=t.withDateRanges,m=t.hideSymbolSearch,y=t.defSymbol,b=t.defInterval,w=t.defExtendedHours,S=t.defTimeframe,x=$.inArray(t.defStyle,$.map($.grep(Object.keys(f),function(t){return/^STYLE_\w+/.test(t)}),function(t){return f[t]}))!==-1,P=x?t.defStyle:void 0,this._chartWidgetCollection=t.chartWidgetCollection||null,this._withDateRanges=(void 0===g?!h:!!g)&&e.enabled("timeframes_toolbar"),this._jqParent=void 0!==r?r:$(document.body),this._setContent(l),this._readOnly=h,this._containsData=c,this._defSymbol=y,this._defInterval=b,this._defTimeframe=S,this._defStyle=P,this._onWidget=!!d,this._onWidget&&(p?this._widgetCustomer="cme":u&&(this._widgetCustomer=u)),this._sizeFunc=a||function(){var t=k._jqParent.width(),e=k._jqParent.height(),i=k._jqParent[0];return window.self!==window.top&&i.offsetWidth<i.clientWidth&&i.getBoundingClientRect().width<100&&(t=Math.round(100*i.getBoundingClientRect().width),e=Math.round(100*i.getBoundingClientRect().height)),new N(0,0,t,e-(k._withDateRanges?22:0))},this._hideSymbolSearch=m,this._jqMainDiv=null,this._rect=this._sizeFunc(),this._jqMainTable=null,this._paneWidgets=[],this._paneSeparators=[],this._timeAxisWidget=null,this._frameTime=30,this._model=null,this._metaInfo={},L=this._contentSeriesProperties(),L&&(y=L.symbol,b=L.interval),void 0===C||C.isValid(b)||(b=void 0),this._properties=new M("chartproperties"),this._properties.mainSeriesProperties.merge(defaults("chartproperties.mainSeriesProperties")),this._properties.mainSeriesProperties.merge({visible:!0,symbol:y||DEFAULT_SYMBOL,shortName:"",timeframe:"",onWidget:this._onWidget,interval:b||"D",style:P,extendedHours:w,lineStyle:{styleType:TradingView.factoryDefaults("chartproperties.mainSeriesProperties.lineStyle.styleType")}}),this._containsData&&this._properties.mainSeriesProperties.merge({showCountdown:!1}),_&&TradingView.timezoneIsAvailable(_)&&this._properties.timezone.setValue(_),this._tagsChanged=new o,this._modelCreated=new o,this._disconnected=new o,this._reconnectBailout=new o,this._connected=new o,this._redrawPanes=new o,this.chartWidgetInitialized=new o,this._studiesMetaData=[],this._studiesMigrations=[],this._chartSession=new O(ChartApiInstance),this.lhsPriceAxisWidthChanged=new o,this.rhsPriceAxisWidthChanged=new o,this.createLogo=null,this._isActive=t.isActive}function r(t){return t.description_localized=$.t(t.description,{context:"study"}),t}var a=i(247),l=i(336),h=i(248),c=i(337),d=i(258),p=i(324),u=i(338),_=(i(148),i(236).BarsMarksContainer),f=i(84),g=i(320),m=i(150).Study,v=i(74).LineDataSource,y=i(339),b=i(141),w=b.Action,S=b.ActionSeparator,T=i(81),C=i(41),x=i(440),P=i(447),L=i(448),k=(i(111),i(113)),E=i(434),I=i(42),A=i(54),V=i(39),M=(i(44),i(80).DefaultProperty),D=i(45).availableTimezones,O=i(109),B=(i(112),i(114)),R=i(55),N=(R.addCanvasTo,R.Rect),F=R.Size,z=R.setAbsoluteRect;s.prototype.refreshMarks=function(){this.model().barsMarksSources().forEach(function(t){t.refreshData()})},s.prototype.clearMarks=function(){this.model().barsMarksSources().forEach(function(t){t.clearMarks()})},s._nextMetadataId=1,s.prototype._setAlertsStudiesList=function(t){this._alertsStudiesList=$.map($.grep(t,function(t){var e,i=t.plots||[];for(e=0;e<i.length;e++)if("line"===i[e].type)return!0;return!1}),function(t){return t.id})},s.prototype.canCreateAlertForDataSource=function(t){if(!e.enabled("alerts"))return!1},s._filterAuthorizedMetaInfo=function(t){var e,i,o,n,s=[];for(e=0;t&&e<t.length;++e)i=t[e],o=B.parseIdString(i.id),n=o.productId,pro.hasPackage(n)&&s.push(i);return s},s.prototype.privateMetaInfo=function(t){if(t){var e=new t(B.CURRENT_METAINFO_FORMAT_VERSION);return e.generateMetaInfo()}return[]},s.prototype._onScriptSources=function(t,e){var i,o,n,s,r,a,l,h;if(TradingView.logDebugChart("ChartWidget _onScriptSources called"),!this.onWidget()){for(i=null,o=0;o<e.length;++o)if(n=e[o],n.id.startsWith("Script@tv-scripting-")){i=B.parseIdString(n.id).version;break}if(null!=i){for(this.studyScriptingPkgVers=i,s=0,r=0,o=0;o<t.length;++o)if(a=t[o],TradingView.isFeatureEnabled("backtesting")||!a.isTVScriptStrategy){l=a.scriptName,s++;try{h=B.createMetaInfoStub(a,i),e.push(h)}catch(t){TradingView.logError("Could not process script (skipped): "+l+" ("+t.message+")"),r++}}TradingView.logDebugChart("User's Pine Scripts loaded "+s+", skipped "+r)}else TradingView.logError("Could not find tv-scripting package in metadata response")}for(o=0;o<e.length;o++)B.addStudyMetaInfo(this._studiesMetaData,e[o]);this._init(),this.chartWidgetInitialized.fire(),TradingView.logDebugChart("ChartWidget _onScriptSources done")},s.prototype._init=function(){var t,o=this;this._containsData||this._content&&this._content.timeScale&&!this._content.timeScale.m_lastVisibleBar&&(this._content.timeScale.m_rightOffset=this._properties.timeScale.rightOffset.value()),this.model()&&this.model().mainSeries().clearData(),this.initColors(),this._makeDefaultGui(),this._makeDefaultModel(),this._checkObsoleteTimezone(),this._chartSession&&this._chartSession.connected()&&this._model.restart(),this._content&&(this.initColors(),this._updateGui(),this.update()),o._model.mainSeries().marketStatus.subscribe(function(t){o.indicatorImage&&o._updateDataAndMarketStatus(t,o._model.mainSeries().status())},{callWithLast:!0}),this._resizeHandler=function(t){this._rect=this._sizeFunc(),t&&(this._rect.w+=t,this._rect.h+=t),z(this._jqMainDiv,this._rect),this._adjustSize(),this._model&&this._model.mainSeries().requestMoreData(),t||(this.paint(),this.resizeSeriesControlUI(),this.checkCompactMode(),this.resizeIndicator())}.bind(this),this._resizeHandler(),this._jqMainDiv.appendTo(this._jqParent),this._spinner&&(this._spinner.stop(),delete this._spinner),t=i(71),t.isFeatureEnabled("chrome_canvas_fix")&&navigator.userAgent.match(/windows.+chrome/i)&&$(window).on("visibilitychange",function(t,e){e&&(o._resizeHandler(1),setTimeout(function(){o._resizeHandler()},0))}),$(window).keydown(function(t){27===t.which&&t.preventDefault()}),this._containsData||this._jqMainDiv.mousewheel(function(t,i,o,n){var s,r,a,l,h;if((TradingView.onWidget()||!parent||parent===window||!parent.IS_DEMO_PAGE)&&this.model()&&!this.noScroll&&!this.model().timeScale().isEmpty())return s=t.pageX-5,r=this._paneWidgets[0].lhsPriceAxisWidget.size.w,a=this._timeAxisWidget.size.w,r&&(s=Math.max(0,s-r)),s=Math.min(s,a),l=e.enabled("right_bar_stays_on_scroll")?1:2*(s/a-.5),h=Math.min(1,Math.abs(n)),n>0?this.model().zoomIn(l,h):n<0&&this.model().zoomOut(l,h),o&&this.model().scrollChart(o*-80),!1}.bind(this)),this._initBarsMarksSources(),TradingView.isFeatureEnabled("esdindicatorfeature")&&this.initESDTimelineWidget(),this.setAutoScaleOnSymbolChange(),this.readOnly()||this._hideSymbolSearch||V.registerDialogKeypressHandler(this),this.adaptOnChartLogo()},s.prototype._checkObsoleteTimezone=function(){var t=this._properties.timezone.value();TradingView.timezoneIsAvailable(t)||this._properties.timezone.setValue(TradingView.getTzByObsoleteName(t))},s.prototype._initBarsMarksSources=function(){var t=this;this.withModel(this,function(){this.model().barsMarksSources().forEach(function(e){e.onNeedRepaint.subscribe(t,t.paint)})})},s.prototype.initESDTimelineWidget=function(){new ESDTimelineWidget(this)},s.prototype.setAutoScaleOnSymbolChange=function(){this.withModel(this,function(){this.model().mainSeries().properties().symbol.listeners().subscribe(this,function(){(!this.model().mainSeries()instanceof f||!this.model().mainSeries().properties().lockScale.value())&&this.model().mainSeries().priceScale().setAutoScale(!0)})})},s.prototype.initColors=function(){this._properties.paneProperties.background.listeners().subscribe(this,s.prototype.setBackgroundColor),this._properties.paneProperties.vertGridProperties.color.listeners().subscribe(this,s.prototype.redrawPanes),this._properties.paneProperties.horzGridProperties.color.listeners().subscribe(this,s.prototype.redrawPanes),this._properties.scalesProperties.lineColor.listeners().subscribe(this,s.prototype.setScaleLineColor),this._properties.scalesProperties.textColor.listeners().subscribe(this,s.prototype.setScaleTextColor)},s.prototype.paneWidgets=function(){return this._paneWidgets},s.prototype.paneByCanvas=function(t){for(var e=0;e<this._paneWidgets.length;e++)if(this._paneWidgets[e].canvas===t||this._paneWidgets[e].top_canvas===t)return this._paneWidgets[e];return null},s.prototype.paneByState=function(t){for(var e=0;e<this._paneWidgets.length;e++)if(this._paneWidgets[e]._state===t)return this._paneWidgets[e];return null},s.prototype.priceAxisByCanvas=function(t){var e,i,o;for(e=0;e<this._paneWidgets.length;e++)if(i=this._paneWidgets[e],o=i.priceAxisByCanvas(t))return o;return null},s.prototype.timeAxisByCanvas=function(t){return t===this._timeAxisWidget.canvas||t===this._timeAxisWidget.top_canvas?this._timeAxisWidget:null},s.prototype.properties=function(){return this._properties},s.prototype.emulateCriticalError=function(){this._chartSession.removeSeries(-1,null)},s.prototype.readOnly=function(){return this._readOnly},s.prototype.onDisconnected=function(){return this._disconnected},s.prototype.onReconnectBailout=function(){return this._reconnectBailout},s.prototype.onConnected=function(){return this._connected},s.prototype.onRedrawPanes=function(){return this._redrawPanes},s.prototype.modelCreated=function(){return this._modelCreated},s.prototype.setResolution=function(t){if(!this._model)return void this._properties.mainSeriesProperties.merge({interval:t});var e=this._model.mainSeries().properties().interval;this._model.setScreenChartProperty(e,t,this,$.t("Change Resolution"))},s.prototype.getResolution=function(){return this._model?this._model.mainSeries().properties().interval.value():this._properties.mainSeriesProperties.interval.value()},s.prototype.addSymbol=function(t,i){var o=this.model(),n=o.studiesMetaData(),s="study_Overlay@tv-basicstudies",r=e.enabled("use_overrides_for_overlay")&&TradingView.defaultProperties[s]&&TradingView.defaultProperties[s].style,a=r||(o.mainSeries().properties().style.value()===f.STYLE_CANDLES?f.STYLE_BARS:f.STYLE_CANDLES),l={inputs:{symbol:t},style:a},h=n.filter(function(t){return"Overlay@tv-basicstudies"===t.id})[0];o.insertStudy(h,l,i)},s.prototype.addSymbolDialog=function(){TVDialogs.showAddSymbolDialog(this,{overlayOption:!0,callback:this.addSymbol.bind(this)})},s.prototype.updateActions=function(){function t(t){function e(){TradingView.showThemeSaveDialog(h._model)}var i,o;c.applyColorTheme.subActions||(c.applyColorTheme.subActions=[]),i=c.applyColorTheme.subActions,i.splice(0,i.length),is_authenticated&&(o=new w({text:$.t("Save As...")}),o.callbacks().subscribe(null,e),i.push(o),i.push(new S)),t&&t.length?$.each(t,function(t,e){function o(t){return function(){var e=$.t("Do you really want to delete __themename__ theme?",{themename:t?'"'+t+'"':""});return TVDialogs.showConfirm($.t("Theme"),e,function(){$.post("/remove-theme/",{name:t}).error(function(t){TradingView.logError(t.responseText)}),TradingView.getThemesList.invalidate()}),this._parentMenu._parentMenuItem._parentMenu.destroy(),!1}}var n=new w({text:$.t(e)});n.callbacks().subscribe(null,function(){$.getJSON("/theme/?themeName="+encodeURIComponent(e),function(t){h.model().model().restoreTheme(JSON.parse(t.content))})}),is_authenticated&&(n.deleteButton={action:o(n.text)}),i.push(n)}):i.push(new w({text:$.t("No color themes saved"),enabled:!1}))}function e(){var t,e,i=studyTemplates.plainList("custom"),o=studyTemplates.plainList("default");c.applyStudyTemplate.subActions||(c.applyStudyTemplate.subActions=[]),t=c.applyStudyTemplate.subActions,t.splice(0,t.length),e=new w({text:studyTemplates._SAVE_AS_TITLE}),e.callbacks().subscribe(studyTemplates,studyTemplates.showSaveAsDiaolg),t.push(e),t.push(new S),i.length||o.length?(i.length&&($.each(i,function(e,i){function o(t){return function(){return studyTemplates.deleteStudyTemplate(t),this._parentMenu._parentMenuItem._parentMenu.destroy(),!1}}var n=new w({text:i});n.callbacks().subscribe(studyTemplates,function(){this.applyStudyTemplate(i)}),n.deleteButton={action:o(n.text)},t.push(n)}),o.length&&t.push(new S)),$.each(o,function(e,i){var o=new w({text:i});o.callbacks().subscribe(studyTemplates,function(){this.applyStudyTemplate(i)}),t.push(o)})):t.push(new w({text:$.t("No study templates saved"),enabled:!1}))}var i,o,n,s,r,a,l,h=this,c=this.actions(),d=this._model.dataSources(),p=!1,u=!1;for(i=0,o=d.length;i<o;i++)n=d[i],TradingView.isInherited(n.constructor,v)&&n.isUserDeletable()&&(p=!0),TradingView.isInherited(n.constructor,m)&&n.removeByRemoveAllStudies()&&(u=!0);this._readOnly||(c.paneRemoveAllStudies&&c.paneRemoveAllStudies.setEnabled(u),c.paneRemoveAllDrawingTools&&c.paneRemoveAllDrawingTools.setEnabled(p),c.paneRemoveAllStudiesDrawingTools&&c.paneRemoveAllStudiesDrawingTools.setEnabled(u||p)),t(TradingView.getThemesList(t)),window.studyTemplates&&(e(),studyTemplates.refreshStudyTemplateList(e)),s=this,r=[],a=D,l=function(t){return t.id===s.model().model().properties().timezone.value()},a.forEach(function(t){if(!t.separator){var e=new w({text:t.title,checkable:!0,checked:l(t)});e.callbacks().subscribe(this,function(){s.model().setProperty(s.model().model().properties().timezone,t.id,"Changed Time Zone")}),r.push(e)}},this),c.applyTimeZone.subActions=r,c.addToWatchlist.text=$.t("Add {0} To Watchlist").format(this.getSymbol(!0)),c.addToTextNotes&&(c.addToTextNotes.text=$.t("Add Text Note For {0}").format(this.getSymbol(!0))),this.updateActionForIntradayOnly(c.sessionBreaks)},s.prototype.actions=function(){return this._actions||this._setActions(),this._actions},s.prototype._setActions=function(){var t,o,n,r,a,l,c,d,p,u,_,f,g,m,v,y,b,C,x,P,E,M,D,O,B,R,N,F,z,W,H,U,q,j,Y,G,K,X,Z,J,Q,tt,et,it,ot,nt,st,rt,at,lt,ht,ct,dt,pt,ut,_t=i(262).ActionBinder,ft=this,gt=[];if(!this._readOnly)for(gt=[new w({text:$.t("Eraser"),callbackContext:"eraser"}),new S,new w({text:$.t("Trend Line"),callbackContext:"LineToolTrendLine"}),new w({text:$.t("Horizontal Line"),callbackContext:"LineToolHorzLine"}),new w({text:$.t("Vertical Line"),callbackContext:"LineToolVertLine"}),new w({text:$.t("Arrow"),callbackContext:"LineToolArrow"}),new w({text:$.t("Ray"),callbackContext:"LineToolRay"}),new w({text:$.t("Extended"),callbackContext:"LineToolExtended"}),new w({text:$.t("Parallel Channel"),callbackContext:"LineToolParallelChannel"}),new S,new w({text:$.t("Pitchfork"),callbackContext:"LineToolPitchfork"}),new w({text:$.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork"}),new w({text:$.t("Pitchfan"),callbackContext:"LineToolPitchfan"}),new w({text:$.t("Gann Square"),callbackContext:"LineToolGannSquare"}),new w({text:$.t("Gann Fan"),callbackContext:"LineToolGannFan"}),new w({text:$.t("Fib Retracement"),callbackContext:"LineToolFibRetracement"}),new w({text:$.t("Trend-Based Fib Extension"),callbackContext:"LineToolTrendBasedFibExtension"}),new w({text:$.t("Fib Speed Resistance Fan"),callbackContext:"LineToolFibSpeedResistanceFan"}),new w({text:$.t("Fib Time Zone"),callbackContext:"LineToolFibTimeZone"}),new w({text:$.t("Circle Lines"),callbackContext:"LineToolCircleLines"}),new w({text:$.t("Fib Circles"),callbackContext:"LineToolFibCircles"}),new w({text:$.t("Fib Speed Resistance Arcs"),callbackContext:"LineToolFibSpeedResistanceArcs"}),new S,new w({text:$.t("Rectangle"),callbackContext:"LineToolRectangle"}),new w({text:$.t("Ellipse"),callbackContext:"LineToolEllipse"}),new w({text:$.t("Triangle"),callbackContext:"LineToolTriangle"}),new w({text:$.t("Polyline"),callbackContext:"LineToolPolyline"}),new w({text:$.t("Arc"),callbackContext:"LineToolArc"}),new S,new w({text:$.t("Text"),callbackContext:"LineToolText"}),new w({text:$.t("Anchored Text"),callbackContext:"LineToolTextAbsolute"}),new w({text:$.t("Balloon"),callbackContext:"LineToolBalloon"}),new w({text:$.t("Price Label"),callbackContext:"LineToolPriceLabel"}),new S,new w({text:$.t("Elliott Wave Subminuette"),callbackContext:"LineToolElliottSubminuette"}),new w({text:$.t("Elliott Wave Minor"),callbackContext:"LineToolElliottMinor"}),new w({text:$.t("Elliott Wave Circle"),callbackContext:"LineToolElliottCircle"}),new w({text:$.t("Elliott Minor Retracement"),callbackContext:"LineToolElliottMinorRetr"}),new w({text:$.t("Elliott Major Retracement"),callbackContext:"LineToolElliottMajorRetr"}),new S,new w({text:$.t("Brush"),callbackContext:"LineToolBrush"}),new S,new w({text:$.t("Forecast"),callbackContext:"LineToolPrediction"})],ft=this,t=function(t){T.tool.setValue(t.callbackContext())},o=0;o<gt.length;o++)gt[o].callbacks().subscribe(null,t);n=new w({text:$.t("Add Alert"),shortcut:"Alt+A"}),r=new w({text:$.t("Reset Chart"),shortcut:"Alt+R"}),r.callbacks().subscribe(this,this.GUIResetScales),a=new w({text:$.t("Undo"),shortcut:"ctrl+z"}),a.callbacks().subscribe(null,function(){TradingView.trackEvent("GUI","Undo"),h.UndoHistory.undo()}),a.disable(),l=new w({text:$.t("Redo"),shortcut:"ctrl+y"}),l.callbacks().subscribe(null,function(){TradingView.trackEvent("GUI","Redo"),h.UndoHistory.redo()}),l.disable(),h.UndoHistory.undoStack().onChange().subscribe(this,this.updateUndoRedo),h.UndoHistory.redoStack().onChange().subscribe(this,this.updateUndoRedo),c=new w({text:$.t("Color Theme")}),d=new w({text:$.t("TimeZone")}),p=new w({text:$.t("Change Symbol..."),shortcut:$.t("Any Symbol"),doNotBindShortcut:!0}),TVSettings.setValue("symboledit.dialog_last_entry",""),p.callbacks().subscribe(this,function(){V.showDialog({callback:this.setSymbol.bind(this)})}),u=new w({text:$.t("Change Interval..."),shortcut:$.t("Any Number"),doNotBindShortcut:!0}),u.callbacks().subscribe(this,function(){new A({callback:function(t){I.interval.setValue(t)}}).show()}),TradingView.onWidget()||(_=new w({text:$.t("Add To Watchlist"),shortcut:"Alt+W"}),f=new w({text:$.t("Add To Text Notes"),shortcut:"Alt+N"}),_.callbacks().subscribe(this,function(){var t,e,i=widgetbar.setPage("base");for(e=0;e<i.widgets.length;e++)if("watchlist"===i.widgets[e].type){t=i.widgets[e].widgetObject;break}t&&t.addHighlight(this.getSymbol())}),f.callbacks().subscribe(this,function(){var t=this;runOrSignIn(function(){TradingView.bottomWidgetBar.toggleWidget("text_notes",!0),TradingView.bottomWidgetBar._widgets.text_notes.addNote(null,t.getSymbol(!0),t.getSymbol())},{source:"Add text note in chart context menu"})})),g=new w({text:$.t("Insert Study Template")}),m=new w({shortcut:"ctrl+alt+q",text:$.t("Reset Scale")}),m.callbacks().subscribe(null,function(t){ft.model().resetTimeScale()}),v=new w({text:$.t("Insert Drawing Tool"),subActions:gt}),y=new w({text:$.t("Remove All Indicators")}),b=new w({text:$.t("Remove All Drawing Tools")}),C=new w({text:$.t("All Indicators And Drawing Tools")}),x=new w({text:$.t("Insert Indicator..."),shortcut:"/"}),P=new w({text:$.t("Script Editor...")}),E=new w({text:$.t("Compare or Add Symbol...")}),M=new w({text:$.t("Compare...")}),D=new w({text:$.t("Objects Tree...")}),O=new w({text:$.t("Properties..."),callback:function(t,e){ft.showChartProperties()}}),B=new w({text:$.t("Scales Properties...")}),R=new w({text:$.t("Timezone/Sessions Properties...")}),N=new w({text:$.t("Lock/Unlock")}),N.callbacks().subscribe(this,s.prototype.toggleLockSelectedObject),F=new w({text:$.t("Hide")}),F.callbacks().subscribe(this,s.prototype.hideSelectedObject),z=new w({text:$.t("Format...")}),z.callbacks().subscribe(this,s.prototype.editSelectedObject),W=new w({text:$.t("Source Code...")}),W.callbacks().subscribe(this,this.openSelectedObjectSource),H=new w({text:$.t("Left Axis"),checkable:!0}),H.binder=new _t(H,this._properties.scalesProperties.showLeftScale,this.model(),$.t("Show Left Scale")),U=new w({text:$.t("Right Axis"),checkable:!0}),U.binder=new _t(U,this._properties.scalesProperties.showRightScale,this.model(),$.t("Show Right Scale")),this._properties.scalesProperties.showLeftScale.listeners().subscribe(this,s.prototype._updateScalesActions),this._properties.scalesProperties.showRightScale.listeners().subscribe(this,s.prototype._updateScalesActions),q=new w({text:$.t("Scale Price Chart Only"),checkable:!0}),q.binder=new _t(q,this._properties.scalesProperties.scaleSeriesOnly,this.model(),$.t("Scale Price Chart Only")),j=this.model().model(),this._properties.scalesProperties.scaleSeriesOnly.listeners().subscribe(null,function(){j.recalculateAllPanes(),j.invalidate(new k(k.FULL_UPDATE))}),Y=new w({text:$.t("Drawings Toolbar"),checkable:!0}),window.sideToolbar&&(Y.binder=new _t(Y,window.sideToolbar.visible,this.model(),$.t("Drawings Toolbar"))),G=new w({text:$.t("Favorite Drawings Toolbar"),checkable:!0}),window.sideToolbar&&window.sideToolbar.favoriteDrawingToolbar&&(G.binder=new _t(G,window.sideToolbar.favoriteDrawingToolbar.visibleProperty,this.model(),$.t("Drawings Toolbar"))),K=new w({text:$.t("Magnet Mode"),checkable:!0}),K.binder=new _t(K,T.properties().magnet,this.model(),"Magnet"),X=new w({text:$.t("Stay In Drawing Mode"),checkable:!0}),X.binder=new _t(X,T.properties().stayInDrawingMode,this.model(),$.t("Stay In Drawing Mode")),Z=new w({text:$.t("Sync drawings to all charts"),checkable:!0}),Z.binder=new _t(Z,T.properties().drawOnAllCharts,this.model(),"SyncDrawings"),J=new w({text:$.t("Lock All Drawing Tools"),checkable:!0}),J.binder=new _t(J,T.lockDrawings(),this.model(),$.t("Lock drawings"),function(t){t||this.binder.setValue(!this.binder.value()),T.lockDrawings().setValue(this.binder.value())}.bind(J)),Q=new w({text:$.t("Hide All Drawing Tools"),checkable:!0}),Q.binder=new _t(Q,T.hideAllDrawings(),this.model(),$.t("Hide All Drawing Tools"),function(t){t||this.binder.setValue(!this.binder.value()),T.hideAllDrawings().setValue(this.binder.value())}.bind(Q)),tt=new w({text:$.t("Hide Marks On Bars"),checkable:!0}),tt.binder=new _t(tt,T.hideMarksOnBars(),this.model(),$.t("Hide Marks On Bars"),function(t){t||this.binder.setValue(!this.binder.value()),T.hideMarksOnBars().setValue(this.binder.value())}.bind(tt)),et=new w({text:$.t("Extended Hours"),checkable:!0}),et.binder=new _t(et,this.model().mainSeries().properties().extendedHours,this.model(),$.t("Change Extended Hours")),it=new w({text:$.t("Symbol Last Value"),checkable:!0,checked:!1}),it.binder=new _t(it,this.properties().scalesProperties.showSeriesLastValue,this.model(),$.t("Show Symbol Last Value")),ot=new w({text:$.t("Symbol Labels"),checkable:!0,checked:!1}),ot.binding=new _t(ot,this.properties().scalesProperties.showSymbolLabels,this.model(),"Undo Show Symbol Labels"),nt=new w({text:$.t("Indicator Last Value"),checkable:!0,checked:!1}),nt.binder=new _t(nt,this.properties().scalesProperties.showStudyLastValue,this.model(),$.t("Show Indicator Last Value")),st=new w({text:$.t("Indicator Labels"),checkable:!0,checked:!1}),st.binding=new _t(st,this.properties().scalesProperties.showStudyPlotLabels,this.model(),"Undo Show Indicator Labels"),rt=new w({text:$.t("Countdown"),checkable:!0,checked:!1}),rt.binder=new _t(rt,this.model().mainSeries().properties().showCountdown,this.model(),$.t("Show Countdown")),at=new w({text:$.t("Symbol Info..."),checkable:!1}),at.callbacks().subscribe(null,function(){var t=ft.model().mainSeries().symbol(),e=ft.model().mainSeries().symbolInfo();L(t,{symbolInfo:e})}),ft.onWidget()||(lt=new w({text:$.t("Snapshot"),shortcut:"Alt+s"}),lt.callbacks().subscribe(null,function(){ft._chartWidgetCollection.takeScreenshot()}),ht=new w({text:$.t("Publish idea"),shortcut:"Alt+p"}),ht.callbacks().subscribe(null,function(){TradingView.Common.publishChart()}),ct=new w({text:$.t("Switch to the next chart"),shortcut:"Tab"}),ct.callbacks().subscribe(null,function(){ft._chartWidgetCollection.switchChart()})),this._actions={chartProperties:O,timeScaleReset:m,chartReset:r,compareOrAdd:E,compare:M,scalesProperties:B,tmzProperties:R,paneObjectTree:D,insertIndicator:x,insertDrawingTool:v,applyColorTheme:c,applyStudyTemplate:g,symbolSearch:p,showSymbolInfoDialog:at,changeInterval:u,seriesHide:F,studyHide:F,lineToggleLock:N,lineHide:F,showLeftAxis:H,showRightAxis:U,scaleSeriesOnly:q,drawingToolbarAction:Y,favoriteDrawingToolbar:G,magnetAction:K,stayInDrawingModeAction:X,syncModeAction:Z,lockDrawingsAction:J,hideAllDrawingsAction:Q,hideAllMarks:tt,applyTimeZone:d,extendedHours:et,showCountdown:rt,showSeriesLastValue:it,showSymbolLabelsAction:ot,showStudyLastValue:nt,showStudyPlotNamesAction:st,undo:a,redo:l,viewSourceCode:W,takeScreenshot:lt},TradingView.onWidget()||(this._actions.addToWatchlist=_),!TradingView.onWidget()&&e.enabled("text_notes")&&(this._actions.addToTextNotes=f),e.enabled("charting_library_base")||(TradingView.onWidget()||(this._actions.gotoDate=gotoDateAction),this._actions.scriptEditor=P),this.createSessionBreaksActions(),this.readOnly()||(dt=new w({text:$.t("Remove"),shortcut:"Del"
}),dt.callbacks().subscribe(this,function(){var t;this._chartWidgetCollection&&(t=this._chartWidgetCollection.activeChartWidget.value()),t||(t=this),t.removeSelectedSource()}),pt=new w({text:$.t("Stop syncing drawing")}),pt.callbacks().subscribe(this,function(){var t;this._chartWidgetCollection&&(t=this._chartWidgetCollection.activeChartWidget.value()),t||(t=this),t.unlinkSelectedLine()}),ut=new w({text:$.t("Sync drawing to all charts")}),ut.callbacks().subscribe(this,function(){var t;this._chartWidgetCollection&&(t=this._chartWidgetCollection.activeChartWidget.value()),t||(t=this),t.copyLineToOtherCharts()}),this._actions.insertDrawingTool=v,this._actions.paneRemoveAllStudies=y,this._actions.paneRemoveAllDrawingTools=b,this._actions.paneRemoveAllStudiesDrawingTools=C,this._actions.seriesRemove=dt,this._actions.studyRemove=dt,this._actions.lineRemove=dt,this._actions.lineUnlink=pt,this._actions.lineCopyToCharts=ut,this._actions.format=z,this._actions.lockDrawingsAction=J,this._actions.hideAllDrawingsAction=Q,this._actions.hideAllMarks=tt,this._actions.paneRemoveAllStudies.callbacks().subscribe(this,s.prototype.removeAllStudies),this._actions.paneRemoveAllDrawingTools.callbacks().subscribe(this,s.prototype.removeAllDrawingTools),this._actions.paneRemoveAllStudiesDrawingTools.callbacks().subscribe(this,s.prototype.removeAllStudiesDrawingTools)),this._actions.paneObjectTree.callbacks().subscribe(this,s.prototype.showSourceProperties),this._actions.chartProperties.callbacks().subscribe(this,s.prototype.showChartProperties),this._actions.insertIndicator.callbacks().subscribe(this,s.prototype.showIndicators),this._actions.scriptEditor&&this._actions.scriptEditor.callbacks().subscribe(this,s.prototype.showScriptEditor),this._actions.compareOrAdd.callbacks().subscribe(this,s.prototype.showCompareOrAdd),this._actions.compare.callbacks().subscribe(this,s.prototype.showCompareOrAdd),this._actions.scalesProperties.callbacks().subscribe(this,s.prototype.showScalesProperties),this._actions.tmzProperties.callbacks().subscribe(this,s.prototype.showTimezoneProperties),this._updateScalesActions()},s.prototype.executeActionByName=function(t){function e(t){var e,o;for(e in i._actions)if(o=i._actions[e],o.text.toLowerCase()===t.toLowerCase())return o;return null}var i=this,o=e(t);return o?void o.callbacks().fire():void TradingView.logWarn("Unknown action: "+t)},s.prototype.executeActionById=function(t){if(t in this._actions){var e=this._actions[t];e.checkable&&e.setChecked(!e.checked),this._actions[t].callbacks().fire(e)}else console.warn("Unknown action id: "+t)},s.prototype.getCheckableActionState=function(t){if(t in this._actions){var e=this._actions[t];if(e.checkable)return e.checked;console.warn("Action "+t+" has no state")}else console.warn("Unknown action id: "+t);return null},s.prototype._updateScalesActions=function(){if(this._actions){for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].updateScalesVisibility();this._timeAxisWidget.updatePriceScalesVisibility(),this._update(new k(k.FULL_UPDATE))}},s.prototype.removeAllStudies=function(){this._model.removeAllStudies()},s.prototype.removeAllDrawingTools=function(){this._model.removeAllDrawingTools()},s.prototype.removeAllStudiesDrawingTools=function(){this._model.removeAllStudies(),this._model.removeAllDrawingTools()},s.prototype.model=function(){return this._model},s.prototype.connect=function(){this._handler=function(t){this._onData(t)}.bind(this),this._chartSession.connect(this._handler)},s.prototype.finishInitWithoutConnect=function(){this._chartSession.disable(),this._init(),this.chartWidgetInitialized.fire()},s.prototype.update=function(){if(this._model){for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].update();this._timeAxisWidget.update()}},s.prototype.paint=function(t){t||(t=new k(k.FULL_UPDATE));for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].paint(t.invalidateForPane(e),!1);this._timeAxisWidget&&this._timeAxisWidget.paint(t.fullInvalidation()),this._redrawPanes.fire()},s.prototype._makeDefaultGui=function(){this._makeChartWidget(),this._makeLoadingScreen(),this._makeMasterTable(),this._makeTimeAxisWidget(),this._adjustSize(),this._updateScalesActions(),$("*",this._jqMainTable).selectable(!1),this.update(),this.paint()},s.prototype.widget=function(){return this._jqMainDiv},s.prototype.restoreState=function(t,e){this._adjustSize();var i=this._model.restoreState(this._content,e);this._setActions(),i.lines_limit_exceeded&&TVDialogs.showLineToolsWarning(i.line_tools_count,this,this._model)},s.prototype.redrawPanes=function(t){for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].paint();this._redrawPanes.fire()},s.prototype.adaptOnChartLogo=function(t){e.enabled("adapt_onchart_logo_background")&&(t=t||this._properties.paneProperties.background.value(),$(this._jqMainDiv).find(".onchart-custom-logo .wrapper .inner").css("background-color",TradingView.generateColor(t,50)),$(this._jqMainDiv).find(".onchart-tv-logo .wrapper .inner").css("background-color",TradingView.generateColor(t,20)))},s.prototype.setBackgroundColor=function(t){this.adaptOnChartLogo(t.value()),this.scaleBackgroundColor=t.value();for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].paint(),this._paneWidgets[e].setCursorForTool();this.update(),this.paint()},s.prototype.setScaleLineColor=function(t){this.scaleLineColor=t.value(),$.each(this._paneSeparators,function(){this.update()}),this.update(),this.paint()},s.prototype.setScaleTextColor=function(t){this.scaleTextColor=t.value(),this.update(),this.paint()},s.prototype._update=function(t){var e;if(this.performance&&t.start(),t&&t.fullInvalidation()!==k.FULL_UPDATE){if(t.fullInvalidation()===k.LIGHT_UPDATE){for(this._timeAxisWidget.update(),e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].statusWidget().update();this._dataWindowWidget&&this._dataWindowWidget.update()}else if(t.fullInvalidation()===k.UPDATE_CURSOR_ONLY){for(e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].statusWidget().update();this._dataWindowWidget&&this._dataWindowWidget.update()}}else{for(this._model?this._updateGui():this._adjustSize(),this._timeAxisWidget.update(),e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e]._state=this._model.panes()[e],this._paneWidgets[e].statusWidget().updateLayout();this._dataWindowWidget&&this._dataWindowWidget.fullUpdate()}this.paint(t),this.performance&&(t.end(),this.performance.newChartDraw(t))},s.prototype._createVolumeIfNeeded=function(){e.enabled("create_volume_indicator_by_default")&&this._options.addVolume&&(!this._content||!this._content.loading&&e.enabled("charting_library_base"))&&this._model.mainSeries().onSymbolResolved().subscribe(this,function(){var t=this;setTimeout(function(){var i,o,n,s=t._model.model().mainSeries().symbolInfo();s&&(i=!s.has_no_volume,!t.containsVolume()&&i?(o=TradingView.factoryDefaults("chartproperties.volumePaneSize"),t.insertStudy("Volume@tv-basicstudies",!1,e.enabled("volume_force_overlay"),void 0,{paneSize:o})):!i&&t.containsVolume()&&(n=t.model().dataSources().filter(function(t){return t instanceof m&&"Volume"===t.metaInfo().shortId})[0],t._model.model().removeSource(n)))},0)},!e.enabled("charting_library_base"))},s.prototype._makeDefaultModel=function(){function t(){return c(a._chartSession,function(t){if(!(t instanceof k))throw Error("Invalid mask");a._invalidateMask?a._invalidateMask.merge(t):a._invalidateMask=t,a._draw_planned||(a._draw_planned=!0,requestAnimationFrame(i))},a._properties,a.readOnly(),n,a._studiesMetaData,a._studiesMigrations,a)}function i(){a._draw_planned=!1,a._inLoadingState||a._invalidateMask&&(a._invalidateMask=a._update(a._invalidateMask))}var o,n,r,a=this;if(this._content&&this._content.timeScale.points&&(o=this._content.timeScale.points.items[0],n={startDate:o}),!this._studiesMetaData)throw Error("Cannot create chart model: studies metainfo is absent");e.enabled("lean_chart_load")?this._model=this._model||t():this._model=t(),this._createVolumeIfNeeded(),this._content?(this.restoreState(this._content,this._containsData),e.enabled("chart_content_overrides_by_deafults")&&(this._defSymbol&&this.setSymbol(this._defSymbol),this._defInterval&&this.setResolution(this._defInterval),void 0!==this._defStyle&&this.setSeriesStyle(this._model.mainSeries(),this._defStyle))):this._setActions(),this._model.onTagsChanged().subscribe(this,s.prototype.onModelTagsChanged),this._updateGui(),this._modelCreated.fire(this._model),this._tagsChanged.fire(),a=this,r=this._model.mainSeries(),this._defTimeframe&&r.setDefaultTimeframe(this._defTimeframe),this._model.lineCancelled().subscribe(this,this.onLineCancelled),r.onSymbolNotPermitted().subscribe(null,function(t){r.properties().symbol.setValue(t)}),r.properties().style.unsubscribe(this,this._onChartStyleChanged),r.properties().style.subscribe(this,this._onChartStyleChanged),this._options.handleSessionErrors&&(r.chartTypeNotPermitted.subscribe(null,function(){TradingView.trackGoProFeature("kagiRenko"),r.properties().interval.setValue("D"),a._options.muteSessionErrors||TVDialogs.showGoProDialog({feature:"kagiRenko"})}),r.intradaySpreadNotPermitted.subscribe(null,function(){r.properties().interval.setValue("D"),a._options.muteSessionErrors||TVDialogs.showGoProDialog({feature:"intradaySpread"})}),r.customIntervalNotPermitted.subscribe(null,function(){r.properties().interval.setValue("D"),a._options.muteSessionErrors||TVDialogs.showGoProDialog({feature:"customIntervals"})}),r.intradayExchangeNotPermitted.subscribe(null,function(){if(r.properties().interval.setValue("D"),!a._options.muteSessionErrors){var t=r.symbolInfo().listed_exchange;TVDialogs.showGoProDialog({feature:"intradayExchange",exchangesButton:window.user.is_pro&&"pro_realtime_trial"!==window.user.pro_plan,exchange:t})}}),r.requestingIntradayWhenNotSupported.subscribe(null,function(){r.properties().interval.setValue("D"),a._options.muteSessionErrors||TVDialogs.showIntervalMismatchDialog()}),r.requestingResolutionWhenNotSupported.subscribe(null,function(t){r.properties().interval.setValue(t)}),a._options.muteSessionErrors||r.onExtendedHoursNotPermitted().subscribe(null,function(){TradingView.trackGoProFeature("extendedHours"),TVDialogs.showGoProDialog({feature:"extendedHours"})}))},s.prototype._onChartStyleChanged=function(){TradingView.trackEvent("Chart","Chart Style "+this._model.mainSeries().getStyleShortName().toUpperCase())},s.prototype._updateGui=function(){this._model&&(this._makePaneWidgetsAndSeparators(),this._makeTimeAxisWidget(),$("*",this._jqMainTable).selectable(!1),this._adjustSize())},s.prototype.setVisibleTimeRange=function(t,e,i){this._chartSession.setVisibleTimeRange(this._model.mainSeries(),t,e,i)},s.prototype._dateRangeResolutions=function(){var t=ChartApiInstance.availableTimeFrames(this._model.mainSeries().symbolInfo(),this._model.mainSeries().status());return t||[]},s.prototype._makeChartWidget=function(){this._jqMainDiv=$(document.createElement("div")),this._jqMainDiv.addClass("chart-widget"),z(this._jqMainDiv,this._rect);var t=this._withDateRanges&&(!e.enabled("lean_chart_load")||!this._chartControlsBar);t&&(this._chartControlsBar=$(document.createElement("div")).attr("class","chart-controls-bar").appendTo(this._jqParent),this._seriesControlWidget=new P({parent:this._chartControlsBar,chartWidget:this})),(this._options.controlBar||e.enabled("control_bar"))&&(this._controlBarNavigation=new x(this,this._jqMainDiv,!0)),this._containsData||this.createIndicatorImage()},s.prototype.navigationButtonsController=function(){return this._navigationButtonsController||(this._navigationButtonsController=new g(this)),this._navigationButtonsController},s.prototype._makeLoadingScreen=function(){if(e.enabled("lean_chart_load")){if(this.screen)return;this.screen=new s.LoadingScreen(this,this._jqParent)}else this.screen=new s.LoadingScreen(this,this._jqMainDiv)},s.prototype.setSymbol=function(t,i){if(this._model){var o=this._model.mainSeries();if(!i&&o.symbolSameAsCurrent(t)&&!e.enabled("same_data_requery"))return;this._model.setSelectedSource(null),this._model.setScreenChartProperty(o.properties().symbol,t,this,"Change Symbol",e.enabled("same_data_requery"))}else this._properties.mainSeriesProperties.merge({symbol:t})},s.prototype.getSymbol=function(t){var e;return e=this._model?this._model.mainSeries().properties():this._properties.mainSeriesProperties,e?t&&e.shortName&&e.shortName.value()?e.shortName.value():e.symbol.value():""},s.LoadingScreen=function(t,e){this._cw=t,this.$element=$('<div class="chart-loading-screen">'),this.$shield=$('<div class="chart-loading-screen-shield">').appendTo(this.$element),this.$element.appendTo(e),this._showed=!1,this._cw.withModel(this,this._connectToModel)},s.LoadingScreen.prototype._connectToModel=function(){this._cw.model().mainSeries().onDataLoaded().subscribe(this,function(t){switch(t.method){case"symbol_error":"permission denied"!==t.params[1]&&this.hide();break;case"series_error":e.enabled("hide_loading_screen_on_series_error")&&this.hide();break;case"series_completed":this.hide()}})},s.LoadingScreen.prototype.show=function(){return this._cw._inLoadingState=!0,this._showed||this._cw.isDetached||(this._showed=!0,this._show()),$.Deferred().resolve()},s.LoadingScreen.prototype._show=function(){var t=this._cw.properties().paneProperties.background.value();this.$shield.css("background",t),this.$element.addClass("fade")},s.LoadingScreen.prototype.hide=function(){delete this._cw._inLoadingState,this._showed&&this._hide()},s.LoadingScreen.prototype._hide=function(){this._showed=!1,this.$element.removeClass("fade")},s.LoadingScreen.prototype.$canvas=null,s.LoadingScreen.prototype.context=null,s.prototype._makeMasterTable=function(){this._jqMainTable=$(document.createElement("table")),this._jqMainTable.appendTo(this._jqMainDiv),this._jqMainTable.addClass("chart-markup-table"),this._jqMainTable.attr("cellpading","0"),this._jqMainTable.attr("cellspacing","0")},s.prototype.unsetActivePaneWidget=function(){this.activePaneWidget=!1},s.prototype.setActivePaneWidget=function(t){this.activePaneWidget=t},s.prototype.isMaximizedPane=function(){return!!this._maximizedPaneWidget},s.prototype.toggleMaximizePane=function(t){if(!(this._paneWidgets.length<2)){this._maximizedPaneWidget?(this._maximizedPaneWidget=null,this._paneSeparators.forEach(function(t){t.show()})):(this._maximizedPaneWidget=t,this._paneSeparators.forEach(function(t){t.hide()}));for(var e=this._paneWidgets.length;e--;)this._paneWidgets[e].updateControls();this._adjustSize(),this.updateIndicatorImagePosition()}},s.prototype._makePaneWidgetsAndSeparators=function(){var t,e,i,o,n=this._model.panes(),s=n.length,r=this._paneWidgets.length;for(t=s;t<r;t++)e=this._paneWidgets.pop(),e.jqRow.remove(),e.jqRow.find("*").remove(),e.destroy(),i=this._paneSeparators.pop(),i&&i.jqRow.remove();for(t=r;t<s;t++)e=new a(this,n[t],this._onWidget),e.onMouseLeave=this.unsetActivePaneWidget.bind(this),e.onMouseEnter=this.setActivePaneWidget.bind(this),this._paneWidgets.push(e),t>0&&(i=new l(this,t-1,t),this._paneSeparators.push(i),this._timeAxisWidget?i.jqRow.insertBefore(this._timeAxisWidget.jqRow):i.jqRow.appendTo(this._jqMainTable)),this._timeAxisWidget?e.jqRow.insertBefore(this._timeAxisWidget.jqRow):e.jqRow.appendTo(this._jqMainTable);for(t=0;t<s;t++)o=n[t],e=this._paneWidgets[t],e.state()!==o&&e.setState(o);for(t=s;t--;)this._paneWidgets[t].updateControls()},s.prototype._makeTimeAxisWidget=function(){this._timeAxisWidget||(this._timeAxisWidget=new u(this,this._onWidget),this._timeAxisWidget.jqRow.appendTo(this._jqMainTable))},s.prototype.insertStudyOrShowDialog=function(t){var e,o,n;this.isSymbolicStudy(t)?(e=defaults("study_"+t.id).description,TVDialogs.showAddSymbolDialog(this,{title:e,okButtonTitle:$.t("Apply"),callback:function(e,i){var o={inputs:{symbol:e}};this.model().insertStudy(t,o,i)}.bind(this)})):this.hasConfirmInputs(t)?(e=defaults("study_"+t.id).description,i(270),TVDialogs.showConfirmInputsDialog(this,t,{title:e,okButtonTitle:$.t("Apply"),callback:function(e){this.model().insertStudy(t,e,!1)}.bind(this)})):m.isPointsBasedStudy(t.id)?(o=m.lineToolNameForPointsBasedStudy(t.id),T.tool.setValue(o)):(n="Volume@tv-basicstudies"===t.id,this.insertStudy(t.id,!0,n))},s.prototype.hasConfirmInputs=function(t){var e,i,o=t.inputs;if(void 0===o)return!1;for(e=0;e<o.length;++e)if(i=o[e],void 0!==i.confirm&&i.confirm)return!0;return!1},s.prototype.isSymbolicStudy=function(t){switch(t.id){case"Overlay@tv-basicstudies":case"CorrelationCoefficient@tv-basicstudies":return!0;default:return!1}},s.prototype.isPointsBasedStudy=function(t){return m.isPointsBasedStudy(t.id)},s.prototype.insertStudy=function(t,e,i,o,n){var s,r=B.findStudyMetaInfo(this._studiesMetaData,t);assert(!r.isTVScriptStubToCompile,"MetaInfo stub is unexpected here!"),s=o?{inputs:o}:{},n&&(s=$.extend(s,n)),e?this._model.insertStudy(r,s,i):this._model.model().insertStudy(r,s,i)},s.prototype.insertStudyStub=function(t){return this.model().insertStudyStub(t)},s.prototype.removeStudyStub=function(t){return this.model().removeStudyStub(t)},s.prototype._adjustSize=function(){var t,e,i,o,n,s,r,a=this,h=0,c=0,d=0;$.each(this._paneWidgets,function(){a._maximizedPaneWidget&&a._maximizedPaneWidget!==this||(h=Math.max(this.lhsPriceAxisWidget.optimalWidth(),h),c=Math.max(this.rhsPriceAxisWidget.optimalWidth(),c),d+=this.stretchFactor())}),t=this._rect,e=t.w-h-c,i=this._paneSeparators.length,o=l.HEIGHT,n=this._timeAxisWidget.optimalHeight(),s=t.h-o*i-n,r=s/d,this._jqMainTable.width(t.w),this._jqMainTable.height(t.h),$.each(this._paneWidgets,function(t){a._model&&(this._state=a._model.panes()[t]);var i=a._maximizedPaneWidget?a._maximizedPaneWidget===this?s:0:Math.max(Math.round(this.stretchFactor()*r),2);this.setPriceAxisSize(p.LHS,new F(h,i)),this.setPriceAxisSize(p.RHS,new F(c,i)),this.setSize(new F(e,i)),a._model&&this.state()&&a._model.setPaneHeight(this.state(),i)}),this._timeAxisWidget.setSize(new F(e,n),new F(h,n),new F(c,n)),this._model&&this._model.setWidth(e),this.maxLhsPriceAxisWidth!==h&&(this.maxLhsPriceAxisWidth=h,this.lhsPriceAxisWidthChanged.fire(h)),this.maxRhsPriceAxisWidth!==c&&(this.maxRhsPriceAxisWidth=c,this.rhsPriceAxisWidthChanged.fire(c))},s.prototype._onData=function(t){switch(t.method){case"connected":this._onConnection();break;case"disconnected":this._onDisconnect();break;case"reconnect_bailout":this._reconnectBailout.fire();break;case"connection_error":this._onConnectionError(t.params[0]);break;case"critical_error":this._disconnected.fire(!0);break;default:this._model.onData(t)}},s.prototype._nextMetadataId=1,s.prototype._onConnection=function(){this._online=!0,this._model?(this._model.restart(),this._updateGui(),this.update(),this.paint(),this._connected.fire()):(e.enabled("charting_library_base")&&this._chartSession.requestMetadata("metadata_"+s._nextMetadataId,function(t){var e,i=t.params[1];for(e=0;e<i.length;++e)B.addStudyMetaInfo(this._studiesMetaData,r(i[e]));this._init(),this.chartWidgetInitialized.fire()}.bind(this)),s._nextMetadataId++)},s.prototype._onDisconnect=function(){this._model&&this._model.disconnect(),this._online=!1,this.update(),this.paint(),this._disconnected.fire()},s.prototype.studiesMetaData=function(){return this._model.studiesMetaData()},s.prototype._onConnectionError=function(t){this._disconnected.fire()},s.prototype.getTimeScale=function(){return this._timeAxisWidget},s.prototype.setSeriesStyle=function(t,e){this._model.setProperty(t.properties().style,e)},s.prototype.showSourceProperties=function(t){new y({chartWidget:this},this._model).show()},s.prototype.showChartProperties=function(t){if(e.enabled("show_chart_property_page"))return t&&t.text===$.t("Properties...")&&TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Style")),new d(this._model.mainSeries(),this._model).show()},s.prototype.showScriptEditor=function(){TradingView.ScriptEditorWidget.open()},s.prototype.showCompareOrAdd=function(){var t=new E(this._chartWidgetCollection);t.show()},s.prototype.showIndicators=function(){window.studyMarket.isVisible()?window.studyMarket.hide():window.studyMarket.show()},s.prototype.showScalesProperties=function(t){var e={selectScales:!0};return new d(this._model.mainSeries(),this._model).show(e)},s.prototype.showTimezoneProperties=function(){return new d(this._model.mainSeries(),this._model).show({selectTmz:!0})},s.prototype.removeSelectedSource=function(){var t=this,e=t._model.selectedSource();!e||e===t._model.mainSeries()||e===t._model.lineBeingCreated()||e instanceof _||(e.hasAlert.value()&&e.isUserDeletable()?TVDialogs.showConfirm($.t("Drawing Alert"),$.t("This drawing is used in alert. If you remove the drawing, the alert will be also removed. Do you want to remove the drawing anyway?"),t._model.removeSelectedSource.bind(t._model)):t._model.removeSelectedSource())},s.prototype.unlinkSelectedLine=function(){var t=this._model.selectedSource();t instanceof v&&this._model.unlinkLine(t)},s.prototype.copyLineToOtherCharts=function(){var t=this._model.selectedSource();t instanceof v&&this._model.copyToOtherCharts(t)},s.prototype.hideSelectedObject=function(){var t=this._model.selectedSource();t&&this._model.setProperty(t.properties().visible,!1,"Hide "+t.title())},s.prototype.toggleLockSelectedObject=function(){var t,e=this._model.selectedSource();e&&(t=e.properties().frozen.value(),this._model.setProperty(e.properties().frozen,!t,(t?$.t("Unlock"):$.t("Lock"))+" "+e.title()))},s.prototype.editSelectedObject=function(t){var e=this._model.selectedSource();if(e)return new d(e,this._model).show()},s.prototype.openSelectedObjectSource=function(t){var e,i=this._model.selectedSource();i&&i.metaInfo&&(e=i.metaInfo(),e&&e.TVScriptSourceCode&&e.scriptIdPart&&TradingView.ScriptEditorWidget&&TradingView.ScriptEditorWidget.open({scriptSource:e.TVScriptSourceCode,scriptIdPart:e.scriptIdPart}))},s.prototype.resetPriceAxisOptimalWidth=function(t){$.each(this._paneWidgets,function(){this.resetPriceAxisOptimalWidth(t)}),this._redrawPanes.fire()},s.prototype.adjustPriceAxisWidth=function(t){this.resetPriceAxisOptimalWidth(t),this._adjustSize()},s.prototype.setPriceAxisVisible=function(t,e){$.each(this._paneWidgets,function(){this.setPriceAxisVisible(t,e)}),this._timeAxisWidget.setStubVisible(t,e),this._adjustSize(),this._redrawPanes.fire()},s.prototype.setTimeAxisVisible=function(t){this._timeAxisWidget.setVisible(t),this._adjustSize()},s.prototype.isTextTool=function(t){switch(t){case"LineToolBalloon":case"LineToolText":case"LineToolTextAbsolute":case"LineToolCallout":case"LineToolNote":case"LineToolNoteAbsolute":return!0}return!1},s.prototype.tags=function(){return this._model?this._model.calculateDefaultTags():[]},s.prototype.state=function(t,e){var i=this._model.state(t,e);return i},s.prototype.asyncState=function(t){return this._model.asyncState(t)},s.prototype.metaInfo=function(){var t=this._metaInfo;return this._model&&(t.systemTags=this._model.calculateDefaultTags()),t},s.prototype.image=function(){var t,e,i,o,n,s,r,a,l=document.createElement("canvas"),h=l.getContext("2d"),c=0,d=this._timeAxisWidget.size.h,p=this.properties().scalesProperties.lineColor.value();for(e=0;e<this._paneWidgets.length;e++)t=this._paneWidgets[e],t&&t.state()&&(t.state().recalculate(!0),0===e&&(c=t.lhsPriceAxisWidget.size.w+t.size.w+t.rhsPriceAxisWidget.size.w),d+=t.size.h);for(d+=this._paneWidgets.length-1,this._update(),i=25,o=5,l.width=c+2*o,l.height=d+i+2*o,h.fillStyle="#F2F5F8",h.fillRect(0,0,l.width,l.height),n=i+o,s=o,r=this.mainSeriesQuotesAndMetainfo(),r.ohlc&&(a="{0} O:{1} H:{2} L:{3} C:{4}".format(r.meta.symbol,r.ohlc[0],r.ohlc[1],r.ohlc[2],r.ohlc[3]),h.fillStyle="#000",h.font="12px Verdana, Arial",h.fillText(a,s,o+15)),e=0;e<this._paneWidgets.length;e++)t=this._paneWidgets[e],h.drawImage(t.lhsPriceAxisWidget.canvas,s,n),h.drawImage(t.canvas,s+t.lhsPriceAxisWidget.size.w,n),t.statusWidget().renderTo(h,s+5,n+5),h.drawImage(t.rhsPriceAxisWidget.canvas,s+t.lhsPriceAxisWidget.size.w+t.size.w,n),n+=t.size.h,e<this._paneWidgets.length-1&&(h.fillStyle=p,h.fillRect(s,n,c,1),n++);return h.drawImage(this._timeAxisWidget.lhsCanvas,s,n),h.drawImage(this._timeAxisWidget.canvas,s+t.lhsPriceAxisWidget.size.w,n),h.drawImage(this._timeAxisWidget.rhsCanvas,s+t.lhsPriceAxisWidget.size.w+t.size.w,n),h.lineWidth=1,h.strokeStyle="#000",h.strokeRect(o+.5,i+o+.5,c-1,d-1),l},s.prototype.images=function(){function t(t){var e,o,n,s,r;for(t.paint(k.LIGHT_UPDATE,i._onWidget),e=t.image(i._onWidget),e.containsMainSeries=t.containsMainSeries(),e.studies=[],o=t.state().dataSources(),n=0;n<o.length;n++)s=o[n],r=i.properties().paneProperties.legendProperties,s instanceof m?s.properties().visible.value()&&s.statusView()&&r.showStudyTitles.value()&&r.showLegend.value()&&e.studies.push(s.statusView().text()):s instanceof f&&r.showLegend.value()&&r.showSeriesTitle.value()&&(e.mainSeriesText=s.statusView().text());return e}var e,i,o,n,s,r,a;if(TradingView.printing=!0,e=this._model.selectedSource(),this._model.setSelectedSource(null),i=this,o=[],this.isMaximizedPane())o.push(t(this._maximizedPaneWidget));else for(n=0;n<this._paneWidgets.length;n++)s=this._paneWidgets[n],o.push(t(s)),n<this._paneWidgets.length-1&&o.push(this._paneSeparators[n].image());return this._timeAxisWidget.paint(k.LIGHT_UPDATE),r=this._timeAxisWidget.image(),TradingView.printing=!1,this._model.setSelectedSource(e),this._model.invalidate(new k(k.LIGHT_UPDATE)),a=this.mainSeriesQuotesAndMetainfo(),{panes:o,timeAxis:r,colors:{text:this.properties().scalesProperties.textColor.value(),bg:this.properties().paneProperties.background.value(),scales:this.properties().scalesProperties.lineColor.value()},meta:a.meta,ohlc:a.ohlc,quotes:a.quotes}},s.prototype.mainSeriesQuotesAndMetainfo=function(){var t,e,i,o,n,s,r,a=this._model.mainSeries();return a&&(o=function(t){return null==t?"":a.formatter().format(t)+""},n=function(t){return null==t?"":t+""},t={resolution:a.interval(),symbol:a.symbol()},s=a.symbolInfo(),s&&(t.symbol=s.full_name,t.description=s.description,t.exchange=s.exchange),r=a.bars().last(),r&&(e=r.value.slice(1,5).map(o)),a.quoteData&&(i={change:o(a.quoteData.change),changePercent:n(a.quoteData.change_percent),last:o(a.quoteData.last_price)})),{meta:t,ohlc:e,quotes:i}},s.prototype.onTagsChanged=function(){return this._tagsChanged},s.prototype.onModelTagsChanged=function(){this._tagsChanged.fire()},s.prototype.destroy=function(){$(window).unbind("resize",this._resizeHandler),this._model.model().destroy(),this.performance&&this.performance.destroy(),this._chartSession.destroy()},s.prototype.title=function(){return $.t("Chart Properties")},s.prototype.symbolProperty=function(){return this._model.mainSeries().properties().shortName?this._model.mainSeries().properties().shortName:this._model.mainSeries().properties().symbol},s.prototype.loadContent=function(t,i){var o,n,s,r,a,l;for(this.screen.show(),o=this,this.isMaximizedPane()&&this.toggleMaximizePane(),n=o._model.model().dataSources(),s=0;s<n.length;s++)r=n[s],r!==o._model.mainSeries()&&o._model.model().removeSource(r,!0);for(o._jqMainDiv&&(o._jqMainDiv.remove(),o._jqMainDiv=null),o._timeAxisWidget=null,o._paneWidgets=[],o.activePaneWidget=!1,o._model.mainSeries().purgeSymbolInfo(),"undefined"!=typeof trading&&trading.unregisterChartWidget(this),t.loading=!0,o._setContent(t),s=0;s<t.panes.length;++s)for(l=0;l<t.panes[s].sources.length;++l)if(t.panes[s].sources[l].state.symbol){a=t.panes[s].sources[l].state;break}if(!a)throw Error("An error occured while determining main series ion the chart");o._properties.mainSeriesProperties.merge({visible:!0,symbol:a.symbol,timeframe:"",onWidget:o._onWidget,interval:a.interval||"D",style:a.style}),o._init(),I.interval.setValue(a.interval),h.UndoHistory.clearStack(),o.updateSeriesControlUI(),o.createLogo&&!e.enabled("move_logo_to_main_pane")&&o.createLogo(void 0,this._jqMainDiv)},s.prototype._setContent=function(t){t&&t.panes.forEach(function(t){t.sources=t.sources.filter(function(t){return!!t&&("MainSeries"===t.type||(!t.points||!t.points.some(function(t){return null===t.time_t||!isFinite(t.time_t)})||(TradingView.logNormalChart("Dropped invalid "+t.type+". Reason: non-numeric point time"),!1)))});var e=function(e){return t.sources&&t.sources.some(function(t){return t.id===e})};t.leftAxisSources&&(t.leftAxisSources=t.leftAxisSources.filter(e)),t.rightAxisSources&&(t.rightAxisSources=t.rightAxisSources.filter(e))}),this._content=t},s.prototype._contentSeriesProperties=function(){var t,e,i;if(this._content)for(t=this._content.panes.length;t-- >0;)for(e=this._content.panes[t].sources,i=e.length;i-- >0;)if("MainSeries"===e[i].type)return e[i].state},s.prototype.updateSeriesControlUI=function(){this._seriesControlWidget&&this._seriesControlWidget.updateUI()},s.prototype.tickSeriesControlClock=function(){this._seriesControlWidget&&this._seriesControlWidget.tickClock()},s.prototype.resizeSeriesControlUI=function(){this._seriesControlWidget&&this._seriesControlWidget.resizeUI()},s.prototype.updateUndoRedo=function(){h.UndoHistory.undoStack().isEmpty()?this.actions().undo.setEnabled(!1):this.actions().undo.setEnabled(!0),h.UndoHistory.redoStack().isEmpty()?this.actions().redo.setEnabled(!1):this.actions().redo.setEnabled(!0)},s.prototype.createSessionBreaksActions=function(t){var e,o=i(262).ActionBinder,n=this,s=function(){e=new w({text:$.t("Session Breaks"),checkable:!0}),e.binder=new o(e,n.model().mainSeries().sessionsStudy().properties().graphics.vertlines.sessBreaks.visible,n.model(),"Session Breaks"),n._actions.sessionBreaks=e};n.model().mainSeries().sessionsStudy()?s():n.model().mainSeries().onSessionsStudyCreated().subscribe(n,function(){s()})},s.prototype.updateActionForIntradayOnly=function(t){!t||!t instanceof w||t.setEnabled(!!this.model().mainSeries().isIntradayInterval())},s.prototype.withModel=function(t,e){this.model()?e.call(t):this.modelCreated().subscribe(t,e,!0)},s.prototype.containsVolume=function(){return this.model().dataSources().some(function(t){return t instanceof m&&"Volume"===t.metaInfo().shortId})},s.prototype.containsStudy=function(t){return!!this._model&&this._model.dataSources().some(function(e){if(!(e instanceof m))return!1;var i=e.metaInfo();return i.id===t||i.fullId===t})},s.prototype.containsSessions=function(){return this.model().dataSources().some(function(t){return t instanceof m&&"Sessions"===t.metaInfo().shortId})},s.prototype.isSmall=function(t){return this.constructor.isSmall(this._jqParent)},s.isSmall=function(t){return t.width()<550||t.height()<300},s.prototype.onWidget=function(){return this._onWidget},s.prototype.onCmeWidget=function(){return"cme"===this.widgetCustomer()},s.prototype.widgetCustomer=function(){return this._widgetCustomer},s.prototype.resize=function(){this._resizeHandler&&this._jqMainDiv&&this._resizeHandler()},s.prototype.chartSession=function(){return this._chartSession},s.prototype.maxLhsPriceAxisWidth=0,s.prototype.maxRhsPriceAxisWidth=0,s.prototype.GUIResetScales=function(){TradingView.trackEvent("GUI","Reset Scales"),this.model()&&(this._containsData&&this.model().chartModel().restoreAxisState(this._content),this.model().resetScales())},s.prototype.onLineCancelled=function(){T.resetToCursor()},s.prototype.createIndicatorImage=function(){var t=this;this.indicatorImage=$('<span class="chart-status-picture"></span>').appendTo(this._jqMainDiv),e.enabled("display_market_status")&&(this.indicatorText=$('<span class="series-status-text"><span class="dot apply-common-tooltip"></span><span class="text"></span><span class="market-status"></span></span>').appendTo(this.indicatorImage),this.indicatorDot=this.indicatorText.find(".dot")),t.withModel(null,function(){var e=t._model.mainSeries();e.onStatusChanged().subscribe(null,t.updateIndicatorImage.bind(t)),e.marketStatus.subscribe(t.updateIndicatorImage.bind(t)),t.updateIndicatorImage(),t.checkCompactMode(),t._model.onRearrangePanes().subscribe(null,function(){t.resetIndicatorSize(),t.resizeIndicator()})}),t.rhsPriceAxisWidthChanged.subscribe(t,t.updateIndicatorImagePosition),
t.updateIndicatorImagePosition()},s.prototype.updateIndicatorImage=function(){function t(t,e){return s.hasOwnProperty(t)?s[t]:e}var e,i,o,n,s,r=this.indicatorImage;this.indicatorImage&&(e=this._model,e&&(i=e.mainSeries(),o=i.status(),n=this._statusDetails(),s=null,s=n.hasOwnProperty(o)?n[o]:n.defaults,r.attr("title",t("title","")),this._updateDataAndMarketStatus(i.marketStatus.value(),o)))},s.prototype.checkCompactMode=function(){this._jqMainDiv&&this._jqMainDiv.toggleClass("i-compact",this._jqMainDiv.width()<=400),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.outerWidth())},s.prototype._statusDetails=function(){return this.__statusDetails||(this.__statusDetails={},this.__statusDetails[f.STATUS_SNAPSHOT]={className:"snapshot",text:"",showBatsWarn:!1,priority:1},this.__statusDetails[f.STATUS_LOADING]=this.__statusDetails[f.STATUS_RESOLVING]={className:"loading",text:$.t("loading data"),priority:1},this.__statusDetails[f.STATUS_INVALID_SYMBOL]={className:"invalid",text:$.t("invalid symbol"),showBatsWarn:!1,priority:1},this.__statusDetails[f.STATUS_NO_BARS]={className:"invalid",text:$.t("instrument is not allowed"),showBatsWarn:!1,priority:1},this.__statusDetails[f.STATUS_OFFLINE]={className:"connecting",text:$.t("retrying"),priority:1},this.__statusDetails[f.STATUS_EOD]=this.__statusDetails[f.STATUS_PULSE]={className:"eod",text:$.t("eod data"),priority:1},this.__statusDetails[f.STATUS_DELAYED]={className:"delayed",title:$.t("Quotes are delayed by 10 min and updated every 30 seconds"),text:$.t("eod delayed"),priority:1},this.__statusDetails[f.STATUS_DELAYED_STREAMING]={className:"delayed-streaming",text:$.t("delayed"),priority:1},this.__statusDetails[f.STATUS_READY]=this.__statusDetails.defaults={className:"realtime",text:$.t("realtime"),priority:-1},this.__statusDetails.pre_market={text:$.t("pre-market"),className:"pre-market",priority:0},this.__statusDetails.post_market={text:$.t("post-market"),className:"post-market",priority:0},this.__statusDetails.out_of_session={text:$.t("closed"),className:"out-of-session",priority:0},this.__statusDetails.market=this.__statusDetails.defaults),this.__statusDetails},s.prototype._updateDataAndMarketStatus=function(t,e){if(void 0!==this.indicatorText){var i=this._resultingStatusRecord(t,e);this.indicatorText.removeClass().addClass("series-status-text "+i.className).find(".text").html(i.text),this.indicatorDot.attr("title",i.text),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.outerWidth()),this.resizeIndicator()}},s.prototype.resetIndicatorSize=function(){if(this._paneWidgets[0]&&this._paneWidgets[0].legendWidget)for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].legendWidget.firstTitle().css("padding-right","")},s.prototype.resizeIndicator=function(){this._paneWidgets[0]&&this._paneWidgets[0].legendWidget&&this._indicatorWidth&&this._paneWidgets[0].legendWidget.firstTitle().css("padding-right",this._indicatorWidth+10)},s.prototype._resultingStatusRecord=function(t,e){var i,o;return t?(i=this._statusDetails()[t],o=this._statusDetails()[e],o||(o=this._statusDetails().defaults),o.priority>i.priority?o:i):this._statusDetails()[e]},s.prototype.updateIndicatorImagePosition=function(){var t=this.indicatorImage;this.indicatorImage&&t.css("marginRight",this.maxRhsPriceAxisWidth)},s.prototype._startSpinner=function(t){if("function"==typeof n&&!this._spinner){var e=$(t).get(0);e&&(this._spinner=TradingView.unifiedSpinner("",{zIndex:"auto"}).spin(e))}},s.prototype.isJustClonedChart=function(){return!!(this._options||{}).justCloned},s.prototype.getLastPaneLeftBottom=function(){var t=this._paneWidgets[this._paneWidgets.length-1].jqPane,e=t.offset();return{left:e.left,bottom:$(document.body).height()-e.top-t.height()}},s.prototype.setDataWindowWidget=function(t){this._dataWindowWidget=t},s.prototype.removeDataWindowWidget=function(){this._dataWindowWidget=null},e.enabled("datasource_copypaste")&&(s.prototype.onAppClipboardPaste=function(t,e){TradingView.logDebugChart("[[paste]]"),this._model&&this._model.pasteSourceFromClip(t,e)},s.prototype.onAppClipboardCopy=function(t){TradingView.logDebugChart("[[copy]]"),this._model&&this._model.copySourceToClip(t||this._model.selectedSource())},s.prototype.onAppClipboardCut=function(t){TradingView.logDebugChart("[[cut]]"),this._model&&this._model.cutSourceToClip(t||this._model.selectedSource())}),s.prototype.applyOverrides=function(t){applyPropertiesOverrides(this.properties(),null,!1,t),this._model&&(applyPropertiesOverrides(this._model.model().properties(),null,!1,t),applyPropertiesOverrides(this._model.mainSeries().properties(),null,!1,t,"mainSeriesProperties"))},s.prototype.setActive=function(t){var e,i=this.actions();for(e in i)i.hasOwnProperty(e)&&this.actions()[e].setActive(t);this._isActive=t,this._paneWidgets.forEach(function(t){t.update()})},s.prototype.isActive=function(){return this._isActive},s.prototype.trackTime=function(){return this._chartWidgetCollection.lock.trackTime},t.exports=s}).call(e,i(1),i(28),i(35))},function(t,e,i){(function(e,o){"use strict";function n(t,i,o){this._chart=t,this.dialog=t.dialog,this._state=i,this._disableContextMenu=!!o,this.lhsPriceAxisWidget=new h(this,h.LHS),this.rhsPriceAxisWidget=new h(this,h.RHS),this.jqPane=$(document.createElement("td")),this.jqPane.addClass("chart-markup-table"),this.jqPane.addClass("pane"),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqPane),this.canvas=E(this._dv,new I(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=E(this._dv,new I(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this._zoomSelector=$("<div>"),this._zoomSelector.addClass("zoom-selector"),this._zoomSelector.css("display","none"),this._zoomSelector.appendTo(this._dv),this._tooltipSelector=$("<div>"),this._tooltipSelector.addClass("tooltip tooltip-selector tooltip-selector-hidden"),this._tooltipSelector.appendTo(this._dv),this.legendWidget=new a(this,this._chart.model(),this._chart._jqMainDiv),this.jqRow=$(document.createElement("tr")),this.lhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.jqPane.appendTo(this.jqRow),this.legendWidget.$el.appendTo(this._dv),this.rhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.setCursorForTool(),A($(this.top_canvas),this,!0),i&&!this._chart.readOnly()&&(this.paneControls=new T(this,this._chart.model(),this._dv)),this.updateScalesVisibility(),this.actions=[],this.readonlyActions=[],this._onKeyUpListener=this._onKeyUpListener.bind(this),this._lineCancelledCallback=this._lineCancelledCallback.bind(this),$(window).on("keyup.panewidget",this._onKeyUpListener),this._chart.withModel(this,this._lineCancelledCallback),this._overlays={},this._contextMenuX=0,this._contextMenuY=0,this._lockDrawingsProperty=w.lockDrawings(),this._chart.withModel(this,function(){var t=this._chart.model();t.onSimpleZoomIn().subscribe(this,this._updateCrosshairOnZoom),t.onSimpleZoomOut().subscribe(this,this._updateCrosshairOnZoom)}),i&&e.enabled("move_logo_to_main_pane")&&i._isMainPane&&t.createLogo&&t.createLogo(null,this._dv,!0)}var s=i(248),r=i(150).Study,a=i(251),l=i(258),h=i(324),c=i(212),d=i(211),p=i(74).LineDataSource,u=i(194),_=i(236).BarsMarksContainer,f=i(79).PriceDataSource,g=i(141),m=g.Action,v=g.ActionPlaceholder,y=g.ActionSeparator,b=i(325),w=i(81),S=i(94),T=i(331),C=i(113),x=i(38),P=i(55),L=P.setCanvasSize,k=P.clearRect,E=P.addCanvasTo,I=P.Size,A=P.setMouseEventHandler,V=i(330),M=i(250);n.prototype.destroy=function(){$(window).off("keyup.panewidget",this._onKeyUpListener),this.legendWidget&&(this.legendWidget.$el.remove(),delete this.legendWidget),this.paneControls&&(this.paneControls.jqDiv.remove(),delete this.paneControls),this._chart.withModel({chart:this._chart,instance:this,callback:this._hideTooltip},function(){this.chart.model().lineCancelled().unsubscribe(this.instance,this.callback)});for(var t in this)delete this[t]},n.prototype.cancelZoom=function(){this._zoomSelector.css("display","none"),delete this._firstZoomPoint},n.prototype._onKeyUpListener=function(t){if(27===t.keyCode){this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine(),this._firstZoomPoint&&this.cancelZoom();var e=this._chart.model().model().crossHairSource();e.clearMeasure(),this.setCursorForTool(),this._hideTooltip()}},n.prototype._lineCancelledCallback=function(){try{this._chart.model().lineCancelled().subscribe(this,this._hideTooltip)}catch(t){}},n.prototype.backgroundColor=function(){return this._chart.properties().paneProperties.background.value()},n.prototype.priceAxisByCanvas=function(t){return t===this.lhsPriceAxisWidget.canvas||t===this.lhsPriceAxisWidget.top_canvas?this.lhsPriceAxisWidget:t===this.rhsPriceAxisWidget.canvas?this.rhsPriceAxisWidget:null},n.prototype.updateScalesVisibility=function(){this.lhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showLeftScale.value()),this.rhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showRightScale.value())},n.prototype.chart=function(){return this._chart},n.prototype.state=function(){return this._state},n.prototype.setState=function(t){this._state=t},n.prototype.stretchFactor=function(){return this._state?this._state._stretchFactor:Pane.DEFAULT_STRETCH_FACTOR},n.prototype.setStretchFactor=function(t){this._state&&(this._state._stretchFactor=t)},n.prototype.mouseEnterEvent=function(t){var e=this._chart.model();e&&(e.crossHairSource().visible=!0,"function"==typeof this.onMouseEnter&&this.onMouseEnter(this))},n.prototype.isLineTool=function(t){var e=TradingView[t];return"function"==typeof e&&e.prototype instanceof p},n.prototype.hideInplaceEditor=function(){return!!this._inplaceEditor&&(this._inplaceEditor.remove(),this._inplaceEditor=void 0,!0)},n.prototype._processMouseMoveWhileZoom=function(t){var e=Math.floor(this._chart.model().timeScale().coordinateToIndex(t.localX)),i=this._chart.model().timeScale().indexToCoordinate(e)-.5*this._chart.model().timeScale().barSpacing(),o=t.localY,n=Math.abs(i-this._firstZoomPoint.x),s=Math.abs(o-this._firstZoomPoint.y);i<this._firstZoomPoint.x?this._zoomSelector.css("left",i):this._zoomSelector.css("left",this._firstZoomPoint.x),t.localY<this._firstZoomPoint.y?this._zoomSelector.css("top",t.localY):this._zoomSelector.css("top",this._firstZoomPoint.y),this._zoomSelector.width(n),this._zoomSelector.height(s)},n.prototype._finishZoom=function(t){var e=this._state.defaultPriceScale(),i=e.coordinateToPrice(t.localY),o=Math.round(this._chart.model().timeScale().coordinateToIndex(t.localX));o!==this._firstZoomPoint.index&&this._chart.model().zoomToViewport(this._firstZoomPoint.index,o,this._firstZoomPoint.price,i,this.state()),this._zoomSelector.css("display","none"),this._firstZoomPoint=null,w.resetToCursor()},n.EvironmentState=function(t){t.shiftKey&&(this.shift=!0),t.ctrlKey&&(this.control=!0)},n.prototype.checkMovepoint=function(t){return t===S.MOVEPOINT||t===S.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any()},n.prototype.mouseDownEvent=function(t){var i,s,a,l,h,c,d,u,_,g,m,v,y,b,T;if(document.activeElement!==document.body&&document.activeElement!==document.documentElement?document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus():document.getSelection?document.getSelection().removeAllRanges():document.selection&&document.selection.clear(),x.emit("mouse_down",{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,screenX:t.screenX,screenY:t.screenY}),this._updateCommonTooltip(null),i=this._chart.model(),s=new n.EvironmentState(t),i.mainSeries().setGotoDateResult(),this.hideInplaceEditor(),TradingView.supportTouch()&&(this._skipFirstMove=!0),a=this._state.defaultPriceScale(),!a.isEmpty()&&!i.timeScale().isEmpty()){if(l=i.crossHairSource(),TradingView.supportTouch()&&"LineToolBrush"!==w.tool.value()||i.setCurrentPosition(t.localX,t.localY,this._state),h=l.price,c=l.index,l.startMeasurePoint()&&l.endMeasurePoint()&&l.clearMeasure(),s.shift&&w.toolIsCursor(w.tool.value())&&w.tool.setValue("measure"),"measure"===w.tool.value()&&!l.startMeasurePoint())return void l.startMeasuring({price:h,index:c,x:t.localX,y:t.localY},this._state);if(l.startMeasurePoint()&&!l.endMeasurePoint())return l.finishMeasure({price:h,index:c,x:t.localX,y:t.localY}),void w.resetToCursor();if(this._firstZoomPoint)return void this._finishZoom(t);if("zoom"===w.tool.value())return d=i.timeScale().indexToCoordinate(c)-.5*i.timeScale().barSpacing(),this._firstZoomPoint={price:h,index:c,x:d,y:t.localY},this._zoomSelector.css("display","block"),this._zoomSelector.css("left",d),this._zoomSelector.css("top",t.localY),this._zoomSelector.width(0),void this._zoomSelector.height(0);if(this.isLineTool(w.tool.value())||i.lineBeingCreated())return void((!e.enabled("charting_library_base")||c>=0)&&this._mouseDownEventForLineTool(t,s,c,h));if(u=this.dataSourceAtPoint(t.localX,t.localY),_=u&&u.source&&u.source.customization?u.source.customization:{},u.hittest&&u.hittest.result()===S.CUSTOM&&(g=u.hittest.data().mouseDownHandler,g&&g(t)),!this._chart.readOnly()){if(u&&!_.disableSelection&&(m=u.hittest&&u.hittest.result()>S.MOVEPOINT_BACKGROUND,m=m||u.hittest&&u.hittest.result()===S.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any(),m?i.setSelectedSource(u.source,u.hittest&&u.hittest.data()):i.setSelectedSource(null)),u.source&&"eraser"===w.tool.value()&&!_.disableErasing&&(TradingView.isInherited(u.source.constructor,p)||TradingView.isInherited(u.source.constructor,r)))return v=u.hittest.eraseMarker(),void(t.ctrlKey&&void 0!==v&&u.source.processErase?u.source.processErase(i,v):i.removeSource(u.source));if(y=u.source&&TradingView.isInherited(u.source.constructor,p)&&u.source.isLocked(),b=this._lockDrawingsProperty.value()||y,!b){if(u.source&&u.source.userEditEnabled&&!u.source.userEditEnabled())return;if(u.hittest&&u.hittest.result()===S.CHANGEPOINT)return a=u.source.priceScale(),h=a.coordinateToPrice(t.localY),i.startChangingLinetool(u.source,{index:c,price:h},u.hittest.data(),s),void this._updateTooltip(t.localX,t.localY);if(u.hittest&&this.checkMovepoint(u.hittest.result()))return T=u.source.properties(),s.control&&T.clonable&&T.clonable.value()?void(this._clonningAtMoveLineTool=u.source):void(u.source.isFixed&&u.source.isFixed()?i.startMovingSource(u.source,new o.Point(t.localX,t.localY),u.hittest.data()):(a=u.source.priceScale(),h=a.coordinateToPrice(t.localY),i.startMovingSource(u.source,{index:c,price:h},u.hittest.data())))}if(u.source&&TradingView.isInherited(u.source.constructor,f)&&u.source.isDraggable())return void(this._chart.draggingSource=u.source)}u.hittest&&u.hittest.result()===S.REGULAR||(this._processing=!0)}},n.prototype.drawRightThere=function(t){var e,i;this.isLineTool(t)&&(e=this._chart.model(),i=e.crossHairSource(),e.createLineTool(this._state,{index:i.index,price:i.price},t))},n.prototype._finishTool=function(t){var e,i,o=this._chart.model(),n=w.tool.value();w.resetToCursor(),this._hideTooltip(),o.setSelectedSource(t),this._chart.isTextTool(n)&&(e=o.createUndoCheckpoint(),i=new l(t,o,e),i.show(),i.focusOnText())},n.prototype._mouseDownEventForLineTool=function(t,e,i,n){var s,r,a,l,h,c,d,p,_,f,g=this._chart.model(),m=!1,v=null,y=t.localX,b=t.localY,S=this._chart.model().model().crossHairSource(),T=w.tool.value();if(w.hideAllDrawings().setValue(!1),w.lockDrawings().setValue(!1),TradingView.supportTouch()&&this.isLineTool(T)&&"LineToolBrush"!==T&&!g.lineBeingCreated()&&(this._startTouchPoint=new o.Point(y,b),this._initCrossHairPosition=S.currentPoint(),this._skipFirstMove=!0),!g.lineBeingCreated()||g.lineBeingCreated()instanceof u)TradingView.supportTouch()&&"LineToolBrush"!==T||(f={index:i,price:n},v=g.createLineTool(this._state,f,T),g.lineBeingCreated()||(m=!0));else if(TradingView.supportTouch()){if(this._skipFirstMove=!0,!this._startTouchPoint)return this._startTouchPoint=new o.Point(y,b),s=g.lineBeingCreated().points(),r=s[s.length-1],a=g.timeScale().indexToCoordinate(r.index),n=r.price,l=g.lineBeingCreated().priceScale(),l.isPercent()&&(h=g.lineBeingCreated().ownerSource().firstValue(),n=l.priceRange().convertToPercent(n,h)),c=l.priceToCoordinate(n),void(this._lastDrawingPoint=new o.Point(a,c))}else v=g.lineBeingCreated(),d=g.paneForSource(v),d!==this._state?(p=this._dv.offset(),y=t.localX+p.left,b=t.localY+p.top,_=this._chart.paneByState(d),p=_._dv.offset(),y-=p.left,b-=p.top,n=v.priceScale().coordinateToPrice(b),i=Math.round(g.timeScale().coordinateToIndex(y)),m=g.coninueCreatingLine({index:i,price:n},e)):m=g.coninueCreatingLine({index:i,price:n},e);g.setSelectedSource(v),m?this._finishTool(v):TradingView.supportTouch()&&"LineToolBrush"!==T||this._updateTooltip(t.localX,t.localY)},n.prototype._equalsCursorCache=function(t,e){return w.toolIsCursor(t.tool)?t.tool===e.tool&&t.theme===e.theme&&t.crosshair===e.crosshair:t.tool===e.tool&&t.theme===e.theme},n.prototype._setCursor=function(t){this._cursorCache&&this._equalsCursorCache(this._cursorCache,t)||(this._cursorCache=t,w.toolIsCursor(t.tool)?this.jqPane.css("cursor",t.crosshair):this.jqPane.css("cursor",V(t.state.name,t.state.hotspot,t.theme)))},n.prototype.setCursorForTool=function(t,e){var i,o,n={_default:{name:"cursor_cross",hotspot:"11 11"},zoom:{name:"zoom",hotspot:"5 5"},pointer:{name:"cursor_pointinghand",hotspot:"13 7"},dragger:{name:"cursor_closed_hand",hotspot:"8 8"}},s=w.tool.value();w.toolIsCursor(s)&&(this._chart.draggingSource||this._isScrolling||this._chart.model()&&this._chart.model().sourceBeingMoved()?s="dragger":t&&(s="pointer")),this._chart.model()&&this._chart.model().lineBeingEdited()?s=this._chart.model().lineBeingEdited()._constructor:e===S.CHANGEPOINT&&(s=t._constructor),i=n._default,s in n&&(i=n[s]),o="light",this._setCursor({tool:s,theme:o,state:i,crosshair:this.defaultPaneCursor(o)})},n.prototype.setDragToAnotherPaneCursor=function(){var t="light";this._setCursor({tool:"dragger",theme:t,state:{name:"cursor_closed_hand_move",hotspot:"8 8"},crosshair:this.defaultPaneCursor(t)})},n.prototype.defaultPaneCursor=function(t){var e={cursor:{name:"cursor_cross",hotspot:"11 11"},dot:{name:"cursor_dot",hotspot:"11 11"},crosshair:{name:"cursor_cross",hotspot:"11 11"},eraser:{name:"cursor_eraser",hotspot:"5 5"}},i=e[w.tool.value()];return i||(i=e[w.cursorTool.value()]),i?V(i.name,i.hotspot,t):"default"},n.prototype.gestureStartEvent=function(t){this._prev_pinch_scale=1,this._pinching=!0},n.prototype.gestureChangeEvent=function(t){var e,i,o=(t.originalEvent.pageX||t.originalEvent.offsetX)-5,n=this._chart.paneWidgets()[0].lhsPriceAxisWidget.size.w,s=this._chart.model().timeScale().width();n&&(o=Math.max(0,o-n)),o=Math.min(o,s),e=2*(o/s-.5),i=5*(t.scale-this._prev_pinch_scale),i>0?this._chart.model().zoomIn(e,i):this._chart.model().zoomOut(e,-i),this._prev_pinch_scale=t.scale},n.prototype.gestureEndEvent=function(t){this._pinching=!1},n.prototype._updateCommonTooltip=function(t){var e,i,o,n=this._lastCommonTooltipData,s=null;if(t&&t.hittest&&t.hittest.result()===S.CUSTOM&&(e=t.hittest.data(),e&&(s=e.tooltip||null)),null!=n||null!=s)return null==s?(this._lastCommonTooltipData=null,void TradingView.Tooltip.hide()):void(n&&s.text===n.text&&s.rect.x===n.rect.x&&s.rect.y===n.rect.y&&s.rect.w===n.rect.w&&s.rect.h===n.rect.h||(this._lastCommonTooltipData=s,i=TradingView.clone(s),o=this.jqPane.offset(),i.rect.x+=o.left,i.rect.y+=o.top,TradingView.Tooltip.show(i)))},n.prototype.mouseMoveEvent=function(t){var e,i,o,s,r,a,l,h,c,d,p,u=this._chart.model();if(u){if(e=t.localX,i=t.localY,o=new n.EvironmentState(t),this._firstZoomPoint)return void this._processMouseMoveWhileZoom(t);if(this._chart.readOnly()||this._editDialog&&this._editDialog.isVisible()||(this.setCursorForTool(),s=w.tool.value(),r=null,this._processing||!w.toolIsCursor(s)&&"eraser"!==s||(r=this.dataSourceAtPoint(t.localX,t.localY),a=r&&r.source,l=this._chart.model().crossHairSource(),a&&("LineToolOrder"===a.toolname||"LineToolPosition"===a.toolname||"AlertLabel"===a.toolname)?l.visibleTrap=!1:l.visibleTrap=!0,r.hittest&&r.hittest.result()>S.MOVEPOINT_BACKGROUND?(this.setCursorForTool(r.source,r.hittest?r.hittest.result():null),!r.source||"eraser"===s&&r.source.constructor===TradingView.Series?u.setHoveredSource(null):u.setHoveredSource(r.source,r.hittest.data())):u.setHoveredSource(null)),this._updateCommonTooltip(r)),this._chart.readOnly()&&(r=this.dataSourceAtPoint(t.localX,t.localY),null!==r.source?u.setHoveredSource(r.source,r.hittest.data()):u.setHoveredSource(null,null)),this._chart.model().lineBeingCreated()&&(h=this._chart.model().lineBeingCreated(),c=this._chart.model().paneForSource(h),c!==this._state))return d=this._dv.offset(),e+=d.left,i+=d.top,p=this._chart.paneByState(c),d=p._dv.offset(),e-=d.left,i-=d.top,void u.setCurrentPosition(e,i,c);s=w.tool.value(),TradingView.supportTouch()&&this.isLineTool(s)||(u.setCurrentPosition(e,i,this._state,o),this._updateTooltip(e,i))}},n.prototype.pressedMouseMoveEvent=function(t){var i,s,r,a,l,h,c,d,_,f,g,m,v,y,b,S,T,C,x,P,L,k,E,I,A,$,M,D;if(!this._pinching){if(this._skipFirstMove?(delete this._skipFirstMove,delete this._touchMove):this._touchMove=!0,i=new n.EvironmentState(t),s=this._chart.model(),r=t.localX,a=t.localY,this._firstZoomPoint)return this._processMouseMoveWhileZoom(t),void(this._firstZoomPoint.draggingMode=!0);if(l=w.tool.value(),TradingView.supportTouch()&&this._startTouchPoint&&this.isLineTool(l)&&"LineToolBrush"!==l&&!s.lineBeingCreated())return h=this._initCrossHairPosition,c=new o.Point(r,a),d=c.substract(this._startTouchPoint),_=h.add(d),this._chart.model().setCurrentPosition(_.x,_.y,this._state),void this._updateTooltip(_.x,_.y);if(TradingView.supportTouch()&&s.lineBeingCreated()&&!(s.lineBeingCreated()instanceof u))return void(this._startTouchPoint&&(f=s.lineBeingCreated(),g=t.localX-this._startTouchPoint.x,m=t.localY-this._startTouchPoint.y,v=this._lastDrawingPoint.x+g,y=this._lastDrawingPoint.y+m,b=this._chart.model().paneForSource(f),s.setCurrentPosition(v,y,b),this._updateTooltip(v,y)));if(s.setCurrentPosition(r,a,this._state,i),this._updateTooltip(r,a),S=w.tool.value(),(!this.isLineTool(S)||"LineToolBrush"===l)&&(0===t.button||Modernizr.touch)){if("LineToolBrush"===S){if(T=this._state.defaultPriceScale(),T.isEmpty())return;if(!this._chart.model().lineBeingCreated())return;return C=T.coordinateToPrice(t.localY),x=Math.round(this._chart.model().timeScale().coordinateToIndex(t.localX)),void((!e.enabled("charting_library_base")||x>=0)&&this._chart.model().coninueCreatingLine({index:x,price:C}))}if(this._chart.draggingSource&&(P=t.target,L=this._chart.paneByCanvas(P),L&&(L!==this?L.setDragToAnotherPaneCursor():L.setCursorForTool()),k=this._chart.priceAxisByCanvas(P),k&&k.jqCell.css("cursor",V("cursor_closed_hand","8 8")),E=this._chart.timeAxisByCanvas(P),E&&(E.jqCell.css("cursor",V("cursor_closed_hand_move","8 8")),E.jqCell.focus())),s.timeScale().isEmpty())return;if(s.lineBeingEdited())return x=Math.round(this._chart.model().timeScale().coordinateToIndex(r)),(!e.enabled("charting_library_base")||x>=0)&&s.changeLinePoint({x:r,y:a},i),this._updateTooltip(r,a),void this.setCursorForTool();if(s.sourceBeingMoved()){if(T=s.sourceBeingMoved().priceScale(),T.isEmpty())return;if(x=this._chart.model().timeScale().coordinateToIndex(t.localX),C=T.coordinateToPrice(t.localY),I=s.sourceBeingMoved(),this.setCursorForTool(),e.enabled("charting_library_base")&&!s.sourceBeingMoved().onlyYMoving()&&(A=I.points(),0!==A.length&&($=A.reduce(function(t,e){return e.index<t.index?e:t}).index,$-((I._currentMovingPoint||I._startMovingPoint).index-x)<0)))return;return TradingView.isInherited(I.constructor,p)&&I.isFixed()?void s.moveSource(new o.Point(r,a)):void s.moveSource({index:x,price:C},i)}if(i.control&&this._clonningAtMoveLineTool)return f=this._clonningAtMoveLineTool,M=this.cloneLineTool(f,!0),D=this._chart.model().model().dataSourceForId(M),this._chart.model().setSelectedSource(D),s.startMovingSource(D,{index:this._chart.model().timeScale().coordinateToIndex(t.localX),price:f.priceScale().coordinateToPrice(t.localY)}),void(this._clonningAtMoveLineTool=null);T=this._state.defaultPriceScale(),this._startScrollingPos||(this._startScrollingPos={x:t.clientX,y:t.clientY}),this._startScrollingPos&&(this._startScrollingPos.x===t.clientX&&this._startScrollingPos.y===t.clientY||this._isScrolling||(s.beginUndoMacro("scroll"),T.isEmpty()||s.startScrollPrice(this._state,T,t.localY),s.startScrollTime(t.localX),this._isScrolling=!0,this.setCursorForTool())),this._isScrolling&&(T.isEmpty()||s.scrollPriceTo(this._state,T,t.localY),s.scrollTimeTo(t.localX))}}},n.prototype._processMouseUpForCustomHandler=function(t){var e,i=this.dataSourceAtPoint(t.localX,t.localY);i.hittest&&i.hittest.result()===S.CUSTOM&&(e=i.hittest.data().mouseUpHandler,e&&e(t))},n.prototype.mouseUpEvent=function(t){var e,i,o,n,r,a,l,h,c,d,p,_,g,m,v,y,b,S,T,P,L,k,E,I,A,V,$,M;if(this._processMouseUpForCustomHandler(t),this._clonningAtMoveLineTool=null,e=this,x.emit("mouse_up",{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,screenX:t.screenX,screenY:t.screenY}),i=this._chart.model(),o=this._touchMove,delete this._touchMove,n=w.tool.value(),TradingView.supportTouch()&&!o&&"LineToolBrush"!==n&&this.isLineTool(n)&&!i.lineBeingCreated())return r=i.crossHairSource().currentPoint(),a=this._state.defaultPriceScale(),l=a.coordinateToPrice(r.y),h=Math.round(i.timeScale().coordinateToIndex(r.x)),c={index:h,price:l},d=i.createLineTool(this._state,c,n),i.setSelectedSource(d),i.lineBeingCreated()||this._finishTool(d),this._updateTooltip(r.x,r.y),void delete this._startTouchPoint;if(i.lineBeingCreated()&&!(i.lineBeingCreated()instanceof u)&&this._startTouchPoint)return p=!1,delete this._startTouchPoint,o||(d=i.lineBeingCreated(),_=d.points()[d.points().length-1],l=_.price,g=d.priceScale(),g.isPercent()&&(m=i.lineBeingCreated().ownerSource().firstValue(),l=g.priceRange().convertToPercent(l,m)),p=i.coninueCreatingLine({index:_.index,price:l},{}),delete this._lastDrawingPoint),void(p&&this._finishTool(d));if(this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(t);if(0===t.button||TradingView.supportTouch()){if(this._processing=!1,i=this._chart.model(),i.lineBeingEdited())return i.endChangingLinetool(),void this._hideTooltip();if("LineToolBrush"===n){if(i.finishLineTool(),a=this._state.defaultPriceScale(),a.isEmpty())return;if(!this._chart.model().lineBeingCreated())return;return l=a.coordinateToPrice(t.localY),h=Math.round(this._chart.model().timeScale().coordinateToIndex(t.localX)),void this._chart.model().coninueCreatingLine({index:h,price:l})}if(v=i.sourceBeingMoved())return i.endMovingSource(),this._hideTooltip(),this.setCursorForTool(v),void i.invalidate(new C(C.UPDATE_CURSOR_ONLY));this._isScrolling||this._chart.readOnly()||this._syncTimeout||(y=i.selectedSource(),(!y||y instanceof f)&&(this._syncTimeout=setTimeout(function(){e._syncTimeout=null,e._chart.model().model().onSyncScrollNeeded()},600))),b=this._isScrolling&&s.UndoHistory.undoStack().head()instanceof s.UndoMacroCommand,this._isScrolling&&(a=this._state.defaultPriceScale(),i.endScrollPrice(this._state,a),e=this,S=function(){i.endScrollTime(),i.endUndoMacro(),e._startScrollingPos=void 0,e._isScrolling=!1,e.setCursorForTool()},TradingView.supportTouch()?(T=i.timeScale().m_scrollStartPoint,P=.05*(t.localX-T),L=null,k=function(e){var o,n;null===L&&(L=e),o=.01*Math.min(100,3*(e-L)),o=Math.sqrt(o),n=t.localX+P*o,i.scrollTimeTo(n),o>=1?S():requestAnimationFrame(k)},requestAnimationFrame(k)):S()),this._chart.draggingSource&&(E=t.target,I=this._chart.paneByCanvas(E),I&&I!==this&&(A=I._state.findSuitableScale(this._chart.draggingSource),b&&(b=!1,s.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,I._state,A)),V=this._chart.priceAxisByCanvas(E),V&&(I=V.pane,a=V._isLeft?I._state.leftPriceScale():I._state.rightPriceScale(),b&&(b=!1,s.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,I._state,a)),$=this._chart.timeAxisByCanvas(E),$&&(b&&(b=!1,s.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,null,null),$.jqCell.css("cursor","")),this._chart.draggingSource=null,M=this.dataSourceAtPoint(t.localX,t.localY),this.setCursorForTool(M.source,M.hittest||null))}delete this._touchMove},n.prototype.mouseLeaveEvent=function(t){var e=this._chart.model();e&&(TradingView.isMobile.any()||e.model().clearCurrentPosition(),e.setHoveredSource(null),this._updateCommonTooltip(null),"function"==typeof this.onMouseLeave&&this.onMouseLeave(this))},n.prototype.mouseClickEvent=function(t){this._chart.model().hoveredSource()instanceof _&&this._chart.model().hoveredSource().onClicked()},n.prototype.showEditDialogForSource=function(t){this.chart().onWidget()||t.userEditEnabled&&!t.userEditEnabled()||(this._editDialog=new l(t,this._chart.model()),this._editDialog.show())},n.prototype.mouseDoubleClickEvent=function(t){var e,i=!this._chart.readOnly()&&!this.isLineTool(w.tool.value())&&this.dataSourceAtPoint(t.localX,t.localY),o=i&&i.hittest&&i.source,n=this;this._syncTimeout&&(clearTimeout(this._syncTimeout),this._syncTimeout=setTimeout(function(){n._syncTimeout=null},100)),o&&i.hittest.result()<=S.MOVEPOINT_BACKGROUND&&!TradingView.isMobile.any()&&(o=null),o&&o.customization&&o.customization.disableSelection&&(o=null),o&&o._metaInfo&&"Sessions@tv-basicstudies"===o._metaInfo.id&&(o=this._chart.model().mainSeries()),o?(e=!1,e?TradingView.alertsDispatcher.openEditDialog(i.source.alert()):this.showEditDialogForSource(o)):this._chart.readOnly()||this.isLineTool(w.tool.value())||this._chart.model().lineBeingCreated()||this._chart.model().selectedSource()||this._chart.toggleMaximizePane(this)},n.prototype.showContextMenuForSource=function(t,e){t.hasContextMenu()&&(this._chart.model().setSelectedSource(t),t.constructor===TradingView.Series?this._seriesContextMenu(t).show(e):TradingView.isInherited(t.constructor,r)?this._studyContextMenu(t).show(e):TradingView.isInherited(t.constructor,c)||TradingView.isInherited(t.constructor,d)?this._tradingDrawingsContextMenu(t).show(e):TradingView.isInherited(t.constructor,p)&&this._lineContextMenu(t).show(e))},n.prototype.contextMenuEvent=function(t,i){var o,n,s,r;if(e.enabled("pane_context_menu")){if(this._chart.model().crossHairSource().startMeasurePoint())return void this._chart.model().crossHairSource().clearMeasure();if(!this._pinching&&(this._firstZoomPoint&&this.cancelZoom(),!this.hideInplaceEditor())){if(!w.toolIsCursor(w.tool.value())){if(TradingView.isMobile.any())return;return w.resetToCursor(!0),this.setCursorForTool(),this._hideTooltip(),void(this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine())}this.chart().readOnly()||this._disableContextMenu||(this._chart.model().mainSeries().createSessStudy(),this._chart.updateActions(),this._contextMenuX=t.localX,this._contextMenuY=t.localY,o=this.dataSourceAtPoint(t.localX,t.localY),n=o?o.source:null,s=o&&o.hittest?o.hittest.result():0,r=s>=S.REGULAR||s>=S.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any(),null!==n&&r?this.showContextMenuForSource(n,t):(this._contextMenu(t).then(function(e){return e.show(t)}),this._chart.model().setSelectedSource(null)),this.paint())}}},n.prototype._contextMenu=function(t){function e(t){return null===t.text}var i=this;return Promise.all(this._initActions(t)).then(function(t){var o,n,s=i._customActions();for(t=t.filter(function(t){return null!==t}),s.remove.forEach(function(e){for(var i=0;i<t.length;i++)if(t[i].text===e){t.splice(i,1);break}}),o=s.top.concat(t).concat(s.bottom),n=o.length-1;n>0;n--)e(o[n])&&e(o[n-1])&&o.splice(n,1);return o.length&&e(o[0])&&o.splice(0,1),
o.length&&e(o[o.length-1])&&o.splice(o.length-1,1),b.createMenu(o)})},n.prototype.createRemoveMenu=function(){var t,e=this._chart.actions(),i=new m({text:$.t("Remove")});return i.subActions||(i.subActions=[]),t=i.subActions,t.push(e.paneRemoveAllStudies),t.push(e.paneRemoveAllDrawingTools),t.push(e.paneRemoveAllStudiesDrawingTools),i},n.prototype.createDrawingMenu=function(){var t,i=this._chart.actions(),o=new m({text:$.t("Drawing Tools")});return o.subActions||(o.subActions=[]),t=o.subActions,t.push(i.drawingToolbarAction),e.enabled("charting_library_base")||t.push(i.favoriteDrawingToolbar),t.push(new y),t.push(i.magnetAction),t.push(i.stayInDrawingModeAction),e.enabled("support_multicharts")&&t.push(i.syncModeAction),t.push(new y),t.push(i.lockDrawingsAction),t.push(i.hideAllDrawingsAction),t.push(i.paneRemoveAllDrawingTools),o},n.prototype._initActions=function(t){var i,o,n,s,r,a=this,l=this._chart.actions(),h=[];return e.enabled("datasource_copypaste")&&(i=M.get(),!i||"study"!==i.type&&"drawing"!==i.type||(o=new m({text:$.t("Paste %s",$.t(i.title||i.type)),shortcut:"Ctrl-V"}),o.callbacks().subscribe(null,function(){a._chart.onAppClipboardPaste(a.state())}),h.push(o))),l.gotoDate&&h.push(l.gotoDate),h.length&&h.push(new y),h.push(l.chartReset),h.push(l.symbolSearch),h.push(l.changeInterval),n=window.widgetbar&&(!window.widgetbar._customization||window.widgetbar._customization.watchlist),n&&h.push(l.addToWatchlist),e.enabled("text_notes")&&h.push(l.addToTextNotes),e.enabled("symbol_info")&&h.push(l.showSymbolInfoDialog),h.push(new y),h.push(this._createLockTimeAxisAction(t)),h.push(new y),h.push(l.paneObjectTree),h.push(l.insertIndicator),e.enabled("charting_library_base")||h.push(l.applyStudyTemplate),e.enabled("compare_symbol")&&h.push(l.compareOrAdd),h.push(this.createDrawingMenu()),e.enabled("charting_library_base")&&h.push(l.hideAllMarks),h.push(this.createRemoveMenu()),h.push(new y),s=this._priceAxisMenu(),s&&h.push(s),r=this._timeAxisMenu(),r&&h.push(r),e.enabled("charting_library_base")||h.push(l.applyColorTheme),e.enabled("show_chart_property_page")&&h.push(l.chartProperties),pro.hasPackage("mtp-mtpredictor")&&this.state().containsMainSeries()&&(h.push(new y),h.push(this._createMTPredictorActions())),h},n.prototype._customActions=function(){var t,i={top:[],bottom:[],remove:[]},o=this._chart.model(),n=o.timeScale(),s=this._state.defaultPriceScale();return e.enabled("custom_items_in_context_menu")?(t=n.isEmpty()?void 0:n.indexToUserTime(n.coordinateToIndex(this._contextMenuX)),x.emit("onContextMenu",{unixtime:t?t/1e3:void 0,price:s.isEmpty()?void 0:s.coordinateToPrice(this._contextMenuY),callback:function(t){[].concat(t).forEach(function(t){if(t.text)if(t.text.length>1&&"-"===t.text[0])i.remove.push(t.text.slice(1));else{var e;"-"===t.text?e=new y:(e=new m({text:t.text}),e.callbacks().subscribe(null,t.click)),t.position&&"top"===t.position?i.top.push(e):i.bottom.push(e)}})}}),i):i},n.prototype._timeAxisMenu=function(){if(this._chart.model().timeScale().isEmpty())return null;var t=this._chart.getTimeScale();return new m({text:$.t("Time Scale"),subActions:t.getContextMenuActions()})},n.prototype.getDefaultPriceAxisWidget=function(){var t=this._state.defaultPriceScale();return t.isEmpty()?null:t===this._state.leftPriceScale?this.leftPriceAxisWidget():this.rightPriceAxisWidget()},n.prototype._priceAxisMenu=function(){var t=this.getDefaultPriceAxisWidget();return t?new m({text:$.t("Price Scale"),subActions:t.getContextMenuActions()}):null},n.prototype._seriesContextMenu=function(t){var i,o,n,s,r,a=this._chart.actions(),l=t.properties().visible.value(),h=null;if(this._chart.readOnly())i=[l?a.seriesHide:this.createActionShow(t),new y,this.createActionShowCountdown(t),new y,this.createActionScaleLeft(t),this.createActionScaleRight(t),this.createActionNoScale(t)],e.enabled("countdown")||i.splice(3,1),h=b.createMenu(i);else{if(o=this._mergeContentMenuItems(t),n=[a.showSymbolInfoDialog,a.compare,l?a.seriesHide:this.createActionShow(t),this.createVisualOrderAction(t),new y,this.createActionShowCountdown(t),new y],e.enabled("countdown")||n.splice(5,2),e.enabled("compare_symbol")||n.splice(1,1),e.enabled("symbol_info")||n.splice(0,1),!this.chart().onWidget()&&e.enabled("show_chart_property_page")&&n.unshift(a.format),s=this.createActionLockScale(t),s&&(n.push(s),n.push(new y)),o.length>0){for(r=0;r<o.length;r++)n.push(o[r]);n.push(new y)}n.push(this.createActionScaleLeft(t)),n.push(this.createActionScaleRight(t)),n.push(this.createActionNoScale(t)),pro.hasPackage("mtp-mtpredictor")&&(n.push(new y),n.push(this._createMTPredictorActions())),h=b.createMenu(n)}return h},n.prototype.toggleLockTimeAxis=function(t,e){var i,o,n;"boolean"!=typeof e&&(e=!w.lockTimeAxis().value()),e&&(i=this._chart.model().timeScale(),o=i.coordinateToIndex(t),n=i.points().roughTime(o),w.lockTimeAxisTime.setValue(n)),w.lockTimeAxis().setValue(e)},n.prototype._createLockTimeAxisAction=function(t){var e=new m({text:$.t("Lock Cursor In Time"),checkable:!0}),i=w.lockTimeAxis().value();return e.setChecked(i),e.callbacks().subscribe(null,this.toggleLockTimeAxis.bind(this,t.localX,!i)),e},n.prototype._createHVLineAction=function(t,e){e="vertical"===e&&"vertical"||"horizontal";var i=new m({text:"vertical"===e?$.t("Create Vertical Line"):$.t("Create Horizontal Line")});return i.callbacks().subscribe(this,function(){var i=this._chart.model().timeScale().coordinateToIndex(t.localX),o=this._state.defaultPriceScale().coordinateToPrice(t.localY),n=this._chart.model().createLineTool(this._state,{index:i,price:o},"vertical"===e&&"LineToolVertLine"||"LineToolHorzLine");this._finishTool(n)}),i},n.prototype._createMTPredictorActions=function(){var t=this,e=function(e,i,o){var n=new m({text:e});return n.callbacks().subscribe(t,function(){var t,e,n=this._chart.model(),s=n.timeScale(),r=this._state.defaultPriceScale();s.isEmpty()||r.isEmpty()||(o?(t=r.coordinateToPrice(this._contextMenuY),e=Math.round(s.coordinateToIndex(this._contextMenuX)),n.createLineTool(this._state,{index:e,price:t},i)):w.tool.setValue(i))}),n};return new m({text:$.t("MTPredictor"),subActions:[e($.t("Apply Manual Risk/Reward"),"LineStudyMtpRiskReward",!1),e($.t("Apply Manual Decision Point"),"LineStudyMtpDecisionPoint",!0),e($.t("Analyze Trade Setup"),"LineStudyMtpAnalysis",!0),new m({text:$.t("Apply Elliot Wave"),subActions:[e($.t("Apply Elliot Wave Intermediate"),"LineStudyMtpElliotWaveMain",!0),e($.t("Apply Elliot Wave Major"),"LineStudyMtpElliotWaveMajor",!0),e($.t("Apply Elliot Wave Minor"),"LineStudyMtpElliotWaveMinor",!0)]}),new m({text:$.t("Apply WPT Up Wave"),subActions:[e($.t("Up Wave 1 or A"),"LineStudyMtpUpWave1OrA",!1),e($.t("Up Wave 2 or B"),"LineStudyMtpUpWave2OrB",!1),e($.t("Up Wave C"),"LineStudyMtpUpWaveC",!1),e($.t("Up Wave 3"),"LineStudyMtpUpWave3",!1),e($.t("Up Wave 4"),"LineStudyMtpUpWave4",!1),e($.t("Up Wave 5"),"LineStudyMtpUpWave5",!1)]}),new m({text:$.t("Apply WPT Down Wave"),subActions:[e($.t("Down Wave 1 or A"),"LineStudyMtpDownWave1OrA",!1),e($.t("Down Wave 2 or B"),"LineStudyMtpDownWave2OrB",!1),e($.t("Down Wave C"),"LineStudyMtpDownWaveC",!1),e($.t("Down Wave 3"),"LineStudyMtpDownWave3",!1),e($.t("Down Wave 4"),"LineStudyMtpDownWave4",!1),e($.t("Down Wave 5"),"LineStudyMtpDownWave5",!1)]})]})},n.prototype.createEarningsShow=function(t){var e=this._chart.model().mainSeries().properties().esdShowEarnings,i=new m({checkable:!0,text:$.t("Show Earnings"),enabled:!0,checked:e.value()});return i.callbacks().subscribe(this,function(t){this._chart.model().setProperty(e,t.checked,"Show Earnings")}),i},n.prototype.createDividendsShow=function(t){var e=this._chart.model().mainSeries().properties().esdShowDividends,i=new m({checkable:!0,text:$.t("Show Dividends"),enabled:!0,checked:e.value()});return i.callbacks().subscribe(this,function(t){this._chart.model().setProperty(e,t.checked,"Show Dividends")}),i},n.prototype.createSplitsShow=function(t){var e=this._chart.model().mainSeries().properties().esdShowSplits,i=new m({checkable:!0,text:$.t("Show Splits"),enabled:!0,checked:e.value()});return i.callbacks().subscribe(this,function(t){this._chart.model().setProperty(e,t.checked,"Show Splits")}),i},n.prototype._studyEsdContextMenu=function(t){var e,i=[];return this._chart.readOnly()||(i.push(this.createDividendsShow(t)),i.push(this.createSplitsShow(t)),i.push(this.createEarningsShow(t))),e=b.createMenu(i)},n.prototype._studyContextMenu=function(t){var i,o,n,s,r,a=this._chart.actions(),l=t.properties().visible.value(),h=[],c=null;return t.userEditEnabled()?(i=this._chart,t.properties().linkedToSeries&&t.properties().linkedToSeries.value()?this._chart.readOnly()?h.push(l?a.studyHide:this.createActionShow(t)):(h.push(a.format),h.push(l?a.studyHide:this.createActionShow(t)),h.push(this.createVisualOrderAction(t)),h.push(new y),h.push(a.studyRemove)):this._chart.readOnly()?h=[l?a.studyHide:this.createActionShow(t),new y,this.createActionScaleLeft(t),this.createActionScaleRight(t),this.createActionNoScale(t)]:(o=[],n=t.metaInfo(),n.TVScriptSourceCode&&n.scriptIdPart&&(o=[a.viewSourceCode]),h=[],h=h.concat([a.format]),h=h.concat(o),h=h.concat([l?a.studyHide:this.createActionShow(t),this.createVisualOrderAction(t),new y]),s=this._mergeContentMenuItems(t),s.length&&s.push(new y),h=h.concat(s),h.push(this.createActionScaleLeft(t)),h.push(this.createActionScaleRight(t)),h.push(this.createActionNoScale(t)),h.push(new y),e.enabled("datasource_copypaste")&&(r=new m({text:$.t("Copy"),shortcut:"Ctrl-C"}),r.callbacks().subscribe(null,function(){i.onAppClipboardCopy(t)}),h.push(r)),h.push(a.studyRemove)),c=b.createMenu(h)):c=b.createMenu(h)},n.prototype.createLineToolTemplateAction=function(t){var e,i,o,n,s,r=t.properties(),a=window.lineToolPropertiesToolbar.templatesList,l=new m({text:$.t("Templates")});return l.subActions||(l.subActions=[]),e=l.subActions,i=new m({text:$.t("Save As...")}),i.callbacks().subscribe(this,function(){a.showSaveDialog(t)}),e.push(i),o=new m({text:$.t("Apply Default")}),o.callbacks().subscribe(this,function(){r.restoreFactoryDefaults(),window.lineToolPropertiesToolbar.onSourceChanged(t)}),e.push(o),n=$.Deferred(),a.templatesLoaded().then(function(){var t=a.getData(),e=[];0!==t.length&&e.push(new y),$.each(t,function(t,i){function o(t){return function(){var e=this.getTopLevelMenu();return e&&e.hide(),a.deleteAction(t),!0}}var n=new m({text:i});n.callbacks().subscribe(this,function(){a.loadTemplate(i)}),n.deleteButton={action:o(n.text)},e.push(n)}),n.resolve(e)}),s=new v(n),e.push(s),l},n.prototype._lineContextMenu=function(t){var o,s,r,a,l=this._chart.actions(),h=[],c=this._chart,d=i(259).hasStylesPropertyPage;if(this._chart.readOnly())h.push(l.lineHide);else if(t.userEditEnabled()&&(e.enabled("alerts")&&!this.chart().onWidget()&&t.hasAlert.value()&&h.push(this._createEditAlertDrawingAction(t)),d(t,this._chart.model())&&h.push(l.format),h.push(l.paneObjectTree),e.enabled("charting_library_base")||h.push(this.createLineToolTemplateAction(t)),h.push(this.createVisualOrderAction(t)),h.push(new y),h.push(l.lineHide),h.push(l.lineToggleLock),t.properties().clonable&&t.properties().clonable.value()&&(o=new m({text:$.t("Clone"),callbackContext:{target:t},shortcut:"Ctrl+Drag",doNotBindShortcut:!0}),o.callbacks().subscribe(this,n.prototype.cloneLineTool.bind(this,t,!1)),h.push(o)),e.enabled("datasource_copypaste")&&!t.properties().blockCopying&&(s=new m({text:$.t("Copy"),shortcut:"Ctrl-C"}),s.callbacks().subscribe(null,function(){c.onAppClipboardCopy(t)}),h.push(s)),e.enabled("support_multicharts")&&(t.linkKey?h.push(l.lineUnlink):h.push(l.lineCopyToCharts)),h.push(l.lineRemove),t.additionalActions))for(h.push(new y),l=t.additionalActions(this._chart.model()),r=0;r<l.length;r++)h.push(l[r]);return a=b.createMenu(h)},n.prototype._tradingDrawingsContextMenu=function(t){return b.createMenu(t.contextMenuItems())},n.prototype._chartEventsContextMenu=function(t){var e,i=[],o=this._chart,n=new m({text:$.t("Format..."),enabled:!0});return n.callbacks().subscribe(this,function(t){TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Events & Alerts")),o.showChartProperties()}),i.push(n),e=new m({text:$.t("Hide Events on Chart"),enabled:!0}),e.callbacks().subscribe(this,function(e){t.properties().visible.setValue(!1)}),i.push(e),b.createMenu(i)},n.prototype._createAlertToggleHorzLineLabelAction=function(t){var e=t.properties().line.visible,i=new m({checkable:!0,text:$.t("Extend Alert Line"),enabled:!0,checked:e.value()});return i.callbacks().subscribe(this,function(t){var i=t.checked,o=i?$.t("Show alert label line"):$.t("Hide alert label line");this._chart.model().setProperty(e,i,o)}),i.setEnabled(t.globalProperties().line.visible.value()),i},n.prototype._createShowGlobalAlertPropertiesLabelAction=function(t){var e=this.chart(),i=new m({text:$.t("Visual settings...")});return i.callbacks().subscribe(this,function(t){e.showChartProperties({selectAlertEvent:!0})}),i},n.prototype._createEditAlertDrawingAction=function(t){if(t.hasAlert.value()){var e=new m({text:$.t("Edit {0} Alert...").format(t.title())});return e.callbacks().subscribe(null,function(){runOrSignIn(function(){t.editAlert()},{source:"Alert edit from pane context menu"})}),e}},n.prototype.cloneLineTool=function(t,e){return this._chart.model().cloneLineTool(t,e)},n.prototype.setPriceAxisSize=function(t,e){this._priceAxisWidget(t).setSize(e)},n.prototype.setPriceAxisVisible=function(t,e){this._priceAxisWidget(t).setVisible(e),this._cachedStatus=null},n.prototype.resetPriceAxisOptimalWidth=function(t){this._priceAxisWidget(t).resetOptimalWidth(),this._cachedStatus=null},n.prototype.setSize=function(t){this.size&&this.size.equals(t)||(this.size=t,L(this.canvas,t),L(this.top_canvas,t),this.ctx=this.canvas.getContext("2d"),this.jqPane.width(t.w),this.jqPane.height(t.h),this._cachedStatus=null,this.jqRow.toggleClass("js-hidden",0===t.h))},n.prototype.dataSourceAtPoint=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m=null,v=null;if(!this._state)return null;for(i=this._state.hitTestSources(),n=i.length;0<n--;)if(s=i[n],r=s.paneViews(this._state))for(a=r.length;0<a--;)l=r[a].renderer(e),l&&l.hitTest&&(h=l.hitTest(new o.Point(t,e)),h&&(c=v?v.result():0,h.result()>c&&(v=h,m=s)));if(this.containsMainSeries()){for(d=this._chart.model().barsMarksSources(),n=0;n<d.length;++n)for(s=d[n],r=s.paneViews(),a=0;a<r.length;a++)if(l=r[a].renderer(e),p=l.hitTest(new o.Point(t,e))){v=p,m=s;break}u=this._chart.model().activeStrategySource().value(),_=u&&u._strategyOrdersPaneView,_&&(f=_.renderer(),f&&(g=f.hitTest(new o.Point(t,e)))&&(v=g,m=u))}return null===m&&(m=this.legendWidget.dataSourceAtPoint(t,e)),{source:m,hittest:v}},n.prototype.update=function(){this.lhsPriceAxisWidget.update(),this.rhsPriceAxisWidget.update(),this.legendWidget.update(),this.paneControls&&this.paneControls.update()},n.prototype.updateControls=function(){this.paneControls&&this.paneControls.update()},n.prototype.drawBackground=function(t,e){k(t,0,0,this.size.w,this.size.h,e)},n.prototype.drawGrid=function(t){var e,i,o=this._chart.model().gridSource(),n=o.paneViews(this._state);for(e=0;e<n.length;e++)t.save(),i=n[e].renderer(t.canvas.height),i&&i.draw(t),t.restore()},n.prototype.drawWatermark=function(t){var e,i,o=this._chart.model().watermarkSource(),n=o.paneViews(this._state);for(e=0;e<n.length;e++)t.save(),i=n[e].renderer(t.canvas.height),i&&i.draw(t),t.restore()},n.prototype.drawCrossHair=function(t){var e=this._chart.model().crossHairSource();e.visibleTrap&&(!e.visible&&w.lockTimeAxis().value()&&(e.setLockedPosition(this._state),e.updateAllViews()),this._drawSource(e,t))},n.prototype._drawSource=function(t,e){var i,o,n=t.paneViews(this._state);if(n)for(i=0;i<n.length;i++)o=n[i].renderer(e.canvas.height),o&&(e.save(),o.draw(e),e.restore())},n.prototype._drawSourceStrategyOrders=function(t,e){var i,o=t._strategyOrdersPaneView;o&&(i=o.renderer(),i&&(e.save(),i.draw(e),e.restore()))},n.prototype._drawSourceBackground=function(t,e){var i,o,n=t.paneViews(this._state);if(n)for(i=0;i<n.length;i++)o=n[i].renderer(e.canvas.height),o&&o.drawBackground&&(e.save(),o.drawBackground(e),e.restore())},n.prototype.drawActiveLineTool=function(t){var e,i,o,n=[this._chart.model().lineBeingCreated(),this._chart.model().sourceBeingMoved(),this._chart.model().lineBeingEdited()];for(e=0;e<n.length;e++)i=n[e],i&&(o=this._chart.model().paneForSource(i),o===this._state&&this._drawSource(i,t))},n.prototype.disableDrawOnTop=function(t){return t&&t.hasOwnProperty("_metaInfo")&&"Volume@tv-basicstudies"===t._metaInfo.id},n.prototype.drawSources=function(t){var e,i,o,n,s=this._state.orderedSources(),r=this._state.model(),a=this._chart.model().hoveredSource(),l=r.crossHairSource(),h=[this._chart.model().lineBeingCreated(),this._chart.model().sourceBeingMoved(),this._chart.model().lineBeingEdited()];for(this.disableDrawOnTop(a)&&(a=void 0),e=this._chart.model().model().panes(),i=e.length-1;i>=0;i--)e[i].createDrawingsCaches();for(i=0;i<s.length;i++)this._drawSourceBackground(s[i],t);for(i=0;i<s.length;i++)o=s[i],o!==l&&o!==a&&h.indexOf(o)===-1&&this._drawSource(o,t);for(a&&h.indexOf(a)===-1&&s.indexOf(a)!==-1&&this._drawSource(a,t),n=this._chart.model().activeStrategySource().value(),n&&this.containsMainSeries()&&this._drawSourceStrategyOrders(n,t),i=e.length-1;i>=0;i--)e[i].clearDrawingCaches()},n.prototype.recalculatePriceScale=function(){var t,e,i,o=this._state;for(o.recalculatePriceScale(o.m_rightPriceScale),o.recalculatePriceScale(o.m_leftPriceScale),t=o.dataSources(),e=0;e<t.length;++e)i=t[e],o.isOverlay(i)&&(i instanceof p||o.recalculatePriceScale(i.priceScale()),i.updateAllViews())},n.prototype.containsMainSeries=function(){return this._state.containsMainSeries()},n.prototype.drawBarsMarks=function(t,e){var i,o;this.containsMainSeries()&&!e&&(i=this._chart.model().barsMarksSources(),o=this,i.forEach(function(e){o._drawSource(e,t)}))},n.prototype._syncOverlays=function(){var t,e,i=this._state.orderedSources(),o={},n=this;$.each(i,function(){var t,e,i=this.paneViews(n._state);if(i)for(t=0;t<i.length;t++)e=i[t],e.uid&&(o[e.uid()]=e)});for(t in this._overlays)o[t]||(this._dv.remove(this._overlays[t]),this._overlays[t]=void 0);for(t in o)this._overlays[t]||(e=o[t].overlay(),this._dv.append(e),this._overlays[t]=e)},n.prototype.paint=function(t,e){if(t&&this._chart.model())if(this.lhsPriceAxisWidget.paint(t),this.rhsPriceAxisWidget.paint(t),t===C.FULL_UPDATE&&(this._cachedStatus=null),t===C.UPDATE_CURSOR_ONLY)this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),this.drawCrossHair(this.top_ctx),this.drawActiveLineTool(this.top_ctx);else{var i=this.ctx;this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),this.drawBackground(i,this.backgroundColor()),this._state&&(this.recalculatePriceScale(),this.drawGrid(i),this.drawWatermark(i),this.drawSources(i),this.drawBarsMarks(i,e),this.drawCrossHair(this.top_ctx),this.drawActiveLineTool(this.top_ctx))}},n.prototype.leftPriceAxisWidget=function(){return this.lhsPriceAxisWidget},n.prototype.rightPriceAxisWidget=function(){return this.rhsPriceAxisWidget},n.prototype._priceAxisWidget=function(t){return h.isLeft(t)?this.lhsPriceAxisWidget:this.rhsPriceAxisWidget},n.prototype.statusWidget=function(){return this.legendWidget},n.prototype.onScaleLeft=function(t){var e=t.callbackContext();this._state.leftPriceScale().dataSources().indexOf(e)===-1&&this.chart().model().move(e,this._state,this._state.leftPriceScale())},n.prototype.onScaleRight=function(t){var e=t.callbackContext();this._state.rightPriceScale().dataSources().indexOf(e)===-1&&this.chart().model().move(e,this._state,this._state.rightPriceScale())},n.prototype.onNoScale=function(t){var e=t.callbackContext();this._state.isOverlay(e)||this.chart().model().move(e,this._state,null)},n.prototype.onRiskReward=function(t){},n.prototype.createActionRiskReward=function(t){var e=new m({checkable:!1,text:$.t("Risk/Reward"),enabled:!0});return e.setCallbackContext(t),e.callbacks().subscribe(this,n.prototype.onRiskReward),e},n.prototype.createActionScaleLeft=function(t){var e=new m({checkable:!0,text:$.t("Scale Left"),enabled:!0});return e.setCallbackContext(t),e.setChecked(this._state.leftPriceScale().dataSources().indexOf(t)!==-1),e.callbacks().subscribe(this,n.prototype.onScaleLeft),e},n.prototype.createActionScaleRight=function(t){var e=new m({checkable:!0,text:$.t("Scale Right"),enabled:!0});return e.setCallbackContext(t),e.setChecked(this._state.rightPriceScale().dataSources().indexOf(t)!==-1),e.callbacks().subscribe(this,n.prototype.onScaleRight),e},n.prototype.createActionNoScale=function(t){var e=this._chart.model().paneForSource(t),i=e.actionNoScaleIsEnabled(t),o=new m({checkable:!0,text:$.t("Screen (No Scale)"),enabled:i});return o.setCallbackContext(t),o.setChecked(this._state.isOverlay(t)),o.callbacks().subscribe(this,n.prototype.onNoScale),o},n.prototype.createActionShowCountdown=function(t){var e=i(262).ActionBinder,o=new m({checkable:!0,text:$.t("Show Countdown"),enabled:!0}),n=this._chart.model().mainSeries().properties();return o._binding=new e(o,n.showCountdown,this._chart.model(),o.text),o._binding.setValue(n.showCountdown.value()),o},n.prototype.createActionLockScale=function(t){var e,o,n=i(262).ActionBinder;return t instanceof TradingView.Series?(e=new m({checkable:t.properties().lockScale.value(),text:$.t("Lock Scale"),enabled:!0}),o=function(e){this._undoModel.setLockScaleProperty(this._property,e.checked,t,this._undoText)},e._binding=new n(e,t.properties().lockScale,this._chart.model(),e.text,o),e):null},n.prototype.createActionMergeUp=function(t){var e,i=this._chart.model().paneForSource(t),o=i!==this._chart.model().panes()[0];return o?(e=new m({checkable:!1,text:$.t("Merge Up"),enabled:!0}),e.setCallbackContext(t),e.callbacks().subscribe(this,n.prototype.onMergeUp),e):null},n.prototype.onMergeUp=function(t){var e=t.callbackContext(),i=this._chart.model().paneForSource(e),o=this._chart.model().panes().indexOf(i),n=this._chart.model().panes()[o-1],s=n.findSuitableScale(e);this._chart.model().move(e,n,s)},n.prototype.createActionUnmergeUp=function(t){var e,i=this._chart.model().paneForSource(t),o=i.dataSources().filter(function(t){return TradingView.isInherited(t.constructor,f)&&t.showInObjectTree()}).length>1;return o?(e=new m({checkable:!1,text:$.t("Unmerge Up"),enabled:!0}),e.setCallbackContext(t),e.callbacks().subscribe(this,n.prototype.onUnmergeUp),e):null},n.prototype.onUnmergeUp=function(t){var e=t.callbackContext(),i=this._chart.model().paneForSource(e),o=this._chart.model().panes().indexOf(i),n=this._chart.model().createPane(o),s=n.findSuitableScale(e);this._chart.model().move(e,n,s)},n.prototype.createActionMergeDown=function(t){var e,i=this._chart.model().paneForSource(t),o=this._chart.model().panes(),s=i!==o[o.length-1];return s?(e=new m({checkable:!1,text:$.t("Merge Down"),enabled:!0}),e.setCallbackContext(t),e.callbacks().subscribe(this,n.prototype.onMergeDown),e):null},n.prototype.onMergeDown=function(t){var e=t.callbackContext(),i=this._chart.model().paneForSource(e),o=this._chart.model().panes().indexOf(i),n=this._chart.model().panes()[o+1],s=n.findSuitableScale(e);this._chart.model().move(e,n,s)},n.prototype.createActionUnmergeDown=function(t){var e,i=this._chart.model().paneForSource(t),o=i.dataSources().filter(function(t){return TradingView.isInherited(t.constructor,f)&&t.showInObjectTree()}).length>1;return o?(e=new m({checkable:!1,text:$.t("Unmerge Down"),enabled:!0}),e.setCallbackContext(t),e.callbacks().subscribe(this,n.prototype.onUnmergeDown),e):null},n.prototype.onUnmergeDown=function(t){var e=t.callbackContext(),i=this._chart.model().paneForSource(e),o=this._chart.model().panes().indexOf(i),n=this._chart.model().createPane(o+1),s=n.findSuitableScale(e);this._chart.model().move(e,n,s)},n.prototype._mergeContentMenuItems=function(t){var e=[],i=this.createActionMergeUp(t);return i&&e.push(i),i=this.createActionUnmergeUp(t),i&&e.push(i),i=this.createActionMergeDown(t),i&&e.push(i),i=this.createActionUnmergeDown(t),i&&e.push(i),e},n.prototype.createActionShow=function(t){var e=i(262).ActionBinder,o=new m({checkable:!0,text:$.t("Show"),enabled:!0});return o._binding=new e(o,t.properties().visible,this._chart.model(),o.text),o._binding.setValue(t.properties().visible.value()),o},n.prototype.bringObjectForward=function(t){var e=this._chart.model().selectedSource();e&&this._chart.model().changeZOrder(e,1)},n.prototype.sendObjectToBack=function(t){var e=this._chart.model().selectedSource();e&&this._chart.model().sendToBack(e)},n.prototype.bringObjectToFront=function(t){var e=this._chart.model().selectedSource();e&&this._chart.model().bringToFront(e)},n.prototype.sendObjectBackward=function(t){var e=this._chart.model().selectedSource();e&&this._chart.model().changeZOrder(e,-1)},n.prototype.createVisualOrderAction=function(t){var e,i,o,s,r,a,l=new m({text:$.t("Visual Order")});return l.subActions||(l.subActions=[]),e=new m({text:$.t("Bring to Front")}),e.callbacks().subscribe(this,n.prototype.bringObjectToFront),l.subActions.push(e),i=new m({text:$.t("Send to Back")}),i.callbacks().subscribe(this,n.prototype.sendObjectToBack),l.subActions.push(i),o=new m({text:$.t("Bring Forward")}),o.callbacks().subscribe(this,n.prototype.bringObjectForward),l.subActions.push(o),s=new m({text:$.t("Send Backward")}),s.callbacks().subscribe(this,n.prototype.sendObjectBackward),l.subActions.push(s),r=this._chart.model().paneForSource(t),a=r.getZOrderMinMax(),i.setEnabled(!0),o.setEnabled(!0),s.setEnabled(!0),e.setEnabled(!0),t.zorder()===a.minZOrder&&(i.setEnabled(!1),s.setEnabled(!1)),t.zorder()===a.maxZOrder&&(o.setEnabled(!1),e.setEnabled(!1)),l},n.prototype.image=function(){var t={};return t.leftAxis=this.leftPriceAxisWidget().image(),t.rightAxis=this.rightPriceAxisWidget().image(),t.content=this.canvas.toDataURL(),t.contentWidth=this.size.w,t.contentHeight=this.size.h,t},n.prototype._updateTooltip=function(t,e){if(!this._rafSet){var i=this;requestAnimationFrame(function(){i._updateTooltipImpl(t,e),i._rafSet=!1}),this._rafSet=!0}},n.prototype._updateTooltipImpl=function(t,e){function i(i){function n(){return TradingView.isMobile.any()?{left:t-o._tooltipSelector.outerWidth()-16,top:e-o._tooltipSelector.outerHeight()-16}:{left:t+16,top:e+16}}TradingView[s].getTooltipText&&(i=TradingView[s].getTooltipText(l)||i),o._tooltipSelector.html(i).removeClass("tooltip-selector-hidden").css(n())}var o,n,s,a,l,h;if(this._chart){for(o=this,n=this._chart.paneWidgets(),s=w.tool.value(),a=this._state.model(),l=a.lineBeingCreated(),h=n.length-1;h>=0;h--)n[h]._hideTooltip();r.isStudyLineTool(s)&&!TradingView.isMobile.any()?i($.t("Click to set a point")):TradingView.isMobile.any()&&"LineToolBrush"!==s&&o.isLineTool(s)&&!o._chart.model().lineBeingCreated()?i($.t("1. Slide your finger to select location for first anchor<br>2. Tap anywhere to place the first anchor")):TradingView.isMobile.any()&&"LineToolBrush"!==s&&o.isLineTool(s)&&i($.t("1. Slide your finger to select location for next anchor<br>2. Tap anywhere to place the next anchor"))}},n.prototype._hideTooltip=function(){this._tooltipSelector.addClass("tooltip-selector-hidden")},n.prototype._updateCrosshairOnZoom=function(){var t,e;w.lockTimeAxis().value()&&(t=this._chart.model(),e=t.crossHairSource(),e.setPosition(e.index,e.price,this._state))},t.exports=n}).call(e,i(1),i(21))},function(t,e,i){(function(t,o){"use strict";function n(t,e){var i="Change Chart Layout to "+Y[e].title;r.call(this,i),this._chartWidgetCollection=t,this._newLayoutId=e,this._oldLayoutId=t.layout.value()}function s(e,i,o,n,s,r,l,h){this._chartWidget=h,this.m_model=new X(e,i,o,n,s,r,l,this,!!h._containsData),this.m_undoStack=new a,this.m_redoStack=new a,this.m_zoomStack=new a,this._onRearrangePanes=new t,this._onSimpleZoomIn=new t,this._onSimpleZoomOut=new t}function r(t){this._text=t}function a(){this.m_commands=[],this._onChange=new t}function l(t){r.call(this,t),this._subcommands=[]}function h(t,e,i,o){r.call(this,i),this._targetObj=t,this._newValue=e,this._model=o}function c(t,e,i,o,n){r.call(this,o),this._property=t,this._priceScale=i,this._newValue=e,this._model=n}function d(t,e,i,o,n){r.call(this,o),this._percentage=t,this._priceScale=i,this._newValue=e,this._model=n}function p(t,e,i,o,n){r.call(this,o),this._log=t,this._priceScale=i,this._newValue=e,this._model=n}function u(t,e,i,o,n,s){r.call(this,o),this._style=t,this._mainSeries=i,this._priceAxisProperties=i.properties().priceAxisProperties,this._newValue=e,this._model=n,this._chartWidget=s}function _(t,e,i,o,n){r.call(this,o),this._property=t,this._mainSeries=i,this._priceAxisProperties=i.properties().priceAxisProperties,this._newValue=e,this._model=n}function f(t,e,i,o){this.m_model=t,this.m_pane=e,this.m_priceScale=i,this.m_state=o,this.m_newPriceScaleState=null}function g(t,e,i){r.call(this,i),this.m_model=t,this.m_state=e,this.m_newTimeScaleState=null}function m(t,e,i,o){this._model=t,this._series=e,this._oldSymbol=e.symbol(),this._oldInterval=e.interval(),this._symbol=i,this._interval=o}function v(t,e,i,o){r.call(this,"Insert "+e.id),this._model=t,this._studyMetaInfo=e,this._props=i,this._isOverlay=o}function y(t,e){this._model=t,this._sourceId=e.id()}function b(t,e){this._model=t,this._linetools=e,this._statesByPaneIndexes={}}function w(t,e,i,o){this._model=t,this._sourceId=e.id(),this._oldPane=this._model.paneForSource(e),this._oldPaneIndex=t.panes().indexOf(this._oldPane),this._oldScaleName=this._oldPane.priceScaleName(e.priceScale()),this._pane=i,this._paneIndex=t.panes().indexOf(i),this._pane?this._scaleName=this._pane.priceScaleName(o):this._paneIndex=t.panes().length}function S(t,e,i){r.call(this,"Create line "+i),this._model=t,this._paneIndex=t.panes().indexOf(e),this._lineTool=i}function T(t,e,i,o){this._model=t,this._prevState=e.state(!0),this._nextState=this._prevState}function C(t,e,i,n){this._model=t,this._sourceId=e.id(),i instanceof o.Point?this._origPoint=i.clone():this._origPoint=TradingView.clone(i),this._pointIndex=n}function x(t,e,i){r.call(this,"Change "+e.title()+" Z order"),this._model=t,this._sourceId=e.id(),this._shift=i}function P(t,e){r.call(this,"Change "+e.title()+" Z order"),this._model=t,this._sourceId=e.id()}function L(t,e){r.call(this,"Change "+e.title()+" Z order"),this._model=t,this._sourceId=e.id()}function k(t,e,i){r.call(this,"Remove pane"),this._model=t,this._index=e,this._pane=this._model.panes()[e],this._chart=i}function E(t,e,i,o){r.call(this,"Rearrange panes"),this._model=t,this._index=e,this._direction=i,this._chart=o}function I(t,e,i,o,n,s){this._model=t,this._startBar=e,this._endBar=i,this._startPrice=o,this._endPrice=n,this._pane=s}function A(t,e,i){this._baseCmd=t,this._zoomStack=e,this._inOut=i}function V(t,e,i,o,n){this._model=t,this._paneA=e,this._paneB=i,this._prevStretchA=o,this._currStretchA=n}function M(t,e){r.call(this,"Restore Defaults"),this._model=t,this._defaultProperty=e,this._state=e.state(e._exclusions),this._chartWidget=t._undoModel._chartWidget}function D(t,e){r.call(this,"Apply Chart Theme"),this._model=t,this._newChartProps=TradingView.factoryDefaults("chartproperties"),["candleStyle","hollowCandleStyle","haStyle"].forEach(function(t){e.mainSourceProperties[t].wickUpColor=e.mainSourceProperties[t].wickUpColor||e.mainSourceProperties[t].wickColor,e.mainSourceProperties[t].wickDownColor=e.mainSourceProperties[t].wickDownColor||e.mainSourceProperties[t].wickColor}),e.chartProperties.paneProperties.vertGridProperties=e.chartProperties.paneProperties.vertGridProperties||e.chartProperties.paneProperties.gridProperties,e.chartProperties.paneProperties.horzGridProperties=e.chartProperties.paneProperties.horzGridProperties||e.chartProperties.paneProperties.gridProperties,e.chartProperties.paneProperties.legendProperties=this._model.properties().state().paneProperties.legendProperties,this._newChartProps=$.extend(!0,{},this._newChartProps,e.chartProperties),delete this._newChartProps.scalesProperties.showLeftScale,delete this._newChartProps.scalesProperties.showRightScale,
delete this._newChartProps.scalesProperties.scaleSeriesOnly,delete this._newChartProps.scalesProperties.showSeriesLastValue,delete this._newChartProps.scalesProperties.showStudyLastValue,delete this._newChartProps.scalesProperties.showSymbolLabels,delete this._newChartProps.scalesProperties.showStudyPlotLabels,this._newSeriesProps=e.mainSourceProperties,this._newChartProps.symbolWatermarkProperties||(this._newChartProps.symbolWatermarkProperties=defaults("chartproperties.symbolWatermarkProperties"),this._newChartProps.symbolWatermarkProperties.color=this._newChartProps.scalesProperties.textColor),this._oldChartProps=t.properties().state(),delete this._oldChartProps.paneProperties.topMargin,delete this._oldChartProps.paneProperties.bottomMargin,this._oldSeriesProps=t.properties().state().mainSeriesProperties}function O(t,e){r.call(this,"Apply Drawing Template"),this._source=t,this._oldProps=t.properties().state(),this._newProps=e}function B(t,e,i,o){var n;o=" "+o||"",n=o+" Study template",r.call(this,n),this._model=t,this._oldProps=e,this._newProps=i}function R(t,e,i,o,n){this._model=t,this._pane=e,this._priceScale=i,this._topMargin=o,this._bottomMargin=n,this._oldTopMargin=i.topMargin(),this._oldBottomMargin=i.bottomMargin()}function N(t,e){this._model=t,this._range=e}function F(t,e,i,o,n){r.call(this,t),this._property=e,this._value=i,this._forceSetProperty=n,this._prevValue=e.value(),this._cw=o}function z(t,e){var i,o,n,s,r,a=e.priceScale(),l=[];for(a.isPercent()&&(i=e.firstValue()),o=0;o<t.length;o++)n={offset:t[o].offset,time_t:t[o].time_t},s=t[o].price,a.isPercent()&&(s=a.priceRange().convertToPercent(s,i)),r=a.priceToCoordinate(s),r-=40,s=a.coordinateToPrice(r),a.isPercent()&&(s=a.priceRange().convertFromPercent(s,i)),n.price=s,l.push(n);return l}function W(t,e,i){r.call(this,"clone "+e.title()),this._model=t,this._originalSource=e,this._withoutShift=i}function H(t,e,i){r.call(this,i),this._wv=t,this._newValue=e,this._oldValue=t.value()}function U(t,e){this._model=t,this._sourceId=e.id(),this._linkKey=e.linkKey}function q(t,e,i){r.call(this,"Paste"),this._model=t,this._clipboardData=e,this._paneIndex=this._model.panes().indexOf(i||this._model.paneForSource(this._model.mainSeries()))}function j(t,e){r.call(this,"Paste"),this._model=t,this._clipboardData=e}var Y=i(245),G=i(124),K=i(74).LineDataSource,X=i(117),Z=i(81),J=i(113),Q=i(55).animate,tt=i(249),et=i(80),it=et.saveDefaultProperties,ot=i(250),nt=i(84),st=i(150),rt=st.Study,at=function(){function t(t){h&&e(),h=new l(t)}function e(){if(h){var t=h;h=null,t.isEmpty()||n(t)}}function i(){if(c.isEmpty())return!1;var t=c.pop();return t.undo(),d.push(t),!0}function o(){if(d.isEmpty())return!1;var t=d.pop();return t.redo(),c.push(t),!0}function n(t){return h?void h.addCommand(t):(d.clear(),void c.push(t))}function s(){var t=c.isEmpty()?null:c.head();return{lastActualCommand:t}}function r(t){for(;!c.isEmpty()&&t.lastActualCommand!==c.head();)c.pop().undo();d.clear()}var h=null,c=new a,d=new a;return{beginUndoMacro:t,endUndoMacro:e,undo:i,redo:o,pushUndoCommand:n,createUndoCheckpoint:s,undoToCheckpoint:r,undoStack:function(){return c},redoStack:function(){return d},clearStack:function(){c.clear(),d.clear()}}}();at.setChartLayout=function(t,e){if(t.layout.value()===e)return!1;var i=new n(t,e);i.redo(),this.pushUndoCommand(i)},inherit(n,r),n.prototype.redo=function(){this._chartWidgetCollection.layout.setValue(this._newLayoutId)},n.prototype.undo=function(){this._chartWidgetCollection.layout.setValue(this._oldLayoutId)},inherit(s,tt),s.prototype.FREE_STUDY_LIMIT=10,s.prototype.version=function(){return this.m_model._version},s.prototype.onData=function(t){switch(t.method){case"timescale_update":var e=t.params;this.m_model.updateTimeScale(e.index,e.zoffset,e.changes,e.marks,e.clear)}},s.prototype.paneForSource=function(t){return this.m_model.paneForSource(t)},s.prototype.createPane=function(t){return this.m_model.createPane(t)},s.prototype.dumpViews=function(){return this.m_model.dumpViews()},s.prototype.readOnly=function(){return this.m_model.readOnly()},s.prototype.restart=function(){this.m_model.restart()},s.prototype.disconnect=function(){this.m_model.disconnect()},s.prototype.studiesMetaData=function(){return this.m_model.studiesMetaData()},s.prototype.studyVersioning=function(){return this.m_model.studyVersioning()},s.prototype.chartModel=function(){return this.m_model},s.prototype.undoStack=at.undoStack,s.prototype.redoStack=at.redoStack,s.prototype.undo=at.undo,s.prototype.redo=at.redo,s.prototype.pushUndoCommand=at.pushUndoCommand,s.prototype.startScalePrice=function(t,e,i){this.pushUndoCommand(new f(this.m_model,t,e,e.state())),this.chartModel().startScalePrice(t,e,i)},s.prototype.scalePriceTo=function(t,e,i){this.chartModel().scalePriceTo(t,e,i)},s.prototype.endScalePrice=function(t,e){this.chartModel().endScalePrice(t,e)},s.prototype.startScrollPrice=function(t,e,i){e.isAutoScale()||(this._initialPriceScrollState=e.state(),this._initialPriceScrollPos=i,this.chartModel().startScrollPrice(t,e,i))},s.prototype.scrollPriceTo=function(t,e,i){e.isAutoScale()||(this._initialPriceScrollPos&&Math.abs(this._initialPriceScrollPos-i)>20&&(this.pushUndoCommand(new f(this.m_model,t,e,this._initialPriceScrollState)),delete this._initialPriceScrollState,delete this._initialPriceScrollPos),this.chartModel().scrollPriceTo(t,e,i))},s.prototype.endScrollPrice=function(t,e){e.isAutoScale()||(delete this._initialPriceScrollState,delete this._initialPriceScrollPos,this.chartModel().endScrollPrice(t,e))},s.prototype.setPriceAutoScale=function(t,e,i){this.pushUndoCommand(new f(this.m_model,t,e,e.state())),this.chartModel().setPriceAutoScale(t,e,i)},s.prototype.resetPriceScale=function(t,e){this.pushUndoCommand(new f(this.m_model,t,e,e.state())),this.chartModel().resetPriceScale(t,e)},s.prototype.startScaleTime=function(t){this.pushUndoCommand(new g(this.m_model,this.m_model.timeScale().state(),"scale time")),this.chartModel().startScaleTime(t)},s.prototype.scaleTimeTo=function(t){this.chartModel().scaleTimeTo(t)},s.prototype.endScaleTime=function(){this.chartModel().endScaleTime()},s.prototype.startScrollTime=function(t){this._initialTimeScrollState=this.m_model.timeScale().state(),this._initialTimeScrollPos=t,this.chartModel().startScrollTime(t)},s.prototype.scrollTimeTo=function(t){this._initialTimeScrollPos&&Math.abs(t-this._initialTimeScrollPos)>20&&(this.pushUndoCommand(new g(this.m_model,this._initialTimeScrollState,"scroll time")),delete this._initialTimeScrollPos,delete this._initialTimeScrollState),this.chartModel().scrollTimeTo(t)},s.prototype.gotoTime=function(t,e){var i,o,n=this.timeScale().visibleBars();return n?(i=n.firstBar(),o=this.m_model.timeScale().state(),this.chartModel().gotoTime(t,e),void(i!==this.timeScale().visibleBars().firstBar()&&this.pushUndoCommand(new g(this.m_model,o,"scroll time")))):$.Deferred().reject().promise()},s.prototype.endScrollTime=function(){this.chartModel().endScrollTime(),delete this._initialTimeScrollPos,delete this._initialTimeScrollState},s.prototype.resetTimeScale=function(){this.pushUndoCommand(new g(this.m_model,this.m_model.timeScale().state())),this.chartModel().resetTimeScale()},s.prototype.canZoomIn=function(){return this.chartModel().canZoomIn()},s.prototype.canZoomOut=function(){return this.chartModel().canZoomOut()},s.prototype.setWidth=function(t){this.m_model.setWidth(t)},s.prototype.setPaneHeight=function(t,e){this.m_model.setPaneHeight(t,e)},s.prototype.gridSource=function(){return this.m_model.gridSource()},s.prototype.watermarkSource=function(){return this.m_model.watermarkSource()},s.prototype.addAlertsSource=function(t){return this.m_model.addAlertsSource(t)},s.prototype.alertsSources=function(){return this.m_model.alertsSources()},s.prototype.barsMarksSources=function(){return this.m_model.barsMarksSources()},s.prototype.crossHairSource=function(){return this.m_model.crossHairSource()},s.prototype.model=function(){return this.m_model},s.prototype.mainSeries=function(){return this.m_model.m_mainSeries},s.prototype.panes=function(){return this.m_model.m_panes},s.prototype.timeScale=function(){return this.m_model.timeScale()},s.prototype.setSelectedSource=function(t,e){this.m_model.setSelectedSource(t,e)},s.prototype.setHoveredSource=function(t,e){this.m_model.setHoveredSource(t,e)},s.prototype.selectedSource=function(){return this.m_model.selectedSource()},s.prototype.onSelectedSourceChanged=function(){return this.m_model.onSelectedSourceChanged()},s.prototype.hoveredSource=function(){return this.m_model.hoveredSource()},s.prototype.activeStrategySource=function(){return this.m_model.activeStrategySource()},s.prototype.invalidate=function(t){this.m_model.invalidate(t)},s.prototype.setCurrentPosition=function(t,e,i,o){this.m_model.setCurrentPosition(t,e,i,o)},s.prototype.modifySeries=function(t,e,i){var o=new m(this.m_model,t,e,i);this.pushUndoCommand(o),o.redo()},s.prototype.insertStudy=function(t,e,i){if(!this.model()._chartApi._chartApi.isCanCreateStudy())return void TVDialogs.showTooManyStudiesNotice();if(TradingView.isFeatureEnabled("indicators_limit")&&!user.is_pro&&this.m_model.countUserStudies()>=this.FREE_STUDY_LIMIT)return TradingView.trackGoProFeature("studyLimit"),void TVDialogs.showGoProDialog({feature:"studyLimit"});if(TradingView.isFeatureEnabled("backtesting")||!t.isTVScriptStrategy){var o=new v(this.m_model,t,e,i);return this.pushUndoCommand(o),o.redo()}},s.prototype.setProperty=function(t,e,i){if(t&&t.value()!==e){var o=new h(t,e,i,this.m_model);this.pushUndoCommand(o),o.redo(),this.emitEvent("setProperty")}},s.prototype.setPercentProperty=function(t,e,i,o){if(t.value()!==e){var n=new d(t,e,i,o,this.m_model);this.pushUndoCommand(n),n.redo()}},s.prototype.setLogProperty=function(t,e,i,o){if(t.value()!==e){var n=new p(t,e,i,o,this.m_model);this.pushUndoCommand(n),n.redo()}},s.prototype.setAutoScaleProperty=function(t,e,i,o){if(t.value()!==e){var n=new c(t,e,i,o,this.m_model);this.pushUndoCommand(n),n.redo()}},s.prototype.setChartStyleProperty=function(t,e,i){if(t.value()!==e){var o=new u(t,e,this.mainSeries(),i,this.m_model,this._chartWidget);this.pushUndoCommand(o),o.redo(),this.emitEvent("setChartStyleProperty")}},s.prototype.setLockScaleProperty=function(t,e,i,o){if(t.value()!==e){var n=new _(t,e,i,o,this.m_model);this.pushUndoCommand(n),n.redo()}},s.prototype.setScreenChartProperty=function(t,e,i,o,n){if(n||t.value()!==e){var s=new F(o,t,e,i,n);this.pushUndoCommand(s),s.redo()}},s.prototype.beginUndoMacro=at.beginUndoMacro,s.prototype.endUndoMacro=at.endUndoMacro,s.prototype.createUndoCheckpoint=at.createUndoCheckpoint,s.prototype.undoToCheckpoint=at.undoToCheckpoint,s.prototype.removeSource=function(t,e){var i,o=e||!1;t.isUserDeletable()&&(i=new y(this.m_model,t),this.pushUndoCommand(i),i.redo(),o||this.emitEvent("removeSource",[t]))},s.prototype.removeSelectedSource=function(){var t,e=this.m_model.selectedSource();e&&e.isUserDeletable()&&(this.setSelectedSource(null),t=new y(this.m_model,e),this.pushUndoCommand(t),t.redo(),this.emitEvent("removeSource",[e]))},s.prototype.removeLineTools=function(t){var e=new b(this.m_model,t);this.pushUndoCommand(e),e.redo()},s.prototype.move=function(t,e,i){var o=new w(this.m_model,t,e,i);this.pushUndoCommand(o),o.redo(),this.emitEvent("moveSource",[t])},s.prototype.createLineTool=function(t,e,i,o,n){var s,r;return"LineToolRegressionTrend"!==i||this.model()._chartApi._chartApi.isCanCreateStudy()?(this._createLineCommand=new S(this.m_model,t,i),s=this._createLineCommand.startCreatingLine(e,o,n),r=this._createLineCommand.line(),s&&(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),r):void TVDialogs.showTooManyStudiesNotice()},s.prototype.lineBeingCreated=function(){return this.m_model.lineBeingCreated()},s.prototype.paneBeingCreatedLineOn=function(){return this.m_model.paneBeingCreatedLineOn()},s.prototype.coninueCreatingLine=function(t,e,i){var o=this._createLineCommand.continueCreatingLine(t,e,i);return o&&(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),o},s.prototype.finishLineTool=function(t){this.m_model.finishLineTool(t)},s.prototype.cancelCreatingLine=function(){this.m_model.cancelCreatingLine()},s.prototype.lineCancelled=function(){return this.m_model.lineCancelled()},s.prototype.startChangingLinetool=function(t,e,i,o){this._currentLineChangeCommand=new T(this.m_model,t,i,o),this.m_model.startChangingLinetool(t,e,i,o)},s.prototype.lineBeingEdited=function(){return this.m_model.lineBeingEdited()},s.prototype.changeLinePoint=function(t,e){this._currentLineChangeCommand.setPoint(t,e),this.m_model.changeLinePoint(t,e)},s.prototype.endChangingLinetool=function(t){this.m_model.endChangingLinetool(t),this._currentLineChangeCommand.endChanging(),this.pushUndoCommand(this._currentLineChangeCommand),this._currentLineChangeCommand=null},s.prototype.startMovingSource=function(t,e,i){this._currentLineMoveCommand=new C(this.m_model,t,e,i),this.m_model.startMovingSource(t,e,i)},s.prototype.sourceBeingMoved=function(){return this.m_model.sourceBeingMoved()},s.prototype.moveSource=function(t){this._currentLineMoveCommand.setPoint(t),this.m_model.moveSource(t)},s.prototype.endMovingSource=function(t){this.m_model.endMovingSource(t),this._currentLineMoveCommand._point&&(this.pushUndoCommand(this._currentLineMoveCommand),this._currentLineChangeCommand=null)},s.prototype.dataSources=function(){return this.m_model.dataSources()},s.prototype.state=function(t,e){return this.m_model.state(t,e)},s.prototype.asyncState=function(t){return this.m_model.asyncState(t)},s.prototype.restoreState=function(t,e){return this.m_model.restoreState(t,e)},s.prototype.calculateDefaultTags=function(){return this.m_model.calculateDefaultTags()},s.prototype.onTagsChanged=function(){return this.m_model.onTagsChanged()},s.prototype.changeZOrder=function(t,e){var i=new x(this.m_model,t,e);this.pushUndoCommand(i),i.redo(),this.emitEvent("changeZOrder",[t,e])},s.prototype.sendToBack=function(t){var e=new P(this.m_model,t);this.pushUndoCommand(e),e.redo(),this.emitEvent("changeZOrder",[t])},s.prototype.bringToFront=function(t){var e=new L(this.m_model,t);this.pushUndoCommand(e),e.redo(),this.emitEvent("changeZOrder",[t])},s.prototype.removeAllStudies=function(){var t,e,i;for(this.beginUndoMacro("remove all studies"),t=this.m_model.dataSources(),e=0;e<t.length;e++)i=t[e],TradingView.isInherited(i.constructor,rt)&&i.removeByRemoveAllStudies()&&this.removeSource(i);this.endUndoMacro()},s.prototype.removeAllDrawingTools=function(t){var e,i,o;for(this.beginUndoMacro("remove all drawing tools"),e=this.m_model.dataSources(),i=0;i<e.length;i++)o=e[i],TradingView.isInherited(o.constructor,K)&&o.isActualSymbol()&&o.isUserDeletable()&&(t&&t!==o._constructor||this.removeSource(o));this.endUndoMacro()},s.prototype.unlinkLine=function(t){var e=new U(this.m_model,t);this.pushUndoCommand(e),e.redo()},s.prototype.copyToOtherCharts=function(t){this.m_model.copyToOtherCharts(t)},s.prototype.moveDown=function(){var t,e,i,o,n;try{this.beginUndoMacro("Move Down")}catch(t){return}t=this,e=this.m_model.mainSeries(),i=this.m_model.paneForSource(e),o=i.priceScaleForSource(e),o.setAutoScale(!1),n=o.height(),Q(n/5,function(e){t.startScrollPrice(i,o,0),t.scrollPriceTo(i,o,e),t.endScrollPrice(i,o)},function(){t.endUndoMacro()})},s.prototype.moveUp=function(){var t,e,i,o,n;try{this.beginUndoMacro("Move Up")}catch(t){return}t=this,e=this.m_model.mainSeries(),i=this.m_model.paneForSource(e),o=i.priceScaleForSource(e),o.setAutoScale(!1),n=o.height(),Q(n/5,function(e){t.startScrollPrice(i,o,e),t.scrollPriceTo(i,o,0),t.endScrollPrice(i,o)},function(){t.endUndoMacro()})},s.prototype.moveLeft=function(){var t,e;try{this.beginUndoMacro("Move Left")}catch(t){return}t=this.m_model.timeScale().width(),e=this,Q(t/5,function(t){e.startScrollTime(t),e.scrollTimeTo(0),e.endScrollTime()},function(){e.endUndoMacro()})},s.prototype.moveRight=function(){var t,e;try{this.beginUndoMacro("Move Right")}catch(t){return}t=this.m_model.timeScale().width(),e=this,Q(t/5,function(t){e.startScrollTime(0),e.scrollTimeTo(t),e.endScrollTime()},function(){e.endUndoMacro()})},s.prototype.scrollChart=function(t){this.startScrollTime(0),this.scrollTimeTo(t),this.endScrollTime()},s.prototype.scrollChartByBar=function(t){var e=t*this.m_model.timeScale().barSpacing();this.startScrollTime(0),this.scrollTimeTo(e),this.endScrollTime()},s.prototype.zoomIn=function(t,e){var i,o,n=this.m_model.timeScale().width(),s=this;if(e=e||1,this.canZoomIn())if(t)i=e*n/10,o=i*((t+1)/2),this.startScaleTime(i),this.scaleTimeTo(0),this.endScaleTime(),this.startScrollTime(0),this.scrollTimeTo(i-o),this.endScrollTime(),this._onSimpleZoomIn.fire();else{try{this.beginUndoMacro("Zoom In")}catch(t){return}Q(n/5,function(t){s.startScaleTime(t),s.scaleTimeTo(0),s.endScaleTime()},function(){s.endUndoMacro(),s._onSimpleZoomIn.fire()})}},s.prototype.zoomOut=function(t,e){var i=this.m_model.timeScale().width(),o=this;if(e=e||1,this.canZoomOut())if(t)this.startScaleTime(0),this.scaleTimeTo(e*i/10),this.endScaleTime(),this.startScrollTime(e*(i/20-i/20*t)),this.scrollTimeTo(0),this.endScrollTime(),this._onSimpleZoomOut.fire();else{try{this.beginUndoMacro("Zoom Out")}catch(t){return}Q(i/5,function(t){o.startScaleTime(0),o.scaleTimeTo(t),o.endScaleTime()},function(){o.endUndoMacro(),o._onSimpleZoomOut.fire()})}},s.prototype.resetScales=function(){var t,e;for(this.beginUndoMacro("Reset scales"),this.resetTimeScale(),t=0;t<this.panes().length;t++)e=this.panes()[t],this.resetPriceScale(e,e.leftPriceScale()),this.resetPriceScale(e,e.rightPriceScale());this.endUndoMacro(),this.m_model.recalculateAllPanes()},s.prototype.zoomToViewport=function(t,e,i,o,n){var s=new I(this.m_model,t,e,i,o,n),r=new A(s,this.m_zoomStack,!0);r.redo(),this.pushUndoCommand(r)},s.prototype.zoomFromViewport=function(){var t=new A(this.m_zoomStack.head(),this.m_zoomStack,!1);t.redo(),this.pushUndoCommand(t)},s.prototype.zoomStack=function(){return this.m_zoomStack},s.prototype.addPaneStretchFactorUndoCommand=function(t,e,i,o){var n=new V(this.m_model,t,e,i,o);this.pushUndoCommand(n)},s.prototype.restoreFactoryDefaults=function(t){var e=new M(this.m_model,t);e.redo(),this.pushUndoCommand(e)},s.prototype.chartLoadTheme=function(t,e){var i=new D(t,e);i.redo(),this.pushUndoCommand(i)},s.prototype.drawingLoadTemplate=function(t,e){var i=new O(t,e);i.redo(),this.pushUndoCommand(i)},s.prototype.studyLoadTemplate=function(t,e,i,o){var n=new B(t,e,i,o);n.redo(),this.pushUndoCommand(n)},s.prototype.onRearrangePanes=function(){return this._onRearrangePanes},s.prototype.onSimpleZoomIn=function(){return this._onSimpleZoomIn},s.prototype.onSimpleZoomOut=function(){return this._onSimpleZoomOut},s.prototype.loadRange=function(t){t.res!==this.m_model.mainSeries().properties().interval.value()?(this.m_model.mainSeries().setDefaultTimeframe(t.val),this.setProperty(this.m_model.mainSeries().properties().interval,t.res,"Change date range")):this.m_model.mainSeries().loadDataTo(t.val)},s.prototype.cloneLineTool=function(t,e){var i=new W(this.m_model,t,e);return i.redo(),this.pushUndoCommand(i),this.emitEvent("cloneLineTool"),i.clonedLineToolId()},s.prototype._preparePriceAxisProperties=function(t,e){var i=t.lockScale.value(),o=t.style.value()===nt.STYLE_PNF;(o||i)&&(e.log.setValue(!1),e.percentage.setValue(!1)),e.logDisabled.setValue(!(!o&&!i)),e.percentageDisabled.setValue(!(!o&&!i))},s.prototype.alertsList=function(){return this.m_model.alertsList()},s.prototype.alertsListChanged=function(){return this.m_model.alertsListChanged()},s.prototype.insertStudyStub=function(t){return this.m_model.insertStudyStub(t)},s.prototype.removeStudyStub=function(t){return this.m_model.removeStudyStub(t)},s.prototype.isJustClonedChart=function(){return this._chartWidget.isJustClonedChart()},s.prototype.copySourceToClip=function(t){if(t&&!t.properties().blockCopying){var e={};if(t instanceof K)e.type="drawing",e.geometry=t.geometry();else{if(!(t instanceof rt))return!1;e.type="study"}return e.source=t.state&&t.state(),delete e.source.alertId,delete e.source.linkKey,!!e.source&&(e.title=t.title&&t.title(),e.modelId=this.m_model._id,ot.set(e),!0)}},s.prototype.cutSourceToClip=function(t){var e=this.copySourceToClip(t);return!!e&&void this.removeSource(t)},s.prototype.pasteLineTool=function(t,e){var i=new q(this.m_model,e,t);this.pushUndoCommand(i),i.redo()},s.prototype.pasteStudy=function(t){var e=new j(this.m_model,t);this.pushUndoCommand(e),e.redo()},s.prototype.pasteSourceFromClip=function(t,e){var i=ot.get();return!!i&&("drawing"===i.type&&this.pasteLineTool(t,i),void("study"===i.type&&this.pasteStudy(i)))},s.prototype.trackTime=function(){return this._chartWidget.trackTime()},r.prototype.text=function(){return this._text},r.prototype.undo=function(){throw Error("pure virtual call ;)")},r.prototype.redo=function(){throw Error("pure virtual call ;)")},a.prototype.onChange=function(){return this._onChange},a.prototype.isEmpty=function(){return 0===this.m_commands.length},a.prototype.clear=function(){this.m_commands.length=0,this._onChange.fire()},a.prototype.push=function(t){if(!(t instanceof r))throw new TypeError("argument must be an instance of UndoCommand");this.m_commands.push(t),this._onChange.fire()},a.prototype.pop=function(){if(this.isEmpty())return void TradingView.logDebugChart("UndoStack.pop: undo stack is empty");var t=this.m_commands.pop();return this._onChange.fire(),t},a.prototype.head=function(){return this.isEmpty()?void TradingView.logDebugChart("UndoStack.head: undo stack is empty"):this.m_commands[this.m_commands.length-1]},inherit(l,r),l.prototype.addCommand=function(t){this._subcommands.push(t)},l.prototype.isEmpty=function(){return 0===this._subcommands.length},l.prototype.redo=function(){for(var t=0;t<this._subcommands.length;t++)this._subcommands[t].redo()},l.prototype.undo=function(){for(var t=this._subcommands.length-1;t>=0;t--)this._subcommands[t].undo()},inherit(h,r),h.prototype.redo=function(){this._oldValue=this._targetObj.value(),it(!0),this._targetObj.setValue(this._newValue),it(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},h.prototype.undo=function(){it(!0),this._targetObj.setValue(this._oldValue),it(!1),this._oldValue=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},inherit(c,r),c.prototype.redo=function(){this._oldValue=this._property.value(),this._oldLockScaleValue=this._priceScale.mainSource()instanceof nt?this._priceScale.mainSource().properties().lockScale.value():void 0,it(!0),this._property.setValue(this._newValue),this._oldLockScaleValue&&this._newValue&&this._priceScale.mainSource().properties().lockScale.setValue(!1),it(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},c.prototype.undo=function(){it(!0),this._property.setValue(this._oldValue),this._oldLockScaleValue&&this._newValue&&this._priceScale.mainSource().properties().lockScale.setValue(this._oldLockScaleValue),it(!1),this._oldValue=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},inherit(d,r),d.prototype.redo=function(){this._oldValue=this._percentage.value(),this._oldAutoScaleValue=this._priceScale.properties().autoScale.value(),this._oldLogValue=this._priceScale.properties().log.value(),this._oldLogDisabled=this._priceScale.properties().logDisabled.value(),it(!0),this._percentage.setValue(this._newValue),this._priceScale.properties().autoScaleDisabled.setValue(this._newValue),this._priceScale.properties().log.setValue(!1),it(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},d.prototype.undo=function(){if(it(!0),this._percentage.setValue(this._oldValue),this._priceScale.properties().autoScale.setValue(this._oldAutoScaleValue),this._priceScale.properties().autoScaleDisabled.setValue(this._oldValue),this._priceScale.properties().log.setValue(this._oldLogValue),!(this._oldAutoScaleValue||this._priceScale.mainSource()instanceof nt&&this._priceScale.mainSource().isLockScale())){var t=this._model.timeScale().visibleBars();this._priceScale.setPriceRange(this._priceScale.priceRange().convertFromPercents(this._priceScale.mainSource().close(t.firstBar())))}it(!1),this._oldValue=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},inherit(p,r),p.prototype.redo=function(){this._oldValue=this._log.value(),this._oldPercValue=this._priceScale.properties().percentage.value(),this._oldPercDisabled=this._priceScale.properties().percentageDisabled.value(),it(!0),this._log.setValue(this._newValue),this._priceScale.properties().percentage.setValue(!1),this._priceScale.properties().autoScaleDisabled.setValue(this._priceScale.properties().percentage.value()),it(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},p.prototype.undo=function(){it(!0),this._log.setValue(this._oldValue),this._priceScale.properties().percentage.setValue(this._oldPercValue),it(!1),this._oldValue=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},inherit(u,r),u.prototype.redo=function(){var t=$.Deferred().resolve();this._mainSeries._properties.style===this._style&&this._model.mainSeries().isNeedRestart(this._newValue)&&(t=this._chartWidget.screen.show()),t.done(function(){this._oldValue=this._style.value(),this._oldAutoScale=this._priceAxisProperties.autoScale.value(),this._oldLogValue=this._priceAxisProperties.log.value(),this._oldLogDisabled=this._priceAxisProperties.logDisabled.value(),this._oldPercentageValue=this._priceAxisProperties.percentage.value(),this._oldPercentageDisabled=this._priceAxisProperties.percentageDisabled.value(),it(!0),this._style.setValue(this._newValue),this._chartWidget.model()._preparePriceAxisProperties(this._mainSeries.properties(),this._priceAxisProperties),it(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))}.bind(this))},u.prototype.undo=function(){var t=$.Deferred().resolve();this._mainSeries._properties.style===this._style&&this._model.mainSeries().isNeedRestart(this._newValue)&&(t=this._chartWidget.screen.show()),t.done(function(){it(!0),this._style.setValue(this._oldValue),this._priceAxisProperties.log.setValue(this._oldLogValue),this._priceAxisProperties.logDisabled.setValue(this._oldLogDisabled),this._priceAxisProperties.percentage.setValue(this._oldPercentageValue),this._priceAxisProperties.percentageDisabled.setValue(this._oldPercentageDisabled),this._priceAxisProperties.autoScale.setValue(this._oldAutoScale),it(!1),this._oldValue=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))}.bind(this))},inherit(_,r),_.prototype.redo=function(){this._oldValue=this._property.value(),this._oldAutoScale=this._priceAxisProperties.autoScale.value(),this._oldPercentage=this._priceAxisProperties.percentage.value(),this._oldLog=this._priceAxisProperties.log.value(),it(!0),this._newValue&&(this._priceAxisProperties.percentage.setValue(!1),this._priceAxisProperties.log.setValue(!1),this._priceAxisProperties.autoScale.setValue(!1));var t=this._mainSeries.properties().style.value();t!==nt.STYLE_RENKO&&t!==nt.STYLE_KAGI&&t!==nt.STYLE_PNF&&t!==nt.STYLE_PB&&this._mainSeries.fixBoxSize(),this._property.setValue(this._newValue),it(!1),this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},_.prototype.undo=function(){it(!0),this._priceAxisProperties.percentage.setValue(this._oldPercentage),this._priceAxisProperties.log.setValue(this._oldLog),this._priceAxisProperties.autoScale.setValue(this._oldAutoScale),this._property.setValue(this._oldValue),it(!1),this._oldValue=null,this._model&&(this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE)))},inherit(f,r),f.prototype.undo=function(){return null!==this.m_newPriceScaleState?void TradingView.logDebugChart("PriceScaleChangeUndoCommand.undo: Command is already undone"):(this.m_newPriceScaleState=this.m_priceScale.state(),this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_state),void this.m_priceScale.recalcLockedScale(null))},f.prototype.redo=function(){return null===this.m_newPriceScaleState?void TradingView.logDebugChart("PriceScaleChangeUndoCommand.redo: Command is not undone"):(this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_newPriceScaleState),void(this.m_newPriceScaleState=null))},inherit(g,r),g.prototype.undo=function(){return null!==this.m_newTimeScaleState?void TradingView.logDebugChart("TimeScaleChangeUndoCommand.undo: Command is already undone"):(this.m_newTimeScaleState=this.m_model.timeScale().state(),this.m_model.restoreTimeScaleState(this.m_state),void this.m_model.timeScale().recalcLockedScale())},g.prototype.redo=function(){return null===this.m_newTimeScaleState?void TradingView.logDebugChart("TimeScaleChangeUndoCommand.redo: Command is not undone"):(this.m_model.restoreTimeScaleState(this.m_newTimeScaleState),void(this.m_newTimeScaleState=null))},inherit(m,r),m.prototype.redo=function(){this._model.modifySeries(this._series,this._symbol,this._interval)},m.prototype.undo=function(){this._model.modifySeries(this._series,this._oldSymbol,this._oldInterval)},inherit(v,r),v.prototype.redo=function(){var t=null;return this._studyState?(t=this._model.restoreSource(this._restorePane,this._paneIndex,this._paneState,this._studyState,this._priceScaleName),this._studyId!==t.id()&&TradingView.logError("Study was restored improperly - study ids does not match"),delete this._studyState):(t=this._model.insertStudy(this._studyMetaInfo,this._props,this._isOverlay),this._studyId=t.id()),t},v.prototype.undo=function(){var t,e=this._model.dataSourceForId(this._studyId);this._studyState=e.state(),t=this._model.paneForSource(e),this._paneIndex=this._model.panes().indexOf(t),this._priceScaleName=t.priceScaleName(e.priceScale()),this._paneState=t.state(),this._restorePane=this._model.removeSource(e)},inherit(y,r),y.prototype.redo=function(){var t,e,i,o,n=this._model.dataSourceForId(this._sourceId),s=this._model.children(n);for(this._removeChildUndoCommands=[],t=0;t<s.length;t++)e=s[t],i=new y(this._model,e),this._removeChildUndoCommands.push(i),i.redo();this._sourceState=n.state(),o=this._model.paneForSource(n),this._paneIndex=this._model.panes().indexOf(o),this._priceScaleName=o.priceScaleName(n.priceScale()),this._paneState=o.state(),this._restorePane=this._model.removeSource(n)},y.prototype.undo=function(){var t,e,i=this._model.restoreSource(this._restorePane,this._paneIndex,this._paneState,this._sourceState,this._priceScaleName);for(this._sourceId!==i.id()&&TradingView.logError("Source was restored improperly - source ids does not match"),t=this._removeChildUndoCommands.length-1;t>=0;t--)e=this._removeChildUndoCommands[t],e.undo();this._removeChildUndoCommands.length=0},inherit(b,r),b.prototype.redo=function(){var t,e,i;for(t=0;t<this._linetools.length;t++)e=this._model.paneForSource(this._linetools[t]),i=this._model.panes().indexOf(e),this._statesByPaneIndexes[i]=this._statesByPaneIndexes[i]||[],this._statesByPaneIndexes[i].push({state:this._linetools[t].state(),owner:this._linetools[t].ownerSource().id()}),e.removeDataSource(this._linetools[t]);delete this._linetools},b.prototype.undo=function(){var t,e,i,o,n,s,r;this._linetools=[];for(t in this._statesByPaneIndexes)for(e=this._model.panes()[t],i=this._statesByPaneIndexes[t],o=0;o<i.length;o++)n=i[o],s=this._model.dataSourceForId(n.owner),r=e._restoreLineTool(n.state),r.setOwnerSource(s),r.updateAllViews(),this._linetools.push(r);this._model.invalidate(new J(J.LIGHT_UPDATE))},inherit(w,r),w.prototype.redo=function(){this._model.panes().indexOf(this._pane)===-1&&(this._pane=this._model.createPane(this._paneIndex)),this._model.move(this._model.dataSourceForId(this._sourceId),this._pane,this._pane.priceScaleByName(this._scaleName)||this._pane.rightPriceScale());
},w.prototype.undo=function(){this._model.panes().indexOf(this._oldPane)===-1&&(this._oldPane=this._model.createPane(this._oldPaneIndex)),this._model.move(this._model.dataSourceForId(this._sourceId),this._oldPane,this._oldPane.priceScaleByName(this._oldScaleName))},inherit(S,r),S.prototype.startCreatingLine=function(t,e,i){var o,n;return this._points=[{point:t}],o=this._model.panes()[this._paneIndex],n=this._model.createLineTool(o,t,this._lineTool,e,i),this._lineId=n.id(),!this._model.lineBeingCreated()},S.prototype.continueCreatingLine=function(t,e,i){return this._points||TradingView.logError("continueCreatingLine is called before startCreatingLine"),this._points.push({point:t,envState:e}),this._model.coninueCreatingLine(t,e,i)},S.prototype.line=function(){return this._lineId?this._model.dataSourceForId(this._lineId):null},S.prototype.undo=function(){var t=this.line();t&&(this._lineState=t.state(),this._model.removeSource(t),delete this._lineId)},S.prototype.redo=function(){this._lineState||TradingView.logError("This command was never undone - nothing to redo");var t=this._model.restoreSource(!1,this._paneIndex,null,this._lineState,null);this._lineId=t.id(),delete this._lineState},inherit(T,r),T.prototype.setPoint=function(t){var e=this._model.dataSourceForId(this._nextState.id);this._nextState=e.state(!0)};T.prototype.endChanging=function(){var t=this._model.dataSourceForId(this._nextState.id);this._nextState=t.state(!0)};T.prototype.undo=function(){var t=this._model.dataSourceForId(this._prevState.id),e=this._prevState;this._model.restoreLineToolState(t,e)},T.prototype.redo=function(){var t=this._model.dataSourceForId(this._nextState.id),e=this._nextState;this._model.restoreLineToolState(t,e)},inherit(C,r),C.prototype.setPoint=function(t){t instanceof o.Point?this._point=t.clone():this._point=TradingView.clone(t)},C.prototype.undo=function(){var t=this._model.dataSourceForId(this._sourceId);this._model.startMovingSource(t,this._point,this._pointIndex),this._model.moveSource(this._origPoint),this._model.endMovingSource()},C.prototype.redo=function(){var t=this._model.dataSourceForId(this._sourceId);this._model.startMovingSource(t,this._origPoint,this._pointIndex),this._model.moveSource(this._point),this._model.endMovingSource()},inherit(x,r),x.prototype.undo=function(){var t=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(t,-this._shift)},x.prototype.redo=function(){var t=this._model.dataSourceForId(this._sourceId);this._model.changeZOrder(t,this._shift)},inherit(P,r),P.prototype.undo=function(){var t=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(t)},P.prototype.redo=function(){var t=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(t)},inherit(L,r),L.prototype.undo=function(){var t=this._model.dataSourceForId(this._sourceId);this._model.sendToBack(t)},L.prototype.redo=function(){var t=this._model.dataSourceForId(this._sourceId);this._model.bringToFront(t)},s.prototype.removePane=function(t,e){var i=new k(this,e,t);this.pushUndoCommand(i),i.redo()},inherit(k,r),k.prototype.redo=function(){this._model.panes().splice(this._index,1),this._chart._updateGui()},k.prototype.undo=function(){this._model.panes().splice(this._index,0,this._pane),this._chart._updateGui()},s.prototype.rearrangePanes=function(t,e,i){var o=new E(this,e,i,t);this.pushUndoCommand(o),o.redo(),this._onRearrangePanes.fire()},inherit(E,r),E.prototype.redo=function(){var t=this._model.panes()[this._index];"up"===this._direction&&this._index>0&&(this._model.panes().splice(this._index,1),this._model.panes().splice(this._index-1,0,t)),"down"===this._direction&&this._index<this._model.panes().length-1&&(this._model.panes().splice(this._index,1),this._model.panes().splice(this._index+1,0,t)),this._model.invalidate(new J(J.FULL_UPDATE))},E.prototype.undo=function(){var t;"up"===this._direction&&(t=this._model.panes()[this._index-1],this._model.panes().splice(this._index-1,1),this._model.panes().splice(this._index,0,t)),"down"===this._direction&&(t=this._model.panes()[this._index+1],this._model.panes().splice(this._index+1,1),this._model.panes().splice(this._index,0,t)),this._model.invalidate(new J(J.FULL_UPDATE))},inherit(I,r),I.prototype.redo=function(){this._timeScaleState=this._model.timeScale().state(),this._priceScaleState=this._pane.defaultPriceScale().state(),this._model.zoomToViewport(this._startBar,this._endBar,this._startPrice,this._endPrice,this._pane)},I.prototype.undo=function(){this._model.timeScale().restoreState(this._timeScaleState),this._pane.defaultPriceScale().restoreState(this._priceScaleState),this._model.recalculateAllPanes(),this._model.invalidate(new J(J.LIGHT_UPDATE))},inherit(A,r),A.prototype.undo=function(){if(this._inOut){if(this._baseCmd!==this._zoomStack.head())return void TradingView.logDebugChart("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}else this._baseCmd.redo(),this._zoomStack.push(this._baseCmd)},A.prototype.redo=function(){if(this._inOut)this._baseCmd.redo(),this._zoomStack.push(this._baseCmd);else{if(this._baseCmd!==this._zoomStack.head())return void TradingView.logDebugChart("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}},inherit(V,r),V.prototype.redo=function(){var t=this._paneA._stretchFactor+this._paneB._stretchFactor;this._paneA._stretchFactor=this._currStretchA,this._paneB._stretchFactor=t-this._currStretchA,this._model.invalidate(new J(J.FULL_UPDATE))},V.prototype.undo=function(){var t=this._paneA._stretchFactor+this._paneB._stretchFactor;this._paneA._stretchFactor=this._prevStretchA,this._paneB._stretchFactor=t-this._prevStretchA,this._model.invalidate(new J(J.FULL_UPDATE))},inherit(M,r),M.prototype.redo=function(){this._model.restoreFactoryDefaults(this._defaultProperty),this._chartWidget.adaptOnChartLogo()},M.prototype.undo=function(){this._defaultProperty.merge(this._state),this._defaultProperty.listeners().fire(this._defaultProperty),this._model.mainSeries().onChartStyleChanged(),this._chartWidget.adaptOnChartLogo()},inherit(D,r),D.prototype._merge=function(t,e){var i=this._model;it(!0),t&&(i.properties().paneProperties.merge(t.paneProperties),i.properties().scalesProperties.merge(t.scalesProperties),i.properties().symbolWatermarkProperties.merge(t.symbolWatermarkProperties)),i.mainSeries().properties().merge(e),i.mainSeries().properties().saveDefaults(),i.mainSeries().createPaneView(),i.mainSeries().invalidateBarStylesCache(),i._version=e.version,i.recalculateAllPanes(),i.invalidate(new J(J.FULL_UPDATE)),i.properties().saveDefaults(),i.properties().listeners().fire(this._properties),i.properties().scalesProperties.textColor.listeners().fire(i.properties().scalesProperties.textColor),it(!1)},D.prototype.undo=function(){this._merge(this._oldChartProps,this._oldSeriesProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales()},D.prototype.redo=function(){this._merge(this._newChartProps,this._newSeriesProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales()},inherit(O,r),O.prototype._merge=function(t){var e=this._source;e.properties().merge(t),e.properties().saveDefaults(),e.propertiesChanged(),e.calcIsActualSymbol(),e.updateAllViews(),e._model.invalidate(new J(J.LIGHT_UPDATE))},O.prototype.undo=function(){this._merge(this._oldProps)},O.prototype.redo=function(){this._merge(this._newProps)},inherit(B,r),B.prototype._merge=function(t){var e,i,o,n,s,r,a,l,h,c,d,p,u,_=this._model.model(),f=_.mainSeries();for(f.properties().lockScale.setValue(!1),t.interval&&f.properties().interval.setValue(t.interval),e=[],i=_.panes(),o=i.length;o--;)for(n=i[o],s=n.containsMainSeries(),r=n.dataSources(),a=r.length;a--;)l=r[a],(!s||l instanceof rt)&&(l.isRemovedByStudyTemplates()||e.push(l),_.removeSource(l));for(h=t.panes,c=function(t,e){return t.dataSources().some(function(t){return t.alert&&t.alert().id===e.alert.id})},o=0;o<h.length;o++){for(d=!1,p=h[o],a=0;a<p.sources.length;a++)l=p.sources[a],"MainSeries"===l.type&&(delete l.state,d=!0);if(n=null,n=d?i[o]:_.createPane(o),n.restoreState(h[o],!1,t.version),d)for(u=0;u<e.length;u++)e[u].restore&&e[u].restore()}f.priceScale().setAutoScale(!0),_._version=t.version,_.startNotStartedStudies(),_.recalculateAllPanes(),_.invalidate(new J(J.FULL_UPDATE))},B.prototype.undo=function(){this._merge(this._oldProps),this._model.model().mainSeries().onChartStyleChanged()},B.prototype.redo=function(){var t,e,i;this._merge(this._newProps),t=this._model.model(),t.mainSeries().onChartStyleChanged(),e=this._model.model().mainSeries().properties(),i=this._model.model().mainSeries().properties().priceAxisProperties,this._model._preparePriceAxisProperties(e,i),t._recalcVisibleRangeStudy(t.dataSources(),!0)},inherit(R,r),R.prototype.redo=function(){this._priceScale.setTopMargin(this._topMargin),this._priceScale.setBottomMargin(this._bottomMargin),this._model.recalculatePane(this._pane,!1)},R.prototype.undo=function(){this._priceScale.setTopMargin(this._oldTopMargin),this._priceScale.setBottomMargin(this._oldBottomMargin),this._model.recalculatePane(this._pane,!1)},inherit(N,r),N.prototype.redo=function(){this._model.mainSeries().loadDataTo(this._range)},inherit(F,r),F.prototype.redo=function(){this._cw.screen.show().done(function(){this._property.setValue(this._value,this._forceSetProperty)}.bind(this))},F.prototype.undo=function(){this._cw.screen.show().done(function(){this._property.setValue(this._prevValue,this._forceSetProperty)}.bind(this))},inherit(W,r),W.prototype.redo=function(){var t,e,i,n,s,r,a,l,h,c,d;if(this._lineState)r=this._model.restoreSource(!1,this._paneIndex,null,this._lineState,null);else{for(t=this._originalSource,e=t.priceScale(),i=this._model.paneForSource(t),n=TradingView.className(t.constructor),s=t.properties().clone(),r=G.create(n,this._model,s,null,t.ownerSource()),r.setOwnerSource(t.ownerSource()),r.properties().visible._value=!0,r._fixedPoints=r._fixedPoints.concat(t._fixedPoints),a=0;a<r._fixedPoints.length;a++)r._fixedPoints[a]=r._fixedPoints[a].add(new o.Point(20,20));l=t._timePoint,h=this._withoutShift?TradingView.clone(l):z(l,t.ownerSource()),c=t._points,d=c,r.restorePoints(h,d),r.cloneData&&r.cloneData(t),i.addDataSource(r,e),this._model.updateSource(r),r.checkAlert&&r.checkAlert(),this._paneIndex=this._model.panes().indexOf(i),Z.drawOnAllCharts().value()&&this._model.copyToOtherCharts(r),this._lineState=r.state()}},W.prototype.undo=function(){this._lineState||TradingView.logError("This command was never executed - nothing to undo");var t=this._model.dataSourceForId(this._lineState.id);this._model.removeSource(t)},W.prototype.clonedLineToolId=function(){return this._lineState.id},at.setWatchedValue=function(t,e,i){if(t.value()!==e){var o=new H(t,e,i);this.pushUndoCommand(o),o.redo()}},inherit(H,r),H.prototype.redo=function(){this._wv.setValue(this._newValue)},H.prototype.undo=function(){this._wv.setValue(this._oldValue)},inherit(U,r),U.prototype.redo=function(){var t=this._model.dataSourceForId(this._sourceId);delete t.linkKey},U.prototype.undo=function(){var t=this._model.dataSourceForId(this._sourceId);t.linkKey=this._linkKey},inherit(q,r),q.prototype.redo=function(){var t,e,i,n,s,r,a,l,h,c=this._model.panes()[this._paneIndex],d=c.dataSourceForId(this._clipboardData.source.ownerSource)||c.mainDataSource();this._sourceState||(t=!0,e=this._clipboardData.source.state.symbol,i=c.mainDataSource(),n=i.symbol?i.symbol():"",s=e===n,s&&(d instanceof nt&&(t=!1),d instanceof rt&&(t=!d.metaInfo().is_price_study)),r=TradingView.clone(this._clipboardData.source),delete r.state.symbol,t?(a=this._model,l=function(t){var e=t.x*a.timeScale().width(),i=t.y*d.priceScale().height();return new o.Point(e,i)},r.points=this._clipboardData.geometry.map(function(t){var e,i=l(t),o=a.timeScale().coordinateToIndex(i.x),n=a.timeScale().normalizeBarIndex(o);return n.price=d.priceScale().coordinateToPrice(i.y),d.priceScale().isPercent()&&(e=d.firstValue(),n.price=d.priceScale().priceRange().convertFromPercent(n.price,e)),n})):this._model._id===this._clipboardData.modelId&&d.id()===this._clipboardData.source.ownerSource&&(r.points=z(this._clipboardData.source.points,d)),r.id=TradingView.guid(),this._sourceState=r),h=c._restoreLineTool(this._sourceState,null,!1),h.calcIsActualSymbol(),h.setOwnerSource(d),h.setPriceScale(d.priceScale()),d.priceScale().addDataSource(h),h.createServerPoints(),this._model.invalidate(new J(J.LIGHT_UPDATE,!0))},q.prototype.undo=function(){var t,e;this._sourceState||TradingView.logError("This command was never executed - nothing to undo"),t=this._model.panes()[this._paneIndex],e=t.dataSourceForId(this._sourceState.id),this._model.removeSource(e)},inherit(j,r),j.prototype.redo=function(){var t,e,i,o;this._sourceState||(t=TradingView.clone(this._clipboardData.source),t.id=TradingView.guid(),this._sourceState=t),e=null,i=null,this._sourceState.metaInfo.is_price_study?(e=this._model.paneForSource(this._model.mainSeries()),i=this._model.mainSeries().priceScale()):(e=this._model.createPane(),i=e.defaultPriceScale()),o=e._restoreStudy(this._sourceState),o.start(),o.setPriceScale(i),e.move(o,i)},j.prototype.undo=function(){this._sourceState||TradingView.logError("This command was never executed - nothing to undo");var t=this._model.dataSourceForId(this._sourceState.id);this._model.removeSource(t)},e.UndoHistory=at,e.ChartUndoModel=s,e.UndoMacroCommand=l}).call(e,i(28),i(21))},function(t,e,i){var o;(function(){"use strict";function e(){}function n(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function s(t){return function(){return this[t].apply(this,arguments)}}var r=e.prototype,a=this,l=a.EventEmitter;r.getListeners=function(t){var e,i,o=this._getEvents();if(t instanceof RegExp){e={};for(i in o)o.hasOwnProperty(i)&&t.test(i)&&(e[i]=o[i])}else e=o[t]||(o[t]=[]);return e},r.flattenListeners=function(t){var e,i=[];for(e=0;e<t.length;e+=1)i.push(t[e].listener);return i},r.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&(e={},e[t]=i),e||i},r.addListener=function(t,e){var i,o=this.getListenersAsObject(t),s="object"==typeof e;for(i in o)o.hasOwnProperty(i)&&n(o[i],e)===-1&&o[i].push(s?e:{listener:e,once:!1});return this},r.on=s("addListener"),r.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},r.once=s("addOnceListener"),r.defineEvent=function(t){return this.getListeners(t),this},r.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},r.removeListener=function(t,e){var i,o,s=this.getListenersAsObject(t);for(o in s)s.hasOwnProperty(o)&&(i=n(s[o],e),i!==-1&&s[o].splice(i,1));return this},r.off=s("removeListener"),r.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},r.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},r.manipulateListeners=function(t,e,i){var o,n,s=t?this.removeListener:this.addListener,r=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(o=i.length;o--;)s.call(this,e,i[o]);else for(o in e)e.hasOwnProperty(o)&&(n=e[o])&&("function"==typeof n?s.call(this,o,n):r.call(this,o,n));return this},r.removeEvent=function(t){var e,i=typeof t,o=this._getEvents();if("string"===i)delete o[t];else if(t instanceof RegExp)for(e in o)o.hasOwnProperty(e)&&t.test(e)&&delete o[e];else delete this._events;return this},r.removeAllListeners=s("removeEvent"),r.emitEvent=function(t,e){var i,o,n,s,r,a=this.getListenersAsObject(t);for(s in a)if(a.hasOwnProperty(s))for(i=a[s].slice(0),n=i.length;n--;)o=i[n],o.once===!0&&this.removeListener(t,o.listener),r=o.listener.apply(this,e||[]),r===this._getOnceReturnValue()&&this.removeListener(t,o.listener);return this},r.trigger=s("emitEvent"),r.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},r.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return a.EventEmitter=l,e},o=function(){return e}.call(a,i,a,t),!(void 0!==o&&(t.exports=o))}).call(this)},function(t,e){"use strict";var i=function(){function t(t){switch(t){case"c67":case"m67":case"c45":return"copy";case"c86":case"m86":case"s45":return"paste";case"c88":case"m88":case"s46":return"cut"}}function e(t){var e=[];return t.shiftKey&&e.push("s"),t.ctrlKey&&e.push("c"),t.metaKey&&e.push("m"),t.altKey&&e.push("a"),e.push(t.keyCode),e.join("")}function i(t){var e=$.Event(d+":"+t);return $(window).trigger(e,{AppClipboard:_}),e}function o(o){var n,s,r;if((document.activeElement===document.body||document.activeElement===document.documentElement)&&(n=e(o),s=t(n))){if("keydown"===o.type)p[n]=!0;else if(p[n])return;if(document.getSelection){if(!document.getSelection().isCollapsed)return}else if(document.selection&&"None"!==document.selection.type)return;o.isDefaultPrevented()||(r=i(s),r.isDefaultPrevented()&&o.preventDefault())}}function n(t){t=t.originalEvent||t,t.key===c&&i("change")}function s(){u||($(document).on("keypress keydown",o),$(window).on("storage",n),u=!0)}function r(){$(document).off("keypress keydown",o),$(window).off("storage",n),$(window).off(d+":copy"),$(window).off(d+":paste"),$(window).off(d+":cut"),$(window).off(d+":change"),u=!1}function a(){try{return JSON.parse(TVLocalStorage.getItem(c))}catch(t){return null}}function l(t){if(null==t)return h();var e=JSON.stringify(t);e!==TVLocalStorage.getItem(c)&&(TVLocalStorage.setItem(c,e),i("change"))}function h(){TVLocalStorage.getItem(c)&&(TVLocalStorage.removeItem(c),i("change"))}var c="application-clipboard",d="appclip",p={},u=!1,_={init:s,set:l,get:a,clear:h,destroy:r};return _}();t.exports=i},function(t,e,i){(function(e){"use strict";function o(t,e,i){this._model=e,this._paneWidget=t,this._chart=t._chart,this._mainDiv=i,this.$el=$(document.createElement("div")).addClass("pane-legend"),this._itemsBinding=[],this._chart.properties().paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,this.updateLayout),this._chart.properties().paneProperties.legendProperties.showSeriesTitle.listeners().subscribe(this,this.updateLayout),this._chart.properties().paneProperties.legendProperties.showSeriesOHLC.listeners().subscribe(this,this.updateLayout),this._chart.properties().paneProperties.legendProperties.showStudyValues.listeners().subscribe(this,this.updateLayout);var o=this._chart.properties().scalesProperties.textColor;o.listeners().subscribe(this,function(t){this.$el.css("color",t)}),this.$el.css("color",o.value()),this.updateLayout()}var n=i(150).Study,s=i(55).setMouseEventHandler;o.prototype.contextMenuEvent=function(t,i){if(!this._model.chartModel().readOnly()&&e.enabled("legend_context_menu")){var o=i.source;this._paneWidget.showContextMenuForSource(o,t)}},o.prototype.updateLayout=function(){var t,e,o,n,r,a,l,h,c,d,p;if(this._itemsBinding.length=0,this.$el.find(".apply-common-tooltip").trigger("mouseleave"),this.$el.empty(),t=this._paneWidget.state(),t&&this._model){for(e={showStudyTitles:this._model.model().properties().paneProperties.legendProperties.showStudyTitles.value(),showSeriesTitle:this._chart.properties().paneProperties.legendProperties.showSeriesTitle.value(),showSeriesOHLC:this._chart.properties().paneProperties.legendProperties.showSeriesOHLC.value(),showStudyValues:this._chart.properties().paneProperties.legendProperties.showStudyValues.value(),showLegend:this._model.model().properties().paneProperties.legendProperties.showLegend.value()},o=this._model.mainSeries(),n=t.orderedSources().slice(),r=n.indexOf(o),r>-1&&(n.splice(r,1),n.push(o)),a=n.length-1;a>=0;a--)l=n[a],h=l.statusView(),h&&(c=l===o,(!c||e.showSeriesTitle||e.showSeriesOHLC||e.showStudyTitles||e.showStudyValues)&&(e.showLegend||!c?(c||e.showStudyTitles||e.showStudyValues)&&e.showLegend&&(d=$("<div>").addClass("pane-legend-line pane-legend-wrap").appendTo(this.$el),d.source=l,c?(p=$('<a class="pane-legend-minbtn apply-common-tooltip apply" title="'+$.t("Hide")+'"></a>').append($(i(253)).attr({class:"expand"})),d.addClass("main").append(p.on("click touchend",this.toggleTitles.bind(this)))):d.addClass("study"),l.properties().visible.value()||d.addClass("disabled"),this._generateItemsForRow(d,h,e),s(d,this,!0)):this.$el.find(".expand-line").length||(d=$("<div>").addClass("pane-legend-line pane-legend-wrap main expand-line").appendTo(this.$el),p=$('<a class="pane-legend-minbtn apply-common-tooltip apply" title="'+$.t("Show")+'"></a>').append($(i(252)).attr({class:"expand closed"})),d.append(p.on("click touchend",this.toggleTitles.bind(this))),d.source=l,e={showStudyTitles:!1,showSeriesTitle:!1,showSeriesOHLC:e.showSeriesOHLC,showStudyValues:!1},this._generateItemsForRow(d,h,e),s(d,this,!0),this.update())));this.update()}},o.prototype._generateItemsForRow=function(t,o,s){var r,a,l,h,c,d,p,u,_,f,g,m,v,y,b=t.source,w=this,S=b===this._model.mainSeries();if((S&&s.showSeriesTitle||!S&&s.showStudyTitles)&&(r=$("<span>"),r.addClass("pane-legend-line apply-overflow-tooltip"),e.enabled("legend_context_menu")||r.addClass("no-context-menu"),S&&r.addClass("main"),b.properties().visible.value()||r.addClass("disabled"),r.css({"font-weight":o.bold()?"bold":"normal","font-size":o.size()}),r.click(function(e){w.contextMenuEvent(e,t)}),r.appendTo(t),this._itemsBinding.push({value:o,cell:r,source:t.source}),!this._chart.readOnly()&&b.userEditEnabled()&&e.enabled("edit_buttons_in_legend")&&(a=$('<span class="pane-legend-icon-container">').appendTo(t),e.enabled("show_hide_button_in_legend")&&$('<a class="pane-legend-icon apply-common-tooltip icon-hide" title="'+$.t("Show/Hide")+'">').append($(i(254)).attr({width:14,height:14})).appendTo(a).on("click touchend",this._generateItemsForRow._onShowhideClick.bind(this,b)),S&&!e.enabled("show_chart_property_page")||!e.enabled("format_button_in_legend")||$('<a class="pane-legend-icon apply-common-tooltip format" title="'+$.t("Format")+'">').append($(i(255)).attr({width:14,height:14})).appendTo(a).on("click touchend",this._generateItemsForRow._onFormatClick.bind(this,b)),b instanceof n&&e.enabled("study_buttons_in_legend")&&(l=b.metaInfo().isTVScript&&void 0!==b.metaInfo().TVScriptSourceCode,l&&!TradingView.isMobileView&&(h=$('<a class="pane-legend-icon apply-common-tooltip source" title="'+$.t("Show Source Code")+'">').append($(i(256)).attr({width:14,height:14})).appendTo(a).on("click touchend",this._generateItemsForRow._onViewSorceClick.bind(this,b)),TradingView.ScriptEditorWidget&&(c=TradingView.ScriptEditorWidget.loadedScriptIdPart(),c&&b.metaInfo().scriptIdPart===c&&h.addClass("active")))),!S&&e.enabled("delete_button_in_legend")&&$('<a class="pane-legend-icon apply-common-tooltip delete" title="'+$.t("Delete")+'">').append($(i(257)).attr({width:14,height:14})).appendTo(a).on("click touchend",this._generateItemsForRow._onDeleteClick.bind(this,b)))),d=b.dataWindowView(),d=b.dataWindowView(),this.isDataWindowValuesVisible(d)&&(S&&s.showSeriesOHLC||!S&&s.showStudyValues)){for(p=[],u=[],_=$('<div class="pane-legend-item-value-container">'),f=0;f<d.items().length;f++)g=$("<span class='pane-legend-item-value-wrap'>").appendTo(_),m=S?$("<span class='pane-legend-item-value-title pane-legend-line'>").appendTo(g):null,v=$("<span class='pane-legend-item-value pane-legend-line'>").appendTo(g),S&&v.addClass("main"),b.properties().visible.value()||(v.addClass("disabled"),m&&m.addClass("disabled")),p.push(v),m&&u.push(m);y=$("<span class='pane-legend-item-additional pane-legend-line'>").appendTo(_.appendTo(t)),this._itemsBinding.push({value:d,cell:p,titleCells:u.length?u:null,source:b,additional:y})}},o.prototype.isDataWindowValuesVisible=function(t){return this._chart.onWidget()?!!t&&!this._chart.isSmall():!!t},o.prototype._generateItemsForRow._onShowhideClick=function(t){this._model.setProperty(t.properties().visible,!t.properties().visible.value(),"Show/Hide "+t.title())},o.prototype._generateItemsForRow._onFormatClick=function(t,e){if(t.userEditEnabled()){TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Style"));var o=i(258);new o(t,this._model).show()}},o.prototype._generateItemsForRow._onDeleteClick=function(t){t.isUserDeletable()&&this._model.removeSource(t)},o.prototype._generateItemsForRow._onViewSorceClick=function(t){var e=t.metaInfo(),i={scriptSource:t.metaInfo().TVScriptSourceCode,scriptIdPart:e.scriptIdPart};TradingView.ScriptEditorWidget&&TradingView.ScriptEditorWidget.open(i)},o.prototype.setItemEnabled=function(t,e){var i=!t.hasClass("disabled"),o=t.closest(".pane-legend-wrap");e&&!i?(t.removeClass("disabled"),o.removeClass("disabled")):!e&&i&&(t.addClass("disabled"),o.addClass("disabled"))},o.prototype.valueChanged=function(t,e,i){return t[e]!==i&&(t[e]=i,!0)},o.prototype.firstTitle=function(){return this.$el.find(".pane-legend-line.pane-legend-wrap:first-child")},o.prototype.updateTitle=function(){var t,e,i,o,n,s,r,a;for(i=this._itemsBinding.length;i--;)e=this._itemsBinding[i],Array.isArray(e.cell)||(e.last||(e.last={}),o=e.last,n=e.source,t=n.properties().visible.value(),this.valueChanged(o,"sourceVisible",t)&&this.setItemEnabled(e.cell,t),s=e.value.color(),r=n!==this._model.mainSeries()&&n===this._model.selectedSource()?"bold":"normal",a=e.value.text(),(this.valueChanged(o,"color",s)||this.valueChanged(o,"fontWeight",r)||this.valueChanged(o,"text",a))&&e.cell.text(TradingView.clean(a,!0)).css({color:s,"border-color":s,"font-weight":r}));this._chart.resizeIndicator()},o.prototype.update=function(t){var e,i,o,n,s,r,a,l,h,c;for(this.updateTitle(),l=this._itemsBinding.length;l--;)if(n=this._itemsBinding[l],e=n.cell,i=n.titleCells,o=n.source.properties().visible.value(),Array.isArray(e)){for(n.last||(n.last={},n.last.dwView||(n.last.dwView={})),h=n.last,s=n.value.items(),c=this.valueChanged(h,"sourceVisible",o),r=0;r<e.length;r++)a=s[r],h[r]||(h[r]={}),c&&this.setItemEnabled(e[r],o),this.valueChanged(h[r],"text",a.text())&&(e[r][0].textContent=a.text()),a.color()&&this.valueChanged(h[r],"color",a.color())&&e[r].css("color",a.color()),i&&(this.valueChanged(h,"sourceVisible",o)&&this.setItemEnabled(i[r],o),this.valueChanged(h[r],"title",a.title())&&(i[r][0].textContent=a.title()));n.additional&&n.value.additional&&this.valueChanged(h,"additional",n.value.additional())&&n.additional.text(n.value.additional()||"")}this._chart.resizeIndicator()},o.prototype.dataSourceAtPoint=function(t,e){return null},o.prototype.renderTo=function(t,e,i){var o,n,s,r,a,l,h;for(t.save(),t.fillStyle=this._chart.properties().scalesProperties.textColor.value(),t.textBaseline="middle",o=0,n=0;n<this._itemsBinding.length;++n)s=this._itemsBinding[n],r=s.value,a=s.source===this._model.mainSeries(),l=a?12:8,h=a?25:17,Array.isArray(s.cell)||(t.font=r.size()+" Verdana, Arial",t.fillText(r.text(),e,i+o+l),o+=h);t.restore()},o.prototype.toggleTitles=function(t){this._model.model().properties().paneProperties.legendProperties.showLegend.setValue(!this._chart.properties().paneProperties.legendProperties.showLegend.value());for(var e=this._chart._paneWidgets.length-1;e>=0;e--)this._chart._paneWidgets[e].legendWidget.updateLayout()},t.exports=o}).call(e,i(1))},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><g><path d="M1 0v1h11V0H1zm11 1v11h1V1h-1zm0 11H1v1h11v-1zM1 12V1H0v11h1zM6 2v4H2v1h4v4h1V7h4V6H7V2H6z"/></g></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13" width="13" height="13"><g><path d="M1 0v1h11V0H1zm11 1v11h1V1h-1zm0 11H1v1h11v-1zM1 12V1H0v11h1zm1-6v1h9V6H2z"/></g></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" width="14" height="14"><path d="M0 0v14h14V0zm7 2.69c3.018 0 5.172 3.232 5.172 4.31 0 1.077-2.154 4.31-5.172 4.31S1.828 8.08 1.828 7c0-1.077 2.154-4.31 5.172-4.31zm0 1.508C5.49 4.198 4.198 5.49 4.198 7S5.49 9.802 7 9.802 9.802 8.51 9.802 7 8.51 4.198 7 4.198zm0 1.68c.646 0 1.12.476 1.12 1.122 0 .646-.473 1.12-1.12 1.12-.646 0-1.12-.473-1.12-1.12 0-.646.473-1.12 1.12-1.12z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2.4 120.9 14 14" width="14" height="14" enable-background="new -2.4 120.9 600 600"><path d="M-2.4 120.9v14h14v-14zm6.086 1.803H5.52v1.332c.416.1.805.258 1.166.48l.944-.935 1.297 1.297-.943.943c.215.35.38.748.48 1.164H9.8v1.837H8.463c-.1.417-.257.806-.48 1.167l.935.944-1.296 1.298-.944-.943c-.35.215-.747.38-1.164.48v1.332H3.677v-1.33c-.415-.102-.804-.258-1.165-.482l-.943.936-1.298-1.296.94-.945c-.216-.35-.38-.748-.482-1.165H-.597v-1.835H.737c.1-.416.257-.805.48-1.166l-.935-.944 1.296-1.297.944.943c.35-.215.747-.38 1.164-.48zm.912 3.053c-1.188 0-2.143.963-2.143 2.143 0 1.187.963 2.143 2.143 2.143 1.18 0 2.14-.963 2.145-2.145 0-1.188-.966-2.144-2.145-2.144z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2.4 120.9 14 14" width="14" height="14" enable-background="new -2.4 120.9 600 600"><path d="M-2.4 120.9v14h14v-14zm4.833 2.042h1.084v1.083H2.433c-.143 0-.18.027-.24.09-.063.062-.135.19-.187.365-.103.353-.114-.147-.114.17 0 .84.01 1.425-.157 2-.127.44-.4.836-.76 1.25.36.413.633.81.76 1.248.167.575.157 1.16.157 2.002 0 .317.01-.185.114.168.052.176.124.305.186.368s.098.09.24.09h1.085v1.082H2.433c-.398 0-.768-.166-1.01-.41-.244-.245-.372-.54-.456-.826-.167-.57-.16-.155-.16-.472 0-.84-.01-1.34-.113-1.7-.09-.31-.328-.612-.7-1.008h-.81v-1.084h.81c.372-.397.61-.7.7-1.01.104-.358.114-.857.114-1.698 0-.317-.008.1.16-.472.083-.286.21-.583.454-.828.242-.244.613-.408 1.01-.408zm3.25 0h1.084c.398 0 .768.164 1.01.408.244.245.374.542.458.828.168.57.157.155.157.472 0 .84.01 1.34.114 1.7.09.31.328.61.7 1.008h.81v1.084h-.81c-.372.397-.61.7-.7 1.01-.104.358-.114.857-.114 1.698 0 .317.01-.1-.157.472-.084.286-.214.58-.457.826-.243.244-.613.41-1.01.41H5.682v-1.083h1.084c.143 0 .18-.026.24-.09.063-.062.138-.19.19-.367.103-.353.11.15.11-.168 0-.84-.01-1.427.158-2.002.127-.44.4-.835.76-1.248-.36-.414-.633-.81-.76-1.25-.167-.575-.157-1.16-.157-2 0-.317-.008.183-.112-.17-.05-.176-.126-.303-.188-.366s-.098-.09-.24-.09H5.682v-1.082z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2.4 120.9 14 14" width="14" height="14" enable-background="new -2.4 120.9 600 600"><path d="M-2.4 120.9v14h14v-14zm3.34 2.123l3.66 3.66 3.66-3.66 1.217 1.22-3.66 3.658 3.66 3.66-1.22 1.22-3.658-3.66-3.66 3.66-1.22-1.22 3.66-3.66-3.66-3.66z"/></svg>'},function(t,e,i){(function(e){"use strict";function o(t,e,i){this._source=t,this._model=e,this._undoCheckpoint=i}var n=i(74).LineDataSource,s=i(150).Study,r=i(79).DataSource,a=i(38),l=i(55).bindPopupMenu;$.extend(o,{TAB_PRIORITY_COORDINATES:100,TAB_PRIORITY_DISPLAY:100,TAB_PRIORITY_STYLE:200,TAB_PRIORITY_INPUTS:300,TAB_PRIORITY_PROPERTIES:250,TAB_NAME_COORDINATES:"Coordinates",TAB_NAME_DISPLAY:"Properties",TAB_NAME_STYLE:"Style",TAB_NAME_INPUTS:"Inputs",TAB_NAME_PROPERTIES:"Properties",TAB_NAME_GRAPHICS:"Graphics",TAB_NAME_VISIBILITY:"Visibility",TAB_OPEN_DEFAULT:100,TAB_OPEN_USERSAVE:200,TAB_OPEN_OVERRIDE:300}),o.prototype.hide=function(t){TVDialogs.destroy(this._dialogTitle,{undoChanges:!!t})},o.prototype._onDestroy=function(t,e){var i,o=(e||{}).undoChanges;$(window).unbind("keyup.hidePropertyDialog"),o?(i=this._undoCheckpoint?this._undoCheckpoint:this._undoCheckpointOnShow,i&&this._model.undoToCheckpoint(i)):this._source.hasAlert.value()&&this._source.localAndServerAlersMismatch&&this._source.synchronizeAlert(!0),this._undoCheckpointOnShow&&delete this._undoCheckpointOnShow,window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.refresh()},o.prototype.isVisible=function(){return this._dialog&&this._dialog.is(":visible")},o.prototype.focusOnText=function(){this._dialog.find('input[type="text"]').focus().select()},o.prototype.switchTab=function(t,e){var i,o;if(this._tabs)return i=null,t?t=t.valueOf():null===t&&(t=void 0),"string"==typeof t&&$.each(this._tabs,function(e,o){
if(o.name===t)return i=o,!1}),"object"==typeof t&&$.each(this._tabs,function(e,o){if(t===o||$(o.labelObject).is(t)||$(o.wrapperObject).is(t))return i=o,!1}),i||(i=this._tabs[~~t]),!!i&&($.each(this._tabs,function(t,e){var o=e===i;$(e.wrapperObject)[o?"show":"hide"](),$(e.labelObject)[o?"addClass":"removeClass"]("active")}),e&&(o=this.activeTabSettingsName(),o&&TVSettings.setValue(o,i.name)),this._dialog.height()+100>$(window).height()&&!i.isScrollable&&this.makeScrollable(i),$(":focus").blur(),!0)},o.prototype.makeScrollable=function(t){var e=t.wrapperObject,i=$(t.objects[0]),o=i.width();e.css({height:$(window).height()/1.4,overflow:"auto"}),i.css("width",o+20),t.isScrollable=!0},o.prototype.appendToTab=function(t,e,i,o,n,s){var r,a;$(t).is("table")&&!$(t).find("tr").size()||(this._tabs||(this._tabs=[]),$.each(this._tabs,function(t,i){if(i.name===e)return r=t,!1}),void 0===r&&(this._tabs.push({name:e,localizedName:$.t(e),objects:$(),displayPriority:0,defaultOpen:0,isButton:!!n,callback:n?s||function(){}:null}),r=this._tabs.length-1),a=this._tabs[r],a.objects=a.objects.add(t),a.displayPriority=Math.max(a.displayPriority||0,i||0),a.defaultOpen=Math.max(a.defaultOpen||0,o||0))},o.prototype.insertTabs=function(){function t(t){r&&r===t.name&&(t.defaultOpen=Math.max(~~t.defaultOpen,o.TAB_OPEN_USERSAVE)),(!n||~~n.defaultOpen<~~t.defaultOpen)&&(n=t),t.labelObject=$('<a href="#" class="properties-tabs-label"></a>').text(t.localizedName).appendTo(i._tabContainer),t.labelObject.bind("click",function(t){t.preventDefault(),i.switchTab(this,!0)});var e=$('<div class="main-properties"></div>');t.wrapperObject=$().add(e),t.objects.each(function(i,o){var n=$(o);n.is("table")?(n.data("layout-separated")&&(t.wrapperObject=t.wrapperObject.add('<div class="properties-separator"></div>').add(e=$('<div class="main-properties"></div>')),n.removeData("layout-separated")),e.append(n),n.children("tbody").each(function(i,n){if(0!==i&&$(n).data("layout-separated")){t.wrapperObject=t.wrapperObject.add('<div class="properties-separator"></div>').add(e=$('<div class="main-properties"></div>'));var s=$(o).clone(!0,!1).appendTo(e);s.children().remove(),s.append(n),$(n).removeData("layout-separated")}})):e.append(n)}),t.wrapperObject.appendTo(i._container)}function e(t){t.labelObject=$('<a href="#" class="properties-tabs-label"></a>').text(t.localizedName).appendTo(i._tabContainer),t.labelObject.bind("click",t.callback)}var i,n,s,r;this._tabs&&(this._tabs.sort(function(t,e){return(e.displayPriority||0)-(t.displayPriority||0)}),i=this,n=null,s=this.activeTabSettingsName(),s&&(r=TVSettings.getValue(s)),$.each(this._tabs,function(i,o){o.isButton?e(o):t(o)}),this.switchTab(n))},o.prototype.activeTabSettingsName=function(){var t=i(246),e=i(84),o=this._source;if(o)return o instanceof e||o instanceof t?"properties_dialog.active_tab.chart":o instanceof n?"properties_dialog.active_tab.drawing":o instanceof s?"properties_dialog.active_tab.study":void 0},o.prototype.show=function(t){function h(){g.hide(!0)}var c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V=i(259),M=i(246);if(t=t||{},c=t.onWidget||!1,TradingView.isInherited(this._source.constructor,M)&&TradingView.trackEvent("GUI","Chart Properties"),TradingView.isInherited(this._source.constructor,s)&&TradingView.trackEvent("GUI","Study Properties"),TradingView.isInherited(this._source.constructor,r)&&this._model.setSelectedSource(this._source),d=V.createStudyStrategyPropertyPage(this._source,this._model),p=V.createInputsPropertyPage(this._source,this._model),u=V.createStylesPropertyPage(this._source,this._model),_=V.createVisibilitiesPropertyPage(this._source,this._model),f=V.createDisplayPropertyPage(this._source,this._model),p||u||d)return g=this,m=null!==p,v=this._source.title(),y=TVDialogs.createDialog(v,{hideTitle:!0,dragHandle:".properties-tabs"}),b=y.find("._tv-dialog-content"),w=$('<div class="properties-tabs"></div>').appendTo(b),S=[],T=400,this._tabs=S,this._dialog=y,this._dialogTitle=v,this._dialog=y,this._container=b,this._tabContainer=w,this._undoCheckpointOnShow=this._model.createUndoCheckpoint(),y.on("destroy",function(t,e){g._onDestroy(t,e),p&&p.destroy(),d&&d.destroy(),u&&u.destroy(),f&&f.destroy(),_&&_.destroy(),$("select",b).each(function(){$(this).selectbox("detach")})}),t.selectScales&&u.setScalesOpenTab&&u.setScalesOpenTab(),t.selectTmz&&u.setTmzOpenTab&&u.setTmzOpenTab(),!this._model.readOnly()&&d&&d.widget().each(function(t,e){var i,n,s=+$(e).data("layout-tab-priority");isNaN(s)&&(s=o.TAB_PRIORITY_PROPERTIES),i=~~$(e).data("layout-tab-open"),n=$(e).data("layout-tab"),void 0===n&&(n=o.TAB_NAME_PROPERTIES),g.appendToTab(e,n,s,i)}),this._model.readOnly()||!m||p.widget().is(":empty")||p.widget().each(function(t,e){var n,s,r=i(273),a=p instanceof r,l=+$(e).data("layout-tab-priority");TradingView.isNaN(l)&&(l=a?o.TAB_PRIORITY_COORDINATES:o.TAB_PRIORITY_INPUTS),n=~~$(e).data("layout-tab-open"),s=$(e).data("layout-tab"),void 0===s&&(s=a?o.TAB_NAME_COORDINATES:o.TAB_NAME_INPUTS),g.appendToTab(e,s,l,n)}),u&&u.widget().each(function(t,e){var n,s,r,a=+$(e).data("layout-tab-priority");TradingView.isNaN(a)&&(a=o.TAB_PRIORITY_STYLE),n=~~$(e).data("layout-tab-open"),s=i(261),!n&&u instanceof s&&(n=o.TAB_OPEN_DEFAULT),r=$(e).data("layout-tab"),void 0===r&&(r=o.TAB_NAME_STYLE),g.appendToTab(e,r,a,n)}),f&&f.widget().each(function(t,e){var i,n,s=+$(e).data("layout-tab-priority");TradingView.isNaN(s)&&(s=o.TAB_PRIORITY_DISPLAY),i=~~$(e).data("layout-tab-open"),n=$(e).data("layout-tab"),void 0===n&&(n=o.TAB_NAME_DISPLAY),g.appendToTab(e,n,s,i)}),_&&_.widget().each(function(t,e){g.appendToTab(e,o.TAB_NAME_VISIBILITY,o.TAB_PRIORITY_DISPLAY,!1)}),P=this._source instanceof s&&this._source.metaInfo().isTVScript&&!!this._source.metaInfo().TVScriptSourceCode&&!TradingView.isMobileView,P&&g.appendToTab(null,$.t("Source Code"),null,null,!0,function(){this.hide();var t=this._source.metaInfo();TradingView.ScriptEditorWidget.open({scriptSource:t.TVScriptSourceCode,scriptIdPart:t.scriptIdPart})}.bind(this)),this.insertTabs(),this._helpItemRequired()&&this._createHelp(),C=$('<div class="main-properties main-properties-aftertabs"></div>').appendTo(b),x=$('<div class="dialog-buttons">').appendTo(C),L=function(){function t(e){e._childs&&e._childs.length&&$.each(e._childs,function(i,o){"percentage"===o?e.percentage.listeners().fire(e.percentage):t(e[o])})}var e=[];u&&"function"==typeof u.defaultProperties&&(e=e.concat(u.defaultProperties())),p&&"function"==typeof p.defaultProperties&&(e=e.concat(p.defaultProperties())),0===e.length&&g._source.properties?e=[g._source.properties()]:g._source._sessionsStudy&&(e=e.concat(g._source._sessionsStudy.properties())),e.length&&($.each(e,function(e,i){g._model.restoreFactoryDefaults(i),g._source.calcIsActualSymbol&&g._source.calcIsActualSymbol(),t(i)}),g._source.properties().minTick&&g._source.properties().minTick.listeners().fire(g._source.properties().minTick),g._source.properties().precision&&g._source.properties().precision.listeners().fire(g._source.properties().precision),p&&p.loadData(),d&&d.loadData(),u.onResoreDefaults&&u.onResoreDefaults(),u&&u.loadData(),_&&_.loadData())},k=function(){_&&_.loadData(),p&&p.loadData()},(!c||window.is_authenticated)&&u&&"function"==typeof u.createTemplateButton&&e.enabled("linetoolpropertieswidget_template_button")?u.createTemplateButton({defaultsCallback:L,loadTemplateCallback:k}).addClass("tv-left").appendTo(x):TradingView.isInherited(this._source.constructor,s)?(E=[{title:$.t("Reset Settings"),action:L},{title:$.t("Save As Default"),action:function(){g._source.properties().saveDefaults()}}],I=$('<a href="#" class="_tv-button tv-left">'+$.t("Defaults")+'<span class="icon-dropdown"></span></a>'),I.on("click",function(t){t.preventDefault();var e=$(this);e.is(".active")||e.trigger("button-popup",[E,!0])}).appendTo(x),l(I,null,{direction:"down",event:"button-popup",notCloseOnButtons:!0})):$('<a class="_tv-button tv-left">'+$.t("Defaults")+"</a>").appendTo(x).click(L),$('<a class="_tv-button ok">'+$.t("OK")+"</a>").appendTo(x).click(function(){g.hide()}),$('<a class="_tv-button cancel">'+$.t("Cancel")+"</a>").appendTo(x).on("click",h),y.find("._tv-dialog-title a").on("click",h),$(window).bind("keyup.hidePropertyDialog",function(t){13===t.keyCode&&"textarea"!==t.target.tagName.toLowerCase()&&g.hide()}),$("select",b).each(function(){var t=$(this),e="tv-select-container dialog";t.hasClass("tv-select-container-fontsize")&&(e+=" tv-select-container-fontsize"),t.selectbox({speed:100,classHolder:e})}),$('input[type="text"]',b).addClass("tv-text-input inset dialog"),$("input.ticker",b).TVTicker(),y.css("min-width",T+"px"),TVDialogs.applyHandlers(y),A={top:($(window).height()-y.height())/2,left:($(window).width()-y.width())/2},u&&"function"==typeof u.dialogPosition&&(A=u.dialogPosition(A,y)||A),TVDialogs.positionDialog(y,A),window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.hide(),a.emit("edit_object_dialog",{objectType:this._source===this._model.mainSeries()?"mainSeries":this._source instanceof n?"drawing":this._source instanceof s?"study":"other",sourceTitle:this._source.title()}),y},o.prototype._helpItemRequired=function(){return this._source._metaInfo&&!!this._source._metaInfo.helpURL},o.prototype._createHelp=function(){var t=$('<a class="help" href="#" target="_blank" title="'+$.t("Help")+'"></a>');t.attr("href",this._source._metaInfo.helpURL),this._tabContainer.prepend(t)},t.exports=o}).call(e,i(1))},function(t,e,i){(function(t){"use strict";function o(t){return t instanceof h?t instanceof Q?Mt:t instanceof pt?null:t instanceof q?null:t instanceof st?null:t instanceof A?Vt:t instanceof I?null:t instanceof tt?null:t instanceof lt?null:t instanceof F?null:t instanceof nt?null:t instanceof ht?It:t instanceof T?null:t instanceof W?null:t instanceof H?null:t instanceof S?Ot:t instanceof yt?Lt:t instanceof U?null:t instanceof w?null:t instanceof M?null:t instanceof ft?Rt:kt:t instanceof vt?t instanceof wt?Pt:Ct:null}function n(e,i){if(e instanceof l||e instanceof a)return t.enabled("show_chart_property_page")?xe:null;if(e instanceof vt)return e instanceof bt?Tt:"Volume@tv-basicstudies"===e.metaInfo().id?Wt:xt;if(e instanceof h){if(e instanceof V)return zt;if(e instanceof A)return At;if(e instanceof L)return fe;if(e instanceof k)return fe;if(e instanceof E)return ge;if(e instanceof ht)return Et;if(e instanceof ct)return Et;if(e instanceof S)return Dt;if(e instanceof z)return Ut;if(e instanceof D)return qt;if(e instanceof lt)return jt;if(e instanceof ot)return ye;if(e instanceof rt)return Ft;if(e instanceof dt||e instanceof q)return Yt;if(e instanceof pt)return Gt;if(e instanceof st)return Kt;if(e instanceof G)return Xt;if(e instanceof I)return Zt;if(e instanceof W)return we;if(e instanceof H)return Se;if(e instanceof $)return Jt;if(e instanceof it)return Qt;if(e instanceof U)return Te;if(e instanceof at)return te;if(e instanceof nt)return ee;if(e instanceof et)return ie;if(e instanceof tt)return oe;if(e instanceof O)return ne;if(e instanceof R)return se;if(e instanceof N)return re;if(e instanceof c)return d;if(e instanceof p)return u;if(e instanceof b)return ae;if(e instanceof j)return ce;if(e instanceof _)return f;if(e instanceof v)return Ce;if(e instanceof C)return le;if(e instanceof B)return he;if(e instanceof x)return de;if(e instanceof g)return m;if(e instanceof F)return pe;if(e instanceof P)return ue;if(e instanceof ut||e instanceof _t)return _e;if(e instanceof y)return St;if(e instanceof T)return Bt;if(e instanceof Q)return $t;if(e instanceof X)return me;if(e instanceof J)return ve;if(e instanceof K)return be;if(e instanceof Z)return ve;if(e instanceof Y)return me;if(e instanceof yt)return xt;if(e instanceof mt||e instanceof gt)return Ht;if(e instanceof ft)return Nt}return null}function s(t){var e=i(270).StudyDisplayPropertyPage;return t instanceof vt?e:null}function r(t){var e=i(322);if(t instanceof h)return e}var a=i(246),l=i(84),h=(i(125),i(213),i(74).LineDataSource),c=i(126),d=i(260),p=i(133),u=i(264),_=i(135),f=i(265),g=i(136),m=i(266),v=i(138),y=i(139).LineToolElliott,b=i(140).LineToolFibCircles,w=i(143),S=(i(144),i(146).LineToolVertLine),T=i(161),C=i(162),x=i(163),P=i(164),L=i(165),k=i(166),E=i(167),I=i(134).LineToolParallelChannel,A=i(168),V=i(131).LineToolTrendLine,$=i(169).LineToolArrowMark,M=i(121).LineToolExecution,D=i(171),O=i(173),B=i(174),R=i(175),N=i(176),F=i(137).LineToolFibWedge,z=i(172).LineToolPitchfork,W=i(177),H=i(178),U=i(179),q=i(180),j=i(181),Y=i(182),G=i(183).LineToolTriangle,K=i(184),X=i(185).LineTool5PointsPattern,Z=i(186),J=i(187),Q=i(188).LineToolRiskReward,tt=i(189),et=i(190),it=i(192),ot=i(193).LineToolNote,nt=i(194),st=i(195),rt=i(196),at=i(197),lt=i(104).LineToolText,ht=i(102).LineToolHorzLine,ct=i(198),dt=i(129).LineToolRectangle,pt=i(199),ut=i(200),_t=i(201),ft=i(202),gt=i(203).LineToolBezierQuadro,mt=i(203).LineToolBezierCubic,vt=i(150).Study,yt=i(145).StudyLineDataSource,bt=i(216).study_Overlay,wt=i(217),St=i(267),Tt=i(268),Ct=i(270).StudyInputsPropertyPage,xt=i(270).StudyStylesPropertyPage,Pt=i(271),Lt=i(272),kt=i(273),Et=i(274).LineToolHorzLineStylesPropertyPage,It=i(274).LineToolHorzLineInputsPropertyPage,At=i(275).LineToolTrendAngleStylesPropertyPage,Vt=i(275).LineToolTrendAngleInputsPropertyPage,$t=i(276).LineToolRiskRewardStylesPropertyPage,Mt=i(276).LineToolRiskRewardInputsPropertyPage,Dt=i(277).LineToolVertLineStylesPropertyPage,Ot=i(277).LineToolVertLineInputsPropertyPage,Bt=i(278).LineToolBarsPatternStylesPropertyPage,Rt=i(279).LineToolGhostFeedInputsPropertyPage,Nt=i(279).LineToolGhostFeedStylesPropertyPage,Ft=i(280),zt=i(281),Wt=i(282),Ht=i(283),Ut=i(284),qt=i(285),jt=i(286),Yt=i(287),Gt=i(288),Kt=i(289),Xt=i(290),Zt=i(291),Jt=i(292),Qt=i(293),te=i(294),ee=i(295),ie=i(296),oe=i(297),ne=i(298),se=i(299),re=i(300),ae=i(301),le=i(302),he=i(303),ce=i(304),de=i(305),pe=i(306),ue=i(307),_e=i(308),fe=i(309),ge=i(310),me=i(311),ve=i(312),ye=i(313),be=i(314),we=i(315),Se=i(316),Te=i(317),Ce=i(318),xe=i(319);e.createInputsPropertyPage=function(t,e){var i=o(t);return i?new i(t.properties(),e,t):null},e.createStudyStrategyPropertyPage=function(t,e){var o=i(214),n=i(323);return t instanceof o?new n(t.properties(),e,t):null},e.createStylesPropertyPage=function(t,e){var i=n(t);return i?new i(t.properties(),e,t):null},e.createDisplayPropertyPage=function(t,e){var i=s(t);return i?new i(t.properties(),e,t):null},e.createVisibilitiesPropertyPage=function(t,e){var i=r(t);return i?new i(t.properties(),e,t):null},e.hasInputsPropertyPage=function(t){return!!o(t)},e.hasStylesPropertyPage=function(t){return!!n(t)},e.hasDisplayPropertyPage=function(t){return!!s(t)}}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.FloatBinder,a=s.BooleanBinder,l=s.SliderBinder,h=s.ColorBinding,c=s.SimpleComboBinder,d=i(55),p=d.addColorPicker,u=d.createLineStyleEditor,_=d.createLineWidthEditor,f=d.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e){var i,o,n,s,l,c=e||$("<tr>").appendTo(this._table),d=$("<td>");return d.appendTo(c),i=$("<input type='checkbox' class='visibility-switch'>"),i.appendTo(d),e&&i.css("margin-left","15px"),o=$("<td>"),o.appendTo(c),n=$("<input type='text'>"),n.appendTo(o),n.css("width","70px"),this.bindControl(new r(n,t.coeff,!1,this.model(),"Change Pitchfork Line Coeff")),s=$("<td class='colorpicker-cell'>"),s.appendTo(c),l=p(s),this.bindControl(new a(i,t.visible,!0,this.model(),"Change Fib Retracement Line Visibility")),this.bindControl(new h(l,t.color,!0,this.model(),"Change Fib Retracement Line Color",0)),c},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,r,d,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V,M,D,O,B,R,N,F,z;for(this._div=$(document.createElement("div")).addClass("property-page"),t=this._linetool.properties().trendline,e=$("<table>").appendTo(this._div).css("padding-bottom","3px"),t&&(i=$("<tr>").appendTo(e),o=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(o).appendTo(i),$("<td>").append($.t("Trend Line")).appendTo(i),this.bindControl(new a(o,t.visible,!0,this.model(),"Change Fib Retracement Line Visibility")),n=$("<td class='colorpicker-cell'>").appendTo(i),s=p(n),this.bindControl(new h(s,t.color,!0,this.model(),"Change Fib Retracement Line Color",0)),r=$("<td>").appendTo(i),d=_(),d.appendTo(r),this.bindControl(new l(d,t.linewidth,parseInt,this.model(),"Change Fib Retracement Line Width")),g=$("<td>").appendTo(i),m=u(),m.render().appendTo(g),this.bindControl(new c(m,t.linestyle,parseInt,!0,this.model(),"Change Fib Retracement Line Style"))),v=this._linetool.properties().levelsStyle,y=$("<tr>").appendTo(e),$("<td>").appendTo(y),$("<td>"+$.t("Levels Line")+"</td>").appendTo(y),$("<td>").appendTo(y),r=$("<td>").appendTo(y),d=_(),d.appendTo(r),this.bindControl(new l(d,v.linewidth,parseInt,this.model(),"Change Fib Retracement Line Width")),g=$("<td>").appendTo(y),m=u(),m.render().appendTo(g),this.bindControl(new c(m,v.linestyle,parseInt,!0,this.model(),"Change Fib Retracement Line Style")),this._table=$(document.createElement("table")).appendTo(this._div),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),b={},w=0;w<24;w++)S=w%8,y=b[S],T="level"+(w+1),b[S]=this.addLevelEditor(this._linetool.properties()[T],y);this.addOneColorPropertyWidget(this._table),C=$("<table cellpadding=0 cellspacing=0>").appendTo(this._div),x=$("<tr>").appendTo(C),this._linetool.properties().extendLines&&(P=$("<input type='checkbox' class='visibility-switch'>"),L=$("<label>").append(P).append($.t("Extend Lines")),$("<td>").append(L).appendTo(x)),this._linetool.properties().extendLeft&&(k=$("<input type='checkbox' class='visibility-switch'>"),L=$("<label>").append(k).append($.t("Extend Left")),$("<td>").append(L).appendTo(x)),this._linetool.properties().extendRight&&(E=$("<input type='checkbox' class='visibility-switch'>"),L=$("<label>").append(E).append($.t("Extend Right")),$("<td>").append(L).appendTo(x)),this._linetool.properties().reverse&&(I=$("<input type='checkbox' class='visibility-switch'>"),L=$("<label>").append(I).append($.t("Reverse")),$("<td>").append(L).appendTo(x)),A=$("<tr>").appendTo(C),V=$("<input type='checkbox' class='visibility-switch'>"),L=$("<label>").append(V).append($.t("Levels")),$("<td>").append(L).appendTo(A),M=$("<input type='checkbox' class='visibility-switch'>"),L=$("<label>").append(M).append($.t("Prices")),$("<td>").append(L).appendTo(A),D=$("<input type='checkbox' class='visibility-switch'>"),L=$("<label>").append(D).append($.t("Percents")),$("<td>").append(L).appendTo(A),O=$("<table cellspacing='0' cellpadding='0'>").appendTo(this._div),B=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),R=$("<select><option value='bottom'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='top'>"+$.t("bottom")+"</option></select>"),y=$("<tr>"),y.append("<td>"+$.t("Labels")+"</td>").append(B).append("<td>&nbsp</td>").append(R),y.appendTo(O),N=$("<table cellspacing='0' cellpadding='0'>").appendTo(this._div),y=$("<tr>").appendTo(N),F=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(F).appendTo(y),this.createLabeledCell($.t("Background"),F).appendTo(y),z=f(),$("<td>").append(z).appendTo(y),this.bindControl(new a(M,this._linetool.properties().showPrices,!0,this.model(),"Change Gann Fan Prices Visibility")),this.bindControl(new a(V,this._linetool.properties().showCoeffs,!0,this.model(),"Change Gann Fan Levels Visibility")),this.bindControl(new a(F,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility")),this.bindControl(new l(z,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency")),this._linetool.properties().extendLines&&this.bindControl(new a(P,this._linetool.properties().extendLines,!0,this.model(),"Change Fib Retracement Extend Lines")),this._linetool.properties().extendLeft&&this.bindControl(new a(k,this._linetool.properties().extendLeft,!0,this.model(),"Change Fib Retracement Extend Lines")),this._linetool.properties().extendRight&&this.bindControl(new a(E,this._linetool.properties().extendRight,!0,this.model(),"Change Fib Retracement Extend Lines")),this._linetool.properties().reverse&&this.bindControl(new a(I,this._linetool.properties().reverse,!0,this.model(),"Change Fib Retracement Reverse")),this.bindControl(new c(B,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Fib Labels Horizontal Alignment")),this.bindControl(new c(R,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Fib Labels Vertical Alignment")),this.bindControl(new a(D,this._linetool.properties().coeffsAsPercents,!0,this.model(),"Change Fib Retracement Coeffs As Percents")),this.loadData()},o.prototype.widget=function(){return this._div},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e),this._linetool=i,this._templateList=new l(this._linetool._constructor,this.applyTemplate.bind(this))}var n=i(262),s=n.PropertyPage,r=n.ColorBinding,a=i(55).addColorPicker,l=i(263);inherit(o,s),o.prototype.applyTemplate=function(t){this._linetool.restoreTemplate(t),this._model.model().updateSource(this._linetool),this.loadData()},o.prototype.createTemplateButton=function(t){var e=this;return t=$.extend({},t,{getDataForSaveAs:function(){return e._linetool.template()}}),this._templateList.createButton(t)},o.prototype.createOneColorForAllLinesWidget=function(){var t=$("<td class='colorpicker-cell'>");return this.bindControl(new r(a(t),this._linetool.properties().collectibleColors,!0,this.model(),"Change All Lines Color",0)),{label:$("<td>"+$.t("Use one color")+"</td>"),editor:t}},o.prototype.addOneColorPropertyWidget=function(t){var e=this.createOneColorForAllLinesWidget(),i=$("<tr>");i.append($("<td>")).append($("<td>").append(e.label)).append($("<td>").append(e.editor)),i.appendTo(t)},o.prototype.appendTemplateRow=function(t){var e,i,o;is_authenticated&&(e=$(document.createElement("tr")),e.appendTo(t),i=$(document.createElement("td")),i.attr("colspan",2),i.appendTo(e),o=$('<div class="dialog-theme-buttons"></div>').appendTo(i),this.templateButton=$(this.createTemplateButton()),this.templateButton.appendTo(o),$('<tr><td class="property-page-separator-cell" colspan="6"><div class="property-page-separator"></div></td></tr>').appendTo(t))},t.exports=o},function(t,e,i){(function(t){"use strict";function o(t,e){this._model=e,this._bindings=[],this._property=t}function n(t,e,i,o,s,r){return t?(this._control=t,this._property=e,this._applyOnFly=i,this._undoModel=o,this._undoText=s,void(e&&(this._formatters=[],this._changed=!1,this.setValue(e.value()),e.listeners().subscribe(this,n.prototype.propertyChanged)))):void TradingView.logDebugChart("Binding: missing control")}function s(t){return t.toUpperCase()}function r(t){return function(e){return e<t?t:e}}function a(t){return function(e){return e>t?t:e}}function l(t){return function(e){var i=parseInt(e,10);return TradingView.isNaN(i)?t:i}}function h(t){var e=new A;return function(i){var o=e.parse(i);return TradingView.isNaN(o)?t:o}}function c(){return function(t){for(var e=t,i=t.replace(/[^\u0000-\u007F]/,"");i.length!==e.length;)e=i,i=e.replace(/[^\u0000-\u007F]/,"");return i}}function d(t){return function(e){return 0===e.length?t:e}}function p(t,e,i,o,s,r){n.call(this,t,e,o,s,r),this._transformFunction=i,this._attachToControl(t,o)}function u(t,e,i,o,n){p.call(this,t,e,h(e.value()),i,o,n),this.addFormatter(function(t){return(new A).format(t)})}function _(t,e,i,o,s,r){this._subControlIds=e,n.call(this,t,i,o,s,r),this._forEachSubControl(function(t){this._attachToControl(t,o)})}function f(t,e,i,o,s,r,a){this._model=o,this._mainSeries=r,this._toIntTransformer=l(a),this._disabled=!1,n.call(this,t,e,i,o,s);var h=this;i&&t.change(function(){h.setValueToProperty(h.value())}),this._mainSeries.onBarReceived().subscribe(this,function(t){h.setValue(this.property().value())})}function g(t,e,i,o,s){n.call(this,t,e,i,o,s),i&&t.on("accept-symbol",function(t,e){this.setValueToProperty(e)}.bind(this))}function m(t,e,i,o,s,r,a){n.call(this,t,e,o,s,r),this._transformFunction=i,this._setter=a;var l=this;o&&t.change(function(){l._setter?l._setter.call(l,l.value()):l.setValueToProperty(l.value())})}function v(t,e){n.call(this,t,e)}function y(t,e,i,o,s,r){if(!t.is(":checkbox, :radio"))return new w(t,e,i,o,s);n.call(this,t,e,i,o,s),this._setter=r;var a=this;i&&t.change(function(){a._setter?a._setter.call(a,a.value()):a.setValueToProperty(a.value())})}function b(t,e,i,o,s,r){n.call(this,t,e,i,o,s),this._inverted=r===!0}function w(t,e,i,o,s){n.call(this,t,e,i,o,s);var r=this;i&&t.click(function(){var t=$(this).toggleClass("active").hasClass("active");r.setValueToProperty(t)})}function S(t,e,i,o,s){return i?(n.call(this,t,e,!0,i,o),void(s?t.callbacks().subscribe(this,s):t.callbacks().subscribe(this,S.prototype.onActionCallback))):void TradingView.logDebugChart("ActionBinder: Missed undo model")}function T(t,e,i,o,s,r){var a,l;a=t.is("input")?t:t.find("input"),n.call(this,a,e,i,o),this._transparencyProperty=r,this.applyOldTransparency(),l=this,i&&a.change(function(){l.setValueToProperty(l.value())})}function C(e,i,o,s,r,a){function l(t,e){var i=c.control().slider("option","min"),o=c.control().slider("option","max"),n=c._property.value();(i<=n&&n<=o||i<e.value&&e.value<o)&&c.setValueToProperty(e.value)}function h(t,e){c.setValueToProperty(e.value)}isNumber(i.value())||(TradingView.logWarn("Property cannot be binded to control, bad value (expect number): "+i.value()),i=new t),n.call(this,e,i,o,s,r);var c=this;o&&(a?(e.bind("slidechange",l),e.bind("slide",l)):(e.bind("slidechange",h),e.bind("slide",h))),e.bind("slidestart",function(t,e){s.beginUndoMacro(r)}),e.bind("slidestop",function(t,e){s.endUndoMacro()})}function x(t,e,i,o,n,s){y.call(this,t,e,o,n,s),this._intervalProperty=i,this._intervalProperty.listeners().subscribe(this,this.onIntervalChanged),this.onIntervalChanged()}function P(t,e,i,o){this._control=t,this._wv=e,this._transformFunction=i,this._undoText=o,this._attachToControl(this._control),this._setValueBinded=this.setValue.bind(this)}function L(t,e,i,o,n){this._not=!!n,P.apply(this,arguments)}function k(t,e,i,o,n,s,r,a){this._propFrom=e[0],this._propTo=e[1],this._control=t,this._applyOnFly=o,this._undoModel=n,this._undoText=r,this._properties=e,this._inputsText=s,this._transformers=i;var l=this;t.slider({range:!0,min:i[0],max:i[1],values:[l._propFrom.value(),l._propTo.value()]}),this.$rangeHandleFrom=$(t.find(".ui-slider-handle")[0]).addClass("from"),this.$rangeHandleTo=$(t.find(".ui-slider-handle")[1]).addClass("to"),this.setValue(this._propFrom,0),this.setValue(this._propTo,1),a&&($(a).on("change",function(t){$(this).is(":checked")?(l._control.slider("enable"),$(l._inputsText[0]).prop("disabled",!1),$(l._inputsText[1]).prop("disabled",!1)):(l._control.slider("disable"),$(l._inputsText[0]).prop("disabled",!0),$(l._inputsText[1]).prop("disabled",!0))}),$(a).is(":checked")?(l._control.slider("enable"),$(l._inputsText[0]).prop("disabled",!1),$(l._inputsText[1]).prop("disabled",!1)):(l._control.slider("disable"),$(l._inputsText[0]).prop("disabled",!0),$(l._inputsText[1]).prop("disabled",!0))),s&&($(s[0]).val(this._control.slider("values",0)),$(s[1]).val(this._control.slider("values",1)),t.slider({slide:function(t,e){$(s[0]).val(e.values[0]),$(s[1]).val(e.values[1])}}),$(s).each(function(){$(this).on("keydown",function(t){parseInt($(s[0]).val())<l._transformers[0]?$(s[0]).val(l._transformers[0]):parseInt($(s[1]).val())>l._transformers[1]&&$(s[1]).val(l._transformers[1]),$.inArray(t.keyCode,[46,8,9,27,13,110,190])!==-1||65===t.keyCode&&t.ctrlKey===!0||67===t.keyCode&&t.ctrlKey===!0||88===t.keyCode&&t.ctrlKey===!0||t.keyCode>=35&&t.keyCode<=39||(t.shiftKey||t.keyCode<48||t.keyCode>57)&&(t.keyCode<96||t.keyCode>105)&&t.preventDefault()})}),$(s[0]).on("keyup",function(t){parseInt($(this).val())<l._transformers[0]?$(this).val(l._transformers[0]):parseInt($(this).val())>l._transformers[1]&&$(this).val(l._transformers[1]),parseInt($(this).val())>parseInt($(s[1]).val())&&$(this).val(s[1].val()),l._control.slider("values",0,$(this).val()),k.prototype.setValueToProperty.call(l,l._control.slider("values"),"from")}),$(s[1]).on("keyup",function(t){parseInt($(this).val())<l._transformers[0]?$(this).val(l._transformers[0]):parseInt($(this).val())>l._transformers[1]&&$(this).val(l._transformers[1]),parseInt($(this).val())<$(s[0]).val()&&$(this).val(s[0].val()),l._control.slider("values",1,$(this).val()),k.prototype.setValueToProperty.call(l,l._control.slider("values"),"to")})),this._propFrom.listeners().subscribe(this,k.prototype.propertyChanged),this._propTo.listeners().subscribe(this,k.prototype.propertyChanged),o&&t.on("slide",function(t,e){l.setValueToProperty(l._control.slider("values"),e.handle)}),t.slider({stop:function(t,e){s&&($(s[0]).val(l._control.slider("values",0)),$(s[1]).val(l._control.slider("values",1))),l.setValueToProperty(l._control.slider("values"),e.handle)},start:function(t,e){s&&($(s[0]).val(l._control.slider("values",0)),$(s[1]).val(l._control.slider("values",1))),l.setValueToProperty(l._control.slider("values"),e.handle)}})}function E(t,e,i,o,s,r){n.call(this,t,e,i,o,s),this._separator=r||" ";var a=this;i&&t.change(function(){a.setValueToProperty(a.value())})}var I=i(248).UndoHistory,A=i(82).NumericFormatter;o.prototype.model=function(){return this._model},o.prototype.bindControl=function(t){return this._bindings.push(t),t},o.prototype.unbindControl=function(t){var e=this._bindings.indexOf(t);e!==-1&&this._bindings.splice(e,1)},o.prototype.loadData=function(){var t,e,i;for(t=0;t<this._bindings.length;t++)e=this._bindings[t],e.properties?(i=e.properties(),e.setValue(i[0],0),e.setValue(i[1],1)):e.property&&(e.transparencyProperty&&e.transparencyProperty()?e.applyOldTransparency():e.setValue(e.property().value()))},o.prototype.saveData=function(){var t,e;for(this._model.beginUndoMacro(),t=0;t<this._bindings.length;t++)e=this._bindings[t],e.changed()&&this._model.setProperty(e.property(),e.value());this._model.endUndoMacro()},o.prototype.createColorPicker=function(t){var e,i;return t=t||{},e=$('<input class="colorpicker-widget">').bind("customcolorchange",function(t,e){TVSettings.setJSON("pickerCustomColors",e)}).on("change",function(){$(this).css("border-color",TradingView.generateLowBrightnessColor($(this).val()||TradingView.defaultColorPickersBorder))}).tvcolorpicker({customColors:TVSettings.getJSON("pickerCustomColors",[]),hideTransparency:!!t.hideTransparency}),i=$('<span class="tvcolorpicker-container">'),$('<div class="tvcolorpicker-transparency">').appendTo(i),e.appendTo(i),t.addClass&&i.addClass(t.addClass),i},o.prototype.createTextEditor=function(t,e){var i={};return t&&(i.width=t),e&&(i.height=e),$(document.createElement("textarea")).css(i)},o.prototype.createCombo=function(t){var e=$(document.createElement("select")),i=t.reduce(function(t,e){return t.add($(document.createElement("option")).prop({value:e,text:e}))},$());return e.append(i)},o.prototype.createKeyCombo=function(t){var e=$(document.createElement("select"));return $.each(t||[],function(t,i){$(document.createElement("option")).prop({value:t,text:i}).appendTo(e)}),e},o.prototype.createFontEditor=function(t){var e=t||TradingView.factoryDefaults("chartproperties.editorFontsList");return this.createCombo(e)},o.prototype.createFontSizeEditor=function(t){var e=t||[10,11,12,14,16,20,24,28,32,40];return this.createCombo(e).addClass("tv-select-container-fontsize")},o.prototype.createSeriesMinTickEditor=function(){var t,e,i,o,n="<select><option value='default'>"+$.t("Default")+"</option>",s=[{priceScale:1,minMove:1,frac:!1},{priceScale:10,minMove:1,frac:!1},{priceScale:100,minMove:1,frac:!1},{priceScale:1e3,minMove:1,frac:!1},{priceScale:1e4,minMove:1,
frac:!1},{priceScale:1e5,minMove:1,frac:!1},{priceScale:1e6,minMove:1,frac:!1},{priceScale:2,minMove:1,frac:!0},{priceScale:4,minMove:1,frac:!0},{priceScale:8,minMove:1,frac:!0},{priceScale:16,minMove:1,frac:!0},{priceScale:32,minMove:1,frac:!0},{priceScale:64,minMove:1,frac:!0},{priceScale:128,minMove:1,frac:!0},{priceScale:320,minMove:1,frac:!0}];for(t in s)e=s[t],i=e.priceScale+","+e.minMove+","+e.frac,o=e.minMove+"/"+e.priceScale,n+="<option value='"+i+"'>"+o+"</option>";return n+="</select>",$(n)},o.prototype.createPrecisionEditor=function(){var t,e="<select><option value='default'>"+$.t("Default")+"</option>";for(t=0;t<=6;t++)e+="<option value='"+t+"'>"+t+"</option>";return e+="</select>",$(e)},o.prototype.createLabeledCell=function(t,e,i){var o,n,s,r,a=null;return"number"==typeof t.valueOf()?(a=t,o=e,n=i):(o=t,n=e),o+="",s=this._labelToId(o),r=$("<td>"),$("<label>").html(o.length>0?$.t(o):"").attr("for",s).appendTo(r),a&&r.attr("colspan",a),n&&n.attr("id",s),r},o.prototype.createTableInTable=function(t){var e=$("<tr>").appendTo(t),i=$("<td>").appendTo(e);return $('<table cellpadding="0" cellspacing="0">').appendTo(i)},o.prototype._labelToId=function(t){return"control"+t.replace(/(^| )\w/g,function(t){return"-"+t.trim().toLowerCase()})+Math.floor(1e3*Math.random())},o.prototype.addRow=function(t){var e=$(document.createElement("tr"));return e.appendTo(t)},o.prototype.addLabeledRow=function(t,e,i,o){var n,s=e&&e.length>0?$.t(e):"",r=$(document.createElement("tr")),a=$(document.createElement("td")).html(s);return o&&a.attr("colspan",2),i&&(n=this._labelToId(e),i.attr("id",n),a.html('<label for="'+n+'">'+s+"</label>")),r.append(a).appendTo(t)},o.prototype.addEditorRow=function(t,e,i,o){var n=$(document.createElement("td"));return i.row=this.addLabeledRow(t,e,i,o),i.appendTo(n.appendTo(i.row)),i},o.prototype.addColorPickerRow=function(t,e){return this.addEditorRow(t,e,this.createColorPicker())},o.prototype.addOffsetEditorRow=function(t,e){var i=$("<input/>");return i.attr("type","text"),i.css("width","100px"),i.addClass("ticker"),this.addEditorRow(t,e,i)},o.prototype.addFontEditorRow=function(t,e){return this.addEditorRow(t,e,this.createFontEditor())},o.prototype.refreshStateControls=function(t,e,i){var o,n,s;for(o=0;o<e.length;o++)n=e[o],s=t[n.id],s.toggle(this.parseRule(n.visible,e,i)),s.attr("disabled",!this.parseRule(n.visible,e,i))},o.prototype.parseRule=function(t,e,i){if(!t)return!0;var o=t.split("==");return!(o.length<2)&&i[o[0]].value()===o[1]},o.prototype.destroy=function(){for(var t=this._bindings.length;t--;)this._bindings[t].destroy();this._bindings.length=0},o.prototype.bindInteger=function(t,e,i,o,n){var s=[l(e.value())];void 0!==o&&s.push(r(1)),void 0!==n&&s.push(a(1e3)),this.bindControl(new p(t,e,s,!1,this.model(),i))},o.prototype.bindColor=function(t,e,i){this.bindControl(new T(t,e,!0,this.model(),i))},o.prototype.bindBoolean=function(t,e,i){this.bindControl(new y(t,e,!0,this.model(),i))},n.prototype.addFormatter=function(t){this._formatters.push(t),this.setValue(this._property.value())},n.prototype._formatValue=function(t){return this._formatters.reduce(function(t,e){return e(t)},t)},n.prototype._attachToControl=function(t,e){var i=this;e?t.on("keyup change input",function(t){var e=i.value();i.setValueToProperty(e),i.setValue(e)}):(t.keypress(function(t){if(this._changed=!0,13===t.which){var e=i.value();i.setValueToProperty(e),i.setValue(e)}}),t.focusout(function(t){var e=i.value();i.changed()&&(i.setValueToProperty(e),i.setValue(e))}),t.change(function(t){var e=i.value();$(t.target).is(".ticker")?(void 0!==i._changeTimerId&&clearTimeout(i._changeTimerId),i._changeTimerId=setTimeout(function(){i.setValueToProperty(e)},250)):i.setValueToProperty(e),i.setValue(e)}))},n.prototype.control=function(){return this._control},n.prototype.changed=function(){return this._changed},n.prototype.setValueToProperty=function(t){this._undoModel.setProperty(this._property,t,this._undoText),this._changed=!1},n.prototype.property=function(){return this._property},n.prototype.propertyChanged=function(t){this.setValue(t.value())},n.prototype.destroy=function(){this._property&&this._property.listeners().unsubscribe(this,n.prototype.propertyChanged)},inherit(p,n),p.prototype.value=function(){var t,e=this._control.val();if(this._transformFunction)if(Array.isArray(this._transformFunction))for(t=0;t<this._transformFunction.length;t++)e=this._transformFunction[t](e);else e=this._transformFunction(e);return e},p.prototype.setValue=function(t){var e=this._control.val(),i=this._formatValue(t);e!==i&&this._control.val(i)},inherit(u,p),inherit(_,n),_.prototype._forEachSubControl=function(t){this._subControlIds.forEach(function(e){var i="#"+e,o=this.control().find(i);t.call(this,o)},this)},_.prototype._parseSessions=function(t){var e,i,o=t.split("-",2);return 2!==o.length&&(o=["0","0"]),e=parseInt(o[0]),i=parseInt(o[1]),[Math.floor(e/100),e%100,Math.floor(i/100),i%100]},_.prototype.value=function(){var t,e,i,o=[];return this._forEachSubControl(function(t){o.push(t.val())}),t=function(t,e){return e.forEach(function(e){t=e(t)}),("0"+t).slice(-2)},e=[l(0),r(0),a(23)],i=[l(0),r(0),a(59)],t(o[0],e)+t(o[1],i)+"-"+t(o[2],e)+t(o[3],i)},_.prototype.setValue=function(t){var e=this._parseSessions(t);this._forEachSubControl(function(t){var i=t.val(),o=("0"+e[0]).slice(-2);e.shift(),i!==o&&t.val(o)})},inherit(f,n),f.prototype.value=function(){var t,e,i,o;return this._disabled?(this._control.attr("disabled",!0),null):(t=this._control.val(),e=this._toIntTransformer(t),e<0&&(e=0),i=this._mainSeries.bars().size(),i<=e&&(e=i-1),o=this._mainSeries.bars()._valueAt(this._mainSeries.bars().lastIndex()-e)[TradingView.TIME_PLOT],1e3*o)},f.prototype.setValue=function(t){var e,i,o,n;return this._disabled||null==t?void this._control.attr("disabled",!0):t<0?(this._control.val(-t),void this._property.setValue(this.value())):(e=this._mainSeries.data().timeToBarIndex(t/1e3,TradingView.SEARCH_FROM_RIGHT),null===e?void(this._disabled=!0):(i=this._mainSeries.bars().lastIndex(),o=i-e,n=this._control.val(),void(n!==""+o&&this._control.val(o))))},inherit(g,n),g.prototype.value=function(){return this._control.val()},g.prototype.setValue=function(t){var e=this.value();t&&e!==t&&this._control.val(t)},inherit(m,n),m.prototype.value=function(){var t=this._control.val();return this._transformFunction&&(t=this._transformFunction(t)),t},m.prototype.setValue=function(t){var e,i;if(this._control.val(t),this._control.selectbox)try{e=this._control.find("[value='"+t+"']"),e.length>0&&(i=e[0],this._control.selectbox("change",i.value,i.text))}catch(t){}},inherit(v,n),v.prototype.value=function(){return this._property.value()},v.prototype.setValue=function(t){return this._control.html(t)},inherit(y,n),y.prototype.value=function(){return this.control().is(":checked")},y.prototype.setValue=function(t){var e,i,o,n;return this.control().is(".visibility-checker")&&(t?(this.control().closest("tr").find(".slider-range").slider("enable"),this.control().closest("tr").find('input[type="text"]').each(function(){$(this).prop("disabled",!1)})):(this.control().closest("tr").find(".slider-range").slider("disable"),this.control().closest("tr").find('input[type="text"]').each(function(){$(this).prop("disabled",!0)}))),this.control().is(".visibility-switch")&&(e={opacity:t?1:.5},i=t?"enable":"disable",o=this.control().data("hides"),o?o.closest("td").css(e):(n=this.control(),n.parent().parent().data("visible",t).find("td").filter(function(){var t=$(this);return!t.find("label").length&&t.find(":checkbox").attr("id")!==n.attr("id")}).each(function(){var o=$(this),n=o.children();n.each(function(){var n=$(this);n.is(".ui-slider")?n.slider(i):n.is("select")?(n.selectbox(i),o.css(e)):n.is(".custom-select")?(n.data(i)(),o.css(e)):n.is(".tvcolorpicker-container")?(n.find("input").prop("disabled",!t),o.css(e)):(n.prop("disabled",!t),o.css(e))})}))),this.control().attr("checked",!!t)},inherit(b,n),b.prototype.value=function(){return this.control().is(":disabled")},b.prototype.setValue=function(t){return t=!!t,this._inverted&&(t=!t),this.control().parents("label").toggleClass("disabled",t),this.control().attr("disabled",t)},inherit(w,n),w.prototype.value=function(){return this.control().hasClass("active")},w.prototype.setValue=function(t){return this.control().toggleClass("active",!!t)},inherit(S,n),S.prototype.onActionCallback=function(t){this._undoModel.setProperty(this._property,this.value(),this._undoText)},S.prototype.value=function(){return this.control().checked},S.prototype.setValue=function(t){return this.control().checked=!!t},inherit(T,n),T.prototype.applyOldTransparency=function(){var t,e,i;this.transparencyProperty()&&(TradingView.isHexColor(this.property().value())?(t=this.transparencyProperty().value?this.transparencyProperty().value():this.transparencyProperty(),e=TradingView.hexRgbDecomp(this.property().value()),i=(100-t)/100,this.control().val(TradingView.rgbaComp(e,i)),this.control().change()):(this.control().val(this.property().value()),this.control().change()))},T.prototype.transparencyProperty=function(){return this._transparencyProperty},T.prototype.value=function(){return this._control.val()},T.prototype.setValue=function(t){this._control.val(t),this._control.change(),this._control.color&&this._control.color.fromString(t)},inherit(C,n),C.prototype.value=function(){return this._control.slider("option","value")},C.prototype.setValue=function(t){this._control.slider("option","value",t)},inherit(x,y),x.prototype.onIntervalChanged=function(){+this._intervalProperty.value()<1440?this._control.attr({disabled:!1,checked:!!this._property.value()}):this._control.attr({disabled:!0,checked:!1})},x.prototype.value=function(){return this._control.is(":disabled")?this._property.value():y.prototype.value.call(this)},x.prototype.setValue=function(t){if(!this._control.is(":disabled"))return y.prototype.setValue.call(this,t)},x.prototype.destroy=function(){this._intervalProperty.listeners().unsubscribe(this,this.onIntervalChanged),delete this._intervalProperty,y.prototype.destroy.call(this,arguments)},P.prototype._attachToControl=function(t){var e=this;this._wv.subscribe(this._setValueBinded,{callWithLast:!0}),$(this._control).on("change",function(){e.setValueToProperty(e.value())})},P.prototype.control=function(){return this._control},P.prototype.value=function(){var t=$(this._control).val();return this._transformFunction&&(t=this._transformFunction(t)),t},P.prototype.setValue=function(t){$(this._control).val(t)},P.prototype.setValueToProperty=function(t){I.setWatchedValue(this._wv,t,this._undoText)},P.prototype.watchedValue=function(){return this._wv},P.prototype.destroy=function(){this._wv.unsubscribe(this._setValueBinded)},inherit(L,P),L.prototype._attachToControl=function(t){var e=this;this._wv.subscribe(this.setValue.bind(this),{callWithLast:!0}),$(this._control).on("click",function(){e.setValueToProperty(e.value())})},L.prototype.value=function(){var t=$(this._control).attr("checked");return this._not&&(t=!t),this._transformFunction&&(t=this._transformFunction(t)),t},L.prototype.setValue=function(t){this._not&&(t=!t),$(this._control).attr("checked",!!t)},k.prototype.properties=function(){return this._properties},k.prototype.value=function(t){return this._control.slider("values",t)},k.prototype.setValue=function(t,e){this._control.slider("values",e,t.value()),this._inputsText&&$(this._inputsText[e]).val(t.value())},k.prototype.propertyChanged=function(t){this.setValue(t)},k.prototype.setValueToProperty=function(t,e){($(e).hasClass("from")||"from"===e)&&(this._undoModel.beginUndoMacro(this._undoText[0]),this._undoModel.setProperty(this._propFrom,t[0],this._undoText[0]),this._propFrom.setValue(t[0],0),this._undoModel.endUndoMacro()),($(e).hasClass("to")||"to"===e)&&(this._undoModel.beginUndoMacro(this._undoText[1]),this._undoModel.setProperty(this._propTo,t[1],this._undoText[1]),this._propTo.setValue(t[1],1),this._undoModel.endUndoMacro())},k.prototype.destroy=function(){this._propFrom&&this._propTo&&(this._propFrom.listeners().unsubscribe(this,n.prototype.propertyChanged),this._propTo.listeners().unsubscribe(this,n.prototype.propertyChanged))},inherit(E,n),E.prototype.value=function(){var t=[];return this._control.each(function(){var e=$(this);e.is(":checked")&&t.push(e.attr("value"))}),t.join(this._separator)},E.prototype.setValue=function(t){var e=t.split(this._separator).filter(Boolean);this._control.each(function(){var t=$(this),i=e.indexOf(t.attr("value"))!==-1;t.attr("checked",i),t.parents("label").toggleClass("active",i)})},e.PropertyPage=o,e.UppercaseTransformer=s,e.GreateTransformer=r,e.LessTransformer=a,e.ToIntTransformer=l,e.ToFloatTransformer=h,e.ToAsciiTransformer=c,e.ReplaceEmptyTransformer=d,e.SimpleStringBinder=p,e.FloatBinder=u,e.SessionBinder=_,e.BarTimeBinder=f,e.SymbolBinder=g,e.SimpleComboBinder=m,e.StaticContentBinder=v,e.BooleanBinder=y,e.DisabledBinder=b,e.ActionBinder=S,e.ColorBinding=T,e.SliderBinder=C,e.CheckboxWVBinding=L,e.RangeBinder=k}).call(e,i(69))},function(t,e,i){(function(e){"use strict";function o(t,i,o){var n={saveAsText:$.t("Save As..."),applyDefaultText:$.t("Apply Defaults")};this._toolName=t,this._applyTemplate=i,this._options=$.extend(n,o||{}),this._list=[],e.enabled("charting_library_base")||(this.templatesDeferred=this.loadData())}var n=i(55),s=n.showChartNameDialog,r=n.bindPopupMenu;o._cache={},o.prototype.getData=function(){return this._list},o.prototype.loadData=function(){var t=this;return this._toolName in o._cache?(this._list=o._cache[this._toolName],$.Deferred().resolve()):$.get("/drawing-templates/"+this._toolName+"/",function(e){t._list=e,o._cache[t._toolName]=e}).error(function(){TradingView.logWarn("Failed to load drawing template: "+t._toolName)})},o.prototype.templatesLoaded=function(){return this.templatesDeferred},o.prototype.invalidateToolCache=function(){delete o._cache[this._toolName]},o.prototype.createButton=function(t){var e,i=this;return t=$.extend({},t,i._options),e=$("<a></span></a>").addClass(t.buttonClass?t.buttonClass:"_tv-button").html(t.buttonInner?t.buttonInner:$.t("Template")+'<span class="icon-dropdown">'),r(e,null,{event:"button-popup"}),e.bind("click",function(e){var o,n,r;e.stopPropagation(),$(this).is("active")||(o=[],"function"==typeof t.getDataForSaveAs&&(n=function(){runOrSignIn(function(){var e=function(e){var o=JSON.stringify(t.getDataForSaveAs());i.saveTemplate(e,o)},o=$.t("Save template as..."),n=$.t("Template name"),r=$.t("Please enter template name"),a=64;s(e,{title:o,label:n,error:r},a)},{source:"Save line tool template",sourceMeta:"Chart"})},o.push({title:t.saveAsText,action:n,addClass:"special"})),"function"==typeof t.defaultsCallback&&o.push({title:t.applyDefaultText,action:t.defaultsCallback,addClass:"special"}),r=[],$.each(i._list,function(e,o){r.push({title:o,action:function(){i.loadTemplate.call(i,o,t.loadTemplateCallback)},deleteAction:function(){runOrSignIn(function(){var t=$.t("Do you realy want to delete {0} template?").format(o?'"'+o+'"':"");TVDialogs.showConfirm($.t("Template"),t,function(){i.removeTemplate.call(i,o)})},{source:"Delete line tool template"})}})}),r.length&&(r.sort(function(t,e){return t=t.title.toUpperCase(),e=e.title.toUpperCase(),t===e?0:t>e?1:-1}),o.push({separator:!0}),o=o.concat(r)),$(this).trigger("button-popup",[o]))}),e},o.prototype.loadTemplate=function(t,e){var i=this;return $.get("/drawing-template/"+this._toolName+"/?templateName="+encodeURIComponent(t),function(t){i._applyTemplate(JSON.parse(t.content)),e&&e()}).error(function(t){TradingView.logWarn(t.responseText)})},o.prototype.removeTemplate=function(t){if(t){var e=this;$.post("/remove-drawing-template/",{name:t,tool:e._toolName}).error(function(t){TradingView.logWarn(t.responseText)}),e.invalidateToolCache(),e._list=$.grep(e._list,function(e){return e!==t})}},o.prototype.saveTemplate=function(t,e){var i,o,n,s,r,a=this;t&&e&&(t=TradingView.clean(t),i=$.inArray(t,a._list)!==-1,o=function(){var o={name:t,tool:a._toolName,content:e},n=function(){i||a._list.push(t)};$.post("/save-drawing-template/",o,n).error(function(t){TradingView.logWarn(t.responseText)}),a.invalidateToolCache()},i?(n=$.t("Confirm replacing"),s=o,r=$.t('Do you realy want to replace "{0}"?').format(t),TVDialogs.showConfirm(n,r,s)):o())},o.prototype.deleteAction=function(t){var e=t,i=this;runOrSignIn(function(){var t=$.t("Do you realy want to delete {0} template?").format(e?'"'+e+'"':"");TVDialogs.showConfirm($.t("Template"),t,function(){i.removeTemplate.call(i,e)})},{source:"Delete line tool template"})},o.prototype.showSaveDialog=function(t){var e=this;runOrSignIn(function(){var i=function(i){var o=JSON.stringify(t.template());e.saveTemplate(i,o)},o=$.t("Save template as..."),n=$.t("Template name"),r=$.t("Please enter template name"),a=64;s(i,{title:o,label:n,error:r},a)},{source:"Save line tool template"})},t.exports=o}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i)}var n=i(260);inherit(o,n),t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.FloatBinder,a=s.SimpleComboBinder,l=s.BooleanBinder,h=s.ColorBinding,c=s.SliderBinder,d=i(55),p=d.addColorPicker,u=d.createLineStyleEditor,_=d.createLineWidthEditor,f=d.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e,i){var o,n,s,d,f,g,m,v,y,b,w=$("<tr>");w.appendTo(this._table),o=$("<td>"),o.appendTo(w),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),t?(s=$("<td>"),s.appendTo(w),d=$("<input type='text'>"),d.appendTo(s),d.css("width","70px"),this.bindControl(new r(d,e.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))):$("<td>"+$.t("Trend Line")+"</td>").appendTo(w),f=$("<td class='colorpicker-cell'>"),f.appendTo(w),g=p(f),m=$("<td>"),m.appendTo(w),v=_(),v.appendTo(m),t||(y=$("<td>"),y.appendTo(w),b=u(),b.render().appendTo(y),this.bindControl(new a(b,e.linestyle,parseInt,!0,this.model(),"Change Fib Speed Resistance Arcs Style"))),this.bindControl(new l(n,e.visible,!0,this.model(),"Change Fib Speed Resistance Arcs Visibility")),this.bindControl(new h(g,e.color,!0,this.model(),"Change Fib Speed Resistance Arcs Line Color",0)),this.bindControl(new c(v,e.linewidth,!0,this.model(),"Change Fib Speed Resistance Arcs Width"))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,r;for(this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().trendline,!1),t=1;t<=11;t++)e="level"+t,this.addLevelEditor("Level "+t,this._linetool.properties()[e],!1);this.addOneColorPropertyWidget(this._table),i=$("<input type='checkbox' class='visibility-switch'>"),o=this.addLabeledRow(this._table,$.t("Levels")),$("<td>").append(i).prependTo(o),this.bindControl(new l(i,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Speed Resistance Arcs Levels Visibility")),n=$("<input type='checkbox' class='visibility-switch'>"),o=this.addLabeledRow(this._table,$.t("Full Circles")),$("<td>").append(n).prependTo(o),this.bindControl(new l(n,this._linetool.properties().fullCircles,!0,this.model(),"Change Fib Speed Resistance Arcs Full Cirlces Mode")),o=$("<tr>"),o.appendTo(this._table),s=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(s).appendTo(o),$("<td>"+$.t("Background")+"</td>").appendTo(o),r=f(),$('<td colspan="3">').append(r).appendTo(o),this.bindControl(new l(s,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Arcs Background Visibility")),this.bindControl(new c(r,this._linetool.properties().transparency,!0,this.model(),"Change Fib Arcs Background Transparency")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SliderBinder,a=s.ColorBinding,l=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=this.createColorPicker(),e=this.createColorPicker(),i=this.addLabeledRow(this._table,"Background"),$("<td>").append(t).appendTo(i),$("<td>").append(e).appendTo(i),o=l(),n=this.createColorPicker(),i=this.addLabeledRow(this._table,"Border"),$("<td>").append(n).appendTo(i),$("<td>").appendTo(i),$("<td>").append(o).appendTo(i),this.bindControl(new a(n,this._linetool.properties().trendline.color,!0,this.model(),"Change Projection Line Color")),this.bindControl(new a(t,this._linetool.properties().color1,!0,this.model(),"Change Projection Background Color",this._linetool.properties().transparency)),this.bindControl(new a(e,this._linetool.properties().color2,!0,this.model(),"Change Projection Background Color",this._linetool.properties().transparency)),this.bindControl(new r(o,this._linetool.properties().linewidth,!0,this.model(),"Change Projection Border Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e,i),this.prepareLayout()}var n=i(139).LineToolElliott,s=i(261),r=i(262),a=r.SimpleComboBinder,l=r.ColorBinding,h=r.SliderBinder,c=r.BooleanBinder,d=i(55).createLineWidthEditor;inherit(o,s),o.prototype.prepareLayout=function(){var t,e,i,o,s,r;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=n.degrees,e=this.createKeyCombo(t),e.width(300),i=this.createColorPicker(),o=$('<input type="checkbox" class="visibility-switch">'),s=this.addLabeledRow(this._table,"Degree"),$("<td>").prependTo(s),$("<td>").append(e).appendTo(s),s=this.addLabeledRow(this._table,"Line Width"),r=d(),$("<td>").prependTo(s),$("<td>").append(r).appendTo(s),s=this.addLabeledRow(this._table,"Color"),$("<td>").prependTo(s),$("<td>").append(i).appendTo(s),s=this.addLabeledRow(this._table,"Show Wave",o),$("<td>").append(o).prependTo(s),this.bindControl(new l(i,this._linetool.properties().color,!0,this.model(),"Change Elliott Label Color")),this.bindControl(new a(e,this._linetool.properties().degree,parseInt,!0,this.model(),"Change Elliott Wave Size")),this.bindControl(new c(o,this._linetool.properties().showWave,!0,this.model(),"Change Elliott Labels Background")),this.bindControl(new h(r,this._linetool.properties().linewidth,parseInt,this.model(),"Change Elliott Wave Line Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){r.call(this,t,e),this._study=i,this.prepareLayout()}var n=i(269),s=i(262),r=s.PropertyPage,a=s.BooleanBinder,l=s.SimpleComboBinder,h=i(270).StudyStylesPropertyPage;inherit(o,r),inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n=$('<table class="property-page" cellspacing="0" cellpadding="2">'),s=$('<table class="property-page" cellspacing="0" cellpadding="2">'),r=$('<table class="property-page" cellspacing="0" cellpadding="2">'),c=$('<table class="property-page" cellspacing="0" cellpadding="2">'),d=$('<table class="property-page" cellspacing="0" cellpadding="2">'),p=this._study.properties();this._prepareSeriesStyleLayout(n,s,r,p),this._table=n.add(s).add(r).add(c).add(d),t=$('<input type="checkbox">'),e=this.addLabeledRow(c,"Price Line",t),$("<td>").append(t).prependTo(e),this.bindControl(new a(t,p.showPriceLine,!0,this.model(),"Change Price Price Line")),i=this.createSeriesMinTickEditor(),o=$("<tr>"),o.appendTo(d),$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(o),$("<td>").append(i).appendTo(o),this.bindControl(new l(i,p.minTick,null,!0,this.model(),"Change MinTick")),h.prototype._putStudyDefaultStyles.call(this,d)},o.prototype.loadData=function(){this.superclass.prototype.loadData.call(this),this.switchStyle()},o.prototype.switchStyle=function(){switch($(this._barsTbody).add(this._barsColorerTbody).add(this._candlesTbody).add(this._candlesColorerTbody).add(this._hollowCandlesTbody).add(this._lineTbody).add(this._areaTbody).css("display","none"),this._study.properties().style.value()){case TradingView.Series.STYLE_BARS:this._barsTbody.css("display","table-row-group"),this._barsColorerTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_CANDLES:this._candlesTbody.css("display","table-row-group"),this._candlesColorerTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_HOLLOW_CANDLES:this._hollowCandlesTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_LINE:this._lineTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_AREA:this._areaTbody.css("display","table-row-group")}},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){(function(e){"use strict";function o(){}var n=i(262),s=n.PropertyPage,r=n.GreateTransformer,a=n.LessTransformer,l=n.ToIntTransformer,h=n.ToFloatTransformer,c=n.SimpleStringBinder,d=n.SimpleComboBinder,p=n.ColorBinding,u=n.BooleanBinder,_=n.SliderBinder,f=i(55),g=f.createLineWidthEditor,m=f.createPriceSourceEditor,v=i(82).NumericFormatter;inherit(o,s),o.prototype.getInputTitle=function(t,e){return e.inputInfo?e.inputInfo[t].name.value():t.toLowerCase().replace(/\b\w/g,function(t){return t.toUpperCase()})},o.prototype.prepareLayoutImpl=function(t,e,i,o){function n(e){u.refreshStateControls(p,t.inputs,i.inputs)}function s(t){return(new v).format(t)}var p,u,_,f,g,m,y,b,w,S,T,C,x,P,L,k,E;for(o=o||{},p={},u=this,_=0;_<t.inputs.length;_++){if(f=t.inputs[_],g=f.id,m=this.getInputTitle(g,i),y=$("<tr/>"),y.appendTo(e),b=$("<td/>"),b.appendTo(y),b.addClass("propertypage-name-label"),b.text($.t(m)),w=$("<td"+(o.valueColspan?' colspan = "'+o.valueColspan+'"':"")+"/>"),w.appendTo(y),S=null,f.options)for(S=$("<select/>"),T=0;T<f.options.length;T++)C=f.options[T],$("<option value='"+C+"'>"+$.t(C)+"</option>").appendTo(S);else S=$("<input/>"),"bool"===f.type?S.attr("type","checkbox"):S.attr("type","text");S.appendTo(w),S.css("width","100px"),x="Change "+m,f.options?this.bindControl(new d(S,i.inputs[g],null,!0,this.model(),x)):"integer"===f.type?(P=[l(f.defval)],f.min&&P.push(r(f.min)),f.max&&P.push(a(f.max)),this.bindControl(new c(S,i.inputs[g],P,!1,this.model(),x)),S.addClass("ticker")):"float"===f.type?(P=[h(f.defval)],f.min&&((("BarSetRenko@tv-prostudies"===t.id||"BarSetPnF@tv-prostudies"===t.id)&&"boxSize"===f.id||"BarSetKagi@tv-prostudies"===t.id&&"reversalAmount"===f.id)&&(k=this._model.model().mainSeries().symbolInfo(),L=k.minmov/k.pricescale),P.push(r(L||f.min))),f.max&&P.push(a(f.max)),E=new c(S,i.inputs[g],P,!1,this.model(),x),E.addFormatter(s),this.bindControl(E),S.addClass("ticker")):"text"===f.type&&this.bindControl(new c(S,this._property.inputs[g],null,!1,this.model(),x)),S.change(n),p[f.id]=y}this.refreshStateControls(p,t.inputs,i.inputs)},o.prototype.getMetaInfo=function(t){var e,i=this._model.m_model._studiesMetaData;for(e=0;e<i.length;e++)if(i[e].id===t)return i[e];return null},o.prototype._prepareSeriesStyleLayout=function(t,o,n,s){var r,a,l,h,c,f,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V,M,D,O,B,R,N,F,z,W,H,U,q,j,Y,G,K,X,Z,J,Q,tt,et,it,ot,nt,st,rt,at,lt,ht,ct,dt,pt,ut,_t,ft,gt,mt,vt,yt,bt,wt,St,Tt,Ct,xt,Pt,Lt=i(268),kt=$("<tbody>").appendTo(t),Et=this._candlesColorerTbody=$("<tbody>").appendTo(o),It=this._barsColorerTbody=$("<tbody>").appendTo(o),At=this._haColorerTbody=$("<tbody>").appendTo(o),Vt=this._candlesTbody=$("<tbody>").appendTo(n),$t=this._hollowCandlesTbody=$("<tbody>").appendTo(n),Mt=this._haTbody=$("<tbody>").appendTo(n),Dt=this._barsTbody=$("<tbody>").appendTo(n),Ot=this._lineTbody=$("<tbody>").appendTo(n),Bt=this._areaTbody=$("<tbody>").appendTo(n),Rt=this._renkoTbody=$("<tbody>").appendTo(n),Nt=this._pbTbody=$("<tbody>").appendTo(n),Ft=this._kagiTbody=$("<tbody>").appendTo(n),zt=this._pnfTbody=$("<tbody>").appendTo(n),Wt=this.addLabeledRow(kt,"Style"),Ht=$(document.createElement("td")).appendTo(Wt);Ht.addClass("property-wide-select"),r=$(document.createElement("select")),$("<option value="+TradingView.Series.STYLE_BARS+">"+$.t("Bars")+"</option>").appendTo(r),$("<option value="+TradingView.Series.STYLE_CANDLES+">"+$.t("Candles")+"</option>").appendTo(r),$("<option value="+TradingView.Series.STYLE_HOLLOW_CANDLES+">"+$.t("Hollow Candles")+"</option>").appendTo(r),this instanceof Lt||$("<option value="+TradingView.Series.STYLE_HEIKEN_ASHI+">"+$.t("Heikin Ashi")+"</option>").appendTo(r),$("<option value="+TradingView.Series.STYLE_LINE+">"+$.t("Line")+"</option>").appendTo(r),$("<option value="+TradingView.Series.STYLE_AREA+">"+$.t("Area")+"</option>").appendTo(r),r.css("width","100px").appendTo(Ht),this.switchStyle(),a=function(t){this._undoModel.setChartStyleProperty(this._property,t,this._undoText)},this.bindControl(new d(r,s.style,parseInt,!0,this.model(),"Change Series Style",a)),s.style.listeners().subscribe(this,this.switchStyle),l=this.createColorPicker(),h=this.createColorPicker(),c=this.createColorPicker(),f=this.createColorPicker(),v=this.createColorPicker(),y=this.createColorPicker(),b=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(v).add(y)),w=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(c)),S=$("<input type='checkbox'/>"),T=this.addLabeledRow(Et,"Color bars based on previous close",S),$("<td>").append(S).prependTo(T),T=this.addLabeledRow(Vt,"Candles"),$("<td>").prependTo(T),$("<td>").append(l).appendTo(T),$("<td>").append(h).appendTo(T),T=this.addLabeledRow(Vt,"Borders",b),$("<td>").append(b).prependTo(T),$("<td>").append(v).appendTo(T),$("<td>").append(y).appendTo(T),T=this.addLabeledRow(Vt,"Wick",w),$("<td>").append(w).prependTo(T),$("<td>").append(c).appendTo(T),$("<td>").append(f).appendTo(T),this.bindControl(new p(l,s.candleStyle.upColor,!0,this.model(),"Change Candle Up Color")),this.bindControl(new p(h,s.candleStyle.downColor,!0,this.model(),"Change Candle Down Color")),this.bindControl(new u(w,s.candleStyle.drawWick,!0,this.model(),"Change Candle Wick Visibility")),this.bindControl(new p(c,s.candleStyle.wickUpColor,!0,this.model(),"Change Candle Wick Up Color")),this.bindControl(new p(f,s.candleStyle.wickDownColor,!0,this.model(),"Change Candle Wick Down Color")),this.bindControl(new u(b,s.candleStyle.drawBorder,!0,this.model(),"Change Candle Border Visibility")),this.bindControl(new p(v,s.candleStyle.borderUpColor,!0,this.model(),"Change Candle Up Border Color")),this.bindControl(new p(y,s.candleStyle.borderDownColor,!0,this.model(),"Change Candle Down Border Color")),this.bindControl(new u(S,s.candleStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close")),C=this.createColorPicker(),x=this.createColorPicker(),P=this.createColorPicker(),L=this.createColorPicker(),k=this.createColorPicker(),E=this.createColorPicker(),I=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(k).add(E)),A=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(P)),T=this.addLabeledRow($t,"Candles"),$("<td>").prependTo(T),$("<td>").append(C).appendTo(T),$("<td>").append(x).appendTo(T),T=this.addLabeledRow($t,"Borders",I),$("<td>").append(I).prependTo(T),$("<td>").append(k).appendTo(T),$("<td>").append(E).appendTo(T),T=this.addLabeledRow($t,"Wick",A),$("<td>").append(A).prependTo(T),$("<td>").append(P).appendTo(T),$("<td>").append(L).appendTo(T),this.bindControl(new p(C,s.hollowCandleStyle.upColor,!0,this.model(),"Change Hollow Candle Up Color")),this.bindControl(new p(x,s.hollowCandleStyle.downColor,!0,this.model(),"Change Hollow Candle Down Color")),this.bindControl(new u(A,s.hollowCandleStyle.drawWick,!0,this.model(),"Change Hollow Candle Wick Visibility")),this.bindControl(new p(P,s.hollowCandleStyle.wickUpColor,!0,this.model(),"Change Hollow Candle Wick Up Color")),this.bindControl(new p(L,s.hollowCandleStyle.wickDownColor,!0,this.model(),"Change Hollow Candle Down Wick Color")),
this.bindControl(new u(I,s.hollowCandleStyle.drawBorder,!0,this.model(),"Change Hollow Candle Border Visibility")),this.bindControl(new p(k,s.hollowCandleStyle.borderUpColor,!0,this.model(),"Change Hollow Candle Up Border Color")),this.bindControl(new p(E,s.hollowCandleStyle.borderDownColor,!0,this.model(),"Change Hollow Candle Down Border Color")),V=$("<input type='checkbox'/>"),T=this.addLabeledRow(It,"Color bars based on previous close",V),$("<td>").append(V).prependTo(T),M=$("<input type='checkbox'/>"),T=this.addLabeledRow(It,"HLC Bars",M),$("<td>").append(M).prependTo(T),D=this.addColorPickerRow(Dt,"Up Color"),O=this.addColorPickerRow(Dt,"Down Color"),this.bindControl(new p(D,s.barStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new p(O,s.barStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new u(V,s.barStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close")),this.bindControl(new u(M,s.barStyle.dontDrawOpen,!0,this.model(),"Change HLC Bars")),B=m(),T=this.addLabeledRow(Ot,"Price Source"),$('<td colspan="3">').append(B).appendTo(T),R=this.addLabeledRow(Ot,"Type"),N=$('<td colspan="3">').appendTo(R),N.addClass("property-wide-select"),F=$(document.createElement("select")),$("<option value="+TradingView.Series.STYLE_LINE_TYPE_SIMPLE+">"+$.t("Simple")+"</option>").appendTo(F),$("<option value="+TradingView.Series.STYLE_LINE_TYPE_MARKERS+">"+$.t("With Markers")+"</option>").appendTo(F),$("<option value="+TradingView.Series.STYLE_LINE_TYPE_STEP+">"+$.t("Step")+"</option>").appendTo(F),F.appendTo(N),T=this.addLabeledRow(Ot,"Line"),z=this.createColorPicker(),W=g(),$("<td>").append(z).appendTo(T),$("<td>").append(W).appendTo(T),this.bindControl(new d(B,s.lineStyle.priceSource,null,!0,this.model(),"Change Price Source")),this.bindControl(new d(F,s.lineStyle.styleType,parseInt,!0,this.model(),"Change Line Type")),this.bindControl(new p(z,s.lineStyle.color,!0,this.model(),"Change Line Color")),this.bindControl(new _(W,s.lineStyle.linewidth,!0,this.model(),"Change Line Width")),s.haStyle&&(H=this.createColorPicker(),U=this.createColorPicker(),q=this.createColorPicker(),j=this.createColorPicker(),Y=this.createColorPicker(),G=this.createColorPicker(),K=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(Y).add(G)),X=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(q)),Z=$("<input type='checkbox'/>"),T=this.addLabeledRow(At,$.t("Color bars based on previous close"),Z),$("<td>").append(Z).prependTo(T),T=this.addLabeledRow(Mt,$.t("Candles")),$("<td>").prependTo(T),$("<td>").append(H).appendTo(T),$("<td>").append(U).appendTo(T),T=this.addLabeledRow(Mt,$.t("Borders"),K),$("<td>").append(K).prependTo(T),$("<td>").append(Y).appendTo(T),$("<td>").append(G).appendTo(T),T=this.addLabeledRow(Mt,$.t("Wick"),X),$("<td>").append(X).prependTo(T),$("<td>").append(q).appendTo(T),$("<td>").append(j).appendTo(T),this.bindControl(new p(H,s.haStyle.upColor,!0,this.model(),"Change Heikin Ashi Up Color")),this.bindControl(new p(U,s.haStyle.downColor,!0,this.model(),"Change Heikin Ashi Down Color")),this.bindControl(new u(X,s.haStyle.drawWick,!0,this.model(),"Change Heikin Ashi Wick Visibility")),this.bindControl(new p(q,s.haStyle.wickUpColor,!0,this.model(),"Change Heikin Ashi Wick Up Color")),this.bindControl(new p(j,s.haStyle.wickDownColor,!0,this.model(),"Change Heikin Ashi Wick Down Color")),this.bindControl(new u(K,s.haStyle.drawBorder,!0,this.model(),"Change Heikin Ashi Border Visibility")),this.bindControl(new p(Y,s.haStyle.borderUpColor,!0,this.model(),"Change Heikin Ashi Up Border Color")),this.bindControl(new p(G,s.haStyle.borderDownColor,!0,this.model(),"Change Heikin Ashi Down Border Color")),this.bindControl(new u(Z,s.haStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close"))),this instanceof Lt||e.enabled("charting_library_base")||($("<option value="+TradingView.Series.STYLE_RENKO+">"+$.t("Renko")+"</option>").appendTo(r),$("<option value="+TradingView.Series.STYLE_PB+">"+$.t("Line Break")+"</option>").appendTo(r),$("<option value="+TradingView.Series.STYLE_KAGI+">"+$.t("Kagi")+"</option>").appendTo(r),$("<option value="+TradingView.Series.STYLE_PNF+">"+$.t("Point & Figure")+"</option>").appendTo(r),J=this.createColorPicker(),Q=this.createColorPicker(),T=this.addLabeledRow(Rt,"Up bars"),$('<td class="some-colorpicker">').append(J).append(Q).appendTo(T),tt=this.createColorPicker(),et=this.createColorPicker(),T=this.addLabeledRow(Rt,"Down bars"),$('<td class="some-colorpicker">').append(tt).append(et).appendTo(T),it=this.createColorPicker(),ot=this.createColorPicker(),T=this.addLabeledRow(Rt,"Projection up bars"),$('<td class="some-colorpicker">').append(it).append(ot).appendTo(T),nt=this.createColorPicker(),st=this.createColorPicker(),T=this.addLabeledRow(Rt,"Projection down bars"),$('<td class="some-colorpicker">').append(nt).append(st).appendTo(T),this.prepareLayoutImpl(this.getMetaInfo("BarSetRenko@tv-prostudies"),Rt,s.renkoStyle),this.bindControl(new p(J,s.renkoStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new p(tt,s.renkoStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new p(it,s.renkoStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new p(nt,s.renkoStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")),this.bindControl(new p(Q,s.renkoStyle.borderUpColor,!0,this.model(),"Change Border Bar Up Color")),this.bindControl(new p(et,s.renkoStyle.borderDownColor,!0,this.model(),"Change Border Bar Down Color")),this.bindControl(new p(ot,s.renkoStyle.borderUpColorProjection,!0,this.model(),"Change Projection Border Bar Up Color")),this.bindControl(new p(st,s.renkoStyle.borderDownColorProjection,!0,this.model(),"Change Projection Border Bar Down Color")),rt=this.createColorPicker(),at=this.createColorPicker(),T=this.addLabeledRow(Nt,"Up bars"),$('<td class="some-colorpicker">').append(rt).append(at).appendTo(T),lt=this.createColorPicker(),ht=this.createColorPicker(),T=this.addLabeledRow(Nt,"Down bars"),$('<td class="some-colorpicker">').append(lt).append(ht).appendTo(T),ct=this.createColorPicker(),dt=this.createColorPicker(),T=this.addLabeledRow(Nt,"Projection up bars"),$('<td class="some-colorpicker">').append(ct).append(dt).appendTo(T),pt=this.createColorPicker(),ut=this.createColorPicker(),T=this.addLabeledRow(Nt,"Projection down bars"),$('<td class="some-colorpicker">').append(pt).append(ut).appendTo(T),this.prepareLayoutImpl(this.getMetaInfo("BarSetPriceBreak@tv-prostudies"),Nt,s.pbStyle,{valueColspan:2}),this.bindControl(new p(rt,s.pbStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new p(lt,s.pbStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new p(ct,s.pbStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new p(pt,s.pbStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")),this.bindControl(new p(at,s.pbStyle.borderUpColor,!0,this.model(),"Change Border Bar Up Color")),this.bindControl(new p(ht,s.pbStyle.borderDownColor,!0,this.model(),"Change Border Bar Down Color")),this.bindControl(new p(dt,s.pbStyle.borderUpColorProjection,!0,this.model(),"Change Projection Border Bar Up Color")),this.bindControl(new p(ut,s.pbStyle.borderDownColorProjection,!0,this.model(),"Change Projection Border Bar Down Color")),_t=this.addColorPickerRow(Ft,"Up bars"),ft=this.addColorPickerRow(Ft,"Down bars"),gt=this.addColorPickerRow(Ft,"Projection up bars"),mt=this.addColorPickerRow(Ft,"Projection down bars"),this.prepareLayoutImpl(this.getMetaInfo("BarSetKagi@tv-prostudies"),Ft,s.kagiStyle),this.bindControl(new p(_t,s.kagiStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new p(ft,s.kagiStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new p(gt,s.kagiStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new p(mt,s.kagiStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")),vt=this.addColorPickerRow(zt,"Up bars"),yt=this.addColorPickerRow(zt,"Down bars"),bt=this.addColorPickerRow(zt,"Projection up bars"),wt=this.addColorPickerRow(zt,"Projection down bars"),this.prepareLayoutImpl(this.getMetaInfo("BarSetPnF@tv-prostudies"),zt,s.pnfStyle),this.bindControl(new p(vt,s.pnfStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new p(yt,s.pnfStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new p(bt,s.pnfStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new p(wt,s.pnfStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color"))),St=m(),T=this.addLabeledRow(Bt,"Price Source"),$('<td colspan="3">').appendTo(T).append(St),Tt=this.createColorPicker(),Ct=g(),T=this.addLabeledRow(Bt,"Line"),$("<td>").appendTo(T).append(Tt),$('<td colspan="2">').appendTo(T).append(Ct),xt=this.createColorPicker(),Pt=this.createColorPicker(),T=this.addLabeledRow(Bt,"Fill"),$("<td>").appendTo(T).append(xt),$("<td>").appendTo(T).append(Pt),this.bindControl(new d(St,s.areaStyle.priceSource,null,!0,this.model(),"Change Price Source")),this.bindControl(new p(Tt,s.areaStyle.linecolor,!0,this.model(),"Change Line Color")),this.bindControl(new _(Ct,s.areaStyle.linewidth,!0,this.model(),"Change Line Width")),this.bindControl(new p(xt,s.areaStyle.color1,!0,this.model(),"Change Line Color",s.areaStyle.transparency)),this.bindControl(new p(Pt,s.areaStyle.color2,!0,this.model(),"Change Line Color",s.areaStyle.transparency))},t.exports=o}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e,i,o){a.call(this,t,e),this._study=i,this._showOnlyConfirmInputs=o,this.prepareLayout()}function n(t,e,i){a.call(this,t,e),this._study=i,this.prepareLayout()}function s(t,e,i){a.call(this,t,e),this._study=i,this._property=t,this.prepareLayout()}var r=i(262),a=r.PropertyPage,l=r.UppercaseTransformer,h=r.GreateTransformer,c=r.LessTransformer,d=r.ToIntTransformer,p=r.ToFloatTransformer,u=r.SimpleComboBinder,_=r.BooleanBinder,f=r.SymbolBinder,g=r.DisabledBinder,m=r.BarTimeBinder,v=r.ColorBinding,y=r.SliderBinder,b=r.SessionBinder,w=r.SimpleStringBinder,S=i(39),T=i(55),C=T.addColorPicker,x=T.createLineStyleEditor,P=T.createShapeLocationEditor,L=T.createShapeStyleEditor,k=T.createLineWidthEditor,E=T.createVisibilityEditor,I=T.createTextEditor,A=T.createHHistDirectionEditor,V=T.createPlotEditor,M=i(82).NumericFormatter,D=i(114),O=i(59).StudyConsts;inherit(o,a),o.prototype._addSessionEditor=function(t,e,i,o){var n,s,r,a,l,h;return"session"!==i.type?void TradingView.logError("Session editor adding FAILED: wrong input type."):(n=function(t,e){var i,o=$("<td/>");o.appendTo(t),o.css("padding-left","0px"),o.css("padding-right","0px"),i=$("<input>"),i.attr("type","text"),i.addClass("ticker"),i.css("width","40px"),i.attr("id",e),i.appendTo(o)},s=function(t,e,i){var o,n=$("<td/>");n.css("padding-left",i),n.css("padding-right",i),n.appendTo(t),o=$("<div/>"),o.appendTo(n),o.append(e),o.css("font-size","150%")},r=$("<table/>"),r.appendTo(t),a=$("<tr/>"),a.appendTo(r),l=["start_hours","start_minutes","end_hours","end_minutes"],n.call(this,a,l[0]),s.call(this,a,":",0),n.call(this,a,l[1]),s.call(this,a,"-",4),n.call(this,a,l[2]),s.call(this,a,":",0),n.call(this,a,l[3]),h=!1,void this.bindControl(new b(a,l,e,h,this.model(),o)))},o.prototype.prepareLayoutImpl=function(t,e){function i(t){return(new M).format(t)}var o,n,s,r,a,g,v,y,b,T,C,x,P,L;for(o=0;o<t.inputs.length;o++)if(n=t.inputs[o],s=n.id,"first_visible_bar_time"!==s&&"last_visible_bar_time"!==s&&"time"!==n.type&&!n.isHidden&&(!this._showOnlyConfirmInputs||n.confirm)&&void 0===n.groupId){if(r=n.name||s.toLowerCase().replace(/\b\w/g,function(t){return t.toUpperCase()}),a="Change "+r,g=$("<tr/>"),g.appendTo(e),v=$("<td/>"),v.appendTo(g),v.addClass($.t("propertypage-name-label",{context:"css_class"})),v.text($.t(r,{context:"input"})),y=$("<td/>"),y.appendTo(g),b=null,"resolution"===n.type)b=$('<select><option value="1">1</option><option value="3">3</option><option value="5">5</option><option value="15">15</option><option value="30">30</option><option value="45">45</option><option value="60">1'+$.t("h")+'</option><option value="120">2'+$.t("h")+'</option><option value="180">3'+$.t("h")+'</option><option value="D">1'+$.t("d")+'</option><option value="W">1'+$.t("w")+"</option></select>");else if("symbol"===n.type)b=$('<input class="symbol-edit single">'),S.bindToInput(b);else if("session"===n.type)this._addSessionEditor(y,this._property.inputs[s],n,a);else if(n.options)for(b=$("<select/>"),T=0;T<n.options.length;T++)C=n.options[T],$("<option value='"+C+"'>"+C+"</option>").appendTo(b);else b=$("<input/>"),"bool"===n.type?b.attr("type","checkbox"):b.attr("type","text");b&&(b.appendTo(y),b.is(":checkbox")||b.css("width","100px")),n.options?this.bindControl(new u(b,this._property.inputs[s],null,!0,this.model(),a)):"bar_time"===n.type?(x=10,this.bindControl(new m(b,this._property.inputs[s],!0,this.model(),a,this.model().mainSeries(),x)),b.addClass("ticker")):"integer"===n.type?(P=[d(n.defval)],(0===n.min||n.min)&&P.push(h(n.min)),(0===n.max||n.max)&&P.push(c(n.max)),this.bindControl(new w(b,this._property.inputs[s],P,!1,this.model(),a)),b.addClass("ticker"),isFinite(n.step)&&n.step>0&&b.attr("data-step",n.step)):"float"===n.type?(P=[p(n.defval)],(0===n.min||n.min)&&P.push(h(n.min)),(0===n.max||n.max)&&P.push(c(n.max)),L=new w(b,this._property.inputs[s],P,!1,this.model(),a),L.addFormatter(i),this.bindControl(L),b.addClass("ticker"),isFinite(n.step)&&n.step>0&&b.attr("data-step",n.step)):"text"===n.type?this.bindControl(new w(b,this._property.inputs[s],null,!1,this.model(),a)):"bool"===n.type?this.bindControl(new _(b,this._property.inputs[s],!0,this.model(),a)):"resolution"===n.type?this.bindControl(new u(b,this._property.inputs[s],l,!0,this.model(),"Change Interval")):"symbol"===n.type&&this.bindControl(new f(b,this._property.inputs[s],!0,this.model(),"Change Symbol"))}this._property.offset&&(r=this._property.offset.title?this._property.offset.title.value():$.t("Offset"),b=this.addOffsetEditorRow(e,r),P=[d(this._property.offset.val)],P.push(h(this._property.offset.min)),P.push(c(this._property.offset.max)),this.bindControl(new w(b,this._property.offset.val,P,!1,this.model(),"Undo "+r))),this._property.offsets&&$.each(t.plots,function(t,i){var o,n,s,r;this._property.offsets[i.id]&&(o=this._property.offsets[i.id],void 0!==o.isHidden&&o.isHidden.value()||(n=o.title.value(),s=this.addOffsetEditorRow(e,n),r=[d(o.val)],r.push(h(o.min)),r.push(c(o.max)),this.bindControl(new w(s,o.val,r,!1,this.model(),"Undo "+n))))}.bind(this))},o.prototype.prepareLayout=function(){this._table=$("<table/>"),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var t=this._study.metaInfo();this.prepareLayoutImpl(t,this._table),this.loadData()},o.prototype.widget=function(){return this._table},inherit(n,a),n.prototype.prepareLayout=function(){function t(t){return(new M).format(t)}var e,i,o,s,r,a,l,h,c,d,f,g,m,b,S,T,P,L,E,I,A,V,O,B,R,N,F,z,W,H,U,q,j;for(this._table=$("<table/>"),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),e=this._study.metaInfo(),i={},o=0;o<e.plots.length;++o)if(!(this._study.isSelfColorerPlot(o)||this._study.isTextColorerPlot(o)||this._study.isDataOffsetPlot(o)||this._study.isOHLCColorerPlot(o))){if(a=e.plots[o],e.styles){if(e.styles[a.id])s=e.styles[a.id].isHidden;else{if(!this._study.isOHLCSeriesPlot(o))continue;if(r=e.plots[o].target,i[r])continue;s=e.ohlcPlots[r].isHidden,i[r]=r}if(s)continue}this._study.isLinePlot(o)||this._study.isBarColorerPlot(o)||this._study.isBgColorerPlot(o)?this._prepareLayoutForPlot(o,a):this._study.isPlotArrowsPlot(o)?this._prepareLayoutForArrowsPlot(o,a):this._study.isPlotCharsPlot(o)?this._prepareLayoutForCharsPlot(o,a):this._study.isPlotShapesPlot(o)?this._prepareLayoutForShapesPlot(o,a):this._study.isOHLCSeriesPlot(o)?(l={id:r,type:"ohlc"},this._study.isOHLCBarsPlot(o)?this._prepareLayoutForBarsPlot(o,l):this._study.isOHLCCandlesPlot(o)&&this._prepareLayoutForCandlesPlot(o,l)):TradingView.logError("Unknown plot type: "+a.type)}if(h=this._study.properties().bands,h&&h.childCount()>0)for(o=0;o<h.childCount();o++)c=h[o],c.isHidden&&c.isHidden.value()||(d=$('<tr class="line"/>'),d.appendTo(this._table),f=$("<td/>"),f.appendTo(d),g=$("<input type='checkbox' class='visibility-switch'/>"),g.appendTo(f),m=c.name.value(),b=this.createLabeledCell(m,g).appendTo(d).addClass($.t("propertypage-name-label",{context:"css_class"})),S=$("<td/>"),S.appendTo(d),S.addClass("colorpicker-cell"),T=C(S),P=$("<td/>"),P.appendTo(d),L=k(),L.appendTo(P),E=$('<td colspan="4">').css({whiteSpace:"nowrap"}),E.appendTo(d),I=x(),I.render().appendTo(E),A=$("<input class='property-page-bandwidth' type='text'/>"),A.appendTo(E),V=[p(c.value.value())],O="Change band",B=new w(A,c.value,V,!1,this.model(),O),B.addFormatter(t),this.bindControl(B),this.bindControl(new _(g,c.visible,!0,this.model(),O)),this.bindControl(new v(T,c.color,!0,this.model(),O)),this.bindControl(new u(I,c.linestyle,parseInt,!0,this.model(),O)),this.bindControl(new y(L,c.linewidth,!0,this.model(),O)));if(this._study.properties().bandsBackground&&(c=this._study.properties().bandsBackground,R=$.t("Background"),O=$.t("Change band background"),d=this._prepareFilledAreaBackground(c.fillBackground,c.backgroundColor,c.transparency,R,O),d.appendTo(this._table)),this._study.properties().areaBackground&&(c=this._study.properties().areaBackground,R=$.t("Background"),O=$.t("Change area background"),d=this._prepareFilledAreaBackground(c.fillBackground,c.backgroundColor,c.transparency,R,O),d.appendTo(this._table)),N=e.filledAreas,void 0!==N)for(o=0;o<N.length;++o)F=N[o],F.isHidden||(c=this._study.properties().filledAreasStyle[F.id],R=F.title||$.t("Background"),O="Change "+R,d=this._prepareFilledAreaBackground(c.visible,c.color,c.transparency,R,O),d.appendTo(this._table));for(z in e.graphics){W=e.graphics[z];for(H in W)c=this._property.graphics[z][H],n["_createRow_"+z].call(this,this._table,c)}U=this._table.find(".visibility-switch.plot-visibility-switch"),1===U.length&&(f=U.parent(),f.css("display","none"),b=this._table.find(".propertypage-plot-with-palette"),1===b.length?b.css("display","none"):(b=this._table.find(".propertypage-name-label"),b.css("padding-left",0),b.find("label").attr("for",""))),q=this._prepareStudyPropertiesLayout(),this._table=this._table.add(q),D.isScriptStrategy(e)&&(j=this._prepareOrdersSwitches(),this._table=this._table.add(j)),this.loadData()},n.prototype._prepareOrdersSwitches=function(){var t,e,i,o,n,s,r,a=$('<table class="property-page study-strategy-properties" cellspacing="0" cellpadding="2">'),l="chart-orders-switch_"+Date.now().toString(36),h=$("<tr>").appendTo(a),c=$('<input id="'+l+'" type="checkbox">').appendTo($("<td>").appendTo(h));return $('<label for="'+l+'">'+$.t("Trades on Chart")+"</label>").appendTo($("<td>").appendTo(h)),t="chart-orders-labels-switch_"+Date.now().toString(36),e=$("<tr>").appendTo(a),i=$('<input id="'+t+'" type="checkbox">').appendTo($("<td>").appendTo(e)),$('<label for="'+t+'">'+$.t("Signal Labels")+"</label>").appendTo($("<td>").appendTo(e)),o="chart-orders-qty-switch_"+Date.now().toString(36),n=$("<tr>").appendTo(a),s=$('<input id="'+o+'" type="checkbox">').appendTo($("<td>").appendTo(n)),$('<label for="'+o+'">'+$.t("Quantity")+"</label>").appendTo($("<td>").appendTo(n)),r=this._study.properties(),this.bindControl(new _(c,r.strategy.orders.visible,!0,this.model(),"Trades on chart visibility")),this.bindControl(new _(i,r.strategy.orders.showLabels,!0,this.model(),"Signal labels visibility")),this.bindControl(new g(i,r.strategy.orders.visible,!0,this.model(),"Signal labels visibility",!0)),this.bindControl(new _(s,r.strategy.orders.showQty,!0,this.model(),"Quantity visibility")),this.bindControl(new g(s,r.strategy.orders.visible,!0,this.model(),"Quantity visibility",!0)),a},n.prototype._prepareLayoutForPlot=function(t,e){var i,o,n,s,r,a,l,h,c,d,p,f,g=e.id,m=this._study.properties().styles[g],b=this._findPlotPalette(t,e),w=b.palette,S=b.paletteProps,T="Change "+g;w?(i=$('<tr class="line"/>'),i.appendTo(this._table),o=$("<td/>"),o.appendTo(i),o.addClass("visibility-cell"),n=$("<input type='checkbox' class='visibility-switch plot-visibility-switch'/>"),n.appendTo(o),this.bindControl(new _(n,m.visible,!0,this.model(),T)),s=m.title.value(),this.createLabeledCell(s,n).appendTo(i).addClass("propertypage-name-label propertypage-plot-with-palette",{context:"css_class"}),this._prepareLayoutForPalette(t,e,w,S,T)):(i=$('<tr class="line"/>'),i.appendTo(this._table),o=$("<td/>"),o.appendTo(i),o.addClass("visibility-cell"),n=$("<input type='checkbox' class='visibility-switch plot-visibility-switch'/>"),n.appendTo(o),s=this._study.properties().styles[g].title.value(),this.createLabeledCell(s,n).appendTo(i).addClass($.t("propertypage-name-label",{context:"css_class"})),r=$("<td/>"),r.appendTo(i),r.addClass("colorpicker-cell"),a=C(r),l=$("<td/>"),l.appendTo(i),h=k(),h.appendTo(l),c=$("<td>"),c.appendTo(i),d=V(),d.appendTo(c),p=$("<td>"),p.appendTo(i),f=$("<input type='checkbox'>"),f.appendTo(p),this.createLabeledCell("Price Line",f).appendTo(i),this.bindControl(new _(n,m.visible,!0,this.model(),T)),this.bindControl(new v(a,m.color,!0,this.model(),T,m.transparency)),this.bindControl(new y(h,m.linewidth,!0,this.model(),T,this._study.metaInfo().isTVScript)),this.bindControl(new u(d,m.plottype,parseInt,!0,this.model(),T)),this.bindControl(new _(f,m.trackPrice,!0,this.model(),"Change Price Line")))},n.prototype._prepareLayoutForBarsPlot=function(t,e){var i,o,n,s,r,a,l=e.id,h=this._study.properties().ohlcPlots[l],c=this._findPlotPalette(t,e),d=c.palette,p=c.paletteProps,u="Change "+l,f=$('<tr class="line"/>');f.appendTo(this._table),i=$("<td/>"),i.appendTo(f),i.addClass("visibility-cell"),o=$("<input type='checkbox' class='visibility-switch'/>"),o.appendTo(i),this.bindControl(new _(o,h.visible,!0,this.model(),u)),n=h.title.value(),this.createLabeledCell(n,o).appendTo(f).addClass("propertypage-name-label",{context:"css_class"}),d?(s=!0,this._prepareLayoutForPalette(t,e,d,p,u,s)):(r=$("<td/>"),r.appendTo(f),r.addClass("colorpicker-cell"),a=C(r),this.bindControl(new v(a,h.color,!0,this.model(),u)))},n.prototype._prepareLayoutForCandlesPlot=function(t,e){var i,o,n,s,r,a,l,h,c;this._prepareLayoutForBarsPlot(t,e),i=e.id,o=this._study.properties().ohlcPlots[i],n="Change "+i,s=$('<tr class="line"/>'),s.appendTo(this._table),r=$("<td/>"),r.appendTo(s),r.addClass("visibility-cell"),a=$("<input type='checkbox' class='visibility-switch'/>"),a.appendTo(r),this.bindControl(new _(a,o.drawWick,!0,this.model(),n)),l="Wick",this.createLabeledCell(l,a).appendTo(s),h=$("<td/>"),h.appendTo(s),h.addClass("colorpicker-cell"),c=C(h),this.bindControl(new v(c,o.wickColor,!0,this.model(),n))},n.prototype._prepareLayoutForShapesPlot=function(t,e){var i,o,n,s,r,a,l,h,c,d=e.id,p=this._study.properties().styles[d],f=this._findPlotPalette(t,e),g=f.palette,m=f.paletteProps,y="Change "+d,b=$('<tr class="line"/>');b.appendTo(this._table),i=$("<td/>"),i.appendTo(b),i.addClass("visibility-cell"),o=$("<input type='checkbox' class='visibility-switch'/>"),o.appendTo(i),this.bindControl(new _(o,p.visible,!0,this.model(),y)),n=this._study.properties().styles[d].title.value(),this.createLabeledCell(n,o).appendTo(b).addClass("propertypage-name-label",{context:"css_class"}),s=$("<td/>"),s.appendTo(b),r=L(),r.appendTo(s),this.bindControl(new u(r,p.plottype,null,!0,this.model(),y)),a=$("<td/>"),a.appendTo(b),l=P(),l.appendTo(a),this.bindControl(new u(l,p.location,null,!0,this.model(),y)),g?this._prepareLayoutForPalette(t,e,g,m,y):(b=$('<tr class="line"/>'),b.appendTo(this._table),$("<td/>").appendTo(b),$("<td/>").appendTo(b),h=$("<td/>"),h.appendTo(b),h.addClass("colorpicker-cell"),c=C(h),this.bindControl(new v(c,p.color,!0,this.model(),y,p.transparency)))},n.prototype._prepareLayoutForCharsPlot=function(t,e){var i,o,n,s,r,a,l,h,c,d=e.id,p=this._study.properties().styles[d],f=this._findPlotPalette(t,e),g=f.palette,m=f.paletteProps,y="Change "+d,b=$('<tr class="line"/>');b.appendTo(this._table),i=$("<td/>"),i.appendTo(b),i.addClass("visibility-cell"),o=$("<input type='checkbox' class='visibility-switch'/>"),o.appendTo(i),this.bindControl(new _(o,p.visible,!0,this.model(),y)),n=this._study.properties().styles[d].title.value(),this.createLabeledCell(n,o).appendTo(b).addClass($.t("propertypage-name-label",{context:"css_class"})),s=$("<td/>"),s.appendTo(b),r=I(),r.appendTo(s),r.keyup(function(){var t=$(this),e=t.val();e&&(t.val(e.split("")[e.length-1]),t.change())}),this.bindControl(new w(r,p.char,null,!1,this.model(),y)),a=$("<td/>"),a.appendTo(b),l=P(),l.appendTo(a),this.bindControl(new u(l,p.location,null,!0,this.model(),y)),g?this._prepareLayoutForPalette(t,e,g,m,y):(b=$('<tr class="line"/>'),b.appendTo(this._table),$("<td/>").appendTo(b),$("<td/>").appendTo(b),h=$("<td/>"),h.appendTo(b),h.addClass("colorpicker-cell"),c=C(h),this.bindControl(new v(c,p.color,!0,this.model(),y,p.transparency)))},n.prototype._isStyleNeedsConnectPoints=function(t){return[O.PLOT_CROSS,O.PLOT_CIRCLES].indexOf(t)>=0},n.prototype._prepareLayoutForPalette=function(t,e,i,o,n,s){var r,a,l,h,c,d,p,f,g,m,b,w,S,T,x,P=t,L=e.id,E=null;E=s?this._study.properties().ohlcPlots[L]:this._study.properties().styles[L],r=0;for(a in i.colors)l=o.colors[a],h=$('<tr class="line"/>'),h.appendTo(this._table),$("<td/>").appendTo(h),c=$("<td/>"),c.appendTo(h),c.addClass($.t("propertypage-name-label",{context:"css_class"})),c.html($.t(l.name.value())),d=$("<td/>"),d.appendTo(h),d.addClass("colorpicker-cell"),p=C(d),this.bindControl(new v(p,l.color,!0,this.model(),n,E.transparency)),this._study.isLinePlot(P)&&(f=$("<td/>"),f.appendTo(h),g=k(),g.appendTo(f),this.bindControl(new y(g,l.width,!0,this.model(),n,this._study.metaInfo().isTVScript)),m=$("<td>"),m.appendTo(h),0===r&&(b=V(),b.appendTo(m),this.bindControl(new u(b,E.plottype,parseInt,!0,this.model(),n)),w=$("<input type='checkbox'>"),S=$('<td colspan="4">').css({whiteSpace:"nowrap"}),T=$("<span>").html($.t("Price Line")),x=$("<span>"),x.append(w),S.append(x).append(T).appendTo(h),this.bindControl(new _(w,E.trackPrice,!0,this.model(),"Change Price Line")))),r++},n.prototype._prepareLayoutForArrowsPlot=function(t,e){var i,o,n,s,r,a,l,h=e.id,c=this._study.properties().styles[h],d="Change "+h,p=$('<tr class="line"/>');p.appendTo(this._table),i=$("<td/>"),i.appendTo(p),i.addClass("visibility-cell"),o=$("<input type='checkbox' class='visibility-switch'/>"),o.appendTo(i),n=this._study.properties().styles[h].title.value(),this.createLabeledCell(n,o).appendTo(p).addClass($.t("propertypage-name-label",{context:"css_class"})),s=$("<td/>"),s.appendTo(p),s.addClass("colorpicker-cell"),r=C(s),a=$("<td/>"),a.appendTo(p),a.addClass("colorpicker-cell"),l=C(a),this.bindControl(new _(o,c.visible,!0,this.model(),d)),this.bindControl(new v(r,c.colorup,!0,this.model(),d,c.transparency)),this.bindControl(new v(l,c.colordown,!0,this.model(),d,c.transparency))},n.prototype._findPlotPalette=function(t,e){var i,o=t,n=e.id,s=null,r=null,a=this._study.metaInfo().plots;if(this._study.isBarColorerPlot(o)||this._study.isBgColorerPlot(o))s=this._study.metaInfo().palettes[e.palette],r=this._study.properties().palettes[e.palette];else for(i=0;i<a.length;i++)if(a[i].target===n&&(this._study.isSelfColorerPlot(i)||this._study.isOHLCColorerPlot(i))){s=this._study.metaInfo().palettes[a[i].palette],r=this._study.properties().palettes[a[i].palette];break}return{palette:s,paletteProps:r}},n.prototype._prepareStudyPropertiesLayout=function(){var t,e,i=$('<table class="property-page study-properties" cellspacing="0" cellpadding="2">');return this._study.metaInfo().is_price_study||(t=this.createPrecisionEditor(),e=$("<tr>"),e.appendTo(i),$("<td>"+$.t("Precision")+"</td>").appendTo(e),$("<td>").append(t).appendTo(e),this.bindControl(new u(t,this._study.properties().precision,null,!0,this.model(),"Change Precision"))),"Compare@tv-basicstudies"===this._study.metaInfo().id&&(t=this.createSeriesMinTickEditor(),e=$("<tr>"),e.appendTo(i),$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(e),$("<td>").append(t).appendTo(e),this.bindControl(new u(t,this._study.properties().minTick,null,!0,this.model(),"Change MinTick"))),this._putStudyDefaultStyles(i),i},n.prototype._putStudyDefaultStyles=function(t,e){var i,o,n,s,r,a=null,l=this._study;return(!l.properties().linkedToSeries||!l.properties().linkedToSeries.value())&&($.each(this._model.m_model.panes(),function(t,e){$.each(e.dataSources(),function(t,i){if(i===l)return a=e,!1})}),this._pane=a,this._pane&&(this._pane.leftPriceScale().dataSources().indexOf(this._study)!==-1?i="left":this._pane.rightPriceScale().dataSources().indexOf(this._study)!==-1?i="right":this._pane.isOverlay(this._study)&&(i="none")),i&&(o=this,n=this.createKeyCombo({left:$.t("Scale Left"),right:$.t("Scale Right"),none:$.t("Screen (No Scale)")}).val(i).change(function(){switch(this.value){case"left":o._model.move(o._study,o._pane,o._pane.leftPriceScale());break;case"right":o._model.move(o._study,o._pane,o._pane.rightPriceScale());break;case"none":o._model.move(o._study,o._pane,null)}}),s=this.addRow(t),$("<td>"+$.t("Scale")+"</td>").appendTo(s),r=$("<td>").appendTo(s).append(n),e&&e>2&&r.attr("colspan",e-1)),t)},n.prototype.widget=function(){return this._table},n.prototype._prepareFilledAreaBackground=function(t,e,i,o,n){var s,r,a,l=$('<tr class="line"/>'),h=$("<td/>");return h.appendTo(l),s=$("<input type='checkbox' class='visibility-switch'/>"),s.appendTo(h),this.createLabeledCell(o,s).appendTo(l).addClass($.t("propertypage-name-label",{context:"css_class"})),r=$("<td/>"),r.appendTo(l),r.addClass("colorpicker-cell"),a=C(r),this.bindControl(new _(s,t,!0,this.model(),n+" visibility")),this.bindControl(new v(a,e,!0,this.model(),n+" color",i)),l},inherit(s,a),s.prototype.prepareLayout=function(){return this._study.properties().linkedToSeries&&this._study.properties().linkedToSeries.value()?void(this._table=$()):void(this._table=$())},s.prototype.widget=function(){return this._table},n._createRow_horizlines=function(t,e){var i=this.addRow(t),o=e.name.value(),n=$("<input type='checkbox' class='visibility-switch'/>"),s=this.createColorPicker(),r=k(),a=x();$("<td>").append(n).appendTo(i),this.createLabeledCell(o,n).appendTo(i),$("<td>").append(s).appendTo(i),$("<td>").append(r).appendTo(i),$("<td>").append(a.render()).appendTo(i),this.bindControl(new _(n,e.visible,!0,this.model(),"Change "+o+" visibility")),this.bindControl(new v(s,e.color,!0,this.model(),"Change "+o+" color")),this.bindControl(new u(a,e.style,parseInt,!0,this.model(),"Change "+o+" style")),this.bindControl(new y(r,e.width,!0,this.model(),"Change "+o+" width"))},n._createRow_vertlines=function(t,e){var i=this.addRow(t),o=e.name.value(),n=$("<input type='checkbox' class='visibility-switch'/>"),s=this.createColorPicker(),r=k(),a=x();$("<td>").append(n).appendTo(i),this.createLabeledCell(o,n).appendTo(i),$("<td>").append(s).appendTo(i),$("<td>").append(r).appendTo(i),$("<td>").append(a.render()).appendTo(i),this.bindControl(new _(n,e.visible,!0,this.model(),"Change "+o+" visibility")),this.bindControl(new v(s,e.color,!0,this.model(),"Change "+o+" color")),this.bindControl(new u(a,e.style,parseInt,!0,this.model(),"Change "+o+" style")),this.bindControl(new y(r,e.width,!0,this.model(),"Change "+o+" width"))},n._createRow_lines=function(t,e){var i=this.addRow(t),o=e.title.value(),n=$("<input type='checkbox' class='visibility-switch'/>"),s=this.createColorPicker(),r=k(),a=x();$("<td>").append(n).appendTo(i),this.createLabeledCell(o,n).appendTo(i),$("<td>").append(s).appendTo(i),$("<td>").append(r).appendTo(i),
$("<td>").append(a.render()).appendTo(i),this.bindControl(new _(n,e.visible,!0,this.model(),"Change "+o+" visibility")),this.bindControl(new v(s,e.color,!0,this.model(),"Change "+o+" color")),this.bindControl(new u(a,e.style,parseInt,!0,this.model(),"Change "+o+" style")),this.bindControl(new y(r,e.width,!0,this.model(),"Change "+o+" width"))},n._createRow_hlines=function(t,e){var i,o,n,s=this.addRow(t),r=e.name.value(),a=$("<input type='checkbox' class='visibility-switch'/>"),l=this.createColorPicker(),h=k(),c=x(),d=$("<input type='checkbox'>");$("<td>").append(a).appendTo(s),this.createLabeledCell(r,a).appendTo(s),$("<td>").append(l).appendTo(s),$("<td>").append(h).appendTo(s),$("<td>").append(c.render()).appendTo(s),$("<td>").appendTo(s),$("<td>").append(d).appendTo(s),this.createLabeledCell("Show Price",d).appendTo(s),this.bindControl(new _(a,e.visible,!0,this.model(),"Change "+r+" visibility")),this.bindControl(new v(l,e.color,!0,this.model(),"Change "+r+" color")),this.bindControl(new u(c,e.style,parseInt,!0,this.model(),"Change "+r+" style")),this.bindControl(new y(h,e.width,!0,this.model(),"Change "+r+" width")),this.bindControl(new _(d,e.showPrice,!0,this.model(),"Change "+r+" show price")),e.enableText.value()&&(s=this.addRow(t),$('<td colspan="2">').appendTo(s),i=$("<input type='checkbox'>"),$('<td class="text-center">').append(i).appendTo(s),this.createLabeledCell("Show Text",i).appendTo(s),this.bindControl(new _(i,e.showText,!0,this.model(),"Change "+r+" show text")),o=TradingView.createTextPosEditor(),$("<td>").append(o.render()).appendTo(s),this.bindControl(new u(o,e.textPos,parseInt,!0,this.model(),"Change "+r+" text position")),n=this.createFontSizeEditor(),$('<td colspan="2">').append(n).appendTo(s),this.bindControl(new u(n,e.fontSize,parseInt,!0,this.model(),"Change "+r+" font size")))},n._createRow_hhists=function(t,e){var i,o,n,s,r,a,l=e.title.value(),p=[],f=[],g=this.addRow(t),m=E();$("<td>").append(m).appendTo(g),this.createLabeledCell(l,m).appendTo(g),this.bindControl(new _(m,e.visible,!0,this.model(),"Change "+l+" Visibility")),g=this.addRow(t),i=$("<input/>"),i.attr("type","text"),i.addClass("ticker"),this.createLabeledCell($.t("Width (% of the Box)"),i).appendTo(g),$("<td>").append(i).appendTo(g),o=[d(40)],o.push(h(0)),o.push(c(100)),this.bindControl(new w(i,e.percentWidth,o,!1,this.model(),"Change Percent Width")),g=this.addLabeledRow(t,"Placement"),n=A(),$("<td>").append(n).appendTo(g),this.bindControl(new u(n,e.direction,null,!0,this.model(),"Change "+l+" Placement")),g=this.addRow(t),s=$("<input type='checkbox'>"),$("<td>").append(s).appendTo(g),this.createLabeledCell($.t("Show Values"),s).appendTo(g),this.bindControl(new _(s,e.showValues,!0,this.model(),"Change "+l+" Show Values")),g=this.addRow(t),r=this.createColorPicker(),this.createLabeledCell($.t("Text Color"),r).appendTo(g),$("<td>").append(r).appendTo(g),this.bindControl(new v(r,e.valuesColor,!0,this.model(),"Change "+l+" Text Color"));for(a in e.colors)isNumber(parseInt(a,10))&&(g=this.addRow(t),p[a]=e.titles[a].value(),f[a]=this.createColorPicker(),$("<td>").append(p[a]).appendTo(g),$("<td>").append(f[a]).appendTo(g),this.bindControl(new v(f[a],e.colors[a],!0,this.model(),"Change "+p[a]+" color")))},n._createRow_backgrounds=function(t,e){var i=this.addRow(t),o=$("<input type='checkbox' class='visibility-switch'/>"),n=e.name.value(),s=this.createColorPicker();$("<td>").append(o).appendTo(i),this.createLabeledCell(n,o).appendTo(i),$("<td>").append(s).appendTo(i),this.bindControl(new _(o,e.visible,!0,this.model(),"Change "+n+" visibility")),this.bindControl(new v(s,e.color,!0,this.model(),"Change "+n+" color",e.transparency))},n._createRow_polygons=function(t,e){var i=this.addRow(t),o=e.name.value(),n=this.createColorPicker();$("<td>").append(o).appendTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new v(n,e.color,!0,this.model(),"Change "+o+" color"))},n._createRow_trendchannels=function(t,e){var i=this.addRow(t),o=e.name.value(),n=this.createColorPicker();$("<td>").append(o).appendTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new v(n,e.color,!0,this.model(),"Change "+o+" color",e.transparency))},n._createRow_textmarks=function(t,e){var i=this.addLabeledRow(t),o=e.name.value(),n=this.createColorPicker(),s=this.createColorPicker(),r=this.createFontEditor(),a=this.createFontSizeEditor(),l=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),h=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(o).appendTo(i),"rectangle"!==e.shape.value()&&$("<td>").append(n).appendTo(i),$("<td>").append(s).appendTo(i),$("<td>").append(r).appendTo(i),$("<td>").append(a).appendTo(i),$("<td>").append(l).appendTo(i),$("<td>").append(h).appendTo(i),this.bindControl(new v(n,e.color,!0,this.model(),"Change "+o+" color",e.transparency)),this.bindControl(new v(s,e.fontColor,!0,this.model(),"Change "+o+" text color",e.transparency)),this.bindControl(new u(a,e.fontSize,parseInt,!0,this.model(),"Change "+o+" font size")),this.bindControl(new u(r,e.fontFamily,null,!0,this.model(),"Change "+o+" font")),this.bindControl(new _(l,e.fontBold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new _(h,e.fontItalic,!0,this.model(),"Change Text Font Italic"))},n._createRow_shapemarks=function(t,e){var i=this.addRow(t),o=$("<input type='checkbox' class='visibility-switch'/>"),n=e.name.value(),s=this.createColorPicker(),r=$("<input/>");r.attr("type","text"),r.addClass("ticker"),$("<td>").append(o).appendTo(i),this.createLabeledCell(n,o).appendTo(i),$("<td>").append(s).appendTo(i),this.createLabeledCell("Size",r).appendTo(i),$("<td>").append(r).appendTo(i),this.bindControl(new _(o,e.visible,!0,this.model(),"Change "+n+" visibility")),this.bindControl(new v(s,e.color,!0,this.model(),"Change "+n+" back color",e.transparency)),this.bindControl(new w(r,e.size,null,!1,this.model(),"Change size"))},TradingView.StudyInputsPropertyPage=o,e.StudyInputsPropertyPage=o,e.StudyStylesPropertyPage=n,e.StudyDisplayPropertyPage=s},function(t,e,i){"use strict";function o(t,e){s.call(this,t,e),this.prepareLayout()}var n=i(262),s=n.PropertyPage,r=n.SimpleComboBinder;inherit(o,s),o.prototype.prepareLayout=function(){var t,e;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=this.createKeyCombo({open:$.t("Open"),high:$.t("High"),low:$.t("Low"),close:$.t("Close")}),e=this.addLabeledRow(this._table,$.t("Source",{context:"compare"})),$("<td>").appendTo(e).append(t),this.bindControl(new r(t,this._property.inputs.source,null,!0,this.model(),"Change Price Source")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e),this._linetool=i,this.prepareLayout()}var n=i(262).PropertyPage,s=i(270).StudyInputsPropertyPage,r=i(273),a=i(114);inherit(o,r),o.prototype.prepareLayout=function(){var t,e,o,n,r,l,h,c,d=i(258),p=$('<table class="property-page" cellspacing="0" cellpadding="0">'),u=$('<table class="property-page" cellspacing="0" cellpadding="0">').data({"layout-tab":d.TAB_NAME_INPUTS,"layout-tab-priority":d.TAB_PRIORITY_INPUTS});for(this._table=p.add(u),t=this._linetool.points(),e=0;e<t.length;e++)o=$("<tr>"),o.appendTo(p),n=$("<td>"),n.html("Point "+(e+1)+" Bar #"),n.appendTo(o),r=$("<td>"),r.appendTo(o),l=$("<input type='text'>"),l.appendTo(r),l.addClass("ticker"),h=this._linetool.properties().points[e],this.bindBarIndex(h.bar,l,this.model(),"Change "+this._linetool+" point bar index");c=a.findStudyMetaInfo(this._model.studiesMetaData(),this._linetool.studyId()),s.prototype.prepareLayoutImpl.call(this,c,u)},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e),this._linetool=i,this.prepareLayout()}var n=i(262),s=n.PropertyPage,r=n.GreateTransformer,a=n.LessTransformer,l=n.ToIntTransformer,h=n.SimpleStringBinder;inherit(o,s),o.BarIndexPastLimit=-5e4,o.BarIndexFutureLimit=15e3,o.prototype.bindBarIndex=function(t,e,i,n){var s=[l(t.value()),r(o.BarIndexPastLimit),a(o.BarIndexFutureLimit)];this.bindControl(new h(e,t,s,!1,i,n))},o.prototype.createPriceEditor=function(t){var e,i=this._linetool.ownerSource().formatter(),o=function(t){var e=i.format(t);return e},n=function(t){var e=i.parse(t);if(e.res)return e.price?e.price:e.value},s=$("<input type='text'>");return s.TVTicker({step:i._minMove/i._priceScale||1,formatter:o,parser:n}),t&&(e=[function(e){var i=n(e);return void 0===i?t.value():i}],this.bindControl(new h(s,t,e,!1,this.model(),"Change "+this._linetool+" point price")).addFormatter(function(t){return i.format(t)})),s},o.prototype._createPointRow=function(t,e,i){var o,n,s,r,a,l=$("<tr>"),h=$("<td>");return h.html($.t("Price")+i),h.appendTo(l),o=$("<td>"),o.appendTo(l),n=this.createPriceEditor(e.price),n.appendTo(o),s=$("<td>"),s.html($.t("Bar #")),s.appendTo(l),r=$("<td>"),r.appendTo(l),a=$("<input type='text'>"),a.appendTo(r),a.addClass("ticker"),this.bindBarIndex(e.bar,a,this.model(),"Change "+this._linetool+" point bar index"),l},o.prototype.prepareLayoutForTable=function(t){var e,i,o,n,s,r=this._linetool.points(),a=r.length;for(e=0;e<r.length;e++)i=r[e],o=this._linetool.properties().points[e],o&&(n=(e||a>1?" "+(e+1):"")+"",s=this._createPointRow(i,o,n),s.appendTo(t))},o.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.prepareLayoutForTable(this._table),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e,i),this.prepareLayout()}function n(t,e,i){r.call(this,t,e,i)}var s=i(261),r=i(273),a=i(262),l=a.BooleanBinder,h=a.SimpleComboBinder,c=a.SimpleStringBinder,d=a.ColorBinding,p=a.SliderBinder,u=i(55),_=u.createLineStyleEditor,f=u.createLineWidthEditor;inherit(o,s),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,r,a,u,g,m,v,y,b;this._res=$("<div>"),this._table=$('<table class="property-page" cellspacing="0" cellpadding="2" style="width:100%"></table>').appendTo(this._res),t=f(),e=_(),i=this.createColorPicker(),o=this.addLabeledRow(this._table,"Line"),$("<td>").append(i).appendTo(o),$("<td>").append(t).appendTo(o),$('<td colspan="3">').append(e.render().css("display","block")).appendTo(o),n=$("<input type='checkbox' class='visibility-switch'>"),o=$("<tr>").appendTo(this._table),$('<td colspan="3">').append($("<label>").append(n).append($.t("Show Price"))).prependTo(o),s=$("<input type='checkbox'>"),o=$("<tr>").appendTo(this._table),$('<td colspan="3">').append($("<label>").append(s).append($.t("Show Text"))).prependTo(o),o=this.addLabeledRow(this._table,"Text:"),r=this.createColorPicker(),a=this.createFontSizeEditor(),u=this.createFontEditor(),g=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),m=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),$("<td>").append(r).appendTo(o),$("<td>").append(u).appendTo(o),$("<td>").append(a).appendTo(o),$("<td>").append(g).appendTo(o),$("<td>").append(m).appendTo(o),o=$("<tr>").appendTo(this._table),$("<td colspan='2'>").append($.t("Text Alignment:")).appendTo(o),v=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),y=$("<select><option value='bottom'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='top'>"+$.t("bottom")+"</option></select>").data("selectbox-css",{display:"block"}),$("<td>").append(v).appendTo(o),$("<td colspan='3'>").append(y).appendTo(o),b=$("<textarea rows='7' cols='60'>").css("width","100%"),o=$("<tr>").appendTo(this._table),$("<td colspan='7'>").append(b).appendTo(o),this.bindControl(new l(s,this._linetool.properties().showLabel,!0,this.model(),"Change Horz Line Text Visibility")),this.bindControl(new h(v,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Horz Line Labels Alignment")),this.bindControl(new h(y,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Horz Line Labels Alignment")),this.bindControl(new c(b,this._linetool.properties().text,null,!0,this.model(),"Change Text")),this.bindControl(new l(n,this._linetool.properties().showPrice,!0,this.model(),"Change Horz Line Price Visibility")),this.bindControl(new d(i,this._linetool.properties().linecolor,!0,this.model(),"Change Horz Line Color")),this.bindControl(new h(e,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Horz Line Style")),this.bindControl(new p(t,this._linetool.properties().linewidth,!0,this.model(),"Change Horz Line Width")),this.bindControl(new h(a,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new h(u,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new d(r,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new l(g,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new l(m,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),this.loadData()},o.prototype.widget=function(){return this._res},inherit(n,r),n.prototype.prepareLayout=function(){var t,e,i,o;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=this._linetool.points()[0],t&&(e=this._linetool.properties().points[0],i=this.createPriceEditor(e.price),o=$("<tr>").appendTo(this._table),$("<td>"+$.t("Price")+"</td>").appendTo(o),$("<td>").append(i).appendTo(o),this.loadData())},e.LineToolHorzLineStylesPropertyPage=o,e.LineToolHorzLineInputsPropertyPage=n},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e,i),this.prepareLayout()}function n(t,e,i){r.call(this,t,e,i)}var s=i(261),r=i(273),a=i(262),l=a.GreateTransformer,h=a.LessTransformer,c=a.ToFloatTransformer,d=a.ColorBinding,p=a.BooleanBinder,u=a.SimpleComboBinder,_=a.SimpleStringBinder,f=a.SliderBinder,g=i(55),m=g.createLineStyleEditor,v=g.createLineWidthEditor,y=i(82),b=y.NumericFormatter;inherit(o,s),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,r,a,l,h,c,_,g,y,b,w;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=v(),i=m(),o=this.createColorPicker(),n=this.addLabeledRow(t,$.t("Line")),$("<td>").append(o).appendTo(n),$("<td>").append(e).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n),s=$("<tbody>").appendTo(this._table),n=this.addLabeledRow(s,$.t("Text")),r=this.createColorPicker(),a=this.createFontSizeEditor(),l=this.createFontEditor(),h=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),c=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),$("<td>").append(r).appendTo(n),$("<td>").append(l).appendTo(n),$("<td>").append(a).appendTo(n),$("<td>").append(h).appendTo(n),$("<td>").append(c).appendTo(n),_=$('<input type="checkbox">'),g=$('<input type="checkbox">'),n=this.addLabeledRow(s,$.t("Extend Right End")),$('<td colspan="3">').appendTo(n).append(_),n=this.addLabeledRow(s,$.t("Extend Left End")),$('<td colspan="3">').appendTo(n).append(g),y=$('<input type="checkbox">'),b=$('<input type="checkbox">'),w=$('<input type="checkbox">'),n=this.addLabeledRow(s,$.t("Show Price Range")),$('<td colspan="3">').appendTo(n).append(y),n=this.addLabeledRow(s,$.t("Show Bars Range")),$('<td colspan="3">').appendTo(n).append(b),n=this.addLabeledRow(s,$.t("Always Show Stats")),$('<td colspan="3">').appendTo(n).append(w),this.bindControl(new p(y,this._linetool.properties().showPriceRange,!0,this.model(),"Change Trend Line Show Price Range")),this.bindControl(new p(b,this._linetool.properties().showBarsRange,!0,this.model(),"Change Trend Line Show Bars Range")),this.bindControl(new u(a,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new u(l,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new d(r,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new p(h,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new p(c,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),this.bindControl(new d(o,this._linetool.properties().linecolor,!0,this.model(),"Change Trend Line Color")),this.bindControl(new u(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Trend Line Style")),this.bindControl(new f(e,this._linetool.properties().linewidth,!0,this.model(),"Change Trend Line Width")),this.bindControl(new p(_,this._linetool.properties().extendRight,!0,this.model(),"Change Trend Angle Extending Right")),this.bindControl(new p(g,this._linetool.properties().extendLeft,!0,this.model(),"Change Trend Angle Extending Left")),this.bindControl(new p(w,this._linetool.properties().alwaysShowStats,!0,this.model(),"Change Trend Line Always Show Stats")),this.loadData()},o.prototype.widget=function(){return this._table},inherit(n,r),n.prototype.prepareLayout=function(){var t,e,i,o,n,s;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=this._linetool.points()[0],e=this._linetool.properties().points[0],t&&e&&(i=this._createPointRow(t,e,""),this._table.append(i),i=$("<tr>").appendTo(this._table),$("<td>").append($.t("Angle")).appendTo(i),o=$("<input type='text'>"),$("<td>").append(o).appendTo(i),n=[c(e.price.value()),l(-360),h(360)],s=new _(o,this._linetool.properties().angle,n,!1,this.model(),"Change angle"),s.addFormatter(function(t){return(new b).format(t)}),this.bindControl(s),this.loadData())},n.prototype.widget=function(){return this._table},e.LineToolTrendAngleStylesPropertyPage=o,e.LineToolTrendAngleInputsPropertyPage=n},function(t,e,i){"use strict";function o(t,e,i){r.call(this,t,e,i),this.prepareLayout()}function n(t,e,i){s.call(this,t,e,i),this.prepareLayout()}var s=i(261),r=i(273),a=i(262),l=a.LessTransformer,h=a.GreateTransformer,c=a.ToIntTransformer,d=a.ToFloatTransformer,p=a.SimpleStringBinder,u=a.ColorBinding,_=a.SliderBinder,f=a.SimpleComboBinder,g=i(55).createLineWidthEditor,m=i(82).NumericFormatter;inherit(o,r),o.prototype.prepareLayout=function(){function t(t){return(new m).format(t)}var e,i,o,n,s,r,a,u,_,f,g,v;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),e=$("<tbody>").appendTo(this._table),i=this.addLabeledRow(e,"Stop Level. Ticks:"),o=$("<input type='text'>"),$("<td>").append(o).appendTo(i),o.addClass("ticker"),n=$("<input type='text'>"),$("<td>"+$.t("Price:")+"</td>").appendTo(i),$("<td>").append(n).appendTo(i),s=this.addLabeledRow(e,"Entry price:"),r=$("<input type='text'>"),$('<td colspan="2">').append(r).appendTo(s),a=this.addLabeledRow(e,"Profit Level. Ticks:"),u=$("<input type='text'>"),$("<td>").append(u).appendTo(a),u.addClass("ticker"),_=$("<input type='text'>"),$("<td>"+$.t("Price:")+"</td>").appendTo(a),$("<td>").append(_).appendTo(a),"LineToolRiskRewardLong"===this._linetool.getConstructor()&&(i.detach().appendTo(e),a.detach().prependTo(e)),f=[c(this._linetool.properties().stopLevel.value()),h(0),l(1e9)],this.bindControl(new p(o,this._linetool.properties().stopLevel,f,!1,this.model(),"Change "+this._linetool+" stop level")),f=[c(this._linetool.properties().profitLevel.value()),h(0),l(1e9)],this.bindControl(new p(u,this._linetool.properties().profitLevel,f,!1,this.model(),"Change "+this._linetool+" profit level")),f=[d(this._linetool.properties().entryPrice.value())],g=new p(r,this._linetool.properties().entryPrice,f,!1,this.model(),"Change "+this._linetool+" entry price"),g.addFormatter(t),this.bindControl(g),v=this,f=[d(this._linetool.properties().stopPrice.value()),function(t){return v._linetool.preparseStopPrice(t)}],g=new p(n,this._linetool.properties().stopPrice,f,!1,this.model(),"Change "+this._linetool+" stop price"),g.addFormatter(t),this.bindControl(g),f=[d(this._linetool.properties().targetPrice.value()),function(t){return v._linetool.preparseProfitPrice(t)}],g=new p(_,this._linetool.properties().targetPrice,f,!1,this.model(),"Change "+this._linetool+" stop price"),g.addFormatter(t),this.bindControl(g)},o.prototype.widget=function(){return this._table},inherit(n,s),n.prototype.prepareLayout=function(){var t,e,i,o,n,s,r,a,l;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=g(),i=this.createColorPicker(),o=this.addLabeledRow(t,"Lines"),$("<td>").append(i).appendTo(o),$("<td>").append(e).appendTo(o),o=this.addLabeledRow(t,"Stop Color:"),n=this.createColorPicker(),$("<td>").append(n).appendTo(o),o=this.addLabeledRow(t,"Target Color:"),s=this.createColorPicker(),$("<td>").append(s).appendTo(o),o=this.addLabeledRow(t,"Text:"),r=this.createColorPicker(),a=this.createFontSizeEditor(),l=this.createFontEditor(),$("<td>").append(r).appendTo(o),$("<td>").append(l).appendTo(o),$("<td>").append(a).appendTo(o),this.bindControl(new u(i,this._linetool.properties().linecolor,!0,this.model(),"Change Risk/Reward line Color")),this.bindControl(new _(e,this._linetool.properties().linewidth,!0,this.model(),"Change Risk/Reward line width")),this.bindControl(new u(n,this._linetool.properties().stopBackground,!0,this.model(),"Change stop color",this._linetool.properties().stopBackgroundTransparency)),this.bindControl(new u(s,this._linetool.properties().profitBackground,!0,this.model(),"Change target color",this._linetool.properties().profitBackgroundTransparency)),this.bindControl(new f(a,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new f(l,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new u(r,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.loadData()},n.prototype.widget=function(){return this._table},e.LineToolRiskRewardInputsPropertyPage=o,e.LineToolRiskRewardStylesPropertyPage=n},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e,i),this.prepareLayout()}function n(t,e,i){r.call(this,t,e,i)}var s=i(261),r=i(273),a=i(262),l=a.BooleanBinder,h=a.SimpleComboBinder,c=a.SliderBinder,d=a.ColorBinding,p=i(55),u=p.createLineStyleEditor,_=p.createLineWidthEditor;inherit(o,s),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=_(),e=u(),i=this.createColorPicker(),o=this.addLabeledRow(this._table,"Line"),$("<td>").prependTo(o),$("<td>").append(i).appendTo(o),$("<td>").append(t).appendTo(o),$("<td>").append(e.render()).appendTo(o),n=$("<input type='checkbox' class='visibility-switch'>"),o=$("<tr>").appendTo(this._table),$("<td>").append(n).prependTo(o),this.createLabeledCell(2,"Show Time",n).appendTo(o),this.bindControl(new l(n,this._linetool.properties().showTime,!0,this.model(),"Change Vert Line Time Visibility")),this.bindControl(new d(i,this._linetool.properties().linecolor,!0,this.model(),"Change Vert Line Color")),this.bindControl(new h(e,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Vert Line Style")),this.bindControl(new c(t,this._linetool.properties().linewidth,!0,this.model(),"Change Vert Line Width")),this.loadData()},o.prototype.widget=function(){return this._table},inherit(n,r),n.prototype.prepareLayout=function(){var t,e,i,o;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=this._linetool.points()[0],t&&(e=$('<input type="text" class="ticker">'),i=$("<tr>").appendTo(this._table),$("<td>"+$.t("Bar #")+"</td>").appendTo(i),$("<td>").append(e).appendTo(i),o=this._linetool.properties().points[0],this.bindBarIndex(o.bar,e,this.model(),"Change "+this._linetool+" point bar index"),this.loadData())},e.LineToolVertLineStylesPropertyPage=o,e.LineToolVertLineInputsPropertyPage=n},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e,i),this.prepareLayout()}function n(t,e,i){r.call(this,t,e,i)}var s=i(261),r=i(273),a=i(262),l=a.ToFloatTransformer,h=a.SimpleComboBinder,c=a.ColorBinding,d=a.BooleanBinder,p=a.SimpleStringBinder;inherit(o,s),o.prototype.prepareLayout=function(){var t,e,i,o,n,s;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=$("<tbody>").appendTo(this._table),e=this.createColorPicker(),i=this.addLabeledRow(t,"Color"),$("<td>").append(e).appendTo(i),o=$('<select><option value="0">'+$.t("HL Bars")+'</option><option value="2">'+$.t("OC Bars")+'</option><option value="1">'+$.t("Line - Close")+'</option><option value="3">'+$.t("Line - Open")+'</option><option value="4">'+$.t("Line - High")+'</option><option value="5">'+$.t("Line - Low")+'</option><option value="6">'+$.t("Line - HL/2")+"</option></select>"),i=this.addLabeledRow(t,"Mode"),$("<td>").append(o).appendTo(i),i=$("<tr>").appendTo(t),$("<td>"+$.t("Mirrored")+"</td>").appendTo(i),n=$("<input type='checkbox'>"),$("<td>").append(n).appendTo(i),i=$("<tr>").appendTo(t),$("<td>"+$.t("Flipped")+"</td>").appendTo(i),s=$("<input type='checkbox'>"),$("<td>").append(s).appendTo(i),this.bindControl(new d(n,this._linetool.properties().mirrored,!0,this.model(),"Change Bars Pattern Mirroring")),this.bindControl(new d(s,this._linetool.properties().flipped,!0,this.model(),"Change Bars Pattern Flipping")),this.bindControl(new c(e,this._linetool.properties().color,!0,this.model(),"Change Bars Pattern Color")),this.bindControl(new h(o,this._linetool.properties().mode,null,!0,this.model(),"Change Bars Pattern Mode")),this.loadData()},o.prototype.widget=function(){return this._table},inherit(n,r),n.prototype.prepareLayout=function(){var t,e,i,o,n,s,r,a,h;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=$("<tr>"),t.appendTo(this._table),e=$("<td>"),e.html($.t("Price")),e.appendTo(t),i=$("<td>"),i.appendTo(t),o=$("<input type='text'>"),o.appendTo(i),n=$("<td>"),n.html($.t("Bar #")),n.appendTo(t),s=$("<td>"),s.appendTo(t),r=$("<input type='text'>"),r.appendTo(s),r.addClass("ticker"),a=this._linetool.properties().points[0],h=[l(a.price.value())],this.bindControl(new p(o,a.price,h,!1,this.model(),"Change "+this._linetool+" point price")),this.bindBarIndex(a.bar,r,this.model(),"Change "+this._linetool+" point bar index"),this.loadData()},e.LineToolBarsPatternStylesPropertyPage=o,e.LineToolBarsPatternInputsPropertyPage=n},function(t,e,i){"use strict";function o(t,e,i){l.call(this,t,e),this._linetool=i,this.prepareLayout()}function n(t,e,i){s.call(this,t,e,i),this.prepareLayout()}var s=i(261),r=i(273),a=i(262),l=a.PropertyPage,h=a.SliderBinder,c=i(55).createTransparencyEditor;inherit(o,r),o.prototype.prepareLayout=function(){var t,e,o,n,s,a,l=i(258),h=$('<table class="property-page" cellspacing="0" cellpadding="0">'),c=$('<table class="property-page" cellspacing="0" cellpadding="0">').data({"layout-tab":l.TAB_NAME_INPUTS,"layout-tab-priority":l.TAB_PRIORITY_INPUTS});this._table=h.add(c),r.prototype.prepareLayoutForTable.call(this,h),t=$("<tr>").appendTo(c),$("<td>").append($.t("Avg HL in minticks")).appendTo(t),e=$("<td>").appendTo(t),o=$("<input type='text'>").addClass("ticker").appendTo(e),t=$("<tr>").appendTo(c),$("<td>").append($.t("Variance")).appendTo(t),n=$("<td>").appendTo(t),s=$("<input type='text'>").addClass("ticker").appendTo(n),a=this._linetool.properties(),this.bindInteger(o,a.averageHL,$.t("Change Average HL value"),1,5e4),this.bindInteger(s,a.variance,$.t("Change Variance value"),1,100),this.loadData()},o.prototype.widget=function(){return this._table},inherit(n,s),n.prototype.prepareLayout=function(){var t,e,i,o,n,s,r,a,l,d,p;this._widget=$("<div>"),t=$("<table cellspacing=4>").appendTo(this._widget),e=this.createColorPicker(),i=this.createColorPicker(),o=this.createColorPicker(),n=this.createColorPicker(),s=this.createColorPicker(),r=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(n).add(s)),a=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(o)),l=this.addLabeledRow(t,$.t("Candles")),$("<td>").prependTo(l),$("<td>").append(e).appendTo(l),$("<td>").append(i).appendTo(l),l=this.addLabeledRow(t,$.t("Borders"),r),$("<td>").append(r).prependTo(l),$("<td>").append(n).appendTo(l),$("<td>").append(s).appendTo(l),$("<td>").appendTo(l),l=this.addLabeledRow(t,$.t("Wick"),a),$("<td>").append(a).prependTo(l),$("<td>").append(o).appendTo(l),$("<td>").appendTo(l),t=$("<table>").appendTo(this._widget),l=$("<tr>").appendTo(t),$("<td colspan='2'>").append($.t("Transparency")).appendTo(l),d=c(),$("<td colspan='2'>").append(d).appendTo(l),p=this._linetool.properties(),this.bindColor(e,p.candleStyle.upColor,"Change Candle Up Color"),this.bindColor(i,p.candleStyle.downColor,"Change Candle Down Color"),this.bindBoolean(a,p.candleStyle.drawWick,"Change Candle Wick Visibility"),this.bindColor(o,p.candleStyle.wickColor,"Change Candle Wick Color"),this.bindBoolean(r,p.candleStyle.drawBorder,"Change Candle Border Visibility"),this.bindColor(n,p.candleStyle.borderUpColor,"Change Candle Up Border Color"),this.bindColor(s,p.candleStyle.borderDownColor,"Change Candle Down Border Color"),this.bindControl(new h(d,p.transparency,!0,this.model(),"Change Guest Feed Transparency"))},n.prototype.widget=function(){return this._widget},e.LineToolGhostFeedInputsPropertyPage=o,e.LineToolGhostFeedStylesPropertyPage=n},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SimpleComboBinder,h=s.SliderBinder,c=s.SimpleStringBinder,d=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,o,n,s,p=this.createColorPicker(),u=this.createFontSizeEditor(),_=this.createFontEditor(),f=this.createTextEditor(350,200),g=this.createColorPicker(),m=d(),v=this.createColorPicker(),y=$('<input type="checkbox">'),b=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),w=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');this.bindControl(new a(p,this._linetool.properties().color,!0,this.model(),"Change Text Color")),this.bindControl(new l(u,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new l(_,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new c(f,this._linetool.properties().text,null,!0,this.model(),"Change Text")),this.bindControl(new a(g,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().transparency)),this.bindControl(new a(v,this._linetool.properties().bordercolor,!0,this.model(),"Change Text Color")),this.bindControl(new h(m,this._linetool.properties().linewidth,!0,this.model(),"Change Border Width")),this.bindControl(new r(y,this._linetool.properties().wordWrap,!0,this.model(),"Change Text Wrap")),this.bindControl(new r(b,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new r(w,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),t=i(258),e=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab-open",t.TAB_OPEN_OVERRIDE),o=$('<table class="property-page" cellspacing="0" cellpadding="2">'),n=$('<table class="property-page" cellspacing="0" cellpadding="2">'),
this._table=e.add(n).add(o),$(document.createElement("tr")).append($(document.createElement("td")).attr({width:1}).append(p)).append($(document.createElement("td")).attr({width:1}).append(_)).append($(document.createElement("td")).attr({width:1}).append(u)).append($(document.createElement("td")).attr({width:1}).append(b)).append($(document.createElement("td")).append(w)).appendTo(e),$(document.createElement("tr")).append($(document.createElement("td")).attr({colspan:5}).append(f)).appendTo(e),s=this.addLabeledRow(o,"Text Wrap",y),$("<td>").append(y).prependTo(s),s=this.addLabeledRow(n,"Background"),$("<td>").append(g).appendTo(s),s=this.addLabeledRow(n,"Border"),$("<td>").append(v).appendTo(s),$("<td>").append(m).appendTo(s),this.loadData(),setTimeout(function(){f.select(),f.focus()},20)},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding,l=s.BooleanBinder,h=s.SliderBinder,c=i(55),d=c.createLineStyleEditor,p=c.createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,c,u,_,f,g,m,v,y,b,w,S,T,C;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=p(),i=d(),o=this.createColorPicker(),n=this.addLabeledRow(t,$.t("Line")),$("<td>").append(o).appendTo(n),$("<td>").append(e).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n),s=$("<tbody>").appendTo(this._table),c=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),u=$('<input type="checkbox">').appendTo(c),_=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),f=$('<input type="checkbox">').appendTo(_),g=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),m=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=this.addLabeledRow(s,$.t("Left End")),$('<td colspan="3">').appendTo(n).append(g).append(c),n=this.addLabeledRow(s,$.t("Right End")),$('<td colspan="3">').appendTo(n).append(m).append(_),n=this.addLabeledRow(s,$.t("Stats Text Color")),v=this.createColorPicker(),$("<td>").append(v).appendTo(n),this.bindControl(new a(v,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),y=$('<input type="checkbox">'),b=$('<input type="checkbox">'),w=$('<input type="checkbox">'),S=$('<input type="checkbox">'),T=$('<input type="checkbox">'),C=$('<input type="checkbox">'),n=this.addLabeledRow(s,$.t("Show Price Range")),$('<td colspan="3">').appendTo(n).append(y),n=this.addLabeledRow(s,$.t("Show Bars Range")),$('<td colspan="3">').appendTo(n).append(b),n=this.addLabeledRow(s,$.t("Show Date/Time Range")),$('<td colspan="3">').appendTo(n).append(w),n=this.addLabeledRow(s,$.t("Show Distance")),$('<td colspan="3">').appendTo(n).append(S),n=this.addLabeledRow(s,$.t("Show Angle")),$('<td colspan="3">').appendTo(n).append(T),n=this.addLabeledRow(s,$.t("Always Show Stats")),$('<td colspan="3">').appendTo(n).append(C),this.bindControl(new l(u,this._linetool.properties().extendLeft,!0,this.model(),"Change Trend Line Extending Left")),this.bindControl(new l(f,this._linetool.properties().extendRight,!0,this.model(),"Change Trend Line Extending Right")),this.bindControl(new a(o,this._linetool.properties().linecolor,!0,this.model(),"Change Trend Line Color")),this.bindControl(new r(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Trend Line Style")),this.bindControl(new h(e,this._linetool.properties().linewidth,!0,this.model(),"Change Trend Line Width")),this.bindControl(new r(g,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Trend Line Left End")),this.bindControl(new r(m,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Trend Line Right End")),this.bindControl(new l(y,this._linetool.properties().showPriceRange,!0,this.model(),"Change Trend Line Show Price Range")),this.bindControl(new l(b,this._linetool.properties().showBarsRange,!0,this.model(),"Change Trend Line Show Bars Range")),this.bindControl(new l(w,this._linetool.properties().showDateTimeRange,!0,this.model(),"Change Trend Line Show Date/Time Range")),this.bindControl(new l(S,this._linetool.properties().showDistance,!0,this.model(),"Change Trend Line Show Distance")),this.bindControl(new l(T,this._linetool.properties().showAngle,!0,this.model(),"Change Trend Line Show Angle")),this.bindControl(new l(C,this._linetool.properties().alwaysShowStats,!0,this.model(),"Change Trend Line Always Show Stats")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e),this._study=i,this.prepareLayout()}var n=i(262),s=n.PropertyPage,r=n.BooleanBinder,a=n.SimpleComboBinder,l=n.SliderBinder,h=n.ColorBinding,c=i(55),d=c.createLineWidthEditor,p=c.createPlotEditor;inherit(o,s),o.prototype.prepareLayout=function(){var t,e,o,n,s,c,u,_,f,g,m,v,y=this._study.properties();this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=this.addLabeledRow(this._table,"Volume"),e=p(),$("<td>").append(e).appendTo(t),this.bindControl(new a(e,y.styles.vol.plottype,parseInt,!0,this.model(),"Change Volume Plot Style")),o=this._study.metaInfo().version<=46&&"transparency"in y?y.transparency:y.styles.vol.transparency,n=this.createColorPicker(),$("<td>").append(n).appendTo(t),this.bindControl(new h(n,y.palettes.volumePalette.colors[0].color,!0,this.model(),"Change Up Volume color",o)),s=this.createColorPicker(),$("<td>").append(s).appendTo(t),this.bindControl(new h(s,y.palettes.volumePalette.colors[1].color,!0,this.model(),"Change Down Volume color",o)),c=$("<input type='checkbox'>"),$("<td>").appendTo(t),$("<td>").append(c).appendTo(t),$("<td>"+$.t("Price Line")+"</td>").appendTo(t),this.bindControl(new r(c,y.styles.vol.trackPrice,!0,this.model(),"Change Price Line")),u=y.styles.vol_ma,_=this.addLabeledRow(this._table,"Volume MA"),f=p(),$("<td>").append(f).appendTo(_),this.bindControl(new a(f,u.plottype,parseInt,!0,this.model(),"Change Volume MA Plot Style")),$("<td>").html("&nbsp;").appendTo(_),g=this.createColorPicker(),$("<td>").append(g).appendTo(_),this.bindControl(new h(g,u.color,!0,this.model(),"Change Volume MA color",u.transparency)),m=d(),$("<td>").append(m).appendTo(_),this.bindControl(new l(m,u.linewidth,!0,this.model(),"Change Volume MA Line Width")),c=$("<input type='checkbox'>"),$("<td>").append(c).appendTo(_),$("<td>"+$.t("Price Line")+"</td>").appendTo(_),this.bindControl(new r(c,u.trackPrice,!0,this.model(),"Change Price Line")),v=i(270).StudyStylesPropertyPage,v.prototype._putStudyDefaultStyles.call(this,this._table,8)},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.ColorBinding,a=s.SimpleComboBinder,l=s.SliderBinder,h=s.BooleanBinder,c=i(55),d=c.createLineStyleEditor,p=c.createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,c,u,_,f,g,m,v,y,b,w;this._block=$("<div>").addClass("property-page"),t=$('<table cellspacing="0" cellpadding="2">').appendTo(this._block),e=$("<tbody>").appendTo(t),i=p(),o=d(),n=this.createColorPicker(),s=this.addLabeledRow(e,$.t("Line")),$("<td>").append(n).appendTo(s),$("<td>").append(i).appendTo(s),$('<td colspan="3">').append(o.render()).appendTo(s),c=$('<table cellspacing="0" cellpadding="2">').appendTo(this._block),s=this.addLabeledRow(c,$.t("Background"),u),u=$('<input type="checkbox" class="visibility-switch">'),_=this.createColorPicker(),$("<td>").append(u).prependTo(s),$("<td>").append(_).appendTo(s),f=$('<table cellspacing="0" cellpadding="2">').appendTo(this._block),g=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),m=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),v=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),y=$('<input type="checkbox">').appendTo(v),b=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),w=$('<input type="checkbox">').appendTo(b),s=this.addLabeledRow(f,$.t("Left End")),$('<td colspan="3">').appendTo(s).append(g).append(v),s=this.addLabeledRow(f,$.t("Right End")),$('<td colspan="3">').appendTo(s).append(m).append(b),this.bindControl(new r(n,this._linetool.properties().linecolor,!0,this.model(),"Change Curve Line Color")),this.bindControl(new a(o,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Curve Line Style")),this.bindControl(new l(i,this._linetool.properties().linewidth,!0,this.model(),"Change Curve Line Width")),this.bindControl(new h(u,this._linetool.properties().fillBackground,!0,this.model(),"Change Curve Filling")),this.bindControl(new r(_,this._linetool.properties().backgroundColor,!0,this.model(),"Change Curve Background Color",this._linetool.properties().transparency)),this.bindControl(new a(g,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Curve Line Left End")),this.bindControl(new a(m,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Curve Line Right End")),this.bindControl(new h(y,this._linetool.properties().extendLeft,!0,this.model(),"Change Curve Line Extending Left")),this.bindControl(new h(w,this._linetool.properties().extendRight,!0,this.model(),"Change Curve Line Extending Right")),this.loadData()},o.prototype.widget=function(){return this._block},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.FloatBinder,l=s.ColorBinding,h=s.SimpleComboBinder,c=s.SliderBinder,d=i(55),p=d.addColorPicker,u=d.createLineStyleEditor,_=d.createLineWidthEditor,f=d.createTransparencyEditor;inherit(o,n),o.prototype.onResoreDefaults=function(){this._linetool.properties().style.listeners().fire(this._linetool.properties().style)},o.prototype.addLevelEditor=function(t,e,i){var o,n,s,d,f,g,m,v,y,b,w=$("<tr>");w.appendTo(this._table),t?(o=$("<td>"),o.appendTo(w),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),s=$("<td>"),s.appendTo(w),d=$("<input type='text'>"),d.appendTo(s),d.css("width","70px"),this.bindControl(new r(n,e.visible,!0,this.model(),"Change Pitchfork Line Visibility")),this.bindControl(new a(d,e.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))):($("<td></td>").appendTo(w),$("<td>"+$.t("Median")+"</td>").appendTo(w)),f=$("<td class='colorpicker-cell'>"),f.appendTo(w),g=p(f),m=$("<td>"),m.appendTo(w),v=_(),v.appendTo(m),y=$("<td>"),y.appendTo(w),b=u(),b.render().appendTo(y),this.bindControl(new l(g,e.color,!0,this.model(),"Change Pitchfork Line Color",0)),this.bindControl(new h(b,e.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style")),this.bindControl(new c(v,e.linewidth,!0,this.model(),"Change Pitchfork Line Width"))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s;for(this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().median,!1),t=0;t<=8;t++)e="level"+t,this.addLevelEditor($.t("Level {0}").format(t+1),this._linetool.properties()[e],!1);this.addOneColorPropertyWidget(this._table),i=$("<tr>"),i.appendTo(this._table),o=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(o).appendTo(i),this.createLabeledCell("Background",o).appendTo(i),n=f(),$('<td colspan="3">').append(n).appendTo(i),s=$("<select><option value='0'>"+$.t("Original")+"</option><option value='3'>"+$.t("Schiff")+"</option><option value='1'>"+$.t("Modified Schiff")+"</option><option value='2'>"+$.t("Inside")+"</option></select>"),i=$("<tr>"),i.appendTo(this._table),$("<td>"+$.t("Style")+"</td>").appendTo(i),$("<td>").append(s).appendTo(i),this.bindControl(new h(s,this._linetool.properties().style,parseInt,!0,this.model(),"Change Pitchfork Style")),this.bindControl(new r(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfork Background Visibility")),this.bindControl(new c(n,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfork Background Transparency")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.FloatBinder,l=s.ColorBinding,h=s.SimpleComboBinder,c=s.SliderBinder,d=i(55),p=d.addColorPicker,u=d.createLineStyleEditor,_=d.createLineWidthEditor,f=d.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e,i){var o,n,s,d,f,g,m,v,y,b,w=$("<tr>");w.appendTo(this._table),t?(o=$("<td>"),o.appendTo(w),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),s=$("<td>"),s.appendTo(w),d=$("<input type='text'>"),d.appendTo(s),d.css("width","70px"),this.bindControl(new r(n,e.visible,!0,this.model(),"Change Pitchfork Line Visibility")),this.bindControl(new a(d,e.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))):$("<td colspan='2'>"+$.t("Median")+"</td>").appendTo(w),f=$("<td class='colorpicker-cell'>"),f.appendTo(w),g=p(f),m=$("<td>"),m.appendTo(w),v=_(),v.appendTo(m),y=$("<td>"),y.appendTo(w),b=u(),b.render().appendTo(y),this.bindControl(new l(g,e.color,!0,this.model(),"Change Pitchfork Line Color"),0),this.bindControl(new h(b,e.linestyle,parseInt,!0,this.model(),"Change Pitchfan Line Style")),this.bindControl(new c(v,e.linewidth,!0,this.model(),"Change Pitchfan Line Width"))},o.prototype.prepareLayout=function(){var t,e,i,o,n;for(this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().median,!1),t=0;t<=8;t++)e="level"+t,this.addLevelEditor($.t("Level {0}").format(t+1),this._linetool.properties()[e],!1);this.addOneColorPropertyWidget(this._table),i=$("<tr>"),i.appendTo(this._table),o=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(o).appendTo(i),this.createLabeledCell($.t("Background"),o).appendTo(i),n=f(),$('<td colspan="3">').append(n).appendTo(i),this.bindControl(new r(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfan Background Visibility")),this.bindControl(new c(n,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfan Background Transparency")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e){this._chartWidget=t,this._undoModel=e}function n(t,e,i){s.call(this,t,e,i),this.prepareLayout()}var s=i(261),r=i(262),a=r.SimpleStringBinder,l=r.SimpleComboBinder,h=r.ColorBinding,c=r.BooleanBinder,d=i(55).setAbsolutePos;o.prototype.attachSource=function(t,e){this._source=t,this._edit=$("<textarea>"),this._edit.css("width","300"),this._edit.css("height","150"),this._edit.appendTo(this._chartWidget._jqMainDiv),d(this._edit,e),this._edit.val(t.properties().text.value()),this._edit.focus();var i=this._edit;return i.select(),this._binding=new a(i,t.properties().text,null,!0,this._undoModel,"change line tool text"),this._edit.focusout(function(){t.properties().text.setValue(i.val())}),this._edit.mousedown(function(t){return!0}),i},inherit(n,s),n.prototype.prepareLayout=function(){var t,e,i,o,n=this.createColorPicker(),s=this.createColorPicker(),r=this.createFontSizeEditor(),d=this.createFontEditor(),p=this.createTextEditor(350,200),u=this.createColorPicker(),_=$('<input type="checkbox" class="visibility-switch">'),f=$('<input type="checkbox" class="visibility-switch">'),g=$('<input type="checkbox">'),m=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),v=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');this.bindControl(new h(n,this._linetool.properties().color,!0,this.model(),"Change Text Color")),this.bindControl(new l(r,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new l(d,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new a(p,this._linetool.properties().text,null,!0,this.model(),"Change Text")),this.bindControl(new h(u,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().backgroundTransparency)),this.bindControl(new c(_,this._linetool.properties().fillBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new c(f,this._linetool.properties().drawBorder,!0,this.model(),"Change Text Border")),this.bindControl(new h(s,this._linetool.properties().borderColor,!0,this.model(),"Change Text Border Color")),this.bindControl(new c(g,this._linetool.properties().wordWrap,!0,this.model(),"Change Text Wrap")),this.bindControl(new c(m,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new c(v,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),t=$('<table class="property-page" cellspacing="0" cellpadding="2">'),e=$('<table class="property-page" cellspacing="0" cellpadding="2">'),i=$('<table class="property-page" cellspacing="0" cellpadding="2">'),this._table=t.add(i).add(e),$(document.createElement("tr")).append($(document.createElement("td")).attr({width:1}).append(n)).append($(document.createElement("td")).attr({width:1}).append(d)).append($(document.createElement("td")).attr({width:1}).append(r)).append($(document.createElement("td")).attr({width:1}).append(m)).append($(document.createElement("td")).append(v)).appendTo(t),$(document.createElement("tr")).append($(document.createElement("td")).attr({colspan:5}).append(p)).appendTo(t),o=this.addLabeledRow(e,$.t("Text Wrap"),g),$("<td>").append(g).prependTo(o),o=this.addLabeledRow(i,$.t("Background"),_),$("<td>").append(_).prependTo(o),$("<td>").append(u).appendTo(o),o=this.addLabeledRow(i,$.t("Border"),f),$("<td>").append(f).prependTo(o),$("<td>").append(s).appendTo(o),this.loadData(),setTimeout(function(){p.select(),p.focus()},20)},n.prototype.widget=function(){return this._table},n.prototype.dialogPosition=function(t,e){var i,o,n,s,r,a,l,h=5,c=0,d=this._linetool,p=d._model.paneForSource(d),u=this._model._chartWidget;return $.each(u.paneWidgets(),function(t,e){if(e._state===p)return c=$(e.canvas).offset().top,!1}),t||(t={}),o=t.left,n=t.top,s=(this._linetool.paneViews()||[])[0],s&&(i=s._floatPoints[0]),i&&(o=i.x,n=i.y+c),r=$(e).outerHeight(),a=$(window).height(),l=d.properties().fontsize.value(),n=n+r+l+h<=a?n+l+h:n-r-h,{top:n,left:o}},t.exports=n},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.ColorBinding,a=s.BooleanBinder,l=s.SliderBinder,h=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=h(),e=this.createColorPicker(),i=this.addLabeledRow(this._table,"Border"),i.prepend("<td>"),$("<td>").append(e).appendTo(i),$("<td>").append(t).appendTo(i),o=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,"Background",o),$("<td>").append(o).prependTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new a(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Rectangle Filling")),this.bindControl(new r(e,this._linetool.properties().color,!0,this.model(),"Change Rectangle Line Color")),this.bindControl(new r(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Rectangle Background Color",this._linetool.properties().transparency)),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Rectangle Border Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SliderBinder,h=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=h(),e=this.createColorPicker(),i=this.addLabeledRow(this._table,$.t("Border")),i.prepend("<td>"),$("<td>").append(e).appendTo(i),$("<td>").append(t).appendTo(i),o=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,$.t("Background"),o),$("<td>").append(o).prependTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new r(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Ellipse Filling")),this.bindControl(new a(e,this._linetool.properties().color,!0,this.model(),"Change Ellipse Line Color")),this.bindControl(new a(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Ellipse Background Color",this._linetool.properties().transparency)),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Ellipse Border Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SliderBinder,h=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=h(),e=this.createColorPicker(),i=this.addLabeledRow(this._table,"Border"),i.prepend("<td>"),$("<td>").append(e).appendTo(i),$("<td>").append(t).appendTo(i),o=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,"Background",o),$("<td>").append(o).prependTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new r(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Arc Filling")),this.bindControl(new a(e,this._linetool.properties().color,!0,this.model(),"Change Arc Line Color")),this.bindControl(new a(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Arc Background Color",this._linetool.properties().transparency)),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Arc Border Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SliderBinder,h=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=h(),e=this.createColorPicker(),i=this.addLabeledRow(this._table,$.t("Border")),i.prepend("<td>"),$("<td>").append(e).appendTo(i),$("<td>").append(t).appendTo(i),o=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,$.t("Background"),o),$("<td>").append(o).prependTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new r(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Triangle Filling")),this.bindControl(new a(e,this._linetool.properties().color,!0,this.model(),"Change Triangle Line Color")),this.bindControl(new a(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Triangle Background Color",this._linetool.properties().transparency)),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Triangle Border Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SimpleComboBinder,h=s.SliderBinder,c=i(55),d=c.createLineStyleEditor,p=c.createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,c,u,_,f,g,m,v,y,b,w,S;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=$("<tbody>").appendTo(this._table),e=p(),i=d(),o=this.createColorPicker(),n=$("<tr>").appendTo(t),$("<td></td><td>"+$.t("Channel")+"</td>").appendTo(n),$("<td>").append(o).appendTo(n),$("<td>").append(e).appendTo(n),$("<td>").append(i.render()).appendTo(n),n=$("<tr>").appendTo(t),s=$("<td>").appendTo(n),c=$("<input type='checkbox' class='visibility-switch'>"),c.appendTo(s),this.createLabeledCell("Middle",c).appendTo(n),u=p(),_=d(),f=this.createColorPicker(),$("<td>").append(f).appendTo(n),$("<td>").append(u).appendTo(n),$("<td>").append(_.render()).appendTo(n),n=$("<tr>").appendTo(t),g=$("<td>").appendTo(n),m=$("<input type='checkbox' class='visibility-switch'>"),m.appendTo(g),this.createLabeledCell("Background",m).appendTo(n),v=this.createColorPicker(),$("<td>").append(v).appendTo(n),y=$("<tbody>").appendTo(this._table),b=this.addEditorRow(y,"Extend Left",$("<input type='checkbox'>"),2),w=this.addEditorRow(y,"Extend Right",$("<input type='checkbox'>"),2),S=this._linetool.properties(),this.bindControl(new r(m,S.fillBackground,!0,this.model(),"Change Parallel Channel Fill Background")),this.bindControl(new r(c,S.showMidline,!0,this.model(),"Change Parallel Channel Show Center Line")),this.bindControl(new r(b,S.extendLeft,!0,this.model(),"Change Parallel Channel Extending Left")),this.bindControl(new r(w,S.extendRight,!0,this.model(),"Change Parallel Channel Extending Right")),this.bindControl(new a(o,S.linecolor,!0,this.model(),"Change Parallel Channel Color")),this.bindControl(new l(i,S.linestyle,parseInt,!0,this.model(),"Change Parallel Channel Style")),this.bindControl(new h(e,S.linewidth,!0,this.model(),"Change Parallel Channel Width")),this.bindControl(new a(f,S.midlinecolor,!0,this.model(),"Change Parallel Channel Middle Color")),this.bindControl(new l(_,S.midlinestyle,parseInt,!0,this.model(),"Change Parallel Channel Middle Style")),this.bindControl(new h(u,S.midlinewidth,!0,this.model(),"Change Parallel Channel Middle Width")),this.bindControl(new a(v,S.backgroundColor,!0,this.model(),"Change Parallel Channel Back Color",S.transparency)),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleStringBinder,a=s.ColorBinding,l=s.SimpleComboBinder;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">').css({width:"100%"}),t=$("<input type='text'>").css({width:"100%"}),e=$('<div class="property-page-fullwidth-wrapper">').append(t),i=this.createColorPicker(),o=this.createFontEditor(),n=$("<tr>").appendTo(this._table),$("<td>").css({width:"0"}).html($.t("Text")).appendTo(n),$('<td colspan="2">').append(e).appendTo(n),n=this.addLabeledRow(this._table,"Text Font"),n.children().css({whiteSpace:"nowrap"}),$("<td>").append(i).appendTo(n).css({width:"0"}),$("<td>").append(o).appendTo(n),this.bindControl(new a(i,this._linetool.properties().color,!0,this.model(),"Change Arrow Mark Text Color")),this.bindControl(new r(t,this._linetool.properties().text,null,!0,this.model(),"Change Arrow Mark Text")),this.bindControl(new l(o,this._linetool.properties().font,null,!0,this.model(),"Change Arrow Mark Font")),this.loadData(),setTimeout(function(){t.select(),t.focus()},20)},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=this.createColorPicker(),e=this.createFontSizeEditor(),i=this.createColorPicker(),o=this.createColorPicker(),n=this.addLabeledRow(this._table,$.t("Text")),$("<td>").append(t).appendTo(n),$("<td>").append(e).appendTo(n),n=this.addLabeledRow(this._table,$.t("Background")),$("<td>").append(i).appendTo(n),n=this.addLabeledRow(this._table,$.t("Border")),$("<td>").append(o).appendTo(n),this.bindControl(new a(t,this._linetool.properties().color,!0,this.model(),"Change Price Text Color")),this.bindControl(new r(e,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Price Text Font Size")),this.bindControl(new a(i,this._linetool.properties().backgroundColor,!0,this.model(),"Change Background Color",this._linetool.properties().transparency)),this.bindControl(new a(o,this._linetool.properties().borderColor,!0,this.model(),"Change Border Color")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding,l=s.SimpleStringBinder;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,o,n,s,h,c,d,p=i(258),u=$('<table class="property-page" cellspacing="0" cellpadding="0">').css({width:"100%"}).data("layout-tab-open",p.TAB_OPEN_OVERRIDE),_=$('<table class="property-page" cellspacing="0" cellpadding="0">');this._table=u.add(_),t=$("<input type='text'>").css({width:"100%"}),e=this.createColorPicker(),o=this.createFontSizeEditor(),n=this.createColorPicker(),s=this.createColorPicker(),h=$("<tr>").appendTo(u),c=$('<div class="property-page-fullwidth-wrapper">').append(t),$("<td>").append(c).appendTo(h),d=this.addLabeledRow(_,$.t("Text")),$("<td>").append(e).appendTo(d),$("<td>").append(o).appendTo(d),d=this.addLabeledRow(_,$.t("Background")),$("<td>").appendTo(d).append(n),d=this.addLabeledRow(_,$.t("Border")),$("<td>").appendTo(d).append(s),$("<td>"),this.bindControl(new l(t,this._linetool.properties().text,null,!0,this.model(),"Change Balloon Text")),this.bindControl(new a(e,this._linetool.properties().color,!0,this.model(),"Change Balooon Text Color")),this.bindControl(new r(o,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Balloon Text Font Size")),this.bindControl(new a(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Balloon Background Color",this._linetool.properties().transparency)),this.bindControl(new a(s,this._linetool.properties().borderColor,!0,this.model(),"Change Balloon Border Color")),this.loadData(),setTimeout(function(){t.select(),t.focus()},0)},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SliderBinder,a=s.BooleanBinder,l=s.ColorBinding,h=s.SimpleComboBinder,c=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,d,p;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=c(),e=this.createColorPicker(),i=$('<input type="checkbox" class="visibility-switch">'),o=this.createColorPicker(),n=this.addLabeledRow(this._table,"Line"),$("<td>").prependTo(n),$("<td>").append(e).appendTo(n),$("<td>").append(t).appendTo(n),n=this.addLabeledRow(this._table,"Background",i),$("<td>").append(i).prependTo(n),$("<td>").append(o).appendTo(n),s=$("<tbody>").appendTo(this._table),d=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),
p=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=this.addLabeledRow(s,$.t("Left End")),$("<td>").prependTo(n),$('<td colspan="3">').appendTo(n).append(d),n=this.addLabeledRow(s,$.t("Right End")),$("<td>").prependTo(n),$('<td colspan="3">').appendTo(n).append(p),this.bindControl(new l(e,this._linetool.properties().linecolor,!0,this.model(),"Change Brush Color")),this.bindControl(new r(t,this._linetool.properties().linewidth,!0,this.model(),"Change Brush Line Width")),this.bindControl(new a(i,this._linetool.properties().fillBackground,!0,this.model(),"Change Brush Filling")),this.bindControl(new l(o,this._linetool.properties().backgroundColor,!0,this.model(),"Change Brush Background Color",this._linetool.properties().transparency)),this.bindControl(new h(d,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Trend Line Left End")),this.bindControl(new h(p,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Trend Line Right End")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.ColorBinding,a=s.SliderBinder,l=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,h,c,d,p,u,_,f,g,m,v,y,b,w=$('<table class="property-page" cellspacing="0" cellpadding="2">'),S=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),T=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._table=w.add(S).add(T),t=this.createColorPicker(),e=l(),i=this.addLabeledRow(w,"Line"),$("<td>").append(t).appendTo(i),$("<td>").append(e).appendTo(i),o=$("<tr>").appendTo(S),n=$("<td>").appendTo(o).css({"vertical-align":"top",width:"50%"}),s=$("<td>").appendTo(o).css({"vertical-align":"top",width:"50%"}),h=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo(n),c=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo(s),d=this.addColorPickerRow(h,$.t("Source back color")),p=this.addColorPickerRow(h,$.t("Source text color")),u=this.addColorPickerRow(h,$.t("Source border color")),_=this.addColorPickerRow(h,$.t("Success back color")),f=this.addColorPickerRow(h,$.t("Success text color")),g=this.addColorPickerRow(c,$.t("Target back color")),m=this.addColorPickerRow(c,$.t("Target text color")),v=this.addColorPickerRow(c,$.t("Target border color")),y=this.addColorPickerRow(c,$.t("Failure back color")),b=this.addColorPickerRow(c,$.t("Failure text color")),this.bindControl(new r(t,this._linetool.properties().linecolor,!0,this.model(),"Forecast Line Color")),this.bindControl(new a(e,this._linetool.properties().linewidth,!0,this.model(),"Forecast Line Width")),this.bindControl(new r(t,this._linetool.properties().linecolor,!0,this.model(),"Forecast Line Color")),this.bindControl(new a(e,this._linetool.properties().linewidth,!0,this.model(),"Forecast Line Width")),this.bindControl(new r(d,this._linetool.properties().sourceBackColor,!0,this.model(),"Forecast Source Background Color",this._linetool.properties().transparency)),this.bindControl(new r(u,this._linetool.properties().sourceStrokeColor,!0,this.model(),"Forecast Source Border Color")),this.bindControl(new r(p,this._linetool.properties().sourceTextColor,!0,this.model(),"Forecast Source Text Color")),this.bindControl(new r(g,this._linetool.properties().targetBackColor,!0,this.model(),"Forecast Target Background Color")),this.bindControl(new r(v,this._linetool.properties().targetStrokeColor,!0,this.model(),"Forecast Target Border Color")),this.bindControl(new r(m,this._linetool.properties().targetTextColor,!0,this.model(),"Forecast Target Text Color")),this.bindControl(new r(_,this._linetool.properties().successBackground,!0,this.model(),"Forecast Success Back Color")),this.bindControl(new r(f,this._linetool.properties().successTextColor,!0,this.model(),"Forecast Success Text Color")),this.bindControl(new r(y,this._linetool.properties().failureBackground,!0,this.model(),"Forecast Failure Back Color")),this.bindControl(new r(b,this._linetool.properties().failureTextColor,!0,this.model(),"Forecast Failure Text Color")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SliderBinder,h=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=h(),e=this.createColorPicker(),i=this.addLabeledRow(this._table,"Border"),i.prepend("<td>"),$("<td>").append(e).appendTo(i),$("<td>").append(t).appendTo(i),o=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,"Background",o),$("<td>").append(o).prependTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new r(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Polyline Filling")),this.bindControl(new a(e,this._linetool.properties().linecolor,!0,this.model(),"Change Polyline Line Color")),this.bindControl(new a(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Polyline Background Color",this._linetool.properties().transparency)),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Polyline Border Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.FloatBinder,l=s.ColorBinding,h=s.SliderBinder,c=i(55),d=c.addColorPicker,p=c.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e,i){var o,n,s,h,c,p,u=$("<tr>");u.appendTo(t),o=$("<td>"),o.appendTo(u),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),s=$("<td>"),s.appendTo(u),h=$("<input type='text'>"),h.appendTo(s),h.css("width","70px"),this.bindControl(new r(n,i.visible,!0,this.model(),"Change Gann Square Line Visibility")),this.bindControl(new a(h,i.coeff,!1,this.model(),"Change Pitchfork Line Coeff")),c=$("<td class='colorpicker-cell'>"),c.appendTo(u),p=d(c),this.bindControl(new l(p,i.color,!0,this.model(),"Change Gann Square Line Color",0))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,a,l,c,d,u,_,f,g,m,v,y,b,w;for(this._table=$(document.createElement("table")),this._table.addClass("property-page property-page-unpadded"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this._table.css({width:"100%"}),t=$("<tbody>").appendTo(this._table),e=$("<tr>"),e.appendTo(t),i=$('<td width="50%">'),i.appendTo(e),o=$('<td width="50%">'),o.appendTo(e),n=$('<table cellspacing="0" cellpadding="2">'),n.appendTo(i),n.addClass("property-page"),s=$('<table cellspacing="0" cellpadding="2">'),s.appendTo(o),s.addClass("property-page"),$("<tr><td align='center' colspan='4'>"+$.t("Price Levels")+"</td></tr>").appendTo(n),$("<tr><td align='center' colspan='4'>"+$.t("Time Levels")+"</td></tr>").appendTo(s),a=1;a<=7;a++)l="hlevel"+a,this.addLevelEditor(n,$.t("Level {0}").format(a),this._linetool.properties()[l]);for(a=1;a<=7;a++)l="vlevel"+a,this.addLevelEditor(s,$.t("Level {0}").format(a),this._linetool.properties()[l]);this.addOneColorPropertyWidget(n),o.css({"vertical-align":"top"}),c=$("<input type='checkbox' class='visibility-switch'>"),d=$("<input type='checkbox' class='visibility-switch'>"),u=$("<input type='checkbox' class='visibility-switch'>"),_=$("<input type='checkbox' class='visibility-switch'>"),f=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),g=$("<tr>").appendTo(f),m=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(g)),v=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(g)),y=this.addLabeledRow(m,$.t("Left Labels"),c),$("<td>").append(c).prependTo(y),y=this.addLabeledRow(v,$.t("Right Labels"),d),$("<td>").append(d).prependTo(y),y=this.addLabeledRow(m,$.t("Top Labels"),u),$("<td>").append(u).prependTo(y),y=this.addLabeledRow(v,$.t("Bottom Labels"),_),$("<td>").append(_).prependTo(y),this.bindControl(new r(c,this._linetool.properties().showLeftLabels,!0,this.model(),"Change Gann Square Left Labels Visibility")),this.bindControl(new r(d,this._linetool.properties().showRightLabels,!0,this.model(),"Change Gann Square Right Labels Visibility")),this.bindControl(new r(u,this._linetool.properties().showTopLabels,!0,this.model(),"Change Gann Square Top Labels Visibility")),this.bindControl(new r(_,this._linetool.properties().showBottomLabels,!0,this.model(),"Change Gann Square Bottom Labels Visibility")),this._table=this._table.add(f),y=$("<tr>"),y.appendTo(m),b=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(b).appendTo(y),w=p(),$("<td>").append(w).appendTo(y),this.bindControl(new r(b,this._linetool.properties().fillHorzBackground,!0,this.model(),"Change Gann Square Background Visibility")),this.bindControl(new h(w,this._linetool.properties().horzTransparency,!0,this.model(),"Change Gann Square Background Transparency")),y=$("<tr>"),y.appendTo(v),b=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(b).appendTo(y),w=p(),$("<td>").append(w).appendTo(y),this.bindControl(new r(b,this._linetool.properties().fillVertBackground,!0,this.model(),"Change Gann Square Background Visibility")),this.bindControl(new h(w,this._linetool.properties().vertTransparency,!0,this.model(),"Change Gann Square Background Transparency")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.SliderBinder,l=s.ColorBinding,h=i(55),c=h.addColorPicker,d=h.createLineWidthEditor,p=h.createTransparencyEditor;inherit(o,n),o.prototype.addOneColorPropertyWidget=function(t){var e=this.createOneColorForAllLinesWidget(),i=$("<tr>");i.append($("<td>")).append($("<td>")).append(e.editor).append($("<td>").append(e.label)),i.appendTo(t)},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,h,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A;this._table=$(document.createElement("table")),this._table.addClass("property-page property-page-unpadded"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this._table.css({width:"100%"}),t=$("<tr>"),t.appendTo(this._table),e=this._linetool.properties(),i=$("<table>"),$("<td valign='top'>").append(i).appendTo(t),o=$("<tr>"),$("<td colspan='3'>"+$.t("Levels")+"</td>").appendTo(o),o.appendTo(i);for(n in e.levels._childs)s=e.levels[n],h=$("<tr>"),h.appendTo(i),$("<td>"+n+"</td>").appendTo(h),u=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(u).appendTo(h),_=$("<td class='colorpicker-cell'>"),_.appendTo(h),f=c(_),g=$("<td>"),g.appendTo(h),m=d(),m.appendTo(g),this.bindControl(new r(u,s.visible,!0,this.model(),"Change Gann Line Visibility")),this.bindControl(new l(f,s.color,!0,this.model(),"Change Gann Line Color",0)),this.bindControl(new a(m,s.width,!0,this.model(),"Change Gann Line Width"));v=$("<table>"),$("<td valign='top'>").append(v).appendTo(t),y=$("<tr>"),$("<td colspan='4'>"+$.t("Fans")+"</td>").appendTo(y),y.appendTo(v);for(n in e.fanlines._childs)b=e.fanlines[n],w=$("<tr>"),w.appendTo(v),u=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(u).appendTo(w),S=b.x.value()+"x"+b.y.value(),$("<td>"+S+"</td>").appendTo(w),_=$("<td class='colorpicker-cell'>"),_.appendTo(w),f=c(_),g=$("<td>"),g.appendTo(w),m=d(),m.appendTo(g),this.bindControl(new r(u,b.visible,!0,this.model(),"Change Gann Line Visibility")),this.bindControl(new l(f,b.color,!0,this.model(),"Change Gann Fan Color",0)),this.bindControl(new a(m,b.width,!0,this.model(),"Change Gann Line Width"));T=$("<table>"),$("<td valign='top'>").append(T).appendTo(t),C=$("<tr>"),$("<td colspan='4'>"+$.t("Arcs")+"</td>").appendTo(C),C.appendTo(T);for(n in e.arcs._childs)x=e.arcs[n],P=$("<tr>"),P.appendTo(T),u=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(u).appendTo(P),S=x.x.value()+"x"+x.y.value(),$("<td>"+S+"</td>").appendTo(P),_=$("<td class='colorpicker-cell'>"),_.appendTo(P),f=c(_),g=$("<td>"),g.appendTo(P),m=d(),m.appendTo(g),this.bindControl(new r(u,x.visible,!0,this.model(),"Change Gann Line Visibility")),this.bindControl(new l(f,x.color,!0,this.model(),"Change Gann Arc Color",0)),this.bindControl(new a(m,x.width,!0,this.model(),"Change Gann Line Width"));this.addOneColorPropertyWidget(T),L=$("<tbody>").appendTo(this._table),k=$('<input type="checkbox" class="visibility-switch">'),E=p(),I=$("<tr>").appendTo(L),A=$("<table>"),$('<td colspan="3">').append(A).appendTo(I),I=$("<tr>").appendTo(A),$("<td>"+$.t("Background")+"</td>").appendTo(I),$("<td>").append(k).appendTo(I),$("<td>").append(E).appendTo(I),this.bindControl(new r(k,this._linetool.properties().arcsBackground.fillBackground,!0,this.model(),"Change Gann Square Filling")),this.bindControl(new a(E,this._linetool.properties().arcsBackground.transparency,!0,this.model(),"Change Gann Square Background Transparency"))},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SimpleComboBinder,h=s.SliderBinder,c=i(55),d=c.addColorPicker,p=c.createLineStyleEditor,u=c.createLineWidthEditor,_=c.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e,i,o){var n,s,c,_,f,g,m,v,y,b,w=$("<tr>");w.appendTo(this._tbody),n="control-level-"+i+"-"+o,s=$("<td>"),s.appendTo(w),c=$("<input type='checkbox' class='visibility-switch' id='"+n+"'>"),c.appendTo(s),_=this.createLabeledCell(t).appendTo(w),_.find("label").attr("for",n),f=$("<td class='colorpicker-cell'>"),f.appendTo(w),g=d(f),m=$("<td>"),m.appendTo(w),v=u(),v.appendTo(m),y=$("<td>"),y.appendTo(w),b=p(),b.render().appendTo(y),this.bindControl(new r(c,e.visible,!0,this.model(),"Change Gann Fan Line Visibility")),this.bindControl(new a(g,e.color,!0,this.model(),"Change Gann Fan Line Color",0)),this.bindControl(new l(b,e.linestyle,parseInt,!0,this.model(),"Change Gann Fan Line Style")),this.bindControl(new h(v,e.linewidth,!0,this.model(),"Change Gann Fan Line Width"))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,a,l,c,d,p=$('<table class="property-page" cellspacing="0" cellpadding="2">'),u=$('<table class="property-page" cellspacing="0" cellpadding="2">');for(this._tbody=$("<tbody>").appendTo(p),t=1;t<=9;t++)e="level"+t,i=this._linetool.properties()[e],o=i.coeff1.value(),n=i.coeff2.value(),s="<sup>"+o+"</sup>&frasl;<sub>"+n+"</sub>",this.addLevelEditor(s,i,o,n);this.addOneColorPropertyWidget(this._tbody),a=$("<input type='checkbox' class='visibility-switch'>"),l=this.addLabeledRow(u,$.t("Labels"),a),$("<td>").append(a).prependTo(l),this.bindControl(new r(a,this._linetool.properties().showLabels,!0,this.model(),"Change Gann Fan Labels Visibility")),this._table=p.add(u),l=$("<tr>"),l.appendTo(this._table),c=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(c).appendTo(l),this.createLabeledCell($.t("Background"),c).appendTo(l),d=_(),$('<td colspan="3">').append(d).appendTo(l),this.bindControl(new r(c,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfan Background Visibility")),this.bindControl(new h(d,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfan Background Transparency")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.FloatBinder,a=s.SimpleComboBinder,l=s.BooleanBinder,h=s.ColorBinding,c=s.SliderBinder,d=i(55),p=d.addColorPicker,u=d.createLineStyleEditor,_=d.createLineWidthEditor,f=d.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e,i){var o,n,s,d,f,g,m,v,y,b,w=$("<tr>");w.appendTo(this._table),o=$("<td>"),o.appendTo(w),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),t?(s=$("<td>"),s.appendTo(w),d=$("<input type='text'>"),d.appendTo(s),d.css("width","70px"),this.bindControl(new r(d,e.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell("Trend Line",n).appendTo(w),f=$("<td class='colorpicker-cell'>"),f.appendTo(w),g=p(f),m=$("<td>"),m.appendTo(w),v=_(),v.appendTo(m),t||(y=$("<td>"),y.appendTo(w),b=u(),b.render().appendTo(y),this.bindControl(new a(b,e.linestyle,parseInt,!0,this.model(),"Change Fib Circle Style"))),this.bindControl(new l(n,e.visible,!0,this.model(),"Change Fib Circle Visibility")),this.bindControl(new h(g,e.color,!0,this.model(),"Change Fib Circle Line Color",0)),this.bindControl(new c(v,e.linewidth,!0,this.model(),"Change Fib Circle Width"))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,r;for(this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().trendline,!1),t=1;t<=11;t++)e="level"+t,this.addLevelEditor("Level "+t,this._linetool.properties()[e],!1);this.addOneColorPropertyWidget(this._table),i=$("<input type='checkbox' class='visibility-switch'>"),o=this.addLabeledRow(this._table,"Levels",i),$("<td>").append(i).prependTo(o),n=$("<input type='checkbox' class='visibility-switch'>"),o=this.addLabeledRow(this._table,"Coeffs As Percents",n),$("<td>").append(n).prependTo(o),this.bindControl(new l(i,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Circle Levels Visibility")),o=$("<tr>"),o.appendTo(this._table),s=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(s).appendTo(o),this.createLabeledCell("Background",s).appendTo(o),r=f(),$('<td colspan="3">').append(r).appendTo(o),this.bindControl(new l(s,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfork Background Visibility")),this.bindControl(new c(r,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfork Background Transparency")),this.bindControl(new l(n,this._linetool.properties().coeffsAsPercents,!0,this.model(),"Change Fib Retracement Coeffs As Percents")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.FloatBinder,a=s.BooleanBinder,l=s.SliderBinder,h=s.SimpleComboBinder,c=s.ColorBinding,d=i(55),p=d.addColorPicker,u=d.createLineStyleEditor,_=d.createLineWidthEditor,f=d.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e,i){var o,n,s,d,f,g,m,v,y,b,w=$("<tr>");w.appendTo(this._table),o=$("<td>"),o.appendTo(w),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),t?(s=$("<td>"),s.appendTo(w),d=$("<input type='text'>"),d.appendTo(s),d.css("width","70px"),this.bindControl(new r(d,e.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell($.t("Trend Line"),n).appendTo(w),f=$("<td class='colorpicker-cell'>"),f.appendTo(w),g=p(f),m=$("<td>"),m.appendTo(w),v=_(),v.appendTo(m),y=$("<td>"),y.appendTo(w),b=u(),b.render().appendTo(y),this.bindControl(new a(n,e.visible,!0,this.model(),"Change Pitchfork Line Visibility")),this.bindControl(new c(g,e.color,!0,this.model(),"Change Pitchfork Line Color",0)),this.bindControl(new h(b,e.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style")),this.bindControl(new l(v,e.linewidth,parseInt,this.model(),"Change Pitchfork Line Width"))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,r,c,d,p,u;for(this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().trendline,!1),t=1;t<=11;t++)e="level"+t,this.addLevelEditor($.t("Level {0}").format(t),this._linetool.properties()[e],!1);this.addOneColorPropertyWidget(this._table),i=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),o=$("<tr>").appendTo(i),$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(o)),$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(o)),n=$("<input type='checkbox' class='visibility-switch'>"),s=this.addLabeledRow(this._table,$.t("Show Labels"),n),$("<td>").append(n).prependTo(s),r=$("<table cellspacing='0' cellpadding='0'>"),c=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),d=$("<select><option value='top'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='bottom'>"+$.t("bottom")+"</option></select>"),s=$("<tr>"),s.append("<td>"+$.t("Labels")+"</td>").append(c).append("<td>&nbsp</td>").append(d),s.appendTo(r),s=$("<tr>"),$("<td colspan='5'>").append(r).appendTo(s),s.appendTo(this._table),this.bindControl(new h(c,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Trend-Based Fib Time Labels Alignment")),this.bindControl(new h(d,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Trend-Based Fib Time Labels Alignment")),s=$("<tr>"),s.appendTo(this._table),p=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(p).appendTo(s),this.createLabeledCell($.t("Background"),p).appendTo(s),u=f(),$('<td colspan="3">').append(u).appendTo(s),this.bindControl(new a(p,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility")),this.bindControl(new l(u,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency")),this.bindControl(new a(n,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Retracement Extend Lines")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.FloatBinder,h=s.SimpleComboBinder,c=s.SliderBinder,d=i(55),p=d.addColorPicker,u=d.createLineStyleEditor,_=d.createLineWidthEditor,f=d.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e,i){var o,n,s,h,c,d,u=$("<tr>");u.appendTo(t),o=$("<td>"),o.appendTo(u),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),s=$("<td>"),s.appendTo(u),h=$("<input type='text'>"),h.appendTo(s),h.css("width","70px"),this.bindControl(new r(n,i.visible,!0,this.model(),"Change Gann Square Line Visibility")),this.bindControl(new l(h,i.coeff,!1,this.model(),"Change Pitchfork Line Coeff")),c=$("<td class='colorpicker-cell'>"),c.appendTo(u),d=p(c),this.bindControl(new a(d,i.color,!0,this.model(),"Change Gann Square Line Color",0))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,l,d,p,g,m,v,y,b,w,S,T,C,x,P,L,k,E;for(this._table=$(document.createElement("table")),this._table.addClass("property-page property-page-unpadded"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this._table.css({width:"100%"}),t=$("<tbody>").appendTo(this._table),e=$("<tr>"),e.appendTo(t),i=$('<td width="50%">'),i.appendTo(e),o=$('<td width="50%">'),o.appendTo(e),n=$('<table cellspacing="0" cellpadding="2">'),n.appendTo(i),n.addClass("property-page"),s=$('<table cellspacing="0" cellpadding="2">'),s.appendTo(o),s.addClass("property-page"),$("<tr><td align='center' colspan='4'>"+$.t("Price Levels")+"</td></tr>").appendTo(n),$("<tr><td align='center' colspan='4'>"+$.t("Time Levels")+"</td></tr>").appendTo(s),l=1;l<=7;l++)d="hlevel"+l,this.addLevelEditor(n,"Level "+l,this._linetool.properties()[d]);for(l=1;l<=7;l++)d="vlevel"+l,this.addLevelEditor(s,"Level "+l,this._linetool.properties()[d]);this.addOneColorPropertyWidget(n),o.css({"vertical-align":"top"}),p=$("<input type='checkbox' class='visibility-switch'>"),g=$("<input type='checkbox' class='visibility-switch'>"),m=$("<input type='checkbox' class='visibility-switch'>"),v=$("<input type='checkbox' class='visibility-switch'>"),y=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),b=$("<tr>").appendTo(y),w=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(b)),S=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(b)),T=this.addLabeledRow(w,$.t("Left Labels"),p),$("<td>").append(p).prependTo(T),T=this.addLabeledRow(S,$.t("Right Labels"),g),$("<td>").append(g).prependTo(T),T=this.addLabeledRow(w,$.t("Top Labels"),m),$("<td>").append(m).prependTo(T),T=this.addLabeledRow(S,$.t("Bottom Labels"),v),$("<td>").append(v).prependTo(T),this.bindControl(new r(p,this._linetool.properties().showLeftLabels,!0,this.model(),"Change Gann Square Left Labels Visibility")),this.bindControl(new r(g,this._linetool.properties().showRightLabels,!0,this.model(),"Change Gann Square Right Labels Visibility")),this.bindControl(new r(m,this._linetool.properties().showTopLabels,!0,this.model(),"Change Gann Square Top Labels Visibility")),this.bindControl(new r(v,this._linetool.properties().showBottomLabels,!0,this.model(),"Change Gann Square Bottom Labels Visibility")),C=$('<table class="property-page" cellspacing="0" cellpadding="2">'),x=_(),P=u(),L=this.createColorPicker(),k=$("<input type='checkbox' class='visibility-switch'>"),T=this.addLabeledRow(C,$.t("Grid"),k),$("<td>").append(k).prependTo(T),$("<td>").append(L).appendTo(T),$("<td>").append(x).appendTo(T),$("<td>").append(P.render()).appendTo(T),this.bindControl(new r(k,this._linetool.properties().grid.visible,!0,this.model(),"Change Fib Speed Resistance Fan Grid Visibility")),this.bindControl(new a(L,this._linetool.properties().grid.color,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Color",0)),this.bindControl(new h(P,this._linetool.properties().grid.linestyle,parseInt,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Style")),this.bindControl(new c(x,this._linetool.properties().grid.linewidth,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Width")),this._table=this._table.add(y).add(C),T=$("<tr>"),T.appendTo(C),k=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(k).appendTo(T),this.createLabeledCell("Background",k).appendTo(T),E=f(),$('<td colspan="3">').append(E).appendTo(T),this.bindControl(new r(k,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Speed/Resistance Fan Background Visibility")),this.bindControl(new c(E,this._linetool.properties().transparency,!0,this.model(),"Change Fib Speed/Resistance Fan Background Transparency")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding,l=s.SliderBinder,h=i(55),c=h.createLineStyleEditor,d=h.createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=d(),i=c(),o=this.createColorPicker(),n=this.addLabeledRow(t,"Line"),$("<td>").append(o).appendTo(n),$("<td>").append(e).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n),this.bindControl(new a(o,this._linetool.properties().linecolor,!0,this.model(),"Change Fib Spiral Line Color")),this.bindControl(new r(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Fib Spiral Line Style")),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Fib Spiral Line Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.FloatBinder,a=s.BooleanBinder,l=s.ColorBinding,h=s.SimpleComboBinder,c=s.SliderBinder,d=i(55),p=d.addColorPicker,u=d.createLineStyleEditor,_=d.createLineWidthEditor,f=d.createTransparencyEditor;inherit(o,n),o.prototype.addLevelEditor=function(t,e,i){var o,n,s,d,f,g,m,v,y,b,w=$("<tr>");w.appendTo(this._table),o=$("<td>"),o.appendTo(w),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),t?(s=$("<td>"),s.appendTo(w),d=$("<input type='text'>"),d.appendTo(s),d.css("width","70px"),this.bindControl(new r(d,e.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell($.t("Trend Line"),n).appendTo(w),f=$("<td class='colorpicker-cell'>"),f.appendTo(w),g=p(f),m=$("<td>"),m.appendTo(w),v=_(),v.appendTo(m),y=$("<td>"),y.appendTo(w),b=u(),b.render().appendTo(y),this.bindControl(new a(n,e.visible,!0,this.model(),"Change Pitchfork Line Visibility")),this.bindControl(new l(g,e.color,!0,this.model(),"Change Pitchfork Line Color",0)),this.bindControl(new h(b,e.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style")),this.bindControl(new c(v,e.linewidth,parseInt,this.model(),"Change Pitchfork Line Width"))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s,r,l,d;for(this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=1;t<=11;t++)e="level"+t,this.addLevelEditor("Level "+t,this._linetool.properties()[e],!1);this.addOneColorPropertyWidget(this._table),i=$("<input type='checkbox' class='visibility-switch'>"),o=this.addLabeledRow(this._table,$.t("Show Labels"),i),$("<td>").append(i).prependTo(o),n=$("<table cellspacing='0' cellpadding='0'>"),s=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),r=$("<select><option value='top'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='bottom'>"+$.t("bottom")+"</option></select>"),o=$("<tr>"),o.append("<td>"+$.t("Labels")+"</td>").append(s).append("<td>&nbsp</td>").append(r),o.appendTo(n),o=$("<tr>"),$("<td colspan='5'>").append(n).appendTo(o),o.appendTo(this._table),this.bindControl(new h(s,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Fib Time Zone Labels Alignment")),this.bindControl(new h(r,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Fib Time Zone Labels Alignment")),o=$("<tr>"),o.appendTo(this._table),l=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(l).appendTo(o),this.createLabeledCell($.t("Background"),l).appendTo(o),d=f(),$('<td colspan="3">').append(d).appendTo(o),this.bindControl(new a(i,this._linetool.properties().showLabels,!0,this.model(),"Change Fib Time Zone Labels Visibility")),this.bindControl(new c(d,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency")),this.bindControl(new a(l,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.FloatBinder,a=s.BooleanBinder,l=s.ColorBinding,h=s.SliderBinder,c=i(55),d=c.addColorPicker,p=c.createLineWidthEditor,u=c.createTransparencyEditor;
inherit(o,n),o.prototype.addLevelEditor=function(t,e,i){var o,n,s,c,u,_,f,g,m=$("<tr>");m.appendTo(this._table),o=$("<td>"),o.appendTo(m),n=$("<input type='checkbox' class='visibility-switch'>"),n.appendTo(o),t?(s=$("<td>"),s.appendTo(m),c=$("<input type='text'>"),c.appendTo(s),c.css("width","70px"),this.bindControl(new r(c,e.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))):this.createLabeledCell("Trend Line",n).appendTo(m),u=$("<td class='colorpicker-cell'>"),u.appendTo(m),_=d(u),f=$("<td>"),f.appendTo(m),g=p(),g.appendTo(f),this.bindControl(new a(n,e.visible,!0,this.model(),"Change Fib Wedge Visibility")),this.bindControl(new l(_,e.color,!0,this.model(),"Change Fib Wedge Line Color",0)),this.bindControl(new h(g,e.linewidth,!0,this.model(),"Change Fib Wedge Width"))},o.prototype.prepareLayout=function(){var t,e,i,o,n,s;for(this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().trendline,!1),t=1;t<=11;t++)e="level"+t,this.addLevelEditor("Level "+t,this._linetool.properties()[e],!1);this.addOneColorPropertyWidget(this._table),i=$("<input type='checkbox' class='visibility-switch'>"),o=this.addLabeledRow(this._table,"Levels",i),$("<td>").append(i).prependTo(o),this.bindControl(new a(i,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Wedge Levels Visibility")),o=$("<tr>"),o.appendTo(this._table),n=$("<input type='checkbox' class='visibility-switch'>"),$("<td>").append(n).appendTo(o),this.createLabeledCell("Background",n).appendTo(o),s=u(),$('<td colspan="3">').append(s).appendTo(o),this.bindControl(new a(n,this._linetool.properties().fillBackground,!0,this.model(),"Change Wedge Background Visibility")),this.bindControl(new h(s,this._linetool.properties().transparency,!0,this.model(),"Change Wedge Background Transparency")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding,l=s.SliderBinder,h=i(55),c=h.createLineStyleEditor,d=h.createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=d(),e=c(),i=this.createColorPicker(),o=this.addLabeledRow(this._table,"Lines"),$("<td>").append(i).appendTo(o),$("<td>").append(t).appendTo(o),$("<td>").append(e.render()).appendTo(o),this.bindControl(new a(i,this._linetool.properties().linecolor,!0,this.model(),"Change Circle Lines Color")),this.bindControl(new r(e,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Circle Lines Style")),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Circle Lines Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding,l=s.SliderBinder,h=s.BooleanBinder,c=i(55),d=c.createLineStyleEditor,p=c.createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,c,u;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=p(),i=d(),o=this.createColorPicker(),n=this.addLabeledRow(t,$.t("Line")),$("<td>").append(o).appendTo(n),$("<td>").append(e).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n),this._linetool.properties().fillBackground&&($("<td>").prependTo(n),s=$('<input type="checkbox" class="visibility-switch">'),c=this.createColorPicker(),u=$("<tbody>").appendTo(this._table),n=$("<tr>").appendTo(u),$("<td>").append(s).appendTo(n),$("<td>").append($.t("Background")).appendTo(n),$("<td>").append(c).appendTo(n)),this.bindControl(new a(o,this._linetool.properties().linecolor,!0,this.model(),"Change Time Cycles Color")),this.bindControl(new r(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Time Cycles Line Style")),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Time Cycles Line Width")),s&&(this.bindControl(new h(s,this._linetool.properties().fillBackground,!0,this.model(),"Change Time Cycles Filling")),this.bindControl(new a(c,this._linetool.properties().backgroundColor,!0,this.model(),"Change Time Cycles Background Color",this._linetool.properties().transparency)))},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding,l=s.BooleanBinder,h=s.SliderBinder,c=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,d,p,u,_,f,g,m,v;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=c(),i=this.createColorPicker(),o=this.addLabeledRow(t,$.t("Line")),$("<td>").prependTo(o),$("<td>").append(i).appendTo(o),$("<td>").append(e).appendTo(o),n=this.createColorPicker(),s=this.createColorPicker(),d=this.createFontSizeEditor(),p=this.createFontEditor(),u=this.createColorPicker(),_=$('<input type="checkbox" class="visibility-switch">'),f=this.createColorPicker(),g=$('<input type="checkbox" class="visibility-switch">'),this.bindControl(new a(n,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new r(d,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new r(p,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new a(u,this._linetool.properties().labelBackgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().labelBackgroundTransparency)),this.bindControl(new l(_,this._linetool.properties().fillLabelBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new a(f,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().backgroundTransparency)),this.bindControl(new l(g,this._linetool.properties().fillBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new a(s,this._linetool.properties().borderColor,!0,this.model(),"Change Text Border Color")),m=this.addLabeledRow(t,$.t("Background"),g),$("<td>").append(g).prependTo(m),$("<td>").append(f).appendTo(m),v=this.addLabeledRow(t,$.t("Label")),$("<td>").prependTo(v),$("<td>").append(n).appendTo(v),$("<td>").append(p).appendTo(v),$("<td>").append(d).appendTo(v),m=this.addLabeledRow(t,$.t("Label Background"),_),$("<td>").append(_).prependTo(m),$("<td>").append(u).appendTo(m),this.bindControl(new a(i,this._linetool.properties().linecolor,!0,this.model(),"Change Date Range Color")),this.bindControl(new h(e,this._linetool.properties().linewidth,!0,this.model(),"Change Date Range Line Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding,l=s.BooleanBinder,h=s.SliderBinder,c=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,d,p,u,_,f,g,m,v;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=c(),i=this.createColorPicker(),o=this.addLabeledRow(t,$.t("Line")),$("<td>").prependTo(o),$("<td>").append(i).appendTo(o),$("<td>").append(e).appendTo(o),n=this.createColorPicker(),s=this.createColorPicker(),d=this.createFontSizeEditor(),p=this.createFontEditor(),u=this.createColorPicker(),_=$('<input type="checkbox" class="visibility-switch">'),f=this.createColorPicker(),g=$('<input type="checkbox" class="visibility-switch">'),this.bindControl(new a(n,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new r(d,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new r(p,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new a(u,this._linetool.properties().labelBackgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().labelBackgroundTransparency)),this.bindControl(new l(_,this._linetool.properties().fillLabelBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new a(f,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().backgroundTransparency)),this.bindControl(new l(g,this._linetool.properties().fillBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new a(s,this._linetool.properties().borderColor,!0,this.model(),"Change Text Border Color")),m=this.addLabeledRow(t,$.t("Background"),g),$("<td>").append(g).prependTo(m),$("<td>").append(f).appendTo(m),v=this.addLabeledRow(t,$.t("Label")),$("<td>").prependTo(v),$("<td>").append(n).appendTo(v),$("<td>").append(p).appendTo(v),$("<td>").append(d).appendTo(v),m=this.addLabeledRow(t,$.t("Label Background"),_),$("<td>").append(_).prependTo(m),$("<td>").append(u).appendTo(m),this.bindControl(new a(i,this._linetool.properties().linecolor,!0,this.model(),"Change Date Range Color")),this.bindControl(new h(e,this._linetool.properties().linewidth,!0,this.model(),"Change Date Range Line Width")),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SliderBinder,h=s.SimpleComboBinder,c=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,d,p,u,_,f;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=c(),e=this.createColorPicker(),i=this.createColorPicker(),o=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),n=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),s=this.createFontSizeEditor(),d=this.createFontEditor(),p=this.addLabeledRow(this._table,"Border"),p.prepend("<td>"),$("<td>").append(e).appendTo(p),$("<td>").append(t).appendTo(p),u=$('<input type="checkbox" class="visibility-switch">'),_=this.createColorPicker(),d=this.createFontEditor(),p=this.addLabeledRow(this._table,"Background",u),$("<td>").append(u).prependTo(p),$("<td>").append(_).appendTo(p),this.bindControl(new r(u,this._linetool.properties().fillBackground,!0,this.model(),"Change Pattern Filling")),this.bindControl(new a(e,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color")),this.bindControl(new a(i,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color")),this.bindControl(new a(_,this._linetool.properties().backgroundColor,!0,this.model(),"Change Pattern Background Color",this._linetool.properties().transparency)),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Pattern Border Width")),this.bindControl(new h(s,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new h(d,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new r(o,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new r(n,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),f=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(i)).append($(document.createElement("td")).attr({width:1}).append(d)).append($(document.createElement("td")).attr({width:1}).append(s)).append($(document.createElement("td")).css("vertical-align","top").attr({width:1}).append(o)).append($(document.createElement("td")).css("vertical-align","top").append(n)).append($("</tr></table>")),p=this.addLabeledRow(this._table,""),$('<td colspan="5">').append(f).appendTo(p),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.ColorBinding,a=s.SliderBinder,l=s.SimpleComboBinder,h=s.BooleanBinder,c=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,d,p,u;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=c(),e=this.createColorPicker(),i=this.createColorPicker(),o=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),n=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),s=this.createFontSizeEditor(),d=this.createFontEditor(),p=this.addLabeledRow(this._table,"Border"),p.prepend("<td>"),$("<td>").append(e).appendTo(p),$("<td>").append(t).appendTo(p),d=this.createFontEditor(),this.bindControl(new r(e,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color")),this.bindControl(new r(i,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color")),this.bindControl(new a(t,this._linetool.properties().linewidth,!0,this.model(),"Change Pattern Border Width")),this.bindControl(new l(s,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new l(d,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new h(o,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new h(n,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),u=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(i)).append($(document.createElement("td")).attr({width:1}).append(d)).append($(document.createElement("td")).attr({width:1}).append(s)).append($(document.createElement("td")).css("vertical-align","top").attr({width:1}).append(o)).append($(document.createElement("td")).css("vertical-align","top").append(n)).append($("</tr></table>")),p=this.addLabeledRow(this._table,""),$('<td colspan="5">').append(u).appendTo(p),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.ColorBinding,a=s.SimpleComboBinder,l=s.SimpleStringBinder,h=s.BooleanBinder,c=i(42);inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n=this.createColorPicker(),s=this.createFontSizeEditor(),c=this.createFontEditor(),d=this.createTextEditor(350,200),p=this.createColorPicker(),u=this.createColorPicker(),_=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),f=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');this.bindControl(new r(n,this._linetool.properties().textColor,!0,this.model(),"Change Text Color")),this.bindControl(new a(s,this._linetool.properties().fontSize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new a(c,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new l(d,this._linetool.properties().text,null,!0,this.model(),"Change Text")),this.bindControl(new r(p,this._linetool.properties().markerColor,!0,this.model(),"Change Marker and Border Color")),this.bindControl(new r(u,this._linetool.properties().backgroundColor,!0,this.model(),"Change Background Color",this._linetool.properties().backgroundTransparency)),this.bindControl(new h(_,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new h(f,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),t=$('<table class="property-page" cellspacing="0" cellpadding="2">'),e=$('<table class="property-page" cellspacing="0" cellpadding="2">'),i=$('<table class="property-page" cellspacing="0" cellpadding="2">'),this._table=t.add(i).add(e),$(document.createElement("tr")).append($(document.createElement("td")).attr({width:1}).append(n)).append($(document.createElement("td")).attr({width:1}).append(c)).append($(document.createElement("td")).attr({width:1}).append(s)).append($(document.createElement("td")).attr({width:1}).append(_)).append($(document.createElement("td")).append(f)).appendTo(t),$(document.createElement("tr")).append($(document.createElement("td")).attr({colspan:5}).append(d)).appendTo(t),o=this.addLabeledRow(i,$.t("Label")),$("<td>").attr("colspan",2).append(p).appendTo(o),o=this.addLabeledRow(i,$.t("Background")),$("<td>").append(u).appendTo(o),this.loadData(),setTimeout(function(){d.select(),d.focus()},20)},o.prototype.widget=function(){return this._table},o.prototype.dialogPosition=function(t,o){var n,s,r,a,l,h,d,p,u,_,f=i(193).LineToolNote;if(t&&o){for(n=0,s=this._linetool._model.paneForSource(this._linetool),r=c.getChartWidget();n<r.paneWidgets().length;n++)if(r.paneWidgets()[n]._state===s){a=$(r.paneWidgets()[n].canvas).offset().left;break}return l=(this._linetool.paneViews()||[])[0],h=new e.Point(0,0),l&&(h=l._floatPoints[0]||this._linetool._fixedPoints[0]),d=(a||0)+h.x,p=f.TOOLTIP_WIDTH,u=d-p/2,_=o.outerWidth(),t.left<u&&t.left+_+10>u?(t.left-=t.left+_+10-u,t):t.left>u&&t.left<u+p+10?(t.left+=u+p+10-t.left,t):void 0}},t.exports=o}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.BooleanBinder,a=s.ColorBinding,l=s.SliderBinder,h=s.SimpleComboBinder,c=i(55).createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,d,p,u,_,f;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=c(),e=this.createColorPicker(),i=this.createColorPicker(),o=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),n=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),s=this.createFontSizeEditor(),d=this.createFontEditor(),p=this.addLabeledRow(this._table,"Border"),p.prepend("<td>"),$("<td>").append(e).appendTo(p),$("<td>").append(t).appendTo(p),u=$('<input type="checkbox" class="visibility-switch">'),_=this.createColorPicker(),d=this.createFontEditor(),p=this.addLabeledRow(this._table,"Background",u),$("<td>").append(u).prependTo(p),$("<td>").append(_).appendTo(p),this.bindControl(new r(u,this._linetool.properties().fillBackground,!0,this.model(),"Change Pattern Filling")),this.bindControl(new a(e,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color")),this.bindControl(new a(i,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color")),this.bindControl(new a(_,this._linetool.properties().backgroundColor,!0,this.model(),"Change Pattern Background Color",this._linetool.properties().transparency)),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Pattern Border Width")),this.bindControl(new h(s,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new h(d,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new r(o,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new r(n,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),f=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(i)).append($(document.createElement("td")).attr({width:1}).append(d)).append($(document.createElement("td")).attr({width:1}).append(s)).append($(document.createElement("td")).css("vertical-align","top").attr({width:1}).append(o)).append($(document.createElement("td")).css("vertical-align","top").append(n)).append($("</tr></table>")),p=this.addLabeledRow(this._table,""),$('<td colspan="5">').append(f).appendTo(p),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.BooleanBinder,l=s.ColorBinding,h=s.SliderBinder,c=i(55),d=c.createLineStyleEditor,p=c.createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,c,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=p(),i=d(),o=this.createColorPicker(),n=this.addLabeledRow(t,$.t("Line")),$("<td>").append(o).appendTo(n),$("<td>").append(e).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n),n=this.addLabeledRow(t,$.t("Text")),s=this.createColorPicker(),c=this.createFontSizeEditor(),u=this.createFontEditor(),_=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),f=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),$("<td>").append(s).appendTo(n),$("<td>").append(u).appendTo(n),$("<td>").append(c).appendTo(n),$("<td>").append(_).appendTo(n),$("<td>").append(f).appendTo(n),g=$("<tbody>").appendTo(this._table),m=$('<input type="checkbox" class="visibility-switch">'),v=this.createColorPicker(),n=this.addLabeledRow(g,$.t("Background"),m),y=$("<table>"),$('<td colspan="5">').append(y).appendTo(n),n=$("<tr>").appendTo(y),$("<td>").append(m).appendTo(n),$("<td>").append(v).appendTo(n),b=$("<tbody>").appendTo(this._table),w=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),S=$('<input type="checkbox">').appendTo(w),T=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),C=$('<input type="checkbox">').appendTo(T),x=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),P=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=this.addLabeledRow(b,$.t("Left End")),$('<td colspan="3">').appendTo(n).append(x).append(w),n=this.addLabeledRow(b,$.t("Right End")),$('<td colspan="3">').appendTo(n).append(P).append(T),L=$("<tbody>").appendTo(this._table),n=$("<tr>").appendTo(L),k=$("<input type='checkbox'>"),E=$("<label style='display:block'>").append(k).append($.t("Show Prices")),$("<td colspan='2'>").append(E).appendTo(n),this.bindControl(new r(c,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new r(u,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new l(s,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new a(_,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new a(f,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),this.bindControl(new a(k,this._linetool.properties().showPrices,!0,this.model(),"Change Disjoint Angle Show Prices")),this.bindControl(new a(S,this._linetool.properties().extendLeft,!0,this.model(),"Change Disjoint Angle Extending Left")),this.bindControl(new a(C,this._linetool.properties().extendRight,!0,this.model(),"Change Disjoint Angle Extending Right")),this.bindControl(new l(o,this._linetool.properties().linecolor,!0,this.model(),"Change Disjoint Angle Color")),this.bindControl(new r(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Disjoint Angle Style")),this.bindControl(new h(e,this._linetool.properties().linewidth,!0,this.model(),"Change Disjoint Angle Width")),this.bindControl(new r(x,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Disjoint Angle Left End")),this.bindControl(new r(P,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Disjoint Angle Right End")),this.bindControl(new a(m,this._linetool.properties().fillBackground,!0,this.model(),"Change Disjoint Angle Filling")),this.bindControl(new l(v,this._linetool.properties().backgroundColor,!0,this.model(),"Change Disjoint Angle Background Color",this._linetool.properties().transparency)),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262),r=s.SimpleComboBinder,a=s.ColorBinding,l=s.BooleanBinder,h=s.SliderBinder,c=i(55),d=c.createLineStyleEditor,p=c.createLineWidthEditor;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i,o,n,s,c,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$("<tbody>").appendTo(this._table),e=p(),i=d(),o=this.createColorPicker(),n=this.addLabeledRow(t,$.t("Line")),$("<td>").append(o).appendTo(n),$("<td>").append(e).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n),n=this.addLabeledRow(t,$.t("Text")),s=this.createColorPicker(),c=this.createFontSizeEditor(),u=this.createFontEditor(),_=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),f=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),$("<td>").append(s).appendTo(n),$("<td>").append(u).appendTo(n),$("<td>").append(c).appendTo(n),$("<td>").append(_).appendTo(n),$("<td>").append(f).appendTo(n),g=$("<tbody>").appendTo(this._table),m=$('<input type="checkbox" class="visibility-switch">'),v=this.createColorPicker(),n=this.addLabeledRow(g,$.t("Background"),m),y=$("<table>"),$('<td colspan="5">').append(y).appendTo(n),n=$("<tr>").appendTo(y),$("<td>").append(m).appendTo(n),$("<td>").append(v).appendTo(n),b=$("<tbody>").appendTo(this._table),w=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),S=$('<input type="checkbox">').appendTo(w),T=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),C=$('<input type="checkbox">').appendTo(T),x=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),P=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=this.addLabeledRow(b,$.t("Left End")),$('<td colspan="3">').appendTo(n).append(x).append(w),n=this.addLabeledRow(b,$.t("Right End")),$('<td colspan="3">').appendTo(n).append(P).append(T),L=$("<tbody>").appendTo(this._table),n=$("<tr>").appendTo(L),k=$("<input type='checkbox'>"),E=$("<label style='display:block'>").append(k).append($.t("Show Prices")),$("<td colspan='2'>").append(E).appendTo(n),this.bindControl(new r(c,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new r(u,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new a(s,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new l(_,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new l(f,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),this.bindControl(new l(k,this._linetool.properties().showPrices,!0,this.model(),"Change Disjoint Angle Show Prices")),this.bindControl(new l(S,this._linetool.properties().extendLeft,!0,this.model(),"Change Disjoint Angle Extending Left")),this.bindControl(new l(C,this._linetool.properties().extendRight,!0,this.model(),"Change Disjoint Angle Extending Right")),this.bindControl(new a(o,this._linetool.properties().linecolor,!0,this.model(),"Change Disjoint Angle Color")),this.bindControl(new r(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Disjoint Angle Style")),this.bindControl(new h(e,this._linetool.properties().linewidth,!0,this.model(),"Change Disjoint Angle Width")),this.bindControl(new r(x,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Disjoint Angle Left End")),this.bindControl(new r(P,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Disjoint Angle Right End")),this.bindControl(new l(m,this._linetool.properties().fillBackground,!0,this.model(),"Change Disjoint Angle Filling")),this.bindControl(new a(v,this._linetool.properties().backgroundColor,!0,this.model(),"Change Disjoint Angle Background Color",this._linetool.properties().transparency)),this.loadData()},o.prototype.widget=function(){return this._table},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i),this.prepareLayout()}var n=i(261),s=i(262).ColorBinding;inherit(o,n),o.prototype.prepareLayout=function(){var t,e,i;this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),t=this.createColorPicker(),e=this.addLabeledRow(this._table,"Color:"),$("<td>").append(t).appendTo(e),i=this._linetool.properties(),this._div=$("<div>").append(this._table),this.bindControl(new s(t,i.color,!0,this.model(),"Change Icon Color")),this.loadData()},o.prototype.widget=function(){return this._div},t.exports=o},function(t,e,i){"use strict";function o(t,e,i){n.call(this,t,e,i)}var n=i(260);inherit(o,n),t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,e,i){var o,n,s=e.m_model.properties();l.call(this,s,e),o=this._series=e.mainSeries(),this._chart=e.m_model,this._model=e,this._source=i,this._property=s,this._seriesProperty=o.properties(),this._scaleProperty=o.m_priceScale.properties(),this._mainAxisProperty=o.properties().priceAxisProperties,n=null,$.each(e.m_model.panes(),function(t,e){$.each(e.dataSources(),function(t,i){if(i===o)return n=e,!1})}),this._pane=n,this.prepareLayout(),this._themes=[]}var n=i(269),s=i(248).UndoHistory,r=i(258),a=i(262),l=a.PropertyPage,h=a.GreateTransformer,c=a.LessTransformer,d=a.ToIntTransformer,p=a.SimpleStringBinder,u=a.BooleanBinder,_=a.SliderBinder,f=a.ColorBinding,g=a.SimpleComboBinder,m=a.DisabledBinder,v=a.CheckboxWVBinding,y=i(84),b=i(113),w=i(55),S=w.addColorPicker,T=w.createLineStyleEditor,C=w.createLineWidthEditor,x=w.bindPopupMenu,P=i(80).DefaultProperty,L=i(45).availableTimezones,k=i(320);inherit(o,l),inherit(o,n),o.prototype.setScalesOpenTab=function(){this.scalesTab&&this.scalesTab.data("layout-tab-open",r.TAB_OPEN_OVERRIDE)},o.prototype.setTmzOpenTab=function(){this.tmzSessTable&&this.tmzSessTable.data("layout-tab-open",r.TAB_OPEN_OVERRIDE)},o.prototype.prepareLayout=function(){var t,i,o,n,s,r,a,l,w,S,x,P,E,I,A,V,M,D,O,B,R,N,F,z,W,H,U,q,j,Y,G,K,X,Z,J,Q,tt,et,it,ot,nt,st,rt,at,lt,ht,ct,dt,pt,ut,_t,ft,gt,mt,vt,yt,bt,wt,St,Tt,Ct,xt,Pt,Lt,kt,Et,It,At,Vt,$t,Mt,Dt,Ot,Bt,Rt,Nt,Ft,zt,Wt,Ht,Ut,qt,jt,Yt,Gt,Kt,Xt,Zt,Jt,Qt,te,ee,ie,oe,ne,se,re,ae,le,he,ce,de,pe,ue,_e,fe,ge,me,ve,ye,be,we,Se,Te,Ce,xe,Pe,Le,ke,Ee,Ie=this;if(e.enabled("chart_property_page_style")&&(t=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),i=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),o=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),this._prepareSeriesStyleLayout(t,i,o,this._seriesProperty),this._hasSeriesStyleLayout=!0,r=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),A=$('<input type="checkbox">'),V=this.addLabeledRow(r,$.t("Price Line"),A),$("<td>").append(A).prependTo(V),
this.bindControl(new u(A,this._seriesProperty.showPriceLine,!0,this.model(),"Change Price Price Line")),M=C(),$("<td>").append(M).appendTo(V),this.bindControl(new _(M,this._seriesProperty.priceLineWidth,!0,this.model(),"Change Price Line Width")),a=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),D=this.createSeriesMinTickEditor(),O=$("<tr>"),O.appendTo(a),$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(O),$("<td>").append(D).appendTo(O),this.bindControl(new g(D,this._seriesProperty.minTick,null,!0,this.model(),"Change MinTick")),l=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),this._pane&&(this._pane.leftPriceScale().dataSources().indexOf(this._series)!==-1?B="left":this._pane.rightPriceScale().dataSources().indexOf(this._series)!==-1?B="right":this._pane.isOverlay(this._series)&&(B="none")),B&&(R={left:$.t("Scale Left"),right:$.t("Scale Right")},Ie._pane.actionNoScaleIsEnabled(Ie._series)&&(R.none=$.t("Screen (No Scale)")),N=this.createKeyCombo(R).val(B).change(function(){switch(this.value){case"left":Ie._model.move(Ie._series,Ie._pane,Ie._pane.leftPriceScale());break;case"right":Ie._model.move(Ie._series,Ie._pane,Ie._pane.rightPriceScale());break;case"none":Ie._model.move(Ie._series,Ie._pane,null)}}),F=this.addRow(l),$("<td>"+$.t("Scale")+"</td>").appendTo(F),$("<td>").appendTo(F).append(N))),e.enabled("chart_property_page_scales")&&(z=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),W=$('<input type="checkbox">').change(function(){this.checked&&setTimeout(function(){Ie._model.m_model.invalidate(new b(b.LIGHT_UPDATE))},0)}),H=this.addLabeledRow(z,$.t("Auto Scale"),W),U=function(t){this._undoModel.setAutoScaleProperty(this._property,t,Ie._series.priceScale(),this._undoText)},$("<td>").append(W).prependTo(H),this.bindControl(new u(W,this._scaleProperty.autoScale,!0,this.model(),"Auto Scale",U)),this.bindControl(new m(W,this._scaleProperty.autoScaleDisabled,!0,this.model(),"Auto Scale")),q=$('<input type="checkbox">'),j=this.addLabeledRow(z,$.t("Percentage"),q),Y=function(t){this._undoModel.setPercentProperty(this._property,t,Ie._series.priceScale(),this._undoText)},$("<td>").append(q).prependTo(j),this.bindControl(new u(q,this._mainAxisProperty.percentage,!0,this.model(),"Scale Percentage",Y)),this.bindControl(new m(q,this._mainAxisProperty.percentageDisabled,!0,this.model(),"Scale Percentage")),G=$('<input type="checkbox">'),K=this.addLabeledRow(z,$.t("Log Scale"),G),X=function(t){this._undoModel.setLogProperty(this._property,t,Ie._series.priceScale(),this._undoText)},$("<td>").append(G).prependTo(K),this.bindControl(new u(G,this._mainAxisProperty.log,!0,this.model(),"Log Scale",X)),this.bindControl(new m(G,this._mainAxisProperty.logDisabled,!0,this.model(),"Log Scale")),Z=$('<input type="checkbox">').change(function(){this.checked&&setTimeout(function(){Ie._model.m_model.invalidate(new b(b.LIGHT_UPDATE))},0)}),J=this.addLabeledRow(z,$.t("Scale Series Only"),Z),$("<td>").append(Z).prependTo(J),this.bindControl(new u(Z,this._property.scalesProperties.scaleSeriesOnly,!0,this.model(),"Scale Series Only")),Q=$("<input type='checkbox'/>"),tt=this.addLabeledRow(z,$.t("Lock scale"),Q),et=function(t){this._undoModel.setLockScaleProperty(this._property,t,Ie._series,this._undoText)},it=function(t){tt.toggle(t.value()===y.STYLE_PNF)},$("<td>").append(Q).prependTo(tt),this.bindControl(new u(Q,this._seriesProperty.lockScale,!0,this.model(),"Change lock scale",et)),this._seriesProperty.style.listeners().subscribe(this,it),ot=$("<input type='checkbox'/>"),nt=this.addLabeledRow(z,$.t("Track time"),ot),$("<td>").append(ot).prependTo(nt),this.bindControl(new v(ot,this._model.trackTime(),null,"Change track time")),st=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),rt=$('<input type="text" class="ticker">'),at=this.addLabeledRow(st,$.t("Top Margin"),rt),$("<td>").appendTo(at).append(rt),$("<td>%</td>").appendTo(at),lt=[d(this._property.paneProperties.topMargin.value())],lt.push(c(25)),lt.push(h(0)),this.bindControl(new p(rt,this._property.paneProperties.topMargin,lt,!0,this.model(),"Top Margin")),ht=$('<input type="text" class="ticker">'),ct=this.addLabeledRow(st,$.t("Bottom Margin"),ht),$("<td>").appendTo(ct).append(ht),$("<td>%</td>").appendTo(ct),dt=[d(this._property.paneProperties.bottomMargin.value())],dt.push(c(25)),dt.push(h(0)),this.bindControl(new p(ht,this._property.paneProperties.bottomMargin,dt,!0,this.model(),"Bottom Margin")),pt=$('<input type="text" class="ticker">'),ut=this.addLabeledRow(st,$.t("Right Margin"),pt),$("<td>").appendTo(ut).append(pt),$("<td>"+$.t("bars",{context:"margin"})+"</td>").appendTo(ut),_t=[d(this._property.timeScale.rightOffset.value())],_t.push(c(~~this._chart.m_timeScale.maxOffset())),_t.push(h(-200)),this.bindControl(new p(pt,this._property.timeScale.rightOffset,_t,!0,this.model(),"Right Margin")),ft=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),gt=$("<input type='checkbox' />"),mt=this.addLabeledRow(ft,$.t("Left Axis"),gt),$("<td>").append(gt).prependTo(mt),setTimeout(function(){this.bindControl(new u(gt,this._property.scalesProperties.showLeftScale,!0,this.model(),"Show Left Axis"))}.bind(this),0),vt=$("<input type='checkbox' />"),yt=this.addLabeledRow(ft,$.t("Right Axis"),vt),$("<td>").append(vt).prependTo(yt),setTimeout(function(){this.bindControl(new u(vt,this._property.scalesProperties.showRightScale,!0,this.model(),"Show Right Axis"))}.bind(this),0),e.enabled("countdown")&&(bt=$("<input type='checkbox'>"),wt=this.addLabeledRow(ft,$.t("Countdown"),bt),$("<td>").append(bt).prependTo(wt),this.bindControl(new u(bt,this._seriesProperty.showCountdown,!0,this.model(),"Change Show Countdown"))),St=$('<input type="checkbox">'),Tt=this.addLabeledRow(ft,$.t("Symbol Last Value"),St),$("<td>").append(St).prependTo(Tt),this.bindControl(new u(St,this._property.scalesProperties.showSeriesLastValue,!0,this.model(),"Change Symbol Last Value Visibility")),Ct=$('<input type="checkbox">'),xt=this.addLabeledRow(ft,$.t("Indicator Last Value"),Ct),$("<td>").append(Ct).prependTo(xt),this.bindControl(new u(Ct,this._property.scalesProperties.showStudyLastValue,!0,this.model(),"Change Indicator Last Value Visibility")),Pt=$('<input type="checkbox">'),Lt=this.addLabeledRow(ft,$.t("Symbol Labels"),Pt),$("<td>").append(Pt).prependTo(Lt),this.bindControl(new u(Pt,this._property.scalesProperties.showSymbolLabels,!0,this.model(),"Show Symbol Labels")),kt=$('<input type="checkbox">'),Et=this.addLabeledRow(ft,$.t("Indicator Labels"),kt),$("<td>").append(kt).prependTo(Et),this.bindControl(new u(kt,this._property.scalesProperties.showStudyPlotLabels,!0,this.model(),"Show Study Plots Labels")),It=$("<input type='checkbox' />"),At=this.addLabeledRow(ft,$.t("Precise Labels"),It),$("<td>").append(It).prependTo(At),this.bindControl(new u(It,this._scaleProperty.alignLabels,!0,this.model(),"Precise Labels")),Vt=$('<div class="property-page-column-2">').append(z).append(st),$t=$('<div class="property-page-column-2">').append(ft),w=$("<div>").css("min-width","420px").data("layout-tab",$.t("Scales")),w.append(Vt).append($t),this.scalesTab=w),e.enabled("chart_property_page_background")&&(Mt=$('<table class="property-page" cellspacing="0" cellpadding="2">'),Dt=this.createColorPicker({hideTransparency:!0}),Ot=this.addLabeledRow(Mt,$.t("Background")),$('<td colspan="2">').append(Dt).appendTo(Ot),this.bindControl(new f(Dt,this._property.paneProperties.background,!0,this.model(),"Change Chart Background Color")),Bt=this.addLabeledRow(Mt,$.t("Vert Grid Lines")),Rt=this.createColorPicker(),$("<td>").append(Rt).appendTo(Bt),this.bindControl(new f(Rt,this._property.paneProperties.vertGridProperties.color,!0,this.model(),"Change Vert Grid Lines Color")),Nt=T(),$('<td colspan="2">').append(Nt.render()).appendTo(Bt),this.bindControl(new g(Nt,this._property.paneProperties.vertGridProperties.style,parseInt,!0,this.model(),"Change Vert Grid Lines Style")),Ft=this.addLabeledRow(Mt,$.t("Horz Grid Lines")),zt=this.createColorPicker(),$("<td>").append(zt).appendTo(Ft),this.bindControl(new f(zt,this._property.paneProperties.horzGridProperties.color,!0,this.model(),"Change Horz Grid Lines Color")),Wt=T(),$('<td colspan="2">').append(Wt.render()).appendTo(Ft),this.bindControl(new g(Wt,this._property.paneProperties.horzGridProperties.style,parseInt,!0,this.model(),"Change Horz Grid Lines Style")),Ht=this.createColorPicker(),Ut=this.addLabeledRow(Mt,$.t("Scales Text")),$("<td>").append(Ht).appendTo(Ut),this.bindControl(new f(Ht,this._property.scalesProperties.textColor,!0,this.model(),"Change Scales Text Color")),qt=this.createFontSizeEditor(),$("<td>").append(qt).appendTo(Ut),this.bindControl(new g(qt,this._property.scalesProperties.fontSize,parseInt,!0,this.model(),"Change Scales Font Size")),jt=this.createColorPicker(),Yt=this.addLabeledRow(Mt,$.t("Scales Lines")),$('<td colspan="2">').append(jt).appendTo(Yt),this.bindControl(new f(jt,this._property.scalesProperties.lineColor,!0,this.model(),"Change Scales Lines Color")),Gt=this.addLabeledRow(Mt,$.t("Watermark")),Kt=this.createColorPicker(),$("<td>").append(Kt).appendTo(Gt),this.bindControl(new f(Kt,this._property.symbolWatermarkProperties.color,!0,this.model(),"Change Symbol Watermark Color",this._property.symbolWatermarkProperties.transparency)),Xt=this.addLabeledRow(Mt,$.t("Crosshair")),Zt=this.createColorPicker(),$("<td>").append(Zt).appendTo(Xt),this.bindControl(new f(Zt,this._property.paneProperties.crossHairProperties.color,!0,this.model(),"Change Crosshair Color",this._property.paneProperties.crossHairProperties.transparency)),Jt=T(),$("<td>").append(Jt.render()).appendTo(Xt),this.bindControl(new g(Jt,this._property.paneProperties.crossHairProperties.style,parseInt,!0,this.model(),"Change Crosshair Style")),Qt=C(),$("<td>").append(Qt).appendTo(this.addRow(Mt).prepend("<td/><td/>")),this.bindControl(new _(Qt,this._property.paneProperties.crossHairProperties.width,!0,this.model(),"Change Crosshair Width")),te=$('<table class="property-page">'),ee=this.addLabeledRow(te,$.t("Navigation Buttons"),null,!0),ie=[],Object.keys(k.visibilityPropertyAvailableValues).forEach(function(t){ie.push('<option value="',t,'">',k.visibilityPropertyAvailableValues[t],"</option>")}),oe=$("<select>"+ie.join("")+"</select>"),$("<td>").append(oe).appendTo(ee),this.bindControl(new g(oe,k.visibilityProperty,null,!0,this.model(),"Change Navigation Buttons Visibility")),ne=$('<table class="property-page" cellspacing="0" cellpadding="2">'),se=$('<input type="checkbox">'),re=this.addLabeledRow(ne,$.t("Symbol Description"),se),$("<td>").append(se).prependTo(re),this.bindControl(new u(se,this._property.paneProperties.legendProperties.showSeriesTitle,!0,this.model(),"Change Symbol Description Visibility")),ae=$('<input type="checkbox">'),le=this.addLabeledRow(ne,$.t("OHLC Values"),ae),$("<td>").append(ae).prependTo(le),this.bindControl(new u(ae,this._property.paneProperties.legendProperties.showSeriesOHLC,!0,this.model(),"Change OHLC Values Visibility")),he=$('<input type="checkbox">'),ce=this.addLabeledRow(ne,$.t("Indicator Titles"),he),$("<td>").append(he).prependTo(ce),this.bindControl(new u(he,this._property.paneProperties.legendProperties.showStudyTitles,!0,this.model(),"Change Indicator Titles Visibility")),de=$('<input type="checkbox">'),pe=this.addLabeledRow(ne,$.t("Indicator Arguments"),de),ue=function(t){de.prop("disabled",!t.value())},$("<td>").append(de).prependTo(pe),this.bindControl(new u(de,this._property.paneProperties.legendProperties.showStudyArguments,!0,this.model(),"Change Indicator Arguments Visibility")),this._property.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,ue),ue(this._property.paneProperties.legendProperties.showStudyTitles),_e=$('<input type="checkbox">'),fe=this.addLabeledRow(ne,$.t("Indicator Values"),_e),$("<td>").append(_e).prependTo(fe),this.bindControl(new u(_e,this._property.paneProperties.legendProperties.showStudyValues,!0,this.model(),"Change Indicator Values Visibility")),ge=$('<div class="property-page-column-2">').append(Mt),me=$('<div class="property-page-column-2">').append(ne),ve=$('<div class="property-page-column-1">').append(te),S=$("<div>").css("min-width","520px").data("layout-tab",$.t("Background")),S.append(ge).append(me).append(ve)),e.enabled("chart_property_page_timezone_sessions")){for(P=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Timezone/Sessions")),this.tmzSessTable=P,ut=$("<tr>").appendTo(P),ye=$("<td>").appendTo(ut),be=$('<table cellspacing="0" cellpadding="0">').appendTo(ye),we=$("<tr>"),we.appendTo(be),Se=$("<td>"),Se.appendTo(we),Se.text($.t("Time Zone")),Te=$('<td colspan="2" class="tzeditor">'),Te.appendTo(we),Ce="",xe=0;xe<L.length;xe++)Ce+='<option value="'+L[xe].id+'">'+L[xe].title+"</option>";Pe=$("<select>"+Ce+"</select>"),Pe.appendTo(Te),this.bindControl(new g(Pe,this._property.timezone,null,!0,this.model(),"Change Timezone")),e.enabled("charting_library_base")||(this._series.createSessStudy(),this.createSessTable(P))}Le=e.enabled("chart_property_page_evetns_alerts")&&(e.enabled("alerts")||TradingView.isFeatureEnabled("esdindicatorfeature"))&&!e.enabled("charting_library_base"),Le&&(ke=e.enabled("alerts")?$.t("Events & Alerts"):$.t("Events"),I=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",ke),this.createEventsTable(I)),Ee=e.enabled("trading_options")||e.enabled("chart_property_page_trading"),Ee&&(E=this.createTradingTable()),n=$('<table class="property-page" cellspacing="0" cellpadding="2">'),s=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}).data("layout-separated",!0),x=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Drawings")),this._table=$().add(t).add(i).add(o).add(n).add(s).add(r).add(l).add(a).add(w).add(S).add(x).add(P).add(E).add(I),this.loadData()},o.prototype.widget=function(){return this._table},o.prototype.loadData=function(){this.superclass.prototype.loadData.call(this),this.switchStyle()},o.prototype.loadTheme=function(t){var e=this;$.get("/theme/?themeName="+encodeURIComponent(t),function(i){e._model._lastLoadedTheme=t,e.applyTheme(JSON.parse(i.content))})},o.prototype.applyTheme=function(t){var e=this._seriesProperty.extendedHours.value();this._model.model().restoreTheme(t),this._seriesProperty.extendedHours.value()!==e&&this._seriesProperty.extendedHours.listeners().fire(this._seriesProperty.extendedHours),this.loadData()},o.prototype.createTemplateButton=function(t){var i,o,n;return e.enabled("chart_property_page_template_button")?(i=this,t||(t={}),o=function(){var e,o=[];return o.push({title:$.t("Save As..."),action:function(){runOrSignIn(function(){TradingView.showThemeSaveDialog(i._model)},{source:"Save theme in chart properties"})},addClass:"special"}),"function"==typeof t.defaultsCallback&&o.push({title:$.t("Apply Defaults"),action:t.defaultsCallback,addClass:"special"}),e=[],$.each(i._themes,function(t,o){e.push({title:$.t(o),action:function(){i.loadTheme(o)},deleteAction:is_authenticated?function(){var t=this,e=$.t("Do you realy want to delete theme",{theme:o?'"'+o+'"':""});TVDialogs.showConfirm($.t("Theme"),e,function(){t instanceof $&&t.remove(),$.post("/remove-theme/",{name:o}).error(function(t){TradingView.logError(t.responseText)}),TradingView.getThemesList.invalidate();for(var e=i._themes.length;e--;)i._themes[e]===o&&i._themes.splice(e,1)})}:void 0})}),e.length&&(e.sort(function(t,e){return t=t.title.toUpperCase(),e=e.title.toUpperCase(),t===e?0:t>e?1:-1}),o.push({separator:!0}),o=o.concat(e)),o},n=$('<a href="#" class="_tv-button">'+$.t("Themes")+'<span class="icon-dropdown"></span></a>'),x(n,null,{direction:"up",event:"button-popup",notCloseOnButtons:!0}),n.bind("click",function(){var t=$(this);t.is(".active")||TradingView.getThemesList(function(e){i._themes=e,t.trigger("button-popup",[o(),!0])})}),n):$("<span />")},o.prototype.switchStyle=function(){if(this._hasSeriesStyleLayout)switch($(this._barsTbody).add(this._barsColorerTbody).add(this._renkoTbody).add(this._pbTbody).add(this._kagiTbody).add(this._pnfTbody).add(this._candlesTbody).add(this._candlesColorerTbody).add(this._hollowCandlesTbody).add(this._lineTbody).add(this._areaTbody).add(this._haTbody).add(this._haColorerTbody).css("display","none"),this._seriesProperty.style.value()){case y.STYLE_BARS:this._barsTbody.css("display","table-row-group"),this._barsColorerTbody.css("display","table-row-group");break;case y.STYLE_CANDLES:this._candlesTbody.css("display","table-row-group"),this._candlesColorerTbody.css("display","table-row-group");break;case y.STYLE_HOLLOW_CANDLES:this._hollowCandlesTbody.css("display","table-row-group");break;case y.STYLE_LINE:this._lineTbody.css("display","table-row-group");break;case y.STYLE_AREA:this._areaTbody.css("display","table-row-group");break;case y.STYLE_RENKO:this._renkoTbody.css("display","table-row-group");break;case y.STYLE_PB:this._pbTbody.css("display","table-row-group");break;case y.STYLE_KAGI:this._kagiTbody.css("display","table-row-group");break;case y.STYLE_PNF:this._pnfTbody.css("display","table-row-group");break;case y.STYLE_HEIKEN_ASHI:this._haTbody.css("display","table-row-group"),this._haColorerTbody.css("display","table-row-group")}},o.prototype.onResoreDefaults=function(){var t,e=this._model.model().properties().paneProperties.topMargin,i=this._model.model().properties().paneProperties.bottomMargin;e.listeners().fire(e),i.listeners().fire(i),"undefined"!=typeof trading&&(s.setWatchedValue(trading.hideFloatingPanel,!1,"Restore Defaults"),s.setWatchedValue(trading.hideCompletedOrders,!1,"Restore Defaults"),s.setWatchedValue(trading.noConfirmEnabled,!1,"Restore Defaults")),t=this._model.model().properties().timezone,t.listeners().fire(t)},o.prototype.defaultProperties=function(){var t=this,e=[t._seriesProperty.extendedHours,t._property.scalesProperties.showLeftScale,t._property.scalesProperties.showRightScale,t._property.timeScale.rightOffset].map(function(t){return{property:t,previousValue:t.value()}});return setTimeout(function(){e.forEach(function(t){t.property.value()!==t.previousValue&&t.property.listeners().fire(t.property)});var i=new P("chartproperties.paneProperties.rightAxisProperties");$.each(["autoScale","percentage","log"],function(e,o){var n=t._scaleProperty[o],s=i[o].value();s!==n.value()&&n.setValue(s)})},0),[this._property,this._seriesProperty]},o.prototype.createEventsTable=function(t){var i,o,n,s,r,a,l,h,c,d,p,v,y,b,w,x,P,L,k,E,I,A,V,M,D,O,B,R,N,F,z;TradingView.isFeatureEnabled("esdindicatorfeature")&&(i=$("<tr>").appendTo(t),o=$('<input type="checkbox" />'),n=this.addLabeledRow(i,$.t("Show Dividends on Chart"),o),$("<td>").append(o).prependTo(n),n.append("<td>"),this.bindControl(new u(o,this._seriesProperty.esdShowDividends,!0,this.model(),"Change Show or Hide Dividends")),s=$('<input type="checkbox" />'),n=this.addLabeledRow(i,$.t("Show Splits on Chart"),s),$("<td>").append(s).prependTo(n),n.append("<td>"),this.bindControl(new u(s,this._seriesProperty.esdShowSplits,!0,this.model(),"Change Show or Hide Splits")),r=$('<input type="checkbox" />'),n=this.addLabeledRow(i,$.t("Show Earnings on Chart"),r),$("<td>").append(r).prependTo(n),n.append("<td>"),this.bindControl(new u(r,this._seriesProperty.esdShowEarnings,!0,this.model(),"Change Show or Hide Earnings")),a=this.createTableInTable(t),l=$('<input type="checkbox" />'),h=T(),c=C(),n=this.addLabeledRow(a,$.t("Earnings breaks"),l),$("<td>").append(l).prependTo(n),d=S($("<td>").appendTo(n)),$("<td>").append(h.render()).appendTo(n),$("<td>").append(c).appendTo(n),n.addClass("offset-row"),n.append("<td>"),this.bindControl(new u(l,this._seriesProperty.esdShowBreaks,!0,this.model(),"Change Show or Hide Earnings")),this.bindControl(new f(d,this._seriesProperty.esdBreaksStyle.color,!0,this.model(),"Change earnings color")),this.bindControl(new g(h,this._seriesProperty.esdBreaksStyle.style,parseInt,!0,this.model(),"Change style")),this.bindControl(new _(c,this._seriesProperty.esdBreaksStyle.width,!0,this.model(),"Change width")),p=function(t){l.prop("disabled",!t.value())},this._seriesProperty.esdShowEarnings.listeners().subscribe(this,p)),e.enabled("chart_events")&&TradingView.isFeatureEnabled("chart_events")&&(v=$('<input type="checkbox">'),y=$('<input type="checkbox">'),b=$('<input type="checkbox" />'),w=T(),x=C(),P=this.createColorPicker(),L=this._property.chartEventsSourceProperties,this.bindControl(new u(v,L.visible,!0,this.model(),"Change Show Economic Events on Chart")),this.bindControl(new u(y,L.futureOnly,!0,this.model(),"Change Show Only Future Events")),this.bindControl(new m(y,L.visible,!0,this.model(),"",!0)),this.bindControl(new m(b,L.visible,!0,this.model(),"",!0)),this.bindControl(new u(b,L.breaks.visible,!0,this.model(),"Change Show or Hide Events Breaks")),this.bindControl(new f(P,L.breaks.color,!0,this.model(),"Change Events Breaks Color")),this.bindControl(new g(w,L.breaks.style,parseInt,!0,this.model(),"Change Events Breaks Style")),this.bindControl(new _(x,L.breaks.width,!0,this.model(),"Change Events Breaks Width")),k=$("<tr>").appendTo(t),n=this.addLabeledRow(k,$.t("Show Economic Events on Chart"),v),$("<td>").append(v).prependTo(n),E=this.createTableInTable(t),n=this.addLabeledRow(E,$.t("Show Only Future Events"),y),$("<td>").append(y).prependTo(n),n.addClass("offset-row"),I=this.createTableInTable(t),n=this.addLabeledRow(I,$.t("Events Breaks"),b),$("<td>").append(b).prependTo(n),$("<td>").append(P).appendTo(n),$("<td>").append(w.render()).appendTo(n),$("<td>").append(x).appendTo(n),n.addClass("offset-row")),e.enabled("alerts")&&(A=$("<tr>").appendTo(t),V=$('<input type="checkbox" />'),n=this.addLabeledRow(A,$.t("Show Alert Labels"),V),$("<td>").append(V).prependTo(n),n.append("<td>"),M=this._property.alertsProperties.labels.visible,this.bindControl(new u(V,M,!0,this.model(),"Change Show or Hide Alert Labels",function(t){this._model.beginUndoMacro("Show Alert Labels"),this._model.setProperty(M,t,"Show Alert Labels"),this._model.endUndoMacro()}.bind(this))),D=this.createTableInTable(t),O=$('<input type="checkbox">'),B=C(),R=T(),N=R.render(),n=this.addLabeledRow(D,$.t("Extended Alert Line"),O),$("<td>").append(O).prependTo(n),F=S($("<td>").appendTo(n)),$("<td>").append(N).appendTo(n),$("<td>").append(B).appendTo(n),n.addClass("offset-row"),n.append("<td>"),this.bindControl(new u(O,this._property.alertsProperties.labels.line.visible,!0,this.model(),"Change Show or Hide Alert Labels Lines")),this.bindControl(new f(F,this._property.alertsProperties.labels.color,!0,this.model(),"Change Alerts Labels color")),this.bindControl(new g(R,this._property.alertsProperties.labels.line.style,parseInt,!0,this.model(),"Change style")),this.bindControl(new _(B,this._property.alertsProperties.labels.line.width,!0,this.model(),"Change width")),z=function(t){O.prop("disabled",!t.value()),N.prop("disabled",!t.value()),B.prop("disabled",!t.value())},M.listeners().subscribe(this,z))},o.prototype.createSessTable=function(t){var e,i,o,n,s,r=this._series.sessionsStudy().properties(),a=this.createTableInTable(t),l=r.name.value(),h=$("<input type='checkbox' />"),c=this.addLabeledRow(a,$.t("Session Breaks"),h),d=T(),p=this.createColorPicker(),m=C();return $("<td>").append(h).prependTo(c),$("<td>").append(p).appendTo(c),$("<td>").append(d.render()).appendTo(c),$("<td>").append(m).appendTo(c),this.bindControl(new u(h,r.graphics.vertlines.sessBreaks.visible,!0,this.model(),"Change "+l+" visibility")),this.bindControl(new f(p,r.graphics.vertlines.sessBreaks.color,!0,this.model(),"Change "+l+" color")),this.bindControl(new g(d,r.graphics.vertlines.sessBreaks.style,parseInt,!0,this.model(),"Change "+l+" style")),this.bindControl(new _(m,r.graphics.vertlines.sessBreaks.width,!0,this.model(),"Change "+l+" width")),a=this.createTableInTable(t),e=this._extendedHoursEditor=$('<input type="checkbox" />'),c=this.addLabeledRow(a,$.t("Extended Hours (Intraday Only)"),e),$("<td>").append(e).prependTo(c),this.bindControl(new u(e,this._seriesProperty.extendedHours,!0,this.model(),"Change Extended Hours")),this._seriesProperty.sessVis=r.graphics.vertlines.sessBreaks.visible,a=this.createTableInTable(t),i=this._createStudySessRow(a,$.t("Extended Hours"),r.graphics.backgrounds.outOfSession),o=this._createStudySessRow(a,$.t("In Session"),r.graphics.backgrounds.inSession),n=function(t){i.prop("disabled",!t.value()),o.prop("disabled",!t.value())},this._seriesProperty.extendedHours.listeners().subscribe(this,n),n(this._seriesProperty.extendedHours),s=this._series.isIntradayInterval(),h.prop("disabled",!s),a},o.prototype._createStudySessRow=function(t,e,i){var o,n=$("<input type='checkbox' />"),s=this.addLabeledRow(t,e,n),r=S($("<td>").appendTo(s));return this.bindControl(new u(n,i.visible,!0,this.model(),"Change "+e+" visibility")),this.bindControl(new f(r,i.color,!0,this.model(),e+" color",i.transparency)),o=$("<td>"),o.append(n).prependTo(s),s.addClass("offset-row"),n},o.prototype.createTradingTable=function(){var t,e,i,o,n,s,r,a,l,f,m,v=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Trading")),y=$("<tr>").appendTo(v),b=$("<td>").appendTo(y),w=$('<table cellspacing="0" cellpadding="0">').appendTo(b),S=$('<input type="checkbox">');return y=this.addLabeledRow(w,$.t("Show Positions"),S),$("<td>").append(S).prependTo(y),this.bindControl(new u(S,this._property.tradingProperties.showPositions,!0,this.model(),"Change Positions Visibility")),t=$('<input type="checkbox">'),y=this.addLabeledRow(w,$.t("Show Orders"),t),$("<td>").append(t).prependTo(y),this.bindControl(new u(t,this._property.tradingProperties.showOrders,!0,this.model(),"Change Orders Visibility")),e=$('<input type="checkbox">'),i=this.addLabeledRow(w,$.t("Extend Lines Left"),e),$("<td>").append(e).prependTo(i),this.bindControl(new u(e,this._property.tradingProperties.extendLeft,!0,this.model(),"Extend Lines Left")),o=C(),this.bindControl(new _(o,this._property.tradingProperties.lineWidth,!0,this.model(),"Change Connecting Line Width")),n=T(),this.bindControl(new g(n,this._property.tradingProperties.lineStyle,parseInt,!0,this.model(),"Change Connecting Line Style")),s=$('<input type="text" class="ticker">'),r=[d(this._property.tradingProperties.lineLength.value()),c(100),h(0)],this.bindControl(new p(s,this._property.tradingProperties.lineLength,r,!0,this.model(),"Change Connecting Line Length")),a=$("<tbody>"),l=this.addLabeledRow(w,$.t("Connecting Line"),a),$("<td>").prependTo(l),$("<td>").append(o).appendTo(l),$('<td colspan="3">').append(n.render()).appendTo(l),$('<td colspan="3">').append(s).appendTo(l),$("<td>%</td>").appendTo(l),f=$('<input type="checkbox">'),m=this.addLabeledRow(w,$.t("Show Executions"),f),$("<td>").append(f).prependTo(m),this.bindControl(new u(f,this._property.tradingProperties.showExecutions,!0,this.model(),"Change Executions Visibility")),v},t.exports=o}).call(e,i(1))},function(t,e,i){(function(e){"use strict";function o(t){var e,i;o.visibilityProperty.value()||(e="NavigationButtons.visibility",o.visibilityProperty.subscribe(null,function(){var t=o.visibilityProperty.value();t!==TVSettings.getValue(e)&&TVSettings.setValue(e,t),n.subscribeOnEvents("visibleOnMouseOver"===t)}),i=TVSettings.getValue(e,Modernizr.touch?"alwaysOn":"visibleOnMouseOver"),o.visibilityProperty.setValue(i)),this._widgets=[],this._chart=t,o.visibilityProperty.subscribe(null,this._onVisibilityPropertyChanged.bind(this))}var n=i(321);o.visibilityProperty=new e,o.visibilityPropertyAvailableValues={visibleOnMouseOver:$.t("Visible on Mouse Over"),alwaysOn:$.t("Always Visible"),alwaysOff:$.t("Always Invisible")},o.prototype.addWidget=function(t){this._widgets.push(t.widget);var e=$.extend({callback:this._onMouseMove.bind(this)},t);n.addWidget(e),this._updateOpacityState([t.widget])},o.prototype._onVisibilityPropertyChanged=function(){this._updateOpacityState(this._widgets)},o.prototype._updateWidgetVisibility=function(t){t.css("visibility",t._state?"visible":"hidden")},o.prototype._updateOpacityState=function(t,e){void 0===e&&(e="alwaysOn"===o.visibilityProperty.value());var i=this;t.forEach(function(t){if(t._state!==e){t._state=e,t.css("visibility","visible");var o=e?1:0;return t.css("opacity")===o?void i._updateWidgetVisibility(t):void t.animate({opacity:o},i._updateWidgetVisibility.bind(i,t))}})},o.prototype._onMouseMove=function(t,e){this._chart.model().lineBeingCreated()||this._updateOpacityState([t],!e)},t.exports=o}).call(e,i(69))},function(t,e){"use strict";function i(){this._widgets=[],this._mouseDownEventType=Modernizr.touch?"touchstart":"mousedown",this._mouseUpEventType=Modernizr.touch?"touchend":"mouseup",this._mouseMoveEventType=Modernizr.touch?"touchmove":"mousemove",this._omMouseDownHandler=this._onMouseUpDown.bind(this,!0),this._omMouseUpHandler=this._onMouseUpDown.bind(this,!1),this._omMouseMoveHandler=this._onMouseUnderWidget.bind(this),this._subscribed=!1,this.subscribeOnEvents(!0)}i.prototype.subscribeOnEvents=function(t){if(this._subscribed!==t){this._subscribed=t;var e=$(document);t?(e.on(this._mouseDownEventType,this._omMouseDownHandler),e.on(this._mouseMoveEventType,this._omMouseMoveHandler),e.on(this._mouseUpEventType,this._omMouseUpHandler)):(e.off(this._mouseDownEventType,this._omMouseDownHandler),e.off(this._mouseMoveEventType,this._omMouseMoveHandler),e.off(this._mouseUpEventType,this._omMouseUpHandler))}},i.prototype.addWidget=function(t){this._widgets.push(t)},i.prototype._onMouseUpDown=function(t){this._isMousePressed=t},i.prototype._onMouseUnderWidget=function(t){this._isMousePressed||this._widgets.forEach(function(e){var i=e.checkingWidget||e.widget,o=i.offset(),n=t.pageX-o.left,s=t.pageY-o.top,r=i.width(),a=i.height(),l=n<-e.acceptableOffset||s<-e.acceptableOffset||n>r+e.acceptableOffset||s>a+e.acceptableOffset;e.callback(e.widget,l)})},t.exports=new i},function(t,e,i){(function(e){"use strict";function o(t,e,i){s.call(this,t,e),this._linetool=i,this.prepareLayout()}var n=i(262),s=n.PropertyPage,r=n.BooleanBinder,a=n.RangeBinder;inherit(o,s),o.prototype.prepareLayout=function(){var t,i,o,n,s,l,h,c,d,p,u,_;this._block=$("<table>"),t=this._linetool.properties().intervalsVisibilities,e.enabled("seconds_resolution")&&(i=$("<tr>").appendTo(this._block),o=$("<label>").append($.t("Seconds")),n=$("<input type='checkbox'>").addClass("visibility-checker").prependTo(o),$("<td>").css("padding-right","15px").append(o).appendTo(i),s=$("<input type='text'>").addClass("ticker-text"),$("<td>").append(s).appendTo(i),l=$("<div>").addClass("slider-range ui-slider-horizontal"),$("<td>").append(l).appendTo(i),h=$("<input type='text'>").addClass("ticker-text"),$("<td>").append(h).appendTo(i),this.bindControl(new r(n,t.seconds,!0,this.model(),"Change Line Tool Visibility On Seconds")),this.bindControl(new a(l,[t.secondsFrom,t.secondsTo],[1,59],!1,this.model(),[s,h],[$.t("Change Seconds From"),$.t("Change Seconds To")],n))),i=$("<tr>").appendTo(this._block),o=$("<label>").append($.t("Minutes")),c=$("<input type='checkbox'>").addClass("visibility-checker").prependTo(o),$("<td>").css("padding-right","15px").append(o).appendTo(i),s=$("<input type='text'>").addClass("ticker-text"),$("<td>").append(s).appendTo(i),l=$("<div>").addClass("slider-range ui-slider-horizontal"),$("<td>").append(l).appendTo(i),h=$("<input type='text'>").addClass("ticker-text"),$("<td>").append(h).appendTo(i),this.bindControl(new r(c,t.minutes,!0,this.model(),"Change Line Tool Visibility On Minutes")),this.bindControl(new a(l,[t.minutesFrom,t.minutesTo],[1,59],!1,this.model(),[s,h],[$.t("Change Minutes From"),$.t("Change Minutes To")],c)),i=$("<tr>").appendTo(this._block),o=$("<label>").append($.t("Hours")),d=$("<input type='checkbox'>").addClass("visibility-checker").prependTo(o),
$("<td>").append(o).appendTo(i),s=$("<input type='text'>").addClass("ticker-text"),$("<td>").append(s).appendTo(i),l=$("<div>").addClass("slider-range ui-slider-horizontal"),$("<td>").append(l).appendTo(i),h=$("<input type='text'>").addClass("ticker-text"),$("<td>").append(h).appendTo(i),this.bindControl(new r(d,t.hours,!0,this.model(),"Change Line Tool Visibility On Hours")),this.bindControl(new a(l,[t.hoursFrom,t.hoursTo],[1,24],!1,this.model(),[s,h],[$.t("Change Minutes From"),$.t("Change Hours To")],d)),i=$("<tr>").appendTo(this._block),o=$("<label>").append($.t("Days")),p=$("<input type='checkbox'>").addClass("visibility-checker").prependTo(o),$("<td>").append(o).appendTo(i),s=$("<input type='text'>").addClass("ticker-text"),$("<td>").append(s).appendTo(i),l=$("<div>").addClass("slider-range ui-slider-horizontal"),$("<td>").append(l).appendTo(i),h=$("<input type='text'>").addClass("ticker-text"),$("<td>").append(h).appendTo(i),this.bindControl(new r(p,t.days,!0,this.model(),"Change Line Tool Visibility On Days")),this.bindControl(new a(l,[t.daysFrom,t.daysTo],[1,366],!1,this.model(),[s,h],[$.t("Change Minutes From"),$.t("Change Days To")],p)),i=$("<tr>").css("height","29px").appendTo(this._block),o=$("<label>").append($.t("Weeks")),u=$("<input type='checkbox'>").prependTo(o),$("<td>").append(o).appendTo(i),this.bindControl(new r(u,t.weeks,!0,this.model(),"Change Line Tool Visibility On Weeks")),i=$("<tr>").css("height","29px").appendTo(this._block),o=$("<label>").append($.t("Months")),_=$("<input type='checkbox'>").prependTo(o),$("<td>").append(o).appendTo(i),this.bindControl(new r(_,t.months,!0,this.model(),"Change Line Tool Visibility On Months")),this.loadData()},o.prototype.widget=function(){return this._block},t.exports=o}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e,i){s.call(this,t,e),this._study=i,this.prepareLayout()}var n=i(262),s=n.PropertyPage,r=n.GreateTransformer,a=n.LessTransformer,l=n.ToIntTransformer,h=n.ToFloatTransformer,c=n.BooleanBinder,d=n.SimpleComboBinder,p=n.SimpleStringBinder,u=i(82).NumericFormatter;inherit(o,s),o.prototype._getStrategyInputs=function(){for(var t,e=0,i=this._study.metaInfo(),o={};e<i.inputs.length;e++)t=i.inputs[e],"strategy_props"===t.groupId&&(assert(void 0!==t.internalID,"Strategy input id="+t.id+" doesn't have an internalID"),o[t.internalID]=i.inputs[e]);return TradingView.clone(o)},o.prototype._setStdInput=function(t,e,i){var o,n,s,_,f,g,m,v,y,b,w,S;if(t){if(o=t.id,n="study_input-"+o+"-"+Date.now().toString(36)+"-"+Math.random().toString(36),s=$("<tr>").appendTo(this._$table),_="Change "+e,f=$('<label for="'+n+'">'+$.t(e,{context:"input"})+"</label>"),"bool"===t.type)m=$('<td colspan="3">').appendTo(s),g=$('<input id="'+n+'" type="checkbox">').appendTo(m),f.appendTo(m),i!==!0&&this.bindControl(new c(g,this._property.inputs[o],!0,this.model(),_));else if($("<td>").addClass($.t("propertypage-name-label",{context:"css_class"})).append(f).appendTo(s),v=$('<td colspan="2">').appendTo(s),t.options){for(g=$('<select id="'+n+'">').appendTo(v),y=0;y<t.options.length;y++)b=t.options[y],b instanceof jQuery?b.appendTo(g):$('<option value="'+b+'">'+b+"</option>").appendTo(g);i!==!0&&this.bindControl(new d(g,this._property.inputs[o],null,!0,this.model(),_))}else g=$('<input id="'+n+'" type="text">').appendTo(v),i!==!0&&("integer"!==t.type&&"float"!==t.type||(w=["integer"===t.type?l(t.defval):h(t.defval)],(0===t.min||t.min)&&w.push(r(t.min)),(0===t.max||t.max)&&w.push(a(t.max))),S=new p(g,this._property.inputs[o],w,!1,this.model(),_),"float"===t.type&&S.addFormatter(function(t){return(new u).format(t)}),this.bindControl(S)),g.addClass("ticker");return g}},o.prototype._setPyramidingInputs=function(t){var e=t.pyramiding,i=this._property.inputs[e.id],o=this._setStdInput({id:"pyramiding_switch",type:"bool"},$.t("Pyramiding"),!0),n=this._setStdInput(t.pyramiding,$.t("Allow up to")),s=n.closest("tr");assert(void 0===this._onAllowUpToChanged),this._onAllowUpToChanged=function(t){t.value()>0?(o.prop("checked",!0),n.removeAttr("disabled"),s.removeClass("disabled")):(o.prop("checked",!1),n.attr("disabled","disabled"),s.addClass("disabled"))},i.subscribe(null,this._onAllowUpToChanged),o.change(function(){var t=!o.prop("checked");i.setValue(t?0:e.defval),t?n.attr("disabled","disabled"):n.removeAttr("disabled"),s.toggleClass("disabled",t)}),i.value()>0?o.prop("checked",!0):(o.prop("checked",!1),n.attr("disabled","disabled"),s.addClass("disabled")),s.children().last().removeAttr("colspan"),$("<td>").text("orders").appendTo(s)},o.prototype._setQtyInputs=function(t){function e(t){if(t=+t,isNaN(t)||t<0)return 0;var e=s.val();return"percent_of_equity"!==e?t=parseInt(t):t>100&&(t=100),t}var i,o,n,s,r,a,l=this,h=t.default_qty_value,c=$.extend({},t.default_qty_type),d=this._property.inputs[h.id],u=this._setStdInput(h,$.t("Order size"),!0),_=new p(u,d,e,!1,this.model(),"Change Order Size");this.bindControl(_),i=u.closest("td"),i.removeAttr("colspan"),o=this._study.reportData()&&this._study.reportData().currency||"USD",n=$('<option value="cash_per_order">'+o+"</option>"),c.options=[$('<option value="fixed">'+$.t("Contracts")+"</option>"),n,$('<option value="percent_of_equity">'+$.t("% of equity")+"</option>")],s=this._setStdInput(c,"type"),r=s.closest("td"),a=r.closest("tr"),r.removeAttr("colspan"),r.detach().insertAfter(i),a.remove(),this._study.watchedData.subscribe(function(){var t=l._study.reportData()&&l._study.reportData().currency||"USD";n.text(t),s.closest("td").find("a[href=#cash_per_order]").text(t)})},o.prototype._setFillLimitsInputs=function(t){var e=this._setStdInput(t.backtest_fill_limits_assumption,$.t("Verify Price for Limit Orders")),i=e.closest("td");i.removeAttr("colSpan"),$("<td>").text("ticks").insertAfter(i)},o.prototype.prepareLayout=function(){this._$table=$(document.createElement("table")).addClass("property-page strategy-properties").attr("cellspacing","0").attr("cellpadding","2");var t=this._getStrategyInputs();t.initial_capital.min=1,this._setStdInput(t.initial_capital,$.t("Initial capital")),Array.isArray(t.currency.options)&&"NONE"===t.currency.options[0]&&(t.currency.options[0]=$('<option value="NONE">'+$.t("Default")+"</option>")),this._setStdInput(t.currency,$.t("Base currency")),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setPyramidingInputs(t),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setQtyInputs(t),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setStdInput(t.calc_on_order_fills,$.t("Recalculate After Order filled")),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setStdInput(t.calc_on_every_tick,$.t("Recalculate On Every Tick")),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setFillLimitsInputs(t),this.loadData()},o.prototype.widget=function(){return this._$table},o.prototype.loadData=function(){var t,e,i;s.prototype.loadData.call(this),t=this._getStrategyInputs(),e=t.pyramiding,i=this._property.inputs[e.id],i.setValue(i.value(),!0)},o.prototype.destroy=function(){var t,e,i;s.prototype.destroy.call(this),t=this._getStrategyInputs(),e=t.pyramiding,i=this._property.inputs[e.id],i.unsubscribe(null,this._onAllowUpToChanged)},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,e,i){this.pane=t,this._isLeft=o.isLeft(e),this._properties=t.chart().properties().scalesProperties,this._disableContextMenu=!!i,this.jqCell=$(document.createElement("td")),this.jqCell.addClass("chart-markup-table"),this.jqCell.addClass("price-axis"),this.jqCell.width(25),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqCell),this.canvas=f(this._dv,new g(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=f(this._dv,new g(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this._textWidthCache=new s,this.restoreDefaultCursor(),this.update(),m(this.jqCell,this,!0),this.dialog=this.pane.chart().dialog,this.contextMenu=null,this.actions={},this._isVisible=!0,this.priceScale().onMarksChanged.subscribe(this,this.onMarksChanged)}var n=i(74).LineDataSource,s=i(107),r=i(141),a=r.Action,l=r.ActionSeparator,h=i(325),c=i(329),d=i(113),p=i(55),u=p.setCanvasSize,_=p.clearRect,f=p.addCanvasTo,g=p.Size,m=p.setMouseEventHandler,v=i(330);o.prototype._BORDER_SIZE=1,o.prototype._OFFSET_SIZE=1,o.prototype._TICK_LENGTH=3,o.LHS=1,o.RHS=2,o.isLeft=function(t){return t===o.LHS||t!==o.RHS&&(TradingView.logDebugChart("PriceAxisWidget.isLeft: wrong side"),!1)},o.prototype.backgroundColor=function(){return this.pane.chart().properties().paneProperties.background.value()},o.prototype.lineColor=function(){return this._properties.lineColor.value()},o.prototype.textColor=function(){return this._properties.textColor.value()},o.prototype.fontSize=function(){return this._properties.fontSize.value()},o.prototype.baseFont=function(){return TradingView.makeFont(this.fontSize(),"Arial","")},o.prototype.rendererOptions=function(){var t,e,i;return this._rendererOptions||(this._rendererOptions={isLeft:this._isLeft,width:0,height:0,borderSize:this._BORDER_SIZE,offsetSize:this._OFFSET_SIZE,tickLength:this._TICK_LENGTH,fontSize:NaN,font:"",widthCache:new s,_tickmarksCache:new c(11,"Arial","","#000"),color:""}),t=this._rendererOptions,e=!1,t.color!==this.textColor()&&(t.color=this.textColor(),e=!0),t.fontSize!==this.fontSize()&&(i=this.fontSize(),t.fontSize=i,t.font=this.baseFont(),t.paddingTop=Math.floor(i/4.5),t.paddingBottom=Math.ceil(i/4.5),t.paddingInner=Math.max(Math.ceil(i/3-t.tickLength/2),0),t.paddingOuter=Math.ceil(i/3),t.baselineOffset=Math.round(i/10),t.widthCache.reset(),e=!0),e&&t._tickmarksCache.reset(t.fontSize,"Arial","",t.color),this.size&&(t.width=this.size.w,t.height=this.size.h),this._rendererOptions},o.prototype.mouseDownEvent=function(t){var e,i;this.priceScale().isEmpty()||(e=this.pane.chart().model(),i=this.pane.state(),this._mousedown=!0,this.jqCell.css("cursor",v("cursor_size_vertical","15 15")),e.startScalePrice(i,this.priceScale(),t.localY))},o.prototype.pressedMouseMoveEvent=function(t){var e=this.pane.chart().model(),i=this.pane.state(),o=this.priceScale();e.scalePriceTo(i,o,t.localY)},o.prototype.mouseDownOutsideEvent=function(t){var e=this.pane.chart().model(),i=this.pane.state(),o=this.priceScale();this._mousedown&&(this._mousedown=!1,e.endScalePrice(i,o),this.restoreDefaultCursor())},o.prototype.mouseUpEvent=function(t){var e=this.pane.chart().model(),i=this.pane.state(),o=this.priceScale();this._mousedown=!1,e.endScalePrice(i,o),this.restoreDefaultCursor()},o.prototype._initActions=function(t){var e,n,s,r,l;this.pane.state()&&(e=i(262).ActionBinder,n=this,this.actions.reset=new a({text:$.t("Reset Scale")}),this.actions.reset.callbacks().subscribe(this,o.prototype.reset),s=function(t){this._undoModel.setLockScaleProperty(this._property,t.checked,n.priceScale().mainSource(),this._undoText)},delete this.actions.setLockScale,this.priceScale().mainSource()instanceof TradingView.Series&&(this.actions.setLockScale=new a({text:$.t("Lock Scale"),checkable:!0,checked:this.priceScale().mainSource().properties().lockScale.value()}),this._lockScaleBinding=new e(this.actions.setLockScale,this.priceScale().mainSource().properties().lockScale,this.pane.chart().model(),"Undo LockScale",s),this._lockScaleBinding.setValue(this.priceScale().mainSource().properties().lockScale.value())),r=function(){this._undoModel.setAutoScaleProperty(this._property,this.value(),n.priceScale(),this._undoText)},this.actions.setAutoScale=new a({text:$.t("Auto Scale"),checkable:!0,checked:!0}),this._autoScaleBinding=new e(this.actions.setAutoScale,this.priceScale().properties().autoScale,this.pane.chart().model(),"Undo AutoScale",r),this._autoScaleBinding.setValue(this._autoScaleBinding.property().value()),this.actions.setPercentage=new a({text:$.t("Percentage",{context:"scale_menu"}),checkable:!0,checked:!1}),l=function(){this._undoModel.setPercentProperty(this._property,this.value(),n.priceScale(),this._undoText)},this.actions.setPercentage.binding=new e(this.actions.setPercentage,this.priceScale().properties().percentage,this.pane.chart().model(),"Undo Percentage",l),this.actions.setLog=new a({text:$.t("Log Scale",{context:"scale_menu"}),checkable:!0,checked:!1}),this.actions.setLog.binding=new e(this.actions.setLog,this.priceScale().properties().log,this.pane.chart().model(),"Undo Log Scale"),this.actions.alignLabels=new a({text:$.t("Precise Labels",{context:"scale_menu"}),checkable:!0,checked:!1}),this.actions.alignLabels.binding=new e(this.actions.alignLabels,this.priceScale().properties().alignLabels,this.pane.chart().model(),"Precise Labels"),this._updateScalesActions())},o.prototype._updateScalesActions=function(){var t=this.priceScale(),e=t.mainSource()instanceof TradingView.Series,i=t.mainSource().properties();this.actions.setPercentage.setEnabled(!(t.isLog()||e&&i.lockScale.value()||e&&i.style.value()===TradingView.Series.STYLE_PNF)),this.actions.setLog.setEnabled(!(t.isPercent()||e&&i.lockScale.value()||e&&i.style.value()===TradingView.Series.STYLE_PNF)),this.actions.setAutoScale.setChecked(t._properties.autoScale.value()),this.actions.setAutoScale.setEnabled(!t.properties().autoScaleDisabled.value())},o.prototype.mouseClickEvent=function(t){},o.prototype.mouseDoubleClickEvent=function(t){this.reset(),TradingView.trackEvent("GUI","Double click price scale")},o.prototype.contextMenuEvent=function(t,i){!this._disableContextMenu&&e.enabled("scales_context_menu")&&this._createContextMenu().show(t)},o.prototype._createContextMenu=function(){return h.createMenu(this.getContextMenuActions())},o.prototype.getContextMenuActions=function(){var t,i;return this._initActions(),t=this.pane.chart().actions(),i=[this.actions.reset,new l,t.showLeftAxis,t.showRightAxis,new l,this.actions.setAutoScale,t.scaleSeriesOnly,new l,this.actions.setPercentage,this.actions.setLog,new l,t.showSymbolLabelsAction,t.showSeriesLastValue,t.showStudyPlotNamesAction,t.showStudyLastValue],e.enabled("countdown")&&i.push(t.showCountdown),i.push(this.actions.alignLabels),!TradingView.onWidget()&&e.enabled("show_chart_property_page")&&e.enabled("chart_property_page_scales")&&(i.push(new l),i.push(t.scalesProperties)),this.actions.setLockScale&&i.splice(6,0,this.actions.setLockScale),i},o.prototype.backLabels=function(t){var e,i,o,n,s,r,a=[],l=this.priceScale().orderedSources().slice(),h=this.pane,c=h.chart().model(),d=h.state(),p=[],u=c.sourceBeingMoved()||c.lineBeingEdited()||c.lineBeingCreated();if(u&&p.push(u),c.selectedSource()&&p.push(c.selectedSource()),c.hoveredSource()&&p.push(c.hoveredSource()),e=this.priceScale()===d.defaultPriceScale())for(i=this.pane.state().dataSources(),o=0;o<i.length;o++)d.isOverlay(i[o])&&l.push(i[o]);for(o=0;o<l.length;++o)if(n=l[o],(t||p.indexOf(n)===-1)&&(s=n.priceAxisViews(d,n.priceScale())))for(r=0;r<s.length;r++)a.push(s[r]);return a},o.prototype.optimalWidth=function(){var t,e,i,o,n,s,r;if(!this.isVisible())return 0;if(t=0,e=this.rendererOptions(),this.pane.state())for(i=this.ctx,o=this.priceScale().marks(),i.setFont(this.baseFont()),o.length>0&&(t=Math.max(e.widthCache.measureText(i,o[0].label),e.widthCache.measureText(i,o[o.length-1].label))),n=this.backLabels(!0),s=n.length;s--;)r=e.widthCache.measureText(i,n[s].text()),r>t&&(t=r);return Math.ceil(e.offsetSize+e.borderSize+e.tickLength+e.paddingInner+e.paddingOuter+t)},o.prototype.setSize=function(t){this.size&&this.size.equals(t)||(this.size=t,u(this.canvas,t),u(this.top_canvas,t),this.jqCell.css({width:t.w,"min-width":t.w,height:t.h}))},o.prototype.update=function(){},o.prototype._hightlightBackground=function(t,e,i){var o,n,s,r,a,l,h=e[0].price,c=e[0].price;for(o=1;o<e.length;o++)h=Math.min(h,e[o].price),c=Math.max(c,e[o].price);n=this.priceScale(),n.isPercent()&&i&&(s=i.firstValue(),h=n.priceRange().convertToPercent(h,s),c=n.priceRange().convertToPercent(c,s)),r=this.priceScale().priceToCoordinate(h),a=this.priceScale().priceToCoordinate(c),l="rgba(109, 158, 235, 0.3)",_(t,1,r,this.size.w-1,a-r,l)},o.prototype.drawBackground=function(t){var e,i,o,s;if(_(t,0,0,this.size.w,this.size.h,this.backgroundColor()),e=this.pane.chart().model(),i=e.model().selectedSource(),i&&i.priceScale()===this.priceScale()&&i instanceof n){if(o=i.axisPoints(),0===o.length)return;this._hightlightBackground(t,o,i.ownerSource())}s=e.model().crossHairSource(),s.startMeasurePoint()&&this._hightlightBackground(t,s.measurePoints(),this.pane.state().mainDataSource())},o.prototype.drawBorder=function(t){var e,i,o;t.save(),t.fillStyle=this.lineColor(),e=this.size.h,this._isLeft?(t.translate(-.5,-.5),i=this.size.w-this._BORDER_SIZE-1,o=this.size.w-1):(t.translate(.5,-.5),i=0,o=i+this._BORDER_SIZE),t.fillRect(i,0,o-i,e),t.restore()},o.prototype.drawTickMarks=function(t){var e,i,o,n,s,r;if(t.save(),t.strokeStyle=this.lineColor(),e=this.priceScale().marks(),t.fillStyle=this.textColor(),t.setFont(this.baseFont()),i=this,t.translate(-.5,-.5),o=this.rendererOptions(),i._isLeft){for(t.fillStyle=i.lineColor(),t.beginPath(),n=this.size.w-i._OFFSET_SIZE-i._BORDER_SIZE-i._TICK_LENGTH,s=e.length;s--;)t.rect(n,e[s].coord,i._TICK_LENGTH,1);for(t.fill(),s=e.length;s--;)o._tickmarksCache.paintTo(t,e[s].label,n-o.paddingInner,e[s].coord,"right")}else{for(t.fillStyle=i.lineColor(),t.beginPath(),r=i._BORDER_SIZE+i._OFFSET_SIZE,s=e.length;s--;)t.rect(r,e[s].coord,i._TICK_LENGTH,1);for(t.fill(),s=e.length;s--;)o._tickmarksCache.paintTo(t,e[s].label,r+i._TICK_LENGTH+o.paddingInner,e[s].coord,"left")}t.restore()},o.prototype._alignLabels=function(){var t,e,i,o,n,s,r,a,l,h,c,d,p,u=this.size.h/2,_=[],f=this.priceScale().orderedSources().slice(),g=this.pane,m=g.state(),v=this.rendererOptions(),y=this.priceScale()===m.defaultPriceScale();if(y)for(t=this.pane.state().dataSources(),e=0;e<t.length;e++)m.isOverlay(t[e])&&f.push(t[e]);for(i=this.priceScale().mainSource(),e=0;e<f.length;++e)if(o=f[e],n=o.priceAxisViews(m,o.priceScale())){for(s=0;s<n.length;s++)_.push(n[s]);i===o&&n.length>0&&(u=n[0].floatCoordinate())}if(r=_.filter(function(t){return t.floatCoordinate()<=u}),a=_.filter(function(t){return t.floatCoordinate()>u}),r.sort(function(t,e){return e.floatCoordinate()-t.floatCoordinate()}),r.length&&a.length&&a.push(r[0]),a.sort(function(t,e){return t.floatCoordinate()-e.floatCoordinate()}),_.forEach(function(t){t._fixedCoordinate=t.coordinate()}),l=this.priceScale().properties(),l.alignLabels&&l.alignLabels.value()){for(e=1;e<r.length;e++)h=r[e],c=r[e-1],d=c.renderer().height(v,!1),h.coordinate()>c._fixedCoordinate-d&&(p=c._fixedCoordinate-d,h._fixedCoordinate=p);for(s=1;s<a.length;s++)h=a[s],c=a[s-1],d=c.renderer().height(v,!0),h.coordinate()<c._fixedCoordinate+d&&(p=c._fixedCoordinate+d,h._fixedCoordinate=p)}},o.prototype.drawBackLabels=function(t){var e,i,o,n,s;for(t.save(),e=this.backLabels(),i=this.rendererOptions(),o=0;o<e.length;o++)n=e[o],s=n.renderer(),n._fixedCoordinate&&(s._data.coordinate=n._fixedCoordinate),s.draw(t,i);t.restore()},o.prototype.drawCrossHairLabel=function(t){var e,i,o,n,s,r,a,l=this.pane.chart().model().model(),h=[],c=l.sourceBeingMoved()||l.lineBeingEdited()||l.lineBeingCreated();for(c&&h.push({source:c,scale:c.priceScale()}),l.selectedSource()&&h.push({source:l.selectedSource(),scale:l.selectedSource().priceScale()}),l.hoveredSource()&&h.push({source:l.hoveredSource(),scale:l.hoveredSource().priceScale()}),h.push({source:l.crossHairSource(),scale:this.priceScale()}),e=this.pane.state(),i=0;i<h.length;i++)if(o=h[i],n=o.source.priceAxisViews(e,o.scale))for(s=0;s<n.length;s++)r=n[s],t.save(),a=r.renderer(),r._fixedCoordinate&&(a._data.coordinate=r._fixedCoordinate),a.draw(t,this.rendererOptions()),t.restore()},o.prototype.priceScale=function(){var t=this.pane.state(),e=[];return e=this._isLeft?[t.leftPriceScale(),t.rightPriceScale()]:[t.rightPriceScale(),t.leftPriceScale()],null===e[0].mainSource()?null===e[1].mainSource()?e[0]:e[1]:e[0]},o.prototype.isVisible=function(){return this._isVisible},o.prototype.setVisible=function(t){t=!!t,t!==this._isVisible&&(t?this.jqCell.css("display","table-cell"):this.jqCell.css("display","none"),this._isVisible=t)},o.prototype.setAutoScale=function(t){var e=this.pane.state,i=this.priceScale(),o=this.pane.chart().model();o.setPriceAutoScale(e,i,t)},o.prototype.reset=function(){var t=this.pane.state(),e=this.priceScale(),i=this.pane.chart().model();i.resetPriceScale(t,e)},o.prototype.paint=function(t){this._isVisible&&t&&(t===d.UPDATE_CURSOR_ONLY?(this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),this.drawCrossHairLabel(this.top_ctx)):(this._alignLabels(),this.drawBackground(this.ctx),this.drawBorder(this.ctx),this.pane.state()&&(this.drawTickMarks(this.ctx),this.drawBackLabels(this.ctx),this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),this.drawCrossHairLabel(this.top_ctx))))},o.prototype.restoreDefaultCursor=function(){this.jqCell.css("cursor","default")},o.prototype.image=function(){var t={};return t.content=this.canvas.toDataURL(),t.contentWidth=this.size.w,t.contentHeight=this.size.h,t},o.prototype.onMarksChanged=function(){var t,e=this.optimalWidth();this._prevOptimalWidth<e&&(t=this,this.updateTimeout||(this.updateTimeout=setTimeout(function(){t.pane&&t.pane.chart&&t.pane.chart()&&t.pane.chart().model().model().fullUpdate(),t.updateTimeout=null},100))),this._prevOptimalWidth=e},t.exports=o}).call(e,i(1))},function(t,e,i){"use strict";var o=i(326),n={instances:[],createMenu:function(t,e,i){var n=new o(t,e,i);return this.instances.push(n),n},hideAll:function(){for(var t in this.instances)this.instances[t].hide()}};t.exports=n},function(t,e,i){"use strict";function o(t){var e,i=[],n=t.m_items;for(e=0;e<n.length;e++)n[e]._menu&&(i.push(n[e]._menu),i=i.concat(o(n[e]._menu)));return i}function n(t,e,i){var o,n;this.options={},this._parentMenuItem=i,$.extend(this.options,e),this.options.class&&(this.options.attributes.class=this.options.class),this.jqMenu=null,this.m_wrapper=null,this.m_items=[];for(o in t)n=t[o],this.addItem(n)}var s=i(327),r=i(141).ActionPlaceholder,a=i(328),l=a.Item,h=a.ItemPlaceholder,c=i(58),d=i(57);n.prototype.addItem=function(t){var e;return e=t instanceof r?new h(t,this):new l(t,this),this.m_items.push(e),e},n.renderItem=function(t,e){t.append(e.render(t))},n.prototype.closeOtherSubmenus=function(t){for(var e=0;e<this.m_items.length;++e)this.m_items[e].highlight(!1),this.m_items[e]._menu&&(this.m_items[e]._menu.destroy(),this.m_items[e]._menu=null)},n.prototype.isShown=function(){return null!==this.jqMenu},n.prototype.render=function(){var t,e,i,o=this.getAttributes();if(this._parentMenuItem){t=$("<table>"),this.jqMenu=t,t.attr("cellspacing","0"),t.attr("cellpadding","0"),t.addClass("context-menu"),t.addClass("submenu");for(e in this.m_items)i=this.m_items[e],n.renderItem(t,i)}else{t=d.create(s.MENU_TAG,o),this.jqMenu=t;for(e in this.m_items)i=this.m_items[e],n.renderItem(t,i)}return this.jqMenu},n.prototype.getAttributes=function(){var t={},e=["context-menu"];return this.options.attributes&&this.options.attributes.class&&e.push(this.options.attributes.class),t.cellspacing=0,t.cellpadding=0,t.class=e.join(),t},n.prototype.deploy=function(t,e){var i=this.wrapper();return this.jqMenu=i.append(this.render()),e?($(e).data("submenu",this.jqMenu),$(document.body).append(this.jqMenu),this.jqMenu.data("parent-menu",e),this.jqMenu.data("parent-item",t.currentTarget)):$(document.body).append(this.jqMenu),c.unbindContextMenu(this.jqMenu),this._setCoords(t),this.jqMenu},n.prototype.show=function(t,e){this.deploy(t,e).show()},n.prototype.hide=function(){this.isShown()&&this.destroy()},n.prototype.destroy=function(){$.each(this.m_items,function(t,e){e._menu&&e._menu.destroy()}),this.jqMenu&&(this.jqMenu.remove(),this.jqMenu=null),this.m_wrapper.empty()},n.prototype._setCoords=function(t){var e,i,o,n,s,r=5,a=this.jqMenu,l=$(this.jqMenu.data("parent-item")),h={width:$(window).width(),height:Math.min($(window).height(),$("body").height())},c={top:$(document).scrollTop(),left:$(document).scrollLeft()};for(this.jqMenu.css({maxWidth:h.width-2*r,maxHeight:h.height-2*r}),e={width:a.outerWidth(),height:a.outerHeight()},l.size()?(o=l.offset(),i={top:o.top-1,left:o.left+l.outerWidth()}):i={top:t.pageY,left:t.pageX},this.jqMenu.offset(i),n={},n.top=Math.min(i.top,h.height+c.top-e.height-r),i.left+e.width+r>h.width||this.options.reverse?n.left=i.left+c.left-e.width:n.left=i.left,s=t.target;s&&s!==document;s=s.parentNode)if("fixed"===$(s).css("position")){this.jqMenu.css("position","fixed");break}this.jqMenu.offset(n)},n.prototype._wrapper=function(){var t=this,e=s.WRAPPER_ATTRIBUTES;return this._parentMenuItem?this.m_wrapper=d.create(s.WRAPPER_TAG,e):(this.m_wrapper=c.createPopup(e,void 0,{mouseDownOutsideEvent:function(e){var i=$();$.each(o(t),function(){i=i.add(this.m_wrapper)}),$(e.target).parents().andSelf().is(i)||t.hide()}}),this.m_wrapper.addClass("topmenu")),this.m_wrapper},n.prototype.wrapper=function(t){return this.m_wrapper||this._wrapper()},t.exports=n},function(t,e){"use strict";t.exports={INSERT_AT_END:0,INSERT_AT_START:1,INSERT_AT_POS:2,WRAPPER_TAG:"div",WRAPPER_ATTRIBUTES:{class:"context-menu-wrapper"},MENU_TAG:"table",ITEM_ROW_TAG:"tr",ICON_CELL_TAG:"td",TEXT_CELL_TAG:"td",RIGHT_CELL_TAG:"td",SUBMENU_CELL_TAG:"td"}},function(t,e,i){"use strict";function o(t){return null==t._parentMenu?null:n(t._parentMenu)}function n(t){return null==t._parentMenuItem?t:o(t._parentMenuItem)}function s(t,e){this.action=t,this._parentMenu=e}function r(t,e){this.action=t,this._parentMenu=e}var a=i(327),l=i(57);s.prototype._createIconTag=function(){var t=this._iconTagAttributes();return this.jqIcon=l.create(a.ICON_CELL_TAG,t),this.jqIcon.addClass("context-menu"),this.jqIcon},s.prototype._createDeleteButton=function(){var t,e,i;return this.action.deleteButton?(t=this,e=this.action.deleteButton.action,i=l.create("span",{class:"context-menu-delete-button"}),e&&i.click(function(){return e.call(t),!1}),this.jqSubmenu.addClass("delete-spacer"),void this.jqSubmenu.append(i)):null},s.prototype._createTextTag=function(){var t=this._textTagAttributes();return this.jqText=l.create(a.TEXT_CELL_TAG,t),this.jqIcon.addClass("context-menu"),this.jqText},s.prototype._createRightTag=function(){var t=this._rightTagAttributes();return this.jqRight=l.create(a.RIGHT_CELL_TAG,t),this.jqIcon.addClass("context-menu"),this.jqRight},s.prototype._createSubmenuTag=function(){var t=this._submenuTagAttributes();return this.jqSubmenu=l.create(a.SUBMENU_CELL_TAG,t),this.jqIcon.addClass("context-menu"),this.jqSubmenu},s.prototype._iconTagAttributes=function(){var t={},e=[];return this.action&&(this.action.icon?(e.push("icon"),e.push(this.action.icon.replace(/\./,"_"))):this.action.checkable?(e.push("icon"),this.action.checked?e.push("checked-icon"):e.push("unchecked-icon")):e.push("spacer")),t.class=e.join(" "),t},s.prototype._textTagAttributes=function(){return{class:"text",html:this.action?this.action.text:""}},s.prototype.highlight=function(t){t?(this.jqRow.addClass("context-menu-hover"),this.jqIcon.addClass("context-menu-hover")):(this.jqRow.removeClass("context-menu-hover"),this.jqIcon.removeClass("context-menu-hover")),this.action&&this.action.hasSubActions()&&(t?this.jqSubmenu.addClass("expanded"):this.jqSubmenu.removeClass("expanded"))},s.prototype._rightTagAttributes=function(){var t={},e=["right"];return this.action&&this.action.shortcut&&(e.push("shortcut"),t.class=e.join(" "),t.html=this.action.shortcut),t},s.prototype._submenuTagAttributes=function(){var t={};return this.action&&this.action.hasSubActions()?t.class="submenu-arrow":t.class="context-menu spacer",t},s.prototype.render=function(){this._createRow(),this.jqRow.append(this._createIconTag()),this.jqRow.append(this._createTextTag()),this.jqRow.append(this._createRightTag()),this.jqRow.append(this._createSubmenuTag()),this._createDeleteButton(),this.appendCallback();var t=this;return this.jqRow.mouseenter(function(e){t.showSubmenu(e),t.highlight(!0),t._parentMenu&&t._parentMenu._parentMenuItem&&t._parentMenu._parentMenuItem.highlight(!0)}),this.jqRow.mouseleave(function(){t.highlight(!1)}),this.jqRow},s.prototype._createRow=function(){var t,e,i=this._rowTagAttributes();this.jqRow=l.create(a.ITEM_ROW_TAG,i),this.jqRow.addClass("context-menu"),t=this,this.action&&!this.action.hasSubActions()&&(e=function(t){t.destroy(),t._parentMenuItem&&e(t._parentMenuItem._parentMenu)},this.jqRow.click(function(i){e(t._parentMenu)}))},s.prototype.showSubmenu=function(t){if(this._parentMenu.closeOtherSubmenus(this),!this.action||this.action.hasSubActions()){if(!this._menu){var e=i(325);this._menu=e.createMenu(this.action.subActions,null,this)}t.pageX=this._parentMenu.jqMenu.width()-2,t.pageY=this.jqSubmenu.offset().top-this._parentMenu.jqMenu.offset().top-1,this._menu.show(t,this._parentMenu.jqMenu)}},s.prototype._rowTagAttributes=function(){var t=[];return this.action&&(this.action.enabled===!1&&t.push("disabled"),this.action.visible===!1&&t.push("hidden"),this.action.font&&t.push("font_"+this.action.font),this.action.hasSubActions()&&t.push("has_submenu"),this.action.htmlclass&&t.push(this.action.htmlclass)),{class:t.join(" ")}},s.prototype.appendCallback=function(){var t=this;this.jqRow.click(function(e){t.action.enabled&&t.action.executeCallback(e)})},s.prototype.getTopLevelMenu=function(){return o(this)},r.prototype.render=function(t){this._createRow();var e=this;return this.action.deferred.then(function(o){var n,s,r,a=i(326);for(n in o)s=o[n],r=e._parentMenu.addItem(s),a.renderItem(t,r)}).always(function(){e.jqRow.hide()}),this.jqRow},r.prototype._createIconTag=function(){var t=this._iconTagAttributes();return this.jqIcon=l.create(a.ICON_CELL_TAG,t),this.jqIcon.addClass("context-menu"),this.jqIcon},r.prototype._createRow=function(){var t=this._rowTagAttributes();this.jqRow=l.create(a.ITEM_ROW_TAG,t),this.jqRow.append(this._createIconTag()),this.jqRow.addClass("context-menu")},r.prototype._rowTagAttributes=function(){var t=[];return this.action&&t.push("spinner"),{class:t.join(" ")}},r.prototype.highlight=function(t){},r.prototype._iconTagAttributes=function(){var t={},e=[];return e.push("spacer"),t.class=e.join(" "),t.colspan="10",t},e.Item=s,e.ItemPlaceholder=r},function(t,e,i){(function(e){"use strict";function i(t,e,i,o){this.reset(t,e,i,o)}i.prototype.maxCount=50,i.prototype.reset=function(t,e,i,o){for(var n=this._next;n&&n!==this;n=n._next)n.canvas.width=0,n._next=null,n._prev=null;this._next=this,this._prev=this,this._count=0,this._fontSize=t,this._color=o,this._font=TradingView.makeFont(t,e,i),this._hash={}},i.prototype.paintTo=function(t,e,i,o,n){var s=this.getLabelImage(e);"left"!==n&&(i-=s.width),o-=Math.floor(s.height/2),t.drawImage(s.canvas,i,o)},i.prototype.getLabelImage=function(t){var i,o,n,s,r;return Object.prototype.hasOwnProperty.call(this._hash,t)?i=this._hash[t]:(this._count<this.maxCount?(this._count++,i={_next:this._next,_prev:this,text:t,width:0,height:0,canvas:document.createElement("canvas")},o=i.canvas.getContext("2d"),o.font=this._font):(i=this._prev,delete this._hash[i.text],i.text=t,o=i.canvas.getContext("2d")),n=Math.ceil(this._fontSize/4),s=Math.round(this._fontSize/10),r=o.measureText(t).width,i.height=this._fontSize+2*n,i.width=Math.max(1,r),0!==r?this._hash[i.text]=i:e.enabled("charting_library_debug_mode")&&console.log('Canvas 2d context measureText return zero width for "'+t+'" text'),i.canvas.height=i.height,i.canvas.width=i.width,o=i.canvas.getContext("2d"),o.font=this._font,o.fillStyle=this._color,o.fillText(t,0,n+this._fontSize-s)),this._next!==i&&(i._next._prev=i._prev,
i._prev._next=i._next,i._prev=this,i._next=this._next,this._next._prev=i,this._next=i),i},t.exports=i}).call(e,i(1))},function(t,e){"use strict";function i(t,e,i){var o,n;return i||(i="light"),o=i+"/"+t+".cur",n=TradingView.wrapUrl("url("+TradingView.resourceFullPath(o)+")"),$.browser.msie?n+", default":n+" "+e+", default"}t.exports=i},function(t,e,i){"use strict";function o(t,e,i){this._model=e,this._paneWidget=t,this._chart=t._chart,this._mainDiv=i,this.jqDiv=$('<div class="pane-controls">').appendTo(i),this._chart.navigationButtonsController().addWidget({widget:this.jqDiv,acceptableOffset:0,checkingWidget:i}),this.update()}o.prototype.update=function(){var t,e,o,n,s,r,a,l;if(!this._chart.isActive())return void this.jqDiv.css("display","none");if(this.jqDiv.css("display","block"),t=this,e=t._model,o=t._paneWidget.state(),n=e.panes().indexOf(o),this.jqDiv.toggleClass("toppane",0===n||this._chart.isMaximizedPane()),s=!1,!o.containsMainSeries()&&!this._chart.isMaximizedPane()){for(r=0,a=o.dataSources(),l=a.length;l--;)if(a[l]instanceof TradingView.Study&&(r++,r>1)){s=!0;break}a=null}n>0&&!this._chart.isMaximizedPane()?(this._$upButton||(this._$upButton=$(document.createElement("a")).addClass("pane-legend-icon up").append($(i(332)).attr({width:14,height:14})).attr("title",$.t("Move Up")).on("click",function(){t._model.rearrangePanes(t._chart,t._model.panes().indexOf(t._paneWidget.state()),"up")})),this._$upButton.appendTo(this.jqDiv)):this._$upButton&&this._$upButton.detach(),n<this._model.panes().length-1&&!this._chart.isMaximizedPane()?(this._$downButton||(this._$downButton=$(document.createElement("a")).addClass("pane-legend-icon down").append($(i(333)).attr({width:14,height:14})).attr("title",$.t("Move Down")).on("click",function(){t._model.rearrangePanes(t._chart,t._model.panes().indexOf(t._paneWidget.state()),"down")})),this._$downButton.appendTo(this.jqDiv)):this._$downButton&&this._$downButton.detach(),s?(this._$closeButton||(this._$closeButton=$(document.createElement("a")).addClass("pane-legend-icon delete").append($(i(257)).attr({width:14,height:14})).attr("title",$.t("Delete")).on("click",function(){t._model.removePane(t._chart,t._model.panes().indexOf(t._paneWidget.state()))})),this._$closeButton.appendTo(this.jqDiv)):this._$closeButton&&this._$closeButton.detach(),this._model.panes().length>1&&!this._chart.isMaximizedPane()?(this._$maximizeButton||(this._$maximizeButton=$(document.createElement("a")).addClass("pane-legend-icon maximize").append($(i(334)).attr({width:14,height:14})).attr("title",$.t("Toggle Maximize Pane")).on("click",function(){t._chart.toggleMaximizePane(t._paneWidget)})),this._$maximizeButton.appendTo(this.jqDiv)):this._$maximizeButton&&this._$maximizeButton.detach(),this._model.panes().length>1&&this._chart.isMaximizedPane()?(this._$restoreButton||(this._$restoreButton=$(document.createElement("a")).addClass("pane-legend-icon restore").append($(i(335)).attr({width:14,height:14})).attr("title",$.t("Toggle Maximize Pane")).on("click",function(){t._chart.toggleMaximizePane(t._paneWidget)})),this._$restoreButton.appendTo(this.jqDiv)):this._$restoreButton&&this._$restoreButton.detach()},t.exports=o},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" width="14" height="14"><path d="M0 0v14h14V0zm7 2l2.8 3H8v6H6V5H4.2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" width="14" height="14"><path d="M14 14V0H0v14zm-7-2L4.2 9H6V3h2v6h1.8z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" width="14" height="14"><path d="M0 0v14h14V0zm7 1l2.8 3H8v2.5H6V4H4.2zM6 7.5h2V10h1.8L7 13l-2.8-3H6z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" width="14" height="14"><path d="M0 0v14h14V0H0zm6 1.5h2V4h1.8L7 7l2.8 3H8v2.5H6V10H4.2L7 7 4.2 4H6V1.5z"/></svg>'},function(t,e,i){(function(e){"use strict";function o(t,e,i){this.chart=t,this.paneA=t.paneWidgets()[e],this.paneB=t.paneWidgets()[i],this.jqRow=$(document.createElement("tr")),this.jqRow.height(o.HEIGHT),this.jqCell=$(document.createElement("td")),this.jqCell.appendTo(this.jqRow),this.jqCell.addClass("pane-separator"),this.jqCell.attr("colspan","3"),this.jqCell.css("background",this.chart.properties().scalesProperties.lineColor.value()),this.jqCell.click(function(){}),this.handle=$('<div class="handle">').appendTo(this.jqCell),$(this.handle).css("cursor",s("cursor_size_vertical","16 15")),n(this.handle,this)}var n=i(55).setMouseEventHandler,s=i(330);o.HEIGHT=1,o.prototype.hide=function(){this.jqRow.addClass("js-hidden")},o.prototype.show=function(){this.jqRow.removeClass("js-hidden")},o.prototype.mouseDownEvent=function(t){(0===t.button||Modernizr.touch)&&(this.startY=t.pageY,this.deltaY=0,this.totalHeight=this.paneA.size.h+this.paneB.size.h,this.totalStretch=this.paneA.stretchFactor()+this.paneB.stretchFactor(),this.prevStretchA=this.paneA.stretchFactor(),this.minPaneHeight=30,this.maxPaneHeight=this.totalHeight-this.minPaneHeight,this.pixelStretchFactor=this.totalStretch/this.totalHeight)},o.prototype.pressedMouseMoveEvent=function(t){var i,o,n,s;(0===t.button||Modernizr.touch)&&(t.preventDefault(),this.deltaY=t.pageY-this.startY,i=this.paneA.size.h,o=e.clamp(i+this.deltaY,this.minPaneHeight,this.maxPaneHeight),n=o*this.pixelStretchFactor,s=this.totalStretch-n,this.paneA.setStretchFactor(n),this.paneB.setStretchFactor(s),this.chart._adjustSize(),this.paneA.size.h!==i&&(this.startY=t.pageY),this.chart.paint())},o.prototype.mouseUpEvent=function(t){(0===t.button||Modernizr.touch)&&(this.chart._model.addPaneStretchFactorUndoCommand(this.paneA._state,this.paneB._state,this.prevStretchA,this.paneA.stretchFactor()),this.startY=0,this.deltaY=0,this.totalHeight=0,this.totalStretch=0,this.minPaneHeight=0,this.maxPaneHeight=0,this.pixelStretchFactor=0)},o.prototype.update=function(){this.jqCell.css("background",this.chart.properties().scalesProperties.lineColor.value())},o.prototype.paint=function(){},o.prototype.image=function(){var t={},e=o.HEIGHT,i=this.paneA.lhsPriceAxisWidget.size.w,n=this.paneA.size.w,s=this.paneA.rhsPriceAxisWidget.size.w,r=$('<canvas width="'+i+'" height="'+e+'">')[0],a=r.getContext("2d");return a.fillStyle=this.chart.properties().scalesProperties.lineColor.value(),a.fillRect(0,0,i,e),t.leftAxis={content:r.toDataURL(),contentWidth:i,contentHeight:e},r=$('<canvas width="'+n+'" height="'+e+'">')[0],a=r.getContext("2d"),a.fillStyle=this.chart.properties().scalesProperties.lineColor.value(),a.fillRect(0,0,n,e),t.content=r.toDataURL(),t.contentWidth=n,t.contentHeight=e,r=$('<canvas width="'+s+'" height="'+e+'">')[0],a=r.getContext("2d"),a.fillStyle=this.chart.properties().scalesProperties.lineColor.value(),a.fillRect(0,0,s,e),t.rightAxis={content:r.toDataURL(),contentWidth:s,contentHeight:e},t},t.exports=o}).call(e,i(21))},function(t,e,i){"use strict";function o(t,e,o,s,r,a,l,h){var c=i(248).ChartUndoModel,d=new c(t,e,o,s,r,a,l,h);return d.model().invalidate(new n(n.FULL_UPDATE)),d}var n=i(113),s=i(114);TradingView.MAMetaInfo=function(){var t={id:"MASimple",inputs:[{id:"length",type:"integer",defval:10},{id:"source",type:"text",defval:"close"}],plots:[{id:"MovAvg",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"true"}],palettes:{}};return new s(t)},TradingView.VolumeMetaInfo=function(){var t={id:"Volume",inputs:[],plots:[{id:"Volume",type:"histogram"},{id:"Color",type:"colorer",palette:"volumePalette",target:"Volume"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{volumePalette:{colors:{0:{color:"#007F0E",width:1,style:CanvasEx.LINESTYLE_SOLID,name:"Up Volume"},1:{color:"#872323",width:1,style:CanvasEx.LINESTYLE_SOLID,name:"Down Volume"}}}}};return new s(t)},TradingView.DMMetaInfo=function(){var t={id:"DM",inputs:[{id:"ADX smoothing",max:50,min:1,type:"integer",defval:14},{id:"DI Length",max:500,min:1,type:"integer",defval:14}],plots:[{id:"ADX",type:"line"},{id:"DI_P",type:"line"},{id:"DI_N",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{}};return new s(t)},TradingView.RSIMetaInfo=function(){var t={id:"RSI",inputs:[{id:"length",type:"integer",defval:14}],plots:[{id:"RelativeStrengthIndex",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{}};return new s(t)},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,e){this.chart=t,this._properties=t.properties().scalesProperties,this.contextMenu=null,this._disableContextMenu=!!e,this.jqRow=$(document.createElement("tr")),this.jqLhsTimeAxisStub=$(document.createElement("td")),this.jqLhsTimeAxisStub.addClass("chart-markup-table"),this.jqLhsTimeAxisStub.appendTo(this.jqRow),this.jqLhsStub=$("<div>"),this.jqLhsStub.css("width","100%"),this.jqLhsStub.css("height","100%"),this.jqLhsStub.css("position","relative"),this.jqLhsStub.css("overflow","hidden"),this.jqLhsStub.appendTo(this.jqLhsTimeAxisStub),this.lhsCanvas=_(this.jqLhsStub,new f(16,16)),$(this.lhsCanvas).css("position","absolute"),$(this.lhsCanvas).css("z-order","2"),$(this.lhsCanvas).css("left",0),$(this.lhsCanvas).css("top",0),this.lhsCtx=this.lhsCanvas.getContext("2d"),this.jqCell=$(document.createElement("td")),this.jqCell.appendTo(this.jqRow),this.jqCell.addClass("chart-markup-table"),this.jqCell.addClass("time-axis"),this.jqCell.height(25),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqCell),this.canvas=_(this._dv,new f(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=_(this._dv,new f(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this.jqRhsTimeAxisStub=$(document.createElement("td")),this.jqRhsTimeAxisStub.addClass("chart-markup-table"),this.jqRhsTimeAxisStub.appendTo(this.jqRow),this.jqRhsStub=$("<div>"),this.jqRhsStub.css("width","100%"),this.jqRhsStub.css("height","100%"),this.jqRhsStub.css("position","relative"),this.jqRhsStub.css("overflow","hidden"),this.jqRhsStub.appendTo(this.jqRhsTimeAxisStub),this.rhsCanvas=_(this.jqRhsStub,new f(16,16)),$(this.rhsCanvas).css("position","absolute"),$(this.rhsCanvas).css("z-order","2"),$(this.rhsCanvas).css("left",0),$(this.rhsCanvas).css("top",0),this.rhsCtx=this.rhsCanvas.getContext("2d"),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=TradingView.MINUTE_SPAN,g(this.jqCell,this,!0),this.updatePriceScalesVisibility()}var n=i(324),s=i(74).LineDataSource,r=i(107),a=i(141),l=a.ActionSeparator,h=i(325),c=i(113),d=i(55),p=d.setCanvasSize,u=d.clearRect,_=d.addCanvasTo,f=d.Size,g=d.setMouseEventHandler,m=i(330);o.prototype._BORDER_SIZE=1,o.prototype._OFFSET_SIZE=1,o.prototype._TICK_LENGTH=3,o.prototype.backgroundColor=function(){return this.chart.properties().paneProperties.background.value()},o.prototype.lineColor=function(){return this._properties.lineColor.value()},o.prototype.textColor=function(){return this._properties.textColor.value()},o.prototype.fontSize=function(){return this._properties.fontSize.value()},o.prototype.baseFont=function(){return TradingView.makeFont(this.fontSize(),"Arial","")},o.prototype.baseBoldFont=function(){return TradingView.makeFont(this.fontSize(),"Arial","bold")},o.prototype.rendererOptions=function(){var t,e;return this._rendererOptions||(this._rendererOptions={borderSize:this._BORDER_SIZE,offsetSize:this._OFFSET_SIZE,tickLength:this._TICK_LENGTH,fontSize:NaN,font:"",widthCache:new r}),t=this._rendererOptions,t.fontSize!==this.fontSize()&&(e=this.fontSize(),t.fontSize=e,t.font=this.baseFont(),t.paddingTop=Math.ceil(Math.max(e/4.5-t.tickLength/2,0)),t.paddingBottom=Math.ceil(e/4.5),t.paddingHorizontal=Math.ceil(e/3),t.baselineOffset=Math.round(this.fontSize()/10),t.widthCache.reset()),this._rendererOptions},o.prototype.updatePriceScalesVisibility=function(){var t=this.chart.properties().scalesProperties;t.showLeftScale.value()?this.jqLhsTimeAxisStub.css("display","table-cell"):this.jqLhsTimeAxisStub.css("display","none"),t.showRightScale.value()?this.jqRhsTimeAxisStub.css("display","table-cell"):this.jqRhsTimeAxisStub.css("display","none")},o.prototype.mouseDownEvent=function(t){if(this._mousedown)return!0;this._mousedown=!0;var e=this.chart.model();e.timeScale().isEmpty()||($(this.jqCell).css("cursor",m("cursor_size_horizontal","15 15")),e.startScaleTime(t.localX))},o.prototype.mouseDownOutsideEvent=function(t){var e=this.chart.model();!e.timeScale().isEmpty()&&this._mousedown&&(this._mousedown=!1,e.endScaleTime(),this.restoreDefaultCursor())},o.prototype.pressedMouseMoveEvent=function(t){var e,i,o,n=this.chart.model();n.timeScale().isEmpty()||(e=!1,i=(new Date).valueOf(),this._lastScrollScaleTime&&(o=i-this._lastScrollScaleTime,o<100&&(e=!0)),e||(n.scaleTimeTo(t.localX),this._lastScrollScaleTime=i))},o.prototype.mouseUpEvent=function(t){this._mousedown=!1;var e=this.chart.model();e.timeScale().isEmpty()||(e.endScaleTime(),this.restoreDefaultCursor())},o.prototype.contextMenuEvent=function(t,i){!this._disableContextMenu&&e.enabled("scales_context_menu")&&this._createContextMenu().show(t)},o.prototype._createContextMenu=function(){return h.createMenu(this.getContextMenuActions())},o.prototype.getContextMenuActions=function(){var t,i,o=this.chart;return o.model().mainSeries().createSessStudy(),o.updateActions(),t=o.actions(),i=e.enabled("charting_library_base")?[t.timeScaleReset,new l,t.applyTimeZone]:[t.timeScaleReset,new l,t.applyTimeZone,t.sessionBreaks,t.extendedHours],e.enabled("timezone_menu")||i.splice(2,1),e.enabled("show_chart_property_page")&&e.enabled("chart_property_page_timezone_sessions")&&i.push(new l,t.tmzProperties),i},o.prototype.mouseClickEvent=function(t){},o.prototype.mouseDoubleClickEvent=function(t){TradingView.trackEvent("GUI","Double click time scale"),this.chart.model().resetTimeScale()},o.prototype.optimalHeight=function(){var t=this.rendererOptions();return Math.ceil(t.offsetSize+t.borderSize+t.tickLength+t.fontSize+t.paddingTop+t.paddingBottom)},o.prototype.setSize=function(t,e,i){this.size&&this.size.equals(t)||(this.lhsStubSize=e,p(this.lhsCanvas,e),this.jqLhsTimeAxisStub.width(e.w),this.jqLhsTimeAxisStub.height(e.h),this.rhsStubSize=i,p(this.rhsCanvas,i),this.jqRhsTimeAxisStub.width(i.w),this.jqRhsTimeAxisStub.height(i.h),this.size=t,p(this.canvas,t),p(this.top_canvas,t),this.lhsCanvas.getContext("2d"),this.rhsCanvas.getContext("2d"),this.canvas.getContext("2d"),this.top_canvas.getContext("2d"),this.jqCell.width(t.w),this.jqCell.height(t.h))},o.prototype._spanIndex=function(t){for(var e=[TradingView.MINUTE_SPAN,TradingView.HOUR_SPAN,TradingView.DAY_SPAN,TradingView.MONTH_SPAN,TradingView.YEAR_SPAN],i=e.length-1;i>0;){if(e[i]<=t)return i;i--}return i},o.prototype._spanOffset=function(t,e){if(e<t)throw Error("actual span cuold not be less then base");return this._spanIndex(e)-this._spanIndex(t)},o.prototype.update=function(){var t,e;this.chart.model()&&(t=this.chart.model().timeScale().marks(),t&&(e=this,this._minVisibleSpan=TradingView.YEAR_SPAN,$.each(t,function(){e._minVisibleSpan=Math.min(this.span,e._minVisibleSpan)})))},o.prototype._hightlightBackground=function(t,e){var i,o,n,s,r=this.chart.model(),a=r.timeScale(),l=e[0].index,h=e[0].index;for(i=1;i<e.length;i++)l=Math.min(l,e[i].index),h=Math.max(h,e[i].index);o=a.indexToCoordinate(l),n=a.indexToCoordinate(h),s="rgba(109, 158, 235, 0.3)",u(t,o,1,n-o,this.size.h-1,s)},o.prototype.drawBackground=function(t){var e,i,o,n,r;if(u(t,0,0,this.size.w,this.size.h,this.backgroundColor()),e=this.chart.model()){if(i=e.timeScale(),o=e.model().selectedSource(),o&&o instanceof s&&!i.isEmpty()){if(n=o.axisPoints(),0===n.length)return;this._hightlightBackground(t,n)}r=e.model().crossHairSource(),r.startMeasurePoint()&&this._hightlightBackground(t,r.measurePoints())}},o.prototype.drawBorder=function(t){t.save(),t.fillStyle=this.lineColor(),t.fillRect(-.5,.5,this.size.w+.5,this._BORDER_SIZE),t.restore()},o.prototype.drawStubs=function(){var t,e=this._BORDER_SIZE,i=2*this._BORDER_SIZE,o=this.lhsCtx;u(o,0,0,this.lhsStubSize.w,this.lhsStubSize.h,this.backgroundColor()),o.fillStyle=this.lineColor(),o.fillRect(this.lhsStubSize.w-i-.5,.5,i,e),o.fillRect(this.lhsStubSize.w-i-.5,-.5,e,e),t=this.rhsCtx,u(t,0,0,this.rhsStubSize.w,this.rhsStubSize.h,this.backgroundColor()),t.fillStyle=this.lineColor(),t.fillRect(-.5,.5,i,e),t.fillRect(.5,-.5,e,e)},o.prototype.drawTickMarks=function(t){var e,i,o,n,s,r,a,l,h,c,d,p=this.chart.model().timeScale().marks();if(p&&0!==p.length){for(e=p.reduce(function(t,e){return t.span>e.span?t:e}).span,e>30&&e<40&&(e=30),t.save(),t.strokeStyle=this.lineColor(),i=this.rendererOptions(),o=i.borderSize+i.tickLength+i.paddingTop+i.fontSize-i.baselineOffset,t.textAlign="center",t.translate(.5,.5),t.fillStyle=this.lineColor(),t.beginPath(),n=p.length;n--;)t.rect(p[n].coord,i.borderSize,1,i.tickLength);for(t.fill(),t.fillStyle=this.textColor(),s={},r=this.baseFont(),a=this.baseBoldFont(),n=0;n<p.length;n++)l=p[n].span>=e?a:r,h=s[l]||[],h.push(p[n]),s[l]=h;for(c in s)for(t.setFont(c),d=s[c],n=0;n<d.length;n++)t.fillText(d[n].label,d[n].coord,o);t.restore()}},o.prototype.drawBackLabels=function(t){var e,i,o,n,s,r,a,l;for(t.save(),e=this.chart.model().dataSources(),i=this.chart.model(),o=i.sourceBeingMoved()||i.lineBeingEdited()||i.lineBeingCreated(),n=this.rendererOptions(),s=0;s<e.length;s++)if(r=e[s],r!==this.chart.model().crossHairSource()&&r!==o&&r.timeAxisViews&&(a=r.timeAxisViews()))for(l=0;l<a.length;l++)a[l].renderer().draw(t,n);t.restore()},o.prototype.drawCrossHairLabel=function(t){var e,i,o,n,s;if(this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),e=this.chart.model(),i=e.sourceBeingMoved()||e.lineBeingEdited()||e.lineBeingCreated(),o=this.rendererOptions(),i){if(t.save(),i.timeAxisViews&&(n=i.timeAxisViews()))for(s=0;s<n.length;s++)n[s].renderer().draw(t,o);return void t.restore()}if(t.save(),n=this.chart.model().crossHairSource().timeAxisView())for(s=0;s<n.length;s++)n[s].renderer().draw(t,o);t.restore()},o.prototype.paint=function(t){if(0!==t)if(t===c.UPDATE_CURSOR_ONLY)this.drawCrossHairLabel(this.top_ctx);else{var e=this.ctx;this.drawBackground(e),this.drawBorder(e),this.drawStubs(),this.chart.model()&&(this.drawTickMarks(e),this.drawBackLabels(e),this.drawCrossHairLabel(this.top_ctx))}},o.prototype.setStubVisible=function(t,e){var i=n.isLeft(t)?this.jqLhsTimeAxisStub:this.jqRhsTimeAxisStub;e?i.css("display","table-cell"):i.css("display","none")},o.prototype.restoreDefaultCursor=function(){this.jqCell.css("cursor","default")},o.prototype.image=function(){var t={};return t.content=this.canvas.toDataURL(),t.contentWidth=this.size.w,t.contentHeight=this.size.h,t.lhsStub={},t.lhsStub.content=this.lhsCanvas.toDataURL(),t.lhsStub.contentWidth=this.lhsStubSize.w,t.lhsStub.contentHeight=this.lhsStubSize.h,t.rhsStub={},t.rhsStub.content=this.rhsCanvas.toDataURL(),t.rhsStub.contentWidth=this.rhsStubSize.w,t.rhsStub.contentHeight=this.rhsStubSize.h,t},t.exports=o}).call(e,i(1))},function(t,e,i){(function(e){"use strict";function o(t,e){this._defaultOptions={maxHeight:550,padding:20,minHeight:258},this.options=$.extend({},this._defaultOptions,t||{}),this._model=e}var n=i(340),s=i(179),r=i(74).LineDataSource,a=i(113),l=i(341),h=i(44);o.prototype.getSourceProperties=function(){var t,e,i,o,n,s,a,l={groups:[],model:this._model,drawings:[]};for(t=0;t<this._model.panes().length;t++){for(e=this._model.panes()[t],i=[],o=e.orderedSources(),n=0;n<o.length;n++)s=o[n],s.showInObjectTree()&&i.push({datasource:s,name:s.title()});for(a=e.dataSources(),n=0;n<a.length;n++)s=a[n],s instanceof r&&s.showInObjectTree()&&l.drawings.push({datasource:s,name:s.title(),symbol:h.shortName(s.symbol()),lastupdate:s.properties().lastUpdateTime.value()});i.length&&l.groups.push({children:i})}return l},o.prototype.calcHeight=function(t,e){var i,o=0;for(i=0;i<t.length;i++){if(t[i]>e){o=0===i?t[0]:t[i-1];break}o=t[i]}return o<this.options.minHeight&&(o=this.options.minHeight),o},o.prototype.tabChanged=function(t){0===t?this.objectsTreeTab.tabChanged():this.manageDrawingsTab.tabChanged()},o.prototype.onDestroy=function(){this.objectsTreeTab.unsubscribeListeners(),this.manageDrawingsTab&&this.manageDrawingsTab.unsubscribeListeners()},o.prototype.show=function(t){var o,s,r,a,h,c,d,p,u,_,f,g;this.title=$.t("Objects Tree"),TradingView.trackEvent("GUI","Objects Tree"),o={hideTitle:!0,dragHandle:".properties-tabs"},h=TVDialogs.createDialog(this.title,o),c=h.find("._tv-dialog-content"),s=$('<div class="properties-tabs"></div>').appendTo(c),r=$('<a href="#" class="properties-tabs-label with-filter"></a>').text($.t("Objects Tree")).appendTo(s),d=$("<div>").appendTo(c),d.addClass("with-drawings"),p=$(window).height(),u=p>this.options.maxHeight?this.options.maxHeight:p,u-=s.height(),u-=this.options.padding,_=$('<div class="main-tree-page active">').appendTo(d),_.addClass("no-top-border"),e.enabled("support_manage_drawings")&&($('<a href="#" class="properties-tabs-label"></a>').text($.t("Manage Drawings")).appendTo(s),a=$('<div class="main-tree-page active">').appendTo(d),f=i(342),this.manageDrawingsTab=new f(this,this.options,this._model,h),this.manageDrawingsTab.createView(a,u)),this.objectsTreeTab=new n(this,this.options,this._model,h),this.objectsTreeTab.createView(_,r,u,t),this.tabs=new l(s,d,{saveTab:"ObjectsTreeDialog.tab",activeTab:this.options.activeTab}),this.tabs.tabChanged.subscribe(this,this.tabChanged),TVDialogs.applyHandlers(h),TVDialogs.positionDialog(h),g=this,h.on("destroy",this.onDestroy.bind(this)),setTimeout(function(){h.unbind("mousedownoutside"),h.on("mousedownoutside",function(t){var e=$(t.target).parents().andSelf();e.is("._tv-dialog, .properties-toolbar, .colorpicker, .charts-popup-list, ._tv-dialog, .tvcolorpicker-popup, .symbol-edit-popup, .context-menu")||(TVDialogs.destroy(g.title),h.unbind("mousedownoutside"))})})},o._getBackgroundPosition=function(t){return"-"+t[0]+"px -"+t[1]+"px"},o.List=function(t,e,i,o){this.model=t,this.datasources={},this.contentHeights=[],this.content=e,this.dialog=i,this.options=o},o.List.prototype.setDefaultItemClass=function(t){this.defaultItemClass=t},o.List.prototype.setActiveListener=function(t){this.activeListener=t},o.List.prototype.setActive=function(t){this.content.find("._tv-dialog-tree-item").removeClass("active"),t.addClass("active"),this.activeListener&&this.activeListener(t);var e=this.datasources[t.attr("id")];this.model.setSelectedSource(e.datasource),this.model.invalidate(new a(a.LIGHT_UPDATE))},o.List.prototype.createItem=function(t,e,i){var o,n,s,a=this,l=$('<a class="_tv-dialog-tree-item"></a>').appendTo(e),h=$('<span class="tree-icon-container">').appendTo(l);return t.skipped&&l.addClass("skipped"),l.attr("id",t.datasource.id()),this.defaultItemClass&&l.addClass(this.defaultItemClass),this.datasources[t.datasource.id()]=t,this.contentHeights.push(this.content.height()),o=$('<div class="name-column"></div>').appendTo(l),$('<span class="name">'+TradingView.clean($.t(t.name))+"</span>").appendTo(o),this.setIcon(l,t),this.setVisible(l,t),l.mousedown(function(t){a.setActive(l)}),t.datasource.userEditEnabled()&&(TradingView.isInherited(t.datasource.constructor,r)?(n=$('<a class="button icon-lock" title="'+$.t("Lock/Unlock")+'">'),n.click(function(e){var i=t.datasource.properties().frozen.value();a.model.setProperty(t.datasource.properties().frozen,!i,"Lock/Unlock "+t.datasource.title())}),n.appendTo(h),$('<span class="icon">').appendTo(n),t.datasource.properties().frozen.value()&&(l.addClass("locked"),n.addClass("active")),t.datasource.properties().frozen.subscribe(this,function(t){var e=t.value();l.toggleClass("locked",e),n.toggleClass("active",e)})):i&&$('<div class="button hidden">&nbsp;</div>').appendTo(h),s=$('<a class="button icon-hide" title="'+$.t("Show/Hide")+'">'),s.click(function(e){var i=t.datasource.properties().visible.value();l.toggleClass("hidden",i),s.toggleClass("active",i),a.model.setProperty(t.datasource.properties().visible,!i,"Show/Hide "+t.datasource.title())}),s.appendTo(h),$('<span class="icon">').appendTo(s),t.datasource.properties().visible.value()||(l.addClass("hidden"),s.addClass("active")),t.datasource.properties().visible.subscribe(this,function(t){var e=t.value();l.toggleClass("hidden",!e),s.toggleClass("active",!e)}),this.createPropertyIcon(t,h,l)),l},o.List.prototype.contextMenuEvent=function(t,i){if(e.enabled("objects_tree_context_menu")){var o=this.options.chartWidget.paneByState(this.model.paneForSource(i));o.showContextMenuForSource(i,t)}},o.List.prototype.createPropertyIcon=function(t,e,o){var n,s,a,l=this;return t.datasource instanceof r&&!t.datasource.isActualSymbol()?void $('<div class="button hidden">&nbsp;</div>').appendTo(e):t.datasource===this.model.mainSeries()&&this.options.chartWidget&&this.options.chartWidget.onWidget()?void $('<div class="button hidden">&nbsp;</div>').appendTo(e):(n=i(259),s=i(258),void((n.hasStylesPropertyPage(t.datasource)||n.hasInputsPropertyPage(t.datasource))&&(a=$('<a class="button format" title="'+$.t("Format")+'">').click(function(e){new s(t.datasource,l.model).show()}).appendTo(e),$('<span class="icon">').appendTo(a),o.dblclick(function(e){new s(t.datasource,l.model).show()}),o.on("contextmenu",function(e){l.contextMenuEvent(e,t.datasource),e.preventDefault(),e.stopPropagation()}))))},o.List.prototype.updateItem=function(t){var e=this.content.find("#"+t.datasource.id());e.find(".name").text(TradingView.clean($.t(t.name))),this.setIcon(e,t),this.setVisible(e,t)},o.List.prototype.findItem=function(t){var e=this.content.find("#"+t.id());return e},o.List.prototype.removeItem=function(t){var e=this.findItem(t);e.remove()},o.List.prototype.setIcon=function(t,e){var o,n,r,a,l,h,c=t.find(".name-column");c.find(".instrument").remove(),!e.datasource.getType||e.datasource instanceof s||c.find(".svg-icon").length||(o=$('<span class="svg-icon">'),n=$(i(343)[e.datasource.getType()]).attr({width:30,height:30}).appendTo(o),o.appendTo(c)),e.datasource instanceof s&&(n=e.datasource.properties().icon.value(),r=String.fromCharCode(n),n=$('<span class="instrument lineicon text-as-icon">'+r+"</span>").appendTo(c)),e.datasource===this.model.mainSeries()&&(n=$('<span class="instrument series">').appendTo(c),a=this.model.mainSeries().properties().style.value(),l=i(433),h=l.styleIconPosition(a),n.css("background-position",h))},o.List.prototype.setVisible=function(t,e){var i=e.datasource.properties().visible.value();i?t.removeClass("hidden"):t.addClass("hidden")},TradingView.ObjectTreeDialog=o,t.exports=o}).call(e,i(1))},function(t,e,i){(function(e){"use strict";function o(t,e,i,o){this.dialog=t,this.options=e||{},this.model=i,this.$mainDialog=o}function n(t){this.$container=t,this.$button=$('<div class="button-filter">').click(function(t){this.$button.trigger("button-popup",[this._getActions()]),t.stopPropagation()}.bind(this)).appendTo(t),a(this.$button,null,{event:"button-popup",addClass:"tree-tab-filter"}),this.onChange=new e}var s=i(74).LineDataSource,r=i(62).SidebarCustomScroll,a=i(55).bindPopupMenu;o.prototype.activeListener=function(t){this.selectedId=t.attr("id")},o.prototype.changeZOrder=function(t){this.model.removeListener("changeZOrder",this.changeZorderListener),t(),this.model.on("changeZOrder",this.changeZorderListener)},o.prototype.addSortable=function(t){var e=0,i=this;t.sortable({scroll:!0,scrollSensitivity:100,scrollSpeed:100,axis:"y",helper:"clone",start:function(t,i){e=i.item.index()},stop:function(t,o){var n,s,r=o.item.index();e-r!==0&&(n=i.list.datasources[o.item.attr("id")],s=e-r>0?1:-1,i.changeZOrder(function(){i.items.model.beginUndoMacro("Change "+n.datasource.title()+" Z order");for(var t=0;t<Math.abs(e-r);t++)i.items.model.changeZOrder(n.datasource,s);i.items.model.endUndoMacro()})),i.setFirstLastItems(o.item.parent())}})},o.prototype.addItemControls=function(t,e,i,o,n){var s,r,a=this,l=e.find(".tree-icon-container"),h=$('<div class="button up" title="'+$.t("Move Up")+'">').click(function(i){i.stopPropagation(),i.preventDefault(),a.moveItemUp(e,t.datasource)}).prependTo(l);$('<span class="icon">').appendTo(h),s=$('<a class="button down" title="'+$.t("Move Down")+'">').click(function(i){i.stopPropagation(),i.preventDefault(),a.moveItemDown(e,t.datasource)}).prependTo(l),$('<span class="icon">').appendTo(s),t.datasource!==a.items.model.mainSeries()&&t.datasource.isUserDeletable()?(r=$('<a class="button delete" title="'+$.t("Delete")+'">').click(function(e){e.stopPropagation(),a.items.model.removeSource(t.datasource)}).appendTo(l),$('<span class="icon">').appendTo(r)):$('<div class="button hidden">&nbsp;</div>').appendTo(l)},o.prototype.getNewSelectedIdOnRemoval=function(t){var e=this.content.find("._tv-dialog-tree-item"),i=e.index(t),o=e.length;o>0&&(i!==o-1?this.selectedId=$(e[i+1]).attr("id"):0!==i&&(this.selectedId=$(e[i-1]).attr("id")))},o.prototype.moveItemUp=function(t,e){var i,o=t.prev(":visible");o.length&&(i=t.prev(":hidden").length,t.insertBefore(o.last()),e&&this.changeZOrder(function(){for(var t=0;t<1+i;t++)this.items.model.changeZOrder(e,1)}.bind(this)),this.setFirstLastItems(t.parent()),this._scroll.scrollTo(t))},o.prototype.moveItemDown=function(t,e){var i,o=t.next(":visible");o.length&&(i=t.next(":hidden").length,t.insertAfter(o.first()),e&&this.changeZOrder(function(){for(var t=0;t<1+i;t++)this.items.model.changeZOrder(e,-1)}.bind(this)),this.setFirstLastItems(t.parent()),this._scroll.scrollTo(t))},o.prototype.showSpinner=function(){this.spinner=TradingView.unifiedSpinner().spin(this.page.get(0)),this.contentContainer.css("opacity",0)},o.prototype.hideSpinner=function(){this.spinner&&(this.spinner.stop(),this.contentContainer.css("opacity",1))},o.prototype.createView=function(t,e,o,s){var r=i(339),a=this;return this.items=this.dialog.getSourceProperties(),this.maxHeight=o,this.page=t,this.contentContainer=$('<div class="main-tree-container object-tree-container">').appendTo(t),this.contentWrap=$('<div class="main-tree-wrap"></div>').appendTo(this.contentContainer),this.content=$('<div class="main-tree"></div>').appendTo(this.contentWrap),this.list=new r.List(this.items.model,this.content,this.dialog,this.options),this.list.setDefaultItemClass("objects"),this.list.setActiveListener(this.activeListener.bind(this)),this.items.model.selectedSource()&&(this.selectedId=this.items.model.selectedSource().id()),this.updateListListener=this.updateList.bind(this),this.fillListListener=this.fillList.bind(this,s),this.removeSourceListener=function(t){var e,i;t&&(Array.isArray(t)?this.fillList(function(){this._scroll.scrollToStart()}.bind(this)):(e=this.list.findItem(t),this.getNewSelectedIdOnRemoval(e),i=this.content.find("#"+this.selectedId),this.fillList(function(){this._scroll.scrollToStart(),i.position&&i.position()&&this._scroll.scrollTo(i)}.bind(this),{showDialog:!0})))}.bind(this),this.changeZorderListener=function(t,e){if(t)if(e){var i=this.list.findItem(t);1===e?this.moveItemUp(i):this.moveItemDown(i)}else this.fillList(function(){this._scroll.scrollTo(this.list.findItem(t))}.bind(this),{showDialog:!0})}.bind(this),this.model.on("setProperty",this.updateListListener),this.model.on("removeSource",this.removeSourceListener),this.model.on("cloneLineTool",this.fillListListener),this.model.on("setChartStyleProperty",this.updateListListener),this.model.on("changeZOrder",this.changeZorderListener),this.model.on("moveSource",this.fillListListener),this.filter=new n(e),this.filter.onChange.subscribe(this,function(){a._scroll&&a._scroll.scrollToStart(),a.fillListListener()}),this.filter.setValue("all"),this.addScroll(),this.contentContainer},o.prototype.unsubscribeListeners=function(){this.model.removeListener("setProperty",this.updateListListener),
this.model.removeListener("removeSource",this.removeSourceListener),this.model.removeListener("cloneLineTool",this.fillListListener),this.model.removeListener("setChartStyleProperty",this.updateListListener),this.model.removeListener("changeZOrder",this.changeZorderListener),this.model.removeListener("moveSource",this.fillListListener)},o.prototype.updateList=function(){var t,e,i,o;for(this.items=this.dialog.getSourceProperties(),t=0;t<this.items.groups.length;t++)if(e=this.items.groups[t],e.children.length)for(i=e.children.length-1;i>=0;i--)o=e.children[i],this.list.updateItem(o)},o.prototype.setFirstLastItems=function(t,e){var i=e&&e.ignoreItemVisibility,o=i?"._tv-dialog-tree-item":"._tv-dialog-tree-item:visible",n=t.find(o);n.length&&(n.removeClass("first last"),n.first().addClass("first"),n.last().addClass("last"))},o.prototype.setSelectedItemActive=function(t,e){t.datasource.id()===this.selectedId&&this.list.setActive(e)},o.prototype.executeFillListCallback=function(t){isFunction(t)&&(this.$mainDialog.show(),t())},o.prototype.renderGroup=function(t){var e,i,o;t=t||{},e=0,i=t.index,o=setInterval(function(){var o=t.group.children.slice(e,e+50);o.forEach(function(e){var i=this.list.createItem(e,t.subitemList,t.showLocks);this.setSelectedItemActive(e,i),this.addItemControls(e,i,t.$group,t.itemIndex--,t.group)}.bind(this)),e+=50,o.length||(t.$group.append(t.subitemList),this.setFirstLastItems(t.subitemList,{ignoreItemVisibility:!0}),clearInterval(t.intervals[i]),0===--this.fillListGroupsCount&&(this.hideSpinner(),this.executeFillListCallback(t.callback)))}.bind(this),100),t.intervals[i]=o,this.$mainDialog.one("destroy",function(){clearInterval(o)})},o.prototype.fillList=function(t,e){var i,o,n,s,r,a,l,h=e&&e.showDialog;for(isFunction(t)&&!h&&this.$mainDialog.hide(),this.content.empty(),this.hideSpinner(),this.showSpinner(),this.items=this.dialog.getSourceProperties(),i="studies"!==this.filter.value()&&this.items.drawings.length,o=[],this.fillListGroupsCount=this.items.groups.length,n=0;n<this.items.groups.length;n++)s=this.filter.applyToGroup(this.items.groups[n]),s.children.length&&(r=$('<div class="_tv-dialog-tree-group">').appendTo(this.content),n>0&&r.append('<div class="_tv-dialog-tree-head">'),a=$('<div class="_tv-dialog-tree-item-list">'),Modernizr.touch||this.addSortable(a),l=s.children.length,s.children.reverse(),this.renderGroup({index:n,showLocks:i,intervals:o,callback:t,group:s,itemIndex:l,subitemList:a,$group:r}))},o.prototype.addScroll=function(){this._scroll=new r(this.contentContainer,this.contentWrap,{showBottomShadow:!1,scrollMarginTop:0})},o.prototype.tabChanged=function(){},n.prototype._getActions=function(){var t=[{name:"all",title:$.t("Show All")},{name:"drawings",title:$.t("Show Only Drawings")},{name:"studies",title:$.t("Show Only Studies")}].map(function(t){return t.name===this._value?t.active=!0:t.action=this.setValue.bind(this,t.name),t}.bind(this));return t},n.prototype.value=function(){return this._value},n.prototype.setValue=function(t){t!==this._value&&(this._value=t,this.onChange.fire(t))},n.prototype.applyToGroup=function(t){if("all"===this._value)return t;for(var e,i=0;i<t.children.length;i++)e=t.children[i],e.skipped=!TradingView.isInherited(e.datasource.constructor,TradingView.Series)&&!TradingView.isInherited(e.datasource.constructor,"drawings"===this._value?s:TradingView.Study);return t},t.exports=o}).call(e,i(28))},function(t,e,i){(function(e){"use strict";function i(t,i,o){this._$tabs=t,this._$pages=i,this.options=$.extend({},this._DEFAULT_OPTIONS,o||{}),this.tabChanged=new e,this.initActivePage(),this.initHandlers()}i.prototype._DEFAULT_OPTIONS={saveTab:!1},i.prototype.initActivePage=function(){var t=0;this.options.saveTab&&(t=TVSettings.getInt(this.options.saveTab,0)),t=this.options.activeTab||t,this.setActivePage(t)},i.prototype.setActivePage=function(t){this._$tabs.children().removeClass("active").eq(t).addClass("active"),this._$pages.children().removeClass("active").eq(t).addClass("active"),this.options.saveTab&&TVSettings.setValue(this.options.saveTab,t),this.tabChanged.fire(t)},i.prototype.initHandlers=function(){this._$tabs.on("click","*",this._onTabClick.bind(this))},i.prototype._onTabClick=function(t){if(t.preventDefault(),$(t.currentTarget).parent()[0]===this._$tabs[0]){var e=$(t.currentTarget).index();this.setActivePage(e)}},i.prototype.addPage=function(t,e){var i=this.count();return this._$tabs.append(t),this._$pages.append(e),i||this.setActivePage(0),i},i.prototype.removePage=function(t){function e(t){return t-1>=0?t-1:0}this._$tabs.children().eq(t).remove(),this._$pages.children().eq(t).remove();var i=this._$tabs.children().filter(".active").length?this._$tabs.children().filter(".active").index():e(t);this.setActivePage(i)},i.prototype.count=function(){return this._$tabs.children().length},i.prototype.index=function(){return this._$tabs.children().filter(".active:eq(0)").index()},i.prototype.indexOfPage=function(t){return this._$pages.children().index(t)},i.prototype.pageAt=function(t){return this._$pages.children().eq(t)},t.exports=i}).call(e,i(28))},function(t,e,i){"use strict";function o(t,e,i,o){this.dialog=t,this.options=e||{},this.model=i,this.$mainDialog=o,this.SETTINGS_STORAGE_NAME="ManageDrawingsTab.sorting"}var n=i(339),s=i(62).SidebarCustomScroll;o.prototype.unsubscribeListeners=function(){},o.prototype.tabChanged=function(){},o.prototype.getSortSettings=function(){return TVSettings.getJSON(this.SETTINGS_STORAGE_NAME)},o.prototype.saveSortSettings=function(t,e){var i=this.getSortSettings()||{};i.sortField=t,i.sortOrder=e,TVSettings.setJSON(this.SETTINGS_STORAGE_NAME,i)},o.prototype.createView=function(t,e){var o,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C=this.dialog.getSourceProperties(),x=$("<div>").addClass("manage-drawings").appendTo(t),P=$("<div>").addClass("wrap").appendTo(x),L={},k=0,E=this;this.items=C.drawings,this.maxHeight=e,this.list=new n.List(C.model,x,this.dialog,this.options),this._scroll=new s(x,P,{showBottomShadow:!1,scrollMarginTop:0}),r=function(t){var e=t.value();this.toggleClass("hidden",!e)},a=function(t){var e,i=t.data.row,o=t.data.symbol;i.hasClass("expanded")?(e=i.find(".subarea"),e.length&&e.hide(),i.removeClass("expanded")):(i.addClass("expanded"),e=i.find(".subarea"),e.length||(e=$("<table cellspacing = 0 cellpading = 0>").addClass("subarea").appendTo(i),E.items.filter(function(t){return t.symbol===o}).forEach(function(t){var i,n,s,a,l,c=$("<tr class='drawing-item'>").appendTo(e);c.data("id",t.datasource._id),i=$('<div class="name-column">'),n=$("<span>").append($.t(t.name)).addClass("name").appendTo(i),r.call(n,t.datasource.properties().visible),t.datasource.properties().visible.subscribe(null,r.bind(n)),s=$("<td class='drawing-property'>").append(i).appendTo(c),E.list.setIcon(s,t),a=$('<td class="controls-cell drawing-property">').appendTo(c),l=$("<div>").addClass("controls").appendTo(a),$('<a class="button flat format" title="'+$.t("Format")+'"><span class="icon"></span></a>').appendTo(l).click({source:t.datasource},d),$('<a class="button flat delete" title="'+$.t("Delete")+'"><span class="icon"></span></a>').appendTo(l).click({symbol:o,source:t.datasource},function(t){t.preventDefault(),h(t)})})),e.show()),E._scroll.updateScrollBar()},l=function(t){var e=$(t.target).addClass("button-in-process").find(".icon").addClass("icon-delete"),i=t.data.symbol,o=E.items.filter(function(t){return t.symbol===i});TradingView.unifiedSpinner("micro").spin(e.get(0)),C.model.beginUndoMacro($.t("Remove all line tools for ")+i),E.asyncRemoveInterval=setInterval(function(){var e=o.splice(0,200).map(function(t){return t.datasource});if(C.model.removeLineTools(e),!o.length)return C.model.emitEvent("removeSource",[e]),C.model.endUndoMacro(),c(t,".row"),w(x),void clearInterval(E.asyncRemoveInterval)},50),E.$mainDialog.one("destroy",function(){clearInterval(E.asyncRemoveInterval)}),delete L[i],v(),t.stopPropagation()},h=function(t){var e=t.data.source,i=t.data.symbol,o=E.items.filter(function(t){return t.symbol===i}).length;return 1===o?void l(t):(C.model.removeSource(e),_(t),c(t,".drawing-item"),p(e._id),void v())},c=function(t,e){var i,o=$(t.target).closest(e),n=o.parent().children(),s=n.index(o),r=n.length;o.remove(),r>0&&(s!==r-1?i=n[s+1]:0!==s&&(i=n[s-1]),u.call(i),E._scroll.scrollToStart(),E._scroll.scrollTo($(i)),E._scroll.updateScrollBar())},d=function(t){var e=t.data.source,o=i(258);new o(e,C.model).show()},p=function(t){E.items.forEach(function(e,i,o){t===e.datasource._id&&o.splice(i,1)})},u=function(){var t,e;P.find(".selected").removeClass("selected"),$(this).addClass("selected"),t=$(this).data("id"),e=E.items.filter(function(e){return e.datasource._id===t})[0],e&&C.model.setSelectedSource(e.datasource)},_=function(t){var e=$(t.target).closest(".expanded").find(".symbol").text();L[e].count-=1,L[e].row.$counter.text(L[e].count)},f=function(t,e,i){var o=[];return i=i||"ASC",$.each(t,function(t,e){o.push({name:t,counter:e.count})}),"ASC"===i?o.sort(function(t,i){return t[e]<i[e]?-1:t[e]>i[e]?1:0}):"DESC"===i&&o.sort(function(t,i){return t[e]>i[e]?-1:t[e]<i[e]?1:0}),o},g=function(){k=0,$.each(L,function(t,e){k+=e.count})},m=function(){o&&o.text($.t("# (Total: {0})").format(k))},v=function(){g(),m()},y=function(t){var e=this.data("order"),i={ASC:"DESC",DESC:"ASC"};S(t,i[e]),E.saveSortSettings(t,i[e])},b=function(t,e){$.each(t,function(t,e){e.removeClass("sorted")}),t[e].addClass("sorted")},w=function(t){var e=t.find(".row");e.find(".symbol-title").length||(e.remove(),$('<div class="empty-drawings-list"></div>').text($.t("No drawings yet")).appendTo(t))},S=function(t,e){var i,n,s,r,h;if(t=t||"name",e=e||"ASC",i=E.dialog.getSourceProperties(),P.empty(),E.items=i.drawings,!E.items.length)return void w(x);for(n=$('<div class="row header"><span class="symbol">'+$.t("Symbol")+'</span><span class="counter">#</span></div>').appendTo(P),s=n.find(".symbol").data("order",e),s.click(y.bind(s,"name")),o=n.find(".counter").data("order",e),o.click(y.bind(o,"counter")),b({name:s,counter:o},t),L={},r=0;r<E.items.length;r++)h=E.items[r],L[h.symbol]?L[h.symbol].count+=1:L[h.symbol]={count:1};f(L,t,e).forEach(function(t){var e,i,o,n=$("<div>").addClass("row").appendTo(P),s=$('<div class="symbol-title">').appendTo(n);P.on("click",".symbol-title, .drawing-item",function(){$(this).hasClass("selected")||u.call(this)}),$('<span class="expand"></span>').appendTo(s),s.click({row:n,symbol:t.name},a),e=$("<span>").append(t.name).addClass("symbol").appendTo(s),i=$("<span>").append(t.counter).addClass("counter").appendTo(s),o=$('<a class="button delete flat delete-symbol">').attr("title",$.t("Delete all drawing for this symbol")).appendTo(s).click({symbol:t.name},l),$('<span class="icon">').appendTo(o),L[t.name].row={$el:n,$symbol:e,$counter:i}}),E._scroll.updateScrollBar(),v()},T=this.getSortSettings()||{},S(T.sortField,T.sortOrder)},t.exports=o},function(t,e,i){"use strict";t.exports={cursor:i(344),dot:i(345),arrow:i(346),eraser:i(347),zoom:i(348),"zoom-out":i(349),measure:i(350),magnet:i(351),drawginmode:i(352),lockAllDrawings:i(353),hideAllDrawings:i(354),SyncDrawing:i(355),showObjectsTree:i(356),removeAllDrawingTools:i(357),group:i(358),LineToolTrendLine:i(359),LineToolTrendAngle:i(360),LineToolHorzLine:i(361),LineToolHorzRay:i(362),LineToolVertLine:i(363),LineToolArrow:i(364),LineToolRay:i(365),LineToolExtended:i(366),LineToolParallelChannel:i(367),LineToolDisjointAngle:i(368),LineToolFlatBottom:i(369),LineToolRegressionTrend:i(370),LineToolPitchfork:i(371),LineToolSchiffPitchfork2:i(372),LineToolSchiffPitchfork:i(373),LineToolInsidePitchfork:i(374),LineToolPitchfan:i(375),LineToolGannSquare:i(376),LineToolGannComplex:i(377),LineToolGannFan:i(378),LineToolFibRetracement:i(379),LineToolTrendBasedFibExtension:i(380),LineToolFibSpeedResistanceFan:i(381),LineToolFibTimeZone:i(382),LineToolTrendBasedFibTime:i(383),LineToolFibCircles:i(384),LineToolFibSpiral:i(385),LineToolFibSpeedResistanceArcs:i(386),LineToolFibWedge:i(387),LineToolFibChannel:i(388),LineToolBrush:i(389),LineToolRectangle:i(390),LineToolRotatedRectangle:i(391),LineToolEllipse:i(392),LineToolTriangle:i(393),LineToolPolyline:i(394),LineToolBezierQuadro:i(395),LineToolBezierCubic:i(396),LineToolArc:i(397),LineToolText:i(398),LineToolTextAbsolute:i(399),LineToolNote:i(400),LineToolNoteAbsolute:i(401),LineToolCallout:i(402),LineToolBalloon:i(403),LineToolPriceLabel:i(404),LineToolArrowMarkLeft:i(405),LineToolArrowMarkRight:i(406),LineToolArrowMarkUp:i(407),LineToolArrowMarkDown:i(408),LineToolFlagMark:i(409),LineTool5PointsPattern:i(410),LineToolCypherPattern:i(411),LineToolABCD:i(412),LineToolTrianglePattern:i(413),LineToolThreeDrivers:i(414),LineToolHeadAndShoulders:i(415),LineToolElliottImpulse:i(416),LineToolElliottTriangle:i(417),LineToolElliottTripleCombo:i(418),LineToolElliottCorrection:i(419),LineToolElliottDoubleCombo:i(420),LineToolCircleLines:i(421),LineToolTimeCycles:i(422),LineToolSineLine:i(423),LineToolRiskRewardLong:i(424),LineToolRiskRewardShort:i(425),LineToolPrediction:i(426),LineToolDateRange:i(427),LineToolPriceRange:i(428),LineToolDateAndPriceRange:i(429),LineToolBarsPattern:i(430),LineToolGhostFeed:i(431),LineToolProjection:i(432)}},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><path d="M16 15h1V8h-1v7zm2 1v1h7v-1h-7zm-2 9h1v-7h-1v7zm-8-8h7v-1H8v1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-750 -750 2095.3 2341.9" enable-background="new 0 0 595.3 841.9"><circle cx="297.6" cy="420.9" r="294.8"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-200 -70 1000 1000"><path d="M486.2 398L109.1 120v468.6L246.3 520l106.6 201.9 99.1-49.6-103-205.7z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M17.948 5.54L7.705 15.468s-.942 1.36-1.67 3.24c-1.255 3.03.314 4.6 1.15 5.226.626.418 4.705 1.045 6.376-.524l10.77-10.767.11-3.866-6.49-3.237zm5.333 7.004l-9.61 9.616c-1.77 1.777-5.43 1.36-6.16.836-.42-.315-1.462-1.987-.63-3.764.838-1.986 1.57-3.24 1.57-3.24l9.515-9.407 5.435 3.03-.107 2.93zm-.52-2.822l-9.2 9.095-5.22-3.034-.31.627 5.124 2.928c-.105.524-.626 1.986-1.252 3.03-1.043 1.57-2.61 1.672-2.61 1.672l.94.418s1.152.106 2.09-1.36c.94-1.465 1.57-3.345 1.57-3.345l9.824-9.617-.94-.414zm1.46-.942l-5.02 4.91v3.453l5.02-4.497zm-6.27-3.24l-4.81 4.702 6.17 3.45 5.02-4.81z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" enable-background="new 0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.95 9.95h-1v3h-3v1h3v3h1v-3h3v-1h-3v-3zm5.8 7.5c.7-1.2 1.2-2.5 1.2-4 0-4.1-3.4-7.5-7.5-7.5s-7.5 3.4-7.5 7.5 3.4 7.5 7.5 7.5c1.5 0 2.9-.5 4.1-1.2l4.3 4.3 2.2-2.2-4.3-4.4zm-6.3 1.5c-3 0-5.5-2.5-5.5-5.5s2.5-5.5 5.5-5.5 5.5 2.5 5.5 5.5-2.5 5.5-5.5 5.5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M20.8 18.5c.7-1.2 1.2-2.5 1.2-4 0-4.1-3.4-7.5-7.5-7.5S7 10.4 7 14.5s3.4 7.5 7.5 7.5c1.5 0 2.9-.5 4.1-1.2l4.3 4.3 2.2-2.2-4.3-4.4zM14.5 20c-3 0-5.5-2.5-5.5-5.5S11.5 9 14.5 9s5.5 2.5 5.5 5.5-2.5 5.5-5.5 5.5zM11 15h7v-1h-7v1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30"><path d="M15 6v2h-1v6h1v2h1v-2h1V8h-1V6zm5 1v2h-1v6h1v2h1v-2h1V9h-1V7zM4 8v16h23v-5H9V8zm1 1h3v2H6v1h2v2H6v1h2v2H6v1h2v1.293l-3 3zm3.707 11H11v2h1v-2h2v2h1v-2h2v2h1v-2h2v2h1v-2h2v2h1v-2h2v3H5.707z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" enable-background="new 0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M22 14c-.3-3.9-3.5-7-7.5-7S7.3 10.1 7 14v9h5v-9h.1c.2-1.1 1.2-2 2.4-2s2.2.9 2.4 2h.1v9h5v-9zm-11 8H8v-4h3v4zm10 0h-3v-4h3v4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M19.2 6.6c-.4-.4-1-.4-1.4 0l-1.2 1.2 1.8 1.8 1.9-1.9-1.1-1.1zM6 22l2.8-2.7L7.5 18 6 22zm3.3-6.9c-.4.4-1.6 1.7-1.2 2.1l1.3 1.3 8.3-8.3-1.8-1.8-6.6 6.7z" opacity=".4"/><path fill-rule="evenodd" clip-rule="evenodd" d="M9 25l2.8-2.7-1.3-1.3L9 25zM22.2 9.6c-.4-.4-1-.4-1.4 0l-1.2 1.2 1.8 1.8 1.9-1.9-1.1-1.1zm-9.9 8.5c-.4.4-1.6 1.7-1.2 2.1l1.3 1.3 8.3-8.3-1.8-1.8-6.6 6.7z" opacity=".75"/><path fill-rule="evenodd" clip-rule="evenodd" d="M15.3 21.1c-.4.4-1.6 1.7-1.2 2.1l2.6 2.6c.4.4 1.7-.8 2.1-1.2l6.6-6.6-3.6-3.5-6.5 6.6zM12 28l4-1.5-2.5-2.5-1.5 4zm15.4-13.2l-2.1-2.1c-.4-.4-1-.4-1.4 0l-1.2 1.2 3.5 3.5 1.2-1.2c.3-.4.3-1 0-1.4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" enable-background="new 0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M20 13h-1v-1.5C19 9 17 7 14.5 7S10 9 10 11.5V13H9c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h11c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-8-.9c0-1.7 1.1-3.1 2.5-3.1s2.5 1.4 2.5 3.1v.9h-5v-.9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 14c.1 0 .3 0 .4.1l.7-.7c-.4-.2-.7-.3-1.1-.3-1.6 0-2.9 1.3-2.9 2.9 0 .4.1.8.2 1.1l.8-.8v-.4c0-1 .8-1.9 1.9-1.9zm-4.7 5.2C10.2 18 8.9 16.7 8.3 16c1.1-1.2 4.7-5 8.2-5 .9 0 1.9.3 2.8.7l.7-.7c-1.1-.6-2.3-.9-3.5-.9-4.6 0-9 5.4-9.2 5.6L7 16l.3.4c.1.1 1.6 2 3.8 3.6l.7-.8zm13.9-3.5c-.1-.1-1.5-1.8-3.4-3.2l2.8-2.8-.7-.7L9 24.3l.7.7 3.7-3.7c1 .4 2 .7 3 .7 4.9 0 9-5.4 9.2-5.6l.4-.4-.3-.3zm-7.2.5c-.1.9-.9 1.6-1.7 1.7l1.7-1.7zm-2 4.8c-.7 0-1.5-.2-2.2-.5l1.7-1.7c.2 0 .4.1.6.1 1.5 0 2.9-1.3 2.9-2.9 0-.2 0-.4-.1-.5l2.3-2.3c1.4 1.1 2.6 2.3 3.1 2.9-1.2 1.2-4.6 4.9-8.3 4.9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30"><path d="M11.527 5.975c-1.345 0-2.692.508-3.713 1.53l-.283.282c-2.04 2.04-2.04 5.385 0 7.426l2.18 2.178c-.3-1.1-.26-2.29.17-3.36l-.58-.58c-1.09-1.09-1.09-2.8 0-3.89l.29-.28c1.1-1.09 2.8-1.09 3.89 0l2.76 2.76c1.09 1.1 1.09 2.8 0 3.89l-.28.28c-.313.32-.69.54-1.08.67l1.86 1.86c.353-.21.69-.45.994-.75l.28-.285c2.04-2.042 2.04-5.383 0-7.424l-2.76-2.76c-1.02-1.02-2.367-1.53-3.71-1.53zm1.733 5.285c-.337.208-.655.453-.946.744l-.283.283c-2.04 2.04-2.04 5.385 0 7.426l2.76 2.758c2.04 2.05 5.39 2.05 7.43 0l.29-.28c2.04-2.04 2.04-5.38 0-7.42l-2.18-2.18c.31 1.11.26 2.29-.17 3.37l.58.58c1.09 1.1 1.09 2.8 0 3.89l-.28.29c-1.09 1.093-2.793 1.093-3.89 0l-2.76-2.76c-1.09-1.092-1.09-2.796 0-3.89l.28-.284c.31-.304.67-.513 1.04-.65l-1.86-1.86zM18 13.492v.31l.03.028c-.007-.113-.01-.226-.03-.338z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30"><path d="M18.827 8.17c-1.227.817-.993 1.49-.993 2.318 0 .703-.29 1.49-.62 1.778-.33.29-.8.965-.8.965l1.168 1.25s.823-.52 1.038-.72c.414-.37 1.407-.66 2.193-.66 1.737 0 2.387-.54 2.454-2.49.017-.5-.07-1.63-.07-1.63l-.795.02c-.458 2.406-1.457 2.53-2.28 1.79-.823-.74-1.13-1.193.386-2.774l-.48-.626-1.2.79zM6.46 7.716c-.29.455 1.2 3.847 1.984 4.468.91.785 1.903.496 2.896-.828.827-1.117.827-1.158.083-1.985-.414-.45-1.158-.82-1.696-.82s-1.034-.17-1.157-.38c-.332-.49-1.863-.86-2.11-.45zm3.983 5.846c0 .372 4.95 4.826 8.467 7.68 2.192 1.78 3.268 2.027 2.77.62-.454-1.24-7.983-10.328-8.81-10.576-.618 1.114-1.67 1.914-2.427 2.276zm-.468 5.778C7.74 21.367 7.74 21.367 8.57 22.194c.826.827.826.827 3.018-1.406 1.383-1.414 2.168-2.514 2.168-2.514l-1.272-1.21s-1.268 1.118-2.51 2.276z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M12 7v1H9v2h13V8h-3V7h-7zm-2 4v12h11V11H10z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M5.5 13A2.5 2.5 0 0 0 3 15.5 2.5 2.5 0 0 0 5.5 18 2.5 2.5 0 0 0 8 15.5 2.5 2.5 0 0 0 5.5 13zm9.5 0a2.5 2.5 0 0 0-2.5 2.5A2.5 2.5 0 0 0 15 18a2.5 2.5 0 0 0 2.5-2.5A2.5 2.5 0 0 0 15 13zm9.5 0a2.5 2.5 0 0 0-2.5 2.5 2.5 2.5 0 0 0 2.5 2.5 2.5 2.5 0 0 0 2.5-2.5 2.5 2.5 0 0 0-2.5-2.5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30"><path d="M21 5v3.3L8.3 21H5v4h4v-3.3L21.7 9H25V5zm1 1h2v2h-2zM6 22h2v2H6z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30"><path d="M21 5v3.3L8.3 21H5v4h4v-1h16v-1h-7c0-3.5-1.5-5.5-3.3-7l7-7H25V5zm1 1h2v2h-2zm-8 10.7c1.75 1.3 3 3.55 3 6.3H9v-1.3zM6 22h2v2H6z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29.999999 30.000001" width="30" height="30" enable-background="new 0 0 841.9 595.3"><path d="M3 17h4v-2h16v2h4v-4h-4v1H7v-1H3zm1-1v-2h2v2zm20 0v-2h2v2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29.999999 30.000001" width="30" height="30" enable-background="new 0 0 841.9 595.3"><path d="M3 13v4h4v-2h21v-1H7v-1zm1 1h2v2H4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29.999999 30.000001" width="30" height="30" enable-background="new 0 0 841.9 595.3"><path d="M17 27v-4h-2V7h2V3h-4v4h1v16h-1v4zm-1-1h-2v-2h2zm0-20h-2V4h2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M21 5v3.302l-5.598 2.3 1.7 1.702L9.298 20H6v4h4v-3.298l7.7-7.7 1.5 1.5 2.3-5.4.102-.1L25 9V5zM9 23H7v-2h2zM24 8l-1.9-.002.1-.2-.202.1L22 6h2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M23.646 5.646L18.293 11H15v3.293L8.293 21H5v4h4v-3.293L15.707 15H19v-3.293l5.354-5.353zM16 12h2v2h-2zM6 22h2v2H6z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M23.605 6.646l-4.34 4.34L16 11l-.014 3.307L13.293 17H10v3.293l-3.354 3.353.708.708L10.707 21H14v-3.293l2.67-2.67L20 15v-3.334l4.313-4.312zM17 12h2v2h-2zm-6 6h2v2h-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M17 4v3.293L7.293 17H4v4h4v-3.293L17.707 8H21V4zm1 1h2v2h-2zm7.646 4.646L19.293 16H16v3.293l-6.354 6.353.708.708 6.376-6.377L20 20l.014-3.307 6.34-6.34zM17 17h2v2h-2zM5 18h2v2H5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M22 3v2.047L9 10.352V10H5v4h4v-2.566l13-5.307V7h4V3zm1 1h2v2h-2zM6 11h2v2H6zm-1 6v4h4v-.783l13 5.2V28h4v-4h-4v.34l-13-5.2V17zm1 1h2v2H6zm17 7h2v2h-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M22 4v2.87L7 13.048V13H3v4h4v-2.87l15-6.177V8h4V4h-4zm1 1h2v2h-2V5zM4 14h2v2H4v-2zm-1 8v4h4v-1.5h15V26h4v-4h-4v1.5H7V22H3zm1 1h2v2H4v-2zm19 0h2v2h-2v-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M537.9 163.6l-14.7-26.4L54.4 400.9l14.7 26.4 468.8-263.7zM57.4 550.4L72 576.8 540.9 313l-14.7-26.4L57.4 550.4zm0 146.5L72 723.3l468.8-263.7-14.7-26.4L57.4 696.9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M15.646 3.646L7.293 12 11 15.707v2.586l-7.354 7.353.708.708L11.707 19h2.586L18 22.707l8.354-8.353-.708-.708L18 21.293l-3-3v-2.586l6.354-6.353-.708-.708L14.293 15h-2.586l-3-3 7.647-7.646zM12 16h2v2h-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M15.646 3.646L7.293 12 11 15.707v2.586L8.293 21H4v1h14.707l7.647-7.646-.708-.708L18.293 21h-.586L15 18.293v-2.586l6.354-6.353-.708-.708L14.293 15h-2.586l-3-3 7.647-7.646zM12 16h2v2h-2zm-.293 3h2.586l2 2H9.707z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M17 2v10.994h2V7.2l2 5.794h2l2.004-5.8.002 4.89V13l2-.002v-.916L27 2h-2l-3 7.398L19 2h-2zm-1.354 1.646L7.293 12 11 15.707v2.586L8.293 21H4v1h14.707l7.647-7.646-.708-.708L18.293 21h-.586L15 18.293v-2.586l1-1-.707-.707-1 1h-2.586l-3-3 7.647-7.646-.708-.708zM12 16h2v2h-2v-2zm-.293 3h2.586l2 2H9.707l2-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M15.646 3.646L8.29 11.002l-.35.352.015 1.308L8.06 22v.006L18.294 22l8.06-7.646-.707-.708L18.293 21h-.586L15 18.293v-2.586l6.354-6.353-.708-.708L14.293 15h-2.586L8.89 12.184l-.003-.364 7.467-7.466zm-6.74 9.967L11 15.707v2.586l-2.02 2.02zM12 16h2v2h-2zm-.293 3h2.586l3 3H9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M5 4v2H4v4h1v12H4v4h4v-1h12v1h4v-1h2v-1h-2v-2h-3.293l-2.816-2.816 9.3-3.72-.37-.93-9.69 3.878L14.71 16l9.646-9.646-.708-.708L14 15.293l-2.414-2.414 3.88-9.7-.93-.37-3.72 9.29L8 9.29V6H6V4zm0 3h2v2H5zm1 3h1.39l3.12 3.12L6.86 22H6zm5.184 3.89l2.11 2.11-4.925 4.924zM14 16.708l2.11 2.11-7.034 2.814zm2.88 2.88l3.12 3.12V24H8v-.86zM5 23h2v2H5zm16 0h2v2h-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30" enable-background="new 0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 5v20h20V5H5zm14 1h5v3h-5V6zm0 4h5v4h-5v-4zm-6-4h5v3h-5V6zm0 4h5v4h-5v-4zm5 5v5h-5v-5h5zM9 6h3v3H9V6zm0 4h3v4H9v-4zm3 5v5H9v-5h3zM6 6h2v3H6V6zm0 4h2v4H6v-4zm0 5h2v5H6v-5zm0 9v-3h2v3H6zm3 0v-3h3v3H9zm4 0v-3h5v3h-5zm11 0h-5v-3h5v3zm-5-4v-5h5v5h-5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M4 4v22h22V4zm2.12 1H11v.285l-.303.832c-.85-.32-1.644-.564-2.36-.74C7.474 5.167 6.76 5.065 6.12 5zm6.048 0H18v5.38c-2.16-1.71-4.19-2.907-6-3.72V5.465zM19 5h5.293L19 10.293zm6 .707V11h-5.293zM5 5.91c.69.014 1.72.102 3.098.44.68.167 1.44.4 2.257.71L8.922 11H5zm7 1.856c1.574.743 3.314 1.785 5.172 3.234H12zm-1 .45V11H9.986zM5 12h3.56l-2.183 6H5zm4.623 0H11v6H7.44zM12 12h5.293L12 17.293zm7.848 0H25v5.832l-.465.168h-.97c-.76-2.048-1.93-4.177-3.717-6zm-.848.574c1.636 1.63 2.735 3.547 3.473 5.426H19zm-1 .133V18h-5.293zM5 19h1.014L5 21.785zm2.078 0h3.215L5.24 24.053zM12 19h6v1.377l-6 2.182zm7 0h2.785L19 20.014zm5.715 0H25v6h-.04c-.048-1.186-.233-3.292-.97-5.736zm-1.68.61c.682 2.29.868 4.265.92 5.39H19v-3.922zM11 19.708v3.215L5.947 24.76zm7 1.734V25h-6v-1.377zm-7 2.546V25H8.215z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M14.04 3.303l-.788 1.838.92.4.787-1.84-.92-.39zM5 4.5V25h20.5v-1H7.936l.378-.162-.394-.92-.23.098L23.855 6.854l-.708-.708L6.984 22.31l.098-.23-.92-.394-.162.378V4.5H5zm7.465 2.48l-.787 1.838.918.393.79-1.83-.92-.39zm-1.576 3.676l-.79 1.838.92.395.79-1.84-.92-.4zm-1.58 3.676l-.79 1.84.92.392.78-1.837-.92-.395zm16.99.71l-1.84.786.39.92 1.83-.79-.397-.917zm-3.68 1.573l-1.84.79.39.917 1.84-.787-.4-.92zM7.73 18.01l-.787 1.838.92.394.78-1.84-.918-.392zm11.213.18l-1.84.79.39.918 1.84-.787-.396-.92zm-3.68 1.578l-1.84.787.392.92 1.84-.788-.396-.92zm-3.678 1.576l-1.84.787.393.92 1.84-.78-.393-.92z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M4.3 642.1H591v-32.6H4.3v32.6zm0-195.6H591v-32.6H4.3v32.6zm0-228.1V251H591v-32.6H4.3z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M25 17H6.05l-.03-3.68 16.187-7.386-.414-.91L5.016 12.68 5.05 17H5v1h.057v.004l.5-.004H25v-1zm0 3H5v1h20v-1zm0 3H5v1h20v-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M14.04 3.303l-.788 1.838.92.4.787-1.84-.92-.39zM5 4.5V25h20.5v-1H21v-6.102l.182.424 1.838-.787-.393-.92-1.627.7v-7.61l2.854-2.852-.708-.708L20.293 9h-7.607l.7-1.627-.92-.393-.788 1.838.424.182H6V4.5H5zM6 10h13.293l-5 5h-4.178l.117-.273-.92-.395-.285.668H6v-5zm4.89.656l-.788 1.838.918.395.79-1.84-.92-.4zm9.11.05V24h-5v-3.027l.668-.286-.395-.92-.273.118v-4.178l5-5zm6.303 4.335l-1.838.79.394.92 1.83-.79-.4-.91zM6 16h2.6l-.075.172.92.392.242-.564h3.606l-6.31 6.31.1-.23-.92-.394-.163.378V16zm8 .707v3.605l-.564.243.392.92L14 21.4V24H7.936l.378-.162-.394-.92-.23.098 6.31-6.31zM7.738 18.01l-.79 1.838.92.394.788-1.84-.918-.392zm11.21.18l-1.837.79.4.918 1.84-.787-.39-.92zm-7.35 3.154l-1.84.787.394.92 1.838-.78-.392-.92z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M7 4v22h1V4zm5 0v22h1V4zm10 0v22h1V4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M17 5v18.95l-3.68.03L5.934 7.792l-.91.414 7.656 16.777L17 24.95V25h1v-.057h.004l-.004-.5V5h-1zm3 0v20h1V5h-1zm3 0v20h1V5h-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M297.6 362.3c-32.2 0-58.6 26.4-58.6 58.6s26.4 58.6 58.6 58.6 58.6-26.4 58.6-58.6-26.3-58.6-58.6-58.6zm0 87.9c-17.6 0-29.3-14.7-29.3-29.3 0-17.6 14.7-29.3 29.3-29.3 17.6 0 29.3 14.7 29.3 29.3 0 17.6-11.7 29.3-29.3 29.3zm0-175.8c-79.1 0-146.5 64.5-146.5 146.5s64.5 146.5 146.5 146.5S444.2 503 444.2 420.9s-67.4-146.5-146.6-146.5zm0 263.8c-64.5 0-117.2-52.7-117.2-117.2s52.7-117.2 117.2-117.2S414.8 356.5 414.8 421s-52.7 117.2-117.2 117.2zm0-322.4c-114.3 0-205.1 90.8-205.1 205.1S183.3 626 297.6 626s205.1-90.8 205.1-205.1-90.8-205.1-205.1-205.1zm0 381c-96.7 0-175.8-79.1-175.8-175.8s79.1-175.8 175.8-175.8S473.4 324.3 473.4 421s-79.1 175.8-175.8 175.8zm0-468.9c-161.2 0-293 131.9-293 293s131.9 293 293 293 293-131.9 293-293-131.8-293-293-293zm0 556.8C151.1 684.7 33.9 567.5 33.9 421s117.2-263.7 263.7-263.7S561.3 274.5 561.3 421 444.2 684.7 297.6 684.7z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M411.2 234c-83.058 0-152.1 69.043-152.1 152.1 0 17.915 3.948 35.028 11.01 50.504l-150.4 30.076c-12.193-30.528-18.91-63.825-18.91-98.68h-20c0 36.155 6.758 70.764 19.046 102.652l-95.88 19.174 5.06 25.3L110.48 494.84C157.367 589.342 254.892 654.5 367.3 654.5c126.89 0 232.2-102.785 232.2-232.2 0-103.637-84.663-188.3-188.3-188.3zm0 20c92.76 0 168.3 75.54 168.3 168.3 0 118.587-96.087 212.2-212.2 212.2-102.81 0-192.092-58.358-236.532-143.72l153.378-30.673c22.716 30.04 58.685 49.694 98.655 49.694 54.71 0 100.4-45.69 100.4-100.4 0-46.72-38.25-82.4-82.4-82.4v20c33.46 0 62.4 26.53 62.4 62.4 0 43.5-36.9 80.4-80.4 80.4-29.91 0-57.24-13.27-76.33-34.15l90.29-18.05-5.06-25.3-101.3 20.26c-7.21-14.045-11.3-29.85-11.3-46.45 0-71.94 60.16-132.1 132.1-132.1z"/></svg>';
},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M297.6 439.5c79 0 146.3-64.4 146.3-146.3h-29.3c0 64.4-52.7 117.1-117.1 117.1s-117.1-52.7-117.1-117.1h-29.3c.2 82 64.6 146.3 146.5 146.3zm0-87.7c32.2 0 58.5-26.3 58.5-58.5h-29.3c0 17.6-14.6 29.3-29.3 29.3s-29.3-14.6-29.3-29.3h-29.3c.2 32.1 26.5 58.5 58.7 58.5zm0 146.3c114.1 0 204.8-90.7 204.8-204.8h-29.3c0 96.6-79 175.6-175.6 175.6s-175.6-79-175.6-175.6H92.8c0 114.1 90.7 204.8 204.8 204.8zM561 293.2c0 146.3-117.1 263.4-263.4 263.4S34.3 439.5 34.3 293.2H5c0 161 131.7 292.6 292.6 292.6s292.6-131.7 292.6-292.6H561z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M566.4 639.5C530.1 399.6 337.6 207.1 97.7 170.8v-33.5H14V221h27.9v418.5H14v83.7h83.7v-27.9h418.5v27.9h83.7v-83.7h-33.5zM41.9 165.2h27.9v27.9H41.9v-27.9zm27.9 530.1H41.9v-27.9h27.9v27.9zm27.9-27.9v-27.9H69.8v-106c67 16.7 117.2 67 133.9 133.9h-106zm133.9 0c-16.7-80.9-80.9-145.1-161.8-161.8v-83.7c125.5 22.3 223.2 120 245.5 245.5h-83.7zm111.6 0C320.9 527.9 209.3 416.3 69.8 394v-83.7c186.9 22.3 334.8 170.2 359.9 357.1h-86.5zm173 0h-58.6C432.5 466.5 270.7 304.7 69.8 279.6V221h27.9v-19.5c226 36.3 404.5 214.8 438 438h-19.5v27.9zm55.8 27.9h-27.9v-27.9H572v27.9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M387.382 160.99L19.62 528.75 5.193 514.327l367.763-367.762zM399.6 195.6v67.3l-259 259H73.2v81.6h81.6v-67.3l259-259h67.3v-81.6h-81.5zM134.4 583.1H93.6v-40.8h40.8v40.8zm326.3-326.3h-40.8V216h40.8v40.8zm114.2 73.4L426.1 481.1h-53l175.4-175.4-14.3-14.3-367.1 367.2 14.3 14.3 175.4-175.4v53l-151 150.9 14.3 14.3L371 564.8h69.3v-67.3l150.9-150.9-16.3-16.4zm-155 212.1h-40.8v-40.8h40.8v40.8zm88.53-257.64L162.304 630.787 147.88 616.36l346.125-346.124z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M377.6 283.1s-136.2-10.2-183.8 170.2c-30.6 115.7-177 251.9-177 251.9l10.2 17s224.7-54.5 360.8-139.6c177-112.3 64.7-255.3 64.7-255.3l-74.9-44.2zm44.3-143L374.2 249l122.5 68.1 78.3-88.5-153.1-88.5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30"><path d="M4 4v4h2v16h16v2h4v-4h-2V6H8V4zm1 1h2v2H5zm3 2h15v15h-1v1H7V8h1zm15 16h2v2h-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30"><path d="M10 2v3.293L5.293 10H2v4h3.293L16 24.707V28h4v-3.293L24.707 20H28v-4h-3.293L14 5.293V2h-4zm1 1h2v2h-2V3zm-.293 3h2.586L24 16.707v2.586L19.293 24h-2.586L6 13.293v-2.586L10.707 6zM3 11h2v2H3v-2zm22 6h2v2h-2v-2zm-8 8h2v2h-2v-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M13 5v1.557C10.26 6.84 7.792 7.69 5.887 8.95c-2.36 1.564-3.885 3.78-3.885 6.27 0 2.49 1.525 4.708 3.885 6.27 2.36 1.563 5.574 2.508 9.115 2.508 3.54 0 6.755-.945 9.115-2.508 2.36-1.562 3.885-3.78 3.885-6.27 0-2.49-1.525-4.706-3.885-6.27C22.21 7.69 19.743 6.84 17 6.558V5zm1 1h2v2h-2zm3 1.562c2.555.282 4.838 1.08 6.563 2.223C25.727 11.218 27 13.14 27 15.22c0 2.082-1.273 4-3.438 5.434-2.164 1.433-5.198 2.342-8.56 2.342s-6.398-.91-8.563-2.342C4.27 19.22 3 17.302 3 15.22c0-2.08 1.27-4 3.435-5.433 1.723-1.14 4.006-1.94 6.56-2.22V9h4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M4 3v4h1.012L5 23H4v4h4v-3.373L22.78 7H26V3h-4v1H8V3zm1 1h2v2H5zm18 0h2v2h-2zM8 5h14v1.373L7.22 23H6l.012-16H8zM5 24h2v2H5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M22 4v1H11.793L5 11.793V22H4v4h4v-1h8.207L20 20.707V17h5V8h1V4zm1 1h2v2h-2zM12.207 6H22v2h2v8h-5v4.293L15.793 24H8v-2H6v-9.793zM5 23h2v2H5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M23 3v1.5c-9.658 0-14.39 4.657-16.576 9.287C4.256 18.377 4.496 22.922 4.5 23H3v4h4v-4H5l.5-.027s-.237-4.39 1.826-8.76C9.39 9.843 13.658 5.5 23 5.5V7h4V3zm1 1h2v2h-2zM4 24h2v2H4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M23 3v4h1.447c-.458.96-3.4 6.5-10.447 6.5-4.187 0-6.633 2.41-7.938 4.758-1.304 2.35-1.558 4.687-1.558 4.687L5 23H3v4h4v-4H5.504c.018-.15.282-2.186 1.434-4.258C8.133 16.592 10.188 14.5 14 14.5c8.292 0 11.46-7.303 11.46-7.303L25 7h2V3h-4zm1 1h2v2h-2V4zM4 24h2v2H4v-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M455.1 285.4C310.8 141.1 110.9 106.7 4.2 206l23.2 23.3c.2-.2.5-.4.8-.6l483.7 483.7c-.2.3-.4.5-.6.8l23.2 23.2c99.3-106.8 64.9-306.7-79.4-451zm76.2 400.1L55 209.2c98.3-58.6 256.8-19.5 376.3 100s158.7 278.1 100 376.3z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M129.8 244.3L5 609.7h54.8l42.6-121.8h121.8l39.6 121.8h57.8L190.7 244.3h-60.9zm-18.2 213.1l51.8-155.3 51.8 155.3H111.6zm456.6 115.7c-3 0-9.1 0-9.1-3-3-6.1-3-9.1-3-18.3v-134c0-82.2-91.3-82.2-103.5-82.2-30.4 0-109.6 3-109.6 91.3h39.6c3-39.6 42.6-60.9 70-60.9 30.4 0 54.8 15.2 54.8 45.7 0 18.3-18.3 30.4-36.5 33.5 0 0-67 9.1-82.2 18.3-15.2 3-45.7 21.3-45.7 70 0 42.6 27.4 76.1 76.1 76.1 33.5 0 67-18.3 91.3-42.6 0 12.2 3 24.4 12.2 30.4 6.1 6.1 18.3 9.1 33.5 9.1 6.1 0 21.3-3 33.5-6.1V567c-9.2 3.1-18.3 6.1-21.4 6.1zm-60.9-63.9c0 42.6-36.5 70-76.1 70-30.4 0-48.7-9.1-48.7-51.8 0-21.3 33.5-39.6 42.6-39.6 24.4-3 54.8-6.1 85.2-15.2v36.5h-3z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path fill-rule="evenodd" clip-rule="evenodd" d="M567.7 358.1h20c-7.2 47.7-55.1 84.7-113.9 84.7s-106.7-37-113.9-84.7h18.9c8.6 32.1 42.6 56.5 84.5 59.9V295.6h-60.8v-20.7h60.8v-21.6c-12.5-4.2-21.7-15.6-21.7-29.4 0-17.3 14.3-31.4 31.9-31.4 17.6 0 31.9 14.1 31.9 31.4 0 14-9.5 25.5-22.4 29.5v21.5h60.1v20.7H483V418c42-3.4 76.1-27.8 84.7-59.9zm-82.1-134.2c0-6.6-5.4-12-12.1-12-6.7 0-12.1 5.3-12.1 12s5.4 12 12.1 12c6.6 0 12.1-5.4 12.1-12zm-85.5 295.4v92.6c0 5.5 4.2 13.1 6 15.2 1.8 2 4.3 3.1 7.6 3.1 2.4 0 2.2-.5 6.8-1.4v20.9c-7 1.6-10.9 2.4-16 2.4-10.8 0-18-3.4-23-7.7-4.9-4.2-9.2-5.9-10.1-15.5-19.1 20.2-37.9 22.5-65.6 22.5-36.5 0-59.5-22.7-59.5-54.8 0-60.9 75.4-59.9 56.1-57.7 0 0 68.5-5.2 68.5-22.8 0-20.7-11.9-32.3-42.5-32.3-14.3 0-24.9 3-31.8 8.9-6.9 5.9-11 6.7-12.1 18.8h-30c3.6-55.3 70.9-52.6 75.3-52 3.2-.2 23 .1 41.2 9.3 17 8.7 29.1 26.4 29.1 50.5zm-31.5 29.3c-21.8 11.8-38.4 11.5-61.2 17.4-6 1.5-30.9 5.3-30.9 28.2 0 30.4 14.7 37.1 37 37.1 30.5 0 55.1-18.3 55.1-50.5v-32.2zm-204.2 19.2H67.6l-29.1 84.3H1.7l96.4-272.2h41.2l92.9 272.2h-38.8l-29-84.3zM115.9 421L80.5 526.6h71L115.9 421z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9" class="text"><path fill-opacity=".2" fill-rule="evenodd" clip-rule="evenodd" d="M297.7 127.9c-127.1 0-230.1 101.6-230.1 227 0 118.4 104.2 240.4 173.8 314.7 26 27.8 56.3 44.2 56.3 44.2s32.5-16.7 60.4-45.3c69.5-71.3 169.6-183.5 169.6-313.7 0-125.2-103-226.9-230-226.9zm0 335c-57.8 0-104.6-46.8-104.6-104.6S240 253.7 297.7 253.7s104.6 46.8 104.6 104.6-46.8 104.6-104.6 104.6z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M297.7 232.8c-69.3 0-125.5 56.2-125.5 125.5s56.2 125.5 125.5 125.5 125.5-56.2 125.5-125.5-56.1-125.5-125.5-125.5zm0 230.1c-57.8 0-104.6-46.8-104.6-104.6S240 253.7 297.7 253.7s104.6 46.8 104.6 104.6-46.8 104.6-104.6 104.6zm0-335c-127.1 0-230.1 101.6-230.1 227 0 118.4 104.2 240.4 173.8 314.7 26 27.8 56.3 44.2 56.3 44.2s32.5-16.7 60.4-45.3c69.5-71.3 169.6-183.5 169.6-313.7 0-125.2-103-226.9-230-226.9zM352.6 651c-25.4 26.5-54.9 42-54.9 42s-27.5-15.3-51.2-41.1c-63.3-69.1-158-182.3-158-292.3 0-116.4 93.6-210.8 209.1-210.8s209.1 94.4 209.1 210.8c.1 121-90.9 225.2-154.1 291.4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9" class="text"><path fill-opacity=".2" fill-rule="evenodd" clip-rule="evenodd" d="M184.1 270C86.7 270 7.7 349.2 7.7 447c0 92.3 79.9 187.4 133.2 245.4 19.9 21.6 43.1 34.5 43.1 34.5s24.9-13 46.3-35.3C283.7 636 360.5 548.5 360.5 447c0-97.8-79-177-176.4-177zm.1 277.5c-53.2 0-96.3-43.8-96.3-97.9 0-54.1 43.1-97.9 96.3-97.9s96.3 43.8 96.3 97.9c-.1 54-43.1 97.9-96.3 97.9z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M184.2 351.7c-53.2 0-96.3 43.8-96.3 97.9 0 54.1 43.1 97.9 96.3 97.9s96.3-43.8 96.3-97.9c-.1-54.1-43.1-97.9-96.3-97.9zm0 167.6c-40.1 0-72.7-32.5-72.7-72.7s32.5-72.7 72.7-72.7 72.7 32.5 72.7 72.7-32.6 72.7-72.7 72.7zm-.1-249.3C86.7 270 7.7 349.2 7.7 447c0 92.3 79.9 187.4 133.2 245.4 19.9 21.6 43.1 34.5 43.1 34.5s24.9-13 46.3-35.3C283.7 636 360.5 548.5 360.5 447c0-97.8-79-177-176.4-177zM225 674c-18.9 20.3-40.9 32.1-40.9 32.1s-20.5-11.7-38.1-31.4C99 622 28.5 535.6 28.5 451.7c0-88.9 69.7-160.9 155.7-160.9 85.9 0 155.6 72 155.6 160.9 0 92.2-67.8 171.8-114.8 222.3zm343.4-363.4h19.8c-7.1 47.4-54.7 84.1-113.1 84.1s-105.8-36.7-113-84.1h18.7c8.5 31.8 42.3 56.1 83.9 59.5V248.5h-60.4V228h60.4v-21.5c-12.4-4.2-21.5-15.5-21.5-29.2 0-17.2 14.2-31.2 31.7-31.2s31.7 14 31.7 31.2c0 13.9-9.4 25.3-22.2 29.3V228h59.7v20.5h-59.7v121.6c41.7-3.4 75.5-27.6 84-59.5zm-81.5-133.2c0-6.6-5.4-11.9-12.1-11.9s-12.1 5.3-12.1 11.9 5.4 11.9 12.1 11.9 12.1-5.4 12.1-11.9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9" class="text"><path fill-opacity=".2" d="M179.9 462.6h-42.1c-25.9 0-48.6-22.7-48.6-48.6V284.6c0-25.9 22.7-48.6 48.6-48.6h388.5c25.9 0 48.6 22.7 48.6 48.6v129.5c0 25.9-22.7 48.6-48.6 48.6H264L56.9 605.1l123-142.5z"/><path d="M526.3 252.2c19.4 0 32.4 12.9 32.4 32.4v129.5c0 19.4-12.9 32.4-32.4 32.4H257.6l-9.7 6.5-97.1 64.7 16.2-16.2 45.3-55h-74.5c-19.4 0-32.4-12.9-32.4-32.4V284.6c0-19.4 12.9-32.4 32.4-32.4h388.5m0-32.4H137.8c-35.6 0-64.7 29.1-64.7 64.7V414c0 35.6 29.1 64.7 64.7 64.7h6.5L1.8 640.7H31l233-161.9h259c35.6 0 64.7-29.1 64.7-64.7V284.6c3.3-35.6-25.8-64.8-61.4-64.8z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9" class="text"><path fill-opacity=".2" d="M139.9 488.7H134c-64.3-2.9-113.9-55.5-113.9-116.9 0-64.3 55.5-116.9 122.7-116.9h309.7c67.2 0 122.7 52.6 122.7 116.9s-55.5 116.9-122.7 116.9H224.6v93.5l-84.7-93.5z"/><path d="M452.5 269.5c58.4 0 108.1 46.7 108.1 102.3s-49.7 102.3-108.1 102.3H210v70.1l-55.5-61.4-8.8-8.8H134c-55.5-2.9-99.3-49.7-99.3-102.3 0-55.5 49.7-102.3 108.1-102.3h309.7m0-29.1H142.8c-76 0-137.3 58.4-137.3 131.5 0 70.1 58.4 125.6 128.6 131.5l105.2 116.9V503.3h213.3c76 0 137.3-58.4 137.3-131.5s-61.4-131.5-137.4-131.5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9" class="text"><path d="M10.17 6.45c-1.145 0-2.077.928-2.077 2.078v6.225c0 .9.575 1.668 1.373 1.953L6.596 20H3v4h4l.057-2.825 6.635-4.35h12.23c1.146 0 2.078-.927 2.078-2.077v-6.22c0-1.15-.927-2.077-2.077-2.077zm.715 1.037h14.163c1.056 0 1.916.87 1.916 1.942v4.39c0 1.07-.86 1.94-1.916 1.94H13.66l-4.013 2.71-.383.02 1.238-2.775c-.83-.18-1.337-.964-1.337-1.9V9.43c0-1.073.663-1.943 1.72-1.943zM4 21h2v2H4z"/><path fill-opacity=".2" fill-rule="evenodd" clip-rule="evenodd" d="M25.06 7.523H10.894c-1.056 0-1.72.87-1.72 1.943v4.397c0 .937.51 1.72 1.337 1.9L9.28 18.54l.384-.026 4.014-2.71H25.06c1.055 0 1.915-.87 1.915-1.94v-4.4c0-1.072-.86-1.942-1.916-1.942z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9" class="text"><path d="M5 16l13 10v-6h8v-8h-8V6L5 16zm1.5 0L17 8v5h8v6h-8v5L6.5 16z"/><path d="M6.5 16L17 8v5h8v6h-8v5z" opacity=".3"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9" class="text"><path d="M26 16L13 6v6H5v8h8v6l13-10zm-1.5 0L14 24v-5H6v-6h8V8l10.5 8z"/><path d="M24.5 16L14 24v-5H6v-6h8V8z" opacity=".3"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9" class="text"><path d="M15 5L5 18h6v8h8v-8h6L15 5zm0 1.5L23 17h-5v8h-6v-8H7l8-10.5z"/><path d="M15 6.5L23 17h-5v8h-6v-8H7z" opacity=".3"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9" class="text"><path d="M16 27l10-13h-6V6h-8v8H6l10 13zm0-1.5L8 15h5V7h6v8h5l-8 10.5z"/><path d="M16 25.5L8 15h5V7h6v8h5z" opacity=".3"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9" class="text"><path d="M303.306 426.633v-241.3h189.7l-93.1 120.7 96.5 120.6zM276.9 399.2c-3.4-3.4-6.9-3.4-13.8-3.4H111.4V154.4h148.3c3.4 0 13.8 10.3 17.2 17.2zm-17.2-262.1H94.2V413h169c13.8 0 31 31 31 31V164.7s-13.8-27.6-34.5-27.6zm-172.4 0H52.8v586.2h34.5zm443.606 30.933h-241.4v275.9h241.4l-110.4-138z"/><path d="M107.02 155.182v244.363h172.126V155.182H107.02zm194.423 26.754v251.5h206.91l-108.81-127.534L508.35 181.936H301.44z" opacity=".2"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M25.3 19L22.5 8H24V4h-4v4h1.3l-4 4h-2.4L12 7.6V4H8v4h1.5L5.7 23H4v4h4v-3.4l6.8-7.6h2.798L23 19.9V23h4v-4zM9 7V5h2v2zM7.003 26H5v-2h2v2zM14 15.4L7.2 23h-.397L10.5 8.102l-.498-.098h1.1l2.898 4.4zm3-.4h-2v-2h2zm4-8V5h2v2zm-3.002 8.102v-2.4l3.698-3.697L24.2 19h-.8zM26 22h-2v-2h2z"/></svg>'},410,function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M21 3v1.975l-9 4.91V9H8v4h1.34L7.648 24H6v4h4v-1.975l9-4.91V22h4v-4h-1.34l1.692-11H25V3zm1 1h2v2h-2zm-1 2.115V7h1.34l-1.692 11h-1.12L12 12.145v-1.12zM9 10h2v2H9zm1.352 3h1.12L19 18.855v1.12l-9 4.91V24H8.66zM20 19h2v2h-2zM7 25h2v2H7z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M4.5 3.238V22H3v4h4v-2.05l5-2.24V22h4v-2.08l13.238-5.926L22 10.848V9h-4v.107L14 7.37V5h-4v.63zm1 1.526L10 6.72V9h1.44L5.5 20.883zM11 6h2v2h-2zm3 2.46l4 1.737V13h1.064l-4.755 4.078L12.51 9H14zM19 10h2v2h-2zm-7.184.482L13.488 18H12v2.615l-5 2.24V22h-.94zM22 11.937l4.76 2.07L16 18.823V18h-1.232l5.834-5H22zM13 19h2v2h-2zm-9 4h2v2H4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M25 2v4h1.387l-2.602 7.145L21 12.005V10h-4v.37l-3-1.23V7h-4v.506L6 5.87V3H2v4h1.072l1.76 11H4v1.664l-2.416-.89-.346.94L4 20.73V22h3.45l2.55.937v1.995h3.828v-.584L18 25.88V28h4v-.646l2.002.736.346-.938L22 26.29V24h-1.102l3.473-9.535 2.44.998.38-.926-2.47-1.014L27.46 6H29V2zm1 1h2v2h-2zM3 4h2v2H3zm3 2.95l4 1.636V11h.287l-4.264 7h-.18L4.083 7H6zM11 8h2v2h-2zm3 2.223l3 1.226V14h.652l-5.502 7h-.318l-.11-10H14zM18 11h2v2h-2zm-7.266 1.19l.098 8.81H10v.873l-2-.736V18h-.805zM21 13.085l2.44.998-3.13 8.602L19.583 14H21zm-2.385 1.307l.8 9.607H18v.81l-4.172-1.54V21h-.406zM7 19v2H5v-2zm6 3v2h-2v-1.996zm6 3h2v2h-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M13 0v4h1.06l-5.2 13h-.247l-3-6H7V7H3v4h.8l-1.958 8.242-1.91.262.136.992 1.526-.21L.236 26H0v4h4v-4H1.264l1.392-5.86L7 19.546V21h4v-2.002l7-.96V19h4v-1.512l4.043-.554L28.33 24H26v4h4v-4h-.617l-2.332-7.203 3.02-.414-.13-.992-3.19.44-1.9-5.83H26V6h-4v4h.99l-2.898 4.867L15.844 4H17V0zm1 1h2v2h-2zm.95 3.46L19.073 15H18v2.027l-7 .96V17H9.94zM23 7h2v2h-2zM4 8h2v2H4zm19.924 2.39l1.805 5.577-3.73.512V15h-.83zM4.72 11.452L7.495 17H7v1.535l-4.096.56zM21 16v2h-2v-2zm-11 2v2H8v-2zm17 7h2.18v2H27zM1.025 27H3v2H1v-1.893z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M10.943 9.127c-1.294 0-2.347 1.06-2.347 2.35s1.058 2.347 2.347 2.347c1.29 0 2.348-1.058 2.348-2.347 0-1.29-1.052-2.35-2.346-2.35zm14.805.707l-5.873 5.87.824.825 5.875-5.88-.828-.817zM8.125 13.357l-4.7 4.702.823.822 4.7-4.7-.823-.826zm5.637 0l-.823.825 2.346 2.347.822-.826-2.348-2.348zm4.23 2.82c-1.294 0-2.347 1.057-2.347 2.346 0 1.295 1.058 2.35 2.347 2.35 1.29 0 2.348-1.06 2.348-2.35.005-1.29-1.054-2.347-2.348-2.347z"/><path d="M6 11.03h-.89V5.308q0-.714.044-1.35-.115.114-.258.24-.143.127-1.307 1.072l-.485-.628L5.23 3H6v8.03z"/><path d="M23.802 23.126q1.27 0 1.994.63.73.628.73 1.72 0 1.248-.796 1.956-.79.71-2.186.71-1.357 0-2.07-.435v-.88q.384.248.955.39.57.138 1.125.138.967 0 1.5-.456.538-.457.538-1.32 0-1.68-2.06-1.68-.522 0-1.395.16l-.473-.303.303-3.757h3.993v.84H22.75l-.204 2.412q.632-.126 1.258-.126z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M10.943 9.127c-1.294 0-2.347 1.06-2.347 2.35s1.058 2.347 2.347 2.347c1.29 0 2.348-1.058 2.348-2.347 0-1.29-1.052-2.35-2.346-2.35zm14.805.707l-5.873 5.87.824.825 5.875-5.88-.828-.817zM8.125 13.357l-4.7 4.702.823.822 4.7-4.7-.823-.826zm5.637 0l-.823.825 2.346 2.347.822-.826-2.348-2.348zm4.23 2.82c-1.294 0-2.347 1.057-2.347 2.346 0 1.295 1.058 2.35 2.347 2.35 1.29 0 2.348-1.06 2.348-2.35.005-1.29-1.054-2.347-2.348-2.347z"/><path d="M7.593 10.064l-1-2.554h-3.22l-.988 2.554H1.44L4.615 2H5.4l3.16 8.064h-.967zM6.303 6.67l-.935-2.49q-.18-.472-.373-1.158-.12.527-.347 1.16l-.944 2.487h2.598z"/><path d="M25.477 28.03H21V20h4.477v.83h-3.543v2.587h3.33v.824h-3.33v2.956h3.543v.835z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M10.943 9.127c-1.294 0-2.347 1.06-2.347 2.35s1.058 2.347 2.347 2.347c1.29 0 2.348-1.058 2.348-2.347 0-1.29-1.052-2.35-2.346-2.35zm14.805.707l-5.873 5.87.824.825 5.875-5.88-.828-.817zM8.125 13.357l-4.7 4.702.823.822 4.7-4.7-.823-.826zm5.637 0l-.823.825 2.346 2.347.822-.826-2.348-2.348zm4.23 2.82c-1.294 0-2.347 1.057-2.347 2.346 0 1.295 1.058 2.35 2.347 2.35 1.29 0 2.348-1.06 2.348-2.35.005-1.29-1.054-2.347-2.348-2.347z"/><path d="M8.91 9.03h-.924l-1.62-5.377q-.116-.357-.26-.9-.142-.545-.147-.654-.122.724-.386 1.586L4.004 9.03H3.08L.944 1h.988l1.27 4.96q.263 1.044.384 1.89.148-1.005.44-1.967L5.463 1h.99l1.51 4.927q.263.852.445 1.923.103-.78.394-1.9L10.068 1h.988L8.91 9.03z"/><path d="M27.52 28.03H22v-.73l4.263-6.46h-4.13V20H27.4v.73l-4.263 6.455h4.384v.846z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M10.943 9.127c-1.294 0-2.347 1.06-2.347 2.35s1.058 2.347 2.347 2.347c1.29 0 2.348-1.058 2.348-2.347 0-1.29-1.052-2.35-2.346-2.35zm14.805.707l-5.873 5.87.824.825 5.875-5.88-.828-.817zM8.125 13.357l-4.7 4.702.823.822 4.7-4.7-.823-.826zm5.637 0l-.823.825 2.346 2.347.822-.826-2.348-2.348zm4.23 2.82c-1.294 0-2.347 1.057-2.347 2.346 0 1.295 1.058 2.35 2.347 2.35 1.29 0 2.348-1.06 2.348-2.35.005-1.29-1.054-2.347-2.348-2.347z"/><path d="M6.593 11.064l-1-2.554h-3.22l-.988 2.554H.44L3.615 3H4.4l3.16 8.064h-.967zM5.303 7.67l-.935-2.49q-.18-.472-.373-1.158-.12.527-.347 1.16l-.944 2.487h2.598z"/><path d="M24.818 20.835q-1.323 0-2.092.884-.764.878-.764 2.41 0 1.577.736 2.44.742.857 2.11.857.84 0 1.917-.302v.818q-.835.313-2.06.313-1.775 0-2.74-1.076-.963-1.077-.963-3.06 0-1.242.462-2.175.467-.934 1.34-1.44.88-.505 2.065-.505 1.263 0 2.208.46l-.396.803q-.912-.428-1.824-.428z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M10.943 9.127c-1.294 0-2.347 1.06-2.347 2.35s1.058 2.347 2.347 2.347c1.29 0 2.348-1.058 2.348-2.347 0-1.29-1.052-2.35-2.346-2.35zm14.805.707l-5.873 5.87.824.825 5.875-5.88-.828-.817zM8.125 13.357l-4.7 4.702.823.822 4.7-4.7-.823-.826zm5.637 0l-.823.825 2.346 2.347.822-.826-2.348-2.348zm4.23 2.82c-1.294 0-2.347 1.057-2.347 2.346 0 1.295 1.058 2.35 2.347 2.35 1.29 0 2.348-1.06 2.348-2.35.005-1.29-1.054-2.347-2.348-2.347z"/><path d="M7.91 10.03h-.924l-1.62-5.377q-.116-.357-.26-.9-.142-.545-.147-.654-.122.724-.386 1.586l-1.57 5.345H2.08L-.056 2h.988l1.27 4.96q.263 1.044.384 1.89.148-1.005.44-1.967L4.463 2h.99l1.51 4.927q.263.852.445 1.923.103-.78.394-1.9L9.068 2h.988L7.91 10.03z"/><path d="M24.997 24l2.143-4.016h1.01L25.47 24.9v3.116h-.945v-3.07l-2.675-4.962h1.02L24.998 24z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M7 4v22h1V4H7zm5 0v22h1V4h-1zm5 0v22h1V4h-1zm5 0v22h1V4h-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M1 15.5v1s1.647.007 3.277.822C5.907 18.138 7.5 19.667 7.5 23H6v4h4v-4H8.508c.03-.186.287-1.697 1.176-3.252.946-1.656 2.51-3.248 5.316-3.248 2.267 0 3.876 1.59 4.955 3.27 1.01 1.57 1.456 3.032 1.516 3.23H20v4h4v-4h-1.5c0-3.333 1.592-4.862 3.223-5.678C27.353 16.507 29 16.5 29 16.5v-1s-1.853-.007-3.723.928c-1.488.744-2.984 2.162-3.54 4.552-.25-.544-.545-1.132-.942-1.75-1.17-1.82-3.062-3.73-5.795-3.73-3.194 0-5.13 1.908-6.184 3.752-.26.453-.468.905-.638 1.33-.62-2.158-2.05-3.45-3.455-4.154C2.853 15.493 1 15.5 1 15.5zM7 24h2v2H7zm14 0h2v2h-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M10 2.5c-1.208 0-2.17.765-2.88 1.775-.706 1.01-1.215 2.3-1.6 3.58-.766 2.56-1.018 5.096-1.018 5.096L5 13H3v4h4v-4H5.504c.008-.076.254-2.453.975-4.855.36-1.22.85-2.43 1.46-3.295.6-.865 1.27-1.35 2.06-1.35.25 0 .59.218 1 .812.4.595.81 1.503 1.21 2.608.793 2.21 1.55 5.2 2.3 8.2.75 3 1.493 6.01 2.32 8.3.414 1.145.844 2.112 1.33 2.83.488.718 1.08 1.25 1.83 1.25 1.207 0 2.17-.765 2.88-1.775.705-1.01 1.214-2.3 1.6-3.58.765-2.56 1.017-5.096 1.017-5.096L25 17h2v-4h-4v4h1.496c-.008.076-.254 2.453-.975 4.855-.36 1.22-.85 2.43-1.46 3.295-.6.865-1.26 1.35-2.06 1.35-.25 0-.59-.218-1-.813-.4-.594-.81-1.502-1.21-2.607-.79-2.21-1.55-5.2-2.3-8.2-.75-3-1.49-6.01-2.32-8.3-.41-1.145-.84-2.112-1.33-2.83-.49-.718-1.08-1.25-1.83-1.25zM4 14h2v2H4v-2zm20 0h2v2h-2v-2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" width="30" height="30"><path d="M10 10v2h38v-2H10zm19 2l-6 6h5v14H10v2h18v6h-5l6 6 6-6h-5v-6h18v-2H30V18h5l-6-6zm0 34H10v2h38v-2H29z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" width="30" height="30"><path d="M10 48v-2h38v2H10zm19-2l-6-6h5V26H10v-2h18v-6h-5l6-6 6 6h-5v6h18v2H30v14h5l-6 6zm0-34H10v-2h38v2H29z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M18 2v4h-2l3.44 4L23 6h-2V2h-3zm-6 7v2h-1v9h1v4h1v-4h1v-9h-1V9h-1zm-4 2v4H7v10h1v2h1v-2h1V15H9v-4H8zm4 1h1v7h-1v-7zm7.5 0a1.5 1.5 0 0 0-1.5 1.5 1.5 1.5 0 0 0 1.5 1.5 1.5 1.5 0 0 0 1.5-1.5 1.5 1.5 0 0 0-1.5-1.5zm-.006.996a.498.498 0 0 1 .498.498.498.498 0 0 1-.498.498.498.498 0 0 1-.498-.498.498.498 0 0 1 .498-.498zM8 15.72h1.19V24H8v-8.28z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M4 10v11h1v-5h15v3l5-3.5-5-3.5v3H5v-5H4zm21 5.5V21h1V10h-1v5.5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M9 4v1h11V4H9zm5.5 1l-3.387 5H14v15H9v1h11v-1h-5V10h3.113L14.5 5z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M10 4v1h9V4zm4.5 1l-3.387 5H14v5H5v-4H4v9h1v-4h9v9h-4v1h9v-1h-4v-9h4.5v3l5.5-3.5-5.5-3.5v3H15v-5h3.113zM25 15.5V20h1v-9h-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M17 4v2h-1v11h1v6h1v-6h1V6h-1V4zm8 0v2h-1v11h1v6h1v-6h1V6h-1V4zM4 5v2H3v11h1v6h1v-6h1V7H5V5zm9 0v2h-1v11h1v6h1v-6h1V7h-1V5zM8 7v6H7v11h1v2h1v-2h1V13H9V7zm9 0h1v9h-1zm8 0h1v9h-1zM4 8h1v9H4zm9 0h1v9h-1zm8 0v3h-1v11h1v2h1v-2h1V11h-1V8zm0 4h1v9h-1zM8 14h1v9H8z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M17 5v2h-1v11h1v4h1v-4h1V7h-1V5zm8 3v2h-1v11h1v4h1v-4h1V10h-1V8zM4 11v2H3v11h1v2h1v-2h1V13H5v-2zm9-7v2h-1v11h1v3h1v-3h1V6h-1V4zM8 4v2H7v11h1v6h1v-6h1V6H9V4zm9 4h1v9h-1zm8 3h1v9h-1zm-4-3v3h-1v11h1v2h1v-2h1V11h-1V8zM8 7h1v9H8z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.000001 29.999999" width="30" height="30" enable-background="new 0 0 595.3 841.9"><path d="M3 3v4h1v16H3v4h4v-1h16v1h4v-4h-2l.5-.008c-.155-9.757-4.81-14.485-9.402-16.646C11.553 4.206 7.095 4.496 7 4.502V3zm1 1h2v2H4zm3 1l.033.498s4.31-.285 8.64 1.752C20 9.286 24.346 13.556 24.5 23H23v2H7v-2H5V7h2zM4 24h2v2H4zm20 0h2v2h-2z"/></svg>'},function(t,e,i){(function(e){"use strict";function o(){}var n=i(434),s=i(38);TradingView.SYMBOL_SEARCH_MAX_LENGTH=100,o.prototype._createBackButton=function(t){var e=t.createGroup("back-button").appendTo(t._$left);t._backButton=$('<div class="mobile-back-button"><i></i></div>').click(function(){window.history.length>1&&window.history.back(),window.location.pathname="/"}).appendTo(e)},o.prototype._createBarsGroup=function(t){var e=this.createGroup("bars-style",{single:!0});return t._style_list.element().appendTo(e),e},o.prototype._createPropertiesGroup=function(t,o){var n,s=this.createGroup("properties",{single:!0});return this._onWidget&&!e.enabled("header_settings")||(n=$("<span>").addClass("button iconed properties apply-common-tooltip").append($(i(437)).attr({width:17,height:17})).appendTo(s),n.on(t,function(t){t.pageX=n.offset().left,t.pageY=n.offset().top+n.height()+15,TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Style"));var e=o.activeChartWidget.value().showChartProperties({_lastEvent:t});n.addClass("active"),e.on("destroy",function(){n.removeClass("active")})}),n.attr("title",$.t("Chart Properties"))),s},o.prototype._createCompareGroup=function(t,e,o){var s=this.createGroup("compare",{single:!0}),r=$('<a class="button toggle-caption compare apply-common-tooltip">').append($(i(438))).append($('<span class="caption">'+$.t("Compare")+"</span>")).appendTo(s);return this._compareButton=r,this._compareButton.on(o,function(t){var i,o;t.preventDefault(),i=new n(e),o=i.show(),r.addClass("active"),o.on("destroy",function(){r.removeClass("active")})}),this._compareButton.attr("title",$.t("Compare or Add Symbol")),s},o.prototype._createIndicatorsGroup=function(t,o){var n=this.createGroup("indicators",{single:!0,showInNarrowView:!0});return this._indicatorsButton=$('<a class="button toggle-caption indicators'+(this._onWidget?" no-last":"")+' apply-common-tooltip">').append($(i(439))).append($('<span class="caption">'+$.t("Indicators")+"</span>")).appendTo(n),e.enabled("charting_library_base")?this._indicatorsButton.attr("title",$.t("Indicators")):this._indicatorsButton.attr("title",$.t("Indicators, Fundamentals, Economy and Add-ons")),this._indicatorsButton.on(t,function(t){t.stopPropagation(),t.preventDefault(),window.studyMarket.isVisible()?window.studyMarket.hide():(window.studyMarket.show(),s.emit("indicators_dialog"))}),TradingView.keyboardBinder.registerListener("IndicatorsHotkey",function(t){if(47===t.which&&$(t.target).is("body")&&!window.studyMarket.isVisible())return window.studyMarket.show(),window.studyMarket.selectSearchPage(),t.preventDefault(),t.stopPropagation(),!0}),window.studyMarket.visibilityChanged.subscribe(this,function(t){this._indicatorsButton.toggleClass("active",t)}),!TradingView.onWidget()&&e.enabled("study_templates")&&studyTemplates.appendMenuButtonTo(n),n},o.prototype.createGroup=function(t,e){e=e||{};var i=$("<div>").addClass("group");return e.right&&i.addClass("right"),e.single&&i.addClass("space-single"),t&&i.addClass("header-group-"+t),i},o.prototype.bindToModel=function(){var t=this._chartWidget.model();this._model=t},o.prototype.backButton=function(){return this._backButton},o.prototype.saveLoadWidget=function(){return this._saveLoad||TradingView.logWarn("No save-load widget created in footer")},o.prototype.styleIconPosition=function(t){return"-%1px 0".replace("%1",19*~~t)},o.styleIconPosition=o.prototype.styleIconPosition,t.exports=o}).call(e,i(1))},function(t,e,i){"use strict";function o(t){this.chartWidgetCollection=t}var n=i(341),s=i(435),r=i(436);o.prototype.tabChanged=function(t){0===t?this.compareTab.focus():this.addSymbolTab.focus()},o.prototype.show=function(){var t,e,i,o,a,l;return TradingView.trackEvent("GUI","Compare Add"),t=TVDialogs.createDialog($.t("Compare Add"),{hideTitle:!0,dragHandle:".properties-tabs"}),e=t.find("._tv-dialog-content"),t.css("min-width",0),e.css("min-width",0),i=$('<div class="properties-tabs"></div>').appendTo(e),$('<a href="#" class="properties-tabs-label"></a>').text($.t("Compare")).appendTo(i),$('<a href="#" class="properties-tabs-label"></a>').text($.t("Add Symbol")).appendTo(i),o=$("<div>").appendTo(e),a=$('<div class="main-tree-page compare active">').appendTo(o),l=$('<div class="main-tree-page compare">').appendTo(o),this.compareTab=new s(this.chartWidgetCollection),this.addSymbolTab=new r(this.chartWidgetCollection),this.compareTab.show(),a.append(this.compareTab._widget),this.addSymbolTab.show(),l.append(this.addSymbolTab._widget),this.tabs=new n(i,o,{saveTab:"CompareAddDialog.tab"}),this.tabs.tabChanged.subscribe(this,this.tabChanged),TVDialogs.applyHandlers(t),TVDialogs.positionDialog(t,this.position),t},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t){var i,o;this._chartWidgetCollection=t,i={"AMEX:SPY":$.t("S&P 500 Trust"),"INDEX:NASX":$.t("Nasdaq Composite"),"AMEX:DIA":$.t("Diamonds Trust"),"AMEX:GLD":$.t("Gold Trust"),"AMEX:FXE":$.t("Euro Currency Trust"),"INDEX:IUXX":$.t("Nasdaq 100"),"INDEX:IXF":$.t("Nasdaq Financial 100")},o={IBOV:$.t("Bovespa Index"),IBXX:$.t("Brazil 100 Index"),IBXL:$.t("Brazil 50 Index"),IBRA:$.t("Brazil Broad-Based Index"),IGCX:$.t("Special Corporate Governance Stock Index"),ITAG:$.t("Special Tag-Along Stock Index"),IGNM:$.t("Novo Mercado Corporate Governance Equity Index")
},this.predefines={"":e.enabled("bovespa_widget")?o:i},this.symbolAlias={"BATS:SPY":"AMEX:SPY","BATS:DIA":"AMEX:DIA","BATS:GLD":"AMEX:GLD","BATS:FXE":"AMEX:FXE"}}var n=i(39);o.prototype.addCompareSymbol=function(t,e,i){var o,n,s,r,a,l,h=this._chartWidgetCollection.activeChartWidget.value();if(h&&(o=h.model())){for(n=o.mainSeries().interval(),s=o.studiesMetaData(),a=0;a<s.length;a++)"Compare@tv-basicstudies"===s[a].id&&(r=s[a]);return l={exchange:i,inputs:{symbol:t,resolution:n}},TradingView.trackEvent("GUI","Add Compare"),o.insertStudy(r,l)}},o.prototype.removeCompareSymbol=function(t){var e,i,o,n,s,r=this._chartWidgetCollection.activeChartWidget.value();if(r&&(e=r.model()))for(i=e.dataSources(),o=0;o<i.length;o++)n=i[o],n._metaInfo&&"Compare@tv-basicstudies"===n._metaInfo.id&&(s=n.properties().inputs.symbol.value(),(s===t||this.symbolAlias[s]&&this.symbolAlias[s]===t)&&e.removeSource(n))},o.prototype._createPredefinesList_normal=function(){function t(t){$(this).is(":checked")?(e=a.addCompareSymbol(t.data.symbol),e||$(this).attr("checked",!1)):a.removeCompareSymbol(t.data.symbol)}var e,i,o,n,s,r,a=this;for(n in this.predefines){s=$('<div class="predefine-section">').appendTo(this._widget);for(r in this.predefines[n])i=$('<div class="predefine-line"></div>').appendTo(s),o=$('<input type="checkbox" id="predefine-checkbox-'+this.symbolToId(r)+'"/>').appendTo(i),o.change({symbol:r},t),$('<label for="predefine-checkbox-'+this.symbolToId(r)+'">'+this.predefines[n][r]+"</label>").appendTo(i)}$('<div class="clear"></div>').appendTo(this._widget)},o.prototype.init=function(){var t,i,o,s=this;this._widget=$('<div class="compare-widget"></div>'),t=$('<div class="symbol-edit-widget">'),this.input=$('<input type="text" class="symbol-edit with-plus single" placeholder="'+$.t("Company Comparison")+'" autocomplete="off">').appendTo(t),i=$('<a class="symbol-edit-plus" title="'+$.t("Company Comparison")+'"><span></span></a>').appendTo(t),o=n.bindToInput(this.input,{callback:function(t){s.addCompareSymbol(t)},keepFocus:!0,clearAfterAccept:!0}),i.click(function(){o.acceptTypeIn()}),t.appendTo(this._widget),e.enabled("charting_library_base")||this._createPredefinesList_normal()},o.prototype.show=function(){var t,e,i,o,n,s,r,a,l,h=this,c=this._chartWidgetCollection.activeChartWidget.value();if(c&&(t=c.model())){e=t.dataSources(),this.init(),this._widget.find('input[id^="predefine-checkbox"]').attr("checked",!1);for(i in this.predefines)for(o in this.predefines[i])for(n=this._widget.find("#predefine-checkbox-"+this.symbolToId(o)),s=0;s<e.length;s++)r=e[s],r._metaInfo&&"Compare@tv-basicstudies"===r._metaInfo.id&&(a=o,l=r.properties().inputs.symbol.value(),(l===a||h.symbolAlias[l]&&h.symbolAlias[l]===a)&&n.attr("checked",!0))}},o.prototype.symbolToId=function(t){return t.replace(/[^a-z0-9]/gi,"_")},o.prototype.focus=function(){Modernizr.touch||this.input.focus()},t.exports=o}).call(e,i(1))},function(t,e,i){"use strict";function o(t){this._chartWidgetCollection=t,this.init()}var n=i(39);o.prototype.init=function(){var t,e,i,o,s,r,a=this;this._widget=$('<div class="addsymbol-widget"></div>'),t=$('<div class="symbol-edit-widget">'),e=$('<input type="text" class="symbol-edit with-plus single" placeholder="'+$.t("Symbol")+'" autocomplete="off">').appendTo(t),this._input=e,i=$('<a class="symbol-edit-plus"><span></span></a>').appendTo(t),o=n.bindToInput(e,{callback:function(t){var e=a._chartWidgetCollection.activeChartWidget.value();e&&e.addSymbol(t,a._checkbox.is(":checked"))},keepFocus:!0,clearAfterAccept:!0}),i.on("click",function(){o.acceptTypeIn()}),t.appendTo(this._widget),s=$('<div class="opts-line">').appendTo(this._widget),r="addsymbol-widget-overlay-"+TradingView.guid(),this._checkbox=$('<input type="checkbox" id="'+r+'">').appendTo(s),this._checkbox.on("click",function(){TVSettings.setValue("showAddSymbolDialog.checkboxState",$(this).is(":checked"))}),$('<label for="'+r+'">'+$.t("Overlay the main chart")+"</label>").appendTo(s)},o.prototype.show=function(){this.focus(),this._checkbox.attr("checked",TVSettings.getBool("showAddSymbolDialog.checkboxState",!0))},o.prototype.focus=function(){Modernizr.touch||this._input.focus()},t.exports=o},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2.4 120.9 600 600" enable-background="new -2.4 120.9 600 600"><path d="M594 473.5V368.8h-76c-5.7-23.8-15.2-46.4-27.5-66.4l53.8-53.8-73.9-73.9-53.8 53.4c-20.6-12.8-42.7-21.8-66.4-27.5v-75.9H245.5v75.9c-23.8 5.7-46.4 15.2-66.4 27.5l-53.8-53.8-73.9 73.9 53.4 53.8C92 322.6 83 344.7 77.3 368.4h-76V473h75.9c5.7 23.8 15.2 46.4 27.5 66.4L51 593.3l73.9 73.9 53.8-53.4c20.6 12.8 42.7 21.8 66.4 27.5v75.9h104.6v-75.9c23.8-5.7 46.4-15.2 66.4-27.5l53.8 53.8 73.9-73.9-53.4-53.8c12.8-20.6 21.8-42.7 27.5-66.4H594zm-296.4 69.7c-67.3 0-122.3-54.6-122.3-122.3 0-67.3 54.6-122.3 122.3-122.3 67.3 0 122.3 54.6 122.3 122.3-.4 67.4-54.9 122.3-122.3 122.3z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 17" width="17" height="17"><path d="M8.5.36L6.45 2H1v1h2l-3 8a3.54 3.5 0 0 0 3.055 2.97 3.5 3.5 0 0 0 .004 0 3.54 3.5 0 0 0 .44.03 3.5 3.5 0 0 0 .35-.018A3.54 3.5 0 0 0 7 11L4 3h9l-3 8a3.54 3.5 0 0 0 3.502 3A3.54 3.5 0 0 0 17 11l-3-8h2V2h-5.45L8.5.36zm0 1.28l.45.36h-.9l.45-.36zm-5 2.694L6 11H1l2.5-6.666zm10 0L16 11h-5l2.5-6.666z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 17" width="17" height="17"><path d="M16 0a1 1 0 0 0-1 1 1 1 0 0 0 .127.484L13.017 5A1 1 0 0 0 13 5a1 1 0 0 0-.258.035L10.965 3.26A1 1 0 0 0 11 3a1 1 0 0 0-1-1 1 1 0 0 0-1 1 1 1 0 0 0 .082.393L7.12 6.008a1 1 0 0 0-.12-.01 1 1 0 0 0-.44.104l-1.564-1.04A1 1 0 0 0 5 4.998a1 1 0 0 0-1-1 1 1 0 0 0-1 1 1 1 0 0 0 .002.066l-1.56 1.04A1 1 0 0 0 1 5.998a1 1 0 0 0-1 1 1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0-.002-.064l1.56-1.04A1 1 0 0 0 4 6a1 1 0 0 0 .44-.103l1.564 1.04A1 1 0 0 0 6 7a1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0-.082-.39l1.965-2.62A1 1 0 0 0 10 4a1 1 0 0 0 .258-.035l1.777 1.777A1 1 0 0 0 12 6a1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0-.127-.482L15.983 2A1 1 0 0 0 16 2a1 1 0 0 0 1-1 1 1 0 0 0-1-1zm-1 5v10h2V5h-2zM9 7v8h2V7H9zM3 9v6h2V9H3zm9 1v5h2v-5h-2zM0 11v4h2v-4H0zm6 0v4h2v-4H6z"/></svg>'},function(t,e,i){(function(e){"use strict";function o(t,e,i){this._chart=t,this._parent=e,this.zoom_active=!1,this._real=i,this._state="stop",this.init(),i&&this.initToRealChart(),this.initHandlers(),t.navigationButtonsController().addWidget({widget:this._widget,acceptableOffset:100})}var n=i(113);o.visibilityProperty=new e,o.prototype.init=function(){this._widget=$('<div class="control-bar-wrapper">').appendTo(this._parent),$('<div class="control-bar">').append($(i(441)).attr("class","move-left-button-control-bar")).append($(i(442)).attr("class","zoom-out-right-button-control-bar")).append($(i(443)).attr("class","turn-button-control-bar")).append($(i(444)).attr("class","zoom-in-button-control-bar")).append($(i(445)).attr("class","move-right-button-control-bar")).appendTo(this._widget),this._buttons={zoomIn:this._widget.find(".zoom-in-button-control-bar"),zoomOut:this._widget.find(".zoom-out-right-button-control-bar"),moveLeft:this._widget.find(".move-left-button-control-bar"),moveRight:this._widget.find(".move-right-button-control-bar"),turn:this._widget.find(".turn-button-control-bar")}},o.prototype.initToRealChart=function(){var t,e=this;this._back=$(i(446)).attr({class:"back-to-present hidden"}).appendTo(this._parent),this._back.on("click",function(){e._chart.model().timeScale().scrollToRealtime(!0),e._chart.model().model()._invalidateHandler(new n(n.FULL_UPDATE))}),t=function(){var t=e._chart.maxRhsPriceAxisWidth+4;t&&e._back.css("marginRight",t)},this._chart.rhsPriceAxisWidthChanged.subscribe(this,t),t(),this._chart.withModel(this,function(){this._chart.model().model().setInterval(function(){e.check()},1e3)})},o.prototype.check=function(){this._chart.model()&&this._chart.model().timeScale().rightOffset()<0?this._back.attr("class","back-to-present"):this._back.attr("class","back-to-present hidden")},o.prototype._move=function(t){var e,i;"stop"===this._state&&this._chart.model().beginUndoMacro(1===t?"Move Left":"Move Right"),this._state="moving",this._moveType="animated",this._deferredFinishTimeout&&(clearTimeout(this._deferredFinishTimeout),this._deferredFinishTimeout=0),this._finishingTimeout&&(clearTimeout(this._finishingTimeout),this._finishingTimeout=0),this._startTime=+new Date,this._movingTimeout||(e=this._startTime,i=10,this._movingTimeout=setTimeout(function o(){this._moveStep.call(this,e,0,50*t,1e3),this._movingTimeout=setTimeout(o.bind(this),i)}.bind(this),i))},o.prototype._moveStep=function(t,e,i,o){var n,s,r;if(!this._chart.model().timeScale().isEmpty())return n=+new Date,s=1-(Math.max(0,t+o-n)/o||0),s<1&&(r=jQuery.easing.easeOutCubic(null,o*s,0,1,o),this.currentDistance=(i-e)*r+e),this._chart.model().scrollChart(this.currentDistance),s},o.prototype._finishMove=function(t){var e,i;clearTimeout(this._movingTimeout),this._movingTimeout=0,this._deferredFinishTimeout=0,e=this.currentDistance,i=+new Date,this._finishingTimeout=setTimeout(function t(){var o=this._moveStep.call(this,i,e,0,700);o<1?this._finishingTimeout=setTimeout(t.bind(this),10):(this._state="stop",this._moveType="",this._movingTimeout=0,this.currentDistance=0,this._chart.model().endUndoMacro())}.bind(this),10)},o.prototype._stopMove=function(t){"moving"===this._state&&(this._state="wait_finishing",(new Date).getTime()-this._startTime<200?this._deferredFinishTimeout=setTimeout(this._finishMove.bind(this),200-((new Date).getTime()-this._startTime)):this._finishMove())},o.prototype._moveByBar=function(t){var e,i,o,n,s=this._chart.model().timeScale();s.isEmpty()||("stop"===this._state&&this._chart.model().beginUndoMacro(1===t?"Move Left":"Move Right"),e=s.indexToCoordinate(s.visibleBars().lastBar())+s.barSpacing()/2,Math.abs(s.width()-e)>s.barSpacing()/6&&this._chart.model().scrollChart(s.width()-e),this._state="moving",this._moveType="by_bar",this._startTime=+new Date,this._movingTimeout||(i=400,o=150,n=0,this._movingTimeout=setTimeout(function e(){this._moveByBarStep(t),n++,o>100&&(o-=20*(n/5)),this._movingTimeout=setTimeout(e.bind(this),o)}.bind(this),i),this._moveByBarStep(t)))},o.prototype._moveByBarStep=function(t){this._chart.model().timeScale().isEmpty()||this._chart.model().scrollChartByBar(t)},o.prototype._stopMoveByBar=function(t){"moving"===this._state&&(clearTimeout(this._movingTimeout),this._movingTimeout=0,this._state="stop",this._moveType="",this._movingTimeout=0,this.currentDistance=0,this._chart.model().endUndoMacro())},o.prototype.initHandlers=function(){var t,e=this._chart,i=Modernizr.touch?"touchstart":"mousedown",o=Modernizr.touch?"touchend":"mouseup mouseout";this._buttons.moveLeft.on(i,this._moveByBar.bind(this,1)),this._buttons.moveLeft.on(o,this._stopMoveByBar.bind(this,1)),this._buttons.moveRight.on(i,this._moveByBar.bind(this,-1)),this._buttons.moveRight.on(o,this._stopMoveByBar.bind(this,-1)),this._buttons.turn.on("click",function(){e.GUIResetScales()}),this._buttons.zoomOut.on("click",function(){e.model()&&e.model().zoomOut()}),this._buttons.zoomIn.on("click",function(){e.model()&&e.model().zoomIn()}),t={},$("body").on("keydown",function(e){if(!$(e.target).closest("input, textarea").length&&!(e.metaKey||e.which in t))switch(t[e.which]=!0,e.which){case 37:e.ctrlKey||e.altKey?this._move(1):this._moveByBar(1),e.preventDefault();break;case 39:e.ctrlKey||e.altKey?this._move(-1):this._moveByBar(-1),e.preventDefault()}}.bind(this)).on("keyup",function(e){if(!$(e.target).closest("input, textarea").length)switch(delete t[e.which],e.which){case 37:case 39:"by_bar"===this._moveType?this._stopMoveByBar():this._stopMove()}}.bind(this))},t.exports=o}).call(e,i(69))},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-80 -25 140 140"><path fill="#8A8B8D" fill-rule="evenodd" clip-rule="evenodd" d="M10 12L-.7.7-41 43.2l.1.1-.1.1L-.7 85.9l10-10.6-29.7-31.2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120"><path fill="#8A8B8D" fill-rule="evenodd" clip-rule="evenodd" d="M28 50h65v17H28z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-58 -18 120 120"><path fill="#8A8B8D" fill-rule="evenodd" clip-rule="evenodd" d="M31 13C23.4 5.3 12.8.5 1.1.5c-23.3 0-42.3 19-42.3 42.5s18.9 42.5 42.3 42.5c13.8 0 26-6.6 33.7-16.9l-16.5-1.8C13.5 70.4 7.5 72.5 1 72.5c-16.2 0-29.3-13.2-29.3-29.4S-15.2 13.7 1 13.7c8.1 0 15.4 3.3 20.7 8.6l-10.9 11h32.5V.5L31 13z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 140"><path fill="#8A8B8D" fill-rule="evenodd" clip-rule="evenodd" d="M112 60H78V26H61v34H27v17h34v34h17V77h34z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="-90 -55 140 140"><path fill="#8A8B8D" fill-rule="evenodd" clip-rule="evenodd" d="M10 12l-40.3-42.5-10 10.6 29.7 31.2L-41 43.4l10.7 11.3L10 12.2l-.1-.1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.8 13.4" enable-background="new 0 0 14.8 13.4"><path d="M8 6.7L1.7 0 .1 1.7l4.7 4.9-4.8 5 1.7 1.8L8 6.7zm6.8 0L8.4 0 6.8 1.7l4.7 4.9-4.8 5 1.7 1.8 6.4-6.7z"/></svg>'},function(t,e,i){(function(e){"use strict";function o(t){var i,o,r,l,h,c=this,d=this._chartWidget=t.chartWidget;this.$parent=t.parent,this._dateRangesPopupList=[],this._goToPopupBtn=[],this._iterativeHide=[],this._timeFormatter=new n,this._$seriesControls=$(document.createElement("div")).attr("class","chart-controls-bar-buttons chart-series-controls").appendTo(t.parent),this._$timezoneButton=$('<a class="apply-common-tooltip" title="'+$.t("Timezone")+'"><span class="chart-controls-clock"></span><span class="chart-controls-tz"></span></a>').appendTo(this._$seriesControls),!d.onWidget()&&e.enabled("timezone_menu")?a(c._$timezoneButton,function(){var t,e,i,o,n;if(d.updateActions(),t=[],e=d.actions(),!e||!e.applyTimeZone||!e.applyTimeZone.subActions)return t;for(i=e.applyTimeZone.subActions,o=0;o<i.length;++o)n=i[o],t.push({action:n.enabled?n.executeCallback.bind(n):null,addClass:n.enabled?"":"special",disabled:!n.enabled,iconClass:n.checkable&&n.checked?"checked-icon":"unchecked-icon",title:n.text});return t},{direction:"up",addClass:"context-menu"}):this._$timezoneButton.addClass("disabled"),this._$timezoneClock=this._$timezoneButton.find(".chart-controls-clock"),this._$timezoneName=this._$timezoneButton.find(".chart-controls-tz"),d.onWidget()||e.enabled("charting_library_base")?this._$extendedHoursButton=null:(this._$extendedHoursButton=$(document.createElement("a")).text($.t("ext")).attr("title",$.t("The Extended Trading Hours feature is available only for intraday charts")).addClass("apply-common-tooltip").appendTo(this._$seriesControls),this._iterativeHide.push(this._$extendedHoursButton)),this._$percButton=$(document.createElement("a")).text("%").attr("title",$.t("Toggle Percentage")).addClass("apply-common-tooltip").appendTo(this._$seriesControls),this._iterativeHide.push(this._$percButton),this._$logButton=$(document.createElement("a")).text($.t("log")).attr("title",$.t("Toggle Log Scale")).addClass("apply-common-tooltip").appendTo(this._$seriesControls),this._iterativeHide.push(this._$logButton),this._$autoScaleButton=$(document.createElement("a")).text($.t("auto",{context:"scale"})).attr("title",$.t("Toggle Auto Scale")).addClass("apply-common-tooltip").appendTo(this._$seriesControls),this._iterativeHide.push(this._$autoScaleButton),i=null,e.enabled("main_series_scale_menu")&&(i=$(document.createElement("a")).attr("title",$.t("Scales Properties")).addClass("apply-common-tooltip").appendTo(this._$seriesControls)),this._$fullscreenChartButton=$(document.createElement("a")).attr("title",$.t("Toggle Maximize Chart")).addClass("apply-common-tooltip").appendTo(this._$seriesControls),this._iterativeHide.push(this._$timezoneButton),o="http://www.w3.org/2000/svg",r=$(document.createElementNS(o,"svg")).attr({width:12,height:12}).css({fill:"currentColor",stroke:"none",margin:"1px"}),$(document.createElementNS(o,"desc")).text("SP").appendTo(r),$(document.createElementNS(o,"path")).attr({d:"M 11.896733,5.4401 C 11.201602,5.2497118 10.287185,5.3844905 9.8529668,4.6739798 9.3680407,3.9899631 9.7713075,3.1150758 10.335646,2.6255445 10.81759,2.1397596 10.086625,1.2464141 9.5348331,1.5679918 9.0096065,2.0197899 8.3586515,2.5915907 7.6081884,2.2860159 6.8487054,2.0572252 6.6657258,1.2214292 6.6611579,0.52971682 6.6904416,-0.14270317 5.5547878,-0.19920111 5.3509206,0.33932112 5.3495604,1.0614071 5.216111,1.980668 4.4411277,2.2733721 3.718985,2.58432 3.0421913,2.0835985 2.5447076,1.6132218 2.019086,1.2075468 1.1733117,2.0525503 1.6258135,2.5522279 2.1291674,3.0522349 2.6067846,3.7947509 2.23627,4.5142319 1.9382627,5.2487851 1.0997484,5.3013165 0.42629601,5.3591295 -0.18586111,5.4121559 -0.1726988,6.614951 0.4382476,6.6606553 1.1701866,6.6354301 2.0901088,6.8653212 2.3114865,7.6677973 2.5690397,8.4182506 1.9757702,9.0009969 1.5707544,9.5375753 1.260194,10.111116 2.1887088,10.863746 2.6392394,10.30714 3.1282414,9.7691412 3.9518015,9.3917137 4.6315605,9.8249999 5.3287279,10.186762 5.2619381,11.018963 5.3869987,11.672161 5.5440075,12.215504 6.7794125,12.12358 6.6535582,11.446999 6.6654072,10.746236 6.9028479,9.8947057 7.6677558,9.6885901 8.4182253,9.4312024 9.000933,10.024446 9.5375381,10.429439 10.111007,10.739871 10.863873,9.8114259 10.307197,9.360908 9.7691358,8.8719351 9.3913098,8.0483184 9.8250144,7.3685614 10.18688,6.6714752 11.018948,6.7380091 11.672226,6.6131264 12.162952,6.4957229 11.998177,5.7860369 11.896733,5.4401 z M 5.999918,8.8061 C 4.4052236,8.8574703 3.0094365,7.3092614 3.2012542,5.7303585 3.3197775,4.2414555 4.7798203,3.0282413 6.2655218,3.2004993 7.7296227,3.3187202 8.9364572,4.7279379 8.805387,6.1941362 8.7186344,7.6148699 7.4347334,8.84471 5.999918,8.8061 z"}).appendTo(r),i&&i.append(r),l=$(document.createElementNS(o,"svg")).attr({width:12,height:12}).css({fill:"currentColor",stroke:"none",margin:"1px"}),l.get(0).setAttribute("viewBox","0 0 24 24"),$(document.createElementNS(o,"desc")).text("FS").appendTo(l),$(document.createElementNS(o,"path")).attr({d:"M0 0v9l3.5-3.5 4.5 4.5h2v-2l-4.5-4.5 3.5-3.5h-9zm15 0l3.5 3.5-4.5 4.5v2h2l4.5-4.5 3.5 3.5v-9h-9zm-7 14l-4.5 4.5-3.5-3.5v9h9l-3.5-3.5 4.5-4.5v-2h-2zm6 0v2l4.5 4.5-3.5 3.5h9v-9l-3.5 3.5-4.5-4.5h-2z"}).appendTo(l),this._$fullscreenChartButton.append(l),this._$percButton.on("click",function(t){var e,i,o,n;t.preventDefault(),e=d.model(),i=e.mainSeries(),o=i.priceScale(),n=o.properties(),i.properties().lockScale.value()||(e.beginUndoMacro($.t("Toggle Percentage")),n.log.value()&&e.setLogProperty(n.log,!1,o,$.t("Toggle Log Scale")),e.setPercentProperty(n.percentage,!n.percentage.value(),o,$.t("Toggle Percentage")),e.endUndoMacro())}),this._$logButton.on("click",function(t){var e,i,o,n;t.preventDefault(),e=d.model(),i=e.mainSeries(),o=i.priceScale(),n=o.properties(),i.properties().lockScale.value()||(e.beginUndoMacro($.t("Toggle Log Scale")),n.percentage.value()&&e.setPercentProperty(n.percentage,!1,o,$.t("Toggle Percentage")),e.setLogProperty(n.log,!n.log.value(),o,$.t("Toggle Log Scale")),e.endUndoMacro())}),this._$autoScaleButton.on("click",function(t){var e,i,o,n;t.preventDefault(),e=d.model(),i=e.mainSeries(),o=i.priceScale(),n=o.properties(),e.beginUndoMacro($.t("Toggle Auto Scale")),n.autoScale.value()&&n.percentage.value()&&e.setPercentProperty(n.percentage,!1,o,$.t("Toggle Percentage")),e.setAutoScaleProperty(n.autoScale,!n.autoScale.value(),o,$.t("Toggle Auto Scale")),e.endUndoMacro()}),i&&a(i,function(){var t,e,i,o,n,r,a,l=d.paneWidgets();for(t=0;t<l.length;++t)if(e=l[t],e.containsMainSeries()){if(i=[],o=e.getDefaultPriceAxisWidget(),!o)return i;for(n=o.getContextMenuActions(),r=0;r<n.length;++r)a=n[r],a instanceof s?i.push({separator:!0}):i.push({action:a.enabled?a.executeCallback.bind(a):null,addClass:a.enabled?"":"special",disabled:!a.enabled,iconClass:a.checkable&&a.checked?"checked-icon":"unchecked-icon",title:a.text});return i}return[]},{direction:"up",addClass:"context-menu",reverse:!0}),this._$extendedHoursButton&&this._$extendedHoursButton.on("click",function(t){var e,i;t.preventDefault(),e=d.model(),i=e.mainSeries().properties().extendedHours,e.setProperty(i,!i.value(),"Extended Hours")}),this._$dateRangesWrap=$(document.createElement("div")).addClass("chart-controls-bar-buttons date-range-wrapper").appendTo(t.parent),this._$dateRangesBtn=$(document.createElement("a")).addClass("date-range-btn").text($.t("Date Range")).appendTo(this._$dateRangesWrap),this._$dateRanges=$(document.createElement("div")).addClass("date-range-list").appendTo(this._$dateRangesWrap),d.withModel(null,function(){var t=d.model(),i=t.mainSeries(),o=i.priceScale();this.updateScaleButtons(),i.priceScaleChanged.subscribe(this,this.updateScaleButtons),o.properties().autoScale.subscribe(this,this.updateScaleButtons),this.updateDateRangeButtons(),i.onStatusChanged().subscribe(this,this.updateDateRangeButtons),e.enabled("update_timeframes_set_on_symbol_resolve")&&i.onSymbolResolved().subscribe(this,this.updateDateRangeButtons),i.properties().lockScale.subscribe(this,this.updateDateRangeButtons),this.updateExtendedHoursButton(),i.properties().extendedHours.subscribe(this,this.updateExtendedHoursButton),i.properties().interval.subscribe(this,this.updateExtendedHoursButton),t.model().mainSeries().onSymbolResolved().subscribe(null,this.updateTimezonesButton.bind(this)),t.model().properties().timezone.subscribe(null,this.updateTimezonesButton.bind(this))}.bind(this)),this.updateFullscreenChartButton(),h=this._chartWidget._chartWidgetCollection,h&&(h.layout.subscribe(this.updateFullscreenChartButton.bind(this)),h.maximizeCurrentChart.subscribe(this.updateFullscreenChartButton.bind(this)),this._$fullscreenChartButton.on("click",function(){h.activeChartWidget.setValue(d),h.maximizeCurrentChart.setValue(!h.maximizeCurrentChart.value())}),this.checkTimezonesButton(h.activeChartWidget.value()),h.activeChartWidget.subscribe(this.checkTimezonesButton.bind(this)))}var n=i(82).TimeFormatter,s=i(141).ActionSeparator,r=i(55),a=r.bindPopupMenu,l=r.unbindPopupMenu;o.prototype.updateScaleButtons=function(){var t=this._chartWidget.model().mainSeries(),e=t.priceScale().properties(),i=e.log.value(),o=e.percentage.value(),n=e.autoScale.value();this._$logButton.toggleClass("active",i),this._$percButton.toggleClass("active",o),this._$autoScaleButton.toggleClass("active",n)},o.prototype.updateDateRangeButtons=function(){var t,e,i,o,n,s,r=this._chartWidget,a=r.model().mainSeries().status();if(a!==TradingView.Series.STATUS_LOADING){if(t=r._dateRangeResolutions(),e=function(t){r.model().loadRange(t)},this._dateRangesPopupList=[],t.length)for(this._$dateRanges.empty(),i=0;i<t.length;i++)o=t[i],n=$(document.createElement("a")).text(o.text),s=e.bind(this,{val:o.value,res:o.targetResolution}),n.appendTo(this._$dateRanges).click(s),this._dateRangesPopupList.push({title:o.description||o.text,action:s});this.updateTimeframePopupMenu()}},o.prototype.updateTimeframePopupMenu=function(){this._$dateRangesBtn.toggleClass("i-hidden",!(this._dateRangesPopupList.length||this._goToPopupBtn.length)),l(this._$dateRangesBtn),a(this._$dateRangesBtn,this._dateRangesPopupList.concat(this._goToPopupBtn),{direction:"up",addClass:"date-range-popupmenu"}),this.resizeUI()},o.prototype.updateTimezonesButton=function(){var t,e,i;null!==this._chartWidget.model().mainSeries().symbolInfo()&&(t=this._chartWidget.model().model().timezone(),"exchange"===t&&(e=this._chartWidget.model().mainSeries().symbolInfo().timezone,e&&(t=e)),i=TradingView.parseTzOffset(t),this.tzOffset=i.offset,this._$timezoneName.text("("+i.string+")"),this.tickClock(),this.resizeUI())},o.prototype.checkTimezonesButton=function(t){this._$timezoneButton.toggleClass("i-invisible",t!==this._chartWidget),this.resizeUI()},o.prototype.tickClock=function(){void 0!==this.tzOffset&&this._$timezoneClock.text(this._timeFormatter.format(new Date(Date.now()+this.tzOffset+1e3*ChartApiInstance.serverTimeOffset())))},o.prototype.updateExtendedHoursButton=function(){if(this._$extendedHoursButton){var t=this._chartWidget.model().mainSeries();t.properties().extendedHours.value()?this._$extendedHoursButton.addClass("active"):this._$extendedHoursButton.removeClass("active"),this.resizeUI()}},o.prototype.updateFullscreenChartButton=function(){var t=this._chartWidget._chartWidgetCollection;return t&&"s"!==t.layout.value()?(this._$fullscreenChartButton.removeClass("i-hidden"),this._$fullscreenChartButton.toggleClass("active",t.maximizeCurrentChart.value()),void this.resizeUI()):void this._$fullscreenChartButton.addClass("i-hidden")},o.prototype.updateUI=function(){this.updateScaleButtons(),this.resizeUI()},o.prototype.resizeUI=function(){var t,e,i,o,n,s,r;if(this._$seriesControls&&this._$dateRanges){for(this.$parent.addClass("i-measure"),t=this.$parent.width(),e=this._$dateRanges.width(),i=this._$dateRangesBtn.outerWidth(),o=0,this._$seriesControls.find("a").each(function(){var t=$(this);t.hasClass("i-hidden")||(o+=t.outerWidth())}),n=o,s=0;s<this._iterativeHide.length;s++)this._iterativeHide[s].hasClass("i-hidden")||(r=this._iterativeHide[s].outerWidth(),this._iterativeHide[s].toggleClass("i-compact",t-i<n),n-=r);this._$dateRangesWrap.toggleClass("i-compact",e>t-o),this.$parent.removeClass("i-measure")}},t.exports=o}).call(e,i(1))},function(t,e,i){(function(e,o){"use strict";function n(t,i){var n,a,l,h,c,d,p,u,_,f,g,m,v,y,b;if(null==t&&(t=s.symbol.value()),null!=t)return t+="",n=i&&i.symbolInfo,a=$.t("Symbol Info"),l=TVDialogs.createDialog(a,{width:450}),h=l.find("._tv-dialog-content"),c=$(document.createElement("div")).addClass("main").addClass("symbol-info-dialog").appendTo(h),d=function(t){var e,i=r;for(e=0;e<i.length;e++)if(i[e].id===t)return i[e].title;return t},p=function(t){return TradingView.parseSessionHours(t).join("<br/>")},u=[{title:"Symbol Name",propName:e.enabled("charting_library_base")?"name":"pro_name"},{title:"Symbol Description",propName:"description"},{title:"Symbol Type",propName:"type"},{title:"Point Value",propName:"pointvalue"},{title:"Exchange",propName:"exchange"},{title:"Listed Exchange",propName:"listed_exchange"},{title:"Currency",propName:"currency_code",formatter:function(t){return t||"USD"},defValue:"USD"},{title:"Price Scale",propName:"pricescale"},{title:"Min Move",propName:"minmov"},{title:"Min Move 2",propName:"minmove2"},{title:"Sector",propName:"sector"},{title:"Industry",propName:"industry"},{title:"Timezone",propName:"timezone",formatter:d,optional:!0},{title:"Session",propName:"session",formatter:p,optional:!0,setHtml:!0}],_='<table cellspacing=0>{{#fields}}<tr{{#optional}} class="js-optional"{{/optional}}><td class="symbol-info-column"><span class="symbol-info-text">{{title}}</span></td><td class="symbol-info-value"><span class="symbol-info-text">{{#defValue}}{{defValue}}{{/defValue}}{{^defValue}}-{{/defValue}}</span></td></tr>{{/fields}}</table>',f=$(o.render(_,{fields:u})).appendTo(c),f.find(".symbol-info-value span").each(function(t,e){u[t].$element=$(e)}),g=function(t){return t||"-"},m=0,v=function(t){var e,i,o,n;for(e=0;e<u.length;e++)i=u[e].propName,i in t&&(o=t[i],o=(u[e].formatter||g)(o),u[e].setHtml?u[e].$element.html(o):u[e].$element.text(o),u.splice(e,1),e--);n=t.type&&"economic"===t.type||t.listed_exchange&&["QUANDL","BSE_EOD","NSE_EOD","LSE_EOD"].indexOf(t.listed_exchange)>=0,n&&f.find(".js-optional").remove()},n&&v(n),m<u.length&&window.quoteSessionMultiplexerInstance&&(y="symbolinfodialog."+TradingView.guid(),quoteSessionMultiplexerInstance.full.subscribe(y,t,function(e,i){v(i.values),quoteSessionMultiplexerInstance.full.unsubscribe(y,t)})),b=$(document.createElement("div")).addClass("dialog-buttons").appendTo(c),$(document.createElement("a")).addClass("_tv-button").addClass("cancel").text($.t("Close")).appendTo(b).click(function(){TVDialogs.destroy(l.data("title"))}),TVDialogs.positionDialog(l),TVDialogs.applyHandlers(l),l}var s=i(42),r=i(45).availableTimezones;t.exports=n}).call(e,i(1),i(29))},function(t,e,i){(function(e){"use strict";function o(t){function o(){if(!t.favoriteChartTypes)return[];var e={Bars:TradingView.Series.STYLE_BARS,Candles:TradingView.Series.STYLE_CANDLES,Line:TradingView.Series.STYLE_LINE,Area:TradingView.Series.STYLE_AREA,"Heiken Ashi":TradingView.Series.STYLE_HEIKEN_ASHI,"Hollow Candles":TradingView.Series.STYLE_HOLLOW_CANDLES};return t.favoriteChartTypes.map(function(t){return e[t]})}var a,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A;t=t||{},a=this._chartWidgetCollection=t.chartWidgetCollection,u=this._chartWidget=a.activeChartWidget.value(),_=this._onWidget=u.onWidget(),f=this,g=Modernizr.touch?"touchstart":"click",m=$(".header-chart-panel").eq(0),this._$right=m.find(".right"),this._$left=m.find(".left"),this._itemsVisibility=t.itemsVisibility,TradingView.isMobileView&&!TradingView.winMobileMode&&this._createBackButton(this),a.readOnly()||(e.enabled("header_symbol_search")&&(v=this.createGroup("symbol-search").appendTo(this._$left),y=$('<div class="symbol-edit-widget no-last"></div>').appendTo(v),b=$('<div class="symbol-edit-wrap">').appendTo(y),w=null,!e.enabled("charting_library_base")&&d.canShowSpreadActions()&&(S=$('<div class="symbol-edit-buttonswrap">').appendTo(b),w=$('<div class="spread-actions">').appendTo(S).on("mousedown",function(t){t.preventDefault()})),T=$('<div class="symbol-edit-inputspacer">').appendTo(b),C=$('<input type="text" class="symbol-edit" maxlenght="'+TradingView.SYMBOL_SEARCH_MAX_LENGTH+'">').appendTo(T),d.bindToInput(C,{syncWithChartWidget:!0,spreadActions:w}),function(){var t=!1;C.on("focus",function(){t=!0,b.addClass("expanded")}),C.on("blur",function(){t=!1,setTimeout(function(){t||b.removeClass("expanded")},40)})}()),e.enabled("header_resolutions")&&(v=this.createGroup("intervals",{single:!0,showInNarrowView:!0}).appendTo(this._$left),x={onWidget:_,submenuBtnAddClass:"apply-common-tooltip"},t.interval_options&&$.extend(x,t.interval_options),!TradingView.isMobileView&&e.enabled("items_favoriting")||$.extend(x,{notShowQuicks:!0,popupSpacing:1}),TradingView.isOnFeaturePage&&$.extend(x,{notShowQuicks:!0}),this._interval=new l(x),e.enabled("charting_library_base")&&ChartApiInstance.on("configuration_received",function(){f._interval.forceUpdate()}),this._interval.element().addClass("no-first").appendTo(v),this._interval.onResize.subscribe(a,a.updateLayout),t.favoriteIntervals&&this._interval.setUpStarredItemsList(t.favoriteIntervals)),e.enabled("header_chart_type")&&(P=e.enabled("charting_library_base")?[{id:TradingView.Series.STYLE_BARS,title:$.t("Bars"),svg:$(i(464)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_CANDLES,title:$.t("Candles"),svg:$(i(465)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_HOLLOW_CANDLES,title:$.t("Hollow Candles"),svg:$(i(466)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_LINE,title:$.t("Line"),svg:$(i(467)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_AREA,title:$.t("Area"),svg:$(i(468)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_HEIKEN_ASHI,title:$.t("Heikin Ashi"),svg:$(i(469)).attr({width:26,height:26})}]:[{id:TradingView.Series.STYLE_BARS,title:$.t("Bars"),svg:$(i(464)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_CANDLES,title:$.t("Candles"),svg:$(i(465)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_HOLLOW_CANDLES,title:$.t("Hollow Candles"),svg:$(i(466)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_HEIKEN_ASHI,title:$.t("Heikin Ashi"),svg:$(i(469)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_LINE,title:$.t("Line"),svg:$(i(467)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_AREA,title:$.t("Area"),svg:$(i(468)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_RENKO,title:$.t("Renko"),svg:$(i(470)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_PB,title:$.t("Line Break"),svg:$(i(471)).attr({
width:26,height:26})},{id:TradingView.Series.STYLE_KAGI,title:$.t("Kagi"),svg:$(i(472)).attr({width:26,height:26})},{id:TradingView.Series.STYLE_PNF,title:$.t("Point & Figure"),svg:$(i(473)).attr({width:26,height:26})}],L=o()||[1,4,5,6],!TradingView.isMobileView&&!TradingView.isOnFeaturePage||e.enabled("charting_library_base")||(L=[]),_?L=[1,3]:e.enabled("collapsible_header")&&this._createMinimizeButton(t.headerChartPanel),this._style_list=new p("StyleWidget",P.map(function(t){return{id:t.id,title:t.title,svg:t.svg,favoriteButton:{title:t.title,addClass:"apply-common-tooltip"}}}),{defaultFavorites:L,addClass:"chart-style-widget",popupAddClass:"chart-style-popup",notShowQuicks:!!TradingView.isMobileView||!e.enabled("items_favoriting"),showJustDefaultQuicks:L&&L.length&&e.enabled("predefined_items_only_may_be_starred"),tooltip:$.t("Bar's Style"),addTooltipClass:"apply-common-tooltip"}),a.activeChartStyle.subscribe(function(t){f._style_list.setValue(t)},{callWithLast:!0}),f._style_list.onChange().subscribe(this,function(t){a.activeChartStyle.setValue(t)}),f._style_list.onResize().subscribe(a,a.updateLayout)),window.studyMarket=new h(a,window.user,{onWidget:_}),this._createLayout(t,f,g)),this._chartWidget.readOnly()||TradingView.isMobileView||!e.enabled("header_undo_redo")||(this._undoRedo=new n(this._$left,this._chartWidget),this._undoRedo.undoElement().addClass("apply-common-tooltip"),this._undoRedo.redoElement().addClass("apply-common-tooltip")),e.enabled("header_screenshot")&&(k=this.createGroup("screenshot",{single:!0}).appendTo(this._$right),E=$('<a class="button getimage"></a>').append($(i(474)).attr({class:"icon"})).addClass("apply-common-tooltip").attr("title",$.t("Take instant snapshot of your chart. No more Paint or other editors to save screenshots simply click the button and copy the link of the picture.")).appendTo(k),k.click(function(t){if(!e.enabled("show_dialog_on_snapshot_ready")){if(E.hasClass("process"))return;E.addClass("process"),c.subscribe("onScreenshotReady",function(t){E.removeClass("process")},null,!0)}u.actions().takeScreenshot.callbacks().fire(),t.preventDefault()})),e.enabled("header_saveload")&&(I=e.enabled("header_saveload_to_the_right")?this._$right:this._$left,v=e.enabled("charting_library_base")?this.createGroup("save-load",{single:!0,showInNarrowView:!0}).appendTo(I):I,A=$("<div>").addClass("save-load-buttons").appendTo(v),this._saveLoad=new r(A,a,{popupDirection:"down",popupReverse:!0}),this._saveLoad.onTitleSizeChanged.subscribe(a,a.updateLayout),TradingView.isOnFeaturePage&&this._saveLoad.hideTitle()),e.enabled("header_widget_dom_node")||$(".header-chart-panel").css("display","none"),u.withModel(this,s.prototype.bindToModel)}var n=i(450),s=i(433),r=i(453),a=i(458),l=i(460),h=i(462),c=i(38),d=i(39),p=i(55).FavoredList;inherit(o,s),o.prototype._createUndoRedoGroup=function(){return this._undoRedo=new n(this._$left,this._chartWidget),this._undoRedo.undoElement().addClass("apply-common-tooltip"),this._undoRedo.redoElement().addClass("apply-common-tooltip"),this.createGroup("undo-redo",{single:!0}).append(this._undoRedo.element())},o.prototype._createFullscreenGroup=function(){this._fullscreen=new a;var t=this.createGroup("fullscreen",{single:!0});return this._fullscreen.element().addClass("apply-common-tooltip").appendTo(t),t},o.prototype._createLayout=function(t,i,o){var n=[];e.enabled("header_chart_type")&&n.push(this._createBarsGroup(i)),e.enabled("header_settings")&&e.enabled("show_chart_property_page")&&n.push(this._createPropertiesGroup(o,t.chartWidgetCollection)),e.enabled("header_indicators")&&n.push(this._createIndicatorsGroup(o)),e.enabled("header_compare")&&n.push(this._createCompareGroup(i,t.chartWidgetCollection,o)),!e.enabled("header_undo_redo")||this._chartWidget.readOnly()||TradingView.isMobileView||n.push(this._createUndoRedoGroup()),e.enabled("header_fullscreen_button")&&!TradingView.isMobileView&&n.push(this._createFullscreenGroup()),n.forEach(function(t){t.appendTo(this._$left)},this),e.enabled("caption_buttons_text_if_possible")&&this._setupCaptionButtons()},o.prototype._setupCaptionButtons=function(){var t=this._$left,e=t.children(".group"),i=this._chartWidgetCollection&&this._chartWidgetCollection.updateLayout,o=function(){for(var t,i=0,o=e.toArray();i<e.length;i++)if(void 0!==t){if($(o[i]).offset().top>t+5)return!1}else t=$(o[i]).offset().top;return!0},n=function(){t.addClass("captions"),o()||t.removeClass("captions"),t.find("svg").pixelSnap(),"function"==typeof i&&i()};this._style_list.onResize().subscribe(null,n),this._interval.onResize.subscribe(null,n),window.studyTemplates&&studyTemplates.onFavoriteListResize.subscribe(null,n),$(window).resize(n),n()},o.prototype._createMinimizeButton=function(t){t&&t.size()&&$(document.createElement("span")).addClass("tv-close-panel top").appendTo(t).on("click",function(e){e.isDefaultPrevented()||(e.preventDefault(),t.toggleClass("hidden"),c.emit("toggle_header",!t.hasClass("hidden")),$(window).trigger("resize"))})},t.exports=o}).call(e,i(1))},function(t,e,i){"use strict";function o(){this._$wrap=$(document.createElement("span")),this._undo=$('<span class="button undo disabled"></span>').append($(i(451))).attr("title","").appendTo(this._$wrap),this._redo=$('<span class="button redo disabled"></span>').append($(i(452))).attr("title","").appendTo(this._$wrap);var t=this;this._undo.click(function(){t.undo()}),this._redo.click(function(){t.redo()}),n.undoStack().onChange().subscribe(this,this.update),n.redoStack().onChange().subscribe(this,this.update)}var n=i(248).UndoHistory;o.prototype.update=function(){var t=n.undoStack(),e=n.redoStack();t.isEmpty()?(this._undo.addClass("disabled"),this._undo.attr("title",null)):(this._undo.removeClass("disabled"),this._undo.attr("title",$.t("Undo {0}").format(t.head().text()||""))),e.isEmpty()?(this._redo.addClass("disabled"),this._redo.attr("title",null)):(this._redo.removeClass("disabled"),this._redo.attr("title",$.t("Redo {0}").format(e.head().text()||"")))},o.prototype.undo=function(){this._undo.hasClass("disabled")||(TradingView.trackEvent("GUI","Undo"),n.undo())},o.prototype.redo=function(){this._redo.hasClass("disabled")||(TradingView.trackEvent("GUI","Redo"),n.redo())},o.prototype.element=function(){return this._$wrap},o.prototype.undoElement=function(){return this._undo},o.prototype.redoElement=function(){return this._redo},t.exports=o},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><path d="M15 13.4C15 4.1 7.5 5 7.5 5V1.7L0 6.5l7.5 4.9V8.2c5.8 0 7.5 5.1 7.5 5.2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><path d="M7.5 8.2v3.2L15 6.5 7.5 1.7V5S0 4.1 0 13.4c0-.1 1.7-5.2 7.5-5.2z"/></svg>'},function(t,e,i){(function(e,o){"use strict";function n(t,o,r){function h(){o.metaInfo.name.value()||p._readOnly?p.setTitle(o.metaInfo.name.value()):p.hideTitle()}var d,p;r=$.extend({popupDirection:"up",popupReverse:!1},r||{}),this._options=r,this.onTitleSizeChanged=new e,this._container=t=$(t),this._chartWidgetCollection=o,this._readOnly=o.readOnly(),this._savedCharts=[],this._editEnabled=!0,this.loadChartDialog=new l,this.renameChartDialog=new a,this._load=$('<span class="load button first apply-common-tooltip"></span>').append($(i(456))).attr("title",$.t("Load Chart Layout")).click(this.signInOrLoadChart.bind(this)).appendTo(t),this._title=$('<span class="title apply-common-tooltip"></span>'),r.hideChartTitle&&this._title.hide(),this._sep=$("<span>").addClass("separator"),this._optionsMenu=$('<span class="button with-arrow options last">').append($("<span>").addClass("arrow-icon")),c(this._optionsMenu,this._getSavedCharts.bind(this),{direction:r.popupDirection,reverse:r.popupReverse,notCloseOnButtons:!0,popupSpacing:r.popupSpacing}),this._readOnly?(this._save=$(),this._copy=$('<span class="copy">'+$.t("Copy")+"</span>").appendTo(t).click($.proxy(this,"cloneChart")),this._title.addClass("read-only"),this._titleReadOnly=$("<span>").addClass("read-only").appendTo(this._title),this._sep.appendTo(this._copy),this._optionsMenu.hide()):(d=$.t("Save Chart Layout saves not just some particular chart, it saves all charts for all symbols and intervals which you are modifying while working with this Layout"),this._save=$('<span class="save button apply-common-tooltip"></span>').attr("title",d).append($(i(457))).appendTo(t).click($.proxy(this,"signInOrSaveChart")),this._copy=$(),this._titleInput=$('<span type="text" maxlength="80">').appendTo(this._title),this._title.bind("click",$.proxy(this,"_renameChart")),this._title.attr("title",$.t("Rename Chart Layout")),this._titleSize=$('<span class="sizer">').appendTo(this._title),this._sep.appendTo(this._save)),this._title.appendTo(t),this._optionsMenu.appendTo(t),this._savecopy=$().add(this._save).add(this._copy).mousedown(function(t){return!t.button&&void this._save.addClass("active")}.bind(this)).mouseup(function(){this._save.removeClass("active")}.bind(this)),p=this,o.metaInfo.name.subscribe(function(){h()}),h(),loginStateChange.subscribe(this,this._refreshSavedChartsList),TVXWindowEvents.on("saved-charts-change",$.proxy(this._otherTabUpdated,this)),TVXWindowEvents.on("saved-charts-change-favorites",$.proxy(this._favoritesUpdated,this)),s.undoStack().onChange().subscribe(this,function(){if(!s.undoStack().isEmpty()){var t=s.undoStack().head().text();if("scroll"===t||"scale time"===t)return}this._setChanges(!0),this.autosave()}),TradingView.keyboardBinder.registerListener("LoadChartDialogHotkey",function(t){return!t.ctrlKey&&(!(46!==t.which||!$(t.target).is("body"))&&(this.loadMenu(),t.preventDefault(),t.stopPropagation(),!0))}.bind(this)),this.favorites=TVSettings.getJSON(n.FAVORITES_KEY,{}),window.saver.chartSaved().subscribe(this,n.prototype._onChartSaved),window.saver.chartAboutToBeSaved().subscribe(this,n.prototype._onChartAboutToBeSaved)}var s=i(248).UndoHistory,r=i(36),a=i(454),l=i(455),h=i(55).showChartNameDialog,c=i(55).bindPopupMenu;n.FAVORITES_KEY="loadChartDialog.favorites",n.prototype._favoritesUpdated=function(t){this.favorites=JSON.parse(t),this.loadChartDialog.updateFavoritesData(this.favorites)},n.prototype._otherTabUpdated=function(t){this._savedCharts=JSON.parse(t),this.loadChartDialog.updateChartsData(this._getLoadMenuCharts())},n.prototype._renameChart=function(){var t=this;t._editEnabled&&this.renameChartDialog.show(this.getTitle()).then(function(e){t.setTitle(e),t.saveChart()})},n.prototype._setTitle=function(t){this._titleInput.text(t),this._titleValue=t,this._savecopy.removeClass("last").addClass("titled"),t?this._options.hideChartTitle||(this._optionsMenu.show(),this._title.show()):(this._optionsMenu.hide(),this._title.hide(),this._savecopy.addClass("last").removeClass("titled")),this._setInputSuze(),this._setChanges(!0)},n.prototype._setReadOnlyTitle=function(t){this._titleReadOnly.html(t).attr("title",t.replace(/<[^>]+>/g,"")),this._savecopy.removeClass("last").addClass("titled"),this._title.addClass("last"),this._options.hideChartTitle||this._title.show()},n.prototype.setTitle=function(t){if(this._readOnly){var e=TradingView.clean(this._chartWidgetCollection.metaInfo.username.value());t=(t?t+": ":"")+"view-only chart by "+'<a href="/u/%1">%1</a>'.replace(/%1/g,e),this._setReadOnlyTitle(t)}else this._setTitle(t)},n.prototype.hideTitle=function(){this._title.hide(),this._optionsMenu.hide(),this._titleInput.text(""),this._savecopy.removeClass("titled").addClass("last")},n.prototype.getTitle=function(){return this._titleValue},n.prototype._setInputSuze=function(){this._titleSize.text(this._titleInput.text()),this._titleInput.width(this._titleSize.width()),this.onTitleSizeChanged.fire()},n.prototype.cloneChart=function(){var t,e=this;o.enabled("save_old_chart_before_save_as")&&this._chartWidgetCollection.metaInfo.id.value()&&this._saveChart(),t=new a($.t("Copy Chart Layout")),t.show($.t("{0} copy").format(e._chartWidgetCollection.metaInfo.name.value())).then(function(t){o.enabled("saved_charts_count_restriction")&&!user.is_pro&&e._savedCharts.length>=5?TVDialogs.showGoProDialog({feature:"savedChartsLimit"}):o.enabled("saveload_storage_customization")?(e._chartWidgetCollection.metaInfo.uid.setValue(void 0),e._chartWidgetCollection.metaInfo.id.setValue(void 0),e.setTitle(t),e.saveChart()):window.open("/chart/?clone="+e._chartWidgetCollection.metaInfo.uid.value()+"&name="+encodeURIComponent(t),"_blank")})},n.prototype._setChanges=function(t){t=!!t,this._haveChanges=t,!t&&this.getTitle()?this._save.addClass("no-change"):this._save.removeClass("no-change")},n.prototype._process=function(t){t=!!t,t?this._save.addClass("process"):this._save.removeClass("process")},n.prototype._onChartAboutToBeSaved=function(){this._saving=!0,this._process(!0),this._editEnabled=!1},n.prototype._onChartSaved=function(t){this._stopProcess(),t&&this._setChanges(!1)},n.prototype._stopProcess=function(){this._saving=!1,this._process(!1),this._editEnabled=!0},n.prototype._saveChart=function(t,e){if(!this._readOnly&&!this._saving&&this._haveChanges)try{window.saver.saveChartSilently(function(){"function"==typeof t&&t.call(this)},null,function(){"function"==typeof e&&e.call(this)})}catch(t){this._stopProcess(),TradingView.logError("Error while saving",t)}},n.prototype._autosaveInterval=6e4,n.prototype.autosave=function(){o.enabled("charts_auto_save")&&(this._chartWidgetCollection.onfeatures||(this._autosaveTimer&&(clearTimeout(this._autosaveTimer),this._autosaveTimer=0),this._autosaveTimer=setTimeout(function(){this._chartWidgetCollection.metaInfo.id.value()&&this._saveChart()}.bind(this),this._autosaveInterval)))},n.prototype._goChartPage=function(t){"/chart/"===location.pathname&&(location.href="/chart/"+t+(TradingView.isMobileView?"?mobile=1":""))},n.prototype.saveChart=function(){if(!this._chartWidgetCollection.onfeatures){var t=this.getTitle();t?(this._chartWidgetCollection.metaInfo.name.setValue(t),this._saveChart(function(){TradingView.trackEvent("GUI","Save Chart Layout"),this._goChartPage(this._chartWidgetCollection.metaInfo.uid.value()),this._refreshSavedChartsList()}.bind(this))):h(function(t){this.setTitle(t),this.saveChart()}.bind(this),{label:$.t("Chart layout name")},64)}},n.prototype.signInOrSaveChart=function(){o.enabled("saveload_requires_authentication")?runOrSignIn($.proxy(this,"saveChart"),{source:"Save chart",sourceMeta:"Chart"}):this.saveChart()},n.prototype.signInOrLoadChart=function(){o.enabled("saveload_requires_authentication")?runOrSignIn($.proxy(this,"loadMenu"),{source:"Load chart",sourceMeta:"Chart"}):this.loadMenu()},n.prototype.signInOrRenameChart=function(){o.enabled("saveload_requires_authentication")?runOrSignIn($.proxy(this,"_renameChart"),{source:"Rename chart"}):this._renameChart()},n.prototype.signInOrSaveAs=function(){o.enabled("saveload_requires_authentication")?runOrSignIn($.proxy(this,"cloneChart"),{source:"Clone chart"}):this.cloneChart()},n.prototype.saveChartByEnter=function(t){13===t.keyCode&&(this._titleInput.blur(),this.signInOrSaveChart())},n.prototype._refreshSavedChartsList=function(t){o.enabled("saveload_requires_authentication")&&!is_authenticated?this._savedCharts=[]:r.getCharts(function(t){this._savedCharts=t,TVXWindowEvents.emit("saved-charts-change",JSON.stringify(t))}.bind(this)).then(function(){t&&t()})},n.prototype._getSavedChartsList=function(){return this._savedCharts},n.prototype._fastDelete=function(t,e){this._savedCharts.splice(e,1),t===this._chartWidgetCollection.metaInfo.id.value()&&(o.enabled("saveload_storage_customization")?(this._chartWidgetCollection.clearChartMetaInfo(),this.setTitle(void 0)):location.href="/chart/")},n.prototype._getSavedCharts=function(){var t,e=[];return this.isSaved()&&e.push({title:this.getTitle(),disabled:!0,addClass:"save-load-chart-title"}),this._readOnly||(e.push({title:$.t("Save Chart Layout"),action:this.signInOrSaveChart.bind(this)}),this.isSaved()&&(e.push({title:$.t("Save As..."),action:this.signInOrSaveAs.bind(this)}),e.push({title:$.t("Rename..."),action:this.signInOrRenameChart.bind(this)})),o.enabled("charting_library_base")||(t=new c.Group,t.push({addClass:"button-load",title:$.t("Load"),action:this.signInOrLoadChart.bind(this)}),t.push({addClass:"button-new",title:$.t("New"),action:this.loadChartDialog.openNewChart.bind(this.loadChartDialog)}),e.push(t))),e},n.prototype.isSaved=function(){return!!this.getTitle()},n.prototype._getLoadMenuCharts=function(){var t=[],e=this,i=this._getSavedChartsList();return i.length&&$.each(i,function(i,o){t.push({id:o.id,title:o.name,symbol:o.short_symbol,interval:o.interval,toolsCount:0,modified:o.modified_iso,active:function(){return o.id===e._chartWidgetCollection.metaInfo.id.value()},openAction:function(){r.loadChart(o)},deleteAction:function(t){TradingView.deleteChart(o.image_url,function(){e._fastDelete(o.id,i),TVXWindowEvents.emit("saved-charts-change",JSON.stringify(e._savedCharts)),t.resolve()})},favoriteAction:function(t){e.favorites=t,TVSettings.setJSON(n.FAVORITES_KEY,t),TVXWindowEvents.emit("saved-charts-change-favorites",JSON.stringify(t))}})}),t},n.prototype.loadMenu=function(){var t=this;this._load.addClass("process"),this._refreshSavedChartsList(function(){t._load.removeClass("process"),t.loadChartDialog.show(t._getLoadMenuCharts(),t.favorites)})},t.exports=n}).call(e,i(28),i(1))},function(t,e){"use strict";function i(t,e,i){this.title=t||$.t("Rename Chart Layout"),this.label=e||$.t("Enter a new chart layout name"),this.maxlength=i||""}i.prototype.show=function(t){var e,i=$.Deferred(),o=TVDialogs.createDialog(this.title),n=function(){var t=o.find('input[name="name"]'),e=t.val();return e?(i.resolve(e),TVDialogs.destroy(this.title)):(TVDialogs.showError($.t("Please enter chart layout name"),TVDialogs.get(this.title)),t.focus()),!1}.bind(this);return o.css("width","400px"),o.find("._tv-dialog-content").html('<div class="main"><form><p>'+this.label+':</p><p class="_tv-dialogs-name"><input type="text" name="name" maxlength="'+this.maxlength+'"/></p><p class="_tv-dialog-right"></p></form></div>'),o.find("form").submit(n),$('<a class="_tv-button wide ok">'+$.t("OK")+"</a>").click(n).css({"margin-right":"5px"}).appendTo(o.find("._tv-dialog-right")),$('<a class="_tv-button wide cancel">'+$.t("Cancel")+"</a>").click(function(){TVDialogs.destroy(this.title)}.bind(this)).appendTo(o.find("._tv-dialog-right")),TVDialogs.positionDialog(o,{left:$(window).width()/2-o.width()/2,top:$(window).height()/2-o.height()/2}),TVDialogs.applyHandlers(o),e=o.find('input[name="name"]'),e.val(t).focus().select(),i},t.exports=i},function(t,e,i){(function(e,o,n){"use strict";function s(){this.title=$.t("Load Chart Layout"),this.options={},this.inputDelegate=new e,this.matchedItems=[],this.itemsData=[],this.qs=new s.QuickSearch(this.inputDelegate,this.fieldsExtractor,this.searchResult.bind(this)),this.sortObj=new s.SortObject(this.modifiedCompare),this.nameSort=new s.SortObject(this.nameCompare),this.symbolSort=new s.SortObject(this.symbolCompare),this.toolsSort=new s.SortObject(this.toolsCompare),r.on("chart_loaded",s.onChartLoaded,this)}var r=i(38),a=i(62).SidebarCustomScroll;s.onChartLoaded=function(){this.itemsData&&this.itemsData.length>0&&this._refreshChartsList()},s.QuickSearch=function(t,e,i){this.fieldsExtractor=e,this.callback=i,this.regExps=[],t.subscribe(this,this.onInput)},s.QuickSearch.prototype.onInput=function(t){this.query=t,this.createRegexps(t),this.search()},s.QuickSearch.prototype.createRegexps=function(t){this.regExps=[],this.regExps.push(RegExp("("+t.split("").map(function(t){return TradingView.RegExpEscape(t)}).join(")(.*?)(")+")","i"))},s.QuickSearch.prototype.match=function(t){var e,i,o,n;for(e=0;e<this.regExps.length;e++)for(i=this.regExps[e],i.lastIndex=0,o=this.fieldsExtractor(t),n=0;n<o.length;n++)if(i.test(o[n]))return!0;return!1},s.QuickSearch.prototype.search=function(){var t,e,i=[];for(t=0;t<this.items.length;t++)e=this.items[t],this.match(e)&&i.push(e);this.callback(i,this.regExps)},s.QuickSearch.prototype.setItems=function(t){this.items=t},s.SortObject=function(t,e){this.isAscending=!1,this.sortingFunc=t,this.getPredicate=function(){return function(t,e){var i=this.sortingFunc(t,e);return this.isAscending&&(i*=-1),i}.bind(this)},this.inverse=function(){this.isAscending=!this.isAscending},this.setIsAscending=function(t){return"boolean"==typeof t&&(this.isAscending=t),this.isAscending},this.reset=function(){this.isAscending=!1}},s.prototype.fieldsExtractor=function(t){var e=s.symbolWrap(t);return[t.title,e]},s.prototype.saveFavorite=function(t,e){e?this.favorites[t]=e:delete this.favorites[t]},s.prototype.filterFavorites=function(){var t={};this.itemsData.map(function(e){this.favorites.hasOwnProperty(e.id)&&(t[e.id]=!0)}.bind(this)),this.favorites=t},s.prototype.getFavorite=function(t){return this.favorites.hasOwnProperty(t)},s.prototype._appendListItem=function(t){var e,i,s,r,a,l=$('<div class="item">').appendTo(this.itemsList);t.active()&&l.addClass("active"),e=o.unix(t.modified),i=$('<div class="value name first">').appendTo(l),n.enabled("items_favoriting")&&(s=$('<div class="icon-favorite">').appendTo(i).click(function(e){this.saveFavorite(t.id,!this.getFavorite(t.id)),this.filterFavorites(),this.fillList(),t.favoriteAction(this.favorites),e.stopPropagation()}.bind(this)),this.getFavorite(t.id)&&s.addClass("active")),$('<span class="text">').text(t.title).appendTo(i),r=$('<div class="actions">').appendTo(l),$('<div class="icon-delete">').appendTo(r).click(function(e){var i=this,o=$.Deferred();t.deleteAction(o),o.then(function(){i.removeItem(t)}),e.stopPropagation()}.bind(this)),$('<div class="value modified">').text(e.format("L LT")).appendTo(l),a=""===t.symbol?"multiple charts":t.symbol+", "+t.interval,$('<div class="value symbol last">').text(a).appendTo(l),l.click(function(e){this.itemsList.executing!==!0&&(this.itemsList.executing=!0,t.openAction(),setTimeout(function(){this.itemsList.executing=!1}.bind(this),1e3))}.bind(this))},s.prototype.removeItem=function(t){var e=this.itemsData.indexOf(t);e>-1&&this.itemsData.splice(e,1),this.setChartsData(this.itemsData)},s.prototype.modifiedCompare=function(t,e){var i=t.modified,n=e.modified;return o(n).diff(o(i))},s.prototype.nameCompare=function(t,e){return t.title.localeCompare(e.title)},s.symbolWrap=function(t){return""===t.symbol?"multiple charts":t.symbol+" "+t.interval},s.prototype.symbolCompare=function(t,e){return s.symbolWrap(t).localeCompare(s.symbolWrap(e))},s.prototype.toolsCompare=function(t,e){var i=t.toolsCount,o=e.toolsCount;return i<o?-1:i===o?0:1},s.prototype.sortClick=function(t){this.setSort($(t.target).data("sort"),!0),this.fillList()},s.prototype.setSort=function(t,e){var i,o={field:TVSettings.getValue("loadChartDialog.sort.field")||"modified",isAscending:TVSettings.getValue("loadChartDialog.sort.asc")||"0"},n=t||o.field,s=e?"0"===o.isAscending?"1":"0":o.isAscending;this.currentSortObj&&!(i=n!==o.field)||(this.currentSortObj="name"===n?this.nameSort:"symbol"===n?this.symbolSort:"tools"===n?this.toolsSort:this.sortObj,i&&TVSettings.setValue("loadChartDialog.sort.field",n)),this.currentSortObj.setIsAscending("1"===s),s!==o.isAscending&&TVSettings.setValue("loadChartDialog.sort.asc",s),$.each(this.header.children(".item"),function(){$(this)[$(this).data("sort")===n?"addClass":"removeClass"]("active")})},s.prototype.sortList=function(){var t,e=[],i=[];this.matchedItems.map(function(t){this.favorites.hasOwnProperty(t.id)?e.push(t):i.push(t)}.bind(this)),void 0!==this.currentSortObj&&(t=this.currentSortObj.getPredicate(),i.sort(t),e.sort(t)),this.matchedItems=e.concat(i)},s.prototype.fillList=function(){var t=this;this.sortList(),this.itemsList.children(".item").remove(),$.each(this.matchedItems,function(){t._appendListItem(this)}),this.highlightOccurrences(this.qs.regExps)},s.prototype.searchResult=function(t,e){this.matchedItems=t,this.fillList()},s.prototype.updateChartsData=function(t){this.setChartsData(t)},s.prototype.updateFavoritesData=function(t){this.favorites=t,this.itemsList&&this.inputDelegate.fire(this.input.val())},s.prototype._refreshChartsList=function(){this.qs.setItems(this.itemsData),this.inputDelegate.fire(this.input.val())},s.prototype.setChartsData=function(t){this.itemsList&&(this.itemsData=t,this.qs.setItems(t),this.inputDelegate.fire(this.input.val()))},s.prototype.layoutHeader=function(){var t=$('<div class="list-header">').appendTo(this.content);return $('<div class="item name first">').text($.t("Chart Layout Name")).data("sort","name").appendTo(t),$('<div class="item modified">').text($.t("Last Modified")).data("sort","modified").appendTo(t),$('<div class="item symbol last">').text($.t("Active Symbol")).data("sort","symbol").appendTo(t),t},s.prototype.resetSort=function(){this.sortObj.reset(),this.nameSort.reset(),this.symbolSort.reset(),this.toolsSort.reset(),this.currentSortObj=this.sortObj},s.prototype.resetSearchClick=function(){this.input.val("").trigger("input").focus()},s.prototype.show=function(t,e){var i,o,l,h;this.options.width="654px",this.options.content='<div class="load-chart">'+(n.enabled("new_chart_creation_available")?'<a class="button new-chart">'+$.t("NEW CHART LAYOUT")+"</a>":"")+'<div class="chart-search"><input type="text" name="q" value="" autocomplete="off" placeholder="'+$.t("Search")+'"><a class="input-reset"></a><div class="search-icon"></div></div></div>',i=TVDialogs.createDialog(this.title,this.options),TVDialogs.positionDialog(i),this.input=i.find(".chart-search input"),this.inputReset=i.find(".chart-search .input-reset"),this.content=$('<div class="list-content"></div>').appendTo(i.find(".load-chart")),this.header=this.layoutHeader(),this.setSort(),this.itemsListContainer=$('<div class="charts-list-container">').appendTo(this.content),this.itemsList=$('<div class="charts-list">').appendTo(this.itemsListContainer),this._scroll=new a(this.itemsListContainer,this.itemsList,{showBottomShadow:!1}),i.find(".new-chart").click(this.openNewChart),this.header.children(".item").click($.proxy(this,"sortClick")),this.inputReset.click($.proxy(this,"resetSearchClick")),this.input.on("input propertychange",function(){this._scroll.scrollTo(0),this.inputDelegate.fire(this.input.val()),""!==this.input.val()?this.inputReset.show():this.inputReset.hide()}.bind(this)),n.enabled("saveload_requires_authentication")&&!is_authenticated&&(this.content.hide(),o=$('<div class="please-log-in"></div>').appendTo(i.find(".load-chart")),$('<a href="#" class="link">'+$.t("You are not logged in. Please sign in.")+"</a>").appendTo(o).click(function(t){t.preventDefault(),TVDialogs.destroy(this.title),TVDialogs.showSignInDialog(null,{mode:"signin",source:"Load chart dialog"})}.bind(this))),this.favorites=e,this.setChartsData(t),l=this,TVDialogs.applyHandlers(i,{doNotCloseOnBgClickIfShadowbox:!0,beforeDestroy:function(){r.on("chart_loaded",s.onChartLoaded,l)}}),h=this.itemsListContainer,o&&(h=o),TVDialogs.resizeContent(i.height(),h),TVDialogs.positionDialog(i)},s.prototype.openNewChart=function(){TradingView.openNewChart()},s.prototype.highlightOccurrences=function(t){this.itemsList.children(".item").each(function(){var e,i=$(this).find(".value.name").find("span"),o=i.text();o=s.highlightText(o,t),i.html(o),e=$(this).find(".value.symbol"),o=e.text(),o=s.highlightText(o,t),e.html(o)})},s.highlightText=function(t,e){var i,o,n,s,r,a;if(t=$("<div>").text(t).html(),0===e.length)return t;for(i=0;i<e.length;i++){if(o=e[i],o.lastIndex=0,n="",s="",r=o.exec(t),r&&r.length)for(a=1;a<r.length;a++)n+=a%2?'<span class="match">$'+a+"</span>":"$"+a;if(s=t.replace(o,n),s&&s!==t)return s}},t.exports=s}).call(e,i(28),i(6),i(1))},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 18" width="26" height="18"><path d="M12 0C8.4 0 5.4 2.8 5.1 6.3 2 6.1.1 9 0 11.1 0 13.9 2.2 16 4.7 16h4.9l-1-1H4.7C2.8 15 1 13.3 1 11.2 1 9 3 6.7 6 7.4 6 3 9 1 12 1s3.7 1.2 5.1 2.9c1.5.1 3.3.6 4.2 1.7 1 1.5 1.2 2.6 1.2 4.2 1.4.4 2.5 1.5 2.5 2.7-.2 1.6-1.3 2.5-2.6 2.5h-5l-1 1h5.9c2.8 0 3.7-1.9 3.7-3.5s-1-3-2.5-3.4c0-1.6-.5-2.9-1.4-4.1-.9-1.2-2.7-2-4.5-2.1C16.3 1.2 14.3 0 12 0zm-2 7v5H7l6 6 6-6h-3V7h-6zm1 1h4v5h1.6L13 16.6 9.4 13H11V8z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 18" width="26" height="18"><path d="M12 0C8.4 0 5.4 2.8 5.1 6.3 2 6.1.1 9 0 11.1 0 13.9 2.2 16 4.7 16H9v-1H4.7C2.8 15 1 13.3 1 11.2 1 9 3 6.7 6 7.4 6 3 9 1 12 1s3.7 1.2 5.1 2.9c1.5.1 3.3.6 4.2 1.7 1 1.5 1.2 2.6 1.2 4.2 1.4.4 2.5 1.5 2.5 2.7-.2 1.6-1.3 2.5-2.6 2.5H17v1h5.3c2.8 0 3.7-1.9 3.7-3.5s-1-3-2.5-3.4c0-1.6-.5-2.9-1.4-4.1-.9-1.2-2.7-2-4.5-2.1C16.3 1.2 14.3 0 12 0zm1 6l-6 6h3v5h6v-5h3l-6-6z"/></svg>'},function(t,e,i){(function(e){"use strict";function o(){var t=this;this.isFullscreen=!1,this._e=$("<span>").addClass("button fullscreen iconed apply-common-tooltip").attr("title",$.t("Fullscreen mode")).append($(i(459)).attr({width:18,height:18})),this._e.click(function(){t.startFullscreen()}),$(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",function(){var e;["fullscreenElement","webkitFullscreenElement","mozFullscreenElement","mozFullScreenElement","msFullscreenElement"].forEach(function(t){return t in document&&void(e=!!document[t])}),null!=e&&(e?t._onStartFullscreen():t._onExitFullscreen())})}o.prototype.element=function(){return this._e},o.prototype.startFullscreen=function(){["requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen"].forEach(function(t){if("function"==typeof document.documentElement[t])return document.documentElement[t](),!0}),this._onStartFullscreen()},o.prototype._onStartFullscreen=function(){var t,i,o=this;e.enabled("side_toolbar_in_fullscreen_mode")?(t=$(".header-chart-panel"),t.hide()):(i=$("#chart-area"),i.addClass("fullscreen")),this._$exitButton||(this._$exitButton=$('<div class="exit-fullscreen">'+$.t("Exit Full Screen (ESC)")+"</div>").on("click",this.exitFullscreen.bind(this)).appendTo(document.body)),$(window).resize(),$(document).off("keyup.toggleFullscreen").on("keyup.toggleFullscreen",function(t){27===t.keyCode&&o.exitFullscreen()})},o.prototype.exitFullscreen=function(){["exitFullscreen","mozCancelFullScreen","mozExitFullscreen","webkitExitFullscreen","msExitFullscreen"].forEach(function(t){if("function"==typeof document[t])return document[t](),!0}),this._onExitFullscreen()},o.prototype._onExitFullscreen=function(){var t,i;this._$exitButton&&($(".exit-fullscreen").remove(),delete this._$exitButton),e.enabled("side_toolbar_in_fullscreen_mode")?(t=$(".header-chart-panel"),t.show()):(i=$("#chart-area"),i.removeClass("fullscreen")),$(window).resize(),$(document).off("keyup.toggleFullscreen")},t.exports=o}).call(e,i(1))},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="M172.6 367.9l-97.7 97.7L0 390.7v195.4h195.4l-74.9-74.9 97.7-97.7-45.6-45.6zM195.4 0H0v195.4l74.9-74.9 97.7 97.7 45.6-45.6-97.7-97.7L195.4 0zm195.3 0l74.9 74.9-97.7 97.7 45.6 45.6 97.7-97.7 74.9 74.9V0H390.7zm22.8 367.9l-45.6 45.6 97.7 97.7-74.9 74.9h195.4V390.7l-74.9 74.9-97.7-97.7z"/></svg>'},function(t,e,i){(function(e,o){"use strict";function n(t){var n=i(461);this._options=$.extend({interval:1},t||{}),this._e=$("<div>").addClass("intervals-container favored-list-container"),this._quick=$("<div>").addClass("quick").appendTo(this._e),this._quicked={},this._main=$("<span>").text(this.shortLabel(this._options.interval)).appendTo(this._quick),this._main.data("interval",this._options.interval),e.enabled("header_interval_dialog_button")&&this._setIntervalDialogButton(),this._mainSub=$("<span>").addClass("submenu").attr("title",$.t("Time Interval")).append($("<i>")).appendTo(this._e),t&&"string"==typeof t.submenuBtnAddClass&&this._mainSub.addClass(t.submenuBtnAddClass),this._quick.on("click",this._selectInterval.bind(this)),this._mainSub.on("click",this._selectMenu.bind(this)),this._menu=new n(this,this._mainSub,this._options),
this.onResize=new o,r.intraday.subscribe(this._fullUpdate.bind(this)),r.supportedResolutions.subscribe(this._fullUpdate.bind(this)),t.interval&&r.interval.setValue(t.interval),r.interval.subscribe(this.activateInterval.bind(this),{callWithLast:!0}),TVXWindowEvents.on("intervalwidget-change",this._onChangeInAnotherTab.bind(this)),this._fullUpdate()}var s=i(41),r=i(42);n.prototype.forceUpdate=function(){this._fullUpdate(!0)},n.prototype._fullUpdate=function(t){this._setupIntervals(t),this._setupQuicks(t),this.reactivateInterval(),this._resize()},n.prototype._onChangeInAnotherTab=function(){this._fullUpdate(!0)},n.prototype.isDefaultInterval=function(t){return t in ChartApiInstance.defaultResolutions()},n.getIntervals=function(){return $.extend({},ChartApiInstance.defaultResolutions())},n.prototype._setupIntervals=function(){this._intervals=n.getIntervals()},n.prototype._sorted=function(t){Array.isArray(t)||(t=Object.keys(t));var e=function(t){var e=new s(t);return e.kind()!==s.MINUTES?{S:1/60,D:1440,W:10080,M:43200}[e.letter()]*e.multiplier():e.multiplier()};return t.sort(function(t,i){return e(t)-e(i)})},n.prototype.setUpStarredItemsList=function(t){var e,i={};for(e=0;e<t.length;++e)i[t[e]]=!0;this._setupQuicks(!1,i)},n.prototype._setupQuicks=function(t,i){this._options.notShowQuicks&&!i||(i=i||{},e.enabled("star_some_intervals_by_default")&&(i={1:!0,30:!0,60:!0}),this._quicked=TVSettings.getJSON("IntervalWidget.quicks",i,t),this._quicked=this._removeCustomIntervalQuicks(this._quicked)),this._addQuicked(this._quicked)},n.prototype._removeCustomIntervalQuicks=function(t){var e={};return Object.keys(t).forEach(function(i){this.isDefaultInterval(i)&&(e[i]=t[i])},this),e},n.prototype.element=function(){return this._e},n.prototype.mainButton=function(){return this._main},n.prototype._quicks=function(){return this._quick.find("span").slice(0,-1)},n.prototype.postfix=function(t,e){if(e){var i=" ";switch(t){case"D":i+=$.t("day",{count:e});break;case"W":i+=$.t("week",{count:e});break;case"M":i+=$.t("month",{count:e});break;case"S":i+=$.t("second",{count:e});break;case"m":i+=$.t("minute",{count:e});break;case"h":i+=$.t("hour",{count:e})}return i}switch(t){case"m":return"";case"h":return $.t("h",{context:"dates"});default:return $.t(t.toUpperCase(),{count:0})}},n.prototype.readable=function(t,e,i){function o(t){return t>=60&&!(t%60)}var n,r;if(t=t,n="m",e=e,r=new s(t),!r.isValid())throw new TypeError("Wrong interval value: "+t);return r.kind()!==s.MINUTES&&(n=r.letter()),t=r.multiplier(),r.kind()===s.MINUTES&&o(t)&&(t=~~(t/60),n="h"),e=e?t:null,t=i&&1===t&&r.isDWM()?"":t,""+t+this.postfix(n,e)},n.prototype.shortLabel=function(t){return TradingView.translatedIntervalString(this.readable(t,!1))},n.prototype.fullLabel=function(t){return this.readable(t,!0)},n.prototype._addQuicked=function(t){var e,o,n,s,r,a,l,h;for(t=this._sorted(t),e=this._quicks(),o=$(),n=!1,e.size()>t.length&&(e.slice(t.length).remove(),n=!0),s=i(40),r=0;r<t.length;r++)a=t[r],l=e.eq(r),h=!1,l.size()?l.data("interval")!==a&&(h=!0):(l=$("<span>"),o=o.add(l),h=!0),h&&(l.data("interval",a).text(this.shortLabel(a)),n=!0),l.toggleClass("selected",a===this.getInterval()).toggleClass("disabled",!s.isAvailable(a));this._main.before(o),n&&this._resize()},n.prototype._resize=function(){this.onResize.fire()},n.prototype.addQuick=function(t){this._quicked[t]=!0,this._addQuicked(this._quicked),this.saveSettings(),this.reactivateInterval()},n.prototype._quickWithInterval=function(t){var e=null;return this._quicks().each(function(i,o){if(o=$(o),t===o.data("interval"))return e=o,!1}),e},n.prototype.inQuick=function(t){return null!=this._quickWithInterval(t)},n.prototype.removeQuick=function(t){this._quickWithInterval(t)&&(this._quickWithInterval(t).remove(),this._resize(),delete this._quicked[t],this.saveSettings(),this.reactivateInterval())},n.prototype.toggleQuick=function(t){var e=this.inQuick(t);return e?this.removeQuick(t):this.addQuick(t),!e},n.prototype.hasQuicks=function(){return!!this._quicks().length},n.prototype.deactivate=function(t){this._quick.find("span").removeClass("selected")},n.prototype.activateInterval=function(t){this.deactivate(),this.inQuick(t)?this._quickWithInterval(t).addClass("selected"):(this.hasQuicks()&&this._main.addClass("selected"),this._main.data("interval")!==t&&(this._main.text(this.shortLabel(t)),this._main.data("interval",t),this._resize()))},n.prototype.reactivateInterval=function(){this.activateInterval(this.getInterval())},n.prototype.getInterval=function(){return r.interval.value()},n.prototype.setInterval=function(t){r.interval.setValue(""+t)},n.prototype._selectInterval=function(t){var e=$(t.target),i=e.data("interval");this.hasQuicks()||this.getInterval()!==i?e.hasClass("disabled")||this.setInterval(i):this._selectMenu()},n.prototype._selectMenu=function(t){this._mainSub.hasClass("active")?this._menu.close():this._menu.open(this._sorted(this._intervals))},n.prototype._setIntervalDialogButton=function(){var t=i(54);this._intervalDialogButton=$("<span>").addClass("submenu interval-dialog-button apply-common-tooltip").attr("title",$.t("Open Interval Dialog")).append($("<i>")).appendTo(this._e).click(function(){var e=new t({callback:function(t){r.interval.setValue(t)}}).show(),i=$(this);i.addClass("active"),e.on("destroy",function(){i.removeClass("active")})})},n.prototype.addInterval=function(t){},n.prototype.removeInterval=function(t){},n.prototype.saveIntervals=function(){},n.prototype.saveQuicked=function(){TVSettings.setJSON("IntervalWidget.quicks",this._quicked)},n.prototype.saveSettings=function(){this.saveQuicked(),this.saveIntervals(),TVXWindowEvents.emit("intervalwidget-change")},t.exports=n}).call(e,i(1),i(28))},function(t,e,i){(function(e){"use strict";function o(t,e,i){this._options=i||{},this._w=t,this._opener=e,this._addMetric=1,this._addOpened=!1}var n=i(41),s=i(40),r=i(55).bindPopupMenu;o.prototype._interval=function(t){var e=$(t.target);e.hasClass("disabled")||(this._w.setInterval(e.data("interval")),this.close())},o.prototype._quickTitle=function(t){return t?$.t("Remove from favorites"):$.t("Add to favorites")},o.prototype._onQuick=function(t){var e=$(t.target).closest(".item"),i=this._w.toggleQuick(e.data("interval"));return e.toggleClass("quicked",i),$(t.target).closest(".to-quick").attr("title",this._quickTitle(i)),!1},o.prototype._onDelete=function(t){var e=$(t.target.parentNode);return this._w.removeInterval(e.data("interval")),this._reopen(),!1},o.prototype._showControlButtons=function(){return!0},o.prototype._append=function(t,e){var o=$("<span>").addClass("item").toggleClass("active",e===this._w.getInterval()).toggleClass("quicked",this._w.inQuick(e)).toggleClass("disabled",!s.isAvailable(e)).text(this._w.fullLabel(e)).data("interval",e);this._showControlButtons()&&(this._w.isDefaultInterval(e)||o.prepend($("<span>").addClass("delete").attr("title",$.t("Remove custom interval")).click(this._onDelete.bind(this))),this._w._options.notShowQuicks||o.prepend($("<span>").addClass("to-quick").append($(i(60)).attr({width:16,height:16})).attr("title",this._quickTitle(this._w.inQuick(e))).click(this._onQuick.bind(this)))),o.click(this._interval.bind(this)),t.append(o)},o.prototype._appendAdd=function(t){function e(){var t,e=parseInt(s.val());e<1&&s.val(1),t={1:1440,60:24,D:364,W:52,M:12}[this._addMetric],e>t&&s.val(t)}var i,o=$("<span>").addClass("item-add"),n=$('<span class="item-add-wrap">').appendTo(o),s=$('<input type="text">').addClass("tv-text-input inset minutes").val(1).appendTo(n).TVTicker(),a=$("<span>").addClass("_tv-button mins").append($("<span>")).append($("<i>")).appendTo(n),l=$("<span>").addClass("_tv-button add").text($.t("Add")).appendTo(n),h={1:$.t("minute_plural"),60:$.t("hour_plural"),D:$.t("day_plural"),W:$.t("week_plural"),M:$.t("month_plural")};a.find("span").text(h[this._addMetric||1]),s.change(e.bind(this)),i=this,r(a,null,{direction:"up",event:"button-popup",addClass:"thin small-font metrics",popupSpacing:~~this._w._options.popupSpacing,onRemove:function(){i._addOpened=!1}}),a.click(function(){i._addOpened=!0,a.trigger("button-popup",[$.map(h,function(t,o){return{title:t.toUpperCase(),active:o===i._addMetric,action:function(){return i._addMetric=o,a.find("span").text(t),e.call(i),!1}}})])}),l.click(function(){TradingView.trackGoProFeature("customIntervals"),TradingView.runOrGoPro(function(){var t,e=parseInt(s.val());e==e&&(t=parseInt(i._addMetric),t==t?i._addInterval(""+e*i._addMetric):i._addInterval(""+e+i._addMetric))},{feature:"customIntervals"})}),t.append($("<div>").addClass("separator")),t.append(o)},o.prototype._addInterval=function(t){},o.prototype._open=function(t,i){var o,s,r,a,l;t.find(".item, .item-add, .separator").remove(),o=[],s=[],r=[],a=[],l=$("<span>").addClass("separator"),$.each(i,function(t,e){var i=new n(e);i.isDWM()?a.push(e):i.kind()===n.HOURS?r.push(e):i.kind()===n.MINUTES?s.push(e):o.push(e)}),o.length&&o.forEach(function(e){this._append(t,e)}.bind(this)),s.length&&(t.append(l.clone()),s.forEach(function(e){this._append(t,e)}.bind(this))),r.length&&(t.append(l.clone()),r.forEach(function(e){this._append(t,e)}.bind(this))),a.length&&(t.append(l.clone()),a.forEach(function(e){this._append(t,e)}.bind(this))),e.enabled("custom_resolutions_box")&&this._appendAdd(t)},o.prototype._reopen=function(t){if(this._open(this._menu,this._w._sorted(this._w._intervals)),t&&t.highlight){var e=this._menu.find(".item").filter(function(){return $(this).data("interval")===t.highlight});e.length&&e.highlight(2)}},o.prototype.open=function(t){var e,i=this,o=$("<div>").addClass("charts-popup-list intervals-list favored-list").toggleClass("touch",Modernizr.touch),n=this._w.mainButton().offset(),s=this._w.mainButton().outerHeight(),r=n.top+s+parseInt(i._options.popupSpacing||0),a=10;o.appendTo(document.body),o.css({top:r,left:n.left}).show(),this._menu=o,this._opener.addClass("active"),this._open(o,t),e=Math.min($("body").height(),$(window).height())-s-r-a,this._setMaxHeight(o,e),setTimeout(function(){o.on("mousedownoutside",function(t){this.close(t)&&o.unbind("mousedownoutside")}.bind(this))}.bind(this),0)},o.prototype._setMaxHeight=function(t,e){t.height()>=e&&(t.css("max-height",e+"px"),t.width(t.width()+18))},o.prototype.close=function(t){return(!t||!$(t.target).parents("span.item-add, .charts-popup-list.metrics").length)&&(!(t&&$(t.target).hasClass("submenu")&&$(t.target).parents(".intervals-container").length)&&(this._menu.remove(),$(document.body).off(".interval-menu"),delete this._menu,this._opener.removeClass("active"),!0))},t.exports=o}).call(e,i(1))},function(t,e,i){(function(e,o,n,s){"use strict";function r(t,i,n){var s=this;this.HIGHLIGHT_STUDY_NUM_FLICKS=2,this._BASIC_STUDIES_PACKAGE_NAME="tv-basicstudies",this._CUSTOM_STUDIES_PACKAGE_NAME="Script$USER",this._PUBLISHED_STUDIES_PACKAGE_NAME="Script$PUB",this._SCRIPTING_PACKAGE_NAME="tv-scripting",this._BASIC_STUDIES_PAGE_NAME=e.enabled("plain_studymarket")?"Technical Analysis":"Built-ins",this._chartWidgetCollection=t,this._chart=t.activeChartWidget.value(),this._options=$.extend({},this.DEFAULT_OPTIONS,n||{}),this.concretizeOptions(),this._market=null,this._studies=null,this._packagesWithTabNames={},this._user=i,this._favs=[],this._pages={},this._tabs={},this._headers={},this.favsChanged=new o,this.layoutChanged=new o,this.visibilityChanged=new o,this.studiesReady=new $.Deferred,this.marketPagesReady=new $.Deferred,this._pubSearchCount=[0,0,0],this._pubSearchCanLoad=[!0,!0,!0],this._pubSearchEntries=[],this._pubSearchCache=[],this._pubSearchDfd=null,this._pubSearchPageShown=!1,TVXWindowEvents.on("StudyFavoritesChanged",function(t){s._onExternalFavoritesChanged(JSON.parse(t))}),this._backtestingEnabled=TradingView.isFeatureEnabled("backtesting")}var a=i(38),l=i(436),h=i(62).SidebarCustomScroll,c=i(55).bindPopupMenu,d=i(114);r.prototype.init=function(){return this._initialized?void this.getStudyInfo():(this.setupMarketInfo(),this.getStudyInfo(),this.setUser(this._user),this.prepareLayout(),this.attachHandlers(),void(this._initialized=!0))},r.prototype.DEFAULT_OPTIONS={onWidget:!1,hideMarketPages:!1,selectBasicPage:!0,minimized:!1,searchKeywords:{earning:RegExp("EPS"),earnings:RegExp("EPS"),"trailing twelve months":RegExp("TTM")},popularFundamentals:[{name:$.t("Income Statement"),studies:["Script$EDGR_TOTAL_REVENUE_V2@tv-scripting","Script$EDGR_DILUTED_EPS_NET_INCOME_V2@tv-scripting","Script$EDGR_NET_INCOME_V2@tv-scripting","Script$EDGR_EBITDA_V2@tv-scripting","Script$EDGR_EBIT_V2@tv-scripting","Script$EDGR_EQUITY_EARNINGS_V2@tv-scripting"]},{name:$.t("Profitability"),studies:["Script$EDGR_GROSS_MARGIN_V2@tv-scripting","Script$EDGR_AFTER_TAX_MARGIN_V2@tv-scripting","Script$EDGR_GROSS_PROFIT_V2@tv-scripting"]},{name:$.t("Dividend"),studies:["Script$EDGR_DIVIDEND_YIELD_V2@tv-scripting","Script$EDGR_DIVIDENDS_PAID_V2@tv-scripting"]},{name:$.t("Current Valuation"),studies:["Script$EDGR_MARKET_CAP_V2@tv-scripting","Script$EDGR_PE_RATIO_V2@tv-scripting","Script$EDGR_PEG_RATIO_V2@tv-scripting","Script$EDGR_PS_RATIO_V2@tv-scripting","Script$EDGR_PRICE_BOOK_VALUE_PER_SHARE_V2@tv-scripting"]},{name:$.t("Other"),studies:["Script$EDGR_DEBT_TO_EQUITY_V2@tv-scripting","Script$EDGR_FREE_CASH_FLOW_V2@tv-scripting","Script$EDGR_PRICE_CASH_FLOW_PER_SHARE_V2@tv-scripting","Script$EDGR_RETURN_ON_EQUITY_V2@tv-scripting","Script$EDGR_ACCOUNTING_CHANGE_V2@tv-scripting","Script$EDGR_ACCOUNTS_PAYABLE_V2@tv-scripting"]}]},r.prototype._FAV_KEY="studyMarket.favorites",r.prototype._PAGE_KEY="studyMarket.page",r.prototype._MARKET_TAB_IS_OPEN_KEY="studyMarket.marketTabIsOpen",r.prototype._TECHNICAL_TAB_IS_OPEN_KEY="studyMarket.technicalTabIsOpen",r.prototype._ECONOMY_TAB="Economy & Symbols",r.prototype._FILTER_KEY="studyMarket.filter",r.prototype._PUB_SEARCH_ENTRIES_ON_PAGE=20,r.prototype.onCustomScriptModified=function(){this._initialized&&(this.getStudyInfo(),this.resetCustomScriptPage(),this.loadFavorites(),this.updateSearchPage())},r.prototype.onPublishedScriptModified=function(){this._initialized&&(this.getStudyInfo(),this.resetPublishedScriptPage(),this.loadFavorites(),this.updateSearchPage())},r.prototype.concretizeOptions=function(){(this._options.onWidget||e.enabled("study_market_minimized"))&&(this._options.hideMarketPages=!0,this._options.selectBasicPage=!0,this._options.minimized=!0)},r.prototype.setupMarketInfo=function(){var t=this;this._market={products:pro.getStudies(),order:pro.getStudiesOrder()},this._market.order=$.grep(t._market.order,function(t){return"Script$EOTPRO"!==t}),this.setupSubproductsInfo()},r.prototype.setupSubproductsInfo=function(){var t,e,i,o,n;for(this._subProductIds={},t=Object.keys(this._market.products),e=0;e<t.length;++e)if(i=this._market.products[t[e]],void 0!==i.subproduct_ids)for(o=0;o<i.subproduct_ids.length;++o)n=i.subproduct_ids[o],this._subProductIds[n]=i.id},r.prototype.getStudyInfo=function(){this._chart.withModel(this,function(){this.setupStudyInfo()})},r.prototype.setupStudyInfo=function(){var t=this._chartWidgetCollection.activeChartWidget.value().model().studiesMetaData();this._studies={},t=t.filter(function(t){return!this.isHidedStudy(t)},this),t.forEach(function(t){var e,i=this.getStudyPackageName(t),o="Script$EOTPRO"!==i&&(!this._options.minimized||i===this._BASIC_STUDIES_PACKAGE_NAME);o&&(e=this.resolvePackageName(i),assert(void 0!==e,"Cannot resolve packageName "+i),this._studies[e]=this._studies[e]||[],this._studies[e].push(t))}.bind(this),this),this.studiesReady.resolve()},r.prototype.resolvePackageName=function(t){return t in this._subProductIds?this._subProductIds[t]:t},r.prototype.setUser=function(t){is_authenticated?this.setupUserData(t):this.setAnonymous()},r.prototype.setupUserData=function(t){this._user=t,this.loadFavorites(),this.updateMarketPages()},r.prototype.setAnonymous=function(){this.setupUserData(null,[]),this.favsChanged.fire()},r.prototype.isHidedStudy=function(t){return!!t.is_hidden_study},r.prototype.loadFavorites=function(){var t,e,i=TVSettings.getJSON(this._FAV_KEY,[]),o=[];for(t=0;t<i.length;t++)e=d.cutFullId(i[t]),o.indexOf(e)===-1&&o.push(e);this._favs=o,this.favsChanged.fire()},r.prototype.saveFavorites=function(){TVSettings.setJSON(this._FAV_KEY,this._favs)},r.prototype.prepareLayout=function(){var t=this;this._widget=$('<div class="insert-study-dialog"><div class="insert-study-row insert-study-title _tv-dialog-title"><a class="_tv-dialog-title-close"></a>'+$.t("Indicators")+'</div><div class="insert-study-row insert-study-body"><div class="insert-study-tabs"><div class="insert-study-tabs-list-container"><ul class="insert-study-tabs-list"></ul></div></div><div class="insert-study-main"><div class="insert-study-headers"></div><div class="insert-study-pages insert-study-row"></div></div></div></div>'),this._w_title=this._widget.find(".insert-study-title"),this._w_tabs_container=this._widget.find(".insert-study-tabs-list-container"),this._w_tabs=this._widget.find(".insert-study-tabs-list"),this._w_pages=this._widget.find(".insert-study-pages"),this._w_pages.onScrollToEnd=new o,this._w_headers=this._widget.find(".insert-study-headers"),this._widget.draggable(TVDialogs._constrainDraggableOptionsIfNeeded({handle:".insert-study-title"})).css({position:"absolute",zIndex:17}),this.preparePages(),this._options.minimized&&this._widget.addClass("minimized"),this._w_pages.scroll(function(){var e=$.map(t._w_pages.children(":visible"),function(t){return $(t).outerHeight(!0)}).reduce(function(t,e){return t+e},0),i=t._w_headers.outerHeight(!0),o=t._widget.find(".insert-study-main").height(),n=e>o-i;n&&e-t._w_pages.scrollTop()===o-i&&t._w_pages.onScrollToEnd.fire()}),this._widget.appendTo("body"),this.hide()},r.prototype.currentPage=function(){return this._pages[this._currentPageTitle]},r.prototype.preparePages=function(){this.addSearchPage(),e.enabled("items_favoriting")&&this.addFavoritesPage(),this.prepareBasicPage(),this._options.minimized||e.enabled("charting_library_base")||(this.preparePublishedScriptPage(),this.prepareCustomScriptPage()),this.prepareMarketPages(),this._options.minimized||e.enabled("charting_library_base")||this.prepareFundamentalsPage(),this.addEconomyPage(),this._scroll=new h(this._w_tabs_container,this._w_tabs,{showBottomShadow:!1})},r.prototype.addEconomyPage=function(){var t=this.addPage(this._ECONOMY_TAB,{showTitle:!0}),e=$('<div class="economy-page">').appendTo(t);this.addSymbolWidget=new l(this._chartWidgetCollection),this.addSymbolWidget.show(),e.append(this.addSymbolWidget._widget)},r.prototype.addFavoritesPage=function(){var t=this.addPage("Favorites",{showTitle:!0,filterControl:this._backtestingEnabled&&this._getStrategiesFilterControl(this.updateFavorites.bind(this))||null});t.addClass("page-padded")},r.prototype._strategiesFilterType=function(){return this._strategiesFilterTypeValue||(this._strategiesFilterTypeValue=new n(TVSettings.getValue("studyMarket.strategiesFilter","none")),this._strategiesFilterTypeValue.subscribe(function(t){TVSettings.setValue("studyMarket.strategiesFilter",t)})),this._strategiesFilterTypeValue},r.prototype._getStrategiesFilterControl=function(t){var e=this,i=$('<span class="filter-control">').on("click",function(){var t=e._strategiesFilterType().value(),i=[{title:$.t("Indicators and Strategies"),action:e._strategiesFilterType().setValue.bind(e._strategiesFilterType(),"none"),active:"only_strategies"!==t&&"not_strategies"!==t},{title:$.t("Indicators"),action:e._strategiesFilterType().setValue.bind(e._strategiesFilterType(),"not_strategies"),active:"not_strategies"===t},{title:$.t("Strategies"),action:e._strategiesFilterType().setValue.bind(e._strategiesFilterType(),"only_strategies"),active:"only_strategies"===t}];$(this).trigger("popup-menu",[i])});return c(i,null,{direction:"down",event:"popup-menu",addClass:"studymarket-strategies-filter"}),this._strategiesFilterType().subscribe(function(t){i.text({not_strategies:$.t("Indicators"),only_strategies:$.t("Strategies")}[t]||$.t("Indicators and Strategies"))},{callWithLast:!0}),"function"==typeof t&&this._strategiesFilterType().subscribe(t),i},r.prototype.prepareBasicPage=function(){var t=this,i=t.addPage(this._BASIC_STUDIES_PAGE_NAME,{packageName:this._BASIC_STUDIES_PACKAGE_NAME,technical:!e.enabled("plain_studymarket"),showTitle:!0,filterControl:this._backtestingEnabled&&this._getStrategiesFilterControl(t.resetBasicPage.bind(t))||null});this._basicPage=i,i.addClass("page-padded"),t.studiesReady.done(function(){t.resetBasicPage()}),t._options.selectBasicPage&&t.selectPage(this._BASIC_STUDIES_PAGE_NAME)},r.prototype.prepareCustomScriptPage=function(){var t=this,e="My Scripts",i=t.addPage(e,{packageName:this._CUSTOM_STUDIES_PACKAGE_NAME,technical:!0,showTitle:!0,filterControl:this._backtestingEnabled&&this._getStrategiesFilterControl(t.resetCustomScriptPage.bind(t))||null});i.addClass("page-padded"),t.studiesReady.done(function(){t.resetCustomScriptPage()})},r.prototype.preparePublishedScriptPage=function(){var t=this,e=$.t("Public Library"),i=t.addPage(e,{packageName:this._CUSTOM_STUDIES_PACKAGE_NAME,technical:!0,showTitle:!0,titleHref:"/script/",filterControl:this._backtestingEnabled&&this._getStrategiesFilterControl(t.resetPublishedScriptPage.bind(t))||null});i.addClass("page-padded"),t.studiesReady.done(function(){}),i.on("show-page",function(){t._onPublishedScriptPageShown()})},r.prototype._onPublishedScriptPageShown=function(){var t=this._getScriptType();this._pubSearchPageShown||(this._pubSearchPageShown=!0,this._pubslishedScriptsLoadMore(t))},r.prototype._pubslishedScriptsLoadMore=function(t){var e,i,o=this;this._pubslishedScriptsLoading||(e=this.getPage($.t("Public Library")),i=TradingView.unifiedSpinner("mini").spin(e.get(0)),this._pubslishedScriptsLoading=!0,this._loadNextPubSearchPage(t).done(function(){i.stop(),o.resetPublishedScriptPage(),o._pubslishedScriptsLoading=!1}))},r.prototype._applyStrategiesFilter=function(t){if(!this._backtestingEnabled)return t;var e=this._strategiesFilterType().value();return"not_strategies"!==e&&"only_strategies"!==e||(t=t.filter(function(t){var i=d.isScriptStrategy(t);return"not_strategies"===e?!i:i})),t},r.prototype.resetBasicPage=function(){var t,e=this.getPage(this._BASIC_STUDIES_PAGE_NAME);this._studies&&(t=this._studies[this._BASIC_STUDIES_PACKAGE_NAME]||[],t=this._applyStrategiesFilter(t),window.studyMarket.preparePageStudies(e,t))},r.prototype.resetCustomScriptPage=function(){var t,e,i,o;!this._options.minimized&&window.scriptLib&&this._studies&&(t=this.getPage("My Scripts"),e=this._studies.Script$USER||[],i=$.Deferred(),window.scriptLib&&e.length?window.scriptLib.requestUserScripts(function(t){var o,n,s,r;for(o=e.length;o--;)if(n=e[o].scriptIdPart){for(delete e[o].scriptName,s=null,r=t.length;r--;)if(t[r].scriptIdPart===n){s=t[r];break}s?e[o].scriptName=t[r].scriptName:e.splice(o,1)}else e.splice(o,1);i.resolve(e)}):i.resolve(e),o=this,i.done(function(e){return e.length?(e=o._applyStrategiesFilter(e),void window.studyMarket.preparePageStudies(t,e)):void window.studyMarket.appendTVScriptBtn(t)}))},r.prototype._createPublishedScriptMetaInfo=function(t){var e=this,i=e._chartWidgetCollection.activeChartWidget.value(),o=d.createMetaInfoStub(t,i.studyScriptingPkgVers);return o=new d(o),o.author=t.author,o.scriptName=t.scriptName,o.scriptDescription=t.description,o.agreeCount=t.agreeCount,o.imageUrl=t.imageUrl,o},r.prototype.resetPublishedScriptPage=function(){var t,e,i,o,n;if(!this._options.minimized&&this._pubSearchPageShown){if(t=this._getScriptType(),this._pubSearchCanLoad[t]&&this._pubSearchCount[t]<this._PUB_SEARCH_ENTRIES_ON_PAGE)return void this._pubslishedScriptsLoadMore(t);e=this,i=this.getPage($.t("Public Library")),o=this._pubSearchEntries.map(function(t){return e._createPublishedScriptMetaInfo(t)}),o=this._applyStrategiesFilter(o,"publishedScript"),e.preparePageStudies(i,o,null,!0),n=function(){e._pubslishedScriptsLoadMore(t)},e._w_pages.onScrollToEnd.unsubscribe(e,n),e._pubSearchCanLoad[t]&&e._w_pages.onScrollToEnd.subscribe(e,n)}},r.prototype.prepareFundamentalsPage=function(t,e){var i=this,o="Script$EDGR";t=this.addPage($.t("Fundamentals"),{packageName:o,showTitle:!0}),this.studiesReady.done(function(){function e(){function t(t){return r.indexOf(t)!==-1}function e(t){return g.filter(function(e){return t===e.id})[0]}var o,n,s=[],r=$.map(g,function(t){return t.id});for(o=0;o<i._options.popularFundamentals.length;o++)n=i._options.popularFundamentals[o],n.studies=n.studies.filter(t).map(e),n.studies.length&&s.push(n);return s}var n,s,r,a,l,h,c,d,p,u,_,f,g=this._studies[o];if("undefined"!==g){if(n=t,s=e(),t.addClass("page-with-popular"),s.length)for(n=$("<div></div>"),r=$("<div></div>"),a=$('<div><div class="column column-left"></div><div class="column column-right"></div></div>'),l=a.find(".column-left").css("width","50%"),h=a.find(".column-right").css("width","50%"),c=function(){var t,e=0;for(t=0;t<s.length;t++)e+=s[t].studies.length;return e}(),d=function(t){var e=$('<div class="insert-study-items"></div>');return i.fillStudies(e,t.studies,null),e.prepend('<div class="subgroup-header">'+t.name+"</div>"),e},t.append(r),r.append('<div class="header-container with-divider"><div class="group-header">'+$.t("All Metrics")+"</div></div>"),r.append(n),t.prepend(a),t.append(r),p=0,u=0;p<s.length;p++)_=s[p],f=d(_),u<c/2?l.append(f):h.append(f),u+=_.studies.length;this.preparePageStudies(n,g)}}.bind(this))},r.prototype.appendTVScriptBtn=function(t){var e,i=this;t&&(e=$('<br><a class="add-custom-script-btn"> '+$.t("Create your first script now!")+"</a>").on("click",function(t){i.hide(),TradingView.ScriptEditorWidget.open(),t.stopPropagation()}),t.empty(),t.append("<p>"+$.t("Welcome to the TradingView custom scripting engine. It allows you to create your own custom studies or modify existing. You do not have any scripts created.")+"</p>"),t.find("p").append(e))},r.prototype.appendPubScriptBtn=function(t){t&&t.html("<p>"+$.t("No public library scripts were found.")+"</p>")},r.prototype.prepareMarketPages=function(){this._options.hideMarketPages||this.studiesReady.done(function(){var t=this,e=this._market.order.map(function(e){return t._market.products[e]});e.sort(function(t,e){return t.name<e.name?-1:t.name>e.name?1:0}),e.forEach(function(t){var e="tv-volumebyprice"!==t.id,i={market:e,packageName:t.id,subProductIds:t.subproduct_ids||[]};t.$page=this.addPage(t.name,i),t.$page.addClass("offer-page")},this),this.selectPage(TVSettings.getValue(this._PAGE_KEY,this._basicPage)),this.marketPagesReady.resolve()}.bind(this))},r.prototype.addSearchPage=function(){var t,i,o,n,s=this;s._tabs.search=$('<div class="tv-chart-study-dialog-search-control"><div class="left-border"></div><div class="right-border"></div><input type="text" name="q" value="" autocomplete="off" placeholder="'+$.t("Search")+'"><div></div><a class="input-reset"></a></div>').data("title","search"),s._pages.search=$('<div class="page-search"></div>').data("title","search"),t=s._tabs.search.find("input"),i=s._tabs.search.find(".input-reset"),s._search_value=null,s._search_input=t,o=null,this._options.minimized?e.enabled("study_dialog_search_control")&&(o=this._widget.find(".insert-study-main"),o.css("border-top","none"),s._tabs.search.addClass("tv-chart-study-dialog-search-control--minimized")):o=this._widget.find(".insert-study-tabs"),o&&o.prepend(s._tabs.search),s._w_pages.prepend(s._pages.search),i.on("click",function(){t.val("").trigger("input").focus()}),t.focus(function(){s.search(t.val())}),t.on("input",function(){i.toggle(""!==this.value);var t=$(this);n&&clearTimeout(n),n=setTimeout(function(){n=void 0,s.search(t.val())},200)})},r.prototype.search=function(t,i,o){function n(t,e,i,o,n,s){t.push(e),t[t.length-1].matchPriority=o,n&&(t[t.length-1].matchIndex=i.match(s).index)}var s,r,a,l,h,c=this;(this._search_value!==t||i)&&(s=this._pages.search,r=[],a=function(t){return t.replace(/[!-\/[-^{-}]/g,"\\$&")},""!==t&&(l=t.split("").map(function(t,e){var i=a(t);return 0!==e&&(i="[/\\s-]"+i),"("+i+")"}).join("(.*?)")+"(.*)",r.push({fullMatch:RegExp("("+a(t)+")","i"),re:RegExp("^"+l,"i"),reserveRe:RegExp(l,"i"),fuzzyHighlight:!0}),t.toLowerCase()in this.DEFAULT_OPTIONS.searchKeywords&&r.push({re:this.DEFAULT_OPTIONS.searchKeywords[t.toLowerCase()],fuzzyHighlight:!1})),this._search_value=t,s.html(""),h=$.Deferred(),c._currentAsyncSearchDfd=h,e.enabled("plain_studymarket")?h.resolve([]):PublishedScript.suggest(t).done(function(t){var e=[];t&&t.results||[];h.resolve(e)}).fail(function(){h.resolve([])}),h.done(function(e){var i,o,a,l,d,p,u,_,f,g,m,v,y,b,w,S;if(c._currentAsyncSearchDfd===h){for(i=Object.keys(c._studies).concat(c._PUBLISHED_STUDIES_PACKAGE_NAME).sort(),o=[c._BASIC_STUDIES_PACKAGE_NAME,c._PUBLISHED_STUDIES_PACKAGE_NAME,c._CUSTOM_STUDIES_PACKAGE_NAME],a=o.length;a--;)l=o[a],d=i.indexOf(l),d!==-1&&(i.splice(d,1),i.unshift(l));for(p=0;p<i.length;p++){if(u=i[p],_=[],u===c._PUBLISHED_STUDIES_PACKAGE_NAME)_=e;else for(f=c._studies[u],a=0;a<f.length;a++)if(g=f[a],r.length)for(m=0;m<r.length;m++)v=r[m].re,v.lastIndex=0,y=r[m].fullMatch,b=g.shortDescription,b&&b.toLowerCase()===t.toLowerCase()?n(_,g,b,3,!0,y):b&&y.test(b)?n(_,g,b,2,!0,y):(b=g.description_localized||g.description||g.scriptName,y.test(b)?n(_,g,b,1,!0,y):v.test(b)&&n(_,g,b,0,!1,v));else _.push(g);if(_.length){switch(w=$('<div class="insert-study-items"><div>'),S=u,u){case c._BASIC_STUDIES_PACKAGE_NAME:S=c._BASIC_STUDIES_PAGE_NAME;break;case"Script$USER":S=$.t("My Scripts");break;case"Script$PUB":S=$.t("Public Library");break;default:u in c._packagesWithTabNames&&(S=c._packagesWithTabNames[S])}s.append('<div class="search-header">'+$.t(S)+"</div>"),s.append(w),r.length&&Array.prototype.sort.call(_,function(t,e){if(t.matchPriority<e.matchPriority)return 1;if(t.matchPriority>e.matchPriority)return-1;if(t.matchPriority===e.matchPriority)switch(t.matchIndex){case void 0:return 0;default:return t.matchIndex>e.matchIndex?1:t.matchIndex<e.matchIndex?-1:0}}),c.fillStudies(w,_,r)}}s.is(":has(li)")||s.is(":has(.not-found)")||s.append('<p class="not-found">'+$.t("No indicators matched your criteria.")+"</p>"),c.layoutChanged.fire()}})),o||this.selectPage("search")},r.prototype.updateSearchPage=function(){var t=this._search_input.val();this.search(t,!0,!0)},r.prototype.updateMarketPages=function(){$.when(this.marketPagesReady).done(function(){var t;this._market.order.forEach(function(e){if(t=this._market.products[e],pro.hasPackage(t.id)){var i=this._studies[t.id];i?this.preparePageStudies(t.$page,i,t):TradingView.logWarn("Subscripted study package "+t.id+" absent in metaInfo.")}else this.preparePageOffer(t.$page,t)},this)}.bind(this))},r.prototype.preparePageStudies=function(t,e,i,o){var n=$('<div class="insert-study-items"/>');t.empty(),t.append(n),i&&t.find(".insert-study-items").css({width:199,float:"left"}).end().append('<div class="insert-study-offer-container">'+pro.prepareProductPage(i)+"</div>"),o||(e=this.sortStudies(e)),this.fillStudies(n,e,null)},r.prototype.preparePageOffer=function(t,e){t.data("html",pro.prepareProductOfferPage(e)),t.data("offer",e)},r.prototype.addPage=function(t,e){var i,o,n,r,a,l,h;return e=$.extend({},e),i=$.t(t),o=t.toLowerCase(),n=$("<div></div>").data("title",o),r=$('<li title="'+i+'"></li>').text(i).data("title",o),a=e.filterControl instanceof jQuery,l=$(s.render('<div class="insert-study-header">{{#showTitle}}<div class="header-text">{{#technical}}'+$.t("Technical Analysis")+': {{/technical}}{{#titleHref}}<a href="{{titleHref}}" target="_blank"><u>{{title}}</u></a>{{/titleHref}}{{^titleHref}}{{title}}{{/titleHref}}{{#wikiHref}}<a href="{{wikiHref}}" target="_blank" class="_tv-dialogs-label-hint apply-common-tooltip" title="Wiki"></a>{{/wikiHref}}{{#filterControl}}<span class="filter-control-placeholder"></span>{{/filterControl}}</div>{{/showTitle}}</div>',{showTitle:e.showTitle,title:i,technical:e.technical,titleHref:e.titleHref,wikiHref:e.wikiHref,filterControl:a})).data("title",o).appendTo(this._w_headers).hide(),a&&l.find(".filter-control-placeholder").replaceWith(e.filterControl),
e.beta&&r.append('<span class="beta-sign">Beta</span>'),e.packageName&&(this._packagesWithTabNames[e.packageName]=t),this._pages[o]=n,this._tabs[o]=r,this._headers[o]=l,e.technical?(h=this._getOrCreateTechincalTab().find("ul"),h.append(r)):e.market?(h=this._getOrCreateMarketTab().find("ul"),h.append(r)):this._w_market_tabs?r.insertBefore(this._w_market_tabs):this._w_tabs.append(r),this._w_pages.append(n),n.toggle(o===this._currentPageTitle),n},r.prototype._getOrCreateMarketTab=function(){var t,e=this;return e._w_market_tabs?e._w_market_tabs:(t=TVSettings.getBool(e._MARKET_TAB_IS_OPEN_KEY,!0),e._w_market_tabs=$('<li class="tabs market-tabs"><div class="text open">'+$.t("Marketplace Add-ons")+"</div><ul></ul></li>"),e._w_tabs.append(e._w_market_tabs),e.toggleMarketTabs(t),e._w_market_tabs)},r.prototype._getOrCreateTechincalTab=function(){var t,e=this;return e._w_technical_tabs?e._w_technical_tabs:(t=TVSettings.getBool(e._TECHNICAL_TAB_IS_OPEN_KEY,!0),e._w_technical_tabs=$('<li class="tabs technical-tabs"><div class="text open">'+$.t("Technical Analysis")+"</div><ul></ul></li>"),e._w_tabs.append(e._w_technical_tabs),e.toggleTechnicalTabs(t),e._w_technical_tabs)},r.prototype.hide=function(){this._widget.hide(),this.visibilityChanged.fire(!1),TradingView.keyboardBinder.removeListener("StudyMarket");var t=TVDialogs.dialogs.indexOf(this._widget);t!==-1&&TVDialogs.dialogs.splice(t,1)},r.prototype.show=function(){this.init(),this._widget.show(),this._widget.css("z-index",TVDialogs.dialogs.length+110),this._widget.on("mousedownoutside",function(t){var e=$(t.target).parents().andSelf();e.is(".colorpicker, .charts-popup-list, .tvcolorpicker-popup, .symbol-edit-popup, ._tv-dialog-shadowbox, .fancybox-overlay")||(this._widget.unbind("mousedownoutside"),this.hide())}.bind(this)),this._widget.on("keyup.hideDialogStudy",function(t){27===t.which&&(this._widget.unbind("keyup.hideDialogStudy"),this.hide())}.bind(this)),this._clearInput(),this.loadFavorites(),this._scroll.scrollTo(0),this.updateLayout(!0),this.visibilityChanged.fire(!0),this.focusAddSymbolInput(this._currentPageTitle),TradingView.keyboardBinder.registerListener("StudyMarket",function(t){return!t.ctrlKey&&(47!==t.which&&(t.which&&13===t.which?(t.target===this._search_input.get(0)&&this._insertStudyByShortDescription(),!0):!!t.charCode&&(!(!t.which||t.which<=32)&&(!/^(input|textarea)$/i.test(t.target.tagName)&&(t.preventDefault(),!!(TradingView.onWidget()||this._options.minimized&&!e.enabled("study_dialog_search_control"))||(this._search_input.focus(),this._search_input[0].value=String.fromCharCode(t.charCode),!0))))))}.bind(this)),TVDialogs.dialogs.push(this._widget)},r.prototype.isVisible=function(){return!!this._initialized&&this._widget.is(":visible")},r.prototype.updateLayout=function(t){var i,o,n,s,r,a,l,h,c=this._widget.find(".insert-study-body");c.css("height",""),this._widget.css("width",""),i=TVDialogs.calcHeight(this._widget.height(),c.height()),c.height(i),TVDialogs.resizeContentWidth(this._widget.width(),this._widget),o=this._w_headers.outerHeight(!0),n=this._widget.find(".insert-study-main").height(),this._options.minimized&&e.enabled("study_dialog_search_control")&&(o+=this._tabs.search.height()),this._w_pages.height(n-o),s=Math.min($(window).height(),$("body").height()),r=$(window).width(),a=this._widget.outerWidth(),l=$("body").hasClass("on-cme-widget")?10:20,h=this._widget.height(),t&&this._widget.css({left:Math.max(0,r-a)/2,top:Math.max(l,s-h)/2})},r.prototype.getPage=function(t){return t=t.toLowerCase(),this._pages[t]},r.prototype.focusAddSymbolInput=function(t){t===this._ECONOMY_TAB.toLowerCase()&&this.addSymbolWidget.focus()},r.prototype.selectPage=function(t){var e,i,o,n,s;if(this.focusAddSymbolInput(t),e="","string"==typeof t?e=t.toLowerCase():t instanceof $&&(e=t.data("title")),this._currentPageTitle!==e)if(e in this._pages&&e in this._tabs&&("favorites"!==e||this.hasVisibleFavorites())){for(i in this._pages)o=e===i,n=this._pages[i],this._headers[i]&&this._headers[i].toggle(o),n.toggle(o),this._tabs[i].toggleClass("active",o),o&&(n.data("html")&&(n.html(n.data("html")),n.data("html",null)),n.trigger("show-page"),s=this._tabs[i].parents(".tabs"),s.is(".technical-tabs")?this.toggleTechnicalTabs(!0):s.is(".market-tabs")&&this.toggleMarketTabs(!0));this._currentPageTitle=e,this._w_pages.scrollTop(0),this.layoutChanged.fire(),TVSettings.setValue(this._PAGE_KEY,e)}else this.selectPage(this._basicPage)},r.prototype.attachHandlers=function(){function t(t){t.stopPropagation()}var i=Modernizr.touch?"touchend":"click",o=this;Modernizr.touch&&this._w_pages.on("touchstart",".insert-study-items li",function(t){o._touchStart=$.extend({},t.originalEvent.touches[0])}),this._w_tabs.on(i,"li",this.selectThisPage.bind(this)),this._w_tabs.on(i,"li.market-tabs",this.marketTabsClickHandler.bind(this)),this._w_tabs.on(i,"li.technical-tabs",this.technicalTabsClickHandler.bind(this)),this._w_tabs.on(i,"li.market-tabs ul, li.technical-tabs ul",function(t){t.stopPropagation()}),e.enabled("items_favoriting")&&(this._w_pages.on(i,".insert-study-items .fav",this.toggleItem.bind(this)),this.favsChanged.subscribe(this,this.updateFavorites)),this._w_pages.on(i,".insert-study-items .source",this.viewSourceCode.bind(this)),this._w_pages.on(i,".insert-study-items .open-chart-popup",this.openChartPopup.bind(this)),this._w_pages.on(i,".insert-study-items .delete",this.deleteScript.bind(this)),this._w_pages.on(i,".insert-study-items li a",function(t){t.stopPropagation()}),this._w_pages.on(i,".insert-study-items li",function(t){o._touchStart&&Math.abs(o._touchStart.screenY-t.originalEvent.changedTouches[0].screenY)>o._w_pages.find(".insert-study-items li")[0].clientHeight||o.insertThisStudy.call(o,t)}),this._widget.on(i,t),this._widget.on(i,".insert-study-subscribe-button",this.subscribePackage.bind(this)),this.layoutChanged.subscribe(this,this.updateLayout),loginStateChange.subscribe(this,this.onLoginStateChange),this._w_title.on(i,"a",this.hide.bind(this)),this._widget.on("click",".insert-study-offer-info-screenshots",function(t){t.currentTarget.getAttribute("data-fancybox-inited")||(t.currentTarget.setAttribute("data-fancybox-inited",!0),$(this).find("a").fancybox({type:"image",live:!1,afterShow:function(){$(".fancybox-overlay").on("click",function(t){t.stopPropagation()})}}),setTimeout(function(){$(t.target).click()},0)),t.preventDefault()})},r.prototype.selectThisPage=function(t){var e=$(t.currentTarget).data("title");e&&"search"!==e&&this.selectPage(e),t.stopPropagation()},r.prototype.toggleTabs=function(t,e,i){var o=this,n=e.find("ul"),s=e.find(".text"),r=function(){TVSettings.setValue(i,s.hasClass("open")),o.layoutChanged.fire(),o._w_tabs.height()<o._w_tabs_container.height()&&o._w_tabs.css("top","0"),o._scroll&&o._scroll.updateScroll()};"boolean"==typeof t?t?(n.is(":visible")?n.slideDown(50,r):(n.css("display","block"),r()),s.addClass("open")):(n.is(":visible")?n.slideUp(50,r):(n.css("display","none"),r()),s.removeClass("open")):(s.toggleClass("open"),n.slideToggle(50,r))},r.prototype.marketTabsClickHandler=function(t){t.stopPropagation(),this.toggleMarketTabs()},r.prototype.toggleMarketTabs=function(t){var e=this,i=this._w_market_tabs;this.toggleTabs(t,i,e._MARKET_TAB_IS_OPEN_KEY)},r.prototype.technicalTabsClickHandler=function(t){t.stopPropagation(),this.toggleTechnicalTabs()},r.prototype.toggleTechnicalTabs=function(t){var e=this,i=this._w_technical_tabs;this.toggleTabs(t,i,e._TECHNICAL_TAB_IS_OPEN_KEY)},r.prototype.toggleItem=function(t){var e=$(t.target).parent().data("study");return this.toggleFavorite(e.id),this.toggleEverywhere(e.id),!1},r.prototype.toggleEverywhere=function(t){var e=this.isFavorite(t);this._widget.find(".insert-study-items li").filter(function(e,i){var o=$(i).data("study");return!!o&&d.cutFullId(o.id)===t}).find(".fav").toggleClass("in-fav",e).attr("title",this.favTitle(e))},r.prototype.toggleFavorite=function(t){this.isFavorite(t)?this.removeFavorite(t):this.addFavorite(t)},r.prototype.isFavorite=function(t){var t=d.cutFullId(t);return this._favs.indexOf(t)!==-1},r.prototype.addFavorite=function(t){return t=d.cutFullId(t),!this.isFavorite(t)&&(this._favs.push(t),this.saveFavorites(),TVXWindowEvents.emit("StudyFavoritesChanged",JSON.stringify(this._favs)),this.favsChanged.fire(),!0)},r.prototype.removeFavorite=function(t){return t=d.cutFullId(t),!!this.isFavorite(t)&&(this._favs.splice(this._favs.indexOf(t),1),this.saveFavorites(),TVXWindowEvents.emit("StudyFavoritesChanged",JSON.stringify(this._favs)),this.favsChanged.fire(),!0)},r.prototype.updateFavorites=function(){var t,e,i,o,n,s,r,a,l,h,c=this.getVisibleFavorites();if(0===c.length)return"favorites"===this._currentPageTitle&&this.selectPage(this._basicPage),this._widget.find(".insert-study-items li .fav").removeClass("in-fav"),void this._tabs.favorites.hide();for(t=this,e=$.Deferred(),i=[],o=[],n=0;n<c.length;n++)if(s=c[n],r=t.getStudyPackageName({id:s}),r!==t._PUBLISHED_STUDIES_PACKAGE_NAME){for(l=t._studies[r]||[],h=0;h<l.length;h++)if(d.cutFullId(l[h].id)===s){i.push(l[h]);break}}else a=(/^Script\$([^@]+)/.exec(s)||0)[1],a&&o.push(a);!o.length||this._options.minimized?e.resolve(i):PublishedScript.info(o).done(function(e){var o,n;for(o=0;o<e.length;o++)n=e[o],i.push(t._createPublishedScriptMetaInfo(n))}).always(function(){e.resolve(i)}),e.done(function(e){e=t._applyStrategiesFilter(e),t.preparePageStudies(t._pages.favorites,e),t._widget.find(".insert-study-items li").find(".fav").removeClass("in-fav"),c.forEach(t.toggleEverywhere,t)}),this._tabs.favorites.show()},r.prototype.hasFavorites=function(){return!!this._favs.length},r.prototype.hasVisibleFavorites=function(){return!!this.getVisibleFavorites().length},r.prototype.getVisibleFavorites=function(){return this.checkExcludePackageStudies(this._favs)},r.prototype.viewSourceCode=function(t){t.stopPropagation(),this.hide();var e=$(t.target).parent().data("study");return this.studyIsPublishedScript(e)?void TradingView.ScriptEditorWidget.open({scriptIdPart:e.scriptIdPart,scriptSource:e.TVScriptSourceCode}):void window.scriptLib.requestBuiltinAndUserScripts(function(t){for(var i=t.length;i--;)if(t[i].scriptIdPart===e.scriptIdPart)return void TradingView.ScriptEditorWidget.open(t[i])})},r.prototype.openChartPopup=function(t){t.stopPropagation(),t.preventDefault();var e=$(t.target).parent().data("study");TradingView.historyManager.push(new HistoryManager.ChartPage(e.imageUrl,e.scriptName||e.description))},r.prototype.deleteScript=function(t){var e,i;t.stopPropagation(),t.preventDefault(),e=$(t.target).closest("li"),i=e.data("study"),TVDialogs.showConfirm($.t("Confirmation"),$.t("Do you really want to delete script '{0}'?").format(TradingView.cleanButAmpersand(i.scriptName||i.description)),function(){window.scriptLib.requestDeleteScript(i.scriptIdPart,function(){TradingView.logNormal("deleted"),e.remove()})})},r.prototype.checkExcludePackageStudies=function(t){var e=this;return t.filter(function(t){var i,o=this.getStudyPackageName({id:t});return o===this._PUBLISHED_STUDIES_PACKAGE_NAME||(i=e._studies[o]&&$.grep(e._studies[o],function(e){return t===e.id}).length>0,!!i&&(o===this._BASIC_STUDIES_PACKAGE_NAME||o===this._CUSTOM_STUDIES_PACKAGE_NAME||o===this._SCRIPTING_PACKAGE_NAME||"Script$EDGR"===o||pro.hasPackage(o)&&o in this._studies))},this)},r.prototype.sortStudies=function(t){return t.sort(function(t,e){return t=t.scriptName||t.description_localized||t.description,e=e.scriptName||e.description_localized||e.description,t>e?1:t<e?-1:0})},r.prototype.fillStudies=function(t,e,i){var o;t.empty(),e.forEach(function(e){e?o=this.createStudyListItem(e,i):(o=document.createElement("li"),o.className="placeholder"),t.append(o)},this)},r.prototype.createStudyListItem=function(t,o){var n,s,r,a,l,h,c,p,u,_,f,g,m,v,y,b,w,S=document.createElement("li");if($.data(S,"study",t),n=t.description_localized||$.t(t.scriptName||t.description||" ",{context:"study"}),s=this.isFavorite(t.id),r=[],o&&n)for(a=[],o instanceof RegExp?a.push({re:o,fuzzyHighlight:!1}):$.isArray(o)&&(a=o),l=0;l<a.length;l++)if(h=a[l].fullMatch,c=a[l].reserveRe,p=a[l].re,h.lastIndex=0,p.lastIndex=0,u=h.exec(n),u?a[l].fuzzyHighlight=!1:(u=p.exec(n),u||(u=c.exec(n)),a[l].fuzzyHighlight=!0),u)if(a[l].fuzzyHighlight)for(_=u.index,f=1;f<u.length;f++)g=u[f].length,f%2&&(r[_]=!0),_+=g;else for(m=0;m<u[0].length;m++)r[u.index+m]=!0;return v=TradingView.clean(n,!0),y=v.replace(/./g,function(t,e){if("<"===t?t="&lt;":"&"===t?t="&amp;":'"'===t&&(t="&quot;"),r[e]){if(" "===t||"-"===t||"/"===t)return r[e+1]=!0,t;t='<span class="match">'+t+"</span>"}return t}),b='<span class="text" title="'+TradingView.strip_tags(v)+'"">'+y+"</span>",e.enabled("items_favoriting")&&(b='<span class="fav'+(s?" in-fav":"")+' apply-common-tooltip" title="'+this.favTitle(s)+'"></span>'+b),t.author&&t.author.username&&(b+='<span class="author"><a href="/u/'+t.author.username+'" target="_blank">'+t.author.username+"</a></span>"),t.agreeCount&&(b+='<span class="agrees apply-common-tooltip" title="'+$.t("Total agrees")+'">'+t.agreeCount+" "+$.t("like",{count:t.agreeCount})+"</span>"),w=t.TVScriptSourceCode&&(0===t.id.indexOf(this._PUBLISHED_STUDIES_PACKAGE_NAME)||0===t.id.indexOf(this._CUSTOM_STUDIES_PACKAGE_NAME)),!TradingView.isMobileView&&w&&(S.className="custom-script",b+='<span class="source apply-common-tooltip" title="'+$.t("Source code")+'">{}</span>'),e.enabled("graying_disabled_tools_enabled")&&ChartApiInstance.studiesAccessController.isToolGrayed(t.description)&&(S.className+=" grayed"),void 0!==t.isCustomIndicator&&(S.className+=" custom-indicator"),t.imageUrl?b+='<div class="open-chart-popup apply-common-tooltip" title="'+$.t("Read more...")+'">...</div>':w&&window.scriptLib&&(b+='<div class="delete apply-common-tooltip" title="'+$.t("Delete script")+'"><i></i></div>'),S.innerHTML=b,d.isScriptStrategy(t)&&$(i(463)).attr({class:"strategy"}).insertAfter(S.querySelector(".text")),S},r.prototype.favTitle=function(t){return t?$.t("Remove from favorites"):$.t("Add to favorites")},r.prototype.insertThisStudy=function(t){var i,o=$(t.target).closest("li");if(!o.hasClass("placeholder"))return i=o.data("study"),e.enabled("graying_disabled_tools_enabled")&&ChartApiInstance.studiesAccessController.isToolGrayed(i.description)?void a.emit("onGrayedObjectClicked",{type:"study",name:i.description}):(o.highlight(this.HIGHLIGHT_STUDY_NUM_FLICKS),this.insertStudy(i),!1)},r.prototype.insertStudy=function(t){var e,i,o=this._chartWidgetCollection.activeChartWidget.value();o&&(e=o.insertStudyStub(t.description),i=d.replaceWithFullStudyMetaInfoAsync(o.model().studiesMetaData(),t),i.done(function(t){var i=o.removeStudyStub(e.id());i&&(o.insertStudyOrShowDialog(t),this._is_on_chart=!0)}.bind(this)),i.fail(function(t){TradingView.logError("Error: "+t),e.setStatus(t)}))},r.prototype.subscribePackage=function(t){var e=$(t.target).closest(".insert-study-pages > div").data("offer");e&&TradingView.visitPaymentPage(e.id)},r.prototype.onLoginStateChange=function(t){t||this.setUser(window.user)},r.prototype.getStudyList=function(t){function e(t){i.push(t)}var i,o;if(!this.studiesReady.isResolved())return[];i=[];for(o in this._studies)(o===this._BASIC_STUDIES_PACKAGE_NAME||pro.hasPackage(o))&&(this._studies[o].forEach(e),t&&i.push({separator:!0}));return t&&i.splice(i.length-1,1),i},r.prototype.getStudyPackageName=function(t){var e,i,o,n;if(t&&t.id)return e=d.getPackageName(t.id),e!==this._SCRIPTING_PACKAGE_NAME?e:(i=t.id.split("@"),o=i[0],0!==o.indexOf("Script$")&&0!==o.indexOf("StrategyScript$")?e:(n=o.indexOf("_"),n!==-1?o.substring(0,n):/^Script\$USER;/.test(o)?"Script$USER":/^Script\$PUB;/.test(o)?"Script$PUB":/^Script\$STD;/.test(o)?this._BASIC_STUDIES_PACKAGE_NAME:o))},r.prototype.studyIsUserTVScript=function(t){if(t&&t.id)return"Script$USER"===this.getStudyPackageName(t)},r.prototype.studyIsPublishedScript=function(t){if(t&&t.id)return"Script$PUB"===this.getStudyPackageName(t)},r.prototype.selectSearchPage=function(){this.selectPage("search"),this._clearInput()},r.prototype._insertStudyByShortDescription=function(){var t,e,i,o=this._search_value;for(o=o.trim(),t=this._studies[this._BASIC_STUDIES_PACKAGE_NAME],e=0;e<t.length;e++)if(i=t[e],i.shortDescription&&i.shortDescription.toUpperCase()===o.toUpperCase()){this.insertStudy(i);break}},r.prototype._clearInput=function(){this._search_input.val(""),"search"===this._currentPageTitle&&this._search_input.val("").trigger("input").focus()},r.prototype._getScriptType=function(){var t=this._strategiesFilterType().value();return"not_strategies"===t?1:"only_strategies"===t?2:0},r.prototype._pubSearchEntryAlreadyLoaded=function(t){var e=t.scriptIdPart.split(";")[1];return!(this._pubSearchCache.indexOf(e)<0)||(this._pubSearchCache.push(e),!1)},r.prototype._addPubSearchResult=function(t,e){if(t.length){var i=this;t.forEach(function(t){i._pubSearchEntryAlreadyLoaded(t)||(i._pubSearchEntries.push(t),i._pubSearchCount[t.scriptType]++)}),0===e&&(i._pubSearchCount[0]+=t.length),i._pubSearchEntries.sort(function(t,e){return e.agreeCount-t.agreeCount})}},r.prototype._getPublicLibraryRequestParams=function(t){var e=this._pubSearchCount[t],i=this._PUB_SEARCH_ENTRIES_ON_PAGE;return e<this._PUB_SEARCH_ENTRIES_ON_PAGE&&(i=this._PUB_SEARCH_ENTRIES_ON_PAGE-e),{offset:e,count:i,type:t}},r.prototype._loadNextPubSearchPage=function(t){var e=this;return e._pubSearchDfd?e._pubSearchDfd:(e._pubSearchDfd=$.ajax({url:"/pubscripts-library/",type:"GET",data:e._getPublicLibraryRequestParams(t),dataType:"json"}),e._pubSearchDfd.done(function(i){e._pubSearchCanLoad[t]=!!i.load_more,0!==t||i.load_more||e._pubSearchCanLoad.fill(!1),e._addPubSearchResult(i.results,t)}),e._pubSearchDfd.always(function(){delete e._pubSearchDfd}),e._pubSearchDfd)},r.prototype._onExternalFavoritesChanged=function(t){var e,i,o=[];for(e=0;e<t.length;e++)i=d.cutFullId(t[e]),o.indexOf(i)===-1&&o.push(i);this._favs=o,this.saveFavorites(),this.favsChanged.fire()},t.exports=r}).call(e,i(1),i(28),i(43),i(29))},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 8"><path fill="#595959" fill-rule="evenodd" d="M2.5 2L0 5h2v3h1V5h2zm5 4L5 3h2V0h1v3h2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="26" height="26"><path d="M16 4v7h-3v2h3v7h2v-2h3v-2h-3V4h-2zM7 6v12H4v2h3v2h2V10h3V8H9V6H7z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="26" height="26"><path d="M16 3v3h-2v12h2v5h1v-5h2V6h-2V3h-1zM9 4v5H7v11h2v3h1v-3h2V9h-2V4H9zm-1 6h3v9H8v-9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="26" height="26"><path d="M16 3v3h-2v12h2v5h1v-5h2V6h-2V3h-1zM9 4v5H7v11h2v3h1v-3h2V9h-2V4H9zm6 3h3v10h-3V7zm-7 3h3v9H8v-9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M142.5 447.4c-102.74 102.74-83.44 83.44 0 0m399-186.2l-70.9 94.6H370.1l-136 159.6-91.6-112.3-38.5 41.4L6.5 542l41.4 41.4 94.6-94.6 91.6 112.3 162.6-186.2h103.5l88.7-118.2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path d="M453.8 360.2l-92.1 6L234 517.7l-86.2-86.1L5.2 514.7v118.9h585.3V268.1z" opacity=".3"/><path d="M234 508.8c-156 222.067-78 111.033 0 0zm309-276.3l-71.3 95.1h-101L236.9 488l-92.1-112.9-38.6 41.6-101 98.1 41.6 41.6 95.1-95.1L234 574.2 397.4 387h104l89.1-118.9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="26" height="26"><path d="M16 3v3h-2v12h2v5h1v-5h2V6h-2V3h-1zM9 4v5H7v11h2v3h1v-3h2V9h-2V4H9z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="26" height="26"><path d="M12 4v6h3V4h-3zm3 6v6h3v-6h-3zm3 6v6h3v-6h-3zm-6-6H9v6h3v-6zm-3 6H6v6h3v-6zm4-11h1v4h-1V5zm-3 6h1v4h-1v-4zm-3 6h1v4H7v-4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="26" height="26"><path d="M12 2v9h3V2h-3zm3 9v12h3V11h-3zm-3 0H9v9h3v-9zm1-8h1.05v6.95H13V3zm-3 9h1v7h-1v-7z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="26" height="26"><path d="M7 4v17H5v-4H4v5h4V6h2v11h8l-.076-7H20v10h3V7h-8v7h-2V4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="26" height="26"><path d="M4 4v1h1v1h1v1H5v1H4v1h2V8h1v1h2V8H8V7H7V6h1V5h1V4H7v1H6V4H4zm12 0v1h1v1h1v1h-1v1h-1v1h2V8h1v1h2V8h-1V7h-1V6h1V5h1V4h-2v1h-1V4h-2zM4 10v1h1v1h1v1H5v1H4v1h2v-1h1v1h2v-1H8v-1H7v-1h1v-1h1v-1H7v1H6v-1H4zm7 0v1h-1v3h1v1h3v-1h1v-3h-1v-1h-3zm5 0v1h1v1h1v1h-1v1h-1v1h2v-1h1v1h2v-1h-1v-1h-1v-1h1v-1h1v-1h-2v1h-1v-1h-2zm-4 1h1v1h1v1h-1v1h-1v-1h-1v-1h1v-1zm-8 5v1h1v1h1v1H5v1H4v1h2v-1h1v1h2v-1H8v-1H7v-1h1v-1h1v-1H7v1H6v-1H4zm7 0v1h-1v3h1v1h3v-1h1v-3h-1v-1h-3zm1 1h1v1h1v1h-1v1h-1v-1h-1v-1h1v-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 11.5"><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>'},function(t,e,i){(function(e,o,n){"use strict";function s(t){function i(){var t=L.last();k.toolsGroupsHeight=t.offset().top+t.outerHeight(),$(window).resize()}var a,l,c,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k=this;t=t||{},this.options=t,h.init(),a=this._container=t.container,this._chartWidgetCollection=t.chartWidgetCollection,this._container.on("contextmenu",function(t){t.preventDefault()}),this._allToolGroups=[],this._toolsFilter=new s.ModernToolsFilter(t.drawingsAccess||{type:"black",tools:[]}),this.favorites=TVSettings.getJSON("chart.favoriteDrawings",[]),t.readOnly||(l=$("<div>").addClass("tools-group no-delimiter").appendTo(a),this._main=l,this.appendToolsGroup([{tool:"cursor",name:$.t("Cross")},{tool:"dot",name:$.t("Dot")},{tool:"arrow",name:$.t("Arrow")},{tool:"eraser",name:$.t("Eraser")}]),this.appendToolsGroup([{tool:"LineToolTrendLine",name:$.t("Trend Line")},{tool:"LineToolTrendAngle",name:$.t("Trend Angle")},{tool:"LineToolHorzLine",name:$.t("Horizontal Line"),shortcut:{keys:"Alt+H",immediately:!0}},{tool:"LineToolHorzRay",name:$.t("Horizontal Ray")},{tool:"LineToolVertLine",name:$.t("Vertical Line"),shortcut:{keys:"Alt+V",immediately:!0}},{tool:"LineToolArrow",name:$.t("Arrow")},{tool:"LineToolRay",name:$.t("Ray")},{tool:"LineToolExtended",name:$.t("Extended")},{tool:"LineToolParallelChannel",name:$.t("Parallel Channel")},{tool:"LineToolDisjointAngle",name:$.t("Disjoint Angle")},{tool:"LineToolFlatBottom",name:$.t("Flat Top/Bottom")}]),this.appendToolsGroup([{tool:"LineToolPitchfork",name:$.t("Pitchfork")},{tool:"LineToolSchiffPitchfork2",name:$.t("Schiff Pitchfork")},{tool:"LineToolSchiffPitchfork",name:$.t("Modified Schiff Pitchfork")},{tool:"LineToolInsidePitchfork",name:$.t("Inside Pitchfork")},{tool:"LineToolPitchfan",name:$.t("Pitchfan")},{tool:"LineToolGannSquare",name:$.t("Gann Box")},{tool:"LineToolGannComplex",name:$.t("Gann Square")},{tool:"LineToolGannFan",name:$.t("Gann Fan")},{tool:"LineToolFibRetracement",name:$.t("Fib Retracement")},{tool:"LineToolTrendBasedFibExtension",name:$.t("Trend-Based Fib Extension")},{tool:"LineToolFibSpeedResistanceFan",name:$.t("Fib Speed Resistance Fan")},{tool:"LineToolFibTimeZone",name:$.t("Fib Time Zone")},{tool:"LineToolTrendBasedFibTime",name:$.t("Trend-Based Fib Time")},{tool:"LineToolFibCircles",name:$.t("Fib Circles")},{tool:"LineToolFibSpiral",name:$.t("Fib Spiral")},{tool:"LineToolFibSpeedResistanceArcs",name:$.t("Fib Speed Resistance Arcs")},{tool:"LineToolFibWedge",name:$.t("Fib Wedge")},{tool:"LineToolFibChannel",name:$.t("Fib Channel")}]),this.appendToolsGroup([{tool:"LineToolBrush",name:$.t("Brush")},{tool:"LineToolRectangle",name:$.t("Rectangle")},{tool:"LineToolRotatedRectangle",name:$.t("Rotated Rectangle")},{tool:"LineToolEllipse",name:$.t("Ellipse")},{tool:"LineToolTriangle",name:$.t("Triangle")},{tool:"LineToolPolyline",name:$.t("Polyline")},{tool:"LineToolBezierQuadro",name:$.t("Curve")},{tool:"LineToolBezierCubic",name:$.t("Double Curve")},{tool:"LineToolArc",name:$.t("Arc")}]),this.appendToolsGroup([{tool:"LineToolText",name:$.t("Text")},{tool:"LineToolTextAbsolute",name:$.t("Anchored Text")},{tool:"LineToolNote",name:$.t("Note")},{tool:"LineToolNoteAbsolute",name:$.t("Anchored Note")},{tool:"LineToolCallout",name:$.t("Callout")},{tool:"LineToolBalloon",name:$.t("Balloon")},{tool:"LineToolPriceLabel",name:$.t("Price Label")},{tool:"LineToolArrowMarkLeft",name:$.t("Arrow Mark Left")},{tool:"LineToolArrowMarkRight",name:$.t("Arrow Mark Right")},{tool:"LineToolArrowMarkUp",name:$.t("Arrow Mark Up")},{tool:"LineToolArrowMarkDown",name:$.t("Arrow Mark Down")},{tool:"LineToolFlagMark",name:$.t("Flag Mark")}]),this.appendToolsGroup([{tool:"LineTool5PointsPattern",name:$.t("XABCD Pattern")},{tool:"LineToolCypherPattern",name:$.t("Cypher Pattern")},{tool:"LineToolABCD",name:$.t("ABCD Pattern")},{tool:"LineToolTrianglePattern",name:$.t("Triangle Pattern")},{tool:"LineToolThreeDrivers",name:$.t("Three Drives Pattern")},{tool:"LineToolHeadAndShoulders",name:$.t("Head & Shoulders")},{tool:"LineToolElliottImpulse",name:$.t("Elliott Impulse Wave (12345)")},{tool:"LineToolElliottTriangle",name:$.t("Elliott Triangle Wave (ABCDE)")},{tool:"LineToolElliottTripleCombo",name:$.t("Elliott Triple Combo Wave (WXYXZ)")},{tool:"LineToolElliottCorrection",name:$.t("Elliott Correction Wave (ABC)")},{tool:"LineToolElliottDoubleCombo",name:$.t("Elliott Double Combo Wave (WXY)")},{tool:"LineToolCircleLines",name:$.t("Cyclic Lines")},{tool:"LineToolTimeCycles",name:$.t("Time Cycles")},{tool:"LineToolSineLine",name:$.t("Sine Line")}]),this.appendToolsGroup([{tool:"LineToolRiskRewardLong",name:$.t("Long Position")},{tool:"LineToolRiskRewardShort",name:$.t("Short Position")},{tool:"LineToolPrediction",name:$.t("Forecast")},{tool:"LineToolDateRange",name:$.t("Date Range")},{tool:"LineToolPriceRange",name:$.t("Price Range")},{tool:"LineToolDateAndPriceRange",name:$.t("Date and Price Range")},{tool:"LineToolBarsPattern",name:$.t("Bars Pattern")},{tool:"LineToolGhostFeed",name:$.t("Ghost Feed")},{tool:"LineToolProjection",name:$.t("Projection")}]),this._toolsFilter.isToolEnabled("Font Icons")&&(c=new this.Button(this.createIconActions(),{addClass:"font-awesome line-tool-icons-popup",buttonClass:"font-awesome"},!0),this._icons=c,l.append(c.element()),this._allToolGroups.push(c)),TradingView.isMobileView||(p=$("<div>").addClass("tools-group").appendTo(a),u=new this.Button({tool:"zoom",name:"Zoom In",action:function(){h.tool.setValue("zoom")}}),p.append(u.element()),this._allToolGroups.push(u),k._chartWidgetCollection&&(_=new this.Button({tool:"zoom-out",name:"Zoom Out",action:function(){var t,e=k._chartWidgetCollection;e&&(t=e.activeChartWidget.value().model(),t&&t.zoomFromViewport())}}),p.append(_.element()),_.element().addClass("js-hidden"),function(){function t(){var i=k._chartWidgetCollection.activeChartWidget.value(),o=i.model(),n=!1;o?(e!==o&&(e&&e.zoomStack().onChange().unsubscribe(null,t),o.zoomStack().onChange().subscribe(null,t),e=o),n=!o.zoomStack().isEmpty()):i.withModel(null,t),_.element().toggleClass("js-hidden",!n)}var e=null;k._chartWidgetCollection.activeChartWidget.subscribe(t,{callWithLast:!0})}()),f=new this.Button({tool:"measure",name:"Measure (Shift + Click on the chart)",action:function(){h.tool.setValue("measure")}}),p.append(f.element()),this._allToolGroups.push(f)),g=$("<div>").addClass("tools-group").appendTo(a),m=!!h.properties().magnet.value(),v=new this.Button({tool:"magnet",name:"Magnet Mode",action:this.ToolbarActions.magnet.bind(this)}),this.magnet=v,g.append(v.element()),v.activate(m),h.properties().magnet.subscribe(this,function(t){v.activate(t.value())}),(!t.onWidget&&!TradingView.isMobileView||e.enabled("charting_library_base"))&&(m=!!h.properties().stayInDrawingMode.value(),y=new this.Button({tool:"drawginmode",name:"Stay in Drawing Mode",action:this.ToolbarActions.drawingmode.bind(this)}),this.drawingmode=y,g.append(y.element()),y.activate(m),h.properties().stayInDrawingMode.subscribe(this,function(t){y.activate(t.value())}),m=!!h.lockDrawings().value(),b=new this.Button({tool:"lockAllDrawings",name:"Lock All Drawing Tools",action:this.ToolbarActions.lockDrawings.bind(this)}),this.lockDrawings=b,g.append(b.element()),b.activate(m),h.lockDrawings().subscribe(this,function(t){b.activate(t.value())}),m=!!h.hideAllDrawings().value(),w=new this.Button({tool:"hideAllDrawings",name:"Hide All Drawing Tools",action:this.ToolbarActions.hideAllDrawings.bind(this)}),this.hideAllDrawings=w,g.append(w.element()),w.activate(m),h.hideAllDrawings().subscribe(this,function(t){w.activate(t.value())}),e.enabled("support_multicharts")&&(m=!!h.drawOnAllCharts().value(),S=new this.Button({tool:"SyncDrawing",name:$.t("Sync drawings to all charts"),action:this.ToolbarActions.drawAllCharts.bind(this)}),this.drawOnAllCharts=S,g.append(S.element()),S.activate(m),h.drawOnAllCharts().subscribe(this,function(t){S.activate(t.value())})),T=$("<div>").addClass("tools-group").appendTo(a),this.removeAndObjectsTreeTools=T,C=new this.Button({tool:"showObjectsTree",name:$.t("Show Objects Tree"),action:this.ToolbarActions.showObjectsTree.bind(this)}),this.showObjectsTree=C,T.append(C.element()),x=new this.Button({tool:"removeAllDrawingTools",name:"Remove All Drawing Tools",action:this.ToolbarActions.removeTools.bind(this)}),this.removeTools=x,T.append(x.element()),P=$("<div>").addClass("tools-group no-delimiter").appendTo(a),this.responsiveToolbar=new this.ResponsiveToolbar(this),P.append(this.responsiveToolbar.getButton().element())),this._favoritesEvent=new o,this._favoritesEvent.subscribe(this,function(t){~["add","remove","reorder"].indexOf(t)&&TVSettings.setJSON("chart.favoriteDrawings",this.favorites.map(function(t){return{tool:t.drawing.tool}}))}),t.onWidget||(this.favorites=this.favorites.filter(function(t){return!!t.drawing}),this.favoriteDrawingToolbar=new r(this))),t.readOnly||h.tool.subscribe(function(t){this._syncView(t)}.bind(this),{callWithLast:!0}),$(document).bind("keydown","esc",function(){h.resetToCursor(!0)}),this._twoColumnLayout=!1,(!t.onWidget&&!TradingView.isMobileView||e.enabled("charting_library_base"))&&(L=a.find(".tools-group"),window.loaded?i():$(window).load(i),$(window).on("resize",this.updateToolsVisibility.bind(this))),this.visible=new n,this.visible.subscribe(this,function(t){this._fold(!t.value()),this.$panelClose&&this.$panelClose.prop("title",this.getVisibilityChangeText(t.value())),TVSettings.setValue("ChartSideToolbarWidget.visible",t.value())}),this.visible.setValue("boolean"==typeof t.forceVisible?t.forceVisible:TVSettings.getBool("ChartSideToolbarWidget.visible",!0)),this.$panelClose=$('<a href="#" class="tv-close-panel left" title="'+this.getVisibilityChangeText(this.visible.value())+'"></a>'),this.$panelClose.on("click",function(t){var e,i=this.activeChartWidget().model();i&&(e=this.visible.value(),this.$panelClose.prop("title",this.getVisibilityChangeText(!e)),i.setProperty(this.visible,!e,this.getVisibilityChangeText(e)),d.emit("toggle_sidebar",!e),t.preventDefault())}.bind(this)).appendTo(a),t.onResize&&(this.onResize=t.onResize),$(window).on("resize",this.updateLayout.bind(this))}var r=i(476),a=i(179),l=i(142),h=i(81),c=i(343),d=i(38),p=i(55).bindPopupMenu,u=i(80).saveDefaultProperties;s.prototype.updateToolsVisibility=function(){var t=$(window).height()<this.toolsGroupsHeight+10;t!==this._twoColumnLayout&&(this.magnet.element().toggleClass("js-hidden",t),this.drawingmode.element().toggleClass("js-hidden",t),this.lockDrawings.element().toggleClass("js-hidden",t),this.hideAllDrawings.element().toggleClass("js-hidden",t),
this.drawOnAllCharts&&this.drawOnAllCharts.element().toggleClass("js-hidden",t),this.showObjectsTree.element().toggleClass("js-hidden",t),this.removeTools.element().toggleClass("js-hidden",t),this.removeAndObjectsTreeTools.toggleClass("js-hidden",t),this.responsiveToolbar.getButton().element().toggleClass("js-hidden",!t),this._twoColumnLayout=t)},s.prototype.updateLayout=function(){this.onResize&&this.onResize(this._container)},s.prototype.appendToolsGroup=function(t){var e,i=this.filterEnabledTools(this.extendTools(t));i.length>0&&(e=new this.Button(i),this._main.append(e.element()),this._allToolGroups.push(e))},s.prototype.filterEnabledTools=function(t){return t.filter(function(t){return this._toolsFilter.isToolEnabled(t.name)},this)},s.prototype.element=function(){return this._container},s.prototype._syncView=function(t){var e,i,o,n;if(this._allToolGroups)for(e=this._allToolGroups.length;e--;)if(i=this._allToolGroups[e],i.textAsIcon)i.activate("LineToolIcon"===t);else{for(o=!1,n=i.tools.length;n--;)i.tools[n].tool===t&&(i.setCurrent(n),o=!0);i.activate(o)}},s.prototype.activeChartWidget=function(){return this._chartWidgetCollection.activeChartWidget.value()},s.prototype.extendTools=function(t){var e=this,i=this._addToFavorite.bind(this),o=e._removeFromFavorite.bind(this),n=this.favorites.reduce(function(t,e){return t.push(e.tool),t},[]);return $.map(t,function(t){var s,r={tool:t.tool,name:t.name,localizedName:$.t(t.name),addClass:e._toolsFilter.isToolGrayed(t.name)&&" grayed",shortcut:t.shortcut,action:function(){h.tool.value()!==t.tool&&(TradingView.supportTouch()&&e._chartWidgetCollection.selectedSource.value()&&e.activeChartWidget().model().lineBeingCreated()&&e.activeChartWidget().model().cancelCreatingLine(),h.tool.setValue(t.tool))},favOptions:{allowMakeFavorite:!e.options.onWidget,addToFavorite:i,removeFromFavorite:o}},a=!!~n.indexOf(t.tool);if(a)for(s=0;s<e.favorites.length;s++)e.favorites[s].tool===t.tool&&(e.favorites[s].drawing=r);return r.favOptions.isFavorite=a,t.shortcut&&l.bind(t.shortcut.keys,function(i){return i.preventDefault(),t.shortcut.immediately?e.activeChartWidget().activePaneWidget&&e.activeChartWidget().activePaneWidget.drawRightThere(t.tool):r.action(),!1}),r})},s.prototype._addToFavorite=function(t){t.favOptions.isFavorite=!0;var e={drawing:t,tool:t.tool};this.favorites.push(e),this._favoritesEvent.fire("add",e)},s.prototype._removeFromFavorite=function(t){t.favOptions.isFavorite=!1;for(var e=0;e<this.favorites.length;e++)this.favorites[e].drawing.tool===t.tool&&(this.favorites.splice(e,1),this._favoritesEvent.fire("remove",t))},s.prototype.createIconActions=function(t){var e=this,i=a.availIcons,o=TVSettings.getJSON("linetoolicon.recenticons");return o&&(i=o.concat(["separator"]).concat(i)),$.map(i,function(t){return"separator"===t?{separator:!0}:{tool:"LineToolIcon",name:String.fromCharCode(t),addClass:e._toolsFilter.isToolGrayed("Font Icons")&&" grayed",action:function(){var i,o,n=defaults("linetoolicon");n.icon=t,TradingView.saveDefaults("linetoolicon",n),h.tool.setValue("LineToolIcon"),e._icons.setTools(e.createIconActions()),i=TVSettings.getJSON("linetoolicon.recenticons")||[],o=10,i=$.grep(i,function(e){return e!==t}),i.unshift(t),i.length>o&&(i=i.slice(0,o)),TVSettings.setJSON("linetoolicon.recenticons",i)}}})},s.prototype.changeTool=function(t){t?this._chartWidget.setCurrentTool(t):this._chartWidget.setCurrentTool(this._chartWidget.currentCursorTool())},s.prototype._fold=function(t){t=!!t;var e=this._container;e.toggleClass("hidden",t),$(window).resize()},s.prototype.getVisibilityChangeText=function(t){return t?$.t("Hide Drawings Toolbar"):$.t("Show Drawings Toolbar")},s.prototype.Button=function(t,e,o){t=Array.isArray(t)?t:[t],this.isGroup=t.length>1,this.textAsIcon=o,this.setTools(t),this._e=$("<span>").addClass("button").addClass("apply-common-tooltip common-tooltip-vertical"),this._main=$("<span>").addClass("main"),o&&(this._main.addClass("text-as-icon"),this._main.text(this._firstNonGrayedTool().localizedName)),this.isGroup&&(this._side=$("<span>").addClass("side").append($(i(477)).attr({width:3,height:6})),this._e.addClass("subgroup"));var n=o?$.t("Icon"):this.tools[0].localizedName;this._e.append(this._main).attr("title",n).append(this._side),this.isGroup&&(e=$.extend({direction:TradingView.isMobileView?"up":"right",event:"button-popup",addClass:"drawings-popup-list favored-list",reverse:!1,popupSpacing:TradingView.isMobileView?15:4,svg:!o,listInner:!0,listTable:!0,wrapIcon:!0},e||{}),o||(e.addClass+=" iconed"),"function"==typeof TradingView.setWidgetLogoOverlayVisibility&&(this._e.on(e.event,function(){TradingView.setWidgetLogoOverlayVisibility(!1)}),e.onRemove=function(){TradingView.setWidgetLogoOverlayVisibility(!0)}),p(this._e,null,e)),this.activated=t.activated||!1,this.setCurrent(this.tools.indexOf(this._firstNonGrayedTool())),this.isGroup?(Modernizr.touch?(this._main.bind("touchstart",$.proxy(this,"_startclick")),this._main.bind("touchend",$.proxy(this,"_stopclick"))):(this._main.mousedown($.proxy(this,"_startclick")),this._main.mouseup($.proxy(this,"_stopclick"))),this._side.click($.proxy(this,"_submenu")),this._e.click(function(){return!1})):this._e.click($.proxy(this,"action"))},s.prototype.Button.prototype.toggle=function(){switch(this.element().css("display")){case"none":this.element().css("display","block");break;case"block":this.element().css("display","none")}},s.prototype.Button.prototype._isToolGrayed=function(t){return t.addClass&&t.addClass.indexOf("grayed")>-1},s.prototype.Button.prototype._firstNonGrayedTool=function(){var t,e;for(t=0;t<this.tools.length;++t)if(e=this.tools[t],!this._isToolGrayed(e)&&!e.separator)return e;return this.tools[0]},s.prototype.Button.prototype.element=function(){return this._e},s.prototype.Button.prototype.setTools=function(t){if(Array.isArray(t)){var e=this;this.tools=$.map(t,$.proxy(function(t,i){return t.separator?{separator:!0}:{icon:e.textAsIcon?t.name:t.tool,name:t.name,shortcut:t.shortcut,localizedName:t.localizedName||$.t(t.name),tool:t.tool,addClass:t.addClass,action:"function"==typeof t.action?t.action:e._defaultAction,favOptions:t.favOptions}},this))}},s.prototype.Button.prototype._setIcon=function(t){var e=$(c[t]).attr({width:30,height:30});this._main.empty().append(e)},s.prototype.Button.prototype._setTextAsIcon=function(t){this._main.text(t)},s.prototype.Button.prototype.setIcon=function(t){this.icon=t,this.textAsIcon?this._setTextAsIcon(t):this._setIcon(t)},s.prototype.Button.prototype._getPopupMenuItems=function(){function t(t){return t?$.t("Remove from favorites"):$.t("Add to favorites")}var e=this;return $.map(this.tools,function(o,n){var s,r;return o.separator?o:(s=function(){e._isToolGrayed(o)?d.emit("onGrayedObjectClicked",{type:"drawing",name:o.name}):(e.setCurrent(n),o.action.call(e,o),$(document).trigger("click"),$(document).trigger("touch"))},!e.textAsIcon&&o.favOptions.allowMakeFavorite&&(r=$('<span class="to-quick" title="'+t(o.favOptions.isFavorite)+'"></span>').append($(i(60)).attr({width:16,height:16})).toggleClass("quicked",!!o.favOptions.isFavorite)),{title:""+o.localizedName,action:s,shortcut:o.shortcut,active:n===e.current,svg:!e.textAsIcon&&$(c[o.icon]).attr({width:30,height:30}),addClass:o.addClass,buttons:e.textAsIcon||!o.favOptions.allowMakeFavorite?void 0:[{el:r,handler:function(e){o.favOptions.isFavorite?(o.favOptions.removeFromFavorite(o),r.removeClass("quicked").attr("title",t(!1))):(o.favOptions.addToFavorite(o),r.addClass("quicked").attr("title",t(!0))),e.stopPropagation(),e.preventDefault()}}]})})},s.prototype.Button.prototype._defaultAction=function(){this.activate()},s.prototype.Button.prototype._startclick=function(){this._e.hasClass("active")?($(document).trigger("click"),this.action()):this._delay=setTimeout($.proxy(function(){this._delay=null,this.openSubmenu()},this),200)},s.prototype.Button.prototype._stopclick=function(){this._delay&&(clearTimeout(this._delay),this._delay=null,this.action())},s.prototype.Button.prototype._submenu=function(){return this._e.hasClass("active")?void $(document).trigger("click"):void this.openSubmenu()},s.prototype.Button.prototype.activate=function(t){t=void 0===t||!!t,this.activated=t,t?this._e.addClass("selected"):this._e.removeClass("selected"),this.textAsIcon||this._setIcon(this.icon)},s.prototype.Button.prototype.action=function(){var t=this.getCurrent();this._isToolGrayed(t)?d.emit("onGrayedObjectClicked",{type:"drawing",name:t.name}):t.action.call(this,t)},s.prototype.Button.prototype.openSubmenu=function(){this._e.trigger("button-popup",[this._getPopupMenuItems()])},s.prototype.Button.prototype.setCurrent=function(t){if(t>=0&&t<this.tools.length){var e=this.tools[t];this.setIcon(e.icon),this._isToolGrayed(e)?this._e.find(".main").addClass(" grayed"):this._e.find(".main").removeClass(" grayed"),this.isGroup&&!this.textAsIcon&&this._e.attr("title",e.localizedName),this.current=t}},s.prototype.Button.prototype.getCurrent=function(){return this.tools[this.current]},s.prototype.Button.prototype.setCurrentTool=function(t,e){var i,o=this;"LineToolIcon"===t?(i=String.fromCharCode(defaults("linetoolicon").icon),$.each(this.tools,function(t,e){if(e.icon===i)return o.setCurrent(t),o.activate(),!1})):$.each(this.tools,function(e,i){if(i.tool===t)return o.setCurrent(e),o.activate(),!1})},s.prototype.ResponsiveToolbar=function(t,e){this.initButton(t,e),this.initPopupMenu()},s.prototype.ResponsiveToolbar.prototype.initButton=function(t){this.button=new s.prototype.Button({tool:"group",name:$.t("Show Hidden Tools"),addClass:"block",action:function(){var e,i;this.button.activate(!this.button.activated),e=[this.getMenuItem("Magnet Mode",t.ToolbarActions.magnet.bind(t),t.magnet.activated),this.getMenuItem("Stay in Drawing Mode",t.ToolbarActions.drawingmode.bind(t),t.drawingmode.activated),this.getMenuItem("Lock All Drawing Tools",t.ToolbarActions.lockDrawings.bind(t),t.lockDrawings.activated),this.getMenuItem("Hide All Drawing Tools",t.ToolbarActions.hideAllDrawings.bind(t),t.hideAllDrawings.activated),t.drawOnAllCharts&&this.getMenuItem("Sync drawings to all charts",t.ToolbarActions.drawAllCharts.bind(t),t.drawOnAllCharts.activated),this.getSeparator(),this.getMenuItem("Show Objects Tree...",t.ToolbarActions.showObjectsTree.bind(t)),this.getMenuItem("Remove All Drawing Tools",t.ToolbarActions.removeTools.bind(t))],i=e.filter(function(t){return void 0!==t}),this.button.element().trigger("button-popup",[i])}.bind(this)}),this.button.element().addClass("js-hidden")},s.prototype.ResponsiveToolbar.prototype.getSeparator=function(){return{separator:!0}},s.prototype.ResponsiveToolbar.prototype.getMenuItem=function(t,e,i){return{title:$.t(t),action:e,addClass:this.getClass(i)}},s.prototype.ResponsiveToolbar.prototype.initPopupMenu=function(){p(this.button.element(),null,{direction:"right",event:"button-popup",reverse:!0,notCloseOnButtons:!0,onRemove:function(){this.button.activate(!1)}.bind(this)})},s.prototype.ResponsiveToolbar.prototype.getClass=function(t){var e="setting-hidden";return t&&(e+=" checked"),e},s.prototype.ResponsiveToolbar.prototype.getButton=function(){return this.button},s.prototype.ResponsiveToolbar.prototype.getButtonElement=function(){return this.button.element()},s.prototype.ToolbarActions={magnet:function(t){this.magnet.activate(!this.magnet.activated),u(!0),h.properties().magnet.setValue(this.magnet.activated),u(!1)},drawingmode:function(){this.drawingmode.activate(!this.drawingmode.activated),u(!0),h.properties().stayInDrawingMode.setValue(this.drawingmode.activated),u(!1)},lockDrawings:function(){this.lockDrawings.activate(!this.lockDrawings.activated),h.lockDrawings().setValue(this.lockDrawings.activated)},hideAllDrawings:function(){this.hideAllDrawings.activate(!this.hideAllDrawings.activated),h.hideAllDrawings().setValue(this.hideAllDrawings.activated)},drawAllCharts:function(){this.drawOnAllCharts.activate(!this.drawOnAllCharts.activated),u(!0),h.drawOnAllCharts().setValue(this.drawOnAllCharts.activated),u(!1)},showObjectsTree:function(){this.activeChartWidget().showSourceProperties()},removeTools:function(){this._chartWidgetCollection.activeChartWidget.value().model().removeAllDrawingTools()}},s.ModernToolsFilter=function(t){this._toolsAccess=t},s.ModernToolsFilter.prototype._findTool=function(t){var e,i,o=null;for(e=0;e<this._toolsAccess.tools.length;++e)if(i=this._toolsAccess.tools[e],i.name===t){o=i;break}return o},s.ModernToolsFilter.prototype.isToolEnabled=function(t){var e=this._findTool(t);return!(!e||!e.grayed)||("black"===this._toolsAccess.type?!e:!!e)},s.ModernToolsFilter.prototype.isToolGrayed=function(t){var e=this._findTool(t);return e&&e.grayed},t.exports=s}).call(e,i(1),i(28),i(69))},function(t,e,i){(function(e){"use strict";function o(t){this.drawingToolbar=t,this.tools=this.drawingToolbar.favorites,this.visibleProperty=new e(TVSettings.getBool("ChartFavoriteDrawingToolbarWidget.visible",!0)),this.visibleProperty.subscribe(this,function(t){this.toggle(t.value()),TVSettings.setValue("ChartFavoriteDrawingToolbarWidget.visible",t.value())}),this._attach(),this.visibleProperty.value()&&this.tools.length>0?this.show():this.init()}var n=i(141).Action,s=i(325),r=i(81);o.prototype._POSITION_KEY="chart.favoriteDrawingsPosition",o.prototype._attach=function(){this.drawingToolbar._favoritesEvent.subscribe(this,this._onEvent),r.tool.subscribe(function(){this._visible&&this.render()}.bind(this))},o.prototype._onEvent=function(t,e){this.tools=this.drawingToolbar.favorites,this._visible||this.visibleProperty.value()?this.tools.length>0?(this.render(),this._visible||this.showWidget(),this._updatePosition()):this.hideWidget():"add"===t&&this.tools.length>0&&this.setVisible(!0)},o.prototype.render=function(){this._$toolsContainer.empty();var t=r.tool.value();this.tools.forEach(function(e){var o,n,s;e.drawing&&(o=e.drawing.tool===t,n=$(i(343)[e.drawing.tool]).attr({width:30,height:30}),s=$('<span class="button apply-common-tooltip" />').attr("title",e.drawing.localizedName).append(n).toggleClass("active",o).on("click",function(){r.tool.value()===e.drawing.tool?r.resetToCursor():e.drawing.action.call(this.drawingToolbar,e.drawing)}),this._$toolsContainer.append(s))}.bind(this))},o.prototype.init=function(){var t,e,i;this._inited||(this._inited=!0,t=this,e=$('<div class="drawing-favorites-toolbar"><div class="drag-handler"><i></i></div></div>').css("position","absolute").addClass("js-hidden").draggable({handle:".drag-handler",stop:function(){TVSettings.setJSON(t._POSITION_KEY,e.offset())}}),$(window).resize(function(){t._visible&&t._updatePosition()}),e.on("contextmenu",function(e){e.preventDefault();var i=new n({text:$.t("Hide Favorite Drawings Toolbar")});i.callbacks().subscribe(null,function(){var e,i=t.drawingToolbar.activeChartWidget().model();i&&(e=!t.visibleProperty.value(),i.setProperty(t.visibleProperty,e,$.t("Hide Favorite Drawings Toolbar")))}),s.createMenu([i]).show(e)}),this._$widget=e,this._$toolsContainer=$('<div class="tools-group"/>').appendTo(e),this._$widget.appendTo(document.body),this._$toolsContainer.sortable({tolerance:"pointer",start:function(t,e){TradingView.Tooltip.hide(),i=e.item.index()},stop:function(t,e){var o=e.item.index();i!==o&&(this.tools.splice(o,0,this.tools.splice(i,1)[0]),this.drawingToolbar._favoritesEvent.fire("reorder"))}.bind(this)}))},o.prototype._updatePosition=function(){var t=this,e=this._$widget,i=$(window),o=i.height()-e.outerHeight(),n=i.width()-e.outerWidth(),s=TVSettings.getJSON(t._POSITION_KEY,{left:n/2,top:window.headerChartPanel.outerHeight()+61});s={top:Math.min(o,Math.max(s.top,0)),left:Math.min(n,Math.max(s.left,0))},e.css(s),e.draggable("option","containment",[0,0,n,o])},o.prototype.showWidget=function(){this._visible=!0,this.render(),this._$widget.removeClass("js-hidden"),this._updatePosition()},o.prototype.hideWidget=function(){this._$widget.addClass("js-hidden"),this._visible=!1},o.prototype.setVisible=function(t){this.visibleProperty.setValue(t)},o.prototype.toggle=function(t){t?this.show():this.hide()},o.prototype.show=function(){!this._visible&&this.tools.length>0&&(this.init(),this.showWidget())},o.prototype.hide=function(){this._visible&&this.hideWidget()},t.exports=o}).call(e,i(69))},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3.0000003 6" width="3" height="6"><path d="M0 0c-.04 1.99 0 4.61 0 6l3-3z"/></svg>'},function(t,e,i){(function(e,o){"use strict";function n(t){this._chartWidgetCollection=t,this._bindings=[],this.attachHandlers()}var s=i(262),r=s.PropertyPage,a=s.SimpleComboBinder,l=s.ColorBinding,h=i(236).BarsMarksContainer,c=i(74).LineDataSource,d=i(56).Combobox,p=i(81),u=i(263),_=i(55).bindPopupMenu,f=i(80).DefaultProperty;n.prototype._POSITION_KEY="properties_toolbar.position",n.prototype.activeChartWidget=function(){return this._chartWidgetCollection.activeChartWidget.value()},n.prototype.selectedSource=function(){return this._chartWidgetCollection.selectedSource.value()},n.prototype.init=function(){var t,e;this._inited||(this._inited=!0,t=this,e=$('<div class="properties-toolbar"><div class="drag-handler"><i></i></div></div>').css("position","absolute").addClass("js-hidden").draggable({handle:".drag-handler",stop:function(){TVSettings.setJSON(t._POSITION_KEY,e.offset())}}),$(window).resize(function(){t._visible&&t._updatePositoin()}),this._$widget=e,this._$templates=$('<div class="tools-group properties-tools-group">').css("display","inline-block").addClass("js-hidden").appendTo(e),this._$properties=$('<div class="tools-group properties-tools-group">').css("display","inline-block").addClass("js-hidden").appendTo(e),this._$sourceActions=$('<div class="tools-group">').css("display","inline-block").addClass("js-hidden").appendTo(e),this.createSourceActions(),this._$widget.appendTo(document.body))},n.prototype.attachHandlers=function(){p.tool.subscribe(function(t){this.onToolChanged(t)}.bind(this),{callWithLast:!0}),this._chartWidgetCollection.selectedSource.subscribe(function(t){this.onSourceChanged(t)}.bind(this))},n.prototype.onToolChanged=function(t,e){if(t&&t.toLowerCase().indexOf("linetool")!==-1){var e=e instanceof f?e:new f(t.toLowerCase());this.init(),this.hideSourceActions(),this.showPropertiesOf(t,e),this.showTemplatesOf({tool:t,properties:e}),this._updateVisibility()}else this.selectedSource()?this.onSourceChanged(this.selectedSource()):this.hide()},n.prototype.findSourceOnWidget=function(t){var e,i,o,n;for(e=0;e<this.activeChartWidget().model().panes().length;e++)for(i=this.activeChartWidget().model().panes()[e],o=i.orderedSources(),n=0;n<o.length;n++)if(o[n]===t)return o[n]},n.prototype.onSourceChanged=function(t){return t?void(t instanceof c&&!(t instanceof h)&&this.findSourceOnWidget(t)?(this.init(),!t.userEditEnabled()||"LineToolBrush"!==t.toolname&&this.activeChartWidget().model().lineBeingCreated()?this.hideSourceActions():this.showSourceActions(t),this.showPropertiesOf(t.getConstructor(),t.properties()),this.showTemplatesOf({source:t}),this._setupToggleLockButton(t),this._updateVisibility()):this.hide()):void this.hide()},n.prototype.showTemplatesOf=function(t){var i,o,n,s,r,a,l;e.enabled("line_tool_templates")&&(i=t.source,i?(o=i.getConstructor(),n=i.properties()):(o=t.tool,n=t.properties),this._$templates.addClass("js-hidden").empty(),s=this,r=function(t){i?(i.restoreTemplate(t),s.activeChartWidget().model().model().updateSource(this._linetool),s.onSourceChanged(i)):(n.merge(t),n.listeners().fire(this),n.saveDefaults(),s.onToolChanged(o,n))},a=new u(o,r,{buttonInner:$.t("Template")+' <span class="icon"></span>',defaultsCallback:function(){n.restoreFactoryDefaults(),s.showPropertiesOf(o,n)},saveAsText:$.t("Save Drawing Template As..."),applyDefaultText:$.t("Apply Default Drawing Template"),getDataForSaveAs:i?function(){return i.template()}:null}),l=a.createButton().attr("title",$.t("Templates")),this.templatesList=a,this._$templates.append(l),this.activeChartWidget()._options.onWidget&&!window.is_authenticated||!e.enabled("linetoolpropertieswidget_template_button")||this._$templates.removeClass("js-hidden"),this._templatesVisible=!0)},n.prototype.createSourceActions=function(){function t(t,e,i,o){var n=$("<div>").addClass("button apply-common-tooltip").attr("title",e).on("click",function(t){i(t)});return o&&n.append(o),n}var o,n,s,r=this,a=i(258),l=t("Settings",$.t("Settings"),function(){new a(r.selectedSource(),r.activeChartWidget().model()).show({onWidget:r.activeChartWidget()._options.onWidget})},$(i(479)).attr({width:15,height:15}).css({"margin-top":"8px"}));this.$zOrder=t("ZOrder",$.t("Visual Order"),function(){r.zOrderButtonHandler()},$(i(480)).attr({width:18,height:18}).css({"margin-top":"7px"})),this.$zOrder.addClass("with-arrow"),_(this.$zOrder,null,{direction:"down",event:"button-popup",reverse:!1,notCloseOnButtons:!0}),o=$.t("Clone"),e.enabled("datasource_copypaste")&&(o=o+", "+$.t("Copy")),e.enabled("support_multicharts")&&(o=o+", "+$.t("Sync")),this.$clone=t("Clone",o,function(){r.cloneButtonHandler()},$(i(481)).attr({width:18,height:18}).css({"margin-top":"7px"})),this.$clone.addClass("with-arrow"),_(this.$clone,null,{direction:"down",event:"button-popup",reverse:!1,notCloseOnButtons:!0}),this.$lock=t("Lock",$.t("Lock"),function(){r.activeChartWidget().toggleLockSelectedObject()},$(i(353)).attr({width:26,height:26}).css({"margin-top":"2px"})),this._lockChangeListener=function(t){r.$lock.toggleClass("active",t.value())},n=t("Hide",$.t("Hide"),function(){r.activeChartWidget().hideSelectedObject()},$(i(482)).attr({width:15,height:15}).css({"margin-top":"8px"})),s=t("Remove",$.t("Remove"),function(){r.activeChartWidget().removeSelectedSource()},$(i(483)).attr({width:20,height:20}).css({"margin-top":"5px"})),e.enabled("alerts")||this._$sourceActions.append(l,this.$zOrder,this.$clone,this.$lock,n,s)},n.prototype.zOrderButtonHandler=function(){this.$zOrder.hasClass("active")||this.$zOrder.trigger("button-popup",[this._getZOrderActions()])},n.prototype.cloneButtonHandler=function(){this.$clone.hasClass("active")||this.$clone.trigger("button-popup",[this._getCloneActions()])},n.prototype._getCloneActions=function(){var t=this.activeChartWidget().model(),i=this.selectedSource(),o=[];return i.properties().clonable.value()&&o.push({title:$.t("Clone"),action:function(){t.cloneLineTool(i)}}),e.enabled("datasource_copypaste")?(o.push({title:$.t("Copy"),shortcut:"Ctrl-C",action:function(){t.copySourceToClip(i)}}),e.enabled("support_multicharts")?(o.push({title:$.t("Sync"),action:function(){t.copyToOtherCharts(i)}}),o):o):o},n.prototype._getZOrderActions=function(){var t=[],e=this.selectedSource(),i=this.activeChartWidget().model(),o={title:$.t("Bring to Front"),action:function(){i.bringToFront(e)}},n={title:$.t("Send to Back"),action:function(){i.sendToBack(e)}},s={title:$.t("Bring Forward"),action:function(){i.changeZOrder(e,1)}},r={title:$.t("Send Backward"),action:function(){i.changeZOrder(e,-1)}},a=i.paneForSource(this.selectedSource()),l=a.getZOrderMinMax();return e.zorder()===l.minZOrder&&(n.disabled=!0,r.disabled=!0),e.zorder()===l.maxZOrder&&(s.disabled=!0,o.disabled=!0),t.push(o,n,s,r),t},n.prototype._getPossibleProperty=function(t){var e,i,o=[],s=this._defaultToolProperties(),r=!0,a=!1;for(e=0;e<s.length;e++)i=s[e],i.name in t?(r=!1,o.push(i)):i.divider&&(o.push(i),a=!0);return t.extendLeft||(o=o.map(function(t){return"leftEnd"===t.name&&(t.comboboxOptions=t.comboboxOptions.filter(function(t){return t.value!==n.LINE_EXTEND})),t})),t.extendRight||(o=o.map(function(t){return"rightEnd"===t.name&&(t.comboboxOptions=t.comboboxOptions.filter(function(t){return t.value!==n.LINE_EXTEND})),t})),2===o.length&&a&&(o=$.grep(o,function(t){return!t.divider})),r?[]:o},n.prototype.showPropertiesOf=function(t,e){var i,o,n,s,r;if(this._toolExceptionCases||(this._toolExceptionCases=this._createToolExceptionCases()),i=this._toolExceptionCases[t]||this._getPossibleProperty(e),this._$properties.empty(),this._propertiesVisible=!1,!i.length)return void this._$properties.addClass("js-hidden");for(o=0;o<i.length;o++)n=i[o],n.divider?this._$properties.append('<div class="divider"></div>'):(s=e[n.name],("function"!=typeof n.showIf||n.showIf(s,e))&&(r=new this.propertyControl(this,s,n,e),this._$properties.append(r.el),this._propertiesVisible=!0));this._$properties.toggleClass("js-hidden",!this._propertiesVisible)},n.prototype.showSourceActions=function(t){function e(i){n.$editAlert.addClass("js-hidden"),n.$addAlert.addClass("js-hidden"),t.canHasAlert()&&(i?n.$editAlert.removeClass("js-hidden"):n.$addAlert.removeClass("js-hidden")),t.hasAlert.subscribe(e,!0)}var i=TradingView.className((t||this.selectedSource()).constructor),o=this.activeChartWidget().model().model().isSingleInstanceLineTool(i),n=this;this.$clone.toggleClass("js-hidden",o),n.$editAlert&&n.$addAlert&&e(t.hasAlert.value()),this._$sourceActions.removeClass("js-hidden"),this._sourceActionsVisible=!0},n.prototype.hideSourceActions=function(){this._$sourceActions.addClass("js-hidden"),this._sourceActionsVisible=!1},n.prototype._updateVisibility=function(){this._propertiesVisible||this._sourceActionsVisible||this._templatesVisible?this._show():this.hide()},n.prototype.hide=function(){this._$widget&&this._$widget.addClass("js-hidden"),this._visible=!1},n.prototype._show=function(){this._$widget.removeClass("js-hidden"),this._updatePositoin(),this._visible=!0},n.prototype.refresh=function(){this.onSourceChanged(this.selectedSource())},n.prototype._setupToggleLockButton=function(t){t!==this._selectedSourceBk&&(this._selectedSourceBk&&this._selectedSourceBk.properties().frozen&&this._selectedSourceBk.properties().frozen.unsubscribe(this,this._lockChangeListener),t&&t.properties().frozen&&(t.properties().frozen.subscribe(this,this._lockChangeListener),this.$lock.toggleClass("active",t.properties().frozen.value())),this._selectedSourceBk=t)},n.prototype._updatePositoin=function(){var t=this,e=this._$widget,i=$(window),o=i.height()-e.outerHeight(),n=i.width()-e.outerWidth(),s=TVSettings.getJSON(t._POSITION_KEY,{left:n/2,top:window.headerChartPanel.outerHeight()+15});s={top:Math.min(o,Math.max(s.top,0)),left:Math.min(n,Math.max(s.left,0))},e.css(s),e.draggable("option","containment",[0,0,n,o])},n.prototype.bindControl=function(t){this._bindings.push(t)},n.prototype.clearBindings=function(t){for(var e=this._bindings.length;e--;)this._bindings[e].destroy();this._bindings.length=0},n.prototype.propertyControl=function(t,e,i,o){var n,s,h,c,p,u,_,f,g,m;e&&i&&t&&i.inputType&&("combobox"!==i.inputType||i.comboboxOptions||TradingView.logWarn('inputType combobox, needs "comboboxOptions" option'),this._toolbarWidget=t,n=i.inputType,"colorPicker"===n?(s=r.prototype.createColorPicker({addClass:"tv-colorpicker-icon"}),h=s.find("input"),i.iconSvgCode&&(c=$(i.iconSvgCode).attr({width:40,height:36}),c.on("click",function(t){h.data("tvcolorpicker")||h.focus()}),$(document).on("click",function(t){h.data("tvcolorpicker")?h.addClass("active"):h.removeClass("active")}),h.after(c)),t.bindControl(new l(s,e,!0,t.activeChartWidget().model(),null,this.getTransparency(i,o))),h.addClass("apply-common-tooltip")):"combobox"===n&&(u=!0,i.simple===!0?(p=$.map(i.comboboxOptions,function(t){return{value:t,html:'<div class="combobox-simple">'+t+"</div>"}}),u=!1):p=$.map(i.comboboxOptions,function(t){var e=$('<div class="combobox-icon"></div>');return e.append($(t.iconSvgCode).attr({width:32,height:25})),{value:t.value,html:e}}),_=new d(p,{horizontal:u}),f=0,g=1,m=41,s=_.render(),u&&s.find(".items").width(i.comboboxOptions.length*m+2*f+2*g-1),i.propertyProxy&&(e=i.propertyProxy(o,t.activeChartWidget().model())),t.bindControl(new a(_,e,null,!0,t.activeChartWidget().model())),s.addClass("apply-common-tooltip")),i.title&&s.attr("title",i.title),"string"==typeof i.addClass&&s.addClass(i.addClass),this.el=s)},n.prototype.propertyControl.prototype.getTransparency=function(t,e){if(t.transparency)return t.transparencyField?e[t.transparencyField].value():e.transparency.value()},n.prototype.createLineEndPropertyProxy=function(t,e){return function(i,s){var r,a;return r=i[e]&&i[e].value()?n.LINE_EXTEND:i[t].value(),a=new o(r),a.subscribe(this,function(o){var n=o.value();n<2?(s.beginUndoMacro(""),i[t].setValue(n),i[e]&&i[e].setValue(!1),s.endUndoMacro()):(s.beginUndoMacro(""),i[t].setValue(c.LINEEND_NORMAL),i[e]&&i[e].setValue(!0),s.endUndoMacro())}),a}},n.LINE_EXTEND=42,n.prototype._defaultToolProperties=function(){return[{name:"color",inputType:"colorPicker",iconSvgCode:i(484),title:$.t("Color")},{name:"linecolor",inputType:"colorPicker",iconSvgCode:i(484),title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",iconSvgCode:i(485),title:$.t("Background Color"),transparency:!0},{divider:!1},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,iconSvgCode:i(486)},{value:2,iconSvgCode:i(487)},{value:3,iconSvgCode:i(488)},{value:4,iconSvgCode:i(489)}],title:$.t("Width")},{name:"linestyle",title:$.t("Style"),inputType:"combobox",comboboxOptions:[{value:0,iconSvgCode:i(486)},{value:1,iconSvgCode:i(490)},{value:2,iconSvgCode:i(491)}]},{name:"leftEnd",title:$.t("Left End"),inputType:"combobox",comboboxOptions:[{value:c.LINEEND_NORMAL,iconSvgCode:i(492)},{value:c.LINEEND_ARROW,iconSvgCode:i(493)},{value:n.LINE_EXTEND,iconSvgCode:i(494)}],propertyProxy:this.createLineEndPropertyProxy("leftEnd","extendLeft")},{name:"rightEnd",title:$.t("Right End"),inputType:"combobox",comboboxOptions:[{value:c.LINEEND_NORMAL,iconSvgCode:i(495)},{value:c.LINEEND_ARROW,iconSvgCode:i(496)},{value:n.LINE_EXTEND,iconSvgCode:i(497)}],propertyProxy:this.createLineEndPropertyProxy("rightEnd","extendRight")}]},n.prototype._riskPropertiesExceptionCases=function(){return[{name:"textcolor",title:$.t("Text color"),inputType:"colorPicker",iconSvgCode:i(498)},{name:"profitBackground",title:$.t("Profit Background Color"),inputType:"colorPicker",iconSvgCode:i(485),transparency:!0,transparencyField:"profitBackgroundTransparency"},{name:"stopBackground",title:$.t("Stop Background Color"),inputType:"colorPicker",iconSvgCode:i(485),transparency:!0,transparencyField:"stopBackgroundTransparency"},{name:"linecolor",title:$.t("Border color"),inputType:"colorPicker",iconSvgCode:i(484)}]},n.prototype._elliottPropertiesExceptionCases=function(){return[{name:"color",inputType:"colorPicker",iconSvgCode:i(484)}]},n.prototype._rangeExceptionCases=function(){return[{name:"linecolor",inputType:"colorPicker",iconSvgCode:i(484),title:"Color"},{name:"backgroundColor",inputType:"colorPicker",iconSvgCode:i(485),title:"Background Color",transparency:!0,transparencyField:"backgroundTransparency"},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,iconSvgCode:i(486)},{value:2,iconSvgCode:i(487)},{value:3,iconSvgCode:i(488)},{value:4,iconSvgCode:i(489)}],title:"Width"}]},n.prototype._textPropertiesExceptionCases=function(){return[{name:"color",title:$.t("Text color"),inputType:"colorPicker",iconSvgCode:i(498)},{name:"backgroundColor",title:$.t("Background Color"),inputType:"colorPicker",iconSvgCode:i(485),showIf:function(t,e){return!e||!e.fillBackground||!!e.fillBackground.value()}},{name:"borderColor",title:$.t("Border Color"),inputType:"colorPicker",iconSvgCode:i(484)},{name:"bordercolor",title:$.t("Border Color"),inputType:"colorPicker",iconSvgCode:i(484)},{divider:!1},{name:"fontsize",title:$.t("Font Size"),inputType:"combobox",simple:!0,addClass:"simple fontsize-dropdown",comboboxOptions:[10,11,12,14,16,20,24,28,32,40]}]},n.prototype._notePropertiesExceptionCases=function(){return[{name:"markerColor",title:$.t("Marker Color"),inputType:"colorPicker",iconSvgCode:i(484)},{name:"textColor",title:$.t("Text color"),inputType:"colorPicker",iconSvgCode:i(498)},{divider:!1},{name:"fontSize",title:$.t("Font Size"),inputType:"combobox",simple:!0,addClass:"simple fontsize-dropdown",comboboxOptions:[10,11,12,14,16,20,24,28,32,40]}]},n.prototype._brushPropertiesExceptionCases=function(){return[{name:"linecolor",inputType:"colorPicker",
iconSvgCode:i(484),title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",iconSvgCode:i(485),transparency:!0,showIf:function(t,e){return e.fillBackground.value()},title:$.t("Background Color")},{divider:!1},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,iconSvgCode:i(486)},{value:2,iconSvgCode:i(487)},{value:3,iconSvgCode:i(488)},{value:4,iconSvgCode:i(489)}],title:$.t("Line Width")},{name:"leftEnd",title:$.t("Left End"),inputType:"combobox",comboboxOptions:[{value:c.LINEEND_NORMAL,iconSvgCode:i(492)},{value:c.LINEEND_ARROW,iconSvgCode:i(493)}],propertyProxy:this.createLineEndPropertyProxy("leftEnd","extendLeft")},{name:"rightEnd",title:$.t("Right End"),inputType:"combobox",comboboxOptions:[{value:c.LINEEND_NORMAL,iconSvgCode:i(495)},{value:c.LINEEND_ARROW,iconSvgCode:i(496)}],propertyProxy:this.createLineEndPropertyProxy("rightEnd","extendRight")}]},n.prototype._oneColorForAllLines=function(){return[{name:"collectibleColors",inputType:"colorPicker",iconSvgCode:i(484),title:$.t("One color for all lines")}]},n.prototype._createToolExceptionCases=function(){return{LineToolRegressionTrend:[],LineToolGannSquare:n.prototype._oneColorForAllLines(),LineToolFibTimeZone:n.prototype._oneColorForAllLines(),LineToolBrush:n.prototype._brushPropertiesExceptionCases(),LineToolPolyline:n.prototype._brushPropertiesExceptionCases(),LineToolText:n.prototype._textPropertiesExceptionCases(),LineToolTextAbsolute:n.prototype._textPropertiesExceptionCases(),LineToolBalloon:n.prototype._textPropertiesExceptionCases(),LineToolCallout:n.prototype._textPropertiesExceptionCases(),LineToolPriceLabel:n.prototype._textPropertiesExceptionCases(),LineToolArrowMarkLeft:[],LineToolArrowMarkRight:[],LineToolArrowMarkUp:[],LineToolArrowMarkDown:[],LineToolFlagMark:[],LineToolThumbUp:[],LineToolThumbDown:[],LineToolElliottCircle:n.prototype._elliottPropertiesExceptionCases(),LineToolElliottSubminuette:n.prototype._elliottPropertiesExceptionCases(),LineToolElliottMinor:n.prototype._elliottPropertiesExceptionCases(),LineToolElliottMinorRetr:n.prototype._elliottPropertiesExceptionCases(),LineToolElliottMajorRetr:n.prototype._elliottPropertiesExceptionCases(),LineToolDateRange:n.prototype._rangeExceptionCases(),LineToolPriceRange:n.prototype._rangeExceptionCases(),LineToolDateAndPriceRange:n.prototype._rangeExceptionCases(),LineToolIcon:[{name:"color",title:$.t("Color"),inputType:"colorPicker",iconSvgCode:i(485)}],LineToolNote:n.prototype._notePropertiesExceptionCases(),LineToolNoteAbsolute:n.prototype._notePropertiesExceptionCases(),LineToolThreeDrivers:[{name:"color",title:$.t("Text color"),inputType:"colorPicker",iconSvgCode:i(484)}],LineToolRiskRewardLong:n.prototype._riskPropertiesExceptionCases(),LineToolRiskRewardShort:n.prototype._riskPropertiesExceptionCases(),LineToolBarsPattern:[{name:"color",title:$.t("Color"),inputType:"colorPicker",iconSvgCode:i(485)}],LineToolProjection:[{name:"color1",title:$.t("Background color 1"),inputType:"colorPicker",iconSvgCode:i(485),transparency:!0},{name:"color2",title:$.t("Background color 2"),inputType:"colorPicker",iconSvgCode:i(485),transparency:!0},{divider:!1},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,iconSvgCode:i(486)},{value:2,iconSvgCode:i(487)},{value:3,iconSvgCode:i(488)},{value:4,iconSvgCode:i(489)}]}],LineToolFibCircles:n.prototype._oneColorForAllLines(),LineToolFibChannel:n.prototype._oneColorForAllLines(),LineToolFibSpeedResistanceArcs:n.prototype._oneColorForAllLines(),LineToolFibRetracement:n.prototype._oneColorForAllLines(),LineToolFibSpeedResistanceFan:n.prototype._oneColorForAllLines(),LineToolTrendBasedFibTime:n.prototype._oneColorForAllLines(),LineToolFibWedge:n.prototype._oneColorForAllLines(),LineToolGannComplex:n.prototype._oneColorForAllLines(),LineToolGannFan:n.prototype._oneColorForAllLines(),LineToolPitchfan:n.prototype._oneColorForAllLines(),LineToolPitchfork:n.prototype._oneColorForAllLines(),LineToolSchiffPitchfork2:n.prototype._oneColorForAllLines(),LineToolSchiffPitchfork:n.prototype._oneColorForAllLines(),LineToolInsidePitchfork:n.prototype._oneColorForAllLines(),LineToolTrendBasedFibExtension:n.prototype._oneColorForAllLines()}},t.exports=n}).call(e,i(1),i(69))},437,function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M0 0v11h6v5h11V5h-6V0zm11 7h4v7H8v-3h3z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path d="M0 0v11h6v5h11V5h-6V0H0zm2 2h7v3H6v4H2V2zm6 5h1v2H8V7zm3 0h4v7H8v-3h3V7z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 10" width="12" height="10"><path d="M6 0C2.5 0 0 3.75 0 5s2.5 5 6 5 6-3.75 6-5-2.5-5-6-5zm0 1.75c1.75 0 3.25 1.5 3.25 3.25S7.75 8.25 6 8.25 2.75 6.75 2.75 5 4.25 1.75 6 1.75zM6 3.7c-.75 0-1.3.55-1.3 1.3S5.25 6.3 6 6.3 7.3 5.75 7.3 5 6.75 3.7 6 3.7z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 595.3 841.9" enable-background="new 0 0 595.3 841.9"><path fill-rule="evenodd" clip-rule="evenodd" d="M88.3 714H507V295.4H88.3V714zm293.1-544.2v-41.9H213.9v41.9H46.5v83.7h502.4v-83.7H381.4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40.000001 33.999999" width="40" height="34" enable-background="new 0 0 595.3 841.9"><g class="bg"><path stroke-miterlimit="10" stroke-width="20" d="M0 0v34h40V0H0zm1 29h38v4H1v-4z"/></g><g class="icon"><path fill-rule="evenodd" clip-rule="evenodd" d="M24.335 15.167l-6.327-6.312-3.367 3.39-.71-.683 3.4-3.39-1.18-1.177c-.38-.378-.99-.378-1.36 0l-2.05 2.043c-.38.377-.38.986 0 1.364l8.19 8.17c.38.378 1.67 1.54 2.05 1.163l2.53-2.524c.38-.37-.79-1.66-1.16-2.04zm1.77 2.764l-2.415 2.41 3.86 1.48-1.446-3.88z"/></g></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40.000001 33.999999" width="40" height="34" enable-background="new 0 0 595.3 841.9"><g class="bg"><path stroke-miterlimit="10" stroke-width="20" d="M0 0v34h40V0H0zm1 29h38v4H1v-4z"/></g><g class="icon"><path d="M18.08 12.542c.822.82 1.916-.274 1.095-1.094l-4.923-4.923c-.82-.82-1.914.273-1.094 1.094zm.822-5.744l-6.564 6.564c-.766.766-.766 2.516 0 3.282l4.376 4.376c.766.766 2.516.766 3.282 0l6.564-6.564zm0 2.188l4.923 4.923H13.98z"/><path fill-opacity=".5" d="M27.107 15.55c2.735 2.735 3.282 6.017 0 6.017s-2.735-3.282 0-6.017z"/></g></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 13h22v-1H5v1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 14h22v-2H5v2z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 14h22v-3H5v3z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 15h22v-4H5v4z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path d="M5 12v1h1v-1H5zm2 0v1h1v-1H7zm2 0v1h1v-1H9zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path d="M5 12v1h3v-1H5zm4 0v1h3v-1H9zm4 0v1h3v-1h-3zm4 0v1h3v-1h-3zm4 0v1h3v-1h-3zm4 0v1h3v-1h-3z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path d="M5 11v3h3v-1h19v-1H8v-1H5zm1 1h1v1H6v-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path d="M6.867 10.36L5 12.48l1.867 2.122V13H27v-1H6.867v-1.64z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path d="M16 11v1H5v1h11v1h3v-1h5v1h3v-3h-3v1h-5v-1h-3zm1 1h1v1h-1v-1zm8 0h1v1h-1v-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path d="M27 11v3h-3v-1H5v-1h19v-1h3zm-1 1h-1v1h1v-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path d="M25.133 10.36L27 12.48l-1.867 2.122V13H5v-1h20.133v-1.64z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.000001 24.999999" width="32" height="25" enable-background="new 0 0 595.3 841.9"><path d="M16 11v1h11v1H16v1h-3v-1H8v1H5v-3h3v1h5v-1h3zm-1 1h-1v1h1v-1zm-8 0H6v1h1v-1z"/></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40.000001 33.999999" width="40" height="34" enable-background="new 0 0 595.3 841.9"><g class="bg"><path stroke-miterlimit="10" stroke-width="20" d="M0 0v34h40V0H0zm1 29h38v4H1v-4z"/></g><g class="icon"><text x="13.526" y="20.771" font-family="sans-serif" font-size="18.94" letter-spacing="0" word-spacing="0" style="line-height:125%"><tspan x="13.526" y="20.771">A</tspan></text></g></svg>'},function(t,e,i){"use strict";var o=i(248).UndoHistory,n=i(116),s=i(500),r=i(501),a=i(507),l=i(510),h=l.ChartApiInterface,c=l.HandlerInfo;JSServer.ChartApi=function(t){this._notificationHandlers=[],this._sessions=[],this.studyCounter=0,this._connected=!1,this._enabled=!1,this._studyEngine=new r(t),this._callbacks={},this._symbolIdCache={},this._seriesIdCache={},this._recentSeriesId={},this._enableLogging=!1,this._enabledMoreBarsRequest=!0,this._serverTimeOffset=0,this._autosaveTimeoutSeconds=5;var e=this;this._studyEngine.on("configuration_received",function(){e._fireEvent("configuration_received")}),this._studyEngine.on("realtime_tick",function(t){var i={time:t.value[0]/1e3,open:t.value[1],high:t.value[2],low:t.value[3],close:t.value[4],volume:t.value[5]};e._fireEvent("realtime_tick",i,!0)}),this._autosavePaused=void 0,this._setupAutoSave()},JSServer.ChartApi.prototype._makeSymbolKey=function(t,e){if(!t||!e)throw Error("incorrect identifiers");return t+"_"+e},JSServer.ChartApi.prototype._makeSeriesKey=function(t,e){if(!t||!e)throw Error("incorrect identifiers");return t+"_"+e},JSServer.ChartApi.prototype.destroy=function(){this._studyEngine.destroy(),this._studyEngine=null},JSServer.ChartApi.prototype.purgeCache=function(t){this._symbolIdCache={},this._seriesIdCache={},this._recentSeriesId={},this._studyEngine.purgeCache(),this._studyEngine.purgeRangeExtensionData(),this._studyEngine.purgeDataCache()},JSServer.ChartApi.prototype.setAdditionalBarsRequestEnabled=function(t){this._enabledMoreBarsRequest=t},JSServer.ChartApi.prototype.setTimeFramesList=function(t){var e,i,o,n,r,a,l,h;for(this._timeframes=[],e=/(\d+)(\w+)/,i=0;i<t.length;++i)o=t[i],n=e.exec(o.text),r=n[2].toLowerCase(),a=parseInt(n[1]),l="y"===r?12*a+"m":a+r,h=s.Symbol.parsePeriod(o.resolution),this._timeframes.push({text:a+$.t(r,{context:"dates",count:a}),description:o.description||"",value:l,targetResolution:o.resolution,requiresIntraday:h.isIntraday})},JSServer.ChartApi.prototype._setupAutoSave=function(){var t=this,e=!1;o.undoStack().onChange().subscribe(this,function(){t._autosavePaused?e=!0:(setTimeout(t._fireEvent.bind(t,"onAutoSaveNeeded",void 0,!0),0),t._autosavePaused=setTimeout(function(){e&&t._fireEvent("onAutoSaveNeeded",void 0,!0),t._autosavePaused=void 0,e=!1},1e3*t._autosaveTimeoutSeconds))})},JSServer.ChartApi.prototype.setAutoSaveDelay=function(t){this._autosaveTimeoutSeconds=+t},JSServer.ChartApi.prototype.defaultWatchlistSymbols=function(){return this._watchlistSettings.default_symbols},JSServer.ChartApi.prototype.availableTimeFrames=function(t,e){if(!t)return[];var i=this._timeframes.filter(function(e){return!(e.requiresIntraday&&!t.has_intraday)&&!(t.supported_resolutions&&t.supported_resolutions.indexOf(e.targetResolution)<0)});return i},JSServer.ChartApi.prototype.defaultResolutions=function(){var t=this._studyEngine.supportedResolutions();return t||{1:1,3:1,5:1,15:1,30:1,45:1,60:1,120:1,180:1,240:1,D:1,W:1,M:1}},JSServer.ChartApi.prototype.supportedSymbolsTypes=function(){return this._studyEngine.supportedSymbolsTypes()},JSServer.ChartApi.prototype.supportedExchangesList=function(){return this._studyEngine.supportedExchangesList()},JSServer.ChartApi.prototype.futuresRegex=function(){return this._studyEngine.futuresRegex()},JSServer.ChartApi.prototype.start=function(){this._enabled=!0,this._fireEvent("start_enabled")},JSServer.ChartApi.prototype._logMessage=function(t){this._enableLogging&&console.log(t)},JSServer.ChartApi.prototype.unsubscribe=function(t,e){var i=this._callbacks[t];i&&i.splice(i.indexOf(e),1)},JSServer.ChartApi.prototype.on=function(t,e){return this._callbacks.hasOwnProperty(t)||(this._callbacks[t]=[]),this._callbacks[t].push(e),this},JSServer.ChartApi.prototype._fireEvent=function(t,e,i){var o,n;if(this._callbacks.hasOwnProperty(t))for(o=this._callbacks[t].slice(0),i||(this._callbacks[t]=[]),n=0;n<o.length;++n)o[n](e)},JSServer.ChartApi.prototype.chartCreateSession=function(t,e){},JSServer.ChartApi.prototype.chartDeleteSession=function(t){},JSServer.ChartApi.prototype.createSession=function(t,e){TradingView.ChartapiMessagerInstances[t]=new a(this,t),this._sessions[t]=e,this._notificationHandlers[t]=e,this.connected()&&e.onMessage({method:"connected",params:[]})},JSServer.ChartApi.prototype.removeSession=function(t){delete this._sessions[t],delete this._notificationHandlers[t],this.chartDeleteSession(t),this._studyEngine.stopSources(t)},JSServer.ChartApi.prototype.connected=function(){return this._connected},JSServer.ChartApi.prototype._getHost=function(t){return t},JSServer.ChartApi.prototype._isSafari5=function(){return!!navigator.appVersion.match(/\/5\.[^\/]*?Safari\//)},JSServer.ChartApi.prototype._isIE9=function(){return!!navigator.appVersion.match(/MSIE 9/)},JSServer.ChartApi.prototype._isIOS5=function(){return!!navigator.appVersion.match(/iPad, CPU 5/)},JSServer.ChartApi.prototype._getPort=function(t){var e=8081;return this._isSafari5()||this._isIE9()?e:t},JSServer.ChartApi.prototype.connect=function(){if(!this._enabled){var t=this;return void this.on("start_enabled",function(){t.connect()})}this.connected()||(this._connected=!0,this.sessionid="dummy session id",this._notifySessions({method:"connected",params:[]}))},JSServer.ChartApi.prototype.disconnect=function(){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.switchTimezone=function(t,e){if(TradingView.ChartapiMessagerInstances[t].setTimezone(e),this._recentSeriesId[t]){this._studyEngine.purgeEndOfDataFlags(t,this._recentSeriesId[t]);var i=this;this._doWhenSeriesSymbolIdIsReady(t,this._recentSeriesId[t],function(e){var o=i._seriesIdCache[i._makeSeriesKey(t,i._recentSeriesId[t])].resolution;i._studyEngine.recreateSources(e.name,o,t),i._doWhenSeriesDataReceived(t,function(){var o=i._seriesIdCache[i._makeSeriesKey(t,i._recentSeriesId[t])].resolution,n=TradingView.ChartapiMessagerInstances[t].lastBar(i._recentSeriesId[t]);if(!n)throw Error("No data received");i._studyEngine.rebuildExtrapolatedData(t,e.name,o,e.info,1e3*n.value[0])})})}},JSServer.ChartApi.prototype.receiveLocalResponse=function(t){this._logMessage("< "+t.method),this._dispathNotification(t),this._fireEvent("message_"+t.method,void 0,!0)},JSServer.ChartApi.prototype.getMarks=function(t,e,i,o,n){this._studyEngine.getMarks(t,e,i,o,n)},JSServer.ChartApi.prototype.getTimescaleMarks=function(t,e,i,o,n){this._studyEngine.getTimescaleMarks(t,e,i,o,n)},JSServer.ChartApi.prototype.resolveSymbol=function(t,e,i,o,n){function s(e,o){TradingView.ChartapiMessagerInstances[t].onSymbolError(e,o),TradingView.ChartapiMessagerInstances[t].onSeriesClearData(0,""),r._symbolIdCache[r._makeSymbolKey(t,e)]={name:i,status:"invalid_symbol"},r._fireEvent(r._makeSymbolKey(t,e)+"_resolve_fail"),r._fireEvent("resolve_fail",{session:t,symbolId:e},!0)}this._notificationHandlers[t][e]=new c(o,e),this._symbolIdCache[this._makeSymbolKey(t,e)]=null;var r=this;this._studyEngine.resolveSymbol(i,function(o){return o.errmsg?void s(e,o.errmsg):(r._symbolIdCache[r._makeSymbolKey(t,e)]={name:i,info:o,status:"ok"},r._fireEvent(r._makeSymbolKey(t,e)+"_resolved",o),r._fireEvent("symbol_resolved",{symbolInfo:o,symbolId:e,session:t},!0),void TradingView.ChartapiMessagerInstances[t].onSymbolResolved(e,o))},function(t){s(e,t)})},JSServer.ChartApi.prototype._doWhenSymbolIdIsReady=function(t,e,i){function o(){return{name:s._symbolIdCache[s._makeSymbolKey(t,e)].name,info:s._symbolIdCache[s._makeSymbolKey(t,e)].info}}function n(){r&&(i(o()),r=!1,s.unsubscribe(s._makeSymbolKey(t,e)+"_resolved",n),s.unsubscribe(s._makeSymbolKey(t,e)+"_resolve_fail",n))}var s=this,r=!0;this._symbolIdCache[this._makeSymbolKey(t,e)]?n():(this.on(this._makeSymbolKey(t,e)+"_resolved",n),this.on(this._makeSymbolKey(t,e)+"_resolve_fail",n))},JSServer.ChartApi.prototype._doWhenSeriesDataReceived=function(t,e){TradingView.ChartapiMessagerInstances[t].seriesCompleted.subscribe(null,e,!0)},JSServer.ChartApi.prototype._doWhenSeriesSymbolIdIsReady=function(t,e,i,o){function n(){var e=h._symbolIdCache[h._makeSymbolKey(t,c)];return{name:e.name,info:e.info}}function s(){i(n())}function r(){h.unsubscribe("symbol_resolved",l),h.unsubscribe("resolve_fail",a)}function a(e){e.symbolId===c&&e.session===t&&(r(),o&&o())}function l(e){e.symbolId===c&&e.session===t&&(r(),s())}var h=this,c=this._seriesIdCache[t+"_"+e].symbolId;this._symbolIdCache[this._makeSymbolKey(t,c)]?s():(this.on("symbol_resolved",l),this.on("resolve_fail",a))},JSServer.ChartApi.prototype.createSeries=function(t,e,i,o,n,r,a){i=i||"";var l=this;this._notificationHandlers[t][e]=new c(function(r){if("series_completed"===r.method){var h=s.Symbol.parsePeriod(n);h.range&&l._applyRange(t,o,e,i,h.range)}a(r)},e),this._recentSeriesId[t]=e,TradingView.ChartapiMessagerInstances[t].setResolution(s.Symbol.parsePeriod(n).pureResolution),this._seriesIdCache[t+"_"+e]={symbolId:o,resolution:n,turnaround:i},this._studyEngine.updateSeriesTurnaround(t,e,i),this._doWhenSeriesSymbolIdIsReady(t,e,function(o){l._studyEngine.seriesTurnaround(t,e)===i&&l._studyEngine.createSeries(o.name,n,t,e,i)})},JSServer.ChartApi.prototype.removeSeries=function(t,e,i){this._notificationHandlers[t][e]=new c(i,e),this._studyEngine.removeSeries(t,e)},JSServer.ChartApi.prototype.setVisibleTimeRange=function(t,e,i,o,n){function s(){var s,a;r=t.data(),s=[r.timeToBarIndex(i,TradingView.SEARCH_FROM_LEFT),r.timeToBarIndex(o,TradingView.SEARCH_FROM_RIGHT)],r.valueAt(s[1])[0]<o&&t.syncModel()&&(a=t.syncModel().distance(r.valueAt(s[1])[0],o),a.success&&(s[1]+=a.result)),TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(l,h._seriesIdCache[e+"_"+l].turnaround,s[0],s[1],!0),t.requestMoreData(),n&&n()}var r=t.data(),a=!!r.timeToBarIndex(i,TradingView.SEARCH_FROM_LEFT),l=this._recentSeriesId[e],h=this;a?s():(this._studyEngine.ensureExtendedTo(l,e,i),this._doWhenSeriesDataReceived(e,s))},JSServer.ChartApi.prototype._exactBarsCountOfTimeFrame=function(t,e){var i,o,s=chartWidget.model().mainSeries().bars(),r=chartWidget.model().mainSeries().symbolInfo().session,a=s._valueAt(s.size()-1)[0],l=n.alignPeriodsBack(r,t.resolution,t.interval,1,1e3*a),h=s.size();for(l/=1e3,i=0,i=0;i<h&&(o=s._valueAt(i)[0],!(o>l));++i);return h-i},JSServer.ChartApi.prototype._applyRange=function(t,e,i,o,n){var s=chartWidget.model().mainSeries().bars().size(),r=this._exactBarsCountOfTimeFrame(n,this._symbolIdCache[this._makeSymbolKey(t,e)].info),a=Math.max(0,s-1-r),l=Math.max(a,s-1);TradingView.ChartapiMessagerInstances[t].onSeriesTimeframeUpdate(i,o,a,l)},JSServer.ChartApi.prototype.modifySeries=function(t,e,i,o,n,r,a){var l,h;i=i||"",l=this._seriesIdCache[t+"_"+e]?this._seriesIdCache[t+"_"+e].resolution:void 0,TradingView.ChartapiMessagerInstances[t].setResolution(s.Symbol.parsePeriod(n).pureResolution),h=this,this._notificationHandlers[t][e]=new c(function(a){var c,d;"series_completed"===a.method&&(c=s.Symbol.parsePeriod(l),d=s.Symbol.parsePeriod(n),d.range&&c.range!==d.range&&h._applyRange(t,o,e,i,d.range)),r(a)},e),this._recentSeriesId[t]=e,this._studyEngine.updateSeriesTurnaround(t,e,i),a&&(this._seriesIdCache[this._makeSeriesKey(t,a)]=null),this._seriesIdCache[this._makeSymbolKey(t,e)]={symbolId:o,resolution:n,turnaround:i},this._doWhenSeriesSymbolIdIsReady(t,e,function(i){h._studyEngine.purgeEndOfDataFlags(t,e),h._studyEngine.purgeRangeExtensionData(t),h._studyEngine.recreateSources(i.name,n,t,!0)})},JSServer.ChartApi.prototype.requestMoreData=function(t,e,i,o){this._enabledMoreBarsRequest&&(this._notificationHandlers[t][e]=new c(o,e),this._studyEngine.extendSeriesRange(e,t,i))},JSServer.ChartApi.prototype.setStudiesAccessController=function(t){this.studiesAccessController=t},JSServer.ChartApi.prototype.setWatchlistSettings=function(t){this._watchlistSettings=t},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(t,e,i){this._notificationHandlers[t][e]=new c(i,e);var o=this.studiesAccessController.getEnabledTools();TradingView.ChartapiMessagerInstances[t].onRequestMetadata(e,o)},JSServer.ChartApi.prototype.isCanCreateStudy=function(){return this.studyCounter<TradingView.STUDY_COUNT_LIMIT},JSServer.ChartApi.prototype.createStudy=function(t,e,i,o,n,s,r){var a,l,h;if(!this.isCanCreateStudy())throw Error("Exceeded the limit of studies");a=this,i=i||"",this._notificationHandlers[t][e]=new c(r,e),l=this._seriesIdCache[this._makeSeriesKey(t,o)].symbolId,h=this._seriesIdCache[this._makeSeriesKey(t,o)].resolution,this._doWhenSymbolIdIsReady(t,l,function(o){a._studyEngine.createStudy(o.name,h,t,e,i,n,s),a.studyCounter++})},JSServer.ChartApi.prototype.removeStudy=function(t,e){this._notificationHandlers[t][e]=null,this._studyEngine.removeStudy(t,e),this.studyCounter--},JSServer.ChartApi.prototype.modifyStudy=function(t,e,i,o,n){i=i||"",this._notificationHandlers[t][e]=new c(n,e),this._studyEngine.recomputeStudy(e,o,t,i)},JSServer.ChartApi.prototype.createPointset=function(t,e,i,o,n,s,r){i=i||"",this._notificationHandlers[t][e]=new c(r,e);var a=this;this._doWhenSymbolIdIsReady(t,o,function(i){a._studyEngine.createPointset(t,e,i.info.full_name,i.info,n,s)})},JSServer.ChartApi.prototype.modifyPointset=function(t,e,i,o,n){throw Error("This call is not implemented")},JSServer.ChartApi.prototype.removePointset=function(t,e,i){this._notificationHandlers[t][e]=null,this._studyEngine.removePointset(e)},JSServer.ChartApi.prototype.requestMoreTickmarks=function(t,e,i,o){this._notificationHandlers[t][e]=new c(o,e);var n=this;this._doWhenSeriesSymbolIdIsReady(t,e,function(o){var s=n._seriesIdCache[n._makeSeriesKey(t,e)].resolution;n._studyEngine.onMoreTickmarksRequested(t,o.name,o.info,s,i)})},JSServer.ChartApi.prototype.requestFirstBarTime=function(t,e,i,o){this._notificationHandlers[t][e]=new c(o,e)},JSServer.ChartApi.prototype._invokeHandler=function(t,e){t&&t(e)},JSServer.ChartApi.prototype._sendRequest=function(t,e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._onMessage=function(t){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._convertTimescaleResponse=function(t){var e,i=t.marks;for(e=0;e<i.length;++e)i[e]={span:i[e][0],time:i[e][1],index:i[e][2]};return t},JSServer.ChartApi.prototype._dispathNotification=function(t){var e,i,o,n,s,r,a,l,h,c,d=t.params.shift();if(this._notificationHandlers[d])switch(t.method){case"timescale_update":e=t.params[0],i=t.params[1],o=this._convertTimescaleResponse(i),o.clear=0===i.changes.length&&0===i.marks.length,this._notificationHandlers[d].onMessage({method:"timescale_update",params:o});for(n in e)s={},s.customId=n,s.plots=e[n].series,e[n].ns&&(s.nonseries=e[n].ns),s.turnaround=e[n].turnaround,r={method:"data_update",params:s},this._invokeNotificationHandler(d,n,r);break;case"tickmark_update":o=this._convertTimescaleResponse(t.params[0]),o.changes=[],this._notificationHandlers[d].onMessage({method:"timescale_update",params:o});break;case"data_update":for(n in t.params[0]){a=t.params[0][n],s={},s.customId=n,s.plots=a.series?a.series:a.plots,s.turnaround=a.turnaround,"s"in a&&"ns"in a&&(s.plots=a.s,s.nonseries=a.ns);for(l in s.plots)for(h in s.plots[l].value)1e100===s.plots[l].value[h]&&(s.plots[l].value[h]=void 0);r={method:"data_update",params:s},this._invokeNotificationHandler(d,n,r)}break;case"index_update":for(n in t.params[0])r={method:"index_update",params:t.params[0][n]},this._invokeNotificationHandler(d,n,r);break;case"critical_error":TradingView.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+t.params[0]),this._notificationHandlers[d].onMessage({method:"critical_error",params:t.params});break;case"quote_symbol_data":case"quote_list_fields":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._notificationHandlers[d].onMessage({method:t.method,params:t.params});break;default:c=t.params[0],this._invokeNotificationHandler(d,c,t)}},JSServer.ChartApi.prototype._invokeNotificationHandler=function(t,e,i){if(void 0!==e){var o=this._notificationHandlers[t][e];void 0!==o&&o&&this._invokeHandler(o.handler,i),"series_deleted"!==i.method&&"study_deleted"!==i.method||delete this._notificationHandlers[t][e]}},JSServer.ChartApi.prototype.searchSymbols=function(t,e,i,o,n){0===t.length&&0===e.length&&0===i.length&&n([]),this._studyEngine.searchSymbols(t,e,i,n)},JSServer.ChartApi.prototype._notifySessions=function(t){var e,i;for(e in this._sessions){if(!this._sessions.hasOwnProperty(e))return;i=this._sessions[e],"function"==typeof i.onMessage&&i.onMessage(t)}},JSServer.ChartApi.prototype.unpack=function(t){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.reconnectTimeout=function(t){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.quoteCreateSession=function(t){return this._studyEngine.quoteCreateSession(t)},JSServer.ChartApi.prototype.quoteDeleteSession=function(t){return this._studyEngine.quoteDeleteSession(t)},JSServer.ChartApi.prototype.quoteSetFields=function(t,e){return this._studyEngine.quoteSetFields(t,e)},JSServer.ChartApi.prototype.quoteAddSymbols=function(t,e){return this._studyEngine.quoteAddSymbols(t,e)},JSServer.ChartApi.prototype.quoteRemoveSymbols=function(t,e){return this._studyEngine.quoteRemoveSymbols(t,e)},JSServer.ChartApi.prototype.quoteFastSymbols=function(t,e){return this._studyEngine.quoteFastSymbols(t,e)},JSServer.ChartApi.prototype.quoteHibernateAll=function(t){return this._studyEngine.quoteHibernateAll(t)},JSServer.ChartApi.prototype.depthCreateSession=function(t,e,i){},JSServer.ChartApi.prototype.depthDeleteSession=function(t){},JSServer.ChartApi.prototype.depthSetSymbol=function(t,e){},JSServer.ChartApi.prototype.depthClearSymbol=function(t){},JSServer.ChartApi.prototype.depthSetScale=function(t,e){},JSServer.ChartApi.prototype.createStudiesAccessController=function(t,e,i){return new this.StudiesAccessController(this._studyEngine,t&&JSON.parse(t)||{type:"black",tools:[]})},JSServer.ChartApi.prototype.StudiesAccessController=function(t,e){this._studyEngine=t,this._studiesAccess=e},JSServer.ChartApi.prototype.StudiesAccessController.prototype._findTool=function(t){var e,i,o=null;for(e=0;e<this._studiesAccess.tools.length;++e)if(i=this._studiesAccess.tools[e],i.name===t||i===t){o=i;break}return o},JSServer.ChartApi.prototype.StudiesAccessController.prototype.getEnabledTools=function(){return this._studyEngine.studiesMetadata().filter(function(t){var e=this._findTool(t.description);return"black"===this._studiesAccess.type?!e||e.grayed:!!e},this)},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolGrayed=function(t){var e=this._findTool(t);return e&&e.grayed},JSServer.ChartApi.prototype.serverTimeOffset=function(){return this._studyEngine.serverTimeOffset()},JSServer.ChartApi.prototype.alignTimePoint=function(t,e,i){return this._studyEngine.alignTimePoint(t,e,i)},JSServer.ChartApi.prototype.disconnectCount=function(){return 0},TradingView.requireFullInterfaceImplementation(JSServer.ChartApi,"JSServer.ChartApi",h,"ChartApiInterface"),t.exports=JSServer.ChartApi},function(t,e,i){(function(e){"use strict";var o=function(){function t(t,e,i,o,n){var s,r=n,a=0;if(isNaN(t.get(e-1)))return{index:NaN,value:NaN};for(s=0;s<e;++s)o(t.get(s),r)&&(a=s,r=t.get(s));return{index:a,value:r}}function o(t,e){return 100*t/e}function n(t,e,i,o,n){var s,r,a;this._areaRight=t,this._areaLeft=e,this._pivotType=i,this._series=o,this._currentIndex=n.new_var(0),this._currentValue=n.new_var(NaN),this._pivotIndex=n.new_var(-1),this._index=w.n(n),this._isNewBar=n.symbol.isNewBar,s=this._currentIndex.get(1),r=this._currentValue.get(1),a=this._pivotIndex.get(1),this._index>1&&(this._currentIndex.set(s),this._currentValue.set(r),this._pivotIndex.set(a))}function s(t,e,i){var o,s,r,a,l;this._deviation=t,o=i.new_var(w.high(i)),s=i.new_var(w.low(i)),o.get(2*e+1),s.get(2*e+1),this._pivotHigh=new n(e,e,n.HIGH,o,i),this._pivotLow=new n(e,e,n.LOW,s,i),this._lastVal=i.new_var(NaN),this._lastIndex=i.new_var(-1),this._lastType=i.new_var(),this._index=w.n(i),this._isNewBar=i.symbol.isNewBar,this._isBarClosed=i.symbol.isBarClosed,r=this._lastIndex.get(1),a=this._lastVal.get(1),l=this._lastType.get(1),this._index>1&&this.addPivot(r,a,l),this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}function r(t){this.symbol=t,this.vars=[],this.vars_index=0,this.ctx=[],this.ctx_index=0}function a(t){this.mindepth=0,this.original=NaN,this.modified=!1,this.symbol=t}function l(t,e){this.timezone=t||"America/New_York",this.session=e||"0000-0000"}function h(t,e,i,o){this.periodBase=i,this.tickerid=t,this.period=e,this.index=-1,this.time=NaN,this.open=NaN,this.high=NaN,this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.isNewBar=!1,this.isBarClosed=!1,this.session=new b.Session,this.other_sessions={},this.script=o,this.ticker=h.parseTicker(t);var n=h.parsePeriod(e);this.resolution=n.resolution,this.interval=n.interval,this.bb_cache={}}function c(t,e,i,o,n,s,a){this.body=n,this.symbols=[],this.runner=o,this.inputCallback=a,this.out=s,this.ctx=new r(this.add_sym(t,e,i)),this.init()}function d(t){this.symbols=[],this.barsets=[],this.subscription=[],this.host=t,this.isRecalculated=!1,this.start()}function p(t){d.feed=t}function u(t){this.runner=new d(t)}function _(t,e){this.info=t,this.bars=e||[],this.isBarClosed=!0}function f(t,e){this.period=t,this.generateEmptyBars=!!e}function g(){}function m(){}var v="undefined"!=typeof window?window:e,y=v.PineJsCalendar?v.PineJsCalendar:i(33),b=i(116),w={};return w.max_series_size=5e3,w.n=function(t){return t.symbol.index+1},w.nz=function(t,e){return e=e||0,isFinite(t)?t:e},w.na=function(t){return 0===arguments.length?NaN:isNaN(t)?1:0},w.isZero=function(t){return Math.abs(t)<=1e-10},w.toBool=function(t){return isFinite(t)&&!w.isZero(t)},w.eq=function(t,e){return w.isZero(t-e)},w.neq=function(t,e){return!w.eq(t,e)},w.ge=function(t,e){return w.isZero(t-e)||t>e},w.gt=function(t,e){return!w.isZero(t-e)&&t>e},w.lt=function(t,e){return!w.isZero(t-e)&&t<e;
},w.le=function(t,e){return w.isZero(t-e)||t<e},w.and=function(t,e){return isNaN(t)||isNaN(e)?NaN:w.isZero(t)||w.isZero(e)?0:1},w.or=function(t,e){return isNaN(t)||isNaN(e)?NaN:w.isZero(t)&&w.isZero(e)?0:1},w.not=function(t){return isNaN(t)?NaN:w.isZero(t)?1:0},w.max=Math.max,w.min=Math.min,w.pow=Math.pow,w.abs=Math.abs,w.log=Math.log,w.log10=function(t){return Math.log(t)/Math.LN10},w.sqrt=Math.sqrt,w.sign=function(t){return isNaN(t)?NaN:w.isZero(t)?0:t>0?1:-1},w.exp=Math.exp,w.sin=Math.sin,w.cos=Math.cos,w.tan=Math.tan,w.asin=Math.asin,w.acos=Math.acos,w.atan=Math.atan,w.floor=Math.floor,w.ceil=Math.ceil,w.round=Math.round,w.avg=function(t,e,i,o,n,s){var r,a;if(2===arguments.length)return(t+e)/2;for(r=0,a=0;a<arguments.length;a++)r+=arguments[a];return r/arguments.length},w.open=function(t){return t.symbol.open},w.high=function(t){return t.symbol.high},w.low=function(t){return t.symbol.low},w.close=function(t){return t.symbol.close},w.hl2=function(t){return(t.symbol.high+t.symbol.low)/2},w.hlc3=function(t){return(t.symbol.high+t.symbol.low+t.symbol.close)/3},w.ohlc4=function(t){return(t.symbol.open+t.symbol.high+t.symbol.low+t.symbol.close)/4},w.volume=function(t){return t.symbol.volume},w.time=function(t,e,i){return t.symbol.bartime(e,i)},w.period=function(t){return t.symbol.period},w.tickerid=function(t){return t.symbol.tickerid},w.ticker=function(t){return t.symbol.ticker},w.interval=function(t){return t.symbol.interval},w.isdwm=function(t){return t.symbol.isdwm()},w.isintraday=function(t){return!t.symbol.isdwm()},w.isdaily=function(t){return"D"===t.symbol.resolution},w.isweekly=function(t){return"W"===t.symbol.resolution},w.ismonthly=function(t){return"M"===t.symbol.resolution},w.year=function(t){return w.timepart(t.symbol,y.YEAR,arguments[1])},w.month=function(t){return w.timepart(t.symbol,y.MONTH,arguments[1])},w.weekofyear=function(t){return w.timepart(t.symbol,y.WEEK_OF_YEAR,arguments[1])},w.dayofmonth=function(t){return w.timepart(t.symbol,y.DAY_OF_MONTH,arguments[1])},w.dayofweek=function(t){return w.timepart(t.symbol,y.DAY_OF_WEEK,arguments[1])},w.hour=function(t){return w.timepart(t.symbol,y.HOUR_OF_DAY,arguments[1])},w.minute=function(t){return w.timepart(t.symbol,y.MINUTE,arguments[1])},w.second=function(t){return w.timepart(t.symbol,y.SECOND,arguments[1])},w.iff=function(t,e,i){return w.not(t)?i:e},w.rising=function(t,e){for(var i=1;i<e+1;++i)if(t.get(i)>t.get(0))return 0;return 1},w.falling=function(t,e){for(var i=1;i<e+1;++i)if(t.get(i)<t.get(0))return 0;return 1},w.timepart=function(t,e,i){var o=y.utc_to_cal(t.timezone,i||t.bartime());return y.get_part(o,e)},w.rsi=function(t,e){return w.isZero(e)?100:w.isZero(t)?0:100-100/(1+t/e)},w.sum=function(t,e,i){var o=i.new_var(),n=w.nz(t.get())+w.nz(o.get(1))-w.nz(t.get(e));return o.set(n),n},w.sma=function(t,e,i){var o=w.sum(t,e,i),n=w.na(t.get(e-1))?NaN:o/e;return n},w.rma=function(t,e,i){var o=w.sum(t,e,i),n=e-1,s=t.get(n),r=i.new_var(),a=r.get(1),l=t.get(),h=w.na(s)?NaN:w.na(a)?o/e:(l+a*n)/e;return r.set(h),h},w.fixnan=function(t,e){var i=e.new_var();return isNaN(t)?i.get(1):(i.set(t),t)},w.tr=function(t,e){var i,o,n;return 1===arguments.length&&(e=t,t=void 0),i=void 0!==t&&!!t,o=e.new_var(w.close(e)),n=o.get(1),i&&isNaN(n)&&(n=w.close(e)),w.max(w.max(w.high(e)-w.low(e),w.abs(w.high(e)-n)),w.abs(w.low(e)-n))},w.atr=function(t,e){var i=e.new_var(w.tr(e));return w.sma(i,t,e)},w.ema=function(t,e,i){var o=w.sum(t,e,i),n=i.new_var(),s=t.get(0),r=t.get(e-1),a=n.get(1),l=w.na(r)?NaN:w.na(a)?o/e:2*(s-a)/(e+1)+a;return n.set(l),l},w.wma=function(t,e,i){var o,n,s=0;for(e=Math.round(e),o=e;o>=0;o--)n=e-o,s+=n*t.get(o);return 2*s/(e*(e+1))},w.vwma=function(t,e,i){var o=i.new_var(w.volume(i)),n=i.new_var(t.get(0)*w.volume(i));return w.sma(n,e,i)/w.sma(o,e,i)},w.swma=function(t,e){return(t.get(0)+2*t.get(1)+2*t.get(2)+t.get(3))/6},w.lowestbars=function(e,i,o){return-t(e,i,o,function(t,e){return w.lt(t,e)},Number.MAX_VALUE).index},w.lowest=function(e,i,o){return t(e,i,o,function(t,e){return w.lt(t,e)},Number.MAX_VALUE).value},w.highestbars=function(e,i,o){return-t(e,i,o,function(t,e){return w.gt(t,e)},Number.MIN_VALUE).index},w.highest=function(e,i,o){return t(e,i,o,function(t,e){return w.gt(t,e)},Number.MIN_VALUE).value},w.cum=function(t,e){var i=e.new_var(),o=w.nz(i.get(1))+t;return i.set(o),o},w.accdist=function(t){var e=w.high(t),i=w.low(t),o=w.close(t),n=w.volume(t);return w.cum(o===e&&o===i||e===i?0:n*(2*o-i-e)/(e-i),t)},w.correlation=function(t,e,i,o){var n=w.sma(t,i,o),s=w.sma(e,i,o),r=o.new_var(t.get()*e.get()),a=w.sma(r,i,o)-n*s;return a/Math.sqrt(w.variance2(t,n,i)*w.variance2(e,s,i))},w.stoch=function(t,e,i,n,s){var r=w.highest(e,n),a=w.lowest(i,n);return w.fixnan(o(t.get()-a,r-a),s)},w.tsi=function(t,e,i,o){var n=o.new_var(w.change(t)),s=o.new_var(w.abs(w.change(t))),r=o.new_var(w.ema(n,i,o)),a=o.new_var(w.ema(s,i,o)),l=w.ema(r,e,o),h=w.ema(a,e,o);return l/h},w.cross=function(t,e,i){function o(t){return t<0?-1:0===t?0:1}if(isNaN(t)||isNaN(e))return!1;var n=i.new_var(o(t-e));return!isNaN(n.get(1))&&n.get(1)!==n.get()},w.linreg=function(t,e,i){var o,n,s,r,a,l,h,c=0,d=0,p=0,u=0;for(o=0;o<e;++o)n=t.get(o),s=e-1-o,r=s+1,c+=r,d+=n,p+=r*r,u+=n*r;return a=(e*u-c*d)/(e*p-c*c),l=d/e,h=l-a*c/e+a,h+a*(e-1-i)},w.sar=function(t,e,i,o){function n(e,i){var o=g.get();return m.set(e),g.set(i),v.set(1e3*t),y.set(o),o}var s,r,a=w.high(o),l=w.low(o),h=w.close(o),c=o.new_var(a),d=o.new_var(l),p=o.new_var(h),u=p.get(1),_=d.get(1),f=c.get(1),g=o.new_var(),m=o.new_var(),v=o.new_var(),y=o.new_var(),b=y.get(1);if(isNaN(u))return NaN;if(s=1e-7,isNaN(b)&&(w.ge(h,u)?(m.set(1),g.set(Math.max(a,f)),b=Math.min(l,_)):(m.set(-1),b=Math.max(a,f),g.set(Math.min(l,_))),v.set(1e3*t)),1===m.get()){if(w.gt(a,g.get())&&(g.set(a),v.set(Math.min(v.get()+1e3*e,1e3*i))),w.le(l,b))return n(-1,l)}else if(w.lt(l,g.get())&&(g.set(l),v.set(Math.min(v.get()+1e3*e,1e3*i))),w.ge(a,b))return n(1,a);return r=b+v.get()*(g.get()-b)/1e3,1===m.get()?w.ge(r,l)&&(r=l-s):w.le(r,a)&&(r=a+s),y.set(r),r},w.alma=function(t,e,i,o){var n,s,r,a=Math.floor(i*(e-1)),l=e/o*(e/o),h=[],c=0;for(n=0;n<e;++n)s=Math.exp(-1*Math.pow(n-a,2)/(2*l)),c+=s,h.push(s);for(n=0;n<e;++n)h[n]/=c;for(r=0,n=0;n<e;++n)r+=h[n]*t.get(e-n-1);return r},w.wvap=function(t,e){var i=t.get()-t.get(1);return i},w.change=function(t){var e=t.get()-t.get(1);return e},w.roc=function(t,e){var i=t.get(e),o=100*(t.get()-i)/i;return o},w.dev=function(t,e,i){var o=w.sma(t,e,i);return w.dev2(t,e,o)},w.dev2=function(t,e,i){var o,n,s,r=0;for(o=0;o<e;o++)n=t.get(o),s=w.abs(n-i),r+=s;return r/e},w.stdev=function(t,e,i){var o=w.variance(t,e,i);return w.sqrt(o)},w.variance=function(t,e,i){var o=w.sma(t,e,i);return w.variance2(t,o,e)},w.variance2=function(t,e,i){var o,n,s,r=0;for(o=0;o<i;o++)n=t.get(o),s=w.abs(n-e),r+=s*s;return r/i},w.percentrank=function(t,e){var i,o,n,s,r;if(w.na(t.get(e-1)))return NaN;for(i=0,o=t.get(),n=1;n<e;n++)s=t.get(n),w.ge(o,s)&&i++;return r=100*i/e},n.LOW=0,n.HIGH=1,n.prototype.isPivotFound=function(){return this._pivotIndex.get()!==-1},n.prototype.pivotIndex=function(){return this._pivotIndex.get()},n.prototype.currentValue=function(){return this._currentValue.get()},n.prototype.pivotType=function(){return this._pivotType},n.prototype.reset=function(){this._currentValue.set(NaN),this._currentIndex.set(0),this._pivotIndex.set(-1)},n.prototype.isRightSideOk=function(t){return t-this._currentIndex.get()===this._areaRight},n.prototype.isViolate=function(t,e){if(t<1||isNaN(this._currentValue.get()))return!0;var i=this._series.get(this._index-t);return!!isNaN(i)||(i===this._currentValue.get()?e:this._pivotType===n.HIGH?i>this._currentValue.get():i<this._currentValue.get())},n.prototype.processPoint=function(t){this.isViolate(t,!1)&&(this._currentValue.set(this._series.get()),this._currentIndex.set(t))},n.prototype.isRestartNeeded=function(t){return t-this._currentIndex.get()>this._areaRight},n.prototype.update=function(){var t,e;if(this._isNewBar&&this.isPivotFound()&&this.reset(),this.processPoint(this._index),this.isRightSideOk(this._index)){if(this._pivotIndex.get()===-1){for(t=!0,e=0;e<this._areaLeft;++e)if(this.isViolate(this._currentIndex.get()-1-e,!0)){t=!1;break}t&&this._pivotIndex.set(this._currentIndex.get())}}else this._pivotIndex.get()!==-1&&this._pivotIndex.set(-1);if(this.isRestartNeeded(this._index))for(this.reset(),e=0;e<=this._areaRight;++e)this.processPoint(this._index-this._areaRight+e)},s.prototype.addPivot=function(t,e,i){this._lastIndex.set(t),this._lastVal.set(e),this._lastType.set(i)},s.prototype.updatePivot=function(t,e){this._lastIndex.set(t),this._lastVal.set(e)},s.prototype.lastPrice=function(){return this._lastVal.get()},s.prototype.lastIndex=function(){return this._lastIndex.get()},s.prototype.addPoint=function(t,e,i){var o,s,r;return isNaN(this._lastVal.get())?void this.addPivot(t,e,i):(o=this._lastVal.get(),this._lastType.get()===i?(s=i===n.HIGH?e>o:e<o,void(s&&this.updatePivot(t,e))):(r=Math.abs(o-e)/e,void(r>this._deviation&&this.addPivot(t,e,i))))},s.prototype.processPivot=function(t){t.update(),this._isBarClosed&&t.isPivotFound()&&this.addPoint(t.pivotIndex(),t.currentValue(),t.pivotType())},w.zigzag=function(t,e,i){var o=new s(t,e,i);return o.lastPrice()},w.zigzagbars=function(t,e,i){var o=new s(t,e,i);return o.lastIndex()===-1?NaN:o.lastIndex()-w.n(i)},r.prototype.new_sym=function(t,e,i){return this.symbol.script.add_sym(t,e,i)},r.prototype.select_sym=function(t){this.symbol=this.symbol.script.get_sym(t)},r.prototype.new_var=function(t){var e,i=this.vars;return i.length<=this.vars_index&&i.push(new a(this.symbol)),e=i[this.vars_index++],arguments.length>0&&e.set(t),e},r.prototype.new_ctx=function(){return this.ctx.length<=this.ctx_index&&this.ctx.push(new r(this.symbol)),this.ctx[this.ctx_index++]},r.prototype.prepare=function(t){var e,i;for(this.ctx_index=0,this.vars_index=0,e=0;e<this.vars.length;e++)this.vars[e].prepare(t);for(i=0;i<this.ctx.length;i++)this.ctx[i].prepare(t)},r.prototype.stop=function(){this.symbol=null,this.vars=null},a.prototype.valueOf=function(){return this.get(0)},a.prototype.get=function(t){return isNaN(t)&&(t=0),t=t||0,this.hist?t>=this.hist.length?(console.error("not enough depth: "+this),NaN):this._get(t):(this.mindepth=w.max(this.mindepth,t),NaN)},a.prototype._get=function(t){var e=this.hist_pos-t;return e<0&&(e+=this.hist.length),this.hist[e]},a.prototype.set=function(t){this.hist&&(this.hist[this.hist_pos]=t,this.modified=!0)},a.prototype.prepare=function(t){t===this.symbol&&(t.isNewBar?(this.original=this.get(0),!this.modified&&this.hist||this.add_hist()):this.set(this.original),this.modified=!1)},a.prototype.add_hist=function(){var t,e,i;if(!this.hist){for(t=w.na(this.mindepth)?w.max_series_size:w.min(this.mindepth+1,w.max_series_size),t=Math.round(t),e=Array(t),i=0;i<t;i++)e[i]=NaN;this.hist=e,this.hist_pos=-1}this.hist_pos=(this.hist_pos+1)%this.hist.length,this.hist[this.hist_pos]=this.original},a.prototype.adopt=function(t,e,i){var o,n,s,r;return this.hist||(this.mindepth=NaN),o=e.get(),n=t.indexOf(o),0!==i&&(s=e.get(1),w.na(s)||(r=t.indexOf(s),n=n===r?-1:n)),n<0?NaN:this._get(n)},a.prototype.indexOf=function(t){var e,i,o,n,s,r;if(!this.hist)return this.mindepth=NaN,-1;if(w.na(t))return-1;for(e=this.symbol.index+1,i=this.hist.length,o=0,n=(e>i?i:e)-1,s=(n+o)/2|0;;){if(r=this._get(s),r>t){if(o=s+1,o>n)return s+1}else if(n=s-1,o>n)return s;s=(n+o)/2|0}},h.parseTicker=function(t){var e=t.indexOf(":");return e===-1?t:t.substr(e+1)},h.parsePeriod=function(t){var e,i,o,n,s,r,a,l;return t+="",e=t.slice(0),i=e.indexOf(",")>=0,i&&(n=e.split(","),o=h.parsePeriod(n[1]),e=n[0]),s=!1,r=!1,a=e[e.length-1],"DWM".indexOf(a)===-1&&("S"===a?r=!0:(s=!0,a="")),l=parseInt(s?e:e.length>1?e.slice(0,e.length-1):1),{resolution:a,interval:l,pureResolution:""+l+a,isIntraday:s,isSeconds:r,range:o}},h.newBarBuilder=function(t,e,i){var o=h.parsePeriod(t);return b.newBarBuilder(o.resolution,o.interval,e,i)},h.newSession=function(t,e){var i=y.get_timezone(t);return(new b.Session).init(i,e)},h.prototype.set_symbolinfo=function(t){t||console.error("WARN: symbolinfo isn't defined for "+this.tickerid),this.info=t,this.timezone=y.get_timezone(t.timezone),this.session.init(this.timezone,t.session);for(var e in this.other_sessions)this.other_sessions.hasOwnProperty(e)&&this.other_sessions[e].init(this.timezone,e)},h.prototype.get_session=function(t){if(!t)return this.session;var e=this.other_sessions[t];return e||(e=new b.Session,this.other_sessions[t]=e),e},h.prototype.isdwm=function(){return""!==this.resolution&&"S"!==this.resolution},h.prototype.enable_dwm_aligning=function(t,e){this.dwm_aligner=h.newBarBuilder(this.period,t,e)},h.prototype.bartime=function(t,e){var i,o,n,s,r=this.time;return t&&(i=t,e&&(i+=e),o=this.bb_cache[i],o||(n=this.get_session(e),o=h.newBarBuilder(t,n),this.bb_cache[i]=o),r=o.alignTime(r)),!this.isdwm()||isNaN(r)?r:(s=y.utc_to_cal(this.timezone,r),this.session.spec.correctTradingDay(s,this.timezone),y.cal_to_utc(this.timezone,s))},h.prototype.lastbar=function(t){var e,i;isNaN(t.time)||(e=t.time,this.dwm_aligner&&(this.dwm_aligner.moveTo(e),e=this.dwm_aligner.startOfBar(0)),i=this.time!==e,i&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=e,this.open=t.open,this.high=t.high,this.low=t.low,this.close=t.close,this.volume=t.volume,this.updatetime=t.updatetime,this.isNewBar=i,this.isBarClosed=t.isBarClosed,this.isNewBar&&this.index++,this.script.calc(this))},c.prototype.calc=function(t){var e,i=this.ctx,o=this.body;i.prepare(t),e=o.main(i,this.inputCallback),!isNaN(i.symbol.time)&&this.out&&this.out(i.symbol,e)},c.prototype.init=function(){var t=this.ctx,e=this.body;e.init&&e.init(t,this.inputCallback),e.main(t,this.inputCallback)},c.prototype.add_sym=function(t,e,i){var o=this.runner.add_sym(t,e,i,this);return this.symbols.push(o),o.isdwm()&&this.symbols.length>1&&o.enable_dwm_aligning(this.symbols[0].session,o.session),o},c.prototype.stop=function(){this.symbols=null,this.ctx.stop(),this.ctx=null},c.prototype.get_sym=function(t){return this.symbols[t]},d.prototype.add_sym=function(t,e,i,o){var n=new h(t,e,i,o);return this.symbols.push(n),n},d.prototype.get_sym=function(t){return this.symbols[t]},d.prototype.start=function(){function t(t,o){var n=d.feed.subscribe(t.tickerid,t.period,t.periodBase,function(t){e.update(o,t)},s.onErrorCallback,s.symbolInfo,s.sessionId,s.rangeExtension);i.push(n)}var e,i,o,n,s=this.host;for(this._script=new c(s.tickerid,s.period,s.periodBase||s.period,this,s.body,s.out,s.input),e=this,i=[],o=this.symbols,n=0;n<o.length;n++)t(o[n],n);this.subscription=i},d.prototype.stop=function(){var t,e=this.subscription;if(!e&&!this._script)return void console.warn("Recurring script engine stop happened.");for(t=0;t<e.length;t++)d.feed.unsubscribe(e[t]);this.subscription=null,this._script.stop(),this._script=null,this.symbols=null},d.prototype.update=function(t,e){var i,o;return e?(i=this.symbols[t],void(this.isRecalculated?(o=e.bar(e.count()-1),o.isBarClosed=e.isLastBarClosed(),i.lastbar(o)):this.barsets[t]||(this.barsets[t]=e,i.set_symbolinfo(e.symbolinfo()),this.recalc()))):void console.error("Unexpected barset = null")},d.prototype.recalc=function(){var t,e,i,o,n,s,r,a=this.symbols;for(t=0;t<a.length;t++)if(!this.barsets[t])return;for(e=a.length-1;e>=0;e--)for(i=a[e],o=this.barsets[e],n=o.count(),s=0;s<n;s++)r=o.bar(s),r.isBarClosed=s!==n-1||o.isLastBarClosed(),i.lastbar(r);this.isRecalculated=!0,this.host.recalc(this,{endOfData:this.barsets[0].endOfData,nextTime:this.barsets[0].nextTime})},d.feed={subscribe:function(t,e,i,o){console.error("must be initialized with setupFeed")},unsubscribe:function(t){console.error("must be initialized with setupFeed")}},u.prototype.stop=function(){this.runner.stop()},_.prototype.symbolinfo=function(){return this.info},_.prototype.isLastBarClosed=function(){return this.isBarClosed},_.prototype.bar=function(t){return this.bars[t]},_.prototype.count=function(){return this.bars.length},_.prototype.add=function(t,e){var i=t,o=this.bars,n=o.length,s=i.time,r=0===n?NaN:o[n-1].time,a=0===n||r<s;a?o.push(i):r===s?o[n-1]=i:console.error("time order violation, prev: "+new Date(r).toUTCString()+", cur: "+new Date(s).toUTCString()),this.isBarClosed=!!e},f.prototype.init=function(t){this.bb=h.newBarBuilder(this.period,t.symbol.session),this.bbEmptyBars=this.generateEmptyBars?h.newBarBuilder(this.period,t.symbol.session):void 0},f.prototype.extrapolate=function(t,e){return isNaN(t)||isNaN(e)?void 0:b.extrapolateBarsFrontToTime(this.bbEmptyBars,t,e)},f.prototype.main=function(t){var e=t.symbol.time,i=this.bb.alignTime(e),o=t.new_var(i),n=w.na(i),s=o.get(1),r=w.na(s)?1:w.neq(i,s),a=t.new_var(),l=t.new_var(),h=t.new_var(),c=t.new_var(),d=a.get(1),p=l.get(1),u=h.get(1),_=c.get(1),f=n?NaN:r?w.open(t):d,g=n?NaN:r?w.high(t):w.max(w.high(t),p),m=n?NaN:r?w.low(t):w.min(w.low(t),u),v=n?NaN:w.close(t),y=n?NaN:r?w.volume(t):w.volume(t)+_,b=n?NaN:e,S=t.symbol.isBarClosed&&this.bb.isLastBar(e),T=this.generateEmptyBars&&r?this.extrapolate(s,i):void 0,C=t.new_var(w.close(t)),x=C.get(1),P=T instanceof Array?x:NaN;return a.set(f),l.set(g),h.set(m),c.set(y),[i,f,g,m,v,y,b,S,T,P]},g.prototype.main=function(t){var e,i,o,n,s=t.new_var(w.open(t)),r=t.new_var(w.close(t)),a=s.get(1),l=r.get(1),h=w.ohlc4(t),c=w.na(s.get(1))?(w.open(t)+w.close(t))/2:(a+l)/2;return s.set(c),r.set(h),e=w.max(w.high(t),w.max(c,h)),i=w.min(w.low(t),w.min(c,h)),o=w.volume(t),n=t.symbol,[n.time,c,e,i,h,o,n.updatetime,n.isBarClosed]},m.prototype.main=function(t){var e=w.open(t),i=w.high(t),o=w.low(t),n=w.close(t),s=w.volume(t);return[e,i,o,n,s]},{Std:w,Series:a,Symbol:h,SymbolInfo:l,StudyEngine:u,BarSet:_,OHLCV:m,BarBuilder:f,HeikenAshi:g,setupFeed:p}}(this);t.exports=o}).call(e,function(){return this}())},function(t,e,i){(function(e,o){"use strict";var n,s,r=i(502),a=i(500),l=i(503),h=i(504),c=i(505),d=i(116),p=i(41),u=i(38);i(506),i(507),n=i(508).DatafeedRequestsCachedProcessor,s=function(t){function i(t,i){var n,s,r=!e.enabled("disable_resolution_rebuild");return r&&p.isDWM(t)?(n=o.get_timezone(i.timezone),s=new d.Session,s.init(n,i.session),a.Symbol.newBarBuilder(t,s,s)):null}function s(t,e,i,o,n){return _._cachedDatafeed.subscribe(t,e,i,o,n)}function r(t){return _._cachedDatafeed.unsubscribe(t)}function u(t,e,i){_.resolveSymbol(t,e,i)}var _=this;this._studiesCache={},this._metainfoCache=[],this._extrapolationManager=h,this._externalDatafeed=t,this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._callbacks={},this._serverTimeOffset=0,_._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),_._datafeedConfiguration=_._adoptConfigurationData(window.configurationData),_._fireEvent("configuration_received"),_._externalDatafeed.getServerTime&&_._externalDatafeed.getServerTime(function(t){_._serverTimeOffset=t-(new Date).valueOf()/1e3}),this._pointsetsManager=c,this._rangeExtensionData={},this._quotesInfo=[],this._endOfData={},this._computeStudyCounter=0,this._create_dwm_aligner=i,this._cachedDatafeed=new n(t,i),this._extendedRange=function(t){return _._rangeExtensionData[t]&&_._rangeExtensionData[t].summary},this._extendedTime=function(t){return _._rangeExtensionData[t]&&_._rangeExtensionData[t].time},l.setupFeed({resolve:u,subscribe:s,unsubscribe:r,calculateHistoryDepth:this._externalDatafeed.calculateHistoryDepth.bind(this._externalDatafeed)})},s.prototype.destroy=function(){this._externalDatafeed=null},s.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={}},s.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},s.prototype._logMessage=function(t){e.enabled("charting_library_debug_mode")&&console.log(t)},s.prototype._extendRange=function(t,e){this._rangeExtensionData[t]||(this._rangeExtensionData[t]={}),void 0===this._rangeExtensionData[t].summary&&(this._rangeExtensionData[t].summary=0),this._rangeExtensionData[t].summary+=e},s.prototype.on=function(t,e){return this._callbacks.hasOwnProperty(t)||(this._callbacks[t]=[]),this._callbacks[t].push(e),this},s.prototype._fireEvent=function(t,e,i){var o,n;if(this._callbacks.hasOwnProperty(t)){for(o=this._callbacks[t],n=0;n<o.length;++n)o[n](e);i||(this._callbacks[t]=[])}},s.prototype._adoptConfigurationData=function(t){var e,i,o,n=TradingView.merge({},t),s=n.supported_resolutions;if(!s||0===s.length)return n.supported_resolutions=void 0,n;for(e={},i=0;i<s.length;i++){if(o=s[i],e.hasOwnProperty(o))throw Error("Duplicating resolution `"+o+"`");e[o]=1}return n.supported_resolutions=e,n},s.prototype.supportedResolutions=function(){return this._datafeedConfiguration.supported_resolutions},s.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},s.prototype.supportedExchangesList=function(){return this._datafeedConfiguration.exchanges||[]},s.prototype.futuresRegex=function(){return this._datafeedConfiguration.futures_regex||/$a/},s.prototype._createStudyLogicObject=function(t){var e,i=t.split("@")[0],o=JSServer.studyLibrary.filter(function(e){return e.metainfo.id===t||e.metainfo.shortDescription===i});if(0===o.length)throw Error("Study `"+t+"` not found");return e=o[0],new e.constructor},s.prototype.getMarks=function(t,e,i,o,n){function s(t){function e(e,i){return isArray(t[e])?t[e][i]:t[e]}var i,o,n=isArray(t);if(n)return t;for(i=[],o=0;o<t.id.length;++o)i.push({id:e("id",o),time:e("time",o),color:e("color",o),text:e("text",o),label:e("label",o),labelFontColor:e("labelFontColor",o),minSize:e("minSize",o)});return i}var r,a={red:6,green:5,blue:4,yellow:3};this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks&&(this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(t.full_name,n,new Date(1e3*e).toUTCString(),new Date(1e3*i).toUTCString())),r=this,this._externalDatafeed.getMarks(t,e,i,function(e){var i,l,h=s(e).map(function(t){return t.time=parseInt(t.time),t});r._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(t.full_name,n,JSON.stringify(h))),i=r._create_dwm_aligner(n,t),l=h.map(function(t){return t.tickmark=null!==i?i.tradingDayToSessionStart(1e3*t.time)/1e3:t.time,t.direction=a[t.color],t.onClicked=function(){u.emit("onMarkClick",t.id)},t.label=!!t.label&&t.label[0],t}),o(l)},n))},s.prototype.getTimescaleMarks=function(t,e,i,o,n){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(t.full_name,n,new Date(1e3*e).toUTCString(),new Date(1e3*i).toUTCString()));var s=this;this._externalDatafeed.getTimescaleMarks(t,e,i,function(e){var i,r;s._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(t.full_name,n,JSON.stringify(e))),i=s._create_dwm_aligner(n,t),r=e.map(function(t){return t.tickmark=null!==i?i.tradingDayToSessionStart(1e3*t.time)/1e3:t.time,t}),o(r)},n)}},s.prototype._computeStudy=function(t,e,i,o,n,s,r,l,h){function c(t,e,i){var o,n,s,r,a=t.time,h="number"==typeof e?[e]:e;for(o=0;o<h.length;++o)n=h[o],n&&"object"==typeof n&&(_["plot_"+o]=n.offset,n=n.value,f++),"number"==typeof n&&isNaN(n)&&(n=void 0),h[o]=n;s=u.length-1,r=s<0||a>u[s].value[0],r?u.push({index:u.length,value:[a].concat(h)}):u[s].value=[a].concat(h),d||l([u[u.length-1]],r,u.length,_,i)}var d=!0,p=this._computeStudyCounter++,u=[],_={},f=0,g=this,m=function(l){var p,m=a.Symbol.parsePeriod(o);if(m.isIntraday&&!l.has_intraday)return void h("Unsupported resolution");if(p=new a.StudyEngine({tickerid:i,symbolInfo:l,period:o,body:e,sessionId:t,onErrorCallback:h,rangeExtension:{getRangeExtensionCount:g._extendedRange.bind(this,t),getRangeExtensionTime:g._extendedTime.bind(this,t)},input:function(t){return s[t]},out:function(t,e){c(t,e,l)},recalc:function(t,e){d=!1,r(u,f>0?_:void 0,l,e)}}),!g._studiesCache[t]||!g._studiesCache[t][n])throw Error("This should never happen");g._studiesCache[t][n].engine=p},v=function(t){h(t)},y=function(){return g._studiesCache[t]&&g._studiesCache[t][n]&&g._studiesCache[t][n].activeResolve===p};g._studiesCache[t][n].activeResolve=p,this.resolveSymbol(i,function(){y()&&m.apply(g,arguments)},function(){y()&&v.apply(g,arguments)})},s.prototype._createStudy=function(t,e,i,o,n,s,r){var a=this;TradingView.ChartapiMessagerInstances[o].onStudyLoading(n,s),a._computeStudy(o,i,t,e,n,r,function(i,r,l){TradingView.ChartapiMessagerInstances[o].onDataUpdate(n,s,a._convertBarsTimeToUnix(i),r,l,a._extendedRange(t,e)),TradingView.ChartapiMessagerInstances[o].onStudyCompleted(n,s)},function(i,r,l,h,c){TradingView.ChartapiMessagerInstances[o].onDataUpdate(n,s,a._convertBarsTimeToUnix(i),h,c,a._extendedRange(t,e))},function(t){TradingView.ChartapiMessagerInstances[o].onStudyError(n,t)})},s.prototype.purgeEndOfDataFlags=function(t,e){for(var i in this._studiesCache[t])e&&e!==i||(this._studiesCache[t][i].firstBarTime=null)},s.prototype.stopSources=function(t){var e,i;for(e in this._studiesCache[t])i=this._studiesCache[t][e],i&&(i.engine&&i.engine.stop(),i.activeResolve=-1);l.unsubscribeUnused()},s.prototype.recreateSources=function(t,e,i,o){var n,s;this.stopSources(i);for(n in this._studiesCache[i])s=this._studiesCache[i][n],s&&(s.symbol=t,s.resolution=e,"series"===s.type&&this.createSeries(t,e,i,n,s.turnaround,o));for(n in this._studiesCache[i])s=this._studiesCache[i][n],s&&"study"===s.type&&this._createStudy(t,e,s.studyObject,i,n,s.turnaround,s.inputs)},s.prototype.removeStudy=function(t,e){this._studiesCache[t]&&this._studiesCache[t][e]&&this._studiesCache[t][e].engine&&(this._studiesCache[t][e].engine.stop(),l.unsubscribeUnused()),this._studiesCache[t][e]=null},s.prototype.removeSeries=function(t,e){this.removeStudy(t,e)},s.prototype.recomputeStudy=function(t,e,i,o){var n=this._studiesCache[i][t];if(!n)throw Error("This should never happen");n.inputs=e,n.turnaround=o,n.engine&&n.engine.stop(),this._createStudy(n.symbol,n.resolution,n.studyObject,i,t,o,e)},s.prototype._convertBarsTimeToUnix=function(t){var e,i,o=[];for(e=0;e<t.length;++e)i={index:t[e].index,value:[].concat(t[e].value)},i.value[0]/=1e3,o.push(i);return o},s.prototype.createStudy=function(t,e,i,o,n,s,r){var a=this._createStudyLogicObject(s);this._studiesCache[i]=this._studiesCache[i]||{},this._studiesCache[i][o]={studyObject:a,symbol:t,resolution:e,guid:o,type:"study",inputs:r,turnaround:n},this._createStudy(t,e,a,i,o,n,r)},s.prototype.purgeRangeExtensionData=function(t){t?this._rangeExtensionData[t]={summary:0}:this._rangeExtensionData={}},s.prototype.ensureExtendedTo=function(t,e,i){var o,n=this._studiesCache[e][t];if(!n)throw Error("This should never happen");this.purgeRangeExtensionData(e),this._rangeExtensionData[e]||(this._rangeExtensionData[e]={}),this._rangeExtensionData[e].time=i,o=this,setTimeout(function(){o.recreateSources(n.symbol,n.resolution,e,!0)},0)},s.prototype.extendSeriesRange=function(t,e,i){var o,n,s=this._studiesCache[e][t];if(!s)throw Error("This should never happen");return this._isEndOfData(e,t,s.turnaround)?(o=s.engine.runner.host.symbolInfo.data_status,void setTimeout(function(){TradingView.ChartapiMessagerInstances[e].onSeriesCompleted(t,s.turnaround,o)},0)):(i+=10,this._extendRange(e,i),n=this,void setTimeout(function(){n.recreateSources(s.symbol,s.resolution,e,!0)},0))},s.prototype.updateSeriesTurnaround=function(t,e,i){this._studiesCache[t]||(this._studiesCache[t]={}),this._studiesCache[t][e]||(this._studiesCache[t][e]={}),this._studiesCache[t][e].type="series",this._studiesCache[t][e].turnaround=i},s.prototype.seriesTurnaround=function(t,e){return this._studiesCache[t]&&this._studiesCache[t][e]&&this._studiesCache[t][e].turnaround},s.prototype.createSeries=function(t,i,o,n,s,r){function l(t,e,n){var s=h._extrapolationManager.storage(o,t.full_name,i);s.setLastBarTime(e,n)}var h,c=t,d=new a.OHLCV;this._studiesCache[o]=this._studiesCache[o]||{},this._studiesCache[o][n]={symbol:t,resolution:i,studyObject:d,guid:n,type:"series",turnaround:s},TradingView.ChartapiMessagerInstances[o].onSeriesLoading(n,s),h=this,this._computeStudy(o,d,c,i,n,[],function(t,e,a,c){var d,p,u,_,f,g=h._studiesCache[o][n];if(!g)throw Error("This should never happen");return d=h._convertBarsTimeToUnix(t),p=d.length>0?1e3*d[0].value[0]:void 0,c.nextTime&&(!p||c.nextTime<p/1e3)?void h.ensureExtendedTo(n,o,c.nextTime):(0!==d.length&&(g.firstBarTime=p,u=d[d.length-1],l(a,d.length-1,1e3*u.value[0]),r&&TradingView.ChartapiMessagerInstances[o].onSeriesClearData(n,s),TradingView.ChartapiMessagerInstances[o].onTimescaleUpdate(n,s,d,a,0),_=h._extrapolationManager.storage(o,a.full_name,i),h._pointsetsManager.broadcastPointsetsUpdates(a.full_name,i,t,_,a,function(t,e){TradingView.ChartapiMessagerInstances[o].onPointsetDataUpdate(t,s,e,a)})),f=0===d.length||c&&c.endOfData,f&&(h._logMessage("Series has no more data on server: {0}".format(a.full_name)),h._setEndOfData(o,n,s),0===d.length&&TradingView.ChartapiMessagerInstances[o].onSeriesClearData(n,s)),void TradingView.ChartapiMessagerInstances[o].onSeriesCompleted(n,s,a.data_status))},function(t,e,r,a,c){var d,p,u=h._convertBarsTimeToUnix(t),_=u[u.length-1];if(e){if(d=h._studiesCache[o][n],!d)throw Error("This should never happen");p=r-1,h._logMessage("New bar arrived: symbol {0}, bar {1}".format(c.full_name,JSON.stringify(_))),TradingView.ChartapiMessagerInstances[o].onTimescaleUpdate(n,s,[_],c,p),l(c,p,1e3*_.value[0]),h.rebuildExtrapolatedData(o,c.full_name,i,c,1e3*_.value[0])}else h._logMessage("Last bar update: symbol {0}, bar {1}".format(c.full_name,JSON.stringify(_))),TradingView.ChartapiMessagerInstances[o].onDataUpdate(n,s,u,void 0,c);h._fireEvent("realtime_tick",t[t.length-1],!0)},function(t){h._logMessage("Series error: {0}".format(t)),TradingView.ChartapiMessagerInstances[o].onSeriesError(n,t),e.enabled("clear_bars_on_series_error")&&TradingView.ChartapiMessagerInstances[o].onSeriesClearData(n,s)})},s.prototype.onMoreTickmarksRequested=function(t,e,i,o,n){this._extrapolationManager.storage(t,i.full_name,o).onTickmarksNeeded(i,n)},s.prototype.removePointset=function(t){this._pointsetsManager.removePointset(t)},s.prototype.rebuildExtrapolatedData=function(t,e,i,o,n){this._extrapolationManager.storage(t,o.full_name,i).rebuild(n,o)},s.prototype.createPointset=function(t,e,i,o,n,s){var r=this._extrapolationManager.storage(t,o.full_name,n);this._pointsetsManager.createPointset(e,i,n,s,r,o)},s.prototype.studiesMetadata=function(){return 0===this._metainfoCache.length&&(this._metainfoCache=JSServer.studyLibrary.map(function(t){return t.metainfo})),this._metainfoCache},s.prototype.searchSymbols=function(t,e,i,o){function n(t){s._logMessage("Symbol search response: {0}".format(JSON.stringify(t))),o(t)}this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(t,e,i));var s=this;"function"==typeof this._externalDatafeed.searchSymbols?this._externalDatafeed.searchSymbols(t,e,i,n):this._externalDatafeed.searchSymbolsByName(t,e,i,n)},s.prototype.validateSymbolInfo=function(t){function e(t){console.warn("SymbolInfo validation: "+t)}var i,o;if((void 0===t.minmov||t.minmov<=0)&&e("minmov must be positive"),(void 0===t.pricescale||t.pricescale<=0)&&e("pricescale must be positive"),void 0!==t.name&&0!==t.name.length||e("name must be non-empty stirng"),void 0!==t.session&&0!==t.session.length||e("session must be non-empty stirng"),void 0!==t.timezone&&0!==t.timezone.length||e("timezone must be non-empty stirng"),void 0!==t.intraday_multipliers)if(i=t.intraday_multipliers,Array.isArray(i))for(o=0;o<i.length;++o)"string"!=typeof i[o]&&e('intraday_multipliers[{0}] = "{1}" must be string (now: {2})'.format(o+1,i[o],typeof i[o]));else e("intraday_multipliers must be array")},s.prototype.resolveSymbol=function(t,e,i){var o,n=l.parseSymbol(t).symbol;this._resolveRequests[n]?o=this._resolveRequests[n]:(o=this.resolveSymbolInternal(n),this._resolveRequests[n]=o),
o.done(e).fail(i)},s.prototype.resolveSymbolInternal=function(t){var e,i=this,o=$.Deferred();return this._logMessage("Symbol resolve requested: `{0}` ".format(t)),e=!0,this._externalDatafeed.resolveSymbol(t,function(n){e&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),i._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(t,JSON.stringify(n))),n.base_name||(n.base_name=[n.name]),n.legs||(n.legs=[n.name]),n.exchange||(n.exchange=n["exchange-listed"]),n.full_name||(n.full_name=n.symbol||n.exchange+":"+n.name),n.pro_name||(n.pro_name=n.name),n.data_status||(n.data_status="streaming"),n.ticker||(n.ticker=n.symbol),!n.session&&n["session-regular"]&&(n.session=n["session-regular"]),!n.minmov&&n.minmovement&&(n.minmov=n.minmovement),i.validateSymbolInfo(n),i._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(t,JSON.stringify(n))),o.resolve(n)},function(e){i._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(t,e)),o.reject(e)}),e=!1,o.promise()},s.prototype._createMarketStatusWatchers=function(t,e){void 0===this._marketStatusWatchers[t]&&(this._marketStatusWatchers[t]={});var i=this;e.forEach(function(e){void 0===i._marketStatusWatchers[t][e]&&(i._marketStatusWatchers[t][e]=new r(i,t,e))})},s.prototype._removeMarketStatusWatchers=function(t){var e=this;Object.keys(this._marketStatusWatchers[t]||{}).forEach(function(i){e._marketStatusWatchers[t][i].stop()}),this._marketStatusWatchers[t]={}},s.prototype._stopQuotesSubscription=function(t){this._quotesInfo[t].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[t].listenerGUID),this._quotesInfo[t].listenerGUID=void 0),this._removeMarketStatusWatchers(t)},s.prototype._startQuotesSubscription=function(t){function i(e,i){var o=s._marketStatusWatchers[t][e.n];e.symbolname=e.n,e.status=e.s,e.values=e.v,e.values.change=e.v.ch,e.values.last_price=e.v.lp,e.values.change_percent=e.v.chp,e.values.current_session=e.v.cs||o&&o.marketStatus(),e.values.pricescale=i.pricescale,e.values.minmov=i.minmov,e.values.minmove2=i.minmove2||0,e.values.fractional=i.fractional||!1,o&&e.v.cs&&o.stop(),TradingView.ChartapiMessagerInstances[t].onQuotesData([t].concat([e]))}function o(t){t.forEach(function(t){void 0!==n[t.n]?null!==n[t.n]&&i(t,n[t.n]):s.resolveSymbol(t.n,function(e){n[t.n]=e,i(t,e)},function(){n[t.n]=null})})}var n={},s=this,r=this._quotesInfo[t].symbols;0!==r.length&&(this._externalDatafeed.getQuotes&&!e.enabled("charting_library")&&this._externalDatafeed.getQuotes(r,function(e){s._quotesInfo[t]&&(o(e),s._quotesInfo[t].listenerGUID=t,s._externalDatafeed.subscribeQuotes(r,s._quotesInfo[t].fastSymbols,o,s._quotesInfo[t].listenerGUID))}),this._createMarketStatusWatchers(t,r))},s.prototype._restartQuotesSubscription=function(t){this._stopQuotesSubscription(t),this._startQuotesSubscription(t)},s.prototype.quoteCreateSession=function(t){this._quotesInfo[t]={symbols:[],fastSymbols:[],listenerGUID:void 0}},s.prototype.quoteDeleteSession=function(t){this._stopQuotesSubscription(t),this._quotesInfo[t]=null},s.prototype.quoteSetFields=function(t,e){},s.prototype.quoteAddSymbols=function(t,e){this._quotesInfo[t].symbols=this._filteredSymbols(this._quotesInfo[t].symbols.concat(e)),this._restartQuotesSubscription(t)},s.prototype.quoteRemoveSymbols=function(t,e){this._quotesInfo[t].symbols=this._quotesInfo[t].symbols.filter(function(t){return e.indexOf(t)<0}),this._restartQuotesSubscription(t)},s.prototype.quoteFastSymbols=function(t,e){this._quotesInfo[t].fastSymbols=this._filteredSymbols(e),this._restartQuotesSubscription(t)},s.prototype.quoteHibernateAll=function(t){},s.prototype._filteredSymbols=function(t){var e=[];return t.forEach(function(t){t instanceof Object||e.indexOf(t)<0&&e.push(t)}),e},s.prototype._isEndOfData=function(t,e,i){var o=t+"!"+e+"@"+i;return!!this._endOfData[o]},s.prototype._setEndOfData=function(t,e,i){var o=t+"!"+e+"@"+i;this._endOfData[o]=!0},s.prototype.alignTimePoint=function(t,e,i){var o=this._create_dwm_aligner(e,i);return o?o.tradingDayToSessionStart(1e3*t)/1e3:t},s.prototype.serverTimeOffset=function(){return this._serverTimeOffset},t.exports=s}).call(e,i(1),i(33))},function(t,e,i){(function(e){"use strict";var o=i(116),n={},s=function(t,i,s){function r(){var t={};t.symbolname=_,t.status="ok",t.values={},t.values.current_session=p,n[_]=p,TradingView.ChartapiMessagerInstances[f].onQuotesData([f].concat([t]))}function a(t,i,n){var s=e.get_timezone(i);h=(new o.Session).init(s,t),c=n,g=setTimeout(l,6e4),l(),r()}function l(){var t,e;if(h){if(c)return void(p="out_of_session");t=o.isTradingNow(new Date,h),e=t?"market":"out_of_session",e!==p&&(p=e,r())}}var h,c,d={},p=n[s]||"out_of_session",u=!1,_=s,f=i,g=null;return t.resolveSymbol(s,function(t){u||a(t.session,t.timezone,t.expired)},function(){}),d.stop=function(){u=!0,g&&clearTimeout(g)},d.marketStatus=function(){return p},d};t.exports=s}).call(e,i(33))},function(t,e,i){(function(e){"use strict";var o=function(){function t(t){this.host=t,this.cache={}}function o(t,e,i,o,s){var r=n(o)?"_":"";return s+t+e+i+r}function n(t){return t.has_empty_bars||t.force_session_rebuild}function s(t){if(0!==t.indexOf("="))return{symbol:t};var e;try{e=JSON.parse(t.slice(1))}catch(e){return{symbol:t}}return e.type&&(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-")?e.builder=new c.HeikenAshi:console.error("unknown builder type: "+e.type)),"string"!=typeof e.symbol&&(e.session=e.symbol.session||e.session,e.symbol=e.symbol.symbol),e}function r(e){t.instance=new t(e),c.setupFeed(t.instance)}var a,l,h,c=i(500),d=i(116),p=c.Symbol,u=c.StudyEngine,_=c.BarBuilder,f=c.BarSet;return t.prototype.getCache=function(t){return this.cache[t]},t.prototype.putCache=function(t,e){this.cache[t]=e},t.prototype.subscribe=function(t,e,i,n,s,r,a,l){var h=o(t,e,i,r,a),c=this.getCache(h);return c||(c=this.createItem(t,e,i,r,l),this.putCache(h,c)),c.listeners.addListener(n,s),{key:h,listener:n}},t.prototype.unsubscribe=function(t){var e=this.getCache(t.key);e&&e.listeners.removeListener(t.listener)},t.prototype.removeUnused=function(){var t,e,i,o,n,s=[];for(t in this.cache)this.cache[t]&&(e=this.cache[t],0===e.listeners.listenersCount()&&s.push(t));if(0!==s.length){for(i=0;i<s.length;i++)o=s[i],n=this.cache[o],this.cache[o]=null,n.stop();this.removeUnused()}},t.prototype.rebuildFrom=function(t,e,i){var o,n,s,r,a=p.parsePeriod(t),l=p.parsePeriod(e);if(""!==a.resolution&&!a.isSeconds){if(i.has_weekly_and_monthly)return a.resolution;if(void 0===i.has_daily||i.has_daily)return"D";""!==l.resolution&&(l.resolution="",l.interval=i.intraday_multipliers?i.intraday_multipliers[0]:1)}if(a.isIntraday&&void 0!==i.has_intraday&&!i.has_intraday)return"";if(a.isSeconds&&!i.has_seconds)return"";if(o=""!==a.resolution?l.interval:""===l.resolution?Math.min(a.interval,l.interval):a.interval,n=a.isIntraday?i.intraday_multipliers:i.seconds_multipliers,n&&-1===n.indexOf(o)){for(s=n.length-1;s>=0;s--)if(r=+n[s],o%r===0)return r+(a.isSeconds?"S":"");return""}return o+(a.isSeconds?"S":"")},t.prototype.createItem=function(t,e,i,o,r){var c,d,p,u,f,g=new h,m=s(t);return m.builder?new l(g,m.symbol,e,i,m.builder,o,r):(c=this.rebuildFrom(e,i,o),d=n(o),e!==c||d?(p=o.has_empty_bars,u=$.extend({},o),d&&(u.has_empty_bars=!1,u.force_session_rebuild=!1),new l(g,m.symbol,e,c,new _(e,p),u,r)):(f=m.session&&"extended"!==m.session,new a(g,m.symbol,e,i,f,this.host,o,r)))},a=function(t,e,i,o,n,s,r,a){this.listeners=t,this.host=s;var l=this;this.host.resolve(e,function(t){n&&t.regular_session&&(t.session=t.regular_session);var s=l.calculateFromTo(t,o||i,e,a);l.subs=l.host.subscribe(t,i,s,function(t){l.listeners.fire(t)},function(t){l.listeners.onError(t)})},function(t){l.listeners.onError(t)})},a.prototype._create_dwm_aligner=function(t,i){var o=e.get_timezone(i.timezone),n=new d.Session;return n.init(o,i.session),p.newBarBuilder(t,n,n)},a.prototype.stop=function(){this.host.unsubscribe(this.subs)},a.prototype.calculateFromTo=function(t,i,o,n){var s,r,a,l,h,c,u,_,f=p.parsePeriod(i),g=(new Date).valueOf(),m=t.expired?e.cal_to_utc(e.get_timezone(t.timezone),new Date(1e3*t.expiration_date))||g:g;return""===f.resolution?(r=f.interval,a="D"):"S"===f.resolution?(r=10*f.interval,a=""):(l="D"===f.resolution?1:"W"===f.resolution?5:30,r=12*l*f.interval,a="M"),f.range?(r=f.range.interval,a=f.range.resolution):this.host.calculateHistoryDepth&&(h=this.host.calculateHistoryDepth(i,a,r),h&&(r=h.intervalBack||r,a=void 0===h.resolutionBack?a:h.resolutionBack)),c=t.sessionString||t.session,s=d.alignPeriodsBack(c,a,r,1,m),n&&n.getRangeExtensionTime&&(u=n.getRangeExtensionTime(),u&&(s=Math.min(1e3*u,s))),n&&n.getRangeExtensionCount&&(_=n.getRangeExtensionCount(),_>0&&(s=d.alignPeriodsBack(c,f.resolution,f.interval,_,s))),{from:s,to:m+6e4}},l=function(t,e,i,o,n,s,r){if(this.listeners=t,this.isRecalculated=!1,""===o)return console.error("unsupported resolution for rebuild: "+i),void this.listeners.onError("unsupported resolution for rebuild: "+i);this.symbolInfo=s;var a=this;this.engine=new u({tickerid:e,period:o,periodBase:i,body:n,symbolInfo:s,rangeExtension:r,recalc:function(t,e){a._recalc(e)},out:function(t,e){a._out(t,e)},onErrorCallback:function(t){a.listeners.onError(t)}})},l.prototype.stop=function(){this.engine?this.engine.stop():console.error("Internal library error 0x1")},l.prototype._recalc=function(t){this.isRecalculated&&console.error("recalc called twice!"),this.barset||(this.barset=new f(this.symbolInfo)),t&&(this.barset.nextTime=t.nextTime,this.barset.endOfData=t.endOfData),this.listeners.fire(this.barset),this.isRecalculated=!0},l.prototype._out=function(t,e){var i,o,n,s,r,a,l,h=e[0];if(!isNaN(h)){if(i={time:h,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],updatetime:e[6]},o=e[7],this.barset||(this.barset=new f(t.info)),n=e[8],n instanceof Array)for(s=0;s<n.length;s++)r=e[9],a=n[s],l={time:a,open:r,high:r,low:r,close:r,volume:0,updatetime:a},this.barset.add(l,!0),this.isRecalculated&&this.listeners.fire(this.barset);this.barset.add(i,o),this.isRecalculated&&this.listeners.fire(this.barset)}},h=function(){this.listeners=[]},h.prototype.listenersCount=function(){return this.listeners.reduce(function(t,e){return t+(e?1:0)},0)},h.prototype.addListener=function(t,e){this.listeners.push({dataListener:t,onErrorCallback:e}),this.barset&&t(this.barset),this.errorMsg&&e(this.errorMsg)},h.prototype.removeListener=function(t){var e,i=this.listeners.filter(function(e){return e.dataListener===t});0!==i.length&&(e=this.listeners.indexOf(i[0]),delete this.listeners[e])},h.prototype.onError=function(t){var e,i,o,n;for(this.errorMsg=t||"unspecified error",e=this.listeners,i=e.length,o=0;o<i;o++)n=e[o],n&&n.onErrorCallback&&n.onErrorCallback(t)},h.prototype.fire=function(t){var e,i,o,n;for(this.barset=t,e=this.listeners,i=e.length,o=0;o<i;o++)n=e[o],n&&n.dataListener(t)},{setupFeed:r,parseSymbol:s,unsubscribeUnused:function(){t.instance.removeUnused()}}}();t.exports=o}).call(e,i(33))},function(t,e,i){"use strict";var o=function(){function t(t,e,i){return t+","+e+","+i}function e(e,i,o){delete n[t(e,i,o)]}function o(e,i,o){function r(t){return"undefined"!=typeof TradingView&&TradingView.ChartapiMessagerInstances?n[t]=new a(TradingView.ChartapiMessagerInstances[e],l.pureResolution):n[t]=new a(null,l.pureResolution),n[t]}var l=s.Symbol.parsePeriod(o),h=t(e,i,l.pureResolution);return n[h]?n[h]:r(h)}var n={},s=i(500),r=i(116),a=function(t,e,i){this._chartApiMessager=t,this._lastRealBarTime=null,this._lastRealBarIndex=null,this._resolution=e,this._extrapolatedBarsCache=[],this._onReadyCallbacks=[],this._maxDepth=i||100};return a.prototype.ready=function(){return null!==this._lastRealBarIndex},a.prototype.rebuild=function(t,e){this._lastRealBarTime=t,this._extrapolatedBarsCache=[],this.ensureExtrapolatedToBar(e,this._lastRealBarIndex)},a.prototype.historyExtrapolator=function(){return void 0===this._historyExtrapolator&&(this._historyExtrapolator=new a(null,this._resolution,Math.max(this._maxDepth,1e3))),this._historyExtrapolator},a.prototype.getPointTimeUTC=function(t,e,i){var o,n;return 0===e?t:!this.ready()||t<this._lastRealBarTime/1e3?(this.historyExtrapolator().setLastBarTime(0,1e3*t),this.historyExtrapolator().getPointTimeUTC(t,e,i)):(o=0===this._extrapolatedBarsCache.length||t===this._lastRealBarTime/1e3,n=o?-1:this.indexOfBar(t,i)-this._lastRealBarIndex-1,this.ensureExtrapolatedToBar(i,n+e+1),this._extrapolatedBarsCache[n+e])},a.prototype.findDistanceInBars=function(t,e,i){return t===e?0:(this.historyExtrapolator().setLastBarTime(0,1e3*t),this.historyExtrapolator().indexOfBar(e,i))},a.prototype.indexOfBar=function(t,e){this._ensureExtrapolatedToTime(e,1e3*t);var i=r.lower_bound(this._extrapolatedBarsCache,t,function(t,e){return t>e?1:t<e?-1:0});return i===-1?i:this._lastRealBarIndex+i+1},a.prototype._extrapolateData=function(t,e){var i,o,n;if(!this._lastRealBarTime)throw Error("No real bars known, so cannot extrapolate anything");if(i=e(this._lastRealBarTime),!i||0===i.length)return void(null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,this._extrapolatedBarsCache,t,this._resolution));for(o=0;o<i.length;++o)i[o]=i[o]/1e3;for(i[0]===this._lastRealBarTime/1e3&&(i=i.slice(1)),this._extrapolatedBarsCache=i,n=i.slice(0),n.sort(),o=0;o<n.length-1;++o)n[o]===n[o+1]&&console.error("Duplicating extrapolated bars: duplicated "+new Date(1e3*n[o]));null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,i,t,this._resolution)},a.prototype.onTickmarksNeeded=function(t,e){if(this.ready())this.ensureExtrapolatedToBar(t,e);else{var i=this;this._onReadyCallbacks.push(function(){i.ensureExtrapolatedToBar(t,e)})}},a.prototype.ensureExtrapolatedToBar=function(t,e){var i=this;return this._extrapolateData(t,function(o){return i._extrapolatedBarsCache.length>=e||!i._shouldExtrapolateMore()?null:r.extrapolateBarsFrontByCount(i.newBarBuilder(t),o,e)})},a.prototype._ensureExtrapolatedToTime=function(t,e){var i=this;return this._extrapolateData(t,function(o){if(o>=e||!i._shouldExtrapolateMore())return null;var n=r.extrapolateBarsFrontToTime(i.newBarBuilder(t),o,e);return n[n.length-1]<e&&console.warn("Extrapolation error: not enough data created"),n})},a.prototype.newBarBuilder=function(t){var e=s.Symbol.newSession(t.timezone,t.session);return s.Symbol.newBarBuilder(this._resolution,e)},a.prototype._shouldExtrapolateMore=function(){return this._extrapolatedBarsCache.length<this._maxDepth},a.prototype.setLastBarTime=function(t,e){(null===this._lastRealBarIndex||this._lastRealBarIndex===t&&this._lastRealBarTime!==e)&&(this._extrapolatedBarsCache=[]),this._extrapolatedBarsCache&&this._extrapolatedBarsCache.length&&this._lastRealBarIndex!==t&&(this._lastRealBarIndex>t?this._extrapolatedBarsCache=[]:this._extrapolatedBarsCache.shift(t-this._lastRealBarIndex)),this._lastRealBarIndex=t,this._lastRealBarTime=e;for(var i=0;i<this._onReadyCallbacks.length;++i)this._onReadyCallbacks[i]();this._onReadyCallbacks=[]},{remove:e,storage:o}}();t.exports=o},function(t,e,i){(function(e){"use strict";var o=i(116),n=i(41),s=function(){function t(t,e){return t}function s(t,e){var i=new n(e),s=g.get_timezone(t.timezone),r=new o.Session;return r.init(s,t.session),i.isDWM()?f.Symbol.newBarBuilder(e,r,r):null}function r(e,i,o,n,s,r){var a,l,h,c,d=t(i,o);for(u.hasOwnProperty(d)||(u[d]=[]),a=[],l=0;l<n.length;++l)n[l][1]<0&&(n[l][1]=0),0!==n[l][1]?(h=s.getPointTimeUTC(n[l][0],n[l][1],r),a.push(h)):n[l][0]&&a.push(n[l][0]);c={guid:e,points:a},u[d].push(c)}function a(t){var e,i,o;for(e in u)for(i=u[e],o=0;o<i.length;++o)if(i[o].guid===t)return void i.splice(o,1)}function l(t,e,i,o,n){var s,r,a,l=[];for(s=0;s<t.points.length;++s){if(r=t.points[s],a=c(e,r,i,o,n),null===a)return null;l.push({index:s,value:[a,r]})}return l}function h(e,i,o,n,s,r){var a,h,c,d,p=t(e,i);if(u.hasOwnProperty(p))for(a=u[p].length,h=0;h<a;++h)c=u[p][h],d=l(c,o,n,s,i),null!==d&&r(c.guid,d)}function c(t,e,i,n,r){var a,l,h=s(n,r);return h&&(e=h.tradingDayToSessionStart(1e3*e)/1e3),1e3*e<t[0].value[0]?-p(n,r,e,t[0].value[0]/1e3,i):(a=o.lower_bound(t,1e3*e,function(t,e){return t.value[0]>e?1:t.value[0]<e?-1:0}),a>=0&&e<t[t.length-1].value[0]?(t[a].value[0]/1e3!==e&&0!==a&&a--,t[a].index):(l=i.indexOfBar(e,n),l===-1?null:l))}function d(t,e,i,o,s){function r(t,e){var i=new Date(1e3*t),o=new Date(1e3*e),n=12*(o.getFullYear()-i.getFullYear());return n-=i.getMonth()+1,n+=o.getMonth(),n<=0?0:n}var a,l,h,c,d,p,u,_,f,m,v,y,b,w,S;if(e.kind()===n.MONTHS)a=r(o,s)/e.multiplier();else if(e.kind()===n.WEEKS)l=Math.ceil((s-o)/604800),a=Math.ceil(l/e.multiplier());else{if(h=g.utc_to_cal(i.timezone,+new Date(1e3*o)),c=g.utc_to_cal(i.timezone,+new Date(1e3*s)),d=(s-o)/86400,d>4*(7-i.spec.weekEndsCount()))u=d/7,p=u*(7-i.spec.weekEndsCount());else{for(_=0,f={},m=h;m.valueOf()<=c.valueOf();m=g.add_days_considering_dst(i.timezone,m,1))v=g.get_day_of_week(m),void 0===f[v]&&(f[v]=i.spec.isWeekEnd(v)),f[v]&&_++;p=d-_}if(e.kind()===n.DAYS)a=Math.ceil(p/e.multiplier());else{if(y=e.kind()===n.HOURS?60*e.multiplier()*60:e.kind()===n.SECONDS?e.multiplier():60*e.multiplier(),d<1&&(b=i.spec.findSession(g.get_day_of_week(h),g.get_minutes_from_midnight(h)),w=i.spec.findSession(g.get_day_of_week(c),g.get_minutes_from_midnight(c)),b===w))return Math.ceil((s-o)/y);v=i.spec.entries[0]._dayOfWeek,S=60*i.spec.entries.reduce(function(t,e){return t+(e._dayOfWeek===v?e._length:0)},0),a=Math.ceil(p*S/y)}}return a}function p(t,e,i,r,a){var l,h,c=new n(e),p=g.get_timezone(t.timezone),u=new o.Session;return u.init(p,t.session),l=s(t,e),l&&(i=l.tradingDayToSessionStart(1e3*i)/1e3,r=l.tradingDayToSessionStart(1e3*r)/1e3),i>=r?0:(h=d(t,c,u,i,r),h>=1e3?h:a.findDistanceInBars(i,r,t))}var u={},_="undefined"!=typeof window?window:e,f=i(500),g=_.PineJsCalendar?_.PineJsCalendar:i(33);return{createPointset:r,removePointset:a,broadcastPointsetsUpdates:h,tests:{approxBarsInterval:d,indexOfTime:c}}}();t.exports=s}).call(e,function(){return this}())},function(t,e,i){"use strict";var o=i(500);JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution"},constructor:function(){this.f_0=function(t,e,i,n){var s=o.Std.or(o.Std.and(o.Std.eq(t,e),o.Std.eq(t,i)),o.Std.eq(e,i))?0:(2*t-i-e)/(e-i)*n;return s},this.main=function(t,e){var i,n,s;return this._context=t,this._input=e,i=this.f_0(o.Std.close(this._context),o.Std.high(this._context),o.Std.low(this._context),o.Std.volume(this._context)),n=o.Std.cum(i,this._context),s=n,[s]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1e12}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline"},constructor:function(){this.f_0=function(t,e){var i=o.Std.gt(t,e);return i},this.f_1=function(t,e){var i=o.Std.lt(t,e);return i},this.f_2=function(t,e){var i=t/e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d;return this._context=t,this._input=e,i=this._input(0),n=this.f_0(o.Std.close(this._context),o.Std.open(this._context)),s=this._context.new_var(n),r=o.Std.sum(s,i,this._context),a=this.f_1(o.Std.close(this._context),o.Std.open(this._context)),l=this._context.new_var(a),h=o.Std.sum(l,i,this._context),c=this.f_2(r,h),d=c,[d]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._input(1),r=this._input(2),a=this._context.new_var(i),l=o.Std.alma(a,n,s,r),[l]}}},{name:"Aroon",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF6A00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0094FF"}},precision:4,inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon"},constructor:function(){this.f_0=function(t,e){var i=100*(t+e)/e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=this._input(0),n=o.Std.high(this._context),s=i+1,r=this._context.new_var(n),a=o.Std.highestbars(r,s,this._context),l=this.f_0(a,i),h=o.Std.low(this._context),c=this._context.new_var(h),d=o.Std.lowestbars(c,s,this._context),p=this.f_0(d,i),u=l,_=p,[u,_]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:41,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index"},constructor:function(){this.f_0=function(t){var e=this._context.new_var(o.Std.high(this._context)),i=o.Std.change(e),n=this._context.new_var(o.Std.low(this._context)),s=-o.Std.change(n),r=this._context.new_var(o.Std.tr(void 0,this._context)),a=o.Std.rma(r,t,this._context),l=this._context.new_var(o.Std.and(o.Std.gt(i,s),o.Std.gt(i,0))?i:0),h=o.Std.fixnan(100*o.Std.rma(l,t,this._context)/a,this._context),c=this._context.new_var(o.Std.and(o.Std.gt(s,i),o.Std.gt(s,0))?s:0),d=o.Std.fixnan(100*o.Std.rma(c,t,this._context)/a,this._context);return[h,d]},this.f_1=function(t,e){var i=this.f_0(t),n=i[0],s=i[1],r=n+s,a=this._context.new_var(o.Std.abs(n-s)/(o.Std.eq(r,0)?1:r)),l=100*o.Std.rma(a,e,this._context);return[l]},this.main=function(t,e){return this._context=t,this._input=e,this.f_1(this._input(0),this._input(1))}}},{name:"Average True Range",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range"},constructor:function(){this.main=function(t,e){var i,n,s,r;return this._context=t,this._input=e,i=this._input(0),n=o.Std.tr(this._context),s=this._context.new_var(n),r=o.Std.rma(s,i,this._context),[r]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,palettes:{palette_0:{colors:{0:{color:"#FF0000",width:1,style:0},1:{color:"#008000",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator"},constructor:function(){this.f_0=function(t,e){var i=t-e;return i},this.f_1=function(t){var e=o.Std.le(t,0)?0:1;return e},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p;return this._context=t,this._input=e,i=o.Std.hl2(this._context),n=this._context.new_var(i),s=o.Std.sma(n,5,this._context),r=this._context.new_var(i),a=o.Std.sma(r,34,this._context),l=this.f_0(s,a),h=l,c=this._context.new_var(l),d=o.Std.change(c),p=this.f_1(d),[h,p]}}},{name:"Balance of Power",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power"},constructor:function(){this.f_0=function(t,e,i,o){var n=(t-e)/(i-o);return n},this.main=function(t,e){this._context=t,this._input=e;var i=this.f_0(o.Std.close(this._context),o.Std.open(this._context),o.Std.high(this._context),o.Std.low(this._context));return[i]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,filledAreasStyle:{fill_0:{color:"#000080",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e12},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands"},constructor:function(){this.f_0=function(t,e){var i=t*e;return i},this.f_1=function(t,e){var i=t+e;return i},this.f_2=function(t,e){var i=t-e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._input(1),r=this._context.new_var(i),a=o.Std.sma(r,n,this._context),l=this._context.new_var(i),h=o.Std.stdev(l,n,this._context),c=this.f_0(s,h),d=this.f_1(a,c),p=this.f_2(a,c),u=a,_=d,f=p,[u,_,f]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#008080",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e12},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B"},constructor:function(){this.f_0=function(t,e){var i=t*e;return i},this.f_1=function(t,e){var i=t+e;return i},this.f_2=function(t,e){var i=t-e;return i},this.f_3=function(t,e,i){var o=(t-e)/(i-e);return o},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._input(1),r=this._context.new_var(i),a=o.Std.sma(r,n,this._context),l=this._context.new_var(i),h=o.Std.stdev(l,n,this._context),c=this.f_0(s,h),d=this.f_1(a,c),p=this.f_2(a,c),u=this.f_3(i,p,d),_=u,[_]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e12},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width"},constructor:function(){this.f_0=function(t,e){var i=t*e;return i},this.f_1=function(t,e){var i=t+e;return i},this.f_2=function(t,e){var i=t-e;return i},this.f_3=function(t,e,i){var o=(t-e)/i;return o},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._input(1),r=this._context.new_var(i),a=o.Std.sma(r,n,this._context),l=this._context.new_var(i),h=o.Std.stdev(l,n,this._context),c=this.f_0(s,h),d=this.f_1(a,c),p=this.f_2(a,c),u=this.f_3(d,p,a),_=u,[_]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e12}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow"},constructor:function(){this.f_0=function(t,e,i,n){var s=o.Std.or(o.Std.and(o.Std.eq(t,e),o.Std.eq(t,i)),o.Std.eq(e,i))?0:(2*t-i-e)/(e-i)*n;
return s},this.f_1=function(t,e){var i=t/e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d;return this._context=t,this._input=e,i=this._input(0),n=this.f_0(o.Std.close(this._context),o.Std.high(this._context),o.Std.low(this._context),o.Std.volume(this._context)),s=this._context.new_var(n),r=o.Std.sum(s,i,this._context),a=o.Std.volume(this._context),l=this._context.new_var(a),h=o.Std.sum(l,i,this._context),c=this.f_1(r,h),d=c,[d]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:1e12},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:1e12}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator"},constructor:function(){this.f_0=function(t,e){var i=t-e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=o.Std.accdist(this._context),r=this._context.new_var(s),a=o.Std.ema(r,i,this._context),l=this._context.new_var(s),h=o.Std.ema(l,n,this._context),c=this.f_0(a,h),d=c,[d]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:1e12},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Kroll Stop@tv-basicstudies-1",scriptIdPart:"",name:"Chande Kroll Stop"},constructor:function(){this.f_0=function(t,e,i){var o=t-e*i;return o},this.f_1=function(t,e,i){var o=t+e*i;return o},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=o.Std.high(this._context),a=this._context.new_var(r),l=o.Std.highest(a,i,this._context),h=o.Std.atr(i,this._context),c=this.f_0(l,n,h),d=this._context.new_var(r),p=o.Std.lowest(d,i,this._context),u=this.f_1(p,n,h),_=this._context.new_var(c),f=o.Std.highest(_,s,this._context),g=this._context.new_var(u),m=o.Std.lowest(g,s,this._context),v=m,y=f,[v,y]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Momentum Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chande Momentum Oscillator"},constructor:function(){this.f_0=function(t){var e=o.Std.ge(t,0)?t:0;return e},this.f_1=function(t){var e=o.Std.ge(t,0)?0:-t;return e},this.f_2=function(t,e){var i=100*t/e;return i},this.f_3=function(t,e){var i=this.f_2(t-e,t+e);return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=this._input(0),n=o.Std.close(this._context),s=this._context.new_var(n),r=o.Std.change(s),a=this.f_0(r),l=this.f_1(r),h=this._context.new_var(a),c=o.Std.sum(h,i,this._context),d=this._context.new_var(l),p=o.Std.sum(d,i,this._context),u=this.f_3(c,p),_=u,[_]}}},{name:"Chop Zone",metainfo:{_metainfoVersion:41,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,palettes:{palette_0:{colors:{0:{color:"#34dddd",width:1,style:0},1:{color:"#006400",width:1,style:0},2:{color:"#98fb98",width:1,style:0},3:{color:"#00FF00",width:1,style:0},4:{color:"#8B0000",width:1,style:0},5:{color:"#FF0000",width:1,style:0},6:{color:"#FF7F00",width:1,style:0},7:{color:"#ffc04c",width:1,style:0},8:{color:"#FFFF00",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Chop Zone",shortDescription:"Chop Zone",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"},4:{name:"Color 4"},5:{name:"Color 5"},6:{name:"Color 6"},7:{name:"Color 7"},8:{name:"Color 8"}},valToIndex:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8}}},inputs:[],id:"chop_zone@tv-basicstudies-1",scriptIdPart:"",name:"Chop Zone"},constructor:function(){this.f_0=function(){var t=o.Std.close(this._context),e=o.Std.hlc3(this._context),i=this._context.new_var(o.Std.high(this._context)),n=o.Std.highest(i,30,this._context),s=o.Std.lowest(i,30,this._context),r=25/(n-s)*s,a=this._context.new_var(t),l=this._context.new_var(o.Std.ema(a,34,this._context)),h=(l.get(1)-l.get(0))/e*r,c=o.Std.sqrt(1+h*h),d=o.Std.round(180*o.Std.acos(1/c)/3.141592653589793),p=o.Std.iff(o.Std.gt(h,0),-d,d),u=o.Std.and(o.Std.gt(p,-2.14),o.Std.le(p,-.71))?7:8,_=o.Std.and(o.Std.gt(p,-3.57),o.Std.le(p,-2.14))?6:u,f=o.Std.and(o.Std.gt(p,-5),o.Std.le(p,-3.57))?5:_,g=o.Std.le(p,-5)?4:f,m=o.Std.and(o.Std.lt(p,2.14),o.Std.ge(p,.71))?3:g,v=o.Std.and(o.Std.lt(p,3.57),o.Std.ge(p,2.14))?2:m,y=o.Std.and(o.Std.lt(p,5),o.Std.ge(p,3.57))?1:v,b=o.Std.ge(p,5)?0:y;return[1,b]},this.main=function(t,e){return this._context=t,this._input=e,this.f_0()}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:61.8},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#008000",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],id:"Choppiness Index@tv-basicstudies-1",scriptIdPart:"",name:"Choppiness Index"},constructor:function(){this.f_0=function(t,e,i,n){var s=100*o.Std.log10(t/(e-i))/n;return s},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f;return this._context=t,this._input=e,i=this._input(0),n=o.Std.atr(1,this._context),s=this._context.new_var(n),r=o.Std.sum(s,i,this._context),a=o.Std.high(this._context),l=this._context.new_var(a),h=o.Std.highest(l,i,this._context),c=o.Std.low(this._context),d=this._context.new_var(c),p=o.Std.lowest(d,i,this._context),u=o.Std.log10(i),_=this.f_0(r,h,p,u),f=_,[f]}}},{name:"Commodity Channel Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#808000",transparency:90,visible:!0}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e12}],id:"Commodity Channel Index@tv-basicstudies-1",scriptIdPart:"",name:"Commodity Channel Index"},constructor:function(){this.f_0=function(t,e,i){var o=(t-e)/(.015*i);return o},this.main=function(t,e){var i,n,s,r,a,l,h,c;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._context.new_var(i),r=o.Std.sma(s,n,this._context),a=this._context.new_var(i),l=o.Std.dev(a,n,this._context),h=this.f_0(i,r,l),c=h,[c]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:-1e12,max:1e12}],id:"Coppock Curve@tv-basicstudies-1",scriptIdPart:"",name:"Coppock Curve"},constructor:function(){this.f_0=function(t,e){var i=t+e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=o.Std.close(this._context),a=this._context.new_var(r),l=o.Std.roc(a,n),h=this._context.new_var(r),c=o.Std.roc(h,s),d=this.f_0(l,c),p=this._context.new_var(d),u=o.Std.wma(p,i,this._context),_=u,[_]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:40,visible:!0,color:"#800080"}},precision:4,inputs:{in_0:"AAPL",in_1:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Correlation Coeff",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"sym",defval:"AAPL",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:1e12}],id:"Correlation Coeff@tv-basicstudies-1",scriptIdPart:"",name:"Correlation Coeff"},constructor:function(){this.init=function(t,e){this._context=t,this._input=e,this._context.new_sym(this._input(0),o.Std.period(this._context),o.Std.period(this._context))},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=this._context.new_var(this._context.symbol.time),n=this._input(0),s=o.Std.period(this._context),r=o.Std.close(this._context),a=this._input(1),this._context.select_sym(1),l=this._context.new_var(this._context.symbol.time),h=o.Std.close(this._context),c=this._context.new_var(h),this._context.select_sym(0),d=c.adopt(l,i,0),p=this._context.new_var(r),u=this._context.new_var(d),_=o.Std.correlation(p,u,a,this._context),[_]}}},{name:"Detrended Price Oscillator",metainfo:{_metainfoVersion:42,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:21,in_1:!1}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"DPO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Detrended Price Oscillator",shortDescription:"DPO",is_price_study:!1,is_hidden_study:!1,id:"detrended_price_oscillator@tv-basicstudies-1",bands:[{id:"hline_0",name:"Zero",isHidden:!1}],inputs:[{id:"in_0",name:"Period",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"isCentered",defval:!1,type:"bool"}],scriptIdPart:"",name:"Detrended Price Oscillator"},constructor:function(){this.f_0=function(){var t=this._input(0),e=this._input(1),i=Math.floor(t/2+1),n=this._context.new_var(o.Std.close(this._context)),s=this._context.new_var(o.Std.sma(n,t,this._context)),r=this._context.new_var(o.Std.close(this._context)),a=r.get(i)-s,l=o.Std.close(this._context)-s.get(i),h=e?a:l,c=-i,d=e?c:0;return[h,d]},this.main=function(t,e){this._context=t,this._input=e;var i=this.f_0();return[{value:i[0],offset:i[1]}]}}},{name:"Directional Movement Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"ADX",histogramBase:0,joinPoints:!1}},description:"Directional Movement Index",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:1e12},{id:"in_1",name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1",scriptIdPart:"",name:"Directional Movement Index"},constructor:function(){this.f_0=function(t){var e=-t;return e},this.f_1=function(t,e){var i=o.Std.and(o.Std.gt(t,e),o.Std.gt(t,0))?t:0;return i},this.f_2=function(t,e){var i=100*t/e;return i},this.f_3=function(t,e){var i=t+e;return i},this.f_4=function(t,e,i){var n=o.Std.abs(t-e)/(o.Std.eq(i,0)?1:i);return n},this.f_5=function(t){var e=100*t;return e},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=o.Std.high(this._context),r=this._context.new_var(s),a=o.Std.change(r),l=o.Std.low(this._context),h=this._context.new_var(l),c=o.Std.change(h),d=this.f_0(c),p=o.Std.tr(this._context),u=this._context.new_var(p),_=o.Std.rma(u,i,this._context),f=this.f_1(a,d),g=this._context.new_var(f),m=o.Std.rma(g,i,this._context),v=this.f_2(m,_),y=o.Std.fixnan(v,this._context),b=this.f_1(d,a),w=this._context.new_var(b),S=o.Std.rma(w,i,this._context),T=this.f_2(S,_),C=o.Std.fixnan(T,this._context),x=this.f_3(y,C),P=this.f_4(y,C,x),L=this._context.new_var(P),k=o.Std.rma(L,n,this._context),E=this.f_5(k),I=y,A=C,V=E,[I,A,V]}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"}},precision:4,filledAreasStyle:{fill_0:{color:"#0000FF",transparency:90,visible:!0}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Lower",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Basis",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e12}],id:"Donchian Channels@tv-basicstudies-1",scriptIdPart:"",name:"Donchian Channels"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u;return this._context=t,this._input=e,i=this._input(0),n=o.Std.low(this._context),s=this._context.new_var(n),r=o.Std.lowest(s,i,this._context),a=o.Std.high(this._context),l=this._context.new_var(a),h=o.Std.highest(l,i,this._context),c=o.Std.avg(h,r),d=r,p=h,u=c,[d,p,u]}}},{name:"Double Exponential Moving Average",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double Exponential Moving Average",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"Double Exponential Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Double Exponential Moving Average"},constructor:function(){this.f_0=function(t,e){var i=2*t-e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c;return this._context=t,this._input=e,i=this._input(0),n=o.Std.close(this._context),s=this._context.new_var(n),r=o.Std.ema(s,i,this._context),a=this._context.new_var(r),l=o.Std.ema(a,i,this._context),h=this.f_0(r,l),c=h,[c]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,inputs:{in_0:1e4,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1e4,type:"integer",min:1,max:1e12},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:1e12}],id:"Ease of Movement@tv-basicstudies-1",scriptIdPart:"",name:"Ease of Movement"},constructor:function(){this.f_0=function(t,e,i,o,n){var s=t*e*(i-o)/n;return s},this.main=function(t,e){var i,n,s,r,a,l,h,c,d;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=o.Std.hl2(this._context),r=this._context.new_var(s),a=o.Std.change(r),l=this.f_0(i,a,o.Std.high(this._context),o.Std.low(this._context),o.Std.volume(this._context)),h=this._context.new_var(l),c=o.Std.sma(h,n,this._context),d=c,[d]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Elders Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:1e12}],id:"Elders Force Index@tv-basicstudies-1",scriptIdPart:"",name:"Elders Force Index"},constructor:function(){this.f_0=function(t,e){var i=t*e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c;return this._context=t,this._input=e,i=this._input(0),n=o.Std.close(this._context),s=this._context.new_var(n),r=o.Std.change(s),a=this.f_0(r,o.Std.volume(this._context)),l=this._context.new_var(a),h=o.Std.ema(l,i,this._context),c=h,[c]}}},{name:"Envelope",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,filledAreasStyle:{fill_0:{color:"#0000FF",transparency:90,visible:!0}},inputs:{in_0:20,in_1:10,in_2:!1}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelope",shortDescription:"Env",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:1e12},{id:"in_1",name:"percent",defval:10,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"exponential",defval:!1,type:"bool"}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",name:"Envelope"},constructor:function(){this.f_0=function(t,e,i){var o=t?e:i;return o},this.f_1=function(t,e){var i=t*(1+e);return i},this.f_2=function(t,e){var i=t*(1-e);return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._input(1),r=this._input(2),a=this._context.new_var(i),l=o.Std.ema(a,n,this._context),h=this._context.new_var(i),c=o.Std.sma(h,n,this._context),d=this.f_0(r,l,c),p=s/100,u=this.f_1(d,p),_=this.f_2(d,p),f=d,g=u,m=_,[f,g,m]}}},{name:"Fisher Transform",metainfo:{_metainfoVersion:41,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"}},precision:4,bands:[{color:"#FF7F00",linestyle:2,linewidth:1,visible:!0,value:1.5},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:.75},{color:"#FF7F00",linestyle:2,linewidth:1,visible:!0,value:0},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:-.75},{color:"#FF7F00",linestyle:2,linewidth:1,visible:!0,value:-1.5}],inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Fisher",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"Trigger",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Fisher Transform",shortDescription:"Fisher",is_price_study:!1,bands:[{id:"hline_0",name:"Level",isHidden:!1},{id:"hline_1",name:"Level",isHidden:!1},{id:"hline_2",name:"Level",isHidden:!1},{id:"hline_3",name:"Level",isHidden:!1},{id:"hline_4",name:"Level",isHidden:!1}],inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e12}],id:"fisher_transform@tv-basicstudies-1",scriptIdPart:"",name:"Fisher Transform"},constructor:function(){this.f_0=function(t){var e=o.Std.lt(t,-.99)?-.999:t,i=o.Std.gt(t,.99)?.999:e;return[i]},this.f_1=function(){var t,e,i,n=this._input(0),s=this._context.new_var(o.Std.hl2(this._context)),r=o.Std.highest(s,n,this._context),a=this._context.new_var(o.Std.hl2(this._context)),l=o.Std.lowest(a,n,this._context),h=this._context.new_var(),c=this.f_0(.66*((o.Std.hl2(this._context)-l)/o.Std.max(r-l,.001)-.5)+.67*o.Std.nz(h.get(1)));return h.set(c[0]),t=this._context.new_var(),t.set(.5*o.Std.log((1+h.get(0))/o.Std.max(1-h.get(0),.001))+.5*o.Std.nz(t.get(1))),e=t.get(1),i=t.get(0),[i,e]},this.main=function(t,e){return this._context=t,this._input=e,this.f_1()}}},{name:"Historical Volatility",metainfo:{_metainfoVersion:41,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Historical Volatility",shortDescription:"HV",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1e12}],id:"historical_volatility@tv-basicstudies-1",scriptIdPart:"",name:"Historical Volatility"},constructor:function(){this.f_0=function(){var t=this._input(0),e=o.Std.or(o.Std.isintraday(this._context),o.Std.and(o.Std.isdaily(this._context),o.Std.eq(o.Std.interval(this._context),1)))?1:7,i=this._context.new_var(o.Std.close(this._context)),n=this._context.new_var(o.Std.log(o.Std.close(this._context)/i.get(1))),s=100*o.Std.stdev(n,t,this._context)*o.Std.sqrt(365/e);return[s]},this.main=function(t,e){return this._context=t,this._input=e,this.f_0()}}},{name:"Hull MA",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Hull MA",shortDescription:"HMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"Hull MA@tv-basicstudies-1",scriptIdPart:"",name:"Hull MA"},constructor:function(){this.f_0=function(t,e){var i=2*t-e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=n/2,r=this._context.new_var(i),a=o.Std.wma(r,s,this._context),l=this._context.new_var(i),h=o.Std.wma(l,n,this._context),c=this.f_0(a,h),d=o.Std.sqrt(n),p=o.Std.round(d),u=this._context.new_var(c),_=o.Std.wma(u,p,this._context),f=_,[f]}}},{name:"Ichimoku Cloud",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"}},precision:4,filledAreasStyle:{fill_0:{color:"#000080",transparency:90,visible:!0}},inputs:{in_0:9,in_1:26,in_2:52,in_3:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{plot_0:{title:"Tenkan-sen",histogramBase:0,joinPoints:!1},plot_1:{title:"Kijun-sen",histogramBase:0,joinPoints:!1},plot_2:{title:"Chikou span",histogramBase:0,joinPoints:!1},plot_3:{title:"Senkou A",histogramBase:0,joinPoints:!1},plot_4:{title:"Senkou B",histogramBase:0,joinPoints:!1}},description:"Ichimoku Cloud",shortDescription:"Ichimoku",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_3",objBId:"plot_4",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:1e12},{id:"in_1",name:"Middle",defval:26,type:"integer",min:1,max:1e12},{id:"in_2",name:"Long",defval:52,type:"integer",min:1,max:1e12},{id:"in_3",name:"displacement",defval:26,type:"integer",min:1,max:1e12}],id:"Ichimoku Cloud@tv-basicstudies-1",scriptIdPart:"",name:"Ichimoku Cloud"},constructor:function(){this.f_0=function(t){var e=-t;return e},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V,$,M,D;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=this._input(3),a=o.Std.low(this._context),l=i,h=this._context.new_var(a),c=o.Std.lowest(h,l,this._context),d=o.Std.high(this._context),p=this._context.new_var(d),u=o.Std.highest(p,l,this._context),_=o.Std.avg(c,u),f=_,g=n,m=this._context.new_var(a),v=o.Std.lowest(m,g,this._context),y=this._context.new_var(d),b=o.Std.highest(y,g,this._context),w=o.Std.avg(v,b),S=w,T=o.Std.avg(f,S),C=s,x=this._context.new_var(a),P=o.Std.lowest(x,C,this._context),L=this._context.new_var(d),k=o.Std.highest(L,C,this._context),E=o.Std.avg(P,k),I=E,A=f,V=S,$=o.Std.close(this._context),M=T,D=I,[A,V,{value:$,offset:this.f_0(r)},{value:M,offset:r},{value:D,offset:r}]}}},{name:"Keltner Channels",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,filledAreasStyle:{fill_0:{color:"#0000FF",transparency:90,visible:!0}},inputs:{in_0:!0,in_1:20,in_2:1}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Middle",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Keltner Channels",shortDescription:"KC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"useTrueRange",defval:!0,type:"bool"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:1e12},{id:"in_2",name:"mult",defval:1,type:"float",min:-1e12,max:1e12}],id:"Keltner Channels@tv-basicstudies-1",scriptIdPart:"",name:"Keltner Channels"},constructor:function(){this.f_0=function(t,e,i,o){var n=t?e:i-o;return n},this.f_1=function(t,e,i){var o=t+e*i;return o},this.f_2=function(t,e,i){var o=t-e*i;return o},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._input(1),r=this._input(2),a=this._context.new_var(i),l=o.Std.ema(a,s,this._context),h=this.f_0(n,o.Std.tr(this._context),o.Std.high(this._context),o.Std.low(this._context)),c=this._context.new_var(h),d=o.Std.ema(c,s,this._context),p=this.f_1(l,d,r),u=this.f_2(l,d,r),_=p,f=l,g=u,[_,f,g]}}},{name:"Klinger Oscillator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Klinger Oscillator",shortDescription:"Klinger Oscillator",is_price_study:!1,inputs:[],id:"Klinger Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Klinger Oscillator"},constructor:function(){this.f_0=function(t,e){var i=o.Std.ge(t,0)?e:-e;return i},this.f_1=function(t,e){var i=t-e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f;return this._context=t,this._input=e,i=o.Std.hlc3(this._context),n=this._context.new_var(i),s=o.Std.change(n),r=this.f_0(s,o.Std.volume(this._context)),a=this._context.new_var(r),l=o.Std.ema(a,34,this._context),h=this._context.new_var(r),c=o.Std.ema(h,55,this._context),d=this.f_1(l,c),p=this._context.new_var(d),u=o.Std.ema(p,13,this._context),_=d,f=u,[_,f]}}},{name:"Know Sure Thing",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:10,in_1:15,in_2:20,in_3:30,in_4:10,in_5:10,in_6:10,in_7:15,in_8:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"KST",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Know Sure Thing",shortDescription:"KST",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{
id:"in_0",name:"roclen1",defval:10,type:"integer",min:1,max:1e12},{id:"in_1",name:"roclen2",defval:15,type:"integer",min:1,max:1e12},{id:"in_2",name:"roclen3",defval:20,type:"integer",min:1,max:1e12},{id:"in_3",name:"roclen4",defval:30,type:"integer",min:1,max:1e12},{id:"in_4",name:"smalen1",defval:10,type:"integer",min:1,max:1e12},{id:"in_5",name:"smalen2",defval:10,type:"integer",min:1,max:1e12},{id:"in_6",name:"smalen3",defval:10,type:"integer",min:1,max:1e12},{id:"in_7",name:"smalen4",defval:15,type:"integer",min:1,max:1e12},{id:"in_8",name:"siglen",defval:9,type:"integer",min:1,max:1e12}],id:"Know Sure Thing@tv-basicstudies-1",scriptIdPart:"",name:"Know Sure Thing"},constructor:function(){this.f_0=function(t,e,i,o){var n=t+2*e+3*i+4*o;return n},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v,y,b,w,S,T,C,x,P,L,k,E,I,A,V,$,M,D,O,B,R,N,F,z;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=this._input(3),a=this._input(4),l=this._input(5),h=this._input(6),c=this._input(7),d=this._input(8),p=o.Std.close(this._context),u=i,_=this._context.new_var(p),f=o.Std.roc(_,u),g=a,m=this._context.new_var(f),v=o.Std.sma(m,g,this._context),y=n,b=this._context.new_var(p),w=o.Std.roc(b,y),S=l,T=this._context.new_var(w),C=o.Std.sma(T,S,this._context),x=s,P=this._context.new_var(p),L=o.Std.roc(P,x),k=h,E=this._context.new_var(L),I=o.Std.sma(E,k,this._context),A=r,V=this._context.new_var(p),$=o.Std.roc(V,A),M=c,D=this._context.new_var($),O=o.Std.sma(D,M,this._context),B=this.f_0(v,C,I,O),R=this._context.new_var(B),N=o.Std.sma(R,d,this._context),F=B,z=N,[F,z]}}},{name:"Least Squares Moving Average",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:25,in_1:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Least Squares Moving Average",shortDescription:"LSMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:25,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Least Squares Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Least Squares Moving Average"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=o.Std.close(this._context),r=this._context.new_var(s),a=o.Std.linreg(r,i,n),l=a,[l]}}},{name:"Linear Regression Curve",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Linear Regression Curve",shortDescription:"LRC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e12}],id:"Linear Regression Curve@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Curve"},constructor:function(){this.main=function(t,e){var i,n,s,r,a;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._context.new_var(i),r=o.Std.linreg(s,n,0),a=r,[a]}}},{name:"MA Cross",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA Cross",shortDescription:"MA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:1e12},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:1e12}],id:"MA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA Cross"},constructor:function(){this.f_0=function(t,e){var i=t?e:o.Std.na();return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=o.Std.close(this._context),r=this._context.new_var(s),a=o.Std.sma(r,i,this._context),l=this._context.new_var(s),h=o.Std.sma(l,n,this._context),c=a,d=h,p=o.Std.cross(a,h,this._context),u=this.f_0(p,a),[c,d,u]}}},{name:"Mass Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Mass Index",shortDescription:"Mass Index",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1e12}],id:"Mass Index@tv-basicstudies-1",scriptIdPart:"",name:"Mass Index"},constructor:function(){this.f_0=function(t,e){var i=t-e;return i},this.f_1=function(t,e){var i=t/e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p;return this._context=t,this._input=e,i=this._input(0),n=this.f_0(o.Std.high(this._context),o.Std.low(this._context)),s=this._context.new_var(n),r=o.Std.ema(s,9,this._context),a=this._context.new_var(r),l=o.Std.ema(a,9,this._context),h=this.f_1(r,l),c=this._context.new_var(h),d=o.Std.sum(c,i,this._context),p=d,[p]}}},{name:"McGinley Dynamic",metainfo:{_metainfoVersion:42,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"McGinley Dynamic",shortDescription:"McGinley Dynamic",is_price_study:!0,is_hidden_study:!1,id:"mcginley_dynamic@tv-basicstudies-1",inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],scriptIdPart:"",name:"McGinley Dynamic"},constructor:function(){this.f_0=function(){var t,e=this._input(0),i=o.Std.close(this._context),n=this._context.new_var(i),s=o.Std.ema(n,e,this._context),r=this._context.new_var(),a=r.get(1)+(i-r.get(1))/(e*o.Std.pow(i/r.get(1),4));return r.set(o.Std.na(r.get(1))?s:a),t=r.get(0),[t]},this.main=function(t,e){return this._context=t,this._input=e,this.f_0()}}},{name:"Momentum",metainfo:{_metainfoVersion:30,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#808000"}},precision:4,inputs:{in_0:10,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Mom",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Momentum",shortDescription:"Mom",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Momentum@tv-basicstudies-1",scriptIdPart:"",name:"Momentum"},constructor:function(){this.main=function(t,e){var i,n,s,r,a;return this._context=t,this._input=e,i=this._input(0),n=o.Std[this._input(1)](this._context),s=this._context.new_var(n),r=s.get(i),a=r?n-r:null,[a]}}},{name:"Money Flow",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#459915"}},precision:4,bands:[{color:"#c0c0c0",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#c0c0c0",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#9915ff",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Money Flow",shortDescription:"MFI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"Length",defval:14,type:"integer",min:1,max:2e3}],id:"Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Money Flow"},constructor:function(){this.f_0=function(t,e,i){var n=t*(o.Std.le(e,0)?0:i);return n},this.f_1=function(t,e,i){var n=t*(o.Std.ge(e,0)?0:i);return n},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=this._input(0),n=o.Std.hlc3(this._context),s=this._context.new_var(n),r=o.Std.change(s),a=this.f_0(o.Std.volume(this._context),r,n),l=this._context.new_var(a),h=o.Std.sum(l,i,this._context),c=this.f_1(o.Std.volume(this._context),r,n),d=this._context.new_var(c),p=o.Std.sum(d,i,this._context),u=o.Std.rsi(h,p),_=u,[_]}}},{name:"Moving Average",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average",shortDescription:"MA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l;return this._context=t,this._input=e,i=o.Std[this._input(1)](this._context),n=this._input(0),s=this._input(2),r=this._context.new_var(i),a=o.Std.sma(r,n,this._context),l=a,[{value:l,offset:s}]}}},{name:"Moving Average Convergence/Divergence",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:12,in_1:26,in_3:"close",in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Histogram",histogramBase:0,joinPoints:!1},plot_1:{title:"MACD",histogramBase:0,joinPoints:!1},plot_2:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"MACD",shortDescription:"MACD",is_price_study:!1,inputs:[{id:"in_0",name:"fastLength",defval:12,type:"integer",min:1,max:1e12},{id:"in_1",name:"slowLength",defval:26,type:"integer",min:1,max:1e12},{id:"in_3",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"signalLength",defval:9,type:"integer",min:1,max:1e12}],id:"Moving Average Convergence/Divergence@tv-basicstudies-1",scriptIdPart:"",name:"MACD"},constructor:function(){this.f_0=function(t,e){var i=t-e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m;return this._context=t,this._input=e,i=o.Std[this._input(2)](this._context),n=this._input(0),s=this._input(1),r=this._input(3),a=this._context.new_var(i),l=o.Std.ema(a,n,this._context),h=this._context.new_var(i),c=o.Std.ema(h,s,this._context),d=this.f_0(l,c),p=this._context.new_var(d),u=o.Std.sma(p,r,this._context),_=this.f_0(d,u),f=_,g=d,m=u,[f,g,m]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l;return this._context=t,this._input=e,i=o.Std[this._input(1)](this._context),n=this._input(0),s=this._input(2),r=this._context.new_var(i),a=o.Std.ema(r,n,this._context),l=a,[{value:l,offset:s}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l;return this._context=t,this._input=e,i=o.Std[this._input(1)](this._context),n=this._input(0),s=this._input(2),r=this._context.new_var(i),a=o.Std.wma(r,n,this._context),l=a,[{value:l,offset:s}]}}},{name:"Net Volume",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Net Volume",shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1",scriptIdPart:"",name:"Net Volume"},constructor:function(){this.f_0=function(t,e,i){var n=o.Std.gt(t,0)?e:o.Std.lt(i,0)?-e:0*e;return n},this.main=function(t,e){var i,n,s,r,a;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._context.new_var(i),s=o.Std.change(n),r=this.f_0(s,o.Std.volume(this._context),s),a=r,[a]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[],id:"On Balance Volume@tv-basicstudies-1",scriptIdPart:"",name:"On Balance Volume"},constructor:function(){this.f_0=function(t,e,i){var n=o.Std.gt(t,0)?e:o.Std.lt(i,0)?-e:0*e;return n},this.main=function(t,e){var i,n,s,r,a,l;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._context.new_var(i),s=o.Std.change(n),r=this.f_0(s,o.Std.volume(this._context),s),a=o.Std.cum(r,this._context),l=a,[l]}}},{name:"Parabolic SAR",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:.02,in_1:.02,in_2:.2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR",shortDescription:"SAR",is_price_study:!0,inputs:[{id:"in_0",name:"start",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_1",name:"increment",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"maximum",defval:.2,type:"float",min:-1e12,max:1e12}],id:"Parabolic SAR@tv-basicstudies-1",scriptIdPart:"",name:"Parabolic SAR"},constructor:function(){this.main=function(t,e){var i,n,s,r,a;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=o.Std.sar(i,n,s,this._context),a=r,[a]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:1e12},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:1e12}],id:"Price Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Price Oscillator"},constructor:function(){this.f_0=function(t,e){var i=(t-e)/e*100;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._input(1),r=this._context.new_var(i),a=o.Std.sma(r,n,this._context),l=this._context.new_var(i),h=o.Std.sma(l,s,this._context),c=this.f_0(a,h),d=c,[d]}}},{name:"Price Volume Trend",metainfo:{_metainfoVersion:42,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"PVT",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Price Volume Trend",shortDescription:"PVT",is_price_study:!1,is_hidden_study:!1,id:"price_volume_trend@tv-basicstudies-1",inputs:[],scriptIdPart:"",name:"Price Volume Trend"},constructor:function(){this.f_0=function(){var t=this._context.new_var(o.Std.close(this._context)),e=o.Std.cum(o.Std.change(t)/t.get(1)*o.Std.volume(this._context),this._context);return[e]},this.main=function(t,e){this._context=t,this._input=e;var i=this.f_0();return[i[0]]}}},{name:"Rate Of Change",metainfo:{_metainfoVersion:41,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ROC",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Rate Of Change",shortDescription:"ROC",is_price_study:!1,bands:[{id:"hline_0",name:"Zero Line",isHidden:!1}],inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"rate_of_change@tv-basicstudies-1",scriptIdPart:"",name:"Rate Of Change"},constructor:function(){this.main=function(t,e){var i,n,s;return this._context=t,this._input=e,i=this._context.new_var(o.Std.close(this._context)),n=this._input(0),s=100*(i.get(0)-i.get(n))/i.get(n),[s]}}},{name:"Relative Strength Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:70},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#800080",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Relative Strength Index",shortDescription:"RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"Length",defval:14,type:"integer",min:1,max:1e12}],id:"Relative Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Strength Index"},constructor:function(){this.f_0=function(t){var e=o.Std.max(t,0);return e},this.f_1=function(t){var e=-o.Std.min(t,0);return e},this.f_2=function(t,e){var i=o.Std.eq(t,0)?100:o.Std.eq(e,0)?0:100-100/(1+e/t);return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._context.new_var(i),r=o.Std.change(s),a=this.f_0(r),l=this._context.new_var(a),h=o.Std.rma(l,n,this._context),c=this.f_1(r),d=this._context.new_var(c),p=o.Std.rma(d,n,this._context),u=this.f_2(p,h),_=u,[_]}}},{name:"Relative Vigor Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"RVGI",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Relative Vigor Index",shortDescription:"RVGI",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:1e12}],id:"Relative Vigor Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Vigor Index"},constructor:function(){this.f_0=function(t,e){var i=t-e;return i},this.f_1=function(t,e){var i=t/e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v;return this._context=t,this._input=e,i=this._input(0),n=this.f_0(o.Std.close(this._context),o.Std.open(this._context)),s=this._context.new_var(n),r=o.Std.swma(s,this._context),a=this._context.new_var(r),l=o.Std.sum(a,i,this._context),h=this.f_0(o.Std.high(this._context),o.Std.low(this._context)),c=this._context.new_var(h),d=o.Std.swma(c,this._context),p=this._context.new_var(d),u=o.Std.sum(p,i,this._context),_=this.f_1(l,u),f=this._context.new_var(_),g=o.Std.swma(f,this._context),m=_,v=g,[m,v]}}},{name:"Relative Volatility Index",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#808000",transparency:90,visible:!0}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Relative Volatility Index",shortDescription:"RVI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1e12}],id:"Relative Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Volatility Index"},constructor:function(){this.f_0=function(t,e){var i=o.Std.le(t,0)?0:e;return i},this.f_1=function(t,e){var i=o.Std.gt(t,0)?0:e;return i},this.f_2=function(t,e){var i=t/(t+e)*100;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g;return this._context=t,this._input=e,i=this._input(0),n=o.Std.close(this._context),s=this._context.new_var(n),r=o.Std.stdev(s,i,this._context),a=this._context.new_var(n),l=o.Std.change(a),h=this.f_0(l,r),c=this._context.new_var(h),d=o.Std.ema(c,14,this._context),p=this.f_1(l,r),u=this._context.new_var(p),_=o.Std.ema(u,14,this._context),f=this.f_2(d,_),g=f,[g]}}},{name:"SMI Ergodic Indicator/Oscillator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF7F00"},plot_2:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:5,in_1:20,in_2:5}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Indicator",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1},plot_2:{title:"Oscillator",histogramBase:0,joinPoints:!1}},description:"SMI Ergodic Indicator/Oscillator",shortDescription:"SMIIO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:1e12},{id:"in_1",name:"longlen",defval:20,type:"integer",min:1,max:1e12},{id:"in_2",name:"siglen",defval:5,type:"integer",min:1,max:1e12}],id:"SMI Ergodic Indicator/Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"SMI Ergodic Indicator/Oscillator"},constructor:function(){this.f_0=function(t,e){var i=t-e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=o.Std.close(this._context),a=this._context.new_var(r),l=o.Std.tsi(a,i,n,this._context),h=this._context.new_var(l),c=o.Std.ema(h,s,this._context),d=this.f_0(l,c),p=l,u=c,_=d,[p,u,_]}}},{name:"Smoothed Moving Average",metainfo:{_metainfoVersion:41,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:7,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Smoothed Moving Average",shortDescription:"SMMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"smoothed_moving_average@tv-basicstudies-1",scriptIdPart:"",name:"Smoothed Moving Average"},constructor:function(){this.f_0=function(){var t,e=this._input(0),i=o.Std[this._input(1)](this._context),n=this._context.new_var(i),s=o.Std.sma(n,e,this._context),r=this._context.new_var(),a=(r.get(1)*(e-1)+i)/e;return r.set(o.Std.na(r.get(1))?s:a),t=r.get(0),[t]},this.main=function(t,e){return this._context=t,this._input=e,this.f_0()}}},{name:"Stochastic",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#800080",transparency:75,visible:!0}},inputs:{in_0:14,in_1:1,in_2:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1}},description:"Stochastic",shortDescription:"Stoch",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12},{id:"in_1",name:"smoothK",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"smoothD",defval:3,type:"integer",min:1,max:1e12}],id:"Stochastic@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=o.Std.close(this._context),a=o.Std.high(this._context),l=o.Std.low(this._context),h=this._context.new_var(r),c=this._context.new_var(a),d=this._context.new_var(l),p=o.Std.stoch(h,c,d,i,this._context),u=this._context.new_var(p),_=o.Std.sma(u,n,this._context),f=this._context.new_var(_),g=o.Std.sma(f,s,this._context),m=_,v=g,[m,v]}}},{name:"Stochastic RSI",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#800080",transparency:80,visible:!0}},inputs:{in_0:14,in_1:14,in_2:3,in_3:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1}},description:"Stochastic RSI",shortDescription:"Stoch RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"lengthRSI",defval:14,type:"integer",min:1,max:1e12},{id:"in_1",name:"lengthStoch",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"smoothK",defval:3,type:"integer",min:1,max:1e12},{id:"in_3",name:"smoothD",defval:3,type:"integer",min:1,max:1e12}],id:"Stochastic RSI@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic RSI"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f,g,m,v;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._input(1),r=this._input(2),a=this._input(3),l=o.Std.rsi(i,n),h=this._context.new_var(l),c=this._context.new_var(l),d=this._context.new_var(l),p=o.Std.stoch(h,c,d,s,this._context),u=this._context.new_var(p),_=o.Std.sma(u,r,this._context),f=this._context.new_var(_),g=o.Std.sma(f,a,this._context),m=_,v=g,[m,v]}}},{name:"TRIX",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:18}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"TRIX",histogramBase:0,joinPoints:!1}},description:"TRIX",shortDescription:"TRIX",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"length",defval:18,type:"integer",min:1,max:1e12}],id:"TRIX@tv-basicstudies-1",scriptIdPart:"",name:"TRIX"},constructor:function(){this.f_0=function(t){var e=o.Std.log(t);return e},this.f_1=function(t){var e=1e4*t;return e},this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_;return this._context=t,this._input=e,i=this._input(0),n=this.f_0(o.Std.close(this._context)),s=this._context.new_var(n),r=o.Std.ema(s,i,this._context),a=this._context.new_var(r),l=o.Std.ema(a,i,this._context),h=this._context.new_var(l),c=o.Std.ema(h,i,this._context),d=this._context.new_var(c),p=o.Std.change(d),u=this.f_1(p),_=u,[_]}}},{name:"Triple EMA",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Triple EMA",shortDescription:"TEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"Triple EMA@tv-basicstudies-1",scriptIdPart:"",name:"Triple EMA"},constructor:function(){this.f_0=function(t,e,i){var o=3*(t-e)+i;return o},this.main=function(t,e){
var i,n,s,r,a,l,h,c,d,p;return this._context=t,this._input=e,i=this._input(0),n=o.Std.close(this._context),s=this._context.new_var(n),r=o.Std.ema(s,i,this._context),a=this._context.new_var(r),l=o.Std.ema(a,i,this._context),h=this._context.new_var(l),c=o.Std.ema(h,i,this._context),d=this.f_0(r,l,c),p=d,[p]}}},{name:"True Strength Indicator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:25,in_1:13,in_2:13}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},plot_1:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"True Strength Indicator",shortDescription:"True Strength Indicator",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"long",defval:25,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"short",defval:13,type:"integer",min:-1e12,max:1e12},{id:"in_2",name:"siglen",defval:13,type:"integer",min:1,max:1e12}],id:"True Strength Indicator@tv-basicstudies-1",scriptIdPart:"",name:"True Strength Indicator"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l,h,c;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=o.Std.close(this._context),a=this._context.new_var(r),l=o.Std.tsi(a,n,i,this._context),h=l,c=this._context.new_var(h),[h,o.Std.ema(c,s,this._context)]}}},{name:"Ultimate Oscillator",metainfo:{_metainfoVersion:41,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:7,in_1:14,in_2:28}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"UO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ultimate Oscillator",shortDescription:"UO",is_price_study:!1,inputs:[{id:"in_0",name:"length7",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"length14",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"length28",defval:28,type:"integer",min:1,max:1e12}],id:"ultimate_oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Ultimate Oscillator"},constructor:function(){this.f_0=function(t,e,i){var n=this._context.new_var(t),s=this._context.new_var(e),r=o.Std.sum(n,i,this._context)/o.Std.sum(s,i,this._context);return[r]},this.f_1=function(){var t=this._input(0),e=this._input(1),i=this._input(2),n=this._context.new_var(o.Std.close(this._context)),s=o.Std.max(o.Std.high(this._context),n.get(1)),r=this._context.new_var(o.Std.close(this._context)),a=o.Std.min(o.Std.low(this._context),r.get(1)),l=o.Std.close(this._context)-a,h=s-a,c=this.f_0(l,h,t),d=this.f_0(l,h,e),p=this.f_0(l,h,i),u=100*(4*c[0]+2*d[0]+p[0])/7;return[u]},this.main=function(t,e){return this._context=t,this._input=e,this.f_1()}}},{name:"VWMA",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e12}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA"},constructor:function(){this.main=function(t,e){var i,n,s,r,a;return this._context=t,this._input=e,i=o.Std.close(this._context),n=this._input(0),s=this._context.new_var(i),r=o.Std.vwma(s,n,this._context),a=r,[a]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:1e12},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:1e12}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Volume Oscillator"},constructor:function(){this.f_0=function(t,e){var i=100*(t-e)/e;return i},this.main=function(t,e){var i,n,s,r,a,l,h,c,d;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=o.Std.volume(this._context),r=this._context.new_var(s),a=o.Std.ema(r,i,this._context),l=this._context.new_var(s),h=o.Std.ema(l,n,this._context),c=this.f_0(a,h),d=c,[d]}}},{name:"Vortex Indicator",metainfo:{_metainfoVersion:42,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"}},precision:4,inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator",shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator"},constructor:function(){this.f_0=function(){var t=this._input(0),e=this._context.new_var(o.Std.low(this._context)),i=this._context.new_var(o.Std.abs(o.Std.high(this._context)-e.get(1))),n=o.Std.sum(i,t,this._context),s=this._context.new_var(o.Std.high(this._context)),r=this._context.new_var(o.Std.abs(o.Std.low(this._context)-s.get(1))),a=o.Std.sum(r,t,this._context),l=this._context.new_var(o.Std.atr(1,this._context)),h=o.Std.sum(l,t,this._context),c=n/h,d=a/h;return[c,d]},this.main=function(t,e){return this._context=t,this._input=e,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"}},precision:4,bands:[{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#808080",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#000080",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Willams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R"},constructor:function(){this.f_0=function(t,e,i){var o=100*(t-e)/(e-i);return o},this.main=function(t,e){var i,n,s,r,a,l,h,c,d;return this._context=t,this._input=e,i=this._input(0),n=o.Std.high(this._context),s=this._context.new_var(n),r=o.Std.highest(s,i,this._context),a=o.Std.low(this._context),l=this._context.new_var(a),h=o.Std.lowest(l,i,this._context),c=this.f_0(o.Std.close(this._context),r,h),d=c,[d]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:27,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{in_0:21,in_1:13,in_2:8}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"jawLength",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"teethLength",defval:13,type:"integer",min:1,max:1e12},{id:"in_2",name:"lipsLength",defval:8,type:"integer",min:1,max:1e12}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l,h,c,d,p,u,_,f;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=this._input(2),r=o.Std.hl2(this._context),a=this._context.new_var(r),l=o.Std.ema(a,i,this._context),h=this._context.new_var(r),c=o.Std.ema(h,n,this._context),d=this._context.new_var(r),p=o.Std.ema(d,s,this._context),u=l,_=c,f=p,[{value:u,offset:8},{value:_,offset:5},{value:f,offset:3}]}}}]},function(t,e,i){(function(e){"use strict";var o=i(116),n=i(41),s=i(28),r=function(t,e){this._server=t,this._session=e,this._timezone=null,this._isDWM=!1,this._resolution=null,this.seriesCompleted=new s,this._lastBarUpdates={}};r.prototype.lastBar=function(t){return this._lastBarUpdates[t]},r.prototype._userTimezone=function(){return this._timezone},r.prototype.setTimezone=function(t){this._timezone="exchange"===t?"exchange":e.get_timezone(t)},r.prototype.setResolution=function(t){this._isDWM=n.isDWM(t),this._resolution=t},r.prototype.onRequestMetadata=function(t,e){this._server.receiveLocalResponse({method:"studies_metadata",params:[this._session,t,e]})},r.prototype.onSymbolResolved=function(t,e){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,t,e]})},r.prototype.onSymbolError=function(t,e){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,t,e]})},r.prototype.onStudyError=function(t,e){this._server.receiveLocalResponse({method:"study_error",params:[this._session,t,e]})},r.prototype.onSeriesLoading=function(t,e){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,t,e]})},r.prototype.onSeriesCompleted=function(t,e,i){this._server.receiveLocalResponse({method:"series_completed",params:[this._session,t,i,e]}),this.seriesCompleted.fire(t)},r.prototype.onSeriesError=function(t,e){this._server.receiveLocalResponse({method:"series_error",params:[this._session,t,e]})},r.prototype.onSeriesClearData=function(t,e){var i={};i[t]={series:[],turnaround:e},this._server.receiveLocalResponse({method:"timescale_update",params:[this._session,i,{index:0,zoffset:0,changes:[],marks:[]}]})},r.prototype.onStudyCompleted=function(t,e){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,t,e]})},r.prototype.onStudyLoading=function(t,e){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,t,e]})},r.prototype._calcMarksTime=function(t,i,n,s,r){var a,l,h,c,d,p=e.get_timezone(i),u=this;if(this._isDWM)for(d=new o.Session,d.init(p,n),c=0;c<t.length;c++)h=t[c],a=s(h),l=e.utc_to_cal(p,1e3*a),l=d.spec.correctTradingDay(l,p),e.set_hms(l,0,0,0,0),t[c]=r(h,parseInt(l.valueOf()/1e3));else for(c=0;c<t.length;c++)t[c]=r(t[c],u.timeInTimezone(s(t[c]),p))},r.prototype.onTickmarksUpdated=function(t,e,i,o){var s,r,a,l,h,c,d;if(n.isEqual(o,this._resolution)){for(s=e.slice(0),this._calcMarksTime(s,i.timezone,i.session,function(t){return t},function(t,e){return e}),r=[],a=[],h=0;h<s.length;++h)c=s[h],r.push([this._spanByTime(c,l),c,t+h]),a.push(c),l=c;d={method:"tickmark_update",params:[this._session,{index:t,zoffset:0,changes:a,marks:r}]},this._server.receiveLocalResponse(d)}},r.prototype.onTimescaleUpdate=function(t,e,i,o,n){var s,r,a,l,h,c,d;for(this._lastBarUpdates[t]=i&&i[i.length-1],this._calcMarksTime(i,o.timezone,o.session,function(t){return t.value[0]},function(t,e){return t.exTime=e,t}),s={},s[t]={series:i,turnaround:e},r=[],a=[],h=0;h<i.length;++h)c=i[h].exTime,r.push([this._spanByTime(c,l),c,n+h]),a.push(i[h].value[0]),l=c;d={method:"timescale_update",params:[this._session,s,{index:n,zoffset:0,changes:a,marks:r}]},this._server.receiveLocalResponse(d)},r.prototype.onSeriesTimeframeUpdate=function(t,e,i,o,n){var s={method:"series_timeframe",params:[this._session,t,e,i,o,n]};this._server.receiveLocalResponse(s)},r.prototype.onPointsetDataUpdate=function(t,e,i,o){this._onDataUpdate(t,e,i,void 0,o,1)},r.prototype.onDataUpdate=function(t,e,i,o,n){this._onDataUpdate(t,e,i,o,n,0)},r.prototype._onDataUpdate=function(t,e,i,o,n,s){var r,a={},l=o?JSON.stringify({offsets:o}):"";a[t]={s:i,ns:{d:l,indexes:[]},turnaround:e},r={method:"data_update",params:[this._session,a]},this._server.receiveLocalResponse(r)},r.prototype.onQuotesData=function(t){this._server.receiveLocalResponse({method:"quote_symbol_data",params:t})},r.prototype.timeInTimezone=function(t,i){return"exchange"===this._userTimezone()?parseInt(e.utc_to_cal(i,1e3*t).valueOf()/1e3):parseInt(e.utc_to_cal(this._userTimezone(),1e3*t).valueOf()/1e3)},r.prototype._spanByTime=function(t,e){function i(t){return 60*t*60*1e3}function o(t){return 60*t*1e3}function n(t){return 1e3*t}var s,r,a,l=[{divisor:1,span:20},{divisor:n(1),span:19},{divisor:o(5),span:21},{divisor:o(30),span:22},{divisor:i(1),span:30},{divisor:i(3),span:31},{divisor:i(6),span:32},{divisor:i(12),span:33}];if(!e)return 20;if(s=new Date(1e3*e),r=new Date(1e3*t),r.getYear()!==s.getYear())return 70;if(r.getUTCMonth()!==s.getUTCMonth())return 60;if(r.getUTCDate()!==s.getUTCDate())return 50;for(a=l.length-1;a>=0;--a)if(Math.floor(s/l[a].divisor)!==Math.floor(r/l[a].divisor))return l[a].span},TradingView.ChartapiMessagerInstances=[],t.exports=r}).call(e,i(33))},function(t,e,i){(function(t){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return t.ticker+"_"+e}function r(t){return new Date(t).toISOString()}var a,l,h,c,d,p,u,_;Object.defineProperty(e,"__esModule",{value:!0}),a=function(){function t(t,e){var i,o;for(i=0;i<e.length;i++)o=e[i],o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),l=i(41),h=o(l),c=i(509),d=i(500),p=o(d),u=function(){function e(t,i,o,s){n(this,e),this._datafeed=t,this._symbolInfo=i,this._resolution=o,this._dwmAligner=s,this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._gaps=[],this._needPurgeCache=!1,this._realtimeOn=!1,this._endOfData=!1}return a(e,[{key:"addSubscription",value:function(t,e,i){var o=this,n=this._getNextSubscriptionId(),s=parseInt(t.from/1e3),r=parseInt(t.to/1e3);return this._pendingSubscribers.push({key:n,range:{from:s,to:r},onHistoryCallback:e,onErrorCallback:i}),setTimeout(function(){return o._processNextPendingSubscriber()},0),n}},{key:"removeSubscription",value:function(t){var e,i=this._pendingSubscribers.find(function(e){return e.key===+t});return i?void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(i),1):(e=this._subscribers.find(function(e){return e.key===+t}))?(this._subscribers.splice(this._subscribers.indexOf(e),1),void(this._subscribers.length||this._unsubscribeRealtime())):void console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,t))}},{key:"purgeCache",value:function(){this._needPurgeCache=!0}},{key:"_logMessage",value:function(e,i){(t.enabled("charting_library_debug_mode")||i)&&console.log("FEED [{0}|{1}]: {2}".format(this._symbolInfo.name,this._resolution,e))}},{key:"_purgeCache",value:function(){this._cache={bars:[]},this._gaps=[],this._errorMessage=null,this._needPurgeCache=!1,this._leftDate=null,this._endOfData=!1}},{key:"_processNextPendingSubscriber",value:function(){var t,e,i,o,n,s;if(this._pendingSubscribers.length&&!this._requesting){if(this._needPurgeCache&&this._purgeCache(),t=this._pendingSubscribers.pop(),this._logMessage("Processing bars request {0} from {1} to {2} ".format(t.key,r(1e3*t.range.from),r(1e3*t.range.to))),this._errorMessage)return this._logMessage("Return error:"+this._errorMessage),t.onErrorCallback(this._errorMessage),void this._processNextPendingSubscriber();if((!this._leftDate||t.range.from<this._leftDate)&&(e=new h.default(this._resolution),i=(e.inMilliseconds()||0)/1e3,o=!this._leftDate,n=!o&&!!this._cache.bars.length&&this._cache.bars[0].time/1e3-t.range.from<i,(o||!n)&&!this._endOfData))return this._pendingSubscribers.push(t),void this._ensureRequestedTo(t.range.from);s=this._moveSubscriberToRealtime(t),this._returnHistoryDataToSubscriber(t,s),this._subscribeRealtimeIfNeeded(),this._processNextPendingSubscriber()}}},{key:"_moveSubscriberToRealtime",value:function(t){var e={key:t.key,onHistoryCallback:t.onHistoryCallback,barset:null};return this._subscribers.push(e),e}},{key:"_subscribeRealtimeIfNeeded",value:function(){this._subscribers.length&&!this._realtimeOn&&this._subscribeRealtime()}},{key:"_subscribeRealtime",value:function(){var t,e,i=this;this._symbolInfo.expired||this._realtimeOn||(t=function(t){i._dwmAligner&&(t.time=i._dwmAligner.tradingDayToSessionStart(t.time)),i._putToCacheNewBar(t),i._subscribers.forEach(function(e){var i=e.barset;i.add(t),e.onHistoryCallback(i)})},e=function(){i._unsubscribeRealtime();var t=i._leftDate;i.purgeCache(),i._ensureRequestedTo(t)},this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,t,s(this._symbolInfo,this._resolution),e))}},{key:"_unsubscribeRealtime",value:function(){!this._symbolInfo.expired&&this._realtimeOn&&(this._datafeed.unsubscribeBars(s(this._symbolInfo,this._resolution)),this._realtimeOn=!1)}},{key:"_returnHistoryDataToSubscriber",value:function(t,e){var i,o=t.range,n=this._createBarset(o.from);n.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(t.key,n.count(),r(n.bars[0].time),r(n.bars[n.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(t.key)),e.barset=n,i=this._inGapNextTime(o.from),i&&(this._logMessage("Request {0} is in gap, nextTime = {1}".format(t.key,r(1e3*i))),n.nextTime=i),this._endOfData&&t.range.from<=this._leftDate&&(n.endOfData=!0),t.onHistoryCallback(n)}},{key:"_createBarset",value:function(t){var e=(0,c.lowerbound)(this._cache.bars,1e3*t,function(t,e){return t.time<e});return new p.default.BarSet(this._symbolInfo,this._cache.bars.slice(e))}},{key:"_ensureRequestedTo",value:function(t){var e,i,o,n=this;return this._leftDate&&this._leftDate<t?void this._processNextPendingSubscriber():(e=!this._leftDate,this._requesting=!0,i=t,o=this._leftDate?this._leftDate-1:parseInt(this._now()/1e3),this._leftDate=t,this._logMessage("Requesting data: [{0} ... {1}] ".format(r(1e3*i),r(1e3*o))),void this._datafeed.getBars(this._symbolInfo,this._resolution,i,o,function(t,e){n._requesting=!1,n._processBars(t,e)},function(t){n._requesting=!1,n._errorMessage=t,n._processNextPendingSubscriber()},e))}},{key:"_processBars",value:function(t,e){var i,o;this._checkBars(t),this._alignBarsTime(t),t.length>0?(i=t[0].time,o=t[t.length-1].time,this._logMessage("Receiving bars: total {0} bars in [{1} ... {2}] ".format(t.length,r(i),r(o))),i<1e3*this._leftDate&&this._logMessage("Returned more data than needed"),this._putToCache(t)?this._cache.bars.length&&this._leftDate>this._cache.bars[0].time/1e3&&(this._leftDate=this._cache.bars[0].time/1e3):this._logMessage("Incremental update failed. Starting full update.",!0),e&&e.nextTime?console.warn("nextTime should be set when there is no data in the requested period only"):e&&e.noData&&console.warn("noData should be set when there is no data in the requested period and earlier only")):(this._logMessage("Receiving bars: barset is empty"),e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format(r(1e3*e.nextTime))),this._addGap(e.nextTime),this._leftDate=Math.min(this._leftDate||this._now()/1e3,e.nextTime+1)):e&&e.noData&&(this._logMessage("EOD received"),this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._cache.bars[0].time/1e3))),this._processNextPendingSubscriber()}},{key:"_now",value:function(){return Date.now()+6e4}},{key:"_addGap",value:function(t){var e,i=this._gaps.find(function(e){return e.from===t});i||(e=(this._cache.bars.length?this._cache.bars[0].time:this._now())/1e3,this._gaps.push({from:t,to:e}))}},{key:"_inGapNextTime",value:function(t){var e=this._gaps.find(function(e){return e.from<t&&e.to>t});return e?e.from:null}},{key:"_getNextSubscriptionId",value:function(){return this._nextSubscriptionId++}},{key:"_checkBars",value:function(e){if(t.enabled("charting_library_debug_mode"))for(var i=1;i<e.length;i++)e[i].time<=e[i-1].time&&console.error("Corrupted bars, time {0} at {1} > {2} at {3}".format(e[i].time,i,e[i-1].time,i-1))}},{key:"_putToCache",value:function(t){if(0===t.length)return!0;if(this._cache.bars.length===t.length&&this._cache.bars[0].time===t[0].time&&this._cache.bars[this._cache.bars.length-1].time===t[t.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&t[t.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&t[t.length-1].time>=this._cache.bars[0].time){var e=this._cache.bars[this._cache.bars.length-1].time===t[t.length-1].time;if(this._cache.bars=[],!e)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return Array.prototype.unshift.apply(this._cache.bars,t),this._checkBars(this._cache.bars),!0}},{key:"_putToCacheNewBar",value:function(t){var e=this._cache.bars.length,i=t.time,o=0===e?NaN:this._cache.bars[e-1].time,n=0===e||o<i;n?this._cache.bars.push(t):o===i?this._cache.bars[e-1]=t:console.error("putToCacheNewBar: time violation, prev: "+r(o)+", cur: "+r(i))}},{key:"_alignBarsTime",value:function(t){if(this._dwmAligner)for(var e=0;e<t.length;e++)t[e].time=this._dwmAligner.tradingDayToSessionStart(t[e].time)}}]),e}(),_=function(){function t(e,i){n(this,t),this._threads={},this._datafeed=e,this._dwmAlignerCreator=i}return a(t,[{key:"createThread",value:function(t,e){return new u(this._datafeed,t,e,this._dwmAlignerCreator(e,t))}},{key:"purgeCache",value:function(){this._forEachThread(function(t,e){return e.purgeCache()})}},{key:"_forEachThread",value:function(t){var e=this;Object.keys(this._threads).forEach(function(i){return t(i,e._threads[i])})}},{key:"subscribe",value:function(t,e,i,o,n){var r,a=s(t,e);return this._threads[a]||(this._threads[a]=this.createThread(t,e)),r=this._threads[a].addSubscription(i,o,n),a+'"'+r}},{key:"unsubscribe",value:function(t){var e,i,o=t.split('"');return 2!==o.length?void console.warn("Wrong guid format"):(e=o[0],i=o[1],void this._threads[e].removeSubscription(i))}}]),t}(),e.DatafeedRequestsCachedProcessor=_}).call(e,i(1))},function(t,e){"use strict";function i(t,e){return t-e}function o(t,e,i,o,n){var s,r,a;for(void 0===o&&(o=0),void 0===n&&(n=t.length),s=n-o;0<s;)r=s>>1,a=o+r,i(t[a],e)?(o=a+1,s-=r+1):s=r;return o}function n(t,e,n,s){return void 0===n&&(n=0),void 0===s&&(s=0),o(t,e,i,n,s)}function s(t,e,i,o,n){var s,r,a;for(void 0===o&&(o=0),void 0===n&&(n=t.length),s=n-o;0<s;)r=s>>1,a=o+r,i(e,t[a])?s=r:(o=a+1,s-=r+1);return o}function r(t,e,o,n){return void 0===o&&(o=0),void 0===n&&(n=0),s(t,e,i,o,n)}e.lowerbound=o,e.lowerbound_int=n,e.upperbound=s,e.upperbound_int=r},function(t,e,i){"use strict";function o(t,e){this.handler=t,this.customId=e,this.requestHook=null}function n(){}TradingView.WEB_SOCKET_WAS_CONNECTED=!1,TradingView.STUDY_COUNT_LIMIT=120,n.prototype.defaultWatchlistSymbols=function(){},n.prototype.availableTimeFrames=function(t,e){},n.prototype.defaultResolutions=function(){},n.prototype.supportedSymbolsTypes=function(){},n.prototype.supportedExchangesList=function(){},n.prototype.futuresRegex=function(){},n.prototype.quoteCreateSession=function(t){},n.prototype.quoteDeleteSession=function(t){},n.prototype.quoteSetFields=function(t,e){},n.prototype.quoteAddSymbols=function(t,e){},n.prototype.quoteRemoveSymbols=function(t,e){},n.prototype.quoteFastSymbols=function(t,e){},n.prototype.depthCreateSession=function(t,e,i){},n.prototype.depthDeleteSession=function(t){},n.prototype.depthSetSymbol=function(t,e){},n.prototype.depthClearSymbol=function(t){},n.prototype.depthSetScale=function(t,e){},n.prototype.chartCreateSession=function(t,e){},n.prototype.chartDeleteSession=function(t){},n.prototype.createSession=function(t,e){},n.prototype.removeSession=function(t){},n.prototype.connected=function(){},n.prototype._getHost=function(t){},n.prototype.connect=function(){},n.prototype.disconnect=function(){},n.prototype.switchTimezone=function(t,e){},n.prototype.resolveSymbol=function(t,e,i,o,n){},n.prototype.createSeries=function(t,e,i,o,n,s,r){},n.prototype.removeSeries=function(t,e,i){},n.prototype.modifySeries=function(t,e,i,o,n,s){},n.prototype.requestMoreData=function(t,e,i,o){},n.prototype.requestMetadata=function(t,e,i){},n.prototype.isCanCreateStudy=function(){},n.prototype.createStudy=function(t,e,i,o,n,s,r){},n.prototype.removeStudy=function(t,e,i){},n.prototype.modifyStudy=function(t,e,i,o,n){},n.prototype.createPointset=function(t,e,i,o,n,s,r){},n.prototype.modifyPointset=function(t,e,i,o,n){},n.prototype.removePointset=function(t,e,i){},n.prototype.requestMoreTickmarks=function(t,e,i,o){},n.prototype.requestFirstBarTime=function(t,e,i,o){},n.prototype._invokeHandler=function(t,e){},n.prototype._sendRequest=function(t,e){},n.prototype._onMessage=function(t){},n.prototype._convertTimescaleResponse=function(t){},n.prototype._dispathNotification=function(t){},n.prototype._invokeNotificationHandler=function(t,e,i){},n.prototype._notifySessions=function(t){},n.prototype.unpack=function(t){},n.prototype.reconnectTimeout=function(t){},n.prototype.searchSymbols=function(t){},n.prototype.serverTimeOffset=function(){},n.prototype._isSafari5=function(){},n.prototype._isIE9=function(){},n.prototype._isIOS5=function(){},n.prototype._getPort=function(t){},n.prototype.getMarks=function(t,e,i,o,n){},n.prototype.getTimescaleMarks=function(t,e,i,o,n){},TradingView.declareClassAsPureInterface(n,"ChartApiInterface"),TradingView.ChartApiInterface=n,TradingView.HandlerInfo=o,e.HandlerInfo=o,e.ChartApiInterface=n},function(t,e,i){(function(e){"use strict";var o=i(59).StudyConsts,n=function(){function t(t){e.enabled("charting_library_debug_mode")&&console.warn("Overrides:"+t)}function n(t,e,i,o){t.defaults.inputs[e]=o,t.inputs[i].defval=o}function s(t,e){t.defaults.precision=e}function r(e,i,o,n){var s,r,a=o[1];if("color"===a){if(s=h(e,i),r=o.length>2?parseInt(o[2]):NaN,null==s&&!isNaN(r)&&r>0)return void t("Plot `{1}` of `{0}` does not have color #{2}".format(e.description,o[0],r));0==r||isNaN(r)?(e.defaults.styles[i].color=n,null!=s&&(s.colors[0].color=n)):s.colors[r].color=n}else{if(!e.defaults.styles[i].hasOwnProperty(a))return void t("Plot `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],a));"plottype"===a&&(n=v[n]),e.defaults.styles[i][a]=n}}function a(e,i,o,n){var s=o[1];return e.defaults.bands[i].hasOwnProperty(s)?("plottype"===s&&(n=v[n]),void(e.defaults.bands[i][s]=n)):void t("Band `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],s))}function l(e,i,o,n){var s=o[1];return e.defaults.filledAreasStyle[i].hasOwnProperty(s)?void(e.defaults.filledAreasStyle[i][s]=n):void t("Area `{1}` of `{0}` does not have property `{2}`".format(e.description,o[0],s))}function h(t,e){for(var i in t.plots)if("colorer"===t.plots[i].type&&t.plots[i].target===e)return t.defaults.palettes[t.plots[i].palette];return null}function c(t){var e,i,o=JSServer.studyLibrary;for(e=0;e<o.length;++e)if(i=o[e].metainfo,i.description.toLowerCase()===t.toLowerCase()||i.shortDescription.toLowerCase()===t.toLowerCase())return i;return null}function d(t,e){for(var i=0;i<t.inputs.length;++i)if(t.inputs[i].name.toLowerCase()===e.toLowerCase())return{id:t.inputs[i].id,index:i};return null}function p(t,e){for(var i in t.styles)if(t.styles[i].title.toLowerCase()===e.toLowerCase())return i;return null}function u(t,e){for(var i in t.filledAreas)if(t.filledAreas[i].title.toLowerCase()===e.toLowerCase())return t.filledAreas[i].id;return null}function _(t,e){if(!t.bands)return null;for(var i in t.bands)if(t.bands[i].name.toLowerCase()===e.toLowerCase())return i;return null}var f,g,m={"volume.transparency":"!transparency","upper limit":"UpperLimit","lower limit":"LowerLimit"},v={};if(Object.keys(o).forEach(function(t){0===t.indexOf("PLOT_")&&0!==t.indexOf("PLOT_TYPE_")&&(v[t.toLowerCase().substring(5)]=o[t])}),f={},f.setMetainfoProperty=function(e,i,o){var h,c,f,g,v,y,b,w,S,T,C;return i=m[i]||i,h=i.split("."),c=h[0],0===c.indexOf("!")?void(e[c.slice(1)]=o):(f=c.split(":"),c=f[0],c=m[c]||c,g=null,v=null,y=null,b=null,w="options"===c,S="precision"===c&&e.defaults&&e.defaults.precision,T=2===f.length?f[1]:null,"plot"!==T&&T||(g=p(e,c)),"band"!==T&&T||(v=_(e,c)),"area"!==T&&T||(y=u(e,c)),"input"!==T&&T||(b=d(e,c)),C=!!g+!!v+!!b+!!w+!!y+!!S,void(0===C?t("Study `{0}` has no plot or input `{1}`".format(e.description,c)):C>1?t("Study `{0}` ambiguous identifier `{1}`".format(e.description,c)):g?r(e,g,h,o):b?n(e,b.id,b.index,o):v?a(e,v,h,o):y?l(e,y,h,o):S?s(e,o):e[h[1]]=o))},f.setProperty=function(e,i){var o=e.split(".")[0],n=c(o);return n?void f.setMetainfoProperty(n,e.substring(o.length+1),i):void t("Study `{0}` not found".format(o))},i(506),"undefined"!=typeof __initialMetainfoOverrides&&__initialMetainfoOverrides)for(g in __initialMetainfoOverrides)f.setProperty(g,__initialMetainfoOverrides[g]);return f}();t.exports=n}).call(e,i(1))},function(t,e,i){"use strict";function o(t,e,i){this._chartWidgetCollection=t,this._chartSaverInstance=e,this._chartApiInstance=i}var n,s=i(42),r=i(513),a=i(245),l=i(38),h=i(325),c=i(68),d=i(81),p=i(460),u=i(36);o.prototype.subscribe=function(t,e){l.subscribe(t,e)},o.prototype.onContextMenu=function(t){l.subscribe("onContextMenu",function(e){e.callback(t(e.unixtime,e.price))})},o.prototype.onGrayedObjectClicked=function(t){l.subscribe("onGrayedObjectClicked",t)},o.prototype.activeChart=function(){return new r(this._chartWidgetCollection.activeChartWidget.value())},o.prototype.changeSymbol=function(t,e,i){s.interval.setValue(e),s.symbol.setValue(t),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)},o.prototype.setLayout=function(t){this._chartWidgetCollection.layout.setValue(t)},o.prototype.layout=function(){return this._chartWidgetCollection.layout.value()},o.prototype.chartsCount=function(){return a[this.layout()].count},o.prototype.chart=function(t){if(void 0===t&&(t=0),t<0||t>this.chartsCount())throw Error("Incorrect index: "+t);return new r(this._chartWidgetCollection.getAll()[t])},o.prototype.getSymbolInterval=function(t){var e={symbol:s.symbol.value(),interval:s.interval.value()};return t&&t(e),e},o.prototype.getVisibleRange=function(t){var e=this.activeChart().getVisibleRange();return t&&t(e),e},o.prototype.saveChart=function(t){var e=this;this._chartSaverInstance.whenReadyToSave(function(){var i=e._chartSaverInstance.saveToJSON();return t&&t(JSON.parse(i.content))})},o.prototype.loadChart=function(t){this._chartApiInstance.purgeCache(),this._chartApiInstance._studyEngine.stopSources(),this._chartWidgetCollection.loadContent(t.json),this._chartWidgetCollection.purgeUnusedWidgets(),t.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(t.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(t.extendedData.uid),
this._chartWidgetCollection.metaInfo.name.setValue(t.extendedData.name)),s.symbol.setValue(this.activeChart().symbol()),l.emit("chart_loaded")},o.prototype.getStudiesList=function(){return this._chartApiInstance.allStudiesMetadata().filter(function(t){return!t.is_hidden_study}).map(function(t){return t.name||t.description})},o.prototype.getSavedCharts=function(t){u.getCharts(t)},o.prototype.loadChartFromServer=function(t){u.loadChart(t)},o.prototype.saveChartToServer=function(t,e,i,o){this._chartSaverInstance.saveChartSilently(t,i,e,o)},o.prototype.removeChartFromServer=function(t,e){u.removeChart(t,e)},o.prototype.getIntervals=function(){return Object.keys(p.getIntervals())},o.prototype.closePopupsAndDialogs=function(){c.dialogs.forEach(function(t){t.dialog.find("._tv-dialog-title-close").click()}),h.hideAll()},n={cursor:"",dot:"",arrow_cursor:"arrow",eraser:"",measure:"",zoom:"",brush:"LineToolBrush"},o.prototype.selectLineTool=function(t){var e=i(515);if(e[t])t=e[t].name;else{if(!n.hasOwnProperty(t))return;t=n[t]||t}d.tool.value()!==t&&(TradingView.supportTouch()&&this._chartWidgetCollection.selectedSource.value()&&this._chartWidgetCollection.activeChartWidget.value().model().lineBeingCreated()&&this._chartWidgetCollection.activeChartWidget.value().model().cancelCreatingLine(),d.tool.setValue(t))},o.prototype.selectedLineTool=function(){var t,e,o,s=i(515),r=Object.keys(s),a=d.tool.value();for(t=0;t<r.length;++t)if(s[r[t]].name===a)return r[t];for(r=Object.keys(n),t=0;t<r.length;++t){if(e=r[t],o=n[e],o&&o===a)return r[t];if(e===a)return e}return""},o.prototype.createStudyTemplate=function(t,e){var i=this.activeChart().createStudyTemplate(t);return e&&e(i),i},o.prototype.mainSeriesPriceFormatter=function(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(t){function e(){i&&(i(),i=null)}t=t||{},t.title=t.title||"",t.body=t.body||"";var i=t.callback;c.showNotice(t.title,"",{html:t.body,onOkButtonClick:e}).on("destroy",e)},o.prototype.showConfirmDialog=function(t){function e(t){i&&(i(t),i=null)}if(t=t||{},t.title=t.title||"",t.body=t.body||"",!t.callback)throw Error("callback must be exist");var i=t.callback;c.showConfirm(t.title,t.body,e.bind(null,!0),e.bind(null,!1),{okButtonText:$.t("OK"),cancelButtonText:$.t("Cancel")}).on("destroy",e.bind(null,!1))},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t){var e,i,o=Object.keys(p),n=o.length;for(e=0;e<n;++e)if(i=o[e],p[i].name===t)return i;return null}var n=i(514),s=i(511),r=i(114),a=i(80).DefaultProperty,l=i(179).availIcons,h=i(116),c=i(41),d=i(33),p=i(515),u=function(t){this._chartWidget=t};u.prototype._makeSubscriptionFromDelegate=function(t){var e=$.extend({},t);return delete e.fire,e},u.prototype.executeAction=function(t){this._chartWidget.executeActionByName(t)},u.prototype.executeActionById=function(t){this._chartWidget.executeActionById(t)},u.prototype.getCheckableActionState=function(t){return this._chartWidget.getCheckableActionState(t)},u.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},u.prototype.clearMarks=function(){this._chartWidget.clearMarks()},u.prototype.symbol=function(){return this._chartWidget.getSymbol()},u.prototype.symbolExt=function(){var t=this._chartWidget.model().mainSeries().symbolInfo();return t?{symbol:t.name,full_name:t.full_name,exchange:t.exchange,description:t.description,type:t.type}:null},u.prototype.resolution=function(){return this._chartWidget.model().mainSeries().properties().interval.value()},u.prototype.setSymbol=function(t,i){function o(){n._chartWidget.model().mainSeries().onDataLoaded().unsubscribe(null,o),i&&i()}if(t!==this.symbol()||e.enabled("same_data_requery")){var n=this;return this._chartWidget.model().mainSeries().onDataLoaded().subscribe(null,o),this._chartWidget.setSymbol(t)}},u.prototype.resetData=function(){var t=e.enabled("same_data_requery");e.enable("same_data_requery"),this.setSymbol(this.symbol()),e.setEnabled("same_data_requery",t)},u.prototype.setResolution=function(t,e){function i(){o._chartWidget.model().mainSeries().onDataLoaded().unsubscribe(null,i),e&&e()}if(t=t.toUpperCase(),t!==this.resolution()){var o=this;return this._chartWidget.model().mainSeries().onDataLoaded().subscribe(null,i),this._chartWidget.setResolution(t)}},u.prototype.setEntityVisibility=function(t,e){var i,o=this._chartWidget.model().model().dataSourceForId(t);o&&(i=o.properties(),i&&i.visible&&i.visible.setValue(e))},u.prototype.getAllStudies=function(){return this._chartWidget.model().model().allStudies().map(function(t){return{id:t._id,name:t._metaInfo.description}})},u.prototype.getAllShapes=function(){return this._chartWidget.model().model().allLineTools().map(function(t){return{id:t._id,name:o(t.toolname)}}).filter(function(t){return null!==t.name})},u.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},u.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},u.prototype.removeEntity=function(t){var e=this._chartWidget.model().chartModel().dataSourceForId(t);return e?void this._chartWidget.model().chartModel().removeSource(e,!0):void console.warn("Can't find a source with id: "+t)},u.prototype.createStudyTemplate=function(t){return this._chartWidget.model().model().studyTemplate(t.saveInterval)},u.prototype.applyStudyTemplate=function(t){this._chartWidget.model().model().restoreStudyTemplate(t,""+1e3*Math.random())},u.prototype.setVisibleRange=function(t,e){if(void 0===t||!t.from||!t.to||isNaN(t.from)||isNaN(t.to))return void console.warn("Wrong time range: "+JSON.stringify(t));var i=this._alignPoints([parseInt(t.from),parseInt(t.to)]);t.from=i[0],t.to=i[1],this._chartWidget.setVisibleTimeRange(t.from,t.to,e)},u.prototype.getVisibleRange=function(){var t=this._chartWidget.model().timeScale(),e=t.visibleBars(),i={from:t.indexToUserTime(e.firstBar()<0?0:e.firstBar()),to:t.indexToUserTime(e.lastBar())};return{from:(+i.from||0)/1e3,to:(+i.to||0)/1e3}},u.prototype.getVisiblePriceRange=function(){if(!this._chartWidget.model().mainSeries())return null;var t=this._chartWidget.model().mainSeries().priceScale();return t.priceRangeInPrice()},u.prototype._createTradingPrimitive=function(t,e){function i(){var t=4,e=o._chartWidget.model().timeScale().m_points.lastTimePointIndex(),i=o._chartWidget.model().mainSeries().data().valueAt(e)[t];return{index:e,price:i}}var o=this,n=this._chartWidget.model().model(),s=n.paneForSource(this._chartWidget.model().model().mainSeries()),r=e?this._chartWidget.model().chartModel():this._chartWidget.model(),a=r.createLineTool(s,i(),t);return a._adapter},u.prototype.createOrderLine=function(t){var t=t||{};return this._createTradingPrimitive("LineToolOrder",t.disableUndo)},u.prototype.createPositionLine=function(t){var t=t||{};return this._createTradingPrimitive("LineToolPosition",t.disableUndo)},u.prototype.createExecutionShape=function(t){var t=t||{};return this._createTradingPrimitive("LineToolExecution",t.disableUndo)},u.prototype.createVerticalLine=function(t,e){this._chartWidget.createShape(t,$.extend(e,{shape:"vertical_line"}))},u.prototype.createShape=function(t,e,i){return this.createMultipointShape([t],e,i)},u.prototype._alignPoints=function(t){var e,i=this._chartWidget.model().model(),o=i.mainSeries(),n=o.symbolInfo(),s=d.get_timezone(n.timezone);return i.timeScale().isEmpty()?t:(e=(new h.Session).init(s,n.session),t.map(function(t){return h.alignExchangeTimeToSessionStartAndReturnUTC(e.timezone,e.spec,new Date(1e3*t))/1e3}))},u.prototype.createMultipointShape=function(t,i,o){function n(t,e,i,o){var n,s,r,a=S.closestIndexLeft(e)||0,l={index:a},h=S.valueAt(a);return e>h&&(n=w.syncModel().distance(h,e),n.success&&(l.index=l.index+n.result)),i?l.price=i:(s=["open","high","low","close"],r=o?s.indexOf(o)+1:1,r<=0&&(r=1),l.price=T.valueAt(a)[r]),l}var s,r,h,d,u,_,f,g,m,v,y=i.disableUndo?this._chartWidget.model().model():this._chartWidget.model(),b=this._chartWidget.model().model(),w=b.mainSeries(),S=b.timeScale().points(),T=w.data();if(!b.timeScale().isEmpty()){for(s=b.paneForSource(w),r=t.map(function(t){return t.time}),h=c.isDWM(w.interval())&&!e.enabled("disable_resolution_rebuild")?this._alignPoints(r):r,u=[],d=0;d<t.length;d++)_=t[d],u.push(n(_.time,h[d],_.price,_.channel));if(f=p[i.shape]||p.flag,"LineToolPolyline"===f.name)u[0].price===u[u.length-1].price&&u[0].index===u[u.length-1].index||u.push(u[0]);else if("LineToolIcon"===f.name){if(i.icon=i.icon||i.overrides&&i.overrides.icon,!i.hasOwnProperty("icon"))throw Error("icon must be specified in options");if(l.indexOf(i.icon)===-1)throw Error("icon value must be valid");i.overrides=i.overrides||{},i.overrides.icon=i.icon}if(g=new a(f.name.toLowerCase()),i.overrides)for(m in i.overrides)g[m]&&g[m].setValue(i.overrides[m]);if(f.supportsText&&i.text&&g.text.setValue(i.text),v=y.createLineTool(s,u[0],f.name,g),v.pointsCount()!==u.length&&v.pointsCount()!==-1)throw Error("Wrong points count for "+i.shape+". Required "+v.pointsCount());for(d=1;d<u.length&&this._chartWidget.model().lineBeingCreated();d++)y.coninueCreatingLine(u[d],{},d<u.length-1);return i.lock&&v.setUserEditEnabled(!1),i.disableSelection&&(v.customization.disableSelection=!0),i.disableSave&&(v.customization.disableSave=!0),i.hasOwnProperty("showInObjectsTree")&&(v.customization.showInObjectsTree=i.showInObjectsTree),i.zOrder&&("top"===i.zOrder?y.bringToFront(v):"bottom"===i.zOrder&&y.sendToBack(v)),o&&o(v.id()),v.id()}},u.prototype.createStudy=function(t,e,i,o,a,l){var h,c,d,p;if(t=t.toLowerCase(),h=r.findStudyMetaInfoByDescription(this._chartWidget.model().studiesMetaData(),t),h=$.extend({},h),delete h.state,h||console.warn("Study `"+t+"` not found."),c={},l){l=l;for(d in l)s.setMetainfoProperty(h,d,l[d]);c.styles=h.defaults.styles,c.bands=h.defaults.bands,c.filledAreasStyle=h.defaults.filledAreasStyle}o&&(c.inputs=n.getStudyRecordFromArray([t].concat(o),this._chartWidget).inputs),p=this._chartWidget.model().chartModel().insertStudy(h,c,e),i&&p.setUserEditEnabled(!1),a&&a(p.id())},u.prototype.chartType=function(){return this._chartWidget.model().mainSeries().properties().style.value()},u.prototype.setChartType=function(t){this._chartWidget.model().mainSeries().properties().style.setValue(t)},u.prototype.priceFormatter=function(){return this._chartWidget.model().mainSeries().priceScale().formatter()},u.prototype.onDataLoaded=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onCompleted())},u.prototype.onSymbolChanged=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onSymbolResolved())},u.prototype.onIntervalChanged=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())},u.prototype.dataReady=function(t){var e=!this._chartWidget.model()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();return t&&(e?this.onDataLoaded().subscribe(null,t,!0):t()),!e},u.prototype.crossHairMoved=function(t){this._makeSubscriptionFromDelegate(this._chartWidget.model().chartModel().crossHairMoved()).subscribe(null,t)},t.exports=u}).call(e,i(1))},function(t,e){"use strict";var i=function(){function t(t){return t.is_price_study}function e(t,e){var i,o=e.slice(0).toLowerCase();if(t){for(i=0;i<t.length;++i)if(t[i].description.toLowerCase()===o||t[i].shortDescription.toLowerCase()===o)return t[i];throw Error("Can't find metainfo for `"+e+"`")}throw Error("There is no studies metainfo at all")}function i(t){return t.inputs.map(function(t){return{id:t.id,type:t.type,name:t.name}})}function o(o,n){var s,a,l,h,c,d,p,u,_;if(!Array.isArray(o))return s=e(n.model().studiesMetaData(),o),{id:s.id,overlay:t(s)};for(a=o.slice(0),l=a[0],s=e(n.model().studiesMetaData(),l),h=t(s),c=i(s),p=a.splice(1),u=0;u<p.length;++u)d||(d={}),_=r[c[u].type]||r.string,d[c[u].id]=_(p[u]);return{id:s.id,name:l,overlay:h,inputs:d}}function n(t,o,n){function s(t){return t.name.toLowerCase()===a}var r,a,l,h=e(n.model().studiesMetaData(),t),c=i(h),d={};for(r in o)a=r.toLowerCase(),l=c.filter(s),0!==l.length?(l=l[0],d[l.id]=o[r]):console.warn("Uknown input `"+r+"` of `"+t+"`");return{id:h.id,name:t,inputs:d}}var s={},r={bool:function(t){return!!t},integer:function(t){return parseInt(t)},float:function(t){return parseFloat(t)},string:function(t){return t}};return s.getStudyRecordFromArray=function(t,e){return e=e||chartWidget,o(t,e)},s.getStudyRecordFromObject=function(t,e,i){return i=i||chartWidget,n(t,e,i)},s}();t.exports=i},function(t,e){"use strict";t.exports={text:{name:"LineToolText",supportsText:!0},anchored_text:{name:"LineToolTextAbsolute",supportsText:!0},note:{name:"LineToolNote",supportsText:!0},anchored_note:{name:"LineToolNoteAbsolute",supportsText:!0},callout:{name:"LineToolCallout",supportsText:!0},balloon:{name:"LineToolBalloon",supportsText:!0},arrow_up:{name:"LineToolArrowMarkUp",supportsText:!0},arrow_down:{name:"LineToolArrowMarkDown",supportsText:!0},arrow_left:{name:"LineToolArrowMarkLeft",supportsText:!0},arrow_right:{name:"LineToolArrowMarkRight",supportsText:!0},price_label:{name:"LineToolPriceLabel"},flag:{name:"LineToolFlagMark"},vertical_line:{name:"LineToolVertLine"},horizontal_line:{name:"LineToolHorzLine"},horizontal_ray:{name:"LineToolHorzRay"},trend_line:{name:"LineToolTrendLine"},trend_angle:{name:"LineToolTrendAngle"},arrow:{name:"LineToolArrow"},ray:{name:"LineToolRay"},extended:{name:"LineToolExtended"},parallel_channel:{name:"LineToolParallelChannel"},disjoint_angle:{name:"LineToolDisjointAngle"},flat_bottom:{name:"LineToolFlatBottom"},pitchfork:{name:"LineToolPitchfork"},schiff_pitchfork_modified:{name:"LineToolSchiffPitchfork"},schiff_pitchfork:{name:"LineToolSchiffPitchfork2"},inside_pitchfork:{name:"LineToolInsidePitchfork"},pitchfan:{name:"LineToolPitchfan"},gannbox:{name:"LineToolGannSquare"},gannbox_square:{name:"LineToolGannComplex"},gannbox_fan:{name:"LineToolGannFan"},fib_retracement:{name:"LineToolFibRetracement"},fib_trend_ext:{name:"LineToolTrendBasedFibExtension"},fib_speed_resist_fan:{name:"LineToolFibSpeedResistanceFan"},fib_timezone:{name:"LineToolFibTimeZone"},fib_trend_time:{name:"LineToolTrendBasedFibTime"},fib_circles:{name:"LineToolFibCircles"},fib_spiral:{name:"LineToolFibSpiral"},fib_speed_resist_arcs:{name:"LineToolFibSpeedResistanceArcs"},fib_wedge:{name:"LineToolFibWedge"},fib_channel:{name:"LineToolFibChannel"},xabcd_pattern:{name:"LineTool5PointsPattern"},cypher_pattern:{name:"LineToolCypherPattern"},abcd_pattern:{name:"LineToolABCD"},triangle_pattern:{name:"LineToolTrianglePattern"},"3divers_pattern":{name:"LineToolThreeDrivers"},head_and_shoulders:{name:"LineToolHeadAndShoulders"},elliott_impulse_wave:{name:"LineToolElliottImpulse"},elliott_triangle_wave:{name:"LineToolElliottTriangle"},elliott_triple_combo:{name:"LineToolElliottTripleCombo"},elliott_correction:{name:"LineToolElliottCorrection"},elliott_double_combo:{name:"LineToolElliottDoubleCombo"},cyclic_lines:{name:"LineToolCircleLines"},time_cycles:{name:"LineToolTimeCycles"},sine_line:{name:"LineToolSineLine"},long_position:{name:"LineToolRiskRewardLong"},short_position:{name:"LineToolRiskRewardShort"},forecast:{name:"LineToolPrediction"},date_range:{name:"LineToolDateRange"},price_range:{name:"LineToolPriceRange"},date_and_price_range:{name:"LineToolDateAndPriceRange"},bars_pattern:{name:"LineToolBarsPattern"},ghost_feed:{name:"LineToolGhostFeed"},projection:{name:"LineToolProjection"},rectangle:{name:"LineToolRectangle"},rotated_rectangle:{name:"LineToolRotatedRectangle"},ellipse:{name:"LineToolEllipse"},triangle:{name:"LineToolTriangle"},polyline:{name:"LineToolPolyline"},curve:{name:"LineToolBezierQuadro"},double_curve:{name:"LineToolBezierCubic"},arc:{name:"LineToolArc"},icon:{name:"LineToolIcon"}}},function(t,e,i){"use strict";var o=i(500);i(506),JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:15,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"}},precision:4,inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol",name:"Symbol",type:"symbol"}],id:"Compare@tv-basicstudies-1"},constructor:function(){this.init=function(t,e){this._context=t,this._context.new_sym(e(1),o.Std.period(this._context),o.Std.period(this._context))},this.main=function(t,e){var i,n,s,r,a,l;return this._context=t,i=this._context.new_var(this._context.symbol.time),n=o.Std.period(this._context),this._context.select_sym(1),s=this._context.new_var(this._context.symbol.time),r=o.Std[e(0)](this._context),a=this._context.new_var(r),this._context.select_sym(0),l=a.adopt(s,i,0),[l]}}},{name:"Overlay",metainfo:{_metainfoVersion:15,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{},precision:4,inputs:{}},plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"}],styles:{open:{},high:{},low:{},close:{}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0}],id:"Overlay@tv-basicstudies-1"},constructor:function(){this.init=function(t,e){this._context=t,this._context.new_sym(e(0),o.Std.period(this._context),o.Std.period(this._context))},this.main=function(t,e){var i,n,s,r,a,l;return this._context=t,i=this._context.new_var(this._context.symbol.time),this._context.select_sym(1),n=this._context.new_var(this._context.symbol.time),s=this._context.new_var(o.Std.open(this._context)),r=this._context.new_var(o.Std.high(this._context)),a=this._context.new_var(o.Std.low(this._context)),l=this._context.new_var(o.Std.close(this._context)),this._context.select_sym(0),[s.adopt(n,i,0),r.adopt(n,i,0),a.adopt(n,i,0),l.adopt(n,i,0)]}}},{name:"Volume",metainfo:{_metainfoVersion:15,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,transparency:65,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:65,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:65,visible:!0,color:"#0496FF"}},precision:0,palettes:{volumePalette:{colors:{0:{color:"#FF0000",width:1,style:0},1:{color:"#008000",width:1,style:0}}}},inputs:{showMA:!1,maLength:20}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"}],styles:{vol:{title:"Volume",histogramBase:0},vol_ma:{title:"Volume MA",histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[{id:"showMA",name:"show MA",defval:!1,type:"bool"},{id:"maLength",name:"MA Length",defval:20,type:"integer",min:1,max:2e3}],id:"Volume@tv-basicstudies-1"},constructor:function(){this.f_0=function(t,e){var i=o.Std.gt(t,e)?0:1;return i},this.f_1=function(t,e){var i=t?e:o.Std.na();return i},this.main=function(t,e){var i,n,s,r,a,l,h;return this._context=t,this._input=e,i=this._input(0),n=o.Std.volume(this._context),s=this.f_0(o.Std.open(this._context),o.Std.close(this._context)),r=o.Std.volume(this._context),a=this._context.new_var(r),l=o.Std.sma(a,this._input(1),this._context),h=this.f_1(i,l),[n,s,h]}}},{name:"ZigZag",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#008000"}},precision:4,inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"ZigZag",shortDescription:"ZigZag",is_price_study:!0,classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"integer",min:1,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1e3}],id:"ZigZag@tv-basicstudies-1"},constructor:function(){this.main=function(t,e){var i,n,s,r,a,l,h,c;return this._context=t,this._input=e,i=this._input(0),n=this._input(1),s=i/100,r=n/2,a=o.Std.zigzag(s,r,this._context),l=o.Std.zigzagbars(s,r,this._context),h=a,c=l,[h,c]}}}])}]);