lightweight-charts-react-components 0.0.1

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.
@@ -0,0 +1,2389 @@
1
+
2
+ /**!
3
+ * lightweight-charts-react-components v0.0.1
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE.md file in the root directory of this source tree.
7
+ *
8
+ * @license MIT
9
+ */
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) {
674
+ return Object.prototype.hasOwnProperty.call(obj, prop);
675
+ };
676
+
677
+ }();
678
+ // webpack/runtime/make_namespace_object
679
+ !function() {
680
+ // define __esModule on exports
681
+ __webpack_require__.r = function(exports) {
682
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
683
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
684
+ }
685
+ Object.defineProperty(exports, '__esModule', { value: true });
686
+ };
687
+
688
+ }();
689
+ /************************************************************************/
690
+ var __webpack_exports__ = {};
691
+ // ESM COMPAT FLAG
692
+ __webpack_require__.r(__webpack_exports__);
693
+
694
+ // EXPORTS
695
+ __webpack_require__.d(__webpack_exports__, {
696
+ CandlestickSeries: function() { return /* reexport */ CandlestickSeries; },
697
+ HistogramSeries: function() { return /* reexport */ series_HistogramSeries; },
698
+ PriceLine: function() { return /* reexport */ PriceLine; },
699
+ AreaSeries: function() { return /* reexport */ series_AreaSeries; },
700
+ Chart: function() { return /* reexport */ chart_ChartWrapper; },
701
+ PriceScale: function() { return /* reexport */ PriceScale; },
702
+ TimeScale: function() { return /* reexport */ TimeScale; },
703
+ LineSeries: function() { return /* reexport */ series_LineSeries; }
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 = /*#__PURE__*/ (0,react.forwardRef)(ChartRenderFunction);
1482
+ ChartWrapper.displayName = "ChartWrapper";
1483
+ /* ESM default export */ var chart_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
+ default:
1825
+ throw new Error("Unknown series type: ".concat(type));
1826
+ }
1827
+ return series;
1828
+ };
1829
+
1830
+ ;// CONCATENATED MODULE: ./src/series/SeriesContext.ts
1831
+
1832
+ var SeriesContext = (0,react.createContext)({});
1833
+ SeriesContext.displayName = "SeriesContext";
1834
+
1835
+ ;// CONCATENATED MODULE: ./src/series/SeriesTemplate.tsx
1836
+ function SeriesTemplate_object_without_properties(source, excluded) {
1837
+ if (source == null) return {};
1838
+ var target = SeriesTemplate_object_without_properties_loose(source, excluded);
1839
+ var key, i;
1840
+ if (Object.getOwnPropertySymbols) {
1841
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1842
+ for(i = 0; i < sourceSymbolKeys.length; i++){
1843
+ key = sourceSymbolKeys[i];
1844
+ if (excluded.indexOf(key) >= 0) continue;
1845
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1846
+ target[key] = source[key];
1847
+ }
1848
+ }
1849
+ return target;
1850
+ }
1851
+ function SeriesTemplate_object_without_properties_loose(source, excluded) {
1852
+ if (source == null) return {};
1853
+ var target = {};
1854
+ var sourceKeys = Object.keys(source);
1855
+ var key, i;
1856
+ for(i = 0; i < sourceKeys.length; i++){
1857
+ key = sourceKeys[i];
1858
+ if (excluded.indexOf(key) >= 0) continue;
1859
+ target[key] = source[key];
1860
+ }
1861
+ return target;
1862
+ }
1863
+
1864
+
1865
+
1866
+
1867
+ var SeriesTemplateRenderFunction = function(_param, ref) {
1868
+ var children = _param.children, rest = SeriesTemplate_object_without_properties(_param, [
1869
+ "children"
1870
+ ]);
1871
+ var seriesApi = useInitSeries(rest);
1872
+ (0,react.useImperativeHandle)(ref, function() {
1873
+ return seriesApi.current;
1874
+ }, [
1875
+ seriesApi
1876
+ ]);
1877
+ return /*#__PURE__*/ (0,jsx_runtime.jsx)(SeriesContext.Provider, {
1878
+ value: seriesApi.current,
1879
+ children: children
1880
+ });
1881
+ };
1882
+ var SeriesTemplate = /*#__PURE__*/ (0,react.forwardRef)(SeriesTemplateRenderFunction);
1883
+ SeriesTemplate.displayName = "SeriesTemplate";
1884
+ /* ESM default export */ var series_SeriesTemplate = (SeriesTemplate);
1885
+
1886
+ ;// CONCATENATED MODULE: ./src/series/LineSeries.tsx
1887
+ function LineSeries_define_property(obj, key, value) {
1888
+ if (key in obj) {
1889
+ Object.defineProperty(obj, key, {
1890
+ value: value,
1891
+ enumerable: true,
1892
+ configurable: true,
1893
+ writable: true
1894
+ });
1895
+ } else {
1896
+ obj[key] = value;
1897
+ }
1898
+ return obj;
1899
+ }
1900
+ function LineSeries_object_spread(target) {
1901
+ for(var i = 1; i < arguments.length; i++){
1902
+ var source = arguments[i] != null ? arguments[i] : {};
1903
+ var ownKeys = Object.keys(source);
1904
+ if (typeof Object.getOwnPropertySymbols === "function") {
1905
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1906
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1907
+ }));
1908
+ }
1909
+ ownKeys.forEach(function(key) {
1910
+ LineSeries_define_property(target, key, source[key]);
1911
+ });
1912
+ }
1913
+ return target;
1914
+ }
1915
+ function LineSeries_ownKeys(object, enumerableOnly) {
1916
+ var keys = Object.keys(object);
1917
+ if (Object.getOwnPropertySymbols) {
1918
+ var symbols = Object.getOwnPropertySymbols(object);
1919
+ if (enumerableOnly) {
1920
+ symbols = symbols.filter(function(sym) {
1921
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1922
+ });
1923
+ }
1924
+ keys.push.apply(keys, symbols);
1925
+ }
1926
+ return keys;
1927
+ }
1928
+ function LineSeries_object_spread_props(target, source) {
1929
+ source = source != null ? source : {};
1930
+ if (Object.getOwnPropertyDescriptors) {
1931
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1932
+ } else {
1933
+ LineSeries_ownKeys(Object(source)).forEach(function(key) {
1934
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1935
+ });
1936
+ }
1937
+ return target;
1938
+ }
1939
+ function LineSeries_object_without_properties(source, excluded) {
1940
+ if (source == null) return {};
1941
+ var target = LineSeries_object_without_properties_loose(source, excluded);
1942
+ var key, i;
1943
+ if (Object.getOwnPropertySymbols) {
1944
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1945
+ for(i = 0; i < sourceSymbolKeys.length; i++){
1946
+ key = sourceSymbolKeys[i];
1947
+ if (excluded.indexOf(key) >= 0) continue;
1948
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1949
+ target[key] = source[key];
1950
+ }
1951
+ }
1952
+ return target;
1953
+ }
1954
+ function LineSeries_object_without_properties_loose(source, excluded) {
1955
+ if (source == null) return {};
1956
+ var target = {};
1957
+ var sourceKeys = Object.keys(source);
1958
+ var key, i;
1959
+ for(i = 0; i < sourceKeys.length; i++){
1960
+ key = sourceKeys[i];
1961
+ if (excluded.indexOf(key) >= 0) continue;
1962
+ target[key] = source[key];
1963
+ }
1964
+ return target;
1965
+ }
1966
+
1967
+
1968
+
1969
+ var LineSeriesRenderFunction = function(_param, ref) {
1970
+ var children = _param.children, rest = LineSeries_object_without_properties(_param, [
1971
+ "children"
1972
+ ]);
1973
+ return /*#__PURE__*/ (0,jsx_runtime.jsx)(series_SeriesTemplate, LineSeries_object_spread_props(LineSeries_object_spread({
1974
+ type: "Line",
1975
+ ref: ref
1976
+ }, rest), {
1977
+ children: children
1978
+ }));
1979
+ };
1980
+ var LineSeries = /*#__PURE__*/ (0,react.forwardRef)(LineSeriesRenderFunction);
1981
+ LineSeries.displayName = "LineSeries";
1982
+ /* ESM default export */ var series_LineSeries = (LineSeries);
1983
+
1984
+ ;// CONCATENATED MODULE: ./src/series/HistogramSeries.tsx
1985
+ function HistogramSeries_define_property(obj, key, value) {
1986
+ if (key in obj) {
1987
+ Object.defineProperty(obj, key, {
1988
+ value: value,
1989
+ enumerable: true,
1990
+ configurable: true,
1991
+ writable: true
1992
+ });
1993
+ } else {
1994
+ obj[key] = value;
1995
+ }
1996
+ return obj;
1997
+ }
1998
+ function HistogramSeries_object_spread(target) {
1999
+ for(var i = 1; i < arguments.length; i++){
2000
+ var source = arguments[i] != null ? arguments[i] : {};
2001
+ var ownKeys = Object.keys(source);
2002
+ if (typeof Object.getOwnPropertySymbols === "function") {
2003
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2004
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2005
+ }));
2006
+ }
2007
+ ownKeys.forEach(function(key) {
2008
+ HistogramSeries_define_property(target, key, source[key]);
2009
+ });
2010
+ }
2011
+ return target;
2012
+ }
2013
+ function HistogramSeries_ownKeys(object, enumerableOnly) {
2014
+ var keys = Object.keys(object);
2015
+ if (Object.getOwnPropertySymbols) {
2016
+ var symbols = Object.getOwnPropertySymbols(object);
2017
+ if (enumerableOnly) {
2018
+ symbols = symbols.filter(function(sym) {
2019
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2020
+ });
2021
+ }
2022
+ keys.push.apply(keys, symbols);
2023
+ }
2024
+ return keys;
2025
+ }
2026
+ function HistogramSeries_object_spread_props(target, source) {
2027
+ source = source != null ? source : {};
2028
+ if (Object.getOwnPropertyDescriptors) {
2029
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2030
+ } else {
2031
+ HistogramSeries_ownKeys(Object(source)).forEach(function(key) {
2032
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2033
+ });
2034
+ }
2035
+ return target;
2036
+ }
2037
+ function HistogramSeries_object_without_properties(source, excluded) {
2038
+ if (source == null) return {};
2039
+ var target = HistogramSeries_object_without_properties_loose(source, excluded);
2040
+ var key, i;
2041
+ if (Object.getOwnPropertySymbols) {
2042
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2043
+ for(i = 0; i < sourceSymbolKeys.length; i++){
2044
+ key = sourceSymbolKeys[i];
2045
+ if (excluded.indexOf(key) >= 0) continue;
2046
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2047
+ target[key] = source[key];
2048
+ }
2049
+ }
2050
+ return target;
2051
+ }
2052
+ function HistogramSeries_object_without_properties_loose(source, excluded) {
2053
+ if (source == null) return {};
2054
+ var target = {};
2055
+ var sourceKeys = Object.keys(source);
2056
+ var key, i;
2057
+ for(i = 0; i < sourceKeys.length; i++){
2058
+ key = sourceKeys[i];
2059
+ if (excluded.indexOf(key) >= 0) continue;
2060
+ target[key] = source[key];
2061
+ }
2062
+ return target;
2063
+ }
2064
+
2065
+
2066
+
2067
+ var HistogramSeriesRenderFunction = function(_param, ref) {
2068
+ var children = _param.children, rest = HistogramSeries_object_without_properties(_param, [
2069
+ "children"
2070
+ ]);
2071
+ return /*#__PURE__*/ (0,jsx_runtime.jsx)(series_SeriesTemplate, HistogramSeries_object_spread_props(HistogramSeries_object_spread({
2072
+ type: "Histogram",
2073
+ ref: ref
2074
+ }, rest), {
2075
+ children: children
2076
+ }));
2077
+ };
2078
+ var HistogramSeries = /*#__PURE__*/ (0,react.forwardRef)(HistogramSeriesRenderFunction);
2079
+ HistogramSeries.displayName = "HistogramSeries";
2080
+ /* ESM default export */ var series_HistogramSeries = (HistogramSeries);
2081
+
2082
+ ;// CONCATENATED MODULE: ./src/series/CandlestickSeries.tsx
2083
+ function CandlestickSeries_define_property(obj, key, value) {
2084
+ if (key in obj) {
2085
+ Object.defineProperty(obj, key, {
2086
+ value: value,
2087
+ enumerable: true,
2088
+ configurable: true,
2089
+ writable: true
2090
+ });
2091
+ } else {
2092
+ obj[key] = value;
2093
+ }
2094
+ return obj;
2095
+ }
2096
+ function CandlestickSeries_object_spread(target) {
2097
+ for(var i = 1; i < arguments.length; i++){
2098
+ var source = arguments[i] != null ? arguments[i] : {};
2099
+ var ownKeys = Object.keys(source);
2100
+ if (typeof Object.getOwnPropertySymbols === "function") {
2101
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2102
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2103
+ }));
2104
+ }
2105
+ ownKeys.forEach(function(key) {
2106
+ CandlestickSeries_define_property(target, key, source[key]);
2107
+ });
2108
+ }
2109
+ return target;
2110
+ }
2111
+ function CandlestickSeries_ownKeys(object, enumerableOnly) {
2112
+ var keys = Object.keys(object);
2113
+ if (Object.getOwnPropertySymbols) {
2114
+ var symbols = Object.getOwnPropertySymbols(object);
2115
+ if (enumerableOnly) {
2116
+ symbols = symbols.filter(function(sym) {
2117
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2118
+ });
2119
+ }
2120
+ keys.push.apply(keys, symbols);
2121
+ }
2122
+ return keys;
2123
+ }
2124
+ function CandlestickSeries_object_spread_props(target, source) {
2125
+ source = source != null ? source : {};
2126
+ if (Object.getOwnPropertyDescriptors) {
2127
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2128
+ } else {
2129
+ CandlestickSeries_ownKeys(Object(source)).forEach(function(key) {
2130
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2131
+ });
2132
+ }
2133
+ return target;
2134
+ }
2135
+ function CandlestickSeries_object_without_properties(source, excluded) {
2136
+ if (source == null) return {};
2137
+ var target = CandlestickSeries_object_without_properties_loose(source, excluded);
2138
+ var key, i;
2139
+ if (Object.getOwnPropertySymbols) {
2140
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2141
+ for(i = 0; i < sourceSymbolKeys.length; i++){
2142
+ key = sourceSymbolKeys[i];
2143
+ if (excluded.indexOf(key) >= 0) continue;
2144
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2145
+ target[key] = source[key];
2146
+ }
2147
+ }
2148
+ return target;
2149
+ }
2150
+ function CandlestickSeries_object_without_properties_loose(source, excluded) {
2151
+ if (source == null) return {};
2152
+ var target = {};
2153
+ var sourceKeys = Object.keys(source);
2154
+ var key, i;
2155
+ for(i = 0; i < sourceKeys.length; i++){
2156
+ key = sourceKeys[i];
2157
+ if (excluded.indexOf(key) >= 0) continue;
2158
+ target[key] = source[key];
2159
+ }
2160
+ return target;
2161
+ }
2162
+
2163
+
2164
+
2165
+ var CandlestickSeriesRenderFunction = function(_param, ref) {
2166
+ var children = _param.children, rest = CandlestickSeries_object_without_properties(_param, [
2167
+ "children"
2168
+ ]);
2169
+ return /*#__PURE__*/ (0,jsx_runtime.jsx)(series_SeriesTemplate, CandlestickSeries_object_spread_props(CandlestickSeries_object_spread({
2170
+ type: "Candlestick",
2171
+ ref: ref
2172
+ }, rest), {
2173
+ children: children
2174
+ }));
2175
+ };
2176
+ var CandlestickSeries_CandlestickSeries = /*#__PURE__*/ (0,react.forwardRef)(CandlestickSeriesRenderFunction);
2177
+ CandlestickSeries_CandlestickSeries.displayName = "CandlestickSeries";
2178
+ /* ESM default export */ var CandlestickSeries = (CandlestickSeries_CandlestickSeries);
2179
+
2180
+ ;// CONCATENATED MODULE: ./src/series/AreaSeries.tsx
2181
+ function AreaSeries_define_property(obj, key, value) {
2182
+ if (key in obj) {
2183
+ Object.defineProperty(obj, key, {
2184
+ value: value,
2185
+ enumerable: true,
2186
+ configurable: true,
2187
+ writable: true
2188
+ });
2189
+ } else {
2190
+ obj[key] = value;
2191
+ }
2192
+ return obj;
2193
+ }
2194
+ function AreaSeries_object_spread(target) {
2195
+ for(var i = 1; i < arguments.length; i++){
2196
+ var source = arguments[i] != null ? arguments[i] : {};
2197
+ var ownKeys = Object.keys(source);
2198
+ if (typeof Object.getOwnPropertySymbols === "function") {
2199
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2200
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2201
+ }));
2202
+ }
2203
+ ownKeys.forEach(function(key) {
2204
+ AreaSeries_define_property(target, key, source[key]);
2205
+ });
2206
+ }
2207
+ return target;
2208
+ }
2209
+ function AreaSeries_ownKeys(object, enumerableOnly) {
2210
+ var keys = Object.keys(object);
2211
+ if (Object.getOwnPropertySymbols) {
2212
+ var symbols = Object.getOwnPropertySymbols(object);
2213
+ if (enumerableOnly) {
2214
+ symbols = symbols.filter(function(sym) {
2215
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2216
+ });
2217
+ }
2218
+ keys.push.apply(keys, symbols);
2219
+ }
2220
+ return keys;
2221
+ }
2222
+ function AreaSeries_object_spread_props(target, source) {
2223
+ source = source != null ? source : {};
2224
+ if (Object.getOwnPropertyDescriptors) {
2225
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2226
+ } else {
2227
+ AreaSeries_ownKeys(Object(source)).forEach(function(key) {
2228
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2229
+ });
2230
+ }
2231
+ return target;
2232
+ }
2233
+ function AreaSeries_object_without_properties(source, excluded) {
2234
+ if (source == null) return {};
2235
+ var target = AreaSeries_object_without_properties_loose(source, excluded);
2236
+ var key, i;
2237
+ if (Object.getOwnPropertySymbols) {
2238
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2239
+ for(i = 0; i < sourceSymbolKeys.length; i++){
2240
+ key = sourceSymbolKeys[i];
2241
+ if (excluded.indexOf(key) >= 0) continue;
2242
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2243
+ target[key] = source[key];
2244
+ }
2245
+ }
2246
+ return target;
2247
+ }
2248
+ function AreaSeries_object_without_properties_loose(source, excluded) {
2249
+ if (source == null) return {};
2250
+ var target = {};
2251
+ var sourceKeys = Object.keys(source);
2252
+ var key, i;
2253
+ for(i = 0; i < sourceKeys.length; i++){
2254
+ key = sourceKeys[i];
2255
+ if (excluded.indexOf(key) >= 0) continue;
2256
+ target[key] = source[key];
2257
+ }
2258
+ return target;
2259
+ }
2260
+
2261
+
2262
+
2263
+ var AreaSeriesRenderFunction = function(_param, ref) {
2264
+ var children = _param.children, rest = AreaSeries_object_without_properties(_param, [
2265
+ "children"
2266
+ ]);
2267
+ return /*#__PURE__*/ (0,jsx_runtime.jsx)(series_SeriesTemplate, AreaSeries_object_spread_props(AreaSeries_object_spread({
2268
+ type: "Area",
2269
+ ref: ref
2270
+ }, rest), {
2271
+ children: children
2272
+ }));
2273
+ };
2274
+ var AreaSeries = /*#__PURE__*/ (0,react.forwardRef)(AreaSeriesRenderFunction);
2275
+ AreaSeries.displayName = "AreaSeries";
2276
+ /* ESM default export */ var series_AreaSeries = (AreaSeries);
2277
+
2278
+ ;// CONCATENATED MODULE: ./src/series/index.ts
2279
+
2280
+
2281
+
2282
+
2283
+
2284
+
2285
+ ;// CONCATENATED MODULE: ./src/priceLine/useInitPriceLine.ts
2286
+ function useInitPriceLine_define_property(obj, key, value) {
2287
+ if (key in obj) {
2288
+ Object.defineProperty(obj, key, {
2289
+ value: value,
2290
+ enumerable: true,
2291
+ configurable: true,
2292
+ writable: true
2293
+ });
2294
+ } else {
2295
+ obj[key] = value;
2296
+ }
2297
+ return obj;
2298
+ }
2299
+ function useInitPriceLine_object_spread(target) {
2300
+ for(var i = 1; i < arguments.length; i++){
2301
+ var source = arguments[i] != null ? arguments[i] : {};
2302
+ var ownKeys = Object.keys(source);
2303
+ if (typeof Object.getOwnPropertySymbols === "function") {
2304
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2305
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2306
+ }));
2307
+ }
2308
+ ownKeys.forEach(function(key) {
2309
+ useInitPriceLine_define_property(target, key, source[key]);
2310
+ });
2311
+ }
2312
+ return target;
2313
+ }
2314
+
2315
+
2316
+
2317
+ var useInitPriceLine = function(param) {
2318
+ var options = param.options, price = param.price;
2319
+ var series = useSafeContext(SeriesContext);
2320
+ var priceLineApiRef = (0,react.useRef)({
2321
+ _priceLine: null,
2322
+ api: function() {
2323
+ if (!this._priceLine) {
2324
+ var seriesApi = series.api();
2325
+ if (!seriesApi) {
2326
+ return null;
2327
+ }
2328
+ this._priceLine = seriesApi.createPriceLine(useInitPriceLine_object_spread({
2329
+ price: price
2330
+ }, options));
2331
+ }
2332
+ return this._priceLine;
2333
+ },
2334
+ clear: function() {
2335
+ if (this._priceLine !== null) {
2336
+ var _series_api;
2337
+ (_series_api = series.api()) === null || _series_api === void 0 ? void 0 : _series_api.removePriceLine(this._priceLine);
2338
+ this._priceLine = null;
2339
+ }
2340
+ }
2341
+ });
2342
+ (0,react.useLayoutEffect)(function() {
2343
+ priceLineApiRef.current.api();
2344
+ return function() {
2345
+ priceLineApiRef.current.clear();
2346
+ };
2347
+ }, []);
2348
+ (0,react.useLayoutEffect)(function() {
2349
+ if (!series) return;
2350
+ if (options) {
2351
+ var _priceLineApiRef_current_api;
2352
+ (_priceLineApiRef_current_api = priceLineApiRef.current.api()) === null || _priceLineApiRef_current_api === void 0 ? void 0 : _priceLineApiRef_current_api.applyOptions(options);
2353
+ }
2354
+ }, [
2355
+ options
2356
+ ]);
2357
+ return priceLineApiRef;
2358
+ };
2359
+
2360
+ ;// CONCATENATED MODULE: ./src/priceLine/PriceLine.tsx
2361
+
2362
+
2363
+ var PriceLineRenderFunction = function(props, ref) {
2364
+ var priceLineApiRef = useInitPriceLine(props);
2365
+ (0,react.useImperativeHandle)(ref, function() {
2366
+ return priceLineApiRef.current;
2367
+ }, [
2368
+ priceLineApiRef
2369
+ ]);
2370
+ return null;
2371
+ };
2372
+ var PriceLine_PriceLine = /*#__PURE__*/ (0,react.forwardRef)(PriceLineRenderFunction);
2373
+ PriceLine_PriceLine.displayName = "PriceLine";
2374
+ /* ESM default export */ var PriceLine = (PriceLine_PriceLine);
2375
+
2376
+ ;// CONCATENATED MODULE: ./src/priceLine/index.ts
2377
+
2378
+
2379
+
2380
+ ;// CONCATENATED MODULE: ./src/index.ts?__rslib_entry__
2381
+
2382
+
2383
+
2384
+
2385
+
2386
+ return __webpack_exports__;
2387
+ })()
2388
+
2389
+ });