'},nApS:function(t,e){t.exports=''},nSyy:function(t,e,o){},rXte:function(t,e){t.exports=''},tPkB:function(t,e,o){"use strict";(function(e,i){function n(t){this._chartWidgetCollection=t,this._bindings=[],this._hasAlertWathcedValue=null,this._$templatesButton=null,this._currentProperties=null,this._toolbarWidgets=[],this._clearProeprtiesOnHideTimeoutId=null,this._init(),this.attachHandlers()}function r(t,e){t.push({id:e,widget:$(''+e+"
")[0]})}function s(t,e){t.push({id:e.value,widget:$(e.iconSvgCode)[0]})}function a(t){return function(t,e){return $("").addClass("tv-linetool-properties-toolbar__icon").addClass(e).append(t)[0]}(t,"tv-linetool-properties-toolbar__icon--line-props")}
var l,d,c,p,u,h,g,_,v,f,b,y,w,m,C,x=o("DxCR"),W=x.PropertyPage,T=x.ColorBinding,L=o("fTGZ").BarsMarksContainer,S=o("mMWL"),P=o("guTw"),E=o("bR4N").bindPopupMenu,k=o("Ocx9").DefaultProperty,B=o("my99").GroupButtonFloatingToolbar,z=o("a7Ha").LineEnd,V=o("VNzU").isMultipleLayout,A=o("yMne"),M=o("CW80").isLineTool,F=o("tITk").trackEvent;o("m/4m"),o("nSyy"),n.prototype.activeChartWidget=function(){return this._chartWidgetCollection.activeChartWidget.value()},n.prototype.selectedSources=function(){return this._chartWidgetCollection.selectedSources.value()},n.prototype._init=function(){this._floatingToolbar=new B({addClass:"tv-linetool-properties-toolbar",defaultPosition:{top:A.HEADER_TOOLBAR_HEIGHT_EXPANDED+15,left:window.innerWidth/2},positionSettingsKey:"properties_toolbar.position"}),this._floatingToolbar.onWidgetStateChanged().subscribe(this,this._onPropertyChangedInToolbar),this._sourceActions=this._createSourceActions(),this._sourceActions.forEach(function(t){this._floatingToolbar.addWidget(t.button)},this)},n.prototype._bindPopupMenuDirection=function(){return this._floatingToolbar.isVertical()?"right":"down"},n.prototype._onPropertyChangedInToolbar=function(t,e){this._currentProperties&&this.activeChartWidget().model().setProperty(this._currentProperties[t],e)},n.prototype._onPropertyChanged=function(t,e){this._floatingToolbar.setGroupedWidgetState(t,e.value())},n.prototype._hideAllSourceActions=function(){this._sourceActions.forEach(function(t){this._floatingToolbar.hideWidget(t.button)},this),this._sourceActionsVisible=!1},n.prototype._updateSourceActionsVisibility=function(t){this._sourceActionsVisible=!1,this._sourceActions.forEach(function(e){!e.isVisibleForSources||e.isVisibleForSources(t)?(this._floatingToolbar.showWidget(e.button),this._sourceActionsVisible=!0):this._floatingToolbar.hideWidget(e.button)},this)},n.prototype.attachHandlers=function(){S.tool.subscribe(this.onToolChanged.bind(this),{callWithLast:!0}),this._chartWidgetCollection.selectedSources.subscribe(this.onSourceChanged.bind(this)),this._chartWidgetCollection.layout.subscribe(this._updateCloneButtonTitle.bind(this))},n.prototype._updateCloneButtonTitle=function(){this._setButtonTitle(this._cloneButton,this._cloneButtonTitle())},n.prototype.onToolChanged=function(t,e){if(t&&-1!==t.toLowerCase().indexOf("linetool")){e=e instanceof k?e:new k(t.toLowerCase());this._hideAllSourceActions(),this.showPropertiesOf(t,e),this.showTemplatesOf({tool:t,properties:e}),this._updateVisibility()}else this.selectedSources()?this.onSourceChanged(this.selectedSources()):this.hide()},n.prototype.findSourceOnWidget=function(t){var e,o,i;for(e=0;e'+o("rXte")+'
',buttonClass:"tv-linetool-properties-toolbar__button apply-common-tooltip",defaultsCallback:function(){void 0!==i?s.activeChartWidget().model().restorePropertiesForSource(i):r._restoreFactoryDefaults();s.showPropertiesOf(n,r)},saveAsText:$.t("Save Drawing Template As..."),applyDefaultText:$.t("Apply Default Drawing Template"),getDataForSaveAs:i?function(){return i.template()}:null,popupActiveClass:"i-dropped",popupDirection:this._bindPopupMenuDirection.bind(this)}),this._$templatesButton=this._templatesList.createButton().attr("title",$.t("Templates")).on("click",function(){this._trackContextAction("Templates")}.bind(this)),this._floatingToolbar.addWidget(this._$templatesButton[0],{index:0})),this._templatesVisible=!0)},n.prototype.templatesList=function(){return this._templatesList},n.prototype._createButton=function(t){var e,o,i;return t=t||{},e=document.createElement("div"),this._setButtonTitle(e,t.title),e.className+="tv-linetool-properties-toolbar__button apply-common-tooltip",e.addEventListener("click",t.callback),t.svgIcon&&((o=document.createElement("div")).classList.add("tv-linetool-properties-toolbar__icon"),o.appendChild(t.svgIcon),e.appendChild(o)),t.addCaret&&((i=document.createElement("div")).className="tv-caret tv-caret--small tv-caret--colored tv-linetool-properties-toolbar__caret",e.appendChild(i)),e},n.prototype._setButtonTitle=function(t,e){t.setAttribute("title",e)},n.prototype._createSettingsButton=function(){
var t=this;return this._createButton({title:$.t("Settings"),callback:function(){t._trackContextAction("Settings"),t.activeChartWidget().showChartPropertiesForSource(t.selectedSources()[0],null,{onWidget:t.activeChartWidget()._options.onWidget})},svgIcon:$(o("RsxI"))[0]})},n.prototype._createZOrderButton=function(){var t=this._createButton({title:$.t("Visual Order"),callback:function(){t.classList.contains("i-dropped")||(this._trackContextAction("Visual order"),$(t).trigger("button-popup",[this._getZOrderActions()]))}.bind(this),svgIcon:$(o("tzjn"))[0],addCaret:!0});return E($(t),null,{direction:this._bindPopupMenuDirection.bind(this),event:"button-popup",reverse:!1,notCloseOnButtons:!0,activeClass:"i-dropped"}),t},n.prototype._cloneButtonTitle=function(){var t=$.t("Clone");return e.enabled("datasource_copypaste")&&(t+=", "+$.t("Copy")),V(this._chartWidgetCollection.layout.value())&&(t+=", "+$.t("Sync")),t},n.prototype._createCloneButton=function(){var t=this._createButton({title:this._cloneButtonTitle(),callback:function(){t.classList.contains("i-dropped")||(this._trackContextAction("Clone"),$(t).trigger("button-popup",[this._getCloneActions()]))}.bind(this),svgIcon:$(o("WRHa"))[0],addCaret:!0});return E($(t),null,{direction:this._bindPopupMenuDirection.bind(this),event:"button-popup",reverse:!1,notCloseOnButtons:!0,activeClass:"i-dropped"}),t},n.prototype._createLockButton=function(){var t=this._createButton({title:$.t("Lock"),callback:function(){this._trackContextAction("Lock"),this.activeChartWidget().toggleLockSelectedObject()}.bind(this),svgIcon:$(o("gPdB"))[0]});return this._lockChangeListener=function(e){t.classList.toggle("i-active",!!e.value())},t},n.prototype._createHideButton=function(){return this._createButton({title:$.t("Hide"),callback:function(){this._trackContextAction("Hide"),this.activeChartWidget().hideSelectedObject()}.bind(this),svgIcon:$(o("nApS"))[0]})},n.prototype._createRemoveButton=function(){return this._createButton({title:$.t("Remove"),callback:function(){this._trackContextAction("Remove"),this.activeChartWidget().removeSelectedSources()}.bind(this),svgIcon:$(o("RRhU"))[0]})},n.prototype._createSourceActions=function(){var t=[];return e.enabled("property_pages")&&t.push({button:this._createSettingsButton(),isVisibleForSources:function(t){return 1===t.length}}),this._cloneButton=this._createCloneButton(),t.push({button:this._createZOrderButton()},{button:this._cloneButton,isVisibleForSources:function(t){var e=this;return t.filter(function(t){var o=TradingView.className(t.constructor);return!e.activeChartWidget().model().model().isSingleInstanceLineTool(o)}).length}.bind(this)},{button:this._createLockButton()},{button:this._createHideButton()},{button:this._createRemoveButton()}),t},n.prototype._getCloneActions=function(){var t=this.activeChartWidget().model(),o=this.selectedSources(),i=[],n=o.filter(function(t){return t.properties().clonable.value()});return n.length&&i.push({title:$.t("Clone"),action:function(){t.cloneLineTools(n)}}),e.enabled("datasource_copypaste")?(i.push({
title:$.t("Copy"),shortcut:"Ctrl-C",action:function(){t.copySourcesToClip(o)}}),V(this._chartWidgetCollection.layout.value())?(o.filter(function(t){return!!t.linkKey}).length?i.push({title:$.t("Stop syncing"),action:function(){t.unlinkLines(o)}}):i.push({title:$.t("Sync to all charts"),action:function(){t.copyToOtherCharts(o)}}),i):i):i},n.prototype._getZOrderActions=function(){var t=[],e=this.selectedSources(),o=this.activeChartWidget().model(),i={title:$.t("Bring to Front"),action:function(){o.bringToFront(e)}},n={title:$.t("Send to Back"),action:function(){o.sendToBack(e)}},r={title:$.t("Bring Forward"),action:function(){o.changeZOrder(e,1)}},s={title:$.t("Send Backward"),action:function(){o.changeZOrder(e,-1)}},a=o.paneForSource(e[0]),l=a.getZOrderMinMax();return 1===e.length&&e[0].zorder()===l.minZOrder&&(n.disabled=!0,s.disabled=!0),1===e.length&&e[0].zorder()===l.maxZOrder&&(r.disabled=!0,i.disabled=!0),t.push(i,n,r,s),t},n.prototype._getPossibleProperty=function(t){var e,o,i=[],r=this._defaultToolProperties();for(e=0;e=0;--n)if(l=e[(a=o[n]).name],"function"!=typeof(d=a.showIf)||d(l,e)){if(!l)continue;if(this._propertiesVisible=!0,c=[],"combobox"!==a.inputType){p=this.colorPropertyControl(l,a,e),this._floatingToolbar.addWidget(p[0],{index:this._$templatesButton?1:0}),this._toolbarWidgets.push(p);continue}a.simple?a.comboboxOptions.forEach(r.bind(null,c)):a.comboboxOptions.forEach(s.bind(null,c)),a.propertyProxy&&(l=a.propertyProxy(e,this.activeChartWidget().model())),i[a.name]=l,l.subscribe(this,this._onPropertyChanged.bind(this,a.name,l)),this._floatingToolbar.addGroupedWidget({id:a.name,currentStateId:l.value(),stateWidgetAddClass:"tv-linetool-properties-toolbar__sub-widget",states:c,widgetAddClass:"tv-linetool-properties-toolbar__grouped-button",tooltip:a.title},{index:this._$templatesButton?1:0})}this._currentProperties=i}},n.prototype._updateVisibility=function(){this._propertiesVisible||this._sourceActionsVisible||this._templatesVisible?this._show():this.hide()},n.prototype._clearProperties=function(){this._currentProperties&&(this._clearProeprtiesOnHideTimeoutId&&(clearTimeout(this._clearProeprtiesOnHideTimeoutId),this._clearProeprtiesOnHideTimeoutId=null),Object.keys(this._currentProperties).forEach(function(t){this._currentProperties[t].unsubscribeAll(this),this._floatingToolbar.removeGroupedWidget(t)},this),this._currentProperties=null,
this._toolbarWidgets.forEach(function(t){this._floatingToolbar.removeWidget(t[0]),t.remove()},this),this._toolbarWidgets=[],this.clearBindings())},n.prototype.hide=function(){this._floatingToolbar.hide(),this._clearProeprtiesOnHideTimeoutId=setTimeout(this._clearProperties.bind(this),this._floatingToolbar.hideDuration())},n.prototype._show=function(){this._floatingToolbar.show()},n.prototype.refresh=function(){this.onSourceChanged(this.selectedSources())},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._lockChangeListener(t.properties().frozen)),this._selectedSourceBk=t)},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.colorPropertyControl=function(t,e,o){var i,r,s=W.prototype.createColorPicker({addClass:"tv-linetool-properties-toolbar__color-picker apply-common-tooltip",direction:this._bindPopupMenuDirection.bind(this)});return s.attr("title",e.title),i=s.find("input"),(r=$(e.iconSvgCode)).on("click",function(t){i.data("tvcolorpicker")||i.focus()}),$(document).on("click",function(t){i.data("tvcolorpicker")?i.addClass("i-active"):i.removeClass("i-active")}),i.after(r),this.bindControl(new T(s,t,!0,this.activeChartWidget().model(),null,n.getTransparency(e,o))),"string"==typeof e.addClass&&s.addClass(e.addClass),s},n.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(o,r){var s,a;return s=o[e]&&o[e].value()?n.LINE_EXTEND:o[t].value(),(a=new i(s)).subscribe(this,function(i){var n=i.value();n<2?(r.beginUndoMacro(""),o[t].setValue(n),o[e]&&o[e].setValue(!1),r.endUndoMacro()):(r.beginUndoMacro(""),o[t].setValue(z.Normal),o[e]&&o[e].setValue(!0),r.endUndoMacro())}),a}},n.LINE_EXTEND=42,l=a(o("wLZl")),d=a(o("XqDt")),c=a(o("znEV")),p=a(o("NDCK")),u=a(o("9On3")),h=a(o("Nz7V")),g=a(o("dhuF")),_=a(o("n2Ch")),v=a(o("eHtW")),f=a(o("BiGZ")),b=a(o("fUH/")),y=a(o("BsMi")),w=o("HKvk"),m=o("2JFs"),C=o("Kjbl"),n.prototype._defaultToolProperties=function(){return[{name:"color",inputType:"colorPicker",iconSvgCode:w,title:$.t("Color")},{name:"linecolor",inputType:"colorPicker",iconSvgCode:w,title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",iconSvgCode:m,title:$.t("Background Color"),transparency:!0},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,iconSvgCode:l},{value:2,iconSvgCode:d},{value:3,iconSvgCode:c},{value:4,iconSvgCode:p}],title:$.t("Width")},{name:"linestyle",title:$.t("Style"),inputType:"combobox",comboboxOptions:[{value:0,iconSvgCode:l},{value:1,iconSvgCode:u},{value:2,iconSvgCode:h}]},{name:"leftEnd",title:$.t("Left End"),
inputType:"combobox",comboboxOptions:[{value:z.Normal,iconSvgCode:g},{value:z.Arrow,iconSvgCode:_},{value:n.LINE_EXTEND,iconSvgCode:v}],propertyProxy:this.createLineEndPropertyProxy("leftEnd","extendLeft")},{name:"rightEnd",title:$.t("Right End"),inputType:"combobox",comboboxOptions:[{value:z.Normal,iconSvgCode:f},{value:z.Arrow,iconSvgCode:b},{value:n.LINE_EXTEND,iconSvgCode:y}],propertyProxy:this.createLineEndPropertyProxy("rightEnd","extendRight")}]},n.prototype._riskPropertiesExceptionCases=function(){return[{name:"textcolor",title:$.t("Text color"),inputType:"colorPicker",iconSvgCode:C},{name:"profitBackground",title:$.t("Profit Background Color"),inputType:"colorPicker",iconSvgCode:m,transparency:!0,transparencyField:"profitBackgroundTransparency"},{name:"stopBackground",title:$.t("Stop Background Color"),inputType:"colorPicker",iconSvgCode:m,transparency:!0,transparencyField:"stopBackgroundTransparency"},{name:"linecolor",title:$.t("Border color"),inputType:"colorPicker",iconSvgCode:w}]},n.prototype._elliottPropertiesExceptionCases=function(){return[{name:"color",title:$.t("Color"),inputType:"colorPicker",iconSvgCode:w}]},n.prototype._rangeExceptionCases=function(){return[{name:"linecolor",inputType:"colorPicker",iconSvgCode:w,title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",iconSvgCode:m,title:$.t("Background Color"),transparency:!0,transparencyField:"backgroundTransparency"},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,iconSvgCode:l},{value:2,iconSvgCode:d},{value:3,iconSvgCode:c},{value:4,iconSvgCode:p}],title:"Width"}]},n.prototype._textPropertiesExceptionCases=function(){return[{name:"color",title:$.t("Text color"),inputType:"colorPicker",iconSvgCode:C},{name:"backgroundColor",title:$.t("Background Color"),inputType:"colorPicker",iconSvgCode:m,showIf:function(t,e){return!e||!e.fillBackground||!!e.fillBackground.value()}},{name:"borderColor",title:$.t("Border Color"),inputType:"colorPicker",iconSvgCode:w},{name:"bordercolor",title:$.t("Border Color"),inputType:"colorPicker",iconSvgCode:w},{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:w},{name:"textColor",title:$.t("Text color"),inputType:"colorPicker",iconSvgCode:C},{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:w,title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",iconSvgCode:m,transparency:!0,showIf:function(t,e){return e.fillBackground.value()},title:$.t("Background Color")},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,iconSvgCode:l},{value:2,iconSvgCode:d},{value:3,iconSvgCode:c},{value:4,iconSvgCode:p}],
title:$.t("Line Width")},{name:"leftEnd",title:$.t("Left End"),inputType:"combobox",comboboxOptions:[{value:z.Normal,iconSvgCode:g},{value:z.Arrow,iconSvgCode:_}],propertyProxy:this.createLineEndPropertyProxy("leftEnd","extendLeft")},{name:"rightEnd",title:$.t("Right End"),inputType:"combobox",comboboxOptions:[{value:z.Normal,iconSvgCode:f},{value:z.Arrow,iconSvgCode:b}],propertyProxy:this.createLineEndPropertyProxy("rightEnd","extendRight")}]},n.prototype._oneColorForAllLines=function(){return[{name:"collectibleColors",inputType:"colorPicker",iconSvgCode:w,title:$.t("One color for all lines")}]},n.prototype._trackContextAction=function(t){F("GUI","Context action on drawings",t)},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:m}],LineToolNote:n.prototype._notePropertiesExceptionCases(),LineToolNoteAbsolute:n.prototype._notePropertiesExceptionCases(),LineToolThreeDrivers:[{name:"color",title:$.t("Text color"),inputType:"colorPicker",iconSvgCode:w}],LineToolRiskRewardLong:n.prototype._riskPropertiesExceptionCases(),LineToolRiskRewardShort:n.prototype._riskPropertiesExceptionCases(),LineToolBarsPattern:[{name:"color",title:$.t("Color"),inputType:"colorPicker",iconSvgCode:m}],LineToolProjection:[{name:"color1",title:$.t("Background color 1"),inputType:"colorPicker",iconSvgCode:m,transparency:!0},{name:"color2",title:$.t("Background color 2"),inputType:"colorPicker",iconSvgCode:m,transparency:!0},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,iconSvgCode:l},{value:2,iconSvgCode:d},{value:3,iconSvgCode:c},{value:4,iconSvgCode:p}]}],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(),LineToolGannFixed: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(this,o("Kxc7"),o("tc+8"))},tzjn:function(t,e){t.exports=''},wLZl:function(t,e){t.exports=''},yB98:function(t,e){t.exports=''},znEV:function(t,e){t.exports=''}}]);