@nabeeltahirdeveloper/chart-sdk 1.2.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,43 @@
1
- (function(Y,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],w):(Y=typeof globalThis<"u"?globalThis:Y||self,w(Y.ChartSDK={},Y.jsxRuntime,Y.React))})(this,(function(Y,w,C){"use strict";var ji=typeof document<"u"?document.currentScript:null;function ft(s){var t=s.width,e=s.height;if(t<0)throw new Error("Negative width is not allowed for Size");if(e<0)throw new Error("Negative height is not allowed for Size");return{width:t,height:e}}function we(s,t){return s.width===t.width&&s.height===t.height}var tl=(function(){function s(t){var e=this;this._resolutionListener=function(){return e._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=t,this._installResolutionListener()}return s.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(s.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),s.prototype.subscribe=function(t){var e=this,i={next:t};return this._observers.push(i),{unsubscribe:function(){e._observers=e._observers.filter(function(n){return n!==i})}}},s.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var t=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(t,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},s.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},s.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},s.prototype._onResolutionChanged=function(){var t=this;this._observers.forEach(function(e){return e.next(t._window.devicePixelRatio)}),this._reinstallResolutionListener()},s})();function el(s){return new tl(s)}var il=(function(){function s(t,e,i){var n;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=t,this._canvasElementClientSize=ft({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=e??(function(r){return r}),this._allowResizeObserver=(n=i?.allowResizeObserver)!==null&&n!==void 0?n:!0,this._chooseAndInitObserver()}return s.prototype.dispose=function(){var t,e;if(this._canvasElement===null)throw new Error("Object is disposed");(t=this._canvasElementResizeObserver)===null||t===void 0||t.disconnect(),this._canvasElementResizeObserver=null,(e=this._devicePixelRatioObservable)===null||e===void 0||e.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(s.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"bitmapSize",{get:function(){return ft({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),s.prototype.resizeCanvasElement=function(t){this._canvasElementClientSize=ft(t),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},s.prototype.subscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners.push(t)},s.prototype.unsubscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(e){return e!==t})},Object.defineProperty(s.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),s.prototype.subscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners.push(t)},s.prototype.unsubscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(e){return e!==t})},s.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var t=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(t),this._emitSuggestedBitmapSizeChanged(t,this._suggestedBitmapSize)}},s.prototype._resizeBitmap=function(t){var e=this.bitmapSize;we(e,t)||(this.canvasElement.width=t.width,this.canvasElement.height=t.height,this._emitBitmapSizeChanged(e,t))},s.prototype._emitBitmapSizeChanged=function(t,e){var i=this;this._bitmapSizeChangedListeners.forEach(function(n){return n.call(i,t,e)})},s.prototype._suggestNewBitmapSize=function(t){var e=this._suggestedBitmapSize,i=ft(this._transformBitmapSize(t,this._canvasElementClientSize)),n=we(this.bitmapSize,i)?null:i;e===null&&n===null||e!==null&&n!==null&&we(e,n)||(this._suggestedBitmapSize=n,this._emitSuggestedBitmapSizeChanged(e,n))},s.prototype._emitSuggestedBitmapSizeChanged=function(t,e){var i=this;this._suggestedBitmapSizeChangedListeners.forEach(function(n){return n.call(i,t,e)})},s.prototype._chooseAndInitObserver=function(){var t=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}nl().then(function(e){return e?t._initResizeObserver():t._initDevicePixelRatioObservable()})},s.prototype._initDevicePixelRatioObservable=function(){var t=this;if(this._canvasElement!==null){var e=cn(this._canvasElement);if(e===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=el(e),this._devicePixelRatioObservable.subscribe(function(){return t._invalidateBitmapSize()}),this._invalidateBitmapSize()}},s.prototype._invalidateBitmapSize=function(){var t,e;if(this._canvasElement!==null){var i=cn(this._canvasElement);if(i!==null){var n=(e=(t=this._devicePixelRatioObservable)===null||t===void 0?void 0:t.value)!==null&&e!==void 0?e:i.devicePixelRatio,r=this._canvasElement.getClientRects(),o=r[0]!==void 0?rl(r[0],n):ft({width:this._canvasElementClientSize.width*n,height:this._canvasElementClientSize.height*n});this._suggestNewBitmapSize(o)}}},s.prototype._initResizeObserver=function(){var t=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(e){var i=e.find(function(o){return o.target===t._canvasElement});if(!(!i||!i.devicePixelContentBoxSize||!i.devicePixelContentBoxSize[0])){var n=i.devicePixelContentBoxSize[0],r=ft({width:n.inlineSize,height:n.blockSize});t._suggestNewBitmapSize(r)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},s})();function sl(s,t){return new il(s,t.transform,t.options)}function cn(s){return s.ownerDocument.defaultView}function nl(){return new Promise(function(s){var t=new ResizeObserver(function(e){s(e.every(function(i){return"devicePixelContentBoxSize"in i})),t.disconnect()});t.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function rl(s,t){return ft({width:Math.round(s.left*t+s.width*t)-Math.round(s.left*t),height:Math.round(s.top*t+s.height*t)-Math.round(s.top*t)})}var ol=(function(){function s(t,e,i){if(e.width===0||e.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=e,i.width===0||i.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=i,this._context=t}return s.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()}},s.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(s.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),s})();function Se(s,t){var e=s.canvasElementClientSize;if(e.width===0||e.height===0)return null;var i=s.bitmapSize;if(i.width===0||i.height===0)return null;var n=s.canvasElement.getContext("2d",t);return n===null?null:new ol(n,e,i)}const ll={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},hl={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},al={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},cl={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},ul={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},fl={color:"#26a69a",base:0},un={color:"#2196f3"},fn={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 dn,pn;function xe(s,t){const e={0:[],1:[s.lineWidth,s.lineWidth],2:[2*s.lineWidth,2*s.lineWidth],3:[6*s.lineWidth,6*s.lineWidth],4:[s.lineWidth,4*s.lineWidth]}[t];s.setLineDash(e)}function mn(s,t,e,i){s.beginPath();const n=s.lineWidth%2?.5:0;s.moveTo(e,t+n),s.lineTo(i,t+n),s.stroke()}function be(s,t){if(!s)throw new Error("Assertion failed"+(t?": "+t:""))}function Ft(s){if(s===void 0)throw new Error("Value is undefined");return s}function E(s){if(s===null)throw new Error("Value is null");return s}function Oe(s){return E(Ft(s))}(function(s){s[s.Simple=0]="Simple",s[s.WithSteps=1]="WithSteps",s[s.Curved=2]="Curved"})(dn||(dn={})),(function(s){s[s.Solid=0]="Solid",s[s.Dotted=1]="Dotted",s[s.Dashed=2]="Dashed",s[s.LargeDashed=3]="LargeDashed",s[s.SparseDotted=4]="SparseDotted"})(pn||(pn={}));const bn={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 jt(s){return s<0?0:s>255?255:Math.round(s)||0}function gn(s){return s<=0||s>1?Math.min(Math.max(s,0),1):Math.round(1e4*s)/1e4}const dl=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,pl=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,ml=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,bl=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function $e(s){(s=s.toLowerCase())in bn&&(s=bn[s]);{const t=bl.exec(s)||ml.exec(s);if(t)return[jt(parseInt(t[1],10)),jt(parseInt(t[2],10)),jt(parseInt(t[3],10)),gn(t.length<5?1:parseFloat(t[4]))]}{const t=pl.exec(s);if(t)return[jt(parseInt(t[1],16)),jt(parseInt(t[2],16)),jt(parseInt(t[3],16)),1]}{const t=dl.exec(s);if(t)return[jt(17*parseInt(t[1],16)),jt(17*parseInt(t[2],16)),jt(17*parseInt(t[3],16)),1]}throw new Error(`Cannot parse color: ${s}`)}function vn(s){return .199*s[0]+.687*s[1]+.114*s[2]}function hi(s){const t=$e(s);return{t:`rgb(${t[0]}, ${t[1]}, ${t[2]})`,i:vn(t)>160?"black":"white"}}class Ct{constructor(){this.h=[]}l(t,e,i){const n={o:t,_:e,u:i===!0};this.h.push(n)}v(t){const e=this.h.findIndex((i=>t===i.o));e>-1&&this.h.splice(e,1)}p(t){this.h=this.h.filter((e=>e._!==t))}m(t,e,i){const n=[...this.h];this.h=this.h.filter((r=>!r.u)),n.forEach((r=>r.o(t,e,i)))}M(){return this.h.length>0}S(){this.h=[]}}function Qt(s,...t){for(const e of t)for(const i in e)e[i]!==void 0&&Object.prototype.hasOwnProperty.call(e,i)&&!["__proto__","constructor","prototype"].includes(i)&&(typeof e[i]!="object"||s[i]===void 0||Array.isArray(e[i])?s[i]=e[i]:Qt(s[i],e[i]));return s}function ie(s){return typeof s=="number"&&isFinite(s)}function Ie(s){return typeof s=="number"&&s%1==0}function Ue(s){return typeof s=="string"}function ai(s){return typeof s=="boolean"}function pe(s){const t=s;if(!t||typeof t!="object")return t;let e,i,n;for(i in e=Array.isArray(t)?[]:{},t)t.hasOwnProperty(i)&&(n=t[i],e[i]=n&&typeof n=="object"?pe(n):n);return e}function gl(s){return s!==null}function We(s){return s===null?void 0:s}const Ki="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function ze(s,t,e){return t===void 0&&(t=Ki),`${e=e!==void 0?`${e} `:""}${s}px ${t}`}class vl{constructor(t){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=t}W(){const t=this.k,e=this.j(),i=this.H();return t.P===e&&t.D===i||(t.P=e,t.D=i,t.R=ze(e,i),t.L=2.5/12*e,t.B=t.L,t.A=e/12*t.T,t.I=e/12*t.T,t.N=0),t.V=this.$(),t.O=this.U(),this.k}$(){return this.F.W().layout.textColor}U(){return this.F.q()}j(){return this.F.W().layout.fontSize}H(){return this.F.W().layout.fontFamily}}class Xi{constructor(){this.Y=[]}Z(t){this.Y=t}X(t,e,i){this.Y.forEach((n=>{n.X(t,e,i)}))}}class Zt{X(t,e,i){t.useBitmapCoordinateSpace((n=>this.K(n,e,i)))}}class yl extends Zt{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(this.G===null||this.G.tt===null)return;const n=this.G.tt,r=this.G,o=Math.max(1,Math.floor(e))%2/2,l=h=>{t.beginPath();for(let a=n.to-1;a>=n.from;--a){const c=r.it[a],u=Math.round(c.nt*e)+o,d=c.st*i,b=h*i+o;t.moveTo(u,d),t.arc(u,d,b,0,2*Math.PI)}t.fill()};r.et>0&&(t.fillStyle=r.rt,l(r.ht+r.et)),t.fillStyle=r.lt,l(r.ht)}}function wl(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Sl={from:0,to:1};class xl{constructor(t,e){this.ut=new Xi,this.ct=[],this.dt=[],this.ft=!0,this.F=t,this.vt=e,this.ut.Z(this.ct)}bt(t){const e=this.F.wt();e.length!==this.ct.length&&(this.dt=e.map(wl),this.ct=this.dt.map((i=>{const n=new yl;return n.J(i),n})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const t=this.vt.W().mode===2,e=this.F.wt(),i=this.vt.xt(),n=this.F.St();e.forEach(((r,o)=>{var l;const h=this.dt[o],a=r.kt(i);if(t||a===null||!r.yt())return void(h.tt=null);const c=E(r.Ct());h.lt=a.Tt,h.ht=a.ht,h.et=a.Pt,h.it[0]._t=a._t,h.it[0].st=r.Dt().Rt(a._t,c.Vt),h.rt=(l=a.Ot)!==null&&l!==void 0?l:this.F.Bt(h.it[0].st/r.Dt().At()),h.it[0].ot=i,h.it[0].nt=n.It(i),h.tt=Sl}))}}class _l extends Zt{constructor(t){super(),this.zt=t}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:n}){if(this.zt===null)return;const r=this.zt.Lt.yt,o=this.zt.Et.yt;if(!r&&!o)return;const l=Math.round(this.zt.nt*i),h=Math.round(this.zt.st*n);t.lineCap="butt",r&&l>=0&&(t.lineWidth=Math.floor(this.zt.Lt.et*i),t.strokeStyle=this.zt.Lt.V,t.fillStyle=this.zt.Lt.V,xe(t,this.zt.Lt.Nt),(function(a,c,u,d){a.beginPath();const b=a.lineWidth%2?.5:0;a.moveTo(c+b,u),a.lineTo(c+b,d),a.stroke()})(t,l,0,e.height)),o&&h>=0&&(t.lineWidth=Math.floor(this.zt.Et.et*n),t.strokeStyle=this.zt.Et.V,t.fillStyle=this.zt.Et.V,xe(t,this.zt.Et.Nt),mn(t,h,0,e.width))}}class Cl{constructor(t){this.ft=!0,this.Ft={Lt:{et:1,Nt:0,V:"",yt:!1},Et:{et:1,Nt:0,V:"",yt:!1},nt:0,st:0},this.Wt=new _l(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(),e=E(this.jt.Ht()),i=e.$t().W().crosshair,n=this.Ft;if(i.mode===2)return n.Et.yt=!1,void(n.Lt.yt=!1);n.Et.yt=t&&this.jt.Ut(e),n.Lt.yt=t&&this.jt.qt(),n.Et.et=i.horzLine.width,n.Et.Nt=i.horzLine.style,n.Et.V=i.horzLine.color,n.Lt.et=i.vertLine.width,n.Lt.Nt=i.vertLine.style,n.Lt.V=i.vertLine.color,n.nt=this.jt.Yt(),n.st=this.jt.Zt()}}function El(s,t,e,i,n,r){s.fillRect(t+r,e,i-2*r,r),s.fillRect(t+r,e+n-r,i-2*r,r),s.fillRect(t,e,r,n),s.fillRect(t+i-r,e,r,n)}function ci(s,t,e,i,n,r){s.save(),s.globalCompositeOperation="copy",s.fillStyle=r,s.fillRect(t,e,i,n),s.restore()}function yn(s,t,e,i,n,r){s.beginPath(),s.roundRect?s.roundRect(t,e,i,n,r):(s.lineTo(t+i-r[1],e),r[1]!==0&&s.arcTo(t+i,e,t+i,e+r[1],r[1]),s.lineTo(t+i,e+n-r[2]),r[2]!==0&&s.arcTo(t+i,e+n,t+i-r[2],e+n,r[2]),s.lineTo(t+r[3],e+n),r[3]!==0&&s.arcTo(t,e+n,t,e+n-r[3],r[3]),s.lineTo(t,e+r[0]),r[0]!==0&&s.arcTo(t,e,t+r[0],e,r[0]))}function wn(s,t,e,i,n,r,o=0,l=[0,0,0,0],h=""){if(s.save(),!o||!h||h===r)return yn(s,t,e,i,n,l),s.fillStyle=r,s.fill(),void s.restore();const a=o/2;var c;yn(s,t+a,e+a,i-o,n-o,(c=-a,l.map((u=>u===0?u:u+c)))),r!=="transparent"&&(s.fillStyle=r,s.fill()),h!=="transparent"&&(s.lineWidth=o,s.strokeStyle=h,s.closePath(),s.stroke()),s.restore()}function Sn(s,t,e,i,n,r,o){s.save(),s.globalCompositeOperation="copy";const l=s.createLinearGradient(0,0,0,n);l.addColorStop(0,r),l.addColorStop(1,o),s.fillStyle=l,s.fillRect(t,e,i,n),s.restore()}class xn{constructor(t,e){this.J(t,e)}J(t,e){this.zt=t,this.Xt=e}At(t,e){return this.zt.yt?t.P+t.L+t.B:0}X(t,e,i,n){if(!this.zt.yt||this.zt.Kt.length===0)return;const r=this.zt.V,o=this.Xt.t,l=t.useBitmapCoordinateSpace((h=>{const a=h.context;a.font=e.R;const c=this.Gt(h,e,i,n),u=c.Jt;return c.Qt?wn(a,u.ti,u.ii,u.ni,u.si,o,u.ei,[u.ht,0,0,u.ht],o):wn(a,u.ri,u.ii,u.ni,u.si,o,u.ei,[0,u.ht,u.ht,0],o),this.zt.hi&&(a.fillStyle=r,a.fillRect(u.ri,u.li,u.ai-u.ri,u.oi)),this.zt._i&&(a.fillStyle=e.O,a.fillRect(c.Qt?u.ui-u.ei:0,u.ii,u.ei,u.ci-u.ii)),c}));t.useMediaCoordinateSpace((({context:h})=>{const a=l.di;h.font=e.R,h.textAlign=l.Qt?"right":"left",h.textBaseline="middle",h.fillStyle=r,h.fillText(this.zt.Kt,a.fi,(a.ii+a.ci)/2+a.pi)}))}Gt(t,e,i,n){var r;const{context:o,bitmapSize:l,mediaSize:h,horizontalPixelRatio:a,verticalPixelRatio:c}=t,u=this.zt.hi||!this.zt.mi?e.T:0,d=this.zt.bi?e.C:0,b=e.L+this.Xt.wi,p=e.B+this.Xt.gi,f=e.A,m=e.I,S=this.zt.Kt,g=e.P,x=i.Mi(o,S),M=Math.ceil(i.xi(o,S)),P=g+b+p,K=e.C+f+m+M+u,D=Math.max(1,Math.floor(c));let G=Math.round(P*c);G%2!=D%2&&(G+=1);const Z=d>0?Math.max(1,Math.floor(d*a)):0,Et=Math.round(K*a),$=Math.round(u*a),ct=(r=this.Xt.Si)!==null&&r!==void 0?r:this.Xt.ki,Nt=Math.round(ct*c)-Math.floor(.5*c),vt=Math.floor(Nt+D/2-G/2),lt=vt+G,ht=n==="right",ut=ht?h.width-d:d,Rt=ht?l.width-Z:Z;let Tt,St,xt;return ht?(Tt=Rt-Et,St=Rt-$,xt=ut-u-f-d):(Tt=Rt+Et,St=Rt+$,xt=ut+u+f),{Qt:ht,Jt:{ii:vt,li:Nt,ci:lt,ni:Et,si:G,ht:2*a,ei:Z,ti:Tt,ri:Rt,ai:St,oi:D,ui:l.width},di:{ii:vt/c,ci:lt/c,fi:xt,pi:x}}}}class ui{constructor(t){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Kt:"",yt:!1,hi:!0,mi:!1,Ot:"",V:"#FFF",_i:!1,bi:!1},this.Ti={Kt:"",yt:!1,hi:!1,mi:!0,Ot:"",V:"#FFF",_i:!0,bi:!0},this.ft=!0,this.Pi=new(t||xn)(this.Ci,this.yi),this.Ri=new(t||xn)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(t,e=!1){return Math.max(this.Pi.At(t,e),this.Ri.At(t,e))}Vi(){return this.yi.Si||0}Oi(t){this.yi.Si=t}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(t){return this.Di(),this.Ci.hi=this.Ci.hi&&t.W().ticksVisible,this.Ti.hi=this.Ti.hi&&t.W().ticksVisible,this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Pi}Ii(){return this.Di(),this.Pi.J(this.Ci,this.yi),this.Ri.J(this.Ti,this.yi),this.Ri}Di(){this.ft&&(this.Ci.hi=!0,this.Ti.hi=!1,this.zi(this.Ci,this.Ti,this.yi))}}class Tl extends ui{constructor(t,e,i){super(),this.jt=t,this.Li=e,this.Ei=i}zi(t,e,i){if(t.yt=!1,this.jt.W().mode===2)return;const n=this.jt.W().horzLine;if(!n.labelVisible)return;const r=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||r===null)return;const o=hi(n.labelBackgroundColor);i.t=o.t,t.V=o.i;const l=2/12*this.Li.P();i.wi=l,i.gi=l;const h=this.Ei(this.Li);i.ki=h.ki,t.Kt=this.Li.Fi(h._t,r),t.yt=!0}}const Ml=/[1-9]/g;class _n{constructor(){this.zt=null}J(t){this.zt=t}X(t,e){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const i=t.useMediaCoordinateSpace((({context:d})=>(d.font=e.R,Math.round(e.Wi.xi(d,E(this.zt).Kt,Ml)))));if(i<=0)return;const n=e.ji,r=i+2*n,o=r/2,l=this.zt.Hi;let h=this.zt.ki,a=Math.floor(h-o)+.5;a<0?(h+=Math.abs(0-a),a=Math.floor(h-o)+.5):a+r>l&&(h-=Math.abs(l-(a+r)),a=Math.floor(h-o)+.5);const c=a+r,u=Math.ceil(0+e.C+e.T+e.L+e.P+e.B);t.useBitmapCoordinateSpace((({context:d,horizontalPixelRatio:b,verticalPixelRatio:p})=>{const f=E(this.zt);d.fillStyle=f.t;const m=Math.round(a*b),S=Math.round(0*p),g=Math.round(c*b),x=Math.round(u*p),M=Math.round(2*b);if(d.beginPath(),d.moveTo(m,S),d.lineTo(m,x-M),d.arcTo(m,x,m+M,x,M),d.lineTo(g-M,x),d.arcTo(g,x,g,x-M,M),d.lineTo(g,S),d.fill(),f.hi){const P=Math.round(f.ki*b),K=S,D=Math.round((K+e.T)*p);d.fillStyle=f.V;const G=Math.max(1,Math.floor(b)),Z=Math.floor(.5*b);d.fillRect(P-Z,K,G,D-K)}})),t.useMediaCoordinateSpace((({context:d})=>{const b=E(this.zt),p=0+e.C+e.T+e.L+e.P/2;d.font=e.R,d.textAlign="left",d.textBaseline="middle",d.fillStyle=b.V;const f=e.Wi.Mi(d,"Apr0");d.translate(a+n,p+f),d.fillText(b.Kt,0,0)}))}}class kl{constructor(t,e,i){this.ft=!0,this.Wt=new _n,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=t,this.$i=e,this.Ei=i}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,this.vt.W().mode===2)return;const e=this.vt.W().vertLine;if(!e.labelVisible)return;const i=this.$i.St();if(i.Ni())return;t.Hi=i.Hi();const n=this.Ei();if(n===null)return;t.ki=n.ki;const r=i.Ui(this.vt.xt());t.Kt=i.qi(E(r)),t.yt=!0;const o=hi(e.labelBackgroundColor);t.t=o.t,t.V=o.i,t.hi=i.W().ticksVisible}}class Ji{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(t){this.Zi=t}Dt(){return this.Yi}Gi(t){this.Yi=t}Ji(t){return[]}Qi(){return[]}yt(){return!0}}var Cn;(function(s){s[s.Normal=0]="Normal",s[s.Magnet=1]="Magnet",s[s.Hidden=2]="Hidden"})(Cn||(Cn={}));class Ll extends Ji{constructor(t,e){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=e,this.dn=new xl(t,this),this.fn=((n,r)=>o=>{const l=r(),h=n();if(o===E(this.tn).vn())return{_t:h,ki:l};{const a=E(o.Ct());return{_t:o.pn(l,a),ki:l}}})((()=>this.nn),(()=>this.an));const i=((n,r)=>()=>{const o=this.$i.St().mn(n()),l=r();return o&&Number.isFinite(l)?{ot:o,ki:l}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new kl(this,t,i),this.wn=new Cl(this)}W(){return this.cn}gn(t,e){this._n=t,this.un=e}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(t,e,i){this.hn||(this.hn=!0),this.en=!0,this.yn(t,e,i)}xt(){return this.sn}Yt(){return this.ln}Zt(){return this.an}yt(){return this.en}Cn(){this.en=!1,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn()}Pn(t){return this.tn!==null?[this.wn,this.dn]:[]}Ut(t){return t===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(t,e){this.en&&this.tn===t||this.rn.clear();const i=[];return this.tn===t&&i.push(this.Dn(this.rn,e,this.fn)),i}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach((t=>t.bt())),this.bn.bt(),this.dn.bt()}On(t){return t&&!t.vn().Ni()?t.vn():null}yn(t,e,i){this.Bn(t,e,i)&&this.Vn()}Bn(t,e,i){const n=this.ln,r=this.an,o=this.nn,l=this.sn,h=this.tn,a=this.On(i);this.sn=t,this.ln=isNaN(t)?NaN:this.$i.St().It(t),this.tn=i;const c=a!==null?a.Ct():null;return a!==null&&c!==null?(this.nn=e,this.an=a.Rt(e,c)):(this.nn=NaN,this.an=NaN),n!==this.ln||r!==this.an||l!==this.sn||o!==this.nn||h!==this.tn}Tn(){const t=this.$i.wt().map((i=>i.In().An())).filter(gl),e=t.length===0?null:Math.max(...t);this.sn=e!==null?e:NaN}Dn(t,e,i){let n=t.get(e);return n===void 0&&(n=new Tl(this,e,i),t.set(e,n)),n}}function fi(s){return s==="left"||s==="right"}class Pt{constructor(t){this.zn=new Map,this.Ln=[],this.En=t}Nn(t,e){const i=(function(n,r){return n===void 0?r:{Fn:Math.max(n.Fn,r.Fn),Wn:n.Wn||r.Wn}})(this.zn.get(t),e);this.zn.set(t,i)}jn(){return this.En}Hn(t){const e=this.zn.get(t);return e===void 0?{Fn:this.En}:{Fn:Math.max(this.En,e.Fn),Wn:e.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(t){this.Un(),this.Ln=[{qn:1,Vt:t}]}Zn(t){this.Xn(),this.Ln.push({qn:5,Vt:t})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(t){this.Un(),this.Ln.push({qn:2,Vt:t})}Jn(t){this.Un(),this.Ln.push({qn:3,Vt:t})}Qn(){return this.Ln}ts(t){for(const e of t.Ln)this.ns(e);this.En=Math.max(this.En,t.En),t.zn.forEach(((e,i)=>{this.Nn(i,e)}))}static ss(){return new Pt(2)}static es(){return new Pt(3)}ns(t){switch(t.qn){case 0:this.$n();break;case 1:this.Yn(t.Vt);break;case 2:this.Gn(t.Vt);break;case 3:this.Jn(t.Vt);break;case 4:this.Kn();break;case 5:this.Zn(t.Vt);break;case 6:this.Xn()}}Xn(){const t=this.Ln.findIndex((e=>e.qn===5));t!==-1&&this.Ln.splice(t,1)}}const En=".";function me(s,t){if(!ie(s))return"n/a";if(!Ie(t))throw new TypeError("invalid length");if(t<0||t>16)throw new TypeError("invalid length");return t===0?s.toString():("0000000000000000"+s.toString()).slice(-t)}class di{constructor(t,e){if(e||(e=1),ie(t)&&Ie(t)||(t=100),t<0)throw new TypeError("invalid base");this.Li=t,this.rs=e,this.hs()}format(t){const e=t<0?"−":"";return t=Math.abs(t),e+this.ls(t)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let t=this.Li;for(;t>1;)t/=10,this._s++}}ls(t){const e=this.Li/this.rs;let i=Math.floor(t),n="";const r=this._s!==void 0?this._s:NaN;if(e>1){let o=+(Math.round(t*e)-i*e).toFixed(this._s);o>=e&&(o-=e,i+=1),n=En+me(+o.toFixed(this._s)*this.rs,r)}else i=Math.round(i*e)/e,r>0&&(n=En+me(0,r));return i.toFixed(0)+n}}class Tn extends di{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class Ol{constructor(t){this.us=t}format(t){let e="";return t<0&&(e="-",t=-t),t<995?e+this.cs(t):t<999995?e+this.cs(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),e+this.cs(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),e+this.cs(t/1e9)+"B")}cs(t){let e;const i=Math.pow(10,this.us);return e=(t=Math.round(t*i)/i)>=1e-15&&t<1?t.toFixed(this.us).replace(/\.?0+$/,""):String(t),e.replace(/(\.[1-9]*)0+$/,((n,r)=>r))}}function Mn(s,t,e,i,n,r,o){if(t.length===0||i.from>=t.length||i.to<=0)return;const{context:l,horizontalPixelRatio:h,verticalPixelRatio:a}=s,c=t[i.from];let u=r(s,c),d=c;if(i.to-i.from<2){const b=n/2;l.beginPath();const p={nt:c.nt-b,st:c.st},f={nt:c.nt+b,st:c.st};l.moveTo(p.nt*h,p.st*a),l.lineTo(f.nt*h,f.st*a),o(s,u,p,f)}else{const b=(f,m)=>{o(s,u,d,m),l.beginPath(),u=f,d=m};let p=d;l.beginPath(),l.moveTo(c.nt*h,c.st*a);for(let f=i.from+1;f<i.to;++f){p=t[f];const m=r(s,p);switch(e){case 0:l.lineTo(p.nt*h,p.st*a);break;case 1:l.lineTo(p.nt*h,t[f-1].st*a),m!==u&&(b(m,p),l.lineTo(p.nt*h,t[f-1].st*a)),l.lineTo(p.nt*h,p.st*a);break;case 2:{const[S,g]=zl(t,f-1,f);l.bezierCurveTo(S.nt*h,S.st*a,g.nt*h,g.st*a,p.nt*h,p.st*a);break}}e!==1&&m!==u&&(b(m,p),l.moveTo(p.nt*h,p.st*a))}(d!==p||d===p&&e===1)&&o(s,u,d,p)}}const kn=6;function Gi(s,t){return{nt:s.nt-t.nt,st:s.st-t.st}}function Ln(s,t){return{nt:s.nt/t,st:s.st/t}}function zl(s,t,e){const i=Math.max(0,t-1),n=Math.min(s.length-1,e+1);var r,o;return[(r=s[t],o=Ln(Gi(s[e],s[i]),kn),{nt:r.nt+o.nt,st:r.st+o.st}),Gi(s[e],Ln(Gi(s[n],s[t]),kn))]}function Pl(s,t,e,i,n){const{context:r,horizontalPixelRatio:o,verticalPixelRatio:l}=t;r.lineTo(n.nt*o,s*l),r.lineTo(i.nt*o,s*l),r.closePath(),r.fillStyle=e,r.fill()}class On extends Zt{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K(t){var e;if(this.G===null)return;const{it:i,tt:n,ds:r,et:o,Nt:l,fs:h}=this.G,a=(e=this.G.vs)!==null&&e!==void 0?e:this.G.ps?0:t.mediaSize.height;if(n===null)return;const c=t.context;c.lineCap="butt",c.lineJoin="round",c.lineWidth=o,xe(c,l),c.lineWidth=1,Mn(t,i,h,n,r,this.bs.bind(this),Pl.bind(null,a))}}function Yi(s,t,e){return Math.min(Math.max(s,t),e)}function pi(s,t,e){return t-s<=e}function zn(s){const t=Math.ceil(s);return t%2==0?t-1:t}class Qi{ws(t,e){const i=this.gs,{Ms:n,xs:r,Ss:o,ks:l,ys:h,vs:a}=e;if(this.Cs===void 0||i===void 0||i.Ms!==n||i.xs!==r||i.Ss!==o||i.ks!==l||i.vs!==a||i.ys!==h){const c=t.context.createLinearGradient(0,0,0,h);if(c.addColorStop(0,n),a!=null){const u=Yi(a*t.verticalPixelRatio/h,0,1);c.addColorStop(u,r),c.addColorStop(u,o)}c.addColorStop(1,l),this.Cs=c,this.gs=e}return this.Cs}}class Nl extends On{constructor(){super(...arguments),this.Ts=new Qi}bs(t,e){return this.Ts.ws(t,{Ms:e.Ps,xs:"",Ss:"",ks:e.Rs,ys:t.bitmapSize.height})}}function Rl(s,t){const e=s.context;e.strokeStyle=t,e.stroke()}class Pn extends Zt{constructor(){super(...arguments),this.G=null}J(t){this.G=t}K(t){if(this.G===null)return;const{it:e,tt:i,ds:n,fs:r,et:o,Nt:l,Ds:h}=this.G;if(i===null)return;const a=t.context;a.lineCap="butt",a.lineWidth=o*t.verticalPixelRatio,xe(a,l),a.lineJoin="round";const c=this.Vs.bind(this);r!==void 0&&Mn(t,e,r,i,n,c,Rl),h&&(function(u,d,b,p,f){const{horizontalPixelRatio:m,verticalPixelRatio:S,context:g}=u;let x=null;const M=Math.max(1,Math.floor(m))%2/2,P=b*S+M;for(let K=p.to-1;K>=p.from;--K){const D=d[K];if(D){const G=f(u,D);G!==x&&(g.beginPath(),x!==null&&g.fill(),g.fillStyle=G,x=G);const Z=Math.round(D.nt*m)+M,Et=D.st*S;g.moveTo(Z,Et),g.arc(Z,Et,P,0,2*Math.PI)}}g.fill()})(t,e,h,i,c)}}class Nn extends Pn{Vs(t,e){return e.lt}}function Rn(s,t,e,i,n=0,r=t.length){let o=r-n;for(;0<o;){const l=o>>1,h=n+l;i(t[h],e)===s?(n=h+1,o-=l+1):o=l}return n}const He=Rn.bind(null,!0),An=Rn.bind(null,!1);function Al(s,t){return s.ot<t}function Bl(s,t){return t<s.ot}function Bn(s,t,e){const i=t.Os(),n=t.ui(),r=He(s,i,Al),o=An(s,n,Bl);if(!e)return{from:r,to:o};let l=r,h=o;return r>0&&r<s.length&&s[r].ot>=i&&(l=r-1),o>0&&o<s.length&&s[o-1].ot<=n&&(h=o+1),{from:l,to:h}}class Zi{constructor(t,e,i){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=t,this.Ns=e,this.Fs=i}bt(t){this.Bs=!0,t==="data"&&(this.As=!0),t==="options"&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),this.Ls===null?null:this.js):null}Hs(){this.zs=this.zs.map((t=>Object.assign(Object.assign({},t),this.Es.Us().$s(t.ot))))}qs(){this.Ls=null}Ws(){this.As&&(this.Ys(),this.As=!1),this.Is&&(this.Hs(),this.Is=!1),this.Bs&&(this.Zs(),this.Bs=!1)}Zs(){const t=this.Es.Dt(),e=this.Ns.St();if(this.qs(),e.Ni()||t.Ni())return;const i=e.Xs();if(i===null||this.Es.In().Ks()===0)return;const n=this.Es.Ct();n!==null&&(this.Ls=Bn(this.zs,i,this.Fs),this.Gs(t,e,n.Vt),this.Js())}}class mi extends Zi{constructor(t,e){super(t,e,!0)}Gs(t,e,i){e.Qs(this.zs,We(this.Ls)),t.te(this.zs,i,We(this.Ls))}ie(t,e){return{ot:t,_t:e,nt:NaN,st:NaN}}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map((e=>{const i=e.Vt[3];return this.se(e.ee,i,t)}))}}class Dl extends mi{constructor(t,e){super(t,e),this.js=new Xi,this.re=new Nl,this.he=new Nn,this.js.Z([this.re,this.he])}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.W();this.re.J({fs:t.lineType,it:this.zs,Nt:t.lineStyle,et:t.lineWidth,vs:null,ps:t.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:t.lineVisible?t.lineType:void 0,it:this.zs,Nt:t.lineStyle,et:t.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0})}}class Vl extends Zt{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(t){this.zt=t}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(e),this.ae>=2&&Math.max(1,Math.floor(e))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(e)):this.ae;let n=null;const r=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*e);for(let o=this.zt.tt.from;o<this.zt.tt.to;++o){const l=this.zt.In[o];n!==l.ce&&(t.fillStyle=l.ce,n=l.ce);const h=Math.floor(.5*this.oe),a=Math.round(l.nt*e),c=a-h,u=this.oe,d=c+u-1,b=Math.min(l.de,l.fe),p=Math.max(l.de,l.fe),f=Math.round(b*i)-h,m=Math.round(p*i)+h,S=Math.max(m-f,this.oe);t.fillRect(c,f,u,S);const g=Math.ceil(1.5*this.ae);if(r){if(this.zt.ve){const K=a-g;let D=Math.max(f,Math.round(l.pe*i)-h),G=D+u-1;G>f+S-1&&(G=f+S-1,D=G-u+1),t.fillRect(K,D,c-K,G-D+1)}const x=a+g;let M=Math.max(f,Math.round(l.me*i)-h),P=M+u-1;P>f+S-1&&(P=f+S-1,M=P-u+1),t.fillRect(d+1,M,x-d,P-M+1)}}}_e(t){const e=Math.floor(t);return Math.max(e,Math.floor((function(i,n){return Math.floor(.3*i*n)})(E(this.zt).le,t)))}}class Dn extends Zi{constructor(t,e){super(t,e,!1)}Gs(t,e,i){e.Qs(this.zs,We(this.Ls)),t.be(this.zs,i,We(this.Ls))}we(t,e,i){return{ot:t,ge:e.Vt[0],Me:e.Vt[1],xe:e.Vt[2],Se:e.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map((e=>this.se(e.ee,e,t)))}}class Fl extends Dn{constructor(){super(...arguments),this.js=new Vl}se(t,e,i){return Object.assign(Object.assign({},this.we(t,e,i)),i.$s(t))}Js(){const t=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:t.openVisible,ue:t.thinBars,tt:this.Ls})}}class $l extends On{constructor(){super(...arguments),this.Ts=new Qi}bs(t,e){const i=this.G;return this.Ts.ws(t,{Ms:e.ke,xs:e.ye,Ss:e.Ce,ks:e.Te,ys:t.bitmapSize.height,vs:i.vs})}}class Il extends Pn{constructor(){super(...arguments),this.Pe=new Qi}Vs(t,e){const i=this.G;return this.Pe.ws(t,{Ms:e.Re,xs:e.Re,Ss:e.De,ks:e.De,ys:t.bitmapSize.height,vs:i.vs})}}class Ul extends mi{constructor(t,e){super(t,e),this.js=new Xi,this.Ve=new $l,this.Oe=new Il,this.js.Z([this.Ve,this.Oe])}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.Ct();if(t===null)return;const e=this.Es.W(),i=this.Es.Dt().Rt(e.baseValue.price,t.Vt),n=this.Ns.St().le();this.Ve.J({it:this.zs,et:e.lineWidth,Nt:e.lineStyle,fs:e.lineType,vs:i,ps:!1,tt:this.Ls,ds:n}),this.Oe.J({it:this.zs,et:e.lineWidth,Nt:e.lineStyle,fs:e.lineVisible?e.lineType:void 0,Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,vs:i,tt:this.Ls,ds:n})}}class Wl extends Zt{constructor(){super(...arguments),this.zt=null,this.ae=0}J(t){this.zt=t}K(t){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:e}=t;this.ae=(function(r,o){if(r>=2.5&&r<=4)return Math.floor(3*o);const l=1-.2*Math.atan(Math.max(4,r)-4)/(.5*Math.PI),h=Math.floor(r*l*o),a=Math.floor(r*o),c=Math.min(h,a);return Math.max(Math.floor(o),c)})(this.zt.le,e),this.ae>=2&&Math.floor(e)%2!=this.ae%2&&this.ae--;const i=this.zt.In;this.zt.Be&&this.Ae(t,i,this.zt.tt),this.zt._i&&this.Ie(t,i,this.zt.tt);const n=this.ze(e);(!this.zt._i||this.ae>2*n)&&this.Le(t,i,this.zt.tt)}Ae(t,e,i){if(this.zt===null)return;const{context:n,horizontalPixelRatio:r,verticalPixelRatio:o}=t;let l="",h=Math.min(Math.floor(r),Math.floor(this.zt.le*r));h=Math.max(Math.floor(r),Math.min(h,this.ae));const a=Math.floor(.5*h);let c=null;for(let u=i.from;u<i.to;u++){const d=e[u];d.Ee!==l&&(n.fillStyle=d.Ee,l=d.Ee);const b=Math.round(Math.min(d.pe,d.me)*o),p=Math.round(Math.max(d.pe,d.me)*o),f=Math.round(d.de*o),m=Math.round(d.fe*o);let S=Math.round(r*d.nt)-a;const g=S+h-1;c!==null&&(S=Math.max(c+1,S),S=Math.min(S,g));const x=g-S+1;n.fillRect(S,f,x,b-f),n.fillRect(S,p+1,x,m-p),c=g}}ze(t){let e=Math.floor(1*t);this.ae<=2*e&&(e=Math.floor(.5*(this.ae-1)));const i=Math.max(Math.floor(t),e);return this.ae<=2*i?Math.max(Math.floor(t),Math.floor(1*t)):i}Ie(t,e,i){if(this.zt===null)return;const{context:n,horizontalPixelRatio:r,verticalPixelRatio:o}=t;let l="";const h=this.ze(r);let a=null;for(let c=i.from;c<i.to;c++){const u=e[c];u.Ne!==l&&(n.fillStyle=u.Ne,l=u.Ne);let d=Math.round(u.nt*r)-Math.floor(.5*this.ae);const b=d+this.ae-1,p=Math.round(Math.min(u.pe,u.me)*o),f=Math.round(Math.max(u.pe,u.me)*o);if(a!==null&&(d=Math.max(a+1,d),d=Math.min(d,b)),this.zt.le*r>2*h)El(n,d,p,b-d+1,f-p+1,h);else{const m=b-d+1;n.fillRect(d,p,m,f-p+1)}a=b}}Le(t,e,i){if(this.zt===null)return;const{context:n,horizontalPixelRatio:r,verticalPixelRatio:o}=t;let l="";const h=this.ze(r);for(let a=i.from;a<i.to;a++){const c=e[a];let u=Math.round(Math.min(c.pe,c.me)*o),d=Math.round(Math.max(c.pe,c.me)*o),b=Math.round(c.nt*r)-Math.floor(.5*this.ae),p=b+this.ae-1;if(c.ce!==l){const f=c.ce;n.fillStyle=f,l=f}this.zt._i&&(b+=h,u+=h,p-=h,d-=h),u>d||n.fillRect(b,u,p-b+1,d-u+1)}}}class Hl extends Dn{constructor(){super(...arguments),this.js=new Wl}se(t,e,i){return Object.assign(Object.assign({},this.we(t,e,i)),i.$s(t))}Js(){const t=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:t.wickVisible,_i:t.borderVisible,tt:this.Ls})}}class ql{constructor(t,e){this.Fe=t,this.Li=e}X(t,e,i){this.Fe.draw(t,this.Li,e,i)}}class ts extends Zi{constructor(t,e,i){super(t,e,!1),this.wn=i,this.js=new ql(this.wn.renderer(),(n=>{const r=t.Ct();return r===null?null:t.Dt().Rt(n,r.Vt)}))}We(t){return this.wn.priceValueBuilder(t)}je(t){return this.wn.isWhitespace(t)}Ys(){const t=this.Es.Us();this.zs=this.Es.In().ne().map((e=>Object.assign(Object.assign({ot:e.ee,nt:NaN},t.$s(e.ee)),{He:e.$e})))}Gs(t,e){e.Qs(this.zs,We(this.Ls))}Js(){this.wn.update({bars:this.zs.map(jl),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function jl(s){return{x:s.nt,time:s.ot,originalData:s.He,barColor:s.ce}}class Kl extends Zt{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(t){this.zt=t,this.Ue=[]}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(e);const n=Math.max(1,Math.floor(i)),r=Math.round(this.zt.Ye*i)-Math.floor(n/2),o=r+n;for(let l=this.zt.tt.from;l<this.zt.tt.to;l++){const h=this.zt.it[l],a=this.Ue[l-this.zt.tt.from],c=Math.round(h.st*i);let u,d;t.fillStyle=h.ce,c<=r?(u=c,d=o):(u=r,d=c-Math.floor(n/2)+n),t.fillRect(a.Os,u,a.ui-a.Os+1,d-u)}}qe(t){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const e=Math.ceil(this.zt.le*t)<=1?0:Math.max(1,Math.floor(t)),i=Math.round(this.zt.le*t)-e;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let r=this.zt.tt.from;r<this.zt.tt.to;r++){const o=this.zt.it[r],l=Math.round(o.nt*t);let h,a;if(i%2){const c=(i-1)/2;h=l-c,a=l+c}else{const c=i/2;h=l-c,a=l+c-1}this.Ue[r-this.zt.tt.from]={Os:h,ui:a,Ze:l,Xe:o.nt*t,ot:o.ot}}for(let r=this.zt.tt.from+1;r<this.zt.tt.to;r++){const o=this.Ue[r-this.zt.tt.from],l=this.Ue[r-this.zt.tt.from-1];o.ot===l.ot+1&&o.Os-l.ui!==e+1&&(l.Ze>l.Xe?l.ui=o.Os-e-1:o.Os=l.ui+e+1)}let n=Math.ceil(this.zt.le*t);for(let r=this.zt.tt.from;r<this.zt.tt.to;r++){const o=this.Ue[r-this.zt.tt.from];o.ui<o.Os&&(o.ui=o.Os);const l=o.ui-o.Os+1;n=Math.min(l,n)}if(e>0&&n<4)for(let r=this.zt.tt.from;r<this.zt.tt.to;r++){const o=this.Ue[r-this.zt.tt.from];o.ui-o.Os+1>n&&(o.Ze>o.Xe?o.ui-=1:o.Os+=1)}}}class Xl extends mi{constructor(){super(...arguments),this.js=new Kl}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,E(this.Es.Ct()).Vt)};this.js.J(t)}}class Jl extends mi{constructor(){super(...arguments),this.js=new Nn}se(t,e,i){return Object.assign(Object.assign({},this.ie(t,e)),i.$s(t))}Js(){const t=this.Es.W(),e={it:this.zs,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,et:t.lineWidth,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(e)}}const Gl=/[2-9]/g;class qe{constructor(t=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=t}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(t,e,i){return this.sr(t,e,i).width}Mi(t,e,i){const n=this.sr(t,e,i);return((n.actualBoundingBoxAscent||0)-(n.actualBoundingBoxDescent||0))/2}sr(t,e,i){const n=i||Gl,r=String(e).replace(n,"0");if(this.tr.has(r))return Ft(this.tr.get(r)).er;if(this.Ke===this.ir){const l=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(l),this.Je++,this.Ke--}t.save(),t.textBaseline="middle";const o=t.measureText(r);return t.restore(),o.width===0&&e.length||(this.tr.set(r,{er:o,rr:this.Ge}),this.Qe[this.Ge]=r,this.Ke++,this.Ge++),o}}class Yl{constructor(t){this.hr=null,this.k=null,this.lr="right",this.ar=t}_r(t,e,i){this.hr=t,this.k=e,this.lr=i}X(t){this.k!==null&&this.hr!==null&&this.hr.X(t,this.k,this.ar,this.lr)}}class Vn{constructor(t,e,i){this.ur=t,this.ar=new qe(50),this.cr=e,this.F=i,this.j=-1,this.Wt=new Yl(this.ar)}gt(){const t=this.F.dr(this.cr);if(t===null)return null;const e=t.vr(this.cr)?t.pr():this.cr.Dt();if(e===null)return null;const i=t.mr(e);if(i==="overlay")return null;const n=this.F.br();return n.P!==this.j&&(this.j=n.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),n,i),this.Wt}}class Ql extends Zt{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}wr(t,e){var i;if(!(!((i=this.zt)===null||i===void 0)&&i.yt))return null;const{st:n,et:r,gr:o}=this.zt;return e>=n-r-7&&e<=n+r+7?{Mr:this.zt,gr:o}:null}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:n}){if(this.zt===null||this.zt.yt===!1)return;const r=Math.round(this.zt.st*n);r<0||r>e.height||(t.lineCap="butt",t.strokeStyle=this.zt.V,t.lineWidth=Math.floor(this.zt.et*i),xe(t,this.zt.Nt),mn(t,r,0,e.width))}}class es{constructor(t){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new Ql,this.ft=!0,this.Es=t,this.Ns=t.$t(),this.kr.J(this.Sr)}bt(){this.ft=!0}gt(){return this.Es.yt()?(this.ft&&(this.yr(),this.ft=!1),this.kr):null}}class Zl extends es{constructor(t){super(t)}yr(){this.Sr.yt=!1;const t=this.Es.Dt(),e=t.Cr().Cr;if(e!==2&&e!==3)return;const i=this.Es.W();if(!i.baseLineVisible||!this.Es.yt())return;const n=this.Es.Ct();n!==null&&(this.Sr.yt=!0,this.Sr.st=t.Rt(n.Vt,n.Vt),this.Sr.V=i.baseLineColor,this.Sr.et=i.baseLineWidth,this.Sr.Nt=i.baseLineStyle)}}class th extends Zt{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}$e(){return this.zt}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i}){const n=this.zt;if(n===null)return;const r=Math.max(1,Math.floor(e)),o=r%2/2,l=Math.round(n.Xe.x*e)+o,h=n.Xe.y*i;t.fillStyle=n.Tr,t.beginPath();const a=Math.max(2,1.5*n.Pr)*e;t.arc(l,h,a,0,2*Math.PI,!1),t.fill(),t.fillStyle=n.Rr,t.beginPath(),t.arc(l,h,n.ht*e,0,2*Math.PI,!1),t.fill(),t.lineWidth=r,t.strokeStyle=n.Dr,t.beginPath(),t.arc(l,h,n.ht*e+r/2,0,2*Math.PI,!1),t.stroke()}}const eh=[{Vr:0,Or:.25,Br:4,Ar:10,Ir:.25,zr:0,Lr:.4,Er:.8},{Vr:.25,Or:.525,Br:10,Ar:14,Ir:0,zr:0,Lr:.8,Er:0},{Vr:.525,Or:1,Br:14,Ar:14,Ir:0,zr:0,Lr:0,Er:0}];function Fn(s,t,e,i){return(function(n,r){if(n==="transparent")return n;const o=$e(n),l=o[3];return`rgba(${o[0]}, ${o[1]}, ${o[2]}, ${r*l})`})(s,e+(i-e)*t)}function $n(s,t){const e=s%2600/2600;let i;for(const h of eh)if(e>=h.Vr&&e<=h.Or){i=h;break}be(i!==void 0,"Last price animation internal logic error");const n=(e-i.Vr)/(i.Or-i.Vr);return{Rr:Fn(t,n,i.Ir,i.zr),Dr:Fn(t,n,i.Lr,i.Er),ht:(r=n,o=i.Br,l=i.Ar,o+(l-o)*r)};var r,o,l}class ih{constructor(t){this.Wt=new th,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=t}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),this.jr.W().lastPriceAnimation===2){const t=performance.now(),e=this.Wr-t;if(e>0)return void(e<650&&(this.Wr+=2600));this.Fr=t,this.Wr=t+2600}}bt(){this.ft=!0}Ur(){this.Nr=!0}yt(){return this.jr.W().lastPriceAnimation!==0}qr(){switch(this.jr.W().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.Wr}}gt(){return this.ft?(this.Mt(),this.ft=!1,this.Nr=!1):this.Nr&&(this.Yr(),this.Nr=!1),this.Wt}Mt(){this.Wt.J(null);const t=this.jr.$t().St(),e=t.Xs(),i=this.jr.Ct();if(e===null||i===null)return;const n=this.jr.Zr(!0);if(n.Xr||!e.Kr(n.ee))return;const r={x:t.It(n.ee),y:this.jr.Dt().Rt(n._t,i.Vt)},o=n.V,l=this.jr.W().lineWidth,h=$n(this.Gr(),o);this.Wt.J({Tr:o,Pr:l,Rr:h.Rr,Dr:h.Dr,ht:h.ht,Xe:r})}Yr(){const t=this.Wt.$e();if(t!==null){const e=$n(this.Gr(),t.Tr);t.Rr=e.Rr,t.Dr=e.Dr,t.ht=e.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function je(s,t){return zn(Math.min(Math.max(s,12),30)*t)}function Ke(s,t){switch(s){case"arrowDown":case"arrowUp":return je(t,1);case"circle":return je(t,.8);case"square":return je(t,.7)}}function In(s){return(function(t){const e=Math.ceil(t);return e%2!=0?e-1:e})(je(s,1))}function Un(s){return Math.max(je(s,.1),3)}function Wn(s,t,e){return t?s:e?Math.ceil(s/2):0}function Hn(s,t,e,i,n){const r=Ke("square",e),o=(r-1)/2,l=s-o,h=t-o;return i>=l&&i<=l+r&&n>=h&&n<=h+r}function qn(s,t,e,i){const n=(Ke("arrowUp",i)-1)/2*e.Jr,r=(zn(i/2)-1)/2*e.Jr;t.beginPath(),s?(t.moveTo(e.nt-n,e.st),t.lineTo(e.nt,e.st-n),t.lineTo(e.nt+n,e.st),t.lineTo(e.nt+r,e.st),t.lineTo(e.nt+r,e.st+n),t.lineTo(e.nt-r,e.st+n),t.lineTo(e.nt-r,e.st)):(t.moveTo(e.nt-n,e.st),t.lineTo(e.nt,e.st+n),t.lineTo(e.nt+n,e.st),t.lineTo(e.nt+r,e.st),t.lineTo(e.nt+r,e.st-n),t.lineTo(e.nt-r,e.st-n),t.lineTo(e.nt-r,e.st)),t.fill()}function sh(s,t,e,i,n,r){return Hn(t,e,i,n,r)}class nh extends Zt{constructor(){super(...arguments),this.zt=null,this.ar=new qe,this.j=-1,this.H="",this.Qr=""}J(t){this.zt=t}_r(t,e){this.j===t&&this.H===e||(this.j=t,this.H=e,this.Qr=ze(t,e),this.ar.nr())}wr(t,e){if(this.zt===null||this.zt.tt===null)return null;for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const n=this.zt.it[i];if(oh(n,t,e))return{Mr:n.th,gr:n.gr}}return null}K({context:t,horizontalPixelRatio:e,verticalPixelRatio:i},n,r){if(this.zt!==null&&this.zt.tt!==null){t.textBaseline="middle",t.font=this.Qr;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o];l.Kt!==void 0&&(l.Kt.Hi=this.ar.xi(t,l.Kt.ih),l.Kt.At=this.j,l.Kt.nt=l.nt-l.Kt.Hi/2),rh(l,t,e,i)}}}}function rh(s,t,e,i){t.fillStyle=s.V,s.Kt!==void 0&&(function(n,r,o,l,h,a){n.save(),n.scale(h,a),n.fillText(r,o,l),n.restore()})(t,s.Kt.ih,s.Kt.nt,s.Kt.st,e,i),(function(n,r,o){if(n.Ks!==0){switch(n.nh){case"arrowDown":return void qn(!1,r,o,n.Ks);case"arrowUp":return void qn(!0,r,o,n.Ks);case"circle":return void(function(l,h,a){const c=(Ke("circle",a)-1)/2;l.beginPath(),l.arc(h.nt,h.st,c*h.Jr,0,2*Math.PI,!1),l.fill()})(r,o,n.Ks);case"square":return void(function(l,h,a){const c=Ke("square",a),u=(c-1)*h.Jr/2,d=h.nt-u,b=h.st-u;l.fillRect(d,b,c*h.Jr,c*h.Jr)})(r,o,n.Ks)}n.nh}})(s,t,(function(n,r,o){const l=Math.max(1,Math.floor(r))%2/2;return{nt:Math.round(n.nt*r)+l,st:n.st*o,Jr:r}})(s,e,i))}function oh(s,t,e){return!(s.Kt===void 0||!(function(i,n,r,o,l,h){const a=o/2;return l>=i&&l<=i+r&&h>=n-a&&h<=n+a})(s.Kt.nt,s.Kt.st,s.Kt.Hi,s.Kt.At,t,e))||(function(i,n,r){if(i.Ks===0)return!1;switch(i.nh){case"arrowDown":case"arrowUp":return sh(0,i.nt,i.st,i.Ks,n,r);case"circle":return(function(o,l,h,a,c){const u=2+Ke("circle",h)/2,d=o-a,b=l-c;return Math.sqrt(d*d+b*b)<=u})(i.nt,i.st,i.Ks,n,r);case"square":return Hn(i.nt,i.st,i.Ks,n,r)}})(s,t,e)}function lh(s,t,e,i,n,r,o,l,h){const a=ie(e)?e:e.Se,c=ie(e)?e:e.Me,u=ie(e)?e:e.xe,d=ie(t.size)?Math.max(t.size,0):1,b=In(l.le())*d,p=b/2;switch(s.Ks=b,t.position){case"inBar":return s.st=o.Rt(a,h),void(s.Kt!==void 0&&(s.Kt.st=s.st+p+r+.6*n));case"aboveBar":return s.st=o.Rt(c,h)-p-i.sh,s.Kt!==void 0&&(s.Kt.st=s.st-p-.6*n,i.sh+=1.2*n),void(i.sh+=b+r);case"belowBar":return s.st=o.Rt(u,h)+p+i.eh,s.Kt!==void 0&&(s.Kt.st=s.st+p+r+.6*n,i.eh+=1.2*n),void(i.eh+=b+r)}t.position}class hh{constructor(t,e){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new nh,this.jr=t,this.$i=e,this.zt={it:[],tt:null}}bt(t){this.ft=!0,this.hh=!0,t==="data"&&(this.rh=!0,this.oh=null)}gt(t){if(!this.jr.yt())return null;this.ft&&this._h();const e=this.$i.W().layout;return this.Wt._r(e.fontSize,e.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const t=this.$i.St().le(),e=Un(t),i=1.5*In(t)+2*e,n=this.fh();this.ah={above:Wn(i,n.aboveBar,n.inBar),below:Wn(i,n.belowBar,n.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((t,e)=>(t[e.position]||(t[e.position]=!0),t)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const t=this.jr.Dt(),e=this.$i.St(),i=this.jr.dh();this.rh&&(this.zt.it=i.map((c=>({ot:c.time,nt:0,st:0,Ks:0,nh:c.shape,V:c.color,th:c.th,gr:c.id,Kt:void 0}))),this.rh=!1);const n=this.$i.W().layout;this.zt.tt=null;const r=e.Xs();if(r===null)return;const o=this.jr.Ct();if(o===null||this.zt.it.length===0)return;let l=NaN;const h=Un(e.le()),a={sh:h,eh:h};this.zt.tt=Bn(this.zt.it,r,!0);for(let c=this.zt.tt.from;c<this.zt.tt.to;c++){const u=i[c];u.time!==l&&(a.sh=h,a.eh=h,l=u.time);const d=this.zt.it[c];d.nt=e.It(u.time),u.text!==void 0&&u.text.length>0&&(d.Kt={ih:u.text,nt:0,st:0,Hi:0,At:0});const b=this.jr.ph(u.time);b!==null&&lh(d,u,b,a,n.fontSize,h,t,e,o.Vt)}this.ft=!1}}class ah extends es{constructor(t){super(t)}yr(){const t=this.Sr;t.yt=!1;const e=this.Es.W();if(!e.priceLineVisible||!this.Es.yt())return;const i=this.Es.Zr(e.priceLineSource===0);i.Xr||(t.yt=!0,t.st=i.ki,t.V=this.Es.mh(i.V),t.et=e.priceLineWidth,t.Nt=e.priceLineStyle)}}class ch extends ui{constructor(t){super(),this.jt=t}zi(t,e,i){t.yt=!1,e.yt=!1;const n=this.jt;if(!n.yt())return;const r=n.W(),o=r.lastValueVisible,l=n.bh()!=="",h=r.seriesLastValueMode===0,a=n.Zr(!1);if(a.Xr)return;o&&(t.Kt=this.wh(a,o,h),t.yt=t.Kt.length!==0),(l||h)&&(e.Kt=this.gh(a,o,l,h),e.yt=e.Kt.length>0);const c=n.mh(a.V),u=hi(c);i.t=u.t,i.ki=a.ki,e.Ot=n.$t().Bt(a.ki/n.Dt().At()),t.Ot=c,t.V=u.i,e.V=u.i}gh(t,e,i,n){let r="";const o=this.jt.bh();return i&&o.length!==0&&(r+=`${o} `),e&&n&&(r+=this.jt.Dt().Mh()?t.xh:t.Sh),r.trim()}wh(t,e,i){return e?i?this.jt.Dt().Mh()?t.Sh:t.xh:t.Kt:""}}function jn(s,t,e,i){const n=Number.isFinite(t),r=Number.isFinite(e);return n&&r?s(t,e):n||r?n?t:e:i}class It{constructor(t,e){this.kh=t,this.yh=e}Ch(t){return t!==null&&this.kh===t.kh&&this.yh===t.yh}Th(){return new It(this.kh,this.yh)}Ph(){return this.kh}Rh(){return this.yh}Dh(){return this.yh-this.kh}Ni(){return this.yh===this.kh||Number.isNaN(this.yh)||Number.isNaN(this.kh)}ts(t){return t===null?this:new It(jn(Math.min,this.Ph(),t.Ph(),-1/0),jn(Math.max,this.Rh(),t.Rh(),1/0))}Vh(t){if(!ie(t)||this.yh-this.kh===0)return;const e=.5*(this.yh+this.kh);let i=this.yh-e,n=this.kh-e;i*=t,n*=t,this.yh=e+i,this.kh=e+n}Oh(t){ie(t)&&(this.yh+=t,this.kh+=t)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(t){return t===null?null:new It(t.minValue,t.maxValue)}}class bi{constructor(t,e){this.Ih=t,this.zh=e||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return this.Ih===null?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(t){return t===null?null:new bi(It.Ah(t.priceRange),t.margins)}}class uh extends es{constructor(t,e){super(t),this.Nh=e}yr(){const t=this.Sr;t.yt=!1;const e=this.Nh.W();if(!this.Es.yt()||!e.lineVisible)return;const i=this.Nh.Fh();i!==null&&(t.yt=!0,t.st=i,t.V=e.color,t.et=e.lineWidth,t.Nt=e.lineStyle,t.gr=this.Nh.W().id)}}class fh extends ui{constructor(t,e){super(),this.jr=t,this.Nh=e}zi(t,e,i){t.yt=!1,e.yt=!1;const n=this.Nh.W(),r=n.axisLabelVisible,o=n.title!=="",l=this.jr;if(!r||!l.yt())return;const h=this.Nh.Fh();if(h===null)return;o&&(e.Kt=n.title,e.yt=!0),e.Ot=l.$t().Bt(h/l.Dt().At()),t.Kt=this.Wh(n.price),t.yt=!0;const a=hi(n.axisLabelColor||n.color);i.t=a.t;const c=n.axisLabelTextColor||a.i;t.V=c,e.V=c,i.ki=h}Wh(t){const e=this.jr.Ct();return e===null?"":this.jr.Dt().Fi(t,e.Vt)}}class dh{constructor(t,e){this.jr=t,this.cn=e,this.jh=new uh(t,this),this.ur=new fh(t,this),this.Hh=new Vn(this.ur,t,t.$t())}$h(t){Qt(this.cn,t),this.bt(),this.jr.$t().Uh()}W(){return this.cn}qh(){return this.jh}Yh(){return this.Hh}Zh(){return this.ur}bt(){this.jh.bt(),this.ur.bt()}Fh(){const t=this.jr,e=t.Dt();if(t.$t().St().Ni()||e.Ni())return null;const i=t.Ct();return i===null?null:e.Rt(this.cn.price,i.Vt)}}class ph extends Ji{constructor(t){super(),this.$i=t}$t(){return this.$i}}const mh={Bar:(s,t,e,i)=>{var n;const r=t.upColor,o=t.downColor,l=E(s(e,i)),h=Oe(l.Vt[0])<=Oe(l.Vt[3]);return{ce:(n=l.V)!==null&&n!==void 0?n:h?r:o}},Candlestick:(s,t,e,i)=>{var n,r,o;const l=t.upColor,h=t.downColor,a=t.borderUpColor,c=t.borderDownColor,u=t.wickUpColor,d=t.wickDownColor,b=E(s(e,i)),p=Oe(b.Vt[0])<=Oe(b.Vt[3]);return{ce:(n=b.V)!==null&&n!==void 0?n:p?l:h,Ne:(r=b.Ot)!==null&&r!==void 0?r:p?a:c,Ee:(o=b.Xh)!==null&&o!==void 0?o:p?u:d}},Custom:(s,t,e,i)=>{var n;return{ce:(n=E(s(e,i)).V)!==null&&n!==void 0?n:t.color}},Area:(s,t,e,i)=>{var n,r,o,l;const h=E(s(e,i));return{ce:(n=h.lt)!==null&&n!==void 0?n:t.lineColor,lt:(r=h.lt)!==null&&r!==void 0?r:t.lineColor,Ps:(o=h.Ps)!==null&&o!==void 0?o:t.topColor,Rs:(l=h.Rs)!==null&&l!==void 0?l:t.bottomColor}},Baseline:(s,t,e,i)=>{var n,r,o,l,h,a;const c=E(s(e,i));return{ce:c.Vt[3]>=t.baseValue.price?t.topLineColor:t.bottomLineColor,Re:(n=c.Re)!==null&&n!==void 0?n:t.topLineColor,De:(r=c.De)!==null&&r!==void 0?r:t.bottomLineColor,ke:(o=c.ke)!==null&&o!==void 0?o:t.topFillColor1,ye:(l=c.ye)!==null&&l!==void 0?l:t.topFillColor2,Ce:(h=c.Ce)!==null&&h!==void 0?h:t.bottomFillColor1,Te:(a=c.Te)!==null&&a!==void 0?a:t.bottomFillColor2}},Line:(s,t,e,i)=>{var n,r;const o=E(s(e,i));return{ce:(n=o.V)!==null&&n!==void 0?n:t.color,lt:(r=o.V)!==null&&r!==void 0?r:t.color}},Histogram:(s,t,e,i)=>{var n;return{ce:(n=E(s(e,i)).V)!==null&&n!==void 0?n:t.color}}};class bh{constructor(t){this.Kh=(e,i)=>i!==void 0?i.Vt:this.jr.In().Gh(e),this.jr=t,this.Jh=mh[t.Qh()]}$s(t,e){return this.Jh(this.Kh,this.jr.W(),t,e)}}var Kn;(function(s){s[s.NearestLeft=-1]="NearestLeft",s[s.None=0]="None",s[s.NearestRight=1]="NearestRight"})(Kn||(Kn={}));const ge=30;class gh{constructor(){this.tl=[],this.il=new Map,this.nl=new Map}sl(){return this.Ks()>0?this.tl[this.tl.length-1]:null}el(){return this.Ks()>0?this.rl(0):null}An(){return this.Ks()>0?this.rl(this.tl.length-1):null}Ks(){return this.tl.length}Ni(){return this.Ks()===0}Kr(t){return this.hl(t,0)!==null}Gh(t){return this.ll(t)}ll(t,e=0){const i=this.hl(t,e);return i===null?null:Object.assign(Object.assign({},this.al(i)),{ee:this.rl(i)})}ne(){return this.tl}ol(t,e,i){if(this.Ni())return null;let n=null;for(const r of i)n=gi(n,this._l(t,e,r));return n}J(t){this.nl.clear(),this.il.clear(),this.tl=t}rl(t){return this.tl[t].ee}al(t){return this.tl[t]}hl(t,e){const i=this.ul(t);if(i===null&&e!==0)switch(e){case-1:return this.cl(t);case 1:return this.dl(t);default:throw new TypeError("Unknown search mode")}return i}cl(t){let e=this.fl(t);return e>0&&(e-=1),e!==this.tl.length&&this.rl(e)<t?e:null}dl(t){const e=this.vl(t);return e!==this.tl.length&&t<this.rl(e)?e:null}ul(t){const e=this.fl(t);return e===this.tl.length||t<this.tl[e].ee?null:e}fl(t){return He(this.tl,t,((e,i)=>e.ee<i))}vl(t){return An(this.tl,t,((e,i)=>e.ee>i))}pl(t,e,i){let n=null;for(let r=t;r<e;r++){const o=this.tl[r].Vt[i];Number.isNaN(o)||(n===null?n={ml:o,bl:o}:(o<n.ml&&(n.ml=o),o>n.bl&&(n.bl=o)))}return n}_l(t,e,i){if(this.Ni())return null;let n=null;const r=E(this.el()),o=E(this.An()),l=Math.max(t,r),h=Math.min(e,o),a=Math.ceil(l/ge)*ge,c=Math.max(a,Math.floor(h/ge)*ge);{const d=this.fl(l),b=this.vl(Math.min(h,a,e));n=gi(n,this.pl(d,b,i))}let u=this.il.get(i);u===void 0&&(u=new Map,this.il.set(i,u));for(let d=Math.max(a+1,l);d<c;d+=ge){const b=Math.floor(d/ge);let p=u.get(b);if(p===void 0){const f=this.fl(b*ge),m=this.vl((b+1)*ge-1);p=this.pl(f,m,i),u.set(b,p)}n=gi(n,p)}{const d=this.fl(c),b=this.vl(h);n=gi(n,this.pl(d,b,i))}return n}}function gi(s,t){return s===null?t:t===null?s:{ml:Math.min(s.ml,t.ml),bl:Math.max(s.bl,t.bl)}}class vh{constructor(t){this.wl=t}X(t,e,i){this.wl.draw(t)}gl(t,e,i){var n,r;(r=(n=this.wl).drawBackground)===null||r===void 0||r.call(n,t)}}class is{constructor(t){this.tr=null,this.wn=t}gt(){var t;const e=this.wn.renderer();if(e===null)return null;if(((t=this.tr)===null||t===void 0?void 0:t.Ml)===e)return this.tr.xl;const i=new vh(e);return this.tr={Ml:e,xl:i},i}Sl(){var t,e,i;return(i=(e=(t=this.wn).zOrder)===null||e===void 0?void 0:e.call(t))!==null&&i!==void 0?i:"normal"}}function Xn(s){var t,e,i,n,r;return{Kt:s.text(),ki:s.coordinate(),Si:(t=s.fixedCoordinate)===null||t===void 0?void 0:t.call(s),V:s.textColor(),t:s.backColor(),yt:(i=(e=s.visible)===null||e===void 0?void 0:e.call(s))===null||i===void 0||i,hi:(r=(n=s.tickVisible)===null||n===void 0?void 0:n.call(s))===null||r===void 0||r}}class yh{constructor(t,e){this.Wt=new _n,this.kl=t,this.yl=e}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Xn(this.kl))),this.Wt}}class wh extends ui{constructor(t,e){super(),this.kl=t,this.Li=e}zi(t,e,i){const n=Xn(this.kl);i.t=n.t,t.V=n.V;const r=2/12*this.Li.P();i.wi=r,i.gi=r,i.ki=n.ki,i.Si=n.Si,t.Kt=n.Kt,t.yt=n.yt,t.hi=n.hi}}class Sh{constructor(t,e){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=t,this.jr=e}Ol(){return this.Vl}Vn(){var t,e;(e=(t=this.Vl).updateAllViews)===null||e===void 0||e.call(t)}Pn(){var t,e,i,n;const r=(i=(e=(t=this.Vl).paneViews)===null||e===void 0?void 0:e.call(t))!==null&&i!==void 0?i:[];if(((n=this.Cl)===null||n===void 0?void 0:n.Ml)===r)return this.Cl.xl;const o=r.map((l=>new is(l)));return this.Cl={Ml:r,xl:o},o}Qi(){var t,e,i,n;const r=(i=(e=(t=this.Vl).timeAxisViews)===null||e===void 0?void 0:e.call(t))!==null&&i!==void 0?i:[];if(((n=this.Tl)===null||n===void 0?void 0:n.Ml)===r)return this.Tl.xl;const o=this.jr.$t().St(),l=r.map((h=>new yh(h,o)));return this.Tl={Ml:r,xl:l},l}Rn(){var t,e,i,n;const r=(i=(e=(t=this.Vl).priceAxisViews)===null||e===void 0?void 0:e.call(t))!==null&&i!==void 0?i:[];if(((n=this.Pl)===null||n===void 0?void 0:n.Ml)===r)return this.Pl.xl;const o=this.jr.Dt(),l=r.map((h=>new wh(h,o)));return this.Pl={Ml:r,xl:l},l}Bl(){var t,e,i,n;const r=(i=(e=(t=this.Vl).priceAxisPaneViews)===null||e===void 0?void 0:e.call(t))!==null&&i!==void 0?i:[];if(((n=this.Rl)===null||n===void 0?void 0:n.Ml)===r)return this.Rl.xl;const o=r.map((l=>new is(l)));return this.Rl={Ml:r,xl:o},o}Al(){var t,e,i,n;const r=(i=(e=(t=this.Vl).timeAxisPaneViews)===null||e===void 0?void 0:e.call(t))!==null&&i!==void 0?i:[];if(((n=this.Dl)===null||n===void 0?void 0:n.Ml)===r)return this.Dl.xl;const o=r.map((l=>new is(l)));return this.Dl={Ml:r,xl:o},o}Il(t,e){var i,n,r;return(r=(n=(i=this.Vl).autoscaleInfo)===null||n===void 0?void 0:n.call(i,t,e))!==null&&r!==void 0?r:null}wr(t,e){var i,n,r;return(r=(n=(i=this.Vl).hitTest)===null||n===void 0?void 0:n.call(i,t,e))!==null&&r!==void 0?r:null}}function ss(s,t,e,i){s.forEach((n=>{t(n).forEach((r=>{r.Sl()===e&&i.push(r)}))}))}function ns(s){return s.Pn()}function xh(s){return s.Bl()}function _h(s){return s.Al()}class rs extends ph{constructor(t,e,i,n,r){super(t),this.zt=new gh,this.jh=new ah(this),this.zl=[],this.Ll=new Zl(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=e,this.$l=i;const o=new ch(this);this.rn=[o],this.Hh=new Vn(o,this,t),i!=="Area"&&i!=="Line"&&i!=="Baseline"||(this.El=new ih(this)),this.Ul(),this.ql(r)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(t){return this.cn.priceLineColor||t}Zr(t){const e={Xr:!0},i=this.Dt();if(this.$t().St().Ni()||i.Ni()||this.zt.Ni())return e;const n=this.$t().St().Xs(),r=this.Ct();if(n===null||r===null)return e;let o,l;if(t){const u=this.zt.sl();if(u===null)return e;o=u,l=u.ee}else{const u=this.zt.ll(n.ui(),-1);if(u===null||(o=this.zt.Gh(u.ee),o===null))return e;l=u.ee}const h=o.Vt[3],a=this.Us().$s(l,{Vt:o}),c=i.Rt(h,r.Vt);return{Xr:!1,_t:h,Kt:i.Fi(h,r.Vt),xh:i.Yl(h),Sh:i.Zl(h,r.Vt),V:a.ce,ki:c,ee:l}}Us(){return this.Nl!==null||(this.Nl=new bh(this)),this.Nl}W(){return this.cn}$h(t){const e=t.priceScaleId;e!==void 0&&e!==this.cn.priceScaleId&&this.$t().Xl(this,e),Qt(this.cn,t),t.priceFormat!==void 0&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(t,e){this.zt.J(t),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(e&&e.ta?this.El.$r():t.length===0&&this.El.Hr());const i=this.$t().dr(this);this.$t().ia(i),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(t){this.Fl=t,this.Ql();const e=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(e),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(t){const e=new dh(this,t);return this.zl.push(e),this.$t().Gl(this),e}ra(t){const e=this.zl.indexOf(t);e!==-1&&this.zl.splice(e,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const t=this.ha();return t===null?null:{Vt:t.Vt[3],la:t.ot}}ha(){const t=this.$t().St().Xs();if(t===null)return null;const e=t.Os();return this.zt.ll(e,1)}In(){return this.zt}ph(t){const e=this.zt.Gh(t);return e===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:e.Vt[0],Me:e.Vt[1],xe:e.Vt[2],Se:e.Vt[3]}:e.Vt[3]}aa(t){const e=[];ss(this.Hl,ns,"top",e);const i=this.El;return i!==null&&i.yt()&&(this.jl===null&&i.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),i.Ur(),e.unshift(i)),e}Pn(){const t=[];this._a()||t.push(this.Ll),t.push(this.wn,this.jh,this.dn);const e=this.zl.map((i=>i.qh()));return t.push(...e),ss(this.Hl,ns,"normal",t),t}ua(){return this.ca(ns,"bottom")}da(t){return this.ca(xh,t)}fa(t){return this.ca(_h,t)}va(t,e){return this.Hl.map((i=>i.wr(t,e))).filter((i=>i!==null))}Ji(t){return[this.Hh,...this.zl.map((e=>e.Yh()))]}Rn(t,e){if(e!==this.Yi&&!this._a())return[];const i=[...this.rn];for(const n of this.zl)i.push(n.Zh());return this.Hl.forEach((n=>{i.push(...n.Rn())})),i}Qi(){const t=[];return this.Hl.forEach((e=>{t.push(...e.Qi())})),t}Il(t,e){if(this.cn.autoscaleInfoProvider!==void 0){const i=this.cn.autoscaleInfoProvider((()=>{const n=this.pa(t,e);return n===null?null:n.Bh()}));return bi.Ah(i)}return this.pa(t,e)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var t;this.wn.bt(),this.dn.bt();for(const e of this.rn)e.bt();for(const e of this.zl)e.bt();this.jh.bt(),this.Ll.bt(),(t=this.El)===null||t===void 0||t.bt(),this.Hl.forEach((e=>e.Vn()))}Dt(){return E(super.Dt())}kt(t){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const e=this.zt.Gh(t);return e===null?null:{_t:e.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(t)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(t){this.Hl.push(new Sh(t,this))}ya(t){this.Hl=this.Hl.filter((e=>e.Ol()!==t))}Ca(){if(this.wn instanceof ts)return t=>this.wn.We(t)}Ta(){if(this.wn instanceof ts)return t=>this.wn.je(t)}_a(){return!fi(this.Dt().Pa())}pa(t,e){if(!Ie(t)||!Ie(e)||this.zt.Ni())return null;const i=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],n=this.zt.ol(t,e,i);let r=n!==null?new It(n.ml,n.bl):null;if(this.Qh()==="Histogram"){const l=this.cn.base,h=new It(l,l);r=r!==null?r.ts(h):h}let o=this.dn.uh();return this.Hl.forEach((l=>{const h=l.Il(t,e);if(h?.priceRange){const b=new It(h.priceRange.minValue,h.priceRange.maxValue);r=r!==null?r.ts(b):b}var a,c,u,d;h?.margins&&(a=o,c=h.margins,o={above:Math.max((u=a?.above)!==null&&u!==void 0?u:0,c.above),below:Math.max((d=a?.below)!==null&&d!==void 0?d:0,c.below)})})),new bi(r,o)}ga(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}Ma(){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBorderColor;if(t.length!==0)return t}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(t){switch(this.$l){case"Line":case"Area":case"Baseline":{const e=this.cn.crosshairMarkerBackgroundColor;if(e.length!==0)return e}}return this.Us().$s(t).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new Ol(this.cn.priceFormat.precision);break;case"percent":this.wa=new Tn(this.cn.priceFormat.precision);break;default:{const t=Math.pow(10,this.cn.priceFormat.precision);this.wa=new di(t,this.cn.priceFormat.minMove*t)}}this.Yi!==null&&this.Yi.Ra()}Ql(){const t=this.$t().St();if(!t.Da()||this.zt.Ni())return void(this.Wl=[]);const e=E(this.zt.el());this.Wl=this.Fl.map(((i,n)=>{const r=E(t.Va(i.time,!0)),o=r<e?1:-1;return{time:E(this.zt.ll(r,o)).ee,position:i.position,shape:i.shape,color:i.color,id:i.id,th:n,text:i.text,size:i.size,originalTime:i.originalTime}}))}ql(t){switch(this.dn=new hh(this,this.$t()),this.$l){case"Bar":this.wn=new Fl(this,this.$t());break;case"Candlestick":this.wn=new Hl(this,this.$t());break;case"Line":this.wn=new Jl(this,this.$t());break;case"Custom":this.wn=new ts(this,this.$t(),Ft(t));break;case"Area":this.wn=new Dl(this,this.$t());break;case"Baseline":this.wn=new Ul(this,this.$t());break;case"Histogram":this.wn=new Xl(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(t,e){const i=[];return ss(this.Hl,t,e,i),i}}class Ch{constructor(t){this.cn=t}Oa(t,e,i){let n=t;if(this.cn.mode===0)return n;const r=i.vn(),o=r.Ct();if(o===null)return n;const l=r.Rt(t,o),h=i.Ba().filter((c=>c instanceof rs)).reduce(((c,u)=>{if(i.vr(u)||!u.yt())return c;const d=u.Dt(),b=u.In();if(d.Ni()||!b.Kr(e))return c;const p=b.Gh(e);if(p===null)return c;const f=Oe(u.Ct());return c.concat([d.Rt(p.Vt[3],f.Vt)])}),[]);if(h.length===0)return n;h.sort(((c,u)=>Math.abs(c-l)-Math.abs(u-l)));const a=h[0];return n=r.pn(a,o),n}}class Eh extends Zt{constructor(){super(...arguments),this.zt=null}J(t){this.zt=t}K({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:n}){if(this.zt===null)return;const r=Math.max(1,Math.floor(i));t.lineWidth=r,(function(o,l){o.save(),o.lineWidth%2&&o.translate(.5,.5),l(),o.restore()})(t,(()=>{const o=E(this.zt);if(o.Aa){t.strokeStyle=o.Ia,xe(t,o.za),t.beginPath();for(const l of o.La){const h=Math.round(l.Ea*i);t.moveTo(h,-r),t.lineTo(h,e.height+r)}t.stroke()}if(o.Na){t.strokeStyle=o.Fa,xe(t,o.Wa),t.beginPath();for(const l of o.ja){const h=Math.round(l.Ea*n);t.moveTo(-r,h),t.lineTo(e.width+r,h)}t.stroke()}}))}}class Th{constructor(t){this.Wt=new Eh,this.ft=!0,this.tn=t}bt(){this.ft=!0}gt(){if(this.ft){const t=this.tn.$t().W().grid,e={Na:t.horzLines.visible,Aa:t.vertLines.visible,Fa:t.horzLines.color,Ia:t.vertLines.color,Wa:t.horzLines.style,za:t.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map((i=>({Ea:i.coord})))};this.Wt.J(e),this.ft=!1}return this.Wt}}class Mh{constructor(t){this.wn=new Th(t)}qh(){return this.wn}}const os={$a:4,Ua:1e-4};function Pe(s,t){const e=100*(s-t)/t;return t<0?-e:e}function kh(s,t){const e=Pe(s.Ph(),t),i=Pe(s.Rh(),t);return new It(e,i)}function Xe(s,t){const e=100*(s-t)/t+100;return t<0?-e:e}function Lh(s,t){const e=Xe(s.Ph(),t),i=Xe(s.Rh(),t);return new It(e,i)}function vi(s,t){const e=Math.abs(s);if(e<1e-15)return 0;const i=Math.log10(e+t.Ua)+t.$a;return s<0?-i:i}function Je(s,t){const e=Math.abs(s);if(e<1e-15)return 0;const i=Math.pow(10,e-t.$a)-t.Ua;return s<0?-i:i}function Ge(s,t){if(s===null)return null;const e=vi(s.Ph(),t),i=vi(s.Rh(),t);return new It(e,i)}function yi(s,t){if(s===null)return null;const e=Je(s.Ph(),t),i=Je(s.Rh(),t);return new It(e,i)}function ls(s){if(s===null)return os;const t=Math.abs(s.Rh()-s.Ph());if(t>=1||t<1e-15)return os;const e=Math.ceil(Math.abs(Math.log10(t))),i=os.$a+e;return{$a:i,Ua:1/Math.pow(10,i)}}class hs{constructor(t,e){if(this.qa=t,this.Ya=e,(function(i){if(i<0)return!1;for(let n=i;n>1;n/=10)if(n%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let i=this.qa;i!==1;){if(i%2==0)this.Za.push(2),i/=2;else{if(i%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),i/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(t,e,i){const n=this.qa===0?0:1/this.qa;let r=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-e)))),o=0,l=this.Ya[0];for(;;){const u=pi(r,n,1e-14)&&r>n+1e-14,d=pi(r,i*l,1e-14),b=pi(r,1,1e-14);if(!(u&&d&&b))break;r/=l,l=this.Ya[++o%this.Ya.length]}if(r<=n+1e-14&&(r=n),r=Math.max(1,r),this.Za.length>0&&(h=r,a=1,c=1e-14,Math.abs(h-a)<c))for(o=0,l=this.Za[0];pi(r,i*l,1e-14)&&r>n+1e-14;)r/=l,l=this.Za[++o%this.Za.length];var h,a,c;return r}}class Jn{constructor(t,e,i,n){this.Ka=[],this.Li=t,this.qa=e,this.Ga=i,this.Ja=n}Xa(t,e){if(t<e)throw new Error("high < low");const i=this.Li.At(),n=(t-e)*this.Qa()/i,r=new hs(this.qa,[2,2.5,2]),o=new hs(this.qa,[2,2,2.5]),l=new hs(this.qa,[2.5,2,2]),h=[];return h.push(r.Xa(t,e,n),o.Xa(t,e,n),l.Xa(t,e,n)),(function(a){if(a.length<1)throw Error("array is empty");let c=a[0];for(let u=1;u<a.length;++u)a[u]<c&&(c=a[u]);return c})(h)}io(){const t=this.Li,e=t.Ct();if(e===null)return void(this.Ka=[]);const i=t.At(),n=this.Ga(i-1,e),r=this.Ga(0,e),o=this.Li.W().entireTextOnly?this.no()/2:0,l=o,h=i-1-o,a=Math.max(n,r),c=Math.min(n,r);if(a===c)return void(this.Ka=[]);let u=this.Xa(a,c),d=a%u;d+=d<0?u:0;const b=a>=c?1:-1;let p=null,f=0;for(let m=a-d;m>c;m-=u){const S=this.Ja(m,e,!0);p!==null&&Math.abs(S-p)<this.Qa()||S<l||S>h||(f<this.Ka.length?(this.Ka[f].Ea=S,this.Ka[f].so=t.eo(m)):this.Ka.push({Ea:S,so:t.eo(m)}),f++,p=S,t.ro()&&(u=this.Xa(m*b,c)))}this.Ka.length=f}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Gn(s){return s.slice().sort(((t,e)=>E(t.Xi())-E(e.Xi())))}var Yn;(function(s){s[s.Normal=0]="Normal",s[s.Logarithmic=1]="Logarithmic",s[s.Percentage=2]="Percentage",s[s.IndexedTo100=3]="IndexedTo100"})(Yn||(Yn={}));const Qn=new Tn,Zn=new di(100,1);class Oh{constructor(t,e,i,n){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new Ct,this.vo=new Ct,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=Zn,this.xo=ls(null),this.So=t,this.cn=e,this.ko=i,this.yo=n,this.Co=new Jn(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(t){if(Qt(this.cn,t),this.Ra(),t.mode!==void 0&&this.Ro({Cr:t.mode}),t.scaleMargins!==void 0){const e=Ft(t.scaleMargins.top),i=Ft(t.scaleMargins.bottom);if(e<0||e>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${e}`);if(i<0||i>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${i}`);if(e+i>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${e+i}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return this.cn.mode===1}Mh(){return this.cn.mode===2}Oo(){return this.cn.mode===3}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(t){const e=this.Cr();let i=null;t.Wn!==void 0&&(this.cn.autoScale=t.Wn),t.Cr!==void 0&&(this.cn.mode=t.Cr,t.Cr!==2&&t.Cr!==3||(this.cn.autoScale=!0),this.oo._o=!1),e.Cr===1&&t.Cr!==e.Cr&&((function(r,o){if(r===null)return!1;const l=Je(r.Ph(),o),h=Je(r.Rh(),o);return isFinite(l)&&isFinite(h)})(this.Ih,this.xo)?(i=yi(this.Ih,this.xo),i!==null&&this.Ao(i)):this.cn.autoScale=!0),t.Cr===1&&t.Cr!==e.Cr&&(i=Ge(this.Ih,this.xo),i!==null&&this.Ao(i));const n=e.Cr!==this.cn.mode;n&&(e.Cr===2||this.Mh())&&this.Ra(),n&&(e.Cr===3||this.Oo())&&this.Ra(),t.Bo!==void 0&&e.Bo!==t.Bo&&(this.cn.invertScale=t.Bo,this.Io()),this.vo.m(e,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(t){this.ho!==t&&(this.ho=t,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const t=this.At()-this.No()-this.Fo();return this.lo=t,t}Lh(){return this.Wo(),this.Ih}Ao(t,e){const i=this.Ih;(e||i===null&&t!==null||i!==null&&!i.Ch(t))&&(this.bo=null,this.Ih=t)}Ni(){return this.Wo(),this.ho===0||!this.Ih||this.Ih.Ni()}jo(t){return this.Bo()?t:this.At()-1-t}Rt(t,e){return this.Mh()?t=Pe(t,e):this.Oo()&&(t=Xe(t,e)),this.Po(t,e)}te(t,e,i){this.Wo();const n=this.Fo(),r=E(this.Lh()),o=r.Ph(),l=r.Rh(),h=this.Eo()-1,a=this.Bo(),c=h/(l-o),u=i===void 0?0:i.from,d=i===void 0?t.length:i.to,b=this.Ho();for(let p=u;p<d;p++){const f=t[p],m=f._t;if(isNaN(m))continue;let S=m;b!==null&&(S=b(f._t,e));const g=n+c*(S-o),x=a?g:this.ho-1-g;f.st=x}}be(t,e,i){this.Wo();const n=this.Fo(),r=E(this.Lh()),o=r.Ph(),l=r.Rh(),h=this.Eo()-1,a=this.Bo(),c=h/(l-o),u=i===void 0?0:i.from,d=i===void 0?t.length:i.to,b=this.Ho();for(let p=u;p<d;p++){const f=t[p];let m=f.ge,S=f.Me,g=f.xe,x=f.Se;b!==null&&(m=b(f.ge,e),S=b(f.Me,e),g=b(f.xe,e),x=b(f.Se,e));let M=n+c*(m-o),P=a?M:this.ho-1-M;f.pe=P,M=n+c*(S-o),P=a?M:this.ho-1-M,f.de=P,M=n+c*(g-o),P=a?M:this.ho-1-M,f.fe=P,M=n+c*(x-o),P=a?M:this.ho-1-M,f.me=P}}pn(t,e){const i=this.To(t,e);return this.$o(i,e)}$o(t,e){let i=t;return this.Mh()?i=(function(n,r){return r<0&&(n=-n),n/100*r+r})(i,e):this.Oo()&&(i=(function(n,r){return n-=100,r<0&&(n=-n),n/100*r+r})(i,e)),i}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let t=[];for(let e=0;e<this.po.length;e++){const i=this.po[e];i.Xi()===null&&i.Ki(e+1),t.push(i)}return t=Gn(t),this.mo=t,this.mo}qo(t){this.po.indexOf(t)===-1&&(this.po.push(t),this.Ra(),this.Yo())}Zo(t){const e=this.po.indexOf(t);if(e===-1)throw new Error("source is not attached to scale");this.po.splice(e,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let t=null;for(const e of this.po){const i=e.Ct();i!==null&&(t===null||i.la<t.la)&&(t=i)}return t===null?null:t.Vt}Bo(){return this.cn.invertScale}Ha(){const t=this.Ct()===null;if(this.bo!==null&&(t||this.bo.Xo===t))return this.bo.Ha;this.Co.io();const e=this.Co.Ha();return this.bo={Ha:e,Xo:t},this.fo.m(),e}Ko(){return this.fo}Go(t){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-t,this.ao=E(this.Lh()).Th()))}Jo(t){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(t=this.ho-t)<0&&(t=0);let e=(this.wo+.2*(this.ho-1))/(t+.2*(this.ho-1));const i=E(this.ao).Th();e=Math.max(e,.1),i.Vh(e),this.Ao(i)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(t){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=t,this.ao=E(this.Lh()).Th()))}i_(t){if(this.Vo()||this.Mo===null)return;const e=E(this.Lh()).Dh()/(this.Eo()-1);let i=t-this.Mo;this.Bo()&&(i*=-1);const n=i*e,r=E(this.ao).Th();r.Oh(n),this.Ao(r,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(t,e){switch(this.cn.mode){case 2:return this.s_(Pe(t,e));case 3:return this.ba().format(Xe(t,e));default:return this.Wh(t)}}eo(t){switch(this.cn.mode){case 2:return this.s_(t);case 3:return this.ba().format(t);default:return this.Wh(t)}}Yl(t){return this.Wh(t,E(this.e_()).ba())}Zl(t,e){return t=Pe(t,e),this.s_(t,Qn)}r_(){return this.po}h_(t){this.oo={uo:t,_o:!1}}Vn(){this.po.forEach((t=>t.Vn()))}Ra(){this.bo=null;const t=this.e_();let e=100;t!==null&&(e=Math.round(1/t.ma())),this.wa=Zn,this.Mh()?(this.wa=Qn,e=100):this.Oo()?(this.wa=new di(100,1),e=100):t!==null&&(this.wa=t.ba()),this.Co=new Jn(this,e,this.To.bind(this),this.Po.bind(this)),this.Co.io()}Yo(){this.mo=null}e_(){return this.po[0]||null}No(){return this.Bo()?this.cn.scaleMargins.bottom*this.At()+this.do:this.cn.scaleMargins.top*this.At()+this.co}Fo(){return this.Bo()?this.cn.scaleMargins.top*this.At()+this.co:this.cn.scaleMargins.bottom*this.At()+this.do}Wo(){this.oo._o||(this.oo._o=!0,this.l_())}Do(){this.lo=null}Po(t,e){if(this.Wo(),this.Ni())return 0;t=this.ro()&&t?vi(t,this.xo):t;const i=E(this.Lh()),n=this.Fo()+(this.Eo()-1)*(t-i.Ph())/i.Dh();return this.jo(n)}To(t,e){if(this.Wo(),this.Ni())return 0;const i=this.jo(t),n=E(this.Lh()),r=n.Ph()+n.Dh()*((i-this.Fo())/(this.Eo()-1));return this.ro()?Je(r,this.xo):r}Io(){this.bo=null,this.Co.io()}l_(){const t=this.oo.uo;if(t===null)return;let e=null;const i=this.r_();let n=0,r=0;for(const h of i){if(!h.yt())continue;const a=h.Ct();if(a===null)continue;const c=h.Il(t.Os(),t.ui());let u=c&&c.Lh();if(u!==null){switch(this.cn.mode){case 1:u=Ge(u,this.xo);break;case 2:u=kh(u,a.Vt);break;case 3:u=Lh(u,a.Vt)}if(e=e===null?u:e.ts(E(u)),c!==null){const d=c.Eh();d!==null&&(n=Math.max(n,d.above),r=Math.max(r,d.below))}}}if(n===this.co&&r===this.do||(this.co=n,this.do=r,this.bo=null,this.Do()),e!==null){if(e.Ph()===e.Rh()){const h=this.e_(),a=5*(h===null||this.Mh()||this.Oo()?1:h.ma());this.ro()&&(e=yi(e,this.xo)),e=new It(e.Ph()-a,e.Rh()+a),this.ro()&&(e=Ge(e,this.xo))}if(this.ro()){const h=yi(e,this.xo),a=ls(h);if(o=a,l=this.xo,o.$a!==l.$a||o.Ua!==l.Ua){const c=this.ao!==null?yi(this.ao,this.xo):null;this.xo=a,e=Ge(h,a),c!==null&&(this.ao=Ge(c,a))}}this.Ao(e)}else this.Ih===null&&(this.Ao(new It(-.5,.5)),this.xo=ls(null));var o,l;this.oo._o=!0}Ho(){return this.Mh()?Pe:this.Oo()?Xe:this.ro()?t=>vi(t,this.xo):null}a_(t,e,i){return e===void 0?(i===void 0&&(i=this.ba()),i.format(t)):e(t)}Wh(t,e){return this.a_(t,this.yo.priceFormatter,e)}s_(t,e){return this.a_(t,this.yo.percentageFormatter,e)}}class zh{constructor(t,e){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Ct,this.yl=t,this.$i=e,this.d_=new Mh(this);const i=e.W();this.f_=this.v_("left",i.leftPriceScale),this.p_=this.v_("right",i.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(i)}b_(t){if(t.leftPriceScale&&this.f_.$h(t.leftPriceScale),t.rightPriceScale&&this.p_.$h(t.rightPriceScale),t.localization&&(this.f_.Ra(),this.p_.Ra()),t.overlayPriceScales){const e=Array.from(this.o_.values());for(const i of e){const n=E(i[0].Dt());n.$h(t.overlayPriceScales),t.localization&&n.Ra()}}}w_(t){switch(t){case"left":return this.f_;case"right":return this.p_}return this.o_.has(t)?Ft(this.o_.get(t))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((t=>{t.S&&t.S()})),this.c_.m()}M_(){return this.u_}x_(t){this.u_=t}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(t){this.__=t,this.k_()}Lo(t){this.ho=t,this.f_.Lo(t),this.p_.Lo(t),this.po.forEach((e=>{if(this.vr(e)){const i=e.Dt();i!==null&&i.Lo(t)}})),this.k_()}Ba(){return this.po}vr(t){const e=t.Dt();return e===null||this.f_!==e&&this.p_!==e}qo(t,e,i){const n=i!==void 0?i:this.C_().y_+1;this.T_(t,e,n)}Zo(t){const e=this.po.indexOf(t);be(e!==-1,"removeDataSource: invalid data source"),this.po.splice(e,1);const i=E(t.Dt()).Pa();if(this.o_.has(i)){const r=Ft(this.o_.get(i)),o=r.indexOf(t);o!==-1&&(r.splice(o,1),r.length===0&&this.o_.delete(i))}const n=t.Dt();n&&n.Ba().indexOf(t)>=0&&n.Zo(t),n!==null&&(n.Yo(),this.P_(n)),this.mo=null}mr(t){return t===this.f_?"left":t===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(t,e){t.Go(e)}O_(t,e){t.Jo(e),this.k_()}B_(t){t.Qo()}A_(t,e){t.t_(e)}I_(t,e){t.i_(e),this.k_()}z_(t){t.n_()}k_(){this.po.forEach((t=>{t.Vn()}))}vn(){let t=null;return this.$i.W().rightPriceScale.visible&&this.p_.Ba().length!==0?t=this.p_:this.$i.W().leftPriceScale.visible&&this.f_.Ba().length!==0?t=this.f_:this.po.length!==0&&(t=this.po[0].Dt()),t===null&&(t=this.p_),t}pr(){let t=null;return this.$i.W().rightPriceScale.visible?t=this.p_:this.$i.W().leftPriceScale.visible&&(t=this.f_),t}P_(t){t!==null&&t.Vo()&&this.L_(t)}E_(t){const e=this.yl.Xs();t.Ro({Wn:!0}),e!==null&&t.h_(e),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((t=>{this.vr(t)&&this.P_(t.Dt())})),this.k_(),this.$i.Uh()}Uo(){return this.mo===null&&(this.mo=Gn(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(t){const e=t.r_();if(e&&e.length>0&&!this.yl.Ni()){const i=this.yl.Xs();i!==null&&t.h_(i)}t.Vn()}C_(){const t=this.Uo();if(t.length===0)return{H_:0,y_:0};let e=0,i=0;for(let n=0;n<t.length;n++){const r=t[n].Xi();r!==null&&(r<e&&(e=r),r>i&&(i=r))}return{H_:e,y_:i}}T_(t,e,i){let n=this.w_(e);if(n===null&&(n=this.v_(e,this.$i.W().overlayPriceScales)),this.po.push(t),!fi(e)){const r=this.o_.get(e)||[];r.push(t),this.o_.set(e,r)}n.qo(t),t.Gi(n),t.Ki(i),this.P_(n),this.mo=null}m_(t,e,i){e.Cr!==i.Cr&&this.L_(t)}v_(t,e){const i=Object.assign({visible:!0,autoScale:!0},pe(e)),n=new Oh(t,i,this.$i.W().layout,this.$i.W().localization);return n.Lo(this.At()),n}}class Ph{constructor(t,e,i=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=t,this.q_=e,this.ir=i}Y_(t){const e=t.time,i=this.q_.cacheKey(e),n=this.tr.get(i);if(n!==void 0)return n.Z_;if(this.Ke===this.ir){const o=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(Ft(o)),this.Je++,this.Ke--}const r=this.U_(t);return this.tr.set(i,{Z_:r,rr:this.Ge}),this.Qe.set(this.Ge,i),this.Ke++,this.Ge++,r}}class Ye{constructor(t,e){be(t<=e,"right should be >= left"),this.X_=t,this.K_=e}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(t){return this.X_<=t&&t<=this.K_}Ch(t){return this.X_===t.Os()&&this.K_===t.ui()}}function tr(s,t){return s===null||t===null?s===t:s.Ch(t)}class Nh{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(t){this.Q_=t,this.tr=null}iu(t,e){this.nu(e),this.tr=null;for(let i=e;i<t.length;++i){const n=t[i];let r=this.J_.get(n.timeWeight);r===void 0&&(r=[],this.J_.set(n.timeWeight,r)),r.push({index:i,time:n.time,weight:n.timeWeight,originalTime:n.originalTime})}}su(t,e){const i=Math.ceil(e/t);return this.tr!==null&&this.tr.eu===i||(this.tr={Ha:this.ru(i),eu:i}),this.tr.Ha}nu(t){if(t===0)return void this.J_.clear();const e=[];this.J_.forEach(((i,n)=>{t<=i[0].index?e.push(n):i.splice(He(i,t,(r=>r.index<t)),1/0)}));for(const i of e)this.J_.delete(i)}ru(t){let e=[];for(const i of Array.from(this.J_.keys()).sort(((n,r)=>r-n))){if(!this.J_.get(i))continue;const n=e;e=[];const r=n.length;let o=0;const l=Ft(this.J_.get(i)),h=l.length;let a=1/0,c=-1/0;for(let u=0;u<h;u++){const d=l[u],b=d.index;for(;o<r;){const p=n[o],f=p.index;if(!(f<b)){a=f;break}o++,e.push(p),c=f,a=1/0}if(a-b>=t&&b-c>=t)e.push(d),c=b;else if(this.Q_)return n}for(;o<r;o++)e.push(n[o])}return e}}class Ne{constructor(t){this.hu=t}lu(){return this.hu===null?null:new Ye(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Ne(null)}}function Rh(s,t){return s.weight>t.weight?s:t}class Ah{constructor(t,e,i,n){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Nh,this.du=new Map,this.fu=Ne.ou(),this.vu=!0,this.pu=new Ct,this.mu=new Ct,this.bu=new Ct,this.wu=null,this.gu=null,this.Mu=[],this.cn=e,this.yo=i,this.xu=e.rightOffset,this.Su=e.barSpacing,this.$i=t,this.q_=n,this.ku(),this.cu.tu(e.uniformDistribution)}W(){return this.cn}yu(t){Qt(this.yo,t),this.Cu(),this.ku()}$h(t,e){var i;Qt(this.cn,t),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),t.barSpacing!==void 0&&this.$i.Gn(t.barSpacing),t.rightOffset!==void 0&&this.$i.Jn(t.rightOffset),t.minBarSpacing!==void 0&&this.$i.Gn((i=t.barSpacing)!==null&&i!==void 0?i:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(t){var e,i;return(i=(e=this.uu[t])===null||e===void 0?void 0:e.time)!==null&&i!==void 0?i:null}Ui(t){var e;return(e=this.uu[t])!==null&&e!==void 0?e:null}Va(t,e){if(this.uu.length<1)return null;if(this.q_.key(t)>this.q_.key(this.uu[this.uu.length-1].time))return e?this.uu.length-1:null;const i=He(this.uu,this.q_.key(t),((n,r)=>this.q_.key(n.time)<r));return this.q_.key(t)<this.q_.key(this.uu[i].time)?e?i:null:i}Ni(){return this.__===0||this.uu.length===0||this._u===null}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const t=this.Xs();if(t===null)return null;const e={from:t.Os(),to:t.ui()};return this.Ou(e)}Ou(t){const e=Math.round(t.from),i=Math.round(t.to),n=E(this.Bu()),r=E(this.Au());return{from:E(this.Ui(Math.max(n,e))),to:E(this.Ui(Math.min(r,i)))}}Iu(t){return{from:E(this.Va(t.from,!0)),to:E(this.Va(t.to,!0))}}Hi(){return this.__}S_(t){if(!isFinite(t)||t<=0||this.__===t)return;const e=this.Du(),i=this.__;if(this.__=t,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&i!==0){const n=this.Su*t/i;this.Su=n}if(this.cn.fixLeftEdge&&e!==null&&e.Os()<=0){const n=i-t;this.xu-=Math.round(n/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(t){if(this.Ni()||!Ie(t))return 0;const e=this.Eu()+this.xu-t;return this.__-(e+.5)*this.Su-1}Qs(t,e){const i=this.Eu(),n=e===void 0?0:e.from,r=e===void 0?t.length:e.to;for(let o=n;o<r;o++){const l=t[o].ot,h=i+this.xu-l,a=this.__-(h+.5)*this.Su-1;t[o].nt=a}}Nu(t){return Math.ceil(this.Fu(t))}Jn(t){this.vu=!0,this.xu=t,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(t){this.ju(t),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(this.gu!==null)return this.gu;const t=this.Su,e=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),i=Math.round(e/t),n=E(this.Xs()),r=Math.max(n.Os(),n.Os()-i),o=Math.max(n.ui(),n.ui()-i),l=this.cu.su(t,e),h=this.Bu()+i,a=this.Au()-i,c=this.$u(),u=this.cn.fixLeftEdge||c,d=this.cn.fixRightEdge||c;let b=0;for(const p of l){if(!(r<=p.index&&p.index<=o))continue;let f;b<this.Mu.length?(f=this.Mu[b],f.coord=this.It(p.index),f.label=this.Uu(p),f.weight=p.weight):(f={needAlignCoordinate:!1,coord:this.It(p.index),label:this.Uu(p),weight:p.weight},this.Mu.push(f)),this.Su>e/2&&!c?f.needAlignCoordinate=!1:f.needAlignCoordinate=u&&p.index<=h||d&&p.index>=a,b++}return this.Mu.length=b,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(t){this.vu=!0,this._u=t,this.Lu(),this.Tu()}Zu(t,e){const i=this.Fu(t),n=this.le(),r=n+e*(n/10);this.Gn(r),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(i-this.Fu(t)))}Go(t){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=t,this.Xu()))}Jo(t){if(this.wu===null)return;const e=Yi(this.__-t,0,this.__),i=Yi(this.__-E(this.wo),0,this.__);e!==0&&i!==0&&this.Gn(this.wu.le*e/i)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(t){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=t,this.Xu()))}i_(t){if(this.Mo===null)return;const e=(this.Mo-t)/this.le();this.xu=E(this.wu).Hu+e,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(t,e=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(e)||e<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const i=this.xu,n=performance.now();this.$i.Zn({Qu:r=>(r-n)/e>=1,tc:r=>{const o=(r-n)/e;return o>=1?t:i+(t-i)*o}})}bt(t,e){this.vu=!0,this.uu=t,this.cu.iu(t,e),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(t){const e=t.G_();this.ju(this.__/e),this.xu=t.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const t=this.Bu(),e=this.Au();t!==null&&e!==null&&this.rc(new Ye(t,e+this.cn.rightOffset))}lc(t){const e=new Ye(t.from,t.to);this.rc(e)}qi(t){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(t.originalTime):this.q_.formatHorzItem(t.time)}$u(){const{handleScroll:t,handleScale:e}=this.$i.W();return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||e.axisDoubleClickReset.time||e.axisPressedMouseMove.time||e.mouseWheel||e.pinch)}Bu(){return this.uu.length===0?null:0}Au(){return this.uu.length===0?null:this.uu.length-1}ac(t){return(this.__-1-t)/this.Su}Fu(t){const e=this.ac(t),i=this.Eu()+this.xu-e;return Math.round(1e6*i)/1e6}ju(t){const e=this.Su;this.Su=t,this.zu(),e!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(Ne.ou());const t=this.Eu(),e=this.__/this.Su,i=this.xu+t,n=new Ye(i-e+1,i);this._c(new Ne(n))}zu(){const t=this.uc();if(this.Su<t&&(this.Su=t,this.vu=!0),this.__!==0){const e=.5*this.__;this.Su>e&&(this.Su=e,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.uu.length!==0?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const t=this.cc();t!==null&&this.xu<t&&(this.xu=t,this.vu=!0);const e=this.dc();this.xu>e&&(this.xu=e,this.vu=!0)}cc(){const t=this.Bu(),e=this._u;return t===null||e===null?null:t-e-1+(this.cn.fixLeftEdge?this.__/this.Su:Math.min(2,this.uu.length))}dc(){return this.cn.fixRightEdge?0:this.__/this.Su-Math.min(2,this.uu.length)}Xu(){this.wu={le:this.le(),Hu:this.Hu()}}Ku(){this.wu=null}Uu(t){let e=this.du.get(t.weight);return e===void 0&&(e=new Ph((i=>this.fc(i)),this.q_),this.du.set(t.weight,e)),e.Y_(t)}fc(t){return this.q_.formatTickmark(t,this.yo)}_c(t){const e=this.fu;this.fu=t,tr(e.lu(),this.fu.lu())||this.pu.m(),tr(e.au(),this.fu.au())||this.mu.m(),this.oc()}oc(){this.gu=null}Cu(){this.oc(),this.du.clear()}ku(){this.q_.updateFormatter(this.yo)}Tu(){if(!this.cn.fixLeftEdge)return;const t=this.Bu();if(t===null)return;const e=this.Xs();if(e===null)return;const i=e.Os()-t;if(i<0){const n=this.xu-i-1;this.Jn(n)}this.zu()}Pu(){this.Lu(),this.zu()}}class Bh{X(t,e,i){t.useMediaCoordinateSpace((n=>this.K(n,e,i)))}gl(t,e,i){t.useMediaCoordinateSpace((n=>this.vc(n,e,i)))}vc(t,e,i){}}class Dh extends Bh{constructor(t){super(),this.mc=new Map,this.zt=t}K(t){}vc(t){if(!this.zt.yt)return;const{context:e,mediaSize:i}=t;let n=0;for(const o of this.zt.bc){if(o.Kt.length===0)continue;e.font=o.R;const l=this.wc(e,o.Kt);l>i.width?o.Zu=i.width/l:o.Zu=1,n+=o.gc*o.Zu}let r=0;switch(this.zt.Mc){case"top":r=0;break;case"center":r=Math.max((i.height-n)/2,0);break;case"bottom":r=Math.max(i.height-n,0)}e.fillStyle=this.zt.V;for(const o of this.zt.bc){e.save();let l=0;switch(this.zt.xc){case"left":e.textAlign="left",l=o.gc/2;break;case"center":e.textAlign="center",l=i.width/2;break;case"right":e.textAlign="right",l=i.width-1-o.gc/2}e.translate(l,r),e.textBaseline="top",e.font=o.R,e.scale(o.Zu,o.Zu),e.fillText(o.Kt,0,o.Sc),e.restore(),r+=o.gc*o.Zu}}wc(t,e){const i=this.kc(t.font);let n=i.get(e);return n===void 0&&(n=t.measureText(e).width,i.set(e,n)),n}kc(t){let e=this.mc.get(t);return e===void 0&&(e=new Map,this.mc.set(t,e)),e}}class Vh{constructor(t){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new Dh(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(),e=this.Ft;e.yt=t.visible,e.yt&&(e.V=t.color,e.xc=t.horzAlign,e.Mc=t.vertAlign,e.bc=[{Kt:t.text,R:ze(t.fontSize,t.fontFamily,t.fontStyle),gc:1.2*t.fontSize,Sc:0,Zu:0}])}}class Fh extends Ji{constructor(t,e){super(),this.cn=e,this.wn=new Vh(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var er,ir,sr,nr,rr;(function(s){s[s.OnTouchEnd=0]="OnTouchEnd",s[s.OnNextTap=1]="OnNextTap"})(er||(er={}));class $h{constructor(t,e,i){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Ct,this.Rc=new Ct,this.Dc=null,this.Vc=t,this.cn=e,this.q_=i,this.Oc=new vl(this),this.yl=new Ah(this,e.timeScale,this.cn.localization,i),this.vt=new Ll(this,e.crosshair),this.Bc=new Ch(e.crosshair),this.Ac=new Fh(this,e.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Pt.es())}Uh(){this.Nc(Pt.ss())}oa(){this.Nc(new Pt(1))}Gl(t){const e=this.Fc(t);this.Nc(e)}Wc(){return this.Tc}jc(t){const e=this.Tc;this.Tc=t,e!==null&&this.Gl(e.Hc),t!==null&&this.Gl(t.Hc)}W(){return this.cn}$h(t){Qt(this.cn,t),this.yc.forEach((e=>e.b_(t))),t.timeScale!==void 0&&this.yl.$h(t.timeScale),t.localization!==void 0&&this.yl.yu(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(t,e){if(t==="left")return void this.$h({leftPriceScale:e});if(t==="right")return void this.$h({rightPriceScale:e});const i=this.Uc(t);i!==null&&(i.Dt.$h(e),this.Pc.m())}Uc(t){for(const e of this.yc){const i=e.w_(t);if(i!==null)return{Ht:e,Dt:i}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(t,e){t.Lo(e),this.Wu()}S_(t){this.__=t,this.yl.S_(this.__),this.yc.forEach((e=>e.S_(t))),this.Wu()}Ic(t){const e=new zh(this.yl,this);t!==void 0?this.yc.splice(t,0,e):this.yc.push(e);const i=t===void 0?this.yc.length-1:t,n=Pt.es();return n.Nn(i,{Fn:0,Wn:!0}),this.Nc(n),e}V_(t,e,i){t.V_(e,i)}O_(t,e,i){t.O_(e,i),this.Jl(),this.Nc(this.Gc(t,2))}B_(t,e){t.B_(e),this.Nc(this.Gc(t,2))}A_(t,e,i){e.Vo()||t.A_(e,i)}I_(t,e,i){e.Vo()||(t.I_(e,i),this.Jl(),this.Nc(this.Gc(t,2)))}z_(t,e){e.Vo()||(t.z_(e),this.Nc(this.Gc(t,2)))}E_(t,e){t.E_(e),this.Nc(this.Gc(t,2))}Jc(t){this.yl.Go(t)}Qc(t,e){const i=this.St();if(i.Ni()||e===0)return;const n=i.Hi();t=Math.max(1,Math.min(t,n)),i.Zu(t,e),this.Wu()}td(t){this.nd(0),this.sd(t),this.ed()}rd(t){this.yl.Jo(t),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(t){this.yl.t_(t)}sd(t){this.yl.i_(t),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(t,e,i,n,r){this.vt.gn(t,e);let o=NaN,l=this.yl.Nu(t);const h=this.yl.Xs();h!==null&&(l=Math.min(Math.max(h.Os(),l),h.ui()));const a=n.vn(),c=a.Ct();c!==null&&(o=a.pn(e,c)),o=this.Bc.Oa(o,l,n),this.vt.kn(l,o,n),this.oa(),r||this.Rc.m(this.vt.xt(),{x:t,y:e},i)}ad(t,e,i){const n=i.vn(),r=n.Ct(),o=n.Rt(t,E(r)),l=this.yl.Va(e,!0),h=this.yl.It(E(l));this.ld(h,o,null,i,!0)}od(t){this.Zc().Cn(),this.oa(),t||this.Rc.m(null,null,null)}Jl(){const t=this.vt.Ht();if(t!==null){const e=this.vt.xn(),i=this.vt.Sn();this.ld(e,i,null,t)}this.vt.Vn()}_d(t,e,i){const n=this.yl.mn(0);e!==void 0&&i!==void 0&&this.yl.bt(e,i);const r=this.yl.mn(0),o=this.yl.Eu(),l=this.yl.Xs();if(l!==null&&n!==null&&r!==null){const h=l.Kr(o),a=this.q_.key(n)>this.q_.key(r),c=t!==null&&t>o&&!a,u=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,d=h&&(i!==void 0||u)&&this.yl.W().shiftVisibleRangeOnNewBar;if(c&&!d){const b=t-o;this.yl.Jn(this.yl.Hu()-b)}}this.yl.Yu(t)}ia(t){t!==null&&t.F_()}dr(t){const e=this.yc.find((i=>i.Uo().includes(t)));return e===void 0?null:e}Wu(){this.Ac.Vn(),this.yc.forEach((t=>t.F_())),this.Jl()}S(){this.yc.forEach((t=>t.S())),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(t,e,i){const n=this.yc[0],r=this.fd(e,t,n,i);return this.Cc.push(r),this.Cc.length===1?this.Kl():this.Uh(),r}vd(t){const e=this.dr(t),i=this.Cc.indexOf(t);be(i!==-1,"Series not found"),this.Cc.splice(i,1),E(e).Zo(t),t.S&&t.S()}Xl(t,e){const i=E(this.dr(t));i.Zo(t);const n=this.Uc(e);if(n===null){const r=t.Xi();i.qo(t,e,r)}else{const r=n.Ht===i?t.Xi():void 0;n.Ht.qo(t,e,r)}}hc(){const t=Pt.ss();t.$n(),this.Nc(t)}pd(t){const e=Pt.ss();e.Yn(t),this.Nc(e)}Kn(){const t=Pt.ss();t.Kn(),this.Nc(t)}Gn(t){const e=Pt.ss();e.Gn(t),this.Nc(e)}Jn(t){const e=Pt.ss();e.Jn(t),this.Nc(e)}Zn(t){const e=Pt.ss();e.Zn(t),this.Nc(e)}Un(){const t=Pt.ss();t.Un(),this.Nc(t)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(t){const e=this.Ec,i=this.zc;if(e===i)return e;if(t=Math.max(0,Math.min(100,Math.round(100*t))),this.Dc===null||this.Dc.Ps!==i||this.Dc.Rs!==e)this.Dc={Ps:i,Rs:e,wd:new Map};else{const r=this.Dc.wd.get(t);if(r!==void 0)return r}const n=(function(r,o,l){const[h,a,c,u]=$e(r),[d,b,p,f]=$e(o),m=[jt(h+l*(d-h)),jt(a+l*(b-a)),jt(c+l*(p-c)),gn(u+l*(f-u))];return`rgba(${m[0]}, ${m[1]}, ${m[2]}, ${m[3]})`})(i,e,t/100);return this.Dc.wd.set(t,n),n}Gc(t,e){const i=new Pt(e);if(t!==null){const n=this.yc.indexOf(t);i.Nn(n,{Fn:e})}return i}Fc(t,e){return e===void 0&&(e=2),this.Gc(this.dr(t),e)}Nc(t){this.Vc&&this.Vc(t),this.yc.forEach((e=>e.j_().qh().bt()))}fd(t,e,i,n){const r=new rs(this,t,e,i,n),o=t.priceScaleId!==void 0?t.priceScaleId:this.md();return i.qo(r,o),fi(o)||r.$h(t),r}Lc(t){const e=this.cn.layout;return e.background.type==="gradient"?t===0?e.background.topColor:e.background.bottomColor:e.background.color}}function as(s){return!ie(s)&&!Ue(s)}function or(s){return ie(s)}(function(s){s[s.Disabled=0]="Disabled",s[s.Continuous=1]="Continuous",s[s.OnDataUpdate=2]="OnDataUpdate"})(ir||(ir={})),(function(s){s[s.LastBar=0]="LastBar",s[s.LastVisible=1]="LastVisible"})(sr||(sr={})),(function(s){s.Solid="solid",s.VerticalGradient="gradient"})(nr||(nr={})),(function(s){s[s.Year=0]="Year",s[s.Month=1]="Month",s[s.DayOfMonth=2]="DayOfMonth",s[s.Time=3]="Time",s[s.TimeWithSeconds=4]="TimeWithSeconds"})(rr||(rr={}));const lr=s=>s.getUTCFullYear();function Ih(s,t,e){return t.replace(/yyyy/g,(i=>me(lr(i),4))(s)).replace(/yy/g,(i=>me(lr(i)%100,2))(s)).replace(/MMMM/g,((i,n)=>new Date(i.getUTCFullYear(),i.getUTCMonth(),1).toLocaleString(n,{month:"long"}))(s,e)).replace(/MMM/g,((i,n)=>new Date(i.getUTCFullYear(),i.getUTCMonth(),1).toLocaleString(n,{month:"short"}))(s,e)).replace(/MM/g,(i=>me((n=>n.getUTCMonth()+1)(i),2))(s)).replace(/dd/g,(i=>me((n=>n.getUTCDate())(i),2))(s))}class hr{constructor(t="yyyy-MM-dd",e="default"){this.gd=t,this.Md=e}Y_(t){return Ih(t,this.gd,this.Md)}}class Uh{constructor(t){this.xd=t||"%h:%m:%s"}Y_(t){return this.xd.replace("%h",me(t.getUTCHours(),2)).replace("%m",me(t.getUTCMinutes(),2)).replace("%s",me(t.getUTCSeconds(),2))}}const Wh={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class Hh{constructor(t={}){const e=Object.assign(Object.assign({},Wh),t);this.Td=new hr(e.Sd,e.Cd),this.Pd=new Uh(e.kd),this.Rd=e.yd}Y_(t){return`${this.Td.Y_(t)}${this.Rd}${this.Pd.Y_(t)}`}}function wi(s){return 60*s*60*1e3}function cs(s){return 60*s*1e3}const Si=[{Dd:(ar=1,1e3*ar),Vd:10},{Dd:cs(1),Vd:20},{Dd:cs(5),Vd:21},{Dd:cs(30),Vd:22},{Dd:wi(1),Vd:30},{Dd:wi(3),Vd:31},{Dd:wi(6),Vd:32},{Dd:wi(12),Vd:33}];var ar;function cr(s,t){if(s.getUTCFullYear()!==t.getUTCFullYear())return 70;if(s.getUTCMonth()!==t.getUTCMonth())return 60;if(s.getUTCDate()!==t.getUTCDate())return 50;for(let e=Si.length-1;e>=0;--e)if(Math.floor(t.getTime()/Si[e].Dd)!==Math.floor(s.getTime()/Si[e].Dd))return Si[e].Vd;return 0}function us(s){let t=s;if(Ue(s)&&(t=fs(s)),!as(t))throw new Error("time must be of type BusinessDay");const e=new Date(Date.UTC(t.year,t.month-1,t.day,0,0,0,0));return{Od:Math.round(e.getTime()/1e3),Bd:t}}function ur(s){if(!or(s))throw new Error("time must be of type isUTCTimestamp");return{Od:s}}function fs(s){const t=new Date(s);if(isNaN(t.getTime()))throw new Error(`Invalid date string=${s}, expected format=yyyy-mm-dd`);return{day:t.getUTCDate(),month:t.getUTCMonth()+1,year:t.getUTCFullYear()}}function fr(s){Ue(s.time)&&(s.time=fs(s.time))}class dr{options(){return this.cn}setOptions(t){this.cn=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?(function(e){e.forEach(fr)})(t):fr(t)}createConverterToInternalObj(t){return E((function(e){return e.length===0?null:as(e[0].time)||Ue(e[0].time)?us:ur})(t))}key(t){return typeof t=="object"&&"Od"in t?t.Od:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){const e=t;return e.Bd===void 0?new Date(1e3*e.Od).getTime():new Date(Date.UTC(e.Bd.year,e.Bd.month-1,e.Bd.day)).getTime()}convertHorzItemToInternal(t){return or(e=t)?ur(e):as(e)?us(e):us(fs(e));var e}updateFormatter(t){if(!this.cn)return;const e=t.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new Hh({Sd:e,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:t.locale}):this.Ad=new hr(e,t.locale)}formatHorzItem(t){const e=t;return this.Ad.Y_(new Date(1e3*e.Od))}formatTickmark(t,e){const i=(function(r,o,l){switch(r){case 0:case 10:return o?l?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return o?3:2;case 50:return 2;case 60:return 1;case 70:return 0}})(t.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),n=this.cn.timeScale;if(n.tickMarkFormatter!==void 0){const r=n.tickMarkFormatter(t.originalTime,i,e.locale);if(r!==null)return r}return(function(r,o,l){const h={};switch(o){case 0:h.year="numeric";break;case 1:h.month="short";break;case 2:h.day="numeric";break;case 3:h.hour12=!1,h.hour="2-digit",h.minute="2-digit";break;case 4:h.hour12=!1,h.hour="2-digit",h.minute="2-digit",h.second="2-digit"}const a=r.Bd===void 0?new Date(1e3*r.Od):new Date(Date.UTC(r.Bd.year,r.Bd.month-1,r.Bd.day));return new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()).toLocaleString(l,h)})(t.time,i,e.locale)}maxTickMarkWeight(t){let e=t.reduce(Rh,t[0]).weight;return e>30&&e<50&&(e=30),e}fillWeightsForPoints(t,e){(function(i,n=0){if(i.length===0)return;let r=n===0?null:i[n-1].time.Od,o=r!==null?new Date(1e3*r):null,l=0;for(let h=n;h<i.length;++h){const a=i[h],c=new Date(1e3*a.time.Od);o!==null&&(a.timeWeight=cr(c,o)),l+=a.time.Od-(r||a.time.Od),r=a.time.Od,o=c}if(n===0&&i.length>1){const h=Math.ceil(l/(i.length-1)),a=new Date(1e3*(i[0].time.Od-h));i[0].timeWeight=cr(new Date(1e3*i[0].time.Od),a)}})(t,e)}static Id(t){return Qt({localization:{dateFormat:"dd MMM 'yy"}},t??{})}}const Re=typeof window<"u";function pr(){return!!Re&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function ds(){return!!Re&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function ps(s){return s+s%2}function ms(s,t){return s.zd-t.zd}function bs(s,t,e){const i=(s.zd-t.zd)/(s.ot-t.ot);return Math.sign(i)*Math.min(Math.abs(i),e)}class qh{constructor(t,e,i,n){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=t,this.Ud=e,this.qd=i,this.rs=n}Yd(t,e){if(this.Ld!==null){if(this.Ld.ot===e)return void(this.Ld.zd=t);if(Math.abs(this.Ld.zd-t)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:e,zd:t}}Vr(t,e){if(this.Ld===null||this.Ed===null||e-this.Ld.ot>50)return;let i=0;const n=bs(this.Ld,this.Ed,this.Ud),r=ms(this.Ld,this.Ed),o=[n],l=[r];if(i+=r,this.Nd!==null){const a=bs(this.Ed,this.Nd,this.Ud);if(Math.sign(a)===Math.sign(n)){const c=ms(this.Ed,this.Nd);if(o.push(a),l.push(c),i+=c,this.Fd!==null){const u=bs(this.Nd,this.Fd,this.Ud);if(Math.sign(u)===Math.sign(n)){const d=ms(this.Nd,this.Fd);o.push(u),l.push(d),i+=d}}}}let h=0;for(let a=0;a<o.length;++a)h+=l[a]/i*o[a];Math.abs(h)<this.$d||(this.Wd={zd:t,ot:e},this.Hd=h,this.jd=(function(a,c){const u=Math.log(c);return Math.log(1*u/-a)/u})(Math.abs(h),this.qd))}tc(t){const e=E(this.Wd),i=t-e.ot;return e.zd+this.Hd*(Math.pow(this.qd,i)-1)/Math.log(this.qd)}Qu(t){return this.Wd===null||this.Zd(t)===this.jd}Zd(t){const e=t-E(this.Wd).ot;return Math.min(e,this.jd)}}class jh{constructor(t,e){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=t,this.Qd=e,this.tf()}bt(){this.tf()}if(){this.Xd&&this.Jd.removeChild(this.Xd),this.Kd&&this.Jd.removeChild(this.Kd),this.Xd=void 0,this.Kd=void 0}nf(){return this.en!==this.sf()||this.Gd!==this.ef()}ef(){return vn($e(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const t=new URL(location.href);return t.hostname?"&utm_source="+t.hostname+t.pathname:""}tf(){this.nf()&&(this.if(),this.en=this.sf(),this.en&&(this.Gd=this.ef(),this.Kd=document.createElement("style"),this.Kd.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.Xd=document.createElement("a"),this.Xd.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.rf()}`,this.Xd.title="Charting by TradingView",this.Xd.id="tv-attr-logo",this.Xd.target="_blank",this.Xd.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 19" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.Xd.toggleAttribute("data-dark",this.Gd==="dark"),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function _e(s,t){const e=E(s.ownerDocument).createElement("canvas");s.appendChild(e);const i=sl(e,{options:{allowResizeObserver:!1},transform:(n,r)=>({width:Math.max(n.width,r.width),height:Math.max(n.height,r.height)})});return i.resizeCanvasElement(t),i}function Ce(s){var t;s.width=1,s.height=1,(t=s.getContext("2d"))===null||t===void 0||t.clearRect(0,0,1,1)}function gs(s,t,e,i){s.gl&&s.gl(t,e,i)}function xi(s,t,e,i){s.X(t,e,i)}function vs(s,t,e,i){const n=s(e,i);for(const r of n){const o=r.gt();o!==null&&t(o)}}function Kh(s){Re&&window.chrome!==void 0&&s.addEventListener("mousedown",(t=>{if(t.button===1)return t.preventDefault(),!1}))}class ys{constructor(t,e,i){this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.df=null,this.ff=!1,this.vf=null,this.pf=null,this.mf=!1,this.bf=!1,this.wf=!1,this.gf=null,this.Mf=null,this.xf=null,this.Sf=null,this.kf=null,this.yf=null,this.Cf=null,this.Tf=0,this.Pf=!1,this.Rf=!1,this.Df=!1,this.Vf=0,this.Of=null,this.Bf=!ds(),this.Af=n=>{this.If(n)},this.zf=n=>{if(this.Lf(n)){const r=this.Ef(n);if(++this._f,this.uf&&this._f>1){const{Nf:o}=this.Ff(se(n),this.cf);o<30&&!this.wf&&this.Wf(r,this.Hf.jf),this.$f()}}else{const r=this.Ef(n);if(++this.hf,this.lf&&this.hf>1){const{Nf:o}=this.Ff(se(n),this.af);o<5&&!this.bf&&this.Uf(r,this.Hf.qf),this.Yf()}}},this.Zf=t,this.Hf=e,this.cn=i,this.Xf()}S(){this.gf!==null&&(this.gf(),this.gf=null),this.Mf!==null&&(this.Mf(),this.Mf=null),this.Sf!==null&&(this.Sf(),this.Sf=null),this.kf!==null&&(this.kf(),this.kf=null),this.yf!==null&&(this.yf(),this.yf=null),this.xf!==null&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(t){this.Sf&&this.Sf();const e=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",e)},this.Zf.addEventListener("mousemove",e),this.Lf(t))return;const i=this.Ef(t);this.Uf(i,this.Hf.Qf),this.Bf=!0}Yf(){this.lf!==null&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){this.uf!==null&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(t){if(this.Df||this.pf!==null||this.Lf(t))return;const e=this.Ef(t);this.Uf(e,this.Hf.tv),this.Bf=!0}iv(t){const e=ws(t.changedTouches,E(this.Of));if(e===null||(this.Vf=_i(t),this.Cf!==null)||this.Rf)return;this.Pf=!0;const i=this.Ff(se(e),E(this.pf)),{nv:n,sv:r,Nf:o}=i;if(this.mf||!(o<5)){if(!this.mf){const l=.5*n,h=r>=l&&!this.cn.ev(),a=l>r&&!this.cn.rv();h||a||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const l=this.Ef(t,e);this.Wf(l,this.Hf.hv),Ae(t)}}}lv(t){if(t.button!==0)return;const e=this.Ff(se(t),E(this.vf)),{Nf:i}=e;if(i>=5&&(this.bf=!0,this.Yf()),this.bf){const n=this.Ef(t);this.Uf(n,this.Hf.av)}}Ff(t,e){const i=Math.abs(e.nt-t.nt),n=Math.abs(e.st-t.st);return{nv:i,sv:n,Nf:i+n}}ov(t){let e=ws(t.changedTouches,E(this.Of));if(e===null&&t.touches.length===0&&(e=t.changedTouches[0]),e===null)return;this.Of=null,this.Vf=_i(t),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const i=this.Ef(t,e);if(this.Wf(i,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:n}=this.Ff(se(e),this.cf);n<30&&!this.wf&&this.Wf(i,this.Hf.jf),this.$f()}else this.wf||(this.Wf(i,this.Hf.uv),this.Hf.uv&&Ae(t));this._f===0&&Ae(t),t.touches.length===0&&this.ff&&(this.ff=!1,Ae(t))}If(t){if(t.button!==0)return;const e=this.Ef(t);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),pr()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(t))if(this.Uf(e,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:i}=this.Ff(se(t),this.af);i<5&&!this.bf&&this.Uf(e,this.Hf.qf),this.Yf()}else this.bf||this.Uf(e,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(t){if(this.Of!==null)return;const e=t.changedTouches[0];this.Of=e.identifier,this.Vf=_i(t);const i=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=se(e),this.yf&&(this.yf(),this.yf=null);{const r=this.iv.bind(this),o=this.ov.bind(this);this.yf=()=>{i.removeEventListener("touchmove",r),i.removeEventListener("touchend",o)},i.addEventListener("touchmove",r,{passive:!1}),i.addEventListener("touchend",o,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,t),240)}const n=this.Ef(t,e);this.Wf(n,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=se(e))}mv(t){if(t.button!==0)return;const e=this.Zf.ownerDocument.documentElement;pr()&&e.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=se(t),this.kf&&(this.kf(),this.kf=null);{const n=this.lv.bind(this),r=this.If.bind(this);this.kf=()=>{e.removeEventListener("mousemove",n),e.removeEventListener("mouseup",r)},e.addEventListener("mousemove",n),e.addEventListener("mouseup",r)}if(this.Df=!0,this.Lf(t))return;const i=this.Ef(t);this.Uf(i,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=se(t))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const t=this.Zf.ownerDocument,e=i=>{this.Hf.wv&&(i.composed&&this.Zf.contains(i.composedPath()[0])||i.target&&this.Zf.contains(i.target)||this.Hf.wv())};this.Mf=()=>{t.removeEventListener("touchstart",e)},this.gf=()=>{t.removeEventListener("mousedown",e)},t.addEventListener("mousedown",e),t.addEventListener("touchstart",e,{passive:!0})}ds()&&(this.xf=()=>{this.Zf.removeEventListener("dblclick",this.zf)},this.Zf.addEventListener("dblclick",this.zf)),this.Zf.addEventListener("mouseleave",this.gv.bind(this)),this.Zf.addEventListener("touchstart",this.fv.bind(this),{passive:!0}),Kh(this.Zf),this.Zf.addEventListener("mousedown",this.mv.bind(this)),this.Mv(),this.Zf.addEventListener("touchmove",(()=>{}),{passive:!1})}Mv(){this.Hf.xv===void 0&&this.Hf.Sv===void 0&&this.Hf.kv===void 0||(this.Zf.addEventListener("touchstart",(t=>this.yv(t.touches)),{passive:!0}),this.Zf.addEventListener("touchmove",(t=>{if(t.touches.length===2&&this.Cf!==null&&this.Hf.Sv!==void 0){const e=mr(t.touches[0],t.touches[1])/this.Tf;this.Hf.Sv(this.Cf,e),Ae(t)}}),{passive:!1}),this.Zf.addEventListener("touchend",(t=>{this.yv(t.touches)})))}yv(t){t.length===1&&(this.Pf=!1),t.length!==2||this.Pf||this.ff?this.Cv():this.Tv(t)}Tv(t){const e=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(t[0].clientX-e.left+(t[1].clientX-e.left))/2,st:(t[0].clientY-e.top+(t[1].clientY-e.top))/2},this.Tf=mr(t[0],t[1]),this.Hf.xv!==void 0&&this.Hf.xv(),this.Kf()}Cv(){this.Cf!==null&&(this.Cf=null,this.Hf.kv!==void 0&&this.Hf.kv())}gv(t){if(this.Sf&&this.Sf(),this.Lf(t)||!this.Bf)return;const e=this.Ef(t);this.Uf(e,this.Hf.Pv),this.Bf=!ds()}vv(t){const e=ws(t.touches,E(this.Of));if(e===null)return;const i=this.Ef(t,e);this.Wf(i,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(t){return t.sourceCapabilities&&t.sourceCapabilities.firesTouchEvents!==void 0?t.sourceCapabilities.firesTouchEvents:_i(t)<this.Vf+500}Wf(t,e){e&&e.call(this.Hf,t)}Uf(t,e){e&&e.call(this.Hf,t)}Ef(t,e){const i=e||t,n=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,localX:i.clientX-n.left,localY:i.clientY-n.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,Dv:!t.type.startsWith("mouse")&&t.type!=="contextmenu"&&t.type!=="click",Vv:t.type,Ov:i.target,Bv:t.view,Av:()=>{t.type!=="touchstart"&&Ae(t)}}}}function mr(s,t){const e=s.clientX-t.clientX,i=s.clientY-t.clientY;return Math.sqrt(e*e+i*i)}function Ae(s){s.cancelable&&s.preventDefault()}function se(s){return{nt:s.pageX,st:s.pageY}}function _i(s){return s.timeStamp||performance.now()}function ws(s,t){for(let e=0;e<s.length;++e)if(s[e].identifier===t)return s[e];return null}function Ci(s){return{Hc:s.Hc,Iv:{gr:s.zv.externalId},Lv:s.zv.cursorStyle}}function Xh(s,t,e){for(const i of s){const n=i.gt();if(n!==null&&n.wr){const r=n.wr(t,e);if(r!==null)return{Bv:i,Iv:r}}}return null}function Ss(s,t){return e=>{var i,n,r,o;return((n=(i=e.Dt())===null||i===void 0?void 0:i.Pa())!==null&&n!==void 0?n:"")!==t?[]:(o=(r=e.da)===null||r===void 0?void 0:r.call(e,s))!==null&&o!==void 0?o:[]}}function br(s,t,e,i){if(!s.length)return;let n=0;const r=e/2,o=s[0].At(i,!0);let l=t===1?r-(s[0].Vi()-o/2):s[0].Vi()-o/2-r;l=Math.max(0,l);for(let h=1;h<s.length;h++){const a=s[h],c=s[h-1],u=c.At(i,!1),d=a.Vi(),b=c.Vi();if(t===1?d>b-u:d<b+u){const p=b-u*t;a.Oi(p);const f=p-t*u/2;if((t===1?f<0:f>e)&&l>0){const m=t===1?-1-f:f-e,S=Math.min(m,l);for(let g=n;g<s.length;g++)s[g].Oi(s[g].Vi()+t*S);l-=S}}else n=h,l=t===1?b-u-d:d-(b+u)}}class gr{constructor(t,e,i,n){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new qe(200),this.Qr=null,this.Wv=0,this.jv=!1,this.Hv=()=>{this.jv||this.tn.$v().$t().Uh()},this.Uv=()=>{this.jv||this.tn.$v().$t().Uh()},this.tn=t,this.cn=e,this.ko=e.layout,this.Oc=i,this.qv=n==="left",this.Yv=Ss("normal",n),this.Zv=Ss("top",n),this.Xv=Ss("bottom",n),this.Kv=document.createElement("div"),this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Kv.style.width="25px",this.Kv.style.left="0",this.Kv.style.position="relative",this.Gv=_e(this.Kv,ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const r=this.Gv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jv=_e(this.Kv,ft({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const o=this.Jv.canvasElement;o.style.position="absolute",o.style.zIndex="2",o.style.left="0",o.style.top="0";const l={bv:this.Qv.bind(this),pv:this.Qv.bind(this),av:this.tp.bind(this),hv:this.tp.bind(this),wv:this.ip.bind(this),cv:this.np.bind(this),_v:this.np.bind(this),qf:this.sp.bind(this),jf:this.sp.bind(this),Qf:this.ep.bind(this),Pv:this.rp.bind(this)};this.hp=new ys(this.Jv.canvasElement,l,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ce(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ce(this.Gv.canvasElement),this.Gv.dispose(),this.Li!==null&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const t=this.Oc.W();return this.Qr!==t.R&&(this.Fv.nr(),this.Qr=t.R),t}op(){if(this.Li===null)return 0;let t=0;const e=this.ap(),i=E(this.Gv.canvasElement.getContext("2d"));i.save();const n=this.Li.Ha();i.font=this._p(),n.length>0&&(t=Math.max(this.Fv.xi(i,n[0].so),this.Fv.xi(i,n[n.length-1].so)));const r=this.up();for(let a=r.length;a--;){const c=this.Fv.xi(i,r[a].Kt());c>t&&(t=c)}const o=this.Li.Ct();if(o!==null&&this.Ev!==null&&(l=this.cn.crosshair).mode!==2&&l.horzLine.visible&&l.horzLine.labelVisible){const a=this.Li.pn(1,o),c=this.Li.pn(this.Ev.height-2,o);t=Math.max(t,this.Fv.xi(i,this.Li.Fi(Math.floor(Math.min(a,c))+.11111111111111,o)),this.Fv.xi(i,this.Li.Fi(Math.ceil(Math.max(a,c))-.11111111111111,o)))}var l;i.restore();const h=t||34;return ps(Math.ceil(e.C+e.T+e.A+e.I+5+h))}cp(t){this.Ev!==null&&we(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`)}dp(){return E(this.Ev).width}Gi(t){this.Li!==t&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=t,t.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const t=this.tn.fp();this.tn.$v().$t().E_(t,E(this.Dt()))}vp(t){if(this.Ev===null)return;if(t!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const i=Se(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((n=>{this.mp(n),this.Ie(n)})),this.tn.bp(i,this.Xv),this.wp(i),this.tn.bp(i,this.Yv),this.gp(i))}this.Jv.applySuggestedBitmapSize();const e=Se(this.Jv);e!==null&&(e.useBitmapCoordinateSpace((({context:i,bitmapSize:n})=>{i.clearRect(0,0,n.width,n.height)})),this.Mp(e),this.tn.bp(e,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const n=this.xp();n.width>0&&n.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}bt(){var t;(t=this.Li)===null||t===void 0||t.Ha()}Qv(t){if(this.Li===null||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!0,e.V_(i,this.Li,t.localY)}tp(t){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp(),n=this.Li;e.O_(i,n,t.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),e=this.tn.fp(),i=this.Li;this.Nv&&(this.Nv=!1,t.B_(e,i))}np(t){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!1,e.B_(i,this.Li)}sp(t){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(t){this.Li!==null&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(t){this.kp(0)}up(){const t=[],e=this.Li===null?void 0:this.Li;return(i=>{for(let n=0;n<i.length;++n){const r=i[n].Rn(this.tn.fp(),e);for(let o=0;o<r.length;o++)t.push(r[o])}})(this.tn.fp().Uo()),t}mp({context:t,bitmapSize:e}){const{width:i,height:n}=e,r=this.tn.fp().$t(),o=r.q(),l=r.bd();o===l?ci(t,0,0,i,n,o):Sn(t,0,0,i,n,o,l)}Ie({context:t,bitmapSize:e,horizontalPixelRatio:i}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;t.fillStyle=this.Li.W().borderColor;const n=Math.max(1,Math.floor(this.ap().C*i));let r;r=this.qv?e.width-n:0,t.fillRect(r,0,n,e.height)}wp(t){if(this.Ev===null||this.Li===null)return;const e=this.Li.Ha(),i=this.Li.W(),n=this.ap(),r=this.qv?this.Ev.width-n.T:0;i.borderVisible&&i.ticksVisible&&t.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:h})=>{o.fillStyle=i.borderColor;const a=Math.max(1,Math.floor(h)),c=Math.floor(.5*h),u=Math.round(n.T*l);o.beginPath();for(const d of e)o.rect(Math.floor(r*l),Math.round(d.Ea*h)-c,u,a);o.fill()})),t.useMediaCoordinateSpace((({context:o})=>{var l;o.font=this._p(),o.fillStyle=(l=i.textColor)!==null&&l!==void 0?l:this.ko.textColor,o.textAlign=this.qv?"right":"left",o.textBaseline="middle";const h=this.qv?Math.round(r-n.A):Math.round(r+n.T+n.A),a=e.map((c=>this.Fv.Mi(o,c.so)));for(let c=e.length;c--;){const u=e[c];o.fillText(u.so,h,u.Ea+a[c])}}))}pp(){if(this.Ev===null||this.Li===null)return;const t=[],e=this.Li.Uo().slice(),i=this.tn.fp(),n=this.ap();this.Li===i.pr()&&this.tn.fp().Uo().forEach((o=>{i.vr(o)&&e.push(o)}));const r=this.Li;e.forEach((o=>{o.Rn(i,r).forEach((l=>{l.Oi(null),l.Bi()&&t.push(l)}))})),t.forEach((o=>o.Oi(o.ki()))),this.Li.W().alignLabels&&this.yp(t,n)}yp(t,e){if(this.Ev===null)return;const i=this.Ev.height/2,n=t.filter((o=>o.ki()<=i)),r=t.filter((o=>o.ki()>i));n.sort(((o,l)=>l.ki()-o.ki())),r.sort(((o,l)=>o.ki()-l.ki()));for(const o of t){const l=Math.floor(o.At(e)/2),h=o.ki();h>-l&&h<l&&o.Oi(l),h>this.Ev.height-l&&h<this.Ev.height+l&&o.Oi(this.Ev.height-l)}br(n,1,this.Ev.height,e),br(r,-1,this.Ev.height,e)}gp(t){if(this.Ev===null)return;const e=this.up(),i=this.ap(),n=this.qv?"right":"left";e.forEach((r=>{r.Ai()&&r.gt(E(this.Li)).X(t,i,this.Fv,n)}))}Mp(t){if(this.Ev===null||this.Li===null)return;const e=this.tn.$v().$t(),i=[],n=this.tn.fp(),r=e.Zc().Rn(n,this.Li);r.length&&i.push(r);const o=this.ap(),l=this.qv?"right":"left";i.forEach((h=>{h.forEach((a=>{a.gt(E(this.Li)).X(t,o,this.Fv,l)}))}))}kp(t){this.Kv.style.cursor=t===1?"ns-resize":"default"}fo(){const t=this.op();this.Wv<t&&this.tn.$v().$t().Kl(),this.Wv=t}_p(){return ze(this.ko.fontSize,this.ko.fontFamily)}}function Jh(s,t){var e,i;return(i=(e=s.ua)===null||e===void 0?void 0:e.call(s,t))!==null&&i!==void 0?i:[]}function Ei(s,t){var e,i;return(i=(e=s.Pn)===null||e===void 0?void 0:e.call(s,t))!==null&&i!==void 0?i:[]}function Gh(s,t){var e,i;return(i=(e=s.Ji)===null||e===void 0?void 0:e.call(s,t))!==null&&i!==void 0?i:[]}function Yh(s,t){var e,i;return(i=(e=s.aa)===null||e===void 0?void 0:e.call(s,t))!==null&&i!==void 0?i:[]}class xs{constructor(t,e){this.Ev=ft({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Ct,this.Op=new Ct,this.Bp=0,this.Ap=!1,this.Ip=null,this.zp=!1,this.Lp=null,this.Ep=null,this.jv=!1,this.Hv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Uv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Qd=t,this.Np=e,this.Np.W_().l(this.Fp.bind(this),this,!0),this.Wp=document.createElement("td"),this.Wp.style.padding="0",this.Wp.style.position="relative";const i=document.createElement("div");i.style.width="100%",i.style.height="100%",i.style.position="relative",i.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(i),this.Gv=_e(i,ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const n=this.Gv.canvasElement;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.Jv=_e(i,ft({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const r=this.Jv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.$p=document.createElement("tr"),this.$p.appendChild(this.jp),this.$p.appendChild(this.Wp),this.$p.appendChild(this.Hp),this.Up(),this.hp=new ys(this.Jv.canvasElement,this,{ev:()=>this.Ip===null&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>this.Ip===null&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.Cp!==null&&this.Cp.S(),this.Tp!==null&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ce(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ce(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return E(this.Np)}qp(t){var e,i;this.Np!==null&&this.Np.W_().p(this),this.Np=t,this.Np!==null&&this.Np.W_().l(xs.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=(e=this.Pp)!==null&&e!==void 0?e:new jh(this.Wp,this.Qd),this.Pp.bt()):((i=this.Pp)===null||i===void 0||i.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(this.Np!==null&&(this.Zp(),this.$i().wt().length!==0)){if(this.Cp!==null){const t=this.Np.R_();this.Cp.Gi(E(t))}if(this.Tp!==null){const t=this.Np.D_();this.Tp.Gi(E(t))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(t){this.Np&&this.Np.x_(t)}Qf(t){if(!this.Np)return;this.Kp();const e=t.localX,i=t.localY;this.Gp(e,i,t)}bv(t){this.Kp(),this.Jp(),this.Gp(t.localX,t.localY,t)}tv(t){var e;if(!this.Np)return;this.Kp();const i=t.localX,n=t.localY;this.Gp(i,n,t);const r=this.wr(i,n);this.Qd.Qp((e=r?.Lv)!==null&&e!==void 0?e:null),this.$i().jc(r&&{Hc:r.Hc,Iv:r.Iv})}dv(t){this.Np!==null&&(this.Kp(),this.tm(t))}qf(t){this.Np!==null&&this.im(this.Op,t)}jf(t){this.qf(t)}av(t){this.Kp(),this.nm(t),this.Gp(t.localX,t.localY,t)}cv(t){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(t))}uv(t){this.Np!==null&&this.tm(t)}Rv(t){if(this.Ap=!0,this.Ip===null){const e={x:t.localX,y:t.localY};this.rm(e,e,t)}}Pv(t){this.Np!==null&&(this.Kp(),this.Np.$t().jc(null),this.hm())}lm(){return this.Vp}am(){return this.Op}xv(){this.Bp=1,this.$i().Un()}Sv(t,e){if(!this.Qd.W().handleScale.pinch)return;const i=5*(e-this.Bp);this.Bp=e,this.$i().Qc(t.nt,i)}pv(t){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const e=this.$i().Zc();this.Ip!==null&&e.yt()&&(this.Lp={x:e.Yt(),y:e.Zt()},this.Ip={x:t.localX,y:t.localY})}hv(t){if(this.Np===null)return;const e=t.localX,i=t.localY;if(this.Ip===null)this.nm(t);else{this.zp=!1;const n=E(this.Lp),r=n.x+(e-this.Ip.x),o=n.y+(i-this.Ip.y);this.Gp(r,o,t)}}_v(t){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(t)}wr(t,e){const i=this.Np;return i===null?null:(function(n,r,o){const l=n.Uo(),h=(function(a,c,u){var d,b;let p,f;for(const g of a){const x=(b=(d=g.va)===null||d===void 0?void 0:d.call(g,c,u))!==null&&b!==void 0?b:[];for(const M of x)m=M.zOrder,(!(S=p?.zOrder)||m==="top"&&S!=="top"||m==="normal"&&S==="bottom")&&(p=M,f=g)}var m,S;return p&&f?{zv:p,Hc:f}:null})(l,r,o);if(h?.zv.zOrder==="top")return Ci(h);for(const a of l){if(h&&h.Hc===a&&h.zv.zOrder!=="bottom"&&!h.zv.isBackground)return Ci(h);const c=Xh(a.Pn(n),r,o);if(c!==null)return{Hc:a,Bv:c.Bv,Iv:c.Iv};if(h&&h.Hc===a&&h.zv.zOrder!=="bottom"&&h.zv.isBackground)return Ci(h)}return h?.zv?Ci(h):null})(i,t,e)}_m(t,e){E(e==="left"?this.Cp:this.Tp).cp(ft({width:t,height:this.Ev.height}))}um(){return this.Ev}cp(t){we(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Wp.style.width=t.width+"px",this.Wp.style.height=t.height+"px")}dm(){const t=E(this.Np);t.P_(t.R_()),t.P_(t.D_());for(const e of t.Ba())if(t.vr(e)){const i=e.Dt();i!==null&&t.P_(i),e.Vn()}}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const n=this.xp();n.width>0&&n.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}vp(t){if(t===0||this.Np===null)return;if(t>1&&this.dm(),this.Cp!==null&&this.Cp.vp(t),this.Tp!==null&&this.Tp.vp(t),t!==1){this.Gv.applySuggestedBitmapSize();const i=Se(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((n=>{this.mp(n)})),this.Np&&(this.fm(i,Jh),this.vm(i),this.pm(i),this.fm(i,Ei),this.fm(i,Gh)))}this.Jv.applySuggestedBitmapSize();const e=Se(this.Jv);e!==null&&(e.useBitmapCoordinateSpace((({context:i,bitmapSize:n})=>{i.clearRect(0,0,n.width,n.height)})),this.bm(e),this.fm(e,Yh))}wm(){return this.Cp}gm(){return this.Tp}bp(t,e){this.fm(t,e)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(t){this.im(this.Vp,t)}im(t,e){const i=e.localX,n=e.localY;t.M()&&t.m(this.$i().St().Nu(i),{x:i,y:n},e)}mp({context:t,bitmapSize:e}){const{width:i,height:n}=e,r=this.$i(),o=r.q(),l=r.bd();o===l?ci(t,0,0,i,n,l):Sn(t,0,0,i,n,o,l)}vm(t){const e=E(this.Np).j_().qh().gt();e!==null&&e.X(t,!1)}pm(t){const e=this.$i().Yc();this.Mm(t,Ei,gs,e),this.Mm(t,Ei,xi,e)}bm(t){this.Mm(t,Ei,xi,this.$i().Zc())}fm(t,e){const i=E(this.Np).Uo();for(const n of i)this.Mm(t,e,gs,n);for(const n of i)this.Mm(t,e,xi,n)}Mm(t,e,i,n){const r=E(this.Np),o=r.$t().Wc(),l=o!==null&&o.Hc===n,h=o!==null&&l&&o.Iv!==void 0?o.Iv.Mr:void 0;vs(e,(a=>i(a,t,l,h)),n,r)}Zp(){if(this.Np===null)return;const t=this.Qd,e=this.Np.R_().W().visible,i=this.Np.D_().W().visible;e||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),i||this.Tp===null||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const n=t.$t().ud();e&&this.Cp===null&&(this.Cp=new gr(this,t.W(),n,"left"),this.jp.appendChild(this.Cp.lp())),i&&this.Tp===null&&(this.Tp=new gr(this,t.W(),n,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(t){return t.Dv&&this.Ap||this.Ip!==null}Sm(t){return Math.max(0,Math.min(t,this.Ev.width-1))}km(t){return Math.max(0,Math.min(t,this.Ev.height-1))}Gp(t,e,i){this.$i().ld(this.Sm(t),this.km(e),i,E(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(t,e,i){this.Ip=t,this.zp=!1,this.Gp(e.x,e.y,i);const n=this.$i().Zc();this.Lp={x:n.Yt(),y:n.Zt()}}$i(){return this.Qd.$t()}sm(t){if(!this.Dp)return;const e=this.$i(),i=this.fp();if(e.z_(i,i.vn()),this.Rp=null,this.Dp=!1,e.ed(),this.Ep!==null){const n=performance.now(),r=e.St();this.Ep.Vr(r.Hu(),n),this.Ep.Qu(n)||e.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)E(document.activeElement).blur();else{const t=document.getSelection();t!==null&&t.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(t){if(this.Np===null)return;const e=this.$i(),i=e.St();if(i.Ni())return;const n=this.Qd.W(),r=n.handleScroll,o=n.kineticScroll;if((!r.pressedMouseMove||t.Dv)&&(!r.horzTouchDrag&&!r.vertTouchDrag||!t.Dv))return;const l=this.Np.vn(),h=performance.now();if(this.Rp!==null||this.xm(t)||(this.Rp={x:t.clientX,y:t.clientY,Od:h,ym:t.localX,Cm:t.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==t.clientX||this.Rp.y!==t.clientY)){if(t.Dv&&o.touch||!t.Dv&&o.mouse){const a=i.le();this.Ep=new qh(.2/a,7/a,.997,15/a),this.Ep.Yd(i.Hu(),this.Rp.Od)}else this.Ep=null;l.Ni()||e.A_(this.Np,l,t.localY),e.nd(t.localX),this.Dp=!0}this.Dp&&(l.Ni()||e.I_(this.Np,l,t.localY),e.sd(t.localX),this.Ep!==null&&this.Ep.Yd(i.Hu(),h))}}class vr{constructor(t,e,i,n,r){this.ft=!0,this.Ev=ft({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=t==="left",this.Oc=i.ud,this.cn=e,this.Tm=n,this.Pm=r,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=_e(this.Kv,ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ce(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(t){we(this.Ev,t)||(this.Ev=t,this.Gv.resizeCanvasElement(t),this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`,this.ft=!0)}vp(t){if(t<3&&!this.ft||this.Ev.width===0||this.Ev.height===0)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const e=Se(this.Gv);e!==null&&e.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i)}))}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const n=this.xp();n.width>0&&n.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}Ie({context:t,bitmapSize:e,horizontalPixelRatio:i,verticalPixelRatio:n}){if(!this.Tm())return;t.fillStyle=this.cn.timeScale.borderColor;const r=Math.floor(this.Oc.W().C*i),o=Math.floor(this.Oc.W().C*n),l=this.qv?e.width-r:0;t.fillRect(l,0,r,o)}mp({context:t,bitmapSize:e}){ci(t,0,0,e.width,e.height,this.Pm())}}function _s(s){return t=>{var e,i;return(i=(e=t.fa)===null||e===void 0?void 0:e.call(t,s))!==null&&i!==void 0?i:[]}}const Qh=_s("normal"),Zh=_s("top"),ta=_s("bottom");class ea{constructor(t,e){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=ft({width:0,height:0}),this.Om=new Ct,this.Fv=new qe(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=t,this.q_=e,this.cn=t.W().layout,this.Xd=document.createElement("tr"),this.Bm=document.createElement("td"),this.Bm.style.padding="0",this.Am=document.createElement("td"),this.Am.style.padding="0",this.Kv=document.createElement("td"),this.Kv.style.height="25px",this.Kv.style.padding="0",this.Im=document.createElement("div"),this.Im.style.width="100%",this.Im.style.height="100%",this.Im.style.position="relative",this.Im.style.overflow="hidden",this.Kv.appendChild(this.Im),this.Gv=_e(this.Im,ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const i=this.Gv.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Jv=_e(this.Im,ft({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const n=this.Jv.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.style.top="0",this.Xd.appendChild(this.Bm),this.Xd.appendChild(this.Kv),this.Xd.appendChild(this.Am),this.zm(),this.Qd.$t().g_().l(this.zm.bind(this),this),this.hp=new ys(this.Jv.canvasElement,this,{ev:()=>!0,rv:()=>!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.hp.S(),this.Rm!==null&&this.Rm.S(),this.Dm!==null&&this.Dm.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ce(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ce(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(t){if(this.Vm)return;this.Vm=!0;const e=this.Qd.$t();!e.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&e.Jc(t.localX)}pv(t){this.bv(t)}wv(){const t=this.Qd.$t();!t.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&t.hd())}av(t){const e=this.Qd.$t();!e.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&e.rd(t.localX)}hv(t){this.av(t)}cv(){this.Vm=!1;const t=this.Qd.$t();t.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||t.hd()}_v(){this.cv()}qf(){this.Qd.W().handleScale.axisDoubleClickReset.time&&this.Qd.$t().Kn()}jf(){this.qf()}Qf(){this.Qd.$t().W().handleScale.axisPressedMouseMove.time&&this.kp(1)}Pv(){this.kp(0)}um(){return this.Ev}Nm(){return this.Om}Fm(t,e,i){we(this.Ev,t)||(this.Ev=t,this.jv=!0,this.Gv.resizeCanvasElement(t),this.Jv.resizeCanvasElement(t),this.jv=!1,this.Kv.style.width=`${t.width}px`,this.Kv.style.height=`${t.height}px`,this.Om.m(t)),this.Rm!==null&&this.Rm.cp(ft({width:e,height:t.height})),this.Dm!==null&&this.Dm.cp(ft({width:i,height:t.height}))}Wm(){const t=this.jm();return Math.ceil(t.C+t.T+t.P+t.L+t.B+t.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(t,e,i){const n=this.xp();n.width>0&&n.height>0&&t.drawImage(this.Gv.canvasElement,e,i)}vp(t){if(t===0)return;if(t!==1){this.Gv.applySuggestedBitmapSize();const i=Se(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((n=>{this.mp(n),this.Ie(n),this.$m(i,ta)})),this.wp(i),this.$m(i,Qh)),this.Rm!==null&&this.Rm.vp(t),this.Dm!==null&&this.Dm.vp(t)}this.Jv.applySuggestedBitmapSize();const e=Se(this.Jv);e!==null&&(e.useBitmapCoordinateSpace((({context:i,bitmapSize:n})=>{i.clearRect(0,0,n.width,n.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],e),this.$m(e,Zh))}$m(t,e){const i=this.Qd.$t().wt();for(const n of i)vs(e,(r=>gs(r,t,!1,void 0)),n,void 0);for(const n of i)vs(e,(r=>xi(r,t,!1,void 0)),n,void 0)}mp({context:t,bitmapSize:e}){ci(t,0,0,e.width,e.height,this.Qd.$t().bd())}Ie({context:t,bitmapSize:e,verticalPixelRatio:i}){if(this.Qd.W().timeScale.borderVisible){t.fillStyle=this.qm();const n=Math.max(1,Math.floor(this.jm().C*i));t.fillRect(0,0,e.width,n)}}wp(t){const e=this.Qd.$t().St(),i=e.Ha();if(!i||i.length===0)return;const n=this.q_.maxTickMarkWeight(i),r=this.jm(),o=e.W();o.borderVisible&&o.ticksVisible&&t.useBitmapCoordinateSpace((({context:l,horizontalPixelRatio:h,verticalPixelRatio:a})=>{l.strokeStyle=this.qm(),l.fillStyle=this.qm();const c=Math.max(1,Math.floor(h)),u=Math.floor(.5*h);l.beginPath();const d=Math.round(r.T*a);for(let b=i.length;b--;){const p=Math.round(i[b].coord*h);l.rect(p-u,0,c,d)}l.fill()})),t.useMediaCoordinateSpace((({context:l})=>{const h=r.C+r.T+r.L+r.P/2;l.textAlign="center",l.textBaseline="middle",l.fillStyle=this.$(),l.font=this._p();for(const a of i)if(a.weight<n){const c=a.needAlignCoordinate?this.Ym(l,a.coord,a.label):a.coord;l.fillText(a.label,c,h)}this.Qd.W().timeScale.allowBoldLabels&&(l.font=this.Zm());for(const a of i)if(a.weight>=n){const c=a.needAlignCoordinate?this.Ym(l,a.coord,a.label):a.coord;l.fillText(a.label,c,h)}}))}Ym(t,e,i){const n=this.Fv.xi(t,i),r=n/2,o=Math.floor(e-r)+.5;return o<0?e+=Math.abs(0-o):o+n>this.Ev.width&&(e-=Math.abs(this.Ev.width-(o+n))),e}Um(t,e){const i=this.jm();for(const n of t)for(const r of n.Qi())r.gt().X(e,i)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return ze(this.j(),this.cn.fontFamily)}Zm(){return ze(this.j(),this.cn.fontFamily,"bold")}jm(){this.k===null&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new qe,Hm:0});const t=this.k,e=this._p();if(t.R!==e){const i=this.j();t.P=i,t.R=e,t.L=3*i/12,t.B=3*i/12,t.ji=9*i/12,t.N=0,t.Hm=4*i/12,t.Wi.nr()}return this.k}kp(t){this.Kv.style.cursor=t===1?"ew-resize":"default"}zm(){const t=this.Qd.$t(),e=t.W();e.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),e.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const i={ud:this.Qd.$t().ud()},n=()=>e.leftPriceScale.borderVisible&&t.St().W().borderVisible,r=()=>t.bd();e.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new vr("left",e,i,n,r),this.Bm.appendChild(this.Rm.lp())),e.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new vr("right",e,i,n,r),this.Am.appendChild(this.Dm.lp()))}}const ia=!!Re&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((s=>s.brand.includes("Chromium")))&&!!Re&&(!((Cs=navigator?.userAgentData)===null||Cs===void 0)&&Cs.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var Cs;class sa{constructor(t,e,i){var n;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new Ct,this.Op=new Ct,this.Rc=new Ct,this.ib=null,this.nb=null,this.Jd=t,this.cn=e,this.q_=i,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(n=this.Xd).style.userSelect="none",n.style.webkitUserSelect="none",n.style.msUserSelect="none",n.style.MozUserSelect="none",n.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Es(this.cn)&&this.hb(!0),this.$i=new $h(this.Vc.bind(this),this.cn,i),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new ea(this,this.q_),this.sb.appendChild(this.ab.lp());const r=e.autoSize&&this.ob();let o=this.cn.width,l=this.cn.height;if(r||o===0||l===0){const h=t.getBoundingClientRect();o=o||h.width,l=l||h.height}this._b(o,l),this.ub(),t.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),this.Km!==0&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const t of this.Xm)this.sb.removeChild(t.lp()),t.lm().p(this),t.am().p(this),t.S();this.Xm=[],E(this.ab).S(),this.Xd.parentElement!==null&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(t,e,i=!1){if(this.ho===e&&this.__===t)return;const n=(function(l){const h=Math.floor(l.width),a=Math.floor(l.height);return ft({width:h-h%2,height:a-a%2})})(ft({width:t,height:e}));this.ho=n.height,this.__=n.width;const r=this.ho+"px",o=this.__+"px";E(this.Xd).style.height=r,E(this.Xd).style.width=o,this.sb.style.height=r,this.sb.style.width=o,i?this.mb(Pt.es(),performance.now()):this.$i.Kl()}vp(t){t===void 0&&(t=Pt.es());for(let e=0;e<this.Xm.length;e++)this.Xm[e].vp(t.Hn(e).Fn);this.cn.timeScale.visible&&this.ab.vp(t.jn())}$h(t){const e=Es(this.cn);this.$i.$h(t);const i=Es(this.cn);i!==e&&this.hb(i),this.cb(),this.bb(t)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){this.Qm!==null&&(this.mb(this.Qm,performance.now()),this.Qm=null);const t=this.gb(null),e=document.createElement("canvas");e.width=t.width,e.height=t.height;const i=E(e.getContext("2d"));return this.gb(i),e}Mb(t){return t==="left"&&!this.xb()||t==="right"&&!this.Sb()||this.Xm.length===0?0:E(t==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(t){this.nb=t,this.nb?this.yb().style.setProperty("cursor",t):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return Ft(this.Xm[0]).um()}bb(t){(t.autoSize!==void 0||!this.ib||t.width===void 0&&t.height===void 0)&&(t.autoSize&&!this.ib&&this.ob(),t.autoSize===!1&&this.ib!==null&&this.pb(),t.autoSize||t.width===void 0&&t.height===void 0||this._b(t.width||this.__,t.height||this.ho))}gb(t){let e=0,i=0;const n=this.Xm[0],r=(l,h)=>{let a=0;for(let c=0;c<this.Xm.length;c++){const u=this.Xm[c],d=E(l==="left"?u.wm():u.gm()),b=d.xp();t!==null&&d.Sp(t,h,a),a+=b.height}};this.xb()&&(r("left",0),e+=E(n.wm()).xp().width);for(let l=0;l<this.Xm.length;l++){const h=this.Xm[l],a=h.xp();t!==null&&h.Sp(t,e,i),i+=a.height}e+=n.xp().width,this.Sb()&&(r("right",e),e+=E(n.gm()).xp().width);const o=(l,h,a)=>{E(l==="left"?this.ab.Lm():this.ab.Em()).Sp(E(t),h,a)};if(this.cn.timeScale.visible){const l=this.ab.xp();if(t!==null){let h=0;this.xb()&&(o("left",h,i),h=E(n.wm()).xp().width),this.ab.Sp(t,h,i),h+=l.width,this.Sb()&&o("right",h,i)}i+=l.height}return ft({width:e,height:i})}Pb(){let t=0,e=0,i=0;for(const p of this.Xm)this.xb()&&(e=Math.max(e,E(p.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(i=Math.max(i,E(p.gm()).op(),this.cn.rightPriceScale.minimumWidth)),t+=p.M_();e=ps(e),i=ps(i);const n=this.__,r=this.ho,o=Math.max(n-e-i,0),l=this.cn.timeScale.visible;let h=l?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var a;h=(a=h)+a%2;const c=0+h,u=r<c?0:r-c,d=u/t;let b=0;for(let p=0;p<this.Xm.length;++p){const f=this.Xm[p];f.qp(this.$i.qc()[p]);let m=0,S=0;S=p===this.Xm.length-1?u-b:Math.round(f.M_()*d),m=Math.max(S,2),b+=m,f.cp(ft({width:o,height:m})),this.xb()&&f._m(e,"left"),this.Sb()&&f._m(i,"right"),f.fp()&&this.$i.Kc(f.fp(),m)}this.ab.Fm(ft({width:l?o:0,height:h}),l?e:0,l?i:0),this.$i.S_(o),this.Gm!==e&&(this.Gm=e),this.Jm!==i&&(this.Jm=i)}hb(t){t?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(t){switch(t.deltaMode){case t.DOM_DELTA_PAGE:return 120;case t.DOM_DELTA_LINE:return 32}return ia?1/window.devicePixelRatio:1}rb(t){if(!(t.deltaX!==0&&this.cn.handleScroll.mouseWheel||t.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const e=this.Rb(t),i=e*t.deltaX/100,n=-e*t.deltaY/100;if(t.cancelable&&t.preventDefault(),n!==0&&this.cn.handleScale.mouseWheel){const r=Math.sign(n)*Math.min(1,Math.abs(n)),o=t.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(o,r)}i!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*i)}mb(t,e){var i;const n=t.jn();n===3&&this.Db(),n!==3&&n!==2||(this.Vb(t),this.Ob(t,e),this.ab.bt(),this.Xm.forEach((r=>{r.Xp()})),((i=this.Qm)===null||i===void 0?void 0:i.jn())===3&&(this.Qm.ts(t),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,e),t=this.Qm,this.Qm=null)),this.vp(t)}Ob(t,e){for(const i of t.Qn())this.ns(i,e)}Vb(t){const e=this.$i.qc();for(let i=0;i<e.length;i++)t.Hn(i).Wn&&e[i].N_()}ns(t,e){const i=this.$i.St();switch(t.qn){case 0:i.hc();break;case 1:i.lc(t.Vt);break;case 2:i.Gn(t.Vt);break;case 3:i.Jn(t.Vt);break;case 4:i.qu();break;case 5:t.Vt.Qu(e)||i.Jn(t.Vt.tc(e))}}Vc(t){this.Qm!==null?this.Qm.ts(t):this.Qm=t,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((e=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const i=this.Qm;this.Qm=null,this.mb(i,e);for(const n of i.Qn())if(n.qn===5&&!n.Vt.Qu(e)){this.$t().Zn(n.Vt);break}}})))}Db(){this.ub()}ub(){const t=this.$i.qc(),e=t.length,i=this.Xm.length;for(let n=e;n<i;n++){const r=Ft(this.Xm.pop());this.sb.removeChild(r.lp()),r.lm().p(this),r.am().p(this),r.S()}for(let n=i;n<e;n++){const r=new xs(this,t[n]);r.lm().l(this.Bb.bind(this),this),r.am().l(this.Ab.bind(this),this),this.Xm.push(r),this.sb.insertBefore(r.lp(),this.ab.lp())}for(let n=0;n<e;n++){const r=t[n],o=this.Xm[n];o.fp()!==r?o.qp(r):o.Up()}this.cb(),this.Pb()}Ib(t,e,i){var n;const r=new Map;t!==null&&this.$i.wt().forEach((c=>{const u=c.In().ll(t);u!==null&&r.set(c,u)}));let o;if(t!==null){const c=(n=this.$i.St().Ui(t))===null||n===void 0?void 0:n.originalTime;c!==void 0&&(o=c)}const l=this.$t().Wc(),h=l!==null&&l.Hc instanceof rs?l.Hc:void 0,a=l!==null&&l.Iv!==void 0?l.Iv.gr:void 0;return{zb:o,ee:t??void 0,Lb:e??void 0,Eb:h,Nb:r,Fb:a,Wb:i??void 0}}Bb(t,e,i){this.Vp.m((()=>this.Ib(t,e,i)))}Ab(t,e,i){this.Op.m((()=>this.Ib(t,e,i)))}lb(t,e,i){this.Rc.m((()=>this.Ib(t,e,i)))}cb(){const t=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=t}xb(){return this.Xm[0].fp().R_().W().visible}Sb(){return this.Xm[0].fp().D_().W().visible}ob(){return"ResizeObserver"in window&&(this.ib=new ResizeObserver((t=>{const e=t.find((i=>i.target===this.Jd));e&&this._b(e.contentRect.width,e.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){this.ib!==null&&this.ib.disconnect(),this.ib=null}}function Es(s){return!!(s.handleScroll.mouseWheel||s.handleScale.mouseWheel)}function na(s){return(function(t){return t.open!==void 0})(s)||(function(t){return t.value!==void 0})(s)}function yr(s,t){var e={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(i=Object.getOwnPropertySymbols(s);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(s,i[n])&&(e[i[n]]=s[i[n]])}return e}function wr(s,t,e,i){const n=e.value,r={ee:t,ot:s,Vt:[n,n,n,n],zb:i};return e.color!==void 0&&(r.V=e.color),r}function ra(s,t,e,i){const n=e.value,r={ee:t,ot:s,Vt:[n,n,n,n],zb:i};return e.lineColor!==void 0&&(r.lt=e.lineColor),e.topColor!==void 0&&(r.Ps=e.topColor),e.bottomColor!==void 0&&(r.Rs=e.bottomColor),r}function oa(s,t,e,i){const n=e.value,r={ee:t,ot:s,Vt:[n,n,n,n],zb:i};return e.topLineColor!==void 0&&(r.Re=e.topLineColor),e.bottomLineColor!==void 0&&(r.De=e.bottomLineColor),e.topFillColor1!==void 0&&(r.ke=e.topFillColor1),e.topFillColor2!==void 0&&(r.ye=e.topFillColor2),e.bottomFillColor1!==void 0&&(r.Ce=e.bottomFillColor1),e.bottomFillColor2!==void 0&&(r.Te=e.bottomFillColor2),r}function la(s,t,e,i){const n={ee:t,ot:s,Vt:[e.open,e.high,e.low,e.close],zb:i};return e.color!==void 0&&(n.V=e.color),n}function ha(s,t,e,i){const n={ee:t,ot:s,Vt:[e.open,e.high,e.low,e.close],zb:i};return e.color!==void 0&&(n.V=e.color),e.borderColor!==void 0&&(n.Ot=e.borderColor),e.wickColor!==void 0&&(n.Xh=e.wickColor),n}function aa(s,t,e,i,n){const r=Ft(n)(e),o=Math.max(...r),l=Math.min(...r),h=r[r.length-1],a=[h,o,l,h],c=e,{time:u,color:d}=c;return{ee:t,ot:s,Vt:a,zb:i,$e:yr(c,["time","color"]),V:d}}function Ti(s){return s.Vt!==void 0}function Sr(s,t){return t.customValues!==void 0&&(s.jb=t.customValues),s}function Ee(s){return(t,e,i,n,r,o)=>(function(l,h){return h?h(l):(a=l).open===void 0&&a.value===void 0;var a})(i,o)?Sr({ot:t,ee:e,zb:n},i):Sr(s(t,e,i,n,r),i)}function xr(s){return{Candlestick:Ee(ha),Bar:Ee(la),Area:Ee(ra),Baseline:Ee(oa),Histogram:Ee(wr),Line:Ee(wr),Custom:Ee(aa)}[s]}function _r(s){return{ee:0,Hb:new Map,la:s}}function Cr(s,t){if(s!==void 0&&s.length!==0)return{$b:t.key(s[0].ot),Ub:t.key(s[s.length-1].ot)}}function Er(s){let t;return s.forEach((e=>{t===void 0&&(t=e.zb)})),Ft(t)}class ca{constructor(t){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=t}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(t,e){let i=this.qb.size!==0,n=!1;const r=this.Yb.get(t);if(r!==void 0)if(this.Yb.size===1)i=!1,n=!0,this.qb.clear();else for(const h of this.Xb)h.pointData.Hb.delete(t)&&(n=!0);let o=[];if(e.length!==0){const h=e.map((b=>b.time)),a=this.q_.createConverterToInternalObj(e),c=xr(t.Qh()),u=t.Ca(),d=t.Ta();o=e.map(((b,p)=>{const f=a(b.time),m=this.q_.key(f);let S=this.qb.get(m);S===void 0&&(S=_r(f),this.qb.set(m,S),n=!0);const g=c(f,S.ee,b,h[p],u,d);return S.Hb.set(t,g),g}))}i&&this.Gb(),this.Jb(t,o);let l=-1;if(n){const h=[];this.qb.forEach((a=>{h.push({timeWeight:0,time:a.la,pointData:a,originalTime:Er(a.Hb)})})),h.sort(((a,c)=>this.q_.key(a.time)-this.q_.key(c.time))),l=this.Qb(h)}return this.tw(t,l,(function(h,a,c){const u=Cr(h,c),d=Cr(a,c);if(u!==void 0&&d!==void 0)return{ta:u.Ub>=d.Ub&&u.$b>=d.$b}})(this.Yb.get(t),r,this.q_))}vd(t){return this.Kb(t,[])}iw(t,e){const i=e;(function(f){f.zb===void 0&&(f.zb=f.time)})(i),this.q_.preprocessData(e);const n=this.q_.createConverterToInternalObj([e])(e.time),r=this.Zb.get(t);if(r!==void 0&&this.q_.key(n)<this.q_.key(r))throw new Error(`Cannot update oldest data, last time=${r}, new time=${n}`);let o=this.qb.get(this.q_.key(n));const l=o===void 0;o===void 0&&(o=_r(n),this.qb.set(this.q_.key(n),o));const h=xr(t.Qh()),a=t.Ca(),c=t.Ta(),u=h(n,o.ee,e,i.zb,a,c);o.Hb.set(t,u),this.nw(t,u);const d={ta:Ti(u)};if(!l)return this.tw(t,-1,d);const b={timeWeight:0,time:o.la,pointData:o,originalTime:Er(o.Hb)},p=He(this.Xb,this.q_.key(b.time),((f,m)=>this.q_.key(f.time)<m));this.Xb.splice(p,0,b);for(let f=p;f<this.Xb.length;++f)Ts(this.Xb[f].pointData,f);return this.q_.fillWeightsForPoints(this.Xb,p),this.tw(t,p,d)}nw(t,e){let i=this.Yb.get(t);i===void 0&&(i=[],this.Yb.set(t,i));const n=i.length!==0?i[i.length-1]:null;n===null||this.q_.key(e.ot)>this.q_.key(n.ot)?Ti(e)&&i.push(e):Ti(e)?i[i.length-1]=e:i.splice(-1,1),this.Zb.set(t,e.ot)}Jb(t,e){e.length!==0?(this.Yb.set(t,e.filter(Ti)),this.Zb.set(t,e[e.length-1].ot)):(this.Yb.delete(t),this.Zb.delete(t))}Gb(){for(const t of this.Xb)t.pointData.Hb.size===0&&this.qb.delete(this.q_.key(t.time))}Qb(t){let e=-1;for(let i=0;i<this.Xb.length&&i<t.length;++i){const n=this.Xb[i],r=t[i];if(this.q_.key(n.time)!==this.q_.key(r.time)){e=i;break}r.timeWeight=n.timeWeight,Ts(r.pointData,i)}if(e===-1&&this.Xb.length!==t.length&&(e=Math.min(this.Xb.length,t.length)),e===-1)return-1;for(let i=e;i<t.length;++i)Ts(t[i].pointData,i);return this.q_.fillWeightsForPoints(t,e),this.Xb=t,e}sw(){if(this.Yb.size===0)return null;let t=0;return this.Yb.forEach((e=>{e.length!==0&&(t=Math.max(t,e[e.length-1].ee))})),t}tw(t,e,i){const n={ew:new Map,St:{Eu:this.sw()}};if(e!==-1)this.Yb.forEach(((r,o)=>{n.ew.set(o,{$e:r,rw:o===t?i:void 0})})),this.Yb.has(t)||n.ew.set(t,{$e:[],rw:i}),n.St.hw=this.Xb,n.St.lw=e;else{const r=this.Yb.get(t);n.ew.set(t,{$e:r||[],rw:i})}return n}}function Ts(s,t){s.ee=t,s.Hb.forEach((e=>{e.ee=t}))}function Ms(s){const t={value:s.Vt[3],time:s.zb};return s.jb!==void 0&&(t.customValues=s.jb),t}function Tr(s){const t=Ms(s);return s.V!==void 0&&(t.color=s.V),t}function ua(s){const t=Ms(s);return s.lt!==void 0&&(t.lineColor=s.lt),s.Ps!==void 0&&(t.topColor=s.Ps),s.Rs!==void 0&&(t.bottomColor=s.Rs),t}function fa(s){const t=Ms(s);return s.Re!==void 0&&(t.topLineColor=s.Re),s.De!==void 0&&(t.bottomLineColor=s.De),s.ke!==void 0&&(t.topFillColor1=s.ke),s.ye!==void 0&&(t.topFillColor2=s.ye),s.Ce!==void 0&&(t.bottomFillColor1=s.Ce),s.Te!==void 0&&(t.bottomFillColor2=s.Te),t}function Mr(s){const t={open:s.Vt[0],high:s.Vt[1],low:s.Vt[2],close:s.Vt[3],time:s.zb};return s.jb!==void 0&&(t.customValues=s.jb),t}function da(s){const t=Mr(s);return s.V!==void 0&&(t.color=s.V),t}function pa(s){const t=Mr(s),{V:e,Ot:i,Xh:n}=s;return e!==void 0&&(t.color=e),i!==void 0&&(t.borderColor=i),n!==void 0&&(t.wickColor=n),t}function ks(s){return{Area:ua,Line:Tr,Baseline:fa,Histogram:Tr,Bar:da,Candlestick:pa,Custom:ma}[s]}function ma(s){const t=s.zb;return Object.assign(Object.assign({},s.$e),{time:t})}const ba={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},ga={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},va={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Ki,attributionLogo:!0},Ls={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},ya={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},wa={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Ki,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function kr(){return{width:0,height:0,autoSize:!1,layout:va,crosshair:ba,grid:ga,overlayPriceScales:Object.assign({},Ls),leftPriceScale:Object.assign(Object.assign({},Ls),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Ls),{visible:!0}),timeScale:ya,watermark:wa,localization:{locale:Re?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 Sa{constructor(t,e){this.aw=t,this.ow=e}applyOptions(t){this.aw.$t().$c(this.ow,t)}options(){return this.Li().W()}width(){return fi(this.ow)?this.aw.Mb(this.ow):0}Li(){return E(this.aw.$t().Uc(this.ow)).Dt}}function Lr(s,t,e){const i=yr(s,["time","originalTime"]),n=Object.assign({time:t},i);return e!==void 0&&(n.originalTime=e),n}const xa={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class _a{constructor(t){this.Nh=t}applyOptions(t){this.Nh.$h(t)}options(){return this.Nh.W()}_w(){return this.Nh}}class Ca{constructor(t,e,i,n,r){this.uw=new Ct,this.Es=t,this.cw=e,this.dw=i,this.q_=r,this.fw=n}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(t){const e=this.Es.Ct();return e===null?null:this.Es.Dt().Rt(t,e.Vt)}coordinateToPrice(t){const e=this.Es.Ct();return e===null?null:this.Es.Dt().pn(t,e.Vt)}barsInLogicalRange(t){if(t===null)return null;const e=new Ne(new Ye(t.from,t.to)).lu(),i=this.Es.In();if(i.Ni())return null;const n=i.ll(e.Os(),1),r=i.ll(e.ui(),-1),o=E(i.el()),l=E(i.An());if(n!==null&&r!==null&&n.ee>r.ee)return{barsBefore:t.from-o,barsAfter:l-t.to};const h={barsBefore:n===null||n.ee===o?t.from-o:n.ee-o,barsAfter:r===null||r.ee===l?l-t.to:l-r.ee};return n!==null&&r!==null&&(h.from=n.zb,h.to=r.zb),h}setData(t){this.q_,this.Es.Qh(),this.cw.pw(this.Es,t),this.mw("full")}update(t){this.Es.Qh(),this.cw.bw(this.Es,t),this.mw("update")}dataByIndex(t,e){const i=this.Es.In().ll(t,e);return i===null?null:ks(this.seriesType())(i)}data(){const t=ks(this.seriesType());return this.Es.In().ne().map((e=>t(e)))}subscribeDataChanged(t){this.uw.l(t)}unsubscribeDataChanged(t){this.uw.v(t)}setMarkers(t){this.q_;const e=t.map((i=>Lr(i,this.q_.convertHorzItemToInternal(i.time),i.time)));this.Es.na(e)}markers(){return this.Es.sa().map((t=>Lr(t,t.originalTime,void 0)))}applyOptions(t){this.Es.$h(t)}options(){return pe(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(t){const e=Qt(pe(xa),t),i=this.Es.ea(e);return new _a(i)}removePriceLine(t){this.Es.ra(t._w())}seriesType(){return this.Es.Qh()}attachPrimitive(t){this.Es.ka(t),t.attached&&t.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(t){this.Es.ya(t),t.detached&&t.detached()}mw(t){this.uw.M()&&this.uw.m(t)}}class Ea{constructor(t,e,i){this.ww=new Ct,this.mu=new Ct,this.Om=new Ct,this.$i=t,this.yl=t.St(),this.ab=e,this.yl.nc().l(this.gw.bind(this)),this.yl.sc().l(this.Mw.bind(this)),this.ab.Nm().l(this.xw.bind(this)),this.q_=i}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(t,e){e?this.yl.Ju(t,1e3):this.$i.Jn(t)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const t=this.yl.Vu();return t===null?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const e={from:this.q_.convertHorzItemToInternal(t.from),to:this.q_.convertHorzItemToInternal(t.to)},i=this.yl.Iu(e);this.$i.pd(i)}getVisibleLogicalRange(){const t=this.yl.Du();return t===null?null:{from:t.Os(),to:t.ui()}}setVisibleLogicalRange(t){be(t.from<=t.to,"The from index cannot be after the to index."),this.$i.pd(t)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(t){const e=this.$i.St();return e.Ni()?null:e.It(t)}coordinateToLogical(t){return this.yl.Ni()?null:this.yl.Nu(t)}timeToCoordinate(t){const e=this.q_.convertHorzItemToInternal(t),i=this.yl.Va(e,!1);return i===null?null:this.yl.It(i)}coordinateToTime(t){const e=this.$i.St(),i=e.Nu(t),n=e.Ui(i);return n===null?null:n.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(t){this.ww.l(t)}unsubscribeVisibleTimeRangeChange(t){this.ww.v(t)}subscribeVisibleLogicalRangeChange(t){this.mu.l(t)}unsubscribeVisibleLogicalRangeChange(t){this.mu.v(t)}subscribeSizeChange(t){this.Om.l(t)}unsubscribeSizeChange(t){this.Om.v(t)}applyOptions(t){this.yl.$h(t)}options(){return Object.assign(Object.assign({},pe(this.yl.W())),{barSpacing:this.yl.le()})}gw(){this.ww.M()&&this.ww.m(this.getVisibleRange())}Mw(){this.mu.M()&&this.mu.m(this.getVisibleLogicalRange())}xw(t){this.Om.m(t.width,t.height)}}function Ta(s){if(s===void 0||s.type==="custom")return;const t=s;t.minMove!==void 0&&t.precision===void 0&&(t.precision=(function(e){if(e>=1)return 0;let i=0;for(;i<8;i++){const n=Math.round(e);if(Math.abs(n-e)<1e-8)return i;e*=10}return i})(t.minMove))}function Or(s){return(function(t){if(ai(t.handleScale)){const i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(t.handleScale!==void 0){const{axisPressedMouseMove:i,axisDoubleClickReset:n}=t.handleScale;ai(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),ai(n)&&(t.handleScale.axisDoubleClickReset={time:n,price:n})}const e=t.handleScroll;ai(e)&&(t.handleScroll={horzTouchDrag:e,vertTouchDrag:e,mouseWheel:e,pressedMouseMove:e})})(s),s}class Ma{constructor(t,e,i){this.Sw=new Map,this.kw=new Map,this.yw=new Ct,this.Cw=new Ct,this.Tw=new Ct,this.Pw=new ca(e);const n=i===void 0?pe(kr()):Qt(pe(kr()),Or(i));this.q_=e,this.aw=new sa(t,n,e),this.aw.lm().l((o=>{this.yw.M()&&this.yw.m(this.Rw(o()))}),this),this.aw.am().l((o=>{this.Cw.M()&&this.Cw.m(this.Rw(o()))}),this),this.aw.Xc().l((o=>{this.Tw.M()&&this.Tw.m(this.Rw(o()))}),this);const r=this.aw.$t();this.Dw=new Ea(r,this.aw.fb(),this.q_)}remove(){this.aw.lm().p(this),this.aw.am().p(this),this.aw.Xc().p(this),this.Dw.S(),this.aw.S(),this.Sw.clear(),this.kw.clear(),this.yw.S(),this.Cw.S(),this.Tw.S(),this.Pw.S()}resize(t,e,i){this.autoSizeActive()||this.aw._b(t,e,i)}addCustomSeries(t,e){const i=Oe(t),n=Object.assign(Object.assign({},un),i.defaultOptions());return this.Vw("Custom",n,e,i)}addAreaSeries(t){return this.Vw("Area",cl,t)}addBaselineSeries(t){return this.Vw("Baseline",ul,t)}addBarSeries(t){return this.Vw("Bar",hl,t)}addCandlestickSeries(t={}){return(function(e){e.borderColor!==void 0&&(e.borderUpColor=e.borderColor,e.borderDownColor=e.borderColor),e.wickColor!==void 0&&(e.wickUpColor=e.wickColor,e.wickDownColor=e.wickColor)})(t),this.Vw("Candlestick",ll,t)}addHistogramSeries(t){return this.Vw("Histogram",fl,t)}addLineSeries(t){return this.Vw("Line",al,t)}removeSeries(t){const e=Ft(this.Sw.get(t)),i=this.Pw.vd(e);this.aw.$t().vd(e),this.Ow(i),this.Sw.delete(t),this.kw.delete(e)}pw(t,e){this.Ow(this.Pw.Kb(t,e))}bw(t,e){this.Ow(this.Pw.iw(t,e))}subscribeClick(t){this.yw.l(t)}unsubscribeClick(t){this.yw.v(t)}subscribeCrosshairMove(t){this.Tw.l(t)}unsubscribeCrosshairMove(t){this.Tw.v(t)}subscribeDblClick(t){this.Cw.l(t)}unsubscribeDblClick(t){this.Cw.v(t)}priceScale(t){return new Sa(this.aw,t)}timeScale(){return this.Dw}applyOptions(t){this.aw.$h(Or(t))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const t=this.aw.Tb();return{height:t.height,width:t.width}}setCrosshairPosition(t,e,i){const n=this.Sw.get(i);if(n===void 0)return;const r=this.aw.$t().dr(n);r!==null&&this.aw.$t().ad(t,e,r)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(t,e,i={},n){Ta(i.priceFormat);const r=Qt(pe(fn),pe(e),i),o=this.aw.$t().dd(t,r,n),l=new Ca(o,this,this,this,this.q_);return this.Sw.set(l,o),this.kw.set(o,l),l}Ow(t){const e=this.aw.$t();e._d(t.St.Eu,t.St.hw,t.St.lw),t.ew.forEach(((i,n)=>n.J(i.$e,i.rw))),e.Wu()}Bw(t){return Ft(this.kw.get(t))}Rw(t){const e=new Map;t.Nb.forEach(((n,r)=>{const o=r.Qh(),l=ks(o)(n);if(o!=="Custom")be(na(l));else{const h=r.Ta();be(!h||h(l)===!1)}e.set(this.Bw(r),l)}));const i=t.Eb!==void 0&&this.kw.has(t.Eb)?this.Bw(t.Eb):void 0;return{time:t.zb,logical:t.ee,point:t.Lb,hoveredSeries:i,hoveredObjectId:t.Fb,seriesData:e,sourceEvent:t.Wb}}}function ka(s,t,e){let i;if(Ue(s)){const r=document.getElementById(s);be(r!==null,`Cannot find element in DOM with id=${s}`),i=r}else i=s;const n=new Ma(i,t,e);return t.setOptions(n.options()),n}function La(s,t){return ka(s,new dr,dr.Id(t))}Object.assign(Object.assign({},fn),un);function zr(s,t){return function(){return s.apply(t,arguments)}}const{toString:Oa}=Object.prototype,{getPrototypeOf:Os}=Object,{iterator:Mi,toStringTag:Pr}=Symbol,ki=(s=>t=>{const e=Oa.call(t);return s[e]||(s[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),te=s=>(s=s.toLowerCase(),t=>ki(t)===s),Li=s=>t=>typeof t===s,{isArray:Be}=Array,De=Li("undefined");function Qe(s){return s!==null&&!De(s)&&s.constructor!==null&&!De(s.constructor)&&Ut(s.constructor.isBuffer)&&s.constructor.isBuffer(s)}const Nr=te("ArrayBuffer");function za(s){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(s):t=s&&s.buffer&&Nr(s.buffer),t}const Pa=Li("string"),Ut=Li("function"),Rr=Li("number"),Ze=s=>s!==null&&typeof s=="object",Na=s=>s===!0||s===!1,Oi=s=>{if(ki(s)!=="object")return!1;const t=Os(s);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Pr in s)&&!(Mi in s)},Ra=s=>{if(!Ze(s)||Qe(s))return!1;try{return Object.keys(s).length===0&&Object.getPrototypeOf(s)===Object.prototype}catch{return!1}},Aa=te("Date"),Ba=te("File"),Da=te("Blob"),Va=te("FileList"),Fa=s=>Ze(s)&&Ut(s.pipe),$a=s=>{let t;return s&&(typeof FormData=="function"&&s instanceof FormData||Ut(s.append)&&((t=ki(s))==="formdata"||t==="object"&&Ut(s.toString)&&s.toString()==="[object FormData]"))},Ia=te("URLSearchParams"),[Ua,Wa,Ha,qa]=["ReadableStream","Request","Response","Headers"].map(te),ja=s=>s.trim?s.trim():s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ti(s,t,{allOwnKeys:e=!1}={}){if(s===null||typeof s>"u")return;let i,n;if(typeof s!="object"&&(s=[s]),Be(s))for(i=0,n=s.length;i<n;i++)t.call(null,s[i],i,s);else{if(Qe(s))return;const r=e?Object.getOwnPropertyNames(s):Object.keys(s),o=r.length;let l;for(i=0;i<o;i++)l=r[i],t.call(null,s[l],l,s)}}function Ar(s,t){if(Qe(s))return null;t=t.toLowerCase();const e=Object.keys(s);let i=e.length,n;for(;i-- >0;)if(n=e[i],t===n.toLowerCase())return n;return null}const Te=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Br=s=>!De(s)&&s!==Te;function zs(){const{caseless:s,skipUndefined:t}=Br(this)&&this||{},e={},i=(n,r)=>{if(r==="__proto__"||r==="constructor"||r==="prototype")return;const o=s&&Ar(e,r)||r;Oi(e[o])&&Oi(n)?e[o]=zs(e[o],n):Oi(n)?e[o]=zs({},n):Be(n)?e[o]=n.slice():(!t||!De(n))&&(e[o]=n)};for(let n=0,r=arguments.length;n<r;n++)arguments[n]&&ti(arguments[n],i);return e}const Ka=(s,t,e,{allOwnKeys:i}={})=>(ti(t,(n,r)=>{e&&Ut(n)?Object.defineProperty(s,r,{value:zr(n,e),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(s,r,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),s),Xa=s=>(s.charCodeAt(0)===65279&&(s=s.slice(1)),s),Ja=(s,t,e,i)=>{s.prototype=Object.create(t.prototype,i),Object.defineProperty(s.prototype,"constructor",{value:s,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(s,"super",{value:t.prototype}),e&&Object.assign(s.prototype,e)},Ga=(s,t,e,i)=>{let n,r,o;const l={};if(t=t||{},s==null)return t;do{for(n=Object.getOwnPropertyNames(s),r=n.length;r-- >0;)o=n[r],(!i||i(o,s,t))&&!l[o]&&(t[o]=s[o],l[o]=!0);s=e!==!1&&Os(s)}while(s&&(!e||e(s,t))&&s!==Object.prototype);return t},Ya=(s,t,e)=>{s=String(s),(e===void 0||e>s.length)&&(e=s.length),e-=t.length;const i=s.indexOf(t,e);return i!==-1&&i===e},Qa=s=>{if(!s)return null;if(Be(s))return s;let t=s.length;if(!Rr(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=s[t];return e},Za=(s=>t=>s&&t instanceof s)(typeof Uint8Array<"u"&&Os(Uint8Array)),tc=(s,t)=>{const i=(s&&s[Mi]).call(s);let n;for(;(n=i.next())&&!n.done;){const r=n.value;t.call(s,r[0],r[1])}},ec=(s,t)=>{let e;const i=[];for(;(e=s.exec(t))!==null;)i.push(e);return i},ic=te("HTMLFormElement"),sc=s=>s.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,i,n){return i.toUpperCase()+n}),Dr=(({hasOwnProperty:s})=>(t,e)=>s.call(t,e))(Object.prototype),nc=te("RegExp"),Vr=(s,t)=>{const e=Object.getOwnPropertyDescriptors(s),i={};ti(e,(n,r)=>{let o;(o=t(n,r,s))!==!1&&(i[r]=o||n)}),Object.defineProperties(s,i)},rc=s=>{Vr(s,(t,e)=>{if(Ut(s)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const i=s[e];if(Ut(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},oc=(s,t)=>{const e={},i=n=>{n.forEach(r=>{e[r]=!0})};return Be(s)?i(s):i(String(s).split(t)),e},lc=()=>{},hc=(s,t)=>s!=null&&Number.isFinite(s=+s)?s:t;function ac(s){return!!(s&&Ut(s.append)&&s[Pr]==="FormData"&&s[Mi])}const cc=s=>{const t=new Array(10),e=(i,n)=>{if(Ze(i)){if(t.indexOf(i)>=0)return;if(Qe(i))return i;if(!("toJSON"in i)){t[n]=i;const r=Be(i)?[]:{};return ti(i,(o,l)=>{const h=e(o,n+1);!De(h)&&(r[l]=h)}),t[n]=void 0,r}}return i};return e(s,0)},uc=te("AsyncFunction"),fc=s=>s&&(Ze(s)||Ut(s))&&Ut(s.then)&&Ut(s.catch),Fr=((s,t)=>s?setImmediate:t?((e,i)=>(Te.addEventListener("message",({source:n,data:r})=>{n===Te&&r===e&&i.length&&i.shift()()},!1),n=>{i.push(n),Te.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate=="function",Ut(Te.postMessage)),dc=typeof queueMicrotask<"u"?queueMicrotask.bind(Te):typeof process<"u"&&process.nextTick||Fr,v={isArray:Be,isArrayBuffer:Nr,isBuffer:Qe,isFormData:$a,isArrayBufferView:za,isString:Pa,isNumber:Rr,isBoolean:Na,isObject:Ze,isPlainObject:Oi,isEmptyObject:Ra,isReadableStream:Ua,isRequest:Wa,isResponse:Ha,isHeaders:qa,isUndefined:De,isDate:Aa,isFile:Ba,isBlob:Da,isRegExp:nc,isFunction:Ut,isStream:Fa,isURLSearchParams:Ia,isTypedArray:Za,isFileList:Va,forEach:ti,merge:zs,extend:Ka,trim:ja,stripBOM:Xa,inherits:Ja,toFlatObject:Ga,kindOf:ki,kindOfTest:te,endsWith:Ya,toArray:Qa,forEachEntry:tc,matchAll:ec,isHTMLForm:ic,hasOwnProperty:Dr,hasOwnProp:Dr,reduceDescriptors:Vr,freezeMethods:rc,toObjectSet:oc,toCamelCase:sc,noop:lc,toFiniteNumber:hc,findKey:Ar,global:Te,isContextDefined:Br,isSpecCompliantForm:ac,toJSONObject:cc,isAsyncFn:uc,isThenable:fc,setImmediate:Fr,asap:dc,isIterable:s=>s!=null&&Ut(s[Mi])};let V=class Qo extends Error{static from(t,e,i,n,r,o){const l=new Qo(t.message,e||t.code,i,n,r);return l.cause=t,l.name=t.name,o&&Object.assign(l,o),l}constructor(t,e,i,n,r){super(t),this.name="AxiosError",this.isAxiosError=!0,e&&(this.code=e),i&&(this.config=i),n&&(this.request=n),r&&(this.response=r,this.status=r.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:v.toJSONObject(this.config),code:this.code,status:this.status}}};V.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",V.ERR_BAD_OPTION="ERR_BAD_OPTION",V.ECONNABORTED="ECONNABORTED",V.ETIMEDOUT="ETIMEDOUT",V.ERR_NETWORK="ERR_NETWORK",V.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",V.ERR_DEPRECATED="ERR_DEPRECATED",V.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",V.ERR_BAD_REQUEST="ERR_BAD_REQUEST",V.ERR_CANCELED="ERR_CANCELED",V.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",V.ERR_INVALID_URL="ERR_INVALID_URL";const pc=null;function Ps(s){return v.isPlainObject(s)||v.isArray(s)}function $r(s){return v.endsWith(s,"[]")?s.slice(0,-2):s}function Ir(s,t,e){return s?s.concat(t).map(function(n,r){return n=$r(n),!e&&r?"["+n+"]":n}).join(e?".":""):t}function mc(s){return v.isArray(s)&&!s.some(Ps)}const bc=v.toFlatObject(v,{},null,function(t){return/^is[A-Z]/.test(t)});function zi(s,t,e){if(!v.isObject(s))throw new TypeError("target must be an object");t=t||new FormData,e=v.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,m){return!v.isUndefined(m[f])});const i=e.metaTokens,n=e.visitor||c,r=e.dots,o=e.indexes,h=(e.Blob||typeof Blob<"u"&&Blob)&&v.isSpecCompliantForm(t);if(!v.isFunction(n))throw new TypeError("visitor must be a function");function a(p){if(p===null)return"";if(v.isDate(p))return p.toISOString();if(v.isBoolean(p))return p.toString();if(!h&&v.isBlob(p))throw new V("Blob is not supported. Use a Buffer instead.");return v.isArrayBuffer(p)||v.isTypedArray(p)?h&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,f,m){let S=p;if(p&&!m&&typeof p=="object"){if(v.endsWith(f,"{}"))f=i?f:f.slice(0,-2),p=JSON.stringify(p);else if(v.isArray(p)&&mc(p)||(v.isFileList(p)||v.endsWith(f,"[]"))&&(S=v.toArray(p)))return f=$r(f),S.forEach(function(x,M){!(v.isUndefined(x)||x===null)&&t.append(o===!0?Ir([f],M,r):o===null?f:f+"[]",a(x))}),!1}return Ps(p)?!0:(t.append(Ir(m,f,r),a(p)),!1)}const u=[],d=Object.assign(bc,{defaultVisitor:c,convertValue:a,isVisitable:Ps});function b(p,f){if(!v.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+f.join("."));u.push(p),v.forEach(p,function(S,g){(!(v.isUndefined(S)||S===null)&&n.call(t,S,v.isString(g)?g.trim():g,f,d))===!0&&b(S,f?f.concat(g):[g])}),u.pop()}}if(!v.isObject(s))throw new TypeError("data must be an object");return b(s),t}function Ur(s){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(s).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Ns(s,t){this._pairs=[],s&&zi(s,this,t)}const Wr=Ns.prototype;Wr.append=function(t,e){this._pairs.push([t,e])},Wr.toString=function(t){const e=t?function(i){return t.call(this,i,Ur)}:Ur;return this._pairs.map(function(n){return e(n[0])+"="+e(n[1])},"").join("&")};function gc(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Hr(s,t,e){if(!t)return s;const i=e&&e.encode||gc,n=v.isFunction(e)?{serialize:e}:e,r=n&&n.serialize;let o;if(r?o=r(t,n):o=v.isURLSearchParams(t)?t.toString():new Ns(t,n).toString(i),o){const l=s.indexOf("#");l!==-1&&(s=s.slice(0,l)),s+=(s.indexOf("?")===-1?"?":"&")+o}return s}class qr{constructor(){this.handlers=[]}use(t,e,i){return this.handlers.push({fulfilled:t,rejected:e,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){v.forEach(this.handlers,function(i){i!==null&&t(i)})}}const Rs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},vc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ns,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},As=typeof window<"u"&&typeof document<"u",Bs=typeof navigator=="object"&&navigator||void 0,yc=As&&(!Bs||["ReactNative","NativeScript","NS"].indexOf(Bs.product)<0),wc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Sc=As&&window.location.href||"http://localhost",At={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:As,hasStandardBrowserEnv:yc,hasStandardBrowserWebWorkerEnv:wc,navigator:Bs,origin:Sc},Symbol.toStringTag,{value:"Module"})),...vc};function xc(s,t){return zi(s,new At.classes.URLSearchParams,{visitor:function(e,i,n,r){return At.isNode&&v.isBuffer(e)?(this.append(i,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}function _c(s){return v.matchAll(/\w+|\[(\w*)]/g,s).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Cc(s){const t={},e=Object.keys(s);let i;const n=e.length;let r;for(i=0;i<n;i++)r=e[i],t[r]=s[r];return t}function jr(s){function t(e,i,n,r){let o=e[r++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),h=r>=e.length;return o=!o&&v.isArray(n)?n.length:o,h?(v.hasOwnProp(n,o)?n[o]=[n[o],i]:n[o]=i,!l):((!n[o]||!v.isObject(n[o]))&&(n[o]=[]),t(e,i,n[o],r)&&v.isArray(n[o])&&(n[o]=Cc(n[o])),!l)}if(v.isFormData(s)&&v.isFunction(s.entries)){const e={};return v.forEachEntry(s,(i,n)=>{t(_c(i),n,e,0)}),e}return null}function Ec(s,t,e){if(v.isString(s))try{return(t||JSON.parse)(s),v.trim(s)}catch(i){if(i.name!=="SyntaxError")throw i}return(e||JSON.stringify)(s)}const ei={transitional:Rs,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const i=e.getContentType()||"",n=i.indexOf("application/json")>-1,r=v.isObject(t);if(r&&v.isHTMLForm(t)&&(t=new FormData(t)),v.isFormData(t))return n?JSON.stringify(jr(t)):t;if(v.isArrayBuffer(t)||v.isBuffer(t)||v.isStream(t)||v.isFile(t)||v.isBlob(t)||v.isReadableStream(t))return t;if(v.isArrayBufferView(t))return t.buffer;if(v.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(r){if(i.indexOf("application/x-www-form-urlencoded")>-1)return xc(t,this.formSerializer).toString();if((l=v.isFileList(t))||i.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return zi(l?{"files[]":t}:t,h&&new h,this.formSerializer)}}return r||n?(e.setContentType("application/json",!1),Ec(t)):t}],transformResponse:[function(t){const e=this.transitional||ei.transitional,i=e&&e.forcedJSONParsing,n=this.responseType==="json";if(v.isResponse(t)||v.isReadableStream(t))return t;if(t&&v.isString(t)&&(i&&!this.responseType||n)){const o=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?V.from(l,V.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:At.classes.FormData,Blob:At.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch"],s=>{ei.headers[s]={}});const Tc=v.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Mc=s=>{const t={};let e,i,n;return s&&s.split(`
2
- `).forEach(function(o){n=o.indexOf(":"),e=o.substring(0,n).trim().toLowerCase(),i=o.substring(n+1).trim(),!(!e||t[e]&&Tc[e])&&(e==="set-cookie"?t[e]?t[e].push(i):t[e]=[i]:t[e]=t[e]?t[e]+", "+i:i)}),t},Kr=Symbol("internals");function ii(s){return s&&String(s).trim().toLowerCase()}function Pi(s){return s===!1||s==null?s:v.isArray(s)?s.map(Pi):String(s)}function kc(s){const t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=e.exec(s);)t[i[1]]=i[2];return t}const Lc=s=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(s.trim());function Ds(s,t,e,i,n){if(v.isFunction(i))return i.call(this,t,e);if(n&&(t=e),!!v.isString(t)){if(v.isString(i))return t.indexOf(i)!==-1;if(v.isRegExp(i))return i.test(t)}}function Oc(s){return s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,i)=>e.toUpperCase()+i)}function zc(s,t){const e=v.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(s,i+e,{value:function(n,r,o){return this[i].call(this,t,n,r,o)},configurable:!0})})}let Wt=class{constructor(t){t&&this.set(t)}set(t,e,i){const n=this;function r(l,h,a){const c=ii(h);if(!c)throw new Error("header name must be a non-empty string");const u=v.findKey(n,c);(!u||n[u]===void 0||a===!0||a===void 0&&n[u]!==!1)&&(n[u||h]=Pi(l))}const o=(l,h)=>v.forEach(l,(a,c)=>r(a,c,h));if(v.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(v.isString(t)&&(t=t.trim())&&!Lc(t))o(Mc(t),e);else if(v.isObject(t)&&v.isIterable(t)){let l={},h,a;for(const c of t){if(!v.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[a=c[0]]=(h=l[a])?v.isArray(h)?[...h,c[1]]:[h,c[1]]:c[1]}o(l,e)}else t!=null&&r(e,t,i);return this}get(t,e){if(t=ii(t),t){const i=v.findKey(this,t);if(i){const n=this[i];if(!e)return n;if(e===!0)return kc(n);if(v.isFunction(e))return e.call(this,n,i);if(v.isRegExp(e))return e.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=ii(t),t){const i=v.findKey(this,t);return!!(i&&this[i]!==void 0&&(!e||Ds(this,this[i],i,e)))}return!1}delete(t,e){const i=this;let n=!1;function r(o){if(o=ii(o),o){const l=v.findKey(i,o);l&&(!e||Ds(i,i[l],l,e))&&(delete i[l],n=!0)}}return v.isArray(t)?t.forEach(r):r(t),n}clear(t){const e=Object.keys(this);let i=e.length,n=!1;for(;i--;){const r=e[i];(!t||Ds(this,this[r],r,t,!0))&&(delete this[r],n=!0)}return n}normalize(t){const e=this,i={};return v.forEach(this,(n,r)=>{const o=v.findKey(i,r);if(o){e[o]=Pi(n),delete e[r];return}const l=t?Oc(r):String(r).trim();l!==r&&delete e[r],e[l]=Pi(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return v.forEach(this,(i,n)=>{i!=null&&i!==!1&&(e[n]=t&&v.isArray(i)?i.join(", "):i)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const i=new this(t);return e.forEach(n=>i.set(n)),i}static accessor(t){const i=(this[Kr]=this[Kr]={accessors:{}}).accessors,n=this.prototype;function r(o){const l=ii(o);i[l]||(zc(n,o),i[l]=!0)}return v.isArray(t)?t.forEach(r):r(t),this}};Wt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),v.reduceDescriptors(Wt.prototype,({value:s},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>s,set(i){this[e]=i}}}),v.freezeMethods(Wt);function Vs(s,t){const e=this||ei,i=t||e,n=Wt.from(i.headers);let r=i.data;return v.forEach(s,function(l){r=l.call(e,r,n.normalize(),t?t.status:void 0)}),n.normalize(),r}function Xr(s){return!!(s&&s.__CANCEL__)}let si=class extends V{constructor(t,e,i){super(t??"canceled",V.ERR_CANCELED,e,i),this.name="CanceledError",this.__CANCEL__=!0}};function Jr(s,t,e){const i=e.config.validateStatus;!e.status||!i||i(e.status)?s(e):t(new V("Request failed with status code "+e.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}function Pc(s){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(s);return t&&t[1]||""}function Nc(s,t){s=s||10;const e=new Array(s),i=new Array(s);let n=0,r=0,o;return t=t!==void 0?t:1e3,function(h){const a=Date.now(),c=i[r];o||(o=a),e[n]=h,i[n]=a;let u=r,d=0;for(;u!==n;)d+=e[u++],u=u%s;if(n=(n+1)%s,n===r&&(r=(r+1)%s),a-o<t)return;const b=c&&a-c;return b?Math.round(d*1e3/b):void 0}}function Rc(s,t){let e=0,i=1e3/t,n,r;const o=(a,c=Date.now())=>{e=c,n=null,r&&(clearTimeout(r),r=null),s(...a)};return[(...a)=>{const c=Date.now(),u=c-e;u>=i?o(a,c):(n=a,r||(r=setTimeout(()=>{r=null,o(n)},i-u)))},()=>n&&o(n)]}const Ni=(s,t,e=3)=>{let i=0;const n=Nc(50,250);return Rc(r=>{const o=r.loaded,l=r.lengthComputable?r.total:void 0,h=o-i,a=n(h),c=o<=l;i=o;const u={loaded:o,total:l,progress:l?o/l:void 0,bytes:h,rate:a||void 0,estimated:a&&l&&c?(l-o)/a:void 0,event:r,lengthComputable:l!=null,[t?"download":"upload"]:!0};s(u)},e)},Gr=(s,t)=>{const e=s!=null;return[i=>t[0]({lengthComputable:e,total:s,loaded:i}),t[1]]},Yr=s=>(...t)=>v.asap(()=>s(...t)),Ac=At.hasStandardBrowserEnv?((s,t)=>e=>(e=new URL(e,At.origin),s.protocol===e.protocol&&s.host===e.host&&(t||s.port===e.port)))(new URL(At.origin),At.navigator&&/(msie|trident)/i.test(At.navigator.userAgent)):()=>!0,Bc=At.hasStandardBrowserEnv?{write(s,t,e,i,n,r,o){if(typeof document>"u")return;const l=[`${s}=${encodeURIComponent(t)}`];v.isNumber(e)&&l.push(`expires=${new Date(e).toUTCString()}`),v.isString(i)&&l.push(`path=${i}`),v.isString(n)&&l.push(`domain=${n}`),r===!0&&l.push("secure"),v.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(s){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+s+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(s){this.write(s,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Dc(s){return typeof s!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function Vc(s,t){return t?s.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):s}function Qr(s,t,e){let i=!Dc(t);return s&&(i||e==!1)?Vc(s,t):t}const Zr=s=>s instanceof Wt?{...s}:s;function Me(s,t){t=t||{};const e={};function i(a,c,u,d){return v.isPlainObject(a)&&v.isPlainObject(c)?v.merge.call({caseless:d},a,c):v.isPlainObject(c)?v.merge({},c):v.isArray(c)?c.slice():c}function n(a,c,u,d){if(v.isUndefined(c)){if(!v.isUndefined(a))return i(void 0,a,u,d)}else return i(a,c,u,d)}function r(a,c){if(!v.isUndefined(c))return i(void 0,c)}function o(a,c){if(v.isUndefined(c)){if(!v.isUndefined(a))return i(void 0,a)}else return i(void 0,c)}function l(a,c,u){if(u in t)return i(a,c);if(u in s)return i(void 0,a)}const h={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(a,c,u)=>n(Zr(a),Zr(c),u,!0)};return v.forEach(Object.keys({...s,...t}),function(c){if(c==="__proto__"||c==="constructor"||c==="prototype")return;const u=v.hasOwnProp(h,c)?h[c]:n,d=u(s[c],t[c],c);v.isUndefined(d)&&u!==l||(e[c]=d)}),e}const to=s=>{const t=Me({},s);let{data:e,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:r,headers:o,auth:l}=t;if(t.headers=o=Wt.from(o),t.url=Hr(Qr(t.baseURL,t.url,t.allowAbsoluteUrls),s.params,s.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),v.isFormData(e)){if(At.hasStandardBrowserEnv||At.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(v.isFunction(e.getHeaders)){const h=e.getHeaders(),a=["content-type","content-length"];Object.entries(h).forEach(([c,u])=>{a.includes(c.toLowerCase())&&o.set(c,u)})}}if(At.hasStandardBrowserEnv&&(i&&v.isFunction(i)&&(i=i(t)),i||i!==!1&&Ac(t.url))){const h=n&&r&&Bc.read(r);h&&o.set(n,h)}return t},Fc=typeof XMLHttpRequest<"u"&&function(s){return new Promise(function(e,i){const n=to(s);let r=n.data;const o=Wt.from(n.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:a}=n,c,u,d,b,p;function f(){b&&b(),p&&p(),n.cancelToken&&n.cancelToken.unsubscribe(c),n.signal&&n.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout;function S(){if(!m)return;const x=Wt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),P={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:x,config:s,request:m};Jr(function(D){e(D),f()},function(D){i(D),f()},P),m=null}"onloadend"in m?m.onloadend=S:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(S)},m.onabort=function(){m&&(i(new V("Request aborted",V.ECONNABORTED,s,m)),m=null)},m.onerror=function(M){const P=M&&M.message?M.message:"Network Error",K=new V(P,V.ERR_NETWORK,s,m);K.event=M||null,i(K),m=null},m.ontimeout=function(){let M=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const P=n.transitional||Rs;n.timeoutErrorMessage&&(M=n.timeoutErrorMessage),i(new V(M,P.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,s,m)),m=null},r===void 0&&o.setContentType(null),"setRequestHeader"in m&&v.forEach(o.toJSON(),function(M,P){m.setRequestHeader(P,M)}),v.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),l&&l!=="json"&&(m.responseType=n.responseType),a&&([d,p]=Ni(a,!0),m.addEventListener("progress",d)),h&&m.upload&&([u,b]=Ni(h),m.upload.addEventListener("progress",u),m.upload.addEventListener("loadend",b)),(n.cancelToken||n.signal)&&(c=x=>{m&&(i(!x||x.type?new si(null,s,m):x),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(c),n.signal&&(n.signal.aborted?c():n.signal.addEventListener("abort",c)));const g=Pc(n.url);if(g&&At.protocols.indexOf(g)===-1){i(new V("Unsupported protocol "+g+":",V.ERR_BAD_REQUEST,s));return}m.send(r||null)})},$c=(s,t)=>{const{length:e}=s=s?s.filter(Boolean):[];if(t||e){let i=new AbortController,n;const r=function(a){if(!n){n=!0,l();const c=a instanceof Error?a:this.reason;i.abort(c instanceof V?c:new si(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,r(new V(`timeout of ${t}ms exceeded`,V.ETIMEDOUT))},t);const l=()=>{s&&(o&&clearTimeout(o),o=null,s.forEach(a=>{a.unsubscribe?a.unsubscribe(r):a.removeEventListener("abort",r)}),s=null)};s.forEach(a=>a.addEventListener("abort",r));const{signal:h}=i;return h.unsubscribe=()=>v.asap(l),h}},Ic=function*(s,t){let e=s.byteLength;if(e<t){yield s;return}let i=0,n;for(;i<e;)n=i+t,yield s.slice(i,n),i=n},Uc=async function*(s,t){for await(const e of Wc(s))yield*Ic(e,t)},Wc=async function*(s){if(s[Symbol.asyncIterator]){yield*s;return}const t=s.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)break;yield i}}finally{await t.cancel()}},eo=(s,t,e,i)=>{const n=Uc(s,t);let r=0,o,l=h=>{o||(o=!0,i&&i(h))};return new ReadableStream({async pull(h){try{const{done:a,value:c}=await n.next();if(a){l(),h.close();return}let u=c.byteLength;if(e){let d=r+=u;e(d)}h.enqueue(new Uint8Array(c))}catch(a){throw l(a),a}},cancel(h){return l(h),n.return()}},{highWaterMark:2})},io=64*1024,{isFunction:Ri}=v,Hc=(({Request:s,Response:t})=>({Request:s,Response:t}))(v.global),{ReadableStream:so,TextEncoder:no}=v.global,ro=(s,...t)=>{try{return!!s(...t)}catch{return!1}},qc=s=>{s=v.merge.call({skipUndefined:!0},Hc,s);const{fetch:t,Request:e,Response:i}=s,n=t?Ri(t):typeof fetch=="function",r=Ri(e),o=Ri(i);if(!n)return!1;const l=n&&Ri(so),h=n&&(typeof no=="function"?(p=>f=>p.encode(f))(new no):async p=>new Uint8Array(await new e(p).arrayBuffer())),a=r&&l&&ro(()=>{let p=!1;const f=new e(At.origin,{body:new so,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!f}),c=o&&l&&ro(()=>v.isReadableStream(new i("").body)),u={stream:c&&(p=>p.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!u[p]&&(u[p]=(f,m)=>{let S=f&&f[p];if(S)return S.call(f);throw new V(`Response type '${p}' is not supported`,V.ERR_NOT_SUPPORT,m)})});const d=async p=>{if(p==null)return 0;if(v.isBlob(p))return p.size;if(v.isSpecCompliantForm(p))return(await new e(At.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(v.isArrayBufferView(p)||v.isArrayBuffer(p))return p.byteLength;if(v.isURLSearchParams(p)&&(p=p+""),v.isString(p))return(await h(p)).byteLength},b=async(p,f)=>{const m=v.toFiniteNumber(p.getContentLength());return m??d(f)};return async p=>{let{url:f,method:m,data:S,signal:g,cancelToken:x,timeout:M,onDownloadProgress:P,onUploadProgress:K,responseType:D,headers:G,withCredentials:Z="same-origin",fetchOptions:Et}=to(p),$=t||fetch;D=D?(D+"").toLowerCase():"text";let ct=$c([g,x&&x.toAbortSignal()],M),Nt=null;const vt=ct&&ct.unsubscribe&&(()=>{ct.unsubscribe()});let lt;try{if(K&&a&&m!=="get"&&m!=="head"&&(lt=await b(G,S))!==0){let xt=new e(f,{method:"POST",body:S,duplex:"half"}),st;if(v.isFormData(S)&&(st=xt.headers.get("content-type"))&&G.setContentType(st),xt.body){const[dt,Mt]=Gr(lt,Ni(Yr(K)));S=eo(xt.body,io,dt,Mt)}}v.isString(Z)||(Z=Z?"include":"omit");const ht=r&&"credentials"in e.prototype,ut={...Et,signal:ct,method:m.toUpperCase(),headers:G.normalize().toJSON(),body:S,duplex:"half",credentials:ht?Z:void 0};Nt=r&&new e(f,ut);let Rt=await(r?$(Nt,Et):$(f,ut));const Tt=c&&(D==="stream"||D==="response");if(c&&(P||Tt&&vt)){const xt={};["status","statusText","headers"].forEach(_t=>{xt[_t]=Rt[_t]});const st=v.toFiniteNumber(Rt.headers.get("content-length")),[dt,Mt]=P&&Gr(st,Ni(Yr(P),!0))||[];Rt=new i(eo(Rt.body,io,dt,()=>{Mt&&Mt(),vt&&vt()}),xt)}D=D||"text";let St=await u[v.findKey(u,D)||"text"](Rt,p);return!Tt&&vt&&vt(),await new Promise((xt,st)=>{Jr(xt,st,{data:St,headers:Wt.from(Rt.headers),status:Rt.status,statusText:Rt.statusText,config:p,request:Nt})})}catch(ht){throw vt&&vt(),ht&&ht.name==="TypeError"&&/Load failed|fetch/i.test(ht.message)?Object.assign(new V("Network Error",V.ERR_NETWORK,p,Nt,ht&&ht.response),{cause:ht.cause||ht}):V.from(ht,ht&&ht.code,p,Nt,ht&&ht.response)}}},jc=new Map,oo=s=>{let t=s&&s.env||{};const{fetch:e,Request:i,Response:n}=t,r=[i,n,e];let o=r.length,l=o,h,a,c=jc;for(;l--;)h=r[l],a=c.get(h),a===void 0&&c.set(h,a=l?new Map:qc(t)),c=a;return a};oo();const Fs={http:pc,xhr:Fc,fetch:{get:oo}};v.forEach(Fs,(s,t)=>{if(s){try{Object.defineProperty(s,"name",{value:t})}catch{}Object.defineProperty(s,"adapterName",{value:t})}});const lo=s=>`- ${s}`,Kc=s=>v.isFunction(s)||s===null||s===!1;function Xc(s,t){s=v.isArray(s)?s:[s];const{length:e}=s;let i,n;const r={};for(let o=0;o<e;o++){i=s[o];let l;if(n=i,!Kc(i)&&(n=Fs[(l=String(i)).toLowerCase()],n===void 0))throw new V(`Unknown adapter '${l}'`);if(n&&(v.isFunction(n)||(n=n.get(t))))break;r[l||"#"+o]=n}if(!n){const o=Object.entries(r).map(([h,a])=>`adapter ${h} `+(a===!1?"is not supported by the environment":"is not available in the build"));let l=e?o.length>1?`since :
4
- `+o.map(lo).join(`
5
- `):" "+lo(o[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return n}const ho={getAdapter:Xc,adapters:Fs};function $s(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new si(null,s)}function ao(s){return $s(s),s.headers=Wt.from(s.headers),s.data=Vs.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),ho.getAdapter(s.adapter||ei.adapter,s)(s).then(function(i){return $s(s),i.data=Vs.call(s,s.transformResponse,i),i.headers=Wt.from(i.headers),i},function(i){return Xr(i)||($s(s),i&&i.response&&(i.response.data=Vs.call(s,s.transformResponse,i.response),i.response.headers=Wt.from(i.response.headers))),Promise.reject(i)})}const co="1.13.5",Ai={};["object","boolean","number","function","string","symbol"].forEach((s,t)=>{Ai[s]=function(i){return typeof i===s||"a"+(t<1?"n ":" ")+s}});const uo={};Ai.transitional=function(t,e,i){function n(r,o){return"[Axios v"+co+"] Transitional option '"+r+"'"+o+(i?". "+i:"")}return(r,o,l)=>{if(t===!1)throw new V(n(o," has been removed"+(e?" in "+e:"")),V.ERR_DEPRECATED);return e&&!uo[o]&&(uo[o]=!0,console.warn(n(o," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(r,o,l):!0}},Ai.spelling=function(t){return(e,i)=>(console.warn(`${i} is likely a misspelling of ${t}`),!0)};function Jc(s,t,e){if(typeof s!="object")throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const i=Object.keys(s);let n=i.length;for(;n-- >0;){const r=i[n],o=t[r];if(o){const l=s[r],h=l===void 0||o(l,r,s);if(h!==!0)throw new V("option "+r+" must be "+h,V.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new V("Unknown option "+r,V.ERR_BAD_OPTION)}}const Bi={assertOptions:Jc,validators:Ai},Kt=Bi.validators;let ke=class{constructor(t){this.defaults=t||{},this.interceptors={request:new qr,response:new qr}}async request(t,e){try{return await this._request(t,e)}catch(i){if(i instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const r=n.stack?n.stack.replace(/^.+\n/,""):"";try{i.stack?r&&!String(i.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(i.stack+=`
6
- `+r):i.stack=r}catch{}}throw i}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Me(this.defaults,e);const{transitional:i,paramsSerializer:n,headers:r}=e;i!==void 0&&Bi.assertOptions(i,{silentJSONParsing:Kt.transitional(Kt.boolean),forcedJSONParsing:Kt.transitional(Kt.boolean),clarifyTimeoutError:Kt.transitional(Kt.boolean),legacyInterceptorReqResOrdering:Kt.transitional(Kt.boolean)},!1),n!=null&&(v.isFunction(n)?e.paramsSerializer={serialize:n}:Bi.assertOptions(n,{encode:Kt.function,serialize:Kt.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Bi.assertOptions(e,{baseUrl:Kt.spelling("baseURL"),withXsrfToken:Kt.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=r&&v.merge(r.common,r[e.method]);r&&v.forEach(["delete","get","head","post","put","patch","common"],p=>{delete r[p]}),e.headers=Wt.concat(o,r);const l=[];let h=!0;this.interceptors.request.forEach(function(f){if(typeof f.runWhen=="function"&&f.runWhen(e)===!1)return;h=h&&f.synchronous;const m=e.transitional||Rs;m&&m.legacyInterceptorReqResOrdering?l.unshift(f.fulfilled,f.rejected):l.push(f.fulfilled,f.rejected)});const a=[];this.interceptors.response.forEach(function(f){a.push(f.fulfilled,f.rejected)});let c,u=0,d;if(!h){const p=[ao.bind(this),void 0];for(p.unshift(...l),p.push(...a),d=p.length,c=Promise.resolve(e);u<d;)c=c.then(p[u++],p[u++]);return c}d=l.length;let b=e;for(;u<d;){const p=l[u++],f=l[u++];try{b=p(b)}catch(m){f.call(this,m);break}}try{c=ao.call(this,b)}catch(p){return Promise.reject(p)}for(u=0,d=a.length;u<d;)c=c.then(a[u++],a[u++]);return c}getUri(t){t=Me(this.defaults,t);const e=Qr(t.baseURL,t.url,t.allowAbsoluteUrls);return Hr(e,t.params,t.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(t){ke.prototype[t]=function(e,i){return this.request(Me(i||{},{method:t,url:e,data:(i||{}).data}))}}),v.forEach(["post","put","patch"],function(t){function e(i){return function(r,o,l){return this.request(Me(l||{},{method:t,headers:i?{"Content-Type":"multipart/form-data"}:{},url:r,data:o}))}}ke.prototype[t]=e(),ke.prototype[t+"Form"]=e(!0)});let Gc=class Zo{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(r){e=r});const i=this;this.promise.then(n=>{if(!i._listeners)return;let r=i._listeners.length;for(;r-- >0;)i._listeners[r](n);i._listeners=null}),this.promise.then=n=>{let r;const o=new Promise(l=>{i.subscribe(l),r=l}).then(n);return o.cancel=function(){i.unsubscribe(r)},o},t(function(r,o,l){i.reason||(i.reason=new si(r,o,l),e(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=i=>{t.abort(i)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new Zo(function(n){t=n}),cancel:t}}};function Yc(s){return function(e){return s.apply(null,e)}}function Qc(s){return v.isObject(s)&&s.isAxiosError===!0}const Is={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Is).forEach(([s,t])=>{Is[t]=s});function fo(s){const t=new ke(s),e=zr(ke.prototype.request,t);return v.extend(e,ke.prototype,t,{allOwnKeys:!0}),v.extend(e,t,null,{allOwnKeys:!0}),e.create=function(n){return fo(Me(s,n))},e}const bt=fo(ei);bt.Axios=ke,bt.CanceledError=si,bt.CancelToken=Gc,bt.isCancel=Xr,bt.VERSION=co,bt.toFormData=zi,bt.AxiosError=V,bt.Cancel=bt.CanceledError,bt.all=function(t){return Promise.all(t)},bt.spread=Yc,bt.isAxiosError=Qc,bt.mergeConfig=Me,bt.AxiosHeaders=Wt,bt.formToJSON=s=>jr(v.isHTMLForm(s)?new FormData(s):s),bt.getAdapter=ho.getAdapter,bt.HttpStatusCode=Is,bt.default=bt;const{Axios:Tf,AxiosError:Mf,CanceledError:kf,isCancel:Lf,CancelToken:Of,VERSION:zf,all:Pf,Cancel:Nf,isAxiosError:Rf,spread:Af,toFormData:Bf,AxiosHeaders:Df,HttpStatusCode:Vf,formToJSON:Ff,getAdapter:$f,mergeConfig:If}=bt,ne=Object.create(null);ne.open="0",ne.close="1",ne.ping="2",ne.pong="3",ne.message="4",ne.upgrade="5",ne.noop="6";const Di=Object.create(null);Object.keys(ne).forEach(s=>{Di[ne[s]]=s});const Us={type:"error",data:"parser error"},po=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",mo=typeof ArrayBuffer=="function",bo=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,Ws=({type:s,data:t},e,i)=>po&&t instanceof Blob?e?i(t):go(t,i):mo&&(t instanceof ArrayBuffer||bo(t))?e?i(t):go(new Blob([t]),i):i(ne[s]+(t||"")),go=(s,t)=>{const e=new FileReader;return e.onload=function(){const i=e.result.split(",")[1];t("b"+(i||""))},e.readAsDataURL(s)};function vo(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}let Hs;function Zc(s,t){if(po&&s.data instanceof Blob)return s.data.arrayBuffer().then(vo).then(t);if(mo&&(s.data instanceof ArrayBuffer||bo(s.data)))return t(vo(s.data));Ws(s,!1,e=>{Hs||(Hs=new TextEncoder),t(Hs.encode(e))})}const yo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ni=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<yo.length;s++)ni[yo.charCodeAt(s)]=s;const tu=s=>{let t=s.length*.75,e=s.length,i,n=0,r,o,l,h;s[s.length-1]==="="&&(t--,s[s.length-2]==="="&&t--);const a=new ArrayBuffer(t),c=new Uint8Array(a);for(i=0;i<e;i+=4)r=ni[s.charCodeAt(i)],o=ni[s.charCodeAt(i+1)],l=ni[s.charCodeAt(i+2)],h=ni[s.charCodeAt(i+3)],c[n++]=r<<2|o>>4,c[n++]=(o&15)<<4|l>>2,c[n++]=(l&3)<<6|h&63;return a},eu=typeof ArrayBuffer=="function",qs=(s,t)=>{if(typeof s!="string")return{type:"message",data:wo(s,t)};const e=s.charAt(0);return e==="b"?{type:"message",data:iu(s.substring(1),t)}:Di[e]?s.length>1?{type:Di[e],data:s.substring(1)}:{type:Di[e]}:Us},iu=(s,t)=>{if(eu){const e=tu(s);return wo(e,t)}else return{base64:!0,data:s}},wo=(s,t)=>t==="blob"?s instanceof Blob?s:new Blob([s]):s instanceof ArrayBuffer?s:s.buffer,So="",su=(s,t)=>{const e=s.length,i=new Array(e);let n=0;s.forEach((r,o)=>{Ws(r,!1,l=>{i[o]=l,++n===e&&t(i.join(So))})})},nu=(s,t)=>{const e=s.split(So),i=[];for(let n=0;n<e.length;n++){const r=qs(e[n],t);if(i.push(r),r.type==="error")break}return i};function ru(){return new TransformStream({transform(s,t){Zc(s,e=>{const i=e.length;let n;if(i<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,i);else if(i<65536){n=new Uint8Array(3);const r=new DataView(n.buffer);r.setUint8(0,126),r.setUint16(1,i)}else{n=new Uint8Array(9);const r=new DataView(n.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(i))}s.data&&typeof s.data!="string"&&(n[0]|=128),t.enqueue(n),t.enqueue(e)})}})}let js;function Vi(s){return s.reduce((t,e)=>t+e.length,0)}function Fi(s,t){if(s[0].length===t)return s.shift();const e=new Uint8Array(t);let i=0;for(let n=0;n<t;n++)e[n]=s[0][i++],i===s[0].length&&(s.shift(),i=0);return s.length&&i<s[0].length&&(s[0]=s[0].slice(i)),e}function ou(s,t){js||(js=new TextDecoder);const e=[];let i=0,n=-1,r=!1;return new TransformStream({transform(o,l){for(e.push(o);;){if(i===0){if(Vi(e)<1)break;const h=Fi(e,1);r=(h[0]&128)===128,n=h[0]&127,n<126?i=3:n===126?i=1:i=2}else if(i===1){if(Vi(e)<2)break;const h=Fi(e,2);n=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),i=3}else if(i===2){if(Vi(e)<8)break;const h=Fi(e,8),a=new DataView(h.buffer,h.byteOffset,h.length),c=a.getUint32(0);if(c>Math.pow(2,21)-1){l.enqueue(Us);break}n=c*Math.pow(2,32)+a.getUint32(4),i=3}else{if(Vi(e)<n)break;const h=Fi(e,n);l.enqueue(qs(r?h:js.decode(h),t)),i=0}if(n===0||n>s){l.enqueue(Us);break}}}})}const xo=4;function kt(s){if(s)return lu(s)}function lu(s){for(var t in kt.prototype)s[t]=kt.prototype[t];return s}kt.prototype.on=kt.prototype.addEventListener=function(s,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(t),this},kt.prototype.once=function(s,t){function e(){this.off(s,e),t.apply(this,arguments)}return e.fn=t,this.on(s,e),this},kt.prototype.off=kt.prototype.removeListener=kt.prototype.removeAllListeners=kt.prototype.removeEventListener=function(s,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+s];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var i,n=0;n<e.length;n++)if(i=e[n],i===t||i.fn===t){e.splice(n,1);break}return e.length===0&&delete this._callbacks["$"+s],this},kt.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+s],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,n=e.length;i<n;++i)e[i].apply(this,t)}return this},kt.prototype.emitReserved=kt.prototype.emit,kt.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]},kt.prototype.hasListeners=function(s){return!!this.listeners(s).length};const $i=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,e)=>e(t,0),Xt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),hu="arraybuffer";function Uf(){}function _o(s,...t){return t.reduce((e,i)=>(s.hasOwnProperty(i)&&(e[i]=s[i]),e),{})}const au=Xt.setTimeout,cu=Xt.clearTimeout;function Ii(s,t){t.useNativeTimers?(s.setTimeoutFn=au.bind(Xt),s.clearTimeoutFn=cu.bind(Xt)):(s.setTimeoutFn=Xt.setTimeout.bind(Xt),s.clearTimeoutFn=Xt.clearTimeout.bind(Xt))}const uu=1.33;function fu(s){return typeof s=="string"?du(s):Math.ceil((s.byteLength||s.size)*uu)}function du(s){let t=0,e=0;for(let i=0,n=s.length;i<n;i++)t=s.charCodeAt(i),t<128?e+=1:t<2048?e+=2:t<55296||t>=57344?e+=3:(i++,e+=4);return e}function Co(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function pu(s){let t="";for(let e in s)s.hasOwnProperty(e)&&(t.length&&(t+="&"),t+=encodeURIComponent(e)+"="+encodeURIComponent(s[e]));return t}function mu(s){let t={},e=s.split("&");for(let i=0,n=e.length;i<n;i++){let r=e[i].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}class bu extends Error{constructor(t,e,i){super(t),this.description=e,this.context=i,this.type="TransportError"}}class Ks extends kt{constructor(t){super(),this.writable=!1,Ii(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,i){return super.emitReserved("error",new bu(t,e,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=qs(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const e=pu(t);return e.length?"?"+e:""}}class gu extends Ks{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};nu(t,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,su(t,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Co()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(t,e)}}let Eo=!1;try{Eo=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const vu=Eo;function yu(){}class wu extends gu{constructor(t){if(super(t),typeof location<"u"){const e=location.protocol==="https:";let i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,e){const i=this.request({method:"POST",data:t});i.on("success",e),i.on("error",(n,r)=>{this.onError("xhr post error",n,r)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=t}}class re extends kt{constructor(t,e,i){super(),this.createRequest=t,Ii(this,i),this._opts=i,this._method=i.method||"GET",this._uri=e,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const e=_o(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(e);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=re.requestsCount++,re.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=yu,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete re.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(re.requestsCount=0,re.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",To);else if(typeof addEventListener=="function"){const s="onpagehide"in Xt?"pagehide":"unload";addEventListener(s,To,!1)}}function To(){for(let s in re.requests)re.requests.hasOwnProperty(s)&&re.requests[s].abort()}const Su=(function(){const s=Mo({xdomain:!1});return s&&s.responseType!==null})();class xu extends wu{constructor(t){super(t);const e=t&&t.forceBase64;this.supportsBinary=Su&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new re(Mo,this.uri(),t)}}function Mo(s){const t=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||vu))return new XMLHttpRequest}catch{}if(!t)try{return new Xt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const ko=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class _u extends Ks{get name(){return"websocket"}doOpen(){const t=this.uri(),e=this.opts.protocols,i=ko?{}:_o(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,i)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const i=t[e],n=e===t.length-1;Ws(i,this.supportsBinary,r=>{try{this.doWrite(i,r)}catch{}n&&$i(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Co()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}}const Xs=Xt.WebSocket||Xt.MozWebSocket;class Cu extends _u{createSocket(t,e,i){return ko?new Xs(t,e,i):e?new Xs(t,e):new Xs(t)}doWrite(t,e){this.ws.send(e)}}class Eu extends Ks{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const e=ou(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(e).getReader(),n=ru();n.readable.pipeTo(t.writable),this._writer=n.writable.getWriter();const r=()=>{i.read().then(({done:l,value:h})=>{l||(this.onPacket(h),r())}).catch(l=>{})};r();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const i=t[e],n=e===t.length-1;this._writer.write(i).then(()=>{n&&$i(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Tu={websocket:Cu,webtransport:Eu,polling:xu},Mu=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ku=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Js(s){if(s.length>8e3)throw"URI too long";const t=s,e=s.indexOf("["),i=s.indexOf("]");e!=-1&&i!=-1&&(s=s.substring(0,e)+s.substring(e,i).replace(/:/g,";")+s.substring(i,s.length));let n=Mu.exec(s||""),r={},o=14;for(;o--;)r[ku[o]]=n[o]||"";return e!=-1&&i!=-1&&(r.source=t,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=Lu(r,r.path),r.queryKey=Ou(r,r.query),r}function Lu(s,t){const e=/\/{2,9}/g,i=t.replace(e,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Ou(s,t){const e={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,n,r){n&&(e[n]=r)}),e}const Gs=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ui=[];Gs&&addEventListener("offline",()=>{Ui.forEach(s=>s())},!1);class ve extends kt{constructor(t,e){if(super(),this.binaryType=hu,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(e=t,t=null),t){const i=Js(t);e.hostname=i.host,e.secure=i.protocol==="https"||i.protocol==="wss",e.port=i.port,i.query&&(e.query=i.query)}else e.host&&(e.hostname=Js(e.host).host);Ii(this,e),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(i=>{const n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=mu(this.opts.query)),Gs&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ui.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=xo,e.transport=t,this.id&&(e.sid=this.id);const i=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&ve.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const e=this.createTransport(t);e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",ve.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const e=new Error("server error");e.code=t.data,this._onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let i=0;i<this.writeBuffer.length;i++){const n=this.writeBuffer[i].data;if(n&&(e+=fu(n)),i>0&&e>this._maxPayload)return this.writeBuffer.slice(0,i);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,$i(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,e,i){return this._sendPacket("message",t,e,i),this}send(t,e,i){return this._sendPacket("message",t,e,i),this}_sendPacket(t,e,i,n){if(typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const r={type:t,data:e,options:i};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),n&&this.once("flush",n),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},i=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(ve.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Gs&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=Ui.indexOf(this._offlineEventListener);i!==-1&&Ui.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this._prevBufferLen=0}}}ve.protocol=xo;class zu extends ve{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),i=!1;ve.priorWebsocketSuccess=!1;const n=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",u=>{if(!i)if(u.type==="pong"&&u.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;ve.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(c(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{const d=new Error("probe error");d.transport=e.name,this.emitReserved("upgradeError",d)}}))};function r(){i||(i=!0,c(),e.close(),e=null)}const o=u=>{const d=new Error("probe error: "+u);d.transport=e.name,r(),this.emitReserved("upgradeError",d)};function l(){o("transport closed")}function h(){o("socket closed")}function a(u){e&&u.name!==e.name&&r()}const c=()=>{e.removeListener("open",n),e.removeListener("error",o),e.removeListener("close",l),this.off("close",h),this.off("upgrading",a)};e.once("open",n),e.once("error",o),e.once("close",l),this.once("close",h),this.once("upgrading",a),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const e=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&e.push(t[i]);return e}}let Pu=class extends zu{constructor(t,e={}){const i=typeof t=="object"?t:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(n=>Tu[n]).filter(n=>!!n)),super(t,i)}};function Nu(s,t="",e){let i=s;e=e||typeof location<"u"&&location,s==null&&(s=e.protocol+"//"+e.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=e.protocol+s:s=e.host+s),/^(https?|wss?):\/\//.test(s)||(typeof e<"u"?s=e.protocol+"//"+s:s="https://"+s),i=Js(s)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const r=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+r+":"+i.port+t,i.href=i.protocol+"://"+r+(e&&e.port===i.port?"":":"+i.port),i}const Ru=typeof ArrayBuffer=="function",Au=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,Lo=Object.prototype.toString,Bu=typeof Blob=="function"||typeof Blob<"u"&&Lo.call(Blob)==="[object BlobConstructor]",Du=typeof File=="function"||typeof File<"u"&&Lo.call(File)==="[object FileConstructor]";function Ys(s){return Ru&&(s instanceof ArrayBuffer||Au(s))||Bu&&s instanceof Blob||Du&&s instanceof File}function Wi(s,t){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let e=0,i=s.length;e<i;e++)if(Wi(s[e]))return!0;return!1}if(Ys(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return Wi(s.toJSON(),!0);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)&&Wi(s[e]))return!0;return!1}function Vu(s){const t=[],e=s.data,i=s;return i.data=Qs(e,t),i.attachments=t.length,{packet:i,buffers:t}}function Qs(s,t){if(!s)return s;if(Ys(s)){const e={_placeholder:!0,num:t.length};return t.push(s),e}else if(Array.isArray(s)){const e=new Array(s.length);for(let i=0;i<s.length;i++)e[i]=Qs(s[i],t);return e}else if(typeof s=="object"&&!(s instanceof Date)){const e={};for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=Qs(s[i],t));return e}return s}function Fu(s,t){return s.data=Zs(s.data,t),delete s.attachments,s}function Zs(s,t){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<t.length)return t[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let e=0;e<s.length;e++)s[e]=Zs(s[e],t);else if(typeof s=="object")for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&(s[e]=Zs(s[e],t));return s}const $u=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var et;(function(s){s[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK"})(et||(et={}));class Iu{constructor(t){this.replacer=t}encode(t){return(t.type===et.EVENT||t.type===et.ACK)&&Wi(t)?this.encodeAsBinary({type:t.type===et.EVENT?et.BINARY_EVENT:et.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===et.BINARY_EVENT||t.type===et.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=Vu(t),i=this.encodeAsString(e.packet),n=e.buffers;return n.unshift(i),n}}class tn extends kt{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const i=e.type===et.BINARY_EVENT;i||e.type===et.BINARY_ACK?(e.type=i?et.EVENT:et.ACK,this.reconstructor=new Uu(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(Ys(t)||t.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let e=0;const i={type:Number(t.charAt(0))};if(et[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===et.BINARY_EVENT||i.type===et.BINARY_ACK){const r=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);const o=t.substring(r,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(t.charAt(e+1)==="/"){const r=e+1;for(;++e&&!(t.charAt(e)===","||e===t.length););i.nsp=t.substring(r,e)}else i.nsp="/";const n=t.charAt(e+1);if(n!==""&&Number(n)==n){const r=e+1;for(;++e;){const o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}i.id=Number(t.substring(r,e+1))}if(t.charAt(++e)){const r=this.tryParse(t.substr(e));if(tn.isPayloadValid(i.type,r))i.data=r;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case et.CONNECT:return Oo(e);case et.DISCONNECT:return e===void 0;case et.CONNECT_ERROR:return typeof e=="string"||Oo(e);case et.EVENT:case et.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&$u.indexOf(e[0])===-1);case et.ACK:case et.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Uu{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const e=Fu(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Oo(s){return Object.prototype.toString.call(s)==="[object Object]"}const Wu=Object.freeze(Object.defineProperty({__proto__:null,Decoder:tn,Encoder:Iu,get PacketType(){return et}},Symbol.toStringTag,{value:"Module"}));function ee(s,t,e){return s.on(t,e),function(){s.off(t,e)}}const Hu=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class zo extends kt{constructor(t,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[ee(t,"open",this.onopen.bind(this)),ee(t,"packet",this.onpacket.bind(this)),ee(t,"error",this.onerror.bind(this)),ee(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var i,n,r;if(Hu.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const o={type:et.EVENT,data:e};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){const c=this.ids++,u=e.pop();this._registerAckCallback(c,u),o.id=c}const l=(n=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||n===void 0?void 0:n.writable,h=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!l||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,e){var i;const n=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(n===void 0){this.acks[t]=e;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);e.call(this,new Error("operation has timed out"))},n),o=(...l)=>{this.io.clearTimeoutFn(r),e.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((i,n)=>{const r=(o,l)=>o?n(o):i(l);r.withError=!0,e.push(r),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((n,...r)=>(this._queue[0],n!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(n)):(this._queue.shift(),e&&e(null,...r)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:et.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case et.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case et.EVENT:case et.BINARY_EVENT:this.onevent(t);break;case et.ACK:case et.BINARY_ACK:this.onack(t);break;case et.DISCONNECT:this.ondisconnect();break;case et.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const i of e)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let i=!1;return function(...n){i||(i=!0,e.packet({type:et.ACK,id:t,data:n}))}}onack(t){const e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:et.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const i of e)i.apply(this,t.data)}}}function Ve(s){s=s||{},this.ms=s.min||100,this.max=s.max||1e4,this.factor=s.factor||2,this.jitter=s.jitter>0&&s.jitter<=1?s.jitter:0,this.attempts=0}Ve.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*s);s=(Math.floor(t*10)&1)==0?s-e:s+e}return Math.min(s,this.max)|0},Ve.prototype.reset=function(){this.attempts=0},Ve.prototype.setMin=function(s){this.ms=s},Ve.prototype.setMax=function(s){this.max=s},Ve.prototype.setJitter=function(s){this.jitter=s};class en extends kt{constructor(t,e){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,Ii(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ve({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;const n=e.parser||Wu;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Pu(this.uri,this.opts);const e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const n=ee(e,"open",function(){i.onopen(),t&&t()}),r=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=ee(e,"error",r);if(this._timeout!==!1){const l=this._timeout,h=this.setTimeoutFn(()=>{n(),r(new Error("timeout")),e.close()},l);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(n),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(ee(t,"ping",this.onping.bind(this)),ee(t,"data",this.ondata.bind(this)),ee(t,"error",this.onerror.bind(this)),ee(t,"close",this.onclose.bind(this)),ee(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){$i(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new zo(this,t,e),this.nsps[t]=i),i}_destroy(t){const e=Object.keys(this.nsps);for(const i of e)if(this.nsps[i].active)return;this._close()}_packet(t){const e=this.encoder.encode(t);for(let i=0;i<e.length;i++)this.engine.write(e[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(n=>{n?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",n)):t.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ri={};function Hi(s,t){typeof s=="object"&&(t=s,s=void 0),t=t||{};const e=Nu(s,t.path||"/socket.io"),i=e.source,n=e.id,r=e.path,o=ri[n]&&r in ri[n].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let h;return l?h=new en(i,t):(ri[n]||(ri[n]=new en(i,t)),h=ri[n]),e.query&&!t.query&&(t.query=e.queryKey),h.socket(e.path,t)}Object.assign(Hi,{Manager:en,Socket:zo,io:Hi,connect:Hi});let sn="http://localhost:8000";function Po(s){s&&s!==sn&&(sn=s,oe&&(oe.disconnect(),oe=null))}let oe=null;function qu(){return Hi(sn,{transports:["websocket","polling"],reconnection:!0,reconnectionDelay:500,reconnectionAttempts:1/0,timeout:1e4,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0})}function nn(){return oe||(oe=qu()),oe}function ju(s,t){const e=nn();return e.on(s,t),()=>e.off(s,t)}function Ku(s,t){oe&&oe.off(s,t)}function Xu(s,t){nn().emit(s,t)}function Ju(){return oe?oe.connected?"connected":"connecting":"disconnected"}const qi={getSocket:nn,on:ju,off:Ku,emit:Xu,getStatus:Ju,setBaseUrl:Po},No=C.createContext(),le=()=>{const s=C.useContext(No);if(!s)throw new Error("useTrading must be used within TradingProvider");return s},Gu=({children:s,baseUrl:t})=>{const e=t||typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ji&&ji.tagName.toUpperCase()==="SCRIPT"&&ji.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&"http://localhost:8000"||"http://localhost:8000";Wo(e),qi.setBaseUrl(e),C.useEffect(()=>{qi.setBaseUrl(e)},[e]);const[i,n]=C.useState("BTCUSDT"),[r,o]=C.useState("M1"),[l,h]=C.useState([]),[a,c]=C.useState(!0),[u,d]=C.useState([]),[b,p]=C.useState(!1),[f,m]=C.useState(1e5),[S,g]=C.useState(null),[x,M]=C.useState([]),[P,K]=C.useState(!0),[D,G]=C.useState(!1),[Z,Et]=C.useState(!0),[$,ct]=C.useState("candles"),[Nt,vt]=C.useState(!1),lt=C.useRef(null),ht=C.useRef(new Map),ut=C.useRef(null),Rt=1e3,Tt=C.useCallback(async()=>{try{const W=localStorage.getItem("token");if(!W){console.log("⚠️ No token, skipping orders fetch");return}p(!0);const nt=await bt.get(`${e}/api/trades`,{headers:{Authorization:`Bearer ${W}`}});if(nt.data&&nt.data.data){const wt=nt.data.data.map(tt=>({id:tt.id,ticket:tt.ticket,symbol:tt.symbol,type:tt.type,volume:tt.volume,price:tt.price,stopLoss:tt.stopLoss,takeProfit:tt.takeProfit,comment:tt.comment||"",status:tt.status,swap:tt.swap||0,profit:tt.profit||0,profitCurrency:"USD",time:new Date(tt.openAt).toLocaleTimeString(),openAt:tt.openAt,closeAt:tt.closeAt}));d(wt)}else d([])}catch(W){console.error("❌ Error fetching orders:",W.response?.data||W.message),d([])}finally{p(!1)}},[]),St=C.useCallback((W,nt)=>!nt||!W.price||isNaN(nt)||isNaN(W.price)?W.profit||0:(W.type==="BUY"?nt-W.price:W.price-nt)*W.volume,[]),xt=C.useCallback(async()=>{try{const W=localStorage.getItem("token");if(!W){console.log("⚠️ No token, skipping balance fetch");return}const nt=await bt.get(`${e}/api/user/account`,{headers:{Authorization:`Bearer ${W}`}});if(nt.data&&nt.data.data){const wt=parseFloat(nt.data.data.balance);isNaN(wt)||m(wt)}}catch(W){console.error("❌ Error fetching user balance:",W.response?.data||W.message)}},[]),st=C.useMemo(()=>{const W=f,nt=u.reduce((Ot,zt)=>Ot+zt.volume*zt.price*.01,0),wt=u.reduce((Ot,zt)=>{const Jt=l.find(Gt=>Gt.symbol===zt.symbol);if(Jt){const Gt=zt.type==="BUY"?parseFloat(Jt.bid||0):parseFloat(Jt.ask||0);if(Gt&&Gt>0&&!isNaN(Gt))return Ot+St(zt,Gt)}return Ot+(zt.profit||0)},0),tt=W+wt,it=tt-nt,rt=nt>0?tt/nt*100:0;return{balance:W,equity:tt,margin:nt,freeMargin:it,level:rt.toFixed(2)}},[u,l,f,St]);C.useEffect(()=>{localStorage.getItem("token")&&(Tt(),xt())},[Tt,xt]),C.useEffect(()=>{(async()=>{try{c(!0);const nt=await bt.get(`${e}/api/symbols`);if(nt.data&&nt.data.data){const wt=nt.data.data;h(wt),wt.length>0&&(wt.find(it=>it.symbol===i)||n(wt[0].symbol))}else h([])}catch(nt){console.error("❌ Error fetching symbols:",nt.response?.data||nt.message),h([])}finally{c(!1)}})()},[]);const dt=C.useCallback(()=>{const W=ht.current;if(W.size===0)return;const nt=new Map(W);W.clear(),h(wt=>wt.map(tt=>{const it=nt.get(tt.symbol);return it?{...tt,...it}:tt})),d(wt=>{let tt=!1;const it=wt.map(rt=>{const Ot=nt.get(rt.symbol);if(!Ot)return rt;const zt=rt.type==="BUY"?parseFloat(Ot.bid||0):parseFloat(Ot.ask||0);if(!zt||isNaN(zt)||zt<=0)return rt;const Jt=St(rt,zt);return Jt===rt.profit?rt:(tt=!0,{...rt,profit:Jt})});return tt?it:wt})},[St]);C.useEffect(()=>{lt.current||(lt.current=qi.getSocket());const W=lt.current,nt=()=>console.log("✅ TradingContext: Connected"),wt=()=>console.log("⚠️ TradingContext: Disconnected"),tt=rt=>{rt?.symbol&&(ht.current.set(rt.symbol,rt),ut.current||(ut.current=setTimeout(()=>{ut.current=null,dt()},Rt)))},it=async rt=>{if(console.log("🔔 Trade closed event received:",rt),!!rt){if(rt.newBalance!==void 0){const Ot=parseFloat(rt.newBalance);isNaN(Ot)||m(Ot)}if(window.notify){const Ot=rt.profitLoss||rt.profit||0,zt=Ot>=0?`+${Ot.toFixed(2)}`:Ot.toFixed(2),Jt=rt.symbol||"Trade",Gt=rt.reason||"Closed";window.notify(`Trade Closed: ${Gt} | ${Jt} | P/L: ${zt} USD`,Ot>=0?"success":"error")}rt.tradeId&&d(Ot=>Ot.filter(zt=>zt.id!==rt.tradeId)),await Tt(),await xt()}};return W.on("connect",nt),W.on("disconnect",wt),W.on("priceUpdate",tt),W.on("tradeClosed",it),()=>{W.off("connect",nt),W.off("disconnect",wt),W.off("priceUpdate",tt),W.off("tradeClosed",it),ut.current&&(clearTimeout(ut.current),ut.current=null),ht.current.clear()}},[dt,Tt,xt]);const Mt=C.useMemo(()=>l.find(W=>W.symbol===i)||{bid:"0.00000",ask:"0.00000",change:0},[l,i]),_t=C.useMemo(()=>({selectedSymbol:i,setSelectedSymbol:n,selectedTimeframe:r,setSelectedTimeframe:o,symbols:l,setSymbols:h,symbolsLoading:a,orders:u,setOrders:d,ordersLoading:b,fetchOrders:Tt,fetchUserBalance:xt,userBalance:f,setUserBalance:m,accountSummary:st,currentSymbolData:Mt,activeTool:S,setActiveTool:g,chartObjects:x,setChartObjects:M,showGrid:P,setShowGrid:K,snapToGrid:D,setSnapToGrid:G,drawingsVisible:Z,setDrawingsVisible:Et,chartType:$,setChartType:ct,chartLocked:Nt,setChartLocked:vt,baseUrl:e}),[i,r,l,a,u,b,Tt,xt,f,st,Mt,S,x,P,D,Z,$,Nt,e]);return w.jsx(No.Provider,{value:_t,children:s})};function Lt(s){if(s==null)return null;if(typeof s=="number"){if(Number.isNaN(s)||!Number.isFinite(s))return null;let t;s>1e10?t=s/1e3:(s<1e9,t=s);const e=Math.floor(t);return e<946684800||e>4102444800?null:e}if(typeof s=="string"){const t=Date.parse(s);return Number.isNaN(t)?null:Math.floor(t/1e3)}if(typeof s=="object"&&"year"in s&&"month"in s&&"day"in s){const e=new Date(Date.UTC(s.year,s.month-1,s.day)).getTime();return Number.isNaN(e)?null:Math.floor(e/1e3)}return null}function Yu(s,t){if(!s||s.length<2)return[];const e=[],i=2;for(let n=1;n<s.length;n++){const r=s[n-1].time,o=s[n].time,l=o-r;l>t*i&&e.push({from:r,to:o,gapSeconds:l,gapHours:(l/3600).toFixed(1),fromDate:new Date(r*1e3).toISOString(),toDate:new Date(o*1e3).toISOString()})}return e}function Qu(s,t="America/New_York"){const e=new Date(s*1e3),i=new Date(e.toLocaleString("en-US",{timeZone:t})),n=i.getDay();return!(n===0||n===6||n===5&&i.getHours()>=17)}function Ro(s){return Array.isArray(s)?s.map(t=>({...t,time:Lt(t.time)})).filter(t=>t.time!=null):[]}function Zu(s){if(!s||s.length<2)return!0;for(let t=1;t<s.length;t++)if(s[t].time<=s[t-1].time)return!1;return!0}function Fe(s,t){return!Number.isFinite(s)||!Number.isFinite(t)||t<=0?s:Math.floor(s/t)*t}const Bt="17:00-17:00",Dt="America/New_York",he="24x7",ae="UTC",Ao={EURUSD:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"},BTCUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},ETHUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},BNBUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},SOLUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},ADAUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},XRPUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},DOGEUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},DOTUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},MATICUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"},LINKUSDT:{type:"crypto",session:he,sessionTZ:ae,priceMode:"last"}},Bo={type:"forex",sessionTZ:Dt,session:Bt,priceMode:"mid"};function oi(s){return s&&Ao[s.toUpperCase()]||Bo}function tf(s){return oi(s).type==="forex"}function ef(s){return oi(s).type==="crypto"}function sf(s){return oi(s).session==="24x7"}function Do(s){if(!s||typeof s!="object")return!1;const{time:t,open:e,high:i,low:n,close:r,volume:o}=s;return!(Lt(t)==null||typeof e!="number"||!Number.isFinite(e)||typeof i!="number"||!Number.isFinite(i)||typeof n!="number"||!Number.isFinite(n)||typeof r!="number"||!Number.isFinite(r)||o!=null&&(typeof o!="number"||o<0||!Number.isFinite(o))||i<e||i<r||i<n||n>e||n>r||n>i||e<=0||i<=0||n<=0||r<=0)}function Vo(s){const t=o=>Math.round(o*1e5)/1e5;let e=t(s.open),i=t(s.high),n=t(s.low),r=t(s.close);return i=Math.max(i,e,r,n),n=Math.min(n,e,r,i),{...s,open:e,high:i,low:n,close:r,volume:s.volume!=null?Math.round(s.volume):s.volume}}function Fo(s){if(!Array.isArray(s)||s.length===0)return[];const t=new Map;return s.forEach(e=>{const i=Lt(e.time);if(i!=null)if(t.has(i)){const n=t.get(i);t.set(i,{...e,time:i,open:e.open,high:Math.max(n.high,e.high),low:Math.min(n.low,e.low),close:e.close,volume:(n.volume||0)+(e.volume||0)})}else t.set(i,{...e,time:i})}),Array.from(t.values())}function nf(s,t="percentile"){if(!Array.isArray(s)||s.length<3)return s;const e=s.map(o=>o.close).filter(o=>Number.isFinite(o));if(e.length<3)return s;const i=[...e].sort((o,l)=>o-l);let n,r;if(t==="percentile"){const o=Math.floor(i.length*.25),l=Math.floor(i.length*.75),h=i[o],a=i[l],c=a-h;n=h-1.5*c,r=a+1.5*c}else{const o=e.reduce((a,c)=>a+c,0)/e.length,l=e.reduce((a,c)=>a+Math.pow(c-o,2),0)/e.length,h=Math.sqrt(l);if(h===0)return s;n=o-3*h,r=o+3*h}return s.map((o,l)=>{const h=o.close;if(h<n||h>r){if(l===0)return o;const a=s[l-1].close;return{...o,open:a,high:Math.max(a,o.high),low:Math.min(a,o.low),close:a}}return o})}function rf(s,t){if(!Array.isArray(s)||s.length===0)return s;const e=[],i=Math.max(t*10080,604800),n=1e4;for(let l=0;l<s.length;l++)if(e.push(s[l]),l<s.length-1){const h=s[l].time,a=s[l+1].time,c=a-h;if(c>i&&((c/3600).toFixed(1),(i/3600).toFixed(1)),c>t&&c<=i){const u=s[l];let d=h+t,b=0;for(d=Fe(d,t);d<a&&b<n;){const p=Fe(d,t);e.some(m=>m.time===p)||(e.push({time:p,open:u.close,high:u.close,low:u.close,close:u.close,volume:0}),b++),d+=t}if(d<a&&b>=n){const p=Fe(a-t,t);e.some(m=>m.time===p)||e.push({time:p,open:u.close,high:u.close,low:u.close,close:u.close,volume:0})}}}e.sort((l,h)=>l.time-h.time);const r=[],o=new Set;for(const l of e)o.has(l.time)||(o.add(l.time),r.push(l));return r}function rn(s){if(!s||typeof s!="string")return 60;const t=s.toUpperCase();if(t==="MN")return 2592e3;let e=t.match(/^([MHDW])(\d+)$/);if(e){const i=e[1];return parseInt(e[2],10)*({M:60,H:3600,D:86400,W:604800}[i]||60)}if(e=s.match(/^(\d+)([mhdwy])$/i),e){const i=parseInt(e[1],10),n=e[2].toLowerCase();return i*({m:60,h:3600,d:86400,w:604800,y:31536e3}[n]||60)}return 60}function $o(s,t,e){if(!Array.isArray(s)||s.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const i=oi(t),n=rn(e),l=Ro(s).map(m=>({...m,time:Fe(m.time,n)})).filter(m=>Do(m)).map(m=>Vo(m)),h=Fo(l);h.sort((m,S)=>m.time-S.time);const a=h.filter((m,S)=>S===0?!0:m.time>h[S-1].time),c=a.length>10?nf(a,"percentile"):a,u=Fo(c);u.sort((m,S)=>m.time-S.time);const d=rf(u,n),b=[];for(let m=1;m<d.length;m++){const S=d[m].time-d[m-1].time;S>n*2&&b.push({from:d[m-1].time,to:d[m].time,gapSeconds:S,gapMinutes:Math.round(S/60),fromDate:new Date(d[m-1].time*1e3).toISOString(),toDate:new Date(d[m].time*1e3).toISOString()})}const p=c.filter((m,S)=>S===0?!1:m.close===c[S-1].close&&m.open===c[S-1].close).length,f={original:s.length,processed:d.length,duplicates:s.length-h.length,outliers:p,gaps:b,filledGaps:d.length-u.length,symbolConfig:i};return{candles:d,stats:f}}function Io(s,t,e="1m"){if(!s||!t||!Do(s))return null;const i=Lt(s.time);if(i==null)return null;const n=rn(e),r=Fe(i,n);return Vo({...s,time:r})}let Uo="http://localhost:8000";function Wo(s){s&&(Uo=s)}const of={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Ho(s){if(!s)return 7;const t=String(s).toUpperCase();return of[t]??7}function lf(s,t){const e=String(s||"").toUpperCase(),i=t||Ho(s),n={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[e]||96,r=Math.ceil(i*(typeof n=="number"?n:96));return Math.min(Math.max(r,500),5e3)}const Vt=s=>{if(!Array.isArray(s)||s.length===0)return[];const t=s.map(i=>({...i,time:Lt(i.time)})).filter(i=>i.time!=null);t.sort((i,n)=>i.time-n.time);const e=new Map;for(const i of t)e.set(i.time,i);return Array.from(e.values()).sort((i,n)=>i.time-n.time)};function hf(s,t,e,i,n,r){const o=n-e,l=r-i,h=Math.sqrt(o*o+l*l);if(h===0)return Math.hypot(s-e,t-i);let a=((s-e)*o+(t-i)*l)/(h*h);a=Math.max(0,Math.min(1,a));const c=e+a*o,u=i+a*l;return Math.hypot(s-c,t-u)}function on(s,t,e,i,n){if(!e||!i||!n)return null;const r=e.time,o=i.time,l=o-r,h=e.price,a=i.price,c=n.price;if(Math.abs(l)<1e-9){const p=c-h;return[{time:r,price:h+p},{time:o+1,price:a+p}]}const u=(a-h)/l,d=c+u*(r-n.time),b=c+u*(o-n.time);return[{time:r,price:d},{time:o,price:b}]}const af=C.forwardRef(function({bidPrice:t="113.638",askPrice:e="113.649",showBuySellPanel:i=!0,onBuyClick:n,onSellClick:r},o){const l=C.useRef(null),h=C.useRef(null),a=C.useRef(null),c=C.useRef(null),u=C.useRef([]),d=C.useRef(!1),b=C.useRef(null),p=C.useRef(null),f=C.useRef(null),m=C.useRef(null),S=C.useRef([]),[g,x]=C.useState(null),[M,P]=C.useState([]),K=C.useRef(null),D=C.useRef(null),G=C.useRef(null),Z=C.useRef(!1);C.useEffect(()=>{G.current=g},[g]);const Et=C.useRef(new Map),$=C.useRef(null),ct=(y,_)=>`${y}_${_}`,Nt=()=>{const y=ct(st,dt);return Et.current.get(y)||null},vt=y=>{if(!y)return;const _=ct(st,dt);Et.current.set(_,y)},{activeTool:lt,setActiveTool:ht,showGrid:ut,snapToGrid:Rt,chartObjects:Tt,setChartObjects:St,orders:xt,selectedSymbol:st,selectedTimeframe:dt,drawingsVisible:Mt,chartType:_t,chartLocked:W,baseUrl:nt}=le(),wt=nt||Uo,tt=C.useRef([]),[it,rt]=C.useState([]),[Ot,zt]=C.useState(!0),Jt=C.useRef(null),Gt=C.useRef(new Map);C.useRef(null);const Yo=C.useRef(0);C.useImperativeHandle(o,()=>({zoomIn:()=>{const y=h.current?.timeScale();if(!y)return;const _=y.getVisibleRange();if(!_||!_.from||!_.to)return;const T=_.to-_.from,R=(_.from+_.to)/2,L=T*.8;try{y.setVisibleRange({from:R-L/2,to:R+L/2}),vt(y.getVisibleRange())}catch{}},zoomOut:()=>{const y=h.current?.timeScale();if(!y)return;const _=y.getVisibleRange();if(!_||!_.from||!_.to)return;const T=_.to-_.from,R=(_.from+_.to)/2,L=T*1.25;try{y.setVisibleRange({from:R-L/2,to:R+L/2}),vt(y.getVisibleRange())}catch{}}}));const an=C.useMemo(()=>it.length===0?[]:_t==="line"||_t==="area"?it.map(y=>({time:y.time,value:y.close})):it,[it,_t]);return C.useEffect(()=>{const y=l.current;if(!y)return;const _=y.getBoundingClientRect(),T=O=>{const I=Math.abs(Number(O));return Number.isFinite(I)?I>=1e3?I.toFixed(2):I>=1?I.toFixed(4):I.toFixed(5):"0"},R=La(y,{width:_.width||y.clientWidth,height:_.height||y.clientHeight,autoSize:!0,localization:{priceFormatter:T},layout:{background:{color:"#0F1720"},textColor:"#fff",fontSize:12},grid:{vertLines:{visible:ut,color:ut?"rgba(148, 163, 184, 0.2)":"transparent",style:0},horzLines:{visible:ut,color:ut?"rgba(148, 163, 184, 0.2)":"transparent",style:0}},rightPriceScale:{borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0},leftPriceScale:{visible:!1},timeScale:{borderColor:"#1e293b",timeVisible:!0,secondsVisible:!1,rightOffset:10,barSpacing:3,minBarSpacing:2,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1},crosshair:{mode:lt===1?1:0,vertLine:{width:1,color:"#64748b",style:0,labelBackgroundColor:"#1e293b"},horzLine:{width:1,color:"#64748b",style:0,labelBackgroundColor:"#1e293b"},vertLineVisible:lt===1,horzLineVisible:lt===1},handleScroll:{mouseWheel:!0,pressedMouseMove:lt===null||lt===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),L=R.addCandlestickSeries({upColor:"#26A69A",downColor:"#EF5350",wickUpColor:"#26A69A",wickDownColor:"#EF5350",borderVisible:!1});h.current=R,a.current=L;const H=R.timeScale(),J=()=>{if(Z.current&&it.length>0){const O=H.getVisibleRange();O&&vt(O)}};H.subscribeVisibleTimeRangeChange(J);const pt=new ResizeObserver(O=>{for(const I of O){const{width:at,height:q}=I.contentRect;if(at>0&&q>0&&R){const k=H.getVisibleRange();R.resize(at,q),k&&setTimeout(()=>{try{H.setVisibleRange(k)}catch{}},0)}}});return pt.observe(y),()=>{H.unsubscribeVisibleTimeRangeChange(J),pt.disconnect(),R.remove(),h.current=null,a.current=null,c.current=null,u.current=[]}},[]),C.useEffect(()=>{h.current&&h.current.applyOptions({grid:{vertLines:{visible:ut,color:ut?"rgba(148, 163, 184, 0.2)":"transparent",style:0},horzLines:{visible:ut,color:ut?"rgba(148, 163, 184, 0.2)":"transparent",style:0}}})},[ut]),C.useEffect(()=>{if(!h.current)return;const _=!W&&!(lt!==null&&lt!==1&&lt!==0),T=!W;h.current.applyOptions({crosshair:{mode:lt===1?1:0,vertLine:{visible:lt===1,width:1,color:"#64748b",style:0,labelBackgroundColor:"#1e293b"},horzLine:{visible:lt===1,width:1,color:"#64748b",style:0,labelBackgroundColor:"#1e293b"}},handleScroll:{mouseWheel:T,pressedMouseMove:_,horzTouchDrag:_,vertTouchDrag:_},handleScale:{axisPressedMouseMove:{time:_,price:_},axisDoubleClickReset:{time:T,price:T},axisTouch:{time:_,price:_},mouseWheel:T,pinch:T}})},[lt,W]),C.useEffect(()=>{(async()=>{if(!st||!dt){rt([]),Z.current=!1;return}try{if(zt(!0),rt([]),Z.current=!1,a.current)try{a.current.setData([])}catch{}console.log(`📊 Fetching candles for ${st} @ ${dt}`);const _=Ho(dt),T=lf(dt,_),R=await bt.get(`${wt}/api/chart/candles`,{params:{symbol:st,timeframe:dt,limit:T,daysBack:_},timeout:1e4});if(R.data&&R.data.data&&R.data.data.length>0){const L=R.data.data;console.log(`✅ Loaded ${L.length} raw candles from server`);const{candles:H,stats:J}=$o(L,st,dt);H.length>0?(rt(H),Gt.current=new Map,H.forEach(pt=>{Gt.current.set(pt.time,pt)})):(console.warn(`⚠️ No valid candles after processing for ${st}`),rt([]))}else console.warn(`⚠️ No candle data returned for ${st}`),rt([])}catch(_){console.error(`❌ Error fetching ${st}:`,_.message),rt([])}finally{zt(!1)}})()},[st,dt,wt]),C.useEffect(()=>{Jt.current=qi.getSocket();const y=Jt.current,_=()=>{console.log("✅ Chart WebSocket connected"),L()},T=()=>{console.log("⚠️ Chart WebSocket disconnected - will auto-reconnect")},R=J=>{console.error("❌ Chart WebSocket connection error:",J)};y.on("connect",_),y.on("disconnect",T),y.on("connect_error",R);const L=()=>{st&&dt&&y.connected&&(console.log(`Subscribing to real-time candles: ${st}@${dt}`),y.emit("subscribeCandles",{symbol:st,timeframe:dt}))},H=J=>{if(!J||!J.candle||!J.symbol||J.symbol.toUpperCase()!==st?.toUpperCase())return;const{candle:pt}=J,O=Io(pt,st,dt);if(!O)return;const I=Date.now();if(I-Yo.current<200)return;Yo.current=I;const at=h.current?.timeScale(),q=at?.getVisibleRange(),k=a.current,U=h.current;if(!(!k||!U||!Z.current))try{_t==="line"||_t==="area"?k.update({time:O.time,value:O.close}):k.update({time:O.time,open:O.open,high:O.high,low:O.low,close:O.close}),Gt.current.set(O.time,O),at&&q&&vt(q)}catch(z){console.error("❌ Error updating candle:",z)}};return y.on("candleUpdate",H),y.connected&&L(),()=>{y.off("candleUpdate",H),y.off("connect",_),y.off("disconnect",T),y.off("connect_error",R),st&&dt&&y.connected&&y.emit("unsubscribeCandles",{symbol:st,timeframe:dt})}},[st,dt]),C.useEffect(()=>{const y=a.current,_=h.current;if(!(!y||!_)&&!(it.length===0&&Z.current)){if(it.length===0&&!Z.current){if(Ot)return;const T=_.timeScale();y.setData([]),T.fitContent();return}if(!Z.current){const T=_.timeScale(),R=ct(st,dt);if($.current,$.current=R,_t==="line"||_t==="area"){const H=[...it.map(J=>({time:J.time,value:J.close})).filter(J=>J.time!=null)].sort((J,pt)=>J.time-pt.time);H.length>0&&y.setData(H)}else{const L=[...it].sort((H,J)=>H.time-J.time);L.length>0&&y.setData(L)}T.fitContent();try{_.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}Z.current=!0,vt(T.getVisibleRange())}}},[it.length,_t,st,dt]),C.useEffect(()=>{const y=h.current;if(!y||!Z.current||it.length===0)return;const _=y.timeScale(),T=_.getVisibleRange()||Nt();if(a.current)try{y.removeSeries(a.current)}catch{}if(c.current)try{y.removeSeries(c.current),c.current=null}catch{}let R;if(_t==="bars"){R=y.addBarSeries({upColor:"#26A69A",downColor:"#EF5350",borderUpColor:"#26A69A",borderDownColor:"#EF5350",scaleMargins:{top:.1,bottom:.1}});const L=[...it].sort((H,J)=>H.time-J.time);L.length>0&&R.setData(L)}else if(_t==="line"){R=y.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const L=Vt(an);L.length>0&&R.setData(L)}else if(_t==="area"){R=y.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const L=Vt(an);L.length>0&&R.setData(L)}else if(_t==="volume ticks"||_t==="volume"){R=y.addCandlestickSeries({upColor:"#26A69A",downColor:"#EF5350",wickUpColor:"#26A69A",wickDownColor:"#EF5350",borderVisible:!1,priceScaleId:"right"});const L=[...it].sort((pt,O)=>pt.time-O.time);L.length>0&&R.setData(L);const H=y.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});y.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),y.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const J=L.map(pt=>({time:pt.time,value:pt.volume||0,color:pt.close>=pt.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));J.length>0&&H.setData(J),c.current=H}else{R=y.addCandlestickSeries({upColor:"#26A69A",downColor:"#EF5350",wickUpColor:"#26A69A",wickDownColor:"#EF5350",borderVisible:!1,scaleMargins:{top:.1,bottom:.1}});const L=[...it].sort((H,J)=>H.time-J.time);L.length>0&&R.setData(L)}if(a.current=R,T&&Z.current)setTimeout(()=>{try{_.setVisibleRange(T),vt(T)}catch{if(it.length>0)try{const H=it[it.length-1].time,J=H-6e3;_.setVisibleRange({from:J,to:H}),vt(_.getVisibleRange())}catch{_.fitContent(),vt(_.getVisibleRange())}}try{y.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!Z.current){_.fitContent();try{y.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}Z.current=!0,vt(_.getVisibleRange())}},[_t,it.length,an.length]),C.useEffect(()=>{const y=h.current,_=c.current;if(!y||!_||!Z.current||it.length===0||_t!=="volume"&&_t!=="volume ticks")return;const R=[...it].sort((L,H)=>L.time-H.time).map(L=>({time:L.time,value:L.volume||0,color:L.close>=L.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));R.length>0&&_.setData(R)},[it,_t]),C.useEffect(()=>{const y=h.current,_=a.current,T=l.current;if(!y||!_||!T)return;const L=lt!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","pricelevel","text",null,null,null,null,null,null,null,null,null][lt]:null;if(!L){if(d.current=!1,b.current=null,p.current=null,m.current=null,f.current?.series)try{y.removeSeries(f.current.series)}catch{}f.current=null;return}if(L==="pricelevel"){const O=I=>{const at=T.getBoundingClientRect(),q=I.clientX-at.left,k=I.clientY-at.top,U=y.timeScale().coordinateToTime(q),z=_.coordinateToPrice(k);if(U==null||z==null)return;const A={type:"pricelevel",priceLine:_.createPriceLine({price:z,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:z.toFixed(5)}),price:z};St(j=>[...j,A]),u.current.push(A)};return T.addEventListener("click",O),()=>{T.removeEventListener("click",O)}}if(L==="trendline"){const O=k=>{k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation();const U=T.getBoundingClientRect(),z=k.clientX-U.left,B=k.clientY-U.top;let A=y.timeScale().coordinateToTime(z);const j=_.coordinateToPrice(B);if(!(A==null||j==null)&&(A=Lt(A),A!=null))if(m.current===null){m.current={time:A,price:j};const N=y.addLineSeries({color:"#22c55e",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});f.current={type:"trendline",series:N},N.setData([{time:A,value:j}])}else{const N=m.current,F={time:A,price:j},X=1,mt=1e-5,ot=Math.abs(F.time-N.time),yt=Math.abs(F.price-N.price);if(ot<X&&yt<mt){try{y.removeSeries(f.current.series)}catch{}m.current=null,f.current=null;return}const fe={time:N.time,price:N.price},de={time:F.time,price:F.price},Yt=Vt([{time:fe.time,value:fe.price},{time:de.time,value:de.price}]);if(Yt.length>0){f.current.series.setData(Yt);const ye={type:"trendline",series:f.current.series,point1:fe,point2:de};St(Le=>[...Le,ye]),u.current.push(ye)}ht(null),m.current=null,f.current=null}},I=k=>{if(m.current===null||f.current?.type!=="trendline")return;k.preventDefault(),k.stopPropagation();const U=T.getBoundingClientRect(),z=k.clientX-U.left,B=k.clientY-U.top;let A=y.timeScale().coordinateToTime(z);const j=_.coordinateToPrice(B);if(A==null||j==null||(A=Lt(A),A==null))return;const N=m.current,F=Vt([{time:N.time,value:N.price},{time:A,value:j}]);F.length>0&&f.current.series.setData(F)},at=k=>{k.stopPropagation()},q={capture:!0,passive:!1};return T.addEventListener("click",O,q),T.addEventListener("mousemove",I,q),T.addEventListener("mousemove",at,q),()=>{if(m.current=null,f.current?.type==="trendline"&&f.current?.series){try{y.removeSeries(f.current.series)}catch{}f.current=null}T.removeEventListener("click",O,q),T.removeEventListener("mousemove",I,q),T.removeEventListener("mousemove",at,q)}}if(L==="parallellines"){const O={capture:!0,passive:!1},I=z=>{z.preventDefault(),z.stopPropagation(),z.stopImmediatePropagation();const B=T.getBoundingClientRect(),A=z.clientX-B.left,j=z.clientY-B.top;let N=y.timeScale().coordinateToTime(A);const F=_.coordinateToPrice(j);if(N==null||F==null||(N=Lt(N),N==null))return;const X={time:N,price:F},mt=S.current;if(mt.length===0){S.current=[X];const ot=y.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});ot.setData([{time:N,value:F}]),f.current={type:"parallellines",series:ot,previewLine:null}}else if(mt.length===1){S.current=[mt[0],X];const ot=Vt([{time:mt[0].time,value:mt[0].price},{time:N,value:F}]);ot.length>0&&f.current.series.setData(ot),f.current.previewLine=y.addLineSeries({color:"#8b5cf6",lineWidth:2,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1});const yt=on(y,_,mt[0],X,X);yt&&f.current.previewLine.setData(Vt([{time:yt[0].time,value:yt[0].price},{time:yt[1].time,value:yt[1].price}]))}else{const[ot,yt]=mt,fe=X;if(f.current?.previewLine){try{y.removeSeries(f.current.previewLine)}catch{}f.current.previewLine=null}const de=f.current?.series;if(!de)return;const Yt=on(y,_,ot,yt,fe);if(!Yt)return;const ye=y.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});de.setData(Vt([{time:ot.time,value:ot.price},{time:yt.time,value:yt.price}])),ye.setData(Vt([{time:Yt[0].time,value:Yt[0].price},{time:Yt[1].time,value:Yt[1].price}]));const Le={type:"parallellines",point1:ot,point2:yt,point3:fe,baseLine:de,parallelLine:ye};St(li=>[...li,Le]),u.current.push(Le),ht(null),S.current=[],f.current=null}},at=z=>{const B=S.current;if(B.length!==1||!f.current?.series)return;const A=T.getBoundingClientRect(),j=z.clientX-A.left,N=z.clientY-A.top;let F=y.timeScale().coordinateToTime(j);const X=_.coordinateToPrice(N);if(F==null||X==null||(F=Lt(F),F==null))return;const mt=Vt([{time:B[0].time,value:B[0].price},{time:F,value:X}]);mt.length>0&&f.current.series.setData(mt)},q=z=>{const B=S.current;if(B.length!==2||!f.current?.previewLine)return;const A=T.getBoundingClientRect(),j=z.clientX-A.left,N=z.clientY-A.top;let F=y.timeScale().coordinateToTime(j);const X=_.coordinateToPrice(N);if(F==null||X==null||(F=Lt(F),F==null))return;const mt={time:F,price:X},ot=on(y,_,B[0],B[1],mt);ot&&f.current.previewLine.setData(Vt([{time:ot[0].time,value:ot[0].price},{time:ot[1].time,value:ot[1].price}]))},k=z=>{at(z),q(z)},U=z=>{z.stopPropagation()};return T.addEventListener("click",I,O),T.addEventListener("mousemove",k,O),T.addEventListener("mousemove",U,O),()=>{if(S.current=[],f.current?.type==="parallellines"){try{f.current.series&&y.removeSeries(f.current.series),f.current.previewLine&&y.removeSeries(f.current.previewLine)}catch{}f.current=null}T.removeEventListener("click",I,O),T.removeEventListener("mousemove",k,O),T.removeEventListener("mousemove",U,O)}}if(m.current=null,f.current?.type==="trendline"&&f.current?.series){try{y.removeSeries(f.current.series)}catch{}f.current=null}const H=O=>{if(O.preventDefault(),O.stopPropagation(),O.stopImmediatePropagation(),L==="trendline"||L==="parallellines"||L!=="rectangle"&&L!=="fibonacci")return;const I=T.getBoundingClientRect(),at=O.clientX-I.left,q=O.clientY-I.top;let k=y.timeScale().coordinateToTime(at);const U=_.coordinateToPrice(q);if(!(k==null||U==null)&&(k=Lt(k),k!=null)){if(d.current=!0,b.current={time:k,price:U},p.current=null,L==="rectangle"){const z=y.addBaselineSeries({baseValue:{type:"price",price:U},topLineColor:"#2563eb",bottomLineColor:"#2563eb",topFillColor1:"rgba(59, 130, 246, 0.38)",topFillColor2:"rgba(59, 130, 246, 0.22)",bottomFillColor1:"rgba(59, 130, 246, 0.22)",bottomFillColor2:"rgba(59, 130, 246, 0.38)",priceLineVisible:!1,lastValueVisible:!1,lineWidth:2,lineStyle:0});f.current={type:"rectangle",series:z}}if(L==="fibonacci"){const z=y.addLineSeries({color:"#f59e0b",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});f.current={type:"fibonacci",series:z,priceLines:[]}}if(L==="parallellines"){const z=y.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});f.current={type:"parallellines",series:z,firstLine:null,secondLine:null}}}},J=O=>{if(!d.current||!b.current||!f.current)return;O.preventDefault(),O.stopPropagation(),O.stopImmediatePropagation();const I=T.getBoundingClientRect(),at=O.clientX-I.left,q=O.clientY-I.top;let k=y.timeScale().coordinateToTime(at);const U=_.coordinateToPrice(q);if(k==null||U==null||(k=Lt(k),k==null))return;p.current={time:k,price:U};const z=b.current;if(f.current.type==="rectangle"){const B=Math.max(z.price,U),A=Math.min(z.price,U),j=Lt(Math.min(z.time,k)),N=Lt(Math.max(z.time,k));if(j==null||N==null||Math.abs(N-j)<1||Math.abs(B-A)<1e-5)return;const F=f.current.series;F.setData(Vt([{time:j,value:B},{time:N,value:B}])),F.applyOptions({baseValue:{type:"price",price:A}})}if(f.current.type==="fibonacci"){const B=[{time:z.time,value:z.price},{time:k,value:U}],A=Vt(B);A.length>0&&f.current.series.setData(A),p.current={time:k,price:U},f.current.priceLines&&(f.current.priceLines.forEach(j=>{try{_.removePriceLine(j)}catch{}}),f.current.priceLines=[])}if(f.current.type==="parallellines")if(f.current.firstLine){const B=f.current.firstLine;B.endTime-B.startTime;const A=B.endPrice-B.startPrice,j=U,N=j+A;if(f.current.secondLine)f.current.secondLine.setData([{time:z.time,value:j},{time:k,value:N}]);else{const F=y.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.setData([{time:z.time,value:j},{time:k,value:N}]),f.current.secondLine=F}}else f.current.series.setData([{time:z.time,value:z.price},{time:k,value:U}])},pt=O=>{if(O&&(O.preventDefault(),O.stopPropagation()),!d.current||!f.current||!b.current)return;const I=b.current,at=p.current||I;if(f.current.type==="parallellines")if(f.current.firstLine){const q={type:"parallellines",firstLine:f.current.series,secondLine:f.current.secondLine,firstLineData:f.current.firstLine};St(k=>[...k,q]),u.current.push(q),ht(null),f.current=null,d.current=!1,b.current=null,p.current=null;return}else{f.current.firstLine={startTime:I.time,startPrice:I.price,endTime:at.time,endPrice:at.price},d.current=!1,b.current=null,p.current=null;return}if(f.current.type==="fibonacci"){const k=(p.current||I).price;if(Math.abs(I.price-k)<1e-4){try{y.removeSeries(f.current.series)}catch{}d.current=!1,b.current=null,p.current=null,f.current=null;return}const U=Math.max(I.price,k),z=Math.min(I.price,k),B=U-z,A=[{level:0,label:"0.0%"},{level:.236,label:"23.6%"},{level:.382,label:"38.2%"},{level:.5,label:"50.0%"},{level:.618,label:"61.8%"},{level:.786,label:"78.6%"},{level:1,label:"100.0%"}],j=[],N=f.current.series;try{y.removeSeries(N)}catch{}A.forEach(({level:X,label:mt})=>{const ot=U-B*X,yt=_.createPriceLine({price:ot,color:X===0||X===1?"#f59e0b":"#fbbf24",lineWidth:X===0||X===1?2:1,lineStyle:X===0||X===1?0:2,axisLabelVisible:!0,title:`${mt} (${ot.toFixed(5)})`,textColor:X===0||X===1?"#f59e0b":"#fbbf24"});j.push(yt)});const F={type:"fibonacci",priceLines:j,startPrice:I.price,endPrice:k,high:U,low:z};St(X=>[...X,F]),u.current.push(F),ht(null)}if(f.current.type==="rectangle"){const q=b.current,k=p.current||q,U=Math.max(q.price,k.price),z=Math.min(q.price,k.price),B=Lt(Math.min(q.time,k.time)),A=Lt(Math.max(q.time,k.time));if(B!=null&&A!=null&&Math.abs(A-B)>=1&&Math.abs(U-z)>=1e-5){const j=f.current.series;j.setData(Vt([{time:B,value:U},{time:A,value:U}])),j.applyOptions({baseValue:{type:"price",price:z}});const N={type:"rectangle",timeStart:B,timeEnd:A,priceTop:U,priceBottom:z,series:j};St(F=>[...F,N]),u.current.push(N),ht(null)}else try{y.removeSeries(f.current.series)}catch{}}d.current=!1,b.current=null,p.current=null,f.current=null};if(L==="rectangle"||L==="fibonacci"||L==="parallellines"){const O={capture:!0,passive:!1},I=at=>{d.current||at.stopPropagation()};return T.addEventListener("mousedown",H,O),T.addEventListener("mousemove",J,O),T.addEventListener("mousemove",I,O),T.addEventListener("mouseup",pt,O),()=>{T.removeEventListener("mousedown",H,O),T.removeEventListener("mousemove",J,O),T.removeEventListener("mousemove",I,O),T.removeEventListener("mouseup",pt,O)}}},[lt,St,ht]),C.useEffect(()=>{const y=h.current,_=a.current,T=l.current,R=lt===null||lt===1;if(!R||!y||!_||!T){R||(x(null),P([]));return}const L=10,H=8;function J(q,k){const U=Tt.filter(z=>z.type==="trendline"&&z.point1&&z.point2);for(let z=U.length-1;z>=0;z--){const B=U[z],A=y.timeScale().timeToCoordinate(B.point1.time),j=_.priceToCoordinate(B.point1.price),N=y.timeScale().timeToCoordinate(B.point2.time),F=_.priceToCoordinate(B.point2.price);if(A==null||j==null||N==null||F==null)continue;const X=Math.hypot(q-A,k-j),mt=Math.hypot(q-N,k-F);if(X<L)return{object:B,mode:"handle1"};if(mt<L)return{object:B,mode:"handle2"};if(hf(q,k,A,j,N,F)<H)return{object:B,mode:"line"}}return null}const pt=q=>{q.preventDefault(),q.stopPropagation();const k=T.getBoundingClientRect(),U=q.clientX-k.left,z=q.clientY-k.top,B=J(U,z);B?(x(B.object),K.current=B.mode,B.mode==="line"&&(D.current={x:U,y:z,point1:{...B.object.point1},point2:{...B.object.point2}})):(x(null),K.current=null)},O=q=>{if(!K.current)return;const k=G.current;if(!k||!k.point1||!k.point2)return;const U=T.getBoundingClientRect(),z=q.clientX-U.left,B=q.clientY-U.top;let A=y.timeScale().coordinateToTime(z);const j=_.coordinateToPrice(B);if(!(A==null||j==null)&&(A=Lt(A),A!=null)){if(K.current==="handle1"){const N={time:A,price:j},F=Vt([{time:N.time,value:N.price},{time:k.point2.time,value:k.point2.price}]);F.length>0&&k.series.setData(F);const X={...k,point1:N};St(mt=>{const ot=mt.map(yt=>yt===k?X:yt);return u.current=ot,ot}),x(X),G.current=X}else if(K.current==="handle2"){const N={time:A,price:j},F=Vt([{time:k.point1.time,value:k.point1.price},{time:N.time,value:N.price}]);F.length>0&&k.series.setData(F);const X={...k,point2:N};St(mt=>{const ot=mt.map(yt=>yt===k?X:yt);return u.current=ot,ot}),x(X),G.current=X}else if(K.current==="line"){const N=D.current;if(!N)return;const F=y.timeScale().coordinateToTime(N.x),X=_.coordinateToPrice(N.y);if(F==null||X==null)return;const mt=A-F,ot=j-X,yt={time:Lt(N.point1.time+mt),price:N.point1.price+ot},fe={time:Lt(N.point2.time+mt),price:N.point2.price+ot},de=Vt([{time:yt.time,value:yt.price},{time:fe.time,value:fe.price}]);de.length>0&&k.series.setData(de);const Yt={...k,point1:yt,point2:fe};St(ye=>{const Le=ye.map(li=>li===k?Yt:li);return u.current=Le,Le}),x(Yt),G.current=Yt}}},I=()=>{K.current=null,D.current=null},at={capture:!0,passive:!1};return T.addEventListener("mousedown",pt,at),T.addEventListener("mousemove",O,at),T.addEventListener("mouseup",I,at),()=>{T.removeEventListener("mousedown",pt,at),T.removeEventListener("mousemove",O,at),T.removeEventListener("mouseup",I,at)}},[lt,Tt,St]),C.useEffect(()=>{const y=h.current,_=a.current;if(!y||!_)return;const T=()=>{const L=g;if(!L||L.type!=="trendline"||!L.point1||!L.point2){P([]);return}const H=y.timeScale(),J=H.timeToCoordinate(L.point1.time),pt=_.priceToCoordinate(L.point1.price),O=H.timeToCoordinate(L.point2.time),I=_.priceToCoordinate(L.point2.price);J!=null&&pt!=null&&O!=null&&I!=null?P([{x:J,y:pt},{x:O,y:I}]):P([])};T();const R=y.timeScale();return R.subscribeVisibleTimeRangeChange(T),()=>{R.unsubscribeVisibleTimeRangeChange(T)}},[g]),C.useEffect(()=>{!h.current||!a.current||u.current.forEach(y=>{y.series&&y.series.applyOptions({visible:Mt}),y.priceLine&&y.priceLine.applyOptions(Mt?{color:"#3b82f6",axisLabelVisible:!0,title:typeof y.price=="number"?y.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""}),y.type==="fibonacci"&&y.priceLines&&y.priceLines.forEach(_=>{try{_.applyOptions({lineVisible:Mt,axisLabelVisible:Mt})}catch{}}),y.type==="rectangle"&&y.series&&y.series.applyOptions({visible:Mt}),y.type==="parallellines"&&(y.baseLine&&y.baseLine.applyOptions({visible:Mt}),y.parallelLine&&y.parallelLine.applyOptions({visible:Mt}),y.firstLine&&y.firstLine.applyOptions({visible:Mt}),y.secondLine&&y.secondLine.applyOptions({visible:Mt}))})},[Mt,Tt]),C.useEffect(()=>{!Mt&&g&&(x(null),P([]))},[Mt,g]),C.useEffect(()=>{if(u.current.length>Tt.length){const y=u.current.filter((_,T)=>!Tt.includes(_));g&&y.some(_=>_===g)&&(x(null),P([])),y.forEach(_=>{if(_.series&&h.current?.removeSeries(_.series),_.priceLine&&a.current?.removePriceLine(_.priceLine),_.type==="fibonacci"&&_.priceLines&&_.priceLines.forEach(T=>{try{a.current?.removePriceLine(T)}catch{}}),_.type==="rectangle"&&_.series)try{h.current?.removeSeries(_.series)}catch{}if(_.type==="parallellines")try{_.baseLine&&h.current?.removeSeries(_.baseLine),_.parallelLine&&h.current?.removeSeries(_.parallelLine),_.firstLine&&h.current?.removeSeries(_.firstLine),_.secondLine&&h.current?.removeSeries(_.secondLine)}catch{}}),u.current=Tt}},[Tt,g]),C.useEffect(()=>{const y=a.current;return y?(tt.current.forEach(T=>{try{y.removePriceLine(T)}catch{}}),tt.current=[],xt.filter(T=>T.symbol===st).forEach(T=>{const R=parseFloat(T.price);if(isNaN(R))return;const H=T.type==="BUY"?"#26A69A":"#EF5350",J=y.createPriceLine({price:R,color:H,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${T.type} ${T.volume} @ ${T.price}`,textColor:H});tt.current.push(J)}),()=>{tt.current.forEach(T=>{try{y.removePriceLine(T)}catch{}}),tt.current=[]}):void 0},[xt,st]),w.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,overflow:"hidden",width:"100%",height:"100%"},children:w.jsx("div",{ref:l,style:{flex:1,width:"100%",height:"100%",position:"relative",cursor:lt===1||lt!==null?"crosshair":"default",minHeight:0,minWidth:0},onDoubleClick:y=>{h.current&&!d.current&&(y.preventDefault(),y.stopPropagation(),h.current.timeScale().fitContent(),vt(h.current.timeScale().getVisibleRange()))},children:Mt&&g?.type==="trendline"&&g?.point1&&g?.point2&&M.length===2&&w.jsx("div",{style:{position:"absolute",inset:0,zIndex:20,pointerEvents:"none"},"aria-hidden":!0,children:M.map((y,_)=>w.jsx("div",{style:{position:"absolute",width:10,height:10,borderRadius:"50%",border:"2px solid white",backgroundColor:"#22c55e",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",left:y.x-5,top:y.y-5}},_))})})})}),gt={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function qo({style:s,className:t}){const{selectedSymbol:e,setSelectedSymbol:i,symbols:n,symbolsLoading:r}=le(),[o,l]=C.useState(!1),[h,a]=C.useState(""),[c,u]=C.useState(-1),d=C.useRef(null),b=C.useRef(null);C.useEffect(()=>{const g=x=>{d.current&&!d.current.contains(x.target)&&(l(!1),a(""))};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),C.useEffect(()=>{o&&b.current&&b.current.focus()},[o]);const p=n.filter(g=>g.symbol.toLowerCase().includes(h.toLowerCase())),f=p.filter(g=>!g.symbol.endsWith("USDT")),m=p.filter(g=>g.symbol.endsWith("USDT")),S=g=>{i(g),l(!1),a("")};return n.find(g=>g.symbol===e),w.jsxs("div",{ref:d,style:{...gt.container,...s},className:t,children:[w.jsxs("button",{style:gt.button,onClick:()=>l(!o),onMouseEnter:g=>Object.assign(g.currentTarget.style,gt.buttonHover),onMouseLeave:g=>{g.currentTarget.style.borderColor="#334155",g.currentTarget.style.backgroundColor="#1e293b"},children:[w.jsx("span",{children:r?"Loading...":e||"Select Coin"}),w.jsx("span",{style:{...gt.arrow,...o?gt.arrowOpen:{}},children:"▼"})]}),o&&w.jsxs("div",{style:gt.dropdown,children:[w.jsx("div",{style:gt.searchContainer,children:w.jsx("input",{ref:b,style:gt.searchInput,type:"text",placeholder:"Search symbol...",value:h,onChange:g=>a(g.target.value)})}),w.jsx("div",{style:gt.list,children:p.length===0?w.jsx("div",{style:gt.empty,children:"No symbols found"}):w.jsxs(w.Fragment,{children:[f.length>0&&w.jsxs(w.Fragment,{children:[w.jsx("div",{style:gt.categoryLabel,children:"Forex & Metals"}),f.map(g=>w.jsxs("div",{style:{...gt.item,...g.symbol===e?gt.itemSelected:{}},onClick:()=>S(g.symbol),onMouseEnter:x=>{g.symbol!==e&&(x.currentTarget.style.backgroundColor="#334155")},onMouseLeave:x=>{g.symbol!==e&&(x.currentTarget.style.backgroundColor="transparent")},children:[w.jsx("span",{style:gt.symbolName,children:g.symbol}),g.bid&&w.jsx("span",{style:{...gt.symbolPrice,...parseFloat(g.change)>=0?gt.priceUp:gt.priceDown},children:parseFloat(g.bid).toFixed(5)})]},g.symbol))]}),m.length>0&&w.jsxs(w.Fragment,{children:[w.jsx("div",{style:gt.categoryLabel,children:"Crypto"}),m.map(g=>w.jsxs("div",{style:{...gt.item,...g.symbol===e?gt.itemSelected:{}},onClick:()=>S(g.symbol),onMouseEnter:x=>{g.symbol!==e&&(x.currentTarget.style.backgroundColor="#334155")},onMouseLeave:x=>{g.symbol!==e&&(x.currentTarget.style.backgroundColor="transparent")},children:[w.jsx("span",{style:gt.symbolName,children:g.symbol}),g.bid&&w.jsx("span",{style:{...gt.symbolPrice,...parseFloat(g.change)>=0?gt.priceUp:gt.priceDown},children:parseFloat(g.bid).toFixed(2)})]},g.symbol))]})]})})]})]})}const ce={container:{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"14px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",padding:0,lineHeight:1,userSelect:"none"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},input:{width:"70px",padding:"4px 6px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"center",outline:"none",boxSizing:"border-box"},presets:{display:"inline-flex",gap:"2px",marginLeft:"4px"},preset:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},presetActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}},cf=[.01,.05,.1,.5,1];function jo({value:s,onChange:t,min:e=.01,max:i=100,step:n=.01,presets:r=cf,showPresets:o=!0,showLabel:l=!0,label:h="Vol",style:a,className:c}){const[u,d]=C.useState(.1),b=s!==void 0?s:u,p=C.useCallback(g=>{const x=Math.max(e,Math.min(i,parseFloat(g)||e)),M=Math.round(x/n)*n,P=parseFloat(M.toFixed(8));s!==void 0||d(P),t?.(P)},[e,i,n,s,t]),f=()=>p(b+n),m=()=>p(b-n),S=(b>=1,b.toFixed(2));return w.jsxs("div",{style:{...ce.container,...a},className:c,children:[l&&w.jsx("span",{style:ce.label,children:h}),w.jsx("button",{style:ce.btn,onClick:m,onMouseEnter:g=>Object.assign(g.currentTarget.style,ce.btnHover),onMouseLeave:g=>{g.currentTarget.style.borderColor="#334155",g.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),w.jsx("input",{style:ce.input,type:"text",value:S,onChange:g=>{const x=g.target.value;if(x===""||x==="."||x==="0.")return;const M=parseFloat(x);isNaN(M)||p(M)},onBlur:()=>p(b)}),w.jsx("button",{style:ce.btn,onClick:f,onMouseEnter:g=>Object.assign(g.currentTarget.style,ce.btnHover),onMouseLeave:g=>{g.currentTarget.style.borderColor="#334155",g.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),o&&r&&r.length>0&&w.jsx("div",{style:ce.presets,children:r.map(g=>w.jsx("button",{style:{...ce.preset,...Math.abs(b-g)<1e-4?ce.presetActive:{}},onClick:()=>p(g),onMouseEnter:x=>{Math.abs(b-g)>=1e-4&&Object.assign(x.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:x=>{Math.abs(b-g)>=1e-4&&(x.currentTarget.style.borderColor="#334155")},children:g},g))})]})}const Ht={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#EF5350",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#EF5350"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#3b1515",borderColor:"#EF5350",color:"#EF5350"}};function Ko({value:s,onChange:t,enabled:e,onEnabledChange:i,mode:n,onModeChange:r,showToggle:o=!0,showModeSwitch:l=!0,showLabel:h=!0,label:a="SL",style:c,className:u}){const{currentSymbolData:d}=le(),[b,p]=C.useState(""),[f,m]=C.useState(!1),[S,g]=C.useState("price"),x=s!==void 0?s:b,M=e!==void 0?e:f,P=n!==void 0?n:S,K=C.useCallback($=>{e!==void 0||m($),i?.($)},[e,i]),D=C.useCallback($=>{n!==void 0||g($),r?.($)},[n,r]),G=C.useCallback($=>{s!==void 0||p($),t?.($)},[s,t]),Z=$=>{const ct=$.target.value;if(ct===""||ct==="."||ct==="0."){G(ct);return}const Nt=parseFloat(ct);isNaN(Nt)||G(ct)},Et=P==="price"?d?.bid?parseFloat(d.bid).toFixed(5):"0.00000":"50";return w.jsxs("div",{style:{...Ht.container,...c},className:u,children:[h&&w.jsx("span",{style:Ht.label,children:a}),o&&w.jsx("button",{style:{...Ht.toggle,...M?Ht.toggleOn:Ht.toggleOff},onClick:()=>K(!M),children:w.jsx("div",{style:{...Ht.toggleKnob,...M?Ht.knobOn:Ht.knobOff}})}),(M||!o)&&w.jsxs("div",{style:Ht.inputGroup,children:[w.jsx("input",{style:Ht.input,type:"text",value:x,onChange:Z,placeholder:Et,onFocus:$=>$.currentTarget.style.borderColor="#EF5350",onBlur:$=>$.currentTarget.style.borderColor="#334155"}),l&&w.jsxs(w.Fragment,{children:[w.jsx("button",{style:{...Ht.modeBtn,...P==="price"?Ht.modeBtnActive:{}},onClick:()=>D("price"),children:"Price"}),w.jsx("button",{style:{...Ht.modeBtn,...P==="pips"?Ht.modeBtnActive:{}},onClick:()=>D("pips"),children:"Pips"})]})]})]})}const qt={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function Xo({value:s,onChange:t,enabled:e,onEnabledChange:i,mode:n,onModeChange:r,showToggle:o=!0,showModeSwitch:l=!0,showLabel:h=!0,label:a="TP",style:c,className:u}){const{currentSymbolData:d}=le(),[b,p]=C.useState(""),[f,m]=C.useState(!1),[S,g]=C.useState("price"),x=s!==void 0?s:b,M=e!==void 0?e:f,P=n!==void 0?n:S,K=C.useCallback($=>{e!==void 0||m($),i?.($)},[e,i]),D=C.useCallback($=>{n!==void 0||g($),r?.($)},[n,r]),G=C.useCallback($=>{s!==void 0||p($),t?.($)},[s,t]),Z=$=>{const ct=$.target.value;if(ct===""||ct==="."||ct==="0."){G(ct);return}const Nt=parseFloat(ct);isNaN(Nt)||G(ct)},Et=P==="price"?d?.ask?parseFloat(d.ask).toFixed(5):"0.00000":"50";return w.jsxs("div",{style:{...qt.container,...c},className:u,children:[h&&w.jsx("span",{style:qt.label,children:a}),o&&w.jsx("button",{style:{...qt.toggle,...M?qt.toggleOn:qt.toggleOff},onClick:()=>K(!M),children:w.jsx("div",{style:{...qt.toggleKnob,...M?qt.knobOn:qt.knobOff}})}),(M||!o)&&w.jsxs("div",{style:qt.inputGroup,children:[w.jsx("input",{style:qt.input,type:"text",value:x,onChange:Z,placeholder:Et,onFocus:$=>$.currentTarget.style.borderColor="#26A69A",onBlur:$=>$.currentTarget.style.borderColor="#334155"}),l&&w.jsxs(w.Fragment,{children:[w.jsx("button",{style:{...qt.modeBtn,...P==="price"?qt.modeBtnActive:{}},onClick:()=>D("price"),children:"Price"}),w.jsx("button",{style:{...qt.modeBtn,...P==="pips"?qt.modeBtnActive:{}},onClick:()=>D("pips"),children:"Pips"})]})]})]})}const uf=[{id:1,name:"Crosshair",icon:"+"},{id:2,name:"Trend Line",icon:"╱"},{id:3,name:"Parallel Channel",icon:"═"},{id:4,name:"Fibonacci",icon:"≡"},{id:5,name:"Rectangle",icon:"▭"},{id:6,name:"Price Level",icon:"─"}],ue={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"14px",cursor:"pointer",transition:"all 0.15s ease",padding:0,position:"relative"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},tooltip:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"11px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},divider:{width:"1px",height:"20px",backgroundColor:"#334155",margin:"0 4px"},deleteBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0},deleteBtnHover:{borderColor:"#EF5350",backgroundColor:"#3b1515",color:"#EF5350"},visibilityBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0}};function Jo({showLabel:s=!0,showDelete:t=!0,showVisibility:e=!0,tools:i,label:n="Draw",style:r,className:o}){const{activeTool:l,setActiveTool:h,drawingsVisible:a,setDrawingsVisible:c,chartObjects:u,setChartObjects:d}=le(),[b,p]=C.useState(null),f=i||uf,m=x=>{h(l===x?null:x)},S=()=>{d([]),h(null)},g=()=>{c(!a)};return w.jsxs("div",{style:{...ue.container,...r},className:o,children:[s&&w.jsx("span",{style:ue.label,children:n}),f.map(x=>w.jsxs("button",{style:{...ue.btn,...l===x.id?ue.btnActive:{}},onClick:()=>m(x.id),onMouseEnter:M=>{p(x.id),l!==x.id&&Object.assign(M.currentTarget.style,ue.btnHover)},onMouseLeave:M=>{p(null),l!==x.id&&(M.currentTarget.style.borderColor="#334155",M.currentTarget.style.backgroundColor="#1e293b",M.currentTarget.style.color="#94a3b8")},title:x.name,children:[x.icon,b===x.id&&w.jsx("div",{style:ue.tooltip,children:x.name})]},x.id)),(t||e)&&w.jsx("div",{style:ue.divider}),e&&w.jsx("button",{style:{...ue.visibilityBtn,...a?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:g,onMouseEnter:x=>{x.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:x=>{x.currentTarget.style.borderColor="#334155"},title:a?"Hide Drawings":"Show Drawings",children:a?"👁":"○"}),t&&w.jsx("button",{style:ue.deleteBtn,onClick:S,onMouseEnter:x=>Object.assign(x.currentTarget.style,ue.deleteBtnHover),onMouseLeave:x=>{x.currentTarget.style.borderColor="#334155",x.currentTarget.style.backgroundColor="#1e293b",x.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Go={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function ff({showCoinSelector:s=!0,showVolumeControl:t=!0,showStopLoss:e=!0,showTakeProfit:i=!0,showDrawingTools:n=!0,showDividers:r=!0,volume:o,onVolumeChange:l,stopLoss:h,onStopLossChange:a,stopLossEnabled:c,onStopLossEnabledChange:u,takeProfit:d,onTakeProfitChange:b,takeProfitEnabled:p,onTakeProfitEnabledChange:f,coinSelectorProps:m={},volumeControlProps:S={},stopLossProps:g={},takeProfitProps:x={},drawingToolsProps:M={},style:P,className:K}){const D=[];s&&D.push(w.jsx(qo,{...m},"coin")),t&&D.push(w.jsx(jo,{value:o,onChange:l,...S},"volume")),e&&D.push(w.jsx(Ko,{value:h,onChange:a,enabled:c,onEnabledChange:u,...g},"sl")),i&&D.push(w.jsx(Xo,{value:d,onChange:b,enabled:p,onEnabledChange:f,...x},"tp")),n&&D.push(w.jsx(Jo,{...M},"draw"));const G=[];return D.forEach((Z,Et)=>{G.push(Z),r&&Et<D.length-1&&G.push(w.jsx("div",{style:Go.divider},`div-${Et}`))}),w.jsx("div",{style:{...Go.toolbar,...P},className:K,children:G})}const df=[{label:"M1",value:"M1"},{label:"M5",value:"M5"},{label:"M15",value:"M15"},{label:"M30",value:"M30"},{label:"H1",value:"H1"},{label:"H4",value:"H4"},{label:"D1",value:"D1"},{label:"W1",value:"W1"}],ln={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function pf({style:s,className:t}){const{selectedTimeframe:e,setSelectedTimeframe:i}=le();return w.jsx("div",{style:{...ln.container,...s},className:t,children:df.map(n=>w.jsx("button",{style:{...ln.btn,...e===n.value?ln.btnActive:{}},onClick:()=>i(n.value),onMouseEnter:r=>{e!==n.value&&(r.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:r=>{e!==n.value&&(r.currentTarget.style.borderColor="#334155")},children:n.label},n.value))})}const mf=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],hn={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function bf({style:s,className:t}){const{chartType:e,setChartType:i}=le();return w.jsx("div",{style:{...hn.container,...s},className:t,children:mf.map(n=>w.jsxs("button",{style:{...hn.btn,...e===n.value?hn.btnActive:{}},onClick:()=>i(n.value),onMouseEnter:r=>{e!==n.value&&(r.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:r=>{e!==n.value&&(r.currentTarget.style.borderColor="#334155")},title:n.label,children:[w.jsx("span",{children:n.icon}),w.jsx("span",{children:n.label})]},n.value))})}const $t={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function gf({volume:s=.1,stopLoss:t,takeProfit:e,onTradeExecuted:i,style:n,className:r}){const{selectedSymbol:o,currentSymbolData:l,setOrders:h,setUserBalance:a}=le(),[c,u]=C.useState(null),d=parseFloat(l?.bid||0),b=parseFloat(l?.ask||0),p=b>0&&d>0?Math.abs(b-d):0,f=g=>!g||g===0?"-.-----":g>=1e3?g.toFixed(2):g>=1?g.toFixed(4):g.toFixed(5),m=g=>g===0?"-":g>=1?g.toFixed(1):g>=.01?g.toFixed(3):(g*1e4).toFixed(1)+"p",S=C.useCallback(g=>{if(!o)return;const x=g==="BUY"?b:d;if(!x||x<=0){u({type:"error",message:"No price available"});return}const M={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:o,type:g,volume:s,price:x,stopLoss:t?parseFloat(t):null,takeProfit:e?parseFloat(e):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};h(K=>[...K,M]);const P=s*x*.01;a(K=>K-P),u({type:"success",message:`${g} executed`}),i?.(M),setTimeout(()=>u(null),3e3)},[o,b,d,s,t,e,h,a,i]);return w.jsxs("div",{style:{...$t.container,...n},className:r,children:[w.jsx("button",{style:$t.sellBtn,onClick:()=>S("SELL"),onMouseEnter:g=>{Object.assign(g.currentTarget.style,$t.sellBtnHover)},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="#7f1d1d",g.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),w.jsxs("div",{style:$t.priceBox,children:[w.jsx("span",{style:$t.priceLabel,children:"Bid"}),w.jsx("span",{style:{...$t.priceValue,color:"#EF5350"},children:f(d)})]}),w.jsxs("div",{style:$t.spread,children:[w.jsx("span",{style:$t.spreadLabel,children:"Spread"}),w.jsx("span",{style:$t.spreadValue,children:m(p)})]}),w.jsxs("div",{style:$t.priceBox,children:[w.jsx("span",{style:$t.priceLabel,children:"Ask"}),w.jsx("span",{style:{...$t.priceValue,color:"#26A69A"},children:f(b)})]}),w.jsx("button",{style:$t.buyBtn,onClick:()=>S("BUY"),onMouseEnter:g=>{Object.assign(g.currentTarget.style,$t.buyBtnHover)},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="#14532d",g.currentTarget.style.borderColor="#166534"},children:"Buy"}),c&&w.jsx("span",{style:{...$t.status,backgroundColor:c.type==="success"?"#14532d":"#7f1d1d",color:c.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${c.type==="success"?"#166534":"#991b1b"}`},children:c.message})]})}const Q={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function vf({style:s,className:t,maxHeight:e=200}){const{orders:i,setOrders:n,symbols:r,accountSummary:o,setUserBalance:l}=le(),[h,a]=C.useState(null),c=i.filter(f=>f.status==="OPEN"||!f.closeAt),u=C.useCallback((f,m)=>{const S=r.find(g=>g.symbol===f);return S?parseFloat(m==="BUY"?S.bid||0:S.ask||0):0},[r]),d=C.useCallback(f=>{if(h)return;a(f.id);const m=u(f.symbol,f.type),g=(f.type==="BUY"?m-f.price:f.price-m)*f.volume,x=f.volume*f.price*.01;n(M=>M.filter(P=>P.id!==f.id)),l(M=>M+x+g),a(null)},[h,u,n,l]),b=f=>{const m=parseFloat(f);return!m||isNaN(m)?"-":m>=1e3?m.toFixed(2):m>=1?m.toFixed(4):m.toFixed(5)},p=f=>{const m=parseFloat(f);return isNaN(m)?"-":(m>=0?"+":"")+m.toFixed(2)};return w.jsxs("div",{style:{...Q.container,...s},className:t,children:[w.jsxs("div",{style:Q.header,children:[w.jsxs("span",{style:Q.headerTitle,children:["Positions (",c.length,")"]}),w.jsxs("div",{style:Q.summary,children:[w.jsxs("div",{style:Q.summaryItem,children:[w.jsx("span",{style:Q.summaryLabel,children:"Balance:"}),w.jsxs("span",{style:{...Q.summaryValue,color:"#e2e8f0"},children:["$",o?.balance?.toFixed(2)||"0.00"]})]}),w.jsxs("div",{style:Q.summaryItem,children:[w.jsx("span",{style:Q.summaryLabel,children:"Equity:"}),w.jsxs("span",{style:{...Q.summaryValue,color:(o?.equity||0)>=(o?.balance||0)?"#26A69A":"#EF5350"},children:["$",o?.equity?.toFixed(2)||"0.00"]})]}),w.jsxs("div",{style:Q.summaryItem,children:[w.jsx("span",{style:Q.summaryLabel,children:"Free:"}),w.jsxs("span",{style:{...Q.summaryValue,color:"#94a3b8"},children:["$",o?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),w.jsx("div",{style:{...Q.scrollArea,maxHeight:e},children:w.jsxs("table",{style:Q.table,children:[w.jsx("thead",{children:w.jsxs("tr",{children:[w.jsx("th",{style:Q.th,children:"Symbol"}),w.jsx("th",{style:Q.th,children:"Type"}),w.jsx("th",{style:Q.th,children:"Volume"}),w.jsx("th",{style:Q.th,children:"Open Price"}),w.jsx("th",{style:Q.th,children:"Current"}),w.jsx("th",{style:Q.th,children:"SL"}),w.jsx("th",{style:Q.th,children:"TP"}),w.jsx("th",{style:Q.th,children:"Profit"}),w.jsx("th",{style:Q.th,children:"Action"})]})}),w.jsx("tbody",{children:c.length===0?w.jsx("tr",{children:w.jsx("td",{colSpan:9,style:Q.emptyRow,children:"No open positions"})}):c.map(f=>{const m=u(f.symbol,f.type),S=f.profit||0;return w.jsxs("tr",{children:[w.jsx("td",{style:{...Q.td,fontWeight:700,color:"#e2e8f0"},children:f.symbol}),w.jsx("td",{style:{...Q.td,...f.type==="BUY"?Q.typeBuy:Q.typeSell},children:f.type}),w.jsx("td",{style:Q.td,children:f.volume}),w.jsx("td",{style:Q.td,children:b(f.price)}),w.jsx("td",{style:Q.td,children:b(m)}),w.jsx("td",{style:Q.td,children:f.stopLoss?b(f.stopLoss):"-"}),w.jsx("td",{style:Q.td,children:f.takeProfit?b(f.takeProfit):"-"}),w.jsx("td",{style:{...Q.td,color:S>=0?"#26A69A":"#EF5350",fontWeight:700},children:p(S)}),w.jsx("td",{style:Q.td,children:w.jsx("button",{style:{...Q.closeBtn,...h===f.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>d(f),disabled:h===f.id,onMouseEnter:g=>{h!==f.id&&(g.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="#7f1d1d"},children:h===f.id?"...":"Close"})})]},f.id)})})]})})]})}const yf="1.2.1";Y.Chart=af,Y.ChartTypeSelector=bf,Y.CoinSelector=qo,Y.DrawingTools=Jo,Y.PositionsPanel=vf,Y.SYMBOL_CONFIG=Ao,Y.StopLoss=Ko,Y.TakeProfit=Xo,Y.TimeframeSelector=pf,Y.TradePanel=gf,Y.TradingProvider=Gu,Y.TradingToolbar=ff,Y.VolumeControl=jo,Y.alignToTimeframe=Fe,Y.detectGaps=Yu,Y.getSymbolConfig=oi,Y.is24x7Symbol=sf,Y.isCryptoSymbol=ef,Y.isForexSymbol=tf,Y.isWithinTradingSession=Qu,Y.normalizeCandleTimes=Ro,Y.normalizeTime=Lt,Y.processCandles=$o,Y.processSingleCandle=Io,Y.setChartBaseUrl=Wo,Y.setSocketBaseUrl=Po,Y.timeframeToSeconds=rn,Y.useTrading=le,Y.validateTimeOrdering=Zu,Y.version=yf,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(dA,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],h):(dA=typeof globalThis<"u"?globalThis:dA||self,h(dA.ChartSDK={},dA.jsxRuntime,dA.React))})(this,(function(dA,h,b){"use strict";var bi=typeof document<"u"?document.currentScript:null;function IA(r){var A=r.width,e=r.height;if(A<0)throw new Error("Negative width is not allowed for Size");if(e<0)throw new Error("Negative height is not allowed for Size");return{width:A,height:e}}function ft(r,A){return r.width===A.width&&r.height===A.height}var Hu=(function(){function r(A){var e=this;this._resolutionListener=function(){return e._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=A,this._installResolutionListener()}return r.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(r.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),r.prototype.subscribe=function(A){var e=this,t={next:A};return this._observers.push(t),{unsubscribe:function(){e._observers=e._observers.filter(function(s){return s!==t})}}},r.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var A=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(A,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},r.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},r.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},r.prototype._onResolutionChanged=function(){var A=this;this._observers.forEach(function(e){return e.next(A._window.devicePixelRatio)}),this._reinstallResolutionListener()},r})();function Lu(r){return new Hu(r)}var Iu=(function(){function r(A,e,t){var s;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=A,this._canvasElementClientSize=IA({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=e??(function(i){return i}),this._allowResizeObserver=(s=t?.allowResizeObserver)!==null&&s!==void 0?s:!0,this._chooseAndInitObserver()}return r.prototype.dispose=function(){var A,e;if(this._canvasElement===null)throw new Error("Object is disposed");(A=this._canvasElementResizeObserver)===null||A===void 0||A.disconnect(),this._canvasElementResizeObserver=null,(e=this._devicePixelRatioObservable)===null||e===void 0||e.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(r.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bitmapSize",{get:function(){return IA({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),r.prototype.resizeCanvasElement=function(A){this._canvasElementClientSize=IA(A),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},r.prototype.subscribeBitmapSizeChanged=function(A){this._bitmapSizeChangedListeners.push(A)},r.prototype.unsubscribeBitmapSizeChanged=function(A){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(e){return e!==A})},Object.defineProperty(r.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),r.prototype.subscribeSuggestedBitmapSizeChanged=function(A){this._suggestedBitmapSizeChangedListeners.push(A)},r.prototype.unsubscribeSuggestedBitmapSizeChanged=function(A){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(e){return e!==A})},r.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var A=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(A),this._emitSuggestedBitmapSizeChanged(A,this._suggestedBitmapSize)}},r.prototype._resizeBitmap=function(A){var e=this.bitmapSize;ft(e,A)||(this.canvasElement.width=A.width,this.canvasElement.height=A.height,this._emitBitmapSizeChanged(e,A))},r.prototype._emitBitmapSizeChanged=function(A,e){var t=this;this._bitmapSizeChangedListeners.forEach(function(s){return s.call(t,A,e)})},r.prototype._suggestNewBitmapSize=function(A){var e=this._suggestedBitmapSize,t=IA(this._transformBitmapSize(A,this._canvasElementClientSize)),s=ft(this.bitmapSize,t)?null:t;e===null&&s===null||e!==null&&s!==null&&ft(e,s)||(this._suggestedBitmapSize=s,this._emitSuggestedBitmapSizeChanged(e,s))},r.prototype._emitSuggestedBitmapSizeChanged=function(A,e){var t=this;this._suggestedBitmapSizeChangedListeners.forEach(function(s){return s.call(t,A,e)})},r.prototype._chooseAndInitObserver=function(){var A=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}Mu().then(function(e){return e?A._initResizeObserver():A._initDevicePixelRatioObservable()})},r.prototype._initDevicePixelRatioObservable=function(){var A=this;if(this._canvasElement!==null){var e=No(this._canvasElement);if(e===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Lu(e),this._devicePixelRatioObservable.subscribe(function(){return A._invalidateBitmapSize()}),this._invalidateBitmapSize()}},r.prototype._invalidateBitmapSize=function(){var A,e;if(this._canvasElement!==null){var t=No(this._canvasElement);if(t!==null){var s=(e=(A=this._devicePixelRatioObservable)===null||A===void 0?void 0:A.value)!==null&&e!==void 0?e:t.devicePixelRatio,i=this._canvasElement.getClientRects(),n=i[0]!==void 0?Du(i[0],s):IA({width:this._canvasElementClientSize.width*s,height:this._canvasElementClientSize.height*s});this._suggestNewBitmapSize(n)}}},r.prototype._initResizeObserver=function(){var A=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(e){var t=e.find(function(n){return n.target===A._canvasElement});if(!(!t||!t.devicePixelContentBoxSize||!t.devicePixelContentBoxSize[0])){var s=t.devicePixelContentBoxSize[0],i=IA({width:s.inlineSize,height:s.blockSize});A._suggestNewBitmapSize(i)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},r})();function Tu(r,A){return new Iu(r,A.transform,A.options)}function No(r){return r.ownerDocument.defaultView}function Mu(){return new Promise(function(r){var A=new ResizeObserver(function(e){r(e.every(function(t){return"devicePixelContentBoxSize"in t})),A.disconnect()});A.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function Du(r,A){return IA({width:Math.round(r.left*A+r.width*A)-Math.round(r.left*A),height:Math.round(r.top*A+r.height*A)-Math.round(r.top*A)})}var Ou=(function(){function r(A,e,t){if(e.width===0||e.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=e,t.width===0||t.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=t,this._context=A}return r.prototype.useMediaCoordinateSpace=function(A){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),A({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},r.prototype.useBitmapCoordinateSpace=function(A){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),A({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(r.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),r})();function dt(r,A){var e=r.canvasElementClientSize;if(e.width===0||e.height===0)return null;var t=r.bitmapSize;if(t.width===0||t.height===0)return null;var s=r.canvasElement.getContext("2d",A);return s===null?null:new Ou(s,e,t)}const ku={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},_u={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Nu={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Ku={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},Vu={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},Pu={color:"#26a69a",base:0},Ko={color:"#2196f3"},Vo={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 Po,Go;function Bt(r,A){const e={0:[],1:[r.lineWidth,r.lineWidth],2:[2*r.lineWidth,2*r.lineWidth],3:[6*r.lineWidth,6*r.lineWidth],4:[r.lineWidth,4*r.lineWidth]}[A];r.setLineDash(e)}function Ro(r,A,e,t){r.beginPath();const s=r.lineWidth%2?.5:0;r.moveTo(e,A+s),r.lineTo(t,A+s),r.stroke()}function At(r,A){if(!r)throw new Error("Assertion failed"+(A?": "+A:""))}function ie(r){if(r===void 0)throw new Error("Value is undefined");return r}function H(r){if(r===null)throw new Error("Value is null");return r}function xt(r){return H(ie(r))}(function(r){r[r.Simple=0]="Simple",r[r.WithSteps=1]="WithSteps",r[r.Curved=2]="Curved"})(Po||(Po={})),(function(r){r[r.Solid=0]="Solid",r[r.Dotted=1]="Dotted",r[r.Dashed=2]="Dashed",r[r.LargeDashed=3]="LargeDashed",r[r.SparseDotted=4]="SparseDotted"})(Go||(Go={}));const Wo={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 me(r){return r<0?0:r>255?255:Math.round(r)||0}function zo(r){return r<=0||r>0?r<0?0:r>1?1:Math.round(1e4*r)/1e4:0}const Gu=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Ru=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Wu=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,zu=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?[\d]{0,10}(?:\.\d+)?)\s*\)$/;function Kr(r){(r=r.toLowerCase())in Wo&&(r=Wo[r]);{const A=zu.exec(r)||Wu.exec(r);if(A)return[me(parseInt(A[1],10)),me(parseInt(A[2],10)),me(parseInt(A[3],10)),zo(A.length<5?1:parseFloat(A[4]))]}{const A=Ru.exec(r);if(A)return[me(parseInt(A[1],16)),me(parseInt(A[2],16)),me(parseInt(A[3],16)),1]}{const A=Gu.exec(r);if(A)return[me(17*parseInt(A[1],16)),me(17*parseInt(A[2],16)),me(17*parseInt(A[3],16)),1]}throw new Error(`Cannot parse color: ${r}`)}function Vr(r){const A=Kr(r);return{t:`rgb(${A[0]}, ${A[1]}, ${A[2]})`,i:(e=A,.199*e[0]+.687*e[1]+.114*e[2]>160?"black":"white")};var e}class KA{constructor(){this.h=[]}l(A,e,t){const s={o:A,_:e,u:t===!0};this.h.push(s)}v(A){const e=this.h.findIndex((t=>A===t.o));e>-1&&this.h.splice(e,1)}p(A){this.h=this.h.filter((e=>e._!==A))}m(A,e,t){const s=[...this.h];this.h=this.h.filter((i=>!i.u)),s.forEach((i=>i.o(A,e,t)))}M(){return this.h.length>0}S(){this.h=[]}}function Ue(r,...A){for(const e of A)for(const t in e)e[t]!==void 0&&(typeof e[t]!="object"||r[t]===void 0||Array.isArray(e[t])?r[t]=e[t]:Ue(r[t],e[t]));return r}function Le(r){return typeof r=="number"&&isFinite(r)}function Yt(r){return typeof r=="number"&&r%1==0}function qt(r){return typeof r=="string"}function Pr(r){return typeof r=="boolean"}function ze(r){const A=r;if(!A||typeof A!="object")return A;let e,t,s;for(t in e=Array.isArray(A)?[]:{},A)A.hasOwnProperty(t)&&(s=A[t],e[t]=s&&typeof s=="object"?ze(s):s);return e}function Xu(r){return r!==null}function $t(r){return r===null?void 0:r}const Qi="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function St(r,A,e){return A===void 0&&(A=Qi),`${e=e!==void 0?`${e} `:""}${r}px ${A}`}let Ju=class{constructor(A){this.k={C:1,T:5,P:NaN,R:"",D:"",O:"",A:"",V:0,B:0,I:0,L:0,N:0},this.F=A}W(){const A=this.k,e=this.j(),t=this.H();return A.P===e&&A.D===t||(A.P=e,A.D=t,A.R=St(e,t),A.L=2.5/12*e,A.V=A.L,A.B=e/12*A.T,A.I=e/12*A.T,A.N=0),A.O=this.$(),A.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 Fi{constructor(){this.Y=[]}X(A){this.Y=A}K(A,e,t){this.Y.forEach((s=>{s.K(A,e,t)}))}}class yi{K(A,e,t){A.useMediaCoordinateSpace((s=>this.Z(s,e,t)))}G(A,e,t){A.useMediaCoordinateSpace((s=>this.J(s,e,t)))}J(A,e,t){}}class Zu extends yi{constructor(){super(...arguments),this.tt=null}it(A){this.tt=A}Z({context:A}){if(this.tt===null||this.tt.nt===null)return;const e=this.tt.nt,t=this.tt,s=i=>{A.beginPath();for(let n=e.to-1;n>=e.from;--n){const o=t.st[n];A.moveTo(o.et,o.rt),A.arc(o.et,o.rt,i,0,2*Math.PI)}A.fill()};t.ht>0&&(A.fillStyle=t.lt,s(t.ot+t.ht)),A.fillStyle=t._t,s(t.ot)}}function Yu(){return{st:[{et:0,rt:0,ut:0,ct:0}],_t:"",lt:"",ot:0,ht:0,nt:null}}const qu={from:0,to:1};class $u{constructor(A,e){this.dt=new Fi,this.ft=[],this.vt=[],this.bt=!0,this.F=A,this.wt=e,this.dt.X(this.ft)}gt(A){const e=this.F.Mt();e.length!==this.ft.length&&(this.vt=e.map(Yu),this.ft=this.vt.map((t=>{const s=new Zu;return s.it(t),s})),this.dt.X(this.ft)),this.bt=!0}xt(){return this.bt&&(this.St(),this.bt=!1),this.dt}St(){const A=this.wt.W().mode===2,e=this.F.Mt(),t=this.wt.kt(),s=this.F.yt();e.forEach(((i,n)=>{var o;const a=this.vt[n],l=i.Ct(t);if(A||l===null||!i.Tt())return void(a.nt=null);const c=H(i.Pt());a._t=l.Rt,a.ot=l.ot,a.ht=l.Dt,a.st[0].ct=l.ct,a.st[0].rt=i.At().Ot(l.ct,c.Vt),a.lt=(o=l.Bt)!==null&&o!==void 0?o:this.F.It(a.st[0].rt/i.At().zt()),a.st[0].ut=t,a.st[0].et=s.Et(t),a.nt=qu}))}}class Xe{K(A,e,t){A.useBitmapCoordinateSpace((s=>this.Z(s,e,t)))}}class ju extends Xe{constructor(A){super(),this.Lt=A}Z({context:A,bitmapSize:e,horizontalPixelRatio:t,verticalPixelRatio:s}){if(this.Lt===null)return;const i=this.Lt.Nt.Tt,n=this.Lt.Ft.Tt;if(!i&&!n)return;const o=Math.round(this.Lt.et*t),a=Math.round(this.Lt.rt*s);A.lineCap="butt",i&&o>=0&&(A.lineWidth=Math.floor(this.Lt.Nt.ht*t),A.strokeStyle=this.Lt.Nt.O,A.fillStyle=this.Lt.Nt.O,Bt(A,this.Lt.Nt.Wt),(function(l,c,u,d){l.beginPath();const g=l.lineWidth%2?.5:0;l.moveTo(c+g,u),l.lineTo(c+g,d),l.stroke()})(A,o,0,e.height)),n&&a>=0&&(A.lineWidth=Math.floor(this.Lt.Ft.ht*s),A.strokeStyle=this.Lt.Ft.O,A.fillStyle=this.Lt.Ft.O,Bt(A,this.Lt.Ft.Wt),Ro(A,a,0,e.width))}}class Af{constructor(A){this.bt=!0,this.jt={Nt:{ht:1,Wt:0,O:"",Tt:!1},Ft:{ht:1,Wt:0,O:"",Tt:!1},et:0,rt:0},this.Ht=new ju(this.jt),this.$t=A}gt(){this.bt=!0}xt(){return this.bt&&(this.St(),this.bt=!1),this.Ht}St(){const A=this.$t.Tt(),e=H(this.$t.Ut()),t=e.qt().W().crosshair,s=this.jt;if(t.mode===2)return s.Ft.Tt=!1,void(s.Nt.Tt=!1);s.Ft.Tt=A&&this.$t.Yt(e),s.Nt.Tt=A&&this.$t.Xt(),s.Ft.ht=t.horzLine.width,s.Ft.Wt=t.horzLine.style,s.Ft.O=t.horzLine.color,s.Nt.ht=t.vertLine.width,s.Nt.Wt=t.vertLine.style,s.Nt.O=t.vertLine.color,s.et=this.$t.Kt(),s.rt=this.$t.Zt()}}function ef(r,A,e,t,s,i){r.fillRect(A+i,e,t-2*i,i),r.fillRect(A+i,e+s-i,t-2*i,i),r.fillRect(A,e,i,s),r.fillRect(A+t-i,e,i,s)}function Gr(r,A,e,t,s,i){r.save(),r.globalCompositeOperation="copy",r.fillStyle=i,r.fillRect(A,e,t,s),r.restore()}function Xo(r,A){return r.map((e=>e===0?e:e+A))}function Ui(r,A,e,t,s,i){r.beginPath(),r.lineTo(A+t-i[1],e),i[1]!==0&&r.arcTo(A+t,e,A+t,e+i[1],i[1]),r.lineTo(A+t,e+s-i[2]),i[2]!==0&&r.arcTo(A+t,e+s,A+t-i[2],e+s,i[2]),r.lineTo(A+i[3],e+s),i[3]!==0&&r.arcTo(A,e+s,A,e+s-i[3],i[3]),r.lineTo(A,e+i[0]),i[0]!==0&&r.arcTo(A,e,A+i[0],e,i[0])}function Jo(r,A,e,t,s,i,n=0,o=[0,0,0,0],a=""){if(r.save(),!n||!a||a===i)return Ui(r,A,e,t,s,o),r.fillStyle=i,r.fill(),void r.restore();const l=n/2;i!=="transparent"&&(Ui(r,A+n,e+n,t-2*n,s-2*n,Xo(o,-n)),r.fillStyle=i,r.fill()),a!=="transparent"&&(Ui(r,A+l,e+l,t-n,s-n,Xo(o,-l)),r.lineWidth=n,r.strokeStyle=a,r.closePath(),r.stroke()),r.restore()}function Zo(r,A,e,t,s,i,n){r.save(),r.globalCompositeOperation="copy";const o=r.createLinearGradient(0,0,0,s);o.addColorStop(0,i),o.addColorStop(1,n),r.fillStyle=o,r.fillRect(A,e,t,s),r.restore()}class Yo{constructor(A,e){this.it(A,e)}it(A,e){this.Lt=A,this.Gt=e}zt(A,e){return this.Lt.Tt?A.P+A.L+A.V:0}K(A,e,t,s){if(!this.Lt.Tt||this.Lt.Jt.length===0)return;const i=this.Lt.O,n=this.Gt.t,o=A.useBitmapCoordinateSpace((a=>{const l=a.context;l.font=e.R;const c=this.Qt(a,e,t,s),u=c.ti,d=(g,B)=>{c.ii?Jo(l,u.ni,u.si,u.ei,u.ri,g,u.hi,[u.ot,0,0,u.ot],B):Jo(l,u.li,u.si,u.ei,u.ri,g,u.hi,[0,u.ot,u.ot,0],B)};return d(n,"transparent"),this.Lt.ai&&(l.fillStyle=i,l.fillRect(u.li,u.oi,u._i-u.li,u.ui)),d("transparent",n),this.Lt.ci&&(l.fillStyle=e.A,l.fillRect(c.ii?u.di-u.hi:0,u.si,u.hi,u.fi-u.si)),c}));A.useMediaCoordinateSpace((({context:a})=>{const l=o.vi;a.font=e.R,a.textAlign=o.ii?"right":"left",a.textBaseline="middle",a.fillStyle=i,a.fillText(this.Lt.Jt,l.pi,(l.si+l.fi)/2+l.mi)}))}Qt(A,e,t,s){var i;const{context:n,bitmapSize:o,mediaSize:a,horizontalPixelRatio:l,verticalPixelRatio:c}=A,u=this.Lt.ai||!this.Lt.bi?e.T:0,d=this.Lt.wi?e.C:0,g=e.L+this.Gt.gi,B=e.V+this.Gt.Mi,f=e.B,w=e.I,m=this.Lt.Jt,p=e.P,v=t.xi(n,m),y=Math.ceil(t.Si(n,m)),E=p+g+B,U=e.C+f+w+y+u,I=Math.max(1,Math.floor(c));let O=Math.round(E*c);O%2!=I%2&&(O+=1);const T=d>0?Math.max(1,Math.floor(d*l)):0,lA=Math.round(U*l),M=Math.round(u*l),Z=(i=this.Gt.ki)!==null&&i!==void 0?i:this.Gt.yi,S=Math.round(Z*c)-Math.floor(.5*c),V=Math.floor(S+I/2-O/2),X=V+O,cA=s==="right",hA=cA?a.width-d:d,EA=cA?o.width-T:T;let vA,UA,bA;return cA?(vA=EA-lA,UA=EA-M,bA=hA-u-f-d):(vA=EA+lA,UA=EA+M,bA=hA+u+f),{ii:cA,ti:{si:V,oi:S,fi:X,ei:lA,ri:O,ot:2*l,hi:T,ni:vA,li:EA,_i:UA,ui:I,di:o.width},vi:{si:V/c,fi:X/c,pi:bA,mi:v}}}}class Rr{constructor(A){this.Ci={yi:0,t:"#000",Mi:0,gi:0},this.Ti={Jt:"",Tt:!1,ai:!0,bi:!1,Bt:"",O:"#FFF",ci:!1,wi:!1},this.Pi={Jt:"",Tt:!1,ai:!1,bi:!0,Bt:"",O:"#FFF",ci:!0,wi:!0},this.bt=!0,this.Ri=new(A||Yo)(this.Ti,this.Ci),this.Di=new(A||Yo)(this.Pi,this.Ci)}Jt(){return this.Oi(),this.Ti.Jt}yi(){return this.Oi(),this.Ci.yi}gt(){this.bt=!0}zt(A,e=!1){return Math.max(this.Ri.zt(A,e),this.Di.zt(A,e))}Ai(){return this.Ci.ki||0}Vi(A){this.Ci.ki=A}Bi(){return this.Oi(),this.Ti.Tt||this.Pi.Tt}Ii(){return this.Oi(),this.Ti.Tt}xt(A){return this.Oi(),this.Ti.ai=this.Ti.ai&&A.W().ticksVisible,this.Pi.ai=this.Pi.ai&&A.W().ticksVisible,this.Ri.it(this.Ti,this.Ci),this.Di.it(this.Pi,this.Ci),this.Ri}zi(){return this.Oi(),this.Ri.it(this.Ti,this.Ci),this.Di.it(this.Pi,this.Ci),this.Di}Oi(){this.bt&&(this.Ti.ai=!0,this.Pi.ai=!1,this.Ei(this.Ti,this.Pi,this.Ci))}}class tf extends Rr{constructor(A,e,t){super(),this.$t=A,this.Li=e,this.Ni=t}Ei(A,e,t){if(A.Tt=!1,this.$t.W().mode===2)return;const s=this.$t.W().horzLine;if(!s.labelVisible)return;const i=this.Li.Pt();if(!this.$t.Tt()||this.Li.Fi()||i===null)return;const n=Vr(s.labelBackgroundColor);t.t=n.t,A.O=n.i;const o=2/12*this.Li.P();t.gi=o,t.Mi=o;const a=this.Ni(this.Li);t.yi=a.yi,A.Jt=this.Li.Wi(a.ct,i),A.Tt=!0}}const rf=/[1-9]/g;class qo{constructor(){this.Lt=null}it(A){this.Lt=A}K(A,e){if(this.Lt===null||this.Lt.Tt===!1||this.Lt.Jt.length===0)return;const t=A.useMediaCoordinateSpace((({context:d})=>(d.font=e.R,Math.round(e.ji.Si(d,H(this.Lt).Jt,rf)))));if(t<=0)return;const s=e.Hi,i=t+2*s,n=i/2,o=this.Lt.$i;let a=this.Lt.yi,l=Math.floor(a-n)+.5;l<0?(a+=Math.abs(0-l),l=Math.floor(a-n)+.5):l+i>o&&(a-=Math.abs(o-(l+i)),l=Math.floor(a-n)+.5);const c=l+i,u=Math.ceil(0+e.C+e.T+e.L+e.P+e.V);A.useBitmapCoordinateSpace((({context:d,horizontalPixelRatio:g,verticalPixelRatio:B})=>{const f=H(this.Lt);d.fillStyle=f.t;const w=Math.round(l*g),m=Math.round(0*B),p=Math.round(c*g),v=Math.round(u*B),y=Math.round(2*g);if(d.beginPath(),d.moveTo(w,m),d.lineTo(w,v-y),d.arcTo(w,v,w+y,v,y),d.lineTo(p-y,v),d.arcTo(p,v,p,v-y,y),d.lineTo(p,m),d.fill(),f.ai){const E=Math.round(f.yi*g),U=m,I=Math.round((U+e.T)*B);d.fillStyle=f.O;const O=Math.max(1,Math.floor(g)),T=Math.floor(.5*g);d.fillRect(E-T,U,O,I-U)}})),A.useMediaCoordinateSpace((({context:d})=>{const g=H(this.Lt),B=0+e.C+e.T+e.L+e.P/2;d.font=e.R,d.textAlign="left",d.textBaseline="middle",d.fillStyle=g.O;const f=e.ji.xi(d,"Apr0");d.translate(l+s,B+f),d.fillText(g.Jt,0,0)}))}}class sf{constructor(A,e,t){this.bt=!0,this.Ht=new qo,this.jt={Tt:!1,t:"#4c525e",O:"white",Jt:"",$i:0,yi:NaN,ai:!0},this.wt=A,this.Ui=e,this.Ni=t}gt(){this.bt=!0}xt(){return this.bt&&(this.St(),this.bt=!1),this.Ht.it(this.jt),this.Ht}St(){const A=this.jt;if(A.Tt=!1,this.wt.W().mode===2)return;const e=this.wt.W().vertLine;if(!e.labelVisible)return;const t=this.Ui.yt();if(t.Fi())return;A.$i=t.$i();const s=this.Ni();if(s===null)return;A.yi=s.yi;const i=t.qi(this.wt.kt());A.Jt=t.Yi(H(i)),A.Tt=!0;const n=Vr(e.labelBackgroundColor);A.t=n.t,A.O=n.i,A.ai=t.W().ticksVisible}}class Ei{constructor(){this.Xi=null,this.Ki=0}Zi(){return this.Ki}Gi(A){this.Ki=A}At(){return this.Xi}Ji(A){this.Xi=A}Qi(A){return[]}tn(){return[]}Tt(){return!0}}var $o;(function(r){r[r.Normal=0]="Normal",r[r.Magnet=1]="Magnet",r[r.Hidden=2]="Hidden"})($o||($o={}));class nf extends Ei{constructor(A,e){super(),this.nn=null,this.sn=NaN,this.en=0,this.rn=!0,this.hn=new Map,this.ln=!1,this.an=NaN,this.on=NaN,this._n=NaN,this.un=NaN,this.Ui=A,this.cn=e,this.dn=new $u(A,this),this.fn=((s,i)=>n=>{const o=i(),a=s();if(n===H(this.nn).vn())return{ct:a,yi:o};{const l=H(n.Pt());return{ct:n.pn(o,l),yi:o}}})((()=>this.sn),(()=>this.on));const t=((s,i)=>()=>{const n=this.Ui.yt().mn(s()),o=i();return n&&Number.isFinite(o)?{ut:n,yi:o}:null})((()=>this.en),(()=>this.Kt()));this.bn=new sf(this,A,t),this.wn=new Af(this)}W(){return this.cn}gn(A,e){this._n=A,this.un=e}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(A,e,t){this.ln||(this.ln=!0),this.rn=!0,this.yn(A,e,t)}kt(){return this.en}Kt(){return this.an}Zt(){return this.on}Tt(){return this.rn}Cn(){this.rn=!1,this.Tn(),this.sn=NaN,this.an=NaN,this.on=NaN,this.nn=null,this.Mn()}Pn(A){return this.nn!==null?[this.wn,this.dn]:[]}Yt(A){return A===this.nn&&this.cn.horzLine.visible}Xt(){return this.cn.vertLine.visible}Rn(A,e){this.rn&&this.nn===A||this.hn.clear();const t=[];return this.nn===A&&t.push(this.Dn(this.hn,e,this.fn)),t}tn(){return this.rn?[this.bn]:[]}Ut(){return this.nn}On(){this.wn.gt(),this.hn.forEach((A=>A.gt())),this.bn.gt(),this.dn.gt()}An(A){return A&&!A.vn().Fi()?A.vn():null}yn(A,e,t){this.Vn(A,e,t)&&this.On()}Vn(A,e,t){const s=this.an,i=this.on,n=this.sn,o=this.en,a=this.nn,l=this.An(t);this.en=A,this.an=isNaN(A)?NaN:this.Ui.yt().Et(A),this.nn=t;const c=l!==null?l.Pt():null;return l!==null&&c!==null?(this.sn=e,this.on=l.Ot(e,c)):(this.sn=NaN,this.on=NaN),s!==this.an||i!==this.on||o!==this.en||n!==this.sn||a!==this.nn}Tn(){const A=this.Ui.Mt().map((t=>t.In().Bn())).filter(Xu),e=A.length===0?null:Math.max(...A);this.en=e!==null?e:NaN}Dn(A,e,t){let s=A.get(e);return s===void 0&&(s=new tf(this,e,t),A.set(e,s)),s}}function Wr(r){return r==="left"||r==="right"}class YA{constructor(A){this.zn=new Map,this.En=[],this.Ln=A}Nn(A,e){const t=(function(s,i){return s===void 0?i:{Fn:Math.max(s.Fn,i.Fn),Wn:s.Wn||i.Wn}})(this.zn.get(A),e);this.zn.set(A,t)}jn(){return this.Ln}Hn(A){const e=this.zn.get(A);return e===void 0?{Fn:this.Ln}:{Fn:Math.max(this.Ln,e.Fn),Wn:e.Wn}}$n(){this.Un(),this.En=[{qn:0}]}Yn(A){this.Un(),this.En=[{qn:1,Vt:A}]}Xn(A){this.Kn(),this.En.push({qn:5,Vt:A})}Un(){this.Kn(),this.En.push({qn:6})}Zn(){this.Un(),this.En=[{qn:4}]}Gn(A){this.Un(),this.En.push({qn:2,Vt:A})}Jn(A){this.Un(),this.En.push({qn:3,Vt:A})}Qn(){return this.En}ts(A){for(const e of A.En)this.ns(e);this.Ln=Math.max(this.Ln,A.Ln),A.zn.forEach(((e,t)=>{this.Nn(t,e)}))}static ss(){return new YA(2)}static es(){return new YA(3)}ns(A){switch(A.qn){case 0:this.$n();break;case 1:this.Yn(A.Vt);break;case 2:this.Gn(A.Vt);break;case 3:this.Jn(A.Vt);break;case 4:this.Zn();break;case 5:this.Xn(A.Vt);break;case 6:this.Kn()}}Kn(){const A=this.En.findIndex((e=>e.qn===5));A!==-1&&this.En.splice(A,1)}}const jo=".";function Je(r,A){if(!Le(r))return"n/a";if(!Yt(A))throw new TypeError("invalid length");if(A<0||A>16)throw new TypeError("invalid length");return A===0?r.toString():("0000000000000000"+r.toString()).slice(-A)}class zr{constructor(A,e){if(e||(e=1),Le(A)&&Yt(A)||(A=100),A<0)throw new TypeError("invalid base");this.Li=A,this.rs=e,this.hs()}format(A){const e=A<0?"−":"";return A=Math.abs(A),e+this.ls(A)}hs(){if(this.os=0,this.Li>0&&this.rs>0){let A=this.Li;for(;A>1;)A/=10,this.os++}}ls(A){const e=this.Li/this.rs;let t=Math.floor(A),s="";const i=this.os!==void 0?this.os:NaN;if(e>1){let n=+(Math.round(A*e)-t*e).toFixed(this.os);n>=e&&(n-=e,t+=1),s=jo+Je(+n.toFixed(this.os)*this.rs,i)}else t=Math.round(t*e)/e,i>0&&(s=jo+Je(0,i));return t.toFixed(0)+s}}class Aa extends zr{constructor(A=100){super(A)}format(A){return`${super.format(A)}%`}}class of{constructor(A){this._s=A}format(A){let e="";return A<0&&(e="-",A=-A),A<995?e+this.us(A):A<999995?e+this.us(A/1e3)+"K":A<999999995?(A=1e3*Math.round(A/1e3),e+this.us(A/1e6)+"M"):(A=1e6*Math.round(A/1e6),e+this.us(A/1e9)+"B")}us(A){let e;const t=Math.pow(10,this._s);return e=(A=Math.round(A*t)/t)>=1e-15&&A<1?A.toFixed(this._s).replace(/\.?0+$/,""):String(A),e.replace(/(\.[1-9]*)0+$/,((s,i)=>i))}}function ea(r,A,e,t,s,i,n){if(A.length===0||t.from>=A.length||t.to<=0)return;const{context:o,horizontalPixelRatio:a,verticalPixelRatio:l}=r,c=A[t.from];let u=i(r,c),d=c;if(t.to-t.from<2){const g=s/2;o.beginPath();const B={et:c.et-g,rt:c.rt},f={et:c.et+g,rt:c.rt};o.moveTo(B.et*a,B.rt*l),o.lineTo(f.et*a,f.rt*l),n(r,u,B,f)}else{const g=(f,w)=>{n(r,u,d,w),o.beginPath(),u=f,d=w};let B=d;o.beginPath(),o.moveTo(c.et*a,c.rt*l);for(let f=t.from+1;f<t.to;++f){B=A[f];const w=i(r,B);switch(e){case 0:o.lineTo(B.et*a,B.rt*l);break;case 1:o.lineTo(B.et*a,A[f-1].rt*l),w!==u&&(g(w,B),o.lineTo(B.et*a,A[f-1].rt*l)),o.lineTo(B.et*a,B.rt*l);break;case 2:{const[m,p]=af(A,f-1,f);o.bezierCurveTo(m.et*a,m.rt*l,p.et*a,p.rt*l,B.et*a,B.rt*l);break}}e!==1&&w!==u&&(g(w,B),o.moveTo(B.et*a,B.rt*l))}(d!==B||d===B&&e===1)&&n(r,u,d,B)}}const ta=6;function xi(r,A){return{et:r.et-A.et,rt:r.rt-A.rt}}function ra(r,A){return{et:r.et/A,rt:r.rt/A}}function af(r,A,e){const t=Math.max(0,A-1),s=Math.min(r.length-1,e+1);var i,n;return[(i=r[A],n=ra(xi(r[e],r[t]),ta),{et:i.et+n.et,rt:i.rt+n.rt}),xi(r[e],ra(xi(r[s],r[A]),ta))]}function lf(r,A,e,t,s){const{context:i,horizontalPixelRatio:n,verticalPixelRatio:o}=A;i.lineTo(s.et*n,r*o),i.lineTo(t.et*n,r*o),i.closePath(),i.fillStyle=e,i.fill()}class sa extends Xe{constructor(){super(...arguments),this.tt=null}it(A){this.tt=A}Z(A){var e;if(this.tt===null)return;const{st:t,nt:s,cs:i,ht:n,Wt:o,ds:a}=this.tt,l=(e=this.tt.fs)!==null&&e!==void 0?e:this.tt.vs?0:A.mediaSize.height;if(s===null)return;const c=A.context;c.lineCap="butt",c.lineJoin="round",c.lineWidth=n,Bt(c,o),c.lineWidth=1,ea(A,t,a,s,i,this.ps.bind(this),lf.bind(null,l))}}function Si(r,A,e){return Math.min(Math.max(r,A),e)}function Xr(r,A,e){return A-r<=e}function ia(r){const A=Math.ceil(r);return A%2==0?A-1:A}class Hi{bs(A,e){const t=this.ws,{gs:s,Ms:i,xs:n,Ss:o,ks:a,fs:l}=e;if(this.ys===void 0||t===void 0||t.gs!==s||t.Ms!==i||t.xs!==n||t.Ss!==o||t.fs!==l||t.ks!==a){const c=A.context.createLinearGradient(0,0,0,a);if(c.addColorStop(0,s),l!=null){const u=Si(l*A.verticalPixelRatio/a,0,1);c.addColorStop(u,i),c.addColorStop(u,n)}c.addColorStop(1,o),this.ys=c,this.ws=e}return this.ys}}class cf extends sa{constructor(){super(...arguments),this.Cs=new Hi}ps(A,e){return this.Cs.bs(A,{gs:e.Ts,Ms:"",xs:"",Ss:e.Ps,ks:A.bitmapSize.height})}}function hf(r,A){const e=r.context;e.strokeStyle=A,e.stroke()}class na extends Xe{constructor(){super(...arguments),this.tt=null}it(A){this.tt=A}Z(A){if(this.tt===null)return;const{st:e,nt:t,cs:s,ds:i,ht:n,Wt:o,Rs:a}=this.tt;if(t===null)return;const l=A.context;l.lineCap="butt",l.lineWidth=n*A.verticalPixelRatio,Bt(l,o),l.lineJoin="round";const c=this.Ds.bind(this);i!==void 0&&ea(A,e,i,t,s,c,hf),a&&(function(u,d,g,B,f){const{horizontalPixelRatio:w,verticalPixelRatio:m,context:p}=u;let v=null;const y=Math.max(1,Math.floor(w))%2/2,E=g*m+y;for(let U=B.to-1;U>=B.from;--U){const I=d[U];if(I){const O=f(u,I);O!==v&&(p.beginPath(),v!==null&&p.fill(),p.fillStyle=O,v=O);const T=Math.round(I.et*w)+y,lA=I.rt*m;p.moveTo(T,lA),p.arc(T,lA,E,0,2*Math.PI)}}p.fill()})(A,e,a,t,c)}}class oa extends na{Ds(A,e){return e._t}}function aa(r,A,e,t,s=0,i=A.length){let n=i-s;for(;0<n;){const o=n>>1,a=s+o;t(A[a],e)===r?(s=a+1,n-=o+1):n=o}return s}const jt=aa.bind(null,!0),la=aa.bind(null,!1);function uf(r,A){return r.ut<A}function ff(r,A){return A<r.ut}function ca(r,A,e){const t=A.Os(),s=A.di(),i=jt(r,t,uf),n=la(r,s,ff);if(!e)return{from:i,to:n};let o=i,a=n;return i>0&&i<r.length&&r[i].ut>=t&&(o=i-1),n>0&&n<r.length&&r[n-1].ut<=s&&(a=n+1),{from:o,to:a}}class Li{constructor(A,e,t){this.As=!0,this.Vs=!0,this.Bs=!0,this.Is=[],this.zs=null,this.Es=A,this.Ls=e,this.Ns=t}gt(A){this.As=!0,A==="data"&&(this.Vs=!0),A==="options"&&(this.Bs=!0)}xt(){return this.Es.Tt()?(this.Fs(),this.zs===null?null:this.Ws):null}js(){this.Is=this.Is.map((A=>Object.assign(Object.assign({},A),this.Es.$s().Hs(A.ut))))}Us(){this.zs=null}Fs(){this.Vs&&(this.qs(),this.Vs=!1),this.Bs&&(this.js(),this.Bs=!1),this.As&&(this.Ys(),this.As=!1)}Ys(){const A=this.Es.At(),e=this.Ls.yt();if(this.Us(),e.Fi()||A.Fi())return;const t=e.Xs();if(t===null||this.Es.In().Ks()===0)return;const s=this.Es.Pt();s!==null&&(this.zs=ca(this.Is,t,this.Ns),this.Zs(A,e,s.Vt),this.Gs())}}class Jr extends Li{constructor(A,e){super(A,e,!0)}Zs(A,e,t){e.Js(this.Is,$t(this.zs)),A.Qs(this.Is,t,$t(this.zs))}te(A,e){return{ut:A,ct:e,et:NaN,rt:NaN}}qs(){const A=this.Es.$s();this.Is=this.Es.In().ie().map((e=>{const t=e.Vt[3];return this.ne(e.se,t,A)}))}}class df extends Jr{constructor(A,e){super(A,e),this.Ws=new Fi,this.ee=new cf,this.re=new oa,this.Ws.X([this.ee,this.re])}ne(A,e,t){return Object.assign(Object.assign({},this.te(A,e)),t.Hs(A))}Gs(){const A=this.Es.W();this.ee.it({ds:A.lineType,st:this.Is,Wt:A.lineStyle,ht:A.lineWidth,fs:null,vs:A.invertFilledArea,nt:this.zs,cs:this.Ls.yt().he()}),this.re.it({ds:A.lineVisible?A.lineType:void 0,st:this.Is,Wt:A.lineStyle,ht:A.lineWidth,nt:this.zs,cs:this.Ls.yt().he(),Rs:A.pointMarkersVisible?A.pointMarkersRadius||A.lineWidth/2+2:void 0})}}class Bf extends Xe{constructor(){super(...arguments),this.Lt=null,this.le=0,this.ae=0}it(A){this.Lt=A}Z({context:A,horizontalPixelRatio:e,verticalPixelRatio:t}){if(this.Lt===null||this.Lt.In.length===0||this.Lt.nt===null)return;this.le=this.oe(e),this.le>=2&&Math.max(1,Math.floor(e))%2!=this.le%2&&this.le--,this.ae=this.Lt._e?Math.min(this.le,Math.floor(e)):this.le;let s=null;const i=this.ae<=this.le&&this.Lt.he>=Math.floor(1.5*e);for(let n=this.Lt.nt.from;n<this.Lt.nt.to;++n){const o=this.Lt.In[n];s!==o.ue&&(A.fillStyle=o.ue,s=o.ue);const a=Math.floor(.5*this.ae),l=Math.round(o.et*e),c=l-a,u=this.ae,d=c+u-1,g=Math.min(o.ce,o.de),B=Math.max(o.ce,o.de),f=Math.round(g*t)-a,w=Math.round(B*t)+a,m=Math.max(w-f,this.ae);A.fillRect(c,f,u,m);const p=Math.ceil(1.5*this.le);if(i){if(this.Lt.fe){const U=l-p;let I=Math.max(f,Math.round(o.ve*t)-a),O=I+u-1;O>f+m-1&&(O=f+m-1,I=O-u+1),A.fillRect(U,I,c-U,O-I+1)}const v=l+p;let y=Math.max(f,Math.round(o.pe*t)-a),E=y+u-1;E>f+m-1&&(E=f+m-1,y=E-u+1),A.fillRect(d+1,y,v-d,E-y+1)}}}oe(A){const e=Math.floor(A);return Math.max(e,Math.floor((function(t,s){return Math.floor(.3*t*s)})(H(this.Lt).he,A)))}}class ha extends Li{constructor(A,e){super(A,e,!1)}Zs(A,e,t){e.Js(this.Is,$t(this.zs)),A.me(this.Is,t,$t(this.zs))}be(A,e,t){return{ut:A,we:e.Vt[0],ge:e.Vt[1],Me:e.Vt[2],xe:e.Vt[3],et:NaN,ve:NaN,ce:NaN,de:NaN,pe:NaN}}qs(){const A=this.Es.$s();this.Is=this.Es.In().ie().map((e=>this.ne(e.se,e,A)))}}class gf extends ha{constructor(){super(...arguments),this.Ws=new Bf}ne(A,e,t){return Object.assign(Object.assign({},this.be(A,e,t)),t.Hs(A))}Gs(){const A=this.Es.W();this.Ws.it({In:this.Is,he:this.Ls.yt().he(),fe:A.openVisible,_e:A.thinBars,nt:this.zs})}}class pf extends sa{constructor(){super(...arguments),this.Cs=new Hi}ps(A,e){const t=this.tt;return this.Cs.bs(A,{gs:e.Se,Ms:e.ke,xs:e.ye,Ss:e.Ce,ks:A.bitmapSize.height,fs:t.fs})}}class wf extends na{constructor(){super(...arguments),this.Te=new Hi}Ds(A,e){const t=this.tt;return this.Te.bs(A,{gs:e.Pe,Ms:e.Pe,xs:e.Re,Ss:e.Re,ks:A.bitmapSize.height,fs:t.fs})}}class mf extends Jr{constructor(A,e){super(A,e),this.Ws=new Fi,this.De=new pf,this.Oe=new wf,this.Ws.X([this.De,this.Oe])}ne(A,e,t){return Object.assign(Object.assign({},this.te(A,e)),t.Hs(A))}Gs(){const A=this.Es.Pt();if(A===null)return;const e=this.Es.W(),t=this.Es.At().Ot(e.baseValue.price,A.Vt),s=this.Ls.yt().he();this.De.it({st:this.Is,ht:e.lineWidth,Wt:e.lineStyle,ds:e.lineType,fs:t,vs:!1,nt:this.zs,cs:s}),this.Oe.it({st:this.Is,ht:e.lineWidth,Wt:e.lineStyle,ds:e.lineVisible?e.lineType:void 0,Rs:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,fs:t,nt:this.zs,cs:s})}}class Cf extends Xe{constructor(){super(...arguments),this.Lt=null,this.le=0}it(A){this.Lt=A}Z(A){if(this.Lt===null||this.Lt.In.length===0||this.Lt.nt===null)return;const{horizontalPixelRatio:e}=A;this.le=(function(i,n){if(i>=2.5&&i<=4)return Math.floor(3*n);const o=1-.2*Math.atan(Math.max(4,i)-4)/(.5*Math.PI),a=Math.floor(i*o*n),l=Math.floor(i*n),c=Math.min(a,l);return Math.max(Math.floor(n),c)})(this.Lt.he,e),this.le>=2&&Math.floor(e)%2!=this.le%2&&this.le--;const t=this.Lt.In;this.Lt.Ae&&this.Ve(A,t,this.Lt.nt),this.Lt.ci&&this.Be(A,t,this.Lt.nt);const s=this.Ie(e);(!this.Lt.ci||this.le>2*s)&&this.ze(A,t,this.Lt.nt)}Ve(A,e,t){if(this.Lt===null)return;const{context:s,horizontalPixelRatio:i,verticalPixelRatio:n}=A;let o="",a=Math.min(Math.floor(i),Math.floor(this.Lt.he*i));a=Math.max(Math.floor(i),Math.min(a,this.le));const l=Math.floor(.5*a);let c=null;for(let u=t.from;u<t.to;u++){const d=e[u];d.Ee!==o&&(s.fillStyle=d.Ee,o=d.Ee);const g=Math.round(Math.min(d.ve,d.pe)*n),B=Math.round(Math.max(d.ve,d.pe)*n),f=Math.round(d.ce*n),w=Math.round(d.de*n);let m=Math.round(i*d.et)-l;const p=m+a-1;c!==null&&(m=Math.max(c+1,m),m=Math.min(m,p));const v=p-m+1;s.fillRect(m,f,v,g-f),s.fillRect(m,B+1,v,w-B),c=p}}Ie(A){let e=Math.floor(1*A);this.le<=2*e&&(e=Math.floor(.5*(this.le-1)));const t=Math.max(Math.floor(A),e);return this.le<=2*t?Math.max(Math.floor(A),Math.floor(1*A)):t}Be(A,e,t){if(this.Lt===null)return;const{context:s,horizontalPixelRatio:i,verticalPixelRatio:n}=A;let o="";const a=this.Ie(i);let l=null;for(let c=t.from;c<t.to;c++){const u=e[c];u.Le!==o&&(s.fillStyle=u.Le,o=u.Le);let d=Math.round(u.et*i)-Math.floor(.5*this.le);const g=d+this.le-1,B=Math.round(Math.min(u.ve,u.pe)*n),f=Math.round(Math.max(u.ve,u.pe)*n);if(l!==null&&(d=Math.max(l+1,d),d=Math.min(d,g)),this.Lt.he*i>2*a)ef(s,d,B,g-d+1,f-B+1,a);else{const w=g-d+1;s.fillRect(d,B,w,f-B+1)}l=g}}ze(A,e,t){if(this.Lt===null)return;const{context:s,horizontalPixelRatio:i,verticalPixelRatio:n}=A;let o="";const a=this.Ie(i);for(let l=t.from;l<t.to;l++){const c=e[l];let u=Math.round(Math.min(c.ve,c.pe)*n),d=Math.round(Math.max(c.ve,c.pe)*n),g=Math.round(c.et*i)-Math.floor(.5*this.le),B=g+this.le-1;if(c.ue!==o){const f=c.ue;s.fillStyle=f,o=f}this.Lt.ci&&(g+=a,u+=a,B-=a,d-=a),u>d||s.fillRect(g,u,B-g+1,d-u+1)}}}class vf extends ha{constructor(){super(...arguments),this.Ws=new Cf}ne(A,e,t){return Object.assign(Object.assign({},this.be(A,e,t)),t.Hs(A))}Gs(){const A=this.Es.W();this.Ws.it({In:this.Is,he:this.Ls.yt().he(),Ae:A.wickVisible,ci:A.borderVisible,nt:this.zs})}}class bf{constructor(A,e){this.Ne=A,this.Li=e}K(A,e,t){this.Ne.draw(A,this.Li,e,t)}}class Ii extends Li{constructor(A,e,t){super(A,e,!1),this.wn=t,this.Ws=new bf(this.wn.renderer(),(s=>{const i=A.Pt();return i===null?null:A.At().Ot(s,i.Vt)}))}Fe(A){return this.wn.priceValueBuilder(A)}We(A){return this.wn.isWhitespace(A)}qs(){const A=this.Es.$s();this.Is=this.Es.In().ie().map((e=>Object.assign(Object.assign({ut:e.se,et:NaN},A.Hs(e.se)),{je:e.He})))}Zs(A,e){e.Js(this.Is,$t(this.zs))}Gs(){this.wn.update({bars:this.Is.map(Qf),barSpacing:this.Ls.yt().he(),visibleRange:this.zs},this.Es.W())}}function Qf(r){return{x:r.et,time:r.ut,originalData:r.je,barColor:r.ue}}class Ff extends Xe{constructor(){super(...arguments),this.Lt=null,this.$e=[]}it(A){this.Lt=A,this.$e=[]}Z({context:A,horizontalPixelRatio:e,verticalPixelRatio:t}){if(this.Lt===null||this.Lt.st.length===0||this.Lt.nt===null)return;this.$e.length||this.Ue(e);const s=Math.max(1,Math.floor(t)),i=Math.round(this.Lt.qe*t)-Math.floor(s/2),n=i+s;for(let o=this.Lt.nt.from;o<this.Lt.nt.to;o++){const a=this.Lt.st[o],l=this.$e[o-this.Lt.nt.from],c=Math.round(a.rt*t);let u,d;A.fillStyle=a.ue,c<=i?(u=c,d=n):(u=i,d=c-Math.floor(s/2)+s),A.fillRect(l.Os,u,l.di-l.Os+1,d-u)}}Ue(A){if(this.Lt===null||this.Lt.st.length===0||this.Lt.nt===null)return void(this.$e=[]);const e=Math.ceil(this.Lt.he*A)<=1?0:Math.max(1,Math.floor(A)),t=Math.round(this.Lt.he*A)-e;this.$e=new Array(this.Lt.nt.to-this.Lt.nt.from);for(let i=this.Lt.nt.from;i<this.Lt.nt.to;i++){const n=this.Lt.st[i],o=Math.round(n.et*A);let a,l;if(t%2){const c=(t-1)/2;a=o-c,l=o+c}else{const c=t/2;a=o-c,l=o+c-1}this.$e[i-this.Lt.nt.from]={Os:a,di:l,Ye:o,Xe:n.et*A,ut:n.ut}}for(let i=this.Lt.nt.from+1;i<this.Lt.nt.to;i++){const n=this.$e[i-this.Lt.nt.from],o=this.$e[i-this.Lt.nt.from-1];n.ut===o.ut+1&&n.Os-o.di!==e+1&&(o.Ye>o.Xe?o.di=n.Os-e-1:n.Os=o.di+e+1)}let s=Math.ceil(this.Lt.he*A);for(let i=this.Lt.nt.from;i<this.Lt.nt.to;i++){const n=this.$e[i-this.Lt.nt.from];n.di<n.Os&&(n.di=n.Os);const o=n.di-n.Os+1;s=Math.min(o,s)}if(e>0&&s<4)for(let i=this.Lt.nt.from;i<this.Lt.nt.to;i++){const n=this.$e[i-this.Lt.nt.from];n.di-n.Os+1>s&&(n.Ye>n.Xe?n.di-=1:n.Os+=1)}}}class yf extends Jr{constructor(){super(...arguments),this.Ws=new Ff}ne(A,e,t){return Object.assign(Object.assign({},this.te(A,e)),t.Hs(A))}Gs(){const A={st:this.Is,he:this.Ls.yt().he(),nt:this.zs,qe:this.Es.At().Ot(this.Es.W().base,H(this.Es.Pt()).Vt)};this.Ws.it(A)}}class Uf extends Jr{constructor(){super(...arguments),this.Ws=new oa}ne(A,e,t){return Object.assign(Object.assign({},this.te(A,e)),t.Hs(A))}Gs(){const A=this.Es.W(),e={st:this.Is,Wt:A.lineStyle,ds:A.lineVisible?A.lineType:void 0,ht:A.lineWidth,Rs:A.pointMarkersVisible?A.pointMarkersRadius||A.lineWidth/2+2:void 0,nt:this.zs,cs:this.Ls.yt().he()};this.Ws.it(e)}}const Ef=/[2-9]/g;class Ar{constructor(A=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Je={},this.Qe=new Map,this.tr=A}ir(){this.Ke=0,this.Qe.clear(),this.Ze=1,this.Ge=1,this.Je={}}Si(A,e,t){return this.nr(A,e,t).width}xi(A,e,t){const s=this.nr(A,e,t);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}nr(A,e,t){const s=t||Ef,i=String(e).replace(s,"0");if(this.Qe.has(i))return ie(this.Qe.get(i)).sr;if(this.Ke===this.tr){const o=this.Je[this.Ge];delete this.Je[this.Ge],this.Qe.delete(o),this.Ge++,this.Ke--}A.save(),A.textBaseline="middle";const n=A.measureText(i);return A.restore(),n.width===0&&e.length||(this.Qe.set(i,{sr:n,er:this.Ze}),this.Je[this.Ze]=i,this.Ke++,this.Ze++),n}}class xf{constructor(A){this.rr=null,this.k=null,this.hr="right",this.lr=A}ar(A,e,t){this.rr=A,this.k=e,this.hr=t}K(A){this.k!==null&&this.rr!==null&&this.rr.K(A,this.k,this.lr,this.hr)}}class ua{constructor(A,e,t){this._r=A,this.lr=new Ar(50),this.ur=e,this.F=t,this.j=-1,this.Ht=new xf(this.lr)}xt(){const A=this.F.cr(this.ur);if(A===null)return null;const e=A.dr(this.ur)?A.vr():this.ur.At();if(e===null)return null;const t=A.pr(e);if(t==="overlay")return null;const s=this.F.mr();return s.P!==this.j&&(this.j=s.P,this.lr.ir()),this.Ht.ar(this._r.zi(),s,t),this.Ht}}class Sf extends Xe{constructor(){super(...arguments),this.Lt=null}it(A){this.Lt=A}br(A,e){var t;if(!(!((t=this.Lt)===null||t===void 0)&&t.Tt))return null;const{rt:s,ht:i,wr:n}=this.Lt;return e>=s-i-7&&e<=s+i+7?{gr:this.Lt,wr:n}:null}Z({context:A,bitmapSize:e,horizontalPixelRatio:t,verticalPixelRatio:s}){if(this.Lt===null||this.Lt.Tt===!1)return;const i=Math.round(this.Lt.rt*s);i<0||i>e.height||(A.lineCap="butt",A.strokeStyle=this.Lt.O,A.lineWidth=Math.floor(this.Lt.ht*t),Bt(A,this.Lt.Wt),Ro(A,i,0,e.width))}}class Ti{constructor(A){this.Mr={rt:0,O:"rgba(0, 0, 0, 0)",ht:1,Wt:0,Tt:!1},this.Sr=new Sf,this.bt=!0,this.Es=A,this.Ls=A.qt(),this.Sr.it(this.Mr)}gt(){this.bt=!0}xt(){return this.Es.Tt()?(this.bt&&(this.kr(),this.bt=!1),this.Sr):null}}class Hf extends Ti{constructor(A){super(A)}kr(){this.Mr.Tt=!1;const A=this.Es.At(),e=A.yr().yr;if(e!==2&&e!==3)return;const t=this.Es.W();if(!t.baseLineVisible||!this.Es.Tt())return;const s=this.Es.Pt();s!==null&&(this.Mr.Tt=!0,this.Mr.rt=A.Ot(s.Vt,s.Vt),this.Mr.O=t.baseLineColor,this.Mr.ht=t.baseLineWidth,this.Mr.Wt=t.baseLineStyle)}}class Lf extends Xe{constructor(){super(...arguments),this.Lt=null}it(A){this.Lt=A}He(){return this.Lt}Z({context:A,horizontalPixelRatio:e,verticalPixelRatio:t}){const s=this.Lt;if(s===null)return;const i=Math.max(1,Math.floor(e)),n=i%2/2,o=Math.round(s.Xe.x*e)+n,a=s.Xe.y*t;A.fillStyle=s.Cr,A.beginPath();const l=Math.max(2,1.5*s.Tr)*e;A.arc(o,a,l,0,2*Math.PI,!1),A.fill(),A.fillStyle=s.Pr,A.beginPath(),A.arc(o,a,s.ot*e,0,2*Math.PI,!1),A.fill(),A.lineWidth=i,A.strokeStyle=s.Rr,A.beginPath(),A.arc(o,a,s.ot*e+i/2,0,2*Math.PI,!1),A.stroke()}}const If=[{Dr:0,Or:.25,Ar:4,Vr:10,Br:.25,Ir:0,zr:.4,Er:.8},{Dr:.25,Or:.525,Ar:10,Vr:14,Br:0,Ir:0,zr:.8,Er:0},{Dr:.525,Or:1,Ar:14,Vr:14,Br:0,Ir:0,zr:0,Er:0}];function fa(r,A,e,t){return(function(s,i){if(s==="transparent")return s;const n=Kr(s),o=n[3];return`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i*o})`})(r,e+(t-e)*A)}function da(r,A){const e=r%2600/2600;let t;for(const a of If)if(e>=a.Dr&&e<=a.Or){t=a;break}At(t!==void 0,"Last price animation internal logic error");const s=(e-t.Dr)/(t.Or-t.Dr);return{Pr:fa(A,s,t.Br,t.Ir),Rr:fa(A,s,t.zr,t.Er),ot:(i=s,n=t.Ar,o=t.Vr,n+(o-n)*i)};var i,n,o}class Tf{constructor(A){this.Ht=new Lf,this.bt=!0,this.Lr=!0,this.Nr=performance.now(),this.Fr=this.Nr-1,this.Wr=A}jr(){this.Fr=this.Nr-1,this.gt()}Hr(){if(this.gt(),this.Wr.W().lastPriceAnimation===2){const A=performance.now(),e=this.Fr-A;if(e>0)return void(e<650&&(this.Fr+=2600));this.Nr=A,this.Fr=A+2600}}gt(){this.bt=!0}$r(){this.Lr=!0}Tt(){return this.Wr.W().lastPriceAnimation!==0}Ur(){switch(this.Wr.W().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.Fr}}xt(){return this.bt?(this.St(),this.bt=!1,this.Lr=!1):this.Lr&&(this.qr(),this.Lr=!1),this.Ht}St(){this.Ht.it(null);const A=this.Wr.qt().yt(),e=A.Xs(),t=this.Wr.Pt();if(e===null||t===null)return;const s=this.Wr.Yr(!0);if(s.Xr||!e.Kr(s.se))return;const i={x:A.Et(s.se),y:this.Wr.At().Ot(s.ct,t.Vt)},n=s.O,o=this.Wr.W().lineWidth,a=da(this.Zr(),n);this.Ht.it({Cr:n,Tr:o,Pr:a.Pr,Rr:a.Rr,ot:a.ot,Xe:i})}qr(){const A=this.Ht.He();if(A!==null){const e=da(this.Zr(),A.Cr);A.Pr=e.Pr,A.Rr=e.Rr,A.ot=e.ot}}Zr(){return this.Ur()?performance.now()-this.Nr:2599}}function er(r,A){return ia(Math.min(Math.max(r,12),30)*A)}function tr(r,A){switch(r){case"arrowDown":case"arrowUp":return er(A,1);case"circle":return er(A,.8);case"square":return er(A,.7)}}function Ba(r){return(function(A){const e=Math.ceil(A);return e%2!=0?e-1:e})(er(r,1))}function ga(r){return Math.max(er(r,.1),3)}function pa(r,A,e,t,s){const i=tr("square",e),n=(i-1)/2,o=r-n,a=A-n;return t>=o&&t<=o+i&&s>=a&&s<=a+i}function wa(r,A,e,t,s){const i=(tr("arrowUp",s)-1)/2,n=(ia(s/2)-1)/2;A.beginPath(),r?(A.moveTo(e-i,t),A.lineTo(e,t-i),A.lineTo(e+i,t),A.lineTo(e+n,t),A.lineTo(e+n,t+i),A.lineTo(e-n,t+i),A.lineTo(e-n,t)):(A.moveTo(e-i,t),A.lineTo(e,t+i),A.lineTo(e+i,t),A.lineTo(e+n,t),A.lineTo(e+n,t-i),A.lineTo(e-n,t-i),A.lineTo(e-n,t)),A.fill()}function Mf(r,A,e,t,s,i){return pa(A,e,t,s,i)}class Df extends yi{constructor(){super(...arguments),this.Lt=null,this.lr=new Ar,this.j=-1,this.H="",this.Gr=""}it(A){this.Lt=A}ar(A,e){this.j===A&&this.H===e||(this.j=A,this.H=e,this.Gr=St(A,e),this.lr.ir())}br(A,e){if(this.Lt===null||this.Lt.nt===null)return null;for(let t=this.Lt.nt.from;t<this.Lt.nt.to;t++){const s=this.Lt.st[t];if(kf(s,A,e))return{gr:s.Jr,wr:s.wr}}return null}Z({context:A},e,t){if(this.Lt!==null&&this.Lt.nt!==null){A.textBaseline="middle",A.font=this.Gr;for(let s=this.Lt.nt.from;s<this.Lt.nt.to;s++){const i=this.Lt.st[s];i.Jt!==void 0&&(i.Jt.$i=this.lr.Si(A,i.Jt.Qr),i.Jt.zt=this.j,i.Jt.et=i.et-i.Jt.$i/2),Of(i,A)}}}}function Of(r,A){A.fillStyle=r.O,r.Jt!==void 0&&(function(e,t,s,i){e.fillText(t,s,i)})(A,r.Jt.Qr,r.Jt.et,r.Jt.rt),(function(e,t){if(e.Ks!==0){switch(e.th){case"arrowDown":return void wa(!1,t,e.et,e.rt,e.Ks);case"arrowUp":return void wa(!0,t,e.et,e.rt,e.Ks);case"circle":return void(function(s,i,n,o){const a=(tr("circle",o)-1)/2;s.beginPath(),s.arc(i,n,a,0,2*Math.PI,!1),s.fill()})(t,e.et,e.rt,e.Ks);case"square":return void(function(s,i,n,o){const a=tr("square",o),l=(a-1)/2,c=i-l,u=n-l;s.fillRect(c,u,a,a)})(t,e.et,e.rt,e.Ks)}e.th}})(r,A)}function kf(r,A,e){return!(r.Jt===void 0||!(function(t,s,i,n,o,a){const l=n/2;return o>=t&&o<=t+i&&a>=s-l&&a<=s+l})(r.Jt.et,r.Jt.rt,r.Jt.$i,r.Jt.zt,A,e))||(function(t,s,i){if(t.Ks===0)return!1;switch(t.th){case"arrowDown":case"arrowUp":return Mf(0,t.et,t.rt,t.Ks,s,i);case"circle":return(function(n,o,a,l,c){const u=2+tr("circle",a)/2,d=n-l,g=o-c;return Math.sqrt(d*d+g*g)<=u})(t.et,t.rt,t.Ks,s,i);case"square":return pa(t.et,t.rt,t.Ks,s,i)}})(r,A,e)}function _f(r,A,e,t,s,i,n,o,a){const l=Le(e)?e:e.xe,c=Le(e)?e:e.ge,u=Le(e)?e:e.Me,d=Le(A.size)?Math.max(A.size,0):1,g=Ba(o.he())*d,B=g/2;switch(r.Ks=g,A.position){case"inBar":return r.rt=n.Ot(l,a),void(r.Jt!==void 0&&(r.Jt.rt=r.rt+B+i+.6*s));case"aboveBar":return r.rt=n.Ot(c,a)-B-t.ih,r.Jt!==void 0&&(r.Jt.rt=r.rt-B-.6*s,t.ih+=1.2*s),void(t.ih+=g+i);case"belowBar":return r.rt=n.Ot(u,a)+B+t.nh,r.Jt!==void 0&&(r.Jt.rt=r.rt+B+i+.6*s,t.nh+=1.2*s),void(t.nh+=g+i)}A.position}class Nf{constructor(A,e){this.bt=!0,this.sh=!0,this.eh=!0,this.rh=null,this.Ht=new Df,this.Wr=A,this.Ui=e,this.Lt={st:[],nt:null}}gt(A){this.bt=!0,this.eh=!0,A==="data"&&(this.sh=!0)}xt(A){if(!this.Wr.Tt())return null;this.bt&&this.hh();const e=this.Ui.W().layout;return this.Ht.ar(e.fontSize,e.fontFamily),this.Ht.it(this.Lt),this.Ht}lh(){if(this.eh){if(this.Wr.ah().length>0){const A=this.Ui.yt().he(),e=ga(A),t=1.5*Ba(A)+2*e;this.rh={above:t,below:t}}else this.rh=null;this.eh=!1}return this.rh}hh(){const A=this.Wr.At(),e=this.Ui.yt(),t=this.Wr.ah();this.sh&&(this.Lt.st=t.map((c=>({ut:c.time,et:0,rt:0,Ks:0,th:c.shape,O:c.color,Jr:c.Jr,wr:c.id,Jt:void 0}))),this.sh=!1);const s=this.Ui.W().layout;this.Lt.nt=null;const i=e.Xs();if(i===null)return;const n=this.Wr.Pt();if(n===null||this.Lt.st.length===0)return;let o=NaN;const a=ga(e.he()),l={ih:a,nh:a};this.Lt.nt=ca(this.Lt.st,i,!0);for(let c=this.Lt.nt.from;c<this.Lt.nt.to;c++){const u=t[c];u.time!==o&&(l.ih=a,l.nh=a,o=u.time);const d=this.Lt.st[c];d.et=e.Et(u.time),u.text!==void 0&&u.text.length>0&&(d.Jt={Qr:u.text,et:0,rt:0,$i:0,zt:0});const g=this.Wr.oh(u.time);g!==null&&_f(d,u,g,l,s.fontSize,a,A,e,n.Vt)}this.bt=!1}}class Kf extends Ti{constructor(A){super(A)}kr(){const A=this.Mr;A.Tt=!1;const e=this.Es.W();if(!e.priceLineVisible||!this.Es.Tt())return;const t=this.Es.Yr(e.priceLineSource===0);t.Xr||(A.Tt=!0,A.rt=t.yi,A.O=this.Es._h(t.O),A.ht=e.priceLineWidth,A.Wt=e.priceLineStyle)}}class Vf extends Rr{constructor(A){super(),this.$t=A}Ei(A,e,t){A.Tt=!1,e.Tt=!1;const s=this.$t;if(!s.Tt())return;const i=s.W(),n=i.lastValueVisible,o=s.uh()!=="",a=i.seriesLastValueMode===0,l=s.Yr(!1);if(l.Xr)return;n&&(A.Jt=this.dh(l,n,a),A.Tt=A.Jt.length!==0),(o||a)&&(e.Jt=this.fh(l,n,o,a),e.Tt=e.Jt.length>0);const c=s._h(l.O),u=Vr(c);t.t=u.t,t.yi=l.yi,e.Bt=s.qt().It(l.yi/s.At().zt()),A.Bt=c,A.O=u.i,e.O=u.i}fh(A,e,t,s){let i="";const n=this.$t.uh();return t&&n.length!==0&&(i+=`${n} `),e&&s&&(i+=this.$t.At().ph()?A.mh:A.bh),i.trim()}dh(A,e,t){return e?t?this.$t.At().ph()?A.bh:A.mh:A.Jt:""}}function ma(r,A,e,t){const s=Number.isFinite(A),i=Number.isFinite(e);return s&&i?r(A,e):s||i?s?A:e:t}class ce{constructor(A,e){this.wh=A,this.gh=e}Mh(A){return A!==null&&this.wh===A.wh&&this.gh===A.gh}xh(){return new ce(this.wh,this.gh)}Sh(){return this.wh}kh(){return this.gh}yh(){return this.gh-this.wh}Fi(){return this.gh===this.wh||Number.isNaN(this.gh)||Number.isNaN(this.wh)}ts(A){return A===null?this:new ce(ma(Math.min,this.Sh(),A.Sh(),-1/0),ma(Math.max,this.kh(),A.kh(),1/0))}Ch(A){if(!Le(A)||this.gh-this.wh===0)return;const e=.5*(this.gh+this.wh);let t=this.gh-e,s=this.wh-e;t*=A,s*=A,this.gh=e+t,this.wh=e+s}Th(A){Le(A)&&(this.gh+=A,this.wh+=A)}Ph(){return{minValue:this.wh,maxValue:this.gh}}static Rh(A){return A===null?null:new ce(A.minValue,A.maxValue)}}class Zr{constructor(A,e){this.Dh=A,this.Oh=e||null}Ah(){return this.Dh}Vh(){return this.Oh}Ph(){return this.Dh===null?null:{priceRange:this.Dh.Ph(),margins:this.Oh||void 0}}static Rh(A){return A===null?null:new Zr(ce.Rh(A.priceRange),A.margins)}}class Pf extends Ti{constructor(A,e){super(A),this.Bh=e}kr(){const A=this.Mr;A.Tt=!1;const e=this.Bh.W();if(!this.Es.Tt()||!e.lineVisible)return;const t=this.Bh.Ih();t!==null&&(A.Tt=!0,A.rt=t,A.O=e.color,A.ht=e.lineWidth,A.Wt=e.lineStyle,A.wr=this.Bh.W().id)}}class Gf extends Rr{constructor(A,e){super(),this.Wr=A,this.Bh=e}Ei(A,e,t){A.Tt=!1,e.Tt=!1;const s=this.Bh.W(),i=s.axisLabelVisible,n=s.title!=="",o=this.Wr;if(!i||!o.Tt())return;const a=this.Bh.Ih();if(a===null)return;n&&(e.Jt=s.title,e.Tt=!0),e.Bt=o.qt().It(a/o.At().zt()),A.Jt=this.zh(s.price),A.Tt=!0;const l=Vr(s.axisLabelColor||s.color);t.t=l.t;const c=s.axisLabelTextColor||l.i;A.O=c,e.O=c,t.yi=a}zh(A){const e=this.Wr.Pt();return e===null?"":this.Wr.At().Wi(A,e.Vt)}}class Rf{constructor(A,e){this.Wr=A,this.cn=e,this.Eh=new Pf(A,this),this._r=new Gf(A,this),this.Lh=new ua(this._r,A,A.qt())}Nh(A){Ue(this.cn,A),this.gt(),this.Wr.qt().Fh()}W(){return this.cn}Wh(){return this.Eh}jh(){return this.Lh}Hh(){return this._r}gt(){this.Eh.gt(),this._r.gt()}Ih(){const A=this.Wr,e=A.At();if(A.qt().yt().Fi()||e.Fi())return null;const t=A.Pt();return t===null?null:e.Ot(this.cn.price,t.Vt)}}class Wf extends Ei{constructor(A){super(),this.Ui=A}qt(){return this.Ui}}const zf={Bar:(r,A,e,t)=>{var s;const i=A.upColor,n=A.downColor,o=H(r(e,t)),a=xt(o.Vt[0])<=xt(o.Vt[3]);return{ue:(s=o.O)!==null&&s!==void 0?s:a?i:n}},Candlestick:(r,A,e,t)=>{var s,i,n;const o=A.upColor,a=A.downColor,l=A.borderUpColor,c=A.borderDownColor,u=A.wickUpColor,d=A.wickDownColor,g=H(r(e,t)),B=xt(g.Vt[0])<=xt(g.Vt[3]);return{ue:(s=g.O)!==null&&s!==void 0?s:B?o:a,Le:(i=g.Bt)!==null&&i!==void 0?i:B?l:c,Ee:(n=g.$h)!==null&&n!==void 0?n:B?u:d}},Custom:(r,A,e,t)=>{var s;return{ue:(s=H(r(e,t)).O)!==null&&s!==void 0?s:A.color}},Area:(r,A,e,t)=>{var s,i,n,o;const a=H(r(e,t));return{ue:(s=a._t)!==null&&s!==void 0?s:A.lineColor,_t:(i=a._t)!==null&&i!==void 0?i:A.lineColor,Ts:(n=a.Ts)!==null&&n!==void 0?n:A.topColor,Ps:(o=a.Ps)!==null&&o!==void 0?o:A.bottomColor}},Baseline:(r,A,e,t)=>{var s,i,n,o,a,l;const c=H(r(e,t));return{ue:c.Vt[3]>=A.baseValue.price?A.topLineColor:A.bottomLineColor,Pe:(s=c.Pe)!==null&&s!==void 0?s:A.topLineColor,Re:(i=c.Re)!==null&&i!==void 0?i:A.bottomLineColor,Se:(n=c.Se)!==null&&n!==void 0?n:A.topFillColor1,ke:(o=c.ke)!==null&&o!==void 0?o:A.topFillColor2,ye:(a=c.ye)!==null&&a!==void 0?a:A.bottomFillColor1,Ce:(l=c.Ce)!==null&&l!==void 0?l:A.bottomFillColor2}},Line:(r,A,e,t)=>{var s,i;const n=H(r(e,t));return{ue:(s=n.O)!==null&&s!==void 0?s:A.color,_t:(i=n.O)!==null&&i!==void 0?i:A.color}},Histogram:(r,A,e,t)=>{var s;return{ue:(s=H(r(e,t)).O)!==null&&s!==void 0?s:A.color}}};class Xf{constructor(A){this.Uh=(e,t)=>t!==void 0?t.Vt:this.Wr.In().qh(e),this.Wr=A,this.Yh=zf[A.Xh()]}Hs(A,e){return this.Yh(this.Uh,this.Wr.W(),A,e)}}var Ca;(function(r){r[r.NearestLeft=-1]="NearestLeft",r[r.None=0]="None",r[r.NearestRight=1]="NearestRight"})(Ca||(Ca={}));const et=30;class Jf{constructor(){this.Kh=[],this.Zh=new Map,this.Gh=new Map}Jh(){return this.Ks()>0?this.Kh[this.Kh.length-1]:null}Qh(){return this.Ks()>0?this.tl(0):null}Bn(){return this.Ks()>0?this.tl(this.Kh.length-1):null}Ks(){return this.Kh.length}Fi(){return this.Ks()===0}Kr(A){return this.il(A,0)!==null}qh(A){return this.nl(A)}nl(A,e=0){const t=this.il(A,e);return t===null?null:Object.assign(Object.assign({},this.sl(t)),{se:this.tl(t)})}ie(){return this.Kh}el(A,e,t){if(this.Fi())return null;let s=null;for(const i of t)s=Yr(s,this.rl(A,e,i));return s}it(A){this.Gh.clear(),this.Zh.clear(),this.Kh=A}tl(A){return this.Kh[A].se}sl(A){return this.Kh[A]}il(A,e){const t=this.hl(A);if(t===null&&e!==0)switch(e){case-1:return this.ll(A);case 1:return this.al(A);default:throw new TypeError("Unknown search mode")}return t}ll(A){let e=this.ol(A);return e>0&&(e-=1),e!==this.Kh.length&&this.tl(e)<A?e:null}al(A){const e=this._l(A);return e!==this.Kh.length&&A<this.tl(e)?e:null}hl(A){const e=this.ol(A);return e===this.Kh.length||A<this.Kh[e].se?null:e}ol(A){return jt(this.Kh,A,((e,t)=>e.se<t))}_l(A){return la(this.Kh,A,((e,t)=>e.se>t))}ul(A,e,t){let s=null;for(let i=A;i<e;i++){const n=this.Kh[i].Vt[t];Number.isNaN(n)||(s===null?s={cl:n,dl:n}:(n<s.cl&&(s.cl=n),n>s.dl&&(s.dl=n)))}return s}rl(A,e,t){if(this.Fi())return null;let s=null;const i=H(this.Qh()),n=H(this.Bn()),o=Math.max(A,i),a=Math.min(e,n),l=Math.ceil(o/et)*et,c=Math.max(l,Math.floor(a/et)*et);{const d=this.ol(o),g=this._l(Math.min(a,l,e));s=Yr(s,this.ul(d,g,t))}let u=this.Zh.get(t);u===void 0&&(u=new Map,this.Zh.set(t,u));for(let d=Math.max(l+1,o);d<c;d+=et){const g=Math.floor(d/et);let B=u.get(g);if(B===void 0){const f=this.ol(g*et),w=this._l((g+1)*et-1);B=this.ul(f,w,t),u.set(g,B)}s=Yr(s,B)}{const d=this.ol(c),g=this._l(a);s=Yr(s,this.ul(d,g,t))}return s}}function Yr(r,A){return r===null?A:A===null?r:{cl:Math.min(r.cl,A.cl),dl:Math.max(r.dl,A.dl)}}class Zf{constructor(A){this.fl=A}K(A,e,t){this.fl.draw(A)}G(A,e,t){var s,i;(i=(s=this.fl).drawBackground)===null||i===void 0||i.call(s,A)}}class Mi{constructor(A){this.Qe=null,this.wn=A}xt(){var A;const e=this.wn.renderer();if(e===null)return null;if(((A=this.Qe)===null||A===void 0?void 0:A.vl)===e)return this.Qe.pl;const t=new Zf(e);return this.Qe={vl:e,pl:t},t}ml(){var A,e,t;return(t=(e=(A=this.wn).zOrder)===null||e===void 0?void 0:e.call(A))!==null&&t!==void 0?t:"normal"}}function va(r){var A,e,t,s,i;return{Jt:r.text(),yi:r.coordinate(),ki:(A=r.fixedCoordinate)===null||A===void 0?void 0:A.call(r),O:r.textColor(),t:r.backColor(),Tt:(t=(e=r.visible)===null||e===void 0?void 0:e.call(r))===null||t===void 0||t,ai:(i=(s=r.tickVisible)===null||s===void 0?void 0:s.call(r))===null||i===void 0||i}}class Yf{constructor(A,e){this.Ht=new qo,this.bl=A,this.wl=e}xt(){return this.Ht.it(Object.assign({$i:this.wl.$i()},va(this.bl))),this.Ht}}class qf extends Rr{constructor(A,e){super(),this.bl=A,this.Li=e}Ei(A,e,t){const s=va(this.bl);t.t=s.t,A.O=s.O;const i=2/12*this.Li.P();t.gi=i,t.Mi=i,t.yi=s.yi,t.ki=s.ki,A.Jt=s.Jt,A.Tt=s.Tt,A.ai=s.ai}}class $f{constructor(A,e){this.gl=null,this.Ml=null,this.xl=null,this.Sl=null,this.kl=null,this.yl=A,this.Wr=e}Cl(){return this.yl}On(){var A,e;(e=(A=this.yl).updateAllViews)===null||e===void 0||e.call(A)}Pn(){var A,e,t,s;const i=(t=(e=(A=this.yl).paneViews)===null||e===void 0?void 0:e.call(A))!==null&&t!==void 0?t:[];if(((s=this.gl)===null||s===void 0?void 0:s.vl)===i)return this.gl.pl;const n=i.map((o=>new Mi(o)));return this.gl={vl:i,pl:n},n}tn(){var A,e,t,s;const i=(t=(e=(A=this.yl).timeAxisViews)===null||e===void 0?void 0:e.call(A))!==null&&t!==void 0?t:[];if(((s=this.Ml)===null||s===void 0?void 0:s.vl)===i)return this.Ml.pl;const n=this.Wr.qt().yt(),o=i.map((a=>new Yf(a,n)));return this.Ml={vl:i,pl:o},o}Rn(){var A,e,t,s;const i=(t=(e=(A=this.yl).priceAxisViews)===null||e===void 0?void 0:e.call(A))!==null&&t!==void 0?t:[];if(((s=this.xl)===null||s===void 0?void 0:s.vl)===i)return this.xl.pl;const n=this.Wr.At(),o=i.map((a=>new qf(a,n)));return this.xl={vl:i,pl:o},o}Tl(){var A,e,t,s;const i=(t=(e=(A=this.yl).priceAxisPaneViews)===null||e===void 0?void 0:e.call(A))!==null&&t!==void 0?t:[];if(((s=this.Sl)===null||s===void 0?void 0:s.vl)===i)return this.Sl.pl;const n=i.map((o=>new Mi(o)));return this.Sl={vl:i,pl:n},n}Pl(){var A,e,t,s;const i=(t=(e=(A=this.yl).timeAxisPaneViews)===null||e===void 0?void 0:e.call(A))!==null&&t!==void 0?t:[];if(((s=this.kl)===null||s===void 0?void 0:s.vl)===i)return this.kl.pl;const n=i.map((o=>new Mi(o)));return this.kl={vl:i,pl:n},n}Rl(A,e){var t,s,i;return(i=(s=(t=this.yl).autoscaleInfo)===null||s===void 0?void 0:s.call(t,A,e))!==null&&i!==void 0?i:null}br(A,e){var t,s,i;return(i=(s=(t=this.yl).hitTest)===null||s===void 0?void 0:s.call(t,A,e))!==null&&i!==void 0?i:null}}function Di(r,A,e,t){r.forEach((s=>{A(s).forEach((i=>{i.ml()===e&&t.push(i)}))}))}function Oi(r){return r.Pn()}function jf(r){return r.Tl()}function Ad(r){return r.Pl()}class ki extends Wf{constructor(A,e,t,s,i){super(A),this.Lt=new Jf,this.Eh=new Kf(this),this.Dl=[],this.Ol=new Hf(this),this.Al=null,this.Vl=null,this.Bl=[],this.Il=[],this.zl=null,this.El=[],this.cn=e,this.Ll=t;const n=new Vf(this);this.hn=[n],this.Lh=new ua(n,this,A),t!=="Area"&&t!=="Line"&&t!=="Baseline"||(this.Al=new Tf(this)),this.Nl(),this.Fl(i)}S(){this.zl!==null&&clearTimeout(this.zl)}_h(A){return this.cn.priceLineColor||A}Yr(A){const e={Xr:!0},t=this.At();if(this.qt().yt().Fi()||t.Fi()||this.Lt.Fi())return e;const s=this.qt().yt().Xs(),i=this.Pt();if(s===null||i===null)return e;let n,o;if(A){const u=this.Lt.Jh();if(u===null)return e;n=u,o=u.se}else{const u=this.Lt.nl(s.di(),-1);if(u===null||(n=this.Lt.qh(u.se),n===null))return e;o=u.se}const a=n.Vt[3],l=this.$s().Hs(o,{Vt:n}),c=t.Ot(a,i.Vt);return{Xr:!1,ct:a,Jt:t.Wi(a,i.Vt),mh:t.Wl(a),bh:t.jl(a,i.Vt),O:l.ue,yi:c,se:o}}$s(){return this.Vl!==null||(this.Vl=new Xf(this)),this.Vl}W(){return this.cn}Nh(A){const e=A.priceScaleId;e!==void 0&&e!==this.cn.priceScaleId&&this.qt().Hl(this,e),Ue(this.cn,A),A.priceFormat!==void 0&&(this.Nl(),this.qt().$l()),this.qt().Ul(this),this.qt().ql(),this.wn.gt("options")}it(A,e){this.Lt.it(A),this.Yl(),this.wn.gt("data"),this.dn.gt("data"),this.Al!==null&&(e&&e.Xl?this.Al.Hr():A.length===0&&this.Al.jr());const t=this.qt().cr(this);this.qt().Kl(t),this.qt().Ul(this),this.qt().ql(),this.qt().Fh()}Zl(A){this.Bl=A,this.Yl();const e=this.qt().cr(this);this.dn.gt("data"),this.qt().Kl(e),this.qt().Ul(this),this.qt().ql(),this.qt().Fh()}Gl(){return this.Bl}ah(){return this.Il}Jl(A){const e=new Rf(this,A);return this.Dl.push(e),this.qt().Ul(this),e}Ql(A){const e=this.Dl.indexOf(A);e!==-1&&this.Dl.splice(e,1),this.qt().Ul(this)}Xh(){return this.Ll}Pt(){const A=this.ta();return A===null?null:{Vt:A.Vt[3],ia:A.ut}}ta(){const A=this.qt().yt().Xs();if(A===null)return null;const e=A.Os();return this.Lt.nl(e,1)}In(){return this.Lt}oh(A){const e=this.Lt.qh(A);return e===null?null:this.Ll==="Bar"||this.Ll==="Candlestick"||this.Ll==="Custom"?{we:e.Vt[0],ge:e.Vt[1],Me:e.Vt[2],xe:e.Vt[3]}:e.Vt[3]}na(A){const e=[];Di(this.El,Oi,"top",e);const t=this.Al;return t!==null&&t.Tt()&&(this.zl===null&&t.Ur()&&(this.zl=setTimeout((()=>{this.zl=null,this.qt().sa()}),0)),t.$r(),e.push(t)),e}Pn(){const A=[];this.ea()||A.push(this.Ol),A.push(this.wn,this.Eh,this.dn);const e=this.Dl.map((t=>t.Wh()));return A.push(...e),Di(this.El,Oi,"normal",A),A}ra(){return this.ha(Oi,"bottom")}la(A){return this.ha(jf,A)}aa(A){return this.ha(Ad,A)}oa(A,e){return this.El.map((t=>t.br(A,e))).filter((t=>t!==null))}Qi(A){return[this.Lh,...this.Dl.map((e=>e.jh()))]}Rn(A,e){if(e!==this.Xi&&!this.ea())return[];const t=[...this.hn];for(const s of this.Dl)t.push(s.Hh());return this.El.forEach((s=>{t.push(...s.Rn())})),t}tn(){const A=[];return this.El.forEach((e=>{A.push(...e.tn())})),A}Rl(A,e){if(this.cn.autoscaleInfoProvider!==void 0){const t=this.cn.autoscaleInfoProvider((()=>{const s=this._a(A,e);return s===null?null:s.Ph()}));return Zr.Rh(t)}return this._a(A,e)}ua(){return this.cn.priceFormat.minMove}ca(){return this.da}On(){var A;this.wn.gt(),this.dn.gt();for(const e of this.hn)e.gt();for(const e of this.Dl)e.gt();this.Eh.gt(),this.Ol.gt(),(A=this.Al)===null||A===void 0||A.gt(),this.El.forEach((e=>e.On()))}At(){return H(super.At())}Ct(A){if(!((this.Ll==="Line"||this.Ll==="Area"||this.Ll==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const e=this.Lt.qh(A);return e===null?null:{ct:e.Vt[3],ot:this.fa(),Bt:this.va(),Dt:this.pa(),Rt:this.ma(A)}}uh(){return this.cn.title}Tt(){return this.cn.visible}ba(A){this.El.push(new $f(A,this))}wa(A){this.El=this.El.filter((e=>e.Cl()!==A))}ga(){if(this.wn instanceof Ii)return A=>this.wn.Fe(A)}Ma(){if(this.wn instanceof Ii)return A=>this.wn.We(A)}ea(){return!Wr(this.At().xa())}_a(A,e){if(!Yt(A)||!Yt(e)||this.Lt.Fi())return null;const t=this.Ll==="Line"||this.Ll==="Area"||this.Ll==="Baseline"||this.Ll==="Histogram"?[3]:[2,1],s=this.Lt.el(A,e,t);let i=s!==null?new ce(s.cl,s.dl):null;if(this.Xh()==="Histogram"){const o=this.cn.base,a=new ce(o,o);i=i!==null?i.ts(a):a}let n=this.dn.lh();return this.El.forEach((o=>{const a=o.Rl(A,e);if(a?.priceRange){const g=new ce(a.priceRange.minValue,a.priceRange.maxValue);i=i!==null?i.ts(g):g}var l,c,u,d;a?.margins&&(l=n,c=a.margins,n={above:Math.max((u=l?.above)!==null&&u!==void 0?u:0,c.above),below:Math.max((d=l?.below)!==null&&d!==void 0?d:0,c.below)})})),new Zr(i,n)}fa(){switch(this.Ll){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}va(){switch(this.Ll){case"Line":case"Area":case"Baseline":{const A=this.cn.crosshairMarkerBorderColor;if(A.length!==0)return A}}return null}pa(){switch(this.Ll){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}ma(A){switch(this.Ll){case"Line":case"Area":case"Baseline":{const e=this.cn.crosshairMarkerBackgroundColor;if(e.length!==0)return e}}return this.$s().Hs(A).ue}Nl(){switch(this.cn.priceFormat.type){case"custom":this.da={format:this.cn.priceFormat.formatter};break;case"volume":this.da=new of(this.cn.priceFormat.precision);break;case"percent":this.da=new Aa(this.cn.priceFormat.precision);break;default:{const A=Math.pow(10,this.cn.priceFormat.precision);this.da=new zr(A,this.cn.priceFormat.minMove*A)}}this.Xi!==null&&this.Xi.Sa()}Yl(){const A=this.qt().yt();if(!A.ka()||this.Lt.Fi())return void(this.Il=[]);const e=H(this.Lt.Qh());this.Il=this.Bl.map(((t,s)=>{const i=H(A.ya(t.time,!0)),n=i<e?1:-1;return{time:H(this.Lt.nl(i,n)).se,position:t.position,shape:t.shape,color:t.color,id:t.id,Jr:s,text:t.text,size:t.size,originalTime:t.originalTime}}))}Fl(A){switch(this.dn=new Nf(this,this.qt()),this.Ll){case"Bar":this.wn=new gf(this,this.qt());break;case"Candlestick":this.wn=new vf(this,this.qt());break;case"Line":this.wn=new Uf(this,this.qt());break;case"Custom":this.wn=new Ii(this,this.qt(),ie(A));break;case"Area":this.wn=new df(this,this.qt());break;case"Baseline":this.wn=new mf(this,this.qt());break;case"Histogram":this.wn=new yf(this,this.qt());break;default:throw Error("Unknown chart style assigned: "+this.Ll)}}ha(A,e){const t=[];return Di(this.El,A,e,t),t}}class ed{constructor(A){this.cn=A}Ca(A,e,t){let s=A;if(this.cn.mode===0)return s;const i=t.vn(),n=i.Pt();if(n===null)return s;const o=i.Ot(A,n),a=t.Ta().filter((c=>c instanceof ki)).reduce(((c,u)=>{if(t.dr(u)||!u.Tt())return c;const d=u.At(),g=u.In();if(d.Fi()||!g.Kr(e))return c;const B=g.qh(e);if(B===null)return c;const f=xt(u.Pt());return c.concat([d.Ot(B.Vt[3],f.Vt)])}),[]);if(a.length===0)return s;a.sort(((c,u)=>Math.abs(c-o)-Math.abs(u-o)));const l=a[0];return s=i.pn(l,n),s}}class td extends Xe{constructor(){super(...arguments),this.Lt=null}it(A){this.Lt=A}Z({context:A,bitmapSize:e,horizontalPixelRatio:t,verticalPixelRatio:s}){if(this.Lt===null)return;const i=Math.max(1,Math.floor(t));A.lineWidth=i,(function(n,o){n.save(),n.lineWidth%2&&n.translate(.5,.5),o(),n.restore()})(A,(()=>{const n=H(this.Lt);if(n.Pa){A.strokeStyle=n.Ra,Bt(A,n.Da),A.beginPath();for(const o of n.Oa){const a=Math.round(o.Aa*t);A.moveTo(a,-i),A.lineTo(a,e.height+i)}A.stroke()}if(n.Va){A.strokeStyle=n.Ba,Bt(A,n.Ia),A.beginPath();for(const o of n.za){const a=Math.round(o.Aa*s);A.moveTo(-i,a),A.lineTo(e.width+i,a)}A.stroke()}}))}}class rd{constructor(A){this.Ht=new td,this.bt=!0,this.nn=A}gt(){this.bt=!0}xt(){if(this.bt){const A=this.nn.qt().W().grid,e={Va:A.horzLines.visible,Pa:A.vertLines.visible,Ba:A.horzLines.color,Ra:A.vertLines.color,Ia:A.horzLines.style,Da:A.vertLines.style,za:this.nn.vn().Ea(),Oa:(this.nn.qt().yt().Ea()||[]).map((t=>({Aa:t.coord})))};this.Ht.it(e),this.bt=!1}return this.Ht}}class sd{constructor(A){this.wn=new rd(A)}Wh(){return this.wn}}const _i={La:4,Na:1e-4};function Ht(r,A){const e=100*(r-A)/A;return A<0?-e:e}function id(r,A){const e=Ht(r.Sh(),A),t=Ht(r.kh(),A);return new ce(e,t)}function rr(r,A){const e=100*(r-A)/A+100;return A<0?-e:e}function nd(r,A){const e=rr(r.Sh(),A),t=rr(r.kh(),A);return new ce(e,t)}function qr(r,A){const e=Math.abs(r);if(e<1e-15)return 0;const t=Math.log10(e+A.Na)+A.La;return r<0?-t:t}function sr(r,A){const e=Math.abs(r);if(e<1e-15)return 0;const t=Math.pow(10,e-A.La)-A.Na;return r<0?-t:t}function ir(r,A){if(r===null)return null;const e=qr(r.Sh(),A),t=qr(r.kh(),A);return new ce(e,t)}function $r(r,A){if(r===null)return null;const e=sr(r.Sh(),A),t=sr(r.kh(),A);return new ce(e,t)}function Ni(r){if(r===null)return _i;const A=Math.abs(r.kh()-r.Sh());if(A>=1||A<1e-15)return _i;const e=Math.ceil(Math.abs(Math.log10(A))),t=_i.La+e;return{La:t,Na:1/Math.pow(10,t)}}class Ki{constructor(A,e){if(this.Fa=A,this.Wa=e,(function(t){if(t<0)return!1;for(let s=t;s>1;s/=10)if(s%10!=0)return!1;return!0})(this.Fa))this.ja=[2,2.5,2];else{this.ja=[];for(let t=this.Fa;t!==1;){if(t%2==0)this.ja.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this.ja.push(2,2.5),t/=5}if(this.ja.length>100)throw new Error("something wrong with base")}}}Ha(A,e,t){const s=this.Fa===0?0:1/this.Fa;let i=Math.pow(10,Math.max(0,Math.ceil(Math.log10(A-e)))),n=0,o=this.Wa[0];for(;;){const u=Xr(i,s,1e-14)&&i>s+1e-14,d=Xr(i,t*o,1e-14),g=Xr(i,1,1e-14);if(!(u&&d&&g))break;i/=o,o=this.Wa[++n%this.Wa.length]}if(i<=s+1e-14&&(i=s),i=Math.max(1,i),this.ja.length>0&&(a=i,l=1,c=1e-14,Math.abs(a-l)<c))for(n=0,o=this.ja[0];Xr(i,t*o,1e-14)&&i>s+1e-14;)i/=o,o=this.ja[++n%this.ja.length];var a,l,c;return i}}class ba{constructor(A,e,t,s){this.$a=[],this.Li=A,this.Fa=e,this.Ua=t,this.qa=s}Ha(A,e){if(A<e)throw new Error("high < low");const t=this.Li.zt(),s=(A-e)*this.Ya()/t,i=new Ki(this.Fa,[2,2.5,2]),n=new Ki(this.Fa,[2,2,2.5]),o=new Ki(this.Fa,[2.5,2,2]),a=[];return a.push(i.Ha(A,e,s),n.Ha(A,e,s),o.Ha(A,e,s)),(function(l){if(l.length<1)throw Error("array is empty");let c=l[0];for(let u=1;u<l.length;++u)l[u]<c&&(c=l[u]);return c})(a)}Xa(){const A=this.Li,e=A.Pt();if(e===null)return void(this.$a=[]);const t=A.zt(),s=this.Ua(t-1,e),i=this.Ua(0,e),n=this.Li.W().entireTextOnly?this.Ka()/2:0,o=n,a=t-1-n,l=Math.max(s,i),c=Math.min(s,i);if(l===c)return void(this.$a=[]);let u=this.Ha(l,c),d=l%u;d+=d<0?u:0;const g=l>=c?1:-1;let B=null,f=0;for(let w=l-d;w>c;w-=u){const m=this.qa(w,e,!0);B!==null&&Math.abs(m-B)<this.Ya()||m<o||m>a||(f<this.$a.length?(this.$a[f].Aa=m,this.$a[f].Za=A.Ga(w)):this.$a.push({Aa:m,Za:A.Ga(w)}),f++,B=m,A.Ja()&&(u=this.Ha(w*g,c)))}this.$a.length=f}Ea(){return this.$a}Ka(){return this.Li.P()}Ya(){return Math.ceil(2.5*this.Ka())}}function Qa(r){return r.slice().sort(((A,e)=>H(A.Zi())-H(e.Zi())))}var Fa;(function(r){r[r.Normal=0]="Normal",r[r.Logarithmic=1]="Logarithmic",r[r.Percentage=2]="Percentage",r[r.IndexedTo100=3]="IndexedTo100"})(Fa||(Fa={}));const ya=new Aa,Ua=new zr(100,1);class od{constructor(A,e,t,s){this.Qa=0,this.io=null,this.Dh=null,this.no=null,this.so={eo:!1,ro:null},this.ho=0,this.lo=0,this.ao=new KA,this.oo=new KA,this._o=[],this.uo=null,this.co=null,this.do=null,this.fo=null,this.da=Ua,this.vo=Ni(null),this.po=A,this.cn=e,this.mo=t,this.bo=s,this.wo=new ba(this,100,this.Mo.bind(this),this.xo.bind(this))}xa(){return this.po}W(){return this.cn}Nh(A){if(Ue(this.cn,A),this.Sa(),A.mode!==void 0&&this.So({yr:A.mode}),A.scaleMargins!==void 0){const e=ie(A.scaleMargins.top),t=ie(A.scaleMargins.bottom);if(e<0||e>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${e}`);if(t<0||t>1||e+t>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${t}`);if(e+t>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${e+t}`);this.ko(),this.co=null}}yo(){return this.cn.autoScale}Ja(){return this.cn.mode===1}ph(){return this.cn.mode===2}Co(){return this.cn.mode===3}yr(){return{Wn:this.cn.autoScale,To:this.cn.invertScale,yr:this.cn.mode}}So(A){const e=this.yr();let t=null;A.Wn!==void 0&&(this.cn.autoScale=A.Wn),A.yr!==void 0&&(this.cn.mode=A.yr,A.yr!==2&&A.yr!==3||(this.cn.autoScale=!0),this.so.eo=!1),e.yr===1&&A.yr!==e.yr&&((function(i,n){if(i===null)return!1;const o=sr(i.Sh(),n),a=sr(i.kh(),n);return isFinite(o)&&isFinite(a)})(this.Dh,this.vo)?(t=$r(this.Dh,this.vo),t!==null&&this.Po(t)):this.cn.autoScale=!0),A.yr===1&&A.yr!==e.yr&&(t=ir(this.Dh,this.vo),t!==null&&this.Po(t));const s=e.yr!==this.cn.mode;s&&(e.yr===2||this.ph())&&this.Sa(),s&&(e.yr===3||this.Co())&&this.Sa(),A.To!==void 0&&e.To!==A.To&&(this.cn.invertScale=A.To,this.Ro()),this.oo.m(e,this.yr())}Do(){return this.oo}P(){return this.mo.fontSize}zt(){return this.Qa}Oo(A){this.Qa!==A&&(this.Qa=A,this.ko(),this.co=null)}Ao(){if(this.io)return this.io;const A=this.zt()-this.Vo()-this.Bo();return this.io=A,A}Ah(){return this.Io(),this.Dh}Po(A,e){const t=this.Dh;(e||t===null&&A!==null||t!==null&&!t.Mh(A))&&(this.co=null,this.Dh=A)}Fi(){return this.Io(),this.Qa===0||!this.Dh||this.Dh.Fi()}zo(A){return this.To()?A:this.zt()-1-A}Ot(A,e){return this.ph()?A=Ht(A,e):this.Co()&&(A=rr(A,e)),this.xo(A,e)}Qs(A,e,t){this.Io();const s=this.Bo(),i=H(this.Ah()),n=i.Sh(),o=i.kh(),a=this.Ao()-1,l=this.To(),c=a/(o-n),u=t===void 0?0:t.from,d=t===void 0?A.length:t.to,g=this.Eo();for(let B=u;B<d;B++){const f=A[B],w=f.ct;if(isNaN(w))continue;let m=w;g!==null&&(m=g(f.ct,e));const p=s+c*(m-n),v=l?p:this.Qa-1-p;f.rt=v}}me(A,e,t){this.Io();const s=this.Bo(),i=H(this.Ah()),n=i.Sh(),o=i.kh(),a=this.Ao()-1,l=this.To(),c=a/(o-n),u=t===void 0?0:t.from,d=t===void 0?A.length:t.to,g=this.Eo();for(let B=u;B<d;B++){const f=A[B];let w=f.we,m=f.ge,p=f.Me,v=f.xe;g!==null&&(w=g(f.we,e),m=g(f.ge,e),p=g(f.Me,e),v=g(f.xe,e));let y=s+c*(w-n),E=l?y:this.Qa-1-y;f.ve=E,y=s+c*(m-n),E=l?y:this.Qa-1-y,f.ce=E,y=s+c*(p-n),E=l?y:this.Qa-1-y,f.de=E,y=s+c*(v-n),E=l?y:this.Qa-1-y,f.pe=E}}pn(A,e){const t=this.Mo(A,e);return this.Lo(t,e)}Lo(A,e){let t=A;return this.ph()?t=(function(s,i){return i<0&&(s=-s),s/100*i+i})(t,e):this.Co()&&(t=(function(s,i){return s-=100,i<0&&(s=-s),s/100*i+i})(t,e)),t}Ta(){return this._o}No(){if(this.uo)return this.uo;let A=[];for(let e=0;e<this._o.length;e++){const t=this._o[e];t.Zi()===null&&t.Gi(e+1),A.push(t)}return A=Qa(A),this.uo=A,this.uo}Fo(A){this._o.indexOf(A)===-1&&(this._o.push(A),this.Sa(),this.Wo())}jo(A){const e=this._o.indexOf(A);if(e===-1)throw new Error("source is not attached to scale");this._o.splice(e,1),this._o.length===0&&(this.So({Wn:!0}),this.Po(null)),this.Sa(),this.Wo()}Pt(){let A=null;for(const e of this._o){const t=e.Pt();t!==null&&(A===null||t.ia<A.ia)&&(A=t)}return A===null?null:A.Vt}To(){return this.cn.invertScale}Ea(){const A=this.Pt()===null;if(this.co!==null&&(A||this.co.Ho===A))return this.co.Ea;this.wo.Xa();const e=this.wo.Ea();return this.co={Ea:e,Ho:A},this.ao.m(),e}$o(){return this.ao}Uo(A){this.ph()||this.Co()||this.do===null&&this.no===null&&(this.Fi()||(this.do=this.Qa-A,this.no=H(this.Ah()).xh()))}qo(A){if(this.ph()||this.Co()||this.do===null)return;this.So({Wn:!1}),(A=this.Qa-A)<0&&(A=0);let e=(this.do+.2*(this.Qa-1))/(A+.2*(this.Qa-1));const t=H(this.no).xh();e=Math.max(e,.1),t.Ch(e),this.Po(t)}Yo(){this.ph()||this.Co()||(this.do=null,this.no=null)}Xo(A){this.yo()||this.fo===null&&this.no===null&&(this.Fi()||(this.fo=A,this.no=H(this.Ah()).xh()))}Ko(A){if(this.yo()||this.fo===null)return;const e=H(this.Ah()).yh()/(this.Ao()-1);let t=A-this.fo;this.To()&&(t*=-1);const s=t*e,i=H(this.no).xh();i.Th(s),this.Po(i,!0),this.co=null}Zo(){this.yo()||this.fo!==null&&(this.fo=null,this.no=null)}ca(){return this.da||this.Sa(),this.da}Wi(A,e){switch(this.cn.mode){case 2:return this.Go(Ht(A,e));case 3:return this.ca().format(rr(A,e));default:return this.zh(A)}}Ga(A){switch(this.cn.mode){case 2:return this.Go(A);case 3:return this.ca().format(A);default:return this.zh(A)}}Wl(A){return this.zh(A,H(this.Jo()).ca())}jl(A,e){return A=Ht(A,e),this.Go(A,ya)}Qo(){return this._o}t_(A){this.so={ro:A,eo:!1}}On(){this._o.forEach((A=>A.On()))}Sa(){this.co=null;const A=this.Jo();let e=100;A!==null&&(e=Math.round(1/A.ua())),this.da=Ua,this.ph()?(this.da=ya,e=100):this.Co()?(this.da=new zr(100,1),e=100):A!==null&&(this.da=A.ca()),this.wo=new ba(this,e,this.Mo.bind(this),this.xo.bind(this)),this.wo.Xa()}Wo(){this.uo=null}Jo(){return this._o[0]||null}Vo(){return this.To()?this.cn.scaleMargins.bottom*this.zt()+this.lo:this.cn.scaleMargins.top*this.zt()+this.ho}Bo(){return this.To()?this.cn.scaleMargins.top*this.zt()+this.ho:this.cn.scaleMargins.bottom*this.zt()+this.lo}Io(){this.so.eo||(this.so.eo=!0,this.i_())}ko(){this.io=null}xo(A,e){if(this.Io(),this.Fi())return 0;A=this.Ja()&&A?qr(A,this.vo):A;const t=H(this.Ah()),s=this.Bo()+(this.Ao()-1)*(A-t.Sh())/t.yh();return this.zo(s)}Mo(A,e){if(this.Io(),this.Fi())return 0;const t=this.zo(A),s=H(this.Ah()),i=s.Sh()+s.yh()*((t-this.Bo())/(this.Ao()-1));return this.Ja()?sr(i,this.vo):i}Ro(){this.co=null,this.wo.Xa()}i_(){const A=this.so.ro;if(A===null)return;let e=null;const t=this.Qo();let s=0,i=0;for(const a of t){if(!a.Tt())continue;const l=a.Pt();if(l===null)continue;const c=a.Rl(A.Os(),A.di());let u=c&&c.Ah();if(u!==null){switch(this.cn.mode){case 1:u=ir(u,this.vo);break;case 2:u=id(u,l.Vt);break;case 3:u=nd(u,l.Vt)}if(e=e===null?u:e.ts(H(u)),c!==null){const d=c.Vh();d!==null&&(s=Math.max(s,d.above),i=Math.max(s,d.below))}}}if(s===this.ho&&i===this.lo||(this.ho=s,this.lo=i,this.co=null,this.ko()),e!==null){if(e.Sh()===e.kh()){const a=this.Jo(),l=5*(a===null||this.ph()||this.Co()?1:a.ua());this.Ja()&&(e=$r(e,this.vo)),e=new ce(e.Sh()-l,e.kh()+l),this.Ja()&&(e=ir(e,this.vo))}if(this.Ja()){const a=$r(e,this.vo),l=Ni(a);if(n=l,o=this.vo,n.La!==o.La||n.Na!==o.Na){const c=this.no!==null?$r(this.no,this.vo):null;this.vo=l,e=ir(a,l),c!==null&&(this.no=ir(c,l))}}this.Po(e)}else this.Dh===null&&(this.Po(new ce(-.5,.5)),this.vo=Ni(null));var n,o;this.so.eo=!0}Eo(){return this.ph()?Ht:this.Co()?rr:this.Ja()?A=>qr(A,this.vo):null}n_(A,e,t){return e===void 0?(t===void 0&&(t=this.ca()),t.format(A)):e(A)}zh(A,e){return this.n_(A,this.bo.priceFormatter,e)}Go(A,e){return this.n_(A,this.bo.percentageFormatter,e)}}class ad{constructor(A,e){this._o=[],this.s_=new Map,this.Qa=0,this.e_=0,this.r_=1e3,this.uo=null,this.h_=new KA,this.wl=A,this.Ui=e,this.l_=new sd(this);const t=e.W();this.a_=this.o_("left",t.leftPriceScale),this.__=this.o_("right",t.rightPriceScale),this.a_.Do().l(this.u_.bind(this,this.a_),this),this.__.Do().l(this.u_.bind(this,this.__),this),this.c_(t)}c_(A){if(A.leftPriceScale&&this.a_.Nh(A.leftPriceScale),A.rightPriceScale&&this.__.Nh(A.rightPriceScale),A.localization&&(this.a_.Sa(),this.__.Sa()),A.overlayPriceScales){const e=Array.from(this.s_.values());for(const t of e){const s=H(t[0].At());s.Nh(A.overlayPriceScales),A.localization&&s.Sa()}}}d_(A){switch(A){case"left":return this.a_;case"right":return this.__}return this.s_.has(A)?ie(this.s_.get(A))[0].At():null}S(){this.qt().f_().p(this),this.a_.Do().p(this),this.__.Do().p(this),this._o.forEach((A=>{A.S&&A.S()})),this.h_.m()}v_(){return this.r_}p_(A){this.r_=A}qt(){return this.Ui}$i(){return this.e_}zt(){return this.Qa}m_(A){this.e_=A,this.b_()}Oo(A){this.Qa=A,this.a_.Oo(A),this.__.Oo(A),this._o.forEach((e=>{if(this.dr(e)){const t=e.At();t!==null&&t.Oo(A)}})),this.b_()}Ta(){return this._o}dr(A){const e=A.At();return e===null||this.a_!==e&&this.__!==e}Fo(A,e,t){const s=t!==void 0?t:this.g_().w_+1;this.M_(A,e,s)}jo(A){const e=this._o.indexOf(A);At(e!==-1,"removeDataSource: invalid data source"),this._o.splice(e,1);const t=H(A.At()).xa();if(this.s_.has(t)){const i=ie(this.s_.get(t)),n=i.indexOf(A);n!==-1&&(i.splice(n,1),i.length===0&&this.s_.delete(t))}const s=A.At();s&&s.Ta().indexOf(A)>=0&&s.jo(A),s!==null&&(s.Wo(),this.x_(s)),this.uo=null}pr(A){return A===this.a_?"left":A===this.__?"right":"overlay"}S_(){return this.a_}k_(){return this.__}y_(A,e){A.Uo(e)}C_(A,e){A.qo(e),this.b_()}T_(A){A.Yo()}P_(A,e){A.Xo(e)}R_(A,e){A.Ko(e),this.b_()}D_(A){A.Zo()}b_(){this._o.forEach((A=>{A.On()}))}vn(){let A=null;return this.Ui.W().rightPriceScale.visible&&this.__.Ta().length!==0?A=this.__:this.Ui.W().leftPriceScale.visible&&this.a_.Ta().length!==0?A=this.a_:this._o.length!==0&&(A=this._o[0].At()),A===null&&(A=this.__),A}vr(){let A=null;return this.Ui.W().rightPriceScale.visible?A=this.__:this.Ui.W().leftPriceScale.visible&&(A=this.a_),A}x_(A){A!==null&&A.yo()&&this.O_(A)}A_(A){const e=this.wl.Xs();A.So({Wn:!0}),e!==null&&A.t_(e),this.b_()}V_(){this.O_(this.a_),this.O_(this.__)}B_(){this.x_(this.a_),this.x_(this.__),this._o.forEach((A=>{this.dr(A)&&this.x_(A.At())})),this.b_(),this.Ui.Fh()}No(){return this.uo===null&&(this.uo=Qa(this._o)),this.uo}I_(){return this.h_}z_(){return this.l_}O_(A){const e=A.Qo();if(e&&e.length>0&&!this.wl.Fi()){const t=this.wl.Xs();t!==null&&A.t_(t)}A.On()}g_(){const A=this.No();if(A.length===0)return{E_:0,w_:0};let e=0,t=0;for(let s=0;s<A.length;s++){const i=A[s].Zi();i!==null&&(i<e&&(e=i),i>t&&(t=i))}return{E_:e,w_:t}}M_(A,e,t){let s=this.d_(e);if(s===null&&(s=this.o_(e,this.Ui.W().overlayPriceScales)),this._o.push(A),!Wr(e)){const i=this.s_.get(e)||[];i.push(A),this.s_.set(e,i)}s.Fo(A),A.Ji(s),A.Gi(t),this.x_(s),this.uo=null}u_(A,e,t){e.yr!==t.yr&&this.O_(A)}o_(A,e){const t=Object.assign({visible:!0,autoScale:!0},ze(e)),s=new od(A,t,this.Ui.W().layout,this.Ui.W().localization);return s.Oo(this.zt()),s}}class ld{constructor(A,e,t=50){this.Ke=0,this.Ze=1,this.Ge=1,this.Qe=new Map,this.Je=new Map,this.L_=A,this.N_=e,this.tr=t}F_(A){const e=A.time,t=this.N_.cacheKey(e),s=this.Qe.get(t);if(s!==void 0)return s.W_;if(this.Ke===this.tr){const n=this.Je.get(this.Ge);this.Je.delete(this.Ge),this.Qe.delete(ie(n)),this.Ge++,this.Ke--}const i=this.L_(A);return this.Qe.set(t,{W_:i,er:this.Ze}),this.Je.set(this.Ze,t),this.Ke++,this.Ze++,i}}class nr{constructor(A,e){At(A<=e,"right should be >= left"),this.j_=A,this.H_=e}Os(){return this.j_}di(){return this.H_}U_(){return this.H_-this.j_+1}Kr(A){return this.j_<=A&&A<=this.H_}Mh(A){return this.j_===A.Os()&&this.H_===A.di()}}function Ea(r,A){return r===null||A===null?r===A:r.Mh(A)}class cd{constructor(){this.q_=new Map,this.Qe=null,this.Y_=!1}X_(A){this.Y_=A,this.Qe=null}K_(A,e){this.Z_(e),this.Qe=null;for(let t=e;t<A.length;++t){const s=A[t];let i=this.q_.get(s.timeWeight);i===void 0&&(i=[],this.q_.set(s.timeWeight,i)),i.push({index:t,time:s.time,weight:s.timeWeight,originalTime:s.originalTime})}}G_(A,e){const t=Math.ceil(e/A);return this.Qe!==null&&this.Qe.J_===t||(this.Qe={Ea:this.Q_(t),J_:t}),this.Qe.Ea}Z_(A){if(A===0)return void this.q_.clear();const e=[];this.q_.forEach(((t,s)=>{A<=t[0].index?e.push(s):t.splice(jt(t,A,(i=>i.index<A)),1/0)}));for(const t of e)this.q_.delete(t)}Q_(A){let e=[];for(const t of Array.from(this.q_.keys()).sort(((s,i)=>i-s))){if(!this.q_.get(t))continue;const s=e;e=[];const i=s.length;let n=0;const o=ie(this.q_.get(t)),a=o.length;let l=1/0,c=-1/0;for(let u=0;u<a;u++){const d=o[u],g=d.index;for(;n<i;){const B=s[n],f=B.index;if(!(f<g)){l=f;break}n++,e.push(B),c=f,l=1/0}if(l-g>=A&&g-c>=A)e.push(d),c=g;else if(this.Y_)return s}for(;n<i;n++)e.push(s[n])}return e}}class Lt{constructor(A){this.tu=A}iu(){return this.tu===null?null:new nr(Math.floor(this.tu.Os()),Math.ceil(this.tu.di()))}nu(){return this.tu}static su(){return new Lt(null)}}function hd(r,A){return r.weight>A.weight?r:A}class ud{constructor(A,e,t,s){this.e_=0,this.eu=null,this.ru=[],this.fo=null,this.do=null,this.hu=new cd,this.lu=new Map,this.au=Lt.su(),this.ou=!0,this._u=new KA,this.uu=new KA,this.cu=new KA,this.du=null,this.fu=null,this.vu=[],this.cn=e,this.bo=t,this.pu=e.rightOffset,this.mu=e.barSpacing,this.Ui=A,this.N_=s,this.bu(),this.hu.X_(e.uniformDistribution)}W(){return this.cn}wu(A){Ue(this.bo,A),this.gu(),this.bu()}Nh(A,e){var t;Ue(this.cn,A),this.cn.fixLeftEdge&&this.Mu(),this.cn.fixRightEdge&&this.xu(),A.barSpacing!==void 0&&this.Ui.Gn(A.barSpacing),A.rightOffset!==void 0&&this.Ui.Jn(A.rightOffset),A.minBarSpacing!==void 0&&this.Ui.Gn((t=A.barSpacing)!==null&&t!==void 0?t:this.mu),this.gu(),this.bu(),this.cu.m()}mn(A){var e,t;return(t=(e=this.ru[A])===null||e===void 0?void 0:e.time)!==null&&t!==void 0?t:null}qi(A){var e;return(e=this.ru[A])!==null&&e!==void 0?e:null}ya(A,e){if(this.ru.length<1)return null;if(this.N_.key(A)>this.N_.key(this.ru[this.ru.length-1].time))return e?this.ru.length-1:null;const t=jt(this.ru,this.N_.key(A),((s,i)=>this.N_.key(s.time)<i));return this.N_.key(A)<this.N_.key(this.ru[t].time)?e?t:null:t}Fi(){return this.e_===0||this.ru.length===0||this.eu===null}ka(){return this.ru.length>0}Xs(){return this.Su(),this.au.iu()}ku(){return this.Su(),this.au.nu()}yu(){const A=this.Xs();if(A===null)return null;const e={from:A.Os(),to:A.di()};return this.Cu(e)}Cu(A){const e=Math.round(A.from),t=Math.round(A.to),s=H(this.Tu()),i=H(this.Bn());return{from:H(this.qi(Math.max(s,e))),to:H(this.qi(Math.min(i,t)))}}Pu(A){return{from:H(this.ya(A.from,!0)),to:H(this.ya(A.to,!0))}}$i(){return this.e_}m_(A){if(!isFinite(A)||A<=0||this.e_===A)return;const e=this.ku(),t=this.e_;if(this.e_=A,this.ou=!0,this.cn.lockVisibleTimeRangeOnResize&&t!==0){const s=this.mu*A/t;this.mu=s}if(this.cn.fixLeftEdge&&e!==null&&e.Os()<=0){const s=t-A;this.pu-=Math.round(s/this.mu)+1,this.ou=!0}this.Ru(),this.Du()}Et(A){if(this.Fi()||!Yt(A))return 0;const e=this.Ou()+this.pu-A;return this.e_-(e+.5)*this.mu-1}Js(A,e){const t=this.Ou(),s=e===void 0?0:e.from,i=e===void 0?A.length:e.to;for(let n=s;n<i;n++){const o=A[n].ut,a=t+this.pu-o,l=this.e_-(a+.5)*this.mu-1;A[n].et=l}}Au(A){return Math.ceil(this.Vu(A))}Jn(A){this.ou=!0,this.pu=A,this.Du(),this.Ui.Bu(),this.Ui.Fh()}he(){return this.mu}Gn(A){this.Iu(A),this.Du(),this.Ui.Bu(),this.Ui.Fh()}zu(){return this.pu}Ea(){if(this.Fi())return null;if(this.fu!==null)return this.fu;const A=this.mu,e=5*(this.Ui.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),t=Math.round(e/A),s=H(this.Xs()),i=Math.max(s.Os(),s.Os()-t),n=Math.max(s.di(),s.di()-t),o=this.hu.G_(A,e),a=this.Tu()+t,l=this.Bn()-t,c=this.Eu(),u=this.cn.fixLeftEdge||c,d=this.cn.fixRightEdge||c;let g=0;for(const B of o){if(!(i<=B.index&&B.index<=n))continue;let f;g<this.vu.length?(f=this.vu[g],f.coord=this.Et(B.index),f.label=this.Lu(B),f.weight=B.weight):(f={needAlignCoordinate:!1,coord:this.Et(B.index),label:this.Lu(B),weight:B.weight},this.vu.push(f)),this.mu>e/2&&!c?f.needAlignCoordinate=!1:f.needAlignCoordinate=u&&B.index<=a||d&&B.index>=l,g++}return this.vu.length=g,this.fu=this.vu,this.vu}Nu(){this.ou=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Fu(A){this.ou=!0,this.eu=A,this.Du(),this.Mu()}Wu(A,e){const t=this.Vu(A),s=this.he(),i=s+e*(s/10);this.Gn(i),this.cn.rightBarStaysOnScroll||this.Jn(this.zu()+(t-this.Vu(A)))}Uo(A){this.fo&&this.Zo(),this.do===null&&this.du===null&&(this.Fi()||(this.do=A,this.ju()))}qo(A){if(this.du===null)return;const e=Si(this.e_-A,0,this.e_),t=Si(this.e_-H(this.do),0,this.e_);e!==0&&t!==0&&this.Gn(this.du.he*e/t)}Yo(){this.do!==null&&(this.do=null,this.Hu())}Xo(A){this.fo===null&&this.du===null&&(this.Fi()||(this.fo=A,this.ju()))}Ko(A){if(this.fo===null)return;const e=(this.fo-A)/this.he();this.pu=H(this.du).zu+e,this.ou=!0,this.Du()}Zo(){this.fo!==null&&(this.fo=null,this.Hu())}$u(){this.Uu(this.cn.rightOffset)}Uu(A,e=400){if(!isFinite(A))throw new RangeError("offset is required and must be finite number");if(!isFinite(e)||e<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const t=this.pu,s=performance.now();this.Ui.Xn({qu:i=>(i-s)/e>=1,Yu:i=>{const n=(i-s)/e;return n>=1?A:t+(A-t)*n}})}gt(A,e){this.ou=!0,this.ru=A,this.hu.K_(A,e),this.Du()}Xu(){return this._u}Ku(){return this.uu}Zu(){return this.cu}Ou(){return this.eu||0}Gu(A){const e=A.U_();this.Iu(this.e_/e),this.pu=A.di()-this.Ou(),this.Du(),this.ou=!0,this.Ui.Bu(),this.Ui.Fh()}Ju(){const A=this.Tu(),e=this.Bn();A!==null&&e!==null&&this.Gu(new nr(A,e+this.cn.rightOffset))}Qu(A){const e=new nr(A.from,A.to);this.Gu(e)}Yi(A){return this.bo.timeFormatter!==void 0?this.bo.timeFormatter(A.originalTime):this.N_.formatHorzItem(A.time)}Bn(){return this.ru.length===0?null:this.ru.length-1}Eu(){const{handleScroll:A,handleScale:e}=this.Ui.W();return!(A.horzTouchDrag||A.mouseWheel||A.pressedMouseMove||A.vertTouchDrag||e.axisDoubleClickReset.time||e.axisPressedMouseMove.time||e.mouseWheel||e.pinch)}Tu(){return this.ru.length===0?null:0}tc(A){return(this.e_-1-A)/this.mu}Vu(A){const e=this.tc(A),t=this.Ou()+this.pu-e;return Math.round(1e6*t)/1e6}Iu(A){const e=this.mu;this.mu=A,this.Ru(),e!==this.mu&&(this.ou=!0,this.ic())}Su(){if(!this.ou)return;if(this.ou=!1,this.Fi())return void this.nc(Lt.su());const A=this.Ou(),e=this.e_/this.mu,t=this.pu+A,s=new nr(t-e+1,t);this.nc(new Lt(s))}Ru(){const A=this.sc();if(this.mu<A&&(this.mu=A,this.ou=!0),this.e_!==0){const e=.5*this.e_;this.mu>e&&(this.mu=e,this.ou=!0)}}sc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.ru.length!==0?this.e_/this.ru.length:this.cn.minBarSpacing}Du(){const A=this.ec();this.pu>A&&(this.pu=A,this.ou=!0);const e=this.rc();e!==null&&this.pu<e&&(this.pu=e,this.ou=!0)}rc(){const A=this.Tu(),e=this.eu;return A===null||e===null?null:A-e-1+(this.cn.fixLeftEdge?this.e_/this.mu:Math.min(2,this.ru.length))}ec(){return this.cn.fixRightEdge?0:this.e_/this.mu-Math.min(2,this.ru.length)}ju(){this.du={he:this.he(),zu:this.zu()}}Hu(){this.du=null}Lu(A){let e=this.lu.get(A.weight);return e===void 0&&(e=new ld((t=>this.hc(t)),this.N_),this.lu.set(A.weight,e)),e.F_(A)}hc(A){return this.N_.formatTickmark(A,this.bo)}nc(A){const e=this.au;this.au=A,Ea(e.iu(),this.au.iu())||this._u.m(),Ea(e.nu(),this.au.nu())||this.uu.m(),this.ic()}ic(){this.fu=null}gu(){this.ic(),this.lu.clear()}bu(){this.N_.updateFormatter(this.bo)}Mu(){if(!this.cn.fixLeftEdge)return;const A=this.Tu();if(A===null)return;const e=this.Xs();if(e===null)return;const t=e.Os()-A;if(t<0){const s=this.pu-t-1;this.Jn(s)}this.Ru()}xu(){this.Du(),this.Ru()}}class fd extends yi{constructor(A){super(),this.lc=new Map,this.Lt=A}Z(A){}J(A){if(!this.Lt.Tt)return;const{context:e,mediaSize:t}=A;let s=0;for(const n of this.Lt.ac){if(n.Jt.length===0)continue;e.font=n.R;const o=this.oc(e,n.Jt);o>t.width?n.Wu=t.width/o:n.Wu=1,s+=n._c*n.Wu}let i=0;switch(this.Lt.uc){case"top":i=0;break;case"center":i=Math.max((t.height-s)/2,0);break;case"bottom":i=Math.max(t.height-s,0)}e.fillStyle=this.Lt.O;for(const n of this.Lt.ac){e.save();let o=0;switch(this.Lt.cc){case"left":e.textAlign="left",o=n._c/2;break;case"center":e.textAlign="center",o=t.width/2;break;case"right":e.textAlign="right",o=t.width-1-n._c/2}e.translate(o,i),e.textBaseline="top",e.font=n.R,e.scale(n.Wu,n.Wu),e.fillText(n.Jt,0,n.dc),e.restore(),i+=n._c*n.Wu}}oc(A,e){const t=this.fc(A.font);let s=t.get(e);return s===void 0&&(s=A.measureText(e).width,t.set(e,s)),s}fc(A){let e=this.lc.get(A);return e===void 0&&(e=new Map,this.lc.set(A,e)),e}}class dd{constructor(A){this.bt=!0,this.jt={Tt:!1,O:"",ac:[],uc:"center",cc:"center"},this.Ht=new fd(this.jt),this.$t=A}gt(){this.bt=!0}xt(){return this.bt&&(this.St(),this.bt=!1),this.Ht}St(){const A=this.$t.W(),e=this.jt;e.Tt=A.visible,e.Tt&&(e.O=A.color,e.cc=A.horzAlign,e.uc=A.vertAlign,e.ac=[{Jt:A.text,R:St(A.fontSize,A.fontFamily,A.fontStyle),_c:1.2*A.fontSize,dc:0,Wu:0}])}}class Bd extends Ei{constructor(A,e){super(),this.cn=e,this.wn=new dd(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}On(){this.wn.gt()}}var xa,Sa,Ha,La,Ia;(function(r){r[r.OnTouchEnd=0]="OnTouchEnd",r[r.OnNextTap=1]="OnNextTap"})(xa||(xa={}));class gd{constructor(A,e,t){this.vc=[],this.mc=[],this.e_=0,this.bc=null,this.wc=new KA,this.gc=new KA,this.Mc=null,this.xc=A,this.cn=e,this.N_=t,this.Sc=new Ju(this),this.wl=new ud(this,e.timeScale,this.cn.localization,t),this.wt=new nf(this,e.crosshair),this.kc=new ed(e.crosshair),this.yc=new Bd(this,e.watermark),this.Cc(),this.vc[0].p_(2e3),this.Tc=this.Pc(0),this.Rc=this.Pc(1)}$l(){this.Dc(YA.es())}Fh(){this.Dc(YA.ss())}sa(){this.Dc(new YA(1))}Ul(A){const e=this.Oc(A);this.Dc(e)}Ac(){return this.bc}Vc(A){const e=this.bc;this.bc=A,e!==null&&this.Ul(e.Bc),A!==null&&this.Ul(A.Bc)}W(){return this.cn}Nh(A){Ue(this.cn,A),this.vc.forEach((e=>e.c_(A))),A.timeScale!==void 0&&this.wl.Nh(A.timeScale),A.localization!==void 0&&this.wl.wu(A.localization),(A.leftPriceScale||A.rightPriceScale)&&this.wc.m(),this.Tc=this.Pc(0),this.Rc=this.Pc(1),this.$l()}Ic(A,e){if(A==="left")return void this.Nh({leftPriceScale:e});if(A==="right")return void this.Nh({rightPriceScale:e});const t=this.zc(A);t!==null&&(t.At.Nh(e),this.wc.m())}zc(A){for(const e of this.vc){const t=e.d_(A);if(t!==null)return{Ut:e,At:t}}return null}yt(){return this.wl}Ec(){return this.vc}Lc(){return this.yc}Nc(){return this.wt}Fc(){return this.gc}Wc(A,e){A.Oo(e),this.Bu()}m_(A){this.e_=A,this.wl.m_(this.e_),this.vc.forEach((e=>e.m_(A))),this.Bu()}Cc(A){const e=new ad(this.wl,this);A!==void 0?this.vc.splice(A,0,e):this.vc.push(e);const t=A===void 0?this.vc.length-1:A,s=YA.es();return s.Nn(t,{Fn:0,Wn:!0}),this.Dc(s),e}y_(A,e,t){A.y_(e,t)}C_(A,e,t){A.C_(e,t),this.ql(),this.Dc(this.jc(A,2))}T_(A,e){A.T_(e),this.Dc(this.jc(A,2))}P_(A,e,t){e.yo()||A.P_(e,t)}R_(A,e,t){e.yo()||(A.R_(e,t),this.ql(),this.Dc(this.jc(A,2)))}D_(A,e){e.yo()||(A.D_(e),this.Dc(this.jc(A,2)))}A_(A,e){A.A_(e),this.Dc(this.jc(A,2))}Hc(A){this.wl.Uo(A)}$c(A,e){const t=this.yt();if(t.Fi()||e===0)return;const s=t.$i();A=Math.max(1,Math.min(A,s)),t.Wu(A,e),this.Bu()}Uc(A){this.qc(0),this.Yc(A),this.Xc()}Kc(A){this.wl.qo(A),this.Bu()}Zc(){this.wl.Yo(),this.Fh()}qc(A){this.wl.Xo(A)}Yc(A){this.wl.Ko(A),this.Bu()}Xc(){this.wl.Zo(),this.Fh()}Mt(){return this.mc}Gc(A,e,t,s,i){this.wt.gn(A,e);let n=NaN,o=this.wl.Au(A);const a=this.wl.Xs();a!==null&&(o=Math.min(Math.max(a.Os(),o),a.di()));const l=s.vn(),c=l.Pt();c!==null&&(n=l.pn(e,c)),n=this.kc.Ca(n,o,s),this.wt.kn(o,n,s),this.sa(),i||this.gc.m(this.wt.kt(),{x:A,y:e},t)}Jc(A,e,t){const s=t.vn(),i=s.Pt(),n=s.Ot(A,H(i)),o=this.wl.ya(e,!0),a=this.wl.Et(H(o));this.Gc(a,n,null,t,!0)}Qc(A){this.Nc().Cn(),this.sa(),A||this.gc.m(null,null,null)}ql(){const A=this.wt.Ut();if(A!==null){const e=this.wt.xn(),t=this.wt.Sn();this.Gc(e,t,null,A)}this.wt.On()}td(A,e,t){const s=this.wl.mn(0),i=this.wl.Bn();e!==void 0&&t!==void 0&&this.wl.gt(e,t);const n=this.wl.mn(0),o=this.wl.Ou(),a=this.wl.Xs();if(a!==null&&s!==null&&n!==null){const l=a.Kr(o),c=this.N_.key(s)>this.N_.key(n),u=A!==null&&A>o&&!c,d=this.wl.Bn(),g=l&&d!==i&&this.wl.W().shiftVisibleRangeOnNewBar;if(u&&!g){const B=A-o;this.wl.Jn(this.wl.zu()-B)}}this.wl.Fu(A)}Kl(A){A!==null&&A.B_()}cr(A){const e=this.vc.find((t=>t.No().includes(A)));return e===void 0?null:e}Bu(){this.yc.On(),this.vc.forEach((A=>A.B_())),this.ql()}S(){this.vc.forEach((A=>A.S())),this.vc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}nd(){return this.Sc}mr(){return this.Sc.W()}f_(){return this.wc}sd(A,e,t){const s=this.vc[0],i=this.ed(e,A,s,t);return this.mc.push(i),this.mc.length===1?this.$l():this.Fh(),i}rd(A){const e=this.cr(A),t=this.mc.indexOf(A);At(t!==-1,"Series not found"),this.mc.splice(t,1),H(e).jo(A),A.S&&A.S()}Hl(A,e){const t=H(this.cr(A));t.jo(A);const s=this.zc(e);if(s===null){const i=A.Zi();t.Fo(A,e,i)}else{const i=s.Ut===t?A.Zi():void 0;s.Ut.Fo(A,e,i)}}Ju(){const A=YA.ss();A.$n(),this.Dc(A)}hd(A){const e=YA.ss();e.Yn(A),this.Dc(e)}Zn(){const A=YA.ss();A.Zn(),this.Dc(A)}Gn(A){const e=YA.ss();e.Gn(A),this.Dc(e)}Jn(A){const e=YA.ss();e.Jn(A),this.Dc(e)}Xn(A){const e=YA.ss();e.Xn(A),this.Dc(e)}Un(){const A=YA.ss();A.Un(),this.Dc(A)}ld(){return this.cn.rightPriceScale.visible?"right":"left"}ad(){return this.Rc}q(){return this.Tc}It(A){const e=this.Rc,t=this.Tc;if(e===t)return e;if(A=Math.max(0,Math.min(100,Math.round(100*A))),this.Mc===null||this.Mc.Ts!==t||this.Mc.Ps!==e)this.Mc={Ts:t,Ps:e,od:new Map};else{const i=this.Mc.od.get(A);if(i!==void 0)return i}const s=(function(i,n,o){const[a,l,c,u]=Kr(i),[d,g,B,f]=Kr(n),w=[me(a+o*(d-a)),me(l+o*(g-l)),me(c+o*(B-c)),zo(u+o*(f-u))];return`rgba(${w[0]}, ${w[1]}, ${w[2]}, ${w[3]})`})(t,e,A/100);return this.Mc.od.set(A,s),s}jc(A,e){const t=new YA(e);if(A!==null){const s=this.vc.indexOf(A);t.Nn(s,{Fn:e})}return t}Oc(A,e){return e===void 0&&(e=2),this.jc(this.cr(A),e)}Dc(A){this.xc&&this.xc(A),this.vc.forEach((e=>e.z_().Wh().gt()))}ed(A,e,t,s){const i=new ki(this,A,e,t,s),n=A.priceScaleId!==void 0?A.priceScaleId:this.ld();return t.Fo(i,n),Wr(n)||i.Nh(A),i}Pc(A){const e=this.cn.layout;return e.background.type==="gradient"?A===0?e.background.topColor:e.background.bottomColor:e.background.color}}function Vi(r){return!Le(r)&&!qt(r)}function Ta(r){return Le(r)}(function(r){r[r.Disabled=0]="Disabled",r[r.Continuous=1]="Continuous",r[r.OnDataUpdate=2]="OnDataUpdate"})(Sa||(Sa={})),(function(r){r[r.LastBar=0]="LastBar",r[r.LastVisible=1]="LastVisible"})(Ha||(Ha={})),(function(r){r.Solid="solid",r.VerticalGradient="gradient"})(La||(La={})),(function(r){r[r.Year=0]="Year",r[r.Month=1]="Month",r[r.DayOfMonth=2]="DayOfMonth",r[r.Time=3]="Time",r[r.TimeWithSeconds=4]="TimeWithSeconds"})(Ia||(Ia={}));const Ma=r=>r.getUTCFullYear();function pd(r,A,e){return A.replace(/yyyy/g,(t=>Je(Ma(t),4))(r)).replace(/yy/g,(t=>Je(Ma(t)%100,2))(r)).replace(/MMMM/g,((t,s)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(s,{month:"long"}))(r,e)).replace(/MMM/g,((t,s)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(s,{month:"short"}))(r,e)).replace(/MM/g,(t=>Je((s=>s.getUTCMonth()+1)(t),2))(r)).replace(/dd/g,(t=>Je((s=>s.getUTCDate())(t),2))(r))}class Da{constructor(A="yyyy-MM-dd",e="default"){this._d=A,this.ud=e}F_(A){return pd(A,this._d,this.ud)}}class wd{constructor(A){this.dd=A||"%h:%m:%s"}F_(A){return this.dd.replace("%h",Je(A.getUTCHours(),2)).replace("%m",Je(A.getUTCMinutes(),2)).replace("%s",Je(A.getUTCSeconds(),2))}}const md={fd:"yyyy-MM-dd",vd:"%h:%m:%s",pd:" ",md:"default"};class Cd{constructor(A={}){const e=Object.assign(Object.assign({},md),A);this.bd=new Da(e.fd,e.md),this.wd=new wd(e.vd),this.gd=e.pd}F_(A){return`${this.bd.F_(A)}${this.gd}${this.wd.F_(A)}`}}function jr(r){return 60*r*60*1e3}function Pi(r){return 60*r*1e3}const As=[{Md:(Oa=1,1e3*Oa),xd:10},{Md:Pi(1),xd:20},{Md:Pi(5),xd:21},{Md:Pi(30),xd:22},{Md:jr(1),xd:30},{Md:jr(3),xd:31},{Md:jr(6),xd:32},{Md:jr(12),xd:33}];var Oa;function ka(r,A){if(r.getUTCFullYear()!==A.getUTCFullYear())return 70;if(r.getUTCMonth()!==A.getUTCMonth())return 60;if(r.getUTCDate()!==A.getUTCDate())return 50;for(let e=As.length-1;e>=0;--e)if(Math.floor(A.getTime()/As[e].Md)!==Math.floor(r.getTime()/As[e].Md))return As[e].xd;return 0}function Gi(r){let A=r;if(qt(r)&&(A=Ri(r)),!Vi(A))throw new Error("time must be of type BusinessDay");const e=new Date(Date.UTC(A.year,A.month-1,A.day,0,0,0,0));return{Sd:Math.round(e.getTime()/1e3),kd:A}}function _a(r){if(!Ta(r))throw new Error("time must be of type isUTCTimestamp");return{Sd:r}}function Ri(r){const A=new Date(r);if(isNaN(A.getTime()))throw new Error(`Invalid date string=${r}, expected format=yyyy-mm-dd`);return{day:A.getUTCDate(),month:A.getUTCMonth()+1,year:A.getUTCFullYear()}}function Na(r){qt(r.time)&&(r.time=Ri(r.time))}class Ka{options(){return this.cn}setOptions(A){this.cn=A,this.updateFormatter(A.localization)}preprocessData(A){Array.isArray(A)?(function(e){e.forEach(Na)})(A):Na(A)}createConverterToInternalObj(A){return H((function(e){return e.length===0?null:Vi(e[0].time)||qt(e[0].time)?Gi:_a})(A))}key(A){return typeof A=="object"&&"Sd"in A?A.Sd:this.key(this.convertHorzItemToInternal(A))}cacheKey(A){const e=A;return e.kd===void 0?new Date(1e3*e.Sd).getTime():new Date(Date.UTC(e.kd.year,e.kd.month-1,e.kd.day)).getTime()}convertHorzItemToInternal(A){return Ta(e=A)?_a(e):Vi(e)?Gi(e):Gi(Ri(e));var e}updateFormatter(A){if(!this.cn)return;const e=A.dateFormat;this.cn.timeScale.timeVisible?this.yd=new Cd({fd:e,vd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",pd:" ",md:A.locale}):this.yd=new Da(e,A.locale)}formatHorzItem(A){const e=A;return this.yd.F_(new Date(1e3*e.Sd))}formatTickmark(A,e){const t=(function(i,n,o){switch(i){case 0:case 10:return n?o?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return n?3:2;case 50:return 2;case 60:return 1;case 70:return 0}})(A.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),s=this.cn.timeScale;if(s.tickMarkFormatter!==void 0){const i=s.tickMarkFormatter(A.originalTime,t,e.locale);if(i!==null)return i}return(function(i,n,o){const a={};switch(n){case 0:a.year="numeric";break;case 1:a.month="short";break;case 2:a.day="numeric";break;case 3:a.hour12=!1,a.hour="2-digit",a.minute="2-digit";break;case 4:a.hour12=!1,a.hour="2-digit",a.minute="2-digit",a.second="2-digit"}const l=i.kd===void 0?new Date(1e3*i.Sd):new Date(Date.UTC(i.kd.year,i.kd.month-1,i.kd.day));return new Date(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()).toLocaleString(o,a)})(A.time,t,e.locale)}maxTickMarkWeight(A){let e=A.reduce(hd,A[0]).weight;return e>30&&e<50&&(e=30),e}fillWeightsForPoints(A,e){(function(t,s=0){if(t.length===0)return;let i=s===0?null:t[s-1].time.Sd,n=i!==null?new Date(1e3*i):null,o=0;for(let a=s;a<t.length;++a){const l=t[a],c=new Date(1e3*l.time.Sd);n!==null&&(l.timeWeight=ka(c,n)),o+=l.time.Sd-(i||l.time.Sd),i=l.time.Sd,n=c}if(s===0&&t.length>1){const a=Math.ceil(o/(t.length-1)),l=new Date(1e3*(t[0].time.Sd-a));t[0].timeWeight=ka(new Date(1e3*t[0].time.Sd),l)}})(A,e)}static Cd(A){return Ue({localization:{dateFormat:"dd MMM 'yy"}},A??{})}}const It=typeof window<"u";function Va(){return!!It&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Wi(){return!!It&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function zi(r){return r+r%2}function Xi(r,A){return r.Td-A.Td}function Ji(r,A,e){const t=(r.Td-A.Td)/(r.ut-A.ut);return Math.sign(t)*Math.min(Math.abs(t),e)}class vd{constructor(A,e,t,s){this.Pd=null,this.Rd=null,this.Dd=null,this.Od=null,this.Ad=null,this.Vd=0,this.Bd=0,this.Id=A,this.zd=e,this.Ed=t,this.rs=s}Ld(A,e){if(this.Pd!==null){if(this.Pd.ut===e)return void(this.Pd.Td=A);if(Math.abs(this.Pd.Td-A)<this.rs)return}this.Od=this.Dd,this.Dd=this.Rd,this.Rd=this.Pd,this.Pd={ut:e,Td:A}}Dr(A,e){if(this.Pd===null||this.Rd===null||e-this.Pd.ut>50)return;let t=0;const s=Ji(this.Pd,this.Rd,this.zd),i=Xi(this.Pd,this.Rd),n=[s],o=[i];if(t+=i,this.Dd!==null){const l=Ji(this.Rd,this.Dd,this.zd);if(Math.sign(l)===Math.sign(s)){const c=Xi(this.Rd,this.Dd);if(n.push(l),o.push(c),t+=c,this.Od!==null){const u=Ji(this.Dd,this.Od,this.zd);if(Math.sign(u)===Math.sign(s)){const d=Xi(this.Dd,this.Od);n.push(u),o.push(d),t+=d}}}}let a=0;for(let l=0;l<n.length;++l)a+=o[l]/t*n[l];Math.abs(a)<this.Id||(this.Ad={Td:A,ut:e},this.Bd=a,this.Vd=(function(l,c){const u=Math.log(c);return Math.log(1*u/-l)/u})(Math.abs(a),this.Ed))}Yu(A){const e=H(this.Ad),t=A-e.ut;return e.Td+this.Bd*(Math.pow(this.Ed,t)-1)/Math.log(this.Ed)}qu(A){return this.Ad===null||this.Nd(A)===this.Vd}Nd(A){const e=A-H(this.Ad).ut;return Math.min(e,this.Vd)}}function gt(r,A){const e=H(r.ownerDocument).createElement("canvas");r.appendChild(e);const t=Tu(e,{options:{allowResizeObserver:!1},transform:(s,i)=>({width:Math.max(s.width,i.width),height:Math.max(s.height,i.height)})});return t.resizeCanvasElement(A),t}function Zi(r,A,e,t){r.G&&r.G(A,e,t)}function es(r,A,e,t){r.K(A,e,t)}function Yi(r,A,e,t){const s=r(e,t);for(const i of s){const n=i.xt();n!==null&&A(n)}}function bd(r){It&&window.chrome!==void 0&&r.addEventListener("mousedown",(A=>{if(A.button===1)return A.preventDefault(),!1}))}class qi{constructor(A,e,t){this.Fd=0,this.Wd=null,this.jd={et:Number.NEGATIVE_INFINITY,rt:Number.POSITIVE_INFINITY},this.Hd=0,this.$d=null,this.Ud={et:Number.NEGATIVE_INFINITY,rt:Number.POSITIVE_INFINITY},this.qd=null,this.Yd=!1,this.Xd=null,this.Kd=null,this.Zd=!1,this.Gd=!1,this.Jd=!1,this.Qd=null,this.tf=null,this.if=null,this.nf=null,this.sf=null,this.ef=null,this.rf=null,this.hf=0,this.lf=!1,this.af=!1,this._f=!1,this.uf=0,this.cf=null,this.df=!Wi(),this.ff=s=>{this.vf(s)},this.pf=s=>{if(this.mf(s)){const i=this.bf(s);if(++this.Hd,this.$d&&this.Hd>1){const{wf:n}=this.gf(Ie(s),this.Ud);n<30&&!this.Jd&&this.Mf(i,this.Sf.xf),this.kf()}}else{const i=this.bf(s);if(++this.Fd,this.Wd&&this.Fd>1){const{wf:n}=this.gf(Ie(s),this.jd);n<5&&!this.Gd&&this.yf(i,this.Sf.Cf),this.Tf()}}},this.Pf=A,this.Sf=e,this.cn=t,this.Rf()}S(){this.Qd!==null&&(this.Qd(),this.Qd=null),this.tf!==null&&(this.tf(),this.tf=null),this.nf!==null&&(this.nf(),this.nf=null),this.sf!==null&&(this.sf(),this.sf=null),this.ef!==null&&(this.ef(),this.ef=null),this.if!==null&&(this.if(),this.if=null),this.Df(),this.Tf()}Of(A){this.nf&&this.nf();const e=this.Af.bind(this);if(this.nf=()=>{this.Pf.removeEventListener("mousemove",e)},this.Pf.addEventListener("mousemove",e),this.mf(A))return;const t=this.bf(A);this.yf(t,this.Sf.Vf),this.df=!0}Tf(){this.Wd!==null&&clearTimeout(this.Wd),this.Fd=0,this.Wd=null,this.jd={et:Number.NEGATIVE_INFINITY,rt:Number.POSITIVE_INFINITY}}kf(){this.$d!==null&&clearTimeout(this.$d),this.Hd=0,this.$d=null,this.Ud={et:Number.NEGATIVE_INFINITY,rt:Number.POSITIVE_INFINITY}}Af(A){if(this._f||this.Kd!==null||this.mf(A))return;const e=this.bf(A);this.yf(e,this.Sf.Bf),this.df=!0}If(A){const e=$i(A.changedTouches,H(this.cf));if(e===null||(this.uf=ts(A),this.rf!==null)||this.af)return;this.lf=!0;const t=this.gf(Ie(e),H(this.Kd)),{zf:s,Ef:i,wf:n}=t;if(this.Zd||!(n<5)){if(!this.Zd){const o=.5*s,a=i>=o&&!this.cn.Lf(),l=o>i&&!this.cn.Nf();a||l||(this.af=!0),this.Zd=!0,this.Jd=!0,this.Df(),this.kf()}if(!this.af){const o=this.bf(A,e);this.Mf(o,this.Sf.Ff),Tt(A)}}}Wf(A){if(A.button!==0)return;const e=this.gf(Ie(A),H(this.Xd)),{wf:t}=e;if(t>=5&&(this.Gd=!0,this.Tf()),this.Gd){const s=this.bf(A);this.yf(s,this.Sf.jf)}}gf(A,e){const t=Math.abs(e.et-A.et),s=Math.abs(e.rt-A.rt);return{zf:t,Ef:s,wf:t+s}}Hf(A){let e=$i(A.changedTouches,H(this.cf));if(e===null&&A.touches.length===0&&(e=A.changedTouches[0]),e===null)return;this.cf=null,this.uf=ts(A),this.Df(),this.Kd=null,this.ef&&(this.ef(),this.ef=null);const t=this.bf(A,e);if(this.Mf(t,this.Sf.$f),++this.Hd,this.$d&&this.Hd>1){const{wf:s}=this.gf(Ie(e),this.Ud);s<30&&!this.Jd&&this.Mf(t,this.Sf.xf),this.kf()}else this.Jd||(this.Mf(t,this.Sf.Uf),this.Sf.Uf&&Tt(A));this.Hd===0&&Tt(A),A.touches.length===0&&this.Yd&&(this.Yd=!1,Tt(A))}vf(A){if(A.button!==0)return;const e=this.bf(A);if(this.Xd=null,this._f=!1,this.sf&&(this.sf(),this.sf=null),Va()&&this.Pf.ownerDocument.documentElement.removeEventListener("mouseleave",this.ff),!this.mf(A))if(this.yf(e,this.Sf.qf),++this.Fd,this.Wd&&this.Fd>1){const{wf:t}=this.gf(Ie(A),this.jd);t<5&&!this.Gd&&this.yf(e,this.Sf.Cf),this.Tf()}else this.Gd||this.yf(e,this.Sf.Yf)}Df(){this.qd!==null&&(clearTimeout(this.qd),this.qd=null)}Xf(A){if(this.cf!==null)return;const e=A.changedTouches[0];this.cf=e.identifier,this.uf=ts(A);const t=this.Pf.ownerDocument.documentElement;this.Jd=!1,this.Zd=!1,this.af=!1,this.Kd=Ie(e),this.ef&&(this.ef(),this.ef=null);{const i=this.If.bind(this),n=this.Hf.bind(this);this.ef=()=>{t.removeEventListener("touchmove",i),t.removeEventListener("touchend",n)},t.addEventListener("touchmove",i,{passive:!1}),t.addEventListener("touchend",n,{passive:!1}),this.Df(),this.qd=setTimeout(this.Kf.bind(this,A),240)}const s=this.bf(A,e);this.Mf(s,this.Sf.Zf),this.$d||(this.Hd=0,this.$d=setTimeout(this.kf.bind(this),500),this.Ud=Ie(e))}Gf(A){if(A.button!==0)return;const e=this.Pf.ownerDocument.documentElement;Va()&&e.addEventListener("mouseleave",this.ff),this.Gd=!1,this.Xd=Ie(A),this.sf&&(this.sf(),this.sf=null);{const s=this.Wf.bind(this),i=this.vf.bind(this);this.sf=()=>{e.removeEventListener("mousemove",s),e.removeEventListener("mouseup",i)},e.addEventListener("mousemove",s),e.addEventListener("mouseup",i)}if(this._f=!0,this.mf(A))return;const t=this.bf(A);this.yf(t,this.Sf.Jf),this.Wd||(this.Fd=0,this.Wd=setTimeout(this.Tf.bind(this),500),this.jd=Ie(A))}Rf(){this.Pf.addEventListener("mouseenter",this.Of.bind(this)),this.Pf.addEventListener("touchcancel",this.Df.bind(this));{const A=this.Pf.ownerDocument,e=t=>{this.Sf.Qf&&(t.composed&&this.Pf.contains(t.composedPath()[0])||t.target&&this.Pf.contains(t.target)||this.Sf.Qf())};this.tf=()=>{A.removeEventListener("touchstart",e)},this.Qd=()=>{A.removeEventListener("mousedown",e)},A.addEventListener("mousedown",e),A.addEventListener("touchstart",e,{passive:!0})}Wi()&&(this.if=()=>{this.Pf.removeEventListener("dblclick",this.pf)},this.Pf.addEventListener("dblclick",this.pf)),this.Pf.addEventListener("mouseleave",this.tv.bind(this)),this.Pf.addEventListener("touchstart",this.Xf.bind(this),{passive:!0}),bd(this.Pf),this.Pf.addEventListener("mousedown",this.Gf.bind(this)),this.iv(),this.Pf.addEventListener("touchmove",(()=>{}),{passive:!1})}iv(){this.Sf.nv===void 0&&this.Sf.sv===void 0&&this.Sf.ev===void 0||(this.Pf.addEventListener("touchstart",(A=>this.rv(A.touches)),{passive:!0}),this.Pf.addEventListener("touchmove",(A=>{if(A.touches.length===2&&this.rf!==null&&this.Sf.sv!==void 0){const e=Pa(A.touches[0],A.touches[1])/this.hf;this.Sf.sv(this.rf,e),Tt(A)}}),{passive:!1}),this.Pf.addEventListener("touchend",(A=>{this.rv(A.touches)})))}rv(A){A.length===1&&(this.lf=!1),A.length!==2||this.lf||this.Yd?this.hv():this.lv(A)}lv(A){const e=this.Pf.getBoundingClientRect()||{left:0,top:0};this.rf={et:(A[0].clientX-e.left+(A[1].clientX-e.left))/2,rt:(A[0].clientY-e.top+(A[1].clientY-e.top))/2},this.hf=Pa(A[0],A[1]),this.Sf.nv!==void 0&&this.Sf.nv(),this.Df()}hv(){this.rf!==null&&(this.rf=null,this.Sf.ev!==void 0&&this.Sf.ev())}tv(A){if(this.nf&&this.nf(),this.mf(A)||!this.df)return;const e=this.bf(A);this.yf(e,this.Sf.av),this.df=!Wi()}Kf(A){const e=$i(A.touches,H(this.cf));if(e===null)return;const t=this.bf(A,e);this.Mf(t,this.Sf.ov),this.Jd=!0,this.Yd=!0}mf(A){return A.sourceCapabilities&&A.sourceCapabilities.firesTouchEvents!==void 0?A.sourceCapabilities.firesTouchEvents:ts(A)<this.uf+500}Mf(A,e){e&&e.call(this.Sf,A)}yf(A,e){e&&e.call(this.Sf,A)}bf(A,e){const t=e||A,s=this.Pf.getBoundingClientRect()||{left:0,top:0};return{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,screenX:t.screenX,screenY:t.screenY,localX:t.clientX-s.left,localY:t.clientY-s.top,ctrlKey:A.ctrlKey,altKey:A.altKey,shiftKey:A.shiftKey,metaKey:A.metaKey,_v:!A.type.startsWith("mouse")&&A.type!=="contextmenu"&&A.type!=="click",uv:A.type,cv:t.target,dv:A.view,fv:()=>{A.type!=="touchstart"&&Tt(A)}}}}function Pa(r,A){const e=r.clientX-A.clientX,t=r.clientY-A.clientY;return Math.sqrt(e*e+t*t)}function Tt(r){r.cancelable&&r.preventDefault()}function Ie(r){return{et:r.pageX,rt:r.pageY}}function ts(r){return r.timeStamp||performance.now()}function $i(r,A){for(let e=0;e<r.length;++e)if(r[e].identifier===A)return r[e];return null}function rs(r){return{Bc:r.Bc,vv:{wr:r.pv.externalId},mv:r.pv.cursorStyle}}function Qd(r,A,e){for(const t of r){const s=t.xt();if(s!==null&&s.br){const i=s.br(A,e);if(i!==null)return{dv:t,vv:i}}}return null}function ji(r,A){return e=>{var t,s,i,n;return((s=(t=e.At())===null||t===void 0?void 0:t.xa())!==null&&s!==void 0?s:"")!==A?[]:(n=(i=e.la)===null||i===void 0?void 0:i.call(e,r))!==null&&n!==void 0?n:[]}}class Ga{constructor(A,e,t,s){this.Li=null,this.bv=null,this.wv=!1,this.gv=new Ar(200),this.Gr=null,this.Mv=0,this.xv=!1,this.Sv=()=>{this.xv||this.nn.kv().qt().Fh()},this.yv=()=>{this.xv||this.nn.kv().qt().Fh()},this.nn=A,this.cn=e,this.mo=e.layout,this.Sc=t,this.Cv=s==="left",this.Tv=ji("normal",s),this.Pv=ji("top",s),this.Rv=ji("bottom",s),this.Dv=document.createElement("div"),this.Dv.style.height="100%",this.Dv.style.overflow="hidden",this.Dv.style.width="25px",this.Dv.style.left="0",this.Dv.style.position="relative",this.Ov=gt(this.Dv,IA({width:16,height:16})),this.Ov.subscribeSuggestedBitmapSizeChanged(this.Sv);const i=this.Ov.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Av=gt(this.Dv,IA({width:16,height:16})),this.Av.subscribeSuggestedBitmapSizeChanged(this.yv);const n=this.Av.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.style.top="0";const o={Jf:this.Vv.bind(this),Zf:this.Vv.bind(this),jf:this.Bv.bind(this),Ff:this.Bv.bind(this),Qf:this.Iv.bind(this),qf:this.zv.bind(this),$f:this.zv.bind(this),Cf:this.Ev.bind(this),xf:this.Ev.bind(this),Vf:this.Lv.bind(this),av:this.Nv.bind(this)};this.Fv=new qi(this.Av.canvasElement,o,{Lf:()=>!1,Nf:()=>!0})}S(){this.Fv.S(),this.Av.unsubscribeSuggestedBitmapSizeChanged(this.yv),this.Av.dispose(),this.Ov.unsubscribeSuggestedBitmapSizeChanged(this.Sv),this.Ov.dispose(),this.Li!==null&&this.Li.$o().p(this),this.Li=null}Wv(){return this.Dv}P(){return this.mo.fontSize}jv(){const A=this.Sc.W();return this.Gr!==A.R&&(this.gv.ir(),this.Gr=A.R),A}Hv(){if(this.Li===null)return 0;let A=0;const e=this.jv(),t=H(this.Ov.canvasElement.getContext("2d"));t.save();const s=this.Li.Ea();t.font=this.$v(),s.length>0&&(A=Math.max(this.gv.Si(t,s[0].Za),this.gv.Si(t,s[s.length-1].Za)));const i=this.Uv();for(let a=i.length;a--;){const l=this.gv.Si(t,i[a].Jt());l>A&&(A=l)}const n=this.Li.Pt();if(n!==null&&this.bv!==null){const a=this.Li.pn(1,n),l=this.Li.pn(this.bv.height-2,n);A=Math.max(A,this.gv.Si(t,this.Li.Wi(Math.floor(Math.min(a,l))+.11111111111111,n)),this.gv.Si(t,this.Li.Wi(Math.ceil(Math.max(a,l))-.11111111111111,n)))}t.restore();const o=A||34;return zi(Math.ceil(e.C+e.T+e.B+e.I+5+o))}qv(A){this.bv!==null&&ft(this.bv,A)||(this.bv=A,this.xv=!0,this.Ov.resizeCanvasElement(A),this.Av.resizeCanvasElement(A),this.xv=!1,this.Dv.style.width=`${A.width}px`,this.Dv.style.height=`${A.height}px`)}Yv(){return H(this.bv).width}Ji(A){this.Li!==A&&(this.Li!==null&&this.Li.$o().p(this),this.Li=A,A.$o().l(this.ao.bind(this),this))}At(){return this.Li}ir(){const A=this.nn.Xv();this.nn.kv().qt().A_(A,H(this.At()))}Kv(A){if(this.bv===null)return;if(A!==1){this.Zv(),this.Ov.applySuggestedBitmapSize();const t=dt(this.Ov);t!==null&&(t.useBitmapCoordinateSpace((s=>{this.Gv(s),this.Be(s)})),this.nn.Jv(t,this.Rv),this.Qv(t),this.nn.Jv(t,this.Tv),this.tp(t))}this.Av.applySuggestedBitmapSize();const e=dt(this.Av);e!==null&&(e.useBitmapCoordinateSpace((({context:t,bitmapSize:s})=>{t.clearRect(0,0,s.width,s.height)})),this.ip(e),this.nn.Jv(e,this.Pv))}np(){return this.Ov.bitmapSize}sp(A,e,t){const s=this.np();s.width>0&&s.height>0&&A.drawImage(this.Ov.canvasElement,e,t)}gt(){var A;(A=this.Li)===null||A===void 0||A.Ea()}Vv(A){if(this.Li===null||this.Li.Fi()||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.nn.kv().qt(),t=this.nn.Xv();this.wv=!0,e.y_(t,this.Li,A.localY)}Bv(A){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.nn.kv().qt(),t=this.nn.Xv(),s=this.Li;e.C_(t,s,A.localY)}Iv(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const A=this.nn.kv().qt(),e=this.nn.Xv(),t=this.Li;this.wv&&(this.wv=!1,A.T_(e,t))}zv(A){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.nn.kv().qt(),t=this.nn.Xv();this.wv=!1,e.T_(t,this.Li)}Ev(A){this.cn.handleScale.axisDoubleClickReset.price&&this.ir()}Lv(A){this.Li!==null&&(!this.nn.kv().qt().W().handleScale.axisPressedMouseMove.price||this.Li.ph()||this.Li.Co()||this.ep(1))}Nv(A){this.ep(0)}Uv(){const A=[],e=this.Li===null?void 0:this.Li;return(t=>{for(let s=0;s<t.length;++s){const i=t[s].Rn(this.nn.Xv(),e);for(let n=0;n<i.length;n++)A.push(i[n])}})(this.nn.Xv().No()),A}Gv({context:A,bitmapSize:e}){const{width:t,height:s}=e,i=this.nn.Xv().qt(),n=i.q(),o=i.ad();n===o?Gr(A,0,0,t,s,n):Zo(A,0,0,t,s,n,o)}Be({context:A,bitmapSize:e,horizontalPixelRatio:t}){if(this.bv===null||this.Li===null||!this.Li.W().borderVisible)return;A.fillStyle=this.Li.W().borderColor;const s=Math.max(1,Math.floor(this.jv().C*t));let i;i=this.Cv?e.width-s:0,A.fillRect(i,0,s,e.height)}Qv(A){if(this.bv===null||this.Li===null)return;const e=this.Li.Ea(),t=this.Li.W(),s=this.jv(),i=this.Cv?this.bv.width-s.T:0;t.borderVisible&&t.ticksVisible&&A.useBitmapCoordinateSpace((({context:n,horizontalPixelRatio:o,verticalPixelRatio:a})=>{n.fillStyle=t.borderColor;const l=Math.max(1,Math.floor(a)),c=Math.floor(.5*a),u=Math.round(s.T*o);n.beginPath();for(const d of e)n.rect(Math.floor(i*o),Math.round(d.Aa*a)-c,u,l);n.fill()})),A.useMediaCoordinateSpace((({context:n})=>{var o;n.font=this.$v(),n.fillStyle=(o=t.textColor)!==null&&o!==void 0?o:this.mo.textColor,n.textAlign=this.Cv?"right":"left",n.textBaseline="middle";const a=this.Cv?Math.round(i-s.B):Math.round(i+s.T+s.B),l=e.map((c=>this.gv.xi(n,c.Za)));for(let c=e.length;c--;){const u=e[c];n.fillText(u.Za,a,u.Aa+l[c])}}))}Zv(){if(this.bv===null||this.Li===null)return;let A=this.bv.height/2;const e=[],t=this.Li.No().slice(),s=this.nn.Xv(),i=this.jv();this.Li===s.vr()&&this.nn.Xv().No().forEach((a=>{s.dr(a)&&t.push(a)}));const n=this.Li.Ta()[0],o=this.Li;t.forEach((a=>{const l=a.Rn(s,o);l.forEach((c=>{c.Vi(null),c.Bi()&&e.push(c)})),n===a&&l.length>0&&(A=l[0].yi())})),e.forEach((a=>a.Vi(a.yi()))),this.Li.W().alignLabels&&this.rp(e,i,A)}rp(A,e,t){if(this.bv===null)return;const s=A.filter((n=>n.yi()<=t)),i=A.filter((n=>n.yi()>t));s.sort(((n,o)=>o.yi()-n.yi())),s.length&&i.length&&i.push(s[0]),i.sort(((n,o)=>n.yi()-o.yi()));for(const n of A){const o=Math.floor(n.zt(e)/2),a=n.yi();a>-o&&a<o&&n.Vi(o),a>this.bv.height-o&&a<this.bv.height+o&&n.Vi(this.bv.height-o)}for(let n=1;n<s.length;n++){const o=s[n],a=s[n-1],l=a.zt(e,!1),c=o.yi(),u=a.Ai();c>u-l&&o.Vi(u-l)}for(let n=1;n<i.length;n++){const o=i[n],a=i[n-1],l=a.zt(e,!0),c=o.yi(),u=a.Ai();c<u+l&&o.Vi(u+l)}}tp(A){if(this.bv===null)return;const e=this.Uv(),t=this.jv(),s=this.Cv?"right":"left";e.forEach((i=>{i.Ii()&&i.xt(H(this.Li)).K(A,t,this.gv,s)}))}ip(A){if(this.bv===null||this.Li===null)return;const e=this.nn.kv().qt(),t=[],s=this.nn.Xv(),i=e.Nc().Rn(s,this.Li);i.length&&t.push(i);const n=this.jv(),o=this.Cv?"right":"left";t.forEach((a=>{a.forEach((l=>{l.xt(H(this.Li)).K(A,n,this.gv,o)}))}))}ep(A){this.Dv.style.cursor=A===1?"ns-resize":"default"}ao(){const A=this.Hv();this.Mv<A&&this.nn.kv().qt().$l(),this.Mv=A}$v(){return St(this.mo.fontSize,this.mo.fontFamily)}}function Fd(r,A){var e,t;return(t=(e=r.ra)===null||e===void 0?void 0:e.call(r,A))!==null&&t!==void 0?t:[]}function ss(r,A){var e,t;return(t=(e=r.Pn)===null||e===void 0?void 0:e.call(r,A))!==null&&t!==void 0?t:[]}function yd(r,A){var e,t;return(t=(e=r.Qi)===null||e===void 0?void 0:e.call(r,A))!==null&&t!==void 0?t:[]}function Ud(r,A){var e,t;return(t=(e=r.na)===null||e===void 0?void 0:e.call(r,A))!==null&&t!==void 0?t:[]}class An{constructor(A,e){this.bv=IA({width:0,height:0}),this.hp=null,this.lp=null,this.ap=null,this.op=!1,this._p=new KA,this.up=new KA,this.cp=0,this.dp=!1,this.fp=null,this.vp=!1,this.pp=null,this.mp=null,this.xv=!1,this.Sv=()=>{this.xv||this.bp===null||this.Ui().Fh()},this.yv=()=>{this.xv||this.bp===null||this.Ui().Fh()},this.wp=A,this.bp=e,this.bp.I_().l(this.gp.bind(this),this,!0),this.Mp=document.createElement("td"),this.Mp.style.padding="0",this.Mp.style.position="relative";const t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="relative",t.style.overflow="hidden",this.xp=document.createElement("td"),this.xp.style.padding="0",this.Sp=document.createElement("td"),this.Sp.style.padding="0",this.Mp.appendChild(t),this.Ov=gt(t,IA({width:16,height:16})),this.Ov.subscribeSuggestedBitmapSizeChanged(this.Sv);const s=this.Ov.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Av=gt(t,IA({width:16,height:16})),this.Av.subscribeSuggestedBitmapSizeChanged(this.yv);const i=this.Av.canvasElement;i.style.position="absolute",i.style.zIndex="2",i.style.left="0",i.style.top="0",this.kp=document.createElement("tr"),this.kp.appendChild(this.xp),this.kp.appendChild(this.Mp),this.kp.appendChild(this.Sp),this.yp(),this.Fv=new qi(this.Av.canvasElement,this,{Lf:()=>this.fp===null&&!this.wp.W().handleScroll.vertTouchDrag,Nf:()=>this.fp===null&&!this.wp.W().handleScroll.horzTouchDrag})}S(){this.hp!==null&&this.hp.S(),this.lp!==null&&this.lp.S(),this.Av.unsubscribeSuggestedBitmapSizeChanged(this.yv),this.Av.dispose(),this.Ov.unsubscribeSuggestedBitmapSizeChanged(this.Sv),this.Ov.dispose(),this.bp!==null&&this.bp.I_().p(this),this.Fv.S()}Xv(){return H(this.bp)}Cp(A){this.bp!==null&&this.bp.I_().p(this),this.bp=A,this.bp!==null&&this.bp.I_().l(An.prototype.gp.bind(this),this,!0),this.yp()}kv(){return this.wp}Wv(){return this.kp}yp(){if(this.bp!==null&&(this.Tp(),this.Ui().Mt().length!==0)){if(this.hp!==null){const A=this.bp.S_();this.hp.Ji(H(A))}if(this.lp!==null){const A=this.bp.k_();this.lp.Ji(H(A))}}}Pp(){this.hp!==null&&this.hp.gt(),this.lp!==null&&this.lp.gt()}v_(){return this.bp!==null?this.bp.v_():0}p_(A){this.bp&&this.bp.p_(A)}Vf(A){if(!this.bp)return;this.Rp();const e=A.localX,t=A.localY;this.Dp(e,t,A)}Jf(A){this.Rp(),this.Op(),this.Dp(A.localX,A.localY,A)}Bf(A){var e;if(!this.bp)return;this.Rp();const t=A.localX,s=A.localY;this.Dp(t,s,A);const i=this.br(t,s);this.wp.Ap((e=i?.mv)!==null&&e!==void 0?e:null),this.Ui().Vc(i&&{Bc:i.Bc,vv:i.vv})}Yf(A){this.bp!==null&&(this.Rp(),this.Vp(A))}Cf(A){this.bp!==null&&this.Bp(this.up,A)}xf(A){this.Cf(A)}jf(A){this.Rp(),this.Ip(A),this.Dp(A.localX,A.localY,A)}qf(A){this.bp!==null&&(this.Rp(),this.dp=!1,this.zp(A))}Uf(A){this.bp!==null&&this.Vp(A)}ov(A){if(this.dp=!0,this.fp===null){const e={x:A.localX,y:A.localY};this.Ep(e,e,A)}}av(A){this.bp!==null&&(this.Rp(),this.bp.qt().Vc(null),this.Lp())}Np(){return this._p}Fp(){return this.up}nv(){this.cp=1,this.Ui().Un()}sv(A,e){if(!this.wp.W().handleScale.pinch)return;const t=5*(e-this.cp);this.cp=e,this.Ui().$c(A.et,t)}Zf(A){this.dp=!1,this.vp=this.fp!==null,this.Op();const e=this.Ui().Nc();this.fp!==null&&e.Tt()&&(this.pp={x:e.Kt(),y:e.Zt()},this.fp={x:A.localX,y:A.localY})}Ff(A){if(this.bp===null)return;const e=A.localX,t=A.localY;if(this.fp===null)this.Ip(A);else{this.vp=!1;const s=H(this.pp),i=s.x+(e-this.fp.x),n=s.y+(t-this.fp.y);this.Dp(i,n,A)}}$f(A){this.kv().W().trackingMode.exitMode===0&&(this.vp=!0),this.Wp(),this.zp(A)}br(A,e){const t=this.bp;return t===null?null:(function(s,i,n){const o=s.No(),a=(function(l,c,u){var d,g;let B,f;for(const p of l){const v=(g=(d=p.oa)===null||d===void 0?void 0:d.call(p,c,u))!==null&&g!==void 0?g:[];for(const y of v)w=y.zOrder,(!(m=B?.zOrder)||w==="top"&&m!=="top"||w==="normal"&&m==="bottom")&&(B=y,f=p)}var w,m;return B&&f?{pv:B,Bc:f}:null})(o,i,n);if(a?.pv.zOrder==="top")return rs(a);for(const l of o){if(a&&a.Bc===l&&a.pv.zOrder!=="bottom"&&!a.pv.isBackground)return rs(a);const c=Qd(l.Pn(s),i,n);if(c!==null)return{Bc:l,dv:c.dv,vv:c.vv};if(a&&a.Bc===l&&a.pv.zOrder!=="bottom"&&a.pv.isBackground)return rs(a)}return a?.pv?rs(a):null})(t,A,e)}jp(A,e){H(e==="left"?this.hp:this.lp).qv(IA({width:A,height:this.bv.height}))}Hp(){return this.bv}qv(A){ft(this.bv,A)||(this.bv=A,this.xv=!0,this.Ov.resizeCanvasElement(A),this.Av.resizeCanvasElement(A),this.xv=!1,this.Mp.style.width=A.width+"px",this.Mp.style.height=A.height+"px")}$p(){const A=H(this.bp);A.x_(A.S_()),A.x_(A.k_());for(const e of A.Ta())if(A.dr(e)){const t=e.At();t!==null&&A.x_(t),e.On()}}np(){return this.Ov.bitmapSize}sp(A,e,t){const s=this.np();s.width>0&&s.height>0&&A.drawImage(this.Ov.canvasElement,e,t)}Kv(A){if(A===0||this.bp===null)return;if(A>1&&this.$p(),this.hp!==null&&this.hp.Kv(A),this.lp!==null&&this.lp.Kv(A),A!==1){this.Ov.applySuggestedBitmapSize();const t=dt(this.Ov);t!==null&&(t.useBitmapCoordinateSpace((s=>{this.Gv(s)})),this.bp&&(this.Up(t,Fd),this.qp(t),this.Yp(t),this.Up(t,ss),this.Up(t,yd)))}this.Av.applySuggestedBitmapSize();const e=dt(this.Av);e!==null&&(e.useBitmapCoordinateSpace((({context:t,bitmapSize:s})=>{t.clearRect(0,0,s.width,s.height)})),this.Xp(e),this.Up(e,Ud))}Kp(){return this.hp}Zp(){return this.lp}Jv(A,e){this.Up(A,e)}gp(){this.bp!==null&&this.bp.I_().p(this),this.bp=null}Vp(A){this.Bp(this._p,A)}Bp(A,e){const t=e.localX,s=e.localY;A.M()&&A.m(this.Ui().yt().Au(t),{x:t,y:s},e)}Gv({context:A,bitmapSize:e}){const{width:t,height:s}=e,i=this.Ui(),n=i.q(),o=i.ad();n===o?Gr(A,0,0,t,s,o):Zo(A,0,0,t,s,n,o)}qp(A){const e=H(this.bp).z_().Wh().xt();e!==null&&e.K(A,!1)}Yp(A){const e=this.Ui().Lc();this.Gp(A,ss,Zi,e),this.Gp(A,ss,es,e)}Xp(A){this.Gp(A,ss,es,this.Ui().Nc())}Up(A,e){const t=H(this.bp).No();for(const s of t)this.Gp(A,e,Zi,s);for(const s of t)this.Gp(A,e,es,s)}Gp(A,e,t,s){const i=H(this.bp),n=i.qt().Ac(),o=n!==null&&n.Bc===s,a=n!==null&&o&&n.vv!==void 0?n.vv.gr:void 0;Yi(e,(l=>t(l,A,o,a)),s,i)}Tp(){if(this.bp===null)return;const A=this.wp,e=this.bp.S_().W().visible,t=this.bp.k_().W().visible;e||this.hp===null||(this.xp.removeChild(this.hp.Wv()),this.hp.S(),this.hp=null),t||this.lp===null||(this.Sp.removeChild(this.lp.Wv()),this.lp.S(),this.lp=null);const s=A.qt().nd();e&&this.hp===null&&(this.hp=new Ga(this,A.W(),s,"left"),this.xp.appendChild(this.hp.Wv())),t&&this.lp===null&&(this.lp=new Ga(this,A.W(),s,"right"),this.Sp.appendChild(this.lp.Wv()))}Jp(A){return A._v&&this.dp||this.fp!==null}Qp(A){return Math.max(0,Math.min(A,this.bv.width-1))}tm(A){return Math.max(0,Math.min(A,this.bv.height-1))}Dp(A,e,t){this.Ui().Gc(this.Qp(A),this.tm(e),t,H(this.bp))}Lp(){this.Ui().Qc()}Wp(){this.vp&&(this.fp=null,this.Lp())}Ep(A,e,t){this.fp=A,this.vp=!1,this.Dp(e.x,e.y,t);const s=this.Ui().Nc();this.pp={x:s.Kt(),y:s.Zt()}}Ui(){return this.wp.qt()}zp(A){if(!this.op)return;const e=this.Ui(),t=this.Xv();if(e.D_(t,t.vn()),this.ap=null,this.op=!1,e.Xc(),this.mp!==null){const s=performance.now(),i=e.yt();this.mp.Dr(i.zu(),s),this.mp.qu(s)||e.Xn(this.mp)}}Rp(){this.fp=null}Op(){if(this.bp){if(this.Ui().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)H(document.activeElement).blur();else{const A=document.getSelection();A!==null&&A.removeAllRanges()}!this.bp.vn().Fi()&&this.Ui().yt().Fi()}}Ip(A){if(this.bp===null)return;const e=this.Ui(),t=e.yt();if(t.Fi())return;const s=this.wp.W(),i=s.handleScroll,n=s.kineticScroll;if((!i.pressedMouseMove||A._v)&&(!i.horzTouchDrag&&!i.vertTouchDrag||!A._v))return;const o=this.bp.vn(),a=performance.now();if(this.ap!==null||this.Jp(A)||(this.ap={x:A.clientX,y:A.clientY,Sd:a,im:A.localX,nm:A.localY}),this.ap!==null&&!this.op&&(this.ap.x!==A.clientX||this.ap.y!==A.clientY)){if(A._v&&n.touch||!A._v&&n.mouse){const l=t.he();this.mp=new vd(.2/l,7/l,.997,15/l),this.mp.Ld(t.zu(),this.ap.Sd)}else this.mp=null;o.Fi()||e.P_(this.bp,o,A.localY),e.qc(A.localX),this.op=!0}this.op&&(o.Fi()||e.R_(this.bp,o,A.localY),e.Yc(A.localX),this.mp!==null&&this.mp.Ld(t.zu(),a))}}class Ra{constructor(A,e,t,s,i){this.bt=!0,this.bv=IA({width:0,height:0}),this.Sv=()=>this.Kv(3),this.Cv=A==="left",this.Sc=t.nd,this.cn=e,this.sm=s,this.rm=i,this.Dv=document.createElement("div"),this.Dv.style.width="25px",this.Dv.style.height="100%",this.Dv.style.overflow="hidden",this.Ov=gt(this.Dv,IA({width:16,height:16})),this.Ov.subscribeSuggestedBitmapSizeChanged(this.Sv)}S(){this.Ov.unsubscribeSuggestedBitmapSizeChanged(this.Sv),this.Ov.dispose()}Wv(){return this.Dv}Hp(){return this.bv}qv(A){ft(this.bv,A)||(this.bv=A,this.Ov.resizeCanvasElement(A),this.Dv.style.width=`${A.width}px`,this.Dv.style.height=`${A.height}px`,this.bt=!0)}Kv(A){if(A<3&&!this.bt||this.bv.width===0||this.bv.height===0)return;this.bt=!1,this.Ov.applySuggestedBitmapSize();const e=dt(this.Ov);e!==null&&e.useBitmapCoordinateSpace((t=>{this.Gv(t),this.Be(t)}))}np(){return this.Ov.bitmapSize}sp(A,e,t){const s=this.np();s.width>0&&s.height>0&&A.drawImage(this.Ov.canvasElement,e,t)}Be({context:A,bitmapSize:e,horizontalPixelRatio:t,verticalPixelRatio:s}){if(!this.sm())return;A.fillStyle=this.cn.timeScale.borderColor;const i=Math.floor(this.Sc.W().C*t),n=Math.floor(this.Sc.W().C*s),o=this.Cv?e.width-i:0;A.fillRect(o,0,i,n)}Gv({context:A,bitmapSize:e}){Gr(A,0,0,e.width,e.height,this.rm())}}function en(r){return A=>{var e,t;return(t=(e=A.aa)===null||e===void 0?void 0:e.call(A,r))!==null&&t!==void 0?t:[]}}const Ed=en("normal"),xd=en("top"),Sd=en("bottom");class Hd{constructor(A,e){this.hm=null,this.lm=null,this.k=null,this.am=!1,this.bv=IA({width:0,height:0}),this.om=new KA,this.gv=new Ar(5),this.xv=!1,this.Sv=()=>{this.xv||this.wp.qt().Fh()},this.yv=()=>{this.xv||this.wp.qt().Fh()},this.wp=A,this.N_=e,this.cn=A.W().layout,this._m=document.createElement("tr"),this.um=document.createElement("td"),this.um.style.padding="0",this.dm=document.createElement("td"),this.dm.style.padding="0",this.Dv=document.createElement("td"),this.Dv.style.height="25px",this.Dv.style.padding="0",this.fm=document.createElement("div"),this.fm.style.width="100%",this.fm.style.height="100%",this.fm.style.position="relative",this.fm.style.overflow="hidden",this.Dv.appendChild(this.fm),this.Ov=gt(this.fm,IA({width:16,height:16})),this.Ov.subscribeSuggestedBitmapSizeChanged(this.Sv);const t=this.Ov.canvasElement;t.style.position="absolute",t.style.zIndex="1",t.style.left="0",t.style.top="0",this.Av=gt(this.fm,IA({width:16,height:16})),this.Av.subscribeSuggestedBitmapSizeChanged(this.yv);const s=this.Av.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this._m.appendChild(this.um),this._m.appendChild(this.Dv),this._m.appendChild(this.dm),this.vm(),this.wp.qt().f_().l(this.vm.bind(this),this),this.Fv=new qi(this.Av.canvasElement,this,{Lf:()=>!0,Nf:()=>!1})}S(){this.Fv.S(),this.hm!==null&&this.hm.S(),this.lm!==null&&this.lm.S(),this.Av.unsubscribeSuggestedBitmapSizeChanged(this.yv),this.Av.dispose(),this.Ov.unsubscribeSuggestedBitmapSizeChanged(this.Sv),this.Ov.dispose()}Wv(){return this._m}pm(){return this.hm}bm(){return this.lm}Jf(A){if(this.am)return;this.am=!0;const e=this.wp.qt();!e.yt().Fi()&&this.wp.W().handleScale.axisPressedMouseMove.time&&e.Hc(A.localX)}Zf(A){this.Jf(A)}Qf(){const A=this.wp.qt();!A.yt().Fi()&&this.am&&(this.am=!1,this.wp.W().handleScale.axisPressedMouseMove.time&&A.Zc())}jf(A){const e=this.wp.qt();!e.yt().Fi()&&this.wp.W().handleScale.axisPressedMouseMove.time&&e.Kc(A.localX)}Ff(A){this.jf(A)}qf(){this.am=!1;const A=this.wp.qt();A.yt().Fi()&&!this.wp.W().handleScale.axisPressedMouseMove.time||A.Zc()}$f(){this.qf()}Cf(){this.wp.W().handleScale.axisDoubleClickReset.time&&this.wp.qt().Zn()}xf(){this.Cf()}Vf(){this.wp.qt().W().handleScale.axisPressedMouseMove.time&&this.ep(1)}av(){this.ep(0)}Hp(){return this.bv}wm(){return this.om}gm(A,e,t){ft(this.bv,A)||(this.bv=A,this.xv=!0,this.Ov.resizeCanvasElement(A),this.Av.resizeCanvasElement(A),this.xv=!1,this.Dv.style.width=`${A.width}px`,this.Dv.style.height=`${A.height}px`,this.om.m(A)),this.hm!==null&&this.hm.qv(IA({width:e,height:A.height})),this.lm!==null&&this.lm.qv(IA({width:t,height:A.height}))}Mm(){const A=this.xm();return Math.ceil(A.C+A.T+A.P+A.L+A.V+A.Sm)}gt(){this.wp.qt().yt().Ea()}np(){return this.Ov.bitmapSize}sp(A,e,t){const s=this.np();s.width>0&&s.height>0&&A.drawImage(this.Ov.canvasElement,e,t)}Kv(A){if(A===0)return;if(A!==1){this.Ov.applySuggestedBitmapSize();const t=dt(this.Ov);t!==null&&(t.useBitmapCoordinateSpace((s=>{this.Gv(s),this.Be(s),this.km(t,Sd)})),this.Qv(t),this.km(t,Ed)),this.hm!==null&&this.hm.Kv(A),this.lm!==null&&this.lm.Kv(A)}this.Av.applySuggestedBitmapSize();const e=dt(this.Av);e!==null&&(e.useBitmapCoordinateSpace((({context:t,bitmapSize:s})=>{t.clearRect(0,0,s.width,s.height)})),this.ym([...this.wp.qt().Mt(),this.wp.qt().Nc()],e),this.km(e,xd))}km(A,e){const t=this.wp.qt().Mt();for(const s of t)Yi(e,(i=>Zi(i,A,!1,void 0)),s,void 0);for(const s of t)Yi(e,(i=>es(i,A,!1,void 0)),s,void 0)}Gv({context:A,bitmapSize:e}){Gr(A,0,0,e.width,e.height,this.wp.qt().ad())}Be({context:A,bitmapSize:e,verticalPixelRatio:t}){if(this.wp.W().timeScale.borderVisible){A.fillStyle=this.Cm();const s=Math.max(1,Math.floor(this.xm().C*t));A.fillRect(0,0,e.width,s)}}Qv(A){const e=this.wp.qt().yt(),t=e.Ea();if(!t||t.length===0)return;const s=this.N_.maxTickMarkWeight(t),i=this.xm(),n=e.W();n.borderVisible&&n.ticksVisible&&A.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:a,verticalPixelRatio:l})=>{o.strokeStyle=this.Cm(),o.fillStyle=this.Cm();const c=Math.max(1,Math.floor(a)),u=Math.floor(.5*a);o.beginPath();const d=Math.round(i.T*l);for(let g=t.length;g--;){const B=Math.round(t[g].coord*a);o.rect(B-u,0,c,d)}o.fill()})),A.useMediaCoordinateSpace((({context:o})=>{const a=i.C+i.T+i.L+i.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this.$v();for(const l of t)if(l.weight<s){const c=l.needAlignCoordinate?this.Tm(o,l.coord,l.label):l.coord;o.fillText(l.label,c,a)}o.font=this.Pm();for(const l of t)if(l.weight>=s){const c=l.needAlignCoordinate?this.Tm(o,l.coord,l.label):l.coord;o.fillText(l.label,c,a)}}))}Tm(A,e,t){const s=this.gv.Si(A,t),i=s/2,n=Math.floor(e-i)+.5;return n<0?e+=Math.abs(0-n):n+s>this.bv.width&&(e-=Math.abs(this.bv.width-(n+s))),e}ym(A,e){const t=this.xm();for(const s of A)for(const i of s.tn())i.xt().K(e,t)}Cm(){return this.wp.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}$v(){return St(this.j(),this.cn.fontFamily)}Pm(){return St(this.j(),this.cn.fontFamily,"bold")}xm(){this.k===null&&(this.k={C:1,N:NaN,L:NaN,V:NaN,Hi:NaN,T:5,P:NaN,R:"",ji:new Ar,Sm:0});const A=this.k,e=this.$v();if(A.R!==e){const t=this.j();A.P=t,A.R=e,A.L=3*t/12,A.V=3*t/12,A.Hi=9*t/12,A.N=0,A.Sm=4*t/12,A.ji.ir()}return this.k}ep(A){this.Dv.style.cursor=A===1?"ew-resize":"default"}vm(){const A=this.wp.qt(),e=A.W();e.leftPriceScale.visible||this.hm===null||(this.um.removeChild(this.hm.Wv()),this.hm.S(),this.hm=null),e.rightPriceScale.visible||this.lm===null||(this.dm.removeChild(this.lm.Wv()),this.lm.S(),this.lm=null);const t={nd:this.wp.qt().nd()},s=()=>e.leftPriceScale.borderVisible&&A.yt().W().borderVisible,i=()=>A.ad();e.leftPriceScale.visible&&this.hm===null&&(this.hm=new Ra("left",e,t,s,i),this.um.appendChild(this.hm.Wv())),e.rightPriceScale.visible&&this.lm===null&&(this.lm=new Ra("right",e,t,s,i),this.dm.appendChild(this.lm.Wv()))}}const Ld=!!It&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((r=>r.brand.includes("Chromium")))&&!!It&&(!((tn=navigator?.userAgentData)===null||tn===void 0)&&tn.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var tn;class Id{constructor(A,e,t){var s;this.Rm=[],this.Dm=0,this.Qa=0,this.e_=0,this.Om=0,this.Am=0,this.Vm=null,this.Bm=!1,this._p=new KA,this.up=new KA,this.gc=new KA,this.Im=null,this.zm=null,this.Em=A,this.cn=e,this.N_=t,this._m=document.createElement("div"),this._m.classList.add("tv-lightweight-charts"),this._m.style.overflow="hidden",this._m.style.direction="ltr",this._m.style.width="100%",this._m.style.height="100%",(s=this._m).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.Lm=document.createElement("table"),this.Lm.setAttribute("cellspacing","0"),this._m.appendChild(this.Lm),this.Nm=this.Fm.bind(this),rn(this.cn)&&this.Wm(!0),this.Ui=new gd(this.xc.bind(this),this.cn,t),this.qt().Fc().l(this.jm.bind(this),this),this.Hm=new Hd(this,this.N_),this.Lm.appendChild(this.Hm.Wv());const i=e.autoSize&&this.$m();let n=this.cn.width,o=this.cn.height;if(i||n===0||o===0){const a=A.getBoundingClientRect();n=n||a.width,o=o||a.height}this.Um(n,o),this.qm(),A.appendChild(this._m),this.Ym(),this.Ui.yt().Zu().l(this.Ui.$l.bind(this.Ui),this),this.Ui.f_().l(this.Ui.$l.bind(this.Ui),this)}qt(){return this.Ui}W(){return this.cn}Xm(){return this.Rm}Km(){return this.Hm}S(){this.Wm(!1),this.Dm!==0&&window.cancelAnimationFrame(this.Dm),this.Ui.Fc().p(this),this.Ui.yt().Zu().p(this),this.Ui.f_().p(this),this.Ui.S();for(const A of this.Rm)this.Lm.removeChild(A.Wv()),A.Np().p(this),A.Fp().p(this),A.S();this.Rm=[],H(this.Hm).S(),this._m.parentElement!==null&&this._m.parentElement.removeChild(this._m),this.gc.S(),this._p.S(),this.up.S(),this.Zm()}Um(A,e,t=!1){if(this.Qa===e&&this.e_===A)return;const s=(function(o){const a=Math.floor(o.width),l=Math.floor(o.height);return IA({width:a-a%2,height:l-l%2})})(IA({width:A,height:e}));this.Qa=s.height,this.e_=s.width;const i=this.Qa+"px",n=this.e_+"px";H(this._m).style.height=i,H(this._m).style.width=n,this.Lm.style.height=i,this.Lm.style.width=n,t?this.Gm(YA.es(),performance.now()):this.Ui.$l()}Kv(A){A===void 0&&(A=YA.es());for(let e=0;e<this.Rm.length;e++)this.Rm[e].Kv(A.Hn(e).Fn);this.cn.timeScale.visible&&this.Hm.Kv(A.jn())}Nh(A){const e=rn(this.cn);this.Ui.Nh(A);const t=rn(this.cn);t!==e&&this.Wm(t),this.Ym(),this.Jm(A)}Np(){return this._p}Fp(){return this.up}Fc(){return this.gc}Qm(){this.Vm!==null&&(this.Gm(this.Vm,performance.now()),this.Vm=null);const A=this.tb(null),e=document.createElement("canvas");e.width=A.width,e.height=A.height;const t=H(e.getContext("2d"));return this.tb(t),e}ib(A){return A==="left"&&!this.nb()||A==="right"&&!this.sb()||this.Rm.length===0?0:H(A==="left"?this.Rm[0].Kp():this.Rm[0].Zp()).Yv()}eb(){return this.cn.autoSize&&this.Im!==null}rb(){return this._m}Ap(A){this.zm=A,this.zm?this.rb().style.setProperty("cursor",A):this.rb().style.removeProperty("cursor")}hb(){return this.zm}lb(){return ie(this.Rm[0]).Hp()}Jm(A){(A.autoSize!==void 0||!this.Im||A.width===void 0&&A.height===void 0)&&(A.autoSize&&!this.Im&&this.$m(),A.autoSize===!1&&this.Im!==null&&this.Zm(),A.autoSize||A.width===void 0&&A.height===void 0||this.Um(A.width||this.e_,A.height||this.Qa))}tb(A){let e=0,t=0;const s=this.Rm[0],i=(o,a)=>{let l=0;for(let c=0;c<this.Rm.length;c++){const u=this.Rm[c],d=H(o==="left"?u.Kp():u.Zp()),g=d.np();A!==null&&d.sp(A,a,l),l+=g.height}};this.nb()&&(i("left",0),e+=H(s.Kp()).np().width);for(let o=0;o<this.Rm.length;o++){const a=this.Rm[o],l=a.np();A!==null&&a.sp(A,e,t),t+=l.height}e+=s.np().width,this.sb()&&(i("right",e),e+=H(s.Zp()).np().width);const n=(o,a,l)=>{H(o==="left"?this.Hm.pm():this.Hm.bm()).sp(H(A),a,l)};if(this.cn.timeScale.visible){const o=this.Hm.np();if(A!==null){let a=0;this.nb()&&(n("left",a,t),a=H(s.Kp()).np().width),this.Hm.sp(A,a,t),a+=o.width,this.sb()&&n("right",a,t)}t+=o.height}return IA({width:e,height:t})}ab(){let A=0,e=0,t=0;for(const B of this.Rm)this.nb()&&(e=Math.max(e,H(B.Kp()).Hv(),this.cn.leftPriceScale.minimumWidth)),this.sb()&&(t=Math.max(t,H(B.Zp()).Hv(),this.cn.rightPriceScale.minimumWidth)),A+=B.v_();e=zi(e),t=zi(t);const s=this.e_,i=this.Qa,n=Math.max(s-e-t,0),o=this.cn.timeScale.visible;let a=o?Math.max(this.Hm.Mm(),this.cn.timeScale.minimumHeight):0;var l;a=(l=a)+l%2;const c=0+a,u=i<c?0:i-c,d=u/A;let g=0;for(let B=0;B<this.Rm.length;++B){const f=this.Rm[B];f.Cp(this.Ui.Ec()[B]);let w=0,m=0;m=B===this.Rm.length-1?u-g:Math.round(f.v_()*d),w=Math.max(m,2),g+=w,f.qv(IA({width:n,height:w})),this.nb()&&f.jp(e,"left"),this.sb()&&f.jp(t,"right"),f.Xv()&&this.Ui.Wc(f.Xv(),w)}this.Hm.gm(IA({width:o?n:0,height:a}),o?e:0,o?t:0),this.Ui.m_(n),this.Om!==e&&(this.Om=e),this.Am!==t&&(this.Am=t)}Wm(A){A?this._m.addEventListener("wheel",this.Nm,{passive:!1}):this._m.removeEventListener("wheel",this.Nm)}ob(A){switch(A.deltaMode){case A.DOM_DELTA_PAGE:return 120;case A.DOM_DELTA_LINE:return 32}return Ld?1/window.devicePixelRatio:1}Fm(A){if(!(A.deltaX!==0&&this.cn.handleScroll.mouseWheel||A.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const e=this.ob(A),t=e*A.deltaX/100,s=-e*A.deltaY/100;if(A.cancelable&&A.preventDefault(),s!==0&&this.cn.handleScale.mouseWheel){const i=Math.sign(s)*Math.min(1,Math.abs(s)),n=A.clientX-this._m.getBoundingClientRect().left;this.qt().$c(n,i)}t!==0&&this.cn.handleScroll.mouseWheel&&this.qt().Uc(-80*t)}Gm(A,e){var t;const s=A.jn();s===3&&this._b(),s!==3&&s!==2||(this.ub(A),this.cb(A,e),this.Hm.gt(),this.Rm.forEach((i=>{i.Pp()})),((t=this.Vm)===null||t===void 0?void 0:t.jn())===3&&(this.Vm.ts(A),this._b(),this.ub(this.Vm),this.cb(this.Vm,e),A=this.Vm,this.Vm=null)),this.Kv(A)}cb(A,e){for(const t of A.Qn())this.ns(t,e)}ub(A){const e=this.Ui.Ec();for(let t=0;t<e.length;t++)A.Hn(t).Wn&&e[t].V_()}ns(A,e){const t=this.Ui.yt();switch(A.qn){case 0:t.Ju();break;case 1:t.Qu(A.Vt);break;case 2:t.Gn(A.Vt);break;case 3:t.Jn(A.Vt);break;case 4:t.Nu();break;case 5:A.Vt.qu(e)||t.Jn(A.Vt.Yu(e))}}xc(A){this.Vm!==null?this.Vm.ts(A):this.Vm=A,this.Bm||(this.Bm=!0,this.Dm=window.requestAnimationFrame((e=>{if(this.Bm=!1,this.Dm=0,this.Vm!==null){const t=this.Vm;this.Vm=null,this.Gm(t,e);for(const s of t.Qn())if(s.qn===5&&!s.Vt.qu(e)){this.qt().Xn(s.Vt);break}}})))}_b(){this.qm()}qm(){const A=this.Ui.Ec(),e=A.length,t=this.Rm.length;for(let s=e;s<t;s++){const i=ie(this.Rm.pop());this.Lm.removeChild(i.Wv()),i.Np().p(this),i.Fp().p(this),i.S()}for(let s=t;s<e;s++){const i=new An(this,A[s]);i.Np().l(this.fb.bind(this),this),i.Fp().l(this.vb.bind(this),this),this.Rm.push(i),this.Lm.insertBefore(i.Wv(),this.Hm.Wv())}for(let s=0;s<e;s++){const i=A[s],n=this.Rm[s];n.Xv()!==i?n.Cp(i):n.yp()}this.Ym(),this.ab()}pb(A,e,t){var s;const i=new Map;A!==null&&this.Ui.Mt().forEach((c=>{const u=c.In().nl(A);u!==null&&i.set(c,u)}));let n;if(A!==null){const c=(s=this.Ui.yt().qi(A))===null||s===void 0?void 0:s.originalTime;c!==void 0&&(n=c)}const o=this.qt().Ac(),a=o!==null&&o.Bc instanceof ki?o.Bc:void 0,l=o!==null&&o.vv!==void 0?o.vv.wr:void 0;return{mb:n,se:A??void 0,bb:e??void 0,wb:a,gb:i,Mb:l,xb:t??void 0}}fb(A,e,t){this._p.m((()=>this.pb(A,e,t)))}vb(A,e,t){this.up.m((()=>this.pb(A,e,t)))}jm(A,e,t){this.gc.m((()=>this.pb(A,e,t)))}Ym(){const A=this.cn.timeScale.visible?"":"none";this.Hm.Wv().style.display=A}nb(){return this.Rm[0].Xv().S_().W().visible}sb(){return this.Rm[0].Xv().k_().W().visible}$m(){return"ResizeObserver"in window&&(this.Im=new ResizeObserver((A=>{const e=A.find((t=>t.target===this.Em));e&&this.Um(e.contentRect.width,e.contentRect.height)})),this.Im.observe(this.Em,{box:"border-box"}),!0)}Zm(){this.Im!==null&&this.Im.disconnect(),this.Im=null}}function rn(r){return!!(r.handleScroll.mouseWheel||r.handleScale.mouseWheel)}function Wa(r,A){var e={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&A.indexOf(t)<0&&(e[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(t=Object.getOwnPropertySymbols(r);s<t.length;s++)A.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(r,t[s])&&(e[t[s]]=r[t[s]])}return e}function za(r,A,e,t){const s=e.value,i={se:A,ut:r,Vt:[s,s,s,s],mb:t};return e.color!==void 0&&(i.O=e.color),i}function Td(r,A,e,t){const s=e.value,i={se:A,ut:r,Vt:[s,s,s,s],mb:t};return e.lineColor!==void 0&&(i._t=e.lineColor),e.topColor!==void 0&&(i.Ts=e.topColor),e.bottomColor!==void 0&&(i.Ps=e.bottomColor),i}function Md(r,A,e,t){const s=e.value,i={se:A,ut:r,Vt:[s,s,s,s],mb:t};return e.topLineColor!==void 0&&(i.Pe=e.topLineColor),e.bottomLineColor!==void 0&&(i.Re=e.bottomLineColor),e.topFillColor1!==void 0&&(i.Se=e.topFillColor1),e.topFillColor2!==void 0&&(i.ke=e.topFillColor2),e.bottomFillColor1!==void 0&&(i.ye=e.bottomFillColor1),e.bottomFillColor2!==void 0&&(i.Ce=e.bottomFillColor2),i}function Dd(r,A,e,t){const s={se:A,ut:r,Vt:[e.open,e.high,e.low,e.close],mb:t};return e.color!==void 0&&(s.O=e.color),s}function Od(r,A,e,t){const s={se:A,ut:r,Vt:[e.open,e.high,e.low,e.close],mb:t};return e.color!==void 0&&(s.O=e.color),e.borderColor!==void 0&&(s.Bt=e.borderColor),e.wickColor!==void 0&&(s.$h=e.wickColor),s}function kd(r,A,e,t,s){const i=ie(s)(e),n=Math.max(...i),o=Math.min(...i),a=i[i.length-1],l=[a,n,o,a],c=e,{time:u,color:d}=c;return{se:A,ut:r,Vt:l,mb:t,He:Wa(c,["time","color"]),O:d}}function is(r){return r.Vt!==void 0}function Xa(r,A){return A.customValues!==void 0&&(r.Sb=A.customValues),r}function pt(r){return(A,e,t,s,i,n)=>(function(o,a){return a?a(o):(l=o).open===void 0&&l.value===void 0;var l})(t,n)?Xa({ut:A,se:e,mb:s},t):Xa(r(A,e,t,s,i),t)}function Ja(r){return{Candlestick:pt(Od),Bar:pt(Dd),Area:pt(Td),Baseline:pt(Md),Histogram:pt(za),Line:pt(za),Custom:pt(kd)}[r]}function Za(r){return{se:0,kb:new Map,ia:r}}function Ya(r,A){if(r!==void 0&&r.length!==0)return{yb:A.key(r[0].ut),Cb:A.key(r[r.length-1].ut)}}function qa(r){let A;return r.forEach((e=>{A===void 0&&(A=e.mb)})),ie(A)}class _d{constructor(A){this.Tb=new Map,this.Pb=new Map,this.Rb=new Map,this.Db=[],this.N_=A}S(){this.Tb.clear(),this.Pb.clear(),this.Rb.clear(),this.Db=[]}Ob(A,e){let t=this.Tb.size!==0,s=!1;const i=this.Pb.get(A);if(i!==void 0)if(this.Pb.size===1)t=!1,s=!0,this.Tb.clear();else for(const a of this.Db)a.pointData.kb.delete(A)&&(s=!0);let n=[];if(e.length!==0){const a=e.map((g=>g.time)),l=this.N_.createConverterToInternalObj(e),c=Ja(A.Xh()),u=A.ga(),d=A.Ma();n=e.map(((g,B)=>{const f=l(g.time),w=this.N_.key(f);let m=this.Tb.get(w);m===void 0&&(m=Za(f),this.Tb.set(w,m),s=!0);const p=c(f,m.se,g,a[B],u,d);return m.kb.set(A,p),p}))}t&&this.Ab(),this.Vb(A,n);let o=-1;if(s){const a=[];this.Tb.forEach((l=>{a.push({timeWeight:0,time:l.ia,pointData:l,originalTime:qa(l.kb)})})),a.sort(((l,c)=>this.N_.key(l.time)-this.N_.key(c.time))),o=this.Bb(a)}return this.Ib(A,o,(function(a,l,c){const u=Ya(a,c),d=Ya(l,c);if(u!==void 0&&d!==void 0)return{Xl:u.Cb>=d.Cb&&u.yb>=d.yb}})(this.Pb.get(A),i,this.N_))}rd(A){return this.Ob(A,[])}zb(A,e){const t=e;(function(f){f.mb===void 0&&(f.mb=f.time)})(t),this.N_.preprocessData(e);const s=this.N_.createConverterToInternalObj([e])(e.time),i=this.Rb.get(A);if(i!==void 0&&this.N_.key(s)<this.N_.key(i))throw new Error(`Cannot update oldest data, last time=${i}, new time=${s}`);let n=this.Tb.get(this.N_.key(s));const o=n===void 0;n===void 0&&(n=Za(s),this.Tb.set(this.N_.key(s),n));const a=Ja(A.Xh()),l=A.ga(),c=A.Ma(),u=a(s,n.se,e,t.mb,l,c);n.kb.set(A,u),this.Eb(A,u);const d={Xl:is(u)};if(!o)return this.Ib(A,-1,d);const g={timeWeight:0,time:n.ia,pointData:n,originalTime:qa(n.kb)},B=jt(this.Db,this.N_.key(g.time),((f,w)=>this.N_.key(f.time)<w));this.Db.splice(B,0,g);for(let f=B;f<this.Db.length;++f)sn(this.Db[f].pointData,f);return this.N_.fillWeightsForPoints(this.Db,B),this.Ib(A,B,d)}Eb(A,e){let t=this.Pb.get(A);t===void 0&&(t=[],this.Pb.set(A,t));const s=t.length!==0?t[t.length-1]:null;s===null||this.N_.key(e.ut)>this.N_.key(s.ut)?is(e)&&t.push(e):is(e)?t[t.length-1]=e:t.splice(-1,1),this.Rb.set(A,e.ut)}Vb(A,e){e.length!==0?(this.Pb.set(A,e.filter(is)),this.Rb.set(A,e[e.length-1].ut)):(this.Pb.delete(A),this.Rb.delete(A))}Ab(){for(const A of this.Db)A.pointData.kb.size===0&&this.Tb.delete(this.N_.key(A.time))}Bb(A){let e=-1;for(let t=0;t<this.Db.length&&t<A.length;++t){const s=this.Db[t],i=A[t];if(this.N_.key(s.time)!==this.N_.key(i.time)){e=t;break}i.timeWeight=s.timeWeight,sn(i.pointData,t)}if(e===-1&&this.Db.length!==A.length&&(e=Math.min(this.Db.length,A.length)),e===-1)return-1;for(let t=e;t<A.length;++t)sn(A[t].pointData,t);return this.N_.fillWeightsForPoints(A,e),this.Db=A,e}Lb(){if(this.Pb.size===0)return null;let A=0;return this.Pb.forEach((e=>{e.length!==0&&(A=Math.max(A,e[e.length-1].se))})),A}Ib(A,e,t){const s={Nb:new Map,yt:{Ou:this.Lb()}};if(e!==-1)this.Pb.forEach(((i,n)=>{s.Nb.set(n,{He:i,Fb:n===A?t:void 0})})),this.Pb.has(A)||s.Nb.set(A,{He:[],Fb:t}),s.yt.Wb=this.Db,s.yt.jb=e;else{const i=this.Pb.get(A);s.Nb.set(A,{He:i||[],Fb:t})}return s}}function sn(r,A){r.se=A,r.kb.forEach((e=>{e.se=A}))}function nn(r){const A={value:r.Vt[3],time:r.mb};return r.Sb!==void 0&&(A.customValues=r.Sb),A}function $a(r){const A=nn(r);return r.O!==void 0&&(A.color=r.O),A}function Nd(r){const A=nn(r);return r._t!==void 0&&(A.lineColor=r._t),r.Ts!==void 0&&(A.topColor=r.Ts),r.Ps!==void 0&&(A.bottomColor=r.Ps),A}function Kd(r){const A=nn(r);return r.Pe!==void 0&&(A.topLineColor=r.Pe),r.Re!==void 0&&(A.bottomLineColor=r.Re),r.Se!==void 0&&(A.topFillColor1=r.Se),r.ke!==void 0&&(A.topFillColor2=r.ke),r.ye!==void 0&&(A.bottomFillColor1=r.ye),r.Ce!==void 0&&(A.bottomFillColor2=r.Ce),A}function ja(r){const A={open:r.Vt[0],high:r.Vt[1],low:r.Vt[2],close:r.Vt[3],time:r.mb};return r.Sb!==void 0&&(A.customValues=r.Sb),A}function Vd(r){const A=ja(r);return r.O!==void 0&&(A.color=r.O),A}function Pd(r){const A=ja(r),{O:e,Bt:t,$h:s}=r;return e!==void 0&&(A.color=e),t!==void 0&&(A.borderColor=t),s!==void 0&&(A.wickColor=s),A}function on(r){return{Area:Nd,Line:$a,Baseline:Kd,Histogram:$a,Bar:Vd,Candlestick:Pd,Custom:Gd}[r]}function Gd(r){const A=r.mb;return Object.assign(Object.assign({},r.He),{time:A})}const Rd={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},Wd={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},zd={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Qi},an={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},Xd={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,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0},Jd={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Qi,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Al(){return{width:0,height:0,autoSize:!1,layout:zd,crosshair:Rd,grid:Wd,overlayPriceScales:Object.assign({},an),leftPriceScale:Object.assign(Object.assign({},an),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},an),{visible:!0}),timeScale:Xd,watermark:Jd,localization:{locale:It?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 Zd{constructor(A,e){this.Hb=A,this.$b=e}applyOptions(A){this.Hb.qt().Ic(this.$b,A)}options(){return this.Li().W()}width(){return Wr(this.$b)?this.Hb.ib(this.$b):0}Li(){return H(this.Hb.qt().zc(this.$b)).At}}function el(r,A,e){const t=Wa(r,["time","originalTime"]),s=Object.assign({time:A},t);return e!==void 0&&(s.originalTime=e),s}const Yd={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class qd{constructor(A){this.Bh=A}applyOptions(A){this.Bh.Nh(A)}options(){return this.Bh.W()}Ub(){return this.Bh}}class $d{constructor(A,e,t,s,i){this.qb=new KA,this.Es=A,this.Yb=e,this.Xb=t,this.N_=i,this.Kb=s}S(){this.qb.S()}priceFormatter(){return this.Es.ca()}priceToCoordinate(A){const e=this.Es.Pt();return e===null?null:this.Es.At().Ot(A,e.Vt)}coordinateToPrice(A){const e=this.Es.Pt();return e===null?null:this.Es.At().pn(A,e.Vt)}barsInLogicalRange(A){if(A===null)return null;const e=new Lt(new nr(A.from,A.to)).iu(),t=this.Es.In();if(t.Fi())return null;const s=t.nl(e.Os(),1),i=t.nl(e.di(),-1),n=H(t.Qh()),o=H(t.Bn());if(s!==null&&i!==null&&s.se>i.se)return{barsBefore:A.from-n,barsAfter:o-A.to};const a={barsBefore:s===null||s.se===n?A.from-n:s.se-n,barsAfter:i===null||i.se===o?o-A.to:o-i.se};return s!==null&&i!==null&&(a.from=s.mb,a.to=i.mb),a}setData(A){this.N_,this.Es.Xh(),this.Yb.Zb(this.Es,A),this.Gb("full")}update(A){this.Es.Xh(),this.Yb.Jb(this.Es,A),this.Gb("update")}dataByIndex(A,e){const t=this.Es.In().nl(A,e);return t===null?null:on(this.seriesType())(t)}data(){const A=on(this.seriesType());return this.Es.In().ie().map((e=>A(e)))}subscribeDataChanged(A){this.qb.l(A)}unsubscribeDataChanged(A){this.qb.v(A)}setMarkers(A){this.N_;const e=A.map((t=>el(t,this.N_.convertHorzItemToInternal(t.time),t.time)));this.Es.Zl(e)}markers(){return this.Es.Gl().map((A=>el(A,A.originalTime,void 0)))}applyOptions(A){this.Es.Nh(A)}options(){return ze(this.Es.W())}priceScale(){return this.Xb.priceScale(this.Es.At().xa())}createPriceLine(A){const e=Ue(ze(Yd),A),t=this.Es.Jl(e);return new qd(t)}removePriceLine(A){this.Es.Ql(A.Ub())}seriesType(){return this.Es.Xh()}attachPrimitive(A){this.Es.ba(A),A.attached&&A.attached({chart:this.Kb,series:this,requestUpdate:()=>this.Es.qt().$l()})}detachPrimitive(A){this.Es.wa(A),A.detached&&A.detached()}Gb(A){this.qb.M()&&this.qb.m(A)}}class jd{constructor(A,e,t){this.Qb=new KA,this.uu=new KA,this.om=new KA,this.Ui=A,this.wl=A.yt(),this.Hm=e,this.wl.Xu().l(this.tw.bind(this)),this.wl.Ku().l(this.iw.bind(this)),this.Hm.wm().l(this.nw.bind(this)),this.N_=t}S(){this.wl.Xu().p(this),this.wl.Ku().p(this),this.Hm.wm().p(this),this.Qb.S(),this.uu.S(),this.om.S()}scrollPosition(){return this.wl.zu()}scrollToPosition(A,e){e?this.wl.Uu(A,1e3):this.Ui.Jn(A)}scrollToRealTime(){this.wl.$u()}getVisibleRange(){const A=this.wl.yu();return A===null?null:{from:A.from.originalTime,to:A.to.originalTime}}setVisibleRange(A){const e={from:this.N_.convertHorzItemToInternal(A.from),to:this.N_.convertHorzItemToInternal(A.to)},t=this.wl.Pu(e);this.Ui.hd(t)}getVisibleLogicalRange(){const A=this.wl.ku();return A===null?null:{from:A.Os(),to:A.di()}}setVisibleLogicalRange(A){At(A.from<=A.to,"The from index cannot be after the to index."),this.Ui.hd(A)}resetTimeScale(){this.Ui.Zn()}fitContent(){this.Ui.Ju()}logicalToCoordinate(A){const e=this.Ui.yt();return e.Fi()?null:e.Et(A)}coordinateToLogical(A){return this.wl.Fi()?null:this.wl.Au(A)}timeToCoordinate(A){const e=this.N_.convertHorzItemToInternal(A),t=this.wl.ya(e,!1);return t===null?null:this.wl.Et(t)}coordinateToTime(A){const e=this.Ui.yt(),t=e.Au(A),s=e.qi(t);return s===null?null:s.originalTime}width(){return this.Hm.Hp().width}height(){return this.Hm.Hp().height}subscribeVisibleTimeRangeChange(A){this.Qb.l(A)}unsubscribeVisibleTimeRangeChange(A){this.Qb.v(A)}subscribeVisibleLogicalRangeChange(A){this.uu.l(A)}unsubscribeVisibleLogicalRangeChange(A){this.uu.v(A)}subscribeSizeChange(A){this.om.l(A)}unsubscribeSizeChange(A){this.om.v(A)}applyOptions(A){this.wl.Nh(A)}options(){return Object.assign(Object.assign({},ze(this.wl.W())),{barSpacing:this.wl.he()})}tw(){this.Qb.M()&&this.Qb.m(this.getVisibleRange())}iw(){this.uu.M()&&this.uu.m(this.getVisibleLogicalRange())}nw(A){this.om.m(A.width,A.height)}}function A0(r){if(r===void 0||r.type==="custom")return;const A=r;A.minMove!==void 0&&A.precision===void 0&&(A.precision=(function(e){if(e>=1)return 0;let t=0;for(;t<8;t++){const s=Math.round(e);if(Math.abs(s-e)<1e-8)return t;e*=10}return t})(A.minMove))}function tl(r){return(function(A){if(Pr(A.handleScale)){const t=A.handleScale;A.handleScale={axisDoubleClickReset:{time:t,price:t},axisPressedMouseMove:{time:t,price:t},mouseWheel:t,pinch:t}}else if(A.handleScale!==void 0){const{axisPressedMouseMove:t,axisDoubleClickReset:s}=A.handleScale;Pr(t)&&(A.handleScale.axisPressedMouseMove={time:t,price:t}),Pr(s)&&(A.handleScale.axisDoubleClickReset={time:s,price:s})}const e=A.handleScroll;Pr(e)&&(A.handleScroll={horzTouchDrag:e,vertTouchDrag:e,mouseWheel:e,pressedMouseMove:e})})(r),r}class e0{constructor(A,e,t){this.sw=new Map,this.ew=new Map,this.rw=new KA,this.hw=new KA,this.lw=new KA,this.aw=new _d(e);const s=t===void 0?ze(Al()):Ue(ze(Al()),tl(t));this.N_=e,this.Hb=new Id(A,s,e),this.Hb.Np().l((n=>{this.rw.M()&&this.rw.m(this.ow(n()))}),this),this.Hb.Fp().l((n=>{this.hw.M()&&this.hw.m(this.ow(n()))}),this),this.Hb.Fc().l((n=>{this.lw.M()&&this.lw.m(this.ow(n()))}),this);const i=this.Hb.qt();this._w=new jd(i,this.Hb.Km(),this.N_)}remove(){this.Hb.Np().p(this),this.Hb.Fp().p(this),this.Hb.Fc().p(this),this._w.S(),this.Hb.S(),this.sw.clear(),this.ew.clear(),this.rw.S(),this.hw.S(),this.lw.S(),this.aw.S()}resize(A,e,t){this.autoSizeActive()||this.Hb.Um(A,e,t)}addCustomSeries(A,e){const t=xt(A),s=Object.assign(Object.assign({},Ko),t.defaultOptions());return this.uw("Custom",s,e,t)}addAreaSeries(A){return this.uw("Area",Ku,A)}addBaselineSeries(A){return this.uw("Baseline",Vu,A)}addBarSeries(A){return this.uw("Bar",_u,A)}addCandlestickSeries(A={}){return(function(e){e.borderColor!==void 0&&(e.borderUpColor=e.borderColor,e.borderDownColor=e.borderColor),e.wickColor!==void 0&&(e.wickUpColor=e.wickColor,e.wickDownColor=e.wickColor)})(A),this.uw("Candlestick",ku,A)}addHistogramSeries(A){return this.uw("Histogram",Pu,A)}addLineSeries(A){return this.uw("Line",Nu,A)}removeSeries(A){const e=ie(this.sw.get(A)),t=this.aw.rd(e);this.Hb.qt().rd(e),this.cw(t),this.sw.delete(A),this.ew.delete(e)}Zb(A,e){this.cw(this.aw.Ob(A,e))}Jb(A,e){this.cw(this.aw.zb(A,e))}subscribeClick(A){this.rw.l(A)}unsubscribeClick(A){this.rw.v(A)}subscribeCrosshairMove(A){this.lw.l(A)}unsubscribeCrosshairMove(A){this.lw.v(A)}subscribeDblClick(A){this.hw.l(A)}unsubscribeDblClick(A){this.hw.v(A)}priceScale(A){return new Zd(this.Hb,A)}timeScale(){return this._w}applyOptions(A){this.Hb.Nh(tl(A))}options(){return this.Hb.W()}takeScreenshot(){return this.Hb.Qm()}autoSizeActive(){return this.Hb.eb()}chartElement(){return this.Hb.rb()}paneSize(){const A=this.Hb.lb();return{height:A.height,width:A.width}}setCrosshairPosition(A,e,t){const s=this.sw.get(t);if(s===void 0)return;const i=this.Hb.qt().cr(s);i!==null&&this.Hb.qt().Jc(A,e,i)}clearCrosshairPosition(){this.Hb.qt().Qc(!0)}uw(A,e,t={},s){A0(t.priceFormat);const i=Ue(ze(Vo),ze(e),t),n=this.Hb.qt().sd(A,i,s),o=new $d(n,this,this,this,this.N_);return this.sw.set(o,n),this.ew.set(n,o),o}cw(A){const e=this.Hb.qt();e.td(A.yt.Ou,A.yt.Wb,A.yt.jb),A.Nb.forEach(((t,s)=>s.it(t.He,t.Fb))),e.Bu()}dw(A){return ie(this.ew.get(A))}ow(A){const e=new Map;A.gb.forEach(((s,i)=>{const n=i.Xh(),o=on(n)(s);if(n!=="Custom")At((function(a){return a.open!==void 0||a.value!==void 0})(o));else{const a=i.Ma();At(!a||a(o)===!1)}e.set(this.dw(i),o)}));const t=A.wb===void 0?void 0:this.dw(A.wb);return{time:A.mb,logical:A.se,point:A.bb,hoveredSeries:t,hoveredObjectId:A.Mb,seriesData:e,sourceEvent:A.xb}}}function t0(r,A,e){let t;if(qt(r)){const i=document.getElementById(r);At(i!==null,`Cannot find element in DOM with id=${r}`),t=i}else t=r;const s=new e0(t,A,e);return A.setOptions(s.options()),s}function r0(r,A){return t0(r,new Ka,Ka.Cd(A))}Object.assign(Object.assign({},Vo),Ko);function rl(r,A){return function(){return r.apply(A,arguments)}}const{toString:s0}=Object.prototype,{getPrototypeOf:ln}=Object,{iterator:ns,toStringTag:sl}=Symbol,os=(r=>A=>{const e=s0.call(A);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),Ee=r=>(r=r.toLowerCase(),A=>os(A)===r),as=r=>A=>typeof A===r,{isArray:Mt}=Array,Dt=as("undefined");function or(r){return r!==null&&!Dt(r)&&r.constructor!==null&&!Dt(r.constructor)&&he(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const il=Ee("ArrayBuffer");function i0(r){let A;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?A=ArrayBuffer.isView(r):A=r&&r.buffer&&il(r.buffer),A}const n0=as("string"),he=as("function"),nl=as("number"),ar=r=>r!==null&&typeof r=="object",o0=r=>r===!0||r===!1,ls=r=>{if(os(r)!=="object")return!1;const A=ln(r);return(A===null||A===Object.prototype||Object.getPrototypeOf(A)===null)&&!(sl in r)&&!(ns in r)},a0=r=>{if(!ar(r)||or(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},l0=Ee("Date"),c0=Ee("File"),h0=Ee("Blob"),u0=Ee("FileList"),f0=r=>ar(r)&&he(r.pipe),d0=r=>{let A;return r&&(typeof FormData=="function"&&r instanceof FormData||he(r.append)&&((A=os(r))==="formdata"||A==="object"&&he(r.toString)&&r.toString()==="[object FormData]"))},B0=Ee("URLSearchParams"),[g0,p0,w0,m0]=["ReadableStream","Request","Response","Headers"].map(Ee),C0=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lr(r,A,{allOwnKeys:e=!1}={}){if(r===null||typeof r>"u")return;let t,s;if(typeof r!="object"&&(r=[r]),Mt(r))for(t=0,s=r.length;t<s;t++)A.call(null,r[t],t,r);else{if(or(r))return;const i=e?Object.getOwnPropertyNames(r):Object.keys(r),n=i.length;let o;for(t=0;t<n;t++)o=i[t],A.call(null,r[o],o,r)}}function ol(r,A){if(or(r))return null;A=A.toLowerCase();const e=Object.keys(r);let t=e.length,s;for(;t-- >0;)if(s=e[t],A===s.toLowerCase())return s;return null}const wt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,al=r=>!Dt(r)&&r!==wt;function cn(){const{caseless:r,skipUndefined:A}=al(this)&&this||{},e={},t=(s,i)=>{const n=r&&ol(e,i)||i;ls(e[n])&&ls(s)?e[n]=cn(e[n],s):ls(s)?e[n]=cn({},s):Mt(s)?e[n]=s.slice():(!A||!Dt(s))&&(e[n]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&lr(arguments[s],t);return e}const v0=(r,A,e,{allOwnKeys:t}={})=>(lr(A,(s,i)=>{e&&he(s)?Object.defineProperty(r,i,{value:rl(s,e),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:t}),r),b0=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Q0=(r,A,e,t)=>{r.prototype=Object.create(A.prototype,t),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:A.prototype}),e&&Object.assign(r.prototype,e)},F0=(r,A,e,t)=>{let s,i,n;const o={};if(A=A||{},r==null)return A;do{for(s=Object.getOwnPropertyNames(r),i=s.length;i-- >0;)n=s[i],(!t||t(n,r,A))&&!o[n]&&(A[n]=r[n],o[n]=!0);r=e!==!1&&ln(r)}while(r&&(!e||e(r,A))&&r!==Object.prototype);return A},y0=(r,A,e)=>{r=String(r),(e===void 0||e>r.length)&&(e=r.length),e-=A.length;const t=r.indexOf(A,e);return t!==-1&&t===e},U0=r=>{if(!r)return null;if(Mt(r))return r;let A=r.length;if(!nl(A))return null;const e=new Array(A);for(;A-- >0;)e[A]=r[A];return e},E0=(r=>A=>r&&A instanceof r)(typeof Uint8Array<"u"&&ln(Uint8Array)),x0=(r,A)=>{const t=(r&&r[ns]).call(r);let s;for(;(s=t.next())&&!s.done;){const i=s.value;A.call(r,i[0],i[1])}},S0=(r,A)=>{let e;const t=[];for(;(e=r.exec(A))!==null;)t.push(e);return t},H0=Ee("HTMLFormElement"),L0=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,s){return t.toUpperCase()+s}),ll=(({hasOwnProperty:r})=>(A,e)=>r.call(A,e))(Object.prototype),I0=Ee("RegExp"),cl=(r,A)=>{const e=Object.getOwnPropertyDescriptors(r),t={};lr(e,(s,i)=>{let n;(n=A(s,i,r))!==!1&&(t[i]=n||s)}),Object.defineProperties(r,t)},T0=r=>{cl(r,(A,e)=>{if(he(r)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const t=r[e];if(he(t)){if(A.enumerable=!1,"writable"in A){A.writable=!1;return}A.set||(A.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},M0=(r,A)=>{const e={},t=s=>{s.forEach(i=>{e[i]=!0})};return Mt(r)?t(r):t(String(r).split(A)),e},D0=()=>{},O0=(r,A)=>r!=null&&Number.isFinite(r=+r)?r:A;function k0(r){return!!(r&&he(r.append)&&r[sl]==="FormData"&&r[ns])}const _0=r=>{const A=new Array(10),e=(t,s)=>{if(ar(t)){if(A.indexOf(t)>=0)return;if(or(t))return t;if(!("toJSON"in t)){A[s]=t;const i=Mt(t)?[]:{};return lr(t,(n,o)=>{const a=e(n,s+1);!Dt(a)&&(i[o]=a)}),A[s]=void 0,i}}return t};return e(r,0)},N0=Ee("AsyncFunction"),K0=r=>r&&(ar(r)||he(r))&&he(r.then)&&he(r.catch),hl=((r,A)=>r?setImmediate:A?((e,t)=>(wt.addEventListener("message",({source:s,data:i})=>{s===wt&&i===e&&t.length&&t.shift()()},!1),s=>{t.push(s),wt.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate=="function",he(wt.postMessage)),V0=typeof queueMicrotask<"u"?queueMicrotask.bind(wt):typeof process<"u"&&process.nextTick||hl,Q={isArray:Mt,isArrayBuffer:il,isBuffer:or,isFormData:d0,isArrayBufferView:i0,isString:n0,isNumber:nl,isBoolean:o0,isObject:ar,isPlainObject:ls,isEmptyObject:a0,isReadableStream:g0,isRequest:p0,isResponse:w0,isHeaders:m0,isUndefined:Dt,isDate:l0,isFile:c0,isBlob:h0,isRegExp:I0,isFunction:he,isStream:f0,isURLSearchParams:B0,isTypedArray:E0,isFileList:u0,forEach:lr,merge:cn,extend:v0,trim:C0,stripBOM:b0,inherits:Q0,toFlatObject:F0,kindOf:os,kindOfTest:Ee,endsWith:y0,toArray:U0,forEachEntry:x0,matchAll:S0,isHTMLForm:H0,hasOwnProperty:ll,hasOwnProp:ll,reduceDescriptors:cl,freezeMethods:T0,toObjectSet:M0,toCamelCase:L0,noop:D0,toFiniteNumber:O0,findKey:ol,global:wt,isContextDefined:al,isSpecCompliantForm:k0,toJSONObject:_0,isAsyncFn:N0,isThenable:K0,setImmediate:hl,asap:V0,isIterable:r=>r!=null&&he(r[ns])};let oA=class xu extends Error{static from(A,e,t,s,i,n){const o=new xu(A.message,e||A.code,t,s,i);return o.cause=A,o.name=A.name,n&&Object.assign(o,n),o}constructor(A,e,t,s,i){super(A),this.name="AxiosError",this.isAxiosError=!0,e&&(this.code=e),t&&(this.config=t),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Q.toJSONObject(this.config),code:this.code,status:this.status}}};oA.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",oA.ERR_BAD_OPTION="ERR_BAD_OPTION",oA.ECONNABORTED="ECONNABORTED",oA.ETIMEDOUT="ETIMEDOUT",oA.ERR_NETWORK="ERR_NETWORK",oA.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",oA.ERR_DEPRECATED="ERR_DEPRECATED",oA.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",oA.ERR_BAD_REQUEST="ERR_BAD_REQUEST",oA.ERR_CANCELED="ERR_CANCELED",oA.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",oA.ERR_INVALID_URL="ERR_INVALID_URL";const P0=null;function hn(r){return Q.isPlainObject(r)||Q.isArray(r)}function ul(r){return Q.endsWith(r,"[]")?r.slice(0,-2):r}function fl(r,A,e){return r?r.concat(A).map(function(s,i){return s=ul(s),!e&&i?"["+s+"]":s}).join(e?".":""):A}function G0(r){return Q.isArray(r)&&!r.some(hn)}const R0=Q.toFlatObject(Q,{},null,function(A){return/^is[A-Z]/.test(A)});function cs(r,A,e){if(!Q.isObject(r))throw new TypeError("target must be an object");A=A||new FormData,e=Q.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,w){return!Q.isUndefined(w[f])});const t=e.metaTokens,s=e.visitor||c,i=e.dots,n=e.indexes,a=(e.Blob||typeof Blob<"u"&&Blob)&&Q.isSpecCompliantForm(A);if(!Q.isFunction(s))throw new TypeError("visitor must be a function");function l(B){if(B===null)return"";if(Q.isDate(B))return B.toISOString();if(Q.isBoolean(B))return B.toString();if(!a&&Q.isBlob(B))throw new oA("Blob is not supported. Use a Buffer instead.");return Q.isArrayBuffer(B)||Q.isTypedArray(B)?a&&typeof Blob=="function"?new Blob([B]):Buffer.from(B):B}function c(B,f,w){let m=B;if(B&&!w&&typeof B=="object"){if(Q.endsWith(f,"{}"))f=t?f:f.slice(0,-2),B=JSON.stringify(B);else if(Q.isArray(B)&&G0(B)||(Q.isFileList(B)||Q.endsWith(f,"[]"))&&(m=Q.toArray(B)))return f=ul(f),m.forEach(function(v,y){!(Q.isUndefined(v)||v===null)&&A.append(n===!0?fl([f],y,i):n===null?f:f+"[]",l(v))}),!1}return hn(B)?!0:(A.append(fl(w,f,i),l(B)),!1)}const u=[],d=Object.assign(R0,{defaultVisitor:c,convertValue:l,isVisitable:hn});function g(B,f){if(!Q.isUndefined(B)){if(u.indexOf(B)!==-1)throw Error("Circular reference detected in "+f.join("."));u.push(B),Q.forEach(B,function(m,p){(!(Q.isUndefined(m)||m===null)&&s.call(A,m,Q.isString(p)?p.trim():p,f,d))===!0&&g(m,f?f.concat(p):[p])}),u.pop()}}if(!Q.isObject(r))throw new TypeError("data must be an object");return g(r),A}function dl(r){const A={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(t){return A[t]})}function un(r,A){this._pairs=[],r&&cs(r,this,A)}const Bl=un.prototype;Bl.append=function(A,e){this._pairs.push([A,e])},Bl.toString=function(A){const e=A?function(t){return A.call(this,t,dl)}:dl;return this._pairs.map(function(s){return e(s[0])+"="+e(s[1])},"").join("&")};function W0(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function gl(r,A,e){if(!A)return r;const t=e&&e.encode||W0,s=Q.isFunction(e)?{serialize:e}:e,i=s&&s.serialize;let n;if(i?n=i(A,s):n=Q.isURLSearchParams(A)?A.toString():new un(A,s).toString(t),n){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+n}return r}class pl{constructor(){this.handlers=[]}use(A,e,t){return this.handlers.push({fulfilled:A,rejected:e,synchronous:t?t.synchronous:!1,runWhen:t?t.runWhen:null}),this.handlers.length-1}eject(A){this.handlers[A]&&(this.handlers[A]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(A){Q.forEach(this.handlers,function(t){t!==null&&A(t)})}}const wl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},z0={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:un,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},fn=typeof window<"u"&&typeof document<"u",dn=typeof navigator=="object"&&navigator||void 0,X0=fn&&(!dn||["ReactNative","NativeScript","NS"].indexOf(dn.product)<0),J0=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Z0=fn&&window.location.href||"http://localhost",jA={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fn,hasStandardBrowserEnv:X0,hasStandardBrowserWebWorkerEnv:J0,navigator:dn,origin:Z0},Symbol.toStringTag,{value:"Module"})),...z0};function Y0(r,A){return cs(r,new jA.classes.URLSearchParams,{visitor:function(e,t,s,i){return jA.isNode&&Q.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...A})}function q0(r){return Q.matchAll(/\w+|\[(\w*)]/g,r).map(A=>A[0]==="[]"?"":A[1]||A[0])}function $0(r){const A={},e=Object.keys(r);let t;const s=e.length;let i;for(t=0;t<s;t++)i=e[t],A[i]=r[i];return A}function ml(r){function A(e,t,s,i){let n=e[i++];if(n==="__proto__")return!0;const o=Number.isFinite(+n),a=i>=e.length;return n=!n&&Q.isArray(s)?s.length:n,a?(Q.hasOwnProp(s,n)?s[n]=[s[n],t]:s[n]=t,!o):((!s[n]||!Q.isObject(s[n]))&&(s[n]=[]),A(e,t,s[n],i)&&Q.isArray(s[n])&&(s[n]=$0(s[n])),!o)}if(Q.isFormData(r)&&Q.isFunction(r.entries)){const e={};return Q.forEachEntry(r,(t,s)=>{A(q0(t),s,e,0)}),e}return null}function j0(r,A,e){if(Q.isString(r))try{return(A||JSON.parse)(r),Q.trim(r)}catch(t){if(t.name!=="SyntaxError")throw t}return(e||JSON.stringify)(r)}const cr={transitional:wl,adapter:["xhr","http","fetch"],transformRequest:[function(A,e){const t=e.getContentType()||"",s=t.indexOf("application/json")>-1,i=Q.isObject(A);if(i&&Q.isHTMLForm(A)&&(A=new FormData(A)),Q.isFormData(A))return s?JSON.stringify(ml(A)):A;if(Q.isArrayBuffer(A)||Q.isBuffer(A)||Q.isStream(A)||Q.isFile(A)||Q.isBlob(A)||Q.isReadableStream(A))return A;if(Q.isArrayBufferView(A))return A.buffer;if(Q.isURLSearchParams(A))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),A.toString();let o;if(i){if(t.indexOf("application/x-www-form-urlencoded")>-1)return Y0(A,this.formSerializer).toString();if((o=Q.isFileList(A))||t.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return cs(o?{"files[]":A}:A,a&&new a,this.formSerializer)}}return i||s?(e.setContentType("application/json",!1),j0(A)):A}],transformResponse:[function(A){const e=this.transitional||cr.transitional,t=e&&e.forcedJSONParsing,s=this.responseType==="json";if(Q.isResponse(A)||Q.isReadableStream(A))return A;if(A&&Q.isString(A)&&(t&&!this.responseType||s)){const n=!(e&&e.silentJSONParsing)&&s;try{return JSON.parse(A,this.parseReviver)}catch(o){if(n)throw o.name==="SyntaxError"?oA.from(o,oA.ERR_BAD_RESPONSE,this,null,this.response):o}}return A}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jA.classes.FormData,Blob:jA.classes.Blob},validateStatus:function(A){return A>=200&&A<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Q.forEach(["delete","get","head","post","put","patch"],r=>{cr.headers[r]={}});const AB=Q.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),eB=r=>{const A={};let e,t,s;return r&&r.split(`
2
+ `).forEach(function(n){s=n.indexOf(":"),e=n.substring(0,s).trim().toLowerCase(),t=n.substring(s+1).trim(),!(!e||A[e]&&AB[e])&&(e==="set-cookie"?A[e]?A[e].push(t):A[e]=[t]:A[e]=A[e]?A[e]+", "+t:t)}),A},Cl=Symbol("internals");function hr(r){return r&&String(r).trim().toLowerCase()}function hs(r){return r===!1||r==null?r:Q.isArray(r)?r.map(hs):String(r)}function tB(r){const A=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let t;for(;t=e.exec(r);)A[t[1]]=t[2];return A}const rB=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Bn(r,A,e,t,s){if(Q.isFunction(t))return t.call(this,A,e);if(s&&(A=e),!!Q.isString(A)){if(Q.isString(t))return A.indexOf(t)!==-1;if(Q.isRegExp(t))return t.test(A)}}function sB(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(A,e,t)=>e.toUpperCase()+t)}function iB(r,A){const e=Q.toCamelCase(" "+A);["get","set","has"].forEach(t=>{Object.defineProperty(r,t+e,{value:function(s,i,n){return this[t].call(this,A,s,i,n)},configurable:!0})})}let ue=class{constructor(A){A&&this.set(A)}set(A,e,t){const s=this;function i(o,a,l){const c=hr(a);if(!c)throw new Error("header name must be a non-empty string");const u=Q.findKey(s,c);(!u||s[u]===void 0||l===!0||l===void 0&&s[u]!==!1)&&(s[u||a]=hs(o))}const n=(o,a)=>Q.forEach(o,(l,c)=>i(l,c,a));if(Q.isPlainObject(A)||A instanceof this.constructor)n(A,e);else if(Q.isString(A)&&(A=A.trim())&&!rB(A))n(eB(A),e);else if(Q.isObject(A)&&Q.isIterable(A)){let o={},a,l;for(const c of A){if(!Q.isArray(c))throw TypeError("Object iterator must return a key-value pair");o[l=c[0]]=(a=o[l])?Q.isArray(a)?[...a,c[1]]:[a,c[1]]:c[1]}n(o,e)}else A!=null&&i(e,A,t);return this}get(A,e){if(A=hr(A),A){const t=Q.findKey(this,A);if(t){const s=this[t];if(!e)return s;if(e===!0)return tB(s);if(Q.isFunction(e))return e.call(this,s,t);if(Q.isRegExp(e))return e.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(A,e){if(A=hr(A),A){const t=Q.findKey(this,A);return!!(t&&this[t]!==void 0&&(!e||Bn(this,this[t],t,e)))}return!1}delete(A,e){const t=this;let s=!1;function i(n){if(n=hr(n),n){const o=Q.findKey(t,n);o&&(!e||Bn(t,t[o],o,e))&&(delete t[o],s=!0)}}return Q.isArray(A)?A.forEach(i):i(A),s}clear(A){const e=Object.keys(this);let t=e.length,s=!1;for(;t--;){const i=e[t];(!A||Bn(this,this[i],i,A,!0))&&(delete this[i],s=!0)}return s}normalize(A){const e=this,t={};return Q.forEach(this,(s,i)=>{const n=Q.findKey(t,i);if(n){e[n]=hs(s),delete e[i];return}const o=A?sB(i):String(i).trim();o!==i&&delete e[i],e[o]=hs(s),t[o]=!0}),this}concat(...A){return this.constructor.concat(this,...A)}toJSON(A){const e=Object.create(null);return Q.forEach(this,(t,s)=>{t!=null&&t!==!1&&(e[s]=A&&Q.isArray(t)?t.join(", "):t)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([A,e])=>A+": "+e).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(A){return A instanceof this?A:new this(A)}static concat(A,...e){const t=new this(A);return e.forEach(s=>t.set(s)),t}static accessor(A){const t=(this[Cl]=this[Cl]={accessors:{}}).accessors,s=this.prototype;function i(n){const o=hr(n);t[o]||(iB(s,n),t[o]=!0)}return Q.isArray(A)?A.forEach(i):i(A),this}};ue.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Q.reduceDescriptors(ue.prototype,({value:r},A)=>{let e=A[0].toUpperCase()+A.slice(1);return{get:()=>r,set(t){this[e]=t}}}),Q.freezeMethods(ue);function gn(r,A){const e=this||cr,t=A||e,s=ue.from(t.headers);let i=t.data;return Q.forEach(r,function(o){i=o.call(e,i,s.normalize(),A?A.status:void 0)}),s.normalize(),i}function vl(r){return!!(r&&r.__CANCEL__)}let ur=class extends oA{constructor(A,e,t){super(A??"canceled",oA.ERR_CANCELED,e,t),this.name="CanceledError",this.__CANCEL__=!0}};function bl(r,A,e){const t=e.config.validateStatus;!e.status||!t||t(e.status)?r(e):A(new oA("Request failed with status code "+e.status,[oA.ERR_BAD_REQUEST,oA.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}function nB(r){const A=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return A&&A[1]||""}function oB(r,A){r=r||10;const e=new Array(r),t=new Array(r);let s=0,i=0,n;return A=A!==void 0?A:1e3,function(a){const l=Date.now(),c=t[i];n||(n=l),e[s]=a,t[s]=l;let u=i,d=0;for(;u!==s;)d+=e[u++],u=u%r;if(s=(s+1)%r,s===i&&(i=(i+1)%r),l-n<A)return;const g=c&&l-c;return g?Math.round(d*1e3/g):void 0}}function aB(r,A){let e=0,t=1e3/A,s,i;const n=(l,c=Date.now())=>{e=c,s=null,i&&(clearTimeout(i),i=null),r(...l)};return[(...l)=>{const c=Date.now(),u=c-e;u>=t?n(l,c):(s=l,i||(i=setTimeout(()=>{i=null,n(s)},t-u)))},()=>s&&n(s)]}const us=(r,A,e=3)=>{let t=0;const s=oB(50,250);return aB(i=>{const n=i.loaded,o=i.lengthComputable?i.total:void 0,a=n-t,l=s(a),c=n<=o;t=n;const u={loaded:n,total:o,progress:o?n/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&c?(o-n)/l:void 0,event:i,lengthComputable:o!=null,[A?"download":"upload"]:!0};r(u)},e)},Ql=(r,A)=>{const e=r!=null;return[t=>A[0]({lengthComputable:e,total:r,loaded:t}),A[1]]},Fl=r=>(...A)=>Q.asap(()=>r(...A)),lB=jA.hasStandardBrowserEnv?((r,A)=>e=>(e=new URL(e,jA.origin),r.protocol===e.protocol&&r.host===e.host&&(A||r.port===e.port)))(new URL(jA.origin),jA.navigator&&/(msie|trident)/i.test(jA.navigator.userAgent)):()=>!0,cB=jA.hasStandardBrowserEnv?{write(r,A,e,t,s,i,n){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(A)}`];Q.isNumber(e)&&o.push(`expires=${new Date(e).toUTCString()}`),Q.isString(t)&&o.push(`path=${t}`),Q.isString(s)&&o.push(`domain=${s}`),i===!0&&o.push("secure"),Q.isString(n)&&o.push(`SameSite=${n}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const A=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return A?decodeURIComponent(A[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function hB(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function uB(r,A){return A?r.replace(/\/?\/$/,"")+"/"+A.replace(/^\/+/,""):r}function yl(r,A,e){let t=!hB(A);return r&&(t||e==!1)?uB(r,A):A}const Ul=r=>r instanceof ue?{...r}:r;function mt(r,A){A=A||{};const e={};function t(l,c,u,d){return Q.isPlainObject(l)&&Q.isPlainObject(c)?Q.merge.call({caseless:d},l,c):Q.isPlainObject(c)?Q.merge({},c):Q.isArray(c)?c.slice():c}function s(l,c,u,d){if(Q.isUndefined(c)){if(!Q.isUndefined(l))return t(void 0,l,u,d)}else return t(l,c,u,d)}function i(l,c){if(!Q.isUndefined(c))return t(void 0,c)}function n(l,c){if(Q.isUndefined(c)){if(!Q.isUndefined(l))return t(void 0,l)}else return t(void 0,c)}function o(l,c,u){if(u in A)return t(l,c);if(u in r)return t(void 0,l)}const a={url:i,method:i,data:i,baseURL:n,transformRequest:n,transformResponse:n,paramsSerializer:n,timeout:n,timeoutMessage:n,withCredentials:n,withXSRFToken:n,adapter:n,responseType:n,xsrfCookieName:n,xsrfHeaderName:n,onUploadProgress:n,onDownloadProgress:n,decompress:n,maxContentLength:n,maxBodyLength:n,beforeRedirect:n,transport:n,httpAgent:n,httpsAgent:n,cancelToken:n,socketPath:n,responseEncoding:n,validateStatus:o,headers:(l,c,u)=>s(Ul(l),Ul(c),u,!0)};return Q.forEach(Object.keys({...r,...A}),function(c){const u=a[c]||s,d=u(r[c],A[c],c);Q.isUndefined(d)&&u!==o||(e[c]=d)}),e}const El=r=>{const A=mt({},r);let{data:e,withXSRFToken:t,xsrfHeaderName:s,xsrfCookieName:i,headers:n,auth:o}=A;if(A.headers=n=ue.from(n),A.url=gl(yl(A.baseURL,A.url,A.allowAbsoluteUrls),r.params,r.paramsSerializer),o&&n.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),Q.isFormData(e)){if(jA.hasStandardBrowserEnv||jA.hasStandardBrowserWebWorkerEnv)n.setContentType(void 0);else if(Q.isFunction(e.getHeaders)){const a=e.getHeaders(),l=["content-type","content-length"];Object.entries(a).forEach(([c,u])=>{l.includes(c.toLowerCase())&&n.set(c,u)})}}if(jA.hasStandardBrowserEnv&&(t&&Q.isFunction(t)&&(t=t(A)),t||t!==!1&&lB(A.url))){const a=s&&i&&cB.read(i);a&&n.set(s,a)}return A},fB=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(e,t){const s=El(r);let i=s.data;const n=ue.from(s.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:l}=s,c,u,d,g,B;function f(){g&&g(),B&&B(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let w=new XMLHttpRequest;w.open(s.method.toUpperCase(),s.url,!0),w.timeout=s.timeout;function m(){if(!w)return;const v=ue.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),E={data:!o||o==="text"||o==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:v,config:r,request:w};bl(function(I){e(I),f()},function(I){t(I),f()},E),w=null}"onloadend"in w?w.onloadend=m:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(m)},w.onabort=function(){w&&(t(new oA("Request aborted",oA.ECONNABORTED,r,w)),w=null)},w.onerror=function(y){const E=y&&y.message?y.message:"Network Error",U=new oA(E,oA.ERR_NETWORK,r,w);U.event=y||null,t(U),w=null},w.ontimeout=function(){let y=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||wl;s.timeoutErrorMessage&&(y=s.timeoutErrorMessage),t(new oA(y,E.clarifyTimeoutError?oA.ETIMEDOUT:oA.ECONNABORTED,r,w)),w=null},i===void 0&&n.setContentType(null),"setRequestHeader"in w&&Q.forEach(n.toJSON(),function(y,E){w.setRequestHeader(E,y)}),Q.isUndefined(s.withCredentials)||(w.withCredentials=!!s.withCredentials),o&&o!=="json"&&(w.responseType=s.responseType),l&&([d,B]=us(l,!0),w.addEventListener("progress",d)),a&&w.upload&&([u,g]=us(a),w.upload.addEventListener("progress",u),w.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(c=v=>{w&&(t(!v||v.type?new ur(null,r,w):v),w.abort(),w=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const p=nB(s.url);if(p&&jA.protocols.indexOf(p)===-1){t(new oA("Unsupported protocol "+p+":",oA.ERR_BAD_REQUEST,r));return}w.send(i||null)})},dB=(r,A)=>{const{length:e}=r=r?r.filter(Boolean):[];if(A||e){let t=new AbortController,s;const i=function(l){if(!s){s=!0,o();const c=l instanceof Error?l:this.reason;t.abort(c instanceof oA?c:new ur(c instanceof Error?c.message:c))}};let n=A&&setTimeout(()=>{n=null,i(new oA(`timeout of ${A}ms exceeded`,oA.ETIMEDOUT))},A);const o=()=>{r&&(n&&clearTimeout(n),n=null,r.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),r=null)};r.forEach(l=>l.addEventListener("abort",i));const{signal:a}=t;return a.unsubscribe=()=>Q.asap(o),a}},BB=function*(r,A){let e=r.byteLength;if(e<A){yield r;return}let t=0,s;for(;t<e;)s=t+A,yield r.slice(t,s),t=s},gB=async function*(r,A){for await(const e of pB(r))yield*BB(e,A)},pB=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const A=r.getReader();try{for(;;){const{done:e,value:t}=await A.read();if(e)break;yield t}}finally{await A.cancel()}},xl=(r,A,e,t)=>{const s=gB(r,A);let i=0,n,o=a=>{n||(n=!0,t&&t(a))};return new ReadableStream({async pull(a){try{const{done:l,value:c}=await s.next();if(l){o(),a.close();return}let u=c.byteLength;if(e){let d=i+=u;e(d)}a.enqueue(new Uint8Array(c))}catch(l){throw o(l),l}},cancel(a){return o(a),s.return()}},{highWaterMark:2})},Sl=64*1024,{isFunction:fs}=Q,wB=(({Request:r,Response:A})=>({Request:r,Response:A}))(Q.global),{ReadableStream:Hl,TextEncoder:Ll}=Q.global,Il=(r,...A)=>{try{return!!r(...A)}catch{return!1}},mB=r=>{r=Q.merge.call({skipUndefined:!0},wB,r);const{fetch:A,Request:e,Response:t}=r,s=A?fs(A):typeof fetch=="function",i=fs(e),n=fs(t);if(!s)return!1;const o=s&&fs(Hl),a=s&&(typeof Ll=="function"?(B=>f=>B.encode(f))(new Ll):async B=>new Uint8Array(await new e(B).arrayBuffer())),l=i&&o&&Il(()=>{let B=!1;const f=new e(jA.origin,{body:new Hl,method:"POST",get duplex(){return B=!0,"half"}}).headers.has("Content-Type");return B&&!f}),c=n&&o&&Il(()=>Q.isReadableStream(new t("").body)),u={stream:c&&(B=>B.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(B=>{!u[B]&&(u[B]=(f,w)=>{let m=f&&f[B];if(m)return m.call(f);throw new oA(`Response type '${B}' is not supported`,oA.ERR_NOT_SUPPORT,w)})});const d=async B=>{if(B==null)return 0;if(Q.isBlob(B))return B.size;if(Q.isSpecCompliantForm(B))return(await new e(jA.origin,{method:"POST",body:B}).arrayBuffer()).byteLength;if(Q.isArrayBufferView(B)||Q.isArrayBuffer(B))return B.byteLength;if(Q.isURLSearchParams(B)&&(B=B+""),Q.isString(B))return(await a(B)).byteLength},g=async(B,f)=>{const w=Q.toFiniteNumber(B.getContentLength());return w??d(f)};return async B=>{let{url:f,method:w,data:m,signal:p,cancelToken:v,timeout:y,onDownloadProgress:E,onUploadProgress:U,responseType:I,headers:O,withCredentials:T="same-origin",fetchOptions:lA}=El(B),M=A||fetch;I=I?(I+"").toLowerCase():"text";let Z=dB([p,v&&v.toAbortSignal()],y),S=null;const V=Z&&Z.unsubscribe&&(()=>{Z.unsubscribe()});let X;try{if(U&&l&&w!=="get"&&w!=="head"&&(X=await g(O,m))!==0){let bA=new e(f,{method:"POST",body:m,duplex:"half"}),q;if(Q.isFormData(m)&&(q=bA.headers.get("content-type"))&&O.setContentType(q),bA.body){const[$,QA]=Ql(X,us(Fl(U)));m=xl(bA.body,Sl,$,QA)}}Q.isString(T)||(T=T?"include":"omit");const cA=i&&"credentials"in e.prototype,hA={...lA,signal:Z,method:w.toUpperCase(),headers:O.normalize().toJSON(),body:m,duplex:"half",credentials:cA?T:void 0};S=i&&new e(f,hA);let EA=await(i?M(S,lA):M(f,hA));const vA=c&&(I==="stream"||I==="response");if(c&&(E||vA&&V)){const bA={};["status","statusText","headers"].forEach(BA=>{bA[BA]=EA[BA]});const q=Q.toFiniteNumber(EA.headers.get("content-length")),[$,QA]=E&&Ql(q,us(Fl(E),!0))||[];EA=new t(xl(EA.body,Sl,$,()=>{QA&&QA(),V&&V()}),bA)}I=I||"text";let UA=await u[Q.findKey(u,I)||"text"](EA,B);return!vA&&V&&V(),await new Promise((bA,q)=>{bl(bA,q,{data:UA,headers:ue.from(EA.headers),status:EA.status,statusText:EA.statusText,config:B,request:S})})}catch(cA){throw V&&V(),cA&&cA.name==="TypeError"&&/Load failed|fetch/i.test(cA.message)?Object.assign(new oA("Network Error",oA.ERR_NETWORK,B,S),{cause:cA.cause||cA}):oA.from(cA,cA&&cA.code,B,S)}}},CB=new Map,Tl=r=>{let A=r&&r.env||{};const{fetch:e,Request:t,Response:s}=A,i=[t,s,e];let n=i.length,o=n,a,l,c=CB;for(;o--;)a=i[o],l=c.get(a),l===void 0&&c.set(a,l=o?new Map:mB(A)),c=l;return l};Tl();const pn={http:P0,xhr:fB,fetch:{get:Tl}};Q.forEach(pn,(r,A)=>{if(r){try{Object.defineProperty(r,"name",{value:A})}catch{}Object.defineProperty(r,"adapterName",{value:A})}});const Ml=r=>`- ${r}`,vB=r=>Q.isFunction(r)||r===null||r===!1;function bB(r,A){r=Q.isArray(r)?r:[r];const{length:e}=r;let t,s;const i={};for(let n=0;n<e;n++){t=r[n];let o;if(s=t,!vB(t)&&(s=pn[(o=String(t)).toLowerCase()],s===void 0))throw new oA(`Unknown adapter '${o}'`);if(s&&(Q.isFunction(s)||(s=s.get(A))))break;i[o||"#"+n]=s}if(!s){const n=Object.entries(i).map(([a,l])=>`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?n.length>1?`since :
4
+ `+n.map(Ml).join(`
5
+ `):" "+Ml(n[0]):"as no adapter specified";throw new oA("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s}const Dl={getAdapter:bB,adapters:pn};function wn(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new ur(null,r)}function Ol(r){return wn(r),r.headers=ue.from(r.headers),r.data=gn.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Dl.getAdapter(r.adapter||cr.adapter,r)(r).then(function(t){return wn(r),t.data=gn.call(r,r.transformResponse,t),t.headers=ue.from(t.headers),t},function(t){return vl(t)||(wn(r),t&&t.response&&(t.response.data=gn.call(r,r.transformResponse,t.response),t.response.headers=ue.from(t.response.headers))),Promise.reject(t)})}const kl="1.13.4",ds={};["object","boolean","number","function","string","symbol"].forEach((r,A)=>{ds[r]=function(t){return typeof t===r||"a"+(A<1?"n ":" ")+r}});const _l={};ds.transitional=function(A,e,t){function s(i,n){return"[Axios v"+kl+"] Transitional option '"+i+"'"+n+(t?". "+t:"")}return(i,n,o)=>{if(A===!1)throw new oA(s(n," has been removed"+(e?" in "+e:"")),oA.ERR_DEPRECATED);return e&&!_l[n]&&(_l[n]=!0,console.warn(s(n," has been deprecated since v"+e+" and will be removed in the near future"))),A?A(i,n,o):!0}},ds.spelling=function(A){return(e,t)=>(console.warn(`${t} is likely a misspelling of ${A}`),!0)};function QB(r,A,e){if(typeof r!="object")throw new oA("options must be an object",oA.ERR_BAD_OPTION_VALUE);const t=Object.keys(r);let s=t.length;for(;s-- >0;){const i=t[s],n=A[i];if(n){const o=r[i],a=o===void 0||n(o,i,r);if(a!==!0)throw new oA("option "+i+" must be "+a,oA.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new oA("Unknown option "+i,oA.ERR_BAD_OPTION)}}const Bs={assertOptions:QB,validators:ds},Te=Bs.validators;let Ct=class{constructor(A){this.defaults=A||{},this.interceptors={request:new pl,response:new pl}}async request(A,e){try{return await this._request(A,e)}catch(t){if(t instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{t.stack?i&&!String(t.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(t.stack+=`
6
+ `+i):t.stack=i}catch{}}throw t}}_request(A,e){typeof A=="string"?(e=e||{},e.url=A):e=A||{},e=mt(this.defaults,e);const{transitional:t,paramsSerializer:s,headers:i}=e;t!==void 0&&Bs.assertOptions(t,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean)},!1),s!=null&&(Q.isFunction(s)?e.paramsSerializer={serialize:s}:Bs.assertOptions(s,{encode:Te.function,serialize:Te.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Bs.assertOptions(e,{baseUrl:Te.spelling("baseURL"),withXsrfToken:Te.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let n=i&&Q.merge(i.common,i[e.method]);i&&Q.forEach(["delete","get","head","post","put","patch","common"],B=>{delete i[B]}),e.headers=ue.concat(n,i);const o=[];let a=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(a=a&&f.synchronous,o.unshift(f.fulfilled,f.rejected))});const l=[];this.interceptors.response.forEach(function(f){l.push(f.fulfilled,f.rejected)});let c,u=0,d;if(!a){const B=[Ol.bind(this),void 0];for(B.unshift(...o),B.push(...l),d=B.length,c=Promise.resolve(e);u<d;)c=c.then(B[u++],B[u++]);return c}d=o.length;let g=e;for(;u<d;){const B=o[u++],f=o[u++];try{g=B(g)}catch(w){f.call(this,w);break}}try{c=Ol.call(this,g)}catch(B){return Promise.reject(B)}for(u=0,d=l.length;u<d;)c=c.then(l[u++],l[u++]);return c}getUri(A){A=mt(this.defaults,A);const e=yl(A.baseURL,A.url,A.allowAbsoluteUrls);return gl(e,A.params,A.paramsSerializer)}};Q.forEach(["delete","get","head","options"],function(A){Ct.prototype[A]=function(e,t){return this.request(mt(t||{},{method:A,url:e,data:(t||{}).data}))}}),Q.forEach(["post","put","patch"],function(A){function e(t){return function(i,n,o){return this.request(mt(o||{},{method:A,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}Ct.prototype[A]=e(),Ct.prototype[A+"Form"]=e(!0)});let FB=class Su{constructor(A){if(typeof A!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(i){e=i});const t=this;this.promise.then(s=>{if(!t._listeners)return;let i=t._listeners.length;for(;i-- >0;)t._listeners[i](s);t._listeners=null}),this.promise.then=s=>{let i;const n=new Promise(o=>{t.subscribe(o),i=o}).then(s);return n.cancel=function(){t.unsubscribe(i)},n},A(function(i,n,o){t.reason||(t.reason=new ur(i,n,o),e(t.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(A){if(this.reason){A(this.reason);return}this._listeners?this._listeners.push(A):this._listeners=[A]}unsubscribe(A){if(!this._listeners)return;const e=this._listeners.indexOf(A);e!==-1&&this._listeners.splice(e,1)}toAbortSignal(){const A=new AbortController,e=t=>{A.abort(t)};return this.subscribe(e),A.signal.unsubscribe=()=>this.unsubscribe(e),A.signal}static source(){let A;return{token:new Su(function(s){A=s}),cancel:A}}};function yB(r){return function(e){return r.apply(null,e)}}function UB(r){return Q.isObject(r)&&r.isAxiosError===!0}const mn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(mn).forEach(([r,A])=>{mn[A]=r});function Nl(r){const A=new Ct(r),e=rl(Ct.prototype.request,A);return Q.extend(e,Ct.prototype,A,{allOwnKeys:!0}),Q.extend(e,A,null,{allOwnKeys:!0}),e.create=function(s){return Nl(mt(r,s))},e}const HA=Nl(cr);HA.Axios=Ct,HA.CanceledError=ur,HA.CancelToken=FB,HA.isCancel=vl,HA.VERSION=kl,HA.toFormData=cs,HA.AxiosError=oA,HA.Cancel=HA.CanceledError,HA.all=function(A){return Promise.all(A)},HA.spread=yB,HA.isAxiosError=UB,HA.mergeConfig=mt,HA.AxiosHeaders=ue,HA.formToJSON=r=>ml(Q.isHTMLForm(r)?new FormData(r):r),HA.getAdapter=Dl.getAdapter,HA.HttpStatusCode=mn,HA.default=HA;const{Axios:Nv,AxiosError:Kv,CanceledError:Vv,isCancel:Pv,CancelToken:Gv,VERSION:Rv,all:Wv,Cancel:zv,isAxiosError:Xv,spread:Jv,toFormData:Zv,AxiosHeaders:Yv,HttpStatusCode:qv,formToJSON:$v,getAdapter:jv,mergeConfig:Ab}=HA,Me=Object.create(null);Me.open="0",Me.close="1",Me.ping="2",Me.pong="3",Me.message="4",Me.upgrade="5",Me.noop="6";const gs=Object.create(null);Object.keys(Me).forEach(r=>{gs[Me[r]]=r});const Cn={type:"error",data:"parser error"},Kl=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Vl=typeof ArrayBuffer=="function",Pl=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,vn=({type:r,data:A},e,t)=>Kl&&A instanceof Blob?e?t(A):Gl(A,t):Vl&&(A instanceof ArrayBuffer||Pl(A))?e?t(A):Gl(new Blob([A]),t):t(Me[r]+(A||"")),Gl=(r,A)=>{const e=new FileReader;return e.onload=function(){const t=e.result.split(",")[1];A("b"+(t||""))},e.readAsDataURL(r)};function Rl(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let bn;function EB(r,A){if(Kl&&r.data instanceof Blob)return r.data.arrayBuffer().then(Rl).then(A);if(Vl&&(r.data instanceof ArrayBuffer||Pl(r.data)))return A(Rl(r.data));vn(r,!1,e=>{bn||(bn=new TextEncoder),A(bn.encode(e))})}const Wl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Wl.length;r++)fr[Wl.charCodeAt(r)]=r;const xB=r=>{let A=r.length*.75,e=r.length,t,s=0,i,n,o,a;r[r.length-1]==="="&&(A--,r[r.length-2]==="="&&A--);const l=new ArrayBuffer(A),c=new Uint8Array(l);for(t=0;t<e;t+=4)i=fr[r.charCodeAt(t)],n=fr[r.charCodeAt(t+1)],o=fr[r.charCodeAt(t+2)],a=fr[r.charCodeAt(t+3)],c[s++]=i<<2|n>>4,c[s++]=(n&15)<<4|o>>2,c[s++]=(o&3)<<6|a&63;return l},SB=typeof ArrayBuffer=="function",Qn=(r,A)=>{if(typeof r!="string")return{type:"message",data:zl(r,A)};const e=r.charAt(0);return e==="b"?{type:"message",data:HB(r.substring(1),A)}:gs[e]?r.length>1?{type:gs[e],data:r.substring(1)}:{type:gs[e]}:Cn},HB=(r,A)=>{if(SB){const e=xB(r);return zl(e,A)}else return{base64:!0,data:r}},zl=(r,A)=>A==="blob"?r instanceof Blob?r:new Blob([r]):r instanceof ArrayBuffer?r:r.buffer,Xl="",LB=(r,A)=>{const e=r.length,t=new Array(e);let s=0;r.forEach((i,n)=>{vn(i,!1,o=>{t[n]=o,++s===e&&A(t.join(Xl))})})},IB=(r,A)=>{const e=r.split(Xl),t=[];for(let s=0;s<e.length;s++){const i=Qn(e[s],A);if(t.push(i),i.type==="error")break}return t};function TB(){return new TransformStream({transform(r,A){EB(r,e=>{const t=e.length;let s;if(t<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,t);else if(t<65536){s=new Uint8Array(3);const i=new DataView(s.buffer);i.setUint8(0,126),i.setUint16(1,t)}else{s=new Uint8Array(9);const i=new DataView(s.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(t))}r.data&&typeof r.data!="string"&&(s[0]|=128),A.enqueue(s),A.enqueue(e)})}})}let Fn;function ps(r){return r.reduce((A,e)=>A+e.length,0)}function ws(r,A){if(r[0].length===A)return r.shift();const e=new Uint8Array(A);let t=0;for(let s=0;s<A;s++)e[s]=r[0][t++],t===r[0].length&&(r.shift(),t=0);return r.length&&t<r[0].length&&(r[0]=r[0].slice(t)),e}function MB(r,A){Fn||(Fn=new TextDecoder);const e=[];let t=0,s=-1,i=!1;return new TransformStream({transform(n,o){for(e.push(n);;){if(t===0){if(ps(e)<1)break;const a=ws(e,1);i=(a[0]&128)===128,s=a[0]&127,s<126?t=3:s===126?t=1:t=2}else if(t===1){if(ps(e)<2)break;const a=ws(e,2);s=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),t=3}else if(t===2){if(ps(e)<8)break;const a=ws(e,8),l=new DataView(a.buffer,a.byteOffset,a.length),c=l.getUint32(0);if(c>Math.pow(2,21)-1){o.enqueue(Cn);break}s=c*Math.pow(2,32)+l.getUint32(4),t=3}else{if(ps(e)<s)break;const a=ws(e,s);o.enqueue(Qn(i?a:Fn.decode(a),A)),t=0}if(s===0||s>r){o.enqueue(Cn);break}}}})}const Jl=4;function GA(r){if(r)return DB(r)}function DB(r){for(var A in GA.prototype)r[A]=GA.prototype[A];return r}GA.prototype.on=GA.prototype.addEventListener=function(r,A){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(A),this},GA.prototype.once=function(r,A){function e(){this.off(r,e),A.apply(this,arguments)}return e.fn=A,this.on(r,e),this},GA.prototype.off=GA.prototype.removeListener=GA.prototype.removeAllListeners=GA.prototype.removeEventListener=function(r,A){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+r];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var t,s=0;s<e.length;s++)if(t=e[s],t===A||t.fn===A){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+r],this},GA.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var A=new Array(arguments.length-1),e=this._callbacks["$"+r],t=1;t<arguments.length;t++)A[t-1]=arguments[t];if(e){e=e.slice(0);for(var t=0,s=e.length;t<s;++t)e[t].apply(this,A)}return this},GA.prototype.emitReserved=GA.prototype.emit,GA.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]},GA.prototype.hasListeners=function(r){return!!this.listeners(r).length};const ms=typeof Promise=="function"&&typeof Promise.resolve=="function"?A=>Promise.resolve().then(A):(A,e)=>e(A,0),Ce=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),OB="arraybuffer";function eb(){}function Zl(r,...A){return A.reduce((e,t)=>(r.hasOwnProperty(t)&&(e[t]=r[t]),e),{})}const kB=Ce.setTimeout,_B=Ce.clearTimeout;function Cs(r,A){A.useNativeTimers?(r.setTimeoutFn=kB.bind(Ce),r.clearTimeoutFn=_B.bind(Ce)):(r.setTimeoutFn=Ce.setTimeout.bind(Ce),r.clearTimeoutFn=Ce.clearTimeout.bind(Ce))}const NB=1.33;function KB(r){return typeof r=="string"?VB(r):Math.ceil((r.byteLength||r.size)*NB)}function VB(r){let A=0,e=0;for(let t=0,s=r.length;t<s;t++)A=r.charCodeAt(t),A<128?e+=1:A<2048?e+=2:A<55296||A>=57344?e+=3:(t++,e+=4);return e}function Yl(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function PB(r){let A="";for(let e in r)r.hasOwnProperty(e)&&(A.length&&(A+="&"),A+=encodeURIComponent(e)+"="+encodeURIComponent(r[e]));return A}function GB(r){let A={},e=r.split("&");for(let t=0,s=e.length;t<s;t++){let i=e[t].split("=");A[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return A}class RB extends Error{constructor(A,e,t){super(A),this.description=e,this.context=t,this.type="TransportError"}}class yn extends GA{constructor(A){super(),this.writable=!1,Cs(this,A),this.opts=A,this.query=A.query,this.socket=A.socket,this.supportsBinary=!A.forceBase64}onError(A,e,t){return super.emitReserved("error",new RB(A,e,t)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(A){this.readyState==="open"&&this.write(A)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(A){const e=Qn(A,this.socket.binaryType);this.onPacket(e)}onPacket(A){super.emitReserved("packet",A)}onClose(A){this.readyState="closed",super.emitReserved("close",A)}pause(A){}createUri(A,e={}){return A+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const A=this.opts.hostname;return A.indexOf(":")===-1?A:"["+A+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(A){const e=PB(A);return e.length?"?"+e:""}}class WB extends yn{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(A){this.readyState="pausing";const e=()=>{this.readyState="paused",A()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||e()})),this.writable||(t++,this.once("drain",function(){--t||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(A){const e=t=>{if(this.readyState==="opening"&&t.type==="open"&&this.onOpen(),t.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)};IB(A,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const A=()=>{this.write([{type:"close"}])};this.readyState==="open"?A():this.once("open",A)}write(A){this.writable=!1,LB(A,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const A=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Yl()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(A,e)}}let ql=!1;try{ql=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const zB=ql;function XB(){}class JB extends WB{constructor(A){if(super(A),typeof location<"u"){const e=location.protocol==="https:";let t=location.port;t||(t=e?"443":"80"),this.xd=typeof location<"u"&&A.hostname!==location.hostname||t!==A.port}}doWrite(A,e){const t=this.request({method:"POST",data:A});t.on("success",e),t.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const A=this.request();A.on("data",this.onData.bind(this)),A.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=A}}class De extends GA{constructor(A,e,t){super(),this.createRequest=A,Cs(this,t),this._opts=t,this._method=t.method||"GET",this._uri=e,this._data=t.data!==void 0?t.data:null,this._create()}_create(){var A;const e=Zl(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;const t=this._xhr=this.createRequest(e);try{t.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&t.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}(A=this._opts.cookieJar)===null||A===void 0||A.addCookies(t),"withCredentials"in t&&(t.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(t.timeout=this._opts.requestTimeout),t.onreadystatechange=()=>{var s;t.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(t.getResponseHeader("set-cookie"))),t.readyState===4&&(t.status===200||t.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof t.status=="number"?t.status:0)},0))},t.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=De.requestsCount++,De.requests[this._index]=this)}_onError(A){this.emitReserved("error",A,this._xhr),this._cleanup(!0)}_cleanup(A){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=XB,A)try{this._xhr.abort()}catch{}typeof document<"u"&&delete De.requests[this._index],this._xhr=null}}_onLoad(){const A=this._xhr.responseText;A!==null&&(this.emitReserved("data",A),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(De.requestsCount=0,De.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",$l);else if(typeof addEventListener=="function"){const r="onpagehide"in Ce?"pagehide":"unload";addEventListener(r,$l,!1)}}function $l(){for(let r in De.requests)De.requests.hasOwnProperty(r)&&De.requests[r].abort()}const ZB=(function(){const r=jl({xdomain:!1});return r&&r.responseType!==null})();class YB extends JB{constructor(A){super(A);const e=A&&A.forceBase64;this.supportsBinary=ZB&&!e}request(A={}){return Object.assign(A,{xd:this.xd},this.opts),new De(jl,this.uri(),A)}}function jl(r){const A=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!A||zB))return new XMLHttpRequest}catch{}if(!A)try{return new Ce[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ac=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class qB extends yn{get name(){return"websocket"}doOpen(){const A=this.uri(),e=this.opts.protocols,t=Ac?{}:Zl(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(t.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(A,e,t)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=A=>this.onClose({description:"websocket connection closed",context:A}),this.ws.onmessage=A=>this.onData(A.data),this.ws.onerror=A=>this.onError("websocket error",A)}write(A){this.writable=!1;for(let e=0;e<A.length;e++){const t=A[e],s=e===A.length-1;vn(t,this.supportsBinary,i=>{try{this.doWrite(t,i)}catch{}s&&ms(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const A=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Yl()),this.supportsBinary||(e.b64=1),this.createUri(A,e)}}const Un=Ce.WebSocket||Ce.MozWebSocket;class $B extends qB{createSocket(A,e,t){return Ac?new Un(A,e,t):e?new Un(A,e):new Un(A)}doWrite(A,e){this.ws.send(e)}}class jB extends yn{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(A){return this.emitReserved("error",A)}this._transport.closed.then(()=>{this.onClose()}).catch(A=>{this.onError("webtransport error",A)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(A=>{const e=MB(Number.MAX_SAFE_INTEGER,this.socket.binaryType),t=A.readable.pipeThrough(e).getReader(),s=TB();s.readable.pipeTo(A.writable),this._writer=s.writable.getWriter();const i=()=>{t.read().then(({done:o,value:a})=>{o||(this.onPacket(a),i())}).catch(o=>{})};i();const n={type:"open"};this.query.sid&&(n.data=`{"sid":"${this.query.sid}"}`),this._writer.write(n).then(()=>this.onOpen())})})}write(A){this.writable=!1;for(let e=0;e<A.length;e++){const t=A[e],s=e===A.length-1;this._writer.write(t).then(()=>{s&&ms(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var A;(A=this._transport)===null||A===void 0||A.close()}}const Ag={websocket:$B,webtransport:jB,polling:YB},eg=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function En(r){if(r.length>8e3)throw"URI too long";const A=r,e=r.indexOf("["),t=r.indexOf("]");e!=-1&&t!=-1&&(r=r.substring(0,e)+r.substring(e,t).replace(/:/g,";")+r.substring(t,r.length));let s=eg.exec(r||""),i={},n=14;for(;n--;)i[tg[n]]=s[n]||"";return e!=-1&&t!=-1&&(i.source=A,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=rg(i,i.path),i.queryKey=sg(i,i.query),i}function rg(r,A){const e=/\/{2,9}/g,t=A.replace(e,"/").split("/");return(A.slice(0,1)=="/"||A.length===0)&&t.splice(0,1),A.slice(-1)=="/"&&t.splice(t.length-1,1),t}function sg(r,A){const e={};return A.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,s,i){s&&(e[s]=i)}),e}const xn=typeof addEventListener=="function"&&typeof removeEventListener=="function",vs=[];xn&&addEventListener("offline",()=>{vs.forEach(r=>r())},!1);class tt extends GA{constructor(A,e){if(super(),this.binaryType=OB,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,A&&typeof A=="object"&&(e=A,A=null),A){const t=En(A);e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)}else e.host&&(e.hostname=En(e.host).host);Cs(this,e),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(t=>{const s=t.prototype.name;this.transports.push(s),this._transportsByName[s]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=GB(this.opts.query)),xn&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},vs.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(A){const e=Object.assign({},this.opts.query);e.EIO=Jl,e.transport=A,this.id&&(e.sid=this.id);const t=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[A]);return new this._transportsByName[A](t)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const A=this.opts.rememberUpgrade&&tt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const e=this.createTransport(A);e.open(),this.setTransport(e)}setTransport(A){this.transport&&this.transport.removeAllListeners(),this.transport=A,A.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",tt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(A){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",A),this.emitReserved("heartbeat"),A.type){case"open":this.onHandshake(JSON.parse(A.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const e=new Error("server error");e.code=A.data,this._onError(e);break;case"message":this.emitReserved("data",A.data),this.emitReserved("message",A.data);break}}onHandshake(A){this.emitReserved("handshake",A),this.id=A.sid,this.transport.query.sid=A.sid,this._pingInterval=A.pingInterval,this._pingTimeout=A.pingTimeout,this._maxPayload=A.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const A=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+A,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},A),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const A=this._getWritablePackets();this.transport.send(A),this._prevBufferLen=A.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const s=this.writeBuffer[t].data;if(s&&(e+=KB(s)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const A=Date.now()>this._pingTimeoutTime;return A&&(this._pingTimeoutTime=0,ms(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),A}write(A,e,t){return this._sendPacket("message",A,e,t),this}send(A,e,t){return this._sendPacket("message",A,e,t),this}_sendPacket(A,e,t,s){if(typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t=null),this.readyState==="closing"||this.readyState==="closed")return;t=t||{},t.compress=t.compress!==!1;const i={type:A,data:e,options:t};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const A=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),A()},t=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?t():A()}):this.upgrading?t():A()),this}_onError(A){if(tt.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",A),this._onClose("transport error",A)}_onClose(A,e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),xn&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const t=vs.indexOf(this._offlineEventListener);t!==-1&&vs.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",A,e),this.writeBuffer=[],this._prevBufferLen=0}}}tt.protocol=Jl;class ig extends tt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let A=0;A<this._upgrades.length;A++)this._probe(this._upgrades[A])}_probe(A){let e=this.createTransport(A),t=!1;tt.priorWebsocketSuccess=!1;const s=()=>{t||(e.send([{type:"ping",data:"probe"}]),e.once("packet",u=>{if(!t)if(u.type==="pong"&&u.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;tt.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{t||this.readyState!=="closed"&&(c(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{const d=new Error("probe error");d.transport=e.name,this.emitReserved("upgradeError",d)}}))};function i(){t||(t=!0,c(),e.close(),e=null)}const n=u=>{const d=new Error("probe error: "+u);d.transport=e.name,i(),this.emitReserved("upgradeError",d)};function o(){n("transport closed")}function a(){n("socket closed")}function l(u){e&&u.name!==e.name&&i()}const c=()=>{e.removeListener("open",s),e.removeListener("error",n),e.removeListener("close",o),this.off("close",a),this.off("upgrading",l)};e.once("open",s),e.once("error",n),e.once("close",o),this.once("close",a),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&A!=="webtransport"?this.setTimeoutFn(()=>{t||e.open()},200):e.open()}onHandshake(A){this._upgrades=this._filterUpgrades(A.upgrades),super.onHandshake(A)}_filterUpgrades(A){const e=[];for(let t=0;t<A.length;t++)~this.transports.indexOf(A[t])&&e.push(A[t]);return e}}let ng=class extends ig{constructor(A,e={}){const t=typeof A=="object"?A:e;(!t.transports||t.transports&&typeof t.transports[0]=="string")&&(t.transports=(t.transports||["polling","websocket","webtransport"]).map(s=>Ag[s]).filter(s=>!!s)),super(A,t)}};function og(r,A="",e){let t=r;e=e||typeof location<"u"&&location,r==null&&(r=e.protocol+"//"+e.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=e.protocol+r:r=e.host+r),/^(https?|wss?):\/\//.test(r)||(typeof e<"u"?r=e.protocol+"//"+r:r="https://"+r),t=En(r)),t.port||(/^(http|ws)$/.test(t.protocol)?t.port="80":/^(http|ws)s$/.test(t.protocol)&&(t.port="443")),t.path=t.path||"/";const i=t.host.indexOf(":")!==-1?"["+t.host+"]":t.host;return t.id=t.protocol+"://"+i+":"+t.port+A,t.href=t.protocol+"://"+i+(e&&e.port===t.port?"":":"+t.port),t}const ag=typeof ArrayBuffer=="function",lg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,ec=Object.prototype.toString,cg=typeof Blob=="function"||typeof Blob<"u"&&ec.call(Blob)==="[object BlobConstructor]",hg=typeof File=="function"||typeof File<"u"&&ec.call(File)==="[object FileConstructor]";function Sn(r){return ag&&(r instanceof ArrayBuffer||lg(r))||cg&&r instanceof Blob||hg&&r instanceof File}function bs(r,A){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let e=0,t=r.length;e<t;e++)if(bs(r[e]))return!0;return!1}if(Sn(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return bs(r.toJSON(),!0);for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&bs(r[e]))return!0;return!1}function ug(r){const A=[],e=r.data,t=r;return t.data=Hn(e,A),t.attachments=A.length,{packet:t,buffers:A}}function Hn(r,A){if(!r)return r;if(Sn(r)){const e={_placeholder:!0,num:A.length};return A.push(r),e}else if(Array.isArray(r)){const e=new Array(r.length);for(let t=0;t<r.length;t++)e[t]=Hn(r[t],A);return e}else if(typeof r=="object"&&!(r instanceof Date)){const e={};for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=Hn(r[t],A));return e}return r}function fg(r,A){return r.data=Ln(r.data,A),delete r.attachments,r}function Ln(r,A){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<A.length)return A[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=Ln(r[e],A);else if(typeof r=="object")for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=Ln(r[e],A));return r}const dg=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var CA;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(CA||(CA={}));class Bg{constructor(A){this.replacer=A}encode(A){return(A.type===CA.EVENT||A.type===CA.ACK)&&bs(A)?this.encodeAsBinary({type:A.type===CA.EVENT?CA.BINARY_EVENT:CA.BINARY_ACK,nsp:A.nsp,data:A.data,id:A.id}):[this.encodeAsString(A)]}encodeAsString(A){let e=""+A.type;return(A.type===CA.BINARY_EVENT||A.type===CA.BINARY_ACK)&&(e+=A.attachments+"-"),A.nsp&&A.nsp!=="/"&&(e+=A.nsp+","),A.id!=null&&(e+=A.id),A.data!=null&&(e+=JSON.stringify(A.data,this.replacer)),e}encodeAsBinary(A){const e=ug(A),t=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(t),s}}class In extends GA{constructor(A){super(),this.reviver=A}add(A){let e;if(typeof A=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(A);const t=e.type===CA.BINARY_EVENT;t||e.type===CA.BINARY_ACK?(e.type=t?CA.EVENT:CA.ACK,this.reconstructor=new gg(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(Sn(A)||A.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(A),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+A)}decodeString(A){let e=0;const t={type:Number(A.charAt(0))};if(CA[t.type]===void 0)throw new Error("unknown packet type "+t.type);if(t.type===CA.BINARY_EVENT||t.type===CA.BINARY_ACK){const i=e+1;for(;A.charAt(++e)!=="-"&&e!=A.length;);const n=A.substring(i,e);if(n!=Number(n)||A.charAt(e)!=="-")throw new Error("Illegal attachments");t.attachments=Number(n)}if(A.charAt(e+1)==="/"){const i=e+1;for(;++e&&!(A.charAt(e)===","||e===A.length););t.nsp=A.substring(i,e)}else t.nsp="/";const s=A.charAt(e+1);if(s!==""&&Number(s)==s){const i=e+1;for(;++e;){const n=A.charAt(e);if(n==null||Number(n)!=n){--e;break}if(e===A.length)break}t.id=Number(A.substring(i,e+1))}if(A.charAt(++e)){const i=this.tryParse(A.substr(e));if(In.isPayloadValid(t.type,i))t.data=i;else throw new Error("invalid payload")}return t}tryParse(A){try{return JSON.parse(A,this.reviver)}catch{return!1}}static isPayloadValid(A,e){switch(A){case CA.CONNECT:return tc(e);case CA.DISCONNECT:return e===void 0;case CA.CONNECT_ERROR:return typeof e=="string"||tc(e);case CA.EVENT:case CA.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&dg.indexOf(e[0])===-1);case CA.ACK:case CA.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class gg{constructor(A){this.packet=A,this.buffers=[],this.reconPack=A}takeBinaryData(A){if(this.buffers.push(A),this.buffers.length===this.reconPack.attachments){const e=fg(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function tc(r){return Object.prototype.toString.call(r)==="[object Object]"}const pg=Object.freeze(Object.defineProperty({__proto__:null,Decoder:In,Encoder:Bg,get PacketType(){return CA}},Symbol.toStringTag,{value:"Module"}));function xe(r,A,e){return r.on(A,e),function(){r.off(A,e)}}const wg=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class rc extends GA{constructor(A,e,t){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=A,this.nsp=e,t&&t.auth&&(this.auth=t.auth),this._opts=Object.assign({},t),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const A=this.io;this.subs=[xe(A,"open",this.onopen.bind(this)),xe(A,"packet",this.onpacket.bind(this)),xe(A,"error",this.onerror.bind(this)),xe(A,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...A){return A.unshift("message"),this.emit.apply(this,A),this}emit(A,...e){var t,s,i;if(wg.hasOwnProperty(A))throw new Error('"'+A.toString()+'" is a reserved event name');if(e.unshift(A),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const n={type:CA.EVENT,data:e};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){const c=this.ids++,u=e.pop();this._registerAckCallback(c,u),n.id=c}const o=(s=(t=this.io.engine)===null||t===void 0?void 0:t.transport)===null||s===void 0?void 0:s.writable,a=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(A,e){var t;const s=(t=this.flags.timeout)!==null&&t!==void 0?t:this._opts.ackTimeout;if(s===void 0){this.acks[A]=e;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[A];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===A&&this.sendBuffer.splice(o,1);e.call(this,new Error("operation has timed out"))},s),n=(...o)=>{this.io.clearTimeoutFn(i),e.apply(this,o)};n.withError=!0,this.acks[A]=n}emitWithAck(A,...e){return new Promise((t,s)=>{const i=(n,o)=>n?s(n):t(o);i.withError=!0,e.push(i),this.emit(A,...e)})}_addToQueue(A){let e;typeof A[A.length-1]=="function"&&(e=A.pop());const t={id:this._queueSeq++,tryCount:0,pending:!1,args:A,flags:Object.assign({fromQueue:!0},this.flags)};A.push((s,...i)=>(this._queue[0],s!==null?t.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...i)),t.pending=!1,this._drainQueue())),this._queue.push(t),this._drainQueue()}_drainQueue(A=!1){if(!this.connected||this._queue.length===0)return;const e=this._queue[0];e.pending&&!A||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(A){A.nsp=this.nsp,this.io._packet(A)}onopen(){typeof this.auth=="function"?this.auth(A=>{this._sendConnectPacket(A)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(A){this.packet({type:CA.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},A):A})}onerror(A){this.connected||this.emitReserved("connect_error",A)}onclose(A,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",A,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(A=>{if(!this.sendBuffer.some(t=>String(t.id)===A)){const t=this.acks[A];delete this.acks[A],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(A){if(A.nsp===this.nsp)switch(A.type){case CA.CONNECT:A.data&&A.data.sid?this.onconnect(A.data.sid,A.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case CA.EVENT:case CA.BINARY_EVENT:this.onevent(A);break;case CA.ACK:case CA.BINARY_ACK:this.onack(A);break;case CA.DISCONNECT:this.ondisconnect();break;case CA.CONNECT_ERROR:this.destroy();const t=new Error(A.data.message);t.data=A.data.data,this.emitReserved("connect_error",t);break}}onevent(A){const e=A.data||[];A.id!=null&&e.push(this.ack(A.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(A){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const t of e)t.apply(this,A)}super.emit.apply(this,A),this._pid&&A.length&&typeof A[A.length-1]=="string"&&(this._lastOffset=A[A.length-1])}ack(A){const e=this;let t=!1;return function(...s){t||(t=!0,e.packet({type:CA.ACK,id:A,data:s}))}}onack(A){const e=this.acks[A.id];typeof e=="function"&&(delete this.acks[A.id],e.withError&&A.data.unshift(null),e.apply(this,A.data))}onconnect(A,e){this.id=A,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(A=>this.emitEvent(A)),this.receiveBuffer=[],this.sendBuffer.forEach(A=>{this.notifyOutgoingListeners(A),this.packet(A)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(A=>A()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:CA.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(A){return this.flags.compress=A,this}get volatile(){return this.flags.volatile=!0,this}timeout(A){return this.flags.timeout=A,this}onAny(A){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(A),this}prependAny(A){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(A),this}offAny(A){if(!this._anyListeners)return this;if(A){const e=this._anyListeners;for(let t=0;t<e.length;t++)if(A===e[t])return e.splice(t,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(A){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(A),this}prependAnyOutgoing(A){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(A),this}offAnyOutgoing(A){if(!this._anyOutgoingListeners)return this;if(A){const e=this._anyOutgoingListeners;for(let t=0;t<e.length;t++)if(A===e[t])return e.splice(t,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(A){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const t of e)t.apply(this,A.data)}}}function Ot(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Ot.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var A=Math.random(),e=Math.floor(A*this.jitter*r);r=(Math.floor(A*10)&1)==0?r-e:r+e}return Math.min(r,this.max)|0},Ot.prototype.reset=function(){this.attempts=0},Ot.prototype.setMin=function(r){this.ms=r},Ot.prototype.setMax=function(r){this.max=r},Ot.prototype.setJitter=function(r){this.jitter=r};class Tn extends GA{constructor(A,e){var t;super(),this.nsps={},this.subs=[],A&&typeof A=="object"&&(e=A,A=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,Cs(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((t=e.randomizationFactor)!==null&&t!==void 0?t:.5),this.backoff=new Ot({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=A;const s=e.parser||pg;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(A){return arguments.length?(this._reconnection=!!A,A||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(A){return A===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=A,this)}reconnectionDelay(A){var e;return A===void 0?this._reconnectionDelay:(this._reconnectionDelay=A,(e=this.backoff)===null||e===void 0||e.setMin(A),this)}randomizationFactor(A){var e;return A===void 0?this._randomizationFactor:(this._randomizationFactor=A,(e=this.backoff)===null||e===void 0||e.setJitter(A),this)}reconnectionDelayMax(A){var e;return A===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=A,(e=this.backoff)===null||e===void 0||e.setMax(A),this)}timeout(A){return arguments.length?(this._timeout=A,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(A){if(~this._readyState.indexOf("open"))return this;this.engine=new ng(this.uri,this.opts);const e=this.engine,t=this;this._readyState="opening",this.skipReconnect=!1;const s=xe(e,"open",function(){t.onopen(),A&&A()}),i=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),A?A(o):this.maybeReconnectOnOpen()},n=xe(e,"error",i);if(this._timeout!==!1){const o=this._timeout,a=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),e.close()},o);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(s),this.subs.push(n),this}connect(A){return this.open(A)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const A=this.engine;this.subs.push(xe(A,"ping",this.onping.bind(this)),xe(A,"data",this.ondata.bind(this)),xe(A,"error",this.onerror.bind(this)),xe(A,"close",this.onclose.bind(this)),xe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(A){try{this.decoder.add(A)}catch(e){this.onclose("parse error",e)}}ondecoded(A){ms(()=>{this.emitReserved("packet",A)},this.setTimeoutFn)}onerror(A){this.emitReserved("error",A)}socket(A,e){let t=this.nsps[A];return t?this._autoConnect&&!t.active&&t.connect():(t=new rc(this,A,e),this.nsps[A]=t),t}_destroy(A){const e=Object.keys(this.nsps);for(const t of e)if(this.nsps[t].active)return;this._close()}_packet(A){const e=this.encoder.encode(A);for(let t=0;t<e.length;t++)this.engine.write(e[t],A.options)}cleanup(){this.subs.forEach(A=>A()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(A,e){var t;this.cleanup(),(t=this.engine)===null||t===void 0||t.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",A,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const A=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const t=this.setTimeoutFn(()=>{A.skipReconnect||(this.emitReserved("reconnect_attempt",A.backoff.attempts),!A.skipReconnect&&A.open(s=>{s?(A._reconnecting=!1,A.reconnect(),this.emitReserved("reconnect_error",s)):A.onreconnect()}))},e);this.opts.autoUnref&&t.unref(),this.subs.push(()=>{this.clearTimeoutFn(t)})}}onreconnect(){const A=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",A)}}const dr={};function Qs(r,A){typeof r=="object"&&(A=r,r=void 0),A=A||{};const e=og(r,A.path||"/socket.io"),t=e.source,s=e.id,i=e.path,n=dr[s]&&i in dr[s].nsps,o=A.forceNew||A["force new connection"]||A.multiplex===!1||n;let a;return o?a=new Tn(t,A):(dr[s]||(dr[s]=new Tn(t,A)),a=dr[s]),e.query&&!A.query&&(A.query=e.queryKey),a.socket(e.path,A)}Object.assign(Qs,{Manager:Tn,Socket:rc,io:Qs,connect:Qs});let fe="http://localhost:8000";function sc(r){if(!r){console.warn("⚠️ [SOCKET DEBUG] setBaseUrl called with empty URL");return}if(r!==fe){const A=fe;fe=r,console.log(`🔄 [SOCKET DEBUG] SocketService: Changing baseUrl from ${A} to ${r}`),_A&&(console.log("🔄 [SOCKET DEBUG] Disconnecting old socket..."),_A.disconnect(),_A.removeAllListeners(),_A=null)}else console.log(`✅ [SOCKET DEBUG] BaseUrl already set to ${r}, no change needed`)}let _A=null;function mg(){const A=(()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}})();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:fe,hasToken:!!A,tokenLength:A?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const e=Qs(fe,{transports:["websocket","polling"],reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!0,autoConnect:!0,upgrade:!0,auth:A?{token:A}:void 0});return e.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:e.id,baseUrl:fe,transport:e.io.engine.transport.name,namespace:e.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),e.on("disconnect",t=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:t,socketId:e.id})}),e.on("connect_error",t=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:t?.message,description:t?.description,context:t?.context,type:t?.type,baseUrl:fe,namespace:e.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),e.on("reconnect_attempt",t=>{console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:t,baseUrl:fe})}),e.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:fe})}),e.on("reconnect",t=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:t,socketId:e.id})}),e}function Mn(){const r=_A?.io?.uri||_A?.io?.opts?.host||null;return!_A||_A.io&&r&&r!==fe?(_A&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:r,newBaseUrl:fe,wasConnected:_A.connected,reason:"baseUrl changed"}),_A.disconnect(),_A.removeAllListeners(),_A=null),console.log("🔧 [SOCKET DEBUG] Creating new socket instance for MT5 backend:",fe),_A=mg()):_A.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:_A.id,connected:_A.connected,baseUrl:fe,uri:r}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:_A.id,baseUrl:fe}),_A}function Cg(r,A){const e=Mn();return e.on(r,A),()=>e.off(r,A)}function vg(r,A){_A&&_A.off(r,A)}function bg(r,A){Mn().emit(r,A)}function Qg(){return _A?_A.connected?"connected":"connecting":"disconnected"}const Fs={getSocket:Mn,on:Cg,off:vg,emit:bg,getStatus:Qg,setBaseUrl:sc},ic=b.createContext(),ne=()=>{const r=b.useContext(ic);if(!r)throw new Error("useTrading must be used within TradingProvider");return r},Fg=({children:r,baseUrl:A,endpoints:e})=>{const t=A??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:bi&&bi.tagName.toUpperCase()==="SCRIPT"&&bi.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&"https://api-chart-sdk.e-volvo.io")??"http://localhost:8000",i={...{candles:"/api/chart/candles",symbols:"/api/symbols",trades:"/api/trades",account:"/api/user/account"},...e},n=e?.params||{},[o,a]=b.useState("CADJPY"),[l,c]=b.useState("M1"),[u,d]=b.useState([]),[g,B]=b.useState(!0),[f,w]=b.useState([]),[m,p]=b.useState(!1),[v,y]=b.useState(1e5),[E,U]=b.useState(null),[I,O]=b.useState([]),[T,lA]=b.useState(!0),[M,Z]=b.useState(!1),[S,V]=b.useState(!0),[X,cA]=b.useState("candles"),[hA,EA]=b.useState(!1),[vA,UA]=b.useState("dark"),bA=b.useRef(null);b.useEffect(()=>{Fs.setBaseUrl(t)},[t]);const q=b.useRef(new Map),$=b.useRef(null),QA=1e3,BA=b.useCallback(async()=>{try{const k=localStorage.getItem("token");if(!k){console.log("⚠️ No token, skipping orders fetch");return}p(!0);let _=await HA.get(`${t}${i.trades}`,{headers:{Authorization:`Bearer ${k}`}});const AA=_.data?.orphanTradeIds;if(Array.isArray(AA)&&AA.length>0&&(await HA.get(`${t}${i.trades}`,{headers:{Authorization:`Bearer ${k}`},params:{claimTradeId:AA[0]}}),_=await HA.get(`${t}/api/trades`,{headers:{Authorization:`Bearer ${k}`}})),_.data&&_.data.data){const eA=_.data.data.map(P=>({id:P.id,ticket:P.ticket,symbol:P.symbol,type:P.type,volume:P.volume,price:P.price,stopLoss:P.stopLoss,takeProfit:P.takeProfit,comment:P.comment||"",status:P.status,swap:P.swap||0,profit:P.profit||0,profitCurrency:"USD",time:new Date(P.openAt).toLocaleTimeString(),openAt:P.openAt,closeAt:P.closeAt}));w(eA)}else w([])}catch(k){console.error("❌ Error fetching orders:",k.response?.data||k.message),w([])}finally{p(!1)}},[t]),JA=b.useCallback((k,_)=>!_||!k.price||isNaN(_)||isNaN(k.price)?k.profit||0:(k.type==="BUY"?_-k.price:k.price-_)*k.volume,[]),xA=b.useCallback(async()=>{try{const k=localStorage.getItem("token");if(!k){console.log("⚠️ No token, skipping balance fetch");return}const _=await HA.get(`${t}${i.account}`,{headers:{Authorization:`Bearer ${k}`}});if(_.data&&_.data.data){const AA=parseFloat(_.data.data.balance);isNaN(AA)||y(AA)}}catch(k){console.error("❌ Error fetching user balance:",k.response?.data||k.message)}},[t]),Ge=b.useMemo(()=>{const k=v,_=f.reduce((TA,NA)=>TA+NA.volume*NA.price*.01,0),AA=f.reduce((TA,NA)=>{const ZA=u.find(le=>le.symbol===NA.symbol);if(ZA){const le=NA.type==="BUY"?parseFloat(ZA.bid||0):parseFloat(ZA.ask||0);if(le&&le>0&&!isNaN(le))return TA+JA(NA,le)}return TA+(NA.profit||0)},0),eA=k+AA,P=eA-_,j=_>0?eA/_*100:0;return{balance:k,equity:eA,margin:_,freeMargin:P,level:j.toFixed(2)}},[f,u,v,JA]);b.useEffect(()=>{localStorage.getItem("token")&&(BA(),xA())},[BA,xA]),b.useEffect(()=>{(async()=>{try{B(!0);const _=i.symbols.includes("?")?`${t}${i.symbols}`:`${t}${i.symbols}`,AA=await HA.get(_);let eA=[];Array.isArray(AA.data)?eA=AA.data:AA.data&&AA.data.data&&Array.isArray(AA.data.data)?eA=AA.data.data:AA.data&&AA.data.prices&&Array.isArray(AA.data.prices)?eA=AA.data.prices:AA.data&&Array.isArray(AA.data)&&(eA=AA.data);const P=eA.map(j=>j.symbol&&(j.bid!==void 0||j.price!==void 0)?{symbol:j.symbol,bid:j.bid??j.price??0,ask:j.ask??j.price??0,change:j.change??0}:j);P.length>0?(d(P),P.find(TA=>TA.symbol===o)||a(P[0].symbol)):d([])}catch(_){console.error("❌ Error fetching symbols:",_.response?.data||_.message),d([])}finally{B(!1)}})()},[t,i.symbols]);const Ut=b.useCallback(()=>{const k=q.current;if(k.size===0)return;const _=new Map(k);k.clear(),d(AA=>AA.map(eA=>{const P=_.get(eA.symbol);return P?{...eA,...P}:eA})),w(AA=>{let eA=!1;const P=AA.map(j=>{const TA=_.get(j.symbol);if(!TA)return j;const NA=j.type==="BUY"?parseFloat(TA.bid||0):parseFloat(TA.ask||0);if(!NA||isNaN(NA)||NA<=0)return j;const ZA=JA(j,NA);return ZA===j.profit?j:(eA=!0,{...j,profit:ZA})});return eA?P:AA})},[JA]);b.useEffect(()=>{bA.current||(bA.current=Fs.getSocket());const k=bA.current,_=()=>console.log("✅ TradingContext: Connected"),AA=()=>console.log("⚠️ TradingContext: Disconnected"),eA=j=>{j?.symbol&&(q.current.set(j.symbol,j),$.current||($.current=setTimeout(()=>{$.current=null,Ut()},QA)))},P=async j=>{if(console.log("🔔 Trade closed event received:",j),!!j){if(j.newBalance!==void 0){const TA=parseFloat(j.newBalance);isNaN(TA)||y(TA)}if(window.notify){const TA=j.profitLoss||j.profit||0,NA=TA>=0?`+${TA.toFixed(2)}`:TA.toFixed(2),ZA=j.symbol||"Trade",le=j.reason||"Closed";window.notify(`Trade Closed: ${le} | ${ZA} | P/L: ${NA} USD`,TA>=0?"success":"error")}j.tradeId&&w(TA=>TA.filter(NA=>NA.id!==j.tradeId)),await BA(),await xA()}};return k.on("connect",_),k.on("disconnect",AA),k.on("priceUpdate",eA),k.on("tradeClosed",P),()=>{k.off("connect",_),k.off("disconnect",AA),k.off("priceUpdate",eA),k.off("tradeClosed",P),$.current&&(clearTimeout($.current),$.current=null),q.current.clear()}},[Ut,BA,xA]),b.useEffect(()=>{try{const k=document.documentElement;if(!k)return;k.dataset.theme=vA}catch{}},[vA]);const kr=b.useMemo(()=>u.find(k=>k.symbol===o)||{bid:"0.00000",ask:"0.00000",change:0},[u,o]),je=b.useMemo(()=>({selectedSymbol:o,setSelectedSymbol:a,selectedTimeframe:l,setSelectedTimeframe:c,symbols:u,setSymbols:d,symbolsLoading:g,orders:f,setOrders:w,ordersLoading:m,fetchOrders:BA,fetchUserBalance:xA,userBalance:v,setUserBalance:y,accountSummary:Ge,currentSymbolData:kr,activeTool:E,setActiveTool:U,chartObjects:I,setChartObjects:O,showGrid:T,setShowGrid:lA,snapToGrid:M,setSnapToGrid:Z,drawingsVisible:S,setDrawingsVisible:V,chartType:X,setChartType:cA,chartLocked:hA,setChartLocked:EA,theme:vA,setTheme:UA,baseUrl:t,endpoints:i,endpointParams:n}),[o,l,u,g,f,m,BA,xA,v,Ge,kr,E,I,T,M,S,X,hA,vA,t,i,n]);return h.jsx(ic.Provider,{value:je,children:r})},yg=({bidPrice:r,askPrice:A,onBuyClick:e,onSellClick:t})=>{const s=()=>{e&&e(null)},i=()=>{t&&t(null)};return h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("button",{onClick:i,className:"text-white font-semibold rounded transition-colors text-sm",children:h.jsxs("div",{className:"flex items-center",children:[h.jsx("span",{className:"text-xs bg-[#BD3E3E] px-3 py-1.5",children:"SELL"}),h.jsx("span",{className:"text-xs font-bold bg-[#DE4848] px-3 py-1.5",children:r||"0.00000"})]})}),h.jsx("button",{onClick:s,className:"text-white font-semibold rounded transition-colors text-sm",children:h.jsxs("div",{className:"flex items-center",children:[h.jsx("span",{className:"text-xs bg-[#2869CE] px-3 py-1.5 cursor-pointer",children:"BUY"}),h.jsx("span",{className:"text-xs font-bold bg-[#2F7CF2] px-3 py-1.5 cursor-pointer",children:A||"0.00000"})]})})]})},nc=({isOpen:r,onClose:A,orderType:e,bidPrice:t,askPrice:s})=>{const{selectedSymbol:i,selectedTimeframe:n,setOrders:o,symbols:a,fetchOrders:l,theme:c,baseUrl:u,endpoints:d}=ne(),g=c==="light",[B,f]=b.useState("0.01"),[w,m]=b.useState(""),[p,v]=b.useState(""),[y,E]=b.useState(""),[U,I]=b.useState(!1),[O,T]=b.useState(null),[lA,M]=b.useState(""),[Z,S]=b.useState(e||"BUY"),[V,X]=b.useState(parseFloat(t)||0),[cA,hA]=b.useState(parseFloat(s)||0),[EA,vA]=b.useState("text-white"),[UA,bA]=b.useState("text-white"),q=b.useRef(parseFloat(t)||0),$=b.useRef(parseFloat(s)||0);b.useEffect(()=>{if(!r)return;const k=Fs.getSocket(),_=eA=>{if(!(!eA||!eA.symbol)&&eA.symbol.toUpperCase()===i?.toUpperCase()){const P=parseFloat(eA.bid)||0,j=parseFloat(eA.ask)||0;P>0&&(P>q.current?(vA("text-green-400"),setTimeout(()=>vA("text-white"),500)):P<q.current&&q.current>0&&(vA("text-red-400"),setTimeout(()=>vA("text-white"),500)),X(P),q.current=P),j>0&&(j>$.current?(bA("text-green-400"),setTimeout(()=>bA("text-white"),500)):j<$.current&&$.current>0&&(bA("text-red-400"),setTimeout(()=>bA("text-white"),500)),hA(j),$.current=j)}};k.on("priceUpdate",_);const AA=a.find(eA=>eA.symbol===i);if(AA){const eA=parseFloat(AA.bid)||0,P=parseFloat(AA.ask)||0;eA>0&&(X(eA),q.current=eA),P>0&&(hA(P),$.current=P)}return()=>{k.off("priceUpdate",_)}},[r,i,a]),b.useEffect(()=>{if(r){f("0.01"),m(""),v(""),E(""),M(""),S(e||"BUY");const k=parseFloat(t)||0,_=parseFloat(s)||0;k>0&&(X(k),q.current=k),_>0&&(hA(_),$.current=_)}},[r,e,t,s]);const QA=V||0,BA=cA||0,JA=k=>{const _=parseFloat(B)||.01,AA=Math.max(.01,_+k);f(AA.toFixed(2))},xA=k=>{const _=parseFloat(w)||0,AA=parseFloat(Z==="BUY"?cA:V)||0;if(!AA){M("Current price not available. Please wait...");return}let eA=_+k;Z==="BUY"?eA=Math.max(1e-5,Math.min(eA,AA-1e-5)):eA=Math.max(AA+1e-5,eA),m(eA>0?eA.toFixed(5):""),M("")},Ge=k=>{const _=parseFloat(p)||0,AA=parseFloat(Z==="BUY"?cA:V)||0;if(!AA){M("Current price not available. Please wait...");return}let eA=_+k;Z==="BUY"?eA=Math.max(AA+1e-5,eA):eA=Math.max(1e-5,Math.min(eA,AA-1e-5)),v(eA>0?eA.toFixed(5):""),M("")},Ut=async k=>{M("");const _=k||Z,AA=parseFloat(_==="BUY"?cA:V),eA=parseFloat(B),P=w?parseFloat(w):null,j=p?parseFloat(p):null;if(!eA||eA<=0||isNaN(eA)){M("Please enter a valid volume (minimum 0.01)");return}if(eA<.01){M("Volume must be at least 0.01");return}if(!AA||AA<=0||isNaN(AA)){M("Invalid price. Please refresh and try again.");return}if(P!==null&&P!==""){if(isNaN(P)||P<=0){M("Stop Loss must be a valid positive number");return}if(_==="BUY"&&P>=AA){M("Stop Loss must be below the current price for BUY orders");return}if(_==="SELL"&&P<=AA){M("Stop Loss must be above the current price for SELL orders");return}}if(j!==null&&j!==""){if(isNaN(j)||j<=0){M("Take Profit must be a valid positive number");return}if(_==="BUY"){if(j<=AA){M(`Take Profit must be above the entry price (${AA.toFixed(5)}) for BUY orders`);return}}else if(_==="SELL"&&j>=AA){M(`Take Profit must be below the entry price (${AA.toFixed(5)}) for SELL orders`);return}}S(_),T(_),I(!0);const TA=new Date,NA=TA.toLocaleTimeString(),ZA=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,le=localStorage.getItem("token");if(!le){M("Please login to place trades"),I(!1),T(null);return}const vi={symbol:i,type:_,volume:eA,price:AA,takeProfit:j,stopLoss:P,comment:y.trim()||null},_r={ticket:ZA.substring(0,8),symbol:i,type:_,volume:parseFloat(eA),price:parseFloat(AA),time:NA,stopLoss:P?parseFloat(P):null,takeProfit:j?parseFloat(j):null,swap:0,profit:0,profitCurrency:"USD",comment:y.trim()||"",id:ZA,status:"OPEN",openAt:TA.toISOString()};o&&o(pe=>[...pe,_r]),I(!1),T(null),A();const ko=u||"https://api-chart-sdk.e-volvo.io",_o=d?.trades||"/api/trades";HA.post(`${ko}${_o}`,vi,{headers:{Authorization:`Bearer ${le}`,"Content-Type":"application/json"}}).then(pe=>{if(pe.data&&pe.data.data){const C=pe.data.data.trade;o&&o(F=>F.map(x=>x.id===ZA?{...x,id:C.id,ticket:C.id.substring(0,8),time:NA,openAt:C.openAt}:x)),console.log("✅ Trade saved successfully:",C),window.notify&&window.notify(`Trade placed successfully: ${C.symbol} ${C.type}`,"success")}else{o&&o(F=>F.filter(x=>x.id!==ZA));const C=pe.data?.message||"Failed to place trade";window.notify&&window.notify(C,"error")}}).catch(pe=>{console.error("Error placing trade:",pe),o&&o(F=>F.filter(x=>x.id!==ZA));let C="Failed to place trade";if(pe.response){const F=pe.response.status,x=pe.response.data;F===400?C=x?.message||"Invalid trade data. Please check your inputs.":F===401?C="Authentication failed. Please login again.":F===404?C=x?.message||"Symbol not found. Please select a valid symbol.":F===500?C="Server error. Please try again later.":C=x?.message||`Error: ${F}`}else pe.request&&(C="Network error. Please check your internet connection.");window.notify&&window.notify(C,"error")})},je=((parseFloat(B)||0)*1e5).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return r?h.jsxs("div",{className:`w-full max-w-sm rounded-lg shadow-2xl flex flex-col pointer-events-auto z-30 ${g?"bg-white border border-slate-400":"bg-[#12161d] border border-slate-700"}`,style:{maxHeight:"95vh",marginTop:"57px"},children:[h.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between ${g?"border-slate-400 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:`text-sm font-semibold ${g?"text-slate-800":"text-white"}`,children:"Market Execution"}),h.jsx("button",{className:`p-0.5 transition-colors ${g?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),h.jsx("button",{onClick:A,className:`p-1 rounded transition-colors ${g?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),h.jsxs("div",{className:"overflow-y-auto p-4 space-y-4",style:{maxHeight:"calc(90vh - 60px)"},children:[lA&&h.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:lA}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("label",{className:`text-sm font-medium ${g?"text-slate-700":"text-white"}`,children:"Volume"}),h.jsxs("span",{className:`text-sm ${g?"text-slate-700":"text-white"}`,children:[je," CAD"]})]}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>JA(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${g?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),h.jsx("input",{type:"number",value:B,onChange:k=>{f(k.target.value),M("")},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${g?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),h.jsx("button",{type:"button",onClick:()=>JA(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${g?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[h.jsxs("div",{children:[h.jsx("div",{className:"flex items-center justify-between mb-2",children:h.jsx("label",{className:`text-sm font-medium ${g?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>xA(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${g?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),h.jsx("input",{type:"text",value:w,onChange:k=>{const _=k.target.value;(_===""||/^\d*\.?\d*$/.test(_))&&(m(_),M(""))},onBlur:k=>{const _=parseFloat(k.target.value);!isNaN(_)&&_>0?m(_.toFixed(5)):k.target.value===""&&m("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${g?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),h.jsx("button",{type:"button",onClick:()=>xA(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${g?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"flex items-center justify-between mb-2",children:h.jsx("label",{className:`text-sm font-medium ${g?"text-slate-700":"text-white"}`,children:"Take Profit"})}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>Ge(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${g?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),h.jsx("input",{type:"text",value:p,onChange:k=>{const _=k.target.value;(_===""||/^\d*\.?\d*$/.test(_))&&(v(_),M(""))},onBlur:k=>{const _=parseFloat(k.target.value);!isNaN(_)&&_>0?v(_.toFixed(5)):k.target.value===""&&v("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${g?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),h.jsx("button",{type:"button",onClick:()=>Ge(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${g?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),h.jsxs("div",{children:[h.jsx("label",{className:`block text-sm font-medium mb-2 ${g?"text-slate-700":"text-white"}`,children:"Comment"}),h.jsx("textarea",{value:y,onChange:k=>E(k.target.value),placeholder:"Optional comment",rows:2,className:`w-full px-3 py-2 rounded text-sm focus:outline-none focus:border-secondary resize-none ${g?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),h.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${g?"border-slate-400":"border-slate-700"}`,children:[h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:g?"text-slate-700":"text-white",children:"Bid: "}),h.jsx("span",{className:`${EA} font-medium transition-colors duration-400`,children:QA>0?QA.toFixed(5):"---"})]}),h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:g?"text-slate-700":"text-white",children:"Ask: "}),h.jsx("span",{className:`${UA} font-medium transition-colors duration-400`,children:BA>0?BA.toFixed(5):"---"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[h.jsx("button",{onClick:()=>Ut("SELL"),disabled:U,className:"px-4 py-3 bg-rose-600 hover:bg-rose-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:U&&O==="SELL"?h.jsxs("span",{className:"flex items-center justify-center gap-2",children:[h.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Sell by Market"}),h.jsx("button",{onClick:()=>Ut("BUY"),disabled:U,className:"px-4 py-3 bg-sky-600 hover:bg-sky-700 text-white font-semibold rounded text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:U&&O==="BUY"?h.jsxs("span",{className:"flex items-center justify-center gap-2",children:[h.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Placing..."]}):"Buy by Market"})]})]})]}):null};function RA(r){if(r==null)return null;if(typeof r=="number"){if(Number.isNaN(r)||!Number.isFinite(r))return null;let A;r>1e10?A=r/1e3:(r<1e9,A=r);const e=Math.floor(A);return e<946684800||e>4102444800?null:e}if(typeof r=="string"){const A=Date.parse(r);return Number.isNaN(A)?null:Math.floor(A/1e3)}if(typeof r=="object"&&"year"in r&&"month"in r&&"day"in r){const e=new Date(Date.UTC(r.year,r.month-1,r.day)).getTime();return Number.isNaN(e)?null:Math.floor(e/1e3)}return null}function Ug(r,A){if(!r||r.length<2)return[];const e=[],t=2;for(let s=1;s<r.length;s++){const i=r[s-1].time,n=r[s].time,o=n-i;o>A*t&&e.push({from:i,to:n,gapSeconds:o,gapHours:(o/3600).toFixed(1),fromDate:new Date(i*1e3).toISOString(),toDate:new Date(n*1e3).toISOString()})}return e}function Eg(r,A="America/New_York"){const e=new Date(r*1e3),t=new Date(e.toLocaleString("en-US",{timeZone:A})),s=t.getDay();return!(s===0||s===6||s===5&&t.getHours()>=17)}function oc(r){return Array.isArray(r)?r.map(A=>({...A,time:RA(A.time)})).filter(A=>A.time!=null):[]}function xg(r){if(!r||r.length<2)return!0;for(let A=1;A<r.length;A++)if(r[A].time<=r[A-1].time)return!1;return!0}function kt(r,A){return!Number.isFinite(r)||!Number.isFinite(A)||A<=0?r:Math.floor(r/A)*A}const Ae="17:00-17:00",ee="America/New_York",Oe="24x7",ke="UTC",ac={EURUSD:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"},BTCUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},ETHUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},BNBUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},SOLUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},ADAUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},XRPUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},DOGEUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},DOTUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},MATICUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"},LINKUSDT:{type:"crypto",session:Oe,sessionTZ:ke,priceMode:"last"}},lc={type:"forex",sessionTZ:ee,session:Ae,priceMode:"mid"};function Br(r){return r&&ac[r.toUpperCase()]||lc}function Sg(r){return Br(r).type==="forex"}function Hg(r){return Br(r).type==="crypto"}function Lg(r){return Br(r).session==="24x7"}function cc(r){if(!r||typeof r!="object")return!1;const{time:A,open:e,high:t,low:s,close:i,volume:n}=r;return!(RA(A)==null||typeof e!="number"||!Number.isFinite(e)||typeof t!="number"||!Number.isFinite(t)||typeof s!="number"||!Number.isFinite(s)||typeof i!="number"||!Number.isFinite(i)||n!=null&&(typeof n!="number"||n<0||!Number.isFinite(n))||t<e||t<i||t<s||s>e||s>i||s>t||e<=0||t<=0||s<=0||i<=0)}function hc(r){const A=n=>Math.round(n*1e5)/1e5;let e=A(r.open),t=A(r.high),s=A(r.low),i=A(r.close);return t=Math.max(t,e,i,s),s=Math.min(s,e,i,t),{...r,open:e,high:t,low:s,close:i,volume:r.volume!=null?Math.round(r.volume):r.volume}}function uc(r){if(!Array.isArray(r)||r.length===0)return[];const A=new Map;return r.forEach(e=>{const t=RA(e.time);if(t!=null)if(A.has(t)){const s=A.get(t);A.set(t,{...e,time:t,open:e.open,high:Math.max(s.high,e.high),low:Math.min(s.low,e.low),close:e.close,volume:(s.volume||0)+(e.volume||0)})}else A.set(t,{...e,time:t})}),Array.from(A.values())}function Ig(r,A="percentile"){if(!Array.isArray(r)||r.length<3)return r;const e=r.map(n=>n.close).filter(n=>Number.isFinite(n));if(e.length<3)return r;const t=[...e].sort((n,o)=>n-o);let s,i;if(A==="percentile"){const n=Math.floor(t.length*.25),o=Math.floor(t.length*.75),a=t[n],l=t[o],c=l-a;s=a-1.5*c,i=l+1.5*c}else{const n=e.reduce((l,c)=>l+c,0)/e.length,o=e.reduce((l,c)=>l+Math.pow(c-n,2),0)/e.length,a=Math.sqrt(o);if(a===0)return r;s=n-3*a,i=n+3*a}return r.map((n,o)=>{const a=n.close;if(a<s||a>i){if(o===0)return n;const l=r[o-1].close;return{...n,open:l,high:Math.max(l,n.high),low:Math.min(l,n.low),close:l}}return n})}function Tg(r,A){if(!Array.isArray(r)||r.length===0)return r;const e=[],t=Math.max(A*10080,604800),s=1e4;for(let o=0;o<r.length;o++)if(e.push(r[o]),o<r.length-1){const a=r[o].time,l=r[o+1].time,c=l-a;if(c>t&&((c/3600).toFixed(1),(t/3600).toFixed(1)),c>A&&c<=t){const u=r[o];let d=a+A,g=0;for(d=kt(d,A);d<l&&g<s;){const B=kt(d,A);e.some(w=>w.time===B)||(e.push({time:B,open:u.close,high:u.close,low:u.close,close:u.close,volume:0}),g++),d+=A}if(d<l&&g>=s){const B=kt(l-A,A);e.some(w=>w.time===B)||e.push({time:B,open:u.close,high:u.close,low:u.close,close:u.close,volume:0})}}}e.sort((o,a)=>o.time-a.time);const i=[],n=new Set;for(const o of e)n.has(o.time)||(n.add(o.time),i.push(o));return i}function ys(r){if(!r||typeof r!="string")return 60;const A=r.toUpperCase();if(A==="MN")return 2592e3;let e=A.match(/^([MHDW])(\d+)$/);if(e){const t=e[1];return parseInt(e[2],10)*({M:60,H:3600,D:86400,W:604800}[t]||60)}if(e=r.match(/^(\d+)([mhdwy])$/i),e){const t=parseInt(e[1],10),s=e[2].toLowerCase();return t*({m:60,h:3600,d:86400,w:604800,y:31536e3}[s]||60)}return 60}function fc(r,A,e){if(!Array.isArray(r)||r.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const t=Br(A),s=ys(e),o=oc(r).map(w=>({...w,time:kt(w.time,s)})).filter(w=>cc(w)).map(w=>hc(w)),a=uc(o);a.sort((w,m)=>w.time-m.time);const l=a.filter((w,m)=>m===0?!0:w.time>a[m-1].time),c=l.length>10?Ig(l,"percentile"):l,u=uc(c);u.sort((w,m)=>w.time-m.time);const d=Tg(u,s),g=[];for(let w=1;w<d.length;w++){const m=d[w].time-d[w-1].time;m>s*2&&g.push({from:d[w-1].time,to:d[w].time,gapSeconds:m,gapMinutes:Math.round(m/60),fromDate:new Date(d[w-1].time*1e3).toISOString(),toDate:new Date(d[w].time*1e3).toISOString()})}const B=c.filter((w,m)=>m===0?!1:w.close===c[m-1].close&&w.open===c[m-1].close).length,f={original:r.length,processed:d.length,duplicates:r.length-a.length,outliers:B,gaps:g,filledGaps:d.length-u.length,symbolConfig:t};return{candles:d,stats:f}}function dc(r,A,e="1m"){if(!r||!A||!cc(r))return null;const t=RA(r.time);if(t==null)return null;const s=ys(e),i=kt(t,s);return hc({...r,time:i})}var Dn=function(r,A){return Dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])},Dn(r,A)};function Se(r,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");Dn(r,A);function e(){this.constructor=r}r.prototype=A===null?Object.create(A):(e.prototype=A.prototype,new e)}var On=function(){return On=Object.assign||function(A){for(var e,t=1,s=arguments.length;t<s;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(A[i]=e[i])}return A},On.apply(this,arguments)};function oe(r,A,e,t){function s(i){return i instanceof e?i:new e(function(n){n(i)})}return new(e||(e=Promise))(function(i,n){function o(c){try{l(t.next(c))}catch(u){n(u)}}function a(c){try{l(t.throw(c))}catch(u){n(u)}}function l(c){c.done?i(c.value):s(c.value).then(o,a)}l((t=t.apply(r,[])).next())})}function te(r,A){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,s,i,n;return n={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function o(l){return function(c){return a([l,c])}}function a(l){if(t)throw new TypeError("Generator is already executing.");for(;e;)try{if(t=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){e.label=l[1];break}if(l[0]===6&&e.label<i[1]){e.label=i[1],i=l;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(l);break}i[2]&&e.ops.pop(),e.trys.pop();continue}l=A.call(r,e)}catch(c){l=[6,c],s=0}finally{t=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Us(r,A,e){if(arguments.length===2)for(var t=0,s=A.length,i;t<s;t++)(i||!(t in A))&&(i||(i=Array.prototype.slice.call(A,0,t)),i[t]=A[t]);return r.concat(i||A)}for(var Ze=(function(){function r(A,e,t,s){this.left=A,this.top=e,this.width=t,this.height=s}return r.prototype.add=function(A,e,t,s){return new r(this.left+A,this.top+e,this.width+t,this.height+s)},r.fromClientRect=function(A,e){return new r(e.left+A.windowBounds.left,e.top+A.windowBounds.top,e.width,e.height)},r.fromDOMRectList=function(A,e){var t=Array.from(e).find(function(s){return s.width!==0});return t?new r(t.left+A.windowBounds.left,t.top+A.windowBounds.top,t.width,t.height):r.EMPTY},r.EMPTY=new r(0,0,0,0),r})(),Es=function(r,A){return Ze.fromClientRect(r,A.getBoundingClientRect())},Mg=function(r){var A=r.body,e=r.documentElement;if(!A||!e)throw new Error("Unable to get document size");var t=Math.max(Math.max(A.scrollWidth,e.scrollWidth),Math.max(A.offsetWidth,e.offsetWidth),Math.max(A.clientWidth,e.clientWidth)),s=Math.max(Math.max(A.scrollHeight,e.scrollHeight),Math.max(A.offsetHeight,e.offsetHeight),Math.max(A.clientHeight,e.clientHeight));return new Ze(0,0,t,s)},xs=function(r){for(var A=[],e=0,t=r.length;e<t;){var s=r.charCodeAt(e++);if(s>=55296&&s<=56319&&e<t){var i=r.charCodeAt(e++);(i&64512)===56320?A.push(((s&1023)<<10)+(i&1023)+65536):(A.push(s),e--)}else A.push(s)}return A},VA=function(){for(var r=[],A=0;A<arguments.length;A++)r[A]=arguments[A];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var e=r.length;if(!e)return"";for(var t=[],s=-1,i="";++s<e;){var n=r[s];n<=65535?t.push(n):(n-=65536,t.push((n>>10)+55296,n%1024+56320)),(s+1===e||t.length>16384)&&(i+=String.fromCharCode.apply(String,t),t.length=0)}return i},Bc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dg=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ss=0;Ss<Bc.length;Ss++)Dg[Bc.charCodeAt(Ss)]=Ss;for(var gc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Hs=0;Hs<gc.length;Hs++)gr[gc.charCodeAt(Hs)]=Hs;for(var Og=function(r){var A=r.length*.75,e=r.length,t,s=0,i,n,o,a;r[r.length-1]==="="&&(A--,r[r.length-2]==="="&&A--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(A):new Array(A),c=Array.isArray(l)?l:new Uint8Array(l);for(t=0;t<e;t+=4)i=gr[r.charCodeAt(t)],n=gr[r.charCodeAt(t+1)],o=gr[r.charCodeAt(t+2)],a=gr[r.charCodeAt(t+3)],c[s++]=i<<2|n>>4,c[s++]=(n&15)<<4|o>>2,c[s++]=(o&3)<<6|a&63;return l},kg=function(r){for(var A=r.length,e=[],t=0;t<A;t+=2)e.push(r[t+1]<<8|r[t]);return e},_g=function(r){for(var A=r.length,e=[],t=0;t<A;t+=4)e.push(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]);return e},vt=5,kn=11,_n=2,Ng=kn-vt,pc=65536>>vt,Kg=1<<vt,Nn=Kg-1,Vg=1024>>vt,Pg=pc+Vg,Gg=Pg,Rg=32,Wg=Gg+Rg,zg=65536>>kn,Xg=1<<Ng,Jg=Xg-1,wc=function(r,A,e){return r.slice?r.slice(A,e):new Uint16Array(Array.prototype.slice.call(r,A,e))},Zg=function(r,A,e){return r.slice?r.slice(A,e):new Uint32Array(Array.prototype.slice.call(r,A,e))},Yg=function(r,A){var e=Og(r),t=Array.isArray(e)?_g(e):new Uint32Array(e),s=Array.isArray(e)?kg(e):new Uint16Array(e),i=24,n=wc(s,i/2,t[4]/2),o=t[5]===2?wc(s,(i+t[4])/2):Zg(t,Math.ceil((i+t[4])/4));return new qg(t[0],t[1],t[2],t[3],n,o)},qg=(function(){function r(A,e,t,s,i,n){this.initialValue=A,this.errorValue=e,this.highStart=t,this.highValueIndex=s,this.index=i,this.data=n}return r.prototype.get=function(A){var e;if(A>=0){if(A<55296||A>56319&&A<=65535)return e=this.index[A>>vt],e=(e<<_n)+(A&Nn),this.data[e];if(A<=65535)return e=this.index[pc+(A-55296>>vt)],e=(e<<_n)+(A&Nn),this.data[e];if(A<this.highStart)return e=Wg-zg+(A>>kn),e=this.index[e],e+=A>>vt&Jg,e=this.index[e],e=(e<<_n)+(A&Nn),this.data[e];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),mc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$g=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ls=0;Ls<mc.length;Ls++)$g[mc.charCodeAt(Ls)]=Ls;var jg="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Cc=50,Ap=1,vc=2,bc=3,ep=4,tp=5,Qc=7,Fc=8,yc=9,rt=10,Kn=11,Uc=12,Vn=13,rp=14,pr=15,Pn=16,Is=17,wr=18,sp=19,Ec=20,Gn=21,mr=22,Rn=23,_t=24,we=25,Cr=26,vr=27,Nt=28,ip=29,bt=30,np=31,Ts=32,Ms=33,Wn=34,zn=35,Xn=36,br=37,Jn=38,Ds=39,Os=40,Zn=41,xc=42,op=43,ap=[9001,65288],Sc="!",mA="×",ks="÷",Yn=Yg(jg),Ye=[bt,Xn],qn=[Ap,vc,bc,tp],Hc=[rt,Fc],Lc=[vr,Cr],lp=qn.concat(Hc),Ic=[Jn,Ds,Os,Wn,zn],cp=[pr,Vn],hp=function(r,A){A===void 0&&(A="strict");var e=[],t=[],s=[];return r.forEach(function(i,n){var o=Yn.get(i);if(o>Cc?(s.push(!0),o-=Cc):s.push(!1),["normal","auto","loose"].indexOf(A)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return t.push(n),e.push(Pn);if(o===ep||o===Kn){if(n===0)return t.push(n),e.push(bt);var a=e[n-1];return lp.indexOf(a)===-1?(t.push(t[n-1]),e.push(a)):(t.push(n),e.push(bt))}if(t.push(n),o===np)return e.push(A==="strict"?Gn:br);if(o===xc||o===ip)return e.push(bt);if(o===op)return i>=131072&&i<=196605||i>=196608&&i<=262141?e.push(br):e.push(bt);e.push(o)}),[t,e,s]},$n=function(r,A,e,t){var s=t[e];if(Array.isArray(r)?r.indexOf(s)!==-1:r===s)for(var i=e;i<=t.length;){i++;var n=t[i];if(n===A)return!0;if(n!==rt)break}if(s===rt)for(var i=e;i>0;){i--;var o=t[i];if(Array.isArray(r)?r.indexOf(o)!==-1:r===o)for(var a=e;a<=t.length;){a++;var n=t[a];if(n===A)return!0;if(n!==rt)break}if(o!==rt)break}return!1},Tc=function(r,A){for(var e=r;e>=0;){var t=A[e];if(t===rt)e--;else return t}return 0},up=function(r,A,e,t,s){if(e[t]===0)return mA;var i=t-1;if(Array.isArray(s)&&s[i]===!0)return mA;var n=i-1,o=i+1,a=A[i],l=n>=0?A[n]:0,c=A[o];if(a===vc&&c===bc)return mA;if(qn.indexOf(a)!==-1)return Sc;if(qn.indexOf(c)!==-1||Hc.indexOf(c)!==-1)return mA;if(Tc(i,A)===Fc)return ks;if(Yn.get(r[i])===Kn||(a===Ts||a===Ms)&&Yn.get(r[o])===Kn||a===Qc||c===Qc||a===yc||[rt,Vn,pr].indexOf(a)===-1&&c===yc||[Is,wr,sp,_t,Nt].indexOf(c)!==-1||Tc(i,A)===mr||$n(Rn,mr,i,A)||$n([Is,wr],Gn,i,A)||$n(Uc,Uc,i,A))return mA;if(a===rt)return ks;if(a===Rn||c===Rn)return mA;if(c===Pn||a===Pn)return ks;if([Vn,pr,Gn].indexOf(c)!==-1||a===rp||l===Xn&&cp.indexOf(a)!==-1||a===Nt&&c===Xn||c===Ec||Ye.indexOf(c)!==-1&&a===we||Ye.indexOf(a)!==-1&&c===we||a===vr&&[br,Ts,Ms].indexOf(c)!==-1||[br,Ts,Ms].indexOf(a)!==-1&&c===Cr||Ye.indexOf(a)!==-1&&Lc.indexOf(c)!==-1||Lc.indexOf(a)!==-1&&Ye.indexOf(c)!==-1||[vr,Cr].indexOf(a)!==-1&&(c===we||[mr,pr].indexOf(c)!==-1&&A[o+1]===we)||[mr,pr].indexOf(a)!==-1&&c===we||a===we&&[we,Nt,_t].indexOf(c)!==-1)return mA;if([we,Nt,_t,Is,wr].indexOf(c)!==-1)for(var u=i;u>=0;){var d=A[u];if(d===we)return mA;if([Nt,_t].indexOf(d)!==-1)u--;else break}if([vr,Cr].indexOf(c)!==-1)for(var u=[Is,wr].indexOf(a)!==-1?n:i;u>=0;){var d=A[u];if(d===we)return mA;if([Nt,_t].indexOf(d)!==-1)u--;else break}if(Jn===a&&[Jn,Ds,Wn,zn].indexOf(c)!==-1||[Ds,Wn].indexOf(a)!==-1&&[Ds,Os].indexOf(c)!==-1||[Os,zn].indexOf(a)!==-1&&c===Os||Ic.indexOf(a)!==-1&&[Ec,Cr].indexOf(c)!==-1||Ic.indexOf(c)!==-1&&a===vr||Ye.indexOf(a)!==-1&&Ye.indexOf(c)!==-1||a===_t&&Ye.indexOf(c)!==-1||Ye.concat(we).indexOf(a)!==-1&&c===mr&&ap.indexOf(r[o])===-1||Ye.concat(we).indexOf(c)!==-1&&a===wr)return mA;if(a===Zn&&c===Zn){for(var g=e[i],B=1;g>0&&(g--,A[g]===Zn);)B++;if(B%2!==0)return mA}return a===Ts&&c===Ms?mA:ks},fp=function(r,A){A||(A={lineBreak:"normal",wordBreak:"normal"});var e=hp(r,A.lineBreak),t=e[0],s=e[1],i=e[2];(A.wordBreak==="break-all"||A.wordBreak==="break-word")&&(s=s.map(function(o){return[we,bt,xc].indexOf(o)!==-1?br:o}));var n=A.wordBreak==="keep-all"?i.map(function(o,a){return o&&r[a]>=19968&&r[a]<=40959}):void 0;return[t,s,n]},dp=(function(){function r(A,e,t,s){this.codePoints=A,this.required=e===Sc,this.start=t,this.end=s}return r.prototype.slice=function(){return VA.apply(void 0,this.codePoints.slice(this.start,this.end))},r})(),Bp=function(r,A){var e=xs(r),t=fp(e,A),s=t[0],i=t[1],n=t[2],o=e.length,a=0,l=0;return{next:function(){if(l>=o)return{done:!0,value:null};for(var c=mA;l<o&&(c=up(e,i,s,++l,n))===mA;);if(c!==mA||l===o){var u=new dp(e,c,a,l);return a=l,{value:u,done:!1}}return{done:!0,value:null}}}},gp=1,pp=2,Qr=4,Mc=8,_s=10,Dc=47,Fr=92,wp=9,mp=32,Ns=34,yr=61,Cp=35,vp=36,bp=37,Ks=39,Vs=40,Ur=41,Qp=95,de=45,Fp=33,yp=60,Up=62,Ep=64,xp=91,Sp=93,Hp=61,Lp=123,Ps=63,Ip=125,Oc=124,Tp=126,Mp=128,kc=65533,jn=42,Qt=43,Dp=44,Op=58,kp=59,Er=46,_p=0,Np=8,Kp=11,Vp=14,Pp=31,Gp=127,_e=-1,_c=48,Nc=97,Kc=101,Rp=102,Wp=117,zp=122,Vc=65,Pc=69,Gc=70,Xp=85,Jp=90,re=function(r){return r>=_c&&r<=57},Zp=function(r){return r>=55296&&r<=57343},Kt=function(r){return re(r)||r>=Vc&&r<=Gc||r>=Nc&&r<=Rp},Yp=function(r){return r>=Nc&&r<=zp},qp=function(r){return r>=Vc&&r<=Jp},$p=function(r){return Yp(r)||qp(r)},jp=function(r){return r>=Mp},Gs=function(r){return r===_s||r===wp||r===mp},Rs=function(r){return $p(r)||jp(r)||r===Qp},Rc=function(r){return Rs(r)||re(r)||r===de},Aw=function(r){return r>=_p&&r<=Np||r===Kp||r>=Vp&&r<=Pp||r===Gp},st=function(r,A){return r!==Fr?!1:A!==_s},Ws=function(r,A,e){return r===de?Rs(A)||st(A,e):Rs(r)?!0:!!(r===Fr&&st(r,A))},Ao=function(r,A,e){return r===Qt||r===de?re(A)?!0:A===Er&&re(e):re(r===Er?A:r)},ew=function(r){var A=0,e=1;(r[A]===Qt||r[A]===de)&&(r[A]===de&&(e=-1),A++);for(var t=[];re(r[A]);)t.push(r[A++]);var s=t.length?parseInt(VA.apply(void 0,t),10):0;r[A]===Er&&A++;for(var i=[];re(r[A]);)i.push(r[A++]);var n=i.length,o=n?parseInt(VA.apply(void 0,i),10):0;(r[A]===Pc||r[A]===Kc)&&A++;var a=1;(r[A]===Qt||r[A]===de)&&(r[A]===de&&(a=-1),A++);for(var l=[];re(r[A]);)l.push(r[A++]);var c=l.length?parseInt(VA.apply(void 0,l),10):0;return e*(s+o*Math.pow(10,-n))*Math.pow(10,a*c)},tw={type:2},rw={type:3},sw={type:4},iw={type:13},nw={type:8},ow={type:21},aw={type:9},lw={type:10},cw={type:11},hw={type:12},uw={type:14},zs={type:23},fw={type:1},dw={type:25},Bw={type:24},gw={type:26},pw={type:27},ww={type:28},mw={type:29},Cw={type:31},eo={type:32},Wc=(function(){function r(){this._value=[]}return r.prototype.write=function(A){this._value=this._value.concat(xs(A))},r.prototype.read=function(){for(var A=[],e=this.consumeToken();e!==eo;)A.push(e),e=this.consumeToken();return A},r.prototype.consumeToken=function(){var A=this.consumeCodePoint();switch(A){case Ns:return this.consumeStringToken(Ns);case Cp:var e=this.peekCodePoint(0),t=this.peekCodePoint(1),s=this.peekCodePoint(2);if(Rc(e)||st(t,s)){var i=Ws(e,t,s)?pp:gp,n=this.consumeName();return{type:5,value:n,flags:i}}break;case vp:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),iw;break;case Ks:return this.consumeStringToken(Ks);case Vs:return tw;case Ur:return rw;case jn:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),uw;break;case Qt:if(Ao(A,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(A),this.consumeNumericToken();break;case Dp:return sw;case de:var o=A,a=this.peekCodePoint(0),l=this.peekCodePoint(1);if(Ao(o,a,l))return this.reconsumeCodePoint(A),this.consumeNumericToken();if(Ws(o,a,l))return this.reconsumeCodePoint(A),this.consumeIdentLikeToken();if(a===de&&l===Up)return this.consumeCodePoint(),this.consumeCodePoint(),Bw;break;case Er:if(Ao(A,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(A),this.consumeNumericToken();break;case Dc:if(this.peekCodePoint(0)===jn)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===jn&&(c=this.consumeCodePoint(),c===Dc))return this.consumeToken();if(c===_e)return this.consumeToken()}break;case Op:return gw;case kp:return pw;case yp:if(this.peekCodePoint(0)===Fp&&this.peekCodePoint(1)===de&&this.peekCodePoint(2)===de)return this.consumeCodePoint(),this.consumeCodePoint(),dw;break;case Ep:var u=this.peekCodePoint(0),d=this.peekCodePoint(1),g=this.peekCodePoint(2);if(Ws(u,d,g)){var n=this.consumeName();return{type:7,value:n}}break;case xp:return ww;case Fr:if(st(A,this.peekCodePoint(0)))return this.reconsumeCodePoint(A),this.consumeIdentLikeToken();break;case Sp:return mw;case Hp:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),nw;break;case Lp:return cw;case Ip:return hw;case Wp:case Xp:var B=this.peekCodePoint(0),f=this.peekCodePoint(1);return B===Qt&&(Kt(f)||f===Ps)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(A),this.consumeIdentLikeToken();case Oc:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),aw;if(this.peekCodePoint(0)===Oc)return this.consumeCodePoint(),ow;break;case Tp:if(this.peekCodePoint(0)===yr)return this.consumeCodePoint(),lw;break;case _e:return eo}return Gs(A)?(this.consumeWhiteSpace(),Cw):re(A)?(this.reconsumeCodePoint(A),this.consumeNumericToken()):Rs(A)?(this.reconsumeCodePoint(A),this.consumeIdentLikeToken()):{type:6,value:VA(A)}},r.prototype.consumeCodePoint=function(){var A=this._value.shift();return typeof A>"u"?-1:A},r.prototype.reconsumeCodePoint=function(A){this._value.unshift(A)},r.prototype.peekCodePoint=function(A){return A>=this._value.length?-1:this._value[A]},r.prototype.consumeUnicodeRangeToken=function(){for(var A=[],e=this.consumeCodePoint();Kt(e)&&A.length<6;)A.push(e),e=this.consumeCodePoint();for(var t=!1;e===Ps&&A.length<6;)A.push(e),e=this.consumeCodePoint(),t=!0;if(t){var s=parseInt(VA.apply(void 0,A.map(function(a){return a===Ps?_c:a})),16),i=parseInt(VA.apply(void 0,A.map(function(a){return a===Ps?Gc:a})),16);return{type:30,start:s,end:i}}var n=parseInt(VA.apply(void 0,A),16);if(this.peekCodePoint(0)===de&&Kt(this.peekCodePoint(1))){this.consumeCodePoint(),e=this.consumeCodePoint();for(var o=[];Kt(e)&&o.length<6;)o.push(e),e=this.consumeCodePoint();var i=parseInt(VA.apply(void 0,o),16);return{type:30,start:n,end:i}}else return{type:30,start:n,end:n}},r.prototype.consumeIdentLikeToken=function(){var A=this.consumeName();return A.toLowerCase()==="url"&&this.peekCodePoint(0)===Vs?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Vs?(this.consumeCodePoint(),{type:19,value:A}):{type:20,value:A}},r.prototype.consumeUrlToken=function(){var A=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===_e)return{type:22,value:""};var e=this.peekCodePoint(0);if(e===Ks||e===Ns){var t=this.consumeStringToken(this.consumeCodePoint());return t.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===_e||this.peekCodePoint(0)===Ur)?(this.consumeCodePoint(),{type:22,value:t.value}):(this.consumeBadUrlRemnants(),zs)}for(;;){var s=this.consumeCodePoint();if(s===_e||s===Ur)return{type:22,value:VA.apply(void 0,A)};if(Gs(s))return this.consumeWhiteSpace(),this.peekCodePoint(0)===_e||this.peekCodePoint(0)===Ur?(this.consumeCodePoint(),{type:22,value:VA.apply(void 0,A)}):(this.consumeBadUrlRemnants(),zs);if(s===Ns||s===Ks||s===Vs||Aw(s))return this.consumeBadUrlRemnants(),zs;if(s===Fr)if(st(s,this.peekCodePoint(0)))A.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),zs;else A.push(s)}},r.prototype.consumeWhiteSpace=function(){for(;Gs(this.peekCodePoint(0));)this.consumeCodePoint()},r.prototype.consumeBadUrlRemnants=function(){for(;;){var A=this.consumeCodePoint();if(A===Ur||A===_e)return;st(A,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},r.prototype.consumeStringSlice=function(A){for(var e=5e4,t="";A>0;){var s=Math.min(e,A);t+=VA.apply(void 0,this._value.splice(0,s)),A-=s}return this._value.shift(),t},r.prototype.consumeStringToken=function(A){var e="",t=0;do{var s=this._value[t];if(s===_e||s===void 0||s===A)return e+=this.consumeStringSlice(t),{type:0,value:e};if(s===_s)return this._value.splice(0,t),fw;if(s===Fr){var i=this._value[t+1];i!==_e&&i!==void 0&&(i===_s?(e+=this.consumeStringSlice(t),t=-1,this._value.shift()):st(s,i)&&(e+=this.consumeStringSlice(t),e+=VA(this.consumeEscapedCodePoint()),t=-1))}t++}while(!0)},r.prototype.consumeNumber=function(){var A=[],e=Qr,t=this.peekCodePoint(0);for((t===Qt||t===de)&&A.push(this.consumeCodePoint());re(this.peekCodePoint(0));)A.push(this.consumeCodePoint());t=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(t===Er&&re(s))for(A.push(this.consumeCodePoint(),this.consumeCodePoint()),e=Mc;re(this.peekCodePoint(0));)A.push(this.consumeCodePoint());t=this.peekCodePoint(0),s=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((t===Pc||t===Kc)&&((s===Qt||s===de)&&re(i)||re(s)))for(A.push(this.consumeCodePoint(),this.consumeCodePoint()),e=Mc;re(this.peekCodePoint(0));)A.push(this.consumeCodePoint());return[ew(A),e]},r.prototype.consumeNumericToken=function(){var A=this.consumeNumber(),e=A[0],t=A[1],s=this.peekCodePoint(0),i=this.peekCodePoint(1),n=this.peekCodePoint(2);if(Ws(s,i,n)){var o=this.consumeName();return{type:15,number:e,flags:t,unit:o}}return s===bp?(this.consumeCodePoint(),{type:16,number:e,flags:t}):{type:17,number:e,flags:t}},r.prototype.consumeEscapedCodePoint=function(){var A=this.consumeCodePoint();if(Kt(A)){for(var e=VA(A);Kt(this.peekCodePoint(0))&&e.length<6;)e+=VA(this.consumeCodePoint());Gs(this.peekCodePoint(0))&&this.consumeCodePoint();var t=parseInt(e,16);return t===0||Zp(t)||t>1114111?kc:t}return A===_e?kc:A},r.prototype.consumeName=function(){for(var A="";;){var e=this.consumeCodePoint();if(Rc(e))A+=VA(e);else if(st(e,this.peekCodePoint(0)))A+=VA(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(e),A}},r})(),zc=(function(){function r(A){this._tokens=A}return r.create=function(A){var e=new Wc;return e.write(A),new r(e.read())},r.parseValue=function(A){return r.create(A).parseComponentValue()},r.parseValues=function(A){return r.create(A).parseComponentValues()},r.prototype.parseComponentValue=function(){for(var A=this.consumeToken();A.type===31;)A=this.consumeToken();if(A.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(A);var e=this.consumeComponentValue();do A=this.consumeToken();while(A.type===31);if(A.type===32)return e;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},r.prototype.parseComponentValues=function(){for(var A=[];;){var e=this.consumeComponentValue();if(e.type===32)return A;A.push(e),A.push()}},r.prototype.consumeComponentValue=function(){var A=this.consumeToken();switch(A.type){case 11:case 28:case 2:return this.consumeSimpleBlock(A.type);case 19:return this.consumeFunction(A)}return A},r.prototype.consumeSimpleBlock=function(A){for(var e={type:A,values:[]},t=this.consumeToken();;){if(t.type===32||bw(t,A))return e;this.reconsumeToken(t),e.values.push(this.consumeComponentValue()),t=this.consumeToken()}},r.prototype.consumeFunction=function(A){for(var e={name:A.value,values:[],type:18};;){var t=this.consumeToken();if(t.type===32||t.type===3)return e;this.reconsumeToken(t),e.values.push(this.consumeComponentValue())}},r.prototype.consumeToken=function(){var A=this._tokens.shift();return typeof A>"u"?eo:A},r.prototype.reconsumeToken=function(A){this._tokens.unshift(A)},r})(),xr=function(r){return r.type===15},Vt=function(r){return r.type===17},SA=function(r){return r.type===20},vw=function(r){return r.type===0},to=function(r,A){return SA(r)&&r.value===A},Xc=function(r){return r.type!==31},Pt=function(r){return r.type!==31&&r.type!==4},Ne=function(r){var A=[],e=[];return r.forEach(function(t){if(t.type===4){if(e.length===0)throw new Error("Error parsing function args, zero tokens for arg");A.push(e),e=[];return}t.type!==31&&e.push(t)}),e.length&&A.push(e),A},bw=function(r,A){return A===11&&r.type===12||A===28&&r.type===29?!0:A===2&&r.type===3},it=function(r){return r.type===17||r.type===15},WA=function(r){return r.type===16||it(r)},Jc=function(r){return r.length>1?[r[0],r[1]]:[r[0]]},qA={type:17,number:0,flags:Qr},ro={type:16,number:50,flags:Qr},nt={type:16,number:100,flags:Qr},Sr=function(r,A,e){var t=r[0],s=r[1];return[LA(t,A),LA(typeof s<"u"?s:t,e)]},LA=function(r,A){if(r.type===16)return r.number/100*A;if(xr(r))switch(r.unit){case"rem":case"em":return 16*r.number;default:return r.number}return r.number},Zc="deg",Yc="grad",qc="rad",$c="turn",Xs={name:"angle",parse:function(r,A){if(A.type===15)switch(A.unit){case Zc:return Math.PI*A.number/180;case Yc:return Math.PI/200*A.number;case qc:return A.number;case $c:return Math.PI*2*A.number}throw new Error("Unsupported angle type")}},jc=function(r){return r.type===15&&(r.unit===Zc||r.unit===Yc||r.unit===qc||r.unit===$c)},Ah=function(r){var A=r.filter(SA).map(function(e){return e.value}).join(" ");switch(A){case"to bottom right":case"to right bottom":case"left top":case"top left":return[qA,qA];case"to top":case"bottom":return ve(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[qA,nt];case"to right":case"left":return ve(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[nt,nt];case"to bottom":case"top":return ve(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[nt,qA];case"to left":case"right":return ve(270)}return 0},ve=function(r){return Math.PI*r/180},ot={name:"color",parse:function(r,A){if(A.type===18){var e=Qw[A.name];if(typeof e>"u")throw new Error('Attempting to parse an unsupported color function "'+A.name+'"');return e(r,A.values)}if(A.type===5){if(A.value.length===3){var t=A.value.substring(0,1),s=A.value.substring(1,2),i=A.value.substring(2,3);return lt(parseInt(t+t,16),parseInt(s+s,16),parseInt(i+i,16),1)}if(A.value.length===4){var t=A.value.substring(0,1),s=A.value.substring(1,2),i=A.value.substring(2,3),n=A.value.substring(3,4);return lt(parseInt(t+t,16),parseInt(s+s,16),parseInt(i+i,16),parseInt(n+n,16)/255)}if(A.value.length===6){var t=A.value.substring(0,2),s=A.value.substring(2,4),i=A.value.substring(4,6);return lt(parseInt(t,16),parseInt(s,16),parseInt(i,16),1)}if(A.value.length===8){var t=A.value.substring(0,2),s=A.value.substring(2,4),i=A.value.substring(4,6),n=A.value.substring(6,8);return lt(parseInt(t,16),parseInt(s,16),parseInt(i,16),parseInt(n,16)/255)}}if(A.type===20){var o=qe[A.value.toUpperCase()];if(typeof o<"u")return o}return qe.TRANSPARENT}},at=function(r){return(255&r)===0},XA=function(r){var A=255&r,e=255&r>>8,t=255&r>>16,s=255&r>>24;return A<255?"rgba("+s+","+t+","+e+","+A/255+")":"rgb("+s+","+t+","+e+")"},lt=function(r,A,e,t){return(r<<24|A<<16|e<<8|Math.round(t*255)<<0)>>>0},eh=function(r,A){if(r.type===17)return r.number;if(r.type===16){var e=A===3?1:255;return A===3?r.number/100*e:Math.round(r.number/100*e)}return 0},th=function(r,A){var e=A.filter(Pt);if(e.length===3){var t=e.map(eh),s=t[0],i=t[1],n=t[2];return lt(s,i,n,1)}if(e.length===4){var o=e.map(eh),s=o[0],i=o[1],n=o[2],a=o[3];return lt(s,i,n,a)}return 0};function so(r,A,e){return e<0&&(e+=1),e>=1&&(e-=1),e<1/6?(A-r)*e*6+r:e<1/2?A:e<2/3?(A-r)*6*(2/3-e)+r:r}var rh=function(r,A){var e=A.filter(Pt),t=e[0],s=e[1],i=e[2],n=e[3],o=(t.type===17?ve(t.number):Xs.parse(r,t))/(Math.PI*2),a=WA(s)?s.number/100:0,l=WA(i)?i.number/100:0,c=typeof n<"u"&&WA(n)?LA(n,1):1;if(a===0)return lt(l*255,l*255,l*255,1);var u=l<=.5?l*(a+1):l+a-l*a,d=l*2-u,g=so(d,u,o+1/3),B=so(d,u,o),f=so(d,u,o-1/3);return lt(g*255,B*255,f*255,c)},Qw={hsl:rh,hsla:rh,rgb:th,rgba:th},Hr=function(r,A){return ot.parse(r,zc.create(A).parseComponentValue())},qe={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Fw={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(r,A){return A.map(function(e){if(SA(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},yw={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Js=function(r,A){var e=ot.parse(r,A[0]),t=A[1];return t&&WA(t)?{color:e,stop:t}:{color:e,stop:null}},sh=function(r,A){var e=r[0],t=r[r.length-1];e.stop===null&&(e.stop=qA),t.stop===null&&(t.stop=nt);for(var s=[],i=0,n=0;n<r.length;n++){var o=r[n].stop;if(o!==null){var a=LA(o,A);a>i?s.push(a):s.push(i),i=a}else s.push(null)}for(var l=null,n=0;n<s.length;n++){var c=s[n];if(c===null)l===null&&(l=n);else if(l!==null){for(var u=n-l,d=s[l-1],g=(c-d)/(u+1),B=1;B<=u;B++)s[l+B-1]=g*B;l=null}}return r.map(function(f,w){var m=f.color;return{color:m,stop:Math.max(Math.min(1,s[w]/A),0)}})},Uw=function(r,A,e){var t=A/2,s=e/2,i=LA(r[0],A)-t,n=s-LA(r[1],e);return(Math.atan2(n,i)+Math.PI*2)%(Math.PI*2)},Ew=function(r,A,e){var t=typeof r=="number"?r:Uw(r,A,e),s=Math.abs(A*Math.sin(t))+Math.abs(e*Math.cos(t)),i=A/2,n=e/2,o=s/2,a=Math.sin(t-Math.PI/2)*o,l=Math.cos(t-Math.PI/2)*o;return[s,i-l,i+l,n-a,n+a]},He=function(r,A){return Math.sqrt(r*r+A*A)},ih=function(r,A,e,t,s){var i=[[0,0],[0,A],[r,0],[r,A]];return i.reduce(function(n,o){var a=o[0],l=o[1],c=He(e-a,t-l);return(s?c<n.optimumDistance:c>n.optimumDistance)?{optimumCorner:o,optimumDistance:c}:n},{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},xw=function(r,A,e,t,s){var i=0,n=0;switch(r.size){case 0:r.shape===0?i=n=Math.min(Math.abs(A),Math.abs(A-t),Math.abs(e),Math.abs(e-s)):r.shape===1&&(i=Math.min(Math.abs(A),Math.abs(A-t)),n=Math.min(Math.abs(e),Math.abs(e-s)));break;case 2:if(r.shape===0)i=n=Math.min(He(A,e),He(A,e-s),He(A-t,e),He(A-t,e-s));else if(r.shape===1){var o=Math.min(Math.abs(e),Math.abs(e-s))/Math.min(Math.abs(A),Math.abs(A-t)),a=ih(t,s,A,e,!0),l=a[0],c=a[1];i=He(l-A,(c-e)/o),n=o*i}break;case 1:r.shape===0?i=n=Math.max(Math.abs(A),Math.abs(A-t),Math.abs(e),Math.abs(e-s)):r.shape===1&&(i=Math.max(Math.abs(A),Math.abs(A-t)),n=Math.max(Math.abs(e),Math.abs(e-s)));break;case 3:if(r.shape===0)i=n=Math.max(He(A,e),He(A,e-s),He(A-t,e),He(A-t,e-s));else if(r.shape===1){var o=Math.max(Math.abs(e),Math.abs(e-s))/Math.max(Math.abs(A),Math.abs(A-t)),u=ih(t,s,A,e,!1),l=u[0],c=u[1];i=He(l-A,(c-e)/o),n=o*i}break}return Array.isArray(r.size)&&(i=LA(r.size[0],t),n=r.size.length===2?LA(r.size[1],s):i),[i,n]},Sw=function(r,A){var e=ve(180),t=[];return Ne(A).forEach(function(s,i){if(i===0){var n=s[0];if(n.type===20&&n.value==="to"){e=Ah(s);return}else if(jc(n)){e=Xs.parse(r,n);return}}var o=Js(r,s);t.push(o)}),{angle:e,stops:t,type:1}},Zs=function(r,A){var e=ve(180),t=[];return Ne(A).forEach(function(s,i){if(i===0){var n=s[0];if(n.type===20&&["top","left","right","bottom"].indexOf(n.value)!==-1){e=Ah(s);return}else if(jc(n)){e=(Xs.parse(r,n)+ve(270))%ve(360);return}}var o=Js(r,s);t.push(o)}),{angle:e,stops:t,type:1}},Hw=function(r,A){var e=ve(180),t=[],s=1,i=0,n=3,o=[];return Ne(A).forEach(function(a,l){var c=a[0];if(l===0){if(SA(c)&&c.value==="linear"){s=1;return}else if(SA(c)&&c.value==="radial"){s=2;return}}if(c.type===18){if(c.name==="from"){var u=ot.parse(r,c.values[0]);t.push({stop:qA,color:u})}else if(c.name==="to"){var u=ot.parse(r,c.values[0]);t.push({stop:nt,color:u})}else if(c.name==="color-stop"){var d=c.values.filter(Pt);if(d.length===2){var u=ot.parse(r,d[1]),g=d[0];Vt(g)&&t.push({stop:{type:16,number:g.number*100,flags:g.flags},color:u})}}}}),s===1?{angle:(e+ve(180))%ve(360),stops:t,type:s}:{size:n,shape:i,stops:t,position:o,type:s}},nh="closest-side",oh="farthest-side",ah="closest-corner",lh="farthest-corner",ch="circle",hh="ellipse",uh="cover",fh="contain",Lw=function(r,A){var e=0,t=3,s=[],i=[];return Ne(A).forEach(function(n,o){var a=!0;if(o===0){var l=!1;a=n.reduce(function(u,d){if(l)if(SA(d))switch(d.value){case"center":return i.push(ro),u;case"top":case"left":return i.push(qA),u;case"right":case"bottom":return i.push(nt),u}else(WA(d)||it(d))&&i.push(d);else if(SA(d))switch(d.value){case ch:return e=0,!1;case hh:return e=1,!1;case"at":return l=!0,!1;case nh:return t=0,!1;case uh:case oh:return t=1,!1;case fh:case ah:return t=2,!1;case lh:return t=3,!1}else if(it(d)||WA(d))return Array.isArray(t)||(t=[]),t.push(d),!1;return u},a)}if(a){var c=Js(r,n);s.push(c)}}),{size:t,shape:e,stops:s,position:i,type:2}},Ys=function(r,A){var e=0,t=3,s=[],i=[];return Ne(A).forEach(function(n,o){var a=!0;if(o===0?a=n.reduce(function(c,u){if(SA(u))switch(u.value){case"center":return i.push(ro),!1;case"top":case"left":return i.push(qA),!1;case"right":case"bottom":return i.push(nt),!1}else if(WA(u)||it(u))return i.push(u),!1;return c},a):o===1&&(a=n.reduce(function(c,u){if(SA(u))switch(u.value){case ch:return e=0,!1;case hh:return e=1,!1;case fh:case nh:return t=0,!1;case oh:return t=1,!1;case ah:return t=2,!1;case uh:case lh:return t=3,!1}else if(it(u)||WA(u))return Array.isArray(t)||(t=[]),t.push(u),!1;return c},a)),a){var l=Js(r,n);s.push(l)}}),{size:t,shape:e,stops:s,position:i,type:2}},Iw=function(r){return r.type===1},Tw=function(r){return r.type===2},io={name:"image",parse:function(r,A){if(A.type===22){var e={url:A.value,type:0};return r.cache.addImage(A.value),e}if(A.type===18){var t=dh[A.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported image function "'+A.name+'"');return t(r,A.values)}throw new Error("Unsupported image type "+A.type)}};function Mw(r){return!(r.type===20&&r.value==="none")&&(r.type!==18||!!dh[r.name])}var dh={"linear-gradient":Sw,"-moz-linear-gradient":Zs,"-ms-linear-gradient":Zs,"-o-linear-gradient":Zs,"-webkit-linear-gradient":Zs,"radial-gradient":Lw,"-moz-radial-gradient":Ys,"-ms-radial-gradient":Ys,"-o-radial-gradient":Ys,"-webkit-radial-gradient":Ys,"-webkit-gradient":Hw},Dw={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(r,A){if(A.length===0)return[];var e=A[0];return e.type===20&&e.value==="none"?[]:A.filter(function(t){return Pt(t)&&Mw(t)}).map(function(t){return io.parse(r,t)})}},Ow={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(r,A){return A.map(function(e){if(SA(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},kw={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(r,A){return Ne(A).map(function(e){return e.filter(WA)}).map(Jc)}},_w={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(r,A){return Ne(A).map(function(e){return e.filter(SA).map(function(t){return t.value}).join(" ")}).map(Nw)}},Nw=function(r){switch(r){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}},Gt;(function(r){r.AUTO="auto",r.CONTAIN="contain",r.COVER="cover"})(Gt||(Gt={}));var Kw={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(r,A){return Ne(A).map(function(e){return e.filter(Vw)})}},Vw=function(r){return SA(r)||WA(r)},qs=function(r){return{name:"border-"+r+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Pw=qs("top"),Gw=qs("right"),Rw=qs("bottom"),Ww=qs("left"),$s=function(r){return{name:"border-radius-"+r,initialValue:"0 0",prefix:!1,type:1,parse:function(A,e){return Jc(e.filter(WA))}}},zw=$s("top-left"),Xw=$s("top-right"),Jw=$s("bottom-right"),Zw=$s("bottom-left"),js=function(r){return{name:"border-"+r+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(A,e){switch(e){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Yw=js("top"),qw=js("right"),$w=js("bottom"),jw=js("left"),Ai=function(r){return{name:"border-"+r+"-width",initialValue:"0",type:0,prefix:!1,parse:function(A,e){return xr(e)?e.number:0}}},A1=Ai("top"),e1=Ai("right"),t1=Ai("bottom"),r1=Ai("left"),s1={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},i1={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(r,A){return A==="rtl"?1:0}},n1={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(r,A){return A.filter(SA).reduce(function(e,t){return e|o1(t.value)},0)}},o1=function(r){switch(r){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},a1={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(r,A){switch(A){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},l1={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(r,A){return A.type===20&&A.value==="normal"?0:A.type===17||A.type===15?A.number:0}},ei;(function(r){r.NORMAL="normal",r.STRICT="strict"})(ei||(ei={}));var c1={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,A){return A==="strict"?ei.STRICT:ei.NORMAL}},h1={name:"line-height",initialValue:"normal",prefix:!1,type:4},Bh=function(r,A){return SA(r)&&r.value==="normal"?1.2*A:r.type===17?A*r.number:WA(r)?LA(r,A):A},u1={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(r,A){return A.type===20&&A.value==="none"?null:io.parse(r,A)}},f1={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(r,A){return A==="inside"?0:1}},no={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(r,A){switch(A){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},ti=function(r){return{name:"margin-"+r,initialValue:"0",prefix:!1,type:4}},d1=ti("top"),B1=ti("right"),g1=ti("bottom"),p1=ti("left"),w1={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(r,A){return A.filter(SA).map(function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},m1={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(r,A){return A==="break-word"?"break-word":"normal"}},ri=function(r){return{name:"padding-"+r,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},C1=ri("top"),v1=ri("right"),b1=ri("bottom"),Q1=ri("left"),F1={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(r,A){switch(A){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},y1={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(r,A){switch(A){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},U1={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,A){return A.length===1&&to(A[0],"none")?[]:Ne(A).map(function(e){for(var t={color:qe.TRANSPARENT,offsetX:qA,offsetY:qA,blur:qA},s=0,i=0;i<e.length;i++){var n=e[i];it(n)?(s===0?t.offsetX=n:s===1?t.offsetY=n:t.blur=n,s++):t.color=ot.parse(r,n)}return t})}},E1={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(r,A){switch(A){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},x1={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(r,A){if(A.type===20&&A.value==="none")return null;if(A.type===18){var e=L1[A.name];if(typeof e>"u")throw new Error('Attempting to parse an unsupported transform function "'+A.name+'"');return e(A.values)}return null}},S1=function(r){var A=r.filter(function(e){return e.type===17}).map(function(e){return e.number});return A.length===6?A:null},H1=function(r){var A=r.filter(function(a){return a.type===17}).map(function(a){return a.number}),e=A[0],t=A[1];A[2],A[3];var s=A[4],i=A[5];A[6],A[7],A[8],A[9],A[10],A[11];var n=A[12],o=A[13];return A[14],A[15],A.length===16?[e,t,s,i,n,o]:null},L1={matrix:S1,matrix3d:H1},gh={type:16,number:50,flags:Qr},I1=[gh,gh],T1={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(r,A){var e=A.filter(WA);return e.length!==2?I1:[e[0],e[1]]}},M1={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(r,A){switch(A){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Lr;(function(r){r.NORMAL="normal",r.BREAK_ALL="break-all",r.KEEP_ALL="keep-all"})(Lr||(Lr={}));for(var D1={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,A){switch(A){case"break-all":return Lr.BREAK_ALL;case"keep-all":return Lr.KEEP_ALL;default:return Lr.NORMAL}}},O1={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(r,A){if(A.type===20)return{auto:!0,order:0};if(Vt(A))return{auto:!1,order:A.number};throw new Error("Invalid z-index number parsed")}},ph={name:"time",parse:function(r,A){if(A.type===15)switch(A.unit.toLowerCase()){case"s":return 1e3*A.number;case"ms":return A.number}throw new Error("Unsupported time type")}},k1={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(r,A){return Vt(A)?A.number:1}},_1={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},N1={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(r,A){return A.filter(SA).map(function(e){switch(e.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(e){return e!==0})}},K1={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(r,A){var e=[],t=[];return A.forEach(function(s){switch(s.type){case 20:case 0:e.push(s.value);break;case 17:e.push(s.number.toString());break;case 4:t.push(e.join(" ")),e.length=0;break}}),e.length&&t.push(e.join(" ")),t.map(function(s){return s.indexOf(" ")===-1?s:"'"+s+"'"})}},V1={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},P1={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(r,A){return Vt(A)?A.number:SA(A)&&A.value==="bold"?700:400}},G1={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(r,A){return A.filter(SA).map(function(e){return e.value})}},R1={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(r,A){switch(A){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},zA=function(r,A){return(r&A)!==0},W1={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(r,A){if(A.length===0)return[];var e=A[0];return e.type===20&&e.value==="none"?[]:A}},z1={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(r,A){if(A.length===0)return null;var e=A[0];if(e.type===20&&e.value==="none")return null;for(var t=[],s=A.filter(Xc),i=0;i<s.length;i++){var n=s[i],o=s[i+1];if(n.type===20){var a=o&&Vt(o)?o.number:1;t.push({counter:n.value,increment:a})}}return t}},X1={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(r,A){if(A.length===0)return[];for(var e=[],t=A.filter(Xc),s=0;s<t.length;s++){var i=t[s],n=t[s+1];if(SA(i)&&i.value!=="none"){var o=n&&Vt(n)?n.number:0;e.push({counter:i.value,reset:o})}}return e}},J1={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(r,A){return A.filter(xr).map(function(e){return ph.parse(r,e)})}},Z1={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(r,A){if(A.length===0)return null;var e=A[0];if(e.type===20&&e.value==="none")return null;var t=[],s=A.filter(vw);if(s.length%2!==0)return null;for(var i=0;i<s.length;i+=2){var n=s[i].value,o=s[i+1].value;t.push({open:n,close:o})}return t}},wh=function(r,A,e){if(!r)return"";var t=r[Math.min(A,r.length-1)];return t?e?t.open:t.close:""},Y1={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,A){return A.length===1&&to(A[0],"none")?[]:Ne(A).map(function(e){for(var t={color:255,offsetX:qA,offsetY:qA,blur:qA,spread:qA,inset:!1},s=0,i=0;i<e.length;i++){var n=e[i];to(n,"inset")?t.inset=!0:it(n)?(s===0?t.offsetX=n:s===1?t.offsetY=n:s===2?t.blur=n:t.spread=n,s++):t.color=ot.parse(r,n)}return t})}},q1={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(r,A){var e=[0,1,2],t=[];return A.filter(SA).forEach(function(s){switch(s.value){case"stroke":t.push(1);break;case"fill":t.push(0);break;case"markers":t.push(2);break}}),e.forEach(function(s){t.indexOf(s)===-1&&t.push(s)}),t}},$1={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},j1={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(r,A){return xr(A)?A.number:0}},Am=(function(){function r(A,e){var t,s;this.animationDuration=G(A,J1,e.animationDuration),this.backgroundClip=G(A,Fw,e.backgroundClip),this.backgroundColor=G(A,yw,e.backgroundColor),this.backgroundImage=G(A,Dw,e.backgroundImage),this.backgroundOrigin=G(A,Ow,e.backgroundOrigin),this.backgroundPosition=G(A,kw,e.backgroundPosition),this.backgroundRepeat=G(A,_w,e.backgroundRepeat),this.backgroundSize=G(A,Kw,e.backgroundSize),this.borderTopColor=G(A,Pw,e.borderTopColor),this.borderRightColor=G(A,Gw,e.borderRightColor),this.borderBottomColor=G(A,Rw,e.borderBottomColor),this.borderLeftColor=G(A,Ww,e.borderLeftColor),this.borderTopLeftRadius=G(A,zw,e.borderTopLeftRadius),this.borderTopRightRadius=G(A,Xw,e.borderTopRightRadius),this.borderBottomRightRadius=G(A,Jw,e.borderBottomRightRadius),this.borderBottomLeftRadius=G(A,Zw,e.borderBottomLeftRadius),this.borderTopStyle=G(A,Yw,e.borderTopStyle),this.borderRightStyle=G(A,qw,e.borderRightStyle),this.borderBottomStyle=G(A,$w,e.borderBottomStyle),this.borderLeftStyle=G(A,jw,e.borderLeftStyle),this.borderTopWidth=G(A,A1,e.borderTopWidth),this.borderRightWidth=G(A,e1,e.borderRightWidth),this.borderBottomWidth=G(A,t1,e.borderBottomWidth),this.borderLeftWidth=G(A,r1,e.borderLeftWidth),this.boxShadow=G(A,Y1,e.boxShadow),this.color=G(A,s1,e.color),this.direction=G(A,i1,e.direction),this.display=G(A,n1,e.display),this.float=G(A,a1,e.cssFloat),this.fontFamily=G(A,K1,e.fontFamily),this.fontSize=G(A,V1,e.fontSize),this.fontStyle=G(A,R1,e.fontStyle),this.fontVariant=G(A,G1,e.fontVariant),this.fontWeight=G(A,P1,e.fontWeight),this.letterSpacing=G(A,l1,e.letterSpacing),this.lineBreak=G(A,c1,e.lineBreak),this.lineHeight=G(A,h1,e.lineHeight),this.listStyleImage=G(A,u1,e.listStyleImage),this.listStylePosition=G(A,f1,e.listStylePosition),this.listStyleType=G(A,no,e.listStyleType),this.marginTop=G(A,d1,e.marginTop),this.marginRight=G(A,B1,e.marginRight),this.marginBottom=G(A,g1,e.marginBottom),this.marginLeft=G(A,p1,e.marginLeft),this.opacity=G(A,k1,e.opacity);var i=G(A,w1,e.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=G(A,m1,e.overflowWrap),this.paddingTop=G(A,C1,e.paddingTop),this.paddingRight=G(A,v1,e.paddingRight),this.paddingBottom=G(A,b1,e.paddingBottom),this.paddingLeft=G(A,Q1,e.paddingLeft),this.paintOrder=G(A,q1,e.paintOrder),this.position=G(A,y1,e.position),this.textAlign=G(A,F1,e.textAlign),this.textDecorationColor=G(A,_1,(t=e.textDecorationColor)!==null&&t!==void 0?t:e.color),this.textDecorationLine=G(A,N1,(s=e.textDecorationLine)!==null&&s!==void 0?s:e.textDecoration),this.textShadow=G(A,U1,e.textShadow),this.textTransform=G(A,E1,e.textTransform),this.transform=G(A,x1,e.transform),this.transformOrigin=G(A,T1,e.transformOrigin),this.visibility=G(A,M1,e.visibility),this.webkitTextStrokeColor=G(A,$1,e.webkitTextStrokeColor),this.webkitTextStrokeWidth=G(A,j1,e.webkitTextStrokeWidth),this.wordBreak=G(A,D1,e.wordBreak),this.zIndex=G(A,O1,e.zIndex)}return r.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},r.prototype.isTransparent=function(){return at(this.backgroundColor)},r.prototype.isTransformed=function(){return this.transform!==null},r.prototype.isPositioned=function(){return this.position!==0},r.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},r.prototype.isFloating=function(){return this.float!==0},r.prototype.isInlineLevel=function(){return zA(this.display,4)||zA(this.display,33554432)||zA(this.display,268435456)||zA(this.display,536870912)||zA(this.display,67108864)||zA(this.display,134217728)},r})(),em=(function(){function r(A,e){this.content=G(A,W1,e.content),this.quotes=G(A,Z1,e.quotes)}return r})(),mh=(function(){function r(A,e){this.counterIncrement=G(A,z1,e.counterIncrement),this.counterReset=G(A,X1,e.counterReset)}return r})(),G=function(r,A,e){var t=new Wc,s=e!==null&&typeof e<"u"?e.toString():A.initialValue;t.write(s);var i=new zc(t.read());switch(A.type){case 2:var n=i.parseComponentValue();return A.parse(r,SA(n)?n.value:A.initialValue);case 0:return A.parse(r,i.parseComponentValue());case 1:return A.parse(r,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(A.format){case"angle":return Xs.parse(r,i.parseComponentValue());case"color":return ot.parse(r,i.parseComponentValue());case"image":return io.parse(r,i.parseComponentValue());case"length":var o=i.parseComponentValue();return it(o)?o:qA;case"length-percentage":var a=i.parseComponentValue();return WA(a)?a:qA;case"time":return ph.parse(r,i.parseComponentValue())}break}},tm="data-html2canvas-debug",rm=function(r){var A=r.getAttribute(tm);switch(A){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},oo=function(r,A){var e=rm(r);return e===1||A===e},Ke=(function(){function r(A,e){if(this.context=A,this.textNodes=[],this.elements=[],this.flags=0,oo(e,3))debugger;this.styles=new Am(A,window.getComputedStyle(e,null)),bo(e)&&(this.styles.animationDuration.some(function(t){return t>0})&&(e.style.animationDuration="0s"),this.styles.transform!==null&&(e.style.transform="none")),this.bounds=Es(this.context,e),oo(e,4)&&(this.flags|=16)}return r})(),sm="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ir=typeof Uint8Array>"u"?[]:new Uint8Array(256),si=0;si<Ch.length;si++)Ir[Ch.charCodeAt(si)]=si;for(var im=function(r){var A=r.length*.75,e=r.length,t,s=0,i,n,o,a;r[r.length-1]==="="&&(A--,r[r.length-2]==="="&&A--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(A):new Array(A),c=Array.isArray(l)?l:new Uint8Array(l);for(t=0;t<e;t+=4)i=Ir[r.charCodeAt(t)],n=Ir[r.charCodeAt(t+1)],o=Ir[r.charCodeAt(t+2)],a=Ir[r.charCodeAt(t+3)],c[s++]=i<<2|n>>4,c[s++]=(n&15)<<4|o>>2,c[s++]=(o&3)<<6|a&63;return l},nm=function(r){for(var A=r.length,e=[],t=0;t<A;t+=2)e.push(r[t+1]<<8|r[t]);return e},om=function(r){for(var A=r.length,e=[],t=0;t<A;t+=4)e.push(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]);return e},Ft=5,ao=11,lo=2,am=ao-Ft,vh=65536>>Ft,lm=1<<Ft,co=lm-1,cm=1024>>Ft,hm=vh+cm,um=hm,fm=32,dm=um+fm,Bm=65536>>ao,gm=1<<am,pm=gm-1,bh=function(r,A,e){return r.slice?r.slice(A,e):new Uint16Array(Array.prototype.slice.call(r,A,e))},wm=function(r,A,e){return r.slice?r.slice(A,e):new Uint32Array(Array.prototype.slice.call(r,A,e))},mm=function(r,A){var e=im(r),t=Array.isArray(e)?om(e):new Uint32Array(e),s=Array.isArray(e)?nm(e):new Uint16Array(e),i=24,n=bh(s,i/2,t[4]/2),o=t[5]===2?bh(s,(i+t[4])/2):wm(t,Math.ceil((i+t[4])/4));return new Cm(t[0],t[1],t[2],t[3],n,o)},Cm=(function(){function r(A,e,t,s,i,n){this.initialValue=A,this.errorValue=e,this.highStart=t,this.highValueIndex=s,this.index=i,this.data=n}return r.prototype.get=function(A){var e;if(A>=0){if(A<55296||A>56319&&A<=65535)return e=this.index[A>>Ft],e=(e<<lo)+(A&co),this.data[e];if(A<=65535)return e=this.index[vh+(A-55296>>Ft)],e=(e<<lo)+(A&co),this.data[e];if(A<this.highStart)return e=dm-Bm+(A>>ao),e=this.index[e],e+=A>>Ft&pm,e=this.index[e],e=(e<<lo)+(A&co),this.data[e];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),Qh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vm=typeof Uint8Array>"u"?[]:new Uint8Array(256),ii=0;ii<Qh.length;ii++)vm[Qh.charCodeAt(ii)]=ii;var bm=1,ho=2,uo=3,Fh=4,yh=5,Qm=7,Uh=8,fo=9,Bo=10,Eh=11,xh=12,Sh=13,Hh=14,go=15,Fm=function(r){for(var A=[],e=0,t=r.length;e<t;){var s=r.charCodeAt(e++);if(s>=55296&&s<=56319&&e<t){var i=r.charCodeAt(e++);(i&64512)===56320?A.push(((s&1023)<<10)+(i&1023)+65536):(A.push(s),e--)}else A.push(s)}return A},ym=function(){for(var r=[],A=0;A<arguments.length;A++)r[A]=arguments[A];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var e=r.length;if(!e)return"";for(var t=[],s=-1,i="";++s<e;){var n=r[s];n<=65535?t.push(n):(n-=65536,t.push((n>>10)+55296,n%1024+56320)),(s+1===e||t.length>16384)&&(i+=String.fromCharCode.apply(String,t),t.length=0)}return i},Um=mm(sm),be="×",po="÷",Em=function(r){return Um.get(r)},xm=function(r,A,e){var t=e-2,s=A[t],i=A[e-1],n=A[e];if(i===ho&&n===uo)return be;if(i===ho||i===uo||i===Fh||n===ho||n===uo||n===Fh)return po;if(i===Uh&&[Uh,fo,Eh,xh].indexOf(n)!==-1||(i===Eh||i===fo)&&(n===fo||n===Bo)||(i===xh||i===Bo)&&n===Bo||n===Sh||n===yh||n===Qm||i===bm)return be;if(i===Sh&&n===Hh){for(;s===yh;)s=A[--t];if(s===Hh)return be}if(i===go&&n===go){for(var o=0;s===go;)o++,s=A[--t];if(o%2===0)return be}return po},Sm=function(r){var A=Fm(r),e=A.length,t=0,s=0,i=A.map(Em);return{next:function(){if(t>=e)return{done:!0,value:null};for(var n=be;t<e&&(n=xm(A,i,++t))===be;);if(n!==be||t===e){var o=ym.apply(null,A.slice(s,t));return s=t,{value:o,done:!1}}return{done:!0,value:null}}}},Hm=function(r){for(var A=Sm(r),e=[],t;!(t=A.next()).done;)t.value&&e.push(t.value.slice());return e},Lm=function(r){var A=123;if(r.createRange){var e=r.createRange();if(e.getBoundingClientRect){var t=r.createElement("boundtest");t.style.height=A+"px",t.style.display="block",r.body.appendChild(t),e.selectNode(t);var s=e.getBoundingClientRect(),i=Math.round(s.height);if(r.body.removeChild(t),i===A)return!0}}return!1},Im=function(r){var A=r.createElement("boundtest");A.style.width="50px",A.style.display="block",A.style.fontSize="12px",A.style.letterSpacing="0px",A.style.wordSpacing="0px",r.body.appendChild(A);var e=r.createRange();A.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var t=A.firstChild,s=xs(t.data).map(function(a){return VA(a)}),i=0,n={},o=s.every(function(a,l){e.setStart(t,i),e.setEnd(t,i+a.length);var c=e.getBoundingClientRect();i+=a.length;var u=c.x>n.x||c.y>n.y;return n=c,l===0?!0:u});return r.body.removeChild(A),o},Tm=function(){return typeof new Image().crossOrigin<"u"},Mm=function(){return typeof new XMLHttpRequest().responseType=="string"},Dm=function(r){var A=new Image,e=r.createElement("canvas"),t=e.getContext("2d");if(!t)return!1;A.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{t.drawImage(A,0,0),e.toDataURL()}catch{return!1}return!0},Lh=function(r){return r[0]===0&&r[1]===255&&r[2]===0&&r[3]===255},Om=function(r){var A=r.createElement("canvas"),e=100;A.width=e,A.height=e;var t=A.getContext("2d");if(!t)return Promise.reject(!1);t.fillStyle="rgb(0, 255, 0)",t.fillRect(0,0,e,e);var s=new Image,i=A.toDataURL();s.src=i;var n=wo(e,e,0,0,s);return t.fillStyle="red",t.fillRect(0,0,e,e),Ih(n).then(function(o){t.drawImage(o,0,0);var a=t.getImageData(0,0,e,e).data;t.fillStyle="red",t.fillRect(0,0,e,e);var l=r.createElement("div");return l.style.backgroundImage="url("+i+")",l.style.height=e+"px",Lh(a)?Ih(wo(e,e,0,0,l)):Promise.reject(!1)}).then(function(o){return t.drawImage(o,0,0),Lh(t.getImageData(0,0,e,e).data)}).catch(function(){return!1})},wo=function(r,A,e,t,s){var i="http://www.w3.org/2000/svg",n=document.createElementNS(i,"svg"),o=document.createElementNS(i,"foreignObject");return n.setAttributeNS(null,"width",r.toString()),n.setAttributeNS(null,"height",A.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",e.toString()),o.setAttributeNS(null,"y",t.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),n.appendChild(o),o.appendChild(s),n},Ih=function(r){return new Promise(function(A,e){var t=new Image;t.onload=function(){return A(t)},t.onerror=e,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},$A={get SUPPORT_RANGE_BOUNDS(){var r=Lm(document);return Object.defineProperty($A,"SUPPORT_RANGE_BOUNDS",{value:r}),r},get SUPPORT_WORD_BREAKING(){var r=$A.SUPPORT_RANGE_BOUNDS&&Im(document);return Object.defineProperty($A,"SUPPORT_WORD_BREAKING",{value:r}),r},get SUPPORT_SVG_DRAWING(){var r=Dm(document);return Object.defineProperty($A,"SUPPORT_SVG_DRAWING",{value:r}),r},get SUPPORT_FOREIGNOBJECT_DRAWING(){var r=typeof Array.from=="function"&&typeof window.fetch=="function"?Om(document):Promise.resolve(!1);return Object.defineProperty($A,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:r}),r},get SUPPORT_CORS_IMAGES(){var r=Tm();return Object.defineProperty($A,"SUPPORT_CORS_IMAGES",{value:r}),r},get SUPPORT_RESPONSE_TYPE(){var r=Mm();return Object.defineProperty($A,"SUPPORT_RESPONSE_TYPE",{value:r}),r},get SUPPORT_CORS_XHR(){var r="withCredentials"in new XMLHttpRequest;return Object.defineProperty($A,"SUPPORT_CORS_XHR",{value:r}),r},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var r=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty($A,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:r}),r}},Tr=(function(){function r(A,e){this.text=A,this.bounds=e}return r})(),km=function(r,A,e,t){var s=Km(A,e),i=[],n=0;return s.forEach(function(o){if(e.textDecorationLine.length||o.trim().length>0)if($A.SUPPORT_RANGE_BOUNDS){var a=Th(t,n,o.length).getClientRects();if(a.length>1){var l=mo(o),c=0;l.forEach(function(d){i.push(new Tr(d,Ze.fromDOMRectList(r,Th(t,c+n,d.length).getClientRects()))),c+=d.length})}else i.push(new Tr(o,Ze.fromDOMRectList(r,a)))}else{var u=t.splitText(o.length);i.push(new Tr(o,_m(r,t))),t=u}else $A.SUPPORT_RANGE_BOUNDS||(t=t.splitText(o.length));n+=o.length}),i},_m=function(r,A){var e=A.ownerDocument;if(e){var t=e.createElement("html2canvaswrapper");t.appendChild(A.cloneNode(!0));var s=A.parentNode;if(s){s.replaceChild(t,A);var i=Es(r,t);return t.firstChild&&s.replaceChild(t.firstChild,t),i}}return Ze.EMPTY},Th=function(r,A,e){var t=r.ownerDocument;if(!t)throw new Error("Node has no owner document");var s=t.createRange();return s.setStart(r,A),s.setEnd(r,A+e),s},mo=function(r){if($A.SUPPORT_NATIVE_TEXT_SEGMENTATION){var A=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(A.segment(r)).map(function(e){return e.segment})}return Hm(r)},Nm=function(r,A){if($A.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(e.segment(r)).map(function(t){return t.segment})}return Pm(r,A)},Km=function(r,A){return A.letterSpacing!==0?mo(r):Nm(r,A)},Vm=[32,160,4961,65792,65793,4153,4241],Pm=function(r,A){for(var e=Bp(r,{lineBreak:A.lineBreak,wordBreak:A.overflowWrap==="break-word"?"break-word":A.wordBreak}),t=[],s,i=function(){if(s.value){var n=s.value.slice(),o=xs(n),a="";o.forEach(function(l){Vm.indexOf(l)===-1?a+=VA(l):(a.length&&t.push(a),t.push(VA(l)),a="")}),a.length&&t.push(a)}};!(s=e.next()).done;)i();return t},Gm=(function(){function r(A,e,t){this.text=Rm(e.data,t.textTransform),this.textBounds=km(A,this.text,t,e)}return r})(),Rm=function(r,A){switch(A){case 1:return r.toLowerCase();case 3:return r.replace(Wm,zm);case 2:return r.toUpperCase();default:return r}},Wm=/(^|\s|:|-|\(|\))([a-z])/g,zm=function(r,A,e){return r.length>0?A+e.toUpperCase():r},Mh=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;return s.src=t.currentSrc||t.src,s.intrinsicWidth=t.naturalWidth,s.intrinsicHeight=t.naturalHeight,s.context.cache.addImage(s.src),s}return A})(Ke),Dh=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;return s.canvas=t,s.intrinsicWidth=t.width,s.intrinsicHeight=t.height,s}return A})(Ke),Oh=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this,i=new XMLSerializer,n=Es(e,t);return t.setAttribute("width",n.width+"px"),t.setAttribute("height",n.height+"px"),s.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(t)),s.intrinsicWidth=t.width.baseVal.value,s.intrinsicHeight=t.height.baseVal.value,s.context.cache.addImage(s.svg),s}return A})(Ke),kh=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;return s.value=t.value,s}return A})(Ke),Co=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;return s.start=t.start,s.reversed=typeof t.reversed=="boolean"&&t.reversed===!0,s}return A})(Ke),Xm=[{type:15,flags:0,unit:"px",number:3}],Jm=[{type:16,flags:0,number:50}],Zm=function(r){return r.width>r.height?new Ze(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width<r.height?new Ze(r.left,r.top+(r.height-r.width)/2,r.width,r.width):r},Ym=function(r){var A=r.type===qm?new Array(r.value.length+1).join("•"):r.value;return A.length===0?r.placeholder||"":A},ni="checkbox",oi="radio",qm="password",_h=707406591,vo=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;switch(s.type=t.type.toLowerCase(),s.checked=t.checked,s.value=Ym(t),(s.type===ni||s.type===oi)&&(s.styles.backgroundColor=3739148031,s.styles.borderTopColor=s.styles.borderRightColor=s.styles.borderBottomColor=s.styles.borderLeftColor=2779096575,s.styles.borderTopWidth=s.styles.borderRightWidth=s.styles.borderBottomWidth=s.styles.borderLeftWidth=1,s.styles.borderTopStyle=s.styles.borderRightStyle=s.styles.borderBottomStyle=s.styles.borderLeftStyle=1,s.styles.backgroundClip=[0],s.styles.backgroundOrigin=[0],s.bounds=Zm(s.bounds)),s.type){case ni:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=Xm;break;case oi:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=Jm;break}return s}return A})(Ke),Nh=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this,i=t.options[t.selectedIndex||0];return s.value=i&&i.text||"",s}return A})(Ke),Kh=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;return s.value=t.value,s}return A})(Ke),Vh=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;s.src=t.src,s.width=parseInt(t.width,10)||0,s.height=parseInt(t.height,10)||0,s.backgroundColor=s.styles.backgroundColor;try{if(t.contentWindow&&t.contentWindow.document&&t.contentWindow.document.documentElement){s.tree=Gh(e,t.contentWindow.document.documentElement);var i=t.contentWindow.document.documentElement?Hr(e,getComputedStyle(t.contentWindow.document.documentElement).backgroundColor):qe.TRANSPARENT,n=t.contentWindow.document.body?Hr(e,getComputedStyle(t.contentWindow.document.body).backgroundColor):qe.TRANSPARENT;s.backgroundColor=at(i)?at(n)?s.styles.backgroundColor:n:i}}catch{}return s}return A})(Ke),$m=["OL","UL","MENU"],ai=function(r,A,e,t){for(var s=A.firstChild,i=void 0;s;s=i)if(i=s.nextSibling,Rh(s)&&s.data.trim().length>0)e.textNodes.push(new Gm(r,s,e.styles));else if(Rt(s))if(Yh(s)&&s.assignedNodes)s.assignedNodes().forEach(function(o){return ai(r,o,e,t)});else{var n=Ph(r,s);n.styles.isVisible()&&(jm(s,n,t)?n.flags|=4:AC(n.styles)&&(n.flags|=2),$m.indexOf(s.tagName)!==-1&&(n.flags|=8),e.elements.push(n),s.slot,s.shadowRoot?ai(r,s.shadowRoot,n,t):!ci(s)&&!Wh(s)&&!hi(s)&&ai(r,s,n,t))}},Ph=function(r,A){return Fo(A)?new Mh(r,A):zh(A)?new Dh(r,A):Wh(A)?new Oh(r,A):eC(A)?new kh(r,A):tC(A)?new Co(r,A):rC(A)?new vo(r,A):hi(A)?new Nh(r,A):ci(A)?new Kh(r,A):Jh(A)?new Vh(r,A):new Ke(r,A)},Gh=function(r,A){var e=Ph(r,A);return e.flags|=4,ai(r,A,e,e),e},jm=function(r,A,e){return A.styles.isPositionedWithZIndex()||A.styles.opacity<1||A.styles.isTransformed()||Qo(r)&&e.styles.isTransparent()},AC=function(r){return r.isPositioned()||r.isFloating()},Rh=function(r){return r.nodeType===Node.TEXT_NODE},Rt=function(r){return r.nodeType===Node.ELEMENT_NODE},bo=function(r){return Rt(r)&&typeof r.style<"u"&&!li(r)},li=function(r){return typeof r.className=="object"},eC=function(r){return r.tagName==="LI"},tC=function(r){return r.tagName==="OL"},rC=function(r){return r.tagName==="INPUT"},sC=function(r){return r.tagName==="HTML"},Wh=function(r){return r.tagName==="svg"},Qo=function(r){return r.tagName==="BODY"},zh=function(r){return r.tagName==="CANVAS"},Xh=function(r){return r.tagName==="VIDEO"},Fo=function(r){return r.tagName==="IMG"},Jh=function(r){return r.tagName==="IFRAME"},Zh=function(r){return r.tagName==="STYLE"},iC=function(r){return r.tagName==="SCRIPT"},ci=function(r){return r.tagName==="TEXTAREA"},hi=function(r){return r.tagName==="SELECT"},Yh=function(r){return r.tagName==="SLOT"},qh=function(r){return r.tagName.indexOf("-")>0},nC=(function(){function r(){this.counters={}}return r.prototype.getCounterValue=function(A){var e=this.counters[A];return e&&e.length?e[e.length-1]:1},r.prototype.getCounterValues=function(A){var e=this.counters[A];return e||[]},r.prototype.pop=function(A){var e=this;A.forEach(function(t){return e.counters[t].pop()})},r.prototype.parse=function(A){var e=this,t=A.counterIncrement,s=A.counterReset,i=!0;t!==null&&t.forEach(function(o){var a=e.counters[o.counter];a&&o.increment!==0&&(i=!1,a.length||a.push(1),a[Math.max(0,a.length-1)]+=o.increment)});var n=[];return i&&s.forEach(function(o){var a=e.counters[o.counter];n.push(o.counter),a||(a=e.counters[o.counter]=[]),a.push(o.reset)}),n},r})(),$h={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},jh={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},oC={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},aC={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Wt=function(r,A,e,t,s,i){return r<A||r>e?Dr(r,s,i.length>0):t.integers.reduce(function(n,o,a){for(;r>=o;)r-=o,n+=t.values[a];return n},"")+i},Au=function(r,A,e,t){var s="";do e||r--,s=t(r)+s,r/=A;while(r*A>=A);return s},PA=function(r,A,e,t,s){var i=e-A+1;return(r<0?"-":"")+(Au(Math.abs(r),i,t,function(n){return VA(Math.floor(n%i)+A)})+s)},yt=function(r,A,e){e===void 0&&(e=". ");var t=A.length;return Au(Math.abs(r),t,!1,function(s){return A[Math.floor(s%t)]})+e},zt=1,ct=2,ht=4,Mr=8,$e=function(r,A,e,t,s,i){if(r<-9999||r>9999)return Dr(r,4,s.length>0);var n=Math.abs(r),o=s;if(n===0)return A[0]+o;for(var a=0;n>0&&a<=4;a++){var l=n%10;l===0&&zA(i,zt)&&o!==""?o=A[l]+o:l>1||l===1&&a===0||l===1&&a===1&&zA(i,ct)||l===1&&a===1&&zA(i,ht)&&r>100||l===1&&a>1&&zA(i,Mr)?o=A[l]+(a>0?e[a-1]:"")+o:l===1&&a>0&&(o=e[a-1]+o),n=Math.floor(n/10)}return(r<0?t:"")+o},eu="十百千萬",tu="拾佰仟萬",ru="マイナス",yo="마이너스",Dr=function(r,A,e){var t=e?". ":"",s=e?"、":"",i=e?", ":"",n=e?" ":"";switch(A){case 0:return"•"+n;case 1:return"◦"+n;case 2:return"◾"+n;case 5:var o=PA(r,48,57,!0,t);return o.length<4?"0"+o:o;case 4:return yt(r,"〇一二三四五六七八九",s);case 6:return Wt(r,1,3999,$h,3,t).toLowerCase();case 7:return Wt(r,1,3999,$h,3,t);case 8:return PA(r,945,969,!1,t);case 9:return PA(r,97,122,!1,t);case 10:return PA(r,65,90,!1,t);case 11:return PA(r,1632,1641,!0,t);case 12:case 49:return Wt(r,1,9999,jh,3,t);case 35:return Wt(r,1,9999,jh,3,t).toLowerCase();case 13:return PA(r,2534,2543,!0,t);case 14:case 30:return PA(r,6112,6121,!0,t);case 15:return yt(r,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return yt(r,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return $e(r,"零一二三四五六七八九",eu,"負",s,ct|ht|Mr);case 47:return $e(r,"零壹貳參肆伍陸柒捌玖",tu,"負",s,zt|ct|ht|Mr);case 42:return $e(r,"零一二三四五六七八九",eu,"负",s,ct|ht|Mr);case 41:return $e(r,"零壹贰叁肆伍陆柒捌玖",tu,"负",s,zt|ct|ht|Mr);case 26:return $e(r,"〇一二三四五六七八九","十百千万",ru,s,0);case 25:return $e(r,"零壱弐参四伍六七八九","拾百千万",ru,s,zt|ct|ht);case 31:return $e(r,"영일이삼사오육칠팔구","십백천만",yo,i,zt|ct|ht);case 33:return $e(r,"零一二三四五六七八九","十百千萬",yo,i,0);case 32:return $e(r,"零壹貳參四五六七八九","拾百千",yo,i,zt|ct|ht);case 18:return PA(r,2406,2415,!0,t);case 20:return Wt(r,1,19999,aC,3,t);case 21:return PA(r,2790,2799,!0,t);case 22:return PA(r,2662,2671,!0,t);case 22:return Wt(r,1,10999,oC,3,t);case 23:return yt(r,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return yt(r,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return PA(r,3302,3311,!0,t);case 28:return yt(r,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return yt(r,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return PA(r,3792,3801,!0,t);case 37:return PA(r,6160,6169,!0,t);case 38:return PA(r,4160,4169,!0,t);case 39:return PA(r,2918,2927,!0,t);case 40:return PA(r,1776,1785,!0,t);case 43:return PA(r,3046,3055,!0,t);case 44:return PA(r,3174,3183,!0,t);case 45:return PA(r,3664,3673,!0,t);case 46:return PA(r,3872,3881,!0,t);default:return PA(r,48,57,!0,t)}},su="data-html2canvas-ignore",iu=(function(){function r(A,e,t){if(this.context=A,this.options=t,this.scrolledElements=[],this.referenceElement=e,this.counters=new nC,this.quoteDepth=0,!e.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(e.ownerDocument.documentElement,!1)}return r.prototype.toIFrame=function(A,e){var t=this,s=lC(A,e);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var i=A.defaultView.pageXOffset,n=A.defaultView.pageYOffset,o=s.contentWindow,a=o.document,l=uC(s).then(function(){return oe(t,void 0,void 0,function(){var c,u;return te(this,function(d){switch(d.label){case 0:return this.scrolledElements.forEach(gC),o&&(o.scrollTo(e.left,e.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==e.top||o.scrollX!==e.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-e.left,o.scrollY-e.top,0,0))),c=this.options.onclone,u=this.clonedReferenceElement,typeof u>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:d.sent(),d.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,hC(a)]:[3,4];case 3:d.sent(),d.label=4;case 4:return typeof c=="function"?[2,Promise.resolve().then(function(){return c(a,u)}).then(function(){return s})]:[2,s]}})})});return a.open(),a.write(dC(document.doctype)+"<html></html>"),BC(this.referenceElement.ownerDocument,i,n),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),l},r.prototype.createElementClone=function(A){if(oo(A,2))debugger;if(zh(A))return this.createCanvasClone(A);if(Xh(A))return this.createVideoClone(A);if(Zh(A))return this.createStyleClone(A);var e=A.cloneNode(!1);return Fo(e)&&(Fo(A)&&A.currentSrc&&A.currentSrc!==A.src&&(e.src=A.currentSrc,e.srcset=""),e.loading==="lazy"&&(e.loading="eager")),qh(e)?this.createCustomElementClone(e):e},r.prototype.createCustomElementClone=function(A){var e=document.createElement("html2canvascustomelement");return Uo(A.style,e),e},r.prototype.createStyleClone=function(A){try{var e=A.sheet;if(e&&e.cssRules){var t=[].slice.call(e.cssRules,0).reduce(function(i,n){return n&&typeof n.cssText=="string"?i+n.cssText:i},""),s=A.cloneNode(!1);return s.textContent=t,s}}catch(i){if(this.context.logger.error("Unable to access cssRules property",i),i.name!=="SecurityError")throw i}return A.cloneNode(!1)},r.prototype.createCanvasClone=function(A){var e;if(this.options.inlineImages&&A.ownerDocument){var t=A.ownerDocument.createElement("img");try{return t.src=A.toDataURL(),t}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",A)}}var s=A.cloneNode(!1);try{s.width=A.width,s.height=A.height;var i=A.getContext("2d"),n=s.getContext("2d");if(n)if(!this.options.allowTaint&&i)n.putImageData(i.getImageData(0,0,A.width,A.height),0,0);else{var o=(e=A.getContext("webgl2"))!==null&&e!==void 0?e:A.getContext("webgl");if(o){var a=o.getContextAttributes();a?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",A)}n.drawImage(A,0,0)}return s}catch{this.context.logger.info("Unable to clone canvas as it is tainted",A)}return s},r.prototype.createVideoClone=function(A){var e=A.ownerDocument.createElement("canvas");e.width=A.offsetWidth,e.height=A.offsetHeight;var t=e.getContext("2d");try{return t&&(t.drawImage(A,0,0,e.width,e.height),this.options.allowTaint||t.getImageData(0,0,e.width,e.height)),e}catch{this.context.logger.info("Unable to clone video as it is tainted",A)}var s=A.ownerDocument.createElement("canvas");return s.width=A.offsetWidth,s.height=A.offsetHeight,s},r.prototype.appendChildNode=function(A,e,t){(!Rt(e)||!iC(e)&&!e.hasAttribute(su)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(e)))&&(!this.options.copyStyles||!Rt(e)||!Zh(e))&&A.appendChild(this.cloneNode(e,t))},r.prototype.cloneChildNodes=function(A,e,t){for(var s=this,i=A.shadowRoot?A.shadowRoot.firstChild:A.firstChild;i;i=i.nextSibling)if(Rt(i)&&Yh(i)&&typeof i.assignedNodes=="function"){var n=i.assignedNodes();n.length&&n.forEach(function(o){return s.appendChildNode(e,o,t)})}else this.appendChildNode(e,i,t)},r.prototype.cloneNode=function(A,e){if(Rh(A))return document.createTextNode(A.data);if(!A.ownerDocument)return A.cloneNode(!1);var t=A.ownerDocument.defaultView;if(t&&Rt(A)&&(bo(A)||li(A))){var s=this.createElementClone(A);s.style.transitionProperty="none";var i=t.getComputedStyle(A),n=t.getComputedStyle(A,":before"),o=t.getComputedStyle(A,":after");this.referenceElement===A&&bo(s)&&(this.clonedReferenceElement=s),Qo(s)&&mC(s);var a=this.counters.parse(new mh(this.context,i)),l=this.resolvePseudoContent(A,s,n,Or.BEFORE);qh(A)&&(e=!0),Xh(A)||this.cloneChildNodes(A,s,e),l&&s.insertBefore(l,s.firstChild);var c=this.resolvePseudoContent(A,s,o,Or.AFTER);return c&&s.appendChild(c),this.counters.pop(a),(i&&(this.options.copyStyles||li(A))&&!Jh(A)||e)&&Uo(i,s),(A.scrollTop!==0||A.scrollLeft!==0)&&this.scrolledElements.push([s,A.scrollLeft,A.scrollTop]),(ci(A)||hi(A))&&(ci(s)||hi(s))&&(s.value=A.value),s}return A.cloneNode(!1)},r.prototype.resolvePseudoContent=function(A,e,t,s){var i=this;if(t){var n=t.content,o=e.ownerDocument;if(!(!o||!n||n==="none"||n==="-moz-alt-content"||t.display==="none")){this.counters.parse(new mh(this.context,t));var a=new em(this.context,t),l=o.createElement("html2canvaspseudoelement");Uo(t,l),a.content.forEach(function(u){if(u.type===0)l.appendChild(o.createTextNode(u.value));else if(u.type===22){var d=o.createElement("img");d.src=u.value,d.style.opacity="1",l.appendChild(d)}else if(u.type===18){if(u.name==="attr"){var g=u.values.filter(SA);g.length&&l.appendChild(o.createTextNode(A.getAttribute(g[0].value)||""))}else if(u.name==="counter"){var B=u.values.filter(Pt),f=B[0],w=B[1];if(f&&SA(f)){var m=i.counters.getCounterValue(f.value),p=w&&SA(w)?no.parse(i.context,w.value):3;l.appendChild(o.createTextNode(Dr(m,p,!1)))}}else if(u.name==="counters"){var v=u.values.filter(Pt),f=v[0],y=v[1],w=v[2];if(f&&SA(f)){var E=i.counters.getCounterValues(f.value),U=w&&SA(w)?no.parse(i.context,w.value):3,I=y&&y.type===0?y.value:"",O=E.map(function(M){return Dr(M,U,!1)}).join(I);l.appendChild(o.createTextNode(O))}}}else if(u.type===20)switch(u.value){case"open-quote":l.appendChild(o.createTextNode(wh(a.quotes,i.quoteDepth++,!0)));break;case"close-quote":l.appendChild(o.createTextNode(wh(a.quotes,--i.quoteDepth,!1)));break;default:l.appendChild(o.createTextNode(u.value))}}),l.className=Eo+" "+xo;var c=s===Or.BEFORE?" "+Eo:" "+xo;return li(e)?e.className.baseValue+=c:e.className+=c,l}}},r.destroy=function(A){return A.parentNode?(A.parentNode.removeChild(A),!0):!1},r})(),Or;(function(r){r[r.BEFORE=0]="BEFORE",r[r.AFTER=1]="AFTER"})(Or||(Or={}));var lC=function(r,A){var e=r.createElement("iframe");return e.className="html2canvas-container",e.style.visibility="hidden",e.style.position="fixed",e.style.left="-10000px",e.style.top="0px",e.style.border="0",e.width=A.width.toString(),e.height=A.height.toString(),e.scrolling="no",e.setAttribute(su,"true"),r.body.appendChild(e),e},cC=function(r){return new Promise(function(A){if(r.complete){A();return}if(!r.src){A();return}r.onload=A,r.onerror=A})},hC=function(r){return Promise.all([].slice.call(r.images,0).map(cC))},uC=function(r){return new Promise(function(A,e){var t=r.contentWindow;if(!t)return e("No window assigned for iframe");var s=t.document;t.onload=r.onload=function(){t.onload=r.onload=null;var i=setInterval(function(){s.body.childNodes.length>0&&s.readyState==="complete"&&(clearInterval(i),A(r))},50)}})},fC=["all","d","content"],Uo=function(r,A){for(var e=r.length-1;e>=0;e--){var t=r.item(e);fC.indexOf(t)===-1&&A.style.setProperty(t,r.getPropertyValue(t))}return A},dC=function(r){var A="";return r&&(A+="<!DOCTYPE ",r.name&&(A+=r.name),r.internalSubset&&(A+=r.internalSubset),r.publicId&&(A+='"'+r.publicId+'"'),r.systemId&&(A+='"'+r.systemId+'"'),A+=">"),A},BC=function(r,A,e){r&&r.defaultView&&(A!==r.defaultView.pageXOffset||e!==r.defaultView.pageYOffset)&&r.defaultView.scrollTo(A,e)},gC=function(r){var A=r[0],e=r[1],t=r[2];A.scrollLeft=e,A.scrollTop=t},pC=":before",wC=":after",Eo="___html2canvas___pseudoelement_before",xo="___html2canvas___pseudoelement_after",nu=`{
7
+ content: "" !important;
8
+ display: none !important;
9
+ }`,mC=function(r){CC(r,"."+Eo+pC+nu+`
10
+ .`+xo+wC+nu)},CC=function(r,A){var e=r.ownerDocument;if(e){var t=e.createElement("style");t.textContent=A,r.appendChild(t)}},ou=(function(){function r(){}return r.getOrigin=function(A){var e=r._link;return e?(e.href=A,e.href=e.href,e.protocol+e.hostname+e.port):"about:blank"},r.isSameOrigin=function(A){return r.getOrigin(A)===r._origin},r.setContext=function(A){r._link=A.document.createElement("a"),r._origin=r.getOrigin(A.location.href)},r._origin="about:blank",r})(),vC=(function(){function r(A,e){this.context=A,this._options=e,this._cache={}}return r.prototype.addImage=function(A){var e=Promise.resolve();return this.has(A)||(Ho(A)||yC(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),e},r.prototype.match=function(A){return this._cache[A]},r.prototype.loadImage=function(A){return oe(this,void 0,void 0,function(){var e,t,s,i,n=this;return te(this,function(o){switch(o.label){case 0:return e=ou.isSameOrigin(A),t=!So(A)&&this._options.useCORS===!0&&$A.SUPPORT_CORS_IMAGES&&!e,s=!So(A)&&!e&&!Ho(A)&&typeof this._options.proxy=="string"&&$A.SUPPORT_CORS_XHR&&!t,!e&&this._options.allowTaint===!1&&!So(A)&&!Ho(A)&&!s&&!t?[2]:(i=A,s?[4,this.proxy(i)]:[3,2]);case 1:i=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(a,l){var c=new Image;c.onload=function(){return a(c)},c.onerror=l,(UC(i)||t)&&(c.crossOrigin="anonymous"),c.src=i,c.complete===!0&&setTimeout(function(){return a(c)},500),n._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+n._options.imageTimeout+"ms) loading image")},n._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(A){return typeof this._cache[A]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(A){var e=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var s=A.substring(0,256);return new Promise(function(i,n){var o=$A.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")i(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return i(u.result)},!1),u.addEventListener("error",function(d){return n(d)},!1),u.readAsDataURL(a.response)}else n("Failed to proxy resource "+s+" with status code "+a.status)},a.onerror=n;var l=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+l+"url="+encodeURIComponent(A)+"&responseType="+o),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),e._options.imageTimeout){var c=e._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return n("Timed out ("+c+"ms) proxying "+s)}}a.send()})},r})(),bC=/^data:image\/svg\+xml/i,QC=/^data:image\/.*;base64,/i,FC=/^data:image\/.*/i,yC=function(r){return $A.SUPPORT_SVG_DRAWING||!EC(r)},So=function(r){return FC.test(r)},UC=function(r){return QC.test(r)},Ho=function(r){return r.substr(0,4)==="blob"},EC=function(r){return r.substr(-3).toLowerCase()==="svg"||bC.test(r)},K=(function(){function r(A,e){this.type=0,this.x=A,this.y=e}return r.prototype.add=function(A,e){return new r(this.x+A,this.y+e)},r})(),Xt=function(r,A,e){return new K(r.x+(A.x-r.x)*e,r.y+(A.y-r.y)*e)},ui=(function(){function r(A,e,t,s){this.type=1,this.start=A,this.startControl=e,this.endControl=t,this.end=s}return r.prototype.subdivide=function(A,e){var t=Xt(this.start,this.startControl,A),s=Xt(this.startControl,this.endControl,A),i=Xt(this.endControl,this.end,A),n=Xt(t,s,A),o=Xt(s,i,A),a=Xt(n,o,A);return e?new r(this.start,t,n,a):new r(a,o,i,this.end)},r.prototype.add=function(A,e){return new r(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r})(),Qe=function(r){return r.type===1},xC=(function(){function r(A){var e=A.styles,t=A.bounds,s=Sr(e.borderTopLeftRadius,t.width,t.height),i=s[0],n=s[1],o=Sr(e.borderTopRightRadius,t.width,t.height),a=o[0],l=o[1],c=Sr(e.borderBottomRightRadius,t.width,t.height),u=c[0],d=c[1],g=Sr(e.borderBottomLeftRadius,t.width,t.height),B=g[0],f=g[1],w=[];w.push((i+a)/t.width),w.push((B+u)/t.width),w.push((n+f)/t.height),w.push((l+d)/t.height);var m=Math.max.apply(Math,w);m>1&&(i/=m,n/=m,a/=m,l/=m,u/=m,d/=m,B/=m,f/=m);var p=t.width-a,v=t.height-d,y=t.width-u,E=t.height-f,U=e.borderTopWidth,I=e.borderRightWidth,O=e.borderBottomWidth,T=e.borderLeftWidth,lA=LA(e.paddingTop,A.bounds.width),M=LA(e.paddingRight,A.bounds.width),Z=LA(e.paddingBottom,A.bounds.width),S=LA(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||n>0?DA(t.left+T/3,t.top+U/3,i-T/3,n-U/3,yA.TOP_LEFT):new K(t.left+T/3,t.top+U/3),this.topRightBorderDoubleOuterBox=i>0||n>0?DA(t.left+p,t.top+U/3,a-I/3,l-U/3,yA.TOP_RIGHT):new K(t.left+t.width-I/3,t.top+U/3),this.bottomRightBorderDoubleOuterBox=u>0||d>0?DA(t.left+y,t.top+v,u-I/3,d-O/3,yA.BOTTOM_RIGHT):new K(t.left+t.width-I/3,t.top+t.height-O/3),this.bottomLeftBorderDoubleOuterBox=B>0||f>0?DA(t.left+T/3,t.top+E,B-T/3,f-O/3,yA.BOTTOM_LEFT):new K(t.left+T/3,t.top+t.height-O/3),this.topLeftBorderDoubleInnerBox=i>0||n>0?DA(t.left+T*2/3,t.top+U*2/3,i-T*2/3,n-U*2/3,yA.TOP_LEFT):new K(t.left+T*2/3,t.top+U*2/3),this.topRightBorderDoubleInnerBox=i>0||n>0?DA(t.left+p,t.top+U*2/3,a-I*2/3,l-U*2/3,yA.TOP_RIGHT):new K(t.left+t.width-I*2/3,t.top+U*2/3),this.bottomRightBorderDoubleInnerBox=u>0||d>0?DA(t.left+y,t.top+v,u-I*2/3,d-O*2/3,yA.BOTTOM_RIGHT):new K(t.left+t.width-I*2/3,t.top+t.height-O*2/3),this.bottomLeftBorderDoubleInnerBox=B>0||f>0?DA(t.left+T*2/3,t.top+E,B-T*2/3,f-O*2/3,yA.BOTTOM_LEFT):new K(t.left+T*2/3,t.top+t.height-O*2/3),this.topLeftBorderStroke=i>0||n>0?DA(t.left+T/2,t.top+U/2,i-T/2,n-U/2,yA.TOP_LEFT):new K(t.left+T/2,t.top+U/2),this.topRightBorderStroke=i>0||n>0?DA(t.left+p,t.top+U/2,a-I/2,l-U/2,yA.TOP_RIGHT):new K(t.left+t.width-I/2,t.top+U/2),this.bottomRightBorderStroke=u>0||d>0?DA(t.left+y,t.top+v,u-I/2,d-O/2,yA.BOTTOM_RIGHT):new K(t.left+t.width-I/2,t.top+t.height-O/2),this.bottomLeftBorderStroke=B>0||f>0?DA(t.left+T/2,t.top+E,B-T/2,f-O/2,yA.BOTTOM_LEFT):new K(t.left+T/2,t.top+t.height-O/2),this.topLeftBorderBox=i>0||n>0?DA(t.left,t.top,i,n,yA.TOP_LEFT):new K(t.left,t.top),this.topRightBorderBox=a>0||l>0?DA(t.left+p,t.top,a,l,yA.TOP_RIGHT):new K(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||d>0?DA(t.left+y,t.top+v,u,d,yA.BOTTOM_RIGHT):new K(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=B>0||f>0?DA(t.left,t.top+E,B,f,yA.BOTTOM_LEFT):new K(t.left,t.top+t.height),this.topLeftPaddingBox=i>0||n>0?DA(t.left+T,t.top+U,Math.max(0,i-T),Math.max(0,n-U),yA.TOP_LEFT):new K(t.left+T,t.top+U),this.topRightPaddingBox=a>0||l>0?DA(t.left+Math.min(p,t.width-I),t.top+U,p>t.width+I?0:Math.max(0,a-I),Math.max(0,l-U),yA.TOP_RIGHT):new K(t.left+t.width-I,t.top+U),this.bottomRightPaddingBox=u>0||d>0?DA(t.left+Math.min(y,t.width-T),t.top+Math.min(v,t.height-O),Math.max(0,u-I),Math.max(0,d-O),yA.BOTTOM_RIGHT):new K(t.left+t.width-I,t.top+t.height-O),this.bottomLeftPaddingBox=B>0||f>0?DA(t.left+T,t.top+Math.min(E,t.height-O),Math.max(0,B-T),Math.max(0,f-O),yA.BOTTOM_LEFT):new K(t.left+T,t.top+t.height-O),this.topLeftContentBox=i>0||n>0?DA(t.left+T+S,t.top+U+lA,Math.max(0,i-(T+S)),Math.max(0,n-(U+lA)),yA.TOP_LEFT):new K(t.left+T+S,t.top+U+lA),this.topRightContentBox=a>0||l>0?DA(t.left+Math.min(p,t.width+T+S),t.top+U+lA,p>t.width+T+S?0:a-T+S,l-(U+lA),yA.TOP_RIGHT):new K(t.left+t.width-(I+M),t.top+U+lA),this.bottomRightContentBox=u>0||d>0?DA(t.left+Math.min(y,t.width-(T+S)),t.top+Math.min(v,t.height+U+lA),Math.max(0,u-(I+M)),d-(O+Z),yA.BOTTOM_RIGHT):new K(t.left+t.width-(I+M),t.top+t.height-(O+Z)),this.bottomLeftContentBox=B>0||f>0?DA(t.left+T+S,t.top+E,Math.max(0,B-(T+S)),f-(O+Z),yA.BOTTOM_LEFT):new K(t.left+T+S,t.top+t.height-(O+Z))}return r})(),yA;(function(r){r[r.TOP_LEFT=0]="TOP_LEFT",r[r.TOP_RIGHT=1]="TOP_RIGHT",r[r.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",r[r.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(yA||(yA={}));var DA=function(r,A,e,t,s){var i=4*((Math.sqrt(2)-1)/3),n=e*i,o=t*i,a=r+e,l=A+t;switch(s){case yA.TOP_LEFT:return new ui(new K(r,l),new K(r,l-o),new K(a-n,A),new K(a,A));case yA.TOP_RIGHT:return new ui(new K(r,A),new K(r+n,A),new K(a,l-o),new K(a,l));case yA.BOTTOM_RIGHT:return new ui(new K(a,A),new K(a,A+o),new K(r+n,l),new K(r,l));case yA.BOTTOM_LEFT:default:return new ui(new K(a,l),new K(a-n,l),new K(r,A+o),new K(r,A))}},fi=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},SC=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},di=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},HC=(function(){function r(A,e,t){this.offsetX=A,this.offsetY=e,this.matrix=t,this.type=0,this.target=6}return r})(),Bi=(function(){function r(A,e){this.path=A,this.target=e,this.type=1}return r})(),LC=(function(){function r(A){this.opacity=A,this.type=2,this.target=6}return r})(),IC=function(r){return r.type===0},au=function(r){return r.type===1},TC=function(r){return r.type===2},lu=function(r,A){return r.length===A.length?r.some(function(e,t){return e===A[t]}):!1},MC=function(r,A,e,t,s){return r.map(function(i,n){switch(n){case 0:return i.add(A,e);case 1:return i.add(A+t,e);case 2:return i.add(A+t,e+s);case 3:return i.add(A,e+s)}return i})},cu=(function(){function r(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r})(),hu=(function(){function r(A,e){if(this.container=A,this.parent=e,this.effects=[],this.curves=new xC(this.container),this.container.styles.opacity<1&&this.effects.push(new LC(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,s=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new HC(t,s,i))}if(this.container.styles.overflowX!==0){var n=fi(this.curves),o=di(this.curves);lu(n,o)?this.effects.push(new Bi(n,6)):(this.effects.push(new Bi(n,2)),this.effects.push(new Bi(o,4)))}}return r.prototype.getEffects=function(A){for(var e=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,s=this.effects.slice(0);t;){var i=t.effects.filter(function(a){return!au(a)});if(e||t.container.styles.position!==0||!t.parent){if(s.unshift.apply(s,i),e=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var n=fi(t.curves),o=di(t.curves);lu(n,o)||s.unshift(new Bi(o,6))}}else s.unshift.apply(s,i);t=t.parent}return s.filter(function(a){return zA(a.target,A)})},r})(),Lo=function(r,A,e,t){r.container.elements.forEach(function(s){var i=zA(s.flags,4),n=zA(s.flags,2),o=new hu(s,r);zA(s.styles.display,2048)&&t.push(o);var a=zA(s.flags,8)?[]:t;if(i||n){var l=i||s.styles.isPositioned()?e:A,c=new cu(o);if(s.styles.isPositioned()||s.styles.opacity<1||s.styles.isTransformed()){var u=s.styles.zIndex.order;if(u<0){var d=0;l.negativeZIndex.some(function(B,f){return u>B.element.container.styles.zIndex.order?(d=f,!1):d>0}),l.negativeZIndex.splice(d,0,c)}else if(u>0){var g=0;l.positiveZIndex.some(function(B,f){return u>=B.element.container.styles.zIndex.order?(g=f+1,!1):g>0}),l.positiveZIndex.splice(g,0,c)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else s.styles.isFloating()?l.nonPositionedFloats.push(c):l.nonPositionedInlineLevel.push(c);Lo(o,c,i?c:e,a)}else s.styles.isInlineLevel()?A.inlineLevel.push(o):A.nonInlineLevel.push(o),Lo(o,A,e,a);zA(s.flags,8)&&uu(s,a)})},uu=function(r,A){for(var e=r instanceof Co?r.start:1,t=r instanceof Co?r.reversed:!1,s=0;s<A.length;s++){var i=A[s];i.container instanceof kh&&typeof i.container.value=="number"&&i.container.value!==0&&(e=i.container.value),i.listValue=Dr(e,i.container.styles.listStyleType,!0),e+=t?-1:1}},DC=function(r){var A=new hu(r,null),e=new cu(A),t=[];return Lo(A,e,e,t),uu(A.container,t),e},fu=function(r,A){switch(A){case 0:return Fe(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return Fe(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return Fe(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);default:return Fe(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},OC=function(r,A){switch(A){case 0:return Fe(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return Fe(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return Fe(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);default:return Fe(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},kC=function(r,A){switch(A){case 0:return Fe(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return Fe(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return Fe(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);default:return Fe(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},_C=function(r,A){switch(A){case 0:return gi(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return gi(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return gi(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);default:return gi(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},gi=function(r,A){var e=[];return Qe(r)?e.push(r.subdivide(.5,!1)):e.push(r),Qe(A)?e.push(A.subdivide(.5,!0)):e.push(A),e},Fe=function(r,A,e,t){var s=[];return Qe(r)?s.push(r.subdivide(.5,!1)):s.push(r),Qe(e)?s.push(e.subdivide(.5,!0)):s.push(e),Qe(t)?s.push(t.subdivide(.5,!0).reverse()):s.push(t),Qe(A)?s.push(A.subdivide(.5,!1).reverse()):s.push(A),s},du=function(r){var A=r.bounds,e=r.styles;return A.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},pi=function(r){var A=r.styles,e=r.bounds,t=LA(A.paddingLeft,e.width),s=LA(A.paddingRight,e.width),i=LA(A.paddingTop,e.width),n=LA(A.paddingBottom,e.width);return e.add(t+A.borderLeftWidth,i+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+t+s),-(A.borderTopWidth+A.borderBottomWidth+i+n))},NC=function(r,A){return r===0?A.bounds:r===2?pi(A):du(A)},KC=function(r,A){return r===0?A.bounds:r===2?pi(A):du(A)},Io=function(r,A,e){var t=NC(Zt(r.styles.backgroundOrigin,A),r),s=KC(Zt(r.styles.backgroundClip,A),r),i=VC(Zt(r.styles.backgroundSize,A),e,t),n=i[0],o=i[1],a=Sr(Zt(r.styles.backgroundPosition,A),t.width-n,t.height-o),l=PC(Zt(r.styles.backgroundRepeat,A),a,i,t,s),c=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[l,c,u,n,o]},Jt=function(r){return SA(r)&&r.value===Gt.AUTO},wi=function(r){return typeof r=="number"},VC=function(r,A,e){var t=A[0],s=A[1],i=A[2],n=r[0],o=r[1];if(!n)return[0,0];if(WA(n)&&o&&WA(o))return[LA(n,e.width),LA(o,e.height)];var a=wi(i);if(SA(n)&&(n.value===Gt.CONTAIN||n.value===Gt.COVER)){if(wi(i)){var l=e.width/e.height;return l<i!=(n.value===Gt.COVER)?[e.width,e.width/i]:[e.height*i,e.height]}return[e.width,e.height]}var c=wi(t),u=wi(s),d=c||u;if(Jt(n)&&(!o||Jt(o))){if(c&&u)return[t,s];if(!a&&!d)return[e.width,e.height];if(d&&a){var g=c?t:s*i,B=u?s:t/i;return[g,B]}var f=c?t:e.width,w=u?s:e.height;return[f,w]}if(a){var m=0,p=0;return WA(n)?m=LA(n,e.width):WA(o)&&(p=LA(o,e.height)),Jt(n)?m=p*i:(!o||Jt(o))&&(p=m/i),[m,p]}var v=null,y=null;if(WA(n)?v=LA(n,e.width):o&&WA(o)&&(y=LA(o,e.height)),v!==null&&(!o||Jt(o))&&(y=c&&u?v/t*s:e.height),y!==null&&Jt(n)&&(v=c&&u?y/s*t:e.width),v!==null&&y!==null)return[v,y];throw new Error("Unable to calculate background-size for element")},Zt=function(r,A){var e=r[A];return typeof e>"u"?r[0]:e},PC=function(r,A,e,t,s){var i=A[0],n=A[1],o=e[0],a=e[1];switch(r){case 2:return[new K(Math.round(t.left),Math.round(t.top+n)),new K(Math.round(t.left+t.width),Math.round(t.top+n)),new K(Math.round(t.left+t.width),Math.round(a+t.top+n)),new K(Math.round(t.left),Math.round(a+t.top+n))];case 3:return[new K(Math.round(t.left+i),Math.round(t.top)),new K(Math.round(t.left+i+o),Math.round(t.top)),new K(Math.round(t.left+i+o),Math.round(t.height+t.top)),new K(Math.round(t.left+i),Math.round(t.height+t.top))];case 1:return[new K(Math.round(t.left+i),Math.round(t.top+n)),new K(Math.round(t.left+i+o),Math.round(t.top+n)),new K(Math.round(t.left+i+o),Math.round(t.top+n+a)),new K(Math.round(t.left+i),Math.round(t.top+n+a))];default:return[new K(Math.round(s.left),Math.round(s.top)),new K(Math.round(s.left+s.width),Math.round(s.top)),new K(Math.round(s.left+s.width),Math.round(s.height+s.top)),new K(Math.round(s.left),Math.round(s.height+s.top))]}},GC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Bu="Hidden Text",RC=(function(){function r(A){this._data={},this._document=A}return r.prototype.parseMetrics=function(A,e){var t=this._document.createElement("div"),s=this._document.createElement("img"),i=this._document.createElement("span"),n=this._document.body;t.style.visibility="hidden",t.style.fontFamily=A,t.style.fontSize=e,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",n.appendChild(t),s.src=GC,s.width=1,s.height=1,s.style.margin="0",s.style.padding="0",s.style.verticalAlign="baseline",i.style.fontFamily=A,i.style.fontSize=e,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(Bu)),t.appendChild(i),t.appendChild(s);var o=s.offsetTop-i.offsetTop+2;t.removeChild(i),t.appendChild(this._document.createTextNode(Bu)),t.style.lineHeight="normal",s.style.verticalAlign="super";var a=s.offsetTop-t.offsetTop+2;return n.removeChild(t),{baseline:o,middle:a}},r.prototype.getMetrics=function(A,e){var t=A+" "+e;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(A,e)),this._data[t]},r})(),gu=(function(){function r(A,e){this.context=A,this.options=e}return r})(),WC=1e4,zC=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;return s._activeEffects=[],s.canvas=t.canvas?t.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),t.canvas||(s.canvas.width=Math.floor(t.width*t.scale),s.canvas.height=Math.floor(t.height*t.scale),s.canvas.style.width=t.width+"px",s.canvas.style.height=t.height+"px"),s.fontMetrics=new RC(document),s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-t.x,-t.y),s.ctx.textBaseline="bottom",s._activeEffects=[],s.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),s}return A.prototype.applyEffects=function(e){for(var t=this;this._activeEffects.length;)this.popEffect();e.forEach(function(s){return t.applyEffect(s)})},A.prototype.applyEffect=function(e){this.ctx.save(),TC(e)&&(this.ctx.globalAlpha=e.opacity),IC(e)&&(this.ctx.translate(e.offsetX,e.offsetY),this.ctx.transform(e.matrix[0],e.matrix[1],e.matrix[2],e.matrix[3],e.matrix[4],e.matrix[5]),this.ctx.translate(-e.offsetX,-e.offsetY)),au(e)&&(this.path(e.path),this.ctx.clip()),this._activeEffects.push(e)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(e){return oe(this,void 0,void 0,function(){var t;return te(this,function(s){switch(s.label){case 0:return t=e.element.container.styles,t.isVisible()?[4,this.renderStackContent(e)]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(e){return oe(this,void 0,void 0,function(){return te(this,function(t){switch(t.label){case 0:if(zA(e.container.flags,16))debugger;return e.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(e)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(e,t,s){var i=this;if(t===0)this.ctx.fillText(e.text,e.bounds.left,e.bounds.top+s);else{var n=mo(e.text);n.reduce(function(o,a){return i.ctx.fillText(a,o,e.bounds.top+s),o+i.ctx.measureText(a).width},e.bounds.left)}},A.prototype.createFontStyle=function(e){var t=e.fontVariant.filter(function(n){return n==="normal"||n==="small-caps"}).join(""),s=qC(e.fontFamily).join(", "),i=xr(e.fontSize)?""+e.fontSize.number+e.fontSize.unit:e.fontSize.number+"px";return[[e.fontStyle,t,e.fontWeight,i,s].join(" "),s,i]},A.prototype.renderTextNode=function(e,t){return oe(this,void 0,void 0,function(){var s,i,n,o,a,l,c,u,d=this;return te(this,function(g){return s=this.createFontStyle(t),i=s[0],n=s[1],o=s[2],this.ctx.font=i,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(n,o),l=a.baseline,c=a.middle,u=t.paintOrder,e.textBounds.forEach(function(B){u.forEach(function(f){switch(f){case 0:d.ctx.fillStyle=XA(t.color),d.renderTextWithLetterSpacing(B,t.letterSpacing,l);var w=t.textShadow;w.length&&B.text.trim().length&&(w.slice(0).reverse().forEach(function(m){d.ctx.shadowColor=XA(m.color),d.ctx.shadowOffsetX=m.offsetX.number*d.options.scale,d.ctx.shadowOffsetY=m.offsetY.number*d.options.scale,d.ctx.shadowBlur=m.blur.number,d.renderTextWithLetterSpacing(B,t.letterSpacing,l)}),d.ctx.shadowColor="",d.ctx.shadowOffsetX=0,d.ctx.shadowOffsetY=0,d.ctx.shadowBlur=0),t.textDecorationLine.length&&(d.ctx.fillStyle=XA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(m){switch(m){case 1:d.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top+l),B.bounds.width,1);break;case 2:d.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top),B.bounds.width,1);break;case 3:d.ctx.fillRect(B.bounds.left,Math.ceil(B.bounds.top+c),B.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&B.text.trim().length&&(d.ctx.strokeStyle=XA(t.webkitTextStrokeColor),d.ctx.lineWidth=t.webkitTextStrokeWidth,d.ctx.lineJoin=window.chrome?"miter":"round",d.ctx.strokeText(B.text,B.bounds.left,B.bounds.top+l)),d.ctx.strokeStyle="",d.ctx.lineWidth=0,d.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(e,t,s){if(s&&e.intrinsicWidth>0&&e.intrinsicHeight>0){var i=pi(e),n=di(t);this.path(n),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(s,0,0,e.intrinsicWidth,e.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(e){return oe(this,void 0,void 0,function(){var t,s,i,n,o,a,p,p,l,c,u,d,y,g,B,E,f,w,m,p,v,y,E;return te(this,function(U){switch(U.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,s=e.curves,i=t.styles,n=0,o=t.textNodes,U.label=1;case 1:return n<o.length?(a=o[n],[4,this.renderTextNode(a,i)]):[3,4];case 2:U.sent(),U.label=3;case 3:return n++,[3,1];case 4:if(!(t instanceof Mh))return[3,8];U.label=5;case 5:return U.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return p=U.sent(),this.renderReplacedElement(t,s,p),[3,8];case 7:return U.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Dh&&this.renderReplacedElement(t,s,t.canvas),!(t instanceof Oh))return[3,12];U.label=9;case 9:return U.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return p=U.sent(),this.renderReplacedElement(t,s,p),[3,12];case 11:return U.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Vh&&t.tree?(l=new A(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,l.render(t.tree)]):[3,14];case 13:c=U.sent(),t.width&&t.height&&this.ctx.drawImage(c,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),U.label=14;case 14:if(t instanceof vo&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===ni?t.checked&&(this.ctx.save(),this.path([new K(t.bounds.left+u*.39363,t.bounds.top+u*.79),new K(t.bounds.left+u*.16,t.bounds.top+u*.5549),new K(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new K(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new K(t.bounds.left+u*.72983,t.bounds.top+u*.23),new K(t.bounds.left+u*.84,t.bounds.top+u*.34085),new K(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=XA(_h),this.ctx.fill(),this.ctx.restore()):t.type===oi&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=XA(_h),this.ctx.fill(),this.ctx.restore())),XC(t)&&t.value.length){switch(d=this.createFontStyle(i),y=d[0],g=d[1],B=this.fontMetrics.getMetrics(y,g).baseline,this.ctx.font=y,this.ctx.fillStyle=XA(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=ZC(t.styles.textAlign),E=pi(t),f=0,t.styles.textAlign){case 1:f+=E.width/2;break;case 2:f+=E.width;break}w=E.add(f,0,0,-E.height/2+1),this.ctx.save(),this.path([new K(E.left,E.top),new K(E.left+E.width,E.top),new K(E.left+E.width,E.top+E.height),new K(E.left,E.top+E.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Tr(t.value,w),i.letterSpacing,B),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!zA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(m=t.styles.listStyleImage,m.type!==0)return[3,18];p=void 0,v=m.url,U.label=15;case 15:return U.trys.push([15,17,,18]),[4,this.context.cache.match(v)];case 16:return p=U.sent(),this.ctx.drawImage(p,t.bounds.left-(p.width+10),t.bounds.top),[3,18];case 17:return U.sent(),this.context.logger.error("Error loading list-style-image "+v),[3,18];case 18:return[3,20];case 19:e.listValue&&t.styles.listStyleType!==-1&&(y=this.createFontStyle(i)[0],this.ctx.font=y,this.ctx.fillStyle=XA(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",E=new Ze(t.bounds.left,t.bounds.top+LA(t.styles.paddingTop,t.bounds.width),t.bounds.width,Bh(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Tr(e.listValue,E),i.letterSpacing,Bh(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),U.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(e){return oe(this,void 0,void 0,function(){var t,s,m,i,n,m,o,a,m,l,c,m,u,d,m,g,B,m,f,w,m;return te(this,function(p){switch(p.label){case 0:if(zA(e.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(e.element)];case 1:p.sent(),t=0,s=e.negativeZIndex,p.label=2;case 2:return t<s.length?(m=s[t],[4,this.renderStack(m)]):[3,5];case 3:p.sent(),p.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(e.element)];case 6:p.sent(),i=0,n=e.nonInlineLevel,p.label=7;case 7:return i<n.length?(m=n[i],[4,this.renderNode(m)]):[3,10];case 8:p.sent(),p.label=9;case 9:return i++,[3,7];case 10:o=0,a=e.nonPositionedFloats,p.label=11;case 11:return o<a.length?(m=a[o],[4,this.renderStack(m)]):[3,14];case 12:p.sent(),p.label=13;case 13:return o++,[3,11];case 14:l=0,c=e.nonPositionedInlineLevel,p.label=15;case 15:return l<c.length?(m=c[l],[4,this.renderStack(m)]):[3,18];case 16:p.sent(),p.label=17;case 17:return l++,[3,15];case 18:u=0,d=e.inlineLevel,p.label=19;case 19:return u<d.length?(m=d[u],[4,this.renderNode(m)]):[3,22];case 20:p.sent(),p.label=21;case 21:return u++,[3,19];case 22:g=0,B=e.zeroOrAutoZIndexOrTransformedOrOpacity,p.label=23;case 23:return g<B.length?(m=B[g],[4,this.renderStack(m)]):[3,26];case 24:p.sent(),p.label=25;case 25:return g++,[3,23];case 26:f=0,w=e.positiveZIndex,p.label=27;case 27:return f<w.length?(m=w[f],[4,this.renderStack(m)]):[3,30];case 28:p.sent(),p.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(e){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(e.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(e){this.ctx.beginPath(),this.formatPath(e),this.ctx.closePath()},A.prototype.formatPath=function(e){var t=this;e.forEach(function(s,i){var n=Qe(s)?s.start:s;i===0?t.ctx.moveTo(n.x,n.y):t.ctx.lineTo(n.x,n.y),Qe(s)&&t.ctx.bezierCurveTo(s.startControl.x,s.startControl.y,s.endControl.x,s.endControl.y,s.end.x,s.end.y)})},A.prototype.renderRepeat=function(e,t,s,i){this.path(e),this.ctx.fillStyle=t,this.ctx.translate(s,i),this.ctx.fill(),this.ctx.translate(-s,-i)},A.prototype.resizeImage=function(e,t,s){var i;if(e.width===t&&e.height===s)return e;var n=(i=this.canvas.ownerDocument)!==null&&i!==void 0?i:document,o=n.createElement("canvas");o.width=Math.max(1,t),o.height=Math.max(1,s);var a=o.getContext("2d");return a.drawImage(e,0,0,e.width,e.height,0,0,t,s),o},A.prototype.renderBackgroundImage=function(e){return oe(this,void 0,void 0,function(){var t,s,i,n,o,a;return te(this,function(l){switch(l.label){case 0:t=e.styles.backgroundImage.length-1,s=function(c){var u,d,g,lA,cA,hA,S,V,O,B,lA,cA,hA,S,V,f,w,m,p,v,y,E,U,I,O,T,lA,M,Z,S,V,X,cA,hA,EA,vA,UA,bA,q,$,QA,BA;return te(this,function(JA){switch(JA.label){case 0:if(c.type!==0)return[3,5];u=void 0,d=c.url,JA.label=1;case 1:return JA.trys.push([1,3,,4]),[4,i.context.cache.match(d)];case 2:return u=JA.sent(),[3,4];case 3:return JA.sent(),i.context.logger.error("Error loading background-image "+d),[3,4];case 4:return u&&(g=Io(e,t,[u.width,u.height,u.width/u.height]),lA=g[0],cA=g[1],hA=g[2],S=g[3],V=g[4],O=i.ctx.createPattern(i.resizeImage(u,S,V),"repeat"),i.renderRepeat(lA,O,cA,hA)),[3,6];case 5:Iw(c)?(B=Io(e,t,[null,null,null]),lA=B[0],cA=B[1],hA=B[2],S=B[3],V=B[4],f=Ew(c.angle,S,V),w=f[0],m=f[1],p=f[2],v=f[3],y=f[4],E=document.createElement("canvas"),E.width=S,E.height=V,U=E.getContext("2d"),I=U.createLinearGradient(m,v,p,y),sh(c.stops,w).forEach(function(xA){return I.addColorStop(xA.stop,XA(xA.color))}),U.fillStyle=I,U.fillRect(0,0,S,V),S>0&&V>0&&(O=i.ctx.createPattern(E,"repeat"),i.renderRepeat(lA,O,cA,hA))):Tw(c)&&(T=Io(e,t,[null,null,null]),lA=T[0],M=T[1],Z=T[2],S=T[3],V=T[4],X=c.position.length===0?[ro]:c.position,cA=LA(X[0],S),hA=LA(X[X.length-1],V),EA=xw(c,cA,hA,S,V),vA=EA[0],UA=EA[1],vA>0&&UA>0&&(bA=i.ctx.createRadialGradient(M+cA,Z+hA,0,M+cA,Z+hA,vA),sh(c.stops,vA*2).forEach(function(xA){return bA.addColorStop(xA.stop,XA(xA.color))}),i.path(lA),i.ctx.fillStyle=bA,vA!==UA?(q=e.bounds.left+.5*e.bounds.width,$=e.bounds.top+.5*e.bounds.height,QA=UA/vA,BA=1/QA,i.ctx.save(),i.ctx.translate(q,$),i.ctx.transform(1,0,0,QA,0,0),i.ctx.translate(-q,-$),i.ctx.fillRect(M,BA*(Z-$)+$,S,V*BA),i.ctx.restore()):i.ctx.fill())),JA.label=6;case 6:return t--,[2]}})},i=this,n=0,o=e.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return n<o.length?(a=o[n],[5,s(a)]):[3,4];case 2:l.sent(),l.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(e,t,s){return oe(this,void 0,void 0,function(){return te(this,function(i){return this.path(fu(s,t)),this.ctx.fillStyle=XA(e),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(e,t,s,i){return oe(this,void 0,void 0,function(){var n,o;return te(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(e,s,i)]:[3,2];case 1:return a.sent(),[2];case 2:return n=OC(i,s),this.path(n),this.ctx.fillStyle=XA(e),this.ctx.fill(),o=kC(i,s),this.path(o),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(e){return oe(this,void 0,void 0,function(){var t,s,i,n,o,a,l,c,u=this;return te(this,function(d){switch(d.label){case 0:return this.applyEffects(e.getEffects(2)),t=e.container.styles,s=!at(t.backgroundColor)||t.backgroundImage.length,i=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],n=JC(Zt(t.backgroundClip,0),e.curves),s||t.boxShadow.length?(this.ctx.save(),this.path(n),this.ctx.clip(),at(t.backgroundColor)||(this.ctx.fillStyle=XA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(e.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(g){u.ctx.save();var B=fi(e.curves),f=g.inset?0:WC,w=MC(B,-f+(g.inset?1:-1)*g.spread.number,(g.inset?1:-1)*g.spread.number,g.spread.number*(g.inset?-2:2),g.spread.number*(g.inset?-2:2));g.inset?(u.path(B),u.ctx.clip(),u.mask(w)):(u.mask(B),u.ctx.clip(),u.path(w)),u.ctx.shadowOffsetX=g.offsetX.number+f,u.ctx.shadowOffsetY=g.offsetY.number,u.ctx.shadowColor=XA(g.color),u.ctx.shadowBlur=g.blur.number,u.ctx.fillStyle=g.inset?XA(g.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),d.label=2;case 2:o=0,a=0,l=i,d.label=3;case 3:return a<l.length?(c=l[a],c.style!==0&&!at(c.color)&&c.width>0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,o,e.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,o,e.curves,3)];case 6:return d.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,o,e.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,o,e.curves)];case 10:d.sent(),d.label=11;case 11:o++,d.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(e,t,s,i,n){return oe(this,void 0,void 0,function(){var o,a,l,c,u,d,g,B,f,w,m,p,v,y,E,U,E,U;return te(this,function(I){return this.ctx.save(),o=_C(i,s),a=fu(i,s),n===2&&(this.path(a),this.ctx.clip()),Qe(a[0])?(l=a[0].start.x,c=a[0].start.y):(l=a[0].x,c=a[0].y),Qe(a[1])?(u=a[1].end.x,d=a[1].end.y):(u=a[1].x,d=a[1].y),s===0||s===2?g=Math.abs(l-u):g=Math.abs(c-d),this.ctx.beginPath(),n===3?this.formatPath(o):this.formatPath(a.slice(0,2)),B=t<3?t*3:t*2,f=t<3?t*2:t,n===3&&(B=t,f=t),w=!0,g<=B*2?w=!1:g<=B*2+f?(m=g/(2*B+f),B*=m,f*=m):(p=Math.floor((g+f)/(B+f)),v=(g-p*B)/(p-1),y=(g-(p+1)*B)/p,f=y<=0||Math.abs(f-v)<Math.abs(f-y)?v:y),w&&(n===3?this.ctx.setLineDash([0,B+f]):this.ctx.setLineDash([B,f])),n===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=XA(e),this.ctx.stroke(),this.ctx.setLineDash([]),n===2&&(Qe(a[0])&&(E=a[3],U=a[0],this.ctx.beginPath(),this.formatPath([new K(E.end.x,E.end.y),new K(U.start.x,U.start.y)]),this.ctx.stroke()),Qe(a[1])&&(E=a[1],U=a[2],this.ctx.beginPath(),this.formatPath([new K(E.end.x,E.end.y),new K(U.start.x,U.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(e){return oe(this,void 0,void 0,function(){var t;return te(this,function(s){switch(s.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=XA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=DC(e),[4,this.renderStack(t)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},A})(gu),XC=function(r){return r instanceof Kh||r instanceof Nh?!0:r instanceof vo&&r.type!==oi&&r.type!==ni},JC=function(r,A){switch(r){case 0:return fi(A);case 2:return SC(A);default:return di(A)}},ZC=function(r){switch(r){case 1:return"center";case 2:return"right";default:return"left"}},YC=["-apple-system","system-ui"],qC=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(A){return YC.indexOf(A)===-1}):r},$C=(function(r){Se(A,r);function A(e,t){var s=r.call(this,e,t)||this;return s.canvas=t.canvas?t.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),s.options=t,s.canvas.width=Math.floor(t.width*t.scale),s.canvas.height=Math.floor(t.height*t.scale),s.canvas.style.width=t.width+"px",s.canvas.style.height=t.height+"px",s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-t.x,-t.y),s.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),s}return A.prototype.render=function(e){return oe(this,void 0,void 0,function(){var t,s;return te(this,function(i){switch(i.label){case 0:return t=wo(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,jC(t)];case 1:return s=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=XA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(s,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A})(gu),jC=function(r){return new Promise(function(A,e){var t=new Image;t.onload=function(){A(t)},t.onerror=e,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},Av=(function(){function r(A){var e=A.id,t=A.enabled;this.id=e,this.enabled=t,this.start=Date.now()}return r.prototype.debug=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Us([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Us([this.id,this.getTime()+"ms"],A))},r.prototype.warn=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Us([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.error=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Us([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.instances={},r})(),ev=(function(){function r(A,e){var t;this.windowBounds=e,this.instanceName="#"+r.instanceCount++,this.logger=new Av({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new vC(this,A)}return r.instanceCount=1,r})(),tv=function(r,A){return A===void 0&&(A={}),rv(r,A)};typeof window<"u"&&ou.setContext(window);var rv=function(r,A){return oe(void 0,void 0,void 0,function(){var e,t,s,i,n,o,a,l,c,u,d,g,B,f,w,m,p,v,y,E,I,U,I,O,T,lA,M,Z,S,V,X,cA,hA,EA,vA,UA,bA,q,$,QA;return te(this,function(BA){switch(BA.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(e=r.ownerDocument,!e)throw new Error("Element is not attached to a Document");if(t=e.defaultView,!t)throw new Error("Document is not attached to a Window");return s={allowTaint:(O=A.allowTaint)!==null&&O!==void 0?O:!1,imageTimeout:(T=A.imageTimeout)!==null&&T!==void 0?T:15e3,proxy:A.proxy,useCORS:(lA=A.useCORS)!==null&&lA!==void 0?lA:!1},i=On({logging:(M=A.logging)!==null&&M!==void 0?M:!0,cache:A.cache},s),n={windowWidth:(Z=A.windowWidth)!==null&&Z!==void 0?Z:t.innerWidth,windowHeight:(S=A.windowHeight)!==null&&S!==void 0?S:t.innerHeight,scrollX:(V=A.scrollX)!==null&&V!==void 0?V:t.pageXOffset,scrollY:(X=A.scrollY)!==null&&X!==void 0?X:t.pageYOffset},o=new Ze(n.scrollX,n.scrollY,n.windowWidth,n.windowHeight),a=new ev(i,o),l=(cA=A.foreignObjectRendering)!==null&&cA!==void 0?cA:!1,c={allowTaint:(hA=A.allowTaint)!==null&&hA!==void 0?hA:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:l,copyStyles:l},a.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),u=new iu(a,r,c),d=u.clonedReferenceElement,d?[4,u.toIFrame(e,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return g=BA.sent(),B=Qo(d)||sC(d)?Mg(d.ownerDocument):Es(a,d),f=B.width,w=B.height,m=B.left,p=B.top,v=sv(a,d,A.backgroundColor),y={canvas:A.canvas,backgroundColor:v,scale:(vA=(EA=A.scale)!==null&&EA!==void 0?EA:t.devicePixelRatio)!==null&&vA!==void 0?vA:1,x:((UA=A.x)!==null&&UA!==void 0?UA:0)+m,y:((bA=A.y)!==null&&bA!==void 0?bA:0)+p,width:(q=A.width)!==null&&q!==void 0?q:Math.ceil(f),height:($=A.height)!==null&&$!==void 0?$:Math.ceil(w)},l?(a.logger.debug("Document cloned, using foreign object rendering"),I=new $C(a,y),[4,I.render(d)]):[3,3];case 2:return E=BA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+m+","+p+" with size "+f+"x"+w+" using computed rendering"),a.logger.debug("Starting DOM parsing"),U=Gh(a,d),v===U.styles.backgroundColor&&(U.styles.backgroundColor=qe.TRANSPARENT),a.logger.debug("Starting renderer for element at "+y.x+","+y.y+" with size "+y.width+"x"+y.height),I=new zC(a,y),[4,I.render(U)];case 4:E=BA.sent(),BA.label=5;case 5:return(!((QA=A.removeContainer)!==null&&QA!==void 0)||QA)&&(iu.destroy(g)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,E]}})})},sv=function(r,A,e){var t=A.ownerDocument,s=t.documentElement?Hr(r,getComputedStyle(t.documentElement).backgroundColor):qe.TRANSPARENT,i=t.body?Hr(r,getComputedStyle(t.body).backgroundColor):qe.TRANSPARENT,n=typeof e=="string"?Hr(r,e):e===null?qe.TRANSPARENT:4294967295;return A===t.documentElement?at(s)?at(i)?n:i:s:n};const iv={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function pu(r){if(!r)return 7;const A=String(r).toUpperCase();return iv[A]??7}function nv(r,A){const e=String(r||"").toUpperCase(),t=A||pu(r),s={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[e]||96,i=Math.ceil(t*(typeof s=="number"?s:96));return Math.min(Math.max(i,500),5e3)}const se=r=>{if(!Array.isArray(r)||r.length===0)return[];const A=r.map(t=>({...t,time:RA(t.time)})).filter(t=>t.time!=null);A.sort((t,s)=>t.time-s.time);const e=new Map;for(const t of A)e.set(t.time,t);return Array.from(e.values()).sort((t,s)=>t.time-s.time)};function ov(r,A,e,t,s,i){const n=s-e,o=i-t,a=Math.sqrt(n*n+o*o);if(a===0)return Math.hypot(r-e,A-t);let l=((r-e)*n+(A-t)*o)/(a*a);l=Math.max(0,Math.min(1,l));const c=e+l*n,u=t+l*o;return Math.hypot(r-c,A-u)}function To(r,A,e,t,s){if(!e||!t||!s)return null;const i=e.time,n=t.time,o=n-i,a=e.price,l=t.price,c=s.price;if(Math.abs(o)<1e-9){const B=c-a;return[{time:i,price:a+B},{time:n+1,price:l+B}]}const u=(l-a)/o,d=c+u*(i-s.time),g=c+u*(n-s.time);return[{time:i,price:d},{time:n,price:g}]}const av=b.forwardRef(function({bidPrice:A="113.638",askPrice:e="113.649",showBuySellPanel:t=!0,onBuyClick:s,onSellClick:i},n){const o=b.useRef(null),a=b.useRef(null),l=b.useRef(null),c=b.useRef(null),u=b.useRef([]),d=b.useRef(!1),g=b.useRef(null),B=b.useRef(null),f=b.useRef(null),w=b.useRef(null),m=b.useRef([]),[p,v]=b.useState(null),[y,E]=b.useState([]),U=b.useRef(null),I=b.useRef(null),O=b.useRef(null),T=b.useRef(!1);b.useEffect(()=>{O.current=p},[p]);const lA=b.useRef(new Map),M=b.useRef(null),Z=(C,F)=>`${C}_${F}`,S=()=>{const C=Z(q,$);return lA.current.get(C)||null},V=C=>{if(!C)return;const F=Z(q,$);lA.current.set(F,C)},{activeTool:X,setActiveTool:cA,showGrid:hA,snapToGrid:EA,chartObjects:vA,setChartObjects:UA,orders:bA,selectedSymbol:q,selectedTimeframe:$,drawingsVisible:QA,chartType:BA,chartLocked:JA,theme:xA,baseUrl:Ge,endpoints:Ut,endpointParams:kr}=ne(),je=b.useRef([]),[k,_]=b.useState(!1),[AA,eA]=b.useState(null),[P,j]=b.useState([]),[TA,NA]=b.useState(!0),ZA=b.useRef(null),le=b.useRef(new Map);b.useRef(null);const vi=b.useRef(0);b.useImperativeHandle(n,()=>({zoomIn:()=>{const C=a.current?.timeScale();if(!C)return;const F=C.getVisibleRange();if(!F||!F.from||!F.to)return;const x=F.to-F.from,J=(F.from+F.to)/2,L=x*.8;try{C.setVisibleRange({from:J-L/2,to:J+L/2}),V(C.getVisibleRange())}catch{}},zoomOut:()=>{const C=a.current?.timeScale();if(!C)return;const F=C.getVisibleRange();if(!F||!F.from||!F.to)return;const x=F.to-F.from,J=(F.from+F.to)/2,L=x*1.25;try{C.setVisibleRange({from:J-L/2,to:J+L/2}),V(C.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const C=o.current;if(!C){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const F=C.querySelectorAll("canvas"),x=xA==="light"?"#ffffff":"#12161d";let J=null,L=0;if(F.forEach(W=>{if(W.width>0&&W.height>0){const rA=W.width*W.height;rA>L&&(L=rA,J=W)}}),J)try{const W=document.createElement("canvas");W.width=J.width,W.height=J.height;const rA=W.getContext("2d");rA.fillStyle=x,rA.fillRect(0,0,W.width,W.height),rA.drawImage(J,0,0);const Y=document.createElement("a");Y.download=`chart-${q}-${$}-${Date.now()}.png`,Y.href=W.toDataURL("image/png"),Y.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(W){console.warn("Canvas export failed, trying html2canvas",W)}tv(C,{useCORS:!0,allowTaint:!0,backgroundColor:x,scale:2,logging:!1}).then(W=>{const rA=document.createElement("a");rA.download=`chart-${q}-${$}-${Date.now()}.png`,rA.href=W.toDataURL("image/png"),rA.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(W=>{console.error("Chart screenshot failed",W),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[q,$,xA]);const _r=b.useMemo(()=>P.length===0?[]:BA==="line"||BA==="area"?P.map(C=>({time:C.time,value:C.close})):P,[P,BA]),ko=C=>{console.log("Buy Order:",C),s?s("BUY"):(eA("BUY"),_(!0))},_o=C=>{console.log("Sell Order:",C),i?i("SELL"):(eA("SELL"),_(!0))},pe=()=>{_(!1),eA(null)};return b.useEffect(()=>{const C=o.current;if(!C)return;const F=C.getBoundingClientRect(),x=R=>{const gA=Math.abs(Number(R));return Number.isFinite(gA)?gA>=1e3?gA.toFixed(2):gA>=1?gA.toFixed(4):gA.toFixed(5):"0"},J=xA==="light",L=r0(C,{width:F.width||C.clientWidth,height:F.height||C.clientHeight,autoSize:!0,localization:{priceFormatter:x},layout:{background:{color:J?"#FFFFFF":"#0d1117",type:"solid"},textColor:J?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:hA,color:hA?J?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:hA?2:0},horzLines:{visible:hA,color:hA?J?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:hA?2:0}},rightPriceScale:{borderColor:J?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,textColor:J?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:J?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:X===1?1:0,vertLine:{width:1,color:J?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:J?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:J?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:J?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:X===1,horzLineVisible:X===1},handleScroll:{mouseWheel:!0,pressedMouseMove:X===null||X===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),W=L.addCandlestickSeries({upColor:J?"#089981":"#26a69a",downColor:J?"#f23645":"#ef5350",wickUpColor:J?"#089981":"#26a69a",wickDownColor:J?"#f23645":"#ef5350",borderUpColor:J?"#089981":"#26a69a",borderDownColor:J?"#f23645":"#ef5350",borderVisible:!0});a.current=L,l.current=W;const rA=L.timeScale(),Y=()=>{if(T.current&&P.length>0){const R=rA.getVisibleRange();R&&V(R)}};rA.subscribeVisibleTimeRangeChange(Y);const N=new ResizeObserver(R=>{for(const gA of R){const{width:uA,height:D}=gA.contentRect;if(uA>0&&D>0&&L){const nA=rA.getVisibleRange();L.resize(uA,D),nA&&setTimeout(()=>{try{rA.setVisibleRange(nA)}catch{}},0)}}});return N.observe(C),()=>{rA.unsubscribeVisibleTimeRangeChange(Y),N.disconnect(),L.remove(),a.current=null,l.current=null,c.current=null,u.current=[]}},[]),b.useEffect(()=>{a.current&&a.current.applyOptions({grid:{vertLines:{visible:hA,color:hA?"rgba(110, 118, 129, 0.15)":"transparent",style:hA?2:0},horzLines:{visible:hA,color:hA?"rgba(110, 118, 129, 0.15)":"transparent",style:hA?2:0}}})},[hA]),b.useEffect(()=>{const C=a.current;if(!C)return;const F=xA==="light";C.applyOptions({layout:{background:{color:F?"#FFFFFF":"#12161d"},textColor:F?"#020617":"#fff"},grid:{vertLines:{color:hA?F?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:hA?F?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:F?"#e5e7eb":"#1e293b"},timeScale:{borderColor:F?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:F?"#3b82f6":"#58a6ff",labelBackgroundColor:F?"#eff6ff":"#161b22",width:1},horzLine:{color:F?"#3b82f6":"#58a6ff",labelBackgroundColor:F?"#eff6ff":"#161b22",width:1}}})},[xA,hA]),b.useEffect(()=>{if(!a.current)return;const F=!JA&&!(X!==null&&X!==1&&X!==0),x=!JA;a.current.applyOptions({crosshair:{mode:X===1?1:0,vertLine:{visible:X===1,width:1,color:xA==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:xA==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:X===1,width:1,color:xA==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:xA==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:x,pressedMouseMove:F,horzTouchDrag:F,vertTouchDrag:F},handleScale:{axisPressedMouseMove:{time:F,price:F},axisDoubleClickReset:{time:x,price:x},axisTouch:{time:F,price:F},mouseWheel:x,pinch:x}})},[X,JA]),b.useEffect(()=>{(async()=>{if(!q||!$){j([]),T.current=!1;return}try{if(NA(!0),j([]),T.current=!1,l.current)try{l.current.setData([])}catch{}console.log(`📊 Fetching candles for ${q} @ ${$}`);const F=pu($),x=nv($,F),J=Ge||"https://api-chart-sdk.e-volvo.io",L=Ut?.candles||"/api/chart/candles",W=kr?.candles||{},rA={symbol:W.symbol||"symbol",timeframe:W.timeframe||"timeframe",limit:W.limit||"limit",daysBack:W.daysBack||"daysBack"},Y={};Y[rA.symbol]=q,Y[rA.timeframe]=$,Y[rA.limit]=x,W.daysBack!==!1&&(Y[rA.daysBack]=F);const N=await HA.get(`${J}${L}`,{params:Y,timeout:1e4});let R=[];if(Array.isArray(N.data)?R=N.data:N.data&&N.data.data&&Array.isArray(N.data.data)?R=N.data.data:N.data&&Array.isArray(N.data)&&(R=N.data),R&&R.length>0){console.log(`✅ Loaded ${R.length} raw candles from server`);const{candles:gA,stats:uA}=fc(R,q,$);gA.length>0?(j(gA),le.current=new Map,gA.forEach(D=>{le.current.set(D.time,D)})):(console.warn(`⚠️ No valid candles after processing for ${q}`),j([]))}else console.warn(`⚠️ No candle data returned for ${q}`),j([])}catch(F){console.error(`❌ Error fetching ${q}:`,F.message),j([])}finally{NA(!1)}})()},[q,$]),b.useEffect(()=>{console.log("🔧 [CANDLES DEBUG] Setting up WebSocket for candles:",{baseUrl:Ge,symbol:q,timeframe:$}),ZA.current=Fs.getSocket();const C=ZA.current;console.log("🔌 [CANDLES DEBUG] Socket status for CandlesGateway (ROOT namespace):",{socketId:C.id,connected:C.connected,baseUrl:Ge,socketUrl:C.io?.uri||"unknown",namespace:C.nsp?.name||"/",hasAuth:!!C.auth,note:"This socket MUST connect to root namespace for CandlesGateway"});const F=()=>{if(console.log("📡 [CANDLES DEBUG] subscribeToCandles called:",{selectedSymbol:q,selectedTimeframe:$,connected:C.connected,socketId:C.id}),q&&$&&C.connected){const Y={symbol:q,timeframe:$};console.log("📡 [CANDLES DEBUG] Emitting subscribeCandles:",Y),C.emit("subscribeCandles",Y),console.log("✅ [CANDLES DEBUG] subscribeCandles event emitted successfully")}else console.warn("⚠️ [CANDLES DEBUG] Cannot subscribe to candles:",{selectedSymbol:q,selectedTimeframe:$,connected:C.connected,socketId:C.id,reason:q?$?"Not connected":"No timeframe":"No symbol"})},x=()=>{console.log("✅ [CANDLES DEBUG] Chart WebSocket connected to backend, socket ID:",C.id),setTimeout(()=>{q&&$&&(console.log("📡 [CANDLES DEBUG] Backend connected, subscribing to candles..."),F())},200)},J=Y=>{console.log("⚠️ [CANDLES DEBUG] Chart WebSocket disconnected:",Y)},L=Y=>{console.error("❌ [CANDLES DEBUG] Chart WebSocket connection error:",Y),console.error("❌ [CANDLES DEBUG] Error details:",{message:Y.message,description:Y.description,context:Y.context,type:Y.type})};C.on("connect",x),C.on("disconnect",J),C.on("connect_error",L),C.on("subscription:confirmed",Y=>{console.log("✅ [CANDLES DEBUG] Subscription confirmed:",Y),Y.type==="candles"&&console.log("✅ [CANDLES DEBUG] Candle subscription confirmed for:",{symbol:Y.symbol,timeframe:Y.timeframe})});const W=Y=>{if(console.log("📊 [CANDLES DEBUG] candleUpdate event received:",Y),!Y||!Y.candle||!Y.symbol){console.warn("⚠️ [CANDLES DEBUG] Invalid candleUpdate data:",Y);return}if(console.log("✅ [CANDLES DEBUG] Valid candleUpdate received:",{symbol:Y.symbol,timeframe:Y.timeframe,candle:Y.candle,selectedSymbol:q,selectedTimeframe:$}),Y.symbol.toUpperCase()!==q?.toUpperCase()){console.log(`⚠️ [CANDLES DEBUG] Symbol mismatch: received ${Y.symbol}, selected ${q}`);return}const{candle:N}=Y;console.log("✅ [CANDLES DEBUG] Processing candle update:",{symbol:Y.symbol,timeframe:Y.timeframe,candle:N,candleTime:N.time,candleClose:N.close});const R=dc(N,q,$);if(!R){console.warn("⚠️ [CANDLES DEBUG] Rejected realtime candle (invalid):",{symbol:Y.symbol,candle:N});return}console.log("✅ [CANDLES DEBUG] Processed candle:",{time:R.time,open:R.open,high:R.high,low:R.low,close:R.close});const gA=Date.now();if(gA-vi.current<200)return;vi.current=gA;const uA=a.current?.timeScale(),D=uA?.getVisibleRange(),nA=l.current,z=a.current;if(!(!nA||!z||!T.current))try{console.log("🔄 [CANDLES DEBUG] Updating chart with candle:",{time:R.time,close:R.close,chartType:BA,hasSeries:!!nA,hasChart:!!z,hasInitialized:T.current}),BA==="line"||BA==="area"?(nA.update({time:R.time,value:R.close}),console.log("✅ [CANDLES DEBUG] Chart updated (line/area)")):(nA.update({time:R.time,open:R.open,high:R.high,low:R.low,close:R.close}),console.log("✅ [CANDLES DEBUG] Chart updated (candlestick)")),le.current.set(R.time,R),uA&&D&&V(D),console.log("✅ [CANDLES DEBUG] Candle update completed successfully")}catch(sA){console.error("❌ [CANDLES DEBUG] Error updating candle:",sA),console.error("❌ [CANDLES DEBUG] Error stack:",sA.stack)}};C.on("candleUpdate",W);const rA=()=>{C.connected&&q&&$?(console.log("✅ [CANDLES DEBUG] Socket connected, subscribing to backend..."),F()):console.log("⏳ [CANDLES DEBUG] Waiting for socket connection...",{connected:C.connected,hasSymbol:!!q,hasTimeframe:!!$})};if(C.connected)rA();else{const Y=()=>{console.log("✅ [CANDLES DEBUG] Socket connected to backend, subscribing..."),setTimeout(rA,200)};C.once("connect",Y),setTimeout(()=>{C.connected&&rA()},500)}return()=>{C.off("candleUpdate",W),C.off("connect",x),C.off("disconnect",J),C.off("connect_error",L),C.off("subscription:confirmed"),q&&$&&C.connected&&(console.log(`🔌 Unsubscribing from: ${q}@${$}`),C.emit("unsubscribeCandles",{symbol:q,timeframe:$}))}},[q,$,Ge]),b.useEffect(()=>{const C=l.current,F=a.current;if(!(!C||!F)&&!(P.length===0&&T.current)){if(P.length===0&&!T.current){if(TA)return;const x=F.timeScale();C.setData([]),x.fitContent();return}if(!T.current){const x=F.timeScale(),J=Z(q,$);M.current,M.current=J;const L=[...P].sort((W,rA)=>W.time-rA.time);if(BA==="line"||BA==="area"){const W=L.map(rA=>({time:rA.time,value:rA.close})).filter(rA=>rA.time!=null);W.length>0&&C.setData(W)}else L.length>0&&C.setData(L);if(L.length>0){const W=L[L.length-1].time,rA=ys($)||60,N=W-($==="M1"?150:$==="M5"?120:100)*rA;try{x.setVisibleRange({from:N,to:W+rA*2})}catch{x.fitContent()}}else x.fitContent();try{F.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}T.current=!0,V(x.getVisibleRange())}}},[P.length,BA,q,$]),b.useEffect(()=>{const C=a.current;if(!C||!T.current||P.length===0)return;const F=C.timeScale(),x=F.getVisibleRange()||S();if(l.current)try{C.removeSeries(l.current)}catch{}if(c.current)try{C.removeSeries(c.current),c.current=null}catch{}let J;if(BA==="bars"){const L=xA==="light";J=C.addBarSeries({upColor:L?"#089981":"#26A69A",downColor:L?"#f23645":"#EF5350",borderUpColor:L?"#089981":"#26A69A",borderDownColor:L?"#f23645":"#EF5350",scaleMargins:{top:.1,bottom:.1}});const W=[...P].sort((rA,Y)=>rA.time-Y.time);W.length>0&&J.setData(W)}else if(BA==="line"){J=C.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const L=se(_r);L.length>0&&J.setData(L)}else if(BA==="area"){J=C.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const L=se(_r);L.length>0&&J.setData(L)}else if(BA==="volume ticks"||BA==="volume"){const L=xA==="light";J=C.addCandlestickSeries({upColor:L?"#089981":"#26A69A",downColor:L?"#f23645":"#EF5350",wickUpColor:L?"#089981":"#26A69A",wickDownColor:L?"#f23645":"#EF5350",borderUpColor:L?"#089981":"#26A69A",borderDownColor:L?"#f23645":"#EF5350",borderVisible:!0,priceScaleId:"right"});const W=[...P].sort((N,R)=>N.time-R.time);W.length>0&&J.setData(W);const rA=C.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});C.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),C.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const Y=W.map(N=>({time:N.time,value:N.volume||0,color:N.close>=N.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));Y.length>0&&rA.setData(Y),c.current=rA}else{const L=xA==="light";J=C.addCandlestickSeries({upColor:L?"#089981":"#26A69A",downColor:L?"#f23645":"#EF5350",wickUpColor:L?"#089981":"#26A69A",wickDownColor:L?"#f23645":"#EF5350",borderUpColor:L?"#089981":"#26A69A",borderDownColor:L?"#f23645":"#EF5350",borderVisible:!0,scaleMargins:{top:.1,bottom:.1}});const W=[...P].sort((rA,Y)=>rA.time-Y.time);W.length>0&&J.setData(W)}if(l.current=J,x&&T.current)setTimeout(()=>{try{F.setVisibleRange(x),V(x)}catch{if(P.length>0)try{const W=P[P.length-1].time,rA=W-6e3;F.setVisibleRange({from:rA,to:W}),V(F.getVisibleRange())}catch{F.fitContent(),V(F.getVisibleRange())}}try{C.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!T.current){F.fitContent();try{C.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}T.current=!0,V(F.getVisibleRange())}},[BA,P.length,_r.length]),b.useEffect(()=>{const C=a.current,F=c.current;if(!C||!F||!T.current||P.length===0||BA!=="volume"&&BA!=="volume ticks")return;const J=[...P].sort((L,W)=>L.time-W.time).map(L=>({time:L.time,value:L.volume||0,color:L.close>=L.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));J.length>0&&F.setData(J)},[P,BA]),b.useEffect(()=>{const C=a.current,F=l.current,x=o.current;if(!C||!F||!x)return;const L=X!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","pricelevel","text",null,null,null,null,null,null,null,null,null][X]:null;if(!L){if(d.current=!1,g.current=null,B.current=null,w.current=null,f.current?.series)try{C.removeSeries(f.current.series)}catch{}f.current=null;return}if(L==="pricelevel"){const N=R=>{const gA=x.getBoundingClientRect(),uA=R.clientX-gA.left,D=R.clientY-gA.top,nA=C.timeScale().coordinateToTime(uA),z=F.coordinateToPrice(D);if(nA==null||z==null)return;const iA={type:"pricelevel",priceLine:F.createPriceLine({price:z,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:z.toFixed(5)}),price:z};UA(fA=>[...fA,iA]),u.current.push(iA)};return x.addEventListener("click",N),()=>{x.removeEventListener("click",N)}}if(L==="trendline"){const N=D=>{D.preventDefault(),D.stopPropagation(),D.stopImmediatePropagation();const nA=x.getBoundingClientRect(),z=D.clientX-nA.left,sA=D.clientY-nA.top;let iA=C.timeScale().coordinateToTime(z);const fA=F.coordinateToPrice(sA);if(!(iA==null||fA==null)&&(iA=RA(iA),iA!=null))if(w.current===null){w.current={time:iA,price:fA};const tA=C.addLineSeries({color:"#22c55e",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});f.current={type:"trendline",series:tA},tA.setData([{time:iA,value:fA}])}else{const tA=w.current,aA={time:iA,price:fA},pA=1,MA=1e-5,FA=Math.abs(aA.time-tA.time),kA=Math.abs(aA.price-tA.price);if(FA<pA&&kA<MA){try{C.removeSeries(f.current.series)}catch{}w.current=null,f.current=null;return}const Re={time:tA.time,price:tA.price},We={time:aA.time,price:aA.price},ye=se([{time:Re.time,value:Re.price},{time:We.time,value:We.price}]);if(ye.length>0){f.current.series.setData(ye);const ut={type:"trendline",series:f.current.series,point1:Re,point2:We};UA(Et=>[...Et,ut]),u.current.push(ut)}cA(null),w.current=null,f.current=null}},R=D=>{if(w.current===null||f.current?.type!=="trendline")return;D.preventDefault(),D.stopPropagation();const nA=x.getBoundingClientRect(),z=D.clientX-nA.left,sA=D.clientY-nA.top;let iA=C.timeScale().coordinateToTime(z);const fA=F.coordinateToPrice(sA);if(iA==null||fA==null||(iA=RA(iA),iA==null))return;const tA=w.current,aA=se([{time:tA.time,value:tA.price},{time:iA,value:fA}]);aA.length>0&&f.current.series.setData(aA)},gA=D=>{D.stopPropagation()},uA={capture:!0,passive:!1};return x.addEventListener("click",N,uA),x.addEventListener("mousemove",R,uA),x.addEventListener("mousemove",gA,uA),()=>{if(w.current=null,f.current?.type==="trendline"&&f.current?.series){try{C.removeSeries(f.current.series)}catch{}f.current=null}x.removeEventListener("click",N,uA),x.removeEventListener("mousemove",R,uA),x.removeEventListener("mousemove",gA,uA)}}if(L==="parallellines"){const N={capture:!0,passive:!1},R=z=>{z.preventDefault(),z.stopPropagation(),z.stopImmediatePropagation();const sA=x.getBoundingClientRect(),iA=z.clientX-sA.left,fA=z.clientY-sA.top;let tA=C.timeScale().coordinateToTime(iA);const aA=F.coordinateToPrice(fA);if(tA==null||aA==null||(tA=RA(tA),tA==null))return;const pA={time:tA,price:aA},MA=m.current;if(MA.length===0){m.current=[pA];const FA=C.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});FA.setData([{time:tA,value:aA}]),f.current={type:"parallellines",series:FA,previewLine:null}}else if(MA.length===1){m.current=[MA[0],pA];const FA=se([{time:MA[0].time,value:MA[0].price},{time:tA,value:aA}]);FA.length>0&&f.current.series.setData(FA),f.current.previewLine=C.addLineSeries({color:"#8b5cf6",lineWidth:2,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1});const kA=To(C,F,MA[0],pA,pA);kA&&f.current.previewLine.setData(se([{time:kA[0].time,value:kA[0].price},{time:kA[1].time,value:kA[1].price}]))}else{const[FA,kA]=MA,Re=pA;if(f.current?.previewLine){try{C.removeSeries(f.current.previewLine)}catch{}f.current.previewLine=null}const We=f.current?.series;if(!We)return;const ye=To(C,F,FA,kA,Re);if(!ye)return;const ut=C.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});We.setData(se([{time:FA.time,value:FA.price},{time:kA.time,value:kA.price}])),ut.setData(se([{time:ye[0].time,value:ye[0].price},{time:ye[1].time,value:ye[1].price}]));const Et={type:"parallellines",point1:FA,point2:kA,point3:Re,baseLine:We,parallelLine:ut};UA(Nr=>[...Nr,Et]),u.current.push(Et),cA(null),m.current=[],f.current=null}},gA=z=>{const sA=m.current;if(sA.length!==1||!f.current?.series)return;const iA=x.getBoundingClientRect(),fA=z.clientX-iA.left,tA=z.clientY-iA.top;let aA=C.timeScale().coordinateToTime(fA);const pA=F.coordinateToPrice(tA);if(aA==null||pA==null||(aA=RA(aA),aA==null))return;const MA=se([{time:sA[0].time,value:sA[0].price},{time:aA,value:pA}]);MA.length>0&&f.current.series.setData(MA)},uA=z=>{const sA=m.current;if(sA.length!==2||!f.current?.previewLine)return;const iA=x.getBoundingClientRect(),fA=z.clientX-iA.left,tA=z.clientY-iA.top;let aA=C.timeScale().coordinateToTime(fA);const pA=F.coordinateToPrice(tA);if(aA==null||pA==null||(aA=RA(aA),aA==null))return;const MA={time:aA,price:pA},FA=To(C,F,sA[0],sA[1],MA);FA&&f.current.previewLine.setData(se([{time:FA[0].time,value:FA[0].price},{time:FA[1].time,value:FA[1].price}]))},D=z=>{gA(z),uA(z)},nA=z=>{z.stopPropagation()};return x.addEventListener("click",R,N),x.addEventListener("mousemove",D,N),x.addEventListener("mousemove",nA,N),()=>{if(m.current=[],f.current?.type==="parallellines"){try{f.current.series&&C.removeSeries(f.current.series),f.current.previewLine&&C.removeSeries(f.current.previewLine)}catch{}f.current=null}x.removeEventListener("click",R,N),x.removeEventListener("mousemove",D,N),x.removeEventListener("mousemove",nA,N)}}if(w.current=null,f.current?.type==="trendline"&&f.current?.series){try{C.removeSeries(f.current.series)}catch{}f.current=null}const W=N=>{if(N.preventDefault(),N.stopPropagation(),N.stopImmediatePropagation(),L==="trendline"||L==="parallellines"||L!=="rectangle"&&L!=="fibonacci")return;const R=x.getBoundingClientRect(),gA=N.clientX-R.left,uA=N.clientY-R.top;let D=C.timeScale().coordinateToTime(gA);const nA=F.coordinateToPrice(uA);if(!(D==null||nA==null)&&(D=RA(D),D!=null)){if(d.current=!0,g.current={time:D,price:nA},B.current=null,L==="rectangle"){const z=C.addBaselineSeries({baseValue:{type:"price",price:nA},topLineColor:"#2563eb",bottomLineColor:"#2563eb",topFillColor1:"rgba(59, 130, 246, 0.38)",topFillColor2:"rgba(59, 130, 246, 0.22)",bottomFillColor1:"rgba(59, 130, 246, 0.22)",bottomFillColor2:"rgba(59, 130, 246, 0.38)",priceLineVisible:!1,lastValueVisible:!1,lineWidth:2,lineStyle:0});f.current={type:"rectangle",series:z}}if(L==="fibonacci"){const z=C.addLineSeries({color:"#f59e0b",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});f.current={type:"fibonacci",series:z,priceLines:[]}}if(L==="parallellines"){const z=C.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});f.current={type:"parallellines",series:z,firstLine:null,secondLine:null}}}},rA=N=>{if(!d.current||!g.current||!f.current)return;N.preventDefault(),N.stopPropagation(),N.stopImmediatePropagation();const R=x.getBoundingClientRect(),gA=N.clientX-R.left,uA=N.clientY-R.top;let D=C.timeScale().coordinateToTime(gA);const nA=F.coordinateToPrice(uA);if(D==null||nA==null||(D=RA(D),D==null))return;B.current={time:D,price:nA};const z=g.current;if(f.current.type==="rectangle"){const sA=Math.max(z.price,nA),iA=Math.min(z.price,nA),fA=RA(Math.min(z.time,D)),tA=RA(Math.max(z.time,D));if(fA==null||tA==null||Math.abs(tA-fA)<1||Math.abs(sA-iA)<1e-5)return;const aA=f.current.series;aA.setData(se([{time:fA,value:sA},{time:tA,value:sA}])),aA.applyOptions({baseValue:{type:"price",price:iA}})}if(f.current.type==="fibonacci"){const sA=[{time:z.time,value:z.price},{time:D,value:nA}],iA=se(sA);iA.length>0&&f.current.series.setData(iA),B.current={time:D,price:nA},f.current.priceLines&&(f.current.priceLines.forEach(fA=>{try{F.removePriceLine(fA)}catch{}}),f.current.priceLines=[])}if(f.current.type==="parallellines")if(f.current.firstLine){const sA=f.current.firstLine;sA.endTime-sA.startTime;const iA=sA.endPrice-sA.startPrice,fA=nA,tA=fA+iA;if(f.current.secondLine)f.current.secondLine.setData([{time:z.time,value:fA},{time:D,value:tA}]);else{const aA=C.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});aA.setData([{time:z.time,value:fA},{time:D,value:tA}]),f.current.secondLine=aA}}else f.current.series.setData([{time:z.time,value:z.price},{time:D,value:nA}])},Y=N=>{if(N&&(N.preventDefault(),N.stopPropagation()),!d.current||!f.current||!g.current)return;const R=g.current,gA=B.current||R;if(f.current.type==="parallellines")if(f.current.firstLine){const uA={type:"parallellines",firstLine:f.current.series,secondLine:f.current.secondLine,firstLineData:f.current.firstLine};UA(D=>[...D,uA]),u.current.push(uA),cA(null),f.current=null,d.current=!1,g.current=null,B.current=null;return}else{f.current.firstLine={startTime:R.time,startPrice:R.price,endTime:gA.time,endPrice:gA.price},d.current=!1,g.current=null,B.current=null;return}if(f.current.type==="fibonacci"){const D=(B.current||R).price;if(Math.abs(R.price-D)<1e-4){try{C.removeSeries(f.current.series)}catch{}d.current=!1,g.current=null,B.current=null,f.current=null;return}const nA=Math.max(R.price,D),z=Math.min(R.price,D),sA=nA-z,iA=[{level:0,label:"0.0%"},{level:.236,label:"23.6%"},{level:.382,label:"38.2%"},{level:.5,label:"50.0%"},{level:.618,label:"61.8%"},{level:.786,label:"78.6%"},{level:1,label:"100.0%"}],fA=[],tA=f.current.series;try{C.removeSeries(tA)}catch{}iA.forEach(({level:pA,label:MA})=>{const FA=nA-sA*pA,kA=F.createPriceLine({price:FA,color:pA===0||pA===1?"#f59e0b":"#fbbf24",lineWidth:pA===0||pA===1?2:1,lineStyle:pA===0||pA===1?0:2,axisLabelVisible:!0,title:`${MA} (${FA.toFixed(5)})`,textColor:pA===0||pA===1?"#f59e0b":"#fbbf24"});fA.push(kA)});const aA={type:"fibonacci",priceLines:fA,startPrice:R.price,endPrice:D,high:nA,low:z};UA(pA=>[...pA,aA]),u.current.push(aA),cA(null)}if(f.current.type==="rectangle"){const uA=g.current,D=B.current||uA,nA=Math.max(uA.price,D.price),z=Math.min(uA.price,D.price),sA=RA(Math.min(uA.time,D.time)),iA=RA(Math.max(uA.time,D.time));if(sA!=null&&iA!=null&&Math.abs(iA-sA)>=1&&Math.abs(nA-z)>=1e-5){const fA=f.current.series;fA.setData(se([{time:sA,value:nA},{time:iA,value:nA}])),fA.applyOptions({baseValue:{type:"price",price:z}});const tA={type:"rectangle",timeStart:sA,timeEnd:iA,priceTop:nA,priceBottom:z,series:fA};UA(aA=>[...aA,tA]),u.current.push(tA),cA(null)}else try{C.removeSeries(f.current.series)}catch{}}d.current=!1,g.current=null,B.current=null,f.current=null};if(L==="rectangle"||L==="fibonacci"||L==="parallellines"){const N={capture:!0,passive:!1},R=gA=>{d.current||gA.stopPropagation()};return x.addEventListener("mousedown",W,N),x.addEventListener("mousemove",rA,N),x.addEventListener("mousemove",R,N),x.addEventListener("mouseup",Y,N),()=>{x.removeEventListener("mousedown",W,N),x.removeEventListener("mousemove",rA,N),x.removeEventListener("mousemove",R,N),x.removeEventListener("mouseup",Y,N)}}},[X,UA,cA]),b.useEffect(()=>{const C=a.current,F=l.current,x=o.current,J=X===null||X===1;if(!J||!C||!F||!x){J||(v(null),E([]));return}const L=10,W=8;function rA(uA,D){const nA=vA.filter(z=>z.type==="trendline"&&z.point1&&z.point2);for(let z=nA.length-1;z>=0;z--){const sA=nA[z],iA=C.timeScale().timeToCoordinate(sA.point1.time),fA=F.priceToCoordinate(sA.point1.price),tA=C.timeScale().timeToCoordinate(sA.point2.time),aA=F.priceToCoordinate(sA.point2.price);if(iA==null||fA==null||tA==null||aA==null)continue;const pA=Math.hypot(uA-iA,D-fA),MA=Math.hypot(uA-tA,D-aA);if(pA<L)return{object:sA,mode:"handle1"};if(MA<L)return{object:sA,mode:"handle2"};if(ov(uA,D,iA,fA,tA,aA)<W)return{object:sA,mode:"line"}}return null}const Y=uA=>{uA.preventDefault(),uA.stopPropagation();const D=x.getBoundingClientRect(),nA=uA.clientX-D.left,z=uA.clientY-D.top,sA=rA(nA,z);sA?(v(sA.object),U.current=sA.mode,sA.mode==="line"&&(I.current={x:nA,y:z,point1:{...sA.object.point1},point2:{...sA.object.point2}})):(v(null),U.current=null)},N=uA=>{if(!U.current)return;const D=O.current;if(!D||!D.point1||!D.point2)return;const nA=x.getBoundingClientRect(),z=uA.clientX-nA.left,sA=uA.clientY-nA.top;let iA=C.timeScale().coordinateToTime(z);const fA=F.coordinateToPrice(sA);if(!(iA==null||fA==null)&&(iA=RA(iA),iA!=null)){if(U.current==="handle1"){const tA={time:iA,price:fA},aA=se([{time:tA.time,value:tA.price},{time:D.point2.time,value:D.point2.price}]);aA.length>0&&D.series.setData(aA);const pA={...D,point1:tA};UA(MA=>{const FA=MA.map(kA=>kA===D?pA:kA);return u.current=FA,FA}),v(pA),O.current=pA}else if(U.current==="handle2"){const tA={time:iA,price:fA},aA=se([{time:D.point1.time,value:D.point1.price},{time:tA.time,value:tA.price}]);aA.length>0&&D.series.setData(aA);const pA={...D,point2:tA};UA(MA=>{const FA=MA.map(kA=>kA===D?pA:kA);return u.current=FA,FA}),v(pA),O.current=pA}else if(U.current==="line"){const tA=I.current;if(!tA)return;const aA=C.timeScale().coordinateToTime(tA.x),pA=F.coordinateToPrice(tA.y);if(aA==null||pA==null)return;const MA=iA-aA,FA=fA-pA,kA={time:RA(tA.point1.time+MA),price:tA.point1.price+FA},Re={time:RA(tA.point2.time+MA),price:tA.point2.price+FA},We=se([{time:kA.time,value:kA.price},{time:Re.time,value:Re.price}]);We.length>0&&D.series.setData(We);const ye={...D,point1:kA,point2:Re};UA(ut=>{const Et=ut.map(Nr=>Nr===D?ye:Nr);return u.current=Et,Et}),v(ye),O.current=ye}}},R=()=>{U.current=null,I.current=null},gA={capture:!0,passive:!1};return x.addEventListener("mousedown",Y,gA),x.addEventListener("mousemove",N,gA),x.addEventListener("mouseup",R,gA),()=>{x.removeEventListener("mousedown",Y,gA),x.removeEventListener("mousemove",N,gA),x.removeEventListener("mouseup",R,gA)}},[X,vA,UA]),b.useEffect(()=>{const C=a.current,F=l.current;if(!C||!F)return;const x=()=>{const L=p;if(!L||L.type!=="trendline"||!L.point1||!L.point2){E([]);return}const W=C.timeScale(),rA=W.timeToCoordinate(L.point1.time),Y=F.priceToCoordinate(L.point1.price),N=W.timeToCoordinate(L.point2.time),R=F.priceToCoordinate(L.point2.price);rA!=null&&Y!=null&&N!=null&&R!=null?E([{x:rA,y:Y},{x:N,y:R}]):E([])};x();const J=C.timeScale();return J.subscribeVisibleTimeRangeChange(x),()=>{J.unsubscribeVisibleTimeRangeChange(x)}},[p]),b.useEffect(()=>{!a.current||!l.current||u.current.forEach(C=>{C.series&&C.series.applyOptions({visible:QA}),C.priceLine&&C.priceLine.applyOptions(QA?{color:"#3b82f6",axisLabelVisible:!0,title:typeof C.price=="number"?C.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""}),C.type==="fibonacci"&&C.priceLines&&C.priceLines.forEach(F=>{try{F.applyOptions({lineVisible:QA,axisLabelVisible:QA})}catch{}}),C.type==="rectangle"&&C.series&&C.series.applyOptions({visible:QA}),C.type==="parallellines"&&(C.baseLine&&C.baseLine.applyOptions({visible:QA}),C.parallelLine&&C.parallelLine.applyOptions({visible:QA}),C.firstLine&&C.firstLine.applyOptions({visible:QA}),C.secondLine&&C.secondLine.applyOptions({visible:QA}))})},[QA,vA]),b.useEffect(()=>{!QA&&p&&(v(null),E([]))},[QA,p]),b.useEffect(()=>{if(u.current.length>vA.length){const C=u.current.filter((F,x)=>!vA.includes(F));p&&C.some(F=>F===p)&&(v(null),E([])),C.forEach(F=>{if(F.series&&a.current?.removeSeries(F.series),F.priceLine&&l.current?.removePriceLine(F.priceLine),F.type==="fibonacci"&&F.priceLines&&F.priceLines.forEach(x=>{try{l.current?.removePriceLine(x)}catch{}}),F.type==="rectangle"&&F.series)try{a.current?.removeSeries(F.series)}catch{}if(F.type==="parallellines")try{F.baseLine&&a.current?.removeSeries(F.baseLine),F.parallelLine&&a.current?.removeSeries(F.parallelLine),F.firstLine&&a.current?.removeSeries(F.firstLine),F.secondLine&&a.current?.removeSeries(F.secondLine)}catch{}}),u.current=vA}},[vA,p]),b.useEffect(()=>{const C=l.current;return C?(je.current.forEach(x=>{try{C.removePriceLine(x)}catch{}}),je.current=[],bA.filter(x=>x.symbol===q).forEach(x=>{const J=parseFloat(x.price);if(isNaN(J))return;const W=x.type==="BUY"?"#26A69A":"#EF5350",rA=C.createPriceLine({price:J,color:W,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${x.type} ${x.volume} @ ${x.price}`,textColor:W});je.current.push(rA)}),()=>{je.current.forEach(x=>{try{C.removePriceLine(x)}catch{}}),je.current=[]}):void 0},[bA,q]),h.jsx("div",{className:`flex-1 flex flex-col min-w-0 overflow-hidden ${xA==="light"?"bg-white":"bg-[#12161d]"}`,children:h.jsxs("div",{ref:o,className:"flex-1 w-full h-full relative",style:{cursor:X===1||X!==null?"crosshair":"default",minHeight:0,minWidth:0},onDoubleClick:C=>{a.current&&!d.current&&(C.preventDefault(),C.stopPropagation(),a.current.timeScale().fitContent(),V(a.current.timeScale().getVisibleRange()))},children:[t&&h.jsx("div",{className:"absolute top-3 left-3 z-30",children:h.jsx(yg,{bidPrice:A,askPrice:e,onBuyClick:ko,onSellClick:_o})}),h.jsx(nc,{isOpen:k,onClose:pe,orderType:AA,bidPrice:A,askPrice:e}),QA&&p?.type==="trendline"&&p?.point1&&p?.point2&&y.length===2&&h.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none","aria-hidden":!0,children:y.map((C,F)=>h.jsx("div",{className:"absolute w-[10px] h-[10px] rounded-full border-2 border-white bg-[#22c55e] shadow",style:{left:C.x-5,top:C.y-5}},F))})]})})}),OA={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function wu({style:r,className:A}){const{selectedSymbol:e,setSelectedSymbol:t,symbols:s,symbolsLoading:i}=ne(),[n,o]=b.useState(!1),[a,l]=b.useState(""),[c,u]=b.useState(-1),d=b.useRef(null),g=b.useRef(null);b.useEffect(()=>{const p=v=>{d.current&&!d.current.contains(v.target)&&(o(!1),l(""))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),b.useEffect(()=>{n&&g.current&&g.current.focus()},[n]);const B=s.filter(p=>p.symbol.toLowerCase().includes(a.toLowerCase())),f=B.filter(p=>!p.symbol.endsWith("USDT")),w=B.filter(p=>p.symbol.endsWith("USDT")),m=p=>{t(p),o(!1),l("")};return s.find(p=>p.symbol===e),h.jsxs("div",{ref:d,style:{...OA.container,...r},className:A,children:[h.jsxs("button",{style:OA.button,onClick:()=>o(!n),onMouseEnter:p=>Object.assign(p.currentTarget.style,OA.buttonHover),onMouseLeave:p=>{p.currentTarget.style.borderColor="#334155",p.currentTarget.style.backgroundColor="#1e293b"},children:[h.jsx("span",{children:i?"Loading...":e||"Select Coin"}),h.jsx("span",{style:{...OA.arrow,...n?OA.arrowOpen:{}},children:"▼"})]}),n&&h.jsxs("div",{style:OA.dropdown,children:[h.jsx("div",{style:OA.searchContainer,children:h.jsx("input",{ref:g,style:OA.searchInput,type:"text",placeholder:"Search symbol...",value:a,onChange:p=>l(p.target.value)})}),h.jsx("div",{style:OA.list,children:B.length===0?h.jsx("div",{style:OA.empty,children:"No symbols found"}):h.jsxs(h.Fragment,{children:[f.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{style:OA.categoryLabel,children:"Forex & Metals"}),f.map(p=>h.jsxs("div",{style:{...OA.item,...p.symbol===e?OA.itemSelected:{}},onClick:()=>m(p.symbol),onMouseEnter:v=>{p.symbol!==e&&(v.currentTarget.style.backgroundColor="#334155")},onMouseLeave:v=>{p.symbol!==e&&(v.currentTarget.style.backgroundColor="transparent")},children:[h.jsx("span",{style:OA.symbolName,children:p.symbol}),p.bid&&h.jsx("span",{style:{...OA.symbolPrice,...parseFloat(p.change)>=0?OA.priceUp:OA.priceDown},children:parseFloat(p.bid).toFixed(5)})]},p.symbol))]}),w.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{style:OA.categoryLabel,children:"Crypto"}),w.map(p=>h.jsxs("div",{style:{...OA.item,...p.symbol===e?OA.itemSelected:{}},onClick:()=>m(p.symbol),onMouseEnter:v=>{p.symbol!==e&&(v.currentTarget.style.backgroundColor="#334155")},onMouseLeave:v=>{p.symbol!==e&&(v.currentTarget.style.backgroundColor="transparent")},children:[h.jsx("span",{style:OA.symbolName,children:p.symbol}),p.bid&&h.jsx("span",{style:{...OA.symbolPrice,...parseFloat(p.change)>=0?OA.priceUp:OA.priceDown},children:parseFloat(p.bid).toFixed(2)})]},p.symbol))]})]})})]})]})}const Ve={container:{display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"14px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",padding:0,lineHeight:1,userSelect:"none"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},input:{width:"70px",padding:"4px 6px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"center",outline:"none",boxSizing:"border-box"},presets:{display:"inline-flex",gap:"2px",marginLeft:"4px"},preset:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},presetActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}},lv=[.01,.05,.1,.5,1];function mu({value:r,onChange:A,min:e=.01,max:t=100,step:s=.01,presets:i=lv,showPresets:n=!0,showLabel:o=!0,label:a="Vol",style:l,className:c}){const[u,d]=b.useState(.1),g=r!==void 0?r:u,B=b.useCallback(p=>{const v=Math.max(e,Math.min(t,parseFloat(p)||e)),y=Math.round(v/s)*s,E=parseFloat(y.toFixed(8));r!==void 0||d(E),A?.(E)},[e,t,s,r,A]),f=()=>B(g+s),w=()=>B(g-s),m=(g>=1,g.toFixed(2));return h.jsxs("div",{style:{...Ve.container,...l},className:c,children:[o&&h.jsx("span",{style:Ve.label,children:a}),h.jsx("button",{style:Ve.btn,onClick:w,onMouseEnter:p=>Object.assign(p.currentTarget.style,Ve.btnHover),onMouseLeave:p=>{p.currentTarget.style.borderColor="#334155",p.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),h.jsx("input",{style:Ve.input,type:"text",value:m,onChange:p=>{const v=p.target.value;if(v===""||v==="."||v==="0.")return;const y=parseFloat(v);isNaN(y)||B(y)},onBlur:()=>B(g)}),h.jsx("button",{style:Ve.btn,onClick:f,onMouseEnter:p=>Object.assign(p.currentTarget.style,Ve.btnHover),onMouseLeave:p=>{p.currentTarget.style.borderColor="#334155",p.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),n&&i&&i.length>0&&h.jsx("div",{style:Ve.presets,children:i.map(p=>h.jsx("button",{style:{...Ve.preset,...Math.abs(g-p)<1e-4?Ve.presetActive:{}},onClick:()=>B(p),onMouseEnter:v=>{Math.abs(g-p)>=1e-4&&Object.assign(v.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:v=>{Math.abs(g-p)>=1e-4&&(v.currentTarget.style.borderColor="#334155")},children:p},p))})]})}const Be={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#EF5350",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#EF5350"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#3b1515",borderColor:"#EF5350",color:"#EF5350"}};function Cu({value:r,onChange:A,enabled:e,onEnabledChange:t,mode:s,onModeChange:i,showToggle:n=!0,showModeSwitch:o=!0,showLabel:a=!0,label:l="SL",style:c,className:u}){const{currentSymbolData:d}=ne(),[g,B]=b.useState(""),[f,w]=b.useState(!1),[m,p]=b.useState("price"),v=r!==void 0?r:g,y=e!==void 0?e:f,E=s!==void 0?s:m,U=b.useCallback(M=>{e!==void 0||w(M),t?.(M)},[e,t]),I=b.useCallback(M=>{s!==void 0||p(M),i?.(M)},[s,i]),O=b.useCallback(M=>{r!==void 0||B(M),A?.(M)},[r,A]),T=M=>{const Z=M.target.value;if(Z===""||Z==="."||Z==="0."){O(Z);return}const S=parseFloat(Z);isNaN(S)||O(Z)},lA=E==="price"?d?.bid?parseFloat(d.bid).toFixed(5):"0.00000":"50";return h.jsxs("div",{style:{...Be.container,...c},className:u,children:[a&&h.jsx("span",{style:Be.label,children:l}),n&&h.jsx("button",{style:{...Be.toggle,...y?Be.toggleOn:Be.toggleOff},onClick:()=>U(!y),children:h.jsx("div",{style:{...Be.toggleKnob,...y?Be.knobOn:Be.knobOff}})}),(y||!n)&&h.jsxs("div",{style:Be.inputGroup,children:[h.jsx("input",{style:Be.input,type:"text",value:v,onChange:T,placeholder:lA,onFocus:M=>M.currentTarget.style.borderColor="#EF5350",onBlur:M=>M.currentTarget.style.borderColor="#334155"}),o&&h.jsxs(h.Fragment,{children:[h.jsx("button",{style:{...Be.modeBtn,...E==="price"?Be.modeBtnActive:{}},onClick:()=>I("price"),children:"Price"}),h.jsx("button",{style:{...Be.modeBtn,...E==="pips"?Be.modeBtnActive:{}},onClick:()=>I("pips"),children:"Pips"})]})]})]})}const ge={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function vu({value:r,onChange:A,enabled:e,onEnabledChange:t,mode:s,onModeChange:i,showToggle:n=!0,showModeSwitch:o=!0,showLabel:a=!0,label:l="TP",style:c,className:u}){const{currentSymbolData:d}=ne(),[g,B]=b.useState(""),[f,w]=b.useState(!1),[m,p]=b.useState("price"),v=r!==void 0?r:g,y=e!==void 0?e:f,E=s!==void 0?s:m,U=b.useCallback(M=>{e!==void 0||w(M),t?.(M)},[e,t]),I=b.useCallback(M=>{s!==void 0||p(M),i?.(M)},[s,i]),O=b.useCallback(M=>{r!==void 0||B(M),A?.(M)},[r,A]),T=M=>{const Z=M.target.value;if(Z===""||Z==="."||Z==="0."){O(Z);return}const S=parseFloat(Z);isNaN(S)||O(Z)},lA=E==="price"?d?.ask?parseFloat(d.ask).toFixed(5):"0.00000":"50";return h.jsxs("div",{style:{...ge.container,...c},className:u,children:[a&&h.jsx("span",{style:ge.label,children:l}),n&&h.jsx("button",{style:{...ge.toggle,...y?ge.toggleOn:ge.toggleOff},onClick:()=>U(!y),children:h.jsx("div",{style:{...ge.toggleKnob,...y?ge.knobOn:ge.knobOff}})}),(y||!n)&&h.jsxs("div",{style:ge.inputGroup,children:[h.jsx("input",{style:ge.input,type:"text",value:v,onChange:T,placeholder:lA,onFocus:M=>M.currentTarget.style.borderColor="#26A69A",onBlur:M=>M.currentTarget.style.borderColor="#334155"}),o&&h.jsxs(h.Fragment,{children:[h.jsx("button",{style:{...ge.modeBtn,...E==="price"?ge.modeBtnActive:{}},onClick:()=>I("price"),children:"Price"}),h.jsx("button",{style:{...ge.modeBtn,...E==="pips"?ge.modeBtnActive:{}},onClick:()=>I("pips"),children:"Pips"})]})]})]})}const cv=[{id:1,name:"Crosshair",icon:"+"},{id:2,name:"Trend Line",icon:"╱"},{id:3,name:"Parallel Channel",icon:"═"},{id:4,name:"Fibonacci",icon:"≡"},{id:5,name:"Rectangle",icon:"▭"},{id:6,name:"Price Level",icon:"─"}],Pe={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",marginRight:"4px",whiteSpace:"nowrap"},btn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"14px",cursor:"pointer",transition:"all 0.15s ease",padding:0,position:"relative"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"},btnHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},tooltip:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"11px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:100},divider:{width:"1px",height:"20px",backgroundColor:"#334155",margin:"0 4px"},deleteBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0},deleteBtnHover:{borderColor:"#EF5350",backgroundColor:"#3b1515",color:"#EF5350"},visibilityBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"13px",cursor:"pointer",transition:"all 0.15s ease",padding:0}};function bu({showLabel:r=!0,showDelete:A=!0,showVisibility:e=!0,tools:t,label:s="Draw",style:i,className:n}){const{activeTool:o,setActiveTool:a,drawingsVisible:l,setDrawingsVisible:c,chartObjects:u,setChartObjects:d}=ne(),[g,B]=b.useState(null),f=t||cv,w=v=>{a(o===v?null:v)},m=()=>{d([]),a(null)},p=()=>{c(!l)};return h.jsxs("div",{style:{...Pe.container,...i},className:n,children:[r&&h.jsx("span",{style:Pe.label,children:s}),f.map(v=>h.jsxs("button",{style:{...Pe.btn,...o===v.id?Pe.btnActive:{}},onClick:()=>w(v.id),onMouseEnter:y=>{B(v.id),o!==v.id&&Object.assign(y.currentTarget.style,Pe.btnHover)},onMouseLeave:y=>{B(null),o!==v.id&&(y.currentTarget.style.borderColor="#334155",y.currentTarget.style.backgroundColor="#1e293b",y.currentTarget.style.color="#94a3b8")},title:v.name,children:[v.icon,g===v.id&&h.jsx("div",{style:Pe.tooltip,children:v.name})]},v.id)),(A||e)&&h.jsx("div",{style:Pe.divider}),e&&h.jsx("button",{style:{...Pe.visibilityBtn,...l?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:p,onMouseEnter:v=>{v.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:v=>{v.currentTarget.style.borderColor="#334155"},title:l?"Hide Drawings":"Show Drawings",children:l?"👁":"○"}),A&&h.jsx("button",{style:Pe.deleteBtn,onClick:m,onMouseEnter:v=>Object.assign(v.currentTarget.style,Pe.deleteBtnHover),onMouseLeave:v=>{v.currentTarget.style.borderColor="#334155",v.currentTarget.style.backgroundColor="#1e293b",v.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Qu={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function hv({showCoinSelector:r=!0,showVolumeControl:A=!0,showStopLoss:e=!0,showTakeProfit:t=!0,showDrawingTools:s=!0,showDividers:i=!0,volume:n,onVolumeChange:o,stopLoss:a,onStopLossChange:l,stopLossEnabled:c,onStopLossEnabledChange:u,takeProfit:d,onTakeProfitChange:g,takeProfitEnabled:B,onTakeProfitEnabledChange:f,coinSelectorProps:w={},volumeControlProps:m={},stopLossProps:p={},takeProfitProps:v={},drawingToolsProps:y={},style:E,className:U}){const I=[];r&&I.push(h.jsx(wu,{...w},"coin")),A&&I.push(h.jsx(mu,{value:n,onChange:o,...m},"volume")),e&&I.push(h.jsx(Cu,{value:a,onChange:l,enabled:c,onEnabledChange:u,...p},"sl")),t&&I.push(h.jsx(vu,{value:d,onChange:g,enabled:B,onEnabledChange:f,...v},"tp")),s&&I.push(h.jsx(bu,{...y},"draw"));const O=[];return I.forEach((T,lA)=>{O.push(T),i&&lA<I.length-1&&O.push(h.jsx("div",{style:Qu.divider},`div-${lA}`))}),h.jsx("div",{style:{...Qu.toolbar,...E},className:U,children:O})}const uv=[{label:"M1",value:"M1"},{label:"M5",value:"M5"},{label:"M15",value:"M15"},{label:"M30",value:"M30"},{label:"H1",value:"H1"},{label:"H4",value:"H4"},{label:"D1",value:"D1"},{label:"W1",value:"W1"}],Mo={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function fv({style:r,className:A}){const{selectedTimeframe:e,setSelectedTimeframe:t}=ne();return h.jsx("div",{style:{...Mo.container,...r},className:A,children:uv.map(s=>h.jsx("button",{style:{...Mo.btn,...e===s.value?Mo.btnActive:{}},onClick:()=>t(s.value),onMouseEnter:i=>{e!==s.value&&(i.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:i=>{e!==s.value&&(i.currentTarget.style.borderColor="#334155")},children:s.label},s.value))})}const dv=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Do={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function Bv({style:r,className:A}){const{chartType:e,setChartType:t}=ne();return h.jsx("div",{style:{...Do.container,...r},className:A,children:dv.map(s=>h.jsxs("button",{style:{...Do.btn,...e===s.value?Do.btnActive:{}},onClick:()=>t(s.value),onMouseEnter:i=>{e!==s.value&&(i.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:i=>{e!==s.value&&(i.currentTarget.style.borderColor="#334155")},title:s.label,children:[h.jsx("span",{children:s.icon}),h.jsx("span",{children:s.label})]},s.value))})}const ae={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function gv({volume:r=.1,stopLoss:A,takeProfit:e,onTradeExecuted:t,style:s,className:i}){const{selectedSymbol:n,currentSymbolData:o,setOrders:a,setUserBalance:l}=ne(),[c,u]=b.useState(null),d=parseFloat(o?.bid||0),g=parseFloat(o?.ask||0),B=g>0&&d>0?Math.abs(g-d):0,f=p=>!p||p===0?"-.-----":p>=1e3?p.toFixed(2):p>=1?p.toFixed(4):p.toFixed(5),w=p=>p===0?"-":p>=1?p.toFixed(1):p>=.01?p.toFixed(3):(p*1e4).toFixed(1)+"p",m=b.useCallback(p=>{if(!n)return;const v=p==="BUY"?g:d;if(!v||v<=0){u({type:"error",message:"No price available"});return}const y={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:n,type:p,volume:r,price:v,stopLoss:A?parseFloat(A):null,takeProfit:e?parseFloat(e):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};a(U=>[...U,y]);const E=r*v*.01;l(U=>U-E),u({type:"success",message:`${p} executed`}),t?.(y),setTimeout(()=>u(null),3e3)},[n,g,d,r,A,e,a,l,t]);return h.jsxs("div",{style:{...ae.container,...s},className:i,children:[h.jsx("button",{style:ae.sellBtn,onClick:()=>m("SELL"),onMouseEnter:p=>{Object.assign(p.currentTarget.style,ae.sellBtnHover)},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="#7f1d1d",p.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),h.jsxs("div",{style:ae.priceBox,children:[h.jsx("span",{style:ae.priceLabel,children:"Bid"}),h.jsx("span",{style:{...ae.priceValue,color:"#EF5350"},children:f(d)})]}),h.jsxs("div",{style:ae.spread,children:[h.jsx("span",{style:ae.spreadLabel,children:"Spread"}),h.jsx("span",{style:ae.spreadValue,children:w(B)})]}),h.jsxs("div",{style:ae.priceBox,children:[h.jsx("span",{style:ae.priceLabel,children:"Ask"}),h.jsx("span",{style:{...ae.priceValue,color:"#26A69A"},children:f(g)})]}),h.jsx("button",{style:ae.buyBtn,onClick:()=>m("BUY"),onMouseEnter:p=>{Object.assign(p.currentTarget.style,ae.buyBtnHover)},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="#14532d",p.currentTarget.style.borderColor="#166534"},children:"Buy"}),c&&h.jsx("span",{style:{...ae.status,backgroundColor:c.type==="success"?"#14532d":"#7f1d1d",color:c.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${c.type==="success"?"#166534":"#991b1b"}`},children:c.message})]})}const wA={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function pv({style:r,className:A,maxHeight:e=200}){const{orders:t,setOrders:s,symbols:i,accountSummary:n,setUserBalance:o}=ne(),[a,l]=b.useState(null),c=t.filter(f=>f.status==="OPEN"||!f.closeAt),u=b.useCallback((f,w)=>{const m=i.find(p=>p.symbol===f);return m?parseFloat(w==="BUY"?m.bid||0:m.ask||0):0},[i]),d=b.useCallback(f=>{if(a)return;l(f.id);const w=u(f.symbol,f.type),p=(f.type==="BUY"?w-f.price:f.price-w)*f.volume,v=f.volume*f.price*.01;s(y=>y.filter(E=>E.id!==f.id)),o(y=>y+v+p),l(null)},[a,u,s,o]),g=f=>{const w=parseFloat(f);return!w||isNaN(w)?"-":w>=1e3?w.toFixed(2):w>=1?w.toFixed(4):w.toFixed(5)},B=f=>{const w=parseFloat(f);return isNaN(w)?"-":(w>=0?"+":"")+w.toFixed(2)};return h.jsxs("div",{style:{...wA.container,...r},className:A,children:[h.jsxs("div",{style:wA.header,children:[h.jsxs("span",{style:wA.headerTitle,children:["Positions (",c.length,")"]}),h.jsxs("div",{style:wA.summary,children:[h.jsxs("div",{style:wA.summaryItem,children:[h.jsx("span",{style:wA.summaryLabel,children:"Balance:"}),h.jsxs("span",{style:{...wA.summaryValue,color:"#e2e8f0"},children:["$",n?.balance?.toFixed(2)||"0.00"]})]}),h.jsxs("div",{style:wA.summaryItem,children:[h.jsx("span",{style:wA.summaryLabel,children:"Equity:"}),h.jsxs("span",{style:{...wA.summaryValue,color:(n?.equity||0)>=(n?.balance||0)?"#26A69A":"#EF5350"},children:["$",n?.equity?.toFixed(2)||"0.00"]})]}),h.jsxs("div",{style:wA.summaryItem,children:[h.jsx("span",{style:wA.summaryLabel,children:"Free:"}),h.jsxs("span",{style:{...wA.summaryValue,color:"#94a3b8"},children:["$",n?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),h.jsx("div",{style:{...wA.scrollArea,maxHeight:e},children:h.jsxs("table",{style:wA.table,children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{style:wA.th,children:"Symbol"}),h.jsx("th",{style:wA.th,children:"Type"}),h.jsx("th",{style:wA.th,children:"Volume"}),h.jsx("th",{style:wA.th,children:"Open Price"}),h.jsx("th",{style:wA.th,children:"Current"}),h.jsx("th",{style:wA.th,children:"SL"}),h.jsx("th",{style:wA.th,children:"TP"}),h.jsx("th",{style:wA.th,children:"Profit"}),h.jsx("th",{style:wA.th,children:"Action"})]})}),h.jsx("tbody",{children:c.length===0?h.jsx("tr",{children:h.jsx("td",{colSpan:9,style:wA.emptyRow,children:"No open positions"})}):c.map(f=>{const w=u(f.symbol,f.type),m=f.profit||0;return h.jsxs("tr",{children:[h.jsx("td",{style:{...wA.td,fontWeight:700,color:"#e2e8f0"},children:f.symbol}),h.jsx("td",{style:{...wA.td,...f.type==="BUY"?wA.typeBuy:wA.typeSell},children:f.type}),h.jsx("td",{style:wA.td,children:f.volume}),h.jsx("td",{style:wA.td,children:g(f.price)}),h.jsx("td",{style:wA.td,children:g(w)}),h.jsx("td",{style:wA.td,children:f.stopLoss?g(f.stopLoss):"-"}),h.jsx("td",{style:wA.td,children:f.takeProfit?g(f.takeProfit):"-"}),h.jsx("td",{style:{...wA.td,color:m>=0?"#26A69A":"#EF5350",fontWeight:700},children:B(m)}),h.jsx("td",{style:wA.td,children:h.jsx("button",{style:{...wA.closeBtn,...a===f.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>d(f),disabled:a===f.id,onMouseEnter:p=>{a!==f.id&&(p.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="#7f1d1d"},children:a===f.id?"...":"Close"})})]},f.id)})})]})})]})}var Fu={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},yu=b.createContext&&b.createContext(Fu),wv=["attr","size","title"];function mv(r,A){if(r==null)return{};var e=Cv(r,A),t,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(s=0;s<i.length;s++)t=i[s],!(A.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(e[t]=r[t])}return e}function Cv(r,A){if(r==null)return{};var e={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(A.indexOf(t)>=0)continue;e[t]=r[t]}return e}function mi(){return mi=Object.assign?Object.assign.bind():function(r){for(var A=1;A<arguments.length;A++){var e=arguments[A];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}return r},mi.apply(this,arguments)}function Uu(r,A){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);A&&(t=t.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),e.push.apply(e,t)}return e}function Ci(r){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?Uu(Object(e),!0).forEach(function(t){vv(r,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):Uu(Object(e)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})}return r}function vv(r,A,e){return A=bv(A),A in r?Object.defineProperty(r,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[A]=e,r}function bv(r){var A=Qv(r,"string");return typeof A=="symbol"?A:A+""}function Qv(r,A){if(typeof r!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var t=e.call(r,A);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(r)}function Eu(r){return r&&r.map((A,e)=>b.createElement(A.tag,Ci({key:e},A.attr),Eu(A.child)))}function Oo(r){return A=>b.createElement(Fv,mi({attr:Ci({},r.attr)},A),Eu(r.child))}function Fv(r){var A=e=>{var{attr:t,size:s,title:i}=r,n=mv(r,wv),o=s||e.size||"1em",a;return e.className&&(a=e.className),r.className&&(a=(a?a+" ":"")+r.className),b.createElement("svg",mi({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,t,n,{className:a,style:Ci(Ci({color:r.color||e.color},e.style),r.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),i&&b.createElement("title",null,i),r.children)};return yu!==void 0?b.createElement(yu.Consumer,null,e=>A(e)):A(Fu)}function yv(r){return Oo({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(r)}function Uv(r){return Oo({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(r)}const Ev=({selectedSymbol:r,selectedTimeframe:A,onTimeframeChange:e,chartType:t="candles",onChartTypeChange:s,onNewOrder:i,onZoomIn:n,onZoomOut:o,onToggleBuySell:a,onDownloadChartPNG:l,onToggleFullscreen:c,marketWatchOpen:u=!0,onToggleMarketWatch:d,buySellPanelOpen:g})=>{const{theme:B}=ne(),f=B==="light",w=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],m={bars:h.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),h.jsx("path",{fillRule:"evenodd",d:"M20.999 15.002H19v3a1 1 0 0 1-2.001 0V8H15a1 1 0 1 1 0-2h1.999v-3A1 1 0 1 1 19 3v10h1.999a1 1 0 0 1 0 2Zm-10.999-4H6.999v10a1 1 0 1 1-1.999 0v-3H3a1 1 0 0 1 0-2h2v-11a1 1 0 1 1 1.999 0V9H10a1 1 0 0 1 0 2Z",clipRule:"evenodd",fill:"currentColor"})]}),candles:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:h.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),h.jsx("path",{d:"m2.166 16.571 7.013-7.194c.38-.583 1.116-.273 1.707.256l4.14 2.31 5.136-6.692c.277-.425 1.853-.182 1.853-.182v13.952H2.047a7.772 7.772 0 0 1 .119-2.45Z",opacity:".2",fill:"currentColor"}),h.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),line:h.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),h.jsx("path",{d:"M3.027 18.011a1 1 0 0 1-.81-1.58c.81-1.128 1.5-2.154 2.113-3.065 1.938-2.887 3.22-4.795 5.234-5.042 1.607-.195 3.364.683 6.28 3.212l4.35-6.086a1 1 0 0 1 1.626 1.16l-4.994 6.99a1 1 0 0 1-1.483.16c-2.824-2.552-4.481-3.587-5.536-3.454-1.108.136-2.186 1.742-3.82 4.173-.621.927-1.323 1.971-2.148 3.117a1.001 1.001 0 0 1-.812.415Z",fill:"currentColor"})]}),volume:h.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),h.jsx("path",{fillRule:"evenodd",d:"M19.024 17.844H19a1 1 0 0 1-1-1V13a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1Zm-3 0H16a1 1 0 0 1-1-1v-5.845A1 1 0 0 1 16 10h.024a1 1 0 0 1 1 .999v5.845a1 1 0 0 1-1 1Zm-3 0H13a1 1 0 0 1-1-1V6.999A1 1 0 0 1 13 6h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H10a1 1 0 0 1-1-1V12a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H7a1 1 0 0 1-1-1V9.999A.999.999 0 0 1 7 9h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H4a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1Z",clipRule:"evenodd",fill:"currentColor"})]}),"volume ticks":h.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),h.jsx("path",{fillRule:"evenodd",d:"M20.009 6.993h-.985v3.985a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1V6.993h-.946c-.565 0-1.023-.441-1.023-.985v-.024c0-.543.458-.984 1.023-.984h3.955c.565 0 1.023.441 1.023.984v.024c0 .544-.458.985-1.023.985Zm-3.985 6.14v5.845a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-5.845a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999Zm-4 6.845H12a1 1 0 0 1-1-1V9.133a1 1 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v9.845a1 1 0 0 1-1 1Zm-3 0H9a1 1 0 0 1-1-1v-4.844a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v4.844a1 1 0 0 1-1 1Zm-3 0H6a1 1 0 0 1-1-1v-6.845a.998.998 0 0 1 1-.999h.024a1 1 0 0 1 1 .999v6.845a1 1 0 0 1-1 1Zm-3 0H3a1 1 0 0 1-1-1v-2.845a1 1 0 0 1 1-1h.024a1 1 0 0 1 1 1v2.845a1 1 0 0 1-1 1ZM18 14.134h.024a1 1 0 0 1 1 1v3.844a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-3.844a1 1 0 0 1 1-1Z",clipRule:"evenodd",fill:"currentColor"})]})};return h.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b ${f?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${f?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(p=>h.jsx("button",{onClick:()=>s(p),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
11
+ ${t===p?"text-secondary":f?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
12
+ `,title:p,children:m[p]},p))}),h.jsx("div",{className:`flex items-center gap-1 border-r ${f?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(p=>h.jsx("button",{onClick:()=>s(p),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
13
+ ${t===p?"text-secondary":f?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
+ `,title:p,children:m[p]},p))}),h.jsxs("div",{className:"flex items-center gap-2",children:[w.map(p=>h.jsx("button",{onClick:()=>e(p),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${A===p?"text-secondary":f?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:p},p)),h.jsx("div",{className:`border-r h-6 mx-1 ${f?"border-slate-200":"border-slate-700"}`}),h.jsx("button",{onClick:()=>a?.(),title:g?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${g?f?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":f?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:h.jsxs("g",{fill:"none",fillRule:"evenodd",children:[h.jsx("path",{fill:"#DA5244",d:"M11.5 5v4H9c-1.054 0-1.918.816-1.995 1.85L7 11v2c0 1.105.895 2 2 2h2.5v4H4c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h7.5z"}),h.jsx("path",{fill:"#3687ED",d:"M20 5c1.105 0 2 .895 2 2v10c0 1.105-.895 2-2 2h-7.5v-4H15c1.054 0 1.918-.816 1.995-1.85L17 13v-2c0-1.105-.895-2-2-2h-2.5V5H20z"}),h.jsx("path",{fill:"#B0BEC5",d:"M10 10h4c1.105 0 2 .895 2 2s-.895 2-2 2h-4c-1.105 0-2-.895-2-2s.895-2 2-2z"})]})})}),h.jsxs("button",{onClick:i,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${f?"text-secondary hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[h.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:h.jsxs("g",{fill:"none",fillRule:"evenodd",children:[h.jsx("path",{fill:"#DA5244",d:"M11.5 4v2.02C8.42 6.276 6 8.856 6 12c0 3.145 2.42 5.725 5.5 5.98V20H10c-4.418 0-8-3.582-8-8s3.582-8 8-8h1.5z"}),h.jsx("path",{fill:"#3687ED",d:"M14 4c4.418 0 8 3.582 8 8s-3.582 8-8 8h-1.5v-2.02c3.08-.256 5.5-2.836 5.5-5.98 0-3.145-2.42-5.725-5.5-5.98V4H14z"}),h.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),h.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),h.jsx("div",{className:`border-r ${f?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:n,className:`p-1 ${f?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:h.jsx(yv,{className:"w-5 h-5"})}),h.jsx("button",{onClick:o,className:`p-2 ${f?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:h.jsx(Uv,{className:"w-5 h-5"})}),h.jsx("div",{className:`border-r ${f?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsx("button",{onClick:i,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${f?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:h.jsxs("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[h.jsx("path",{fillRule:"evenodd",d:"M14.057 18.177c.786 0 1.369-.451 1.763-.934.391-.48.699-1.108.954-1.763.474-1.22.861-2.791 1.22-4.312l-2.258.828c-.26 1.04-.527 1.991-.826 2.759-.226.58-.443.982-.64 1.223-.121.15-.194.19-.219.199-.312-.003-.62-.16-.964-.895-.354-.757-.586-1.809-.842-3.019l-.026-.122c-.235-1.108-.497-2.35-.932-3.316-.454-1.009-1.261-2.06-2.715-2.06-1.21 0-2.038.943-2.57 1.82-.562.93-1.022 2.16-1.4 3.449l2.378-.83c.233-.624.478-1.16.734-1.583.472-.78.782-.856.858-.856.26 0 .55.124.891.88.343.763.568 1.818.825 3.033l.004.019c.241 1.138.515 2.43.984 3.433.48 1.025 1.317 2.047 2.781 2.047Zm-.016-1.998s.004-.002.01-.002l-.01.002Z",clipRule:"evenodd"}),h.jsx("path",{d:"m5.752 15.75-2.187.763a94.295 94.295 0 0 0-.554 3.34 1 1 0 1 0 1.978.295c.183-1.226.434-2.799.763-4.397Z"}),h.jsx("path",{fillRule:"evenodd",d:"m16.845 7.46 2.353-.864.068-.191c.216-.585.422-.99.607-1.232A.784.784 0 0 1 20.038 5 1 1 0 0 0 20 3c-.791 0-1.354.485-1.717.96-.365.478-.653 1.102-.893 1.753-.194.526-.375 1.12-.546 1.746Zm3.211-2.47-.009.004c.006-.004.009-.004.009-.004Z",clipRule:"evenodd"}),h.jsx("path",{d:"M21.942 7.664a1 1 0 0 1-.605 1.278l-7 2.5a1 1 0 0 1-.673-1.884l7-2.5a1 1 0 0 1 1.278.606ZM8.86 13.433a1 1 0 1 0-.719-1.866l-6.5 2.5a1 1 0 0 0 .718 1.866l6.5-2.5Z"})]})}),h.jsx("div",{className:`border-r ${f?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsx("button",{onClick:i,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${f?"text-secondary hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:h.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:h.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),h.jsx("div",{className:`border-r ${f?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsx("button",{type:"button",onClick:()=>d?.(),title:u?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${u?f?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":f?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:h.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[h.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14Zm-1 2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h12Z"})]})})]})]})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("button",{type:"button",onClick:()=>l?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${f?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:h.jsx("path",{d:"M22 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0-4a1 1 0 0 1-1-1V4h-1a1 1 0 1 1 0-2h1a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Zm1 7v8a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-8l3.764-1s.45-.428.789-1.105l.171-.342a.998.998 0 0 1 .894-.553h4.764a1 1 0 0 1 .894.552l.171.342c.339.678.789 1.106.789 1.106L23 13Zm-8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm0 4.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3ZM16 4h-2a1 1 0 1 1 0-2h2a1 1 0 1 1 0 2Zm-6 0H8a1 1 0 0 1 0-2h2a1 1 0 1 1 0 2ZM4 22H3a2 2 0 0 1-2-2v-1a1 1 0 1 1 2 0v1h1a1 1 0 1 1 0 2ZM4 4H3v1a1 1 0 0 1-2 0V4a2 2 0 0 1 2-2h1a1 1 0 0 1 0 2ZM2 8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1Zm0 5a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1Z"})})}),h.jsx("button",{type:"button",onClick:()=>c?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${f?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:h.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})})]})]})},xv=()=>{const{activeTool:r,setActiveTool:A,showGrid:e,setShowGrid:t,snapToGrid:s,setSnapToGrid:i,chartObjects:n,setChartObjects:o,drawingsVisible:a,setDrawingsVisible:l,chartLocked:c,setChartLocked:u,theme:d,setTheme:g}=ne(),[B,f]=b.useState(!1),[w,m]=b.useState(null),[p,v]=b.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),y=b.useRef(null),E=b.useRef(null);b.useEffect(()=>{const S=V=>{if(!B)return;const X=y.current;X&&!X.contains(V.target)&&(f(!1),m(null))};return window.addEventListener("mousedown",S),()=>window.removeEventListener("mousedown",S)},[B]),b.useEffect(()=>{const S=V=>{V.key==="Escape"&&(f(!1),m(null))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]);const U=b.useMemo(()=>[{icon:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),h.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z",fill:"currentColor"}),h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 13H15.874C15.5122 14.4056 14.4056 15.5122 13 15.874V20C13 20.2652 12.8946 20.5196 12.7071 20.7071C12.5196 20.8946 12.2652 21 12 21C11.7348 21 11.4804 20.8946 11.2929 20.7071C11.1054 20.5196 11 20.2652 11 20V15.874C9.59439 15.5122 8.4878 14.4056 8.12602 13H4C3.73478 13 3.48043 12.8946 3.29289 12.7071C3.10536 12.5196 3 12.2652 3 12C3 11.7348 3.10536 11.4804 3.29289 11.2929C3.48043 11.1054 3.73478 11 4 11H8.12602C8.4878 9.59439 9.59439 8.4878 11 8.12602V4C11 3.73478 11.1054 3.48043 11.2929 3.29289C11.4804 3.10536 11.7348 3 12 3C12.2652 3 12.5196 3.10536 12.7071 3.29289C12.8946 3.48043 13 3.73478 13 4V8.12602C14.4056 8.4878 15.5122 9.59439 15.874 11H20C20.2652 11 20.5196 11.1054 20.7071 11.2929C20.8946 11.4804 21 11.7348 21 12C21 12.2652 20.8946 12.5196 20.7071 12.7071C20.5196 12.8946 20.2652 13 20 13ZM12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10Z",fill:"currentColor"})]})}),label:"Crosshair",description:"Precise cursor positioning for measurement on chart"},{icon:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:[h.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),h.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})}),label:"Trend Line",description:"Draw trend line (drag from first point to second point)"},{icon:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Parallel Lines",description:"Draw two parallel trend lines (draw first line, then second)"},{icon:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M21 15H3a1 1 0 0 1 0-2h18a1 1 0 0 1 0 2Zm-2-3a2.99 2.99 0 0 1-2.816-2H3a1 1 0 0 1 0-2h13.184A2.995 2.995 0 1 1 19 12Zm0-4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2-3H3a1 1 0 0 1 0-2h18a1 1 0 1 1 0 2ZM5 16a2.99 2.99 0 0 1 2.816 2H21a1 1 0 0 1 0 2H7.816A2.995 2.995 0 1 1 5 16Zm0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})}),label:"Fibonacci",description:"Draw Fibonacci retracement levels"},{icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Rectangle",description:"Draw support/resistance zone (drag from corner to corner)"},{icon:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M4 12h16M4 12v.01M16 12v.01",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}),label:"Price Level",description:"Add horizontal price line (click on chart)"},{icon:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart (coming soon)"},{icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M12.76 17.958c-.504.07-1.016.07-1.52 0C6.07 17.532 2 12.932 2 12c0-.977 4.48-6 10-6s10 5.043 10 6c0 .912-4.07 5.529-9.24 5.958ZM3.63 12a11.724 11.724 0 0 0 3.03 2.741 5.963 5.963 0 0 1 .02-5.492A11.7 11.7 0 0 0 3.63 12ZM12 7.57a4.443 4.443 0 1 0-.006 8.886A4.443 4.443 0 0 0 12 7.57Zm5.31 1.652a5.954 5.954 0 0 1 .01 5.546A11.45 11.45 0 0 0 20.37 12a11.525 11.525 0 0 0-3.06-2.778ZM12 14a2 2 0 1 1 0-4 2 2 0 0 1 0 4Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Eye",description:"Show or hide all drawing objects on chart"},{icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:h.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M16 20H8a2 2 0 0 1-2-2v-7a2 2 0 0 1 1.05-1.749A1.044 1.044 0 0 1 7 9a5 5 0 0 1 8.75-3.3 1.008 1.008 0 0 1-.09 1.411 1 1 0 0 1-1.41-.09A3 3 0 0 0 9 9h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2Zm0-9H8v7h8v-7Zm-4 2a1 1 0 0 1 1 1v1a1 1 0 0 1-2 0v-1a1 1 0 0 1 1-1Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})})}),label:"Lock",description:"Lock chart (disable pan and zoom)"},{icon:h.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),label:"Delete",description:"Remove last drawn object from chart"},{icon:h.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16M6 4v16M12 4v16M18 4v16"})}),label:"Grid",description:"Toggle grid display on/off for chart alignment"},{icon:h.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[h.jsx("circle",{cx:"12",cy:"12",r:"8",strokeWidth:2}),h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l-3 3m6-3l-3-3"})]}),label:"History",description:"Undo/redo actions and view action history"},{icon:h.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[h.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),h.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),h.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),h.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),I=S=>{const V=U[S].label;if(V==="Menu"){f(X=>!X),m(null);return}if(V==="Grid"){t(!e);return}if(V==="Magnet"){i(!s),A(s?null:S);return}if(V==="Delete"){if(n.length>0){const X=[...n];X.pop(),o(X)}return}if(V==="Eye"){l(!a);return}if(V==="Lock"){u(!c);return}if(V==="Light Theme"||V==="Dark Theme"){g(d==="light"?"dark":"light"),f(!1),m(null);return}A(r===S?null:S)},O=U.slice(0,12),T=U.slice(12),lA=[{key:"accounts",label:"Trading accounts",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:h.jsx("path",{d:"M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 14a6 6 0 0 0-5 2 8 8 0 0 0 5 2l5-2a6 6 0 0 0-5-2zm0-12a8 8 0 0 0-6 13 8 8 0 0 1 6-3 8 8 0 0 1 6 3 8 8 0 0 0-6-13zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8zm0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",fill:"currentColor"})})})}),submenu:[{label:"Connect to account",icon:h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Open Demo account",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"M14.5 13.103c1.836 0 3.667.723 5.5 2.14V19l-10.5.5-.5-4.257c1.833-1.417 3.664-2.14 5.5-2.14Z","clip-rule":"evenodd"}),h.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M9.53 15.469 9.5 19l10-.477v-3.032c-1.703-1.27-3.365-1.888-5-1.888-1.626 0-3.277.611-4.97 1.866Zm-.836-.622c1.895-1.465 3.83-2.244 5.806-2.244 1.975 0 3.91.78 5.806 2.244l.194.15v4.48l-12.03.545V15.02l.224-.173Z","clip-rule":"evenodd"}),h.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"m7.736 13.701-.734 2.345L7.001 20H4.5a1 1 0 0 1-1-1v-4c1.412-.669 2.824-1.102 4.236-1.299Z","clip-rule":"evenodd"}),h.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"m7.913 13.678-.475 1.086c-.988.111-1.87.308-2.646.59l-.29.11v3.529H7L7.002 20H4.5a1 1 0 0 1-1-1v-4c1.471-.697 2.942-1.138 4.413-1.322Z","clip-rule":"evenodd"}),h.jsx("path",{fill:"#CDFDDA",d:"M14.5 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"}),h.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M14.5 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z","clip-rule":"evenodd"}),h.jsx("path",{fill:"#00AC00",d:"M11.471 11.979A4.992 4.992 0 0 1 9.5 8c0-.67.131-1.308.37-1.891a3.5 3.5 0 1 0 1.601 5.87Z"}),h.jsx("path",{fill:"#CDFDDA",d:"M9.586 7.07a2.5 2.5 0 1 0 1.153 4.226A4.981 4.981 0 0 1 9.5 8c0-.318.03-.63.086-.93Z"})]})})})}]},{key:"chart",label:"Chart settings",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("g",{clipPath:"url(#a)",children:h.jsx("path",{fillRule:"evenodd","clip-rule":"evenodd",d:"M20 6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6zm-2 3V6h-3v3h3zm-4-3h-4v2.999h4V6zM9 6H6v3l3-.001V6zm-3 4v4l3-.001v-4H6zm0 5v3h3v-3.001H6zm4 3h4v-3.001h-4V18zm5 0h3v-3h-3v3zm3-4v-4h-3v4h3zm-8-.001v-4h4v4h-4z",fill:"currentColor"})})})},{label:"Trade Orders",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),h.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),h.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),h.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Trade Position",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M16 10L12 5H20L16 10Z",fill:"#D95852"}),h.jsx("path",{d:"M16 10H20V11H4V10H16Z",fill:"#D95852"}),h.jsx("path",{d:"M20 13H4V14H8L4 19H12L8 14H20V13Z",fill:"#4682F7"})]})})})},{label:"Trade History",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M4 19L8 14L12 19H4Z",fill:"#3183FF"}),h.jsx("path",{d:"M7 16L17.5 8",stroke:"#3183FF",strokeDasharray:"2 2"}),h.jsx("path",{d:"M13 5L17 10L21 5H13Z",fill:"#EA4C4C"})]})})})},{label:"SL/TP Levels",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"m4.688 17.773-.375.91c.43.277.911.415 1.445.415.614 0 1.104-.15 1.469-.45.367-.299.55-.68.55-1.144 0-.258-.044-.491-.132-.7a1.568 1.568 0 0 0-.387-.55c-.17-.159-.446-.332-.828-.52-.727-.354-1.09-.695-1.09-1.023 0-.198.064-.358.191-.48.13-.126.313-.188.547-.188.396 0 .772.128 1.129.383l.309-.875c-.31-.248-.796-.371-1.457-.371-.508 0-.925.146-1.25.437a1.421 1.421 0 0 0-.485 1.102c0 .237.04.453.121.648.084.195.2.365.352.508.154.14.45.322.887.543.44.219.73.417.87.594.141.177.212.363.212.558 0 .417-.299.625-.895.625-.388 0-.782-.14-1.184-.422ZM8.68 13.277V19h3.601v-.902H9.695v-4.82H8.68ZM20 20H4v1h16v-1Z",fill:"#EA4C4C"}),h.jsx("path",{d:"M10.5 10V7.895c.193.018.346.027.46.027 1.548 0 2.321-.656 2.321-1.969 0-.588-.21-1.02-.629-1.297-.416-.278-1.076-.418-1.98-.418-.115 0-.51.015-1.188.043V10H10.5Zm0-3.008V5.16c.099-.013.202-.02.309-.02.955 0 1.433.298 1.433.891 0 .35-.107.602-.32.758-.214.154-.552.23-1.016.23-.099 0-.234-.009-.406-.027Z",fill:"#3183FF",fillRule:"evenodd","clip-rule":"evenodd"}),h.jsx("path",{d:"M6.914 10V5.18h1.902v-.903H4.078v.903h1.82V10h1.016ZM20 11H4v1h16v-1Z",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"m6.926 14-.418-1.16H4.547L4.148 14H3.02L5.3 8.2h.446l2.3 5.8h-1.12ZM5.523 9.95l-.687 2.113H6.21l-.688-2.114Zm2.86 3.734.375-.91c.4.28.795.421 1.183.421.597 0 .895-.208.895-.625a.886.886 0 0 0-.211-.558c-.14-.177-.431-.375-.871-.594-.438-.221-.733-.402-.887-.543a1.506 1.506 0 0 1-.351-.508 1.682 1.682 0 0 1-.121-.648c0-.443.161-.81.484-1.102.325-.291.742-.437 1.25-.437.661 0 1.147.123 1.457.37l-.309.876a1.909 1.909 0 0 0-1.129-.383c-.234 0-.416.062-.546.187a.635.635 0 0 0-.192.48c0 .33.363.67 1.09 1.024.383.188.659.361.828.52.17.156.298.34.387.55.088.209.133.442.133.7 0 .463-.184.845-.551 1.144-.365.3-.854.45-1.469.45a2.617 2.617 0 0 1-1.445-.414Zm7.613.316-1.594-2.438-.636.872V14H12.75V8.277h1.016v2.739l1.945-2.739h1.156l-1.793 2.5L17.211 14h-1.215ZM3 15h18v1H3z",fill:"#C96057"})})})})},{label:"Chart Controls",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),h.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),h.jsx("path",{d:"M11.2574 18.9959C11.1719 18.9986 11.0861 19 11 19C6.58172 19 3 15.4183 3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11C19 11.0599 18.9993 11.1196 18.998 11.1791L16.9574 10.2813C16.6023 7.3064 14.0705 5 11 5C7.68629 5 5 7.68629 5 11C5 14.191 7.49101 16.8002 10.6345 16.9891L11.2574 18.9959Z",fill:"currentColor"})]})})})},{label:"Trade Notification",icon:h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),h.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Crosshair cursor",icon:h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),h.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"oneclick",label:"One Click Trading",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M20.9914 12.3966L18.9885 11.5954C18.7789 7.91769 15.7302 5 12 5C8.13401 5 5 8.13401 5 12C5 15.7302 7.91769 18.7789 11.5954 18.9885L12.3966 20.9914C12.2651 20.9971 12.1329 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 12.1329 20.9971 12.2651 20.9914 12.3966ZM11 11L21 15L19 17L22 20L20 22L17 19L15 21L11 11Z",fill:"currentColor"})})})})},{key:"theme",label:d==="light"?"Dark Theme":"Light Theme",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"m4.408 12.954-2.265-.756a.209.209 0 0 1 0-.396l2.265-.755a.209.209 0 0 1 .276.198v1.51c0 .143-.14.244-.276.198ZM5.959 7.306 4.89 5.17c-.09-.18.1-.37.28-.28l2.136 1.068a.209.209 0 0 1 .054.334L6.293 7.36c-.1.101-.27.074-.334-.054ZM11.802 21.857l-.755-2.265a.209.209 0 0 1 .198-.276h1.51c.143 0 .244.14.198.276l-.755 2.265a.21.21 0 0 1-.396 0ZM11.802 2.143l-.755 2.265a.209.209 0 0 0 .198.276h1.51c.143 0 .244-.14.198-.276l-.755-2.265a.209.209 0 0 0-.396 0ZM18.83 19.11l-2.137-1.068a.209.209 0 0 1-.054-.335l1.068-1.068c.1-.1.27-.073.334.055l1.069 2.136c.09.18-.101.37-.28.28ZM16.693 5.958 18.83 4.89c.18-.09.37.1.28.28l-1.068 2.136a.209.209 0 0 1-.334.054l-1.068-1.068a.209.209 0 0 1 .054-.334ZM4.89 18.83l1.069-2.136a.209.209 0 0 1 .334-.055l1.068 1.068c.101.101.074.271-.054.335L5.171 19.11c-.18.09-.37-.1-.28-.28ZM21.857 12.198l-2.265.755a.209.209 0 0 1-.276-.198v-1.51c0-.143.14-.244.276-.198l2.265.755a.21.21 0 0 1 0 .396Z",fill:"#FEBC5A"}),h.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{fillRule:"evenodd",d:"M20.775 8.992C20.922 9.638 21 10.31 21 11a8.354 8.354 0 0 0-.787 0c-1.467.072-2.422.564-3.082 1.283l-1.18-1.65c.761-.718 1.697-1.205 2.81-1.452A7 7 0 1 0 12 18c.396-.001.565-.082.63-.12.07-.042.17-.124.295-.34.218-.375.36-.835.534-1.49l1.518 1.822C14.485 19.102 13.705 20 12 20a9 9 0 1 1 8.775-11.008Z","clip-rule":"evenodd",fill:"currentColor"}),h.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),h.jsx("path",{d:"M13.892 14.693c-2.034.46-2.59-1.07-2.892-4.693 3.85.352 5.232 1.05 4.697 3.012L20 17.192s.038 1.023-.361 1.447c-.463.49-1.687.361-1.687.361l-4.06-4.307Z",fill:"currentColor"})]})})}),submenu:[{label:"Green & Red",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),h.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#26a69a"})]})})})},{label:"Blue & Red",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),h.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#578cf2"})]})})})},{label:"Black & White",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),h.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),h.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#76ac85"})]})})})}]},{key:"lang",label:"Language",rightText:"EN",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M17.9 17.39C17.64 16.59 16.89 16 16 16H15V13C15 12.4477 14.5523 12 14 12H8V10H10C10.5523 10 11 9.55228 11 9V7H13C14.1046 7 15 6.10457 15 5V4.59C17.93 5.77 20 8.64 20 12C20 14.08 19.2 15.97 17.9 17.39ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.78 4.21 10.21L9 15V16C9 17.1046 9.89543 18 11 18V19.93ZM12 2C6.47715 2 2 6.47715 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C6.8043 20.9464 9.34784 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 9.34784 20.9464 6.8043 19.0711 4.92893C17.1957 3.05357 14.6522 2 12 2Z",fill:"currentColor"})})})}),submenu:[{label:"English",icon:h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),h.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Arabic",icon:h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),h.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Bulgarian",icon:h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Simplified",icon:h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Traditional",icon:h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Czech",icon:h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Dutch",icon:h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Urdu",icon:h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})}]},{key:"shortcuts",label:"Shortcuts",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM11 18H13V16H11V18ZM12 6C9.79 6 8 7.79 8 10H10C10 8.9 10.9 8 12 8C13.1 8 14 8.9 14 10C14 12 11 11.75 11 15H13C13 12.75 16 12.5 16 10C16 7.79 14.21 6 12 6Z",fill:"currentColor"})})})})},{key:"contact",label:"Contact us",icon:h.jsx(h.Fragment,{children:h.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M5 4C3.89543 4 3 4.89543 3 6V15C3 16.1046 3.89543 17 5 17H5.98719L6 21L13 17H19C20.1046 17 21 16.1046 21 15V6C21 4.89543 20.1046 4 19 4H5ZM6 6H18C18.5128 6 18.9355 6.38604 18.9933 6.88338L19 7V14C19 14.5128 18.614 14.9355 18.1166 14.9933L18 15H12.5339C12.4234 15 12.314 15.0183 12.21 15.0539L12.108 15.0952L8 17.0289V16C8 15.4872 7.61396 15.0645 7.11662 15.0067L7 15H6C5.48716 15 5.06449 14.614 5.00673 14.1166L5 14V7C5 6.48716 5.38604 6.06449 5.88338 6.00673L6 6Z",fillRule:"evenodd","clip-rule":"evenodd",fill:"currentColor"})})})})},{key:"about",label:"About program",icon:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",stroke:"currentColor",strokeWidth:"2"}),h.jsx("path",{d:"M12 10v7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M12 7h.01",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}],M=({item:S})=>{const V=!!S.submenu?.length;return h.jsxs("div",{className:"relative",onMouseEnter:()=>{E.current&&(clearTimeout(E.current),E.current=null),V&&m(S.key)},onMouseLeave:()=>{V&&(E.current=setTimeout(()=>m(null),120))},children:[h.jsxs("button",{type:"button",onClick:()=>{V?m(X=>X===S.key?null:S.key):(S.key==="theme"&&g(X=>X==="light"?"dark":"light"),f(!1),m(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Z?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[h.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Z?"text-slate-500":"text-slate-400"}`,children:S.icon}),h.jsx("span",{className:"flex-1 text-[15px]",children:S.label}),S.rightText&&h.jsx("span",{className:`text-xs ${Z?"text-slate-500":"text-slate-400"}`,children:S.rightText}),V&&h.jsx("svg",{className:`w-4 h-4 ${Z?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),V&&w===S.key&&h.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${Z?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:h.jsx("div",{className:"py-1",children:S.submenu.map((X,cA)=>{const hA=p[S.key]===X.label||X.selected&&p[S.key]==null;return h.jsxs("button",{type:"button",onClick:()=>{v(EA=>({...EA,[S.key]:X.label})),console.log("Sub selected:",S.key,X.label)},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Z?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[h.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Z?"text-slate-500":"text-slate-400"}`,children:X.icon||null}),h.jsx("span",{className:"flex-1 min-w-0",children:X.label}),hA&&h.jsx("span",{className:"w-5 h-5 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},cA)})})})]})},Z=d==="light";return h.jsxs("div",{className:"relative h-full",children:[h.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${Z?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[h.jsx("div",{className:"flex flex-col items-center gap-2",children:O.map((S,V)=>h.jsxs(b.Fragment,{children:[h.jsx("button",{onClick:()=>I(V),className:`w-10 h-10 flex items-center justify-center rounded-md transition-colors duration-150
15
+ ${S.label==="Grid"&&e||S.label==="Eye"&&!a||S.label==="Lock"&&c||r===V?Z?"text-sky-600 bg-sky-100":"text-sky-300 bg-slate-700":Z?"text-slate-600 hover:text-slate-900 hover:bg-slate-100":"text-slate-400 hover:text-slate-100 hover:bg-slate-700"}`,title:`${S.label}: ${S.description}`,children:S.icon}),S.label==="Text"&&h.jsx("div",{className:`w-8 border-t my-1 ${Z?"border-slate-200":"border-slate-700"}`})]},S.label))}),h.jsx("div",{className:"flex-1"}),h.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:T.map((S,V)=>{const X=12+V;return h.jsx("button",{onClick:()=>I(X),className:`w-10 h-10 flex items-center justify-center rounded-md transition-colors duration-150
16
+ ${S.label==="Grid"&&e||S.label==="Eye"&&!a||S.label==="Lock"&&c||r===X?Z?"text-sky-600 bg-sky-100":"text-sky-300 bg-slate-700":Z?"text-slate-600 hover:text-slate-900 hover:bg-slate-100":"text-slate-400 hover:text-slate-100 hover:bg-slate-700"}`,title:`${S.label}: ${S.description}`,children:S.icon},S.label)})})]}),B&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:()=>{f(!1),m(null)},"aria-hidden":"true"}),h.jsxs("div",{ref:y,className:`absolute left-12 top-2 z-50 w-68 border shadow-2xl overflow-visible ${Z?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[h.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${Z?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[h.jsx("span",{className:"absolute top-0 right-0 inline-flex items-center justify-center text-[11px] font-semibold uppercase tracking-wide text-white shadow-md",title:"Demo",style:{backgroundColor:"var(--color-fill-greenHover, #16a34a)",transform:"rotate(45deg) translate(32%, -32%)",transformOrigin:"center",minWidth:"5rem"},children:"Demo"}),h.jsx("div",{className:`text-[16px] font-medium pr-12 ${Z?"text-slate-800":"text-slate-100"}`,children:"Anjolie Macias"}),h.jsx("div",{className:`text-[12px] mt-0.5 ${Z?"text-slate-500":"text-slate-400"}`,children:"5044488330 - MetaQuotes-Demo - Hedge"})]}),h.jsx("div",{className:"py-2",children:lA.map(S=>h.jsx(M,{item:S},S.key))})]})]})]})};function Sv(r){return Oo({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M337.509 305.372h-17.501l-6.571-5.486c20.791-25.232 33.922-57.054 33.922-93.257C347.358 127.632 283.896 64 205.135 64 127.452 64 64 127.632 64 206.629s63.452 142.628 142.225 142.628c35.011 0 67.831-13.167 92.991-34.008l6.561 5.487v17.551L415.18 448 448 415.086 337.509 305.372zm-131.284 0c-54.702 0-98.463-43.887-98.463-98.743 0-54.858 43.761-98.742 98.463-98.742 54.7 0 98.462 43.884 98.462 98.742 0 54.856-43.762 98.743-98.462 98.743z"},child:[]}]})(r)}const Hv=({width:r=256,symbols:A=[],selectedSymbol:e,onSymbolSelect:t,symbolsLoading:s=!1,isOpen:i})=>{const{theme:n}=ne(),o=n==="light",[a,l]=b.useState(""),c=A.filter(g=>g.symbol.toLowerCase().includes(a.toLowerCase())),u=c.filter(g=>!g.symbol.toUpperCase().endsWith("USDT")),d=c.filter(g=>g.symbol.toUpperCase().endsWith("USDT"));return h.jsxs(h.Fragment,{children:[h.jsx("style",{children:`
17
+ .scrollbar-dark::-webkit-scrollbar {
18
+ width: 8px;
19
+ }
20
+ .scrollbar-dark::-webkit-scrollbar-track {
21
+ background: #12161d;
22
+ }
23
+ .scrollbar-dark::-webkit-scrollbar-thumb {
24
+ background: #1e293b;
25
+ border-radius: 4px;
26
+ }
27
+ .scrollbar-dark::-webkit-scrollbar-thumb:hover {
28
+ background: #334155;
29
+ }
30
+ .scrollbar-light::-webkit-scrollbar {
31
+ width: 8px;
32
+ }
33
+ .scrollbar-light::-webkit-scrollbar-track {
34
+ background: #ffffff;
35
+ }
36
+ .scrollbar-light::-webkit-scrollbar-thumb {
37
+ background: #cbd5e1;
38
+ border-radius: 4px;
39
+ }
40
+ .scrollbar-light::-webkit-scrollbar-thumb:hover {
41
+ background: #94a3b8;
42
+ }
43
+ `}),h.jsxs("div",{style:{width:`${r}px`,minWidth:"550px",maxWidth:"1900px"},className:`border-l flex flex-col h-full shrink-0 ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[h.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[h.jsx(Sv,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),h.jsx("input",{type:"text",placeholder:"Search symbol",value:a,onChange:g=>l(g.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),h.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:s?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):c.length===0?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:`text-sm text-center px-4 ${o?"text-slate-700":"text-slate-200"}`,children:A.length===0?"No symbols found. Please check server connection.":"No symbols match your search."})}):h.jsxs("table",{className:"w-full text-xs",children:[h.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:h.jsxs("tr",{children:[h.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),h.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),h.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),h.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change"})]})}),h.jsxs("tbody",{children:[u.length>0&&h.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:h.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?"text-sky-600":"text-sky-400"}`,children:"FOREX"})}),u.map(g=>h.jsxs("tr",{onClick:()=>t(g.symbol),className:`cursor-pointer transition-colors ${e===g.symbol?o?"bg-sky-50 border-l-2 border-sky-500":"bg-slate-800 border-l-2 border-sky-500":o?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[h.jsx("td",{className:`px-3 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:g.symbol}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${g.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:g.bid}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${g.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:g.ask}),h.jsxs("td",{className:`px-3 py-2 text-right font-medium ${g.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[g.change>=0?"+":"",g.change,"%"]})]},g.symbol)),d.length>0&&h.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:h.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?"text-emerald-600":"text-emerald-400"}`,children:"CRYPTO"})}),d.map(g=>h.jsxs("tr",{onClick:()=>t(g.symbol),className:`cursor-pointer transition-colors ${e===g.symbol?o?"bg-sky-50 border-l-2 border-sky-500":"bg-slate-800 border-l-2 border-sky-500":o?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[h.jsx("td",{className:`px-3 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:g.symbol}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${g.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:g.bid}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${g.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:g.ask}),h.jsxs("td",{className:`px-3 py-2 text-right font-medium ${g.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[g.change>=0?"+":"",g.change,"%"]})]},g.symbol))]})]})})]})]})},Lv=({accountSummary:r,orders:A,height:e})=>{const{accountSummary:t,orders:s,theme:i}=ne(),n=r||t,o=A||s,a=i==="light",l=o?.filter(c=>c.status==="OPEN"||!c.closeAt)||[];return h.jsxs("div",{style:{height:e?`${e}px`:"auto"},className:`flex flex-col overflow-hidden ${a?"bg-white border-t border-slate-200":"bg-[#12161d] border-t border-slate-700"}`,children:[h.jsxs("div",{className:`px-4 py-2 border-b flex items-center justify-between ${a?"border-slate-200":"border-slate-700"}`,children:[h.jsx("h3",{className:`text-sm font-semibold ${a?"text-slate-800":"text-slate-200"}`,children:"Account Summary"}),h.jsxs("div",{className:`text-xs ${a?"text-slate-500":"text-slate-400"}`,children:[l.length," Position",l.length!==1?"s":""]})]}),h.jsxs("div",{className:`px-4 py-3 border-b grid grid-cols-3 gap-4 ${a?"border-slate-200":"border-slate-700"}`,children:[h.jsxs("div",{children:[h.jsx("div",{className:`text-xs ${a?"text-slate-500":"text-slate-400"}`,children:"Balance"}),h.jsxs("div",{className:`text-sm font-semibold ${a?"text-slate-800":"text-slate-200"}`,children:["$",n?.balance?.toFixed(2)||"0.00"]})]}),h.jsxs("div",{children:[h.jsx("div",{className:`text-xs ${a?"text-slate-500":"text-slate-400"}`,children:"Equity"}),h.jsxs("div",{className:`text-sm font-semibold ${(n?.equity||0)>=(n?.balance||0)?"text-emerald-500":"text-rose-500"}`,children:["$",n?.equity?.toFixed(2)||"0.00"]})]}),h.jsxs("div",{children:[h.jsx("div",{className:`text-xs ${a?"text-slate-500":"text-slate-400"}`,children:"Free Margin"}),h.jsxs("div",{className:`text-sm font-semibold ${a?"text-slate-800":"text-slate-200"}`,children:["$",n?.freeMargin?.toFixed(2)||"0.00"]})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?h.jsx("div",{className:`flex items-center justify-center h-full ${a?"text-slate-500":"text-slate-400"}`,children:h.jsx("div",{className:"text-sm",children:"No open positions"})}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-xs",children:[h.jsx("thead",{className:`sticky top-0 ${a?"bg-white border-b border-slate-200":"bg-slate-800 border-b border-slate-700"}`,children:h.jsxs("tr",{children:[h.jsx("th",{className:`px-3 py-2 text-left ${a?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),h.jsx("th",{className:`px-3 py-2 text-left ${a?"text-slate-700":"text-slate-300"}`,children:"Type"}),h.jsx("th",{className:`px-3 py-2 text-right ${a?"text-slate-700":"text-slate-300"}`,children:"Volume"}),h.jsx("th",{className:`px-3 py-2 text-right ${a?"text-slate-700":"text-slate-300"}`,children:"Open Price"}),h.jsx("th",{className:`px-3 py-2 text-right ${a?"text-slate-700":"text-slate-300"}`,children:"Profit"})]})}),h.jsx("tbody",{children:l.map(c=>h.jsxs("tr",{className:`${a?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[h.jsx("td",{className:`px-3 py-2 ${a?"text-slate-800":"text-slate-200"}`,children:c.symbol}),h.jsx("td",{className:`px-3 py-2 ${c.type==="BUY"?"text-emerald-500":"text-rose-500"}`,children:c.type}),h.jsx("td",{className:`px-3 py-2 text-right ${a?"text-slate-800":"text-slate-200"}`,children:c.volume}),h.jsx("td",{className:`px-3 py-2 text-right ${a?"text-slate-800":"text-slate-200"}`,children:c.price?.toFixed(4)||"-"}),h.jsxs("td",{className:`px-3 py-2 text-right font-semibold ${(c.profit||0)>=0?"text-emerald-500":"text-rose-500"}`,children:[(c.profit||0)>=0?"+":"",(c.profit||0).toFixed(2)]})]},c.id))})]})})})]})},Iv="1.2.1";dA.AccountPanel=Lv,dA.Chart=av,dA.ChartTypeSelector=Bv,dA.CoinSelector=wu,dA.DrawingTools=bu,dA.LeftSidebar=xv,dA.MarketExecutionModal=nc,dA.MarketWatch=Hv,dA.PositionsPanel=pv,dA.SYMBOL_CONFIG=ac,dA.StopLoss=Cu,dA.TakeProfit=vu,dA.TimeframeSelector=fv,dA.TopBar=Ev,dA.TradePanel=gv,dA.TradingProvider=Fg,dA.TradingToolbar=hv,dA.VolumeControl=mu,dA.alignToTimeframe=kt,dA.detectGaps=Ug,dA.getSymbolConfig=Br,dA.is24x7Symbol=Lg,dA.isCryptoSymbol=Hg,dA.isForexSymbol=Sg,dA.isWithinTradingSession=Eg,dA.normalizeCandleTimes=oc,dA.normalizeTime=RA,dA.processCandles=fc,dA.processSingleCandle=dc,dA.setSocketBaseUrl=sc,dA.timeframeToSeconds=ys,dA.useTrading=ne,dA.validateTimeOrdering=xg,dA.version=Iv,Object.defineProperty(dA,Symbol.toStringTag,{value:"Module"})}));