"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[65255,24377,31057,68149,91317],{150335:(t,i)=>{function s(t){return Math.round(1e10*t)/1e10}Object.defineProperty(i,"__esModule",{value:!0}),i.alignTo=i.fixComputationError=i.isNaN=i.isInteger=i.isNumber=void 0,i.isNumber=function(t){return"number"==typeof t&&isFinite(t)},i.isInteger=function(t){return"number"==typeof t&&t%1==0},i.isNaN=function(t){return!(t<=0||t>0)},i.fixComputationError=s,i.alignTo=function(t,i){var e=t/i,n=Math.floor(e),h=e-n;return h>2e-10?s(h>.5?(n+1)*i:n*i):t}},130551:(t,i)=>{i.hasProperty=i.isObject=void 0,i.isObject=function(t){var i=typeof t;return null!==t&&("object"===i||"function"===i)},i.hasProperty=function(t,i){return i in t}},724377:(t,i,s)=>{var e=s(150335);function n(t,i,s){return e.isNaN(i)||is?s:Math.round(i)}function h(t,i,s){return e.isNaN(i)||is?s:Math.round(1e4*i)/1e4}function r(t){return n(0,t,255)}function o(t){return n(0,t,255)}function l(t){return n(0,t,255)}function a(t){return h(0,t,1)}function c(t){return h(0,t,1)}function u(t){return h(0,t,1)}function f(t){return h(0,t,1)}function d(t){return h(0,t,1)}function m(t){return h(0,t,1)}function p(t){var i=t[0]/255,s=t[1]/255,e=t[2]/255,n=Math.min(i,s,e),h=Math.max(i,s,e),r=0,o=0,l=(n+h)/2;if(n===h)r=0,o=0;else{var a=h-n;switch(o=l>.5?a/(2-h-n):a/(h+n),h){case i:r=((s-e)/a+(s1&&(s-=1),s<1/6?t+6*(i-t)*s:s<.5?i:s<2/3?t+(i-t)*(2/3-s)*6:t}function b(t){var i,s,e,n=t[0],h=t[1],a=t[2];if(0===h)i=s=e=a;else{var c=a<.5?a*(1+h):a+h-a*h,u=2*a-c;i=v(u,c,n+1/3),s=v(u,c,n),e=v(u,c,n-1/3)}return[r(255*i),o(255*s),l(255*e)]}i.normalizeAlphaComponent=a,i.rgba=function(t,i,s,e){if(Array.isArray(t)){var n=t;return e=i,[n[0],n[1],n[2],a(e)]}var h=i;return s=s||0,e=e||0,[r(t),o(h),l(s),a(e)]};var g=[.199,.687,.114];function w(t){return g[0]*t[0]+g[1]*t[1]+g[2]*t[2]}function S(t,i,s){void 0===s&&(s=.05);var e=p(t),n=e[0]+i*s;return e[0]=c(n-Math.floor(n)),b(e)}function M(t,i,s){void 0===s&&(s=.05);var e=t[0],n=t[1],h=t[2],r=t[3],o=S([e,n,h],i,s);return[o[0],o[1],o[2],r]}var y,z,C,_,x={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",feldspar:"#d19275", firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslateblue:"#8470ff",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",violetred:"#d02090",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function k(t,i){return i in t}function L(t){var i=y.re.exec(t);return null!==i?y.parse(i):null}function O(t){var i=z.re.exec(t);return null!==i?z.parse(i):null}function E(t){var i=C.re.exec(t);return null!==i?C.parse(i):null}function T(t){var i=_.re.exec(t);return null!==i?_.parse(i):null}function W(t){return"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function P(t){if(t=t.toLowerCase(),k(x,t)){var i=O(x[t]);if(null!==i)return i;throw new Error("Invalid named color definition")}var s=L(t);if(null!==s)return s;var e=O(t);if(null!==e)return e;var n=E(t);if(null!==n)return n;var h=T(t);return null!==h?[h[0],h[1],h[2]]:null}function N(t){if(t=t.toLowerCase(),k(x,t)){var i=O(x[t]);if(null!==i)return[i[0],i[1],i[2],1];throw new Error("Invalid named color definition")}var s=L(t);if(null!==s)return[s[0],s[1],s[2],1];var e=O(t);if(null!==e)return[e[0],e[1],e[2],1];var n=E(t);if(null!==n)return[n[0],n[1],n[2],1];var h=T(t);return null!==h?h:null}function $(t){var i=N(t);if(null!==i)return i ;throw new Error("Passed color string does not match any of the known color representations")}!function(t){t.re=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,t.parse=function(t){return[r(parseInt(t[1],10)),o(parseInt(t[2],10)),l(parseInt(t[3],10))]}}(y||(y={})),function(t){t.re=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,t.parse=function(t){return[r(parseInt(t[1],16)),o(parseInt(t[2],16)),l(parseInt(t[3],16))]}}(z||(z={})),function(t){t.re=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/,t.parse=function(t){return[r(parseInt(t[1]+t[1],16)),o(parseInt(t[2]+t[2],16)),l(parseInt(t[3]+t[3],16))]}}(C||(C={})),function(t){t.re=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?[\d]{0,10}(?:\.\d+)?)\s*\)$/,t.parse=function(t){return[r(parseInt(t[1],10)),o(parseInt(t[2],10)),l(parseInt(t[3],10)),a(parseFloat(t[4]))]}}(_||(_={})),i.rgbaToString=W,i.tryParseRgb=P,i.parseRgb=function(t){var i=P(t);if(null!==i)return i;throw new Error("Passed color string does not match any of the known color representations")},i.tryParseRgba=N,i.parseRgba=$},39654:(t,i,s)=>{s.d(i,{getIsoLanguageCodeFromLanguage:()=>n});const e={ar_AE:"ar",br:"pt",de_DE:"de",ca_ES:"ca",he_IL:"he",id_ID:"id",in:"en",kr:"ko",ms_MY:"ms",sv_SE:"sv",th_TH:"th",uk:"en",vi_VN:"vi",zh_CN:"zh-Hans",zh_TW:"zh-Hant",zh:"zh-Hans",hu_HU:"hu-HU"};function n(t){return e[t]||t}},871934:(t,i,s)=>{s.d(i,{bindCanvasElementBitmapSizeTo:()=>r,equalSizes:()=>e.equalSizes,size:()=>e.size,tryCreateCanvasRenderingTarget2D:()=>a});var e=s(341161),n=s(340159),h=function(){function t(t,i,s){var n;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=t,this._canvasElementClientSize=(0,e.size)({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=null!=i?i:function(t){return t},this._allowResizeObserver=null===(n=null==s?void 0:s.allowResizeObserver)||void 0===n||n,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var t,i;if(null===this._canvasElement)throw new Error("Object is disposed");null===(t=this._canvasElementResizeObserver)||void 0===t||t.disconnect(),this._canvasElementResizeObserver=null,null===(i=this._devicePixelRatioObservable)||void 0===i||i.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(null===this._canvasElement)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return(0,e.size)({width:this.canvasElement.width,height:this.canvasElement.height}) },enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(t){this._canvasElementClientSize=(0,e.size)(t),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter((function(i){return i!==t}))},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter((function(i){return i!==t}))},t.prototype.applySuggestedBitmapSize=function(){if(null!==this._suggestedBitmapSize){var t=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(t),this._emitSuggestedBitmapSizeChanged(t,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(t){var i=this.bitmapSize;(0,e.equalSizes)(i,t)||(this.canvasElement.width=t.width,this.canvasElement.height=t.height,this._emitBitmapSizeChanged(i,t))},t.prototype._emitBitmapSizeChanged=function(t,i){var s=this;this._bitmapSizeChangedListeners.forEach((function(e){return e.call(s,t,i)}))},t.prototype._suggestNewBitmapSize=function(t){var i=this._suggestedBitmapSize,s=(0,e.size)(this._transformBitmapSize(t,this._canvasElementClientSize)),n=(0,e.equalSizes)(this.bitmapSize,s)?null:s;null===i&&null===n||null!==i&&null!==n&&(0,e.equalSizes)(i,n)||(this._suggestedBitmapSize=n,this._emitSuggestedBitmapSizeChanged(i,n))},t.prototype._emitSuggestedBitmapSizeChanged=function(t,i){var s=this;this._suggestedBitmapSizeChangedListeners.forEach((function(e){return e.call(s,t,i)}))},t.prototype._chooseAndInitObserver=function(){var t=this;this._allowResizeObserver?new Promise((function(t){var i=new ResizeObserver((function(s){t(s.every((function(t){return"devicePixelContentBoxSize"in t}))),i.disconnect()}));i.observe(document.body,{box:"device-pixel-content-box"})})).catch((function(){return!1})).then((function(i){return i?t._initResizeObserver():t._initDevicePixelRatioObservable()})):this._initDevicePixelRatioObservable()},t.prototype._initDevicePixelRatioObservable=function(){var t=this;if(null!==this._canvasElement){var i=o(this._canvasElement);if(null===i)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=(0,n.createObservable)(i),this._devicePixelRatioObservable.subscribe((function(){return t._invalidateBitmapSize()})),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){var t,i;if(null!==this._canvasElement){var s=o(this._canvasElement);if(null!==s){ var n=null!==(i=null===(t=this._devicePixelRatioObservable)||void 0===t?void 0:t.value)&&void 0!==i?i:s.devicePixelRatio,h=this._canvasElement.getClientRects(),r=void 0!==h[0]?function(t,i){return(0,e.size)({width:Math.round(t.left*i+t.width*i)-Math.round(t.left*i),height:Math.round(t.top*i+t.height*i)-Math.round(t.top*i)})}(h[0],n):(0,e.size)({width:this._canvasElementClientSize.width*n,height:this._canvasElementClientSize.height*n});this._suggestNewBitmapSize(r)}}},t.prototype._initResizeObserver=function(){var t=this;null!==this._canvasElement&&(this._canvasElementResizeObserver=new ResizeObserver((function(i){var s=i.find((function(i){return i.target===t._canvasElement}));if(s&&s.devicePixelContentBoxSize&&s.devicePixelContentBoxSize[0]){var n=s.devicePixelContentBoxSize[0],h=(0,e.size)({width:n.inlineSize,height:n.blockSize});t._suggestNewBitmapSize(h)}})),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function r(t,i){if("device-pixel-content-box"===i.type)return new h(t,i.transform,i.options);throw new Error("Unsupported binding target")}function o(t){return t.ownerDocument.defaultView}var l=function(){function t(t,i,s){if(0===i.width||0===i.height)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=i,0===s.width||0===s.height)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=s,this._context=t}return t.prototype.useMediaCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),t({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),t({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t}();function a(t,i){var s=t.canvasElementClientSize;if(0===s.width||0===s.height)return null;var e=t.bitmapSize;if(0===e.width||0===e.height)return null;var n=t.canvasElement.getContext("2d",i);return null===n?null:new l(n,s,e)}},431057:(t,i,s)=>{s.d(i,{ColorType:()=>Es,CrosshairMode:()=>lt,LineStyle:()=>d,PriceScaleMode:()=>fs,TickMarkType:()=>Ts,createChartEx:()=>Sn,defaultHorzScaleBehavior:()=>Mn});var e=s(871934);const n={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375", wickUpColor:"#26a69a",wickDownColor:"#ef5350"},h={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},r={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},o={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},l={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},a={color:"#26a69a",base:0},c={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 f,d,m;function p(t,i){const s={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(s)}function v(t,i,s,e){t.beginPath();const n=t.lineWidth%2?.5:0;t.moveTo(s,i+n),t.lineTo(e,i+n),t.stroke()}function b(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function g(t){if(void 0===t)throw new Error("Value is undefined");return t}function w(t){if(null===t)throw new Error("Value is null");return t}function S(t){return w(g(t))}(m=f||(f={}))[m.Simple=0]="Simple",m[m.WithSteps=1]="WithSteps",m[m.Curved=2]="Curved",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 M={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 y(t){return t<0?0:t>255?255:Math.round(t)||0}function z(t){return t<=0||t>1?Math.min(Math.max(t,0),1):Math.round(1e4*t)/1e4}const C=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,_=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,x=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,k=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function L(t){(t=t.toLowerCase())in M&&(t=M[t]);{const i=k.exec(t)||x.exec(t);if(i)return[y(parseInt(i[1],10)),y(parseInt(i[2],10)),y(parseInt(i[3],10)),z(i.length<5?1:parseFloat(i[4]))]}{const i=_.exec(t);if(i)return[y(parseInt(i[1],16)),y(parseInt(i[2],16)),y(parseInt(i[3],16)),1]}{const i=C.exec(t);if(i)return[y(17*parseInt(i[1],16)),y(17*parseInt(i[2],16)),y(17*parseInt(i[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function O(t){const i=L(t);return{t:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,i:(s=i, .199*s[0]+.687*s[1]+.114*s[2]>160?"black":"white")};var s}class E{constructor(){this.h=[]}l(t,i,s){const e={o:t,_:i,u:!0===s};this.h.push(e)}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,s){const e=[...this.h];this.h=this.h.filter((t=>!t.u)),e.forEach((e=>e.o(t,i,s)))}M(){return this.h.length>0}S(){this.h=[]}}function T(t,...i){for(const s of i)for(const i in s)void 0!==s[i]&&("object"!=typeof s[i]||void 0===t[i]||Array.isArray(s[i])?t[i]=s[i]:T(t[i],s[i]));return t}function W(t){return"number"==typeof t&&isFinite(t)}function P(t){return"number"==typeof t&&t%1==0}function N(t){return"string"==typeof t}function $(t){return"boolean"==typeof t}function R(t){const i=t;if(!i||"object"!=typeof i)return i;let s,e,n;for(e in s=Array.isArray(i)?[]:{},i)i.hasOwnProperty(e)&&(n=i[e],s[e]=n&&"object"==typeof n?R(n):n);return s}function D(t){return null!==t}function B(t){return null===t?void 0:t}const F="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function I(t,i,s){return void 0===i&&(i=F),`${s=void 0!==s?`${s} `:""}${t}px ${i}`}class V{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(),s=this.H();return t.P===i&&t.D===s||(t.P=i,t.D=s,t.R=I(i,s),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 A{constructor(){this.Y=[]}X(t){this.Y=t}K(t,i,s){this.Y.forEach((e=>{e.K(t,i,s)}))}}class j{K(t,i,s){t.useBitmapCoordinateSpace((t=>this.Z(t,i,s)))}}class U extends j{constructor(){super(...arguments),this.G=null}J(t){this.G=t}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this.G||null===this.G.tt)return;const e=this.G.tt,n=this.G,h=Math.max(1,Math.floor(i))%2/2,r=r=>{t.beginPath();for(let o=e.to-1;o>=e.from;--o){const e=n.it[o],l=Math.round(e.nt*i)+h,a=e.st*s,c=r*s+h;t.moveTo(l,a),t.arc(l,a,c,0,2*Math.PI)}t.fill()};n.et>0&&(t.fillStyle=n.rt,r(n.ht+n.et)),t.fillStyle=n.lt,r(n.ht)}}function J(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const H={from:0,to:1};class Z{constructor(t,i){this.ut=new A,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(J),this.ct=this.dt.map((t=>{const i=new U;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(),s=this.vt.xt(),e=this.F.St();i.forEach(((i,n)=>{var h;const r=this.dt[n],o=i.kt(s);if(t||null===o||!i.yt())return void(r.tt=null);const l=w(i.Ct());r.lt=o.Tt,r.ht=o.ht,r.et=o.Pt,r.it[0]._t=o._t,r.it[0].st=i.Dt().Rt(o._t,l.Ot),r.rt=null!==(h=o.At)&&void 0!==h?h:this.F.Bt(r.it[0].st/i.Dt().Vt()),r.it[0].ot=s,r.it[0].nt=e.It(s),r.tt=H}))}}class K extends j{constructor(t){super(),this.zt=t} Z({context:t,bitmapSize:i,horizontalPixelRatio:s,verticalPixelRatio:e}){if(null===this.zt)return;const n=this.zt.Lt.yt,h=this.zt.Et.yt;if(!n&&!h)return;const r=Math.round(this.zt.nt*s),o=Math.round(this.zt.st*e);t.lineCap="butt",n&&r>=0&&(t.lineWidth=Math.floor(this.zt.Lt.et*s),t.strokeStyle=this.zt.Lt.O,t.fillStyle=this.zt.Lt.O,p(t,this.zt.Lt.Nt),function(t,i,s,e){t.beginPath();const n=t.lineWidth%2?.5:0;t.moveTo(i+n,0),t.lineTo(i+n,e),t.stroke()}(t,r,0,i.height)),h&&o>=0&&(t.lineWidth=Math.floor(this.zt.Et.et*e),t.strokeStyle=this.zt.Et.O,t.fillStyle=this.zt.Et.O,p(t,this.zt.Et.Nt),v(t,o,0,i.width))}}class G{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 K(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=w(this.jt.Ht()),s=i.$t().W().crosshair,e=this.Ft;if(2===s.mode)return e.Et.yt=!1,void(e.Lt.yt=!1);e.Et.yt=t&&this.jt.Ut(i),e.Lt.yt=t&&this.jt.qt(),e.Et.et=s.horzLine.width,e.Et.Nt=s.horzLine.style,e.Et.O=s.horzLine.color,e.Lt.et=s.vertLine.width,e.Lt.Nt=s.vertLine.style,e.Lt.O=s.vertLine.color,e.nt=this.jt.Yt(),e.st=this.jt.Xt()}}function X(t,i,s,e,n,h){t.fillRect(i+h,s,e-2*h,h),t.fillRect(i+h,s+n-h,e-2*h,h),t.fillRect(i,s,h,n),t.fillRect(i+e-h,s,h,n)}function Y(t,i,s,e,n,h){t.save(),t.globalCompositeOperation="copy",t.fillStyle=h,t.fillRect(i,s,e,n),t.restore()}function q(t,i,s,e,n,h){t.beginPath(),t.roundRect?t.roundRect(i,s,e,n,h):(t.lineTo(i+e-h[1],s),0!==h[1]&&t.arcTo(i+e,s,i+e,s+h[1],h[1]),t.lineTo(i+e,s+n-h[2]),0!==h[2]&&t.arcTo(i+e,s+n,i+e-h[2],s+n,h[2]),t.lineTo(i+h[3],s+n),0!==h[3]&&t.arcTo(i,s+n,i,s+n-h[3],h[3]),t.lineTo(i,s+h[0]),0!==h[0]&&t.arcTo(i,s,i+h[0],s,h[0]))}function Q(t,i,s,e,n,h,r=0,o=[0,0,0,0],l=""){if(t.save(),!r||!l||l===h)return q(t,i,s,e,n,o),t.fillStyle=h,t.fill(),void t.restore();const a=r/2;var c;q(t,i+a,s+a,e-r,n-r,(c=-a,o.map((t=>0===t?t:t+c)))),"transparent"!==h&&(t.fillStyle=h,t.fill()),"transparent"!==l&&(t.lineWidth=r,t.strokeStyle=l,t.closePath(),t.stroke()),t.restore()}function tt(t,i,s,e,n,h,r){t.save(),t.globalCompositeOperation="copy";const o=t.createLinearGradient(0,0,0,n);o.addColorStop(0,h),o.addColorStop(1,r),t.fillStyle=o,t.fillRect(i,s,e,n),t.restore()}class it{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,s,e){if(!this.zt.yt||0===this.zt.Zt.length)return;const n=this.zt.O,h=this.Kt.t,r=t.useBitmapCoordinateSpace((t=>{const r=t.context;r.font=i.R;const o=this.Gt(t,i,s,e),l=o.Jt,a=(t,i)=>{o.Qt?Q(r,l.ti,l.ii,l.ni,l.si,t,l.ei,[l.ht,0,0,l.ht],i):Q(r,l.ri,l.ii,l.ni,l.si,t,l.ei,[0,l.ht,l.ht,0],i)};return a(h,"transparent"),this.zt.hi&&(r.fillStyle=n,r.fillRect(l.ri,l.li,l.ai-l.ri,l.oi)),a("transparent",h),this.zt._i&&(r.fillStyle=i.A,r.fillRect(o.Qt?l.ui-l.ei:0,l.ii,l.ei,l.ci-l.ii)),o}));t.useMediaCoordinateSpace((({context:t})=>{const s=r.di;t.font=i.R,t.textAlign=r.Qt?"right":"left",t.textBaseline="middle",t.fillStyle=n,t.fillText(this.zt.Zt,s.fi,(s.ii+s.ci)/2+s.pi)}))}Gt(t,i,s,e){var n ;const{context:h,bitmapSize:r,mediaSize:o,horizontalPixelRatio:l,verticalPixelRatio:a}=t,c=this.zt.hi||!this.zt.mi?i.T:0,u=this.zt.bi?i.C:0,f=i.L+this.Kt.wi,d=i.B+this.Kt.gi,m=i.V,p=i.I,v=this.zt.Zt,b=i.P,g=s.Mi(h,v),w=Math.ceil(s.xi(h,v)),S=b+f+d,M=i.C+m+p+w+c,y=Math.max(1,Math.floor(a));let z=Math.round(S*a);z%2!=y%2&&(z+=1);const C=u>0?Math.max(1,Math.floor(u*l)):0,_=Math.round(M*l),x=Math.round(c*l),k=null!==(n=this.Kt.Si)&&void 0!==n?n:this.Kt.ki,L=Math.round(k*a)-Math.floor(.5*a),O=Math.floor(L+y/2-z/2),E=O+z,T="right"===e,W=T?o.width-u:u,P=T?r.width-C:C;let N,$,R;return T?(N=P-_,$=P-x,R=W-c-m-u):(N=P+_,$=P+x,R=W+c+m),{Qt:T,Jt:{ii:O,li:L,ci:E,ni:_,si:z,ht:2*l,ei:C,ti:N,ri:P,ai:$,oi:y,ui:r.width},di:{ii:O/a,ci:E/a,fi:R,pi:g}}}}class st{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||it)(this.Ci,this.yi),this.Ri=new(t||it)(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 et extends st{constructor(t,i,s){super(),this.jt=t,this.Li=i,this.Ei=s}zi(t,i,s){if(t.yt=!1,2===this.jt.W().mode)return;const e=this.jt.W().horzLine;if(!e.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||null===n)return;const h=O(e.labelBackgroundColor);s.t=h.t,t.O=h.i;const r=2/12*this.Li.P();s.wi=r,s.gi=r;const o=this.Ei(this.Li);s.ki=o.ki,t.Zt=this.Li.Fi(o._t,n),t.yt=!0}}const nt=/[1-9]/g;class ht{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 s=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.R,Math.round(i.Wi.xi(t,w(this.zt).Zt,nt)))));if(s<=0)return;const e=i.ji,n=s+2*e,h=n/2,r=this.zt.Hi;let o=this.zt.ki,l=Math.floor(o-h)+.5;l<0?(o+=Math.abs(0-l),l=Math.floor(o-h)+.5):l+n>r&&(o-=Math.abs(r-(l+n)),l=Math.floor(o-h)+.5);const a=l+n,c=Math.ceil(0+i.C+i.T+i.L+i.P+i.B);t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:s,verticalPixelRatio:e})=>{const n=w(this.zt);t.fillStyle=n.t;const h=Math.round(l*s),r=Math.round(0*e),o=Math.round(a*s),u=Math.round(c*e),f=Math.round(2*s);if(t.beginPath(),t.moveTo(h,r),t.lineTo(h,u-f),t.arcTo(h,u,h+f,u,f),t.lineTo(o-f,u),t.arcTo(o,u,o,u-f,f),t.lineTo(o,r),t.fill(),n.hi){const h=Math.round(n.ki*s),o=r,l=Math.round((o+i.T)*e);t.fillStyle=n.O;const a=Math.max(1,Math.floor(s)),c=Math.floor(.5*s);t.fillRect(h-c,o,a,l-o)}})),t.useMediaCoordinateSpace((({context:t})=>{ const s=w(this.zt),n=0+i.C+i.T+i.L+i.P/2;t.font=i.R,t.textAlign="left",t.textBaseline="middle",t.fillStyle=s.O;const h=i.Wi.Mi(t,"Apr0");t.translate(l+e,n+h),t.fillText(s.Zt,0,0)}))}}class rt{constructor(t,i,s){this.ft=!0,this.Wt=new ht,this.Ft={yt:!1,t:"#4c525e",O:"white",Zt:"",Hi:0,ki:NaN,hi:!0},this.vt=t,this.$i=i,this.Ei=s}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 s=this.$i.St();if(s.Ni())return;t.Hi=s.Hi();const e=this.Ei();if(null===e)return;t.ki=e.ki;const n=s.Ui(this.vt.xt());t.Zt=s.qi(w(n)),t.yt=!0;const h=O(i.labelBackgroundColor);t.t=h.t,t.O=h.i,t.hi=s.W().ticksVisible}}class ot{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 ot{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 Z(t,this),this.fn=((t,i)=>s=>{const e=i(),n=t();if(s===w(this.tn).vn())return{_t:n,ki:e};{const t=w(s.Ct());return{_t:s.pn(e,t),ki:e}}})((()=>this.nn),(()=>this.an));const s=((t,i)=>()=>{const s=this.$i.St().mn(t()),e=i();return s&&Number.isFinite(e)?{ot:s,ki:e}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new rt(this,t,s),this.wn=new G(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,s){this.hn||(this.hn=!0),this.en=!0,this.yn(t,i,s)}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 s=[];return this.tn===t&&s.push(this.Dn(this.rn,i,this.fn)),s}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,s){this.Bn(t,i,s)&&this.On()}Bn(t,i,s){const e=this.ln,n=this.an,h=this.nn,r=this.sn,o=this.tn,l=this.An(s);this.sn=t,this.ln=isNaN(t)?NaN:this.$i.St().It(t),this.tn=s;const a=null!==l?l.Ct():null;return null!==l&&null!==a?(this.nn=i,this.an=l.Rt(i,a)):(this.nn=NaN,this.an=NaN),e!==this.ln||n!==this.an||r!==this.sn||h!==this.nn||o!==this.tn}Tn(){const t=this.$i.wt().map((t=>t.In().Vn())).filter(D),i=0===t.length?null:Math.max(...t);this.sn=null!==i?i:NaN}Dn(t,i,s){let e=t.get(i);return void 0===e&&(e=new et(this,i,s),t.set(i,e)),e}}function ct(t){return"left"===t||"right"===t}class ut{constructor(t){this.zn=new Map,this.Ln=[],this.En=t}Nn(t,i){const s=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,s)}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 ut(2)}static es(){return new ut(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)}}function ft(t,i){if(!W(t))return"n/a";if(!P(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");return 0===i?t.toString():("0000000000000000"+t.toString()).slice(-i)}class dt{constructor(t,i){if(i||(i=1),W(t)&&P(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 s=Math.floor(t),e="";const n=void 0!==this.os?this.os:NaN;if(i>1){let h=+(Math.round(t*i)-s*i).toFixed(this.os);h>=i&&(h-=i,s+=1),e="."+ft(+h.toFixed(this.os)*this.rs,n)}else s=Math.round(s*i)/i,n>0&&(e="."+ft(0,n));return s.toFixed(0)+e}}class mt extends dt{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class pt{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 s=Math.pow(10,this._s);return i=(t=Math.round(t*s)/s)>=1e-15&&t<1?t.toFixed(this._s).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}function vt(t,i,s,e,n,h,r){if(0===i.length||e.from>=i.length||e.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:a}=t,c=i[e.from];let u=h(t,c),f=c;if(e.to-e.from<2){const i=n/2;o.beginPath();const s={nt:c.nt-i,st:c.st},e={nt:c.nt+i,st:c.st};o.moveTo(s.nt*l,s.st*a),o.lineTo(e.nt*l,e.st*a),r(t,u,s,e)}else{const n=(i,s)=>{r(t,u,f,s),o.beginPath(),u=i,f=s};let d=f;o.beginPath(),o.moveTo(c.nt*l,c.st*a);for(let r=e.from+1;r=e.from;--s){const e=i[s];if(e){const i=n(t,e);i!==l&&(o.beginPath(),null!==l&&o.fill(),o.fillStyle=i,l=i);const s=Math.round(e.nt*h)+a,u=e.st*r;o.moveTo(s,u),o.arc(s,u,c,0,2*Math.PI)}}o.fill()}(t,i,o,s,a)}}class Ot extends Lt{Ds(t,i){return i.lt}}function Et(t,i,s,e,n=0,h=i.length){let r=h-n;for(;0>1,o=n+h;e(i[o],s)===t?(n=o+1,r-=h+1):r=h}return n}const Tt=Et.bind(null,!0),Wt=Et.bind(null,!1);function Pt(t,i){return t.ot0&&h=e&&(o=h-1),r>0&&rObject.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 s=i.Xs();if(null===s)return;if(0===this.Ls.In().Ks())return;const e=this.Ls.Ct();null!==e&&(this.zs=$t(this.Is,s,this.Ns),this.Zs(t,i,e.Ot),this.Gs())}}class Dt extends Rt{constructor(t,i){super(t,i,!0)}Zs(t,i,s){i.Js(this.Is,B(this.zs)),t.Qs(this.Is,s,B(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 s=i.Ot[3];return this.ne(i.se,s,t)}))}}class Bt extends Dt{constructor(t,i){super(t,i),this.Ws=new A,this.ee=new xt,this.re=new Ot,this.Ws.X([this.ee,this.re])}ne(t,i,s){return Object.assign(Object.assign({},this.te(t,i)),s.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:s}){if(null===this.zt||0===this.zt.In.length||null===this.zt.tt)return;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 e=null;const n=this.ae<=this.le&&this.zt.he>=Math.floor(1.5*i);for(let h=this.zt.tt.from;hm+v-1&&(n=m+v-1,e=n-c+1),t.fillRect(i,e,a-i,n-e+1)}const i=l+b;let e=Math.max(m,Math.round(r.pe*s)-o),n=e+c-1;n>m+v-1&&(n=m+v-1,e=n-c+1),t.fillRect(u+1,e,i-u,n-e+1)}}}oe(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(w(this.zt).he,t)))}}class It extends Rt{constructor(t,i){super(t,i,!1)}Zs(t,i,s){i.Js(this.Is,B(this.zs)),t.me(this.Is,s,B(this.zs))}be(t,i,s){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 Vt extends It{constructor(){super(...arguments),this.Ws=new Ft}ne(t,i,s){return Object.assign(Object.assign({},this.be(t,i,s)),s.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 At extends Mt{constructor(){super(...arguments),this.Cs=new _t}ps(t,i){const s=this.G;return this.Cs.bs(t,{gs:i.Se,Ms:i.ke,xs:i.ye,Ss:i.Ce,ks:t.bitmapSize.height,fs:s.fs})}}class jt extends Lt{constructor(){super(...arguments),this.Te=new _t}Ds(t,i){const s=this.G;return this.Te.bs(t,{gs:i.Pe,Ms:i.Pe,xs:i.Re,Ss:i.Re,ks:t.bitmapSize.height, fs:s.fs})}}class Ut extends Dt{constructor(t,i){super(t,i),this.Ws=new A,this.De=new At,this.Oe=new jt,this.Ws.X([this.De,this.Oe])}ne(t,i,s){return Object.assign(Object.assign({},this.te(t,i)),s.Hs(t))}Gs(){const t=this.Ls.Ct();if(null===t)return;const i=this.Ls.W(),s=this.Ls.Dt().Rt(i.baseValue.price,t.Ot),e=this.Es.St().he();this.De.J({it:this.Is,et:i.lineWidth,Nt:i.lineStyle,ds:i.lineType,fs:s,vs:!1,tt:this.zs,cs:e}),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:s,tt:this.zs,cs:e})}}class Jt 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;this.le=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);const s=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),e=Math.floor(t*s*i),n=Math.floor(t*i),h=Math.min(e,n);return Math.max(Math.floor(i),h)}(this.zt.he,i),this.le>=2&&Math.floor(i)%2!=this.le%2&&this.le--;const s=this.zt.In;this.zt.Ae&&this.Be(t,s,this.zt.tt),this.zt._i&&this.Ve(t,s,this.zt.tt);const e=this.Ie(i);(!this.zt._i||this.le>2*e)&&this.ze(t,s,this.zt.tt)}Be(t,i,s){if(null===this.zt)return;const{context:e,horizontalPixelRatio:n,verticalPixelRatio:h}=t;let r="",o=Math.min(Math.floor(n),Math.floor(this.zt.he*n));o=Math.max(Math.floor(n),Math.min(o,this.le));const l=Math.floor(.5*o);let a=null;for(let t=s.from;t2*o)X(e,a,u,c-a+1,f-u+1,o);else{const t=c-a+1;e.fillRect(a,u,t,f-u+1)}l=c}}ze(t,i,s){if(null===this.zt)return;const{context:e,horizontalPixelRatio:n,verticalPixelRatio:h}=t;let r="";const o=this.Ie(n);for(let t=s.from;ta||e.fillRect(c,l,u-c+1,a-l+1)}}}class Ht extends It{constructor(){super(...arguments),this.Ws=new Jt}ne(t,i,s){return Object.assign(Object.assign({},this.be(t,i,s)),s.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 Zt{constructor(t,i){this.Ne=t,this.Li=i}K(t,i,s){this.Ne.draw(t,this.Li,i,s)}}class Kt extends Rt{constructor(t,i,s){super(t,i,!1),this.wn=s,this.Ws=new Zt(this.wn.renderer(),(i=>{const s=t.Ct();return null===s?null:t.Dt().Rt(i,s.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,B(this.zs))}Gs(){this.wn.update({bars:this.Is.map(Gt),barSpacing:this.Es.St().he(),visibleRange:this.zs},this.Ls.W())}}function Gt(t){return{x:t.nt,time:t.ot,originalData:t.je,barColor:t.ue}}class Xt extends j{constructor(){super(...arguments),this.zt=null,this.$e=[]}J(t){this.zt=t,this.$e=[]}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this.zt||0===this.zt.it.length||null===this.zt.tt)return;this.$e.length||this.Ue(i);const e=Math.max(1,Math.floor(s)),n=Math.round(this.zt.qe*s)-Math.floor(e/2),h=n+e;for(let i=this.zt.tt.from;ie.Xe?e.ui=s.Os-i-1:s.Os=e.ui+i+1)}let e=Math.ceil(this.zt.he*t);for(let t=this.zt.tt.from;t0&&e<4)for(let t=this.zt.tt.from;te&&(i.Ye>i.Xe?i.ui-=1:i.Os+=1)}}}class Yt extends Dt{constructor(){super(...arguments),this.Ws=new Xt}ne(t,i,s){return Object.assign(Object.assign({},this.te(t,i)),s.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,w(this.Ls.Ct()).Ot)};this.Ws.J(t)}}class qt extends Dt{constructor(){super(...arguments),this.Ws=new Ot}ne(t,i,s){return Object.assign(Object.assign({},this.te(t,i)),s.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 Qt=/[2-9]/g;class ti{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,s){return this.nr(t,i,s).width}Mi(t,i,s){const e=this.nr(t,i,s);return((e.actualBoundingBoxAscent||0)-(e.actualBoundingBoxDescent||0))/2}nr(t,i,s){const e=s||Qt,n=String(i).replace(e,"0");if(this.Qe.has(n))return g(this.Qe.get(n)).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 h=t.measureText(n);return t.restore(),0===h.width&&i.length||(this.Qe.set(n,{sr:h,er:this.Ze}),this.Je[this.Ze]=n,this.Ke++,this.Ze++),h}}class ii{constructor(t){this.rr=null,this.k=null,this.hr="right",this.lr=t}ar(t,i,s){this.rr=t,this.k=i,this.hr=s}K(t){null!==this.k&&null!==this.rr&&this.rr.K(t,this.k,this.lr,this.hr)}}class si{constructor(t,i,s){this._r=t,this.lr=new ti(50),this.ur=i,this.F=s,this.j=-1,this.Wt=new ii(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 s=t.pr(i);if("overlay"===s)return null;const e=this.F.mr();return e.P!==this.j&&(this.j=e.P,this.lr.ir()),this.Wt.ar(this._r.Ii(),e,s),this.Wt}}class ei extends j{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}br(t,i){var s;if(!(null===(s=this.zt)||void 0===s?void 0:s.yt))return null;const{st:e,et:n,wr:h}=this.zt;return i>=e-n-7&&i<=e+n+7?{gr:this.zt,wr:h}:null}Z({context:t,bitmapSize:i,horizontalPixelRatio:s,verticalPixelRatio:e}){if(null===this.zt)return;if(!1===this.zt.yt)return;const n=Math.round(this.zt.st*e);n<0||n>i.height||(t.lineCap="butt",t.strokeStyle=this.zt.O,t.lineWidth=Math.floor(this.zt.et*s),p(t,this.zt.Nt),v(t,n,0,i.width))}}class ni{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 ni{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 s=this.Ls.W();if(!s.baseLineVisible||!this.Ls.yt())return;const e=this.Ls.Ct();null!==e&&(this.Mr.yt=!0,this.Mr.st=t.Rt(e.Ot,e.Ot),this.Mr.O=s.baseLineColor,this.Mr.et=s.baseLineWidth,this.Mr.Nt=s.baseLineStyle)}}class ri extends j{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}He(){return this.zt}Z({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){const e=this.zt;if(null===e)return;const n=Math.max(1,Math.floor(i)),h=n%2/2,r=Math.round(e.Xe.x*i)+h,o=e.Xe.y*s;t.fillStyle=e.Cr,t.beginPath();const l=Math.max(2,1.5*e.Tr)*i;t.arc(r,o,l,0,2*Math.PI,!1),t.fill(),t.fillStyle=e.Pr,t.beginPath(),t.arc(r,o,e.ht*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=n,t.strokeStyle=e.Rr,t.beginPath(),t.arc(r,o,e.ht*i+n/2,0,2*Math.PI,!1),t.stroke()}}const oi=[{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 li(t,i,s,e){return function(t,i){if("transparent"===t)return t;const s=L(t),e=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${i*e})`}(t,s+(e-s)*i)}function ai(t,i){ const s=t%2600/2600;let e;for(const t of oi)if(s>=t.Dr&&s<=t.Or){e=t;break}b(void 0!==e,"Last price animation internal logic error");const n=(s-e.Dr)/(e.Or-e.Dr);return{Pr:li(i,n,e.Vr,e.Ir),Rr:li(i,n,e.zr,e.Lr),ht:(h=n,r=e.Ar,o=e.Br,r+(o-r)*h)};var h,r,o}class ci{constructor(t){this.Wt=new ri,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(),s=this.Wr.Ct();if(null===i||null===s)return;const e=this.Wr.Yr(!0);if(e.Xr||!i.Kr(e.se))return;const n={x:t.It(e.se),y:this.Wr.Dt().Rt(e._t,s.Ot)},h=e.O,r=this.Wr.W().lineWidth,o=ai(this.Zr(),h);this.Wt.J({Cr:h,Tr:r,Pr:o.Pr,Rr:o.Rr,ht:o.ht,Xe:n})}qr(){const t=this.Wt.He();if(null!==t){const i=ai(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 ui(t,i){return Ct(Math.min(Math.max(t,12),30)*i)}function fi(t,i){switch(t){case"arrowDown":case"arrowUp":return ui(i,1);case"circle":return ui(i,.8);case"square":return ui(i,.7)}}function di(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(ui(t,1))}function mi(t){return Math.max(ui(t,.1),3)}function pi(t,i,s){return i?t:s?Math.ceil(t/2):0}function vi(t,i,s,e,n){const h=fi("square",s),r=(h-1)/2,o=t-r,l=i-r;return e>=o&&e<=o+h&&n>=l&&n<=l+h}function bi(t,i,s,e){const n=(fi("arrowUp",e)-1)/2*s.Gr,h=(Ct(e/2)-1)/2*s.Gr;i.beginPath(),t?(i.moveTo(s.nt-n,s.st),i.lineTo(s.nt,s.st-n),i.lineTo(s.nt+n,s.st),i.lineTo(s.nt+h,s.st),i.lineTo(s.nt+h,s.st+n),i.lineTo(s.nt-h,s.st+n),i.lineTo(s.nt-h,s.st)):(i.moveTo(s.nt-n,s.st),i.lineTo(s.nt,s.st+n),i.lineTo(s.nt+n,s.st),i.lineTo(s.nt+h,s.st),i.lineTo(s.nt+h,s.st-n),i.lineTo(s.nt-h,s.st-n),i.lineTo(s.nt-h,s.st)),i.fill()}class gi extends j{constructor(){super(...arguments),this.zt=null,this.lr=new ti,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=I(t,i),this.lr.ir())}br(t,i){if(null===this.zt||null===this.zt.tt)return null;for(let s=this.zt.tt.from;s=t&&n<=t+s&&h>=i-r&&h<=i+r}(t.Zt.nt,t.Zt.st,t.Zt.Hi,t.Zt.Vt,i,s))||function(t,i,s){if(0===t.Ks)return!1;switch(t.ih){case"arrowDown":case"arrowUp":return function(t,i,s,e,n,h){return vi(i,s,e,n,h)}(0,t.nt,t.st,t.Ks,i,s);case"circle":return function(t,i,s,e,n){const h=2+fi("circle",s)/2,r=t-e,o=i-n;return Math.sqrt(r*r+o*o)<=h}(t.nt,t.st,t.Ks,i,s);case"square":return vi(t.nt,t.st,t.Ks,i,s)}}(t,i,s)}function Mi(t,i,s,e,n,h,r,o,l){const a=W(s)?s:s.xe,c=W(s)?s:s.ge,u=W(s)?s:s.Me,f=W(i.size)?Math.max(i.size,0):1,d=di(o.he())*f,m=d/2;switch(t.Ks=d,i.position){case"inBar":return t.st=r.Rt(a,l),void(void 0!==t.Zt&&(t.Zt.st=t.st+m+h+.6*n));case"aboveBar":return t.st=r.Rt(c,l)-m-e.nh,void 0!==t.Zt&&(t.Zt.st=t.st-m-.6*n,e.nh+=1.2*n),void(e.nh+=d+h);case"belowBar":return t.st=r.Rt(u,l)+m+e.sh,void 0!==t.Zt&&(t.Zt.st=t.st+m+h+.6*n,e.sh+=1.2*n),void(e.sh+=d+h)}i.position}class yi{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=mi(t),s=1.5*di(t)+2*i,e=this.dh();this.hh={above:pi(s,e.aboveBar,e.inBar),below:pi(s,e.belowBar,e.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(),s=this.Wr.uh();this.eh&&(this.zt.it=s.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 e=this.$i.W().layout;this.zt.tt=null;const n=i.Xs();if(null===n)return;const h=this.Wr.Ct();if(null===h)return;if(0===this.zt.it.length)return;let r=NaN;const o=mi(i.he()),l={nh:o,sh:o};this.zt.tt=$t(this.zt.it,n,!0);for(let n=this.zt.tt.from;n0&&(c.Zt={th:a.text,nt:0,st:0,Hi:0,Vt:0});const u=this.Wr.fh(a.time);null!==u&&Mi(c,a,u,l,e.fontSize,o,t,i,h.Ot)}this.ft=!1}}class zi extends ni{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 s=this.Ls.Yr(0===i.priceLineSource);s.Xr||(t.yt=!0,t.st=s.ki,t.O=this.Ls.ph(s.O),t.et=i.priceLineWidth,t.Nt=i.priceLineStyle)}}class Ci extends st{constructor(t){super(),this.jt=t}zi(t,i,s){t.yt=!1,i.yt=!1;const e=this.jt;if(!e.yt())return;const n=e.W(),h=n.lastValueVisible,r=""!==e.mh(),o=0===n.seriesLastValueMode,l=e.Yr(!1);if(l.Xr)return;h&&(t.Zt=this.bh(l,h,o),t.yt=0!==t.Zt.length),(r||o)&&(i.Zt=this.wh(l,h,r,o),i.yt=i.Zt.length>0);const a=e.ph(l.O),c=O(a);s.t=c.t,s.ki=l.ki,i.At=e.$t().Bt(l.ki/e.Dt().Vt()),t.At=a,t.O=c.i,i.O=c.i}wh(t,i,s,e){let n="";const h=this.jt.mh();return s&&0!==h.length&&(n+=`${h} `),i&&e&&(n+=this.jt.Dt().gh()?t.Mh:t.xh),n.trim()}bh(t,i,s){return i?s?this.jt.Dt().gh()?t.xh:t.Mh:t.Zt:""}}function _i(t,i,s,e){const n=Number.isFinite(i),h=Number.isFinite(s);return n&&h?t(i,s):n||h?n?i:s:e}class xi{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 xi(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 xi(_i(Math.min,this.Th(),t.Th(),-1/0),_i(Math.max,this.Ph(),t.Ph(),1/0))}Dh(t){if(!W(t))return;if(0==this.kh-this.Sh)return;const i=.5*(this.kh+this.Sh);let s=this.kh-i,e=this.Sh-i;s*=t,e*=t,this.kh=i+s,this.Sh=i+e}Oh(t){W(t)&&(this.kh+=t,this.Sh+=t)}Ah(){return{minValue:this.Sh,maxValue:this.kh}}static Bh(t){return null===t?null:new xi(t.minValue,t.maxValue)}}class ki{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 ki(xi.Bh(t.priceRange),t.margins)}}class Li extends ni{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 s=this.Eh.Nh();null!==s&&(t.yt=!0,t.st=s,t.O=i.color,t.et=i.lineWidth,t.Nt=i.lineStyle,t.wr=this.Eh.W().id)}}class Oi extends st{constructor(t,i){super(),this.Wr=t,this.Eh=i}zi(t,i,s){t.yt=!1,i.yt=!1;const e=this.Eh.W(),n=e.axisLabelVisible,h=""!==e.title,r=this.Wr;if(!n||!r.yt())return;const o=this.Eh.Nh();if(null===o)return;h&&(i.Zt=e.title,i.yt=!0),i.At=r.$t().Bt(o/r.Dt().Vt()),t.Zt=this.Fh(e.price),t.yt=!0;const l=O(e.axisLabelColor||e.color);s.t=l.t;const a=e.axisLabelTextColor||l.i;t.O=a,i.O=a,s.ki=o}Fh(t){const i=this.Wr.Ct();return null===i?"":this.Wr.Dt().Fi(t,i.Ot)}}class Ei{constructor(t,i){this.Wr=t,this.cn=i,this.Wh=new Li(t,this),this._r=new Oi(t,this),this.jh=new si(this._r,t,t.$t())}Hh(t){T(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 s=t.Ct();return null===s?null:i.Rt(this.cn.price,s.Ot)}}class Ti extends ot{constructor(t){super(),this.$i=t}$t(){return this.$i}}const Wi={Bar:(t,i,s,e)=>{var n ;const h=i.upColor,r=i.downColor,o=w(t(s,e)),l=S(o.Ot[0])<=S(o.Ot[3]);return{ue:null!==(n=o.O)&&void 0!==n?n:l?h:r}},Candlestick:(t,i,s,e)=>{var n,h,r;const o=i.upColor,l=i.downColor,a=i.borderUpColor,c=i.borderDownColor,u=i.wickUpColor,f=i.wickDownColor,d=w(t(s,e)),m=S(d.Ot[0])<=S(d.Ot[3]);return{ue:null!==(n=d.O)&&void 0!==n?n:m?o:l,Ee:null!==(h=d.At)&&void 0!==h?h:m?a:c,Le:null!==(r=d.Xh)&&void 0!==r?r:m?u:f}},Custom:(t,i,s,e)=>{var n;return{ue:null!==(n=w(t(s,e)).O)&&void 0!==n?n:i.color}},Area:(t,i,s,e)=>{var n,h,r,o;const l=w(t(s,e));return{ue:null!==(n=l.lt)&&void 0!==n?n:i.lineColor,lt:null!==(h=l.lt)&&void 0!==h?h:i.lineColor,Ts:null!==(r=l.Ts)&&void 0!==r?r:i.topColor,Ps:null!==(o=l.Ps)&&void 0!==o?o:i.bottomColor}},Baseline:(t,i,s,e)=>{var n,h,r,o,l,a;const c=w(t(s,e));return{ue:c.Ot[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,Pe:null!==(n=c.Pe)&&void 0!==n?n:i.topLineColor,Re:null!==(h=c.Re)&&void 0!==h?h:i.bottomLineColor,Se:null!==(r=c.Se)&&void 0!==r?r:i.topFillColor1,ke:null!==(o=c.ke)&&void 0!==o?o:i.topFillColor2,ye:null!==(l=c.ye)&&void 0!==l?l:i.bottomFillColor1,Ce:null!==(a=c.Ce)&&void 0!==a?a:i.bottomFillColor2}},Line:(t,i,s,e)=>{var n,h;const r=w(t(s,e));return{ue:null!==(n=r.O)&&void 0!==n?n:i.color,lt:null!==(h=r.O)&&void 0!==h?h:i.color}},Histogram:(t,i,s,e)=>{var n;return{ue:null!==(n=w(t(s,e)).O)&&void 0!==n?n:i.color}}};class Pi{constructor(t){this.Kh=(t,i)=>void 0!==i?i.Ot:this.Wr.In().Zh(t),this.Wr=t,this.Gh=Wi[t.Jh()]}Hs(t,i){return this.Gh(this.Kh,this.Wr.W(),t,i)}}var Ni;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"}(Ni||(Ni={}));const $i=30;class Ri{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 s=this.rl(t,i);return null===s?null:Object.assign(Object.assign({},this.ll(s)),{se:this.el(s)})}ie(){return this.Qh}al(t,i,s){if(this.Ni())return null;let e=null;for(const n of s)e=Di(e,this.ol(t,i,n));return e}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 s=this._l(t);if(null===s&&0!==i)switch(i){case-1:return this.ul(t);case 1:return this.cl(t);default:throw new TypeError("Unknown search mode")}return s}ul(t){let i=this.dl(t);return i>0&&(i-=1),i!==this.Qh.length&&this.el(i)t.set.se>i))}vl(t,i,s){let e=null;for(let n=t;ne.ml&&(e.ml=t)))}return e}ol(t,i,s){if(this.Ni())return null;let e=null ;const n=w(this.sl()),h=w(this.Vn()),r=Math.max(t,n),o=Math.min(i,h),l=Math.ceil(r/$i)*$i,a=Math.max(l,Math.floor(o/$i)*$i);{const t=this.dl(r),n=this.fl(Math.min(o,l,i));e=Di(e,this.vl(t,n,s))}let c=this.tl.get(s);void 0===c&&(c=new Map,this.tl.set(s,c));for(let t=Math.max(l+1,r);tnew Fi(t)));return this.yl={gl:n,Ml:h},h}Qi(){var t,i,s,e;const n=null!==(s=null===(i=(t=this.Dl).timeAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==s?s:[];if((null===(e=this.Cl)||void 0===e?void 0:e.gl)===n)return this.Cl.Ml;const h=this.Wr.$t().St(),r=n.map((t=>new Vi(t,h)));return this.Cl={gl:n,Ml:r},r}Rn(){var t,i,s,e;const n=null!==(s=null===(i=(t=this.Dl).priceAxisViews)||void 0===i?void 0:i.call(t))&&void 0!==s?s:[];if((null===(e=this.Tl)||void 0===e?void 0:e.gl)===n)return this.Tl.Ml;const h=this.Wr.Dt(),r=n.map((t=>new Ai(t,h)));return this.Tl={gl:n,Ml:r},r}Al(){var t,i,s,e;const n=null!==(s=null===(i=(t=this.Dl).priceAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==s?s:[];if((null===(e=this.Pl)||void 0===e?void 0:e.gl)===n)return this.Pl.Ml;const h=n.map((t=>new Fi(t)));return this.Pl={gl:n,Ml:h},h}Bl(){var t,i,s,e ;const n=null!==(s=null===(i=(t=this.Dl).timeAxisPaneViews)||void 0===i?void 0:i.call(t))&&void 0!==s?s:[];if((null===(e=this.Rl)||void 0===e?void 0:e.gl)===n)return this.Rl.Ml;const h=n.map((t=>new Fi(t)));return this.Rl={gl:n,Ml:h},h}Vl(t,i){var s,e,n;return null!==(n=null===(e=(s=this.Dl).autoscaleInfo)||void 0===e?void 0:e.call(s,t,i))&&void 0!==n?n:null}br(t,i){var s,e,n;return null!==(n=null===(e=(s=this.Dl).hitTest)||void 0===e?void 0:e.call(s,t,i))&&void 0!==n?n:null}}function Ui(t,i,s,e){t.forEach((t=>{i(t).forEach((t=>{t.xl()===s&&e.push(t)}))}))}function Ji(t){return t.Pn()}function Hi(t){return t.Al()}function Zi(t){return t.Bl()}class Ki extends Ti{constructor(t,i,s,e,n){super(t),this.zt=new Ri,this.Wh=new zi(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=s;const h=new Ci(this);this.rn=[h],this.jh=new si(h,this,t),"Area"!==s&&"Line"!==s&&"Baseline"!==s||(this.Ll=new ci(this)),this.$l(),this.Ul(n)}S(){null!==this.Wl&&clearTimeout(this.Wl)}ph(t){return this.cn.priceLineColor||t}Yr(t){const i={Xr:!0},s=this.Dt();if(this.$t().St().Ni()||s.Ni()||this.zt.Ni())return i;const e=this.$t().St().Xs(),n=this.Ct();if(null===e||null===n)return i;let h,r;if(t){const t=this.zt.nl();if(null===t)return i;h=t,r=t.se}else{const t=this.zt.hl(e.ui(),-1);if(null===t)return i;if(h=this.zt.Zh(t.se),null===h)return i;r=t.se}const o=h.Ot[3],l=this.$s().Hs(r,{Ot:h}),a=s.Rt(o,n.Ot);return{Xr:!1,_t:o,Zt:s.Fi(o,n.Ot),Mh:s.ql(o),xh:s.Yl(o,n.Ot),O:l.ue,ki:a,se:r}}$s(){return null!==this.El||(this.El=new Pi(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),T(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 s=this.$t().cr(this);this.$t().ta(s),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 Ei(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=[];Ui(this.jl,Ji,"top",i);const s=this.Ll;return null!==s&&s.yt()?(null===this.Wl&&s.Ur()&&(this.Wl=setTimeout((()=>{this.Wl=null,this.$t().aa()}),0)),s.$r(),i.unshift(s),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),Ui(this.jl,Ji,"normal",t),t}_a(){return this.ua(Ji,"bottom")}ca(t){return this.ua(Hi,t)}da(t){return this.ua(Zi,t)}fa(t,i){return this.jl.map((s=>s.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 s=[...this.rn];for(const t of this.Il)s.push(t.Yh());return this.jl.forEach((t=>{s.push(...t.Rn())})),s}Qi(){const t=[];return this.jl.forEach((i=>{t.push(...i.Qi())})),t}Vl(t,i){if(void 0!==this.cn.autoscaleInfoProvider){const s=this.cn.autoscaleInfoProvider((()=>{const s=this.va(t,i);return null===s?null:s.Ah()}));return ki.Bh(s)}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 w(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);return null===i?null:{_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 ji(t,this))}ka(t){this.jl=this.jl.filter((i=>i.Ol()!==t))}ya(){if(this.wn instanceof Kt!=0)return t=>this.wn.Fe(t)}Ca(){if(this.wn instanceof Kt!=0)return t=>this.wn.We(t)}oa(){return!ct(this.Dt().Ta())}va(t,i){if(!P(t)||!P(i)||this.zt.Ni())return null;const s="Line"===this.Hl||"Area"===this.Hl||"Baseline"===this.Hl||"Histogram"===this.Hl?[3]:[2,1],e=this.zt.al(t,i,s);let n=null!==e?new xi(e.pl,e.ml):null;if("Histogram"===this.Jh()){const t=this.cn.base,i=new xi(t,t);n=null!==n?n.ts(i):i}let h=this.dn._h();return this.jl.forEach((s=>{const e=s.Vl(t,i);if(null==e?void 0:e.priceRange){const t=new xi(e.priceRange.minValue,e.priceRange.maxValue);n=null!==n?n.ts(t):t}var r,o,l,a;(null==e?void 0:e.margins)&&(r=h,o=e.margins,h={above:Math.max(null!==(l=null==r?void 0:r.above)&&void 0!==l?l:0,o.above),below:Math.max(null!==(a=null==r?void 0:r.below)&&void 0!==a?a:0,o.below)})})),new ki(n,h)}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 pt(this.cn.priceFormat.precision);break;case"percent":this.ba=new mt(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=w(this.zt.sl());this.Fl=this.Nl.map(((s,e)=>{const n=w(t.Da(s.time,!0)),h=nt instanceof Ki)).reduce(((t,e)=>{if(s.dr(e)||!e.yt())return t;const n=e.Dt(),h=e.In();if(n.Ni()||!h.Kr(i))return t;const r=h.Zh(i);if(null===r)return t;const o=S(e.Ct());return t.concat([n.Rt(r.Ot[3],o.Ot)])}),[]);if(0===o.length)return e;o.sort(((t,i)=>Math.abs(t-r)-Math.abs(i-r)));const l=o[0];return e=n.pn(l,h),e}}class Xi extends j{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}Z({context:t,bitmapSize:i,horizontalPixelRatio:s,verticalPixelRatio:e}){if(null===this.zt)return;const n=Math.max(1,Math.floor(s));t.lineWidth=n,function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore()}(t,(()=>{const h=w(this.zt);if(h.Ba){t.strokeStyle=h.Va,p(t,h.Ia),t.beginPath();for(const e of h.za){const h=Math.round(e.La*s);t.moveTo(h,-n),t.lineTo(h,i.height+n)}t.stroke()}if(h.Ea){t.strokeStyle=h.Na,p(t,h.Fa),t.beginPath();for(const s of h.Wa){const h=Math.round(s.La*e);t.moveTo(-n,h),t.lineTo(i.width+n,h)}t.stroke()}}))}}class Yi{constructor(t){this.Wt=new Xi,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 qi{constructor(t){this.wn=new Yi(t)}Uh(){return this.wn}}const Qi={Ha:4,$a:1e-4};function ts(t,i){const s=100*(t-i)/i;return i<0?-s:s}function is(t,i){const s=ts(t.Th(),i),e=ts(t.Ph(),i);return new xi(s,e)}function ss(t,i){const s=100*(t-i)/i+100;return i<0?-s:s}function es(t,i){const s=ss(t.Th(),i),e=ss(t.Ph(),i);return new xi(s,e)}function ns(t,i){const s=Math.abs(t);if(s<1e-15)return 0;const e=Math.log10(s+i.$a)+i.Ha;return t<0?-e:e}function hs(t,i){const s=Math.abs(t);if(s<1e-15)return 0;const e=Math.pow(10,s-i.Ha)-i.$a;return t<0?-e:e}function rs(t,i){if(null===t)return null;const s=ns(t.Th(),i),e=ns(t.Ph(),i);return new xi(s,e)}function os(t,i){if(null===t)return null;const s=hs(t.Th(),i),e=hs(t.Ph(),i);return new xi(s,e)}function ls(t){ if(null===t)return Qi;const i=Math.abs(t.Ph()-t.Th());if(i>=1||i<1e-15)return Qi;const s=Math.ceil(Math.abs(Math.log10(i))),e=Qi.Ha+s;return{Ha:e,$a:1/Math.pow(10,e)}}class as{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,s){const e=0===this.Ua?0:1/this.Ua;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),h=0,r=this.qa[0];for(;;){const t=zt(n,e,1e-14)&&n>e+1e-14,i=zt(n,s*r,1e-14),o=zt(n,1,1e-14);if(!(t&&i&&o))break;n/=r,r=this.qa[++h%this.qa.length]}if(n<=e+1e-14&&(n=e),n=Math.max(1,n),this.Ya.length>0&&(o=n,1,1e-14,Math.abs(o-1)<1e-14))for(h=0,r=this.Ya[0];zt(n,s*r,1e-14)&&n>e+1e-14;)n/=r,r=this.Ya[++h%this.Ya.length];var o;return n}}class cs{constructor(t,i,s,e){this.Ka=[],this.Li=t,this.Ua=i,this.Za=s,this.Ga=e}Xa(t,i){if(t=a?1:-1;let d=null,m=0;for(let s=l-u;s>a;s-=c){const e=this.Ga(s,i,!0);null!==d&&Math.abs(e-d)o||(mw(t.Ki())-w(i.Ki())))}var fs;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(fs||(fs={}));const ds=new mt,ms=new dt(100,1);class ps{constructor(t,i,s,e){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 E,this.fo=new E,this.vo=[],this.po=null,this.mo=null,this.bo=null,this.wo=null,this.ba=ms,this.Mo=ls(null),this.xo=t,this.cn=i,this.So=s,this.ko=e,this.yo=new cs(this,100,this.Co.bind(this),this.To.bind(this))}Ta(){return this.xo}W(){return this.cn}Hh(t){if(T(this.cn,t),this.Pa(),void 0!==t.mode&&this.Po({yr:t.mode}),void 0!==t.scaleMargins){const i=g(t.scaleMargins.top),s=g(t.scaleMargins.bottom);if(i<0||i>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(s<0||s>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${s}`) ;if(i+s>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${i+s}`);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 s=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 s=hs(t.Th(),i),e=hs(t.Ph(),i);return isFinite(s)&&isFinite(e)}(this.Vh,this.Mo)?(s=os(this.Vh,this.Mo),null!==s&&this.Bo(s)):this.cn.autoScale=!0),1===t.yr&&t.yr!==i.yr&&(s=rs(this.Vh,this.Mo),null!==s&&this.Bo(s));const e=i.yr!==this.cn.mode;e&&(2===i.yr||this.gh())&&this.Pa(),e&&(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 s=this.Vh;(i||null===s&&null!==t||null!==s&&!s.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=ts(t,i):this.Oo()&&(t=ss(t,i)),this.To(t,i)}Qs(t,i,s){this.Fo();const e=this.No(),n=w(this.zh()),h=n.Th(),r=n.Ph(),o=this.Lo()-1,l=this.Ao(),a=o/(r-h),c=void 0===s?0:s.from,u=void 0===s?t.length:s.to,f=this.jo();for(let s=c;st.On()))}Pa(){this.mo=null;const t=this.s_();let i=100;null!==t&&(i=Math.round(1/t.pa())),this.ba=ms,this.gh()?(this.ba=ds,i=100):this.Oo()?(this.ba=new dt(100,1),i=100):null!==t&&(this.ba=t.ma()),this.yo=new cs(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?ns(t,this.Mo):t;const s=w(this.zh()),e=this.No()+(this.Lo()-1)*(t-s.Th())/s.Rh();return this.Wo(e)}Co(t,i){if(this.Fo(),this.Ni())return 0;const s=this.Wo(t),e=w(this.zh()),n=e.Th()+e.Rh()*((s-this.No())/(this.Lo()-1));return this.eo()?hs(n,this.Mo):n}Vo(){this.mo=null,this.yo.Qa()}h_(){const t=this.ao._o;if(null===t)return;let i=null;const s=this.e_();let e=0,n=0;for(const h of s){if(!h.yt())continue;const s=h.Ct();if(null===s)continue;const r=h.Vl(t.Os(),t.ui());let o=r&&r.zh();if(null!==o){switch(this.cn.mode){case 1:o=rs(o,this.Mo);break;case 2:o=is(o,s.Ot);break;case 3:o=es(o,s.Ot)}if(i=null===i?o:i.ts(w(o)),null!==r){const t=r.Lh();null!==t&&(e=Math.max(e,t.above),n=Math.max(n,t.below))}}}if(e===this.uo&&n===this.co||(this.uo=e,this.co=n,this.mo=null,this.Ro()),null!==i){if(i.Th()===i.Ph()){const t=this.s_(),s=5*(null===t||this.gh()||this.Oo()?1:t.pa());this.eo()&&(i=os(i,this.Mo)),i=new xi(i.Th()-s,i.Ph()+s),this.eo()&&(i=rs(i,this.Mo))}if(this.eo()){const t=os(i,this.Mo),s=ls(t);if(h=s,r=this.Mo,h.Ha!==r.Ha||h.$a!==r.$a){const e=null!==this.lo?os(this.lo,this.Mo):null ;this.Mo=s,i=rs(t,s),null!==e&&(this.lo=rs(e,s))}}this.Bo(i)}else null===this.Vh&&(this.Bo(new xi(-.5,.5)),this.Mo=ls(null));var h,r;this.ao.oo=!0}jo(){return this.gh()?ts:this.Oo()?ss:this.eo()?t=>ns(t,this.Mo):null}l_(t,i,s){return void 0===i?(void 0===s&&(s=this.ma()),s.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 vs{constructor(t,i){this.vo=[],this.a_=new Map,this.ro=0,this.o_=0,this.__=1e3,this.po=null,this.u_=new E,this.kl=t,this.$i=i,this.c_=new qi(this);const s=i.W();this.d_=this.f_("left",s.leftPriceScale),this.v_=this.f_("right",s.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_(s)}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 s of i){const i=w(s[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)?g(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 s=i.Dt();null!==s&&s.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,s){const e=void 0!==s?s:this.y_().k_+1;this.C_(t,i,e)}Yo(t){const i=this.vo.indexOf(t);b(-1!==i,"removeDataSource: invalid data source"),this.vo.splice(i,1);const s=w(t.Dt()).Ta();if(this.a_.has(s)){const i=g(this.a_.get(s)),e=i.indexOf(t);-1!==e&&(i.splice(e,1),0===i.length&&this.a_.delete(s))}const e=t.Dt();e&&e.Aa().indexOf(t)>=0&&e.Yo(t),null!==e&&(e.qo(),this.T_(e)),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=us(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,s=0;for(let e=0;es&&(s=n))}return{j_:i,k_:s}}C_(t,i,s){let e=this.b_(i);if(null===e&&(e=this.f_(i,this.$i.W().overlayPriceScales)),this.vo.push(t),!ct(i)){const s=this.a_.get(i)||[];s.push(t),this.a_.set(i,s)}e.Uo(t),t.Gi(e),t.Zi(s),this.T_(e),this.po=null}p_(t,i,s){i.yr!==s.yr&&this.z_(t)}f_(t,i){const s=Object.assign({visible:!0,autoScale:!0},R(i)),e=new ps(t,s,this.$i.W().layout,this.$i.W().localization);return e.zo(this.Vt()),e}}class bs{constructor(t,i,s=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=s}q_(t){const i=t.time,s=this.U_.cacheKey(i),e=this.Qe.get(s);if(void 0!==e)return e.Y_;if(this.Ke===this.tr){const t=this.Je.get(this.Ge);this.Je.delete(this.Ge),this.Qe.delete(g(t)),this.Ge++,this.Ke--}const n=this.H_(t);return this.Qe.set(s,{Y_:n,er:this.Ze}),this.Je.set(this.Ze,s),this.Ke++,this.Ze++,n}}class gs{constructor(t,i){b(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 ws(t,i){return null===t||null===i?t===i:t.yh(i)}class Ss{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 s=i;s{t<=s[0].index?i.push(e):s.splice(Tt(s,t,(i=>i.indexi-t))){if(!this.G_.get(s))continue;const e=i;i=[];const n=e.length;let h=0;const r=g(this.G_.get(s)),o=r.length;let l=1/0,a=-1/0;for(let s=0;s=t&&c-a>=t)i.push(o),a=c;else if(this.J_)return e}for(;hi.weight?t:i}class zs{constructor(t,i,s,e){this.o_=0,this.ou=null,this._u=[],this.wo=null,this.bo=null,this.uu=new Ss,this.cu=new Map,this.du=Ms.au(),this.fu=!0,this.vu=new E,this.pu=new E,this.mu=new E,this.bu=null,this.wu=null,this.gu=[],this.cn=i,this.ko=s,this.Mu=i.rightOffset,this.xu=i.barSpacing,this.$i=t,this.U_=e,this.Su(),this.uu.Q_(i.uniformDistribution)}W(){return this.cn}ku(t){T(this.ko,t),this.yu(),this.Su()}Hh(t,i){var s;T(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!==(s=t.barSpacing)&&void 0!==s?s:this.xu),this.yu(),this.Su(),this.mu.m()}mn(t){var i,s;return null!==(s=null===(i=this._u[t])||void 0===i?void 0:i.time)&&void 0!==s?s: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 s=Tt(this._u,this.U_.key(t),((t,i)=>this.U_.key(t.time)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),s=Math.round(t.to),e=w(this.Au()),n=w(this.Bu());return{from:w(this.Ui(Math.max(e,i))),to:w(this.Ui(Math.min(n,s)))}}Vu(t){return{from:w(this.Da(t.from,!0)),to:w(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(),s=this.o_;if(this.o_=t,this.fu=!0,this.cn.lockVisibleTimeRangeOnResize&&0!==s){const i=this.xu*t/s;this.xu=i}if(this.cn.fixLeftEdge&&null!==i&&i.Os()<=0){const i=s-t;this.Mu-=Math.round(i/this.xu)+1,this.fu=!0}this.Iu(),this.zu()}It(t){if(this.Ni()||!P(t))return 0;const i=this.Lu()+this.Mu-t;return this.o_-(i+.5)*this.xu-1}Js(t,i){const s=this.Lu(),e=void 0===i?0:i.from,n=void 0===i?t.length:i.to;for(let i=e;ii/2&&!a?s.needAlignCoordinate=!1:s.needAlignCoordinate=c&&t.index<=o||u&&t.index>=l,f++}return this.gu.length=f,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 s=this.Nu(t),e=this.he(),n=e+i*(e/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.ju()+(s-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=yt(this.o_-t,0,this.o_),s=yt(this.o_-w(this.bo),0,this.o_);0!==i&&0!==s&&this.Gn(this.bu.he*i/s)}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=w(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 s=this.Mu,e=performance.now();this.$i.Xn({Ju:t=>(t-e)/i>=1,Qu:n=>{const h=(n-e)/i;return h>=1?t:s+(t-s)*h}})}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 gs(t,i+this.cn.rightOffset))}hc(t){const i=new gs(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),s=this.Lu()+this.Mu-i;return Math.round(1e6*s)/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(Ms.au());const t=this.Lu(),i=this.o_/this.xu,s=this.Mu+t,e=new gs(s-i+1,s);this.oc(new Ms(e))}Iu(){const t=this._c();if(this.xut&&(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.Muthis.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,ws(i.hu(),this.du.hu())||this.vu.m(),ws(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 s=i.Os()-t;if(s<0){const t=this.Mu-s-1;this.Jn(t)}this.Iu()} Tu(){this.zu(),this.Iu()}}class Cs extends class{K(t,i,s){t.useMediaCoordinateSpace((t=>this.Z(t,i,s)))}wl(t,i,s){t.useMediaCoordinateSpace((t=>this.fc(t,i,s)))}fc(t,i,s){}}{constructor(t){super(),this.vc=new Map,this.zt=t}Z(t){}fc(t){if(!this.zt.yt)return;const{context:i,mediaSize:s}=t;let e=0;for(const t of this.zt.mc){if(0===t.Zt.length)continue;i.font=t.R;const n=this.bc(i,t.Zt);n>s.width?t.Yu=s.width/n:t.Yu=1,e+=t.wc*t.Yu}let n=0;switch(this.zt.gc){case"top":n=0;break;case"center":n=Math.max((s.height-e)/2,0);break;case"bottom":n=Math.max(s.height-e,0)}i.fillStyle=this.zt.O;for(const t of this.zt.mc){i.save();let e=0;switch(this.zt.Mc){case"left":i.textAlign="left",e=t.wc/2;break;case"center":i.textAlign="center",e=s.width/2;break;case"right":i.textAlign="right",e=s.width-1-t.wc/2}i.translate(e,n),i.textBaseline="top",i.font=t.R,i.scale(t.Yu,t.Yu),i.fillText(t.Zt,0,t.xc),i.restore(),n+=t.wc*t.Yu}}bc(t,i){const s=this.Sc(t.font);let e=s.get(i);return void 0===e&&(e=t.measureText(i).width,s.set(i,e)),e}Sc(t){let i=this.vc.get(t);return void 0===i&&(i=new Map,this.vc.set(t,i)),i}}class _s{constructor(t){this.ft=!0,this.Ft={yt:!1,O:"",mc:[],gc:"center",Mc:"center"},this.Wt=new Cs(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:I(t.fontSize,t.fontFamily,t.fontStyle),wc:1.2*t.fontSize,xc:0,Yu:0}])}}class xs extends ot{constructor(t,i){super(),this.cn=i,this.wn=new _s(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}On(){this.wn.bt()}}var ks,Ls,Os,Es,Ts;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"}(ks||(ks={}));class Ws{constructor(t,i,s){this.kc=[],this.yc=[],this.o_=0,this.Cc=null,this.Tc=new E,this.Pc=new E,this.Rc=null,this.Dc=t,this.cn=i,this.U_=s,this.Oc=new V(this),this.kl=new zs(this,i.timeScale,this.cn.localization,s),this.vt=new at(this,i.crosshair),this.Ac=new Gi(i.crosshair),this.Bc=new xs(this,i.watermark),this.Vc(),this.kc[0].M_(2e3),this.Ic=this.zc(0),this.Lc=this.zc(1)}Kl(){this.Ec(ut.es())}$h(){this.Ec(ut.ss())}aa(){this.Ec(new ut(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){T(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 s=this.$c(t);null!==s&&(s.Dt.Hh(i),this.Tc.m())}$c(t){for(const i of this.kc){const s=i.b_(t);if(null!==s)return{Ht:i,Dt:s}}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 vs(this.kl,this);void 0!==t?this.kc.splice(t,0,i):this.kc.push(i);const s=void 0===t?this.kc.length-1:t,e=ut.es();return e.Nn(s,{Fn:0,Wn:!0}),this.Ec(e),i}D_(t,i,s){t.D_(i,s)}O_(t,i,s){t.O_(i,s),this.Gl(),this.Ec(this.Zc(t,2))}A_(t,i){t.A_(i),this.Ec(this.Zc(t,2))}B_(t,i,s){i.Do()||t.B_(i,s)}V_(t,i,s){i.Do()||(t.V_(i,s),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 s=this.St();if(s.Ni()||0===i)return;const e=s.Hi();t=Math.max(1,Math.min(t,e)),s.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,s,e,n){this.vt.gn(t,i);let h=NaN,r=this.kl.Eu(t);const o=this.kl.Xs();null!==o&&(r=Math.min(Math.max(o.Os(),r),o.ui()));const l=e.vn(),a=l.Ct();null!==a&&(h=l.pn(i,a)),h=this.Ac.Oa(h,r,e),this.vt.kn(r,h,e),this.aa(),n||this.Pc.m(this.vt.xt(),{x:t,y:i},s)}ld(t,i,s){const e=s.vn(),n=e.Ct(),h=e.Rt(t,w(n)),r=this.kl.Da(i,!0),o=this.kl.It(w(r));this.hd(o,h,null,s,!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(),s=this.vt.Sn();this.hd(i,s,null,t)}this.vt.On()}od(t,i,s){const e=this.kl.mn(0);void 0!==i&&void 0!==s&&this.kl.bt(i,s);const n=this.kl.mn(0),h=this.kl.Lu(),r=this.kl.Xs();if(null!==r&&null!==e&&null!==n){const i=r.Kr(h),o=this.U_.key(e)>this.U_.key(n),l=null!==t&&t>h&&!o,a=this.kl.W().allowShiftVisibleRangeOnWhitespaceReplacement,c=i&&(!(void 0===s)||a)&&this.kl.W().shiftVisibleRangeOnNewBar;if(l&&!c){const i=t-h;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,s){const e=this.kc[0],n=this.dd(i,t,e,s);return this.yc.push(n),1===this.yc.length?this.Kl():this.$h(),n}fd(t){const i=this.cr(t),s=this.yc.indexOf(t);b(-1!==s,"Series not found"),this.yc.splice(s,1),w(i).Yo(t),t.S&&t.S()}Xl(t,i){const s=w(this.cr(t));s.Yo(t);const e=this.$c(i);if(null===e){const e=t.Ki();s.Uo(t,i,e)}else{const n=e.Ht===s?t.Ki():void 0;e.Ht.Uo(t,i,n)}}rc(){const t=ut.ss();t.$n(),this.Ec(t)}vd(t){const i=ut.ss();i.Yn(t),this.Ec(i)}Zn(){const t=ut.ss();t.Zn(),this.Ec(t)}Gn(t){const i=ut.ss();i.Gn(t),this.Ec(i)}Jn(t){const i=ut.ss();i.Jn(t),this.Ec(i)}Xn(t){const i=ut.ss();i.Xn(t),this.Ec(i)}Un(){const t=ut.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,s=this.Ic;if(i===s)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.Rc||this.Rc.Ts!==s||this.Rc.Ps!==i)this.Rc={Ts:s,Ps:i,bd:new Map };else{const i=this.Rc.bd.get(t);if(void 0!==i)return i}const e=function(t,i,s){const[e,n,h,r]=L(t),[o,l,a,c]=L(i),u=[y(e+s*(o-e)),y(n+s*(l-n)),y(h+s*(a-h)),z(r+s*(c-r))];return`rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}(s,i,t/100);return this.Rc.bd.set(t,e),e}Zc(t,i){const s=new ut(i);if(null!==t){const e=this.kc.indexOf(t);s.Nn(e,{Fn:i})}return s}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,s,e){const n=new Ki(this,t,i,s,e),h=void 0!==t.priceScaleId?t.priceScaleId:this.pd();return s.Uo(n,h),ct(h)||n.Hh(t),n}zc(t){const i=this.cn.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}}function Ps(t){return!W(t)&&!N(t)}function Ns(t){return W(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"}(Ls||(Ls={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(Os||(Os={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(Es||(Es={})),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"}(Ts||(Ts={}));const $s=t=>t.getUTCFullYear();class Rs{constructor(t="yyyy-MM-dd",i="default"){this.wd=t,this.gd=i}q_(t){return function(t,i,s){return i.replace(/yyyy/g,(t=>ft($s(t),4))(t)).replace(/yy/g,(t=>ft($s(t)%100,2))(t)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(t,s)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(t,s)).replace(/MM/g,(t=>ft((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>ft((t=>t.getUTCDate())(t),2))(t))}(t,this.wd,this.gd)}}class Ds{constructor(t){this.Md=t||"%h:%m:%s"}q_(t){return this.Md.replace("%h",ft(t.getUTCHours(),2)).replace("%m",ft(t.getUTCMinutes(),2)).replace("%s",ft(t.getUTCSeconds(),2))}}const Bs={xd:"yyyy-MM-dd",Sd:"%h:%m:%s",kd:" ",yd:"default"};class Fs{constructor(t={}){const i=Object.assign(Object.assign({},Bs),t);this.Cd=new Rs(i.xd,i.yd),this.Td=new Ds(i.Sd),this.Pd=i.kd}q_(t){return`${this.Cd.q_(t)}${this.Pd}${this.Td.q_(t)}`}}function Is(t){return 60*t*60*1e3}function Vs(t){return 60*t*1e3}const As=[{Rd:(1,1e3),Dd:10},{Rd:Vs(1),Dd:20},{Rd:Vs(5),Dd:21},{Rd:Vs(30),Dd:22},{Rd:Is(1),Dd:30},{Rd:Is(3),Dd:31},{Rd:Is(6),Dd:32},{Rd:Is(12),Dd:33}];function js(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 s=As.length-1;s>=0;--s)if(Math.floor(i.getTime()/As[s].Rd)!==Math.floor(t.getTime()/As[s].Rd))return As[s].Dd;return 0}function Us(t){let i=t;if(N(t)&&(i=Hs(t)),!Ps(i))throw new Error("time must be of type BusinessDay");const s=new Date(Date.UTC(i.year,i.month-1,i.day,0,0,0,0));return{Od:Math.round(s.getTime()/1e3),Ad:i}}function Js(t){if(!Ns(t))throw new Error("time must be of type isUTCTimestamp");return{Od:t}}function Hs(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 Zs(t){N(t.time)&&(t.time=Hs(t.time))}class Ks{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?function(t){t.forEach(Zs)}(t):Zs(t)}createConverterToInternalObj(t){return w(function(t){return 0===t.length?null:Ps(t[0].time)||N(t[0].time)?Us:Js}(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 Ns(i=t)?Js(i):Ps(i)?Us(i):Us(Hs(i));var i}updateFormatter(t){if(!this.cn)return;const i=t.dateFormat;this.cn.timeScale.timeVisible?this.Bd=new Fs({xd:i,Sd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",kd:" ",yd:t.locale}):this.Bd=new Rs(i,t.locale)}formatHorzItem(t){const i=t;return this.Bd.q_(new Date(1e3*i.Od))}formatTickmark(t,i){const s=function(t,i,s){switch(t){case 0:case 10:return i?s?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),e=this.cn.timeScale;if(void 0!==e.tickMarkFormatter){const n=e.tickMarkFormatter(t.originalTime,s,i.locale);if(null!==n)return n}return function(t,i,s){const e={};switch(i){case 0:e.year="numeric";break;case 1:e.month="short";break;case 2:e.day="numeric";break;case 3:e.hour12=!1,e.hour="2-digit",e.minute="2-digit";break;case 4:e.hour12=!1,e.hour="2-digit",e.minute="2-digit",e.second="2-digit"}const n=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(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()).toLocaleString(s,e)}(t.time,s,i.locale)}maxTickMarkWeight(t){let i=t.reduce(ys,t[0]).weight;return i>30&&i<50&&(i=30),i}fillWeightsForPoints(t,i){!function(t,i=0){if(0===t.length)return;let s=0===i?null:t[i-1].time.Od,e=null!==s?new Date(1e3*s):null,n=0;for(let h=i;h1){const i=Math.ceil(n/(t.length-1)),s=new Date(1e3*(t[0].time.Od-i));t[0].timeWeight=js(new Date(1e3*t[0].time.Od),s)}}(t,i)}static Vd(t){return T({localization:{dateFormat:"dd MMM 'yy"}},null!=t?t:{})}}const Gs="undefined"!=typeof window;function Xs(){return!!Gs&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Ys(){return!!Gs&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function qs(t){return t+t%2}function Qs(t,i){return t.Id-i.Id}function te(t,i,s){const e=(t.Id-i.Id)/(t.ot-i.ot);return Math.sign(e)*Math.min(Math.abs(e),s)}class ie{constructor(t,i,s,e){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=s,this.rs=e}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)50)return;let s=0;const e=te(this.zd,this.Ld,this.$d),n=Qs(this.zd,this.Ld),h=[e],r=[n];if(s+=n,null!==this.Ed){const t=te(this.Ld,this.Ed,this.$d);if(Math.sign(t)===Math.sign(e)){const i=Qs(this.Ld,this.Ed);if(h.push(t),r.push(i),s+=i,null!==this.Nd){const t=te(this.Ed,this.Nd,this.$d);if(Math.sign(t)===Math.sign(e)){const i=Qs(this.Ed,this.Nd);h.push(t),r.push(i),s+=i}}}}let o=0;for(let t=0;t({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return n.resizeCanvasElement(i),n}function ee(t){var i;t.width=1,t.height=1,null===(i=t.getContext("2d"))||void 0===i||i.clearRect(0,0,1,1)}function ne(t,i,s,e){t.wl&&t.wl(i,s,e)}function he(t,i,s,e){t.K(i,s,e)}function re(t,i,s,e){const n=t(s,e);for(const t of n){const s=t.gt();null!==s&&i(s)}}class oe{constructor(t,i,s){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=!Ys(),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:s}=this.Pf(ce(t),this.Qd);s<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:s}=this.Pf(ce(t),this.Zd);s<5&&!this.rf&&this.Bf(i,this.Of.Vf),this.If()}}},this.zf=t,this.Of=i,this.cn=s,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 s=this.Cf(t);this.Bf(s,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=fe(t.changedTouches,w(this.gf));if(null===i)return;if(this.wf=ue(t),null!==this.ff)return;if(this.mf)return;this.pf=!0;const s=this.Pf(ce(i),w(this.sf)),{$f:e,Uf:n,Tf:h}=s;if(this.ef||!(h<5)){if(!this.ef){const t=.5*e,i=n>=t&&!this.cn.qf(),s=t>n&&!this.cn.Yf();i||s||(this.mf=!0),this.ef=!0,this.hf=!0,this.Ef(),this.Af()}if(!this.mf){const s=this.Cf(t,i);this.Rf(s,this.Of.Xf),ae(t)}}}Kf(t){if(0!==t.button)return;const i=this.Pf(ce(t),w(this.nf)),{Tf:s}=i;if(s>=5&&(this.rf=!0,this.If()),this.rf){const i=this.Cf(t);this.Bf(i,this.Of.Zf)}}Pf(t,i){const s=Math.abs(i.nt-t.nt),e=Math.abs(i.st-t.st);return{$f:s,Uf:e,Tf:s+e}}Gf(t){let i=fe(t.changedTouches,w(this.gf));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.gf=null,this.wf=ue(t),this.Ef(),this.sf=null,this.df&&(this.df(),this.df=null);const s=this.Cf(t,i);if(this.Rf(s,this.Of.Jf),++this.Gd,this.Jd&&this.Gd>1){const{Tf:t}=this.Pf(ce(i),this.Qd);t<30&&!this.hf&&this.Rf(s,this.Of.Df),this.Af()}else this.hf||(this.Rf(s,this.Of.Qf),this.Of.Qf&&ae(t));0===this.Gd&&ae(t),0===t.touches.length&&this.if&&(this.if=!1,ae(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),Xs()&&this.zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.xf),!this.yf(t))if(this.Bf(i,this.Of.tv),++this.Xd,this.Kd&&this.Xd>1){const{Tf:s}=this.Pf(ce(t),this.Zd);s<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=ue(t);const s=this.zf.ownerDocument.documentElement;this.hf=!1,this.ef=!1,this.mf=!1,this.sf=ce(i),this.df&&(this.df(),this.df=null);{const i=this.Hf.bind(this),e=this.Gf.bind(this);this.df=()=>{s.removeEventListener("touchmove",i),s.removeEventListener("touchend",e)},s.addEventListener("touchmove",i,{passive:!1}),s.addEventListener("touchend",e,{passive:!1}),this.Ef(),this.tf=setTimeout(this.sv.bind(this,t),240)}const e=this.Cf(t,i);this.Rf(e,this.Of.ev),this.Jd||(this.Gd=0,this.Jd=setTimeout(this.Af.bind(this),500),this.Qd=ce(i))}rv(t){if(0!==t.button)return;const i=this.zf.ownerDocument.documentElement;Xs()&&i.addEventListener("mouseleave",this.xf),this.rf=!1,this.nf=ce(t),this.cf&&(this.cf(),this.cf=null);{const t=this.Kf.bind(this),s=this.Sf.bind(this);this.cf=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",s)},i.addEventListener("mousemove",t),i.addEventListener("mouseup",s)}if(this.bf=!0,this.yf(t))return;const s=this.Cf(t);this.Bf(s,this.Of.hv),this.Kd||(this.Xd=0,this.Kd=setTimeout(this.If.bind(this),500),this.Zd=ce(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})}Ys()&&(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}),function(t){Gs&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),!1}))}(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=le(t.touches[0],t.touches[1])/this.vf;this.Of.uv(this.ff,i),ae(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=le(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=!Ys()}sv(t){const i=fe(t.touches,w(this.gf));if(null===i)return;const s=this.Cf(t,i);this.Rf(s,this.Of.mv),this.hf=!0,this.if=!0}yf(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:ue(t){"touchstart"!==t.type&&ae(t)}}}}function le(t,i){const s=t.clientX-i.clientX,e=t.clientY-i.clientY;return Math.sqrt(s*s+e*e)}function ae(t){t.cancelable&&t.preventDefault()}function ce(t){return{nt:t.pageX,st:t.pageY}}function ue(t){return t.timeStamp||performance.now()}function fe(t,i){for(let s=0;s{var e,n,h,r;return(null!==(n=null===(e=s.Dt())||void 0===e?void 0:e.Ta())&&void 0!==n?n:"")!==i?[]:null!==(r=null===(h=s.ca)||void 0===h?void 0:h.call(s,t))&&void 0!==r?r:[]}}function ve(t,i,s,e){if(!t.length)return;let n=0;const h=s/2,r=t[0].Vt(e,!0);let o=1===i?h-(t[0].Oi()-r/2):t[0].Oi()-r/2-h;o=Math.max(0,o);for(let h=1;hu-a:cs)&&o>0){const e=1===i?-1-h:h-s,r=Math.min(e,o);for(let s=n;s{this.Dv||this.tn.Av().$t().$h()},this.Bv=()=>{this.Dv||this.tn.Av().$t().$h()},this.tn=t,this.cn=i,this.So=i.layout,this.Oc=s,this.Vv="left"===n,this.Iv=pe("normal",n),this.zv=pe("top",n),this.Lv=pe("bottom",n),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=se(this.Ev,e.size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const h=this.Nv.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this.Fv=se(this.Ev,e.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";const o={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 oe(this.Fv.canvasElement,o,{qf:()=>!this.cn.handleScroll.vertTouchDrag,Yf:()=>!0})}S(){this.Xv.S(),this.Fv.unsubscribeSuggestedBitmapSizeChanged(this.Bv),ee(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),ee(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(),s=w(this.Nv.canvasElement.getContext("2d"));s.save();const e=this.Li.ja();s.font=this.Jv(),e.length>0&&(t=Math.max(this.Pv.xi(s,e[0].no),this.Pv.xi(s,e[e.length-1].no)));const n=this.Qv();for(let i=n.length;i--;){const e=this.Pv.xi(s,n[i].Zt());e>t&&(t=e)}const h=this.Li.Ct();if(null!==h&&null!==this.Cv){const i=this.Li.pn(1,h),e=this.Li.pn(this.Cv.height-2,h);t=Math.max(t,this.Pv.xi(s,this.Li.Fi(Math.floor(Math.min(i,e))+.11111111111111,h)),this.Pv.xi(s,this.Li.Fi(Math.ceil(Math.max(i,e))-.11111111111111,h)))}s.restore();const r=t||34 ;return qs(Math.ceil(i.C+i.T+i.V+i.I+5+r))}tp(t){null!==this.Cv&&(0,e.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 w(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,w(this.Dt()))}sp(t){if(null===this.Cv)return;if(1!==t){this.ep(),this.Nv.applySuggestedBitmapSize();const t=(0,e.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=(0,e.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,s){const e=this._p();e.width>0&&e.height>0&&t.drawImage(this.Nv.canvasElement,i,s)}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(),s=this.tn.np();this.Tv=!0,i.D_(s,this.Li,t.localY)}jv(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),s=this.tn.np(),e=this.Li;i.O_(s,e,t.localY)}Hv(){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.Av().$t(),i=this.tn.np(),s=this.Li;this.Tv&&(this.Tv=!1,t.A_(i,s))}$v(t){if(null===this.Li||!this.cn.handleScale.axisPressedMouseMove.price)return;const i=this.tn.Av().$t(),s=this.tn.np();this.Tv=!1,i.A_(s,this.Li)}Uv(t){this.cn.handleScale.axisDoubleClickReset.price&&this.ir()}qv(t){null!==this.Li&&(!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(s=>{for(let e=0;e{t.fillStyle=s.borderColor;const o=Math.max(1,Math.floor(r)),l=Math.floor(.5*r),a=Math.round(e.T*h);t.beginPath();for(const s of i)t.rect(Math.floor(n*h),Math.round(s.La*r)-l,a,o);t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{var h;t.font=this.Jv(), t.fillStyle=null!==(h=s.textColor)&&void 0!==h?h:this.So.textColor,t.textAlign=this.Vv?"right":"left",t.textBaseline="middle";const r=this.Vv?Math.round(n-e.V):Math.round(n+e.T+e.V),o=i.map((i=>this.Pv.Mi(t,i.no)));for(let s=i.length;s--;){const e=i[s];t.fillText(e.no,r,e.La+o[s])}}))}ep(){if(null===this.Cv||null===this.Li)return;const t=[],i=this.Li.$o().slice(),s=this.tn.np(),e=this.Zv();this.Li===s.vr()&&this.tn.np().$o().forEach((t=>{s.dr(t)&&i.push(t)}));const n=this.Li;i.forEach((i=>{i.Rn(s,n).forEach((i=>{i.Ai(null),i.Bi()&&t.push(i)}))})),t.forEach((t=>t.Ai(t.ki()))),this.Li.W().alignLabels&&this.dp(t,e)}dp(t,i){if(null===this.Cv)return;const s=this.Cv.height/2,e=t.filter((t=>t.ki()<=s)),n=t.filter((t=>t.ki()>s));e.sort(((t,i)=>i.ki()-t.ki())),n.sort(((t,i)=>t.ki()-i.ki()));for(const s of t){const t=Math.floor(s.Vt(i)/2),e=s.ki();e>-t&&ethis.Cv.height-t&&e{i.Vi()&&i.gt(w(this.Li)).K(t,s,this.Pv,e)}))}op(t){if(null===this.Cv||null===this.Li)return;const i=this.tn.Av().$t(),s=[],e=this.tn.np(),n=i.Yc().Rn(e,this.Li);n.length&&s.push(n);const h=this.Zv(),r=this.Vv?"right":"left";s.forEach((i=>{i.forEach((i=>{i.gt(w(this.Li)).K(t,h,this.Pv,r)}))}))}cp(t){this.Ev.style.cursor=1===t?"ns-resize":"default"}do(){const t=this.Gv();this.Rv{this.Dv||null===this.Cp||this.$i().$h()},this.Bv=()=>{this.Dv||null===this.Cp||this.$i().$h()},this.Tp=t,this.Cp=i,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=se(s,e.size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov);const n=this.Nv.canvasElement;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.Fv=se(s,e.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",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 oe(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),ee(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),ee(this.Nv.canvasElement),this.Nv.dispose(),null!==this.Cp&&this.Cp.F_().p(this),this.Xv.S()}np(){return w(this.Cp)}Vp(t){null!==this.Cp&&this.Cp.F_().p(this),this.Cp=t,null!==this.Cp&&this.Cp.F_().l(ye.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(w(t))}if(null!==this.vp){const t=this.Cp.R_();this.vp.Gi(w(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,s=t.localY;this.Ep(i,s,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 s=t.localX,e=t.localY;this.Ep(s,e,t);const n=this.br(s,e);this.Tp.Fp(null!==(i=null==n?void 0:n.yv)&&void 0!==i?i:null),this.$i().Wc(n&&{jc:n.jc,Sv:n.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 s=5*(i-this.gp);this.gp=i,this.$i().Jc(t.nt,s)}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,s=t.localY;if(null===this.xp)this.Hp(t);else{this.Sp=!1;const e=w(this.kp),n=e.x+(i-this.xp.x),h=e.y+(s-this.xp.y);this.Ep(n,h,t)}}Jf(t){0===this.Av().W().trackingMode.exitMode&&(this.Sp=!0),this.Kp(),this.$p(t)}br(t,i){const s=this.Cp;return null===s?null:function(t,i,s){const e=t.$o(),n=function(t,i,s){var e,n;let h,r;for(const a of t){const t=null!==(n=null===(e=a.fa)||void 0===e?void 0:e.call(a,i,s))&&void 0!==n?n:[];for(const i of t)o=i.zOrder,(!(l=null==h?void 0:h.zOrder)||"top"===o&&"top"!==l||"normal"===o&&"bottom"===l)&&(h=i,r=a)}var o,l;return h&&r?{kv:h,jc:r}:null}(e,i,s);if("top"===(null==n?void 0:n.kv.zOrder))return de(n);for(const h of e){ if(n&&n.jc===h&&"bottom"!==n.kv.zOrder&&!n.kv.isBackground)return de(n);const e=me(h.Pn(t),i,s);if(null!==e)return{jc:h,Mv:e.Mv,Sv:e.Sv};if(n&&n.jc===h&&"bottom"!==n.kv.zOrder&&n.kv.isBackground)return de(n)}return(null==n?void 0:n.kv)?de(n):null}(s,t,i)}Zp(t,i){w("left"===i?this.fp:this.vp).tp(e.size({width:t,height:this.Cv.height}))}Gp(){return this.Cv}tp(t){(0,e.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=w(this.Cp);t.T_(t.P_()),t.T_(t.R_());for(const i of t.Aa())if(t.dr(i)){const s=i.Dt();null!==s&&t.T_(s),i.On()}}_p(){return this.Nv.bitmapSize}up(t,i,s){const e=this._p();e.width>0&&e.height>0&&t.drawImage(this.Nv.canvasElement,i,s)}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=(0,e.tryCreateCanvasRenderingTarget2D)(this.Nv);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.rp(t)})),this.Cp&&(this.Qp(t,ge),this.tm(t),this.im(t),this.Qp(t,we),this.Qp(t,Se)))}this.Fv.applySuggestedBitmapSize();const i=(0,e.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,Me))}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 s=i.localX,e=i.localY;t.M()&&t.m(this.$i().St().Eu(s),{x:s,y:e},i)}rp({context:t,bitmapSize:i}){const{width:s,height:e}=i,n=this.$i(),h=n.q(),r=n.md();h===r?Y(t,0,0,s,e,r):tt(t,0,0,s,e,h,r)}tm(t){const i=w(this.Cp).W_().Uh().gt();null!==i&&i.K(t,!1)}im(t){const i=this.$i().qc();this.hm(t,we,ne,i),this.hm(t,we,he,i)}nm(t){this.hm(t,we,he,this.$i().Yc())}Qp(t,i){const s=w(this.Cp).$o();for(const e of s)this.hm(t,i,ne,e);for(const e of s)this.hm(t,i,he,e)}hm(t,i,s,e){const n=w(this.Cp),h=n.$t().Fc(),r=null!==h&&h.jc===e,o=null!==h&&r&&void 0!==h.Sv?h.Sv.gr:void 0;re(i,(i=>s(i,t,r,o)),e,n)}Ip(){if(null===this.Cp)return;const t=this.Tp,i=this.Cp.P_().W().visible,s=this.Cp.R_().W().visible;i||null===this.fp||(this.Dp.removeChild(this.fp.Kv()),this.fp.S(),this.fp=null),s||null===this.vp||(this.Op.removeChild(this.vp.Kv()),this.vp.S(),this.vp=null);const e=t.$t()._d();i&&null===this.fp&&(this.fp=new be(this,t.W(),e,"left"),this.Dp.appendChild(this.fp.Kv())),s&&null===this.vp&&(this.vp=new be(this,t.W(),e,"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,s){this.$i().hd(this.am(t),this.om(i),s,w(this.Cp))}qp(){this.$i().ad()}Kp(){this.Sp&&(this.xp=null,this.qp())}Up(t,i,s){this.xp=t,this.Sp=!1,this.Ep(i.x,i.y,s);const e=this.$i().Yc();this.kp={x:e.Yt(),y:e.Xt()}}$i(){return this.Tp.$t()}$p(t){if(!this.mp)return;const i=this.$i(),s=this.np();if(i.I_(s,s.vn()),this.pp=null, this.mp=!1,i.sd(),null!==this.yp){const t=performance.now(),s=i.St();this.yp.Dr(s.ju(),t),this.yp.Ju(t)||i.Xn(this.yp)}}Lp(){this.xp=null}Np(){if(this.Cp){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)w(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(),s=i.St();if(s.Ni())return;const e=this.Tp.W(),n=e.handleScroll,h=e.kineticScroll;if((!n.pressedMouseMove||t.bv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!t.bv))return;const r=this.Cp.vn(),o=performance.now();if(null!==this.pp||this.lm(t)||(this.pp={x:t.clientX,y:t.clientY,Od:o,_m:t.localX,um:t.localY}),null!==this.pp&&!this.mp&&(this.pp.x!==t.clientX||this.pp.y!==t.clientY)){if(t.bv&&h.touch||!t.bv&&h.mouse){const t=s.he();this.yp=new ie(.2/t,7/t,.997,15/t),this.yp.qd(s.ju(),this.pp.Od)}else this.yp=null;r.Ni()||i.B_(this.Cp,r,t.localY),i.td(t.localX),this.mp=!0}this.mp&&(r.Ni()||i.V_(this.Cp,r,t.localY),i.nd(t.localX),null!==this.yp&&this.yp.qd(s.ju(),o))}}class ze{constructor(t,i,s,n,h){this.ft=!0,this.Cv=e.size({width:0,height:0}),this.Ov=()=>this.sp(3),this.Vv="left"===t,this.Oc=s._d,this.cn=i,this.dm=n,this.fm=h,this.Ev=document.createElement("div"),this.Ev.style.width="25px",this.Ev.style.height="100%",this.Ev.style.overflow="hidden",this.Nv=se(this.Ev,e.size({width:16,height:16})),this.Nv.subscribeSuggestedBitmapSizeChanged(this.Ov)}S(){this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),ee(this.Nv.canvasElement),this.Nv.dispose()}Kv(){return this.Ev}Gp(){return this.Cv}tp(t){(0,e.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=(0,e.tryCreateCanvasRenderingTarget2D)(this.Nv);null!==i&&i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t)}))}_p(){return this.Nv.bitmapSize}up(t,i,s){const e=this._p();e.width>0&&e.height>0&&t.drawImage(this.Nv.canvasElement,i,s)}Ve({context:t,bitmapSize:i,horizontalPixelRatio:s,verticalPixelRatio:e}){if(!this.dm())return;t.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*s),h=Math.floor(this.Oc.W().C*e),r=this.Vv?i.width-n:0;t.fillRect(r,0,n,h)}rp({context:t,bitmapSize:i}){Y(t,0,0,i.width,i.height,this.fm())}}function Ce(t){return i=>{var s,e;return null!==(e=null===(s=i.da)||void 0===s?void 0:s.call(i,t))&&void 0!==e?e:[]}}const _e=Ce("normal"),xe=Ce("top"),ke=Ce("bottom");class Le{constructor(t,i){this.vm=null,this.pm=null,this.k=null,this.bm=!1,this.Cv=e.size({width:0,height:0}),this.wm=new E,this.Pv=new ti(5),this.Dv=!1,this.Ov=()=>{this.Dv||this.Tp.$t().$h()},this.Bv=()=>{this.Dv||this.Tp.$t().$h()},this.Tp=t,this.U_=i,this.cn=t.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=se(this.Sm,e.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=se(this.Sm,e.size({width:16,height:16})),this.Fv.subscribeSuggestedBitmapSizeChanged(this.Bv);const n=this.Fv.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.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 oe(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),ee(this.Fv.canvasElement),this.Fv.dispose(),this.Nv.unsubscribeSuggestedBitmapSizeChanged(this.Ov),ee(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(t,i,s){(0,e.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`,this.wm.m(t)),null!==this.vm&&this.vm.tp(e.size({width:i,height:t.height})),null!==this.pm&&this.pm.tp(e.size({width:s,height:t.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,s){const e=this._p();e.width>0&&e.height>0&&t.drawImage(this.Nv.canvasElement,i,s)}sp(t){if(0===t)return;if(1!==t){this.Nv.applySuggestedBitmapSize();const i=(0,e.tryCreateCanvasRenderingTarget2D)(this.Nv);null!==i&&(i.useBitmapCoordinateSpace((t=>{this.rp(t),this.Ve(t),this.Am(i,ke)})),this.lp(i),this.Am(i,_e)),null!==this.vm&&this.vm.sp(t),null!==this.pm&&this.pm.sp(t)}this.Fv.applySuggestedBitmapSize();const i=(0,e.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,xe))}Am(t,i){const s=this.Tp.$t().wt();for(const e of s)re(i,(i=>ne(i,t,!1,void 0)),e,void 0);for(const e of s)re(i,(i=>he(i,t,!1,void 0)),e,void 0)}rp({context:t,bitmapSize:i}){Y(t,0,0,i.width,i.height,this.Tp.$t().md())}Ve({context:t,bitmapSize:i,verticalPixelRatio:s}){if(this.Tp.W().timeScale.borderVisible){t.fillStyle=this.Vm();const e=Math.max(1,Math.floor(this.Dm().C*s));t.fillRect(0,0,i.width,e)}}lp(t){const i=this.Tp.$t().St(),s=i.ja();if(!s||0===s.length)return;const e=this.U_.maxTickMarkWeight(s),n=this.Dm(),h=i.W();h.borderVisible&&h.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:e})=>{t.strokeStyle=this.Vm(),t.fillStyle=this.Vm();const h=Math.max(1,Math.floor(i)),r=Math.floor(.5*i);t.beginPath();const o=Math.round(n.T*e);for(let e=s.length;e--;){const n=Math.round(s[e].coord*i);t.rect(n-r,0,h,o)}t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{const i=n.C+n.T+n.L+n.P/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.$(),t.font=this.Jv();for(const n of s)if(n.weight=e){const s=n.needAlignCoordinate?this.Im(t,n.coord,n.label):n.coord;t.fillText(n.label,s,i)}}))}Im(t,i,s){const e=this.Pv.xi(t,s),n=e/2,h=Math.floor(i-n)+.5;return h<0?i+=Math.abs(0-h):h+e>this.Cv.width&&(i-=Math.abs(this.Cv.width-(h+e))),i}Bm(t,i){const s=this.Dm();for(const e of t)for(const t of e.Qi())t.gt().K(i,s)}Vm(){return this.Tp.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}Jv(){return I(this.j(),this.cn.fontFamily)}zm(){return I(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 ti,Om:0});const t=this.k,i=this.Jv();if(t.R!==i){const s=this.j();t.P=s,t.R=i,t.L=3*s/12,t.B=3*s/12,t.ji=9*s/12,t.N=0,t.Om=4*s/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 s={_d:this.Tp.$t()._d()},e=()=>i.leftPriceScale.borderVisible&&t.St().W().borderVisible,n=()=>t.md();i.leftPriceScale.visible&&null===this.vm&&(this.vm=new ze("left",i,s,e,n),this.Mm.appendChild(this.vm.Kv())),i.rightPriceScale.visible&&null===this.pm&&(this.pm=new ze("right",i,s,e,n),this.xm.appendChild(this.pm.Kv()))}}const Oe=!!Gs&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!Gs&&((null===(Ee=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===Ee?void 0:Ee.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var Ee;class Te{ constructor(t,i,s){var e;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 E,this.wp=new E,this.Pc=new E,this.Hm=null,this.$m=null,this.Um=t,this.cn=i,this.U_=s,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%",(e=this.gm).style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent",this.qm=document.createElement("table"),this.qm.setAttribute("cellspacing","0"),this.gm.appendChild(this.qm),this.Ym=this.Xm.bind(this),We(this.cn)&&this.Km(!0),this.$i=new Ws(this.Dc.bind(this),this.cn,s),this.$t().Xc().l(this.Zm.bind(this),this),this.Gm=new Le(this,this.U_),this.qm.appendChild(this.Gm.Kv());const n=i.autoSize&&this.Jm();let h=this.cn.width,r=this.cn.height;if(n||0===h||0===r){const i=t.getBoundingClientRect();h=h||i.width,r=r||i.height}this.Qm(h,r),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=[],w(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(t,i,s=!1){if(this.ro===i&&this.o_===t)return;const n=function(t){const i=Math.floor(t.width),s=Math.floor(t.height);return e.size({width:i-i%2,height:s-s%2})}(e.size({width:t,height:i}));this.ro=n.height,this.o_=n.width;const h=this.ro+"px",r=this.o_+"px";w(this.gm).style.height=h,w(this.gm).style.width=r,this.qm.style.height=h,this.qm.style.width=r,s?this.rb(ut.es(),performance.now()):this.$i.Kl()}sp(t){void 0===t&&(t=ut.es());for(let i=0;i{let e=0;for(let n=0;n{w("left"===i?this.Gm.ym():this.Gm.Cm()).up(w(t),s,e)};if(this.cn.timeScale.visible){const i=this.Gm._p();if(null!==t){let e=0;this._b()&&(r("left",e,s),e=w(n.sm())._p().width),this.Gm.up(t,e,s),e+=i.width,this.ub()&&r("right",e,s)}s+=i.height}return e.size({width:i,height:s})}bb(){let t=0,i=0,s=0;for(const e of this.Lm)this._b()&&(i=Math.max(i,w(e.sm()).Gv(),this.cn.leftPriceScale.minimumWidth)),this.ub()&&(s=Math.max(s,w(e.rm()).Gv(),this.cn.rightPriceScale.minimumWidth)),t+=e.g_();i=qs(i),s=qs(s);const n=this.o_,h=this.ro,r=Math.max(n-i-s,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.Gm.Rm(),this.cn.timeScale.minimumHeight):0;var a;l=(a=l)+a%2;const c=0+l,u=h{t.zp()})),3===(null===(s=this.Wm)||void 0===s?void 0:s.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 s of t.Qn())this.ns(s,i)}Mb(t){const i=this.$i.Uc();for(let s=0;s{if(this.jm=!1,this.Em=0,null!==this.Wm){const i=this.Wm;this.Wm=null,this.rb(i,t);for(const s of i.Qn())if(5===s.qn&&!s.Ot.Ju(t)){ this.$t().Xn(s.Ot);break}}})))}gb(){this.tb()}tb(){const t=this.$i.Uc(),i=t.length,s=this.Lm.length;for(let t=i;t{const s=i.In().hl(t);null!==s&&n.set(i,s)})),null!==t){const i=null===(e=this.$i.St().Ui(t))||void 0===e?void 0:e.originalTime;void 0!==i&&(h=i)}const r=this.$t().Fc(),o=null!==r&&r.jc instanceof Ki?r.jc:void 0,l=null!==r&&void 0!==r.Sv?r.Sv.wr:void 0;return{Cb:h,se:null!=t?t:void 0,Tb:null!=i?i:void 0,Pb:o,Rb:n,Db:l,Ob:null!=s?s:void 0}}Sb(t,i,s){this.bp.m((()=>this.yb(t,i,s)))}kb(t,i,s){this.wp.m((()=>this.yb(t,i,s)))}Zm(t,i,s){this.Pc.m((()=>this.yb(t,i,s)))}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 We(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Pe(t,i){var s={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.indexOf(e)<0&&(s[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(e=Object.getOwnPropertySymbols(t);nfunction(t,i){return i?i(t):void 0===(s=t).open&&void 0===s.value;var s}(e,r)?Ve({ot:i,se:s,Cb:n},e):Ve(t(i,s,e,n,h),e)}function je(t){return{Candlestick:Ae(Be),Bar:Ae(De),Area:Ae($e),Baseline:Ae(Re),Histogram:Ae(Ne),Line:Ae(Ne),Custom:Ae(Fe)}[t]}function Ue(t){return{se:0,Bb:new Map,ha:t}}function Je(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 He(t){let i;return t.forEach((t=>{void 0===i&&(i=t.Cb)})),g(i)}class Ze{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 s=0!==this.zb.size,e=!1;const n=this.Lb.get(t);if(void 0!==n)if(1===this.Lb.size)s=!1,e=!0,this.zb.clear();else for(const i of this.Nb)i.pointData.Bb.delete(t)&&(e=!0);let h=[];if(0!==i.length){const s=i.map((t=>t.time)),n=this.U_.createConverterToInternalObj(i),r=je(t.Jh()),o=t.ya(),l=t.Ca();h=i.map(((i,h)=>{const a=n(i.time),c=this.U_.key(a);let u=this.zb.get(c);void 0===u&&(u=Ue(a),this.zb.set(c,u),e=!0);const f=r(a,u.se,i,s[h],o,l);return u.Bb.set(t,f),f}))}s&&this.Wb(),this.jb(t,h);let r=-1;if(e){const t=[];this.zb.forEach((i=>{t.push({timeWeight:0,time:i.ha,pointData:i,originalTime:He(i.Bb)})})),t.sort(((t,i)=>this.U_.key(t.time)-this.U_.key(i.time))),r=this.Hb(t)}return this.$b(t,r,function(t,i,s){const e=Je(t,s),n=Je(i,s);if(void 0!==e&&void 0!==n)return{Ql:e.Ib>=n.Ib&&e.Vb>=n.Vb}}(this.Lb.get(t),n,this.U_))}fd(t){return this.Fb(t,[])}Ub(t,i){const s=i;!function(t){void 0===t.Cb&&(t.Cb=t.time)}(s),this.U_.preprocessData(i);const e=this.U_.createConverterToInternalObj([i])(i.time),n=this.Eb.get(t);if(void 0!==n&&this.U_.key(e)this.U_.key(t.time)this.U_.key(e.ot)?Ie(i)&&s.push(i):Ie(i)?s[s.length-1]=i:s.splice(-1,1),this.Eb.set(t,i.ot)}jb(t,i){0!==i.length?(this.Lb.set(t,i.filter(Ie)),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 s=0;s{0!==i.length&&(t=Math.max(t,i[i.length-1].se))})),t}$b(t,i,s){const e={Xb:new Map,St:{Lu:this.Yb()}};if(-1!==i)this.Lb.forEach(((i,n)=>{e.Xb.set(n,{He:i,Kb:n===t?s:void 0})})),this.Lb.has(t)||e.Xb.set(t,{He:[],Kb:s}),e.St.Zb=this.Nb,e.St.Gb=i;else{const i=this.Lb.get(t);e.Xb.set(t,{He:i||[],Kb:s})}return e}}function Ke(t,i){t.se=i,t.Bb.forEach((t=>{t.se=i}))}function Ge(t){const i={value:t.Ot[3],time:t.Cb};return void 0!==t.Ab&&(i.customValues=t.Ab),i}function Xe(t){const i=Ge(t);return void 0!==t.O&&(i.color=t.O),i}function Ye(t){const i=Ge(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 qe(t){const i=Ge(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 Qe(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 tn(t){const i=Qe(t);return void 0!==t.O&&(i.color=t.O),i}function sn(t){const i=Qe(t),{O:s,At:e,Xh:n}=t;return void 0!==s&&(i.color=s),void 0!==e&&(i.borderColor=e),void 0!==n&&(i.wickColor=n),i}function en(t){return{Area:Ye,Line:Xe,Baseline:qe,Histogram:Xe,Bar:tn,Candlestick:sn,Custom:nn}[t]}function nn(t){const i=t.Cb;return Object.assign(Object.assign({},t.He),{time:i})}const hn={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},rn={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},on={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:F},ln={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},an={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},cn={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:F,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function un(){return{width:0,height:0,autoSize:!1,layout:on,crosshair:hn,grid:rn,overlayPriceScales:Object.assign({},ln),leftPriceScale:Object.assign(Object.assign({},ln),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},ln),{ visible:!0}),timeScale:an,watermark:cn,localization:{locale:Gs?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 fn{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 ct(this.Qb)?this.Jb.ob(this.Qb):0}Li(){return w(this.Jb.$t().$c(this.Qb)).Dt}}function dn(t,i,s){const e=Pe(t,["time","originalTime"]),n=Object.assign({time:i},e);return void 0!==s&&(n.originalTime=s),n}const mn={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class pn{constructor(t){this.Eh=t}applyOptions(t){this.Eh.Hh(t)}options(){return this.Eh.W()}tw(){return this.Eh}}class vn{constructor(t,i,s,e,n){this.iw=new E,this.Ls=t,this.nw=i,this.sw=s,this.U_=n,this.ew=e}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 Ms(new gs(t.from,t.to)).hu(),s=this.Ls.In();if(s.Ni())return null;const e=s.hl(i.Os(),1),n=s.hl(i.ui(),-1),h=w(s.sl()),r=w(s.Vn());if(null!==e&&null!==n&&e.se>n.se)return{barsBefore:t.from-h,barsAfter:r-t.to};const o={barsBefore:null===e||e.se===h?t.from-h:e.se-h,barsAfter:null===n||n.se===r?r-t.to:r-n.se};return null!==e&&null!==n&&(o.from=e.Cb,o.to=n.Cb),o}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 s=this.Ls.In().hl(t,i);return null===s?null:en(this.seriesType())(s)}data(){const t=en(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=>dn(t,this.U_.convertHorzItemToInternal(t.time),t.time)));this.Ls.ia(i)}markers(){return this.Ls.na().map((t=>dn(t,t.originalTime,void 0)))}applyOptions(t){this.Ls.Hh(t)}options(){return R(this.Ls.W())}priceScale(){return this.sw.priceScale(this.Ls.Dt().Ta())}createPriceLine(t){const i=T(R(mn),t),s=this.Ls.sa(i);return new pn(s)}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 bn{constructor(t,i,s){this.aw=new E,this.pu=new E,this.wm=new E,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_=s}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)},s=this.kl.Vu(i);this.$i.vd(s)}getVisibleLogicalRange(){const t=this.kl.Ru();return null===t?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){b(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),s=this.kl.Da(i,!1);return null===s?null:this.kl.It(s)}coordinateToTime(t){const i=this.$i.St(),s=i.Eu(t),e=i.Ui(s);return null===e?null:e.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({},R(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 gn(t){return function(t){if($(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:s}=t.handleScale;$(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),$(s)&&(t.handleScale.axisDoubleClickReset={time:s,price:s})}const i=t.handleScroll;$(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i})}(t),t}class wn{constructor(t,i,s){this.cw=new Map,this.dw=new Map,this.fw=new E,this.pw=new E,this.mw=new E,this.bw=new Ze(i);const e=void 0===s?R(un()):T(R(un()),gn(s));this.U_=i,this.Jb=new Te(t,e,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 n=this.Jb.$t();this.gw=new bn(n,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,s){this.autoSizeActive()||this.Jb.Qm(t,i,s)}addCustomSeries(t,i){const s=S(t),e=Object.assign(Object.assign({},c),s.defaultOptions());return this.Mw("Custom",e,i,s)}addAreaSeries(t){return this.Mw("Area",o,t)}addBaselineSeries(t){return this.Mw("Baseline",l,t)}addBarSeries(t){return this.Mw("Bar",h,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",n,t)}addHistogramSeries(t){return this.Mw("Histogram",a,t)}addLineSeries(t){return this.Mw("Line",r,t)}removeSeries(t){const i=g(this.cw.get(t)),s=this.bw.fd(i);this.Jb.$t().fd(i),this.xw(s),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 fn(this.Jb,t)}timeScale(){return this.gw}applyOptions(t){this.Jb.Hh(gn(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,s){const e=this.cw.get(s);if(void 0===e)return;const n=this.Jb.$t().cr(e);null!==n&&this.Jb.$t().ld(t,i,n)}clearCrosshairPosition(){this.Jb.$t().ad(!0)}Mw(t,i,s={},e){!function(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 s=Math.round(t);if(Math.abs(s-t)<1e-8)return i;t*=10}return i}(i.minMove))}(s.priceFormat);const n=T(R(u),R(i),s),h=this.Jb.$t().ud(t,n,e),r=new vn(h,this,this,this,this.U_);return this.cw.set(r,h),this.dw.set(h,r),r}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 g(this.dw.get(t))}ww(t){const i=new Map;t.Rb.forEach(((t,s)=>{const e=s.Jh(),n=en(e)(t);if("Custom"!==e)b(function(t){return void 0!==t.open||void 0!==t.value}(n));else{const t=s.Ca();b(!t||!1===t(n))}i.set(this.Sw(s),n)}));const s=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:s,hoveredObjectId:t.Db,seriesData:i,sourceEvent:t.Ob}}}function Sn(t,i,s){let e;if(N(t)){const i=document.getElementById(t);b(null!==i,`Cannot find element in DOM with id=${t}`),e=i}else e=t;const n=new wn(e,i,s);return i.setOptions(n.options()),n}function Mn(){return Ks}Object.assign(Object.assign({},u),c)}}]);