lightweight-charts-react-components 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**!
3
- * lightweight-charts-react-components v0.0.3
3
+ * lightweight-charts-react-components v0.1.0
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE.md file in the root directory of this source tree.
@@ -8,2587 +8,6 @@
8
8
  * @license MIT
9
9
  */
10
10
 
11
- (function webpackUniversalModuleDefinition(root, factory) {
12
-
13
- if(typeof exports === 'object' && typeof module === 'object') {
14
- module.exports = factory();
15
- }else if(typeof define === 'function' && define.amd) {
16
-
17
- define([], factory);
18
-
19
- } else if(typeof exports === 'object'){
20
-
21
-
22
- exports["LightweightChartsReactComponents"] = factory();
23
-
24
- } else {
25
-
26
-
27
- root["LightweightChartsReactComponents"] = factory();
28
- }
29
-
30
- })(self, function() {
31
- return (function() { // webpackBootstrap
32
- "use strict";
33
- var __webpack_modules__ = ({
34
- "../node_modules/react/cjs/react-jsx-runtime.production.js": (function (__unused_webpack_module, exports) {
35
- var __webpack_unused_export__;
36
- /**
37
- * @license React
38
- * react-jsx-runtime.production.js
39
- *
40
- * Copyright (c) Meta Platforms, Inc. and affiliates.
41
- *
42
- * This source code is licensed under the MIT license found in the
43
- * LICENSE file in the root directory of this source tree.
44
- */
45
-
46
-
47
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
48
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
49
- function jsxProd(type, config, maybeKey) {
50
- var key = null;
51
- void 0 !== maybeKey && (key = "" + maybeKey);
52
- void 0 !== config.key && (key = "" + config.key);
53
- if ("key" in config) {
54
- maybeKey = {};
55
- for (var propName in config)
56
- "key" !== propName && (maybeKey[propName] = config[propName]);
57
- } else maybeKey = config;
58
- config = maybeKey.ref;
59
- return {
60
- $$typeof: REACT_ELEMENT_TYPE,
61
- type: type,
62
- key: key,
63
- ref: void 0 !== config ? config : null,
64
- props: maybeKey
65
- };
66
- }
67
- __webpack_unused_export__ = REACT_FRAGMENT_TYPE;
68
- exports.jsx = jsxProd;
69
- __webpack_unused_export__ = jsxProd;
70
-
71
-
72
- }),
73
- "../node_modules/react/cjs/react.production.js": (function (__unused_webpack_module, exports) {
74
- var __webpack_unused_export__;
75
- /**
76
- * @license React
77
- * react.production.js
78
- *
79
- * Copyright (c) Meta Platforms, Inc. and affiliates.
80
- *
81
- * This source code is licensed under the MIT license found in the
82
- * LICENSE file in the root directory of this source tree.
83
- */
84
-
85
-
86
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
87
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
88
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
89
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
90
- REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
91
- REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
92
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
93
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
94
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
95
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
96
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
97
- MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
98
- function getIteratorFn(maybeIterable) {
99
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
100
- maybeIterable =
101
- (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
102
- maybeIterable["@@iterator"];
103
- return "function" === typeof maybeIterable ? maybeIterable : null;
104
- }
105
- var ReactNoopUpdateQueue = {
106
- isMounted: function () {
107
- return !1;
108
- },
109
- enqueueForceUpdate: function () {},
110
- enqueueReplaceState: function () {},
111
- enqueueSetState: function () {}
112
- },
113
- assign = Object.assign,
114
- emptyObject = {};
115
- function Component(props, context, updater) {
116
- this.props = props;
117
- this.context = context;
118
- this.refs = emptyObject;
119
- this.updater = updater || ReactNoopUpdateQueue;
120
- }
121
- Component.prototype.isReactComponent = {};
122
- Component.prototype.setState = function (partialState, callback) {
123
- if (
124
- "object" !== typeof partialState &&
125
- "function" !== typeof partialState &&
126
- null != partialState
127
- )
128
- throw Error(
129
- "takes an object of state variables to update or a function which returns an object of state variables."
130
- );
131
- this.updater.enqueueSetState(this, partialState, callback, "setState");
132
- };
133
- Component.prototype.forceUpdate = function (callback) {
134
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
135
- };
136
- function ComponentDummy() {}
137
- ComponentDummy.prototype = Component.prototype;
138
- function PureComponent(props, context, updater) {
139
- this.props = props;
140
- this.context = context;
141
- this.refs = emptyObject;
142
- this.updater = updater || ReactNoopUpdateQueue;
143
- }
144
- var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
145
- pureComponentPrototype.constructor = PureComponent;
146
- assign(pureComponentPrototype, Component.prototype);
147
- pureComponentPrototype.isPureReactComponent = !0;
148
- var isArrayImpl = Array.isArray,
149
- ReactSharedInternals = { H: null, A: null, T: null, S: null },
150
- hasOwnProperty = Object.prototype.hasOwnProperty;
151
- function ReactElement(type, key, self, source, owner, props) {
152
- self = props.ref;
153
- return {
154
- $$typeof: REACT_ELEMENT_TYPE,
155
- type: type,
156
- key: key,
157
- ref: void 0 !== self ? self : null,
158
- props: props
159
- };
160
- }
161
- function cloneAndReplaceKey(oldElement, newKey) {
162
- return ReactElement(
163
- oldElement.type,
164
- newKey,
165
- void 0,
166
- void 0,
167
- void 0,
168
- oldElement.props
169
- );
170
- }
171
- function isValidElement(object) {
172
- return (
173
- "object" === typeof object &&
174
- null !== object &&
175
- object.$$typeof === REACT_ELEMENT_TYPE
176
- );
177
- }
178
- function escape(key) {
179
- var escaperLookup = { "=": "=0", ":": "=2" };
180
- return (
181
- "$" +
182
- key.replace(/[=:]/g, function (match) {
183
- return escaperLookup[match];
184
- })
185
- );
186
- }
187
- var userProvidedKeyEscapeRegex = /\/+/g;
188
- function getElementKey(element, index) {
189
- return "object" === typeof element && null !== element && null != element.key
190
- ? escape("" + element.key)
191
- : index.toString(36);
192
- }
193
- function noop$1() {}
194
- function resolveThenable(thenable) {
195
- switch (thenable.status) {
196
- case "fulfilled":
197
- return thenable.value;
198
- case "rejected":
199
- throw thenable.reason;
200
- default:
201
- switch (
202
- ("string" === typeof thenable.status
203
- ? thenable.then(noop$1, noop$1)
204
- : ((thenable.status = "pending"),
205
- thenable.then(
206
- function (fulfilledValue) {
207
- "pending" === thenable.status &&
208
- ((thenable.status = "fulfilled"),
209
- (thenable.value = fulfilledValue));
210
- },
211
- function (error) {
212
- "pending" === thenable.status &&
213
- ((thenable.status = "rejected"), (thenable.reason = error));
214
- }
215
- )),
216
- thenable.status)
217
- ) {
218
- case "fulfilled":
219
- return thenable.value;
220
- case "rejected":
221
- throw thenable.reason;
222
- }
223
- }
224
- throw thenable;
225
- }
226
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
227
- var type = typeof children;
228
- if ("undefined" === type || "boolean" === type) children = null;
229
- var invokeCallback = !1;
230
- if (null === children) invokeCallback = !0;
231
- else
232
- switch (type) {
233
- case "bigint":
234
- case "string":
235
- case "number":
236
- invokeCallback = !0;
237
- break;
238
- case "object":
239
- switch (children.$$typeof) {
240
- case REACT_ELEMENT_TYPE:
241
- case REACT_PORTAL_TYPE:
242
- invokeCallback = !0;
243
- break;
244
- case REACT_LAZY_TYPE:
245
- return (
246
- (invokeCallback = children._init),
247
- mapIntoArray(
248
- invokeCallback(children._payload),
249
- array,
250
- escapedPrefix,
251
- nameSoFar,
252
- callback
253
- )
254
- );
255
- }
256
- }
257
- if (invokeCallback)
258
- return (
259
- (callback = callback(children)),
260
- (invokeCallback =
261
- "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
262
- isArrayImpl(callback)
263
- ? ((escapedPrefix = ""),
264
- null != invokeCallback &&
265
- (escapedPrefix =
266
- invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
267
- mapIntoArray(callback, array, escapedPrefix, "", function (c) {
268
- return c;
269
- }))
270
- : null != callback &&
271
- (isValidElement(callback) &&
272
- (callback = cloneAndReplaceKey(
273
- callback,
274
- escapedPrefix +
275
- (null == callback.key ||
276
- (children && children.key === callback.key)
277
- ? ""
278
- : ("" + callback.key).replace(
279
- userProvidedKeyEscapeRegex,
280
- "$&/"
281
- ) + "/") +
282
- invokeCallback
283
- )),
284
- array.push(callback)),
285
- 1
286
- );
287
- invokeCallback = 0;
288
- var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
289
- if (isArrayImpl(children))
290
- for (var i = 0; i < children.length; i++)
291
- (nameSoFar = children[i]),
292
- (type = nextNamePrefix + getElementKey(nameSoFar, i)),
293
- (invokeCallback += mapIntoArray(
294
- nameSoFar,
295
- array,
296
- escapedPrefix,
297
- type,
298
- callback
299
- ));
300
- else if (((i = getIteratorFn(children)), "function" === typeof i))
301
- for (
302
- children = i.call(children), i = 0;
303
- !(nameSoFar = children.next()).done;
304
-
305
- )
306
- (nameSoFar = nameSoFar.value),
307
- (type = nextNamePrefix + getElementKey(nameSoFar, i++)),
308
- (invokeCallback += mapIntoArray(
309
- nameSoFar,
310
- array,
311
- escapedPrefix,
312
- type,
313
- callback
314
- ));
315
- else if ("object" === type) {
316
- if ("function" === typeof children.then)
317
- return mapIntoArray(
318
- resolveThenable(children),
319
- array,
320
- escapedPrefix,
321
- nameSoFar,
322
- callback
323
- );
324
- array = String(children);
325
- throw Error(
326
- "Objects are not valid as a React child (found: " +
327
- ("[object Object]" === array
328
- ? "object with keys {" + Object.keys(children).join(", ") + "}"
329
- : array) +
330
- "). If you meant to render a collection of children, use an array instead."
331
- );
332
- }
333
- return invokeCallback;
334
- }
335
- function mapChildren(children, func, context) {
336
- if (null == children) return children;
337
- var result = [],
338
- count = 0;
339
- mapIntoArray(children, result, "", "", function (child) {
340
- return func.call(context, child, count++);
341
- });
342
- return result;
343
- }
344
- function lazyInitializer(payload) {
345
- if (-1 === payload._status) {
346
- var ctor = payload._result;
347
- ctor = ctor();
348
- ctor.then(
349
- function (moduleObject) {
350
- if (0 === payload._status || -1 === payload._status)
351
- (payload._status = 1), (payload._result = moduleObject);
352
- },
353
- function (error) {
354
- if (0 === payload._status || -1 === payload._status)
355
- (payload._status = 2), (payload._result = error);
356
- }
357
- );
358
- -1 === payload._status && ((payload._status = 0), (payload._result = ctor));
359
- }
360
- if (1 === payload._status) return payload._result.default;
361
- throw payload._result;
362
- }
363
- var reportGlobalError =
364
- "function" === typeof reportError
365
- ? reportError
366
- : function (error) {
367
- if (
368
- "object" === typeof window &&
369
- "function" === typeof window.ErrorEvent
370
- ) {
371
- var event = new window.ErrorEvent("error", {
372
- bubbles: !0,
373
- cancelable: !0,
374
- message:
375
- "object" === typeof error &&
376
- null !== error &&
377
- "string" === typeof error.message
378
- ? String(error.message)
379
- : String(error),
380
- error: error
381
- });
382
- if (!window.dispatchEvent(event)) return;
383
- } else if (
384
- "object" === typeof process &&
385
- "function" === typeof process.emit
386
- ) {
387
- process.emit("uncaughtException", error);
388
- return;
389
- }
390
- console.error(error);
391
- };
392
- function noop() {}
393
- __webpack_unused_export__ = {
394
- map: mapChildren,
395
- forEach: function (children, forEachFunc, forEachContext) {
396
- mapChildren(
397
- children,
398
- function () {
399
- forEachFunc.apply(this, arguments);
400
- },
401
- forEachContext
402
- );
403
- },
404
- count: function (children) {
405
- var n = 0;
406
- mapChildren(children, function () {
407
- n++;
408
- });
409
- return n;
410
- },
411
- toArray: function (children) {
412
- return (
413
- mapChildren(children, function (child) {
414
- return child;
415
- }) || []
416
- );
417
- },
418
- only: function (children) {
419
- if (!isValidElement(children))
420
- throw Error(
421
- "React.Children.only expected to receive a single React element child."
422
- );
423
- return children;
424
- }
425
- };
426
- __webpack_unused_export__ = Component;
427
- __webpack_unused_export__ = REACT_FRAGMENT_TYPE;
428
- __webpack_unused_export__ = REACT_PROFILER_TYPE;
429
- __webpack_unused_export__ = PureComponent;
430
- __webpack_unused_export__ = REACT_STRICT_MODE_TYPE;
431
- __webpack_unused_export__ = REACT_SUSPENSE_TYPE;
432
- __webpack_unused_export__ =
433
- ReactSharedInternals;
434
- __webpack_unused_export__ = function () {
435
- throw Error("act(...) is not supported in production builds of React.");
436
- };
437
- __webpack_unused_export__ = function (fn) {
438
- return function () {
439
- return fn.apply(null, arguments);
440
- };
441
- };
442
- __webpack_unused_export__ = function (element, config, children) {
443
- if (null === element || void 0 === element)
444
- throw Error(
445
- "The argument must be a React element, but you passed " + element + "."
446
- );
447
- var props = assign({}, element.props),
448
- key = element.key,
449
- owner = void 0;
450
- if (null != config)
451
- for (propName in (void 0 !== config.ref && (owner = void 0),
452
- void 0 !== config.key && (key = "" + config.key),
453
- config))
454
- !hasOwnProperty.call(config, propName) ||
455
- "key" === propName ||
456
- "__self" === propName ||
457
- "__source" === propName ||
458
- ("ref" === propName && void 0 === config.ref) ||
459
- (props[propName] = config[propName]);
460
- var propName = arguments.length - 2;
461
- if (1 === propName) props.children = children;
462
- else if (1 < propName) {
463
- for (var childArray = Array(propName), i = 0; i < propName; i++)
464
- childArray[i] = arguments[i + 2];
465
- props.children = childArray;
466
- }
467
- return ReactElement(element.type, key, void 0, void 0, owner, props);
468
- };
469
- exports.createContext = function (defaultValue) {
470
- defaultValue = {
471
- $$typeof: REACT_CONTEXT_TYPE,
472
- _currentValue: defaultValue,
473
- _currentValue2: defaultValue,
474
- _threadCount: 0,
475
- Provider: null,
476
- Consumer: null
477
- };
478
- defaultValue.Provider = defaultValue;
479
- defaultValue.Consumer = {
480
- $$typeof: REACT_CONSUMER_TYPE,
481
- _context: defaultValue
482
- };
483
- return defaultValue;
484
- };
485
- __webpack_unused_export__ = function (type, config, children) {
486
- var propName,
487
- props = {},
488
- key = null;
489
- if (null != config)
490
- for (propName in (void 0 !== config.key && (key = "" + config.key), config))
491
- hasOwnProperty.call(config, propName) &&
492
- "key" !== propName &&
493
- "__self" !== propName &&
494
- "__source" !== propName &&
495
- (props[propName] = config[propName]);
496
- var childrenLength = arguments.length - 2;
497
- if (1 === childrenLength) props.children = children;
498
- else if (1 < childrenLength) {
499
- for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
500
- childArray[i] = arguments[i + 2];
501
- props.children = childArray;
502
- }
503
- if (type && type.defaultProps)
504
- for (propName in ((childrenLength = type.defaultProps), childrenLength))
505
- void 0 === props[propName] &&
506
- (props[propName] = childrenLength[propName]);
507
- return ReactElement(type, key, void 0, void 0, null, props);
508
- };
509
- __webpack_unused_export__ = function () {
510
- return { current: null };
511
- };
512
- exports.forwardRef = function (render) {
513
- return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
514
- };
515
- __webpack_unused_export__ = isValidElement;
516
- __webpack_unused_export__ = function (ctor) {
517
- return {
518
- $$typeof: REACT_LAZY_TYPE,
519
- _payload: { _status: -1, _result: ctor },
520
- _init: lazyInitializer
521
- };
522
- };
523
- __webpack_unused_export__ = function (type, compare) {
524
- return {
525
- $$typeof: REACT_MEMO_TYPE,
526
- type: type,
527
- compare: void 0 === compare ? null : compare
528
- };
529
- };
530
- __webpack_unused_export__ = function (scope) {
531
- var prevTransition = ReactSharedInternals.T,
532
- currentTransition = {};
533
- ReactSharedInternals.T = currentTransition;
534
- try {
535
- var returnValue = scope(),
536
- onStartTransitionFinish = ReactSharedInternals.S;
537
- null !== onStartTransitionFinish &&
538
- onStartTransitionFinish(currentTransition, returnValue);
539
- "object" === typeof returnValue &&
540
- null !== returnValue &&
541
- "function" === typeof returnValue.then &&
542
- returnValue.then(noop, reportGlobalError);
543
- } catch (error) {
544
- reportGlobalError(error);
545
- } finally {
546
- ReactSharedInternals.T = prevTransition;
547
- }
548
- };
549
- __webpack_unused_export__ = function () {
550
- return ReactSharedInternals.H.useCacheRefresh();
551
- };
552
- __webpack_unused_export__ = function (usable) {
553
- return ReactSharedInternals.H.use(usable);
554
- };
555
- __webpack_unused_export__ = function (action, initialState, permalink) {
556
- return ReactSharedInternals.H.useActionState(action, initialState, permalink);
557
- };
558
- exports.useCallback = function (callback, deps) {
559
- return ReactSharedInternals.H.useCallback(callback, deps);
560
- };
561
- exports.useContext = function (Context) {
562
- return ReactSharedInternals.H.useContext(Context);
563
- };
564
- __webpack_unused_export__ = function () {};
565
- __webpack_unused_export__ = function (value, initialValue) {
566
- return ReactSharedInternals.H.useDeferredValue(value, initialValue);
567
- };
568
- __webpack_unused_export__ = function (create, deps) {
569
- return ReactSharedInternals.H.useEffect(create, deps);
570
- };
571
- __webpack_unused_export__ = function () {
572
- return ReactSharedInternals.H.useId();
573
- };
574
- exports.useImperativeHandle = function (ref, create, deps) {
575
- return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
576
- };
577
- __webpack_unused_export__ = function (create, deps) {
578
- return ReactSharedInternals.H.useInsertionEffect(create, deps);
579
- };
580
- exports.useLayoutEffect = function (create, deps) {
581
- return ReactSharedInternals.H.useLayoutEffect(create, deps);
582
- };
583
- __webpack_unused_export__ = function (create, deps) {
584
- return ReactSharedInternals.H.useMemo(create, deps);
585
- };
586
- __webpack_unused_export__ = function (passthrough, reducer) {
587
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
588
- };
589
- __webpack_unused_export__ = function (reducer, initialArg, init) {
590
- return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
591
- };
592
- exports.useRef = function (initialValue) {
593
- return ReactSharedInternals.H.useRef(initialValue);
594
- };
595
- exports.useState = function (initialState) {
596
- return ReactSharedInternals.H.useState(initialState);
597
- };
598
- __webpack_unused_export__ = function (
599
- subscribe,
600
- getSnapshot,
601
- getServerSnapshot
602
- ) {
603
- return ReactSharedInternals.H.useSyncExternalStore(
604
- subscribe,
605
- getSnapshot,
606
- getServerSnapshot
607
- );
608
- };
609
- __webpack_unused_export__ = function () {
610
- return ReactSharedInternals.H.useTransition();
611
- };
612
- __webpack_unused_export__ = "19.0.0";
613
-
614
-
615
- }),
616
- "../node_modules/react/index.js": (function (module, __unused_webpack_exports, __webpack_require__) {
617
-
618
-
619
- if (true) {
620
- module.exports = __webpack_require__("../node_modules/react/cjs/react.production.js");
621
- } else {}
622
-
623
-
624
- }),
625
- "../node_modules/react/jsx-runtime.js": (function (module, __unused_webpack_exports, __webpack_require__) {
626
-
627
-
628
- if (true) {
629
- module.exports = __webpack_require__("../node_modules/react/cjs/react-jsx-runtime.production.js");
630
- } else {}
631
-
632
-
633
- }),
634
-
635
- });
636
- /************************************************************************/
637
- // The module cache
638
- var __webpack_module_cache__ = {};
639
-
640
- // The require function
641
- function __webpack_require__(moduleId) {
642
-
643
- // Check if module is in cache
644
- var cachedModule = __webpack_module_cache__[moduleId];
645
- if (cachedModule !== undefined) {
646
- return cachedModule.exports;
647
- }
648
- // Create a new module (and put it into the cache)
649
- var module = (__webpack_module_cache__[moduleId] = {
650
- exports: {}
651
- });
652
- // Execute the module function
653
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
654
-
655
- // Return the exports of the module
656
- return module.exports;
657
-
658
- }
659
-
660
- /************************************************************************/
661
- // webpack/runtime/define_property_getters
662
- !function() {
663
- __webpack_require__.d = function(exports, definition) {
664
- for(var key in definition) {
665
- if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
666
- Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
667
- }
668
- }
669
- };
670
- }();
671
- // webpack/runtime/has_own_property
672
- !function() {
673
- __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
674
- }();
675
- // webpack/runtime/make_namespace_object
676
- !function() {
677
- // define __esModule on exports
678
- __webpack_require__.r = function(exports) {
679
- if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
680
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
681
- }
682
- Object.defineProperty(exports, '__esModule', { value: true });
683
- };
684
- }();
685
- /************************************************************************/
686
- var __webpack_exports__ = {};
687
- // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
688
- !function() {
689
- // ESM COMPAT FLAG
690
- __webpack_require__.r(__webpack_exports__);
691
-
692
- // EXPORTS
693
- __webpack_require__.d(__webpack_exports__, {
694
- BarSeries: function() { return /* reexport */ BarSeries; },
695
- LineSeries: function() { return /* reexport */ series_LineSeries; },
696
- Chart: function() { return /* reexport */ ChartWrapper; },
697
- BaselineSeries: function() { return /* reexport */ BaselineSeries; },
698
- PriceLine: function() { return /* reexport */ priceLine_PriceLine; },
699
- CandlestickSeries: function() { return /* reexport */ series_CandlestickSeries; },
700
- HistogramSeries: function() { return /* reexport */ series_HistogramSeries; },
701
- TimeScale: function() { return /* reexport */ TimeScale; },
702
- AreaSeries: function() { return /* reexport */ series_AreaSeries; },
703
- PriceScale: function() { return /* reexport */ PriceScale; }
704
- });
705
-
706
- // EXTERNAL MODULE: ../node_modules/react/jsx-runtime.js
707
- var jsx_runtime = __webpack_require__("../node_modules/react/jsx-runtime.js");
708
- // EXTERNAL MODULE: ../node_modules/react/index.js
709
- var react = __webpack_require__("../node_modules/react/index.js");
710
- ;// CONCATENATED MODULE: ./src/chart/ChartContext.ts
711
-
712
- var ChartContext = (0,react.createContext)({});
713
- ChartContext.displayName = "ChartContext";
714
-
715
- ;// CONCATENATED MODULE: ../node_modules/fancy-canvas/size.mjs
716
- function size_size(_a) {
717
- var width = _a.width, height = _a.height;
718
- if (width < 0) {
719
- throw new Error('Negative width is not allowed for Size');
720
- }
721
- if (height < 0) {
722
- throw new Error('Negative height is not allowed for Size');
723
- }
724
- return {
725
- width: width,
726
- height: height,
727
- };
728
- }
729
- function equalSizes(first, second) {
730
- return (first.width === second.width) &&
731
- (first.height === second.height);
732
- }
733
-
734
- ;// CONCATENATED MODULE: ../node_modules/fancy-canvas/device-pixel-ratio.mjs
735
- var device_pixel_ratio_Observable = /** @class */ (function () {
736
- function Observable(win) {
737
- var _this = this;
738
- this._resolutionListener = function () { return _this._onResolutionChanged(); };
739
- this._resolutionMediaQueryList = null;
740
- this._observers = [];
741
- this._window = win;
742
- this._installResolutionListener();
743
- }
744
- Observable.prototype.dispose = function () {
745
- this._uninstallResolutionListener();
746
- this._window = null;
747
- };
748
- Object.defineProperty(Observable.prototype, "value", {
749
- get: function () {
750
- return this._window.devicePixelRatio;
751
- },
752
- enumerable: false,
753
- configurable: true
754
- });
755
- Observable.prototype.subscribe = function (next) {
756
- var _this = this;
757
- var observer = { next: next };
758
- this._observers.push(observer);
759
- return {
760
- unsubscribe: function () {
761
- _this._observers = _this._observers.filter(function (o) { return o !== observer; });
762
- },
763
- };
764
- };
765
- Observable.prototype._installResolutionListener = function () {
766
- if (this._resolutionMediaQueryList !== null) {
767
- throw new Error('Resolution listener is already installed');
768
- }
769
- var dppx = this._window.devicePixelRatio;
770
- this._resolutionMediaQueryList = this._window.matchMedia("all and (resolution: ".concat(dppx, "dppx)"));
771
- // IE and some versions of Edge do not support addEventListener/removeEventListener, and we are going to use the deprecated addListener/removeListener
772
- this._resolutionMediaQueryList.addListener(this._resolutionListener);
773
- };
774
- Observable.prototype._uninstallResolutionListener = function () {
775
- if (this._resolutionMediaQueryList !== null) {
776
- // IE and some versions of Edge do not support addEventListener/removeEventListener, and we are going to use the deprecated addListener/removeListener
777
- this._resolutionMediaQueryList.removeListener(this._resolutionListener);
778
- this._resolutionMediaQueryList = null;
779
- }
780
- };
781
- Observable.prototype._reinstallResolutionListener = function () {
782
- this._uninstallResolutionListener();
783
- this._installResolutionListener();
784
- };
785
- Observable.prototype._onResolutionChanged = function () {
786
- var _this = this;
787
- this._observers.forEach(function (observer) { return observer.next(_this._window.devicePixelRatio); });
788
- this._reinstallResolutionListener();
789
- };
790
- return Observable;
791
- }());
792
- function createObservable(win) {
793
- return new device_pixel_ratio_Observable(win);
794
- }
795
-
796
- ;// CONCATENATED MODULE: ../node_modules/fancy-canvas/canvas-element-bitmap-size.mjs
797
-
798
-
799
- var canvas_element_bitmap_size_DevicePixelContentBoxBinding = /** @class */ (function () {
800
- function DevicePixelContentBoxBinding(canvasElement, transformBitmapSize, options) {
801
- var _a;
802
- this._canvasElement = null;
803
- this._bitmapSizeChangedListeners = [];
804
- this._suggestedBitmapSize = null;
805
- this._suggestedBitmapSizeChangedListeners = [];
806
- // devicePixelRatio approach
807
- this._devicePixelRatioObservable = null;
808
- // ResizeObserver approach
809
- this._canvasElementResizeObserver = null;
810
- this._canvasElement = canvasElement;
811
- this._canvasElementClientSize = size_size({
812
- width: this._canvasElement.clientWidth,
813
- height: this._canvasElement.clientHeight,
814
- });
815
- this._transformBitmapSize = transformBitmapSize !== null && transformBitmapSize !== void 0 ? transformBitmapSize : (function (size) { return size; });
816
- this._allowResizeObserver = (_a = options === null || options === void 0 ? void 0 : options.allowResizeObserver) !== null && _a !== void 0 ? _a : true;
817
- this._chooseAndInitObserver();
818
- // we MAY leave the constuctor without any bitmap size observation mechanics initialized
819
- }
820
- DevicePixelContentBoxBinding.prototype.dispose = function () {
821
- var _a, _b;
822
- if (this._canvasElement === null) {
823
- throw new Error('Object is disposed');
824
- }
825
- (_a = this._canvasElementResizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
826
- this._canvasElementResizeObserver = null;
827
- (_b = this._devicePixelRatioObservable) === null || _b === void 0 ? void 0 : _b.dispose();
828
- this._devicePixelRatioObservable = null;
829
- this._suggestedBitmapSizeChangedListeners.length = 0;
830
- this._bitmapSizeChangedListeners.length = 0;
831
- this._canvasElement = null;
832
- };
833
- Object.defineProperty(DevicePixelContentBoxBinding.prototype, "canvasElement", {
834
- get: function () {
835
- if (this._canvasElement === null) {
836
- throw new Error('Object is disposed');
837
- }
838
- return this._canvasElement;
839
- },
840
- enumerable: false,
841
- configurable: true
842
- });
843
- Object.defineProperty(DevicePixelContentBoxBinding.prototype, "canvasElementClientSize", {
844
- get: function () {
845
- return this._canvasElementClientSize;
846
- },
847
- enumerable: false,
848
- configurable: true
849
- });
850
- Object.defineProperty(DevicePixelContentBoxBinding.prototype, "bitmapSize", {
851
- get: function () {
852
- return size_size({
853
- width: this.canvasElement.width,
854
- height: this.canvasElement.height,
855
- });
856
- },
857
- enumerable: false,
858
- configurable: true
859
- });
860
- /**
861
- * Use this function to change canvas element client size until binding is disposed
862
- * @param clientSize New client size for bound HTMLCanvasElement
863
- */
864
- DevicePixelContentBoxBinding.prototype.resizeCanvasElement = function (clientSize) {
865
- this._canvasElementClientSize = size_size(clientSize);
866
- this.canvasElement.style.width = "".concat(this._canvasElementClientSize.width, "px");
867
- this.canvasElement.style.height = "".concat(this._canvasElementClientSize.height, "px");
868
- this._invalidateBitmapSize();
869
- };
870
- DevicePixelContentBoxBinding.prototype.subscribeBitmapSizeChanged = function (listener) {
871
- this._bitmapSizeChangedListeners.push(listener);
872
- };
873
- DevicePixelContentBoxBinding.prototype.unsubscribeBitmapSizeChanged = function (listener) {
874
- this._bitmapSizeChangedListeners = this._bitmapSizeChangedListeners.filter(function (l) { return l !== listener; });
875
- };
876
- Object.defineProperty(DevicePixelContentBoxBinding.prototype, "suggestedBitmapSize", {
877
- get: function () {
878
- return this._suggestedBitmapSize;
879
- },
880
- enumerable: false,
881
- configurable: true
882
- });
883
- DevicePixelContentBoxBinding.prototype.subscribeSuggestedBitmapSizeChanged = function (listener) {
884
- this._suggestedBitmapSizeChangedListeners.push(listener);
885
- };
886
- DevicePixelContentBoxBinding.prototype.unsubscribeSuggestedBitmapSizeChanged = function (listener) {
887
- this._suggestedBitmapSizeChangedListeners = this._suggestedBitmapSizeChangedListeners.filter(function (l) { return l !== listener; });
888
- };
889
- DevicePixelContentBoxBinding.prototype.applySuggestedBitmapSize = function () {
890
- if (this._suggestedBitmapSize === null) {
891
- // nothing to apply
892
- return;
893
- }
894
- var oldSuggestedSize = this._suggestedBitmapSize;
895
- this._suggestedBitmapSize = null;
896
- this._resizeBitmap(oldSuggestedSize);
897
- this._emitSuggestedBitmapSizeChanged(oldSuggestedSize, this._suggestedBitmapSize);
898
- };
899
- DevicePixelContentBoxBinding.prototype._resizeBitmap = function (newSize) {
900
- var oldSize = this.bitmapSize;
901
- if (equalSizes(oldSize, newSize)) {
902
- return;
903
- }
904
- this.canvasElement.width = newSize.width;
905
- this.canvasElement.height = newSize.height;
906
- this._emitBitmapSizeChanged(oldSize, newSize);
907
- };
908
- DevicePixelContentBoxBinding.prototype._emitBitmapSizeChanged = function (oldSize, newSize) {
909
- var _this = this;
910
- this._bitmapSizeChangedListeners.forEach(function (listener) { return listener.call(_this, oldSize, newSize); });
911
- };
912
- DevicePixelContentBoxBinding.prototype._suggestNewBitmapSize = function (newSize) {
913
- var oldSuggestedSize = this._suggestedBitmapSize;
914
- var finalNewSize = size_size(this._transformBitmapSize(newSize, this._canvasElementClientSize));
915
- var newSuggestedSize = equalSizes(this.bitmapSize, finalNewSize) ? null : finalNewSize;
916
- if (oldSuggestedSize === null && newSuggestedSize === null) {
917
- return;
918
- }
919
- if (oldSuggestedSize !== null && newSuggestedSize !== null
920
- && equalSizes(oldSuggestedSize, newSuggestedSize)) {
921
- return;
922
- }
923
- this._suggestedBitmapSize = newSuggestedSize;
924
- this._emitSuggestedBitmapSizeChanged(oldSuggestedSize, newSuggestedSize);
925
- };
926
- DevicePixelContentBoxBinding.prototype._emitSuggestedBitmapSizeChanged = function (oldSize, newSize) {
927
- var _this = this;
928
- this._suggestedBitmapSizeChangedListeners.forEach(function (listener) { return listener.call(_this, oldSize, newSize); });
929
- };
930
- DevicePixelContentBoxBinding.prototype._chooseAndInitObserver = function () {
931
- var _this = this;
932
- if (!this._allowResizeObserver) {
933
- this._initDevicePixelRatioObservable();
934
- return;
935
- }
936
- isDevicePixelContentBoxSupported()
937
- .then(function (isSupported) {
938
- return isSupported ?
939
- _this._initResizeObserver() :
940
- _this._initDevicePixelRatioObservable();
941
- });
942
- };
943
- // devicePixelRatio approach
944
- DevicePixelContentBoxBinding.prototype._initDevicePixelRatioObservable = function () {
945
- var _this = this;
946
- if (this._canvasElement === null) {
947
- // it looks like we are already dead
948
- return;
949
- }
950
- var win = canvasElementWindow(this._canvasElement);
951
- if (win === null) {
952
- throw new Error('No window is associated with the canvas');
953
- }
954
- this._devicePixelRatioObservable = createObservable(win);
955
- this._devicePixelRatioObservable.subscribe(function () { return _this._invalidateBitmapSize(); });
956
- this._invalidateBitmapSize();
957
- };
958
- DevicePixelContentBoxBinding.prototype._invalidateBitmapSize = function () {
959
- var _a, _b;
960
- if (this._canvasElement === null) {
961
- // it looks like we are already dead
962
- return;
963
- }
964
- var win = canvasElementWindow(this._canvasElement);
965
- if (win === null) {
966
- return;
967
- }
968
- var ratio = (_b = (_a = this._devicePixelRatioObservable) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : win.devicePixelRatio;
969
- var canvasRects = this._canvasElement.getClientRects();
970
- var newSize =
971
- // eslint-disable-next-line no-negated-condition
972
- canvasRects[0] !== undefined ?
973
- predictedBitmapSize(canvasRects[0], ratio) :
974
- size_size({
975
- width: this._canvasElementClientSize.width * ratio,
976
- height: this._canvasElementClientSize.height * ratio,
977
- });
978
- this._suggestNewBitmapSize(newSize);
979
- };
980
- // ResizeObserver approach
981
- DevicePixelContentBoxBinding.prototype._initResizeObserver = function () {
982
- var _this = this;
983
- if (this._canvasElement === null) {
984
- // it looks like we are already dead
985
- return;
986
- }
987
- this._canvasElementResizeObserver = new ResizeObserver(function (entries) {
988
- var entry = entries.find(function (entry) { return entry.target === _this._canvasElement; });
989
- if (!entry || !entry.devicePixelContentBoxSize || !entry.devicePixelContentBoxSize[0]) {
990
- return;
991
- }
992
- var entrySize = entry.devicePixelContentBoxSize[0];
993
- var newSize = size_size({
994
- width: entrySize.inlineSize,
995
- height: entrySize.blockSize,
996
- });
997
- _this._suggestNewBitmapSize(newSize);
998
- });
999
- this._canvasElementResizeObserver.observe(this._canvasElement, { box: 'device-pixel-content-box' });
1000
- };
1001
- return DevicePixelContentBoxBinding;
1002
- }());
1003
- function bindTo(canvasElement, target) {
1004
- if (target.type === 'device-pixel-content-box') {
1005
- return new canvas_element_bitmap_size_DevicePixelContentBoxBinding(canvasElement, target.transform, target.options);
1006
- }
1007
- throw new Error('Unsupported binding target');
1008
- }
1009
- function canvasElementWindow(canvasElement) {
1010
- // According to DOM Level 2 Core specification, ownerDocument should never be null for HTMLCanvasElement
1011
- // see https://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#node-ownerDoc
1012
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1013
- return canvasElement.ownerDocument.defaultView;
1014
- }
1015
- function isDevicePixelContentBoxSupported() {
1016
- return new Promise(function (resolve) {
1017
- var ro = new ResizeObserver(function (entries) {
1018
- resolve(entries.every(function (entry) { return 'devicePixelContentBoxSize' in entry; }));
1019
- ro.disconnect();
1020
- });
1021
- ro.observe(document.body, { box: 'device-pixel-content-box' });
1022
- })
1023
- .catch(function () { return false; });
1024
- }
1025
- function predictedBitmapSize(canvasRect, ratio) {
1026
- return size_size({
1027
- width: Math.round(canvasRect.left * ratio + canvasRect.width * ratio) -
1028
- Math.round(canvasRect.left * ratio),
1029
- height: Math.round(canvasRect.top * ratio + canvasRect.height * ratio) -
1030
- Math.round(canvasRect.top * ratio),
1031
- });
1032
- }
1033
-
1034
- ;// CONCATENATED MODULE: ../node_modules/fancy-canvas/canvas-rendering-target.mjs
1035
- /**
1036
- * @experimental
1037
- */
1038
- var canvas_rendering_target_CanvasRenderingTarget2D = /** @class */ (function () {
1039
- function CanvasRenderingTarget2D(context, mediaSize, bitmapSize) {
1040
- if (mediaSize.width === 0 || mediaSize.height === 0) {
1041
- throw new TypeError('Rendering target could only be created on a media with positive width and height');
1042
- }
1043
- this._mediaSize = mediaSize;
1044
- // !Number.isInteger(bitmapSize.width) || !Number.isInteger(bitmapSize.height)
1045
- if (bitmapSize.width === 0 || bitmapSize.height === 0) {
1046
- throw new TypeError('Rendering target could only be created using a bitmap with positive integer width and height');
1047
- }
1048
- this._bitmapSize = bitmapSize;
1049
- this._context = context;
1050
- }
1051
- CanvasRenderingTarget2D.prototype.useMediaCoordinateSpace = function (f) {
1052
- try {
1053
- this._context.save();
1054
- // do not use resetTransform to support old versions of Edge
1055
- this._context.setTransform(1, 0, 0, 1, 0, 0);
1056
- this._context.scale(this._horizontalPixelRatio, this._verticalPixelRatio);
1057
- return f({
1058
- context: this._context,
1059
- mediaSize: this._mediaSize,
1060
- });
1061
- }
1062
- finally {
1063
- this._context.restore();
1064
- }
1065
- };
1066
- CanvasRenderingTarget2D.prototype.useBitmapCoordinateSpace = function (f) {
1067
- try {
1068
- this._context.save();
1069
- // do not use resetTransform to support old versions of Edge
1070
- this._context.setTransform(1, 0, 0, 1, 0, 0);
1071
- return f({
1072
- context: this._context,
1073
- mediaSize: this._mediaSize,
1074
- bitmapSize: this._bitmapSize,
1075
- horizontalPixelRatio: this._horizontalPixelRatio,
1076
- verticalPixelRatio: this._verticalPixelRatio,
1077
- });
1078
- }
1079
- finally {
1080
- this._context.restore();
1081
- }
1082
- };
1083
- Object.defineProperty(CanvasRenderingTarget2D.prototype, "_horizontalPixelRatio", {
1084
- get: function () {
1085
- return this._bitmapSize.width / this._mediaSize.width;
1086
- },
1087
- enumerable: false,
1088
- configurable: true
1089
- });
1090
- Object.defineProperty(CanvasRenderingTarget2D.prototype, "_verticalPixelRatio", {
1091
- get: function () {
1092
- return this._bitmapSize.height / this._mediaSize.height;
1093
- },
1094
- enumerable: false,
1095
- configurable: true
1096
- });
1097
- return CanvasRenderingTarget2D;
1098
- }());
1099
-
1100
- /**
1101
- * @experimental
1102
- */
1103
- function createCanvasRenderingTarget2D(binding, contextOptions) {
1104
- var mediaSize = binding.canvasElementClientSize;
1105
- var bitmapSize = binding.bitmapSize;
1106
- var context = binding.canvasElement.getContext('2d', contextOptions);
1107
- if (context === null) {
1108
- throw new Error('Could not get 2d drawing context from bound canvas element. Has the canvas already been set to a different context mode?');
1109
- }
1110
- return new canvas_rendering_target_CanvasRenderingTarget2D(context, mediaSize, bitmapSize);
1111
- }
1112
- /**
1113
- * @experimental
1114
- */
1115
- function tryCreateCanvasRenderingTarget2D(binding, contextOptions) {
1116
- var mediaSize = binding.canvasElementClientSize;
1117
- if (mediaSize.width === 0 || mediaSize.height === 0) {
1118
- return null;
1119
- }
1120
- var bitmapSize = binding.bitmapSize;
1121
- if (bitmapSize.width === 0 || bitmapSize.height === 0) {
1122
- return null;
1123
- }
1124
- var context = binding.canvasElement.getContext('2d', contextOptions);
1125
- if (context === null) {
1126
- return null;
1127
- }
1128
- return new canvas_rendering_target_CanvasRenderingTarget2D(context, mediaSize, bitmapSize);
1129
- }
1130
-
1131
- ;// CONCATENATED MODULE: ../node_modules/fancy-canvas/index.mjs
1132
-
1133
-
1134
-
1135
-
1136
- ;// CONCATENATED MODULE: ../node_modules/lightweight-charts/dist/lightweight-charts.production.mjs
1137
- /*!
1138
- * @license
1139
- * TradingView Lightweight Charts™ v4.2.3
1140
- * Copyright (c) 2025 TradingView, Inc.
1141
- * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
1142
- */
1143
- const dist_lightweight_charts_production_e={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},lightweight_charts_production_r={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},lightweight_charts_production_h={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},lightweight_charts_production_l={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},lightweight_charts_production_a={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},lightweight_charts_production_o={color:"#26a69a",base:0},lightweight_charts_production_={color:"#2196f3"},lightweight_charts_production_u={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};var lightweight_charts_production_c,lightweight_charts_production_d;function lightweight_charts_production_f(t,i){const n={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[i];t.setLineDash(n)}function lightweight_charts_production_v(t,i,n,s){t.beginPath();const e=t.lineWidth%2?.5:0;t.moveTo(n,i+e),t.lineTo(s,i+e),t.stroke()}function lightweight_charts_production_p(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function lightweight_charts_production_m(t){if(void 0===t)throw new Error("Value is undefined");return t}function lightweight_charts_production_b(t){if(null===t)throw new Error("Value is null");return t}function lightweight_charts_production_w(t){return lightweight_charts_production_b(lightweight_charts_production_m(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved"}(lightweight_charts_production_c||(lightweight_charts_production_c={})),function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"}(lightweight_charts_production_d||(lightweight_charts_production_d={}));const lightweight_charts_production_g={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function lightweight_charts_production_M(t){return t<0?0:t>255?255:Math.round(t)||0}function lightweight_charts_production_x(t){return t<=0||t>1?Math.min(Math.max(t,0),1):Math.round(1e4*t)/1e4}const lightweight_charts_production_S=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,lightweight_charts_production_k=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,lightweight_charts_production_y=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,lightweight_charts_production_C=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function lightweight_charts_production_T(t){(t=t.toLowerCase())in lightweight_charts_production_g&&(t=lightweight_charts_production_g[t]);{const i=lightweight_charts_production_C.exec(t)||lightweight_charts_production_y.exec(t);if(i)return[lightweight_charts_production_M(parseInt(i[1],10)),lightweight_charts_production_M(parseInt(i[2],10)),lightweight_charts_production_M(parseInt(i[3],10)),lightweight_charts_production_x(i.length<5?1:parseFloat(i[4]))]}{const i=lightweight_charts_production_k.exec(t);if(i)return[lightweight_charts_production_M(parseInt(i[1],16)),lightweight_charts_production_M(parseInt(i[2],16)),lightweight_charts_production_M(parseInt(i[3],16)),1]}{const i=lightweight_charts_production_S.exec(t);if(i)return[lightweight_charts_production_M(17*parseInt(i[1],16)),lightweight_charts_production_M(17*parseInt(i[2],16)),lightweight_charts_production_M(17*parseInt(i[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function lightweight_charts_production_P(t){return.199*t[0]+.687*t[1]+.114*t[2]}function lightweight_charts_production_R(t){const i=lightweight_charts_production_T(t);return{t:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,i:lightweight_charts_production_P(i)>160?"black":"white"}}class lightweight_charts_production_D{constructor(){this.h=[]}l(t,i,n){const s={o:t,_:i,u:!0===n};this.h.push(s)}v(t){const i=this.h.findIndex((i=>t===i.o));i>-1&&this.h.splice(i,1)}p(t){this.h=this.h.filter((i=>i._!==t))}m(t,i,n){const s=[...this.h];this.h=this.h.filter((t=>!t.u)),s.forEach((s=>s.o(t,i,n)))}M(){return this.h.length>0}S(){this.h=[]}}function lightweight_charts_production_V(t,...i){for(const n of i)for(const i in n)void 0!==n[i]&&Object.prototype.hasOwnProperty.call(n,i)&&!["__proto__","constructor","prototype"].includes(i)&&("object"!=typeof n[i]||void 0===t[i]||Array.isArray(n[i])?t[i]=n[i]:lightweight_charts_production_V(t[i],n[i]));return t}function lightweight_charts_production_O(t){return"number"==typeof t&&isFinite(t)}function lightweight_charts_production_B(t){return"number"==typeof t&&t%1==0}function lightweight_charts_production_A(t){return"string"==typeof t}function lightweight_charts_production_I(t){return"boolean"==typeof t}function lightweight_charts_production_z(t){const i=t;if(!i||"object"!=typeof i)return i;let n,s,e;for(s in n=Array.isArray(i)?[]:{},i)i.hasOwnProperty(s)&&(e=i[s],n[s]=e&&"object"==typeof e?lightweight_charts_production_z(e):e);return n}function L(t){return null!==t}function E(t){return null===t?void 0:t}const N="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function F(t,i,n){return void 0===i&&(i=N),`${n=void 0!==n?`${n} `:""}${t}px ${i}`}class W{constructor(t){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=t}W(){const t=this.k,i=this.j(),n=this.H();return t.P===i&&t.D===n||(t.P=i,t.D=n,t.R=F(i,n),t.L=2.5/12*i,t.B=t.L,t.A=i/12*t.T,t.I=i/12*t.T,t.N=0),t.V=this.$(),t.O=this.U(),this.k}$(){return this.F.W().layout.textColor}U(){return this.F.q()}j(){return this.F.W().layout.fontSize}H(){return this.F.W().layout.fontFamily}}class j{constructor(){this.Y=[]}Z(t){this.Y=t}X(t,i,n){this.Y.forEach((s=>{s.X(t,i,n)}))}}class H{X(t,i,n){t.useBitmapCoordinateSpace((t=>this.K(t,i,n)))}}class $ extends H{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.G||null===this.G.tt)return;const s=this.G.tt,e=this.G,r=Math.max(1,Math.floor(i))%2/2,h=h=>{t.beginPath();for(let l=s.to-1;l>=s.from;--l){const s=e.it[l],a=Math.round(s.nt*i)+r,o=s.st*n,_=h*n+r;t.moveTo(a,o),t.arc(a,o,_,0,2*Math.PI)}t.fill()};e.et>0&&(t.fillStyle=e.rt,h(e.ht+e.et)),t.fillStyle=e.lt,h(e.ht)}}function U(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const q={from:0,to:1};class Y{constructor(t,i){this.ut=new j,this.ct=[],this.dt=[],this.ft=!0,this.F=t,this.vt=i,this.ut.Z(this.ct)}bt(t){const i=this.F.wt();i.length!==this.ct.length&&(this.dt=i.map(U),this.ct=this.dt.map((t=>{const i=new $;return i.J(t),i})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const t=2===this.vt.W().mode,i=this.F.wt(),n=this.vt.xt(),s=this.F.St();i.forEach(((i,e)=>{var r;const h=this.dt[e],l=i.kt(n);if(t||null===l||!i.yt())return void(h.tt=null);const a=lightweight_charts_production_b(i.Ct());h.lt=l.Tt,h.ht=l.ht,h.et=l.Pt,h.it[0]._t=l._t,h.it[0].st=i.Dt().Rt(l._t,a.Vt),h.rt=null!==(r=l.Ot)&&void 0!==r?r:this.F.Bt(h.it[0].st/i.Dt().At()),h.it[0].ot=n,h.it[0].nt=s.It(n),h.tt=q}))}}class Z extends H{constructor(t){super(),this.zt=t}K({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;const e=this.zt.Lt.yt,r=this.zt.Et.yt;if(!e&&!r)return;const h=Math.round(this.zt.nt*n),l=Math.round(this.zt.st*s);t.lineCap="butt",e&&h>=0&&(t.lineWidth=Math.floor(this.zt.Lt.et*n),t.strokeStyle=this.zt.Lt.V,t.fillStyle=this.zt.Lt.V,lightweight_charts_production_f(t,this.zt.Lt.Nt),function(t,i,n,s){t.beginPath();const e=t.lineWidth%2?.5:0;t.moveTo(i+e,n),t.lineTo(i+e,s),t.stroke()}(t,h,0,i.height)),r&&l>=0&&(t.lineWidth=Math.floor(this.zt.Et.et*s),t.strokeStyle=this.zt.Et.V,t.fillStyle=this.zt.Et.V,lightweight_charts_production_f(t,this.zt.Et.Nt),lightweight_charts_production_v(t,l,0,i.width))}}class X{constructor(t){this.ft=!0,this.Ft={Lt:{et:1,Nt:0,V:"",yt:!1},Et:{et:1,Nt:0,V:"",yt:!1},nt:0,st:0},this.Wt=new Z(this.Ft),this.jt=t}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const t=this.jt.yt(),i=lightweight_charts_production_b(this.jt.Ht()),n=i.$t().W().crosshair,s=this.Ft;if(2===n.mode)return s.Et.yt=!1,void(s.Lt.yt=!1);s.Et.yt=t&&this.jt.Ut(i),s.Lt.yt=t&&this.jt.qt(),s.Et.et=n.horzLine.width,s.Et.Nt=n.horzLine.style,s.Et.V=n.horzLine.color,s.Lt.et=n.vertLine.width,s.Lt.Nt=n.vertLine.style,s.Lt.V=n.vertLine.color,s.nt=this.jt.Yt(),s.st=this.jt.Zt()}}function K(t,i,n,s,e,r){t.fillRect(i+r,n,s-2*r,r),t.fillRect(i+r,n+e-r,s-2*r,r),t.fillRect(i,n,r,e),t.fillRect(i+s-r,n,r,e)}function G(t,i,n,s,e,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,n,s,e),t.restore()}function J(t,i,n,s,e,r){t.beginPath(),t.roundRect?t.roundRect(i,n,s,e,r):(t.lineTo(i+s-r[1],n),0!==r[1]&&t.arcTo(i+s,n,i+s,n+r[1],r[1]),t.lineTo(i+s,n+e-r[2]),0!==r[2]&&t.arcTo(i+s,n+e,i+s-r[2],n+e,r[2]),t.lineTo(i+r[3],n+e),0!==r[3]&&t.arcTo(i,n+e,i,n+e-r[3],r[3]),t.lineTo(i,n+r[0]),0!==r[0]&&t.arcTo(i,n,i+r[0],n,r[0]))}function Q(t,i,n,s,e,r,h=0,l=[0,0,0,0],a=""){if(t.save(),!h||!a||a===r)return J(t,i,n,s,e,l),t.fillStyle=r,t.fill(),void t.restore();const o=h/2;var _;J(t,i+o,n+o,s-h,e-h,(_=-o,l.map((t=>0===t?t:t+_)))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==a&&(t.lineWidth=h,t.strokeStyle=a,t.closePath(),t.stroke()),t.restore()}function tt(t,i,n,s,e,r,h){t.save(),t.globalCompositeOperation="copy";const l=t.createLinearGradient(0,0,0,e);l.addColorStop(0,r),l.addColorStop(1,h),t.fillStyle=l,t.fillRect(i,n,s,e),t.restore()}class it{constructor(t,i){this.J(t,i)}J(t,i){this.zt=t,this.Xt=i}At(t,i){return this.zt.yt?t.P+t.L+t.B:0}X(t,i,n,s){if(!this.zt.yt||0===this.zt.Kt.length)return;const e=this.zt.V,r=this.Xt.t,h=t.useBitmapCoordinateSpace((t=>{const h=t.context;h.font=i.R;const l=this.Gt(t,i,n,s),a=l.Jt;return l.Qt?Q(h,a.ti,a.ii,a.ni,a.si,r,a.ei,[a.ht,0,0,a.ht],r):Q(h,a.ri,a.ii,a.ni,a.si,r,a.ei,[0,a.ht,a.ht,0],r),this.zt.hi&&(h.fillStyle=e,h.fillRect(a.ri,a.li,a.ai-a.ri,a.oi)),this.zt._i&&(h.fillStyle=i.O,h.fillRect(l.Qt?a.ui-a.ei:0,a.ii,a.ei,a.ci-a.ii)),l}));t.useMediaCoordinateSpace((({context:t})=>{const n=h.di;t.font=i.R,t.textAlign=h.Qt?"right":"left",t.textBaseline="middle",t.fillStyle=e,t.fillText(this.zt.Kt,n.fi,(n.ii+n.ci)/2+n.pi)}))}Gt(t,i,n,s){var e;const{context:r,bitmapSize:h,mediaSize:l,horizontalPixelRatio:a,verticalPixelRatio:o}=t,_=this.zt.hi||!this.zt.mi?i.T:0,u=this.zt.bi?i.C:0,c=i.L+this.Xt.wi,d=i.B+this.Xt.gi,f=i.A,v=i.I,p=this.zt.Kt,m=i.P,b=n.Mi(r,p),w=Math.ceil(n.xi(r,p)),g=m+c+d,M=i.C+f+v+w+_,x=Math.max(1,Math.floor(o));let S=Math.round(g*o);S%2!=x%2&&(S+=1);const k=u>0?Math.max(1,Math.floor(u*a)):0,y=Math.round(M*a),C=Math.round(_*a),T=null!==(e=this.Xt.Si)&&void 0!==e?e:this.Xt.ki,P=Math.round(T*o)-Math.floor(.5*o),R=Math.floor(P+x/2-S/2),D=R+S,V="right"===s,O=V?l.width-u:u,B=V?h.width-k:k;let A,I,z;return V?(A=B-y,I=B-C,z=O-_-f-u):(A=B+y,I=B+C,z=O+_+f),{Qt:V,Jt:{ii:R,li:P,ci:D,ni:y,si:S,ht:2*a,ei:k,ti:A,ri:B,ai:I,oi:x,ui:h.width},di:{ii:R/o,ci:D/o,fi:z,pi:b}}}}class nt{constructor(t){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Kt:"",yt:!1,hi:!0,mi:!1,Ot:"",V:"#FFF",_i:!1,bi:!1},this.Ti={Kt:"",yt:!1,hi:!1,mi:!0,Ot:"",V:"#FFF",_i:!0,bi:!0},this.ft=!0,this.Pi=new(t||it)(this.Ci,this.yi),this.Ri=new(t||it)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(t,i=!1){return Math.max(this.Pi.At(t,i),this.Ri.At(t,i))}Vi(){return this.yi.Si||0}Oi(t){this.yi.Si=t}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(t){return this.Di(),this.Ci.hi=this.Ci.hi&&t.W().ticksVisible,this.Ti.hi=this.Ti.hi&&t.W().ticksVisible,this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Pi}Ii(){return this.Di(),this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Ri}Di(){this.ft&&(this.Ci.hi=!0,this.Ti.hi=!1,this.zi(this.Ci,this.Ti,this.yi))}}class st extends nt{constructor(t,i,n){super(),this.jt=t,this.Li=i,this.Ei=n}zi(t,i,n){if(t.yt=!1,2===this.jt.W().mode)return;const s=this.jt.W().horzLine;if(!s.labelVisible)return;const e=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||null===e)return;const r=lightweight_charts_production_R(s.labelBackgroundColor);n.t=r.t,t.V=r.i;const h=2/12*this.Li.P();n.wi=h,n.gi=h;const l=this.Ei(this.Li);n.ki=l.ki,t.Kt=this.Li.Fi(l._t,e),t.yt=!0}}const et=/[1-9]/g;class rt{constructor(){this.zt=null}J(t){this.zt=t}X(t,i){if(null===this.zt||!1===this.zt.yt||0===this.zt.Kt.length)return;const n=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.R,Math.round(i.Wi.xi(t,lightweight_charts_production_b(this.zt).Kt,et)))));if(n<=0)return;const s=i.ji,e=n+2*s,r=e/2,h=this.zt.Hi;let l=this.zt.ki,a=Math.floor(l-r)+.5;a<0?(l+=Math.abs(0-a),a=Math.floor(l-r)+.5):a+e>h&&(l-=Math.abs(h-(a+e)),a=Math.floor(l-r)+.5);const o=a+e,_=Math.ceil(0+i.C+i.T+i.L+i.P+i.B);t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:n,verticalPixelRatio:s})=>{const e=lightweight_charts_production_b(this.zt);t.fillStyle=e.t;const r=Math.round(a*n),h=Math.round(0*s),l=Math.round(o*n),u=Math.round(_*s),c=Math.round(2*n);if(t.beginPath(),t.moveTo(r,h),t.lineTo(r,u-c),t.arcTo(r,u,r+c,u,c),t.lineTo(l-c,u),t.arcTo(l,u,l,u-c,c),t.lineTo(l,h),t.fill(),e.hi){const r=Math.round(e.ki*n),l=h,a=Math.round((l+i.T)*s);t.fillStyle=e.V;const o=Math.max(1,Math.floor(n)),_=Math.floor(.5*n);t.fillRect(r-_,l,o,a-l)}})),t.useMediaCoordinateSpace((({context:t})=>{const n=lightweight_charts_production_b(this.zt),e=0+i.C+i.T+i.L+i.P/2;t.font=i.R,t.textAlign="left",t.textBaseline="middle",t.fillStyle=n.V;const r=i.Wi.Mi(t,"Apr0");t.translate(a+s,e+r),t.fillText(n.Kt,0,0)}))}}class ht{constructor(t,i,n){this.ft=!0,this.Wt=new rt,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=t,this.$i=i,this.Ei=n}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const t=this.Ft;if(t.yt=!1,2===this.vt.W().mode)return;const i=this.vt.W().vertLine;if(!i.labelVisible)return;const n=this.$i.St();if(n.Ni())return;t.Hi=n.Hi();const s=this.Ei();if(null===s)return;t.ki=s.ki;const e=n.Ui(this.vt.xt());t.Kt=n.qi(lightweight_charts_production_b(e)),t.yt=!0;const r=lightweight_charts_production_R(i.labelBackgroundColor);t.t=r.t,t.V=r.i,t.hi=n.W().ticksVisible}}class lt{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(t){this.Zi=t}Dt(){return this.Yi}Gi(t){this.Yi=t}Ji(t){return[]}Qi(){return[]}yt(){return!0}}var at;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden"}(at||(at={}));class ot extends lt{constructor(t,i){super(),this.tn=null,this.nn=NaN,this.sn=0,this.en=!0,this.rn=new Map,this.hn=!1,this.ln=NaN,this.an=NaN,this._n=NaN,this.un=NaN,this.$i=t,this.cn=i,this.dn=new Y(t,this);this.fn=((t,i)=>n=>{const s=i(),e=t();if(n===lightweight_charts_production_b(this.tn).vn())return{_t:e,ki:s};{const t=lightweight_charts_production_b(n.Ct());return{_t:n.pn(s,t),ki:s}}})((()=>this.nn),(()=>this.an));const n=((t,i)=>()=>{const n=this.$i.St().mn(t()),s=i();return n&&Number.isFinite(s)?{ot:n,ki:s}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new ht(this,t,n),this.wn=new X(this)}W(){return this.cn}gn(t,i){this._n=t,this.un=i}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(t,i,n){this.hn||(this.hn=!0),this.en=!0,this.yn(t,i,n)}xt(){return this.sn}Yt(){return this.ln}Zt(){return this.an}yt(){return this.en}Cn(){this.en=!1,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn()}Pn(t){return null!==this.tn?[this.wn,this.dn]:[]}Ut(t){return t===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(t,i){this.en&&this.tn===t||this.rn.clear();const n=[];return this.tn===t&&n.push(this.Dn(this.rn,i,this.fn)),n}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach((t=>t.bt())),this.bn.bt(),this.dn.bt()}On(t){return t&&!t.vn().Ni()?t.vn():null}yn(t,i,n){this.Bn(t,i,n)&&this.Vn()}Bn(t,i,n){const s=this.ln,e=this.an,r=this.nn,h=this.sn,l=this.tn,a=this.On(n);this.sn=t,this.ln=isNaN(t)?NaN:this.$i.St().It(t),this.tn=n;const o=null!==a?a.Ct():null;return null!==a&&null!==o?(this.nn=i,this.an=a.Rt(i,o)):(this.nn=NaN,this.an=NaN),s!==this.ln||e!==this.an||h!==this.sn||r!==this.nn||l!==this.tn}Tn(){const t=this.$i.wt().map((t=>t.In().An())).filter(L),i=0===t.length?null:Math.max(...t);this.sn=null!==i?i:NaN}Dn(t,i,n){let s=t.get(i);return void 0===s&&(s=new st(this,i,n),t.set(i,s)),s}}function _t(t){return"left"===t||"right"===t}class ut{constructor(t){this.zn=new Map,this.Ln=[],this.En=t}Nn(t,i){const n=function(t,i){return void 0===t?i:{Fn:Math.max(t.Fn,i.Fn),Wn:t.Wn||i.Wn}}(this.zn.get(t),i);this.zn.set(t,n)}jn(){return this.En}Hn(t){const i=this.zn.get(t);return void 0===i?{Fn:this.En}:{Fn:Math.max(this.En,i.Fn),Wn:i.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(t){this.Un(),this.Ln=[{qn:1,Vt:t}]}Zn(t){this.Xn(),this.Ln.push({qn:5,Vt:t})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(t){this.Un(),this.Ln.push({qn:2,Vt:t})}Jn(t){this.Un(),this.Ln.push({qn:3,Vt:t})}Qn(){return this.Ln}ts(t){for(const i of t.Ln)this.ns(i);this.En=Math.max(this.En,t.En),t.zn.forEach(((t,i)=>{this.Nn(i,t)}))}static ss(){return new ut(2)}static es(){return new ut(3)}ns(t){switch(t.qn){case 0:this.$n();break;case 1:this.Yn(t.Vt);break;case 2:this.Gn(t.Vt);break;case 3:this.Jn(t.Vt);break;case 4:this.Kn();break;case 5:this.Zn(t.Vt);break;case 6:this.Xn()}}Xn(){const t=this.Ln.findIndex((t=>5===t.qn));-1!==t&&this.Ln.splice(t,1)}}const ct=".";function dt(t,i){if(!lightweight_charts_production_O(t))return"n/a";if(!lightweight_charts_production_B(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");if(0===i)return t.toString();return("0000000000000000"+t.toString()).slice(-i)}class ft{constructor(t,i){if(i||(i=1),lightweight_charts_production_O(t)&&lightweight_charts_production_B(t)||(t=100),t<0)throw new TypeError("invalid base");this.Li=t,this.rs=i,this.hs()}format(t){const i=t<0?"−":"";return t=Math.abs(t),i+this.ls(t)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let t=this.Li;for(;t>1;)t/=10,this._s++}}ls(t){const i=this.Li/this.rs;let n=Math.floor(t),s="";const e=void 0!==this._s?this._s:NaN;if(i>1){let r=+(Math.round(t*i)-n*i).toFixed(this._s);r>=i&&(r-=i,n+=1),s=ct+dt(+r.toFixed(this._s)*this.rs,e)}else n=Math.round(n*i)/i,e>0&&(s=ct+dt(0,e));return n.toFixed(0)+s}}class vt extends ft{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class pt{constructor(t){this.us=t}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.cs(t):t<999995?i+this.cs(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this.cs(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.cs(t/1e9)+"B")}cs(t){let i;const n=Math.pow(10,this.us);return i=(t=Math.round(t*n)/n)>=1e-15&&t<1?t.toFixed(this.us).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}function mt(t,i,n,s,e,r,h){if(0===i.length||s.from>=i.length||s.to<=0)return;const{context:l,horizontalPixelRatio:a,verticalPixelRatio:o}=t,_=i[s.from];let u=r(t,_),c=_;if(s.to-s.from<2){const i=e/2;l.beginPath();const n={nt:_.nt-i,st:_.st},s={nt:_.nt+i,st:_.st};l.moveTo(n.nt*a,n.st*o),l.lineTo(s.nt*a,s.st*o),h(t,u,n,s)}else{const e=(i,n)=>{h(t,u,c,n),l.beginPath(),u=i,c=n};let d=c;l.beginPath(),l.moveTo(_.nt*a,_.st*o);for(let h=s.from+1;h<s.to;++h){d=i[h];const s=r(t,d);switch(n){case 0:l.lineTo(d.nt*a,d.st*o);break;case 1:l.lineTo(d.nt*a,i[h-1].st*o),s!==u&&(e(s,d),l.lineTo(d.nt*a,i[h-1].st*o)),l.lineTo(d.nt*a,d.st*o);break;case 2:{const[t,n]=Mt(i,h-1,h);l.bezierCurveTo(t.nt*a,t.st*o,n.nt*a,n.st*o,d.nt*a,d.st*o);break}}1!==n&&s!==u&&(e(s,d),l.moveTo(d.nt*a,d.st*o))}(c!==d||c===d&&1===n)&&h(t,u,c,d)}}const bt=6;function wt(t,i){return{nt:t.nt-i.nt,st:t.st-i.st}}function gt(t,i){return{nt:t.nt/i,st:t.st/i}}function Mt(t,i,n){const s=Math.max(0,i-1),e=Math.min(t.length-1,n+1);var r,h;return[(r=t[i],h=gt(wt(t[n],t[s]),bt),{nt:r.nt+h.nt,st:r.st+h.st}),wt(t[n],gt(wt(t[e],t[i]),bt))]}function xt(t,i,n,s,e){const{context:r,horizontalPixelRatio:h,verticalPixelRatio:l}=i;r.lineTo(e.nt*h,t*l),r.lineTo(s.nt*h,t*l),r.closePath(),r.fillStyle=n,r.fill()}class St extends H{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K(t){var i;if(null===this.G)return;const{it:n,tt:s,ds:e,et:r,Nt:h,fs:l}=this.G,a=null!==(i=this.G.vs)&&void 0!==i?i:this.G.ps?0:t.mediaSize.height;if(null===s)return;const o=t.context;o.lineCap="butt",o.lineJoin="round",o.lineWidth=r,lightweight_charts_production_f(o,h),o.lineWidth=1,mt(t,n,l,s,e,this.bs.bind(this),xt.bind(null,a))}}function kt(t,i,n){return Math.min(Math.max(t,i),n)}function yt(t,i,n){return i-t<=n}function Ct(t){const i=Math.ceil(t);return i%2==0?i-1:i}class Tt{ws(t,i){const n=this.gs,{Ms:s,xs:e,Ss:r,ks:h,ys:l,vs:a}=i;if(void 0===this.Cs||void 0===n||n.Ms!==s||n.xs!==e||n.Ss!==r||n.ks!==h||n.vs!==a||n.ys!==l){const n=t.context.createLinearGradient(0,0,0,l);if(n.addColorStop(0,s),null!=a){const i=kt(a*t.verticalPixelRatio/l,0,1);n.addColorStop(i,e),n.addColorStop(i,r)}n.addColorStop(1,h),this.Cs=n,this.gs=i}return this.Cs}}class Pt extends St{constructor(){super(...arguments),this.Ts=new Tt}bs(t,i){return this.Ts.ws(t,{Ms:i.Ps,xs:"",Ss:"",ks:i.Rs,ys:t.bitmapSize.height})}}function Rt(t,i){const n=t.context;n.strokeStyle=i,n.stroke()}class Dt extends H{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K(t){if(null===this.G)return;const{it:i,tt:n,ds:s,fs:e,et:r,Nt:h,Ds:l}=this.G;if(null===n)return;const a=t.context;a.lineCap="butt",a.lineWidth=r*t.verticalPixelRatio,lightweight_charts_production_f(a,h),a.lineJoin="round";const o=this.Vs.bind(this);void 0!==e&&mt(t,i,e,n,s,o,Rt),l&&function(t,i,n,s,e){const{horizontalPixelRatio:r,verticalPixelRatio:h,context:l}=t;let a=null;const o=Math.max(1,Math.floor(r))%2/2,_=n*h+o;for(let n=s.to-1;n>=s.from;--n){const s=i[n];if(s){const i=e(t,s);i!==a&&(l.beginPath(),null!==a&&l.fill(),l.fillStyle=i,a=i);const n=Math.round(s.nt*r)+o,u=s.st*h;l.moveTo(n,u),l.arc(n,u,_,0,2*Math.PI)}}l.fill()}(t,i,l,n,o)}}class Vt extends Dt{Vs(t,i){return i.lt}}function Ot(t,i,n,s,e=0,r=i.length){let h=r-e;for(;0<h;){const r=h>>1,l=e+r;s(i[l],n)===t?(e=l+1,h-=r+1):h=r}return e}const Bt=Ot.bind(null,!0),At=Ot.bind(null,!1);function It(t,i){return t.ot<i}function zt(t,i){return i<t.ot}function Lt(t,i,n){const s=i.Os(),e=i.ui(),r=Bt(t,s,It),h=At(t,e,zt);if(!n)return{from:r,to:h};let l=r,a=h;return r>0&&r<t.length&&t[r].ot>=s&&(l=r-1),h>0&&h<t.length&&t[h-1].ot<=e&&(a=h+1),{from:l,to:a}}class Et{constructor(t,i,n){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=t,this.Ns=i,this.Fs=n}bt(t){this.Bs=!0,"data"===t&&(this.As=!0),"options"===t&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),null===this.Ls?null:this.js):null}Hs(){this.zs=this.zs.map((t=>Object.assign(Object.assign({},t),this.Es.Us().$s(t.ot))))}qs(){this.Ls=null}Ws(){this.As&&(this.Ys(),this.As=!1),this.Is&&(this.Hs(),this.Is=!1),this.Bs&&(this.Zs(),this.Bs=!1)}Zs(){const t=this.Es.Dt(),i=this.Ns.St();if(this.qs(),i.Ni()||t.Ni())return;const n=i.Xs();if(null===n)return;if(0===this.Es.In().Ks())return;const s=this.Es.Ct();null!==s&&(this.Ls=Lt(this.zs,n,this.Fs),this.Gs(t,i,s.Vt),this.Js())}}class Nt extends Et{constructor(t,i){super(t,i,!0)}Gs(t,i,n){i.Qs(this.zs,E(this.Ls)),t.te(this.zs,n,E(this.Ls))}ie(t,i){return{ot:t,_t:i,nt:NaN,st:NaN}}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map((i=>{const n=i.Vt[3];return this.se(i.ee,n,t)}))}}class Ft extends Nt{constructor(t,i){super(t,i),this.js=new j,this.re=new Pt,this.he=new Vt,this.js.Z([this.re,this.he])}se(t,i,n){return Object.assign(Object.assign({},this.ie(t,i)),n.$s(t))}Js(){const t=this.Es.W();this.re.J({fs:t.lineType,it:this.zs,Nt:t.lineStyle,et:t.lineWidth,vs:null,ps:t.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:t.lineVisible?t.lineType:void 0,it:this.zs,Nt:t.lineStyle,et:t.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0})}}class Wt extends H{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(t){this.zt=t}K({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;if(this.ae=this._e(i),this.ae>=2){Math.max(1,Math.floor(i))%2!=this.ae%2&&this.ae--}this.oe=this.zt.ue?Math.min(this.ae,Math.floor(i)):this.ae;let s=null;const e=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*i);for(let r=this.zt.tt.from;r<this.zt.tt.to;++r){const h=this.zt.In[r];s!==h.ce&&(t.fillStyle=h.ce,s=h.ce);const l=Math.floor(.5*this.oe),a=Math.round(h.nt*i),o=a-l,_=this.oe,u=o+_-1,c=Math.min(h.de,h.fe),d=Math.max(h.de,h.fe),f=Math.round(c*n)-l,v=Math.round(d*n)+l,p=Math.max(v-f,this.oe);t.fillRect(o,f,_,p);const m=Math.ceil(1.5*this.ae);if(e){if(this.zt.ve){const i=a-m;let s=Math.max(f,Math.round(h.pe*n)-l),e=s+_-1;e>f+p-1&&(e=f+p-1,s=e-_+1),t.fillRect(i,s,o-i,e-s+1)}const i=a+m;let s=Math.max(f,Math.round(h.me*n)-l),e=s+_-1;e>f+p-1&&(e=f+p-1,s=e-_+1),t.fillRect(u+1,s,i-u,e-s+1)}}}_e(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(lightweight_charts_production_b(this.zt).le,t)))}}class jt extends Et{constructor(t,i){super(t,i,!1)}Gs(t,i,n){i.Qs(this.zs,E(this.Ls)),t.be(this.zs,n,E(this.Ls))}we(t,i,n){return{ot:t,ge:i.Vt[0],Me:i.Vt[1],xe:i.Vt[2],Se:i.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map((i=>this.se(i.ee,i,t)))}}class Ht extends jt{constructor(){super(...arguments),this.js=new Wt}se(t,i,n){return Object.assign(Object.assign({},this.we(t,i,n)),n.$s(t))}Js(){const t=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:t.openVisible,ue:t.thinBars,tt:this.Ls})}}class $t extends St{constructor(){super(...arguments),this.Ts=new Tt}bs(t,i){const n=this.G;return this.Ts.ws(t,{Ms:i.ke,xs:i.ye,Ss:i.Ce,ks:i.Te,ys:t.bitmapSize.height,vs:n.vs})}}class Ut extends Dt{constructor(){super(...arguments),this.Pe=new Tt}Vs(t,i){const n=this.G;return this.Pe.ws(t,{Ms:i.Re,xs:i.Re,Ss:i.De,ks:i.De,ys:t.bitmapSize.height,vs:n.vs})}}class qt extends Nt{constructor(t,i){super(t,i),this.js=new j,this.Ve=new $t,this.Oe=new Ut,this.js.Z([this.Ve,this.Oe])}se(t,i,n){return Object.assign(Object.assign({},this.ie(t,i)),n.$s(t))}Js(){const t=this.Es.Ct();if(null===t)return;const i=this.Es.W(),n=this.Es.Dt().Rt(i.baseValue.price,t.Vt),s=this.Ns.St().le();this.Ve.J({it:this.zs,et:i.lineWidth,Nt:i.lineStyle,fs:i.lineType,vs:n,ps:!1,tt:this.Ls,ds:s}),this.Oe.J({it:this.zs,et:i.lineWidth,Nt:i.lineStyle,fs:i.lineVisible?i.lineType:void 0,Ds:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0,vs:n,tt:this.Ls,ds:s})}}class Yt extends H{constructor(){super(...arguments),this.zt=null,this.ae=0}J(t){this.zt=t}K(t){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;const{horizontalPixelRatio:i}=t;if(this.ae=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);const n=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.floor(t*n*i),e=Math.floor(t*i),r=Math.min(s,e);return Math.max(Math.floor(i),r)}(this.zt.le,i),this.ae>=2){Math.floor(i)%2!=this.ae%2&&this.ae--}const n=this.zt.In;this.zt.Be&&this.Ae(t,n,this.zt.tt),this.zt._i&&this.Ie(t,n,this.zt.tt);const s=this.ze(i);(!this.zt._i||this.ae>2*s)&&this.Le(t,n,this.zt.tt)}Ae(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="",l=Math.min(Math.floor(e),Math.floor(this.zt.le*e));l=Math.max(Math.floor(e),Math.min(l,this.ae));const a=Math.floor(.5*l);let o=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Ee!==h&&(s.fillStyle=n.Ee,h=n.Ee);const _=Math.round(Math.min(n.pe,n.me)*r),u=Math.round(Math.max(n.pe,n.me)*r),c=Math.round(n.de*r),d=Math.round(n.fe*r);let f=Math.round(e*n.nt)-a;const v=f+l-1;null!==o&&(f=Math.max(o+1,f),f=Math.min(f,v));const p=v-f+1;s.fillRect(f,c,p,_-c),s.fillRect(f,u+1,p,d-u),o=v}}ze(t){let i=Math.floor(1*t);this.ae<=2*i&&(i=Math.floor(.5*(this.ae-1)));const n=Math.max(Math.floor(t),i);return this.ae<=2*n?Math.max(Math.floor(t),Math.floor(1*t)):n}Ie(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.ze(e);let a=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Ne!==h&&(s.fillStyle=n.Ne,h=n.Ne);let o=Math.round(n.nt*e)-Math.floor(.5*this.ae);const _=o+this.ae-1,u=Math.round(Math.min(n.pe,n.me)*r),c=Math.round(Math.max(n.pe,n.me)*r);if(null!==a&&(o=Math.max(a+1,o),o=Math.min(o,_)),this.zt.le*e>2*l)K(s,o,u,_-o+1,c-u+1,l);else{const t=_-o+1;s.fillRect(o,u,t,c-u+1)}a=_}}Le(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.ze(e);for(let t=n.from;t<n.to;t++){const n=i[t];let a=Math.round(Math.min(n.pe,n.me)*r),o=Math.round(Math.max(n.pe,n.me)*r),_=Math.round(n.nt*e)-Math.floor(.5*this.ae),u=_+this.ae-1;if(n.ce!==h){const t=n.ce;s.fillStyle=t,h=t}this.zt._i&&(_+=l,a+=l,u-=l,o-=l),a>o||s.fillRect(_,a,u-_+1,o-a+1)}}}class Zt extends jt{constructor(){super(...arguments),this.js=new Yt}se(t,i,n){return Object.assign(Object.assign({},this.we(t,i,n)),n.$s(t))}Js(){const t=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:t.wickVisible,_i:t.borderVisible,tt:this.Ls})}}class Xt{constructor(t,i){this.Fe=t,this.Li=i}X(t,i,n){this.Fe.draw(t,this.Li,i,n)}}class Kt extends Et{constructor(t,i,n){super(t,i,!1),this.wn=n,this.js=new Xt(this.wn.renderer(),(i=>{const n=t.Ct();return null===n?null:t.Dt().Rt(i,n.Vt)}))}We(t){return this.wn.priceValueBuilder(t)}je(t){return this.wn.isWhitespace(t)}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map((i=>Object.assign(Object.assign({ot:i.ee,nt:NaN},t.$s(i.ee)),{He:i.$e})))}Gs(t,i){i.Qs(this.zs,E(this.Ls))}Js(){this.wn.update({bars:this.zs.map(Gt),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function Gt(t){return{x:t.nt,time:t.ot,originalData:t.He,barColor:t.ce}}class Jt extends H{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(t){this.zt=t,this.Ue=[]}K({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return;this.Ue.length||this.qe(i);const s=Math.max(1,Math.floor(n)),e=Math.round(this.zt.Ye*n)-Math.floor(s/2),r=e+s;for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const h=this.zt.it[i],l=this.Ue[i-this.zt.tt.from],a=Math.round(h.st*n);let o,_;t.fillStyle=h.ce,a<=e?(o=a,_=r):(o=e,_=a-Math.floor(s/2)+s),t.fillRect(l.Os,o,l.ui-l.Os+1,_-o)}}qe(t){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return void(this.Ue=[]);const i=Math.ceil(this.zt.le*t)<=1?0:Math.max(1,Math.floor(t)),n=Math.round(this.zt.le*t)-i;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const s=this.zt.it[i],e=Math.round(s.nt*t);let r,h;if(n%2){const t=(n-1)/2;r=e-t,h=e+t}else{const t=n/2;r=e-t,h=e+t-1}this.Ue[i-this.zt.tt.from]={Os:r,ui:h,Ze:e,Xe:s.nt*t,ot:s.ot}}for(let t=this.zt.tt.from+1;t<this.zt.tt.to;t++){const n=this.Ue[t-this.zt.tt.from],s=this.Ue[t-this.zt.tt.from-1];n.ot===s.ot+1&&(n.Os-s.ui!==i+1&&(s.Ze>s.Xe?s.ui=n.Os-i-1:n.Os=s.ui+i+1))}let s=Math.ceil(this.zt.le*t);for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.Ue[t-this.zt.tt.from];i.ui<i.Os&&(i.ui=i.Os);const n=i.ui-i.Os+1;s=Math.min(n,s)}if(i>0&&s<4)for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.Ue[t-this.zt.tt.from];i.ui-i.Os+1>s&&(i.Ze>i.Xe?i.ui-=1:i.Os+=1)}}}class Qt extends Nt{constructor(){super(...arguments),this.js=new Jt}se(t,i,n){return Object.assign(Object.assign({},this.ie(t,i)),n.$s(t))}Js(){const t={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,lightweight_charts_production_b(this.Es.Ct()).Vt)};this.js.J(t)}}class ti extends Nt{constructor(){super(...arguments),this.js=new Vt}se(t,i,n){return Object.assign(Object.assign({},this.ie(t,i)),n.$s(t))}Js(){const t=this.Es.W(),i={it:this.zs,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,et:t.lineWidth,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(i)}}const ii=/[2-9]/g;class ni{constructor(t=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=t}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(t,i,n){return this.sr(t,i,n).width}Mi(t,i,n){const s=this.sr(t,i,n);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}sr(t,i,n){const s=n||ii,e=String(i).replace(s,"0");if(this.tr.has(e))return lightweight_charts_production_m(this.tr.get(e)).er;if(this.Ke===this.ir){const t=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(t),this.Je++,this.Ke--}t.save(),t.textBaseline="middle";const r=t.measureText(e);return t.restore(),0===r.width&&i.length||(this.tr.set(e,{er:r,rr:this.Ge}),this.Qe[this.Ge]=e,this.Ke++,this.Ge++),r}}class si{constructor(t){this.hr=null,this.k=null,this.lr="right",this.ar=t}_r(t,i,n){this.hr=t,this.k=i,this.lr=n}X(t){null!==this.k&&null!==this.hr&&this.hr.X(t,this.k,this.ar,this.lr)}}class ei{constructor(t,i,n){this.ur=t,this.ar=new ni(50),this.cr=i,this.F=n,this.j=-1,this.Wt=new si(this.ar)}gt(){const t=this.F.dr(this.cr);if(null===t)return null;const i=t.vr(this.cr)?t.pr():this.cr.Dt();if(null===i)return null;const n=t.mr(i);if("overlay"===n)return null;const s=this.F.br();return s.P!==this.j&&(this.j=s.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),s,n),this.Wt}}class ri extends H{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}wr(t,i){var n;if(!(null===(n=this.zt)||void 0===n?void 0:n.yt))return null;const{st:s,et:e,gr:r}=this.zt;return i>=s-e-7&&i<=s+e+7?{Mr:this.zt,gr:r}:null}K({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;if(!1===this.zt.yt)return;const e=Math.round(this.zt.st*s);e<0||e>i.height||(t.lineCap="butt",t.strokeStyle=this.zt.V,t.lineWidth=Math.floor(this.zt.et*n),lightweight_charts_production_f(t,this.zt.Nt),lightweight_charts_production_v(t,e,0,i.width))}}class hi{constructor(t){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new ri,this.ft=!0,this.Es=t,this.Ns=t.$t(),this.kr.J(this.Sr)}bt(){this.ft=!0}gt(){return this.Es.yt()?(this.ft&&(this.yr(),this.ft=!1),this.kr):null}}class li extends hi{constructor(t){super(t)}yr(){this.Sr.yt=!1;const t=this.Es.Dt(),i=t.Cr().Cr;if(2!==i&&3!==i)return;const n=this.Es.W();if(!n.baseLineVisible||!this.Es.yt())return;const s=this.Es.Ct();null!==s&&(this.Sr.yt=!0,this.Sr.st=t.Rt(s.Vt,s.Vt),this.Sr.V=n.baseLineColor,this.Sr.et=n.baseLineWidth,this.Sr.Nt=n.baseLineStyle)}}class ai extends H{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}$e(){return this.zt}K({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){const s=this.zt;if(null===s)return;const e=Math.max(1,Math.floor(i)),r=e%2/2,h=Math.round(s.Xe.x*i)+r,l=s.Xe.y*n;t.fillStyle=s.Tr,t.beginPath();const a=Math.max(2,1.5*s.Pr)*i;t.arc(h,l,a,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.Rr,t.beginPath(),t.arc(h,l,s.ht*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=e,t.strokeStyle=s.Dr,t.beginPath(),t.arc(h,l,s.ht*i+e/2,0,2*Math.PI,!1),t.stroke()}}const oi=[{Vr:0,Or:.25,Br:4,Ar:10,Ir:.25,zr:0,Lr:.4,Er:.8},{Vr:.25,Or:.525,Br:10,Ar:14,Ir:0,zr:0,Lr:.8,Er:0},{Vr:.525,Or:1,Br:14,Ar:14,Ir:0,zr:0,Lr:0,Er:0}];function lightweight_charts_production_i(t,i,n,s){return function(t,i){if("transparent"===t)return t;const n=lightweight_charts_production_T(t),s=n[3];return`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i*s})`}(t,n+(s-n)*i)}function ui(t,i){const n=t%2600/2600;let s;for(const t of oi)if(n>=t.Vr&&n<=t.Or){s=t;break}lightweight_charts_production_p(void 0!==s,"Last price animation internal logic error");const e=(n-s.Vr)/(s.Or-s.Vr);return{Rr:lightweight_charts_production_i(i,e,s.Ir,s.zr),Dr:lightweight_charts_production_i(i,e,s.Lr,s.Er),ht:(r=e,h=s.Br,l=s.Ar,h+(l-h)*r)};var r,h,l}class ci{constructor(t){this.Wt=new ai,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=t}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),2===this.jr.W().lastPriceAnimation){const t=performance.now(),i=this.Wr-t;if(i>0)return void(i<650&&(this.Wr+=2600));this.Fr=t,this.Wr=t+2600}}bt(){this.ft=!0}Ur(){this.Nr=!0}yt(){return 0!==this.jr.W().lastPriceAnimation}qr(){switch(this.jr.W().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.Wr}}gt(){return this.ft?(this.Mt(),this.ft=!1,this.Nr=!1):this.Nr&&(this.Yr(),this.Nr=!1),this.Wt}Mt(){this.Wt.J(null);const t=this.jr.$t().St(),i=t.Xs(),n=this.jr.Ct();if(null===i||null===n)return;const s=this.jr.Zr(!0);if(s.Xr||!i.Kr(s.ee))return;const e={x:t.It(s.ee),y:this.jr.Dt().Rt(s._t,n.Vt)},r=s.V,h=this.jr.W().lineWidth,l=ui(this.Gr(),r);this.Wt.J({Tr:r,Pr:h,Rr:l.Rr,Dr:l.Dr,ht:l.ht,Xe:e})}Yr(){const t=this.Wt.$e();if(null!==t){const i=ui(this.Gr(),t.Tr);t.Rr=i.Rr,t.Dr=i.Dr,t.ht=i.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function di(t,i){return Ct(Math.min(Math.max(t,12),30)*i)}function fi(t,i){switch(t){case"arrowDown":case"arrowUp":return di(i,1);case"circle":return di(i,.8);case"square":return di(i,.7)}}function vi(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(di(t,1))}function pi(t){return Math.max(di(t,.1),3)}function mi(t,i,n){return i?t:n?Math.ceil(t/2):0}function bi(t,i,n,s,e){const r=fi("square",n),h=(r-1)/2,l=t-h,a=i-h;return s>=l&&s<=l+r&&e>=a&&e<=a+r}function wi(t,i,n,s){const e=(fi("arrowUp",s)-1)/2*n.Jr,r=(Ct(s/2)-1)/2*n.Jr;i.beginPath(),t?(i.moveTo(n.nt-e,n.st),i.lineTo(n.nt,n.st-e),i.lineTo(n.nt+e,n.st),i.lineTo(n.nt+r,n.st),i.lineTo(n.nt+r,n.st+e),i.lineTo(n.nt-r,n.st+e),i.lineTo(n.nt-r,n.st)):(i.moveTo(n.nt-e,n.st),i.lineTo(n.nt,n.st+e),i.lineTo(n.nt+e,n.st),i.lineTo(n.nt+r,n.st),i.lineTo(n.nt+r,n.st-e),i.lineTo(n.nt-r,n.st-e),i.lineTo(n.nt-r,n.st)),i.fill()}function gi(t,i,n,s,e,r){return bi(i,n,s,e,r)}class Mi extends H{constructor(){super(...arguments),this.zt=null,this.ar=new ni,this.j=-1,this.H="",this.Qr=""}J(t){this.zt=t}_r(t,i){this.j===t&&this.H===i||(this.j=t,this.H=i,this.Qr=F(t,i),this.ar.nr())}wr(t,i){if(null===this.zt||null===this.zt.tt)return null;for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n];if(Si(s,t,i))return{Mr:s.th,gr:s.gr}}return null}K({context:t,horizontalPixelRatio:i,verticalPixelRatio:n},s,e){if(null!==this.zt&&null!==this.zt.tt){t.textBaseline="middle",t.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const e=this.zt.it[s];void 0!==e.Kt&&(e.Kt.Hi=this.ar.xi(t,e.Kt.ih),e.Kt.At=this.j,e.Kt.nt=e.nt-e.Kt.Hi/2),xi(e,t,i,n)}}}}function xi(t,i,n,s){i.fillStyle=t.V,void 0!==t.Kt&&function(t,i,n,s,e,r){t.save(),t.scale(e,r),t.fillText(i,n,s),t.restore()}(i,t.Kt.ih,t.Kt.nt,t.Kt.st,n,s),function(t,i,n){if(0===t.Ks)return;switch(t.nh){case"arrowDown":return void wi(!1,i,n,t.Ks);case"arrowUp":return void wi(!0,i,n,t.Ks);case"circle":return void function(t,i,n){const s=(fi("circle",n)-1)/2;t.beginPath(),t.arc(i.nt,i.st,s*i.Jr,0,2*Math.PI,!1),t.fill()}(i,n,t.Ks);case"square":return void function(t,i,n){const s=fi("square",n),e=(s-1)*i.Jr/2,r=i.nt-e,h=i.st-e;t.fillRect(r,h,s*i.Jr,s*i.Jr)}(i,n,t.Ks)}t.nh}(t,i,function(t,i,n){const s=Math.max(1,Math.floor(i))%2/2;return{nt:Math.round(t.nt*i)+s,st:t.st*n,Jr:i}}(t,n,s))}function Si(t,i,n){return!(void 0===t.Kt||!function(t,i,n,s,e,r){const h=s/2;return e>=t&&e<=t+n&&r>=i-h&&r<=i+h}(t.Kt.nt,t.Kt.st,t.Kt.Hi,t.Kt.At,i,n))||function(t,i,n){if(0===t.Ks)return!1;switch(t.nh){case"arrowDown":case"arrowUp":return gi(0,t.nt,t.st,t.Ks,i,n);case"circle":return function(t,i,n,s,e){const r=2+fi("circle",n)/2,h=t-s,l=i-e;return Math.sqrt(h*h+l*l)<=r}(t.nt,t.st,t.Ks,i,n);case"square":return bi(t.nt,t.st,t.Ks,i,n)}}(t,i,n)}function ki(t,i,n,s,e,r,h,l,a){const o=lightweight_charts_production_O(n)?n:n.Se,_=lightweight_charts_production_O(n)?n:n.Me,u=lightweight_charts_production_O(n)?n:n.xe,c=lightweight_charts_production_O(i.size)?Math.max(i.size,0):1,d=vi(l.le())*c,f=d/2;switch(t.Ks=d,i.position){case"inBar":return t.st=h.Rt(o,a),void(void 0!==t.Kt&&(t.Kt.st=t.st+f+r+.6*e));case"aboveBar":return t.st=h.Rt(_,a)-f-s.sh,void 0!==t.Kt&&(t.Kt.st=t.st-f-.6*e,s.sh+=1.2*e),void(s.sh+=d+r);case"belowBar":return t.st=h.Rt(u,a)+f+s.eh,void 0!==t.Kt&&(t.Kt.st=t.st+f+r+.6*e,s.eh+=1.2*e),void(s.eh+=d+r)}i.position}class yi{constructor(t,i){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Mi,this.jr=t,this.$i=i,this.zt={it:[],tt:null}}bt(t){this.ft=!0,this.hh=!0,"data"===t&&(this.rh=!0,this.oh=null)}gt(t){if(!this.jr.yt())return null;this.ft&&this._h();const i=this.$i.W().layout;return this.Wt._r(i.fontSize,i.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const t=this.$i.St().le(),i=pi(t),n=1.5*vi(t)+2*i,s=this.fh();this.ah={above:mi(n,s.aboveBar,s.inBar),below:mi(n,s.belowBar,s.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return null===this.oh&&(this.oh=this.jr.dh().reduce(((t,i)=>(t[i.position]||(t[i.position]=!0),t)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const t=this.jr.Dt(),i=this.$i.St(),n=this.jr.dh();this.rh&&(this.zt.it=n.map((t=>({ot:t.time,nt:0,st:0,Ks:0,nh:t.shape,V:t.color,th:t.th,gr:t.id,Kt:void 0}))),this.rh=!1);const s=this.$i.W().layout;this.zt.tt=null;const e=i.Xs();if(null===e)return;const r=this.jr.Ct();if(null===r)return;if(0===this.zt.it.length)return;let h=NaN;const l=pi(i.le()),a={sh:l,eh:l};this.zt.tt=Lt(this.zt.it,e,!0);for(let e=this.zt.tt.from;e<this.zt.tt.to;e++){const o=n[e];o.time!==h&&(a.sh=l,a.eh=l,h=o.time);const _=this.zt.it[e];_.nt=i.It(o.time),void 0!==o.text&&o.text.length>0&&(_.Kt={ih:o.text,nt:0,st:0,Hi:0,At:0});const u=this.jr.ph(o.time);null!==u&&ki(_,o,u,a,s.fontSize,l,t,i,r.Vt)}this.ft=!1}}class Ci extends hi{constructor(t){super(t)}yr(){const t=this.Sr;t.yt=!1;const i=this.Es.W();if(!i.priceLineVisible||!this.Es.yt())return;const n=this.Es.Zr(0===i.priceLineSource);n.Xr||(t.yt=!0,t.st=n.ki,t.V=this.Es.mh(n.V),t.et=i.priceLineWidth,t.Nt=i.priceLineStyle)}}class Ti extends nt{constructor(t){super(),this.jt=t}zi(t,i,n){t.yt=!1,i.yt=!1;const s=this.jt;if(!s.yt())return;const e=s.W(),r=e.lastValueVisible,h=""!==s.bh(),l=0===e.seriesLastValueMode,a=s.Zr(!1);if(a.Xr)return;r&&(t.Kt=this.wh(a,r,l),t.yt=0!==t.Kt.length),(h||l)&&(i.Kt=this.gh(a,r,h,l),i.yt=i.Kt.length>0);const o=s.mh(a.V),_=lightweight_charts_production_R(o);n.t=_.t,n.ki=a.ki,i.Ot=s.$t().Bt(a.ki/s.Dt().At()),t.Ot=o,t.V=_.i,i.V=_.i}gh(t,i,n,s){let e="";const r=this.jt.bh();return n&&0!==r.length&&(e+=`${r} `),i&&s&&(e+=this.jt.Dt().Mh()?t.xh:t.Sh),e.trim()}wh(t,i,n){return i?n?this.jt.Dt().Mh()?t.Sh:t.xh:t.Kt:""}}function Pi(t,i,n,s){const e=Number.isFinite(i),r=Number.isFinite(n);return e&&r?t(i,n):e||r?e?i:n:s}class Ri{constructor(t,i){this.kh=t,this.yh=i}Ch(t){return null!==t&&(this.kh===t.kh&&this.yh===t.yh)}Th(){return new Ri(this.kh,this.yh)}Ph(){return this.kh}Rh(){return this.yh}Dh(){return this.yh-this.kh}Ni(){return this.yh===this.kh||Number.isNaN(this.yh)||Number.isNaN(this.kh)}ts(t){return null===t?this:new Ri(Pi(Math.min,this.Ph(),t.Ph(),-1/0),Pi(Math.max,this.Rh(),t.Rh(),1/0))}Vh(t){if(!lightweight_charts_production_O(t))return;if(0===this.yh-this.kh)return;const i=.5*(this.yh+this.kh);let n=this.yh-i,s=this.kh-i;n*=t,s*=t,this.yh=i+n,this.kh=i+s}Oh(t){lightweight_charts_production_O(t)&&(this.yh+=t,this.kh+=t)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(t){return null===t?null:new Ri(t.minValue,t.maxValue)}}class Di{constructor(t,i){this.Ih=t,this.zh=i||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return null===this.Ih?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(t){return null===t?null:new Di(Ri.Ah(t.priceRange),t.margins)}}class Vi extends hi{constructor(t,i){super(t),this.Nh=i}yr(){const t=this.Sr;t.yt=!1;const i=this.Nh.W();if(!this.Es.yt()||!i.lineVisible)return;const n=this.Nh.Fh();null!==n&&(t.yt=!0,t.st=n,t.V=i.color,t.et=i.lineWidth,t.Nt=i.lineStyle,t.gr=this.Nh.W().id)}}class Oi extends nt{constructor(t,i){super(),this.jr=t,this.Nh=i}zi(t,i,n){t.yt=!1,i.yt=!1;const s=this.Nh.W(),e=s.axisLabelVisible,r=""!==s.title,h=this.jr;if(!e||!h.yt())return;const l=this.Nh.Fh();if(null===l)return;r&&(i.Kt=s.title,i.yt=!0),i.Ot=h.$t().Bt(l/h.Dt().At()),t.Kt=this.Wh(s.price),t.yt=!0;const a=lightweight_charts_production_R(s.axisLabelColor||s.color);n.t=a.t;const o=s.axisLabelTextColor||a.i;t.V=o,i.V=o,n.ki=l}Wh(t){const i=this.jr.Ct();return null===i?"":this.jr.Dt().Fi(t,i.Vt)}}class Bi{constructor(t,i){this.jr=t,this.cn=i,this.jh=new Vi(t,this),this.ur=new Oi(t,this),this.Hh=new ei(this.ur,t,t.$t())}$h(t){lightweight_charts_production_V(this.cn,t),this.bt(),this.jr.$t().Uh()}W(){return this.cn}qh(){return this.jh}Yh(){return this.Hh}Zh(){return this.ur}bt(){this.jh.bt(),this.ur.bt()}Fh(){const t=this.jr,i=t.Dt();if(t.$t().St().Ni()||i.Ni())return null;const n=t.Ct();return null===n?null:i.Rt(this.cn.price,n.Vt)}}class Ai extends lt{constructor(t){super(),this.$i=t}$t(){return this.$i}}const Ii={Bar:(t,i,n,s)=>{var e;const r=i.upColor,h=i.downColor,l=lightweight_charts_production_b(t(n,s)),a=lightweight_charts_production_w(l.Vt[0])<=lightweight_charts_production_w(l.Vt[3]);return{ce:null!==(e=l.V)&&void 0!==e?e:a?r:h}},Candlestick:(t,i,n,s)=>{var e,r,h;const l=i.upColor,a=i.downColor,o=i.borderUpColor,_=i.borderDownColor,u=i.wickUpColor,c=i.wickDownColor,d=lightweight_charts_production_b(t(n,s)),f=lightweight_charts_production_w(d.Vt[0])<=lightweight_charts_production_w(d.Vt[3]);return{ce:null!==(e=d.V)&&void 0!==e?e:f?l:a,Ne:null!==(r=d.Ot)&&void 0!==r?r:f?o:_,Ee:null!==(h=d.Xh)&&void 0!==h?h:f?u:c}},Custom:(t,i,n,s)=>{var e;return{ce:null!==(e=lightweight_charts_production_b(t(n,s)).V)&&void 0!==e?e:i.color}},Area:(t,i,n,s)=>{var e,r,h,l;const a=lightweight_charts_production_b(t(n,s));return{ce:null!==(e=a.lt)&&void 0!==e?e:i.lineColor,lt:null!==(r=a.lt)&&void 0!==r?r:i.lineColor,Ps:null!==(h=a.Ps)&&void 0!==h?h:i.topColor,Rs:null!==(l=a.Rs)&&void 0!==l?l:i.bottomColor}},Baseline:(t,i,n,s)=>{var e,r,h,l,a,o;const _=lightweight_charts_production_b(t(n,s));return{ce:_.Vt[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,Re:null!==(e=_.Re)&&void 0!==e?e:i.topLineColor,De:null!==(r=_.De)&&void 0!==r?r:i.bottomLineColor,ke:null!==(h=_.ke)&&void 0!==h?h:i.topFillColor1,ye:null!==(l=_.ye)&&void 0!==l?l:i.topFillColor2,Ce:null!==(a=_.Ce)&&void 0!==a?a:i.bottomFillColor1,Te:null!==(o=_.Te)&&void 0!==o?o:i.bottomFillColor2}},Line:(t,i,n,s)=>{var e,r;const h=lightweight_charts_production_b(t(n,s));return{ce:null!==(e=h.V)&&void 0!==e?e:i.color,lt:null!==(r=h.V)&&void 0!==r?r:i.color}},Histogram:(t,i,n,s)=>{var e;return{ce:null!==(e=lightweight_charts_production_b(t(n,s)).V)&&void 0!==e?e:i.color}}};class zi{constructor(t){this.Kh=(t,i)=>void 0!==i?i.Vt:this.jr.In().Gh(t),this.jr=t,this.Jh=Ii[t.Qh()]}$s(t,i){return this.Jh(this.Kh,this.jr.W(),t,i)}}var Li;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"}(Li||(Li={}));const Ei=30;class Ni{constructor(){this.tl=[],this.il=new Map,this.nl=new Map}sl(){return this.Ks()>0?this.tl[this.tl.length-1]:null}el(){return this.Ks()>0?this.rl(0):null}An(){return this.Ks()>0?this.rl(this.tl.length-1):null}Ks(){return this.tl.length}Ni(){return 0===this.Ks()}Kr(t){return null!==this.hl(t,0)}Gh(t){return this.ll(t)}ll(t,i=0){const n=this.hl(t,i);return null===n?null:Object.assign(Object.assign({},this.al(n)),{ee:this.rl(n)})}ne(){return this.tl}ol(t,i,n){if(this.Ni())return null;let s=null;for(const e of n){s=Fi(s,this._l(t,i,e))}return s}J(t){this.nl.clear(),this.il.clear(),this.tl=t}rl(t){return this.tl[t].ee}al(t){return this.tl[t]}hl(t,i){const n=this.ul(t);if(null===n&&0!==i)switch(i){case-1:return this.cl(t);case 1:return this.dl(t);default:throw new TypeError("Unknown search mode")}return n}cl(t){let i=this.fl(t);return i>0&&(i-=1),i!==this.tl.length&&this.rl(i)<t?i:null}dl(t){const i=this.vl(t);return i!==this.tl.length&&t<this.rl(i)?i:null}ul(t){const i=this.fl(t);return i===this.tl.length||t<this.tl[i].ee?null:i}fl(t){return Bt(this.tl,t,((t,i)=>t.ee<i))}vl(t){return At(this.tl,t,((t,i)=>t.ee>i))}pl(t,i,n){let s=null;for(let e=t;e<i;e++){const t=this.tl[e].Vt[n];Number.isNaN(t)||(null===s?s={ml:t,bl:t}:(t<s.ml&&(s.ml=t),t>s.bl&&(s.bl=t)))}return s}_l(t,i,n){if(this.Ni())return null;let s=null;const e=lightweight_charts_production_b(this.el()),r=lightweight_charts_production_b(this.An()),h=Math.max(t,e),l=Math.min(i,r),a=Math.ceil(h/Ei)*Ei,o=Math.max(a,Math.floor(l/Ei)*Ei);{const t=this.fl(h),e=this.vl(Math.min(l,a,i));s=Fi(s,this.pl(t,e,n))}let _=this.il.get(n);void 0===_&&(_=new Map,this.il.set(n,_));for(let t=Math.max(a+1,h);t<o;t+=Ei){const i=Math.floor(t/Ei);let e=_.get(i);if(void 0===e){const t=this.fl(i*Ei),s=this.vl((i+1)*Ei-1);e=this.pl(t,s,n),_.set(i,e)}s=Fi(s,e)}{const t=this.fl(o),i=this.vl(l);s=Fi(s,this.pl(t,i,n))}return s}}function Fi(t,i){if(null===t)return i;if(null===i)return t;return{ml:Math.min(t.ml,i.ml),bl:Math.max(t.bl,i.bl)}}class Wi{constructor(t){this.wl=t}X(t,i,n){this.wl.draw(t)}gl(t,i,n){var s,e;null===(e=(s=this.wl).drawBackground)||void 0===e||e.call(s,t)}}class ji{constructor(t){this.tr=null,this.wn=t}gt(){var t;const i=this.wn.renderer();if(null===i)return null;if((null===(t=this.tr)||void 0===t?void 0:t.Ml)===i)return this.tr.xl;const n=new Wi(i);return this.tr={Ml:i,xl:n},n}Sl(){var t,i,n;return null!==(n=null===(i=(t=this.wn).zOrder)||void 0===i?void 0:i.call(t))&&void 0!==n?n:"normal"}}function Hi(t){var i,n,s,e,r;return{Kt:t.text(),ki:t.coordinate(),Si:null===(i=t.fixedCoordinate)||void 0===i?void 0:i.call(t),V:t.textColor(),t:t.backColor(),yt:null===(s=null===(n=t.visible)||void 0===n?void 0:n.call(t))||void 0===s||s,hi:null===(r=null===(e=t.tickVisible)||void 0===e?void 0:e.call(t))||void 0===r||r}}class $i{constructor(t,i){this.Wt=new rt,this.kl=t,this.yl=i}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Hi(this.kl))),this.Wt}}class Ui extends nt{constructor(t,i){super(),this.kl=t,this.Li=i}zi(t,i,n){const s=Hi(this.kl);n.t=s.t,t.V=s.V;const e=2/12*this.Li.P();n.wi=e,n.gi=e,n.ki=s.ki,n.Si=s.Si,t.Kt=s.Kt,t.yt=s.yt,t.hi=s.hi}}class qi{constructor(t,i){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=t,this.jr=i}Ol(){return this.Vl}Vn(){var t,i;null===(i=(t=this.Vl).updateAllViews)||void 0===i||i.call(t)}Pn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Vl).paneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Cl)||void 0===s?void 0:s.Ml)===e)return this.Cl.xl;const r=e.map((t=>new ji(t)));return this.Cl={Ml:e,xl:r},r}Qi(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Vl).timeAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Tl)||void 0===s?void 0:s.Ml)===e)return this.Tl.xl;const r=this.jr.$t().St(),h=e.map((t=>new $i(t,r)));return this.Tl={Ml:e,xl:h},h}Rn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Vl).priceAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Pl)||void 0===s?void 0:s.Ml)===e)return this.Pl.xl;const r=this.jr.Dt(),h=e.map((t=>new Ui(t,r)));return this.Pl={Ml:e,xl:h},h}Bl(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Vl).priceAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Rl)||void 0===s?void 0:s.Ml)===e)return this.Rl.xl;const r=e.map((t=>new ji(t)));return this.Rl={Ml:e,xl:r},r}Al(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Vl).timeAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Dl)||void 0===s?void 0:s.Ml)===e)return this.Dl.xl;const r=e.map((t=>new ji(t)));return this.Dl={Ml:e,xl:r},r}Il(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Vl).autoscaleInfo)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}wr(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Vl).hitTest)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}}function Yi(t,i,n,s){t.forEach((t=>{i(t).forEach((t=>{t.Sl()===n&&s.push(t)}))}))}function Zi(t){return t.Pn()}function Xi(t){return t.Bl()}function Ki(t){return t.Al()}class Gi extends Ai{constructor(t,i,n,s,e){super(t),this.zt=new Ni,this.jh=new Ci(this),this.zl=[],this.Ll=new li(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=i,this.$l=n;const r=new Ti(this);this.rn=[r],this.Hh=new ei(r,this,t),"Area"!==n&&"Line"!==n&&"Baseline"!==n||(this.El=new ci(this)),this.Ul(),this.ql(e)}S(){null!==this.jl&&clearTimeout(this.jl)}mh(t){return this.cn.priceLineColor||t}Zr(t){const i={Xr:!0},n=this.Dt();if(this.$t().St().Ni()||n.Ni()||this.zt.Ni())return i;const s=this.$t().St().Xs(),e=this.Ct();if(null===s||null===e)return i;let r,h;if(t){const t=this.zt.sl();if(null===t)return i;r=t,h=t.ee}else{const t=this.zt.ll(s.ui(),-1);if(null===t)return i;if(r=this.zt.Gh(t.ee),null===r)return i;h=t.ee}const l=r.Vt[3],a=this.Us().$s(h,{Vt:r}),o=n.Rt(l,e.Vt);return{Xr:!1,_t:l,Kt:n.Fi(l,e.Vt),xh:n.Yl(l),Sh:n.Zl(l,e.Vt),V:a.ce,ki:o,ee:h}}Us(){return null!==this.Nl||(this.Nl=new zi(this)),this.Nl}W(){return this.cn}$h(t){const i=t.priceScaleId;void 0!==i&&i!==this.cn.priceScaleId&&this.$t().Xl(this,i),lightweight_charts_production_V(this.cn,t),void 0!==t.priceFormat&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(t,i){this.zt.J(t),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),null!==this.El&&(i&&i.ta?this.El.$r():0===t.length&&this.El.Hr());const n=this.$t().dr(this);this.$t().ia(n),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(t){this.Fl=t,this.Ql();const i=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(i),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(t){const i=new Bi(this,t);return this.zl.push(i),this.$t().Gl(this),i}ra(t){const i=this.zl.indexOf(t);-1!==i&&this.zl.splice(i,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const t=this.ha();return null===t?null:{Vt:t.Vt[3],la:t.ot}}ha(){const t=this.$t().St().Xs();if(null===t)return null;const i=t.Os();return this.zt.ll(i,1)}In(){return this.zt}ph(t){const i=this.zt.Gh(t);return null===i?null:"Bar"===this.$l||"Candlestick"===this.$l||"Custom"===this.$l?{ge:i.Vt[0],Me:i.Vt[1],xe:i.Vt[2],Se:i.Vt[3]}:i.Vt[3]}aa(t){const i=[];Yi(this.Hl,Zi,"top",i);const n=this.El;return null!==n&&n.yt()?(null===this.jl&&n.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),n.Ur(),i.unshift(n),i):i}Pn(){const t=[];this._a()||t.push(this.Ll),t.push(this.wn,this.jh,this.dn);const i=this.zl.map((t=>t.qh()));return t.push(...i),Yi(this.Hl,Zi,"normal",t),t}ua(){return this.ca(Zi,"bottom")}da(t){return this.ca(Xi,t)}fa(t){return this.ca(Ki,t)}va(t,i){return this.Hl.map((n=>n.wr(t,i))).filter((t=>null!==t))}Ji(t){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(t,i){if(i!==this.Yi&&!this._a())return[];const n=[...this.rn];for(const t of this.zl)n.push(t.Zh());return this.Hl.forEach((t=>{n.push(...t.Rn())})),n}Qi(){const t=[];return this.Hl.forEach((i=>{t.push(...i.Qi())})),t}Il(t,i){if(void 0!==this.cn.autoscaleInfoProvider){const n=this.cn.autoscaleInfoProvider((()=>{const n=this.pa(t,i);return null===n?null:n.Bh()}));return Di.Ah(n)}return this.pa(t,i)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var t;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.zl)t.bt();this.jh.bt(),this.Ll.bt(),null===(t=this.El)||void 0===t||t.bt(),this.Hl.forEach((t=>t.Vn()))}Dt(){return lightweight_charts_production_b(super.Dt())}kt(t){if(!(("Line"===this.$l||"Area"===this.$l||"Baseline"===this.$l)&&this.cn.crosshairMarkerVisible))return null;const i=this.zt.Gh(t);if(null===i)return null;return{_t:i.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(t)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(t){this.Hl.push(new qi(t,this))}ya(t){this.Hl=this.Hl.filter((i=>i.Ol()!==t))}Ca(){if(this.wn instanceof Kt!=!1)return t=>this.wn.We(t)}Ta(){if(this.wn instanceof Kt!=!1)return t=>this.wn.je(t)}_a(){return!_t(this.Dt().Pa())}pa(t,i){if(!lightweight_charts_production_B(t)||!lightweight_charts_production_B(i)||this.zt.Ni())return null;const n="Line"===this.$l||"Area"===this.$l||"Baseline"===this.$l||"Histogram"===this.$l?[3]:[2,1],s=this.zt.ol(t,i,n);let e=null!==s?new Ri(s.ml,s.bl):null;if("Histogram"===this.Qh()){const t=this.cn.base,i=new Ri(t,t);e=null!==e?e.ts(i):i}let r=this.dn.uh();return this.Hl.forEach((n=>{const s=n.Il(t,i);if(null==s?void 0:s.priceRange){const t=new Ri(s.priceRange.minValue,s.priceRange.maxValue);e=null!==e?e.ts(t):t}var h,l,a,o;(null==s?void 0:s.margins)&&(h=r,l=s.margins,r={above:Math.max(null!==(a=null==h?void 0:h.above)&&void 0!==a?a:0,l.above),below:Math.max(null!==(o=null==h?void 0:h.below)&&void 0!==o?o:0,l.below)})})),new Di(e,r)}ga(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}Ma(){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(t){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.Us().$s(t).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new pt(this.cn.priceFormat.precision);break;case"percent":this.wa=new vt(this.cn.priceFormat.precision);break;default:{const t=Math.pow(10,this.cn.priceFormat.precision);this.wa=new ft(t,this.cn.priceFormat.minMove*t)}}null!==this.Yi&&this.Yi.Ra()}Ql(){const t=this.$t().St();if(!t.Da()||this.zt.Ni())return void(this.Wl=[]);const i=lightweight_charts_production_b(this.zt.el());this.Wl=this.Fl.map(((n,s)=>{const e=lightweight_charts_production_b(t.Va(n.time,!0)),r=e<i?1:-1;return{time:lightweight_charts_production_b(this.zt.ll(e,r)).ee,position:n.position,shape:n.shape,color:n.color,id:n.id,th:s,text:n.text,size:n.size,originalTime:n.originalTime}}))}ql(t){switch(this.dn=new yi(this,this.$t()),this.$l){case"Bar":this.wn=new Ht(this,this.$t());break;case"Candlestick":this.wn=new Zt(this,this.$t());break;case"Line":this.wn=new ti(this,this.$t());break;case"Custom":this.wn=new Kt(this,this.$t(),lightweight_charts_production_m(t));break;case"Area":this.wn=new Ft(this,this.$t());break;case"Baseline":this.wn=new qt(this,this.$t());break;case"Histogram":this.wn=new Qt(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(t,i){const n=[];return Yi(this.Hl,t,i,n),n}}class Ji{constructor(t){this.cn=t}Oa(t,i,n){let s=t;if(0===this.cn.mode)return s;const e=n.vn(),r=e.Ct();if(null===r)return s;const h=e.Rt(t,r),l=n.Ba().filter((t=>t instanceof Gi)).reduce(((t,s)=>{if(n.vr(s)||!s.yt())return t;const e=s.Dt(),r=s.In();if(e.Ni()||!r.Kr(i))return t;const h=r.Gh(i);if(null===h)return t;const l=lightweight_charts_production_w(s.Ct());return t.concat([e.Rt(h.Vt[3],l.Vt)])}),[]);if(0===l.length)return s;l.sort(((t,i)=>Math.abs(t-h)-Math.abs(i-h)));const a=l[0];return s=e.pn(a,r),s}}class Qi extends H{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}K({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(null===this.zt)return;const e=Math.max(1,Math.floor(n));t.lineWidth=e,function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore()}(t,(()=>{const r=lightweight_charts_production_b(this.zt);if(r.Aa){t.strokeStyle=r.Ia,lightweight_charts_production_f(t,r.za),t.beginPath();for(const s of r.La){const r=Math.round(s.Ea*n);t.moveTo(r,-e),t.lineTo(r,i.height+e)}t.stroke()}if(r.Na){t.strokeStyle=r.Fa,lightweight_charts_production_f(t,r.Wa),t.beginPath();for(const n of r.ja){const r=Math.round(n.Ea*s);t.moveTo(-e,r),t.lineTo(i.width+e,r)}t.stroke()}}))}}class tn{constructor(t){this.Wt=new Qi,this.ft=!0,this.tn=t}bt(){this.ft=!0}gt(){if(this.ft){const t=this.tn.$t().W().grid,i={Na:t.horzLines.visible,Aa:t.vertLines.visible,Fa:t.horzLines.color,Ia:t.vertLines.color,Wa:t.horzLines.style,za:t.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map((t=>({Ea:t.coord})))};this.Wt.J(i),this.ft=!1}return this.Wt}}class nn{constructor(t){this.wn=new tn(t)}qh(){return this.wn}}const sn={$a:4,Ua:1e-4};function en(t,i){const n=100*(t-i)/i;return i<0?-n:n}function rn(t,i){const n=en(t.Ph(),i),s=en(t.Rh(),i);return new Ri(n,s)}function hn(t,i){const n=100*(t-i)/i+100;return i<0?-n:n}function ln(t,i){const n=hn(t.Ph(),i),s=hn(t.Rh(),i);return new Ri(n,s)}function an(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.log10(n+i.Ua)+i.$a;return t<0?-s:s}function on(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.pow(10,n-i.$a)-i.Ua;return t<0?-s:s}function lightweight_charts_production_n(t,i){if(null===t)return null;const n=an(t.Ph(),i),s=an(t.Rh(),i);return new Ri(n,s)}function un(t,i){if(null===t)return null;const n=on(t.Ph(),i),s=on(t.Rh(),i);return new Ri(n,s)}function cn(t){if(null===t)return sn;const i=Math.abs(t.Rh()-t.Ph());if(i>=1||i<1e-15)return sn;const n=Math.ceil(Math.abs(Math.log10(i))),s=sn.$a+n;return{$a:s,Ua:1/Math.pow(10,s)}}class dn{constructor(t,i){if(this.qa=t,this.Ya=i,function(t){if(t<0)return!1;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0}(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let t=this.qa;1!==t;){if(t%2==0)this.Za.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),t/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(t,i,n){const s=0===this.qa?0:1/this.qa;let e=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,h=this.Ya[0];for(;;){const t=yt(e,s,1e-14)&&e>s+1e-14,i=yt(e,n*h,1e-14),l=yt(e,1,1e-14);if(!(t&&i&&l))break;e/=h,h=this.Ya[++r%this.Ya.length]}if(e<=s+1e-14&&(e=s),e=Math.max(1,e),this.Za.length>0&&(l=e,a=1,o=1e-14,Math.abs(l-a)<o))for(r=0,h=this.Za[0];yt(e,n*h,1e-14)&&e>s+1e-14;)e/=h,h=this.Za[++r%this.Za.length];var l,a,o;return e}}class fn{constructor(t,i,n,s){this.Ka=[],this.Li=t,this.qa=i,this.Ga=n,this.Ja=s}Xa(t,i){if(t<i)throw new Error("high < low");const n=this.Li.At(),s=(t-i)*this.Qa()/n,e=new dn(this.qa,[2,2.5,2]),r=new dn(this.qa,[2,2,2.5]),h=new dn(this.qa,[2.5,2,2]),l=[];return l.push(e.Xa(t,i,s),r.Xa(t,i,s),h.Xa(t,i,s)),function(t){if(t.length<1)throw Error("array is empty");let i=t[0];for(let n=1;n<t.length;++n)t[n]<i&&(i=t[n]);return i}(l)}io(){const t=this.Li,i=t.Ct();if(null===i)return void(this.Ka=[]);const n=t.At(),s=this.Ga(n-1,i),e=this.Ga(0,i),r=this.Li.W().entireTextOnly?this.no()/2:0,h=r,l=n-1-r,a=Math.max(s,e),o=Math.min(s,e);if(a===o)return void(this.Ka=[]);let _=this.Xa(a,o),u=a%_;u+=u<0?_:0;const c=a>=o?1:-1;let d=null,f=0;for(let n=a-u;n>o;n-=_){const s=this.Ja(n,i,!0);null!==d&&Math.abs(s-d)<this.Qa()||(s<h||s>l||(f<this.Ka.length?(this.Ka[f].Ea=s,this.Ka[f].so=t.eo(n)):this.Ka.push({Ea:s,so:t.eo(n)}),f++,d=s,t.ro()&&(_=this.Xa(n*c,o))))}this.Ka.length=f}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function vn(t){return t.slice().sort(((t,i)=>lightweight_charts_production_b(t.Xi())-lightweight_charts_production_b(i.Xi())))}var pn;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(pn||(pn={}));const mn=new vt,bn=new ft(100,1);class wn{constructor(t,i,n,s){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new lightweight_charts_production_D,this.vo=new lightweight_charts_production_D,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=bn,this.xo=cn(null),this.So=t,this.cn=i,this.ko=n,this.yo=s,this.Co=new fn(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(t){if(lightweight_charts_production_V(this.cn,t),this.Ra(),void 0!==t.mode&&this.Ro({Cr:t.mode}),void 0!==t.scaleMargins){const i=lightweight_charts_production_m(t.scaleMargins.top),n=lightweight_charts_production_m(t.scaleMargins.bottom);if(i<0||i>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(n<0||n>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${n}`);if(i+n>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${i+n}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return 1===this.cn.mode}Mh(){return 2===this.cn.mode}Oo(){return 3===this.cn.mode}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(t){const i=this.Cr();let n=null;void 0!==t.Wn&&(this.cn.autoScale=t.Wn),void 0!==t.Cr&&(this.cn.mode=t.Cr,2!==t.Cr&&3!==t.Cr||(this.cn.autoScale=!0),this.oo._o=!1),1===i.Cr&&t.Cr!==i.Cr&&(!function(t,i){if(null===t)return!1;const n=on(t.Ph(),i),s=on(t.Rh(),i);return isFinite(n)&&isFinite(s)}(this.Ih,this.xo)?this.cn.autoScale=!0:(n=un(this.Ih,this.xo),null!==n&&this.Ao(n))),1===t.Cr&&t.Cr!==i.Cr&&(n=lightweight_charts_production_n(this.Ih,this.xo),null!==n&&this.Ao(n));const s=i.Cr!==this.cn.mode;s&&(2===i.Cr||this.Mh())&&this.Ra(),s&&(3===i.Cr||this.Oo())&&this.Ra(),void 0!==t.Bo&&i.Bo!==t.Bo&&(this.cn.invertScale=t.Bo,this.Io()),this.vo.m(i,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(t){this.ho!==t&&(this.ho=t,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const t=this.At()-this.No()-this.Fo();return this.lo=t,t}Lh(){return this.Wo(),this.Ih}Ao(t,i){const n=this.Ih;(i||null===n&&null!==t||null!==n&&!n.Ch(t))&&(this.bo=null,this.Ih=t)}Ni(){return this.Wo(),0===this.ho||!this.Ih||this.Ih.Ni()}jo(t){return this.Bo()?t:this.At()-1-t}Rt(t,i){return this.Mh()?t=en(t,i):this.Oo()&&(t=hn(t,i)),this.Po(t,i)}te(t,i,n){this.Wo();const s=this.Fo(),e=lightweight_charts_production_b(this.Lh()),r=e.Ph(),h=e.Rh(),l=this.Eo()-1,a=this.Bo(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.Ho();for(let n=_;n<u;n++){const e=t[n],h=e._t;if(isNaN(h))continue;let l=h;null!==c&&(l=c(e._t,i));const _=s+o*(l-r),u=a?_:this.ho-1-_;e.st=u}}be(t,i,n){this.Wo();const s=this.Fo(),e=lightweight_charts_production_b(this.Lh()),r=e.Ph(),h=e.Rh(),l=this.Eo()-1,a=this.Bo(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.Ho();for(let n=_;n<u;n++){const e=t[n];let h=e.ge,l=e.Me,_=e.xe,u=e.Se;null!==c&&(h=c(e.ge,i),l=c(e.Me,i),_=c(e.xe,i),u=c(e.Se,i));let d=s+o*(h-r),f=a?d:this.ho-1-d;e.pe=f,d=s+o*(l-r),f=a?d:this.ho-1-d,e.de=f,d=s+o*(_-r),f=a?d:this.ho-1-d,e.fe=f,d=s+o*(u-r),f=a?d:this.ho-1-d,e.me=f}}pn(t,i){const n=this.To(t,i);return this.$o(n,i)}$o(t,i){let n=t;return this.Mh()?n=function(t,i){return i<0&&(t=-t),t/100*i+i}(n,i):this.Oo()&&(n=function(t,i){return t-=100,i<0&&(t=-t),t/100*i+i}(n,i)),n}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let t=[];for(let i=0;i<this.po.length;i++){const n=this.po[i];null===n.Xi()&&n.Ki(i+1),t.push(n)}return t=vn(t),this.mo=t,this.mo}qo(t){-1===this.po.indexOf(t)&&(this.po.push(t),this.Ra(),this.Yo())}Zo(t){const i=this.po.indexOf(t);if(-1===i)throw new Error("source is not attached to scale");this.po.splice(i,1),0===this.po.length&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let t=null;for(const i of this.po){const n=i.Ct();null!==n&&((null===t||n.la<t.la)&&(t=n))}return null===t?null:t.Vt}Bo(){return this.cn.invertScale}Ha(){const t=null===this.Ct();if(null!==this.bo&&(t||this.bo.Xo===t))return this.bo.Ha;this.Co.io();const i=this.Co.Ha();return this.bo={Ha:i,Xo:t},this.fo.m(),i}Ko(){return this.fo}Go(t){this.Mh()||this.Oo()||null===this.wo&&null===this.ao&&(this.Ni()||(this.wo=this.ho-t,this.ao=lightweight_charts_production_b(this.Lh()).Th()))}Jo(t){if(this.Mh()||this.Oo())return;if(null===this.wo)return;this.Ro({Wn:!1}),(t=this.ho-t)<0&&(t=0);let i=(this.wo+.2*(this.ho-1))/(t+.2*(this.ho-1));const n=lightweight_charts_production_b(this.ao).Th();i=Math.max(i,.1),n.Vh(i),this.Ao(n)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(t){this.Vo()||null===this.Mo&&null===this.ao&&(this.Ni()||(this.Mo=t,this.ao=lightweight_charts_production_b(this.Lh()).Th()))}i_(t){if(this.Vo())return;if(null===this.Mo)return;const i=lightweight_charts_production_b(this.Lh()).Dh()/(this.Eo()-1);let n=t-this.Mo;this.Bo()&&(n*=-1);const s=n*i,e=lightweight_charts_production_b(this.ao).Th();e.Oh(s),this.Ao(e,!0),this.bo=null}n_(){this.Vo()||null!==this.Mo&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(t,i){switch(this.cn.mode){case 2:return this.s_(en(t,i));case 3:return this.ba().format(hn(t,i));default:return this.Wh(t)}}eo(t){switch(this.cn.mode){case 2:return this.s_(t);case 3:return this.ba().format(t);default:return this.Wh(t)}}Yl(t){return this.Wh(t,lightweight_charts_production_b(this.e_()).ba())}Zl(t,i){return t=en(t,i),this.s_(t,mn)}r_(){return this.po}h_(t){this.oo={uo:t,_o:!1}}Vn(){this.po.forEach((t=>t.Vn()))}Ra(){this.bo=null;const t=this.e_();let i=100;null!==t&&(i=Math.round(1/t.ma())),this.wa=bn,this.Mh()?(this.wa=mn,i=100):this.Oo()?(this.wa=new ft(100,1),i=100):null!==t&&(this.wa=t.ba()),this.Co=new fn(this,i,this.To.bind(this),this.Po.bind(this)),this.Co.io()}Yo(){this.mo=null}e_(){return this.po[0]||null}No(){return this.Bo()?this.cn.scaleMargins.bottom*this.At()+this.do:this.cn.scaleMargins.top*this.At()+this.co}Fo(){return this.Bo()?this.cn.scaleMargins.top*this.At()+this.co:this.cn.scaleMargins.bottom*this.At()+this.do}Wo(){this.oo._o||(this.oo._o=!0,this.l_())}Do(){this.lo=null}Po(t,i){if(this.Wo(),this.Ni())return 0;t=this.ro()&&t?an(t,this.xo):t;const n=lightweight_charts_production_b(this.Lh()),s=this.Fo()+(this.Eo()-1)*(t-n.Ph())/n.Dh();return this.jo(s)}To(t,i){if(this.Wo(),this.Ni())return 0;const n=this.jo(t),s=lightweight_charts_production_b(this.Lh()),e=s.Ph()+s.Dh()*((n-this.Fo())/(this.Eo()-1));return this.ro()?on(e,this.xo):e}Io(){this.bo=null,this.Co.io()}l_(){const t=this.oo.uo;if(null===t)return;let i=null;const n=this.r_();let s=0,e=0;for(const r of n){if(!r.yt())continue;const n=r.Ct();if(null===n)continue;const h=r.Il(t.Os(),t.ui());let l=h&&h.Lh();if(null!==l){switch(this.cn.mode){case 1:l=lightweight_charts_production_n(l,this.xo);break;case 2:l=rn(l,n.Vt);break;case 3:l=ln(l,n.Vt)}if(i=null===i?l:i.ts(lightweight_charts_production_b(l)),null!==h){const t=h.Eh();null!==t&&(s=Math.max(s,t.above),e=Math.max(e,t.below))}}}if(s===this.co&&e===this.do||(this.co=s,this.do=e,this.bo=null,this.Do()),null!==i){if(i.Ph()===i.Rh()){const t=this.e_(),n=5*(null===t||this.Mh()||this.Oo()?1:t.ma());this.ro()&&(i=un(i,this.xo)),i=new Ri(i.Ph()-n,i.Rh()+n),this.ro()&&(i=lightweight_charts_production_n(i,this.xo))}if(this.ro()){const t=un(i,this.xo),n=cn(t);if(r=n,h=this.xo,r.$a!==h.$a||r.Ua!==h.Ua){const s=null!==this.ao?un(this.ao,this.xo):null;this.xo=n,i=lightweight_charts_production_n(t,n),null!==s&&(this.ao=lightweight_charts_production_n(s,n))}}this.Ao(i)}else null===this.Ih&&(this.Ao(new Ri(-.5,.5)),this.xo=cn(null));var r,h;this.oo._o=!0}Ho(){return this.Mh()?en:this.Oo()?hn:this.ro()?t=>an(t,this.xo):null}a_(t,i,n){return void 0===i?(void 0===n&&(n=this.ba()),n.format(t)):i(t)}Wh(t,i){return this.a_(t,this.yo.priceFormatter,i)}s_(t,i){return this.a_(t,this.yo.percentageFormatter,i)}}class gn{constructor(t,i){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new lightweight_charts_production_D,this.yl=t,this.$i=i,this.d_=new nn(this);const n=i.W();this.f_=this.v_("left",n.leftPriceScale),this.p_=this.v_("right",n.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(n)}b_(t){if(t.leftPriceScale&&this.f_.$h(t.leftPriceScale),t.rightPriceScale&&this.p_.$h(t.rightPriceScale),t.localization&&(this.f_.Ra(),this.p_.Ra()),t.overlayPriceScales){const i=Array.from(this.o_.values());for(const n of i){const i=lightweight_charts_production_b(n[0].Dt());i.$h(t.overlayPriceScales),t.localization&&i.Ra()}}}w_(t){switch(t){case"left":return this.f_;case"right":return this.p_}return this.o_.has(t)?lightweight_charts_production_m(this.o_.get(t))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((t=>{t.S&&t.S()})),this.c_.m()}M_(){return this.u_}x_(t){this.u_=t}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(t){this.__=t,this.k_()}Lo(t){this.ho=t,this.f_.Lo(t),this.p_.Lo(t),this.po.forEach((i=>{if(this.vr(i)){const n=i.Dt();null!==n&&n.Lo(t)}})),this.k_()}Ba(){return this.po}vr(t){const i=t.Dt();return null===i||this.f_!==i&&this.p_!==i}qo(t,i,n){const s=void 0!==n?n:this.C_().y_+1;this.T_(t,i,s)}Zo(t){const i=this.po.indexOf(t);lightweight_charts_production_p(-1!==i,"removeDataSource: invalid data source"),this.po.splice(i,1);const n=lightweight_charts_production_b(t.Dt()).Pa();if(this.o_.has(n)){const i=lightweight_charts_production_m(this.o_.get(n)),s=i.indexOf(t);-1!==s&&(i.splice(s,1),0===i.length&&this.o_.delete(n))}const s=t.Dt();s&&s.Ba().indexOf(t)>=0&&s.Zo(t),null!==s&&(s.Yo(),this.P_(s)),this.mo=null}mr(t){return t===this.f_?"left":t===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(t,i){t.Go(i)}O_(t,i){t.Jo(i),this.k_()}B_(t){t.Qo()}A_(t,i){t.t_(i)}I_(t,i){t.i_(i),this.k_()}z_(t){t.n_()}k_(){this.po.forEach((t=>{t.Vn()}))}vn(){let t=null;return this.$i.W().rightPriceScale.visible&&0!==this.p_.Ba().length?t=this.p_:this.$i.W().leftPriceScale.visible&&0!==this.f_.Ba().length?t=this.f_:0!==this.po.length&&(t=this.po[0].Dt()),null===t&&(t=this.p_),t}pr(){let t=null;return this.$i.W().rightPriceScale.visible?t=this.p_:this.$i.W().leftPriceScale.visible&&(t=this.f_),t}P_(t){null!==t&&t.Vo()&&this.L_(t)}E_(t){const i=this.yl.Xs();t.Ro({Wn:!0}),null!==i&&t.h_(i),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((t=>{this.vr(t)&&this.P_(t.Dt())})),this.k_(),this.$i.Uh()}Uo(){return null===this.mo&&(this.mo=vn(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(t){const i=t.r_();if(i&&i.length>0&&!this.yl.Ni()){const i=this.yl.Xs();null!==i&&t.h_(i)}t.Vn()}C_(){const t=this.Uo();if(0===t.length)return{H_:0,y_:0};let i=0,n=0;for(let s=0;s<t.length;s++){const e=t[s].Xi();null!==e&&(e<i&&(i=e),e>n&&(n=e))}return{H_:i,y_:n}}T_(t,i,n){let s=this.w_(i);if(null===s&&(s=this.v_(i,this.$i.W().overlayPriceScales)),this.po.push(t),!_t(i)){const n=this.o_.get(i)||[];n.push(t),this.o_.set(i,n)}s.qo(t),t.Gi(s),t.Ki(n),this.P_(s),this.mo=null}m_(t,i,n){i.Cr!==n.Cr&&this.L_(t)}v_(t,i){const n=Object.assign({visible:!0,autoScale:!0},lightweight_charts_production_z(i)),s=new wn(t,n,this.$i.W().layout,this.$i.W().localization);return s.Lo(this.At()),s}}class Mn{constructor(t,i,n=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=t,this.q_=i,this.ir=n}Y_(t){const i=t.time,n=this.q_.cacheKey(i),s=this.tr.get(n);if(void 0!==s)return s.Z_;if(this.Ke===this.ir){const t=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(lightweight_charts_production_m(t)),this.Je++,this.Ke--}const e=this.U_(t);return this.tr.set(n,{Z_:e,rr:this.Ge}),this.Qe.set(this.Ge,n),this.Ke++,this.Ge++,e}}class xn{constructor(t,i){lightweight_charts_production_p(t<=i,"right should be >= left"),this.X_=t,this.K_=i}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(t){return this.X_<=t&&t<=this.K_}Ch(t){return this.X_===t.Os()&&this.K_===t.ui()}}function Sn(t,i){return null===t||null===i?t===i:t.Ch(i)}class kn{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(t){this.Q_=t,this.tr=null}iu(t,i){this.nu(i),this.tr=null;for(let n=i;n<t.length;++n){const i=t[n];let s=this.J_.get(i.timeWeight);void 0===s&&(s=[],this.J_.set(i.timeWeight,s)),s.push({index:n,time:i.time,weight:i.timeWeight,originalTime:i.originalTime})}}su(t,i){const n=Math.ceil(i/t);return null!==this.tr&&this.tr.eu===n||(this.tr={Ha:this.ru(n),eu:n}),this.tr.Ha}nu(t){if(0===t)return void this.J_.clear();const i=[];this.J_.forEach(((n,s)=>{t<=n[0].index?i.push(s):n.splice(Bt(n,t,(i=>i.index<t)),1/0)}));for(const t of i)this.J_.delete(t)}ru(t){let i=[];for(const n of Array.from(this.J_.keys()).sort(((t,i)=>i-t))){if(!this.J_.get(n))continue;const s=i;i=[];const e=s.length;let r=0;const h=lightweight_charts_production_m(this.J_.get(n)),l=h.length;let a=1/0,o=-1/0;for(let n=0;n<l;n++){const l=h[n],_=l.index;for(;r<e;){const t=s[r],n=t.index;if(!(n<_)){a=n;break}r++,i.push(t),o=n,a=1/0}if(a-_>=t&&_-o>=t)i.push(l),o=_;else if(this.Q_)return s}for(;r<e;r++)i.push(s[r])}return i}}class yn{constructor(t){this.hu=t}lu(){return null===this.hu?null:new xn(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new yn(null)}}function Cn(t,i){return t.weight>i.weight?t:i}class Tn{constructor(t,i,n,s){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new kn,this.du=new Map,this.fu=yn.ou(),this.vu=!0,this.pu=new lightweight_charts_production_D,this.mu=new lightweight_charts_production_D,this.bu=new lightweight_charts_production_D,this.wu=null,this.gu=null,this.Mu=[],this.cn=i,this.yo=n,this.xu=i.rightOffset,this.Su=i.barSpacing,this.$i=t,this.q_=s,this.ku(),this.cu.tu(i.uniformDistribution)}W(){return this.cn}yu(t){lightweight_charts_production_V(this.yo,t),this.Cu(),this.ku()}$h(t,i){var n;lightweight_charts_production_V(this.cn,t),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),void 0!==t.barSpacing&&this.$i.Gn(t.barSpacing),void 0!==t.rightOffset&&this.$i.Jn(t.rightOffset),void 0!==t.minBarSpacing&&this.$i.Gn(null!==(n=t.barSpacing)&&void 0!==n?n:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(t){var i,n;return null!==(n=null===(i=this.uu[t])||void 0===i?void 0:i.time)&&void 0!==n?n:null}Ui(t){var i;return null!==(i=this.uu[t])&&void 0!==i?i:null}Va(t,i){if(this.uu.length<1)return null;if(this.q_.key(t)>this.q_.key(this.uu[this.uu.length-1].time))return i?this.uu.length-1:null;const n=Bt(this.uu,this.q_.key(t),((t,i)=>this.q_.key(t.time)<i));return this.q_.key(t)<this.q_.key(this.uu[n].time)?i?n:null:n}Ni(){return 0===this.__||0===this.uu.length||null===this._u}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const t=this.Xs();if(null===t)return null;const i={from:t.Os(),to:t.ui()};return this.Ou(i)}Ou(t){const i=Math.round(t.from),n=Math.round(t.to),s=lightweight_charts_production_b(this.Bu()),e=lightweight_charts_production_b(this.Au());return{from:lightweight_charts_production_b(this.Ui(Math.max(s,i))),to:lightweight_charts_production_b(this.Ui(Math.min(e,n)))}}Iu(t){return{from:lightweight_charts_production_b(this.Va(t.from,!0)),to:lightweight_charts_production_b(this.Va(t.to,!0))}}Hi(){return this.__}S_(t){if(!isFinite(t)||t<=0)return;if(this.__===t)return;const i=this.Du(),n=this.__;if(this.__=t,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&0!==n){const i=this.Su*t/n;this.Su=i}if(this.cn.fixLeftEdge&&null!==i&&i.Os()<=0){const i=n-t;this.xu-=Math.round(i/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(t){if(this.Ni()||!lightweight_charts_production_B(t))return 0;const i=this.Eu()+this.xu-t;return this.__-(i+.5)*this.Su-1}Qs(t,i){const n=this.Eu(),s=void 0===i?0:i.from,e=void 0===i?t.length:i.to;for(let i=s;i<e;i++){const s=t[i].ot,e=n+this.xu-s,r=this.__-(e+.5)*this.Su-1;t[i].nt=r}}Nu(t){return Math.ceil(this.Fu(t))}Jn(t){this.vu=!0,this.xu=t,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(t){this.ju(t),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(null!==this.gu)return this.gu;const t=this.Su,i=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),n=Math.round(i/t),s=lightweight_charts_production_b(this.Xs()),e=Math.max(s.Os(),s.Os()-n),r=Math.max(s.ui(),s.ui()-n),h=this.cu.su(t,i),l=this.Bu()+n,a=this.Au()-n,o=this.$u(),_=this.cn.fixLeftEdge||o,u=this.cn.fixRightEdge||o;let c=0;for(const t of h){if(!(e<=t.index&&t.index<=r))continue;let n;c<this.Mu.length?(n=this.Mu[c],n.coord=this.It(t.index),n.label=this.Uu(t),n.weight=t.weight):(n={needAlignCoordinate:!1,coord:this.It(t.index),label:this.Uu(t),weight:t.weight},this.Mu.push(n)),this.Su>i/2&&!o?n.needAlignCoordinate=!1:n.needAlignCoordinate=_&&t.index<=l||u&&t.index>=a,c++}return this.Mu.length=c,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(t){this.vu=!0,this._u=t,this.Lu(),this.Tu()}Zu(t,i){const n=this.Fu(t),s=this.le(),e=s+i*(s/10);this.Gn(e),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(n-this.Fu(t)))}Go(t){this.Mo&&this.n_(),null===this.wo&&null===this.wu&&(this.Ni()||(this.wo=t,this.Xu()))}Jo(t){if(null===this.wu)return;const i=kt(this.__-t,0,this.__),n=kt(this.__-lightweight_charts_production_b(this.wo),0,this.__);0!==i&&0!==n&&this.Gn(this.wu.le*i/n)}Qo(){null!==this.wo&&(this.wo=null,this.Ku())}t_(t){null===this.Mo&&null===this.wu&&(this.Ni()||(this.Mo=t,this.Xu()))}i_(t){if(null===this.Mo)return;const i=(this.Mo-t)/this.le();this.xu=lightweight_charts_production_b(this.wu).Hu+i,this.vu=!0,this.Lu()}n_(){null!==this.Mo&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(t,i=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const n=this.xu,s=performance.now();this.$i.Zn({Qu:t=>(t-s)/i>=1,tc:e=>{const r=(e-s)/i;return r>=1?t:n+(t-n)*r}})}bt(t,i){this.vu=!0,this.uu=t,this.cu.iu(t,i),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(t){const i=t.G_();this.ju(this.__/i),this.xu=t.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const t=this.Bu(),i=this.Au();null!==t&&null!==i&&this.rc(new xn(t,i+this.cn.rightOffset))}lc(t){const i=new xn(t.from,t.to);this.rc(i)}qi(t){return void 0!==this.yo.timeFormatter?this.yo.timeFormatter(t.originalTime):this.q_.formatHorzItem(t.time)}$u(){const{handleScroll:t,handleScale:i}=this.$i.W();return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||i.axisDoubleClickReset.time||i.axisPressedMouseMove.time||i.mouseWheel||i.pinch)}Bu(){return 0===this.uu.length?null:0}Au(){return 0===this.uu.length?null:this.uu.length-1}ac(t){return(this.__-1-t)/this.Su}Fu(t){const i=this.ac(t),n=this.Eu()+this.xu-i;return Math.round(1e6*n)/1e6}ju(t){const i=this.Su;this.Su=t,this.zu(),i!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(yn.ou());const t=this.Eu(),i=this.__/this.Su,n=this.xu+t,s=new xn(n-i+1,n);this._c(new yn(s))}zu(){const t=this.uc();if(this.Su<t&&(this.Su=t,this.vu=!0),0!==this.__){const t=.5*this.__;this.Su>t&&(this.Su=t,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&0!==this.uu.length?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const t=this.cc();null!==t&&this.xu<t&&(this.xu=t,this.vu=!0);const i=this.dc();this.xu>i&&(this.xu=i,this.vu=!0)}cc(){const t=this.Bu(),i=this._u;if(null===t||null===i)return null;return t-i-1+(this.cn.fixLeftEdge?this.__/this.Su:Math.min(2,this.uu.length))}dc(){return this.cn.fixRightEdge?0:this.__/this.Su-Math.min(2,this.uu.length)}Xu(){this.wu={le:this.le(),Hu:this.Hu()}}Ku(){this.wu=null}Uu(t){let i=this.du.get(t.weight);return void 0===i&&(i=new Mn((t=>this.fc(t)),this.q_),this.du.set(t.weight,i)),i.Y_(t)}fc(t){return this.q_.formatTickmark(t,this.yo)}_c(t){const i=this.fu;this.fu=t,Sn(i.lu(),this.fu.lu())||this.pu.m(),Sn(i.au(),this.fu.au())||this.mu.m(),this.oc()}oc(){this.gu=null}Cu(){this.oc(),this.du.clear()}ku(){this.q_.updateFormatter(this.yo)}Tu(){if(!this.cn.fixLeftEdge)return;const t=this.Bu();if(null===t)return;const i=this.Xs();if(null===i)return;const n=i.Os()-t;if(n<0){const t=this.xu-n-1;this.Jn(t)}this.zu()}Pu(){this.Lu(),this.zu()}}class Pn{X(t,i,n){t.useMediaCoordinateSpace((t=>this.K(t,i,n)))}gl(t,i,n){t.useMediaCoordinateSpace((t=>this.vc(t,i,n)))}vc(t,i,n){}}class Rn extends Pn{constructor(t){super(),this.mc=new Map,this.zt=t}K(t){}vc(t){if(!this.zt.yt)return;const{context:i,mediaSize:n}=t;let s=0;for(const t of this.zt.bc){if(0===t.Kt.length)continue;i.font=t.R;const e=this.wc(i,t.Kt);e>n.width?t.Zu=n.width/e:t.Zu=1,s+=t.gc*t.Zu}let e=0;switch(this.zt.Mc){case"top":e=0;break;case"center":e=Math.max((n.height-s)/2,0);break;case"bottom":e=Math.max(n.height-s,0)}i.fillStyle=this.zt.V;for(const t of this.zt.bc){i.save();let s=0;switch(this.zt.xc){case"left":i.textAlign="left",s=t.gc/2;break;case"center":i.textAlign="center",s=n.width/2;break;case"right":i.textAlign="right",s=n.width-1-t.gc/2}i.translate(s,e),i.textBaseline="top",i.font=t.R,i.scale(t.Zu,t.Zu),i.fillText(t.Kt,0,t.Sc),i.restore(),e+=t.gc*t.Zu}}wc(t,i){const n=this.kc(t.font);let s=n.get(i);return void 0===s&&(s=t.measureText(i).width,n.set(i,s)),s}kc(t){let i=this.mc.get(t);return void 0===i&&(i=new Map,this.mc.set(t,i)),i}}class Dn{constructor(t){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new Rn(this.Ft),this.jt=t}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const t=this.jt.W(),i=this.Ft;i.yt=t.visible,i.yt&&(i.V=t.color,i.xc=t.horzAlign,i.Mc=t.vertAlign,i.bc=[{Kt:t.text,R:F(t.fontSize,t.fontFamily,t.fontStyle),gc:1.2*t.fontSize,Sc:0,Zu:0}])}}class Vn extends lt{constructor(t,i){super(),this.cn=i,this.wn=new Dn(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var On,Bn,An,In,zn;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"}(On||(On={}));class Ln{constructor(t,i,n){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new lightweight_charts_production_D,this.Rc=new lightweight_charts_production_D,this.Dc=null,this.Vc=t,this.cn=i,this.q_=n,this.Oc=new W(this),this.yl=new Tn(this,i.timeScale,this.cn.localization,n),this.vt=new ot(this,i.crosshair),this.Bc=new Ji(i.crosshair),this.Ac=new Vn(this,i.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(ut.es())}Uh(){this.Nc(ut.ss())}oa(){this.Nc(new ut(1))}Gl(t){const i=this.Fc(t);this.Nc(i)}Wc(){return this.Tc}jc(t){const i=this.Tc;this.Tc=t,null!==i&&this.Gl(i.Hc),null!==t&&this.Gl(t.Hc)}W(){return this.cn}$h(t){lightweight_charts_production_V(this.cn,t),this.yc.forEach((i=>i.b_(t))),void 0!==t.timeScale&&this.yl.$h(t.timeScale),void 0!==t.localization&&this.yl.yu(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(t,i){if("left"===t)return void this.$h({leftPriceScale:i});if("right"===t)return void this.$h({rightPriceScale:i});const n=this.Uc(t);null!==n&&(n.Dt.$h(i),this.Pc.m())}Uc(t){for(const i of this.yc){const n=i.w_(t);if(null!==n)return{Ht:i,Dt:n}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(t,i){t.Lo(i),this.Wu()}S_(t){this.__=t,this.yl.S_(this.__),this.yc.forEach((i=>i.S_(t))),this.Wu()}Ic(t){const i=new gn(this.yl,this);void 0!==t?this.yc.splice(t,0,i):this.yc.push(i);const n=void 0===t?this.yc.length-1:t,s=ut.es();return s.Nn(n,{Fn:0,Wn:!0}),this.Nc(s),i}V_(t,i,n){t.V_(i,n)}O_(t,i,n){t.O_(i,n),this.Jl(),this.Nc(this.Gc(t,2))}B_(t,i){t.B_(i),this.Nc(this.Gc(t,2))}A_(t,i,n){i.Vo()||t.A_(i,n)}I_(t,i,n){i.Vo()||(t.I_(i,n),this.Jl(),this.Nc(this.Gc(t,2)))}z_(t,i){i.Vo()||(t.z_(i),this.Nc(this.Gc(t,2)))}E_(t,i){t.E_(i),this.Nc(this.Gc(t,2))}Jc(t){this.yl.Go(t)}Qc(t,i){const n=this.St();if(n.Ni()||0===i)return;const s=n.Hi();t=Math.max(1,Math.min(t,s)),n.Zu(t,i),this.Wu()}td(t){this.nd(0),this.sd(t),this.ed()}rd(t){this.yl.Jo(t),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(t){this.yl.t_(t)}sd(t){this.yl.i_(t),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(t,i,n,s,e){this.vt.gn(t,i);let r=NaN,h=this.yl.Nu(t);const l=this.yl.Xs();null!==l&&(h=Math.min(Math.max(l.Os(),h),l.ui()));const a=s.vn(),o=a.Ct();null!==o&&(r=a.pn(i,o)),r=this.Bc.Oa(r,h,s),this.vt.kn(h,r,s),this.oa(),e||this.Rc.m(this.vt.xt(),{x:t,y:i},n)}ad(t,i,n){const s=n.vn(),e=s.Ct(),r=s.Rt(t,lightweight_charts_production_b(e)),h=this.yl.Va(i,!0),l=this.yl.It(lightweight_charts_production_b(h));this.ld(l,r,null,n,!0)}od(t){this.Zc().Cn(),this.oa(),t||this.Rc.m(null,null,null)}Jl(){const t=this.vt.Ht();if(null!==t){const i=this.vt.xn(),n=this.vt.Sn();this.ld(i,n,null,t)}this.vt.Vn()}_d(t,i,n){const s=this.yl.mn(0);void 0!==i&&void 0!==n&&this.yl.bt(i,n);const e=this.yl.mn(0),r=this.yl.Eu(),h=this.yl.Xs();if(null!==h&&null!==s&&null!==e){const i=h.Kr(r),l=this.q_.key(s)>this.q_.key(e),a=null!==t&&t>r&&!l,o=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,_=i&&(!(void 0===n)||o)&&this.yl.W().shiftVisibleRangeOnNewBar;if(a&&!_){const i=t-r;this.yl.Jn(this.yl.Hu()-i)}}this.yl.Yu(t)}ia(t){null!==t&&t.F_()}dr(t){const i=this.yc.find((i=>i.Uo().includes(t)));return void 0===i?null:i}Wu(){this.Ac.Vn(),this.yc.forEach((t=>t.F_())),this.Jl()}S(){this.yc.forEach((t=>t.S())),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(t,i,n){const s=this.yc[0],e=this.fd(i,t,s,n);return this.Cc.push(e),1===this.Cc.length?this.Kl():this.Uh(),e}vd(t){const i=this.dr(t),n=this.Cc.indexOf(t);lightweight_charts_production_p(-1!==n,"Series not found"),this.Cc.splice(n,1),lightweight_charts_production_b(i).Zo(t),t.S&&t.S()}Xl(t,i){const n=lightweight_charts_production_b(this.dr(t));n.Zo(t);const s=this.Uc(i);if(null===s){const s=t.Xi();n.qo(t,i,s)}else{const e=s.Ht===n?t.Xi():void 0;s.Ht.qo(t,i,e)}}hc(){const t=ut.ss();t.$n(),this.Nc(t)}pd(t){const i=ut.ss();i.Yn(t),this.Nc(i)}Kn(){const t=ut.ss();t.Kn(),this.Nc(t)}Gn(t){const i=ut.ss();i.Gn(t),this.Nc(i)}Jn(t){const i=ut.ss();i.Jn(t),this.Nc(i)}Zn(t){const i=ut.ss();i.Zn(t),this.Nc(i)}Un(){const t=ut.ss();t.Un(),this.Nc(t)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(t){const i=this.Ec,n=this.zc;if(i===n)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Dc||this.Dc.Ps!==n||this.Dc.Rs!==i)this.Dc={Ps:n,Rs:i,wd:new Map};else{const i=this.Dc.wd.get(t);if(void 0!==i)return i}const s=function(t,i,n){const[s,e,r,h]=lightweight_charts_production_T(t),[l,a,o,_]=lightweight_charts_production_T(i),u=[lightweight_charts_production_M(s+n*(l-s)),lightweight_charts_production_M(e+n*(a-e)),lightweight_charts_production_M(r+n*(o-r)),lightweight_charts_production_x(h+n*(_-h))];return`rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}(n,i,t/100);return this.Dc.wd.set(t,s),s}Gc(t,i){const n=new ut(i);if(null!==t){const s=this.yc.indexOf(t);n.Nn(s,{Fn:i})}return n}Fc(t,i){return void 0===i&&(i=2),this.Gc(this.dr(t),i)}Nc(t){this.Vc&&this.Vc(t),this.yc.forEach((t=>t.j_().qh().bt()))}fd(t,i,n,s){const e=new Gi(this,t,i,n,s),r=void 0!==t.priceScaleId?t.priceScaleId:this.md();return n.qo(e,r),_t(r)||e.$h(t),e}Lc(t){const i=this.cn.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}}function En(t){return!lightweight_charts_production_O(t)&&!lightweight_charts_production_A(t)}function Nn(t){return lightweight_charts_production_O(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"}(Bn||(Bn={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(An||(An={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(In||(In={})),function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds"}(zn||(zn={}));const Fn=t=>t.getUTCFullYear();function Wn(t,i,n){return i.replace(/yyyy/g,(t=>dt(Fn(t),4))(t)).replace(/yy/g,(t=>dt(Fn(t)%100,2))(t)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(t,n)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(t,n)).replace(/MM/g,(t=>dt((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>dt((t=>t.getUTCDate())(t),2))(t))}class jn{constructor(t="yyyy-MM-dd",i="default"){this.gd=t,this.Md=i}Y_(t){return Wn(t,this.gd,this.Md)}}class Hn{constructor(t){this.xd=t||"%h:%m:%s"}Y_(t){return this.xd.replace("%h",dt(t.getUTCHours(),2)).replace("%m",dt(t.getUTCMinutes(),2)).replace("%s",dt(t.getUTCSeconds(),2))}}const $n={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class Un{constructor(t={}){const i=Object.assign(Object.assign({},$n),t);this.Td=new jn(i.Sd,i.Cd),this.Pd=new Hn(i.kd),this.Rd=i.yd}Y_(t){return`${this.Td.Y_(t)}${this.Rd}${this.Pd.Y_(t)}`}}function qn(t){return 60*t*60*1e3}function Yn(t){return 60*t*1e3}const Zn=[{Dd:(Xn=1,1e3*Xn),Vd:10},{Dd:Yn(1),Vd:20},{Dd:Yn(5),Vd:21},{Dd:Yn(30),Vd:22},{Dd:qn(1),Vd:30},{Dd:qn(3),Vd:31},{Dd:qn(6),Vd:32},{Dd:qn(12),Vd:33}];var Xn;function Kn(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let n=Zn.length-1;n>=0;--n)if(Math.floor(i.getTime()/Zn[n].Dd)!==Math.floor(t.getTime()/Zn[n].Dd))return Zn[n].Vd;return 0}function Gn(t){let i=t;if(lightweight_charts_production_A(t)&&(i=Qn(t)),!En(i))throw new Error("time must be of type BusinessDay");const n=new Date(Date.UTC(i.year,i.month-1,i.day,0,0,0,0));return{Od:Math.round(n.getTime()/1e3),Bd:i}}function Jn(t){if(!Nn(t))throw new Error("time must be of type isUTCTimestamp");return{Od:t}}function Qn(t){const i=new Date(t);if(isNaN(i.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function ts(t){lightweight_charts_production_A(t.time)&&(t.time=Qn(t.time))}class is{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?function(t){t.forEach(ts)}(t):ts(t)}createConverterToInternalObj(t){return lightweight_charts_production_b(function(t){return 0===t.length?null:En(t[0].time)||lightweight_charts_production_A(t[0].time)?Gn:Jn}(t))}key(t){return"object"==typeof t&&"Od"in t?t.Od:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){const i=t;return void 0===i.Bd?new Date(1e3*i.Od).getTime():new Date(Date.UTC(i.Bd.year,i.Bd.month-1,i.Bd.day)).getTime()}convertHorzItemToInternal(t){return Nn(i=t)?Jn(i):En(i)?Gn(i):Gn(Qn(i));var i}updateFormatter(t){if(!this.cn)return;const i=t.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new Un({Sd:i,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:t.locale}):this.Ad=new jn(i,t.locale)}formatHorzItem(t){const i=t;return this.Ad.Y_(new Date(1e3*i.Od))}formatTickmark(t,i){const n=function(t,i,n){switch(t){case 0:case 10:return i?n?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),s=this.cn.timeScale;if(void 0!==s.tickMarkFormatter){const e=s.tickMarkFormatter(t.originalTime,n,i.locale);if(null!==e)return e}return function(t,i,n){const s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=!1,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=!1,s.hour="2-digit",s.minute="2-digit",s.second="2-digit"}const e=void 0===t.Bd?new Date(1e3*t.Od):new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day));return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()).toLocaleString(n,s)}(t.time,n,i.locale)}maxTickMarkWeight(t){let i=t.reduce(Cn,t[0]).weight;return i>30&&i<50&&(i=30),i}fillWeightsForPoints(t,i){!function(t,i=0){if(0===t.length)return;let n=0===i?null:t[i-1].time.Od,s=null!==n?new Date(1e3*n):null,e=0;for(let r=i;r<t.length;++r){const i=t[r],h=new Date(1e3*i.time.Od);null!==s&&(i.timeWeight=Kn(h,s)),e+=i.time.Od-(n||i.time.Od),n=i.time.Od,s=h}if(0===i&&t.length>1){const i=Math.ceil(e/(t.length-1)),n=new Date(1e3*(t[0].time.Od-i));t[0].timeWeight=Kn(new Date(1e3*t[0].time.Od),n)}}(t,i)}static Id(t){return lightweight_charts_production_V({localization:{dateFormat:"dd MMM 'yy"}},null!=t?t:{})}}const ns="undefined"!=typeof window;function ss(){return!!ns&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function es(){return!!ns&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function rs(t){return t+t%2}function hs(t,i){return t.zd-i.zd}function ls(t,i,n){const s=(t.zd-i.zd)/(t.ot-i.ot);return Math.sign(s)*Math.min(Math.abs(s),n)}class as{constructor(t,i,n,s){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=t,this.Ud=i,this.qd=n,this.rs=s}Yd(t,i){if(null!==this.Ld){if(this.Ld.ot===i)return void(this.Ld.zd=t);if(Math.abs(this.Ld.zd-t)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:i,zd:t}}Vr(t,i){if(null===this.Ld||null===this.Ed)return;if(i-this.Ld.ot>50)return;let n=0;const s=ls(this.Ld,this.Ed,this.Ud),e=hs(this.Ld,this.Ed),r=[s],h=[e];if(n+=e,null!==this.Nd){const t=ls(this.Ed,this.Nd,this.Ud);if(Math.sign(t)===Math.sign(s)){const i=hs(this.Ed,this.Nd);if(r.push(t),h.push(i),n+=i,null!==this.Fd){const t=ls(this.Nd,this.Fd,this.Ud);if(Math.sign(t)===Math.sign(s)){const i=hs(this.Nd,this.Fd);r.push(t),h.push(i),n+=i}}}}let l=0;for(let t=0;t<r.length;++t)l+=h[t]/n*r[t];Math.abs(l)<this.$d||(this.Wd={zd:t,ot:i},this.Hd=l,this.jd=function(t,i){const n=Math.log(i);return Math.log(1*n/-t)/n}(Math.abs(l),this.qd))}tc(t){const i=lightweight_charts_production_b(this.Wd),n=t-i.ot;return i.zd+this.Hd*(Math.pow(this.qd,n)-1)/Math.log(this.qd)}Qu(t){return null===this.Wd||this.Zd(t)===this.jd}Zd(t){const i=t-lightweight_charts_production_b(this.Wd).ot;return Math.min(i,this.jd)}}class os{constructor(t,i){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=t,this.Qd=i,this.tf()}bt(){this.tf()}if(){this.Xd&&this.Jd.removeChild(this.Xd),this.Kd&&this.Jd.removeChild(this.Kd),this.Xd=void 0,this.Kd=void 0}nf(){return this.en!==this.sf()||this.Gd!==this.ef()}ef(){return lightweight_charts_production_P(lightweight_charts_production_T(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const t=new URL(location.href);return t.hostname?"&utm_source="+t.hostname+t.pathname:""}tf(){this.nf()&&(this.if(),this.en=this.sf(),this.en&&(this.Gd=this.ef(),this.Kd=document.createElement("style"),this.Kd.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.Xd=document.createElement("a"),this.Xd.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.rf()}`,this.Xd.title="Charting by TradingView",this.Xd.id="tv-attr-logo",this.Xd.target="_blank",this.Xd.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 19" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.Xd.toggleAttribute("data-dark","dark"===this.Gd),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function lightweight_charts_production_s(t,n){const s=lightweight_charts_production_b(t.ownerDocument).createElement("canvas");t.appendChild(s);const e=bindTo(s,{type:"device-pixel-content-box",options:{allowResizeObserver:!1},transform:(t,i)=>({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return e.resizeCanvasElement(n),e}function us(t){var i;t.width=1,t.height=1,null===(i=t.getContext("2d"))||void 0===i||i.clearRect(0,0,1,1)}function cs(t,i,n,s){t.gl&&t.gl(i,n,s)}function ds(t,i,n,s){t.X(i,n,s)}function fs(t,i,n,s){const e=t(n,s);for(const t of e){const n=t.gt();null!==n&&i(n)}}function vs(t){ns&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),!1}))}class ps{constructor(t,i,n){this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.df=null,this.ff=!1,this.vf=null,this.pf=null,this.mf=!1,this.bf=!1,this.wf=!1,this.gf=null,this.Mf=null,this.xf=null,this.Sf=null,this.kf=null,this.yf=null,this.Cf=null,this.Tf=0,this.Pf=!1,this.Rf=!1,this.Df=!1,this.Vf=0,this.Of=null,this.Bf=!es(),this.Af=t=>{this.If(t)},this.zf=t=>{if(this.Lf(t)){const i=this.Ef(t);if(++this._f,this.uf&&this._f>1){const{Nf:n}=this.Ff(ws(t),this.cf);n<30&&!this.wf&&this.Wf(i,this.Hf.jf),this.$f()}}else{const i=this.Ef(t);if(++this.hf,this.lf&&this.hf>1){const{Nf:n}=this.Ff(ws(t),this.af);n<5&&!this.bf&&this.Uf(i,this.Hf.qf),this.Yf()}}},this.Zf=t,this.Hf=i,this.cn=n,this.Xf()}S(){null!==this.gf&&(this.gf(),this.gf=null),null!==this.Mf&&(this.Mf(),this.Mf=null),null!==this.Sf&&(this.Sf(),this.Sf=null),null!==this.kf&&(this.kf(),this.kf=null),null!==this.yf&&(this.yf(),this.yf=null),null!==this.xf&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(t){this.Sf&&this.Sf();const i=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",i)},this.Zf.addEventListener("mousemove",i),this.Lf(t))return;const n=this.Ef(t);this.Uf(n,this.Hf.Qf),this.Bf=!0}Yf(){null!==this.lf&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){null!==this.uf&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(t){if(this.Df||null!==this.pf)return;if(this.Lf(t))return;const i=this.Ef(t);this.Uf(i,this.Hf.tv),this.Bf=!0}iv(t){const i=Ms(t.changedTouches,lightweight_charts_production_b(this.Of));if(null===i)return;if(this.Vf=gs(t),null!==this.Cf)return;if(this.Rf)return;this.Pf=!0;const n=this.Ff(ws(i),lightweight_charts_production_b(this.pf)),{nv:s,sv:e,Nf:r}=n;if(this.mf||!(r<5)){if(!this.mf){const t=.5*s,i=e>=t&&!this.cn.ev(),n=t>e&&!this.cn.rv();i||n||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const n=this.Ef(t,i);this.Wf(n,this.Hf.hv),bs(t)}}}lv(t){if(0!==t.button)return;const i=this.Ff(ws(t),lightweight_charts_production_b(this.vf)),{Nf:n}=i;if(n>=5&&(this.bf=!0,this.Yf()),this.bf){const i=this.Ef(t);this.Uf(i,this.Hf.av)}}Ff(t,i){const n=Math.abs(i.nt-t.nt),s=Math.abs(i.st-t.st);return{nv:n,sv:s,Nf:n+s}}ov(t){let i=Ms(t.changedTouches,lightweight_charts_production_b(this.Of));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.Of=null,this.Vf=gs(t),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const n=this.Ef(t,i);if(this.Wf(n,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:t}=this.Ff(ws(i),this.cf);t<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}else this.wf||(this.Wf(n,this.Hf.uv),this.Hf.uv&&bs(t));0===this._f&&bs(t),0===t.touches.length&&this.ff&&(this.ff=!1,bs(t))}If(t){if(0!==t.button)return;const i=this.Ef(t);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),ss()){this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af)}if(!this.Lf(t))if(this.Uf(i,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:n}=this.Ff(ws(t),this.af);n<5&&!this.bf&&this.Uf(i,this.Hf.qf),this.Yf()}else this.bf||this.Uf(i,this.Hf.dv)}Kf(){null!==this.df&&(clearTimeout(this.df),this.df=null)}fv(t){if(null!==this.Of)return;const i=t.changedTouches[0];this.Of=i.identifier,this.Vf=gs(t);const n=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=ws(i),this.yf&&(this.yf(),this.yf=null);{const i=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{n.removeEventListener("touchmove",i),n.removeEventListener("touchend",s)},n.addEventListener("touchmove",i,{passive:!1}),n.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,t),240)}const s=this.Ef(t,i);this.Wf(s,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=ws(i))}mv(t){if(0!==t.button)return;const i=this.Zf.ownerDocument.documentElement;ss()&&i.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=ws(t),this.kf&&(this.kf(),this.kf=null);{const t=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",n)},i.addEventListener("mousemove",t),i.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(t))return;const n=this.Ef(t);this.Uf(n,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=ws(t))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const t=this.Zf.ownerDocument,i=t=>{this.Hf.wv&&(t.composed&&this.Zf.contains(t.composedPath()[0])||t.target&&this.Zf.contains(t.target)||this.Hf.wv())};this.Mf=()=>{t.removeEventListener("touchstart",i)},this.gf=()=>{t.removeEventListener("mousedown",i)},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0})}es()&&(this.xf=()=>{this.Zf.removeEventListener("dblclick",this.zf)},this.Zf.addEventListener("dblclick",this.zf)),this.Zf.addEventListener("mouseleave",this.gv.bind(this)),this.Zf.addEventListener("touchstart",this.fv.bind(this),{passive:!0}),vs(this.Zf),this.Zf.addEventListener("mousedown",this.mv.bind(this)),this.Mv(),this.Zf.addEventListener("touchmove",(()=>{}),{passive:!1})}Mv(){void 0===this.Hf.xv&&void 0===this.Hf.Sv&&void 0===this.Hf.kv||(this.Zf.addEventListener("touchstart",(t=>this.yv(t.touches)),{passive:!0}),this.Zf.addEventListener("touchmove",(t=>{if(2===t.touches.length&&null!==this.Cf&&void 0!==this.Hf.Sv){const i=ms(t.touches[0],t.touches[1])/this.Tf;this.Hf.Sv(this.Cf,i),bs(t)}}),{passive:!1}),this.Zf.addEventListener("touchend",(t=>{this.yv(t.touches)})))}yv(t){1===t.length&&(this.Pf=!1),2!==t.length||this.Pf||this.ff?this.Cv():this.Tv(t)}Tv(t){const i=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,st:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.Tf=ms(t[0],t[1]),void 0!==this.Hf.xv&&this.Hf.xv(),this.Kf()}Cv(){null!==this.Cf&&(this.Cf=null,void 0!==this.Hf.kv&&this.Hf.kv())}gv(t){if(this.Sf&&this.Sf(),this.Lf(t))return;if(!this.Bf)return;const i=this.Ef(t);this.Uf(i,this.Hf.Pv),this.Bf=!es()}vv(t){const i=Ms(t.touches,lightweight_charts_production_b(this.Of));if(null===i)return;const n=this.Ef(t,i);this.Wf(n,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:gs(t)<this.Vf+500}Wf(t,i){i&&i.call(this.Hf,t)}Uf(t,i){i&&i.call(this.Hf,t)}Ef(t,i){const n=i||t,s=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:n.clientX,clientY:n.clientY,pageX:n.pageX,pageY:n.pageY,screenX:n.screenX,screenY:n.screenY,localX:n.clientX-s.left,localY:n.clientY-s.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,Dv:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,Vv:t.type,Ov:n.target,Bv:t.view,Av:()=>{"touchstart"!==t.type&&bs(t)}}}}function ms(t,i){const n=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(n*n+s*s)}function bs(t){t.cancelable&&t.preventDefault()}function ws(t){return{nt:t.pageX,st:t.pageY}}function gs(t){return t.timeStamp||performance.now()}function Ms(t,i){for(let n=0;n<t.length;++n)if(t[n].identifier===i)return t[n];return null}function xs(t){return{Hc:t.Hc,Iv:{gr:t.zv.externalId},Lv:t.zv.cursorStyle}}function Ss(t,i,n){for(const s of t){const t=s.gt();if(null!==t&&t.wr){const e=t.wr(i,n);if(null!==e)return{Bv:s,Iv:e}}}return null}function ks(t,i){return n=>{var s,e,r,h;return(null!==(e=null===(s=n.Dt())||void 0===s?void 0:s.Pa())&&void 0!==e?e:"")!==i?[]:null!==(h=null===(r=n.da)||void 0===r?void 0:r.call(n,t))&&void 0!==h?h:[]}}function ys(t,i,n,s){if(!t.length)return;let e=0;const r=n/2,h=t[0].At(s,!0);let l=1===i?r-(t[0].Vi()-h/2):t[0].Vi()-h/2-r;l=Math.max(0,l);for(let r=1;r<t.length;r++){const h=t[r],a=t[r-1],o=a.At(s,!1),_=h.Vi(),u=a.Vi();if(1===i?_>u-o:_<u+o){const s=u-o*i;h.Oi(s);const r=s-i*o/2;if((1===i?r<0:r>n)&&l>0){const s=1===i?-1-r:r-n,h=Math.min(s,l);for(let n=e;n<t.length;n++)t[n].Oi(t[n].Vi()+i*h);l-=h}}else e=r,l=1===i?u-o-_:_-(u+o)}}class Cs{constructor(i,n,s,e){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new ni(200),this.Qr=null,this.Wv=0,this.jv=!1,this.Hv=()=>{this.jv||this.tn.$v().$t().Uh()},this.Uv=()=>{this.jv||this.tn.$v().$t().Uh()},this.tn=i,this.cn=n,this.ko=n.layout,this.Oc=s,this.qv="left"===e,this.Yv=ks("normal",e),this.Zv=ks("top",e),this.Xv=ks("bottom",e),this.Kv=document.createElement("div"),this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Kv.style.width="25px",this.Kv.style.left="0",this.Kv.style.position="relative",this.Gv=lightweight_charts_production_s(this.Kv,size_size({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const r=this.Gv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jv=lightweight_charts_production_s(this.Kv,size_size({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const h=this.Jv.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0";const l={bv:this.Qv.bind(this),pv:this.Qv.bind(this),av:this.tp.bind(this),hv:this.tp.bind(this),wv:this.ip.bind(this),cv:this.np.bind(this),_v:this.np.bind(this),qf:this.sp.bind(this),jf:this.sp.bind(this),Qf:this.ep.bind(this),Pv:this.rp.bind(this)};this.hp=new ps(this.Jv.canvasElement,l,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),us(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),us(this.Gv.canvasElement),this.Gv.dispose(),null!==this.Li&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const t=this.Oc.W();return this.Qr!==t.R&&(this.Fv.nr(),this.Qr=t.R),t}op(){if(null===this.Li)return 0;let t=0;const i=this.ap(),n=lightweight_charts_production_b(this.Gv.canvasElement.getContext("2d"));n.save();const s=this.Li.Ha();n.font=this._p(),s.length>0&&(t=Math.max(this.Fv.xi(n,s[0].so),this.Fv.xi(n,s[s.length-1].so)));const e=this.up();for(let i=e.length;i--;){const s=this.Fv.xi(n,e[i].Kt());s>t&&(t=s)}const r=this.Li.Ct();if(null!==r&&null!==this.Ev&&(2!==(h=this.cn.crosshair).mode&&h.horzLine.visible&&h.horzLine.labelVisible)){const i=this.Li.pn(1,r),s=this.Li.pn(this.Ev.height-2,r);t=Math.max(t,this.Fv.xi(n,this.Li.Fi(Math.floor(Math.min(i,s))+.11111111111111,r)),this.Fv.xi(n,this.Li.Fi(Math.ceil(Math.max(i,s))-.11111111111111,r)))}var h;n.restore();const l=t||34;return rs(Math.ceil(i.C+i.T+i.A+i.I+5+l))}cp(t){null!==this.Ev&&equalSizes(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`)}dp(){return lightweight_charts_production_b(this.Ev).width}Gi(t){this.Li!==t&&(null!==this.Li&&this.Li.Ko().p(this),this.Li=t,t.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const t=this.tn.fp();this.tn.$v().$t().E_(t,lightweight_charts_production_b(this.Dt()))}vp(t){if(null===this.Ev)return;if(1!==t){this.pp(),this.Gv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Gv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.mp(t),this.Ie(t)})),this.tn.bp(t,this.Xv),this.wp(t),this.tn.bp(t,this.Yv),this.gp(t))}this.Jv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Jv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.Mp(i),this.tn.bp(i,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(t,i,n){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,i,n)}bt(){var t;null===(t=this.Li)||void 0===t||t.Ha()}Qv(t){if(null===this.Li||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.$v().$t(),n=this.tn.fp();this.Nv=!0,i.V_(n,this.Li,t.localY)}tp(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.$v().$t(),n=this.tn.fp(),s=this.Li;i.O_(n,s,t.localY)}ip(){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),i=this.tn.fp(),n=this.Li;this.Nv&&(this.Nv=!1,t.B_(i,n))}np(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.$v().$t(),n=this.tn.fp();this.Nv=!1,i.B_(n,this.Li)}sp(t){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(t){if(null===this.Li)return;!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1)}rp(t){this.kp(0)}up(){const t=[],i=null===this.Li?void 0:this.Li;return(n=>{for(let s=0;s<n.length;++s){const e=n[s].Rn(this.tn.fp(),i);for(let i=0;i<e.length;i++)t.push(e[i])}})(this.tn.fp().Uo()),t}mp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.tn.fp().$t(),r=e.q(),h=e.bd();r===h?G(t,0,0,n,s,r):tt(t,0,0,n,s,r,h)}Ie({context:t,bitmapSize:i,horizontalPixelRatio:n}){if(null===this.Ev||null===this.Li||!this.Li.W().borderVisible)return;t.fillStyle=this.Li.W().borderColor;const s=Math.max(1,Math.floor(this.ap().C*n));let e;e=this.qv?i.width-s:0,t.fillRect(e,0,s,i.height)}wp(t){if(null===this.Ev||null===this.Li)return;const i=this.Li.Ha(),n=this.Li.W(),s=this.ap(),e=this.qv?this.Ev.width-s.T:0;n.borderVisible&&n.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:r,verticalPixelRatio:h})=>{t.fillStyle=n.borderColor;const l=Math.max(1,Math.floor(h)),a=Math.floor(.5*h),o=Math.round(s.T*r);t.beginPath();for(const n of i)t.rect(Math.floor(e*r),Math.round(n.Ea*h)-a,o,l);t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{var r;t.font=this._p(),t.fillStyle=null!==(r=n.textColor)&&void 0!==r?r:this.ko.textColor,t.textAlign=this.qv?"right":"left",t.textBaseline="middle";const h=this.qv?Math.round(e-s.A):Math.round(e+s.T+s.A),l=i.map((i=>this.Fv.Mi(t,i.so)));for(let n=i.length;n--;){const s=i[n];t.fillText(s.so,h,s.Ea+l[n])}}))}pp(){if(null===this.Ev||null===this.Li)return;const t=[],i=this.Li.Uo().slice(),n=this.tn.fp(),s=this.ap();this.Li===n.pr()&&this.tn.fp().Uo().forEach((t=>{n.vr(t)&&i.push(t)}));const e=this.Li;i.forEach((i=>{i.Rn(n,e).forEach((i=>{i.Oi(null),i.Bi()&&t.push(i)}))})),t.forEach((t=>t.Oi(t.ki())));this.Li.W().alignLabels&&this.yp(t,s)}yp(t,i){if(null===this.Ev)return;const n=this.Ev.height/2,s=t.filter((t=>t.ki()<=n)),e=t.filter((t=>t.ki()>n));s.sort(((t,i)=>i.ki()-t.ki())),e.sort(((t,i)=>t.ki()-i.ki()));for(const n of t){const t=Math.floor(n.At(i)/2),s=n.ki();s>-t&&s<t&&n.Oi(t),s>this.Ev.height-t&&s<this.Ev.height+t&&n.Oi(this.Ev.height-t)}ys(s,1,this.Ev.height,i),ys(e,-1,this.Ev.height,i)}gp(t){if(null===this.Ev)return;const i=this.up(),n=this.ap(),s=this.qv?"right":"left";i.forEach((i=>{if(i.Ai()){i.gt(lightweight_charts_production_b(this.Li)).X(t,n,this.Fv,s)}}))}Mp(t){if(null===this.Ev||null===this.Li)return;const i=this.tn.$v().$t(),n=[],s=this.tn.fp(),e=i.Zc().Rn(s,this.Li);e.length&&n.push(e);const r=this.ap(),h=this.qv?"right":"left";n.forEach((i=>{i.forEach((i=>{i.gt(lightweight_charts_production_b(this.Li)).X(t,r,this.Fv,h)}))}))}kp(t){this.Kv.style.cursor=1===t?"ns-resize":"default"}fo(){const t=this.op();this.Wv<t&&this.tn.$v().$t().Kl(),this.Wv=t}_p(){return F(this.ko.fontSize,this.ko.fontFamily)}}function Ts(t,i){var n,s;return null!==(s=null===(n=t.ua)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function Ps(t,i){var n,s;return null!==(s=null===(n=t.Pn)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function Rs(t,i){var n,s;return null!==(s=null===(n=t.Ji)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function Ds(t,i){var n,s;return null!==(s=null===(n=t.aa)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}class Vs{constructor(i,n){this.Ev=size_size({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new lightweight_charts_production_D,this.Op=new lightweight_charts_production_D,this.Bp=0,this.Ap=!1,this.Ip=null,this.zp=!1,this.Lp=null,this.Ep=null,this.jv=!1,this.Hv=()=>{this.jv||null===this.Np||this.$i().Uh()},this.Uv=()=>{this.jv||null===this.Np||this.$i().Uh()},this.Qd=i,this.Np=n,this.Np.W_().l(this.Fp.bind(this),this,!0),this.Wp=document.createElement("td"),this.Wp.style.padding="0",this.Wp.style.position="relative";const s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.position="relative",s.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(s),this.Gv=lightweight_charts_production_s(s,size_size({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const e=this.Gv.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Jv=lightweight_charts_production_s(s,size_size({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const r=this.Jv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.$p=document.createElement("tr"),this.$p.appendChild(this.jp),this.$p.appendChild(this.Wp),this.$p.appendChild(this.Hp),this.Up(),this.hp=new ps(this.Jv.canvasElement,this,{ev:()=>null===this.Ip&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>null===this.Ip&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){null!==this.Cp&&this.Cp.S(),null!==this.Tp&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),us(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),us(this.Gv.canvasElement),this.Gv.dispose(),null!==this.Np&&this.Np.W_().p(this),this.hp.S()}fp(){return lightweight_charts_production_b(this.Np)}qp(t){var i,n;null!==this.Np&&this.Np.W_().p(this),this.Np=t,null!==this.Np&&this.Np.W_().l(Vs.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=null!==(i=this.Pp)&&void 0!==i?i:new os(this.Wp,this.Qd),this.Pp.bt()):(null===(n=this.Pp)||void 0===n||n.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(null!==this.Np&&(this.Zp(),0!==this.$i().wt().length)){if(null!==this.Cp){const t=this.Np.R_();this.Cp.Gi(lightweight_charts_production_b(t))}if(null!==this.Tp){const t=this.Np.D_();this.Tp.Gi(lightweight_charts_production_b(t))}}}Xp(){null!==this.Cp&&this.Cp.bt(),null!==this.Tp&&this.Tp.bt()}M_(){return null!==this.Np?this.Np.M_():0}x_(t){this.Np&&this.Np.x_(t)}Qf(t){if(!this.Np)return;this.Kp();const i=t.localX,n=t.localY;this.Gp(i,n,t)}bv(t){this.Kp(),this.Jp(),this.Gp(t.localX,t.localY,t)}tv(t){var i;if(!this.Np)return;this.Kp();const n=t.localX,s=t.localY;this.Gp(n,s,t);const e=this.wr(n,s);this.Qd.Qp(null!==(i=null==e?void 0:e.Lv)&&void 0!==i?i:null),this.$i().jc(e&&{Hc:e.Hc,Iv:e.Iv})}dv(t){null!==this.Np&&(this.Kp(),this.tm(t))}qf(t){null!==this.Np&&this.im(this.Op,t)}jf(t){this.qf(t)}av(t){this.Kp(),this.nm(t),this.Gp(t.localX,t.localY,t)}cv(t){null!==this.Np&&(this.Kp(),this.Ap=!1,this.sm(t))}uv(t){null!==this.Np&&this.tm(t)}Rv(t){if(this.Ap=!0,null===this.Ip){const i={x:t.localX,y:t.localY};this.rm(i,i,t)}}Pv(t){null!==this.Np&&(this.Kp(),this.Np.$t().jc(null),this.hm())}lm(){return this.Vp}am(){return this.Op}xv(){this.Bp=1,this.$i().Un()}Sv(t,i){if(!this.Qd.W().handleScale.pinch)return;const n=5*(i-this.Bp);this.Bp=i,this.$i().Qc(t.nt,n)}pv(t){this.Ap=!1,this.zp=null!==this.Ip,this.Jp();const i=this.$i().Zc();null!==this.Ip&&i.yt()&&(this.Lp={x:i.Yt(),y:i.Zt()},this.Ip={x:t.localX,y:t.localY})}hv(t){if(null===this.Np)return;const i=t.localX,n=t.localY;if(null===this.Ip)this.nm(t);else{this.zp=!1;const s=lightweight_charts_production_b(this.Lp),e=s.x+(i-this.Ip.x),r=s.y+(n-this.Ip.y);this.Gp(e,r,t)}}_v(t){0===this.$v().W().trackingMode.exitMode&&(this.zp=!0),this.om(),this.sm(t)}wr(t,i){const n=this.Np;return null===n?null:function(t,i,n){const s=t.Uo(),e=function(t,i,n){var s,e;let r,h;for(const o of t){const t=null!==(e=null===(s=o.va)||void 0===s?void 0:s.call(o,i,n))&&void 0!==e?e:[];for(const i of t)l=i.zOrder,(!(a=null==r?void 0:r.zOrder)||"top"===l&&"top"!==a||"normal"===l&&"bottom"===a)&&(r=i,h=o)}var l,a;return r&&h?{zv:r,Hc:h}:null}(s,i,n);if("top"===(null==e?void 0:e.zv.zOrder))return xs(e);for(const r of s){if(e&&e.Hc===r&&"bottom"!==e.zv.zOrder&&!e.zv.isBackground)return xs(e);const s=Ss(r.Pn(t),i,n);if(null!==s)return{Hc:r,Bv:s.Bv,Iv:s.Iv};if(e&&e.Hc===r&&"bottom"!==e.zv.zOrder&&e.zv.isBackground)return xs(e)}return(null==e?void 0:e.zv)?xs(e):null}(n,t,i)}_m(i,n){lightweight_charts_production_b("left"===n?this.Cp:this.Tp).cp(size_size({width:i,height:this.Ev.height}))}um(){return this.Ev}cp(t){equalSizes(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Wp.style.width=t.width+"px",this.Wp.style.height=t.height+"px")}dm(){const t=lightweight_charts_production_b(this.Np);t.P_(t.R_()),t.P_(t.D_());for(const i of t.Ba())if(t.vr(i)){const n=i.Dt();null!==n&&t.P_(n),i.Vn()}}xp(){return this.Gv.bitmapSize}Sp(t,i,n){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,i,n)}vp(t){if(0===t)return;if(null===this.Np)return;if(t>1&&this.dm(),null!==this.Cp&&this.Cp.vp(t),null!==this.Tp&&this.Tp.vp(t),1!==t){this.Gv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Gv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.mp(t)})),this.Np&&(this.fm(t,Ts),this.vm(t),this.pm(t),this.fm(t,Ps),this.fm(t,Rs)))}this.Jv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Jv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.bm(i),this.fm(i,Ds))}wm(){return this.Cp}gm(){return this.Tp}bp(t,i){this.fm(t,i)}Fp(){null!==this.Np&&this.Np.W_().p(this),this.Np=null}tm(t){this.im(this.Vp,t)}im(t,i){const n=i.localX,s=i.localY;t.M()&&t.m(this.$i().St().Nu(n),{x:n,y:s},i)}mp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.$i(),r=e.q(),h=e.bd();r===h?G(t,0,0,n,s,h):tt(t,0,0,n,s,r,h)}vm(t){const i=lightweight_charts_production_b(this.Np).j_().qh().gt();null!==i&&i.X(t,!1)}pm(t){const i=this.$i().Yc();this.Mm(t,Ps,cs,i),this.Mm(t,Ps,ds,i)}bm(t){this.Mm(t,Ps,ds,this.$i().Zc())}fm(t,i){const n=lightweight_charts_production_b(this.Np).Uo();for(const s of n)this.Mm(t,i,cs,s);for(const s of n)this.Mm(t,i,ds,s)}Mm(t,i,n,s){const e=lightweight_charts_production_b(this.Np),r=e.$t().Wc(),h=null!==r&&r.Hc===s,l=null!==r&&h&&void 0!==r.Iv?r.Iv.Mr:void 0;fs(i,(i=>n(i,t,h,l)),s,e)}Zp(){if(null===this.Np)return;const t=this.Qd,i=this.Np.R_().W().visible,n=this.Np.D_().W().visible;i||null===this.Cp||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),n||null===this.Tp||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const s=t.$t().ud();i&&null===this.Cp&&(this.Cp=new Cs(this,t.W(),s,"left"),this.jp.appendChild(this.Cp.lp())),n&&null===this.Tp&&(this.Tp=new Cs(this,t.W(),s,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(t){return t.Dv&&this.Ap||null!==this.Ip}Sm(t){return Math.max(0,Math.min(t,this.Ev.width-1))}km(t){return Math.max(0,Math.min(t,this.Ev.height-1))}Gp(t,i,n){this.$i().ld(this.Sm(t),this.km(i),n,lightweight_charts_production_b(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(t,i,n){this.Ip=t,this.zp=!1,this.Gp(i.x,i.y,n);const s=this.$i().Zc();this.Lp={x:s.Yt(),y:s.Zt()}}$i(){return this.Qd.$t()}sm(t){if(!this.Dp)return;const i=this.$i(),n=this.fp();if(i.z_(n,n.vn()),this.Rp=null,this.Dp=!1,i.ed(),null!==this.Ep){const t=performance.now(),n=i.St();this.Ep.Vr(n.Hu(),t),this.Ep.Qu(t)||i.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(!this.Np)return;if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)lightweight_charts_production_b(document.activeElement).blur();else{const t=document.getSelection();null!==t&&t.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}nm(t){if(null===this.Np)return;const i=this.$i(),n=i.St();if(n.Ni())return;const s=this.Qd.W(),e=s.handleScroll,r=s.kineticScroll;if((!e.pressedMouseMove||t.Dv)&&(!e.horzTouchDrag&&!e.vertTouchDrag||!t.Dv))return;const h=this.Np.vn(),l=performance.now();if(null!==this.Rp||this.xm(t)||(this.Rp={x:t.clientX,y:t.clientY,Od:l,ym:t.localX,Cm:t.localY}),null!==this.Rp&&!this.Dp&&(this.Rp.x!==t.clientX||this.Rp.y!==t.clientY)){if(t.Dv&&r.touch||!t.Dv&&r.mouse){const t=n.le();this.Ep=new as(.2/t,7/t,.997,15/t),this.Ep.Yd(n.Hu(),this.Rp.Od)}else this.Ep=null;h.Ni()||i.A_(this.Np,h,t.localY),i.nd(t.localX),this.Dp=!0}this.Dp&&(h.Ni()||i.I_(this.Np,h,t.localY),i.sd(t.localX),null!==this.Ep&&this.Ep.Yd(n.Hu(),l))}}class Os{constructor(i,n,s,e,r){this.ft=!0,this.Ev=size_size({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv="left"===i,this.Oc=s.ud,this.cn=n,this.Tm=e,this.Pm=r,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=lightweight_charts_production_s(this.Kv,size_size({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),us(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(t){equalSizes(this.Ev,t)||(this.Ev=t,this.Gv.resizeCanvasElement(t),this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`,this.ft=!0)}vp(t){if(t<3&&!this.ft)return;if(0===this.Ev.width||0===this.Ev.height)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Gv);null!==i&&i.useBitmapCoordinateSpace((t=>{this.mp(t),this.Ie(t)}))}xp(){return this.Gv.bitmapSize}Sp(t,i,n){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,i,n)}Ie({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(!this.Tm())return;t.fillStyle=this.cn.timeScale.borderColor;const e=Math.floor(this.Oc.W().C*n),r=Math.floor(this.Oc.W().C*s),h=this.qv?i.width-e:0;t.fillRect(h,0,e,r)}mp({context:t,bitmapSize:i}){G(t,0,0,i.width,i.height,this.Pm())}}function Bs(t){return i=>{var n,s;return null!==(s=null===(n=i.fa)||void 0===n?void 0:n.call(i,t))&&void 0!==s?s:[]}}const As=Bs("normal"),Is=Bs("top"),zs=Bs("bottom");class Ls{constructor(i,n){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=size_size({width:0,height:0}),this.Om=new lightweight_charts_production_D,this.Fv=new ni(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=i,this.q_=n,this.cn=i.W().layout,this.Xd=document.createElement("tr"),this.Bm=document.createElement("td"),this.Bm.style.padding="0",this.Am=document.createElement("td"),this.Am.style.padding="0",this.Kv=document.createElement("td"),this.Kv.style.height="25px",this.Kv.style.padding="0",this.Im=document.createElement("div"),this.Im.style.width="100%",this.Im.style.height="100%",this.Im.style.position="relative",this.Im.style.overflow="hidden",this.Kv.appendChild(this.Im),this.Gv=lightweight_charts_production_s(this.Im,size_size({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const s=this.Gv.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Jv=lightweight_charts_production_s(this.Im,size_size({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const e=this.Jv.canvasElement;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0",this.Xd.appendChild(this.Bm),this.Xd.appendChild(this.Kv),this.Xd.appendChild(this.Am),this.zm(),this.Qd.$t().g_().l(this.zm.bind(this),this),this.hp=new ps(this.Jv.canvasElement,this,{ev:()=>!0,rv:()=>!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.hp.S(),null!==this.Rm&&this.Rm.S(),null!==this.Dm&&this.Dm.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),us(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),us(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(t){if(this.Vm)return;this.Vm=!0;const i=this.Qd.$t();!i.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&i.Jc(t.localX)}pv(t){this.bv(t)}wv(){const t=this.Qd.$t();!t.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&t.hd())}av(t){const i=this.Qd.$t();!i.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&i.rd(t.localX)}hv(t){this.av(t)}cv(){this.Vm=!1;const t=this.Qd.$t();t.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||t.hd()}_v(){this.cv()}qf(){this.Qd.W().handleScale.axisDoubleClickReset.time&&this.Qd.$t().Kn()}jf(){this.qf()}Qf(){this.Qd.$t().W().handleScale.axisPressedMouseMove.time&&this.kp(1)}Pv(){this.kp(0)}um(){return this.Ev}Nm(){return this.Om}Fm(i,s,e){equalSizes(this.Ev,i)||(this.Ev=i,this.jv=!0,this.Gv.resizeCanvasElement(i),this.Jv.resizeCanvasElement(i),this.jv=!1,this.Kv.style.width=`${i.width}px`,this.Kv.style.height=`${i.height}px`,this.Om.m(i)),null!==this.Rm&&this.Rm.cp(size_size({width:s,height:i.height})),null!==this.Dm&&this.Dm.cp(size_size({width:e,height:i.height}))}Wm(){const t=this.jm();return Math.ceil(t.C+t.T+t.P+t.L+t.B+t.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(t,i,n){const s=this.xp();s.width>0&&s.height>0&&t.drawImage(this.Gv.canvasElement,i,n)}vp(t){if(0===t)return;if(1!==t){this.Gv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Gv);null!==i&&(i.useBitmapCoordinateSpace((t=>{this.mp(t),this.Ie(t),this.$m(i,zs)})),this.wp(i),this.$m(i,As)),null!==this.Rm&&this.Rm.vp(t),null!==this.Dm&&this.Dm.vp(t)}this.Jv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Jv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],i),this.$m(i,Is))}$m(t,i){const n=this.Qd.$t().wt();for(const s of n)fs(i,(i=>cs(i,t,!1,void 0)),s,void 0);for(const s of n)fs(i,(i=>ds(i,t,!1,void 0)),s,void 0)}mp({context:t,bitmapSize:i}){G(t,0,0,i.width,i.height,this.Qd.$t().bd())}Ie({context:t,bitmapSize:i,verticalPixelRatio:n}){if(this.Qd.W().timeScale.borderVisible){t.fillStyle=this.qm();const s=Math.max(1,Math.floor(this.jm().C*n));t.fillRect(0,0,i.width,s)}}wp(t){const i=this.Qd.$t().St(),n=i.Ha();if(!n||0===n.length)return;const s=this.q_.maxTickMarkWeight(n),e=this.jm(),r=i.W();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this.qm(),t.fillStyle=this.qm();const r=Math.max(1,Math.floor(i)),h=Math.floor(.5*i);t.beginPath();const l=Math.round(e.T*s);for(let s=n.length;s--;){const e=Math.round(n[s].coord*i);t.rect(e-h,0,r,l)}t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{const i=e.C+e.T+e.L+e.P/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.$(),t.font=this._p();for(const e of n)if(e.weight<s){const n=e.needAlignCoordinate?this.Ym(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i)}this.Qd.W().timeScale.allowBoldLabels&&(t.font=this.Zm());for(const e of n)if(e.weight>=s){const n=e.needAlignCoordinate?this.Ym(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i)}}))}Ym(t,i,n){const s=this.Fv.xi(t,n),e=s/2,r=Math.floor(i-e)+.5;return r<0?i+=Math.abs(0-r):r+s>this.Ev.width&&(i-=Math.abs(this.Ev.width-(r+s))),i}Um(t,i){const n=this.jm();for(const s of t)for(const t of s.Qi())t.gt().X(i,n)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return F(this.j(),this.cn.fontFamily)}Zm(){return F(this.j(),this.cn.fontFamily,"bold")}jm(){null===this.k&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new ni,Hm:0});const t=this.k,i=this._p();if(t.R!==i){const n=this.j();t.P=n,t.R=i,t.L=3*n/12,t.B=3*n/12,t.ji=9*n/12,t.N=0,t.Hm=4*n/12,t.Wi.nr()}return this.k}kp(t){this.Kv.style.cursor=1===t?"ew-resize":"default"}zm(){const t=this.Qd.$t(),i=t.W();i.leftPriceScale.visible||null===this.Rm||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),i.rightPriceScale.visible||null===this.Dm||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const n={ud:this.Qd.$t().ud()},s=()=>i.leftPriceScale.borderVisible&&t.St().W().borderVisible,e=()=>t.bd();i.leftPriceScale.visible&&null===this.Rm&&(this.Rm=new Os("left",i,n,s,e),this.Bm.appendChild(this.Rm.lp())),i.rightPriceScale.visible&&null===this.Dm&&(this.Dm=new Os("right",i,n,s,e),this.Am.appendChild(this.Dm.lp()))}}const Es=!!ns&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!ns&&((null===(Ns=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===Ns?void 0:Ns.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var Ns;class Fs{constructor(t,i,n){var s;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new lightweight_charts_production_D,this.Op=new lightweight_charts_production_D,this.Rc=new lightweight_charts_production_D,this.ib=null,this.nb=null,this.Jd=t,this.cn=i,this.q_=n,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(s=this.Xd).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Ws(this.cn)&&this.hb(!0),this.$i=new Ln(this.Vc.bind(this),this.cn,n),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new Ls(this,this.q_),this.sb.appendChild(this.ab.lp());const e=i.autoSize&&this.ob();let r=this.cn.width,h=this.cn.height;if(e||0===r||0===h){const i=t.getBoundingClientRect();r=r||i.width,h=h||i.height}this._b(r,h),this.ub(),t.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),0!==this.Km&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const t of this.Xm)this.sb.removeChild(t.lp()),t.lm().p(this),t.am().p(this),t.S();this.Xm=[],lightweight_charts_production_b(this.ab).S(),null!==this.Xd.parentElement&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(i,n,s=!1){if(this.ho===n&&this.__===i)return;const e=function(i){const n=Math.floor(i.width),s=Math.floor(i.height);return size_size({width:n-n%2,height:s-s%2})}(size_size({width:i,height:n}));this.ho=e.height,this.__=e.width;const r=this.ho+"px",h=this.__+"px";lightweight_charts_production_b(this.Xd).style.height=r,lightweight_charts_production_b(this.Xd).style.width=h,this.sb.style.height=r,this.sb.style.width=h,s?this.mb(ut.es(),performance.now()):this.$i.Kl()}vp(t){void 0===t&&(t=ut.es());for(let i=0;i<this.Xm.length;i++)this.Xm[i].vp(t.Hn(i).Fn);this.cn.timeScale.visible&&this.ab.vp(t.jn())}$h(t){const i=Ws(this.cn);this.$i.$h(t);const n=Ws(this.cn);n!==i&&this.hb(n),this.cb(),this.bb(t)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){null!==this.Qm&&(this.mb(this.Qm,performance.now()),this.Qm=null);const t=this.gb(null),i=document.createElement("canvas");i.width=t.width,i.height=t.height;const n=lightweight_charts_production_b(i.getContext("2d"));return this.gb(n),i}Mb(t){if("left"===t&&!this.xb())return 0;if("right"===t&&!this.Sb())return 0;if(0===this.Xm.length)return 0;return lightweight_charts_production_b("left"===t?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&null!==this.ib}yb(){return this.Xd}Qp(t){this.nb=t,this.nb?this.yb().style.setProperty("cursor",t):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return lightweight_charts_production_m(this.Xm[0]).um()}bb(t){(void 0!==t.autoSize||!this.ib||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.ib&&this.ob(),!1===t.autoSize&&null!==this.ib&&this.pb(),t.autoSize||void 0===t.width&&void 0===t.height||this._b(t.width||this.__,t.height||this.ho))}gb(i){let n=0,s=0;const e=this.Xm[0],r=(t,n)=>{let s=0;for(let e=0;e<this.Xm.length;e++){const r=this.Xm[e],h=lightweight_charts_production_b("left"===t?r.wm():r.gm()),l=h.xp();null!==i&&h.Sp(i,n,s),s+=l.height}};if(this.xb()){r("left",0);n+=lightweight_charts_production_b(e.wm()).xp().width}for(let t=0;t<this.Xm.length;t++){const e=this.Xm[t],r=e.xp();null!==i&&e.Sp(i,n,s),s+=r.height}if(n+=e.xp().width,this.Sb()){r("right",n);n+=lightweight_charts_production_b(e.gm()).xp().width}const h=(t,n,s)=>{lightweight_charts_production_b("left"===t?this.ab.Lm():this.ab.Em()).Sp(lightweight_charts_production_b(i),n,s)};if(this.cn.timeScale.visible){const t=this.ab.xp();if(null!==i){let n=0;this.xb()&&(h("left",n,s),n=lightweight_charts_production_b(e.wm()).xp().width),this.ab.Sp(i,n,s),n+=t.width,this.Sb()&&h("right",n,s)}s+=t.height}return size_size({width:n,height:s})}Pb(){let i=0,n=0,s=0;for(const t of this.Xm)this.xb()&&(n=Math.max(n,lightweight_charts_production_b(t.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(s=Math.max(s,lightweight_charts_production_b(t.gm()).op(),this.cn.rightPriceScale.minimumWidth)),i+=t.M_();n=rs(n),s=rs(s);const e=this.__,r=this.ho,h=Math.max(e-n-s,0),l=this.cn.timeScale.visible;let a=l?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var o;a=(o=a)+o%2;const _=0+a,u=r<_?0:r-_,c=u/i;let d=0;for(let i=0;i<this.Xm.length;++i){const e=this.Xm[i];e.qp(this.$i.qc()[i]);let r=0,l=0;l=i===this.Xm.length-1?u-d:Math.round(e.M_()*c),r=Math.max(l,2),d+=r,e.cp(size_size({width:h,height:r})),this.xb()&&e._m(n,"left"),this.Sb()&&e._m(s,"right"),e.fp()&&this.$i.Kc(e.fp(),r)}this.ab.Fm(size_size({width:l?h:0,height:a}),l?n:0,l?s:0),this.$i.S_(h),this.Gm!==n&&(this.Gm=n),this.Jm!==s&&(this.Jm=s)}hb(t){t?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return Es?1/window.devicePixelRatio:1}rb(t){if(!(0!==t.deltaX&&this.cn.handleScroll.mouseWheel||0!==t.deltaY&&this.cn.handleScale.mouseWheel))return;const i=this.Rb(t),n=i*t.deltaX/100,s=-i*t.deltaY/100;if(t.cancelable&&t.preventDefault(),0!==s&&this.cn.handleScale.mouseWheel){const i=Math.sign(s)*Math.min(1,Math.abs(s)),n=t.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(n,i)}0!==n&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*n)}mb(t,i){var n;const s=t.jn();3===s&&this.Db(),3!==s&&2!==s||(this.Vb(t),this.Ob(t,i),this.ab.bt(),this.Xm.forEach((t=>{t.Xp()})),3===(null===(n=this.Qm)||void 0===n?void 0:n.jn())&&(this.Qm.ts(t),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,i),t=this.Qm,this.Qm=null)),this.vp(t)}Ob(t,i){for(const n of t.Qn())this.ns(n,i)}Vb(t){const i=this.$i.qc();for(let n=0;n<i.length;n++)t.Hn(n).Wn&&i[n].N_()}ns(t,i){const n=this.$i.St();switch(t.qn){case 0:n.hc();break;case 1:n.lc(t.Vt);break;case 2:n.Gn(t.Vt);break;case 3:n.Jn(t.Vt);break;case 4:n.qu();break;case 5:t.Vt.Qu(i)||n.Jn(t.Vt.tc(i))}}Vc(t){null!==this.Qm?this.Qm.ts(t):this.Qm=t,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((t=>{if(this.tb=!1,this.Km=0,null!==this.Qm){const i=this.Qm;this.Qm=null,this.mb(i,t);for(const n of i.Qn())if(5===n.qn&&!n.Vt.Qu(t)){this.$t().Zn(n.Vt);break}}})))}Db(){this.ub()}ub(){const t=this.$i.qc(),i=t.length,n=this.Xm.length;for(let t=i;t<n;t++){const t=lightweight_charts_production_m(this.Xm.pop());this.sb.removeChild(t.lp()),t.lm().p(this),t.am().p(this),t.S()}for(let s=n;s<i;s++){const i=new Vs(this,t[s]);i.lm().l(this.Bb.bind(this),this),i.am().l(this.Ab.bind(this),this),this.Xm.push(i),this.sb.insertBefore(i.lp(),this.ab.lp())}for(let n=0;n<i;n++){const i=t[n],s=this.Xm[n];s.fp()!==i?s.qp(i):s.Up()}this.cb(),this.Pb()}Ib(t,i,n){var s;const e=new Map;if(null!==t){this.$i.wt().forEach((i=>{const n=i.In().ll(t);null!==n&&e.set(i,n)}))}let r;if(null!==t){const i=null===(s=this.$i.St().Ui(t))||void 0===s?void 0:s.originalTime;void 0!==i&&(r=i)}const h=this.$t().Wc(),l=null!==h&&h.Hc instanceof Gi?h.Hc:void 0,a=null!==h&&void 0!==h.Iv?h.Iv.gr:void 0;return{zb:r,ee:null!=t?t:void 0,Lb:null!=i?i:void 0,Eb:l,Nb:e,Fb:a,Wb:null!=n?n:void 0}}Bb(t,i,n){this.Vp.m((()=>this.Ib(t,i,n)))}Ab(t,i,n){this.Op.m((()=>this.Ib(t,i,n)))}lb(t,i,n){this.Rc.m((()=>this.Ib(t,i,n)))}cb(){const t=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=t}xb(){return this.Xm[0].fp().R_().W().visible}Sb(){return this.Xm[0].fp().D_().W().visible}ob(){return"ResizeObserver"in window&&(this.ib=new ResizeObserver((t=>{const i=t.find((t=>t.target===this.Jd));i&&this._b(i.contentRect.width,i.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){null!==this.ib&&this.ib.disconnect(),this.ib=null}}function Ws(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function js(t){return function(t){return void 0!==t.open}(t)||function(t){return void 0!==t.value}(t)}function Hs(t,i){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(s=Object.getOwnPropertySymbols(t);e<s.length;e++)i.indexOf(s[e])<0&&Object.prototype.propertyIsEnumerable.call(t,s[e])&&(n[s[e]]=t[s[e]])}return n}function $s(t,i,n,s){const e=n.value,r={ee:i,ot:t,Vt:[e,e,e,e],zb:s};return void 0!==n.color&&(r.V=n.color),r}function Us(t,i,n,s){const e=n.value,r={ee:i,ot:t,Vt:[e,e,e,e],zb:s};return void 0!==n.lineColor&&(r.lt=n.lineColor),void 0!==n.topColor&&(r.Ps=n.topColor),void 0!==n.bottomColor&&(r.Rs=n.bottomColor),r}function qs(t,i,n,s){const e=n.value,r={ee:i,ot:t,Vt:[e,e,e,e],zb:s};return void 0!==n.topLineColor&&(r.Re=n.topLineColor),void 0!==n.bottomLineColor&&(r.De=n.bottomLineColor),void 0!==n.topFillColor1&&(r.ke=n.topFillColor1),void 0!==n.topFillColor2&&(r.ye=n.topFillColor2),void 0!==n.bottomFillColor1&&(r.Ce=n.bottomFillColor1),void 0!==n.bottomFillColor2&&(r.Te=n.bottomFillColor2),r}function Ys(t,i,n,s){const e={ee:i,ot:t,Vt:[n.open,n.high,n.low,n.close],zb:s};return void 0!==n.color&&(e.V=n.color),e}function Zs(t,i,n,s){const e={ee:i,ot:t,Vt:[n.open,n.high,n.low,n.close],zb:s};return void 0!==n.color&&(e.V=n.color),void 0!==n.borderColor&&(e.Ot=n.borderColor),void 0!==n.wickColor&&(e.Xh=n.wickColor),e}function Xs(t,i,n,s,e){const r=lightweight_charts_production_m(e)(n),h=Math.max(...r),l=Math.min(...r),a=r[r.length-1],o=[a,h,l,a],_=n,{time:u,color:c}=_;return{ee:i,ot:t,Vt:o,zb:s,$e:Hs(_,["time","color"]),V:c}}function Ks(t){return void 0!==t.Vt}function Gs(t,i){return void 0!==i.customValues&&(t.jb=i.customValues),t}function Js(t){return(i,n,s,e,r,h)=>function(t,i){return i?i(t):void 0===(n=t).open&&void 0===n.value;var n}(s,h)?Gs({ot:i,ee:n,zb:e},s):Gs(t(i,n,s,e,r),s)}function Qs(t){return{Candlestick:Js(Zs),Bar:Js(Ys),Area:Js(Us),Baseline:Js(qs),Histogram:Js($s),Line:Js($s),Custom:Js(Xs)}[t]}function te(t){return{ee:0,Hb:new Map,la:t}}function ie(t,i){if(void 0!==t&&0!==t.length)return{$b:i.key(t[0].ot),Ub:i.key(t[t.length-1].ot)}}function ne(t){let i;return t.forEach((t=>{void 0===i&&(i=t.zb)})),lightweight_charts_production_m(i)}class se{constructor(t){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=t}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(t,i){let n=0!==this.qb.size,s=!1;const e=this.Yb.get(t);if(void 0!==e)if(1===this.Yb.size)n=!1,s=!0,this.qb.clear();else for(const i of this.Xb)i.pointData.Hb.delete(t)&&(s=!0);let r=[];if(0!==i.length){const n=i.map((t=>t.time)),e=this.q_.createConverterToInternalObj(i),h=Qs(t.Qh()),l=t.Ca(),a=t.Ta();r=i.map(((i,r)=>{const o=e(i.time),_=this.q_.key(o);let u=this.qb.get(_);void 0===u&&(u=te(o),this.qb.set(_,u),s=!0);const c=h(o,u.ee,i,n[r],l,a);return u.Hb.set(t,c),c}))}n&&this.Gb(),this.Jb(t,r);let h=-1;if(s){const t=[];this.qb.forEach((i=>{t.push({timeWeight:0,time:i.la,pointData:i,originalTime:ne(i.Hb)})})),t.sort(((t,i)=>this.q_.key(t.time)-this.q_.key(i.time))),h=this.Qb(t)}return this.tw(t,h,function(t,i,n){const s=ie(t,n),e=ie(i,n);if(void 0!==s&&void 0!==e)return{ta:s.Ub>=e.Ub&&s.$b>=e.$b}}(this.Yb.get(t),e,this.q_))}vd(t){return this.Kb(t,[])}iw(t,i){const n=i;!function(t){void 0===t.zb&&(t.zb=t.time)}(n),this.q_.preprocessData(i);const s=this.q_.createConverterToInternalObj([i])(i.time),e=this.Zb.get(t);if(void 0!==e&&this.q_.key(s)<this.q_.key(e))throw new Error(`Cannot update oldest data, last time=${e}, new time=${s}`);let r=this.qb.get(this.q_.key(s));const h=void 0===r;void 0===r&&(r=te(s),this.qb.set(this.q_.key(s),r));const l=Qs(t.Qh()),a=t.Ca(),o=t.Ta(),_=l(s,r.ee,i,n.zb,a,o);r.Hb.set(t,_),this.nw(t,_);const u={ta:Ks(_)};if(!h)return this.tw(t,-1,u);const c={timeWeight:0,time:r.la,pointData:r,originalTime:ne(r.Hb)},d=Bt(this.Xb,this.q_.key(c.time),((t,i)=>this.q_.key(t.time)<i));this.Xb.splice(d,0,c);for(let t=d;t<this.Xb.length;++t)ee(this.Xb[t].pointData,t);return this.q_.fillWeightsForPoints(this.Xb,d),this.tw(t,d,u)}nw(t,i){let n=this.Yb.get(t);void 0===n&&(n=[],this.Yb.set(t,n));const s=0!==n.length?n[n.length-1]:null;null===s||this.q_.key(i.ot)>this.q_.key(s.ot)?Ks(i)&&n.push(i):Ks(i)?n[n.length-1]=i:n.splice(-1,1),this.Zb.set(t,i.ot)}Jb(t,i){0!==i.length?(this.Yb.set(t,i.filter(Ks)),this.Zb.set(t,i[i.length-1].ot)):(this.Yb.delete(t),this.Zb.delete(t))}Gb(){for(const t of this.Xb)0===t.pointData.Hb.size&&this.qb.delete(this.q_.key(t.time))}Qb(t){let i=-1;for(let n=0;n<this.Xb.length&&n<t.length;++n){const s=this.Xb[n],e=t[n];if(this.q_.key(s.time)!==this.q_.key(e.time)){i=n;break}e.timeWeight=s.timeWeight,ee(e.pointData,n)}if(-1===i&&this.Xb.length!==t.length&&(i=Math.min(this.Xb.length,t.length)),-1===i)return-1;for(let n=i;n<t.length;++n)ee(t[n].pointData,n);return this.q_.fillWeightsForPoints(t,i),this.Xb=t,i}sw(){if(0===this.Yb.size)return null;let t=0;return this.Yb.forEach((i=>{0!==i.length&&(t=Math.max(t,i[i.length-1].ee))})),t}tw(t,i,n){const s={ew:new Map,St:{Eu:this.sw()}};if(-1!==i)this.Yb.forEach(((i,e)=>{s.ew.set(e,{$e:i,rw:e===t?n:void 0})})),this.Yb.has(t)||s.ew.set(t,{$e:[],rw:n}),s.St.hw=this.Xb,s.St.lw=i;else{const i=this.Yb.get(t);s.ew.set(t,{$e:i||[],rw:n})}return s}}function ee(t,i){t.ee=i,t.Hb.forEach((t=>{t.ee=i}))}function re(t){const i={value:t.Vt[3],time:t.zb};return void 0!==t.jb&&(i.customValues=t.jb),i}function he(t){const i=re(t);return void 0!==t.V&&(i.color=t.V),i}function le(t){const i=re(t);return void 0!==t.lt&&(i.lineColor=t.lt),void 0!==t.Ps&&(i.topColor=t.Ps),void 0!==t.Rs&&(i.bottomColor=t.Rs),i}function ae(t){const i=re(t);return void 0!==t.Re&&(i.topLineColor=t.Re),void 0!==t.De&&(i.bottomLineColor=t.De),void 0!==t.ke&&(i.topFillColor1=t.ke),void 0!==t.ye&&(i.topFillColor2=t.ye),void 0!==t.Ce&&(i.bottomFillColor1=t.Ce),void 0!==t.Te&&(i.bottomFillColor2=t.Te),i}function oe(t){const i={open:t.Vt[0],high:t.Vt[1],low:t.Vt[2],close:t.Vt[3],time:t.zb};return void 0!==t.jb&&(i.customValues=t.jb),i}function lightweight_charts_production_e(t){const i=oe(t);return void 0!==t.V&&(i.color=t.V),i}function ue(t){const i=oe(t),{V:n,Ot:s,Xh:e}=t;return void 0!==n&&(i.color=n),void 0!==s&&(i.borderColor=s),void 0!==e&&(i.wickColor=e),i}function ce(t){return{Area:le,Line:he,Baseline:ae,Histogram:he,Bar:lightweight_charts_production_e,Candlestick:ue,Custom:de}[t]}function de(t){const i=t.zb;return Object.assign(Object.assign({},t.$e),{time:i})}const fe={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},ve={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},pe={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:N,attributionLogo:!0},me={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0},be={rightOffset:0,barSpacing:6,minBarSpacing:.5,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0},we={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:N,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function ge(){return{width:0,height:0,autoSize:!1,layout:pe,crosshair:fe,grid:ve,overlayPriceScales:Object.assign({},me),leftPriceScale:Object.assign(Object.assign({},me),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},me),{visible:!0}),timeScale:be,watermark:we,localization:{locale:ns?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class Me{constructor(t,i){this.aw=t,this.ow=i}applyOptions(t){this.aw.$t().$c(this.ow,t)}options(){return this.Li().W()}width(){return _t(this.ow)?this.aw.Mb(this.ow):0}Li(){return lightweight_charts_production_b(this.aw.$t().Uc(this.ow)).Dt}}function xe(t,i,n){const s=Hs(t,["time","originalTime"]),e=Object.assign({time:i},s);return void 0!==n&&(e.originalTime=n),e}const Se={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class ke{constructor(t){this.Nh=t}applyOptions(t){this.Nh.$h(t)}options(){return this.Nh.W()}_w(){return this.Nh}}class ye{constructor(t,i,n,s,e){this.uw=new lightweight_charts_production_D,this.Es=t,this.cw=i,this.dw=n,this.q_=e,this.fw=s}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(t){const i=this.Es.Ct();return null===i?null:this.Es.Dt().Rt(t,i.Vt)}coordinateToPrice(t){const i=this.Es.Ct();return null===i?null:this.Es.Dt().pn(t,i.Vt)}barsInLogicalRange(t){if(null===t)return null;const i=new yn(new xn(t.from,t.to)).lu(),n=this.Es.In();if(n.Ni())return null;const s=n.ll(i.Os(),1),e=n.ll(i.ui(),-1),r=lightweight_charts_production_b(n.el()),h=lightweight_charts_production_b(n.An());if(null!==s&&null!==e&&s.ee>e.ee)return{barsBefore:t.from-r,barsAfter:h-t.to};const l={barsBefore:null===s||s.ee===r?t.from-r:s.ee-r,barsAfter:null===e||e.ee===h?h-t.to:h-e.ee};return null!==s&&null!==e&&(l.from=s.zb,l.to=e.zb),l}setData(t){this.q_,this.Es.Qh(),this.cw.pw(this.Es,t),this.mw("full")}update(t){this.Es.Qh(),this.cw.bw(this.Es,t),this.mw("update")}dataByIndex(t,i){const n=this.Es.In().ll(t,i);if(null===n)return null;return ce(this.seriesType())(n)}data(){const t=ce(this.seriesType());return this.Es.In().ne().map((i=>t(i)))}subscribeDataChanged(t){this.uw.l(t)}unsubscribeDataChanged(t){this.uw.v(t)}setMarkers(t){this.q_;const i=t.map((t=>xe(t,this.q_.convertHorzItemToInternal(t.time),t.time)));this.Es.na(i)}markers(){return this.Es.sa().map((t=>xe(t,t.originalTime,void 0)))}applyOptions(t){this.Es.$h(t)}options(){return lightweight_charts_production_z(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(t){const i=lightweight_charts_production_V(lightweight_charts_production_z(Se),t),n=this.Es.ea(i);return new ke(n)}removePriceLine(t){this.Es.ra(t._w())}seriesType(){return this.Es.Qh()}attachPrimitive(t){this.Es.ka(t),t.attached&&t.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(t){this.Es.ya(t),t.detached&&t.detached()}mw(t){this.uw.M()&&this.uw.m(t)}}class Ce{constructor(t,i,n){this.ww=new lightweight_charts_production_D,this.mu=new lightweight_charts_production_D,this.Om=new lightweight_charts_production_D,this.$i=t,this.yl=t.St(),this.ab=i,this.yl.nc().l(this.gw.bind(this)),this.yl.sc().l(this.Mw.bind(this)),this.ab.Nm().l(this.xw.bind(this)),this.q_=n}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(t,i){i?this.yl.Ju(t,1e3):this.$i.Jn(t)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const t=this.yl.Vu();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const i={from:this.q_.convertHorzItemToInternal(t.from),to:this.q_.convertHorzItemToInternal(t.to)},n=this.yl.Iu(i);this.$i.pd(n)}getVisibleLogicalRange(){const t=this.yl.Du();return null===t?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){lightweight_charts_production_p(t.from<=t.to,"The from index cannot be after the to index."),this.$i.pd(t)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(t){const i=this.$i.St();return i.Ni()?null:i.It(t)}coordinateToLogical(t){return this.yl.Ni()?null:this.yl.Nu(t)}timeToCoordinate(t){const i=this.q_.convertHorzItemToInternal(t),n=this.yl.Va(i,!1);return null===n?null:this.yl.It(n)}coordinateToTime(t){const i=this.$i.St(),n=i.Nu(t),s=i.Ui(n);return null===s?null:s.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(t){this.ww.l(t)}unsubscribeVisibleTimeRangeChange(t){this.ww.v(t)}subscribeVisibleLogicalRangeChange(t){this.mu.l(t)}unsubscribeVisibleLogicalRangeChange(t){this.mu.v(t)}subscribeSizeChange(t){this.Om.l(t)}unsubscribeSizeChange(t){this.Om.v(t)}applyOptions(t){this.yl.$h(t)}options(){return Object.assign(Object.assign({},lightweight_charts_production_z(this.yl.W())),{barSpacing:this.yl.le()})}gw(){this.ww.M()&&this.ww.m(this.getVisibleRange())}Mw(){this.mu.M()&&this.mu.m(this.getVisibleLogicalRange())}xw(t){this.Om.m(t.width,t.height)}}function Te(t){if(void 0===t||"custom"===t.type)return;const i=t;void 0!==i.minMove&&void 0===i.precision&&(i.precision=function(t){if(t>=1)return 0;let i=0;for(;i<8;i++){const n=Math.round(t);if(Math.abs(n-t)<1e-8)return i;t*=10}return i}(i.minMove))}function Pe(t){return function(t){if(lightweight_charts_production_I(t.handleScale)){const i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(void 0!==t.handleScale){const{axisPressedMouseMove:i,axisDoubleClickReset:n}=t.handleScale;lightweight_charts_production_I(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),lightweight_charts_production_I(n)&&(t.handleScale.axisDoubleClickReset={time:n,price:n})}const i=t.handleScroll;lightweight_charts_production_I(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i})}(t),t}class Re{constructor(t,i,n){this.Sw=new Map,this.kw=new Map,this.yw=new lightweight_charts_production_D,this.Cw=new lightweight_charts_production_D,this.Tw=new lightweight_charts_production_D,this.Pw=new se(i);const s=void 0===n?lightweight_charts_production_z(ge()):lightweight_charts_production_V(lightweight_charts_production_z(ge()),Pe(n));this.q_=i,this.aw=new Fs(t,s,i),this.aw.lm().l((t=>{this.yw.M()&&this.yw.m(this.Rw(t()))}),this),this.aw.am().l((t=>{this.Cw.M()&&this.Cw.m(this.Rw(t()))}),this),this.aw.Xc().l((t=>{this.Tw.M()&&this.Tw.m(this.Rw(t()))}),this);const e=this.aw.$t();this.Dw=new Ce(e,this.aw.fb(),this.q_)}remove(){this.aw.lm().p(this),this.aw.am().p(this),this.aw.Xc().p(this),this.Dw.S(),this.aw.S(),this.Sw.clear(),this.kw.clear(),this.yw.S(),this.Cw.S(),this.Tw.S(),this.Pw.S()}resize(t,i,n){this.autoSizeActive()||this.aw._b(t,i,n)}addCustomSeries(t,i){const n=lightweight_charts_production_w(t),s=Object.assign(Object.assign({},lightweight_charts_production_),n.defaultOptions());return this.Vw("Custom",s,i,n)}addAreaSeries(t){return this.Vw("Area",lightweight_charts_production_l,t)}addBaselineSeries(t){return this.Vw("Baseline",lightweight_charts_production_a,t)}addBarSeries(t){return this.Vw("Bar",lightweight_charts_production_r,t)}addCandlestickSeries(t={}){return function(t){void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)}(t),this.Vw("Candlestick",dist_lightweight_charts_production_e,t)}addHistogramSeries(t){return this.Vw("Histogram",lightweight_charts_production_o,t)}addLineSeries(t){return this.Vw("Line",lightweight_charts_production_h,t)}removeSeries(t){const i=lightweight_charts_production_m(this.Sw.get(t)),n=this.Pw.vd(i);this.aw.$t().vd(i),this.Ow(n),this.Sw.delete(t),this.kw.delete(i)}pw(t,i){this.Ow(this.Pw.Kb(t,i))}bw(t,i){this.Ow(this.Pw.iw(t,i))}subscribeClick(t){this.yw.l(t)}unsubscribeClick(t){this.yw.v(t)}subscribeCrosshairMove(t){this.Tw.l(t)}unsubscribeCrosshairMove(t){this.Tw.v(t)}subscribeDblClick(t){this.Cw.l(t)}unsubscribeDblClick(t){this.Cw.v(t)}priceScale(t){return new Me(this.aw,t)}timeScale(){return this.Dw}applyOptions(t){this.aw.$h(Pe(t))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const t=this.aw.Tb();return{height:t.height,width:t.width}}setCrosshairPosition(t,i,n){const s=this.Sw.get(n);if(void 0===s)return;const e=this.aw.$t().dr(s);null!==e&&this.aw.$t().ad(t,i,e)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(t,i,n={},s){Te(n.priceFormat);const e=lightweight_charts_production_V(lightweight_charts_production_z(lightweight_charts_production_u),lightweight_charts_production_z(i),n),r=this.aw.$t().dd(t,e,s),h=new ye(r,this,this,this,this.q_);return this.Sw.set(h,r),this.kw.set(r,h),h}Ow(t){const i=this.aw.$t();i._d(t.St.Eu,t.St.hw,t.St.lw),t.ew.forEach(((t,i)=>i.J(t.$e,t.rw))),i.Wu()}Bw(t){return lightweight_charts_production_m(this.kw.get(t))}Rw(t){const i=new Map;t.Nb.forEach(((t,n)=>{const s=n.Qh(),e=ce(s)(t);if("Custom"!==s)lightweight_charts_production_p(js(e));else{const t=n.Ta();lightweight_charts_production_p(!t||!1===t(e))}i.set(this.Bw(n),e)}));const n=void 0!==t.Eb&&this.kw.has(t.Eb)?this.Bw(t.Eb):void 0;return{time:t.zb,logical:t.ee,point:t.Lb,hoveredSeries:n,hoveredObjectId:t.Fb,seriesData:i,sourceEvent:t.Wb}}}function De(t,i,n){let s;if(lightweight_charts_production_A(t)){const i=document.getElementById(t);lightweight_charts_production_p(null!==i,`Cannot find element in DOM with id=${t}`),s=i}else s=t;const e=new Re(s,i,n);return i.setOptions(e.options()),e}function Ve(t,i){return De(t,new is,is.Id(i))}function Oe(){return is}const Be=Object.assign(Object.assign({},lightweight_charts_production_u),lightweight_charts_production_);function Ae(){return"4.2.3"}
1144
-
1145
- ;// CONCATENATED MODULE: ./src/chart/useInitChart.ts
1146
- function _object_without_properties(source, excluded) {
1147
- if (source == null) return {};
1148
- var target = _object_without_properties_loose(source, excluded);
1149
- var key, i;
1150
- if (Object.getOwnPropertySymbols) {
1151
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1152
- for(i = 0; i < sourceSymbolKeys.length; i++){
1153
- key = sourceSymbolKeys[i];
1154
- if (excluded.indexOf(key) >= 0) continue;
1155
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1156
- target[key] = source[key];
1157
- }
1158
- }
1159
- return target;
1160
- }
1161
- function _object_without_properties_loose(source, excluded) {
1162
- if (source == null) return {};
1163
- var target = {};
1164
- var sourceKeys = Object.keys(source);
1165
- var key, i;
1166
- for(i = 0; i < sourceKeys.length; i++){
1167
- key = sourceKeys[i];
1168
- if (excluded.indexOf(key) >= 0) continue;
1169
- target[key] = source[key];
1170
- }
1171
- return target;
1172
- }
1173
-
1174
-
1175
- var useInitChart = function(_param) {
1176
- var container = _param.container, rest = _object_without_properties(_param, [
1177
- "container"
1178
- ]);
1179
- var onClick = rest.onClick, onCrosshairMove = rest.onCrosshairMove, onInit = rest.onInit, restOptions = _object_without_properties(rest, [
1180
- "onClick",
1181
- "onCrosshairMove",
1182
- "onInit"
1183
- ]);
1184
- var chartApiRef = (0,react.useRef)({
1185
- _chart: null,
1186
- api: function() {
1187
- if (this._chart === null && !this.destroyed) {
1188
- this._chart = Ve(container, restOptions);
1189
- if (onInit) {
1190
- onInit(this._chart);
1191
- }
1192
- }
1193
- return this._chart;
1194
- },
1195
- clear: function() {
1196
- if (this._chart !== null) {
1197
- this._chart.remove();
1198
- this._chart = null;
1199
- this.destroyed = true;
1200
- }
1201
- },
1202
- destroyed: false
1203
- });
1204
- (0,react.useLayoutEffect)(function() {
1205
- chartApiRef.current.api();
1206
- return function() {
1207
- chartApiRef.current.clear();
1208
- };
1209
- }, []);
1210
- (0,react.useLayoutEffect)(function() {
1211
- if (!container) return;
1212
- if (onClick) {
1213
- var _chartApiRef_current_api;
1214
- (_chartApiRef_current_api = chartApiRef.current.api()) === null || _chartApiRef_current_api === void 0 ? void 0 : _chartApiRef_current_api.subscribeClick(onClick);
1215
- }
1216
- return function() {
1217
- if (onClick) {
1218
- var _chartApiRef_current_api;
1219
- (_chartApiRef_current_api = chartApiRef.current.api()) === null || _chartApiRef_current_api === void 0 ? void 0 : _chartApiRef_current_api.unsubscribeClick(onClick);
1220
- }
1221
- };
1222
- }, [
1223
- onClick
1224
- ]);
1225
- (0,react.useLayoutEffect)(function() {
1226
- if (!container) return;
1227
- if (onCrosshairMove) {
1228
- var _chartApiRef_current_api;
1229
- (_chartApiRef_current_api = chartApiRef.current.api()) === null || _chartApiRef_current_api === void 0 ? void 0 : _chartApiRef_current_api.subscribeCrosshairMove(onCrosshairMove);
1230
- }
1231
- return function() {
1232
- if (onCrosshairMove) {
1233
- var _chartApiRef_current_api;
1234
- (_chartApiRef_current_api = chartApiRef.current.api()) === null || _chartApiRef_current_api === void 0 ? void 0 : _chartApiRef_current_api.unsubscribeCrosshairMove(onCrosshairMove);
1235
- }
1236
- };
1237
- }, [
1238
- onCrosshairMove
1239
- ]);
1240
- (0,react.useLayoutEffect)(function() {
1241
- var _chartApiRef_current_api;
1242
- if (!container) return;
1243
- (_chartApiRef_current_api = chartApiRef.current.api()) === null || _chartApiRef_current_api === void 0 ? void 0 : _chartApiRef_current_api.applyOptions(restOptions);
1244
- }, [
1245
- restOptions
1246
- ]);
1247
- return chartApiRef;
1248
- };
1249
-
1250
- ;// CONCATENATED MODULE: ./src/chart/ChartComponent.tsx
1251
- function _define_property(obj, key, value) {
1252
- if (key in obj) {
1253
- Object.defineProperty(obj, key, {
1254
- value: value,
1255
- enumerable: true,
1256
- configurable: true,
1257
- writable: true
1258
- });
1259
- } else {
1260
- obj[key] = value;
1261
- }
1262
- return obj;
1263
- }
1264
- function _object_spread(target) {
1265
- for(var i = 1; i < arguments.length; i++){
1266
- var source = arguments[i] != null ? arguments[i] : {};
1267
- var ownKeys = Object.keys(source);
1268
- if (typeof Object.getOwnPropertySymbols === "function") {
1269
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1270
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1271
- }));
1272
- }
1273
- ownKeys.forEach(function(key) {
1274
- _define_property(target, key, source[key]);
1275
- });
1276
- }
1277
- return target;
1278
- }
1279
- function ChartComponent_object_without_properties(source, excluded) {
1280
- if (source == null) return {};
1281
- var target = ChartComponent_object_without_properties_loose(source, excluded);
1282
- var key, i;
1283
- if (Object.getOwnPropertySymbols) {
1284
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1285
- for(i = 0; i < sourceSymbolKeys.length; i++){
1286
- key = sourceSymbolKeys[i];
1287
- if (excluded.indexOf(key) >= 0) continue;
1288
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1289
- target[key] = source[key];
1290
- }
1291
- }
1292
- return target;
1293
- }
1294
- function ChartComponent_object_without_properties_loose(source, excluded) {
1295
- if (source == null) return {};
1296
- var target = {};
1297
- var sourceKeys = Object.keys(source);
1298
- var key, i;
1299
- for(i = 0; i < sourceKeys.length; i++){
1300
- key = sourceKeys[i];
1301
- if (excluded.indexOf(key) >= 0) continue;
1302
- target[key] = source[key];
1303
- }
1304
- return target;
1305
- }
1306
-
1307
-
1308
-
1309
- var ChartComponent = function(_param) {
1310
- var children = _param.children, container = _param.container, rest = ChartComponent_object_without_properties(_param, [
1311
- "children",
1312
- "container"
1313
- ]);
1314
- var chartApiRef = useInitChart(_object_spread({
1315
- container: container
1316
- }, rest));
1317
- return /*#__PURE__*/ (0,jsx_runtime.jsx)(ChartContext.Provider, {
1318
- value: chartApiRef.current,
1319
- children: children
1320
- });
1321
- };
1322
- /* ESM default export */ var chart_ChartComponent = (ChartComponent);
1323
-
1324
- ;// CONCATENATED MODULE: ./src/chart/ChartWrapper.tsx
1325
- function _array_like_to_array(arr, len) {
1326
- if (len == null || len > arr.length) len = arr.length;
1327
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1328
- return arr2;
1329
- }
1330
- function _array_with_holes(arr) {
1331
- if (Array.isArray(arr)) return arr;
1332
- }
1333
- function ChartWrapper_define_property(obj, key, value) {
1334
- if (key in obj) {
1335
- Object.defineProperty(obj, key, {
1336
- value: value,
1337
- enumerable: true,
1338
- configurable: true,
1339
- writable: true
1340
- });
1341
- } else {
1342
- obj[key] = value;
1343
- }
1344
- return obj;
1345
- }
1346
- function _iterable_to_array_limit(arr, i) {
1347
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1348
- if (_i == null) return;
1349
- var _arr = [];
1350
- var _n = true;
1351
- var _d = false;
1352
- var _s, _e;
1353
- try {
1354
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1355
- _arr.push(_s.value);
1356
- if (i && _arr.length === i) break;
1357
- }
1358
- } catch (err) {
1359
- _d = true;
1360
- _e = err;
1361
- } finally{
1362
- try {
1363
- if (!_n && _i["return"] != null) _i["return"]();
1364
- } finally{
1365
- if (_d) throw _e;
1366
- }
1367
- }
1368
- return _arr;
1369
- }
1370
- function _non_iterable_rest() {
1371
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1372
- }
1373
- function ChartWrapper_object_spread(target) {
1374
- for(var i = 1; i < arguments.length; i++){
1375
- var source = arguments[i] != null ? arguments[i] : {};
1376
- var ownKeys = Object.keys(source);
1377
- if (typeof Object.getOwnPropertySymbols === "function") {
1378
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1379
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1380
- }));
1381
- }
1382
- ownKeys.forEach(function(key) {
1383
- ChartWrapper_define_property(target, key, source[key]);
1384
- });
1385
- }
1386
- return target;
1387
- }
1388
- function ChartWrapper_ownKeys(object, enumerableOnly) {
1389
- var keys = Object.keys(object);
1390
- if (Object.getOwnPropertySymbols) {
1391
- var symbols = Object.getOwnPropertySymbols(object);
1392
- if (enumerableOnly) {
1393
- symbols = symbols.filter(function(sym) {
1394
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1395
- });
1396
- }
1397
- keys.push.apply(keys, symbols);
1398
- }
1399
- return keys;
1400
- }
1401
- function _object_spread_props(target, source) {
1402
- source = source != null ? source : {};
1403
- if (Object.getOwnPropertyDescriptors) {
1404
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1405
- } else {
1406
- ChartWrapper_ownKeys(Object(source)).forEach(function(key) {
1407
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1408
- });
1409
- }
1410
- return target;
1411
- }
1412
- function ChartWrapper_object_without_properties(source, excluded) {
1413
- if (source == null) return {};
1414
- var target = ChartWrapper_object_without_properties_loose(source, excluded);
1415
- var key, i;
1416
- if (Object.getOwnPropertySymbols) {
1417
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1418
- for(i = 0; i < sourceSymbolKeys.length; i++){
1419
- key = sourceSymbolKeys[i];
1420
- if (excluded.indexOf(key) >= 0) continue;
1421
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1422
- target[key] = source[key];
1423
- }
1424
- }
1425
- return target;
1426
- }
1427
- function ChartWrapper_object_without_properties_loose(source, excluded) {
1428
- if (source == null) return {};
1429
- var target = {};
1430
- var sourceKeys = Object.keys(source);
1431
- var key, i;
1432
- for(i = 0; i < sourceKeys.length; i++){
1433
- key = sourceKeys[i];
1434
- if (excluded.indexOf(key) >= 0) continue;
1435
- target[key] = source[key];
1436
- }
1437
- return target;
1438
- }
1439
- function _sliced_to_array(arr, i) {
1440
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
1441
- }
1442
- function _unsupported_iterable_to_array(o, minLen) {
1443
- if (!o) return;
1444
- if (typeof o === "string") return _array_like_to_array(o, minLen);
1445
- var n = Object.prototype.toString.call(o).slice(8, -1);
1446
- if (n === "Object" && o.constructor) n = o.constructor.name;
1447
- if (n === "Map" || n === "Set") return Array.from(n);
1448
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1449
- }
1450
-
1451
-
1452
-
1453
- var ChartRenderFunction = function(_param, ref) {
1454
- var children = _param.children, className = _param.className, rest = ChartWrapper_object_without_properties(_param, [
1455
- "children",
1456
- "className"
1457
- ]);
1458
- var _useState = _sliced_to_array((0,react.useState)(), 2), container = _useState[0], setContainer = _useState[1];
1459
- var containerRef = (0,react.useCallback)(function(r) {
1460
- setContainer(r);
1461
- if (ref) {
1462
- if (typeof ref === "function") {
1463
- containerRef(r);
1464
- } else {
1465
- ref.current = r;
1466
- }
1467
- }
1468
- }, [
1469
- ref
1470
- ]);
1471
- return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
1472
- ref: containerRef,
1473
- className: className,
1474
- children: !!container && /*#__PURE__*/ (0,jsx_runtime.jsx)(chart_ChartComponent, _object_spread_props(ChartWrapper_object_spread({
1475
- container: container
1476
- }, rest), {
1477
- children: children
1478
- }))
1479
- });
1480
- };
1481
- var ChartWrapper_ChartWrapper = /*#__PURE__*/ (0,react.forwardRef)(ChartRenderFunction);
1482
- ChartWrapper_ChartWrapper.displayName = "ChartWrapper";
1483
- /* ESM default export */ var ChartWrapper = (ChartWrapper_ChartWrapper);
1484
-
1485
- ;// CONCATENATED MODULE: ./src/chart/index.ts
1486
-
1487
-
1488
-
1489
- ;// CONCATENATED MODULE: ./src/shared/useSafeContext.ts
1490
-
1491
- var useSafeContext = function(context) {
1492
- var currentContextValue = (0,react.useContext)(context);
1493
- if (!currentContextValue) {
1494
- var ctxName = context.name;
1495
- throw new Error("".concat(ctxName, " not found. You can access context value only inside its Provider."));
1496
- }
1497
- return currentContextValue;
1498
- };
1499
-
1500
- ;// CONCATENATED MODULE: ./src/scales/useInitTimeScale.ts
1501
-
1502
-
1503
-
1504
- var useInitTimeScale = function(param) {
1505
- var onVisibleTimeRangeChange = param.onVisibleTimeRangeChange, onVisibleLogicalRangeChange = param.onVisibleLogicalRangeChange, onSizeChange = param.onSizeChange, visibleRange = param.visibleRange, visibleLogicalRange = param.visibleLogicalRange, _param_options = param.options, options = _param_options === void 0 ? {} : _param_options;
1506
- var chart = useSafeContext(ChartContext);
1507
- if (!chart) {
1508
- throw new Error("Chart context not found");
1509
- }
1510
- var timeScaleApiRef = (0,react.useRef)({
1511
- _timeScale: null,
1512
- api: function() {
1513
- if (!this._timeScale) {
1514
- var chartApi = chart.api();
1515
- if (!chartApi) {
1516
- return null;
1517
- }
1518
- this._timeScale = chartApi.timeScale();
1519
- this._timeScale.applyOptions(options);
1520
- if (visibleRange) {
1521
- this._timeScale.setVisibleRange(visibleRange);
1522
- }
1523
- if (visibleLogicalRange) {
1524
- this._timeScale.setVisibleLogicalRange(visibleLogicalRange);
1525
- }
1526
- }
1527
- return this._timeScale;
1528
- },
1529
- clear: function() {
1530
- if (this._timeScale !== null) {
1531
- this._timeScale = null;
1532
- }
1533
- }
1534
- });
1535
- (0,react.useLayoutEffect)(function() {
1536
- timeScaleApiRef.current.api();
1537
- return function() {
1538
- timeScaleApiRef.current.clear();
1539
- };
1540
- }, []);
1541
- (0,react.useLayoutEffect)(function() {
1542
- if (!chart) return;
1543
- if (options) {
1544
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1545
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.applyOptions(options);
1546
- }
1547
- }, [
1548
- options
1549
- ]);
1550
- (0,react.useLayoutEffect)(function() {
1551
- if (!chart) return;
1552
- if (onSizeChange) {
1553
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1554
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.subscribeSizeChange(onSizeChange);
1555
- }
1556
- return function() {
1557
- if (onSizeChange) {
1558
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1559
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.unsubscribeSizeChange(onSizeChange);
1560
- }
1561
- };
1562
- }, [
1563
- onSizeChange
1564
- ]);
1565
- (0,react.useLayoutEffect)(function() {
1566
- if (!chart) return;
1567
- if (onVisibleLogicalRangeChange) {
1568
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1569
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.subscribeVisibleLogicalRangeChange(onVisibleLogicalRangeChange);
1570
- }
1571
- return function() {
1572
- if (onVisibleLogicalRangeChange) {
1573
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1574
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.unsubscribeVisibleLogicalRangeChange(onVisibleLogicalRangeChange);
1575
- }
1576
- };
1577
- }, [
1578
- onVisibleLogicalRangeChange
1579
- ]);
1580
- (0,react.useLayoutEffect)(function() {
1581
- if (!chart) return;
1582
- if (onVisibleTimeRangeChange) {
1583
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1584
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.subscribeVisibleTimeRangeChange(onVisibleTimeRangeChange);
1585
- }
1586
- return function() {
1587
- if (onVisibleTimeRangeChange) {
1588
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1589
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.unsubscribeVisibleTimeRangeChange(onVisibleTimeRangeChange);
1590
- }
1591
- };
1592
- }, [
1593
- onVisibleTimeRangeChange
1594
- ]);
1595
- (0,react.useLayoutEffect)(function() {
1596
- if (!chart) return;
1597
- if (visibleRange) {
1598
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1599
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.setVisibleRange(visibleRange);
1600
- }
1601
- }, [
1602
- visibleRange
1603
- ]);
1604
- (0,react.useLayoutEffect)(function() {
1605
- if (!chart) return;
1606
- if (visibleLogicalRange) {
1607
- var _timeScaleApiRef_current_api, _timeScaleApiRef_current;
1608
- (_timeScaleApiRef_current = timeScaleApiRef.current) === null || _timeScaleApiRef_current === void 0 ? void 0 : (_timeScaleApiRef_current_api = _timeScaleApiRef_current.api()) === null || _timeScaleApiRef_current_api === void 0 ? void 0 : _timeScaleApiRef_current_api.setVisibleLogicalRange(visibleLogicalRange);
1609
- }
1610
- }, [
1611
- visibleLogicalRange
1612
- ]);
1613
- return timeScaleApiRef;
1614
- };
1615
-
1616
- ;// CONCATENATED MODULE: ./src/scales/TimeScale.tsx
1617
-
1618
-
1619
- var TimeScaleRenderFunction = function(props, ref) {
1620
- var timeScaleApiRef = useInitTimeScale(props);
1621
- (0,react.useImperativeHandle)(ref, function() {
1622
- return timeScaleApiRef.current;
1623
- }, [
1624
- timeScaleApiRef
1625
- ]);
1626
- return null;
1627
- };
1628
- var TimeScale_TimeScale = /*#__PURE__*/ (0,react.forwardRef)(TimeScaleRenderFunction);
1629
- TimeScale_TimeScale.displayName = "TimeScale";
1630
- /* ESM default export */ var TimeScale = (TimeScale_TimeScale);
1631
-
1632
- ;// CONCATENATED MODULE: ./src/scales/useInitPriceScale.ts
1633
- function useInitPriceScale_define_property(obj, key, value) {
1634
- if (key in obj) {
1635
- Object.defineProperty(obj, key, {
1636
- value: value,
1637
- enumerable: true,
1638
- configurable: true,
1639
- writable: true
1640
- });
1641
- } else {
1642
- obj[key] = value;
1643
- }
1644
- return obj;
1645
- }
1646
- function useInitPriceScale_object_spread(target) {
1647
- for(var i = 1; i < arguments.length; i++){
1648
- var source = arguments[i] != null ? arguments[i] : {};
1649
- var ownKeys = Object.keys(source);
1650
- if (typeof Object.getOwnPropertySymbols === "function") {
1651
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1652
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1653
- }));
1654
- }
1655
- ownKeys.forEach(function(key) {
1656
- useInitPriceScale_define_property(target, key, source[key]);
1657
- });
1658
- }
1659
- return target;
1660
- }
1661
-
1662
-
1663
-
1664
- var useInitPriceScale = function(param) {
1665
- var _param_options = param.options, options = _param_options === void 0 ? {} : _param_options, id = param.id;
1666
- var chart = useSafeContext(ChartContext);
1667
- var priceScaleApiRef = (0,react.useRef)({
1668
- _priceScale: null,
1669
- api: function() {
1670
- if (!this._priceScale) {
1671
- var chartApi = chart.api();
1672
- if (!chartApi) {
1673
- return null;
1674
- }
1675
- this._priceScale = chartApi.priceScale(id);
1676
- this._priceScale.applyOptions(useInitPriceScale_object_spread({}, options));
1677
- }
1678
- return this._priceScale;
1679
- },
1680
- setId: function(id) {
1681
- if (this._priceScale === null) {
1682
- return;
1683
- }
1684
- this._priceScale = chart.api().priceScale(id);
1685
- },
1686
- clear: function() {
1687
- if (this._priceScale !== null) {
1688
- this._priceScale = null;
1689
- }
1690
- }
1691
- });
1692
- (0,react.useLayoutEffect)(function() {
1693
- priceScaleApiRef.current.api();
1694
- return function() {
1695
- priceScaleApiRef.current.clear();
1696
- };
1697
- }, []);
1698
- (0,react.useLayoutEffect)(function() {
1699
- var _priceScaleApiRef_current;
1700
- if (!chart) return;
1701
- (_priceScaleApiRef_current = priceScaleApiRef.current) === null || _priceScaleApiRef_current === void 0 ? void 0 : _priceScaleApiRef_current.setId(id);
1702
- }, [
1703
- id
1704
- ]);
1705
- (0,react.useLayoutEffect)(function() {
1706
- if (!chart) return;
1707
- if (options) {
1708
- var _priceScaleApiRef_current_api, _priceScaleApiRef_current;
1709
- (_priceScaleApiRef_current = priceScaleApiRef.current) === null || _priceScaleApiRef_current === void 0 ? void 0 : (_priceScaleApiRef_current_api = _priceScaleApiRef_current.api()) === null || _priceScaleApiRef_current_api === void 0 ? void 0 : _priceScaleApiRef_current_api.applyOptions(options);
1710
- }
1711
- }, [
1712
- options
1713
- ]);
1714
- return priceScaleApiRef;
1715
- };
1716
-
1717
- ;// CONCATENATED MODULE: ./src/scales/PriceScale.tsx
1718
-
1719
-
1720
- var PriceScaleRenderFunction = function(props, ref) {
1721
- var priceScaleApiRef = useInitPriceScale(props);
1722
- (0,react.useImperativeHandle)(ref, function() {
1723
- return priceScaleApiRef.current;
1724
- }, [
1725
- priceScaleApiRef
1726
- ]);
1727
- return null;
1728
- };
1729
- var PriceScale_PriceScale = /*#__PURE__*/ (0,react.forwardRef)(PriceScaleRenderFunction);
1730
- PriceScale_PriceScale.displayName = "PriceScale";
1731
- /* ESM default export */ var PriceScale = (PriceScale_PriceScale);
1732
-
1733
- ;// CONCATENATED MODULE: ./src/scales/index.ts
1734
-
1735
-
1736
-
1737
-
1738
- ;// CONCATENATED MODULE: ./src/series/useInitSeries.ts
1739
-
1740
-
1741
-
1742
- var useInitSeries = function(param) {
1743
- var type = param.type, data = param.data, _param_options = param.options, options = _param_options === void 0 ? {} : _param_options, reactive = param.reactive, markers = param.markers;
1744
- var chart = useSafeContext(ChartContext);
1745
- var seriesApiRef = (0,react.useRef)({
1746
- _series: null,
1747
- api: function() {
1748
- if (!this._series && !this.destroyed) {
1749
- var chartApi = chart.api();
1750
- if (!chartApi) {
1751
- return null;
1752
- }
1753
- this._series = addSeries(chartApi, type);
1754
- this._series.applyOptions(options);
1755
- this._series.setData(data);
1756
- if (markers) {
1757
- this._series.setMarkers(markers);
1758
- }
1759
- }
1760
- return this._series;
1761
- },
1762
- clear: function() {
1763
- if (this._series !== null) {
1764
- var _chart_api;
1765
- (_chart_api = chart.api()) === null || _chart_api === void 0 ? void 0 : _chart_api.removeSeries(this._series);
1766
- this._series = null;
1767
- this.destroyed = true;
1768
- }
1769
- },
1770
- destroyed: false
1771
- });
1772
- (0,react.useLayoutEffect)(function() {
1773
- seriesApiRef.current.api();
1774
- return function() {
1775
- seriesApiRef.current.clear();
1776
- };
1777
- }, []);
1778
- (0,react.useLayoutEffect)(function() {
1779
- if (!chart) return;
1780
- if (markers && reactive) {
1781
- var _seriesApiRef_current_api;
1782
- (_seriesApiRef_current_api = seriesApiRef.current.api()) === null || _seriesApiRef_current_api === void 0 ? void 0 : _seriesApiRef_current_api.setMarkers(markers);
1783
- }
1784
- }, [
1785
- markers,
1786
- reactive
1787
- ]);
1788
- (0,react.useLayoutEffect)(function() {
1789
- if (!chart) return;
1790
- if (data && reactive) {
1791
- var _seriesApiRef_current_api;
1792
- (_seriesApiRef_current_api = seriesApiRef.current.api()) === null || _seriesApiRef_current_api === void 0 ? void 0 : _seriesApiRef_current_api.setData(data);
1793
- }
1794
- }, [
1795
- data,
1796
- reactive
1797
- ]);
1798
- (0,react.useLayoutEffect)(function() {
1799
- if (!chart) return;
1800
- if (options) {
1801
- var _seriesApiRef_current_api;
1802
- (_seriesApiRef_current_api = seriesApiRef.current.api()) === null || _seriesApiRef_current_api === void 0 ? void 0 : _seriesApiRef_current_api.applyOptions(options);
1803
- }
1804
- }, [
1805
- options
1806
- ]);
1807
- return seriesApiRef;
1808
- };
1809
- var addSeries = function(chart, type) {
1810
- var series = null;
1811
- switch(type){
1812
- case "Line":
1813
- series = chart.addLineSeries();
1814
- break;
1815
- case "Candlestick":
1816
- series = chart.addCandlestickSeries();
1817
- break;
1818
- case "Histogram":
1819
- series = chart.addHistogramSeries();
1820
- break;
1821
- case "Area":
1822
- series = chart.addAreaSeries();
1823
- break;
1824
- case "Baseline":
1825
- series = chart.addBaselineSeries();
1826
- break;
1827
- case "Bar":
1828
- series = chart.addBarSeries();
1829
- break;
1830
- default:
1831
- throw new Error("Unknown series type: ".concat(type));
1832
- }
1833
- return series;
1834
- };
1835
-
1836
- ;// CONCATENATED MODULE: ./src/series/SeriesContext.ts
1837
-
1838
- var SeriesContext = (0,react.createContext)({});
1839
- SeriesContext.displayName = "SeriesContext";
1840
-
1841
- ;// CONCATENATED MODULE: ./src/series/SeriesTemplate.tsx
1842
- function SeriesTemplate_object_without_properties(source, excluded) {
1843
- if (source == null) return {};
1844
- var target = SeriesTemplate_object_without_properties_loose(source, excluded);
1845
- var key, i;
1846
- if (Object.getOwnPropertySymbols) {
1847
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1848
- for(i = 0; i < sourceSymbolKeys.length; i++){
1849
- key = sourceSymbolKeys[i];
1850
- if (excluded.indexOf(key) >= 0) continue;
1851
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1852
- target[key] = source[key];
1853
- }
1854
- }
1855
- return target;
1856
- }
1857
- function SeriesTemplate_object_without_properties_loose(source, excluded) {
1858
- if (source == null) return {};
1859
- var target = {};
1860
- var sourceKeys = Object.keys(source);
1861
- var key, i;
1862
- for(i = 0; i < sourceKeys.length; i++){
1863
- key = sourceKeys[i];
1864
- if (excluded.indexOf(key) >= 0) continue;
1865
- target[key] = source[key];
1866
- }
1867
- return target;
1868
- }
1869
-
1870
-
1871
-
1872
-
1873
- var SeriesTemplateRenderFunction = function(_param, ref) {
1874
- var children = _param.children, rest = SeriesTemplate_object_without_properties(_param, [
1875
- "children"
1876
- ]);
1877
- var seriesApi = useInitSeries(rest);
1878
- (0,react.useImperativeHandle)(ref, function() {
1879
- return seriesApi.current;
1880
- }, [
1881
- seriesApi
1882
- ]);
1883
- return /*#__PURE__*/ (0,jsx_runtime.jsx)(SeriesContext.Provider, {
1884
- value: seriesApi.current,
1885
- children: children
1886
- });
1887
- };
1888
- var SeriesTemplate_SeriesTemplate = /*#__PURE__*/ (0,react.forwardRef)(SeriesTemplateRenderFunction);
1889
- SeriesTemplate_SeriesTemplate.displayName = "SeriesTemplate";
1890
- /* ESM default export */ var SeriesTemplate = (SeriesTemplate_SeriesTemplate);
1891
-
1892
- ;// CONCATENATED MODULE: ./src/series/LineSeries.tsx
1893
- function LineSeries_define_property(obj, key, value) {
1894
- if (key in obj) {
1895
- Object.defineProperty(obj, key, {
1896
- value: value,
1897
- enumerable: true,
1898
- configurable: true,
1899
- writable: true
1900
- });
1901
- } else {
1902
- obj[key] = value;
1903
- }
1904
- return obj;
1905
- }
1906
- function LineSeries_object_spread(target) {
1907
- for(var i = 1; i < arguments.length; i++){
1908
- var source = arguments[i] != null ? arguments[i] : {};
1909
- var ownKeys = Object.keys(source);
1910
- if (typeof Object.getOwnPropertySymbols === "function") {
1911
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1912
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1913
- }));
1914
- }
1915
- ownKeys.forEach(function(key) {
1916
- LineSeries_define_property(target, key, source[key]);
1917
- });
1918
- }
1919
- return target;
1920
- }
1921
- function LineSeries_ownKeys(object, enumerableOnly) {
1922
- var keys = Object.keys(object);
1923
- if (Object.getOwnPropertySymbols) {
1924
- var symbols = Object.getOwnPropertySymbols(object);
1925
- if (enumerableOnly) {
1926
- symbols = symbols.filter(function(sym) {
1927
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1928
- });
1929
- }
1930
- keys.push.apply(keys, symbols);
1931
- }
1932
- return keys;
1933
- }
1934
- function LineSeries_object_spread_props(target, source) {
1935
- source = source != null ? source : {};
1936
- if (Object.getOwnPropertyDescriptors) {
1937
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1938
- } else {
1939
- LineSeries_ownKeys(Object(source)).forEach(function(key) {
1940
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1941
- });
1942
- }
1943
- return target;
1944
- }
1945
- function LineSeries_object_without_properties(source, excluded) {
1946
- if (source == null) return {};
1947
- var target = LineSeries_object_without_properties_loose(source, excluded);
1948
- var key, i;
1949
- if (Object.getOwnPropertySymbols) {
1950
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1951
- for(i = 0; i < sourceSymbolKeys.length; i++){
1952
- key = sourceSymbolKeys[i];
1953
- if (excluded.indexOf(key) >= 0) continue;
1954
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1955
- target[key] = source[key];
1956
- }
1957
- }
1958
- return target;
1959
- }
1960
- function LineSeries_object_without_properties_loose(source, excluded) {
1961
- if (source == null) return {};
1962
- var target = {};
1963
- var sourceKeys = Object.keys(source);
1964
- var key, i;
1965
- for(i = 0; i < sourceKeys.length; i++){
1966
- key = sourceKeys[i];
1967
- if (excluded.indexOf(key) >= 0) continue;
1968
- target[key] = source[key];
1969
- }
1970
- return target;
1971
- }
1972
-
1973
-
1974
-
1975
- var LineSeriesRenderFunction = function(_param, ref) {
1976
- var children = _param.children, rest = LineSeries_object_without_properties(_param, [
1977
- "children"
1978
- ]);
1979
- return /*#__PURE__*/ (0,jsx_runtime.jsx)(SeriesTemplate, LineSeries_object_spread_props(LineSeries_object_spread({
1980
- type: "Line",
1981
- ref: ref
1982
- }, rest), {
1983
- children: children
1984
- }));
1985
- };
1986
- var LineSeries = /*#__PURE__*/ (0,react.forwardRef)(LineSeriesRenderFunction);
1987
- LineSeries.displayName = "LineSeries";
1988
- /* ESM default export */ var series_LineSeries = (LineSeries);
1989
-
1990
- ;// CONCATENATED MODULE: ./src/series/HistogramSeries.tsx
1991
- function HistogramSeries_define_property(obj, key, value) {
1992
- if (key in obj) {
1993
- Object.defineProperty(obj, key, {
1994
- value: value,
1995
- enumerable: true,
1996
- configurable: true,
1997
- writable: true
1998
- });
1999
- } else {
2000
- obj[key] = value;
2001
- }
2002
- return obj;
2003
- }
2004
- function HistogramSeries_object_spread(target) {
2005
- for(var i = 1; i < arguments.length; i++){
2006
- var source = arguments[i] != null ? arguments[i] : {};
2007
- var ownKeys = Object.keys(source);
2008
- if (typeof Object.getOwnPropertySymbols === "function") {
2009
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2010
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2011
- }));
2012
- }
2013
- ownKeys.forEach(function(key) {
2014
- HistogramSeries_define_property(target, key, source[key]);
2015
- });
2016
- }
2017
- return target;
2018
- }
2019
- function HistogramSeries_ownKeys(object, enumerableOnly) {
2020
- var keys = Object.keys(object);
2021
- if (Object.getOwnPropertySymbols) {
2022
- var symbols = Object.getOwnPropertySymbols(object);
2023
- if (enumerableOnly) {
2024
- symbols = symbols.filter(function(sym) {
2025
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2026
- });
2027
- }
2028
- keys.push.apply(keys, symbols);
2029
- }
2030
- return keys;
2031
- }
2032
- function HistogramSeries_object_spread_props(target, source) {
2033
- source = source != null ? source : {};
2034
- if (Object.getOwnPropertyDescriptors) {
2035
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2036
- } else {
2037
- HistogramSeries_ownKeys(Object(source)).forEach(function(key) {
2038
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2039
- });
2040
- }
2041
- return target;
2042
- }
2043
- function HistogramSeries_object_without_properties(source, excluded) {
2044
- if (source == null) return {};
2045
- var target = HistogramSeries_object_without_properties_loose(source, excluded);
2046
- var key, i;
2047
- if (Object.getOwnPropertySymbols) {
2048
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2049
- for(i = 0; i < sourceSymbolKeys.length; i++){
2050
- key = sourceSymbolKeys[i];
2051
- if (excluded.indexOf(key) >= 0) continue;
2052
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2053
- target[key] = source[key];
2054
- }
2055
- }
2056
- return target;
2057
- }
2058
- function HistogramSeries_object_without_properties_loose(source, excluded) {
2059
- if (source == null) return {};
2060
- var target = {};
2061
- var sourceKeys = Object.keys(source);
2062
- var key, i;
2063
- for(i = 0; i < sourceKeys.length; i++){
2064
- key = sourceKeys[i];
2065
- if (excluded.indexOf(key) >= 0) continue;
2066
- target[key] = source[key];
2067
- }
2068
- return target;
2069
- }
2070
-
2071
-
2072
-
2073
- var HistogramSeriesRenderFunction = function(_param, ref) {
2074
- var children = _param.children, rest = HistogramSeries_object_without_properties(_param, [
2075
- "children"
2076
- ]);
2077
- return /*#__PURE__*/ (0,jsx_runtime.jsx)(SeriesTemplate, HistogramSeries_object_spread_props(HistogramSeries_object_spread({
2078
- type: "Histogram",
2079
- ref: ref
2080
- }, rest), {
2081
- children: children
2082
- }));
2083
- };
2084
- var HistogramSeries = /*#__PURE__*/ (0,react.forwardRef)(HistogramSeriesRenderFunction);
2085
- HistogramSeries.displayName = "HistogramSeries";
2086
- /* ESM default export */ var series_HistogramSeries = (HistogramSeries);
2087
-
2088
- ;// CONCATENATED MODULE: ./src/series/CandlestickSeries.tsx
2089
- function CandlestickSeries_define_property(obj, key, value) {
2090
- if (key in obj) {
2091
- Object.defineProperty(obj, key, {
2092
- value: value,
2093
- enumerable: true,
2094
- configurable: true,
2095
- writable: true
2096
- });
2097
- } else {
2098
- obj[key] = value;
2099
- }
2100
- return obj;
2101
- }
2102
- function CandlestickSeries_object_spread(target) {
2103
- for(var i = 1; i < arguments.length; i++){
2104
- var source = arguments[i] != null ? arguments[i] : {};
2105
- var ownKeys = Object.keys(source);
2106
- if (typeof Object.getOwnPropertySymbols === "function") {
2107
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2108
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2109
- }));
2110
- }
2111
- ownKeys.forEach(function(key) {
2112
- CandlestickSeries_define_property(target, key, source[key]);
2113
- });
2114
- }
2115
- return target;
2116
- }
2117
- function CandlestickSeries_ownKeys(object, enumerableOnly) {
2118
- var keys = Object.keys(object);
2119
- if (Object.getOwnPropertySymbols) {
2120
- var symbols = Object.getOwnPropertySymbols(object);
2121
- if (enumerableOnly) {
2122
- symbols = symbols.filter(function(sym) {
2123
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2124
- });
2125
- }
2126
- keys.push.apply(keys, symbols);
2127
- }
2128
- return keys;
2129
- }
2130
- function CandlestickSeries_object_spread_props(target, source) {
2131
- source = source != null ? source : {};
2132
- if (Object.getOwnPropertyDescriptors) {
2133
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2134
- } else {
2135
- CandlestickSeries_ownKeys(Object(source)).forEach(function(key) {
2136
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2137
- });
2138
- }
2139
- return target;
2140
- }
2141
- function CandlestickSeries_object_without_properties(source, excluded) {
2142
- if (source == null) return {};
2143
- var target = CandlestickSeries_object_without_properties_loose(source, excluded);
2144
- var key, i;
2145
- if (Object.getOwnPropertySymbols) {
2146
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2147
- for(i = 0; i < sourceSymbolKeys.length; i++){
2148
- key = sourceSymbolKeys[i];
2149
- if (excluded.indexOf(key) >= 0) continue;
2150
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2151
- target[key] = source[key];
2152
- }
2153
- }
2154
- return target;
2155
- }
2156
- function CandlestickSeries_object_without_properties_loose(source, excluded) {
2157
- if (source == null) return {};
2158
- var target = {};
2159
- var sourceKeys = Object.keys(source);
2160
- var key, i;
2161
- for(i = 0; i < sourceKeys.length; i++){
2162
- key = sourceKeys[i];
2163
- if (excluded.indexOf(key) >= 0) continue;
2164
- target[key] = source[key];
2165
- }
2166
- return target;
2167
- }
2168
-
2169
-
2170
-
2171
- var CandlestickSeriesRenderFunction = function(_param, ref) {
2172
- var children = _param.children, rest = CandlestickSeries_object_without_properties(_param, [
2173
- "children"
2174
- ]);
2175
- return /*#__PURE__*/ (0,jsx_runtime.jsx)(SeriesTemplate, CandlestickSeries_object_spread_props(CandlestickSeries_object_spread({
2176
- type: "Candlestick",
2177
- ref: ref
2178
- }, rest), {
2179
- children: children
2180
- }));
2181
- };
2182
- var CandlestickSeries = /*#__PURE__*/ (0,react.forwardRef)(CandlestickSeriesRenderFunction);
2183
- CandlestickSeries.displayName = "CandlestickSeries";
2184
- /* ESM default export */ var series_CandlestickSeries = (CandlestickSeries);
2185
-
2186
- ;// CONCATENATED MODULE: ./src/series/AreaSeries.tsx
2187
- function AreaSeries_define_property(obj, key, value) {
2188
- if (key in obj) {
2189
- Object.defineProperty(obj, key, {
2190
- value: value,
2191
- enumerable: true,
2192
- configurable: true,
2193
- writable: true
2194
- });
2195
- } else {
2196
- obj[key] = value;
2197
- }
2198
- return obj;
2199
- }
2200
- function AreaSeries_object_spread(target) {
2201
- for(var i = 1; i < arguments.length; i++){
2202
- var source = arguments[i] != null ? arguments[i] : {};
2203
- var ownKeys = Object.keys(source);
2204
- if (typeof Object.getOwnPropertySymbols === "function") {
2205
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2206
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2207
- }));
2208
- }
2209
- ownKeys.forEach(function(key) {
2210
- AreaSeries_define_property(target, key, source[key]);
2211
- });
2212
- }
2213
- return target;
2214
- }
2215
- function AreaSeries_ownKeys(object, enumerableOnly) {
2216
- var keys = Object.keys(object);
2217
- if (Object.getOwnPropertySymbols) {
2218
- var symbols = Object.getOwnPropertySymbols(object);
2219
- if (enumerableOnly) {
2220
- symbols = symbols.filter(function(sym) {
2221
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2222
- });
2223
- }
2224
- keys.push.apply(keys, symbols);
2225
- }
2226
- return keys;
2227
- }
2228
- function AreaSeries_object_spread_props(target, source) {
2229
- source = source != null ? source : {};
2230
- if (Object.getOwnPropertyDescriptors) {
2231
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2232
- } else {
2233
- AreaSeries_ownKeys(Object(source)).forEach(function(key) {
2234
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2235
- });
2236
- }
2237
- return target;
2238
- }
2239
- function AreaSeries_object_without_properties(source, excluded) {
2240
- if (source == null) return {};
2241
- var target = AreaSeries_object_without_properties_loose(source, excluded);
2242
- var key, i;
2243
- if (Object.getOwnPropertySymbols) {
2244
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2245
- for(i = 0; i < sourceSymbolKeys.length; i++){
2246
- key = sourceSymbolKeys[i];
2247
- if (excluded.indexOf(key) >= 0) continue;
2248
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2249
- target[key] = source[key];
2250
- }
2251
- }
2252
- return target;
2253
- }
2254
- function AreaSeries_object_without_properties_loose(source, excluded) {
2255
- if (source == null) return {};
2256
- var target = {};
2257
- var sourceKeys = Object.keys(source);
2258
- var key, i;
2259
- for(i = 0; i < sourceKeys.length; i++){
2260
- key = sourceKeys[i];
2261
- if (excluded.indexOf(key) >= 0) continue;
2262
- target[key] = source[key];
2263
- }
2264
- return target;
2265
- }
2266
-
2267
-
2268
-
2269
- var AreaSeriesRenderFunction = function(_param, ref) {
2270
- var children = _param.children, rest = AreaSeries_object_without_properties(_param, [
2271
- "children"
2272
- ]);
2273
- return /*#__PURE__*/ (0,jsx_runtime.jsx)(SeriesTemplate, AreaSeries_object_spread_props(AreaSeries_object_spread({
2274
- type: "Area",
2275
- ref: ref
2276
- }, rest), {
2277
- children: children
2278
- }));
2279
- };
2280
- var AreaSeries = /*#__PURE__*/ (0,react.forwardRef)(AreaSeriesRenderFunction);
2281
- AreaSeries.displayName = "AreaSeries";
2282
- /* ESM default export */ var series_AreaSeries = (AreaSeries);
2283
-
2284
- ;// CONCATENATED MODULE: ./src/series/BaselineSeries.tsx
2285
- function BaselineSeries_define_property(obj, key, value) {
2286
- if (key in obj) {
2287
- Object.defineProperty(obj, key, {
2288
- value: value,
2289
- enumerable: true,
2290
- configurable: true,
2291
- writable: true
2292
- });
2293
- } else {
2294
- obj[key] = value;
2295
- }
2296
- return obj;
2297
- }
2298
- function BaselineSeries_object_spread(target) {
2299
- for(var i = 1; i < arguments.length; i++){
2300
- var source = arguments[i] != null ? arguments[i] : {};
2301
- var ownKeys = Object.keys(source);
2302
- if (typeof Object.getOwnPropertySymbols === "function") {
2303
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2304
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2305
- }));
2306
- }
2307
- ownKeys.forEach(function(key) {
2308
- BaselineSeries_define_property(target, key, source[key]);
2309
- });
2310
- }
2311
- return target;
2312
- }
2313
- function BaselineSeries_ownKeys(object, enumerableOnly) {
2314
- var keys = Object.keys(object);
2315
- if (Object.getOwnPropertySymbols) {
2316
- var symbols = Object.getOwnPropertySymbols(object);
2317
- if (enumerableOnly) {
2318
- symbols = symbols.filter(function(sym) {
2319
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2320
- });
2321
- }
2322
- keys.push.apply(keys, symbols);
2323
- }
2324
- return keys;
2325
- }
2326
- function BaselineSeries_object_spread_props(target, source) {
2327
- source = source != null ? source : {};
2328
- if (Object.getOwnPropertyDescriptors) {
2329
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2330
- } else {
2331
- BaselineSeries_ownKeys(Object(source)).forEach(function(key) {
2332
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2333
- });
2334
- }
2335
- return target;
2336
- }
2337
- function BaselineSeries_object_without_properties(source, excluded) {
2338
- if (source == null) return {};
2339
- var target = BaselineSeries_object_without_properties_loose(source, excluded);
2340
- var key, i;
2341
- if (Object.getOwnPropertySymbols) {
2342
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2343
- for(i = 0; i < sourceSymbolKeys.length; i++){
2344
- key = sourceSymbolKeys[i];
2345
- if (excluded.indexOf(key) >= 0) continue;
2346
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2347
- target[key] = source[key];
2348
- }
2349
- }
2350
- return target;
2351
- }
2352
- function BaselineSeries_object_without_properties_loose(source, excluded) {
2353
- if (source == null) return {};
2354
- var target = {};
2355
- var sourceKeys = Object.keys(source);
2356
- var key, i;
2357
- for(i = 0; i < sourceKeys.length; i++){
2358
- key = sourceKeys[i];
2359
- if (excluded.indexOf(key) >= 0) continue;
2360
- target[key] = source[key];
2361
- }
2362
- return target;
2363
- }
2364
-
2365
-
2366
-
2367
- var BaselineSeriesRenderFunction = function(_param, ref) {
2368
- var children = _param.children, rest = BaselineSeries_object_without_properties(_param, [
2369
- "children"
2370
- ]);
2371
- return /*#__PURE__*/ (0,jsx_runtime.jsx)(SeriesTemplate, BaselineSeries_object_spread_props(BaselineSeries_object_spread({
2372
- type: "Baseline",
2373
- ref: ref
2374
- }, rest), {
2375
- children: children
2376
- }));
2377
- };
2378
- var BaselineSeries_BaselineSeries = /*#__PURE__*/ (0,react.forwardRef)(BaselineSeriesRenderFunction);
2379
- BaselineSeries_BaselineSeries.displayName = "BaselineSeries";
2380
- /* ESM default export */ var BaselineSeries = (BaselineSeries_BaselineSeries);
2381
-
2382
- ;// CONCATENATED MODULE: ./src/series/BarSeries.tsx
2383
- function BarSeries_define_property(obj, key, value) {
2384
- if (key in obj) {
2385
- Object.defineProperty(obj, key, {
2386
- value: value,
2387
- enumerable: true,
2388
- configurable: true,
2389
- writable: true
2390
- });
2391
- } else {
2392
- obj[key] = value;
2393
- }
2394
- return obj;
2395
- }
2396
- function BarSeries_object_spread(target) {
2397
- for(var i = 1; i < arguments.length; i++){
2398
- var source = arguments[i] != null ? arguments[i] : {};
2399
- var ownKeys = Object.keys(source);
2400
- if (typeof Object.getOwnPropertySymbols === "function") {
2401
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2402
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2403
- }));
2404
- }
2405
- ownKeys.forEach(function(key) {
2406
- BarSeries_define_property(target, key, source[key]);
2407
- });
2408
- }
2409
- return target;
2410
- }
2411
- function BarSeries_ownKeys(object, enumerableOnly) {
2412
- var keys = Object.keys(object);
2413
- if (Object.getOwnPropertySymbols) {
2414
- var symbols = Object.getOwnPropertySymbols(object);
2415
- if (enumerableOnly) {
2416
- symbols = symbols.filter(function(sym) {
2417
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2418
- });
2419
- }
2420
- keys.push.apply(keys, symbols);
2421
- }
2422
- return keys;
2423
- }
2424
- function BarSeries_object_spread_props(target, source) {
2425
- source = source != null ? source : {};
2426
- if (Object.getOwnPropertyDescriptors) {
2427
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2428
- } else {
2429
- BarSeries_ownKeys(Object(source)).forEach(function(key) {
2430
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2431
- });
2432
- }
2433
- return target;
2434
- }
2435
- function BarSeries_object_without_properties(source, excluded) {
2436
- if (source == null) return {};
2437
- var target = BarSeries_object_without_properties_loose(source, excluded);
2438
- var key, i;
2439
- if (Object.getOwnPropertySymbols) {
2440
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2441
- for(i = 0; i < sourceSymbolKeys.length; i++){
2442
- key = sourceSymbolKeys[i];
2443
- if (excluded.indexOf(key) >= 0) continue;
2444
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2445
- target[key] = source[key];
2446
- }
2447
- }
2448
- return target;
2449
- }
2450
- function BarSeries_object_without_properties_loose(source, excluded) {
2451
- if (source == null) return {};
2452
- var target = {};
2453
- var sourceKeys = Object.keys(source);
2454
- var key, i;
2455
- for(i = 0; i < sourceKeys.length; i++){
2456
- key = sourceKeys[i];
2457
- if (excluded.indexOf(key) >= 0) continue;
2458
- target[key] = source[key];
2459
- }
2460
- return target;
2461
- }
2462
-
2463
-
2464
-
2465
- var BarSeriesRenderFunction = function(_param, ref) {
2466
- var children = _param.children, rest = BarSeries_object_without_properties(_param, [
2467
- "children"
2468
- ]);
2469
- return /*#__PURE__*/ (0,jsx_runtime.jsx)(SeriesTemplate, BarSeries_object_spread_props(BarSeries_object_spread({
2470
- type: "Bar",
2471
- ref: ref
2472
- }, rest), {
2473
- children: children
2474
- }));
2475
- };
2476
- var BarSeries_BarSeries = /*#__PURE__*/ (0,react.forwardRef)(BarSeriesRenderFunction);
2477
- BarSeries_BarSeries.displayName = "BarSeries";
2478
- /* ESM default export */ var BarSeries = (BarSeries_BarSeries);
2479
-
2480
- ;// CONCATENATED MODULE: ./src/series/index.ts
2481
-
2482
-
2483
-
2484
-
2485
-
2486
-
2487
-
2488
-
2489
- ;// CONCATENATED MODULE: ./src/priceLine/useInitPriceLine.ts
2490
- function useInitPriceLine_define_property(obj, key, value) {
2491
- if (key in obj) {
2492
- Object.defineProperty(obj, key, {
2493
- value: value,
2494
- enumerable: true,
2495
- configurable: true,
2496
- writable: true
2497
- });
2498
- } else {
2499
- obj[key] = value;
2500
- }
2501
- return obj;
2502
- }
2503
- function useInitPriceLine_object_spread(target) {
2504
- for(var i = 1; i < arguments.length; i++){
2505
- var source = arguments[i] != null ? arguments[i] : {};
2506
- var ownKeys = Object.keys(source);
2507
- if (typeof Object.getOwnPropertySymbols === "function") {
2508
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2509
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2510
- }));
2511
- }
2512
- ownKeys.forEach(function(key) {
2513
- useInitPriceLine_define_property(target, key, source[key]);
2514
- });
2515
- }
2516
- return target;
2517
- }
2518
-
2519
-
2520
-
2521
- var useInitPriceLine = function(param) {
2522
- var options = param.options, price = param.price;
2523
- var series = useSafeContext(SeriesContext);
2524
- var priceLineApiRef = (0,react.useRef)({
2525
- _priceLine: null,
2526
- api: function() {
2527
- if (!this._priceLine) {
2528
- var seriesApi = series.api();
2529
- if (!seriesApi) {
2530
- return null;
2531
- }
2532
- this._priceLine = seriesApi.createPriceLine(useInitPriceLine_object_spread({
2533
- price: price
2534
- }, options));
2535
- }
2536
- return this._priceLine;
2537
- },
2538
- clear: function() {
2539
- if (this._priceLine !== null) {
2540
- var _series_api;
2541
- (_series_api = series.api()) === null || _series_api === void 0 ? void 0 : _series_api.removePriceLine(this._priceLine);
2542
- this._priceLine = null;
2543
- }
2544
- }
2545
- });
2546
- (0,react.useLayoutEffect)(function() {
2547
- priceLineApiRef.current.api();
2548
- return function() {
2549
- priceLineApiRef.current.clear();
2550
- };
2551
- }, []);
2552
- (0,react.useLayoutEffect)(function() {
2553
- if (!series) return;
2554
- if (options) {
2555
- var _priceLineApiRef_current_api;
2556
- (_priceLineApiRef_current_api = priceLineApiRef.current.api()) === null || _priceLineApiRef_current_api === void 0 ? void 0 : _priceLineApiRef_current_api.applyOptions(options);
2557
- }
2558
- }, [
2559
- options
2560
- ]);
2561
- return priceLineApiRef;
2562
- };
2563
-
2564
- ;// CONCATENATED MODULE: ./src/priceLine/PriceLine.tsx
2565
-
2566
-
2567
- var PriceLineRenderFunction = function(props, ref) {
2568
- var priceLineApiRef = useInitPriceLine(props);
2569
- (0,react.useImperativeHandle)(ref, function() {
2570
- return priceLineApiRef.current;
2571
- }, [
2572
- priceLineApiRef
2573
- ]);
2574
- return null;
2575
- };
2576
- var PriceLine = /*#__PURE__*/ (0,react.forwardRef)(PriceLineRenderFunction);
2577
- PriceLine.displayName = "PriceLine";
2578
- /* ESM default export */ var priceLine_PriceLine = (PriceLine);
2579
-
2580
- ;// CONCATENATED MODULE: ./src/priceLine/index.ts
2581
-
2582
-
2583
-
2584
- ;// CONCATENATED MODULE: ./src/index.ts?__rslib_entry__
2585
-
2586
-
2587
-
2588
-
2589
-
2590
- }();
2591
- return __webpack_exports__;
2592
- })()
2593
-
2594
- });
11
+ /*! For license information please see lightweight-charts-react-components.standalone.js.LICENSE.txt */
12
+ !function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("React")):"function"==typeof define&&define.amd?define(["React"],i):"object"==typeof exports?exports.LightweightChartsReactComponents=i(require("React")):t.LightweightChartsReactComponents=i(t.React)}(self,function(t){return function(){"use strict";var i={"../node_modules/react/cjs/react-jsx-runtime.production.js":function(t,i){var e=Symbol.for("react.transitional.element");Symbol.for("react.fragment");i.jsx=function(t,i,s){var h=null;if(void 0!==s&&(h=""+s),void 0!==i.key&&(h=""+i.key),"key"in i)for(var r in s={},i)"key"!==r&&(s[r]=i[r]);else s=i;return{$$typeof:e,type:t,key:h,ref:void 0!==(i=s.ref)?i:null,props:s}}},"../node_modules/react/jsx-runtime.js":function(t,i,e){t.exports=e("../node_modules/react/cjs/react-jsx-runtime.production.js")},react:function(i){i.exports=t}},e={};function s(t){var h=e[t];if(void 0!==h)return h.exports;var r=e[t]={exports:{}};return i[t](r,r.exports,s),r.exports}s.d=function(t,i){for(var e in i)s.o(i,e)&&!s.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:i[e]})},s.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var h={};return!function(){s.r(h),s.d(h,{BarSeries:function(){return hv},CustomSeries:function(){return hy},Chart:function(){return sK},BaselineSeries:function(){return hm},LineSeries:function(){return hl},CandlestickSeries:function(){return hc},PriceLine:function(){return h_},HistogramSeries:function(){return ha},Markers:function(){return hO},TimeScale:function(){return s0},AreaSeries:function(){return hd},PriceScale:function(){return s3}});var t,i,e,r,n,l,o,a,u,c,f,d,p,m,g,v,b,y,w,M,_=s("../node_modules/react/jsx-runtime.js"),S=s("react"),x=(0,S.createContext)({});function P(t){var i=t.width,e=t.height;if(i<0)throw Error("Negative width is not allowed for Size");if(e<0)throw Error("Negative height is not allowed for Size");return{width:i,height:e}}function O(t,i){return t.width===i.width&&t.height===i.height}x.displayName="ChartContext";var C=function(){function t(t){var i=this;this._resolutionListener=function(){return i._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=t,this._installResolutionListener()}return t.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(t.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),t.prototype.subscribe=function(t){var i=this,e={next:t};return this._observers.push(e),{unsubscribe:function(){i._observers=i._observers.filter(function(t){return t!==e})}}},t.prototype._installResolutionListener=function(){if(null!==this._resolutionMediaQueryList)throw Error("Resolution listener is already installed");var t=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(t,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){null!==this._resolutionMediaQueryList&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){var t=this;this._observers.forEach(function(i){return i.next(t._window.devicePixelRatio)}),this._reinstallResolutionListener()},t}(),R=function(){function t(t,i,e){var s;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=t,this._canvasElementClientSize=P({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=null!=i?i:function(t){return t},this._allowResizeObserver=null===(s=null==e?void 0:e.allowResizeObserver)||void 0===s||s,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var t,i;if(null===this._canvasElement)throw Error("Object is disposed");null===(t=this._canvasElementResizeObserver)||void 0===t||t.disconnect(),this._canvasElementResizeObserver=null,null===(i=this._devicePixelRatioObservable)||void 0===i||i.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(null===this._canvasElement)throw Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return P({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(t){this._canvasElementClientSize=P(t),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(i){return i!==t})},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(i){return i!==t})},t.prototype.applySuggestedBitmapSize=function(){if(null!==this._suggestedBitmapSize){var t=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(t),this._emitSuggestedBitmapSizeChanged(t,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(t){var i=this.bitmapSize;!O(i,t)&&(this.canvasElement.width=t.width,this.canvasElement.height=t.height,this._emitBitmapSizeChanged(i,t))},t.prototype._emitBitmapSizeChanged=function(t,i){var e=this;this._bitmapSizeChangedListeners.forEach(function(s){return s.call(e,t,i)})},t.prototype._suggestNewBitmapSize=function(t){var i=this._suggestedBitmapSize,e=P(this._transformBitmapSize(t,this._canvasElementClientSize)),s=O(this.bitmapSize,e)?null:e;!(null===i&&null===s||null!==i&&null!==s&&O(i,s))&&(this._suggestedBitmapSize=s,this._emitSuggestedBitmapSizeChanged(i,s))},t.prototype._emitSuggestedBitmapSizeChanged=function(t,i){var e=this;this._suggestedBitmapSizeChangedListeners.forEach(function(s){return s.call(e,t,i)})},t.prototype._chooseAndInitObserver=function(){var t=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}new Promise(function(t){var i=new ResizeObserver(function(e){t(e.every(function(t){return"devicePixelContentBoxSize"in t})),i.disconnect()});i.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1}).then(function(i){return i?t._initResizeObserver():t._initDevicePixelRatioObservable()})},t.prototype._initDevicePixelRatioObservable=function(){var t=this;if(null!==this._canvasElement){var i=k(this._canvasElement);if(null===i)throw Error("No window is associated with the canvas");this._devicePixelRatioObservable=new C(i),this._devicePixelRatioObservable.subscribe(function(){return t._invalidateBitmapSize()}),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){if(null!==this._canvasElement){var t,i,e=k(this._canvasElement);if(null!==e){var s,h,r=null!==(i=null===(t=this._devicePixelRatioObservable)||void 0===t?void 0:t.value)&&void 0!==i?i:e.devicePixelRatio,n=this._canvasElement.getClientRects(),l=void 0!==n[0]?(s=n[0],h=r,P({width:Math.round(s.left*h+s.width*h)-Math.round(s.left*h),height:Math.round(s.top*h+s.height*h)-Math.round(s.top*h)})):P({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(l)}}},t.prototype._initResizeObserver=function(){var t=this;null!==this._canvasElement&&(this._canvasElementResizeObserver=new ResizeObserver(function(i){var e=i.find(function(i){return i.target===t._canvasElement});if(e&&e.devicePixelContentBoxSize&&e.devicePixelContentBoxSize[0]){var s=e.devicePixelContentBoxSize[0],h=P({width:s.inlineSize,height:s.blockSize});t._suggestNewBitmapSize(h)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function k(t){return t.ownerDocument.defaultView}var z=function(){function t(t,i,e){if(0===i.width||0===i.height)throw TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=i,0===e.width||0===e.height)throw TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=e,this._context=t}return t.prototype.useMediaCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),t({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),t({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t}();function Y(t,i){var e=t.canvasElementClientSize;if(0===e.width||0===e.height)return null;var s=t.bitmapSize;if(0===s.width||0===s.height)return null;var h=t.canvasElement.getContext("2d",i);return null===h?null:new z(h,e,s)}let E={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};function j(t,i){let e={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[i];t.setLineDash(e)}function T(t,i,e,s){t.beginPath();let h=t.lineWidth%2?.5:0;t.moveTo(e,i+h),t.lineTo(s,i+h),t.stroke()}function L(t,i){if(!t)throw Error("Assertion failed"+(i?": "+i:""))}function N(t){if(void 0===t)throw Error("Value is undefined");return t}function V(t){if(null===t)throw Error("Value is null");return t}function D(t){return V(N(t))}(t=f||(f={}))[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved",(i=d||(d={}))[i.Solid=0]="Solid",i[i.Dotted=1]="Dotted",i[i.Dashed=2]="Dashed",i[i.LargeDashed=3]="LargeDashed",i[i.SparseDotted=4]="SparseDotted";class B{constructor(){this.t=[]}i(t,i,e){this.t.push({h:t,l:i,o:!0===e})}_(t){let i=this.t.findIndex(i=>t===i.h);i>-1&&this.t.splice(i,1)}u(t){this.t=this.t.filter(i=>i.l!==t)}p(t,i,e){let s=[...this.t];this.t=this.t.filter(t=>!t.o),s.forEach(s=>s.h(t,i,e))}v(){return this.t.length>0}m(){this.t=[]}}function W(t,...i){for(let e of i)for(let i in e)void 0!==e[i]&&Object.prototype.hasOwnProperty.call(e,i)&&!["__proto__","constructor","prototype"].includes(i)&&("object"!=typeof e[i]||void 0===t[i]||Array.isArray(e[i])?t[i]=e[i]:W(t[i],e[i]));return t}function F(t){return"number"==typeof t&&isFinite(t)}function I(t){return"number"==typeof t&&t%1==0}function Q(t){return"string"==typeof t}function A(t){return"boolean"==typeof t}function J(t){let i,e,s;if(!t||"object"!=typeof t)return t;for(e in i=Array.isArray(t)?[]:{},t)t.hasOwnProperty(e)&&(s=t[e],i[e]=s&&"object"==typeof s?J(s):s);return i}function $(t){return null!==t}function U(t){return null===t?void 0:t}let Z="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function G(t,i,e){return void 0===i&&(i=Z),`${e=void 0!==e?`${e} `:""}${t}px ${i}`}class K{constructor(t){this.M={S:1,C:5,P:NaN,k:"",T:"",R:"",D:"",V:0,I:0,B:0,A:0,L:0},this.O=t}N(){let t=this.M,i=this.W(),e=this.F();return t.P===i&&t.T===e||(t.P=i,t.T=e,t.k=G(i,e),t.A=2.5/12*i,t.V=t.A,t.I=i/12*t.C,t.B=i/12*t.C,t.L=0),t.R=this.H(),t.D=this.U(),this.M}H(){return this.O.N().layout.textColor}U(){return this.O.$()}W(){return this.O.N().layout.fontSize}F(){return this.O.N().layout.fontFamily}}function X(t){return t<0?0:t>255?255:Math.round(t)||0}function H(t){return .199*t[0]+.687*t[1]+.114*t[2]}class q{constructor(t,i){this.q=new Map,this.Y=t,i&&(this.q=i)}j(t,i){if("transparent"===t)return t;let e=this.Z(t),s=e[3];return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${i*s})`}K(t){let i=this.Z(t);return{X:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,G:H(i)>160?"black":"white"}}J(t){return H(this.Z(t))}tt(t,i,e){var s;let[h,r,n,l]=this.Z(t),[o,a,u,c]=this.Z(i),f=[X(h+e*(o-h)),X(r+e*(a-r)),X(n+e*(u-n)),(s=l+e*(c-l))<=0||s>1?Math.min(Math.max(s,0),1):Math.round(1e4*s)/1e4];return`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${f[3]})`}Z(t){let i=this.q.get(t);if(i)return i;let e=(function(t){let i=document.createElement("div");i.style.display="none",document.body.appendChild(i),i.style.color=t;let e=window.getComputedStyle(i).color;return document.body.removeChild(i),e})(t).match(/^rgba?\s*\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d+))?\)$/);if(!e){if(this.Y.length)for(let i of this.Y){let e=i(t);if(e)return this.q.set(t,e),e}throw Error(`Failed to parse color: ${t}`)}let s=[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10),e[4]?parseFloat(e[4]):1];return this.q.set(t,s),s}}class tt{constructor(){this.it=[]}st(t){this.it=t}nt(t,i,e){this.it.forEach(s=>{s.nt(t,i,e)})}}class ti{nt(t,i,e){t.useBitmapCoordinateSpace(t=>this.et(t,i,e))}}class te extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.rt||null===this.rt.lt)return;let s=this.rt.lt,h=this.rt,r=Math.max(1,Math.floor(i))%2/2,n=n=>{t.beginPath();for(let l=s.to-1;l>=s.from;--l){let s=h.ot[l],o=Math.round(s._t*i)+r,a=s.ut*e,u=n*e+r;t.moveTo(o,a),t.arc(o,a,u,0,2*Math.PI)}t.fill()};h.ct>0&&(t.fillStyle=h.dt,n(h.ft+h.ct)),t.fillStyle=h.vt,n(h.ft)}}function ts(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:"",dt:"",ft:0,ct:0,lt:null}}let th={from:0,to:1};class tr{constructor(t,i,e){this.Mt=new tt,this.bt=[],this.xt=[],this.St=!0,this.O=t,this.Ct=i,this.yt=e,this.Mt.st(this.bt)}Pt(t){this.kt(),this.St=!0}Tt(){return this.St&&(this.Rt(),this.St=!1),this.Mt}kt(){let t=this.yt.Dt();t.length!==this.bt.length&&(this.xt=t.map(ts),this.bt=this.xt.map(t=>{let i=new te;return i.ht(t),i}),this.Mt.st(this.bt))}Rt(){let t=2===this.Ct.N().mode||!this.Ct.Vt(),i=this.yt.It(),e=this.Ct.Bt(),s=this.O.At();this.kt(),i.forEach((i,h)=>{let r=this.xt[h],n=i.Et(e),l=i.zt();!t&&null!==n&&i.Vt()&&null!==l?(r.vt=n.Lt,r.ft=n.ft,r.ct=n.Ot,r.ot[0].gt=n.gt,r.ot[0].ut=i.Wt().Nt(n.gt,l.Ft),r.dt=n.Ht??this.O.Ut(r.ot[0].ut/i.Wt().$t()),r.ot[0].wt=e,r.ot[0]._t=s.qt(e),r.lt=th):r.lt=null})}}class tn extends ti{constructor(t){super(),this.Yt=t}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(null===this.Yt)return;let h=this.Yt.jt.Vt,r=this.Yt.Zt.Vt;if(!h&&!r)return;let n=Math.round(this.Yt._t*e),l=Math.round(this.Yt.ut*s);t.lineCap="butt",h&&n>=0&&(t.lineWidth=Math.floor(this.Yt.jt.ct*e),t.strokeStyle=this.Yt.jt.R,t.fillStyle=this.Yt.jt.R,j(t,this.Yt.jt.Kt),function(t,i,e,s){t.beginPath();let h=t.lineWidth%2?.5:0;t.moveTo(i+h,0),t.lineTo(i+h,s),t.stroke()}(t,n,0,i.height)),r&&l>=0&&(t.lineWidth=Math.floor(this.Yt.Zt.ct*s),t.strokeStyle=this.Yt.Zt.R,t.fillStyle=this.Yt.Zt.R,j(t,this.Yt.Zt.Kt),T(t,l,0,i.width))}}class tl{constructor(t,i){this.St=!0,this.Xt={jt:{ct:1,Kt:0,R:"",Vt:!1},Zt:{ct:1,Kt:0,R:"",Vt:!1},_t:0,ut:0},this.Gt=new tn(this.Xt),this.Jt=t,this.yt=i}Pt(){this.St=!0}Tt(t){return this.St&&(this.Rt(),this.St=!1),this.Gt}Rt(){let t=this.Jt.Vt(),i=this.yt.Qt().N().crosshair,e=this.Xt;if(2===i.mode)return e.Zt.Vt=!1,void(e.jt.Vt=!1);e.Zt.Vt=t&&this.Jt.ti(this.yt),e.jt.Vt=t&&this.Jt.ii(),e.Zt.ct=i.horzLine.width,e.Zt.Kt=i.horzLine.style,e.Zt.R=i.horzLine.color,e.jt.ct=i.vertLine.width,e.jt.Kt=i.vertLine.style,e.jt.R=i.vertLine.color,e._t=this.Jt.si(),e.ut=this.Jt.ni()}}function to(t,i,e,s,h,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,e,s,h),t.restore()}function ta(t,i,e,s,h,r){t.beginPath(),t.roundRect?t.roundRect(i,e,s,h,r):(t.lineTo(i+s-r[1],e),0!==r[1]&&t.arcTo(i+s,e,i+s,e+r[1],r[1]),t.lineTo(i+s,e+h-r[2]),0!==r[2]&&t.arcTo(i+s,e+h,i+s-r[2],e+h,r[2]),t.lineTo(i+r[3],e+h),0!==r[3]&&t.arcTo(i,e+h,i,e+h-r[3],r[3]),t.lineTo(i,e+r[0]),0!==r[0]&&t.arcTo(i,e,i+r[0],e,r[0]))}function tu(t,i,e,s,h,r,n=0,l=[0,0,0,0],o=""){var a;if(t.save(),!n||!o||o===r)return ta(t,i,e,s,h,l),t.fillStyle=r,t.fill(),void t.restore();let u=n/2;ta(t,i+u,e+u,s-n,h-n,(a=-u,l.map(t=>0===t?t:t+a))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==o&&(t.lineWidth=n,t.strokeStyle=o,t.closePath(),t.stroke()),t.restore()}function tc(t,i,e,s,h,r,n){t.save(),t.globalCompositeOperation="copy";let l=t.createLinearGradient(0,0,0,h);l.addColorStop(0,r),l.addColorStop(1,n),t.fillStyle=l,t.fillRect(i,e,s,h),t.restore()}class tf{constructor(t,i){this.ht(t,i)}ht(t,i){this.Yt=t,this.ei=i}$t(t,i){return this.Yt.Vt?t.P+t.A+t.V:0}nt(t,i,e,s){if(!this.Yt.Vt||0===this.Yt.ri.length)return;let h=this.Yt.R,r=this.ei.X,n=t.useBitmapCoordinateSpace(t=>{let n=t.context;n.font=i.k;let l=this.hi(t,i,e,s),o=l.ai;return l.li?tu(n,o.oi,o._i,o.ui,o.ci,r,o.di,[o.ft,0,0,o.ft],r):tu(n,o.fi,o._i,o.ui,o.ci,r,o.di,[0,o.ft,o.ft,0],r),this.Yt.pi&&(n.fillStyle=h,n.fillRect(o.fi,o.mi,o.wi-o.fi,o.gi)),this.Yt.Mi&&(n.fillStyle=i.D,n.fillRect(l.li?o.bi-o.di:0,o._i,o.di,o.xi-o._i)),l});t.useMediaCoordinateSpace(({context:t})=>{let e=n.Si;t.font=i.k,t.textAlign=n.li?"right":"left",t.textBaseline="middle",t.fillStyle=h,t.fillText(this.Yt.ri,e.Ci,(e._i+e.xi)/2+e.yi)})}hi(t,i,e,s){let h,r,n;let{context:l,bitmapSize:o,mediaSize:a,horizontalPixelRatio:u,verticalPixelRatio:c}=t,f=this.Yt.pi||!this.Yt.Pi?i.C:0,d=this.Yt.ki?i.S:0,p=i.A+this.ei.Ti,m=i.V+this.ei.Ri,g=i.I,v=i.B,b=this.Yt.ri,y=i.P,w=e.Di(l,b),M=Math.ceil(e.Vi(l,b)),_=i.S+g+v+M+f,S=Math.max(1,Math.floor(c)),x=Math.round((y+p+m)*c);x%2!=S%2&&(x+=1);let P=d>0?Math.max(1,Math.floor(d*u)):0,O=Math.round(_*u),C=Math.round(f*u),R=Math.round((this.ei.Ii??this.ei.Bi)*c)-Math.floor(.5*c),k=Math.floor(R+S/2-x/2),z=k+x,Y="right"===s,E=Y?a.width-d:d,j=Y?o.width-P:P;return Y?(h=j-O,r=j-C,n=E-f-g-d):(h=j+O,r=j+C,n=E+f+g),{li:Y,ai:{_i:k,mi:R,xi:z,ui:O,ci:x,ft:2*u,di:P,oi:h,fi:j,wi:r,gi:S,bi:o.width},Si:{_i:k/c,xi:z/c,Ci:n,yi:w}}}}class td{constructor(t){this.Ai={Bi:0,X:"#000",Ri:0,Ti:0},this.Ei={ri:"",Vt:!1,pi:!0,Pi:!1,Ht:"",R:"#FFF",Mi:!1,ki:!1},this.zi={ri:"",Vt:!1,pi:!1,Pi:!0,Ht:"",R:"#FFF",Mi:!0,ki:!0},this.St=!0,this.Li=new(t||tf)(this.Ei,this.Ai),this.Oi=new(t||tf)(this.zi,this.Ai)}ri(){return this.Ni(),this.Ei.ri}Bi(){return this.Ni(),this.Ai.Bi}Pt(){this.St=!0}$t(t,i=!1){return Math.max(this.Li.$t(t,i),this.Oi.$t(t,i))}Wi(){return this.Ai.Ii||0}Fi(t){this.Ai.Ii=t}Hi(){return this.Ni(),this.Ei.Vt||this.zi.Vt}Ui(){return this.Ni(),this.Ei.Vt}Tt(t){return this.Ni(),this.Ei.pi=this.Ei.pi&&t.N().ticksVisible,this.zi.pi=this.zi.pi&&t.N().ticksVisible,this.Li.ht(this.Ei,this.Ai),this.Oi.ht(this.zi,this.Ai),this.Li}$i(){return this.Ni(),this.Li.ht(this.Ei,this.Ai),this.Oi.ht(this.zi,this.Ai),this.Oi}Ni(){this.St&&(this.Ei.pi=!0,this.zi.pi=!1,this.qi(this.Ei,this.zi,this.Ai))}}class tp extends td{constructor(t,i,e){super(),this.Jt=t,this.Yi=i,this.ji=e}qi(t,i,e){if(t.Vt=!1,2===this.Jt.N().mode)return;let s=this.Jt.N().horzLine;if(!s.labelVisible)return;let h=this.Yi.zt();if(!this.Jt.Vt()||this.Yi.Zi()||null===h)return;let r=this.Yi.Ki().K(s.labelBackgroundColor);e.X=r.X,t.R=r.G;let n=2/12*this.Yi.P();e.Ti=n,e.Ri=n;let l=this.ji(this.Yi);e.Bi=l.Bi,t.ri=this.Yi.Xi(l.gt,h),t.Vt=!0}}let tm=/[1-9]/g;class tg{constructor(){this.Yt=null}ht(t){this.Yt=t}nt(t,i){if(null===this.Yt||!1===this.Yt.Vt||0===this.Yt.ri.length)return;let e=t.useMediaCoordinateSpace(({context:t})=>(t.font=i.k,Math.round(i.Gi.Vi(t,V(this.Yt).ri,tm))));if(e<=0)return;let s=i.Ji,h=e+2*s,r=h/2,n=this.Yt.Qi,l=this.Yt.Bi,o=Math.floor(l-r)+.5;o<0?(l+=Math.abs(0-o),o=Math.floor(l-r)+.5):o+h>n&&(l-=Math.abs(n-(o+h)),o=Math.floor(l-r)+.5);let a=o+h,u=Math.ceil(0+i.S+i.C+i.A+i.P+i.V);t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:e,verticalPixelRatio:s})=>{let h=V(this.Yt);t.fillStyle=h.X;let r=Math.round(o*e),n=Math.round(0*s),l=Math.round(a*e),c=Math.round(u*s),f=Math.round(2*e);if(t.beginPath(),t.moveTo(r,n),t.lineTo(r,c-f),t.arcTo(r,c,r+f,c,f),t.lineTo(l-f,c),t.arcTo(l,c,l,c-f,f),t.lineTo(l,n),t.fill(),h.pi){let r=Math.round(h.Bi*e),l=Math.round((n+i.C)*s);t.fillStyle=h.R;let o=Math.max(1,Math.floor(e)),a=Math.floor(.5*e);t.fillRect(r-a,n,o,l-n)}}),t.useMediaCoordinateSpace(({context:t})=>{let e=V(this.Yt),h=0+i.S+i.C+i.A+i.P/2;t.font=i.k,t.textAlign="left",t.textBaseline="middle",t.fillStyle=e.R;let r=i.Gi.Di(t,"Apr0");t.translate(o+s,h+r),t.fillText(e.ri,0,0)})}}class tv{constructor(t,i,e){this.St=!0,this.Gt=new tg,this.Xt={Vt:!1,X:"#4c525e",R:"white",ri:"",Qi:0,Bi:NaN,pi:!0},this.Ct=t,this.ts=i,this.ji=e}Pt(){this.St=!0}Tt(){return this.St&&(this.Rt(),this.St=!1),this.Gt.ht(this.Xt),this.Gt}Rt(){let t=this.Xt;if(t.Vt=!1,2===this.Ct.N().mode)return;let i=this.Ct.N().vertLine;if(!i.labelVisible)return;let e=this.ts.At();if(e.Zi())return;t.Qi=e.Qi();let s=this.ji();if(null===s)return;t.Bi=s.Bi;let h=e.ss(this.Ct.Bt());t.ri=e.ns(V(h)),t.Vt=!0;let r=this.ts.Ki().K(i.labelBackgroundColor);t.X=r.X,t.R=r.G,t.pi=e.N().ticksVisible}}class tb{constructor(){this.es=null,this.rs=0}hs(){return this.rs}ls(t){this.rs=t}Wt(){return this.es}_s(t){this.es=t}us(t){return[]}cs(){return[]}Vt(){return!0}}(e=p||(p={}))[e.Normal=0]="Normal",e[e.Magnet=1]="Magnet",e[e.Hidden=2]="Hidden",e[e.MagnetOHLC=3]="MagnetOHLC";class ty extends tb{constructor(t,i){let e,s,h,r;super(),this.yt=null,this.ds=NaN,this.fs=0,this.ps=!1,this.vs=new Map,this.ws=!1,this.gs=new WeakMap,this.Ms=new WeakMap,this.bs=NaN,this.xs=NaN,this.Ss=NaN,this.Cs=NaN,this.ts=t,this.ys=i,this.Ps=(e=()=>this.ds,s=()=>this.xs,t=>{let i=s(),h=e();if(t===V(this.yt).ks())return{gt:h,Bi:i};{let e=V(t.zt());return{gt:t.Ts(i,e),Bi:i}}});let n=(h=()=>this.fs,r=()=>this.si(),()=>{let t=this.ts.At().Rs(h()),i=r();return t&&Number.isFinite(i)?{wt:t,Bi:i}:null});this.Ds=new tv(this,t,n)}N(){return this.ys}Vs(t,i){this.Ss=t,this.Cs=i}Is(){this.Ss=NaN,this.Cs=NaN}Bs(){return this.Ss}As(){return this.Cs}Es(t,i,e){this.ws||(this.ws=!0),this.ps=!0,this.zs(t,i,e)}Bt(){return this.fs}si(){return this.bs}ni(){return this.xs}Vt(){return this.ps}Ls(){this.ps=!1,this.Os(),this.ds=NaN,this.bs=NaN,this.xs=NaN,this.yt=null,this.Is(),this.Ns()}Ws(t){let i=this.gs.get(t);i||(i=new tl(this,t),this.gs.set(t,i));let e=this.Ms.get(t);return e||(e=new tr(this.ts,this,t),this.Ms.set(t,e)),[i,e]}ti(t){return t===this.yt&&this.ys.horzLine.visible}ii(){return this.ys.vertLine.visible}Fs(t,i){this.ps&&this.yt===t||this.vs.clear();let e=[];return this.yt===t&&e.push(this.Hs(this.vs,i,this.Ps)),e}cs(){return this.ps?[this.Ds]:[]}Us(){return this.yt}Ns(){this.ts.$s().forEach(t=>{this.gs.get(t)?.Pt(),this.Ms.get(t)?.Pt()}),this.vs.forEach(t=>t.Pt()),this.Ds.Pt()}qs(t){return t&&!t.ks().Zi()?t.ks():null}zs(t,i,e){this.Ys(t,i,e)&&this.Ns()}Ys(t,i,e){let s=this.bs,h=this.xs,r=this.ds,n=this.fs,l=this.yt,o=this.qs(e);this.fs=t,this.bs=isNaN(t)?NaN:this.ts.At().qt(t),this.yt=e;let a=null!==o?o.zt():null;return null!==o&&null!==a?(this.ds=i,this.xs=o.Nt(i,a)):(this.ds=NaN,this.xs=NaN),s!==this.bs||h!==this.xs||n!==this.fs||r!==this.ds||l!==this.yt}Os(){let t=this.ts.js().map(t=>t.Ks().Zs()).filter($),i=0===t.length?null:Math.max(...t);this.fs=null!==i?i:NaN}Hs(t,i,e){let s=t.get(i);return void 0===s&&(s=new tp(this,i,e),t.set(i,s)),s}}function tw(t){return"left"===t||"right"===t}class tM{constructor(t){this.Xs=new Map,this.Gs=[],this.Js=t}Qs(t,i){var e;let s=void 0===(e=this.Xs.get(t))?i:{tn:Math.max(e.tn,i.tn),sn:e.sn||i.sn};this.Xs.set(t,s)}nn(){return this.Js}en(t){let i=this.Xs.get(t);return void 0===i?{tn:this.Js}:{tn:Math.max(this.Js,i.tn),sn:i.sn}}rn(){this.hn(),this.Gs=[{an:0}]}ln(t){this.hn(),this.Gs=[{an:1,Ft:t}]}_n(t){this.un(),this.Gs.push({an:5,Ft:t})}hn(){this.un(),this.Gs.push({an:6})}cn(){this.hn(),this.Gs=[{an:4}]}dn(t){this.hn(),this.Gs.push({an:2,Ft:t})}fn(t){this.hn(),this.Gs.push({an:3,Ft:t})}pn(){return this.Gs}vn(t){for(let i of t.Gs)this.mn(i);this.Js=Math.max(this.Js,t.Js),t.Xs.forEach((t,i)=>{this.Qs(i,t)})}static wn(){return new tM(2)}static gn(){return new tM(3)}mn(t){switch(t.an){case 0:this.rn();break;case 1:this.ln(t.Ft);break;case 2:this.dn(t.Ft);break;case 3:this.fn(t.Ft);break;case 4:this.cn();break;case 5:this._n(t.Ft);break;case 6:this.un()}}un(){let t=this.Gs.findIndex(t=>5===t.an);-1!==t&&this.Gs.splice(t,1)}}function t_(t,i){if(!F(t))return"n/a";if(!I(i)||i<0||i>16)throw TypeError("invalid length");return 0===i?t.toString():("0000000000000000"+t.toString()).slice(-i)}class tS{constructor(t,i){if(i||(i=1),F(t)&&I(t)||(t=100),t<0)throw TypeError("invalid base");this.Yi=t,this.Mn=i,this.bn()}format(t){let i=t<0?"−":"";return t=Math.abs(t),i+this.xn(t)}bn(){if(this.Sn=0,this.Yi>0&&this.Mn>0){let t=this.Yi;for(;t>1;)t/=10,this.Sn++}}xn(t){let i=this.Yi/this.Mn,e=Math.floor(t),s="",h=void 0!==this.Sn?this.Sn:NaN;if(i>1){let r=+(Math.round(t*i)-e*i).toFixed(this.Sn);r>=i&&(r-=i,e+=1),s="."+t_(+r.toFixed(this.Sn)*this.Mn,h)}else e=Math.round(e*i)/i,h>0&&(s="."+t_(0,h));return e.toFixed(0)+s}}class tx extends tS{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class tP{constructor(t){this.Cn=t}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.yn(t):t<999995?i+this.yn(t/1e3)+"K":t<0x3b9ac9fb?(t=1e3*Math.round(t/1e3),i+this.yn(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.yn(t/1e9)+"B")}yn(t){let i=Math.pow(10,this.Cn);return((t=Math.round(t*i)/i)>=1e-15&&t<1?t.toFixed(this.Cn).replace(/\.?0+$/,""):String(t)).replace(/(\.[1-9]*)0+$/,(t,i)=>i)}}let tO=/[2-9]/g;class tC{constructor(t=50){this.Pn=0,this.kn=1,this.Tn=1,this.Rn={},this.Dn=new Map,this.Vn=t}In(){this.Pn=0,this.Dn.clear(),this.kn=1,this.Tn=1,this.Rn={}}Vi(t,i,e){return this.Bn(t,i,e).width}Di(t,i,e){let s=this.Bn(t,i,e);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}Bn(t,i,e){let s=String(i).replace(e||tO,"0");if(this.Dn.has(s))return N(this.Dn.get(s)).An;if(this.Pn===this.Vn){let t=this.Rn[this.Tn];delete this.Rn[this.Tn],this.Dn.delete(t),this.Tn++,this.Pn--}t.save(),t.textBaseline="middle";let h=t.measureText(s);return t.restore(),0===h.width&&i.length||(this.Dn.set(s,{An:h,En:this.kn}),this.Rn[this.kn]=s,this.Pn++,this.kn++),h}}class tR{constructor(t){this.zn=null,this.M=null,this.Ln="right",this.On=t}Nn(t,i,e){this.zn=t,this.M=i,this.Ln=e}nt(t){null!==this.M&&null!==this.zn&&this.zn.nt(t,this.M,this.On,this.Ln)}}class tk{constructor(t,i,e){this.Wn=t,this.On=new tC(50),this.Fn=i,this.O=e,this.W=-1,this.Gt=new tR(this.On)}Tt(){let t=this.O.Hn(this.Fn);if(null===t)return null;let i=t.Un(this.Fn)?t.$n():this.Fn.Wt();if(null===i)return null;let e=t.qn(i);if("overlay"===e)return null;let s=this.O.Yn();return s.P!==this.W&&(this.W=s.P,this.On.In()),this.Gt.Nn(this.Wn.$i(),s,e),this.Gt}}class tz extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}jn(t,i){if(!this.Yt?.Vt)return null;let{ut:e,ct:s,Zn:h}=this.Yt;return i>=e-s-7&&i<=e+s+7?{Kn:this.Yt,Zn:h}:null}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(null===this.Yt||!1===this.Yt.Vt)return;let h=Math.round(this.Yt.ut*s);h<0||h>i.height||(t.lineCap="butt",t.strokeStyle=this.Yt.R,t.lineWidth=Math.floor(this.Yt.ct*e),j(t,this.Yt.Kt),T(t,h,0,i.width))}}class tY{constructor(t){this.Xn={ut:0,R:"rgba(0, 0, 0, 0)",ct:1,Kt:0,Vt:!1},this.Gn=new tz,this.St=!0,this.Jn=t,this.Qn=t.Qt(),this.Gn.ht(this.Xn)}Pt(){this.St=!0}Tt(){return this.Jn.Vt()?(this.St&&(this.te(),this.St=!1),this.Gn):null}}class tE extends tY{constructor(t){super(t)}te(){this.Xn.Vt=!1;let t=this.Jn.Wt(),i=t.ie().ie;if(2!==i&&3!==i)return;let e=this.Jn.N();if(!e.baseLineVisible||!this.Jn.Vt())return;let s=this.Jn.zt();null!==s&&(this.Xn.Vt=!0,this.Xn.ut=t.Nt(s.Ft,s.Ft),this.Xn.R=e.baseLineColor,this.Xn.ct=e.baseLineWidth,this.Xn.Kt=e.baseLineStyle)}}class tj extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}se(){return this.Yt}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){let s=this.Yt;if(null===s)return;let h=Math.max(1,Math.floor(i)),r=h%2/2,n=Math.round(s.ne.x*i)+r,l=s.ne.y*e;t.fillStyle=s.ee,t.beginPath();let o=Math.max(2,1.5*s.re)*i;t.arc(n,l,o,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.he,t.beginPath(),t.arc(n,l,s.ft*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=h,t.strokeStyle=s.ae,t.beginPath(),t.arc(n,l,s.ft*i+h/2,0,2*Math.PI,!1),t.stroke()}}let tT=[{le:0,oe:.25,_e:4,ue:10,ce:.25,de:0,fe:.4,pe:.8},{le:.25,oe:.525,_e:10,ue:14,ce:0,de:0,fe:.8,pe:0},{le:.525,oe:1,_e:14,ue:14,ce:0,de:0,fe:0,pe:0}];class tL{constructor(t){this.Gt=new tj,this.St=!0,this.ve=!0,this.me=performance.now(),this.we=this.me-1,this.ge=t}Me(){this.we=this.me-1,this.Pt()}be(){if(this.Pt(),2===this.ge.N().lastPriceAnimation){let t=performance.now(),i=this.we-t;if(i>0)return void(i<650&&(this.we+=2600));this.me=t,this.we=t+2600}}Pt(){this.St=!0}xe(){this.ve=!0}Vt(){return 0!==this.ge.N().lastPriceAnimation}Se(){switch(this.ge.N().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.we}}Tt(){return this.St?(this.Rt(),this.St=!1,this.ve=!1):this.ve&&(this.Ce(),this.ve=!1),this.Gt}Rt(){this.Gt.ht(null);let t=this.ge.Qt().At(),i=t.ye(),e=this.ge.zt();if(null===i||null===e)return;let s=this.ge.Pe(!0);if(s.ke||!i.Te(s.Re))return;let h={x:t.qt(s.Re),y:this.ge.Wt().Nt(s.gt,e.Ft)},r=s.R,n=this.ge.N().lineWidth,l=this.De(this.Ve(),r);this.Gt.ht({ee:r,re:n,he:l.he,ae:l.ae,ft:l.ft,ne:h})}Ce(){let t=this.Gt.se();if(null!==t){let i=this.De(this.Ve(),t.ee);t.he=i.he,t.ae=i.ae,t.ft=i.ft}}Ve(){return this.Se()?performance.now()-this.me:2599}Ie(t,i,e,s){return this.ge.Qt().Ki().j(t,e+(s-e)*i)}De(t,i){var e;let s;let h=t%2600/2600;for(let t of tT)if(h>=t.le&&h<=t.oe){s=t;break}L(void 0!==s,"Last price animation internal logic error");let r=(h-s.le)/(s.oe-s.le);return{he:this.Ie(i,r,s.ce,s.de),ae:this.Ie(i,r,s.fe,s.pe),ft:(e=s._e)+(s.ue-e)*r}}}class tN extends tY{constructor(t){super(t)}te(){let t=this.Xn;t.Vt=!1;let i=this.Jn.N();if(!i.priceLineVisible||!this.Jn.Vt())return;let e=this.Jn.Pe(0===i.priceLineSource);e.ke||(t.Vt=!0,t.ut=e.Bi,t.R=this.Jn.Be(e.R),t.ct=i.priceLineWidth,t.Kt=i.priceLineStyle)}}class tV extends td{constructor(t){super(),this.Jt=t}qi(t,i,e){t.Vt=!1,i.Vt=!1;let s=this.Jt;if(!s.Vt())return;let h=s.N(),r=h.lastValueVisible,n=""!==s.Ae(),l=0===h.seriesLastValueMode,o=s.Pe(!1);if(o.ke)return;r&&(t.ri=this.Ee(o,r,l),t.Vt=0!==t.ri.length),(n||l)&&(i.ri=this.ze(o,r,n,l),i.Vt=i.ri.length>0);let a=s.Be(o.R),u=this.Jt.Qt().Ki().K(a);e.X=u.X,e.Bi=o.Bi,i.Ht=s.Qt().Ut(o.Bi/s.Wt().$t()),t.Ht=a,t.R=u.G,i.R=u.G}ze(t,i,e,s){let h="",r=this.Jt.Ae();return e&&0!==r.length&&(h+=`${r} `),i&&s&&(h+=this.Jt.Wt().Le()?t.Oe:t.Ne),h.trim()}Ee(t,i,e){return i?e?this.Jt.Wt().Le()?t.Ne:t.Oe:t.ri:""}}function tD(t,i,e,s){let h=Number.isFinite(i),r=Number.isFinite(e);return h&&r?t(i,e):h||r?h?i:e:s}class tB{constructor(t,i){this.We=t,this.Fe=i}He(t){return null!==t&&this.We===t.We&&this.Fe===t.Fe}Ue(){return new tB(this.We,this.Fe)}$e(){return this.We}qe(){return this.Fe}Ye(){return this.Fe-this.We}Zi(){return this.Fe===this.We||Number.isNaN(this.Fe)||Number.isNaN(this.We)}vn(t){return null===t?this:new tB(tD(Math.min,this.$e(),t.$e(),-1/0),tD(Math.max,this.qe(),t.qe(),1/0))}je(t){if(!F(t)||0==this.Fe-this.We)return;let i=.5*(this.Fe+this.We),e=this.Fe-i,s=this.We-i;e*=t,s*=t,this.Fe=i+e,this.We=i+s}Ze(t){F(t)&&(this.Fe+=t,this.We+=t)}Ke(){return{minValue:this.We,maxValue:this.Fe}}static Xe(t){return null===t?null:new tB(t.minValue,t.maxValue)}}class tW{constructor(t,i){this.Ge=t,this.Je=i||null}Qe(){return this.Ge}tr(){return this.Je}Ke(){return{priceRange:null===this.Ge?null:this.Ge.Ke(),margins:this.Je||void 0}}static Xe(t){return null===t?null:new tW(tB.Xe(t.priceRange),t.margins)}}class tF extends tY{constructor(t,i){super(t),this.ir=i}te(){let t=this.Xn;t.Vt=!1;let i=this.ir.N();if(!this.Jn.Vt()||!i.lineVisible)return;let e=this.ir.sr();null!==e&&(t.Vt=!0,t.ut=e,t.R=i.color,t.ct=i.lineWidth,t.Kt=i.lineStyle,t.Zn=this.ir.N().id)}}class tI extends td{constructor(t,i){super(),this.ge=t,this.ir=i}qi(t,i,e){t.Vt=!1,i.Vt=!1;let s=this.ir.N(),h=s.axisLabelVisible,r=""!==s.title,n=this.ge;if(!h||!n.Vt())return;let l=this.ir.sr();if(null===l)return;r&&(i.ri=s.title,i.Vt=!0),i.Ht=n.Qt().Ut(l/n.Wt().$t()),t.ri=this.nr(s.price),t.Vt=!0;let o=this.ge.Qt().Ki().K(s.axisLabelColor||s.color);e.X=o.X;let a=s.axisLabelTextColor||o.G;t.R=a,i.R=a,e.Bi=l}nr(t){let i=this.ge.zt();return null===i?"":this.ge.Wt().Xi(t,i.Ft)}}class tQ{constructor(t,i){this.ge=t,this.ys=i,this.er=new tF(t,this),this.Wn=new tI(t,this),this.rr=new tk(this.Wn,t,t.Qt())}hr(t){W(this.ys,t),this.Pt(),this.ge.Qt().ar()}N(){return this.ys}lr(){return this.er}_r(){return this.rr}ur(){return this.Wn}Pt(){this.er.Pt(),this.Wn.Pt()}sr(){let t=this.ge,i=t.Wt();if(t.Qt().At().Zi()||i.Zi())return null;let e=t.zt();return null===e?null:i.Nt(this.ys.price,e.Ft)}}class tA extends tb{constructor(t){super(),this.ts=t}Qt(){return this.ts}}let tJ={Bar:(t,i,e,s)=>{let h=i.upColor,r=i.downColor,n=V(t(e,s)),l=D(n.Ft[0])<=D(n.Ft[3]);return{cr:n.R??(l?h:r)}},Candlestick:(t,i,e,s)=>{let h=i.upColor,r=i.downColor,n=i.borderUpColor,l=i.borderDownColor,o=i.wickUpColor,a=i.wickDownColor,u=V(t(e,s)),c=D(u.Ft[0])<=D(u.Ft[3]);return{cr:u.R??(c?h:r),dr:u.Ht??(c?n:l),pr:u.vr??(c?o:a)}},Custom:(t,i,e,s)=>({cr:V(t(e,s)).R??i.color}),Area:(t,i,e,s)=>{let h=V(t(e,s));return{cr:h.vt??i.lineColor,vt:h.vt??i.lineColor,mr:h.mr??i.topColor,wr:h.wr??i.bottomColor}},Baseline:(t,i,e,s)=>{let h=V(t(e,s));return{cr:h.Ft[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,gr:h.gr??i.topLineColor,Mr:h.Mr??i.bottomLineColor,br:h.br??i.topFillColor1,Sr:h.Sr??i.topFillColor2,Cr:h.Cr??i.bottomFillColor1,yr:h.yr??i.bottomFillColor2}},Line:(t,i,e,s)=>{let h=V(t(e,s));return{cr:h.R??i.color,vt:h.R??i.color}},Histogram:(t,i,e,s)=>({cr:V(t(e,s)).R??i.color})};class t${constructor(t){this.Pr=(t,i)=>void 0!==i?i.Ft:this.ge.Ks().kr(t),this.ge=t,this.Tr=tJ[t.Rr()]}Dr(t,i){return this.Tr(this.Pr,this.ge.N(),t,i)}}function tU(t,i,e,s,h=0,r=i.length){let n=r-h;for(;0<n;){let r=n>>1,l=h+r;s(i[l],e)===t?(h=l+1,n-=r+1):n=r}return h}let tZ=tU.bind(null,!0),tG=tU.bind(null,!1);(r=m||(m={}))[r.NearestLeft=-1]="NearestLeft",r[r.None=0]="None",r[r.NearestRight=1]="NearestRight";class tK{constructor(){this.Vr=[],this.Ir=new Map,this.Br=new Map,this.Ar=[]}Er(){return this.zr()>0?this.Vr[this.Vr.length-1]:null}Lr(){return this.zr()>0?this.Or(0):null}Zs(){return this.zr()>0?this.Or(this.Vr.length-1):null}zr(){return this.Vr.length}Zi(){return 0===this.zr()}Te(t){return null!==this.Nr(t,0)}kr(t){return this.Wr(t)}Wr(t,i=0){let e=this.Nr(t,i);return null===e?null:{...this.Fr(e),Re:this.Or(e)}}Hr(){return this.Vr}Ur(t,i,e){if(this.Zi())return null;let s=null;for(let h of e)s=tX(s,this.$r(t,i,h));return s}ht(t){this.Br.clear(),this.Ir.clear(),this.Vr=t,this.Ar=t.map(t=>t.Re)}qr(){return this.Ar}Or(t){return this.Vr[t].Re}Fr(t){return this.Vr[t]}Nr(t,i){let e=this.Yr(t);if(null===e&&0!==i)switch(i){case -1:return this.jr(t);case 1:return this.Zr(t);default:throw TypeError("Unknown search mode")}return e}jr(t){let i=this.Kr(t);return i>0&&(i-=1),i!==this.Vr.length&&this.Or(i)<t?i:null}Zr(t){let i=this.Xr(t);return i!==this.Vr.length&&t<this.Or(i)?i:null}Yr(t){let i=this.Kr(t);return i===this.Vr.length||t<this.Vr[i].Re?null:i}Kr(t){return tZ(this.Vr,t,(t,i)=>t.Re<i)}Xr(t){return tG(this.Vr,t,(t,i)=>t.Re>i)}Gr(t,i,e){let s=null;for(let h=t;h<i;h++){let t=this.Vr[h].Ft[e];Number.isNaN(t)||(null===s?s={Jr:t,Qr:t}:(t<s.Jr&&(s.Jr=t),t>s.Qr&&(s.Qr=t)))}return s}$r(t,i,e){if(this.Zi())return null;let s=null,h=V(this.Lr()),r=V(this.Zs()),n=Math.max(t,h),l=Math.min(i,r),o=30*Math.ceil(n/30),a=Math.max(o,30*Math.floor(l/30));{let t=this.Kr(n),h=this.Xr(Math.min(l,o,i));s=tX(s,this.Gr(t,h,e))}let u=this.Ir.get(e);void 0===u&&(u=new Map,this.Ir.set(e,u));for(let t=Math.max(o+1,n);t<a;t+=30){let i=Math.floor(t/30),h=u.get(i);if(void 0===h){let t=this.Kr(30*i),s=this.Xr((i+1)*30-1);h=this.Gr(t,s,e),u.set(i,h)}s=tX(s,h)}{let t=this.Kr(a),i=this.Xr(l);s=tX(s,this.Gr(t,i,e))}return s}}function tX(t,i){return null===t?i:null===i?t:{Jr:Math.min(t.Jr,i.Jr),Qr:Math.max(t.Qr,i.Qr)}}class tH{constructor(t){this.th=t}nt(t,i,e){this.th.draw(t)}ih(t,i,e){this.th.drawBackground?.(t)}}class tq{constructor(t){this.Dn=null,this.sh=t}Tt(){let t=this.sh.renderer();if(null===t)return null;if(this.Dn?.nh===t)return this.Dn.eh;let i=new tH(t);return this.Dn={nh:t,eh:i},i}rh(){return this.sh.zOrder?.()??"normal"}}class t0{constructor(t){this.hh=null,this.ah=t}oh(){return this.ah}Ns(){this.ah.updateAllViews?.()}Ws(){let t=this.ah.paneViews?.()??[];if(this.hh?.nh===t)return this.hh.eh;let i=t.map(t=>new tq(t));return this.hh={nh:t,eh:i},i}jn(t,i){return this.ah.hitTest?.(t,i)??null}}let t1=class extends t0{us(){return[]}};class t2{constructor(t){this.th=t}nt(t,i,e){this.th.draw(t)}ih(t,i,e){this.th.drawBackground?.(t)}}class t3{constructor(t){this.Dn=null,this.sh=t}Tt(){let t=this.sh.renderer();if(null===t)return null;if(this.Dn?.nh===t)return this.Dn.eh;let i=new t2(t);return this.Dn={nh:t,eh:i},i}rh(){return this.sh.zOrder?.()??"normal"}}function t5(t){return{ri:t.text(),Bi:t.coordinate(),Ii:t.fixedCoordinate?.(),R:t.textColor(),X:t.backColor(),Vt:t.visible?.()??!0,pi:t.tickVisible?.()??!0}}class t6{constructor(t,i){this.Gt=new tg,this._h=t,this.uh=i}Tt(){return this.Gt.ht({Qi:this.uh.Qi(),...t5(this._h)}),this.Gt}}class t4 extends td{constructor(t,i){super(),this._h=t,this.Yi=i}qi(t,i,e){let s=t5(this._h);e.X=s.X,t.R=s.R;let h=2/12*this.Yi.P();e.Ti=h,e.Ri=h,e.Bi=s.Bi,e.Ii=s.Ii,t.ri=s.ri,t.Vt=s.Vt,t.pi=s.pi}}class t9 extends t0{constructor(t,i){super(t),this.dh=null,this.fh=null,this.ph=null,this.mh=null,this.ge=i}cs(){let t=this.ah.timeAxisViews?.()??[];if(this.dh?.nh===t)return this.dh.eh;let i=this.ge.Qt().At(),e=t.map(t=>new t6(t,i));return this.dh={nh:t,eh:e},e}Fs(){let t=this.ah.priceAxisViews?.()??[];if(this.fh?.nh===t)return this.fh.eh;let i=this.ge.Wt(),e=t.map(t=>new t4(t,i));return this.fh={nh:t,eh:e},e}wh(){let t=this.ah.priceAxisPaneViews?.()??[];if(this.ph?.nh===t)return this.ph.eh;let i=t.map(t=>new t3(t));return this.ph={nh:t,eh:i},i}gh(){let t=this.ah.timeAxisPaneViews?.()??[];if(this.mh?.nh===t)return this.mh.eh;let i=t.map(t=>new t3(t));return this.mh={nh:t,eh:i},i}Mh(t,i){return this.ah.autoscaleInfo?.(t,i)??null}}function t8(t,i,e,s){t.forEach(t=>{i(t).forEach(t=>{t.rh()===e&&s.push(t)})})}function t7(t){return t.Ws()}function it(t){return t.wh()}function ii(t){return t.gh()}let ie=["Area","Line","Baseline"];class is extends tA{constructor(t,i,e,s,h){super(t),this.Yt=new tK,this.er=new tN(this),this.bh=[],this.xh=new tE(this),this.Sh=null,this.Ch=null,this.yh=null,this.Ph=[],this.ys=e,this.kh=i;let r=new tV(this);this.vs=[r],this.rr=new tk(r,this,t),ie.includes(this.kh)&&(this.Sh=new tL(this)),this.Th(),this.sh=s(this,this.Qt(),h)}m(){null!==this.yh&&clearTimeout(this.yh)}Be(t){return this.ys.priceLineColor||t}Pe(t){let i,e;let s={ke:!0},h=this.Wt();if(this.Qt().At().Zi()||h.Zi()||this.Yt.Zi())return s;let r=this.Qt().At().ye(),n=this.zt();if(null===r||null===n)return s;if(t){let t=this.Yt.Er();if(null===t)return s;i=t,e=t.Re}else{let t=this.Yt.Wr(r.bi(),-1);if(null===t||null===(i=this.Yt.kr(t.Re)))return s;e=t.Re}let l=i.Ft[3],o=this.Rh().Dr(e,{Ft:i}),a=h.Nt(l,n.Ft);return{ke:!1,gt:l,ri:h.Xi(l,n.Ft),Oe:h.Dh(l),Ne:h.Vh(l,n.Ft),R:o.cr,Bi:a,Re:e}}Rh(){return null!==this.Ch||(this.Ch=new t$(this)),this.Ch}N(){return this.ys}hr(t){let i=t.priceScaleId;void 0!==i&&i!==this.ys.priceScaleId&&this.Qt().Ih(this,i),W(this.ys,t),void 0!==t.priceFormat&&(this.Th(),this.Qt().Bh()),this.Qt().Ah(this),this.Qt().Eh(),this.sh.Pt("options")}ht(t,i){this.Yt.ht(t),this.sh.Pt("data"),null!==this.Sh&&(i&&i.zh?this.Sh.be():0===t.length&&this.Sh.Me());let e=this.Qt().Hn(this);this.Qt().Lh(e),this.Qt().Ah(this),this.Qt().Eh(),this.Qt().ar()}Oh(t){let i=new tQ(this,t);return this.bh.push(i),this.Qt().Ah(this),i}Nh(t){let i=this.bh.indexOf(t);-1!==i&&this.bh.splice(i,1),this.Qt().Ah(this)}Wh(){return this.bh}Rr(){return this.kh}zt(){let t=this.Fh();return null===t?null:{Ft:t.Ft[3],Hh:t.wt}}Fh(){let t=this.Qt().At().ye();if(null===t)return null;let i=t.Uh();return this.Yt.Wr(i,1)}Ks(){return this.Yt}$h(t){let i=this.Yt.kr(t);return null===i?null:"Bar"===this.kh||"Candlestick"===this.kh||"Custom"===this.kh?{qh:i.Ft[0],Yh:i.Ft[1],jh:i.Ft[2],Zh:i.Ft[3]}:i.Ft[3]}Kh(t){let i=[];t8(this.Ph,t7,"top",i);let e=this.Sh;return null!==e&&e.Vt()&&(null===this.yh&&e.Se()&&(this.yh=setTimeout(()=>{this.yh=null,this.Qt().Xh()},0)),e.xe(),i.unshift(e)),i}Ws(){let t=[];this.Gh()||t.push(this.xh),t.push(this.sh,this.er);let i=this.bh.map(t=>t.lr());return t.push(...i),t8(this.Ph,t7,"normal",t),t}Jh(){return this.Qh(t7,"bottom")}ta(t){return this.Qh(it,t)}ia(t){return this.Qh(ii,t)}sa(t,i){return this.Ph.map(e=>e.jn(t,i)).filter(t=>null!==t)}us(){return[this.rr,...this.bh.map(t=>t._r())]}Fs(t,i){if(i!==this.es&&!this.Gh())return[];let e=[...this.vs];for(let t of this.bh)e.push(t.ur());return this.Ph.forEach(t=>{e.push(...t.Fs())}),e}cs(){let t=[];return this.Ph.forEach(i=>{t.push(...i.cs())}),t}Mh(t,i){if(void 0!==this.ys.autoscaleInfoProvider){let e=this.ys.autoscaleInfoProvider(()=>{let e=this.na(t,i);return null===e?null:e.Ke()});return tW.Xe(e)}return this.na(t,i)}ea(){return this.ys.priceFormat.minMove}ra(){return this.ha}Ns(){for(let t of(this.sh.Pt(),this.vs))t.Pt();for(let t of this.bh)t.Pt();this.er.Pt(),this.xh.Pt(),this.Sh?.Pt(),this.Ph.forEach(t=>t.Ns())}Wt(){return V(super.Wt())}Et(t){if(!(("Line"===this.kh||"Area"===this.kh||"Baseline"===this.kh)&&this.ys.crosshairMarkerVisible))return null;let i=this.Yt.kr(t);return null===i?null:{gt:i.Ft[3],ft:this.aa(),Ht:this.la(),Ot:this.oa(),Lt:this._a(t)}}Ae(){return this.ys.title}Vt(){return this.ys.visible}ua(t){this.Ph.push(new t9(t,this))}ca(t){this.Ph=this.Ph.filter(i=>i.oh()!==t)}da(){if("Custom"===this.kh)return t=>this.sh.fa(t)}pa(){if("Custom"===this.kh)return t=>this.sh.va(t)}ma(){return this.Yt.qr()}Gh(){return!tw(this.Wt().wa())}na(t,i){if(!I(t)||!I(i)||this.Yt.Zi())return null;let e="Line"===this.kh||"Area"===this.kh||"Baseline"===this.kh||"Histogram"===this.kh?[3]:[2,1],s=this.Yt.Ur(t,i,e),h=null!==s?new tB(s.Jr,s.Qr):null,r=null;if("Histogram"===this.Rr()){let t=this.ys.base,i=new tB(t,t);h=null!==h?h.vn(i):i}return this.Ph.forEach(e=>{let s=e.Mh(t,i);if(s?.priceRange){let t=new tB(s.priceRange.minValue,s.priceRange.maxValue);h=null!==h?h.vn(t):t}s?.margins&&(r=s.margins)}),new tW(h,r)}aa(){switch(this.kh){case"Line":case"Area":case"Baseline":return this.ys.crosshairMarkerRadius}return 0}la(){switch(this.kh){case"Line":case"Area":case"Baseline":{let t=this.ys.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}oa(){switch(this.kh){case"Line":case"Area":case"Baseline":return this.ys.crosshairMarkerBorderWidth}return 0}_a(t){switch(this.kh){case"Line":case"Area":case"Baseline":{let t=this.ys.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.Rh().Dr(t).cr}Th(){switch(this.ys.priceFormat.type){case"custom":this.ha={format:this.ys.priceFormat.formatter};break;case"volume":this.ha=new tP(this.ys.priceFormat.precision);break;case"percent":this.ha=new tx(this.ys.priceFormat.precision);break;default:{let t=Math.pow(10,this.ys.priceFormat.precision);this.ha=new tS(t,this.ys.priceFormat.minMove*t)}}null!==this.es&&this.es.ga()}Qh(t,i){let e=[];return t8(this.Ph,t,i,e),e}}let ih=[3],ir=[0,1,2,3];class il{constructor(t){this.ys=t}Ma(t,i,e){if(0===this.ys.mode)return t;let s=e.ks(),h=s.zt();if(null===h)return t;let r=s.Nt(t,h),n=e.ba().filter(t=>t instanceof is).reduce((t,s)=>{if(e.Un(s)||!s.Vt())return t;let h=s.Wt(),r=s.Ks();if(h.Zi()||!r.Te(i))return t;let n=r.kr(i);if(null===n)return t;let l=D(s.zt()),o=3===this.ys.mode?ir:ih;return t.concat(o.map(t=>h.Nt(n.Ft[t],l.Ft)))},[]);if(0===n.length)return t;n.sort((t,i)=>Math.abs(t-r)-Math.abs(i-r));let l=n[0];return s.Ts(l,h)}}class io extends ti{constructor(){super(...arguments),this.Yt=null}ht(t){this.Yt=t}et({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){var h;if(null===this.Yt)return;let r=Math.max(1,Math.floor(e));t.lineWidth=r,h=()=>{let h=V(this.Yt);if(h.xa){for(let s of(t.strokeStyle=h.Sa,j(t,h.Ca),t.beginPath(),h.ya)){let h=Math.round(s.Pa*e);t.moveTo(h,-r),t.lineTo(h,i.height+r)}t.stroke()}if(h.ka){for(let e of(t.strokeStyle=h.Ta,j(t,h.Ra),t.beginPath(),h.Da)){let h=Math.round(e.Pa*s);t.moveTo(-r,h),t.lineTo(i.width+r,h)}t.stroke()}},t.save(),t.lineWidth%2&&t.translate(.5,.5),h(),t.restore()}}class ia{constructor(t){this.Gt=new io,this.St=!0,this.yt=t}Pt(){this.St=!0}Tt(){if(this.St){let t=this.yt.Qt().N().grid,i={ka:t.horzLines.visible,xa:t.vertLines.visible,Ta:t.horzLines.color,Sa:t.vertLines.color,Ra:t.horzLines.style,Ca:t.vertLines.style,Da:this.yt.ks().Va(),ya:(this.yt.Qt().At().Va()||[]).map(t=>({Pa:t.coord}))};this.Gt.ht(i),this.St=!1}return this.Gt}}class iu{constructor(t){this.sh=new ia(t)}lr(){return this.sh}}let ic={Ia:4,Ba:1e-4};function id(t,i){let e=100*(t-i)/i;return i<0?-e:e}function ip(t,i){let e=100*(t-i)/i+100;return i<0?-e:e}function im(t,i){let e=Math.abs(t);if(e<1e-15)return 0;let s=Math.log10(e+i.Ba)+i.Ia;return t<0?-s:s}function ig(t,i){let e=Math.abs(t);if(e<1e-15)return 0;let s=Math.pow(10,e-i.Ia)-i.Ba;return t<0?-s:s}function iv(t,i){return null===t?null:new tB(im(t.$e(),i),im(t.qe(),i))}function ib(t,i){return null===t?null:new tB(ig(t.$e(),i),ig(t.qe(),i))}function iy(t){if(null===t)return ic;let i=Math.abs(t.qe()-t.$e());if(i>=1||i<1e-15)return ic;let e=Math.ceil(Math.abs(Math.log10(i))),s=ic.Ia+e;return{Ia:s,Ba:1/Math.pow(10,s)}}function iw(t,i,e){return Math.min(Math.max(t,i),e)}function iM(t){let i=Math.ceil(t);return i%2==0?i-1:i}class i_{constructor(t,i){if(this.Aa=t,this.Ea=i,function(t){if(t<0)return!1;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0}(this.Aa))this.za=[2,2.5,2];else{this.za=[];for(let t=this.Aa;1!==t;){if(t%2==0)this.za.push(2),t/=2;else{if(t%5!=0)throw Error("unexpected base");this.za.push(2,2.5),t/=5}if(this.za.length>100)throw Error("something wrong with base")}}}La(t,i,e){let s=0===this.Aa?0:1/this.Aa,h=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,n=this.Ea[0];for(;;){let t=s-h<=1e-14&&h>s+1e-14,i=e*n-h<=1e-14,l=1-h<=1e-14;if(!(t&&i&&l))break;h/=n,n=this.Ea[++r%this.Ea.length]}if(h<=s+1e-14&&(h=s),h=Math.max(1,h),this.za.length>0&&1e-14>Math.abs(h-1))for(r=0,n=this.za[0];e*n-h<=1e-14&&h>s+1e-14;)h/=n,n=this.za[++r%this.za.length];return h}}class iS{constructor(t,i,e,s){this.Oa=[],this.Yi=t,this.Aa=i,this.Na=e,this.Wa=s}La(t,i){if(t<i)throw Error("high < low");let e=this.Yi.$t(),s=(t-i)*this.Fa()/e,h=new i_(this.Aa,[2,2.5,2]),r=new i_(this.Aa,[2,2,2.5]),n=new i_(this.Aa,[2.5,2,2]),l=[];return l.push(h.La(t,i,s),r.La(t,i,s),n.La(t,i,s)),function(t){if(t.length<1)throw Error("array is empty");let i=t[0];for(let e=1;e<t.length;++e)t[e]<i&&(i=t[e]);return i}(l)}Ha(){let t=this.Yi,i=t.zt();if(null===i)return void(this.Oa=[]);let e=t.$t(),s=this.Na(e-1,i),h=this.Na(0,i),r=this.Yi.N().entireTextOnly?this.Ua()/2:0,n=e-1-r,l=Math.max(s,h),o=Math.min(s,h);if(l===o)return void(this.Oa=[]);let a=this.La(l,o),u=l%a;u+=u<0?a:0;let c=l>=o?1:-1,f=null,d=0;for(let e=l-u;e>o;e-=a){let s=this.Wa(e,i,!0);null!==f&&Math.abs(s-f)<this.Fa()||s<r||s>n||(d<this.Oa.length?(this.Oa[d].Pa=s,this.Oa[d].$a=t.qa(e)):this.Oa.push({Pa:s,$a:t.qa(e)}),d++,f=s,t.Ya()&&(a=this.La(e*c,o)))}this.Oa.length=d}Va(){return this.Oa}Ua(){return this.Yi.P()}Fa(){return Math.ceil(2.5*this.Ua())}}function ix(t){return t.slice().sort((t,i)=>V(t.hs())-V(i.hs()))}(n=g||(g={}))[n.Normal=0]="Normal",n[n.Logarithmic=1]="Logarithmic",n[n.Percentage=2]="Percentage",n[n.IndexedTo100=3]="IndexedTo100";let iP=new tx,iO=new tS(100,1);class iC{constructor(t,i,e,s,h){this.ja=0,this.Za=null,this.Ge=null,this.Ka=null,this.Xa={Ga:!1,Ja:null},this.Qa=0,this.tl=0,this.il=new B,this.sl=new B,this.nl=[],this.el=null,this.rl=null,this.hl=null,this.al=null,this.ha=iO,this.ll=iy(null),this.ol=t,this.ys=i,this._l=e,this.ul=s,this.cl=h,this.dl=new iS(this,100,this.fl.bind(this),this.pl.bind(this))}wa(){return this.ol}N(){return this.ys}hr(t){if(W(this.ys,t),this.ga(),void 0!==t.mode&&this.vl({ie:t.mode}),void 0!==t.scaleMargins){let i=N(t.scaleMargins.top),e=N(t.scaleMargins.bottom);if(i<0||i>1)throw Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(e<0||e>1)throw Error(`Invalid bottom margin - expect value between 0 and 1, given=${e}`);if(i+e>1)throw Error(`Invalid margins - sum of margins must be less than 1, given=${i+e}`);this.ml(),this.rl=null}}wl(){return this.ys.autoScale}Ya(){return 1===this.ys.mode}Le(){return 2===this.ys.mode}gl(){return 3===this.ys.mode}ie(){return{sn:this.ys.autoScale,Ml:this.ys.invertScale,ie:this.ys.mode}}vl(t){let i=this.ie(),e=null;void 0!==t.sn&&(this.ys.autoScale=t.sn),void 0!==t.ie&&(this.ys.mode=t.ie,2!==t.ie&&3!==t.ie||(this.ys.autoScale=!0),this.Xa.Ga=!1),1===i.ie&&t.ie!==i.ie&&(function(t,i){if(null===t)return!1;let e=ig(t.$e(),i),s=ig(t.qe(),i);return isFinite(e)&&isFinite(s)}(this.Ge,this.ll)?null!==(e=ib(this.Ge,this.ll))&&this.bl(e):this.ys.autoScale=!0),1===t.ie&&t.ie!==i.ie&&null!==(e=iv(this.Ge,this.ll))&&this.bl(e);let s=i.ie!==this.ys.mode;s&&(2===i.ie||this.Le())&&this.ga(),s&&(3===i.ie||this.gl())&&this.ga(),void 0!==t.Ml&&i.Ml!==t.Ml&&(this.ys.invertScale=t.Ml,this.xl()),this.sl.p(i,this.ie())}Sl(){return this.sl}P(){return this._l.fontSize}$t(){return this.ja}Cl(t){this.ja!==t&&(this.ja=t,this.ml(),this.rl=null)}yl(){if(this.Za)return this.Za;let t=this.$t()-this.Pl()-this.kl();return this.Za=t,t}Qe(){return this.Tl(),this.Ge}bl(t,i){let e=this.Ge;(i||null===e&&null!==t||null!==e&&!e.He(t))&&(this.rl=null,this.Ge=t)}Zi(){return this.Tl(),0===this.ja||!this.Ge||this.Ge.Zi()}Rl(t){return this.Ml()?t:this.$t()-1-t}Nt(t,i){return this.Le()?t=id(t,i):this.gl()&&(t=ip(t,i)),this.pl(t,i)}Dl(t,i,e){this.Tl();let s=this.kl(),h=V(this.Qe()),r=h.$e(),n=h.qe(),l=this.yl()-1,o=this.Ml(),a=l/(n-r),u=void 0===e?0:e.from,c=void 0===e?t.length:e.to,f=this.Vl();for(let e=u;e<c;e++){let h=t[e],n=h.gt;if(isNaN(n))continue;let l=n;null!==f&&(l=f(h.gt,i));let u=s+a*(l-r),c=o?u:this.ja-1-u;h.ut=c}}Il(t,i,e){this.Tl();let s=this.kl(),h=V(this.Qe()),r=h.$e(),n=h.qe(),l=this.yl()-1,o=this.Ml(),a=l/(n-r),u=void 0===e?0:e.from,c=void 0===e?t.length:e.to,f=this.Vl();for(let e=u;e<c;e++){let h=t[e],n=h.qh,l=h.Yh,u=h.jh,c=h.Zh;null!==f&&(n=f(h.qh,i),l=f(h.Yh,i),u=f(h.jh,i),c=f(h.Zh,i));let d=s+a*(n-r),p=o?d:this.ja-1-d;h.Bl=p,d=s+a*(l-r),p=o?d:this.ja-1-d,h.Al=p,d=s+a*(u-r),p=o?d:this.ja-1-d,h.El=p,d=s+a*(c-r),p=o?d:this.ja-1-d,h.zl=p}}Ts(t,i){let e=this.fl(t,i);return this.Ll(e,i)}Ll(t,i){var e,s;let h=t;return this.Le()?(e=h,i<0&&(e=-e),h=e/100*i+i):this.gl()&&(s=h-100,i<0&&(s=-s),h=s/100*i+i),h}ba(){return this.nl}Dt(){if(this.el)return this.el;let t=[];for(let i=0;i<this.nl.length;i++){let e=this.nl[i];null===e.hs()&&e.ls(i+1),t.push(e)}return t=ix(t),this.el=t,this.el}Ol(t){-1===this.nl.indexOf(t)&&(this.nl.push(t),this.ga(),this.Nl())}Wl(t){let i=this.nl.indexOf(t);if(-1===i)throw Error("source is not attached to scale");this.nl.splice(i,1),0===this.nl.length&&(this.vl({sn:!0}),this.bl(null)),this.ga(),this.Nl()}zt(){let t=null;for(let i of this.nl){let e=i.zt();null!==e&&(null===t||e.Hh<t.Hh)&&(t=e)}return null===t?null:t.Ft}Ml(){return this.ys.invertScale}Va(){let t=null===this.zt();if(null!==this.rl&&(t||this.rl.Fl===t))return this.rl.Va;this.dl.Ha();let i=this.dl.Va();return this.rl={Va:i,Fl:t},this.il.p(),i}Hl(){return this.il}Ul(t){this.Le()||this.gl()||null===this.hl&&null===this.Ka&&(this.Zi()||(this.hl=this.ja-t,this.Ka=V(this.Qe()).Ue()))}$l(t){if(this.Le()||this.gl()||null===this.hl)return;this.vl({sn:!1}),(t=this.ja-t)<0&&(t=0);let i=(this.hl+.2*(this.ja-1))/(t+.2*(this.ja-1)),e=V(this.Ka).Ue();i=Math.max(i,.1),e.je(i),this.bl(e)}ql(){this.Le()||this.gl()||(this.hl=null,this.Ka=null)}Yl(t){this.wl()||null===this.al&&null===this.Ka&&(this.Zi()||(this.al=t,this.Ka=V(this.Qe()).Ue()))}jl(t){if(this.wl()||null===this.al)return;let i=V(this.Qe()).Ye()/(this.yl()-1),e=t-this.al;this.Ml()&&(e*=-1);let s=e*i,h=V(this.Ka).Ue();h.Ze(s),this.bl(h,!0),this.rl=null}Zl(){this.wl()||null!==this.al&&(this.al=null,this.Ka=null)}ra(){return this.ha||this.ga(),this.ha}Xi(t,i){switch(this.ys.mode){case 2:return this.Kl(id(t,i));case 3:return this.ra().format(ip(t,i));default:return this.nr(t)}}qa(t){switch(this.ys.mode){case 2:return this.Kl(t);case 3:return this.ra().format(t);default:return this.nr(t)}}Dh(t){return this.nr(t,V(this.Xl()).ra())}Vh(t,i){return t=id(t,i),this.Kl(t,iP)}Gl(){return this.nl}Jl(t){this.Xa={Ja:t,Ga:!1}}Ns(){this.nl.forEach(t=>t.Ns())}ga(){this.rl=null;let t=this.Xl(),i=100;null!==t&&(i=Math.round(1/t.ea())),this.ha=iO,this.Le()?(this.ha=iP,i=100):this.gl()?(this.ha=new tS(100,1),i=100):null!==t&&(this.ha=t.ra()),this.dl=new iS(this,i,this.fl.bind(this),this.pl.bind(this)),this.dl.Ha()}Nl(){this.el=null}Ki(){return this.cl}Xl(){return this.nl[0]||null}Pl(){return this.Ml()?this.ys.scaleMargins.bottom*this.$t()+this.tl:this.ys.scaleMargins.top*this.$t()+this.Qa}kl(){return this.Ml()?this.ys.scaleMargins.top*this.$t()+this.Qa:this.ys.scaleMargins.bottom*this.$t()+this.tl}Tl(){this.Xa.Ga||(this.Xa.Ga=!0,this.Ql())}ml(){this.Za=null}pl(t,i){if(this.Tl(),this.Zi())return 0;t=this.Ya()&&t?im(t,this.ll):t;let e=V(this.Qe()),s=this.kl()+(this.yl()-1)*(t-e.$e())/e.Ye();return this.Rl(s)}fl(t,i){if(this.Tl(),this.Zi())return 0;let e=this.Rl(t),s=V(this.Qe()),h=s.$e()+s.Ye()*((e-this.kl())/(this.yl()-1));return this.Ya()?ig(h,this.ll):h}xl(){this.rl=null,this.dl.Ha()}Ql(){var t,i,e,s,h;let r=this.Xa.Ja;if(null===r)return;let n=null,l=this.Gl(),o=0,a=0;for(let t of l){if(!t.Vt())continue;let l=t.zt();if(null===l)continue;let u=t.Mh(r.Uh(),r.bi()),c=u&&u.Qe();if(null!==c){switch(this.ys.mode){case 1:c=iv(c,this.ll);break;case 2:i=c,e=l.Ft,c=new tB(id(i.$e(),e),id(i.qe(),e));break;case 3:s=c,h=l.Ft,c=new tB(ip(s.$e(),h),ip(s.qe(),h))}if(n=null===n?c:n.vn(V(c)),null!==u){let t=u.tr();null!==t&&(o=Math.max(o,t.above),a=Math.max(a,t.below))}}}if(o===this.Qa&&a===this.tl||(this.Qa=o,this.tl=a,this.rl=null,this.ml()),null!==n){if(n.$e()===n.qe()){let t=this.Xl(),i=5*(null===t||this.Le()||this.gl()?1:t.ea());this.Ya()&&(n=ib(n,this.ll)),n=new tB(n.$e()-i,n.qe()+i),this.Ya()&&(n=iv(n,this.ll))}if(this.Ya()){let i=ib(n,this.ll),e=iy(i);if(t=this.ll,e.Ia!==t.Ia||e.Ba!==t.Ba){let t=null!==this.Ka?ib(this.Ka,this.ll):null;this.ll=e,n=iv(i,e),null!==t&&(this.Ka=iv(t,e))}}this.bl(n)}else null===this.Ge&&(this.bl(new tB(-.5,.5)),this.ll=iy(null));this.Xa.Ga=!0}Vl(){return this.Le()?id:this.gl()?ip:this.Ya()?t=>im(t,this.ll):null}io(t,i,e){return void 0===i?(void 0===e&&(e=this.ra()),e.format(t)):i(t)}nr(t,i){return this.io(t,this.ul.priceFormatter,i)}Kl(t,i){return this.io(t,this.ul.percentageFormatter,i)}}function iR(t){return t instanceof is}class ik{constructor(t,i){this.nl=[],this.so=new Map,this.ja=0,this.no=0,this.eo=1e3,this.el=null,this.ro=new B,this.Ph=[],this.uh=t,this.ts=i,this.ho=new iu(this);let e=i.N();this.ao=this.lo("left",e.leftPriceScale),this.oo=this.lo("right",e.rightPriceScale),this.ao.Sl().i(this._o.bind(this,this.ao),this),this.oo.Sl().i(this._o.bind(this,this.oo),this),this.uo(e)}uo(t){if(t.leftPriceScale&&this.ao.hr(t.leftPriceScale),t.rightPriceScale&&this.oo.hr(t.rightPriceScale),t.localization&&(this.ao.ga(),this.oo.ga()),t.overlayPriceScales)for(let i of Array.from(this.so.values())){let e=V(i[0].Wt());e.hr(t.overlayPriceScales),t.localization&&e.ga()}}co(t){switch(t){case"left":return this.ao;case"right":return this.oo}return this.so.has(t)?N(this.so.get(t))[0].Wt():null}m(){this.Qt().do().u(this),this.ao.Sl().u(this),this.oo.Sl().u(this),this.nl.forEach(t=>{t.m&&t.m()}),this.Ph=this.Ph.filter(t=>{let i=t.oh();return i.detached&&i.detached(),!1}),this.ro.p()}fo(){return this.eo}po(t){this.eo=t}Qt(){return this.ts}Qi(){return this.no}$t(){return this.ja}vo(t){this.no=t,this.mo()}Cl(t){this.ja=t,this.ao.Cl(t),this.oo.Cl(t),this.nl.forEach(i=>{if(this.Un(i)){let e=i.Wt();null!==e&&e.Cl(t)}}),this.mo()}wo(){return this.nl.filter(iR)}ba(){return this.nl}Un(t){let i=t.Wt();return null===i||this.ao!==i&&this.oo!==i}Ol(t,i,e){let s=void 0!==e?e:this.bo().Mo+1;this.xo(t,i,s)}Wl(t){let i=this.nl.indexOf(t);L(-1!==i,"removeDataSource: invalid data source"),this.nl.splice(i,1);let e=V(t.Wt()).wa();if(this.so.has(e)){let i=N(this.so.get(e)),s=i.indexOf(t);-1!==s&&(i.splice(s,1),0===i.length&&this.so.delete(e))}let s=t.Wt();s&&s.ba().indexOf(t)>=0&&s.Wl(t),null!==s&&(s.Nl(),this.So(s)),this.el=null}qn(t){return t===this.ao?"left":t===this.oo?"right":"overlay"}Co(){return this.ao}yo(){return this.oo}Po(t,i){t.Ul(i)}ko(t,i){t.$l(i),this.mo()}To(t){t.ql()}Ro(t,i){t.Yl(i)}Do(t,i){t.jl(i),this.mo()}Vo(t){t.Zl()}mo(){this.nl.forEach(t=>{t.Ns()})}ks(){let t=null;return this.ts.N().rightPriceScale.visible&&0!==this.oo.ba().length?t=this.oo:this.ts.N().leftPriceScale.visible&&0!==this.ao.ba().length?t=this.ao:0!==this.nl.length&&(t=this.nl[0].Wt()),null===t&&(t=this.oo),t}$n(){let t=null;return this.ts.N().rightPriceScale.visible?t=this.oo:this.ts.N().leftPriceScale.visible&&(t=this.ao),t}So(t){null!==t&&t.wl()&&this.Io(t)}Bo(t){let i=this.uh.ye();t.vl({sn:!0}),null!==i&&t.Jl(i),this.mo()}Ao(){this.Io(this.ao),this.Io(this.oo)}Eo(){this.So(this.ao),this.So(this.oo),this.nl.forEach(t=>{this.Un(t)&&this.So(t.Wt())}),this.mo(),this.ts.ar()}Dt(){return null===this.el&&(this.el=ix(this.nl)),this.el}It(){return this.Dt().filter(iR)}zo(){return this.ro}Lo(){return this.ho}ua(t){this.Ph.push(new t1(t))}ca(t){this.Ph=this.Ph.filter(i=>i.oh()!==t),t.detached&&t.detached(),this.ts.ar()}Oo(){return this.Ph}sa(t,i){return this.Ph.map(e=>e.jn(t,i)).filter(t=>null!==t)}Io(t){let i=t.Gl();if(i&&i.length>0&&!this.uh.Zi()){let i=this.uh.ye();null!==i&&t.Jl(i)}t.Ns()}bo(){let t=this.Dt();if(0===t.length)return{No:0,Mo:0};let i=0,e=0;for(let s=0;s<t.length;s++){let h=t[s].hs();null!==h&&(h<i&&(i=h),h>e&&(e=h))}return{No:i,Mo:e}}xo(t,i,e){let s=this.co(i);if(null===s&&(s=this.lo(i,this.ts.N().overlayPriceScales)),this.nl.push(t),!tw(i)){let e=this.so.get(i)||[];e.push(t),this.so.set(i,e)}s.Ol(t),t._s(s),t.ls(e),this.So(s),this.el=null}_o(t,i,e){i.ie!==e.ie&&this.Io(t)}lo(t,i){let e=new iC(t,{visible:!0,autoScale:!0,...J(i)},this.ts.N().layout,this.ts.N().localization,this.ts.Ki());return e.Cl(this.$t()),e}}function iz(t){return{Wo:t.Wo,Fo:{Zn:t.Ho.externalId},Uo:t.Ho.cursorStyle}}function iY(t,i,e){let s=[t,...t.Dt()],h=function(t,i,e){var s,h;let r,n;for(let l of t)for(let t of l.sa?.(i,e)??[])s=t.zOrder,(h=r?.zOrder)&&("top"!==s||"top"===h)&&("normal"!==s||"bottom"!==h)||(r=t,n=l);return r&&n?{Ho:r,Wo:n}:null}(s,i,e);if("top"===h?.Ho.zOrder)return iz(h);for(let r of s){if(h&&h.Wo===r&&"bottom"!==h.Ho.zOrder&&!h.Ho.isBackground)return iz(h);if(void 0!==r.Ws){let s=function(t,i,e,s){for(let h of t){let t=h.Tt(s);if(null!==t&&t.jn){let s=t.jn(i,e);if(null!==s)return{$o:h,Fo:s}}}return null}(r.Ws(t),i,e,t);if(null!==s)return{Wo:r,$o:s.$o,Fo:s.Fo}}if(h&&h.Wo===r&&"bottom"!==h.Ho.zOrder&&h.Ho.isBackground)return iz(h)}return h?.Ho?iz(h):null}class iE{constructor(t,i,e=50){this.Pn=0,this.kn=1,this.Tn=1,this.Dn=new Map,this.Rn=new Map,this.qo=t,this.Yo=i,this.Vn=e}jo(t){let i=t.time,e=this.Yo.cacheKey(i),s=this.Dn.get(e);if(void 0!==s)return s.Zo;if(this.Pn===this.Vn){let t=this.Rn.get(this.Tn);this.Rn.delete(this.Tn),this.Dn.delete(N(t)),this.Tn++,this.Pn--}let h=this.qo(t);return this.Dn.set(e,{Zo:h,En:this.kn}),this.Rn.set(this.kn,e),this.Pn++,this.kn++,h}}class ij{constructor(t,i){L(t<=i,"right should be >= left"),this.Ko=t,this.Xo=i}Uh(){return this.Ko}bi(){return this.Xo}Go(){return this.Xo-this.Ko+1}Te(t){return this.Ko<=t&&t<=this.Xo}He(t){return this.Ko===t.Uh()&&this.Xo===t.bi()}}function iT(t,i){return null===t||null===i?t===i:t.He(i)}class iL{constructor(){this.Jo=new Map,this.Dn=null,this.Qo=!1}t_(t){this.Qo=t,this.Dn=null}i_(t,i){this.s_(i),this.Dn=null;for(let e=i;e<t.length;++e){let i=t[e],s=this.Jo.get(i.timeWeight);void 0===s&&(s=[],this.Jo.set(i.timeWeight,s)),s.push({index:e,time:i.time,weight:i.timeWeight,originalTime:i.originalTime})}}n_(t,i,e,s,h){let r=Math.ceil(i/t);return null!==this.Dn&&this.Dn.e_===r&&h===this.Dn.r_&&e===this.Dn.h_||(this.Dn={r_:h,h_:e,Va:this.a_(r,e,s),e_:r}),this.Dn.Va}s_(t){if(0===t)return void this.Jo.clear();let i=[];for(let e of(this.Jo.forEach((e,s)=>{t<=e[0].index?i.push(s):e.splice(tZ(e,t,i=>i.index<t),1/0)}),i))this.Jo.delete(e)}a_(t,i,e){let s=[],h=t=>!i||e.has(t.index);for(let i of Array.from(this.Jo.keys()).sort((t,i)=>i-t)){if(!this.Jo.get(i))continue;let e=s;s=[];let r=e.length,n=0,l=N(this.Jo.get(i)),o=l.length,a=1/0,u=-1/0;for(let i=0;i<o;i++){let o=l[i],c=o.index;for(;n<r;){let t=e[n],i=t.index;if(!(i<c&&h(t))){a=i;break}n++,s.push(t),u=i,a=1/0}if(a-c>=t&&c-u>=t&&h(o))s.push(o),u=c;else if(this.Qo)return e}for(;n<r;n++)h(e[n])&&s.push(e[n])}return s}}class iN{constructor(t){this.l_=t}o_(){return null===this.l_?null:new ij(Math.floor(this.l_.Uh()),Math.ceil(this.l_.bi()))}__(){return this.l_}static u_(){return new iN(null)}}function iV(t,i){return t.weight>i.weight?t:i}class iD{constructor(t,i,e,s){this.no=0,this.c_=null,this.d_=[],this.al=null,this.hl=null,this.f_=new iL,this.p_=new Map,this.v_=iN.u_(),this.m_=!0,this.w_=new B,this.g_=new B,this.M_=new B,this.b_=null,this.x_=null,this.S_=new Map,this.C_=-1,this.y_=[],this.ys=i,this.ul=e,this.P_=i.rightOffset,this.k_=i.barSpacing,this.ts=t,this.Yo=s,this.T_(),this.f_.t_(i.uniformDistribution),this.R_()}N(){return this.ys}D_(t){W(this.ul,t),this.V_(),this.T_()}hr(t,i){W(this.ys,t),this.ys.fixLeftEdge&&this.I_(),this.ys.fixRightEdge&&this.B_(),void 0!==t.barSpacing&&this.ts.dn(t.barSpacing),void 0!==t.rightOffset&&this.ts.fn(t.rightOffset),void 0===t.minBarSpacing&&void 0===t.maxBarSpacing||this.ts.dn(t.barSpacing??this.k_),void 0!==t.ignoreWhitespaceIndices&&t.ignoreWhitespaceIndices!==this.ys.ignoreWhitespaceIndices&&this.R_(),this.V_(),this.T_(),this.M_.p()}Rs(t){return this.d_[t]?.time??null}ss(t){return this.d_[t]??null}A_(t,i){if(this.d_.length<1)return null;if(this.Yo.key(t)>this.Yo.key(this.d_[this.d_.length-1].time))return i?this.d_.length-1:null;let e=tZ(this.d_,this.Yo.key(t),(t,i)=>this.Yo.key(t.time)<i);return this.Yo.key(t)<this.Yo.key(this.d_[e].time)?i?e:null:e}Zi(){return 0===this.no||0===this.d_.length||null===this.c_}E_(){return this.d_.length>0}ye(){return this.z_(),this.v_.o_()}L_(){return this.z_(),this.v_.__()}O_(){let t=this.ye();if(null===t)return null;let i={from:t.Uh(),to:t.bi()};return this.N_(i)}N_(t){let i=Math.round(t.from),e=Math.round(t.to),s=V(this.W_()),h=V(this.F_());return{from:V(this.ss(Math.max(s,i))),to:V(this.ss(Math.min(h,e)))}}H_(t){return{from:V(this.A_(t.from,!0)),to:V(this.A_(t.to,!0))}}Qi(){return this.no}vo(t){if(!isFinite(t)||t<=0||this.no===t)return;let i=this.L_(),e=this.no;if(this.no=t,this.m_=!0,this.ys.lockVisibleTimeRangeOnResize&&0!==e){let i=this.k_*t/e;this.k_=i}this.ys.fixLeftEdge&&null!==i&&0>=i.Uh()&&(this.P_-=Math.round((e-t)/this.k_)+1,this.m_=!0),this.U_(),this.q_()}qt(t){if(this.Zi()||!I(t))return 0;let i=this.Y_()+this.P_-t;return this.no-(i+.5)*this.k_-1}j_(t,i){let e=this.Y_(),s=void 0===i?0:i.from,h=void 0===i?t.length:i.to;for(let i=s;i<h;i++){let s=t[i].wt,h=e+this.P_-s,r=this.no-(h+.5)*this.k_-1;t[i]._t=r}}Z_(t,i){let e=Math.ceil(this.K_(t));return i&&this.ys.ignoreWhitespaceIndices&&!this.X_(e)?this.G_(e):e}fn(t){this.m_=!0,this.P_=t,this.q_(),this.ts.J_(),this.ts.ar()}Q_(){return this.k_}dn(t){this.tu(t),this.q_(),this.ts.J_(),this.ts.ar()}iu(){return this.P_}Va(){if(this.Zi())return null;if(null!==this.x_)return this.x_;let t=this.k_,i=5*(this.ts.N().layout.fontSize+4)/8*(this.ys.tickMarkMaxCharacterLength||8),e=Math.round(i/t),s=V(this.ye()),h=Math.max(s.Uh(),s.Uh()-e),r=Math.max(s.bi(),s.bi()-e),n=this.f_.n_(t,i,this.ys.ignoreWhitespaceIndices,this.S_,this.C_),l=this.W_()+e,o=this.F_()-e,a=this.su(),u=this.ys.fixLeftEdge||a,c=this.ys.fixRightEdge||a,f=0;for(let t of n){let e;h<=t.index&&t.index<=r&&(f<this.y_.length?((e=this.y_[f]).coord=this.qt(t.index),e.label=this.nu(t),e.weight=t.weight):(e={needAlignCoordinate:!1,coord:this.qt(t.index),label:this.nu(t),weight:t.weight},this.y_.push(e)),this.k_>i/2&&!a?e.needAlignCoordinate=!1:e.needAlignCoordinate=u&&t.index<=l||c&&t.index>=o,f++)}return this.y_.length=f,this.x_=this.y_,this.y_}eu(){this.m_=!0,this.dn(this.ys.barSpacing),this.fn(this.ys.rightOffset)}ru(t){this.m_=!0,this.c_=t,this.q_(),this.I_()}hu(t,i){let e=this.K_(t),s=this.Q_();this.dn(s+s/10*i),this.ys.rightBarStaysOnScroll||this.fn(this.iu()+(e-this.K_(t)))}Ul(t){this.al&&this.Zl(),null===this.hl&&null===this.b_&&(this.Zi()||(this.hl=t,this.au()))}$l(t){if(null===this.b_)return;let i=iw(this.no-t,0,this.no),e=iw(this.no-V(this.hl),0,this.no);0!==i&&0!==e&&this.dn(this.b_.Q_*i/e)}ql(){null!==this.hl&&(this.hl=null,this.lu())}Yl(t){null===this.al&&null===this.b_&&(this.Zi()||(this.al=t,this.au()))}jl(t){if(null===this.al)return;let i=(this.al-t)/this.Q_();this.P_=V(this.b_).iu+i,this.m_=!0,this.q_()}Zl(){null!==this.al&&(this.al=null,this.lu())}ou(){this._u(this.ys.rightOffset)}_u(t,i=400){if(!isFinite(t))throw RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw RangeError("animationDuration (optional) must be finite positive number");let e=this.P_,s=performance.now();this.ts._n({uu:t=>(t-s)/i>=1,cu:h=>{let r=(h-s)/i;return r>=1?t:e+(t-e)*r}})}Pt(t,i){this.m_=!0,this.d_=t,this.f_.i_(t,i),this.q_()}du(){return this.w_}fu(){return this.g_}pu(){return this.M_}Y_(){return this.c_||0}vu(t){let i=t.Go();this.tu(this.no/i),this.P_=t.bi()-this.Y_(),this.q_(),this.m_=!0,this.ts.J_(),this.ts.ar()}mu(){let t=this.W_(),i=this.F_();null!==t&&null!==i&&this.vu(new ij(t,i+this.ys.rightOffset))}wu(t){let i=new ij(t.from,t.to);this.vu(i)}ns(t){return void 0!==this.ul.timeFormatter?this.ul.timeFormatter(t.originalTime):this.Yo.formatHorzItem(t.time)}R_(){if(this.ys.ignoreWhitespaceIndices){for(let t of(this.S_.clear(),this.ts.js()))for(let i of t.ma())this.S_.set(i,!0);this.C_++}}su(){let t=this.ts.N().handleScroll,i=this.ts.N().handleScale;return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||i.axisDoubleClickReset.time||i.axisPressedMouseMove.time||i.mouseWheel||i.pinch)}W_(){return 0===this.d_.length?null:0}F_(){return 0===this.d_.length?null:this.d_.length-1}gu(t){return(this.no-1-t)/this.k_}K_(t){let i=this.gu(t);return Math.round(1e6*(this.Y_()+this.P_-i))/1e6}tu(t){let i=this.k_;this.k_=t,this.U_(),i!==this.k_&&(this.m_=!0,this.Mu())}z_(){if(!this.m_)return;if(this.m_=!1,this.Zi())return void this.bu(iN.u_());let t=this.Y_(),i=this.no/this.k_,e=this.P_+t,s=new ij(e-i+1,e);this.bu(new iN(s))}U_(){let t=iw(this.k_,this.xu(),this.Su());this.k_!==t&&(this.k_=t,this.m_=!0)}Su(){return this.ys.maxBarSpacing>0?this.ys.maxBarSpacing:.5*this.no}xu(){return this.ys.fixLeftEdge&&this.ys.fixRightEdge&&0!==this.d_.length?this.no/this.d_.length:this.ys.minBarSpacing}q_(){let t=this.Cu();null!==t&&this.P_<t&&(this.P_=t,this.m_=!0);let i=this.yu();this.P_>i&&(this.P_=i,this.m_=!0)}Cu(){let t=this.W_(),i=this.c_;return null===t||null===i?null:t-i-1+(this.ys.fixLeftEdge?this.no/this.k_:Math.min(2,this.d_.length))}yu(){return this.ys.fixRightEdge?0:this.no/this.k_-Math.min(2,this.d_.length)}au(){this.b_={Q_:this.Q_(),iu:this.iu()}}lu(){this.b_=null}nu(t){let i=this.p_.get(t.weight);return void 0===i&&(i=new iE(t=>this.Pu(t),this.Yo),this.p_.set(t.weight,i)),i.jo(t)}Pu(t){return this.Yo.formatTickmark(t,this.ul)}bu(t){let i=this.v_;this.v_=t,iT(i.o_(),this.v_.o_())||this.w_.p(),iT(i.__(),this.v_.__())||this.g_.p(),this.Mu()}Mu(){this.x_=null}V_(){this.Mu(),this.p_.clear()}T_(){this.Yo.updateFormatter(this.ul)}I_(){if(!this.ys.fixLeftEdge)return;let t=this.W_();if(null===t)return;let i=this.ye();if(null===i)return;let e=i.Uh()-t;if(e<0){let t=this.P_-e-1;this.fn(t)}this.U_()}B_(){this.q_(),this.U_()}X_(t){return!this.ys.ignoreWhitespaceIndices||this.S_.get(t)||!1}G_(t){let i=function*(t){let i=Math.round(t),e=i<t,s=1;for(;;)e?(yield i+s,yield i-s):(yield i-s,yield i+s),s++}(t),e=this.F_();for(;e;){let t=i.next().value;if(this.S_.get(t))return t;if(t<0||t>e)break}return t}}(l=v||(v={}))[l.OnTouchEnd=0]="OnTouchEnd",l[l.OnNextTap=1]="OnNextTap";class iB{constructor(t,i,e){this.ku=[],this.Tu=[],this.no=0,this.Ru=null,this.Du=new B,this.Vu=new B,this.Iu=null,this.Bu=t,this.ys=i,this.Yo=e,this.cl=new q(this.ys.layout.colorParsers),this.Au=new K(this),this.uh=new iD(this,i.timeScale,this.ys.localization,e),this.Ct=new ty(this,i.crosshair),this.Eu=new il(i.crosshair),this.zu(0),this.ku[0].po(2e3),this.Lu=this.Ou(0),this.Nu=this.Ou(1)}Bh(){this.Wu(tM.gn())}ar(){this.Wu(tM.wn())}Xh(){this.Wu(new tM(1))}Ah(t){let i=this.Fu(t);this.Wu(i)}Hu(){return this.Ru}Uu(t){if(this.Ru?.Wo===t?.Wo&&this.Ru?.Fo?.Zn===t?.Fo?.Zn)return;let i=this.Ru;this.Ru=t,null!==i&&this.Ah(i.Wo),null!==t&&t.Wo!==i?.Wo&&this.Ah(t.Wo)}N(){return this.ys}hr(t){W(this.ys,t),this.ku.forEach(i=>i.uo(t)),void 0!==t.timeScale&&this.uh.hr(t.timeScale),void 0!==t.localization&&this.uh.D_(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Du.p(),this.Lu=this.Ou(0),this.Nu=this.Ou(1),this.Bh()}$u(t,i,e=0){let s=this.ku[e];if(void 0===s)return;if("left"===t)return W(this.ys,{leftPriceScale:i}),s.uo({leftPriceScale:i}),this.Du.p(),void this.Bh();if("right"===t)return W(this.ys,{rightPriceScale:i}),s.uo({rightPriceScale:i}),this.Du.p(),void this.Bh();let h=this.qu(t,e);null!==h&&(h.Wt.hr(i),this.Du.p())}qu(t,i){let e=this.ku[i];if(void 0===e)return null;let s=e.co(t);return null!==s?{Us:e,Wt:s}:null}At(){return this.uh}$s(){return this.ku}Yu(){return this.Ct}ju(){return this.Vu}Zu(t,i){t.Cl(i),this.J_()}vo(t){this.no=t,this.uh.vo(this.no),this.ku.forEach(i=>i.vo(t)),this.J_()}Ku(t){1!==this.ku.length&&(L(t>=0&&t<this.ku.length,"Invalid pane index"),this.ku.splice(t,1),this.Bh())}Xu(t,i){if(this.ku.length<2)return;L(t>=0&&t<this.ku.length,"Invalid pane index");let e=this.ku[t],s=this.ku.reduce((t,i)=>t+i.fo(),0),h=this.ku.reduce((t,i)=>t+i.$t(),0),r=h-30*(this.ku.length-1);i=Math.min(r,Math.max(30,i));let n=s/h,l=e.$t();e.po(i*n);let o=i-l,a=this.ku.length-1;for(let t of this.ku)if(t!==e){let i=Math.min(r,Math.max(30,t.$t()-o/a));o-=t.$t()-i,a-=1;let e=i*n;t.po(e)}this.Bh()}Gu(t,i){L(t>=0&&t<this.ku.length&&i>=0&&i<this.ku.length,"Invalid pane index");let e=this.ku[t],s=this.ku[i];this.ku[t]=s,this.ku[i]=e,this.Bh()}Po(t,i,e){t.Po(i,e)}ko(t,i,e){t.ko(i,e),this.Eh(),this.Wu(this.Ju(t,2))}To(t,i){t.To(i),this.Wu(this.Ju(t,2))}Ro(t,i,e){i.wl()||t.Ro(i,e)}Do(t,i,e){i.wl()||(t.Do(i,e),this.Eh(),this.Wu(this.Ju(t,2)))}Vo(t,i){i.wl()||(t.Vo(i),this.Wu(this.Ju(t,2)))}Bo(t,i){t.Bo(i),this.Wu(this.Ju(t,2))}Qu(t){this.uh.Ul(t)}tc(t,i){let e=this.At();if(e.Zi()||0===i)return;let s=e.Qi();t=Math.max(1,Math.min(t,s)),e.hu(t,i),this.J_()}sc(t){this.nc(0),this.ec(t),this.rc()}hc(t){this.uh.$l(t),this.J_()}ac(){this.uh.ql(),this.ar()}nc(t){this.uh.Yl(t)}ec(t){this.uh.jl(t),this.J_()}rc(){this.uh.Zl(),this.ar()}js(){return this.Tu}lc(t,i,e,s,h){this.Ct.Vs(t,i);let r=NaN,n=this.uh.Z_(t,!0),l=this.uh.ye();null!==l&&(n=Math.min(Math.max(l.Uh(),n),l.bi()));let o=s.ks(),a=o.zt();if(null!==a&&(r=o.Ts(i,a)),r=this.Eu.Ma(r,n,s),this.Ct.Es(n,r,s),this.Xh(),!h){let h=iY(s,t,i);this.Uu(h&&{Wo:h.Wo,Fo:h.Fo,Uo:h.Uo||null}),this.Vu.p(this.Ct.Bt(),{x:t,y:i},e)}}oc(t,i,e){let s=e.ks(),h=s.zt(),r=s.Nt(t,V(h)),n=this.uh.A_(i,!0),l=this.uh.qt(V(n));this.lc(l,r,null,e,!0)}_c(t){this.Yu().Ls(),this.Xh(),t||this.Vu.p(null,null,null)}Eh(){let t=this.Ct.Us();if(null!==t){let i=this.Ct.Bs(),e=this.Ct.As();this.lc(i,e,null,t)}this.Ct.Ns()}uc(t,i,e){let s=this.uh.Rs(0);void 0!==i&&void 0!==e&&this.uh.Pt(i,e);let h=this.uh.Rs(0),r=this.uh.Y_(),n=this.uh.ye();if(null!==n&&null!==s&&null!==h){let i=n.Te(r),l=this.Yo.key(s)>this.Yo.key(h),o=null!==t&&t>r&&!l,a=this.uh.N().allowShiftVisibleRangeOnWhitespaceReplacement,u=i&&(void 0!==e||a)&&this.uh.N().shiftVisibleRangeOnNewBar;if(o&&!u){let i=t-r;this.uh.fn(this.uh.iu()-i)}}this.uh.ru(t)}Lh(t){null!==t&&t.Eo()}Hn(t){if(t instanceof ik)return t;let i=this.ku.find(i=>i.Dt().includes(t));return void 0===i?null:i}J_(){this.ku.forEach(t=>t.Eo()),this.Eh()}m(){this.ku.forEach(t=>t.m()),this.ku.length=0,this.ys.localization.priceFormatter=void 0,this.ys.localization.percentageFormatter=void 0,this.ys.localization.timeFormatter=void 0}cc(){return this.Au}Yn(){return this.Au.N()}do(){return this.Du}dc(t,i){let e=this.zu(i);this.fc(t,e),this.Tu.push(t),1===this.Tu.length?this.Bh():this.ar()}vc(t){let i=this.Hn(t),e=this.Tu.indexOf(t);L(-1!==e,"Series not found");let s=V(i);this.Tu.splice(e,1),s.Wl(t),t.m&&t.m(),this.uh.R_(),this.mc(s)}Ih(t,i){let e=V(this.Hn(t));e.Wl(t),e.Ol(t,i,V(t.hs()))}mu(){let t=tM.wn();t.rn(),this.Wu(t)}wc(t){let i=tM.wn();i.ln(t),this.Wu(i)}cn(){let t=tM.wn();t.cn(),this.Wu(t)}dn(t){let i=tM.wn();i.dn(t),this.Wu(i)}fn(t){let i=tM.wn();i.fn(t),this.Wu(i)}_n(t){let i=tM.wn();i._n(t),this.Wu(i)}hn(){let t=tM.wn();t.hn(),this.Wu(t)}gc(){return this.ys.rightPriceScale.visible?"right":"left"}Mc(t,i){if(L(i>=0,"Index should be greater or equal to 0"),i===this.bc(t))return;let e=V(this.Hn(t));e.Wl(t);let s=this.zu(i);this.fc(t,s),0===e.ba().length&&this.mc(e)}xc(){return this.Nu}$(){return this.Lu}Ut(t){let i=this.Nu,e=this.Lu;if(i===e)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Iu||this.Iu.mr!==e||this.Iu.wr!==i)this.Iu={mr:e,wr:i,Sc:new Map};else{let i=this.Iu.Sc.get(t);if(void 0!==i)return i}let s=this.cl.tt(e,i,t/100);return this.Iu.Sc.set(t,s),s}Cc(t){return this.ku.indexOf(t)}Ki(){return this.cl}zu(t){if(L(t>=0,"Index should be greater or equal to 0"),(t=Math.min(this.ku.length,t))<this.ku.length)return this.ku[t];let i=new ik(this.uh,this);this.ku.push(i);let e=tM.gn();return e.Qs(t,{tn:0,sn:!0}),this.Wu(e),i}bc(t){return this.ku.findIndex(i=>i.wo().includes(t))}Ju(t,i){let e=new tM(i);if(null!==t){let s=this.ku.indexOf(t);e.Qs(s,{tn:i})}return e}Fu(t,i){return void 0===i&&(i=2),this.Ju(this.Hn(t),i)}Wu(t){this.Bu&&this.Bu(t),this.ku.forEach(t=>t.Lo().lr().Pt())}fc(t,i){let e=t.N().priceScaleId,s=void 0!==e?e:this.gc();i.Ol(t,s),tw(s)||t.hr(t.N())}Ou(t){let i=this.ys.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}mc(t){0===t.ba().length&&this.ku.length>1&&(this.ku.splice(this.Cc(t),1),this.Bh())}}function iW(t){return!F(t)&&!Q(t)}(o=b||(b={}))[o.Disabled=0]="Disabled",o[o.Continuous=1]="Continuous",o[o.OnDataUpdate=2]="OnDataUpdate",(a=y||(y={}))[a.LastBar=0]="LastBar",a[a.LastVisible=1]="LastVisible",(u=w||(w={})).Solid="solid",u.VerticalGradient="gradient",(c=M||(M={}))[c.Year=0]="Year",c[c.Month=1]="Month",c[c.DayOfMonth=2]="DayOfMonth",c[c.Time=3]="Time",c[c.TimeWithSeconds=4]="TimeWithSeconds";let iF=t=>t.getUTCFullYear();class iI{constructor(t="yyyy-MM-dd",i="default"){this.yc=t,this.Pc=i}jo(t){var i,e;return i=this.yc,e=this.Pc,i.replace(/yyyy/g,t_(iF(t),4)).replace(/yy/g,t_(iF(t)%100,2)).replace(/MMMM/g,new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"long"})).replace(/MMM/g,new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(e,{month:"short"})).replace(/MM/g,t_(t.getUTCMonth()+1,2)).replace(/dd/g,t_(t.getUTCDate(),2))}}class iQ{constructor(t){this.kc=t||"%h:%m:%s"}jo(t){return this.kc.replace("%h",t_(t.getUTCHours(),2)).replace("%m",t_(t.getUTCMinutes(),2)).replace("%s",t_(t.getUTCSeconds(),2))}}let iA={Tc:"yyyy-MM-dd",Rc:"%h:%m:%s",Dc:" ",Vc:"default"};class iJ{constructor(t={}){let i={...iA,...t};this.Ic=new iI(i.Tc,i.Vc),this.Bc=new iQ(i.Rc),this.Ac=i.Dc}jo(t){return`${this.Ic.jo(t)}${this.Ac}${this.Bc.jo(t)}`}}function i$(t){return 60*t*6e4}function iU(t){return 60*t*1e3}let iZ=[{Ec:1e3,zc:10},{Ec:iU(1),zc:20},{Ec:iU(5),zc:21},{Ec:iU(30),zc:22},{Ec:i$(1),zc:30},{Ec:i$(3),zc:31},{Ec:i$(6),zc:32},{Ec:i$(12),zc:33}];function iG(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let e=iZ.length-1;e>=0;--e)if(Math.floor(i.getTime()/iZ[e].Ec)!==Math.floor(t.getTime()/iZ[e].Ec))return iZ[e].zc;return 0}function iK(t){let i=t;if(Q(t)&&(i=iH(t)),!iW(i))throw Error("time must be of type BusinessDay");return{Lc:Math.round(new Date(Date.UTC(i.year,i.month-1,i.day,0,0,0,0)).getTime()/1e3),Oc:i}}function iX(t){if(!F(t))throw Error("time must be of type isUTCTimestamp");return{Lc:t}}function iH(t){let i=new Date(t);if(isNaN(i.getTime()))throw Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function iq(t){Q(t.time)&&(t.time=iH(t.time))}class i0{options(){return this.ys}setOptions(t){this.ys=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?function(t){t.forEach(iq)}(t):iq(t)}createConverterToInternalObj(t){return V(0===t.length?null:iW(t[0].time)||Q(t[0].time)?iK:iX)}key(t){return"object"==typeof t&&"Lc"in t?t.Lc:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){return void 0===t.Oc?new Date(1e3*t.Lc).getTime():new Date(Date.UTC(t.Oc.year,t.Oc.month-1,t.Oc.day)).getTime()}convertHorzItemToInternal(t){return F(t)?iX(t):iW(t)?iK(t):iK(iH(t))}updateFormatter(t){if(!this.ys)return;let i=t.dateFormat;this.ys.timeScale.timeVisible?this.Nc=new iJ({Tc:i,Rc:this.ys.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",Dc:" ",Vc:t.locale}):this.Nc=new iI(i,t.locale)}formatHorzItem(t){return this.Nc.jo(new Date(1e3*t.Lc))}formatTickmark(t,i){let e=function(t,i,e){switch(t){case 0:case 10:return i?e?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.ys.timeScale.timeVisible,this.ys.timeScale.secondsVisible),s=this.ys.timeScale;if(void 0!==s.tickMarkFormatter){let h=s.tickMarkFormatter(t.originalTime,e,i.locale);if(null!==h)return h}return function(t,i,e){let s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=!1,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=!1,s.hour="2-digit",s.minute="2-digit",s.second="2-digit"}let h=new Date(void 0===t.Oc?1e3*t.Lc:Date.UTC(t.Oc.year,t.Oc.month-1,t.Oc.day));return new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()).toLocaleString(e,s)}(t.time,e,i.locale)}maxTickMarkWeight(t){let i=t.reduce(iV,t[0]).weight;return i>30&&i<50&&(i=30),i}fillWeightsForPoints(t,i){!function(t,i=0){if(0===t.length)return;let e=0===i?null:t[i-1].time.Lc,s=null!==e?new Date(1e3*e):null,h=0;for(let r=i;r<t.length;++r){let i=t[r],n=new Date(1e3*i.time.Lc);null!==s&&(i.timeWeight=iG(n,s)),h+=i.time.Lc-(e||i.time.Lc),e=i.time.Lc,s=n}if(0===i&&t.length>1){let i=Math.ceil(h/(t.length-1)),e=new Date(1e3*(t[0].time.Lc-i));t[0].timeWeight=iG(new Date(1e3*t[0].time.Lc),e)}}(t,i)}static Wc(t){return W({localization:{dateFormat:"dd MMM 'yy"}},t??{})}}let i1="undefined"!=typeof window;function i2(){return!!i1&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function i3(){return!!i1&&/iPhone|iPad|iPod/.test(window.navigator.platform)}class i5{constructor(t,i,e){this.Fc=0,this.Hc=null,this.Uc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.$c=0,this.qc=null,this.Yc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.jc=null,this.Zc=!1,this.Kc=null,this.Xc=null,this.Gc=!1,this.Jc=!1,this.Qc=!1,this.td=null,this.sd=null,this.nd=null,this.ed=null,this.rd=null,this.hd=null,this.ad=null,this.ld=0,this.od=!1,this._d=!1,this.ud=!1,this.dd=0,this.fd=null,this.pd=!i3(),this.vd=t=>{this.md(t)},this.wd=t=>{if(this.gd(t)){let i=this.Md(t);if(++this.$c,this.qc&&this.$c>1){let{bd:e}=this.xd(i9(t),this.Yc);e<30&&!this.Qc&&this.Sd(i,this.yd.Cd),this.Pd()}}else{let i=this.Md(t);if(++this.Fc,this.Hc&&this.Fc>1){let{bd:e}=this.xd(i9(t),this.Uc);e<5&&!this.Jc&&this.kd(i,this.yd.Td),this.Rd()}}},this.Dd=t,this.yd=i,this.ys=e,this.Vd()}m(){null!==this.td&&(this.td(),this.td=null),null!==this.sd&&(this.sd(),this.sd=null),null!==this.ed&&(this.ed(),this.ed=null),null!==this.rd&&(this.rd(),this.rd=null),null!==this.hd&&(this.hd(),this.hd=null),null!==this.nd&&(this.nd(),this.nd=null),this.Id(),this.Rd()}Bd(t){this.ed&&this.ed();let i=this.Ad.bind(this);if(this.ed=()=>{this.Dd.removeEventListener("mousemove",i)},this.Dd.addEventListener("mousemove",i),this.gd(t))return;let e=this.Md(t);this.kd(e,this.yd.Ed),this.pd=!0}Rd(){null!==this.Hc&&clearTimeout(this.Hc),this.Fc=0,this.Hc=null,this.Uc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}Pd(){null!==this.qc&&clearTimeout(this.qc),this.$c=0,this.qc=null,this.Yc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}Ad(t){if(this.ud||null!==this.Xc||this.gd(t))return;let i=this.Md(t);this.kd(i,this.yd.zd),this.pd=!0}Ld(t){let i=i7(t.changedTouches,V(this.fd));if(null===i||(this.dd=i8(t),null!==this.ad)||this._d)return;this.od=!0;let{Od:e,Nd:s,bd:h}=this.xd(i9(i),V(this.Xc));if(this.Gc||!(h<5)){if(!this.Gc){let t=.5*e,i=s>=t&&!this.ys.Wd(),h=t>s&&!this.ys.Fd();i||h||(this._d=!0),this.Gc=!0,this.Qc=!0,this.Id(),this.Pd()}if(!this._d){let e=this.Md(t,i);this.Sd(e,this.yd.Hd),i4(t)}}}Ud(t){if(0!==t.button)return;let{bd:i}=this.xd(i9(t),V(this.Kc));if(i>=5&&(this.Jc=!0,this.Rd()),this.Jc){let i=this.Md(t);this.kd(i,this.yd.$d)}}xd(t,i){let e=Math.abs(i._t-t._t),s=Math.abs(i.ut-t.ut);return{Od:e,Nd:s,bd:e+s}}qd(t){let i=i7(t.changedTouches,V(this.fd));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.fd=null,this.dd=i8(t),this.Id(),this.Xc=null,this.hd&&(this.hd(),this.hd=null);let e=this.Md(t,i);if(this.Sd(e,this.yd.Yd),++this.$c,this.qc&&this.$c>1){let{bd:t}=this.xd(i9(i),this.Yc);t<30&&!this.Qc&&this.Sd(e,this.yd.Cd),this.Pd()}else this.Qc||(this.Sd(e,this.yd.jd),this.yd.jd&&i4(t));0===this.$c&&i4(t),0===t.touches.length&&this.Zc&&(this.Zc=!1,i4(t))}md(t){if(0!==t.button)return;let i=this.Md(t);if(this.Kc=null,this.ud=!1,this.rd&&(this.rd(),this.rd=null),i2()&&this.Dd.ownerDocument.documentElement.removeEventListener("mouseleave",this.vd),!this.gd(t)){if(this.kd(i,this.yd.Zd),++this.Fc,this.Hc&&this.Fc>1){let{bd:e}=this.xd(i9(t),this.Uc);e<5&&!this.Jc&&this.kd(i,this.yd.Td),this.Rd()}else this.Jc||this.kd(i,this.yd.Kd)}}Id(){null!==this.jc&&(clearTimeout(this.jc),this.jc=null)}Xd(t){if(null!==this.fd)return;let i=t.changedTouches[0];this.fd=i.identifier,this.dd=i8(t);let e=this.Dd.ownerDocument.documentElement;this.Qc=!1,this.Gc=!1,this._d=!1,this.Xc=i9(i),this.hd&&(this.hd(),this.hd=null);{let i=this.Ld.bind(this),s=this.qd.bind(this);this.hd=()=>{e.removeEventListener("touchmove",i),e.removeEventListener("touchend",s)},e.addEventListener("touchmove",i,{passive:!1}),e.addEventListener("touchend",s,{passive:!1}),this.Id(),this.jc=setTimeout(this.Gd.bind(this,t),240)}let s=this.Md(t,i);this.Sd(s,this.yd.Jd),this.qc||(this.$c=0,this.qc=setTimeout(this.Pd.bind(this),500),this.Yc=i9(i))}Qd(t){if(0!==t.button)return;let i=this.Dd.ownerDocument.documentElement;i2()&&i.addEventListener("mouseleave",this.vd),this.Jc=!1,this.Kc=i9(t),this.rd&&(this.rd(),this.rd=null);{let t=this.Ud.bind(this),e=this.md.bind(this);this.rd=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",e)},i.addEventListener("mousemove",t),i.addEventListener("mouseup",e)}if(this.ud=!0,this.gd(t))return;let e=this.Md(t);this.kd(e,this.yd.tf),this.Hc||(this.Fc=0,this.Hc=setTimeout(this.Rd.bind(this),500),this.Uc=i9(t))}Vd(){var t;this.Dd.addEventListener("mouseenter",this.Bd.bind(this)),this.Dd.addEventListener("touchcancel",this.Id.bind(this));{let t=this.Dd.ownerDocument,i=t=>{this.yd.if&&(t.composed&&this.Dd.contains(t.composedPath()[0])||t.target&&this.Dd.contains(t.target)||this.yd.if())};this.sd=()=>{t.removeEventListener("touchstart",i)},this.td=()=>{t.removeEventListener("mousedown",i)},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0})}i3()&&(this.nd=()=>{this.Dd.removeEventListener("dblclick",this.wd)},this.Dd.addEventListener("dblclick",this.wd)),this.Dd.addEventListener("mouseleave",this.sf.bind(this)),this.Dd.addEventListener("touchstart",this.Xd.bind(this),{passive:!0}),t=this.Dd,i1&&void 0!==window.chrome&&t.addEventListener("mousedown",t=>{if(1===t.button)return t.preventDefault(),!1}),this.Dd.addEventListener("mousedown",this.Qd.bind(this)),this.nf(),this.Dd.addEventListener("touchmove",()=>{},{passive:!1})}nf(){void 0===this.yd.ef&&void 0===this.yd.rf&&void 0===this.yd.hf||(this.Dd.addEventListener("touchstart",t=>this.af(t.touches),{passive:!0}),this.Dd.addEventListener("touchmove",t=>{if(2===t.touches.length&&null!==this.ad&&void 0!==this.yd.rf){let i=i6(t.touches[0],t.touches[1])/this.ld;this.yd.rf(this.ad,i),i4(t)}},{passive:!1}),this.Dd.addEventListener("touchend",t=>{this.af(t.touches)}))}af(t){1===t.length&&(this.od=!1),2!==t.length||this.od||this.Zc?this.lf():this._f(t)}_f(t){let i=this.Dd.getBoundingClientRect()||{left:0,top:0};this.ad={_t:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,ut:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.ld=i6(t[0],t[1]),void 0!==this.yd.ef&&this.yd.ef(),this.Id()}lf(){null!==this.ad&&(this.ad=null,void 0!==this.yd.hf&&this.yd.hf())}sf(t){if(this.ed&&this.ed(),this.gd(t)||!this.pd)return;let i=this.Md(t);this.kd(i,this.yd.uf),this.pd=!i3()}Gd(t){let i=i7(t.touches,V(this.fd));if(null===i)return;let e=this.Md(t,i);this.Sd(e,this.yd.cf),this.Qc=!0,this.Zc=!0}gd(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:i8(t)<this.dd+500}Sd(t,i){i&&i.call(this.yd,t)}kd(t,i){i&&i.call(this.yd,t)}Md(t,i){let e=i||t,s=this.Dd.getBoundingClientRect()||{left:0,top:0};return{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,localX:e.clientX-s.left,localY:e.clientY-s.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,df:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,ff:t.type,pf:e.target,$o:t.view,vf:()=>{"touchstart"!==t.type&&i4(t)}}}}function i6(t,i){let e=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(e*e+s*s)}function i4(t){t.cancelable&&t.preventDefault()}function i9(t){return{_t:t.pageX,ut:t.pageY}}function i8(t){return t.timeStamp||performance.now()}function i7(t,i){for(let e=0;e<t.length;++e)if(t[e].identifier===i)return t[e];return null}class et{constructor(t,i,e){this.mf=null,this.wf=null,this.gf=!0,this.Mf=null,this.bf=t,this.xf=t.Sf()[i],this.Cf=t.Sf()[e],this.yf=document.createElement("tr"),this.yf.style.height="1px",this.Pf=document.createElement("td"),this.Pf.style.position="relative",this.Pf.style.padding="0",this.Pf.style.margin="0",this.Pf.setAttribute("colspan","3"),this.kf(),this.yf.appendChild(this.Pf),this.gf=this.bf.N().layout.panes.enableResize,this.gf?this.Tf():(this.mf=null,this.wf=null)}m(){null!==this.wf&&this.wf.m()}Rf(){return this.yf}Df(){return P({width:this.xf.Df().width,height:1})}Vf(){return P({width:this.xf.Vf().width,height:+window.devicePixelRatio})}If(t,i,e){let s=this.Vf();t.fillStyle=this.bf.N().layout.panes.separatorColor,t.fillRect(i,e,s.width,s.height)}Pt(){this.kf(),this.bf.N().layout.panes.enableResize!==this.gf&&(this.gf=this.bf.N().layout.panes.enableResize,this.gf?this.Tf():(null!==this.mf&&(this.Pf.removeChild(this.mf.Bf),this.Pf.removeChild(this.mf.Af),this.mf=null),null!==this.wf&&(this.wf.m(),this.wf=null)))}Tf(){let t=document.createElement("div"),i=t.style;i.position="fixed",i.display="none",i.zIndex="49",i.top="0",i.left="0",i.width="100%",i.height="100%",i.cursor="row-resize",this.Pf.appendChild(t);let e=document.createElement("div"),s=e.style;s.position="absolute",s.zIndex="50",s.top="-4px",s.height="9px",s.width="100%",s.backgroundColor="",s.cursor="row-resize",this.Pf.appendChild(e);let h={Ed:this.Ef.bind(this),uf:this.zf.bind(this),tf:this.Lf.bind(this),Jd:this.Lf.bind(this),$d:this.Of.bind(this),Hd:this.Of.bind(this),Zd:this.Nf.bind(this),Yd:this.Nf.bind(this)};this.wf=new i5(e,h,{Wd:()=>!1,Fd:()=>!0}),this.mf={Af:e,Bf:t}}kf(){this.Pf.style.background=this.bf.N().layout.panes.separatorColor}Ef(t){null!==this.mf&&(this.mf.Af.style.backgroundColor=this.bf.N().layout.panes.separatorHoverColor)}zf(t){null!==this.mf&&null===this.Mf&&(this.mf.Af.style.backgroundColor="")}Lf(t){if(null===this.mf)return;let i=this.xf.Wf().fo()+this.Cf.Wf().fo(),e=i/(this.xf.Df().height+this.Cf.Df().height),s=30*e;i<=2*s||(this.Mf={Ff:t.pageY,Hf:this.xf.Wf().fo(),Uf:i-s,$f:i,qf:e,Yf:s},this.mf.Bf.style.display="block")}Of(t){let i=this.Mf;if(null===i)return;let e=(t.pageY-i.Ff)*i.qf,s=iw(i.Hf+e,i.Yf,i.Uf);this.xf.Wf().po(s),this.Cf.Wf().po(i.$f-s),this.bf.Qt().Bh()}Nf(t){null!==this.Mf&&null!==this.mf&&(this.Mf=null,this.mf.Bf.style.display="none")}}function ei(t,i,e){let s=(t.jf-i.jf)/(t.wt-i.wt);return Math.sign(s)*Math.min(Math.abs(s),e)}class ee{constructor(t,i,e,s){this.Zf=null,this.Kf=null,this.Xf=null,this.Gf=null,this.Jf=null,this.Qf=0,this.tp=0,this.ip=t,this.sp=i,this.np=e,this.Mn=s}ep(t,i){if(null!==this.Zf){if(this.Zf.wt===i)return void(this.Zf.jf=t);if(Math.abs(this.Zf.jf-t)<this.Mn)return}this.Gf=this.Xf,this.Xf=this.Kf,this.Kf=this.Zf,this.Zf={wt:i,jf:t}}le(t,i){var e,s,h,r,n,l;if(null===this.Zf||null===this.Kf||i-this.Zf.wt>50)return;let o=0,a=ei(this.Zf,this.Kf,this.sp),u=(e=this.Zf,s=this.Kf,e.jf-s.jf),c=[a],f=[u];if(o+=u,null!==this.Xf){let t=ei(this.Kf,this.Xf,this.sp);if(Math.sign(t)===Math.sign(a)){let i=(h=this.Kf,r=this.Xf,h.jf-r.jf);if(c.push(t),f.push(i),o+=i,null!==this.Gf){let t=ei(this.Xf,this.Gf,this.sp);if(Math.sign(t)===Math.sign(a)){let i=(n=this.Xf,l=this.Gf,n.jf-l.jf);c.push(t),f.push(i),o+=i}}}}let d=0;for(let t=0;t<c.length;++t)d+=f[t]/o*c[t];Math.abs(d)<this.ip||(this.Jf={jf:t,wt:i},this.tp=d,this.Qf=function(t,i){let e=Math.log(i);return Math.log(-(+e/t))/e}(Math.abs(d),this.np))}cu(t){let i=V(this.Jf),e=t-i.wt;return i.jf+this.tp*(Math.pow(this.np,e)-1)/Math.log(this.np)}uu(t){return null===this.Jf||this.rp(t)===this.Qf}rp(t){return Math.min(t-V(this.Jf).wt,this.Qf)}}class es{constructor(t,i){this.hp=void 0,this.ap=void 0,this.lp=void 0,this.ps=!1,this.op=t,this._p=i,this.up()}Pt(){this.up()}cp(){this.hp&&this.op.removeChild(this.hp),this.ap&&this.op.removeChild(this.ap),this.hp=void 0,this.ap=void 0}dp(){return this.ps!==this.fp()||this.lp!==this.pp()}pp(){return this._p.Qt().Ki().J(this._p.N().layout.textColor)>160?"dark":"light"}fp(){return this._p.N().layout.attributionLogo}vp(){let t=new URL(location.href);return t.hostname?"&utm_source="+t.hostname+t.pathname:""}up(){this.dp()&&(this.cp(),this.ps=this.fp(),this.ps&&(this.lp=this.pp(),this.ap=document.createElement("style"),this.ap.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.hp=document.createElement("a"),this.hp.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.vp()}`,this.hp.title="Charting by TradingView",this.hp.id="tv-attr-logo",this.hp.target="_blank",this.hp.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.hp.toggleAttribute("data-dark","dark"===this.lp),this.op.appendChild(this.ap),this.op.appendChild(this.hp)))}}function eh(t,i){let e=V(t.ownerDocument).createElement("canvas");t.appendChild(e);let s=function(t,i){if("device-pixel-content-box"===i.type)return new R(t,i.transform,i.options);throw Error("Unsupported binding target")}(e,{type:"device-pixel-content-box",options:{allowResizeObserver:!0},transform:(t,i)=>({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return s.resizeCanvasElement(i),s}function er(t){t.width=1,t.height=1,t.getContext("2d")?.clearRect(0,0,1,1)}function en(t,i,e,s){t.ih&&t.ih(i,e,s)}function el(t,i,e,s){t.nt(i,e,s)}function eo(t,i,e,s){for(let h of t(e,s)){let t=h.Tt(s);null!==t&&i(t)}}function ea(t,i){return e=>void 0===e.Wt?[]:(e.Wt()?.wa()??"")!==i?[]:e.ta?.(t)??[]}function eu(t,i,e,s){if(!t.length)return;let h=0,r=t[0].$t(s,!0),n=1===i?e/2-(t[0].Wi()-r/2):t[0].Wi()-r/2-e/2;n=Math.max(0,n);for(let r=1;r<t.length;r++){let l=t[r],o=t[r-1],a=o.$t(s,!1),u=l.Wi(),c=o.Wi();if(1===i?u>c-a:u<c+a){let s=c-a*i;l.Fi(s);let r=s-i*a/2;if((1===i?r<0:r>e)&&n>0){let s=Math.min(1===i?-1-r:r-e,n);for(let e=h;e<t.length;e++)t[e].Fi(t[e].Wi()+i*s);n-=s}}else h=r,n=1===i?c-a-u:u-(c+a)}}class ec{constructor(t,i,e,s){this.Yi=null,this.mp=null,this.wp=!1,this.gp=new tC(200),this.Mp=null,this.bp=0,this.xp=!1,this.Sp=()=>{this.xp||this.yt.Cp().Qt().ar()},this.yp=()=>{this.xp||this.yt.Cp().Qt().ar()},this.yt=t,this.ys=i,this._l=i.layout,this.Au=e,this.Pp="left"===s,this.kp=ea("normal",s),this.Tp=ea("top",s),this.Rp=ea("bottom",s),this.Pf=document.createElement("div"),this.Pf.style.height="100%",this.Pf.style.overflow="hidden",this.Pf.style.width="25px",this.Pf.style.left="0",this.Pf.style.position="relative",this.Dp=eh(this.Pf,P({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let h=this.Dp.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this.Vp=eh(this.Pf,P({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let r=this.Vp.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0";let n={tf:this.Lf.bind(this),Jd:this.Lf.bind(this),$d:this.Of.bind(this),Hd:this.Of.bind(this),if:this.Ip.bind(this),Zd:this.Nf.bind(this),Yd:this.Nf.bind(this),Td:this.Bp.bind(this),Cd:this.Bp.bind(this),Ed:this.Ap.bind(this),uf:this.zf.bind(this)};this.wf=new i5(this.Vp.canvasElement,n,{Wd:()=>!this.ys.handleScroll.vertTouchDrag,Fd:()=>!0})}m(){this.wf.m(),this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose(),null!==this.Yi&&this.Yi.Hl().u(this),this.Yi=null}Rf(){return this.Pf}P(){return this._l.fontSize}Ep(){let t=this.Au.N();return this.Mp!==t.k&&(this.gp.In(),this.Mp=t.k),t}zp(){var t,i;if(null===this.Yi)return 0;let e=0,s=this.Ep(),h=V(this.Dp.canvasElement.getContext("2d",{colorSpace:this.yt.Cp().N().layout.colorSpace}));h.save();let r=this.Yi.Va();h.font=this.Lp(),r.length>0&&(e=Math.max(this.gp.Vi(h,r[0].$a),this.gp.Vi(h,r[r.length-1].$a)));let n=this.Op();for(let t=n.length;t--;){let i=this.gp.Vi(h,n[t].ri());i>e&&(e=i)}let l=this.Yi.zt();if(null!==l&&null!==this.mp&&2!==(t=this.ys.crosshair).mode&&t.horzLine.visible&&t.horzLine.labelVisible){let t=this.Yi.Ts(1,l),i=this.Yi.Ts(this.mp.height-2,l);e=Math.max(e,this.gp.Vi(h,this.Yi.Xi(Math.floor(Math.min(t,i))+.11111111111111,l)),this.gp.Vi(h,this.Yi.Xi(Math.ceil(Math.max(t,i))-.11111111111111,l)))}h.restore();let o=e||34;return(i=Math.ceil(s.S+s.C+s.I+s.B+5+o))+i%2}Np(t){null!==this.mp&&O(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`)}Wp(){return V(this.mp).width}_s(t){this.Yi!==t&&(null!==this.Yi&&this.Yi.Hl().u(this),this.Yi=t,t.Hl().i(this.il.bind(this),this))}Wt(){return this.Yi}In(){let t=this.yt.Wf();this.yt.Cp().Qt().Bo(t,V(this.Wt()))}Fp(t){if(null===this.mp)return;let i={colorSpace:this.yt.Cp().N().layout.colorSpace};if(1!==t){this.Hp(),this.Dp.applySuggestedBitmapSize();let t=Y(this.Dp,i);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t)}),this.yt.qp(t,this.Rp),this.Yp(t),this.yt.qp(t,this.kp),this.jp(t))}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.Zp(e),this.yt.qp(e,this.Tp))}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Pt(){this.Yi?.Va()}Lf(t){if(null===this.Yi||this.Yi.Zi()||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf();this.wp=!0,i.Po(e,this.Yi,t.localY)}Of(t){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf(),s=this.Yi;i.ko(e,s,t.localY)}Ip(){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let t=this.yt.Cp().Qt(),i=this.yt.Wf(),e=this.Yi;this.wp&&(this.wp=!1,t.To(i,e))}Nf(t){if(null===this.Yi||!this.ys.handleScale.axisPressedMouseMove.price)return;let i=this.yt.Cp().Qt(),e=this.yt.Wf();this.wp=!1,i.To(e,this.Yi)}Bp(t){this.ys.handleScale.axisDoubleClickReset.price&&this.In()}Ap(t){null!==this.Yi&&(!this.yt.Cp().Qt().N().handleScale.axisPressedMouseMove.price||this.Yi.Le()||this.Yi.gl()||this.Kp(1))}zf(t){this.Kp(0)}Op(){let t=[],i=null===this.Yi?void 0:this.Yi;return(e=>{for(let s=0;s<e.length;++s){let h=e[s].Fs(this.yt.Wf(),i);for(let i=0;i<h.length;i++)t.push(h[i])}})(this.yt.Wf().Dt()),t}Up({context:t,bitmapSize:i}){let{width:e,height:s}=i,h=this.yt.Wf().Qt(),r=h.$(),n=h.xc();r===n?to(t,0,0,e,s,r):tc(t,0,0,e,s,r,n)}$p({context:t,bitmapSize:i,horizontalPixelRatio:e}){let s;if(null===this.mp||null===this.Yi||!this.Yi.N().borderVisible)return;t.fillStyle=this.Yi.N().borderColor;let h=Math.max(1,Math.floor(this.Ep().S*e));s=this.Pp?i.width-h:0,t.fillRect(s,0,h,i.height)}Yp(t){if(null===this.mp||null===this.Yi)return;let i=this.Yi.Va(),e=this.Yi.N(),s=this.Ep(),h=this.Pp?this.mp.width-s.C:0;e.borderVisible&&e.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:r,verticalPixelRatio:n})=>{t.fillStyle=e.borderColor;let l=Math.max(1,Math.floor(n)),o=Math.floor(.5*n),a=Math.round(s.C*r);for(let e of(t.beginPath(),i))t.rect(Math.floor(h*r),Math.round(e.Pa*n)-o,a,l);t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{t.font=this.Lp(),t.fillStyle=e.textColor??this._l.textColor,t.textAlign=this.Pp?"right":"left",t.textBaseline="middle";let r=this.Pp?Math.round(h-s.I):Math.round(h+s.C+s.I),n=i.map(i=>this.gp.Di(t,i.$a));for(let e=i.length;e--;){let s=i[e];t.fillText(s.$a,r,s.Pa+n[e])}})}Hp(){if(null===this.mp||null===this.Yi)return;let t=this.mp.height/2,i=[],e=this.Yi.Dt().slice(),s=this.yt.Wf(),h=this.Ep();this.Yi===s.$n()&&this.yt.Wf().Dt().forEach(t=>{s.Un(t)&&e.push(t)});let r=this.Yi.ba()[0],n=this.Yi;e.forEach(e=>{let h=e.Fs(s,n);h.forEach(t=>{t.Fi(null),t.Hi()&&i.push(t)}),r===e&&h.length>0&&(t=h[0].Bi())}),i.forEach(t=>t.Fi(t.Bi())),this.Yi.N().alignLabels&&this.Xp(i,h,t)}Xp(t,i,e){if(null===this.mp)return;let s=t.filter(t=>t.Bi()<=e),h=t.filter(t=>t.Bi()>e);for(let e of(s.sort((t,i)=>i.Bi()-t.Bi()),s.length&&h.length&&h.push(s[0]),h.sort((t,i)=>t.Bi()-i.Bi()),t)){let t=Math.floor(e.$t(i)/2),s=e.Bi();s>-t&&s<t&&e.Fi(t),s>this.mp.height-t&&s<this.mp.height+t&&e.Fi(this.mp.height-t)}eu(s,1,this.mp.height,i),eu(h,-1,this.mp.height,i)}jp(t){if(null===this.mp)return;let i=this.Op(),e=this.Ep(),s=this.Pp?"right":"left";i.forEach(i=>{i.Ui()&&i.Tt(V(this.Yi)).nt(t,e,this.gp,s)})}Zp(t){if(null===this.mp||null===this.Yi)return;let i=this.yt.Cp().Qt(),e=[],s=this.yt.Wf(),h=i.Yu().Fs(s,this.Yi);h.length&&e.push(h);let r=this.Ep(),n=this.Pp?"right":"left";e.forEach(i=>{i.forEach(i=>{i.Tt(V(this.Yi)).nt(t,r,this.gp,n)})})}Kp(t){this.Pf.style.cursor=1===t?"ns-resize":"default"}il(){let t=this.zp();this.bp<t&&this.yt.Cp().Qt().Bh(),this.bp=t}Lp(){return G(this._l.fontSize,this._l.fontFamily)}}function ef(t,i){return t.Jh?.(i)??[]}function ed(t,i){return t.Ws?.(i)??[]}function ep(t,i){return t.us?.(i)??[]}function em(t,i){return t.Kh?.(i)??[]}class eg{constructor(t,i){this.mp=P({width:0,height:0}),this.Gp=null,this.Jp=null,this.Qp=null,this.tv=null,this.iv=!1,this.sv=new B,this.nv=new B,this.ev=0,this.rv=!1,this.hv=null,this.av=!1,this.lv=null,this.ov=null,this.xp=!1,this.Sp=()=>{this.xp||null===this._v||this.ts().ar()},this.yp=()=>{this.xp||null===this._v||this.ts().ar()},this._p=t,this._v=i,this._v.zo().i(this.uv.bind(this),this,!0),this.cv=document.createElement("td"),this.cv.style.padding="0",this.cv.style.position="relative";let e=document.createElement("div");e.style.width="100%",e.style.height="100%",e.style.position="relative",e.style.overflow="hidden",this.dv=document.createElement("td"),this.dv.style.padding="0",this.fv=document.createElement("td"),this.fv.style.padding="0",this.cv.appendChild(e),this.Dp=eh(e,P({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let s=this.Dp.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Vp=eh(e,P({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let h=this.Vp.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",this.yf=document.createElement("tr"),this.yf.appendChild(this.dv),this.yf.appendChild(this.cv),this.yf.appendChild(this.fv),this.pv(),this.wf=new i5(this.Vp.canvasElement,this,{Wd:()=>null===this.hv&&!this._p.N().handleScroll.vertTouchDrag,Fd:()=>null===this.hv&&!this._p.N().handleScroll.horzTouchDrag})}m(){null!==this.Gp&&this.Gp.m(),null!==this.Jp&&this.Jp.m(),this.Qp=null,this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose(),null!==this._v&&(this._v.zo().u(this),this._v.m()),this.wf.m()}Wf(){return V(this._v)}vv(t){null!==this._v&&this._v.zo().u(this),this._v=t,null!==this._v&&this._v.zo().i(eg.prototype.uv.bind(this),this,!0),this.pv(),this._p.Sf().indexOf(this)===this._p.Sf().length-1?(this.Qp=this.Qp??new es(this.cv,this._p),this.Qp.Pt()):(this.Qp?.cp(),this.Qp=null)}Cp(){return this._p}Rf(){return this.yf}pv(){if(null!==this._v&&(this.mv(),0!==this.ts().js().length)){if(null!==this.Gp){let t=this._v.Co();this.Gp._s(V(t))}if(null!==this.Jp){let t=this._v.yo();this.Jp._s(V(t))}}}wv(){null!==this.Gp&&this.Gp.Pt(),null!==this.Jp&&this.Jp.Pt()}fo(){return null!==this._v?this._v.fo():0}po(t){this._v&&this._v.po(t)}Ed(t){if(!this._v)return;this.gv();let i=t.localX,e=t.localY;this.Mv(i,e,t)}tf(t){this.gv(),this.bv(),this.Mv(t.localX,t.localY,t)}zd(t){if(!this._v)return;this.gv();let i=t.localX,e=t.localY;this.Mv(i,e,t)}Kd(t){null!==this._v&&(this.gv(),this.xv(t))}Td(t){null!==this._v&&this.Sv(this.nv,t)}Cd(t){this.Td(t)}$d(t){this.gv(),this.Cv(t),this.Mv(t.localX,t.localY,t)}Zd(t){null!==this._v&&(this.gv(),this.rv=!1,this.yv(t))}jd(t){null!==this._v&&this.xv(t)}cf(t){if(this.rv=!0,null===this.hv){let i={x:t.localX,y:t.localY};this.Pv(i,i,t)}}uf(t){null!==this._v&&(this.gv(),this._v.Qt().Uu(null),this.kv())}Tv(){return this.sv}Rv(){return this.nv}ef(){this.ev=1,this.ts().hn()}rf(t,i){if(!this._p.N().handleScale.pinch)return;let e=5*(i-this.ev);this.ev=i,this.ts().tc(t._t,e)}Jd(t){this.rv=!1,this.av=null!==this.hv,this.bv();let i=this.ts().Yu();null!==this.hv&&i.Vt()&&(this.lv={x:i.si(),y:i.ni()},this.hv={x:t.localX,y:t.localY})}Hd(t){if(null===this._v)return;let i=t.localX,e=t.localY;if(null===this.hv)this.Cv(t);else{this.av=!1;let s=V(this.lv),h=s.x+(i-this.hv.x),r=s.y+(e-this.hv.y);this.Mv(h,r,t)}}Yd(t){0===this.Cp().N().trackingMode.exitMode&&(this.av=!0),this.Dv(),this.yv(t)}jn(t,i){let e=this._v;return null===e?null:iY(e,t,i)}Vv(t,i){V("left"===i?this.Gp:this.Jp).Np(P({width:t,height:this.mp.height}))}Df(){return this.mp}Np(t){O(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.cv.style.width=t.width+"px",this.cv.style.height=t.height+"px")}Iv(){let t=V(this._v);for(let i of(t.So(t.Co()),t.So(t.yo()),t.ba()))if(t.Un(i)){let e=i.Wt();null!==e&&t.So(e),i.Ns()}for(let i of t.Oo())i.Ns()}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Fp(t){if(0===t||null===this._v)return;t>1&&this.Iv(),null!==this.Gp&&this.Gp.Fp(t),null!==this.Jp&&this.Jp.Fp(t);let i={colorSpace:this._p.N().layout.colorSpace};if(1!==t){this.Dp.applySuggestedBitmapSize();let t=Y(this.Dp,i);null!==t&&(t.useBitmapCoordinateSpace(t=>{this.Up(t)}),this._v&&(this.Bv(t,ef),this.Av(t),this.Bv(t,ed),this.Bv(t,ep)))}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.Ev(e),this.Bv(e,em),this.Bv(e,ep))}zv(){return this.Gp}Lv(){return this.Jp}qp(t,i){this.Bv(t,i)}uv(){null!==this._v&&this._v.zo().u(this),this._v=null}xv(t){this.Sv(this.sv,t)}Sv(t,i){let e=i.localX,s=i.localY;t.v()&&t.p(this.ts().At().Z_(e),{x:e,y:s},i)}Up({context:t,bitmapSize:i}){let{width:e,height:s}=i,h=this.ts(),r=h.$(),n=h.xc();r===n?to(t,0,0,e,s,n):tc(t,0,0,e,s,r,n)}Av(t){let i=V(this._v),e=i.Lo().lr().Tt(i);null!==e&&e.nt(t,!1)}Ev(t){this.Ov(t,ed,el,this.ts().Yu())}Bv(t,i){let e=V(this._v),s=e.Dt(),h=e.Oo();for(let e of h)this.Ov(t,i,en,e);for(let e of s)this.Ov(t,i,en,e);for(let e of h)this.Ov(t,i,el,e);for(let e of s)this.Ov(t,i,el,e)}Ov(t,i,e,s){let h=V(this._v),r=h.Qt().Hu(),n=null!==r&&r.Wo===s,l=null!==r&&n&&void 0!==r.Fo?r.Fo.Kn:void 0;eo(i,i=>e(i,t,n,l),s,h)}mv(){if(null===this._v)return;let t=this._p,i=this._v.Co().N().visible,e=this._v.yo().N().visible;i||null===this.Gp||(this.dv.removeChild(this.Gp.Rf()),this.Gp.m(),this.Gp=null),e||null===this.Jp||(this.fv.removeChild(this.Jp.Rf()),this.Jp.m(),this.Jp=null);let s=t.Qt().cc();i&&null===this.Gp&&(this.Gp=new ec(this,t.N(),s,"left"),this.dv.appendChild(this.Gp.Rf())),e&&null===this.Jp&&(this.Jp=new ec(this,t.N(),s,"right"),this.fv.appendChild(this.Jp.Rf()))}Nv(t){return t.df&&this.rv||null!==this.hv}Wv(t){return Math.max(0,Math.min(t,this.mp.width-1))}Fv(t){return Math.max(0,Math.min(t,this.mp.height-1))}Mv(t,i,e){this.ts().lc(this.Wv(t),this.Fv(i),e,V(this._v))}kv(){this.ts()._c()}Dv(){this.av&&(this.hv=null,this.kv())}Pv(t,i,e){this.hv=t,this.av=!1,this.Mv(i.x,i.y,e);let s=this.ts().Yu();this.lv={x:s.si(),y:s.ni()}}ts(){return this._p.Qt()}yv(t){if(!this.iv)return;let i=this.ts(),e=this.Wf();if(i.Vo(e,e.ks()),this.tv=null,this.iv=!1,i.rc(),null!==this.ov){let t=performance.now(),e=i.At();this.ov.le(e.iu(),t),this.ov.uu(t)||i._n(this.ov)}}gv(){this.hv=null}bv(){if(this._v){if(this.ts().hn(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)V(document.activeElement).blur();else{let t=document.getSelection();null!==t&&t.removeAllRanges()}this._v.ks().Zi()||this.ts().At().Zi()}}Cv(t){if(null===this._v)return;let i=this.ts(),e=i.At();if(e.Zi())return;let s=this._p.N(),h=s.handleScroll,r=s.kineticScroll;if((!h.pressedMouseMove||t.df)&&(!h.horzTouchDrag&&!h.vertTouchDrag||!t.df))return;let n=this._v.ks(),l=performance.now();if(null!==this.tv||this.Nv(t)||(this.tv={x:t.clientX,y:t.clientY,Lc:l,Hv:t.localX,Uv:t.localY}),null!==this.tv&&!this.iv&&(this.tv.x!==t.clientX||this.tv.y!==t.clientY)){if(t.df&&r.touch||!t.df&&r.mouse){let t=e.Q_();this.ov=new ee(.2/t,7/t,.997,15/t),this.ov.ep(e.iu(),this.tv.Lc)}else this.ov=null;n.Zi()||i.Ro(this._v,n,t.localY),i.nc(t.localX),this.iv=!0}this.iv&&(n.Zi()||i.Do(this._v,n,t.localY),i.ec(t.localX),null!==this.ov&&this.ov.ep(e.iu(),l))}}class ev{constructor(t,i,e,s,h){this.St=!0,this.mp=P({width:0,height:0}),this.Sp=()=>this.Fp(3),this.Pp="left"===t,this.Au=e.cc,this.ys=i,this.$v=s,this.qv=h,this.Pf=document.createElement("div"),this.Pf.style.width="25px",this.Pf.style.height="100%",this.Pf.style.overflow="hidden",this.Dp=eh(this.Pf,P({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp)}m(){this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose()}Rf(){return this.Pf}Df(){return this.mp}Np(t){O(this.mp,t)||(this.mp=t,this.Dp.resizeCanvasElement(t),this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`,this.St=!0)}Fp(t){if(t<3&&!this.St||0===this.mp.width||0===this.mp.height)return;this.St=!1,this.Dp.applySuggestedBitmapSize();let i=Y(this.Dp,{colorSpace:this.ys.layout.colorSpace});null!==i&&i.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t)})}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}$p({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:s}){if(!this.$v())return;t.fillStyle=this.ys.timeScale.borderColor;let h=Math.floor(this.Au.N().S*e),r=Math.floor(this.Au.N().S*s),n=this.Pp?i.width-h:0;t.fillRect(n,0,h,r)}Up({context:t,bitmapSize:i}){to(t,0,0,i.width,i.height,this.qv())}}function eb(t){return i=>i.ia?.(t)??[]}let ey=eb("normal"),ew=eb("top"),eM=eb("bottom");class e_{constructor(t,i){this.Yv=null,this.jv=null,this.M=null,this.Zv=!1,this.mp=P({width:0,height:0}),this.Kv=new B,this.gp=new tC(5),this.xp=!1,this.Sp=()=>{this.xp||this._p.Qt().ar()},this.yp=()=>{this.xp||this._p.Qt().ar()},this._p=t,this.Yo=i,this.ys=t.N().layout,this.hp=document.createElement("tr"),this.Xv=document.createElement("td"),this.Xv.style.padding="0",this.Gv=document.createElement("td"),this.Gv.style.padding="0",this.Pf=document.createElement("td"),this.Pf.style.height="25px",this.Pf.style.padding="0",this.Jv=document.createElement("div"),this.Jv.style.width="100%",this.Jv.style.height="100%",this.Jv.style.position="relative",this.Jv.style.overflow="hidden",this.Pf.appendChild(this.Jv),this.Dp=eh(this.Jv,P({width:16,height:16})),this.Dp.subscribeSuggestedBitmapSizeChanged(this.Sp);let e=this.Dp.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Vp=eh(this.Jv,P({width:16,height:16})),this.Vp.subscribeSuggestedBitmapSizeChanged(this.yp);let s=this.Vp.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.hp.appendChild(this.Xv),this.hp.appendChild(this.Pf),this.hp.appendChild(this.Gv),this.Qv(),this._p.Qt().do().i(this.Qv.bind(this),this),this.wf=new i5(this.Vp.canvasElement,this,{Wd:()=>!0,Fd:()=>!this._p.N().handleScroll.horzTouchDrag})}m(){this.wf.m(),null!==this.Yv&&this.Yv.m(),null!==this.jv&&this.jv.m(),this.Vp.unsubscribeSuggestedBitmapSizeChanged(this.yp),er(this.Vp.canvasElement),this.Vp.dispose(),this.Dp.unsubscribeSuggestedBitmapSizeChanged(this.Sp),er(this.Dp.canvasElement),this.Dp.dispose()}Rf(){return this.hp}tm(){return this.Yv}im(){return this.jv}tf(t){if(this.Zv)return;this.Zv=!0;let i=this._p.Qt();!i.At().Zi()&&this._p.N().handleScale.axisPressedMouseMove.time&&i.Qu(t.localX)}Jd(t){this.tf(t)}if(){let t=this._p.Qt();!t.At().Zi()&&this.Zv&&(this.Zv=!1,this._p.N().handleScale.axisPressedMouseMove.time&&t.ac())}$d(t){let i=this._p.Qt();!i.At().Zi()&&this._p.N().handleScale.axisPressedMouseMove.time&&i.hc(t.localX)}Hd(t){this.$d(t)}Zd(){this.Zv=!1;let t=this._p.Qt();t.At().Zi()&&!this._p.N().handleScale.axisPressedMouseMove.time||t.ac()}Yd(){this.Zd()}Td(){this._p.N().handleScale.axisDoubleClickReset.time&&this._p.Qt().cn()}Cd(){this.Td()}Ed(){this._p.Qt().N().handleScale.axisPressedMouseMove.time&&this.Kp(1)}uf(){this.Kp(0)}Df(){return this.mp}sm(){return this.Kv}nm(t,i,e){O(this.mp,t)||(this.mp=t,this.xp=!0,this.Dp.resizeCanvasElement(t),this.Vp.resizeCanvasElement(t),this.xp=!1,this.Pf.style.width=`${t.width}px`,this.Pf.style.height=`${t.height}px`,this.Kv.p(t)),null!==this.Yv&&this.Yv.Np(P({width:i,height:t.height})),null!==this.jv&&this.jv.Np(P({width:e,height:t.height}))}rm(){let t=this.hm();return Math.ceil(t.S+t.C+t.P+t.A+t.V+t.am)}Pt(){this._p.Qt().At().Va()}Vf(){return this.Dp.bitmapSize}If(t,i,e){let s=this.Vf();s.width>0&&s.height>0&&t.drawImage(this.Dp.canvasElement,i,e)}Fp(t){if(0===t)return;let i={colorSpace:this.ys.colorSpace};if(1!==t){this.Dp.applySuggestedBitmapSize();let e=Y(this.Dp,i);null!==e&&(e.useBitmapCoordinateSpace(t=>{this.Up(t),this.$p(t),this.lm(e,eM)}),this.Yp(e),this.lm(e,ey)),null!==this.Yv&&this.Yv.Fp(t),null!==this.jv&&this.jv.Fp(t)}this.Vp.applySuggestedBitmapSize();let e=Y(this.Vp,i);null!==e&&(e.useBitmapCoordinateSpace(({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)}),this.om([...this._p.Qt().js(),this._p.Qt().Yu()],e),this.lm(e,ew))}lm(t,i){let e=this._p.Qt().js();for(let s of e)eo(i,i=>en(i,t,!1,void 0),s,void 0);for(let s of e)eo(i,i=>el(i,t,!1,void 0),s,void 0)}Up({context:t,bitmapSize:i}){to(t,0,0,i.width,i.height,this._p.Qt().xc())}$p({context:t,bitmapSize:i,verticalPixelRatio:e}){if(this._p.N().timeScale.borderVisible){t.fillStyle=this._m();let s=Math.max(1,Math.floor(this.hm().S*e));t.fillRect(0,0,i.width,s)}}Yp(t){let i=this._p.Qt().At(),e=i.Va();if(!e||0===e.length)return;let s=this.Yo.maxTickMarkWeight(e),h=this.hm(),r=i.N();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace(({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this._m(),t.fillStyle=this._m();let r=Math.max(1,Math.floor(i)),n=Math.floor(.5*i);t.beginPath();let l=Math.round(h.C*s);for(let s=e.length;s--;){let h=Math.round(e[s].coord*i);t.rect(h-n,0,r,l)}t.fill()}),t.useMediaCoordinateSpace(({context:t})=>{let i=h.S+h.C+h.A+h.P/2;for(let h of(t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.H(),t.font=this.Lp(),e))if(h.weight<s){let e=h.needAlignCoordinate?this.um(t,h.coord,h.label):h.coord;t.fillText(h.label,e,i)}for(let h of(this._p.N().timeScale.allowBoldLabels&&(t.font=this.dm()),e))if(h.weight>=s){let e=h.needAlignCoordinate?this.um(t,h.coord,h.label):h.coord;t.fillText(h.label,e,i)}})}um(t,i,e){let s=this.gp.Vi(t,e),h=Math.floor(i-s/2)+.5;return h<0?i+=Math.abs(0-h):h+s>this.mp.width&&(i-=Math.abs(this.mp.width-(h+s))),i}om(t,i){let e=this.hm();for(let s of t)for(let t of s.cs())t.Tt().nt(i,e)}_m(){return this._p.N().timeScale.borderColor}H(){return this.ys.textColor}W(){return this.ys.fontSize}Lp(){return G(this.W(),this.ys.fontFamily)}dm(){return G(this.W(),this.ys.fontFamily,"bold")}hm(){null===this.M&&(this.M={S:1,L:NaN,A:NaN,V:NaN,Ji:NaN,C:5,P:NaN,k:"",Gi:new tC,am:0});let t=this.M,i=this.Lp();if(t.k!==i){let e=this.W();t.P=e,t.k=i,t.A=3*e/12,t.V=3*e/12,t.Ji=9*e/12,t.L=0,t.am=4*e/12,t.Gi.In()}return this.M}Kp(t){this.Pf.style.cursor=1===t?"ew-resize":"default"}Qv(){let t=this._p.Qt(),i=t.N();i.leftPriceScale.visible||null===this.Yv||(this.Xv.removeChild(this.Yv.Rf()),this.Yv.m(),this.Yv=null),i.rightPriceScale.visible||null===this.jv||(this.Gv.removeChild(this.jv.Rf()),this.jv.m(),this.jv=null);let e={cc:this._p.Qt().cc()},s=()=>i.leftPriceScale.borderVisible&&t.At().N().borderVisible,h=()=>t.xc();i.leftPriceScale.visible&&null===this.Yv&&(this.Yv=new ev("left",i,e,s,h),this.Xv.appendChild(this.Yv.Rf())),i.rightPriceScale.visible&&null===this.jv&&(this.jv=new ev("right",i,e,s,h),this.Gv.appendChild(this.jv.Rf()))}}let eS=!!i1&&!!navigator.userAgentData&&navigator.userAgentData.brands.some(t=>t.brand.includes("Chromium"))&&!!i1&&(navigator?.userAgentData?.platform?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);class ex{constructor(t,i,e){var s;this.fm=[],this.pm=[],this.vm=0,this.ja=0,this.no=0,this.wm=0,this.gm=0,this.Mm=null,this.bm=!1,this.sv=new B,this.nv=new B,this.Vu=new B,this.xm=null,this.Sm=null,this.op=t,this.ys=i,this.Yo=e,this.hp=document.createElement("div"),this.hp.classList.add("tv-lightweight-charts"),this.hp.style.overflow="hidden",this.hp.style.direction="ltr",this.hp.style.width="100%",this.hp.style.height="100%",(s=this.hp).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.Cm=document.createElement("table"),this.Cm.setAttribute("cellspacing","0"),this.hp.appendChild(this.Cm),this.ym=this.Pm.bind(this),eP(this.ys)&&this.km(!0),this.ts=new iB(this.Bu.bind(this),this.ys,e),this.Qt().ju().i(this.Tm.bind(this),this),this.Rm=new e_(this,this.Yo),this.Cm.appendChild(this.Rm.Rf());let h=i.autoSize&&this.Dm(),r=this.ys.width,n=this.ys.height;if(h||0===r||0===n){let i=t.getBoundingClientRect();r=r||i.width,n=n||i.height}this.Vm(r,n),this.Im(),t.appendChild(this.hp),this.Bm(),this.ts.At().pu().i(this.ts.Bh.bind(this.ts),this),this.ts.do().i(this.ts.Bh.bind(this.ts),this)}Qt(){return this.ts}N(){return this.ys}Sf(){return this.fm}Am(){return this.Rm}m(){for(let t of(this.km(!1),0!==this.vm&&window.cancelAnimationFrame(this.vm),this.ts.ju().u(this),this.ts.At().pu().u(this),this.ts.do().u(this),this.ts.m(),this.fm))this.Cm.removeChild(t.Rf()),t.Tv().u(this),t.Rv().u(this),t.m();for(let t of(this.fm=[],this.pm))this.Em(t);this.pm=[],V(this.Rm).m(),null!==this.hp.parentElement&&this.hp.parentElement.removeChild(this.hp),this.Vu.m(),this.sv.m(),this.nv.m(),this.zm()}Vm(t,i,e=!1){if(this.ja===i&&this.no===t)return;let s=function(t){let i=Math.floor(t.width),e=Math.floor(t.height);return P({width:i-i%2,height:e-e%2})}(P({width:t,height:i}));this.ja=s.height,this.no=s.width;let h=this.ja+"px",r=this.no+"px";V(this.hp).style.height=h,V(this.hp).style.width=r,this.Cm.style.height=h,this.Cm.style.width=r,e?this.Lm(tM.gn(),performance.now()):this.ts.Bh()}Fp(t){void 0===t&&(t=tM.gn());for(let i=0;i<this.fm.length;i++)this.fm[i].Fp(t.en(i).tn);this.ys.timeScale.visible&&this.Rm.Fp(t.nn())}hr(t){let i=eP(this.ys);this.ts.hr(t);let e=eP(this.ys);e!==i&&this.km(e),t.layout?.panes&&this.Om(),this.Bm(),this.Nm(t)}Tv(){return this.sv}Rv(){return this.nv}ju(){return this.Vu}Wm(){null!==this.Mm&&(this.Lm(this.Mm,performance.now()),this.Mm=null);let t=this.Fm(null),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let e=V(i.getContext("2d"));return this.Fm(e),i}Hm(t){return("left"!==t||this.Um())&&("right"!==t||this.$m())&&0!==this.fm.length?V("left"===t?this.fm[0].zv():this.fm[0].Lv()).Wp():0}qm(){return this.ys.autoSize&&null!==this.xm}Af(){return this.hp}Ym(t){this.Sm=t,this.Sm?this.Af().style.setProperty("cursor",t):this.Af().style.removeProperty("cursor")}jm(){return this.Sm}Zm(t){return N(this.fm[t]).Df()}Om(){this.pm.forEach(t=>{t.Pt()})}Nm(t){(void 0!==t.autoSize||!this.xm||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.xm&&this.Dm(),!1===t.autoSize&&null!==this.xm&&this.zm(),t.autoSize||void 0===t.width&&void 0===t.height||this.Vm(t.width||this.no,t.height||this.ja))}Fm(t){let i=0,e=0,s=this.fm[0],h=(i,e)=>{let s=0;for(let h=0;h<this.fm.length;h++){let r=this.fm[h],n=V("left"===i?r.zv():r.Lv()),l=n.Vf();if(null!==t&&n.If(t,e,s),s+=l.height,h<this.fm.length-1){let i=this.pm[h],r=i.Vf();null!==t&&i.If(t,e,s),s+=r.height}}};this.Um()&&(h("left",0),i+=V(s.zv()).Vf().width);for(let s=0;s<this.fm.length;s++){let h=this.fm[s],r=h.Vf();if(null!==t&&h.If(t,i,e),e+=r.height,s<this.fm.length-1){let h=this.pm[s],r=h.Vf();null!==t&&h.If(t,i,e),e+=r.height}}i+=s.Vf().width,this.$m()&&(h("right",i),i+=V(s.Lv()).Vf().width);let r=(i,e,s)=>{V("left"===i?this.Rm.tm():this.Rm.im()).If(V(t),e,s)};if(this.ys.timeScale.visible){let i=this.Rm.Vf();if(null!==t){let h=0;this.Um()&&(r("left",h,e),h=V(s.zv()).Vf().width),this.Rm.If(t,h,e),h+=i.width,this.$m()&&r("right",h,e)}e+=i.height}return P({width:i,height:e})}Km(){var t,i,e;let s=0,h=0,r=0;for(let t of this.fm)this.Um()&&(h=Math.max(h,V(t.zv()).zp(),this.ys.leftPriceScale.minimumWidth)),this.$m()&&(r=Math.max(r,V(t.Lv()).zp(),this.ys.rightPriceScale.minimumWidth)),s+=t.fo();h=(i=h)+i%2,r=(e=r)+e%2;let n=this.no,l=this.ja,o=Math.max(n-h-r,0),a=+this.pm.length,u=this.ys.timeScale.visible,c=u?Math.max(this.Rm.rm(),this.ys.timeScale.minimumHeight):0,f=a+(c=(t=c)+t%2),d=l<f?0:l-f,p=d/s,m=0,g=window.devicePixelRatio||1;for(let t=0;t<this.fm.length;++t){let i=this.fm[t];i.vv(this.ts.$s()[t]);let e=0,s=0;e=Math.max(t===this.fm.length-1?Math.ceil((d-m)*g)/g:Math.round(i.fo()*p*g)/g,2),m+=e,i.Np(P({width:o,height:e})),this.Um()&&i.Vv(h,"left"),this.$m()&&i.Vv(r,"right"),i.Wf()&&this.ts.Zu(i.Wf(),e)}this.Rm.nm(P({width:u?o:0,height:c}),u?h:0,u?r:0),this.ts.vo(o),this.wm!==h&&(this.wm=h),this.gm!==r&&(this.gm=r)}km(t){t?this.hp.addEventListener("wheel",this.ym,{passive:!1}):this.hp.removeEventListener("wheel",this.ym)}Xm(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return eS?1/window.devicePixelRatio:1}Pm(t){if(!(0!==t.deltaX&&this.ys.handleScroll.mouseWheel||0!==t.deltaY&&this.ys.handleScale.mouseWheel))return;let i=this.Xm(t),e=i*t.deltaX/100,s=-i*t.deltaY/100;if(t.cancelable&&t.preventDefault(),0!==s&&this.ys.handleScale.mouseWheel){let i=Math.sign(s)*Math.min(1,Math.abs(s)),e=t.clientX-this.hp.getBoundingClientRect().left;this.Qt().tc(e,i)}0!==e&&this.ys.handleScroll.mouseWheel&&this.Qt().sc(-80*e)}Lm(t,i){let e=t.nn();3===e&&this.Gm(),3!==e&&2!==e||(this.Jm(t),this.Qm(t,i),this.Rm.Pt(),this.fm.forEach(t=>{t.wv()}),3===this.Mm?.nn()&&(this.Mm.vn(t),this.Gm(),this.Jm(this.Mm),this.Qm(this.Mm,i),t=this.Mm,this.Mm=null)),this.Fp(t)}Qm(t,i){for(let e of t.pn())this.mn(e,i)}Jm(t){let i=this.ts.$s();for(let e=0;e<i.length;e++)t.en(e).sn&&i[e].Ao()}mn(t,i){let e=this.ts.At();switch(t.an){case 0:e.mu();break;case 1:e.wu(t.Ft);break;case 2:e.dn(t.Ft);break;case 3:e.fn(t.Ft);break;case 4:e.eu();break;case 5:t.Ft.uu(i)||e.fn(t.Ft.cu(i))}}Bu(t){null!==this.Mm?this.Mm.vn(t):this.Mm=t,this.bm||(this.bm=!0,this.vm=window.requestAnimationFrame(t=>{if(this.bm=!1,this.vm=0,null!==this.Mm){let i=this.Mm;for(let e of(this.Mm=null,this.Lm(i,t),i.pn()))if(5===e.an&&!e.Ft.uu(t)){this.Qt()._n(e.Ft);break}}}))}Gm(){this.Im()}Em(t){this.Cm.removeChild(t.Rf()),t.m()}Im(){let t=this.ts.$s(),i=t.length,e=this.fm.length;for(let t=i;t<e;t++){let t=N(this.fm.pop());this.Cm.removeChild(t.Rf()),t.Tv().u(this),t.Rv().u(this),t.m();let i=this.pm.pop();void 0!==i&&this.Em(i)}for(let s=e;s<i;s++){let i=new eg(this,t[s]);if(i.Tv().i(this.tw.bind(this,i),this),i.Rv().i(this.iw.bind(this,i),this),this.fm.push(i),s>0){let t=new et(this,s-1,s);this.pm.push(t),this.Cm.insertBefore(t.Rf(),this.Rm.Rf())}this.Cm.insertBefore(i.Rf(),this.Rm.Rf())}for(let e=0;e<i;e++){let i=t[e],s=this.fm[e];s.Wf()!==i?s.vv(i):s.pv()}this.Bm(),this.Km()}sw(t,i,e,s){let h;let r=new Map;if(null!==t&&this.ts.js().forEach(i=>{let e=i.Ks().Wr(t);null!==e&&r.set(i,e)}),null!==t){let i=this.ts.At().ss(t)?.originalTime;void 0!==i&&(h=i)}let n=this.Qt().Hu(),l=null!==n&&n.Wo instanceof is?n.Wo:void 0,o=null!==n&&void 0!==n.Fo?n.Fo.Zn:void 0,a=this.nw(s);return{ew:h,Re:t??void 0,rw:i??void 0,hw:-1!==a?a:void 0,aw:l,lw:r,ow:o,_w:e??void 0}}nw(t){let i=-1;if(t)i=this.fm.indexOf(t);else{let t=this.Qt().Yu().Us();null!==t&&(i=this.Qt().$s().indexOf(t))}return i}tw(t,i,e,s){this.sv.p(()=>this.sw(i,e,s,t))}iw(t,i,e,s){this.nv.p(()=>this.sw(i,e,s,t))}Tm(t,i,e){this.Ym(this.Qt().Hu()?.Uo??null),this.Vu.p(()=>this.sw(t,i,e))}Bm(){let t=this.ys.timeScale.visible?"":"none";this.Rm.Rf().style.display=t}Um(){return this.fm[0].Wf().Co().N().visible}$m(){return this.fm[0].Wf().yo().N().visible}Dm(){return"ResizeObserver"in window&&(this.xm=new ResizeObserver(t=>{let i=t[t.length-1];i&&this.Vm(i.contentRect.width,i.contentRect.height)}),this.xm.observe(this.op,{box:"border-box"}),!0)}zm(){null!==this.xm&&this.xm.disconnect(),this.xm=null}}function eP(t){return!!(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function eO(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.color&&(r.R=e.color),r}function eC(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.lineColor&&(r.vt=e.lineColor),void 0!==e.topColor&&(r.mr=e.topColor),void 0!==e.bottomColor&&(r.wr=e.bottomColor),r}function eR(t,i,e,s){let h=e.value,r={Re:i,wt:t,Ft:[h,h,h,h],ew:s};return void 0!==e.topLineColor&&(r.gr=e.topLineColor),void 0!==e.bottomLineColor&&(r.Mr=e.bottomLineColor),void 0!==e.topFillColor1&&(r.br=e.topFillColor1),void 0!==e.topFillColor2&&(r.Sr=e.topFillColor2),void 0!==e.bottomFillColor1&&(r.Cr=e.bottomFillColor1),void 0!==e.bottomFillColor2&&(r.yr=e.bottomFillColor2),r}function ek(t,i,e,s){let h={Re:i,wt:t,Ft:[e.open,e.high,e.low,e.close],ew:s};return void 0!==e.color&&(h.R=e.color),h}function ez(t,i,e,s){let h={Re:i,wt:t,Ft:[e.open,e.high,e.low,e.close],ew:s};return void 0!==e.color&&(h.R=e.color),void 0!==e.borderColor&&(h.Ht=e.borderColor),void 0!==e.wickColor&&(h.vr=e.wickColor),h}function eY(t,i,e,s,h){let r=N(h)(e),n=Math.max(...r),l=Math.min(...r),o=r[r.length-1],{time:a,color:u,...c}=e;return{Re:i,wt:t,Ft:[o,n,l,o],ew:s,se:c,R:u}}function eE(t){return void 0!==t.Ft}function ej(t,i){return void 0!==i.customValues&&(t.uw=i.customValues),t}function eT(t){return(i,e,s,h,r,n)=>(n?n(s):void 0===s.open&&void 0===s.value)?ej({wt:i,Re:e,ew:h},s):ej(t(i,e,s,h,r),s)}function eL(t){return({Candlestick:eT(ez),Bar:eT(ek),Area:eT(eC),Baseline:eT(eR),Histogram:eT(eO),Line:eT(eO),Custom:eT(eY)})[t]}function eN(t){return{Re:0,cw:new Map,Hh:t}}function eV(t,i){if(void 0!==t&&0!==t.length)return{dw:i.key(t[0].wt),fw:i.key(t[t.length-1].wt)}}function eD(t){let i;return t.forEach(t=>{void 0===i&&(i=t.ew)}),N(i)}class eB{constructor(t){this.pw=new Map,this.mw=new Map,this.ww=new Map,this.gw=[],this.Yo=t}m(){this.pw.clear(),this.mw.clear(),this.ww.clear(),this.gw=[]}Mw(t,i){let e=0!==this.pw.size,s=!1,h=this.mw.get(t);if(void 0!==h){if(1===this.mw.size)e=!1,s=!0,this.pw.clear();else for(let i of this.gw)i.pointData.cw.delete(t)&&(s=!0)}let r=[];if(0!==i.length){let e=i.map(t=>t.time),h=this.Yo.createConverterToInternalObj(i),n=eL(t.Rr()),l=t.da(),o=t.pa();r=i.map((i,r)=>{let a=h(i.time),u=this.Yo.key(a),c=this.pw.get(u);void 0===c&&(c=eN(a),this.pw.set(u,c),s=!0);let f=n(a,c.Re,i,e[r],l,o);return c.cw.set(t,f),f})}e&&this.bw(),this.xw(t,r);let n=-1;if(s){let t=[];this.pw.forEach(i=>{t.push({timeWeight:0,time:i.Hh,pointData:i,originalTime:eD(i.cw)})}),t.sort((t,i)=>this.Yo.key(t.time)-this.Yo.key(i.time)),n=this.Sw(t)}return this.Cw(t,n,function(t,i,e){let s=eV(t,e),h=eV(i,e);if(void 0!==s&&void 0!==h)return{yw:!1,zh:s.fw>=h.fw&&s.dw>=h.dw}}(this.mw.get(t),h,this.Yo))}vc(t){return this.Mw(t,[])}Pw(t,i,e){void 0===i.ew&&(i.ew=i.time),this.Yo.preprocessData(i);let s=this.Yo.createConverterToInternalObj([i])(i.time),h=this.ww.get(t);if(!e&&void 0!==h&&this.Yo.key(s)<this.Yo.key(h))throw Error(`Cannot update oldest data, last time=${h}, new time=${s}`);let r=this.pw.get(this.Yo.key(s));if(e&&void 0===r)throw Error("Cannot update non-existing data point when historicalUpdate is true");let n=void 0===r;void 0===r&&(r=eN(s),this.pw.set(this.Yo.key(s),r));let l=eL(t.Rr()),o=t.da(),a=t.pa(),u=l(s,r.Re,i,i.ew,o,a);r.cw.set(t,u),e?this.kw(t,u,r.Re):this.Tw(t,u);let c={zh:eE(u),yw:e};if(!n)return this.Cw(t,-1,c);let f={timeWeight:0,time:r.Hh,pointData:r,originalTime:eD(r.cw)},d=tZ(this.gw,this.Yo.key(f.time),(t,i)=>this.Yo.key(t.time)<i);this.gw.splice(d,0,f);for(let t=d;t<this.gw.length;++t)eW(this.gw[t].pointData,t);return this.Yo.fillWeightsForPoints(this.gw,d),this.Cw(t,d,c)}Tw(t,i){let e=this.mw.get(t);void 0===e&&(e=[],this.mw.set(t,e));let s=0!==e.length?e[e.length-1]:null;null===s||this.Yo.key(i.wt)>this.Yo.key(s.wt)?eE(i)&&e.push(i):eE(i)?e[e.length-1]=i:e.splice(-1,1),this.ww.set(t,i.wt)}kw(t,i,e){let s=this.mw.get(t);if(void 0===s)return;let h=tZ(s,e,(t,i)=>t.Re<i);eE(i)?s[h]=i:s.splice(h,1)}xw(t,i){0!==i.length?(this.mw.set(t,i.filter(eE)),this.ww.set(t,i[i.length-1].wt)):(this.mw.delete(t),this.ww.delete(t))}bw(){for(let t of this.gw)0===t.pointData.cw.size&&this.pw.delete(this.Yo.key(t.time))}Sw(t){let i=-1;for(let e=0;e<this.gw.length&&e<t.length;++e){let s=this.gw[e],h=t[e];if(this.Yo.key(s.time)!==this.Yo.key(h.time)){i=e;break}h.timeWeight=s.timeWeight,eW(h.pointData,e)}if(-1===i&&this.gw.length!==t.length&&(i=Math.min(this.gw.length,t.length)),-1===i)return -1;for(let e=i;e<t.length;++e)eW(t[e].pointData,e);return this.Yo.fillWeightsForPoints(t,i),this.gw=t,i}Rw(){if(0===this.mw.size)return null;let t=0;return this.mw.forEach(i=>{0!==i.length&&(t=Math.max(t,i[i.length-1].Re))}),t}Cw(t,i,e){let s={wo:new Map,At:{Y_:this.Rw()}};if(-1!==i)this.mw.forEach((i,h)=>{s.wo.set(h,{se:i,Dw:h===t?e:void 0})}),this.mw.has(t)||s.wo.set(t,{se:[],Dw:e}),s.At.Vw=this.gw,s.At.Iw=i;else{let i=this.mw.get(t);s.wo.set(t,{se:i||[],Dw:e})}return s}}function eW(t,i){t.Re=i,t.cw.forEach(t=>{t.Re=i})}function eF(t,i){return t.wt<i}function eI(t,i){return i<t.wt}function eQ(t,i,e){let s=i.Uh(),h=i.bi(),r=tZ(t,s,eF),n=tG(t,h,eI);if(!e)return{from:r,to:n};let l=r,o=n;return r>0&&r<t.length&&t[r].wt>=s&&(l=r-1),n>0&&n<t.length&&t[n-1].wt<=h&&(o=n+1),{from:l,to:o}}class eA{constructor(t,i,e){this.Bw=!0,this.Aw=!0,this.Ew=!0,this.zw=[],this.Lw=null,this.Jn=t,this.Qn=i,this.Ow=e}Pt(t){this.Bw=!0,"data"===t&&(this.Aw=!0),"options"===t&&(this.Ew=!0)}Tt(){return this.Jn.Vt()?(this.Nw(),null===this.Lw?null:this.Ww):null}Fw(){this.zw=this.zw.map(t=>({...t,...this.Jn.Rh().Dr(t.wt)}))}Hw(){this.Lw=null}Nw(){this.Aw&&(this.Uw(),this.Aw=!1),this.Ew&&(this.Fw(),this.Ew=!1),this.Bw&&(this.$w(),this.Bw=!1)}$w(){let t=this.Jn.Wt(),i=this.Qn.At();if(this.Hw(),i.Zi()||t.Zi())return;let e=i.ye();if(null===e||0===this.Jn.Ks().zr())return;let s=this.Jn.zt();null!==s&&(this.Lw=eQ(this.zw,e,this.Ow),this.qw(t,i,s.Ft),this.Yw())}}class eJ{constructor(t,i){this.jw=t,this.Yi=i}nt(t,i,e){this.jw.draw(t,this.Yi,i,e)}}class e$ extends eA{constructor(t,i,e){super(t,i,!1),this.sh=e,this.Ww=new eJ(this.sh.renderer(),i=>{let e=t.zt();return null===e?null:t.Wt().Nt(i,e.Ft)})}fa(t){return this.sh.priceValueBuilder(t)}va(t){return this.sh.isWhitespace(t)}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>({wt:i.Re,_t:NaN,...t.Dr(i.Re),Zw:i.se}))}qw(t,i){i.j_(this.zw,U(this.Lw))}Yw(){this.sh.update({bars:this.zw.map(eU),barSpacing:this.Qn.At().Q_(),visibleRange:this.Lw},this.Jn.N())}}function eU(t){return{x:t._t,time:t.wt,originalData:t.Zw,barColor:t.cr}}let eZ={color:"#2196f3"},eG=(t,i,e)=>new e$(t,i,D(e));function eK(t){let i={value:t.Ft[3],time:t.ew};return void 0!==t.uw&&(i.customValues=t.uw),i}function eX(t){let i=eK(t);return void 0!==t.R&&(i.color=t.R),i}function eH(t){let i=eK(t);return void 0!==t.vt&&(i.lineColor=t.vt),void 0!==t.mr&&(i.topColor=t.mr),void 0!==t.wr&&(i.bottomColor=t.wr),i}function eq(t){let i=eK(t);return void 0!==t.gr&&(i.topLineColor=t.gr),void 0!==t.Mr&&(i.bottomLineColor=t.Mr),void 0!==t.br&&(i.topFillColor1=t.br),void 0!==t.Sr&&(i.topFillColor2=t.Sr),void 0!==t.Cr&&(i.bottomFillColor1=t.Cr),void 0!==t.yr&&(i.bottomFillColor2=t.yr),i}function e0(t){let i={open:t.Ft[0],high:t.Ft[1],low:t.Ft[2],close:t.Ft[3],time:t.ew};return void 0!==t.uw&&(i.customValues=t.uw),i}function e1(t){let i=e0(t);return void 0!==t.R&&(i.color=t.R),i}function e2(t){let i=e0(t),{R:e,Ht:s,vr:h}=t;return void 0!==e&&(i.color=e),void 0!==s&&(i.borderColor=s),void 0!==h&&(i.wickColor=h),i}function e3(t){return({Area:eH,Line:eX,Baseline:eq,Histogram:eX,Bar:e1,Candlestick:e2,Custom:e5})[t]}function e5(t){let i=t.ew;return{...t.se,time:i}}let e6={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},e4={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},e9={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Z,panes:{enableResize:!0,separatorColor:"#E0E3EB",separatorHoverColor:"rgba(178, 181, 189, 0.2)"},attributionLogo:!0,colorSpace:"srgb",colorParsers:[]},e8={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0},e7={rightOffset:0,barSpacing:6,minBarSpacing:.5,maxBarSpacing:0,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0,ignoreWhitespaceIndices:!1};function st(){return{width:0,height:0,autoSize:!1,layout:e9,crosshair:e6,grid:e4,overlayPriceScales:{...e8},leftPriceScale:{...e8,visible:!1},rightPriceScale:{...e8,visible:!0},timeScale:e7,localization:{locale:i1?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class si{constructor(t,i,e){this.bf=t,this.Kw=i,this.Xw=e??0}applyOptions(t){this.bf.Qt().$u(this.Kw,t,this.Xw)}options(){return this.Yi().N()}width(){return tw(this.Kw)?this.bf.Hm(this.Kw):0}Yi(){return V(this.bf.Qt().qu(this.Kw,this.Xw)).Wt}}class se{constructor(t,i,e,s){this.bf=t,this.yt=e,this.Gw=i,this.Jw=s}getHeight(){return this.yt.$t()}setHeight(t){let i=this.bf.Qt(),e=i.Cc(this.yt);i.Xu(e,t)}paneIndex(){return this.bf.Qt().Cc(this.yt)}moveTo(t){let i=this.paneIndex();i!==t&&(L(t>=0&&t<this.bf.Sf().length,"Invalid pane index"),this.bf.Qt().Gu(i,t))}getSeries(){return this.yt.wo().map(t=>this.Gw(t))??[]}getHTMLElement(){return this.bf.Sf()[this.paneIndex()].Rf()}attachPrimitive(t){this.yt.ua(t),t.attached&&t.attached({chart:this.Jw,requestUpdate:()=>this.yt.Qt().Bh()})}detachPrimitive(t){this.yt.ca(t)}priceScale(t){if(null===this.yt.co(t))throw Error(`Cannot find price scale with id: ${t}`);return new si(this.bf,t,this.paneIndex())}}let ss={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class sh{constructor(t){this.ir=t}applyOptions(t){this.ir.hr(t)}options(){return this.ir.N()}Qw(){return this.ir}}class sr{constructor(t,i,e,s,h,r){this.tg=new B,this.Jn=t,this.ig=i,this.sg=e,this.Yo=h,this.Jw=s,this.ng=r}m(){this.tg.m()}priceFormatter(){return this.Jn.ra()}priceToCoordinate(t){let i=this.Jn.zt();return null===i?null:this.Jn.Wt().Nt(t,i.Ft)}coordinateToPrice(t){let i=this.Jn.zt();return null===i?null:this.Jn.Wt().Ts(t,i.Ft)}barsInLogicalRange(t){if(null===t)return null;let i=new iN(new ij(t.from,t.to)).o_(),e=this.Jn.Ks();if(e.Zi())return null;let s=e.Wr(i.Uh(),1),h=e.Wr(i.bi(),-1),r=V(e.Lr()),n=V(e.Zs());if(null!==s&&null!==h&&s.Re>h.Re)return{barsBefore:t.from-r,barsAfter:n-t.to};let l={barsBefore:null===s||s.Re===r?t.from-r:s.Re-r,barsAfter:null===h||h.Re===n?n-t.to:n-h.Re};return null!==s&&null!==h&&(l.from=s.ew,l.to=h.ew),l}setData(t){this.Yo,this.Jn.Rr(),this.ig.eg(this.Jn,t),this.rg("full")}update(t,i=!1){this.Jn.Rr(),this.ig.hg(this.Jn,t,i),this.rg("update")}dataByIndex(t,i){let e=this.Jn.Ks().Wr(t,i);return null===e?null:e3(this.seriesType())(e)}data(){let t=e3(this.seriesType());return this.Jn.Ks().Hr().map(i=>t(i))}subscribeDataChanged(t){this.tg.i(t)}unsubscribeDataChanged(t){this.tg._(t)}applyOptions(t){this.Jn.hr(t)}options(){return J(this.Jn.N())}priceScale(){return this.sg.priceScale(this.Jn.Wt().wa(),this.getPane().paneIndex())}createPriceLine(t){let i=W(J(ss),t);return new sh(this.Jn.Oh(i))}removePriceLine(t){this.Jn.Nh(t.Qw())}priceLines(){return this.Jn.Wh().map(t=>new sh(t))}seriesType(){return this.Jn.Rr()}attachPrimitive(t){this.Jn.ua(t),t.attached&&t.attached({chart:this.Jw,series:this,requestUpdate:()=>this.Jn.Qt().Bh(),horzScaleBehavior:this.Yo})}detachPrimitive(t){this.Jn.ca(t),t.detached&&t.detached(),this.Jn.Qt().Bh()}getPane(){let t=this.Jn,i=V(this.Jn.Qt().Hn(t));return this.ng(i)}moveToPane(t){this.Jn.Qt().Mc(this.Jn,t)}rg(t){this.tg.v()&&this.tg.p(t)}}class sn{constructor(t,i,e){this.ag=new B,this.g_=new B,this.Kv=new B,this.ts=t,this.uh=t.At(),this.Rm=i,this.uh.du().i(this.lg.bind(this)),this.uh.fu().i(this.og.bind(this)),this.Rm.sm().i(this._g.bind(this)),this.Yo=e}m(){this.uh.du().u(this),this.uh.fu().u(this),this.Rm.sm().u(this),this.ag.m(),this.g_.m(),this.Kv.m()}scrollPosition(){return this.uh.iu()}scrollToPosition(t,i){i?this.uh._u(t,1e3):this.ts.fn(t)}scrollToRealTime(){this.uh.ou()}getVisibleRange(){let t=this.uh.O_();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){let i={from:this.Yo.convertHorzItemToInternal(t.from),to:this.Yo.convertHorzItemToInternal(t.to)},e=this.uh.H_(i);this.ts.wc(e)}getVisibleLogicalRange(){let t=this.uh.L_();return null===t?null:{from:t.Uh(),to:t.bi()}}setVisibleLogicalRange(t){L(t.from<=t.to,"The from index cannot be after the to index."),this.ts.wc(t)}resetTimeScale(){this.ts.cn()}fitContent(){this.ts.mu()}logicalToCoordinate(t){let i=this.ts.At();return i.Zi()?null:i.qt(t)}coordinateToLogical(t){return this.uh.Zi()?null:this.uh.Z_(t)}timeToIndex(t,i){let e=this.Yo.convertHorzItemToInternal(t);return this.uh.A_(e,i)}timeToCoordinate(t){let i=this.timeToIndex(t,!1);return null===i?null:this.uh.qt(i)}coordinateToTime(t){let i=this.ts.At(),e=i.Z_(t),s=i.ss(e);return null===s?null:s.originalTime}width(){return this.Rm.Df().width}height(){return this.Rm.Df().height}subscribeVisibleTimeRangeChange(t){this.ag.i(t)}unsubscribeVisibleTimeRangeChange(t){this.ag._(t)}subscribeVisibleLogicalRangeChange(t){this.g_.i(t)}unsubscribeVisibleLogicalRangeChange(t){this.g_._(t)}subscribeSizeChange(t){this.Kv.i(t)}unsubscribeSizeChange(t){this.Kv._(t)}applyOptions(t){this.uh.hr(t)}options(){return{...J(this.uh.N()),barSpacing:this.uh.Q_()}}lg(){this.ag.v()&&this.ag.p(this.getVisibleRange())}og(){this.g_.v()&&this.g_.p(this.getVisibleLogicalRange())}_g(t){this.Kv.p(t.width,t.height)}}function sl(t){return function(t){if(A(t.handleScale)){let i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(void 0!==t.handleScale){let{axisPressedMouseMove:i,axisDoubleClickReset:e}=t.handleScale;A(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),A(e)&&(t.handleScale.axisDoubleClickReset={time:e,price:e})}let i=t.handleScroll;A(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i})}(t),t}class so{constructor(t,i,e){this.ug=new Map,this.cg=new Map,this.dg=new B,this.fg=new B,this.pg=new B,this.ku=new WeakMap,this.vg=new eB(i);let s=void 0===e?J(st()):W(J(st()),sl(e));this.mg=i,this.bf=new ex(t,s,i),this.bf.Tv().i(t=>{this.dg.v()&&this.dg.p(this.wg(t()))},this),this.bf.Rv().i(t=>{this.fg.v()&&this.fg.p(this.wg(t()))},this),this.bf.ju().i(t=>{this.pg.v()&&this.pg.p(this.wg(t()))},this);let h=this.bf.Qt();this.gg=new sn(h,this.bf.Am(),this.mg)}remove(){this.bf.Tv().u(this),this.bf.Rv().u(this),this.bf.ju().u(this),this.gg.m(),this.bf.m(),this.ug.clear(),this.cg.clear(),this.dg.m(),this.fg.m(),this.pg.m(),this.vg.m()}resize(t,i,e){this.autoSizeActive()||this.bf.Vm(t,i,e)}addCustomSeries(t,i={},e=0){let s;let h=(s=D(t),{type:"Custom",isBuiltIn:!1,defaultOptions:{...eZ,...s.defaultOptions()},Mg:eG,bg:s});return this.xg(h,i,e)}addSeries(t,i={},e=0){return this.xg(t,i,e)}removeSeries(t){let i=N(this.ug.get(t)),e=this.vg.vc(i);this.bf.Qt().vc(i),this.Sg(e),this.ug.delete(t),this.cg.delete(i)}eg(t,i){this.Sg(this.vg.Mw(t,i))}hg(t,i,e){this.Sg(this.vg.Pw(t,i,e))}subscribeClick(t){this.dg.i(t)}unsubscribeClick(t){this.dg._(t)}subscribeCrosshairMove(t){this.pg.i(t)}unsubscribeCrosshairMove(t){this.pg._(t)}subscribeDblClick(t){this.fg.i(t)}unsubscribeDblClick(t){this.fg._(t)}priceScale(t,i=0){return new si(this.bf,t,i)}timeScale(){return this.gg}applyOptions(t){this.bf.hr(sl(t))}options(){return this.bf.N()}takeScreenshot(){return this.bf.Wm()}removePane(t){this.bf.Qt().Ku(t)}swapPanes(t,i){this.bf.Qt().Gu(t,i)}autoSizeActive(){return this.bf.qm()}chartElement(){return this.bf.Af()}panes(){return this.bf.Qt().$s().map(t=>this.Cg(t))}paneSize(t=0){let i=this.bf.Zm(t);return{height:i.height,width:i.width}}setCrosshairPosition(t,i,e){let s=this.ug.get(e);if(void 0===s)return;let h=this.bf.Qt().Hn(s);null!==h&&this.bf.Qt().oc(t,i,h)}clearCrosshairPosition(){this.bf.Qt()._c(!0)}horzBehaviour(){return this.mg}xg(t,i={},e=0){var s;L(void 0!==t.Mg),void 0!==(s=i.priceFormat)&&"custom"!==s.type&&void 0!==s.minMove&&void 0===s.precision&&(s.precision=function(t){if(t>=1)return 0;let i=0;for(;i<8&&!(1e-8>Math.abs(Math.round(t)-t));i++)t*=10;return i}(s.minMove)),"Candlestick"===t.type&&(void 0!==i.borderColor&&(i.borderUpColor=i.borderColor,i.borderDownColor=i.borderColor),void 0!==i.wickColor&&(i.wickUpColor=i.wickColor,i.wickDownColor=i.wickColor));let h=W(J(E),J(t.defaultOptions),i),r=t.Mg,n=new is(this.bf.Qt(),t.type,h,r,t.bg);this.bf.Qt().dc(n,e);let l=new sr(n,this,this,this,this.mg,t=>this.Cg(t));return this.ug.set(l,n),this.cg.set(n,l),l}Sg(t){let i=this.bf.Qt();i.uc(t.At.Y_,t.At.Vw,t.At.Iw),t.wo.forEach((t,i)=>i.ht(t.se,t.Dw)),i.At().R_(),i.J_()}yg(t){return N(this.cg.get(t))}wg(t){let i=new Map;t.lw.forEach((t,e)=>{let s=e.Rr(),h=e3(s)(t);if("Custom"!==s)L(void 0!==h.open||void 0!==h.value);else{let t=e.pa();L(!t||!1===t(h))}i.set(this.yg(e),h)});let e=void 0!==t.aw&&this.cg.has(t.aw)?this.yg(t.aw):void 0;return{time:t.ew,logical:t.Re,point:t.rw,paneIndex:t.hw,hoveredSeries:e,hoveredObjectId:t.ow,seriesData:i,sourceEvent:t._w}}Cg(t){let i=this.ku.get(t);return i||(i=new se(this.bf,t=>this.yg(t),t,this),this.ku.set(t,i)),i}}class sa extends eA{constructor(t,i){super(t,i,!0)}qw(t,i,e){i.j_(this.zw,U(this.Lw)),t.Dl(this.zw,e,U(this.Lw))}Pg(t,i){return{wt:t,gt:i,_t:NaN,ut:NaN}}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>{let e=i.Ft[3];return this.kg(i.Re,e,t)})}}function su(t,i,e,s,h,r,n){if(0===i.length||s.from>=i.length||s.to<=0)return;let{context:l,horizontalPixelRatio:o,verticalPixelRatio:a}=t,u=i[s.from],c=r(t,u),f=u;if(s.to-s.from<2){let i=h/2;l.beginPath();let e={_t:u._t-i,ut:u.ut},s={_t:u._t+i,ut:u.ut};l.moveTo(e._t*o,e.ut*a),l.lineTo(s._t*o,s.ut*a),n(t,c,e,s)}else{let h=(i,e)=>{n(t,c,f,e),l.beginPath(),c=i,f=e},d=f;l.beginPath(),l.moveTo(u._t*o,u.ut*a);for(let n=s.from+1;n<s.to;++n){let s=r(t,d=i[n]);switch(e){case 0:l.lineTo(d._t*o,d.ut*a);break;case 1:l.lineTo(d._t*o,i[n-1].ut*a),s!==c&&(h(s,d),l.lineTo(d._t*o,i[n-1].ut*a)),l.lineTo(d._t*o,d.ut*a);break;case 2:{let[t,e]=function(t,i,e){var s,h;let r=Math.max(0,i-1),n=Math.min(t.length-1,e+1);return[(s=t[i],h=sf(sc(t[e],t[r]),6),{_t:s._t+h._t,ut:s.ut+h.ut}),sc(t[e],sf(sc(t[n],t[i]),6))]}(i,n-1,n);l.bezierCurveTo(t._t*o,t.ut*a,e._t*o,e.ut*a,d._t*o,d.ut*a)}}1!==e&&s!==c&&(h(s,d),l.moveTo(d._t*o,d.ut*a))}(f!==d||f===d&&1===e)&&n(t,c,f,d)}}function sc(t,i){return{_t:t._t-i._t,ut:t.ut-i.ut}}function sf(t,i){return{_t:t._t/i,ut:t.ut/i}}function sd(t,i){let e=t.context;e.strokeStyle=i,e.stroke()}class sp extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et(t){if(null===this.rt)return;let{ot:i,lt:e,Tg:s,Rg:h,ct:r,Kt:n,Dg:l}=this.rt;if(null===e)return;let o=t.context;o.lineCap="butt",o.lineWidth=r*t.verticalPixelRatio,j(o,n),o.lineJoin="round";let a=this.Vg.bind(this);void 0!==h&&su(t,i,h,e,s,a,sd),l&&function(t,i,e,s,h){if(s.to-s.from<=0)return;let{horizontalPixelRatio:r,verticalPixelRatio:n,context:l}=t,o=null,a=Math.max(1,Math.floor(r))%2/2,u=e*n+a;for(let e=s.to-1;e>=s.from;--e){let s=i[e];if(s){let i=h(t,s);i!==o&&(l.beginPath(),null!==o&&l.fill(),l.fillStyle=i,o=i);let e=Math.round(s._t*r)+a,c=s.ut*n;l.moveTo(e,c),l.arc(e,c,u,0,2*Math.PI)}}l.fill()}(t,i,l,e,a)}}class sm extends sp{Vg(t,i){return i.vt}}class sg extends sa{constructor(){super(...arguments),this.Ww=new sm}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t=this.Jn.N(),i={ot:this.zw,Kt:t.lineStyle,Rg:t.lineVisible?t.lineType:void 0,ct:t.lineWidth,Dg:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,lt:this.Lw,Tg:this.Qn.At().Q_()};this.Ww.ht(i)}}function sv(t,i,e,s,h){let{context:r,horizontalPixelRatio:n,verticalPixelRatio:l}=i;r.lineTo(h._t*n,t*l),r.lineTo(s._t*n,t*l),r.closePath(),r.fillStyle=e,r.fill()}class sb extends ti{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et(t){if(null===this.rt)return;let{ot:i,lt:e,Tg:s,ct:h,Kt:r,Rg:n}=this.rt,l=this.rt.Og??(this.rt.Ng?0:t.mediaSize.height);if(null===e)return;let o=t.context;o.lineCap="butt",o.lineJoin="round",o.lineWidth=h,j(o,r),o.lineWidth=1,su(t,i,n,e,s,this.Wg.bind(this),sv.bind(null,l))}}class sy{Fg(t,i){let e=this.Hg,{Ug:s,$g:h,qg:r,Yg:n,Og:l,jg:o,Zg:a}=i;if(void 0===this.Kg||void 0===e||e.Ug!==s||e.$g!==h||e.qg!==r||e.Yg!==n||e.Og!==l||e.jg!==o||e.Zg!==a){let{verticalPixelRatio:e}=t,u=l||o>0?e:1,c=o*u,f=a===t.bitmapSize.height?a:a*u,d=t.context.createLinearGradient(0,c,0,f);if(d.addColorStop(0,s),null!=l){let t=iw(((l??0)*u-c)/(f-c),0,1);d.addColorStop(t,h),d.addColorStop(t,r)}d.addColorStop(1,n),this.Kg=d,this.Hg=i}return this.Kg}}class sw extends sb{constructor(){super(...arguments),this.Xg=new sy}Wg(t,i){let e=this.rt;return this.Xg.Fg(t,{Ug:i.br,$g:i.Sr,qg:i.Cr,Yg:i.yr,Og:e.Og,jg:e.jg??0,Zg:e.Zg??t.bitmapSize.height})}}class sM extends sp{constructor(){super(...arguments),this.Gg=new sy}Vg(t,i){let e=this.rt;return this.Gg.Fg(t,{Ug:i.gr,$g:i.gr,qg:i.Mr,Yg:i.Mr,Og:e.Og,jg:e.jg??0,Zg:e.Zg??t.bitmapSize.height})}}class s_ extends sa{constructor(t,i){super(t,i),this.Ww=new tt,this.Jg=new sw,this.Qg=new sM,this.Ww.st([this.Jg,this.Qg])}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t,i;let e=this.Jn.zt();if(null===e)return;let s=this.Jn.N(),h=this.Jn.Wt().Nt(s.baseValue.price,e.Ft),r=this.Qn.At().Q_();if(null!==this.Lw&&0!==this.zw.length){if(s.relativeGradient){t=this.zw[this.Lw.from].ut,i=this.zw[this.Lw.from].ut;for(let e=this.Lw.from;e<this.Lw.to;e++){let s=this.zw[e];s.ut<t&&(t=s.ut),s.ut>i&&(i=s.ut)}}this.Jg.ht({ot:this.zw,ct:s.lineWidth,Kt:s.lineStyle,Rg:s.lineType,Og:h,jg:t,Zg:i,Ng:!1,lt:this.Lw,Tg:r}),this.Qg.ht({ot:this.zw,ct:s.lineWidth,Kt:s.lineStyle,Rg:s.lineVisible?s.lineType:void 0,Dg:s.pointMarkersVisible?s.pointMarkersRadius||s.lineWidth/2+2:void 0,Og:h,jg:t,Zg:i,lt:this.Lw,Tg:r})}}}class sS extends sb{constructor(){super(...arguments),this.Xg=new sy}Wg(t,i){return this.Xg.Fg(t,{Ug:i.mr,$g:"",qg:"",Yg:i.wr,jg:this.rt?.jg??0,Zg:t.bitmapSize.height})}}class sx extends sa{constructor(t,i){super(t,i),this.Ww=new tt,this.tM=new sS,this.iM=new sm,this.Ww.st([this.tM,this.iM])}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t;let i=this.Jn.N();if(null!==this.Lw&&0!==this.zw.length){if(i.relativeGradient){t=this.zw[this.Lw.from].ut;for(let i=this.Lw.from;i<this.Lw.to;i++){let e=this.zw[i];e.ut<t&&(t=e.ut)}}this.tM.ht({Rg:i.lineType,ot:this.zw,Kt:i.lineStyle,ct:i.lineWidth,Og:null,jg:t,Ng:i.invertFilledArea,lt:this.Lw,Tg:this.Qn.At().Q_()}),this.iM.ht({Rg:i.lineVisible?i.lineType:void 0,ot:this.zw,Kt:i.lineStyle,ct:i.lineWidth,lt:this.Lw,Tg:this.Qn.At().Q_(),Dg:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0})}}}class sP extends ti{constructor(){super(...arguments),this.Yt=null,this.sM=0,this.nM=0}ht(t){this.Yt=t}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.Yt||0===this.Yt.Ks.length||null===this.Yt.lt)return;this.sM=this.eM(i),this.sM>=2&&Math.max(1,Math.floor(i))%2!=this.sM%2&&this.sM--,this.nM=this.Yt.rM?Math.min(this.sM,Math.floor(i)):this.sM;let s=null,h=this.nM<=this.sM&&this.Yt.Q_>=Math.floor(1.5*i);for(let r=this.Yt.lt.from;r<this.Yt.lt.to;++r){let n=this.Yt.Ks[r];s!==n.cr&&(t.fillStyle=n.cr,s=n.cr);let l=Math.floor(.5*this.nM),o=Math.round(n._t*i),a=o-l,u=this.nM,c=a+u-1,f=Math.min(n.Al,n.El),d=Math.max(n.Al,n.El),p=Math.round(f*e)-l,m=Math.max(Math.round(d*e)+l-p,this.nM);t.fillRect(a,p,u,m);let g=Math.ceil(1.5*this.sM);if(h){if(this.Yt.hM){let i=o-g,s=Math.max(p,Math.round(n.Bl*e)-l),h=s+u-1;h>p+m-1&&(s=(h=p+m-1)-u+1),t.fillRect(i,s,a-i,h-s+1)}let i=o+g,s=Math.max(p,Math.round(n.zl*e)-l),h=s+u-1;h>p+m-1&&(s=(h=p+m-1)-u+1),t.fillRect(c+1,s,i-c,h-s+1)}}}eM(t){return Math.max(Math.floor(t),Math.floor(Math.floor(.3*V(this.Yt).Q_*t)))}}class sO extends eA{constructor(t,i){super(t,i,!1)}qw(t,i,e){i.j_(this.zw,U(this.Lw)),t.Il(this.zw,e,U(this.Lw))}aM(t,i,e){return{wt:t,qh:i.Ft[0],Yh:i.Ft[1],jh:i.Ft[2],Zh:i.Ft[3],_t:NaN,Bl:NaN,Al:NaN,El:NaN,zl:NaN}}Uw(){let t=this.Jn.Rh();this.zw=this.Jn.Ks().Hr().map(i=>this.kg(i.Re,i,t))}}class sC extends sO{constructor(){super(...arguments),this.Ww=new sP}kg(t,i,e){return{...this.aM(t,i,e),...e.Dr(t)}}Yw(){let t=this.Jn.N();this.Ww.ht({Ks:this.zw,Q_:this.Qn.At().Q_(),hM:t.openVisible,rM:t.thinBars,lt:this.Lw})}}class sR extends ti{constructor(){super(...arguments),this.Yt=null,this.sM=0}ht(t){this.Yt=t}et(t){if(null===this.Yt||0===this.Yt.Ks.length||null===this.Yt.lt)return;let{horizontalPixelRatio:i}=t;this.sM=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);let e=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.min(Math.floor(t*e*i),Math.floor(t*i));return Math.max(Math.floor(i),s)}(this.Yt.Q_,i),this.sM>=2&&Math.floor(i)%2!=this.sM%2&&this.sM--;let e=this.Yt.Ks;this.Yt.lM&&this.oM(t,e,this.Yt.lt),this.Yt.Mi&&this.$p(t,e,this.Yt.lt);let s=this._M(i);(!this.Yt.Mi||this.sM>2*s)&&this.uM(t,e,this.Yt.lt)}oM(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=Math.min(Math.floor(h),Math.floor(this.Yt.Q_*h)),o=Math.floor(.5*(l=Math.max(Math.floor(h),Math.min(l,this.sM)))),a=null;for(let t=e.from;t<e.to;t++){let e=i[t];e.pr!==n&&(s.fillStyle=e.pr,n=e.pr);let u=Math.round(Math.min(e.Bl,e.zl)*r),c=Math.round(Math.max(e.Bl,e.zl)*r),f=Math.round(e.Al*r),d=Math.round(e.El*r),p=Math.round(h*e._t)-o,m=p+l-1;null!==a&&(p=Math.min(p=Math.max(a+1,p),m));let g=m-p+1;s.fillRect(p,f,g,u-f),s.fillRect(p,c+1,g,d-c),a=m}}_M(t){let i=Math.floor(+t);this.sM<=2*i&&(i=Math.floor(.5*(this.sM-1)));let e=Math.max(Math.floor(t),i);return this.sM<=2*e?Math.max(Math.floor(t),Math.floor(+t)):e}$p(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=this._M(h),o=null;for(let t=e.from;t<e.to;t++){let e=i[t];e.dr!==n&&(s.fillStyle=e.dr,n=e.dr);let f=Math.round(e._t*h)-Math.floor(.5*this.sM),d=f+this.sM-1,p=Math.round(Math.min(e.Bl,e.zl)*r),m=Math.round(Math.max(e.Bl,e.zl)*r);if(null!==o&&(f=Math.min(f=Math.max(o+1,f),d)),this.Yt.Q_*h>2*l){var a,u,c;a=f,u=d-f+1,c=m-p+1,s.fillRect(a+l,p,u-2*l,l),s.fillRect(a+l,p+c-l,u-2*l,l),s.fillRect(a,p,l,c),s.fillRect(a+u-l,p,l,c)}else{let t=d-f+1;s.fillRect(f,p,t,m-p+1)}o=d}}uM(t,i,e){if(null===this.Yt)return;let{context:s,horizontalPixelRatio:h,verticalPixelRatio:r}=t,n="",l=this._M(h);for(let t=e.from;t<e.to;t++){let e=i[t],o=Math.round(Math.min(e.Bl,e.zl)*r),a=Math.round(Math.max(e.Bl,e.zl)*r),u=Math.round(e._t*h)-Math.floor(.5*this.sM),c=u+this.sM-1;if(e.cr!==n){let t=e.cr;s.fillStyle=t,n=t}this.Yt.Mi&&(u+=l,o+=l,c-=l,a-=l),o>a||s.fillRect(u,o,c-u+1,a-o+1)}}}class sk extends sO{constructor(){super(...arguments),this.Ww=new sR}kg(t,i,e){return{...this.aM(t,i,e),...e.Dr(t)}}Yw(){let t=this.Jn.N();this.Ww.ht({Ks:this.zw,Q_:this.Qn.At().Q_(),lM:t.wickVisible,Mi:t.borderVisible,lt:this.Lw})}}class sz extends ti{constructor(){super(...arguments),this.Yt=null,this.cM=[]}ht(t){this.Yt=t,this.cM=[]}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null===this.Yt||0===this.Yt.ot.length||null===this.Yt.lt)return;this.cM.length||this.dM(i);let s=Math.max(1,Math.floor(e)),h=Math.round(this.Yt.fM*e)-Math.floor(s/2),r=h+s;for(let i=this.Yt.lt.from;i<this.Yt.lt.to;i++){let n,l;let o=this.Yt.ot[i],a=this.cM[i-this.Yt.lt.from],u=Math.round(o.ut*e);t.fillStyle=o.cr,u<=h?(n=u,l=r):(n=h,l=u-Math.floor(s/2)+s),t.fillRect(a.Uh,n,a.bi-a.Uh+1,l-n)}}dM(t){if(null===this.Yt||0===this.Yt.ot.length||null===this.Yt.lt)return void(this.cM=[]);let i=1>=Math.ceil(this.Yt.Q_*t)?0:Math.max(1,Math.floor(t)),e=Math.round(this.Yt.Q_*t)-i;this.cM=Array(this.Yt.lt.to-this.Yt.lt.from);for(let i=this.Yt.lt.from;i<this.Yt.lt.to;i++){let s,h;let r=this.Yt.ot[i],n=Math.round(r._t*t);if(e%2){let t=(e-1)/2;s=n-t,h=n+t}else{let t=e/2;s=n-t,h=n+t-1}this.cM[i-this.Yt.lt.from]={Uh:s,bi:h,pM:n,ne:r._t*t,wt:r.wt}}for(let t=this.Yt.lt.from+1;t<this.Yt.lt.to;t++){let e=this.cM[t-this.Yt.lt.from],s=this.cM[t-this.Yt.lt.from-1];e.wt===s.wt+1&&e.Uh-s.bi!==i+1&&(s.pM>s.ne?s.bi=e.Uh-i-1:e.Uh=s.bi+i+1)}let s=Math.ceil(this.Yt.Q_*t);for(let t=this.Yt.lt.from;t<this.Yt.lt.to;t++){let i=this.cM[t-this.Yt.lt.from];i.bi<i.Uh&&(i.bi=i.Uh),s=Math.min(i.bi-i.Uh+1,s)}if(i>0&&s<4)for(let t=this.Yt.lt.from;t<this.Yt.lt.to;t++){let i=this.cM[t-this.Yt.lt.from];i.bi-i.Uh+1>s&&(i.pM>i.ne?i.bi-=1:i.Uh+=1)}}}class sY extends sa{constructor(){super(...arguments),this.Ww=new sz}kg(t,i,e){return{...this.Pg(t,i),...e.Dr(t)}}Yw(){let t={ot:this.zw,Q_:this.Qn.At().Q_(),lt:this.Lw,fM:this.Jn.Wt().Nt(this.Jn.N().base,V(this.Jn.zt()).Ft)};this.Ww.ht(t)}}class sE{constructor(t,i){this.Jn=t,this.ah=i,this.mM()}detach(){this.Jn.detachPrimitive(this.ah)}getSeries(){return this.Jn}applyOptions(t){this.ah&&this.ah.hr&&this.ah.hr(t)}mM(){this.Jn.attachPrimitive(this.ah)}}function sj(t,i){return iM(Math.min(Math.max(t,12),30)*i)}function sT(t,i){switch(t){case"arrowDown":case"arrowUp":return sj(i,1);case"circle":return sj(i,.8);case"square":return sj(i,.7)}}function sL(t){return function(t){let i=Math.ceil(t);return i%2!=0?i-1:i}(sj(t,1))}function sN(t){return Math.max(sj(t,.1),3)}function sV(t,i,e){return i?t:e?Math.ceil(t/2):0}function sD(t,i,e,s){let h=(sT("arrowUp",s)-1)/2*e.WM,r=(iM(s/2)-1)/2*e.WM;i.beginPath(),t?(i.moveTo(e._t-h,e.ut),i.lineTo(e._t,e.ut-h),i.lineTo(e._t+h,e.ut),i.lineTo(e._t+r,e.ut),i.lineTo(e._t+r,e.ut+h),i.lineTo(e._t-r,e.ut+h)):(i.moveTo(e._t-h,e.ut),i.lineTo(e._t,e.ut+h),i.lineTo(e._t+h,e.ut),i.lineTo(e._t+r,e.ut),i.lineTo(e._t+r,e.ut-h),i.lineTo(e._t-r,e.ut-h)),i.lineTo(e._t-r,e.ut),i.fill()}function sB(t,i,e,s,h,r){let n=(sT("arrowUp",s)-1)/2,l=(iM(s/2)-1)/2;return h>=i-l-2&&h<=i+l+2&&r>=(t?e:e-n)-2&&r<=(t?e+n:e)+2||!(h<i-n-3)&&!(h>i+n+3)&&!(r<(t?e-n-3:e))&&!(r>(t?e:e+n+3))&&Math.abs(r-e)+3>=Math.abs(h-i)/2}class sW{constructor(){this.Yt=null,this.On=new tC,this.W=-1,this.F="",this.Mp=""}ht(t){this.Yt=t}Nn(t,i){this.W===t&&this.F===i||(this.W=t,this.F=i,this.Mp=G(t,i),this.On.In())}jn(t,i){if(null===this.Yt||null===this.Yt.lt)return null;for(let r=this.Yt.lt.from;r<this.Yt.lt.to;r++){var e,s,h;let n=this.Yt.ot[r];if(n&&(e=n,s=t,h=i,!(void 0===e.ri||!function(t,i,e,s,h,r){let n=s/2;return h>=t&&h<=t+e&&r>=i-n&&r<=i+n}(e.ri._t,e.ri.ut,e.ri.Qi,e.ri.$t,s,h))||function(t,i,e){if(0===t.zr)return!1;switch(t.HM){case"arrowDown":return sB(!0,t._t,t.ut,t.zr,i,e);case"arrowUp":return sB(!1,t._t,t.ut,t.zr,i,e);case"circle":return function(t,i,e,s,h){let r=2+sT("circle",e)/2,n=t-s,l=i-h;return Math.sqrt(n*n+l*l)<=r}(t._t,t.ut,t.zr,i,e);case"square":return function(t,i,e,s,h){let r=sT("square",e),n=(r-1)/2,l=t-n,o=i-n;return s>=l&&s<=l+r&&h>=o&&h<=o+r}(t._t,t.ut,t.zr,i,e)}}(e,s,h)))return{zOrder:"normal",externalId:n.Zn??""}}return null}draw(t){t.useBitmapCoordinateSpace(t=>{this.et(t)})}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:e}){if(null!==this.Yt&&null!==this.Yt.lt){t.textBaseline="middle",t.font=this.Mp;for(let s=this.Yt.lt.from;s<this.Yt.lt.to;s++){let h=this.Yt.ot[s];void 0!==h.ri&&(h.ri.Qi=this.On.Vi(t,h.ri.FM),h.ri.$t=this.W,h.ri._t=h._t-h.ri.Qi/2),function(t,i,e,s){var h,r,n;i.fillStyle=t.R,void 0!==t.ri&&(h=t.ri.FM,r=t.ri._t,n=t.ri.ut,i.save(),i.scale(e,s),i.fillText(h,r,n),i.restore()),function(t,i,e){if(0!==t.zr){switch(t.HM){case"arrowDown":return void sD(!1,i,e,t.zr);case"arrowUp":return void sD(!0,i,e,t.zr);case"circle":return void function(t,i,e){let s=(sT("circle",e)-1)/2;t.beginPath(),t.arc(i._t,i.ut,s*i.WM,0,2*Math.PI,!1),t.fill()}(i,e,t.zr);case"square":return void function(t,i,e){let s=sT("square",e),h=(s-1)*i.WM/2,r=i._t-h,n=i.ut-h;t.fillRect(r,n,s*i.WM,s*i.WM)}(i,e,t.zr)}t.HM}}(t,i,function(t,i,e){let s=Math.max(1,Math.floor(i))%2/2;return{_t:Math.round(t._t*i)+s,ut:t.ut*e,WM:i}}(t,e,s))}(h,t,i,e)}}}}function sF(t){return"atPriceTop"===t||"atPriceBottom"===t||"atPriceMiddle"===t}class sI{constructor(t,i){this.qM=[],this.St=!0,this.YM=!0,this.Gt=new sW,this.ge=t,this._p=i,this.Yt={ot:[],lt:null}}renderer(){if(!this.ge.options().visible)return null;this.St&&this.jM();let t=this._p.options().layout;return this.Gt.Nn(t.fontSize,t.fontFamily),this.Gt.ht(this.Yt),this.Gt}ZM(t){this.qM=t,this.Pt("data")}Pt(t){this.St=!0,"data"===t&&(this.YM=!0)}jM(){let t=this._p.timeScale(),i=this.qM;this.YM&&(this.Yt.ot=i.map(t=>({wt:t.time,_t:0,ut:0,zr:0,HM:t.shape,R:t.color,Zn:t.id,KM:t.KM,ri:void 0})),this.YM=!1);let e=this._p.options().layout;this.Yt.lt=null;let s=t.getVisibleLogicalRange();if(null===s)return;let h=new ij(Math.floor(s.from),Math.ceil(s.to));if(null===this.ge.data()[0]||0===this.Yt.ot.length)return;let r=NaN,n=sN(t.options().barSpacing),l={UM:n,$M:n};this.Yt.lt=eQ(this.Yt.ot,h,!0);for(let s=this.Yt.lt.from;s<this.Yt.lt.to;s++){let h=i[s];h.time!==r&&(l.UM=n,l.$M=n,r=h.time);let o=this.Yt.ot[s];o._t=V(t.logicalToCoordinate(h.time)),void 0!==h.text&&h.text.length>0&&(o.ri={FM:h.text,_t:0,ut:0,Qi:0,$t:0});let a=this.ge.dataByIndex(h.time,0);null!==a&&function(t,i,e,s,h,r,n,l){let o=function(t,i){if(sF(i.position)&&void 0!==i.price)return i.price;if("value"in t&&"number"==typeof t.value)return t.value;if("open"in t&&"high"in t&&"low"in t&&"close"in t){if("inBar"===i.position)return t.close;if("aboveBar"===i.position)return t.high;if("belowBar"===i.position)return t.low}}(e,i);if(void 0===o)return;let a=sF(i.position),u=l.timeScale(),c=F(i.size)?Math.max(i.size,0):1,f=sL(u.options().barSpacing)*c,d=f/2;switch(t.zr=f,i.position){case"inBar":case"atPriceMiddle":return t.ut=V(n.priceToCoordinate(o)),void(void 0!==t.ri&&(t.ri.ut=t.ut+d+r+.6*h));case"aboveBar":case"atPriceTop":{let i=a?0:s.UM;return t.ut=V(n.priceToCoordinate(o))-d-i,void 0!==t.ri&&(t.ri.ut=t.ut-d-.6*h,s.UM+=1.2*h),void(a||(s.UM+=f+r))}case"belowBar":case"atPriceBottom":{let i=a?0:s.$M;return t.ut=V(n.priceToCoordinate(o))+d+i,void 0!==t.ri&&(t.ri.ut=t.ut+d+r+.6*h,s.$M+=1.2*h),void(a||(s.$M+=f+r))}}}(o,h,a,l,e.fontSize,n,this.ge,this._p)}this.St=!1}}class sQ{constructor(){this.sh=null,this.qM=[],this.XM=[],this.GM=null,this.ge=null,this._p=null,this.JM=!0,this.QM=null,this.tb=null,this.ib=null,this.sb=!0}attached(t){this.nb(),this._p=t.chart,this.ge=t.series,this.sh=new sI(this.ge,V(this._p)),this.OM=t.requestUpdate,this.ge.subscribeDataChanged(t=>this.rg(t)),this.sb=!0,this.SM()}SM(){this.OM&&this.OM()}detached(){this.ge&&this.GM&&this.ge.unsubscribeDataChanged(this.GM),this._p=null,this.ge=null,this.sh=null,this.GM=null}ZM(t){this.sb=!0,this.qM=t,this.nb(),this.JM=!0,this.tb=null,this.SM()}eb(){return this.qM}paneViews(){return this.sh?[this.sh]:[]}updateAllViews(){this.rb()}hitTest(t,i){return this.sh?this.sh.renderer()?.jn(t,i)??null:null}autoscaleInfo(t,i){if(this.sh){let t=this.hb();if(t)return{priceRange:null,margins:t}}return null}hb(){let t=V(this._p).timeScale().options().barSpacing;if(this.JM||t!==this.ib){if(this.ib=t,this.qM.length>0){let i=sN(t),e=1.5*sL(t)+2*i,s=this.ab();this.QM={above:sV(e,s.aboveBar,s.inBar),below:sV(e,s.belowBar,s.inBar)}}else this.QM=null;this.JM=!1}return this.QM}ab(){return null===this.tb&&(this.tb=this.qM.reduce((t,i)=>(t[i.position]||(t[i.position]=!0),t),{inBar:!1,aboveBar:!1,belowBar:!1,atPriceTop:!1,atPriceBottom:!1,atPriceMiddle:!1})),this.tb}nb(){if(!this.sb||!this._p||!this.ge)return;let t=this._p.timeScale(),i=this.ge?.data();if(null==t.getVisibleLogicalRange()||!this.ge||0===i.length)return void(this.XM=[]);let e=t.timeToIndex(V(i[0].time),!0);this.XM=this.qM.map((i,s)=>{let h=t.timeToIndex(i.time,!0),r=V(this.ge).dataByIndex(h,h<e?1:-1),n={time:t.timeToIndex(V(r).time,!1),position:i.position,shape:i.shape,color:i.color,id:i.id,KM:s,text:i.text,size:i.size,price:i.price,ew:i.time};if(("atPriceTop"===i.position||"atPriceBottom"===i.position||"atPriceMiddle"===i.position)&&void 0===i.price)throw Error(`Price is required for position ${i.position}`);return{...n,position:i.position,price:i.price}}),this.sb=!1}rb(t){this.sh&&(this.nb(),this.sh.ZM(this.XM),this.sh.Pt(t))}rg(t){this.sb=!0,this.SM()}}class sA extends sE{constructor(t,i,e){super(t,i),e&&this.setMarkers(e)}setMarkers(t){this.ah.ZM(t)}markers(){return this.ah.eb()}}function sJ(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}({...E});var s$=function(t){var i=t.container,e=sJ(t,["container"]),s=e.onClick,h=e.onCrosshairMove,r=e.onInit,n=sJ(e,["onClick","onCrosshairMove","onInit"]),l=(0,S.useRef)({_chart:null,api:function(){if(null===this._chart&&!this.destroyed)this._chart=function(t,i,e){let s=new so(function(t){if(Q(t)){let i=document.getElementById(t);return L(null!==i,`Cannot find element in DOM with id=${t}`),i}return t}(t),i,e);return i.setOptions(s.options()),s}(i,new i0,i0.Wc(n)),r&&r(this._chart);return this._chart},clear:function(){null!==this._chart&&(this._chart.remove(),this._chart=null,this.destroyed=!0)},destroyed:!1});return(0,S.useLayoutEffect)(function(){return l.current.api(),function(){l.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(i){if(s){var t;null===(t=l.current.api())||void 0===t||t.subscribeClick(s)}return function(){if(s){var t;null===(t=l.current.api())||void 0===t||t.unsubscribeClick(s)}}}},[s]),(0,S.useLayoutEffect)(function(){if(i){if(h){var t;null===(t=l.current.api())||void 0===t||t.subscribeCrosshairMove(h)}return function(){if(h){var t;null===(t=l.current.api())||void 0===t||t.unsubscribeCrosshairMove(h)}}}},[h]),(0,S.useLayoutEffect)(function(){var t;i&&(null===(t=l.current.api())||void 0===t||t.applyOptions(n))},[n]),l},sU=function(t){var i=t.children,e=s$(function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({container:t.container},function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children","container"])));return(0,_.jsx)(x.Provider,{value:e.current,children:i})};function sZ(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);e<i;e++)s[e]=t[e];return s}var sG=(0,S.forwardRef)(function(t,i){var e,s,h,r=t.children,n=t.className,l=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children","className"]),o=function(t){if(Array.isArray(t))return t}(e=(0,S.useState)())||function(t,i){var e,s,h=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=h){var r=[],n=!0,l=!1;try{for(h=h.call(t);!(n=(e=h.next()).done)&&(r.push(e.value),r.length!==i);n=!0);}catch(t){l=!0,s=t}finally{try{n||null==h.return||h.return()}finally{if(l)throw s}}return r}}(e,2)||function(t,i){if(t){if("string"==typeof t)return sZ(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return sZ(t,i)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=o[0],u=o[1],c=(0,S.useCallback)(function(t){u(t),i&&("function"==typeof i?c(t):i.current=t)},[i]);return(0,_.jsx)("div",{ref:c,className:n,children:!!a&&(0,_.jsx)(sU,(s=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({container:a},l),h=h={children:r},Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(h)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(h)).forEach(function(t){Object.defineProperty(s,t,Object.getOwnPropertyDescriptor(h,t))}),s))})});sG.displayName="ChartWrapper";var sK=sG,sX=function(t){var i=(0,S.useContext)(t);if(!i){var e=t.name;throw Error("".concat(e," not found. You can access context value only inside its Provider."))}return i},sH=function(t){var i=t.onVisibleTimeRangeChange,e=t.onVisibleLogicalRangeChange,s=t.onSizeChange,h=t.visibleRange,r=t.visibleLogicalRange,n=t.options,l=void 0===n?{}:n,o=sX(x);if(!o)throw Error("Chart context not found");var a=(0,S.useRef)({_timeScale:null,api:function(){if(!this._timeScale){var t=o.api();if(!t)return null;this._timeScale=t.timeScale(),this._timeScale.applyOptions(l),h&&this._timeScale.setVisibleRange(h),r&&this._timeScale.setVisibleLogicalRange(r)}return this._timeScale},clear:function(){null!==this._timeScale&&(this._timeScale=null)}});return(0,S.useLayoutEffect)(function(){return a.current.api(),function(){a.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(o&&l){var t,i;null===(i=a.current)||void 0===i||null===(t=i.api())||void 0===t||t.applyOptions(l)}},[l]),(0,S.useLayoutEffect)(function(){if(o){if(s){var t,i;null===(i=a.current)||void 0===i||null===(t=i.api())||void 0===t||t.subscribeSizeChange(s)}return function(){if(s){var t,i;null===(i=a.current)||void 0===i||null===(t=i.api())||void 0===t||t.unsubscribeSizeChange(s)}}}},[s]),(0,S.useLayoutEffect)(function(){if(o){if(e){var t,i;null===(i=a.current)||void 0===i||null===(t=i.api())||void 0===t||t.subscribeVisibleLogicalRangeChange(e)}return function(){if(e){var t,i;null===(i=a.current)||void 0===i||null===(t=i.api())||void 0===t||t.unsubscribeVisibleLogicalRangeChange(e)}}}},[e]),(0,S.useLayoutEffect)(function(){if(o){if(i){var t,e;null===(e=a.current)||void 0===e||null===(t=e.api())||void 0===t||t.subscribeVisibleTimeRangeChange(i)}return function(){if(i){var t,e;null===(e=a.current)||void 0===e||null===(t=e.api())||void 0===t||t.unsubscribeVisibleTimeRangeChange(i)}}}},[i]),(0,S.useLayoutEffect)(function(){if(o&&h){var t,i;null===(i=a.current)||void 0===i||null===(t=i.api())||void 0===t||t.setVisibleRange(h)}},[h]),(0,S.useLayoutEffect)(function(){if(o&&r){var t,i;null===(i=a.current)||void 0===i||null===(t=i.api())||void 0===t||t.setVisibleLogicalRange(r)}},[r]),a},sq=(0,S.forwardRef)(function(t,i){var e=sH(t);return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null});sq.displayName="TimeScale";var s0=sq,s1=function(t){var i=t.options,e=void 0===i?{}:i,s=t.id,h=sX(x),r=(0,S.useRef)({_priceScale:null,api:function(){if(!this._priceScale){var t=h.api();if(!t)return null;this._priceScale=t.priceScale(s),this._priceScale.applyOptions(function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({},e))}return this._priceScale},setId:function(t){null!==this._priceScale&&(this._priceScale=h.api().priceScale(t))},clear:function(){null!==this._priceScale&&(this._priceScale=null)}});return(0,S.useLayoutEffect)(function(){return r.current.api(),function(){r.current.clear()}},[]),(0,S.useLayoutEffect)(function(){var t;h&&(null===(t=r.current)||void 0===t||t.setId(s))},[s]),(0,S.useLayoutEffect)(function(){if(h&&e){var t,i;null===(i=r.current)||void 0===i||null===(t=i.api())||void 0===t||t.applyOptions(e)}},[e]),r},s2=(0,S.forwardRef)(function(t,i){var e=s1(t);return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null});s2.displayName="PriceScale";var s3=s2,s5={i8:"0.1.0"};function s6(t,i,e){return(s6=ht()?Reflect.construct:function(t,i,e){var s=[null];s.push.apply(s,i);var h=new(Function.bind.apply(t,s));return e&&s8(h,e.prototype),h}).apply(null,arguments)}function s4(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function s9(t){return(s9=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s8(t,i){return(s8=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,i)}function s7(t){var i="function"==typeof Map?new Map:void 0;return(s7=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(t))return i.get(t);i.set(t,e)}function e(){return s6(t,arguments,s9(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s8(e,t)})(t)}function ht(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ht=function(){return!!t})()}var hi=function(t){function i(t){var e,s,h,r,n,l,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=a.isOperational,c=a.cause,f=a.docsPath;return function(t,i){if(!(t instanceof i))throw TypeError("Cannot call a class as a function")}(this,i),r=i,n=[t],r=s9(r),s4((e=this,l=(s=ht()?Reflect.construct(r,n||[],s9(this).constructor):r.apply(this,n))&&("object"==((h=s)&&"undefined"!=typeof Symbol&&h.constructor===Symbol?"symbol":typeof h)||"function"==typeof s)?s:function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e)),"isOperational",void 0),s4(l,"cause",void 0),l.name=null!==(o=l.constructor.name)&&void 0!==o?o:"InternalError",l.isOperational=void 0===u||u,l.cause=c,l.message="".concat(null!=t?t:"An error occurred"),f&&(l.message="".concat(l.message,"\n Docs: see ").concat("https://tradingview.github.io/lightweight-charts/docs/4.2"+f)),s5.i8&&(l.message="".concat(l.message,"\n Version: lightweight-charts-react-components/").concat(s5.i8)),Object.setPrototypeOf(l,i.prototype),l}return function(t,i){if("function"!=typeof i&&null!==i)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&s8(t,i)}(i,t),i}(s7(Error)),he=function(t){var i=t.type,e=t.data,s=t.options,h=void 0===s?{}:s,r=t.reactive,n=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["type","data","options","reactive"]),l=sX(x),o=(0,S.useRef)({_series:null,api:function(){if(!this._series&&!this.destroyed){var t,s=l.api();if(!s)return null;if("Custom"===i){var r=n.plugin;if(!r)throw new hi("Custom series requires a plugin to be defined");this._series=s.addCustomSeries(r,h)}else this._series=s.addSeries(hs[i],h);null===(t=this._series)||void 0===t||t.setData(e)}return this._series},clear:function(){if(null!==this._series){var t;null===(t=l.api())||void 0===t||t.removeSeries(this._series),this._series=null,this.destroyed=!0}},destroyed:!1});return(0,S.useLayoutEffect)(function(){return o.current.api(),function(){o.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(l&&e&&r){var t;null===(t=o.current.api())||void 0===t||t.setData(e)}},[e,r]),(0,S.useLayoutEffect)(function(){if(l&&h){var t;null===(t=o.current.api())||void 0===t||t.applyOptions(h)}},[h]),o},hs={Line:{type:"Line",isBuiltIn:!0,defaultOptions:{color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new sg(t,i)},Candlestick:{type:"Candlestick",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Mg:(t,i)=>new sk(t,i)},Histogram:{type:"Histogram",isBuiltIn:!0,defaultOptions:{color:"#26a69a",base:0},Mg:(t,i)=>new sY(t,i)},Area:{type:"Area",isBuiltIn:!0,defaultOptions:{topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,relativeGradient:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new sx(t,i)},Baseline:{type:"Baseline",isBuiltIn:!0,defaultOptions:{baseValue:{type:"price",price:0},relativeGradient:!1,topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Mg:(t,i)=>new s_(t,i)},Bar:{type:"Bar",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Mg:(t,i)=>new sC(t,i)}},hh=(0,S.createContext)({});hh.displayName="SeriesContext";var hr=(0,S.forwardRef)(function(t,i){var e=t.children,s=he(function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]));return(0,S.useImperativeHandle)(i,function(){return s.current},[s]),(0,_.jsx)(hh.Provider,{value:s.current,children:e})});hr.displayName="SeriesTemplate";var hn=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hr,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Line",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hn.displayName="LineSeries";var hl=hn,ho=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hr,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Histogram",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});ho.displayName="HistogramSeries";var ha=ho,hu=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hr,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Candlestick",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hu.displayName="CandlestickSeries";var hc=hu,hf=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hr,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Area",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hf.displayName="AreaSeries";var hd=hf,hp=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hr,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Baseline",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hp.displayName="BaselineSeries";var hm=hp,hg=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hr,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Bar",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hg.displayName="BarSeries";var hv=hg,hb=(0,S.forwardRef)(function(t,i){var e,s,h=t.children,r=function(t,i){if(null==t)return{};var e,s,h=function(t,i){if(null==t)return{};var e,s,h={},r=Object.keys(t);for(s=0;s<r.length;s++)e=r[s],i.indexOf(e)>=0||(h[e]=t[e]);return h}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s<r.length;s++)e=r[s],!(i.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(h[e]=t[e])}return h}(t,["children"]);return(0,_.jsx)(hr,(e=function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({type:"Custom",ref:i},r),s=s={children:h},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):(function(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e})(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}),e))});hb.displayName="CustomSeries";var hy=hb,hw=function(t){var i=t.options,e=t.price,s=sX(hh),h=(0,S.useRef)({_priceLine:null,api:function(){if(!this._priceLine){var t=s.api();if(!t)return null;this._priceLine=t.createPriceLine(function(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.forEach(function(i){var s;s=e[i],i in t?Object.defineProperty(t,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[i]=s})}return t}({price:e},i))}return this._priceLine},clear:function(){if(null!==this._priceLine){var t;null===(t=s.api())||void 0===t||t.removePriceLine(this._priceLine),this._priceLine=null}}});return(0,S.useLayoutEffect)(function(){return h.current.api(),function(){h.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(s&&i){var t;null===(t=h.current.api())||void 0===t||t.applyOptions(i)}},[i]),h},hM=(0,S.forwardRef)(function(t,i){var e=hw(t);return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null});hM.displayName="PriceLine";var h_=hM,hS=function(t){var i=t.reactive,e=t.markers,s=sX(hh),h=(0,S.useRef)({_markers:null,api:function(){if(!this._markers&&!this.destroyed){var t=s.api();if(!t)return null;this._markers=function(t,i){let e=new sA(t,new sQ);return i&&e.setMarkers(i),e}(t,[])}return this._markers},clear:function(){null!==this._markers&&(this._markers.detach(),this._markers=null,this.destroyed=!0)},destroyed:!1});return(0,S.useLayoutEffect)(function(){return h.current.api(),function(){h.current.clear()}},[]),(0,S.useLayoutEffect)(function(){if(s&&e&&i){var t;null===(t=h.current.api())||void 0===t||t.setMarkers(e)}},[e,i]),h};function hx(){return(hx=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t}).apply(this,arguments)}var hP=(0,S.forwardRef)(function(t,i){var e=hS(hx({},function(t){if(null==t)throw TypeError("Cannot destructure "+t);return t}(t)));return(0,S.useImperativeHandle)(i,function(){return e.current},[e]),null});hP.displayName="Markers";var hO=hP}(),h}()});
13
+ //# sourceMappingURL=lightweight-charts-react-components.standalone.js.map