')),
this._initVisibility(),
this.update(),
this.jqDiv.appendTo(i);
}
var n = i(976);
(s.prototype.update = function() {
var t,
e,
s,
n,
o,
r,
a,
l = this._paneWidget.state();
if (l) {
if (!this._visible || !this._chart.isActive())
return void this.jqDiv[0].classList.add('pane-controls--hidden');
if (
(this.jqDiv[0].classList.remove('pane-controls--hidden'),
(t = this),
(e = t._model),
(s = e.panes().indexOf(l)),
this.jqDiv.toggleClass('toppane', 0 === s || this._chart.isMaximizedPane()),
(n = !1),
!l.containsMainSeries() && !this._chart.isMaximizedPane())
) {
for (o = 0, r = l.dataSources(), a = r.length; a--; )
if (r[a] instanceof TradingView.Study && ++o > 1) {
n = !0;
break;
}
r = null;
}
s > 0 && !this._chart.isMaximizedPane()
? (this._$upButton ||
(this._$upButton = $(document.createElement('a'))
.addClass('pane-legend-icon up')
.append($(i(1152)).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(),
s < this._model.panes().length - 1 && !this._chart.isMaximizedPane()
? (this._$downButton ||
(this._$downButton = $(document.createElement('a'))
.addClass('pane-legend-icon down')
.append($(i(1153)).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(),
n
? (this._$closeButton ||
(this._$closeButton = $(document.createElement('a'))
.addClass('pane-legend-icon delete')
.append($(i(1040)).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(1154)).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(1155)).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();
}
}),
(s.prototype.destroy = function() {
this._visibilityProperty &&
(this._visibilityProperty.unsubscribe(this, this._onVisibilityPropertyChange),
(this._visibilityProperty = null)),
this._boundMouseHandler &&
(this._mainDiv[0].removeEventListener('mouseenter', this._boundMouseHandler, !1),
this._mainDiv[0].removeEventListener('mouseleave', this._boundMouseHandler, !1),
(this._boundMouseHandler = null)),
this.jqDiv.remove();
}),
(s.prototype._initVisibility = function() {
(this._visible = !0),
(this._visibilityProperty = n.actualBehavior()),
this._visibilityProperty.subscribe(this, this._onVisibilityPropertyChange),
this._onVisibilityPropertyChange();
}),
(s.prototype._onVisibilityPropertyChange = function() {
var t = this._visibilityProperty.value();
'alwaysOn' === t || 'alwaysOff' === t
? ((this._visible = 'alwaysOn' === t),
this._boundMouseHandler &&
(this._mainDiv[0].removeEventListener('mouseenter', this._boundMouseHandler),
this._mainDiv[0].removeEventListener('mouseleave', this._boundMouseHandler),
(this._boundMouseHandler = null)))
: (this._boundMouseHandler ||
((this._boundMouseHandler = this._visibilityMouseHandler.bind(this)),
this._mainDiv[0].addEventListener('mouseenter', this._boundMouseHandler),
this._mainDiv[0].addEventListener('mouseleave', this._boundMouseHandler)),
(this._visible = !1)),
this.update();
}),
(s.prototype._visibilityMouseHandler = function(t) {
(this._visible = 'mouseenter' === t.type), this.update();
}),
(t.exports = s);
},
817: function(t, e, i) {
'use strict';
var s, n, o, r, a, l, h, d, u, p, c, _, v, m, g, b, y, w, f, M, B, C, S, x, T;
Object.defineProperty(e, '__esModule', { value: !0 }),
i.d(e, 'ControlBarNavigation', function() {
return T;
}),
i(11),
(s = i(1178)),
i.n(s),
(n = i(976)),
(o = i(38)),
(r = i(202)),
(a = i(29)),
(l = i(306)),
(h = i(71)),
i.n(h),
i(39),
(d = i(873)),
i.n(d),
(u = i(1179)),
i.n(u),
(p = i(1180)),
i.n(p),
(c = i(1181)),
i.n(c),
(_ = i(973)),
i.n(_),
(v = i(1182)),
i.n(v),
(m = i(1183)),
i.n(m),
(g = i(1184)),
i.n(g),
(b = i(1185)),
i.n(b),
(w = Object(l.b)({ keys: ['Alt', 'R'], text: '{0} + {1}' })),
(f = Object(l.b)({ keys: [m], text: '{0}' })),
(M = Object(l.b)({ keys: [g], text: '{0}' })),
(B =
'
\n\t
\n\t\t
\n\t\t\t
\n\t\t\t\t' +
u +
'\n\t\t\t
\n\t\t\t
\n\t\t\t\t' +
c +
'\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t' +
d +
'\n\t\t\t
\n\t\t\t
\n\t\t\t\t' +
_ +
'\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t' +
p +
'\n\t\t
\n\t
\n
'),
(C =
'
\n\t' +
v +
'\n
'),
(y = {}),
(y.moving = 'wait_finishing'),
(y.wait_finishing = 'stop'),
(y.stop = 'moving'),
(S = y),
(x = 'control-bar__btn--btn-hidden'),
(T = (function() {
function t(t, e) {
(this._back = null),
(this._backButtonVisible = !1),
(this._boundKeydownHandler = null),
(this._boundKeyupHandler = null),
(this._boundMouseHandler = null),
(this._chartBackgroundProperty = null),
(this._chartModel = null),
(this._checkIntervalId = 0),
(this._controlBar = null),
(this._controlBarVisible = !1),
(this._currentDistance = 0),
(this._deferredFinishTimeout = 0),
(this._finishingTimeout = 0),
(this._moveType = ''),
(this._movingTimeout = 0),
(this._pressedKey = []),
(this._priceAxisChanged = null),
(this._resetAvailabilityChanged = null),
(this._priceAxisName = ''),
(this._rafId = 0),
(this._startTime = 0),
(this._state = 'stop'),
(this._visibilityTypeProperty = null),
(this._widget = null),
(this._btnGroups = null),
(this._chart = t),
(this._parent = e),
this._init(),
this._initHandlers();
}
return (
(t.prototype.destroy = function() {
null !== this._visibilityTypeProperty &&
(this._visibilityTypeProperty.unsubscribe(this, this._onVisibilityTypeChange),
(this._visibilityTypeProperty = null)),
null !== this._boundMouseHandler &&
(this._parent.removeEventListener('mousemove', this._boundMouseHandler, !1),
this._parent.removeEventListener('mouseleave', this._boundMouseHandler, !1),
(this._boundMouseHandler = null)),
null !== this._boundKeydownHandler &&
(this._parent.ownerDocument.removeEventListener(
'keydown',
this._boundKeydownHandler,
),
(this._boundKeydownHandler = null)),
null !== this._boundKeyupHandler &&
(this._parent.ownerDocument.removeEventListener('keyup', this._boundKeyupHandler),
(this._boundKeyupHandler = null)),
clearTimeout(this._movingTimeout),
null !== this._priceAxisChanged &&
(this._priceAxisChanged.unsubscribe(this, this._updateBackBtnPosition),
(this._priceAxisChanged = null)),
null !== this._chartBackgroundProperty &&
(clearInterval(this._checkIntervalId),
this._chartBackgroundProperty.unsubscribe(this, this._updateBgBarStyle),
(this._chartBackgroundProperty = null)),
null !== this._resetAvailabilityChanged &&
(this._resetAvailabilityChanged.unsubscribe(
this,
this._updateResetScalesButtonVisibility,
),
(this._resetAvailabilityChanged = null)),
(this._chart = null);
}),
(t.prototype.updatePosition = function(t) {
null !== this._widget && null !== this._controlBar && this._updateBtnGroupVisibility(t);
}),
(t.prototype._init = function() {
var t,
e,
i,
s = this;
if (
((this._widget = Object(r.a)(B).querySelector('.control-bar-wrapper')),
(this._back = Object(r.a)(C).querySelector('.control-bar__btn--back-present')),
(this._controlBar = this._widget.querySelector('.control-bar')),
(this._btnGroups = Array.from(this._controlBar.querySelectorAll('.js-btn-group'))),
h.CheckMobile.any())
)
for (t = 0, e = this._btnGroups; t < e.length; t++)
(i = e[t]), i.classList.add('js-hidden');
(this._buttons = {
zoomIn: this._widget.querySelector('.control-bar__btn--zoom-in'),
zoomOut: this._widget.querySelector('.control-bar__btn--zoom-out'),
moveLeft: this._widget.querySelector('.control-bar__btn--move-left'),
moveRight: this._widget.querySelector('.control-bar__btn--move-right'),
turn: this._widget.querySelector('.control-bar__btn--turn-button'),
}),
this._updateControlBarPosition(),
this._initVisibility(),
this._parent.appendChild(this._widget),
this._parent.appendChild(this._back),
(this._backButtonVisible = !1),
(this._priceAxisName = o.IS_RTL ? 'left' : 'right'),
this._chart.withModel(this, function() {
(s._chartModel = s._chart.model()),
(s._priceAxisChanged = s._chart.getPriceAxisWidthChangedByName(s._priceAxisName)),
(s._resetAvailabilityChanged = s._chartModel
.model()
.isScalesResetAvailableChanged()),
s._priceAxisChanged.subscribe(s, s._updateBackBtnPosition),
s._resetAvailabilityChanged.subscribe(s, s._updateResetScalesButtonVisibility),
s._updateBackBtnPosition(),
null !== s._back &&
s._back.addEventListener('click', function() {
null !== s._chartModel && s._chartModel.timeScale().scrollToRealtime(!0);
}),
(s._checkIntervalId = setInterval(function() {
return s._check();
}, 1e3)),
(s._chartBackgroundProperty = s._chartModel
.model()
.properties().paneProperties.background),
null !== s._chartBackgroundProperty &&
s._chartBackgroundProperty.subscribe(s, s._updateBgBarStyle),
s._updateBgBarStyle();
});
}),
(t.prototype._initHandlers = function() {
var t,
e,
i,
s = this,
n = Modernizr.touch ? 'touchstart' : 'mousedown',
o = Modernizr.touch ? ['touchend'] : ['mouseup', 'mouseout'];
for (
this._buttons.moveLeft.addEventListener(n, function(t) {
t.preventDefault(), s._moveByBar(1), s._trackEvent('Move Left');
}),
this._buttons.moveRight.addEventListener(n, function(t) {
t.preventDefault(), s._moveByBar(-1), s._trackEvent('Move Right');
}),
t = 0,
e = o;
t < e.length;
t++
)
(i = e[t]),
this._buttons.moveLeft.addEventListener(i, function() {
return s._stopMoveByBar();
}),
this._buttons.moveRight.addEventListener(i, function() {
return s._stopMoveByBar();
});
this._buttons.turn.addEventListener('click', function(t) {
t.preventDefault(),
s._chart.GUIResetScales(),
s._trackEvent('Reset to Default Settings');
}),
this._buttons.zoomOut.addEventListener('click', function(t) {
t.preventDefault(),
null !== s._chartModel && s._chartModel.zoomOut(),
s._trackEvent('Zoom Out');
}),
this._buttons.zoomIn.addEventListener('click', function(t) {
t.preventDefault(),
null !== s._chartModel && s._chartModel.zoomIn(),
s._trackEvent('Zoom In');
}),
(this._boundKeydownHandler = this._keydownHandler.bind(this)),
(this._boundKeyupHandler = this._keyupHandler.bind(this)),
this._parent.ownerDocument.addEventListener('keydown', this._boundKeydownHandler),
this._parent.ownerDocument.addEventListener('keyup', this._boundKeyupHandler);
}),
(t.prototype._check = function() {
if (null !== this._chartModel && null !== this._back) {
var t = this._chartModel.timeScale().rightOffset() < 0;
t !== this._backButtonVisible &&
((this._backButtonVisible = t),
this._back.classList.toggle(x, !this._backButtonVisible));
}
}),
(t.prototype._initVisibility = function() {
(this._visibilityTypeProperty = Object(n.actualBehavior)()),
this._visibilityTypeProperty.subscribe(this, this._onVisibilityTypeChange),
this._onVisibilityTypeChange();
}),
(t.prototype._onVisibilityTypeChange = function() {
if (null !== this._visibilityTypeProperty) {
var t = this._visibilityTypeProperty.value();
'alwaysOn' === t || 'alwaysOff' === t
? ((this._controlBarVisible = 'alwaysOn' === t),
null !== this._boundMouseHandler &&
(this._parent.removeEventListener('mousemove', this._boundMouseHandler, !1),
this._parent.removeEventListener('mouseleave', this._boundMouseHandler, !1),
(this._boundMouseHandler = null)))
: ((this._controlBarVisible = !1),
this._boundMouseHandler ||
((this._boundMouseHandler = this._visibilityMouseHandler.bind(this)),
this._parent.addEventListener('mousemove', this._boundMouseHandler),
this._parent.addEventListener('mouseleave', this._boundMouseHandler))),
this._updateControlBarVisibility();
}
}),
(t.prototype._visibilityMouseHandler = function(t) {
var e, i;
t.buttons ||
(null !== this._chartModel && this._chartModel.lineBeingCreated()) ||
((e = !1),
('mousemove' !== t.type && 'mouseleave' !== t.type) ||
null === this._widget ||
((i = this._widget.getBoundingClientRect()),
(e =
t.clientX >= i.left - 100 &&
t.clientX <= i.right + 100 &&
t.clientY >= i.top - 100 &&
t.clientY <= i.bottom + 100)),
this._controlBarVisible !== e &&
((this._controlBarVisible = e),
null !== this._controlBar &&
null === this._rafId &&
(this._rafId = this._controlBar.ownerDocument.defaultView.requestAnimationFrame(
this._updateControlBarVisibility.bind(this),
))));
}),
(t.prototype._updateControlBarVisibility = function() {
(this._rafId = null),
null !== this._controlBar &&
this._controlBar.classList.toggle('control-bar--hidden', !this._controlBarVisible);
}),
(t.prototype._updateBackBtnPosition = function() {
if ('left' === this._priceAxisName || 'right' === this._priceAxisName) {
var t = this._chart.getPriceAxisMaxWidthByName(this._priceAxisName) + 14;
t && null !== this._back && (this._back.style.marginRight = t + 'px');
}
}),
(t.prototype._updateBgBarStyle = function() {
var t, e, i, s;
if (null !== this._chartModel) {
for (
t =
Object(a.getLuminance)(
this._chartModel
.model()
.properties()
.paneProperties.background.value(),
) < 0.5,
e = 0,
i = Object.values(this._buttons);
e < i.length;
e++
)
(s = i[e]), s.classList.toggle('control-bar__btn--dark', t);
null !== this._back && this._back.classList.toggle('control-bar__btn--dark', t);
}
}),
(t.prototype._updateBtnGroupVisibility = function(t) {
var e, i, s, n, o, r;
if (
null !== this._btnGroups &&
((e = [
{ breakPoint: 390, className: 'js-btn-group-right' },
{ breakPoint: 290, className: 'js-btn-group-left' },
]),
!h.CheckMobile.any())
)
for (i = 0, s = e; i < s.length; i++)
(n = s[i]),
(o = t <= n.breakPoint),
void 0 !== (r = this._getBtnGroup(n.className)) &&
o !== r.classList.contains('js-hidden') &&
(r.classList.toggle('js-hidden', o), this._updateControlBarPosition());
}),
(t.prototype._getBtnGroup = function(t) {
if (null !== this._btnGroups)
return this._btnGroups.find(function(e) {
return e.classList.contains(t);
});
}),
(t.prototype._updateControlBarPosition = function() {
var t, e;
null !== this._widget &&
null !== this._controlBar &&
((t = 0),
(e = this._controlBar.querySelectorAll('.js-btn-group:not(.js-hidden)')),
(t = e.length > 0 ? 86 * e.length : 50),
(this._widget.style.left = 'calc(50% - ' + Math.ceil(t / 2) + 'px)'));
}),
(t.prototype._updateResetScalesButtonVisibility = function() {
if (null !== this._chartModel) {
var t = this._chartModel.model().isScalesResetAvailable();
this._buttons.turn.classList.toggle(x, !t);
}
}),
(t.prototype._move = function(t) {
var e,
i,
s,
n = this;
null !== this._chartModel &&
'stop' === this._state &&
this._chartModel.beginUndoMacro(1 === t ? 'Move Left' : 'Move Right'),
(this._state = S.stop),
(this._moveType = 'animated'),
this._deferredFinishTimeout &&
(clearTimeout(this._deferredFinishTimeout), (this._deferredFinishTimeout = 0)),
this._finishingTimeout &&
(clearTimeout(this._finishingTimeout), (this._finishingTimeout = 0)),
(this._startTime = Date.now()),
0 === this._movingTimeout &&
((e = this._startTime),
(i = 10),
(s = function() {
n._moveStep(e, 0, 50 * t, 1e3), (n._movingTimeout = setTimeout(s.bind(n), i));
}),
(this._movingTimeout = setTimeout(s.bind(this), i)));
}),
(t.prototype._moveStep = function(t, e, i, s) {
var n, o, r;
return null === this._chartModel || this._chartModel.timeScale().isEmpty()
? void 0
: ((n = Date.now()),
n < t && (t = n),
(o = (n - t) / s),
(o > 1 || !isFinite(o)) && (o = 1),
(r = 1 - Math.pow(1 - o, 3)),
(this._currentDistance = (i - e) * r + e),
this._chartModel.scrollChart(this._currentDistance),
o);
}),
(t.prototype._finishMove = function() {
var t,
e,
i,
s = this;
clearTimeout(this._movingTimeout),
(this._movingTimeout = 0),
(this._deferredFinishTimeout = 0),
(t = this._currentDistance),
(e = Date.now()),
(i = function() {
var n = s._moveStep(e, t, 0, 700);
n && n < 1
? (s._finishingTimeout = setTimeout(i.bind(s), 10))
: null !== s._chartModel &&
((s._state = S.wait_finishing),
(s._moveType = ''),
(s._movingTimeout = 0),
(s._currentDistance = 0),
s._chartModel.endUndoMacro());
}),
(this._finishingTimeout = setTimeout(i.bind(this), 10));
}),
(t.prototype._stopMove = function() {
'moving' === this._state &&
((this._state = S.moving),
Date.now() - this._startTime < 200
? (this._deferredFinishTimeout = setTimeout(
this._finishMove.bind(this),
200 - (Date.now() - this._startTime),
))
: this._finishMove());
}),
(t.prototype._moveByBar = function(t) {
var e,
i,
s,
n,
o,
r,
a = this;
if (null !== this._chartModel) {
if (((e = this._chartModel.timeScale()), e.isEmpty())) return;
'stop' === this._state &&
this._chartModel.beginUndoMacro(1 === t ? 'Move Left' : 'Move Right'),
null !== e.visibleBars() &&
((i = e.indexToCoordinate(e.visibleBars().lastBar()) + e.barSpacing() / 2),
Math.abs(e.width() - i) > e.barSpacing() / 6 &&
this._chartModel.scrollChart(e.width() - i)),
(this._state = S.stop),
(this._moveType = 'by_bar'),
(this._startTime = Date.now()),
this._movingTimeout ||
((s = 0),
(n = 150),
(o = 400),
(r = function() {
a._moveByBarStep(t),
s++,
n > 100 && (n -= (s / 5) * 20),
(a._movingTimeout = setTimeout(r, n));
}),
(this._movingTimeout = setTimeout(r, o)),
this._moveByBarStep(t));
}
}),
(t.prototype._moveByBarStep = function(t) {
if (null !== this._chartModel) {
if (this._chartModel.timeScale().isEmpty()) return;
this._chartModel.scrollChartByBar(t);
}
}),
(t.prototype._stopMoveByBar = function() {
'moving' === this._state &&
(clearTimeout(this._movingTimeout),
(this._movingTimeout = 0),
(this._state = S.wait_finishing),
(this._moveType = ''),
(this._movingTimeout = 0),
(this._currentDistance = 0),
null !== this._chartModel && this._chartModel.endUndoMacro());
}),
(t.prototype._keydownHandler = function(t) {
var e, i;
t.metaKey ||
(37 !== (e = t.which) && 39 !== e) ||
this._pressedKey[e] ||
((this._pressedKey[e] = !0),
t.target.closest('input, textarea') ||
((i = 37 === e ? 1 : -1),
t.ctrlKey || t.altKey ? this._move(i) : this._moveByBar(i),
t.preventDefault()));
}),
(t.prototype._keyupHandler = function(t) {
var e = t.which;
(37 !== e && 39 !== e) ||
t.target.closest('input, textarea') ||
((this._pressedKey[t.which] = !1),
'by_bar' === this._moveType ? this._stopMoveByBar() : this._stopMove());
}),
(t.prototype._trackEvent = function(t) {}),
t
);
})());
},
873: function(t, e) {
t.exports =
'
';
},
973: function(t, e) {
t.exports =
'
';
},
976: function(t, e, i) {
'use strict';
function s(t) {
return 'alwaysOn' === t || 'alwaysOff' === t ? t : 'visibleOnMouseOver';
}
function n() {
if (!u) {
var t = 'NavigationButtons.visibility';
(u = new h.a()),
u.setValue(s(d.getValue(t))),
u.subscribe(u, function(e) {
d.setValue(t, s(e.value()));
});
}
return u;
}
function o() {
return [
{ value: 'visibleOnMouseOver', title: window.t('Visible on Mouse Over') },
{ value: 'alwaysOn', title: window.t('Always Visible') },
{ value: 'alwaysOff', title: window.t('Always Invisible') },
];
}
function r() {
var t, e;
return (
p ||
((p = new h.a()),
(t = n()),
(e = function() {
var e = t.value();
'alwaysOn' !== e &&
'alwaysOff' !== e &&
(e = Modernizr.touch ? 'alwaysOn' : 'visibleOnMouseOver'),
p && p.setValue(e);
}),
t.subscribe(p, e),
e()),
p
);
}
var a, l, h, d, u, p;
Object.defineProperty(e, '__esModule', { value: !0 }),
(e.property = n),
(e.availableValues = o),
(e.actualBehavior = r),
i(11),
(a = i(127)),
i.n(a),
(l = i(13)),
(h = i.n(l)),
(d = i(49)),
i.n(d);
},
});