webpackJsonp([3, 30], { 1e3: function(t, e) { t.exports = ''; }, 1001: function(t, e) { t.exports = ''; }, 1002: function(t, e) { t.exports = ''; }, 1003: function(t, e) { t.exports = ''; }, 1004: function(t, e) { t.exports = ''; }, 1005: function(t, e) { t.exports = ''; }, 1006: function(t, e) { t.exports = ''; }, 1007: function(t, e) { t.exports = ''; }, 1009: function(t, e, o) { 'use strict'; var i, n, s, r, l; o.d(e, 'a', function() { return l; }), (i = o(8)), (n = o.n(i)), (s = o(49)), o.n(s), (function(t) { function e(e) { return t.favorites.indexOf(e); } function o() { (t.favorites = []), Object(s.getJSON)('chart.favoriteDrawings', []).forEach(function(e) { t.favorites.push(e.tool || e); }), t.favoritesSynced.fire(); } function i() { Object(s.setJSON)('chart.favoriteDrawings', t.favorites); } (t.favorites = []), (t.favoritesSynced = new n.a()), (t.favoriteIndex = e), (t.saveFavorites = i), o(), s.onSync.subscribe(null, o); })(r || (r = {})), (function(t) { function e() { return r.favorites.slice(); } function o() { return r.favorites.length; } function i(t) { return t < 0 || t >= o() ? '' : r.favorites[t]; } function s(e) { return !a(e) && (r.favorites.push(e), r.saveFavorites(), t.favoriteAdded.fire(e), !0); } function l(e) { var o = r.favoriteIndex(e); return ( -1 !== o && (r.favorites.splice(o, 1), r.saveFavorites(), t.favoriteRemoved.fire(e), !0) ); } function a(t) { return -1 !== r.favoriteIndex(t); } function c(e, i) { if (i < 0 || i >= o()) return !1; var n = r.favoriteIndex(e); return ( -1 !== n && i !== n && (r.favorites.splice(n, 1), r.favorites.splice(i, 0, e), r.saveFavorites(), t.favoriteMoved.fire(e, n, i), !0) ); } (t.favoriteAdded = new n.a()), (t.favoriteRemoved = new n.a()), (t.favoriteMoved = new n.a()), (t.favoritesSynced = r.favoritesSynced), (t.favorites = e), (t.favoritesCount = o), (t.favorite = i), (t.addFavorite = s), (t.removeFavorite = l), (t.isFavorite = a), (t.moveFavorite = c); })(l || (l = {})); }, 1015: function(t, e) { t.exports = ''; }, 1023: function(t, e) { t.exports = ''; }, 1039: function(t, e, o) { 'use strict'; var i, n, s, r, l, a, c, h, d, p, u, v, g, f, w; o.d(e, 'a', function() { return w; }), (i = o(14)), (n = o.n(i)), (s = o(127)), o.n(s), (r = o(184)), (l = o(49)), o.n(l), (a = o(8)), (c = o.n(a)), (h = o(16)), (d = o.n(h)), (p = o(827)), (u = o(356)), (v = o(1015)), o.n(v), (g = o(1146)), o.n(g), (f = '
' + (Modernizr.touch ? '
' : '') + '
' + v + '
'), (w = (function() { function t(e) { (this._widget = document.createElement('div')), (this._isVertical = !1), (this._hiddingTimeoutId = null), (this._visibility = new d.a(!1)), (this._windowResizeListener = this._onWindowResize.bind(this)), (this._reorderedDelegate = new c.a()), t._toolbars.push(this), (this._options = e), (this._widget = n()(f).get(0)), (this._content = this._widget.getElementsByClassName('js-content').item(0)), this._setZIndex(t._startZIndex + t._toolbars.length - 1), this._options.addClass && (this._widget.className += ' ' + this._options.addClass), this._options.layout && 'auto' !== this._options.layout && ((this._isVertical = 'vertical' === this._options.layout), this._updateLayoutType(), this._updateAxisOption()); } return ( (t.prototype.destroy = function() { this.hide(!0), t._toolbars.splice(t._toolbars.indexOf(this), 1), document.body.contains(this._widget) && document.body.removeChild(this._widget), (this._widget.innerHTML = ''); }), (t.prototype.isVisible = function() { return this._visibility.value(); }), (t.prototype.visibility = function() { return this._visibility.readonly(); }), (t.prototype.isVertical = function() { return this._isVertical; }), (t.prototype.show = function() { var t = this; this.isVisible() || (document.body.contains(this._widget) || (this._init(), document.body.appendChild(this._widget)), this._setHiddingTimeout(null), window.addEventListener('resize', this._windowResizeListener), this.raise(), this._visibility.setValue(!0), this._widget.classList.contains('i-hidden') ? (this._widget.classList.remove('i-hidden'), setTimeout(function() { t.isVisible() && t._widget.classList.remove('i-closed'); })) : this._widget.classList.remove('i-closed'), this._onWindowResize()); }), (t.prototype.hide = function(t) { var e, o, i = this; void 0 === t && (t = !1), this.isVisible() && ((e = this._widget.classList.contains('i-closed')), this._widget.classList.add('i-closed'), this._visibility.setValue(!1), t || e ? (this._setHiddingTimeout(null), this._widget.classList.add('i-hidden')) : ((o = setTimeout(function() { i._setHiddingTimeout(null), i._widget.classList.add('i-hidden'); }, this.hideDuration())), this._setHiddingTimeout(o)), window.removeEventListener('resize', this._windowResizeListener)); }), (t.prototype.raise = function() { t._toolbars.length + t._startZIndex !== this._zIndex() && (t._toolbars.splice(t._toolbars.indexOf(this), 1), t._toolbars.push(this), t._updateAllZIndexes()); }), (t.prototype.hideDuration = function() { return 0.75 * r.dur; }), (t.prototype.addWidget = function(t, e) { var o, i, n; if ( (void 0 === e && (e = {}), (o = this.widgetsCount()), void 0 === e.index && (e.index = o), e.index < 0 || e.index > o) ) throw Error('Index must be in [0, ' + o + ']'); (i = document.createElement('div')), (i.className = 'tv-floating-toolbar__widget js-widget'), i.appendChild(t), (n = e.index === o ? null : this._content.childNodes.item(e.index)), this._content.insertBefore(i, n), this._onWindowResize(); }), (t.prototype.removeWidget = function(t) { var e = this._findWrapperForWidget(t); e && (this._content.removeChild(e), this._onWindowResize()); }), (t.prototype.widgetsCount = function() { return this._content.childNodes.length; }), (t.prototype.showWidget = function(t) { var e = this._findWrapperForWidget(t); e && e.classList.remove('i-hidden'); }), (t.prototype.hideWidget = function(t) { var e = this._findWrapperForWidget(t); e && e.classList.add('i-hidden'); }), (t.prototype.removeWidgets = function() { for (; this._content.firstChild; ) this._content.removeChild(this._content.firstChild); this._onWindowResize(); }), (t.prototype.onWidgetsReordered = function() { return this._reorderedDelegate; }), (t.prototype.onContextMenu = function(t) { var e, o = this; Modernizr.touch ? ((e = new u.a()), e.load().then(function(e) { var i = new e(o._widget); i.get('press').set({ time: 500 }), i.on('press', function(e) { o._preventWidgetTouchEndEvent(), t(e.srcEvent); }); })) : this._widget.addEventListener('contextmenu', t); }), (t.prototype._determineCurrentLayoutVertical = function(t) { var e = this._isVertical ? t.height : t.width; return window.innerWidth < e; }), (t.prototype._getWidget = function() { return this._widget; }), (t.prototype._findWrapperForWidget = function(t) { var e, o, i = this._content.getElementsByClassName('js-widget'); for (e = 0; e < i.length; ++e) if (((o = i.item(e)), o.contains(t))) return o; return null; }), (t.prototype._onVerticalChanged = function(t, e) {}), (t.prototype._setHiddingTimeout = function(t) { null !== this._hiddingTimeoutId && clearTimeout(this._hiddingTimeoutId), (this._hiddingTimeoutId = t); }), (t.prototype._preventWidgetTouchEndEvent = function() { var t = this, e = function(o) { o.preventDefault(), t._widget.removeEventListener('touchend', e); }; this._widget.addEventListener('touchend', e); }), (t.prototype._updateLayoutType = function() { this._widget.classList.toggle('i-vertical', this._isVertical); }), (t.prototype._updateAxisOption = function() { if (this._options.dragOnlyInsideToolbar) { var t = this._isVertical ? 'y' : 'x'; Object(p.lazyJqueryUI)(n()(this._content)).sortable('option', 'axis', t); } }), (t.prototype._onWindowResize = function() { var t, e; 'auto' === (this._options.layout || 'auto') && ((t = this._isVertical), (e = this._getCorrectedWidgetRect()), (this._isVertical = this._determineCurrentLayoutVertical(e)), this._updateLayoutType(), t !== this._isVertical && (this._onVerticalChanged(this._isVertical, t), this._updateAxisOption())), this._checkPosition(); }), (t.prototype._checkPosition = function() { var t = this._getCorrectedWidgetRect(), e = { left: t.left, top: t.top }; this._correctPosition(e), (t.left === e.left && t.top === e.top) || ((this._widget.style.left = e.left + 'px'), (this._widget.style.top = e.top + 'px')); }), (t.prototype._correctPosition = function(t) { var e = this._getCorrectedWidgetRect(); t.left + e.width > window.innerWidth && (t.left = Math.max(0, window.innerWidth - e.width)), t.top + e.height > window.innerHeight && (t.top = Math.max(0, window.innerHeight - e.height)), (t.left = Math.max(0, t.left)), (t.top = Math.max(0, t.top)); }), (t.prototype._setZIndex = function(t) { this._widget.style.zIndex = t + ''; }), (t.prototype._zIndex = function() { return +this._widget.style.zIndex; }), (t.prototype._loadPosition = function() { var t = Object(l.getJSON)( this._options.positionSettingsKey, this._options.defaultPosition, ); (this._widget.style.left = Math.round(t.left) + 'px'), (this._widget.style.top = Math.round(t.top) + 'px'), this._onWindowResize(); }), (t.prototype._savePosition = function() { var t = this._widget.getBoundingClientRect(); Object(l.setJSON)(this._options.positionSettingsKey, { left: t.left, top: t.top }); }), (t.prototype._init = function() { this._loadPosition(), Object(p.lazyJqueryUI)(n()(this._widget)).draggable({ containment: 'window', drag: this._onDragEvent.bind(this), handle: '.js-drag', stop: this._savePosition.bind(this), }), this._options.allowSortable && this._initSortable(), this._widget.addEventListener( Modernizr.touch ? 'touchstart' : 'mousedown', this.raise.bind(this), ); }), (t.prototype._onDragEvent = function(t, e) { this._correctPosition(e.position); }), (t.prototype._initSortable = function() { var t = this, e = -1; Object(p.lazyJqueryUI)(n()(this._content)).sortable({ start: function(t, o) { e = o.item.index(); }, stop: function(o, i) { var n = i.item.index(); e !== n && t._reorderedDelegate.fire(e, n); }, tolerance: 'pointer', distance: 5, containment: !!this._options.dragOnlyInsideToolbar && 'parent', scroll: !1, placeholder: 'sortable-placeholder', forcePlaceholderSize: !0, }), this._updateAxisOption(); }), (t.prototype._getCorrectedWidgetRect = function() { var t, e, o, i, n = this._widget.getBoundingClientRect(); return this._widget.classList.contains('i-closed') ? ((t = 0.925), (e = 1 / t - 1), (o = n.width * e), (i = n.height * e), { bottom: n.bottom + i / 2, height: n.height + i, left: n.left - o / 2, right: n.right + o / 2, top: n.top - i / 2, width: n.width + o, }) : n; }), (t._updateAllZIndexes = function() { t._toolbars.forEach(function(e, o) { e._setZIndex(t._startZIndex + o); }); }), (t._startZIndex = 20), (t._toolbars = []), t ); })()); }, 1146: function(t, e) {}, 1147: function(t, e) {}, 1221: function(t, e, o) { 'use strict'; var i, n, s, r, l, a, c, h; Object.defineProperty(e, '__esModule', { value: !0 }), o.d(e, 'GroupButtonFloatingToolbar', function() { return h; }), (i = o(1)), (n = o(7)), o.n(n), (s = o(1039)), (r = o(8)), (l = o.n(r)), (a = o(876)), o.n(a), (c = o(1222)), o.n(c), (h = (function(t) { function e(o) { var i = t.call(this, e._prepareOptions(o)) || this; return ( (i._onWidgetStateChangedDelegate = new l.a()), (i._statedWidgets = []), (i._currentPopup = null), (i._onWindowClickedListener = i._onWindowClicked.bind(i)), i ); } return ( i.c(e, t), (e.prototype.show = function() { t.prototype.show.call(this), document.addEventListener('mousedown', this._onWindowClickedListener); }), (e.prototype.hide = function() { t.prototype.hide.call(this), document.removeEventListener('mousedown', this._onWindowClickedListener); }), (e.prototype.destroy = function() { this._closePopup(), t.prototype.destroy.call(this); }), (e.prototype.addGroupedWidget = function(t, o) { var i, s, r; void 0 === o && (o = {}), Object(n.assert)( t.states.length > 0 && -1 !== e._getStateIndexById(t, t.currentStateId), 'Argument is invalid (count: ' + t.states.length + ', state: ' + t.currentStateId + ')', ), (i = document.createElement('div')), (i.className = 'tv-grouped-floating-toolbar__widget-wrapper apply-common-tooltip'), t.widgetAddClass && i.classList.add(t.widgetAddClass), i.setAttribute('title', t.tooltip), (s = { isEnabled: !0, statedWidget: t, toolbarWidget: i }), (r = this._onWidgetClicked.bind(this, s)), (s.clickListener = r), i.addEventListener('click', r), this._updateWidgetPreview(s), this.addWidget(i, o), this._statedWidgets.push(s); }), (e.prototype.removeGroupedWidget = function(t) { var e, o, i = this._statedWidgets.length; for (e = 0; e < i; ++e) if (((o = this._statedWidgets[e]), o.statedWidget.id === t)) return ( this._isPopupCreatedForWidget(t) && this._closePopup(), void 0 !== o.clickListener && o.toolbarWidget.removeEventListener('click', o.clickListener), this.removeWidget(o.toolbarWidget), this._statedWidgets.splice(e, 1), void this._updatePopupPosition() ); Object(n.assert)(!1, 'Unknown groupId(' + t + ')'); }), (e.prototype.updateGroupedWidget = function(t, e) { this._closePopup(); var o = this._ensuredGetWidgetDataForId(t); (o.statedWidget.currentStateId = e.currentStateId), (o.statedWidget.states = e.states), this._updateWidgetPreview(o); }), (e.prototype.setGroupedWidgetEnabled = function(t, e) { var o = this._ensuredGetWidgetDataForId(t); (o.isEnabled = e), o.toolbarWidget.classList.toggle('i-disabled', !e); }), (e.prototype.setGroupedWidgetState = function(t, o) { var i = this._ensuredGetWidgetDataForId(t); Object(n.assert)( -1 !== e._getStateIndexById(i.statedWidget, o), 'Unknown stateId (' + o + ')', ), (i.statedWidget.currentStateId = o), this._updateSubWidgetsState(i.statedWidget), this._updateWidgetPreview(i); }), (e.prototype.onWidgetStateChanged = function() { return this._onWidgetStateChangedDelegate; }), (e.prototype._onVerticalChanged = function(t, e) { this._updatePopupPosition(); }), (e.prototype._ensuredGetWidgetDataForId = function(t) { var e, o, i; for (e = 0, o = this._statedWidgets; e < o.length; e++) if (((i = o[e]), i.statedWidget.id === t)) return i; throw Error('Unknown groupId(' + t + ')'); }), (e.prototype._onWidgetClicked = function(t, e) { var o = this._currentPopup && this._isPopupCreatedForWidget(t.statedWidget.id); this._closePopup(), !o && t.isEnabled && this._createPopup(t); }), (e.prototype._createPopup = function(t) { var e, o = this, i = { createdFor: t.toolbarWidget, element: document.createElement('div'), stateWidgetId: t.statedWidget.id, widgets: [], }; (i.element.className += 'tv-grouped-floating-toolbar__popup js-popup'), (e = t.statedWidget.states.length), t.statedWidget.states.forEach(function(n, s) { var r = o._createSubWidget(t, n), l = o._onSubWidgetClicked.bind(o, t, n.id); r.addEventListener('click', l), i.widgets.push({ clickListener: l, stateWidget: n, widget: r }), r.classList.add('tv-grouped-floating-toolbar__sub-widget--slide-right-' + s), r.classList.add( 'tv-grouped-floating-toolbar__sub-widget--slide-left-' + (e - s + 1), ), i.element.appendChild(r); }), (this._currentPopup = i), this._updateSubWidgetsState(t.statedWidget), t.toolbarWidget.classList.add('i-dropped'), this._getWidget().appendChild(this._currentPopup.element), Promise.resolve().then(function() { o._currentPopup && o._currentPopup.element.classList.add('i-opened'); }), this._updatePopupPosition(); }), (e.prototype._closePopup = function() { var t, e, o = this; this._statedWidgets.forEach(function(t) { t.toolbarWidget.classList.remove('i-dropped'); }), this._currentPopup && ((t = this._currentPopup.widgets), (e = this._currentPopup.element), (this._currentPopup = null), t.forEach(function(t) { t.widget.removeEventListener('click', t.clickListener); }), e.classList.remove('i-opened'), e.addEventListener('transitionend', function(t) { t.target === e && o._getWidget().removeChild(e); })); }), (e.prototype._updateWidgetPreview = function(t) { var o, i = e._getStateIndexById(t.statedWidget, t.statedWidget.currentStateId); Object(n.assert)(-1 !== i, 'Unknown state id: ' + t.statedWidget.currentStateId), (o = t.statedWidget.states[i].widget.cloneNode(!0)), t.toolbarWidget.firstChild ? t.toolbarWidget.replaceChild(o, t.toolbarWidget.firstChild) : (t.toolbarWidget.appendChild(o), t.toolbarWidget.appendChild(e._createCaret())); }), (e.prototype._updateSubWidgetsState = function(t) { this._currentPopup && this._isPopupCreatedForWidget(t.id) && this._currentPopup.widgets.forEach(function(o) { o.widget.classList.toggle( e._activeSubWidgetClass, o.stateWidget.id === t.currentStateId, ); }); }), (e.prototype._updatePopupPosition = function() { var t, e, o, i, n, s, r, l; if (this._currentPopup) { if ( ((t = this._currentPopup.createdFor), (e = this._getWidget().getBoundingClientRect()), !(o = this._findWrapperForWidget(t)) || !this._currentPopup) ) throw Error("Toolbar has no wrapper for preview's widget or there is no popup"); (i = o.getBoundingClientRect()), (n = this._currentPopup.element.getBoundingClientRect()), (s = this._currentPopup.element), this.isVertical() ? (s.classList.remove('tv-grouped-floating-toolbar__popup--at-top'), (s.style.top = i.top - e.top + 1 + 'px'), (s.style.left = ''), e.left > window.innerWidth - e.right ? s.classList.add('tv-grouped-floating-toolbar__popup--at-left') : s.classList.remove('tv-grouped-floating-toolbar__popup--at-left')) : (s.classList.remove('tv-grouped-floating-toolbar__popup--at-left'), (r = i.left + n.width), (l = 0), r > window.innerWidth ? e.left + n.width > window.innerWidth && (l = e.width - n.width) : (l = i.left - e.left + 1), (s.style.left = l + 'px'), e.bottom + n.height > window.innerHeight ? s.classList.add('tv-grouped-floating-toolbar__popup--at-top') : (s.classList.remove('tv-grouped-floating-toolbar__popup--at-top'), (s.style.top = ''))); } }), (e.prototype._isPopupCreatedForWidget = function(t) { return !(!this._currentPopup || this._currentPopup.stateWidgetId !== t); }), (e.prototype._createSubWidget = function(t, e) { var o = document.createElement('div'); return ( (o.className += 'tv-grouped-floating-toolbar__sub-widget'), t.statedWidget.stateWidgetAddClass && o.classList.add(t.statedWidget.stateWidgetAddClass), o.appendChild(e.widget), o ); }), (e.prototype._onSubWidgetClicked = function(t, e) { this._closePopup(), t.statedWidget.currentStateId !== e && (this.setGroupedWidgetState(t.statedWidget.id, e), this._onWidgetStateChangedDelegate.fire(t.statedWidget.id, e)); }), (e.prototype._onWindowClicked = function(t) { if ( this.isVisible() && this._currentPopup && !e._isEventInElement(t, this._currentPopup.element) ) { for (var o = 0; o < this._statedWidgets.length; ++o) if (e._isEventInElement(t, this._statedWidgets[o].toolbarWidget)) return; this._closePopup(); } }), (e._getStateIndexById = function(t, e) { for (var o = 0; o < t.states.length; ++o) if (t.states[o].id === e) return o; return -1; }), (e._createCaret = function() { var t = document.createElement('div'); return ( (t.className = 'tv-caret tv-caret--small tv-caret--colored tv-grouped-floating-toolbar__caret'), t ); }), (e._prepareOptions = function(t) { var e = ' tv-grouped-floating-toolbar'; return t.addClass ? (t.addClass += e) : (t.addClass = e), t; }), (e._isEventInElement = function(t, e) { return t.target === e || e.contains(t.target); }), (e._activeSubWidgetClass = 'tv-grouped-floating-toolbar__sub-widget--current'), e ); })(s.a)); }, 1222: function(t, e) {}, 1223: function(t, e) {}, 1224: function(t, e) { t.exports = ''; }, 1225: function(t, e) { t.exports = ''; }, 1226: function(t, e) { t.exports = ''; }, 1227: function(t, e) { t.exports = ''; }, 1228: function(t, e) { t.exports = ''; }, 1229: function(t, e) { t.exports = ''; }, 1230: function(t, e) { t.exports = ''; }, 1231: function(t, e) { t.exports = ''; }, 1232: function(t, e) { t.exports = ''; }, 1233: function(t, e) { t.exports = ''; }, 1234: function(t, e) { t.exports = ''; }, 1235: function(t, e) { t.exports = ''; }, 1236: function(t, e) { t.exports = ''; }, 1237: function(t, e) { t.exports = ''; }, 1238: function(t, e) { t.exports = ''; }, 1239: function(t, e) { t.exports = ''; }, 1240: function(t, e) { t.exports = ''; }, 1241: function(t, e) { t.exports = ''; }, 1242: function(t, e) { t.exports = ''; }, 1243: function(t, e) { t.exports = ''; }, 1244: function(t, e) { t.exports = ''; }, 813: function(t, e, o) { 'use strict'; Object.defineProperty(e, '__esModule', { value: !0 }), function(t) { var i, n, s, r, l, a, c, h, d, p, u, v, g, f, w, m; o.d(e, 'FavoriteDrawingToolbar', function() { return m; }), (i = o(1)), (n = o(14)), o.n(n), (s = o(126)), o.n(s), (r = o(127)), o.n(r), o(11), (l = o(1039)), (a = o(1009)), (c = o(41)), o.n(c), (h = o(88)), o.n(h), (d = o(32)), o.n(d), (p = o(853)), (u = o(49)), o.n(u), (v = o(16)), (g = o.n(v)), (f = o(1147)), o.n(f), (w = '{{{icon}}}'), (m = (function(e) { function o(t) { var o = e.call(this, { allowSortable: !Modernizr.touch, dragOnlyInsideToolbar: !0, defaultPosition: t, positionSettingsKey: 'chart.favoriteDrawingsPosition', }) || this; return ( (o._linetoolsWidgets = {}), (o._canBeShownValue = new g.a(!1)), o._attachHandlers(), o._loadVisibilityState(), o ); } return ( i.c(o, e), (o.prototype.show = function() { this._canBeShownValue.value() && (u.setValue(o._visibilitySettingsKey, !0), this.isVisible() || this._renderAllLinetools(), e.prototype.show.call(this)); }), (o.prototype.hide = function() { u.setValue(o._visibilitySettingsKey, !1), e.prototype.hide.call(this); }), (o.prototype.canBeShown = function() { return this._canBeShownValue.readonly(); }), (o.prototype._onFavoriteAdded = function(t) { this._canBeShownValue.setValue(!0), this.addWidget(this._createLinetoolWidget(t)), this.show(); }), (o.prototype._onFavoriteRemoved = function(t) { this.removeWidget(this._linetoolsWidgets[t]), delete this._linetoolsWidgets[t], 0 === a.a.favoritesCount() && (this._canBeShownValue.setValue(!1), this.hide()); }), (o.prototype._onFavoriteMoved = function() { this._renderAllLinetools(); }), (o.prototype._onSelectedLinetoolChanged = function(t) { var e = this; Object.keys(this._linetoolsWidgets).forEach(function(o) { e._linetoolsWidgets[o].classList.toggle('i-active', t === o); }); }), (o.prototype._createLinetoolWidget = function(e) { var o = $( t.render(w, { icon: p.a[e].icon, isActive: e === d.tool.value(), title: p.a[e].localizedName, }), )[0]; return ( o.addEventListener('click', function(t) { t.preventDefault(), d.tool.value() === e ? Object(d.resetToCursor)() : d.tool.setValue(e); }), (this._linetoolsWidgets[e] = o), o ); }), (o.prototype._renderAllLinetools = function() { var t = this; (this._linetoolsWidgets = {}), this.removeWidgets(), a.a.favorites().forEach(function(e) { t.addWidget(t._createLinetoolWidget(e)); }); }), (o.prototype._attachHandlers = function() { var t = this; a.a.favoriteAdded.subscribe(this, this._onFavoriteAdded), a.a.favoriteRemoved.subscribe(this, this._onFavoriteRemoved), a.a.favoriteMoved.subscribe(this, this._onFavoriteMoved), a.a.favoritesSynced.subscribe(null, function() { t._loadVisibilityState(), t._renderAllLinetools(); }), this.onWidgetsReordered().subscribe(this, function(e, o) { if ( (a.a.favoriteMoved.unsubscribe(t, t._onFavoriteMoved), !a.a.moveFavorite(a.a.favorite(e), o)) ) throw Error('Something went wrong'); a.a.favoriteMoved.subscribe(t, t._onFavoriteMoved); }), this.onContextMenu(function(e) { e.preventDefault(); var o = new c.Action({ text: $.t('Hide Favorite Drawings Toolbar') }); o.callbacks().subscribe(null, function() { t.hide(); }), h.createMenu([o]).show(e); }), d.tool.subscribe(this._onSelectedLinetoolChanged.bind(this)); }), (o.prototype._loadVisibilityState = function() { var t, e = a.a.favoritesCount() > 0; this._canBeShownValue.setValue(e), (t = u.getBool(o._visibilitySettingsKey, !0)), t && e ? this.show() : this.hide(); }), (o._visibilitySettingsKey = 'ChartFavoriteDrawingToolbarWidget.visible'), o ); })(l.a)); }.call(e, o(126)); }, 822: 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 s(t, e) { t.push({ id: e, widget: $('
' + e + '
')[0], }); } function r(t, e) { t.push({ id: e.value, widget: $(e.iconSvgCode)[0] }); } function l(t, e) { return $('
') .addClass('tv-linetool-properties-toolbar__icon') .addClass(e) .append(t)[0]; } function a(t) { return l(t, 'tv-linetool-properties-toolbar__icon--line-props'); } var c, h, d, p, u, v, g, f, w, m, z, _, M, y, T, b = o(823), x = b.PropertyPage, C = b.ColorBinding, L = o(87).BarsMarksContainer, P = o(0).LineDataSource, S = o(32), k = o(964), B = o(847).bindPopupMenu, A = o(3).DefaultProperty, I = o(1221).GroupButtonFloatingToolbar, E = o(197).showEditObjectDialog, W = o(103).LineEnd, V = o(108).isMultipleLayout, F = o(198); o(876), o(1223), (n.prototype.activeChartWidget = function() { return this._chartWidgetCollection.activeChartWidget.value(); }), (n.prototype.selectedSource = function() { return this._chartWidgetCollection.selectedSource.value(); }), (n.prototype._init = function() { (this._floatingToolbar = new I({ addClass: 'tv-linetool-properties-toolbar', defaultPosition: { top: F.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.isVisibleForSource || e.isVisibleForSource(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.selectedSource.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')) { var e = e instanceof A ? e : new A(t.toLowerCase()); this._hideAllSourceActions(), 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, o, i, n; for ( e = 0; e < this.activeChartWidget() .model() .panes().length; e++ ) for ( o = this.activeChartWidget() .model() .panes()[e], i = o.orderedSources(), n = 0; n < i.length; n++ ) if (i[n] === t) return i[n]; }), (n.prototype.onSourceChanged = function(t) { if ( (this._hasAlertWathcedValue && (this._hasAlertWathcedValue.destroy(), (this._hasAlertWathcedValue = null)), !t) ) return void this.hide(); t instanceof P && !(t instanceof L) && this.findSourceOnWidget(t) ? (!t.userEditEnabled() || ('LineToolBrush' !== t.toolname && this.activeChartWidget() .model() .lineBeingCreated()) ? this._hideAllSourceActions() : (this._updateSourceActionsVisibility(t), t.canHasAlert() && ((this._hasAlertWathcedValue = t.hasAlert.spawn()), this._hasAlertWathcedValue.subscribe( this._updateSourceActionsVisibility.bind(this, t), ))), this.showPropertiesOf(t.getConstructor(), t.properties()), this.showTemplatesOf({ source: t }), this._setupToggleLockButton(t), this._updateVisibility()) : this.hide(); }), (n.prototype.showTemplatesOf = function(t) { var i, n, s, r, l; e.enabled('line_tool_templates') && ((i = t.source), i ? ((n = i.getConstructor()), (s = i.properties())) : ((n = t.tool), (s = t.properties)), this._$templatesButton && (this._floatingToolbar.removeWidget(this._$templatesButton[0]), (this._$templatesButton = null)), (r = this), (l = function(t) { if (i) { r .activeChartWidget() .model() .applyLineToolTemplate(i, t, 'Apply Drawing Template'), r.onSourceChanged(i); } else s.merge(t), s.listeners().fire(this), s.saveDefaults(), r.onToolChanged(n, s); }), (TradingView.onWidget() && !window.is_authenticated) || !e.enabled('linetoolpropertieswidget_template_button') || ((this._templatesList = new k(n, l, { buttonInner: '
' + o(1224) + '
', buttonClass: 'tv-linetool-properties-toolbar__button apply-common-tooltip', defaultsCallback: function() { if (void 0 !== i) { r.activeChartWidget() .model() .restoreLineToolFactoryDefaults(i, 'Load default drawing template'); } else s.restoreFactoryDefaults(); r.showPropertiesOf(n, s); }, 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'))), 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')), o.classList.add('tv-linetool-properties-toolbar__icon'), o.appendChild(t.svgIcon), e.appendChild(o)), t.addCaret && ((i = document.createElement('div')), (i.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() { E(t.selectedSource(), t.activeChartWidget().model(), { onWidget: t.activeChartWidget()._options.onWidget, }); }, svgIcon: $(o(1225))[0], }); }), (n.prototype._createZOrderButton = function() { var t = this._createButton({ title: $.t('Visual Order'), callback: function() { t.classList.contains('i-dropped') || $(t).trigger('button-popup', [this._getZOrderActions()]); }.bind(this), svgIcon: $(o(1226))[0], addCaret: !0, }); return ( B($(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') || $(t).trigger('button-popup', [this._getCloneActions()]); }.bind(this), svgIcon: $(o(1227))[0], addCaret: !0, }); return ( B($(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.activeChartWidget().toggleLockSelectedObject(); }.bind(this), svgIcon: $(o(1023))[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.activeChartWidget().hideSelectedObject(); }.bind(this), svgIcon: $(o(1228))[0], }); }), (n.prototype._createRemoveButton = function() { return this._createButton({ title: $.t('Remove'), callback: function() { this.activeChartWidget().removeSelectedSource(); }.bind(this), svgIcon: $(o(1229))[0], }); }), (n.prototype._createSourceActions = function() { var t = []; return ( e.enabled('property_pages') && t.push({ button: this._createSettingsButton() }), (this._cloneButton = this._createCloneButton()), t.push( { button: this._createZOrderButton() }, { button: this._cloneButton, isVisibleForSource: function(t) { var e = TradingView.className(t.constructor); return !this.activeChartWidget() .model() .model() .isSingleInstanceLineTool(e); }.bind(this), }, { button: this._createLockButton() }, { button: this._createHideButton() }, { button: this._createRemoveButton() }, ), t ); }), (n.prototype._getCloneActions = function() { var t = this.activeChartWidget().model(), o = this.selectedSource(), i = []; return ( o.properties().clonable.value() && i.push({ title: $.t('Clone'), action: function() { t.cloneLineTool(o); }, }), e.enabled('datasource_copypaste') ? (i.push({ title: $.t('Copy'), shortcut: 'Ctrl-C', action: function() { t.copySourceToClip(o); }, }), V(this._chartWidgetCollection.layout.value()) ? (o.linkKey ? i.push({ title: $.t('Stop syncing'), action: function() { t.unlinkLine(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.selectedSource(), 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); }, }, s = { title: $.t('Bring Forward'), action: function() { o.changeZOrder(e, 1); }, }, r = { title: $.t('Send Backward'), action: function() { o.changeZOrder(e, -1); }, }, l = o.paneForSource(this.selectedSource()), a = l.getZOrderMinMax(); return ( e.zorder() === a.minZOrder && ((n.disabled = !0), (r.disabled = !0)), e.zorder() === a.maxZOrder && ((s.disabled = !0), (i.disabled = !0)), t.push(i, n, s, r), t ); }), (n.prototype._getPossibleProperty = function(t) { var e, o, i = [], s = this._defaultToolProperties(); for (e = 0; e < s.length; e++) (o = s[e]), o.name in t && i.push(o); return ( t.extendLeft || (i = i.map(function(t) { return ( 'leftEnd' === t.name && (t.comboboxOptions = t.comboboxOptions.filter(function(t) { return t.value !== n.LINE_EXTEND; })), t ); })), t.extendRight || (i = i.map(function(t) { return ( 'rightEnd' === t.name && (t.comboboxOptions = t.comboboxOptions.filter(function(t) { return t.value !== n.LINE_EXTEND; })), t ); })), i ); }), (n.prototype.showPropertiesOf = function(t, e) { var o, i, n, l, a, c, h, d; if ( (this._toolExceptionCases || (this._toolExceptionCases = this._createToolExceptionCases()), (o = this._toolExceptionCases[t] || this._getPossibleProperty(e)), this._clearProperties(), (this._propertiesVisible = !1), o.length) ) { for (i = {}, n = o.length - 1; n >= 0; --n) if (((l = o[n]), (a = e[l.name]), 'function' != typeof (c = l.showIf) || c(a, e))) { if (!a) continue; if (((this._propertiesVisible = !0), (h = []), 'combobox' !== l.inputType)) { (d = this.colorPropertyControl(a, l, e)), this._floatingToolbar.addWidget(d[0], { index: this._$templatesButton ? 1 : 0, }), this._toolbarWidgets.push(d[0]); continue; } l.simple ? l.comboboxOptions.forEach(s.bind(null, h)) : l.comboboxOptions.forEach(r.bind(null, h)), l.propertyProxy && (a = l.propertyProxy(e, this.activeChartWidget().model())), (i[l.name] = a), a.subscribe(this, this._onPropertyChanged.bind(this, l.name, a)), this._floatingToolbar.addGroupedWidget( { id: l.name, currentStateId: a.value(), stateWidgetAddClass: 'tv-linetool-properties-toolbar__sub-widget', states: h, widgetAddClass: 'tv-linetool-properties-toolbar__grouped-button', tooltip: l.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); }, 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.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._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, s, r = x.prototype.createColorPicker({ addClass: 'tv-linetool-properties-toolbar__color-picker apply-common-tooltip', direction: this._bindPopupMenuDirection.bind(this), }); return ( r.attr('title', e.title), (i = r.find('input')), (s = $(e.iconSvgCode)), s.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(s), this.bindControl( new C(r, t, !0, this.activeChartWidget().model(), null, n.getTransparency(e, o)), ), 'string' == typeof e.addClass && r.addClass(e.addClass), r ); }), (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, s) { var r, l; return ( (r = o[e] && o[e].value() ? n.LINE_EXTEND : o[t].value()), (l = new i(r)), l.subscribe(this, function(i) { var n = i.value(); n < 2 ? (s.beginUndoMacro(''), o[t].setValue(n), o[e] && o[e].setValue(!1), s.endUndoMacro()) : (s.beginUndoMacro(''), o[t].setValue(W.Normal), o[e] && o[e].setValue(!0), s.endUndoMacro()); }), l ); }; }), (n.LINE_EXTEND = 42), (c = a(o(1230))), (h = a(o(1231))), (d = a(o(1232))), (p = a(o(1233))), (u = a(o(1234))), (v = a(o(1235))), (g = a(o(1236))), (f = a(o(1237))), (w = a(o(1238))), (m = a(o(1239))), (z = a(o(1240))), (_ = a(o(1241))), (M = o(1242)), (y = o(1243)), (T = o(1244)), (n.prototype._defaultToolProperties = function() { return [ { name: 'color', inputType: 'colorPicker', iconSvgCode: M, title: $.t('Color') }, { name: 'linecolor', inputType: 'colorPicker', iconSvgCode: M, title: $.t('Color') }, { name: 'backgroundColor', inputType: 'colorPicker', iconSvgCode: y, title: $.t('Background Color'), transparency: !0, }, { name: 'linewidth', inputType: 'combobox', comboboxOptions: [ { value: 1, iconSvgCode: c }, { value: 2, iconSvgCode: h }, { value: 3, iconSvgCode: d }, { value: 4, iconSvgCode: p }, ], title: $.t('Width'), }, { name: 'linestyle', title: $.t('Style'), inputType: 'combobox', comboboxOptions: [ { value: 0, iconSvgCode: c }, { value: 1, iconSvgCode: u }, { value: 2, iconSvgCode: v }, ], }, { name: 'leftEnd', title: $.t('Left End'), inputType: 'combobox', comboboxOptions: [ { value: W.Normal, iconSvgCode: g }, { value: W.Arrow, iconSvgCode: f }, { value: n.LINE_EXTEND, iconSvgCode: w }, ], propertyProxy: this.createLineEndPropertyProxy('leftEnd', 'extendLeft'), }, { name: 'rightEnd', title: $.t('Right End'), inputType: 'combobox', comboboxOptions: [ { value: W.Normal, iconSvgCode: m }, { value: W.Arrow, iconSvgCode: z }, { value: n.LINE_EXTEND, iconSvgCode: _ }, ], propertyProxy: this.createLineEndPropertyProxy('rightEnd', 'extendRight'), }, ]; }), (n.prototype._riskPropertiesExceptionCases = function() { return [ { name: 'textcolor', title: $.t('Text color'), inputType: 'colorPicker', iconSvgCode: T, }, { name: 'profitBackground', title: $.t('Profit Background Color'), inputType: 'colorPicker', iconSvgCode: y, transparency: !0, transparencyField: 'profitBackgroundTransparency', }, { name: 'stopBackground', title: $.t('Stop Background Color'), inputType: 'colorPicker', iconSvgCode: y, transparency: !0, transparencyField: 'stopBackgroundTransparency', }, { name: 'linecolor', title: $.t('Border color'), inputType: 'colorPicker', iconSvgCode: M, }, ]; }), (n.prototype._elliottPropertiesExceptionCases = function() { return [{ name: 'color', title: $.t('Color'), inputType: 'colorPicker', iconSvgCode: M }]; }), (n.prototype._rangeExceptionCases = function() { return [ { name: 'linecolor', inputType: 'colorPicker', iconSvgCode: M, title: $.t('Color') }, { name: 'backgroundColor', inputType: 'colorPicker', iconSvgCode: y, title: $.t('Background Color'), transparency: !0, transparencyField: 'backgroundTransparency', }, { name: 'linewidth', inputType: 'combobox', comboboxOptions: [ { value: 1, iconSvgCode: c }, { value: 2, iconSvgCode: h }, { value: 3, iconSvgCode: d }, { value: 4, iconSvgCode: p }, ], title: 'Width', }, ]; }), (n.prototype._textPropertiesExceptionCases = function() { return [ { name: 'color', title: $.t('Text color'), inputType: 'colorPicker', iconSvgCode: T }, { name: 'backgroundColor', title: $.t('Background Color'), inputType: 'colorPicker', iconSvgCode: y, showIf: function(t, e) { return !e || !e.fillBackground || !!e.fillBackground.value(); }, }, { name: 'borderColor', title: $.t('Border Color'), inputType: 'colorPicker', iconSvgCode: M, }, { name: 'bordercolor', title: $.t('Border Color'), inputType: 'colorPicker', iconSvgCode: M, }, { 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: M, }, { name: 'textColor', title: $.t('Text color'), inputType: 'colorPicker', iconSvgCode: T, }, { 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: M, title: $.t('Color') }, { name: 'backgroundColor', inputType: 'colorPicker', iconSvgCode: y, transparency: !0, showIf: function(t, e) { return e.fillBackground.value(); }, title: $.t('Background Color'), }, { name: 'linewidth', inputType: 'combobox', comboboxOptions: [ { value: 1, iconSvgCode: c }, { value: 2, iconSvgCode: h }, { value: 3, iconSvgCode: d }, { value: 4, iconSvgCode: p }, ], title: $.t('Line Width'), }, { name: 'leftEnd', title: $.t('Left End'), inputType: 'combobox', comboboxOptions: [ { value: W.Normal, iconSvgCode: g }, { value: W.Arrow, iconSvgCode: f }, ], propertyProxy: this.createLineEndPropertyProxy('leftEnd', 'extendLeft'), }, { name: 'rightEnd', title: $.t('Right End'), inputType: 'combobox', comboboxOptions: [ { value: W.Normal, iconSvgCode: m }, { value: W.Arrow, iconSvgCode: z }, ], propertyProxy: this.createLineEndPropertyProxy('rightEnd', 'extendRight'), }, ]; }), (n.prototype._oneColorForAllLines = function() { return [ { name: 'collectibleColors', inputType: 'colorPicker', iconSvgCode: M, 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: y }, ], LineToolNote: n.prototype._notePropertiesExceptionCases(), LineToolNoteAbsolute: n.prototype._notePropertiesExceptionCases(), LineToolThreeDrivers: [ { name: 'color', title: $.t('Text color'), inputType: 'colorPicker', iconSvgCode: M }, ], LineToolRiskRewardLong: n.prototype._riskPropertiesExceptionCases(), LineToolRiskRewardShort: n.prototype._riskPropertiesExceptionCases(), LineToolBarsPattern: [ { name: 'color', title: $.t('Color'), inputType: 'colorPicker', iconSvgCode: y }, ], LineToolProjection: [ { name: 'color1', title: $.t('Background color 1'), inputType: 'colorPicker', iconSvgCode: y, transparency: !0, }, { name: 'color2', title: $.t('Background color 2'), inputType: 'colorPicker', iconSvgCode: y, transparency: !0, }, { name: 'linewidth', inputType: 'combobox', comboboxOptions: [ { value: 1, iconSvgCode: c }, { value: 2, iconSvgCode: h }, { value: 3, iconSvgCode: d }, { 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(e, o(5), o(13))); }, 823: function(t, e, o) { 'use strict'; (function(t) { function i(t, e) { return ''; } function n(t, e) { (this._model = e), (this._bindings = []), (this._property = t), (this.supportThemeSwitcher = !1); } function s(t) { return t.toUpperCase(); } function r(t) { return function(e) { return e < t ? t : e; }; } function l(t) { return function(e) { return e > t ? t : e; }; } function a(t) { return function(e) { var o = parseInt(e, 10); return I(o) ? t : o; }; } function c(t) { var e = new N(); return function(o) { var i = e.parse(o); return I(i) ? t : i; }; } function h(t) { var e = new N(); return function(o) { var i = e.parse(o); return I(i) ? t() : i; }; } function d(t, e) { var o = new O(e); return function(e) { var i = o.format(e); return I(i) ? t : i; }; } function p() { return function(t) { for (var e = t, o = t.replace(/[^\u0000-\u007F]/, ''); o.length !== e.length; ) (e = o), (o = e.replace(/[^\u0000-\u007F]/, '')); return o; }; } function u(t) { return function(e) { return 0 === e.length ? t : e; }; } function v(t, e) { return function(o) { var i = t(); return o === e.value() && i && (i.ticker || i.full_name) ? i.ticker || i.full_name : o; }; } function g(t, e, o, i, n, s, r) { j.call(this, t, e, i, n, s), (this._transformFunction = o), (this._setter = r), this._attachToControl(t, i); } function f(t, e, o, i, n) { g.call(this, t, e, c(e.value()), o, i, n), this.addFormatter(function(t) { return new N().format(t); }); } function w(t, e, o, i, n, s) { (this._subControlIds = e), j.call(this, t, o, i, n, s), this._forEachSubControl(function(t) { this._attachToControl(t, i); }); } function m(t, e, o, i, n, s, r) { (this._model = i), (this._mainSeries = s), (this._toIntTransformer = a(r)), (this._disabled = !1), j.call(this, t, e, o, i, n); var l = this; o && t.change(function() { l.setValueToProperty(l.value()); }), this._mainSeries .dataEvents() .barReceived() .subscribe(this, function() { l.setValue(this.property().value()); }); } function z(t, e, o, i, n, s, r) { j.call(this, t, e, o, i, n), (this._transform = s), o && t.on( 'accept-symbol', function(t, e) { this.setValueToProperty(e), this.setValue(e); }.bind(this), ), r && (r.subscribe(this, this._updateDisplayedSymbol), (this._updateDelegate = r)); } function _(t, e, o, i, n, s, r, l) { j.call(this, t, e, i, n, s), (this._transformFunction = o), (this._propertyChangedHook = l), (this._setter = r); var a = this; i && t.change(function() { a._setter ? a._setter.call(a, a.value()) : a.setValueToProperty(a.value()); }); } function M(t, e) { j.call(this, t, e); } function y(t, e, o, i, n, s) { if (!t.is(':checkbox, :radio')) return new b(t, e, o, i, n); j.call(this, t, e, o, i, n), (this._setter = s); var r = this; o && t.change(function() { r._setter ? r._setter.call(r, r.value()) : r.setValueToProperty(r.value()); }); } function T(t, e, o, i, n, s) { j.call(this, t, e, o, i, n), (this._inverted = !0 === s); } function b(t, e, o, i, n) { j.call(this, t, e, o, i, n); var s = this; o && t.click(function() { var t = $(this) .toggleClass('active') .hasClass('active'); s.setValueToProperty(t); }); } function x(t, e, o, i, n, s) { var r, l; (r = t.is('input') ? t : t.find('input')), j.call(this, r, e, o, i, n), (this._transparencyProperty = s), this.applyOldTransparency(), (l = this), o && r.change(function() { l.setValueToProperty(l.value()); }); } function C(e, o, i, n, s, r) { function l(t, e) { var o = c.control().slider('option', 'min'), i = c.control().slider('option', 'max'), n = c._property.value(); ((o <= n && n <= i) || (o < e.value && e.value < i)) && c.setValueToProperty(e.value); } function a(t, e) { c.setValueToProperty(e.value); } isNumber(o.value()) || (G.logWarn( 'Property cannot be binded to control, bad value (expect number): ' + o.value(), ), (o = new t())), j.call(this, e, o, i, n, s); var c = this; i && (r ? (e.bind('slidechange', l), e.bind('slide', l)) : (e.bind('slidechange', a), e.bind('slide', a))), e.bind('slidestart', function(t, e) { n.beginUndoMacro(s); }), e.bind('slidestop', function(t, e) { n.endUndoMacro(); }); } function L(t, e, o, i, n, s) { y.call(this, t, e, i, n, s), (this._intervalProperty = o), this._intervalProperty.listeners().subscribe(this, this.onIntervalChanged), this.onIntervalChanged(); } function P(t, e, o, i, n) { (this._control = t), (this._wv = e), (this._transformFunction = o), (this._undoModel = i), (this._undoText = n), this._attachToControl(this._control), (this._setValueBinded = this.setValue.bind(this)); } function S(t, e, o, i, n, s) { (this._not = !!s), P.apply(this, arguments); } function k(t, e, o, i, n, s, r, l) { (this._propFrom = e[0]), (this._propTo = e[1]), (this._control = t), (this._applyOnFly = i), (this._undoModel = n), (this._undoText = r), (this._properties = e), (this._inputsText = s), (this._transformers = o); var a = this; t.slider({ range: !0, min: o[0], max: o[1], values: [a._propFrom.value(), a._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), l && ($(l).on('change', function(t) { $(this).is(':checked') ? (a._control.slider('enable'), $(a._inputsText[0]).prop('disabled', !1), $(a._inputsText[1]).prop('disabled', !1)) : (a._control.slider('disable'), $(a._inputsText[0]).prop('disabled', !0), $(a._inputsText[1]).prop('disabled', !0)); }), $(l).is(':checked') ? (a._control.slider('enable'), $(a._inputsText[0]).prop('disabled', !1), $(a._inputsText[1]).prop('disabled', !1)) : (a._control.slider('disable'), $(a._inputsText[0]).prop('disabled', !0), $(a._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()) < a._transformers[0] ? $(s[0]).val(a._transformers[0]) : parseInt($(s[1]).val()) > a._transformers[1] && $(s[1]).val(a._transformers[1]), -1 !== $.inArray(t.keyCode, [46, 8, 9, 27, 13, 110, 190]) || (65 === t.keyCode && !0 === t.ctrlKey) || (67 === t.keyCode && !0 === t.ctrlKey) || (88 === t.keyCode && !0 === t.ctrlKey) || (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()) < a._transformers[0] ? $(this).val(a._transformers[0]) : parseInt($(this).val()) > a._transformers[1] && $(this).val(a._transformers[1]), parseInt($(this).val()) > parseInt($(s[1]).val()) && $(this).val(s[1].val()), a._control.slider('values', 0, $(this).val()), k.prototype.setValueToProperty.call(a, a._control.slider('values'), 'from'); }), $(s[1]).on('keyup', function(t) { parseInt($(this).val()) < a._transformers[0] ? $(this).val(a._transformers[0]) : parseInt($(this).val()) > a._transformers[1] && $(this).val(a._transformers[1]), parseInt($(this).val()) < $(s[0]).val() && $(this).val(s[0].val()), a._control.slider('values', 1, $(this).val()), k.prototype.setValueToProperty.call(a, a._control.slider('values'), 'to'); })), this._propFrom.listeners().subscribe(this, k.prototype.propertyChanged), this._propTo.listeners().subscribe(this, k.prototype.propertyChanged), i && t.on('slide', function(t, e) { a.setValueToProperty(a._control.slider('values'), e.handle); }), t.slider({ stop: function(t, e) { s && ($(s[0]).val(a._control.slider('values', 0)), $(s[1]).val(a._control.slider('values', 1))), a.setValueToProperty(a._control.slider('values'), e.handle); }, start: function(t, e) { s && ($(s[0]).val(a._control.slider('values', 0)), $(s[1]).val(a._control.slider('values', 1))), a.setValueToProperty(a._control.slider('values'), e.handle); }, }); } function B(t, e, o, i, n, s) { j.call(this, t, e, o, i, n), (this._separator = s || ' '); var r = this; o && t.change(function() { r.setValueToProperty(r.value()); }); } var A, I, E, W, V, F, D, N, O, R, H, j, G; o(866), (A = o(7).ensureNotNull), (I = o(83).isNaN), (E = o(24)), (W = E.rgba), (V = E.rgbaToString), (F = E.parseRgb), (D = o(72).TimePointIndexSearchMode), (N = o(105).NumericFormatter), (O = o(193).LimitedPrecisionNumericFormatter), (R = o(29)), (H = o(829).addColorPicker), (j = o(317).Binding), (G = o(4).getLogger('Chart.PropertyPage')), (n.prototype.model = function() { return this._model; }), (n.prototype.bindControl = function(t) { return this._bindings.push(t), t; }), (n.prototype.unbindControl = function(t) { var e = this._bindings.indexOf(t); -1 !== e && this._bindings.splice(e, 1); }), (n.prototype.loadData = function() { var t, e, o; for (t = 0; t < this._bindings.length; t++) (e = this._bindings[t]), e.properties ? ((o = e.properties()), e.setValue(o[0], 0), e.setValue(o[1], 1)) : e.property && (e.transparencyProperty && e.transparencyProperty() ? e.applyOldTransparency() : e.setValue(e.property().value())); }), (n.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(); }), (n.prototype.createLineWidthEditor = function() { var t = this._model._chartWidget.widget().prop('ownerDocument'); return $('
', t).slider({ max: 4, min: 1, step: 1 }); }), (n.prototype.createColorPicker = function(t) { return H(null, t); }), (n.prototype.createTextEditor = function(t, e) { var o = {}; return ( t && (o.width = t), e && (o.height = e), $(document.createElement('textarea')) .css(o) .addClass('tv-control-input') ); }), (n.prototype.createCombo = function(t) { var e = $(document.createElement('select')), o = t.reduce(function(t, e) { return t.add($(document.createElement('option')).prop({ value: e, text: e })); }, $()); return e.append(o); }), (n.prototype.createKeyCombo = function(t) { var e = $(document.createElement('select')); return ( $.each(t || [], function(t, o) { $(document.createElement('option')) .prop({ value: t, text: o }) .appendTo(e); }), e ); }), (n.prototype.createFontEditor = function(t) { var e = t || TradingView.factoryDefaults('chartproperties.editorFontsList'); return this.createCombo(e); }), (n.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'); }), (n.prototype.createSeriesMinTickEditor = function() { var t, e, o, i, n = "'), $(n); }), (n.prototype.createPrecisionEditor = function() { var t, e = "'), $(e); }), (n.prototype.createLabeledCell = function(t, e, o) { var i, n, s, r, l = null; return ( 'number' == typeof t.valueOf() ? ((l = t), (i = e), (n = o)) : ((i = t), (n = e)), (i += ''), (s = this._labelToId(i)), (r = $('')), $('