@ape.swap/bonds-sdk 2.3.3 → 2.3.5

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.
package/dist/main.js CHANGED
@@ -4,6 +4,7 @@ import { useWaitForTransactionReceipt, useChainId, useAccount, useSwitchChain, u
4
4
  import { useQuery, useQueryClient } from '@tanstack/react-query';
5
5
  import axios from 'axios';
6
6
  import { ConnectButton as ConnectButton$1 } from '@rainbow-me/rainbowkit';
7
+ import domtoimage from 'dom-to-image';
7
8
 
8
9
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
9
10
 
@@ -1379,7 +1380,7 @@ if (process.env.NODE_ENV === 'production') {
1379
1380
 
1380
1381
  var jsxRuntimeExports = jsxRuntime.exports;
1381
1382
 
1382
- var isDevelopment$1 = false;
1383
+ var isDevelopment$2 = false;
1383
1384
 
1384
1385
  /*
1385
1386
 
@@ -1461,7 +1462,7 @@ var StyleSheet = /*#__PURE__*/function () {
1461
1462
  _this.tags.push(tag);
1462
1463
  };
1463
1464
 
1464
- this.isSpeedy = options.speedy === undefined ? !isDevelopment$1 : options.speedy;
1465
+ this.isSpeedy = options.speedy === undefined ? !isDevelopment$2 : options.speedy;
1465
1466
  this.tags = [];
1466
1467
  this.ctr = 0;
1467
1468
  this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
@@ -2139,7 +2140,7 @@ function memoize$2(fn) {
2139
2140
  };
2140
2141
  }
2141
2142
 
2142
- var isBrowser$5 = typeof document !== 'undefined';
2143
+ var isBrowser$4 = typeof document !== 'undefined';
2143
2144
 
2144
2145
  var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
2145
2146
  var previous = 0;
@@ -2492,7 +2493,7 @@ export type Options = {
2492
2493
  }
2493
2494
  */
2494
2495
 
2495
- var getServerStylisCache = isBrowser$5 ? undefined : weakMemoize(function () {
2496
+ var getServerStylisCache = isBrowser$4 ? undefined : weakMemoize(function () {
2496
2497
  return memoize$2(function () {
2497
2498
  var cache = {};
2498
2499
  return function (name) {
@@ -2509,7 +2510,7 @@ createCache(options
2509
2510
  ) {
2510
2511
  var key = options.key;
2511
2512
 
2512
- if (isBrowser$5 && key === 'css') {
2513
+ if (isBrowser$4 && key === 'css') {
2513
2514
  var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
2514
2515
  // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
2515
2516
  // note this very very intentionally targets all style elements regardless of the key to ensure
@@ -2543,7 +2544,7 @@ createCache(options
2543
2544
 
2544
2545
  var nodesToHydrate = [];
2545
2546
 
2546
- if (isBrowser$5) {
2547
+ if (isBrowser$4) {
2547
2548
  container = options.container || document.head;
2548
2549
  Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
2549
2550
  // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
@@ -2571,7 +2572,7 @@ createCache(options
2571
2572
 
2572
2573
  var omnipresentPlugins = [compat, removeLabel];
2573
2574
 
2574
- if (isBrowser$5) {
2575
+ if (isBrowser$4) {
2575
2576
  var currentSheet;
2576
2577
  var finalizingPlugins = [stringify, rulesheet(function (rule) {
2577
2578
  currentSheet.insert(rule);
@@ -2933,7 +2934,7 @@ var TYPE_STATICS = {};
2933
2934
  TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
2934
2935
  TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
2935
2936
 
2936
- var isBrowser$4 = typeof document !== 'undefined';
2937
+ var isBrowser$3 = typeof document !== 'undefined';
2937
2938
 
2938
2939
  function getRegisteredStyles(registered, registeredStyles, classNames) {
2939
2940
  var rawClassName = '';
@@ -2958,7 +2959,7 @@ var registerStyles = function registerStyles(cache, serialized, isStringTag) {
2958
2959
  // in node since emotion-server relies on whether a style is in
2959
2960
  // the registered cache to know whether a style is global or not
2960
2961
  // also, note that this check will be dead code eliminated in the browser
2961
- isBrowser$4 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
2962
+ isBrowser$3 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
2962
2963
  cache.registered[className] = serialized.styles;
2963
2964
  }
2964
2965
  };
@@ -2973,14 +2974,14 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
2973
2974
  do {
2974
2975
  var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
2975
2976
 
2976
- if (!isBrowser$4 && maybeStyles !== undefined) {
2977
+ if (!isBrowser$3 && maybeStyles !== undefined) {
2977
2978
  stylesForSSR += maybeStyles;
2978
2979
  }
2979
2980
 
2980
2981
  current = current.next;
2981
2982
  } while (current !== undefined);
2982
2983
 
2983
- if (!isBrowser$4 && stylesForSSR.length !== 0) {
2984
+ if (!isBrowser$3 && stylesForSSR.length !== 0) {
2984
2985
  return stylesForSSR;
2985
2986
  }
2986
2987
  }
@@ -3091,7 +3092,7 @@ var unitlessKeys = {
3091
3092
  strokeWidth: 1
3092
3093
  };
3093
3094
 
3094
- var isDevelopment = false;
3095
+ var isDevelopment$1 = false;
3095
3096
 
3096
3097
  var hyphenateRegex = /[A-Z]|^ms/g;
3097
3098
  var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
@@ -3185,6 +3186,7 @@ function handleInterpolation(mergedProps, registered, interpolation) {
3185
3186
  }
3186
3187
 
3187
3188
  var styles = serializedStyles.styles + ";";
3189
+
3188
3190
  return styles;
3189
3191
  }
3190
3192
 
@@ -3207,12 +3209,9 @@ function handleInterpolation(mergedProps, registered, interpolation) {
3207
3209
 
3208
3210
  var asString = interpolation;
3209
3211
 
3210
- if (registered == null) {
3212
+ {
3211
3213
  return asString;
3212
3214
  }
3213
-
3214
- var cached = registered[asString];
3215
- return cached !== undefined ? cached : asString;
3216
3215
  }
3217
3216
 
3218
3217
  function createStringFromObject(mergedProps, registered, obj) {
@@ -3229,17 +3228,15 @@ function createStringFromObject(mergedProps, registered, obj) {
3229
3228
  if (typeof value !== 'object') {
3230
3229
  var asString = value;
3231
3230
 
3232
- if (registered != null && registered[asString] !== undefined) {
3233
- string += key + "{" + registered[asString] + "}";
3234
- } else if (isProcessableValue(asString)) {
3231
+ if (isProcessableValue(asString)) {
3235
3232
  string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
3236
3233
  }
3237
3234
  } else {
3238
- if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {
3235
+ if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment$1) {
3239
3236
  throw new Error(noComponentSelectorMessage);
3240
3237
  }
3241
3238
 
3242
- if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
3239
+ if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null)) {
3243
3240
  for (var _i = 0; _i < value.length; _i++) {
3244
3241
  if (isProcessableValue(value[_i])) {
3245
3242
  string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
@@ -3270,9 +3267,10 @@ function createStringFromObject(mergedProps, registered, obj) {
3270
3267
  return string;
3271
3268
  }
3272
3269
 
3273
- var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g; // this is the cursor for keyframes
3270
+ var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g;
3274
3271
  // keyframes are stored on the SerializedStyles object as a linked list
3275
3272
 
3273
+
3276
3274
  var cursor;
3277
3275
  function serializeStyles(args, registered, mergedProps) {
3278
3276
  if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
@@ -3302,7 +3300,7 @@ function serializeStyles(args, registered, mergedProps) {
3302
3300
 
3303
3301
  styles += templateStringsArr[i];
3304
3302
  }
3305
- } // using a global regex with .exec is stateful so lastIndex has to be reset each time
3303
+ }
3306
3304
 
3307
3305
 
3308
3306
  labelPattern.lastIndex = 0;
@@ -3322,20 +3320,24 @@ function serializeStyles(args, registered, mergedProps) {
3322
3320
  };
3323
3321
  }
3324
3322
 
3325
- var isBrowser$3 = typeof document !== 'undefined';
3323
+ var isBrowser$2 = typeof document !== 'undefined';
3326
3324
 
3327
3325
  var syncFallback = function syncFallback(create) {
3328
3326
  return create();
3329
3327
  };
3330
3328
 
3331
3329
  var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;
3332
- var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$3 ? syncFallback : useInsertionEffect || syncFallback;
3330
+ var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$2 ? syncFallback : useInsertionEffect || syncFallback;
3333
3331
  var useInsertionEffectWithLayoutFallback = useInsertionEffect || React.useLayoutEffect;
3334
3332
 
3335
- var isBrowser$2 = typeof document !== 'undefined';
3336
- var hasOwn = {}.hasOwnProperty;
3333
+ var isDevelopment = false;
3337
3334
 
3338
- var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
3335
+ var isBrowser$1 = typeof document !== 'undefined';
3336
+
3337
+ /* import { type EmotionCache } from '@emotion/utils' */
3338
+ var EmotionCacheContext
3339
+ /*: React.Context<EmotionCache | null> */
3340
+ = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
3339
3341
  // because this module is primarily intended for the browser and node
3340
3342
  // but it's also required in react native and similar environments sometimes
3341
3343
  // and we could have a special build just for that
@@ -3345,24 +3347,37 @@ typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
3345
3347
  key: 'css'
3346
3348
  }) : null);
3347
3349
 
3348
- if (process.env.NODE_ENV !== 'production') {
3349
- EmotionCacheContext.displayName = 'EmotionCacheContext';
3350
- }
3351
-
3352
3350
  EmotionCacheContext.Provider;
3353
3351
 
3354
- var withEmotionCache = function withEmotionCache(func) {
3355
- // $FlowFixMe
3356
- return /*#__PURE__*/forwardRef(function (props, ref) {
3352
+ var withEmotionCache = function withEmotionCache
3353
+ /* <Props, Ref: React.Ref<*>> */
3354
+ (func
3355
+ /*: (props: Props, cache: EmotionCache, ref: Ref) => React.Node */
3356
+ )
3357
+ /*: React.AbstractComponent<Props> */
3358
+ {
3359
+ return /*#__PURE__*/forwardRef(function (props
3360
+ /*: Props */
3361
+ , ref
3362
+ /*: Ref */
3363
+ ) {
3357
3364
  // the cache will never be null in the browser
3358
3365
  var cache = useContext(EmotionCacheContext);
3359
3366
  return func(props, cache, ref);
3360
3367
  });
3361
3368
  };
3362
3369
 
3363
- if (!isBrowser$2) {
3364
- withEmotionCache = function withEmotionCache(func) {
3365
- return function (props) {
3370
+ if (!isBrowser$1) {
3371
+ withEmotionCache = function withEmotionCache
3372
+ /* <Props> */
3373
+ (func
3374
+ /*: (props: Props, cache: EmotionCache) => React.Node */
3375
+ )
3376
+ /*: React.StatelessFunctionalComponent<Props> */
3377
+ {
3378
+ return function (props
3379
+ /*: Props */
3380
+ ) {
3366
3381
  var cache = useContext(EmotionCacheContext);
3367
3382
 
3368
3383
  if (cache === null) {
@@ -3386,66 +3401,22 @@ if (!isBrowser$2) {
3386
3401
 
3387
3402
  var ThemeContext = /* #__PURE__ */React.createContext({});
3388
3403
 
3389
- if (process.env.NODE_ENV !== 'production') {
3390
- ThemeContext.displayName = 'EmotionThemeContext';
3391
- }
3392
-
3393
3404
  var useTheme = function useTheme() {
3394
3405
  return React.useContext(ThemeContext);
3395
3406
  };
3396
3407
 
3397
- var getLastPart = function getLastPart(functionName) {
3398
- // The match may be something like 'Object.createEmotionProps' or
3399
- // 'Loader.prototype.render'
3400
- var parts = functionName.split('.');
3401
- return parts[parts.length - 1];
3402
- };
3403
-
3404
- var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
3405
- // V8
3406
- var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
3407
- if (match) return getLastPart(match[1]); // Safari / Firefox
3408
-
3409
- match = /^([A-Za-z0-9$.]+)@/.exec(line);
3410
- if (match) return getLastPart(match[1]);
3411
- return undefined;
3412
- };
3413
-
3414
- var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
3415
- // identifiers, thus we only need to replace what is a valid character for JS,
3416
- // but not for CSS.
3417
-
3418
- var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
3419
- return identifier.replace(/\$/g, '-');
3420
- };
3421
-
3422
- var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
3423
- if (!stackTrace) return undefined;
3424
- var lines = stackTrace.split('\n');
3425
-
3426
- for (var i = 0; i < lines.length; i++) {
3427
- var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
3428
-
3429
- if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
3430
-
3431
- if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
3432
- // uppercase letter
3433
-
3434
- if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
3435
- }
3436
-
3437
- return undefined;
3438
- };
3408
+ var hasOwn = {}.hasOwnProperty;
3439
3409
 
3440
3410
  var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
3441
- var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
3442
- var createEmotionProps = function createEmotionProps(type, props) {
3443
- if (process.env.NODE_ENV !== 'production' && typeof props.css === 'string' && // check if there is a css declaration
3444
- props.css.indexOf(':') !== -1) {
3445
- throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`");
3446
- }
3411
+ var createEmotionProps = function createEmotionProps(type
3412
+ /*: React.ElementType */
3413
+ , props
3414
+ /*: Object */
3415
+ ) {
3447
3416
 
3448
- var newProps = {};
3417
+ var newProps
3418
+ /*: any */
3419
+ = {};
3449
3420
 
3450
3421
  for (var key in props) {
3451
3422
  if (hasOwn.call(props, key)) {
@@ -3453,18 +3424,12 @@ var createEmotionProps = function createEmotionProps(type, props) {
3453
3424
  }
3454
3425
  }
3455
3426
 
3456
- newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
3457
- // the label hasn't already been computed
3458
-
3459
- if (process.env.NODE_ENV !== 'production' && !!props.css && (typeof props.css !== 'object' || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) {
3460
- var label = getLabelFromStackTrace(new Error().stack);
3461
- if (label) newProps[labelPropName] = label;
3462
- }
3427
+ newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:
3463
3428
 
3464
3429
  return newProps;
3465
3430
  };
3466
3431
 
3467
- var Insertion$1 = function Insertion(_ref) {
3432
+ var Insertion = function Insertion(_ref) {
3468
3433
  var cache = _ref.cache,
3469
3434
  serialized = _ref.serialized,
3470
3435
  isStringTag = _ref.isStringTag;
@@ -3473,7 +3438,7 @@ var Insertion$1 = function Insertion(_ref) {
3473
3438
  return insertStyles(cache, serialized, isStringTag);
3474
3439
  });
3475
3440
 
3476
- if (!isBrowser$2 && rules !== undefined) {
3441
+ if (!isBrowser$1 && rules !== undefined) {
3477
3442
  var _ref2;
3478
3443
 
3479
3444
  var serializedNames = serialized.name;
@@ -3492,7 +3457,9 @@ var Insertion$1 = function Insertion(_ref) {
3492
3457
  return null;
3493
3458
  };
3494
3459
 
3495
- var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
3460
+ var Emotion = /* #__PURE__ */withEmotionCache(
3461
+ /* <any, any> */
3462
+ function (props, cache, ref) {
3496
3463
  var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
3497
3464
  // not passing the registered cache to serializeStyles because it would
3498
3465
  // make certain babel optimisations not possible
@@ -3513,36 +3480,28 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
3513
3480
 
3514
3481
  var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));
3515
3482
 
3516
- if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
3517
- var labelFromStack = props[labelPropName];
3518
-
3519
- if (labelFromStack) {
3520
- serialized = serializeStyles([serialized, 'label:' + labelFromStack + ';']);
3521
- }
3522
- }
3523
-
3524
3483
  className += cache.key + "-" + serialized.name;
3525
3484
  var newProps = {};
3526
3485
 
3527
3486
  for (var key in props) {
3528
- if (hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
3487
+ if (hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (!isDevelopment )) {
3529
3488
  newProps[key] = props[key];
3530
3489
  }
3531
3490
  }
3532
3491
 
3533
- newProps.ref = ref;
3534
3492
  newProps.className = className;
3535
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion$1, {
3493
+
3494
+ if (ref) {
3495
+ newProps.ref = ref;
3496
+ }
3497
+
3498
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
3536
3499
  cache: cache,
3537
3500
  serialized: serialized,
3538
3501
  isStringTag: typeof WrappedComponent === 'string'
3539
3502
  }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
3540
3503
  });
3541
3504
 
3542
- if (process.env.NODE_ENV !== 'production') {
3543
- Emotion.displayName = 'EmotionCssPropInternal';
3544
- }
3545
-
3546
3505
  var Emotion$1 = Emotion;
3547
3506
 
3548
3507
  function jsx$3(type, props, key) {
@@ -5076,143 +5035,18 @@ const GreenShield = ({ width }) => {
5076
5035
  return (jsx$2("svg", { width: width || '10', height: "12", viewBox: "0 0 10 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx$2("path", { d: "M4.0625 6.6H2.5V4.8H4.0625V3.3H5.9375V4.8H7.5V6.6H5.9375V8.1H4.0625V6.6ZM5 0L0 1.8V5.454C0 8.484 2.13125 11.31 5 12C7.86875 11.31 10 8.484 10 5.454V1.8L5 0Z", fill: "#38A611" }) }));
5077
5036
  };
5078
5037
 
5079
- var pkg = {
5080
- name: "@emotion/react",
5081
- version: "11.11.4",
5082
- main: "dist/emotion-react.cjs.js",
5083
- module: "dist/emotion-react.esm.js",
5084
- browser: {
5085
- "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
5086
- },
5087
- exports: {
5088
- ".": {
5089
- module: {
5090
- worker: "./dist/emotion-react.worker.esm.js",
5091
- browser: "./dist/emotion-react.browser.esm.js",
5092
- "default": "./dist/emotion-react.esm.js"
5093
- },
5094
- "import": "./dist/emotion-react.cjs.mjs",
5095
- "default": "./dist/emotion-react.cjs.js"
5096
- },
5097
- "./jsx-runtime": {
5098
- module: {
5099
- worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js",
5100
- browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
5101
- "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js"
5102
- },
5103
- "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
5104
- "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
5105
- },
5106
- "./_isolated-hnrs": {
5107
- module: {
5108
- worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js",
5109
- browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
5110
- "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js"
5111
- },
5112
- "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
5113
- "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
5114
- },
5115
- "./jsx-dev-runtime": {
5116
- module: {
5117
- worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js",
5118
- browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
5119
- "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js"
5120
- },
5121
- "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
5122
- "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
5123
- },
5124
- "./package.json": "./package.json",
5125
- "./types/css-prop": "./types/css-prop.d.ts",
5126
- "./macro": {
5127
- types: {
5128
- "import": "./macro.d.mts",
5129
- "default": "./macro.d.ts"
5130
- },
5131
- "default": "./macro.js"
5132
- }
5133
- },
5134
- types: "types/index.d.ts",
5135
- files: [
5136
- "src",
5137
- "dist",
5138
- "jsx-runtime",
5139
- "jsx-dev-runtime",
5140
- "_isolated-hnrs",
5141
- "types/*.d.ts",
5142
- "macro.*"
5143
- ],
5144
- sideEffects: false,
5145
- author: "Emotion Contributors",
5146
- license: "MIT",
5147
- scripts: {
5148
- "test:typescript": "dtslint types"
5149
- },
5150
- dependencies: {
5151
- "@babel/runtime": "^7.18.3",
5152
- "@emotion/babel-plugin": "^11.11.0",
5153
- "@emotion/cache": "^11.11.0",
5154
- "@emotion/serialize": "^1.1.3",
5155
- "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
5156
- "@emotion/utils": "^1.2.1",
5157
- "@emotion/weak-memoize": "^0.3.1",
5158
- "hoist-non-react-statics": "^3.3.1"
5159
- },
5160
- peerDependencies: {
5161
- react: ">=16.8.0"
5162
- },
5163
- peerDependenciesMeta: {
5164
- "@types/react": {
5165
- optional: true
5166
- }
5167
- },
5168
- devDependencies: {
5169
- "@definitelytyped/dtslint": "0.0.112",
5170
- "@emotion/css": "11.11.2",
5171
- "@emotion/css-prettifier": "1.1.3",
5172
- "@emotion/server": "11.11.0",
5173
- "@emotion/styled": "11.11.0",
5174
- "html-tag-names": "^1.1.2",
5175
- react: "16.14.0",
5176
- "svg-tag-names": "^1.1.1",
5177
- typescript: "^4.5.5"
5178
- },
5179
- repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
5180
- publishConfig: {
5181
- access: "public"
5182
- },
5183
- "umd:main": "dist/emotion-react.umd.min.js",
5184
- preconstruct: {
5185
- entrypoints: [
5186
- "./index.js",
5187
- "./jsx-runtime.js",
5188
- "./jsx-dev-runtime.js",
5189
- "./_isolated-hnrs.js"
5190
- ],
5191
- umdName: "emotionReact",
5192
- exports: {
5193
- envConditions: [
5194
- "browser",
5195
- "worker"
5196
- ],
5197
- extra: {
5198
- "./types/css-prop": "./types/css-prop.d.ts",
5199
- "./macro": {
5200
- types: {
5201
- "import": "./macro.d.mts",
5202
- "default": "./macro.d.ts"
5203
- },
5204
- "default": "./macro.js"
5205
- }
5206
- }
5207
- }
5208
- }
5209
- };
5210
-
5211
- var jsx$1 = function jsx(type, props) {
5038
+ var jsx$1
5039
+ /*: typeof React.createElement */
5040
+ = function jsx
5041
+ /*: typeof React.createElement */
5042
+ (type
5043
+ /*: React.ElementType */
5044
+ , props
5045
+ /*: Object */
5046
+ ) {
5212
5047
  var args = arguments;
5213
5048
 
5214
5049
  if (props == null || !hasOwn.call(props, 'css')) {
5215
- // $FlowFixMe
5216
5050
  return React.createElement.apply(undefined, args);
5217
5051
  }
5218
5052
 
@@ -5223,30 +5057,26 @@ var jsx$1 = function jsx(type, props) {
5223
5057
 
5224
5058
  for (var i = 2; i < argsLength; i++) {
5225
5059
  createElementArgArray[i] = args[i];
5226
- } // $FlowFixMe
5227
-
5060
+ }
5228
5061
 
5229
5062
  return React.createElement.apply(null, createElementArgArray);
5230
5063
  };
5231
5064
 
5232
- var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
5233
5065
  // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
5234
5066
  // initial client-side render from SSR, use place of hydrating tag
5235
5067
 
5236
- var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
5237
- if (process.env.NODE_ENV !== 'production' && !warnedAboutCssPropForGlobal && ( // check for className as well since the user is
5238
- // probably using the custom createElement which
5239
- // means it will be turned into a className prop
5240
- // $FlowFixMe I don't really want to add it to the type since it shouldn't be used
5241
- props.className || props.css)) {
5242
- console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?");
5243
- warnedAboutCssPropForGlobal = true;
5244
- }
5068
+ var Global
5069
+ /*: React.AbstractComponent<
5070
+ GlobalProps
5071
+ > */
5072
+ = /* #__PURE__ */withEmotionCache(function (props
5073
+ /*: GlobalProps */
5074
+ , cache) {
5245
5075
 
5246
5076
  var styles = props.styles;
5247
5077
  var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));
5248
5078
 
5249
- if (!isBrowser$2) {
5079
+ if (!isBrowser$1) {
5250
5080
  var _ref;
5251
5081
 
5252
5082
  var serializedNames = serialized.name;
@@ -5288,9 +5118,10 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
5288
5118
  container: cache.sheet.container,
5289
5119
  speedy: cache.sheet.isSpeedy
5290
5120
  });
5291
- var rehydrating = false; // $FlowFixMe
5292
-
5293
- var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
5121
+ var rehydrating = false;
5122
+ var node
5123
+ /*: HTMLStyleElement | null*/
5124
+ = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
5294
5125
 
5295
5126
  if (cache.sheet.tags.length) {
5296
5127
  sheet.before = cache.sheet.tags[0];
@@ -5335,11 +5166,11 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
5335
5166
  return null;
5336
5167
  });
5337
5168
 
5338
- if (process.env.NODE_ENV !== 'production') {
5339
- Global.displayName = 'EmotionGlobal';
5340
- }
5169
+ /* import type { Interpolation, SerializedStyles } from '@emotion/utils' */
5341
5170
 
5342
- function css$1() {
5171
+ function css$1()
5172
+ /*: SerializedStyles */
5173
+ {
5343
5174
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5344
5175
  args[_key] = arguments[_key];
5345
5176
  }
@@ -5347,10 +5178,20 @@ function css$1() {
5347
5178
  return serializeStyles(args);
5348
5179
  }
5349
5180
 
5350
- var keyframes$1 = function keyframes() {
5351
- var insertable = css$1.apply(void 0, arguments);
5352
- var name = "animation-" + insertable.name; // $FlowFixMe
5181
+ /*
5182
+ type Keyframes = {|
5183
+ name: string,
5184
+ styles: string,
5185
+ anim: 1,
5186
+ toString: () => string
5187
+ |} & string
5188
+ */
5353
5189
 
5190
+ var keyframes$1 = function
5191
+ /*: Keyframes */
5192
+ keyframes() {
5193
+ var insertable = css$1.apply(void 0, arguments);
5194
+ var name = "animation-" + insertable.name;
5354
5195
  return {
5355
5196
  name: name,
5356
5197
  styles: "@keyframes " + name + "{" + insertable.styles + "}",
@@ -5361,169 +5202,6 @@ var keyframes$1 = function keyframes() {
5361
5202
  };
5362
5203
  };
5363
5204
 
5364
- var classnames = function classnames(args) {
5365
- var len = args.length;
5366
- var i = 0;
5367
- var cls = '';
5368
-
5369
- for (; i < len; i++) {
5370
- var arg = args[i];
5371
- if (arg == null) continue;
5372
- var toAdd = void 0;
5373
-
5374
- switch (typeof arg) {
5375
- case 'boolean':
5376
- break;
5377
-
5378
- case 'object':
5379
- {
5380
- if (Array.isArray(arg)) {
5381
- toAdd = classnames(arg);
5382
- } else {
5383
- if (process.env.NODE_ENV !== 'production' && arg.styles !== undefined && arg.name !== undefined) {
5384
- console.error('You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n' + '`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component.');
5385
- }
5386
-
5387
- toAdd = '';
5388
-
5389
- for (var k in arg) {
5390
- if (arg[k] && k) {
5391
- toAdd && (toAdd += ' ');
5392
- toAdd += k;
5393
- }
5394
- }
5395
- }
5396
-
5397
- break;
5398
- }
5399
-
5400
- default:
5401
- {
5402
- toAdd = arg;
5403
- }
5404
- }
5405
-
5406
- if (toAdd) {
5407
- cls && (cls += ' ');
5408
- cls += toAdd;
5409
- }
5410
- }
5411
-
5412
- return cls;
5413
- };
5414
-
5415
- function merge$2(registered, css, className) {
5416
- var registeredStyles = [];
5417
- var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
5418
-
5419
- if (registeredStyles.length < 2) {
5420
- return className;
5421
- }
5422
-
5423
- return rawClassName + css(registeredStyles);
5424
- }
5425
-
5426
- var Insertion = function Insertion(_ref) {
5427
- var cache = _ref.cache,
5428
- serializedArr = _ref.serializedArr;
5429
- var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
5430
- var rules = '';
5431
-
5432
- for (var i = 0; i < serializedArr.length; i++) {
5433
- var res = insertStyles(cache, serializedArr[i], false);
5434
-
5435
- if (!isBrowser$2 && res !== undefined) {
5436
- rules += res;
5437
- }
5438
- }
5439
-
5440
- if (!isBrowser$2) {
5441
- return rules;
5442
- }
5443
- });
5444
-
5445
- if (!isBrowser$2 && rules.length !== 0) {
5446
- var _ref2;
5447
-
5448
- return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
5449
- return serialized.name;
5450
- }).join(' '), _ref2.dangerouslySetInnerHTML = {
5451
- __html: rules
5452
- }, _ref2.nonce = cache.sheet.nonce, _ref2));
5453
- }
5454
-
5455
- return null;
5456
- };
5457
-
5458
- var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
5459
- var hasRendered = false;
5460
- var serializedArr = [];
5461
-
5462
- var css = function css() {
5463
- if (hasRendered && process.env.NODE_ENV !== 'production') {
5464
- throw new Error('css can only be used during render');
5465
- }
5466
-
5467
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5468
- args[_key] = arguments[_key];
5469
- }
5470
-
5471
- var serialized = serializeStyles(args, cache.registered);
5472
- serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
5473
-
5474
- registerStyles(cache, serialized, false);
5475
- return cache.key + "-" + serialized.name;
5476
- };
5477
-
5478
- var cx = function cx() {
5479
- if (hasRendered && process.env.NODE_ENV !== 'production') {
5480
- throw new Error('cx can only be used during render');
5481
- }
5482
-
5483
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
5484
- args[_key2] = arguments[_key2];
5485
- }
5486
-
5487
- return merge$2(cache.registered, css, classnames(args));
5488
- };
5489
-
5490
- var content = {
5491
- css: css,
5492
- cx: cx,
5493
- theme: React.useContext(ThemeContext)
5494
- };
5495
- var ele = props.children(content);
5496
- hasRendered = true;
5497
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
5498
- cache: cache,
5499
- serializedArr: serializedArr
5500
- }), ele);
5501
- });
5502
-
5503
- if (process.env.NODE_ENV !== 'production') {
5504
- ClassNames.displayName = 'EmotionClassNames';
5505
- }
5506
-
5507
- if (process.env.NODE_ENV !== 'production') {
5508
- var isBrowser$1 = typeof document !== 'undefined'; // #1727, #2905 for some reason Jest and Vitest evaluate modules twice if some consuming module gets mocked
5509
-
5510
- var isTestEnv = typeof jest !== 'undefined' || typeof vi !== 'undefined';
5511
-
5512
- if (isBrowser$1 && !isTestEnv) {
5513
- // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
5514
- var globalContext = // $FlowIgnore
5515
- typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef
5516
- : isBrowser$1 ? window : global;
5517
- var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__";
5518
-
5519
- if (globalContext[globalKey]) {
5520
- console.warn('You are loading @emotion/react when it is already loaded. Running ' + 'multiple instances may cause problems. This can happen if multiple ' + 'versions are used, or if multiple builds of the same version are ' + 'used.');
5521
- }
5522
-
5523
- globalContext[globalKey] = true;
5524
- }
5525
- }
5526
-
5527
5205
  var isMergeableObject = function isMergeableObject(value) {
5528
5206
  return isNonNullObject(value)
5529
5207
  && !isSpecial(value)
@@ -5659,46 +5337,223 @@ var cjs = deepmerge_1;
5659
5337
  var deepmerge$1 = /*@__PURE__*/getDefaultExportFromCjs(cjs);
5660
5338
 
5661
5339
  var name$1 = "@emotion/react";
5662
- var version$k = "11.11.4";
5340
+ var version$k = "11.13.3";
5663
5341
  var main = "dist/emotion-react.cjs.js";
5664
5342
  var module = "dist/emotion-react.esm.js";
5665
- var browser$1 = {
5666
- "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
5667
- };
5668
5343
  var exports = {
5669
5344
  ".": {
5670
- module: {
5671
- worker: "./dist/emotion-react.worker.esm.js",
5672
- browser: "./dist/emotion-react.browser.esm.js",
5673
- "default": "./dist/emotion-react.esm.js"
5345
+ types: {
5346
+ "import": "./dist/emotion-react.cjs.mjs",
5347
+ "default": "./dist/emotion-react.cjs.js"
5348
+ },
5349
+ development: {
5350
+ "edge-light": {
5351
+ module: "./dist/emotion-react.development.edge-light.esm.js",
5352
+ "import": "./dist/emotion-react.development.edge-light.cjs.mjs",
5353
+ "default": "./dist/emotion-react.development.edge-light.cjs.js"
5354
+ },
5355
+ worker: {
5356
+ module: "./dist/emotion-react.development.edge-light.esm.js",
5357
+ "import": "./dist/emotion-react.development.edge-light.cjs.mjs",
5358
+ "default": "./dist/emotion-react.development.edge-light.cjs.js"
5359
+ },
5360
+ workerd: {
5361
+ module: "./dist/emotion-react.development.edge-light.esm.js",
5362
+ "import": "./dist/emotion-react.development.edge-light.cjs.mjs",
5363
+ "default": "./dist/emotion-react.development.edge-light.cjs.js"
5364
+ },
5365
+ browser: {
5366
+ module: "./dist/emotion-react.browser.development.esm.js",
5367
+ "import": "./dist/emotion-react.browser.development.cjs.mjs",
5368
+ "default": "./dist/emotion-react.browser.development.cjs.js"
5369
+ },
5370
+ module: "./dist/emotion-react.development.esm.js",
5371
+ "import": "./dist/emotion-react.development.cjs.mjs",
5372
+ "default": "./dist/emotion-react.development.cjs.js"
5674
5373
  },
5374
+ "edge-light": {
5375
+ module: "./dist/emotion-react.edge-light.esm.js",
5376
+ "import": "./dist/emotion-react.edge-light.cjs.mjs",
5377
+ "default": "./dist/emotion-react.edge-light.cjs.js"
5378
+ },
5379
+ worker: {
5380
+ module: "./dist/emotion-react.edge-light.esm.js",
5381
+ "import": "./dist/emotion-react.edge-light.cjs.mjs",
5382
+ "default": "./dist/emotion-react.edge-light.cjs.js"
5383
+ },
5384
+ workerd: {
5385
+ module: "./dist/emotion-react.edge-light.esm.js",
5386
+ "import": "./dist/emotion-react.edge-light.cjs.mjs",
5387
+ "default": "./dist/emotion-react.edge-light.cjs.js"
5388
+ },
5389
+ browser: {
5390
+ module: "./dist/emotion-react.browser.esm.js",
5391
+ "import": "./dist/emotion-react.browser.cjs.mjs",
5392
+ "default": "./dist/emotion-react.browser.cjs.js"
5393
+ },
5394
+ module: "./dist/emotion-react.esm.js",
5675
5395
  "import": "./dist/emotion-react.cjs.mjs",
5676
5396
  "default": "./dist/emotion-react.cjs.js"
5677
5397
  },
5678
5398
  "./jsx-runtime": {
5679
- module: {
5680
- worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js",
5681
- browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
5682
- "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js"
5399
+ types: {
5400
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
5401
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
5683
5402
  },
5403
+ development: {
5404
+ "edge-light": {
5405
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js",
5406
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs",
5407
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js"
5408
+ },
5409
+ worker: {
5410
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js",
5411
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs",
5412
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js"
5413
+ },
5414
+ workerd: {
5415
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js",
5416
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs",
5417
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js"
5418
+ },
5419
+ browser: {
5420
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.esm.js",
5421
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.cjs.mjs",
5422
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.cjs.js"
5423
+ },
5424
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.esm.js",
5425
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.cjs.mjs",
5426
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.cjs.js"
5427
+ },
5428
+ "edge-light": {
5429
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js",
5430
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs",
5431
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js"
5432
+ },
5433
+ worker: {
5434
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js",
5435
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs",
5436
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js"
5437
+ },
5438
+ workerd: {
5439
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js",
5440
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs",
5441
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js"
5442
+ },
5443
+ browser: {
5444
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
5445
+ "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.mjs",
5446
+ "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.js"
5447
+ },
5448
+ module: "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js",
5684
5449
  "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
5685
5450
  "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
5686
5451
  },
5687
5452
  "./_isolated-hnrs": {
5688
- module: {
5689
- worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js",
5690
- browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
5691
- "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js"
5453
+ types: {
5454
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
5455
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
5456
+ },
5457
+ development: {
5458
+ "edge-light": {
5459
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
5460
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
5461
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
5462
+ },
5463
+ worker: {
5464
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
5465
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
5466
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
5467
+ },
5468
+ workerd: {
5469
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js",
5470
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs",
5471
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js"
5472
+ },
5473
+ browser: {
5474
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js",
5475
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.cjs.mjs",
5476
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.cjs.js"
5477
+ },
5478
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.esm.js",
5479
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.cjs.mjs",
5480
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.cjs.js"
5481
+ },
5482
+ "edge-light": {
5483
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
5484
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
5485
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
5692
5486
  },
5487
+ worker: {
5488
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
5489
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
5490
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
5491
+ },
5492
+ workerd: {
5493
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js",
5494
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs",
5495
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js"
5496
+ },
5497
+ browser: {
5498
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
5499
+ "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.mjs",
5500
+ "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.js"
5501
+ },
5502
+ module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js",
5693
5503
  "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
5694
5504
  "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
5695
5505
  },
5696
5506
  "./jsx-dev-runtime": {
5697
- module: {
5698
- worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js",
5699
- browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
5700
- "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js"
5507
+ types: {
5508
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
5509
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
5510
+ },
5511
+ development: {
5512
+ "edge-light": {
5513
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js",
5514
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs",
5515
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js"
5516
+ },
5517
+ worker: {
5518
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js",
5519
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs",
5520
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js"
5521
+ },
5522
+ workerd: {
5523
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js",
5524
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs",
5525
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js"
5526
+ },
5527
+ browser: {
5528
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.esm.js",
5529
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.cjs.mjs",
5530
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.cjs.js"
5531
+ },
5532
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.esm.js",
5533
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.cjs.mjs",
5534
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.cjs.js"
5535
+ },
5536
+ "edge-light": {
5537
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js",
5538
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs",
5539
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js"
5701
5540
  },
5541
+ worker: {
5542
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js",
5543
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs",
5544
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js"
5545
+ },
5546
+ workerd: {
5547
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js",
5548
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs",
5549
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js"
5550
+ },
5551
+ browser: {
5552
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
5553
+ "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.mjs",
5554
+ "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.js"
5555
+ },
5556
+ module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js",
5702
5557
  "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
5703
5558
  "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
5704
5559
  },
@@ -5712,6 +5567,19 @@ var exports = {
5712
5567
  "default": "./macro.js"
5713
5568
  }
5714
5569
  };
5570
+ var imports = {
5571
+ "#is-development": {
5572
+ development: "./src/conditions/true.js",
5573
+ "default": "./src/conditions/false.js"
5574
+ },
5575
+ "#is-browser": {
5576
+ "edge-light": "./src/conditions/false.js",
5577
+ workerd: "./src/conditions/false.js",
5578
+ worker: "./src/conditions/false.js",
5579
+ browser: "./src/conditions/true.js",
5580
+ "default": "./src/conditions/is-browser.js"
5581
+ }
5582
+ };
5715
5583
  var types$1 = "types/index.d.ts";
5716
5584
  var files = [
5717
5585
  "src",
@@ -5730,12 +5598,12 @@ var scripts = {
5730
5598
  };
5731
5599
  var dependencies = {
5732
5600
  "@babel/runtime": "^7.18.3",
5733
- "@emotion/babel-plugin": "^11.11.0",
5734
- "@emotion/cache": "^11.11.0",
5735
- "@emotion/serialize": "^1.1.3",
5736
- "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
5737
- "@emotion/utils": "^1.2.1",
5738
- "@emotion/weak-memoize": "^0.3.1",
5601
+ "@emotion/babel-plugin": "^11.12.0",
5602
+ "@emotion/cache": "^11.13.0",
5603
+ "@emotion/serialize": "^1.3.1",
5604
+ "@emotion/use-insertion-effect-with-fallbacks": "^1.1.0",
5605
+ "@emotion/utils": "^1.4.0",
5606
+ "@emotion/weak-memoize": "^0.4.0",
5739
5607
  "hoist-non-react-statics": "^3.3.1"
5740
5608
  };
5741
5609
  var peerDependencies = {
@@ -5748,14 +5616,14 @@ var peerDependenciesMeta = {
5748
5616
  };
5749
5617
  var devDependencies = {
5750
5618
  "@definitelytyped/dtslint": "0.0.112",
5751
- "@emotion/css": "11.11.2",
5752
- "@emotion/css-prettifier": "1.1.3",
5619
+ "@emotion/css": "11.13.0",
5620
+ "@emotion/css-prettifier": "1.1.4",
5753
5621
  "@emotion/server": "11.11.0",
5754
- "@emotion/styled": "11.11.0",
5622
+ "@emotion/styled": "11.13.0",
5755
5623
  "html-tag-names": "^1.1.2",
5756
5624
  react: "16.14.0",
5757
5625
  "svg-tag-names": "^1.1.1",
5758
- typescript: "^4.5.5"
5626
+ typescript: "^5.4.5"
5759
5627
  };
5760
5628
  var repository = "https://github.com/emotion-js/emotion/tree/main/packages/react";
5761
5629
  var publishConfig = {
@@ -5770,10 +5638,6 @@ var preconstruct = {
5770
5638
  ],
5771
5639
  umdName: "emotionReact",
5772
5640
  exports: {
5773
- envConditions: [
5774
- "browser",
5775
- "worker"
5776
- ],
5777
5641
  extra: {
5778
5642
  "./types/css-prop": "./types/css-prop.d.ts",
5779
5643
  "./macro": {
@@ -5791,8 +5655,8 @@ var packageInfo = {
5791
5655
  version: version$k,
5792
5656
  main: main,
5793
5657
  module: module,
5794
- browser: browser$1,
5795
5658
  exports: exports,
5659
+ imports: imports,
5796
5660
  types: types$1,
5797
5661
  files: files,
5798
5662
  sideEffects: sideEffects,
@@ -6431,7 +6295,7 @@ const Text$1 = /*#__PURE__*/React__default.forwardRef(function Text(props, ref)
6431
6295
  * Image style variants can be defined in the theme.images object.
6432
6296
  * @see https://theme-ui.com/components/image/
6433
6297
  */
6434
- const Image$1 = /*#__PURE__*/React__default.forwardRef(function Image(props, ref) {
6298
+ const Image = /*#__PURE__*/React__default.forwardRef(function Image(props, ref) {
6435
6299
  const __outerCss = props.__css;
6436
6300
  return jsx$2(Box$1, {
6437
6301
  ref: ref,
@@ -7939,21 +7803,6 @@ function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyfr
7939
7803
 
7940
7804
  const noop$1 = (any) => any;
7941
7805
 
7942
- let warning = noop$1;
7943
- let invariant = noop$1;
7944
- if (process.env.NODE_ENV !== "production") {
7945
- warning = (check, message) => {
7946
- if (!check && typeof console !== "undefined") {
7947
- console.warn(message);
7948
- }
7949
- };
7950
- invariant = (check, message) => {
7951
- if (!check) {
7952
- throw new Error(message);
7953
- }
7954
- };
7955
- }
7956
-
7957
7806
  function createRenderStep(runNextFrame) {
7958
7807
  /**
7959
7808
  * We create and reuse two queues, one to queue jobs for the current frame
@@ -8186,6 +8035,21 @@ function isNone(value) {
8186
8035
  }
8187
8036
  }
8188
8037
 
8038
+ let warning = noop$1;
8039
+ let invariant = noop$1;
8040
+ if (process.env.NODE_ENV !== "production") {
8041
+ warning = (check, message) => {
8042
+ if (!check && typeof console !== "undefined") {
8043
+ console.warn(message);
8044
+ }
8045
+ };
8046
+ invariant = (check, message) => {
8047
+ if (!check) {
8048
+ throw new Error(message);
8049
+ }
8050
+ };
8051
+ }
8052
+
8189
8053
  /**
8190
8054
  * Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
8191
8055
  */
@@ -9222,10 +9086,6 @@ class BaseAnimation {
9222
9086
  then(resolve, reject) {
9223
9087
  return this.currentFinishedPromise.then(resolve, reject);
9224
9088
  }
9225
- flatten() {
9226
- this.options.type = "keyframes";
9227
- this.options.ease = "linear";
9228
- }
9229
9089
  updateFinishedPromise() {
9230
9090
  this.currentFinishedPromise = new Promise((resolve) => {
9231
9091
  this.resolveFinishedPromise = resolve;
@@ -9233,34 +9093,6 @@ class BaseAnimation {
9233
9093
  }
9234
9094
  }
9235
9095
 
9236
- /*
9237
- Progress within given range
9238
-
9239
- Given a lower limit and an upper limit, we return the progress
9240
- (expressed as a number 0-1) represented by the given value, and
9241
- limit that progress to within 0-1.
9242
-
9243
- @param [number]: Lower limit
9244
- @param [number]: Upper limit
9245
- @param [number]: Value to find progress within given range
9246
- @return [number]: Progress of value within range as expressed 0-1
9247
- */
9248
- const progress = (from, to, value) => {
9249
- const toFromDifference = to - from;
9250
- return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
9251
- };
9252
-
9253
- const generateLinearEasing = (easing, duration, // as milliseconds
9254
- resolution = 10 // as milliseconds
9255
- ) => {
9256
- let points = "";
9257
- const numPoints = Math.max(Math.round(duration / resolution), 2);
9258
- for (let i = 0; i < numPoints; i++) {
9259
- points += easing(progress(0, numPoints - 1, i)) + ", ";
9260
- }
9261
- return `linear(${points.substring(0, points.length - 2)})`;
9262
- };
9263
-
9264
9096
  /*
9265
9097
  Convert velocity into velocity per second
9266
9098
 
@@ -9277,43 +9109,21 @@ function calcGeneratorVelocity(resolveValue, t, current) {
9277
9109
  return velocityPerSecond(current - resolveValue(prevT), t - prevT);
9278
9110
  }
9279
9111
 
9280
- const springDefaults = {
9281
- // Default spring physics
9282
- stiffness: 100,
9283
- damping: 10,
9284
- mass: 1.0,
9285
- velocity: 0.0,
9286
- // Default duration/bounce-based options
9287
- duration: 800, // in ms
9288
- bounce: 0.3,
9289
- visualDuration: 0.3, // in seconds
9290
- // Rest thresholds
9291
- restSpeed: {
9292
- granular: 0.01,
9293
- default: 2,
9294
- },
9295
- restDelta: {
9296
- granular: 0.005,
9297
- default: 0.5,
9298
- },
9299
- // Limits
9300
- minDuration: 0.01, // in seconds
9301
- maxDuration: 10.0, // in seconds
9302
- minDamping: 0.05,
9303
- maxDamping: 1,
9304
- };
9305
-
9306
9112
  const safeMin = 0.001;
9307
- function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass, }) {
9113
+ const minDuration = 0.01;
9114
+ const maxDuration$1 = 10.0;
9115
+ const minDamping = 0.05;
9116
+ const maxDamping = 1;
9117
+ function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {
9308
9118
  let envelope;
9309
9119
  let derivative;
9310
- warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less");
9120
+ warning(duration <= secondsToMilliseconds(maxDuration$1), "Spring duration must be 10 seconds or less");
9311
9121
  let dampingRatio = 1 - bounce;
9312
9122
  /**
9313
9123
  * Restrict dampingRatio and duration to within acceptable ranges.
9314
9124
  */
9315
- dampingRatio = clamp(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio);
9316
- duration = clamp(springDefaults.minDuration, springDefaults.maxDuration, millisecondsToSeconds(duration));
9125
+ dampingRatio = clamp(minDamping, maxDamping, dampingRatio);
9126
+ duration = clamp(minDuration, maxDuration$1, millisecondsToSeconds(duration));
9317
9127
  if (dampingRatio < 1) {
9318
9128
  /**
9319
9129
  * Underdamped spring
@@ -9357,8 +9167,8 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
9357
9167
  duration = secondsToMilliseconds(duration);
9358
9168
  if (isNaN(undampedFreq)) {
9359
9169
  return {
9360
- stiffness: springDefaults.stiffness,
9361
- damping: springDefaults.damping,
9170
+ stiffness: 100,
9171
+ damping: 10,
9362
9172
  duration,
9363
9173
  };
9364
9174
  }
@@ -9383,22 +9193,6 @@ function calcAngularFreq(undampedFreq, dampingRatio) {
9383
9193
  return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
9384
9194
  }
9385
9195
 
9386
- /**
9387
- * Implement a practical max duration for keyframe generation
9388
- * to prevent infinite loops
9389
- */
9390
- const maxGeneratorDuration = 20000;
9391
- function calcGeneratorDuration(generator) {
9392
- let duration = 0;
9393
- const timeStep = 50;
9394
- let state = generator.next(duration);
9395
- while (!state.done && duration < maxGeneratorDuration) {
9396
- duration += timeStep;
9397
- state = generator.next(duration);
9398
- }
9399
- return duration >= maxGeneratorDuration ? Infinity : duration;
9400
- }
9401
-
9402
9196
  const durationKeys = ["duration", "bounce"];
9403
9197
  const physicsKeys = ["stiffness", "damping", "mass"];
9404
9198
  function isSpringType(options, keys) {
@@ -9406,51 +9200,29 @@ function isSpringType(options, keys) {
9406
9200
  }
9407
9201
  function getSpringOptions(options) {
9408
9202
  let springOptions = {
9409
- velocity: springDefaults.velocity,
9410
- stiffness: springDefaults.stiffness,
9411
- damping: springDefaults.damping,
9412
- mass: springDefaults.mass,
9203
+ velocity: 0.0,
9204
+ stiffness: 100,
9205
+ damping: 10,
9206
+ mass: 1.0,
9413
9207
  isResolvedFromDuration: false,
9414
9208
  ...options,
9415
9209
  };
9416
9210
  // stiffness/damping/mass overrides duration/bounce
9417
9211
  if (!isSpringType(options, physicsKeys) &&
9418
9212
  isSpringType(options, durationKeys)) {
9419
- if (options.visualDuration) {
9420
- const visualDuration = options.visualDuration;
9421
- const root = (2 * Math.PI) / (visualDuration * 1.2);
9422
- const stiffness = root * root;
9423
- const damping = 2 * clamp(0.05, 1, 1 - options.bounce) * Math.sqrt(stiffness);
9424
- springOptions = {
9425
- ...springOptions,
9426
- mass: springDefaults.mass,
9427
- stiffness,
9428
- damping,
9429
- };
9430
- }
9431
- else {
9432
- const derived = findSpring(options);
9433
- springOptions = {
9434
- ...springOptions,
9435
- ...derived,
9436
- mass: springDefaults.mass,
9437
- };
9438
- springOptions.isResolvedFromDuration = true;
9439
- }
9213
+ const derived = findSpring(options);
9214
+ springOptions = {
9215
+ ...springOptions,
9216
+ ...derived,
9217
+ mass: 1.0,
9218
+ };
9219
+ springOptions.isResolvedFromDuration = true;
9440
9220
  }
9441
9221
  return springOptions;
9442
9222
  }
9443
- function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) {
9444
- const options = typeof optionsOrVisualDuration !== "object"
9445
- ? {
9446
- visualDuration: optionsOrVisualDuration,
9447
- keyframes: [0, 1],
9448
- bounce,
9449
- }
9450
- : optionsOrVisualDuration;
9451
- let { restSpeed, restDelta } = options;
9452
- const origin = options.keyframes[0];
9453
- const target = options.keyframes[options.keyframes.length - 1];
9223
+ function spring({ keyframes, restDelta, restSpeed, ...options }) {
9224
+ const origin = keyframes[0];
9225
+ const target = keyframes[keyframes.length - 1];
9454
9226
  /**
9455
9227
  * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
9456
9228
  * to reduce GC during animation.
@@ -9472,12 +9244,8 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
9472
9244
  * ratio between feeling good and finishing as soon as changes are imperceptible.
9473
9245
  */
9474
9246
  const isGranularScale = Math.abs(initialDelta) < 5;
9475
- restSpeed || (restSpeed = isGranularScale
9476
- ? springDefaults.restSpeed.granular
9477
- : springDefaults.restSpeed.default);
9478
- restDelta || (restDelta = isGranularScale
9479
- ? springDefaults.restDelta.granular
9480
- : springDefaults.restDelta.default);
9247
+ restSpeed || (restSpeed = isGranularScale ? 0.01 : 2);
9248
+ restDelta || (restDelta = isGranularScale ? 0.005 : 0.5);
9481
9249
  let resolveSpring;
9482
9250
  if (dampingRatio < 1) {
9483
9251
  const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
@@ -9518,7 +9286,7 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
9518
9286
  dampedAngularFreq);
9519
9287
  };
9520
9288
  }
9521
- const generator = {
9289
+ return {
9522
9290
  calculatedDuration: isResolvedFromDuration ? duration || null : null,
9523
9291
  next: (t) => {
9524
9292
  const current = resolveSpring(t);
@@ -9546,13 +9314,7 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
9546
9314
  state.value = state.done ? target : current;
9547
9315
  return state;
9548
9316
  },
9549
- toString: () => {
9550
- const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
9551
- const easing = generateLinearEasing((progress) => generator.next(calculatedDuration * progress).value, calculatedDuration, 30);
9552
- return calculatedDuration + "ms " + easing;
9553
- },
9554
9317
  };
9555
- return generator;
9556
9318
  }
9557
9319
 
9558
9320
  function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {
@@ -9686,6 +9448,23 @@ const easingDefinitionToFunction = (definition) => {
9686
9448
  const combineFunctions = (a, b) => (v) => b(a(v));
9687
9449
  const pipe = (...transformers) => transformers.reduce(combineFunctions);
9688
9450
 
9451
+ /*
9452
+ Progress within given range
9453
+
9454
+ Given a lower limit and an upper limit, we return the progress
9455
+ (expressed as a number 0-1) represented by the given value, and
9456
+ limit that progress to within 0-1.
9457
+
9458
+ @param [number]: Lower limit
9459
+ @param [number]: Upper limit
9460
+ @param [number]: Value to find progress within given range
9461
+ @return [number]: Progress of value within range as expressed 0-1
9462
+ */
9463
+ const progress = (from, to, value) => {
9464
+ const toFromDifference = to - from;
9465
+ return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
9466
+ };
9467
+
9689
9468
  /*
9690
9469
  Value in range from progress
9691
9470
 
@@ -9773,7 +9552,7 @@ function asRGBA(color) {
9773
9552
  return false;
9774
9553
  let model = type.parse(color);
9775
9554
  if (type === hsla) {
9776
- // TODO Remove this cast - needed since Motion's stricter typing
9555
+ // TODO Remove this cast - needed since Framer Motion's stricter typing
9777
9556
  model = hslaToRgba(model);
9778
9557
  }
9779
9558
  return model;
@@ -10030,6 +9809,22 @@ function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "e
10030
9809
  };
10031
9810
  }
10032
9811
 
9812
+ /**
9813
+ * Implement a practical max duration for keyframe generation
9814
+ * to prevent infinite loops
9815
+ */
9816
+ const maxGeneratorDuration = 20000;
9817
+ function calcGeneratorDuration(generator) {
9818
+ let duration = 0;
9819
+ const timeStep = 50;
9820
+ let state = generator.next(duration);
9821
+ while (!state.done && duration < maxGeneratorDuration) {
9822
+ duration += timeStep;
9823
+ state = generator.next(duration);
9824
+ }
9825
+ return duration >= maxGeneratorDuration ? Infinity : duration;
9826
+ }
9827
+
10033
9828
  const frameloopDriver = (update) => {
10034
9829
  const passTimestamp = ({ timestamp }) => update(timestamp);
10035
9830
  return {
@@ -10105,13 +9900,6 @@ class MainThreadAnimation extends BaseAnimation {
10105
9900
  this.resolver = new KeyframeResolver$1(keyframes, onResolved, name, motionValue, element);
10106
9901
  this.resolver.scheduleResolve();
10107
9902
  }
10108
- flatten() {
10109
- super.flatten();
10110
- // If we've already resolved the animation, re-initialise it
10111
- if (this._resolved) {
10112
- Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes));
10113
- }
10114
- }
10115
9903
  initPlayback(keyframes$1) {
10116
9904
  const { type = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0, } = this.options;
10117
9905
  const generatorFactory = isGenerator(type)
@@ -10427,6 +10215,18 @@ const acceleratedValues = new Set([
10427
10215
  // "background-color"
10428
10216
  ]);
10429
10217
 
10218
+ // Create a linear easing point for every 10 ms
10219
+ const resolution = 10;
10220
+ const generateLinearEasing = (easing, duration // as milliseconds
10221
+ ) => {
10222
+ let points = "";
10223
+ const numPoints = Math.max(Math.round(duration / resolution), 2);
10224
+ for (let i = 0; i < numPoints; i++) {
10225
+ points += easing(progress(0, numPoints - 1, i)) + ", ";
10226
+ }
10227
+ return `linear(${points.substring(0, points.length - 2)})`;
10228
+ };
10229
+
10430
10230
  function memo(callback) {
10431
10231
  let result;
10432
10232
  return () => {
@@ -10500,7 +10300,7 @@ function mapEasingToNativeEasing(easing, duration) {
10500
10300
  }
10501
10301
  }
10502
10302
 
10503
- function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
10303
+ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease, times, } = {}) {
10504
10304
  const keyframeOptions = { [valueName]: keyframes };
10505
10305
  if (times)
10506
10306
  keyframeOptions.offset = times;
@@ -10890,9 +10690,6 @@ class GroupPlaybackControls {
10890
10690
  runAll(methodName) {
10891
10691
  this.animations.forEach((controls) => controls[methodName]());
10892
10692
  }
10893
- flatten() {
10894
- this.runAll("flatten");
10895
- }
10896
10693
  play() {
10897
10694
  this.runAll("play");
10898
10695
  }
@@ -11092,7 +10889,7 @@ class MotionValue {
11092
10889
  * This will be replaced by the build step with the latest version number.
11093
10890
  * When MotionValues are provided to motion components, warn if versions are mixed.
11094
10891
  */
11095
- this.version = "11.13.1";
10892
+ this.version = "11.11.10";
11096
10893
  /**
11097
10894
  * Tracks whether this value can output a velocity. Currently this is only true
11098
10895
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -11998,94 +11795,6 @@ const animations = {
11998
11795
  },
11999
11796
  };
12000
11797
 
12001
- function resolveElements(elementOrSelector, scope, selectorCache) {
12002
- var _a;
12003
- if (elementOrSelector instanceof Element) {
12004
- return [elementOrSelector];
12005
- }
12006
- else if (typeof elementOrSelector === "string") {
12007
- let root = document;
12008
- const elements = (_a = void 0 ) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
12009
- return elements ? Array.from(elements) : [];
12010
- }
12011
- return Array.from(elementOrSelector);
12012
- }
12013
-
12014
- const isDragging = {
12015
- x: false,
12016
- y: false,
12017
- };
12018
- function isDragActive() {
12019
- return isDragging.x || isDragging.y;
12020
- }
12021
-
12022
- /**
12023
- * Filter out events that are not pointer events, or are triggering
12024
- * while a Motion gesture is active.
12025
- */
12026
- function filterEvents(callback) {
12027
- return (event) => {
12028
- if (event.pointerType === "touch" || isDragActive())
12029
- return;
12030
- callback(event);
12031
- };
12032
- }
12033
- /**
12034
- * Create a hover gesture. hover() is different to .addEventListener("pointerenter")
12035
- * in that it has an easier syntax, filters out polyfilled touch events, interoperates
12036
- * with drag gestures, and automatically removes the "pointerennd" event listener when the hover ends.
12037
- *
12038
- * @public
12039
- */
12040
- function hover(elementOrSelector, onHoverStart, options = {}) {
12041
- const gestureAbortController = new AbortController();
12042
- const eventOptions = {
12043
- passive: true,
12044
- ...options,
12045
- signal: gestureAbortController.signal,
12046
- };
12047
- const onPointerEnter = filterEvents((enterEvent) => {
12048
- const { target } = enterEvent;
12049
- const onHoverEnd = onHoverStart(enterEvent);
12050
- if (!onHoverEnd || !target)
12051
- return;
12052
- const onPointerLeave = filterEvents((leaveEvent) => {
12053
- onHoverEnd(leaveEvent);
12054
- target.removeEventListener("pointerleave", onPointerLeave);
12055
- });
12056
- target.addEventListener("pointerleave", onPointerLeave, eventOptions);
12057
- });
12058
- resolveElements(elementOrSelector).forEach((element) => {
12059
- element.addEventListener("pointerenter", onPointerEnter, eventOptions);
12060
- });
12061
- return () => gestureAbortController.abort();
12062
- }
12063
-
12064
- function setDragLock(axis) {
12065
- if (axis === "x" || axis === "y") {
12066
- if (isDragging[axis]) {
12067
- return null;
12068
- }
12069
- else {
12070
- isDragging[axis] = true;
12071
- return () => {
12072
- isDragging[axis] = false;
12073
- };
12074
- }
12075
- }
12076
- else {
12077
- if (isDragging.x || isDragging.y) {
12078
- return null;
12079
- }
12080
- else {
12081
- isDragging.x = isDragging.y = true;
12082
- return () => {
12083
- isDragging.x = isDragging.y = false;
12084
- };
12085
- }
12086
- }
12087
- }
12088
-
12089
11798
  const isPrimaryPointer = (event) => {
12090
11799
  if (event.pointerType === "mouse") {
12091
11800
  return typeof event.button !== "number" || event.button <= 0;
@@ -12103,11 +11812,11 @@ const isPrimaryPointer = (event) => {
12103
11812
  }
12104
11813
  };
12105
11814
 
12106
- function extractEventInfo(event) {
11815
+ function extractEventInfo(event, pointType = "page") {
12107
11816
  return {
12108
11817
  point: {
12109
- x: event.pageX,
12110
- y: event.pageY,
11818
+ x: event[`${pointType}X`],
11819
+ y: event[`${pointType}Y`],
12111
11820
  },
12112
11821
  };
12113
11822
  }
@@ -12279,6 +11988,58 @@ function getVelocity(history, timeDelta) {
12279
11988
  return currentVelocity;
12280
11989
  }
12281
11990
 
11991
+ function createLock(name) {
11992
+ let lock = null;
11993
+ return () => {
11994
+ const openLock = () => {
11995
+ lock = null;
11996
+ };
11997
+ if (lock === null) {
11998
+ lock = name;
11999
+ return openLock;
12000
+ }
12001
+ return false;
12002
+ };
12003
+ }
12004
+ const globalHorizontalLock = createLock("dragHorizontal");
12005
+ const globalVerticalLock = createLock("dragVertical");
12006
+ function getGlobalLock(drag) {
12007
+ let lock = false;
12008
+ if (drag === "y") {
12009
+ lock = globalVerticalLock();
12010
+ }
12011
+ else if (drag === "x") {
12012
+ lock = globalHorizontalLock();
12013
+ }
12014
+ else {
12015
+ const openHorizontal = globalHorizontalLock();
12016
+ const openVertical = globalVerticalLock();
12017
+ if (openHorizontal && openVertical) {
12018
+ lock = () => {
12019
+ openHorizontal();
12020
+ openVertical();
12021
+ };
12022
+ }
12023
+ else {
12024
+ // Release the locks because we don't use them
12025
+ if (openHorizontal)
12026
+ openHorizontal();
12027
+ if (openVertical)
12028
+ openVertical();
12029
+ }
12030
+ }
12031
+ return lock;
12032
+ }
12033
+ function isDragActive() {
12034
+ // Check the gesture lock - if we get it, it means no drag gesture is active
12035
+ // and we can safely fire the tap gesture.
12036
+ const openGestureLock = getGlobalLock(true);
12037
+ if (!openGestureLock)
12038
+ return true;
12039
+ openGestureLock();
12040
+ return false;
12041
+ }
12042
+
12282
12043
  function isRefObject(ref) {
12283
12044
  return (ref &&
12284
12045
  typeof ref === "object" &&
@@ -12674,7 +12435,10 @@ const elementDragControls = new WeakMap();
12674
12435
  // let latestPointerEvent: PointerEvent
12675
12436
  class VisualElementDragControls {
12676
12437
  constructor(visualElement) {
12677
- this.openDragLock = null;
12438
+ // This is a reference to the global drag gesture lock, ensuring only one component
12439
+ // can "capture" the drag of one or both axes.
12440
+ // TODO: Look into moving this into pansession?
12441
+ this.openGlobalLock = null;
12678
12442
  this.isDragging = false;
12679
12443
  this.currentDirection = null;
12680
12444
  this.originPoint = { x: 0, y: 0 };
@@ -12702,18 +12466,18 @@ class VisualElementDragControls {
12702
12466
  // the component.
12703
12467
  dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation();
12704
12468
  if (snapToCursor) {
12705
- this.snapToCursor(extractEventInfo(event).point);
12469
+ this.snapToCursor(extractEventInfo(event, "page").point);
12706
12470
  }
12707
12471
  };
12708
12472
  const onStart = (event, info) => {
12709
12473
  // Attempt to grab the global drag gesture lock - maybe make this part of PanSession
12710
12474
  const { drag, dragPropagation, onDragStart } = this.getProps();
12711
12475
  if (drag && !dragPropagation) {
12712
- if (this.openDragLock)
12713
- this.openDragLock();
12714
- this.openDragLock = setDragLock(drag);
12476
+ if (this.openGlobalLock)
12477
+ this.openGlobalLock();
12478
+ this.openGlobalLock = getGlobalLock(drag);
12715
12479
  // If we don 't have the lock, don't start dragging
12716
- if (!this.openDragLock)
12480
+ if (!this.openGlobalLock)
12717
12481
  return;
12718
12482
  }
12719
12483
  this.isDragging = true;
@@ -12755,7 +12519,7 @@ class VisualElementDragControls {
12755
12519
  // latestPointerEvent = event
12756
12520
  const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
12757
12521
  // If we didn't successfully receive the gesture lock, early return.
12758
- if (!dragPropagation && !this.openDragLock)
12522
+ if (!dragPropagation && !this.openGlobalLock)
12759
12523
  return;
12760
12524
  const { offset } = info;
12761
12525
  // Attempt to detect drag direction if directionLock is true
@@ -12823,9 +12587,9 @@ class VisualElementDragControls {
12823
12587
  this.panSession && this.panSession.end();
12824
12588
  this.panSession = undefined;
12825
12589
  const { dragPropagation } = this.getProps();
12826
- if (!dragPropagation && this.openDragLock) {
12827
- this.openDragLock();
12828
- this.openDragLock = null;
12590
+ if (!dragPropagation && this.openGlobalLock) {
12591
+ this.openGlobalLock();
12592
+ this.openGlobalLock = null;
12829
12593
  }
12830
12594
  animationState && animationState.setActive("whileDrag", false);
12831
12595
  }
@@ -15463,25 +15227,28 @@ const drag = {
15463
15227
  },
15464
15228
  };
15465
15229
 
15466
- function handleHoverEvent(node, event, isActive) {
15467
- const { props } = node;
15468
- if (node.animationState && props.whileHover) {
15469
- node.animationState.setActive("whileHover", isActive);
15470
- }
15471
- const callback = props[isActive ? "onHoverStart" : "onHoverEnd"];
15472
- if (callback) {
15473
- frame.postRender(() => callback(event, extractEventInfo(event)));
15474
- }
15230
+ function addHoverEvent(node, isActive) {
15231
+ const eventName = isActive ? "pointerenter" : "pointerleave";
15232
+ const callbackName = isActive ? "onHoverStart" : "onHoverEnd";
15233
+ const handleEvent = (event, info) => {
15234
+ if (event.pointerType === "touch" || isDragActive())
15235
+ return;
15236
+ const props = node.getProps();
15237
+ if (node.animationState && props.whileHover) {
15238
+ node.animationState.setActive("whileHover", isActive);
15239
+ }
15240
+ const callback = props[callbackName];
15241
+ if (callback) {
15242
+ frame.postRender(() => callback(event, info));
15243
+ }
15244
+ };
15245
+ return addPointerEvent(node.current, eventName, handleEvent, {
15246
+ passive: !node.getProps()[callbackName],
15247
+ });
15475
15248
  }
15476
15249
  class HoverGesture extends Feature {
15477
15250
  mount() {
15478
- const { current, props } = this.node;
15479
- if (!current)
15480
- return;
15481
- this.unmount = hover(current, (startEvent) => {
15482
- handleHoverEvent(this.node, startEvent, true);
15483
- return (endEvent) => handleHoverEvent(this.node, endEvent, false);
15484
- }, { passive: !props.onHoverStart && !props.onHoverEnd });
15251
+ this.unmount = pipe(addHoverEvent(this.node, true), addHoverEvent(this.node, false));
15485
15252
  }
15486
15253
  unmount() { }
15487
15254
  }
@@ -15850,15 +15617,8 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
15850
15617
  (visualElement.type === "html" || visualElement.type === "svg")) {
15851
15618
  createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
15852
15619
  }
15853
- const isMounted = useRef(false);
15854
15620
  useInsertionEffect$1(() => {
15855
- /**
15856
- * Check the component has already mounted before calling
15857
- * `update` unnecessarily. This ensures we skip the initial update.
15858
- */
15859
- if (visualElement && isMounted.current) {
15860
- visualElement.update(props, presenceContext);
15861
- }
15621
+ visualElement && visualElement.update(props, presenceContext);
15862
15622
  });
15863
15623
  /**
15864
15624
  * Cache this value as we want to know whether HandoffAppearAnimations
@@ -15871,7 +15631,6 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
15871
15631
  useIsomorphicLayoutEffect$1(() => {
15872
15632
  if (!visualElement)
15873
15633
  return;
15874
- isMounted.current = true;
15875
15634
  window.MotionIsMounted = true;
15876
15635
  visualElement.updateFeatures();
15877
15636
  microtask.render(visualElement.render);
@@ -16865,7 +16624,7 @@ function updateMotionValuesFromProps(element, next, prev) {
16865
16624
  * and warn against mismatches.
16866
16625
  */
16867
16626
  if (process.env.NODE_ENV === "development") {
16868
- warnOnce(nextValue.version === "11.13.1", `Attempting to mix Motion versions ${nextValue.version} with 11.13.1 may not work as expected.`);
16627
+ warnOnce(nextValue.version === "11.11.10", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.11.10 may not work as expected.`);
16869
16628
  }
16870
16629
  }
16871
16630
  else if (isMotionValue(prevValue)) {
@@ -17391,20 +17150,6 @@ class DOMVisualElement extends VisualElement {
17391
17150
  delete vars[key];
17392
17151
  delete style[key];
17393
17152
  }
17394
- handleChildMotionValue() {
17395
- if (this.childSubscription) {
17396
- this.childSubscription();
17397
- delete this.childSubscription;
17398
- }
17399
- const { children } = this.props;
17400
- if (isMotionValue(children)) {
17401
- this.childSubscription = children.on("change", (latest) => {
17402
- if (this.current) {
17403
- this.current.textContent = `${latest}`;
17404
- }
17405
- });
17406
- }
17407
- }
17408
17153
  }
17409
17154
 
17410
17155
  function getComputedStyle$3(element) {
@@ -17438,6 +17183,19 @@ class HTMLVisualElement extends DOMVisualElement {
17438
17183
  scrapeMotionValuesFromProps(props, prevProps, visualElement) {
17439
17184
  return scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
17440
17185
  }
17186
+ handleChildMotionValue() {
17187
+ if (this.childSubscription) {
17188
+ this.childSubscription();
17189
+ delete this.childSubscription;
17190
+ }
17191
+ const { children } = this.props;
17192
+ if (isMotionValue(children)) {
17193
+ this.childSubscription = children.on("change", (latest) => {
17194
+ if (this.current)
17195
+ this.current.textContent = `${latest}`;
17196
+ });
17197
+ }
17198
+ }
17441
17199
  }
17442
17200
 
17443
17201
  class SVGVisualElement extends DOMVisualElement {
@@ -18326,7 +18084,6 @@ var types = {};
18326
18084
  (_c[LiquidityDex.PancakeSwapV2] = {
18327
18085
  factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73',
18328
18086
  protocol: Protocols.V2,
18329
- router: '0x10ED43C718714eb63d5aA57B78B54704E256024E',
18330
18087
  }),
18331
18088
  (_c[LiquidityDex.ApeSwapV3] = {
18332
18089
  factory: '0x7Bc382DdC5928964D7af60e7e2f6299A1eA6F48d',
@@ -73554,7 +73311,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
73554
73311
  return [approvalState !== null && approvalState !== void 0 ? approvalState : ApprovalState.NOT_APPROVED, handleApprove];
73555
73312
  };
73556
73313
 
73557
- const version$1 = '2.21.54';
73314
+ const version$1 = '2.21.35';
73558
73315
 
73559
73316
  let errorConfig = {
73560
73317
  getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
@@ -73636,10 +73393,7 @@ class BaseError extends Error {
73636
73393
  function walk(err, fn) {
73637
73394
  if (fn?.(err))
73638
73395
  return err;
73639
- if (err &&
73640
- typeof err === 'object' &&
73641
- 'cause' in err &&
73642
- err.cause !== undefined)
73396
+ if (err && typeof err === 'object' && 'cause' in err)
73643
73397
  return walk(err.cause, fn);
73644
73398
  return fn ? null : err;
73645
73399
  }
@@ -74161,19 +73915,11 @@ const ImageAndShortDescription = ({ bondData, onDismiss }) => {
74161
73915
  alignItems: 'center',
74162
73916
  overflow: 'hidden',
74163
73917
  position: 'relative',
74164
- }, children: [jsxs(Swiper, { id: "hotbondsSweper", onSwiper: setSwiper, slidesPerView: "auto", centeredSlides: true, lazy: true, preloadImages: false, onSlideChange: handleSlide, style: { width: '100%', overflow: 'visible' }, children: [jsx$2(SwiperSlide, { style: {
74165
- width: '100%',
74166
- display: 'flex',
74167
- justifyContent: 'center',
74168
- }, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 0), jsx$2(SwiperSlide, { style: {
74169
- width: '100%',
74170
- display: 'flex',
74171
- justifyContent: 'center',
74172
- }, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 1), jsx$2(SwiperSlide, { style: {
74173
- width: '100%',
74174
- display: 'flex',
74175
- justifyContent: 'center',
74176
- }, children: jsx$2("img", { className: "project-image", src: "https://placehold.co/400x200" }) }, 2)] }), jsx$2(Flex, { sx: { position: 'absolute', bottom: ['15px', '15px', '15px', '20px'], left: 'calc(50% - 28,5px)', zIndex: 2 }, children: [...Array(imagesLength)].map((_, i) => {
73918
+ }, children: [jsx$2(Swiper, { id: "hotbondsSweper", onSwiper: setSwiper, slidesPerView: "auto", centeredSlides: true, lazy: true, preloadImages: false, onSlideChange: handleSlide, style: { width: '100%', overflow: 'visible' }, children: jsx$2(SwiperSlide, { style: {
73919
+ width: '100%',
73920
+ display: 'flex',
73921
+ justifyContent: 'center',
73922
+ }, children: jsx$2("img", { className: "project-image", src: "/images/bills/default-slide.png" }) }, 0) }), jsx$2(Flex, { sx: { position: 'absolute', bottom: ['15px', '15px', '15px', '20px'], left: 'calc(50% - 28,5px)', zIndex: 2 }, children: [...Array(imagesLength)].map((_, i) => {
74177
73923
  return jsx$2(SwiperDots, { isActive: i === activeSlide, onClick: () => slideTo(i) }, i);
74178
73924
  }) })] }), jsxs(Flex, { sx: { alignItems: 'center', display: ['flex', 'flex', 'flex', 'none'], p: '10px', width: '100%' }, children: [jsxs(Flex, { sx: { width: ['50%', '50%', '50%', '100%'], alignItems: 'center' }, children: [jsx$2(Flex, { sx: { mr: '5px' }, children: jsx$2(TokenImage, { symbol: (_a = bondData.showcaseTokenName) !== null && _a !== void 0 ? _a : bondData.earnToken.symbol, size: 30, chain: bondData.chainId }) }), jsxs("h2", { className: "modal-tokenname-chainicon", sx: { margin: '0px' }, children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, ' '] })] }), jsx$2(Flex, { className: "modal-marketprice-header", sx: { justifyContent: 'flex-end', alignItems: 'center' }, children: jsxs("span", { className: "modal-marketprice", children: ["Market Price: $", earnTokenPrice(bondData)] }) }), jsx$2(Flex, { className: "bondmodal-header-alt", sx: { mb: '10px' }, children: jsx$2(BondModalHeaderAlt, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }) })] }), jsx$2(Flex, { className: "description-container paragraph-spaced", sx: { px: '10px', opacity: 0.7, mt: ['0', '0', '0', '10px'] }, children: jsx$2(ProjectDescription, { description: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription }) })] }));
74179
73925
  };
@@ -74953,7 +74699,7 @@ const RecommendationCards$1 = () => {
74953
74699
  color: 'grey',
74954
74700
  fontSize: ['11px'],
74955
74701
  fontWeight: 500,
74956
- }, children: "BONDS MARKETS:" }), jsx$2(RecommendationSelector, { options: options, activeOption: activeOption, setActiveOption: setActiveOption })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] }, children: jsx$2(Image$1, { width: 190, height: 20, alt: "poweredBy", src: "/images/bills/powered.png", sx: {
74702
+ }, children: "BONDS MARKETS:" }), jsx$2(RecommendationSelector, { options: options, activeOption: activeOption, setActiveOption: setActiveOption })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] }, children: jsx$2(Image, { width: 190, height: 20, alt: "poweredBy", src: "/images/bills/powered.png", sx: {
74957
74703
  width: '190px',
74958
74704
  height: '20px',
74959
74705
  cursor: 'pointer',
@@ -79268,9 +79014,9 @@ var Knob = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inPr
79268
79014
  Knob.displayName = 'Knob';
79269
79015
 
79270
79016
  /*!
79271
- * @kurkle/color v0.3.4
79017
+ * @kurkle/color v0.3.2
79272
79018
  * https://github.com/kurkle/color#readme
79273
- * (c) 2024 Jukka Kurkela
79019
+ * (c) 2023 Jukka Kurkela
79274
79020
  * Released under the MIT License
79275
79021
  */
79276
79022
  function round(v) {
@@ -79444,183 +79190,183 @@ function hslString(v) {
79444
79190
  }
79445
79191
 
79446
79192
  const map = {
79447
- x: 'dark',
79448
- Z: 'light',
79449
- Y: 're',
79450
- X: 'blu',
79451
- W: 'gr',
79452
- V: 'medium',
79453
- U: 'slate',
79454
- A: 'ee',
79455
- T: 'ol',
79456
- S: 'or',
79457
- B: 'ra',
79458
- C: 'lateg',
79459
- D: 'ights',
79460
- R: 'in',
79461
- Q: 'turquois',
79462
- E: 'hi',
79463
- P: 'ro',
79464
- O: 'al',
79465
- N: 'le',
79466
- M: 'de',
79467
- L: 'yello',
79468
- F: 'en',
79469
- K: 'ch',
79470
- G: 'arks',
79471
- H: 'ea',
79472
- I: 'ightg',
79473
- J: 'wh'
79193
+ x: 'dark',
79194
+ Z: 'light',
79195
+ Y: 're',
79196
+ X: 'blu',
79197
+ W: 'gr',
79198
+ V: 'medium',
79199
+ U: 'slate',
79200
+ A: 'ee',
79201
+ T: 'ol',
79202
+ S: 'or',
79203
+ B: 'ra',
79204
+ C: 'lateg',
79205
+ D: 'ights',
79206
+ R: 'in',
79207
+ Q: 'turquois',
79208
+ E: 'hi',
79209
+ P: 'ro',
79210
+ O: 'al',
79211
+ N: 'le',
79212
+ M: 'de',
79213
+ L: 'yello',
79214
+ F: 'en',
79215
+ K: 'ch',
79216
+ G: 'arks',
79217
+ H: 'ea',
79218
+ I: 'ightg',
79219
+ J: 'wh'
79474
79220
  };
79475
79221
  const names$1 = {
79476
- OiceXe: 'f0f8ff',
79477
- antiquewEte: 'faebd7',
79478
- aqua: 'ffff',
79479
- aquamarRe: '7fffd4',
79480
- azuY: 'f0ffff',
79481
- beige: 'f5f5dc',
79482
- bisque: 'ffe4c4',
79483
- black: '0',
79484
- blanKedOmond: 'ffebcd',
79485
- Xe: 'ff',
79486
- XeviTet: '8a2be2',
79487
- bPwn: 'a52a2a',
79488
- burlywood: 'deb887',
79489
- caMtXe: '5f9ea0',
79490
- KartYuse: '7fff00',
79491
- KocTate: 'd2691e',
79492
- cSO: 'ff7f50',
79493
- cSnflowerXe: '6495ed',
79494
- cSnsilk: 'fff8dc',
79495
- crimson: 'dc143c',
79496
- cyan: 'ffff',
79497
- xXe: '8b',
79498
- xcyan: '8b8b',
79499
- xgTMnPd: 'b8860b',
79500
- xWay: 'a9a9a9',
79501
- xgYF: '6400',
79502
- xgYy: 'a9a9a9',
79503
- xkhaki: 'bdb76b',
79504
- xmagFta: '8b008b',
79505
- xTivegYF: '556b2f',
79506
- xSange: 'ff8c00',
79507
- xScEd: '9932cc',
79508
- xYd: '8b0000',
79509
- xsOmon: 'e9967a',
79510
- xsHgYF: '8fbc8f',
79511
- xUXe: '483d8b',
79512
- xUWay: '2f4f4f',
79513
- xUgYy: '2f4f4f',
79514
- xQe: 'ced1',
79515
- xviTet: '9400d3',
79516
- dAppRk: 'ff1493',
79517
- dApskyXe: 'bfff',
79518
- dimWay: '696969',
79519
- dimgYy: '696969',
79520
- dodgerXe: '1e90ff',
79521
- fiYbrick: 'b22222',
79522
- flSOwEte: 'fffaf0',
79523
- foYstWAn: '228b22',
79524
- fuKsia: 'ff00ff',
79525
- gaRsbSo: 'dcdcdc',
79526
- ghostwEte: 'f8f8ff',
79527
- gTd: 'ffd700',
79528
- gTMnPd: 'daa520',
79529
- Way: '808080',
79530
- gYF: '8000',
79531
- gYFLw: 'adff2f',
79532
- gYy: '808080',
79533
- honeyMw: 'f0fff0',
79534
- hotpRk: 'ff69b4',
79535
- RdianYd: 'cd5c5c',
79536
- Rdigo: '4b0082',
79537
- ivSy: 'fffff0',
79538
- khaki: 'f0e68c',
79539
- lavFMr: 'e6e6fa',
79540
- lavFMrXsh: 'fff0f5',
79541
- lawngYF: '7cfc00',
79542
- NmoncEffon: 'fffacd',
79543
- ZXe: 'add8e6',
79544
- ZcSO: 'f08080',
79545
- Zcyan: 'e0ffff',
79546
- ZgTMnPdLw: 'fafad2',
79547
- ZWay: 'd3d3d3',
79548
- ZgYF: '90ee90',
79549
- ZgYy: 'd3d3d3',
79550
- ZpRk: 'ffb6c1',
79551
- ZsOmon: 'ffa07a',
79552
- ZsHgYF: '20b2aa',
79553
- ZskyXe: '87cefa',
79554
- ZUWay: '778899',
79555
- ZUgYy: '778899',
79556
- ZstAlXe: 'b0c4de',
79557
- ZLw: 'ffffe0',
79558
- lime: 'ff00',
79559
- limegYF: '32cd32',
79560
- lRF: 'faf0e6',
79561
- magFta: 'ff00ff',
79562
- maPon: '800000',
79563
- VaquamarRe: '66cdaa',
79564
- VXe: 'cd',
79565
- VScEd: 'ba55d3',
79566
- VpurpN: '9370db',
79567
- VsHgYF: '3cb371',
79568
- VUXe: '7b68ee',
79569
- VsprRggYF: 'fa9a',
79570
- VQe: '48d1cc',
79571
- VviTetYd: 'c71585',
79572
- midnightXe: '191970',
79573
- mRtcYam: 'f5fffa',
79574
- mistyPse: 'ffe4e1',
79575
- moccasR: 'ffe4b5',
79576
- navajowEte: 'ffdead',
79577
- navy: '80',
79578
- Tdlace: 'fdf5e6',
79579
- Tive: '808000',
79580
- TivedBb: '6b8e23',
79581
- Sange: 'ffa500',
79582
- SangeYd: 'ff4500',
79583
- ScEd: 'da70d6',
79584
- pOegTMnPd: 'eee8aa',
79585
- pOegYF: '98fb98',
79586
- pOeQe: 'afeeee',
79587
- pOeviTetYd: 'db7093',
79588
- papayawEp: 'ffefd5',
79589
- pHKpuff: 'ffdab9',
79590
- peru: 'cd853f',
79591
- pRk: 'ffc0cb',
79592
- plum: 'dda0dd',
79593
- powMrXe: 'b0e0e6',
79594
- purpN: '800080',
79595
- YbeccapurpN: '663399',
79596
- Yd: 'ff0000',
79597
- Psybrown: 'bc8f8f',
79598
- PyOXe: '4169e1',
79599
- saddNbPwn: '8b4513',
79600
- sOmon: 'fa8072',
79601
- sandybPwn: 'f4a460',
79602
- sHgYF: '2e8b57',
79603
- sHshell: 'fff5ee',
79604
- siFna: 'a0522d',
79605
- silver: 'c0c0c0',
79606
- skyXe: '87ceeb',
79607
- UXe: '6a5acd',
79608
- UWay: '708090',
79609
- UgYy: '708090',
79610
- snow: 'fffafa',
79611
- sprRggYF: 'ff7f',
79612
- stAlXe: '4682b4',
79613
- tan: 'd2b48c',
79614
- teO: '8080',
79615
- tEstN: 'd8bfd8',
79616
- tomato: 'ff6347',
79617
- Qe: '40e0d0',
79618
- viTet: 'ee82ee',
79619
- JHt: 'f5deb3',
79620
- wEte: 'ffffff',
79621
- wEtesmoke: 'f5f5f5',
79622
- Lw: 'ffff00',
79623
- LwgYF: '9acd32'
79222
+ OiceXe: 'f0f8ff',
79223
+ antiquewEte: 'faebd7',
79224
+ aqua: 'ffff',
79225
+ aquamarRe: '7fffd4',
79226
+ azuY: 'f0ffff',
79227
+ beige: 'f5f5dc',
79228
+ bisque: 'ffe4c4',
79229
+ black: '0',
79230
+ blanKedOmond: 'ffebcd',
79231
+ Xe: 'ff',
79232
+ XeviTet: '8a2be2',
79233
+ bPwn: 'a52a2a',
79234
+ burlywood: 'deb887',
79235
+ caMtXe: '5f9ea0',
79236
+ KartYuse: '7fff00',
79237
+ KocTate: 'd2691e',
79238
+ cSO: 'ff7f50',
79239
+ cSnflowerXe: '6495ed',
79240
+ cSnsilk: 'fff8dc',
79241
+ crimson: 'dc143c',
79242
+ cyan: 'ffff',
79243
+ xXe: '8b',
79244
+ xcyan: '8b8b',
79245
+ xgTMnPd: 'b8860b',
79246
+ xWay: 'a9a9a9',
79247
+ xgYF: '6400',
79248
+ xgYy: 'a9a9a9',
79249
+ xkhaki: 'bdb76b',
79250
+ xmagFta: '8b008b',
79251
+ xTivegYF: '556b2f',
79252
+ xSange: 'ff8c00',
79253
+ xScEd: '9932cc',
79254
+ xYd: '8b0000',
79255
+ xsOmon: 'e9967a',
79256
+ xsHgYF: '8fbc8f',
79257
+ xUXe: '483d8b',
79258
+ xUWay: '2f4f4f',
79259
+ xUgYy: '2f4f4f',
79260
+ xQe: 'ced1',
79261
+ xviTet: '9400d3',
79262
+ dAppRk: 'ff1493',
79263
+ dApskyXe: 'bfff',
79264
+ dimWay: '696969',
79265
+ dimgYy: '696969',
79266
+ dodgerXe: '1e90ff',
79267
+ fiYbrick: 'b22222',
79268
+ flSOwEte: 'fffaf0',
79269
+ foYstWAn: '228b22',
79270
+ fuKsia: 'ff00ff',
79271
+ gaRsbSo: 'dcdcdc',
79272
+ ghostwEte: 'f8f8ff',
79273
+ gTd: 'ffd700',
79274
+ gTMnPd: 'daa520',
79275
+ Way: '808080',
79276
+ gYF: '8000',
79277
+ gYFLw: 'adff2f',
79278
+ gYy: '808080',
79279
+ honeyMw: 'f0fff0',
79280
+ hotpRk: 'ff69b4',
79281
+ RdianYd: 'cd5c5c',
79282
+ Rdigo: '4b0082',
79283
+ ivSy: 'fffff0',
79284
+ khaki: 'f0e68c',
79285
+ lavFMr: 'e6e6fa',
79286
+ lavFMrXsh: 'fff0f5',
79287
+ lawngYF: '7cfc00',
79288
+ NmoncEffon: 'fffacd',
79289
+ ZXe: 'add8e6',
79290
+ ZcSO: 'f08080',
79291
+ Zcyan: 'e0ffff',
79292
+ ZgTMnPdLw: 'fafad2',
79293
+ ZWay: 'd3d3d3',
79294
+ ZgYF: '90ee90',
79295
+ ZgYy: 'd3d3d3',
79296
+ ZpRk: 'ffb6c1',
79297
+ ZsOmon: 'ffa07a',
79298
+ ZsHgYF: '20b2aa',
79299
+ ZskyXe: '87cefa',
79300
+ ZUWay: '778899',
79301
+ ZUgYy: '778899',
79302
+ ZstAlXe: 'b0c4de',
79303
+ ZLw: 'ffffe0',
79304
+ lime: 'ff00',
79305
+ limegYF: '32cd32',
79306
+ lRF: 'faf0e6',
79307
+ magFta: 'ff00ff',
79308
+ maPon: '800000',
79309
+ VaquamarRe: '66cdaa',
79310
+ VXe: 'cd',
79311
+ VScEd: 'ba55d3',
79312
+ VpurpN: '9370db',
79313
+ VsHgYF: '3cb371',
79314
+ VUXe: '7b68ee',
79315
+ VsprRggYF: 'fa9a',
79316
+ VQe: '48d1cc',
79317
+ VviTetYd: 'c71585',
79318
+ midnightXe: '191970',
79319
+ mRtcYam: 'f5fffa',
79320
+ mistyPse: 'ffe4e1',
79321
+ moccasR: 'ffe4b5',
79322
+ navajowEte: 'ffdead',
79323
+ navy: '80',
79324
+ Tdlace: 'fdf5e6',
79325
+ Tive: '808000',
79326
+ TivedBb: '6b8e23',
79327
+ Sange: 'ffa500',
79328
+ SangeYd: 'ff4500',
79329
+ ScEd: 'da70d6',
79330
+ pOegTMnPd: 'eee8aa',
79331
+ pOegYF: '98fb98',
79332
+ pOeQe: 'afeeee',
79333
+ pOeviTetYd: 'db7093',
79334
+ papayawEp: 'ffefd5',
79335
+ pHKpuff: 'ffdab9',
79336
+ peru: 'cd853f',
79337
+ pRk: 'ffc0cb',
79338
+ plum: 'dda0dd',
79339
+ powMrXe: 'b0e0e6',
79340
+ purpN: '800080',
79341
+ YbeccapurpN: '663399',
79342
+ Yd: 'ff0000',
79343
+ Psybrown: 'bc8f8f',
79344
+ PyOXe: '4169e1',
79345
+ saddNbPwn: '8b4513',
79346
+ sOmon: 'fa8072',
79347
+ sandybPwn: 'f4a460',
79348
+ sHgYF: '2e8b57',
79349
+ sHshell: 'fff5ee',
79350
+ siFna: 'a0522d',
79351
+ silver: 'c0c0c0',
79352
+ skyXe: '87ceeb',
79353
+ UXe: '6a5acd',
79354
+ UWay: '708090',
79355
+ UgYy: '708090',
79356
+ snow: 'fffafa',
79357
+ sprRggYF: 'ff7f',
79358
+ stAlXe: '4682b4',
79359
+ tan: 'd2b48c',
79360
+ teO: '8080',
79361
+ tEstN: 'd8bfd8',
79362
+ tomato: 'ff6347',
79363
+ Qe: '40e0d0',
79364
+ viTet: 'ee82ee',
79365
+ JHt: 'f5deb3',
79366
+ wEte: 'ffffff',
79367
+ wEtesmoke: 'f5f5f5',
79368
+ Lw: 'ffff00',
79369
+ LwgYF: '9acd32'
79624
79370
  };
79625
79371
  function unpack() {
79626
79372
  const unpacked = {};
@@ -91198,7 +90944,7 @@ function tryCreateCanvasRenderingTarget2D(binding, contextOptions) {
91198
90944
  * Copyright (c) 2024 TradingView, Inc.
91199
90945
  * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
91200
90946
  */
91201
- const e={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},r={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},h={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},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},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},o={color:"#26a69a",base:0},_={color:"#2196f3"},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 c,d;function 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 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 p(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function m(t){if(void 0===t)throw new Error("Value is undefined");return t}function b(t){if(null===t)throw new Error("Value is null");return t}function w(t){return b(m(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved";}(c||(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";}(d||(d={}));const 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 M(t){return t<0?0:t>255?255:Math.round(t)||0}function x(t){return t<=0||t>1?Math.min(Math.max(t,0),1):Math.round(1e4*t)/1e4}const S=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,k=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,y=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,C=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function T(t){(t=t.toLowerCase())in g&&(t=g[t]);{const i=C.exec(t)||y.exec(t);if(i)return [M(parseInt(i[1],10)),M(parseInt(i[2],10)),M(parseInt(i[3],10)),x(i.length<5?1:parseFloat(i[4]))]}{const i=k.exec(t);if(i)return [M(parseInt(i[1],16)),M(parseInt(i[2],16)),M(parseInt(i[3],16)),1]}{const i=S.exec(t);if(i)return [M(17*parseInt(i[1],16)),M(17*parseInt(i[2],16)),M(17*parseInt(i[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function P(t){const i=T(t);return {t:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,i:(n=i,.199*n[0]+.687*n[1]+.114*n[2]>160?"black":"white")};var n;}class R{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 D(t,...i){for(const n of i)for(const i in n)void 0!==n[i]&&("object"!=typeof n[i]||void 0===t[i]||Array.isArray(n[i])?t[i]=n[i]:D(t[i],n[i]));return t}function O(t){return "number"==typeof t&&isFinite(t)}function A(t){return "number"==typeof t&&t%1==0}function B(t){return "string"==typeof t}function V(t){return "boolean"==typeof t}function I(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?I(e):e);return n}function z(t){return null!==t}function L(t){return null===t?void 0:t}const E="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function N(t,i,n){return void 0===i&&(i=E),`${n=void 0!==n?`${n} `:""}${t}px ${i}`}class F{constructor(t){this.k={C:1,T:5,P:NaN,R:"",D:"",O:"",A:"",B:0,V: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=N(i,n),t.L=2.5/12*i,t.B=t.L,t.V=i/12*t.T,t.I=i/12*t.T,t.N=0),t.O=this.$(),t.A=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 W{constructor(){this.Y=[];}X(t){this.Y=t;}K(t,i,n){this.Y.forEach((s=>{s.K(t,i,n);}));}}class j{K(t,i,n){t.useBitmapCoordinateSpace((t=>this.Z(t,i,n)));}}class H extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z({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 $(){return {it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const U={from:0,to:1};class q{constructor(t,i){this.ut=new W,this.ct=[],this.dt=[],this.ft=!0,this.F=t,this.vt=i,this.ut.X(this.ct);}bt(t){const i=this.F.wt();i.length!==this.ct.length&&(this.dt=i.map($),this.ct=this.dt.map((t=>{const i=new H;return i.J(t),i})),this.ut.X(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=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.Ot),h.rt=null!==(r=l.At)&&void 0!==r?r:this.F.Bt(h.it[0].st/i.Dt().Vt()),h.it[0].ot=n,h.it[0].nt=s.It(n),h.tt=U;}));}}class Y extends j{constructor(t){super(),this.zt=t;}Z({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.O,t.fillStyle=this.zt.Lt.O,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.O,t.fillStyle=this.zt.Et.O,f(t,this.zt.Et.Nt),v(t,l,0,i.width));}}class X{constructor(t){this.ft=!0,this.Ft={Lt:{et:1,Nt:0,O:"",yt:!1},Et:{et:1,Nt:0,O:"",yt:!1},nt:0,st:0},this.Wt=new Y(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=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.O=n.horzLine.color,s.Lt.et=n.vertLine.width,s.Lt.Nt=n.vertLine.style,s.Lt.O=n.vertLine.color,s.nt=this.jt.Yt(),s.st=this.jt.Xt();}}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 Z(t,i,n,s,e,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,n,s,e),t.restore();}function G(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 J(t,i,n,s,e,r,h=0,l=[0,0,0,0],a=""){if(t.save(),!h||!a||a===r)return G(t,i,n,s,e,l),t.fillStyle=r,t.fill(),void t.restore();const o=h/2;var _;G(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 Q(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 tt{constructor(t,i){this.J(t,i);}J(t,i){this.zt=t,this.Kt=i;}Vt(t,i){return this.zt.yt?t.P+t.L+t.B:0}K(t,i,n,s){if(!this.zt.yt||0===this.zt.Zt.length)return;const e=this.zt.O,r=this.Kt.t,h=t.useBitmapCoordinateSpace((t=>{const h=t.context;h.font=i.R;const l=this.Gt(t,i,n,s),a=l.Jt,o=(t,i)=>{l.Qt?J(h,a.ti,a.ii,a.ni,a.si,t,a.ei,[a.ht,0,0,a.ht],i):J(h,a.ri,a.ii,a.ni,a.si,t,a.ei,[0,a.ht,a.ht,0],i);};return o(r,"transparent"),this.zt.hi&&(h.fillStyle=e,h.fillRect(a.ri,a.li,a.ai-a.ri,a.oi)),o("transparent",r),this.zt._i&&(h.fillStyle=i.A,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.Zt,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.Kt.wi,d=i.B+this.Kt.gi,f=i.V,v=i.I,p=this.zt.Zt,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.Kt.Si)&&void 0!==e?e:this.Kt.ki,P=Math.round(T*o)-Math.floor(.5*o),R=Math.floor(P+x/2-S/2),D=R+S,O="right"===s,A=O?l.width-u:u,B=O?h.width-k:k;let V,I,z;return O?(V=B-y,I=B-C,z=A-_-f-u):(V=B+y,I=B+C,z=A+_+f),{Qt:O,Jt:{ii:R,li:P,ci:D,ni:y,si:S,ht:2*a,ei:k,ti:V,ri:B,ai:I,oi:x,ui:h.width},di:{ii:R/o,ci:D/o,fi:z,pi:b}}}}class it{constructor(t){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Zt:"",yt:!1,hi:!0,mi:!1,At:"",O:"#FFF",_i:!1,bi:!1},this.Ti={Zt:"",yt:!1,hi:!1,mi:!0,At:"",O:"#FFF",_i:!0,bi:!0},this.ft=!0,this.Pi=new(t||tt)(this.Ci,this.yi),this.Ri=new(t||tt)(this.Ti,this.yi);}Zt(){return this.Di(),this.Ci.Zt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0;}Vt(t,i=!1){return Math.max(this.Pi.Vt(t,i),this.Ri.Vt(t,i))}Oi(){return this.yi.Si||0}Ai(t){this.yi.Si=t;}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Vi(){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 nt extends it{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=P(s.labelBackgroundColor);n.t=r.t,t.O=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.Zt=this.Li.Fi(l._t,e),t.yt=!0;}}const st=/[1-9]/g;class et{constructor(){this.zt=null;}J(t){this.zt=t;}K(t,i){if(null===this.zt||!1===this.zt.yt||0===this.zt.Zt.length)return;const n=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.R,Math.round(i.Wi.xi(t,b(this.zt).Zt,st)))));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=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.O;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=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.O;const r=i.Wi.Mi(t,"Apr0");t.translate(a+s,e+r),t.fillText(n.Zt,0,0);}));}}class rt{constructor(t,i,n){this.ft=!0,this.Wt=new et,this.Ft={yt:!1,t:"#4c525e",O:"white",Zt:"",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.Zt=n.qi(b(e)),t.yt=!0;const r=P(i.labelBackgroundColor);t.t=r.t,t.O=r.i,t.hi=n.W().ticksVisible;}}class ht{constructor(){this.Yi=null,this.Xi=0;}Ki(){return this.Xi}Zi(t){this.Xi=t;}Dt(){return this.Yi}Gi(t){this.Yi=t;}Ji(t){return []}Qi(){return []}yt(){return !0}}var lt;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden";}(lt||(lt={}));class at extends ht{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 q(t,this);this.fn=((t,i)=>n=>{const s=i(),e=t();if(n===b(this.tn).vn())return {_t:e,ki:s};{const t=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 rt(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}Xt(){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}On(){this.wn.bt(),this.rn.forEach((t=>t.bt())),this.bn.bt(),this.dn.bt();}An(t){return t&&!t.vn().Ni()?t.vn():null}yn(t,i,n){this.Bn(t,i,n)&&this.On();}Bn(t,i,n){const s=this.ln,e=this.an,r=this.nn,h=this.sn,l=this.tn,a=this.An(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().Vn())).filter(z),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 nt(this,i,n),t.set(i,s)),s}}function ot(t){return "left"===t||"right"===t}class _t{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,Ot:t}];}Xn(t){this.Kn(),this.Ln.push({qn:5,Ot:t});}Un(){this.Kn(),this.Ln.push({qn:6});}Zn(){this.Un(),this.Ln=[{qn:4}];}Gn(t){this.Un(),this.Ln.push({qn:2,Ot:t});}Jn(t){this.Un(),this.Ln.push({qn:3,Ot: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 _t(2)}static es(){return new _t(3)}ns(t){switch(t.qn){case 0:this.$n();break;case 1:this.Yn(t.Ot);break;case 2:this.Gn(t.Ot);break;case 3:this.Jn(t.Ot);break;case 4:this.Zn();break;case 5:this.Xn(t.Ot);break;case 6:this.Kn();}}Kn(){const t=this.Ln.findIndex((t=>5===t.qn));-1!==t&&this.Ln.splice(t,1);}}const ut=".";function ct(t,i){if(!O(t))return "n/a";if(!A(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 dt{constructor(t,i){if(i||(i=1),O(t)&&A(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.os=0,this.Li>0&&this.rs>0){let t=this.Li;for(;t>1;)t/=10,this.os++;}}ls(t){const i=this.Li/this.rs;let n=Math.floor(t),s="";const e=void 0!==this.os?this.os:NaN;if(i>1){let r=+(Math.round(t*i)-n*i).toFixed(this.os);r>=i&&(r-=i,n+=1),s=ut+ct(+r.toFixed(this.os)*this.rs,e);}else n=Math.round(n*i)/i,e>0&&(s=ut+ct(0,e));return n.toFixed(0)+s}}class ft extends dt{constructor(t=100){super(t);}format(t){return `${super.format(t)}%`}}class vt{constructor(t){this._s=t;}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.us(t):t<999995?i+this.us(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this.us(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.us(t/1e9)+"B")}us(t){let i;const n=Math.pow(10,this._s);return i=(t=Math.round(t*n)/n)>=1e-15&&t<1?t.toFixed(this._s).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}function pt(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]=gt(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 mt=6;function bt(t,i){return {nt:t.nt-i.nt,st:t.st-i.st}}function wt(t,i){return {nt:t.nt/i,st:t.st/i}}function gt(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=wt(bt(t[n],t[s]),mt),{nt:r.nt+h.nt,st:r.st+h.st}),bt(t[n],wt(bt(t[e],t[i]),mt))]}function Mt(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 xt extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z(t){var i;if(null===this.G)return;const{it:n,tt:s,cs:e,et:r,Nt:h,ds:l}=this.G,a=null!==(i=this.G.fs)&&void 0!==i?i:this.G.vs?0:t.mediaSize.height;if(null===s)return;const o=t.context;o.lineCap="butt",o.lineJoin="round",o.lineWidth=r,f(o,h),o.lineWidth=1,pt(t,n,l,s,e,this.ps.bind(this),Mt.bind(null,a));}}function St(t,i,n){return Math.min(Math.max(t,i),n)}function kt(t,i,n){return i-t<=n}function yt(t){const i=Math.ceil(t);return i%2==0?i-1:i}class Ct{bs(t,i){const n=this.ws,{gs:s,Ms:e,xs:r,Ss:h,ks:l,fs:a}=i;if(void 0===this.ys||void 0===n||n.gs!==s||n.Ms!==e||n.xs!==r||n.Ss!==h||n.fs!==a||n.ks!==l){const n=t.context.createLinearGradient(0,0,0,l);if(n.addColorStop(0,s),null!=a){const i=St(a*t.verticalPixelRatio/l,0,1);n.addColorStop(i,e),n.addColorStop(i,r);}n.addColorStop(1,h),this.ys=n,this.ws=i;}return this.ys}}class Tt extends xt{constructor(){super(...arguments),this.Cs=new Ct;}ps(t,i){return this.Cs.bs(t,{gs:i.Ts,Ms:"",xs:"",Ss:i.Ps,ks:t.bitmapSize.height})}}function Pt(t,i){const n=t.context;n.strokeStyle=i,n.stroke();}class Rt extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z(t){if(null===this.G)return;const{it:i,tt:n,cs:s,ds:e,et:r,Nt:h,Rs:l}=this.G;if(null===n)return;const a=t.context;a.lineCap="butt",a.lineWidth=r*t.verticalPixelRatio,f(a,h),a.lineJoin="round";const o=this.Ds.bind(this);void 0!==e&&pt(t,i,e,n,s,o,Pt),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 Dt extends Rt{Ds(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 At=Ot.bind(null,!0),Bt=Ot.bind(null,!1);function Vt(t,i){return t.ot<i}function It(t,i){return i<t.ot}function zt(t,i,n){const s=i.Os(),e=i.ui(),r=At(t,s,Vt),h=Bt(t,e,It);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 Lt{constructor(t,i,n){this.As=!0,this.Bs=!0,this.Vs=!0,this.Is=[],this.zs=null,this.Ls=t,this.Es=i,this.Ns=n;}bt(t){this.As=!0,"data"===t&&(this.Bs=!0),"options"===t&&(this.Vs=!0);}gt(){return this.Ls.yt()?(this.Fs(),null===this.zs?null:this.Ws):null}js(){this.Is=this.Is.map((t=>Object.assign(Object.assign({},t),this.Ls.$s().Hs(t.ot))));}Us(){this.zs=null;}Fs(){this.Bs&&(this.qs(),this.Bs=!1),this.Vs&&(this.js(),this.Vs=!1),this.As&&(this.Ys(),this.As=!1);}Ys(){const t=this.Ls.Dt(),i=this.Es.St();if(this.Us(),i.Ni()||t.Ni())return;const n=i.Xs();if(null===n)return;if(0===this.Ls.In().Ks())return;const s=this.Ls.Ct();null!==s&&(this.zs=zt(this.Is,n,this.Ns),this.Zs(t,i,s.Ot),this.Gs());}}class Et extends Lt{constructor(t,i){super(t,i,!0);}Zs(t,i,n){i.Js(this.Is,L(this.zs)),t.Qs(this.Is,n,L(this.zs));}te(t,i){return {ot:t,_t:i,nt:NaN,st:NaN}}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>{const n=i.Ot[3];return this.ne(i.se,n,t)}));}}class Nt extends Et{constructor(t,i){super(t,i),this.Ws=new W,this.ee=new Tt,this.re=new Dt,this.Ws.X([this.ee,this.re]);}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.W();this.ee.J({ds:t.lineType,it:this.Is,Nt:t.lineStyle,et:t.lineWidth,fs:null,vs:t.invertFilledArea,tt:this.zs,cs:this.Es.St().he()}),this.re.J({ds:t.lineVisible?t.lineType:void 0,it:this.Is,Nt:t.lineStyle,et:t.lineWidth,tt:this.zs,cs:this.Es.St().he(),Rs:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0});}}class Ft extends j{constructor(){super(...arguments),this.zt=null,this.le=0,this.ae=0;}J(t){this.zt=t;}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;if(this.le=this.oe(i),this.le>=2){Math.max(1,Math.floor(i))%2!=this.le%2&&this.le--;}this.ae=this.zt._e?Math.min(this.le,Math.floor(i)):this.le;let s=null;const e=this.ae<=this.le&&this.zt.he>=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.ue&&(t.fillStyle=h.ue,s=h.ue);const l=Math.floor(.5*this.ae),a=Math.round(h.nt*i),o=a-l,_=this.ae,u=o+_-1,c=Math.min(h.ce,h.de),d=Math.max(h.ce,h.de),f=Math.round(c*n)-l,v=Math.round(d*n)+l,p=Math.max(v-f,this.ae);t.fillRect(o,f,_,p);const m=Math.ceil(1.5*this.le);if(e){if(this.zt.fe){const i=a-m;let s=Math.max(f,Math.round(h.ve*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.pe*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);}}}oe(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(b(this.zt).he,t)))}}class Wt extends Lt{constructor(t,i){super(t,i,!1);}Zs(t,i,n){i.Js(this.Is,L(this.zs)),t.me(this.Is,n,L(this.zs));}be(t,i,n){return {ot:t,we:i.Ot[0],ge:i.Ot[1],Me:i.Ot[2],xe:i.Ot[3],nt:NaN,ve:NaN,ce:NaN,de:NaN,pe:NaN}}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>this.ne(i.se,i,t)));}}class jt extends Wt{constructor(){super(...arguments),this.Ws=new Ft;}ne(t,i,n){return Object.assign(Object.assign({},this.be(t,i,n)),n.Hs(t))}Gs(){const t=this.Ls.W();this.Ws.J({In:this.Is,he:this.Es.St().he(),fe:t.openVisible,_e:t.thinBars,tt:this.zs});}}class Ht extends xt{constructor(){super(...arguments),this.Cs=new Ct;}ps(t,i){const n=this.G;return this.Cs.bs(t,{gs:i.Se,Ms:i.ke,xs:i.ye,Ss:i.Ce,ks:t.bitmapSize.height,fs:n.fs})}}class $t extends Rt{constructor(){super(...arguments),this.Te=new Ct;}Ds(t,i){const n=this.G;return this.Te.bs(t,{gs:i.Pe,Ms:i.Pe,xs:i.Re,Ss:i.Re,ks:t.bitmapSize.height,fs:n.fs})}}class Ut extends Et{constructor(t,i){super(t,i),this.Ws=new W,this.De=new Ht,this.Oe=new $t,this.Ws.X([this.De,this.Oe]);}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.Ct();if(null===t)return;const i=this.Ls.W(),n=this.Ls.Dt().Rt(i.baseValue.price,t.Ot),s=this.Es.St().he();this.De.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineType,fs:n,vs:!1,tt:this.zs,cs:s}),this.Oe.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineVisible?i.lineType:void 0,Rs:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0,fs:n,tt:this.zs,cs:s});}}class qt extends j{constructor(){super(...arguments),this.zt=null,this.le=0;}J(t){this.zt=t;}Z(t){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;const{horizontalPixelRatio:i}=t;if(this.le=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.he,i),this.le>=2){Math.floor(i)%2!=this.le%2&&this.le--;}const n=this.zt.In;this.zt.Ae&&this.Be(t,n,this.zt.tt),this.zt._i&&this.Ve(t,n,this.zt.tt);const s=this.Ie(i);(!this.zt._i||this.le>2*s)&&this.ze(t,n,this.zt.tt);}Be(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.he*e));l=Math.max(Math.floor(e),Math.min(l,this.le));const a=Math.floor(.5*l);let o=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Le!==h&&(s.fillStyle=n.Le,h=n.Le);const _=Math.round(Math.min(n.ve,n.pe)*r),u=Math.round(Math.max(n.ve,n.pe)*r),c=Math.round(n.ce*r),d=Math.round(n.de*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;}}Ie(t){let i=Math.floor(1*t);this.le<=2*i&&(i=Math.floor(.5*(this.le-1)));const n=Math.max(Math.floor(t),i);return this.le<=2*n?Math.max(Math.floor(t),Math.floor(1*t)):n}Ve(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.Ie(e);let a=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Ee!==h&&(s.fillStyle=n.Ee,h=n.Ee);let o=Math.round(n.nt*e)-Math.floor(.5*this.le);const _=o+this.le-1,u=Math.round(Math.min(n.ve,n.pe)*r),c=Math.round(Math.max(n.ve,n.pe)*r);if(null!==a&&(o=Math.max(a+1,o),o=Math.min(o,_)),this.zt.he*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=_;}}ze(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.Ie(e);for(let t=n.from;t<n.to;t++){const n=i[t];let a=Math.round(Math.min(n.ve,n.pe)*r),o=Math.round(Math.max(n.ve,n.pe)*r),_=Math.round(n.nt*e)-Math.floor(.5*this.le),u=_+this.le-1;if(n.ue!==h){const t=n.ue;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 Yt extends Wt{constructor(){super(...arguments),this.Ws=new qt;}ne(t,i,n){return Object.assign(Object.assign({},this.be(t,i,n)),n.Hs(t))}Gs(){const t=this.Ls.W();this.Ws.J({In:this.Is,he:this.Es.St().he(),Ae:t.wickVisible,_i:t.borderVisible,tt:this.zs});}}class Xt{constructor(t,i){this.Ne=t,this.Li=i;}K(t,i,n){this.Ne.draw(t,this.Li,i,n);}}class Kt extends Lt{constructor(t,i,n){super(t,i,!1),this.wn=n,this.Ws=new Xt(this.wn.renderer(),(i=>{const n=t.Ct();return null===n?null:t.Dt().Rt(i,n.Ot)}));}Fe(t){return this.wn.priceValueBuilder(t)}We(t){return this.wn.isWhitespace(t)}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>Object.assign(Object.assign({ot:i.se,nt:NaN},t.Hs(i.se)),{je:i.He})));}Zs(t,i){i.Js(this.Is,L(this.zs));}Gs(){this.wn.update({bars:this.Is.map(Zt),barSpacing:this.Es.St().he(),visibleRange:this.zs},this.Ls.W());}}function Zt(t){return {x:t.nt,time:t.ot,originalData:t.je,barColor:t.ue}}class Gt extends j{constructor(){super(...arguments),this.zt=null,this.$e=[];}J(t){this.zt=t,this.$e=[];}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return;this.$e.length||this.Ue(i);const s=Math.max(1,Math.floor(n)),e=Math.round(this.zt.qe*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.$e[i-this.zt.tt.from],a=Math.round(h.st*n);let o,_;t.fillStyle=h.ue,a<=e?(o=a,_=r):(o=e,_=a-Math.floor(s/2)+s),t.fillRect(l.Os,o,l.ui-l.Os+1,_-o);}}Ue(t){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return void(this.$e=[]);const i=Math.ceil(this.zt.he*t)<=1?0:Math.max(1,Math.floor(t)),n=Math.round(this.zt.he*t)-i;this.$e=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.$e[i-this.zt.tt.from]={Os:r,ui:h,Ye: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.$e[t-this.zt.tt.from],s=this.$e[t-this.zt.tt.from-1];n.ot===s.ot+1&&(n.Os-s.ui!==i+1&&(s.Ye>s.Xe?s.ui=n.Os-i-1:n.Os=s.ui+i+1));}let s=Math.ceil(this.zt.he*t);for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.$e[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.$e[t-this.zt.tt.from];i.ui-i.Os+1>s&&(i.Ye>i.Xe?i.ui-=1:i.Os+=1);}}}class Jt extends Et{constructor(){super(...arguments),this.Ws=new Gt;}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t={it:this.Is,he:this.Es.St().he(),tt:this.zs,qe:this.Ls.Dt().Rt(this.Ls.W().base,b(this.Ls.Ct()).Ot)};this.Ws.J(t);}}class Qt extends Et{constructor(){super(...arguments),this.Ws=new Dt;}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.W(),i={it:this.Is,Nt:t.lineStyle,ds:t.lineVisible?t.lineType:void 0,et:t.lineWidth,Rs:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,tt:this.zs,cs:this.Es.St().he()};this.Ws.J(i);}}const ti=/[2-9]/g;class ii{constructor(t=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Je={},this.Qe=new Map,this.tr=t;}ir(){this.Ke=0,this.Qe.clear(),this.Ze=1,this.Ge=1,this.Je={};}xi(t,i,n){return this.nr(t,i,n).width}Mi(t,i,n){const s=this.nr(t,i,n);return ((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}nr(t,i,n){const s=n||ti,e=String(i).replace(s,"0");if(this.Qe.has(e))return m(this.Qe.get(e)).sr;if(this.Ke===this.tr){const t=this.Je[this.Ge];delete this.Je[this.Ge],this.Qe.delete(t),this.Ge++,this.Ke--;}t.save(),t.textBaseline="middle";const r=t.measureText(e);return t.restore(),0===r.width&&i.length||(this.Qe.set(e,{sr:r,er:this.Ze}),this.Je[this.Ze]=e,this.Ke++,this.Ze++),r}}class ni{constructor(t){this.rr=null,this.k=null,this.hr="right",this.lr=t;}ar(t,i,n){this.rr=t,this.k=i,this.hr=n;}K(t){null!==this.k&&null!==this.rr&&this.rr.K(t,this.k,this.lr,this.hr);}}class si{constructor(t,i,n){this._r=t,this.lr=new ii(50),this.ur=i,this.F=n,this.j=-1,this.Wt=new ni(this.lr);}gt(){const t=this.F.cr(this.ur);if(null===t)return null;const i=t.dr(this.ur)?t.vr():this.ur.Dt();if(null===i)return null;const n=t.pr(i);if("overlay"===n)return null;const s=this.F.mr();return s.P!==this.j&&(this.j=s.P,this.lr.ir()),this.Wt.ar(this._r.Ii(),s,n),this.Wt}}class ei extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}br(t,i){var n;if(!(null===(n=this.zt)||void 0===n?void 0:n.yt))return null;const{st:s,et:e,wr:r}=this.zt;return i>=s-e-7&&i<=s+e+7?{gr:this.zt,wr:r}:null}Z({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.O,t.lineWidth=Math.floor(this.zt.et*n),f(t,this.zt.Nt),v(t,e,0,i.width));}}class ri{constructor(t){this.Mr={st:0,O:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.Sr=new ei,this.ft=!0,this.Ls=t,this.Es=t.$t(),this.Sr.J(this.Mr);}bt(){this.ft=!0;}gt(){return this.Ls.yt()?(this.ft&&(this.kr(),this.ft=!1),this.Sr):null}}class hi extends ri{constructor(t){super(t);}kr(){this.Mr.yt=!1;const t=this.Ls.Dt(),i=t.yr().yr;if(2!==i&&3!==i)return;const n=this.Ls.W();if(!n.baseLineVisible||!this.Ls.yt())return;const s=this.Ls.Ct();null!==s&&(this.Mr.yt=!0,this.Mr.st=t.Rt(s.Ot,s.Ot),this.Mr.O=n.baseLineColor,this.Mr.et=n.baseLineWidth,this.Mr.Nt=n.baseLineStyle);}}class li extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}He(){return this.zt}Z({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.Cr,t.beginPath();const a=Math.max(2,1.5*s.Tr)*i;t.arc(h,l,a,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.Pr,t.beginPath(),t.arc(h,l,s.ht*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=e,t.strokeStyle=s.Rr,t.beginPath(),t.arc(h,l,s.ht*i+e/2,0,2*Math.PI,!1),t.stroke();}}const ai=[{Dr:0,Or:.25,Ar:4,Br:10,Vr:.25,Ir:0,zr:.4,Lr:.8},{Dr:.25,Or:.525,Ar:10,Br:14,Vr:0,Ir:0,zr:.8,Lr:0},{Dr:.525,Or:1,Ar:14,Br:14,Vr:0,Ir:0,zr:0,Lr:0}];function oi(t,i,n,s){return function(t,i){if("transparent"===t)return t;const n=T(t),s=n[3];return `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i*s})`}(t,n+(s-n)*i)}function _i(t,i){const n=t%2600/2600;let s;for(const t of ai)if(n>=t.Dr&&n<=t.Or){s=t;break}p(void 0!==s,"Last price animation internal logic error");const e=(n-s.Dr)/(s.Or-s.Dr);return {Pr:oi(i,e,s.Vr,s.Ir),Rr:oi(i,e,s.zr,s.Lr),ht:(r=e,h=s.Ar,l=s.Br,h+(l-h)*r)};var r,h,l;}class ui{constructor(t){this.Wt=new li,this.ft=!0,this.Er=!0,this.Nr=performance.now(),this.Fr=this.Nr-1,this.Wr=t;}jr(){this.Fr=this.Nr-1,this.bt();}Hr(){if(this.bt(),2===this.Wr.W().lastPriceAnimation){const t=performance.now(),i=this.Fr-t;if(i>0)return void(i<650&&(this.Fr+=2600));this.Nr=t,this.Fr=t+2600;}}bt(){this.ft=!0;}$r(){this.Er=!0;}yt(){return 0!==this.Wr.W().lastPriceAnimation}Ur(){switch(this.Wr.W().lastPriceAnimation){case 0:return !1;case 1:return !0;case 2:return performance.now()<=this.Fr}}gt(){return this.ft?(this.Mt(),this.ft=!1,this.Er=!1):this.Er&&(this.qr(),this.Er=!1),this.Wt}Mt(){this.Wt.J(null);const t=this.Wr.$t().St(),i=t.Xs(),n=this.Wr.Ct();if(null===i||null===n)return;const s=this.Wr.Yr(!0);if(s.Xr||!i.Kr(s.se))return;const e={x:t.It(s.se),y:this.Wr.Dt().Rt(s._t,n.Ot)},r=s.O,h=this.Wr.W().lineWidth,l=_i(this.Zr(),r);this.Wt.J({Cr:r,Tr:h,Pr:l.Pr,Rr:l.Rr,ht:l.ht,Xe:e});}qr(){const t=this.Wt.He();if(null!==t){const i=_i(this.Zr(),t.Cr);t.Pr=i.Pr,t.Rr=i.Rr,t.ht=i.ht;}}Zr(){return this.Ur()?performance.now()-this.Nr:2599}}function ci(t,i){return yt(Math.min(Math.max(t,12),30)*i)}function di(t,i){switch(t){case"arrowDown":case"arrowUp":return ci(i,1);case"circle":return ci(i,.8);case"square":return ci(i,.7)}}function fi(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(ci(t,1))}function vi$1(t){return Math.max(ci(t,.1),3)}function pi(t,i,n){return i?t:n?Math.ceil(t/2):0}function mi(t,i,n,s,e){const r=di("square",n),h=(r-1)/2,l=t-h,a=i-h;return s>=l&&s<=l+r&&e>=a&&e<=a+r}function bi(t,i,n,s){const e=(di("arrowUp",s)-1)/2*n.Gr,r=(yt(s/2)-1)/2*n.Gr;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 wi(t,i,n,s,e,r){return mi(i,n,s,e,r)}class gi extends j{constructor(){super(...arguments),this.zt=null,this.lr=new ii,this.j=-1,this.H="",this.Jr="";}J(t){this.zt=t;}ar(t,i){this.j===t&&this.H===i||(this.j=t,this.H=i,this.Jr=N(t,i),this.lr.ir());}br(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(xi(s,t,i))return {gr:s.Qr,wr:s.wr}}return null}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n},s,e){if(null!==this.zt&&null!==this.zt.tt){t.textBaseline="middle",t.font=this.Jr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const e=this.zt.it[s];void 0!==e.Zt&&(e.Zt.Hi=this.lr.xi(t,e.Zt.th),e.Zt.Vt=this.j,e.Zt.nt=e.nt-e.Zt.Hi/2),Mi(e,t,i,n);}}}}function Mi(t,i,n,s){i.fillStyle=t.O,void 0!==t.Zt&&function(t,i,n,s,e,r){t.save(),t.scale(e,r),t.fillText(i,n,s),t.restore();}(i,t.Zt.th,t.Zt.nt,t.Zt.st,n,s),function(t,i,n){if(0===t.Ks)return;switch(t.ih){case"arrowDown":return void bi(!1,i,n,t.Ks);case"arrowUp":return void bi(!0,i,n,t.Ks);case"circle":return void function(t,i,n){const s=(di("circle",n)-1)/2;t.beginPath(),t.arc(i.nt,i.st,s*i.Gr,0,2*Math.PI,!1),t.fill();}(i,n,t.Ks);case"square":return void function(t,i,n){const s=di("square",n),e=(s-1)*i.Gr/2,r=i.nt-e,h=i.st-e;t.fillRect(r,h,s*i.Gr,s*i.Gr);}(i,n,t.Ks)}t.ih;}(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,Gr:i}}(t,n,s));}function xi(t,i,n){return !(void 0===t.Zt||!function(t,i,n,s,e,r){const h=s/2;return e>=t&&e<=t+n&&r>=i-h&&r<=i+h}(t.Zt.nt,t.Zt.st,t.Zt.Hi,t.Zt.Vt,i,n))||function(t,i,n){if(0===t.Ks)return !1;switch(t.ih){case"arrowDown":case"arrowUp":return wi(0,t.nt,t.st,t.Ks,i,n);case"circle":return function(t,i,n,s,e){const r=2+di("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 mi(t.nt,t.st,t.Ks,i,n)}}(t,i,n)}function Si(t,i,n,s,e,r,h,l,a){const o=O(n)?n:n.xe,_=O(n)?n:n.ge,u=O(n)?n:n.Me,c=O(i.size)?Math.max(i.size,0):1,d=fi(l.he())*c,f=d/2;switch(t.Ks=d,i.position){case"inBar":return t.st=h.Rt(o,a),void(void 0!==t.Zt&&(t.Zt.st=t.st+f+r+.6*e));case"aboveBar":return t.st=h.Rt(_,a)-f-s.nh,void 0!==t.Zt&&(t.Zt.st=t.st-f-.6*e,s.nh+=1.2*e),void(s.nh+=d+r);case"belowBar":return t.st=h.Rt(u,a)+f+s.sh,void 0!==t.Zt&&(t.Zt.st=t.st+f+r+.6*e,s.sh+=1.2*e),void(s.sh+=d+r)}i.position;}class ki{constructor(t,i){this.ft=!0,this.eh=!0,this.rh=!0,this.hh=null,this.ah=null,this.Wt=new gi,this.Wr=t,this.$i=i,this.zt={it:[],tt:null};}bt(t){this.ft=!0,this.rh=!0,"data"===t&&(this.eh=!0,this.ah=null);}gt(t){if(!this.Wr.yt())return null;this.ft&&this.oh();const i=this.$i.W().layout;return this.Wt.ar(i.fontSize,i.fontFamily),this.Wt.J(this.zt),this.Wt}_h(){if(this.rh){if(this.Wr.uh().length>0){const t=this.$i.St().he(),i=vi$1(t),n=1.5*fi(t)+2*i,s=this.dh();this.hh={above:pi(n,s.aboveBar,s.inBar),below:pi(n,s.belowBar,s.inBar)};}else this.hh=null;this.rh=!1;}return this.hh}dh(){return null===this.ah&&(this.ah=this.Wr.uh().reduce(((t,i)=>(t[i.position]||(t[i.position]=!0),t)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.ah}oh(){const t=this.Wr.Dt(),i=this.$i.St(),n=this.Wr.uh();this.eh&&(this.zt.it=n.map((t=>({ot:t.time,nt:0,st:0,Ks:0,ih:t.shape,O:t.color,Qr:t.Qr,wr:t.id,Zt:void 0}))),this.eh=!1);const s=this.$i.W().layout;this.zt.tt=null;const e=i.Xs();if(null===e)return;const r=this.Wr.Ct();if(null===r)return;if(0===this.zt.it.length)return;let h=NaN;const l=vi$1(i.he()),a={nh:l,sh:l};this.zt.tt=zt(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.nh=l,a.sh=l,h=o.time);const _=this.zt.it[e];_.nt=i.It(o.time),void 0!==o.text&&o.text.length>0&&(_.Zt={th:o.text,nt:0,st:0,Hi:0,Vt:0});const u=this.Wr.fh(o.time);null!==u&&Si(_,o,u,a,s.fontSize,l,t,i,r.Ot);}this.ft=!1;}}class yi extends ri{constructor(t){super(t);}kr(){const t=this.Mr;t.yt=!1;const i=this.Ls.W();if(!i.priceLineVisible||!this.Ls.yt())return;const n=this.Ls.Yr(0===i.priceLineSource);n.Xr||(t.yt=!0,t.st=n.ki,t.O=this.Ls.ph(n.O),t.et=i.priceLineWidth,t.Nt=i.priceLineStyle);}}class Ci extends it{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.mh(),l=0===e.seriesLastValueMode,a=s.Yr(!1);if(a.Xr)return;r&&(t.Zt=this.bh(a,r,l),t.yt=0!==t.Zt.length),(h||l)&&(i.Zt=this.wh(a,r,h,l),i.yt=i.Zt.length>0);const o=s.ph(a.O),_=P(o);n.t=_.t,n.ki=a.ki,i.At=s.$t().Bt(a.ki/s.Dt().Vt()),t.At=o,t.O=_.i,i.O=_.i;}wh(t,i,n,s){let e="";const r=this.jt.mh();return n&&0!==r.length&&(e+=`${r} `),i&&s&&(e+=this.jt.Dt().gh()?t.Mh:t.xh),e.trim()}bh(t,i,n){return i?n?this.jt.Dt().gh()?t.xh:t.Mh:t.Zt:""}}function Ti(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 Pi{constructor(t,i){this.Sh=t,this.kh=i;}yh(t){return null!==t&&(this.Sh===t.Sh&&this.kh===t.kh)}Ch(){return new Pi(this.Sh,this.kh)}Th(){return this.Sh}Ph(){return this.kh}Rh(){return this.kh-this.Sh}Ni(){return this.kh===this.Sh||Number.isNaN(this.kh)||Number.isNaN(this.Sh)}ts(t){return null===t?this:new Pi(Ti(Math.min,this.Th(),t.Th(),-1/0),Ti(Math.max,this.Ph(),t.Ph(),1/0))}Dh(t){if(!O(t))return;if(0===this.kh-this.Sh)return;const i=.5*(this.kh+this.Sh);let n=this.kh-i,s=this.Sh-i;n*=t,s*=t,this.kh=i+n,this.Sh=i+s;}Oh(t){O(t)&&(this.kh+=t,this.Sh+=t);}Ah(){return {minValue:this.Sh,maxValue:this.kh}}static Bh(t){return null===t?null:new Pi(t.minValue,t.maxValue)}}class Ri{constructor(t,i){this.Vh=t,this.Ih=i||null;}zh(){return this.Vh}Lh(){return this.Ih}Ah(){return null===this.Vh?null:{priceRange:this.Vh.Ah(),margins:this.Ih||void 0}}static Bh(t){return null===t?null:new Ri(Pi.Bh(t.priceRange),t.margins)}}class Di extends ri{constructor(t,i){super(t),this.Eh=i;}kr(){const t=this.Mr;t.yt=!1;const i=this.Eh.W();if(!this.Ls.yt()||!i.lineVisible)return;const n=this.Eh.Nh();null!==n&&(t.yt=!0,t.st=n,t.O=i.color,t.et=i.lineWidth,t.Nt=i.lineStyle,t.wr=this.Eh.W().id);}}class Oi extends it{constructor(t,i){super(),this.Wr=t,this.Eh=i;}zi(t,i,n){t.yt=!1,i.yt=!1;const s=this.Eh.W(),e=s.axisLabelVisible,r=""!==s.title,h=this.Wr;if(!e||!h.yt())return;const l=this.Eh.Nh();if(null===l)return;r&&(i.Zt=s.title,i.yt=!0),i.At=h.$t().Bt(l/h.Dt().Vt()),t.Zt=this.Fh(s.price),t.yt=!0;const a=P(s.axisLabelColor||s.color);n.t=a.t;const o=s.axisLabelTextColor||a.i;t.O=o,i.O=o,n.ki=l;}Fh(t){const i=this.Wr.Ct();return null===i?"":this.Wr.Dt().Fi(t,i.Ot)}}class Ai{constructor(t,i){this.Wr=t,this.cn=i,this.Wh=new Di(t,this),this._r=new Oi(t,this),this.jh=new si(this._r,t,t.$t());}Hh(t){D(this.cn,t),this.bt(),this.Wr.$t().$h();}W(){return this.cn}Uh(){return this.Wh}qh(){return this.jh}Yh(){return this._r}bt(){this.Wh.bt(),this._r.bt();}Nh(){const t=this.Wr,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.Ot)}}class Bi extends ht{constructor(t){super(),this.$i=t;}$t(){return this.$i}}const Vi={Bar:(t,i,n,s)=>{var e;const r=i.upColor,h=i.downColor,l=b(t(n,s)),a=w(l.Ot[0])<=w(l.Ot[3]);return {ue:null!==(e=l.O)&&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=b(t(n,s)),f=w(d.Ot[0])<=w(d.Ot[3]);return {ue:null!==(e=d.O)&&void 0!==e?e:f?l:a,Ee:null!==(r=d.At)&&void 0!==r?r:f?o:_,Le:null!==(h=d.Xh)&&void 0!==h?h:f?u:c}},Custom:(t,i,n,s)=>{var e;return {ue:null!==(e=b(t(n,s)).O)&&void 0!==e?e:i.color}},Area:(t,i,n,s)=>{var e,r,h,l;const a=b(t(n,s));return {ue:null!==(e=a.lt)&&void 0!==e?e:i.lineColor,lt:null!==(r=a.lt)&&void 0!==r?r:i.lineColor,Ts:null!==(h=a.Ts)&&void 0!==h?h:i.topColor,Ps:null!==(l=a.Ps)&&void 0!==l?l:i.bottomColor}},Baseline:(t,i,n,s)=>{var e,r,h,l,a,o;const _=b(t(n,s));return {ue:_.Ot[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,Pe:null!==(e=_.Pe)&&void 0!==e?e:i.topLineColor,Re:null!==(r=_.Re)&&void 0!==r?r:i.bottomLineColor,Se:null!==(h=_.Se)&&void 0!==h?h:i.topFillColor1,ke:null!==(l=_.ke)&&void 0!==l?l:i.topFillColor2,ye:null!==(a=_.ye)&&void 0!==a?a:i.bottomFillColor1,Ce:null!==(o=_.Ce)&&void 0!==o?o:i.bottomFillColor2}},Line:(t,i,n,s)=>{var e,r;const h=b(t(n,s));return {ue:null!==(e=h.O)&&void 0!==e?e:i.color,lt:null!==(r=h.O)&&void 0!==r?r:i.color}},Histogram:(t,i,n,s)=>{var e;return {ue:null!==(e=b(t(n,s)).O)&&void 0!==e?e:i.color}}};class Ii{constructor(t){this.Kh=(t,i)=>void 0!==i?i.Ot:this.Wr.In().Zh(t),this.Wr=t,this.Gh=Vi[t.Jh()];}Hs(t,i){return this.Gh(this.Kh,this.Wr.W(),t,i)}}var zi;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight";}(zi||(zi={}));const Li=30;class Ei{constructor(){this.Qh=[],this.tl=new Map,this.il=new Map;}nl(){return this.Ks()>0?this.Qh[this.Qh.length-1]:null}sl(){return this.Ks()>0?this.el(0):null}Vn(){return this.Ks()>0?this.el(this.Qh.length-1):null}Ks(){return this.Qh.length}Ni(){return 0===this.Ks()}Kr(t){return null!==this.rl(t,0)}Zh(t){return this.hl(t)}hl(t,i=0){const n=this.rl(t,i);return null===n?null:Object.assign(Object.assign({},this.ll(n)),{se:this.el(n)})}ie(){return this.Qh}al(t,i,n){if(this.Ni())return null;let s=null;for(const e of n){s=Ni(s,this.ol(t,i,e));}return s}J(t){this.il.clear(),this.tl.clear(),this.Qh=t;}el(t){return this.Qh[t].se}ll(t){return this.Qh[t]}rl(t,i){const n=this._l(t);if(null===n&&0!==i)switch(i){case-1:return this.ul(t);case 1:return this.cl(t);default:throw new TypeError("Unknown search mode")}return n}ul(t){let i=this.dl(t);return i>0&&(i-=1),i!==this.Qh.length&&this.el(i)<t?i:null}cl(t){const i=this.fl(t);return i!==this.Qh.length&&t<this.el(i)?i:null}_l(t){const i=this.dl(t);return i===this.Qh.length||t<this.Qh[i].se?null:i}dl(t){return At(this.Qh,t,((t,i)=>t.se<i))}fl(t){return Bt(this.Qh,t,((t,i)=>t.se>i))}vl(t,i,n){let s=null;for(let e=t;e<i;e++){const t=this.Qh[e].Ot[n];Number.isNaN(t)||(null===s?s={pl:t,ml:t}:(t<s.pl&&(s.pl=t),t>s.ml&&(s.ml=t)));}return s}ol(t,i,n){if(this.Ni())return null;let s=null;const e=b(this.sl()),r=b(this.Vn()),h=Math.max(t,e),l=Math.min(i,r),a=Math.ceil(h/Li)*Li,o=Math.max(a,Math.floor(l/Li)*Li);{const t=this.dl(h),e=this.fl(Math.min(l,a,i));s=Ni(s,this.vl(t,e,n));}let _=this.tl.get(n);void 0===_&&(_=new Map,this.tl.set(n,_));for(let t=Math.max(a+1,h);t<o;t+=Li){const i=Math.floor(t/Li);let e=_.get(i);if(void 0===e){const t=this.dl(i*Li),s=this.fl((i+1)*Li-1);e=this.vl(t,s,n),_.set(i,e);}s=Ni(s,e);}{const t=this.dl(o),i=this.fl(l);s=Ni(s,this.vl(t,i,n));}return s}}function Ni(t,i){if(null===t)return i;if(null===i)return t;return {pl:Math.min(t.pl,i.pl),ml:Math.max(t.ml,i.ml)}}class Fi{constructor(t){this.bl=t;}K(t,i,n){this.bl.draw(t);}wl(t,i,n){var s,e;null===(e=(s=this.bl).drawBackground)||void 0===e||e.call(s,t);}}class Wi{constructor(t){this.Qe=null,this.wn=t;}gt(){var t;const i=this.wn.renderer();if(null===i)return null;if((null===(t=this.Qe)||void 0===t?void 0:t.gl)===i)return this.Qe.Ml;const n=new Fi(i);return this.Qe={gl:i,Ml:n},n}xl(){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 ji(t){var i,n,s,e,r;return {Zt:t.text(),ki:t.coordinate(),Si:null===(i=t.fixedCoordinate)||void 0===i?void 0:i.call(t),O: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 Hi{constructor(t,i){this.Wt=new et,this.Sl=t,this.kl=i;}gt(){return this.Wt.J(Object.assign({Hi:this.kl.Hi()},ji(this.Sl))),this.Wt}}class $i extends it{constructor(t,i){super(),this.Sl=t,this.Li=i;}zi(t,i,n){const s=ji(this.Sl);n.t=s.t,t.O=s.O;const e=2/12*this.Li.P();n.wi=e,n.gi=e,n.ki=s.ki,n.Si=s.Si,t.Zt=s.Zt,t.yt=s.yt,t.hi=s.hi;}}class Ui{constructor(t,i){this.yl=null,this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=t,this.Wr=i;}Ol(){return this.Dl}On(){var t,i;null===(i=(t=this.Dl).updateAllViews)||void 0===i||i.call(t);}Pn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).paneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.yl)||void 0===s?void 0:s.gl)===e)return this.yl.Ml;const r=e.map((t=>new Wi(t)));return this.yl={gl:e,Ml:r},r}Qi(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).timeAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Cl)||void 0===s?void 0:s.gl)===e)return this.Cl.Ml;const r=this.Wr.$t().St(),h=e.map((t=>new Hi(t,r)));return this.Cl={gl:e,Ml:h},h}Rn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).priceAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Tl)||void 0===s?void 0:s.gl)===e)return this.Tl.Ml;const r=this.Wr.Dt(),h=e.map((t=>new $i(t,r)));return this.Tl={gl:e,Ml:h},h}Al(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).priceAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Pl)||void 0===s?void 0:s.gl)===e)return this.Pl.Ml;const r=e.map((t=>new Wi(t)));return this.Pl={gl:e,Ml:r},r}Bl(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).timeAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Rl)||void 0===s?void 0:s.gl)===e)return this.Rl.Ml;const r=e.map((t=>new Wi(t)));return this.Rl={gl:e,Ml:r},r}Vl(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Dl).autoscaleInfo)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}br(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Dl).hitTest)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}}function qi(t,i,n,s){t.forEach((t=>{i(t).forEach((t=>{t.xl()===n&&s.push(t);}));}));}function Yi(t){return t.Pn()}function Xi(t){return t.Al()}function Ki(t){return t.Bl()}class Zi extends Bi{constructor(t,i,n,s,e){super(t),this.zt=new Ei,this.Wh=new yi(this),this.Il=[],this.zl=new hi(this),this.Ll=null,this.El=null,this.Nl=[],this.Fl=[],this.Wl=null,this.jl=[],this.cn=i,this.Hl=n;const r=new Ci(this);this.rn=[r],this.jh=new si(r,this,t),"Area"!==n&&"Line"!==n&&"Baseline"!==n||(this.Ll=new ui(this)),this.$l(),this.Ul(e);}S(){null!==this.Wl&&clearTimeout(this.Wl);}ph(t){return this.cn.priceLineColor||t}Yr(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.nl();if(null===t)return i;r=t,h=t.se;}else {const t=this.zt.hl(s.ui(),-1);if(null===t)return i;if(r=this.zt.Zh(t.se),null===r)return i;h=t.se;}const l=r.Ot[3],a=this.$s().Hs(h,{Ot:r}),o=n.Rt(l,e.Ot);return {Xr:!1,_t:l,Zt:n.Fi(l,e.Ot),Mh:n.ql(l),xh:n.Yl(l,e.Ot),O:a.ue,ki:o,se:h}}$s(){return null!==this.El||(this.El=new Ii(this)),this.El}W(){return this.cn}Hh(t){const i=t.priceScaleId;void 0!==i&&i!==this.cn.priceScaleId&&this.$t().Xl(this,i),D(this.cn,t),void 0!==t.priceFormat&&(this.$l(),this.$t().Kl()),this.$t().Zl(this),this.$t().Gl(),this.wn.bt("options");}J(t,i){this.zt.J(t),this.Jl(),this.wn.bt("data"),this.dn.bt("data"),null!==this.Ll&&(i&&i.Ql?this.Ll.Hr():0===t.length&&this.Ll.jr());const n=this.$t().cr(this);this.$t().ta(n),this.$t().Zl(this),this.$t().Gl(),this.$t().$h();}ia(t){this.Nl=t,this.Jl();const i=this.$t().cr(this);this.dn.bt("data"),this.$t().ta(i),this.$t().Zl(this),this.$t().Gl(),this.$t().$h();}na(){return this.Nl}uh(){return this.Fl}sa(t){const i=new Ai(this,t);return this.Il.push(i),this.$t().Zl(this),i}ea(t){const i=this.Il.indexOf(t);-1!==i&&this.Il.splice(i,1),this.$t().Zl(this);}Jh(){return this.Hl}Ct(){const t=this.ra();return null===t?null:{Ot:t.Ot[3],ha:t.ot}}ra(){const t=this.$t().St().Xs();if(null===t)return null;const i=t.Os();return this.zt.hl(i,1)}In(){return this.zt}fh(t){const i=this.zt.Zh(t);return null===i?null:"Bar"===this.Hl||"Candlestick"===this.Hl||"Custom"===this.Hl?{we:i.Ot[0],ge:i.Ot[1],Me:i.Ot[2],xe:i.Ot[3]}:i.Ot[3]}la(t){const i=[];qi(this.jl,Yi,"top",i);const n=this.Ll;return null!==n&&n.yt()?(null===this.Wl&&n.Ur()&&(this.Wl=setTimeout((()=>{this.Wl=null,this.$t().aa();}),0)),n.$r(),i.unshift(n),i):i}Pn(){const t=[];this.oa()||t.push(this.zl),t.push(this.wn,this.Wh,this.dn);const i=this.Il.map((t=>t.Uh()));return t.push(...i),qi(this.jl,Yi,"normal",t),t}_a(){return this.ua(Yi,"bottom")}ca(t){return this.ua(Xi,t)}da(t){return this.ua(Ki,t)}fa(t,i){return this.jl.map((n=>n.br(t,i))).filter((t=>null!==t))}Ji(t){return [this.jh,...this.Il.map((t=>t.qh()))]}Rn(t,i){if(i!==this.Yi&&!this.oa())return [];const n=[...this.rn];for(const t of this.Il)n.push(t.Yh());return this.jl.forEach((t=>{n.push(...t.Rn());})),n}Qi(){const t=[];return this.jl.forEach((i=>{t.push(...i.Qi());})),t}Vl(t,i){if(void 0!==this.cn.autoscaleInfoProvider){const n=this.cn.autoscaleInfoProvider((()=>{const n=this.va(t,i);return null===n?null:n.Ah()}));return Ri.Bh(n)}return this.va(t,i)}pa(){return this.cn.priceFormat.minMove}ma(){return this.ba}On(){var t;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.Il)t.bt();this.Wh.bt(),this.zl.bt(),null===(t=this.Ll)||void 0===t||t.bt(),this.jl.forEach((t=>t.On()));}Dt(){return b(super.Dt())}kt(t){if(!(("Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl)&&this.cn.crosshairMarkerVisible))return null;const i=this.zt.Zh(t);if(null===i)return null;return {_t:i.Ot[3],ht:this.wa(),At:this.ga(),Pt:this.Ma(),Tt:this.xa(t)}}mh(){return this.cn.title}yt(){return this.cn.visible}Sa(t){this.jl.push(new Ui(t,this));}ka(t){this.jl=this.jl.filter((i=>i.Ol()!==t));}ya(){if(this.wn instanceof Kt!=!1)return t=>this.wn.Fe(t)}Ca(){if(this.wn instanceof Kt!=!1)return t=>this.wn.We(t)}oa(){return !ot(this.Dt().Ta())}va(t,i){if(!A(t)||!A(i)||this.zt.Ni())return null;const n="Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl||"Histogram"===this.Hl?[3]:[2,1],s=this.zt.al(t,i,n);let e=null!==s?new Pi(s.pl,s.ml):null;if("Histogram"===this.Jh()){const t=this.cn.base,i=new Pi(t,t);e=null!==e?e.ts(i):i;}let r=this.dn._h();return this.jl.forEach((n=>{const s=n.Vl(t,i);if(null==s?void 0:s.priceRange){const t=new Pi(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 Ri(e,r)}wa(){switch(this.Hl){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}ga(){switch(this.Hl){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}Ma(){switch(this.Hl){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}xa(t){switch(this.Hl){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.$s().Hs(t).ue}$l(){switch(this.cn.priceFormat.type){case"custom":this.ba={format:this.cn.priceFormat.formatter};break;case"volume":this.ba=new vt(this.cn.priceFormat.precision);break;case"percent":this.ba=new ft(this.cn.priceFormat.precision);break;default:{const t=Math.pow(10,this.cn.priceFormat.precision);this.ba=new dt(t,this.cn.priceFormat.minMove*t);}}null!==this.Yi&&this.Yi.Pa();}Jl(){const t=this.$t().St();if(!t.Ra()||this.zt.Ni())return void(this.Fl=[]);const i=b(this.zt.sl());this.Fl=this.Nl.map(((n,s)=>{const e=b(t.Da(n.time,!0)),r=e<i?1:-1;return {time:b(this.zt.hl(e,r)).se,position:n.position,shape:n.shape,color:n.color,id:n.id,Qr:s,text:n.text,size:n.size,originalTime:n.originalTime}}));}Ul(t){switch(this.dn=new ki(this,this.$t()),this.Hl){case"Bar":this.wn=new jt(this,this.$t());break;case"Candlestick":this.wn=new Yt(this,this.$t());break;case"Line":this.wn=new Qt(this,this.$t());break;case"Custom":this.wn=new Kt(this,this.$t(),m(t));break;case"Area":this.wn=new Nt(this,this.$t());break;case"Baseline":this.wn=new Ut(this,this.$t());break;case"Histogram":this.wn=new Jt(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.Hl)}}ua(t,i){const n=[];return qi(this.jl,t,i,n),n}}class Gi{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.Aa().filter((t=>t instanceof Zi)).reduce(((t,s)=>{if(n.dr(s)||!s.yt())return t;const e=s.Dt(),r=s.In();if(e.Ni()||!r.Kr(i))return t;const h=r.Zh(i);if(null===h)return t;const l=w(s.Ct());return t.concat([e.Rt(h.Ot[3],l.Ot)])}),[]);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 Ji extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}Z({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=b(this.zt);if(r.Ba){t.strokeStyle=r.Va,f(t,r.Ia),t.beginPath();for(const s of r.za){const r=Math.round(s.La*n);t.moveTo(r,-e),t.lineTo(r,i.height+e);}t.stroke();}if(r.Ea){t.strokeStyle=r.Na,f(t,r.Fa),t.beginPath();for(const n of r.Wa){const r=Math.round(n.La*s);t.moveTo(-e,r),t.lineTo(i.width+e,r);}t.stroke();}}));}}class Qi{constructor(t){this.Wt=new Ji,this.ft=!0,this.tn=t;}bt(){this.ft=!0;}gt(){if(this.ft){const t=this.tn.$t().W().grid,i={Ea:t.horzLines.visible,Ba:t.vertLines.visible,Na:t.horzLines.color,Va:t.vertLines.color,Fa:t.horzLines.style,Ia:t.vertLines.style,Wa:this.tn.vn().ja(),za:(this.tn.$t().St().ja()||[]).map((t=>({La:t.coord})))};this.Wt.J(i),this.ft=!1;}return this.Wt}}class tn{constructor(t){this.wn=new Qi(t);}Uh(){return this.wn}}const nn={Ha:4,$a:1e-4};function sn(t,i){const n=100*(t-i)/i;return i<0?-n:n}function en(t,i){const n=sn(t.Th(),i),s=sn(t.Ph(),i);return new Pi(n,s)}function rn(t,i){const n=100*(t-i)/i+100;return i<0?-n:n}function hn(t,i){const n=rn(t.Th(),i),s=rn(t.Ph(),i);return new Pi(n,s)}function ln(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.log10(n+i.$a)+i.Ha;return t<0?-s:s}function an(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.pow(10,n-i.Ha)-i.$a;return t<0?-s:s}function on(t,i){if(null===t)return null;const n=ln(t.Th(),i),s=ln(t.Ph(),i);return new Pi(n,s)}function _n(t,i){if(null===t)return null;const n=an(t.Th(),i),s=an(t.Ph(),i);return new Pi(n,s)}function un(t){if(null===t)return nn;const i=Math.abs(t.Ph()-t.Th());if(i>=1||i<1e-15)return nn;const n=Math.ceil(Math.abs(Math.log10(i))),s=nn.Ha+n;return {Ha:s,$a:1/Math.pow(10,s)}}class cn{constructor(t,i){if(this.Ua=t,this.qa=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.Ua))this.Ya=[2,2.5,2];else {this.Ya=[];for(let t=this.Ua;1!==t;){if(t%2==0)this.Ya.push(2),t/=2;else {if(t%5!=0)throw new Error("unexpected base");this.Ya.push(2,2.5),t/=5;}if(this.Ya.length>100)throw new Error("something wrong with base")}}}Xa(t,i,n){const s=0===this.Ua?0:1/this.Ua;let e=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,h=this.qa[0];for(;;){const t=kt(e,s,1e-14)&&e>s+1e-14,i=kt(e,n*h,1e-14),l=kt(e,1,1e-14);if(!(t&&i&&l))break;e/=h,h=this.qa[++r%this.qa.length];}if(e<=s+1e-14&&(e=s),e=Math.max(1,e),this.Ya.length>0&&(l=e,a=1,o=1e-14,Math.abs(l-a)<o))for(r=0,h=this.Ya[0];kt(e,n*h,1e-14)&&e>s+1e-14;)e/=h,h=this.Ya[++r%this.Ya.length];var l,a,o;return e}}class dn{constructor(t,i,n,s){this.Ka=[],this.Li=t,this.Ua=i,this.Za=n,this.Ga=s;}Xa(t,i){if(t<i)throw new Error("high < low");const n=this.Li.Vt(),s=(t-i)*this.Ja()/n,e=new cn(this.Ua,[2,2.5,2]),r=new cn(this.Ua,[2,2,2.5]),h=new cn(this.Ua,[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)}Qa(){const t=this.Li,i=t.Ct();if(null===i)return void(this.Ka=[]);const n=t.Vt(),s=this.Za(n-1,i),e=this.Za(0,i),r=this.Li.W().entireTextOnly?this.io()/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.Ga(n,i,!0);null!==d&&Math.abs(s-d)<this.Ja()||(s<h||s>l||(f<this.Ka.length?(this.Ka[f].La=s,this.Ka[f].no=t.so(n)):this.Ka.push({La:s,no:t.so(n)}),f++,d=s,t.eo()&&(_=this.Xa(n*c,o))));}this.Ka.length=f;}ja(){return this.Ka}io(){return this.Li.P()}Ja(){return Math.ceil(2.5*this.io())}}function fn(t){return t.slice().sort(((t,i)=>b(t.Ki())-b(i.Ki())))}var vn;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100";}(vn||(vn={}));const pn=new ft,mn=new dt(100,1);class bn{constructor(t,i,n,s){this.ro=0,this.ho=null,this.Vh=null,this.lo=null,this.ao={oo:!1,_o:null},this.uo=0,this.co=0,this.do=new R,this.fo=new R,this.vo=[],this.po=null,this.mo=null,this.bo=null,this.wo=null,this.ba=mn,this.Mo=un(null),this.xo=t,this.cn=i,this.So=n,this.ko=s,this.yo=new dn(this,100,this.Co.bind(this),this.To.bind(this));}Ta(){return this.xo}W(){return this.cn}Hh(t){if(D(this.cn,t),this.Pa(),void 0!==t.mode&&this.Po({yr:t.mode}),void 0!==t.scaleMargins){const i=m(t.scaleMargins.top),n=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.Ro(),this.mo=null;}}Do(){return this.cn.autoScale}eo(){return 1===this.cn.mode}gh(){return 2===this.cn.mode}Oo(){return 3===this.cn.mode}yr(){return {Wn:this.cn.autoScale,Ao:this.cn.invertScale,yr:this.cn.mode}}Po(t){const i=this.yr();let n=null;void 0!==t.Wn&&(this.cn.autoScale=t.Wn),void 0!==t.yr&&(this.cn.mode=t.yr,2!==t.yr&&3!==t.yr||(this.cn.autoScale=!0),this.ao.oo=!1),1===i.yr&&t.yr!==i.yr&&(!function(t,i){if(null===t)return !1;const n=an(t.Th(),i),s=an(t.Ph(),i);return isFinite(n)&&isFinite(s)}(this.Vh,this.Mo)?this.cn.autoScale=!0:(n=_n(this.Vh,this.Mo),null!==n&&this.Bo(n))),1===t.yr&&t.yr!==i.yr&&(n=on(this.Vh,this.Mo),null!==n&&this.Bo(n));const s=i.yr!==this.cn.mode;s&&(2===i.yr||this.gh())&&this.Pa(),s&&(3===i.yr||this.Oo())&&this.Pa(),void 0!==t.Ao&&i.Ao!==t.Ao&&(this.cn.invertScale=t.Ao,this.Vo()),this.fo.m(i,this.yr());}Io(){return this.fo}P(){return this.So.fontSize}Vt(){return this.ro}zo(t){this.ro!==t&&(this.ro=t,this.Ro(),this.mo=null);}Lo(){if(this.ho)return this.ho;const t=this.Vt()-this.Eo()-this.No();return this.ho=t,t}zh(){return this.Fo(),this.Vh}Bo(t,i){const n=this.Vh;(i||null===n&&null!==t||null!==n&&!n.yh(t))&&(this.mo=null,this.Vh=t);}Ni(){return this.Fo(),0===this.ro||!this.Vh||this.Vh.Ni()}Wo(t){return this.Ao()?t:this.Vt()-1-t}Rt(t,i){return this.gh()?t=sn(t,i):this.Oo()&&(t=rn(t,i)),this.To(t,i)}Qs(t,i,n){this.Fo();const s=this.No(),e=b(this.zh()),r=e.Th(),h=e.Ph(),l=this.Lo()-1,a=this.Ao(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.jo();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.ro-1-_;e.st=u;}}me(t,i,n){this.Fo();const s=this.No(),e=b(this.zh()),r=e.Th(),h=e.Ph(),l=this.Lo()-1,a=this.Ao(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.jo();for(let n=_;n<u;n++){const e=t[n];let h=e.we,l=e.ge,_=e.Me,u=e.xe;null!==c&&(h=c(e.we,i),l=c(e.ge,i),_=c(e.Me,i),u=c(e.xe,i));let d=s+o*(h-r),f=a?d:this.ro-1-d;e.ve=f,d=s+o*(l-r),f=a?d:this.ro-1-d,e.ce=f,d=s+o*(_-r),f=a?d:this.ro-1-d,e.de=f,d=s+o*(u-r),f=a?d:this.ro-1-d,e.pe=f;}}pn(t,i){const n=this.Co(t,i);return this.Ho(n,i)}Ho(t,i){let n=t;return this.gh()?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}Aa(){return this.vo}$o(){if(this.po)return this.po;let t=[];for(let i=0;i<this.vo.length;i++){const n=this.vo[i];null===n.Ki()&&n.Zi(i+1),t.push(n);}return t=fn(t),this.po=t,this.po}Uo(t){-1===this.vo.indexOf(t)&&(this.vo.push(t),this.Pa(),this.qo());}Yo(t){const i=this.vo.indexOf(t);if(-1===i)throw new Error("source is not attached to scale");this.vo.splice(i,1),0===this.vo.length&&(this.Po({Wn:!0}),this.Bo(null)),this.Pa(),this.qo();}Ct(){let t=null;for(const i of this.vo){const n=i.Ct();null!==n&&((null===t||n.ha<t.ha)&&(t=n));}return null===t?null:t.Ot}Ao(){return this.cn.invertScale}ja(){const t=null===this.Ct();if(null!==this.mo&&(t||this.mo.Xo===t))return this.mo.ja;this.yo.Qa();const i=this.yo.ja();return this.mo={ja:i,Xo:t},this.do.m(),i}Ko(){return this.do}Zo(t){this.gh()||this.Oo()||null===this.bo&&null===this.lo&&(this.Ni()||(this.bo=this.ro-t,this.lo=b(this.zh()).Ch()));}Go(t){if(this.gh()||this.Oo())return;if(null===this.bo)return;this.Po({Wn:!1}),(t=this.ro-t)<0&&(t=0);let i=(this.bo+.2*(this.ro-1))/(t+.2*(this.ro-1));const n=b(this.lo).Ch();i=Math.max(i,.1),n.Dh(i),this.Bo(n);}Jo(){this.gh()||this.Oo()||(this.bo=null,this.lo=null);}Qo(t){this.Do()||null===this.wo&&null===this.lo&&(this.Ni()||(this.wo=t,this.lo=b(this.zh()).Ch()));}t_(t){if(this.Do())return;if(null===this.wo)return;const i=b(this.zh()).Rh()/(this.Lo()-1);let n=t-this.wo;this.Ao()&&(n*=-1);const s=n*i,e=b(this.lo).Ch();e.Oh(s),this.Bo(e,!0),this.mo=null;}i_(){this.Do()||null!==this.wo&&(this.wo=null,this.lo=null);}ma(){return this.ba||this.Pa(),this.ba}Fi(t,i){switch(this.cn.mode){case 2:return this.n_(sn(t,i));case 3:return this.ma().format(rn(t,i));default:return this.Fh(t)}}so(t){switch(this.cn.mode){case 2:return this.n_(t);case 3:return this.ma().format(t);default:return this.Fh(t)}}ql(t){return this.Fh(t,b(this.s_()).ma())}Yl(t,i){return t=sn(t,i),this.n_(t,pn)}e_(){return this.vo}r_(t){this.ao={_o:t,oo:!1};}On(){this.vo.forEach((t=>t.On()));}Pa(){this.mo=null;const t=this.s_();let i=100;null!==t&&(i=Math.round(1/t.pa())),this.ba=mn,this.gh()?(this.ba=pn,i=100):this.Oo()?(this.ba=new dt(100,1),i=100):null!==t&&(this.ba=t.ma()),this.yo=new dn(this,i,this.Co.bind(this),this.To.bind(this)),this.yo.Qa();}qo(){this.po=null;}s_(){return this.vo[0]||null}Eo(){return this.Ao()?this.cn.scaleMargins.bottom*this.Vt()+this.co:this.cn.scaleMargins.top*this.Vt()+this.uo}No(){return this.Ao()?this.cn.scaleMargins.top*this.Vt()+this.uo:this.cn.scaleMargins.bottom*this.Vt()+this.co}Fo(){this.ao.oo||(this.ao.oo=!0,this.h_());}Ro(){this.ho=null;}To(t,i){if(this.Fo(),this.Ni())return 0;t=this.eo()&&t?ln(t,this.Mo):t;const n=b(this.zh()),s=this.No()+(this.Lo()-1)*(t-n.Th())/n.Rh();return this.Wo(s)}Co(t,i){if(this.Fo(),this.Ni())return 0;const n=this.Wo(t),s=b(this.zh()),e=s.Th()+s.Rh()*((n-this.No())/(this.Lo()-1));return this.eo()?an(e,this.Mo):e}Vo(){this.mo=null,this.yo.Qa();}h_(){const t=this.ao._o;if(null===t)return;let i=null;const n=this.e_();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.Vl(t.Os(),t.ui());let l=h&&h.zh();if(null!==l){switch(this.cn.mode){case 1:l=on(l,this.Mo);break;case 2:l=en(l,n.Ot);break;case 3:l=hn(l,n.Ot);}if(i=null===i?l:i.ts(b(l)),null!==h){const t=h.Lh();null!==t&&(s=Math.max(s,t.above),e=Math.max(e,t.below));}}}if(s===this.uo&&e===this.co||(this.uo=s,this.co=e,this.mo=null,this.Ro()),null!==i){if(i.Th()===i.Ph()){const t=this.s_(),n=5*(null===t||this.gh()||this.Oo()?1:t.pa());this.eo()&&(i=_n(i,this.Mo)),i=new Pi(i.Th()-n,i.Ph()+n),this.eo()&&(i=on(i,this.Mo));}if(this.eo()){const t=_n(i,this.Mo),n=un(t);if(r=n,h=this.Mo,r.Ha!==h.Ha||r.$a!==h.$a){const s=null!==this.lo?_n(this.lo,this.Mo):null;this.Mo=n,i=on(t,n),null!==s&&(this.lo=on(s,n));}}this.Bo(i);}else null===this.Vh&&(this.Bo(new Pi(-.5,.5)),this.Mo=un(null));var r,h;this.ao.oo=!0;}jo(){return this.gh()?sn:this.Oo()?rn:this.eo()?t=>ln(t,this.Mo):null}l_(t,i,n){return void 0===i?(void 0===n&&(n=this.ma()),n.format(t)):i(t)}Fh(t,i){return this.l_(t,this.ko.priceFormatter,i)}n_(t,i){return this.l_(t,this.ko.percentageFormatter,i)}}class wn{constructor(t,i){this.vo=[],this.a_=new Map,this.ro=0,this.o_=0,this.__=1e3,this.po=null,this.u_=new R,this.kl=t,this.$i=i,this.c_=new tn(this);const n=i.W();this.d_=this.f_("left",n.leftPriceScale),this.v_=this.f_("right",n.rightPriceScale),this.d_.Io().l(this.p_.bind(this,this.d_),this),this.v_.Io().l(this.p_.bind(this,this.v_),this),this.m_(n);}m_(t){if(t.leftPriceScale&&this.d_.Hh(t.leftPriceScale),t.rightPriceScale&&this.v_.Hh(t.rightPriceScale),t.localization&&(this.d_.Pa(),this.v_.Pa()),t.overlayPriceScales){const i=Array.from(this.a_.values());for(const n of i){const i=b(n[0].Dt());i.Hh(t.overlayPriceScales),t.localization&&i.Pa();}}}b_(t){switch(t){case"left":return this.d_;case"right":return this.v_}return this.a_.has(t)?m(this.a_.get(t))[0].Dt():null}S(){this.$t().w_().p(this),this.d_.Io().p(this),this.v_.Io().p(this),this.vo.forEach((t=>{t.S&&t.S();})),this.u_.m();}g_(){return this.__}M_(t){this.__=t;}$t(){return this.$i}Hi(){return this.o_}Vt(){return this.ro}x_(t){this.o_=t,this.S_();}zo(t){this.ro=t,this.d_.zo(t),this.v_.zo(t),this.vo.forEach((i=>{if(this.dr(i)){const n=i.Dt();null!==n&&n.zo(t);}})),this.S_();}Aa(){return this.vo}dr(t){const i=t.Dt();return null===i||this.d_!==i&&this.v_!==i}Uo(t,i,n){const s=void 0!==n?n:this.y_().k_+1;this.C_(t,i,s);}Yo(t){const i=this.vo.indexOf(t);p(-1!==i,"removeDataSource: invalid data source"),this.vo.splice(i,1);const n=b(t.Dt()).Ta();if(this.a_.has(n)){const i=m(this.a_.get(n)),s=i.indexOf(t);-1!==s&&(i.splice(s,1),0===i.length&&this.a_.delete(n));}const s=t.Dt();s&&s.Aa().indexOf(t)>=0&&s.Yo(t),null!==s&&(s.qo(),this.T_(s)),this.po=null;}pr(t){return t===this.d_?"left":t===this.v_?"right":"overlay"}P_(){return this.d_}R_(){return this.v_}D_(t,i){t.Zo(i);}O_(t,i){t.Go(i),this.S_();}A_(t){t.Jo();}B_(t,i){t.Qo(i);}V_(t,i){t.t_(i),this.S_();}I_(t){t.i_();}S_(){this.vo.forEach((t=>{t.On();}));}vn(){let t=null;return this.$i.W().rightPriceScale.visible&&0!==this.v_.Aa().length?t=this.v_:this.$i.W().leftPriceScale.visible&&0!==this.d_.Aa().length?t=this.d_:0!==this.vo.length&&(t=this.vo[0].Dt()),null===t&&(t=this.v_),t}vr(){let t=null;return this.$i.W().rightPriceScale.visible?t=this.v_:this.$i.W().leftPriceScale.visible&&(t=this.d_),t}T_(t){null!==t&&t.Do()&&this.z_(t);}L_(t){const i=this.kl.Xs();t.Po({Wn:!0}),null!==i&&t.r_(i),this.S_();}E_(){this.z_(this.d_),this.z_(this.v_);}N_(){this.T_(this.d_),this.T_(this.v_),this.vo.forEach((t=>{this.dr(t)&&this.T_(t.Dt());})),this.S_(),this.$i.$h();}$o(){return null===this.po&&(this.po=fn(this.vo)),this.po}F_(){return this.u_}W_(){return this.c_}z_(t){const i=t.e_();if(i&&i.length>0&&!this.kl.Ni()){const i=this.kl.Xs();null!==i&&t.r_(i);}t.On();}y_(){const t=this.$o();if(0===t.length)return {j_:0,k_:0};let i=0,n=0;for(let s=0;s<t.length;s++){const e=t[s].Ki();null!==e&&(e<i&&(i=e),e>n&&(n=e));}return {j_:i,k_:n}}C_(t,i,n){let s=this.b_(i);if(null===s&&(s=this.f_(i,this.$i.W().overlayPriceScales)),this.vo.push(t),!ot(i)){const n=this.a_.get(i)||[];n.push(t),this.a_.set(i,n);}s.Uo(t),t.Gi(s),t.Zi(n),this.T_(s),this.po=null;}p_(t,i,n){i.yr!==n.yr&&this.z_(t);}f_(t,i){const n=Object.assign({visible:!0,autoScale:!0},I(i)),s=new bn(t,n,this.$i.W().layout,this.$i.W().localization);return s.zo(this.Vt()),s}}class gn{constructor(t,i,n=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Qe=new Map,this.Je=new Map,this.H_=t,this.U_=i,this.tr=n;}q_(t){const i=t.time,n=this.U_.cacheKey(i),s=this.Qe.get(n);if(void 0!==s)return s.Y_;if(this.Ke===this.tr){const t=this.Je.get(this.Ge);this.Je.delete(this.Ge),this.Qe.delete(m(t)),this.Ge++,this.Ke--;}const e=this.H_(t);return this.Qe.set(n,{Y_:e,er:this.Ze}),this.Je.set(this.Ze,n),this.Ke++,this.Ze++,e}}class Mn{constructor(t,i){p(t<=i,"right should be >= left"),this.X_=t,this.K_=i;}Os(){return this.X_}ui(){return this.K_}Z_(){return this.K_-this.X_+1}Kr(t){return this.X_<=t&&t<=this.K_}yh(t){return this.X_===t.Os()&&this.K_===t.ui()}}function xn(t,i){return null===t||null===i?t===i:t.yh(i)}class Sn{constructor(){this.G_=new Map,this.Qe=null,this.J_=!1;}Q_(t){this.J_=t,this.Qe=null;}tu(t,i){this.iu(i),this.Qe=null;for(let n=i;n<t.length;++n){const i=t[n];let s=this.G_.get(i.timeWeight);void 0===s&&(s=[],this.G_.set(i.timeWeight,s)),s.push({index:n,time:i.time,weight:i.timeWeight,originalTime:i.originalTime});}}nu(t,i){const n=Math.ceil(i/t);return null!==this.Qe&&this.Qe.su===n||(this.Qe={ja:this.eu(n),su:n}),this.Qe.ja}iu(t){if(0===t)return void this.G_.clear();const i=[];this.G_.forEach(((n,s)=>{t<=n[0].index?i.push(s):n.splice(At(n,t,(i=>i.index<t)),1/0);}));for(const t of i)this.G_.delete(t);}eu(t){let i=[];for(const n of Array.from(this.G_.keys()).sort(((t,i)=>i-t))){if(!this.G_.get(n))continue;const s=i;i=[];const e=s.length;let r=0;const h=m(this.G_.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.J_)return s}for(;r<e;r++)i.push(s[r]);}return i}}class kn{constructor(t){this.ru=t;}hu(){return null===this.ru?null:new Mn(Math.floor(this.ru.Os()),Math.ceil(this.ru.ui()))}lu(){return this.ru}static au(){return new kn(null)}}function yn(t,i){return t.weight>i.weight?t:i}class Cn{constructor(t,i,n,s){this.o_=0,this.ou=null,this._u=[],this.wo=null,this.bo=null,this.uu=new Sn,this.cu=new Map,this.du=kn.au(),this.fu=!0,this.vu=new R,this.pu=new R,this.mu=new R,this.bu=null,this.wu=null,this.gu=[],this.cn=i,this.ko=n,this.Mu=i.rightOffset,this.xu=i.barSpacing,this.$i=t,this.U_=s,this.Su(),this.uu.Q_(i.uniformDistribution);}W(){return this.cn}ku(t){D(this.ko,t),this.yu(),this.Su();}Hh(t,i){var n;D(this.cn,t),this.cn.fixLeftEdge&&this.Cu(),this.cn.fixRightEdge&&this.Tu(),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.xu),this.yu(),this.Su(),this.mu.m();}mn(t){var i,n;return null!==(n=null===(i=this._u[t])||void 0===i?void 0:i.time)&&void 0!==n?n:null}Ui(t){var i;return null!==(i=this._u[t])&&void 0!==i?i:null}Da(t,i){if(this._u.length<1)return null;if(this.U_.key(t)>this.U_.key(this._u[this._u.length-1].time))return i?this._u.length-1:null;const n=At(this._u,this.U_.key(t),((t,i)=>this.U_.key(t.time)<i));return this.U_.key(t)<this.U_.key(this._u[n].time)?i?n:null:n}Ni(){return 0===this.o_||0===this._u.length||null===this.ou}Ra(){return this._u.length>0}Xs(){return this.Pu(),this.du.hu()}Ru(){return this.Pu(),this.du.lu()}Du(){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=b(this.Au()),e=b(this.Bu());return {from:b(this.Ui(Math.max(s,i))),to:b(this.Ui(Math.min(e,n)))}}Vu(t){return {from:b(this.Da(t.from,!0)),to:b(this.Da(t.to,!0))}}Hi(){return this.o_}x_(t){if(!isFinite(t)||t<=0)return;if(this.o_===t)return;const i=this.Ru(),n=this.o_;if(this.o_=t,this.fu=!0,this.cn.lockVisibleTimeRangeOnResize&&0!==n){const i=this.xu*t/n;this.xu=i;}if(this.cn.fixLeftEdge&&null!==i&&i.Os()<=0){const i=n-t;this.Mu-=Math.round(i/this.xu)+1,this.fu=!0;}this.Iu(),this.zu();}It(t){if(this.Ni()||!A(t))return 0;const i=this.Lu()+this.Mu-t;return this.o_-(i+.5)*this.xu-1}Js(t,i){const n=this.Lu(),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.Mu-s,r=this.o_-(e+.5)*this.xu-1;t[i].nt=r;}}Eu(t){return Math.ceil(this.Nu(t))}Jn(t){this.fu=!0,this.Mu=t,this.zu(),this.$i.Fu(),this.$i.$h();}he(){return this.xu}Gn(t){this.Wu(t),this.zu(),this.$i.Fu(),this.$i.$h();}ju(){return this.Mu}ja(){if(this.Ni())return null;if(null!==this.wu)return this.wu;const t=this.xu,i=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),n=Math.round(i/t),s=b(this.Xs()),e=Math.max(s.Os(),s.Os()-n),r=Math.max(s.ui(),s.ui()-n),h=this.uu.nu(t,i),l=this.Au()+n,a=this.Bu()-n,o=this.Hu(),_=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.gu.length?(n=this.gu[c],n.coord=this.It(t.index),n.label=this.$u(t),n.weight=t.weight):(n={needAlignCoordinate:!1,coord:this.It(t.index),label:this.$u(t),weight:t.weight},this.gu.push(n)),this.xu>i/2&&!o?n.needAlignCoordinate=!1:n.needAlignCoordinate=_&&t.index<=l||u&&t.index>=a,c++;}return this.gu.length=c,this.wu=this.gu,this.gu}Uu(){this.fu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset);}qu(t){this.fu=!0,this.ou=t,this.zu(),this.Cu();}Yu(t,i){const n=this.Nu(t),s=this.he(),e=s+i*(s/10);this.Gn(e),this.cn.rightBarStaysOnScroll||this.Jn(this.ju()+(n-this.Nu(t)));}Zo(t){this.wo&&this.i_(),null===this.bo&&null===this.bu&&(this.Ni()||(this.bo=t,this.Xu()));}Go(t){if(null===this.bu)return;const i=St(this.o_-t,0,this.o_),n=St(this.o_-b(this.bo),0,this.o_);0!==i&&0!==n&&this.Gn(this.bu.he*i/n);}Jo(){null!==this.bo&&(this.bo=null,this.Ku());}Qo(t){null===this.wo&&null===this.bu&&(this.Ni()||(this.wo=t,this.Xu()));}t_(t){if(null===this.wo)return;const i=(this.wo-t)/this.he();this.Mu=b(this.bu).ju+i,this.fu=!0,this.zu();}i_(){null!==this.wo&&(this.wo=null,this.Ku());}Zu(){this.Gu(this.cn.rightOffset);}Gu(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.Mu,s=performance.now();this.$i.Xn({Ju:t=>(t-s)/i>=1,Qu:e=>{const r=(e-s)/i;return r>=1?t:n+(t-n)*r}});}bt(t,i){this.fu=!0,this._u=t,this.uu.tu(t,i),this.zu();}tc(){return this.vu}nc(){return this.pu}sc(){return this.mu}Lu(){return this.ou||0}ec(t){const i=t.Z_();this.Wu(this.o_/i),this.Mu=t.ui()-this.Lu(),this.zu(),this.fu=!0,this.$i.Fu(),this.$i.$h();}rc(){const t=this.Au(),i=this.Bu();null!==t&&null!==i&&this.ec(new Mn(t,i+this.cn.rightOffset));}hc(t){const i=new Mn(t.from,t.to);this.ec(i);}qi(t){return void 0!==this.ko.timeFormatter?this.ko.timeFormatter(t.originalTime):this.U_.formatHorzItem(t.time)}Hu(){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)}Au(){return 0===this._u.length?null:0}Bu(){return 0===this._u.length?null:this._u.length-1}lc(t){return (this.o_-1-t)/this.xu}Nu(t){const i=this.lc(t),n=this.Lu()+this.Mu-i;return Math.round(1e6*n)/1e6}Wu(t){const i=this.xu;this.xu=t,this.Iu(),i!==this.xu&&(this.fu=!0,this.ac());}Pu(){if(!this.fu)return;if(this.fu=!1,this.Ni())return void this.oc(kn.au());const t=this.Lu(),i=this.o_/this.xu,n=this.Mu+t,s=new Mn(n-i+1,n);this.oc(new kn(s));}Iu(){const t=this._c();if(this.xu<t&&(this.xu=t,this.fu=!0),0!==this.o_){const t=.5*this.o_;this.xu>t&&(this.xu=t,this.fu=!0);}}_c(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&0!==this._u.length?this.o_/this._u.length:this.cn.minBarSpacing}zu(){const t=this.uc();this.Mu>t&&(this.Mu=t,this.fu=!0);const i=this.cc();null!==i&&this.Mu<i&&(this.Mu=i,this.fu=!0);}cc(){const t=this.Au(),i=this.ou;if(null===t||null===i)return null;return t-i-1+(this.cn.fixLeftEdge?this.o_/this.xu:Math.min(2,this._u.length))}uc(){return this.cn.fixRightEdge?0:this.o_/this.xu-Math.min(2,this._u.length)}Xu(){this.bu={he:this.he(),ju:this.ju()};}Ku(){this.bu=null;}$u(t){let i=this.cu.get(t.weight);return void 0===i&&(i=new gn((t=>this.dc(t)),this.U_),this.cu.set(t.weight,i)),i.q_(t)}dc(t){return this.U_.formatTickmark(t,this.ko)}oc(t){const i=this.du;this.du=t,xn(i.hu(),this.du.hu())||this.vu.m(),xn(i.lu(),this.du.lu())||this.pu.m(),this.ac();}ac(){this.wu=null;}yu(){this.ac(),this.cu.clear();}Su(){this.U_.updateFormatter(this.ko);}Cu(){if(!this.cn.fixLeftEdge)return;const t=this.Au();if(null===t)return;const i=this.Xs();if(null===i)return;const n=i.Os()-t;if(n<0){const t=this.Mu-n-1;this.Jn(t);}this.Iu();}Tu(){this.zu(),this.Iu();}}class Tn{K(t,i,n){t.useMediaCoordinateSpace((t=>this.Z(t,i,n)));}wl(t,i,n){t.useMediaCoordinateSpace((t=>this.fc(t,i,n)));}fc(t,i,n){}}class Pn extends Tn{constructor(t){super(),this.vc=new Map,this.zt=t;}Z(t){}fc(t){if(!this.zt.yt)return;const{context:i,mediaSize:n}=t;let s=0;for(const t of this.zt.mc){if(0===t.Zt.length)continue;i.font=t.R;const e=this.bc(i,t.Zt);e>n.width?t.Yu=n.width/e:t.Yu=1,s+=t.wc*t.Yu;}let e=0;switch(this.zt.gc){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.O;for(const t of this.zt.mc){i.save();let s=0;switch(this.zt.Mc){case"left":i.textAlign="left",s=t.wc/2;break;case"center":i.textAlign="center",s=n.width/2;break;case"right":i.textAlign="right",s=n.width-1-t.wc/2;}i.translate(s,e),i.textBaseline="top",i.font=t.R,i.scale(t.Yu,t.Yu),i.fillText(t.Zt,0,t.xc),i.restore(),e+=t.wc*t.Yu;}}bc(t,i){const n=this.Sc(t.font);let s=n.get(i);return void 0===s&&(s=t.measureText(i).width,n.set(i,s)),s}Sc(t){let i=this.vc.get(t);return void 0===i&&(i=new Map,this.vc.set(t,i)),i}}class Rn{constructor(t){this.ft=!0,this.Ft={yt:!1,O:"",mc:[],gc:"center",Mc:"center"},this.Wt=new Pn(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.O=t.color,i.Mc=t.horzAlign,i.gc=t.vertAlign,i.mc=[{Zt:t.text,R:N(t.fontSize,t.fontFamily,t.fontStyle),wc:1.2*t.fontSize,xc:0,Yu:0}]);}}class Dn extends ht{constructor(t,i){super(),this.cn=i,this.wn=new Rn(this);}Rn(){return []}Pn(){return [this.wn]}W(){return this.cn}On(){this.wn.bt();}}var On,An,Bn,Vn,In;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap";}(On||(On={}));class zn{constructor(t,i,n){this.kc=[],this.yc=[],this.o_=0,this.Cc=null,this.Tc=new R,this.Pc=new R,this.Rc=null,this.Dc=t,this.cn=i,this.U_=n,this.Oc=new F(this),this.kl=new Cn(this,i.timeScale,this.cn.localization,n),this.vt=new at(this,i.crosshair),this.Ac=new Gi(i.crosshair),this.Bc=new Dn(this,i.watermark),this.Vc(),this.kc[0].M_(2e3),this.Ic=this.zc(0),this.Lc=this.zc(1);}Kl(){this.Ec(_t.es());}$h(){this.Ec(_t.ss());}aa(){this.Ec(new _t(1));}Zl(t){const i=this.Nc(t);this.Ec(i);}Fc(){return this.Cc}Wc(t){const i=this.Cc;this.Cc=t,null!==i&&this.Zl(i.jc),null!==t&&this.Zl(t.jc);}W(){return this.cn}Hh(t){D(this.cn,t),this.kc.forEach((i=>i.m_(t))),void 0!==t.timeScale&&this.kl.Hh(t.timeScale),void 0!==t.localization&&this.kl.ku(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Tc.m(),this.Ic=this.zc(0),this.Lc=this.zc(1),this.Kl();}Hc(t,i){if("left"===t)return void this.Hh({leftPriceScale:i});if("right"===t)return void this.Hh({rightPriceScale:i});const n=this.$c(t);null!==n&&(n.Dt.Hh(i),this.Tc.m());}$c(t){for(const i of this.kc){const n=i.b_(t);if(null!==n)return {Ht:i,Dt:n}}return null}St(){return this.kl}Uc(){return this.kc}qc(){return this.Bc}Yc(){return this.vt}Xc(){return this.Pc}Kc(t,i){t.zo(i),this.Fu();}x_(t){this.o_=t,this.kl.x_(this.o_),this.kc.forEach((i=>i.x_(t))),this.Fu();}Vc(t){const i=new wn(this.kl,this);void 0!==t?this.kc.splice(t,0,i):this.kc.push(i);const n=void 0===t?this.kc.length-1:t,s=_t.es();return s.Nn(n,{Fn:0,Wn:!0}),this.Ec(s),i}D_(t,i,n){t.D_(i,n);}O_(t,i,n){t.O_(i,n),this.Gl(),this.Ec(this.Zc(t,2));}A_(t,i){t.A_(i),this.Ec(this.Zc(t,2));}B_(t,i,n){i.Do()||t.B_(i,n);}V_(t,i,n){i.Do()||(t.V_(i,n),this.Gl(),this.Ec(this.Zc(t,2)));}I_(t,i){i.Do()||(t.I_(i),this.Ec(this.Zc(t,2)));}L_(t,i){t.L_(i),this.Ec(this.Zc(t,2));}Gc(t){this.kl.Zo(t);}Jc(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.Yu(t,i),this.Fu();}Qc(t){this.td(0),this.nd(t),this.sd();}ed(t){this.kl.Go(t),this.Fu();}rd(){this.kl.Jo(),this.$h();}td(t){this.kl.Qo(t);}nd(t){this.kl.t_(t),this.Fu();}sd(){this.kl.i_(),this.$h();}wt(){return this.yc}hd(t,i,n,s,e){this.vt.gn(t,i);let r=NaN,h=this.kl.Eu(t);const l=this.kl.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.Ac.Oa(r,h,s),this.vt.kn(h,r,s),this.aa(),e||this.Pc.m(this.vt.xt(),{x:t,y:i},n);}ld(t,i,n){const s=n.vn(),e=s.Ct(),r=s.Rt(t,b(e)),h=this.kl.Da(i,!0),l=this.kl.It(b(h));this.hd(l,r,null,n,!0);}ad(t){this.Yc().Cn(),this.aa(),t||this.Pc.m(null,null,null);}Gl(){const t=this.vt.Ht();if(null!==t){const i=this.vt.xn(),n=this.vt.Sn();this.hd(i,n,null,t);}this.vt.On();}od(t,i,n){const s=this.kl.mn(0);void 0!==i&&void 0!==n&&this.kl.bt(i,n);const e=this.kl.mn(0),r=this.kl.Lu(),h=this.kl.Xs();if(null!==h&&null!==s&&null!==e){const i=h.Kr(r),l=this.U_.key(s)>this.U_.key(e),a=null!==t&&t>r&&!l,o=this.kl.W().allowShiftVisibleRangeOnWhitespaceReplacement,_=i&&(!(void 0===n)||o)&&this.kl.W().shiftVisibleRangeOnNewBar;if(a&&!_){const i=t-r;this.kl.Jn(this.kl.ju()-i);}}this.kl.qu(t);}ta(t){null!==t&&t.N_();}cr(t){const i=this.kc.find((i=>i.$o().includes(t)));return void 0===i?null:i}Fu(){this.Bc.On(),this.kc.forEach((t=>t.N_())),this.Gl();}S(){this.kc.forEach((t=>t.S())),this.kc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0;}_d(){return this.Oc}mr(){return this.Oc.W()}w_(){return this.Tc}ud(t,i,n){const s=this.kc[0],e=this.dd(i,t,s,n);return this.yc.push(e),1===this.yc.length?this.Kl():this.$h(),e}fd(t){const i=this.cr(t),n=this.yc.indexOf(t);p(-1!==n,"Series not found"),this.yc.splice(n,1),b(i).Yo(t),t.S&&t.S();}Xl(t,i){const n=b(this.cr(t));n.Yo(t);const s=this.$c(i);if(null===s){const s=t.Ki();n.Uo(t,i,s);}else {const e=s.Ht===n?t.Ki():void 0;s.Ht.Uo(t,i,e);}}rc(){const t=_t.ss();t.$n(),this.Ec(t);}vd(t){const i=_t.ss();i.Yn(t),this.Ec(i);}Zn(){const t=_t.ss();t.Zn(),this.Ec(t);}Gn(t){const i=_t.ss();i.Gn(t),this.Ec(i);}Jn(t){const i=_t.ss();i.Jn(t),this.Ec(i);}Xn(t){const i=_t.ss();i.Xn(t),this.Ec(i);}Un(){const t=_t.ss();t.Un(),this.Ec(t);}pd(){return this.cn.rightPriceScale.visible?"right":"left"}md(){return this.Lc}q(){return this.Ic}Bt(t){const i=this.Lc,n=this.Ic;if(i===n)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Rc||this.Rc.Ts!==n||this.Rc.Ps!==i)this.Rc={Ts:n,Ps:i,bd:new Map};else {const i=this.Rc.bd.get(t);if(void 0!==i)return i}const s=function(t,i,n){const[s,e,r,h]=T(t),[l,a,o,_]=T(i),u=[M(s+n*(l-s)),M(e+n*(a-e)),M(r+n*(o-r)),x(h+n*(_-h))];return `rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}(n,i,t/100);return this.Rc.bd.set(t,s),s}Zc(t,i){const n=new _t(i);if(null!==t){const s=this.kc.indexOf(t);n.Nn(s,{Fn:i});}return n}Nc(t,i){return void 0===i&&(i=2),this.Zc(this.cr(t),i)}Ec(t){this.Dc&&this.Dc(t),this.kc.forEach((t=>t.W_().Uh().bt()));}dd(t,i,n,s){const e=new Zi(this,t,i,n,s),r=void 0!==t.priceScaleId?t.priceScaleId:this.pd();return n.Uo(e,r),ot(r)||e.Hh(t),e}zc(t){const i=this.cn.layout;return "gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}}function Ln(t){return !O(t)&&!B(t)}function En(t){return O(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate";}(An||(An={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible";}(Bn||(Bn={})),function(t){t.Solid="solid",t.VerticalGradient="gradient";}(Vn||(Vn={})),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";}(In||(In={}));const Nn=t=>t.getUTCFullYear();function Fn(t,i,n){return i.replace(/yyyy/g,(t=>ct(Nn(t),4))(t)).replace(/yy/g,(t=>ct(Nn(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=>ct((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>ct((t=>t.getUTCDate())(t),2))(t))}class Wn{constructor(t="yyyy-MM-dd",i="default"){this.wd=t,this.gd=i;}q_(t){return Fn(t,this.wd,this.gd)}}class jn{constructor(t){this.Md=t||"%h:%m:%s";}q_(t){return this.Md.replace("%h",ct(t.getUTCHours(),2)).replace("%m",ct(t.getUTCMinutes(),2)).replace("%s",ct(t.getUTCSeconds(),2))}}const Hn={xd:"yyyy-MM-dd",Sd:"%h:%m:%s",kd:" ",yd:"default"};class $n{constructor(t={}){const i=Object.assign(Object.assign({},Hn),t);this.Cd=new Wn(i.xd,i.yd),this.Td=new jn(i.Sd),this.Pd=i.kd;}q_(t){return `${this.Cd.q_(t)}${this.Pd}${this.Td.q_(t)}`}}function Un(t){return 60*t*60*1e3}function qn(t){return 60*t*1e3}const Yn=[{Rd:(Xn=1,1e3*Xn),Dd:10},{Rd:qn(1),Dd:20},{Rd:qn(5),Dd:21},{Rd:qn(30),Dd:22},{Rd:Un(1),Dd:30},{Rd:Un(3),Dd:31},{Rd:Un(6),Dd:32},{Rd:Un(12),Dd: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=Yn.length-1;n>=0;--n)if(Math.floor(i.getTime()/Yn[n].Rd)!==Math.floor(t.getTime()/Yn[n].Rd))return Yn[n].Dd;return 0}function Zn(t){let i=t;if(B(t)&&(i=Jn(t)),!Ln(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),Ad:i}}function Gn(t){if(!En(t))throw new Error("time must be of type isUTCTimestamp");return {Od:t}}function Jn(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 Qn(t){B(t.time)&&(t.time=Jn(t.time));}class ts{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization);}preprocessData(t){Array.isArray(t)?function(t){t.forEach(Qn);}(t):Qn(t);}createConverterToInternalObj(t){return b(function(t){return 0===t.length?null:Ln(t[0].time)||B(t[0].time)?Zn:Gn}(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.Ad?new Date(1e3*i.Od).getTime():new Date(Date.UTC(i.Ad.year,i.Ad.month-1,i.Ad.day)).getTime()}convertHorzItemToInternal(t){return En(i=t)?Gn(i):Ln(i)?Zn(i):Zn(Jn(i));var i;}updateFormatter(t){if(!this.cn)return;const i=t.dateFormat;this.cn.timeScale.timeVisible?this.Bd=new $n({xd:i,Sd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",kd:" ",yd:t.locale}):this.Bd=new Wn(i,t.locale);}formatHorzItem(t){const i=t;return this.Bd.q_(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.Ad?new Date(1e3*t.Od):new Date(Date.UTC(t.Ad.year,t.Ad.month-1,t.Ad.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(yn,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 Vd(t){return D({localization:{dateFormat:"dd MMM 'yy"}},null!=t?t:{})}}const is="undefined"!=typeof window;function ns(){return !!is&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function ss(){return !!is&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function es(t){return t+t%2}function rs(t,i){return t.Id-i.Id}function hs(t,i,n){const s=(t.Id-i.Id)/(t.ot-i.ot);return Math.sign(s)*Math.min(Math.abs(s),n)}class ls{constructor(t,i,n,s){this.zd=null,this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=0,this.jd=0,this.Hd=t,this.$d=i,this.Ud=n,this.rs=s;}qd(t,i){if(null!==this.zd){if(this.zd.ot===i)return void(this.zd.Id=t);if(Math.abs(this.zd.Id-t)<this.rs)return}this.Nd=this.Ed,this.Ed=this.Ld,this.Ld=this.zd,this.zd={ot:i,Id:t};}Dr(t,i){if(null===this.zd||null===this.Ld)return;if(i-this.zd.ot>50)return;let n=0;const s=hs(this.zd,this.Ld,this.$d),e=rs(this.zd,this.Ld),r=[s],h=[e];if(n+=e,null!==this.Ed){const t=hs(this.Ld,this.Ed,this.$d);if(Math.sign(t)===Math.sign(s)){const i=rs(this.Ld,this.Ed);if(r.push(t),h.push(i),n+=i,null!==this.Nd){const t=hs(this.Ed,this.Nd,this.$d);if(Math.sign(t)===Math.sign(s)){const i=rs(this.Ed,this.Nd);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.Hd||(this.Fd={Id:t,ot:i},this.jd=l,this.Wd=function(t,i){const n=Math.log(i);return Math.log(1*n/-t)/n}(Math.abs(l),this.Ud));}Qu(t){const i=b(this.Fd),n=t-i.ot;return i.Id+this.jd*(Math.pow(this.Ud,n)-1)/Math.log(this.Ud)}Ju(t){return null===this.Fd||this.Yd(t)===this.Wd}Yd(t){const i=t-b(this.Fd).ot;return Math.min(i,this.Wd)}}function as(t,n){const s=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 os(t){var i;t.width=1,t.height=1,null===(i=t.getContext("2d"))||void 0===i||i.clearRect(0,0,1,1);}function _s(t,i,n,s){t.wl&&t.wl(i,n,s);}function us(t,i,n,s){t.K(i,n,s);}function cs(t,i,n,s){const e=t(n,s);for(const t of e){const n=t.gt();null!==n&&i(n);}}function ds(t){is&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),!1}));}class fs{constructor(t,i,n){this.Xd=0,this.Kd=null,this.Zd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.Gd=0,this.Jd=null,this.Qd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.tf=null,this.if=!1,this.nf=null,this.sf=null,this.ef=!1,this.rf=!1,this.hf=!1,this.lf=null,this.af=null,this._f=null,this.uf=null,this.cf=null,this.df=null,this.ff=null,this.vf=0,this.pf=!1,this.mf=!1,this.bf=!1,this.wf=0,this.gf=null,this.Mf=!ss(),this.xf=t=>{this.Sf(t);},this.kf=t=>{if(this.yf(t)){const i=this.Cf(t);if(++this.Gd,this.Jd&&this.Gd>1){const{Tf:n}=this.Pf(ms(t),this.Qd);n<30&&!this.hf&&this.Rf(i,this.Of.Df),this.Af();}}else {const i=this.Cf(t);if(++this.Xd,this.Kd&&this.Xd>1){const{Tf:n}=this.Pf(ms(t),this.Zd);n<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If();}}},this.zf=t,this.Of=i,this.cn=n,this.Lf();}S(){null!==this.lf&&(this.lf(),this.lf=null),null!==this.af&&(this.af(),this.af=null),null!==this.uf&&(this.uf(),this.uf=null),null!==this.cf&&(this.cf(),this.cf=null),null!==this.df&&(this.df(),this.df=null),null!==this._f&&(this._f(),this._f=null),this.Ef(),this.If();}Nf(t){this.uf&&this.uf();const i=this.Ff.bind(this);if(this.uf=()=>{this.zf.removeEventListener("mousemove",i);},this.zf.addEventListener("mousemove",i),this.yf(t))return;const n=this.Cf(t);this.Bf(n,this.Of.Wf),this.Mf=!0;}If(){null!==this.Kd&&clearTimeout(this.Kd),this.Xd=0,this.Kd=null,this.Zd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY};}Af(){null!==this.Jd&&clearTimeout(this.Jd),this.Gd=0,this.Jd=null,this.Qd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY};}Ff(t){if(this.bf||null!==this.sf)return;if(this.yf(t))return;const i=this.Cf(t);this.Bf(i,this.Of.jf),this.Mf=!0;}Hf(t){const i=ws(t.changedTouches,b(this.gf));if(null===i)return;if(this.wf=bs(t),null!==this.ff)return;if(this.mf)return;this.pf=!0;const n=this.Pf(ms(i),b(this.sf)),{$f:s,Uf:e,Tf:r}=n;if(this.ef||!(r<5)){if(!this.ef){const t=.5*s,i=e>=t&&!this.cn.qf(),n=t>e&&!this.cn.Yf();i||n||(this.mf=!0),this.ef=!0,this.hf=!0,this.Ef(),this.Af();}if(!this.mf){const n=this.Cf(t,i);this.Rf(n,this.Of.Xf),ps(t);}}}Kf(t){if(0!==t.button)return;const i=this.Pf(ms(t),b(this.nf)),{Tf:n}=i;if(n>=5&&(this.rf=!0,this.If()),this.rf){const i=this.Cf(t);this.Bf(i,this.Of.Zf);}}Pf(t,i){const n=Math.abs(i.nt-t.nt),s=Math.abs(i.st-t.st);return {$f:n,Uf:s,Tf:n+s}}Gf(t){let i=ws(t.changedTouches,b(this.gf));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.gf=null,this.wf=bs(t),this.Ef(),this.sf=null,this.df&&(this.df(),this.df=null);const n=this.Cf(t,i);if(this.Rf(n,this.Of.Jf),++this.Gd,this.Jd&&this.Gd>1){const{Tf:t}=this.Pf(ms(i),this.Qd);t<30&&!this.hf&&this.Rf(n,this.Of.Df),this.Af();}else this.hf||(this.Rf(n,this.Of.Qf),this.Of.Qf&&ps(t));0===this.Gd&&ps(t),0===t.touches.length&&this.if&&(this.if=!1,ps(t));}Sf(t){if(0!==t.button)return;const i=this.Cf(t);if(this.nf=null,this.bf=!1,this.cf&&(this.cf(),this.cf=null),ns()){this.zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.xf);}if(!this.yf(t))if(this.Bf(i,this.Of.tv),++this.Xd,this.Kd&&this.Xd>1){const{Tf:n}=this.Pf(ms(t),this.Zd);n<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If();}else this.rf||this.Bf(i,this.Of.iv);}Ef(){null!==this.tf&&(clearTimeout(this.tf),this.tf=null);}nv(t){if(null!==this.gf)return;const i=t.changedTouches[0];this.gf=i.identifier,this.wf=bs(t);const n=this.zf.ownerDocument.documentElement;this.hf=!1,this.ef=!1,this.mf=!1,this.sf=ms(i),this.df&&(this.df(),this.df=null);{const i=this.Hf.bind(this),s=this.Gf.bind(this);this.df=()=>{n.removeEventListener("touchmove",i),n.removeEventListener("touchend",s);},n.addEventListener("touchmove",i,{passive:!1}),n.addEventListener("touchend",s,{passive:!1}),this.Ef(),this.tf=setTimeout(this.sv.bind(this,t),240);}const s=this.Cf(t,i);this.Rf(s,this.Of.ev),this.Jd||(this.Gd=0,this.Jd=setTimeout(this.Af.bind(this),500),this.Qd=ms(i));}rv(t){if(0!==t.button)return;const i=this.zf.ownerDocument.documentElement;ns()&&i.addEventListener("mouseleave",this.xf),this.rf=!1,this.nf=ms(t),this.cf&&(this.cf(),this.cf=null);{const t=this.Kf.bind(this),n=this.Sf.bind(this);this.cf=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",n);},i.addEventListener("mousemove",t),i.addEventListener("mouseup",n);}if(this.bf=!0,this.yf(t))return;const n=this.Cf(t);this.Bf(n,this.Of.hv),this.Kd||(this.Xd=0,this.Kd=setTimeout(this.If.bind(this),500),this.Zd=ms(t));}Lf(){this.zf.addEventListener("mouseenter",this.Nf.bind(this)),this.zf.addEventListener("touchcancel",this.Ef.bind(this));{const t=this.zf.ownerDocument,i=t=>{this.Of.lv&&(t.composed&&this.zf.contains(t.composedPath()[0])||t.target&&this.zf.contains(t.target)||this.Of.lv());};this.af=()=>{t.removeEventListener("touchstart",i);},this.lf=()=>{t.removeEventListener("mousedown",i);},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0});}ss()&&(this._f=()=>{this.zf.removeEventListener("dblclick",this.kf);},this.zf.addEventListener("dblclick",this.kf)),this.zf.addEventListener("mouseleave",this.av.bind(this)),this.zf.addEventListener("touchstart",this.nv.bind(this),{passive:!0}),ds(this.zf),this.zf.addEventListener("mousedown",this.rv.bind(this)),this.ov(),this.zf.addEventListener("touchmove",(()=>{}),{passive:!1});}ov(){void 0===this.Of._v&&void 0===this.Of.uv&&void 0===this.Of.cv||(this.zf.addEventListener("touchstart",(t=>this.dv(t.touches)),{passive:!0}),this.zf.addEventListener("touchmove",(t=>{if(2===t.touches.length&&null!==this.ff&&void 0!==this.Of.uv){const i=vs(t.touches[0],t.touches[1])/this.vf;this.Of.uv(this.ff,i),ps(t);}}),{passive:!1}),this.zf.addEventListener("touchend",(t=>{this.dv(t.touches);})));}dv(t){1===t.length&&(this.pf=!1),2!==t.length||this.pf||this.if?this.fv():this.vv(t);}vv(t){const i=this.zf.getBoundingClientRect()||{left:0,top:0};this.ff={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.vf=vs(t[0],t[1]),void 0!==this.Of._v&&this.Of._v(),this.Ef();}fv(){null!==this.ff&&(this.ff=null,void 0!==this.Of.cv&&this.Of.cv());}av(t){if(this.uf&&this.uf(),this.yf(t))return;if(!this.Mf)return;const i=this.Cf(t);this.Bf(i,this.Of.pv),this.Mf=!ss();}sv(t){const i=ws(t.touches,b(this.gf));if(null===i)return;const n=this.Cf(t,i);this.Rf(n,this.Of.mv),this.hf=!0,this.if=!0;}yf(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:bs(t)<this.wf+500}Rf(t,i){i&&i.call(this.Of,t);}Bf(t,i){i&&i.call(this.Of,t);}Cf(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,bv:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,wv:t.type,gv:n.target,Mv:t.view,xv:()=>{"touchstart"!==t.type&&ps(t);}}}}function vs(t,i){const n=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(n*n+s*s)}function ps(t){t.cancelable&&t.preventDefault();}function ms(t){return {nt:t.pageX,st:t.pageY}}function bs(t){return t.timeStamp||performance.now()}function ws(t,i){for(let n=0;n<t.length;++n)if(t[n].identifier===i)return t[n];return null}function gs(t){return {jc:t.jc,Sv:{wr:t.kv.externalId},yv:t.kv.cursorStyle}}function Ms(t,i,n){for(const s of t){const t=s.gt();if(null!==t&&t.br){const e=t.br(i,n);if(null!==e)return {Mv:s,Sv:e}}}return null}function xs(t,i){return n=>{var s,e,r,h;return (null!==(e=null===(s=n.Dt())||void 0===s?void 0:s.Ta())&&void 0!==e?e:"")!==i?[]:null!==(h=null===(r=n.ca)||void 0===r?void 0:r.call(n,t))&&void 0!==h?h:[]}}class Ss{constructor(i,n,s,e){this.Li=null,this.Cv=null,this.Tv=!1,this.Pv=new ii(200),this.Jr=null,this.Rv=0,this.Dv=!1,this.Ov=()=>{this.Dv||this.tn.Av().$t().$h();},this.Bv=()=>{this.Dv||this.tn.Av().$t().$h();},this.tn=i,this.cn=n,this.So=n.layout,this.Oc=s,this.Vv="left"===e,this.Iv=xs("normal",e),this.zv=xs("top",e),this.Lv=xs("bottom",e),this.Ev=document.createElement("div"),this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Ev.style.width="25px",this.Ev.style.left="0",this.Ev.style.position="relative",this.Nv=as(this.Ev,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const r=this.Nv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Fv=as(this.Ev,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const h=this.Fv.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0";const l={hv:this.Wv.bind(this),ev:this.Wv.bind(this),Zf:this.jv.bind(this),Xf:this.jv.bind(this),lv:this.Hv.bind(this),tv:this.$v.bind(this),Jf:this.$v.bind(this),Vf:this.Uv.bind(this),Df:this.Uv.bind(this),Wf:this.qv.bind(this),pv:this.Yv.bind(this)};this.Xv=new fs(this.Fv.canvasElement,l,{qf:()=>!this.cn.handleScroll.vertTouchDrag,Yf:()=>!0});}S(){this.Xv.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Li&&this.Li.Ko().p(this),this.Li=null;}Kv(){return this.Ev}P(){return this.So.fontSize}Zv(){const t=this.Oc.W();return this.Jr!==t.R&&(this.Pv.ir(),this.Jr=t.R),t}Gv(){if(null===this.Li)return 0;let t=0;const i=this.Zv(),n=b(this.Nv.canvasElement.getContext("2d"));n.save();const s=this.Li.ja();n.font=this.Jv(),s.length>0&&(t=Math.max(this.Pv.xi(n,s[0].no),this.Pv.xi(n,s[s.length-1].no)));const e=this.Qv();for(let i=e.length;i--;){const s=this.Pv.xi(n,e[i].Zt());s>t&&(t=s);}const r=this.Li.Ct();if(null!==r&&null!==this.Cv){const i=this.Li.pn(1,r),s=this.Li.pn(this.Cv.height-2,r);t=Math.max(t,this.Pv.xi(n,this.Li.Fi(Math.floor(Math.min(i,s))+.11111111111111,r)),this.Pv.xi(n,this.Li.Fi(Math.ceil(Math.max(i,s))-.11111111111111,r)));}n.restore();const h=t||34;return es(Math.ceil(i.C+i.T+i.V+i.I+5+h))}tp(t){null!==this.Cv&&equalSizes(this.Cv,t)||(this.Cv=t,this.Dv=!0,this.Nv.resizeCanvasElement(t),this.Fv.resizeCanvasElement(t),this.Dv=!1,this.Ev.style.width=`${t.width}px`,this.Ev.style.height=`${t.height}px`);}ip(){return b(this.Cv).width}Gi(t){this.Li!==t&&(null!==this.Li&&this.Li.Ko().p(this),this.Li=t,t.Ko().l(this.do.bind(this),this));}Dt(){return this.Li}ir(){const t=this.tn.np();this.tn.Av().$t().L_(t,b(this.Dt()));}sp(t){if(null===this.Cv)return;if(1!==t){this.ep(),this.Nv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t);})),this.tn.hp(t,this.Lv),this.lp(t),this.tn.hp(t,this.Iv),this.ap(t));}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.op(i),this.tn.hp(i,this.zv));}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}bt(){var t;null===(t=this.Li)||void 0===t||t.ja();}Wv(t){if(null===this.Li||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np();this.Tv=!0,i.D_(n,this.Li,t.localY);}jv(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np(),s=this.Li;i.O_(n,s,t.localY);}Hv(){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.Av().$t(),i=this.tn.np(),n=this.Li;this.Tv&&(this.Tv=!1,t.A_(i,n));}$v(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np();this.Tv=!1,i.A_(n,this.Li);}Uv(t){this.cn.handleScale.axisDoubleClickReset.price&&this.ir();}qv(t){if(null===this.Li)return;!this.tn.Av().$t().W().handleScale.axisPressedMouseMove.price||this.Li.gh()||this.Li.Oo()||this.cp(1);}Yv(t){this.cp(0);}Qv(){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.np(),i);for(let i=0;i<e.length;i++)t.push(e[i]);}})(this.tn.np().$o()),t}rp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.tn.np().$t(),r=e.q(),h=e.md();r===h?Z(t,0,0,n,s,r):Q(t,0,0,n,s,r,h);}Ve({context:t,bitmapSize:i,horizontalPixelRatio:n}){if(null===this.Cv||null===this.Li||!this.Li.W().borderVisible)return;t.fillStyle=this.Li.W().borderColor;const s=Math.max(1,Math.floor(this.Zv().C*n));let e;e=this.Vv?i.width-s:0,t.fillRect(e,0,s,i.height);}lp(t){if(null===this.Cv||null===this.Li)return;const i=this.Li.ja(),n=this.Li.W(),s=this.Zv(),e=this.Vv?this.Cv.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.La*h)-a,o,l);t.fill();})),t.useMediaCoordinateSpace((({context:t})=>{var r;t.font=this.Jv(),t.fillStyle=null!==(r=n.textColor)&&void 0!==r?r:this.So.textColor,t.textAlign=this.Vv?"right":"left",t.textBaseline="middle";const h=this.Vv?Math.round(e-s.V):Math.round(e+s.T+s.V),l=i.map((i=>this.Pv.Mi(t,i.no)));for(let n=i.length;n--;){const s=i[n];t.fillText(s.no,h,s.La+l[n]);}}));}ep(){if(null===this.Cv||null===this.Li)return;let t=this.Cv.height/2;const i=[],n=this.Li.$o().slice(),s=this.tn.np(),e=this.Zv();this.Li===s.vr()&&this.tn.np().$o().forEach((t=>{s.dr(t)&&n.push(t);}));const r=this.Li.Aa()[0],h=this.Li;n.forEach((n=>{const e=n.Rn(s,h);e.forEach((t=>{t.Ai(null),t.Bi()&&i.push(t);})),r===n&&e.length>0&&(t=e[0].ki());})),i.forEach((t=>t.Ai(t.ki())));this.Li.W().alignLabels&&this.dp(i,e,t);}dp(t,i,n){if(null===this.Cv)return;const s=t.filter((t=>t.ki()<=n)),e=t.filter((t=>t.ki()>n));s.sort(((t,i)=>i.ki()-t.ki())),s.length&&e.length&&e.push(s[0]),e.sort(((t,i)=>t.ki()-i.ki()));for(const n of t){const t=Math.floor(n.Vt(i)/2),s=n.ki();s>-t&&s<t&&n.Ai(t),s>this.Cv.height-t&&s<this.Cv.height+t&&n.Ai(this.Cv.height-t);}for(let t=1;t<s.length;t++){const n=s[t],e=s[t-1],r=e.Vt(i,!1),h=n.ki(),l=e.Oi();h>l-r&&n.Ai(l-r);}for(let t=1;t<e.length;t++){const n=e[t],s=e[t-1],r=s.Vt(i,!0),h=n.ki(),l=s.Oi();h<l+r&&n.Ai(l+r);}}ap(t){if(null===this.Cv)return;const i=this.Qv(),n=this.Zv(),s=this.Vv?"right":"left";i.forEach((i=>{if(i.Vi()){i.gt(b(this.Li)).K(t,n,this.Pv,s);}}));}op(t){if(null===this.Cv||null===this.Li)return;const i=this.tn.Av().$t(),n=[],s=this.tn.np(),e=i.Yc().Rn(s,this.Li);e.length&&n.push(e);const r=this.Zv(),h=this.Vv?"right":"left";n.forEach((i=>{i.forEach((i=>{i.gt(b(this.Li)).K(t,r,this.Pv,h);}));}));}cp(t){this.Ev.style.cursor=1===t?"ns-resize":"default";}do(){const t=this.Gv();this.Rv<t&&this.tn.Av().$t().Kl(),this.Rv=t;}Jv(){return N(this.So.fontSize,this.So.fontFamily)}}function ks(t,i){var n,s;return null!==(s=null===(n=t._a)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function ys(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 Cs(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 Ts(t,i){var n,s;return null!==(s=null===(n=t.la)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}class Ps{constructor(i,n){this.Cv=size({width:0,height:0}),this.fp=null,this.vp=null,this.pp=null,this.mp=!1,this.bp=new R,this.wp=new R,this.gp=0,this.Mp=!1,this.xp=null,this.Sp=!1,this.kp=null,this.yp=null,this.Dv=!1,this.Ov=()=>{this.Dv||null===this.Cp||this.$i().$h();},this.Bv=()=>{this.Dv||null===this.Cp||this.$i().$h();},this.Tp=i,this.Cp=n,this.Cp.F_().l(this.Pp.bind(this),this,!0),this.Rp=document.createElement("td"),this.Rp.style.padding="0",this.Rp.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.Dp=document.createElement("td"),this.Dp.style.padding="0",this.Op=document.createElement("td"),this.Op.style.padding="0",this.Rp.appendChild(s),this.Nv=as(s,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const e=this.Nv.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Fv=as(s,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const r=this.Fv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.Ap=document.createElement("tr"),this.Ap.appendChild(this.Dp),this.Ap.appendChild(this.Rp),this.Ap.appendChild(this.Op),this.Bp(),this.Xv=new fs(this.Fv.canvasElement,this,{qf:()=>null===this.xp&&!this.Tp.W().handleScroll.vertTouchDrag,Yf:()=>null===this.xp&&!this.Tp.W().handleScroll.horzTouchDrag});}S(){null!==this.fp&&this.fp.S(),null!==this.vp&&this.vp.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Cp&&this.Cp.F_().p(this),this.Xv.S();}np(){return b(this.Cp)}Vp(t){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=t,null!==this.Cp&&this.Cp.F_().l(Ps.prototype.Pp.bind(this),this,!0),this.Bp();}Av(){return this.Tp}Kv(){return this.Ap}Bp(){if(null!==this.Cp&&(this.Ip(),0!==this.$i().wt().length)){if(null!==this.fp){const t=this.Cp.P_();this.fp.Gi(b(t));}if(null!==this.vp){const t=this.Cp.R_();this.vp.Gi(b(t));}}}zp(){null!==this.fp&&this.fp.bt(),null!==this.vp&&this.vp.bt();}g_(){return null!==this.Cp?this.Cp.g_():0}M_(t){this.Cp&&this.Cp.M_(t);}Wf(t){if(!this.Cp)return;this.Lp();const i=t.localX,n=t.localY;this.Ep(i,n,t);}hv(t){this.Lp(),this.Np(),this.Ep(t.localX,t.localY,t);}jf(t){var i;if(!this.Cp)return;this.Lp();const n=t.localX,s=t.localY;this.Ep(n,s,t);const e=this.br(n,s);this.Tp.Fp(null!==(i=null==e?void 0:e.yv)&&void 0!==i?i:null),this.$i().Wc(e&&{jc:e.jc,Sv:e.Sv});}iv(t){null!==this.Cp&&(this.Lp(),this.Wp(t));}Vf(t){null!==this.Cp&&this.jp(this.wp,t);}Df(t){this.Vf(t);}Zf(t){this.Lp(),this.Hp(t),this.Ep(t.localX,t.localY,t);}tv(t){null!==this.Cp&&(this.Lp(),this.Mp=!1,this.$p(t));}Qf(t){null!==this.Cp&&this.Wp(t);}mv(t){if(this.Mp=!0,null===this.xp){const i={x:t.localX,y:t.localY};this.Up(i,i,t);}}pv(t){null!==this.Cp&&(this.Lp(),this.Cp.$t().Wc(null),this.qp());}Yp(){return this.bp}Xp(){return this.wp}_v(){this.gp=1,this.$i().Un();}uv(t,i){if(!this.Tp.W().handleScale.pinch)return;const n=5*(i-this.gp);this.gp=i,this.$i().Jc(t.nt,n);}ev(t){this.Mp=!1,this.Sp=null!==this.xp,this.Np();const i=this.$i().Yc();null!==this.xp&&i.yt()&&(this.kp={x:i.Yt(),y:i.Xt()},this.xp={x:t.localX,y:t.localY});}Xf(t){if(null===this.Cp)return;const i=t.localX,n=t.localY;if(null===this.xp)this.Hp(t);else {this.Sp=!1;const s=b(this.kp),e=s.x+(i-this.xp.x),r=s.y+(n-this.xp.y);this.Ep(e,r,t);}}Jf(t){0===this.Av().W().trackingMode.exitMode&&(this.Sp=!0),this.Kp(),this.$p(t);}br(t,i){const n=this.Cp;return null===n?null:function(t,i,n){const s=t.$o(),e=function(t,i,n){var s,e;let r,h;for(const o of t){const t=null!==(e=null===(s=o.fa)||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?{kv:r,jc:h}:null}(s,i,n);if("top"===(null==e?void 0:e.kv.zOrder))return gs(e);for(const r of s){if(e&&e.jc===r&&"bottom"!==e.kv.zOrder&&!e.kv.isBackground)return gs(e);const s=Ms(r.Pn(t),i,n);if(null!==s)return {jc:r,Mv:s.Mv,Sv:s.Sv};if(e&&e.jc===r&&"bottom"!==e.kv.zOrder&&e.kv.isBackground)return gs(e)}return (null==e?void 0:e.kv)?gs(e):null}(n,t,i)}Zp(i,n){b("left"===n?this.fp:this.vp).tp(size({width:i,height:this.Cv.height}));}Gp(){return this.Cv}tp(t){equalSizes(this.Cv,t)||(this.Cv=t,this.Dv=!0,this.Nv.resizeCanvasElement(t),this.Fv.resizeCanvasElement(t),this.Dv=!1,this.Rp.style.width=t.width+"px",this.Rp.style.height=t.height+"px");}Jp(){const t=b(this.Cp);t.T_(t.P_()),t.T_(t.R_());for(const i of t.Aa())if(t.dr(i)){const n=i.Dt();null!==n&&t.T_(n),i.On();}}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}sp(t){if(0===t)return;if(null===this.Cp)return;if(t>1&&this.Jp(),null!==this.fp&&this.fp.sp(t),null!==this.vp&&this.vp.sp(t),1!==t){this.Nv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t);})),this.Cp&&(this.Qp(t,ks),this.tm(t),this.im(t),this.Qp(t,ys),this.Qp(t,Cs)));}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.nm(i),this.Qp(i,Ts));}sm(){return this.fp}rm(){return this.vp}hp(t,i){this.Qp(t,i);}Pp(){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=null;}Wp(t){this.jp(this.bp,t);}jp(t,i){const n=i.localX,s=i.localY;t.M()&&t.m(this.$i().St().Eu(n),{x:n,y:s},i);}rp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.$i(),r=e.q(),h=e.md();r===h?Z(t,0,0,n,s,h):Q(t,0,0,n,s,r,h);}tm(t){const i=b(this.Cp).W_().Uh().gt();null!==i&&i.K(t,!1);}im(t){const i=this.$i().qc();this.hm(t,ys,_s,i),this.hm(t,ys,us,i);}nm(t){this.hm(t,ys,us,this.$i().Yc());}Qp(t,i){const n=b(this.Cp).$o();for(const s of n)this.hm(t,i,_s,s);for(const s of n)this.hm(t,i,us,s);}hm(t,i,n,s){const e=b(this.Cp),r=e.$t().Fc(),h=null!==r&&r.jc===s,l=null!==r&&h&&void 0!==r.Sv?r.Sv.gr:void 0;cs(i,(i=>n(i,t,h,l)),s,e);}Ip(){if(null===this.Cp)return;const t=this.Tp,i=this.Cp.P_().W().visible,n=this.Cp.R_().W().visible;i||null===this.fp||(this.Dp.removeChild(this.fp.Kv()),this.fp.S(),this.fp=null),n||null===this.vp||(this.Op.removeChild(this.vp.Kv()),this.vp.S(),this.vp=null);const s=t.$t()._d();i&&null===this.fp&&(this.fp=new Ss(this,t.W(),s,"left"),this.Dp.appendChild(this.fp.Kv())),n&&null===this.vp&&(this.vp=new Ss(this,t.W(),s,"right"),this.Op.appendChild(this.vp.Kv()));}lm(t){return t.bv&&this.Mp||null!==this.xp}am(t){return Math.max(0,Math.min(t,this.Cv.width-1))}om(t){return Math.max(0,Math.min(t,this.Cv.height-1))}Ep(t,i,n){this.$i().hd(this.am(t),this.om(i),n,b(this.Cp));}qp(){this.$i().ad();}Kp(){this.Sp&&(this.xp=null,this.qp());}Up(t,i,n){this.xp=t,this.Sp=!1,this.Ep(i.x,i.y,n);const s=this.$i().Yc();this.kp={x:s.Yt(),y:s.Xt()};}$i(){return this.Tp.$t()}$p(t){if(!this.mp)return;const i=this.$i(),n=this.np();if(i.I_(n,n.vn()),this.pp=null,this.mp=!1,i.sd(),null!==this.yp){const t=performance.now(),n=i.St();this.yp.Dr(n.ju(),t),this.yp.Ju(t)||i.Xn(this.yp);}}Lp(){this.xp=null;}Np(){if(!this.Cp)return;if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)b(document.activeElement).blur();else {const t=document.getSelection();null!==t&&t.removeAllRanges();}!this.Cp.vn().Ni()&&this.$i().St().Ni();}Hp(t){if(null===this.Cp)return;const i=this.$i(),n=i.St();if(n.Ni())return;const s=this.Tp.W(),e=s.handleScroll,r=s.kineticScroll;if((!e.pressedMouseMove||t.bv)&&(!e.horzTouchDrag&&!e.vertTouchDrag||!t.bv))return;const h=this.Cp.vn(),l=performance.now();if(null!==this.pp||this.lm(t)||(this.pp={x:t.clientX,y:t.clientY,Od:l,_m:t.localX,um:t.localY}),null!==this.pp&&!this.mp&&(this.pp.x!==t.clientX||this.pp.y!==t.clientY)){if(t.bv&&r.touch||!t.bv&&r.mouse){const t=n.he();this.yp=new ls(.2/t,7/t,.997,15/t),this.yp.qd(n.ju(),this.pp.Od);}else this.yp=null;h.Ni()||i.B_(this.Cp,h,t.localY),i.td(t.localX),this.mp=!0;}this.mp&&(h.Ni()||i.V_(this.Cp,h,t.localY),i.nd(t.localX),null!==this.yp&&this.yp.qd(n.ju(),l));}}class Rs{constructor(i,n,s,e,r){this.ft=!0,this.Cv=size({width:0,height:0}),this.Ov=()=>this.sp(3),this.Vv="left"===i,this.Oc=s._d,this.cn=n,this.dm=e,this.fm=r,this.Ev=document.createElement("div"),this.Ev.style.width="25px",this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Nv=as(this.Ev,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);}S(){this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose();}Kv(){return this.Ev}Gp(){return this.Cv}tp(t){equalSizes(this.Cv,t)||(this.Cv=t,this.Nv.resizeCanvasElement(t),this.Ev.style.width=`${t.width}px`,this.Ev.style.height=`${t.height}px`,this.ft=!0);}sp(t){if(t<3&&!this.ft)return;if(0===this.Cv.width||0===this.Cv.height)return;this.ft=!1,this.Nv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Nv);null!==i&&i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t);}));}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}Ve({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(!this.dm())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.Vv?i.width-e:0;t.fillRect(h,0,e,r);}rp({context:t,bitmapSize:i}){Z(t,0,0,i.width,i.height,this.fm());}}function Ds(t){return i=>{var n,s;return null!==(s=null===(n=i.da)||void 0===n?void 0:n.call(i,t))&&void 0!==s?s:[]}}const Os=Ds("normal"),As=Ds("top"),Bs=Ds("bottom");class Vs{constructor(i,n){this.vm=null,this.pm=null,this.k=null,this.bm=!1,this.Cv=size({width:0,height:0}),this.wm=new R,this.Pv=new ii(5),this.Dv=!1,this.Ov=()=>{this.Dv||this.Tp.$t().$h();},this.Bv=()=>{this.Dv||this.Tp.$t().$h();},this.Tp=i,this.U_=n,this.cn=i.W().layout,this.gm=document.createElement("tr"),this.Mm=document.createElement("td"),this.Mm.style.padding="0",this.xm=document.createElement("td"),this.xm.style.padding="0",this.Ev=document.createElement("td"),this.Ev.style.height="25px",this.Ev.style.padding="0",this.Sm=document.createElement("div"),this.Sm.style.width="100%",this.Sm.style.height="100%",this.Sm.style.position="relative",this.Sm.style.overflow="hidden",this.Ev.appendChild(this.Sm),this.Nv=as(this.Sm,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const s=this.Nv.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Fv=as(this.Sm,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const e=this.Fv.canvasElement;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0",this.gm.appendChild(this.Mm),this.gm.appendChild(this.Ev),this.gm.appendChild(this.xm),this.km(),this.Tp.$t().w_().l(this.km.bind(this),this),this.Xv=new fs(this.Fv.canvasElement,this,{qf:()=>!0,Yf:()=>!this.Tp.W().handleScroll.horzTouchDrag});}S(){this.Xv.S(),null!==this.vm&&this.vm.S(),null!==this.pm&&this.pm.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose();}Kv(){return this.gm}ym(){return this.vm}Cm(){return this.pm}hv(t){if(this.bm)return;this.bm=!0;const i=this.Tp.$t();!i.St().Ni()&&this.Tp.W().handleScale.axisPressedMouseMove.time&&i.Gc(t.localX);}ev(t){this.hv(t);}lv(){const t=this.Tp.$t();!t.St().Ni()&&this.bm&&(this.bm=!1,this.Tp.W().handleScale.axisPressedMouseMove.time&&t.rd());}Zf(t){const i=this.Tp.$t();!i.St().Ni()&&this.Tp.W().handleScale.axisPressedMouseMove.time&&i.ed(t.localX);}Xf(t){this.Zf(t);}tv(){this.bm=!1;const t=this.Tp.$t();t.St().Ni()&&!this.Tp.W().handleScale.axisPressedMouseMove.time||t.rd();}Jf(){this.tv();}Vf(){this.Tp.W().handleScale.axisDoubleClickReset.time&&this.Tp.$t().Zn();}Df(){this.Vf();}Wf(){this.Tp.$t().W().handleScale.axisPressedMouseMove.time&&this.cp(1);}pv(){this.cp(0);}Gp(){return this.Cv}Tm(){return this.wm}Pm(i,s,e){equalSizes(this.Cv,i)||(this.Cv=i,this.Dv=!0,this.Nv.resizeCanvasElement(i),this.Fv.resizeCanvasElement(i),this.Dv=!1,this.Ev.style.width=`${i.width}px`,this.Ev.style.height=`${i.height}px`,this.wm.m(i)),null!==this.vm&&this.vm.tp(size({width:s,height:i.height})),null!==this.pm&&this.pm.tp(size({width:e,height:i.height}));}Rm(){const t=this.Dm();return Math.ceil(t.C+t.T+t.P+t.L+t.B+t.Om)}bt(){this.Tp.$t().St().ja();}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}sp(t){if(0===t)return;if(1!==t){this.Nv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Nv);null!==i&&(i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t),this.Am(i,Bs);})),this.lp(i),this.Am(i,Os)),null!==this.vm&&this.vm.sp(t),null!==this.pm&&this.pm.sp(t);}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.Bm([...this.Tp.$t().wt(),this.Tp.$t().Yc()],i),this.Am(i,As));}Am(t,i){const n=this.Tp.$t().wt();for(const s of n)cs(i,(i=>_s(i,t,!1,void 0)),s,void 0);for(const s of n)cs(i,(i=>us(i,t,!1,void 0)),s,void 0);}rp({context:t,bitmapSize:i}){Z(t,0,0,i.width,i.height,this.Tp.$t().md());}Ve({context:t,bitmapSize:i,verticalPixelRatio:n}){if(this.Tp.W().timeScale.borderVisible){t.fillStyle=this.Vm();const s=Math.max(1,Math.floor(this.Dm().C*n));t.fillRect(0,0,i.width,s);}}lp(t){const i=this.Tp.$t().St(),n=i.ja();if(!n||0===n.length)return;const s=this.U_.maxTickMarkWeight(n),e=this.Dm(),r=i.W();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this.Vm(),t.fillStyle=this.Vm();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.Jv();for(const e of n)if(e.weight<s){const n=e.needAlignCoordinate?this.Im(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i);}this.Tp.W().timeScale.allowBoldLabels&&(t.font=this.zm());for(const e of n)if(e.weight>=s){const n=e.needAlignCoordinate?this.Im(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i);}}));}Im(t,i,n){const s=this.Pv.xi(t,n),e=s/2,r=Math.floor(i-e)+.5;return r<0?i+=Math.abs(0-r):r+s>this.Cv.width&&(i-=Math.abs(this.Cv.width-(r+s))),i}Bm(t,i){const n=this.Dm();for(const s of t)for(const t of s.Qi())t.gt().K(i,n);}Vm(){return this.Tp.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}Jv(){return N(this.j(),this.cn.fontFamily)}zm(){return N(this.j(),this.cn.fontFamily,"bold")}Dm(){null===this.k&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new ii,Om:0});const t=this.k,i=this.Jv();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.Om=4*n/12,t.Wi.ir();}return this.k}cp(t){this.Ev.style.cursor=1===t?"ew-resize":"default";}km(){const t=this.Tp.$t(),i=t.W();i.leftPriceScale.visible||null===this.vm||(this.Mm.removeChild(this.vm.Kv()),this.vm.S(),this.vm=null),i.rightPriceScale.visible||null===this.pm||(this.xm.removeChild(this.pm.Kv()),this.pm.S(),this.pm=null);const n={_d:this.Tp.$t()._d()},s=()=>i.leftPriceScale.borderVisible&&t.St().W().borderVisible,e=()=>t.md();i.leftPriceScale.visible&&null===this.vm&&(this.vm=new Rs("left",i,n,s,e),this.Mm.appendChild(this.vm.Kv())),i.rightPriceScale.visible&&null===this.pm&&(this.pm=new Rs("right",i,n,s,e),this.xm.appendChild(this.pm.Kv()));}}const Is=!!is&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!is&&((null===(zs=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===zs?void 0:zs.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var zs;class Ls{constructor(t,i,n){var s;this.Lm=[],this.Em=0,this.ro=0,this.o_=0,this.Nm=0,this.Fm=0,this.Wm=null,this.jm=!1,this.bp=new R,this.wp=new R,this.Pc=new R,this.Hm=null,this.$m=null,this.Um=t,this.cn=i,this.U_=n,this.gm=document.createElement("div"),this.gm.classList.add("tv-lightweight-charts"),this.gm.style.overflow="hidden",this.gm.style.direction="ltr",this.gm.style.width="100%",this.gm.style.height="100%",(s=this.gm).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.qm=document.createElement("table"),this.qm.setAttribute("cellspacing","0"),this.gm.appendChild(this.qm),this.Ym=this.Xm.bind(this),Es(this.cn)&&this.Km(!0),this.$i=new zn(this.Dc.bind(this),this.cn,n),this.$t().Xc().l(this.Zm.bind(this),this),this.Gm=new Vs(this,this.U_),this.qm.appendChild(this.Gm.Kv());const e=i.autoSize&&this.Jm();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.Qm(r,h),this.tb(),t.appendChild(this.gm),this.ib(),this.$i.St().sc().l(this.$i.Kl.bind(this.$i),this),this.$i.w_().l(this.$i.Kl.bind(this.$i),this);}$t(){return this.$i}W(){return this.cn}nb(){return this.Lm}sb(){return this.Gm}S(){this.Km(!1),0!==this.Em&&window.cancelAnimationFrame(this.Em),this.$i.Xc().p(this),this.$i.St().sc().p(this),this.$i.w_().p(this),this.$i.S();for(const t of this.Lm)this.qm.removeChild(t.Kv()),t.Yp().p(this),t.Xp().p(this),t.S();this.Lm=[],b(this.Gm).S(),null!==this.gm.parentElement&&this.gm.parentElement.removeChild(this.gm),this.Pc.S(),this.bp.S(),this.wp.S(),this.eb();}Qm(i,n,s=!1){if(this.ro===n&&this.o_===i)return;const e=function(i){const n=Math.floor(i.width),s=Math.floor(i.height);return size({width:n-n%2,height:s-s%2})}(size({width:i,height:n}));this.ro=e.height,this.o_=e.width;const r=this.ro+"px",h=this.o_+"px";b(this.gm).style.height=r,b(this.gm).style.width=h,this.qm.style.height=r,this.qm.style.width=h,s?this.rb(_t.es(),performance.now()):this.$i.Kl();}sp(t){void 0===t&&(t=_t.es());for(let i=0;i<this.Lm.length;i++)this.Lm[i].sp(t.Hn(i).Fn);this.cn.timeScale.visible&&this.Gm.sp(t.jn());}Hh(t){const i=Es(this.cn);this.$i.Hh(t);const n=Es(this.cn);n!==i&&this.Km(n),this.ib(),this.hb(t);}Yp(){return this.bp}Xp(){return this.wp}Xc(){return this.Pc}lb(){null!==this.Wm&&(this.rb(this.Wm,performance.now()),this.Wm=null);const t=this.ab(null),i=document.createElement("canvas");i.width=t.width,i.height=t.height;const n=b(i.getContext("2d"));return this.ab(n),i}ob(t){if("left"===t&&!this._b())return 0;if("right"===t&&!this.ub())return 0;if(0===this.Lm.length)return 0;return b("left"===t?this.Lm[0].sm():this.Lm[0].rm()).ip()}cb(){return this.cn.autoSize&&null!==this.Hm}fb(){return this.gm}Fp(t){this.$m=t,this.$m?this.fb().style.setProperty("cursor",t):this.fb().style.removeProperty("cursor");}pb(){return this.$m}mb(){return m(this.Lm[0]).Gp()}hb(t){(void 0!==t.autoSize||!this.Hm||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.Hm&&this.Jm(),!1===t.autoSize&&null!==this.Hm&&this.eb(),t.autoSize||void 0===t.width&&void 0===t.height||this.Qm(t.width||this.o_,t.height||this.ro));}ab(i){let n=0,s=0;const e=this.Lm[0],r=(t,n)=>{let s=0;for(let e=0;e<this.Lm.length;e++){const r=this.Lm[e],h=b("left"===t?r.sm():r.rm()),l=h._p();null!==i&&h.up(i,n,s),s+=l.height;}};if(this._b()){r("left",0);n+=b(e.sm())._p().width;}for(let t=0;t<this.Lm.length;t++){const e=this.Lm[t],r=e._p();null!==i&&e.up(i,n,s),s+=r.height;}if(n+=e._p().width,this.ub()){r("right",n);n+=b(e.rm())._p().width;}const h=(t,n,s)=>{b("left"===t?this.Gm.ym():this.Gm.Cm()).up(b(i),n,s);};if(this.cn.timeScale.visible){const t=this.Gm._p();if(null!==i){let n=0;this._b()&&(h("left",n,s),n=b(e.sm())._p().width),this.Gm.up(i,n,s),n+=t.width,this.ub()&&h("right",n,s);}s+=t.height;}return size({width:n,height:s})}bb(){let i=0,n=0,s=0;for(const t of this.Lm)this._b()&&(n=Math.max(n,b(t.sm()).Gv(),this.cn.leftPriceScale.minimumWidth)),this.ub()&&(s=Math.max(s,b(t.rm()).Gv(),this.cn.rightPriceScale.minimumWidth)),i+=t.g_();n=es(n),s=es(s);const e=this.o_,r=this.ro,h=Math.max(e-n-s,0),l=this.cn.timeScale.visible;let a=l?Math.max(this.Gm.Rm(),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.Lm.length;++i){const e=this.Lm[i];e.Vp(this.$i.Uc()[i]);let r=0,l=0;l=i===this.Lm.length-1?u-d:Math.round(e.g_()*c),r=Math.max(l,2),d+=r,e.tp(size({width:h,height:r})),this._b()&&e.Zp(n,"left"),this.ub()&&e.Zp(s,"right"),e.np()&&this.$i.Kc(e.np(),r);}this.Gm.Pm(size({width:l?h:0,height:a}),l?n:0,l?s:0),this.$i.x_(h),this.Nm!==n&&(this.Nm=n),this.Fm!==s&&(this.Fm=s);}Km(t){t?this.gm.addEventListener("wheel",this.Ym,{passive:!1}):this.gm.removeEventListener("wheel",this.Ym);}wb(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return Is?1/window.devicePixelRatio:1}Xm(t){if(!(0!==t.deltaX&&this.cn.handleScroll.mouseWheel||0!==t.deltaY&&this.cn.handleScale.mouseWheel))return;const i=this.wb(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.gm.getBoundingClientRect().left;this.$t().Jc(n,i);}0!==n&&this.cn.handleScroll.mouseWheel&&this.$t().Qc(-80*n);}rb(t,i){var n;const s=t.jn();3===s&&this.gb(),3!==s&&2!==s||(this.Mb(t),this.xb(t,i),this.Gm.bt(),this.Lm.forEach((t=>{t.zp();})),3===(null===(n=this.Wm)||void 0===n?void 0:n.jn())&&(this.Wm.ts(t),this.gb(),this.Mb(this.Wm),this.xb(this.Wm,i),t=this.Wm,this.Wm=null)),this.sp(t);}xb(t,i){for(const n of t.Qn())this.ns(n,i);}Mb(t){const i=this.$i.Uc();for(let n=0;n<i.length;n++)t.Hn(n).Wn&&i[n].E_();}ns(t,i){const n=this.$i.St();switch(t.qn){case 0:n.rc();break;case 1:n.hc(t.Ot);break;case 2:n.Gn(t.Ot);break;case 3:n.Jn(t.Ot);break;case 4:n.Uu();break;case 5:t.Ot.Ju(i)||n.Jn(t.Ot.Qu(i));}}Dc(t){null!==this.Wm?this.Wm.ts(t):this.Wm=t,this.jm||(this.jm=!0,this.Em=window.requestAnimationFrame((t=>{if(this.jm=!1,this.Em=0,null!==this.Wm){const i=this.Wm;this.Wm=null,this.rb(i,t);for(const n of i.Qn())if(5===n.qn&&!n.Ot.Ju(t)){this.$t().Xn(n.Ot);break}}})));}gb(){this.tb();}tb(){const t=this.$i.Uc(),i=t.length,n=this.Lm.length;for(let t=i;t<n;t++){const t=m(this.Lm.pop());this.qm.removeChild(t.Kv()),t.Yp().p(this),t.Xp().p(this),t.S();}for(let s=n;s<i;s++){const i=new Ps(this,t[s]);i.Yp().l(this.Sb.bind(this),this),i.Xp().l(this.kb.bind(this),this),this.Lm.push(i),this.qm.insertBefore(i.Kv(),this.Gm.Kv());}for(let n=0;n<i;n++){const i=t[n],s=this.Lm[n];s.np()!==i?s.Vp(i):s.Bp();}this.ib(),this.bb();}yb(t,i,n){var s;const e=new Map;if(null!==t){this.$i.wt().forEach((i=>{const n=i.In().hl(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().Fc(),l=null!==h&&h.jc instanceof Zi?h.jc:void 0,a=null!==h&&void 0!==h.Sv?h.Sv.wr:void 0;return {Cb:r,se:null!=t?t:void 0,Tb:null!=i?i:void 0,Pb:l,Rb:e,Db:a,Ob:null!=n?n:void 0}}Sb(t,i,n){this.bp.m((()=>this.yb(t,i,n)));}kb(t,i,n){this.wp.m((()=>this.yb(t,i,n)));}Zm(t,i,n){this.Pc.m((()=>this.yb(t,i,n)));}ib(){const t=this.cn.timeScale.visible?"":"none";this.Gm.Kv().style.display=t;}_b(){return this.Lm[0].np().P_().W().visible}ub(){return this.Lm[0].np().R_().W().visible}Jm(){return "ResizeObserver"in window&&(this.Hm=new ResizeObserver((t=>{const i=t.find((t=>t.target===this.Um));i&&this.Qm(i.contentRect.width,i.contentRect.height);})),this.Hm.observe(this.Um,{box:"border-box"}),!0)}eb(){null!==this.Hm&&this.Hm.disconnect(),this.Hm=null;}}function Es(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Ns(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 Fs(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.color&&(r.O=n.color),r}function Ws(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.lineColor&&(r.lt=n.lineColor),void 0!==n.topColor&&(r.Ts=n.topColor),void 0!==n.bottomColor&&(r.Ps=n.bottomColor),r}function js(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.topLineColor&&(r.Pe=n.topLineColor),void 0!==n.bottomLineColor&&(r.Re=n.bottomLineColor),void 0!==n.topFillColor1&&(r.Se=n.topFillColor1),void 0!==n.topFillColor2&&(r.ke=n.topFillColor2),void 0!==n.bottomFillColor1&&(r.ye=n.bottomFillColor1),void 0!==n.bottomFillColor2&&(r.Ce=n.bottomFillColor2),r}function Hs(t,i,n,s){const e={se:i,ot:t,Ot:[n.open,n.high,n.low,n.close],Cb:s};return void 0!==n.color&&(e.O=n.color),e}function $s(t,i,n,s){const e={se:i,ot:t,Ot:[n.open,n.high,n.low,n.close],Cb:s};return void 0!==n.color&&(e.O=n.color),void 0!==n.borderColor&&(e.At=n.borderColor),void 0!==n.wickColor&&(e.Xh=n.wickColor),e}function Us(t,i,n,s,e){const r=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 {se:i,ot:t,Ot:o,Cb:s,He:Ns(_,["time","color"]),O:c}}function qs(t){return void 0!==t.Ot}function Ys(t,i){return void 0!==i.customValues&&(t.Ab=i.customValues),t}function Xs(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)?Ys({ot:i,se:n,Cb:e},s):Ys(t(i,n,s,e,r),s)}function Ks(t){return {Candlestick:Xs($s),Bar:Xs(Hs),Area:Xs(Ws),Baseline:Xs(js),Histogram:Xs(Fs),Line:Xs(Fs),Custom:Xs(Us)}[t]}function Zs(t){return {se:0,Bb:new Map,ha:t}}function Gs(t,i){if(void 0!==t&&0!==t.length)return {Vb:i.key(t[0].ot),Ib:i.key(t[t.length-1].ot)}}function Js(t){let i;return t.forEach((t=>{void 0===i&&(i=t.Cb);})),m(i)}class Qs{constructor(t){this.zb=new Map,this.Lb=new Map,this.Eb=new Map,this.Nb=[],this.U_=t;}S(){this.zb.clear(),this.Lb.clear(),this.Eb.clear(),this.Nb=[];}Fb(t,i){let n=0!==this.zb.size,s=!1;const e=this.Lb.get(t);if(void 0!==e)if(1===this.Lb.size)n=!1,s=!0,this.zb.clear();else for(const i of this.Nb)i.pointData.Bb.delete(t)&&(s=!0);let r=[];if(0!==i.length){const n=i.map((t=>t.time)),e=this.U_.createConverterToInternalObj(i),h=Ks(t.Jh()),l=t.ya(),a=t.Ca();r=i.map(((i,r)=>{const o=e(i.time),_=this.U_.key(o);let u=this.zb.get(_);void 0===u&&(u=Zs(o),this.zb.set(_,u),s=!0);const c=h(o,u.se,i,n[r],l,a);return u.Bb.set(t,c),c}));}n&&this.Wb(),this.jb(t,r);let h=-1;if(s){const t=[];this.zb.forEach((i=>{t.push({timeWeight:0,time:i.ha,pointData:i,originalTime:Js(i.Bb)});})),t.sort(((t,i)=>this.U_.key(t.time)-this.U_.key(i.time))),h=this.Hb(t);}return this.$b(t,h,function(t,i,n){const s=Gs(t,n),e=Gs(i,n);if(void 0!==s&&void 0!==e)return {Ql:s.Ib>=e.Ib&&s.Vb>=e.Vb}}(this.Lb.get(t),e,this.U_))}fd(t){return this.Fb(t,[])}Ub(t,i){const n=i;!function(t){void 0===t.Cb&&(t.Cb=t.time);}(n),this.U_.preprocessData(i);const s=this.U_.createConverterToInternalObj([i])(i.time),e=this.Eb.get(t);if(void 0!==e&&this.U_.key(s)<this.U_.key(e))throw new Error(`Cannot update oldest data, last time=${e}, new time=${s}`);let r=this.zb.get(this.U_.key(s));const h=void 0===r;void 0===r&&(r=Zs(s),this.zb.set(this.U_.key(s),r));const l=Ks(t.Jh()),a=t.ya(),o=t.Ca(),_=l(s,r.se,i,n.Cb,a,o);r.Bb.set(t,_),this.qb(t,_);const u={Ql:qs(_)};if(!h)return this.$b(t,-1,u);const c={timeWeight:0,time:r.ha,pointData:r,originalTime:Js(r.Bb)},d=At(this.Nb,this.U_.key(c.time),((t,i)=>this.U_.key(t.time)<i));this.Nb.splice(d,0,c);for(let t=d;t<this.Nb.length;++t)te(this.Nb[t].pointData,t);return this.U_.fillWeightsForPoints(this.Nb,d),this.$b(t,d,u)}qb(t,i){let n=this.Lb.get(t);void 0===n&&(n=[],this.Lb.set(t,n));const s=0!==n.length?n[n.length-1]:null;null===s||this.U_.key(i.ot)>this.U_.key(s.ot)?qs(i)&&n.push(i):qs(i)?n[n.length-1]=i:n.splice(-1,1),this.Eb.set(t,i.ot);}jb(t,i){0!==i.length?(this.Lb.set(t,i.filter(qs)),this.Eb.set(t,i[i.length-1].ot)):(this.Lb.delete(t),this.Eb.delete(t));}Wb(){for(const t of this.Nb)0===t.pointData.Bb.size&&this.zb.delete(this.U_.key(t.time));}Hb(t){let i=-1;for(let n=0;n<this.Nb.length&&n<t.length;++n){const s=this.Nb[n],e=t[n];if(this.U_.key(s.time)!==this.U_.key(e.time)){i=n;break}e.timeWeight=s.timeWeight,te(e.pointData,n);}if(-1===i&&this.Nb.length!==t.length&&(i=Math.min(this.Nb.length,t.length)),-1===i)return -1;for(let n=i;n<t.length;++n)te(t[n].pointData,n);return this.U_.fillWeightsForPoints(t,i),this.Nb=t,i}Yb(){if(0===this.Lb.size)return null;let t=0;return this.Lb.forEach((i=>{0!==i.length&&(t=Math.max(t,i[i.length-1].se));})),t}$b(t,i,n){const s={Xb:new Map,St:{Lu:this.Yb()}};if(-1!==i)this.Lb.forEach(((i,e)=>{s.Xb.set(e,{He:i,Kb:e===t?n:void 0});})),this.Lb.has(t)||s.Xb.set(t,{He:[],Kb:n}),s.St.Zb=this.Nb,s.St.Gb=i;else {const i=this.Lb.get(t);s.Xb.set(t,{He:i||[],Kb:n});}return s}}function te(t,i){t.se=i,t.Bb.forEach((t=>{t.se=i;}));}function ie(t){const i={value:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function ne(t){const i=ie(t);return void 0!==t.O&&(i.color=t.O),i}function se(t){const i=ie(t);return void 0!==t.lt&&(i.lineColor=t.lt),void 0!==t.Ts&&(i.topColor=t.Ts),void 0!==t.Ps&&(i.bottomColor=t.Ps),i}function ee(t){const i=ie(t);return void 0!==t.Pe&&(i.topLineColor=t.Pe),void 0!==t.Re&&(i.bottomLineColor=t.Re),void 0!==t.Se&&(i.topFillColor1=t.Se),void 0!==t.ke&&(i.topFillColor2=t.ke),void 0!==t.ye&&(i.bottomFillColor1=t.ye),void 0!==t.Ce&&(i.bottomFillColor2=t.Ce),i}function re(t){const i={open:t.Ot[0],high:t.Ot[1],low:t.Ot[2],close:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function he(t){const i=re(t);return void 0!==t.O&&(i.color=t.O),i}function le(t){const i=re(t),{O:n,At: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 ae(t){return {Area:se,Line:ne,Baseline:ee,Histogram:ne,Bar:he,Candlestick:le,Custom:oe}[t]}function oe(t){const i=t.Cb;return Object.assign(Object.assign({},t.He),{time:i})}const _e={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},ue={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},ce={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:E},de={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},fe={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},ve={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:E,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function pe(){return {width:0,height:0,autoSize:!1,layout:ce,crosshair:_e,grid:ue,overlayPriceScales:Object.assign({},de),leftPriceScale:Object.assign(Object.assign({},de),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},de),{visible:!0}),timeScale:fe,watermark:ve,localization:{locale:is?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.Jb=t,this.Qb=i;}applyOptions(t){this.Jb.$t().Hc(this.Qb,t);}options(){return this.Li().W()}width(){return ot(this.Qb)?this.Jb.ob(this.Qb):0}Li(){return b(this.Jb.$t().$c(this.Qb)).Dt}}function be(t,i,n){const s=Ns(t,["time","originalTime"]),e=Object.assign({time:i},s);return void 0!==n&&(e.originalTime=n),e}const we={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class ge{constructor(t){this.Eh=t;}applyOptions(t){this.Eh.Hh(t);}options(){return this.Eh.W()}tw(){return this.Eh}}class Me{constructor(t,i,n,s,e){this.iw=new R,this.Ls=t,this.nw=i,this.sw=n,this.U_=e,this.ew=s;}S(){this.iw.S();}priceFormatter(){return this.Ls.ma()}priceToCoordinate(t){const i=this.Ls.Ct();return null===i?null:this.Ls.Dt().Rt(t,i.Ot)}coordinateToPrice(t){const i=this.Ls.Ct();return null===i?null:this.Ls.Dt().pn(t,i.Ot)}barsInLogicalRange(t){if(null===t)return null;const i=new kn(new Mn(t.from,t.to)).hu(),n=this.Ls.In();if(n.Ni())return null;const s=n.hl(i.Os(),1),e=n.hl(i.ui(),-1),r=b(n.sl()),h=b(n.Vn());if(null!==s&&null!==e&&s.se>e.se)return {barsBefore:t.from-r,barsAfter:h-t.to};const l={barsBefore:null===s||s.se===r?t.from-r:s.se-r,barsAfter:null===e||e.se===h?h-t.to:h-e.se};return null!==s&&null!==e&&(l.from=s.Cb,l.to=e.Cb),l}setData(t){this.U_,this.Ls.Jh(),this.nw.rw(this.Ls,t),this.hw("full");}update(t){this.Ls.Jh(),this.nw.lw(this.Ls,t),this.hw("update");}dataByIndex(t,i){const n=this.Ls.In().hl(t,i);if(null===n)return null;return ae(this.seriesType())(n)}data(){const t=ae(this.seriesType());return this.Ls.In().ie().map((i=>t(i)))}subscribeDataChanged(t){this.iw.l(t);}unsubscribeDataChanged(t){this.iw.v(t);}setMarkers(t){this.U_;const i=t.map((t=>be(t,this.U_.convertHorzItemToInternal(t.time),t.time)));this.Ls.ia(i);}markers(){return this.Ls.na().map((t=>be(t,t.originalTime,void 0)))}applyOptions(t){this.Ls.Hh(t);}options(){return I(this.Ls.W())}priceScale(){return this.sw.priceScale(this.Ls.Dt().Ta())}createPriceLine(t){const i=D(I(we),t),n=this.Ls.sa(i);return new ge(n)}removePriceLine(t){this.Ls.ea(t.tw());}seriesType(){return this.Ls.Jh()}attachPrimitive(t){this.Ls.Sa(t),t.attached&&t.attached({chart:this.ew,series:this,requestUpdate:()=>this.Ls.$t().Kl()});}detachPrimitive(t){this.Ls.ka(t),t.detached&&t.detached();}hw(t){this.iw.M()&&this.iw.m(t);}}class xe{constructor(t,i,n){this.aw=new R,this.pu=new R,this.wm=new R,this.$i=t,this.kl=t.St(),this.Gm=i,this.kl.tc().l(this.ow.bind(this)),this.kl.nc().l(this._w.bind(this)),this.Gm.Tm().l(this.uw.bind(this)),this.U_=n;}S(){this.kl.tc().p(this),this.kl.nc().p(this),this.Gm.Tm().p(this),this.aw.S(),this.pu.S(),this.wm.S();}scrollPosition(){return this.kl.ju()}scrollToPosition(t,i){i?this.kl.Gu(t,1e3):this.$i.Jn(t);}scrollToRealTime(){this.kl.Zu();}getVisibleRange(){const t=this.kl.Du();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const i={from:this.U_.convertHorzItemToInternal(t.from),to:this.U_.convertHorzItemToInternal(t.to)},n=this.kl.Vu(i);this.$i.vd(n);}getVisibleLogicalRange(){const t=this.kl.Ru();return null===t?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){p(t.from<=t.to,"The from index cannot be after the to index."),this.$i.vd(t);}resetTimeScale(){this.$i.Zn();}fitContent(){this.$i.rc();}logicalToCoordinate(t){const i=this.$i.St();return i.Ni()?null:i.It(t)}coordinateToLogical(t){return this.kl.Ni()?null:this.kl.Eu(t)}timeToCoordinate(t){const i=this.U_.convertHorzItemToInternal(t),n=this.kl.Da(i,!1);return null===n?null:this.kl.It(n)}coordinateToTime(t){const i=this.$i.St(),n=i.Eu(t),s=i.Ui(n);return null===s?null:s.originalTime}width(){return this.Gm.Gp().width}height(){return this.Gm.Gp().height}subscribeVisibleTimeRangeChange(t){this.aw.l(t);}unsubscribeVisibleTimeRangeChange(t){this.aw.v(t);}subscribeVisibleLogicalRangeChange(t){this.pu.l(t);}unsubscribeVisibleLogicalRangeChange(t){this.pu.v(t);}subscribeSizeChange(t){this.wm.l(t);}unsubscribeSizeChange(t){this.wm.v(t);}applyOptions(t){this.kl.Hh(t);}options(){return Object.assign(Object.assign({},I(this.kl.W())),{barSpacing:this.kl.he()})}ow(){this.aw.M()&&this.aw.m(this.getVisibleRange());}_w(){this.pu.M()&&this.pu.m(this.getVisibleLogicalRange());}uw(t){this.wm.m(t.width,t.height);}}function Se(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 ke(t){return function(t){if(V(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;V(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),V(n)&&(t.handleScale.axisDoubleClickReset={time:n,price:n});}const i=t.handleScroll;V(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i});}(t),t}class ye{constructor(t,i,n){this.cw=new Map,this.dw=new Map,this.fw=new R,this.pw=new R,this.mw=new R,this.bw=new Qs(i);const s=void 0===n?I(pe()):D(I(pe()),ke(n));this.U_=i,this.Jb=new Ls(t,s,i),this.Jb.Yp().l((t=>{this.fw.M()&&this.fw.m(this.ww(t()));}),this),this.Jb.Xp().l((t=>{this.pw.M()&&this.pw.m(this.ww(t()));}),this),this.Jb.Xc().l((t=>{this.mw.M()&&this.mw.m(this.ww(t()));}),this);const e=this.Jb.$t();this.gw=new xe(e,this.Jb.sb(),this.U_);}remove(){this.Jb.Yp().p(this),this.Jb.Xp().p(this),this.Jb.Xc().p(this),this.gw.S(),this.Jb.S(),this.cw.clear(),this.dw.clear(),this.fw.S(),this.pw.S(),this.mw.S(),this.bw.S();}resize(t,i,n){this.autoSizeActive()||this.Jb.Qm(t,i,n);}addCustomSeries(t,i){const n=w(t),s=Object.assign(Object.assign({},_),n.defaultOptions());return this.Mw("Custom",s,i,n)}addAreaSeries(t){return this.Mw("Area",l,t)}addBaselineSeries(t){return this.Mw("Baseline",a,t)}addBarSeries(t){return this.Mw("Bar",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.Mw("Candlestick",e,t)}addHistogramSeries(t){return this.Mw("Histogram",o,t)}addLineSeries(t){return this.Mw("Line",h,t)}removeSeries(t){const i=m(this.cw.get(t)),n=this.bw.fd(i);this.Jb.$t().fd(i),this.xw(n),this.cw.delete(t),this.dw.delete(i);}rw(t,i){this.xw(this.bw.Fb(t,i));}lw(t,i){this.xw(this.bw.Ub(t,i));}subscribeClick(t){this.fw.l(t);}unsubscribeClick(t){this.fw.v(t);}subscribeCrosshairMove(t){this.mw.l(t);}unsubscribeCrosshairMove(t){this.mw.v(t);}subscribeDblClick(t){this.pw.l(t);}unsubscribeDblClick(t){this.pw.v(t);}priceScale(t){return new me(this.Jb,t)}timeScale(){return this.gw}applyOptions(t){this.Jb.Hh(ke(t));}options(){return this.Jb.W()}takeScreenshot(){return this.Jb.lb()}autoSizeActive(){return this.Jb.cb()}chartElement(){return this.Jb.fb()}paneSize(){const t=this.Jb.mb();return {height:t.height,width:t.width}}setCrosshairPosition(t,i,n){const s=this.cw.get(n);if(void 0===s)return;const e=this.Jb.$t().cr(s);null!==e&&this.Jb.$t().ld(t,i,e);}clearCrosshairPosition(){this.Jb.$t().ad(!0);}Mw(t,i,n={},s){Se(n.priceFormat);const e=D(I(u),I(i),n),r=this.Jb.$t().ud(t,e,s),h=new Me(r,this,this,this,this.U_);return this.cw.set(h,r),this.dw.set(r,h),h}xw(t){const i=this.Jb.$t();i.od(t.St.Lu,t.St.Zb,t.St.Gb),t.Xb.forEach(((t,i)=>i.J(t.He,t.Kb))),i.Fu();}Sw(t){return m(this.dw.get(t))}ww(t){const i=new Map;t.Rb.forEach(((t,n)=>{const s=n.Jh(),e=ae(s)(t);if("Custom"!==s)p(function(t){return void 0!==t.open||void 0!==t.value}(e));else {const t=n.Ca();p(!t||!1===t(e));}i.set(this.Sw(n),e);}));const n=void 0!==t.Pb&&this.dw.has(t.Pb)?this.Sw(t.Pb):void 0;return {time:t.Cb,logical:t.se,point:t.Tb,hoveredSeries:n,hoveredObjectId:t.Db,seriesData:i,sourceEvent:t.Ob}}}function Ce(t,i,n){let s;if(B(t)){const i=document.getElementById(t);p(null!==i,`Cannot find element in DOM with id=${t}`),s=i;}else s=t;const e=new ye(s,i,n);return i.setOptions(e.options()),e}function Te(t,i){return Ce(t,new ts,ts.Vd(i))}Object.assign(Object.assign({},u),_);
90947
+ const e={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},r={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},h={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},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},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},o={color:"#26a69a",base:0},_={color:"#2196f3"},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 c,d;function 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 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 p(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function m(t){if(void 0===t)throw new Error("Value is undefined");return t}function b(t){if(null===t)throw new Error("Value is null");return t}function w(t){return b(m(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved";}(c||(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";}(d||(d={}));const 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 M(t){return t<0?0:t>255?255:Math.round(t)||0}function x(t){return t<=0||t>1?Math.min(Math.max(t,0),1):Math.round(1e4*t)/1e4}const S=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,k=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,y=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,C=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function T(t){(t=t.toLowerCase())in g&&(t=g[t]);{const i=C.exec(t)||y.exec(t);if(i)return [M(parseInt(i[1],10)),M(parseInt(i[2],10)),M(parseInt(i[3],10)),x(i.length<5?1:parseFloat(i[4]))]}{const i=k.exec(t);if(i)return [M(parseInt(i[1],16)),M(parseInt(i[2],16)),M(parseInt(i[3],16)),1]}{const i=S.exec(t);if(i)return [M(17*parseInt(i[1],16)),M(17*parseInt(i[2],16)),M(17*parseInt(i[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function P(t){const i=T(t);return {t:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,i:(n=i,.199*n[0]+.687*n[1]+.114*n[2]>160?"black":"white")};var n;}class R{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 D(t,...i){for(const n of i)for(const i in n)void 0!==n[i]&&("object"!=typeof n[i]||void 0===t[i]||Array.isArray(n[i])?t[i]=n[i]:D(t[i],n[i]));return t}function O(t){return "number"==typeof t&&isFinite(t)}function A(t){return "number"==typeof t&&t%1==0}function B(t){return "string"==typeof t}function V(t){return "boolean"==typeof t}function I(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?I(e):e);return n}function z(t){return null!==t}function L(t){return null===t?void 0:t}const E="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function N(t,i,n){return void 0===i&&(i=E),`${n=void 0!==n?`${n} `:""}${t}px ${i}`}class F{constructor(t){this.k={C:1,T:5,P:NaN,R:"",D:"",O:"",A:"",B:0,V: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=N(i,n),t.L=2.5/12*i,t.B=t.L,t.V=i/12*t.T,t.I=i/12*t.T,t.N=0),t.O=this.$(),t.A=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 W{constructor(){this.Y=[];}X(t){this.Y=t;}K(t,i,n){this.Y.forEach((s=>{s.K(t,i,n);}));}}class j{K(t,i,n){t.useBitmapCoordinateSpace((t=>this.Z(t,i,n)));}}class H extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z({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 $(){return {it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const U={from:0,to:1};class q{constructor(t,i){this.ut=new W,this.ct=[],this.dt=[],this.ft=!0,this.F=t,this.vt=i,this.ut.X(this.ct);}bt(t){const i=this.F.wt();i.length!==this.ct.length&&(this.dt=i.map($),this.ct=this.dt.map((t=>{const i=new H;return i.J(t),i})),this.ut.X(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=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.Ot),h.rt=null!==(r=l.At)&&void 0!==r?r:this.F.Bt(h.it[0].st/i.Dt().Vt()),h.it[0].ot=n,h.it[0].nt=s.It(n),h.tt=U;}));}}class Y extends j{constructor(t){super(),this.zt=t;}Z({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.O,t.fillStyle=this.zt.Lt.O,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.O,t.fillStyle=this.zt.Et.O,f(t,this.zt.Et.Nt),v(t,l,0,i.width));}}class X{constructor(t){this.ft=!0,this.Ft={Lt:{et:1,Nt:0,O:"",yt:!1},Et:{et:1,Nt:0,O:"",yt:!1},nt:0,st:0},this.Wt=new Y(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=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.O=n.horzLine.color,s.Lt.et=n.vertLine.width,s.Lt.Nt=n.vertLine.style,s.Lt.O=n.vertLine.color,s.nt=this.jt.Yt(),s.st=this.jt.Xt();}}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 Z(t,i,n,s,e,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,n,s,e),t.restore();}function G(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 J(t,i,n,s,e,r,h=0,l=[0,0,0,0],a=""){if(t.save(),!h||!a||a===r)return G(t,i,n,s,e,l),t.fillStyle=r,t.fill(),void t.restore();const o=h/2;var _;G(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 Q(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 tt{constructor(t,i){this.J(t,i);}J(t,i){this.zt=t,this.Kt=i;}Vt(t,i){return this.zt.yt?t.P+t.L+t.B:0}K(t,i,n,s){if(!this.zt.yt||0===this.zt.Zt.length)return;const e=this.zt.O,r=this.Kt.t,h=t.useBitmapCoordinateSpace((t=>{const h=t.context;h.font=i.R;const l=this.Gt(t,i,n,s),a=l.Jt,o=(t,i)=>{l.Qt?J(h,a.ti,a.ii,a.ni,a.si,t,a.ei,[a.ht,0,0,a.ht],i):J(h,a.ri,a.ii,a.ni,a.si,t,a.ei,[0,a.ht,a.ht,0],i);};return o(r,"transparent"),this.zt.hi&&(h.fillStyle=e,h.fillRect(a.ri,a.li,a.ai-a.ri,a.oi)),o("transparent",r),this.zt._i&&(h.fillStyle=i.A,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.Zt,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.Kt.wi,d=i.B+this.Kt.gi,f=i.V,v=i.I,p=this.zt.Zt,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.Kt.Si)&&void 0!==e?e:this.Kt.ki,P=Math.round(T*o)-Math.floor(.5*o),R=Math.floor(P+x/2-S/2),D=R+S,O="right"===s,A=O?l.width-u:u,B=O?h.width-k:k;let V,I,z;return O?(V=B-y,I=B-C,z=A-_-f-u):(V=B+y,I=B+C,z=A+_+f),{Qt:O,Jt:{ii:R,li:P,ci:D,ni:y,si:S,ht:2*a,ei:k,ti:V,ri:B,ai:I,oi:x,ui:h.width},di:{ii:R/o,ci:D/o,fi:z,pi:b}}}}class it{constructor(t){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Zt:"",yt:!1,hi:!0,mi:!1,At:"",O:"#FFF",_i:!1,bi:!1},this.Ti={Zt:"",yt:!1,hi:!1,mi:!0,At:"",O:"#FFF",_i:!0,bi:!0},this.ft=!0,this.Pi=new(t||tt)(this.Ci,this.yi),this.Ri=new(t||tt)(this.Ti,this.yi);}Zt(){return this.Di(),this.Ci.Zt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0;}Vt(t,i=!1){return Math.max(this.Pi.Vt(t,i),this.Ri.Vt(t,i))}Oi(){return this.yi.Si||0}Ai(t){this.yi.Si=t;}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Vi(){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 nt extends it{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=P(s.labelBackgroundColor);n.t=r.t,t.O=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.Zt=this.Li.Fi(l._t,e),t.yt=!0;}}const st=/[1-9]/g;class et{constructor(){this.zt=null;}J(t){this.zt=t;}K(t,i){if(null===this.zt||!1===this.zt.yt||0===this.zt.Zt.length)return;const n=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.R,Math.round(i.Wi.xi(t,b(this.zt).Zt,st)))));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=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.O;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=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.O;const r=i.Wi.Mi(t,"Apr0");t.translate(a+s,e+r),t.fillText(n.Zt,0,0);}));}}class rt{constructor(t,i,n){this.ft=!0,this.Wt=new et,this.Ft={yt:!1,t:"#4c525e",O:"white",Zt:"",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.Zt=n.qi(b(e)),t.yt=!0;const r=P(i.labelBackgroundColor);t.t=r.t,t.O=r.i,t.hi=n.W().ticksVisible;}}class ht{constructor(){this.Yi=null,this.Xi=0;}Ki(){return this.Xi}Zi(t){this.Xi=t;}Dt(){return this.Yi}Gi(t){this.Yi=t;}Ji(t){return []}Qi(){return []}yt(){return !0}}var lt;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden";}(lt||(lt={}));class at extends ht{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 q(t,this);this.fn=((t,i)=>n=>{const s=i(),e=t();if(n===b(this.tn).vn())return {_t:e,ki:s};{const t=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 rt(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}Xt(){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}On(){this.wn.bt(),this.rn.forEach((t=>t.bt())),this.bn.bt(),this.dn.bt();}An(t){return t&&!t.vn().Ni()?t.vn():null}yn(t,i,n){this.Bn(t,i,n)&&this.On();}Bn(t,i,n){const s=this.ln,e=this.an,r=this.nn,h=this.sn,l=this.tn,a=this.An(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().Vn())).filter(z),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 nt(this,i,n),t.set(i,s)),s}}function ot(t){return "left"===t||"right"===t}class _t{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,Ot:t}];}Xn(t){this.Kn(),this.Ln.push({qn:5,Ot:t});}Un(){this.Kn(),this.Ln.push({qn:6});}Zn(){this.Un(),this.Ln=[{qn:4}];}Gn(t){this.Un(),this.Ln.push({qn:2,Ot:t});}Jn(t){this.Un(),this.Ln.push({qn:3,Ot: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 _t(2)}static es(){return new _t(3)}ns(t){switch(t.qn){case 0:this.$n();break;case 1:this.Yn(t.Ot);break;case 2:this.Gn(t.Ot);break;case 3:this.Jn(t.Ot);break;case 4:this.Zn();break;case 5:this.Xn(t.Ot);break;case 6:this.Kn();}}Kn(){const t=this.Ln.findIndex((t=>5===t.qn));-1!==t&&this.Ln.splice(t,1);}}const ut=".";function ct(t,i){if(!O(t))return "n/a";if(!A(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 dt{constructor(t,i){if(i||(i=1),O(t)&&A(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.os=0,this.Li>0&&this.rs>0){let t=this.Li;for(;t>1;)t/=10,this.os++;}}ls(t){const i=this.Li/this.rs;let n=Math.floor(t),s="";const e=void 0!==this.os?this.os:NaN;if(i>1){let r=+(Math.round(t*i)-n*i).toFixed(this.os);r>=i&&(r-=i,n+=1),s=ut+ct(+r.toFixed(this.os)*this.rs,e);}else n=Math.round(n*i)/i,e>0&&(s=ut+ct(0,e));return n.toFixed(0)+s}}class ft extends dt{constructor(t=100){super(t);}format(t){return `${super.format(t)}%`}}class vt{constructor(t){this._s=t;}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.us(t):t<999995?i+this.us(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this.us(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.us(t/1e9)+"B")}us(t){let i;const n=Math.pow(10,this._s);return i=(t=Math.round(t*n)/n)>=1e-15&&t<1?t.toFixed(this._s).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}function pt(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]=gt(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 mt=6;function bt(t,i){return {nt:t.nt-i.nt,st:t.st-i.st}}function wt(t,i){return {nt:t.nt/i,st:t.st/i}}function gt(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=wt(bt(t[n],t[s]),mt),{nt:r.nt+h.nt,st:r.st+h.st}),bt(t[n],wt(bt(t[e],t[i]),mt))]}function Mt(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 xt extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z(t){var i;if(null===this.G)return;const{it:n,tt:s,cs:e,et:r,Nt:h,ds:l}=this.G,a=null!==(i=this.G.fs)&&void 0!==i?i:this.G.vs?0:t.mediaSize.height;if(null===s)return;const o=t.context;o.lineCap="butt",o.lineJoin="round",o.lineWidth=r,f(o,h),o.lineWidth=1,pt(t,n,l,s,e,this.ps.bind(this),Mt.bind(null,a));}}function St(t,i,n){return Math.min(Math.max(t,i),n)}function kt(t,i,n){return i-t<=n}function yt(t){const i=Math.ceil(t);return i%2==0?i-1:i}class Ct{bs(t,i){const n=this.ws,{gs:s,Ms:e,xs:r,Ss:h,ks:l,fs:a}=i;if(void 0===this.ys||void 0===n||n.gs!==s||n.Ms!==e||n.xs!==r||n.Ss!==h||n.fs!==a||n.ks!==l){const n=t.context.createLinearGradient(0,0,0,l);if(n.addColorStop(0,s),null!=a){const i=St(a*t.verticalPixelRatio/l,0,1);n.addColorStop(i,e),n.addColorStop(i,r);}n.addColorStop(1,h),this.ys=n,this.ws=i;}return this.ys}}class Tt extends xt{constructor(){super(...arguments),this.Cs=new Ct;}ps(t,i){return this.Cs.bs(t,{gs:i.Ts,Ms:"",xs:"",Ss:i.Ps,ks:t.bitmapSize.height})}}function Pt(t,i){const n=t.context;n.strokeStyle=i,n.stroke();}class Rt extends j{constructor(){super(...arguments),this.G=null;}J(t){this.G=t;}Z(t){if(null===this.G)return;const{it:i,tt:n,cs:s,ds:e,et:r,Nt:h,Rs:l}=this.G;if(null===n)return;const a=t.context;a.lineCap="butt",a.lineWidth=r*t.verticalPixelRatio,f(a,h),a.lineJoin="round";const o=this.Ds.bind(this);void 0!==e&&pt(t,i,e,n,s,o,Pt),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 Dt extends Rt{Ds(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 At=Ot.bind(null,!0),Bt=Ot.bind(null,!1);function Vt(t,i){return t.ot<i}function It(t,i){return i<t.ot}function zt(t,i,n){const s=i.Os(),e=i.ui(),r=At(t,s,Vt),h=Bt(t,e,It);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 Lt{constructor(t,i,n){this.As=!0,this.Bs=!0,this.Vs=!0,this.Is=[],this.zs=null,this.Ls=t,this.Es=i,this.Ns=n;}bt(t){this.As=!0,"data"===t&&(this.Bs=!0),"options"===t&&(this.Vs=!0);}gt(){return this.Ls.yt()?(this.Fs(),null===this.zs?null:this.Ws):null}js(){this.Is=this.Is.map((t=>Object.assign(Object.assign({},t),this.Ls.$s().Hs(t.ot))));}Us(){this.zs=null;}Fs(){this.Bs&&(this.qs(),this.Bs=!1),this.Vs&&(this.js(),this.Vs=!1),this.As&&(this.Ys(),this.As=!1);}Ys(){const t=this.Ls.Dt(),i=this.Es.St();if(this.Us(),i.Ni()||t.Ni())return;const n=i.Xs();if(null===n)return;if(0===this.Ls.In().Ks())return;const s=this.Ls.Ct();null!==s&&(this.zs=zt(this.Is,n,this.Ns),this.Zs(t,i,s.Ot),this.Gs());}}class Et extends Lt{constructor(t,i){super(t,i,!0);}Zs(t,i,n){i.Js(this.Is,L(this.zs)),t.Qs(this.Is,n,L(this.zs));}te(t,i){return {ot:t,_t:i,nt:NaN,st:NaN}}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>{const n=i.Ot[3];return this.ne(i.se,n,t)}));}}class Nt extends Et{constructor(t,i){super(t,i),this.Ws=new W,this.ee=new Tt,this.re=new Dt,this.Ws.X([this.ee,this.re]);}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.W();this.ee.J({ds:t.lineType,it:this.Is,Nt:t.lineStyle,et:t.lineWidth,fs:null,vs:t.invertFilledArea,tt:this.zs,cs:this.Es.St().he()}),this.re.J({ds:t.lineVisible?t.lineType:void 0,it:this.Is,Nt:t.lineStyle,et:t.lineWidth,tt:this.zs,cs:this.Es.St().he(),Rs:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0});}}class Ft extends j{constructor(){super(...arguments),this.zt=null,this.le=0,this.ae=0;}J(t){this.zt=t;}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;if(this.le=this.oe(i),this.le>=2){Math.max(1,Math.floor(i))%2!=this.le%2&&this.le--;}this.ae=this.zt._e?Math.min(this.le,Math.floor(i)):this.le;let s=null;const e=this.ae<=this.le&&this.zt.he>=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.ue&&(t.fillStyle=h.ue,s=h.ue);const l=Math.floor(.5*this.ae),a=Math.round(h.nt*i),o=a-l,_=this.ae,u=o+_-1,c=Math.min(h.ce,h.de),d=Math.max(h.ce,h.de),f=Math.round(c*n)-l,v=Math.round(d*n)+l,p=Math.max(v-f,this.ae);t.fillRect(o,f,_,p);const m=Math.ceil(1.5*this.le);if(e){if(this.zt.fe){const i=a-m;let s=Math.max(f,Math.round(h.ve*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.pe*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);}}}oe(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(b(this.zt).he,t)))}}class Wt extends Lt{constructor(t,i){super(t,i,!1);}Zs(t,i,n){i.Js(this.Is,L(this.zs)),t.me(this.Is,n,L(this.zs));}be(t,i,n){return {ot:t,we:i.Ot[0],ge:i.Ot[1],Me:i.Ot[2],xe:i.Ot[3],nt:NaN,ve:NaN,ce:NaN,de:NaN,pe:NaN}}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>this.ne(i.se,i,t)));}}class jt extends Wt{constructor(){super(...arguments),this.Ws=new Ft;}ne(t,i,n){return Object.assign(Object.assign({},this.be(t,i,n)),n.Hs(t))}Gs(){const t=this.Ls.W();this.Ws.J({In:this.Is,he:this.Es.St().he(),fe:t.openVisible,_e:t.thinBars,tt:this.zs});}}class Ht extends xt{constructor(){super(...arguments),this.Cs=new Ct;}ps(t,i){const n=this.G;return this.Cs.bs(t,{gs:i.Se,Ms:i.ke,xs:i.ye,Ss:i.Ce,ks:t.bitmapSize.height,fs:n.fs})}}class $t extends Rt{constructor(){super(...arguments),this.Te=new Ct;}Ds(t,i){const n=this.G;return this.Te.bs(t,{gs:i.Pe,Ms:i.Pe,xs:i.Re,Ss:i.Re,ks:t.bitmapSize.height,fs:n.fs})}}class Ut extends Et{constructor(t,i){super(t,i),this.Ws=new W,this.De=new Ht,this.Oe=new $t,this.Ws.X([this.De,this.Oe]);}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.Ct();if(null===t)return;const i=this.Ls.W(),n=this.Ls.Dt().Rt(i.baseValue.price,t.Ot),s=this.Es.St().he();this.De.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineType,fs:n,vs:!1,tt:this.zs,cs:s}),this.Oe.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineVisible?i.lineType:void 0,Rs:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0,fs:n,tt:this.zs,cs:s});}}class qt extends j{constructor(){super(...arguments),this.zt=null,this.le=0;}J(t){this.zt=t;}Z(t){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;const{horizontalPixelRatio:i}=t;if(this.le=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.he,i),this.le>=2){Math.floor(i)%2!=this.le%2&&this.le--;}const n=this.zt.In;this.zt.Ae&&this.Be(t,n,this.zt.tt),this.zt._i&&this.Ve(t,n,this.zt.tt);const s=this.Ie(i);(!this.zt._i||this.le>2*s)&&this.ze(t,n,this.zt.tt);}Be(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.he*e));l=Math.max(Math.floor(e),Math.min(l,this.le));const a=Math.floor(.5*l);let o=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Le!==h&&(s.fillStyle=n.Le,h=n.Le);const _=Math.round(Math.min(n.ve,n.pe)*r),u=Math.round(Math.max(n.ve,n.pe)*r),c=Math.round(n.ce*r),d=Math.round(n.de*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;}}Ie(t){let i=Math.floor(1*t);this.le<=2*i&&(i=Math.floor(.5*(this.le-1)));const n=Math.max(Math.floor(t),i);return this.le<=2*n?Math.max(Math.floor(t),Math.floor(1*t)):n}Ve(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.Ie(e);let a=null;for(let t=n.from;t<n.to;t++){const n=i[t];n.Ee!==h&&(s.fillStyle=n.Ee,h=n.Ee);let o=Math.round(n.nt*e)-Math.floor(.5*this.le);const _=o+this.le-1,u=Math.round(Math.min(n.ve,n.pe)*r),c=Math.round(Math.max(n.ve,n.pe)*r);if(null!==a&&(o=Math.max(a+1,o),o=Math.min(o,_)),this.zt.he*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=_;}}ze(t,i,n){if(null===this.zt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const l=this.Ie(e);for(let t=n.from;t<n.to;t++){const n=i[t];let a=Math.round(Math.min(n.ve,n.pe)*r),o=Math.round(Math.max(n.ve,n.pe)*r),_=Math.round(n.nt*e)-Math.floor(.5*this.le),u=_+this.le-1;if(n.ue!==h){const t=n.ue;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 Yt extends Wt{constructor(){super(...arguments),this.Ws=new qt;}ne(t,i,n){return Object.assign(Object.assign({},this.be(t,i,n)),n.Hs(t))}Gs(){const t=this.Ls.W();this.Ws.J({In:this.Is,he:this.Es.St().he(),Ae:t.wickVisible,_i:t.borderVisible,tt:this.zs});}}class Xt{constructor(t,i){this.Ne=t,this.Li=i;}K(t,i,n){this.Ne.draw(t,this.Li,i,n);}}class Kt extends Lt{constructor(t,i,n){super(t,i,!1),this.wn=n,this.Ws=new Xt(this.wn.renderer(),(i=>{const n=t.Ct();return null===n?null:t.Dt().Rt(i,n.Ot)}));}Fe(t){return this.wn.priceValueBuilder(t)}We(t){return this.wn.isWhitespace(t)}qs(){const t=this.Ls.$s();this.Is=this.Ls.In().ie().map((i=>Object.assign(Object.assign({ot:i.se,nt:NaN},t.Hs(i.se)),{je:i.He})));}Zs(t,i){i.Js(this.Is,L(this.zs));}Gs(){this.wn.update({bars:this.Is.map(Zt),barSpacing:this.Es.St().he(),visibleRange:this.zs},this.Ls.W());}}function Zt(t){return {x:t.nt,time:t.ot,originalData:t.je,barColor:t.ue}}class Gt extends j{constructor(){super(...arguments),this.zt=null,this.$e=[];}J(t){this.zt=t,this.$e=[];}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return;this.$e.length||this.Ue(i);const s=Math.max(1,Math.floor(n)),e=Math.round(this.zt.qe*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.$e[i-this.zt.tt.from],a=Math.round(h.st*n);let o,_;t.fillStyle=h.ue,a<=e?(o=a,_=r):(o=e,_=a-Math.floor(s/2)+s),t.fillRect(l.Os,o,l.ui-l.Os+1,_-o);}}Ue(t){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return void(this.$e=[]);const i=Math.ceil(this.zt.he*t)<=1?0:Math.max(1,Math.floor(t)),n=Math.round(this.zt.he*t)-i;this.$e=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.$e[i-this.zt.tt.from]={Os:r,ui:h,Ye: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.$e[t-this.zt.tt.from],s=this.$e[t-this.zt.tt.from-1];n.ot===s.ot+1&&(n.Os-s.ui!==i+1&&(s.Ye>s.Xe?s.ui=n.Os-i-1:n.Os=s.ui+i+1));}let s=Math.ceil(this.zt.he*t);for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.$e[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.$e[t-this.zt.tt.from];i.ui-i.Os+1>s&&(i.Ye>i.Xe?i.ui-=1:i.Os+=1);}}}class Jt extends Et{constructor(){super(...arguments),this.Ws=new Gt;}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t={it:this.Is,he:this.Es.St().he(),tt:this.zs,qe:this.Ls.Dt().Rt(this.Ls.W().base,b(this.Ls.Ct()).Ot)};this.Ws.J(t);}}class Qt extends Et{constructor(){super(...arguments),this.Ws=new Dt;}ne(t,i,n){return Object.assign(Object.assign({},this.te(t,i)),n.Hs(t))}Gs(){const t=this.Ls.W(),i={it:this.Is,Nt:t.lineStyle,ds:t.lineVisible?t.lineType:void 0,et:t.lineWidth,Rs:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,tt:this.zs,cs:this.Es.St().he()};this.Ws.J(i);}}const ti=/[2-9]/g;class ii{constructor(t=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Je={},this.Qe=new Map,this.tr=t;}ir(){this.Ke=0,this.Qe.clear(),this.Ze=1,this.Ge=1,this.Je={};}xi(t,i,n){return this.nr(t,i,n).width}Mi(t,i,n){const s=this.nr(t,i,n);return ((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}nr(t,i,n){const s=n||ti,e=String(i).replace(s,"0");if(this.Qe.has(e))return m(this.Qe.get(e)).sr;if(this.Ke===this.tr){const t=this.Je[this.Ge];delete this.Je[this.Ge],this.Qe.delete(t),this.Ge++,this.Ke--;}t.save(),t.textBaseline="middle";const r=t.measureText(e);return t.restore(),0===r.width&&i.length||(this.Qe.set(e,{sr:r,er:this.Ze}),this.Je[this.Ze]=e,this.Ke++,this.Ze++),r}}class ni{constructor(t){this.rr=null,this.k=null,this.hr="right",this.lr=t;}ar(t,i,n){this.rr=t,this.k=i,this.hr=n;}K(t){null!==this.k&&null!==this.rr&&this.rr.K(t,this.k,this.lr,this.hr);}}class si{constructor(t,i,n){this._r=t,this.lr=new ii(50),this.ur=i,this.F=n,this.j=-1,this.Wt=new ni(this.lr);}gt(){const t=this.F.cr(this.ur);if(null===t)return null;const i=t.dr(this.ur)?t.vr():this.ur.Dt();if(null===i)return null;const n=t.pr(i);if("overlay"===n)return null;const s=this.F.mr();return s.P!==this.j&&(this.j=s.P,this.lr.ir()),this.Wt.ar(this._r.Ii(),s,n),this.Wt}}class ei extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}br(t,i){var n;if(!(null===(n=this.zt)||void 0===n?void 0:n.yt))return null;const{st:s,et:e,wr:r}=this.zt;return i>=s-e-7&&i<=s+e+7?{gr:this.zt,wr:r}:null}Z({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.O,t.lineWidth=Math.floor(this.zt.et*n),f(t,this.zt.Nt),v(t,e,0,i.width));}}class ri{constructor(t){this.Mr={st:0,O:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.Sr=new ei,this.ft=!0,this.Ls=t,this.Es=t.$t(),this.Sr.J(this.Mr);}bt(){this.ft=!0;}gt(){return this.Ls.yt()?(this.ft&&(this.kr(),this.ft=!1),this.Sr):null}}class hi extends ri{constructor(t){super(t);}kr(){this.Mr.yt=!1;const t=this.Ls.Dt(),i=t.yr().yr;if(2!==i&&3!==i)return;const n=this.Ls.W();if(!n.baseLineVisible||!this.Ls.yt())return;const s=this.Ls.Ct();null!==s&&(this.Mr.yt=!0,this.Mr.st=t.Rt(s.Ot,s.Ot),this.Mr.O=n.baseLineColor,this.Mr.et=n.baseLineWidth,this.Mr.Nt=n.baseLineStyle);}}class li extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}He(){return this.zt}Z({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.Cr,t.beginPath();const a=Math.max(2,1.5*s.Tr)*i;t.arc(h,l,a,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.Pr,t.beginPath(),t.arc(h,l,s.ht*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=e,t.strokeStyle=s.Rr,t.beginPath(),t.arc(h,l,s.ht*i+e/2,0,2*Math.PI,!1),t.stroke();}}const ai=[{Dr:0,Or:.25,Ar:4,Br:10,Vr:.25,Ir:0,zr:.4,Lr:.8},{Dr:.25,Or:.525,Ar:10,Br:14,Vr:0,Ir:0,zr:.8,Lr:0},{Dr:.525,Or:1,Ar:14,Br:14,Vr:0,Ir:0,zr:0,Lr:0}];function oi(t,i,n,s){return function(t,i){if("transparent"===t)return t;const n=T(t),s=n[3];return `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i*s})`}(t,n+(s-n)*i)}function _i(t,i){const n=t%2600/2600;let s;for(const t of ai)if(n>=t.Dr&&n<=t.Or){s=t;break}p(void 0!==s,"Last price animation internal logic error");const e=(n-s.Dr)/(s.Or-s.Dr);return {Pr:oi(i,e,s.Vr,s.Ir),Rr:oi(i,e,s.zr,s.Lr),ht:(r=e,h=s.Ar,l=s.Br,h+(l-h)*r)};var r,h,l;}class ui{constructor(t){this.Wt=new li,this.ft=!0,this.Er=!0,this.Nr=performance.now(),this.Fr=this.Nr-1,this.Wr=t;}jr(){this.Fr=this.Nr-1,this.bt();}Hr(){if(this.bt(),2===this.Wr.W().lastPriceAnimation){const t=performance.now(),i=this.Fr-t;if(i>0)return void(i<650&&(this.Fr+=2600));this.Nr=t,this.Fr=t+2600;}}bt(){this.ft=!0;}$r(){this.Er=!0;}yt(){return 0!==this.Wr.W().lastPriceAnimation}Ur(){switch(this.Wr.W().lastPriceAnimation){case 0:return !1;case 1:return !0;case 2:return performance.now()<=this.Fr}}gt(){return this.ft?(this.Mt(),this.ft=!1,this.Er=!1):this.Er&&(this.qr(),this.Er=!1),this.Wt}Mt(){this.Wt.J(null);const t=this.Wr.$t().St(),i=t.Xs(),n=this.Wr.Ct();if(null===i||null===n)return;const s=this.Wr.Yr(!0);if(s.Xr||!i.Kr(s.se))return;const e={x:t.It(s.se),y:this.Wr.Dt().Rt(s._t,n.Ot)},r=s.O,h=this.Wr.W().lineWidth,l=_i(this.Zr(),r);this.Wt.J({Cr:r,Tr:h,Pr:l.Pr,Rr:l.Rr,ht:l.ht,Xe:e});}qr(){const t=this.Wt.He();if(null!==t){const i=_i(this.Zr(),t.Cr);t.Pr=i.Pr,t.Rr=i.Rr,t.ht=i.ht;}}Zr(){return this.Ur()?performance.now()-this.Nr:2599}}function ci(t,i){return yt(Math.min(Math.max(t,12),30)*i)}function di(t,i){switch(t){case"arrowDown":case"arrowUp":return ci(i,1);case"circle":return ci(i,.8);case"square":return ci(i,.7)}}function fi(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(ci(t,1))}function vi(t){return Math.max(ci(t,.1),3)}function pi(t,i,n){return i?t:n?Math.ceil(t/2):0}function mi(t,i,n,s,e){const r=di("square",n),h=(r-1)/2,l=t-h,a=i-h;return s>=l&&s<=l+r&&e>=a&&e<=a+r}function bi(t,i,n,s){const e=(di("arrowUp",s)-1)/2*n.Gr,r=(yt(s/2)-1)/2*n.Gr;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 wi(t,i,n,s,e,r){return mi(i,n,s,e,r)}class gi extends j{constructor(){super(...arguments),this.zt=null,this.lr=new ii,this.j=-1,this.H="",this.Jr="";}J(t){this.zt=t;}ar(t,i){this.j===t&&this.H===i||(this.j=t,this.H=i,this.Jr=N(t,i),this.lr.ir());}br(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(xi(s,t,i))return {gr:s.Qr,wr:s.wr}}return null}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:n},s,e){if(null!==this.zt&&null!==this.zt.tt){t.textBaseline="middle",t.font=this.Jr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const e=this.zt.it[s];void 0!==e.Zt&&(e.Zt.Hi=this.lr.xi(t,e.Zt.th),e.Zt.Vt=this.j,e.Zt.nt=e.nt-e.Zt.Hi/2),Mi(e,t,i,n);}}}}function Mi(t,i,n,s){i.fillStyle=t.O,void 0!==t.Zt&&function(t,i,n,s,e,r){t.save(),t.scale(e,r),t.fillText(i,n,s),t.restore();}(i,t.Zt.th,t.Zt.nt,t.Zt.st,n,s),function(t,i,n){if(0===t.Ks)return;switch(t.ih){case"arrowDown":return void bi(!1,i,n,t.Ks);case"arrowUp":return void bi(!0,i,n,t.Ks);case"circle":return void function(t,i,n){const s=(di("circle",n)-1)/2;t.beginPath(),t.arc(i.nt,i.st,s*i.Gr,0,2*Math.PI,!1),t.fill();}(i,n,t.Ks);case"square":return void function(t,i,n){const s=di("square",n),e=(s-1)*i.Gr/2,r=i.nt-e,h=i.st-e;t.fillRect(r,h,s*i.Gr,s*i.Gr);}(i,n,t.Ks)}t.ih;}(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,Gr:i}}(t,n,s));}function xi(t,i,n){return !(void 0===t.Zt||!function(t,i,n,s,e,r){const h=s/2;return e>=t&&e<=t+n&&r>=i-h&&r<=i+h}(t.Zt.nt,t.Zt.st,t.Zt.Hi,t.Zt.Vt,i,n))||function(t,i,n){if(0===t.Ks)return !1;switch(t.ih){case"arrowDown":case"arrowUp":return wi(0,t.nt,t.st,t.Ks,i,n);case"circle":return function(t,i,n,s,e){const r=2+di("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 mi(t.nt,t.st,t.Ks,i,n)}}(t,i,n)}function Si(t,i,n,s,e,r,h,l,a){const o=O(n)?n:n.xe,_=O(n)?n:n.ge,u=O(n)?n:n.Me,c=O(i.size)?Math.max(i.size,0):1,d=fi(l.he())*c,f=d/2;switch(t.Ks=d,i.position){case"inBar":return t.st=h.Rt(o,a),void(void 0!==t.Zt&&(t.Zt.st=t.st+f+r+.6*e));case"aboveBar":return t.st=h.Rt(_,a)-f-s.nh,void 0!==t.Zt&&(t.Zt.st=t.st-f-.6*e,s.nh+=1.2*e),void(s.nh+=d+r);case"belowBar":return t.st=h.Rt(u,a)+f+s.sh,void 0!==t.Zt&&(t.Zt.st=t.st+f+r+.6*e,s.sh+=1.2*e),void(s.sh+=d+r)}i.position;}class ki{constructor(t,i){this.ft=!0,this.eh=!0,this.rh=!0,this.hh=null,this.ah=null,this.Wt=new gi,this.Wr=t,this.$i=i,this.zt={it:[],tt:null};}bt(t){this.ft=!0,this.rh=!0,"data"===t&&(this.eh=!0,this.ah=null);}gt(t){if(!this.Wr.yt())return null;this.ft&&this.oh();const i=this.$i.W().layout;return this.Wt.ar(i.fontSize,i.fontFamily),this.Wt.J(this.zt),this.Wt}_h(){if(this.rh){if(this.Wr.uh().length>0){const t=this.$i.St().he(),i=vi(t),n=1.5*fi(t)+2*i,s=this.dh();this.hh={above:pi(n,s.aboveBar,s.inBar),below:pi(n,s.belowBar,s.inBar)};}else this.hh=null;this.rh=!1;}return this.hh}dh(){return null===this.ah&&(this.ah=this.Wr.uh().reduce(((t,i)=>(t[i.position]||(t[i.position]=!0),t)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.ah}oh(){const t=this.Wr.Dt(),i=this.$i.St(),n=this.Wr.uh();this.eh&&(this.zt.it=n.map((t=>({ot:t.time,nt:0,st:0,Ks:0,ih:t.shape,O:t.color,Qr:t.Qr,wr:t.id,Zt:void 0}))),this.eh=!1);const s=this.$i.W().layout;this.zt.tt=null;const e=i.Xs();if(null===e)return;const r=this.Wr.Ct();if(null===r)return;if(0===this.zt.it.length)return;let h=NaN;const l=vi(i.he()),a={nh:l,sh:l};this.zt.tt=zt(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.nh=l,a.sh=l,h=o.time);const _=this.zt.it[e];_.nt=i.It(o.time),void 0!==o.text&&o.text.length>0&&(_.Zt={th:o.text,nt:0,st:0,Hi:0,Vt:0});const u=this.Wr.fh(o.time);null!==u&&Si(_,o,u,a,s.fontSize,l,t,i,r.Ot);}this.ft=!1;}}class yi extends ri{constructor(t){super(t);}kr(){const t=this.Mr;t.yt=!1;const i=this.Ls.W();if(!i.priceLineVisible||!this.Ls.yt())return;const n=this.Ls.Yr(0===i.priceLineSource);n.Xr||(t.yt=!0,t.st=n.ki,t.O=this.Ls.ph(n.O),t.et=i.priceLineWidth,t.Nt=i.priceLineStyle);}}class Ci extends it{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.mh(),l=0===e.seriesLastValueMode,a=s.Yr(!1);if(a.Xr)return;r&&(t.Zt=this.bh(a,r,l),t.yt=0!==t.Zt.length),(h||l)&&(i.Zt=this.wh(a,r,h,l),i.yt=i.Zt.length>0);const o=s.ph(a.O),_=P(o);n.t=_.t,n.ki=a.ki,i.At=s.$t().Bt(a.ki/s.Dt().Vt()),t.At=o,t.O=_.i,i.O=_.i;}wh(t,i,n,s){let e="";const r=this.jt.mh();return n&&0!==r.length&&(e+=`${r} `),i&&s&&(e+=this.jt.Dt().gh()?t.Mh:t.xh),e.trim()}bh(t,i,n){return i?n?this.jt.Dt().gh()?t.xh:t.Mh:t.Zt:""}}function Ti(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 Pi{constructor(t,i){this.Sh=t,this.kh=i;}yh(t){return null!==t&&(this.Sh===t.Sh&&this.kh===t.kh)}Ch(){return new Pi(this.Sh,this.kh)}Th(){return this.Sh}Ph(){return this.kh}Rh(){return this.kh-this.Sh}Ni(){return this.kh===this.Sh||Number.isNaN(this.kh)||Number.isNaN(this.Sh)}ts(t){return null===t?this:new Pi(Ti(Math.min,this.Th(),t.Th(),-1/0),Ti(Math.max,this.Ph(),t.Ph(),1/0))}Dh(t){if(!O(t))return;if(0===this.kh-this.Sh)return;const i=.5*(this.kh+this.Sh);let n=this.kh-i,s=this.Sh-i;n*=t,s*=t,this.kh=i+n,this.Sh=i+s;}Oh(t){O(t)&&(this.kh+=t,this.Sh+=t);}Ah(){return {minValue:this.Sh,maxValue:this.kh}}static Bh(t){return null===t?null:new Pi(t.minValue,t.maxValue)}}class Ri{constructor(t,i){this.Vh=t,this.Ih=i||null;}zh(){return this.Vh}Lh(){return this.Ih}Ah(){return null===this.Vh?null:{priceRange:this.Vh.Ah(),margins:this.Ih||void 0}}static Bh(t){return null===t?null:new Ri(Pi.Bh(t.priceRange),t.margins)}}class Di extends ri{constructor(t,i){super(t),this.Eh=i;}kr(){const t=this.Mr;t.yt=!1;const i=this.Eh.W();if(!this.Ls.yt()||!i.lineVisible)return;const n=this.Eh.Nh();null!==n&&(t.yt=!0,t.st=n,t.O=i.color,t.et=i.lineWidth,t.Nt=i.lineStyle,t.wr=this.Eh.W().id);}}class Oi extends it{constructor(t,i){super(),this.Wr=t,this.Eh=i;}zi(t,i,n){t.yt=!1,i.yt=!1;const s=this.Eh.W(),e=s.axisLabelVisible,r=""!==s.title,h=this.Wr;if(!e||!h.yt())return;const l=this.Eh.Nh();if(null===l)return;r&&(i.Zt=s.title,i.yt=!0),i.At=h.$t().Bt(l/h.Dt().Vt()),t.Zt=this.Fh(s.price),t.yt=!0;const a=P(s.axisLabelColor||s.color);n.t=a.t;const o=s.axisLabelTextColor||a.i;t.O=o,i.O=o,n.ki=l;}Fh(t){const i=this.Wr.Ct();return null===i?"":this.Wr.Dt().Fi(t,i.Ot)}}class Ai{constructor(t,i){this.Wr=t,this.cn=i,this.Wh=new Di(t,this),this._r=new Oi(t,this),this.jh=new si(this._r,t,t.$t());}Hh(t){D(this.cn,t),this.bt(),this.Wr.$t().$h();}W(){return this.cn}Uh(){return this.Wh}qh(){return this.jh}Yh(){return this._r}bt(){this.Wh.bt(),this._r.bt();}Nh(){const t=this.Wr,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.Ot)}}class Bi extends ht{constructor(t){super(),this.$i=t;}$t(){return this.$i}}const Vi={Bar:(t,i,n,s)=>{var e;const r=i.upColor,h=i.downColor,l=b(t(n,s)),a=w(l.Ot[0])<=w(l.Ot[3]);return {ue:null!==(e=l.O)&&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=b(t(n,s)),f=w(d.Ot[0])<=w(d.Ot[3]);return {ue:null!==(e=d.O)&&void 0!==e?e:f?l:a,Ee:null!==(r=d.At)&&void 0!==r?r:f?o:_,Le:null!==(h=d.Xh)&&void 0!==h?h:f?u:c}},Custom:(t,i,n,s)=>{var e;return {ue:null!==(e=b(t(n,s)).O)&&void 0!==e?e:i.color}},Area:(t,i,n,s)=>{var e,r,h,l;const a=b(t(n,s));return {ue:null!==(e=a.lt)&&void 0!==e?e:i.lineColor,lt:null!==(r=a.lt)&&void 0!==r?r:i.lineColor,Ts:null!==(h=a.Ts)&&void 0!==h?h:i.topColor,Ps:null!==(l=a.Ps)&&void 0!==l?l:i.bottomColor}},Baseline:(t,i,n,s)=>{var e,r,h,l,a,o;const _=b(t(n,s));return {ue:_.Ot[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,Pe:null!==(e=_.Pe)&&void 0!==e?e:i.topLineColor,Re:null!==(r=_.Re)&&void 0!==r?r:i.bottomLineColor,Se:null!==(h=_.Se)&&void 0!==h?h:i.topFillColor1,ke:null!==(l=_.ke)&&void 0!==l?l:i.topFillColor2,ye:null!==(a=_.ye)&&void 0!==a?a:i.bottomFillColor1,Ce:null!==(o=_.Ce)&&void 0!==o?o:i.bottomFillColor2}},Line:(t,i,n,s)=>{var e,r;const h=b(t(n,s));return {ue:null!==(e=h.O)&&void 0!==e?e:i.color,lt:null!==(r=h.O)&&void 0!==r?r:i.color}},Histogram:(t,i,n,s)=>{var e;return {ue:null!==(e=b(t(n,s)).O)&&void 0!==e?e:i.color}}};class Ii{constructor(t){this.Kh=(t,i)=>void 0!==i?i.Ot:this.Wr.In().Zh(t),this.Wr=t,this.Gh=Vi[t.Jh()];}Hs(t,i){return this.Gh(this.Kh,this.Wr.W(),t,i)}}var zi;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight";}(zi||(zi={}));const Li=30;class Ei{constructor(){this.Qh=[],this.tl=new Map,this.il=new Map;}nl(){return this.Ks()>0?this.Qh[this.Qh.length-1]:null}sl(){return this.Ks()>0?this.el(0):null}Vn(){return this.Ks()>0?this.el(this.Qh.length-1):null}Ks(){return this.Qh.length}Ni(){return 0===this.Ks()}Kr(t){return null!==this.rl(t,0)}Zh(t){return this.hl(t)}hl(t,i=0){const n=this.rl(t,i);return null===n?null:Object.assign(Object.assign({},this.ll(n)),{se:this.el(n)})}ie(){return this.Qh}al(t,i,n){if(this.Ni())return null;let s=null;for(const e of n){s=Ni(s,this.ol(t,i,e));}return s}J(t){this.il.clear(),this.tl.clear(),this.Qh=t;}el(t){return this.Qh[t].se}ll(t){return this.Qh[t]}rl(t,i){const n=this._l(t);if(null===n&&0!==i)switch(i){case-1:return this.ul(t);case 1:return this.cl(t);default:throw new TypeError("Unknown search mode")}return n}ul(t){let i=this.dl(t);return i>0&&(i-=1),i!==this.Qh.length&&this.el(i)<t?i:null}cl(t){const i=this.fl(t);return i!==this.Qh.length&&t<this.el(i)?i:null}_l(t){const i=this.dl(t);return i===this.Qh.length||t<this.Qh[i].se?null:i}dl(t){return At(this.Qh,t,((t,i)=>t.se<i))}fl(t){return Bt(this.Qh,t,((t,i)=>t.se>i))}vl(t,i,n){let s=null;for(let e=t;e<i;e++){const t=this.Qh[e].Ot[n];Number.isNaN(t)||(null===s?s={pl:t,ml:t}:(t<s.pl&&(s.pl=t),t>s.ml&&(s.ml=t)));}return s}ol(t,i,n){if(this.Ni())return null;let s=null;const e=b(this.sl()),r=b(this.Vn()),h=Math.max(t,e),l=Math.min(i,r),a=Math.ceil(h/Li)*Li,o=Math.max(a,Math.floor(l/Li)*Li);{const t=this.dl(h),e=this.fl(Math.min(l,a,i));s=Ni(s,this.vl(t,e,n));}let _=this.tl.get(n);void 0===_&&(_=new Map,this.tl.set(n,_));for(let t=Math.max(a+1,h);t<o;t+=Li){const i=Math.floor(t/Li);let e=_.get(i);if(void 0===e){const t=this.dl(i*Li),s=this.fl((i+1)*Li-1);e=this.vl(t,s,n),_.set(i,e);}s=Ni(s,e);}{const t=this.dl(o),i=this.fl(l);s=Ni(s,this.vl(t,i,n));}return s}}function Ni(t,i){if(null===t)return i;if(null===i)return t;return {pl:Math.min(t.pl,i.pl),ml:Math.max(t.ml,i.ml)}}class Fi{constructor(t){this.bl=t;}K(t,i,n){this.bl.draw(t);}wl(t,i,n){var s,e;null===(e=(s=this.bl).drawBackground)||void 0===e||e.call(s,t);}}class Wi{constructor(t){this.Qe=null,this.wn=t;}gt(){var t;const i=this.wn.renderer();if(null===i)return null;if((null===(t=this.Qe)||void 0===t?void 0:t.gl)===i)return this.Qe.Ml;const n=new Fi(i);return this.Qe={gl:i,Ml:n},n}xl(){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 ji(t){var i,n,s,e,r;return {Zt:t.text(),ki:t.coordinate(),Si:null===(i=t.fixedCoordinate)||void 0===i?void 0:i.call(t),O: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 Hi{constructor(t,i){this.Wt=new et,this.Sl=t,this.kl=i;}gt(){return this.Wt.J(Object.assign({Hi:this.kl.Hi()},ji(this.Sl))),this.Wt}}class $i extends it{constructor(t,i){super(),this.Sl=t,this.Li=i;}zi(t,i,n){const s=ji(this.Sl);n.t=s.t,t.O=s.O;const e=2/12*this.Li.P();n.wi=e,n.gi=e,n.ki=s.ki,n.Si=s.Si,t.Zt=s.Zt,t.yt=s.yt,t.hi=s.hi;}}class Ui{constructor(t,i){this.yl=null,this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=t,this.Wr=i;}Ol(){return this.Dl}On(){var t,i;null===(i=(t=this.Dl).updateAllViews)||void 0===i||i.call(t);}Pn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).paneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.yl)||void 0===s?void 0:s.gl)===e)return this.yl.Ml;const r=e.map((t=>new Wi(t)));return this.yl={gl:e,Ml:r},r}Qi(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).timeAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Cl)||void 0===s?void 0:s.gl)===e)return this.Cl.Ml;const r=this.Wr.$t().St(),h=e.map((t=>new Hi(t,r)));return this.Cl={gl:e,Ml:h},h}Rn(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).priceAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Tl)||void 0===s?void 0:s.gl)===e)return this.Tl.Ml;const r=this.Wr.Dt(),h=e.map((t=>new $i(t,r)));return this.Tl={gl:e,Ml:h},h}Al(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).priceAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Pl)||void 0===s?void 0:s.gl)===e)return this.Pl.Ml;const r=e.map((t=>new Wi(t)));return this.Pl={gl:e,Ml:r},r}Bl(){var t,i,n,s;const e=null!==(n=null===(i=(t=this.Dl).timeAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];if((null===(s=this.Rl)||void 0===s?void 0:s.gl)===e)return this.Rl.Ml;const r=e.map((t=>new Wi(t)));return this.Rl={gl:e,Ml:r},r}Vl(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Dl).autoscaleInfo)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}br(t,i){var n,s,e;return null!==(e=null===(s=(n=this.Dl).hitTest)||void 0===s?void 0:s.call(n,t,i))&&void 0!==e?e:null}}function qi(t,i,n,s){t.forEach((t=>{i(t).forEach((t=>{t.xl()===n&&s.push(t);}));}));}function Yi(t){return t.Pn()}function Xi(t){return t.Al()}function Ki(t){return t.Bl()}class Zi extends Bi{constructor(t,i,n,s,e){super(t),this.zt=new Ei,this.Wh=new yi(this),this.Il=[],this.zl=new hi(this),this.Ll=null,this.El=null,this.Nl=[],this.Fl=[],this.Wl=null,this.jl=[],this.cn=i,this.Hl=n;const r=new Ci(this);this.rn=[r],this.jh=new si(r,this,t),"Area"!==n&&"Line"!==n&&"Baseline"!==n||(this.Ll=new ui(this)),this.$l(),this.Ul(e);}S(){null!==this.Wl&&clearTimeout(this.Wl);}ph(t){return this.cn.priceLineColor||t}Yr(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.nl();if(null===t)return i;r=t,h=t.se;}else {const t=this.zt.hl(s.ui(),-1);if(null===t)return i;if(r=this.zt.Zh(t.se),null===r)return i;h=t.se;}const l=r.Ot[3],a=this.$s().Hs(h,{Ot:r}),o=n.Rt(l,e.Ot);return {Xr:!1,_t:l,Zt:n.Fi(l,e.Ot),Mh:n.ql(l),xh:n.Yl(l,e.Ot),O:a.ue,ki:o,se:h}}$s(){return null!==this.El||(this.El=new Ii(this)),this.El}W(){return this.cn}Hh(t){const i=t.priceScaleId;void 0!==i&&i!==this.cn.priceScaleId&&this.$t().Xl(this,i),D(this.cn,t),void 0!==t.priceFormat&&(this.$l(),this.$t().Kl()),this.$t().Zl(this),this.$t().Gl(),this.wn.bt("options");}J(t,i){this.zt.J(t),this.Jl(),this.wn.bt("data"),this.dn.bt("data"),null!==this.Ll&&(i&&i.Ql?this.Ll.Hr():0===t.length&&this.Ll.jr());const n=this.$t().cr(this);this.$t().ta(n),this.$t().Zl(this),this.$t().Gl(),this.$t().$h();}ia(t){this.Nl=t,this.Jl();const i=this.$t().cr(this);this.dn.bt("data"),this.$t().ta(i),this.$t().Zl(this),this.$t().Gl(),this.$t().$h();}na(){return this.Nl}uh(){return this.Fl}sa(t){const i=new Ai(this,t);return this.Il.push(i),this.$t().Zl(this),i}ea(t){const i=this.Il.indexOf(t);-1!==i&&this.Il.splice(i,1),this.$t().Zl(this);}Jh(){return this.Hl}Ct(){const t=this.ra();return null===t?null:{Ot:t.Ot[3],ha:t.ot}}ra(){const t=this.$t().St().Xs();if(null===t)return null;const i=t.Os();return this.zt.hl(i,1)}In(){return this.zt}fh(t){const i=this.zt.Zh(t);return null===i?null:"Bar"===this.Hl||"Candlestick"===this.Hl||"Custom"===this.Hl?{we:i.Ot[0],ge:i.Ot[1],Me:i.Ot[2],xe:i.Ot[3]}:i.Ot[3]}la(t){const i=[];qi(this.jl,Yi,"top",i);const n=this.Ll;return null!==n&&n.yt()?(null===this.Wl&&n.Ur()&&(this.Wl=setTimeout((()=>{this.Wl=null,this.$t().aa();}),0)),n.$r(),i.unshift(n),i):i}Pn(){const t=[];this.oa()||t.push(this.zl),t.push(this.wn,this.Wh,this.dn);const i=this.Il.map((t=>t.Uh()));return t.push(...i),qi(this.jl,Yi,"normal",t),t}_a(){return this.ua(Yi,"bottom")}ca(t){return this.ua(Xi,t)}da(t){return this.ua(Ki,t)}fa(t,i){return this.jl.map((n=>n.br(t,i))).filter((t=>null!==t))}Ji(t){return [this.jh,...this.Il.map((t=>t.qh()))]}Rn(t,i){if(i!==this.Yi&&!this.oa())return [];const n=[...this.rn];for(const t of this.Il)n.push(t.Yh());return this.jl.forEach((t=>{n.push(...t.Rn());})),n}Qi(){const t=[];return this.jl.forEach((i=>{t.push(...i.Qi());})),t}Vl(t,i){if(void 0!==this.cn.autoscaleInfoProvider){const n=this.cn.autoscaleInfoProvider((()=>{const n=this.va(t,i);return null===n?null:n.Ah()}));return Ri.Bh(n)}return this.va(t,i)}pa(){return this.cn.priceFormat.minMove}ma(){return this.ba}On(){var t;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.Il)t.bt();this.Wh.bt(),this.zl.bt(),null===(t=this.Ll)||void 0===t||t.bt(),this.jl.forEach((t=>t.On()));}Dt(){return b(super.Dt())}kt(t){if(!(("Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl)&&this.cn.crosshairMarkerVisible))return null;const i=this.zt.Zh(t);if(null===i)return null;return {_t:i.Ot[3],ht:this.wa(),At:this.ga(),Pt:this.Ma(),Tt:this.xa(t)}}mh(){return this.cn.title}yt(){return this.cn.visible}Sa(t){this.jl.push(new Ui(t,this));}ka(t){this.jl=this.jl.filter((i=>i.Ol()!==t));}ya(){if(this.wn instanceof Kt!=!1)return t=>this.wn.Fe(t)}Ca(){if(this.wn instanceof Kt!=!1)return t=>this.wn.We(t)}oa(){return !ot(this.Dt().Ta())}va(t,i){if(!A(t)||!A(i)||this.zt.Ni())return null;const n="Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl||"Histogram"===this.Hl?[3]:[2,1],s=this.zt.al(t,i,n);let e=null!==s?new Pi(s.pl,s.ml):null;if("Histogram"===this.Jh()){const t=this.cn.base,i=new Pi(t,t);e=null!==e?e.ts(i):i;}let r=this.dn._h();return this.jl.forEach((n=>{const s=n.Vl(t,i);if(null==s?void 0:s.priceRange){const t=new Pi(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 Ri(e,r)}wa(){switch(this.Hl){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}ga(){switch(this.Hl){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}Ma(){switch(this.Hl){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}xa(t){switch(this.Hl){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.$s().Hs(t).ue}$l(){switch(this.cn.priceFormat.type){case"custom":this.ba={format:this.cn.priceFormat.formatter};break;case"volume":this.ba=new vt(this.cn.priceFormat.precision);break;case"percent":this.ba=new ft(this.cn.priceFormat.precision);break;default:{const t=Math.pow(10,this.cn.priceFormat.precision);this.ba=new dt(t,this.cn.priceFormat.minMove*t);}}null!==this.Yi&&this.Yi.Pa();}Jl(){const t=this.$t().St();if(!t.Ra()||this.zt.Ni())return void(this.Fl=[]);const i=b(this.zt.sl());this.Fl=this.Nl.map(((n,s)=>{const e=b(t.Da(n.time,!0)),r=e<i?1:-1;return {time:b(this.zt.hl(e,r)).se,position:n.position,shape:n.shape,color:n.color,id:n.id,Qr:s,text:n.text,size:n.size,originalTime:n.originalTime}}));}Ul(t){switch(this.dn=new ki(this,this.$t()),this.Hl){case"Bar":this.wn=new jt(this,this.$t());break;case"Candlestick":this.wn=new Yt(this,this.$t());break;case"Line":this.wn=new Qt(this,this.$t());break;case"Custom":this.wn=new Kt(this,this.$t(),m(t));break;case"Area":this.wn=new Nt(this,this.$t());break;case"Baseline":this.wn=new Ut(this,this.$t());break;case"Histogram":this.wn=new Jt(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.Hl)}}ua(t,i){const n=[];return qi(this.jl,t,i,n),n}}class Gi{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.Aa().filter((t=>t instanceof Zi)).reduce(((t,s)=>{if(n.dr(s)||!s.yt())return t;const e=s.Dt(),r=s.In();if(e.Ni()||!r.Kr(i))return t;const h=r.Zh(i);if(null===h)return t;const l=w(s.Ct());return t.concat([e.Rt(h.Ot[3],l.Ot)])}),[]);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 Ji extends j{constructor(){super(...arguments),this.zt=null;}J(t){this.zt=t;}Z({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=b(this.zt);if(r.Ba){t.strokeStyle=r.Va,f(t,r.Ia),t.beginPath();for(const s of r.za){const r=Math.round(s.La*n);t.moveTo(r,-e),t.lineTo(r,i.height+e);}t.stroke();}if(r.Ea){t.strokeStyle=r.Na,f(t,r.Fa),t.beginPath();for(const n of r.Wa){const r=Math.round(n.La*s);t.moveTo(-e,r),t.lineTo(i.width+e,r);}t.stroke();}}));}}class Qi{constructor(t){this.Wt=new Ji,this.ft=!0,this.tn=t;}bt(){this.ft=!0;}gt(){if(this.ft){const t=this.tn.$t().W().grid,i={Ea:t.horzLines.visible,Ba:t.vertLines.visible,Na:t.horzLines.color,Va:t.vertLines.color,Fa:t.horzLines.style,Ia:t.vertLines.style,Wa:this.tn.vn().ja(),za:(this.tn.$t().St().ja()||[]).map((t=>({La:t.coord})))};this.Wt.J(i),this.ft=!1;}return this.Wt}}class tn{constructor(t){this.wn=new Qi(t);}Uh(){return this.wn}}const nn={Ha:4,$a:1e-4};function sn(t,i){const n=100*(t-i)/i;return i<0?-n:n}function en(t,i){const n=sn(t.Th(),i),s=sn(t.Ph(),i);return new Pi(n,s)}function rn(t,i){const n=100*(t-i)/i+100;return i<0?-n:n}function hn(t,i){const n=rn(t.Th(),i),s=rn(t.Ph(),i);return new Pi(n,s)}function ln(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.log10(n+i.$a)+i.Ha;return t<0?-s:s}function an(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.pow(10,n-i.Ha)-i.$a;return t<0?-s:s}function on(t,i){if(null===t)return null;const n=ln(t.Th(),i),s=ln(t.Ph(),i);return new Pi(n,s)}function _n(t,i){if(null===t)return null;const n=an(t.Th(),i),s=an(t.Ph(),i);return new Pi(n,s)}function un(t){if(null===t)return nn;const i=Math.abs(t.Ph()-t.Th());if(i>=1||i<1e-15)return nn;const n=Math.ceil(Math.abs(Math.log10(i))),s=nn.Ha+n;return {Ha:s,$a:1/Math.pow(10,s)}}class cn{constructor(t,i){if(this.Ua=t,this.qa=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.Ua))this.Ya=[2,2.5,2];else {this.Ya=[];for(let t=this.Ua;1!==t;){if(t%2==0)this.Ya.push(2),t/=2;else {if(t%5!=0)throw new Error("unexpected base");this.Ya.push(2,2.5),t/=5;}if(this.Ya.length>100)throw new Error("something wrong with base")}}}Xa(t,i,n){const s=0===this.Ua?0:1/this.Ua;let e=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,h=this.qa[0];for(;;){const t=kt(e,s,1e-14)&&e>s+1e-14,i=kt(e,n*h,1e-14),l=kt(e,1,1e-14);if(!(t&&i&&l))break;e/=h,h=this.qa[++r%this.qa.length];}if(e<=s+1e-14&&(e=s),e=Math.max(1,e),this.Ya.length>0&&(l=e,a=1,o=1e-14,Math.abs(l-a)<o))for(r=0,h=this.Ya[0];kt(e,n*h,1e-14)&&e>s+1e-14;)e/=h,h=this.Ya[++r%this.Ya.length];var l,a,o;return e}}class dn{constructor(t,i,n,s){this.Ka=[],this.Li=t,this.Ua=i,this.Za=n,this.Ga=s;}Xa(t,i){if(t<i)throw new Error("high < low");const n=this.Li.Vt(),s=(t-i)*this.Ja()/n,e=new cn(this.Ua,[2,2.5,2]),r=new cn(this.Ua,[2,2,2.5]),h=new cn(this.Ua,[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)}Qa(){const t=this.Li,i=t.Ct();if(null===i)return void(this.Ka=[]);const n=t.Vt(),s=this.Za(n-1,i),e=this.Za(0,i),r=this.Li.W().entireTextOnly?this.io()/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.Ga(n,i,!0);null!==d&&Math.abs(s-d)<this.Ja()||(s<h||s>l||(f<this.Ka.length?(this.Ka[f].La=s,this.Ka[f].no=t.so(n)):this.Ka.push({La:s,no:t.so(n)}),f++,d=s,t.eo()&&(_=this.Xa(n*c,o))));}this.Ka.length=f;}ja(){return this.Ka}io(){return this.Li.P()}Ja(){return Math.ceil(2.5*this.io())}}function fn(t){return t.slice().sort(((t,i)=>b(t.Ki())-b(i.Ki())))}var vn;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100";}(vn||(vn={}));const pn=new ft,mn=new dt(100,1);class bn{constructor(t,i,n,s){this.ro=0,this.ho=null,this.Vh=null,this.lo=null,this.ao={oo:!1,_o:null},this.uo=0,this.co=0,this.do=new R,this.fo=new R,this.vo=[],this.po=null,this.mo=null,this.bo=null,this.wo=null,this.ba=mn,this.Mo=un(null),this.xo=t,this.cn=i,this.So=n,this.ko=s,this.yo=new dn(this,100,this.Co.bind(this),this.To.bind(this));}Ta(){return this.xo}W(){return this.cn}Hh(t){if(D(this.cn,t),this.Pa(),void 0!==t.mode&&this.Po({yr:t.mode}),void 0!==t.scaleMargins){const i=m(t.scaleMargins.top),n=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.Ro(),this.mo=null;}}Do(){return this.cn.autoScale}eo(){return 1===this.cn.mode}gh(){return 2===this.cn.mode}Oo(){return 3===this.cn.mode}yr(){return {Wn:this.cn.autoScale,Ao:this.cn.invertScale,yr:this.cn.mode}}Po(t){const i=this.yr();let n=null;void 0!==t.Wn&&(this.cn.autoScale=t.Wn),void 0!==t.yr&&(this.cn.mode=t.yr,2!==t.yr&&3!==t.yr||(this.cn.autoScale=!0),this.ao.oo=!1),1===i.yr&&t.yr!==i.yr&&(!function(t,i){if(null===t)return !1;const n=an(t.Th(),i),s=an(t.Ph(),i);return isFinite(n)&&isFinite(s)}(this.Vh,this.Mo)?this.cn.autoScale=!0:(n=_n(this.Vh,this.Mo),null!==n&&this.Bo(n))),1===t.yr&&t.yr!==i.yr&&(n=on(this.Vh,this.Mo),null!==n&&this.Bo(n));const s=i.yr!==this.cn.mode;s&&(2===i.yr||this.gh())&&this.Pa(),s&&(3===i.yr||this.Oo())&&this.Pa(),void 0!==t.Ao&&i.Ao!==t.Ao&&(this.cn.invertScale=t.Ao,this.Vo()),this.fo.m(i,this.yr());}Io(){return this.fo}P(){return this.So.fontSize}Vt(){return this.ro}zo(t){this.ro!==t&&(this.ro=t,this.Ro(),this.mo=null);}Lo(){if(this.ho)return this.ho;const t=this.Vt()-this.Eo()-this.No();return this.ho=t,t}zh(){return this.Fo(),this.Vh}Bo(t,i){const n=this.Vh;(i||null===n&&null!==t||null!==n&&!n.yh(t))&&(this.mo=null,this.Vh=t);}Ni(){return this.Fo(),0===this.ro||!this.Vh||this.Vh.Ni()}Wo(t){return this.Ao()?t:this.Vt()-1-t}Rt(t,i){return this.gh()?t=sn(t,i):this.Oo()&&(t=rn(t,i)),this.To(t,i)}Qs(t,i,n){this.Fo();const s=this.No(),e=b(this.zh()),r=e.Th(),h=e.Ph(),l=this.Lo()-1,a=this.Ao(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.jo();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.ro-1-_;e.st=u;}}me(t,i,n){this.Fo();const s=this.No(),e=b(this.zh()),r=e.Th(),h=e.Ph(),l=this.Lo()-1,a=this.Ao(),o=l/(h-r),_=void 0===n?0:n.from,u=void 0===n?t.length:n.to,c=this.jo();for(let n=_;n<u;n++){const e=t[n];let h=e.we,l=e.ge,_=e.Me,u=e.xe;null!==c&&(h=c(e.we,i),l=c(e.ge,i),_=c(e.Me,i),u=c(e.xe,i));let d=s+o*(h-r),f=a?d:this.ro-1-d;e.ve=f,d=s+o*(l-r),f=a?d:this.ro-1-d,e.ce=f,d=s+o*(_-r),f=a?d:this.ro-1-d,e.de=f,d=s+o*(u-r),f=a?d:this.ro-1-d,e.pe=f;}}pn(t,i){const n=this.Co(t,i);return this.Ho(n,i)}Ho(t,i){let n=t;return this.gh()?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}Aa(){return this.vo}$o(){if(this.po)return this.po;let t=[];for(let i=0;i<this.vo.length;i++){const n=this.vo[i];null===n.Ki()&&n.Zi(i+1),t.push(n);}return t=fn(t),this.po=t,this.po}Uo(t){-1===this.vo.indexOf(t)&&(this.vo.push(t),this.Pa(),this.qo());}Yo(t){const i=this.vo.indexOf(t);if(-1===i)throw new Error("source is not attached to scale");this.vo.splice(i,1),0===this.vo.length&&(this.Po({Wn:!0}),this.Bo(null)),this.Pa(),this.qo();}Ct(){let t=null;for(const i of this.vo){const n=i.Ct();null!==n&&((null===t||n.ha<t.ha)&&(t=n));}return null===t?null:t.Ot}Ao(){return this.cn.invertScale}ja(){const t=null===this.Ct();if(null!==this.mo&&(t||this.mo.Xo===t))return this.mo.ja;this.yo.Qa();const i=this.yo.ja();return this.mo={ja:i,Xo:t},this.do.m(),i}Ko(){return this.do}Zo(t){this.gh()||this.Oo()||null===this.bo&&null===this.lo&&(this.Ni()||(this.bo=this.ro-t,this.lo=b(this.zh()).Ch()));}Go(t){if(this.gh()||this.Oo())return;if(null===this.bo)return;this.Po({Wn:!1}),(t=this.ro-t)<0&&(t=0);let i=(this.bo+.2*(this.ro-1))/(t+.2*(this.ro-1));const n=b(this.lo).Ch();i=Math.max(i,.1),n.Dh(i),this.Bo(n);}Jo(){this.gh()||this.Oo()||(this.bo=null,this.lo=null);}Qo(t){this.Do()||null===this.wo&&null===this.lo&&(this.Ni()||(this.wo=t,this.lo=b(this.zh()).Ch()));}t_(t){if(this.Do())return;if(null===this.wo)return;const i=b(this.zh()).Rh()/(this.Lo()-1);let n=t-this.wo;this.Ao()&&(n*=-1);const s=n*i,e=b(this.lo).Ch();e.Oh(s),this.Bo(e,!0),this.mo=null;}i_(){this.Do()||null!==this.wo&&(this.wo=null,this.lo=null);}ma(){return this.ba||this.Pa(),this.ba}Fi(t,i){switch(this.cn.mode){case 2:return this.n_(sn(t,i));case 3:return this.ma().format(rn(t,i));default:return this.Fh(t)}}so(t){switch(this.cn.mode){case 2:return this.n_(t);case 3:return this.ma().format(t);default:return this.Fh(t)}}ql(t){return this.Fh(t,b(this.s_()).ma())}Yl(t,i){return t=sn(t,i),this.n_(t,pn)}e_(){return this.vo}r_(t){this.ao={_o:t,oo:!1};}On(){this.vo.forEach((t=>t.On()));}Pa(){this.mo=null;const t=this.s_();let i=100;null!==t&&(i=Math.round(1/t.pa())),this.ba=mn,this.gh()?(this.ba=pn,i=100):this.Oo()?(this.ba=new dt(100,1),i=100):null!==t&&(this.ba=t.ma()),this.yo=new dn(this,i,this.Co.bind(this),this.To.bind(this)),this.yo.Qa();}qo(){this.po=null;}s_(){return this.vo[0]||null}Eo(){return this.Ao()?this.cn.scaleMargins.bottom*this.Vt()+this.co:this.cn.scaleMargins.top*this.Vt()+this.uo}No(){return this.Ao()?this.cn.scaleMargins.top*this.Vt()+this.uo:this.cn.scaleMargins.bottom*this.Vt()+this.co}Fo(){this.ao.oo||(this.ao.oo=!0,this.h_());}Ro(){this.ho=null;}To(t,i){if(this.Fo(),this.Ni())return 0;t=this.eo()&&t?ln(t,this.Mo):t;const n=b(this.zh()),s=this.No()+(this.Lo()-1)*(t-n.Th())/n.Rh();return this.Wo(s)}Co(t,i){if(this.Fo(),this.Ni())return 0;const n=this.Wo(t),s=b(this.zh()),e=s.Th()+s.Rh()*((n-this.No())/(this.Lo()-1));return this.eo()?an(e,this.Mo):e}Vo(){this.mo=null,this.yo.Qa();}h_(){const t=this.ao._o;if(null===t)return;let i=null;const n=this.e_();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.Vl(t.Os(),t.ui());let l=h&&h.zh();if(null!==l){switch(this.cn.mode){case 1:l=on(l,this.Mo);break;case 2:l=en(l,n.Ot);break;case 3:l=hn(l,n.Ot);}if(i=null===i?l:i.ts(b(l)),null!==h){const t=h.Lh();null!==t&&(s=Math.max(s,t.above),e=Math.max(e,t.below));}}}if(s===this.uo&&e===this.co||(this.uo=s,this.co=e,this.mo=null,this.Ro()),null!==i){if(i.Th()===i.Ph()){const t=this.s_(),n=5*(null===t||this.gh()||this.Oo()?1:t.pa());this.eo()&&(i=_n(i,this.Mo)),i=new Pi(i.Th()-n,i.Ph()+n),this.eo()&&(i=on(i,this.Mo));}if(this.eo()){const t=_n(i,this.Mo),n=un(t);if(r=n,h=this.Mo,r.Ha!==h.Ha||r.$a!==h.$a){const s=null!==this.lo?_n(this.lo,this.Mo):null;this.Mo=n,i=on(t,n),null!==s&&(this.lo=on(s,n));}}this.Bo(i);}else null===this.Vh&&(this.Bo(new Pi(-.5,.5)),this.Mo=un(null));var r,h;this.ao.oo=!0;}jo(){return this.gh()?sn:this.Oo()?rn:this.eo()?t=>ln(t,this.Mo):null}l_(t,i,n){return void 0===i?(void 0===n&&(n=this.ma()),n.format(t)):i(t)}Fh(t,i){return this.l_(t,this.ko.priceFormatter,i)}n_(t,i){return this.l_(t,this.ko.percentageFormatter,i)}}class wn{constructor(t,i){this.vo=[],this.a_=new Map,this.ro=0,this.o_=0,this.__=1e3,this.po=null,this.u_=new R,this.kl=t,this.$i=i,this.c_=new tn(this);const n=i.W();this.d_=this.f_("left",n.leftPriceScale),this.v_=this.f_("right",n.rightPriceScale),this.d_.Io().l(this.p_.bind(this,this.d_),this),this.v_.Io().l(this.p_.bind(this,this.v_),this),this.m_(n);}m_(t){if(t.leftPriceScale&&this.d_.Hh(t.leftPriceScale),t.rightPriceScale&&this.v_.Hh(t.rightPriceScale),t.localization&&(this.d_.Pa(),this.v_.Pa()),t.overlayPriceScales){const i=Array.from(this.a_.values());for(const n of i){const i=b(n[0].Dt());i.Hh(t.overlayPriceScales),t.localization&&i.Pa();}}}b_(t){switch(t){case"left":return this.d_;case"right":return this.v_}return this.a_.has(t)?m(this.a_.get(t))[0].Dt():null}S(){this.$t().w_().p(this),this.d_.Io().p(this),this.v_.Io().p(this),this.vo.forEach((t=>{t.S&&t.S();})),this.u_.m();}g_(){return this.__}M_(t){this.__=t;}$t(){return this.$i}Hi(){return this.o_}Vt(){return this.ro}x_(t){this.o_=t,this.S_();}zo(t){this.ro=t,this.d_.zo(t),this.v_.zo(t),this.vo.forEach((i=>{if(this.dr(i)){const n=i.Dt();null!==n&&n.zo(t);}})),this.S_();}Aa(){return this.vo}dr(t){const i=t.Dt();return null===i||this.d_!==i&&this.v_!==i}Uo(t,i,n){const s=void 0!==n?n:this.y_().k_+1;this.C_(t,i,s);}Yo(t){const i=this.vo.indexOf(t);p(-1!==i,"removeDataSource: invalid data source"),this.vo.splice(i,1);const n=b(t.Dt()).Ta();if(this.a_.has(n)){const i=m(this.a_.get(n)),s=i.indexOf(t);-1!==s&&(i.splice(s,1),0===i.length&&this.a_.delete(n));}const s=t.Dt();s&&s.Aa().indexOf(t)>=0&&s.Yo(t),null!==s&&(s.qo(),this.T_(s)),this.po=null;}pr(t){return t===this.d_?"left":t===this.v_?"right":"overlay"}P_(){return this.d_}R_(){return this.v_}D_(t,i){t.Zo(i);}O_(t,i){t.Go(i),this.S_();}A_(t){t.Jo();}B_(t,i){t.Qo(i);}V_(t,i){t.t_(i),this.S_();}I_(t){t.i_();}S_(){this.vo.forEach((t=>{t.On();}));}vn(){let t=null;return this.$i.W().rightPriceScale.visible&&0!==this.v_.Aa().length?t=this.v_:this.$i.W().leftPriceScale.visible&&0!==this.d_.Aa().length?t=this.d_:0!==this.vo.length&&(t=this.vo[0].Dt()),null===t&&(t=this.v_),t}vr(){let t=null;return this.$i.W().rightPriceScale.visible?t=this.v_:this.$i.W().leftPriceScale.visible&&(t=this.d_),t}T_(t){null!==t&&t.Do()&&this.z_(t);}L_(t){const i=this.kl.Xs();t.Po({Wn:!0}),null!==i&&t.r_(i),this.S_();}E_(){this.z_(this.d_),this.z_(this.v_);}N_(){this.T_(this.d_),this.T_(this.v_),this.vo.forEach((t=>{this.dr(t)&&this.T_(t.Dt());})),this.S_(),this.$i.$h();}$o(){return null===this.po&&(this.po=fn(this.vo)),this.po}F_(){return this.u_}W_(){return this.c_}z_(t){const i=t.e_();if(i&&i.length>0&&!this.kl.Ni()){const i=this.kl.Xs();null!==i&&t.r_(i);}t.On();}y_(){const t=this.$o();if(0===t.length)return {j_:0,k_:0};let i=0,n=0;for(let s=0;s<t.length;s++){const e=t[s].Ki();null!==e&&(e<i&&(i=e),e>n&&(n=e));}return {j_:i,k_:n}}C_(t,i,n){let s=this.b_(i);if(null===s&&(s=this.f_(i,this.$i.W().overlayPriceScales)),this.vo.push(t),!ot(i)){const n=this.a_.get(i)||[];n.push(t),this.a_.set(i,n);}s.Uo(t),t.Gi(s),t.Zi(n),this.T_(s),this.po=null;}p_(t,i,n){i.yr!==n.yr&&this.z_(t);}f_(t,i){const n=Object.assign({visible:!0,autoScale:!0},I(i)),s=new bn(t,n,this.$i.W().layout,this.$i.W().localization);return s.zo(this.Vt()),s}}class gn{constructor(t,i,n=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Qe=new Map,this.Je=new Map,this.H_=t,this.U_=i,this.tr=n;}q_(t){const i=t.time,n=this.U_.cacheKey(i),s=this.Qe.get(n);if(void 0!==s)return s.Y_;if(this.Ke===this.tr){const t=this.Je.get(this.Ge);this.Je.delete(this.Ge),this.Qe.delete(m(t)),this.Ge++,this.Ke--;}const e=this.H_(t);return this.Qe.set(n,{Y_:e,er:this.Ze}),this.Je.set(this.Ze,n),this.Ke++,this.Ze++,e}}class Mn{constructor(t,i){p(t<=i,"right should be >= left"),this.X_=t,this.K_=i;}Os(){return this.X_}ui(){return this.K_}Z_(){return this.K_-this.X_+1}Kr(t){return this.X_<=t&&t<=this.K_}yh(t){return this.X_===t.Os()&&this.K_===t.ui()}}function xn(t,i){return null===t||null===i?t===i:t.yh(i)}class Sn{constructor(){this.G_=new Map,this.Qe=null,this.J_=!1;}Q_(t){this.J_=t,this.Qe=null;}tu(t,i){this.iu(i),this.Qe=null;for(let n=i;n<t.length;++n){const i=t[n];let s=this.G_.get(i.timeWeight);void 0===s&&(s=[],this.G_.set(i.timeWeight,s)),s.push({index:n,time:i.time,weight:i.timeWeight,originalTime:i.originalTime});}}nu(t,i){const n=Math.ceil(i/t);return null!==this.Qe&&this.Qe.su===n||(this.Qe={ja:this.eu(n),su:n}),this.Qe.ja}iu(t){if(0===t)return void this.G_.clear();const i=[];this.G_.forEach(((n,s)=>{t<=n[0].index?i.push(s):n.splice(At(n,t,(i=>i.index<t)),1/0);}));for(const t of i)this.G_.delete(t);}eu(t){let i=[];for(const n of Array.from(this.G_.keys()).sort(((t,i)=>i-t))){if(!this.G_.get(n))continue;const s=i;i=[];const e=s.length;let r=0;const h=m(this.G_.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.J_)return s}for(;r<e;r++)i.push(s[r]);}return i}}class kn{constructor(t){this.ru=t;}hu(){return null===this.ru?null:new Mn(Math.floor(this.ru.Os()),Math.ceil(this.ru.ui()))}lu(){return this.ru}static au(){return new kn(null)}}function yn(t,i){return t.weight>i.weight?t:i}class Cn{constructor(t,i,n,s){this.o_=0,this.ou=null,this._u=[],this.wo=null,this.bo=null,this.uu=new Sn,this.cu=new Map,this.du=kn.au(),this.fu=!0,this.vu=new R,this.pu=new R,this.mu=new R,this.bu=null,this.wu=null,this.gu=[],this.cn=i,this.ko=n,this.Mu=i.rightOffset,this.xu=i.barSpacing,this.$i=t,this.U_=s,this.Su(),this.uu.Q_(i.uniformDistribution);}W(){return this.cn}ku(t){D(this.ko,t),this.yu(),this.Su();}Hh(t,i){var n;D(this.cn,t),this.cn.fixLeftEdge&&this.Cu(),this.cn.fixRightEdge&&this.Tu(),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.xu),this.yu(),this.Su(),this.mu.m();}mn(t){var i,n;return null!==(n=null===(i=this._u[t])||void 0===i?void 0:i.time)&&void 0!==n?n:null}Ui(t){var i;return null!==(i=this._u[t])&&void 0!==i?i:null}Da(t,i){if(this._u.length<1)return null;if(this.U_.key(t)>this.U_.key(this._u[this._u.length-1].time))return i?this._u.length-1:null;const n=At(this._u,this.U_.key(t),((t,i)=>this.U_.key(t.time)<i));return this.U_.key(t)<this.U_.key(this._u[n].time)?i?n:null:n}Ni(){return 0===this.o_||0===this._u.length||null===this.ou}Ra(){return this._u.length>0}Xs(){return this.Pu(),this.du.hu()}Ru(){return this.Pu(),this.du.lu()}Du(){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=b(this.Au()),e=b(this.Bu());return {from:b(this.Ui(Math.max(s,i))),to:b(this.Ui(Math.min(e,n)))}}Vu(t){return {from:b(this.Da(t.from,!0)),to:b(this.Da(t.to,!0))}}Hi(){return this.o_}x_(t){if(!isFinite(t)||t<=0)return;if(this.o_===t)return;const i=this.Ru(),n=this.o_;if(this.o_=t,this.fu=!0,this.cn.lockVisibleTimeRangeOnResize&&0!==n){const i=this.xu*t/n;this.xu=i;}if(this.cn.fixLeftEdge&&null!==i&&i.Os()<=0){const i=n-t;this.Mu-=Math.round(i/this.xu)+1,this.fu=!0;}this.Iu(),this.zu();}It(t){if(this.Ni()||!A(t))return 0;const i=this.Lu()+this.Mu-t;return this.o_-(i+.5)*this.xu-1}Js(t,i){const n=this.Lu(),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.Mu-s,r=this.o_-(e+.5)*this.xu-1;t[i].nt=r;}}Eu(t){return Math.ceil(this.Nu(t))}Jn(t){this.fu=!0,this.Mu=t,this.zu(),this.$i.Fu(),this.$i.$h();}he(){return this.xu}Gn(t){this.Wu(t),this.zu(),this.$i.Fu(),this.$i.$h();}ju(){return this.Mu}ja(){if(this.Ni())return null;if(null!==this.wu)return this.wu;const t=this.xu,i=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),n=Math.round(i/t),s=b(this.Xs()),e=Math.max(s.Os(),s.Os()-n),r=Math.max(s.ui(),s.ui()-n),h=this.uu.nu(t,i),l=this.Au()+n,a=this.Bu()-n,o=this.Hu(),_=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.gu.length?(n=this.gu[c],n.coord=this.It(t.index),n.label=this.$u(t),n.weight=t.weight):(n={needAlignCoordinate:!1,coord:this.It(t.index),label:this.$u(t),weight:t.weight},this.gu.push(n)),this.xu>i/2&&!o?n.needAlignCoordinate=!1:n.needAlignCoordinate=_&&t.index<=l||u&&t.index>=a,c++;}return this.gu.length=c,this.wu=this.gu,this.gu}Uu(){this.fu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset);}qu(t){this.fu=!0,this.ou=t,this.zu(),this.Cu();}Yu(t,i){const n=this.Nu(t),s=this.he(),e=s+i*(s/10);this.Gn(e),this.cn.rightBarStaysOnScroll||this.Jn(this.ju()+(n-this.Nu(t)));}Zo(t){this.wo&&this.i_(),null===this.bo&&null===this.bu&&(this.Ni()||(this.bo=t,this.Xu()));}Go(t){if(null===this.bu)return;const i=St(this.o_-t,0,this.o_),n=St(this.o_-b(this.bo),0,this.o_);0!==i&&0!==n&&this.Gn(this.bu.he*i/n);}Jo(){null!==this.bo&&(this.bo=null,this.Ku());}Qo(t){null===this.wo&&null===this.bu&&(this.Ni()||(this.wo=t,this.Xu()));}t_(t){if(null===this.wo)return;const i=(this.wo-t)/this.he();this.Mu=b(this.bu).ju+i,this.fu=!0,this.zu();}i_(){null!==this.wo&&(this.wo=null,this.Ku());}Zu(){this.Gu(this.cn.rightOffset);}Gu(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.Mu,s=performance.now();this.$i.Xn({Ju:t=>(t-s)/i>=1,Qu:e=>{const r=(e-s)/i;return r>=1?t:n+(t-n)*r}});}bt(t,i){this.fu=!0,this._u=t,this.uu.tu(t,i),this.zu();}tc(){return this.vu}nc(){return this.pu}sc(){return this.mu}Lu(){return this.ou||0}ec(t){const i=t.Z_();this.Wu(this.o_/i),this.Mu=t.ui()-this.Lu(),this.zu(),this.fu=!0,this.$i.Fu(),this.$i.$h();}rc(){const t=this.Au(),i=this.Bu();null!==t&&null!==i&&this.ec(new Mn(t,i+this.cn.rightOffset));}hc(t){const i=new Mn(t.from,t.to);this.ec(i);}qi(t){return void 0!==this.ko.timeFormatter?this.ko.timeFormatter(t.originalTime):this.U_.formatHorzItem(t.time)}Hu(){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)}Au(){return 0===this._u.length?null:0}Bu(){return 0===this._u.length?null:this._u.length-1}lc(t){return (this.o_-1-t)/this.xu}Nu(t){const i=this.lc(t),n=this.Lu()+this.Mu-i;return Math.round(1e6*n)/1e6}Wu(t){const i=this.xu;this.xu=t,this.Iu(),i!==this.xu&&(this.fu=!0,this.ac());}Pu(){if(!this.fu)return;if(this.fu=!1,this.Ni())return void this.oc(kn.au());const t=this.Lu(),i=this.o_/this.xu,n=this.Mu+t,s=new Mn(n-i+1,n);this.oc(new kn(s));}Iu(){const t=this._c();if(this.xu<t&&(this.xu=t,this.fu=!0),0!==this.o_){const t=.5*this.o_;this.xu>t&&(this.xu=t,this.fu=!0);}}_c(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&0!==this._u.length?this.o_/this._u.length:this.cn.minBarSpacing}zu(){const t=this.uc();this.Mu>t&&(this.Mu=t,this.fu=!0);const i=this.cc();null!==i&&this.Mu<i&&(this.Mu=i,this.fu=!0);}cc(){const t=this.Au(),i=this.ou;if(null===t||null===i)return null;return t-i-1+(this.cn.fixLeftEdge?this.o_/this.xu:Math.min(2,this._u.length))}uc(){return this.cn.fixRightEdge?0:this.o_/this.xu-Math.min(2,this._u.length)}Xu(){this.bu={he:this.he(),ju:this.ju()};}Ku(){this.bu=null;}$u(t){let i=this.cu.get(t.weight);return void 0===i&&(i=new gn((t=>this.dc(t)),this.U_),this.cu.set(t.weight,i)),i.q_(t)}dc(t){return this.U_.formatTickmark(t,this.ko)}oc(t){const i=this.du;this.du=t,xn(i.hu(),this.du.hu())||this.vu.m(),xn(i.lu(),this.du.lu())||this.pu.m(),this.ac();}ac(){this.wu=null;}yu(){this.ac(),this.cu.clear();}Su(){this.U_.updateFormatter(this.ko);}Cu(){if(!this.cn.fixLeftEdge)return;const t=this.Au();if(null===t)return;const i=this.Xs();if(null===i)return;const n=i.Os()-t;if(n<0){const t=this.Mu-n-1;this.Jn(t);}this.Iu();}Tu(){this.zu(),this.Iu();}}class Tn{K(t,i,n){t.useMediaCoordinateSpace((t=>this.Z(t,i,n)));}wl(t,i,n){t.useMediaCoordinateSpace((t=>this.fc(t,i,n)));}fc(t,i,n){}}class Pn extends Tn{constructor(t){super(),this.vc=new Map,this.zt=t;}Z(t){}fc(t){if(!this.zt.yt)return;const{context:i,mediaSize:n}=t;let s=0;for(const t of this.zt.mc){if(0===t.Zt.length)continue;i.font=t.R;const e=this.bc(i,t.Zt);e>n.width?t.Yu=n.width/e:t.Yu=1,s+=t.wc*t.Yu;}let e=0;switch(this.zt.gc){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.O;for(const t of this.zt.mc){i.save();let s=0;switch(this.zt.Mc){case"left":i.textAlign="left",s=t.wc/2;break;case"center":i.textAlign="center",s=n.width/2;break;case"right":i.textAlign="right",s=n.width-1-t.wc/2;}i.translate(s,e),i.textBaseline="top",i.font=t.R,i.scale(t.Yu,t.Yu),i.fillText(t.Zt,0,t.xc),i.restore(),e+=t.wc*t.Yu;}}bc(t,i){const n=this.Sc(t.font);let s=n.get(i);return void 0===s&&(s=t.measureText(i).width,n.set(i,s)),s}Sc(t){let i=this.vc.get(t);return void 0===i&&(i=new Map,this.vc.set(t,i)),i}}class Rn{constructor(t){this.ft=!0,this.Ft={yt:!1,O:"",mc:[],gc:"center",Mc:"center"},this.Wt=new Pn(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.O=t.color,i.Mc=t.horzAlign,i.gc=t.vertAlign,i.mc=[{Zt:t.text,R:N(t.fontSize,t.fontFamily,t.fontStyle),wc:1.2*t.fontSize,xc:0,Yu:0}]);}}class Dn extends ht{constructor(t,i){super(),this.cn=i,this.wn=new Rn(this);}Rn(){return []}Pn(){return [this.wn]}W(){return this.cn}On(){this.wn.bt();}}var On,An,Bn,Vn,In;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap";}(On||(On={}));class zn{constructor(t,i,n){this.kc=[],this.yc=[],this.o_=0,this.Cc=null,this.Tc=new R,this.Pc=new R,this.Rc=null,this.Dc=t,this.cn=i,this.U_=n,this.Oc=new F(this),this.kl=new Cn(this,i.timeScale,this.cn.localization,n),this.vt=new at(this,i.crosshair),this.Ac=new Gi(i.crosshair),this.Bc=new Dn(this,i.watermark),this.Vc(),this.kc[0].M_(2e3),this.Ic=this.zc(0),this.Lc=this.zc(1);}Kl(){this.Ec(_t.es());}$h(){this.Ec(_t.ss());}aa(){this.Ec(new _t(1));}Zl(t){const i=this.Nc(t);this.Ec(i);}Fc(){return this.Cc}Wc(t){const i=this.Cc;this.Cc=t,null!==i&&this.Zl(i.jc),null!==t&&this.Zl(t.jc);}W(){return this.cn}Hh(t){D(this.cn,t),this.kc.forEach((i=>i.m_(t))),void 0!==t.timeScale&&this.kl.Hh(t.timeScale),void 0!==t.localization&&this.kl.ku(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Tc.m(),this.Ic=this.zc(0),this.Lc=this.zc(1),this.Kl();}Hc(t,i){if("left"===t)return void this.Hh({leftPriceScale:i});if("right"===t)return void this.Hh({rightPriceScale:i});const n=this.$c(t);null!==n&&(n.Dt.Hh(i),this.Tc.m());}$c(t){for(const i of this.kc){const n=i.b_(t);if(null!==n)return {Ht:i,Dt:n}}return null}St(){return this.kl}Uc(){return this.kc}qc(){return this.Bc}Yc(){return this.vt}Xc(){return this.Pc}Kc(t,i){t.zo(i),this.Fu();}x_(t){this.o_=t,this.kl.x_(this.o_),this.kc.forEach((i=>i.x_(t))),this.Fu();}Vc(t){const i=new wn(this.kl,this);void 0!==t?this.kc.splice(t,0,i):this.kc.push(i);const n=void 0===t?this.kc.length-1:t,s=_t.es();return s.Nn(n,{Fn:0,Wn:!0}),this.Ec(s),i}D_(t,i,n){t.D_(i,n);}O_(t,i,n){t.O_(i,n),this.Gl(),this.Ec(this.Zc(t,2));}A_(t,i){t.A_(i),this.Ec(this.Zc(t,2));}B_(t,i,n){i.Do()||t.B_(i,n);}V_(t,i,n){i.Do()||(t.V_(i,n),this.Gl(),this.Ec(this.Zc(t,2)));}I_(t,i){i.Do()||(t.I_(i),this.Ec(this.Zc(t,2)));}L_(t,i){t.L_(i),this.Ec(this.Zc(t,2));}Gc(t){this.kl.Zo(t);}Jc(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.Yu(t,i),this.Fu();}Qc(t){this.td(0),this.nd(t),this.sd();}ed(t){this.kl.Go(t),this.Fu();}rd(){this.kl.Jo(),this.$h();}td(t){this.kl.Qo(t);}nd(t){this.kl.t_(t),this.Fu();}sd(){this.kl.i_(),this.$h();}wt(){return this.yc}hd(t,i,n,s,e){this.vt.gn(t,i);let r=NaN,h=this.kl.Eu(t);const l=this.kl.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.Ac.Oa(r,h,s),this.vt.kn(h,r,s),this.aa(),e||this.Pc.m(this.vt.xt(),{x:t,y:i},n);}ld(t,i,n){const s=n.vn(),e=s.Ct(),r=s.Rt(t,b(e)),h=this.kl.Da(i,!0),l=this.kl.It(b(h));this.hd(l,r,null,n,!0);}ad(t){this.Yc().Cn(),this.aa(),t||this.Pc.m(null,null,null);}Gl(){const t=this.vt.Ht();if(null!==t){const i=this.vt.xn(),n=this.vt.Sn();this.hd(i,n,null,t);}this.vt.On();}od(t,i,n){const s=this.kl.mn(0);void 0!==i&&void 0!==n&&this.kl.bt(i,n);const e=this.kl.mn(0),r=this.kl.Lu(),h=this.kl.Xs();if(null!==h&&null!==s&&null!==e){const i=h.Kr(r),l=this.U_.key(s)>this.U_.key(e),a=null!==t&&t>r&&!l,o=this.kl.W().allowShiftVisibleRangeOnWhitespaceReplacement,_=i&&(!(void 0===n)||o)&&this.kl.W().shiftVisibleRangeOnNewBar;if(a&&!_){const i=t-r;this.kl.Jn(this.kl.ju()-i);}}this.kl.qu(t);}ta(t){null!==t&&t.N_();}cr(t){const i=this.kc.find((i=>i.$o().includes(t)));return void 0===i?null:i}Fu(){this.Bc.On(),this.kc.forEach((t=>t.N_())),this.Gl();}S(){this.kc.forEach((t=>t.S())),this.kc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0;}_d(){return this.Oc}mr(){return this.Oc.W()}w_(){return this.Tc}ud(t,i,n){const s=this.kc[0],e=this.dd(i,t,s,n);return this.yc.push(e),1===this.yc.length?this.Kl():this.$h(),e}fd(t){const i=this.cr(t),n=this.yc.indexOf(t);p(-1!==n,"Series not found"),this.yc.splice(n,1),b(i).Yo(t),t.S&&t.S();}Xl(t,i){const n=b(this.cr(t));n.Yo(t);const s=this.$c(i);if(null===s){const s=t.Ki();n.Uo(t,i,s);}else {const e=s.Ht===n?t.Ki():void 0;s.Ht.Uo(t,i,e);}}rc(){const t=_t.ss();t.$n(),this.Ec(t);}vd(t){const i=_t.ss();i.Yn(t),this.Ec(i);}Zn(){const t=_t.ss();t.Zn(),this.Ec(t);}Gn(t){const i=_t.ss();i.Gn(t),this.Ec(i);}Jn(t){const i=_t.ss();i.Jn(t),this.Ec(i);}Xn(t){const i=_t.ss();i.Xn(t),this.Ec(i);}Un(){const t=_t.ss();t.Un(),this.Ec(t);}pd(){return this.cn.rightPriceScale.visible?"right":"left"}md(){return this.Lc}q(){return this.Ic}Bt(t){const i=this.Lc,n=this.Ic;if(i===n)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Rc||this.Rc.Ts!==n||this.Rc.Ps!==i)this.Rc={Ts:n,Ps:i,bd:new Map};else {const i=this.Rc.bd.get(t);if(void 0!==i)return i}const s=function(t,i,n){const[s,e,r,h]=T(t),[l,a,o,_]=T(i),u=[M(s+n*(l-s)),M(e+n*(a-e)),M(r+n*(o-r)),x(h+n*(_-h))];return `rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}(n,i,t/100);return this.Rc.bd.set(t,s),s}Zc(t,i){const n=new _t(i);if(null!==t){const s=this.kc.indexOf(t);n.Nn(s,{Fn:i});}return n}Nc(t,i){return void 0===i&&(i=2),this.Zc(this.cr(t),i)}Ec(t){this.Dc&&this.Dc(t),this.kc.forEach((t=>t.W_().Uh().bt()));}dd(t,i,n,s){const e=new Zi(this,t,i,n,s),r=void 0!==t.priceScaleId?t.priceScaleId:this.pd();return n.Uo(e,r),ot(r)||e.Hh(t),e}zc(t){const i=this.cn.layout;return "gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}}function Ln(t){return !O(t)&&!B(t)}function En(t){return O(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate";}(An||(An={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible";}(Bn||(Bn={})),function(t){t.Solid="solid",t.VerticalGradient="gradient";}(Vn||(Vn={})),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";}(In||(In={}));const Nn=t=>t.getUTCFullYear();function Fn(t,i,n){return i.replace(/yyyy/g,(t=>ct(Nn(t),4))(t)).replace(/yy/g,(t=>ct(Nn(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=>ct((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>ct((t=>t.getUTCDate())(t),2))(t))}class Wn{constructor(t="yyyy-MM-dd",i="default"){this.wd=t,this.gd=i;}q_(t){return Fn(t,this.wd,this.gd)}}class jn{constructor(t){this.Md=t||"%h:%m:%s";}q_(t){return this.Md.replace("%h",ct(t.getUTCHours(),2)).replace("%m",ct(t.getUTCMinutes(),2)).replace("%s",ct(t.getUTCSeconds(),2))}}const Hn={xd:"yyyy-MM-dd",Sd:"%h:%m:%s",kd:" ",yd:"default"};class $n{constructor(t={}){const i=Object.assign(Object.assign({},Hn),t);this.Cd=new Wn(i.xd,i.yd),this.Td=new jn(i.Sd),this.Pd=i.kd;}q_(t){return `${this.Cd.q_(t)}${this.Pd}${this.Td.q_(t)}`}}function Un(t){return 60*t*60*1e3}function qn(t){return 60*t*1e3}const Yn=[{Rd:(Xn=1,1e3*Xn),Dd:10},{Rd:qn(1),Dd:20},{Rd:qn(5),Dd:21},{Rd:qn(30),Dd:22},{Rd:Un(1),Dd:30},{Rd:Un(3),Dd:31},{Rd:Un(6),Dd:32},{Rd:Un(12),Dd: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=Yn.length-1;n>=0;--n)if(Math.floor(i.getTime()/Yn[n].Rd)!==Math.floor(t.getTime()/Yn[n].Rd))return Yn[n].Dd;return 0}function Zn(t){let i=t;if(B(t)&&(i=Jn(t)),!Ln(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),Ad:i}}function Gn(t){if(!En(t))throw new Error("time must be of type isUTCTimestamp");return {Od:t}}function Jn(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 Qn(t){B(t.time)&&(t.time=Jn(t.time));}class ts{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization);}preprocessData(t){Array.isArray(t)?function(t){t.forEach(Qn);}(t):Qn(t);}createConverterToInternalObj(t){return b(function(t){return 0===t.length?null:Ln(t[0].time)||B(t[0].time)?Zn:Gn}(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.Ad?new Date(1e3*i.Od).getTime():new Date(Date.UTC(i.Ad.year,i.Ad.month-1,i.Ad.day)).getTime()}convertHorzItemToInternal(t){return En(i=t)?Gn(i):Ln(i)?Zn(i):Zn(Jn(i));var i;}updateFormatter(t){if(!this.cn)return;const i=t.dateFormat;this.cn.timeScale.timeVisible?this.Bd=new $n({xd:i,Sd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",kd:" ",yd:t.locale}):this.Bd=new Wn(i,t.locale);}formatHorzItem(t){const i=t;return this.Bd.q_(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.Ad?new Date(1e3*t.Od):new Date(Date.UTC(t.Ad.year,t.Ad.month-1,t.Ad.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(yn,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 Vd(t){return D({localization:{dateFormat:"dd MMM 'yy"}},null!=t?t:{})}}const is="undefined"!=typeof window;function ns(){return !!is&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function ss(){return !!is&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function es(t){return t+t%2}function rs(t,i){return t.Id-i.Id}function hs(t,i,n){const s=(t.Id-i.Id)/(t.ot-i.ot);return Math.sign(s)*Math.min(Math.abs(s),n)}class ls{constructor(t,i,n,s){this.zd=null,this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=0,this.jd=0,this.Hd=t,this.$d=i,this.Ud=n,this.rs=s;}qd(t,i){if(null!==this.zd){if(this.zd.ot===i)return void(this.zd.Id=t);if(Math.abs(this.zd.Id-t)<this.rs)return}this.Nd=this.Ed,this.Ed=this.Ld,this.Ld=this.zd,this.zd={ot:i,Id:t};}Dr(t,i){if(null===this.zd||null===this.Ld)return;if(i-this.zd.ot>50)return;let n=0;const s=hs(this.zd,this.Ld,this.$d),e=rs(this.zd,this.Ld),r=[s],h=[e];if(n+=e,null!==this.Ed){const t=hs(this.Ld,this.Ed,this.$d);if(Math.sign(t)===Math.sign(s)){const i=rs(this.Ld,this.Ed);if(r.push(t),h.push(i),n+=i,null!==this.Nd){const t=hs(this.Ed,this.Nd,this.$d);if(Math.sign(t)===Math.sign(s)){const i=rs(this.Ed,this.Nd);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.Hd||(this.Fd={Id:t,ot:i},this.jd=l,this.Wd=function(t,i){const n=Math.log(i);return Math.log(1*n/-t)/n}(Math.abs(l),this.Ud));}Qu(t){const i=b(this.Fd),n=t-i.ot;return i.Id+this.jd*(Math.pow(this.Ud,n)-1)/Math.log(this.Ud)}Ju(t){return null===this.Fd||this.Yd(t)===this.Wd}Yd(t){const i=t-b(this.Fd).ot;return Math.min(i,this.Wd)}}function as(t,n){const s=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 os(t){var i;t.width=1,t.height=1,null===(i=t.getContext("2d"))||void 0===i||i.clearRect(0,0,1,1);}function _s(t,i,n,s){t.wl&&t.wl(i,n,s);}function us(t,i,n,s){t.K(i,n,s);}function cs(t,i,n,s){const e=t(n,s);for(const t of e){const n=t.gt();null!==n&&i(n);}}function ds(t){is&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),!1}));}class fs{constructor(t,i,n){this.Xd=0,this.Kd=null,this.Zd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.Gd=0,this.Jd=null,this.Qd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.tf=null,this.if=!1,this.nf=null,this.sf=null,this.ef=!1,this.rf=!1,this.hf=!1,this.lf=null,this.af=null,this._f=null,this.uf=null,this.cf=null,this.df=null,this.ff=null,this.vf=0,this.pf=!1,this.mf=!1,this.bf=!1,this.wf=0,this.gf=null,this.Mf=!ss(),this.xf=t=>{this.Sf(t);},this.kf=t=>{if(this.yf(t)){const i=this.Cf(t);if(++this.Gd,this.Jd&&this.Gd>1){const{Tf:n}=this.Pf(ms(t),this.Qd);n<30&&!this.hf&&this.Rf(i,this.Of.Df),this.Af();}}else {const i=this.Cf(t);if(++this.Xd,this.Kd&&this.Xd>1){const{Tf:n}=this.Pf(ms(t),this.Zd);n<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If();}}},this.zf=t,this.Of=i,this.cn=n,this.Lf();}S(){null!==this.lf&&(this.lf(),this.lf=null),null!==this.af&&(this.af(),this.af=null),null!==this.uf&&(this.uf(),this.uf=null),null!==this.cf&&(this.cf(),this.cf=null),null!==this.df&&(this.df(),this.df=null),null!==this._f&&(this._f(),this._f=null),this.Ef(),this.If();}Nf(t){this.uf&&this.uf();const i=this.Ff.bind(this);if(this.uf=()=>{this.zf.removeEventListener("mousemove",i);},this.zf.addEventListener("mousemove",i),this.yf(t))return;const n=this.Cf(t);this.Bf(n,this.Of.Wf),this.Mf=!0;}If(){null!==this.Kd&&clearTimeout(this.Kd),this.Xd=0,this.Kd=null,this.Zd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY};}Af(){null!==this.Jd&&clearTimeout(this.Jd),this.Gd=0,this.Jd=null,this.Qd={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY};}Ff(t){if(this.bf||null!==this.sf)return;if(this.yf(t))return;const i=this.Cf(t);this.Bf(i,this.Of.jf),this.Mf=!0;}Hf(t){const i=ws(t.changedTouches,b(this.gf));if(null===i)return;if(this.wf=bs(t),null!==this.ff)return;if(this.mf)return;this.pf=!0;const n=this.Pf(ms(i),b(this.sf)),{$f:s,Uf:e,Tf:r}=n;if(this.ef||!(r<5)){if(!this.ef){const t=.5*s,i=e>=t&&!this.cn.qf(),n=t>e&&!this.cn.Yf();i||n||(this.mf=!0),this.ef=!0,this.hf=!0,this.Ef(),this.Af();}if(!this.mf){const n=this.Cf(t,i);this.Rf(n,this.Of.Xf),ps(t);}}}Kf(t){if(0!==t.button)return;const i=this.Pf(ms(t),b(this.nf)),{Tf:n}=i;if(n>=5&&(this.rf=!0,this.If()),this.rf){const i=this.Cf(t);this.Bf(i,this.Of.Zf);}}Pf(t,i){const n=Math.abs(i.nt-t.nt),s=Math.abs(i.st-t.st);return {$f:n,Uf:s,Tf:n+s}}Gf(t){let i=ws(t.changedTouches,b(this.gf));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.gf=null,this.wf=bs(t),this.Ef(),this.sf=null,this.df&&(this.df(),this.df=null);const n=this.Cf(t,i);if(this.Rf(n,this.Of.Jf),++this.Gd,this.Jd&&this.Gd>1){const{Tf:t}=this.Pf(ms(i),this.Qd);t<30&&!this.hf&&this.Rf(n,this.Of.Df),this.Af();}else this.hf||(this.Rf(n,this.Of.Qf),this.Of.Qf&&ps(t));0===this.Gd&&ps(t),0===t.touches.length&&this.if&&(this.if=!1,ps(t));}Sf(t){if(0!==t.button)return;const i=this.Cf(t);if(this.nf=null,this.bf=!1,this.cf&&(this.cf(),this.cf=null),ns()){this.zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.xf);}if(!this.yf(t))if(this.Bf(i,this.Of.tv),++this.Xd,this.Kd&&this.Xd>1){const{Tf:n}=this.Pf(ms(t),this.Zd);n<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If();}else this.rf||this.Bf(i,this.Of.iv);}Ef(){null!==this.tf&&(clearTimeout(this.tf),this.tf=null);}nv(t){if(null!==this.gf)return;const i=t.changedTouches[0];this.gf=i.identifier,this.wf=bs(t);const n=this.zf.ownerDocument.documentElement;this.hf=!1,this.ef=!1,this.mf=!1,this.sf=ms(i),this.df&&(this.df(),this.df=null);{const i=this.Hf.bind(this),s=this.Gf.bind(this);this.df=()=>{n.removeEventListener("touchmove",i),n.removeEventListener("touchend",s);},n.addEventListener("touchmove",i,{passive:!1}),n.addEventListener("touchend",s,{passive:!1}),this.Ef(),this.tf=setTimeout(this.sv.bind(this,t),240);}const s=this.Cf(t,i);this.Rf(s,this.Of.ev),this.Jd||(this.Gd=0,this.Jd=setTimeout(this.Af.bind(this),500),this.Qd=ms(i));}rv(t){if(0!==t.button)return;const i=this.zf.ownerDocument.documentElement;ns()&&i.addEventListener("mouseleave",this.xf),this.rf=!1,this.nf=ms(t),this.cf&&(this.cf(),this.cf=null);{const t=this.Kf.bind(this),n=this.Sf.bind(this);this.cf=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",n);},i.addEventListener("mousemove",t),i.addEventListener("mouseup",n);}if(this.bf=!0,this.yf(t))return;const n=this.Cf(t);this.Bf(n,this.Of.hv),this.Kd||(this.Xd=0,this.Kd=setTimeout(this.If.bind(this),500),this.Zd=ms(t));}Lf(){this.zf.addEventListener("mouseenter",this.Nf.bind(this)),this.zf.addEventListener("touchcancel",this.Ef.bind(this));{const t=this.zf.ownerDocument,i=t=>{this.Of.lv&&(t.composed&&this.zf.contains(t.composedPath()[0])||t.target&&this.zf.contains(t.target)||this.Of.lv());};this.af=()=>{t.removeEventListener("touchstart",i);},this.lf=()=>{t.removeEventListener("mousedown",i);},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0});}ss()&&(this._f=()=>{this.zf.removeEventListener("dblclick",this.kf);},this.zf.addEventListener("dblclick",this.kf)),this.zf.addEventListener("mouseleave",this.av.bind(this)),this.zf.addEventListener("touchstart",this.nv.bind(this),{passive:!0}),ds(this.zf),this.zf.addEventListener("mousedown",this.rv.bind(this)),this.ov(),this.zf.addEventListener("touchmove",(()=>{}),{passive:!1});}ov(){void 0===this.Of._v&&void 0===this.Of.uv&&void 0===this.Of.cv||(this.zf.addEventListener("touchstart",(t=>this.dv(t.touches)),{passive:!0}),this.zf.addEventListener("touchmove",(t=>{if(2===t.touches.length&&null!==this.ff&&void 0!==this.Of.uv){const i=vs(t.touches[0],t.touches[1])/this.vf;this.Of.uv(this.ff,i),ps(t);}}),{passive:!1}),this.zf.addEventListener("touchend",(t=>{this.dv(t.touches);})));}dv(t){1===t.length&&(this.pf=!1),2!==t.length||this.pf||this.if?this.fv():this.vv(t);}vv(t){const i=this.zf.getBoundingClientRect()||{left:0,top:0};this.ff={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.vf=vs(t[0],t[1]),void 0!==this.Of._v&&this.Of._v(),this.Ef();}fv(){null!==this.ff&&(this.ff=null,void 0!==this.Of.cv&&this.Of.cv());}av(t){if(this.uf&&this.uf(),this.yf(t))return;if(!this.Mf)return;const i=this.Cf(t);this.Bf(i,this.Of.pv),this.Mf=!ss();}sv(t){const i=ws(t.touches,b(this.gf));if(null===i)return;const n=this.Cf(t,i);this.Rf(n,this.Of.mv),this.hf=!0,this.if=!0;}yf(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:bs(t)<this.wf+500}Rf(t,i){i&&i.call(this.Of,t);}Bf(t,i){i&&i.call(this.Of,t);}Cf(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,bv:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,wv:t.type,gv:n.target,Mv:t.view,xv:()=>{"touchstart"!==t.type&&ps(t);}}}}function vs(t,i){const n=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(n*n+s*s)}function ps(t){t.cancelable&&t.preventDefault();}function ms(t){return {nt:t.pageX,st:t.pageY}}function bs(t){return t.timeStamp||performance.now()}function ws(t,i){for(let n=0;n<t.length;++n)if(t[n].identifier===i)return t[n];return null}function gs(t){return {jc:t.jc,Sv:{wr:t.kv.externalId},yv:t.kv.cursorStyle}}function Ms(t,i,n){for(const s of t){const t=s.gt();if(null!==t&&t.br){const e=t.br(i,n);if(null!==e)return {Mv:s,Sv:e}}}return null}function xs(t,i){return n=>{var s,e,r,h;return (null!==(e=null===(s=n.Dt())||void 0===s?void 0:s.Ta())&&void 0!==e?e:"")!==i?[]:null!==(h=null===(r=n.ca)||void 0===r?void 0:r.call(n,t))&&void 0!==h?h:[]}}class Ss{constructor(i,n,s,e){this.Li=null,this.Cv=null,this.Tv=!1,this.Pv=new ii(200),this.Jr=null,this.Rv=0,this.Dv=!1,this.Ov=()=>{this.Dv||this.tn.Av().$t().$h();},this.Bv=()=>{this.Dv||this.tn.Av().$t().$h();},this.tn=i,this.cn=n,this.So=n.layout,this.Oc=s,this.Vv="left"===e,this.Iv=xs("normal",e),this.zv=xs("top",e),this.Lv=xs("bottom",e),this.Ev=document.createElement("div"),this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Ev.style.width="25px",this.Ev.style.left="0",this.Ev.style.position="relative",this.Nv=as(this.Ev,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const r=this.Nv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Fv=as(this.Ev,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const h=this.Fv.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0";const l={hv:this.Wv.bind(this),ev:this.Wv.bind(this),Zf:this.jv.bind(this),Xf:this.jv.bind(this),lv:this.Hv.bind(this),tv:this.$v.bind(this),Jf:this.$v.bind(this),Vf:this.Uv.bind(this),Df:this.Uv.bind(this),Wf:this.qv.bind(this),pv:this.Yv.bind(this)};this.Xv=new fs(this.Fv.canvasElement,l,{qf:()=>!this.cn.handleScroll.vertTouchDrag,Yf:()=>!0});}S(){this.Xv.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Li&&this.Li.Ko().p(this),this.Li=null;}Kv(){return this.Ev}P(){return this.So.fontSize}Zv(){const t=this.Oc.W();return this.Jr!==t.R&&(this.Pv.ir(),this.Jr=t.R),t}Gv(){if(null===this.Li)return 0;let t=0;const i=this.Zv(),n=b(this.Nv.canvasElement.getContext("2d"));n.save();const s=this.Li.ja();n.font=this.Jv(),s.length>0&&(t=Math.max(this.Pv.xi(n,s[0].no),this.Pv.xi(n,s[s.length-1].no)));const e=this.Qv();for(let i=e.length;i--;){const s=this.Pv.xi(n,e[i].Zt());s>t&&(t=s);}const r=this.Li.Ct();if(null!==r&&null!==this.Cv){const i=this.Li.pn(1,r),s=this.Li.pn(this.Cv.height-2,r);t=Math.max(t,this.Pv.xi(n,this.Li.Fi(Math.floor(Math.min(i,s))+.11111111111111,r)),this.Pv.xi(n,this.Li.Fi(Math.ceil(Math.max(i,s))-.11111111111111,r)));}n.restore();const h=t||34;return es(Math.ceil(i.C+i.T+i.V+i.I+5+h))}tp(t){null!==this.Cv&&equalSizes(this.Cv,t)||(this.Cv=t,this.Dv=!0,this.Nv.resizeCanvasElement(t),this.Fv.resizeCanvasElement(t),this.Dv=!1,this.Ev.style.width=`${t.width}px`,this.Ev.style.height=`${t.height}px`);}ip(){return b(this.Cv).width}Gi(t){this.Li!==t&&(null!==this.Li&&this.Li.Ko().p(this),this.Li=t,t.Ko().l(this.do.bind(this),this));}Dt(){return this.Li}ir(){const t=this.tn.np();this.tn.Av().$t().L_(t,b(this.Dt()));}sp(t){if(null===this.Cv)return;if(1!==t){this.ep(),this.Nv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t);})),this.tn.hp(t,this.Lv),this.lp(t),this.tn.hp(t,this.Iv),this.ap(t));}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.op(i),this.tn.hp(i,this.zv));}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}bt(){var t;null===(t=this.Li)||void 0===t||t.ja();}Wv(t){if(null===this.Li||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np();this.Tv=!0,i.D_(n,this.Li,t.localY);}jv(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np(),s=this.Li;i.O_(n,s,t.localY);}Hv(){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.Av().$t(),i=this.tn.np(),n=this.Li;this.Tv&&(this.Tv=!1,t.A_(i,n));}$v(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),n=this.tn.np();this.Tv=!1,i.A_(n,this.Li);}Uv(t){this.cn.handleScale.axisDoubleClickReset.price&&this.ir();}qv(t){if(null===this.Li)return;!this.tn.Av().$t().W().handleScale.axisPressedMouseMove.price||this.Li.gh()||this.Li.Oo()||this.cp(1);}Yv(t){this.cp(0);}Qv(){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.np(),i);for(let i=0;i<e.length;i++)t.push(e[i]);}})(this.tn.np().$o()),t}rp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.tn.np().$t(),r=e.q(),h=e.md();r===h?Z(t,0,0,n,s,r):Q(t,0,0,n,s,r,h);}Ve({context:t,bitmapSize:i,horizontalPixelRatio:n}){if(null===this.Cv||null===this.Li||!this.Li.W().borderVisible)return;t.fillStyle=this.Li.W().borderColor;const s=Math.max(1,Math.floor(this.Zv().C*n));let e;e=this.Vv?i.width-s:0,t.fillRect(e,0,s,i.height);}lp(t){if(null===this.Cv||null===this.Li)return;const i=this.Li.ja(),n=this.Li.W(),s=this.Zv(),e=this.Vv?this.Cv.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.La*h)-a,o,l);t.fill();})),t.useMediaCoordinateSpace((({context:t})=>{var r;t.font=this.Jv(),t.fillStyle=null!==(r=n.textColor)&&void 0!==r?r:this.So.textColor,t.textAlign=this.Vv?"right":"left",t.textBaseline="middle";const h=this.Vv?Math.round(e-s.V):Math.round(e+s.T+s.V),l=i.map((i=>this.Pv.Mi(t,i.no)));for(let n=i.length;n--;){const s=i[n];t.fillText(s.no,h,s.La+l[n]);}}));}ep(){if(null===this.Cv||null===this.Li)return;let t=this.Cv.height/2;const i=[],n=this.Li.$o().slice(),s=this.tn.np(),e=this.Zv();this.Li===s.vr()&&this.tn.np().$o().forEach((t=>{s.dr(t)&&n.push(t);}));const r=this.Li.Aa()[0],h=this.Li;n.forEach((n=>{const e=n.Rn(s,h);e.forEach((t=>{t.Ai(null),t.Bi()&&i.push(t);})),r===n&&e.length>0&&(t=e[0].ki());})),i.forEach((t=>t.Ai(t.ki())));this.Li.W().alignLabels&&this.dp(i,e,t);}dp(t,i,n){if(null===this.Cv)return;const s=t.filter((t=>t.ki()<=n)),e=t.filter((t=>t.ki()>n));s.sort(((t,i)=>i.ki()-t.ki())),s.length&&e.length&&e.push(s[0]),e.sort(((t,i)=>t.ki()-i.ki()));for(const n of t){const t=Math.floor(n.Vt(i)/2),s=n.ki();s>-t&&s<t&&n.Ai(t),s>this.Cv.height-t&&s<this.Cv.height+t&&n.Ai(this.Cv.height-t);}for(let t=1;t<s.length;t++){const n=s[t],e=s[t-1],r=e.Vt(i,!1),h=n.ki(),l=e.Oi();h>l-r&&n.Ai(l-r);}for(let t=1;t<e.length;t++){const n=e[t],s=e[t-1],r=s.Vt(i,!0),h=n.ki(),l=s.Oi();h<l+r&&n.Ai(l+r);}}ap(t){if(null===this.Cv)return;const i=this.Qv(),n=this.Zv(),s=this.Vv?"right":"left";i.forEach((i=>{if(i.Vi()){i.gt(b(this.Li)).K(t,n,this.Pv,s);}}));}op(t){if(null===this.Cv||null===this.Li)return;const i=this.tn.Av().$t(),n=[],s=this.tn.np(),e=i.Yc().Rn(s,this.Li);e.length&&n.push(e);const r=this.Zv(),h=this.Vv?"right":"left";n.forEach((i=>{i.forEach((i=>{i.gt(b(this.Li)).K(t,r,this.Pv,h);}));}));}cp(t){this.Ev.style.cursor=1===t?"ns-resize":"default";}do(){const t=this.Gv();this.Rv<t&&this.tn.Av().$t().Kl(),this.Rv=t;}Jv(){return N(this.So.fontSize,this.So.fontFamily)}}function ks(t,i){var n,s;return null!==(s=null===(n=t._a)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}function ys(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 Cs(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 Ts(t,i){var n,s;return null!==(s=null===(n=t.la)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]}class Ps{constructor(i,n){this.Cv=size({width:0,height:0}),this.fp=null,this.vp=null,this.pp=null,this.mp=!1,this.bp=new R,this.wp=new R,this.gp=0,this.Mp=!1,this.xp=null,this.Sp=!1,this.kp=null,this.yp=null,this.Dv=!1,this.Ov=()=>{this.Dv||null===this.Cp||this.$i().$h();},this.Bv=()=>{this.Dv||null===this.Cp||this.$i().$h();},this.Tp=i,this.Cp=n,this.Cp.F_().l(this.Pp.bind(this),this,!0),this.Rp=document.createElement("td"),this.Rp.style.padding="0",this.Rp.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.Dp=document.createElement("td"),this.Dp.style.padding="0",this.Op=document.createElement("td"),this.Op.style.padding="0",this.Rp.appendChild(s),this.Nv=as(s,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const e=this.Nv.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Fv=as(s,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const r=this.Fv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.Ap=document.createElement("tr"),this.Ap.appendChild(this.Dp),this.Ap.appendChild(this.Rp),this.Ap.appendChild(this.Op),this.Bp(),this.Xv=new fs(this.Fv.canvasElement,this,{qf:()=>null===this.xp&&!this.Tp.W().handleScroll.vertTouchDrag,Yf:()=>null===this.xp&&!this.Tp.W().handleScroll.horzTouchDrag});}S(){null!==this.fp&&this.fp.S(),null!==this.vp&&this.vp.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Cp&&this.Cp.F_().p(this),this.Xv.S();}np(){return b(this.Cp)}Vp(t){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=t,null!==this.Cp&&this.Cp.F_().l(Ps.prototype.Pp.bind(this),this,!0),this.Bp();}Av(){return this.Tp}Kv(){return this.Ap}Bp(){if(null!==this.Cp&&(this.Ip(),0!==this.$i().wt().length)){if(null!==this.fp){const t=this.Cp.P_();this.fp.Gi(b(t));}if(null!==this.vp){const t=this.Cp.R_();this.vp.Gi(b(t));}}}zp(){null!==this.fp&&this.fp.bt(),null!==this.vp&&this.vp.bt();}g_(){return null!==this.Cp?this.Cp.g_():0}M_(t){this.Cp&&this.Cp.M_(t);}Wf(t){if(!this.Cp)return;this.Lp();const i=t.localX,n=t.localY;this.Ep(i,n,t);}hv(t){this.Lp(),this.Np(),this.Ep(t.localX,t.localY,t);}jf(t){var i;if(!this.Cp)return;this.Lp();const n=t.localX,s=t.localY;this.Ep(n,s,t);const e=this.br(n,s);this.Tp.Fp(null!==(i=null==e?void 0:e.yv)&&void 0!==i?i:null),this.$i().Wc(e&&{jc:e.jc,Sv:e.Sv});}iv(t){null!==this.Cp&&(this.Lp(),this.Wp(t));}Vf(t){null!==this.Cp&&this.jp(this.wp,t);}Df(t){this.Vf(t);}Zf(t){this.Lp(),this.Hp(t),this.Ep(t.localX,t.localY,t);}tv(t){null!==this.Cp&&(this.Lp(),this.Mp=!1,this.$p(t));}Qf(t){null!==this.Cp&&this.Wp(t);}mv(t){if(this.Mp=!0,null===this.xp){const i={x:t.localX,y:t.localY};this.Up(i,i,t);}}pv(t){null!==this.Cp&&(this.Lp(),this.Cp.$t().Wc(null),this.qp());}Yp(){return this.bp}Xp(){return this.wp}_v(){this.gp=1,this.$i().Un();}uv(t,i){if(!this.Tp.W().handleScale.pinch)return;const n=5*(i-this.gp);this.gp=i,this.$i().Jc(t.nt,n);}ev(t){this.Mp=!1,this.Sp=null!==this.xp,this.Np();const i=this.$i().Yc();null!==this.xp&&i.yt()&&(this.kp={x:i.Yt(),y:i.Xt()},this.xp={x:t.localX,y:t.localY});}Xf(t){if(null===this.Cp)return;const i=t.localX,n=t.localY;if(null===this.xp)this.Hp(t);else {this.Sp=!1;const s=b(this.kp),e=s.x+(i-this.xp.x),r=s.y+(n-this.xp.y);this.Ep(e,r,t);}}Jf(t){0===this.Av().W().trackingMode.exitMode&&(this.Sp=!0),this.Kp(),this.$p(t);}br(t,i){const n=this.Cp;return null===n?null:function(t,i,n){const s=t.$o(),e=function(t,i,n){var s,e;let r,h;for(const o of t){const t=null!==(e=null===(s=o.fa)||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?{kv:r,jc:h}:null}(s,i,n);if("top"===(null==e?void 0:e.kv.zOrder))return gs(e);for(const r of s){if(e&&e.jc===r&&"bottom"!==e.kv.zOrder&&!e.kv.isBackground)return gs(e);const s=Ms(r.Pn(t),i,n);if(null!==s)return {jc:r,Mv:s.Mv,Sv:s.Sv};if(e&&e.jc===r&&"bottom"!==e.kv.zOrder&&e.kv.isBackground)return gs(e)}return (null==e?void 0:e.kv)?gs(e):null}(n,t,i)}Zp(i,n){b("left"===n?this.fp:this.vp).tp(size({width:i,height:this.Cv.height}));}Gp(){return this.Cv}tp(t){equalSizes(this.Cv,t)||(this.Cv=t,this.Dv=!0,this.Nv.resizeCanvasElement(t),this.Fv.resizeCanvasElement(t),this.Dv=!1,this.Rp.style.width=t.width+"px",this.Rp.style.height=t.height+"px");}Jp(){const t=b(this.Cp);t.T_(t.P_()),t.T_(t.R_());for(const i of t.Aa())if(t.dr(i)){const n=i.Dt();null!==n&&t.T_(n),i.On();}}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}sp(t){if(0===t)return;if(null===this.Cp)return;if(t>1&&this.Jp(),null!==this.fp&&this.fp.sp(t),null!==this.vp&&this.vp.sp(t),1!==t){this.Nv.applySuggestedBitmapSize();const t=tryCreateCanvasRenderingTarget2D(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t);})),this.Cp&&(this.Qp(t,ks),this.tm(t),this.im(t),this.Qp(t,ys),this.Qp(t,Cs)));}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.nm(i),this.Qp(i,Ts));}sm(){return this.fp}rm(){return this.vp}hp(t,i){this.Qp(t,i);}Pp(){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=null;}Wp(t){this.jp(this.bp,t);}jp(t,i){const n=i.localX,s=i.localY;t.M()&&t.m(this.$i().St().Eu(n),{x:n,y:s},i);}rp({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.$i(),r=e.q(),h=e.md();r===h?Z(t,0,0,n,s,h):Q(t,0,0,n,s,r,h);}tm(t){const i=b(this.Cp).W_().Uh().gt();null!==i&&i.K(t,!1);}im(t){const i=this.$i().qc();this.hm(t,ys,_s,i),this.hm(t,ys,us,i);}nm(t){this.hm(t,ys,us,this.$i().Yc());}Qp(t,i){const n=b(this.Cp).$o();for(const s of n)this.hm(t,i,_s,s);for(const s of n)this.hm(t,i,us,s);}hm(t,i,n,s){const e=b(this.Cp),r=e.$t().Fc(),h=null!==r&&r.jc===s,l=null!==r&&h&&void 0!==r.Sv?r.Sv.gr:void 0;cs(i,(i=>n(i,t,h,l)),s,e);}Ip(){if(null===this.Cp)return;const t=this.Tp,i=this.Cp.P_().W().visible,n=this.Cp.R_().W().visible;i||null===this.fp||(this.Dp.removeChild(this.fp.Kv()),this.fp.S(),this.fp=null),n||null===this.vp||(this.Op.removeChild(this.vp.Kv()),this.vp.S(),this.vp=null);const s=t.$t()._d();i&&null===this.fp&&(this.fp=new Ss(this,t.W(),s,"left"),this.Dp.appendChild(this.fp.Kv())),n&&null===this.vp&&(this.vp=new Ss(this,t.W(),s,"right"),this.Op.appendChild(this.vp.Kv()));}lm(t){return t.bv&&this.Mp||null!==this.xp}am(t){return Math.max(0,Math.min(t,this.Cv.width-1))}om(t){return Math.max(0,Math.min(t,this.Cv.height-1))}Ep(t,i,n){this.$i().hd(this.am(t),this.om(i),n,b(this.Cp));}qp(){this.$i().ad();}Kp(){this.Sp&&(this.xp=null,this.qp());}Up(t,i,n){this.xp=t,this.Sp=!1,this.Ep(i.x,i.y,n);const s=this.$i().Yc();this.kp={x:s.Yt(),y:s.Xt()};}$i(){return this.Tp.$t()}$p(t){if(!this.mp)return;const i=this.$i(),n=this.np();if(i.I_(n,n.vn()),this.pp=null,this.mp=!1,i.sd(),null!==this.yp){const t=performance.now(),n=i.St();this.yp.Dr(n.ju(),t),this.yp.Ju(t)||i.Xn(this.yp);}}Lp(){this.xp=null;}Np(){if(!this.Cp)return;if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)b(document.activeElement).blur();else {const t=document.getSelection();null!==t&&t.removeAllRanges();}!this.Cp.vn().Ni()&&this.$i().St().Ni();}Hp(t){if(null===this.Cp)return;const i=this.$i(),n=i.St();if(n.Ni())return;const s=this.Tp.W(),e=s.handleScroll,r=s.kineticScroll;if((!e.pressedMouseMove||t.bv)&&(!e.horzTouchDrag&&!e.vertTouchDrag||!t.bv))return;const h=this.Cp.vn(),l=performance.now();if(null!==this.pp||this.lm(t)||(this.pp={x:t.clientX,y:t.clientY,Od:l,_m:t.localX,um:t.localY}),null!==this.pp&&!this.mp&&(this.pp.x!==t.clientX||this.pp.y!==t.clientY)){if(t.bv&&r.touch||!t.bv&&r.mouse){const t=n.he();this.yp=new ls(.2/t,7/t,.997,15/t),this.yp.qd(n.ju(),this.pp.Od);}else this.yp=null;h.Ni()||i.B_(this.Cp,h,t.localY),i.td(t.localX),this.mp=!0;}this.mp&&(h.Ni()||i.V_(this.Cp,h,t.localY),i.nd(t.localX),null!==this.yp&&this.yp.qd(n.ju(),l));}}class Rs{constructor(i,n,s,e,r){this.ft=!0,this.Cv=size({width:0,height:0}),this.Ov=()=>this.sp(3),this.Vv="left"===i,this.Oc=s._d,this.cn=n,this.dm=e,this.fm=r,this.Ev=document.createElement("div"),this.Ev.style.width="25px",this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Nv=as(this.Ev,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);}S(){this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose();}Kv(){return this.Ev}Gp(){return this.Cv}tp(t){equalSizes(this.Cv,t)||(this.Cv=t,this.Nv.resizeCanvasElement(t),this.Ev.style.width=`${t.width}px`,this.Ev.style.height=`${t.height}px`,this.ft=!0);}sp(t){if(t<3&&!this.ft)return;if(0===this.Cv.width||0===this.Cv.height)return;this.ft=!1,this.Nv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Nv);null!==i&&i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t);}));}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}Ve({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(!this.dm())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.Vv?i.width-e:0;t.fillRect(h,0,e,r);}rp({context:t,bitmapSize:i}){Z(t,0,0,i.width,i.height,this.fm());}}function Ds(t){return i=>{var n,s;return null!==(s=null===(n=i.da)||void 0===n?void 0:n.call(i,t))&&void 0!==s?s:[]}}const Os=Ds("normal"),As=Ds("top"),Bs=Ds("bottom");class Vs{constructor(i,n){this.vm=null,this.pm=null,this.k=null,this.bm=!1,this.Cv=size({width:0,height:0}),this.wm=new R,this.Pv=new ii(5),this.Dv=!1,this.Ov=()=>{this.Dv||this.Tp.$t().$h();},this.Bv=()=>{this.Dv||this.Tp.$t().$h();},this.Tp=i,this.U_=n,this.cn=i.W().layout,this.gm=document.createElement("tr"),this.Mm=document.createElement("td"),this.Mm.style.padding="0",this.xm=document.createElement("td"),this.xm.style.padding="0",this.Ev=document.createElement("td"),this.Ev.style.height="25px",this.Ev.style.padding="0",this.Sm=document.createElement("div"),this.Sm.style.width="100%",this.Sm.style.height="100%",this.Sm.style.position="relative",this.Sm.style.overflow="hidden",this.Ev.appendChild(this.Sm),this.Nv=as(this.Sm,size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const s=this.Nv.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Fv=as(this.Sm,size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const e=this.Fv.canvasElement;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0",this.gm.appendChild(this.Mm),this.gm.appendChild(this.Ev),this.gm.appendChild(this.xm),this.km(),this.Tp.$t().w_().l(this.km.bind(this),this),this.Xv=new fs(this.Fv.canvasElement,this,{qf:()=>!0,Yf:()=>!this.Tp.W().handleScroll.horzTouchDrag});}S(){this.Xv.S(),null!==this.vm&&this.vm.S(),null!==this.pm&&this.pm.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),os(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),os(this.Nv.canvasElement),this.Nv.dispose();}Kv(){return this.gm}ym(){return this.vm}Cm(){return this.pm}hv(t){if(this.bm)return;this.bm=!0;const i=this.Tp.$t();!i.St().Ni()&&this.Tp.W().handleScale.axisPressedMouseMove.time&&i.Gc(t.localX);}ev(t){this.hv(t);}lv(){const t=this.Tp.$t();!t.St().Ni()&&this.bm&&(this.bm=!1,this.Tp.W().handleScale.axisPressedMouseMove.time&&t.rd());}Zf(t){const i=this.Tp.$t();!i.St().Ni()&&this.Tp.W().handleScale.axisPressedMouseMove.time&&i.ed(t.localX);}Xf(t){this.Zf(t);}tv(){this.bm=!1;const t=this.Tp.$t();t.St().Ni()&&!this.Tp.W().handleScale.axisPressedMouseMove.time||t.rd();}Jf(){this.tv();}Vf(){this.Tp.W().handleScale.axisDoubleClickReset.time&&this.Tp.$t().Zn();}Df(){this.Vf();}Wf(){this.Tp.$t().W().handleScale.axisPressedMouseMove.time&&this.cp(1);}pv(){this.cp(0);}Gp(){return this.Cv}Tm(){return this.wm}Pm(i,s,e){equalSizes(this.Cv,i)||(this.Cv=i,this.Dv=!0,this.Nv.resizeCanvasElement(i),this.Fv.resizeCanvasElement(i),this.Dv=!1,this.Ev.style.width=`${i.width}px`,this.Ev.style.height=`${i.height}px`,this.wm.m(i)),null!==this.vm&&this.vm.tp(size({width:s,height:i.height})),null!==this.pm&&this.pm.tp(size({width:e,height:i.height}));}Rm(){const t=this.Dm();return Math.ceil(t.C+t.T+t.P+t.L+t.B+t.Om)}bt(){this.Tp.$t().St().ja();}_p(){return this.Nv.bitmapSize}up(t,i,n){const s=this._p();s.width>0&&s.height>0&&t.drawImage(this.Nv.canvasElement,i,n);}sp(t){if(0===t)return;if(1!==t){this.Nv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Nv);null!==i&&(i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t),this.Am(i,Bs);})),this.lp(i),this.Am(i,Os)),null!==this.vm&&this.vm.sp(t),null!==this.pm&&this.pm.sp(t);}this.Fv.applySuggestedBitmapSize();const i=tryCreateCanvasRenderingTarget2D(this.Fv);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height);})),this.Bm([...this.Tp.$t().wt(),this.Tp.$t().Yc()],i),this.Am(i,As));}Am(t,i){const n=this.Tp.$t().wt();for(const s of n)cs(i,(i=>_s(i,t,!1,void 0)),s,void 0);for(const s of n)cs(i,(i=>us(i,t,!1,void 0)),s,void 0);}rp({context:t,bitmapSize:i}){Z(t,0,0,i.width,i.height,this.Tp.$t().md());}Ve({context:t,bitmapSize:i,verticalPixelRatio:n}){if(this.Tp.W().timeScale.borderVisible){t.fillStyle=this.Vm();const s=Math.max(1,Math.floor(this.Dm().C*n));t.fillRect(0,0,i.width,s);}}lp(t){const i=this.Tp.$t().St(),n=i.ja();if(!n||0===n.length)return;const s=this.U_.maxTickMarkWeight(n),e=this.Dm(),r=i.W();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this.Vm(),t.fillStyle=this.Vm();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.Jv();for(const e of n)if(e.weight<s){const n=e.needAlignCoordinate?this.Im(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i);}this.Tp.W().timeScale.allowBoldLabels&&(t.font=this.zm());for(const e of n)if(e.weight>=s){const n=e.needAlignCoordinate?this.Im(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i);}}));}Im(t,i,n){const s=this.Pv.xi(t,n),e=s/2,r=Math.floor(i-e)+.5;return r<0?i+=Math.abs(0-r):r+s>this.Cv.width&&(i-=Math.abs(this.Cv.width-(r+s))),i}Bm(t,i){const n=this.Dm();for(const s of t)for(const t of s.Qi())t.gt().K(i,n);}Vm(){return this.Tp.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}Jv(){return N(this.j(),this.cn.fontFamily)}zm(){return N(this.j(),this.cn.fontFamily,"bold")}Dm(){null===this.k&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new ii,Om:0});const t=this.k,i=this.Jv();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.Om=4*n/12,t.Wi.ir();}return this.k}cp(t){this.Ev.style.cursor=1===t?"ew-resize":"default";}km(){const t=this.Tp.$t(),i=t.W();i.leftPriceScale.visible||null===this.vm||(this.Mm.removeChild(this.vm.Kv()),this.vm.S(),this.vm=null),i.rightPriceScale.visible||null===this.pm||(this.xm.removeChild(this.pm.Kv()),this.pm.S(),this.pm=null);const n={_d:this.Tp.$t()._d()},s=()=>i.leftPriceScale.borderVisible&&t.St().W().borderVisible,e=()=>t.md();i.leftPriceScale.visible&&null===this.vm&&(this.vm=new Rs("left",i,n,s,e),this.Mm.appendChild(this.vm.Kv())),i.rightPriceScale.visible&&null===this.pm&&(this.pm=new Rs("right",i,n,s,e),this.xm.appendChild(this.pm.Kv()));}}const Is=!!is&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!is&&((null===(zs=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===zs?void 0:zs.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var zs;class Ls{constructor(t,i,n){var s;this.Lm=[],this.Em=0,this.ro=0,this.o_=0,this.Nm=0,this.Fm=0,this.Wm=null,this.jm=!1,this.bp=new R,this.wp=new R,this.Pc=new R,this.Hm=null,this.$m=null,this.Um=t,this.cn=i,this.U_=n,this.gm=document.createElement("div"),this.gm.classList.add("tv-lightweight-charts"),this.gm.style.overflow="hidden",this.gm.style.direction="ltr",this.gm.style.width="100%",this.gm.style.height="100%",(s=this.gm).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.qm=document.createElement("table"),this.qm.setAttribute("cellspacing","0"),this.gm.appendChild(this.qm),this.Ym=this.Xm.bind(this),Es(this.cn)&&this.Km(!0),this.$i=new zn(this.Dc.bind(this),this.cn,n),this.$t().Xc().l(this.Zm.bind(this),this),this.Gm=new Vs(this,this.U_),this.qm.appendChild(this.Gm.Kv());const e=i.autoSize&&this.Jm();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.Qm(r,h),this.tb(),t.appendChild(this.gm),this.ib(),this.$i.St().sc().l(this.$i.Kl.bind(this.$i),this),this.$i.w_().l(this.$i.Kl.bind(this.$i),this);}$t(){return this.$i}W(){return this.cn}nb(){return this.Lm}sb(){return this.Gm}S(){this.Km(!1),0!==this.Em&&window.cancelAnimationFrame(this.Em),this.$i.Xc().p(this),this.$i.St().sc().p(this),this.$i.w_().p(this),this.$i.S();for(const t of this.Lm)this.qm.removeChild(t.Kv()),t.Yp().p(this),t.Xp().p(this),t.S();this.Lm=[],b(this.Gm).S(),null!==this.gm.parentElement&&this.gm.parentElement.removeChild(this.gm),this.Pc.S(),this.bp.S(),this.wp.S(),this.eb();}Qm(i,n,s=!1){if(this.ro===n&&this.o_===i)return;const e=function(i){const n=Math.floor(i.width),s=Math.floor(i.height);return size({width:n-n%2,height:s-s%2})}(size({width:i,height:n}));this.ro=e.height,this.o_=e.width;const r=this.ro+"px",h=this.o_+"px";b(this.gm).style.height=r,b(this.gm).style.width=h,this.qm.style.height=r,this.qm.style.width=h,s?this.rb(_t.es(),performance.now()):this.$i.Kl();}sp(t){void 0===t&&(t=_t.es());for(let i=0;i<this.Lm.length;i++)this.Lm[i].sp(t.Hn(i).Fn);this.cn.timeScale.visible&&this.Gm.sp(t.jn());}Hh(t){const i=Es(this.cn);this.$i.Hh(t);const n=Es(this.cn);n!==i&&this.Km(n),this.ib(),this.hb(t);}Yp(){return this.bp}Xp(){return this.wp}Xc(){return this.Pc}lb(){null!==this.Wm&&(this.rb(this.Wm,performance.now()),this.Wm=null);const t=this.ab(null),i=document.createElement("canvas");i.width=t.width,i.height=t.height;const n=b(i.getContext("2d"));return this.ab(n),i}ob(t){if("left"===t&&!this._b())return 0;if("right"===t&&!this.ub())return 0;if(0===this.Lm.length)return 0;return b("left"===t?this.Lm[0].sm():this.Lm[0].rm()).ip()}cb(){return this.cn.autoSize&&null!==this.Hm}fb(){return this.gm}Fp(t){this.$m=t,this.$m?this.fb().style.setProperty("cursor",t):this.fb().style.removeProperty("cursor");}pb(){return this.$m}mb(){return m(this.Lm[0]).Gp()}hb(t){(void 0!==t.autoSize||!this.Hm||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.Hm&&this.Jm(),!1===t.autoSize&&null!==this.Hm&&this.eb(),t.autoSize||void 0===t.width&&void 0===t.height||this.Qm(t.width||this.o_,t.height||this.ro));}ab(i){let n=0,s=0;const e=this.Lm[0],r=(t,n)=>{let s=0;for(let e=0;e<this.Lm.length;e++){const r=this.Lm[e],h=b("left"===t?r.sm():r.rm()),l=h._p();null!==i&&h.up(i,n,s),s+=l.height;}};if(this._b()){r("left",0);n+=b(e.sm())._p().width;}for(let t=0;t<this.Lm.length;t++){const e=this.Lm[t],r=e._p();null!==i&&e.up(i,n,s),s+=r.height;}if(n+=e._p().width,this.ub()){r("right",n);n+=b(e.rm())._p().width;}const h=(t,n,s)=>{b("left"===t?this.Gm.ym():this.Gm.Cm()).up(b(i),n,s);};if(this.cn.timeScale.visible){const t=this.Gm._p();if(null!==i){let n=0;this._b()&&(h("left",n,s),n=b(e.sm())._p().width),this.Gm.up(i,n,s),n+=t.width,this.ub()&&h("right",n,s);}s+=t.height;}return size({width:n,height:s})}bb(){let i=0,n=0,s=0;for(const t of this.Lm)this._b()&&(n=Math.max(n,b(t.sm()).Gv(),this.cn.leftPriceScale.minimumWidth)),this.ub()&&(s=Math.max(s,b(t.rm()).Gv(),this.cn.rightPriceScale.minimumWidth)),i+=t.g_();n=es(n),s=es(s);const e=this.o_,r=this.ro,h=Math.max(e-n-s,0),l=this.cn.timeScale.visible;let a=l?Math.max(this.Gm.Rm(),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.Lm.length;++i){const e=this.Lm[i];e.Vp(this.$i.Uc()[i]);let r=0,l=0;l=i===this.Lm.length-1?u-d:Math.round(e.g_()*c),r=Math.max(l,2),d+=r,e.tp(size({width:h,height:r})),this._b()&&e.Zp(n,"left"),this.ub()&&e.Zp(s,"right"),e.np()&&this.$i.Kc(e.np(),r);}this.Gm.Pm(size({width:l?h:0,height:a}),l?n:0,l?s:0),this.$i.x_(h),this.Nm!==n&&(this.Nm=n),this.Fm!==s&&(this.Fm=s);}Km(t){t?this.gm.addEventListener("wheel",this.Ym,{passive:!1}):this.gm.removeEventListener("wheel",this.Ym);}wb(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return Is?1/window.devicePixelRatio:1}Xm(t){if(!(0!==t.deltaX&&this.cn.handleScroll.mouseWheel||0!==t.deltaY&&this.cn.handleScale.mouseWheel))return;const i=this.wb(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.gm.getBoundingClientRect().left;this.$t().Jc(n,i);}0!==n&&this.cn.handleScroll.mouseWheel&&this.$t().Qc(-80*n);}rb(t,i){var n;const s=t.jn();3===s&&this.gb(),3!==s&&2!==s||(this.Mb(t),this.xb(t,i),this.Gm.bt(),this.Lm.forEach((t=>{t.zp();})),3===(null===(n=this.Wm)||void 0===n?void 0:n.jn())&&(this.Wm.ts(t),this.gb(),this.Mb(this.Wm),this.xb(this.Wm,i),t=this.Wm,this.Wm=null)),this.sp(t);}xb(t,i){for(const n of t.Qn())this.ns(n,i);}Mb(t){const i=this.$i.Uc();for(let n=0;n<i.length;n++)t.Hn(n).Wn&&i[n].E_();}ns(t,i){const n=this.$i.St();switch(t.qn){case 0:n.rc();break;case 1:n.hc(t.Ot);break;case 2:n.Gn(t.Ot);break;case 3:n.Jn(t.Ot);break;case 4:n.Uu();break;case 5:t.Ot.Ju(i)||n.Jn(t.Ot.Qu(i));}}Dc(t){null!==this.Wm?this.Wm.ts(t):this.Wm=t,this.jm||(this.jm=!0,this.Em=window.requestAnimationFrame((t=>{if(this.jm=!1,this.Em=0,null!==this.Wm){const i=this.Wm;this.Wm=null,this.rb(i,t);for(const n of i.Qn())if(5===n.qn&&!n.Ot.Ju(t)){this.$t().Xn(n.Ot);break}}})));}gb(){this.tb();}tb(){const t=this.$i.Uc(),i=t.length,n=this.Lm.length;for(let t=i;t<n;t++){const t=m(this.Lm.pop());this.qm.removeChild(t.Kv()),t.Yp().p(this),t.Xp().p(this),t.S();}for(let s=n;s<i;s++){const i=new Ps(this,t[s]);i.Yp().l(this.Sb.bind(this),this),i.Xp().l(this.kb.bind(this),this),this.Lm.push(i),this.qm.insertBefore(i.Kv(),this.Gm.Kv());}for(let n=0;n<i;n++){const i=t[n],s=this.Lm[n];s.np()!==i?s.Vp(i):s.Bp();}this.ib(),this.bb();}yb(t,i,n){var s;const e=new Map;if(null!==t){this.$i.wt().forEach((i=>{const n=i.In().hl(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().Fc(),l=null!==h&&h.jc instanceof Zi?h.jc:void 0,a=null!==h&&void 0!==h.Sv?h.Sv.wr:void 0;return {Cb:r,se:null!=t?t:void 0,Tb:null!=i?i:void 0,Pb:l,Rb:e,Db:a,Ob:null!=n?n:void 0}}Sb(t,i,n){this.bp.m((()=>this.yb(t,i,n)));}kb(t,i,n){this.wp.m((()=>this.yb(t,i,n)));}Zm(t,i,n){this.Pc.m((()=>this.yb(t,i,n)));}ib(){const t=this.cn.timeScale.visible?"":"none";this.Gm.Kv().style.display=t;}_b(){return this.Lm[0].np().P_().W().visible}ub(){return this.Lm[0].np().R_().W().visible}Jm(){return "ResizeObserver"in window&&(this.Hm=new ResizeObserver((t=>{const i=t.find((t=>t.target===this.Um));i&&this.Qm(i.contentRect.width,i.contentRect.height);})),this.Hm.observe(this.Um,{box:"border-box"}),!0)}eb(){null!==this.Hm&&this.Hm.disconnect(),this.Hm=null;}}function Es(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Ns(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 Fs(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.color&&(r.O=n.color),r}function Ws(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.lineColor&&(r.lt=n.lineColor),void 0!==n.topColor&&(r.Ts=n.topColor),void 0!==n.bottomColor&&(r.Ps=n.bottomColor),r}function js(t,i,n,s){const e=n.value,r={se:i,ot:t,Ot:[e,e,e,e],Cb:s};return void 0!==n.topLineColor&&(r.Pe=n.topLineColor),void 0!==n.bottomLineColor&&(r.Re=n.bottomLineColor),void 0!==n.topFillColor1&&(r.Se=n.topFillColor1),void 0!==n.topFillColor2&&(r.ke=n.topFillColor2),void 0!==n.bottomFillColor1&&(r.ye=n.bottomFillColor1),void 0!==n.bottomFillColor2&&(r.Ce=n.bottomFillColor2),r}function Hs(t,i,n,s){const e={se:i,ot:t,Ot:[n.open,n.high,n.low,n.close],Cb:s};return void 0!==n.color&&(e.O=n.color),e}function $s(t,i,n,s){const e={se:i,ot:t,Ot:[n.open,n.high,n.low,n.close],Cb:s};return void 0!==n.color&&(e.O=n.color),void 0!==n.borderColor&&(e.At=n.borderColor),void 0!==n.wickColor&&(e.Xh=n.wickColor),e}function Us(t,i,n,s,e){const r=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 {se:i,ot:t,Ot:o,Cb:s,He:Ns(_,["time","color"]),O:c}}function qs(t){return void 0!==t.Ot}function Ys(t,i){return void 0!==i.customValues&&(t.Ab=i.customValues),t}function Xs(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)?Ys({ot:i,se:n,Cb:e},s):Ys(t(i,n,s,e,r),s)}function Ks(t){return {Candlestick:Xs($s),Bar:Xs(Hs),Area:Xs(Ws),Baseline:Xs(js),Histogram:Xs(Fs),Line:Xs(Fs),Custom:Xs(Us)}[t]}function Zs(t){return {se:0,Bb:new Map,ha:t}}function Gs(t,i){if(void 0!==t&&0!==t.length)return {Vb:i.key(t[0].ot),Ib:i.key(t[t.length-1].ot)}}function Js(t){let i;return t.forEach((t=>{void 0===i&&(i=t.Cb);})),m(i)}class Qs{constructor(t){this.zb=new Map,this.Lb=new Map,this.Eb=new Map,this.Nb=[],this.U_=t;}S(){this.zb.clear(),this.Lb.clear(),this.Eb.clear(),this.Nb=[];}Fb(t,i){let n=0!==this.zb.size,s=!1;const e=this.Lb.get(t);if(void 0!==e)if(1===this.Lb.size)n=!1,s=!0,this.zb.clear();else for(const i of this.Nb)i.pointData.Bb.delete(t)&&(s=!0);let r=[];if(0!==i.length){const n=i.map((t=>t.time)),e=this.U_.createConverterToInternalObj(i),h=Ks(t.Jh()),l=t.ya(),a=t.Ca();r=i.map(((i,r)=>{const o=e(i.time),_=this.U_.key(o);let u=this.zb.get(_);void 0===u&&(u=Zs(o),this.zb.set(_,u),s=!0);const c=h(o,u.se,i,n[r],l,a);return u.Bb.set(t,c),c}));}n&&this.Wb(),this.jb(t,r);let h=-1;if(s){const t=[];this.zb.forEach((i=>{t.push({timeWeight:0,time:i.ha,pointData:i,originalTime:Js(i.Bb)});})),t.sort(((t,i)=>this.U_.key(t.time)-this.U_.key(i.time))),h=this.Hb(t);}return this.$b(t,h,function(t,i,n){const s=Gs(t,n),e=Gs(i,n);if(void 0!==s&&void 0!==e)return {Ql:s.Ib>=e.Ib&&s.Vb>=e.Vb}}(this.Lb.get(t),e,this.U_))}fd(t){return this.Fb(t,[])}Ub(t,i){const n=i;!function(t){void 0===t.Cb&&(t.Cb=t.time);}(n),this.U_.preprocessData(i);const s=this.U_.createConverterToInternalObj([i])(i.time),e=this.Eb.get(t);if(void 0!==e&&this.U_.key(s)<this.U_.key(e))throw new Error(`Cannot update oldest data, last time=${e}, new time=${s}`);let r=this.zb.get(this.U_.key(s));const h=void 0===r;void 0===r&&(r=Zs(s),this.zb.set(this.U_.key(s),r));const l=Ks(t.Jh()),a=t.ya(),o=t.Ca(),_=l(s,r.se,i,n.Cb,a,o);r.Bb.set(t,_),this.qb(t,_);const u={Ql:qs(_)};if(!h)return this.$b(t,-1,u);const c={timeWeight:0,time:r.ha,pointData:r,originalTime:Js(r.Bb)},d=At(this.Nb,this.U_.key(c.time),((t,i)=>this.U_.key(t.time)<i));this.Nb.splice(d,0,c);for(let t=d;t<this.Nb.length;++t)te(this.Nb[t].pointData,t);return this.U_.fillWeightsForPoints(this.Nb,d),this.$b(t,d,u)}qb(t,i){let n=this.Lb.get(t);void 0===n&&(n=[],this.Lb.set(t,n));const s=0!==n.length?n[n.length-1]:null;null===s||this.U_.key(i.ot)>this.U_.key(s.ot)?qs(i)&&n.push(i):qs(i)?n[n.length-1]=i:n.splice(-1,1),this.Eb.set(t,i.ot);}jb(t,i){0!==i.length?(this.Lb.set(t,i.filter(qs)),this.Eb.set(t,i[i.length-1].ot)):(this.Lb.delete(t),this.Eb.delete(t));}Wb(){for(const t of this.Nb)0===t.pointData.Bb.size&&this.zb.delete(this.U_.key(t.time));}Hb(t){let i=-1;for(let n=0;n<this.Nb.length&&n<t.length;++n){const s=this.Nb[n],e=t[n];if(this.U_.key(s.time)!==this.U_.key(e.time)){i=n;break}e.timeWeight=s.timeWeight,te(e.pointData,n);}if(-1===i&&this.Nb.length!==t.length&&(i=Math.min(this.Nb.length,t.length)),-1===i)return -1;for(let n=i;n<t.length;++n)te(t[n].pointData,n);return this.U_.fillWeightsForPoints(t,i),this.Nb=t,i}Yb(){if(0===this.Lb.size)return null;let t=0;return this.Lb.forEach((i=>{0!==i.length&&(t=Math.max(t,i[i.length-1].se));})),t}$b(t,i,n){const s={Xb:new Map,St:{Lu:this.Yb()}};if(-1!==i)this.Lb.forEach(((i,e)=>{s.Xb.set(e,{He:i,Kb:e===t?n:void 0});})),this.Lb.has(t)||s.Xb.set(t,{He:[],Kb:n}),s.St.Zb=this.Nb,s.St.Gb=i;else {const i=this.Lb.get(t);s.Xb.set(t,{He:i||[],Kb:n});}return s}}function te(t,i){t.se=i,t.Bb.forEach((t=>{t.se=i;}));}function ie(t){const i={value:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function ne(t){const i=ie(t);return void 0!==t.O&&(i.color=t.O),i}function se(t){const i=ie(t);return void 0!==t.lt&&(i.lineColor=t.lt),void 0!==t.Ts&&(i.topColor=t.Ts),void 0!==t.Ps&&(i.bottomColor=t.Ps),i}function ee(t){const i=ie(t);return void 0!==t.Pe&&(i.topLineColor=t.Pe),void 0!==t.Re&&(i.bottomLineColor=t.Re),void 0!==t.Se&&(i.topFillColor1=t.Se),void 0!==t.ke&&(i.topFillColor2=t.ke),void 0!==t.ye&&(i.bottomFillColor1=t.ye),void 0!==t.Ce&&(i.bottomFillColor2=t.Ce),i}function re(t){const i={open:t.Ot[0],high:t.Ot[1],low:t.Ot[2],close:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function he(t){const i=re(t);return void 0!==t.O&&(i.color=t.O),i}function le(t){const i=re(t),{O:n,At: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 ae(t){return {Area:se,Line:ne,Baseline:ee,Histogram:ne,Bar:he,Candlestick:le,Custom:oe}[t]}function oe(t){const i=t.Cb;return Object.assign(Object.assign({},t.He),{time:i})}const _e={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},ue={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},ce={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:E},de={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},fe={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},ve={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:E,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function pe(){return {width:0,height:0,autoSize:!1,layout:ce,crosshair:_e,grid:ue,overlayPriceScales:Object.assign({},de),leftPriceScale:Object.assign(Object.assign({},de),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},de),{visible:!0}),timeScale:fe,watermark:ve,localization:{locale:is?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.Jb=t,this.Qb=i;}applyOptions(t){this.Jb.$t().Hc(this.Qb,t);}options(){return this.Li().W()}width(){return ot(this.Qb)?this.Jb.ob(this.Qb):0}Li(){return b(this.Jb.$t().$c(this.Qb)).Dt}}function be(t,i,n){const s=Ns(t,["time","originalTime"]),e=Object.assign({time:i},s);return void 0!==n&&(e.originalTime=n),e}const we={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class ge{constructor(t){this.Eh=t;}applyOptions(t){this.Eh.Hh(t);}options(){return this.Eh.W()}tw(){return this.Eh}}class Me{constructor(t,i,n,s,e){this.iw=new R,this.Ls=t,this.nw=i,this.sw=n,this.U_=e,this.ew=s;}S(){this.iw.S();}priceFormatter(){return this.Ls.ma()}priceToCoordinate(t){const i=this.Ls.Ct();return null===i?null:this.Ls.Dt().Rt(t,i.Ot)}coordinateToPrice(t){const i=this.Ls.Ct();return null===i?null:this.Ls.Dt().pn(t,i.Ot)}barsInLogicalRange(t){if(null===t)return null;const i=new kn(new Mn(t.from,t.to)).hu(),n=this.Ls.In();if(n.Ni())return null;const s=n.hl(i.Os(),1),e=n.hl(i.ui(),-1),r=b(n.sl()),h=b(n.Vn());if(null!==s&&null!==e&&s.se>e.se)return {barsBefore:t.from-r,barsAfter:h-t.to};const l={barsBefore:null===s||s.se===r?t.from-r:s.se-r,barsAfter:null===e||e.se===h?h-t.to:h-e.se};return null!==s&&null!==e&&(l.from=s.Cb,l.to=e.Cb),l}setData(t){this.U_,this.Ls.Jh(),this.nw.rw(this.Ls,t),this.hw("full");}update(t){this.Ls.Jh(),this.nw.lw(this.Ls,t),this.hw("update");}dataByIndex(t,i){const n=this.Ls.In().hl(t,i);if(null===n)return null;return ae(this.seriesType())(n)}data(){const t=ae(this.seriesType());return this.Ls.In().ie().map((i=>t(i)))}subscribeDataChanged(t){this.iw.l(t);}unsubscribeDataChanged(t){this.iw.v(t);}setMarkers(t){this.U_;const i=t.map((t=>be(t,this.U_.convertHorzItemToInternal(t.time),t.time)));this.Ls.ia(i);}markers(){return this.Ls.na().map((t=>be(t,t.originalTime,void 0)))}applyOptions(t){this.Ls.Hh(t);}options(){return I(this.Ls.W())}priceScale(){return this.sw.priceScale(this.Ls.Dt().Ta())}createPriceLine(t){const i=D(I(we),t),n=this.Ls.sa(i);return new ge(n)}removePriceLine(t){this.Ls.ea(t.tw());}seriesType(){return this.Ls.Jh()}attachPrimitive(t){this.Ls.Sa(t),t.attached&&t.attached({chart:this.ew,series:this,requestUpdate:()=>this.Ls.$t().Kl()});}detachPrimitive(t){this.Ls.ka(t),t.detached&&t.detached();}hw(t){this.iw.M()&&this.iw.m(t);}}class xe{constructor(t,i,n){this.aw=new R,this.pu=new R,this.wm=new R,this.$i=t,this.kl=t.St(),this.Gm=i,this.kl.tc().l(this.ow.bind(this)),this.kl.nc().l(this._w.bind(this)),this.Gm.Tm().l(this.uw.bind(this)),this.U_=n;}S(){this.kl.tc().p(this),this.kl.nc().p(this),this.Gm.Tm().p(this),this.aw.S(),this.pu.S(),this.wm.S();}scrollPosition(){return this.kl.ju()}scrollToPosition(t,i){i?this.kl.Gu(t,1e3):this.$i.Jn(t);}scrollToRealTime(){this.kl.Zu();}getVisibleRange(){const t=this.kl.Du();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const i={from:this.U_.convertHorzItemToInternal(t.from),to:this.U_.convertHorzItemToInternal(t.to)},n=this.kl.Vu(i);this.$i.vd(n);}getVisibleLogicalRange(){const t=this.kl.Ru();return null===t?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){p(t.from<=t.to,"The from index cannot be after the to index."),this.$i.vd(t);}resetTimeScale(){this.$i.Zn();}fitContent(){this.$i.rc();}logicalToCoordinate(t){const i=this.$i.St();return i.Ni()?null:i.It(t)}coordinateToLogical(t){return this.kl.Ni()?null:this.kl.Eu(t)}timeToCoordinate(t){const i=this.U_.convertHorzItemToInternal(t),n=this.kl.Da(i,!1);return null===n?null:this.kl.It(n)}coordinateToTime(t){const i=this.$i.St(),n=i.Eu(t),s=i.Ui(n);return null===s?null:s.originalTime}width(){return this.Gm.Gp().width}height(){return this.Gm.Gp().height}subscribeVisibleTimeRangeChange(t){this.aw.l(t);}unsubscribeVisibleTimeRangeChange(t){this.aw.v(t);}subscribeVisibleLogicalRangeChange(t){this.pu.l(t);}unsubscribeVisibleLogicalRangeChange(t){this.pu.v(t);}subscribeSizeChange(t){this.wm.l(t);}unsubscribeSizeChange(t){this.wm.v(t);}applyOptions(t){this.kl.Hh(t);}options(){return Object.assign(Object.assign({},I(this.kl.W())),{barSpacing:this.kl.he()})}ow(){this.aw.M()&&this.aw.m(this.getVisibleRange());}_w(){this.pu.M()&&this.pu.m(this.getVisibleLogicalRange());}uw(t){this.wm.m(t.width,t.height);}}function Se(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 ke(t){return function(t){if(V(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;V(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),V(n)&&(t.handleScale.axisDoubleClickReset={time:n,price:n});}const i=t.handleScroll;V(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i});}(t),t}class ye{constructor(t,i,n){this.cw=new Map,this.dw=new Map,this.fw=new R,this.pw=new R,this.mw=new R,this.bw=new Qs(i);const s=void 0===n?I(pe()):D(I(pe()),ke(n));this.U_=i,this.Jb=new Ls(t,s,i),this.Jb.Yp().l((t=>{this.fw.M()&&this.fw.m(this.ww(t()));}),this),this.Jb.Xp().l((t=>{this.pw.M()&&this.pw.m(this.ww(t()));}),this),this.Jb.Xc().l((t=>{this.mw.M()&&this.mw.m(this.ww(t()));}),this);const e=this.Jb.$t();this.gw=new xe(e,this.Jb.sb(),this.U_);}remove(){this.Jb.Yp().p(this),this.Jb.Xp().p(this),this.Jb.Xc().p(this),this.gw.S(),this.Jb.S(),this.cw.clear(),this.dw.clear(),this.fw.S(),this.pw.S(),this.mw.S(),this.bw.S();}resize(t,i,n){this.autoSizeActive()||this.Jb.Qm(t,i,n);}addCustomSeries(t,i){const n=w(t),s=Object.assign(Object.assign({},_),n.defaultOptions());return this.Mw("Custom",s,i,n)}addAreaSeries(t){return this.Mw("Area",l,t)}addBaselineSeries(t){return this.Mw("Baseline",a,t)}addBarSeries(t){return this.Mw("Bar",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.Mw("Candlestick",e,t)}addHistogramSeries(t){return this.Mw("Histogram",o,t)}addLineSeries(t){return this.Mw("Line",h,t)}removeSeries(t){const i=m(this.cw.get(t)),n=this.bw.fd(i);this.Jb.$t().fd(i),this.xw(n),this.cw.delete(t),this.dw.delete(i);}rw(t,i){this.xw(this.bw.Fb(t,i));}lw(t,i){this.xw(this.bw.Ub(t,i));}subscribeClick(t){this.fw.l(t);}unsubscribeClick(t){this.fw.v(t);}subscribeCrosshairMove(t){this.mw.l(t);}unsubscribeCrosshairMove(t){this.mw.v(t);}subscribeDblClick(t){this.pw.l(t);}unsubscribeDblClick(t){this.pw.v(t);}priceScale(t){return new me(this.Jb,t)}timeScale(){return this.gw}applyOptions(t){this.Jb.Hh(ke(t));}options(){return this.Jb.W()}takeScreenshot(){return this.Jb.lb()}autoSizeActive(){return this.Jb.cb()}chartElement(){return this.Jb.fb()}paneSize(){const t=this.Jb.mb();return {height:t.height,width:t.width}}setCrosshairPosition(t,i,n){const s=this.cw.get(n);if(void 0===s)return;const e=this.Jb.$t().cr(s);null!==e&&this.Jb.$t().ld(t,i,e);}clearCrosshairPosition(){this.Jb.$t().ad(!0);}Mw(t,i,n={},s){Se(n.priceFormat);const e=D(I(u),I(i),n),r=this.Jb.$t().ud(t,e,s),h=new Me(r,this,this,this,this.U_);return this.cw.set(h,r),this.dw.set(r,h),h}xw(t){const i=this.Jb.$t();i.od(t.St.Lu,t.St.Zb,t.St.Gb),t.Xb.forEach(((t,i)=>i.J(t.He,t.Kb))),i.Fu();}Sw(t){return m(this.dw.get(t))}ww(t){const i=new Map;t.Rb.forEach(((t,n)=>{const s=n.Jh(),e=ae(s)(t);if("Custom"!==s)p(function(t){return void 0!==t.open||void 0!==t.value}(e));else {const t=n.Ca();p(!t||!1===t(e));}i.set(this.Sw(n),e);}));const n=void 0!==t.Pb&&this.dw.has(t.Pb)?this.Sw(t.Pb):void 0;return {time:t.Cb,logical:t.se,point:t.Tb,hoveredSeries:n,hoveredObjectId:t.Db,seriesData:i,sourceEvent:t.Ob}}}function Ce(t,i,n){let s;if(B(t)){const i=document.getElementById(t);p(null!==i,`Cannot find element in DOM with id=${t}`),s=i;}else s=t;const e=new ye(s,i,n);return i.setOptions(e.options()),e}function Te(t,i){return Ce(t,new ts,ts.Vd(i))}Object.assign(Object.assign({},u),_);
91202
90948
 
91203
90949
  const determineValues = (input) => {
91204
90950
  // if input is larger than 1 return [2, 0.01]
@@ -91654,779 +91400,6 @@ const ProjectViewWithProviders = (props) => {
91654
91400
  return (jsx$2(Providers, { children: jsx$2(ProjectView, Object.assign({}, props)) }));
91655
91401
  };
91656
91402
 
91657
- var domToImage = {exports: {}};
91658
-
91659
- (function (module) {
91660
- (function (global) {
91661
-
91662
- var util = newUtil();
91663
- var inliner = newInliner();
91664
- var fontFaces = newFontFaces();
91665
- var images = newImages();
91666
-
91667
- // Default impl options
91668
- var defaultOptions = {
91669
- // Default is to fail on error, no placeholder
91670
- imagePlaceholder: undefined,
91671
- // Default cache bust is false, it will use the cache
91672
- cacheBust: false
91673
- };
91674
-
91675
- var domtoimage = {
91676
- toSvg: toSvg,
91677
- toPng: toPng,
91678
- toJpeg: toJpeg,
91679
- toBlob: toBlob,
91680
- toPixelData: toPixelData,
91681
- impl: {
91682
- fontFaces: fontFaces,
91683
- images: images,
91684
- util: util,
91685
- inliner: inliner,
91686
- options: {}
91687
- }
91688
- };
91689
-
91690
- module.exports = domtoimage;
91691
-
91692
-
91693
- /**
91694
- * @param {Node} node - The DOM Node object to render
91695
- * @param {Object} options - Rendering options
91696
- * @param {Function} options.filter - Should return true if passed node should be included in the output
91697
- * (excluding node means excluding it's children as well). Not called on the root node.
91698
- * @param {String} options.bgcolor - color for the background, any valid CSS color value.
91699
- * @param {Number} options.width - width to be applied to node before rendering.
91700
- * @param {Number} options.height - height to be applied to node before rendering.
91701
- * @param {Object} options.style - an object whose properties to be copied to node's style before rendering.
91702
- * @param {Number} options.quality - a Number between 0 and 1 indicating image quality (applicable to JPEG only),
91703
- defaults to 1.0.
91704
- * @param {String} options.imagePlaceholder - dataURL to use as a placeholder for failed images, default behaviour is to fail fast on images we can't fetch
91705
- * @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url
91706
- * @return {Promise} - A promise that is fulfilled with a SVG image data URL
91707
- * */
91708
- function toSvg(node, options) {
91709
- options = options || {};
91710
- copyOptions(options);
91711
- return Promise.resolve(node)
91712
- .then(function (node) {
91713
- return cloneNode(node, options.filter, true);
91714
- })
91715
- .then(embedFonts)
91716
- .then(inlineImages)
91717
- .then(applyOptions)
91718
- .then(function (clone) {
91719
- return makeSvgDataUri(clone,
91720
- options.width || util.width(node),
91721
- options.height || util.height(node)
91722
- );
91723
- });
91724
-
91725
- function applyOptions(clone) {
91726
- if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;
91727
-
91728
- if (options.width) clone.style.width = options.width + 'px';
91729
- if (options.height) clone.style.height = options.height + 'px';
91730
-
91731
- if (options.style)
91732
- Object.keys(options.style).forEach(function (property) {
91733
- clone.style[property] = options.style[property];
91734
- });
91735
-
91736
- return clone;
91737
- }
91738
- }
91739
-
91740
- /**
91741
- * @param {Node} node - The DOM Node object to render
91742
- * @param {Object} options - Rendering options, @see {@link toSvg}
91743
- * @return {Promise} - A promise that is fulfilled with a Uint8Array containing RGBA pixel data.
91744
- * */
91745
- function toPixelData(node, options) {
91746
- return draw(node, options || {})
91747
- .then(function (canvas) {
91748
- return canvas.getContext('2d').getImageData(
91749
- 0,
91750
- 0,
91751
- util.width(node),
91752
- util.height(node)
91753
- ).data;
91754
- });
91755
- }
91756
-
91757
- /**
91758
- * @param {Node} node - The DOM Node object to render
91759
- * @param {Object} options - Rendering options, @see {@link toSvg}
91760
- * @return {Promise} - A promise that is fulfilled with a PNG image data URL
91761
- * */
91762
- function toPng(node, options) {
91763
- return draw(node, options || {})
91764
- .then(function (canvas) {
91765
- return canvas.toDataURL();
91766
- });
91767
- }
91768
-
91769
- /**
91770
- * @param {Node} node - The DOM Node object to render
91771
- * @param {Object} options - Rendering options, @see {@link toSvg}
91772
- * @return {Promise} - A promise that is fulfilled with a JPEG image data URL
91773
- * */
91774
- function toJpeg(node, options) {
91775
- options = options || {};
91776
- return draw(node, options)
91777
- .then(function (canvas) {
91778
- return canvas.toDataURL('image/jpeg', options.quality || 1.0);
91779
- });
91780
- }
91781
-
91782
- /**
91783
- * @param {Node} node - The DOM Node object to render
91784
- * @param {Object} options - Rendering options, @see {@link toSvg}
91785
- * @return {Promise} - A promise that is fulfilled with a PNG image blob
91786
- * */
91787
- function toBlob(node, options) {
91788
- return draw(node, options || {})
91789
- .then(util.canvasToBlob);
91790
- }
91791
-
91792
- function copyOptions(options) {
91793
- // Copy options to impl options for use in impl
91794
- if(typeof(options.imagePlaceholder) === 'undefined') {
91795
- domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder;
91796
- } else {
91797
- domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder;
91798
- }
91799
-
91800
- if(typeof(options.cacheBust) === 'undefined') {
91801
- domtoimage.impl.options.cacheBust = defaultOptions.cacheBust;
91802
- } else {
91803
- domtoimage.impl.options.cacheBust = options.cacheBust;
91804
- }
91805
- }
91806
-
91807
- function draw(domNode, options) {
91808
- return toSvg(domNode, options)
91809
- .then(util.makeImage)
91810
- .then(util.delay(100))
91811
- .then(function (image) {
91812
- var canvas = newCanvas(domNode);
91813
- canvas.getContext('2d').drawImage(image, 0, 0);
91814
- return canvas;
91815
- });
91816
-
91817
- function newCanvas(domNode) {
91818
- var canvas = document.createElement('canvas');
91819
- canvas.width = options.width || util.width(domNode);
91820
- canvas.height = options.height || util.height(domNode);
91821
-
91822
- if (options.bgcolor) {
91823
- var ctx = canvas.getContext('2d');
91824
- ctx.fillStyle = options.bgcolor;
91825
- ctx.fillRect(0, 0, canvas.width, canvas.height);
91826
- }
91827
-
91828
- return canvas;
91829
- }
91830
- }
91831
-
91832
- function cloneNode(node, filter, root) {
91833
- if (!root && filter && !filter(node)) return Promise.resolve();
91834
-
91835
- return Promise.resolve(node)
91836
- .then(makeNodeCopy)
91837
- .then(function (clone) {
91838
- return cloneChildren(node, clone, filter);
91839
- })
91840
- .then(function (clone) {
91841
- return processClone(node, clone);
91842
- });
91843
-
91844
- function makeNodeCopy(node) {
91845
- if (node instanceof HTMLCanvasElement) return util.makeImage(node.toDataURL());
91846
- return node.cloneNode(false);
91847
- }
91848
-
91849
- function cloneChildren(original, clone, filter) {
91850
- var children = original.childNodes;
91851
- if (children.length === 0) return Promise.resolve(clone);
91852
-
91853
- return cloneChildrenInOrder(clone, util.asArray(children), filter)
91854
- .then(function () {
91855
- return clone;
91856
- });
91857
-
91858
- function cloneChildrenInOrder(parent, children, filter) {
91859
- var done = Promise.resolve();
91860
- children.forEach(function (child) {
91861
- done = done
91862
- .then(function () {
91863
- return cloneNode(child, filter);
91864
- })
91865
- .then(function (childClone) {
91866
- if (childClone) parent.appendChild(childClone);
91867
- });
91868
- });
91869
- return done;
91870
- }
91871
- }
91872
-
91873
- function processClone(original, clone) {
91874
- if (!(clone instanceof Element)) return clone;
91875
-
91876
- return Promise.resolve()
91877
- .then(cloneStyle)
91878
- .then(clonePseudoElements)
91879
- .then(copyUserInput)
91880
- .then(fixSvg)
91881
- .then(function () {
91882
- return clone;
91883
- });
91884
-
91885
- function cloneStyle() {
91886
- copyStyle(window.getComputedStyle(original), clone.style);
91887
-
91888
- function copyStyle(source, target) {
91889
- if (source.cssText) target.cssText = source.cssText;
91890
- else copyProperties(source, target);
91891
-
91892
- function copyProperties(source, target) {
91893
- util.asArray(source).forEach(function (name) {
91894
- target.setProperty(
91895
- name,
91896
- source.getPropertyValue(name),
91897
- source.getPropertyPriority(name)
91898
- );
91899
- });
91900
- }
91901
- }
91902
- }
91903
-
91904
- function clonePseudoElements() {
91905
- [':before', ':after'].forEach(function (element) {
91906
- clonePseudoElement(element);
91907
- });
91908
-
91909
- function clonePseudoElement(element) {
91910
- var style = window.getComputedStyle(original, element);
91911
- var content = style.getPropertyValue('content');
91912
-
91913
- if (content === '' || content === 'none') return;
91914
-
91915
- var className = util.uid();
91916
- clone.className = clone.className + ' ' + className;
91917
- var styleElement = document.createElement('style');
91918
- styleElement.appendChild(formatPseudoElementStyle(className, element, style));
91919
- clone.appendChild(styleElement);
91920
-
91921
- function formatPseudoElementStyle(className, element, style) {
91922
- var selector = '.' + className + ':' + element;
91923
- var cssText = style.cssText ? formatCssText(style) : formatCssProperties(style);
91924
- return document.createTextNode(selector + '{' + cssText + '}');
91925
-
91926
- function formatCssText(style) {
91927
- var content = style.getPropertyValue('content');
91928
- return style.cssText + ' content: ' + content + ';';
91929
- }
91930
-
91931
- function formatCssProperties(style) {
91932
-
91933
- return util.asArray(style)
91934
- .map(formatProperty)
91935
- .join('; ') + ';';
91936
-
91937
- function formatProperty(name) {
91938
- return name + ': ' +
91939
- style.getPropertyValue(name) +
91940
- (style.getPropertyPriority(name) ? ' !important' : '');
91941
- }
91942
- }
91943
- }
91944
- }
91945
- }
91946
-
91947
- function copyUserInput() {
91948
- if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;
91949
- if (original instanceof HTMLInputElement) clone.setAttribute("value", original.value);
91950
- }
91951
-
91952
- function fixSvg() {
91953
- if (!(clone instanceof SVGElement)) return;
91954
- clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
91955
-
91956
- if (!(clone instanceof SVGRectElement)) return;
91957
- ['width', 'height'].forEach(function (attribute) {
91958
- var value = clone.getAttribute(attribute);
91959
- if (!value) return;
91960
-
91961
- clone.style.setProperty(attribute, value);
91962
- });
91963
- }
91964
- }
91965
- }
91966
-
91967
- function embedFonts(node) {
91968
- return fontFaces.resolveAll()
91969
- .then(function (cssText) {
91970
- var styleNode = document.createElement('style');
91971
- node.appendChild(styleNode);
91972
- styleNode.appendChild(document.createTextNode(cssText));
91973
- return node;
91974
- });
91975
- }
91976
-
91977
- function inlineImages(node) {
91978
- return images.inlineAll(node)
91979
- .then(function () {
91980
- return node;
91981
- });
91982
- }
91983
-
91984
- function makeSvgDataUri(node, width, height) {
91985
- return Promise.resolve(node)
91986
- .then(function (node) {
91987
- node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
91988
- return new XMLSerializer().serializeToString(node);
91989
- })
91990
- .then(util.escapeXhtml)
91991
- .then(function (xhtml) {
91992
- return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + '</foreignObject>';
91993
- })
91994
- .then(function (foreignObject) {
91995
- return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">' +
91996
- foreignObject + '</svg>';
91997
- })
91998
- .then(function (svg) {
91999
- return 'data:image/svg+xml;charset=utf-8,' + svg;
92000
- });
92001
- }
92002
-
92003
- function newUtil() {
92004
- return {
92005
- escape: escape,
92006
- parseExtension: parseExtension,
92007
- mimeType: mimeType,
92008
- dataAsUrl: dataAsUrl,
92009
- isDataUrl: isDataUrl,
92010
- canvasToBlob: canvasToBlob,
92011
- resolveUrl: resolveUrl,
92012
- getAndEncode: getAndEncode,
92013
- uid: uid(),
92014
- delay: delay,
92015
- asArray: asArray,
92016
- escapeXhtml: escapeXhtml,
92017
- makeImage: makeImage,
92018
- width: width,
92019
- height: height
92020
- };
92021
-
92022
- function mimes() {
92023
- /*
92024
- * Only WOFF and EOT mime types for fonts are 'real'
92025
- * see http://www.iana.org/assignments/media-types/media-types.xhtml
92026
- */
92027
- var WOFF = 'application/font-woff';
92028
- var JPEG = 'image/jpeg';
92029
-
92030
- return {
92031
- 'woff': WOFF,
92032
- 'woff2': WOFF,
92033
- 'ttf': 'application/font-truetype',
92034
- 'eot': 'application/vnd.ms-fontobject',
92035
- 'png': 'image/png',
92036
- 'jpg': JPEG,
92037
- 'jpeg': JPEG,
92038
- 'gif': 'image/gif',
92039
- 'tiff': 'image/tiff',
92040
- 'svg': 'image/svg+xml'
92041
- };
92042
- }
92043
-
92044
- function parseExtension(url) {
92045
- var match = /\.([^\.\/]*?)$/g.exec(url);
92046
- if (match) return match[1];
92047
- else return '';
92048
- }
92049
-
92050
- function mimeType(url) {
92051
- var extension = parseExtension(url).toLowerCase();
92052
- return mimes()[extension] || '';
92053
- }
92054
-
92055
- function isDataUrl(url) {
92056
- return url.search(/^(data:)/) !== -1;
92057
- }
92058
-
92059
- function toBlob(canvas) {
92060
- return new Promise(function (resolve) {
92061
- var binaryString = window.atob(canvas.toDataURL().split(',')[1]);
92062
- var length = binaryString.length;
92063
- var binaryArray = new Uint8Array(length);
92064
-
92065
- for (var i = 0; i < length; i++)
92066
- binaryArray[i] = binaryString.charCodeAt(i);
92067
-
92068
- resolve(new Blob([binaryArray], {
92069
- type: 'image/png'
92070
- }));
92071
- });
92072
- }
92073
-
92074
- function canvasToBlob(canvas) {
92075
- if (canvas.toBlob)
92076
- return new Promise(function (resolve) {
92077
- canvas.toBlob(resolve);
92078
- });
92079
-
92080
- return toBlob(canvas);
92081
- }
92082
-
92083
- function resolveUrl(url, baseUrl) {
92084
- var doc = document.implementation.createHTMLDocument();
92085
- var base = doc.createElement('base');
92086
- doc.head.appendChild(base);
92087
- var a = doc.createElement('a');
92088
- doc.body.appendChild(a);
92089
- base.href = baseUrl;
92090
- a.href = url;
92091
- return a.href;
92092
- }
92093
-
92094
- function uid() {
92095
- var index = 0;
92096
-
92097
- return function () {
92098
- return 'u' + fourRandomChars() + index++;
92099
-
92100
- function fourRandomChars() {
92101
- /* see http://stackoverflow.com/a/6248722/2519373 */
92102
- return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);
92103
- }
92104
- };
92105
- }
92106
-
92107
- function makeImage(uri) {
92108
- return new Promise(function (resolve, reject) {
92109
- var image = new Image();
92110
- image.onload = function () {
92111
- resolve(image);
92112
- };
92113
- image.onerror = reject;
92114
- image.src = uri;
92115
- });
92116
- }
92117
-
92118
- function getAndEncode(url) {
92119
- var TIMEOUT = 30000;
92120
- if(domtoimage.impl.options.cacheBust) {
92121
- // Cache bypass so we dont have CORS issues with cached images
92122
- // Source: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
92123
- url += ((/\?/).test(url) ? "&" : "?") + (new Date()).getTime();
92124
- }
92125
-
92126
- return new Promise(function (resolve) {
92127
- var request = new XMLHttpRequest();
92128
-
92129
- request.onreadystatechange = done;
92130
- request.ontimeout = timeout;
92131
- request.responseType = 'blob';
92132
- request.timeout = TIMEOUT;
92133
- request.open('GET', url, true);
92134
- request.send();
92135
-
92136
- var placeholder;
92137
- if(domtoimage.impl.options.imagePlaceholder) {
92138
- var split = domtoimage.impl.options.imagePlaceholder.split(/,/);
92139
- if(split && split[1]) {
92140
- placeholder = split[1];
92141
- }
92142
- }
92143
-
92144
- function done() {
92145
- if (request.readyState !== 4) return;
92146
-
92147
- if (request.status !== 200) {
92148
- if(placeholder) {
92149
- resolve(placeholder);
92150
- } else {
92151
- fail('cannot fetch resource: ' + url + ', status: ' + request.status);
92152
- }
92153
-
92154
- return;
92155
- }
92156
-
92157
- var encoder = new FileReader();
92158
- encoder.onloadend = function () {
92159
- var content = encoder.result.split(/,/)[1];
92160
- resolve(content);
92161
- };
92162
- encoder.readAsDataURL(request.response);
92163
- }
92164
-
92165
- function timeout() {
92166
- if(placeholder) {
92167
- resolve(placeholder);
92168
- } else {
92169
- fail('timeout of ' + TIMEOUT + 'ms occured while fetching resource: ' + url);
92170
- }
92171
- }
92172
-
92173
- function fail(message) {
92174
- console.error(message);
92175
- resolve('');
92176
- }
92177
- });
92178
- }
92179
-
92180
- function dataAsUrl(content, type) {
92181
- return 'data:' + type + ';base64,' + content;
92182
- }
92183
-
92184
- function escape(string) {
92185
- return string.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1');
92186
- }
92187
-
92188
- function delay(ms) {
92189
- return function (arg) {
92190
- return new Promise(function (resolve) {
92191
- setTimeout(function () {
92192
- resolve(arg);
92193
- }, ms);
92194
- });
92195
- };
92196
- }
92197
-
92198
- function asArray(arrayLike) {
92199
- var array = [];
92200
- var length = arrayLike.length;
92201
- for (var i = 0; i < length; i++) array.push(arrayLike[i]);
92202
- return array;
92203
- }
92204
-
92205
- function escapeXhtml(string) {
92206
- return string.replace(/#/g, '%23').replace(/\n/g, '%0A');
92207
- }
92208
-
92209
- function width(node) {
92210
- var leftBorder = px(node, 'border-left-width');
92211
- var rightBorder = px(node, 'border-right-width');
92212
- return node.scrollWidth + leftBorder + rightBorder;
92213
- }
92214
-
92215
- function height(node) {
92216
- var topBorder = px(node, 'border-top-width');
92217
- var bottomBorder = px(node, 'border-bottom-width');
92218
- return node.scrollHeight + topBorder + bottomBorder;
92219
- }
92220
-
92221
- function px(node, styleProperty) {
92222
- var value = window.getComputedStyle(node).getPropertyValue(styleProperty);
92223
- return parseFloat(value.replace('px', ''));
92224
- }
92225
- }
92226
-
92227
- function newInliner() {
92228
- var URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g;
92229
-
92230
- return {
92231
- inlineAll: inlineAll,
92232
- shouldProcess: shouldProcess,
92233
- impl: {
92234
- readUrls: readUrls,
92235
- inline: inline
92236
- }
92237
- };
92238
-
92239
- function shouldProcess(string) {
92240
- return string.search(URL_REGEX) !== -1;
92241
- }
92242
-
92243
- function readUrls(string) {
92244
- var result = [];
92245
- var match;
92246
- while ((match = URL_REGEX.exec(string)) !== null) {
92247
- result.push(match[1]);
92248
- }
92249
- return result.filter(function (url) {
92250
- return !util.isDataUrl(url);
92251
- });
92252
- }
92253
-
92254
- function inline(string, url, baseUrl, get) {
92255
- return Promise.resolve(url)
92256
- .then(function (url) {
92257
- return baseUrl ? util.resolveUrl(url, baseUrl) : url;
92258
- })
92259
- .then(get || util.getAndEncode)
92260
- .then(function (data) {
92261
- return util.dataAsUrl(data, util.mimeType(url));
92262
- })
92263
- .then(function (dataUrl) {
92264
- return string.replace(urlAsRegex(url), '$1' + dataUrl + '$3');
92265
- });
92266
-
92267
- function urlAsRegex(url) {
92268
- return new RegExp('(url\\([\'"]?)(' + util.escape(url) + ')([\'"]?\\))', 'g');
92269
- }
92270
- }
92271
-
92272
- function inlineAll(string, baseUrl, get) {
92273
- if (nothingToInline()) return Promise.resolve(string);
92274
-
92275
- return Promise.resolve(string)
92276
- .then(readUrls)
92277
- .then(function (urls) {
92278
- var done = Promise.resolve(string);
92279
- urls.forEach(function (url) {
92280
- done = done.then(function (string) {
92281
- return inline(string, url, baseUrl, get);
92282
- });
92283
- });
92284
- return done;
92285
- });
92286
-
92287
- function nothingToInline() {
92288
- return !shouldProcess(string);
92289
- }
92290
- }
92291
- }
92292
-
92293
- function newFontFaces() {
92294
- return {
92295
- resolveAll: resolveAll,
92296
- impl: {
92297
- readAll: readAll
92298
- }
92299
- };
92300
-
92301
- function resolveAll() {
92302
- return readAll()
92303
- .then(function (webFonts) {
92304
- return Promise.all(
92305
- webFonts.map(function (webFont) {
92306
- return webFont.resolve();
92307
- })
92308
- );
92309
- })
92310
- .then(function (cssStrings) {
92311
- return cssStrings.join('\n');
92312
- });
92313
- }
92314
-
92315
- function readAll() {
92316
- return Promise.resolve(util.asArray(document.styleSheets))
92317
- .then(getCssRules)
92318
- .then(selectWebFontRules)
92319
- .then(function (rules) {
92320
- return rules.map(newWebFont);
92321
- });
92322
-
92323
- function selectWebFontRules(cssRules) {
92324
- return cssRules
92325
- .filter(function (rule) {
92326
- return rule.type === CSSRule.FONT_FACE_RULE;
92327
- })
92328
- .filter(function (rule) {
92329
- return inliner.shouldProcess(rule.style.getPropertyValue('src'));
92330
- });
92331
- }
92332
-
92333
- function getCssRules(styleSheets) {
92334
- var cssRules = [];
92335
- styleSheets.forEach(function (sheet) {
92336
- try {
92337
- util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
92338
- } catch (e) {
92339
- console.log('Error while reading CSS rules from ' + sheet.href, e.toString());
92340
- }
92341
- });
92342
- return cssRules;
92343
- }
92344
-
92345
- function newWebFont(webFontRule) {
92346
- return {
92347
- resolve: function resolve() {
92348
- var baseUrl = (webFontRule.parentStyleSheet || {}).href;
92349
- return inliner.inlineAll(webFontRule.cssText, baseUrl);
92350
- },
92351
- src: function () {
92352
- return webFontRule.style.getPropertyValue('src');
92353
- }
92354
- };
92355
- }
92356
- }
92357
- }
92358
-
92359
- function newImages() {
92360
- return {
92361
- inlineAll: inlineAll,
92362
- impl: {
92363
- newImage: newImage
92364
- }
92365
- };
92366
-
92367
- function newImage(element) {
92368
- return {
92369
- inline: inline
92370
- };
92371
-
92372
- function inline(get) {
92373
- if (util.isDataUrl(element.src)) return Promise.resolve();
92374
-
92375
- return Promise.resolve(element.src)
92376
- .then(get || util.getAndEncode)
92377
- .then(function (data) {
92378
- return util.dataAsUrl(data, util.mimeType(element.src));
92379
- })
92380
- .then(function (dataUrl) {
92381
- return new Promise(function (resolve, reject) {
92382
- element.onload = resolve;
92383
- element.onerror = reject;
92384
- element.src = dataUrl;
92385
- });
92386
- });
92387
- }
92388
- }
92389
-
92390
- function inlineAll(node) {
92391
- if (!(node instanceof Element)) return Promise.resolve(node);
92392
-
92393
- return inlineBackground(node)
92394
- .then(function () {
92395
- if (node instanceof HTMLImageElement)
92396
- return newImage(node).inline();
92397
- else
92398
- return Promise.all(
92399
- util.asArray(node.childNodes).map(function (child) {
92400
- return inlineAll(child);
92401
- })
92402
- );
92403
- });
92404
-
92405
- function inlineBackground(node) {
92406
- var background = node.style.getPropertyValue('background');
92407
-
92408
- if (!background) return Promise.resolve(node);
92409
-
92410
- return inliner.inlineAll(background)
92411
- .then(function (inlined) {
92412
- node.style.setProperty(
92413
- 'background',
92414
- inlined,
92415
- node.style.getPropertyPriority('background')
92416
- );
92417
- })
92418
- .then(function () {
92419
- return node;
92420
- });
92421
- }
92422
- }
92423
- }
92424
- })();
92425
- } (domToImage));
92426
-
92427
- var domToImageExports = domToImage.exports;
92428
- var domtoimage = /*@__PURE__*/getDefaultExportFromCjs(domToImageExports);
92429
-
92430
91403
  function getTemplateHTML(data) {
92431
91404
  var _a, _b, _c;
92432
91405
  const isProfit = data.data.payout * +data.data.payoutTokenPrice - data.data.dollarValue > 0;