@nabeeltahirdeveloper/chart-sdk 2.2.2 → 2.3.2

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,23 +1,23 @@
1
- (function(Ve,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):(Ve=typeof globalThis<"u"?globalThis:Ve||self,h(Ve.ChartSDK={},Ve.jsxRuntime,Ve.React))})(this,(function(Ve,h,J){"use strict";var ts=typeof document<"u"?document.currentScript:null;function sA(r){var e=r.width,A=r.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(A<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:A}}function Dt(r,e){return r.width===e.width&&r.height===e.height}var vd=(function(){function r(e){var A=this;this._resolutionListener=function(){return A._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,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(e){var A=this,t={next:e};return this._observers.push(t),{unsubscribe:function(){A._observers=A._observers.filter(function(i){return i!==t})}}},r.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"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 e=this;this._observers.forEach(function(A){return A.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},r})();function yd(r){return new vd(r)}var bd=(function(){function r(e,A,t){var i;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=sA({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=A??(function(n){return n}),this._allowResizeObserver=(i=t?.allowResizeObserver)!==null&&i!==void 0?i:!0,this._chooseAndInitObserver()}return r.prototype.dispose=function(){var e,A;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(A=this._devicePixelRatioObservable)===null||A===void 0||A.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 sA({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),r.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=sA(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},r.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},r.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(A){return A!==e})},Object.defineProperty(r.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),r.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},r.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(A){return A!==e})},r.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},r.prototype._resizeBitmap=function(e){var A=this.bitmapSize;Dt(A,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(A,e))},r.prototype._emitBitmapSizeChanged=function(e,A){var t=this;this._bitmapSizeChangedListeners.forEach(function(i){return i.call(t,e,A)})},r.prototype._suggestNewBitmapSize=function(e){var A=this._suggestedBitmapSize,t=sA(this._transformBitmapSize(e,this._canvasElementClientSize)),i=Dt(this.bitmapSize,t)?null:t;A===null&&i===null||A!==null&&i!==null&&Dt(A,i)||(this._suggestedBitmapSize=i,this._emitSuggestedBitmapSizeChanged(A,i))},r.prototype._emitSuggestedBitmapSizeChanged=function(e,A){var t=this;this._suggestedBitmapSizeChangedListeners.forEach(function(i){return i.call(t,e,A)})},r.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}Qd().then(function(A){return A?e._initResizeObserver():e._initDevicePixelRatioObservable()})},r.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var A=ml(this._canvasElement);if(A===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=yd(A),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},r.prototype._invalidateBitmapSize=function(){var e,A;if(this._canvasElement!==null){var t=ml(this._canvasElement);if(t!==null){var i=(A=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&A!==void 0?A:t.devicePixelRatio,n=this._canvasElement.getClientRects(),s=n[0]!==void 0?xd(n[0],i):sA({width:this._canvasElementClientSize.width*i,height:this._canvasElementClientSize.height*i});this._suggestNewBitmapSize(s)}}},r.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(A){var t=A.find(function(s){return s.target===e._canvasElement});if(!(!t||!t.devicePixelContentBoxSize||!t.devicePixelContentBoxSize[0])){var i=t.devicePixelContentBoxSize[0],n=sA({width:i.inlineSize,height:i.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},r})();function Td(r,e){return new bd(r,e.transform,e.options)}function ml(r){return r.ownerDocument.defaultView}function Qd(){return new Promise(function(r){var e=new ResizeObserver(function(A){r(A.every(function(t){return"devicePixelContentBoxSize"in t})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function xd(r,e){return sA({width:Math.round(r.left*e+r.width*e)-Math.round(r.left*e),height:Math.round(r.top*e+r.height*e)-Math.round(r.top*e)})}var Fd=(function(){function r(e,A,t){if(A.width===0||A.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=A,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=e}return r.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},r.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({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 kt(r,e){var A=r.canvasElementClientSize;if(A.width===0||A.height===0)return null;var t=r.bitmapSize;if(t.width===0||t.height===0)return null;var i=r.canvasElement.getContext("2d",e);return i===null?null:new Fd(i,A,t)}const Ud={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Ed={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Sd={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Hd={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},Ld={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},Md={color:"#26a69a",base:0},Bl={color:"#2196f3"},wl={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 Cl,vl;function Ot(r,e){const A={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]}[e];r.setLineDash(A)}function yl(r,e,A,t){r.beginPath();const i=r.lineWidth%2?.5:0;r.moveTo(A,e+i),r.lineTo(t,e+i),r.stroke()}function vt(r,e){if(!r)throw new Error("Assertion failed"+(e?": "+e:""))}function EA(r){if(r===void 0)throw new Error("Value is undefined");return r}function ue(r){if(r===null)throw new Error("Value is null");return r}function jt(r){return ue(EA(r))}(function(r){r[r.Simple=0]="Simple",r[r.WithSteps=1]="WithSteps",r[r.Curved=2]="Curved"})(Cl||(Cl={})),(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"})(vl||(vl={}));const bl={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 VA(r){return r<0?0:r>255?255:Math.round(r)||0}function Tl(r){return r<=0||r>1?Math.min(Math.max(r,0),1):Math.round(1e4*r)/1e4}const Id=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,_d=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Dd=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,kd=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function yr(r){(r=r.toLowerCase())in bl&&(r=bl[r]);{const e=kd.exec(r)||Dd.exec(r);if(e)return[VA(parseInt(e[1],10)),VA(parseInt(e[2],10)),VA(parseInt(e[3],10)),Tl(e.length<5?1:parseFloat(e[4]))]}{const e=_d.exec(r);if(e)return[VA(parseInt(e[1],16)),VA(parseInt(e[2],16)),VA(parseInt(e[3],16)),1]}{const e=Id.exec(r);if(e)return[VA(17*parseInt(e[1],16)),VA(17*parseInt(e[2],16)),VA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${r}`)}function Ql(r){return .199*r[0]+.687*r[1]+.114*r[2]}function mi(r){const e=yr(r);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Ql(e)>160?"black":"white"}}class uA{constructor(){this.h=[]}l(e,A,t){const i={o:e,_:A,u:t===!0};this.h.push(i)}v(e){const A=this.h.findIndex((t=>e===t.o));A>-1&&this.h.splice(A,1)}p(e){this.h=this.h.filter((A=>A._!==e))}m(e,A,t){const i=[...this.h];this.h=this.h.filter((n=>!n.u)),i.forEach((n=>n.o(e,A,t)))}M(){return this.h.length>0}S(){this.h=[]}}function JA(r,...e){for(const A of e)for(const t in A)A[t]!==void 0&&Object.prototype.hasOwnProperty.call(A,t)&&!["__proto__","constructor","prototype"].includes(t)&&(typeof A[t]!="object"||r[t]===void 0||Array.isArray(A[t])?r[t]=A[t]:JA(r[t],A[t]));return r}function tt(r){return typeof r=="number"&&isFinite(r)}function br(r){return typeof r=="number"&&r%1==0}function Tr(r){return typeof r=="string"}function Bi(r){return typeof r=="boolean"}function pt(r){const e=r;if(!e||typeof e!="object")return e;let A,t,i;for(t in A=Array.isArray(e)?[]:{},e)e.hasOwnProperty(t)&&(i=e[t],A[t]=i&&typeof i=="object"?pt(i):i);return A}function Od(r){return r!==null}function Qr(r){return r===null?void 0:r}const rs="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function er(r,e,A){return e===void 0&&(e=rs),`${A=A!==void 0?`${A} `:""}${r}px ${e}`}class Nd{constructor(e){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=e}W(){const e=this.k,A=this.j(),t=this.H();return e.P===A&&e.D===t||(e.P=A,e.D=t,e.R=er(A,t),e.L=2.5/12*A,e.B=e.L,e.A=A/12*e.T,e.I=A/12*e.T,e.N=0),e.V=this.$(),e.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 is{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,A,t){this.Y.forEach((i=>{i.X(e,A,t)}))}}class ZA{X(e,A,t){e.useBitmapCoordinateSpace((i=>this.K(i,A,t)))}}class Kd extends ZA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t}){if(this.G===null||this.G.tt===null)return;const i=this.G.tt,n=this.G,s=Math.max(1,Math.floor(A))%2/2,o=l=>{e.beginPath();for(let a=i.to-1;a>=i.from;--a){const c=n.it[a],u=Math.round(c.nt*A)+s,m=c.st*t,y=l*t+s;e.moveTo(u,m),e.arc(u,m,y,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function Pd(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Vd={from:0,to:1};class zd{constructor(e,A){this.ut=new is,this.ct=[],this.dt=[],this.ft=!0,this.F=e,this.vt=A,this.ut.Z(this.ct)}bt(e){const A=this.F.wt();A.length!==this.ct.length&&(this.dt=A.map(Pd),this.ct=this.dt.map((t=>{const i=new Kd;return i.J(t),i})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const e=this.vt.W().mode===2,A=this.F.wt(),t=this.vt.xt(),i=this.F.St();A.forEach(((n,s)=>{var o;const l=this.dt[s],a=n.kt(t);if(e||a===null||!n.yt())return void(l.tt=null);const c=ue(n.Ct());l.lt=a.Tt,l.ht=a.ht,l.et=a.Pt,l.it[0]._t=a._t,l.it[0].st=n.Dt().Rt(a._t,c.Vt),l.rt=(o=a.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=t,l.it[0].nt=i.It(t),l.tt=Vd}))}}let Gd=class extends ZA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:A,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*t),l=Math.round(this.zt.st*i);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*t),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,Ot(e,this.zt.Lt.Nt),(function(a,c,u,m){a.beginPath();const y=a.lineWidth%2?.5:0;a.moveTo(c+y,u),a.lineTo(c+y,m),a.stroke()})(e,o,0,A.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*i),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,Ot(e,this.zt.Et.Nt),yl(e,l,0,A.width))}};class Wd{constructor(e){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 Gd(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.yt(),A=ue(this.jt.Ht()),t=A.$t().W().crosshair,i=this.Ft;if(t.mode===2)return i.Et.yt=!1,void(i.Lt.yt=!1);i.Et.yt=e&&this.jt.Ut(A),i.Lt.yt=e&&this.jt.qt(),i.Et.et=t.horzLine.width,i.Et.Nt=t.horzLine.style,i.Et.V=t.horzLine.color,i.Lt.et=t.vertLine.width,i.Lt.Nt=t.vertLine.style,i.Lt.V=t.vertLine.color,i.nt=this.jt.Yt(),i.st=this.jt.Zt()}}function Rd(r,e,A,t,i,n){r.fillRect(e+n,A,t-2*n,n),r.fillRect(e+n,A+i-n,t-2*n,n),r.fillRect(e,A,n,i),r.fillRect(e+t-n,A,n,i)}function wi(r,e,A,t,i,n){r.save(),r.globalCompositeOperation="copy",r.fillStyle=n,r.fillRect(e,A,t,i),r.restore()}function xl(r,e,A,t,i,n){r.beginPath(),r.roundRect?r.roundRect(e,A,t,i,n):(r.lineTo(e+t-n[1],A),n[1]!==0&&r.arcTo(e+t,A,e+t,A+n[1],n[1]),r.lineTo(e+t,A+i-n[2]),n[2]!==0&&r.arcTo(e+t,A+i,e+t-n[2],A+i,n[2]),r.lineTo(e+n[3],A+i),n[3]!==0&&r.arcTo(e,A+i,e,A+i-n[3],n[3]),r.lineTo(e,A+n[0]),n[0]!==0&&r.arcTo(e,A,e+n[0],A,n[0]))}function Fl(r,e,A,t,i,n,s=0,o=[0,0,0,0],l=""){if(r.save(),!s||!l||l===n)return xl(r,e,A,t,i,o),r.fillStyle=n,r.fill(),void r.restore();const a=s/2;var c;xl(r,e+a,A+a,t-s,i-s,(c=-a,o.map((u=>u===0?u:u+c)))),n!=="transparent"&&(r.fillStyle=n,r.fill()),l!=="transparent"&&(r.lineWidth=s,r.strokeStyle=l,r.closePath(),r.stroke()),r.restore()}function Ul(r,e,A,t,i,n,s){r.save(),r.globalCompositeOperation="copy";const o=r.createLinearGradient(0,0,0,i);o.addColorStop(0,n),o.addColorStop(1,s),r.fillStyle=o,r.fillRect(e,A,t,i),r.restore()}class El{constructor(e,A){this.J(e,A)}J(e,A){this.zt=e,this.Xt=A}At(e,A){return this.zt.yt?e.P+e.L+e.B:0}X(e,A,t,i){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const a=l.context;a.font=A.R;const c=this.Gt(l,A,t,i),u=c.Jt;return c.Qt?Fl(a,u.ti,u.ii,u.ni,u.si,s,u.ei,[u.ht,0,0,u.ht],s):Fl(a,u.ri,u.ii,u.ni,u.si,s,u.ei,[0,u.ht,u.ht,0],s),this.zt.hi&&(a.fillStyle=n,a.fillRect(u.ri,u.li,u.ai-u.ri,u.oi)),this.zt._i&&(a.fillStyle=A.O,a.fillRect(c.Qt?u.ui-u.ei:0,u.ii,u.ei,u.ci-u.ii)),c}));e.useMediaCoordinateSpace((({context:l})=>{const a=o.di;l.font=A.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,a.fi,(a.ii+a.ci)/2+a.pi)}))}Gt(e,A,t,i){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:a,verticalPixelRatio:c}=e,u=this.zt.hi||!this.zt.mi?A.T:0,m=this.zt.bi?A.C:0,y=A.L+this.Xt.wi,B=A.B+this.Xt.gi,p=A.A,Q=A.I,D=this.zt.Kt,F=A.P,_=t.Mi(s,D),L=Math.ceil(t.xi(s,D)),k=F+y+B,V=A.C+p+Q+L+u,Z=Math.max(1,Math.floor(c));let $=Math.round(k*c);$%2!=Z%2&&($+=1);const z=m>0?Math.max(1,Math.floor(m*a)):0,R=Math.round(V*a),X=Math.round(u*a),se=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,ae=Math.round(se*c)-Math.floor(.5*c),ye=Math.floor(ae+Z/2-$/2),Le=ye+$,Qe=i==="right",xe=Qe?l.width-m:m,Se=Qe?o.width-z:z;let pe,Be,Ce;return Qe?(pe=Se-R,Be=Se-X,Ce=xe-u-p-m):(pe=Se+R,Be=Se+X,Ce=xe+u+p),{Qt:Qe,Jt:{ii:ye,li:ae,ci:Le,ni:R,si:$,ht:2*a,ei:z,ti:pe,ri:Se,ai:Be,oi:Z,ui:o.width},di:{ii:ye/c,ci:Le/c,fi:Ce,pi:_}}}}class Ci{constructor(e){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(e||El)(this.Ci,this.yi),this.Ri=new(e||El)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(e,A=!1){return Math.max(this.Pi.At(e,A),this.Ri.At(e,A))}Vi(){return this.yi.Si||0}Oi(e){this.yi.Si=e}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(e){return this.Di(),this.Ci.hi=this.Ci.hi&&e.W().ticksVisible,this.Ti.hi=this.Ti.hi&&e.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 $d extends Ci{constructor(e,A,t){super(),this.jt=e,this.Li=A,this.Ei=t}zi(e,A,t){if(e.yt=!1,this.jt.W().mode===2)return;const i=this.jt.W().horzLine;if(!i.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=mi(i.labelBackgroundColor);t.t=s.t,e.V=s.i;const o=2/12*this.Li.P();t.wi=o,t.gi=o;const l=this.Ei(this.Li);t.ki=l.ki,e.Kt=this.Li.Fi(l._t,n),e.yt=!0}}const Xd=/[1-9]/g;class Sl{constructor(){this.zt=null}J(e){this.zt=e}X(e,A){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const t=e.useMediaCoordinateSpace((({context:m})=>(m.font=A.R,Math.round(A.Wi.xi(m,ue(this.zt).Kt,Xd)))));if(t<=0)return;const i=A.ji,n=t+2*i,s=n/2,o=this.zt.Hi;let l=this.zt.ki,a=Math.floor(l-s)+.5;a<0?(l+=Math.abs(0-a),a=Math.floor(l-s)+.5):a+n>o&&(l-=Math.abs(o-(a+n)),a=Math.floor(l-s)+.5);const c=a+n,u=Math.ceil(0+A.C+A.T+A.L+A.P+A.B);e.useBitmapCoordinateSpace((({context:m,horizontalPixelRatio:y,verticalPixelRatio:B})=>{const p=ue(this.zt);m.fillStyle=p.t;const Q=Math.round(a*y),D=Math.round(0*B),F=Math.round(c*y),_=Math.round(u*B),L=Math.round(2*y);if(m.beginPath(),m.moveTo(Q,D),m.lineTo(Q,_-L),m.arcTo(Q,_,Q+L,_,L),m.lineTo(F-L,_),m.arcTo(F,_,F,_-L,L),m.lineTo(F,D),m.fill(),p.hi){const k=Math.round(p.ki*y),V=D,Z=Math.round((V+A.T)*B);m.fillStyle=p.V;const $=Math.max(1,Math.floor(y)),z=Math.floor(.5*y);m.fillRect(k-z,V,$,Z-V)}})),e.useMediaCoordinateSpace((({context:m})=>{const y=ue(this.zt),B=0+A.C+A.T+A.L+A.P/2;m.font=A.R,m.textAlign="left",m.textBaseline="middle",m.fillStyle=y.V;const p=A.Wi.Mi(m,"Apr0");m.translate(a+i,B+p),m.fillText(y.Kt,0,0)}))}}class Jd{constructor(e,A,t){this.ft=!0,this.Wt=new Sl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=A,this.Ei=t}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const A=this.vt.W().vertLine;if(!A.labelVisible)return;const t=this.$i.St();if(t.Ni())return;e.Hi=t.Hi();const i=this.Ei();if(i===null)return;e.ki=i.ki;const n=t.Ui(this.vt.xt());e.Kt=t.qi(ue(n)),e.yt=!0;const s=mi(A.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=t.W().ticksVisible}}class ns{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(e){this.Zi=e}Dt(){return this.Yi}Gi(e){this.Yi=e}Ji(e){return[]}Qi(){return[]}yt(){return!0}}var Hl;(function(r){r[r.Normal=0]="Normal",r[r.Magnet=1]="Magnet",r[r.Hidden=2]="Hidden"})(Hl||(Hl={}));class Zd extends ns{constructor(e,A){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=e,this.cn=A,this.dn=new zd(e,this),this.fn=((i,n)=>s=>{const o=n(),l=i();if(s===ue(this.tn).vn())return{_t:l,ki:o};{const a=ue(s.Ct());return{_t:s.pn(o,a),ki:o}}})((()=>this.nn),(()=>this.an));const t=((i,n)=>()=>{const s=this.$i.St().mn(i()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new Jd(this,e,t),this.wn=new Wd(this)}W(){return this.cn}gn(e,A){this._n=e,this.un=A}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(e,A,t){this.hn||(this.hn=!0),this.en=!0,this.yn(e,A,t)}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(e){return this.tn!==null?[this.wn,this.dn]:[]}Ut(e){return e===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(e,A){this.en&&this.tn===e||this.rn.clear();const t=[];return this.tn===e&&t.push(this.Dn(this.rn,A,this.fn)),t}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach((e=>e.bt())),this.bn.bt(),this.dn.bt()}On(e){return e&&!e.vn().Ni()?e.vn():null}yn(e,A,t){this.Bn(e,A,t)&&this.Vn()}Bn(e,A,t){const i=this.ln,n=this.an,s=this.nn,o=this.sn,l=this.tn,a=this.On(t);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=t;const c=a!==null?a.Ct():null;return a!==null&&c!==null?(this.nn=A,this.an=a.Rt(A,c)):(this.nn=NaN,this.an=NaN),i!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||l!==this.tn}Tn(){const e=this.$i.wt().map((t=>t.In().An())).filter(Od),A=e.length===0?null:Math.max(...e);this.sn=A!==null?A:NaN}Dn(e,A,t){let i=e.get(A);return i===void 0&&(i=new $d(this,A,t),e.set(A,i)),i}}function vi(r){return r==="left"||r==="right"}class CA{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,A){const t=(function(i,n){return i===void 0?n:{Fn:Math.max(i.Fn,n.Fn),Wn:i.Wn||n.Wn}})(this.zn.get(e),A);this.zn.set(e,t)}jn(){return this.En}Hn(e){const A=this.zn.get(e);return A===void 0?{Fn:this.En}:{Fn:Math.max(this.En,A.Fn),Wn:A.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(e){this.Un(),this.Ln=[{qn:1,Vt:e}]}Zn(e){this.Xn(),this.Ln.push({qn:5,Vt:e})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(e){this.Un(),this.Ln.push({qn:2,Vt:e})}Jn(e){this.Un(),this.Ln.push({qn:3,Vt:e})}Qn(){return this.Ln}ts(e){for(const A of e.Ln)this.ns(A);this.En=Math.max(this.En,e.En),e.zn.forEach(((A,t)=>{this.Nn(t,A)}))}static ss(){return new CA(2)}static es(){return new CA(3)}ns(e){switch(e.qn){case 0:this.$n();break;case 1:this.Yn(e.Vt);break;case 2:this.Gn(e.Vt);break;case 3:this.Jn(e.Vt);break;case 4:this.Kn();break;case 5:this.Zn(e.Vt);break;case 6:this.Xn()}}Xn(){const e=this.Ln.findIndex((A=>A.qn===5));e!==-1&&this.Ln.splice(e,1)}}const Ll=".";function gt(r,e){if(!tt(r))return"n/a";if(!br(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?r.toString():("0000000000000000"+r.toString()).slice(-e)}class yi{constructor(e,A){if(A||(A=1),tt(e)&&br(e)||(e=100),e<0)throw new TypeError("invalid base");this.Li=e,this.rs=A,this.hs()}format(e){const A=e<0?"−":"";return e=Math.abs(e),A+this.ls(e)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let e=this.Li;for(;e>1;)e/=10,this._s++}}ls(e){const A=this.Li/this.rs;let t=Math.floor(e),i="";const n=this._s!==void 0?this._s:NaN;if(A>1){let s=+(Math.round(e*A)-t*A).toFixed(this._s);s>=A&&(s-=A,t+=1),i=Ll+gt(+s.toFixed(this._s)*this.rs,n)}else t=Math.round(t*A)/A,n>0&&(i=Ll+gt(0,n));return t.toFixed(0)+i}}class Ml extends yi{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class qd{constructor(e){this.us=e}format(e){let A="";return e<0&&(A="-",e=-e),e<995?A+this.cs(e):e<999995?A+this.cs(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),A+this.cs(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),A+this.cs(e/1e9)+"B")}cs(e){let A;const t=Math.pow(10,this.us);return A=(e=Math.round(e*t)/t)>=1e-15&&e<1?e.toFixed(this.us).replace(/\.?0+$/,""):String(e),A.replace(/(\.[1-9]*)0+$/,((i,n)=>n))}}function Il(r,e,A,t,i,n,s){if(e.length===0||t.from>=e.length||t.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:a}=r,c=e[t.from];let u=n(r,c),m=c;if(t.to-t.from<2){const y=i/2;o.beginPath();const B={nt:c.nt-y,st:c.st},p={nt:c.nt+y,st:c.st};o.moveTo(B.nt*l,B.st*a),o.lineTo(p.nt*l,p.st*a),s(r,u,B,p)}else{const y=(p,Q)=>{s(r,u,m,Q),o.beginPath(),u=p,m=Q};let B=m;o.beginPath(),o.moveTo(c.nt*l,c.st*a);for(let p=t.from+1;p<t.to;++p){B=e[p];const Q=n(r,B);switch(A){case 0:o.lineTo(B.nt*l,B.st*a);break;case 1:o.lineTo(B.nt*l,e[p-1].st*a),Q!==u&&(y(Q,B),o.lineTo(B.nt*l,e[p-1].st*a)),o.lineTo(B.nt*l,B.st*a);break;case 2:{const[D,F]=Yd(e,p-1,p);o.bezierCurveTo(D.nt*l,D.st*a,F.nt*l,F.st*a,B.nt*l,B.st*a);break}}A!==1&&Q!==u&&(y(Q,B),o.moveTo(B.nt*l,B.st*a))}(m!==B||m===B&&A===1)&&s(r,u,m,B)}}const _l=6;function ss(r,e){return{nt:r.nt-e.nt,st:r.st-e.st}}function Dl(r,e){return{nt:r.nt/e,st:r.st/e}}function Yd(r,e,A){const t=Math.max(0,e-1),i=Math.min(r.length-1,A+1);var n,s;return[(n=r[e],s=Dl(ss(r[A],r[t]),_l),{nt:n.nt+s.nt,st:n.st+s.st}),ss(r[A],Dl(ss(r[i],r[e]),_l))]}function jd(r,e,A,t,i){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(i.nt*s,r*o),n.lineTo(t.nt*s,r*o),n.closePath(),n.fillStyle=A,n.fill()}class kl extends ZA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var A;if(this.G===null)return;const{it:t,tt:i,ds:n,et:s,Nt:o,fs:l}=this.G,a=(A=this.G.vs)!==null&&A!==void 0?A:this.G.ps?0:e.mediaSize.height;if(i===null)return;const c=e.context;c.lineCap="butt",c.lineJoin="round",c.lineWidth=s,Ot(c,o),c.lineWidth=1,Il(e,t,l,i,n,this.bs.bind(this),jd.bind(null,a))}}function os(r,e,A){return Math.min(Math.max(r,e),A)}function bi(r,e,A){return e-r<=A}function Ol(r){const e=Math.ceil(r);return e%2==0?e-1:e}class ls{ws(e,A){const t=this.gs,{Ms:i,xs:n,Ss:s,ks:o,ys:l,vs:a}=A;if(this.Cs===void 0||t===void 0||t.Ms!==i||t.xs!==n||t.Ss!==s||t.ks!==o||t.vs!==a||t.ys!==l){const c=e.context.createLinearGradient(0,0,0,l);if(c.addColorStop(0,i),a!=null){const u=os(a*e.verticalPixelRatio/l,0,1);c.addColorStop(u,n),c.addColorStop(u,s)}c.addColorStop(1,o),this.Cs=c,this.gs=A}return this.Cs}}class ef extends kl{constructor(){super(...arguments),this.Ts=new ls}bs(e,A){return this.Ts.ws(e,{Ms:A.Ps,xs:"",Ss:"",ks:A.Rs,ys:e.bitmapSize.height})}}function Af(r,e){const A=r.context;A.strokeStyle=e,A.stroke()}class Nl extends ZA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:A,tt:t,ds:i,fs:n,et:s,Nt:o,Ds:l}=this.G;if(t===null)return;const a=e.context;a.lineCap="butt",a.lineWidth=s*e.verticalPixelRatio,Ot(a,o),a.lineJoin="round";const c=this.Vs.bind(this);n!==void 0&&Il(e,A,n,t,i,c,Af),l&&(function(u,m,y,B,p){const{horizontalPixelRatio:Q,verticalPixelRatio:D,context:F}=u;let _=null;const L=Math.max(1,Math.floor(Q))%2/2,k=y*D+L;for(let V=B.to-1;V>=B.from;--V){const Z=m[V];if(Z){const $=p(u,Z);$!==_&&(F.beginPath(),_!==null&&F.fill(),F.fillStyle=$,_=$);const z=Math.round(Z.nt*Q)+L,R=Z.st*D;F.moveTo(z,R),F.arc(z,R,k,0,2*Math.PI)}}F.fill()})(e,A,l,t,c)}}class Kl extends Nl{Vs(e,A){return A.lt}}function Pl(r,e,A,t,i=0,n=e.length){let s=n-i;for(;0<s;){const o=s>>1,l=i+o;t(e[l],A)===r?(i=l+1,s-=o+1):s=o}return i}const xr=Pl.bind(null,!0),Vl=Pl.bind(null,!1);function tf(r,e){return r.ot<e}function rf(r,e){return e<r.ot}function zl(r,e,A){const t=e.Os(),i=e.ui(),n=xr(r,t,tf),s=Vl(r,i,rf);if(!A)return{from:n,to:s};let o=n,l=s;return n>0&&n<r.length&&r[n].ot>=t&&(o=n-1),s>0&&s<r.length&&r[s-1].ot<=i&&(l=s+1),{from:o,to:l}}class as{constructor(e,A,t){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=e,this.Ns=A,this.Fs=t}bt(e){this.Bs=!0,e==="data"&&(this.As=!0),e==="options"&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),this.Ls===null?null:this.js):null}Hs(){this.zs=this.zs.map((e=>Object.assign(Object.assign({},e),this.Es.Us().$s(e.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 e=this.Es.Dt(),A=this.Ns.St();if(this.qs(),A.Ni()||e.Ni())return;const t=A.Xs();if(t===null||this.Es.In().Ks()===0)return;const i=this.Es.Ct();i!==null&&(this.Ls=zl(this.zs,t,this.Fs),this.Gs(e,A,i.Vt),this.Js())}}class Ti extends as{constructor(e,A){super(e,A,!0)}Gs(e,A,t){A.Qs(this.zs,Qr(this.Ls)),e.te(this.zs,t,Qr(this.Ls))}ie(e,A){return{ot:e,_t:A,nt:NaN,st:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((A=>{const t=A.Vt[3];return this.se(A.ee,t,e)}))}}class nf extends Ti{constructor(e,A){super(e,A),this.js=new is,this.re=new ef,this.he=new Kl,this.js.Z([this.re,this.he])}se(e,A,t){return Object.assign(Object.assign({},this.ie(e,A)),t.$s(e))}Js(){const e=this.Es.W();this.re.J({fs:e.lineType,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,vs:null,ps:e.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:e.lineVisible?e.lineType:void 0,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0})}}class sf extends ZA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(A),this.ae>=2&&Math.max(1,Math.floor(A))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(A)):this.ae;let i=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*A);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];i!==o.ce&&(e.fillStyle=o.ce,i=o.ce);const l=Math.floor(.5*this.oe),a=Math.round(o.nt*A),c=a-l,u=this.oe,m=c+u-1,y=Math.min(o.de,o.fe),B=Math.max(o.de,o.fe),p=Math.round(y*t)-l,Q=Math.round(B*t)+l,D=Math.max(Q-p,this.oe);e.fillRect(c,p,u,D);const F=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const V=a-F;let Z=Math.max(p,Math.round(o.pe*t)-l),$=Z+u-1;$>p+D-1&&($=p+D-1,Z=$-u+1),e.fillRect(V,Z,c-V,$-Z+1)}const _=a+F;let L=Math.max(p,Math.round(o.me*t)-l),k=L+u-1;k>p+D-1&&(k=p+D-1,L=k-u+1),e.fillRect(m+1,L,_-m,k-L+1)}}}_e(e){const A=Math.floor(e);return Math.max(A,Math.floor((function(t,i){return Math.floor(.3*t*i)})(ue(this.zt).le,e)))}}class Gl extends as{constructor(e,A){super(e,A,!1)}Gs(e,A,t){A.Qs(this.zs,Qr(this.Ls)),e.be(this.zs,t,Qr(this.Ls))}we(e,A,t){return{ot:e,ge:A.Vt[0],Me:A.Vt[1],xe:A.Vt[2],Se:A.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((A=>this.se(A.ee,A,e)))}}class of extends Gl{constructor(){super(...arguments),this.js=new sf}se(e,A,t){return Object.assign(Object.assign({},this.we(e,A,t)),t.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:e.openVisible,ue:e.thinBars,tt:this.Ls})}}class lf extends kl{constructor(){super(...arguments),this.Ts=new ls}bs(e,A){const t=this.G;return this.Ts.ws(e,{Ms:A.ke,xs:A.ye,Ss:A.Ce,ks:A.Te,ys:e.bitmapSize.height,vs:t.vs})}}class af extends Nl{constructor(){super(...arguments),this.Pe=new ls}Vs(e,A){const t=this.G;return this.Pe.ws(e,{Ms:A.Re,xs:A.Re,Ss:A.De,ks:A.De,ys:e.bitmapSize.height,vs:t.vs})}}class cf extends Ti{constructor(e,A){super(e,A),this.js=new is,this.Ve=new lf,this.Oe=new af,this.js.Z([this.Ve,this.Oe])}se(e,A,t){return Object.assign(Object.assign({},this.ie(e,A)),t.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const A=this.Es.W(),t=this.Es.Dt().Rt(A.baseValue.price,e.Vt),i=this.Ns.St().le();this.Ve.J({it:this.zs,et:A.lineWidth,Nt:A.lineStyle,fs:A.lineType,vs:t,ps:!1,tt:this.Ls,ds:i}),this.Oe.J({it:this.zs,et:A.lineWidth,Nt:A.lineStyle,fs:A.lineVisible?A.lineType:void 0,Ds:A.pointMarkersVisible?A.pointMarkersRadius||A.lineWidth/2+2:void 0,vs:t,tt:this.Ls,ds:i})}}class hf extends ZA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:A}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),l=Math.floor(n*o*s),a=Math.floor(n*s),c=Math.min(l,a);return Math.max(Math.floor(s),c)})(this.zt.le,A),this.ae>=2&&Math.floor(A)%2!=this.ae%2&&this.ae--;const t=this.zt.In;this.zt.Be&&this.Ae(e,t,this.zt.tt),this.zt._i&&this.Ie(e,t,this.zt.tt);const i=this.ze(A);(!this.zt._i||this.ae>2*i)&&this.Le(e,t,this.zt.tt)}Ae(e,A,t){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",l=Math.min(Math.floor(n),Math.floor(this.zt.le*n));l=Math.max(Math.floor(n),Math.min(l,this.ae));const a=Math.floor(.5*l);let c=null;for(let u=t.from;u<t.to;u++){const m=A[u];m.Ee!==o&&(i.fillStyle=m.Ee,o=m.Ee);const y=Math.round(Math.min(m.pe,m.me)*s),B=Math.round(Math.max(m.pe,m.me)*s),p=Math.round(m.de*s),Q=Math.round(m.fe*s);let D=Math.round(n*m.nt)-a;const F=D+l-1;c!==null&&(D=Math.max(c+1,D),D=Math.min(D,F));const _=F-D+1;i.fillRect(D,p,_,y-p),i.fillRect(D,B+1,_,Q-B),c=F}}ze(e){let A=Math.floor(1*e);this.ae<=2*A&&(A=Math.floor(.5*(this.ae-1)));const t=Math.max(Math.floor(e),A);return this.ae<=2*t?Math.max(Math.floor(e),Math.floor(1*e)):t}Ie(e,A,t){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let a=null;for(let c=t.from;c<t.to;c++){const u=A[c];u.Ne!==o&&(i.fillStyle=u.Ne,o=u.Ne);let m=Math.round(u.nt*n)-Math.floor(.5*this.ae);const y=m+this.ae-1,B=Math.round(Math.min(u.pe,u.me)*s),p=Math.round(Math.max(u.pe,u.me)*s);if(a!==null&&(m=Math.max(a+1,m),m=Math.min(m,y)),this.zt.le*n>2*l)Rd(i,m,B,y-m+1,p-B+1,l);else{const Q=y-m+1;i.fillRect(m,B,Q,p-B+1)}a=y}}Le(e,A,t){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let a=t.from;a<t.to;a++){const c=A[a];let u=Math.round(Math.min(c.pe,c.me)*s),m=Math.round(Math.max(c.pe,c.me)*s),y=Math.round(c.nt*n)-Math.floor(.5*this.ae),B=y+this.ae-1;if(c.ce!==o){const p=c.ce;i.fillStyle=p,o=p}this.zt._i&&(y+=l,u+=l,B-=l,m-=l),u>m||i.fillRect(y,u,B-y+1,m-u+1)}}}class uf extends Gl{constructor(){super(...arguments),this.js=new hf}se(e,A,t){return Object.assign(Object.assign({},this.we(e,A,t)),t.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:e.wickVisible,_i:e.borderVisible,tt:this.Ls})}}class df{constructor(e,A){this.Fe=e,this.Li=A}X(e,A,t){this.Fe.draw(e,this.Li,A,t)}}class cs extends as{constructor(e,A,t){super(e,A,!1),this.wn=t,this.js=new df(this.wn.renderer(),(i=>{const n=e.Ct();return n===null?null:e.Dt().Rt(i,n.Vt)}))}We(e){return this.wn.priceValueBuilder(e)}je(e){return this.wn.isWhitespace(e)}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((A=>Object.assign(Object.assign({ot:A.ee,nt:NaN},e.$s(A.ee)),{He:A.$e})))}Gs(e,A){A.Qs(this.zs,Qr(this.Ls))}Js(){this.wn.update({bars:this.zs.map(ff),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function ff(r){return{x:r.nt,time:r.ot,originalData:r.He,barColor:r.ce}}class pf extends ZA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(A);const i=Math.max(1,Math.floor(t)),n=Math.round(this.zt.Ye*t)-Math.floor(i/2),s=n+i;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],a=this.Ue[o-this.zt.tt.from],c=Math.round(l.st*t);let u,m;e.fillStyle=l.ce,c<=n?(u=c,m=s):(u=n,m=c-Math.floor(i/2)+i),e.fillRect(a.Os,u,a.ui-a.Os+1,m-u)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const A=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),t=Math.round(this.zt.le*e)-A;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);let l,a;if(t%2){const c=(t-1)/2;l=o-c,a=o+c}else{const c=t/2;l=o-c,a=o+c-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:a,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==A+1&&(o.Ze>o.Xe?o.ui=s.Os-A-1:s.Os=o.ui+A+1)}let i=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;i=Math.min(o,i)}if(A>0&&i<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>i&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class gf extends Ti{constructor(){super(...arguments),this.js=new pf}se(e,A,t){return Object.assign(Object.assign({},this.ie(e,A)),t.$s(e))}Js(){const e={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,ue(this.Es.Ct()).Vt)};this.js.J(e)}}class mf extends Ti{constructor(){super(...arguments),this.js=new Kl}se(e,A,t){return Object.assign(Object.assign({},this.ie(e,A)),t.$s(e))}Js(){const e=this.Es.W(),A={it:this.zs,Nt:e.lineStyle,fs:e.lineVisible?e.lineType:void 0,et:e.lineWidth,Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(A)}}const Bf=/[2-9]/g;class Fr{constructor(e=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=e}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(e,A,t){return this.sr(e,A,t).width}Mi(e,A,t){const i=this.sr(e,A,t);return((i.actualBoundingBoxAscent||0)-(i.actualBoundingBoxDescent||0))/2}sr(e,A,t){const i=t||Bf,n=String(A).replace(i,"0");if(this.tr.has(n))return EA(this.tr.get(n)).er;if(this.Ke===this.ir){const o=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(o),this.Je++,this.Ke--}e.save(),e.textBaseline="middle";const s=e.measureText(n);return e.restore(),s.width===0&&A.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class wf{constructor(e){this.hr=null,this.k=null,this.lr="right",this.ar=e}_r(e,A,t){this.hr=e,this.k=A,this.lr=t}X(e){this.k!==null&&this.hr!==null&&this.hr.X(e,this.k,this.ar,this.lr)}}class Wl{constructor(e,A,t){this.ur=e,this.ar=new Fr(50),this.cr=A,this.F=t,this.j=-1,this.Wt=new wf(this.ar)}gt(){const e=this.F.dr(this.cr);if(e===null)return null;const A=e.vr(this.cr)?e.pr():this.cr.Dt();if(A===null)return null;const t=e.mr(A);if(t==="overlay")return null;const i=this.F.br();return i.P!==this.j&&(this.j=i.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),i,t),this.Wt}}class Cf extends ZA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,A){var t;if(!(!((t=this.zt)===null||t===void 0)&&t.yt))return null;const{st:i,et:n,gr:s}=this.zt;return A>=i-n-7&&A<=i+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:A,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*i);n<0||n>A.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*t),Ot(e,this.zt.Nt),yl(e,n,0,A.width))}}class hs{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new Cf,this.ft=!0,this.Es=e,this.Ns=e.$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 vf extends hs{constructor(e){super(e)}yr(){this.Sr.yt=!1;const e=this.Es.Dt(),A=e.Cr().Cr;if(A!==2&&A!==3)return;const t=this.Es.W();if(!t.baseLineVisible||!this.Es.yt())return;const i=this.Es.Ct();i!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(i.Vt,i.Vt),this.Sr.V=t.baseLineColor,this.Sr.et=t.baseLineWidth,this.Sr.Nt=t.baseLineStyle)}}class yf extends ZA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t}){const i=this.zt;if(i===null)return;const n=Math.max(1,Math.floor(A)),s=n%2/2,o=Math.round(i.Xe.x*A)+s,l=i.Xe.y*t;e.fillStyle=i.Tr,e.beginPath();const a=Math.max(2,1.5*i.Pr)*A;e.arc(o,l,a,0,2*Math.PI,!1),e.fill(),e.fillStyle=i.Rr,e.beginPath(),e.arc(o,l,i.ht*A,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=i.Dr,e.beginPath(),e.arc(o,l,i.ht*A+n/2,0,2*Math.PI,!1),e.stroke()}}const bf=[{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 Rl(r,e,A,t){return(function(i,n){if(i==="transparent")return i;const s=yr(i),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(r,A+(t-A)*e)}function $l(r,e){const A=r%2600/2600;let t;for(const l of bf)if(A>=l.Vr&&A<=l.Or){t=l;break}vt(t!==void 0,"Last price animation internal logic error");const i=(A-t.Vr)/(t.Or-t.Vr);return{Rr:Rl(e,i,t.Ir,t.zr),Dr:Rl(e,i,t.Lr,t.Er),ht:(n=i,s=t.Br,o=t.Ar,s+(o-s)*n)};var n,s,o}class Tf{constructor(e){this.Wt=new yf,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=e}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),this.jr.W().lastPriceAnimation===2){const e=performance.now(),A=this.Wr-e;if(A>0)return void(A<650&&(this.Wr+=2600));this.Fr=e,this.Wr=e+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 e=this.jr.$t().St(),A=e.Xs(),t=this.jr.Ct();if(A===null||t===null)return;const i=this.jr.Zr(!0);if(i.Xr||!A.Kr(i.ee))return;const n={x:e.It(i.ee),y:this.jr.Dt().Rt(i._t,t.Vt)},s=i.V,o=this.jr.W().lineWidth,l=$l(this.Gr(),s);this.Wt.J({Tr:s,Pr:o,Rr:l.Rr,Dr:l.Dr,ht:l.ht,Xe:n})}Yr(){const e=this.Wt.$e();if(e!==null){const A=$l(this.Gr(),e.Tr);e.Rr=A.Rr,e.Dr=A.Dr,e.ht=A.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function Ur(r,e){return Ol(Math.min(Math.max(r,12),30)*e)}function Er(r,e){switch(r){case"arrowDown":case"arrowUp":return Ur(e,1);case"circle":return Ur(e,.8);case"square":return Ur(e,.7)}}function Xl(r){return(function(e){const A=Math.ceil(e);return A%2!=0?A-1:A})(Ur(r,1))}function Jl(r){return Math.max(Ur(r,.1),3)}function Zl(r,e,A){return e?r:A?Math.ceil(r/2):0}function ql(r,e,A,t,i){const n=Er("square",A),s=(n-1)/2,o=r-s,l=e-s;return t>=o&&t<=o+n&&i>=l&&i<=l+n}function Yl(r,e,A,t){const i=(Er("arrowUp",t)-1)/2*A.Jr,n=(Ol(t/2)-1)/2*A.Jr;e.beginPath(),r?(e.moveTo(A.nt-i,A.st),e.lineTo(A.nt,A.st-i),e.lineTo(A.nt+i,A.st),e.lineTo(A.nt+n,A.st),e.lineTo(A.nt+n,A.st+i),e.lineTo(A.nt-n,A.st+i),e.lineTo(A.nt-n,A.st)):(e.moveTo(A.nt-i,A.st),e.lineTo(A.nt,A.st+i),e.lineTo(A.nt+i,A.st),e.lineTo(A.nt+n,A.st),e.lineTo(A.nt+n,A.st-i),e.lineTo(A.nt-n,A.st-i),e.lineTo(A.nt-n,A.st)),e.fill()}function Qf(r,e,A,t,i,n){return ql(e,A,t,i,n)}class xf extends ZA{constructor(){super(...arguments),this.zt=null,this.ar=new Fr,this.j=-1,this.H="",this.Qr=""}J(e){this.zt=e}_r(e,A){this.j===e&&this.H===A||(this.j=e,this.H=A,this.Qr=er(e,A),this.ar.nr())}wr(e,A){if(this.zt===null||this.zt.tt===null)return null;for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.zt.it[t];if(Uf(i,e,A))return{Mr:i.th,gr:i.gr}}return null}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t},i,n){if(this.zt!==null&&this.zt.tt!==null){e.textBaseline="middle",e.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const o=this.zt.it[s];o.Kt!==void 0&&(o.Kt.Hi=this.ar.xi(e,o.Kt.ih),o.Kt.At=this.j,o.Kt.nt=o.nt-o.Kt.Hi/2),Ff(o,e,A,t)}}}}function Ff(r,e,A,t){e.fillStyle=r.V,r.Kt!==void 0&&(function(i,n,s,o,l,a){i.save(),i.scale(l,a),i.fillText(n,s,o),i.restore()})(e,r.Kt.ih,r.Kt.nt,r.Kt.st,A,t),(function(i,n,s){if(i.Ks!==0){switch(i.nh){case"arrowDown":return void Yl(!1,n,s,i.Ks);case"arrowUp":return void Yl(!0,n,s,i.Ks);case"circle":return void(function(o,l,a){const c=(Er("circle",a)-1)/2;o.beginPath(),o.arc(l.nt,l.st,c*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,i.Ks);case"square":return void(function(o,l,a){const c=Er("square",a),u=(c-1)*l.Jr/2,m=l.nt-u,y=l.st-u;o.fillRect(m,y,c*l.Jr,c*l.Jr)})(n,s,i.Ks)}i.nh}})(r,e,(function(i,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(i.nt*n)+o,st:i.st*s,Jr:n}})(r,A,t))}function Uf(r,e,A){return!(r.Kt===void 0||!(function(t,i,n,s,o,l){const a=s/2;return o>=t&&o<=t+n&&l>=i-a&&l<=i+a})(r.Kt.nt,r.Kt.st,r.Kt.Hi,r.Kt.At,e,A))||(function(t,i,n){if(t.Ks===0)return!1;switch(t.nh){case"arrowDown":case"arrowUp":return Qf(0,t.nt,t.st,t.Ks,i,n);case"circle":return(function(s,o,l,a,c){const u=2+Er("circle",l)/2,m=s-a,y=o-c;return Math.sqrt(m*m+y*y)<=u})(t.nt,t.st,t.Ks,i,n);case"square":return ql(t.nt,t.st,t.Ks,i,n)}})(r,e,A)}function Ef(r,e,A,t,i,n,s,o,l){const a=tt(A)?A:A.Se,c=tt(A)?A:A.Me,u=tt(A)?A:A.xe,m=tt(e.size)?Math.max(e.size,0):1,y=Xl(o.le())*m,B=y/2;switch(r.Ks=y,e.position){case"inBar":return r.st=s.Rt(a,l),void(r.Kt!==void 0&&(r.Kt.st=r.st+B+n+.6*i));case"aboveBar":return r.st=s.Rt(c,l)-B-t.sh,r.Kt!==void 0&&(r.Kt.st=r.st-B-.6*i,t.sh+=1.2*i),void(t.sh+=y+n);case"belowBar":return r.st=s.Rt(u,l)+B+t.eh,r.Kt!==void 0&&(r.Kt.st=r.st+B+n+.6*i,t.eh+=1.2*i),void(t.eh+=y+n)}e.position}class Sf{constructor(e,A){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new xf,this.jr=e,this.$i=A,this.zt={it:[],tt:null}}bt(e){this.ft=!0,this.hh=!0,e==="data"&&(this.rh=!0,this.oh=null)}gt(e){if(!this.jr.yt())return null;this.ft&&this._h();const A=this.$i.W().layout;return this.Wt._r(A.fontSize,A.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const e=this.$i.St().le(),A=Jl(e),t=1.5*Xl(e)+2*A,i=this.fh();this.ah={above:Zl(t,i.aboveBar,i.inBar),below:Zl(t,i.belowBar,i.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,A)=>(e[A.position]||(e[A.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),A=this.$i.St(),t=this.jr.dh();this.rh&&(this.zt.it=t.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 i=this.$i.W().layout;this.zt.tt=null;const n=A.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const l=Jl(A.le()),a={sh:l,eh:l};this.zt.tt=zl(this.zt.it,n,!0);for(let c=this.zt.tt.from;c<this.zt.tt.to;c++){const u=t[c];u.time!==o&&(a.sh=l,a.eh=l,o=u.time);const m=this.zt.it[c];m.nt=A.It(u.time),u.text!==void 0&&u.text.length>0&&(m.Kt={ih:u.text,nt:0,st:0,Hi:0,At:0});const y=this.jr.ph(u.time);y!==null&&Ef(m,u,y,a,i.fontSize,l,e,A,s.Vt)}this.ft=!1}}class Hf extends hs{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const A=this.Es.W();if(!A.priceLineVisible||!this.Es.yt())return;const t=this.Es.Zr(A.priceLineSource===0);t.Xr||(e.yt=!0,e.st=t.ki,e.V=this.Es.mh(t.V),e.et=A.priceLineWidth,e.Nt=A.priceLineStyle)}}class Lf extends Ci{constructor(e){super(),this.jt=e}zi(e,A,t){e.yt=!1,A.yt=!1;const i=this.jt;if(!i.yt())return;const n=i.W(),s=n.lastValueVisible,o=i.bh()!=="",l=n.seriesLastValueMode===0,a=i.Zr(!1);if(a.Xr)return;s&&(e.Kt=this.wh(a,s,l),e.yt=e.Kt.length!==0),(o||l)&&(A.Kt=this.gh(a,s,o,l),A.yt=A.Kt.length>0);const c=i.mh(a.V),u=mi(c);t.t=u.t,t.ki=a.ki,A.Ot=i.$t().Bt(a.ki/i.Dt().At()),e.Ot=c,e.V=u.i,A.V=u.i}gh(e,A,t,i){let n="";const s=this.jt.bh();return t&&s.length!==0&&(n+=`${s} `),A&&i&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,A,t){return A?t?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function jl(r,e,A,t){const i=Number.isFinite(e),n=Number.isFinite(A);return i&&n?r(e,A):i||n?i?e:A:t}class MA{constructor(e,A){this.kh=e,this.yh=A}Ch(e){return e!==null&&this.kh===e.kh&&this.yh===e.yh}Th(){return new MA(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(e){return e===null?this:new MA(jl(Math.min,this.Ph(),e.Ph(),-1/0),jl(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!tt(e)||this.yh-this.kh===0)return;const A=.5*(this.yh+this.kh);let t=this.yh-A,i=this.kh-A;t*=e,i*=e,this.yh=A+t,this.kh=A+i}Oh(e){tt(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new MA(e.minValue,e.maxValue)}}class Qi{constructor(e,A){this.Ih=e,this.zh=A||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(e){return e===null?null:new Qi(MA.Ah(e.priceRange),e.margins)}}class Mf extends hs{constructor(e,A){super(e),this.Nh=A}yr(){const e=this.Sr;e.yt=!1;const A=this.Nh.W();if(!this.Es.yt()||!A.lineVisible)return;const t=this.Nh.Fh();t!==null&&(e.yt=!0,e.st=t,e.V=A.color,e.et=A.lineWidth,e.Nt=A.lineStyle,e.gr=this.Nh.W().id)}}class If extends Ci{constructor(e,A){super(),this.jr=e,this.Nh=A}zi(e,A,t){e.yt=!1,A.yt=!1;const i=this.Nh.W(),n=i.axisLabelVisible,s=i.title!=="",o=this.jr;if(!n||!o.yt())return;const l=this.Nh.Fh();if(l===null)return;s&&(A.Kt=i.title,A.yt=!0),A.Ot=o.$t().Bt(l/o.Dt().At()),e.Kt=this.Wh(i.price),e.yt=!0;const a=mi(i.axisLabelColor||i.color);t.t=a.t;const c=i.axisLabelTextColor||a.i;e.V=c,A.V=c,t.ki=l}Wh(e){const A=this.jr.Ct();return A===null?"":this.jr.Dt().Fi(e,A.Vt)}}class _f{constructor(e,A){this.jr=e,this.cn=A,this.jh=new Mf(e,this),this.ur=new If(e,this),this.Hh=new Wl(this.ur,e,e.$t())}$h(e){JA(this.cn,e),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 e=this.jr,A=e.Dt();if(e.$t().St().Ni()||A.Ni())return null;const t=e.Ct();return t===null?null:A.Rt(this.cn.price,t.Vt)}}class Df extends ns{constructor(e){super(),this.$i=e}$t(){return this.$i}}const kf={Bar:(r,e,A,t)=>{var i;const n=e.upColor,s=e.downColor,o=ue(r(A,t)),l=jt(o.Vt[0])<=jt(o.Vt[3]);return{ce:(i=o.V)!==null&&i!==void 0?i:l?n:s}},Candlestick:(r,e,A,t)=>{var i,n,s;const o=e.upColor,l=e.downColor,a=e.borderUpColor,c=e.borderDownColor,u=e.wickUpColor,m=e.wickDownColor,y=ue(r(A,t)),B=jt(y.Vt[0])<=jt(y.Vt[3]);return{ce:(i=y.V)!==null&&i!==void 0?i:B?o:l,Ne:(n=y.Ot)!==null&&n!==void 0?n:B?a:c,Ee:(s=y.Xh)!==null&&s!==void 0?s:B?u:m}},Custom:(r,e,A,t)=>{var i;return{ce:(i=ue(r(A,t)).V)!==null&&i!==void 0?i:e.color}},Area:(r,e,A,t)=>{var i,n,s,o;const l=ue(r(A,t));return{ce:(i=l.lt)!==null&&i!==void 0?i:e.lineColor,lt:(n=l.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=l.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=l.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(r,e,A,t)=>{var i,n,s,o,l,a;const c=ue(r(A,t));return{ce:c.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(i=c.Re)!==null&&i!==void 0?i:e.topLineColor,De:(n=c.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=c.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=c.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=c.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(a=c.Te)!==null&&a!==void 0?a:e.bottomFillColor2}},Line:(r,e,A,t)=>{var i,n;const s=ue(r(A,t));return{ce:(i=s.V)!==null&&i!==void 0?i:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(r,e,A,t)=>{var i;return{ce:(i=ue(r(A,t)).V)!==null&&i!==void 0?i:e.color}}};class Of{constructor(e){this.Kh=(A,t)=>t!==void 0?t.Vt:this.jr.In().Gh(A),this.jr=e,this.Jh=kf[e.Qh()]}$s(e,A){return this.Jh(this.Kh,this.jr.W(),e,A)}}var ea;(function(r){r[r.NearestLeft=-1]="NearestLeft",r[r.None=0]="None",r[r.NearestRight=1]="NearestRight"})(ea||(ea={}));const yt=30;class Nf{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(e){return this.hl(e,0)!==null}Gh(e){return this.ll(e)}ll(e,A=0){const t=this.hl(e,A);return t===null?null:Object.assign(Object.assign({},this.al(t)),{ee:this.rl(t)})}ne(){return this.tl}ol(e,A,t){if(this.Ni())return null;let i=null;for(const n of t)i=xi(i,this._l(e,A,n));return i}J(e){this.nl.clear(),this.il.clear(),this.tl=e}rl(e){return this.tl[e].ee}al(e){return this.tl[e]}hl(e,A){const t=this.ul(e);if(t===null&&A!==0)switch(A){case-1:return this.cl(e);case 1:return this.dl(e);default:throw new TypeError("Unknown search mode")}return t}cl(e){let A=this.fl(e);return A>0&&(A-=1),A!==this.tl.length&&this.rl(A)<e?A:null}dl(e){const A=this.vl(e);return A!==this.tl.length&&e<this.rl(A)?A:null}ul(e){const A=this.fl(e);return A===this.tl.length||e<this.tl[A].ee?null:A}fl(e){return xr(this.tl,e,((A,t)=>A.ee<t))}vl(e){return Vl(this.tl,e,((A,t)=>A.ee>t))}pl(e,A,t){let i=null;for(let n=e;n<A;n++){const s=this.tl[n].Vt[t];Number.isNaN(s)||(i===null?i={ml:s,bl:s}:(s<i.ml&&(i.ml=s),s>i.bl&&(i.bl=s)))}return i}_l(e,A,t){if(this.Ni())return null;let i=null;const n=ue(this.el()),s=ue(this.An()),o=Math.max(e,n),l=Math.min(A,s),a=Math.ceil(o/yt)*yt,c=Math.max(a,Math.floor(l/yt)*yt);{const m=this.fl(o),y=this.vl(Math.min(l,a,A));i=xi(i,this.pl(m,y,t))}let u=this.il.get(t);u===void 0&&(u=new Map,this.il.set(t,u));for(let m=Math.max(a+1,o);m<c;m+=yt){const y=Math.floor(m/yt);let B=u.get(y);if(B===void 0){const p=this.fl(y*yt),Q=this.vl((y+1)*yt-1);B=this.pl(p,Q,t),u.set(y,B)}i=xi(i,B)}{const m=this.fl(c),y=this.vl(l);i=xi(i,this.pl(m,y,t))}return i}}function xi(r,e){return r===null?e:e===null?r:{ml:Math.min(r.ml,e.ml),bl:Math.max(r.bl,e.bl)}}class Kf{constructor(e){this.wl=e}X(e,A,t){this.wl.draw(e)}gl(e,A,t){var i,n;(n=(i=this.wl).drawBackground)===null||n===void 0||n.call(i,e)}}class us{constructor(e){this.tr=null,this.wn=e}gt(){var e;const A=this.wn.renderer();if(A===null)return null;if(((e=this.tr)===null||e===void 0?void 0:e.Ml)===A)return this.tr.xl;const t=new Kf(A);return this.tr={Ml:A,xl:t},t}Sl(){var e,A,t;return(t=(A=(e=this.wn).zOrder)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:"normal"}}function Aa(r){var e,A,t,i,n;return{Kt:r.text(),ki:r.coordinate(),Si:(e=r.fixedCoordinate)===null||e===void 0?void 0:e.call(r),V:r.textColor(),t:r.backColor(),yt:(t=(A=r.visible)===null||A===void 0?void 0:A.call(r))===null||t===void 0||t,hi:(n=(i=r.tickVisible)===null||i===void 0?void 0:i.call(r))===null||n===void 0||n}}class Pf{constructor(e,A){this.Wt=new Sl,this.kl=e,this.yl=A}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Aa(this.kl))),this.Wt}}class Vf extends Ci{constructor(e,A){super(),this.kl=e,this.Li=A}zi(e,A,t){const i=Aa(this.kl);t.t=i.t,e.V=i.V;const n=2/12*this.Li.P();t.wi=n,t.gi=n,t.ki=i.ki,t.Si=i.Si,e.Kt=i.Kt,e.yt=i.yt,e.hi=i.hi}}class zf{constructor(e,A){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=e,this.jr=A}Ol(){return this.Vl}Vn(){var e,A;(A=(e=this.Vl).updateAllViews)===null||A===void 0||A.call(e)}Pn(){var e,A,t,i;const n=(t=(A=(e=this.Vl).paneViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Cl)===null||i===void 0?void 0:i.Ml)===n)return this.Cl.xl;const s=n.map((o=>new us(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,A,t,i;const n=(t=(A=(e=this.Vl).timeAxisViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Tl)===null||i===void 0?void 0:i.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((l=>new Pf(l,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,A,t,i;const n=(t=(A=(e=this.Vl).priceAxisViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Pl)===null||i===void 0?void 0:i.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((l=>new Vf(l,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,A,t,i;const n=(t=(A=(e=this.Vl).priceAxisPaneViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Rl)===null||i===void 0?void 0:i.Ml)===n)return this.Rl.xl;const s=n.map((o=>new us(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,A,t,i;const n=(t=(A=(e=this.Vl).timeAxisPaneViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Dl)===null||i===void 0?void 0:i.Ml)===n)return this.Dl.xl;const s=n.map((o=>new us(o)));return this.Dl={Ml:n,xl:s},s}Il(e,A){var t,i,n;return(n=(i=(t=this.Vl).autoscaleInfo)===null||i===void 0?void 0:i.call(t,e,A))!==null&&n!==void 0?n:null}wr(e,A){var t,i,n;return(n=(i=(t=this.Vl).hitTest)===null||i===void 0?void 0:i.call(t,e,A))!==null&&n!==void 0?n:null}}function ds(r,e,A,t){r.forEach((i=>{e(i).forEach((n=>{n.Sl()===A&&t.push(n)}))}))}function fs(r){return r.Pn()}function Gf(r){return r.Bl()}function Wf(r){return r.Al()}class ps extends Df{constructor(e,A,t,i,n){super(e),this.zt=new Nf,this.jh=new Hf(this),this.zl=[],this.Ll=new vf(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=A,this.$l=t;const s=new Lf(this);this.rn=[s],this.Hh=new Wl(s,this,e),t!=="Area"&&t!=="Line"&&t!=="Baseline"||(this.El=new Tf(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const A={Xr:!0},t=this.Dt();if(this.$t().St().Ni()||t.Ni()||this.zt.Ni())return A;const i=this.$t().St().Xs(),n=this.Ct();if(i===null||n===null)return A;let s,o;if(e){const u=this.zt.sl();if(u===null)return A;s=u,o=u.ee}else{const u=this.zt.ll(i.ui(),-1);if(u===null||(s=this.zt.Gh(u.ee),s===null))return A;o=u.ee}const l=s.Vt[3],a=this.Us().$s(o,{Vt:s}),c=t.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:t.Fi(l,n.Vt),xh:t.Yl(l),Sh:t.Zl(l,n.Vt),V:a.ce,ki:c,ee:o}}Us(){return this.Nl!==null||(this.Nl=new Of(this)),this.Nl}W(){return this.cn}$h(e){const A=e.priceScaleId;A!==void 0&&A!==this.cn.priceScaleId&&this.$t().Xl(this,A),JA(this.cn,e),e.priceFormat!==void 0&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(e,A){this.zt.J(e),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(A&&A.ta?this.El.$r():e.length===0&&this.El.Hr());const t=this.$t().dr(this);this.$t().ia(t),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(e){this.Fl=e,this.Ql();const A=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(A),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(e){const A=new _f(this,e);return this.zl.push(A),this.$t().Gl(this),A}ra(e){const A=this.zl.indexOf(e);A!==-1&&this.zl.splice(A,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const e=this.ha();return e===null?null:{Vt:e.Vt[3],la:e.ot}}ha(){const e=this.$t().St().Xs();if(e===null)return null;const A=e.Os();return this.zt.ll(A,1)}In(){return this.zt}ph(e){const A=this.zt.Gh(e);return A===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:A.Vt[0],Me:A.Vt[1],xe:A.Vt[2],Se:A.Vt[3]}:A.Vt[3]}aa(e){const A=[];ds(this.Hl,fs,"top",A);const t=this.El;return t!==null&&t.yt()&&(this.jl===null&&t.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),t.Ur(),A.unshift(t)),A}Pn(){const e=[];this._a()||e.push(this.Ll),e.push(this.wn,this.jh,this.dn);const A=this.zl.map((t=>t.qh()));return e.push(...A),ds(this.Hl,fs,"normal",e),e}ua(){return this.ca(fs,"bottom")}da(e){return this.ca(Gf,e)}fa(e){return this.ca(Wf,e)}va(e,A){return this.Hl.map((t=>t.wr(e,A))).filter((t=>t!==null))}Ji(e){return[this.Hh,...this.zl.map((A=>A.Yh()))]}Rn(e,A){if(A!==this.Yi&&!this._a())return[];const t=[...this.rn];for(const i of this.zl)t.push(i.Zh());return this.Hl.forEach((i=>{t.push(...i.Rn())})),t}Qi(){const e=[];return this.Hl.forEach((A=>{e.push(...A.Qi())})),e}Il(e,A){if(this.cn.autoscaleInfoProvider!==void 0){const t=this.cn.autoscaleInfoProvider((()=>{const i=this.pa(e,A);return i===null?null:i.Bh()}));return Qi.Ah(t)}return this.pa(e,A)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;this.wn.bt(),this.dn.bt();for(const A of this.rn)A.bt();for(const A of this.zl)A.bt();this.jh.bt(),this.Ll.bt(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((A=>A.Vn()))}Dt(){return ue(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const A=this.zt.Gh(e);return A===null?null:{_t:A.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(e)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(e){this.Hl.push(new zf(e,this))}ya(e){this.Hl=this.Hl.filter((A=>A.Ol()!==e))}Ca(){if(this.wn instanceof cs)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof cs)return e=>this.wn.je(e)}_a(){return!vi(this.Dt().Pa())}pa(e,A){if(!br(e)||!br(A)||this.zt.Ni())return null;const t=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],i=this.zt.ol(e,A,t);let n=i!==null?new MA(i.ml,i.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new MA(o,o);n=n!==null?n.ts(l):l}let s=this.dn.uh();return this.Hl.forEach((o=>{const l=o.Il(e,A);if(l?.priceRange){const y=new MA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(y):y}var a,c,u,m;l?.margins&&(a=s,c=l.margins,s={above:Math.max((u=a?.above)!==null&&u!==void 0?u:0,c.above),below:Math.max((m=a?.below)!==null&&m!==void 0?m:0,c.below)})})),new Qi(n,s)}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 e=this.cn.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(e){switch(this.$l){case"Line":case"Area":case"Baseline":{const A=this.cn.crosshairMarkerBackgroundColor;if(A.length!==0)return A}}return this.Us().$s(e).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new qd(this.cn.priceFormat.precision);break;case"percent":this.wa=new Ml(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new yi(e,this.cn.priceFormat.minMove*e)}}this.Yi!==null&&this.Yi.Ra()}Ql(){const e=this.$t().St();if(!e.Da()||this.zt.Ni())return void(this.Wl=[]);const A=ue(this.zt.el());this.Wl=this.Fl.map(((t,i)=>{const n=ue(e.Va(t.time,!0)),s=n<A?1:-1;return{time:ue(this.zt.ll(n,s)).ee,position:t.position,shape:t.shape,color:t.color,id:t.id,th:i,text:t.text,size:t.size,originalTime:t.originalTime}}))}ql(e){switch(this.dn=new Sf(this,this.$t()),this.$l){case"Bar":this.wn=new of(this,this.$t());break;case"Candlestick":this.wn=new uf(this,this.$t());break;case"Line":this.wn=new mf(this,this.$t());break;case"Custom":this.wn=new cs(this,this.$t(),EA(e));break;case"Area":this.wn=new nf(this,this.$t());break;case"Baseline":this.wn=new cf(this,this.$t());break;case"Histogram":this.wn=new gf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,A){const t=[];return ds(this.Hl,e,A,t),t}}class Rf{constructor(e){this.cn=e}Oa(e,A,t){let i=e;if(this.cn.mode===0)return i;const n=t.vn(),s=n.Ct();if(s===null)return i;const o=n.Rt(e,s),l=t.Ba().filter((c=>c instanceof ps)).reduce(((c,u)=>{if(t.vr(u)||!u.yt())return c;const m=u.Dt(),y=u.In();if(m.Ni()||!y.Kr(A))return c;const B=y.Gh(A);if(B===null)return c;const p=jt(u.Ct());return c.concat([m.Rt(B.Vt[3],p.Vt)])}),[]);if(l.length===0)return i;l.sort(((c,u)=>Math.abs(c-o)-Math.abs(u-o)));const a=l[0];return i=n.pn(a,s),i}}class $f extends ZA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:A,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.zt===null)return;const n=Math.max(1,Math.floor(t));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=ue(this.zt);if(s.Aa){e.strokeStyle=s.Ia,Ot(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*t);e.moveTo(l,-n),e.lineTo(l,A.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,Ot(e,s.Wa),e.beginPath();for(const o of s.ja){const l=Math.round(o.Ea*i);e.moveTo(-n,l),e.lineTo(A.width+n,l)}e.stroke()}}))}}class Xf{constructor(e){this.Wt=new $f,this.ft=!0,this.tn=e}bt(){this.ft=!0}gt(){if(this.ft){const e=this.tn.$t().W().grid,A={Na:e.horzLines.visible,Aa:e.vertLines.visible,Fa:e.horzLines.color,Ia:e.vertLines.color,Wa:e.horzLines.style,za:e.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map((t=>({Ea:t.coord})))};this.Wt.J(A),this.ft=!1}return this.Wt}}class Jf{constructor(e){this.wn=new Xf(e)}qh(){return this.wn}}const gs={$a:4,Ua:1e-4};function Ar(r,e){const A=100*(r-e)/e;return e<0?-A:A}function Zf(r,e){const A=Ar(r.Ph(),e),t=Ar(r.Rh(),e);return new MA(A,t)}function Sr(r,e){const A=100*(r-e)/e+100;return e<0?-A:A}function qf(r,e){const A=Sr(r.Ph(),e),t=Sr(r.Rh(),e);return new MA(A,t)}function Fi(r,e){const A=Math.abs(r);if(A<1e-15)return 0;const t=Math.log10(A+e.Ua)+e.$a;return r<0?-t:t}function Hr(r,e){const A=Math.abs(r);if(A<1e-15)return 0;const t=Math.pow(10,A-e.$a)-e.Ua;return r<0?-t:t}function Lr(r,e){if(r===null)return null;const A=Fi(r.Ph(),e),t=Fi(r.Rh(),e);return new MA(A,t)}function Ui(r,e){if(r===null)return null;const A=Hr(r.Ph(),e),t=Hr(r.Rh(),e);return new MA(A,t)}function ms(r){if(r===null)return gs;const e=Math.abs(r.Rh()-r.Ph());if(e>=1||e<1e-15)return gs;const A=Math.ceil(Math.abs(Math.log10(e))),t=gs.$a+A;return{$a:t,Ua:1/Math.pow(10,t)}}class Bs{constructor(e,A){if(this.qa=e,this.Ya=A,(function(t){if(t<0)return!1;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let t=this.qa;t!==1;){if(t%2==0)this.Za.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),t/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,A,t){const i=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-A)))),s=0,o=this.Ya[0];for(;;){const u=bi(n,i,1e-14)&&n>i+1e-14,m=bi(n,t*o,1e-14),y=bi(n,1,1e-14);if(!(u&&m&&y))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=i+1e-14&&(n=i),n=Math.max(1,n),this.Za.length>0&&(l=n,a=1,c=1e-14,Math.abs(l-a)<c))for(s=0,o=this.Za[0];bi(n,t*o,1e-14)&&n>i+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,a,c;return n}}class ta{constructor(e,A,t,i){this.Ka=[],this.Li=e,this.qa=A,this.Ga=t,this.Ja=i}Xa(e,A){if(e<A)throw new Error("high < low");const t=this.Li.At(),i=(e-A)*this.Qa()/t,n=new Bs(this.qa,[2,2.5,2]),s=new Bs(this.qa,[2,2,2.5]),o=new Bs(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,A,i),s.Xa(e,A,i),o.Xa(e,A,i)),(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})(l)}io(){const e=this.Li,A=e.Ct();if(A===null)return void(this.Ka=[]);const t=e.At(),i=this.Ga(t-1,A),n=this.Ga(0,A),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=t-1-s,a=Math.max(i,n),c=Math.min(i,n);if(a===c)return void(this.Ka=[]);let u=this.Xa(a,c),m=a%u;m+=m<0?u:0;const y=a>=c?1:-1;let B=null,p=0;for(let Q=a-m;Q>c;Q-=u){const D=this.Ja(Q,A,!0);B!==null&&Math.abs(D-B)<this.Qa()||D<o||D>l||(p<this.Ka.length?(this.Ka[p].Ea=D,this.Ka[p].so=e.eo(Q)):this.Ka.push({Ea:D,so:e.eo(Q)}),p++,B=D,e.ro()&&(u=this.Xa(Q*y,c)))}this.Ka.length=p}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function ra(r){return r.slice().sort(((e,A)=>ue(e.Xi())-ue(A.Xi())))}var ia;(function(r){r[r.Normal=0]="Normal",r[r.Logarithmic=1]="Logarithmic",r[r.Percentage=2]="Percentage",r[r.IndexedTo100=3]="IndexedTo100"})(ia||(ia={}));const na=new Ml,sa=new yi(100,1);class Yf{constructor(e,A,t,i){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 uA,this.vo=new uA,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=sa,this.xo=ms(null),this.So=e,this.cn=A,this.ko=t,this.yo=i,this.Co=new ta(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(JA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const A=EA(e.scaleMargins.top),t=EA(e.scaleMargins.bottom);if(A<0||A>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${A}`);if(t<0||t>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${t}`);if(A+t>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${A+t}`);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(e){const A=this.Cr();let t=null;e.Wn!==void 0&&(this.cn.autoScale=e.Wn),e.Cr!==void 0&&(this.cn.mode=e.Cr,e.Cr!==2&&e.Cr!==3||(this.cn.autoScale=!0),this.oo._o=!1),A.Cr===1&&e.Cr!==A.Cr&&((function(n,s){if(n===null)return!1;const o=Hr(n.Ph(),s),l=Hr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(t=Ui(this.Ih,this.xo),t!==null&&this.Ao(t)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==A.Cr&&(t=Lr(this.Ih,this.xo),t!==null&&this.Ao(t));const i=A.Cr!==this.cn.mode;i&&(A.Cr===2||this.Mh())&&this.Ra(),i&&(A.Cr===3||this.Oo())&&this.Ra(),e.Bo!==void 0&&A.Bo!==e.Bo&&(this.cn.invertScale=e.Bo,this.Io()),this.vo.m(A,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(e){this.ho!==e&&(this.ho=e,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const e=this.At()-this.No()-this.Fo();return this.lo=e,e}Lh(){return this.Wo(),this.Ih}Ao(e,A){const t=this.Ih;(A||t===null&&e!==null||t!==null&&!t.Ch(e))&&(this.bo=null,this.Ih=e)}Ni(){return this.Wo(),this.ho===0||!this.Ih||this.Ih.Ni()}jo(e){return this.Bo()?e:this.At()-1-e}Rt(e,A){return this.Mh()?e=Ar(e,A):this.Oo()&&(e=Sr(e,A)),this.Po(e,A)}te(e,A,t){this.Wo();const i=this.Fo(),n=ue(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,a=this.Bo(),c=l/(o-s),u=t===void 0?0:t.from,m=t===void 0?e.length:t.to,y=this.Ho();for(let B=u;B<m;B++){const p=e[B],Q=p._t;if(isNaN(Q))continue;let D=Q;y!==null&&(D=y(p._t,A));const F=i+c*(D-s),_=a?F:this.ho-1-F;p.st=_}}be(e,A,t){this.Wo();const i=this.Fo(),n=ue(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,a=this.Bo(),c=l/(o-s),u=t===void 0?0:t.from,m=t===void 0?e.length:t.to,y=this.Ho();for(let B=u;B<m;B++){const p=e[B];let Q=p.ge,D=p.Me,F=p.xe,_=p.Se;y!==null&&(Q=y(p.ge,A),D=y(p.Me,A),F=y(p.xe,A),_=y(p.Se,A));let L=i+c*(Q-s),k=a?L:this.ho-1-L;p.pe=k,L=i+c*(D-s),k=a?L:this.ho-1-L,p.de=k,L=i+c*(F-s),k=a?L:this.ho-1-L,p.fe=k,L=i+c*(_-s),k=a?L:this.ho-1-L,p.me=k}}pn(e,A){const t=this.To(e,A);return this.$o(t,A)}$o(e,A){let t=e;return this.Mh()?t=(function(i,n){return n<0&&(i=-i),i/100*n+n})(t,A):this.Oo()&&(t=(function(i,n){return i-=100,n<0&&(i=-i),i/100*n+n})(t,A)),t}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let A=0;A<this.po.length;A++){const t=this.po[A];t.Xi()===null&&t.Ki(A+1),e.push(t)}return e=ra(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const A=this.po.indexOf(e);if(A===-1)throw new Error("source is not attached to scale");this.po.splice(A,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const A of this.po){const t=A.Ct();t!==null&&(e===null||t.la<e.la)&&(e=t)}return e===null?null:e.Vt}Bo(){return this.cn.invertScale}Ha(){const e=this.Ct()===null;if(this.bo!==null&&(e||this.bo.Xo===e))return this.bo.Ha;this.Co.io();const A=this.Co.Ha();return this.bo={Ha:A,Xo:e},this.fo.m(),A}Ko(){return this.fo}Go(e){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-e,this.ao=ue(this.Lh()).Th()))}Jo(e){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(e=this.ho-e)<0&&(e=0);let A=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const t=ue(this.ao).Th();A=Math.max(A,.1),t.Vh(A),this.Ao(t)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(e){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=e,this.ao=ue(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const A=ue(this.Lh()).Dh()/(this.Eo()-1);let t=e-this.Mo;this.Bo()&&(t*=-1);const i=t*A,n=ue(this.ao).Th();n.Oh(i),this.Ao(n,!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(e,A){switch(this.cn.mode){case 2:return this.s_(Ar(e,A));case 3:return this.ba().format(Sr(e,A));default:return this.Wh(e)}}eo(e){switch(this.cn.mode){case 2:return this.s_(e);case 3:return this.ba().format(e);default:return this.Wh(e)}}Yl(e){return this.Wh(e,ue(this.e_()).ba())}Zl(e,A){return e=Ar(e,A),this.s_(e,na)}r_(){return this.po}h_(e){this.oo={uo:e,_o:!1}}Vn(){this.po.forEach((e=>e.Vn()))}Ra(){this.bo=null;const e=this.e_();let A=100;e!==null&&(A=Math.round(1/e.ma())),this.wa=sa,this.Mh()?(this.wa=na,A=100):this.Oo()?(this.wa=new yi(100,1),A=100):e!==null&&(this.wa=e.ba()),this.Co=new ta(this,A,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(e,A){if(this.Wo(),this.Ni())return 0;e=this.ro()&&e?Fi(e,this.xo):e;const t=ue(this.Lh()),i=this.Fo()+(this.Eo()-1)*(e-t.Ph())/t.Dh();return this.jo(i)}To(e,A){if(this.Wo(),this.Ni())return 0;const t=this.jo(e),i=ue(this.Lh()),n=i.Ph()+i.Dh()*((t-this.Fo())/(this.Eo()-1));return this.ro()?Hr(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let A=null;const t=this.r_();let i=0,n=0;for(const l of t){if(!l.yt())continue;const a=l.Ct();if(a===null)continue;const c=l.Il(e.Os(),e.ui());let u=c&&c.Lh();if(u!==null){switch(this.cn.mode){case 1:u=Lr(u,this.xo);break;case 2:u=Zf(u,a.Vt);break;case 3:u=qf(u,a.Vt)}if(A=A===null?u:A.ts(ue(u)),c!==null){const m=c.Eh();m!==null&&(i=Math.max(i,m.above),n=Math.max(n,m.below))}}}if(i===this.co&&n===this.do||(this.co=i,this.do=n,this.bo=null,this.Do()),A!==null){if(A.Ph()===A.Rh()){const l=this.e_(),a=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(A=Ui(A,this.xo)),A=new MA(A.Ph()-a,A.Rh()+a),this.ro()&&(A=Lr(A,this.xo))}if(this.ro()){const l=Ui(A,this.xo),a=ms(l);if(s=a,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const c=this.ao!==null?Ui(this.ao,this.xo):null;this.xo=a,A=Lr(l,a),c!==null&&(this.ao=Lr(c,a))}}this.Ao(A)}else this.Ih===null&&(this.Ao(new MA(-.5,.5)),this.xo=ms(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ar:this.Oo()?Sr:this.ro()?e=>Fi(e,this.xo):null}a_(e,A,t){return A===void 0?(t===void 0&&(t=this.ba()),t.format(e)):A(e)}Wh(e,A){return this.a_(e,this.yo.priceFormatter,A)}s_(e,A){return this.a_(e,this.yo.percentageFormatter,A)}}class jf{constructor(e,A){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new uA,this.yl=e,this.$i=A,this.d_=new Jf(this);const t=A.W();this.f_=this.v_("left",t.leftPriceScale),this.p_=this.v_("right",t.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_(t)}b_(e){if(e.leftPriceScale&&this.f_.$h(e.leftPriceScale),e.rightPriceScale&&this.p_.$h(e.rightPriceScale),e.localization&&(this.f_.Ra(),this.p_.Ra()),e.overlayPriceScales){const A=Array.from(this.o_.values());for(const t of A){const i=ue(t[0].Dt());i.$h(e.overlayPriceScales),e.localization&&i.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?EA(this.o_.get(e))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((e=>{e.S&&e.S()})),this.c_.m()}M_(){return this.u_}x_(e){this.u_=e}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(e){this.__=e,this.k_()}Lo(e){this.ho=e,this.f_.Lo(e),this.p_.Lo(e),this.po.forEach((A=>{if(this.vr(A)){const t=A.Dt();t!==null&&t.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const A=e.Dt();return A===null||this.f_!==A&&this.p_!==A}qo(e,A,t){const i=t!==void 0?t:this.C_().y_+1;this.T_(e,A,i)}Zo(e){const A=this.po.indexOf(e);vt(A!==-1,"removeDataSource: invalid data source"),this.po.splice(A,1);const t=ue(e.Dt()).Pa();if(this.o_.has(t)){const n=EA(this.o_.get(t)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(t))}const i=e.Dt();i&&i.Ba().indexOf(e)>=0&&i.Zo(e),i!==null&&(i.Yo(),this.P_(i)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,A){e.Go(A)}O_(e,A){e.Jo(A),this.k_()}B_(e){e.Qo()}A_(e,A){e.t_(A)}I_(e,A){e.i_(A),this.k_()}z_(e){e.n_()}k_(){this.po.forEach((e=>{e.Vn()}))}vn(){let e=null;return this.$i.W().rightPriceScale.visible&&this.p_.Ba().length!==0?e=this.p_:this.$i.W().leftPriceScale.visible&&this.f_.Ba().length!==0?e=this.f_:this.po.length!==0&&(e=this.po[0].Dt()),e===null&&(e=this.p_),e}pr(){let e=null;return this.$i.W().rightPriceScale.visible?e=this.p_:this.$i.W().leftPriceScale.visible&&(e=this.f_),e}P_(e){e!==null&&e.Vo()&&this.L_(e)}E_(e){const A=this.yl.Xs();e.Ro({Wn:!0}),A!==null&&e.h_(A),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((e=>{this.vr(e)&&this.P_(e.Dt())})),this.k_(),this.$i.Uh()}Uo(){return this.mo===null&&(this.mo=ra(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(e){const A=e.r_();if(A&&A.length>0&&!this.yl.Ni()){const t=this.yl.Xs();t!==null&&e.h_(t)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let A=0,t=0;for(let i=0;i<e.length;i++){const n=e[i].Xi();n!==null&&(n<A&&(A=n),n>t&&(t=n))}return{H_:A,y_:t}}T_(e,A,t){let i=this.w_(A);if(i===null&&(i=this.v_(A,this.$i.W().overlayPriceScales)),this.po.push(e),!vi(A)){const n=this.o_.get(A)||[];n.push(e),this.o_.set(A,n)}i.qo(e),e.Gi(i),e.Ki(t),this.P_(i),this.mo=null}m_(e,A,t){A.Cr!==t.Cr&&this.L_(e)}v_(e,A){const t=Object.assign({visible:!0,autoScale:!0},pt(A)),i=new Yf(e,t,this.$i.W().layout,this.$i.W().localization);return i.Lo(this.At()),i}}class ep{constructor(e,A,t=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=e,this.q_=A,this.ir=t}Y_(e){const A=e.time,t=this.q_.cacheKey(A),i=this.tr.get(t);if(i!==void 0)return i.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(EA(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(t,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,t),this.Ke++,this.Ge++,n}}class Mr{constructor(e,A){vt(e<=A,"right should be >= left"),this.X_=e,this.K_=A}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(e){return this.X_<=e&&e<=this.K_}Ch(e){return this.X_===e.Os()&&this.K_===e.ui()}}function oa(r,e){return r===null||e===null?r===e:r.Ch(e)}class Ap{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(e){this.Q_=e,this.tr=null}iu(e,A){this.nu(A),this.tr=null;for(let t=A;t<e.length;++t){const i=e[t];let n=this.J_.get(i.timeWeight);n===void 0&&(n=[],this.J_.set(i.timeWeight,n)),n.push({index:t,time:i.time,weight:i.timeWeight,originalTime:i.originalTime})}}su(e,A){const t=Math.ceil(A/e);return this.tr!==null&&this.tr.eu===t||(this.tr={Ha:this.ru(t),eu:t}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const A=[];this.J_.forEach(((t,i)=>{e<=t[0].index?A.push(i):t.splice(xr(t,e,(n=>n.index<e)),1/0)}));for(const t of A)this.J_.delete(t)}ru(e){let A=[];for(const t of Array.from(this.J_.keys()).sort(((i,n)=>n-i))){if(!this.J_.get(t))continue;const i=A;A=[];const n=i.length;let s=0;const o=EA(this.J_.get(t)),l=o.length;let a=1/0,c=-1/0;for(let u=0;u<l;u++){const m=o[u],y=m.index;for(;s<n;){const B=i[s],p=B.index;if(!(p<y)){a=p;break}s++,A.push(B),c=p,a=1/0}if(a-y>=e&&y-c>=e)A.push(m),c=y;else if(this.Q_)return i}for(;s<n;s++)A.push(i[s])}return A}}class tr{constructor(e){this.hu=e}lu(){return this.hu===null?null:new Mr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new tr(null)}}function tp(r,e){return r.weight>e.weight?r:e}class rp{constructor(e,A,t,i){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Ap,this.du=new Map,this.fu=tr.ou(),this.vu=!0,this.pu=new uA,this.mu=new uA,this.bu=new uA,this.wu=null,this.gu=null,this.Mu=[],this.cn=A,this.yo=t,this.xu=A.rightOffset,this.Su=A.barSpacing,this.$i=e,this.q_=i,this.ku(),this.cu.tu(A.uniformDistribution)}W(){return this.cn}yu(e){JA(this.yo,e),this.Cu(),this.ku()}$h(e,A){var t;JA(this.cn,e),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),e.barSpacing!==void 0&&this.$i.Gn(e.barSpacing),e.rightOffset!==void 0&&this.$i.Jn(e.rightOffset),e.minBarSpacing!==void 0&&this.$i.Gn((t=e.barSpacing)!==null&&t!==void 0?t:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var A,t;return(t=(A=this.uu[e])===null||A===void 0?void 0:A.time)!==null&&t!==void 0?t:null}Ui(e){var A;return(A=this.uu[e])!==null&&A!==void 0?A:null}Va(e,A){if(this.uu.length<1)return null;if(this.q_.key(e)>this.q_.key(this.uu[this.uu.length-1].time))return A?this.uu.length-1:null;const t=xr(this.uu,this.q_.key(e),((i,n)=>this.q_.key(i.time)<n));return this.q_.key(e)<this.q_.key(this.uu[t].time)?A?t:null:t}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 e=this.Xs();if(e===null)return null;const A={from:e.Os(),to:e.ui()};return this.Ou(A)}Ou(e){const A=Math.round(e.from),t=Math.round(e.to),i=ue(this.Bu()),n=ue(this.Au());return{from:ue(this.Ui(Math.max(i,A))),to:ue(this.Ui(Math.min(n,t)))}}Iu(e){return{from:ue(this.Va(e.from,!0)),to:ue(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const A=this.Du(),t=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&t!==0){const i=this.Su*e/t;this.Su=i}if(this.cn.fixLeftEdge&&A!==null&&A.Os()<=0){const i=t-e;this.xu-=Math.round(i/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!br(e))return 0;const A=this.Eu()+this.xu-e;return this.__-(A+.5)*this.Su-1}Qs(e,A){const t=this.Eu(),i=A===void 0?0:A.from,n=A===void 0?e.length:A.to;for(let s=i;s<n;s++){const o=e[s].ot,l=t+this.xu-o,a=this.__-(l+.5)*this.Su-1;e[s].nt=a}}Nu(e){return Math.ceil(this.Fu(e))}Jn(e){this.vu=!0,this.xu=e,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(e){this.ju(e),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 e=this.Su,A=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),t=Math.round(A/e),i=ue(this.Xs()),n=Math.max(i.Os(),i.Os()-t),s=Math.max(i.ui(),i.ui()-t),o=this.cu.su(e,A),l=this.Bu()+t,a=this.Au()-t,c=this.$u(),u=this.cn.fixLeftEdge||c,m=this.cn.fixRightEdge||c;let y=0;for(const B of o){if(!(n<=B.index&&B.index<=s))continue;let p;y<this.Mu.length?(p=this.Mu[y],p.coord=this.It(B.index),p.label=this.Uu(B),p.weight=B.weight):(p={needAlignCoordinate:!1,coord:this.It(B.index),label:this.Uu(B),weight:B.weight},this.Mu.push(p)),this.Su>A/2&&!c?p.needAlignCoordinate=!1:p.needAlignCoordinate=u&&B.index<=l||m&&B.index>=a,y++}return this.Mu.length=y,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,A){const t=this.Fu(e),i=this.le(),n=i+A*(i/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(t-this.Fu(e)))}Go(e){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=e,this.Xu()))}Jo(e){if(this.wu===null)return;const A=os(this.__-e,0,this.__),t=os(this.__-ue(this.wo),0,this.__);A!==0&&t!==0&&this.Gn(this.wu.le*A/t)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(e){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=e,this.Xu()))}i_(e){if(this.Mo===null)return;const A=(this.Mo-e)/this.le();this.xu=ue(this.wu).Hu+A,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,A=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(A)||A<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const t=this.xu,i=performance.now();this.$i.Zn({Qu:n=>(n-i)/A>=1,tc:n=>{const s=(n-i)/A;return s>=1?e:t+(e-t)*s}})}bt(e,A){this.vu=!0,this.uu=e,this.cu.iu(e,A),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const A=e.G_();this.ju(this.__/A),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),A=this.Au();e!==null&&A!==null&&this.rc(new Mr(e,A+this.cn.rightOffset))}lc(e){const A=new Mr(e.from,e.to);this.rc(A)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:A}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||A.axisDoubleClickReset.time||A.axisPressedMouseMove.time||A.mouseWheel||A.pinch)}Bu(){return this.uu.length===0?null:0}Au(){return this.uu.length===0?null:this.uu.length-1}ac(e){return(this.__-1-e)/this.Su}Fu(e){const A=this.ac(e),t=this.Eu()+this.xu-A;return Math.round(1e6*t)/1e6}ju(e){const A=this.Su;this.Su=e,this.zu(),A!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(tr.ou());const e=this.Eu(),A=this.__/this.Su,t=this.xu+e,i=new Mr(t-A+1,t);this._c(new tr(i))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const A=.5*this.__;this.Su>A&&(this.Su=A,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.uu.length!==0?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const e=this.cc();e!==null&&this.xu<e&&(this.xu=e,this.vu=!0);const A=this.dc();this.xu>A&&(this.xu=A,this.vu=!0)}cc(){const e=this.Bu(),A=this._u;return e===null||A===null?null:e-A-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(e){let A=this.du.get(e.weight);return A===void 0&&(A=new ep((t=>this.fc(t)),this.q_),this.du.set(e.weight,A)),A.Y_(e)}fc(e){return this.q_.formatTickmark(e,this.yo)}_c(e){const A=this.fu;this.fu=e,oa(A.lu(),this.fu.lu())||this.pu.m(),oa(A.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 e=this.Bu();if(e===null)return;const A=this.Xs();if(A===null)return;const t=A.Os()-e;if(t<0){const i=this.xu-t-1;this.Jn(i)}this.zu()}Pu(){this.Lu(),this.zu()}}class ip{X(e,A,t){e.useMediaCoordinateSpace((i=>this.K(i,A,t)))}gl(e,A,t){e.useMediaCoordinateSpace((i=>this.vc(i,A,t)))}vc(e,A,t){}}class np extends ip{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:A,mediaSize:t}=e;let i=0;for(const s of this.zt.bc){if(s.Kt.length===0)continue;A.font=s.R;const o=this.wc(A,s.Kt);o>t.width?s.Zu=t.width/o:s.Zu=1,i+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((t.height-i)/2,0);break;case"bottom":n=Math.max(t.height-i,0)}A.fillStyle=this.zt.V;for(const s of this.zt.bc){A.save();let o=0;switch(this.zt.xc){case"left":A.textAlign="left",o=s.gc/2;break;case"center":A.textAlign="center",o=t.width/2;break;case"right":A.textAlign="right",o=t.width-1-s.gc/2}A.translate(o,n),A.textBaseline="top",A.font=s.R,A.scale(s.Zu,s.Zu),A.fillText(s.Kt,0,s.Sc),A.restore(),n+=s.gc*s.Zu}}wc(e,A){const t=this.kc(e.font);let i=t.get(A);return i===void 0&&(i=e.measureText(A).width,t.set(A,i)),i}kc(e){let A=this.mc.get(e);return A===void 0&&(A=new Map,this.mc.set(e,A)),A}}class sp{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new np(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.W(),A=this.Ft;A.yt=e.visible,A.yt&&(A.V=e.color,A.xc=e.horzAlign,A.Mc=e.vertAlign,A.bc=[{Kt:e.text,R:er(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class op extends ns{constructor(e,A){super(),this.cn=A,this.wn=new sp(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var la,aa,ca,ha,ua;(function(r){r[r.OnTouchEnd=0]="OnTouchEnd",r[r.OnNextTap=1]="OnNextTap"})(la||(la={}));class lp{constructor(e,A,t){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new uA,this.Rc=new uA,this.Dc=null,this.Vc=e,this.cn=A,this.q_=t,this.Oc=new Nd(this),this.yl=new rp(this,A.timeScale,this.cn.localization,t),this.vt=new Zd(this,A.crosshair),this.Bc=new Rf(A.crosshair),this.Ac=new op(this,A.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(CA.es())}Uh(){this.Nc(CA.ss())}oa(){this.Nc(new CA(1))}Gl(e){const A=this.Fc(e);this.Nc(A)}Wc(){return this.Tc}jc(e){const A=this.Tc;this.Tc=e,A!==null&&this.Gl(A.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){JA(this.cn,e),this.yc.forEach((A=>A.b_(e))),e.timeScale!==void 0&&this.yl.$h(e.timeScale),e.localization!==void 0&&this.yl.yu(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(e,A){if(e==="left")return void this.$h({leftPriceScale:A});if(e==="right")return void this.$h({rightPriceScale:A});const t=this.Uc(e);t!==null&&(t.Dt.$h(A),this.Pc.m())}Uc(e){for(const A of this.yc){const t=A.w_(e);if(t!==null)return{Ht:A,Dt:t}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(e,A){e.Lo(A),this.Wu()}S_(e){this.__=e,this.yl.S_(this.__),this.yc.forEach((A=>A.S_(e))),this.Wu()}Ic(e){const A=new jf(this.yl,this);e!==void 0?this.yc.splice(e,0,A):this.yc.push(A);const t=e===void 0?this.yc.length-1:e,i=CA.es();return i.Nn(t,{Fn:0,Wn:!0}),this.Nc(i),A}V_(e,A,t){e.V_(A,t)}O_(e,A,t){e.O_(A,t),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,A){e.B_(A),this.Nc(this.Gc(e,2))}A_(e,A,t){A.Vo()||e.A_(A,t)}I_(e,A,t){A.Vo()||(e.I_(A,t),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,A){A.Vo()||(e.z_(A),this.Nc(this.Gc(e,2)))}E_(e,A){e.E_(A),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,A){const t=this.St();if(t.Ni()||A===0)return;const i=t.Hi();e=Math.max(1,Math.min(e,i)),t.Zu(e,A),this.Wu()}td(e){this.nd(0),this.sd(e),this.ed()}rd(e){this.yl.Jo(e),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(e){this.yl.t_(e)}sd(e){this.yl.i_(e),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(e,A,t,i,n){this.vt.gn(e,A);let s=NaN,o=this.yl.Nu(e);const l=this.yl.Xs();l!==null&&(o=Math.min(Math.max(l.Os(),o),l.ui()));const a=i.vn(),c=a.Ct();c!==null&&(s=a.pn(A,c)),s=this.Bc.Oa(s,o,i),this.vt.kn(o,s,i),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:A},t)}ad(e,A,t){const i=t.vn(),n=i.Ct(),s=i.Rt(e,ue(n)),o=this.yl.Va(A,!0),l=this.yl.It(ue(o));this.ld(l,s,null,t,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const A=this.vt.xn(),t=this.vt.Sn();this.ld(A,t,null,e)}this.vt.Vn()}_d(e,A,t){const i=this.yl.mn(0);A!==void 0&&t!==void 0&&this.yl.bt(A,t);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&i!==null&&n!==null){const l=o.Kr(s),a=this.q_.key(i)>this.q_.key(n),c=e!==null&&e>s&&!a,u=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,m=l&&(t!==void 0||u)&&this.yl.W().shiftVisibleRangeOnNewBar;if(c&&!m){const y=e-s;this.yl.Jn(this.yl.Hu()-y)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const A=this.yc.find((t=>t.Uo().includes(e)));return A===void 0?null:A}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.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(e,A,t){const i=this.yc[0],n=this.fd(A,e,i,t);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const A=this.dr(e),t=this.Cc.indexOf(e);vt(t!==-1,"Series not found"),this.Cc.splice(t,1),ue(A).Zo(e),e.S&&e.S()}Xl(e,A){const t=ue(this.dr(e));t.Zo(e);const i=this.Uc(A);if(i===null){const n=e.Xi();t.qo(e,A,n)}else{const n=i.Ht===t?e.Xi():void 0;i.Ht.qo(e,A,n)}}hc(){const e=CA.ss();e.$n(),this.Nc(e)}pd(e){const A=CA.ss();A.Yn(e),this.Nc(A)}Kn(){const e=CA.ss();e.Kn(),this.Nc(e)}Gn(e){const A=CA.ss();A.Gn(e),this.Nc(A)}Jn(e){const A=CA.ss();A.Jn(e),this.Nc(A)}Zn(e){const A=CA.ss();A.Zn(e),this.Nc(A)}Un(){const e=CA.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const A=this.Ec,t=this.zc;if(A===t)return A;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==t||this.Dc.Rs!==A)this.Dc={Ps:t,Rs:A,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const i=(function(n,s,o){const[l,a,c,u]=yr(n),[m,y,B,p]=yr(s),Q=[VA(l+o*(m-l)),VA(a+o*(y-a)),VA(c+o*(B-c)),Tl(u+o*(p-u))];return`rgba(${Q[0]}, ${Q[1]}, ${Q[2]}, ${Q[3]})`})(t,A,e/100);return this.Dc.wd.set(e,i),i}Gc(e,A){const t=new CA(A);if(e!==null){const i=this.yc.indexOf(e);t.Nn(i,{Fn:A})}return t}Fc(e,A){return A===void 0&&(A=2),this.Gc(this.dr(e),A)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((A=>A.j_().qh().bt()))}fd(e,A,t,i){const n=new ps(this,e,A,t,i),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return t.qo(n,s),vi(s)||n.$h(e),n}Lc(e){const A=this.cn.layout;return A.background.type==="gradient"?e===0?A.background.topColor:A.background.bottomColor:A.background.color}}function ws(r){return!tt(r)&&!Tr(r)}function da(r){return tt(r)}(function(r){r[r.Disabled=0]="Disabled",r[r.Continuous=1]="Continuous",r[r.OnDataUpdate=2]="OnDataUpdate"})(aa||(aa={})),(function(r){r[r.LastBar=0]="LastBar",r[r.LastVisible=1]="LastVisible"})(ca||(ca={})),(function(r){r.Solid="solid",r.VerticalGradient="gradient"})(ha||(ha={})),(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"})(ua||(ua={}));const fa=r=>r.getUTCFullYear();function ap(r,e,A){return e.replace(/yyyy/g,(t=>gt(fa(t),4))(r)).replace(/yy/g,(t=>gt(fa(t)%100,2))(r)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(r,A)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(r,A)).replace(/MM/g,(t=>gt((i=>i.getUTCMonth()+1)(t),2))(r)).replace(/dd/g,(t=>gt((i=>i.getUTCDate())(t),2))(r))}class pa{constructor(e="yyyy-MM-dd",A="default"){this.gd=e,this.Md=A}Y_(e){return ap(e,this.gd,this.Md)}}class cp{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",gt(e.getUTCHours(),2)).replace("%m",gt(e.getUTCMinutes(),2)).replace("%s",gt(e.getUTCSeconds(),2))}}const hp={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class up{constructor(e={}){const A=Object.assign(Object.assign({},hp),e);this.Td=new pa(A.Sd,A.Cd),this.Pd=new cp(A.kd),this.Rd=A.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function Ei(r){return 60*r*60*1e3}function Cs(r){return 60*r*1e3}const Si=[{Dd:(ga=1,1e3*ga),Vd:10},{Dd:Cs(1),Vd:20},{Dd:Cs(5),Vd:21},{Dd:Cs(30),Vd:22},{Dd:Ei(1),Vd:30},{Dd:Ei(3),Vd:31},{Dd:Ei(6),Vd:32},{Dd:Ei(12),Vd:33}];var ga;function ma(r,e){if(r.getUTCFullYear()!==e.getUTCFullYear())return 70;if(r.getUTCMonth()!==e.getUTCMonth())return 60;if(r.getUTCDate()!==e.getUTCDate())return 50;for(let A=Si.length-1;A>=0;--A)if(Math.floor(e.getTime()/Si[A].Dd)!==Math.floor(r.getTime()/Si[A].Dd))return Si[A].Vd;return 0}function vs(r){let e=r;if(Tr(r)&&(e=ys(r)),!ws(e))throw new Error("time must be of type BusinessDay");const A=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(A.getTime()/1e3),Bd:e}}function Ba(r){if(!da(r))throw new Error("time must be of type isUTCTimestamp");return{Od:r}}function ys(r){const e=new Date(r);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${r}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function wa(r){Tr(r.time)&&(r.time=ys(r.time))}class Ca{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(A){A.forEach(wa)})(e):wa(e)}createConverterToInternalObj(e){return ue((function(A){return A.length===0?null:ws(A[0].time)||Tr(A[0].time)?vs:Ba})(e))}key(e){return typeof e=="object"&&"Od"in e?e.Od:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const A=e;return A.Bd===void 0?new Date(1e3*A.Od).getTime():new Date(Date.UTC(A.Bd.year,A.Bd.month-1,A.Bd.day)).getTime()}convertHorzItemToInternal(e){return da(A=e)?Ba(A):ws(A)?vs(A):vs(ys(A));var A}updateFormatter(e){if(!this.cn)return;const A=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new up({Sd:A,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new pa(A,e.locale)}formatHorzItem(e){const A=e;return this.Ad.Y_(new Date(1e3*A.Od))}formatTickmark(e,A){const t=(function(n,s,o){switch(n){case 0:case 10:return s?o?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return s?3:2;case 50:return 2;case 60:return 1;case 70:return 0}})(e.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),i=this.cn.timeScale;if(i.tickMarkFormatter!==void 0){const n=i.tickMarkFormatter(e.originalTime,t,A.locale);if(n!==null)return n}return(function(n,s,o){const l={};switch(s){case 0:l.year="numeric";break;case 1:l.month="short";break;case 2:l.day="numeric";break;case 3:l.hour12=!1,l.hour="2-digit",l.minute="2-digit";break;case 4:l.hour12=!1,l.hour="2-digit",l.minute="2-digit",l.second="2-digit"}const a=n.Bd===void 0?new Date(1e3*n.Od):new Date(Date.UTC(n.Bd.year,n.Bd.month-1,n.Bd.day));return new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()).toLocaleString(o,l)})(e.time,t,A.locale)}maxTickMarkWeight(e){let A=e.reduce(tp,e[0]).weight;return A>30&&A<50&&(A=30),A}fillWeightsForPoints(e,A){(function(t,i=0){if(t.length===0)return;let n=i===0?null:t[i-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let l=i;l<t.length;++l){const a=t[l],c=new Date(1e3*a.time.Od);s!==null&&(a.timeWeight=ma(c,s)),o+=a.time.Od-(n||a.time.Od),n=a.time.Od,s=c}if(i===0&&t.length>1){const l=Math.ceil(o/(t.length-1)),a=new Date(1e3*(t[0].time.Od-l));t[0].timeWeight=ma(new Date(1e3*t[0].time.Od),a)}})(e,A)}static Id(e){return JA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const rr=typeof window<"u";function va(){return!!rr&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function bs(){return!!rr&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Ts(r){return r+r%2}function Qs(r,e){return r.zd-e.zd}function xs(r,e,A){const t=(r.zd-e.zd)/(r.ot-e.ot);return Math.sign(t)*Math.min(Math.abs(t),A)}class dp{constructor(e,A,t,i){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=e,this.Ud=A,this.qd=t,this.rs=i}Yd(e,A){if(this.Ld!==null){if(this.Ld.ot===A)return void(this.Ld.zd=e);if(Math.abs(this.Ld.zd-e)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:A,zd:e}}Vr(e,A){if(this.Ld===null||this.Ed===null||A-this.Ld.ot>50)return;let t=0;const i=xs(this.Ld,this.Ed,this.Ud),n=Qs(this.Ld,this.Ed),s=[i],o=[n];if(t+=n,this.Nd!==null){const a=xs(this.Ed,this.Nd,this.Ud);if(Math.sign(a)===Math.sign(i)){const c=Qs(this.Ed,this.Nd);if(s.push(a),o.push(c),t+=c,this.Fd!==null){const u=xs(this.Nd,this.Fd,this.Ud);if(Math.sign(u)===Math.sign(i)){const m=Qs(this.Nd,this.Fd);s.push(u),o.push(m),t+=m}}}}let l=0;for(let a=0;a<s.length;++a)l+=o[a]/t*s[a];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:A},this.Hd=l,this.jd=(function(a,c){const u=Math.log(c);return Math.log(1*u/-a)/u})(Math.abs(l),this.qd))}tc(e){const A=ue(this.Wd),t=e-A.ot;return A.zd+this.Hd*(Math.pow(this.qd,t)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const A=e-ue(this.Wd).ot;return Math.min(A,this.jd)}}class fp{constructor(e,A){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=e,this.Qd=A,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 Ql(yr(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.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 Nt(r,e){const A=ue(r.ownerDocument).createElement("canvas");r.appendChild(A);const t=Td(A,{options:{allowResizeObserver:!1},transform:(i,n)=>({width:Math.max(i.width,n.width),height:Math.max(i.height,n.height)})});return t.resizeCanvasElement(e),t}function Kt(r){var e;r.width=1,r.height=1,(e=r.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function Fs(r,e,A,t){r.gl&&r.gl(e,A,t)}function Hi(r,e,A,t){r.X(e,A,t)}function Us(r,e,A,t){const i=r(A,t);for(const n of i){const s=n.gt();s!==null&&e(s)}}function pp(r){rr&&window.chrome!==void 0&&r.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Es{constructor(e,A,t){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=!bs(),this.Af=i=>{this.If(i)},this.zf=i=>{if(this.Lf(i)){const n=this.Ef(i);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(rt(i),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(i);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(rt(i),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=A,this.cn=t,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(e){this.Sf&&this.Sf();const A=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",A)},this.Zf.addEventListener("mousemove",A),this.Lf(e))return;const t=this.Ef(e);this.Uf(t,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(e){if(this.Df||this.pf!==null||this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.tv),this.Bf=!0}iv(e){const A=Ss(e.changedTouches,ue(this.Of));if(A===null||(this.Vf=Li(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const t=this.Ff(rt(A),ue(this.pf)),{nv:i,sv:n,Nf:s}=t;if(this.mf||!(s<5)){if(!this.mf){const o=.5*i,l=n>=o&&!this.cn.ev(),a=o>n&&!this.cn.rv();l||a||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,A);this.Wf(o,this.Hf.hv),ir(e)}}}lv(e){if(e.button!==0)return;const A=this.Ff(rt(e),ue(this.vf)),{Nf:t}=A;if(t>=5&&(this.bf=!0,this.Yf()),this.bf){const i=this.Ef(e);this.Uf(i,this.Hf.av)}}Ff(e,A){const t=Math.abs(A.nt-e.nt),i=Math.abs(A.st-e.st);return{nv:t,sv:i,Nf:t+i}}ov(e){let A=Ss(e.changedTouches,ue(this.Of));if(A===null&&e.touches.length===0&&(A=e.changedTouches[0]),A===null)return;this.Of=null,this.Vf=Li(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const t=this.Ef(e,A);if(this.Wf(t,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:i}=this.Ff(rt(A),this.cf);i<30&&!this.wf&&this.Wf(t,this.Hf.jf),this.$f()}else this.wf||(this.Wf(t,this.Hf.uv),this.Hf.uv&&ir(e));this._f===0&&ir(e),e.touches.length===0&&this.ff&&(this.ff=!1,ir(e))}If(e){if(e.button!==0)return;const A=this.Ef(e);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),va()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(e))if(this.Uf(A,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:t}=this.Ff(rt(e),this.af);t<5&&!this.bf&&this.Uf(A,this.Hf.qf),this.Yf()}else this.bf||this.Uf(A,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(e){if(this.Of!==null)return;const A=e.changedTouches[0];this.Of=A.identifier,this.Vf=Li(e);const t=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=rt(A),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{t.removeEventListener("touchmove",n),t.removeEventListener("touchend",s)},t.addEventListener("touchmove",n,{passive:!1}),t.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,e),240)}const i=this.Ef(e,A);this.Wf(i,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=rt(A))}mv(e){if(e.button!==0)return;const A=this.Zf.ownerDocument.documentElement;va()&&A.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=rt(e),this.kf&&(this.kf(),this.kf=null);{const i=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{A.removeEventListener("mousemove",i),A.removeEventListener("mouseup",n)},A.addEventListener("mousemove",i),A.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(e))return;const t=this.Ef(e);this.Uf(t,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=rt(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,A=t=>{this.Hf.wv&&(t.composed&&this.Zf.contains(t.composedPath()[0])||t.target&&this.Zf.contains(t.target)||this.Hf.wv())};this.Mf=()=>{e.removeEventListener("touchstart",A)},this.gf=()=>{e.removeEventListener("mousedown",A)},e.addEventListener("mousedown",A),e.addEventListener("touchstart",A,{passive:!0})}bs()&&(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}),pp(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",(e=>this.yv(e.touches)),{passive:!0}),this.Zf.addEventListener("touchmove",(e=>{if(e.touches.length===2&&this.Cf!==null&&this.Hf.Sv!==void 0){const A=ya(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,A),ir(e)}}),{passive:!1}),this.Zf.addEventListener("touchend",(e=>{this.yv(e.touches)})))}yv(e){e.length===1&&(this.Pf=!1),e.length!==2||this.Pf||this.ff?this.Cv():this.Tv(e)}Tv(e){const A=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(e[0].clientX-A.left+(e[1].clientX-A.left))/2,st:(e[0].clientY-A.top+(e[1].clientY-A.top))/2},this.Tf=ya(e[0],e[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(e){if(this.Sf&&this.Sf(),this.Lf(e)||!this.Bf)return;const A=this.Ef(e);this.Uf(A,this.Hf.Pv),this.Bf=!bs()}vv(e){const A=Ss(e.touches,ue(this.Of));if(A===null)return;const t=this.Ef(e,A);this.Wf(t,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:Li(e)<this.Vf+500}Wf(e,A){A&&A.call(this.Hf,e)}Uf(e,A){A&&A.call(this.Hf,e)}Ef(e,A){const t=A||e,i=this.Zf.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-i.left,localY:t.clientY-i.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:t.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&ir(e)}}}}function ya(r,e){const A=r.clientX-e.clientX,t=r.clientY-e.clientY;return Math.sqrt(A*A+t*t)}function ir(r){r.cancelable&&r.preventDefault()}function rt(r){return{nt:r.pageX,st:r.pageY}}function Li(r){return r.timeStamp||performance.now()}function Ss(r,e){for(let A=0;A<r.length;++A)if(r[A].identifier===e)return r[A];return null}function Mi(r){return{Hc:r.Hc,Iv:{gr:r.zv.externalId},Lv:r.zv.cursorStyle}}function gp(r,e,A){for(const t of r){const i=t.gt();if(i!==null&&i.wr){const n=i.wr(e,A);if(n!==null)return{Bv:t,Iv:n}}}return null}function Hs(r,e){return A=>{var t,i,n,s;return((i=(t=A.Dt())===null||t===void 0?void 0:t.Pa())!==null&&i!==void 0?i:"")!==e?[]:(s=(n=A.da)===null||n===void 0?void 0:n.call(A,r))!==null&&s!==void 0?s:[]}}function ba(r,e,A,t){if(!r.length)return;let i=0;const n=A/2,s=r[0].At(t,!0);let o=e===1?n-(r[0].Vi()-s/2):r[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<r.length;l++){const a=r[l],c=r[l-1],u=c.At(t,!1),m=a.Vi(),y=c.Vi();if(e===1?m>y-u:m<y+u){const B=y-u*e;a.Oi(B);const p=B-e*u/2;if((e===1?p<0:p>A)&&o>0){const Q=e===1?-1-p:p-A,D=Math.min(Q,o);for(let F=i;F<r.length;F++)r[F].Oi(r[F].Vi()+e*D);o-=D}}else i=l,o=e===1?y-u-m:m-(y+u)}}class Ta{constructor(e,A,t,i){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Fr(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=e,this.cn=A,this.ko=A.layout,this.Oc=t,this.qv=i==="left",this.Yv=Hs("normal",i),this.Zv=Hs("top",i),this.Xv=Hs("bottom",i),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=Nt(this.Kv,sA({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=Nt(this.Kv,sA({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const s=this.Jv.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0";const o={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 Es(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Kt(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Kt(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 e=this.Oc.W();return this.Qr!==e.R&&(this.Fv.nr(),this.Qr=e.R),e}op(){if(this.Li===null)return 0;let e=0;const A=this.ap(),t=ue(this.Gv.canvasElement.getContext("2d"));t.save();const i=this.Li.Ha();t.font=this._p(),i.length>0&&(e=Math.max(this.Fv.xi(t,i[0].so),this.Fv.xi(t,i[i.length-1].so)));const n=this.up();for(let a=n.length;a--;){const c=this.Fv.xi(t,n[a].Kt());c>e&&(e=c)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const a=this.Li.pn(1,s),c=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(t,this.Li.Fi(Math.floor(Math.min(a,c))+.11111111111111,s)),this.Fv.xi(t,this.Li.Fi(Math.ceil(Math.max(a,c))-.11111111111111,s)))}var o;t.restore();const l=e||34;return Ts(Math.ceil(A.C+A.T+A.A+A.I+5+l))}cp(e){this.Ev!==null&&Dt(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`)}dp(){return ue(this.Ev).width}Gi(e){this.Li!==e&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=e,e.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const e=this.tn.fp();this.tn.$v().$t().E_(e,ue(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const t=kt(this.Gv);t!==null&&(t.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i)})),this.tn.bp(t,this.Xv),this.wp(t),this.tn.bp(t,this.Yv),this.gp(t))}this.Jv.applySuggestedBitmapSize();const A=kt(this.Jv);A!==null&&(A.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.Mp(A),this.tn.bp(A,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,A,t){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,A,t)}bt(){var e;(e=this.Li)===null||e===void 0||e.Ha()}Qv(e){if(this.Li===null||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const A=this.tn.$v().$t(),t=this.tn.fp();this.Nv=!0,A.V_(t,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const A=this.tn.$v().$t(),t=this.tn.fp(),i=this.Li;A.O_(t,i,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),A=this.tn.fp(),t=this.Li;this.Nv&&(this.Nv=!1,e.B_(A,t))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const A=this.tn.$v().$t(),t=this.tn.fp();this.Nv=!1,A.B_(t,this.Li)}sp(e){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(e){this.Li!==null&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(e){this.kp(0)}up(){const e=[],A=this.Li===null?void 0:this.Li;return(t=>{for(let i=0;i<t.length;++i){const n=t[i].Rn(this.tn.fp(),A);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:A}){const{width:t,height:i}=A,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?wi(e,0,0,t,i,s):Ul(e,0,0,t,i,s,o)}Ie({context:e,bitmapSize:A,horizontalPixelRatio:t}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const i=Math.max(1,Math.floor(this.ap().C*t));let n;n=this.qv?A.width-i:0,e.fillRect(n,0,i,A.height)}wp(e){if(this.Ev===null||this.Li===null)return;const A=this.Li.Ha(),t=this.Li.W(),i=this.ap(),n=this.qv?this.Ev.width-i.T:0;t.borderVisible&&t.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=t.borderColor;const a=Math.max(1,Math.floor(l)),c=Math.floor(.5*l),u=Math.round(i.T*o);s.beginPath();for(const m of A)s.rect(Math.floor(n*o),Math.round(m.Ea*l)-c,u,a);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=t.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const l=this.qv?Math.round(n-i.A):Math.round(n+i.T+i.A),a=A.map((c=>this.Fv.Mi(s,c.so)));for(let c=A.length;c--;){const u=A[c];s.fillText(u.so,l,u.Ea+a[c])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],A=this.Li.Uo().slice(),t=this.tn.fp(),i=this.ap();this.Li===t.pr()&&this.tn.fp().Uo().forEach((s=>{t.vr(s)&&A.push(s)}));const n=this.Li;A.forEach((s=>{s.Rn(t,n).forEach((o=>{o.Oi(null),o.Bi()&&e.push(o)}))})),e.forEach((s=>s.Oi(s.ki()))),this.Li.W().alignLabels&&this.yp(e,i)}yp(e,A){if(this.Ev===null)return;const t=this.Ev.height/2,i=e.filter((s=>s.ki()<=t)),n=e.filter((s=>s.ki()>t));i.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(A)/2),l=s.ki();l>-o&&l<o&&s.Oi(o),l>this.Ev.height-o&&l<this.Ev.height+o&&s.Oi(this.Ev.height-o)}ba(i,1,this.Ev.height,A),ba(n,-1,this.Ev.height,A)}gp(e){if(this.Ev===null)return;const A=this.up(),t=this.ap(),i=this.qv?"right":"left";A.forEach((n=>{n.Ai()&&n.gt(ue(this.Li)).X(e,t,this.Fv,i)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const A=this.tn.$v().$t(),t=[],i=this.tn.fp(),n=A.Zc().Rn(i,this.Li);n.length&&t.push(n);const s=this.ap(),o=this.qv?"right":"left";t.forEach((l=>{l.forEach((a=>{a.gt(ue(this.Li)).X(e,s,this.Fv,o)}))}))}kp(e){this.Kv.style.cursor=e===1?"ns-resize":"default"}fo(){const e=this.op();this.Wv<e&&this.tn.$v().$t().Kl(),this.Wv=e}_p(){return er(this.ko.fontSize,this.ko.fontFamily)}}function mp(r,e){var A,t;return(t=(A=r.ua)===null||A===void 0?void 0:A.call(r,e))!==null&&t!==void 0?t:[]}function Ii(r,e){var A,t;return(t=(A=r.Pn)===null||A===void 0?void 0:A.call(r,e))!==null&&t!==void 0?t:[]}function Bp(r,e){var A,t;return(t=(A=r.Ji)===null||A===void 0?void 0:A.call(r,e))!==null&&t!==void 0?t:[]}function wp(r,e){var A,t;return(t=(A=r.aa)===null||A===void 0?void 0:A.call(r,e))!==null&&t!==void 0?t:[]}class Ls{constructor(e,A){this.Ev=sA({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new uA,this.Op=new uA,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=e,this.Np=A,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 t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="relative",t.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(t),this.Gv=Nt(t,sA({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=Nt(t,sA({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.$p=document.createElement("tr"),this.$p.appendChild(this.jp),this.$p.appendChild(this.Wp),this.$p.appendChild(this.Hp),this.Up(),this.hp=new Es(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),Kt(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Kt(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return ue(this.Np)}qp(e){var A,t;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(Ls.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=(A=this.Pp)!==null&&A!==void 0?A:new fp(this.Wp,this.Qd),this.Pp.bt()):((t=this.Pp)===null||t===void 0||t.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 e=this.Np.R_();this.Cp.Gi(ue(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(ue(e))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(e){this.Np&&this.Np.x_(e)}Qf(e){if(!this.Np)return;this.Kp();const A=e.localX,t=e.localY;this.Gp(A,t,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var A;if(!this.Np)return;this.Kp();const t=e.localX,i=e.localY;this.Gp(t,i,e);const n=this.wr(t,i);this.Qd.Qp((A=n?.Lv)!==null&&A!==void 0?A:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(e){this.Np!==null&&(this.Kp(),this.tm(e))}qf(e){this.Np!==null&&this.im(this.Op,e)}jf(e){this.qf(e)}av(e){this.Kp(),this.nm(e),this.Gp(e.localX,e.localY,e)}cv(e){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(e))}uv(e){this.Np!==null&&this.tm(e)}Rv(e){if(this.Ap=!0,this.Ip===null){const A={x:e.localX,y:e.localY};this.rm(A,A,e)}}Pv(e){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(e,A){if(!this.Qd.W().handleScale.pinch)return;const t=5*(A-this.Bp);this.Bp=A,this.$i().Qc(e.nt,t)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const A=this.$i().Zc();this.Ip!==null&&A.yt()&&(this.Lp={x:A.Yt(),y:A.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const A=e.localX,t=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const i=ue(this.Lp),n=i.x+(A-this.Ip.x),s=i.y+(t-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,A){const t=this.Np;return t===null?null:(function(i,n,s){const o=i.Uo(),l=(function(a,c,u){var m,y;let B,p;for(const F of a){const _=(y=(m=F.va)===null||m===void 0?void 0:m.call(F,c,u))!==null&&y!==void 0?y:[];for(const L of _)Q=L.zOrder,(!(D=B?.zOrder)||Q==="top"&&D!=="top"||Q==="normal"&&D==="bottom")&&(B=L,p=F)}var Q,D;return B&&p?{zv:B,Hc:p}:null})(o,n,s);if(l?.zv.zOrder==="top")return Mi(l);for(const a of o){if(l&&l.Hc===a&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Mi(l);const c=gp(a.Pn(i),n,s);if(c!==null)return{Hc:a,Bv:c.Bv,Iv:c.Iv};if(l&&l.Hc===a&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Mi(l)}return l?.zv?Mi(l):null})(t,e,A)}_m(e,A){ue(A==="left"?this.Cp:this.Tp).cp(sA({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){Dt(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Wp.style.width=e.width+"px",this.Wp.style.height=e.height+"px")}dm(){const e=ue(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const A of e.Ba())if(e.vr(A)){const t=A.Dt();t!==null&&e.P_(t),A.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,A,t){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,A,t)}vp(e){if(e===0||this.Np===null)return;if(e>1&&this.dm(),this.Cp!==null&&this.Cp.vp(e),this.Tp!==null&&this.Tp.vp(e),e!==1){this.Gv.applySuggestedBitmapSize();const t=kt(this.Gv);t!==null&&(t.useBitmapCoordinateSpace((i=>{this.mp(i)})),this.Np&&(this.fm(t,mp),this.vm(t),this.pm(t),this.fm(t,Ii),this.fm(t,Bp)))}this.Jv.applySuggestedBitmapSize();const A=kt(this.Jv);A!==null&&(A.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.bm(A),this.fm(A,wp))}wm(){return this.Cp}gm(){return this.Tp}bp(e,A){this.fm(e,A)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(e){this.im(this.Vp,e)}im(e,A){const t=A.localX,i=A.localY;e.M()&&e.m(this.$i().St().Nu(t),{x:t,y:i},A)}mp({context:e,bitmapSize:A}){const{width:t,height:i}=A,n=this.$i(),s=n.q(),o=n.bd();s===o?wi(e,0,0,t,i,o):Ul(e,0,0,t,i,s,o)}vm(e){const A=ue(this.Np).j_().qh().gt();A!==null&&A.X(e,!1)}pm(e){const A=this.$i().Yc();this.Mm(e,Ii,Fs,A),this.Mm(e,Ii,Hi,A)}bm(e){this.Mm(e,Ii,Hi,this.$i().Zc())}fm(e,A){const t=ue(this.Np).Uo();for(const i of t)this.Mm(e,A,Fs,i);for(const i of t)this.Mm(e,A,Hi,i)}Mm(e,A,t,i){const n=ue(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===i,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;Us(A,(a=>t(a,e,o,l)),i,n)}Zp(){if(this.Np===null)return;const e=this.Qd,A=this.Np.R_().W().visible,t=this.Np.D_().W().visible;A||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),t||this.Tp===null||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const i=e.$t().ud();A&&this.Cp===null&&(this.Cp=new Ta(this,e.W(),i,"left"),this.jp.appendChild(this.Cp.lp())),t&&this.Tp===null&&(this.Tp=new Ta(this,e.W(),i,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,A,t){this.$i().ld(this.Sm(e),this.km(A),t,ue(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,A,t){this.Ip=e,this.zp=!1,this.Gp(A.x,A.y,t);const i=this.$i().Zc();this.Lp={x:i.Yt(),y:i.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const A=this.$i(),t=this.fp();if(A.z_(t,t.vn()),this.Rp=null,this.Dp=!1,A.ed(),this.Ep!==null){const i=performance.now(),n=A.St();this.Ep.Vr(n.Hu(),i),this.Ep.Qu(i)||A.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)ue(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(e){if(this.Np===null)return;const A=this.$i(),t=A.St();if(t.Ni())return;const i=this.Qd.W(),n=i.handleScroll,s=i.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),l=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:l,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const a=t.le();this.Ep=new dp(.2/a,7/a,.997,15/a),this.Ep.Yd(t.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||A.A_(this.Np,o,e.localY),A.nd(e.localX),this.Dp=!0}this.Dp&&(o.Ni()||A.I_(this.Np,o,e.localY),A.sd(e.localX),this.Ep!==null&&this.Ep.Yd(t.Hu(),l))}}class Qa{constructor(e,A,t,i,n){this.ft=!0,this.Ev=sA({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=t.ud,this.cn=A,this.Tm=i,this.Pm=n,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=Nt(this.Kv,sA({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Kt(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){Dt(this.Ev,e)||(this.Ev=e,this.Gv.resizeCanvasElement(e),this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.ft=!0)}vp(e){if(e<3&&!this.ft||this.Ev.width===0||this.Ev.height===0)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const A=kt(this.Gv);A!==null&&A.useBitmapCoordinateSpace((t=>{this.mp(t),this.Ie(t)}))}xp(){return this.Gv.bitmapSize}Sp(e,A,t){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,A,t)}Ie({context:e,bitmapSize:A,horizontalPixelRatio:t,verticalPixelRatio:i}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*t),s=Math.floor(this.Oc.W().C*i),o=this.qv?A.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:A}){wi(e,0,0,A.width,A.height,this.Pm())}}function Ms(r){return e=>{var A,t;return(t=(A=e.fa)===null||A===void 0?void 0:A.call(e,r))!==null&&t!==void 0?t:[]}}const Cp=Ms("normal"),vp=Ms("top"),yp=Ms("bottom");class bp{constructor(e,A){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=sA({width:0,height:0}),this.Om=new uA,this.Fv=new Fr(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=e,this.q_=A,this.cn=e.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=Nt(this.Im,sA({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const t=this.Gv.canvasElement;t.style.position="absolute",t.style.zIndex="1",t.style.left="0",t.style.top="0",this.Jv=Nt(this.Im,sA({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const i=this.Jv.canvasElement;i.style.position="absolute",i.style.zIndex="2",i.style.left="0",i.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 Es(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),Kt(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Kt(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(e){if(this.Vm)return;this.Vm=!0;const A=this.Qd.$t();!A.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&A.Jc(e.localX)}pv(e){this.bv(e)}wv(){const e=this.Qd.$t();!e.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&e.hd())}av(e){const A=this.Qd.$t();!A.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&A.rd(e.localX)}hv(e){this.av(e)}cv(){this.Vm=!1;const e=this.Qd.$t();e.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||e.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(e,A,t){Dt(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.Om.m(e)),this.Rm!==null&&this.Rm.cp(sA({width:A,height:e.height})),this.Dm!==null&&this.Dm.cp(sA({width:t,height:e.height}))}Wm(){const e=this.jm();return Math.ceil(e.C+e.T+e.P+e.L+e.B+e.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(e,A,t){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,A,t)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const t=kt(this.Gv);t!==null&&(t.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i),this.$m(t,yp)})),this.wp(t),this.$m(t,Cp)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const A=kt(this.Jv);A!==null&&(A.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],A),this.$m(A,vp))}$m(e,A){const t=this.Qd.$t().wt();for(const i of t)Us(A,(n=>Fs(n,e,!1,void 0)),i,void 0);for(const i of t)Us(A,(n=>Hi(n,e,!1,void 0)),i,void 0)}mp({context:e,bitmapSize:A}){wi(e,0,0,A.width,A.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:A,verticalPixelRatio:t}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const i=Math.max(1,Math.floor(this.jm().C*t));e.fillRect(0,0,A.width,i)}}wp(e){const A=this.Qd.$t().St(),t=A.Ha();if(!t||t.length===0)return;const i=this.q_.maxTickMarkWeight(t),n=this.jm(),s=A.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:a})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const c=Math.max(1,Math.floor(l)),u=Math.floor(.5*l);o.beginPath();const m=Math.round(n.T*a);for(let y=t.length;y--;){const B=Math.round(t[y].coord*l);o.rect(B-u,0,c,m)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const l=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const a of t)if(a.weight<i){const c=a.needAlignCoordinate?this.Ym(o,a.coord,a.label):a.coord;o.fillText(a.label,c,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const a of t)if(a.weight>=i){const c=a.needAlignCoordinate?this.Ym(o,a.coord,a.label):a.coord;o.fillText(a.label,c,l)}}))}Ym(e,A,t){const i=this.Fv.xi(e,t),n=i/2,s=Math.floor(A-n)+.5;return s<0?A+=Math.abs(0-s):s+i>this.Ev.width&&(A-=Math.abs(this.Ev.width-(s+i))),A}Um(e,A){const t=this.jm();for(const i of e)for(const n of i.Qi())n.gt().X(A,t)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return er(this.j(),this.cn.fontFamily)}Zm(){return er(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 Fr,Hm:0});const e=this.k,A=this._p();if(e.R!==A){const t=this.j();e.P=t,e.R=A,e.L=3*t/12,e.B=3*t/12,e.ji=9*t/12,e.N=0,e.Hm=4*t/12,e.Wi.nr()}return this.k}kp(e){this.Kv.style.cursor=e===1?"ew-resize":"default"}zm(){const e=this.Qd.$t(),A=e.W();A.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),A.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const t={ud:this.Qd.$t().ud()},i=()=>A.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();A.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new Qa("left",A,t,i,n),this.Bm.appendChild(this.Rm.lp())),A.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Qa("right",A,t,i,n),this.Am.appendChild(this.Dm.lp()))}}const Tp=!!rr&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((r=>r.brand.includes("Chromium")))&&!!rr&&(!((Is=navigator?.userAgentData)===null||Is===void 0)&&Is.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var Is;class Qp{constructor(e,A,t){var i;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 uA,this.Op=new uA,this.Rc=new uA,this.ib=null,this.nb=null,this.Jd=e,this.cn=A,this.q_=t,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%",(i=this.Xd).style.userSelect="none",i.style.webkitUserSelect="none",i.style.msUserSelect="none",i.style.MozUserSelect="none",i.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),_s(this.cn)&&this.hb(!0),this.$i=new lp(this.Vc.bind(this),this.cn,t),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new bp(this,this.q_),this.sb.appendChild(this.ab.lp());const n=A.autoSize&&this.ob();let s=this.cn.width,o=this.cn.height;if(n||s===0||o===0){const l=e.getBoundingClientRect();s=s||l.width,o=o||l.height}this._b(s,o),this.ub(),e.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 e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],ue(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(e,A,t=!1){if(this.ho===A&&this.__===e)return;const i=(function(o){const l=Math.floor(o.width),a=Math.floor(o.height);return sA({width:l-l%2,height:a-a%2})})(sA({width:e,height:A}));this.ho=i.height,this.__=i.width;const n=this.ho+"px",s=this.__+"px";ue(this.Xd).style.height=n,ue(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,t?this.mb(CA.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=CA.es());for(let A=0;A<this.Xm.length;A++)this.Xm[A].vp(e.Hn(A).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const A=_s(this.cn);this.$i.$h(e);const t=_s(this.cn);t!==A&&this.hb(t),this.cb(),this.bb(e)}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 e=this.gb(null),A=document.createElement("canvas");A.width=e.width,A.height=e.height;const t=ue(A.getContext("2d"));return this.gb(t),A}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:ue(e==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(e){this.nb=e,this.nb?this.yb().style.setProperty("cursor",e):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return EA(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let A=0,t=0;const i=this.Xm[0],n=(o,l)=>{let a=0;for(let c=0;c<this.Xm.length;c++){const u=this.Xm[c],m=ue(o==="left"?u.wm():u.gm()),y=m.xp();e!==null&&m.Sp(e,l,a),a+=y.height}};this.xb()&&(n("left",0),A+=ue(i.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],a=l.xp();e!==null&&l.Sp(e,A,t),t+=a.height}A+=i.xp().width,this.Sb()&&(n("right",A),A+=ue(i.gm()).xp().width);const s=(o,l,a)=>{ue(o==="left"?this.ab.Lm():this.ab.Em()).Sp(ue(e),l,a)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,t),l=ue(i.wm()).xp().width),this.ab.Sp(e,l,t),l+=o.width,this.Sb()&&s("right",l,t)}t+=o.height}return sA({width:A,height:t})}Pb(){let e=0,A=0,t=0;for(const B of this.Xm)this.xb()&&(A=Math.max(A,ue(B.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(t=Math.max(t,ue(B.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=B.M_();A=Ts(A),t=Ts(t);const i=this.__,n=this.ho,s=Math.max(i-A-t,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var a;l=(a=l)+a%2;const c=0+l,u=n<c?0:n-c,m=u/e;let y=0;for(let B=0;B<this.Xm.length;++B){const p=this.Xm[B];p.qp(this.$i.qc()[B]);let Q=0,D=0;D=B===this.Xm.length-1?u-y:Math.round(p.M_()*m),Q=Math.max(D,2),y+=Q,p.cp(sA({width:s,height:Q})),this.xb()&&p._m(A,"left"),this.Sb()&&p._m(t,"right"),p.fp()&&this.$i.Kc(p.fp(),Q)}this.ab.Fm(sA({width:o?s:0,height:l}),o?A:0,o?t:0),this.$i.S_(s),this.Gm!==A&&(this.Gm=A),this.Jm!==t&&(this.Jm=t)}hb(e){e?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(e){switch(e.deltaMode){case e.DOM_DELTA_PAGE:return 120;case e.DOM_DELTA_LINE:return 32}return Tp?1/window.devicePixelRatio:1}rb(e){if(!(e.deltaX!==0&&this.cn.handleScroll.mouseWheel||e.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const A=this.Rb(e),t=A*e.deltaX/100,i=-A*e.deltaY/100;if(e.cancelable&&e.preventDefault(),i!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(i)*Math.min(1,Math.abs(i)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}t!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*t)}mb(e,A){var t;const i=e.jn();i===3&&this.Db(),i!==3&&i!==2||(this.Vb(e),this.Ob(e,A),this.ab.bt(),this.Xm.forEach((n=>{n.Xp()})),((t=this.Qm)===null||t===void 0?void 0:t.jn())===3&&(this.Qm.ts(e),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,A),e=this.Qm,this.Qm=null)),this.vp(e)}Ob(e,A){for(const t of e.Qn())this.ns(t,A)}Vb(e){const A=this.$i.qc();for(let t=0;t<A.length;t++)e.Hn(t).Wn&&A[t].N_()}ns(e,A){const t=this.$i.St();switch(e.qn){case 0:t.hc();break;case 1:t.lc(e.Vt);break;case 2:t.Gn(e.Vt);break;case 3:t.Jn(e.Vt);break;case 4:t.qu();break;case 5:e.Vt.Qu(A)||t.Jn(e.Vt.tc(A))}}Vc(e){this.Qm!==null?this.Qm.ts(e):this.Qm=e,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((A=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const t=this.Qm;this.Qm=null,this.mb(t,A);for(const i of t.Qn())if(i.qn===5&&!i.Vt.Qu(A)){this.$t().Zn(i.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),A=e.length,t=this.Xm.length;for(let i=A;i<t;i++){const n=EA(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let i=t;i<A;i++){const n=new Ls(this,e[i]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let i=0;i<A;i++){const n=e[i],s=this.Xm[i];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,A,t){var i;const n=new Map;e!==null&&this.$i.wt().forEach((c=>{const u=c.In().ll(e);u!==null&&n.set(c,u)}));let s;if(e!==null){const c=(i=this.$i.St().Ui(e))===null||i===void 0?void 0:i.originalTime;c!==void 0&&(s=c)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof ps?o.Hc:void 0,a=o!==null&&o.Iv!==void 0?o.Iv.gr:void 0;return{zb:s,ee:e??void 0,Lb:A??void 0,Eb:l,Nb:n,Fb:a,Wb:t??void 0}}Bb(e,A,t){this.Vp.m((()=>this.Ib(e,A,t)))}Ab(e,A,t){this.Op.m((()=>this.Ib(e,A,t)))}lb(e,A,t){this.Rc.m((()=>this.Ib(e,A,t)))}cb(){const e=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=e}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((e=>{const A=e.find((t=>t.target===this.Jd));A&&this._b(A.contentRect.width,A.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){this.ib!==null&&this.ib.disconnect(),this.ib=null}}function _s(r){return!!(r.handleScroll.mouseWheel||r.handleScale.mouseWheel)}function xp(r){return(function(e){return e.open!==void 0})(r)||(function(e){return e.value!==void 0})(r)}function xa(r,e){var A={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(A[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(t=Object.getOwnPropertySymbols(r);i<t.length;i++)e.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(r,t[i])&&(A[t[i]]=r[t[i]])}return A}function Fa(r,e,A,t){const i=A.value,n={ee:e,ot:r,Vt:[i,i,i,i],zb:t};return A.color!==void 0&&(n.V=A.color),n}function Fp(r,e,A,t){const i=A.value,n={ee:e,ot:r,Vt:[i,i,i,i],zb:t};return A.lineColor!==void 0&&(n.lt=A.lineColor),A.topColor!==void 0&&(n.Ps=A.topColor),A.bottomColor!==void 0&&(n.Rs=A.bottomColor),n}function Up(r,e,A,t){const i=A.value,n={ee:e,ot:r,Vt:[i,i,i,i],zb:t};return A.topLineColor!==void 0&&(n.Re=A.topLineColor),A.bottomLineColor!==void 0&&(n.De=A.bottomLineColor),A.topFillColor1!==void 0&&(n.ke=A.topFillColor1),A.topFillColor2!==void 0&&(n.ye=A.topFillColor2),A.bottomFillColor1!==void 0&&(n.Ce=A.bottomFillColor1),A.bottomFillColor2!==void 0&&(n.Te=A.bottomFillColor2),n}function Ep(r,e,A,t){const i={ee:e,ot:r,Vt:[A.open,A.high,A.low,A.close],zb:t};return A.color!==void 0&&(i.V=A.color),i}function Sp(r,e,A,t){const i={ee:e,ot:r,Vt:[A.open,A.high,A.low,A.close],zb:t};return A.color!==void 0&&(i.V=A.color),A.borderColor!==void 0&&(i.Ot=A.borderColor),A.wickColor!==void 0&&(i.Xh=A.wickColor),i}function Hp(r,e,A,t,i){const n=EA(i)(A),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],a=[l,s,o,l],c=A,{time:u,color:m}=c;return{ee:e,ot:r,Vt:a,zb:t,$e:xa(c,["time","color"]),V:m}}function _i(r){return r.Vt!==void 0}function Ua(r,e){return e.customValues!==void 0&&(r.jb=e.customValues),r}function Pt(r){return(e,A,t,i,n,s)=>(function(o,l){return l?l(o):(a=o).open===void 0&&a.value===void 0;var a})(t,s)?Ua({ot:e,ee:A,zb:i},t):Ua(r(e,A,t,i,n),t)}function Ea(r){return{Candlestick:Pt(Sp),Bar:Pt(Ep),Area:Pt(Fp),Baseline:Pt(Up),Histogram:Pt(Fa),Line:Pt(Fa),Custom:Pt(Hp)}[r]}function Sa(r){return{ee:0,Hb:new Map,la:r}}function Ha(r,e){if(r!==void 0&&r.length!==0)return{$b:e.key(r[0].ot),Ub:e.key(r[r.length-1].ot)}}function La(r){let e;return r.forEach((A=>{e===void 0&&(e=A.zb)})),EA(e)}class Lp{constructor(e){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=e}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(e,A){let t=this.qb.size!==0,i=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)t=!1,i=!0,this.qb.clear();else for(const l of this.Xb)l.pointData.Hb.delete(e)&&(i=!0);let s=[];if(A.length!==0){const l=A.map((y=>y.time)),a=this.q_.createConverterToInternalObj(A),c=Ea(e.Qh()),u=e.Ca(),m=e.Ta();s=A.map(((y,B)=>{const p=a(y.time),Q=this.q_.key(p);let D=this.qb.get(Q);D===void 0&&(D=Sa(p),this.qb.set(Q,D),i=!0);const F=c(p,D.ee,y,l[B],u,m);return D.Hb.set(e,F),F}))}t&&this.Gb(),this.Jb(e,s);let o=-1;if(i){const l=[];this.qb.forEach((a=>{l.push({timeWeight:0,time:a.la,pointData:a,originalTime:La(a.Hb)})})),l.sort(((a,c)=>this.q_.key(a.time)-this.q_.key(c.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,a,c){const u=Ha(l,c),m=Ha(a,c);if(u!==void 0&&m!==void 0)return{ta:u.Ub>=m.Ub&&u.$b>=m.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,A){const t=A;(function(p){p.zb===void 0&&(p.zb=p.time)})(t),this.q_.preprocessData(A);const i=this.q_.createConverterToInternalObj([A])(A.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(i)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${i}`);let s=this.qb.get(this.q_.key(i));const o=s===void 0;s===void 0&&(s=Sa(i),this.qb.set(this.q_.key(i),s));const l=Ea(e.Qh()),a=e.Ca(),c=e.Ta(),u=l(i,s.ee,A,t.zb,a,c);s.Hb.set(e,u),this.nw(e,u);const m={ta:_i(u)};if(!o)return this.tw(e,-1,m);const y={timeWeight:0,time:s.la,pointData:s,originalTime:La(s.Hb)},B=xr(this.Xb,this.q_.key(y.time),((p,Q)=>this.q_.key(p.time)<Q));this.Xb.splice(B,0,y);for(let p=B;p<this.Xb.length;++p)Ds(this.Xb[p].pointData,p);return this.q_.fillWeightsForPoints(this.Xb,B),this.tw(e,B,m)}nw(e,A){let t=this.Yb.get(e);t===void 0&&(t=[],this.Yb.set(e,t));const i=t.length!==0?t[t.length-1]:null;i===null||this.q_.key(A.ot)>this.q_.key(i.ot)?_i(A)&&t.push(A):_i(A)?t[t.length-1]=A:t.splice(-1,1),this.Zb.set(e,A.ot)}Jb(e,A){A.length!==0?(this.Yb.set(e,A.filter(_i)),this.Zb.set(e,A[A.length-1].ot)):(this.Yb.delete(e),this.Zb.delete(e))}Gb(){for(const e of this.Xb)e.pointData.Hb.size===0&&this.qb.delete(this.q_.key(e.time))}Qb(e){let A=-1;for(let t=0;t<this.Xb.length&&t<e.length;++t){const i=this.Xb[t],n=e[t];if(this.q_.key(i.time)!==this.q_.key(n.time)){A=t;break}n.timeWeight=i.timeWeight,Ds(n.pointData,t)}if(A===-1&&this.Xb.length!==e.length&&(A=Math.min(this.Xb.length,e.length)),A===-1)return-1;for(let t=A;t<e.length;++t)Ds(e[t].pointData,t);return this.q_.fillWeightsForPoints(e,A),this.Xb=e,A}sw(){if(this.Yb.size===0)return null;let e=0;return this.Yb.forEach((A=>{A.length!==0&&(e=Math.max(e,A[A.length-1].ee))})),e}tw(e,A,t){const i={ew:new Map,St:{Eu:this.sw()}};if(A!==-1)this.Yb.forEach(((n,s)=>{i.ew.set(s,{$e:n,rw:s===e?t:void 0})})),this.Yb.has(e)||i.ew.set(e,{$e:[],rw:t}),i.St.hw=this.Xb,i.St.lw=A;else{const n=this.Yb.get(e);i.ew.set(e,{$e:n||[],rw:t})}return i}}function Ds(r,e){r.ee=e,r.Hb.forEach((A=>{A.ee=e}))}function ks(r){const e={value:r.Vt[3],time:r.zb};return r.jb!==void 0&&(e.customValues=r.jb),e}function Ma(r){const e=ks(r);return r.V!==void 0&&(e.color=r.V),e}function Mp(r){const e=ks(r);return r.lt!==void 0&&(e.lineColor=r.lt),r.Ps!==void 0&&(e.topColor=r.Ps),r.Rs!==void 0&&(e.bottomColor=r.Rs),e}function Ip(r){const e=ks(r);return r.Re!==void 0&&(e.topLineColor=r.Re),r.De!==void 0&&(e.bottomLineColor=r.De),r.ke!==void 0&&(e.topFillColor1=r.ke),r.ye!==void 0&&(e.topFillColor2=r.ye),r.Ce!==void 0&&(e.bottomFillColor1=r.Ce),r.Te!==void 0&&(e.bottomFillColor2=r.Te),e}function Ia(r){const e={open:r.Vt[0],high:r.Vt[1],low:r.Vt[2],close:r.Vt[3],time:r.zb};return r.jb!==void 0&&(e.customValues=r.jb),e}function _p(r){const e=Ia(r);return r.V!==void 0&&(e.color=r.V),e}function Dp(r){const e=Ia(r),{V:A,Ot:t,Xh:i}=r;return A!==void 0&&(e.color=A),t!==void 0&&(e.borderColor=t),i!==void 0&&(e.wickColor=i),e}function Os(r){return{Area:Mp,Line:Ma,Baseline:Ip,Histogram:Ma,Bar:_p,Candlestick:Dp,Custom:kp}[r]}function kp(r){const e=r.zb;return Object.assign(Object.assign({},r.$e),{time:e})}const Op={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},Np={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},Kp={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:rs,attributionLogo:!0},Ns={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},Pp={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},Vp={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:rs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function _a(){return{width:0,height:0,autoSize:!1,layout:Kp,crosshair:Op,grid:Np,overlayPriceScales:Object.assign({},Ns),leftPriceScale:Object.assign(Object.assign({},Ns),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Ns),{visible:!0}),timeScale:Pp,watermark:Vp,localization:{locale:rr?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 zp{constructor(e,A){this.aw=e,this.ow=A}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return vi(this.ow)?this.aw.Mb(this.ow):0}Li(){return ue(this.aw.$t().Uc(this.ow)).Dt}}function Da(r,e,A){const t=xa(r,["time","originalTime"]),i=Object.assign({time:e},t);return A!==void 0&&(i.originalTime=A),i}const Gp={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class Wp{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class Rp{constructor(e,A,t,i,n){this.uw=new uA,this.Es=e,this.cw=A,this.dw=t,this.q_=n,this.fw=i}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const A=this.Es.Ct();return A===null?null:this.Es.Dt().Rt(e,A.Vt)}coordinateToPrice(e){const A=this.Es.Ct();return A===null?null:this.Es.Dt().pn(e,A.Vt)}barsInLogicalRange(e){if(e===null)return null;const A=new tr(new Mr(e.from,e.to)).lu(),t=this.Es.In();if(t.Ni())return null;const i=t.ll(A.Os(),1),n=t.ll(A.ui(),-1),s=ue(t.el()),o=ue(t.An());if(i!==null&&n!==null&&i.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:i===null||i.ee===s?e.from-s:i.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return i!==null&&n!==null&&(l.from=i.zb,l.to=n.zb),l}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,A){const t=this.Es.In().ll(e,A);return t===null?null:Os(this.seriesType())(t)}data(){const e=Os(this.seriesType());return this.Es.In().ne().map((A=>e(A)))}subscribeDataChanged(e){this.uw.l(e)}unsubscribeDataChanged(e){this.uw.v(e)}setMarkers(e){this.q_;const A=e.map((t=>Da(t,this.q_.convertHorzItemToInternal(t.time),t.time)));this.Es.na(A)}markers(){return this.Es.sa().map((e=>Da(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return pt(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const A=JA(pt(Gp),e),t=this.Es.ea(A);return new Wp(t)}removePriceLine(e){this.Es.ra(e._w())}seriesType(){return this.Es.Qh()}attachPrimitive(e){this.Es.ka(e),e.attached&&e.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(e){this.Es.ya(e),e.detached&&e.detached()}mw(e){this.uw.M()&&this.uw.m(e)}}class $p{constructor(e,A,t){this.ww=new uA,this.mu=new uA,this.Om=new uA,this.$i=e,this.yl=e.St(),this.ab=A,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_=t}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(e,A){A?this.yl.Ju(e,1e3):this.$i.Jn(e)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const e=this.yl.Vu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const A={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},t=this.yl.Iu(A);this.$i.pd(t)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){vt(e.from<=e.to,"The from index cannot be after the to index."),this.$i.pd(e)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(e){const A=this.$i.St();return A.Ni()?null:A.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const A=this.q_.convertHorzItemToInternal(e),t=this.yl.Va(A,!1);return t===null?null:this.yl.It(t)}coordinateToTime(e){const A=this.$i.St(),t=A.Nu(e),i=A.Ui(t);return i===null?null:i.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},pt(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(e){this.Om.m(e.width,e.height)}}function Xp(r){if(r===void 0||r.type==="custom")return;const e=r;e.minMove!==void 0&&e.precision===void 0&&(e.precision=(function(A){if(A>=1)return 0;let t=0;for(;t<8;t++){const i=Math.round(A);if(Math.abs(i-A)<1e-8)return t;A*=10}return t})(e.minMove))}function ka(r){return(function(e){if(Bi(e.handleScale)){const t=e.handleScale;e.handleScale={axisDoubleClickReset:{time:t,price:t},axisPressedMouseMove:{time:t,price:t},mouseWheel:t,pinch:t}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:t,axisDoubleClickReset:i}=e.handleScale;Bi(t)&&(e.handleScale.axisPressedMouseMove={time:t,price:t}),Bi(i)&&(e.handleScale.axisDoubleClickReset={time:i,price:i})}const A=e.handleScroll;Bi(A)&&(e.handleScroll={horzTouchDrag:A,vertTouchDrag:A,mouseWheel:A,pressedMouseMove:A})})(r),r}class Jp{constructor(e,A,t){this.Sw=new Map,this.kw=new Map,this.yw=new uA,this.Cw=new uA,this.Tw=new uA,this.Pw=new Lp(A);const i=t===void 0?pt(_a()):JA(pt(_a()),ka(t));this.q_=A,this.aw=new Qp(e,i,A),this.aw.lm().l((s=>{this.yw.M()&&this.yw.m(this.Rw(s()))}),this),this.aw.am().l((s=>{this.Cw.M()&&this.Cw.m(this.Rw(s()))}),this),this.aw.Xc().l((s=>{this.Tw.M()&&this.Tw.m(this.Rw(s()))}),this);const n=this.aw.$t();this.Dw=new $p(n,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(e,A,t){this.autoSizeActive()||this.aw._b(e,A,t)}addCustomSeries(e,A){const t=jt(e),i=Object.assign(Object.assign({},Bl),t.defaultOptions());return this.Vw("Custom",i,A,t)}addAreaSeries(e){return this.Vw("Area",Hd,e)}addBaselineSeries(e){return this.Vw("Baseline",Ld,e)}addBarSeries(e){return this.Vw("Bar",Ed,e)}addCandlestickSeries(e={}){return(function(A){A.borderColor!==void 0&&(A.borderUpColor=A.borderColor,A.borderDownColor=A.borderColor),A.wickColor!==void 0&&(A.wickUpColor=A.wickColor,A.wickDownColor=A.wickColor)})(e),this.Vw("Candlestick",Ud,e)}addHistogramSeries(e){return this.Vw("Histogram",Md,e)}addLineSeries(e){return this.Vw("Line",Sd,e)}removeSeries(e){const A=EA(this.Sw.get(e)),t=this.Pw.vd(A);this.aw.$t().vd(A),this.Ow(t),this.Sw.delete(e),this.kw.delete(A)}pw(e,A){this.Ow(this.Pw.Kb(e,A))}bw(e,A){this.Ow(this.Pw.iw(e,A))}subscribeClick(e){this.yw.l(e)}unsubscribeClick(e){this.yw.v(e)}subscribeCrosshairMove(e){this.Tw.l(e)}unsubscribeCrosshairMove(e){this.Tw.v(e)}subscribeDblClick(e){this.Cw.l(e)}unsubscribeDblClick(e){this.Cw.v(e)}priceScale(e){return new zp(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(ka(e))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const e=this.aw.Tb();return{height:e.height,width:e.width}}setCrosshairPosition(e,A,t){const i=this.Sw.get(t);if(i===void 0)return;const n=this.aw.$t().dr(i);n!==null&&this.aw.$t().ad(e,A,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,A,t={},i){Xp(t.priceFormat);const n=JA(pt(wl),pt(A),t),s=this.aw.$t().dd(e,n,i),o=new Rp(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const A=this.aw.$t();A._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((t,i)=>i.J(t.$e,t.rw))),A.Wu()}Bw(e){return EA(this.kw.get(e))}Rw(e){const A=new Map;e.Nb.forEach(((i,n)=>{const s=n.Qh(),o=Os(s)(i);if(s!=="Custom")vt(xp(o));else{const l=n.Ta();vt(!l||l(o)===!1)}A.set(this.Bw(n),o)}));const t=e.Eb!==void 0&&this.kw.has(e.Eb)?this.Bw(e.Eb):void 0;return{time:e.zb,logical:e.ee,point:e.Lb,hoveredSeries:t,hoveredObjectId:e.Fb,seriesData:A,sourceEvent:e.Wb}}}function Zp(r,e,A){let t;if(Tr(r)){const n=document.getElementById(r);vt(n!==null,`Cannot find element in DOM with id=${r}`),t=n}else t=r;const i=new Jp(t,e,A);return e.setOptions(i.options()),i}function qp(r,e){return Zp(r,new Ca,Ca.Id(e))}Object.assign(Object.assign({},wl),Bl);function Oa(r,e){return function(){return r.apply(e,arguments)}}const{toString:Yp}=Object.prototype,{getPrototypeOf:Ks}=Object,{iterator:Di,toStringTag:Na}=Symbol,ki=(r=>e=>{const A=Yp.call(e);return r[A]||(r[A]=A.slice(8,-1).toLowerCase())})(Object.create(null)),qA=r=>(r=r.toLowerCase(),e=>ki(e)===r),Oi=r=>e=>typeof e===r,{isArray:nr}=Array,sr=Oi("undefined");function Ir(r){return r!==null&&!sr(r)&&r.constructor!==null&&!sr(r.constructor)&&IA(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const Ka=qA("ArrayBuffer");function jp(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Ka(r.buffer),e}const e0=Oi("string"),IA=Oi("function"),Pa=Oi("number"),_r=r=>r!==null&&typeof r=="object",A0=r=>r===!0||r===!1,Ni=r=>{if(ki(r)!=="object")return!1;const e=Ks(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Na in r)&&!(Di in r)},t0=r=>{if(!_r(r)||Ir(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},r0=qA("Date"),i0=qA("File"),n0=qA("Blob"),s0=qA("FileList"),o0=r=>_r(r)&&IA(r.pipe),l0=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||IA(r.append)&&((e=ki(r))==="formdata"||e==="object"&&IA(r.toString)&&r.toString()==="[object FormData]"))},a0=qA("URLSearchParams"),[c0,h0,u0,d0]=["ReadableStream","Request","Response","Headers"].map(qA),f0=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Dr(r,e,{allOwnKeys:A=!1}={}){if(r===null||typeof r>"u")return;let t,i;if(typeof r!="object"&&(r=[r]),nr(r))for(t=0,i=r.length;t<i;t++)e.call(null,r[t],t,r);else{if(Ir(r))return;const n=A?Object.getOwnPropertyNames(r):Object.keys(r),s=n.length;let o;for(t=0;t<s;t++)o=n[t],e.call(null,r[o],o,r)}}function Va(r,e){if(Ir(r))return null;e=e.toLowerCase();const A=Object.keys(r);let t=A.length,i;for(;t-- >0;)if(i=A[t],e===i.toLowerCase())return i;return null}const Vt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,za=r=>!sr(r)&&r!==Vt;function Ps(){const{caseless:r,skipUndefined:e}=za(this)&&this||{},A={},t=(i,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=r&&Va(A,n)||n;Ni(A[s])&&Ni(i)?A[s]=Ps(A[s],i):Ni(i)?A[s]=Ps({},i):nr(i)?A[s]=i.slice():(!e||!sr(i))&&(A[s]=i)};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&Dr(arguments[i],t);return A}const p0=(r,e,A,{allOwnKeys:t}={})=>(Dr(e,(i,n)=>{A&&IA(i)?Object.defineProperty(r,n,{value:Oa(i,A),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,n,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:t}),r),g0=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),m0=(r,e,A,t)=>{r.prototype=Object.create(e.prototype,t),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),A&&Object.assign(r.prototype,A)},B0=(r,e,A,t)=>{let i,n,s;const o={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),n=i.length;n-- >0;)s=i[n],(!t||t(s,r,e))&&!o[s]&&(e[s]=r[s],o[s]=!0);r=A!==!1&&Ks(r)}while(r&&(!A||A(r,e))&&r!==Object.prototype);return e},w0=(r,e,A)=>{r=String(r),(A===void 0||A>r.length)&&(A=r.length),A-=e.length;const t=r.indexOf(e,A);return t!==-1&&t===A},C0=r=>{if(!r)return null;if(nr(r))return r;let e=r.length;if(!Pa(e))return null;const A=new Array(e);for(;e-- >0;)A[e]=r[e];return A},v0=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Ks(Uint8Array)),y0=(r,e)=>{const t=(r&&r[Di]).call(r);let i;for(;(i=t.next())&&!i.done;){const n=i.value;e.call(r,n[0],n[1])}},b0=(r,e)=>{let A;const t=[];for(;(A=r.exec(e))!==null;)t.push(A);return t},T0=qA("HTMLFormElement"),Q0=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(A,t,i){return t.toUpperCase()+i}),Ga=(({hasOwnProperty:r})=>(e,A)=>r.call(e,A))(Object.prototype),x0=qA("RegExp"),Wa=(r,e)=>{const A=Object.getOwnPropertyDescriptors(r),t={};Dr(A,(i,n)=>{let s;(s=e(i,n,r))!==!1&&(t[n]=s||i)}),Object.defineProperties(r,t)},F0=r=>{Wa(r,(e,A)=>{if(IA(r)&&["arguments","caller","callee"].indexOf(A)!==-1)return!1;const t=r[A];if(IA(t)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+A+"'")})}})},U0=(r,e)=>{const A={},t=i=>{i.forEach(n=>{A[n]=!0})};return nr(r)?t(r):t(String(r).split(e)),A},E0=()=>{},S0=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function H0(r){return!!(r&&IA(r.append)&&r[Na]==="FormData"&&r[Di])}const L0=r=>{const e=new Array(10),A=(t,i)=>{if(_r(t)){if(e.indexOf(t)>=0)return;if(Ir(t))return t;if(!("toJSON"in t)){e[i]=t;const n=nr(t)?[]:{};return Dr(t,(s,o)=>{const l=A(s,i+1);!sr(l)&&(n[o]=l)}),e[i]=void 0,n}}return t};return A(r,0)},M0=qA("AsyncFunction"),I0=r=>r&&(_r(r)||IA(r))&&IA(r.then)&&IA(r.catch),Ra=((r,e)=>r?setImmediate:e?((A,t)=>(Vt.addEventListener("message",({source:i,data:n})=>{i===Vt&&n===A&&t.length&&t.shift()()},!1),i=>{t.push(i),Vt.postMessage(A,"*")}))(`axios@${Math.random()}`,[]):A=>setTimeout(A))(typeof setImmediate=="function",IA(Vt.postMessage)),_0=typeof queueMicrotask<"u"?queueMicrotask.bind(Vt):typeof process<"u"&&process.nextTick||Ra,Y={isArray:nr,isArrayBuffer:Ka,isBuffer:Ir,isFormData:l0,isArrayBufferView:jp,isString:e0,isNumber:Pa,isBoolean:A0,isObject:_r,isPlainObject:Ni,isEmptyObject:t0,isReadableStream:c0,isRequest:h0,isResponse:u0,isHeaders:d0,isUndefined:sr,isDate:r0,isFile:i0,isBlob:n0,isRegExp:x0,isFunction:IA,isStream:o0,isURLSearchParams:a0,isTypedArray:v0,isFileList:s0,forEach:Dr,merge:Ps,extend:p0,trim:f0,stripBOM:g0,inherits:m0,toFlatObject:B0,kindOf:ki,kindOfTest:qA,endsWith:w0,toArray:C0,forEachEntry:y0,matchAll:b0,isHTMLForm:T0,hasOwnProperty:Ga,hasOwnProp:Ga,reduceDescriptors:Wa,freezeMethods:F0,toObjectSet:U0,toCamelCase:Q0,noop:E0,toFiniteNumber:S0,findKey:Va,global:Vt,isContextDefined:za,isSpecCompliantForm:H0,toJSONObject:L0,isAsyncFn:M0,isThenable:I0,setImmediate:Ra,asap:_0,isIterable:r=>r!=null&&IA(r[Di])};let Ne=class wd extends Error{static from(e,A,t,i,n,s){const o=new wd(e.message,A||e.code,t,i,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,A,t,i,n){super(e),this.name="AxiosError",this.isAxiosError=!0,A&&(this.code=A),t&&(this.config=t),i&&(this.request=i),n&&(this.response=n,this.status=n.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:Y.toJSONObject(this.config),code:this.code,status:this.status}}};Ne.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ne.ERR_BAD_OPTION="ERR_BAD_OPTION",Ne.ECONNABORTED="ECONNABORTED",Ne.ETIMEDOUT="ETIMEDOUT",Ne.ERR_NETWORK="ERR_NETWORK",Ne.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ne.ERR_DEPRECATED="ERR_DEPRECATED",Ne.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ne.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ne.ERR_CANCELED="ERR_CANCELED",Ne.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ne.ERR_INVALID_URL="ERR_INVALID_URL";const D0=null;function Vs(r){return Y.isPlainObject(r)||Y.isArray(r)}function $a(r){return Y.endsWith(r,"[]")?r.slice(0,-2):r}function Xa(r,e,A){return r?r.concat(e).map(function(i,n){return i=$a(i),!A&&n?"["+i+"]":i}).join(A?".":""):e}function k0(r){return Y.isArray(r)&&!r.some(Vs)}const O0=Y.toFlatObject(Y,{},null,function(e){return/^is[A-Z]/.test(e)});function Ki(r,e,A){if(!Y.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,A=Y.toFlatObject(A,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,Q){return!Y.isUndefined(Q[p])});const t=A.metaTokens,i=A.visitor||c,n=A.dots,s=A.indexes,l=(A.Blob||typeof Blob<"u"&&Blob)&&Y.isSpecCompliantForm(e);if(!Y.isFunction(i))throw new TypeError("visitor must be a function");function a(B){if(B===null)return"";if(Y.isDate(B))return B.toISOString();if(Y.isBoolean(B))return B.toString();if(!l&&Y.isBlob(B))throw new Ne("Blob is not supported. Use a Buffer instead.");return Y.isArrayBuffer(B)||Y.isTypedArray(B)?l&&typeof Blob=="function"?new Blob([B]):Buffer.from(B):B}function c(B,p,Q){let D=B;if(B&&!Q&&typeof B=="object"){if(Y.endsWith(p,"{}"))p=t?p:p.slice(0,-2),B=JSON.stringify(B);else if(Y.isArray(B)&&k0(B)||(Y.isFileList(B)||Y.endsWith(p,"[]"))&&(D=Y.toArray(B)))return p=$a(p),D.forEach(function(_,L){!(Y.isUndefined(_)||_===null)&&e.append(s===!0?Xa([p],L,n):s===null?p:p+"[]",a(_))}),!1}return Vs(B)?!0:(e.append(Xa(Q,p,n),a(B)),!1)}const u=[],m=Object.assign(O0,{defaultVisitor:c,convertValue:a,isVisitable:Vs});function y(B,p){if(!Y.isUndefined(B)){if(u.indexOf(B)!==-1)throw Error("Circular reference detected in "+p.join("."));u.push(B),Y.forEach(B,function(D,F){(!(Y.isUndefined(D)||D===null)&&i.call(e,D,Y.isString(F)?F.trim():F,p,m))===!0&&y(D,p?p.concat(F):[F])}),u.pop()}}if(!Y.isObject(r))throw new TypeError("data must be an object");return y(r),e}function Ja(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function zs(r,e){this._pairs=[],r&&Ki(r,this,e)}const Za=zs.prototype;Za.append=function(e,A){this._pairs.push([e,A])},Za.toString=function(e){const A=e?function(t){return e.call(this,t,Ja)}:Ja;return this._pairs.map(function(i){return A(i[0])+"="+A(i[1])},"").join("&")};function N0(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function qa(r,e,A){if(!e)return r;const t=A&&A.encode||N0,i=Y.isFunction(A)?{serialize:A}:A,n=i&&i.serialize;let s;if(n?s=n(e,i):s=Y.isURLSearchParams(e)?e.toString():new zs(e,i).toString(t),s){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class Ya{constructor(){this.handlers=[]}use(e,A,t){return this.handlers.push({fulfilled:e,rejected:A,synchronous:t?t.synchronous:!1,runWhen:t?t.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Y.forEach(this.handlers,function(t){t!==null&&e(t)})}}const Gs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},K0={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:zs,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ws=typeof window<"u"&&typeof document<"u",Rs=typeof navigator=="object"&&navigator||void 0,P0=Ws&&(!Rs||["ReactNative","NativeScript","NS"].indexOf(Rs.product)<0),V0=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",z0=Ws&&window.location.href||"http://localhost",bA={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ws,hasStandardBrowserEnv:P0,hasStandardBrowserWebWorkerEnv:V0,navigator:Rs,origin:z0},Symbol.toStringTag,{value:"Module"})),...K0};function G0(r,e){return Ki(r,new bA.classes.URLSearchParams,{visitor:function(A,t,i,n){return bA.isNode&&Y.isBuffer(A)?(this.append(t,A.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function W0(r){return Y.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function R0(r){const e={},A=Object.keys(r);let t;const i=A.length;let n;for(t=0;t<i;t++)n=A[t],e[n]=r[n];return e}function ja(r){function e(A,t,i,n){let s=A[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=A.length;return s=!s&&Y.isArray(i)?i.length:s,l?(Y.hasOwnProp(i,s)?i[s]=[i[s],t]:i[s]=t,!o):((!i[s]||!Y.isObject(i[s]))&&(i[s]=[]),e(A,t,i[s],n)&&Y.isArray(i[s])&&(i[s]=R0(i[s])),!o)}if(Y.isFormData(r)&&Y.isFunction(r.entries)){const A={};return Y.forEachEntry(r,(t,i)=>{e(W0(t),i,A,0)}),A}return null}function $0(r,e,A){if(Y.isString(r))try{return(e||JSON.parse)(r),Y.trim(r)}catch(t){if(t.name!=="SyntaxError")throw t}return(A||JSON.stringify)(r)}const kr={transitional:Gs,adapter:["xhr","http","fetch"],transformRequest:[function(e,A){const t=A.getContentType()||"",i=t.indexOf("application/json")>-1,n=Y.isObject(e);if(n&&Y.isHTMLForm(e)&&(e=new FormData(e)),Y.isFormData(e))return i?JSON.stringify(ja(e)):e;if(Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e)||Y.isReadableStream(e))return e;if(Y.isArrayBufferView(e))return e.buffer;if(Y.isURLSearchParams(e))return A.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(t.indexOf("application/x-www-form-urlencoded")>-1)return G0(e,this.formSerializer).toString();if((o=Y.isFileList(e))||t.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Ki(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||i?(A.setContentType("application/json",!1),$0(e)):e}],transformResponse:[function(e){const A=this.transitional||kr.transitional,t=A&&A.forcedJSONParsing,i=this.responseType==="json";if(Y.isResponse(e)||Y.isReadableStream(e))return e;if(e&&Y.isString(e)&&(t&&!this.responseType||i)){const s=!(A&&A.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Ne.from(o,Ne.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bA.classes.FormData,Blob:bA.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Y.forEach(["delete","get","head","post","put","patch"],r=>{kr.headers[r]={}});const X0=Y.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"]),J0=r=>{const e={};let A,t,i;return r&&r.split(`
2
- `).forEach(function(s){i=s.indexOf(":"),A=s.substring(0,i).trim().toLowerCase(),t=s.substring(i+1).trim(),!(!A||e[A]&&X0[A])&&(A==="set-cookie"?e[A]?e[A].push(t):e[A]=[t]:e[A]=e[A]?e[A]+", "+t:t)}),e},ec=Symbol("internals");function Or(r){return r&&String(r).trim().toLowerCase()}function Pi(r){return r===!1||r==null?r:Y.isArray(r)?r.map(Pi):String(r)}function Z0(r){const e=Object.create(null),A=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let t;for(;t=A.exec(r);)e[t[1]]=t[2];return e}const q0=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function $s(r,e,A,t,i){if(Y.isFunction(t))return t.call(this,e,A);if(i&&(e=A),!!Y.isString(e)){if(Y.isString(t))return e.indexOf(t)!==-1;if(Y.isRegExp(t))return t.test(e)}}function Y0(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,A,t)=>A.toUpperCase()+t)}function j0(r,e){const A=Y.toCamelCase(" "+e);["get","set","has"].forEach(t=>{Object.defineProperty(r,t+A,{value:function(i,n,s){return this[t].call(this,e,i,n,s)},configurable:!0})})}let _A=class{constructor(e){e&&this.set(e)}set(e,A,t){const i=this;function n(o,l,a){const c=Or(l);if(!c)throw new Error("header name must be a non-empty string");const u=Y.findKey(i,c);(!u||i[u]===void 0||a===!0||a===void 0&&i[u]!==!1)&&(i[u||l]=Pi(o))}const s=(o,l)=>Y.forEach(o,(a,c)=>n(a,c,l));if(Y.isPlainObject(e)||e instanceof this.constructor)s(e,A);else if(Y.isString(e)&&(e=e.trim())&&!q0(e))s(J0(e),A);else if(Y.isObject(e)&&Y.isIterable(e)){let o={},l,a;for(const c of e){if(!Y.isArray(c))throw TypeError("Object iterator must return a key-value pair");o[a=c[0]]=(l=o[a])?Y.isArray(l)?[...l,c[1]]:[l,c[1]]:c[1]}s(o,A)}else e!=null&&n(A,e,t);return this}get(e,A){if(e=Or(e),e){const t=Y.findKey(this,e);if(t){const i=this[t];if(!A)return i;if(A===!0)return Z0(i);if(Y.isFunction(A))return A.call(this,i,t);if(Y.isRegExp(A))return A.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,A){if(e=Or(e),e){const t=Y.findKey(this,e);return!!(t&&this[t]!==void 0&&(!A||$s(this,this[t],t,A)))}return!1}delete(e,A){const t=this;let i=!1;function n(s){if(s=Or(s),s){const o=Y.findKey(t,s);o&&(!A||$s(t,t[o],o,A))&&(delete t[o],i=!0)}}return Y.isArray(e)?e.forEach(n):n(e),i}clear(e){const A=Object.keys(this);let t=A.length,i=!1;for(;t--;){const n=A[t];(!e||$s(this,this[n],n,e,!0))&&(delete this[n],i=!0)}return i}normalize(e){const A=this,t={};return Y.forEach(this,(i,n)=>{const s=Y.findKey(t,n);if(s){A[s]=Pi(i),delete A[n];return}const o=e?Y0(n):String(n).trim();o!==n&&delete A[n],A[o]=Pi(i),t[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const A=Object.create(null);return Y.forEach(this,(t,i)=>{t!=null&&t!==!1&&(A[i]=e&&Y.isArray(t)?t.join(", "):t)}),A}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,A])=>e+": "+A).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...A){const t=new this(e);return A.forEach(i=>t.set(i)),t}static accessor(e){const t=(this[ec]=this[ec]={accessors:{}}).accessors,i=this.prototype;function n(s){const o=Or(s);t[o]||(j0(i,s),t[o]=!0)}return Y.isArray(e)?e.forEach(n):n(e),this}};_A.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Y.reduceDescriptors(_A.prototype,({value:r},e)=>{let A=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(t){this[A]=t}}}),Y.freezeMethods(_A);function Xs(r,e){const A=this||kr,t=e||A,i=_A.from(t.headers);let n=t.data;return Y.forEach(r,function(o){n=o.call(A,n,i.normalize(),e?e.status:void 0)}),i.normalize(),n}function Ac(r){return!!(r&&r.__CANCEL__)}let Nr=class extends Ne{constructor(e,A,t){super(e??"canceled",Ne.ERR_CANCELED,A,t),this.name="CanceledError",this.__CANCEL__=!0}};function tc(r,e,A){const t=A.config.validateStatus;!A.status||!t||t(A.status)?r(A):e(new Ne("Request failed with status code "+A.status,[Ne.ERR_BAD_REQUEST,Ne.ERR_BAD_RESPONSE][Math.floor(A.status/100)-4],A.config,A.request,A))}function e1(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function A1(r,e){r=r||10;const A=new Array(r),t=new Array(r);let i=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const a=Date.now(),c=t[n];s||(s=a),A[i]=l,t[i]=a;let u=n,m=0;for(;u!==i;)m+=A[u++],u=u%r;if(i=(i+1)%r,i===n&&(n=(n+1)%r),a-s<e)return;const y=c&&a-c;return y?Math.round(m*1e3/y):void 0}}function t1(r,e){let A=0,t=1e3/e,i,n;const s=(a,c=Date.now())=>{A=c,i=null,n&&(clearTimeout(n),n=null),r(...a)};return[(...a)=>{const c=Date.now(),u=c-A;u>=t?s(a,c):(i=a,n||(n=setTimeout(()=>{n=null,s(i)},t-u)))},()=>i&&s(i)]}const Vi=(r,e,A=3)=>{let t=0;const i=A1(50,250);return t1(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-t,a=i(l),c=s<=o;t=s;const u={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:a||void 0,estimated:a&&o&&c?(o-s)/a:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(u)},A)},rc=(r,e)=>{const A=r!=null;return[t=>e[0]({lengthComputable:A,total:r,loaded:t}),e[1]]},ic=r=>(...e)=>Y.asap(()=>r(...e)),r1=bA.hasStandardBrowserEnv?((r,e)=>A=>(A=new URL(A,bA.origin),r.protocol===A.protocol&&r.host===A.host&&(e||r.port===A.port)))(new URL(bA.origin),bA.navigator&&/(msie|trident)/i.test(bA.navigator.userAgent)):()=>!0,i1=bA.hasStandardBrowserEnv?{write(r,e,A,t,i,n,s){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(e)}`];Y.isNumber(A)&&o.push(`expires=${new Date(A).toUTCString()}`),Y.isString(t)&&o.push(`path=${t}`),Y.isString(i)&&o.push(`domain=${i}`),n===!0&&o.push("secure"),Y.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function n1(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function s1(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function nc(r,e,A){let t=!n1(e);return r&&(t||A==!1)?s1(r,e):e}const sc=r=>r instanceof _A?{...r}:r;function zt(r,e){e=e||{};const A={};function t(a,c,u,m){return Y.isPlainObject(a)&&Y.isPlainObject(c)?Y.merge.call({caseless:m},a,c):Y.isPlainObject(c)?Y.merge({},c):Y.isArray(c)?c.slice():c}function i(a,c,u,m){if(Y.isUndefined(c)){if(!Y.isUndefined(a))return t(void 0,a,u,m)}else return t(a,c,u,m)}function n(a,c){if(!Y.isUndefined(c))return t(void 0,c)}function s(a,c){if(Y.isUndefined(c)){if(!Y.isUndefined(a))return t(void 0,a)}else return t(void 0,c)}function o(a,c,u){if(u in e)return t(a,c);if(u in r)return t(void 0,a)}const l={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(a,c,u)=>i(sc(a),sc(c),u,!0)};return Y.forEach(Object.keys({...r,...e}),function(c){if(c==="__proto__"||c==="constructor"||c==="prototype")return;const u=Y.hasOwnProp(l,c)?l[c]:i,m=u(r[c],e[c],c);Y.isUndefined(m)&&u!==o||(A[c]=m)}),A}const oc=r=>{const e=zt({},r);let{data:A,withXSRFToken:t,xsrfHeaderName:i,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=_A.from(s),e.url=qa(nc(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),Y.isFormData(A)){if(bA.hasStandardBrowserEnv||bA.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Y.isFunction(A.getHeaders)){const l=A.getHeaders(),a=["content-type","content-length"];Object.entries(l).forEach(([c,u])=>{a.includes(c.toLowerCase())&&s.set(c,u)})}}if(bA.hasStandardBrowserEnv&&(t&&Y.isFunction(t)&&(t=t(e)),t||t!==!1&&r1(e.url))){const l=i&&n&&i1.read(n);l&&s.set(i,l)}return e},o1=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(A,t){const i=oc(r);let n=i.data;const s=_A.from(i.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:a}=i,c,u,m,y,B;function p(){y&&y(),B&&B(),i.cancelToken&&i.cancelToken.unsubscribe(c),i.signal&&i.signal.removeEventListener("abort",c)}let Q=new XMLHttpRequest;Q.open(i.method.toUpperCase(),i.url,!0),Q.timeout=i.timeout;function D(){if(!Q)return;const _=_A.from("getAllResponseHeaders"in Q&&Q.getAllResponseHeaders()),k={data:!o||o==="text"||o==="json"?Q.responseText:Q.response,status:Q.status,statusText:Q.statusText,headers:_,config:r,request:Q};tc(function(Z){A(Z),p()},function(Z){t(Z),p()},k),Q=null}"onloadend"in Q?Q.onloadend=D:Q.onreadystatechange=function(){!Q||Q.readyState!==4||Q.status===0&&!(Q.responseURL&&Q.responseURL.indexOf("file:")===0)||setTimeout(D)},Q.onabort=function(){Q&&(t(new Ne("Request aborted",Ne.ECONNABORTED,r,Q)),Q=null)},Q.onerror=function(L){const k=L&&L.message?L.message:"Network Error",V=new Ne(k,Ne.ERR_NETWORK,r,Q);V.event=L||null,t(V),Q=null},Q.ontimeout=function(){let L=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const k=i.transitional||Gs;i.timeoutErrorMessage&&(L=i.timeoutErrorMessage),t(new Ne(L,k.clarifyTimeoutError?Ne.ETIMEDOUT:Ne.ECONNABORTED,r,Q)),Q=null},n===void 0&&s.setContentType(null),"setRequestHeader"in Q&&Y.forEach(s.toJSON(),function(L,k){Q.setRequestHeader(k,L)}),Y.isUndefined(i.withCredentials)||(Q.withCredentials=!!i.withCredentials),o&&o!=="json"&&(Q.responseType=i.responseType),a&&([m,B]=Vi(a,!0),Q.addEventListener("progress",m)),l&&Q.upload&&([u,y]=Vi(l),Q.upload.addEventListener("progress",u),Q.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(c=_=>{Q&&(t(!_||_.type?new Nr(null,r,Q):_),Q.abort(),Q=null)},i.cancelToken&&i.cancelToken.subscribe(c),i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c)));const F=e1(i.url);if(F&&bA.protocols.indexOf(F)===-1){t(new Ne("Unsupported protocol "+F+":",Ne.ERR_BAD_REQUEST,r));return}Q.send(n||null)})},l1=(r,e)=>{const{length:A}=r=r?r.filter(Boolean):[];if(e||A){let t=new AbortController,i;const n=function(a){if(!i){i=!0,o();const c=a instanceof Error?a:this.reason;t.abort(c instanceof Ne?c:new Nr(c instanceof Error?c.message:c))}};let s=e&&setTimeout(()=>{s=null,n(new Ne(`timeout of ${e}ms exceeded`,Ne.ETIMEDOUT))},e);const o=()=>{r&&(s&&clearTimeout(s),s=null,r.forEach(a=>{a.unsubscribe?a.unsubscribe(n):a.removeEventListener("abort",n)}),r=null)};r.forEach(a=>a.addEventListener("abort",n));const{signal:l}=t;return l.unsubscribe=()=>Y.asap(o),l}},a1=function*(r,e){let A=r.byteLength;if(A<e){yield r;return}let t=0,i;for(;t<A;)i=t+e,yield r.slice(t,i),t=i},c1=async function*(r,e){for await(const A of h1(r))yield*a1(A,e)},h1=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:A,value:t}=await e.read();if(A)break;yield t}}finally{await e.cancel()}},lc=(r,e,A,t)=>{const i=c1(r,e);let n=0,s,o=l=>{s||(s=!0,t&&t(l))};return new ReadableStream({async pull(l){try{const{done:a,value:c}=await i.next();if(a){o(),l.close();return}let u=c.byteLength;if(A){let m=n+=u;A(m)}l.enqueue(new Uint8Array(c))}catch(a){throw o(a),a}},cancel(l){return o(l),i.return()}},{highWaterMark:2})},ac=64*1024,{isFunction:zi}=Y,u1=(({Request:r,Response:e})=>({Request:r,Response:e}))(Y.global),{ReadableStream:cc,TextEncoder:hc}=Y.global,uc=(r,...e)=>{try{return!!r(...e)}catch{return!1}},d1=r=>{r=Y.merge.call({skipUndefined:!0},u1,r);const{fetch:e,Request:A,Response:t}=r,i=e?zi(e):typeof fetch=="function",n=zi(A),s=zi(t);if(!i)return!1;const o=i&&zi(cc),l=i&&(typeof hc=="function"?(B=>p=>B.encode(p))(new hc):async B=>new Uint8Array(await new A(B).arrayBuffer())),a=n&&o&&uc(()=>{let B=!1;const p=new A(bA.origin,{body:new cc,method:"POST",get duplex(){return B=!0,"half"}}).headers.has("Content-Type");return B&&!p}),c=s&&o&&uc(()=>Y.isReadableStream(new t("").body)),u={stream:c&&(B=>B.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(B=>{!u[B]&&(u[B]=(p,Q)=>{let D=p&&p[B];if(D)return D.call(p);throw new Ne(`Response type '${B}' is not supported`,Ne.ERR_NOT_SUPPORT,Q)})});const m=async B=>{if(B==null)return 0;if(Y.isBlob(B))return B.size;if(Y.isSpecCompliantForm(B))return(await new A(bA.origin,{method:"POST",body:B}).arrayBuffer()).byteLength;if(Y.isArrayBufferView(B)||Y.isArrayBuffer(B))return B.byteLength;if(Y.isURLSearchParams(B)&&(B=B+""),Y.isString(B))return(await l(B)).byteLength},y=async(B,p)=>{const Q=Y.toFiniteNumber(B.getContentLength());return Q??m(p)};return async B=>{let{url:p,method:Q,data:D,signal:F,cancelToken:_,timeout:L,onDownloadProgress:k,onUploadProgress:V,responseType:Z,headers:$,withCredentials:z="same-origin",fetchOptions:R}=oc(B),X=e||fetch;Z=Z?(Z+"").toLowerCase():"text";let se=l1([F,_&&_.toAbortSignal()],L),ae=null;const ye=se&&se.unsubscribe&&(()=>{se.unsubscribe()});let Le;try{if(V&&a&&Q!=="get"&&Q!=="head"&&(Le=await y($,D))!==0){let Ce=new A(p,{method:"POST",body:D,duplex:"half"}),Fe;if(Y.isFormData(D)&&(Fe=Ce.headers.get("content-type"))&&$.setContentType(Fe),Ce.body){const[be,le]=rc(Le,Vi(ic(V)));D=lc(Ce.body,ac,be,le)}}Y.isString(z)||(z=z?"include":"omit");const Qe=n&&"credentials"in A.prototype,xe={...R,signal:se,method:Q.toUpperCase(),headers:$.normalize().toJSON(),body:D,duplex:"half",credentials:Qe?z:void 0};ae=n&&new A(p,xe);let Se=await(n?X(ae,R):X(p,xe));const pe=c&&(Z==="stream"||Z==="response");if(c&&(k||pe&&ye)){const Ce={};["status","statusText","headers"].forEach(qe=>{Ce[qe]=Se[qe]});const Fe=Y.toFiniteNumber(Se.headers.get("content-length")),[be,le]=k&&rc(Fe,Vi(ic(k),!0))||[];Se=new t(lc(Se.body,ac,be,()=>{le&&le(),ye&&ye()}),Ce)}Z=Z||"text";let Be=await u[Y.findKey(u,Z)||"text"](Se,B);return!pe&&ye&&ye(),await new Promise((Ce,Fe)=>{tc(Ce,Fe,{data:Be,headers:_A.from(Se.headers),status:Se.status,statusText:Se.statusText,config:B,request:ae})})}catch(Qe){throw ye&&ye(),Qe&&Qe.name==="TypeError"&&/Load failed|fetch/i.test(Qe.message)?Object.assign(new Ne("Network Error",Ne.ERR_NETWORK,B,ae,Qe&&Qe.response),{cause:Qe.cause||Qe}):Ne.from(Qe,Qe&&Qe.code,B,ae,Qe&&Qe.response)}}},f1=new Map,dc=r=>{let e=r&&r.env||{};const{fetch:A,Request:t,Response:i}=e,n=[t,i,A];let s=n.length,o=s,l,a,c=f1;for(;o--;)l=n[o],a=c.get(l),a===void 0&&c.set(l,a=o?new Map:d1(e)),c=a;return a};dc();const Js={http:D0,xhr:o1,fetch:{get:dc}};Y.forEach(Js,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const fc=r=>`- ${r}`,p1=r=>Y.isFunction(r)||r===null||r===!1;function g1(r,e){r=Y.isArray(r)?r:[r];const{length:A}=r;let t,i;const n={};for(let s=0;s<A;s++){t=r[s];let o;if(i=t,!p1(t)&&(i=Js[(o=String(t)).toLowerCase()],i===void 0))throw new Ne(`Unknown adapter '${o}'`);if(i&&(Y.isFunction(i)||(i=i.get(e))))break;n[o||"#"+s]=i}if(!i){const s=Object.entries(n).map(([l,a])=>`adapter ${l} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=A?s.length>1?`since :
4
- `+s.map(fc).join(`
5
- `):" "+fc(s[0]):"as no adapter specified";throw new Ne("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i}const pc={getAdapter:g1,adapters:Js};function Zs(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Nr(null,r)}function gc(r){return Zs(r),r.headers=_A.from(r.headers),r.data=Xs.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),pc.getAdapter(r.adapter||kr.adapter,r)(r).then(function(t){return Zs(r),t.data=Xs.call(r,r.transformResponse,t),t.headers=_A.from(t.headers),t},function(t){return Ac(t)||(Zs(r),t&&t.response&&(t.response.data=Xs.call(r,r.transformResponse,t.response),t.response.headers=_A.from(t.response.headers))),Promise.reject(t)})}const mc="1.13.5",Gi={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Gi[r]=function(t){return typeof t===r||"a"+(e<1?"n ":" ")+r}});const Bc={};Gi.transitional=function(e,A,t){function i(n,s){return"[Axios v"+mc+"] Transitional option '"+n+"'"+s+(t?". "+t:"")}return(n,s,o)=>{if(e===!1)throw new Ne(i(s," has been removed"+(A?" in "+A:"")),Ne.ERR_DEPRECATED);return A&&!Bc[s]&&(Bc[s]=!0,console.warn(i(s," has been deprecated since v"+A+" and will be removed in the near future"))),e?e(n,s,o):!0}},Gi.spelling=function(e){return(A,t)=>(console.warn(`${t} is likely a misspelling of ${e}`),!0)};function m1(r,e,A){if(typeof r!="object")throw new Ne("options must be an object",Ne.ERR_BAD_OPTION_VALUE);const t=Object.keys(r);let i=t.length;for(;i-- >0;){const n=t[i],s=e[n];if(s){const o=r[n],l=o===void 0||s(o,n,r);if(l!==!0)throw new Ne("option "+n+" must be "+l,Ne.ERR_BAD_OPTION_VALUE);continue}if(A!==!0)throw new Ne("Unknown option "+n,Ne.ERR_BAD_OPTION)}}const Wi={assertOptions:m1,validators:Gi},zA=Wi.validators;let Gt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ya,response:new Ya}}async request(e,A){try{return await this._request(e,A)}catch(t){if(t instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const n=i.stack?i.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+=`
6
- `+n):t.stack=n}catch{}}throw t}}_request(e,A){typeof e=="string"?(A=A||{},A.url=e):A=e||{},A=zt(this.defaults,A);const{transitional:t,paramsSerializer:i,headers:n}=A;t!==void 0&&Wi.assertOptions(t,{silentJSONParsing:zA.transitional(zA.boolean),forcedJSONParsing:zA.transitional(zA.boolean),clarifyTimeoutError:zA.transitional(zA.boolean),legacyInterceptorReqResOrdering:zA.transitional(zA.boolean)},!1),i!=null&&(Y.isFunction(i)?A.paramsSerializer={serialize:i}:Wi.assertOptions(i,{encode:zA.function,serialize:zA.function},!0)),A.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?A.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:A.allowAbsoluteUrls=!0),Wi.assertOptions(A,{baseUrl:zA.spelling("baseURL"),withXsrfToken:zA.spelling("withXSRFToken")},!0),A.method=(A.method||this.defaults.method||"get").toLowerCase();let s=n&&Y.merge(n.common,n[A.method]);n&&Y.forEach(["delete","get","head","post","put","patch","common"],B=>{delete n[B]}),A.headers=_A.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(A)===!1)return;l=l&&p.synchronous;const Q=A.transitional||Gs;Q&&Q.legacyInterceptorReqResOrdering?o.unshift(p.fulfilled,p.rejected):o.push(p.fulfilled,p.rejected)});const a=[];this.interceptors.response.forEach(function(p){a.push(p.fulfilled,p.rejected)});let c,u=0,m;if(!l){const B=[gc.bind(this),void 0];for(B.unshift(...o),B.push(...a),m=B.length,c=Promise.resolve(A);u<m;)c=c.then(B[u++],B[u++]);return c}m=o.length;let y=A;for(;u<m;){const B=o[u++],p=o[u++];try{y=B(y)}catch(Q){p.call(this,Q);break}}try{c=gc.call(this,y)}catch(B){return Promise.reject(B)}for(u=0,m=a.length;u<m;)c=c.then(a[u++],a[u++]);return c}getUri(e){e=zt(this.defaults,e);const A=nc(e.baseURL,e.url,e.allowAbsoluteUrls);return qa(A,e.params,e.paramsSerializer)}};Y.forEach(["delete","get","head","options"],function(e){Gt.prototype[e]=function(A,t){return this.request(zt(t||{},{method:e,url:A,data:(t||{}).data}))}}),Y.forEach(["post","put","patch"],function(e){function A(t){return function(n,s,o){return this.request(zt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Gt.prototype[e]=A(),Gt.prototype[e+"Form"]=A(!0)});let B1=class Cd{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let A;this.promise=new Promise(function(n){A=n});const t=this;this.promise.then(i=>{if(!t._listeners)return;let n=t._listeners.length;for(;n-- >0;)t._listeners[n](i);t._listeners=null}),this.promise.then=i=>{let n;const s=new Promise(o=>{t.subscribe(o),n=o}).then(i);return s.cancel=function(){t.unsubscribe(n)},s},e(function(n,s,o){t.reason||(t.reason=new Nr(n,s,o),A(t.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const A=this._listeners.indexOf(e);A!==-1&&this._listeners.splice(A,1)}toAbortSignal(){const e=new AbortController,A=t=>{e.abort(t)};return this.subscribe(A),e.signal.unsubscribe=()=>this.unsubscribe(A),e.signal}static source(){let e;return{token:new Cd(function(i){e=i}),cancel:e}}};function w1(r){return function(A){return r.apply(null,A)}}function C1(r){return Y.isObject(r)&&r.isAxiosError===!0}const qs={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(qs).forEach(([r,e])=>{qs[e]=r});function wc(r){const e=new Gt(r),A=Oa(Gt.prototype.request,e);return Y.extend(A,Gt.prototype,e,{allOwnKeys:!0}),Y.extend(A,e,null,{allOwnKeys:!0}),A.create=function(i){return wc(zt(r,i))},A}const oA=wc(kr);oA.Axios=Gt,oA.CanceledError=Nr,oA.CancelToken=B1,oA.isCancel=Ac,oA.VERSION=mc,oA.toFormData=Ki,oA.AxiosError=Ne,oA.Cancel=oA.CanceledError,oA.all=function(e){return Promise.all(e)},oA.spread=w1,oA.isAxiosError=C1,oA.mergeConfig=zt,oA.AxiosHeaders=_A,oA.formToJSON=r=>ja(Y.isHTMLForm(r)?new FormData(r):r),oA.getAdapter=pc.getAdapter,oA.HttpStatusCode=qs,oA.default=oA;const{Axios:iy,AxiosError:ny,CanceledError:sy,isCancel:oy,CancelToken:ly,VERSION:ay,all:cy,Cancel:hy,isAxiosError:uy,spread:dy,toFormData:fy,AxiosHeaders:py,HttpStatusCode:gy,formToJSON:my,getAdapter:By,mergeConfig:wy}=oA,it=Object.create(null);it.open="0",it.close="1",it.ping="2",it.pong="3",it.message="4",it.upgrade="5",it.noop="6";const Ri=Object.create(null);Object.keys(it).forEach(r=>{Ri[it[r]]=r});const Ys={type:"error",data:"parser error"},Cc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",vc=typeof ArrayBuffer=="function",yc=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,js=({type:r,data:e},A,t)=>Cc&&e instanceof Blob?A?t(e):bc(e,t):vc&&(e instanceof ArrayBuffer||yc(e))?A?t(e):bc(new Blob([e]),t):t(it[r]+(e||"")),bc=(r,e)=>{const A=new FileReader;return A.onload=function(){const t=A.result.split(",")[1];e("b"+(t||""))},A.readAsDataURL(r)};function Tc(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let eo;function v1(r,e){if(Cc&&r.data instanceof Blob)return r.data.arrayBuffer().then(Tc).then(e);if(vc&&(r.data instanceof ArrayBuffer||yc(r.data)))return e(Tc(r.data));js(r,!1,A=>{eo||(eo=new TextEncoder),e(eo.encode(A))})}const Qc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Qc.length;r++)Kr[Qc.charCodeAt(r)]=r;const y1=r=>{let e=r.length*.75,A=r.length,t,i=0,n,s,o,l;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const a=new ArrayBuffer(e),c=new Uint8Array(a);for(t=0;t<A;t+=4)n=Kr[r.charCodeAt(t)],s=Kr[r.charCodeAt(t+1)],o=Kr[r.charCodeAt(t+2)],l=Kr[r.charCodeAt(t+3)],c[i++]=n<<2|s>>4,c[i++]=(s&15)<<4|o>>2,c[i++]=(o&3)<<6|l&63;return a},b1=typeof ArrayBuffer=="function",Ao=(r,e)=>{if(typeof r!="string")return{type:"message",data:xc(r,e)};const A=r.charAt(0);return A==="b"?{type:"message",data:T1(r.substring(1),e)}:Ri[A]?r.length>1?{type:Ri[A],data:r.substring(1)}:{type:Ri[A]}:Ys},T1=(r,e)=>{if(b1){const A=y1(r);return xc(A,e)}else return{base64:!0,data:r}},xc=(r,e)=>e==="blob"?r instanceof Blob?r:new Blob([r]):r instanceof ArrayBuffer?r:r.buffer,Fc="",Q1=(r,e)=>{const A=r.length,t=new Array(A);let i=0;r.forEach((n,s)=>{js(n,!1,o=>{t[s]=o,++i===A&&e(t.join(Fc))})})},x1=(r,e)=>{const A=r.split(Fc),t=[];for(let i=0;i<A.length;i++){const n=Ao(A[i],e);if(t.push(n),n.type==="error")break}return t};function F1(){return new TransformStream({transform(r,e){v1(r,A=>{const t=A.length;let i;if(t<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,t);else if(t<65536){i=new Uint8Array(3);const n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,t)}else{i=new Uint8Array(9);const n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(t))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(A)})}})}let to;function $i(r){return r.reduce((e,A)=>e+A.length,0)}function Xi(r,e){if(r[0].length===e)return r.shift();const A=new Uint8Array(e);let t=0;for(let i=0;i<e;i++)A[i]=r[0][t++],t===r[0].length&&(r.shift(),t=0);return r.length&&t<r[0].length&&(r[0]=r[0].slice(t)),A}function U1(r,e){to||(to=new TextDecoder);const A=[];let t=0,i=-1,n=!1;return new TransformStream({transform(s,o){for(A.push(s);;){if(t===0){if($i(A)<1)break;const l=Xi(A,1);n=(l[0]&128)===128,i=l[0]&127,i<126?t=3:i===126?t=1:t=2}else if(t===1){if($i(A)<2)break;const l=Xi(A,2);i=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),t=3}else if(t===2){if($i(A)<8)break;const l=Xi(A,8),a=new DataView(l.buffer,l.byteOffset,l.length),c=a.getUint32(0);if(c>Math.pow(2,21)-1){o.enqueue(Ys);break}i=c*Math.pow(2,32)+a.getUint32(4),t=3}else{if($i(A)<i)break;const l=Xi(A,i);o.enqueue(Ao(n?l:to.decode(l),e)),t=0}if(i===0||i>r){o.enqueue(Ys);break}}}})}const Uc=4;function pA(r){if(r)return E1(r)}function E1(r){for(var e in pA.prototype)r[e]=pA.prototype[e];return r}pA.prototype.on=pA.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this},pA.prototype.once=function(r,e){function A(){this.off(r,A),e.apply(this,arguments)}return A.fn=e,this.on(r,A),this},pA.prototype.off=pA.prototype.removeListener=pA.prototype.removeAllListeners=pA.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var A=this._callbacks["$"+r];if(!A)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var t,i=0;i<A.length;i++)if(t=A[i],t===e||t.fn===e){A.splice(i,1);break}return A.length===0&&delete this._callbacks["$"+r],this},pA.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),A=this._callbacks["$"+r],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(A){A=A.slice(0);for(var t=0,i=A.length;t<i;++t)A[t].apply(this,e)}return this},pA.prototype.emitReserved=pA.prototype.emit,pA.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]},pA.prototype.hasListeners=function(r){return!!this.listeners(r).length};const Ji=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,A)=>A(e,0),GA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),S1="arraybuffer";function Cy(){}function Ec(r,...e){return e.reduce((A,t)=>(r.hasOwnProperty(t)&&(A[t]=r[t]),A),{})}const H1=GA.setTimeout,L1=GA.clearTimeout;function Zi(r,e){e.useNativeTimers?(r.setTimeoutFn=H1.bind(GA),r.clearTimeoutFn=L1.bind(GA)):(r.setTimeoutFn=GA.setTimeout.bind(GA),r.clearTimeoutFn=GA.clearTimeout.bind(GA))}const M1=1.33;function I1(r){return typeof r=="string"?_1(r):Math.ceil((r.byteLength||r.size)*M1)}function _1(r){let e=0,A=0;for(let t=0,i=r.length;t<i;t++)e=r.charCodeAt(t),e<128?A+=1:e<2048?A+=2:e<55296||e>=57344?A+=3:(t++,A+=4);return A}function Sc(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function D1(r){let e="";for(let A in r)r.hasOwnProperty(A)&&(e.length&&(e+="&"),e+=encodeURIComponent(A)+"="+encodeURIComponent(r[A]));return e}function k1(r){let e={},A=r.split("&");for(let t=0,i=A.length;t<i;t++){let n=A[t].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class O1 extends Error{constructor(e,A,t){super(e),this.description=A,this.context=t,this.type="TransportError"}}class ro extends pA{constructor(e){super(),this.writable=!1,Zi(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,A,t){return super.emitReserved("error",new O1(e,A,t)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const A=Ao(e,this.socket.binaryType);this.onPacket(A)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,A={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(A)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_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(e){const A=D1(e);return A.length?"?"+A:""}}class N1 extends ro{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const A=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||A()})),this.writable||(t++,this.once("drain",function(){--t||A()}))}else A()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const A=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)};x1(e,this.socket.binaryType).forEach(A),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Q1(e,A=>{this.doWrite(A,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",A=this.query||{};return this.opts.timestampRequests!==!1&&(A[this.opts.timestampParam]=Sc()),!this.supportsBinary&&!A.sid&&(A.b64=1),this.createUri(e,A)}}let Hc=!1;try{Hc=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const K1=Hc;function P1(){}class V1 extends N1{constructor(e){if(super(e),typeof location<"u"){const A=location.protocol==="https:";let t=location.port;t||(t=A?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||t!==e.port}}doWrite(e,A){const t=this.request({method:"POST",data:e});t.on("success",A),t.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(A,t)=>{this.onError("xhr poll error",A,t)}),this.pollXhr=e}}class nt extends pA{constructor(e,A,t){super(),this.createRequest=e,Zi(this,t),this._opts=t,this._method=t.method||"GET",this._uri=A,this._data=t.data!==void 0?t.data:null,this._create()}_create(){var e;const A=Ec(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");A.xdomain=!!this._opts.xd;const t=this._xhr=this.createRequest(A);try{t.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&t.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(t),"withCredentials"in t&&(t.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(t.timeout=this._opts.requestTimeout),t.onreadystatechange=()=>{var i;t.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.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(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=nt.requestsCount++,nt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=P1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete nt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(nt.requestsCount=0,nt.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Lc);else if(typeof addEventListener=="function"){const r="onpagehide"in GA?"pagehide":"unload";addEventListener(r,Lc,!1)}}function Lc(){for(let r in nt.requests)nt.requests.hasOwnProperty(r)&&nt.requests[r].abort()}const z1=(function(){const r=Mc({xdomain:!1});return r&&r.responseType!==null})();class G1 extends V1{constructor(e){super(e);const A=e&&e.forceBase64;this.supportsBinary=z1&&!A}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new nt(Mc,this.uri(),e)}}function Mc(r){const e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||K1))return new XMLHttpRequest}catch{}if(!e)try{return new GA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ic=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class W1 extends ro{get name(){return"websocket"}doOpen(){const e=this.uri(),A=this.opts.protocols,t=Ic?{}:Ec(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(e,A,t)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let A=0;A<e.length;A++){const t=e[A],i=A===e.length-1;js(t,this.supportsBinary,n=>{try{this.doWrite(t,n)}catch{}i&&Ji(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",A=this.query||{};return this.opts.timestampRequests&&(A[this.opts.timestampParam]=Sc()),this.supportsBinary||(A.b64=1),this.createUri(e,A)}}const io=GA.WebSocket||GA.MozWebSocket;class R1 extends W1{createSocket(e,A,t){return Ic?new io(e,A,t):A?new io(e,A):new io(e)}doWrite(e,A){this.ws.send(A)}}class $1 extends ro{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const A=U1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),t=e.readable.pipeThrough(A).getReader(),i=F1();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const n=()=>{t.read().then(({done:o,value:l})=>{o||(this.onPacket(l),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let A=0;A<e.length;A++){const t=e[A],i=A===e.length-1;this._writer.write(t).then(()=>{i&&Ji(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const X1={websocket:R1,webtransport:$1,polling:G1},J1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Z1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function no(r){if(r.length>8e3)throw"URI too long";const e=r,A=r.indexOf("["),t=r.indexOf("]");A!=-1&&t!=-1&&(r=r.substring(0,A)+r.substring(A,t).replace(/:/g,";")+r.substring(t,r.length));let i=J1.exec(r||""),n={},s=14;for(;s--;)n[Z1[s]]=i[s]||"";return A!=-1&&t!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=q1(n,n.path),n.queryKey=Y1(n,n.query),n}function q1(r,e){const A=/\/{2,9}/g,t=e.replace(A,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&t.splice(0,1),e.slice(-1)=="/"&&t.splice(t.length-1,1),t}function Y1(r,e){const A={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,i,n){i&&(A[i]=n)}),A}const so=typeof addEventListener=="function"&&typeof removeEventListener=="function",qi=[];so&&addEventListener("offline",()=>{qi.forEach(r=>r())},!1);class bt extends pA{constructor(e,A){if(super(),this.binaryType=S1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(A=e,e=null),e){const t=no(e);A.hostname=t.host,A.secure=t.protocol==="https"||t.protocol==="wss",A.port=t.port,t.query&&(A.query=t.query)}else A.host&&(A.hostname=no(A.host).host);Zi(this,A),this.secure=A.secure!=null?A.secure:typeof location<"u"&&location.protocol==="https:",A.hostname&&!A.port&&(A.port=this.secure?"443":"80"),this.hostname=A.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=A.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},A.transports.forEach(t=>{const i=t.prototype.name;this.transports.push(i),this._transportsByName[i]=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},A),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=k1(this.opts.query)),so&&(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"})},qi.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const A=Object.assign({},this.opts.query);A.EIO=Uc,A.transport=e,this.id&&(A.sid=this.id);const t=Object.assign({},this.opts,{query:A,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](t)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&bt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const A=this.createTransport(e);A.open(),this.setTransport(A)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",A=>this._onClose("transport close",A))}onOpen(){this.readyState="open",bt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const A=new Error("server error");A.code=e.data,this._onError(A);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let A=1;for(let t=0;t<this.writeBuffer.length;t++){const i=this.writeBuffer[t].data;if(i&&(A+=I1(i)),t>0&&A>this._maxPayload)return this.writeBuffer.slice(0,t);A+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Ji(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,A,t){return this._sendPacket("message",e,A,t),this}send(e,A,t){return this._sendPacket("message",e,A,t),this}_sendPacket(e,A,t,i){if(typeof A=="function"&&(i=A,A=void 0),typeof t=="function"&&(i=t,t=null),this.readyState==="closing"||this.readyState==="closed")return;t=t||{},t.compress=t.compress!==!1;const n={type:e,data:A,options:t};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},A=()=>{this.off("upgrade",A),this.off("upgradeError",A),e()},t=()=>{this.once("upgrade",A),this.once("upgradeError",A)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?t():e()}):this.upgrading?t():e()),this}_onError(e){if(bt.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,A){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(),so&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const t=qi.indexOf(this._offlineEventListener);t!==-1&&qi.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,A),this.writeBuffer=[],this._prevBufferLen=0}}}bt.protocol=Uc;class j1 extends bt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let A=this.createTransport(e),t=!1;bt.priorWebsocketSuccess=!1;const i=()=>{t||(A.send([{type:"ping",data:"probe"}]),A.once("packet",u=>{if(!t)if(u.type==="pong"&&u.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",A),!A)return;bt.priorWebsocketSuccess=A.name==="websocket",this.transport.pause(()=>{t||this.readyState!=="closed"&&(c(),this.setTransport(A),A.send([{type:"upgrade"}]),this.emitReserved("upgrade",A),A=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=A.name,this.emitReserved("upgradeError",m)}}))};function n(){t||(t=!0,c(),A.close(),A=null)}const s=u=>{const m=new Error("probe error: "+u);m.transport=A.name,n(),this.emitReserved("upgradeError",m)};function o(){s("transport closed")}function l(){s("socket closed")}function a(u){A&&u.name!==A.name&&n()}const c=()=>{A.removeListener("open",i),A.removeListener("error",s),A.removeListener("close",o),this.off("close",l),this.off("upgrading",a)};A.once("open",i),A.once("error",s),A.once("close",o),this.once("close",l),this.once("upgrading",a),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{t||A.open()},200):A.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const A=[];for(let t=0;t<e.length;t++)~this.transports.indexOf(e[t])&&A.push(e[t]);return A}}let eg=class extends j1{constructor(e,A={}){const t=typeof e=="object"?e:A;(!t.transports||t.transports&&typeof t.transports[0]=="string")&&(t.transports=(t.transports||["polling","websocket","webtransport"]).map(i=>X1[i]).filter(i=>!!i)),super(e,t)}};function Ag(r,e="",A){let t=r;A=A||typeof location<"u"&&location,r==null&&(r=A.protocol+"//"+A.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=A.protocol+r:r=A.host+r),/^(https?|wss?):\/\//.test(r)||(typeof A<"u"?r=A.protocol+"//"+r:r="https://"+r),t=no(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 n=t.host.indexOf(":")!==-1?"["+t.host+"]":t.host;return t.id=t.protocol+"://"+n+":"+t.port+e,t.href=t.protocol+"://"+n+(A&&A.port===t.port?"":":"+t.port),t}const tg=typeof ArrayBuffer=="function",rg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,_c=Object.prototype.toString,ig=typeof Blob=="function"||typeof Blob<"u"&&_c.call(Blob)==="[object BlobConstructor]",ng=typeof File=="function"||typeof File<"u"&&_c.call(File)==="[object FileConstructor]";function oo(r){return tg&&(r instanceof ArrayBuffer||rg(r))||ig&&r instanceof Blob||ng&&r instanceof File}function Yi(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let A=0,t=r.length;A<t;A++)if(Yi(r[A]))return!0;return!1}if(oo(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Yi(r.toJSON(),!0);for(const A in r)if(Object.prototype.hasOwnProperty.call(r,A)&&Yi(r[A]))return!0;return!1}function sg(r){const e=[],A=r.data,t=r;return t.data=lo(A,e),t.attachments=e.length,{packet:t,buffers:e}}function lo(r,e){if(!r)return r;if(oo(r)){const A={_placeholder:!0,num:e.length};return e.push(r),A}else if(Array.isArray(r)){const A=new Array(r.length);for(let t=0;t<r.length;t++)A[t]=lo(r[t],e);return A}else if(typeof r=="object"&&!(r instanceof Date)){const A={};for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&(A[t]=lo(r[t],e));return A}return r}function og(r,e){return r.data=ao(r.data,e),delete r.attachments,r}function ao(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let A=0;A<r.length;A++)r[A]=ao(r[A],e);else if(typeof r=="object")for(const A in r)Object.prototype.hasOwnProperty.call(r,A)&&(r[A]=ao(r[A],e));return r}const lg=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Xe;(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"})(Xe||(Xe={}));class ag{constructor(e){this.replacer=e}encode(e){return(e.type===Xe.EVENT||e.type===Xe.ACK)&&Yi(e)?this.encodeAsBinary({type:e.type===Xe.EVENT?Xe.BINARY_EVENT:Xe.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let A=""+e.type;return(e.type===Xe.BINARY_EVENT||e.type===Xe.BINARY_ACK)&&(A+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(A+=e.nsp+","),e.id!=null&&(A+=e.id),e.data!=null&&(A+=JSON.stringify(e.data,this.replacer)),A}encodeAsBinary(e){const A=sg(e),t=this.encodeAsString(A.packet),i=A.buffers;return i.unshift(t),i}}class co extends pA{constructor(e){super(),this.reviver=e}add(e){let A;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");A=this.decodeString(e);const t=A.type===Xe.BINARY_EVENT;t||A.type===Xe.BINARY_ACK?(A.type=t?Xe.EVENT:Xe.ACK,this.reconstructor=new cg(A),A.attachments===0&&super.emitReserved("decoded",A)):super.emitReserved("decoded",A)}else if(oo(e)||e.base64)if(this.reconstructor)A=this.reconstructor.takeBinaryData(e),A&&(this.reconstructor=null,super.emitReserved("decoded",A));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let A=0;const t={type:Number(e.charAt(0))};if(Xe[t.type]===void 0)throw new Error("unknown packet type "+t.type);if(t.type===Xe.BINARY_EVENT||t.type===Xe.BINARY_ACK){const n=A+1;for(;e.charAt(++A)!=="-"&&A!=e.length;);const s=e.substring(n,A);if(s!=Number(s)||e.charAt(A)!=="-")throw new Error("Illegal attachments");t.attachments=Number(s)}if(e.charAt(A+1)==="/"){const n=A+1;for(;++A&&!(e.charAt(A)===","||A===e.length););t.nsp=e.substring(n,A)}else t.nsp="/";const i=e.charAt(A+1);if(i!==""&&Number(i)==i){const n=A+1;for(;++A;){const s=e.charAt(A);if(s==null||Number(s)!=s){--A;break}if(A===e.length)break}t.id=Number(e.substring(n,A+1))}if(e.charAt(++A)){const n=this.tryParse(e.substr(A));if(co.isPayloadValid(t.type,n))t.data=n;else throw new Error("invalid payload")}return t}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,A){switch(e){case Xe.CONNECT:return Dc(A);case Xe.DISCONNECT:return A===void 0;case Xe.CONNECT_ERROR:return typeof A=="string"||Dc(A);case Xe.EVENT:case Xe.BINARY_EVENT:return Array.isArray(A)&&(typeof A[0]=="number"||typeof A[0]=="string"&&lg.indexOf(A[0])===-1);case Xe.ACK:case Xe.BINARY_ACK:return Array.isArray(A)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class cg{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const A=og(this.reconPack,this.buffers);return this.finishedReconstruction(),A}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Dc(r){return Object.prototype.toString.call(r)==="[object Object]"}const hg=Object.freeze(Object.defineProperty({__proto__:null,Decoder:co,Encoder:ag,get PacketType(){return Xe}},Symbol.toStringTag,{value:"Module"}));function YA(r,e,A){return r.on(e,A),function(){r.off(e,A)}}const ug=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class kc extends pA{constructor(e,A,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=e,this.nsp=A,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 e=this.io;this.subs=[YA(e,"open",this.onopen.bind(this)),YA(e,"packet",this.onpacket.bind(this)),YA(e,"error",this.onerror.bind(this)),YA(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...A){var t,i,n;if(ug.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(A.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(A),this;const s={type:Xe.EVENT,data:A};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof A[A.length-1]=="function"){const c=this.ids++,u=A.pop();this._registerAckCallback(c,u),s.id=c}const o=(i=(t=this.io.engine)===null||t===void 0?void 0:t.transport)===null||i===void 0?void 0:i.writable,l=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,A){var t;const i=(t=this.flags.timeout)!==null&&t!==void 0?t:this._opts.ackTimeout;if(i===void 0){this.acks[e]=A;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);A.call(this,new Error("operation has timed out"))},i),s=(...o)=>{this.io.clearTimeoutFn(n),A.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...A){return new Promise((t,i)=>{const n=(s,o)=>s?i(s):t(o);n.withError=!0,A.push(n),this.emit(e,...A)})}_addToQueue(e){let A;typeof e[e.length-1]=="function"&&(A=e.pop());const t={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>(this._queue[0],i!==null?t.tryCount>this._opts.retries&&(this._queue.shift(),A&&A(i)):(this._queue.shift(),A&&A(null,...n)),t.pending=!1,this._drainQueue())),this._queue.push(t),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const A=this._queue[0];A.pending&&!e||(A.pending=!0,A.tryCount++,this.flags=A.flags,this.emit.apply(this,A.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Xe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,A){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,A),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Xe.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Xe.EVENT:case Xe.BINARY_EVENT:this.onevent(e);break;case Xe.ACK:case Xe.BINARY_ACK:this.onack(e);break;case Xe.DISCONNECT:this.ondisconnect();break;case Xe.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t);break}}onevent(e){const A=e.data||[];e.id!=null&&A.push(this.ack(e.id)),this.connected?this.emitEvent(A):this.receiveBuffer.push(Object.freeze(A))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const A=this._anyListeners.slice();for(const t of A)t.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const A=this;let t=!1;return function(...i){t||(t=!0,A.packet({type:Xe.ACK,id:e,data:i}))}}onack(e){const A=this.acks[e.id];typeof A=="function"&&(delete this.acks[e.id],A.withError&&e.data.unshift(null),A.apply(this,e.data))}onconnect(e,A){this.id=e,this.recovered=A&&this._pid===A,this._pid=A,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Xe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const A=this._anyListeners;for(let t=0;t<A.length;t++)if(e===A[t])return A.splice(t,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const A=this._anyOutgoingListeners;for(let t=0;t<A.length;t++)if(e===A[t])return A.splice(t,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const A=this._anyOutgoingListeners.slice();for(const t of A)t.apply(this,e.data)}}}function or(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}or.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),A=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-A:r+A}return Math.min(r,this.max)|0},or.prototype.reset=function(){this.attempts=0},or.prototype.setMin=function(r){this.ms=r},or.prototype.setMax=function(r){this.max=r},or.prototype.setJitter=function(r){this.jitter=r};class ho extends pA{constructor(e,A){var t;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(A=e,e=void 0),A=A||{},A.path=A.path||"/socket.io",this.opts=A,Zi(this,A),this.reconnection(A.reconnection!==!1),this.reconnectionAttempts(A.reconnectionAttempts||1/0),this.reconnectionDelay(A.reconnectionDelay||1e3),this.reconnectionDelayMax(A.reconnectionDelayMax||5e3),this.randomizationFactor((t=A.randomizationFactor)!==null&&t!==void 0?t:.5),this.backoff=new or({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(A.timeout==null?2e4:A.timeout),this._readyState="closed",this.uri=e;const i=A.parser||hg;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=A.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var A;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(A=this.backoff)===null||A===void 0||A.setMin(e),this)}randomizationFactor(e){var A;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(A=this.backoff)===null||A===void 0||A.setJitter(e),this)}reconnectionDelayMax(e){var A;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(A=this.backoff)===null||A===void 0||A.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new eg(this.uri,this.opts);const A=this.engine,t=this;this._readyState="opening",this.skipReconnect=!1;const i=YA(A,"open",function(){t.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=YA(A,"error",n);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),A.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(YA(e,"ping",this.onping.bind(this)),YA(e,"data",this.ondata.bind(this)),YA(e,"error",this.onerror.bind(this)),YA(e,"close",this.onclose.bind(this)),YA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(A){this.onclose("parse error",A)}}ondecoded(e){Ji(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,A){let t=this.nsps[e];return t?this._autoConnect&&!t.active&&t.connect():(t=new kc(this,e,A),this.nsps[e]=t),t}_destroy(e){const A=Object.keys(this.nsps);for(const t of A)if(this.nsps[t].active)return;this._close()}_packet(e){const A=this.encoder.encode(e);for(let t=0;t<A.length;t++)this.engine.write(A[t],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,A){var t;this.cleanup(),(t=this.engine)===null||t===void 0||t.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,A),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const A=this.backoff.duration();this._reconnecting=!0;const t=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},A);this.opts.autoUnref&&t.unref(),this.subs.push(()=>{this.clearTimeoutFn(t)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Pr={};function ji(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};const A=Ag(r,e.path||"/socket.io"),t=A.source,i=A.id,n=A.path,s=Pr[i]&&n in Pr[i].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new ho(t,e):(Pr[i]||(Pr[i]=new ho(t,e)),l=Pr[i]),A.query&&!e.query&&(e.query=A.queryKey),l.socket(A.path,e)}Object.assign(ji,{Manager:ho,Socket:kc,io:ji,connect:ji});let DA="http://localhost:8000";function Oc(r){if(!r){console.warn("⚠️ [SOCKET DEBUG] setBaseUrl called with empty URL");return}if(r!==DA){const e=DA;DA=r,console.log(`🔄 [SOCKET DEBUG] SocketService: Changing baseUrl from ${e} to ${r}`),cA&&(console.log("🔄 [SOCKET DEBUG] Disconnecting old socket..."),cA.disconnect(),cA.removeAllListeners(),cA=null)}else console.log(`✅ [SOCKET DEBUG] BaseUrl already set to ${r}, no change needed`)}let cA=null;function dg(){const e=(()=>{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:DA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const A=ji(DA,{transports:["polling","websocket"],reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!1,auth:e?{token:e}:void 0});return A.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:A.id,baseUrl:DA,transport:A.io.engine.transport.name,namespace:A.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),A.on("disconnect",t=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:t,socketId:A.id})}),A.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:DA,namespace:A.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),A.on("reconnect_attempt",t=>{console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:t,baseUrl:DA})}),A.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:DA})}),A.on("reconnect",t=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:t,socketId:A.id})}),A}function uo(){const r=cA?.io?.uri||cA?.io?.opts?.host||null;return!cA||cA.io&&r&&r!==DA?(cA&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:r,newBaseUrl:DA,wasConnected:cA.connected,reason:"baseUrl changed"}),cA.disconnect(),cA.removeAllListeners(),cA=null),console.log("🔧 [SOCKET DEBUG] Creating new socket instance for MT5 backend:",DA),cA=dg()):cA.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:cA.id,connected:cA.connected,baseUrl:DA,uri:r}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:cA.id,baseUrl:DA}),cA}function fg(r,e){const A=uo();return A.on(r,e),()=>A.off(r,e)}function pg(r,e){cA&&cA.off(r,e)}function gg(r,e){uo().emit(r,e)}function mg(){return cA?cA.connected?"connected":"connecting":"disconnected"}const en={getSocket:uo,on:fg,off:pg,emit:gg,getStatus:mg,setBaseUrl:Oc},Bg={},Nc=J.createContext(),TA=()=>{const r=J.useContext(Nc);if(!r)throw new Error("useTrading must be used within TradingProvider");return r},wg=({children:r,baseUrl:e,endpoints:A,accountId:t})=>{const i=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ts&&ts.tagName.toUpperCase()==="SCRIPT"&&ts.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&Bg?.VITE_BASE_URL)??"http://localhost:8000",s={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account"},...A},o=A?.params||{},[l,a]=J.useState("BTCUSD"),[c,u]=J.useState("M1"),[m,y]=J.useState([]),[B,p]=J.useState(!0),[Q,D]=J.useState([]),[F,_]=J.useState(!1),[L,k]=J.useState(1e5),[V,Z]=J.useState(null),[$,z]=J.useState([]),[R,X]=J.useState(!0),[se,ae]=J.useState(!1),[ye,Le]=J.useState(!0),[Qe,xe]=J.useState("candles"),[Se,pe]=J.useState(!1),[Be,Ce]=J.useState("dark"),Fe=J.useRef(null);J.useEffect(()=>{en.setBaseUrl(i)},[i]);const be=J.useRef(new Map),le=J.useRef(null),qe=1e3,Ie=J.useCallback(async()=>{if(!t){console.log("⚠️ No accountId, skipping orders fetch");return}try{const Oe=localStorage.getItem("token");if(!Oe){console.log("⚠️ No token, skipping orders fetch");return}_(!0);const We=await oA.get(`${i}/trades/account/${t}`,{headers:{Authorization:`Bearer ${Oe}`}});let Pe=[];Array.isArray(We.data)?Pe=We.data:We.data?.data&&Array.isArray(We.data.data)&&(Pe=We.data.data);const tA=Pe.filter(ge=>ge.closePrice===null||ge.closePrice===void 0).map(ge=>({id:ge.id,ticket:ge.id?.substring(0,8),symbol:ge.symbol,type:ge.type,volume:ge.volume,price:ge.openPrice,stopLoss:ge.stopLoss,takeProfit:ge.takeProfit,comment:ge.comment||"",status:"OPEN",swap:0,profit:ge.profit||0,profitCurrency:"USD",time:new Date(ge.openedAt||ge.openAt||Date.now()).toLocaleTimeString(),openAt:ge.openedAt||ge.openAt,closeAt:ge.closedAt||ge.closeAt}));D(tA)}catch(Oe){console.error("❌ Error fetching orders:",Oe.response?.data||Oe.message),D([])}finally{_(!1)}},[i,t]),we=J.useCallback((Oe,We)=>!We||!Oe.price||isNaN(We)||isNaN(Oe.price)?Oe.profit||0:(Oe.type==="BUY"?We-Oe.price:Oe.price-We)*Oe.volume,[]),Ke=J.useCallback(async()=>{try{const Oe=localStorage.getItem("token");if(!Oe){console.log("⚠️ No token, skipping balance fetch");return}const We=await oA.get(`${i}${s.account}`,{headers:{Authorization:`Bearer ${Oe}`}});if(We.data&&We.data.data){const Pe=parseFloat(We.data.data.balance);isNaN(Pe)||k(Pe)}}catch(Oe){console.error("❌ Error fetching user balance:",Oe.response?.data||Oe.message)}},[i]),ce=J.useMemo(()=>{const Oe=L,We=Q.reduce((Ee,ne)=>Ee+ne.volume*ne.price*.01,0),Pe=Q.reduce((Ee,ne)=>{const de=m.find(ke=>ke.symbol===ne.symbol);if(de){const ke=ne.type==="BUY"?parseFloat(de.bid||0):parseFloat(de.ask||0);if(ke&&ke>0&&!isNaN(ke))return Ee+we(ne,ke)}return Ee+(ne.profit||0)},0),tA=Oe+Pe,ge=tA-We,oe=We>0?tA/We*100:0;return{balance:Oe,equity:tA,margin:We,freeMargin:ge,level:oe.toFixed(2)}},[Q,m,L,we]);J.useEffect(()=>{localStorage.getItem("token")&&t&&(Ie(),Ke())},[Ie,Ke,t]),J.useEffect(()=>{(async()=>{try{p(!0);const We=s.symbols.includes("?")?`${i}${s.symbols}`:`${i}${s.symbols}`,Pe=await oA.get(We);let tA=[];Array.isArray(Pe.data)?(console.log("1 console",Pe.data),tA=Pe.data):Pe.data&&Pe.data.data&&Array.isArray(Pe.data.data)?(console.log("2 console",Pe.data.data),tA=Pe.data.data):Pe.data&&Pe.data.prices&&Array.isArray(Pe.data.prices)?(console.log("3 console",Pe.data.price),tA=Pe.data.prices):Pe.data&&Array.isArray(Pe.data)&&(tA=Pe.data,console.log("else format",Pe.data));const ge=tA.map(oe=>oe.symbol&&(oe.bid!==void 0||oe.price!==void 0)?{symbol:oe.symbol,bid:oe.bid??oe.price??0,ask:oe.ask??oe.price??0,change:oe.change??0}:oe);ge.length>0?(y(ge),ge.find(Ee=>Ee.symbol===l)||a(ge[0].symbol)):y([])}catch(We){console.error("❌ Error fetching symbols:",We.response?.data||We.message),y([])}finally{p(!1)}})()},[i,s.symbols]);const De=J.useCallback(()=>{const Oe=be.current;if(Oe.size===0)return;const We=new Map(Oe);Oe.clear(),y(Pe=>Pe.map(tA=>{const ge=We.get(tA.symbol);return ge?{...tA,...ge}:tA})),D(Pe=>{let tA=!1;const ge=Pe.map(oe=>{const Ee=We.get(oe.symbol);if(!Ee)return oe;const ne=oe.type==="BUY"?parseFloat(Ee.bid||0):parseFloat(Ee.ask||0);if(!ne||isNaN(ne)||ne<=0)return oe;const de=we(oe,ne);return de===oe.profit?oe:(tA=!0,{...oe,profit:de})});return tA?ge:Pe})},[we]);J.useEffect(()=>{Fe.current||(Fe.current=en.getSocket());const Oe=Fe.current,We=()=>console.log("✅ TradingContext: Connected"),Pe=()=>console.log("⚠️ TradingContext: Disconnected"),tA=oe=>{oe?.symbol&&(be.current.set(oe.symbol,oe),le.current||(le.current=setTimeout(()=>{le.current=null,De()},qe)))},ge=async oe=>{if(console.log("🔔 Trade closed event received:",oe),!!oe){if(oe.newBalance!==void 0){const Ee=parseFloat(oe.newBalance);isNaN(Ee)||k(Ee)}if(window.notify){const Ee=oe.profitLoss||oe.profit||0,ne=Ee>=0?`+${Ee.toFixed(2)}`:Ee.toFixed(2),de=oe.symbol||"Trade",ke=oe.reason||"Closed";window.notify(`Trade Closed: ${ke} | ${de} | P/L: ${ne} USD`,Ee>=0?"success":"error")}oe.tradeId&&D(Ee=>Ee.filter(ne=>ne.id!==oe.tradeId)),await Ie(),await Ke()}};return Oe.on("connect",We),Oe.on("disconnect",Pe),Oe.on("priceUpdate",tA),Oe.on("tradeClosed",ge),()=>{Oe.off("connect",We),Oe.off("disconnect",Pe),Oe.off("priceUpdate",tA),Oe.off("tradeClosed",ge),le.current&&(clearTimeout(le.current),le.current=null),be.current.clear()}},[De,Ie,Ke]),J.useEffect(()=>{try{const Oe=document.documentElement;if(!Oe)return;Oe.dataset.theme=Be}catch{}},[Be]);const Ye=J.useMemo(()=>m.find(Oe=>Oe.symbol===l)||{bid:"0.00000",ask:"0.00000",change:0},[m,l]),je=J.useMemo(()=>({selectedSymbol:l,setSelectedSymbol:a,selectedTimeframe:c,setSelectedTimeframe:u,symbols:m,setSymbols:y,symbolsLoading:B,orders:Q,setOrders:D,ordersLoading:F,fetchOrders:Ie,fetchUserBalance:Ke,userBalance:L,setUserBalance:k,accountSummary:ce,currentSymbolData:Ye,activeTool:V,setActiveTool:Z,chartObjects:$,setChartObjects:z,showGrid:R,setShowGrid:X,snapToGrid:se,setSnapToGrid:ae,drawingsVisible:ye,setDrawingsVisible:Le,chartType:Qe,setChartType:xe,chartLocked:Se,setChartLocked:pe,theme:Be,setTheme:Ce,baseUrl:i,endpoints:s,endpointParams:o,accountId:t}),[l,c,m,B,Q,F,Ie,Ke,L,ce,Ye,V,$,R,se,ye,Qe,Se,Be,i,s,o]);return h.jsx(Nc.Provider,{value:je,children:r})};var Kc={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Pc=J.createContext&&J.createContext(Kc),Cg=["attr","size","title"];function vg(r,e){if(r==null)return{};var A=yg(r,e),t,i;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);for(i=0;i<n.length;i++)t=n[i],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(A[t]=r[t])}return A}function yg(r,e){if(r==null)return{};var A={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(e.indexOf(t)>=0)continue;A[t]=r[t]}return A}function An(){return An=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var A=arguments[e];for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(r[t]=A[t])}return r},An.apply(this,arguments)}function Vc(r,e){var A=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),A.push.apply(A,t)}return A}function tn(r){for(var e=1;e<arguments.length;e++){var A=arguments[e]!=null?arguments[e]:{};e%2?Vc(Object(A),!0).forEach(function(t){bg(r,t,A[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(A)):Vc(Object(A)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(A,t))})}return r}function bg(r,e,A){return e=Tg(e),e in r?Object.defineProperty(r,e,{value:A,enumerable:!0,configurable:!0,writable:!0}):r[e]=A,r}function Tg(r){var e=Qg(r,"string");return typeof e=="symbol"?e:e+""}function Qg(r,e){if(typeof r!="object"||!r)return r;var A=r[Symbol.toPrimitive];if(A!==void 0){var t=A.call(r,e);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function zc(r){return r&&r.map((e,A)=>J.createElement(e.tag,tn({key:A},e.attr),zc(e.child)))}function Vr(r){return e=>J.createElement(xg,An({attr:tn({},r.attr)},e),zc(r.child))}function xg(r){var e=A=>{var{attr:t,size:i,title:n}=r,s=vg(r,Cg),o=i||A.size||"1em",l;return A.className&&(l=A.className),r.className&&(l=(l?l+" ":"")+r.className),J.createElement("svg",An({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},A.attr,t,s,{className:l,style:tn(tn({color:r.color||A.color},A.style),r.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&J.createElement("title",null,n),r.children)};return Pc!==void 0?J.createElement(Pc.Consumer,null,A=>e(A)):e(Kc)}function Fg(r){return Vr({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(r)}function Ug(r){return Vr({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(r)}const Gc=({bidPrice:r,askPrice:e,onBuyClick:A,onSellClick:t})=>{const{theme:i}=TA(),n=i==="light",[s,o]=J.useState("0.01"),l=n?"bg-slate-100":"bg-[#12161d]",a=n?"text-slate-700":"text-white",c=n?"hover:bg-slate-200":"hover:bg-[#1e2635]",u=B=>{const p=parseFloat(s)||.01,Q=Math.max(.01,p+B);o(Q.toFixed(2))},m=()=>{A&&A({volume:parseFloat(s)})},y=()=>{t&&t({volume:parseFloat(s)})};return h.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[h.jsxs("button",{onClick:y,className:"flex items-stretch overflow-hidden",children:[h.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:r||"—"}),h.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),h.jsxs("div",{className:`flex items-stretch ${l}`,children:[h.jsx("button",{type:"button",onClick:()=>u(-.01),className:`w-5 flex items-center justify-center ${a} ${c} transition-colors`,children:h.jsx(Fg,{size:8})}),h.jsx("input",{type:"number",value:s,onChange:B=>{const p=B.target.value;(p===""||parseFloat(p)>=0)&&o(p)},onBlur:()=>{const B=parseFloat(s);o(isNaN(B)||B<.01?"0.01":B.toFixed(2))},className:`w-14 text-center focus:outline-none ${l} ${a}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),h.jsx("button",{type:"button",onClick:()=>u(.01),className:`w-5 flex items-center justify-center ${a} ${c} transition-colors`,children:h.jsx(Ug,{size:8})})]}),h.jsxs("button",{onClick:m,className:"flex items-stretch overflow-hidden",children:[h.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),h.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e||"—"})]})]})},Eg={},Wc=({isOpen:r,onClose:e,orderType:A,bidPrice:t,askPrice:i,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:a=!1,tradingEngine:c})=>{const{selectedSymbol:u,selectedTimeframe:m,setOrders:y,symbols:B,fetchOrders:p,theme:Q,baseUrl:D,endpoints:F}=TA(),_=Q==="light",L={getContractSpec:ne=>{const de=String(ne||"").toUpperCase();return de.includes("BTC")||de.includes("ETH")||de.includes("SOL")||de.includes("XRP")||de.includes("ADA")||de.includes("DOGE")||de.includes("BNB")||de.includes("AVAX")||de.includes("DOT")||de.includes("LINK")||de.endsWith("USDT")?{contractSize:1}:de.includes("XAU")||de.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:ne,volume:de})=>{const ke=L.getContractSpec(ne);return(parseFloat(de)||0)*(ke.contractSize||1)}},k=c||L,[V,Z]=J.useState("0.01"),[$,z]=J.useState(""),[R,X]=J.useState(""),[se,ae]=J.useState(""),[ye,Le]=J.useState(!1),[Qe,xe]=J.useState(null),[Se,pe]=J.useState(""),[Be,Ce]=J.useState(A||"BUY"),[Fe,be]=J.useState(parseFloat(t)||0),[le,qe]=J.useState(parseFloat(i)||0),[Ie,we]=J.useState("text-white"),[Ke,ce]=J.useState("text-white"),De=J.useRef(parseFloat(t)||0),Ye=J.useRef(parseFloat(i)||0);J.useEffect(()=>{if(!r)return;const ne=en.getSocket(),de=Me=>{if(!(!Me||!Me.symbol)&&Me.symbol.toUpperCase()===u?.toUpperCase()){const Je=parseFloat(Me.bid)||0,hA=parseFloat(Me.ask)||0;Je>0&&(Je>De.current?(we("text-green-400"),setTimeout(()=>we("text-white"),500)):Je<De.current&&De.current>0&&(we("text-red-400"),setTimeout(()=>we("text-white"),500)),be(Je),De.current=Je),hA>0&&(hA>Ye.current?(ce("text-green-400"),setTimeout(()=>ce("text-white"),500)):hA<Ye.current&&Ye.current>0&&(ce("text-red-400"),setTimeout(()=>ce("text-white"),500)),qe(hA),Ye.current=hA)}};ne.on("priceUpdate",de);const ke=B.find(Me=>Me.symbol===u);if(ke){const Me=parseFloat(ke.bid)||0,Je=parseFloat(ke.ask)||0;Me>0&&(be(Me),De.current=Me),Je>0&&(qe(Je),Ye.current=Je)}return()=>{ne.off("priceUpdate",de)}},[r,u,B]),J.useEffect(()=>{if(r){Z(o?String(o):"0.01"),z(""),X(""),ae(""),pe(""),Ce(A||"BUY");const ne=parseFloat(t)||0,de=parseFloat(i)||0;ne>0&&(be(ne),De.current=ne),de>0&&(qe(de),Ye.current=de)}},[r,A,t,i,o]);const je=Fe||0,Oe=le||0,We=ne=>{const de=parseFloat(V)||.01,ke=Math.max(.01,de+ne);Z(ke.toFixed(2))},Pe=ne=>{const de=parseFloat($)||0,ke=parseFloat(Be==="BUY"?le:Fe)||0;if(!ke){pe("Current price not available. Please wait...");return}let Me=de+ne;Be==="BUY"?Me=Math.max(1e-5,Math.min(Me,ke-1e-5)):Me=Math.max(ke+1e-5,Me),z(Me>0?Me.toFixed(5):""),pe("")},tA=ne=>{const de=parseFloat(R)||0,ke=parseFloat(Be==="BUY"?le:Fe)||0;if(!ke){pe("Current price not available. Please wait...");return}let Me=de+ne;Be==="BUY"?Me=Math.max(ke+1e-5,Me):Me=Math.max(1e-5,Math.min(Me,ke-1e-5)),X(Me>0?Me.toFixed(5):""),pe("")},ge=async ne=>{pe("");const de=ne||Be,ke=parseFloat(de==="BUY"?le:Fe),Me=parseFloat(V),Je=$?parseFloat($):null,hA=R?parseFloat(R):null;if(!Me||Me<=0||isNaN(Me)){pe("Please enter a valid volume (minimum 0.01)");return}if(Me<.01){pe("Volume must be at least 0.01");return}if(!ke||ke<=0||isNaN(ke)){pe("Invalid price. Please refresh and try again.");return}if(Je!==null&&Je!==""){if(isNaN(Je)||Je<=0){pe("Stop Loss must be a valid positive number");return}if(de==="BUY"&&Je>=ke){pe("Stop Loss must be below the current price for BUY orders");return}if(de==="SELL"&&Je<=ke){pe("Stop Loss must be above the current price for SELL orders");return}}if(hA!==null&&hA!==""){if(isNaN(hA)||hA<=0){pe("Take Profit must be a valid positive number");return}if(de==="BUY"){if(hA<=ke){pe(`Take Profit must be above the entry price (${ke.toFixed(5)}) for BUY orders`);return}}else if(de==="SELL"&&hA>=ke){pe(`Take Profit must be below the entry price (${ke.toFixed(5)}) for SELL orders`);return}}Ce(de),xe(de),Le(!0);const pi=new Date,vr=pi.toLocaleTimeString(),It=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,jn=localStorage.getItem("token");if(!jn){pe("Please login to place trades"),Le(!1),xe(null);return}const gl={accountId:s,symbol:u,type:de,volume:Me,price:ke,takeProfit:hA,stopLoss:Je,comment:se.trim()||null},es={ticket:It.substring(0,8),symbol:u,type:de,volume:parseFloat(Me),price:parseFloat(ke),time:vr,stopLoss:Je?parseFloat(Je):null,takeProfit:hA?parseFloat(hA):null,swap:0,profit:0,profitCurrency:"USD",comment:se.trim()||"",id:It,status:"OPEN",openAt:pi.toISOString()};if(!l&&y&&y(_t=>[..._t,es]),a&&!n){pe("Execution handler is required in forceParentExecution mode"),Le(!1),xe(null);return}if(n){Le(!1),xe(null),e();const _t={symbol:u,type:de,lotSize:Me,entryPrice:ke,stopLoss:Je,takeProfit:hA,comment:se.trim()||null};Promise.resolve(n(_t)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),p&&p()}).catch(gi=>{console.error("❌ Trade execution failed:",gi),!l&&y&&y(KA=>KA.filter(v=>v.id!==It))})}else{if(a){pe("Fallback API path disabled in forceParentExecution mode"),Le(!1),xe(null);return}Le(!1),xe(null),e();const _t=D||Eg?.VITE_BASE_URL||"http://localhost:8000",gi=F?.trades||"/api/trades";oA.post(`${_t}${gi}`,gl,{headers:{Authorization:`Bearer ${jn}`,"Content-Type":"application/json"}}).then(KA=>{if(KA.data&&KA.data.data){const v=KA.data.data.trade;!l&&y&&y(C=>C.map(P=>P.id===It?{...P,id:v.id,ticket:v.id.substring(0,8),time:vr,openAt:v.openAt}:P)),console.log("✅ Trade saved successfully:",v),window.notify&&window.notify(`Trade placed successfully: ${v.symbol} ${v.type}`,"success")}else{!l&&y&&y(C=>C.filter(P=>P.id!==It));const v=KA.data?.message||"Failed to place trade";window.notify&&window.notify(v,"error")}}).catch(KA=>{console.error("Error placing trade:",KA),!l&&y&&y(C=>C.filter(P=>P.id!==It));let v="Failed to place trade";if(KA.response){const C=KA.response.status,P=KA.response.data;C===400?v=P?.message||"Invalid trade data. Please check your inputs.":C===401?v="Authentication failed. Please login again.":C===404?v=P?.message||"Symbol not found. Please select a valid symbol.":C===500?v="Server error. Please try again later.":v=P?.message||`Error: ${C}`}else KA.request&&(v="Network error. Please check your internet connection.");window.notify&&window.notify(v,"error")})}},Ee=(k?.calculateVolumeUnits?.({symbol:u,volume:parseFloat(V)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return console.log("Logs for SDK",Ee),r?h.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${_?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[h.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${_?"border-slate-300 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 ${_?"text-slate-800":"text-white"}`,children:"Market Execution"}),h.jsx("button",{className:`p-0.5 transition-colors ${_?"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:e,className:`p-1 rounded transition-colors ${_?"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 flex-1",children:[Se&&h.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:Se}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("label",{className:`text-sm font-medium ${_?"text-slate-700":"text-white"}`,children:"Volume"}),h.jsxs("span",{className:`text-sm ${_?"text-slate-700":"text-white"}`,children:[Ee," ",u]})]}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>We(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${_?"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:V,onChange:ne=>{Z(ne.target.value),pe("")},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${_?"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:()=>We(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${_?"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 ${_?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>Pe(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${_?"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:$,onChange:ne=>{const de=ne.target.value;(de===""||/^\d*\.?\d*$/.test(de))&&(z(de),pe(""))},onBlur:ne=>{const de=parseFloat(ne.target.value);!isNaN(de)&&de>0?z(de.toFixed(5)):ne.target.value===""&&z("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${_?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),h.jsx("button",{type:"button",onClick:()=>Pe(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${_?"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 ${_?"text-slate-700":"text-white"}`,children:"Take Profit"})}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>tA(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${_?"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:R,onChange:ne=>{const de=ne.target.value;(de===""||/^\d*\.?\d*$/.test(de))&&(X(de),pe(""))},onBlur:ne=>{const de=parseFloat(ne.target.value);!isNaN(de)&&de>0?X(de.toFixed(5)):ne.target.value===""&&X("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${_?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),h.jsx("button",{type:"button",onClick:()=>tA(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${_?"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 ${_?"text-slate-700":"text-white"}`,children:"Comment"}),h.jsx("textarea",{value:se,onChange:ne=>ae(ne.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 ${_?"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 ${_?"border-slate-400":"border-slate-700"}`,children:[h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:_?"text-slate-700":"text-white",children:"Bid: "}),h.jsx("span",{className:`${Ie} font-medium transition-colors duration-400`,children:je>0?je.toFixed(5):"---"})]}),h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:_?"text-slate-700":"text-white",children:"Ask: "}),h.jsx("span",{className:`${Ke} font-medium transition-colors duration-400`,children:Oe>0?Oe.toFixed(5):"---"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[h.jsx("button",{onClick:()=>ge("SELL"),disabled:ye,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:ye&&Qe==="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:()=>ge("BUY"),disabled:ye,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:ye&&Qe==="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 Ae(r){if(r==null)return null;if(typeof r=="number"){if(Number.isNaN(r)||!Number.isFinite(r))return null;let e;r>1e10?e=r/1e3:(r<1e9,e=r);const A=Math.floor(e);return A<946684800||A>4102444800?null:A}if(typeof r=="string"){const e=Date.parse(r);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof r=="object"&&"year"in r&&"month"in r&&"day"in r){const A=new Date(Date.UTC(r.year,r.month-1,r.day)).getTime();return Number.isNaN(A)?null:Math.floor(A/1e3)}return null}function Sg(r,e){if(!r||r.length<2)return[];const A=[],t=2;for(let i=1;i<r.length;i++){const n=r[i-1].time,s=r[i].time,o=s-n;o>e*t&&A.push({from:n,to:s,gapSeconds:o,gapHours:(o/3600).toFixed(1),fromDate:new Date(n*1e3).toISOString(),toDate:new Date(s*1e3).toISOString()})}return A}function Hg(r,e="America/New_York"){const A=new Date(r*1e3),t=new Date(A.toLocaleString("en-US",{timeZone:e})),i=t.getDay();return!(i===0||i===6||i===5&&t.getHours()>=17)}function Rc(r){return Array.isArray(r)?r.map(e=>({...e,time:Ae(e.time)})).filter(e=>e.time!=null):[]}function Lg(r){if(!r||r.length<2)return!0;for(let e=1;e<r.length;e++)if(r[e].time<=r[e-1].time)return!1;return!0}function lr(r,e){return!Number.isFinite(r)||!Number.isFinite(e)||e<=0?r:Math.floor(r/e)*e}const QA="17:00-17:00",xA="America/New_York",st="24x7",ot="UTC",$c={EURUSD:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"},BTCUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},ETHUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},BNBUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},SOLUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},ADAUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},XRPUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},DOGEUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},DOTUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},MATICUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"},LINKUSDT:{type:"crypto",session:st,sessionTZ:ot,priceMode:"last"}},Xc={type:"forex",sessionTZ:xA,session:QA,priceMode:"mid"};function zr(r){return r&&$c[r.toUpperCase()]||Xc}function Mg(r){return zr(r).type==="forex"}function Ig(r){return zr(r).type==="crypto"}function _g(r){return zr(r).session==="24x7"}function Jc(r){if(!r||typeof r!="object")return!1;const{time:e,open:A,high:t,low:i,close:n,volume:s}=r;return!(Ae(e)==null||typeof A!="number"||!Number.isFinite(A)||typeof t!="number"||!Number.isFinite(t)||typeof i!="number"||!Number.isFinite(i)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||t<A||t<n||t<i||i>A||i>n||i>t||A<=0||t<=0||i<=0||n<=0)}function Zc(r){const e=s=>Math.round(s*1e5)/1e5;let A=e(r.open),t=e(r.high),i=e(r.low),n=e(r.close);return t=Math.max(t,A,n,i),i=Math.min(i,A,n,t),{...r,open:A,high:t,low:i,close:n,volume:r.volume!=null?Math.round(r.volume):r.volume}}function qc(r){if(!Array.isArray(r)||r.length===0)return[];const e=new Map;return r.forEach(A=>{const t=Ae(A.time);if(t!=null)if(e.has(t)){const i=e.get(t);e.set(t,{...A,time:t,open:A.open,high:Math.max(i.high,A.high),low:Math.min(i.low,A.low),close:A.close,volume:(i.volume||0)+(A.volume||0)})}else e.set(t,{...A,time:t})}),Array.from(e.values())}function Dg(r,e="percentile"){if(!Array.isArray(r)||r.length<3)return r;const A=r.map(s=>s.close).filter(s=>Number.isFinite(s));if(A.length<3)return r;const t=[...A].sort((s,o)=>s-o);let i,n;if(e==="percentile"){const s=Math.floor(t.length*.25),o=Math.floor(t.length*.75),l=t[s],a=t[o],c=a-l;i=l-1.5*c,n=a+1.5*c}else{const s=A.reduce((a,c)=>a+c,0)/A.length,o=A.reduce((a,c)=>a+Math.pow(c-s,2),0)/A.length,l=Math.sqrt(o);if(l===0)return r;i=s-3*l,n=s+3*l}return r.map((s,o)=>{const l=s.close;if(l<i||l>n){if(o===0)return s;const a=r[o-1].close;return{...s,open:a,high:Math.max(a,s.high),low:Math.min(a,s.low),close:a}}return s})}function kg(r,e){if(!Array.isArray(r)||r.length===0)return r;const A=[],t=Math.max(e*10080,604800),i=1e4;for(let o=0;o<r.length;o++)if(A.push(r[o]),o<r.length-1){const l=r[o].time,a=r[o+1].time,c=a-l;if(c>t&&((c/3600).toFixed(1),(t/3600).toFixed(1)),c>e&&c<=t){const u=r[o];let m=l+e,y=0;for(m=lr(m,e);m<a&&y<i;){const B=lr(m,e);A.some(Q=>Q.time===B)||(A.push({time:B,open:u.close,high:u.close,low:u.close,close:u.close,volume:0}),y++),m+=e}if(m<a&&y>=i){const B=lr(a-e,e);A.some(Q=>Q.time===B)||A.push({time:B,open:u.close,high:u.close,low:u.close,close:u.close,volume:0})}}}A.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of A)s.has(o.time)||(s.add(o.time),n.push(o));return n}function Wt(r){if(!r||typeof r!="string")return 60;const e=r.toUpperCase();if(e==="MN")return 2592e3;let A=e.match(/^([MHDW])(\d+)$/);if(A){const t=A[1];return parseInt(A[2],10)*({M:60,H:3600,D:86400,W:604800}[t]||60)}if(A=r.match(/^(\d+)([mhdwy])$/i),A){const t=parseInt(A[1],10),i=A[2].toLowerCase();return t*({m:60,h:3600,d:86400,w:604800,y:31536e3}[i]||60)}return 60}function Yc(r,e,A){if(!Array.isArray(r)||r.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const t=zr(e),i=Wt(A),o=Rc(r).map(Q=>({...Q,time:lr(Q.time,i)})).filter(Q=>Jc(Q)).map(Q=>Zc(Q)),l=qc(o);l.sort((Q,D)=>Q.time-D.time);const a=l.filter((Q,D)=>D===0?!0:Q.time>l[D-1].time),c=a.length>10?Dg(a,"percentile"):a,u=qc(c);u.sort((Q,D)=>Q.time-D.time);const m=kg(u,i),y=[];for(let Q=1;Q<m.length;Q++){const D=m[Q].time-m[Q-1].time;D>i*2&&y.push({from:m[Q-1].time,to:m[Q].time,gapSeconds:D,gapMinutes:Math.round(D/60),fromDate:new Date(m[Q-1].time*1e3).toISOString(),toDate:new Date(m[Q].time*1e3).toISOString()})}const B=c.filter((Q,D)=>D===0?!1:Q.close===c[D-1].close&&Q.open===c[D-1].close).length,p={original:r.length,processed:m.length,duplicates:r.length-l.length,outliers:B,gaps:y,filledGaps:m.length-u.length,symbolConfig:t};return{candles:m,stats:p}}function jc(r,e,A="1m"){if(!r||!e||!Jc(r))return null;const t=Ae(r.time);if(t==null)return null;const i=Wt(A),n=lr(t,i);return Zc({...r,time:n})}var fo=function(r,e){return fo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,t){A.__proto__=t}||function(A,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(A[i]=t[i])},fo(r,e)};function jA(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");fo(r,e);function A(){this.constructor=r}r.prototype=e===null?Object.create(e):(A.prototype=e.prototype,new A)}var po=function(){return po=Object.assign||function(e){for(var A,t=1,i=arguments.length;t<i;t++){A=arguments[t];for(var n in A)Object.prototype.hasOwnProperty.call(A,n)&&(e[n]=A[n])}return e},po.apply(this,arguments)};function SA(r,e,A,t){function i(n){return n instanceof A?n:new A(function(s){s(n)})}return new(A||(A=Promise))(function(n,s){function o(c){try{a(t.next(c))}catch(u){s(u)}}function l(c){try{a(t.throw(c))}catch(u){s(u)}}function a(c){c.done?n(c.value):i(c.value).then(o,l)}a((t=t.apply(r,[])).next())})}function FA(r,e){var A={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,i,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(a){return function(c){return l([a,c])}}function l(a){if(t)throw new TypeError("Generator is already executing.");for(;A;)try{if(t=1,i&&(n=a[0]&2?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[a[0]&2,n.value]),a[0]){case 0:case 1:n=a;break;case 4:return A.label++,{value:a[1],done:!1};case 5:A.label++,i=a[1],a=[0];continue;case 7:a=A.ops.pop(),A.trys.pop();continue;default:if(n=A.trys,!(n=n.length>0&&n[n.length-1])&&(a[0]===6||a[0]===2)){A=0;continue}if(a[0]===3&&(!n||a[1]>n[0]&&a[1]<n[3])){A.label=a[1];break}if(a[0]===6&&A.label<n[1]){A.label=n[1],n=a;break}if(n&&A.label<n[2]){A.label=n[2],A.ops.push(a);break}n[2]&&A.ops.pop(),A.trys.pop();continue}a=e.call(r,A)}catch(c){a=[6,c],i=0}finally{t=n=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function rn(r,e,A){if(arguments.length===2)for(var t=0,i=e.length,n;t<i;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return r.concat(n||e)}for(var mt=(function(){function r(e,A,t,i){this.left=e,this.top=A,this.width=t,this.height=i}return r.prototype.add=function(e,A,t,i){return new r(this.left+e,this.top+A,this.width+t,this.height+i)},r.fromClientRect=function(e,A){return new r(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height)},r.fromDOMRectList=function(e,A){var t=Array.from(A).find(function(i){return i.width!==0});return t?new r(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height):r.EMPTY},r.EMPTY=new r(0,0,0,0),r})(),nn=function(r,e){return mt.fromClientRect(r,e.getBoundingClientRect())},Og=function(r){var e=r.body,A=r.documentElement;if(!e||!A)throw new Error("Unable to get document size");var t=Math.max(Math.max(e.scrollWidth,A.scrollWidth),Math.max(e.offsetWidth,A.offsetWidth),Math.max(e.clientWidth,A.clientWidth)),i=Math.max(Math.max(e.scrollHeight,A.scrollHeight),Math.max(e.offsetHeight,A.offsetHeight),Math.max(e.clientHeight,A.clientHeight));return new mt(0,0,t,i)},sn=function(r){for(var e=[],A=0,t=r.length;A<t;){var i=r.charCodeAt(A++);if(i>=55296&&i<=56319&&A<t){var n=r.charCodeAt(A++);(n&64512)===56320?e.push(((i&1023)<<10)+(n&1023)+65536):(e.push(i),A--)}else e.push(i)}return e},dA=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var A=r.length;if(!A)return"";for(var t=[],i=-1,n="";++i<A;){var s=r[i];s<=65535?t.push(s):(s-=65536,t.push((s>>10)+55296,s%1024+56320)),(i+1===A||t.length>16384)&&(n+=String.fromCharCode.apply(String,t),t.length=0)}return n},eh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ng=typeof Uint8Array>"u"?[]:new Uint8Array(256),on=0;on<eh.length;on++)Ng[eh.charCodeAt(on)]=on;for(var Ah="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gr=typeof Uint8Array>"u"?[]:new Uint8Array(256),ln=0;ln<Ah.length;ln++)Gr[Ah.charCodeAt(ln)]=ln;for(var Kg=function(r){var e=r.length*.75,A=r.length,t,i=0,n,s,o,l;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var a=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),c=Array.isArray(a)?a:new Uint8Array(a);for(t=0;t<A;t+=4)n=Gr[r.charCodeAt(t)],s=Gr[r.charCodeAt(t+1)],o=Gr[r.charCodeAt(t+2)],l=Gr[r.charCodeAt(t+3)],c[i++]=n<<2|s>>4,c[i++]=(s&15)<<4|o>>2,c[i++]=(o&3)<<6|l&63;return a},Pg=function(r){for(var e=r.length,A=[],t=0;t<e;t+=2)A.push(r[t+1]<<8|r[t]);return A},Vg=function(r){for(var e=r.length,A=[],t=0;t<e;t+=4)A.push(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]);return A},Rt=5,go=11,mo=2,zg=go-Rt,th=65536>>Rt,Gg=1<<Rt,Bo=Gg-1,Wg=1024>>Rt,Rg=th+Wg,$g=Rg,Xg=32,Jg=$g+Xg,Zg=65536>>go,qg=1<<zg,Yg=qg-1,rh=function(r,e,A){return r.slice?r.slice(e,A):new Uint16Array(Array.prototype.slice.call(r,e,A))},jg=function(r,e,A){return r.slice?r.slice(e,A):new Uint32Array(Array.prototype.slice.call(r,e,A))},em=function(r,e){var A=Kg(r),t=Array.isArray(A)?Vg(A):new Uint32Array(A),i=Array.isArray(A)?Pg(A):new Uint16Array(A),n=24,s=rh(i,n/2,t[4]/2),o=t[5]===2?rh(i,(n+t[4])/2):jg(t,Math.ceil((n+t[4])/4));return new Am(t[0],t[1],t[2],t[3],s,o)},Am=(function(){function r(e,A,t,i,n,s){this.initialValue=e,this.errorValue=A,this.highStart=t,this.highValueIndex=i,this.index=n,this.data=s}return r.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=this.index[e>>Rt],A=(A<<mo)+(e&Bo),this.data[A];if(e<=65535)return A=this.index[th+(e-55296>>Rt)],A=(A<<mo)+(e&Bo),this.data[A];if(e<this.highStart)return A=Jg-Zg+(e>>go),A=this.index[A],A+=e>>Rt&Yg,A=this.index[A],A=(A<<mo)+(e&Bo),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),ih="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tm=typeof Uint8Array>"u"?[]:new Uint8Array(256),an=0;an<ih.length;an++)tm[ih.charCodeAt(an)]=an;var rm="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==",nh=50,im=1,sh=2,oh=3,nm=4,sm=5,lh=7,ah=8,ch=9,Tt=10,wo=11,hh=12,Co=13,om=14,Wr=15,vo=16,cn=17,Rr=18,lm=19,uh=20,yo=21,$r=22,bo=23,ar=24,PA=25,Xr=26,Jr=27,cr=28,am=29,$t=30,cm=31,hn=32,un=33,To=34,Qo=35,xo=36,Zr=37,Fo=38,dn=39,fn=40,Uo=41,dh=42,hm=43,um=[9001,65288],fh="!",$e="×",pn="÷",Eo=em(rm),Bt=[$t,xo],So=[im,sh,oh,sm],ph=[Tt,ah],gh=[Jr,Xr],dm=So.concat(ph),mh=[Fo,dn,fn,To,Qo],fm=[Wr,Co],pm=function(r,e){e===void 0&&(e="strict");var A=[],t=[],i=[];return r.forEach(function(n,s){var o=Eo.get(n);if(o>nh?(i.push(!0),o-=nh):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return t.push(s),A.push(vo);if(o===nm||o===wo){if(s===0)return t.push(s),A.push($t);var l=A[s-1];return dm.indexOf(l)===-1?(t.push(t[s-1]),A.push(l)):(t.push(s),A.push($t))}if(t.push(s),o===cm)return A.push(e==="strict"?yo:Zr);if(o===dh||o===am)return A.push($t);if(o===hm)return n>=131072&&n<=196605||n>=196608&&n<=262141?A.push(Zr):A.push($t);A.push(o)}),[t,A,i]},Ho=function(r,e,A,t){var i=t[A];if(Array.isArray(r)?r.indexOf(i)!==-1:r===i)for(var n=A;n<=t.length;){n++;var s=t[n];if(s===e)return!0;if(s!==Tt)break}if(i===Tt)for(var n=A;n>0;){n--;var o=t[n];if(Array.isArray(r)?r.indexOf(o)!==-1:r===o)for(var l=A;l<=t.length;){l++;var s=t[l];if(s===e)return!0;if(s!==Tt)break}if(o!==Tt)break}return!1},Bh=function(r,e){for(var A=r;A>=0;){var t=e[A];if(t===Tt)A--;else return t}return 0},gm=function(r,e,A,t,i){if(A[t]===0)return $e;var n=t-1;if(Array.isArray(i)&&i[n]===!0)return $e;var s=n-1,o=n+1,l=e[n],a=s>=0?e[s]:0,c=e[o];if(l===sh&&c===oh)return $e;if(So.indexOf(l)!==-1)return fh;if(So.indexOf(c)!==-1||ph.indexOf(c)!==-1)return $e;if(Bh(n,e)===ah)return pn;if(Eo.get(r[n])===wo||(l===hn||l===un)&&Eo.get(r[o])===wo||l===lh||c===lh||l===ch||[Tt,Co,Wr].indexOf(l)===-1&&c===ch||[cn,Rr,lm,ar,cr].indexOf(c)!==-1||Bh(n,e)===$r||Ho(bo,$r,n,e)||Ho([cn,Rr],yo,n,e)||Ho(hh,hh,n,e))return $e;if(l===Tt)return pn;if(l===bo||c===bo)return $e;if(c===vo||l===vo)return pn;if([Co,Wr,yo].indexOf(c)!==-1||l===om||a===xo&&fm.indexOf(l)!==-1||l===cr&&c===xo||c===uh||Bt.indexOf(c)!==-1&&l===PA||Bt.indexOf(l)!==-1&&c===PA||l===Jr&&[Zr,hn,un].indexOf(c)!==-1||[Zr,hn,un].indexOf(l)!==-1&&c===Xr||Bt.indexOf(l)!==-1&&gh.indexOf(c)!==-1||gh.indexOf(l)!==-1&&Bt.indexOf(c)!==-1||[Jr,Xr].indexOf(l)!==-1&&(c===PA||[$r,Wr].indexOf(c)!==-1&&e[o+1]===PA)||[$r,Wr].indexOf(l)!==-1&&c===PA||l===PA&&[PA,cr,ar].indexOf(c)!==-1)return $e;if([PA,cr,ar,cn,Rr].indexOf(c)!==-1)for(var u=n;u>=0;){var m=e[u];if(m===PA)return $e;if([cr,ar].indexOf(m)!==-1)u--;else break}if([Jr,Xr].indexOf(c)!==-1)for(var u=[cn,Rr].indexOf(l)!==-1?s:n;u>=0;){var m=e[u];if(m===PA)return $e;if([cr,ar].indexOf(m)!==-1)u--;else break}if(Fo===l&&[Fo,dn,To,Qo].indexOf(c)!==-1||[dn,To].indexOf(l)!==-1&&[dn,fn].indexOf(c)!==-1||[fn,Qo].indexOf(l)!==-1&&c===fn||mh.indexOf(l)!==-1&&[uh,Xr].indexOf(c)!==-1||mh.indexOf(c)!==-1&&l===Jr||Bt.indexOf(l)!==-1&&Bt.indexOf(c)!==-1||l===ar&&Bt.indexOf(c)!==-1||Bt.concat(PA).indexOf(l)!==-1&&c===$r&&um.indexOf(r[o])===-1||Bt.concat(PA).indexOf(c)!==-1&&l===Rr)return $e;if(l===Uo&&c===Uo){for(var y=A[n],B=1;y>0&&(y--,e[y]===Uo);)B++;if(B%2!==0)return $e}return l===hn&&c===un?$e:pn},mm=function(r,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var A=pm(r,e.lineBreak),t=A[0],i=A[1],n=A[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(o){return[PA,$t,dh].indexOf(o)!==-1?Zr:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&r[l]>=19968&&r[l]<=40959}):void 0;return[t,i,s]},Bm=(function(){function r(e,A,t,i){this.codePoints=e,this.required=A===fh,this.start=t,this.end=i}return r.prototype.slice=function(){return dA.apply(void 0,this.codePoints.slice(this.start,this.end))},r})(),wm=function(r,e){var A=sn(r),t=mm(A,e),i=t[0],n=t[1],s=t[2],o=A.length,l=0,a=0;return{next:function(){if(a>=o)return{done:!0,value:null};for(var c=$e;a<o&&(c=gm(A,n,i,++a,s))===$e;);if(c!==$e||a===o){var u=new Bm(A,c,l,a);return l=a,{value:u,done:!1}}return{done:!0,value:null}}}},Cm=1,vm=2,qr=4,wh=8,gn=10,Ch=47,Yr=92,ym=9,bm=32,mn=34,jr=61,Tm=35,Qm=36,xm=37,Bn=39,wn=40,ei=41,Fm=95,kA=45,Um=33,Em=60,Sm=62,Hm=64,Lm=91,Mm=93,Im=61,_m=123,Cn=63,Dm=125,vh=124,km=126,Om=128,yh=65533,Lo=42,Xt=43,Nm=44,Km=58,Pm=59,Ai=46,Vm=0,zm=8,Gm=11,Wm=14,Rm=31,$m=127,lt=-1,bh=48,Th=97,Qh=101,Xm=102,Jm=117,Zm=122,xh=65,Fh=69,Uh=70,qm=85,Ym=90,UA=function(r){return r>=bh&&r<=57},jm=function(r){return r>=55296&&r<=57343},hr=function(r){return UA(r)||r>=xh&&r<=Uh||r>=Th&&r<=Xm},eB=function(r){return r>=Th&&r<=Zm},AB=function(r){return r>=xh&&r<=Ym},tB=function(r){return eB(r)||AB(r)},rB=function(r){return r>=Om},vn=function(r){return r===gn||r===ym||r===bm},yn=function(r){return tB(r)||rB(r)||r===Fm},Eh=function(r){return yn(r)||UA(r)||r===kA},iB=function(r){return r>=Vm&&r<=zm||r===Gm||r>=Wm&&r<=Rm||r===$m},Qt=function(r,e){return r!==Yr?!1:e!==gn},bn=function(r,e,A){return r===kA?yn(e)||Qt(e,A):yn(r)?!0:!!(r===Yr&&Qt(r,e))},Mo=function(r,e,A){return r===Xt||r===kA?UA(e)?!0:e===Ai&&UA(A):UA(r===Ai?e:r)},nB=function(r){var e=0,A=1;(r[e]===Xt||r[e]===kA)&&(r[e]===kA&&(A=-1),e++);for(var t=[];UA(r[e]);)t.push(r[e++]);var i=t.length?parseInt(dA.apply(void 0,t),10):0;r[e]===Ai&&e++;for(var n=[];UA(r[e]);)n.push(r[e++]);var s=n.length,o=s?parseInt(dA.apply(void 0,n),10):0;(r[e]===Fh||r[e]===Qh)&&e++;var l=1;(r[e]===Xt||r[e]===kA)&&(r[e]===kA&&(l=-1),e++);for(var a=[];UA(r[e]);)a.push(r[e++]);var c=a.length?parseInt(dA.apply(void 0,a),10):0;return A*(i+o*Math.pow(10,-s))*Math.pow(10,l*c)},sB={type:2},oB={type:3},lB={type:4},aB={type:13},cB={type:8},hB={type:21},uB={type:9},dB={type:10},fB={type:11},pB={type:12},gB={type:14},Tn={type:23},mB={type:1},BB={type:25},wB={type:24},CB={type:26},vB={type:27},yB={type:28},bB={type:29},TB={type:31},Io={type:32},Sh=(function(){function r(){this._value=[]}return r.prototype.write=function(e){this._value=this._value.concat(sn(e))},r.prototype.read=function(){for(var e=[],A=this.consumeToken();A!==Io;)e.push(A),A=this.consumeToken();return e},r.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case mn:return this.consumeStringToken(mn);case Tm:var A=this.peekCodePoint(0),t=this.peekCodePoint(1),i=this.peekCodePoint(2);if(Eh(A)||Qt(t,i)){var n=bn(A,t,i)?vm:Cm,s=this.consumeName();return{type:5,value:s,flags:n}}break;case Qm:if(this.peekCodePoint(0)===jr)return this.consumeCodePoint(),aB;break;case Bn:return this.consumeStringToken(Bn);case wn:return sB;case ei:return oB;case Lo:if(this.peekCodePoint(0)===jr)return this.consumeCodePoint(),gB;break;case Xt:if(Mo(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Nm:return lB;case kA:var o=e,l=this.peekCodePoint(0),a=this.peekCodePoint(1);if(Mo(o,l,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(bn(o,l,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===kA&&a===Sm)return this.consumeCodePoint(),this.consumeCodePoint(),wB;break;case Ai:if(Mo(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Ch:if(this.peekCodePoint(0)===Lo)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===Lo&&(c=this.consumeCodePoint(),c===Ch))return this.consumeToken();if(c===lt)return this.consumeToken()}break;case Km:return CB;case Pm:return vB;case Em:if(this.peekCodePoint(0)===Um&&this.peekCodePoint(1)===kA&&this.peekCodePoint(2)===kA)return this.consumeCodePoint(),this.consumeCodePoint(),BB;break;case Hm:var u=this.peekCodePoint(0),m=this.peekCodePoint(1),y=this.peekCodePoint(2);if(bn(u,m,y)){var s=this.consumeName();return{type:7,value:s}}break;case Lm:return yB;case Yr:if(Qt(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Mm:return bB;case Im:if(this.peekCodePoint(0)===jr)return this.consumeCodePoint(),cB;break;case _m:return fB;case Dm:return pB;case Jm:case qm:var B=this.peekCodePoint(0),p=this.peekCodePoint(1);return B===Xt&&(hr(p)||p===Cn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case vh:if(this.peekCodePoint(0)===jr)return this.consumeCodePoint(),uB;if(this.peekCodePoint(0)===vh)return this.consumeCodePoint(),hB;break;case km:if(this.peekCodePoint(0)===jr)return this.consumeCodePoint(),dB;break;case lt:return Io}return vn(e)?(this.consumeWhiteSpace(),TB):UA(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):yn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:dA(e)}},r.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},r.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},r.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},r.prototype.consumeUnicodeRangeToken=function(){for(var e=[],A=this.consumeCodePoint();hr(A)&&e.length<6;)e.push(A),A=this.consumeCodePoint();for(var t=!1;A===Cn&&e.length<6;)e.push(A),A=this.consumeCodePoint(),t=!0;if(t){var i=parseInt(dA.apply(void 0,e.map(function(l){return l===Cn?bh:l})),16),n=parseInt(dA.apply(void 0,e.map(function(l){return l===Cn?Uh:l})),16);return{type:30,start:i,end:n}}var s=parseInt(dA.apply(void 0,e),16);if(this.peekCodePoint(0)===kA&&hr(this.peekCodePoint(1))){this.consumeCodePoint(),A=this.consumeCodePoint();for(var o=[];hr(A)&&o.length<6;)o.push(A),A=this.consumeCodePoint();var n=parseInt(dA.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},r.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===wn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===wn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},r.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===lt)return{type:22,value:""};var A=this.peekCodePoint(0);if(A===Bn||A===mn){var t=this.consumeStringToken(this.consumeCodePoint());return t.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===lt||this.peekCodePoint(0)===ei)?(this.consumeCodePoint(),{type:22,value:t.value}):(this.consumeBadUrlRemnants(),Tn)}for(;;){var i=this.consumeCodePoint();if(i===lt||i===ei)return{type:22,value:dA.apply(void 0,e)};if(vn(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===lt||this.peekCodePoint(0)===ei?(this.consumeCodePoint(),{type:22,value:dA.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Tn);if(i===mn||i===Bn||i===wn||iB(i))return this.consumeBadUrlRemnants(),Tn;if(i===Yr)if(Qt(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Tn;else e.push(i)}},r.prototype.consumeWhiteSpace=function(){for(;vn(this.peekCodePoint(0));)this.consumeCodePoint()},r.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===ei||e===lt)return;Qt(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},r.prototype.consumeStringSlice=function(e){for(var A=5e4,t="";e>0;){var i=Math.min(A,e);t+=dA.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),t},r.prototype.consumeStringToken=function(e){var A="",t=0;do{var i=this._value[t];if(i===lt||i===void 0||i===e)return A+=this.consumeStringSlice(t),{type:0,value:A};if(i===gn)return this._value.splice(0,t),mB;if(i===Yr){var n=this._value[t+1];n!==lt&&n!==void 0&&(n===gn?(A+=this.consumeStringSlice(t),t=-1,this._value.shift()):Qt(i,n)&&(A+=this.consumeStringSlice(t),A+=dA(this.consumeEscapedCodePoint()),t=-1))}t++}while(!0)},r.prototype.consumeNumber=function(){var e=[],A=qr,t=this.peekCodePoint(0);for((t===Xt||t===kA)&&e.push(this.consumeCodePoint());UA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());t=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(t===Ai&&UA(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=wh;UA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());t=this.peekCodePoint(0),i=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((t===Fh||t===Qh)&&((i===Xt||i===kA)&&UA(n)||UA(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=wh;UA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[nB(e),A]},r.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),A=e[0],t=e[1],i=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(bn(i,n,s)){var o=this.consumeName();return{type:15,number:A,flags:t,unit:o}}return i===xm?(this.consumeCodePoint(),{type:16,number:A,flags:t}):{type:17,number:A,flags:t}},r.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(hr(e)){for(var A=dA(e);hr(this.peekCodePoint(0))&&A.length<6;)A+=dA(this.consumeCodePoint());vn(this.peekCodePoint(0))&&this.consumeCodePoint();var t=parseInt(A,16);return t===0||jm(t)||t>1114111?yh:t}return e===lt?yh:e},r.prototype.consumeName=function(){for(var e="";;){var A=this.consumeCodePoint();if(Eh(A))e+=dA(A);else if(Qt(A,this.peekCodePoint(0)))e+=dA(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(A),e}},r})(),Hh=(function(){function r(e){this._tokens=e}return r.create=function(e){var A=new Sh;return A.write(e),new r(A.read())},r.parseValue=function(e){return r.create(e).parseComponentValue()},r.parseValues=function(e){return r.create(e).parseComponentValues()},r.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var A=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return A;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},r.prototype.parseComponentValues=function(){for(var e=[];;){var A=this.consumeComponentValue();if(A.type===32)return e;e.push(A),e.push()}},r.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},r.prototype.consumeSimpleBlock=function(e){for(var A={type:e,values:[]},t=this.consumeToken();;){if(t.type===32||xB(t,e))return A;this.reconsumeToken(t),A.values.push(this.consumeComponentValue()),t=this.consumeToken()}},r.prototype.consumeFunction=function(e){for(var A={name:e.value,values:[],type:18};;){var t=this.consumeToken();if(t.type===32||t.type===3)return A;this.reconsumeToken(t),A.values.push(this.consumeComponentValue())}},r.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Io:e},r.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},r})(),ti=function(r){return r.type===15},ur=function(r){return r.type===17},AA=function(r){return r.type===20},QB=function(r){return r.type===0},_o=function(r,e){return AA(r)&&r.value===e},Lh=function(r){return r.type!==31},dr=function(r){return r.type!==31&&r.type!==4},at=function(r){var e=[],A=[];return r.forEach(function(t){if(t.type===4){if(A.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(A),A=[];return}t.type!==31&&A.push(t)}),A.length&&e.push(A),e},xB=function(r,e){return e===11&&r.type===12||e===28&&r.type===29?!0:e===2&&r.type===3},xt=function(r){return r.type===17||r.type===15},gA=function(r){return r.type===16||xt(r)},Mh=function(r){return r.length>1?[r[0],r[1]]:[r[0]]},vA={type:17,number:0,flags:qr},Do={type:16,number:50,flags:qr},Ft={type:16,number:100,flags:qr},ri=function(r,e,A){var t=r[0],i=r[1];return[nA(t,e),nA(typeof i<"u"?i:t,A)]},nA=function(r,e){if(r.type===16)return r.number/100*e;if(ti(r))switch(r.unit){case"rem":case"em":return 16*r.number;default:return r.number}return r.number},Ih="deg",_h="grad",Dh="rad",kh="turn",Qn={name:"angle",parse:function(r,e){if(e.type===15)switch(e.unit){case Ih:return Math.PI*e.number/180;case _h:return Math.PI/200*e.number;case Dh:return e.number;case kh:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Oh=function(r){return r.type===15&&(r.unit===Ih||r.unit===_h||r.unit===Dh||r.unit===kh)},Nh=function(r){var e=r.filter(AA).map(function(A){return A.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[vA,vA];case"to top":case"bottom":return WA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[vA,Ft];case"to right":case"left":return WA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Ft,Ft];case"to bottom":case"top":return WA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Ft,vA];case"to left":case"right":return WA(270)}return 0},WA=function(r){return Math.PI*r/180},Ut={name:"color",parse:function(r,e){if(e.type===18){var A=FB[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return A(r,e.values)}if(e.type===5){if(e.value.length===3){var t=e.value.substring(0,1),i=e.value.substring(1,2),n=e.value.substring(2,3);return St(parseInt(t+t,16),parseInt(i+i,16),parseInt(n+n,16),1)}if(e.value.length===4){var t=e.value.substring(0,1),i=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return St(parseInt(t+t,16),parseInt(i+i,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var t=e.value.substring(0,2),i=e.value.substring(2,4),n=e.value.substring(4,6);return St(parseInt(t,16),parseInt(i,16),parseInt(n,16),1)}if(e.value.length===8){var t=e.value.substring(0,2),i=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return St(parseInt(t,16),parseInt(i,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=wt[e.value.toUpperCase()];if(typeof o<"u")return o}return wt.TRANSPARENT}},Et=function(r){return(255&r)===0},BA=function(r){var e=255&r,A=255&r>>8,t=255&r>>16,i=255&r>>24;return e<255?"rgba("+i+","+t+","+A+","+e/255+")":"rgb("+i+","+t+","+A+")"},St=function(r,e,A,t){return(r<<24|e<<16|A<<8|Math.round(t*255)<<0)>>>0},Kh=function(r,e){if(r.type===17)return r.number;if(r.type===16){var A=e===3?1:255;return e===3?r.number/100*A:Math.round(r.number/100*A)}return 0},Ph=function(r,e){var A=e.filter(dr);if(A.length===3){var t=A.map(Kh),i=t[0],n=t[1],s=t[2];return St(i,n,s,1)}if(A.length===4){var o=A.map(Kh),i=o[0],n=o[1],s=o[2],l=o[3];return St(i,n,s,l)}return 0};function ko(r,e,A){return A<0&&(A+=1),A>=1&&(A-=1),A<1/6?(e-r)*A*6+r:A<1/2?e:A<2/3?(e-r)*6*(2/3-A)+r:r}var Vh=function(r,e){var A=e.filter(dr),t=A[0],i=A[1],n=A[2],s=A[3],o=(t.type===17?WA(t.number):Qn.parse(r,t))/(Math.PI*2),l=gA(i)?i.number/100:0,a=gA(n)?n.number/100:0,c=typeof s<"u"&&gA(s)?nA(s,1):1;if(l===0)return St(a*255,a*255,a*255,1);var u=a<=.5?a*(l+1):a+l-a*l,m=a*2-u,y=ko(m,u,o+1/3),B=ko(m,u,o),p=ko(m,u,o-1/3);return St(y*255,B*255,p*255,c)},FB={hsl:Vh,hsla:Vh,rgb:Ph,rgba:Ph},ii=function(r,e){return Ut.parse(r,Hh.create(e).parseComponentValue())},wt={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},UB={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(r,e){return e.map(function(A){if(AA(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},EB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},xn=function(r,e){var A=Ut.parse(r,e[0]),t=e[1];return t&&gA(t)?{color:A,stop:t}:{color:A,stop:null}},zh=function(r,e){var A=r[0],t=r[r.length-1];A.stop===null&&(A.stop=vA),t.stop===null&&(t.stop=Ft);for(var i=[],n=0,s=0;s<r.length;s++){var o=r[s].stop;if(o!==null){var l=nA(o,e);l>n?i.push(l):i.push(n),n=l}else i.push(null)}for(var a=null,s=0;s<i.length;s++){var c=i[s];if(c===null)a===null&&(a=s);else if(a!==null){for(var u=s-a,m=i[a-1],y=(c-m)/(u+1),B=1;B<=u;B++)i[a+B-1]=y*B;a=null}}return r.map(function(p,Q){var D=p.color;return{color:D,stop:Math.max(Math.min(1,i[Q]/e),0)}})},SB=function(r,e,A){var t=e/2,i=A/2,n=nA(r[0],e)-t,s=i-nA(r[1],A);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},HB=function(r,e,A){var t=typeof r=="number"?r:SB(r,e,A),i=Math.abs(e*Math.sin(t))+Math.abs(A*Math.cos(t)),n=e/2,s=A/2,o=i/2,l=Math.sin(t-Math.PI/2)*o,a=Math.cos(t-Math.PI/2)*o;return[i,n-a,n+a,s-l,s+l]},et=function(r,e){return Math.sqrt(r*r+e*e)},Gh=function(r,e,A,t,i){var n=[[0,0],[0,e],[r,0],[r,e]];return n.reduce(function(s,o){var l=o[0],a=o[1],c=et(A-l,t-a);return(i?c<s.optimumDistance:c>s.optimumDistance)?{optimumCorner:o,optimumDistance:c}:s},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},LB=function(r,e,A,t,i){var n=0,s=0;switch(r.size){case 0:r.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-t),Math.abs(A),Math.abs(A-i)):r.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-t)),s=Math.min(Math.abs(A),Math.abs(A-i)));break;case 2:if(r.shape===0)n=s=Math.min(et(e,A),et(e,A-i),et(e-t,A),et(e-t,A-i));else if(r.shape===1){var o=Math.min(Math.abs(A),Math.abs(A-i))/Math.min(Math.abs(e),Math.abs(e-t)),l=Gh(t,i,e,A,!0),a=l[0],c=l[1];n=et(a-e,(c-A)/o),s=o*n}break;case 1:r.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-t),Math.abs(A),Math.abs(A-i)):r.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-t)),s=Math.max(Math.abs(A),Math.abs(A-i)));break;case 3:if(r.shape===0)n=s=Math.max(et(e,A),et(e,A-i),et(e-t,A),et(e-t,A-i));else if(r.shape===1){var o=Math.max(Math.abs(A),Math.abs(A-i))/Math.max(Math.abs(e),Math.abs(e-t)),u=Gh(t,i,e,A,!1),a=u[0],c=u[1];n=et(a-e,(c-A)/o),s=o*n}break}return Array.isArray(r.size)&&(n=nA(r.size[0],t),s=r.size.length===2?nA(r.size[1],i):n),[n,s]},MB=function(r,e){var A=WA(180),t=[];return at(e).forEach(function(i,n){if(n===0){var s=i[0];if(s.type===20&&s.value==="to"){A=Nh(i);return}else if(Oh(s)){A=Qn.parse(r,s);return}}var o=xn(r,i);t.push(o)}),{angle:A,stops:t,type:1}},Fn=function(r,e){var A=WA(180),t=[];return at(e).forEach(function(i,n){if(n===0){var s=i[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){A=Nh(i);return}else if(Oh(s)){A=(Qn.parse(r,s)+WA(270))%WA(360);return}}var o=xn(r,i);t.push(o)}),{angle:A,stops:t,type:1}},IB=function(r,e){var A=WA(180),t=[],i=1,n=0,s=3,o=[];return at(e).forEach(function(l,a){var c=l[0];if(a===0){if(AA(c)&&c.value==="linear"){i=1;return}else if(AA(c)&&c.value==="radial"){i=2;return}}if(c.type===18){if(c.name==="from"){var u=Ut.parse(r,c.values[0]);t.push({stop:vA,color:u})}else if(c.name==="to"){var u=Ut.parse(r,c.values[0]);t.push({stop:Ft,color:u})}else if(c.name==="color-stop"){var m=c.values.filter(dr);if(m.length===2){var u=Ut.parse(r,m[1]),y=m[0];ur(y)&&t.push({stop:{type:16,number:y.number*100,flags:y.flags},color:u})}}}}),i===1?{angle:(A+WA(180))%WA(360),stops:t,type:i}:{size:s,shape:n,stops:t,position:o,type:i}},Wh="closest-side",Rh="farthest-side",$h="closest-corner",Xh="farthest-corner",Jh="circle",Zh="ellipse",qh="cover",Yh="contain",_B=function(r,e){var A=0,t=3,i=[],n=[];return at(e).forEach(function(s,o){var l=!0;if(o===0){var a=!1;l=s.reduce(function(u,m){if(a)if(AA(m))switch(m.value){case"center":return n.push(Do),u;case"top":case"left":return n.push(vA),u;case"right":case"bottom":return n.push(Ft),u}else(gA(m)||xt(m))&&n.push(m);else if(AA(m))switch(m.value){case Jh:return A=0,!1;case Zh:return A=1,!1;case"at":return a=!0,!1;case Wh:return t=0,!1;case qh:case Rh:return t=1,!1;case Yh:case $h:return t=2,!1;case Xh:return t=3,!1}else if(xt(m)||gA(m))return Array.isArray(t)||(t=[]),t.push(m),!1;return u},l)}if(l){var c=xn(r,s);i.push(c)}}),{size:t,shape:A,stops:i,position:n,type:2}},Un=function(r,e){var A=0,t=3,i=[],n=[];return at(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(c,u){if(AA(u))switch(u.value){case"center":return n.push(Do),!1;case"top":case"left":return n.push(vA),!1;case"right":case"bottom":return n.push(Ft),!1}else if(gA(u)||xt(u))return n.push(u),!1;return c},l):o===1&&(l=s.reduce(function(c,u){if(AA(u))switch(u.value){case Jh:return A=0,!1;case Zh:return A=1,!1;case Yh:case Wh:return t=0,!1;case Rh:return t=1,!1;case $h:return t=2,!1;case qh:case Xh:return t=3,!1}else if(xt(u)||gA(u))return Array.isArray(t)||(t=[]),t.push(u),!1;return c},l)),l){var a=xn(r,s);i.push(a)}}),{size:t,shape:A,stops:i,position:n,type:2}},DB=function(r){return r.type===1},kB=function(r){return r.type===2},Oo={name:"image",parse:function(r,e){if(e.type===22){var A={url:e.value,type:0};return r.cache.addImage(e.value),A}if(e.type===18){var t=jh[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return t(r,e.values)}throw new Error("Unsupported image type "+e.type)}};function OB(r){return!(r.type===20&&r.value==="none")&&(r.type!==18||!!jh[r.name])}var jh={"linear-gradient":MB,"-moz-linear-gradient":Fn,"-ms-linear-gradient":Fn,"-o-linear-gradient":Fn,"-webkit-linear-gradient":Fn,"radial-gradient":_B,"-moz-radial-gradient":Un,"-ms-radial-gradient":Un,"-o-radial-gradient":Un,"-webkit-radial-gradient":Un,"-webkit-gradient":IB},NB={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(r,e){if(e.length===0)return[];var A=e[0];return A.type===20&&A.value==="none"?[]:e.filter(function(t){return dr(t)&&OB(t)}).map(function(t){return Oo.parse(r,t)})}},KB={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(r,e){return e.map(function(A){if(AA(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},PB={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(r,e){return at(e).map(function(A){return A.filter(gA)}).map(Mh)}},VB={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(r,e){return at(e).map(function(A){return A.filter(AA).map(function(t){return t.value}).join(" ")}).map(zB)}},zB=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}},fr;(function(r){r.AUTO="auto",r.CONTAIN="contain",r.COVER="cover"})(fr||(fr={}));var GB={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(r,e){return at(e).map(function(A){return A.filter(WB)})}},WB=function(r){return AA(r)||gA(r)},En=function(r){return{name:"border-"+r+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},RB=En("top"),$B=En("right"),XB=En("bottom"),JB=En("left"),Sn=function(r){return{name:"border-radius-"+r,initialValue:"0 0",prefix:!1,type:1,parse:function(e,A){return Mh(A.filter(gA))}}},ZB=Sn("top-left"),qB=Sn("top-right"),YB=Sn("bottom-right"),jB=Sn("bottom-left"),Hn=function(r){return{name:"border-"+r+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,A){switch(A){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},ew=Hn("top"),Aw=Hn("right"),tw=Hn("bottom"),rw=Hn("left"),Ln=function(r){return{name:"border-"+r+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,A){return ti(A)?A.number:0}}},iw=Ln("top"),nw=Ln("right"),sw=Ln("bottom"),ow=Ln("left"),lw={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},aw={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(r,e){return e==="rtl"?1:0}},cw={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(r,e){return e.filter(AA).reduce(function(A,t){return A|hw(t.value)},0)}},hw=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},uw={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},dw={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(r,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},Mn;(function(r){r.NORMAL="normal",r.STRICT="strict"})(Mn||(Mn={}));var fw={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){return e==="strict"?Mn.STRICT:Mn.NORMAL}},pw={name:"line-height",initialValue:"normal",prefix:!1,type:4},eu=function(r,e){return AA(r)&&r.value==="normal"?1.2*e:r.type===17?e*r.number:gA(r)?nA(r,e):e},gw={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(r,e){return e.type===20&&e.value==="none"?null:Oo.parse(r,e)}},mw={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(r,e){return e==="inside"?0:1}},No={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){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}}},In=function(r){return{name:"margin-"+r,initialValue:"0",prefix:!1,type:4}},Bw=In("top"),ww=In("right"),Cw=In("bottom"),vw=In("left"),yw={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(r,e){return e.filter(AA).map(function(A){switch(A.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},bw={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){return e==="break-word"?"break-word":"normal"}},_n=function(r){return{name:"padding-"+r,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Tw=_n("top"),Qw=_n("right"),xw=_n("bottom"),Fw=_n("left"),Uw={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(r,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Ew={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(r,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Sw={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.length===1&&_o(e[0],"none")?[]:at(e).map(function(A){for(var t={color:wt.TRANSPARENT,offsetX:vA,offsetY:vA,blur:vA},i=0,n=0;n<A.length;n++){var s=A[n];xt(s)?(i===0?t.offsetX=s:i===1?t.offsetY=s:t.blur=s,i++):t.color=Ut.parse(r,s)}return t})}},Hw={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Lw={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(r,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var A=_w[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return A(e.values)}return null}},Mw=function(r){var e=r.filter(function(A){return A.type===17}).map(function(A){return A.number});return e.length===6?e:null},Iw=function(r){var e=r.filter(function(l){return l.type===17}).map(function(l){return l.number}),A=e[0],t=e[1];e[2],e[3];var i=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[A,t,i,n,s,o]:null},_w={matrix:Mw,matrix3d:Iw},Au={type:16,number:50,flags:qr},Dw=[Au,Au],kw={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(r,e){var A=e.filter(gA);return A.length!==2?Dw:[A[0],A[1]]}},Ow={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},ni;(function(r){r.NORMAL="normal",r.BREAK_ALL="break-all",r.KEEP_ALL="keep-all"})(ni||(ni={}));for(var Nw={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){switch(e){case"break-all":return ni.BREAK_ALL;case"keep-all":return ni.KEEP_ALL;default:return ni.NORMAL}}},Kw={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(r,e){if(e.type===20)return{auto:!0,order:0};if(ur(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},tu={name:"time",parse:function(r,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Pw={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(r,e){return ur(e)?e.number:1}},Vw={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},zw={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(r,e){return e.filter(AA).map(function(A){switch(A.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(A){return A!==0})}},Gw={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(r,e){var A=[],t=[];return e.forEach(function(i){switch(i.type){case 20:case 0:A.push(i.value);break;case 17:A.push(i.number.toString());break;case 4:t.push(A.join(" ")),A.length=0;break}}),A.length&&t.push(A.join(" ")),t.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},Ww={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Rw={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(r,e){return ur(e)?e.number:AA(e)&&e.value==="bold"?700:400}},$w={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.filter(AA).map(function(A){return A.value})}},Xw={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},mA=function(r,e){return(r&e)!==0},Jw={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(r,e){if(e.length===0)return[];var A=e[0];return A.type===20&&A.value==="none"?[]:e}},Zw={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return null;var A=e[0];if(A.type===20&&A.value==="none")return null;for(var t=[],i=e.filter(Lh),n=0;n<i.length;n++){var s=i[n],o=i[n+1];if(s.type===20){var l=o&&ur(o)?o.number:1;t.push({counter:s.value,increment:l})}}return t}},qw={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return[];for(var A=[],t=e.filter(Lh),i=0;i<t.length;i++){var n=t[i],s=t[i+1];if(AA(n)&&n.value!=="none"){var o=s&&ur(s)?s.number:0;A.push({counter:n.value,reset:o})}}return A}},Yw={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(r,e){return e.filter(ti).map(function(A){return tu.parse(r,A)})}},jw={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return null;var A=e[0];if(A.type===20&&A.value==="none")return null;var t=[],i=e.filter(QB);if(i.length%2!==0)return null;for(var n=0;n<i.length;n+=2){var s=i[n].value,o=i[n+1].value;t.push({open:s,close:o})}return t}},ru=function(r,e,A){if(!r)return"";var t=r[Math.min(e,r.length-1)];return t?A?t.open:t.close:""},eC={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.length===1&&_o(e[0],"none")?[]:at(e).map(function(A){for(var t={color:255,offsetX:vA,offsetY:vA,blur:vA,spread:vA,inset:!1},i=0,n=0;n<A.length;n++){var s=A[n];_o(s,"inset")?t.inset=!0:xt(s)?(i===0?t.offsetX=s:i===1?t.offsetY=s:i===2?t.blur=s:t.spread=s,i++):t.color=Ut.parse(r,s)}return t})}},AC={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(r,e){var A=[0,1,2],t=[];return e.filter(AA).forEach(function(i){switch(i.value){case"stroke":t.push(1);break;case"fill":t.push(0);break;case"markers":t.push(2);break}}),A.forEach(function(i){t.indexOf(i)===-1&&t.push(i)}),t}},tC={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},rC={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(r,e){return ti(e)?e.number:0}},iC=(function(){function r(e,A){var t,i;this.animationDuration=Te(e,Yw,A.animationDuration),this.backgroundClip=Te(e,UB,A.backgroundClip),this.backgroundColor=Te(e,EB,A.backgroundColor),this.backgroundImage=Te(e,NB,A.backgroundImage),this.backgroundOrigin=Te(e,KB,A.backgroundOrigin),this.backgroundPosition=Te(e,PB,A.backgroundPosition),this.backgroundRepeat=Te(e,VB,A.backgroundRepeat),this.backgroundSize=Te(e,GB,A.backgroundSize),this.borderTopColor=Te(e,RB,A.borderTopColor),this.borderRightColor=Te(e,$B,A.borderRightColor),this.borderBottomColor=Te(e,XB,A.borderBottomColor),this.borderLeftColor=Te(e,JB,A.borderLeftColor),this.borderTopLeftRadius=Te(e,ZB,A.borderTopLeftRadius),this.borderTopRightRadius=Te(e,qB,A.borderTopRightRadius),this.borderBottomRightRadius=Te(e,YB,A.borderBottomRightRadius),this.borderBottomLeftRadius=Te(e,jB,A.borderBottomLeftRadius),this.borderTopStyle=Te(e,ew,A.borderTopStyle),this.borderRightStyle=Te(e,Aw,A.borderRightStyle),this.borderBottomStyle=Te(e,tw,A.borderBottomStyle),this.borderLeftStyle=Te(e,rw,A.borderLeftStyle),this.borderTopWidth=Te(e,iw,A.borderTopWidth),this.borderRightWidth=Te(e,nw,A.borderRightWidth),this.borderBottomWidth=Te(e,sw,A.borderBottomWidth),this.borderLeftWidth=Te(e,ow,A.borderLeftWidth),this.boxShadow=Te(e,eC,A.boxShadow),this.color=Te(e,lw,A.color),this.direction=Te(e,aw,A.direction),this.display=Te(e,cw,A.display),this.float=Te(e,uw,A.cssFloat),this.fontFamily=Te(e,Gw,A.fontFamily),this.fontSize=Te(e,Ww,A.fontSize),this.fontStyle=Te(e,Xw,A.fontStyle),this.fontVariant=Te(e,$w,A.fontVariant),this.fontWeight=Te(e,Rw,A.fontWeight),this.letterSpacing=Te(e,dw,A.letterSpacing),this.lineBreak=Te(e,fw,A.lineBreak),this.lineHeight=Te(e,pw,A.lineHeight),this.listStyleImage=Te(e,gw,A.listStyleImage),this.listStylePosition=Te(e,mw,A.listStylePosition),this.listStyleType=Te(e,No,A.listStyleType),this.marginTop=Te(e,Bw,A.marginTop),this.marginRight=Te(e,ww,A.marginRight),this.marginBottom=Te(e,Cw,A.marginBottom),this.marginLeft=Te(e,vw,A.marginLeft),this.opacity=Te(e,Pw,A.opacity);var n=Te(e,yw,A.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Te(e,bw,A.overflowWrap),this.paddingTop=Te(e,Tw,A.paddingTop),this.paddingRight=Te(e,Qw,A.paddingRight),this.paddingBottom=Te(e,xw,A.paddingBottom),this.paddingLeft=Te(e,Fw,A.paddingLeft),this.paintOrder=Te(e,AC,A.paintOrder),this.position=Te(e,Ew,A.position),this.textAlign=Te(e,Uw,A.textAlign),this.textDecorationColor=Te(e,Vw,(t=A.textDecorationColor)!==null&&t!==void 0?t:A.color),this.textDecorationLine=Te(e,zw,(i=A.textDecorationLine)!==null&&i!==void 0?i:A.textDecoration),this.textShadow=Te(e,Sw,A.textShadow),this.textTransform=Te(e,Hw,A.textTransform),this.transform=Te(e,Lw,A.transform),this.transformOrigin=Te(e,kw,A.transformOrigin),this.visibility=Te(e,Ow,A.visibility),this.webkitTextStrokeColor=Te(e,tC,A.webkitTextStrokeColor),this.webkitTextStrokeWidth=Te(e,rC,A.webkitTextStrokeWidth),this.wordBreak=Te(e,Nw,A.wordBreak),this.zIndex=Te(e,Kw,A.zIndex)}return r.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},r.prototype.isTransparent=function(){return Et(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 mA(this.display,4)||mA(this.display,33554432)||mA(this.display,268435456)||mA(this.display,536870912)||mA(this.display,67108864)||mA(this.display,134217728)},r})(),nC=(function(){function r(e,A){this.content=Te(e,Jw,A.content),this.quotes=Te(e,jw,A.quotes)}return r})(),iu=(function(){function r(e,A){this.counterIncrement=Te(e,Zw,A.counterIncrement),this.counterReset=Te(e,qw,A.counterReset)}return r})(),Te=function(r,e,A){var t=new Sh,i=A!==null&&typeof A<"u"?A.toString():e.initialValue;t.write(i);var n=new Hh(t.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(r,AA(s)?s.value:e.initialValue);case 0:return e.parse(r,n.parseComponentValue());case 1:return e.parse(r,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return Qn.parse(r,n.parseComponentValue());case"color":return Ut.parse(r,n.parseComponentValue());case"image":return Oo.parse(r,n.parseComponentValue());case"length":var o=n.parseComponentValue();return xt(o)?o:vA;case"length-percentage":var l=n.parseComponentValue();return gA(l)?l:vA;case"time":return tu.parse(r,n.parseComponentValue())}break}},sC="data-html2canvas-debug",oC=function(r){var e=r.getAttribute(sC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Ko=function(r,e){var A=oC(r);return A===1||e===A},ct=(function(){function r(e,A){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Ko(A,3))debugger;this.styles=new iC(e,window.getComputedStyle(A,null)),el(A)&&(this.styles.animationDuration.some(function(t){return t>0})&&(A.style.animationDuration="0s"),this.styles.transform!==null&&(A.style.transform="none")),this.bounds=nn(this.context,A),Ko(A,4)&&(this.flags|=16)}return r})(),lC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",nu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",si=typeof Uint8Array>"u"?[]:new Uint8Array(256),Dn=0;Dn<nu.length;Dn++)si[nu.charCodeAt(Dn)]=Dn;for(var aC=function(r){var e=r.length*.75,A=r.length,t,i=0,n,s,o,l;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var a=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),c=Array.isArray(a)?a:new Uint8Array(a);for(t=0;t<A;t+=4)n=si[r.charCodeAt(t)],s=si[r.charCodeAt(t+1)],o=si[r.charCodeAt(t+2)],l=si[r.charCodeAt(t+3)],c[i++]=n<<2|s>>4,c[i++]=(s&15)<<4|o>>2,c[i++]=(o&3)<<6|l&63;return a},cC=function(r){for(var e=r.length,A=[],t=0;t<e;t+=2)A.push(r[t+1]<<8|r[t]);return A},hC=function(r){for(var e=r.length,A=[],t=0;t<e;t+=4)A.push(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]);return A},Jt=5,Po=11,Vo=2,uC=Po-Jt,su=65536>>Jt,dC=1<<Jt,zo=dC-1,fC=1024>>Jt,pC=su+fC,gC=pC,mC=32,BC=gC+mC,wC=65536>>Po,CC=1<<uC,vC=CC-1,ou=function(r,e,A){return r.slice?r.slice(e,A):new Uint16Array(Array.prototype.slice.call(r,e,A))},yC=function(r,e,A){return r.slice?r.slice(e,A):new Uint32Array(Array.prototype.slice.call(r,e,A))},bC=function(r,e){var A=aC(r),t=Array.isArray(A)?hC(A):new Uint32Array(A),i=Array.isArray(A)?cC(A):new Uint16Array(A),n=24,s=ou(i,n/2,t[4]/2),o=t[5]===2?ou(i,(n+t[4])/2):yC(t,Math.ceil((n+t[4])/4));return new TC(t[0],t[1],t[2],t[3],s,o)},TC=(function(){function r(e,A,t,i,n,s){this.initialValue=e,this.errorValue=A,this.highStart=t,this.highValueIndex=i,this.index=n,this.data=s}return r.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=this.index[e>>Jt],A=(A<<Vo)+(e&zo),this.data[A];if(e<=65535)return A=this.index[su+(e-55296>>Jt)],A=(A<<Vo)+(e&zo),this.data[A];if(e<this.highStart)return A=BC-wC+(e>>Po),A=this.index[A],A+=e>>Jt&vC,A=this.index[A],A=(A<<Vo)+(e&zo),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),lu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",QC=typeof Uint8Array>"u"?[]:new Uint8Array(256),kn=0;kn<lu.length;kn++)QC[lu.charCodeAt(kn)]=kn;var xC=1,Go=2,Wo=3,au=4,cu=5,FC=7,hu=8,Ro=9,$o=10,uu=11,du=12,fu=13,pu=14,Xo=15,UC=function(r){for(var e=[],A=0,t=r.length;A<t;){var i=r.charCodeAt(A++);if(i>=55296&&i<=56319&&A<t){var n=r.charCodeAt(A++);(n&64512)===56320?e.push(((i&1023)<<10)+(n&1023)+65536):(e.push(i),A--)}else e.push(i)}return e},EC=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var A=r.length;if(!A)return"";for(var t=[],i=-1,n="";++i<A;){var s=r[i];s<=65535?t.push(s):(s-=65536,t.push((s>>10)+55296,s%1024+56320)),(i+1===A||t.length>16384)&&(n+=String.fromCharCode.apply(String,t),t.length=0)}return n},SC=bC(lC),RA="×",Jo="÷",HC=function(r){return SC.get(r)},LC=function(r,e,A){var t=A-2,i=e[t],n=e[A-1],s=e[A];if(n===Go&&s===Wo)return RA;if(n===Go||n===Wo||n===au||s===Go||s===Wo||s===au)return Jo;if(n===hu&&[hu,Ro,uu,du].indexOf(s)!==-1||(n===uu||n===Ro)&&(s===Ro||s===$o)||(n===du||n===$o)&&s===$o||s===fu||s===cu||s===FC||n===xC)return RA;if(n===fu&&s===pu){for(;i===cu;)i=e[--t];if(i===pu)return RA}if(n===Xo&&s===Xo){for(var o=0;i===Xo;)o++,i=e[--t];if(o%2===0)return RA}return Jo},MC=function(r){var e=UC(r),A=e.length,t=0,i=0,n=e.map(HC);return{next:function(){if(t>=A)return{done:!0,value:null};for(var s=RA;t<A&&(s=LC(e,n,++t))===RA;);if(s!==RA||t===A){var o=EC.apply(null,e.slice(i,t));return i=t,{value:o,done:!1}}return{done:!0,value:null}}}},IC=function(r){for(var e=MC(r),A=[],t;!(t=e.next()).done;)t.value&&A.push(t.value.slice());return A},_C=function(r){var e=123;if(r.createRange){var A=r.createRange();if(A.getBoundingClientRect){var t=r.createElement("boundtest");t.style.height=e+"px",t.style.display="block",r.body.appendChild(t),A.selectNode(t);var i=A.getBoundingClientRect(),n=Math.round(i.height);if(r.body.removeChild(t),n===e)return!0}}return!1},DC=function(r){var e=r.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",r.body.appendChild(e);var A=r.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var t=e.firstChild,i=sn(t.data).map(function(l){return dA(l)}),n=0,s={},o=i.every(function(l,a){A.setStart(t,n),A.setEnd(t,n+l.length);var c=A.getBoundingClientRect();n+=l.length;var u=c.x>s.x||c.y>s.y;return s=c,a===0?!0:u});return r.body.removeChild(e),o},kC=function(){return typeof new Image().crossOrigin<"u"},OC=function(){return typeof new XMLHttpRequest().responseType=="string"},NC=function(r){var e=new Image,A=r.createElement("canvas"),t=A.getContext("2d");if(!t)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{t.drawImage(e,0,0),A.toDataURL()}catch{return!1}return!0},gu=function(r){return r[0]===0&&r[1]===255&&r[2]===0&&r[3]===255},KC=function(r){var e=r.createElement("canvas"),A=100;e.width=A,e.height=A;var t=e.getContext("2d");if(!t)return Promise.reject(!1);t.fillStyle="rgb(0, 255, 0)",t.fillRect(0,0,A,A);var i=new Image,n=e.toDataURL();i.src=n;var s=Zo(A,A,0,0,i);return t.fillStyle="red",t.fillRect(0,0,A,A),mu(s).then(function(o){t.drawImage(o,0,0);var l=t.getImageData(0,0,A,A).data;t.fillStyle="red",t.fillRect(0,0,A,A);var a=r.createElement("div");return a.style.backgroundImage="url("+n+")",a.style.height=A+"px",gu(l)?mu(Zo(A,A,0,0,a)):Promise.reject(!1)}).then(function(o){return t.drawImage(o,0,0),gu(t.getImageData(0,0,A,A).data)}).catch(function(){return!1})},Zo=function(r,e,A,t,i){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",r.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",A.toString()),o.setAttributeNS(null,"y",t.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(i),s},mu=function(r){return new Promise(function(e,A){var t=new Image;t.onload=function(){return e(t)},t.onerror=A,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},yA={get SUPPORT_RANGE_BOUNDS(){var r=_C(document);return Object.defineProperty(yA,"SUPPORT_RANGE_BOUNDS",{value:r}),r},get SUPPORT_WORD_BREAKING(){var r=yA.SUPPORT_RANGE_BOUNDS&&DC(document);return Object.defineProperty(yA,"SUPPORT_WORD_BREAKING",{value:r}),r},get SUPPORT_SVG_DRAWING(){var r=NC(document);return Object.defineProperty(yA,"SUPPORT_SVG_DRAWING",{value:r}),r},get SUPPORT_FOREIGNOBJECT_DRAWING(){var r=typeof Array.from=="function"&&typeof window.fetch=="function"?KC(document):Promise.resolve(!1);return Object.defineProperty(yA,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:r}),r},get SUPPORT_CORS_IMAGES(){var r=kC();return Object.defineProperty(yA,"SUPPORT_CORS_IMAGES",{value:r}),r},get SUPPORT_RESPONSE_TYPE(){var r=OC();return Object.defineProperty(yA,"SUPPORT_RESPONSE_TYPE",{value:r}),r},get SUPPORT_CORS_XHR(){var r="withCredentials"in new XMLHttpRequest;return Object.defineProperty(yA,"SUPPORT_CORS_XHR",{value:r}),r},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var r=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(yA,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:r}),r}},oi=(function(){function r(e,A){this.text=e,this.bounds=A}return r})(),PC=function(r,e,A,t){var i=GC(e,A),n=[],s=0;return i.forEach(function(o){if(A.textDecorationLine.length||o.trim().length>0)if(yA.SUPPORT_RANGE_BOUNDS){var l=Bu(t,s,o.length).getClientRects();if(l.length>1){var a=qo(o),c=0;a.forEach(function(m){n.push(new oi(m,mt.fromDOMRectList(r,Bu(t,c+s,m.length).getClientRects()))),c+=m.length})}else n.push(new oi(o,mt.fromDOMRectList(r,l)))}else{var u=t.splitText(o.length);n.push(new oi(o,VC(r,t))),t=u}else yA.SUPPORT_RANGE_BOUNDS||(t=t.splitText(o.length));s+=o.length}),n},VC=function(r,e){var A=e.ownerDocument;if(A){var t=A.createElement("html2canvaswrapper");t.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(t,e);var n=nn(r,t);return t.firstChild&&i.replaceChild(t.firstChild,t),n}}return mt.EMPTY},Bu=function(r,e,A){var t=r.ownerDocument;if(!t)throw new Error("Node has no owner document");var i=t.createRange();return i.setStart(r,e),i.setEnd(r,e+A),i},qo=function(r){if(yA.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(r)).map(function(A){return A.segment})}return IC(r)},zC=function(r,e){if(yA.SUPPORT_NATIVE_TEXT_SEGMENTATION){var A=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(A.segment(r)).map(function(t){return t.segment})}return RC(r,e)},GC=function(r,e){return e.letterSpacing!==0?qo(r):zC(r,e)},WC=[32,160,4961,65792,65793,4153,4241],RC=function(r,e){for(var A=wm(r,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),t=[],i,n=function(){if(i.value){var s=i.value.slice(),o=sn(s),l="";o.forEach(function(a){WC.indexOf(a)===-1?l+=dA(a):(l.length&&t.push(l),t.push(dA(a)),l="")}),l.length&&t.push(l)}};!(i=A.next()).done;)n();return t},$C=(function(){function r(e,A,t){this.text=XC(A.data,t.textTransform),this.textBounds=PC(e,this.text,t,A)}return r})(),XC=function(r,e){switch(e){case 1:return r.toLowerCase();case 3:return r.replace(JC,ZC);case 2:return r.toUpperCase();default:return r}},JC=/(^|\s|:|-|\(|\))([a-z])/g,ZC=function(r,e,A){return r.length>0?e+A.toUpperCase():r},wu=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.src=t.currentSrc||t.src,i.intrinsicWidth=t.naturalWidth,i.intrinsicHeight=t.naturalHeight,i.context.cache.addImage(i.src),i}return e})(ct),Cu=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.canvas=t,i.intrinsicWidth=t.width,i.intrinsicHeight=t.height,i}return e})(ct),vu=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this,n=new XMLSerializer,s=nn(A,t);return t.setAttribute("width",s.width+"px"),t.setAttribute("height",s.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(t)),i.intrinsicWidth=t.width.baseVal.value,i.intrinsicHeight=t.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e})(ct),yu=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.value=t.value,i}return e})(ct),Yo=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.start=t.start,i.reversed=typeof t.reversed=="boolean"&&t.reversed===!0,i}return e})(ct),qC=[{type:15,flags:0,unit:"px",number:3}],YC=[{type:16,flags:0,number:50}],jC=function(r){return r.width>r.height?new mt(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width<r.height?new mt(r.left,r.top+(r.height-r.width)/2,r.width,r.width):r},e2=function(r){var e=r.type===A2?new Array(r.value.length+1).join("•"):r.value;return e.length===0?r.placeholder||"":e},On="checkbox",Nn="radio",A2="password",bu=707406591,jo=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;switch(i.type=t.type.toLowerCase(),i.checked=t.checked,i.value=e2(t),(i.type===On||i.type===Nn)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=jC(i.bounds)),i.type){case On:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=qC;break;case Nn:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=YC;break}return i}return e})(ct),Tu=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this,n=t.options[t.selectedIndex||0];return i.value=n&&n.text||"",i}return e})(ct),Qu=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.value=t.value,i}return e})(ct),xu=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;i.src=t.src,i.width=parseInt(t.width,10)||0,i.height=parseInt(t.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(t.contentWindow&&t.contentWindow.document&&t.contentWindow.document.documentElement){i.tree=Uu(A,t.contentWindow.document.documentElement);var n=t.contentWindow.document.documentElement?ii(A,getComputedStyle(t.contentWindow.document.documentElement).backgroundColor):wt.TRANSPARENT,s=t.contentWindow.document.body?ii(A,getComputedStyle(t.contentWindow.document.body).backgroundColor):wt.TRANSPARENT;i.backgroundColor=Et(n)?Et(s)?i.styles.backgroundColor:s:n}}catch{}return i}return e})(ct),t2=["OL","UL","MENU"],Kn=function(r,e,A,t){for(var i=e.firstChild,n=void 0;i;i=n)if(n=i.nextSibling,Eu(i)&&i.data.trim().length>0)A.textNodes.push(new $C(r,i,A.styles));else if(pr(i))if(_u(i)&&i.assignedNodes)i.assignedNodes().forEach(function(o){return Kn(r,o,A,t)});else{var s=Fu(r,i);s.styles.isVisible()&&(r2(i,s,t)?s.flags|=4:i2(s.styles)&&(s.flags|=2),t2.indexOf(i.tagName)!==-1&&(s.flags|=8),A.elements.push(s),i.slot,i.shadowRoot?Kn(r,i.shadowRoot,s,t):!Vn(i)&&!Su(i)&&!zn(i)&&Kn(r,i,s,t))}},Fu=function(r,e){return tl(e)?new wu(r,e):Hu(e)?new Cu(r,e):Su(e)?new vu(r,e):n2(e)?new yu(r,e):s2(e)?new Yo(r,e):o2(e)?new jo(r,e):zn(e)?new Tu(r,e):Vn(e)?new Qu(r,e):Mu(e)?new xu(r,e):new ct(r,e)},Uu=function(r,e){var A=Fu(r,e);return A.flags|=4,Kn(r,e,A,A),A},r2=function(r,e,A){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Al(r)&&A.styles.isTransparent()},i2=function(r){return r.isPositioned()||r.isFloating()},Eu=function(r){return r.nodeType===Node.TEXT_NODE},pr=function(r){return r.nodeType===Node.ELEMENT_NODE},el=function(r){return pr(r)&&typeof r.style<"u"&&!Pn(r)},Pn=function(r){return typeof r.className=="object"},n2=function(r){return r.tagName==="LI"},s2=function(r){return r.tagName==="OL"},o2=function(r){return r.tagName==="INPUT"},l2=function(r){return r.tagName==="HTML"},Su=function(r){return r.tagName==="svg"},Al=function(r){return r.tagName==="BODY"},Hu=function(r){return r.tagName==="CANVAS"},Lu=function(r){return r.tagName==="VIDEO"},tl=function(r){return r.tagName==="IMG"},Mu=function(r){return r.tagName==="IFRAME"},Iu=function(r){return r.tagName==="STYLE"},a2=function(r){return r.tagName==="SCRIPT"},Vn=function(r){return r.tagName==="TEXTAREA"},zn=function(r){return r.tagName==="SELECT"},_u=function(r){return r.tagName==="SLOT"},Du=function(r){return r.tagName.indexOf("-")>0},c2=(function(){function r(){this.counters={}}return r.prototype.getCounterValue=function(e){var A=this.counters[e];return A&&A.length?A[A.length-1]:1},r.prototype.getCounterValues=function(e){var A=this.counters[e];return A||[]},r.prototype.pop=function(e){var A=this;e.forEach(function(t){return A.counters[t].pop()})},r.prototype.parse=function(e){var A=this,t=e.counterIncrement,i=e.counterReset,n=!0;t!==null&&t.forEach(function(o){var l=A.counters[o.counter];l&&o.increment!==0&&(n=!1,l.length||l.push(1),l[Math.max(0,l.length-1)]+=o.increment)});var s=[];return n&&i.forEach(function(o){var l=A.counters[o.counter];s.push(o.counter),l||(l=A.counters[o.counter]=[]),l.push(o.reset)}),s},r})(),ku={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"]},Ou={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},h2={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},u2={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},gr=function(r,e,A,t,i,n){return r<e||r>A?ai(r,i,n.length>0):t.integers.reduce(function(s,o,l){for(;r>=o;)r-=o,s+=t.values[l];return s},"")+n},Nu=function(r,e,A,t){var i="";do A||r--,i=t(r)+i,r/=e;while(r*e>=e);return i},fA=function(r,e,A,t,i){var n=A-e+1;return(r<0?"-":"")+(Nu(Math.abs(r),n,t,function(s){return dA(Math.floor(s%n)+e)})+i)},Zt=function(r,e,A){A===void 0&&(A=". ");var t=e.length;return Nu(Math.abs(r),t,!1,function(i){return e[Math.floor(i%t)]})+A},mr=1,Ht=2,Lt=4,li=8,Ct=function(r,e,A,t,i,n){if(r<-9999||r>9999)return ai(r,4,i.length>0);var s=Math.abs(r),o=i;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var a=s%10;a===0&&mA(n,mr)&&o!==""?o=e[a]+o:a>1||a===1&&l===0||a===1&&l===1&&mA(n,Ht)||a===1&&l===1&&mA(n,Lt)&&r>100||a===1&&l>1&&mA(n,li)?o=e[a]+(l>0?A[l-1]:"")+o:a===1&&l>0&&(o=A[l-1]+o),s=Math.floor(s/10)}return(r<0?t:"")+o},Ku="十百千萬",Pu="拾佰仟萬",Vu="マイナス",rl="마이너스",ai=function(r,e,A){var t=A?". ":"",i=A?"、":"",n=A?", ":"",s=A?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=fA(r,48,57,!0,t);return o.length<4?"0"+o:o;case 4:return Zt(r,"〇一二三四五六七八九",i);case 6:return gr(r,1,3999,ku,3,t).toLowerCase();case 7:return gr(r,1,3999,ku,3,t);case 8:return fA(r,945,969,!1,t);case 9:return fA(r,97,122,!1,t);case 10:return fA(r,65,90,!1,t);case 11:return fA(r,1632,1641,!0,t);case 12:case 49:return gr(r,1,9999,Ou,3,t);case 35:return gr(r,1,9999,Ou,3,t).toLowerCase();case 13:return fA(r,2534,2543,!0,t);case 14:case 30:return fA(r,6112,6121,!0,t);case 15:return Zt(r,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return Zt(r,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return Ct(r,"零一二三四五六七八九",Ku,"負",i,Ht|Lt|li);case 47:return Ct(r,"零壹貳參肆伍陸柒捌玖",Pu,"負",i,mr|Ht|Lt|li);case 42:return Ct(r,"零一二三四五六七八九",Ku,"负",i,Ht|Lt|li);case 41:return Ct(r,"零壹贰叁肆伍陆柒捌玖",Pu,"负",i,mr|Ht|Lt|li);case 26:return Ct(r,"〇一二三四五六七八九","十百千万",Vu,i,0);case 25:return Ct(r,"零壱弐参四伍六七八九","拾百千万",Vu,i,mr|Ht|Lt);case 31:return Ct(r,"영일이삼사오육칠팔구","십백천만",rl,n,mr|Ht|Lt);case 33:return Ct(r,"零一二三四五六七八九","十百千萬",rl,n,0);case 32:return Ct(r,"零壹貳參四五六七八九","拾百千",rl,n,mr|Ht|Lt);case 18:return fA(r,2406,2415,!0,t);case 20:return gr(r,1,19999,u2,3,t);case 21:return fA(r,2790,2799,!0,t);case 22:return fA(r,2662,2671,!0,t);case 22:return gr(r,1,10999,h2,3,t);case 23:return Zt(r,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Zt(r,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return fA(r,3302,3311,!0,t);case 28:return Zt(r,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return Zt(r,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return fA(r,3792,3801,!0,t);case 37:return fA(r,6160,6169,!0,t);case 38:return fA(r,4160,4169,!0,t);case 39:return fA(r,2918,2927,!0,t);case 40:return fA(r,1776,1785,!0,t);case 43:return fA(r,3046,3055,!0,t);case 44:return fA(r,3174,3183,!0,t);case 45:return fA(r,3664,3673,!0,t);case 46:return fA(r,3872,3881,!0,t);default:return fA(r,48,57,!0,t)}},zu="data-html2canvas-ignore",Gu=(function(){function r(e,A,t){if(this.context=e,this.options=t,this.scrolledElements=[],this.referenceElement=A,this.counters=new c2,this.quoteDepth=0,!A.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(A.ownerDocument.documentElement,!1)}return r.prototype.toIFrame=function(e,A){var t=this,i=d2(e,A);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=i.contentWindow,l=o.document,a=g2(i).then(function(){return SA(t,void 0,void 0,function(){var c,u;return FA(this,function(m){switch(m.label){case 0:return this.scrolledElements.forEach(C2),o&&(o.scrollTo(A.left,A.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==A.top||o.scrollX!==A.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-A.left,o.scrollY-A.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")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:m.sent(),m.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,p2(l)]:[3,4];case 3:m.sent(),m.label=4;case 4:return typeof c=="function"?[2,Promise.resolve().then(function(){return c(l,u)}).then(function(){return i})]:[2,i]}})})});return l.open(),l.write(B2(document.doctype)+"<html></html>"),w2(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),a},r.prototype.createElementClone=function(e){if(Ko(e,2))debugger;if(Hu(e))return this.createCanvasClone(e);if(Lu(e))return this.createVideoClone(e);if(Iu(e))return this.createStyleClone(e);var A=e.cloneNode(!1);return tl(A)&&(tl(e)&&e.currentSrc&&e.currentSrc!==e.src&&(A.src=e.currentSrc,A.srcset=""),A.loading==="lazy"&&(A.loading="eager")),Du(A)?this.createCustomElementClone(A):A},r.prototype.createCustomElementClone=function(e){var A=document.createElement("html2canvascustomelement");return il(e.style,A),A},r.prototype.createStyleClone=function(e){try{var A=e.sheet;if(A&&A.cssRules){var t=[].slice.call(A.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),i=e.cloneNode(!1);return i.textContent=t,i}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},r.prototype.createCanvasClone=function(e){var A;if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement("img");try{return t.src=e.toDataURL(),t}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var n=e.getContext("2d"),s=i.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(A=e.getContext("webgl2"))!==null&&A!==void 0?A:e.getContext("webgl");if(o){var l=o.getContextAttributes();l?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},r.prototype.createVideoClone=function(e){var A=e.ownerDocument.createElement("canvas");A.width=e.offsetWidth,A.height=e.offsetHeight;var t=A.getContext("2d");try{return t&&(t.drawImage(e,0,0,A.width,A.height),this.options.allowTaint||t.getImageData(0,0,A.width,A.height)),A}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},r.prototype.appendChildNode=function(e,A,t){(!pr(A)||!a2(A)&&!A.hasAttribute(zu)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(A)))&&(!this.options.copyStyles||!pr(A)||!Iu(A))&&e.appendChild(this.cloneNode(A,t))},r.prototype.cloneChildNodes=function(e,A,t){for(var i=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(pr(n)&&_u(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return i.appendChildNode(A,o,t)})}else this.appendChildNode(A,n,t)},r.prototype.cloneNode=function(e,A){if(Eu(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var t=e.ownerDocument.defaultView;if(t&&pr(e)&&(el(e)||Pn(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var n=t.getComputedStyle(e),s=t.getComputedStyle(e,":before"),o=t.getComputedStyle(e,":after");this.referenceElement===e&&el(i)&&(this.clonedReferenceElement=i),Al(i)&&b2(i);var l=this.counters.parse(new iu(this.context,n)),a=this.resolvePseudoContent(e,i,s,ci.BEFORE);Du(e)&&(A=!0),Lu(e)||this.cloneChildNodes(e,i,A),a&&i.insertBefore(a,i.firstChild);var c=this.resolvePseudoContent(e,i,o,ci.AFTER);return c&&i.appendChild(c),this.counters.pop(l),(n&&(this.options.copyStyles||Pn(e))&&!Mu(e)||A)&&il(n,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(Vn(e)||zn(e))&&(Vn(i)||zn(i))&&(i.value=e.value),i}return e.cloneNode(!1)},r.prototype.resolvePseudoContent=function(e,A,t,i){var n=this;if(t){var s=t.content,o=A.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||t.display==="none")){this.counters.parse(new iu(this.context,t));var l=new nC(this.context,t),a=o.createElement("html2canvaspseudoelement");il(t,a),l.content.forEach(function(u){if(u.type===0)a.appendChild(o.createTextNode(u.value));else if(u.type===22){var m=o.createElement("img");m.src=u.value,m.style.opacity="1",a.appendChild(m)}else if(u.type===18){if(u.name==="attr"){var y=u.values.filter(AA);y.length&&a.appendChild(o.createTextNode(e.getAttribute(y[0].value)||""))}else if(u.name==="counter"){var B=u.values.filter(dr),p=B[0],Q=B[1];if(p&&AA(p)){var D=n.counters.getCounterValue(p.value),F=Q&&AA(Q)?No.parse(n.context,Q.value):3;a.appendChild(o.createTextNode(ai(D,F,!1)))}}else if(u.name==="counters"){var _=u.values.filter(dr),p=_[0],L=_[1],Q=_[2];if(p&&AA(p)){var k=n.counters.getCounterValues(p.value),V=Q&&AA(Q)?No.parse(n.context,Q.value):3,Z=L&&L.type===0?L.value:"",$=k.map(function(X){return ai(X,V,!1)}).join(Z);a.appendChild(o.createTextNode($))}}}else if(u.type===20)switch(u.value){case"open-quote":a.appendChild(o.createTextNode(ru(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":a.appendChild(o.createTextNode(ru(l.quotes,--n.quoteDepth,!1)));break;default:a.appendChild(o.createTextNode(u.value))}}),a.className=nl+" "+sl;var c=i===ci.BEFORE?" "+nl:" "+sl;return Pn(A)?A.className.baseValue+=c:A.className+=c,a}}},r.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},r})(),ci;(function(r){r[r.BEFORE=0]="BEFORE",r[r.AFTER=1]="AFTER"})(ci||(ci={}));var d2=function(r,e){var A=r.createElement("iframe");return A.className="html2canvas-container",A.style.visibility="hidden",A.style.position="fixed",A.style.left="-10000px",A.style.top="0px",A.style.border="0",A.width=e.width.toString(),A.height=e.height.toString(),A.scrolling="no",A.setAttribute(zu,"true"),r.body.appendChild(A),A},f2=function(r){return new Promise(function(e){if(r.complete){e();return}if(!r.src){e();return}r.onload=e,r.onerror=e})},p2=function(r){return Promise.all([].slice.call(r.images,0).map(f2))},g2=function(r){return new Promise(function(e,A){var t=r.contentWindow;if(!t)return A("No window assigned for iframe");var i=t.document;t.onload=r.onload=function(){t.onload=r.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(n),e(r))},50)}})},m2=["all","d","content"],il=function(r,e){for(var A=r.length-1;A>=0;A--){var t=r.item(A);m2.indexOf(t)===-1&&e.style.setProperty(t,r.getPropertyValue(t))}return e},B2=function(r){var e="";return r&&(e+="<!DOCTYPE ",r.name&&(e+=r.name),r.internalSubset&&(e+=r.internalSubset),r.publicId&&(e+='"'+r.publicId+'"'),r.systemId&&(e+='"'+r.systemId+'"'),e+=">"),e},w2=function(r,e,A){r&&r.defaultView&&(e!==r.defaultView.pageXOffset||A!==r.defaultView.pageYOffset)&&r.defaultView.scrollTo(e,A)},C2=function(r){var e=r[0],A=r[1],t=r[2];e.scrollLeft=A,e.scrollTop=t},v2=":before",y2=":after",nl="___html2canvas___pseudoelement_before",sl="___html2canvas___pseudoelement_after",Wu=`{
1
+ (function(ze,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):(ze=typeof globalThis<"u"?globalThis:ze||self,h(ze.ChartSDK={},ze.jsxRuntime,ze.React))})(this,(function(ze,h,J){"use strict";var is=typeof document<"u"?document.currentScript:null;function sA(r){var e=r.width,A=r.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(A<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:A}}function Pt(r,e){return r.width===e.width&&r.height===e.height}var Ud=(function(){function r(e){var A=this;this._resolutionListener=function(){return A._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,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(e){var A=this,t={next:e};return this._observers.push(t),{unsubscribe:function(){A._observers=A._observers.filter(function(i){return i!==t})}}},r.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"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 e=this;this._observers.forEach(function(A){return A.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},r})();function Ed(r){return new Ud(r)}var Sd=(function(){function r(e,A,t){var i;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=sA({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=A??(function(n){return n}),this._allowResizeObserver=(i=t?.allowResizeObserver)!==null&&i!==void 0?i:!0,this._chooseAndInitObserver()}return r.prototype.dispose=function(){var e,A;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(A=this._devicePixelRatioObservable)===null||A===void 0||A.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 sA({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),r.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=sA(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},r.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},r.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(A){return A!==e})},Object.defineProperty(r.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),r.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},r.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(A){return A!==e})},r.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},r.prototype._resizeBitmap=function(e){var A=this.bitmapSize;Pt(A,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(A,e))},r.prototype._emitBitmapSizeChanged=function(e,A){var t=this;this._bitmapSizeChangedListeners.forEach(function(i){return i.call(t,e,A)})},r.prototype._suggestNewBitmapSize=function(e){var A=this._suggestedBitmapSize,t=sA(this._transformBitmapSize(e,this._canvasElementClientSize)),i=Pt(this.bitmapSize,t)?null:t;A===null&&i===null||A!==null&&i!==null&&Pt(A,i)||(this._suggestedBitmapSize=i,this._emitSuggestedBitmapSizeChanged(A,i))},r.prototype._emitSuggestedBitmapSizeChanged=function(e,A){var t=this;this._suggestedBitmapSizeChangedListeners.forEach(function(i){return i.call(t,e,A)})},r.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}Ld().then(function(A){return A?e._initResizeObserver():e._initDevicePixelRatioObservable()})},r.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var A=ya(this._canvasElement);if(A===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Ed(A),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},r.prototype._invalidateBitmapSize=function(){var e,A;if(this._canvasElement!==null){var t=ya(this._canvasElement);if(t!==null){var i=(A=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&A!==void 0?A:t.devicePixelRatio,n=this._canvasElement.getClientRects(),s=n[0]!==void 0?Md(n[0],i):sA({width:this._canvasElementClientSize.width*i,height:this._canvasElementClientSize.height*i});this._suggestNewBitmapSize(s)}}},r.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(A){var t=A.find(function(s){return s.target===e._canvasElement});if(!(!t||!t.devicePixelContentBoxSize||!t.devicePixelContentBoxSize[0])){var i=t.devicePixelContentBoxSize[0],n=sA({width:i.inlineSize,height:i.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},r})();function Hd(r,e){return new Sd(r,e.transform,e.options)}function ya(r){return r.ownerDocument.defaultView}function Ld(){return new Promise(function(r){var e=new ResizeObserver(function(A){r(A.every(function(t){return"devicePixelContentBoxSize"in t})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function Md(r,e){return sA({width:Math.round(r.left*e+r.width*e)-Math.round(r.left*e),height:Math.round(r.top*e+r.height*e)-Math.round(r.top*e)})}var Id=(function(){function r(e,A,t){if(A.width===0||A.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=A,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=e}return r.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},r.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({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 Vt(r,e){var A=r.canvasElementClientSize;if(A.width===0||A.height===0)return null;var t=r.bitmapSize;if(t.width===0||t.height===0)return null;var i=r.canvasElement.getContext("2d",e);return i===null?null:new Id(i,A,t)}const _d={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Dd={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},kd={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Od={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},Nd={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},Kd={color:"#26a69a",base:0},ba={color:"#2196f3"},Ta={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 Qa,xa;function zt(r,e){const A={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]}[e];r.setLineDash(A)}function Fa(r,e,A,t){r.beginPath();const i=r.lineWidth%2?.5:0;r.moveTo(A,e+i),r.lineTo(t,e+i),r.stroke()}function Ft(r,e){if(!r)throw new Error("Assertion failed"+(e?": "+e:""))}function LA(r){if(r===void 0)throw new Error("Value is undefined");return r}function ue(r){if(r===null)throw new Error("Value is null");return r}function rr(r){return ue(LA(r))}(function(r){r[r.Simple=0]="Simple",r[r.WithSteps=1]="WithSteps",r[r.Curved=2]="Curved"})(Qa||(Qa={})),(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"})(xa||(xa={}));const Ua={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 $A(r){return r<0?0:r>255?255:Math.round(r)||0}function Ea(r){return r<=0||r>1?Math.min(Math.max(r,0),1):Math.round(1e4*r)/1e4}const Pd=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Vd=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,zd=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Gd=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function xr(r){(r=r.toLowerCase())in Ua&&(r=Ua[r]);{const e=Gd.exec(r)||zd.exec(r);if(e)return[$A(parseInt(e[1],10)),$A(parseInt(e[2],10)),$A(parseInt(e[3],10)),Ea(e.length<5?1:parseFloat(e[4]))]}{const e=Vd.exec(r);if(e)return[$A(parseInt(e[1],16)),$A(parseInt(e[2],16)),$A(parseInt(e[3],16)),1]}{const e=Pd.exec(r);if(e)return[$A(17*parseInt(e[1],16)),$A(17*parseInt(e[2],16)),$A(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${r}`)}function Sa(r){return .199*r[0]+.687*r[1]+.114*r[2]}function Ci(r){const e=xr(r);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Sa(e)>160?"black":"white"}}class uA{constructor(){this.h=[]}l(e,A,t){const i={o:e,_:A,u:t===!0};this.h.push(i)}v(e){const A=this.h.findIndex((t=>e===t.o));A>-1&&this.h.splice(A,1)}p(e){this.h=this.h.filter((A=>A._!==e))}m(e,A,t){const i=[...this.h];this.h=this.h.filter((n=>!n.u)),i.forEach((n=>n.o(e,A,t)))}M(){return this.h.length>0}S(){this.h=[]}}function et(r,...e){for(const A of e)for(const t in A)A[t]!==void 0&&Object.prototype.hasOwnProperty.call(A,t)&&!["__proto__","constructor","prototype"].includes(t)&&(typeof A[t]!="object"||r[t]===void 0||Array.isArray(A[t])?r[t]=A[t]:et(r[t],A[t]));return r}function ot(r){return typeof r=="number"&&isFinite(r)}function Fr(r){return typeof r=="number"&&r%1==0}function Ur(r){return typeof r=="string"}function vi(r){return typeof r=="boolean"}function Ct(r){const e=r;if(!e||typeof e!="object")return e;let A,t,i;for(t in A=Array.isArray(e)?[]:{},e)e.hasOwnProperty(t)&&(i=e[t],A[t]=i&&typeof i=="object"?Ct(i):i);return A}function Rd(r){return r!==null}function Er(r){return r===null?void 0:r}const ns="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function ir(r,e,A){return e===void 0&&(e=ns),`${A=A!==void 0?`${A} `:""}${r}px ${e}`}class Wd{constructor(e){this.k={C:1,T:5,P:NaN,R:"",D:"",V:"",O:"",B:0,A:0,I:0,L:0,N:0},this.F=e}W(){const e=this.k,A=this.j(),t=this.H();return e.P===A&&e.D===t||(e.P=A,e.D=t,e.R=ir(A,t),e.L=2.5/12*A,e.B=e.L,e.A=A/12*e.T,e.I=A/12*e.T,e.N=0),e.V=this.$(),e.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 ss{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,A,t){this.Y.forEach((i=>{i.X(e,A,t)}))}}class At{X(e,A,t){e.useBitmapCoordinateSpace((i=>this.K(i,A,t)))}}class $d extends At{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t}){if(this.G===null||this.G.tt===null)return;const i=this.G.tt,n=this.G,s=Math.max(1,Math.floor(A))%2/2,o=a=>{e.beginPath();for(let l=i.to-1;l>=i.from;--l){const c=n.it[l],d=Math.round(c.nt*A)+s,p=c.st*t,y=a*t+s;e.moveTo(d,p),e.arc(d,p,y,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function Xd(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Jd={from:0,to:1};class Zd{constructor(e,A){this.ut=new ss,this.ct=[],this.dt=[],this.ft=!0,this.F=e,this.vt=A,this.ut.Z(this.ct)}bt(e){const A=this.F.wt();A.length!==this.ct.length&&(this.dt=A.map(Xd),this.ct=this.dt.map((t=>{const i=new $d;return i.J(t),i})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const e=this.vt.W().mode===2,A=this.F.wt(),t=this.vt.xt(),i=this.F.St();A.forEach(((n,s)=>{var o;const a=this.dt[s],l=n.kt(t);if(e||l===null||!n.yt())return void(a.tt=null);const c=ue(n.Ct());a.lt=l.Tt,a.ht=l.ht,a.et=l.Pt,a.it[0]._t=l._t,a.it[0].st=n.Dt().Rt(l._t,c.Vt),a.rt=(o=l.Ot)!==null&&o!==void 0?o:this.F.Bt(a.it[0].st/n.Dt().At()),a.it[0].ot=t,a.it[0].nt=i.It(t),a.tt=Jd}))}}let qd=class extends At{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:A,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*t),a=Math.round(this.zt.st*i);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*t),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,zt(e,this.zt.Lt.Nt),(function(l,c,d,p){l.beginPath();const y=l.lineWidth%2?.5:0;l.moveTo(c+y,d),l.lineTo(c+y,p),l.stroke()})(e,o,0,A.height)),s&&a>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*i),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,zt(e,this.zt.Et.Nt),Fa(e,a,0,A.width))}};class Yd{constructor(e){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 qd(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.yt(),A=ue(this.jt.Ht()),t=A.$t().W().crosshair,i=this.Ft;if(t.mode===2)return i.Et.yt=!1,void(i.Lt.yt=!1);i.Et.yt=e&&this.jt.Ut(A),i.Lt.yt=e&&this.jt.qt(),i.Et.et=t.horzLine.width,i.Et.Nt=t.horzLine.style,i.Et.V=t.horzLine.color,i.Lt.et=t.vertLine.width,i.Lt.Nt=t.vertLine.style,i.Lt.V=t.vertLine.color,i.nt=this.jt.Yt(),i.st=this.jt.Zt()}}function jd(r,e,A,t,i,n){r.fillRect(e+n,A,t-2*n,n),r.fillRect(e+n,A+i-n,t-2*n,n),r.fillRect(e,A,n,i),r.fillRect(e+t-n,A,n,i)}function yi(r,e,A,t,i,n){r.save(),r.globalCompositeOperation="copy",r.fillStyle=n,r.fillRect(e,A,t,i),r.restore()}function Ha(r,e,A,t,i,n){r.beginPath(),r.roundRect?r.roundRect(e,A,t,i,n):(r.lineTo(e+t-n[1],A),n[1]!==0&&r.arcTo(e+t,A,e+t,A+n[1],n[1]),r.lineTo(e+t,A+i-n[2]),n[2]!==0&&r.arcTo(e+t,A+i,e+t-n[2],A+i,n[2]),r.lineTo(e+n[3],A+i),n[3]!==0&&r.arcTo(e,A+i,e,A+i-n[3],n[3]),r.lineTo(e,A+n[0]),n[0]!==0&&r.arcTo(e,A,e+n[0],A,n[0]))}function La(r,e,A,t,i,n,s=0,o=[0,0,0,0],a=""){if(r.save(),!s||!a||a===n)return Ha(r,e,A,t,i,o),r.fillStyle=n,r.fill(),void r.restore();const l=s/2;var c;Ha(r,e+l,A+l,t-s,i-s,(c=-l,o.map((d=>d===0?d:d+c)))),n!=="transparent"&&(r.fillStyle=n,r.fill()),a!=="transparent"&&(r.lineWidth=s,r.strokeStyle=a,r.closePath(),r.stroke()),r.restore()}function Ma(r,e,A,t,i,n,s){r.save(),r.globalCompositeOperation="copy";const o=r.createLinearGradient(0,0,0,i);o.addColorStop(0,n),o.addColorStop(1,s),r.fillStyle=o,r.fillRect(e,A,t,i),r.restore()}class Ia{constructor(e,A){this.J(e,A)}J(e,A){this.zt=e,this.Xt=A}At(e,A){return this.zt.yt?e.P+e.L+e.B:0}X(e,A,t,i){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((a=>{const l=a.context;l.font=A.R;const c=this.Gt(a,A,t,i),d=c.Jt;return c.Qt?La(l,d.ti,d.ii,d.ni,d.si,s,d.ei,[d.ht,0,0,d.ht],s):La(l,d.ri,d.ii,d.ni,d.si,s,d.ei,[0,d.ht,d.ht,0],s),this.zt.hi&&(l.fillStyle=n,l.fillRect(d.ri,d.li,d.ai-d.ri,d.oi)),this.zt._i&&(l.fillStyle=A.O,l.fillRect(c.Qt?d.ui-d.ei:0,d.ii,d.ei,d.ci-d.ii)),c}));e.useMediaCoordinateSpace((({context:a})=>{const l=o.di;a.font=A.R,a.textAlign=o.Qt?"right":"left",a.textBaseline="middle",a.fillStyle=n,a.fillText(this.zt.Kt,l.fi,(l.ii+l.ci)/2+l.pi)}))}Gt(e,A,t,i){var n;const{context:s,bitmapSize:o,mediaSize:a,horizontalPixelRatio:l,verticalPixelRatio:c}=e,d=this.zt.hi||!this.zt.mi?A.T:0,p=this.zt.bi?A.C:0,y=A.L+this.Xt.wi,w=A.B+this.Xt.gi,C=A.A,v=A.I,S=this.zt.Kt,F=A.P,k=t.Mi(s,S),x=Math.ceil(t.xi(s,S)),V=F+y+w,N=A.C+C+v+x+d,Z=Math.max(1,Math.floor(c));let X=Math.round(V*c);X%2!=Z%2&&(X+=1);const W=p>0?Math.max(1,Math.floor(p*l)):0,ae=Math.round(N*l),G=Math.round(d*l),ee=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,oe=Math.round(ee*c)-Math.floor(.5*c),me=Math.floor(oe+Z/2-X/2),Le=me+X,Ue=i==="right",Fe=Ue?a.width-p:p,ke=Ue?o.width-W:W;let ye,ve,Ce;return Ue?(ye=ke-ae,ve=ke-G,Ce=Fe-d-C-p):(ye=ke+ae,ve=ke+G,Ce=Fe+d+C),{Qt:Ue,Jt:{ii:me,li:oe,ci:Le,ni:ae,si:X,ht:2*l,ei:W,ti:ye,ri:ke,ai:ve,oi:Z,ui:o.width},di:{ii:me/c,ci:Le/c,fi:Ce,pi:k}}}}class bi{constructor(e){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(e||Ia)(this.Ci,this.yi),this.Ri=new(e||Ia)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(e,A=!1){return Math.max(this.Pi.At(e,A),this.Ri.At(e,A))}Vi(){return this.yi.Si||0}Oi(e){this.yi.Si=e}Bi(){return this.Di(),this.Ci.yt||this.Ti.yt}Ai(){return this.Di(),this.Ci.yt}gt(e){return this.Di(),this.Ci.hi=this.Ci.hi&&e.W().ticksVisible,this.Ti.hi=this.Ti.hi&&e.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 ef extends bi{constructor(e,A,t){super(),this.jt=e,this.Li=A,this.Ei=t}zi(e,A,t){if(e.yt=!1,this.jt.W().mode===2)return;const i=this.jt.W().horzLine;if(!i.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=Ci(i.labelBackgroundColor);t.t=s.t,e.V=s.i;const o=2/12*this.Li.P();t.wi=o,t.gi=o;const a=this.Ei(this.Li);t.ki=a.ki,e.Kt=this.Li.Fi(a._t,n),e.yt=!0}}const Af=/[1-9]/g;class _a{constructor(){this.zt=null}J(e){this.zt=e}X(e,A){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const t=e.useMediaCoordinateSpace((({context:p})=>(p.font=A.R,Math.round(A.Wi.xi(p,ue(this.zt).Kt,Af)))));if(t<=0)return;const i=A.ji,n=t+2*i,s=n/2,o=this.zt.Hi;let a=this.zt.ki,l=Math.floor(a-s)+.5;l<0?(a+=Math.abs(0-l),l=Math.floor(a-s)+.5):l+n>o&&(a-=Math.abs(o-(l+n)),l=Math.floor(a-s)+.5);const c=l+n,d=Math.ceil(0+A.C+A.T+A.L+A.P+A.B);e.useBitmapCoordinateSpace((({context:p,horizontalPixelRatio:y,verticalPixelRatio:w})=>{const C=ue(this.zt);p.fillStyle=C.t;const v=Math.round(l*y),S=Math.round(0*w),F=Math.round(c*y),k=Math.round(d*w),x=Math.round(2*y);if(p.beginPath(),p.moveTo(v,S),p.lineTo(v,k-x),p.arcTo(v,k,v+x,k,x),p.lineTo(F-x,k),p.arcTo(F,k,F,k-x,x),p.lineTo(F,S),p.fill(),C.hi){const V=Math.round(C.ki*y),N=S,Z=Math.round((N+A.T)*w);p.fillStyle=C.V;const X=Math.max(1,Math.floor(y)),W=Math.floor(.5*y);p.fillRect(V-W,N,X,Z-N)}})),e.useMediaCoordinateSpace((({context:p})=>{const y=ue(this.zt),w=0+A.C+A.T+A.L+A.P/2;p.font=A.R,p.textAlign="left",p.textBaseline="middle",p.fillStyle=y.V;const C=A.Wi.Mi(p,"Apr0");p.translate(l+i,w+C),p.fillText(y.Kt,0,0)}))}}class tf{constructor(e,A,t){this.ft=!0,this.Wt=new _a,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=A,this.Ei=t}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const A=this.vt.W().vertLine;if(!A.labelVisible)return;const t=this.$i.St();if(t.Ni())return;e.Hi=t.Hi();const i=this.Ei();if(i===null)return;e.ki=i.ki;const n=t.Ui(this.vt.xt());e.Kt=t.qi(ue(n)),e.yt=!0;const s=Ci(A.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=t.W().ticksVisible}}class os{constructor(){this.Yi=null,this.Zi=0}Xi(){return this.Zi}Ki(e){this.Zi=e}Dt(){return this.Yi}Gi(e){this.Yi=e}Ji(e){return[]}Qi(){return[]}yt(){return!0}}var Da;(function(r){r[r.Normal=0]="Normal",r[r.Magnet=1]="Magnet",r[r.Hidden=2]="Hidden"})(Da||(Da={}));class rf extends os{constructor(e,A){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=e,this.cn=A,this.dn=new Zd(e,this),this.fn=((i,n)=>s=>{const o=n(),a=i();if(s===ue(this.tn).vn())return{_t:a,ki:o};{const l=ue(s.Ct());return{_t:s.pn(o,l),ki:o}}})((()=>this.nn),(()=>this.an));const t=((i,n)=>()=>{const s=this.$i.St().mn(i()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new tf(this,e,t),this.wn=new Yd(this)}W(){return this.cn}gn(e,A){this._n=e,this.un=A}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(e,A,t){this.hn||(this.hn=!0),this.en=!0,this.yn(e,A,t)}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(e){return this.tn!==null?[this.wn,this.dn]:[]}Ut(e){return e===this.tn&&this.cn.horzLine.visible}qt(){return this.cn.vertLine.visible}Rn(e,A){this.en&&this.tn===e||this.rn.clear();const t=[];return this.tn===e&&t.push(this.Dn(this.rn,A,this.fn)),t}Qi(){return this.en?[this.bn]:[]}Ht(){return this.tn}Vn(){this.wn.bt(),this.rn.forEach((e=>e.bt())),this.bn.bt(),this.dn.bt()}On(e){return e&&!e.vn().Ni()?e.vn():null}yn(e,A,t){this.Bn(e,A,t)&&this.Vn()}Bn(e,A,t){const i=this.ln,n=this.an,s=this.nn,o=this.sn,a=this.tn,l=this.On(t);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=t;const c=l!==null?l.Ct():null;return l!==null&&c!==null?(this.nn=A,this.an=l.Rt(A,c)):(this.nn=NaN,this.an=NaN),i!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||a!==this.tn}Tn(){const e=this.$i.wt().map((t=>t.In().An())).filter(Rd),A=e.length===0?null:Math.max(...e);this.sn=A!==null?A:NaN}Dn(e,A,t){let i=e.get(A);return i===void 0&&(i=new ef(this,A,t),e.set(A,i)),i}}function Ti(r){return r==="left"||r==="right"}class yA{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,A){const t=(function(i,n){return i===void 0?n:{Fn:Math.max(i.Fn,n.Fn),Wn:i.Wn||n.Wn}})(this.zn.get(e),A);this.zn.set(e,t)}jn(){return this.En}Hn(e){const A=this.zn.get(e);return A===void 0?{Fn:this.En}:{Fn:Math.max(this.En,A.Fn),Wn:A.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(e){this.Un(),this.Ln=[{qn:1,Vt:e}]}Zn(e){this.Xn(),this.Ln.push({qn:5,Vt:e})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(e){this.Un(),this.Ln.push({qn:2,Vt:e})}Jn(e){this.Un(),this.Ln.push({qn:3,Vt:e})}Qn(){return this.Ln}ts(e){for(const A of e.Ln)this.ns(A);this.En=Math.max(this.En,e.En),e.zn.forEach(((A,t)=>{this.Nn(t,A)}))}static ss(){return new yA(2)}static es(){return new yA(3)}ns(e){switch(e.qn){case 0:this.$n();break;case 1:this.Yn(e.Vt);break;case 2:this.Gn(e.Vt);break;case 3:this.Jn(e.Vt);break;case 4:this.Kn();break;case 5:this.Zn(e.Vt);break;case 6:this.Xn()}}Xn(){const e=this.Ln.findIndex((A=>A.qn===5));e!==-1&&this.Ln.splice(e,1)}}const ka=".";function vt(r,e){if(!ot(r))return"n/a";if(!Fr(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?r.toString():("0000000000000000"+r.toString()).slice(-e)}class Qi{constructor(e,A){if(A||(A=1),ot(e)&&Fr(e)||(e=100),e<0)throw new TypeError("invalid base");this.Li=e,this.rs=A,this.hs()}format(e){const A=e<0?"−":"";return e=Math.abs(e),A+this.ls(e)}hs(){if(this._s=0,this.Li>0&&this.rs>0){let e=this.Li;for(;e>1;)e/=10,this._s++}}ls(e){const A=this.Li/this.rs;let t=Math.floor(e),i="";const n=this._s!==void 0?this._s:NaN;if(A>1){let s=+(Math.round(e*A)-t*A).toFixed(this._s);s>=A&&(s-=A,t+=1),i=ka+vt(+s.toFixed(this._s)*this.rs,n)}else t=Math.round(t*A)/A,n>0&&(i=ka+vt(0,n));return t.toFixed(0)+i}}class Oa extends Qi{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class nf{constructor(e){this.us=e}format(e){let A="";return e<0&&(A="-",e=-e),e<995?A+this.cs(e):e<999995?A+this.cs(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),A+this.cs(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),A+this.cs(e/1e9)+"B")}cs(e){let A;const t=Math.pow(10,this.us);return A=(e=Math.round(e*t)/t)>=1e-15&&e<1?e.toFixed(this.us).replace(/\.?0+$/,""):String(e),A.replace(/(\.[1-9]*)0+$/,((i,n)=>n))}}function Na(r,e,A,t,i,n,s){if(e.length===0||t.from>=e.length||t.to<=0)return;const{context:o,horizontalPixelRatio:a,verticalPixelRatio:l}=r,c=e[t.from];let d=n(r,c),p=c;if(t.to-t.from<2){const y=i/2;o.beginPath();const w={nt:c.nt-y,st:c.st},C={nt:c.nt+y,st:c.st};o.moveTo(w.nt*a,w.st*l),o.lineTo(C.nt*a,C.st*l),s(r,d,w,C)}else{const y=(C,v)=>{s(r,d,p,v),o.beginPath(),d=C,p=v};let w=p;o.beginPath(),o.moveTo(c.nt*a,c.st*l);for(let C=t.from+1;C<t.to;++C){w=e[C];const v=n(r,w);switch(A){case 0:o.lineTo(w.nt*a,w.st*l);break;case 1:o.lineTo(w.nt*a,e[C-1].st*l),v!==d&&(y(v,w),o.lineTo(w.nt*a,e[C-1].st*l)),o.lineTo(w.nt*a,w.st*l);break;case 2:{const[S,F]=sf(e,C-1,C);o.bezierCurveTo(S.nt*a,S.st*l,F.nt*a,F.st*l,w.nt*a,w.st*l);break}}A!==1&&v!==d&&(y(v,w),o.moveTo(w.nt*a,w.st*l))}(p!==w||p===w&&A===1)&&s(r,d,p,w)}}const Ka=6;function as(r,e){return{nt:r.nt-e.nt,st:r.st-e.st}}function Pa(r,e){return{nt:r.nt/e,st:r.st/e}}function sf(r,e,A){const t=Math.max(0,e-1),i=Math.min(r.length-1,A+1);var n,s;return[(n=r[e],s=Pa(as(r[A],r[t]),Ka),{nt:n.nt+s.nt,st:n.st+s.st}),as(r[A],Pa(as(r[i],r[e]),Ka))]}function of(r,e,A,t,i){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(i.nt*s,r*o),n.lineTo(t.nt*s,r*o),n.closePath(),n.fillStyle=A,n.fill()}class Va extends At{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var A;if(this.G===null)return;const{it:t,tt:i,ds:n,et:s,Nt:o,fs:a}=this.G,l=(A=this.G.vs)!==null&&A!==void 0?A:this.G.ps?0:e.mediaSize.height;if(i===null)return;const c=e.context;c.lineCap="butt",c.lineJoin="round",c.lineWidth=s,zt(c,o),c.lineWidth=1,Na(e,t,a,i,n,this.bs.bind(this),of.bind(null,l))}}function ls(r,e,A){return Math.min(Math.max(r,e),A)}function xi(r,e,A){return e-r<=A}function za(r){const e=Math.ceil(r);return e%2==0?e-1:e}class cs{ws(e,A){const t=this.gs,{Ms:i,xs:n,Ss:s,ks:o,ys:a,vs:l}=A;if(this.Cs===void 0||t===void 0||t.Ms!==i||t.xs!==n||t.Ss!==s||t.ks!==o||t.vs!==l||t.ys!==a){const c=e.context.createLinearGradient(0,0,0,a);if(c.addColorStop(0,i),l!=null){const d=ls(l*e.verticalPixelRatio/a,0,1);c.addColorStop(d,n),c.addColorStop(d,s)}c.addColorStop(1,o),this.Cs=c,this.gs=A}return this.Cs}}class af extends Va{constructor(){super(...arguments),this.Ts=new cs}bs(e,A){return this.Ts.ws(e,{Ms:A.Ps,xs:"",Ss:"",ks:A.Rs,ys:e.bitmapSize.height})}}function lf(r,e){const A=r.context;A.strokeStyle=e,A.stroke()}class Ga extends At{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:A,tt:t,ds:i,fs:n,et:s,Nt:o,Ds:a}=this.G;if(t===null)return;const l=e.context;l.lineCap="butt",l.lineWidth=s*e.verticalPixelRatio,zt(l,o),l.lineJoin="round";const c=this.Vs.bind(this);n!==void 0&&Na(e,A,n,t,i,c,lf),a&&(function(d,p,y,w,C){const{horizontalPixelRatio:v,verticalPixelRatio:S,context:F}=d;let k=null;const x=Math.max(1,Math.floor(v))%2/2,V=y*S+x;for(let N=w.to-1;N>=w.from;--N){const Z=p[N];if(Z){const X=C(d,Z);X!==k&&(F.beginPath(),k!==null&&F.fill(),F.fillStyle=X,k=X);const W=Math.round(Z.nt*v)+x,ae=Z.st*S;F.moveTo(W,ae),F.arc(W,ae,V,0,2*Math.PI)}}F.fill()})(e,A,a,t,c)}}class Ra extends Ga{Vs(e,A){return A.lt}}function Wa(r,e,A,t,i=0,n=e.length){let s=n-i;for(;0<s;){const o=s>>1,a=i+o;t(e[a],A)===r?(i=a+1,s-=o+1):s=o}return i}const Sr=Wa.bind(null,!0),$a=Wa.bind(null,!1);function cf(r,e){return r.ot<e}function hf(r,e){return e<r.ot}function Xa(r,e,A){const t=e.Os(),i=e.ui(),n=Sr(r,t,cf),s=$a(r,i,hf);if(!A)return{from:n,to:s};let o=n,a=s;return n>0&&n<r.length&&r[n].ot>=t&&(o=n-1),s>0&&s<r.length&&r[s-1].ot<=i&&(a=s+1),{from:o,to:a}}class hs{constructor(e,A,t){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=e,this.Ns=A,this.Fs=t}bt(e){this.Bs=!0,e==="data"&&(this.As=!0),e==="options"&&(this.Is=!0)}gt(){return this.Es.yt()?(this.Ws(),this.Ls===null?null:this.js):null}Hs(){this.zs=this.zs.map((e=>Object.assign(Object.assign({},e),this.Es.Us().$s(e.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 e=this.Es.Dt(),A=this.Ns.St();if(this.qs(),A.Ni()||e.Ni())return;const t=A.Xs();if(t===null||this.Es.In().Ks()===0)return;const i=this.Es.Ct();i!==null&&(this.Ls=Xa(this.zs,t,this.Fs),this.Gs(e,A,i.Vt),this.Js())}}class Fi extends hs{constructor(e,A){super(e,A,!0)}Gs(e,A,t){A.Qs(this.zs,Er(this.Ls)),e.te(this.zs,t,Er(this.Ls))}ie(e,A){return{ot:e,_t:A,nt:NaN,st:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((A=>{const t=A.Vt[3];return this.se(A.ee,t,e)}))}}class uf extends Fi{constructor(e,A){super(e,A),this.js=new ss,this.re=new af,this.he=new Ra,this.js.Z([this.re,this.he])}se(e,A,t){return Object.assign(Object.assign({},this.ie(e,A)),t.$s(e))}Js(){const e=this.Es.W();this.re.J({fs:e.lineType,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,vs:null,ps:e.invertFilledArea,tt:this.Ls,ds:this.Ns.St().le()}),this.he.J({fs:e.lineVisible?e.lineType:void 0,it:this.zs,Nt:e.lineStyle,et:e.lineWidth,tt:this.Ls,ds:this.Ns.St().le(),Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0})}}class df extends At{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(A),this.ae>=2&&Math.max(1,Math.floor(A))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(A)):this.ae;let i=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*A);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];i!==o.ce&&(e.fillStyle=o.ce,i=o.ce);const a=Math.floor(.5*this.oe),l=Math.round(o.nt*A),c=l-a,d=this.oe,p=c+d-1,y=Math.min(o.de,o.fe),w=Math.max(o.de,o.fe),C=Math.round(y*t)-a,v=Math.round(w*t)+a,S=Math.max(v-C,this.oe);e.fillRect(c,C,d,S);const F=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const N=l-F;let Z=Math.max(C,Math.round(o.pe*t)-a),X=Z+d-1;X>C+S-1&&(X=C+S-1,Z=X-d+1),e.fillRect(N,Z,c-N,X-Z+1)}const k=l+F;let x=Math.max(C,Math.round(o.me*t)-a),V=x+d-1;V>C+S-1&&(V=C+S-1,x=V-d+1),e.fillRect(p+1,x,k-p,V-x+1)}}}_e(e){const A=Math.floor(e);return Math.max(A,Math.floor((function(t,i){return Math.floor(.3*t*i)})(ue(this.zt).le,e)))}}class Ja extends hs{constructor(e,A){super(e,A,!1)}Gs(e,A,t){A.Qs(this.zs,Er(this.Ls)),e.be(this.zs,t,Er(this.Ls))}we(e,A,t){return{ot:e,ge:A.Vt[0],Me:A.Vt[1],xe:A.Vt[2],Se:A.Vt[3],nt:NaN,pe:NaN,de:NaN,fe:NaN,me:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((A=>this.se(A.ee,A,e)))}}class ff extends Ja{constructor(){super(...arguments),this.js=new df}se(e,A,t){return Object.assign(Object.assign({},this.we(e,A,t)),t.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),ve:e.openVisible,ue:e.thinBars,tt:this.Ls})}}class pf extends Va{constructor(){super(...arguments),this.Ts=new cs}bs(e,A){const t=this.G;return this.Ts.ws(e,{Ms:A.ke,xs:A.ye,Ss:A.Ce,ks:A.Te,ys:e.bitmapSize.height,vs:t.vs})}}class gf extends Ga{constructor(){super(...arguments),this.Pe=new cs}Vs(e,A){const t=this.G;return this.Pe.ws(e,{Ms:A.Re,xs:A.Re,Ss:A.De,ks:A.De,ys:e.bitmapSize.height,vs:t.vs})}}class mf extends Fi{constructor(e,A){super(e,A),this.js=new ss,this.Ve=new pf,this.Oe=new gf,this.js.Z([this.Ve,this.Oe])}se(e,A,t){return Object.assign(Object.assign({},this.ie(e,A)),t.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const A=this.Es.W(),t=this.Es.Dt().Rt(A.baseValue.price,e.Vt),i=this.Ns.St().le();this.Ve.J({it:this.zs,et:A.lineWidth,Nt:A.lineStyle,fs:A.lineType,vs:t,ps:!1,tt:this.Ls,ds:i}),this.Oe.J({it:this.zs,et:A.lineWidth,Nt:A.lineStyle,fs:A.lineVisible?A.lineType:void 0,Ds:A.pointMarkersVisible?A.pointMarkersRadius||A.lineWidth/2+2:void 0,vs:t,tt:this.Ls,ds:i})}}class Bf extends At{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:A}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),a=Math.floor(n*o*s),l=Math.floor(n*s),c=Math.min(a,l);return Math.max(Math.floor(s),c)})(this.zt.le,A),this.ae>=2&&Math.floor(A)%2!=this.ae%2&&this.ae--;const t=this.zt.In;this.zt.Be&&this.Ae(e,t,this.zt.tt),this.zt._i&&this.Ie(e,t,this.zt.tt);const i=this.ze(A);(!this.zt._i||this.ae>2*i)&&this.Le(e,t,this.zt.tt)}Ae(e,A,t){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",a=Math.min(Math.floor(n),Math.floor(this.zt.le*n));a=Math.max(Math.floor(n),Math.min(a,this.ae));const l=Math.floor(.5*a);let c=null;for(let d=t.from;d<t.to;d++){const p=A[d];p.Ee!==o&&(i.fillStyle=p.Ee,o=p.Ee);const y=Math.round(Math.min(p.pe,p.me)*s),w=Math.round(Math.max(p.pe,p.me)*s),C=Math.round(p.de*s),v=Math.round(p.fe*s);let S=Math.round(n*p.nt)-l;const F=S+a-1;c!==null&&(S=Math.max(c+1,S),S=Math.min(S,F));const k=F-S+1;i.fillRect(S,C,k,y-C),i.fillRect(S,w+1,k,v-w),c=F}}ze(e){let A=Math.floor(1*e);this.ae<=2*A&&(A=Math.floor(.5*(this.ae-1)));const t=Math.max(Math.floor(e),A);return this.ae<=2*t?Math.max(Math.floor(e),Math.floor(1*e)):t}Ie(e,A,t){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const a=this.ze(n);let l=null;for(let c=t.from;c<t.to;c++){const d=A[c];d.Ne!==o&&(i.fillStyle=d.Ne,o=d.Ne);let p=Math.round(d.nt*n)-Math.floor(.5*this.ae);const y=p+this.ae-1,w=Math.round(Math.min(d.pe,d.me)*s),C=Math.round(Math.max(d.pe,d.me)*s);if(l!==null&&(p=Math.max(l+1,p),p=Math.min(p,y)),this.zt.le*n>2*a)jd(i,p,w,y-p+1,C-w+1,a);else{const v=y-p+1;i.fillRect(p,w,v,C-w+1)}l=y}}Le(e,A,t){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const a=this.ze(n);for(let l=t.from;l<t.to;l++){const c=A[l];let d=Math.round(Math.min(c.pe,c.me)*s),p=Math.round(Math.max(c.pe,c.me)*s),y=Math.round(c.nt*n)-Math.floor(.5*this.ae),w=y+this.ae-1;if(c.ce!==o){const C=c.ce;i.fillStyle=C,o=C}this.zt._i&&(y+=a,d+=a,w-=a,p-=a),d>p||i.fillRect(y,d,w-y+1,p-d+1)}}}class wf extends Ja{constructor(){super(...arguments),this.js=new Bf}se(e,A,t){return Object.assign(Object.assign({},this.we(e,A,t)),t.$s(e))}Js(){const e=this.Es.W();this.js.J({In:this.zs,le:this.Ns.St().le(),Be:e.wickVisible,_i:e.borderVisible,tt:this.Ls})}}class Cf{constructor(e,A){this.Fe=e,this.Li=A}X(e,A,t){this.Fe.draw(e,this.Li,A,t)}}class us extends hs{constructor(e,A,t){super(e,A,!1),this.wn=t,this.js=new Cf(this.wn.renderer(),(i=>{const n=e.Ct();return n===null?null:e.Dt().Rt(i,n.Vt)}))}We(e){return this.wn.priceValueBuilder(e)}je(e){return this.wn.isWhitespace(e)}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((A=>Object.assign(Object.assign({ot:A.ee,nt:NaN},e.$s(A.ee)),{He:A.$e})))}Gs(e,A){A.Qs(this.zs,Er(this.Ls))}Js(){this.wn.update({bars:this.zs.map(vf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function vf(r){return{x:r.nt,time:r.ot,originalData:r.He,barColor:r.ce}}class yf extends At{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(A);const i=Math.max(1,Math.floor(t)),n=Math.round(this.zt.Ye*t)-Math.floor(i/2),s=n+i;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const a=this.zt.it[o],l=this.Ue[o-this.zt.tt.from],c=Math.round(a.st*t);let d,p;e.fillStyle=a.ce,c<=n?(d=c,p=s):(d=n,p=c-Math.floor(i/2)+i),e.fillRect(l.Os,d,l.ui-l.Os+1,p-d)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const A=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),t=Math.round(this.zt.le*e)-A;this.Ue=new Array(this.zt.tt.to-this.zt.tt.from);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.zt.it[n],o=Math.round(s.nt*e);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.Ue[n-this.zt.tt.from]={Os:a,ui:l,Ze:o,Xe:s.nt*e,ot:s.ot}}for(let n=this.zt.tt.from+1;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from],o=this.Ue[n-this.zt.tt.from-1];s.ot===o.ot+1&&s.Os-o.ui!==A+1&&(o.Ze>o.Xe?o.ui=s.Os-A-1:s.Os=o.ui+A+1)}let i=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;i=Math.min(o,i)}if(A>0&&i<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>i&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class bf extends Fi{constructor(){super(...arguments),this.js=new yf}se(e,A,t){return Object.assign(Object.assign({},this.ie(e,A)),t.$s(e))}Js(){const e={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,ue(this.Es.Ct()).Vt)};this.js.J(e)}}class Tf extends Fi{constructor(){super(...arguments),this.js=new Ra}se(e,A,t){return Object.assign(Object.assign({},this.ie(e,A)),t.$s(e))}Js(){const e=this.Es.W(),A={it:this.zs,Nt:e.lineStyle,fs:e.lineVisible?e.lineType:void 0,et:e.lineWidth,Ds:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,tt:this.Ls,ds:this.Ns.St().le()};this.js.J(A)}}const Qf=/[2-9]/g;class Hr{constructor(e=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=e}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(e,A,t){return this.sr(e,A,t).width}Mi(e,A,t){const i=this.sr(e,A,t);return((i.actualBoundingBoxAscent||0)-(i.actualBoundingBoxDescent||0))/2}sr(e,A,t){const i=t||Qf,n=String(A).replace(i,"0");if(this.tr.has(n))return LA(this.tr.get(n)).er;if(this.Ke===this.ir){const o=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(o),this.Je++,this.Ke--}e.save(),e.textBaseline="middle";const s=e.measureText(n);return e.restore(),s.width===0&&A.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class xf{constructor(e){this.hr=null,this.k=null,this.lr="right",this.ar=e}_r(e,A,t){this.hr=e,this.k=A,this.lr=t}X(e){this.k!==null&&this.hr!==null&&this.hr.X(e,this.k,this.ar,this.lr)}}class Za{constructor(e,A,t){this.ur=e,this.ar=new Hr(50),this.cr=A,this.F=t,this.j=-1,this.Wt=new xf(this.ar)}gt(){const e=this.F.dr(this.cr);if(e===null)return null;const A=e.vr(this.cr)?e.pr():this.cr.Dt();if(A===null)return null;const t=e.mr(A);if(t==="overlay")return null;const i=this.F.br();return i.P!==this.j&&(this.j=i.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),i,t),this.Wt}}class Ff extends At{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,A){var t;if(!(!((t=this.zt)===null||t===void 0)&&t.yt))return null;const{st:i,et:n,gr:s}=this.zt;return A>=i-n-7&&A<=i+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:A,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*i);n<0||n>A.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*t),zt(e,this.zt.Nt),Fa(e,n,0,A.width))}}class ds{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new Ff,this.ft=!0,this.Es=e,this.Ns=e.$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 Uf extends ds{constructor(e){super(e)}yr(){this.Sr.yt=!1;const e=this.Es.Dt(),A=e.Cr().Cr;if(A!==2&&A!==3)return;const t=this.Es.W();if(!t.baseLineVisible||!this.Es.yt())return;const i=this.Es.Ct();i!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(i.Vt,i.Vt),this.Sr.V=t.baseLineColor,this.Sr.et=t.baseLineWidth,this.Sr.Nt=t.baseLineStyle)}}class Ef extends At{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t}){const i=this.zt;if(i===null)return;const n=Math.max(1,Math.floor(A)),s=n%2/2,o=Math.round(i.Xe.x*A)+s,a=i.Xe.y*t;e.fillStyle=i.Tr,e.beginPath();const l=Math.max(2,1.5*i.Pr)*A;e.arc(o,a,l,0,2*Math.PI,!1),e.fill(),e.fillStyle=i.Rr,e.beginPath(),e.arc(o,a,i.ht*A,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=i.Dr,e.beginPath(),e.arc(o,a,i.ht*A+n/2,0,2*Math.PI,!1),e.stroke()}}const Sf=[{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 qa(r,e,A,t){return(function(i,n){if(i==="transparent")return i;const s=xr(i),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(r,A+(t-A)*e)}function Ya(r,e){const A=r%2600/2600;let t;for(const a of Sf)if(A>=a.Vr&&A<=a.Or){t=a;break}Ft(t!==void 0,"Last price animation internal logic error");const i=(A-t.Vr)/(t.Or-t.Vr);return{Rr:qa(e,i,t.Ir,t.zr),Dr:qa(e,i,t.Lr,t.Er),ht:(n=i,s=t.Br,o=t.Ar,s+(o-s)*n)};var n,s,o}class Hf{constructor(e){this.Wt=new Ef,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=e}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),this.jr.W().lastPriceAnimation===2){const e=performance.now(),A=this.Wr-e;if(A>0)return void(A<650&&(this.Wr+=2600));this.Fr=e,this.Wr=e+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 e=this.jr.$t().St(),A=e.Xs(),t=this.jr.Ct();if(A===null||t===null)return;const i=this.jr.Zr(!0);if(i.Xr||!A.Kr(i.ee))return;const n={x:e.It(i.ee),y:this.jr.Dt().Rt(i._t,t.Vt)},s=i.V,o=this.jr.W().lineWidth,a=Ya(this.Gr(),s);this.Wt.J({Tr:s,Pr:o,Rr:a.Rr,Dr:a.Dr,ht:a.ht,Xe:n})}Yr(){const e=this.Wt.$e();if(e!==null){const A=Ya(this.Gr(),e.Tr);e.Rr=A.Rr,e.Dr=A.Dr,e.ht=A.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function Lr(r,e){return za(Math.min(Math.max(r,12),30)*e)}function Mr(r,e){switch(r){case"arrowDown":case"arrowUp":return Lr(e,1);case"circle":return Lr(e,.8);case"square":return Lr(e,.7)}}function ja(r){return(function(e){const A=Math.ceil(e);return A%2!=0?A-1:A})(Lr(r,1))}function el(r){return Math.max(Lr(r,.1),3)}function Al(r,e,A){return e?r:A?Math.ceil(r/2):0}function tl(r,e,A,t,i){const n=Mr("square",A),s=(n-1)/2,o=r-s,a=e-s;return t>=o&&t<=o+n&&i>=a&&i<=a+n}function rl(r,e,A,t){const i=(Mr("arrowUp",t)-1)/2*A.Jr,n=(za(t/2)-1)/2*A.Jr;e.beginPath(),r?(e.moveTo(A.nt-i,A.st),e.lineTo(A.nt,A.st-i),e.lineTo(A.nt+i,A.st),e.lineTo(A.nt+n,A.st),e.lineTo(A.nt+n,A.st+i),e.lineTo(A.nt-n,A.st+i),e.lineTo(A.nt-n,A.st)):(e.moveTo(A.nt-i,A.st),e.lineTo(A.nt,A.st+i),e.lineTo(A.nt+i,A.st),e.lineTo(A.nt+n,A.st),e.lineTo(A.nt+n,A.st-i),e.lineTo(A.nt-n,A.st-i),e.lineTo(A.nt-n,A.st)),e.fill()}function Lf(r,e,A,t,i,n){return tl(e,A,t,i,n)}class Mf extends At{constructor(){super(...arguments),this.zt=null,this.ar=new Hr,this.j=-1,this.H="",this.Qr=""}J(e){this.zt=e}_r(e,A){this.j===e&&this.H===A||(this.j=e,this.H=A,this.Qr=ir(e,A),this.ar.nr())}wr(e,A){if(this.zt===null||this.zt.tt===null)return null;for(let t=this.zt.tt.from;t<this.zt.tt.to;t++){const i=this.zt.it[t];if(_f(i,e,A))return{Mr:i.th,gr:i.gr}}return null}K({context:e,horizontalPixelRatio:A,verticalPixelRatio:t},i,n){if(this.zt!==null&&this.zt.tt!==null){e.textBaseline="middle",e.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const o=this.zt.it[s];o.Kt!==void 0&&(o.Kt.Hi=this.ar.xi(e,o.Kt.ih),o.Kt.At=this.j,o.Kt.nt=o.nt-o.Kt.Hi/2),If(o,e,A,t)}}}}function If(r,e,A,t){e.fillStyle=r.V,r.Kt!==void 0&&(function(i,n,s,o,a,l){i.save(),i.scale(a,l),i.fillText(n,s,o),i.restore()})(e,r.Kt.ih,r.Kt.nt,r.Kt.st,A,t),(function(i,n,s){if(i.Ks!==0){switch(i.nh){case"arrowDown":return void rl(!1,n,s,i.Ks);case"arrowUp":return void rl(!0,n,s,i.Ks);case"circle":return void(function(o,a,l){const c=(Mr("circle",l)-1)/2;o.beginPath(),o.arc(a.nt,a.st,c*a.Jr,0,2*Math.PI,!1),o.fill()})(n,s,i.Ks);case"square":return void(function(o,a,l){const c=Mr("square",l),d=(c-1)*a.Jr/2,p=a.nt-d,y=a.st-d;o.fillRect(p,y,c*a.Jr,c*a.Jr)})(n,s,i.Ks)}i.nh}})(r,e,(function(i,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(i.nt*n)+o,st:i.st*s,Jr:n}})(r,A,t))}function _f(r,e,A){return!(r.Kt===void 0||!(function(t,i,n,s,o,a){const l=s/2;return o>=t&&o<=t+n&&a>=i-l&&a<=i+l})(r.Kt.nt,r.Kt.st,r.Kt.Hi,r.Kt.At,e,A))||(function(t,i,n){if(t.Ks===0)return!1;switch(t.nh){case"arrowDown":case"arrowUp":return Lf(0,t.nt,t.st,t.Ks,i,n);case"circle":return(function(s,o,a,l,c){const d=2+Mr("circle",a)/2,p=s-l,y=o-c;return Math.sqrt(p*p+y*y)<=d})(t.nt,t.st,t.Ks,i,n);case"square":return tl(t.nt,t.st,t.Ks,i,n)}})(r,e,A)}function Df(r,e,A,t,i,n,s,o,a){const l=ot(A)?A:A.Se,c=ot(A)?A:A.Me,d=ot(A)?A:A.xe,p=ot(e.size)?Math.max(e.size,0):1,y=ja(o.le())*p,w=y/2;switch(r.Ks=y,e.position){case"inBar":return r.st=s.Rt(l,a),void(r.Kt!==void 0&&(r.Kt.st=r.st+w+n+.6*i));case"aboveBar":return r.st=s.Rt(c,a)-w-t.sh,r.Kt!==void 0&&(r.Kt.st=r.st-w-.6*i,t.sh+=1.2*i),void(t.sh+=y+n);case"belowBar":return r.st=s.Rt(d,a)+w+t.eh,r.Kt!==void 0&&(r.Kt.st=r.st+w+n+.6*i,t.eh+=1.2*i),void(t.eh+=y+n)}e.position}class kf{constructor(e,A){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Mf,this.jr=e,this.$i=A,this.zt={it:[],tt:null}}bt(e){this.ft=!0,this.hh=!0,e==="data"&&(this.rh=!0,this.oh=null)}gt(e){if(!this.jr.yt())return null;this.ft&&this._h();const A=this.$i.W().layout;return this.Wt._r(A.fontSize,A.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const e=this.$i.St().le(),A=el(e),t=1.5*ja(e)+2*A,i=this.fh();this.ah={above:Al(t,i.aboveBar,i.inBar),below:Al(t,i.belowBar,i.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,A)=>(e[A.position]||(e[A.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),A=this.$i.St(),t=this.jr.dh();this.rh&&(this.zt.it=t.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 i=this.$i.W().layout;this.zt.tt=null;const n=A.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const a=el(A.le()),l={sh:a,eh:a};this.zt.tt=Xa(this.zt.it,n,!0);for(let c=this.zt.tt.from;c<this.zt.tt.to;c++){const d=t[c];d.time!==o&&(l.sh=a,l.eh=a,o=d.time);const p=this.zt.it[c];p.nt=A.It(d.time),d.text!==void 0&&d.text.length>0&&(p.Kt={ih:d.text,nt:0,st:0,Hi:0,At:0});const y=this.jr.ph(d.time);y!==null&&Df(p,d,y,l,i.fontSize,a,e,A,s.Vt)}this.ft=!1}}class Of extends ds{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const A=this.Es.W();if(!A.priceLineVisible||!this.Es.yt())return;const t=this.Es.Zr(A.priceLineSource===0);t.Xr||(e.yt=!0,e.st=t.ki,e.V=this.Es.mh(t.V),e.et=A.priceLineWidth,e.Nt=A.priceLineStyle)}}class Nf extends bi{constructor(e){super(),this.jt=e}zi(e,A,t){e.yt=!1,A.yt=!1;const i=this.jt;if(!i.yt())return;const n=i.W(),s=n.lastValueVisible,o=i.bh()!=="",a=n.seriesLastValueMode===0,l=i.Zr(!1);if(l.Xr)return;s&&(e.Kt=this.wh(l,s,a),e.yt=e.Kt.length!==0),(o||a)&&(A.Kt=this.gh(l,s,o,a),A.yt=A.Kt.length>0);const c=i.mh(l.V),d=Ci(c);t.t=d.t,t.ki=l.ki,A.Ot=i.$t().Bt(l.ki/i.Dt().At()),e.Ot=c,e.V=d.i,A.V=d.i}gh(e,A,t,i){let n="";const s=this.jt.bh();return t&&s.length!==0&&(n+=`${s} `),A&&i&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,A,t){return A?t?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function il(r,e,A,t){const i=Number.isFinite(e),n=Number.isFinite(A);return i&&n?r(e,A):i||n?i?e:A:t}class DA{constructor(e,A){this.kh=e,this.yh=A}Ch(e){return e!==null&&this.kh===e.kh&&this.yh===e.yh}Th(){return new DA(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(e){return e===null?this:new DA(il(Math.min,this.Ph(),e.Ph(),-1/0),il(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!ot(e)||this.yh-this.kh===0)return;const A=.5*(this.yh+this.kh);let t=this.yh-A,i=this.kh-A;t*=e,i*=e,this.yh=A+t,this.kh=A+i}Oh(e){ot(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new DA(e.minValue,e.maxValue)}}class Ui{constructor(e,A){this.Ih=e,this.zh=A||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(e){return e===null?null:new Ui(DA.Ah(e.priceRange),e.margins)}}class Kf extends ds{constructor(e,A){super(e),this.Nh=A}yr(){const e=this.Sr;e.yt=!1;const A=this.Nh.W();if(!this.Es.yt()||!A.lineVisible)return;const t=this.Nh.Fh();t!==null&&(e.yt=!0,e.st=t,e.V=A.color,e.et=A.lineWidth,e.Nt=A.lineStyle,e.gr=this.Nh.W().id)}}class Pf extends bi{constructor(e,A){super(),this.jr=e,this.Nh=A}zi(e,A,t){e.yt=!1,A.yt=!1;const i=this.Nh.W(),n=i.axisLabelVisible,s=i.title!=="",o=this.jr;if(!n||!o.yt())return;const a=this.Nh.Fh();if(a===null)return;s&&(A.Kt=i.title,A.yt=!0),A.Ot=o.$t().Bt(a/o.Dt().At()),e.Kt=this.Wh(i.price),e.yt=!0;const l=Ci(i.axisLabelColor||i.color);t.t=l.t;const c=i.axisLabelTextColor||l.i;e.V=c,A.V=c,t.ki=a}Wh(e){const A=this.jr.Ct();return A===null?"":this.jr.Dt().Fi(e,A.Vt)}}class Vf{constructor(e,A){this.jr=e,this.cn=A,this.jh=new Kf(e,this),this.ur=new Pf(e,this),this.Hh=new Za(this.ur,e,e.$t())}$h(e){et(this.cn,e),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 e=this.jr,A=e.Dt();if(e.$t().St().Ni()||A.Ni())return null;const t=e.Ct();return t===null?null:A.Rt(this.cn.price,t.Vt)}}class zf extends os{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Gf={Bar:(r,e,A,t)=>{var i;const n=e.upColor,s=e.downColor,o=ue(r(A,t)),a=rr(o.Vt[0])<=rr(o.Vt[3]);return{ce:(i=o.V)!==null&&i!==void 0?i:a?n:s}},Candlestick:(r,e,A,t)=>{var i,n,s;const o=e.upColor,a=e.downColor,l=e.borderUpColor,c=e.borderDownColor,d=e.wickUpColor,p=e.wickDownColor,y=ue(r(A,t)),w=rr(y.Vt[0])<=rr(y.Vt[3]);return{ce:(i=y.V)!==null&&i!==void 0?i:w?o:a,Ne:(n=y.Ot)!==null&&n!==void 0?n:w?l:c,Ee:(s=y.Xh)!==null&&s!==void 0?s:w?d:p}},Custom:(r,e,A,t)=>{var i;return{ce:(i=ue(r(A,t)).V)!==null&&i!==void 0?i:e.color}},Area:(r,e,A,t)=>{var i,n,s,o;const a=ue(r(A,t));return{ce:(i=a.lt)!==null&&i!==void 0?i:e.lineColor,lt:(n=a.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=a.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=a.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(r,e,A,t)=>{var i,n,s,o,a,l;const c=ue(r(A,t));return{ce:c.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(i=c.Re)!==null&&i!==void 0?i:e.topLineColor,De:(n=c.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=c.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=c.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(a=c.Ce)!==null&&a!==void 0?a:e.bottomFillColor1,Te:(l=c.Te)!==null&&l!==void 0?l:e.bottomFillColor2}},Line:(r,e,A,t)=>{var i,n;const s=ue(r(A,t));return{ce:(i=s.V)!==null&&i!==void 0?i:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(r,e,A,t)=>{var i;return{ce:(i=ue(r(A,t)).V)!==null&&i!==void 0?i:e.color}}};class Rf{constructor(e){this.Kh=(A,t)=>t!==void 0?t.Vt:this.jr.In().Gh(A),this.jr=e,this.Jh=Gf[e.Qh()]}$s(e,A){return this.Jh(this.Kh,this.jr.W(),e,A)}}var nl;(function(r){r[r.NearestLeft=-1]="NearestLeft",r[r.None=0]="None",r[r.NearestRight=1]="NearestRight"})(nl||(nl={}));const Ut=30;class Wf{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(e){return this.hl(e,0)!==null}Gh(e){return this.ll(e)}ll(e,A=0){const t=this.hl(e,A);return t===null?null:Object.assign(Object.assign({},this.al(t)),{ee:this.rl(t)})}ne(){return this.tl}ol(e,A,t){if(this.Ni())return null;let i=null;for(const n of t)i=Ei(i,this._l(e,A,n));return i}J(e){this.nl.clear(),this.il.clear(),this.tl=e}rl(e){return this.tl[e].ee}al(e){return this.tl[e]}hl(e,A){const t=this.ul(e);if(t===null&&A!==0)switch(A){case-1:return this.cl(e);case 1:return this.dl(e);default:throw new TypeError("Unknown search mode")}return t}cl(e){let A=this.fl(e);return A>0&&(A-=1),A!==this.tl.length&&this.rl(A)<e?A:null}dl(e){const A=this.vl(e);return A!==this.tl.length&&e<this.rl(A)?A:null}ul(e){const A=this.fl(e);return A===this.tl.length||e<this.tl[A].ee?null:A}fl(e){return Sr(this.tl,e,((A,t)=>A.ee<t))}vl(e){return $a(this.tl,e,((A,t)=>A.ee>t))}pl(e,A,t){let i=null;for(let n=e;n<A;n++){const s=this.tl[n].Vt[t];Number.isNaN(s)||(i===null?i={ml:s,bl:s}:(s<i.ml&&(i.ml=s),s>i.bl&&(i.bl=s)))}return i}_l(e,A,t){if(this.Ni())return null;let i=null;const n=ue(this.el()),s=ue(this.An()),o=Math.max(e,n),a=Math.min(A,s),l=Math.ceil(o/Ut)*Ut,c=Math.max(l,Math.floor(a/Ut)*Ut);{const p=this.fl(o),y=this.vl(Math.min(a,l,A));i=Ei(i,this.pl(p,y,t))}let d=this.il.get(t);d===void 0&&(d=new Map,this.il.set(t,d));for(let p=Math.max(l+1,o);p<c;p+=Ut){const y=Math.floor(p/Ut);let w=d.get(y);if(w===void 0){const C=this.fl(y*Ut),v=this.vl((y+1)*Ut-1);w=this.pl(C,v,t),d.set(y,w)}i=Ei(i,w)}{const p=this.fl(c),y=this.vl(a);i=Ei(i,this.pl(p,y,t))}return i}}function Ei(r,e){return r===null?e:e===null?r:{ml:Math.min(r.ml,e.ml),bl:Math.max(r.bl,e.bl)}}class $f{constructor(e){this.wl=e}X(e,A,t){this.wl.draw(e)}gl(e,A,t){var i,n;(n=(i=this.wl).drawBackground)===null||n===void 0||n.call(i,e)}}class fs{constructor(e){this.tr=null,this.wn=e}gt(){var e;const A=this.wn.renderer();if(A===null)return null;if(((e=this.tr)===null||e===void 0?void 0:e.Ml)===A)return this.tr.xl;const t=new $f(A);return this.tr={Ml:A,xl:t},t}Sl(){var e,A,t;return(t=(A=(e=this.wn).zOrder)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:"normal"}}function sl(r){var e,A,t,i,n;return{Kt:r.text(),ki:r.coordinate(),Si:(e=r.fixedCoordinate)===null||e===void 0?void 0:e.call(r),V:r.textColor(),t:r.backColor(),yt:(t=(A=r.visible)===null||A===void 0?void 0:A.call(r))===null||t===void 0||t,hi:(n=(i=r.tickVisible)===null||i===void 0?void 0:i.call(r))===null||n===void 0||n}}class Xf{constructor(e,A){this.Wt=new _a,this.kl=e,this.yl=A}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},sl(this.kl))),this.Wt}}class Jf extends bi{constructor(e,A){super(),this.kl=e,this.Li=A}zi(e,A,t){const i=sl(this.kl);t.t=i.t,e.V=i.V;const n=2/12*this.Li.P();t.wi=n,t.gi=n,t.ki=i.ki,t.Si=i.Si,e.Kt=i.Kt,e.yt=i.yt,e.hi=i.hi}}class Zf{constructor(e,A){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=e,this.jr=A}Ol(){return this.Vl}Vn(){var e,A;(A=(e=this.Vl).updateAllViews)===null||A===void 0||A.call(e)}Pn(){var e,A,t,i;const n=(t=(A=(e=this.Vl).paneViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Cl)===null||i===void 0?void 0:i.Ml)===n)return this.Cl.xl;const s=n.map((o=>new fs(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,A,t,i;const n=(t=(A=(e=this.Vl).timeAxisViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Tl)===null||i===void 0?void 0:i.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((a=>new Xf(a,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,A,t,i;const n=(t=(A=(e=this.Vl).priceAxisViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Pl)===null||i===void 0?void 0:i.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((a=>new Jf(a,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,A,t,i;const n=(t=(A=(e=this.Vl).priceAxisPaneViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Rl)===null||i===void 0?void 0:i.Ml)===n)return this.Rl.xl;const s=n.map((o=>new fs(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,A,t,i;const n=(t=(A=(e=this.Vl).timeAxisPaneViews)===null||A===void 0?void 0:A.call(e))!==null&&t!==void 0?t:[];if(((i=this.Dl)===null||i===void 0?void 0:i.Ml)===n)return this.Dl.xl;const s=n.map((o=>new fs(o)));return this.Dl={Ml:n,xl:s},s}Il(e,A){var t,i,n;return(n=(i=(t=this.Vl).autoscaleInfo)===null||i===void 0?void 0:i.call(t,e,A))!==null&&n!==void 0?n:null}wr(e,A){var t,i,n;return(n=(i=(t=this.Vl).hitTest)===null||i===void 0?void 0:i.call(t,e,A))!==null&&n!==void 0?n:null}}function ps(r,e,A,t){r.forEach((i=>{e(i).forEach((n=>{n.Sl()===A&&t.push(n)}))}))}function gs(r){return r.Pn()}function qf(r){return r.Bl()}function Yf(r){return r.Al()}class ms extends zf{constructor(e,A,t,i,n){super(e),this.zt=new Wf,this.jh=new Of(this),this.zl=[],this.Ll=new Uf(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=A,this.$l=t;const s=new Nf(this);this.rn=[s],this.Hh=new Za(s,this,e),t!=="Area"&&t!=="Line"&&t!=="Baseline"||(this.El=new Hf(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const A={Xr:!0},t=this.Dt();if(this.$t().St().Ni()||t.Ni()||this.zt.Ni())return A;const i=this.$t().St().Xs(),n=this.Ct();if(i===null||n===null)return A;let s,o;if(e){const d=this.zt.sl();if(d===null)return A;s=d,o=d.ee}else{const d=this.zt.ll(i.ui(),-1);if(d===null||(s=this.zt.Gh(d.ee),s===null))return A;o=d.ee}const a=s.Vt[3],l=this.Us().$s(o,{Vt:s}),c=t.Rt(a,n.Vt);return{Xr:!1,_t:a,Kt:t.Fi(a,n.Vt),xh:t.Yl(a),Sh:t.Zl(a,n.Vt),V:l.ce,ki:c,ee:o}}Us(){return this.Nl!==null||(this.Nl=new Rf(this)),this.Nl}W(){return this.cn}$h(e){const A=e.priceScaleId;A!==void 0&&A!==this.cn.priceScaleId&&this.$t().Xl(this,A),et(this.cn,e),e.priceFormat!==void 0&&(this.Ul(),this.$t().Kl()),this.$t().Gl(this),this.$t().Jl(),this.wn.bt("options")}J(e,A){this.zt.J(e),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(A&&A.ta?this.El.$r():e.length===0&&this.El.Hr());const t=this.$t().dr(this);this.$t().ia(t),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(e){this.Fl=e,this.Ql();const A=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(A),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(e){const A=new Vf(this,e);return this.zl.push(A),this.$t().Gl(this),A}ra(e){const A=this.zl.indexOf(e);A!==-1&&this.zl.splice(A,1),this.$t().Gl(this)}Qh(){return this.$l}Ct(){const e=this.ha();return e===null?null:{Vt:e.Vt[3],la:e.ot}}ha(){const e=this.$t().St().Xs();if(e===null)return null;const A=e.Os();return this.zt.ll(A,1)}In(){return this.zt}ph(e){const A=this.zt.Gh(e);return A===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:A.Vt[0],Me:A.Vt[1],xe:A.Vt[2],Se:A.Vt[3]}:A.Vt[3]}aa(e){const A=[];ps(this.Hl,gs,"top",A);const t=this.El;return t!==null&&t.yt()&&(this.jl===null&&t.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),t.Ur(),A.unshift(t)),A}Pn(){const e=[];this._a()||e.push(this.Ll),e.push(this.wn,this.jh,this.dn);const A=this.zl.map((t=>t.qh()));return e.push(...A),ps(this.Hl,gs,"normal",e),e}ua(){return this.ca(gs,"bottom")}da(e){return this.ca(qf,e)}fa(e){return this.ca(Yf,e)}va(e,A){return this.Hl.map((t=>t.wr(e,A))).filter((t=>t!==null))}Ji(e){return[this.Hh,...this.zl.map((A=>A.Yh()))]}Rn(e,A){if(A!==this.Yi&&!this._a())return[];const t=[...this.rn];for(const i of this.zl)t.push(i.Zh());return this.Hl.forEach((i=>{t.push(...i.Rn())})),t}Qi(){const e=[];return this.Hl.forEach((A=>{e.push(...A.Qi())})),e}Il(e,A){if(this.cn.autoscaleInfoProvider!==void 0){const t=this.cn.autoscaleInfoProvider((()=>{const i=this.pa(e,A);return i===null?null:i.Bh()}));return Ui.Ah(t)}return this.pa(e,A)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;this.wn.bt(),this.dn.bt();for(const A of this.rn)A.bt();for(const A of this.zl)A.bt();this.jh.bt(),this.Ll.bt(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((A=>A.Vn()))}Dt(){return ue(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const A=this.zt.Gh(e);return A===null?null:{_t:A.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(e)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(e){this.Hl.push(new Zf(e,this))}ya(e){this.Hl=this.Hl.filter((A=>A.Ol()!==e))}Ca(){if(this.wn instanceof us)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof us)return e=>this.wn.je(e)}_a(){return!Ti(this.Dt().Pa())}pa(e,A){if(!Fr(e)||!Fr(A)||this.zt.Ni())return null;const t=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],i=this.zt.ol(e,A,t);let n=i!==null?new DA(i.ml,i.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,a=new DA(o,o);n=n!==null?n.ts(a):a}let s=this.dn.uh();return this.Hl.forEach((o=>{const a=o.Il(e,A);if(a?.priceRange){const y=new DA(a.priceRange.minValue,a.priceRange.maxValue);n=n!==null?n.ts(y):y}var l,c,d,p;a?.margins&&(l=s,c=a.margins,s={above:Math.max((d=l?.above)!==null&&d!==void 0?d:0,c.above),below:Math.max((p=l?.below)!==null&&p!==void 0?p:0,c.below)})})),new Ui(n,s)}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 e=this.cn.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(e){switch(this.$l){case"Line":case"Area":case"Baseline":{const A=this.cn.crosshairMarkerBackgroundColor;if(A.length!==0)return A}}return this.Us().$s(e).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new nf(this.cn.priceFormat.precision);break;case"percent":this.wa=new Oa(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new Qi(e,this.cn.priceFormat.minMove*e)}}this.Yi!==null&&this.Yi.Ra()}Ql(){const e=this.$t().St();if(!e.Da()||this.zt.Ni())return void(this.Wl=[]);const A=ue(this.zt.el());this.Wl=this.Fl.map(((t,i)=>{const n=ue(e.Va(t.time,!0)),s=n<A?1:-1;return{time:ue(this.zt.ll(n,s)).ee,position:t.position,shape:t.shape,color:t.color,id:t.id,th:i,text:t.text,size:t.size,originalTime:t.originalTime}}))}ql(e){switch(this.dn=new kf(this,this.$t()),this.$l){case"Bar":this.wn=new ff(this,this.$t());break;case"Candlestick":this.wn=new wf(this,this.$t());break;case"Line":this.wn=new Tf(this,this.$t());break;case"Custom":this.wn=new us(this,this.$t(),LA(e));break;case"Area":this.wn=new uf(this,this.$t());break;case"Baseline":this.wn=new mf(this,this.$t());break;case"Histogram":this.wn=new bf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,A){const t=[];return ps(this.Hl,e,A,t),t}}class jf{constructor(e){this.cn=e}Oa(e,A,t){let i=e;if(this.cn.mode===0)return i;const n=t.vn(),s=n.Ct();if(s===null)return i;const o=n.Rt(e,s),a=t.Ba().filter((c=>c instanceof ms)).reduce(((c,d)=>{if(t.vr(d)||!d.yt())return c;const p=d.Dt(),y=d.In();if(p.Ni()||!y.Kr(A))return c;const w=y.Gh(A);if(w===null)return c;const C=rr(d.Ct());return c.concat([p.Rt(w.Vt[3],C.Vt)])}),[]);if(a.length===0)return i;a.sort(((c,d)=>Math.abs(c-o)-Math.abs(d-o)));const l=a[0];return i=n.pn(l,s),i}}class ep extends At{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:A,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.zt===null)return;const n=Math.max(1,Math.floor(t));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=ue(this.zt);if(s.Aa){e.strokeStyle=s.Ia,zt(e,s.za),e.beginPath();for(const o of s.La){const a=Math.round(o.Ea*t);e.moveTo(a,-n),e.lineTo(a,A.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,zt(e,s.Wa),e.beginPath();for(const o of s.ja){const a=Math.round(o.Ea*i);e.moveTo(-n,a),e.lineTo(A.width+n,a)}e.stroke()}}))}}class Ap{constructor(e){this.Wt=new ep,this.ft=!0,this.tn=e}bt(){this.ft=!0}gt(){if(this.ft){const e=this.tn.$t().W().grid,A={Na:e.horzLines.visible,Aa:e.vertLines.visible,Fa:e.horzLines.color,Ia:e.vertLines.color,Wa:e.horzLines.style,za:e.vertLines.style,ja:this.tn.vn().Ha(),La:(this.tn.$t().St().Ha()||[]).map((t=>({Ea:t.coord})))};this.Wt.J(A),this.ft=!1}return this.Wt}}class tp{constructor(e){this.wn=new Ap(e)}qh(){return this.wn}}const Bs={$a:4,Ua:1e-4};function nr(r,e){const A=100*(r-e)/e;return e<0?-A:A}function rp(r,e){const A=nr(r.Ph(),e),t=nr(r.Rh(),e);return new DA(A,t)}function Ir(r,e){const A=100*(r-e)/e+100;return e<0?-A:A}function ip(r,e){const A=Ir(r.Ph(),e),t=Ir(r.Rh(),e);return new DA(A,t)}function Si(r,e){const A=Math.abs(r);if(A<1e-15)return 0;const t=Math.log10(A+e.Ua)+e.$a;return r<0?-t:t}function _r(r,e){const A=Math.abs(r);if(A<1e-15)return 0;const t=Math.pow(10,A-e.$a)-e.Ua;return r<0?-t:t}function Dr(r,e){if(r===null)return null;const A=Si(r.Ph(),e),t=Si(r.Rh(),e);return new DA(A,t)}function Hi(r,e){if(r===null)return null;const A=_r(r.Ph(),e),t=_r(r.Rh(),e);return new DA(A,t)}function ws(r){if(r===null)return Bs;const e=Math.abs(r.Rh()-r.Ph());if(e>=1||e<1e-15)return Bs;const A=Math.ceil(Math.abs(Math.log10(e))),t=Bs.$a+A;return{$a:t,Ua:1/Math.pow(10,t)}}class Cs{constructor(e,A){if(this.qa=e,this.Ya=A,(function(t){if(t<0)return!1;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let t=this.qa;t!==1;){if(t%2==0)this.Za.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),t/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,A,t){const i=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-A)))),s=0,o=this.Ya[0];for(;;){const d=xi(n,i,1e-14)&&n>i+1e-14,p=xi(n,t*o,1e-14),y=xi(n,1,1e-14);if(!(d&&p&&y))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=i+1e-14&&(n=i),n=Math.max(1,n),this.Za.length>0&&(a=n,l=1,c=1e-14,Math.abs(a-l)<c))for(s=0,o=this.Za[0];xi(n,t*o,1e-14)&&n>i+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var a,l,c;return n}}class ol{constructor(e,A,t,i){this.Ka=[],this.Li=e,this.qa=A,this.Ga=t,this.Ja=i}Xa(e,A){if(e<A)throw new Error("high < low");const t=this.Li.At(),i=(e-A)*this.Qa()/t,n=new Cs(this.qa,[2,2.5,2]),s=new Cs(this.qa,[2,2,2.5]),o=new Cs(this.qa,[2.5,2,2]),a=[];return a.push(n.Xa(e,A,i),s.Xa(e,A,i),o.Xa(e,A,i)),(function(l){if(l.length<1)throw Error("array is empty");let c=l[0];for(let d=1;d<l.length;++d)l[d]<c&&(c=l[d]);return c})(a)}io(){const e=this.Li,A=e.Ct();if(A===null)return void(this.Ka=[]);const t=e.At(),i=this.Ga(t-1,A),n=this.Ga(0,A),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,a=t-1-s,l=Math.max(i,n),c=Math.min(i,n);if(l===c)return void(this.Ka=[]);let d=this.Xa(l,c),p=l%d;p+=p<0?d:0;const y=l>=c?1:-1;let w=null,C=0;for(let v=l-p;v>c;v-=d){const S=this.Ja(v,A,!0);w!==null&&Math.abs(S-w)<this.Qa()||S<o||S>a||(C<this.Ka.length?(this.Ka[C].Ea=S,this.Ka[C].so=e.eo(v)):this.Ka.push({Ea:S,so:e.eo(v)}),C++,w=S,e.ro()&&(d=this.Xa(v*y,c)))}this.Ka.length=C}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function al(r){return r.slice().sort(((e,A)=>ue(e.Xi())-ue(A.Xi())))}var ll;(function(r){r[r.Normal=0]="Normal",r[r.Logarithmic=1]="Logarithmic",r[r.Percentage=2]="Percentage",r[r.IndexedTo100=3]="IndexedTo100"})(ll||(ll={}));const cl=new Oa,hl=new Qi(100,1);class np{constructor(e,A,t,i){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 uA,this.vo=new uA,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=hl,this.xo=ws(null),this.So=e,this.cn=A,this.ko=t,this.yo=i,this.Co=new ol(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(et(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const A=LA(e.scaleMargins.top),t=LA(e.scaleMargins.bottom);if(A<0||A>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${A}`);if(t<0||t>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${t}`);if(A+t>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${A+t}`);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(e){const A=this.Cr();let t=null;e.Wn!==void 0&&(this.cn.autoScale=e.Wn),e.Cr!==void 0&&(this.cn.mode=e.Cr,e.Cr!==2&&e.Cr!==3||(this.cn.autoScale=!0),this.oo._o=!1),A.Cr===1&&e.Cr!==A.Cr&&((function(n,s){if(n===null)return!1;const o=_r(n.Ph(),s),a=_r(n.Rh(),s);return isFinite(o)&&isFinite(a)})(this.Ih,this.xo)?(t=Hi(this.Ih,this.xo),t!==null&&this.Ao(t)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==A.Cr&&(t=Dr(this.Ih,this.xo),t!==null&&this.Ao(t));const i=A.Cr!==this.cn.mode;i&&(A.Cr===2||this.Mh())&&this.Ra(),i&&(A.Cr===3||this.Oo())&&this.Ra(),e.Bo!==void 0&&A.Bo!==e.Bo&&(this.cn.invertScale=e.Bo,this.Io()),this.vo.m(A,this.Cr())}zo(){return this.vo}P(){return this.ko.fontSize}At(){return this.ho}Lo(e){this.ho!==e&&(this.ho=e,this.Do(),this.bo=null)}Eo(){if(this.lo)return this.lo;const e=this.At()-this.No()-this.Fo();return this.lo=e,e}Lh(){return this.Wo(),this.Ih}Ao(e,A){const t=this.Ih;(A||t===null&&e!==null||t!==null&&!t.Ch(e))&&(this.bo=null,this.Ih=e)}Ni(){return this.Wo(),this.ho===0||!this.Ih||this.Ih.Ni()}jo(e){return this.Bo()?e:this.At()-1-e}Rt(e,A){return this.Mh()?e=nr(e,A):this.Oo()&&(e=Ir(e,A)),this.Po(e,A)}te(e,A,t){this.Wo();const i=this.Fo(),n=ue(this.Lh()),s=n.Ph(),o=n.Rh(),a=this.Eo()-1,l=this.Bo(),c=a/(o-s),d=t===void 0?0:t.from,p=t===void 0?e.length:t.to,y=this.Ho();for(let w=d;w<p;w++){const C=e[w],v=C._t;if(isNaN(v))continue;let S=v;y!==null&&(S=y(C._t,A));const F=i+c*(S-s),k=l?F:this.ho-1-F;C.st=k}}be(e,A,t){this.Wo();const i=this.Fo(),n=ue(this.Lh()),s=n.Ph(),o=n.Rh(),a=this.Eo()-1,l=this.Bo(),c=a/(o-s),d=t===void 0?0:t.from,p=t===void 0?e.length:t.to,y=this.Ho();for(let w=d;w<p;w++){const C=e[w];let v=C.ge,S=C.Me,F=C.xe,k=C.Se;y!==null&&(v=y(C.ge,A),S=y(C.Me,A),F=y(C.xe,A),k=y(C.Se,A));let x=i+c*(v-s),V=l?x:this.ho-1-x;C.pe=V,x=i+c*(S-s),V=l?x:this.ho-1-x,C.de=V,x=i+c*(F-s),V=l?x:this.ho-1-x,C.fe=V,x=i+c*(k-s),V=l?x:this.ho-1-x,C.me=V}}pn(e,A){const t=this.To(e,A);return this.$o(t,A)}$o(e,A){let t=e;return this.Mh()?t=(function(i,n){return n<0&&(i=-i),i/100*n+n})(t,A):this.Oo()&&(t=(function(i,n){return i-=100,n<0&&(i=-i),i/100*n+n})(t,A)),t}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let A=0;A<this.po.length;A++){const t=this.po[A];t.Xi()===null&&t.Ki(A+1),e.push(t)}return e=al(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const A=this.po.indexOf(e);if(A===-1)throw new Error("source is not attached to scale");this.po.splice(A,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const A of this.po){const t=A.Ct();t!==null&&(e===null||t.la<e.la)&&(e=t)}return e===null?null:e.Vt}Bo(){return this.cn.invertScale}Ha(){const e=this.Ct()===null;if(this.bo!==null&&(e||this.bo.Xo===e))return this.bo.Ha;this.Co.io();const A=this.Co.Ha();return this.bo={Ha:A,Xo:e},this.fo.m(),A}Ko(){return this.fo}Go(e){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-e,this.ao=ue(this.Lh()).Th()))}Jo(e){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(e=this.ho-e)<0&&(e=0);let A=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const t=ue(this.ao).Th();A=Math.max(A,.1),t.Vh(A),this.Ao(t)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(e){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=e,this.ao=ue(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const A=ue(this.Lh()).Dh()/(this.Eo()-1);let t=e-this.Mo;this.Bo()&&(t*=-1);const i=t*A,n=ue(this.ao).Th();n.Oh(i),this.Ao(n,!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(e,A){switch(this.cn.mode){case 2:return this.s_(nr(e,A));case 3:return this.ba().format(Ir(e,A));default:return this.Wh(e)}}eo(e){switch(this.cn.mode){case 2:return this.s_(e);case 3:return this.ba().format(e);default:return this.Wh(e)}}Yl(e){return this.Wh(e,ue(this.e_()).ba())}Zl(e,A){return e=nr(e,A),this.s_(e,cl)}r_(){return this.po}h_(e){this.oo={uo:e,_o:!1}}Vn(){this.po.forEach((e=>e.Vn()))}Ra(){this.bo=null;const e=this.e_();let A=100;e!==null&&(A=Math.round(1/e.ma())),this.wa=hl,this.Mh()?(this.wa=cl,A=100):this.Oo()?(this.wa=new Qi(100,1),A=100):e!==null&&(this.wa=e.ba()),this.Co=new ol(this,A,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(e,A){if(this.Wo(),this.Ni())return 0;e=this.ro()&&e?Si(e,this.xo):e;const t=ue(this.Lh()),i=this.Fo()+(this.Eo()-1)*(e-t.Ph())/t.Dh();return this.jo(i)}To(e,A){if(this.Wo(),this.Ni())return 0;const t=this.jo(e),i=ue(this.Lh()),n=i.Ph()+i.Dh()*((t-this.Fo())/(this.Eo()-1));return this.ro()?_r(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let A=null;const t=this.r_();let i=0,n=0;for(const a of t){if(!a.yt())continue;const l=a.Ct();if(l===null)continue;const c=a.Il(e.Os(),e.ui());let d=c&&c.Lh();if(d!==null){switch(this.cn.mode){case 1:d=Dr(d,this.xo);break;case 2:d=rp(d,l.Vt);break;case 3:d=ip(d,l.Vt)}if(A=A===null?d:A.ts(ue(d)),c!==null){const p=c.Eh();p!==null&&(i=Math.max(i,p.above),n=Math.max(n,p.below))}}}if(i===this.co&&n===this.do||(this.co=i,this.do=n,this.bo=null,this.Do()),A!==null){if(A.Ph()===A.Rh()){const a=this.e_(),l=5*(a===null||this.Mh()||this.Oo()?1:a.ma());this.ro()&&(A=Hi(A,this.xo)),A=new DA(A.Ph()-l,A.Rh()+l),this.ro()&&(A=Dr(A,this.xo))}if(this.ro()){const a=Hi(A,this.xo),l=ws(a);if(s=l,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const c=this.ao!==null?Hi(this.ao,this.xo):null;this.xo=l,A=Dr(a,l),c!==null&&(this.ao=Dr(c,l))}}this.Ao(A)}else this.Ih===null&&(this.Ao(new DA(-.5,.5)),this.xo=ws(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?nr:this.Oo()?Ir:this.ro()?e=>Si(e,this.xo):null}a_(e,A,t){return A===void 0?(t===void 0&&(t=this.ba()),t.format(e)):A(e)}Wh(e,A){return this.a_(e,this.yo.priceFormatter,A)}s_(e,A){return this.a_(e,this.yo.percentageFormatter,A)}}class sp{constructor(e,A){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new uA,this.yl=e,this.$i=A,this.d_=new tp(this);const t=A.W();this.f_=this.v_("left",t.leftPriceScale),this.p_=this.v_("right",t.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_(t)}b_(e){if(e.leftPriceScale&&this.f_.$h(e.leftPriceScale),e.rightPriceScale&&this.p_.$h(e.rightPriceScale),e.localization&&(this.f_.Ra(),this.p_.Ra()),e.overlayPriceScales){const A=Array.from(this.o_.values());for(const t of A){const i=ue(t[0].Dt());i.$h(e.overlayPriceScales),e.localization&&i.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?LA(this.o_.get(e))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((e=>{e.S&&e.S()})),this.c_.m()}M_(){return this.u_}x_(e){this.u_=e}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(e){this.__=e,this.k_()}Lo(e){this.ho=e,this.f_.Lo(e),this.p_.Lo(e),this.po.forEach((A=>{if(this.vr(A)){const t=A.Dt();t!==null&&t.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const A=e.Dt();return A===null||this.f_!==A&&this.p_!==A}qo(e,A,t){const i=t!==void 0?t:this.C_().y_+1;this.T_(e,A,i)}Zo(e){const A=this.po.indexOf(e);Ft(A!==-1,"removeDataSource: invalid data source"),this.po.splice(A,1);const t=ue(e.Dt()).Pa();if(this.o_.has(t)){const n=LA(this.o_.get(t)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(t))}const i=e.Dt();i&&i.Ba().indexOf(e)>=0&&i.Zo(e),i!==null&&(i.Yo(),this.P_(i)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,A){e.Go(A)}O_(e,A){e.Jo(A),this.k_()}B_(e){e.Qo()}A_(e,A){e.t_(A)}I_(e,A){e.i_(A),this.k_()}z_(e){e.n_()}k_(){this.po.forEach((e=>{e.Vn()}))}vn(){let e=null;return this.$i.W().rightPriceScale.visible&&this.p_.Ba().length!==0?e=this.p_:this.$i.W().leftPriceScale.visible&&this.f_.Ba().length!==0?e=this.f_:this.po.length!==0&&(e=this.po[0].Dt()),e===null&&(e=this.p_),e}pr(){let e=null;return this.$i.W().rightPriceScale.visible?e=this.p_:this.$i.W().leftPriceScale.visible&&(e=this.f_),e}P_(e){e!==null&&e.Vo()&&this.L_(e)}E_(e){const A=this.yl.Xs();e.Ro({Wn:!0}),A!==null&&e.h_(A),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((e=>{this.vr(e)&&this.P_(e.Dt())})),this.k_(),this.$i.Uh()}Uo(){return this.mo===null&&(this.mo=al(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(e){const A=e.r_();if(A&&A.length>0&&!this.yl.Ni()){const t=this.yl.Xs();t!==null&&e.h_(t)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let A=0,t=0;for(let i=0;i<e.length;i++){const n=e[i].Xi();n!==null&&(n<A&&(A=n),n>t&&(t=n))}return{H_:A,y_:t}}T_(e,A,t){let i=this.w_(A);if(i===null&&(i=this.v_(A,this.$i.W().overlayPriceScales)),this.po.push(e),!Ti(A)){const n=this.o_.get(A)||[];n.push(e),this.o_.set(A,n)}i.qo(e),e.Gi(i),e.Ki(t),this.P_(i),this.mo=null}m_(e,A,t){A.Cr!==t.Cr&&this.L_(e)}v_(e,A){const t=Object.assign({visible:!0,autoScale:!0},Ct(A)),i=new np(e,t,this.$i.W().layout,this.$i.W().localization);return i.Lo(this.At()),i}}class op{constructor(e,A,t=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=e,this.q_=A,this.ir=t}Y_(e){const A=e.time,t=this.q_.cacheKey(A),i=this.tr.get(t);if(i!==void 0)return i.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(LA(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(t,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,t),this.Ke++,this.Ge++,n}}class kr{constructor(e,A){Ft(e<=A,"right should be >= left"),this.X_=e,this.K_=A}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(e){return this.X_<=e&&e<=this.K_}Ch(e){return this.X_===e.Os()&&this.K_===e.ui()}}function ul(r,e){return r===null||e===null?r===e:r.Ch(e)}class ap{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(e){this.Q_=e,this.tr=null}iu(e,A){this.nu(A),this.tr=null;for(let t=A;t<e.length;++t){const i=e[t];let n=this.J_.get(i.timeWeight);n===void 0&&(n=[],this.J_.set(i.timeWeight,n)),n.push({index:t,time:i.time,weight:i.timeWeight,originalTime:i.originalTime})}}su(e,A){const t=Math.ceil(A/e);return this.tr!==null&&this.tr.eu===t||(this.tr={Ha:this.ru(t),eu:t}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const A=[];this.J_.forEach(((t,i)=>{e<=t[0].index?A.push(i):t.splice(Sr(t,e,(n=>n.index<e)),1/0)}));for(const t of A)this.J_.delete(t)}ru(e){let A=[];for(const t of Array.from(this.J_.keys()).sort(((i,n)=>n-i))){if(!this.J_.get(t))continue;const i=A;A=[];const n=i.length;let s=0;const o=LA(this.J_.get(t)),a=o.length;let l=1/0,c=-1/0;for(let d=0;d<a;d++){const p=o[d],y=p.index;for(;s<n;){const w=i[s],C=w.index;if(!(C<y)){l=C;break}s++,A.push(w),c=C,l=1/0}if(l-y>=e&&y-c>=e)A.push(p),c=y;else if(this.Q_)return i}for(;s<n;s++)A.push(i[s])}return A}}class sr{constructor(e){this.hu=e}lu(){return this.hu===null?null:new kr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new sr(null)}}function lp(r,e){return r.weight>e.weight?r:e}class cp{constructor(e,A,t,i){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new ap,this.du=new Map,this.fu=sr.ou(),this.vu=!0,this.pu=new uA,this.mu=new uA,this.bu=new uA,this.wu=null,this.gu=null,this.Mu=[],this.cn=A,this.yo=t,this.xu=A.rightOffset,this.Su=A.barSpacing,this.$i=e,this.q_=i,this.ku(),this.cu.tu(A.uniformDistribution)}W(){return this.cn}yu(e){et(this.yo,e),this.Cu(),this.ku()}$h(e,A){var t;et(this.cn,e),this.cn.fixLeftEdge&&this.Tu(),this.cn.fixRightEdge&&this.Pu(),e.barSpacing!==void 0&&this.$i.Gn(e.barSpacing),e.rightOffset!==void 0&&this.$i.Jn(e.rightOffset),e.minBarSpacing!==void 0&&this.$i.Gn((t=e.barSpacing)!==null&&t!==void 0?t:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var A,t;return(t=(A=this.uu[e])===null||A===void 0?void 0:A.time)!==null&&t!==void 0?t:null}Ui(e){var A;return(A=this.uu[e])!==null&&A!==void 0?A:null}Va(e,A){if(this.uu.length<1)return null;if(this.q_.key(e)>this.q_.key(this.uu[this.uu.length-1].time))return A?this.uu.length-1:null;const t=Sr(this.uu,this.q_.key(e),((i,n)=>this.q_.key(i.time)<n));return this.q_.key(e)<this.q_.key(this.uu[t].time)?A?t:null:t}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 e=this.Xs();if(e===null)return null;const A={from:e.Os(),to:e.ui()};return this.Ou(A)}Ou(e){const A=Math.round(e.from),t=Math.round(e.to),i=ue(this.Bu()),n=ue(this.Au());return{from:ue(this.Ui(Math.max(i,A))),to:ue(this.Ui(Math.min(n,t)))}}Iu(e){return{from:ue(this.Va(e.from,!0)),to:ue(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const A=this.Du(),t=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&t!==0){const i=this.Su*e/t;this.Su=i}if(this.cn.fixLeftEdge&&A!==null&&A.Os()<=0){const i=t-e;this.xu-=Math.round(i/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!Fr(e))return 0;const A=this.Eu()+this.xu-e;return this.__-(A+.5)*this.Su-1}Qs(e,A){const t=this.Eu(),i=A===void 0?0:A.from,n=A===void 0?e.length:A.to;for(let s=i;s<n;s++){const o=e[s].ot,a=t+this.xu-o,l=this.__-(a+.5)*this.Su-1;e[s].nt=l}}Nu(e){return Math.ceil(this.Fu(e))}Jn(e){this.vu=!0,this.xu=e,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(e){this.ju(e),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 e=this.Su,A=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),t=Math.round(A/e),i=ue(this.Xs()),n=Math.max(i.Os(),i.Os()-t),s=Math.max(i.ui(),i.ui()-t),o=this.cu.su(e,A),a=this.Bu()+t,l=this.Au()-t,c=this.$u(),d=this.cn.fixLeftEdge||c,p=this.cn.fixRightEdge||c;let y=0;for(const w of o){if(!(n<=w.index&&w.index<=s))continue;let C;y<this.Mu.length?(C=this.Mu[y],C.coord=this.It(w.index),C.label=this.Uu(w),C.weight=w.weight):(C={needAlignCoordinate:!1,coord:this.It(w.index),label:this.Uu(w),weight:w.weight},this.Mu.push(C)),this.Su>A/2&&!c?C.needAlignCoordinate=!1:C.needAlignCoordinate=d&&w.index<=a||p&&w.index>=l,y++}return this.Mu.length=y,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,A){const t=this.Fu(e),i=this.le(),n=i+A*(i/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(t-this.Fu(e)))}Go(e){this.Mo&&this.n_(),this.wo===null&&this.wu===null&&(this.Ni()||(this.wo=e,this.Xu()))}Jo(e){if(this.wu===null)return;const A=ls(this.__-e,0,this.__),t=ls(this.__-ue(this.wo),0,this.__);A!==0&&t!==0&&this.Gn(this.wu.le*A/t)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(e){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=e,this.Xu()))}i_(e){if(this.Mo===null)return;const A=(this.Mo-e)/this.le();this.xu=ue(this.wu).Hu+A,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,A=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(A)||A<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const t=this.xu,i=performance.now();this.$i.Zn({Qu:n=>(n-i)/A>=1,tc:n=>{const s=(n-i)/A;return s>=1?e:t+(e-t)*s}})}bt(e,A){this.vu=!0,this.uu=e,this.cu.iu(e,A),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const A=e.G_();this.ju(this.__/A),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),A=this.Au();e!==null&&A!==null&&this.rc(new kr(e,A+this.cn.rightOffset))}lc(e){const A=new kr(e.from,e.to);this.rc(A)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:A}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||A.axisDoubleClickReset.time||A.axisPressedMouseMove.time||A.mouseWheel||A.pinch)}Bu(){return this.uu.length===0?null:0}Au(){return this.uu.length===0?null:this.uu.length-1}ac(e){return(this.__-1-e)/this.Su}Fu(e){const A=this.ac(e),t=this.Eu()+this.xu-A;return Math.round(1e6*t)/1e6}ju(e){const A=this.Su;this.Su=e,this.zu(),A!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(sr.ou());const e=this.Eu(),A=this.__/this.Su,t=this.xu+e,i=new kr(t-A+1,t);this._c(new sr(i))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const A=.5*this.__;this.Su>A&&(this.Su=A,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.uu.length!==0?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const e=this.cc();e!==null&&this.xu<e&&(this.xu=e,this.vu=!0);const A=this.dc();this.xu>A&&(this.xu=A,this.vu=!0)}cc(){const e=this.Bu(),A=this._u;return e===null||A===null?null:e-A-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(e){let A=this.du.get(e.weight);return A===void 0&&(A=new op((t=>this.fc(t)),this.q_),this.du.set(e.weight,A)),A.Y_(e)}fc(e){return this.q_.formatTickmark(e,this.yo)}_c(e){const A=this.fu;this.fu=e,ul(A.lu(),this.fu.lu())||this.pu.m(),ul(A.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 e=this.Bu();if(e===null)return;const A=this.Xs();if(A===null)return;const t=A.Os()-e;if(t<0){const i=this.xu-t-1;this.Jn(i)}this.zu()}Pu(){this.Lu(),this.zu()}}class hp{X(e,A,t){e.useMediaCoordinateSpace((i=>this.K(i,A,t)))}gl(e,A,t){e.useMediaCoordinateSpace((i=>this.vc(i,A,t)))}vc(e,A,t){}}class up extends hp{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:A,mediaSize:t}=e;let i=0;for(const s of this.zt.bc){if(s.Kt.length===0)continue;A.font=s.R;const o=this.wc(A,s.Kt);o>t.width?s.Zu=t.width/o:s.Zu=1,i+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((t.height-i)/2,0);break;case"bottom":n=Math.max(t.height-i,0)}A.fillStyle=this.zt.V;for(const s of this.zt.bc){A.save();let o=0;switch(this.zt.xc){case"left":A.textAlign="left",o=s.gc/2;break;case"center":A.textAlign="center",o=t.width/2;break;case"right":A.textAlign="right",o=t.width-1-s.gc/2}A.translate(o,n),A.textBaseline="top",A.font=s.R,A.scale(s.Zu,s.Zu),A.fillText(s.Kt,0,s.Sc),A.restore(),n+=s.gc*s.Zu}}wc(e,A){const t=this.kc(e.font);let i=t.get(A);return i===void 0&&(i=e.measureText(A).width,t.set(A,i)),i}kc(e){let A=this.mc.get(e);return A===void 0&&(A=new Map,this.mc.set(e,A)),A}}class dp{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new up(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.W(),A=this.Ft;A.yt=e.visible,A.yt&&(A.V=e.color,A.xc=e.horzAlign,A.Mc=e.vertAlign,A.bc=[{Kt:e.text,R:ir(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class fp extends os{constructor(e,A){super(),this.cn=A,this.wn=new dp(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var dl,fl,pl,gl,ml;(function(r){r[r.OnTouchEnd=0]="OnTouchEnd",r[r.OnNextTap=1]="OnNextTap"})(dl||(dl={}));class pp{constructor(e,A,t){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new uA,this.Rc=new uA,this.Dc=null,this.Vc=e,this.cn=A,this.q_=t,this.Oc=new Wd(this),this.yl=new cp(this,A.timeScale,this.cn.localization,t),this.vt=new rf(this,A.crosshair),this.Bc=new jf(A.crosshair),this.Ac=new fp(this,A.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(yA.es())}Uh(){this.Nc(yA.ss())}oa(){this.Nc(new yA(1))}Gl(e){const A=this.Fc(e);this.Nc(A)}Wc(){return this.Tc}jc(e){const A=this.Tc;this.Tc=e,A!==null&&this.Gl(A.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){et(this.cn,e),this.yc.forEach((A=>A.b_(e))),e.timeScale!==void 0&&this.yl.$h(e.timeScale),e.localization!==void 0&&this.yl.yu(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Pc.m(),this.zc=this.Lc(0),this.Ec=this.Lc(1),this.Kl()}$c(e,A){if(e==="left")return void this.$h({leftPriceScale:A});if(e==="right")return void this.$h({rightPriceScale:A});const t=this.Uc(e);t!==null&&(t.Dt.$h(A),this.Pc.m())}Uc(e){for(const A of this.yc){const t=A.w_(e);if(t!==null)return{Ht:A,Dt:t}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(e,A){e.Lo(A),this.Wu()}S_(e){this.__=e,this.yl.S_(this.__),this.yc.forEach((A=>A.S_(e))),this.Wu()}Ic(e){const A=new sp(this.yl,this);e!==void 0?this.yc.splice(e,0,A):this.yc.push(A);const t=e===void 0?this.yc.length-1:e,i=yA.es();return i.Nn(t,{Fn:0,Wn:!0}),this.Nc(i),A}V_(e,A,t){e.V_(A,t)}O_(e,A,t){e.O_(A,t),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,A){e.B_(A),this.Nc(this.Gc(e,2))}A_(e,A,t){A.Vo()||e.A_(A,t)}I_(e,A,t){A.Vo()||(e.I_(A,t),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,A){A.Vo()||(e.z_(A),this.Nc(this.Gc(e,2)))}E_(e,A){e.E_(A),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,A){const t=this.St();if(t.Ni()||A===0)return;const i=t.Hi();e=Math.max(1,Math.min(e,i)),t.Zu(e,A),this.Wu()}td(e){this.nd(0),this.sd(e),this.ed()}rd(e){this.yl.Jo(e),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(e){this.yl.t_(e)}sd(e){this.yl.i_(e),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(e,A,t,i,n){this.vt.gn(e,A);let s=NaN,o=this.yl.Nu(e);const a=this.yl.Xs();a!==null&&(o=Math.min(Math.max(a.Os(),o),a.ui()));const l=i.vn(),c=l.Ct();c!==null&&(s=l.pn(A,c)),s=this.Bc.Oa(s,o,i),this.vt.kn(o,s,i),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:A},t)}ad(e,A,t){const i=t.vn(),n=i.Ct(),s=i.Rt(e,ue(n)),o=this.yl.Va(A,!0),a=this.yl.It(ue(o));this.ld(a,s,null,t,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const A=this.vt.xn(),t=this.vt.Sn();this.ld(A,t,null,e)}this.vt.Vn()}_d(e,A,t){const i=this.yl.mn(0);A!==void 0&&t!==void 0&&this.yl.bt(A,t);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&i!==null&&n!==null){const a=o.Kr(s),l=this.q_.key(i)>this.q_.key(n),c=e!==null&&e>s&&!l,d=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,p=a&&(t!==void 0||d)&&this.yl.W().shiftVisibleRangeOnNewBar;if(c&&!p){const y=e-s;this.yl.Jn(this.yl.Hu()-y)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const A=this.yc.find((t=>t.Uo().includes(e)));return A===void 0?null:A}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.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(e,A,t){const i=this.yc[0],n=this.fd(A,e,i,t);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const A=this.dr(e),t=this.Cc.indexOf(e);Ft(t!==-1,"Series not found"),this.Cc.splice(t,1),ue(A).Zo(e),e.S&&e.S()}Xl(e,A){const t=ue(this.dr(e));t.Zo(e);const i=this.Uc(A);if(i===null){const n=e.Xi();t.qo(e,A,n)}else{const n=i.Ht===t?e.Xi():void 0;i.Ht.qo(e,A,n)}}hc(){const e=yA.ss();e.$n(),this.Nc(e)}pd(e){const A=yA.ss();A.Yn(e),this.Nc(A)}Kn(){const e=yA.ss();e.Kn(),this.Nc(e)}Gn(e){const A=yA.ss();A.Gn(e),this.Nc(A)}Jn(e){const A=yA.ss();A.Jn(e),this.Nc(A)}Zn(e){const A=yA.ss();A.Zn(e),this.Nc(A)}Un(){const e=yA.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const A=this.Ec,t=this.zc;if(A===t)return A;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==t||this.Dc.Rs!==A)this.Dc={Ps:t,Rs:A,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const i=(function(n,s,o){const[a,l,c,d]=xr(n),[p,y,w,C]=xr(s),v=[$A(a+o*(p-a)),$A(l+o*(y-l)),$A(c+o*(w-c)),Ea(d+o*(C-d))];return`rgba(${v[0]}, ${v[1]}, ${v[2]}, ${v[3]})`})(t,A,e/100);return this.Dc.wd.set(e,i),i}Gc(e,A){const t=new yA(A);if(e!==null){const i=this.yc.indexOf(e);t.Nn(i,{Fn:A})}return t}Fc(e,A){return A===void 0&&(A=2),this.Gc(this.dr(e),A)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((A=>A.j_().qh().bt()))}fd(e,A,t,i){const n=new ms(this,e,A,t,i),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return t.qo(n,s),Ti(s)||n.$h(e),n}Lc(e){const A=this.cn.layout;return A.background.type==="gradient"?e===0?A.background.topColor:A.background.bottomColor:A.background.color}}function vs(r){return!ot(r)&&!Ur(r)}function Bl(r){return ot(r)}(function(r){r[r.Disabled=0]="Disabled",r[r.Continuous=1]="Continuous",r[r.OnDataUpdate=2]="OnDataUpdate"})(fl||(fl={})),(function(r){r[r.LastBar=0]="LastBar",r[r.LastVisible=1]="LastVisible"})(pl||(pl={})),(function(r){r.Solid="solid",r.VerticalGradient="gradient"})(gl||(gl={})),(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"})(ml||(ml={}));const wl=r=>r.getUTCFullYear();function gp(r,e,A){return e.replace(/yyyy/g,(t=>vt(wl(t),4))(r)).replace(/yy/g,(t=>vt(wl(t)%100,2))(r)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(r,A)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(r,A)).replace(/MM/g,(t=>vt((i=>i.getUTCMonth()+1)(t),2))(r)).replace(/dd/g,(t=>vt((i=>i.getUTCDate())(t),2))(r))}class Cl{constructor(e="yyyy-MM-dd",A="default"){this.gd=e,this.Md=A}Y_(e){return gp(e,this.gd,this.Md)}}class mp{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",vt(e.getUTCHours(),2)).replace("%m",vt(e.getUTCMinutes(),2)).replace("%s",vt(e.getUTCSeconds(),2))}}const Bp={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class wp{constructor(e={}){const A=Object.assign(Object.assign({},Bp),e);this.Td=new Cl(A.Sd,A.Cd),this.Pd=new mp(A.kd),this.Rd=A.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function Li(r){return 60*r*60*1e3}function ys(r){return 60*r*1e3}const Mi=[{Dd:(vl=1,1e3*vl),Vd:10},{Dd:ys(1),Vd:20},{Dd:ys(5),Vd:21},{Dd:ys(30),Vd:22},{Dd:Li(1),Vd:30},{Dd:Li(3),Vd:31},{Dd:Li(6),Vd:32},{Dd:Li(12),Vd:33}];var vl;function yl(r,e){if(r.getUTCFullYear()!==e.getUTCFullYear())return 70;if(r.getUTCMonth()!==e.getUTCMonth())return 60;if(r.getUTCDate()!==e.getUTCDate())return 50;for(let A=Mi.length-1;A>=0;--A)if(Math.floor(e.getTime()/Mi[A].Dd)!==Math.floor(r.getTime()/Mi[A].Dd))return Mi[A].Vd;return 0}function bs(r){let e=r;if(Ur(r)&&(e=Ts(r)),!vs(e))throw new Error("time must be of type BusinessDay");const A=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(A.getTime()/1e3),Bd:e}}function bl(r){if(!Bl(r))throw new Error("time must be of type isUTCTimestamp");return{Od:r}}function Ts(r){const e=new Date(r);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${r}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function Tl(r){Ur(r.time)&&(r.time=Ts(r.time))}class Ql{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(A){A.forEach(Tl)})(e):Tl(e)}createConverterToInternalObj(e){return ue((function(A){return A.length===0?null:vs(A[0].time)||Ur(A[0].time)?bs:bl})(e))}key(e){return typeof e=="object"&&"Od"in e?e.Od:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const A=e;return A.Bd===void 0?new Date(1e3*A.Od).getTime():new Date(Date.UTC(A.Bd.year,A.Bd.month-1,A.Bd.day)).getTime()}convertHorzItemToInternal(e){return Bl(A=e)?bl(A):vs(A)?bs(A):bs(Ts(A));var A}updateFormatter(e){if(!this.cn)return;const A=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new wp({Sd:A,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Cl(A,e.locale)}formatHorzItem(e){const A=e;return this.Ad.Y_(new Date(1e3*A.Od))}formatTickmark(e,A){const t=(function(n,s,o){switch(n){case 0:case 10:return s?o?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return s?3:2;case 50:return 2;case 60:return 1;case 70:return 0}})(e.weight,this.cn.timeScale.timeVisible,this.cn.timeScale.secondsVisible),i=this.cn.timeScale;if(i.tickMarkFormatter!==void 0){const n=i.tickMarkFormatter(e.originalTime,t,A.locale);if(n!==null)return n}return(function(n,s,o){const a={};switch(s){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=n.Bd===void 0?new Date(1e3*n.Od):new Date(Date.UTC(n.Bd.year,n.Bd.month-1,n.Bd.day));return new Date(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()).toLocaleString(o,a)})(e.time,t,A.locale)}maxTickMarkWeight(e){let A=e.reduce(lp,e[0]).weight;return A>30&&A<50&&(A=30),A}fillWeightsForPoints(e,A){(function(t,i=0){if(t.length===0)return;let n=i===0?null:t[i-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let a=i;a<t.length;++a){const l=t[a],c=new Date(1e3*l.time.Od);s!==null&&(l.timeWeight=yl(c,s)),o+=l.time.Od-(n||l.time.Od),n=l.time.Od,s=c}if(i===0&&t.length>1){const a=Math.ceil(o/(t.length-1)),l=new Date(1e3*(t[0].time.Od-a));t[0].timeWeight=yl(new Date(1e3*t[0].time.Od),l)}})(e,A)}static Id(e){return et({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const or=typeof window<"u";function xl(){return!!or&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Qs(){return!!or&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function xs(r){return r+r%2}function Fs(r,e){return r.zd-e.zd}function Us(r,e,A){const t=(r.zd-e.zd)/(r.ot-e.ot);return Math.sign(t)*Math.min(Math.abs(t),A)}class Cp{constructor(e,A,t,i){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=e,this.Ud=A,this.qd=t,this.rs=i}Yd(e,A){if(this.Ld!==null){if(this.Ld.ot===A)return void(this.Ld.zd=e);if(Math.abs(this.Ld.zd-e)<this.rs)return}this.Fd=this.Nd,this.Nd=this.Ed,this.Ed=this.Ld,this.Ld={ot:A,zd:e}}Vr(e,A){if(this.Ld===null||this.Ed===null||A-this.Ld.ot>50)return;let t=0;const i=Us(this.Ld,this.Ed,this.Ud),n=Fs(this.Ld,this.Ed),s=[i],o=[n];if(t+=n,this.Nd!==null){const l=Us(this.Ed,this.Nd,this.Ud);if(Math.sign(l)===Math.sign(i)){const c=Fs(this.Ed,this.Nd);if(s.push(l),o.push(c),t+=c,this.Fd!==null){const d=Us(this.Nd,this.Fd,this.Ud);if(Math.sign(d)===Math.sign(i)){const p=Fs(this.Nd,this.Fd);s.push(d),o.push(p),t+=p}}}}let a=0;for(let l=0;l<s.length;++l)a+=o[l]/t*s[l];Math.abs(a)<this.$d||(this.Wd={zd:e,ot:A},this.Hd=a,this.jd=(function(l,c){const d=Math.log(c);return Math.log(1*d/-l)/d})(Math.abs(a),this.qd))}tc(e){const A=ue(this.Wd),t=e-A.ot;return A.zd+this.Hd*(Math.pow(this.qd,t)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const A=e-ue(this.Wd).ot;return Math.min(A,this.jd)}}class vp{constructor(e,A){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=e,this.Qd=A,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 Sa(xr(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.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 Gt(r,e){const A=ue(r.ownerDocument).createElement("canvas");r.appendChild(A);const t=Hd(A,{options:{allowResizeObserver:!1},transform:(i,n)=>({width:Math.max(i.width,n.width),height:Math.max(i.height,n.height)})});return t.resizeCanvasElement(e),t}function Rt(r){var e;r.width=1,r.height=1,(e=r.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function Es(r,e,A,t){r.gl&&r.gl(e,A,t)}function Ii(r,e,A,t){r.X(e,A,t)}function Ss(r,e,A,t){const i=r(A,t);for(const n of i){const s=n.gt();s!==null&&e(s)}}function yp(r){or&&window.chrome!==void 0&&r.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Hs{constructor(e,A,t){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=!Qs(),this.Af=i=>{this.If(i)},this.zf=i=>{if(this.Lf(i)){const n=this.Ef(i);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(at(i),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(i);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(at(i),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=A,this.cn=t,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(e){this.Sf&&this.Sf();const A=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",A)},this.Zf.addEventListener("mousemove",A),this.Lf(e))return;const t=this.Ef(e);this.Uf(t,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(e){if(this.Df||this.pf!==null||this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.tv),this.Bf=!0}iv(e){const A=Ls(e.changedTouches,ue(this.Of));if(A===null||(this.Vf=_i(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const t=this.Ff(at(A),ue(this.pf)),{nv:i,sv:n,Nf:s}=t;if(this.mf||!(s<5)){if(!this.mf){const o=.5*i,a=n>=o&&!this.cn.ev(),l=o>n&&!this.cn.rv();a||l||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,A);this.Wf(o,this.Hf.hv),ar(e)}}}lv(e){if(e.button!==0)return;const A=this.Ff(at(e),ue(this.vf)),{Nf:t}=A;if(t>=5&&(this.bf=!0,this.Yf()),this.bf){const i=this.Ef(e);this.Uf(i,this.Hf.av)}}Ff(e,A){const t=Math.abs(A.nt-e.nt),i=Math.abs(A.st-e.st);return{nv:t,sv:i,Nf:t+i}}ov(e){let A=Ls(e.changedTouches,ue(this.Of));if(A===null&&e.touches.length===0&&(A=e.changedTouches[0]),A===null)return;this.Of=null,this.Vf=_i(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const t=this.Ef(e,A);if(this.Wf(t,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:i}=this.Ff(at(A),this.cf);i<30&&!this.wf&&this.Wf(t,this.Hf.jf),this.$f()}else this.wf||(this.Wf(t,this.Hf.uv),this.Hf.uv&&ar(e));this._f===0&&ar(e),e.touches.length===0&&this.ff&&(this.ff=!1,ar(e))}If(e){if(e.button!==0)return;const A=this.Ef(e);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),xl()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(e))if(this.Uf(A,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:t}=this.Ff(at(e),this.af);t<5&&!this.bf&&this.Uf(A,this.Hf.qf),this.Yf()}else this.bf||this.Uf(A,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(e){if(this.Of!==null)return;const A=e.changedTouches[0];this.Of=A.identifier,this.Vf=_i(e);const t=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=at(A),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{t.removeEventListener("touchmove",n),t.removeEventListener("touchend",s)},t.addEventListener("touchmove",n,{passive:!1}),t.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,e),240)}const i=this.Ef(e,A);this.Wf(i,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=at(A))}mv(e){if(e.button!==0)return;const A=this.Zf.ownerDocument.documentElement;xl()&&A.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=at(e),this.kf&&(this.kf(),this.kf=null);{const i=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{A.removeEventListener("mousemove",i),A.removeEventListener("mouseup",n)},A.addEventListener("mousemove",i),A.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(e))return;const t=this.Ef(e);this.Uf(t,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=at(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,A=t=>{this.Hf.wv&&(t.composed&&this.Zf.contains(t.composedPath()[0])||t.target&&this.Zf.contains(t.target)||this.Hf.wv())};this.Mf=()=>{e.removeEventListener("touchstart",A)},this.gf=()=>{e.removeEventListener("mousedown",A)},e.addEventListener("mousedown",A),e.addEventListener("touchstart",A,{passive:!0})}Qs()&&(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}),yp(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",(e=>this.yv(e.touches)),{passive:!0}),this.Zf.addEventListener("touchmove",(e=>{if(e.touches.length===2&&this.Cf!==null&&this.Hf.Sv!==void 0){const A=Fl(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,A),ar(e)}}),{passive:!1}),this.Zf.addEventListener("touchend",(e=>{this.yv(e.touches)})))}yv(e){e.length===1&&(this.Pf=!1),e.length!==2||this.Pf||this.ff?this.Cv():this.Tv(e)}Tv(e){const A=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(e[0].clientX-A.left+(e[1].clientX-A.left))/2,st:(e[0].clientY-A.top+(e[1].clientY-A.top))/2},this.Tf=Fl(e[0],e[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(e){if(this.Sf&&this.Sf(),this.Lf(e)||!this.Bf)return;const A=this.Ef(e);this.Uf(A,this.Hf.Pv),this.Bf=!Qs()}vv(e){const A=Ls(e.touches,ue(this.Of));if(A===null)return;const t=this.Ef(e,A);this.Wf(t,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:_i(e)<this.Vf+500}Wf(e,A){A&&A.call(this.Hf,e)}Uf(e,A){A&&A.call(this.Hf,e)}Ef(e,A){const t=A||e,i=this.Zf.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-i.left,localY:t.clientY-i.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:t.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&ar(e)}}}}function Fl(r,e){const A=r.clientX-e.clientX,t=r.clientY-e.clientY;return Math.sqrt(A*A+t*t)}function ar(r){r.cancelable&&r.preventDefault()}function at(r){return{nt:r.pageX,st:r.pageY}}function _i(r){return r.timeStamp||performance.now()}function Ls(r,e){for(let A=0;A<r.length;++A)if(r[A].identifier===e)return r[A];return null}function Di(r){return{Hc:r.Hc,Iv:{gr:r.zv.externalId},Lv:r.zv.cursorStyle}}function bp(r,e,A){for(const t of r){const i=t.gt();if(i!==null&&i.wr){const n=i.wr(e,A);if(n!==null)return{Bv:t,Iv:n}}}return null}function Ms(r,e){return A=>{var t,i,n,s;return((i=(t=A.Dt())===null||t===void 0?void 0:t.Pa())!==null&&i!==void 0?i:"")!==e?[]:(s=(n=A.da)===null||n===void 0?void 0:n.call(A,r))!==null&&s!==void 0?s:[]}}function Ul(r,e,A,t){if(!r.length)return;let i=0;const n=A/2,s=r[0].At(t,!0);let o=e===1?n-(r[0].Vi()-s/2):r[0].Vi()-s/2-n;o=Math.max(0,o);for(let a=1;a<r.length;a++){const l=r[a],c=r[a-1],d=c.At(t,!1),p=l.Vi(),y=c.Vi();if(e===1?p>y-d:p<y+d){const w=y-d*e;l.Oi(w);const C=w-e*d/2;if((e===1?C<0:C>A)&&o>0){const v=e===1?-1-C:C-A,S=Math.min(v,o);for(let F=i;F<r.length;F++)r[F].Oi(r[F].Vi()+e*S);o-=S}}else i=a,o=e===1?y-d-p:p-(y+d)}}class El{constructor(e,A,t,i){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Hr(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=e,this.cn=A,this.ko=A.layout,this.Oc=t,this.qv=i==="left",this.Yv=Ms("normal",i),this.Zv=Ms("top",i),this.Xv=Ms("bottom",i),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=Gt(this.Kv,sA({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=Gt(this.Kv,sA({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const s=this.Jv.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0";const o={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 Hs(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Rt(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Rt(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 e=this.Oc.W();return this.Qr!==e.R&&(this.Fv.nr(),this.Qr=e.R),e}op(){if(this.Li===null)return 0;let e=0;const A=this.ap(),t=ue(this.Gv.canvasElement.getContext("2d"));t.save();const i=this.Li.Ha();t.font=this._p(),i.length>0&&(e=Math.max(this.Fv.xi(t,i[0].so),this.Fv.xi(t,i[i.length-1].so)));const n=this.up();for(let l=n.length;l--;){const c=this.Fv.xi(t,n[l].Kt());c>e&&(e=c)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const l=this.Li.pn(1,s),c=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(t,this.Li.Fi(Math.floor(Math.min(l,c))+.11111111111111,s)),this.Fv.xi(t,this.Li.Fi(Math.ceil(Math.max(l,c))-.11111111111111,s)))}var o;t.restore();const a=e||34;return xs(Math.ceil(A.C+A.T+A.A+A.I+5+a))}cp(e){this.Ev!==null&&Pt(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`)}dp(){return ue(this.Ev).width}Gi(e){this.Li!==e&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=e,e.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const e=this.tn.fp();this.tn.$v().$t().E_(e,ue(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const t=Vt(this.Gv);t!==null&&(t.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i)})),this.tn.bp(t,this.Xv),this.wp(t),this.tn.bp(t,this.Yv),this.gp(t))}this.Jv.applySuggestedBitmapSize();const A=Vt(this.Jv);A!==null&&(A.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.Mp(A),this.tn.bp(A,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,A,t){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,A,t)}bt(){var e;(e=this.Li)===null||e===void 0||e.Ha()}Qv(e){if(this.Li===null||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const A=this.tn.$v().$t(),t=this.tn.fp();this.Nv=!0,A.V_(t,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const A=this.tn.$v().$t(),t=this.tn.fp(),i=this.Li;A.O_(t,i,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),A=this.tn.fp(),t=this.Li;this.Nv&&(this.Nv=!1,e.B_(A,t))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const A=this.tn.$v().$t(),t=this.tn.fp();this.Nv=!1,A.B_(t,this.Li)}sp(e){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(e){this.Li!==null&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(e){this.kp(0)}up(){const e=[],A=this.Li===null?void 0:this.Li;return(t=>{for(let i=0;i<t.length;++i){const n=t[i].Rn(this.tn.fp(),A);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:A}){const{width:t,height:i}=A,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?yi(e,0,0,t,i,s):Ma(e,0,0,t,i,s,o)}Ie({context:e,bitmapSize:A,horizontalPixelRatio:t}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const i=Math.max(1,Math.floor(this.ap().C*t));let n;n=this.qv?A.width-i:0,e.fillRect(n,0,i,A.height)}wp(e){if(this.Ev===null||this.Li===null)return;const A=this.Li.Ha(),t=this.Li.W(),i=this.ap(),n=this.qv?this.Ev.width-i.T:0;t.borderVisible&&t.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:a})=>{s.fillStyle=t.borderColor;const l=Math.max(1,Math.floor(a)),c=Math.floor(.5*a),d=Math.round(i.T*o);s.beginPath();for(const p of A)s.rect(Math.floor(n*o),Math.round(p.Ea*a)-c,d,l);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=t.textColor)!==null&&o!==void 0?o:this.ko.textColor,s.textAlign=this.qv?"right":"left",s.textBaseline="middle";const a=this.qv?Math.round(n-i.A):Math.round(n+i.T+i.A),l=A.map((c=>this.Fv.Mi(s,c.so)));for(let c=A.length;c--;){const d=A[c];s.fillText(d.so,a,d.Ea+l[c])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],A=this.Li.Uo().slice(),t=this.tn.fp(),i=this.ap();this.Li===t.pr()&&this.tn.fp().Uo().forEach((s=>{t.vr(s)&&A.push(s)}));const n=this.Li;A.forEach((s=>{s.Rn(t,n).forEach((o=>{o.Oi(null),o.Bi()&&e.push(o)}))})),e.forEach((s=>s.Oi(s.ki()))),this.Li.W().alignLabels&&this.yp(e,i)}yp(e,A){if(this.Ev===null)return;const t=this.Ev.height/2,i=e.filter((s=>s.ki()<=t)),n=e.filter((s=>s.ki()>t));i.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(A)/2),a=s.ki();a>-o&&a<o&&s.Oi(o),a>this.Ev.height-o&&a<this.Ev.height+o&&s.Oi(this.Ev.height-o)}Ul(i,1,this.Ev.height,A),Ul(n,-1,this.Ev.height,A)}gp(e){if(this.Ev===null)return;const A=this.up(),t=this.ap(),i=this.qv?"right":"left";A.forEach((n=>{n.Ai()&&n.gt(ue(this.Li)).X(e,t,this.Fv,i)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const A=this.tn.$v().$t(),t=[],i=this.tn.fp(),n=A.Zc().Rn(i,this.Li);n.length&&t.push(n);const s=this.ap(),o=this.qv?"right":"left";t.forEach((a=>{a.forEach((l=>{l.gt(ue(this.Li)).X(e,s,this.Fv,o)}))}))}kp(e){this.Kv.style.cursor=e===1?"ns-resize":"default"}fo(){const e=this.op();this.Wv<e&&this.tn.$v().$t().Kl(),this.Wv=e}_p(){return ir(this.ko.fontSize,this.ko.fontFamily)}}function Tp(r,e){var A,t;return(t=(A=r.ua)===null||A===void 0?void 0:A.call(r,e))!==null&&t!==void 0?t:[]}function ki(r,e){var A,t;return(t=(A=r.Pn)===null||A===void 0?void 0:A.call(r,e))!==null&&t!==void 0?t:[]}function Qp(r,e){var A,t;return(t=(A=r.Ji)===null||A===void 0?void 0:A.call(r,e))!==null&&t!==void 0?t:[]}function xp(r,e){var A,t;return(t=(A=r.aa)===null||A===void 0?void 0:A.call(r,e))!==null&&t!==void 0?t:[]}class Is{constructor(e,A){this.Ev=sA({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new uA,this.Op=new uA,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=e,this.Np=A,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 t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="relative",t.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(t),this.Gv=Gt(t,sA({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=Gt(t,sA({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.$p=document.createElement("tr"),this.$p.appendChild(this.jp),this.$p.appendChild(this.Wp),this.$p.appendChild(this.Hp),this.Up(),this.hp=new Hs(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),Rt(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Rt(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return ue(this.Np)}qp(e){var A,t;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(Is.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=(A=this.Pp)!==null&&A!==void 0?A:new vp(this.Wp,this.Qd),this.Pp.bt()):((t=this.Pp)===null||t===void 0||t.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 e=this.Np.R_();this.Cp.Gi(ue(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(ue(e))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(e){this.Np&&this.Np.x_(e)}Qf(e){if(!this.Np)return;this.Kp();const A=e.localX,t=e.localY;this.Gp(A,t,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var A;if(!this.Np)return;this.Kp();const t=e.localX,i=e.localY;this.Gp(t,i,e);const n=this.wr(t,i);this.Qd.Qp((A=n?.Lv)!==null&&A!==void 0?A:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(e){this.Np!==null&&(this.Kp(),this.tm(e))}qf(e){this.Np!==null&&this.im(this.Op,e)}jf(e){this.qf(e)}av(e){this.Kp(),this.nm(e),this.Gp(e.localX,e.localY,e)}cv(e){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(e))}uv(e){this.Np!==null&&this.tm(e)}Rv(e){if(this.Ap=!0,this.Ip===null){const A={x:e.localX,y:e.localY};this.rm(A,A,e)}}Pv(e){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(e,A){if(!this.Qd.W().handleScale.pinch)return;const t=5*(A-this.Bp);this.Bp=A,this.$i().Qc(e.nt,t)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const A=this.$i().Zc();this.Ip!==null&&A.yt()&&(this.Lp={x:A.Yt(),y:A.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const A=e.localX,t=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const i=ue(this.Lp),n=i.x+(A-this.Ip.x),s=i.y+(t-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,A){const t=this.Np;return t===null?null:(function(i,n,s){const o=i.Uo(),a=(function(l,c,d){var p,y;let w,C;for(const F of l){const k=(y=(p=F.va)===null||p===void 0?void 0:p.call(F,c,d))!==null&&y!==void 0?y:[];for(const x of k)v=x.zOrder,(!(S=w?.zOrder)||v==="top"&&S!=="top"||v==="normal"&&S==="bottom")&&(w=x,C=F)}var v,S;return w&&C?{zv:w,Hc:C}:null})(o,n,s);if(a?.zv.zOrder==="top")return Di(a);for(const l of o){if(a&&a.Hc===l&&a.zv.zOrder!=="bottom"&&!a.zv.isBackground)return Di(a);const c=bp(l.Pn(i),n,s);if(c!==null)return{Hc:l,Bv:c.Bv,Iv:c.Iv};if(a&&a.Hc===l&&a.zv.zOrder!=="bottom"&&a.zv.isBackground)return Di(a)}return a?.zv?Di(a):null})(t,e,A)}_m(e,A){ue(A==="left"?this.Cp:this.Tp).cp(sA({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){Pt(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Wp.style.width=e.width+"px",this.Wp.style.height=e.height+"px")}dm(){const e=ue(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const A of e.Ba())if(e.vr(A)){const t=A.Dt();t!==null&&e.P_(t),A.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,A,t){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,A,t)}vp(e){if(e===0||this.Np===null)return;if(e>1&&this.dm(),this.Cp!==null&&this.Cp.vp(e),this.Tp!==null&&this.Tp.vp(e),e!==1){this.Gv.applySuggestedBitmapSize();const t=Vt(this.Gv);t!==null&&(t.useBitmapCoordinateSpace((i=>{this.mp(i)})),this.Np&&(this.fm(t,Tp),this.vm(t),this.pm(t),this.fm(t,ki),this.fm(t,Qp)))}this.Jv.applySuggestedBitmapSize();const A=Vt(this.Jv);A!==null&&(A.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.bm(A),this.fm(A,xp))}wm(){return this.Cp}gm(){return this.Tp}bp(e,A){this.fm(e,A)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(e){this.im(this.Vp,e)}im(e,A){const t=A.localX,i=A.localY;e.M()&&e.m(this.$i().St().Nu(t),{x:t,y:i},A)}mp({context:e,bitmapSize:A}){const{width:t,height:i}=A,n=this.$i(),s=n.q(),o=n.bd();s===o?yi(e,0,0,t,i,o):Ma(e,0,0,t,i,s,o)}vm(e){const A=ue(this.Np).j_().qh().gt();A!==null&&A.X(e,!1)}pm(e){const A=this.$i().Yc();this.Mm(e,ki,Es,A),this.Mm(e,ki,Ii,A)}bm(e){this.Mm(e,ki,Ii,this.$i().Zc())}fm(e,A){const t=ue(this.Np).Uo();for(const i of t)this.Mm(e,A,Es,i);for(const i of t)this.Mm(e,A,Ii,i)}Mm(e,A,t,i){const n=ue(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===i,a=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;Ss(A,(l=>t(l,e,o,a)),i,n)}Zp(){if(this.Np===null)return;const e=this.Qd,A=this.Np.R_().W().visible,t=this.Np.D_().W().visible;A||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),t||this.Tp===null||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const i=e.$t().ud();A&&this.Cp===null&&(this.Cp=new El(this,e.W(),i,"left"),this.jp.appendChild(this.Cp.lp())),t&&this.Tp===null&&(this.Tp=new El(this,e.W(),i,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,A,t){this.$i().ld(this.Sm(e),this.km(A),t,ue(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,A,t){this.Ip=e,this.zp=!1,this.Gp(A.x,A.y,t);const i=this.$i().Zc();this.Lp={x:i.Yt(),y:i.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const A=this.$i(),t=this.fp();if(A.z_(t,t.vn()),this.Rp=null,this.Dp=!1,A.ed(),this.Ep!==null){const i=performance.now(),n=A.St();this.Ep.Vr(n.Hu(),i),this.Ep.Qu(i)||A.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)ue(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(e){if(this.Np===null)return;const A=this.$i(),t=A.St();if(t.Ni())return;const i=this.Qd.W(),n=i.handleScroll,s=i.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),a=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:a,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const l=t.le();this.Ep=new Cp(.2/l,7/l,.997,15/l),this.Ep.Yd(t.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||A.A_(this.Np,o,e.localY),A.nd(e.localX),this.Dp=!0}this.Dp&&(o.Ni()||A.I_(this.Np,o,e.localY),A.sd(e.localX),this.Ep!==null&&this.Ep.Yd(t.Hu(),a))}}class Sl{constructor(e,A,t,i,n){this.ft=!0,this.Ev=sA({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=t.ud,this.cn=A,this.Tm=i,this.Pm=n,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=Gt(this.Kv,sA({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Rt(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){Pt(this.Ev,e)||(this.Ev=e,this.Gv.resizeCanvasElement(e),this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.ft=!0)}vp(e){if(e<3&&!this.ft||this.Ev.width===0||this.Ev.height===0)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const A=Vt(this.Gv);A!==null&&A.useBitmapCoordinateSpace((t=>{this.mp(t),this.Ie(t)}))}xp(){return this.Gv.bitmapSize}Sp(e,A,t){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,A,t)}Ie({context:e,bitmapSize:A,horizontalPixelRatio:t,verticalPixelRatio:i}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*t),s=Math.floor(this.Oc.W().C*i),o=this.qv?A.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:A}){yi(e,0,0,A.width,A.height,this.Pm())}}function _s(r){return e=>{var A,t;return(t=(A=e.fa)===null||A===void 0?void 0:A.call(e,r))!==null&&t!==void 0?t:[]}}const Fp=_s("normal"),Up=_s("top"),Ep=_s("bottom");class Sp{constructor(e,A){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=sA({width:0,height:0}),this.Om=new uA,this.Fv=new Hr(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=e,this.q_=A,this.cn=e.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=Gt(this.Im,sA({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const t=this.Gv.canvasElement;t.style.position="absolute",t.style.zIndex="1",t.style.left="0",t.style.top="0",this.Jv=Gt(this.Im,sA({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const i=this.Jv.canvasElement;i.style.position="absolute",i.style.zIndex="2",i.style.left="0",i.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 Hs(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),Rt(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Rt(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(e){if(this.Vm)return;this.Vm=!0;const A=this.Qd.$t();!A.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&A.Jc(e.localX)}pv(e){this.bv(e)}wv(){const e=this.Qd.$t();!e.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&e.hd())}av(e){const A=this.Qd.$t();!A.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&A.rd(e.localX)}hv(e){this.av(e)}cv(){this.Vm=!1;const e=this.Qd.$t();e.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||e.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(e,A,t){Pt(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.Om.m(e)),this.Rm!==null&&this.Rm.cp(sA({width:A,height:e.height})),this.Dm!==null&&this.Dm.cp(sA({width:t,height:e.height}))}Wm(){const e=this.jm();return Math.ceil(e.C+e.T+e.P+e.L+e.B+e.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(e,A,t){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,A,t)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const t=Vt(this.Gv);t!==null&&(t.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i),this.$m(t,Ep)})),this.wp(t),this.$m(t,Fp)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const A=Vt(this.Jv);A!==null&&(A.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],A),this.$m(A,Up))}$m(e,A){const t=this.Qd.$t().wt();for(const i of t)Ss(A,(n=>Es(n,e,!1,void 0)),i,void 0);for(const i of t)Ss(A,(n=>Ii(n,e,!1,void 0)),i,void 0)}mp({context:e,bitmapSize:A}){yi(e,0,0,A.width,A.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:A,verticalPixelRatio:t}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const i=Math.max(1,Math.floor(this.jm().C*t));e.fillRect(0,0,A.width,i)}}wp(e){const A=this.Qd.$t().St(),t=A.Ha();if(!t||t.length===0)return;const i=this.q_.maxTickMarkWeight(t),n=this.jm(),s=A.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:a,verticalPixelRatio:l})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const c=Math.max(1,Math.floor(a)),d=Math.floor(.5*a);o.beginPath();const p=Math.round(n.T*l);for(let y=t.length;y--;){const w=Math.round(t[y].coord*a);o.rect(w-d,0,c,p)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const a=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const l of t)if(l.weight<i){const c=l.needAlignCoordinate?this.Ym(o,l.coord,l.label):l.coord;o.fillText(l.label,c,a)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const l of t)if(l.weight>=i){const c=l.needAlignCoordinate?this.Ym(o,l.coord,l.label):l.coord;o.fillText(l.label,c,a)}}))}Ym(e,A,t){const i=this.Fv.xi(e,t),n=i/2,s=Math.floor(A-n)+.5;return s<0?A+=Math.abs(0-s):s+i>this.Ev.width&&(A-=Math.abs(this.Ev.width-(s+i))),A}Um(e,A){const t=this.jm();for(const i of e)for(const n of i.Qi())n.gt().X(A,t)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return ir(this.j(),this.cn.fontFamily)}Zm(){return ir(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 Hr,Hm:0});const e=this.k,A=this._p();if(e.R!==A){const t=this.j();e.P=t,e.R=A,e.L=3*t/12,e.B=3*t/12,e.ji=9*t/12,e.N=0,e.Hm=4*t/12,e.Wi.nr()}return this.k}kp(e){this.Kv.style.cursor=e===1?"ew-resize":"default"}zm(){const e=this.Qd.$t(),A=e.W();A.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),A.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const t={ud:this.Qd.$t().ud()},i=()=>A.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();A.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new Sl("left",A,t,i,n),this.Bm.appendChild(this.Rm.lp())),A.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Sl("right",A,t,i,n),this.Am.appendChild(this.Dm.lp()))}}const Hp=!!or&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((r=>r.brand.includes("Chromium")))&&!!or&&(!((Ds=navigator?.userAgentData)===null||Ds===void 0)&&Ds.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var Ds;class Lp{constructor(e,A,t){var i;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 uA,this.Op=new uA,this.Rc=new uA,this.ib=null,this.nb=null,this.Jd=e,this.cn=A,this.q_=t,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%",(i=this.Xd).style.userSelect="none",i.style.webkitUserSelect="none",i.style.msUserSelect="none",i.style.MozUserSelect="none",i.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),ks(this.cn)&&this.hb(!0),this.$i=new pp(this.Vc.bind(this),this.cn,t),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new Sp(this,this.q_),this.sb.appendChild(this.ab.lp());const n=A.autoSize&&this.ob();let s=this.cn.width,o=this.cn.height;if(n||s===0||o===0){const a=e.getBoundingClientRect();s=s||a.width,o=o||a.height}this._b(s,o),this.ub(),e.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 e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],ue(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(e,A,t=!1){if(this.ho===A&&this.__===e)return;const i=(function(o){const a=Math.floor(o.width),l=Math.floor(o.height);return sA({width:a-a%2,height:l-l%2})})(sA({width:e,height:A}));this.ho=i.height,this.__=i.width;const n=this.ho+"px",s=this.__+"px";ue(this.Xd).style.height=n,ue(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,t?this.mb(yA.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=yA.es());for(let A=0;A<this.Xm.length;A++)this.Xm[A].vp(e.Hn(A).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const A=ks(this.cn);this.$i.$h(e);const t=ks(this.cn);t!==A&&this.hb(t),this.cb(),this.bb(e)}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 e=this.gb(null),A=document.createElement("canvas");A.width=e.width,A.height=e.height;const t=ue(A.getContext("2d"));return this.gb(t),A}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:ue(e==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(e){this.nb=e,this.nb?this.yb().style.setProperty("cursor",e):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return LA(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let A=0,t=0;const i=this.Xm[0],n=(o,a)=>{let l=0;for(let c=0;c<this.Xm.length;c++){const d=this.Xm[c],p=ue(o==="left"?d.wm():d.gm()),y=p.xp();e!==null&&p.Sp(e,a,l),l+=y.height}};this.xb()&&(n("left",0),A+=ue(i.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const a=this.Xm[o],l=a.xp();e!==null&&a.Sp(e,A,t),t+=l.height}A+=i.xp().width,this.Sb()&&(n("right",A),A+=ue(i.gm()).xp().width);const s=(o,a,l)=>{ue(o==="left"?this.ab.Lm():this.ab.Em()).Sp(ue(e),a,l)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let a=0;this.xb()&&(s("left",a,t),a=ue(i.wm()).xp().width),this.ab.Sp(e,a,t),a+=o.width,this.Sb()&&s("right",a,t)}t+=o.height}return sA({width:A,height:t})}Pb(){let e=0,A=0,t=0;for(const w of this.Xm)this.xb()&&(A=Math.max(A,ue(w.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(t=Math.max(t,ue(w.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=w.M_();A=xs(A),t=xs(t);const i=this.__,n=this.ho,s=Math.max(i-A-t,0),o=this.cn.timeScale.visible;let a=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var l;a=(l=a)+l%2;const c=0+a,d=n<c?0:n-c,p=d/e;let y=0;for(let w=0;w<this.Xm.length;++w){const C=this.Xm[w];C.qp(this.$i.qc()[w]);let v=0,S=0;S=w===this.Xm.length-1?d-y:Math.round(C.M_()*p),v=Math.max(S,2),y+=v,C.cp(sA({width:s,height:v})),this.xb()&&C._m(A,"left"),this.Sb()&&C._m(t,"right"),C.fp()&&this.$i.Kc(C.fp(),v)}this.ab.Fm(sA({width:o?s:0,height:a}),o?A:0,o?t:0),this.$i.S_(s),this.Gm!==A&&(this.Gm=A),this.Jm!==t&&(this.Jm=t)}hb(e){e?this.Xd.addEventListener("wheel",this.eb,{passive:!1}):this.Xd.removeEventListener("wheel",this.eb)}Rb(e){switch(e.deltaMode){case e.DOM_DELTA_PAGE:return 120;case e.DOM_DELTA_LINE:return 32}return Hp?1/window.devicePixelRatio:1}rb(e){if(!(e.deltaX!==0&&this.cn.handleScroll.mouseWheel||e.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const A=this.Rb(e),t=A*e.deltaX/100,i=-A*e.deltaY/100;if(e.cancelable&&e.preventDefault(),i!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(i)*Math.min(1,Math.abs(i)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}t!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*t)}mb(e,A){var t;const i=e.jn();i===3&&this.Db(),i!==3&&i!==2||(this.Vb(e),this.Ob(e,A),this.ab.bt(),this.Xm.forEach((n=>{n.Xp()})),((t=this.Qm)===null||t===void 0?void 0:t.jn())===3&&(this.Qm.ts(e),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,A),e=this.Qm,this.Qm=null)),this.vp(e)}Ob(e,A){for(const t of e.Qn())this.ns(t,A)}Vb(e){const A=this.$i.qc();for(let t=0;t<A.length;t++)e.Hn(t).Wn&&A[t].N_()}ns(e,A){const t=this.$i.St();switch(e.qn){case 0:t.hc();break;case 1:t.lc(e.Vt);break;case 2:t.Gn(e.Vt);break;case 3:t.Jn(e.Vt);break;case 4:t.qu();break;case 5:e.Vt.Qu(A)||t.Jn(e.Vt.tc(A))}}Vc(e){this.Qm!==null?this.Qm.ts(e):this.Qm=e,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((A=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const t=this.Qm;this.Qm=null,this.mb(t,A);for(const i of t.Qn())if(i.qn===5&&!i.Vt.Qu(A)){this.$t().Zn(i.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),A=e.length,t=this.Xm.length;for(let i=A;i<t;i++){const n=LA(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let i=t;i<A;i++){const n=new Is(this,e[i]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let i=0;i<A;i++){const n=e[i],s=this.Xm[i];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,A,t){var i;const n=new Map;e!==null&&this.$i.wt().forEach((c=>{const d=c.In().ll(e);d!==null&&n.set(c,d)}));let s;if(e!==null){const c=(i=this.$i.St().Ui(e))===null||i===void 0?void 0:i.originalTime;c!==void 0&&(s=c)}const o=this.$t().Wc(),a=o!==null&&o.Hc instanceof ms?o.Hc:void 0,l=o!==null&&o.Iv!==void 0?o.Iv.gr:void 0;return{zb:s,ee:e??void 0,Lb:A??void 0,Eb:a,Nb:n,Fb:l,Wb:t??void 0}}Bb(e,A,t){this.Vp.m((()=>this.Ib(e,A,t)))}Ab(e,A,t){this.Op.m((()=>this.Ib(e,A,t)))}lb(e,A,t){this.Rc.m((()=>this.Ib(e,A,t)))}cb(){const e=this.cn.timeScale.visible?"":"none";this.ab.lp().style.display=e}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((e=>{const A=e.find((t=>t.target===this.Jd));A&&this._b(A.contentRect.width,A.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){this.ib!==null&&this.ib.disconnect(),this.ib=null}}function ks(r){return!!(r.handleScroll.mouseWheel||r.handleScale.mouseWheel)}function Mp(r){return(function(e){return e.open!==void 0})(r)||(function(e){return e.value!==void 0})(r)}function Hl(r,e){var A={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(A[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(t=Object.getOwnPropertySymbols(r);i<t.length;i++)e.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(r,t[i])&&(A[t[i]]=r[t[i]])}return A}function Ll(r,e,A,t){const i=A.value,n={ee:e,ot:r,Vt:[i,i,i,i],zb:t};return A.color!==void 0&&(n.V=A.color),n}function Ip(r,e,A,t){const i=A.value,n={ee:e,ot:r,Vt:[i,i,i,i],zb:t};return A.lineColor!==void 0&&(n.lt=A.lineColor),A.topColor!==void 0&&(n.Ps=A.topColor),A.bottomColor!==void 0&&(n.Rs=A.bottomColor),n}function _p(r,e,A,t){const i=A.value,n={ee:e,ot:r,Vt:[i,i,i,i],zb:t};return A.topLineColor!==void 0&&(n.Re=A.topLineColor),A.bottomLineColor!==void 0&&(n.De=A.bottomLineColor),A.topFillColor1!==void 0&&(n.ke=A.topFillColor1),A.topFillColor2!==void 0&&(n.ye=A.topFillColor2),A.bottomFillColor1!==void 0&&(n.Ce=A.bottomFillColor1),A.bottomFillColor2!==void 0&&(n.Te=A.bottomFillColor2),n}function Dp(r,e,A,t){const i={ee:e,ot:r,Vt:[A.open,A.high,A.low,A.close],zb:t};return A.color!==void 0&&(i.V=A.color),i}function kp(r,e,A,t){const i={ee:e,ot:r,Vt:[A.open,A.high,A.low,A.close],zb:t};return A.color!==void 0&&(i.V=A.color),A.borderColor!==void 0&&(i.Ot=A.borderColor),A.wickColor!==void 0&&(i.Xh=A.wickColor),i}function Op(r,e,A,t,i){const n=LA(i)(A),s=Math.max(...n),o=Math.min(...n),a=n[n.length-1],l=[a,s,o,a],c=A,{time:d,color:p}=c;return{ee:e,ot:r,Vt:l,zb:t,$e:Hl(c,["time","color"]),V:p}}function Oi(r){return r.Vt!==void 0}function Ml(r,e){return e.customValues!==void 0&&(r.jb=e.customValues),r}function Wt(r){return(e,A,t,i,n,s)=>(function(o,a){return a?a(o):(l=o).open===void 0&&l.value===void 0;var l})(t,s)?Ml({ot:e,ee:A,zb:i},t):Ml(r(e,A,t,i,n),t)}function Il(r){return{Candlestick:Wt(kp),Bar:Wt(Dp),Area:Wt(Ip),Baseline:Wt(_p),Histogram:Wt(Ll),Line:Wt(Ll),Custom:Wt(Op)}[r]}function _l(r){return{ee:0,Hb:new Map,la:r}}function Dl(r,e){if(r!==void 0&&r.length!==0)return{$b:e.key(r[0].ot),Ub:e.key(r[r.length-1].ot)}}function kl(r){let e;return r.forEach((A=>{e===void 0&&(e=A.zb)})),LA(e)}class Np{constructor(e){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=e}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(e,A){let t=this.qb.size!==0,i=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)t=!1,i=!0,this.qb.clear();else for(const a of this.Xb)a.pointData.Hb.delete(e)&&(i=!0);let s=[];if(A.length!==0){const a=A.map((y=>y.time)),l=this.q_.createConverterToInternalObj(A),c=Il(e.Qh()),d=e.Ca(),p=e.Ta();s=A.map(((y,w)=>{const C=l(y.time),v=this.q_.key(C);let S=this.qb.get(v);S===void 0&&(S=_l(C),this.qb.set(v,S),i=!0);const F=c(C,S.ee,y,a[w],d,p);return S.Hb.set(e,F),F}))}t&&this.Gb(),this.Jb(e,s);let o=-1;if(i){const a=[];this.qb.forEach((l=>{a.push({timeWeight:0,time:l.la,pointData:l,originalTime:kl(l.Hb)})})),a.sort(((l,c)=>this.q_.key(l.time)-this.q_.key(c.time))),o=this.Qb(a)}return this.tw(e,o,(function(a,l,c){const d=Dl(a,c),p=Dl(l,c);if(d!==void 0&&p!==void 0)return{ta:d.Ub>=p.Ub&&d.$b>=p.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,A){const t=A;(function(C){C.zb===void 0&&(C.zb=C.time)})(t),this.q_.preprocessData(A);const i=this.q_.createConverterToInternalObj([A])(A.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(i)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${i}`);let s=this.qb.get(this.q_.key(i));const o=s===void 0;s===void 0&&(s=_l(i),this.qb.set(this.q_.key(i),s));const a=Il(e.Qh()),l=e.Ca(),c=e.Ta(),d=a(i,s.ee,A,t.zb,l,c);s.Hb.set(e,d),this.nw(e,d);const p={ta:Oi(d)};if(!o)return this.tw(e,-1,p);const y={timeWeight:0,time:s.la,pointData:s,originalTime:kl(s.Hb)},w=Sr(this.Xb,this.q_.key(y.time),((C,v)=>this.q_.key(C.time)<v));this.Xb.splice(w,0,y);for(let C=w;C<this.Xb.length;++C)Os(this.Xb[C].pointData,C);return this.q_.fillWeightsForPoints(this.Xb,w),this.tw(e,w,p)}nw(e,A){let t=this.Yb.get(e);t===void 0&&(t=[],this.Yb.set(e,t));const i=t.length!==0?t[t.length-1]:null;i===null||this.q_.key(A.ot)>this.q_.key(i.ot)?Oi(A)&&t.push(A):Oi(A)?t[t.length-1]=A:t.splice(-1,1),this.Zb.set(e,A.ot)}Jb(e,A){A.length!==0?(this.Yb.set(e,A.filter(Oi)),this.Zb.set(e,A[A.length-1].ot)):(this.Yb.delete(e),this.Zb.delete(e))}Gb(){for(const e of this.Xb)e.pointData.Hb.size===0&&this.qb.delete(this.q_.key(e.time))}Qb(e){let A=-1;for(let t=0;t<this.Xb.length&&t<e.length;++t){const i=this.Xb[t],n=e[t];if(this.q_.key(i.time)!==this.q_.key(n.time)){A=t;break}n.timeWeight=i.timeWeight,Os(n.pointData,t)}if(A===-1&&this.Xb.length!==e.length&&(A=Math.min(this.Xb.length,e.length)),A===-1)return-1;for(let t=A;t<e.length;++t)Os(e[t].pointData,t);return this.q_.fillWeightsForPoints(e,A),this.Xb=e,A}sw(){if(this.Yb.size===0)return null;let e=0;return this.Yb.forEach((A=>{A.length!==0&&(e=Math.max(e,A[A.length-1].ee))})),e}tw(e,A,t){const i={ew:new Map,St:{Eu:this.sw()}};if(A!==-1)this.Yb.forEach(((n,s)=>{i.ew.set(s,{$e:n,rw:s===e?t:void 0})})),this.Yb.has(e)||i.ew.set(e,{$e:[],rw:t}),i.St.hw=this.Xb,i.St.lw=A;else{const n=this.Yb.get(e);i.ew.set(e,{$e:n||[],rw:t})}return i}}function Os(r,e){r.ee=e,r.Hb.forEach((A=>{A.ee=e}))}function Ns(r){const e={value:r.Vt[3],time:r.zb};return r.jb!==void 0&&(e.customValues=r.jb),e}function Ol(r){const e=Ns(r);return r.V!==void 0&&(e.color=r.V),e}function Kp(r){const e=Ns(r);return r.lt!==void 0&&(e.lineColor=r.lt),r.Ps!==void 0&&(e.topColor=r.Ps),r.Rs!==void 0&&(e.bottomColor=r.Rs),e}function Pp(r){const e=Ns(r);return r.Re!==void 0&&(e.topLineColor=r.Re),r.De!==void 0&&(e.bottomLineColor=r.De),r.ke!==void 0&&(e.topFillColor1=r.ke),r.ye!==void 0&&(e.topFillColor2=r.ye),r.Ce!==void 0&&(e.bottomFillColor1=r.Ce),r.Te!==void 0&&(e.bottomFillColor2=r.Te),e}function Nl(r){const e={open:r.Vt[0],high:r.Vt[1],low:r.Vt[2],close:r.Vt[3],time:r.zb};return r.jb!==void 0&&(e.customValues=r.jb),e}function Vp(r){const e=Nl(r);return r.V!==void 0&&(e.color=r.V),e}function zp(r){const e=Nl(r),{V:A,Ot:t,Xh:i}=r;return A!==void 0&&(e.color=A),t!==void 0&&(e.borderColor=t),i!==void 0&&(e.wickColor=i),e}function Ks(r){return{Area:Kp,Line:Ol,Baseline:Pp,Histogram:Ol,Bar:Vp,Candlestick:zp,Custom:Gp}[r]}function Gp(r){const e=r.zb;return Object.assign(Object.assign({},r.$e),{time:e})}const Rp={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},Wp={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},$p={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:ns,attributionLogo:!0},Ps={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},Xp={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},Jp={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:ns,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Kl(){return{width:0,height:0,autoSize:!1,layout:$p,crosshair:Rp,grid:Wp,overlayPriceScales:Object.assign({},Ps),leftPriceScale:Object.assign(Object.assign({},Ps),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Ps),{visible:!0}),timeScale:Xp,watermark:Jp,localization:{locale:or?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 Zp{constructor(e,A){this.aw=e,this.ow=A}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return Ti(this.ow)?this.aw.Mb(this.ow):0}Li(){return ue(this.aw.$t().Uc(this.ow)).Dt}}function Pl(r,e,A){const t=Hl(r,["time","originalTime"]),i=Object.assign({time:e},t);return A!==void 0&&(i.originalTime=A),i}const qp={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class Yp{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class jp{constructor(e,A,t,i,n){this.uw=new uA,this.Es=e,this.cw=A,this.dw=t,this.q_=n,this.fw=i}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const A=this.Es.Ct();return A===null?null:this.Es.Dt().Rt(e,A.Vt)}coordinateToPrice(e){const A=this.Es.Ct();return A===null?null:this.Es.Dt().pn(e,A.Vt)}barsInLogicalRange(e){if(e===null)return null;const A=new sr(new kr(e.from,e.to)).lu(),t=this.Es.In();if(t.Ni())return null;const i=t.ll(A.Os(),1),n=t.ll(A.ui(),-1),s=ue(t.el()),o=ue(t.An());if(i!==null&&n!==null&&i.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const a={barsBefore:i===null||i.ee===s?e.from-s:i.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return i!==null&&n!==null&&(a.from=i.zb,a.to=n.zb),a}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,A){const t=this.Es.In().ll(e,A);return t===null?null:Ks(this.seriesType())(t)}data(){const e=Ks(this.seriesType());return this.Es.In().ne().map((A=>e(A)))}subscribeDataChanged(e){this.uw.l(e)}unsubscribeDataChanged(e){this.uw.v(e)}setMarkers(e){this.q_;const A=e.map((t=>Pl(t,this.q_.convertHorzItemToInternal(t.time),t.time)));this.Es.na(A)}markers(){return this.Es.sa().map((e=>Pl(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return Ct(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const A=et(Ct(qp),e),t=this.Es.ea(A);return new Yp(t)}removePriceLine(e){this.Es.ra(e._w())}seriesType(){return this.Es.Qh()}attachPrimitive(e){this.Es.ka(e),e.attached&&e.attached({chart:this.fw,series:this,requestUpdate:()=>this.Es.$t().Kl()})}detachPrimitive(e){this.Es.ya(e),e.detached&&e.detached()}mw(e){this.uw.M()&&this.uw.m(e)}}class e0{constructor(e,A,t){this.ww=new uA,this.mu=new uA,this.Om=new uA,this.$i=e,this.yl=e.St(),this.ab=A,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_=t}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(e,A){A?this.yl.Ju(e,1e3):this.$i.Jn(e)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const e=this.yl.Vu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const A={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},t=this.yl.Iu(A);this.$i.pd(t)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){Ft(e.from<=e.to,"The from index cannot be after the to index."),this.$i.pd(e)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(e){const A=this.$i.St();return A.Ni()?null:A.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const A=this.q_.convertHorzItemToInternal(e),t=this.yl.Va(A,!1);return t===null?null:this.yl.It(t)}coordinateToTime(e){const A=this.$i.St(),t=A.Nu(e),i=A.Ui(t);return i===null?null:i.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},Ct(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(e){this.Om.m(e.width,e.height)}}function A0(r){if(r===void 0||r.type==="custom")return;const e=r;e.minMove!==void 0&&e.precision===void 0&&(e.precision=(function(A){if(A>=1)return 0;let t=0;for(;t<8;t++){const i=Math.round(A);if(Math.abs(i-A)<1e-8)return t;A*=10}return t})(e.minMove))}function Vl(r){return(function(e){if(vi(e.handleScale)){const t=e.handleScale;e.handleScale={axisDoubleClickReset:{time:t,price:t},axisPressedMouseMove:{time:t,price:t},mouseWheel:t,pinch:t}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:t,axisDoubleClickReset:i}=e.handleScale;vi(t)&&(e.handleScale.axisPressedMouseMove={time:t,price:t}),vi(i)&&(e.handleScale.axisDoubleClickReset={time:i,price:i})}const A=e.handleScroll;vi(A)&&(e.handleScroll={horzTouchDrag:A,vertTouchDrag:A,mouseWheel:A,pressedMouseMove:A})})(r),r}class t0{constructor(e,A,t){this.Sw=new Map,this.kw=new Map,this.yw=new uA,this.Cw=new uA,this.Tw=new uA,this.Pw=new Np(A);const i=t===void 0?Ct(Kl()):et(Ct(Kl()),Vl(t));this.q_=A,this.aw=new Lp(e,i,A),this.aw.lm().l((s=>{this.yw.M()&&this.yw.m(this.Rw(s()))}),this),this.aw.am().l((s=>{this.Cw.M()&&this.Cw.m(this.Rw(s()))}),this),this.aw.Xc().l((s=>{this.Tw.M()&&this.Tw.m(this.Rw(s()))}),this);const n=this.aw.$t();this.Dw=new e0(n,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(e,A,t){this.autoSizeActive()||this.aw._b(e,A,t)}addCustomSeries(e,A){const t=rr(e),i=Object.assign(Object.assign({},ba),t.defaultOptions());return this.Vw("Custom",i,A,t)}addAreaSeries(e){return this.Vw("Area",Od,e)}addBaselineSeries(e){return this.Vw("Baseline",Nd,e)}addBarSeries(e){return this.Vw("Bar",Dd,e)}addCandlestickSeries(e={}){return(function(A){A.borderColor!==void 0&&(A.borderUpColor=A.borderColor,A.borderDownColor=A.borderColor),A.wickColor!==void 0&&(A.wickUpColor=A.wickColor,A.wickDownColor=A.wickColor)})(e),this.Vw("Candlestick",_d,e)}addHistogramSeries(e){return this.Vw("Histogram",Kd,e)}addLineSeries(e){return this.Vw("Line",kd,e)}removeSeries(e){const A=LA(this.Sw.get(e)),t=this.Pw.vd(A);this.aw.$t().vd(A),this.Ow(t),this.Sw.delete(e),this.kw.delete(A)}pw(e,A){this.Ow(this.Pw.Kb(e,A))}bw(e,A){this.Ow(this.Pw.iw(e,A))}subscribeClick(e){this.yw.l(e)}unsubscribeClick(e){this.yw.v(e)}subscribeCrosshairMove(e){this.Tw.l(e)}unsubscribeCrosshairMove(e){this.Tw.v(e)}subscribeDblClick(e){this.Cw.l(e)}unsubscribeDblClick(e){this.Cw.v(e)}priceScale(e){return new Zp(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(Vl(e))}options(){return this.aw.W()}takeScreenshot(){return this.aw.wb()}autoSizeActive(){return this.aw.kb()}chartElement(){return this.aw.yb()}paneSize(){const e=this.aw.Tb();return{height:e.height,width:e.width}}setCrosshairPosition(e,A,t){const i=this.Sw.get(t);if(i===void 0)return;const n=this.aw.$t().dr(i);n!==null&&this.aw.$t().ad(e,A,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,A,t={},i){A0(t.priceFormat);const n=et(Ct(Ta),Ct(A),t),s=this.aw.$t().dd(e,n,i),o=new jp(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const A=this.aw.$t();A._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((t,i)=>i.J(t.$e,t.rw))),A.Wu()}Bw(e){return LA(this.kw.get(e))}Rw(e){const A=new Map;e.Nb.forEach(((i,n)=>{const s=n.Qh(),o=Ks(s)(i);if(s!=="Custom")Ft(Mp(o));else{const a=n.Ta();Ft(!a||a(o)===!1)}A.set(this.Bw(n),o)}));const t=e.Eb!==void 0&&this.kw.has(e.Eb)?this.Bw(e.Eb):void 0;return{time:e.zb,logical:e.ee,point:e.Lb,hoveredSeries:t,hoveredObjectId:e.Fb,seriesData:A,sourceEvent:e.Wb}}}function r0(r,e,A){let t;if(Ur(r)){const n=document.getElementById(r);Ft(n!==null,`Cannot find element in DOM with id=${r}`),t=n}else t=r;const i=new t0(t,e,A);return e.setOptions(i.options()),i}function i0(r,e){return r0(r,new Ql,Ql.Id(e))}Object.assign(Object.assign({},Ta),ba);function zl(r,e){return function(){return r.apply(e,arguments)}}const{toString:n0}=Object.prototype,{getPrototypeOf:Vs}=Object,{iterator:Ni,toStringTag:Gl}=Symbol,Ki=(r=>e=>{const A=n0.call(e);return r[A]||(r[A]=A.slice(8,-1).toLowerCase())})(Object.create(null)),tt=r=>(r=r.toLowerCase(),e=>Ki(e)===r),Pi=r=>e=>typeof e===r,{isArray:lr}=Array,cr=Pi("undefined");function Or(r){return r!==null&&!cr(r)&&r.constructor!==null&&!cr(r.constructor)&&kA(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const Rl=tt("ArrayBuffer");function s0(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Rl(r.buffer),e}const o0=Pi("string"),kA=Pi("function"),Wl=Pi("number"),Nr=r=>r!==null&&typeof r=="object",a0=r=>r===!0||r===!1,Vi=r=>{if(Ki(r)!=="object")return!1;const e=Vs(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Gl in r)&&!(Ni in r)},l0=r=>{if(!Nr(r)||Or(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},c0=tt("Date"),h0=tt("File"),u0=tt("Blob"),d0=tt("FileList"),f0=r=>Nr(r)&&kA(r.pipe),p0=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||kA(r.append)&&((e=Ki(r))==="formdata"||e==="object"&&kA(r.toString)&&r.toString()==="[object FormData]"))},g0=tt("URLSearchParams"),[m0,B0,w0,C0]=["ReadableStream","Request","Response","Headers"].map(tt),v0=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Kr(r,e,{allOwnKeys:A=!1}={}){if(r===null||typeof r>"u")return;let t,i;if(typeof r!="object"&&(r=[r]),lr(r))for(t=0,i=r.length;t<i;t++)e.call(null,r[t],t,r);else{if(Or(r))return;const n=A?Object.getOwnPropertyNames(r):Object.keys(r),s=n.length;let o;for(t=0;t<s;t++)o=n[t],e.call(null,r[o],o,r)}}function $l(r,e){if(Or(r))return null;e=e.toLowerCase();const A=Object.keys(r);let t=A.length,i;for(;t-- >0;)if(i=A[t],e===i.toLowerCase())return i;return null}const $t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Xl=r=>!cr(r)&&r!==$t;function zs(){const{caseless:r,skipUndefined:e}=Xl(this)&&this||{},A={},t=(i,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=r&&$l(A,n)||n;Vi(A[s])&&Vi(i)?A[s]=zs(A[s],i):Vi(i)?A[s]=zs({},i):lr(i)?A[s]=i.slice():(!e||!cr(i))&&(A[s]=i)};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&Kr(arguments[i],t);return A}const y0=(r,e,A,{allOwnKeys:t}={})=>(Kr(e,(i,n)=>{A&&kA(i)?Object.defineProperty(r,n,{value:zl(i,A),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,n,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:t}),r),b0=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),T0=(r,e,A,t)=>{r.prototype=Object.create(e.prototype,t),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),A&&Object.assign(r.prototype,A)},Q0=(r,e,A,t)=>{let i,n,s;const o={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),n=i.length;n-- >0;)s=i[n],(!t||t(s,r,e))&&!o[s]&&(e[s]=r[s],o[s]=!0);r=A!==!1&&Vs(r)}while(r&&(!A||A(r,e))&&r!==Object.prototype);return e},x0=(r,e,A)=>{r=String(r),(A===void 0||A>r.length)&&(A=r.length),A-=e.length;const t=r.indexOf(e,A);return t!==-1&&t===A},F0=r=>{if(!r)return null;if(lr(r))return r;let e=r.length;if(!Wl(e))return null;const A=new Array(e);for(;e-- >0;)A[e]=r[e];return A},U0=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Vs(Uint8Array)),E0=(r,e)=>{const t=(r&&r[Ni]).call(r);let i;for(;(i=t.next())&&!i.done;){const n=i.value;e.call(r,n[0],n[1])}},S0=(r,e)=>{let A;const t=[];for(;(A=r.exec(e))!==null;)t.push(A);return t},H0=tt("HTMLFormElement"),L0=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(A,t,i){return t.toUpperCase()+i}),Jl=(({hasOwnProperty:r})=>(e,A)=>r.call(e,A))(Object.prototype),M0=tt("RegExp"),Zl=(r,e)=>{const A=Object.getOwnPropertyDescriptors(r),t={};Kr(A,(i,n)=>{let s;(s=e(i,n,r))!==!1&&(t[n]=s||i)}),Object.defineProperties(r,t)},I0=r=>{Zl(r,(e,A)=>{if(kA(r)&&["arguments","caller","callee"].indexOf(A)!==-1)return!1;const t=r[A];if(kA(t)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+A+"'")})}})},_0=(r,e)=>{const A={},t=i=>{i.forEach(n=>{A[n]=!0})};return lr(r)?t(r):t(String(r).split(e)),A},D0=()=>{},k0=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function O0(r){return!!(r&&kA(r.append)&&r[Gl]==="FormData"&&r[Ni])}const N0=r=>{const e=new Array(10),A=(t,i)=>{if(Nr(t)){if(e.indexOf(t)>=0)return;if(Or(t))return t;if(!("toJSON"in t)){e[i]=t;const n=lr(t)?[]:{};return Kr(t,(s,o)=>{const a=A(s,i+1);!cr(a)&&(n[o]=a)}),e[i]=void 0,n}}return t};return A(r,0)},K0=tt("AsyncFunction"),P0=r=>r&&(Nr(r)||kA(r))&&kA(r.then)&&kA(r.catch),ql=((r,e)=>r?setImmediate:e?((A,t)=>($t.addEventListener("message",({source:i,data:n})=>{i===$t&&n===A&&t.length&&t.shift()()},!1),i=>{t.push(i),$t.postMessage(A,"*")}))(`axios@${Math.random()}`,[]):A=>setTimeout(A))(typeof setImmediate=="function",kA($t.postMessage)),V0=typeof queueMicrotask<"u"?queueMicrotask.bind($t):typeof process<"u"&&process.nextTick||ql,j={isArray:lr,isArrayBuffer:Rl,isBuffer:Or,isFormData:p0,isArrayBufferView:s0,isString:o0,isNumber:Wl,isBoolean:a0,isObject:Nr,isPlainObject:Vi,isEmptyObject:l0,isReadableStream:m0,isRequest:B0,isResponse:w0,isHeaders:C0,isUndefined:cr,isDate:c0,isFile:h0,isBlob:u0,isRegExp:M0,isFunction:kA,isStream:f0,isURLSearchParams:g0,isTypedArray:U0,isFileList:d0,forEach:Kr,merge:zs,extend:y0,trim:v0,stripBOM:b0,inherits:T0,toFlatObject:Q0,kindOf:Ki,kindOfTest:tt,endsWith:x0,toArray:F0,forEachEntry:E0,matchAll:S0,isHTMLForm:H0,hasOwnProperty:Jl,hasOwnProp:Jl,reduceDescriptors:Zl,freezeMethods:I0,toObjectSet:_0,toCamelCase:L0,noop:D0,toFiniteNumber:k0,findKey:$l,global:$t,isContextDefined:Xl,isSpecCompliantForm:O0,toJSONObject:N0,isAsyncFn:K0,isThenable:P0,setImmediate:ql,asap:V0,isIterable:r=>r!=null&&kA(r[Ni])};let Pe=class xd extends Error{static from(e,A,t,i,n,s){const o=new xd(e.message,A||e.code,t,i,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,A,t,i,n){super(e),this.name="AxiosError",this.isAxiosError=!0,A&&(this.code=A),t&&(this.config=t),i&&(this.request=i),n&&(this.response=n,this.status=n.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:j.toJSONObject(this.config),code:this.code,status:this.status}}};Pe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Pe.ERR_BAD_OPTION="ERR_BAD_OPTION",Pe.ECONNABORTED="ECONNABORTED",Pe.ETIMEDOUT="ETIMEDOUT",Pe.ERR_NETWORK="ERR_NETWORK",Pe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Pe.ERR_DEPRECATED="ERR_DEPRECATED",Pe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Pe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Pe.ERR_CANCELED="ERR_CANCELED",Pe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Pe.ERR_INVALID_URL="ERR_INVALID_URL";const z0=null;function Gs(r){return j.isPlainObject(r)||j.isArray(r)}function Yl(r){return j.endsWith(r,"[]")?r.slice(0,-2):r}function jl(r,e,A){return r?r.concat(e).map(function(i,n){return i=Yl(i),!A&&n?"["+i+"]":i}).join(A?".":""):e}function G0(r){return j.isArray(r)&&!r.some(Gs)}const R0=j.toFlatObject(j,{},null,function(e){return/^is[A-Z]/.test(e)});function zi(r,e,A){if(!j.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,A=j.toFlatObject(A,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,v){return!j.isUndefined(v[C])});const t=A.metaTokens,i=A.visitor||c,n=A.dots,s=A.indexes,a=(A.Blob||typeof Blob<"u"&&Blob)&&j.isSpecCompliantForm(e);if(!j.isFunction(i))throw new TypeError("visitor must be a function");function l(w){if(w===null)return"";if(j.isDate(w))return w.toISOString();if(j.isBoolean(w))return w.toString();if(!a&&j.isBlob(w))throw new Pe("Blob is not supported. Use a Buffer instead.");return j.isArrayBuffer(w)||j.isTypedArray(w)?a&&typeof Blob=="function"?new Blob([w]):Buffer.from(w):w}function c(w,C,v){let S=w;if(w&&!v&&typeof w=="object"){if(j.endsWith(C,"{}"))C=t?C:C.slice(0,-2),w=JSON.stringify(w);else if(j.isArray(w)&&G0(w)||(j.isFileList(w)||j.endsWith(C,"[]"))&&(S=j.toArray(w)))return C=Yl(C),S.forEach(function(k,x){!(j.isUndefined(k)||k===null)&&e.append(s===!0?jl([C],x,n):s===null?C:C+"[]",l(k))}),!1}return Gs(w)?!0:(e.append(jl(v,C,n),l(w)),!1)}const d=[],p=Object.assign(R0,{defaultVisitor:c,convertValue:l,isVisitable:Gs});function y(w,C){if(!j.isUndefined(w)){if(d.indexOf(w)!==-1)throw Error("Circular reference detected in "+C.join("."));d.push(w),j.forEach(w,function(S,F){(!(j.isUndefined(S)||S===null)&&i.call(e,S,j.isString(F)?F.trim():F,C,p))===!0&&y(S,C?C.concat(F):[F])}),d.pop()}}if(!j.isObject(r))throw new TypeError("data must be an object");return y(r),e}function ec(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function Rs(r,e){this._pairs=[],r&&zi(r,this,e)}const Ac=Rs.prototype;Ac.append=function(e,A){this._pairs.push([e,A])},Ac.toString=function(e){const A=e?function(t){return e.call(this,t,ec)}:ec;return this._pairs.map(function(i){return A(i[0])+"="+A(i[1])},"").join("&")};function W0(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function tc(r,e,A){if(!e)return r;const t=A&&A.encode||W0,i=j.isFunction(A)?{serialize:A}:A,n=i&&i.serialize;let s;if(n?s=n(e,i):s=j.isURLSearchParams(e)?e.toString():new Rs(e,i).toString(t),s){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class rc{constructor(){this.handlers=[]}use(e,A,t){return this.handlers.push({fulfilled:e,rejected:A,synchronous:t?t.synchronous:!1,runWhen:t?t.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){j.forEach(this.handlers,function(t){t!==null&&e(t)})}}const Ws={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},$0={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Rs,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},$s=typeof window<"u"&&typeof document<"u",Xs=typeof navigator=="object"&&navigator||void 0,X0=$s&&(!Xs||["ReactNative","NativeScript","NS"].indexOf(Xs.product)<0),J0=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Z0=$s&&window.location.href||"http://localhost",xA={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:$s,hasStandardBrowserEnv:X0,hasStandardBrowserWebWorkerEnv:J0,navigator:Xs,origin:Z0},Symbol.toStringTag,{value:"Module"})),...$0};function q0(r,e){return zi(r,new xA.classes.URLSearchParams,{visitor:function(A,t,i,n){return xA.isNode&&j.isBuffer(A)?(this.append(t,A.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function Y0(r){return j.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function j0(r){const e={},A=Object.keys(r);let t;const i=A.length;let n;for(t=0;t<i;t++)n=A[t],e[n]=r[n];return e}function ic(r){function e(A,t,i,n){let s=A[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),a=n>=A.length;return s=!s&&j.isArray(i)?i.length:s,a?(j.hasOwnProp(i,s)?i[s]=[i[s],t]:i[s]=t,!o):((!i[s]||!j.isObject(i[s]))&&(i[s]=[]),e(A,t,i[s],n)&&j.isArray(i[s])&&(i[s]=j0(i[s])),!o)}if(j.isFormData(r)&&j.isFunction(r.entries)){const A={};return j.forEachEntry(r,(t,i)=>{e(Y0(t),i,A,0)}),A}return null}function e1(r,e,A){if(j.isString(r))try{return(e||JSON.parse)(r),j.trim(r)}catch(t){if(t.name!=="SyntaxError")throw t}return(A||JSON.stringify)(r)}const Pr={transitional:Ws,adapter:["xhr","http","fetch"],transformRequest:[function(e,A){const t=A.getContentType()||"",i=t.indexOf("application/json")>-1,n=j.isObject(e);if(n&&j.isHTMLForm(e)&&(e=new FormData(e)),j.isFormData(e))return i?JSON.stringify(ic(e)):e;if(j.isArrayBuffer(e)||j.isBuffer(e)||j.isStream(e)||j.isFile(e)||j.isBlob(e)||j.isReadableStream(e))return e;if(j.isArrayBufferView(e))return e.buffer;if(j.isURLSearchParams(e))return A.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(t.indexOf("application/x-www-form-urlencoded")>-1)return q0(e,this.formSerializer).toString();if((o=j.isFileList(e))||t.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return zi(o?{"files[]":e}:e,a&&new a,this.formSerializer)}}return n||i?(A.setContentType("application/json",!1),e1(e)):e}],transformResponse:[function(e){const A=this.transitional||Pr.transitional,t=A&&A.forcedJSONParsing,i=this.responseType==="json";if(j.isResponse(e)||j.isReadableStream(e))return e;if(e&&j.isString(e)&&(t&&!this.responseType||i)){const s=!(A&&A.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Pe.from(o,Pe.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xA.classes.FormData,Blob:xA.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};j.forEach(["delete","get","head","post","put","patch"],r=>{Pr.headers[r]={}});const A1=j.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"]),t1=r=>{const e={};let A,t,i;return r&&r.split(`
2
+ `).forEach(function(s){i=s.indexOf(":"),A=s.substring(0,i).trim().toLowerCase(),t=s.substring(i+1).trim(),!(!A||e[A]&&A1[A])&&(A==="set-cookie"?e[A]?e[A].push(t):e[A]=[t]:e[A]=e[A]?e[A]+", "+t:t)}),e},nc=Symbol("internals");function Vr(r){return r&&String(r).trim().toLowerCase()}function Gi(r){return r===!1||r==null?r:j.isArray(r)?r.map(Gi):String(r)}function r1(r){const e=Object.create(null),A=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let t;for(;t=A.exec(r);)e[t[1]]=t[2];return e}const i1=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Js(r,e,A,t,i){if(j.isFunction(t))return t.call(this,e,A);if(i&&(e=A),!!j.isString(e)){if(j.isString(t))return e.indexOf(t)!==-1;if(j.isRegExp(t))return t.test(e)}}function n1(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,A,t)=>A.toUpperCase()+t)}function s1(r,e){const A=j.toCamelCase(" "+e);["get","set","has"].forEach(t=>{Object.defineProperty(r,t+A,{value:function(i,n,s){return this[t].call(this,e,i,n,s)},configurable:!0})})}let OA=class{constructor(e){e&&this.set(e)}set(e,A,t){const i=this;function n(o,a,l){const c=Vr(a);if(!c)throw new Error("header name must be a non-empty string");const d=j.findKey(i,c);(!d||i[d]===void 0||l===!0||l===void 0&&i[d]!==!1)&&(i[d||a]=Gi(o))}const s=(o,a)=>j.forEach(o,(l,c)=>n(l,c,a));if(j.isPlainObject(e)||e instanceof this.constructor)s(e,A);else if(j.isString(e)&&(e=e.trim())&&!i1(e))s(t1(e),A);else if(j.isObject(e)&&j.isIterable(e)){let o={},a,l;for(const c of e){if(!j.isArray(c))throw TypeError("Object iterator must return a key-value pair");o[l=c[0]]=(a=o[l])?j.isArray(a)?[...a,c[1]]:[a,c[1]]:c[1]}s(o,A)}else e!=null&&n(A,e,t);return this}get(e,A){if(e=Vr(e),e){const t=j.findKey(this,e);if(t){const i=this[t];if(!A)return i;if(A===!0)return r1(i);if(j.isFunction(A))return A.call(this,i,t);if(j.isRegExp(A))return A.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,A){if(e=Vr(e),e){const t=j.findKey(this,e);return!!(t&&this[t]!==void 0&&(!A||Js(this,this[t],t,A)))}return!1}delete(e,A){const t=this;let i=!1;function n(s){if(s=Vr(s),s){const o=j.findKey(t,s);o&&(!A||Js(t,t[o],o,A))&&(delete t[o],i=!0)}}return j.isArray(e)?e.forEach(n):n(e),i}clear(e){const A=Object.keys(this);let t=A.length,i=!1;for(;t--;){const n=A[t];(!e||Js(this,this[n],n,e,!0))&&(delete this[n],i=!0)}return i}normalize(e){const A=this,t={};return j.forEach(this,(i,n)=>{const s=j.findKey(t,n);if(s){A[s]=Gi(i),delete A[n];return}const o=e?n1(n):String(n).trim();o!==n&&delete A[n],A[o]=Gi(i),t[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const A=Object.create(null);return j.forEach(this,(t,i)=>{t!=null&&t!==!1&&(A[i]=e&&j.isArray(t)?t.join(", "):t)}),A}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,A])=>e+": "+A).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...A){const t=new this(e);return A.forEach(i=>t.set(i)),t}static accessor(e){const t=(this[nc]=this[nc]={accessors:{}}).accessors,i=this.prototype;function n(s){const o=Vr(s);t[o]||(s1(i,s),t[o]=!0)}return j.isArray(e)?e.forEach(n):n(e),this}};OA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),j.reduceDescriptors(OA.prototype,({value:r},e)=>{let A=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(t){this[A]=t}}}),j.freezeMethods(OA);function Zs(r,e){const A=this||Pr,t=e||A,i=OA.from(t.headers);let n=t.data;return j.forEach(r,function(o){n=o.call(A,n,i.normalize(),e?e.status:void 0)}),i.normalize(),n}function sc(r){return!!(r&&r.__CANCEL__)}let zr=class extends Pe{constructor(e,A,t){super(e??"canceled",Pe.ERR_CANCELED,A,t),this.name="CanceledError",this.__CANCEL__=!0}};function oc(r,e,A){const t=A.config.validateStatus;!A.status||!t||t(A.status)?r(A):e(new Pe("Request failed with status code "+A.status,[Pe.ERR_BAD_REQUEST,Pe.ERR_BAD_RESPONSE][Math.floor(A.status/100)-4],A.config,A.request,A))}function o1(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function a1(r,e){r=r||10;const A=new Array(r),t=new Array(r);let i=0,n=0,s;return e=e!==void 0?e:1e3,function(a){const l=Date.now(),c=t[n];s||(s=l),A[i]=a,t[i]=l;let d=n,p=0;for(;d!==i;)p+=A[d++],d=d%r;if(i=(i+1)%r,i===n&&(n=(n+1)%r),l-s<e)return;const y=c&&l-c;return y?Math.round(p*1e3/y):void 0}}function l1(r,e){let A=0,t=1e3/e,i,n;const s=(l,c=Date.now())=>{A=c,i=null,n&&(clearTimeout(n),n=null),r(...l)};return[(...l)=>{const c=Date.now(),d=c-A;d>=t?s(l,c):(i=l,n||(n=setTimeout(()=>{n=null,s(i)},t-d)))},()=>i&&s(i)]}const Ri=(r,e,A=3)=>{let t=0;const i=a1(50,250);return l1(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,a=s-t,l=i(a),c=s<=o;t=s;const d={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&c?(o-s)/l:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(d)},A)},ac=(r,e)=>{const A=r!=null;return[t=>e[0]({lengthComputable:A,total:r,loaded:t}),e[1]]},lc=r=>(...e)=>j.asap(()=>r(...e)),c1=xA.hasStandardBrowserEnv?((r,e)=>A=>(A=new URL(A,xA.origin),r.protocol===A.protocol&&r.host===A.host&&(e||r.port===A.port)))(new URL(xA.origin),xA.navigator&&/(msie|trident)/i.test(xA.navigator.userAgent)):()=>!0,h1=xA.hasStandardBrowserEnv?{write(r,e,A,t,i,n,s){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(e)}`];j.isNumber(A)&&o.push(`expires=${new Date(A).toUTCString()}`),j.isString(t)&&o.push(`path=${t}`),j.isString(i)&&o.push(`domain=${i}`),n===!0&&o.push("secure"),j.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function u1(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function d1(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function cc(r,e,A){let t=!u1(e);return r&&(t||A==!1)?d1(r,e):e}const hc=r=>r instanceof OA?{...r}:r;function Xt(r,e){e=e||{};const A={};function t(l,c,d,p){return j.isPlainObject(l)&&j.isPlainObject(c)?j.merge.call({caseless:p},l,c):j.isPlainObject(c)?j.merge({},c):j.isArray(c)?c.slice():c}function i(l,c,d,p){if(j.isUndefined(c)){if(!j.isUndefined(l))return t(void 0,l,d,p)}else return t(l,c,d,p)}function n(l,c){if(!j.isUndefined(c))return t(void 0,c)}function s(l,c){if(j.isUndefined(c)){if(!j.isUndefined(l))return t(void 0,l)}else return t(void 0,c)}function o(l,c,d){if(d in e)return t(l,c);if(d in r)return t(void 0,l)}const a={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(l,c,d)=>i(hc(l),hc(c),d,!0)};return j.forEach(Object.keys({...r,...e}),function(c){if(c==="__proto__"||c==="constructor"||c==="prototype")return;const d=j.hasOwnProp(a,c)?a[c]:i,p=d(r[c],e[c],c);j.isUndefined(p)&&d!==o||(A[c]=p)}),A}const uc=r=>{const e=Xt({},r);let{data:A,withXSRFToken:t,xsrfHeaderName:i,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=OA.from(s),e.url=tc(cc(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),j.isFormData(A)){if(xA.hasStandardBrowserEnv||xA.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(j.isFunction(A.getHeaders)){const a=A.getHeaders(),l=["content-type","content-length"];Object.entries(a).forEach(([c,d])=>{l.includes(c.toLowerCase())&&s.set(c,d)})}}if(xA.hasStandardBrowserEnv&&(t&&j.isFunction(t)&&(t=t(e)),t||t!==!1&&c1(e.url))){const a=i&&n&&h1.read(n);a&&s.set(i,a)}return e},f1=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(A,t){const i=uc(r);let n=i.data;const s=OA.from(i.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:l}=i,c,d,p,y,w;function C(){y&&y(),w&&w(),i.cancelToken&&i.cancelToken.unsubscribe(c),i.signal&&i.signal.removeEventListener("abort",c)}let v=new XMLHttpRequest;v.open(i.method.toUpperCase(),i.url,!0),v.timeout=i.timeout;function S(){if(!v)return;const k=OA.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),V={data:!o||o==="text"||o==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:k,config:r,request:v};oc(function(Z){A(Z),C()},function(Z){t(Z),C()},V),v=null}"onloadend"in v?v.onloadend=S:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(S)},v.onabort=function(){v&&(t(new Pe("Request aborted",Pe.ECONNABORTED,r,v)),v=null)},v.onerror=function(x){const V=x&&x.message?x.message:"Network Error",N=new Pe(V,Pe.ERR_NETWORK,r,v);N.event=x||null,t(N),v=null},v.ontimeout=function(){let x=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const V=i.transitional||Ws;i.timeoutErrorMessage&&(x=i.timeoutErrorMessage),t(new Pe(x,V.clarifyTimeoutError?Pe.ETIMEDOUT:Pe.ECONNABORTED,r,v)),v=null},n===void 0&&s.setContentType(null),"setRequestHeader"in v&&j.forEach(s.toJSON(),function(x,V){v.setRequestHeader(V,x)}),j.isUndefined(i.withCredentials)||(v.withCredentials=!!i.withCredentials),o&&o!=="json"&&(v.responseType=i.responseType),l&&([p,w]=Ri(l,!0),v.addEventListener("progress",p)),a&&v.upload&&([d,y]=Ri(a),v.upload.addEventListener("progress",d),v.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(c=k=>{v&&(t(!k||k.type?new zr(null,r,v):k),v.abort(),v=null)},i.cancelToken&&i.cancelToken.subscribe(c),i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c)));const F=o1(i.url);if(F&&xA.protocols.indexOf(F)===-1){t(new Pe("Unsupported protocol "+F+":",Pe.ERR_BAD_REQUEST,r));return}v.send(n||null)})},p1=(r,e)=>{const{length:A}=r=r?r.filter(Boolean):[];if(e||A){let t=new AbortController,i;const n=function(l){if(!i){i=!0,o();const c=l instanceof Error?l:this.reason;t.abort(c instanceof Pe?c:new zr(c instanceof Error?c.message:c))}};let s=e&&setTimeout(()=>{s=null,n(new Pe(`timeout of ${e}ms exceeded`,Pe.ETIMEDOUT))},e);const o=()=>{r&&(s&&clearTimeout(s),s=null,r.forEach(l=>{l.unsubscribe?l.unsubscribe(n):l.removeEventListener("abort",n)}),r=null)};r.forEach(l=>l.addEventListener("abort",n));const{signal:a}=t;return a.unsubscribe=()=>j.asap(o),a}},g1=function*(r,e){let A=r.byteLength;if(A<e){yield r;return}let t=0,i;for(;t<A;)i=t+e,yield r.slice(t,i),t=i},m1=async function*(r,e){for await(const A of B1(r))yield*g1(A,e)},B1=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:A,value:t}=await e.read();if(A)break;yield t}}finally{await e.cancel()}},dc=(r,e,A,t)=>{const i=m1(r,e);let n=0,s,o=a=>{s||(s=!0,t&&t(a))};return new ReadableStream({async pull(a){try{const{done:l,value:c}=await i.next();if(l){o(),a.close();return}let d=c.byteLength;if(A){let p=n+=d;A(p)}a.enqueue(new Uint8Array(c))}catch(l){throw o(l),l}},cancel(a){return o(a),i.return()}},{highWaterMark:2})},fc=64*1024,{isFunction:Wi}=j,w1=(({Request:r,Response:e})=>({Request:r,Response:e}))(j.global),{ReadableStream:pc,TextEncoder:gc}=j.global,mc=(r,...e)=>{try{return!!r(...e)}catch{return!1}},C1=r=>{r=j.merge.call({skipUndefined:!0},w1,r);const{fetch:e,Request:A,Response:t}=r,i=e?Wi(e):typeof fetch=="function",n=Wi(A),s=Wi(t);if(!i)return!1;const o=i&&Wi(pc),a=i&&(typeof gc=="function"?(w=>C=>w.encode(C))(new gc):async w=>new Uint8Array(await new A(w).arrayBuffer())),l=n&&o&&mc(()=>{let w=!1;const C=new A(xA.origin,{body:new pc,method:"POST",get duplex(){return w=!0,"half"}}).headers.has("Content-Type");return w&&!C}),c=s&&o&&mc(()=>j.isReadableStream(new t("").body)),d={stream:c&&(w=>w.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(w=>{!d[w]&&(d[w]=(C,v)=>{let S=C&&C[w];if(S)return S.call(C);throw new Pe(`Response type '${w}' is not supported`,Pe.ERR_NOT_SUPPORT,v)})});const p=async w=>{if(w==null)return 0;if(j.isBlob(w))return w.size;if(j.isSpecCompliantForm(w))return(await new A(xA.origin,{method:"POST",body:w}).arrayBuffer()).byteLength;if(j.isArrayBufferView(w)||j.isArrayBuffer(w))return w.byteLength;if(j.isURLSearchParams(w)&&(w=w+""),j.isString(w))return(await a(w)).byteLength},y=async(w,C)=>{const v=j.toFiniteNumber(w.getContentLength());return v??p(C)};return async w=>{let{url:C,method:v,data:S,signal:F,cancelToken:k,timeout:x,onDownloadProgress:V,onUploadProgress:N,responseType:Z,headers:X,withCredentials:W="same-origin",fetchOptions:ae}=uc(w),G=e||fetch;Z=Z?(Z+"").toLowerCase():"text";let ee=p1([F,k&&k.toAbortSignal()],x),oe=null;const me=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let Le;try{if(N&&l&&v!=="get"&&v!=="head"&&(Le=await y(X,S))!==0){let Ce=new A(C,{method:"POST",body:S,duplex:"half"}),ge;if(j.isFormData(S)&&(ge=Ce.headers.get("content-type"))&&X.setContentType(ge),Ce.body){const[Me,_e]=ac(Le,Ri(lc(N)));S=dc(Ce.body,fc,Me,_e)}}j.isString(W)||(W=W?"include":"omit");const Ue=n&&"credentials"in A.prototype,Fe={...ae,signal:ee,method:v.toUpperCase(),headers:X.normalize().toJSON(),body:S,duplex:"half",credentials:Ue?W:void 0};oe=n&&new A(C,Fe);let ke=await(n?G(oe,ae):G(C,Fe));const ye=c&&(Z==="stream"||Z==="response");if(c&&(V||ye&&me)){const Ce={};["status","statusText","headers"].forEach(Be=>{Ce[Be]=ke[Be]});const ge=j.toFiniteNumber(ke.headers.get("content-length")),[Me,_e]=V&&ac(ge,Ri(lc(V),!0))||[];ke=new t(dc(ke.body,fc,Me,()=>{_e&&_e(),me&&me()}),Ce)}Z=Z||"text";let ve=await d[j.findKey(d,Z)||"text"](ke,w);return!ye&&me&&me(),await new Promise((Ce,ge)=>{oc(Ce,ge,{data:ve,headers:OA.from(ke.headers),status:ke.status,statusText:ke.statusText,config:w,request:oe})})}catch(Ue){throw me&&me(),Ue&&Ue.name==="TypeError"&&/Load failed|fetch/i.test(Ue.message)?Object.assign(new Pe("Network Error",Pe.ERR_NETWORK,w,oe,Ue&&Ue.response),{cause:Ue.cause||Ue}):Pe.from(Ue,Ue&&Ue.code,w,oe,Ue&&Ue.response)}}},v1=new Map,Bc=r=>{let e=r&&r.env||{};const{fetch:A,Request:t,Response:i}=e,n=[t,i,A];let s=n.length,o=s,a,l,c=v1;for(;o--;)a=n[o],l=c.get(a),l===void 0&&c.set(a,l=o?new Map:C1(e)),c=l;return l};Bc();const qs={http:z0,xhr:f1,fetch:{get:Bc}};j.forEach(qs,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const wc=r=>`- ${r}`,y1=r=>j.isFunction(r)||r===null||r===!1;function b1(r,e){r=j.isArray(r)?r:[r];const{length:A}=r;let t,i;const n={};for(let s=0;s<A;s++){t=r[s];let o;if(i=t,!y1(t)&&(i=qs[(o=String(t)).toLowerCase()],i===void 0))throw new Pe(`Unknown adapter '${o}'`);if(i&&(j.isFunction(i)||(i=i.get(e))))break;n[o||"#"+s]=i}if(!i){const s=Object.entries(n).map(([a,l])=>`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=A?s.length>1?`since :
4
+ `+s.map(wc).join(`
5
+ `):" "+wc(s[0]):"as no adapter specified";throw new Pe("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i}const Cc={getAdapter:b1,adapters:qs};function Ys(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new zr(null,r)}function vc(r){return Ys(r),r.headers=OA.from(r.headers),r.data=Zs.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Cc.getAdapter(r.adapter||Pr.adapter,r)(r).then(function(t){return Ys(r),t.data=Zs.call(r,r.transformResponse,t),t.headers=OA.from(t.headers),t},function(t){return sc(t)||(Ys(r),t&&t.response&&(t.response.data=Zs.call(r,r.transformResponse,t.response),t.response.headers=OA.from(t.response.headers))),Promise.reject(t)})}const yc="1.13.5",$i={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{$i[r]=function(t){return typeof t===r||"a"+(e<1?"n ":" ")+r}});const bc={};$i.transitional=function(e,A,t){function i(n,s){return"[Axios v"+yc+"] Transitional option '"+n+"'"+s+(t?". "+t:"")}return(n,s,o)=>{if(e===!1)throw new Pe(i(s," has been removed"+(A?" in "+A:"")),Pe.ERR_DEPRECATED);return A&&!bc[s]&&(bc[s]=!0,console.warn(i(s," has been deprecated since v"+A+" and will be removed in the near future"))),e?e(n,s,o):!0}},$i.spelling=function(e){return(A,t)=>(console.warn(`${t} is likely a misspelling of ${e}`),!0)};function T1(r,e,A){if(typeof r!="object")throw new Pe("options must be an object",Pe.ERR_BAD_OPTION_VALUE);const t=Object.keys(r);let i=t.length;for(;i-- >0;){const n=t[i],s=e[n];if(s){const o=r[n],a=o===void 0||s(o,n,r);if(a!==!0)throw new Pe("option "+n+" must be "+a,Pe.ERR_BAD_OPTION_VALUE);continue}if(A!==!0)throw new Pe("Unknown option "+n,Pe.ERR_BAD_OPTION)}}const Xi={assertOptions:T1,validators:$i},XA=Xi.validators;let Jt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new rc,response:new rc}}async request(e,A){try{return await this._request(e,A)}catch(t){if(t instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const n=i.stack?i.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+=`
6
+ `+n):t.stack=n}catch{}}throw t}}_request(e,A){typeof e=="string"?(A=A||{},A.url=e):A=e||{},A=Xt(this.defaults,A);const{transitional:t,paramsSerializer:i,headers:n}=A;t!==void 0&&Xi.assertOptions(t,{silentJSONParsing:XA.transitional(XA.boolean),forcedJSONParsing:XA.transitional(XA.boolean),clarifyTimeoutError:XA.transitional(XA.boolean),legacyInterceptorReqResOrdering:XA.transitional(XA.boolean)},!1),i!=null&&(j.isFunction(i)?A.paramsSerializer={serialize:i}:Xi.assertOptions(i,{encode:XA.function,serialize:XA.function},!0)),A.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?A.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:A.allowAbsoluteUrls=!0),Xi.assertOptions(A,{baseUrl:XA.spelling("baseURL"),withXsrfToken:XA.spelling("withXSRFToken")},!0),A.method=(A.method||this.defaults.method||"get").toLowerCase();let s=n&&j.merge(n.common,n[A.method]);n&&j.forEach(["delete","get","head","post","put","patch","common"],w=>{delete n[w]}),A.headers=OA.concat(s,n);const o=[];let a=!0;this.interceptors.request.forEach(function(C){if(typeof C.runWhen=="function"&&C.runWhen(A)===!1)return;a=a&&C.synchronous;const v=A.transitional||Ws;v&&v.legacyInterceptorReqResOrdering?o.unshift(C.fulfilled,C.rejected):o.push(C.fulfilled,C.rejected)});const l=[];this.interceptors.response.forEach(function(C){l.push(C.fulfilled,C.rejected)});let c,d=0,p;if(!a){const w=[vc.bind(this),void 0];for(w.unshift(...o),w.push(...l),p=w.length,c=Promise.resolve(A);d<p;)c=c.then(w[d++],w[d++]);return c}p=o.length;let y=A;for(;d<p;){const w=o[d++],C=o[d++];try{y=w(y)}catch(v){C.call(this,v);break}}try{c=vc.call(this,y)}catch(w){return Promise.reject(w)}for(d=0,p=l.length;d<p;)c=c.then(l[d++],l[d++]);return c}getUri(e){e=Xt(this.defaults,e);const A=cc(e.baseURL,e.url,e.allowAbsoluteUrls);return tc(A,e.params,e.paramsSerializer)}};j.forEach(["delete","get","head","options"],function(e){Jt.prototype[e]=function(A,t){return this.request(Xt(t||{},{method:e,url:A,data:(t||{}).data}))}}),j.forEach(["post","put","patch"],function(e){function A(t){return function(n,s,o){return this.request(Xt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Jt.prototype[e]=A(),Jt.prototype[e+"Form"]=A(!0)});let Q1=class Fd{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let A;this.promise=new Promise(function(n){A=n});const t=this;this.promise.then(i=>{if(!t._listeners)return;let n=t._listeners.length;for(;n-- >0;)t._listeners[n](i);t._listeners=null}),this.promise.then=i=>{let n;const s=new Promise(o=>{t.subscribe(o),n=o}).then(i);return s.cancel=function(){t.unsubscribe(n)},s},e(function(n,s,o){t.reason||(t.reason=new zr(n,s,o),A(t.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const A=this._listeners.indexOf(e);A!==-1&&this._listeners.splice(A,1)}toAbortSignal(){const e=new AbortController,A=t=>{e.abort(t)};return this.subscribe(A),e.signal.unsubscribe=()=>this.unsubscribe(A),e.signal}static source(){let e;return{token:new Fd(function(i){e=i}),cancel:e}}};function x1(r){return function(A){return r.apply(null,A)}}function F1(r){return j.isObject(r)&&r.isAxiosError===!0}const js={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(js).forEach(([r,e])=>{js[e]=r});function Tc(r){const e=new Jt(r),A=zl(Jt.prototype.request,e);return j.extend(A,Jt.prototype,e,{allOwnKeys:!0}),j.extend(A,e,null,{allOwnKeys:!0}),A.create=function(i){return Tc(Xt(r,i))},A}const oA=Tc(Pr);oA.Axios=Jt,oA.CanceledError=zr,oA.CancelToken=Q1,oA.isCancel=sc,oA.VERSION=yc,oA.toFormData=zi,oA.AxiosError=Pe,oA.Cancel=oA.CanceledError,oA.all=function(e){return Promise.all(e)},oA.spread=x1,oA.isAxiosError=F1,oA.mergeConfig=Xt,oA.AxiosHeaders=OA,oA.formToJSON=r=>ic(j.isHTMLForm(r)?new FormData(r):r),oA.getAdapter=Cc.getAdapter,oA.HttpStatusCode=js,oA.default=oA;const{Axios:dy,AxiosError:fy,CanceledError:py,isCancel:gy,CancelToken:my,VERSION:By,all:wy,Cancel:Cy,isAxiosError:vy,spread:yy,toFormData:by,AxiosHeaders:Ty,HttpStatusCode:Qy,formToJSON:xy,getAdapter:Fy,mergeConfig:Uy}=oA,lt=Object.create(null);lt.open="0",lt.close="1",lt.ping="2",lt.pong="3",lt.message="4",lt.upgrade="5",lt.noop="6";const Ji=Object.create(null);Object.keys(lt).forEach(r=>{Ji[lt[r]]=r});const eo={type:"error",data:"parser error"},Qc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",xc=typeof ArrayBuffer=="function",Fc=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,Ao=({type:r,data:e},A,t)=>Qc&&e instanceof Blob?A?t(e):Uc(e,t):xc&&(e instanceof ArrayBuffer||Fc(e))?A?t(e):Uc(new Blob([e]),t):t(lt[r]+(e||"")),Uc=(r,e)=>{const A=new FileReader;return A.onload=function(){const t=A.result.split(",")[1];e("b"+(t||""))},A.readAsDataURL(r)};function Ec(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let to;function U1(r,e){if(Qc&&r.data instanceof Blob)return r.data.arrayBuffer().then(Ec).then(e);if(xc&&(r.data instanceof ArrayBuffer||Fc(r.data)))return e(Ec(r.data));Ao(r,!1,A=>{to||(to=new TextEncoder),e(to.encode(A))})}const Sc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Sc.length;r++)Gr[Sc.charCodeAt(r)]=r;const E1=r=>{let e=r.length*.75,A=r.length,t,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const l=new ArrayBuffer(e),c=new Uint8Array(l);for(t=0;t<A;t+=4)n=Gr[r.charCodeAt(t)],s=Gr[r.charCodeAt(t+1)],o=Gr[r.charCodeAt(t+2)],a=Gr[r.charCodeAt(t+3)],c[i++]=n<<2|s>>4,c[i++]=(s&15)<<4|o>>2,c[i++]=(o&3)<<6|a&63;return l},S1=typeof ArrayBuffer=="function",ro=(r,e)=>{if(typeof r!="string")return{type:"message",data:Hc(r,e)};const A=r.charAt(0);return A==="b"?{type:"message",data:H1(r.substring(1),e)}:Ji[A]?r.length>1?{type:Ji[A],data:r.substring(1)}:{type:Ji[A]}:eo},H1=(r,e)=>{if(S1){const A=E1(r);return Hc(A,e)}else return{base64:!0,data:r}},Hc=(r,e)=>e==="blob"?r instanceof Blob?r:new Blob([r]):r instanceof ArrayBuffer?r:r.buffer,Lc="",L1=(r,e)=>{const A=r.length,t=new Array(A);let i=0;r.forEach((n,s)=>{Ao(n,!1,o=>{t[s]=o,++i===A&&e(t.join(Lc))})})},M1=(r,e)=>{const A=r.split(Lc),t=[];for(let i=0;i<A.length;i++){const n=ro(A[i],e);if(t.push(n),n.type==="error")break}return t};function I1(){return new TransformStream({transform(r,e){U1(r,A=>{const t=A.length;let i;if(t<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,t);else if(t<65536){i=new Uint8Array(3);const n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,t)}else{i=new Uint8Array(9);const n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(t))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(A)})}})}let io;function Zi(r){return r.reduce((e,A)=>e+A.length,0)}function qi(r,e){if(r[0].length===e)return r.shift();const A=new Uint8Array(e);let t=0;for(let i=0;i<e;i++)A[i]=r[0][t++],t===r[0].length&&(r.shift(),t=0);return r.length&&t<r[0].length&&(r[0]=r[0].slice(t)),A}function _1(r,e){io||(io=new TextDecoder);const A=[];let t=0,i=-1,n=!1;return new TransformStream({transform(s,o){for(A.push(s);;){if(t===0){if(Zi(A)<1)break;const a=qi(A,1);n=(a[0]&128)===128,i=a[0]&127,i<126?t=3:i===126?t=1:t=2}else if(t===1){if(Zi(A)<2)break;const a=qi(A,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),t=3}else if(t===2){if(Zi(A)<8)break;const a=qi(A,8),l=new DataView(a.buffer,a.byteOffset,a.length),c=l.getUint32(0);if(c>Math.pow(2,21)-1){o.enqueue(eo);break}i=c*Math.pow(2,32)+l.getUint32(4),t=3}else{if(Zi(A)<i)break;const a=qi(A,i);o.enqueue(ro(n?a:io.decode(a),e)),t=0}if(i===0||i>r){o.enqueue(eo);break}}}})}const Mc=4;function gA(r){if(r)return D1(r)}function D1(r){for(var e in gA.prototype)r[e]=gA.prototype[e];return r}gA.prototype.on=gA.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this},gA.prototype.once=function(r,e){function A(){this.off(r,A),e.apply(this,arguments)}return A.fn=e,this.on(r,A),this},gA.prototype.off=gA.prototype.removeListener=gA.prototype.removeAllListeners=gA.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var A=this._callbacks["$"+r];if(!A)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var t,i=0;i<A.length;i++)if(t=A[i],t===e||t.fn===e){A.splice(i,1);break}return A.length===0&&delete this._callbacks["$"+r],this},gA.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),A=this._callbacks["$"+r],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(A){A=A.slice(0);for(var t=0,i=A.length;t<i;++t)A[t].apply(this,e)}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 Yi=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,A)=>A(e,0),JA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),k1="arraybuffer";function Ey(){}function Ic(r,...e){return e.reduce((A,t)=>(r.hasOwnProperty(t)&&(A[t]=r[t]),A),{})}const O1=JA.setTimeout,N1=JA.clearTimeout;function ji(r,e){e.useNativeTimers?(r.setTimeoutFn=O1.bind(JA),r.clearTimeoutFn=N1.bind(JA)):(r.setTimeoutFn=JA.setTimeout.bind(JA),r.clearTimeoutFn=JA.clearTimeout.bind(JA))}const K1=1.33;function P1(r){return typeof r=="string"?V1(r):Math.ceil((r.byteLength||r.size)*K1)}function V1(r){let e=0,A=0;for(let t=0,i=r.length;t<i;t++)e=r.charCodeAt(t),e<128?A+=1:e<2048?A+=2:e<55296||e>=57344?A+=3:(t++,A+=4);return A}function _c(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function z1(r){let e="";for(let A in r)r.hasOwnProperty(A)&&(e.length&&(e+="&"),e+=encodeURIComponent(A)+"="+encodeURIComponent(r[A]));return e}function G1(r){let e={},A=r.split("&");for(let t=0,i=A.length;t<i;t++){let n=A[t].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class R1 extends Error{constructor(e,A,t){super(e),this.description=A,this.context=t,this.type="TransportError"}}class no extends gA{constructor(e){super(),this.writable=!1,ji(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,A,t){return super.emitReserved("error",new R1(e,A,t)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const A=ro(e,this.socket.binaryType);this.onPacket(A)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,A={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(A)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_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(e){const A=z1(e);return A.length?"?"+A:""}}class W1 extends no{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const A=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||A()})),this.writable||(t++,this.once("drain",function(){--t||A()}))}else A()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const A=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)};M1(e,this.socket.binaryType).forEach(A),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,L1(e,A=>{this.doWrite(A,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",A=this.query||{};return this.opts.timestampRequests!==!1&&(A[this.opts.timestampParam]=_c()),!this.supportsBinary&&!A.sid&&(A.b64=1),this.createUri(e,A)}}let Dc=!1;try{Dc=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const $1=Dc;function X1(){}class J1 extends W1{constructor(e){if(super(e),typeof location<"u"){const A=location.protocol==="https:";let t=location.port;t||(t=A?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||t!==e.port}}doWrite(e,A){const t=this.request({method:"POST",data:e});t.on("success",A),t.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(A,t)=>{this.onError("xhr poll error",A,t)}),this.pollXhr=e}}class ct extends gA{constructor(e,A,t){super(),this.createRequest=e,ji(this,t),this._opts=t,this._method=t.method||"GET",this._uri=A,this._data=t.data!==void 0?t.data:null,this._create()}_create(){var e;const A=Ic(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");A.xdomain=!!this._opts.xd;const t=this._xhr=this.createRequest(A);try{t.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&t.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(t),"withCredentials"in t&&(t.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(t.timeout=this._opts.requestTimeout),t.onreadystatechange=()=>{var i;t.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.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(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=ct.requestsCount++,ct.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=X1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ct.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(ct.requestsCount=0,ct.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",kc);else if(typeof addEventListener=="function"){const r="onpagehide"in JA?"pagehide":"unload";addEventListener(r,kc,!1)}}function kc(){for(let r in ct.requests)ct.requests.hasOwnProperty(r)&&ct.requests[r].abort()}const Z1=(function(){const r=Oc({xdomain:!1});return r&&r.responseType!==null})();class q1 extends J1{constructor(e){super(e);const A=e&&e.forceBase64;this.supportsBinary=Z1&&!A}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new ct(Oc,this.uri(),e)}}function Oc(r){const e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||$1))return new XMLHttpRequest}catch{}if(!e)try{return new JA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Nc=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Y1 extends no{get name(){return"websocket"}doOpen(){const e=this.uri(),A=this.opts.protocols,t=Nc?{}:Ic(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(e,A,t)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let A=0;A<e.length;A++){const t=e[A],i=A===e.length-1;Ao(t,this.supportsBinary,n=>{try{this.doWrite(t,n)}catch{}i&&Yi(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",A=this.query||{};return this.opts.timestampRequests&&(A[this.opts.timestampParam]=_c()),this.supportsBinary||(A.b64=1),this.createUri(e,A)}}const so=JA.WebSocket||JA.MozWebSocket;class j1 extends Y1{createSocket(e,A,t){return Nc?new so(e,A,t):A?new so(e,A):new so(e)}doWrite(e,A){this.ws.send(A)}}class eg extends no{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const A=_1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),t=e.readable.pipeThrough(A).getReader(),i=I1();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const n=()=>{t.read().then(({done:o,value:a})=>{o||(this.onPacket(a),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let A=0;A<e.length;A++){const t=e[A],i=A===e.length-1;this._writer.write(t).then(()=>{i&&Yi(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Ag={websocket:j1,webtransport:eg,polling:q1},tg=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,rg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function oo(r){if(r.length>8e3)throw"URI too long";const e=r,A=r.indexOf("["),t=r.indexOf("]");A!=-1&&t!=-1&&(r=r.substring(0,A)+r.substring(A,t).replace(/:/g,";")+r.substring(t,r.length));let i=tg.exec(r||""),n={},s=14;for(;s--;)n[rg[s]]=i[s]||"";return A!=-1&&t!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=ig(n,n.path),n.queryKey=ng(n,n.query),n}function ig(r,e){const A=/\/{2,9}/g,t=e.replace(A,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&t.splice(0,1),e.slice(-1)=="/"&&t.splice(t.length-1,1),t}function ng(r,e){const A={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,i,n){i&&(A[i]=n)}),A}const ao=typeof addEventListener=="function"&&typeof removeEventListener=="function",en=[];ao&&addEventListener("offline",()=>{en.forEach(r=>r())},!1);class Et extends gA{constructor(e,A){if(super(),this.binaryType=k1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(A=e,e=null),e){const t=oo(e);A.hostname=t.host,A.secure=t.protocol==="https"||t.protocol==="wss",A.port=t.port,t.query&&(A.query=t.query)}else A.host&&(A.hostname=oo(A.host).host);ji(this,A),this.secure=A.secure!=null?A.secure:typeof location<"u"&&location.protocol==="https:",A.hostname&&!A.port&&(A.port=this.secure?"443":"80"),this.hostname=A.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=A.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},A.transports.forEach(t=>{const i=t.prototype.name;this.transports.push(i),this._transportsByName[i]=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},A),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=G1(this.opts.query)),ao&&(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"})},en.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const A=Object.assign({},this.opts.query);A.EIO=Mc,A.transport=e,this.id&&(A.sid=this.id);const t=Object.assign({},this.opts,{query:A,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](t)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Et.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const A=this.createTransport(e);A.open(),this.setTransport(A)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",A=>this._onClose("transport close",A))}onOpen(){this.readyState="open",Et.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const A=new Error("server error");A.code=e.data,this._onError(A);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let A=1;for(let t=0;t<this.writeBuffer.length;t++){const i=this.writeBuffer[t].data;if(i&&(A+=P1(i)),t>0&&A>this._maxPayload)return this.writeBuffer.slice(0,t);A+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Yi(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,A,t){return this._sendPacket("message",e,A,t),this}send(e,A,t){return this._sendPacket("message",e,A,t),this}_sendPacket(e,A,t,i){if(typeof A=="function"&&(i=A,A=void 0),typeof t=="function"&&(i=t,t=null),this.readyState==="closing"||this.readyState==="closed")return;t=t||{},t.compress=t.compress!==!1;const n={type:e,data:A,options:t};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},A=()=>{this.off("upgrade",A),this.off("upgradeError",A),e()},t=()=>{this.once("upgrade",A),this.once("upgradeError",A)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?t():e()}):this.upgrading?t():e()),this}_onError(e){if(Et.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,A){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(),ao&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const t=en.indexOf(this._offlineEventListener);t!==-1&&en.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,A),this.writeBuffer=[],this._prevBufferLen=0}}}Et.protocol=Mc;class sg extends Et{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let A=this.createTransport(e),t=!1;Et.priorWebsocketSuccess=!1;const i=()=>{t||(A.send([{type:"ping",data:"probe"}]),A.once("packet",d=>{if(!t)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",A),!A)return;Et.priorWebsocketSuccess=A.name==="websocket",this.transport.pause(()=>{t||this.readyState!=="closed"&&(c(),this.setTransport(A),A.send([{type:"upgrade"}]),this.emitReserved("upgrade",A),A=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=A.name,this.emitReserved("upgradeError",p)}}))};function n(){t||(t=!0,c(),A.close(),A=null)}const s=d=>{const p=new Error("probe error: "+d);p.transport=A.name,n(),this.emitReserved("upgradeError",p)};function o(){s("transport closed")}function a(){s("socket closed")}function l(d){A&&d.name!==A.name&&n()}const c=()=>{A.removeListener("open",i),A.removeListener("error",s),A.removeListener("close",o),this.off("close",a),this.off("upgrading",l)};A.once("open",i),A.once("error",s),A.once("close",o),this.once("close",a),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{t||A.open()},200):A.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const A=[];for(let t=0;t<e.length;t++)~this.transports.indexOf(e[t])&&A.push(e[t]);return A}}let og=class extends sg{constructor(e,A={}){const t=typeof e=="object"?e:A;(!t.transports||t.transports&&typeof t.transports[0]=="string")&&(t.transports=(t.transports||["polling","websocket","webtransport"]).map(i=>Ag[i]).filter(i=>!!i)),super(e,t)}};function ag(r,e="",A){let t=r;A=A||typeof location<"u"&&location,r==null&&(r=A.protocol+"//"+A.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=A.protocol+r:r=A.host+r),/^(https?|wss?):\/\//.test(r)||(typeof A<"u"?r=A.protocol+"//"+r:r="https://"+r),t=oo(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 n=t.host.indexOf(":")!==-1?"["+t.host+"]":t.host;return t.id=t.protocol+"://"+n+":"+t.port+e,t.href=t.protocol+"://"+n+(A&&A.port===t.port?"":":"+t.port),t}const lg=typeof ArrayBuffer=="function",cg=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Kc=Object.prototype.toString,hg=typeof Blob=="function"||typeof Blob<"u"&&Kc.call(Blob)==="[object BlobConstructor]",ug=typeof File=="function"||typeof File<"u"&&Kc.call(File)==="[object FileConstructor]";function lo(r){return lg&&(r instanceof ArrayBuffer||cg(r))||hg&&r instanceof Blob||ug&&r instanceof File}function An(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let A=0,t=r.length;A<t;A++)if(An(r[A]))return!0;return!1}if(lo(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return An(r.toJSON(),!0);for(const A in r)if(Object.prototype.hasOwnProperty.call(r,A)&&An(r[A]))return!0;return!1}function dg(r){const e=[],A=r.data,t=r;return t.data=co(A,e),t.attachments=e.length,{packet:t,buffers:e}}function co(r,e){if(!r)return r;if(lo(r)){const A={_placeholder:!0,num:e.length};return e.push(r),A}else if(Array.isArray(r)){const A=new Array(r.length);for(let t=0;t<r.length;t++)A[t]=co(r[t],e);return A}else if(typeof r=="object"&&!(r instanceof Date)){const A={};for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&(A[t]=co(r[t],e));return A}return r}function fg(r,e){return r.data=ho(r.data,e),delete r.attachments,r}function ho(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let A=0;A<r.length;A++)r[A]=ho(r[A],e);else if(typeof r=="object")for(const A in r)Object.prototype.hasOwnProperty.call(r,A)&&(r[A]=ho(r[A],e));return r}const pg=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ze;(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"})(Ze||(Ze={}));class gg{constructor(e){this.replacer=e}encode(e){return(e.type===Ze.EVENT||e.type===Ze.ACK)&&An(e)?this.encodeAsBinary({type:e.type===Ze.EVENT?Ze.BINARY_EVENT:Ze.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let A=""+e.type;return(e.type===Ze.BINARY_EVENT||e.type===Ze.BINARY_ACK)&&(A+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(A+=e.nsp+","),e.id!=null&&(A+=e.id),e.data!=null&&(A+=JSON.stringify(e.data,this.replacer)),A}encodeAsBinary(e){const A=dg(e),t=this.encodeAsString(A.packet),i=A.buffers;return i.unshift(t),i}}class uo extends gA{constructor(e){super(),this.reviver=e}add(e){let A;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");A=this.decodeString(e);const t=A.type===Ze.BINARY_EVENT;t||A.type===Ze.BINARY_ACK?(A.type=t?Ze.EVENT:Ze.ACK,this.reconstructor=new mg(A),A.attachments===0&&super.emitReserved("decoded",A)):super.emitReserved("decoded",A)}else if(lo(e)||e.base64)if(this.reconstructor)A=this.reconstructor.takeBinaryData(e),A&&(this.reconstructor=null,super.emitReserved("decoded",A));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let A=0;const t={type:Number(e.charAt(0))};if(Ze[t.type]===void 0)throw new Error("unknown packet type "+t.type);if(t.type===Ze.BINARY_EVENT||t.type===Ze.BINARY_ACK){const n=A+1;for(;e.charAt(++A)!=="-"&&A!=e.length;);const s=e.substring(n,A);if(s!=Number(s)||e.charAt(A)!=="-")throw new Error("Illegal attachments");t.attachments=Number(s)}if(e.charAt(A+1)==="/"){const n=A+1;for(;++A&&!(e.charAt(A)===","||A===e.length););t.nsp=e.substring(n,A)}else t.nsp="/";const i=e.charAt(A+1);if(i!==""&&Number(i)==i){const n=A+1;for(;++A;){const s=e.charAt(A);if(s==null||Number(s)!=s){--A;break}if(A===e.length)break}t.id=Number(e.substring(n,A+1))}if(e.charAt(++A)){const n=this.tryParse(e.substr(A));if(uo.isPayloadValid(t.type,n))t.data=n;else throw new Error("invalid payload")}return t}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,A){switch(e){case Ze.CONNECT:return Pc(A);case Ze.DISCONNECT:return A===void 0;case Ze.CONNECT_ERROR:return typeof A=="string"||Pc(A);case Ze.EVENT:case Ze.BINARY_EVENT:return Array.isArray(A)&&(typeof A[0]=="number"||typeof A[0]=="string"&&pg.indexOf(A[0])===-1);case Ze.ACK:case Ze.BINARY_ACK:return Array.isArray(A)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class mg{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const A=fg(this.reconPack,this.buffers);return this.finishedReconstruction(),A}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Pc(r){return Object.prototype.toString.call(r)==="[object Object]"}const Bg=Object.freeze(Object.defineProperty({__proto__:null,Decoder:uo,Encoder:gg,get PacketType(){return Ze}},Symbol.toStringTag,{value:"Module"}));function rt(r,e,A){return r.on(e,A),function(){r.off(e,A)}}const wg=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Vc extends gA{constructor(e,A,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=e,this.nsp=A,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 e=this.io;this.subs=[rt(e,"open",this.onopen.bind(this)),rt(e,"packet",this.onpacket.bind(this)),rt(e,"error",this.onerror.bind(this)),rt(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...A){var t,i,n;if(wg.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(A.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(A),this;const s={type:Ze.EVENT,data:A};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof A[A.length-1]=="function"){const c=this.ids++,d=A.pop();this._registerAckCallback(c,d),s.id=c}const o=(i=(t=this.io.engine)===null||t===void 0?void 0:t.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,A){var t;const i=(t=this.flags.timeout)!==null&&t!==void 0?t:this._opts.ackTimeout;if(i===void 0){this.acks[e]=A;return}const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);A.call(this,new Error("operation has timed out"))},i),s=(...o)=>{this.io.clearTimeoutFn(n),A.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...A){return new Promise((t,i)=>{const n=(s,o)=>s?i(s):t(o);n.withError=!0,A.push(n),this.emit(e,...A)})}_addToQueue(e){let A;typeof e[e.length-1]=="function"&&(A=e.pop());const t={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>(this._queue[0],i!==null?t.tryCount>this._opts.retries&&(this._queue.shift(),A&&A(i)):(this._queue.shift(),A&&A(null,...n)),t.pending=!1,this._drainQueue())),this._queue.push(t),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const A=this._queue[0];A.pending&&!e||(A.pending=!0,A.tryCount++,this.flags=A.flags,this.emit.apply(this,A.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ze.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,A){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,A),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ze.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Ze.EVENT:case Ze.BINARY_EVENT:this.onevent(e);break;case Ze.ACK:case Ze.BINARY_ACK:this.onack(e);break;case Ze.DISCONNECT:this.ondisconnect();break;case Ze.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t);break}}onevent(e){const A=e.data||[];e.id!=null&&A.push(this.ack(e.id)),this.connected?this.emitEvent(A):this.receiveBuffer.push(Object.freeze(A))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const A=this._anyListeners.slice();for(const t of A)t.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const A=this;let t=!1;return function(...i){t||(t=!0,A.packet({type:Ze.ACK,id:e,data:i}))}}onack(e){const A=this.acks[e.id];typeof A=="function"&&(delete this.acks[e.id],A.withError&&e.data.unshift(null),A.apply(this,e.data))}onconnect(e,A){this.id=e,this.recovered=A&&this._pid===A,this._pid=A,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ze.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const A=this._anyListeners;for(let t=0;t<A.length;t++)if(e===A[t])return A.splice(t,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const A=this._anyOutgoingListeners;for(let t=0;t<A.length;t++)if(e===A[t])return A.splice(t,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const A=this._anyOutgoingListeners.slice();for(const t of A)t.apply(this,e.data)}}}function hr(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}hr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),A=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-A:r+A}return Math.min(r,this.max)|0},hr.prototype.reset=function(){this.attempts=0},hr.prototype.setMin=function(r){this.ms=r},hr.prototype.setMax=function(r){this.max=r},hr.prototype.setJitter=function(r){this.jitter=r};class fo extends gA{constructor(e,A){var t;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(A=e,e=void 0),A=A||{},A.path=A.path||"/socket.io",this.opts=A,ji(this,A),this.reconnection(A.reconnection!==!1),this.reconnectionAttempts(A.reconnectionAttempts||1/0),this.reconnectionDelay(A.reconnectionDelay||1e3),this.reconnectionDelayMax(A.reconnectionDelayMax||5e3),this.randomizationFactor((t=A.randomizationFactor)!==null&&t!==void 0?t:.5),this.backoff=new hr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(A.timeout==null?2e4:A.timeout),this._readyState="closed",this.uri=e;const i=A.parser||Bg;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=A.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var A;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(A=this.backoff)===null||A===void 0||A.setMin(e),this)}randomizationFactor(e){var A;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(A=this.backoff)===null||A===void 0||A.setJitter(e),this)}reconnectionDelayMax(e){var A;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(A=this.backoff)===null||A===void 0||A.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new og(this.uri,this.opts);const A=this.engine,t=this;this._readyState="opening",this.skipReconnect=!1;const i=rt(A,"open",function(){t.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=rt(A,"error",n);if(this._timeout!==!1){const o=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),A.close()},o);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(rt(e,"ping",this.onping.bind(this)),rt(e,"data",this.ondata.bind(this)),rt(e,"error",this.onerror.bind(this)),rt(e,"close",this.onclose.bind(this)),rt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(A){this.onclose("parse error",A)}}ondecoded(e){Yi(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,A){let t=this.nsps[e];return t?this._autoConnect&&!t.active&&t.connect():(t=new Vc(this,e,A),this.nsps[e]=t),t}_destroy(e){const A=Object.keys(this.nsps);for(const t of A)if(this.nsps[t].active)return;this._close()}_packet(e){const A=this.encoder.encode(e);for(let t=0;t<A.length;t++)this.engine.write(A[t],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,A){var t;this.cleanup(),(t=this.engine)===null||t===void 0||t.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,A),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const A=this.backoff.duration();this._reconnecting=!0;const t=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},A);this.opts.autoUnref&&t.unref(),this.subs.push(()=>{this.clearTimeoutFn(t)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Rr={};function tn(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};const A=ag(r,e.path||"/socket.io"),t=A.source,i=A.id,n=A.path,s=Rr[i]&&n in Rr[i].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let a;return o?a=new fo(t,e):(Rr[i]||(Rr[i]=new fo(t,e)),a=Rr[i]),A.query&&!e.query&&(e.query=A.queryKey),a.socket(A.path,e)}Object.assign(tn,{Manager:fo,Socket:Vc,io:tn,connect:tn});function po(r){if(!r)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,A=new URL(r,e),t=A.pathname.replace(/\/+$/,"");return`${A.protocol}//${A.host}${t}`}catch{return String(r).trim().replace(/\/+$/,"")}}let GA=po("http://localhost:8000");function zc(r){const e=po(r);e&&e!==GA&&(GA=e,hA&&(hA.disconnect(),hA.removeAllListeners(),hA=null))}let hA=null;function Cg(){const r=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=r();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:GA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const A=tn(GA,{transports:["websocket","polling"],reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),t=()=>{const i=r();return A.auth=i?{token:i}:{},i};return A.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:A.id,baseUrl:GA,transport:A.io.engine.transport.name,namespace:A.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),A.on("disconnect",i=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:i,socketId:A.id})}),A.on("connect_error",i=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:i?.message,description:i?.description,context:i?.context,type:i?.type,baseUrl:GA,namespace:A.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),A.io.on("reconnect_attempt",i=>{const n=t();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:i,baseUrl:GA,hasToken:!!n})}),A.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:GA})}),A.io.on("reconnect",i=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:i,socketId:A.id})}),A}function go(){const r=po(hA?.io?.uri||null);return!hA||hA.io&&r&&GA&&r!==GA?(hA&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:r,newBaseUrl:GA,wasConnected:hA.connected,reason:"baseUrl changed"}),hA.disconnect(),hA.removeAllListeners(),hA=null),hA=Cg()):hA.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:hA.id,connected:hA.connected,baseUrl:GA,uri:r}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:hA.id,baseUrl:GA}),hA}function vg(r,e){const A=go();return A.on(r,e),()=>A.off(r,e)}function yg(r,e){hA&&hA.off(r,e)}function bg(r,e){go().emit(r,e)}function Tg(){return hA?hA.connected?"connected":"connecting":"disconnected"}const rn={getSocket:go,on:vg,off:yg,emit:bg,getStatus:Tg,setBaseUrl:zc},Qg={},Gc=J.createContext(),FA=()=>{const r=J.useContext(Gc);if(!r)throw new Error("useTrading must be used within TradingProvider");return r},xg=({children:r,baseUrl:e,endpoints:A,accountId:t})=>{const i=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:is&&is.tagName.toUpperCase()==="SCRIPT"&&is.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&Qg?.VITE_BASE_URL)??"http://localhost:8000",s={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account"},...A},o=A?.params||{},[a,l]=J.useState("BTCUSD"),[c,d]=J.useState("M1"),[p,y]=J.useState([]),[w,C]=J.useState(!0),[v,S]=J.useState([]),[F,k]=J.useState(!1),[x,V]=J.useState(1e5),[N,Z]=J.useState(null),[X,W]=J.useState([]),[ae,G]=J.useState(!0),[ee,oe]=J.useState(!1),[me,Le]=J.useState(!0),[Ue,Fe]=J.useState("candles"),[ke,ye]=J.useState(!1),[ve,Ce]=J.useState("dark"),ge=J.useRef(null);J.useEffect(()=>{rn.setBaseUrl(i)},[i]);const Me=J.useRef(new Map),_e=J.useRef(null),Be=1e3,iA=J.useCallback(async()=>{if(t)try{const Ke=localStorage.getItem("token");if(!Ke)return;k(!0);const Xe=await oA.get(`${i}/trades/account/${t}`,{headers:{Authorization:`Bearer ${Ke}`}});let We=[];Array.isArray(Xe.data)?We=Xe.data:Xe.data?.data&&Array.isArray(Xe.data.data)&&(We=Xe.data.data);const je=We.filter(we=>we.closePrice===null||we.closePrice===void 0).map(we=>({id:we.id,ticket:we.id?.substring(0,8),symbol:we.symbol,type:we.type,volume:we.volume,price:we.openPrice,stopLoss:we.stopLoss,takeProfit:we.takeProfit,comment:we.comment||"",status:"OPEN",swap:0,profit:we.profit||0,profitCurrency:"USD",time:new Date(we.openedAt||we.openAt||Date.now()).toLocaleTimeString(),openAt:we.openedAt||we.openAt,closeAt:we.closedAt||we.closeAt}));S(je)}catch(Ke){console.error("❌ Error fetching orders:",Ke.response?.data||Ke.message),S([])}finally{k(!1)}},[i,t]),Ee=J.useCallback((Ke,Xe)=>!Xe||!Ke.price||isNaN(Xe)||isNaN(Ke.price)?Ke.profit||0:(Ke.type==="BUY"?Xe-Ke.price:Ke.price-Xe)*Ke.volume,[]),Te=J.useCallback(async()=>{try{const Ke=localStorage.getItem("token");if(!Ke)return;const Xe=await oA.get(`${i}${s.account}`,{headers:{Authorization:`Bearer ${Ke}`}});if(Xe.data&&Xe.data.data){const We=parseFloat(Xe.data.data.balance);isNaN(We)||V(We)}}catch(Ke){console.error("❌ Error fetching user balance:",Ke.response?.data||Ke.message)}},[i]),de=J.useMemo(()=>{const Ke=x,Xe=v.reduce((Ie,fe)=>Ie+fe.volume*fe.price*.01,0),We=v.reduce((Ie,fe)=>{const ne=p.find(Oe=>Oe.symbol===fe.symbol);if(ne){const Oe=fe.type==="BUY"?parseFloat(ne.bid||0):parseFloat(ne.ask||0);if(Oe&&Oe>0&&!isNaN(Oe))return Ie+Ee(fe,Oe)}return Ie+(fe.profit||0)},0),je=Ke+We,we=je-Xe,le=Xe>0?je/Xe*100:0;return{balance:Ke,equity:je,margin:Xe,freeMargin:we,level:le.toFixed(2)}},[v,p,x,Ee]);J.useEffect(()=>{localStorage.getItem("token")&&t&&(iA(),Te())},[iA,Te,t]),J.useEffect(()=>{(async()=>{try{C(!0);const Xe=s.symbols.includes("?")?`${i}${s.symbols}`:`${i}${s.symbols}`,We=await oA.get(Xe);let je=[];Array.isArray(We.data)?je=We.data:We.data&&We.data.data&&Array.isArray(We.data.data)?je=We.data.data:We.data&&We.data.prices&&Array.isArray(We.data.prices)?je=We.data.prices:We.data&&Array.isArray(We.data)&&(je=We.data);const we=je.map(le=>le.symbol&&(le.bid!==void 0||le.price!==void 0)?{symbol:le.symbol,bid:le.bid??le.price??0,ask:le.ask??le.price??0,change:le.change??0}:le);we.length>0?(y(we),we.find(Ie=>Ie.symbol===a)||l(we[0].symbol)):y([])}catch(Xe){console.error("❌ Error fetching symbols:",Xe.response?.data||Xe.message),y([])}finally{C(!1)}})()},[i,s.symbols]);const Qe=J.useCallback(()=>{const Ke=Me.current;if(Ke.size===0)return;const Xe=new Map(Ke);Ke.clear(),y(We=>We.map(je=>{const we=Xe.get(je.symbol);return we?{...je,...we}:je})),S(We=>{let je=!1;const we=We.map(le=>{const Ie=Xe.get(le.symbol);if(!Ie)return le;const fe=le.type==="BUY"?parseFloat(Ie.bid||0):parseFloat(Ie.ask||0);if(!fe||isNaN(fe)||fe<=0)return le;const ne=Ee(le,fe);return ne===le.profit?le:(je=!0,{...le,profit:ne})});return je?we:We})},[Ee]);J.useEffect(()=>{ge.current||(ge.current=rn.getSocket());const Ke=ge.current,Xe=()=>console.log("✅ TradingContext: Connected"),We=()=>console.log("⚠️ TradingContext: Disconnected"),je=le=>{le?.symbol&&(Me.current.set(le.symbol,le),_e.current||(_e.current=setTimeout(()=>{_e.current=null,Qe()},Be)))},we=async le=>{if(le){if(le.newBalance!==void 0){const Ie=parseFloat(le.newBalance);isNaN(Ie)||V(Ie)}if(window.notify){const Ie=le.profitLoss||le.profit||0,fe=Ie>=0?`+${Ie.toFixed(2)}`:Ie.toFixed(2),ne=le.symbol||"Trade",Oe=le.reason||"Closed";window.notify(`Trade Closed: ${Oe} | ${ne} | P/L: ${fe} USD`,Ie>=0?"success":"error")}le.tradeId&&S(Ie=>Ie.filter(fe=>fe.id!==le.tradeId)),await iA(),await Te()}};return Ke.on("connect",Xe),Ke.on("disconnect",We),Ke.on("priceUpdate",je),Ke.on("tradeClosed",we),()=>{Ke.off("connect",Xe),Ke.off("disconnect",We),Ke.off("priceUpdate",je),Ke.off("tradeClosed",we),_e.current&&(clearTimeout(_e.current),_e.current=null),Me.current.clear()}},[Qe,iA,Te]),J.useEffect(()=>{try{const Ke=document.documentElement;if(!Ke)return;Ke.dataset.theme=ve}catch{}},[ve]);const cA=J.useMemo(()=>p.find(Ke=>Ke.symbol===a)||{bid:"0.00000",ask:"0.00000",change:0},[p,a]),Re=J.useMemo(()=>({selectedSymbol:a,setSelectedSymbol:l,selectedTimeframe:c,setSelectedTimeframe:d,symbols:p,setSymbols:y,symbolsLoading:w,orders:v,setOrders:S,ordersLoading:F,fetchOrders:iA,fetchUserBalance:Te,userBalance:x,setUserBalance:V,accountSummary:de,currentSymbolData:cA,activeTool:N,setActiveTool:Z,chartObjects:X,setChartObjects:W,showGrid:ae,setShowGrid:G,snapToGrid:ee,setSnapToGrid:oe,drawingsVisible:me,setDrawingsVisible:Le,chartType:Ue,setChartType:Fe,chartLocked:ke,setChartLocked:ye,theme:ve,setTheme:Ce,baseUrl:i,endpoints:s,endpointParams:o,accountId:t}),[a,c,p,w,v,F,iA,Te,x,de,cA,N,X,ae,ee,me,Ue,ke,ve,i,s,o]);return h.jsx(Gc.Provider,{value:Re,children:r})};var Rc={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Wc=J.createContext&&J.createContext(Rc),Fg=["attr","size","title"];function Ug(r,e){if(r==null)return{};var A=Eg(r,e),t,i;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);for(i=0;i<n.length;i++)t=n[i],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(A[t]=r[t])}return A}function Eg(r,e){if(r==null)return{};var A={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(e.indexOf(t)>=0)continue;A[t]=r[t]}return A}function nn(){return nn=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var A=arguments[e];for(var t in A)Object.prototype.hasOwnProperty.call(A,t)&&(r[t]=A[t])}return r},nn.apply(this,arguments)}function $c(r,e){var A=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),A.push.apply(A,t)}return A}function sn(r){for(var e=1;e<arguments.length;e++){var A=arguments[e]!=null?arguments[e]:{};e%2?$c(Object(A),!0).forEach(function(t){Sg(r,t,A[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(A)):$c(Object(A)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(A,t))})}return r}function Sg(r,e,A){return e=Hg(e),e in r?Object.defineProperty(r,e,{value:A,enumerable:!0,configurable:!0,writable:!0}):r[e]=A,r}function Hg(r){var e=Lg(r,"string");return typeof e=="symbol"?e:e+""}function Lg(r,e){if(typeof r!="object"||!r)return r;var A=r[Symbol.toPrimitive];if(A!==void 0){var t=A.call(r,e);if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Xc(r){return r&&r.map((e,A)=>J.createElement(e.tag,sn({key:A},e.attr),Xc(e.child)))}function Wr(r){return e=>J.createElement(Mg,nn({attr:sn({},r.attr)},e),Xc(r.child))}function Mg(r){var e=A=>{var{attr:t,size:i,title:n}=r,s=Ug(r,Fg),o=i||A.size||"1em",a;return A.className&&(a=A.className),r.className&&(a=(a?a+" ":"")+r.className),J.createElement("svg",nn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},A.attr,t,s,{className:a,style:sn(sn({color:r.color||A.color},A.style),r.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&J.createElement("title",null,n),r.children)};return Wc!==void 0?J.createElement(Wc.Consumer,null,A=>e(A)):e(Rc)}function Ig(r){return Wr({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(r)}function _g(r){return Wr({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(r)}const Jc=({bidPrice:r,askPrice:e,onBuyClick:A,onSellClick:t})=>{const{theme:i}=FA(),n=i==="light",[s,o]=J.useState("0.01"),a=n?"bg-slate-100":"bg-[#12161d]",l=n?"text-slate-700":"text-white",c=n?"hover:bg-slate-200":"hover:bg-[#1e2635]",d=w=>{const C=parseFloat(s)||.01,v=Math.max(.01,C+w);o(v.toFixed(2))},p=()=>{A&&A({volume:parseFloat(s)})},y=()=>{t&&t({volume:parseFloat(s)})};return h.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[h.jsxs("button",{onClick:y,className:"flex items-stretch overflow-hidden",children:[h.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:r||"—"}),h.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),h.jsxs("div",{className:`flex items-stretch ${a}`,children:[h.jsx("button",{type:"button",onClick:()=>d(-.01),className:`w-5 flex items-center justify-center ${l} ${c} transition-colors`,children:h.jsx(Ig,{size:8})}),h.jsx("input",{type:"number",value:s,onChange:w=>{const C=w.target.value;(C===""||parseFloat(C)>=0)&&o(C)},onBlur:()=>{const w=parseFloat(s);o(isNaN(w)||w<.01?"0.01":w.toFixed(2))},className:`w-14 text-center focus:outline-none ${a} ${l}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),h.jsx("button",{type:"button",onClick:()=>d(.01),className:`w-5 flex items-center justify-center ${l} ${c} transition-colors`,children:h.jsx(_g,{size:8})})]}),h.jsxs("button",{onClick:p,className:"flex items-stretch overflow-hidden",children:[h.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),h.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e||"—"})]})]})},Dg={},Zc=({isOpen:r,onClose:e,orderType:A,bidPrice:t,askPrice:i,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:a=!1,forceParentExecution:l=!1,tradingEngine:c})=>{const{selectedSymbol:d,selectedTimeframe:p,setOrders:y,symbols:w,fetchOrders:C,theme:v,baseUrl:S,endpoints:F}=FA(),k=v==="light",x={getContractSpec:fe=>{const ne=String(fe||"").toUpperCase();return ne.includes("BTC")||ne.includes("ETH")||ne.includes("SOL")||ne.includes("XRP")||ne.includes("ADA")||ne.includes("DOGE")||ne.includes("BNB")||ne.includes("AVAX")||ne.includes("DOT")||ne.includes("LINK")||ne.endsWith("USDT")?{contractSize:1}:ne.includes("XAU")||ne.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:fe,volume:ne})=>{const Oe=x.getContractSpec(fe);return(parseFloat(ne)||0)*(Oe.contractSize||1)}},V=c||x,[N,Z]=J.useState("0.01"),[X,W]=J.useState(""),[ae,G]=J.useState(""),[ee,oe]=J.useState(""),[me,Le]=J.useState(!1),[Ue,Fe]=J.useState(null),[ke,ye]=J.useState(""),[ve,Ce]=J.useState(A||"BUY"),[ge,Me]=J.useState(parseFloat(t)||0),[_e,Be]=J.useState(parseFloat(i)||0),[iA,Ee]=J.useState("text-white"),[Te,de]=J.useState("text-white"),Qe=J.useRef(parseFloat(t)||0),cA=J.useRef(parseFloat(i)||0);J.useEffect(()=>{if(!r)return;const fe=rn.getSocket(),ne=De=>{if(!(!De||!De.symbol)&&De.symbol.toUpperCase()===d?.toUpperCase()){const Ye=parseFloat(De.bid)||0,CA=parseFloat(De.ask)||0;Ye>0&&(Ye>Qe.current?(Ee("text-green-400"),setTimeout(()=>Ee("text-white"),500)):Ye<Qe.current&&Qe.current>0&&(Ee("text-red-400"),setTimeout(()=>Ee("text-white"),500)),Me(Ye),Qe.current=Ye),CA>0&&(CA>cA.current?(de("text-green-400"),setTimeout(()=>de("text-white"),500)):CA<cA.current&&cA.current>0&&(de("text-red-400"),setTimeout(()=>de("text-white"),500)),Be(CA),cA.current=CA)}};fe.on("priceUpdate",ne);const Oe=w.find(De=>De.symbol===d);if(Oe){const De=parseFloat(Oe.bid)||0,Ye=parseFloat(Oe.ask)||0;De>0&&(Me(De),Qe.current=De),Ye>0&&(Be(Ye),cA.current=Ye)}return()=>{fe.off("priceUpdate",ne)}},[r,d,w]),J.useEffect(()=>{if(r){Z(o?String(o):"0.01"),W(""),G(""),oe(""),ye(""),Ce(A||"BUY");const fe=parseFloat(t)||0,ne=parseFloat(i)||0;fe>0&&(Me(fe),Qe.current=fe),ne>0&&(Be(ne),cA.current=ne)}},[r,A,t,i,o]);const Re=ge||0,Ke=_e||0,Xe=fe=>{const ne=parseFloat(N)||.01,Oe=Math.max(.01,ne+fe);Z(Oe.toFixed(2))},We=fe=>{const ne=parseFloat(X)||0,Oe=parseFloat(ve==="BUY"?_e:ge)||0;if(!Oe){ye("Current price not available. Please wait...");return}let De=ne+fe;ve==="BUY"?De=Math.max(1e-5,Math.min(De,Oe-1e-5)):De=Math.max(Oe+1e-5,De),W(De>0?De.toFixed(5):""),ye("")},je=fe=>{const ne=parseFloat(ae)||0,Oe=parseFloat(ve==="BUY"?_e:ge)||0;if(!Oe){ye("Current price not available. Please wait...");return}let De=ne+fe;ve==="BUY"?De=Math.max(Oe+1e-5,De):De=Math.max(1e-5,Math.min(De,Oe-1e-5)),G(De>0?De.toFixed(5):""),ye("")},we=async fe=>{ye("");const ne=fe||ve,Oe=parseFloat(ne==="BUY"?_e:ge),De=parseFloat(N),Ye=X?parseFloat(X):null,CA=ae?parseFloat(ae):null;if(!De||De<=0||isNaN(De)){ye("Please enter a valid volume (minimum 0.01)");return}if(De<.01){ye("Volume must be at least 0.01");return}if(!Oe||Oe<=0||isNaN(Oe)){ye("Invalid price. Please refresh and try again.");return}if(Ye!==null&&Ye!==""){if(isNaN(Ye)||Ye<=0){ye("Stop Loss must be a valid positive number");return}if(ne==="BUY"&&Ye>=Oe){ye("Stop Loss must be below the current price for BUY orders");return}if(ne==="SELL"&&Ye<=Oe){ye("Stop Loss must be above the current price for SELL orders");return}}if(CA!==null&&CA!==""){if(isNaN(CA)||CA<=0){ye("Take Profit must be a valid positive number");return}if(ne==="BUY"){if(CA<=Oe){ye(`Take Profit must be above the entry price (${Oe.toFixed(5)}) for BUY orders`);return}}else if(ne==="SELL"&&CA>=Oe){ye(`Take Profit must be below the entry price (${Oe.toFixed(5)}) for SELL orders`);return}}Ce(ne),Fe(ne),Le(!0);const xt=new Date,wi=xt.toLocaleTimeString(),Bt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,ts=localStorage.getItem("token");if(!ts){ye("Please login to place trades"),Le(!1),Fe(null);return}const Ca={accountId:s,symbol:d,type:ne,volume:De,price:Oe,takeProfit:CA,stopLoss:Ye,comment:ee.trim()||null},va={ticket:Bt.substring(0,8),symbol:d,type:ne,volume:parseFloat(De),price:parseFloat(Oe),time:wi,stopLoss:Ye?parseFloat(Ye):null,takeProfit:CA?parseFloat(CA):null,swap:0,profit:0,profitCurrency:"USD",comment:ee.trim()||"",id:Bt,status:"OPEN",openAt:xt.toISOString()};if(!a&&y&&y(Kt=>[...Kt,va]),l&&!n){ye("Execution handler is required in forceParentExecution mode"),Le(!1),Fe(null);return}if(n){Le(!1),Fe(null),e();const Kt={symbol:d,type:ne,lotSize:De,entryPrice:Oe,stopLoss:Ye,takeProfit:CA,comment:ee.trim()||null};Promise.resolve(n(Kt)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(Qr=>{console.error("❌ Trade execution failed:",Qr),!a&&y&&y(VA=>VA.filter(BA=>BA.id!==Bt))})}else{if(l){ye("Fallback API path disabled in forceParentExecution mode"),Le(!1),Fe(null);return}Le(!1),Fe(null),e();const Kt=S||Dg?.VITE_BASE_URL||"http://localhost:8000",Qr=F?.trades||"/api/trades";oA.post(`${Kt}${Qr}`,Ca,{headers:{Authorization:`Bearer ${ts}`,"Content-Type":"application/json"}}).then(VA=>{if(VA.data&&VA.data.data){const BA=VA.data.data.trade;!a&&y&&y(b=>b.map(m=>m.id===Bt?{...m,id:BA.id,ticket:BA.id.substring(0,8),time:wi,openAt:BA.openAt}:m)),console.log("✅ Trade saved successfully:",BA),window.notify&&window.notify(`Trade placed successfully: ${BA.symbol} ${BA.type}`,"success")}else{!a&&y&&y(b=>b.filter(m=>m.id!==Bt));const BA=VA.data?.message||"Failed to place trade";window.notify&&window.notify(BA,"error")}}).catch(VA=>{console.error("Error placing trade:",VA),!a&&y&&y(b=>b.filter(m=>m.id!==Bt));let BA="Failed to place trade";if(VA.response){const b=VA.response.status,m=VA.response.data;b===400?BA=m?.message||"Invalid trade data. Please check your inputs.":b===401?BA="Authentication failed. Please login again.":b===404?BA=m?.message||"Symbol not found. Please select a valid symbol.":b===500?BA="Server error. Please try again later.":BA=m?.message||`Error: ${b}`}else VA.request&&(BA="Network error. Please check your internet connection.");window.notify&&window.notify(BA,"error")})}},Ie=(V?.calculateVolumeUnits?.({symbol:d,volume:parseFloat(N)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return r?h.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${k?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[h.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${k?"border-slate-300 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 ${k?"text-slate-800":"text-white"}`,children:"Market Execution"}),h.jsx("button",{className:`p-0.5 transition-colors ${k?"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:e,className:`p-1 rounded transition-colors ${k?"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 flex-1",children:[ke&&h.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:ke}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("label",{className:`text-sm font-medium ${k?"text-slate-700":"text-white"}`,children:"Volume"}),h.jsxs("span",{className:`text-sm ${k?"text-slate-700":"text-white"}`,children:[Ie," ",d]})]}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>Xe(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"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:N,onChange:fe=>{Z(fe.target.value),ye("")},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"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:()=>Xe(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"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 ${k?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>We(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"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:X,onChange:fe=>{const ne=fe.target.value;(ne===""||/^\d*\.?\d*$/.test(ne))&&(W(ne),ye(""))},onBlur:fe=>{const ne=parseFloat(fe.target.value);!isNaN(ne)&&ne>0?W(ne.toFixed(5)):fe.target.value===""&&W("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),h.jsx("button",{type:"button",onClick:()=>We(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"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 ${k?"text-slate-700":"text-white"}`,children:"Take Profit"})}),h.jsxs("div",{className:"relative flex items-center",children:[h.jsx("button",{type:"button",onClick:()=>je(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"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:ae,onChange:fe=>{const ne=fe.target.value;(ne===""||/^\d*\.?\d*$/.test(ne))&&(G(ne),ye(""))},onBlur:fe=>{const ne=parseFloat(fe.target.value);!isNaN(ne)&&ne>0?G(ne.toFixed(5)):fe.target.value===""&&G("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),h.jsx("button",{type:"button",onClick:()=>je(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"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 ${k?"text-slate-700":"text-white"}`,children:"Comment"}),h.jsx("textarea",{value:ee,onChange:fe=>oe(fe.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 ${k?"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 ${k?"border-slate-400":"border-slate-700"}`,children:[h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:k?"text-slate-700":"text-white",children:"Bid: "}),h.jsx("span",{className:`${iA} font-medium transition-colors duration-400`,children:Re>0?Re.toFixed(5):"---"})]}),h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:k?"text-slate-700":"text-white",children:"Ask: "}),h.jsx("span",{className:`${Te} font-medium transition-colors duration-400`,children:Ke>0?Ke.toFixed(5):"---"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[h.jsx("button",{onClick:()=>we("SELL"),disabled:me,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:me&&Ue==="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:()=>we("BUY"),disabled:me,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:me&&Ue==="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 Y(r){if(r==null)return null;if(typeof r=="number"){if(Number.isNaN(r)||!Number.isFinite(r))return null;let e;r>1e10?e=r/1e3:(r<1e9,e=r);const A=Math.floor(e);return A<946684800||A>4102444800?null:A}if(typeof r=="string"){const e=Date.parse(r);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof r=="object"&&"year"in r&&"month"in r&&"day"in r){const A=new Date(Date.UTC(r.year,r.month-1,r.day)).getTime();return Number.isNaN(A)?null:Math.floor(A/1e3)}return null}function kg(r,e){if(!r||r.length<2)return[];const A=[],t=2;for(let i=1;i<r.length;i++){const n=r[i-1].time,s=r[i].time,o=s-n;o>e*t&&A.push({from:n,to:s,gapSeconds:o,gapHours:(o/3600).toFixed(1),fromDate:new Date(n*1e3).toISOString(),toDate:new Date(s*1e3).toISOString()})}return A}function Og(r,e="America/New_York"){const A=new Date(r*1e3),t=new Date(A.toLocaleString("en-US",{timeZone:e})),i=t.getDay();return!(i===0||i===6||i===5&&t.getHours()>=17)}function qc(r){return Array.isArray(r)?r.map(e=>({...e,time:Y(e.time)})).filter(e=>e.time!=null):[]}function Ng(r){if(!r||r.length<2)return!0;for(let e=1;e<r.length;e++)if(r[e].time<=r[e-1].time)return!1;return!0}function ur(r,e){return!Number.isFinite(r)||!Number.isFinite(e)||e<=0?r:Math.floor(r/e)*e}const UA="17:00-17:00",EA="America/New_York",ht="24x7",ut="UTC",Yc={EURUSD:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"},BTCUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},ETHUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},BNBUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},SOLUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},ADAUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},XRPUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},DOGEUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},DOTUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},MATICUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"},LINKUSDT:{type:"crypto",session:ht,sessionTZ:ut,priceMode:"last"}},jc={type:"forex",sessionTZ:EA,session:UA,priceMode:"mid"};function $r(r){return r&&Yc[r.toUpperCase()]||jc}function Kg(r){return $r(r).type==="forex"}function Pg(r){return $r(r).type==="crypto"}function Vg(r){return $r(r).session==="24x7"}function eh(r){if(!r||typeof r!="object")return!1;const{time:e,open:A,high:t,low:i,close:n,volume:s}=r;return!(Y(e)==null||typeof A!="number"||!Number.isFinite(A)||typeof t!="number"||!Number.isFinite(t)||typeof i!="number"||!Number.isFinite(i)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||t<A||t<n||t<i||i>A||i>n||i>t||A<=0||t<=0||i<=0||n<=0)}function Ah(r){const e=s=>Math.round(s*1e5)/1e5;let A=e(r.open),t=e(r.high),i=e(r.low),n=e(r.close);return t=Math.max(t,A,n,i),i=Math.min(i,A,n,t),{...r,open:A,high:t,low:i,close:n,volume:r.volume!=null?Math.round(r.volume):r.volume}}function th(r){if(!Array.isArray(r)||r.length===0)return[];const e=new Map;return r.forEach(A=>{const t=Y(A.time);if(t!=null)if(e.has(t)){const i=e.get(t);e.set(t,{...A,time:t,open:A.open,high:Math.max(i.high,A.high),low:Math.min(i.low,A.low),close:A.close,volume:(i.volume||0)+(A.volume||0)})}else e.set(t,{...A,time:t})}),Array.from(e.values())}function zg(r,e="percentile"){if(!Array.isArray(r)||r.length<3)return r;const A=r.map(s=>s.close).filter(s=>Number.isFinite(s));if(A.length<3)return r;const t=[...A].sort((s,o)=>s-o);let i,n;if(e==="percentile"){const s=Math.floor(t.length*.25),o=Math.floor(t.length*.75),a=t[s],l=t[o],c=l-a;i=a-1.5*c,n=l+1.5*c}else{const s=A.reduce((l,c)=>l+c,0)/A.length,o=A.reduce((l,c)=>l+Math.pow(c-s,2),0)/A.length,a=Math.sqrt(o);if(a===0)return r;i=s-3*a,n=s+3*a}return r.map((s,o)=>{const a=s.close;if(a<i||a>n){if(o===0)return s;const l=r[o-1].close;return{...s,open:l,high:Math.max(l,s.high),low:Math.min(l,s.low),close:l}}return s})}function Gg(r,e){if(!Array.isArray(r)||r.length===0)return r;const A=[],t=Math.max(e*10080,604800),i=1e4;for(let o=0;o<r.length;o++)if(A.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>e&&c<=t){const d=r[o];let p=a+e,y=0;for(p=ur(p,e);p<l&&y<i;){const w=ur(p,e);A.some(v=>v.time===w)||(A.push({time:w,open:d.close,high:d.close,low:d.close,close:d.close,volume:0}),y++),p+=e}if(p<l&&y>=i){const w=ur(l-e,e);A.some(v=>v.time===w)||A.push({time:w,open:d.close,high:d.close,low:d.close,close:d.close,volume:0})}}}A.sort((o,a)=>o.time-a.time);const n=[],s=new Set;for(const o of A)s.has(o.time)||(s.add(o.time),n.push(o));return n}function it(r){if(!r||typeof r!="string")return 60;const e=r.toUpperCase();if(e==="MN")return 2592e3;let A=e.match(/^([MHDW])(\d+)$/);if(A){const t=A[1];return parseInt(A[2],10)*({M:60,H:3600,D:86400,W:604800}[t]||60)}if(A=r.match(/^(\d+)([mhdwy])$/i),A){const t=parseInt(A[1],10),i=A[2].toLowerCase();return t*({m:60,h:3600,d:86400,w:604800,y:31536e3}[i]||60)}return 60}function rh(r,e,A){if(!Array.isArray(r)||r.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const t=$r(e),i=it(A),o=qc(r).map(v=>({...v,time:ur(v.time,i)})).filter(v=>eh(v)).map(v=>Ah(v)),a=th(o);a.sort((v,S)=>v.time-S.time);const l=a.filter((v,S)=>S===0?!0:v.time>a[S-1].time),c=l.length>10?zg(l,"percentile"):l,d=th(c);d.sort((v,S)=>v.time-S.time);const p=Gg(d,i),y=[];for(let v=1;v<p.length;v++){const S=p[v].time-p[v-1].time;S>i*2&&y.push({from:p[v-1].time,to:p[v].time,gapSeconds:S,gapMinutes:Math.round(S/60),fromDate:new Date(p[v-1].time*1e3).toISOString(),toDate:new Date(p[v].time*1e3).toISOString()})}const w=c.filter((v,S)=>S===0?!1:v.close===c[S-1].close&&v.open===c[S-1].close).length,C={original:r.length,processed:p.length,duplicates:r.length-a.length,outliers:w,gaps:y,filledGaps:p.length-d.length,symbolConfig:t};return{candles:p,stats:C}}function ih(r,e,A="1m"){if(!r||!e||!eh(r))return null;const t=Y(r.time);if(t==null)return null;const i=it(A),n=ur(t,i);return Ah({...r,time:n})}var mo=function(r,e){return mo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,t){A.__proto__=t}||function(A,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(A[i]=t[i])},mo(r,e)};function nt(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");mo(r,e);function A(){this.constructor=r}r.prototype=e===null?Object.create(e):(A.prototype=e.prototype,new A)}var Bo=function(){return Bo=Object.assign||function(e){for(var A,t=1,i=arguments.length;t<i;t++){A=arguments[t];for(var n in A)Object.prototype.hasOwnProperty.call(A,n)&&(e[n]=A[n])}return e},Bo.apply(this,arguments)};function MA(r,e,A,t){function i(n){return n instanceof A?n:new A(function(s){s(n)})}return new(A||(A=Promise))(function(n,s){function o(c){try{l(t.next(c))}catch(d){s(d)}}function a(c){try{l(t.throw(c))}catch(d){s(d)}}function l(c){c.done?n(c.value):i(c.value).then(o,a)}l((t=t.apply(r,[])).next())})}function SA(r,e){var A={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,i,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(l){return function(c){return a([l,c])}}function a(l){if(t)throw new TypeError("Generator is already executing.");for(;A;)try{if(t=1,i&&(n=l[0]&2?i.return:l[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,l[1])).done)return n;switch(i=0,n&&(l=[l[0]&2,n.value]),l[0]){case 0:case 1:n=l;break;case 4:return A.label++,{value:l[1],done:!1};case 5:A.label++,i=l[1],l=[0];continue;case 7:l=A.ops.pop(),A.trys.pop();continue;default:if(n=A.trys,!(n=n.length>0&&n[n.length-1])&&(l[0]===6||l[0]===2)){A=0;continue}if(l[0]===3&&(!n||l[1]>n[0]&&l[1]<n[3])){A.label=l[1];break}if(l[0]===6&&A.label<n[1]){A.label=n[1],n=l;break}if(n&&A.label<n[2]){A.label=n[2],A.ops.push(l);break}n[2]&&A.ops.pop(),A.trys.pop();continue}l=e.call(r,A)}catch(c){l=[6,c],i=0}finally{t=n=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function on(r,e,A){if(arguments.length===2)for(var t=0,i=e.length,n;t<i;t++)(n||!(t in e))&&(n||(n=Array.prototype.slice.call(e,0,t)),n[t]=e[t]);return r.concat(n||e)}for(var yt=(function(){function r(e,A,t,i){this.left=e,this.top=A,this.width=t,this.height=i}return r.prototype.add=function(e,A,t,i){return new r(this.left+e,this.top+A,this.width+t,this.height+i)},r.fromClientRect=function(e,A){return new r(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height)},r.fromDOMRectList=function(e,A){var t=Array.from(A).find(function(i){return i.width!==0});return t?new r(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height):r.EMPTY},r.EMPTY=new r(0,0,0,0),r})(),an=function(r,e){return yt.fromClientRect(r,e.getBoundingClientRect())},Rg=function(r){var e=r.body,A=r.documentElement;if(!e||!A)throw new Error("Unable to get document size");var t=Math.max(Math.max(e.scrollWidth,A.scrollWidth),Math.max(e.offsetWidth,A.offsetWidth),Math.max(e.clientWidth,A.clientWidth)),i=Math.max(Math.max(e.scrollHeight,A.scrollHeight),Math.max(e.offsetHeight,A.offsetHeight),Math.max(e.clientHeight,A.clientHeight));return new yt(0,0,t,i)},ln=function(r){for(var e=[],A=0,t=r.length;A<t;){var i=r.charCodeAt(A++);if(i>=55296&&i<=56319&&A<t){var n=r.charCodeAt(A++);(n&64512)===56320?e.push(((i&1023)<<10)+(n&1023)+65536):(e.push(i),A--)}else e.push(i)}return e},dA=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var A=r.length;if(!A)return"";for(var t=[],i=-1,n="";++i<A;){var s=r[i];s<=65535?t.push(s):(s-=65536,t.push((s>>10)+55296,s%1024+56320)),(i+1===A||t.length>16384)&&(n+=String.fromCharCode.apply(String,t),t.length=0)}return n},nh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wg=typeof Uint8Array>"u"?[]:new Uint8Array(256),cn=0;cn<nh.length;cn++)Wg[nh.charCodeAt(cn)]=cn;for(var sh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xr=typeof Uint8Array>"u"?[]:new Uint8Array(256),hn=0;hn<sh.length;hn++)Xr[sh.charCodeAt(hn)]=hn;for(var $g=function(r){var e=r.length*.75,A=r.length,t,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),c=Array.isArray(l)?l:new Uint8Array(l);for(t=0;t<A;t+=4)n=Xr[r.charCodeAt(t)],s=Xr[r.charCodeAt(t+1)],o=Xr[r.charCodeAt(t+2)],a=Xr[r.charCodeAt(t+3)],c[i++]=n<<2|s>>4,c[i++]=(s&15)<<4|o>>2,c[i++]=(o&3)<<6|a&63;return l},Xg=function(r){for(var e=r.length,A=[],t=0;t<e;t+=2)A.push(r[t+1]<<8|r[t]);return A},Jg=function(r){for(var e=r.length,A=[],t=0;t<e;t+=4)A.push(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]);return A},Zt=5,wo=11,Co=2,Zg=wo-Zt,oh=65536>>Zt,qg=1<<Zt,vo=qg-1,Yg=1024>>Zt,jg=oh+Yg,em=jg,Am=32,tm=em+Am,rm=65536>>wo,im=1<<Zg,nm=im-1,ah=function(r,e,A){return r.slice?r.slice(e,A):new Uint16Array(Array.prototype.slice.call(r,e,A))},sm=function(r,e,A){return r.slice?r.slice(e,A):new Uint32Array(Array.prototype.slice.call(r,e,A))},om=function(r,e){var A=$g(r),t=Array.isArray(A)?Jg(A):new Uint32Array(A),i=Array.isArray(A)?Xg(A):new Uint16Array(A),n=24,s=ah(i,n/2,t[4]/2),o=t[5]===2?ah(i,(n+t[4])/2):sm(t,Math.ceil((n+t[4])/4));return new am(t[0],t[1],t[2],t[3],s,o)},am=(function(){function r(e,A,t,i,n,s){this.initialValue=e,this.errorValue=A,this.highStart=t,this.highValueIndex=i,this.index=n,this.data=s}return r.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=this.index[e>>Zt],A=(A<<Co)+(e&vo),this.data[A];if(e<=65535)return A=this.index[oh+(e-55296>>Zt)],A=(A<<Co)+(e&vo),this.data[A];if(e<this.highStart)return A=tm-rm+(e>>wo),A=this.index[A],A+=e>>Zt&nm,A=this.index[A],A=(A<<Co)+(e&vo),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),lh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lm=typeof Uint8Array>"u"?[]:new Uint8Array(256),un=0;un<lh.length;un++)lm[lh.charCodeAt(un)]=un;var cm="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==",ch=50,hm=1,hh=2,uh=3,um=4,dm=5,dh=7,fh=8,ph=9,St=10,yo=11,gh=12,bo=13,fm=14,Jr=15,To=16,dn=17,Zr=18,pm=19,mh=20,Qo=21,qr=22,xo=23,dr=24,RA=25,Yr=26,jr=27,fr=28,gm=29,qt=30,mm=31,fn=32,pn=33,Fo=34,Uo=35,Eo=36,ei=37,So=38,gn=39,mn=40,Ho=41,Bh=42,Bm=43,wm=[9001,65288],wh="!",Je="×",Bn="÷",Lo=om(cm),bt=[qt,Eo],Mo=[hm,hh,uh,dm],Ch=[St,fh],vh=[jr,Yr],Cm=Mo.concat(Ch),yh=[So,gn,mn,Fo,Uo],vm=[Jr,bo],ym=function(r,e){e===void 0&&(e="strict");var A=[],t=[],i=[];return r.forEach(function(n,s){var o=Lo.get(n);if(o>ch?(i.push(!0),o-=ch):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return t.push(s),A.push(To);if(o===um||o===yo){if(s===0)return t.push(s),A.push(qt);var a=A[s-1];return Cm.indexOf(a)===-1?(t.push(t[s-1]),A.push(a)):(t.push(s),A.push(qt))}if(t.push(s),o===mm)return A.push(e==="strict"?Qo:ei);if(o===Bh||o===gm)return A.push(qt);if(o===Bm)return n>=131072&&n<=196605||n>=196608&&n<=262141?A.push(ei):A.push(qt);A.push(o)}),[t,A,i]},Io=function(r,e,A,t){var i=t[A];if(Array.isArray(r)?r.indexOf(i)!==-1:r===i)for(var n=A;n<=t.length;){n++;var s=t[n];if(s===e)return!0;if(s!==St)break}if(i===St)for(var n=A;n>0;){n--;var o=t[n];if(Array.isArray(r)?r.indexOf(o)!==-1:r===o)for(var a=A;a<=t.length;){a++;var s=t[a];if(s===e)return!0;if(s!==St)break}if(o!==St)break}return!1},bh=function(r,e){for(var A=r;A>=0;){var t=e[A];if(t===St)A--;else return t}return 0},bm=function(r,e,A,t,i){if(A[t]===0)return Je;var n=t-1;if(Array.isArray(i)&&i[n]===!0)return Je;var s=n-1,o=n+1,a=e[n],l=s>=0?e[s]:0,c=e[o];if(a===hh&&c===uh)return Je;if(Mo.indexOf(a)!==-1)return wh;if(Mo.indexOf(c)!==-1||Ch.indexOf(c)!==-1)return Je;if(bh(n,e)===fh)return Bn;if(Lo.get(r[n])===yo||(a===fn||a===pn)&&Lo.get(r[o])===yo||a===dh||c===dh||a===ph||[St,bo,Jr].indexOf(a)===-1&&c===ph||[dn,Zr,pm,dr,fr].indexOf(c)!==-1||bh(n,e)===qr||Io(xo,qr,n,e)||Io([dn,Zr],Qo,n,e)||Io(gh,gh,n,e))return Je;if(a===St)return Bn;if(a===xo||c===xo)return Je;if(c===To||a===To)return Bn;if([bo,Jr,Qo].indexOf(c)!==-1||a===fm||l===Eo&&vm.indexOf(a)!==-1||a===fr&&c===Eo||c===mh||bt.indexOf(c)!==-1&&a===RA||bt.indexOf(a)!==-1&&c===RA||a===jr&&[ei,fn,pn].indexOf(c)!==-1||[ei,fn,pn].indexOf(a)!==-1&&c===Yr||bt.indexOf(a)!==-1&&vh.indexOf(c)!==-1||vh.indexOf(a)!==-1&&bt.indexOf(c)!==-1||[jr,Yr].indexOf(a)!==-1&&(c===RA||[qr,Jr].indexOf(c)!==-1&&e[o+1]===RA)||[qr,Jr].indexOf(a)!==-1&&c===RA||a===RA&&[RA,fr,dr].indexOf(c)!==-1)return Je;if([RA,fr,dr,dn,Zr].indexOf(c)!==-1)for(var d=n;d>=0;){var p=e[d];if(p===RA)return Je;if([fr,dr].indexOf(p)!==-1)d--;else break}if([jr,Yr].indexOf(c)!==-1)for(var d=[dn,Zr].indexOf(a)!==-1?s:n;d>=0;){var p=e[d];if(p===RA)return Je;if([fr,dr].indexOf(p)!==-1)d--;else break}if(So===a&&[So,gn,Fo,Uo].indexOf(c)!==-1||[gn,Fo].indexOf(a)!==-1&&[gn,mn].indexOf(c)!==-1||[mn,Uo].indexOf(a)!==-1&&c===mn||yh.indexOf(a)!==-1&&[mh,Yr].indexOf(c)!==-1||yh.indexOf(c)!==-1&&a===jr||bt.indexOf(a)!==-1&&bt.indexOf(c)!==-1||a===dr&&bt.indexOf(c)!==-1||bt.concat(RA).indexOf(a)!==-1&&c===qr&&wm.indexOf(r[o])===-1||bt.concat(RA).indexOf(c)!==-1&&a===Zr)return Je;if(a===Ho&&c===Ho){for(var y=A[n],w=1;y>0&&(y--,e[y]===Ho);)w++;if(w%2!==0)return Je}return a===fn&&c===pn?Je:Bn},Tm=function(r,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var A=ym(r,e.lineBreak),t=A[0],i=A[1],n=A[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(o){return[RA,qt,Bh].indexOf(o)!==-1?ei:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,a){return o&&r[a]>=19968&&r[a]<=40959}):void 0;return[t,i,s]},Qm=(function(){function r(e,A,t,i){this.codePoints=e,this.required=A===wh,this.start=t,this.end=i}return r.prototype.slice=function(){return dA.apply(void 0,this.codePoints.slice(this.start,this.end))},r})(),xm=function(r,e){var A=ln(r),t=Tm(A,e),i=t[0],n=t[1],s=t[2],o=A.length,a=0,l=0;return{next:function(){if(l>=o)return{done:!0,value:null};for(var c=Je;l<o&&(c=bm(A,n,i,++l,s))===Je;);if(c!==Je||l===o){var d=new Qm(A,c,a,l);return a=l,{value:d,done:!1}}return{done:!0,value:null}}}},Fm=1,Um=2,Ai=4,Th=8,wn=10,Qh=47,ti=92,Em=9,Sm=32,Cn=34,ri=61,Hm=35,Lm=36,Mm=37,vn=39,yn=40,ii=41,Im=95,NA=45,_m=33,Dm=60,km=62,Om=64,Nm=91,Km=93,Pm=61,Vm=123,bn=63,zm=125,xh=124,Gm=126,Rm=128,Fh=65533,_o=42,Yt=43,Wm=44,$m=58,Xm=59,ni=46,Jm=0,Zm=8,qm=11,Ym=14,jm=31,eB=127,dt=-1,Uh=48,Eh=97,Sh=101,AB=102,tB=117,rB=122,Hh=65,Lh=69,Mh=70,iB=85,nB=90,HA=function(r){return r>=Uh&&r<=57},sB=function(r){return r>=55296&&r<=57343},pr=function(r){return HA(r)||r>=Hh&&r<=Mh||r>=Eh&&r<=AB},oB=function(r){return r>=Eh&&r<=rB},aB=function(r){return r>=Hh&&r<=nB},lB=function(r){return oB(r)||aB(r)},cB=function(r){return r>=Rm},Tn=function(r){return r===wn||r===Em||r===Sm},Qn=function(r){return lB(r)||cB(r)||r===Im},Ih=function(r){return Qn(r)||HA(r)||r===NA},hB=function(r){return r>=Jm&&r<=Zm||r===qm||r>=Ym&&r<=jm||r===eB},Ht=function(r,e){return r!==ti?!1:e!==wn},xn=function(r,e,A){return r===NA?Qn(e)||Ht(e,A):Qn(r)?!0:!!(r===ti&&Ht(r,e))},Do=function(r,e,A){return r===Yt||r===NA?HA(e)?!0:e===ni&&HA(A):HA(r===ni?e:r)},uB=function(r){var e=0,A=1;(r[e]===Yt||r[e]===NA)&&(r[e]===NA&&(A=-1),e++);for(var t=[];HA(r[e]);)t.push(r[e++]);var i=t.length?parseInt(dA.apply(void 0,t),10):0;r[e]===ni&&e++;for(var n=[];HA(r[e]);)n.push(r[e++]);var s=n.length,o=s?parseInt(dA.apply(void 0,n),10):0;(r[e]===Lh||r[e]===Sh)&&e++;var a=1;(r[e]===Yt||r[e]===NA)&&(r[e]===NA&&(a=-1),e++);for(var l=[];HA(r[e]);)l.push(r[e++]);var c=l.length?parseInt(dA.apply(void 0,l),10):0;return A*(i+o*Math.pow(10,-s))*Math.pow(10,a*c)},dB={type:2},fB={type:3},pB={type:4},gB={type:13},mB={type:8},BB={type:21},wB={type:9},CB={type:10},vB={type:11},yB={type:12},bB={type:14},Fn={type:23},TB={type:1},QB={type:25},xB={type:24},FB={type:26},UB={type:27},EB={type:28},SB={type:29},HB={type:31},ko={type:32},_h=(function(){function r(){this._value=[]}return r.prototype.write=function(e){this._value=this._value.concat(ln(e))},r.prototype.read=function(){for(var e=[],A=this.consumeToken();A!==ko;)e.push(A),A=this.consumeToken();return e},r.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Cn:return this.consumeStringToken(Cn);case Hm:var A=this.peekCodePoint(0),t=this.peekCodePoint(1),i=this.peekCodePoint(2);if(Ih(A)||Ht(t,i)){var n=xn(A,t,i)?Um:Fm,s=this.consumeName();return{type:5,value:s,flags:n}}break;case Lm:if(this.peekCodePoint(0)===ri)return this.consumeCodePoint(),gB;break;case vn:return this.consumeStringToken(vn);case yn:return dB;case ii:return fB;case _o:if(this.peekCodePoint(0)===ri)return this.consumeCodePoint(),bB;break;case Yt:if(Do(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Wm:return pB;case NA:var o=e,a=this.peekCodePoint(0),l=this.peekCodePoint(1);if(Do(o,a,l))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(xn(o,a,l))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(a===NA&&l===km)return this.consumeCodePoint(),this.consumeCodePoint(),xB;break;case ni:if(Do(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Qh:if(this.peekCodePoint(0)===_o)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===_o&&(c=this.consumeCodePoint(),c===Qh))return this.consumeToken();if(c===dt)return this.consumeToken()}break;case $m:return FB;case Xm:return UB;case Dm:if(this.peekCodePoint(0)===_m&&this.peekCodePoint(1)===NA&&this.peekCodePoint(2)===NA)return this.consumeCodePoint(),this.consumeCodePoint(),QB;break;case Om:var d=this.peekCodePoint(0),p=this.peekCodePoint(1),y=this.peekCodePoint(2);if(xn(d,p,y)){var s=this.consumeName();return{type:7,value:s}}break;case Nm:return EB;case ti:if(Ht(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Km:return SB;case Pm:if(this.peekCodePoint(0)===ri)return this.consumeCodePoint(),mB;break;case Vm:return vB;case zm:return yB;case tB:case iB:var w=this.peekCodePoint(0),C=this.peekCodePoint(1);return w===Yt&&(pr(C)||C===bn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case xh:if(this.peekCodePoint(0)===ri)return this.consumeCodePoint(),wB;if(this.peekCodePoint(0)===xh)return this.consumeCodePoint(),BB;break;case Gm:if(this.peekCodePoint(0)===ri)return this.consumeCodePoint(),CB;break;case dt:return ko}return Tn(e)?(this.consumeWhiteSpace(),HB):HA(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Qn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:dA(e)}},r.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},r.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},r.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},r.prototype.consumeUnicodeRangeToken=function(){for(var e=[],A=this.consumeCodePoint();pr(A)&&e.length<6;)e.push(A),A=this.consumeCodePoint();for(var t=!1;A===bn&&e.length<6;)e.push(A),A=this.consumeCodePoint(),t=!0;if(t){var i=parseInt(dA.apply(void 0,e.map(function(a){return a===bn?Uh:a})),16),n=parseInt(dA.apply(void 0,e.map(function(a){return a===bn?Mh:a})),16);return{type:30,start:i,end:n}}var s=parseInt(dA.apply(void 0,e),16);if(this.peekCodePoint(0)===NA&&pr(this.peekCodePoint(1))){this.consumeCodePoint(),A=this.consumeCodePoint();for(var o=[];pr(A)&&o.length<6;)o.push(A),A=this.consumeCodePoint();var n=parseInt(dA.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},r.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===yn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===yn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},r.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===dt)return{type:22,value:""};var A=this.peekCodePoint(0);if(A===vn||A===Cn){var t=this.consumeStringToken(this.consumeCodePoint());return t.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===dt||this.peekCodePoint(0)===ii)?(this.consumeCodePoint(),{type:22,value:t.value}):(this.consumeBadUrlRemnants(),Fn)}for(;;){var i=this.consumeCodePoint();if(i===dt||i===ii)return{type:22,value:dA.apply(void 0,e)};if(Tn(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===dt||this.peekCodePoint(0)===ii?(this.consumeCodePoint(),{type:22,value:dA.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Fn);if(i===Cn||i===vn||i===yn||hB(i))return this.consumeBadUrlRemnants(),Fn;if(i===ti)if(Ht(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Fn;else e.push(i)}},r.prototype.consumeWhiteSpace=function(){for(;Tn(this.peekCodePoint(0));)this.consumeCodePoint()},r.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===ii||e===dt)return;Ht(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},r.prototype.consumeStringSlice=function(e){for(var A=5e4,t="";e>0;){var i=Math.min(A,e);t+=dA.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),t},r.prototype.consumeStringToken=function(e){var A="",t=0;do{var i=this._value[t];if(i===dt||i===void 0||i===e)return A+=this.consumeStringSlice(t),{type:0,value:A};if(i===wn)return this._value.splice(0,t),TB;if(i===ti){var n=this._value[t+1];n!==dt&&n!==void 0&&(n===wn?(A+=this.consumeStringSlice(t),t=-1,this._value.shift()):Ht(i,n)&&(A+=this.consumeStringSlice(t),A+=dA(this.consumeEscapedCodePoint()),t=-1))}t++}while(!0)},r.prototype.consumeNumber=function(){var e=[],A=Ai,t=this.peekCodePoint(0);for((t===Yt||t===NA)&&e.push(this.consumeCodePoint());HA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());t=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(t===ni&&HA(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=Th;HA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());t=this.peekCodePoint(0),i=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((t===Lh||t===Sh)&&((i===Yt||i===NA)&&HA(n)||HA(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=Th;HA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[uB(e),A]},r.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),A=e[0],t=e[1],i=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(xn(i,n,s)){var o=this.consumeName();return{type:15,number:A,flags:t,unit:o}}return i===Mm?(this.consumeCodePoint(),{type:16,number:A,flags:t}):{type:17,number:A,flags:t}},r.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(pr(e)){for(var A=dA(e);pr(this.peekCodePoint(0))&&A.length<6;)A+=dA(this.consumeCodePoint());Tn(this.peekCodePoint(0))&&this.consumeCodePoint();var t=parseInt(A,16);return t===0||sB(t)||t>1114111?Fh:t}return e===dt?Fh:e},r.prototype.consumeName=function(){for(var e="";;){var A=this.consumeCodePoint();if(Ih(A))e+=dA(A);else if(Ht(A,this.peekCodePoint(0)))e+=dA(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(A),e}},r})(),Dh=(function(){function r(e){this._tokens=e}return r.create=function(e){var A=new _h;return A.write(e),new r(A.read())},r.parseValue=function(e){return r.create(e).parseComponentValue()},r.parseValues=function(e){return r.create(e).parseComponentValues()},r.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var A=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return A;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},r.prototype.parseComponentValues=function(){for(var e=[];;){var A=this.consumeComponentValue();if(A.type===32)return e;e.push(A),e.push()}},r.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},r.prototype.consumeSimpleBlock=function(e){for(var A={type:e,values:[]},t=this.consumeToken();;){if(t.type===32||MB(t,e))return A;this.reconsumeToken(t),A.values.push(this.consumeComponentValue()),t=this.consumeToken()}},r.prototype.consumeFunction=function(e){for(var A={name:e.value,values:[],type:18};;){var t=this.consumeToken();if(t.type===32||t.type===3)return A;this.reconsumeToken(t),A.values.push(this.consumeComponentValue())}},r.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?ko:e},r.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},r})(),si=function(r){return r.type===15},gr=function(r){return r.type===17},tA=function(r){return r.type===20},LB=function(r){return r.type===0},Oo=function(r,e){return tA(r)&&r.value===e},kh=function(r){return r.type!==31},mr=function(r){return r.type!==31&&r.type!==4},ft=function(r){var e=[],A=[];return r.forEach(function(t){if(t.type===4){if(A.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(A),A=[];return}t.type!==31&&A.push(t)}),A.length&&e.push(A),e},MB=function(r,e){return e===11&&r.type===12||e===28&&r.type===29?!0:e===2&&r.type===3},Lt=function(r){return r.type===17||r.type===15},mA=function(r){return r.type===16||Lt(r)},Oh=function(r){return r.length>1?[r[0],r[1]]:[r[0]]},bA={type:17,number:0,flags:Ai},No={type:16,number:50,flags:Ai},Mt={type:16,number:100,flags:Ai},oi=function(r,e,A){var t=r[0],i=r[1];return[rA(t,e),rA(typeof i<"u"?i:t,A)]},rA=function(r,e){if(r.type===16)return r.number/100*e;if(si(r))switch(r.unit){case"rem":case"em":return 16*r.number;default:return r.number}return r.number},Nh="deg",Kh="grad",Ph="rad",Vh="turn",Un={name:"angle",parse:function(r,e){if(e.type===15)switch(e.unit){case Nh:return Math.PI*e.number/180;case Kh:return Math.PI/200*e.number;case Ph:return e.number;case Vh:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},zh=function(r){return r.type===15&&(r.unit===Nh||r.unit===Kh||r.unit===Ph||r.unit===Vh)},Gh=function(r){var e=r.filter(tA).map(function(A){return A.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[bA,bA];case"to top":case"bottom":return ZA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[bA,Mt];case"to right":case"left":return ZA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Mt,Mt];case"to bottom":case"top":return ZA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Mt,bA];case"to left":case"right":return ZA(270)}return 0},ZA=function(r){return Math.PI*r/180},It={name:"color",parse:function(r,e){if(e.type===18){var A=IB[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return A(r,e.values)}if(e.type===5){if(e.value.length===3){var t=e.value.substring(0,1),i=e.value.substring(1,2),n=e.value.substring(2,3);return Dt(parseInt(t+t,16),parseInt(i+i,16),parseInt(n+n,16),1)}if(e.value.length===4){var t=e.value.substring(0,1),i=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return Dt(parseInt(t+t,16),parseInt(i+i,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var t=e.value.substring(0,2),i=e.value.substring(2,4),n=e.value.substring(4,6);return Dt(parseInt(t,16),parseInt(i,16),parseInt(n,16),1)}if(e.value.length===8){var t=e.value.substring(0,2),i=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return Dt(parseInt(t,16),parseInt(i,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=Tt[e.value.toUpperCase()];if(typeof o<"u")return o}return Tt.TRANSPARENT}},_t=function(r){return(255&r)===0},vA=function(r){var e=255&r,A=255&r>>8,t=255&r>>16,i=255&r>>24;return e<255?"rgba("+i+","+t+","+A+","+e/255+")":"rgb("+i+","+t+","+A+")"},Dt=function(r,e,A,t){return(r<<24|e<<16|A<<8|Math.round(t*255)<<0)>>>0},Rh=function(r,e){if(r.type===17)return r.number;if(r.type===16){var A=e===3?1:255;return e===3?r.number/100*A:Math.round(r.number/100*A)}return 0},Wh=function(r,e){var A=e.filter(mr);if(A.length===3){var t=A.map(Rh),i=t[0],n=t[1],s=t[2];return Dt(i,n,s,1)}if(A.length===4){var o=A.map(Rh),i=o[0],n=o[1],s=o[2],a=o[3];return Dt(i,n,s,a)}return 0};function Ko(r,e,A){return A<0&&(A+=1),A>=1&&(A-=1),A<1/6?(e-r)*A*6+r:A<1/2?e:A<2/3?(e-r)*6*(2/3-A)+r:r}var $h=function(r,e){var A=e.filter(mr),t=A[0],i=A[1],n=A[2],s=A[3],o=(t.type===17?ZA(t.number):Un.parse(r,t))/(Math.PI*2),a=mA(i)?i.number/100:0,l=mA(n)?n.number/100:0,c=typeof s<"u"&&mA(s)?rA(s,1):1;if(a===0)return Dt(l*255,l*255,l*255,1);var d=l<=.5?l*(a+1):l+a-l*a,p=l*2-d,y=Ko(p,d,o+1/3),w=Ko(p,d,o),C=Ko(p,d,o-1/3);return Dt(y*255,w*255,C*255,c)},IB={hsl:$h,hsla:$h,rgb:Wh,rgba:Wh},ai=function(r,e){return It.parse(r,Dh.create(e).parseComponentValue())},Tt={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},_B={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(r,e){return e.map(function(A){if(tA(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},DB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},En=function(r,e){var A=It.parse(r,e[0]),t=e[1];return t&&mA(t)?{color:A,stop:t}:{color:A,stop:null}},Xh=function(r,e){var A=r[0],t=r[r.length-1];A.stop===null&&(A.stop=bA),t.stop===null&&(t.stop=Mt);for(var i=[],n=0,s=0;s<r.length;s++){var o=r[s].stop;if(o!==null){var a=rA(o,e);a>n?i.push(a):i.push(n),n=a}else i.push(null)}for(var l=null,s=0;s<i.length;s++){var c=i[s];if(c===null)l===null&&(l=s);else if(l!==null){for(var d=s-l,p=i[l-1],y=(c-p)/(d+1),w=1;w<=d;w++)i[l+w-1]=y*w;l=null}}return r.map(function(C,v){var S=C.color;return{color:S,stop:Math.max(Math.min(1,i[v]/e),0)}})},kB=function(r,e,A){var t=e/2,i=A/2,n=rA(r[0],e)-t,s=i-rA(r[1],A);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},OB=function(r,e,A){var t=typeof r=="number"?r:kB(r,e,A),i=Math.abs(e*Math.sin(t))+Math.abs(A*Math.cos(t)),n=e/2,s=A/2,o=i/2,a=Math.sin(t-Math.PI/2)*o,l=Math.cos(t-Math.PI/2)*o;return[i,n-l,n+l,s-a,s+a]},st=function(r,e){return Math.sqrt(r*r+e*e)},Jh=function(r,e,A,t,i){var n=[[0,0],[0,e],[r,0],[r,e]];return n.reduce(function(s,o){var a=o[0],l=o[1],c=st(A-a,t-l);return(i?c<s.optimumDistance:c>s.optimumDistance)?{optimumCorner:o,optimumDistance:c}:s},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},NB=function(r,e,A,t,i){var n=0,s=0;switch(r.size){case 0:r.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-t),Math.abs(A),Math.abs(A-i)):r.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-t)),s=Math.min(Math.abs(A),Math.abs(A-i)));break;case 2:if(r.shape===0)n=s=Math.min(st(e,A),st(e,A-i),st(e-t,A),st(e-t,A-i));else if(r.shape===1){var o=Math.min(Math.abs(A),Math.abs(A-i))/Math.min(Math.abs(e),Math.abs(e-t)),a=Jh(t,i,e,A,!0),l=a[0],c=a[1];n=st(l-e,(c-A)/o),s=o*n}break;case 1:r.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-t),Math.abs(A),Math.abs(A-i)):r.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-t)),s=Math.max(Math.abs(A),Math.abs(A-i)));break;case 3:if(r.shape===0)n=s=Math.max(st(e,A),st(e,A-i),st(e-t,A),st(e-t,A-i));else if(r.shape===1){var o=Math.max(Math.abs(A),Math.abs(A-i))/Math.max(Math.abs(e),Math.abs(e-t)),d=Jh(t,i,e,A,!1),l=d[0],c=d[1];n=st(l-e,(c-A)/o),s=o*n}break}return Array.isArray(r.size)&&(n=rA(r.size[0],t),s=r.size.length===2?rA(r.size[1],i):n),[n,s]},KB=function(r,e){var A=ZA(180),t=[];return ft(e).forEach(function(i,n){if(n===0){var s=i[0];if(s.type===20&&s.value==="to"){A=Gh(i);return}else if(zh(s)){A=Un.parse(r,s);return}}var o=En(r,i);t.push(o)}),{angle:A,stops:t,type:1}},Sn=function(r,e){var A=ZA(180),t=[];return ft(e).forEach(function(i,n){if(n===0){var s=i[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){A=Gh(i);return}else if(zh(s)){A=(Un.parse(r,s)+ZA(270))%ZA(360);return}}var o=En(r,i);t.push(o)}),{angle:A,stops:t,type:1}},PB=function(r,e){var A=ZA(180),t=[],i=1,n=0,s=3,o=[];return ft(e).forEach(function(a,l){var c=a[0];if(l===0){if(tA(c)&&c.value==="linear"){i=1;return}else if(tA(c)&&c.value==="radial"){i=2;return}}if(c.type===18){if(c.name==="from"){var d=It.parse(r,c.values[0]);t.push({stop:bA,color:d})}else if(c.name==="to"){var d=It.parse(r,c.values[0]);t.push({stop:Mt,color:d})}else if(c.name==="color-stop"){var p=c.values.filter(mr);if(p.length===2){var d=It.parse(r,p[1]),y=p[0];gr(y)&&t.push({stop:{type:16,number:y.number*100,flags:y.flags},color:d})}}}}),i===1?{angle:(A+ZA(180))%ZA(360),stops:t,type:i}:{size:s,shape:n,stops:t,position:o,type:i}},Zh="closest-side",qh="farthest-side",Yh="closest-corner",jh="farthest-corner",eu="circle",Au="ellipse",tu="cover",ru="contain",VB=function(r,e){var A=0,t=3,i=[],n=[];return ft(e).forEach(function(s,o){var a=!0;if(o===0){var l=!1;a=s.reduce(function(d,p){if(l)if(tA(p))switch(p.value){case"center":return n.push(No),d;case"top":case"left":return n.push(bA),d;case"right":case"bottom":return n.push(Mt),d}else(mA(p)||Lt(p))&&n.push(p);else if(tA(p))switch(p.value){case eu:return A=0,!1;case Au:return A=1,!1;case"at":return l=!0,!1;case Zh:return t=0,!1;case tu:case qh:return t=1,!1;case ru:case Yh:return t=2,!1;case jh:return t=3,!1}else if(Lt(p)||mA(p))return Array.isArray(t)||(t=[]),t.push(p),!1;return d},a)}if(a){var c=En(r,s);i.push(c)}}),{size:t,shape:A,stops:i,position:n,type:2}},Hn=function(r,e){var A=0,t=3,i=[],n=[];return ft(e).forEach(function(s,o){var a=!0;if(o===0?a=s.reduce(function(c,d){if(tA(d))switch(d.value){case"center":return n.push(No),!1;case"top":case"left":return n.push(bA),!1;case"right":case"bottom":return n.push(Mt),!1}else if(mA(d)||Lt(d))return n.push(d),!1;return c},a):o===1&&(a=s.reduce(function(c,d){if(tA(d))switch(d.value){case eu:return A=0,!1;case Au:return A=1,!1;case ru:case Zh:return t=0,!1;case qh:return t=1,!1;case Yh:return t=2,!1;case tu:case jh:return t=3,!1}else if(Lt(d)||mA(d))return Array.isArray(t)||(t=[]),t.push(d),!1;return c},a)),a){var l=En(r,s);i.push(l)}}),{size:t,shape:A,stops:i,position:n,type:2}},zB=function(r){return r.type===1},GB=function(r){return r.type===2},Po={name:"image",parse:function(r,e){if(e.type===22){var A={url:e.value,type:0};return r.cache.addImage(e.value),A}if(e.type===18){var t=iu[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return t(r,e.values)}throw new Error("Unsupported image type "+e.type)}};function RB(r){return!(r.type===20&&r.value==="none")&&(r.type!==18||!!iu[r.name])}var iu={"linear-gradient":KB,"-moz-linear-gradient":Sn,"-ms-linear-gradient":Sn,"-o-linear-gradient":Sn,"-webkit-linear-gradient":Sn,"radial-gradient":VB,"-moz-radial-gradient":Hn,"-ms-radial-gradient":Hn,"-o-radial-gradient":Hn,"-webkit-radial-gradient":Hn,"-webkit-gradient":PB},WB={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(r,e){if(e.length===0)return[];var A=e[0];return A.type===20&&A.value==="none"?[]:e.filter(function(t){return mr(t)&&RB(t)}).map(function(t){return Po.parse(r,t)})}},$B={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(r,e){return e.map(function(A){if(tA(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},XB={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(r,e){return ft(e).map(function(A){return A.filter(mA)}).map(Oh)}},JB={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(r,e){return ft(e).map(function(A){return A.filter(tA).map(function(t){return t.value}).join(" ")}).map(ZB)}},ZB=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}},Br;(function(r){r.AUTO="auto",r.CONTAIN="contain",r.COVER="cover"})(Br||(Br={}));var qB={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(r,e){return ft(e).map(function(A){return A.filter(YB)})}},YB=function(r){return tA(r)||mA(r)},Ln=function(r){return{name:"border-"+r+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},jB=Ln("top"),ew=Ln("right"),Aw=Ln("bottom"),tw=Ln("left"),Mn=function(r){return{name:"border-radius-"+r,initialValue:"0 0",prefix:!1,type:1,parse:function(e,A){return Oh(A.filter(mA))}}},rw=Mn("top-left"),iw=Mn("top-right"),nw=Mn("bottom-right"),sw=Mn("bottom-left"),In=function(r){return{name:"border-"+r+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,A){switch(A){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},ow=In("top"),aw=In("right"),lw=In("bottom"),cw=In("left"),_n=function(r){return{name:"border-"+r+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,A){return si(A)?A.number:0}}},hw=_n("top"),uw=_n("right"),dw=_n("bottom"),fw=_n("left"),pw={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},gw={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(r,e){return e==="rtl"?1:0}},mw={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(r,e){return e.filter(tA).reduce(function(A,t){return A|Bw(t.value)},0)}},Bw=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},ww={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Cw={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(r,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},Dn;(function(r){r.NORMAL="normal",r.STRICT="strict"})(Dn||(Dn={}));var vw={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){return e==="strict"?Dn.STRICT:Dn.NORMAL}},yw={name:"line-height",initialValue:"normal",prefix:!1,type:4},nu=function(r,e){return tA(r)&&r.value==="normal"?1.2*e:r.type===17?e*r.number:mA(r)?rA(r,e):e},bw={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(r,e){return e.type===20&&e.value==="none"?null:Po.parse(r,e)}},Tw={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(r,e){return e==="inside"?0:1}},Vo={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){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}}},kn=function(r){return{name:"margin-"+r,initialValue:"0",prefix:!1,type:4}},Qw=kn("top"),xw=kn("right"),Fw=kn("bottom"),Uw=kn("left"),Ew={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(r,e){return e.filter(tA).map(function(A){switch(A.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},Sw={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){return e==="break-word"?"break-word":"normal"}},On=function(r){return{name:"padding-"+r,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Hw=On("top"),Lw=On("right"),Mw=On("bottom"),Iw=On("left"),_w={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(r,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Dw={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(r,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},kw={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.length===1&&Oo(e[0],"none")?[]:ft(e).map(function(A){for(var t={color:Tt.TRANSPARENT,offsetX:bA,offsetY:bA,blur:bA},i=0,n=0;n<A.length;n++){var s=A[n];Lt(s)?(i===0?t.offsetX=s:i===1?t.offsetY=s:t.blur=s,i++):t.color=It.parse(r,s)}return t})}},Ow={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Nw={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(r,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var A=Vw[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return A(e.values)}return null}},Kw=function(r){var e=r.filter(function(A){return A.type===17}).map(function(A){return A.number});return e.length===6?e:null},Pw=function(r){var e=r.filter(function(a){return a.type===17}).map(function(a){return a.number}),A=e[0],t=e[1];e[2],e[3];var i=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[A,t,i,n,s,o]:null},Vw={matrix:Kw,matrix3d:Pw},su={type:16,number:50,flags:Ai},zw=[su,su],Gw={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(r,e){var A=e.filter(mA);return A.length!==2?zw:[A[0],A[1]]}},Rw={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},li;(function(r){r.NORMAL="normal",r.BREAK_ALL="break-all",r.KEEP_ALL="keep-all"})(li||(li={}));for(var Ww={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){switch(e){case"break-all":return li.BREAK_ALL;case"keep-all":return li.KEEP_ALL;default:return li.NORMAL}}},$w={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(r,e){if(e.type===20)return{auto:!0,order:0};if(gr(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},ou={name:"time",parse:function(r,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Xw={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(r,e){return gr(e)?e.number:1}},Jw={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Zw={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(r,e){return e.filter(tA).map(function(A){switch(A.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(A){return A!==0})}},qw={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(r,e){var A=[],t=[];return e.forEach(function(i){switch(i.type){case 20:case 0:A.push(i.value);break;case 17:A.push(i.number.toString());break;case 4:t.push(A.join(" ")),A.length=0;break}}),A.length&&t.push(A.join(" ")),t.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},Yw={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},jw={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(r,e){return gr(e)?e.number:tA(e)&&e.value==="bold"?700:400}},eC={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.filter(tA).map(function(A){return A.value})}},AC={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},wA=function(r,e){return(r&e)!==0},tC={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(r,e){if(e.length===0)return[];var A=e[0];return A.type===20&&A.value==="none"?[]:e}},rC={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return null;var A=e[0];if(A.type===20&&A.value==="none")return null;for(var t=[],i=e.filter(kh),n=0;n<i.length;n++){var s=i[n],o=i[n+1];if(s.type===20){var a=o&&gr(o)?o.number:1;t.push({counter:s.value,increment:a})}}return t}},iC={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return[];for(var A=[],t=e.filter(kh),i=0;i<t.length;i++){var n=t[i],s=t[i+1];if(tA(n)&&n.value!=="none"){var o=s&&gr(s)?s.number:0;A.push({counter:n.value,reset:o})}}return A}},nC={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(r,e){return e.filter(si).map(function(A){return ou.parse(r,A)})}},sC={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return null;var A=e[0];if(A.type===20&&A.value==="none")return null;var t=[],i=e.filter(LB);if(i.length%2!==0)return null;for(var n=0;n<i.length;n+=2){var s=i[n].value,o=i[n+1].value;t.push({open:s,close:o})}return t}},au=function(r,e,A){if(!r)return"";var t=r[Math.min(e,r.length-1)];return t?A?t.open:t.close:""},oC={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.length===1&&Oo(e[0],"none")?[]:ft(e).map(function(A){for(var t={color:255,offsetX:bA,offsetY:bA,blur:bA,spread:bA,inset:!1},i=0,n=0;n<A.length;n++){var s=A[n];Oo(s,"inset")?t.inset=!0:Lt(s)?(i===0?t.offsetX=s:i===1?t.offsetY=s:i===2?t.blur=s:t.spread=s,i++):t.color=It.parse(r,s)}return t})}},aC={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(r,e){var A=[0,1,2],t=[];return e.filter(tA).forEach(function(i){switch(i.value){case"stroke":t.push(1);break;case"fill":t.push(0);break;case"markers":t.push(2);break}}),A.forEach(function(i){t.indexOf(i)===-1&&t.push(i)}),t}},lC={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},cC={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(r,e){return si(e)?e.number:0}},hC=(function(){function r(e,A){var t,i;this.animationDuration=xe(e,nC,A.animationDuration),this.backgroundClip=xe(e,_B,A.backgroundClip),this.backgroundColor=xe(e,DB,A.backgroundColor),this.backgroundImage=xe(e,WB,A.backgroundImage),this.backgroundOrigin=xe(e,$B,A.backgroundOrigin),this.backgroundPosition=xe(e,XB,A.backgroundPosition),this.backgroundRepeat=xe(e,JB,A.backgroundRepeat),this.backgroundSize=xe(e,qB,A.backgroundSize),this.borderTopColor=xe(e,jB,A.borderTopColor),this.borderRightColor=xe(e,ew,A.borderRightColor),this.borderBottomColor=xe(e,Aw,A.borderBottomColor),this.borderLeftColor=xe(e,tw,A.borderLeftColor),this.borderTopLeftRadius=xe(e,rw,A.borderTopLeftRadius),this.borderTopRightRadius=xe(e,iw,A.borderTopRightRadius),this.borderBottomRightRadius=xe(e,nw,A.borderBottomRightRadius),this.borderBottomLeftRadius=xe(e,sw,A.borderBottomLeftRadius),this.borderTopStyle=xe(e,ow,A.borderTopStyle),this.borderRightStyle=xe(e,aw,A.borderRightStyle),this.borderBottomStyle=xe(e,lw,A.borderBottomStyle),this.borderLeftStyle=xe(e,cw,A.borderLeftStyle),this.borderTopWidth=xe(e,hw,A.borderTopWidth),this.borderRightWidth=xe(e,uw,A.borderRightWidth),this.borderBottomWidth=xe(e,dw,A.borderBottomWidth),this.borderLeftWidth=xe(e,fw,A.borderLeftWidth),this.boxShadow=xe(e,oC,A.boxShadow),this.color=xe(e,pw,A.color),this.direction=xe(e,gw,A.direction),this.display=xe(e,mw,A.display),this.float=xe(e,ww,A.cssFloat),this.fontFamily=xe(e,qw,A.fontFamily),this.fontSize=xe(e,Yw,A.fontSize),this.fontStyle=xe(e,AC,A.fontStyle),this.fontVariant=xe(e,eC,A.fontVariant),this.fontWeight=xe(e,jw,A.fontWeight),this.letterSpacing=xe(e,Cw,A.letterSpacing),this.lineBreak=xe(e,vw,A.lineBreak),this.lineHeight=xe(e,yw,A.lineHeight),this.listStyleImage=xe(e,bw,A.listStyleImage),this.listStylePosition=xe(e,Tw,A.listStylePosition),this.listStyleType=xe(e,Vo,A.listStyleType),this.marginTop=xe(e,Qw,A.marginTop),this.marginRight=xe(e,xw,A.marginRight),this.marginBottom=xe(e,Fw,A.marginBottom),this.marginLeft=xe(e,Uw,A.marginLeft),this.opacity=xe(e,Xw,A.opacity);var n=xe(e,Ew,A.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=xe(e,Sw,A.overflowWrap),this.paddingTop=xe(e,Hw,A.paddingTop),this.paddingRight=xe(e,Lw,A.paddingRight),this.paddingBottom=xe(e,Mw,A.paddingBottom),this.paddingLeft=xe(e,Iw,A.paddingLeft),this.paintOrder=xe(e,aC,A.paintOrder),this.position=xe(e,Dw,A.position),this.textAlign=xe(e,_w,A.textAlign),this.textDecorationColor=xe(e,Jw,(t=A.textDecorationColor)!==null&&t!==void 0?t:A.color),this.textDecorationLine=xe(e,Zw,(i=A.textDecorationLine)!==null&&i!==void 0?i:A.textDecoration),this.textShadow=xe(e,kw,A.textShadow),this.textTransform=xe(e,Ow,A.textTransform),this.transform=xe(e,Nw,A.transform),this.transformOrigin=xe(e,Gw,A.transformOrigin),this.visibility=xe(e,Rw,A.visibility),this.webkitTextStrokeColor=xe(e,lC,A.webkitTextStrokeColor),this.webkitTextStrokeWidth=xe(e,cC,A.webkitTextStrokeWidth),this.wordBreak=xe(e,Ww,A.wordBreak),this.zIndex=xe(e,$w,A.zIndex)}return r.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},r.prototype.isTransparent=function(){return _t(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 wA(this.display,4)||wA(this.display,33554432)||wA(this.display,268435456)||wA(this.display,536870912)||wA(this.display,67108864)||wA(this.display,134217728)},r})(),uC=(function(){function r(e,A){this.content=xe(e,tC,A.content),this.quotes=xe(e,sC,A.quotes)}return r})(),lu=(function(){function r(e,A){this.counterIncrement=xe(e,rC,A.counterIncrement),this.counterReset=xe(e,iC,A.counterReset)}return r})(),xe=function(r,e,A){var t=new _h,i=A!==null&&typeof A<"u"?A.toString():e.initialValue;t.write(i);var n=new Dh(t.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(r,tA(s)?s.value:e.initialValue);case 0:return e.parse(r,n.parseComponentValue());case 1:return e.parse(r,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return Un.parse(r,n.parseComponentValue());case"color":return It.parse(r,n.parseComponentValue());case"image":return Po.parse(r,n.parseComponentValue());case"length":var o=n.parseComponentValue();return Lt(o)?o:bA;case"length-percentage":var a=n.parseComponentValue();return mA(a)?a:bA;case"time":return ou.parse(r,n.parseComponentValue())}break}},dC="data-html2canvas-debug",fC=function(r){var e=r.getAttribute(dC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},zo=function(r,e){var A=fC(r);return A===1||e===A},pt=(function(){function r(e,A){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,zo(A,3))debugger;this.styles=new hC(e,window.getComputedStyle(A,null)),ra(A)&&(this.styles.animationDuration.some(function(t){return t>0})&&(A.style.animationDuration="0s"),this.styles.transform!==null&&(A.style.transform="none")),this.bounds=an(this.context,A),zo(A,4)&&(this.flags|=16)}return r})(),pC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ci=typeof Uint8Array>"u"?[]:new Uint8Array(256),Nn=0;Nn<cu.length;Nn++)ci[cu.charCodeAt(Nn)]=Nn;for(var gC=function(r){var e=r.length*.75,A=r.length,t,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var l=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),c=Array.isArray(l)?l:new Uint8Array(l);for(t=0;t<A;t+=4)n=ci[r.charCodeAt(t)],s=ci[r.charCodeAt(t+1)],o=ci[r.charCodeAt(t+2)],a=ci[r.charCodeAt(t+3)],c[i++]=n<<2|s>>4,c[i++]=(s&15)<<4|o>>2,c[i++]=(o&3)<<6|a&63;return l},mC=function(r){for(var e=r.length,A=[],t=0;t<e;t+=2)A.push(r[t+1]<<8|r[t]);return A},BC=function(r){for(var e=r.length,A=[],t=0;t<e;t+=4)A.push(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]);return A},jt=5,Go=11,Ro=2,wC=Go-jt,hu=65536>>jt,CC=1<<jt,Wo=CC-1,vC=1024>>jt,yC=hu+vC,bC=yC,TC=32,QC=bC+TC,xC=65536>>Go,FC=1<<wC,UC=FC-1,uu=function(r,e,A){return r.slice?r.slice(e,A):new Uint16Array(Array.prototype.slice.call(r,e,A))},EC=function(r,e,A){return r.slice?r.slice(e,A):new Uint32Array(Array.prototype.slice.call(r,e,A))},SC=function(r,e){var A=gC(r),t=Array.isArray(A)?BC(A):new Uint32Array(A),i=Array.isArray(A)?mC(A):new Uint16Array(A),n=24,s=uu(i,n/2,t[4]/2),o=t[5]===2?uu(i,(n+t[4])/2):EC(t,Math.ceil((n+t[4])/4));return new HC(t[0],t[1],t[2],t[3],s,o)},HC=(function(){function r(e,A,t,i,n,s){this.initialValue=e,this.errorValue=A,this.highStart=t,this.highValueIndex=i,this.index=n,this.data=s}return r.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=this.index[e>>jt],A=(A<<Ro)+(e&Wo),this.data[A];if(e<=65535)return A=this.index[hu+(e-55296>>jt)],A=(A<<Ro)+(e&Wo),this.data[A];if(e<this.highStart)return A=QC-xC+(e>>Go),A=this.index[A],A+=e>>jt&UC,A=this.index[A],A=(A<<Ro)+(e&Wo),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),du="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",LC=typeof Uint8Array>"u"?[]:new Uint8Array(256),Kn=0;Kn<du.length;Kn++)LC[du.charCodeAt(Kn)]=Kn;var MC=1,$o=2,Xo=3,fu=4,pu=5,IC=7,gu=8,Jo=9,Zo=10,mu=11,Bu=12,wu=13,Cu=14,qo=15,_C=function(r){for(var e=[],A=0,t=r.length;A<t;){var i=r.charCodeAt(A++);if(i>=55296&&i<=56319&&A<t){var n=r.charCodeAt(A++);(n&64512)===56320?e.push(((i&1023)<<10)+(n&1023)+65536):(e.push(i),A--)}else e.push(i)}return e},DC=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var A=r.length;if(!A)return"";for(var t=[],i=-1,n="";++i<A;){var s=r[i];s<=65535?t.push(s):(s-=65536,t.push((s>>10)+55296,s%1024+56320)),(i+1===A||t.length>16384)&&(n+=String.fromCharCode.apply(String,t),t.length=0)}return n},kC=SC(pC),qA="×",Yo="÷",OC=function(r){return kC.get(r)},NC=function(r,e,A){var t=A-2,i=e[t],n=e[A-1],s=e[A];if(n===$o&&s===Xo)return qA;if(n===$o||n===Xo||n===fu||s===$o||s===Xo||s===fu)return Yo;if(n===gu&&[gu,Jo,mu,Bu].indexOf(s)!==-1||(n===mu||n===Jo)&&(s===Jo||s===Zo)||(n===Bu||n===Zo)&&s===Zo||s===wu||s===pu||s===IC||n===MC)return qA;if(n===wu&&s===Cu){for(;i===pu;)i=e[--t];if(i===Cu)return qA}if(n===qo&&s===qo){for(var o=0;i===qo;)o++,i=e[--t];if(o%2===0)return qA}return Yo},KC=function(r){var e=_C(r),A=e.length,t=0,i=0,n=e.map(OC);return{next:function(){if(t>=A)return{done:!0,value:null};for(var s=qA;t<A&&(s=NC(e,n,++t))===qA;);if(s!==qA||t===A){var o=DC.apply(null,e.slice(i,t));return i=t,{value:o,done:!1}}return{done:!0,value:null}}}},PC=function(r){for(var e=KC(r),A=[],t;!(t=e.next()).done;)t.value&&A.push(t.value.slice());return A},VC=function(r){var e=123;if(r.createRange){var A=r.createRange();if(A.getBoundingClientRect){var t=r.createElement("boundtest");t.style.height=e+"px",t.style.display="block",r.body.appendChild(t),A.selectNode(t);var i=A.getBoundingClientRect(),n=Math.round(i.height);if(r.body.removeChild(t),n===e)return!0}}return!1},zC=function(r){var e=r.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",r.body.appendChild(e);var A=r.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var t=e.firstChild,i=ln(t.data).map(function(a){return dA(a)}),n=0,s={},o=i.every(function(a,l){A.setStart(t,n),A.setEnd(t,n+a.length);var c=A.getBoundingClientRect();n+=a.length;var d=c.x>s.x||c.y>s.y;return s=c,l===0?!0:d});return r.body.removeChild(e),o},GC=function(){return typeof new Image().crossOrigin<"u"},RC=function(){return typeof new XMLHttpRequest().responseType=="string"},WC=function(r){var e=new Image,A=r.createElement("canvas"),t=A.getContext("2d");if(!t)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{t.drawImage(e,0,0),A.toDataURL()}catch{return!1}return!0},vu=function(r){return r[0]===0&&r[1]===255&&r[2]===0&&r[3]===255},$C=function(r){var e=r.createElement("canvas"),A=100;e.width=A,e.height=A;var t=e.getContext("2d");if(!t)return Promise.reject(!1);t.fillStyle="rgb(0, 255, 0)",t.fillRect(0,0,A,A);var i=new Image,n=e.toDataURL();i.src=n;var s=jo(A,A,0,0,i);return t.fillStyle="red",t.fillRect(0,0,A,A),yu(s).then(function(o){t.drawImage(o,0,0);var a=t.getImageData(0,0,A,A).data;t.fillStyle="red",t.fillRect(0,0,A,A);var l=r.createElement("div");return l.style.backgroundImage="url("+n+")",l.style.height=A+"px",vu(a)?yu(jo(A,A,0,0,l)):Promise.reject(!1)}).then(function(o){return t.drawImage(o,0,0),vu(t.getImageData(0,0,A,A).data)}).catch(function(){return!1})},jo=function(r,e,A,t,i){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",r.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",A.toString()),o.setAttributeNS(null,"y",t.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(i),s},yu=function(r){return new Promise(function(e,A){var t=new Image;t.onload=function(){return e(t)},t.onerror=A,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},TA={get SUPPORT_RANGE_BOUNDS(){var r=VC(document);return Object.defineProperty(TA,"SUPPORT_RANGE_BOUNDS",{value:r}),r},get SUPPORT_WORD_BREAKING(){var r=TA.SUPPORT_RANGE_BOUNDS&&zC(document);return Object.defineProperty(TA,"SUPPORT_WORD_BREAKING",{value:r}),r},get SUPPORT_SVG_DRAWING(){var r=WC(document);return Object.defineProperty(TA,"SUPPORT_SVG_DRAWING",{value:r}),r},get SUPPORT_FOREIGNOBJECT_DRAWING(){var r=typeof Array.from=="function"&&typeof window.fetch=="function"?$C(document):Promise.resolve(!1);return Object.defineProperty(TA,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:r}),r},get SUPPORT_CORS_IMAGES(){var r=GC();return Object.defineProperty(TA,"SUPPORT_CORS_IMAGES",{value:r}),r},get SUPPORT_RESPONSE_TYPE(){var r=RC();return Object.defineProperty(TA,"SUPPORT_RESPONSE_TYPE",{value:r}),r},get SUPPORT_CORS_XHR(){var r="withCredentials"in new XMLHttpRequest;return Object.defineProperty(TA,"SUPPORT_CORS_XHR",{value:r}),r},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var r=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(TA,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:r}),r}},hi=(function(){function r(e,A){this.text=e,this.bounds=A}return r})(),XC=function(r,e,A,t){var i=qC(e,A),n=[],s=0;return i.forEach(function(o){if(A.textDecorationLine.length||o.trim().length>0)if(TA.SUPPORT_RANGE_BOUNDS){var a=bu(t,s,o.length).getClientRects();if(a.length>1){var l=ea(o),c=0;l.forEach(function(p){n.push(new hi(p,yt.fromDOMRectList(r,bu(t,c+s,p.length).getClientRects()))),c+=p.length})}else n.push(new hi(o,yt.fromDOMRectList(r,a)))}else{var d=t.splitText(o.length);n.push(new hi(o,JC(r,t))),t=d}else TA.SUPPORT_RANGE_BOUNDS||(t=t.splitText(o.length));s+=o.length}),n},JC=function(r,e){var A=e.ownerDocument;if(A){var t=A.createElement("html2canvaswrapper");t.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(t,e);var n=an(r,t);return t.firstChild&&i.replaceChild(t.firstChild,t),n}}return yt.EMPTY},bu=function(r,e,A){var t=r.ownerDocument;if(!t)throw new Error("Node has no owner document");var i=t.createRange();return i.setStart(r,e),i.setEnd(r,e+A),i},ea=function(r){if(TA.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(r)).map(function(A){return A.segment})}return PC(r)},ZC=function(r,e){if(TA.SUPPORT_NATIVE_TEXT_SEGMENTATION){var A=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(A.segment(r)).map(function(t){return t.segment})}return jC(r,e)},qC=function(r,e){return e.letterSpacing!==0?ea(r):ZC(r,e)},YC=[32,160,4961,65792,65793,4153,4241],jC=function(r,e){for(var A=xm(r,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),t=[],i,n=function(){if(i.value){var s=i.value.slice(),o=ln(s),a="";o.forEach(function(l){YC.indexOf(l)===-1?a+=dA(l):(a.length&&t.push(a),t.push(dA(l)),a="")}),a.length&&t.push(a)}};!(i=A.next()).done;)n();return t},e2=(function(){function r(e,A,t){this.text=A2(A.data,t.textTransform),this.textBounds=XC(e,this.text,t,A)}return r})(),A2=function(r,e){switch(e){case 1:return r.toLowerCase();case 3:return r.replace(t2,r2);case 2:return r.toUpperCase();default:return r}},t2=/(^|\s|:|-|\(|\))([a-z])/g,r2=function(r,e,A){return r.length>0?e+A.toUpperCase():r},Tu=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.src=t.currentSrc||t.src,i.intrinsicWidth=t.naturalWidth,i.intrinsicHeight=t.naturalHeight,i.context.cache.addImage(i.src),i}return e})(pt),Qu=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.canvas=t,i.intrinsicWidth=t.width,i.intrinsicHeight=t.height,i}return e})(pt),xu=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this,n=new XMLSerializer,s=an(A,t);return t.setAttribute("width",s.width+"px"),t.setAttribute("height",s.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(t)),i.intrinsicWidth=t.width.baseVal.value,i.intrinsicHeight=t.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e})(pt),Fu=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.value=t.value,i}return e})(pt),Aa=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.start=t.start,i.reversed=typeof t.reversed=="boolean"&&t.reversed===!0,i}return e})(pt),i2=[{type:15,flags:0,unit:"px",number:3}],n2=[{type:16,flags:0,number:50}],s2=function(r){return r.width>r.height?new yt(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width<r.height?new yt(r.left,r.top+(r.height-r.width)/2,r.width,r.width):r},o2=function(r){var e=r.type===a2?new Array(r.value.length+1).join("•"):r.value;return e.length===0?r.placeholder||"":e},Pn="checkbox",Vn="radio",a2="password",Uu=707406591,ta=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;switch(i.type=t.type.toLowerCase(),i.checked=t.checked,i.value=o2(t),(i.type===Pn||i.type===Vn)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=s2(i.bounds)),i.type){case Pn:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=i2;break;case Vn:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=n2;break}return i}return e})(pt),Eu=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this,n=t.options[t.selectedIndex||0];return i.value=n&&n.text||"",i}return e})(pt),Su=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.value=t.value,i}return e})(pt),Hu=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;i.src=t.src,i.width=parseInt(t.width,10)||0,i.height=parseInt(t.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(t.contentWindow&&t.contentWindow.document&&t.contentWindow.document.documentElement){i.tree=Mu(A,t.contentWindow.document.documentElement);var n=t.contentWindow.document.documentElement?ai(A,getComputedStyle(t.contentWindow.document.documentElement).backgroundColor):Tt.TRANSPARENT,s=t.contentWindow.document.body?ai(A,getComputedStyle(t.contentWindow.document.body).backgroundColor):Tt.TRANSPARENT;i.backgroundColor=_t(n)?_t(s)?i.styles.backgroundColor:s:n}}catch{}return i}return e})(pt),l2=["OL","UL","MENU"],zn=function(r,e,A,t){for(var i=e.firstChild,n=void 0;i;i=n)if(n=i.nextSibling,Iu(i)&&i.data.trim().length>0)A.textNodes.push(new e2(r,i,A.styles));else if(wr(i))if(Ku(i)&&i.assignedNodes)i.assignedNodes().forEach(function(o){return zn(r,o,A,t)});else{var s=Lu(r,i);s.styles.isVisible()&&(c2(i,s,t)?s.flags|=4:h2(s.styles)&&(s.flags|=2),l2.indexOf(i.tagName)!==-1&&(s.flags|=8),A.elements.push(s),i.slot,i.shadowRoot?zn(r,i.shadowRoot,s,t):!Rn(i)&&!_u(i)&&!Wn(i)&&zn(r,i,s,t))}},Lu=function(r,e){return na(e)?new Tu(r,e):Du(e)?new Qu(r,e):_u(e)?new xu(r,e):u2(e)?new Fu(r,e):d2(e)?new Aa(r,e):f2(e)?new ta(r,e):Wn(e)?new Eu(r,e):Rn(e)?new Su(r,e):Ou(e)?new Hu(r,e):new pt(r,e)},Mu=function(r,e){var A=Lu(r,e);return A.flags|=4,zn(r,e,A,A),A},c2=function(r,e,A){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||ia(r)&&A.styles.isTransparent()},h2=function(r){return r.isPositioned()||r.isFloating()},Iu=function(r){return r.nodeType===Node.TEXT_NODE},wr=function(r){return r.nodeType===Node.ELEMENT_NODE},ra=function(r){return wr(r)&&typeof r.style<"u"&&!Gn(r)},Gn=function(r){return typeof r.className=="object"},u2=function(r){return r.tagName==="LI"},d2=function(r){return r.tagName==="OL"},f2=function(r){return r.tagName==="INPUT"},p2=function(r){return r.tagName==="HTML"},_u=function(r){return r.tagName==="svg"},ia=function(r){return r.tagName==="BODY"},Du=function(r){return r.tagName==="CANVAS"},ku=function(r){return r.tagName==="VIDEO"},na=function(r){return r.tagName==="IMG"},Ou=function(r){return r.tagName==="IFRAME"},Nu=function(r){return r.tagName==="STYLE"},g2=function(r){return r.tagName==="SCRIPT"},Rn=function(r){return r.tagName==="TEXTAREA"},Wn=function(r){return r.tagName==="SELECT"},Ku=function(r){return r.tagName==="SLOT"},Pu=function(r){return r.tagName.indexOf("-")>0},m2=(function(){function r(){this.counters={}}return r.prototype.getCounterValue=function(e){var A=this.counters[e];return A&&A.length?A[A.length-1]:1},r.prototype.getCounterValues=function(e){var A=this.counters[e];return A||[]},r.prototype.pop=function(e){var A=this;e.forEach(function(t){return A.counters[t].pop()})},r.prototype.parse=function(e){var A=this,t=e.counterIncrement,i=e.counterReset,n=!0;t!==null&&t.forEach(function(o){var a=A.counters[o.counter];a&&o.increment!==0&&(n=!1,a.length||a.push(1),a[Math.max(0,a.length-1)]+=o.increment)});var s=[];return n&&i.forEach(function(o){var a=A.counters[o.counter];s.push(o.counter),a||(a=A.counters[o.counter]=[]),a.push(o.reset)}),s},r})(),Vu={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"]},zu={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},B2={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},w2={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Cr=function(r,e,A,t,i,n){return r<e||r>A?di(r,i,n.length>0):t.integers.reduce(function(s,o,a){for(;r>=o;)r-=o,s+=t.values[a];return s},"")+n},Gu=function(r,e,A,t){var i="";do A||r--,i=t(r)+i,r/=e;while(r*e>=e);return i},fA=function(r,e,A,t,i){var n=A-e+1;return(r<0?"-":"")+(Gu(Math.abs(r),n,t,function(s){return dA(Math.floor(s%n)+e)})+i)},er=function(r,e,A){A===void 0&&(A=". ");var t=e.length;return Gu(Math.abs(r),t,!1,function(i){return e[Math.floor(i%t)]})+A},vr=1,kt=2,Ot=4,ui=8,Qt=function(r,e,A,t,i,n){if(r<-9999||r>9999)return di(r,4,i.length>0);var s=Math.abs(r),o=i;if(s===0)return e[0]+o;for(var a=0;s>0&&a<=4;a++){var l=s%10;l===0&&wA(n,vr)&&o!==""?o=e[l]+o:l>1||l===1&&a===0||l===1&&a===1&&wA(n,kt)||l===1&&a===1&&wA(n,Ot)&&r>100||l===1&&a>1&&wA(n,ui)?o=e[l]+(a>0?A[a-1]:"")+o:l===1&&a>0&&(o=A[a-1]+o),s=Math.floor(s/10)}return(r<0?t:"")+o},Ru="十百千萬",Wu="拾佰仟萬",$u="マイナス",sa="마이너스",di=function(r,e,A){var t=A?". ":"",i=A?"、":"",n=A?", ":"",s=A?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=fA(r,48,57,!0,t);return o.length<4?"0"+o:o;case 4:return er(r,"〇一二三四五六七八九",i);case 6:return Cr(r,1,3999,Vu,3,t).toLowerCase();case 7:return Cr(r,1,3999,Vu,3,t);case 8:return fA(r,945,969,!1,t);case 9:return fA(r,97,122,!1,t);case 10:return fA(r,65,90,!1,t);case 11:return fA(r,1632,1641,!0,t);case 12:case 49:return Cr(r,1,9999,zu,3,t);case 35:return Cr(r,1,9999,zu,3,t).toLowerCase();case 13:return fA(r,2534,2543,!0,t);case 14:case 30:return fA(r,6112,6121,!0,t);case 15:return er(r,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return er(r,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return Qt(r,"零一二三四五六七八九",Ru,"負",i,kt|Ot|ui);case 47:return Qt(r,"零壹貳參肆伍陸柒捌玖",Wu,"負",i,vr|kt|Ot|ui);case 42:return Qt(r,"零一二三四五六七八九",Ru,"负",i,kt|Ot|ui);case 41:return Qt(r,"零壹贰叁肆伍陆柒捌玖",Wu,"负",i,vr|kt|Ot|ui);case 26:return Qt(r,"〇一二三四五六七八九","十百千万",$u,i,0);case 25:return Qt(r,"零壱弐参四伍六七八九","拾百千万",$u,i,vr|kt|Ot);case 31:return Qt(r,"영일이삼사오육칠팔구","십백천만",sa,n,vr|kt|Ot);case 33:return Qt(r,"零一二三四五六七八九","十百千萬",sa,n,0);case 32:return Qt(r,"零壹貳參四五六七八九","拾百千",sa,n,vr|kt|Ot);case 18:return fA(r,2406,2415,!0,t);case 20:return Cr(r,1,19999,w2,3,t);case 21:return fA(r,2790,2799,!0,t);case 22:return fA(r,2662,2671,!0,t);case 22:return Cr(r,1,10999,B2,3,t);case 23:return er(r,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return er(r,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return fA(r,3302,3311,!0,t);case 28:return er(r,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return er(r,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return fA(r,3792,3801,!0,t);case 37:return fA(r,6160,6169,!0,t);case 38:return fA(r,4160,4169,!0,t);case 39:return fA(r,2918,2927,!0,t);case 40:return fA(r,1776,1785,!0,t);case 43:return fA(r,3046,3055,!0,t);case 44:return fA(r,3174,3183,!0,t);case 45:return fA(r,3664,3673,!0,t);case 46:return fA(r,3872,3881,!0,t);default:return fA(r,48,57,!0,t)}},Xu="data-html2canvas-ignore",Ju=(function(){function r(e,A,t){if(this.context=e,this.options=t,this.scrolledElements=[],this.referenceElement=A,this.counters=new m2,this.quoteDepth=0,!A.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(A.ownerDocument.documentElement,!1)}return r.prototype.toIFrame=function(e,A){var t=this,i=C2(e,A);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=i.contentWindow,a=o.document,l=b2(i).then(function(){return MA(t,void 0,void 0,function(){var c,d;return SA(this,function(p){switch(p.label){case 0:return this.scrolledElements.forEach(F2),o&&(o.scrollTo(A.left,A.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==A.top||o.scrollX!==A.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-A.left,o.scrollY-A.top,0,0))),c=this.options.onclone,d=this.clonedReferenceElement,typeof d>"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:p.sent(),p.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,y2(a)]:[3,4];case 3:p.sent(),p.label=4;case 4:return typeof c=="function"?[2,Promise.resolve().then(function(){return c(a,d)}).then(function(){return i})]:[2,i]}})})});return a.open(),a.write(Q2(document.doctype)+"<html></html>"),x2(this.referenceElement.ownerDocument,n,s),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),l},r.prototype.createElementClone=function(e){if(zo(e,2))debugger;if(Du(e))return this.createCanvasClone(e);if(ku(e))return this.createVideoClone(e);if(Nu(e))return this.createStyleClone(e);var A=e.cloneNode(!1);return na(A)&&(na(e)&&e.currentSrc&&e.currentSrc!==e.src&&(A.src=e.currentSrc,A.srcset=""),A.loading==="lazy"&&(A.loading="eager")),Pu(A)?this.createCustomElementClone(A):A},r.prototype.createCustomElementClone=function(e){var A=document.createElement("html2canvascustomelement");return oa(e.style,A),A},r.prototype.createStyleClone=function(e){try{var A=e.sheet;if(A&&A.cssRules){var t=[].slice.call(A.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),i=e.cloneNode(!1);return i.textContent=t,i}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},r.prototype.createCanvasClone=function(e){var A;if(this.options.inlineImages&&e.ownerDocument){var t=e.ownerDocument.createElement("img");try{return t.src=e.toDataURL(),t}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var n=e.getContext("2d"),s=i.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(A=e.getContext("webgl2"))!==null&&A!==void 0?A:e.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",e)}s.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},r.prototype.createVideoClone=function(e){var A=e.ownerDocument.createElement("canvas");A.width=e.offsetWidth,A.height=e.offsetHeight;var t=A.getContext("2d");try{return t&&(t.drawImage(e,0,0,A.width,A.height),this.options.allowTaint||t.getImageData(0,0,A.width,A.height)),A}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},r.prototype.appendChildNode=function(e,A,t){(!wr(A)||!g2(A)&&!A.hasAttribute(Xu)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(A)))&&(!this.options.copyStyles||!wr(A)||!Nu(A))&&e.appendChild(this.cloneNode(A,t))},r.prototype.cloneChildNodes=function(e,A,t){for(var i=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(wr(n)&&Ku(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return i.appendChildNode(A,o,t)})}else this.appendChildNode(A,n,t)},r.prototype.cloneNode=function(e,A){if(Iu(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var t=e.ownerDocument.defaultView;if(t&&wr(e)&&(ra(e)||Gn(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var n=t.getComputedStyle(e),s=t.getComputedStyle(e,":before"),o=t.getComputedStyle(e,":after");this.referenceElement===e&&ra(i)&&(this.clonedReferenceElement=i),ia(i)&&S2(i);var a=this.counters.parse(new lu(this.context,n)),l=this.resolvePseudoContent(e,i,s,fi.BEFORE);Pu(e)&&(A=!0),ku(e)||this.cloneChildNodes(e,i,A),l&&i.insertBefore(l,i.firstChild);var c=this.resolvePseudoContent(e,i,o,fi.AFTER);return c&&i.appendChild(c),this.counters.pop(a),(n&&(this.options.copyStyles||Gn(e))&&!Ou(e)||A)&&oa(n,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(Rn(e)||Wn(e))&&(Rn(i)||Wn(i))&&(i.value=e.value),i}return e.cloneNode(!1)},r.prototype.resolvePseudoContent=function(e,A,t,i){var n=this;if(t){var s=t.content,o=A.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||t.display==="none")){this.counters.parse(new lu(this.context,t));var a=new uC(this.context,t),l=o.createElement("html2canvaspseudoelement");oa(t,l),a.content.forEach(function(d){if(d.type===0)l.appendChild(o.createTextNode(d.value));else if(d.type===22){var p=o.createElement("img");p.src=d.value,p.style.opacity="1",l.appendChild(p)}else if(d.type===18){if(d.name==="attr"){var y=d.values.filter(tA);y.length&&l.appendChild(o.createTextNode(e.getAttribute(y[0].value)||""))}else if(d.name==="counter"){var w=d.values.filter(mr),C=w[0],v=w[1];if(C&&tA(C)){var S=n.counters.getCounterValue(C.value),F=v&&tA(v)?Vo.parse(n.context,v.value):3;l.appendChild(o.createTextNode(di(S,F,!1)))}}else if(d.name==="counters"){var k=d.values.filter(mr),C=k[0],x=k[1],v=k[2];if(C&&tA(C)){var V=n.counters.getCounterValues(C.value),N=v&&tA(v)?Vo.parse(n.context,v.value):3,Z=x&&x.type===0?x.value:"",X=V.map(function(G){return di(G,N,!1)}).join(Z);l.appendChild(o.createTextNode(X))}}}else if(d.type===20)switch(d.value){case"open-quote":l.appendChild(o.createTextNode(au(a.quotes,n.quoteDepth++,!0)));break;case"close-quote":l.appendChild(o.createTextNode(au(a.quotes,--n.quoteDepth,!1)));break;default:l.appendChild(o.createTextNode(d.value))}}),l.className=aa+" "+la;var c=i===fi.BEFORE?" "+aa:" "+la;return Gn(A)?A.className.baseValue+=c:A.className+=c,l}}},r.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},r})(),fi;(function(r){r[r.BEFORE=0]="BEFORE",r[r.AFTER=1]="AFTER"})(fi||(fi={}));var C2=function(r,e){var A=r.createElement("iframe");return A.className="html2canvas-container",A.style.visibility="hidden",A.style.position="fixed",A.style.left="-10000px",A.style.top="0px",A.style.border="0",A.width=e.width.toString(),A.height=e.height.toString(),A.scrolling="no",A.setAttribute(Xu,"true"),r.body.appendChild(A),A},v2=function(r){return new Promise(function(e){if(r.complete){e();return}if(!r.src){e();return}r.onload=e,r.onerror=e})},y2=function(r){return Promise.all([].slice.call(r.images,0).map(v2))},b2=function(r){return new Promise(function(e,A){var t=r.contentWindow;if(!t)return A("No window assigned for iframe");var i=t.document;t.onload=r.onload=function(){t.onload=r.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(n),e(r))},50)}})},T2=["all","d","content"],oa=function(r,e){for(var A=r.length-1;A>=0;A--){var t=r.item(A);T2.indexOf(t)===-1&&e.style.setProperty(t,r.getPropertyValue(t))}return e},Q2=function(r){var e="";return r&&(e+="<!DOCTYPE ",r.name&&(e+=r.name),r.internalSubset&&(e+=r.internalSubset),r.publicId&&(e+='"'+r.publicId+'"'),r.systemId&&(e+='"'+r.systemId+'"'),e+=">"),e},x2=function(r,e,A){r&&r.defaultView&&(e!==r.defaultView.pageXOffset||A!==r.defaultView.pageYOffset)&&r.defaultView.scrollTo(e,A)},F2=function(r){var e=r[0],A=r[1],t=r[2];e.scrollLeft=A,e.scrollTop=t},U2=":before",E2=":after",aa="___html2canvas___pseudoelement_before",la="___html2canvas___pseudoelement_after",Zu=`{
7
7
  content: "" !important;
8
8
  display: none !important;
9
- }`,b2=function(r){T2(r,"."+nl+v2+Wu+`
10
- .`+sl+y2+Wu)},T2=function(r,e){var A=r.ownerDocument;if(A){var t=A.createElement("style");t.textContent=e,r.appendChild(t)}},Ru=(function(){function r(){}return r.getOrigin=function(e){var A=r._link;return A?(A.href=e,A.href=A.href,A.protocol+A.hostname+A.port):"about:blank"},r.isSameOrigin=function(e){return r.getOrigin(e)===r._origin},r.setContext=function(e){r._link=e.document.createElement("a"),r._origin=r.getOrigin(e.location.href)},r._origin="about:blank",r})(),Q2=(function(){function r(e,A){this.context=e,this._options=A,this._cache={}}return r.prototype.addImage=function(e){var A=Promise.resolve();return this.has(e)||(ll(e)||E2(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),A},r.prototype.match=function(e){return this._cache[e]},r.prototype.loadImage=function(e){return SA(this,void 0,void 0,function(){var A,t,i,n,s=this;return FA(this,function(o){switch(o.label){case 0:return A=Ru.isSameOrigin(e),t=!ol(e)&&this._options.useCORS===!0&&yA.SUPPORT_CORS_IMAGES&&!A,i=!ol(e)&&!A&&!ll(e)&&typeof this._options.proxy=="string"&&yA.SUPPORT_CORS_XHR&&!t,!A&&this._options.allowTaint===!1&&!ol(e)&&!ll(e)&&!i&&!t?[2]:(n=e,i?[4,this.proxy(n)]:[3,2]);case 1:n=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(l,a){var c=new Image;c.onload=function(){return l(c)},c.onerror=a,(S2(n)||t)&&(c.crossOrigin="anonymous"),c.src=n,c.complete===!0&&setTimeout(function(){return l(c)},500),s._options.imageTimeout>0&&setTimeout(function(){return a("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(e){return typeof this._cache[e]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(e){var A=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(n,s){var o=yA.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var u=new FileReader;u.addEventListener("load",function(){return n(u.result)},!1),u.addEventListener("error",function(m){return s(m)},!1),u.readAsDataURL(l.response)}else s("Failed to proxy resource "+i+" with status code "+l.status)},l.onerror=s;var a=t.indexOf("?")>-1?"&":"?";if(l.open("GET",""+t+a+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),A._options.imageTimeout){var c=A._options.imageTimeout;l.timeout=c,l.ontimeout=function(){return s("Timed out ("+c+"ms) proxying "+i)}}l.send()})},r})(),x2=/^data:image\/svg\+xml/i,F2=/^data:image\/.*;base64,/i,U2=/^data:image\/.*/i,E2=function(r){return yA.SUPPORT_SVG_DRAWING||!H2(r)},ol=function(r){return U2.test(r)},S2=function(r){return F2.test(r)},ll=function(r){return r.substr(0,4)==="blob"},H2=function(r){return r.substr(-3).toLowerCase()==="svg"||x2.test(r)},ve=(function(){function r(e,A){this.type=0,this.x=e,this.y=A}return r.prototype.add=function(e,A){return new r(this.x+e,this.y+A)},r})(),Br=function(r,e,A){return new ve(r.x+(e.x-r.x)*A,r.y+(e.y-r.y)*A)},Gn=(function(){function r(e,A,t,i){this.type=1,this.start=e,this.startControl=A,this.endControl=t,this.end=i}return r.prototype.subdivide=function(e,A){var t=Br(this.start,this.startControl,e),i=Br(this.startControl,this.endControl,e),n=Br(this.endControl,this.end,e),s=Br(t,i,e),o=Br(i,n,e),l=Br(s,o,e);return A?new r(this.start,t,s,l):new r(l,o,n,this.end)},r.prototype.add=function(e,A){return new r(this.start.add(e,A),this.startControl.add(e,A),this.endControl.add(e,A),this.end.add(e,A))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r})(),$A=function(r){return r.type===1},L2=(function(){function r(e){var A=e.styles,t=e.bounds,i=ri(A.borderTopLeftRadius,t.width,t.height),n=i[0],s=i[1],o=ri(A.borderTopRightRadius,t.width,t.height),l=o[0],a=o[1],c=ri(A.borderBottomRightRadius,t.width,t.height),u=c[0],m=c[1],y=ri(A.borderBottomLeftRadius,t.width,t.height),B=y[0],p=y[1],Q=[];Q.push((n+l)/t.width),Q.push((B+u)/t.width),Q.push((s+p)/t.height),Q.push((a+m)/t.height);var D=Math.max.apply(Math,Q);D>1&&(n/=D,s/=D,l/=D,a/=D,u/=D,m/=D,B/=D,p/=D);var F=t.width-l,_=t.height-m,L=t.width-u,k=t.height-p,V=A.borderTopWidth,Z=A.borderRightWidth,$=A.borderBottomWidth,z=A.borderLeftWidth,R=nA(A.paddingTop,e.bounds.width),X=nA(A.paddingRight,e.bounds.width),se=nA(A.paddingBottom,e.bounds.width),ae=nA(A.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?lA(t.left+z/3,t.top+V/3,n-z/3,s-V/3,eA.TOP_LEFT):new ve(t.left+z/3,t.top+V/3),this.topRightBorderDoubleOuterBox=n>0||s>0?lA(t.left+F,t.top+V/3,l-Z/3,a-V/3,eA.TOP_RIGHT):new ve(t.left+t.width-Z/3,t.top+V/3),this.bottomRightBorderDoubleOuterBox=u>0||m>0?lA(t.left+L,t.top+_,u-Z/3,m-$/3,eA.BOTTOM_RIGHT):new ve(t.left+t.width-Z/3,t.top+t.height-$/3),this.bottomLeftBorderDoubleOuterBox=B>0||p>0?lA(t.left+z/3,t.top+k,B-z/3,p-$/3,eA.BOTTOM_LEFT):new ve(t.left+z/3,t.top+t.height-$/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?lA(t.left+z*2/3,t.top+V*2/3,n-z*2/3,s-V*2/3,eA.TOP_LEFT):new ve(t.left+z*2/3,t.top+V*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?lA(t.left+F,t.top+V*2/3,l-Z*2/3,a-V*2/3,eA.TOP_RIGHT):new ve(t.left+t.width-Z*2/3,t.top+V*2/3),this.bottomRightBorderDoubleInnerBox=u>0||m>0?lA(t.left+L,t.top+_,u-Z*2/3,m-$*2/3,eA.BOTTOM_RIGHT):new ve(t.left+t.width-Z*2/3,t.top+t.height-$*2/3),this.bottomLeftBorderDoubleInnerBox=B>0||p>0?lA(t.left+z*2/3,t.top+k,B-z*2/3,p-$*2/3,eA.BOTTOM_LEFT):new ve(t.left+z*2/3,t.top+t.height-$*2/3),this.topLeftBorderStroke=n>0||s>0?lA(t.left+z/2,t.top+V/2,n-z/2,s-V/2,eA.TOP_LEFT):new ve(t.left+z/2,t.top+V/2),this.topRightBorderStroke=n>0||s>0?lA(t.left+F,t.top+V/2,l-Z/2,a-V/2,eA.TOP_RIGHT):new ve(t.left+t.width-Z/2,t.top+V/2),this.bottomRightBorderStroke=u>0||m>0?lA(t.left+L,t.top+_,u-Z/2,m-$/2,eA.BOTTOM_RIGHT):new ve(t.left+t.width-Z/2,t.top+t.height-$/2),this.bottomLeftBorderStroke=B>0||p>0?lA(t.left+z/2,t.top+k,B-z/2,p-$/2,eA.BOTTOM_LEFT):new ve(t.left+z/2,t.top+t.height-$/2),this.topLeftBorderBox=n>0||s>0?lA(t.left,t.top,n,s,eA.TOP_LEFT):new ve(t.left,t.top),this.topRightBorderBox=l>0||a>0?lA(t.left+F,t.top,l,a,eA.TOP_RIGHT):new ve(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||m>0?lA(t.left+L,t.top+_,u,m,eA.BOTTOM_RIGHT):new ve(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=B>0||p>0?lA(t.left,t.top+k,B,p,eA.BOTTOM_LEFT):new ve(t.left,t.top+t.height),this.topLeftPaddingBox=n>0||s>0?lA(t.left+z,t.top+V,Math.max(0,n-z),Math.max(0,s-V),eA.TOP_LEFT):new ve(t.left+z,t.top+V),this.topRightPaddingBox=l>0||a>0?lA(t.left+Math.min(F,t.width-Z),t.top+V,F>t.width+Z?0:Math.max(0,l-Z),Math.max(0,a-V),eA.TOP_RIGHT):new ve(t.left+t.width-Z,t.top+V),this.bottomRightPaddingBox=u>0||m>0?lA(t.left+Math.min(L,t.width-z),t.top+Math.min(_,t.height-$),Math.max(0,u-Z),Math.max(0,m-$),eA.BOTTOM_RIGHT):new ve(t.left+t.width-Z,t.top+t.height-$),this.bottomLeftPaddingBox=B>0||p>0?lA(t.left+z,t.top+Math.min(k,t.height-$),Math.max(0,B-z),Math.max(0,p-$),eA.BOTTOM_LEFT):new ve(t.left+z,t.top+t.height-$),this.topLeftContentBox=n>0||s>0?lA(t.left+z+ae,t.top+V+R,Math.max(0,n-(z+ae)),Math.max(0,s-(V+R)),eA.TOP_LEFT):new ve(t.left+z+ae,t.top+V+R),this.topRightContentBox=l>0||a>0?lA(t.left+Math.min(F,t.width+z+ae),t.top+V+R,F>t.width+z+ae?0:l-z+ae,a-(V+R),eA.TOP_RIGHT):new ve(t.left+t.width-(Z+X),t.top+V+R),this.bottomRightContentBox=u>0||m>0?lA(t.left+Math.min(L,t.width-(z+ae)),t.top+Math.min(_,t.height+V+R),Math.max(0,u-(Z+X)),m-($+se),eA.BOTTOM_RIGHT):new ve(t.left+t.width-(Z+X),t.top+t.height-($+se)),this.bottomLeftContentBox=B>0||p>0?lA(t.left+z+ae,t.top+k,Math.max(0,B-(z+ae)),p-($+se),eA.BOTTOM_LEFT):new ve(t.left+z+ae,t.top+t.height-($+se))}return r})(),eA;(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"})(eA||(eA={}));var lA=function(r,e,A,t,i){var n=4*((Math.sqrt(2)-1)/3),s=A*n,o=t*n,l=r+A,a=e+t;switch(i){case eA.TOP_LEFT:return new Gn(new ve(r,a),new ve(r,a-o),new ve(l-s,e),new ve(l,e));case eA.TOP_RIGHT:return new Gn(new ve(r,e),new ve(r+s,e),new ve(l,a-o),new ve(l,a));case eA.BOTTOM_RIGHT:return new Gn(new ve(l,e),new ve(l,e+o),new ve(r+s,a),new ve(r,a));case eA.BOTTOM_LEFT:default:return new Gn(new ve(l,a),new ve(l-s,a),new ve(r,e+o),new ve(r,e))}},Wn=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},M2=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},Rn=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},I2=(function(){function r(e,A,t){this.offsetX=e,this.offsetY=A,this.matrix=t,this.type=0,this.target=6}return r})(),$n=(function(){function r(e,A){this.path=e,this.target=A,this.type=1}return r})(),_2=(function(){function r(e){this.opacity=e,this.type=2,this.target=6}return r})(),D2=function(r){return r.type===0},$u=function(r){return r.type===1},k2=function(r){return r.type===2},Xu=function(r,e){return r.length===e.length?r.some(function(A,t){return A===e[t]}):!1},O2=function(r,e,A,t,i){return r.map(function(n,s){switch(s){case 0:return n.add(e,A);case 1:return n.add(e+t,A);case 2:return n.add(e+t,A+i);case 3:return n.add(e,A+i)}return n})},Ju=(function(){function r(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r})(),Zu=(function(){function r(e,A){if(this.container=e,this.parent=A,this.effects=[],this.curves=new L2(this.container),this.container.styles.opacity<1&&this.effects.push(new _2(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new I2(t,i,n))}if(this.container.styles.overflowX!==0){var s=Wn(this.curves),o=Rn(this.curves);Xu(s,o)?this.effects.push(new $n(s,6)):(this.effects.push(new $n(s,2)),this.effects.push(new $n(o,4)))}}return r.prototype.getEffects=function(e){for(var A=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,i=this.effects.slice(0);t;){var n=t.effects.filter(function(l){return!$u(l)});if(A||t.container.styles.position!==0||!t.parent){if(i.unshift.apply(i,n),A=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var s=Wn(t.curves),o=Rn(t.curves);Xu(s,o)||i.unshift(new $n(o,6))}}else i.unshift.apply(i,n);t=t.parent}return i.filter(function(l){return mA(l.target,e)})},r})(),al=function(r,e,A,t){r.container.elements.forEach(function(i){var n=mA(i.flags,4),s=mA(i.flags,2),o=new Zu(i,r);mA(i.styles.display,2048)&&t.push(o);var l=mA(i.flags,8)?[]:t;if(n||s){var a=n||i.styles.isPositioned()?A:e,c=new Ju(o);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var m=0;a.negativeZIndex.some(function(B,p){return u>B.element.container.styles.zIndex.order?(m=p,!1):m>0}),a.negativeZIndex.splice(m,0,c)}else if(u>0){var y=0;a.positiveZIndex.some(function(B,p){return u>=B.element.container.styles.zIndex.order?(y=p+1,!1):y>0}),a.positiveZIndex.splice(y,0,c)}else a.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else i.styles.isFloating()?a.nonPositionedFloats.push(c):a.nonPositionedInlineLevel.push(c);al(o,c,n?c:A,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),al(o,e,A,l);mA(i.flags,8)&&qu(i,l)})},qu=function(r,e){for(var A=r instanceof Yo?r.start:1,t=r instanceof Yo?r.reversed:!1,i=0;i<e.length;i++){var n=e[i];n.container instanceof yu&&typeof n.container.value=="number"&&n.container.value!==0&&(A=n.container.value),n.listValue=ai(A,n.container.styles.listStyleType,!0),A+=t?-1:1}},N2=function(r){var e=new Zu(r,null),A=new Ju(e),t=[];return al(e,A,A,t),qu(e.container,t),A},Yu=function(r,e){switch(e){case 0:return XA(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return XA(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return XA(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);default:return XA(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},K2=function(r,e){switch(e){case 0:return XA(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return XA(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return XA(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);default:return XA(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},P2=function(r,e){switch(e){case 0:return XA(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return XA(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return XA(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);default:return XA(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},V2=function(r,e){switch(e){case 0:return Xn(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return Xn(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return Xn(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);default:return Xn(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},Xn=function(r,e){var A=[];return $A(r)?A.push(r.subdivide(.5,!1)):A.push(r),$A(e)?A.push(e.subdivide(.5,!0)):A.push(e),A},XA=function(r,e,A,t){var i=[];return $A(r)?i.push(r.subdivide(.5,!1)):i.push(r),$A(A)?i.push(A.subdivide(.5,!0)):i.push(A),$A(t)?i.push(t.subdivide(.5,!0).reverse()):i.push(t),$A(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},ju=function(r){var e=r.bounds,A=r.styles;return e.add(A.borderLeftWidth,A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth),-(A.borderTopWidth+A.borderBottomWidth))},Jn=function(r){var e=r.styles,A=r.bounds,t=nA(e.paddingLeft,A.width),i=nA(e.paddingRight,A.width),n=nA(e.paddingTop,A.width),s=nA(e.paddingBottom,A.width);return A.add(t+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+t+i),-(e.borderTopWidth+e.borderBottomWidth+n+s))},z2=function(r,e){return r===0?e.bounds:r===2?Jn(e):ju(e)},G2=function(r,e){return r===0?e.bounds:r===2?Jn(e):ju(e)},cl=function(r,e,A){var t=z2(Cr(r.styles.backgroundOrigin,e),r),i=G2(Cr(r.styles.backgroundClip,e),r),n=W2(Cr(r.styles.backgroundSize,e),A,t),s=n[0],o=n[1],l=ri(Cr(r.styles.backgroundPosition,e),t.width-s,t.height-o),a=R2(Cr(r.styles.backgroundRepeat,e),l,n,t,i),c=Math.round(t.left+l[0]),u=Math.round(t.top+l[1]);return[a,c,u,s,o]},wr=function(r){return AA(r)&&r.value===fr.AUTO},Zn=function(r){return typeof r=="number"},W2=function(r,e,A){var t=e[0],i=e[1],n=e[2],s=r[0],o=r[1];if(!s)return[0,0];if(gA(s)&&o&&gA(o))return[nA(s,A.width),nA(o,A.height)];var l=Zn(n);if(AA(s)&&(s.value===fr.CONTAIN||s.value===fr.COVER)){if(Zn(n)){var a=A.width/A.height;return a<n!=(s.value===fr.COVER)?[A.width,A.width/n]:[A.height*n,A.height]}return[A.width,A.height]}var c=Zn(t),u=Zn(i),m=c||u;if(wr(s)&&(!o||wr(o))){if(c&&u)return[t,i];if(!l&&!m)return[A.width,A.height];if(m&&l){var y=c?t:i*n,B=u?i:t/n;return[y,B]}var p=c?t:A.width,Q=u?i:A.height;return[p,Q]}if(l){var D=0,F=0;return gA(s)?D=nA(s,A.width):gA(o)&&(F=nA(o,A.height)),wr(s)?D=F*n:(!o||wr(o))&&(F=D/n),[D,F]}var _=null,L=null;if(gA(s)?_=nA(s,A.width):o&&gA(o)&&(L=nA(o,A.height)),_!==null&&(!o||wr(o))&&(L=c&&u?_/t*i:A.height),L!==null&&wr(s)&&(_=c&&u?L/i*t:A.width),_!==null&&L!==null)return[_,L];throw new Error("Unable to calculate background-size for element")},Cr=function(r,e){var A=r[e];return typeof A>"u"?r[0]:A},R2=function(r,e,A,t,i){var n=e[0],s=e[1],o=A[0],l=A[1];switch(r){case 2:return[new ve(Math.round(t.left),Math.round(t.top+s)),new ve(Math.round(t.left+t.width),Math.round(t.top+s)),new ve(Math.round(t.left+t.width),Math.round(l+t.top+s)),new ve(Math.round(t.left),Math.round(l+t.top+s))];case 3:return[new ve(Math.round(t.left+n),Math.round(t.top)),new ve(Math.round(t.left+n+o),Math.round(t.top)),new ve(Math.round(t.left+n+o),Math.round(t.height+t.top)),new ve(Math.round(t.left+n),Math.round(t.height+t.top))];case 1:return[new ve(Math.round(t.left+n),Math.round(t.top+s)),new ve(Math.round(t.left+n+o),Math.round(t.top+s)),new ve(Math.round(t.left+n+o),Math.round(t.top+s+l)),new ve(Math.round(t.left+n),Math.round(t.top+s+l))];default:return[new ve(Math.round(i.left),Math.round(i.top)),new ve(Math.round(i.left+i.width),Math.round(i.top)),new ve(Math.round(i.left+i.width),Math.round(i.height+i.top)),new ve(Math.round(i.left),Math.round(i.height+i.top))]}},$2="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",ed="Hidden Text",X2=(function(){function r(e){this._data={},this._document=e}return r.prototype.parseMetrics=function(e,A){var t=this._document.createElement("div"),i=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=A,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",s.appendChild(t),i.src=$2,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=A,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(ed)),t.appendChild(n),t.appendChild(i);var o=i.offsetTop-n.offsetTop+2;t.removeChild(n),t.appendChild(this._document.createTextNode(ed)),t.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-t.offsetTop+2;return s.removeChild(t),{baseline:o,middle:l}},r.prototype.getMetrics=function(e,A){var t=e+" "+A;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(e,A)),this._data[t]},r})(),Ad=(function(){function r(e,A){this.context=e,this.options=A}return r})(),J2=1e4,Z2=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i._activeEffects=[],i.canvas=t.canvas?t.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),t.canvas||(i.canvas.width=Math.floor(t.width*t.scale),i.canvas.height=Math.floor(t.height*t.scale),i.canvas.style.width=t.width+"px",i.canvas.style.height=t.height+"px"),i.fontMetrics=new X2(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-t.x,-t.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),i}return e.prototype.applyEffects=function(A){for(var t=this;this._activeEffects.length;)this.popEffect();A.forEach(function(i){return t.applyEffect(i)})},e.prototype.applyEffect=function(A){this.ctx.save(),k2(A)&&(this.ctx.globalAlpha=A.opacity),D2(A)&&(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)),$u(A)&&(this.path(A.path),this.ctx.clip()),this._activeEffects.push(A)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(A){return SA(this,void 0,void 0,function(){var t;return FA(this,function(i){switch(i.label){case 0:return t=A.element.container.styles,t.isVisible()?[4,this.renderStackContent(A)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(A){return SA(this,void 0,void 0,function(){return FA(this,function(t){switch(t.label){case 0:if(mA(A.container.flags,16))debugger;return A.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(A)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(A)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(A,t,i){var n=this;if(t===0)this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+i);else{var s=qo(A.text);s.reduce(function(o,l){return n.ctx.fillText(l,o,A.bounds.top+i),o+n.ctx.measureText(l).width},A.bounds.left)}},e.prototype.createFontStyle=function(A){var t=A.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=Av(A.fontFamily).join(", "),n=ti(A.fontSize)?""+A.fontSize.number+A.fontSize.unit:A.fontSize.number+"px";return[[A.fontStyle,t,A.fontWeight,n,i].join(" "),i,n]},e.prototype.renderTextNode=function(A,t){return SA(this,void 0,void 0,function(){var i,n,s,o,l,a,c,u,m=this;return FA(this,function(y){return i=this.createFontStyle(t),n=i[0],s=i[1],o=i[2],this.ctx.font=n,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),a=l.baseline,c=l.middle,u=t.paintOrder,A.textBounds.forEach(function(B){u.forEach(function(p){switch(p){case 0:m.ctx.fillStyle=BA(t.color),m.renderTextWithLetterSpacing(B,t.letterSpacing,a);var Q=t.textShadow;Q.length&&B.text.trim().length&&(Q.slice(0).reverse().forEach(function(D){m.ctx.shadowColor=BA(D.color),m.ctx.shadowOffsetX=D.offsetX.number*m.options.scale,m.ctx.shadowOffsetY=D.offsetY.number*m.options.scale,m.ctx.shadowBlur=D.blur.number,m.renderTextWithLetterSpacing(B,t.letterSpacing,a)}),m.ctx.shadowColor="",m.ctx.shadowOffsetX=0,m.ctx.shadowOffsetY=0,m.ctx.shadowBlur=0),t.textDecorationLine.length&&(m.ctx.fillStyle=BA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(D){switch(D){case 1:m.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top+a),B.bounds.width,1);break;case 2:m.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top),B.bounds.width,1);break;case 3:m.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&&(m.ctx.strokeStyle=BA(t.webkitTextStrokeColor),m.ctx.lineWidth=t.webkitTextStrokeWidth,m.ctx.lineJoin=window.chrome?"miter":"round",m.ctx.strokeText(B.text,B.bounds.left,B.bounds.top+a)),m.ctx.strokeStyle="",m.ctx.lineWidth=0,m.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(A,t,i){if(i&&A.intrinsicWidth>0&&A.intrinsicHeight>0){var n=Jn(A),s=Rn(t);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,A.intrinsicWidth,A.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(A){return SA(this,void 0,void 0,function(){var t,i,n,s,o,l,F,F,a,c,u,m,L,y,B,k,p,Q,D,F,_,L,k;return FA(this,function(V){switch(V.label){case 0:this.applyEffects(A.getEffects(4)),t=A.container,i=A.curves,n=t.styles,s=0,o=t.textNodes,V.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,n)]):[3,4];case 2:V.sent(),V.label=3;case 3:return s++,[3,1];case 4:if(!(t instanceof wu))return[3,8];V.label=5;case 5:return V.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return F=V.sent(),this.renderReplacedElement(t,i,F),[3,8];case 7:return V.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Cu&&this.renderReplacedElement(t,i,t.canvas),!(t instanceof vu))return[3,12];V.label=9;case 9:return V.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return F=V.sent(),this.renderReplacedElement(t,i,F),[3,12];case 11:return V.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof xu&&t.tree?(a=new e(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,a.render(t.tree)]):[3,14];case 13:c=V.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),V.label=14;case 14:if(t instanceof jo&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===On?t.checked&&(this.ctx.save(),this.path([new ve(t.bounds.left+u*.39363,t.bounds.top+u*.79),new ve(t.bounds.left+u*.16,t.bounds.top+u*.5549),new ve(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new ve(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new ve(t.bounds.left+u*.72983,t.bounds.top+u*.23),new ve(t.bounds.left+u*.84,t.bounds.top+u*.34085),new ve(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=BA(bu),this.ctx.fill(),this.ctx.restore()):t.type===Nn&&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=BA(bu),this.ctx.fill(),this.ctx.restore())),q2(t)&&t.value.length){switch(m=this.createFontStyle(n),L=m[0],y=m[1],B=this.fontMetrics.getMetrics(L,y).baseline,this.ctx.font=L,this.ctx.fillStyle=BA(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=j2(t.styles.textAlign),k=Jn(t),p=0,t.styles.textAlign){case 1:p+=k.width/2;break;case 2:p+=k.width;break}Q=k.add(p,0,0,-k.height/2+1),this.ctx.save(),this.path([new ve(k.left,k.top),new ve(k.left+k.width,k.top),new ve(k.left+k.width,k.top+k.height),new ve(k.left,k.top+k.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new oi(t.value,Q),n.letterSpacing,B),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!mA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(D=t.styles.listStyleImage,D.type!==0)return[3,18];F=void 0,_=D.url,V.label=15;case 15:return V.trys.push([15,17,,18]),[4,this.context.cache.match(_)];case 16:return F=V.sent(),this.ctx.drawImage(F,t.bounds.left-(F.width+10),t.bounds.top),[3,18];case 17:return V.sent(),this.context.logger.error("Error loading list-style-image "+_),[3,18];case 18:return[3,20];case 19:A.listValue&&t.styles.listStyleType!==-1&&(L=this.createFontStyle(n)[0],this.ctx.font=L,this.ctx.fillStyle=BA(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",k=new mt(t.bounds.left,t.bounds.top+nA(t.styles.paddingTop,t.bounds.width),t.bounds.width,eu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new oi(A.listValue,k),n.letterSpacing,eu(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),V.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(A){return SA(this,void 0,void 0,function(){var t,i,D,n,s,D,o,l,D,a,c,D,u,m,D,y,B,D,p,Q,D;return FA(this,function(F){switch(F.label){case 0:if(mA(A.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(A.element)];case 1:F.sent(),t=0,i=A.negativeZIndex,F.label=2;case 2:return t<i.length?(D=i[t],[4,this.renderStack(D)]):[3,5];case 3:F.sent(),F.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(A.element)];case 6:F.sent(),n=0,s=A.nonInlineLevel,F.label=7;case 7:return n<s.length?(D=s[n],[4,this.renderNode(D)]):[3,10];case 8:F.sent(),F.label=9;case 9:return n++,[3,7];case 10:o=0,l=A.nonPositionedFloats,F.label=11;case 11:return o<l.length?(D=l[o],[4,this.renderStack(D)]):[3,14];case 12:F.sent(),F.label=13;case 13:return o++,[3,11];case 14:a=0,c=A.nonPositionedInlineLevel,F.label=15;case 15:return a<c.length?(D=c[a],[4,this.renderStack(D)]):[3,18];case 16:F.sent(),F.label=17;case 17:return a++,[3,15];case 18:u=0,m=A.inlineLevel,F.label=19;case 19:return u<m.length?(D=m[u],[4,this.renderNode(D)]):[3,22];case 20:F.sent(),F.label=21;case 21:return u++,[3,19];case 22:y=0,B=A.zeroOrAutoZIndexOrTransformedOrOpacity,F.label=23;case 23:return y<B.length?(D=B[y],[4,this.renderStack(D)]):[3,26];case 24:F.sent(),F.label=25;case 25:return y++,[3,23];case 26:p=0,Q=A.positiveZIndex,F.label=27;case 27:return p<Q.length?(D=Q[p],[4,this.renderStack(D)]):[3,30];case 28:F.sent(),F.label=29;case 29:return p++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(A){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(A.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()},e.prototype.formatPath=function(A){var t=this;A.forEach(function(i,n){var s=$A(i)?i.start:i;n===0?t.ctx.moveTo(s.x,s.y):t.ctx.lineTo(s.x,s.y),$A(i)&&t.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(A,t,i,n){this.path(A),this.ctx.fillStyle=t,this.ctx.translate(i,n),this.ctx.fill(),this.ctx.translate(-i,-n)},e.prototype.resizeImage=function(A,t,i){var n;if(A.width===t&&A.height===i)return A;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,t),o.height=Math.max(1,i);var l=o.getContext("2d");return l.drawImage(A,0,0,A.width,A.height,0,0,t,i),o},e.prototype.renderBackgroundImage=function(A){return SA(this,void 0,void 0,function(){var t,i,n,s,o,l;return FA(this,function(a){switch(a.label){case 0:t=A.styles.backgroundImage.length-1,i=function(c){var u,m,y,R,Qe,xe,ae,ye,$,B,R,Qe,xe,ae,ye,p,Q,D,F,_,L,k,V,Z,$,z,R,X,se,ae,ye,Le,Qe,xe,Se,pe,Be,Ce,Fe,be,le,qe;return FA(this,function(Ie){switch(Ie.label){case 0:if(c.type!==0)return[3,5];u=void 0,m=c.url,Ie.label=1;case 1:return Ie.trys.push([1,3,,4]),[4,n.context.cache.match(m)];case 2:return u=Ie.sent(),[3,4];case 3:return Ie.sent(),n.context.logger.error("Error loading background-image "+m),[3,4];case 4:return u&&(y=cl(A,t,[u.width,u.height,u.width/u.height]),R=y[0],Qe=y[1],xe=y[2],ae=y[3],ye=y[4],$=n.ctx.createPattern(n.resizeImage(u,ae,ye),"repeat"),n.renderRepeat(R,$,Qe,xe)),[3,6];case 5:DB(c)?(B=cl(A,t,[null,null,null]),R=B[0],Qe=B[1],xe=B[2],ae=B[3],ye=B[4],p=HB(c.angle,ae,ye),Q=p[0],D=p[1],F=p[2],_=p[3],L=p[4],k=document.createElement("canvas"),k.width=ae,k.height=ye,V=k.getContext("2d"),Z=V.createLinearGradient(D,_,F,L),zh(c.stops,Q).forEach(function(we){return Z.addColorStop(we.stop,BA(we.color))}),V.fillStyle=Z,V.fillRect(0,0,ae,ye),ae>0&&ye>0&&($=n.ctx.createPattern(k,"repeat"),n.renderRepeat(R,$,Qe,xe))):kB(c)&&(z=cl(A,t,[null,null,null]),R=z[0],X=z[1],se=z[2],ae=z[3],ye=z[4],Le=c.position.length===0?[Do]:c.position,Qe=nA(Le[0],ae),xe=nA(Le[Le.length-1],ye),Se=LB(c,Qe,xe,ae,ye),pe=Se[0],Be=Se[1],pe>0&&Be>0&&(Ce=n.ctx.createRadialGradient(X+Qe,se+xe,0,X+Qe,se+xe,pe),zh(c.stops,pe*2).forEach(function(we){return Ce.addColorStop(we.stop,BA(we.color))}),n.path(R),n.ctx.fillStyle=Ce,pe!==Be?(Fe=A.bounds.left+.5*A.bounds.width,be=A.bounds.top+.5*A.bounds.height,le=Be/pe,qe=1/le,n.ctx.save(),n.ctx.translate(Fe,be),n.ctx.transform(1,0,0,le,0,0),n.ctx.translate(-Fe,-be),n.ctx.fillRect(X,qe*(se-be)+be,ae,ye*qe),n.ctx.restore()):n.ctx.fill())),Ie.label=6;case 6:return t--,[2]}})},n=this,s=0,o=A.styles.backgroundImage.slice(0).reverse(),a.label=1;case 1:return s<o.length?(l=o[s],[5,i(l)]):[3,4];case 2:a.sent(),a.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(A,t,i){return SA(this,void 0,void 0,function(){return FA(this,function(n){return this.path(Yu(i,t)),this.ctx.fillStyle=BA(A),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(A,t,i,n){return SA(this,void 0,void 0,function(){var s,o;return FA(this,function(l){switch(l.label){case 0:return t<3?[4,this.renderSolidBorder(A,i,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=K2(n,i),this.path(s),this.ctx.fillStyle=BA(A),this.ctx.fill(),o=P2(n,i),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(A){return SA(this,void 0,void 0,function(){var t,i,n,s,o,l,a,c,u=this;return FA(this,function(m){switch(m.label){case 0:return this.applyEffects(A.getEffects(2)),t=A.container.styles,i=!Et(t.backgroundColor)||t.backgroundImage.length,n=[{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}],s=Y2(Cr(t.backgroundClip,0),A.curves),i||t.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),Et(t.backgroundColor)||(this.ctx.fillStyle=BA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(A.container)]):[3,2];case 1:m.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(y){u.ctx.save();var B=Wn(A.curves),p=y.inset?0:J2,Q=O2(B,-p+(y.inset?1:-1)*y.spread.number,(y.inset?1:-1)*y.spread.number,y.spread.number*(y.inset?-2:2),y.spread.number*(y.inset?-2:2));y.inset?(u.path(B),u.ctx.clip(),u.mask(Q)):(u.mask(B),u.ctx.clip(),u.path(Q)),u.ctx.shadowOffsetX=y.offsetX.number+p,u.ctx.shadowOffsetY=y.offsetY.number,u.ctx.shadowColor=BA(y.color),u.ctx.shadowBlur=y.blur.number,u.ctx.fillStyle=y.inset?BA(y.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),m.label=2;case 2:o=0,l=0,a=n,m.label=3;case 3:return l<a.length?(c=a[l],c.style!==0&&!Et(c.color)&&c.width>0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,o,A.curves,2)]:[3,11]):[3,13];case 4:return m.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,o,A.curves,3)];case 6:return m.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,o,A.curves)];case 8:return m.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,o,A.curves)];case 10:m.sent(),m.label=11;case 11:o++,m.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(A,t,i,n,s){return SA(this,void 0,void 0,function(){var o,l,a,c,u,m,y,B,p,Q,D,F,_,L,k,V,k,V;return FA(this,function(Z){return this.ctx.save(),o=V2(n,i),l=Yu(n,i),s===2&&(this.path(l),this.ctx.clip()),$A(l[0])?(a=l[0].start.x,c=l[0].start.y):(a=l[0].x,c=l[0].y),$A(l[1])?(u=l[1].end.x,m=l[1].end.y):(u=l[1].x,m=l[1].y),i===0||i===2?y=Math.abs(a-u):y=Math.abs(c-m),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),B=t<3?t*3:t*2,p=t<3?t*2:t,s===3&&(B=t,p=t),Q=!0,y<=B*2?Q=!1:y<=B*2+p?(D=y/(2*B+p),B*=D,p*=D):(F=Math.floor((y+p)/(B+p)),_=(y-F*B)/(F-1),L=(y-(F+1)*B)/F,p=L<=0||Math.abs(p-_)<Math.abs(p-L)?_:L),Q&&(s===3?this.ctx.setLineDash([0,B+p]):this.ctx.setLineDash([B,p])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=BA(A),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&($A(l[0])&&(k=l[3],V=l[0],this.ctx.beginPath(),this.formatPath([new ve(k.end.x,k.end.y),new ve(V.start.x,V.start.y)]),this.ctx.stroke()),$A(l[1])&&(k=l[1],V=l[2],this.ctx.beginPath(),this.formatPath([new ve(k.end.x,k.end.y),new ve(V.start.x,V.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(A){return SA(this,void 0,void 0,function(){var t;return FA(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=BA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=N2(A),[4,this.renderStack(t)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Ad),q2=function(r){return r instanceof Qu||r instanceof Tu?!0:r instanceof jo&&r.type!==Nn&&r.type!==On},Y2=function(r,e){switch(r){case 0:return Wn(e);case 2:return M2(e);default:return Rn(e)}},j2=function(r){switch(r){case 1:return"center";case 2:return"right";default:return"left"}},ev=["-apple-system","system-ui"],Av=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(e){return ev.indexOf(e)===-1}):r},tv=(function(r){jA(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.canvas=t.canvas?t.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=t,i.canvas.width=Math.floor(t.width*t.scale),i.canvas.height=Math.floor(t.height*t.scale),i.canvas.style.width=t.width+"px",i.canvas.style.height=t.height+"px",i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-t.x,-t.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),i}return e.prototype.render=function(A){return SA(this,void 0,void 0,function(){var t,i;return FA(this,function(n){switch(n.label){case 0:return t=Zo(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,A),[4,rv(t)];case 1:return i=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=BA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(Ad),rv=function(r){return new Promise(function(e,A){var t=new Image;t.onload=function(){e(t)},t.onerror=A,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},iv=(function(){function r(e){var A=e.id,t=e.enabled;this.id=A,this.enabled=t,this.start=Date.now()}return r.prototype.debug=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,rn([this.id,this.getTime()+"ms"],e))},r.prototype.warn=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.prototype.error=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.instances={},r})(),nv=(function(){function r(e,A){var t;this.windowBounds=A,this.instanceName="#"+r.instanceCount++,this.logger=new iv({id:this.instanceName,enabled:e.logging}),this.cache=(t=e.cache)!==null&&t!==void 0?t:new Q2(this,e)}return r.instanceCount=1,r})(),sv=function(r,e){return e===void 0&&(e={}),ov(r,e)};typeof window<"u"&&Ru.setContext(window);var ov=function(r,e){return SA(void 0,void 0,void 0,function(){var A,t,i,n,s,o,l,a,c,u,m,y,B,p,Q,D,F,_,L,k,Z,V,Z,$,z,R,X,se,ae,ye,Le,Qe,xe,Se,pe,Be,Ce,Fe,be,le;return FA(this,function(qe){switch(qe.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(A=r.ownerDocument,!A)throw new Error("Element is not attached to a Document");if(t=A.defaultView,!t)throw new Error("Document is not attached to a Window");return i={allowTaint:($=e.allowTaint)!==null&&$!==void 0?$:!1,imageTimeout:(z=e.imageTimeout)!==null&&z!==void 0?z:15e3,proxy:e.proxy,useCORS:(R=e.useCORS)!==null&&R!==void 0?R:!1},n=po({logging:(X=e.logging)!==null&&X!==void 0?X:!0,cache:e.cache},i),s={windowWidth:(se=e.windowWidth)!==null&&se!==void 0?se:t.innerWidth,windowHeight:(ae=e.windowHeight)!==null&&ae!==void 0?ae:t.innerHeight,scrollX:(ye=e.scrollX)!==null&&ye!==void 0?ye:t.pageXOffset,scrollY:(Le=e.scrollY)!==null&&Le!==void 0?Le:t.pageYOffset},o=new mt(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new nv(n,o),a=(Qe=e.foreignObjectRendering)!==null&&Qe!==void 0?Qe:!1,c={allowTaint:(xe=e.allowTaint)!==null&&xe!==void 0?xe:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:a,copyStyles:a},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),u=new Gu(l,r,c),m=u.clonedReferenceElement,m?[4,u.toIFrame(A,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return y=qe.sent(),B=Al(m)||l2(m)?Og(m.ownerDocument):nn(l,m),p=B.width,Q=B.height,D=B.left,F=B.top,_=lv(l,m,e.backgroundColor),L={canvas:e.canvas,backgroundColor:_,scale:(pe=(Se=e.scale)!==null&&Se!==void 0?Se:t.devicePixelRatio)!==null&&pe!==void 0?pe:1,x:((Be=e.x)!==null&&Be!==void 0?Be:0)+D,y:((Ce=e.y)!==null&&Ce!==void 0?Ce:0)+F,width:(Fe=e.width)!==null&&Fe!==void 0?Fe:Math.ceil(p),height:(be=e.height)!==null&&be!==void 0?be:Math.ceil(Q)},a?(l.logger.debug("Document cloned, using foreign object rendering"),Z=new tv(l,L),[4,Z.render(m)]):[3,3];case 2:return k=qe.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+D+","+F+" with size "+p+"x"+Q+" using computed rendering"),l.logger.debug("Starting DOM parsing"),V=Uu(l,m),_===V.styles.backgroundColor&&(V.styles.backgroundColor=wt.TRANSPARENT),l.logger.debug("Starting renderer for element at "+L.x+","+L.y+" with size "+L.width+"x"+L.height),Z=new Z2(l,L),[4,Z.render(V)];case 4:k=qe.sent(),qe.label=5;case 5:return(!((le=e.removeContainer)!==null&&le!==void 0)||le)&&(Gu.destroy(y)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,k]}})})},lv=function(r,e,A){var t=e.ownerDocument,i=t.documentElement?ii(r,getComputedStyle(t.documentElement).backgroundColor):wt.TRANSPARENT,n=t.body?ii(r,getComputedStyle(t.body).backgroundColor):wt.TRANSPARENT,s=typeof A=="string"?ii(r,A):A===null?wt.TRANSPARENT:4294967295;return e===t.documentElement?Et(i)?Et(n)?s:n:i:s};const av={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class cv{constructor(e,A,t="#3b82f6",i=2){this.price=e,this.originTime=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=o.context,a=n._chart,c=n._series;if(!a||!c)return;const u=c.priceToCoordinate(n.price);if(u==null)return;const m=Math.round(u*o.verticalPixelRatio),y=a.timeScale().timeToCoordinate(n.originTime),B=y==null?0:Math.max(0,Math.round(y*o.horizontalPixelRatio)),p=o.bitmapSize.width;if(B>=p)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(B,m),l.lineTo(p,m),l.stroke(),l.beginPath(),l.fillStyle=n.color;const Q=3*o.verticalPixelRatio;l.arc(B,m,Q,0,Math.PI*2),l.fill(),l.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hv{constructor(e,A,t,i="#3b82f6",n=2){this.p1=e,this.p2=A,this.info=t,this.color=i,this.lineWidth=n,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const a=s._chart,c=s._series;if(!a||!c)return;const u=l.horizontalPixelRatio,m=l.verticalPixelRatio,y=a.timeScale().timeToCoordinate(s.p1.rawTime),B=a.timeScale().timeToCoordinate(s.p2.rawTime),p=c.priceToCoordinate(s.p1.price),Q=c.priceToCoordinate(s.p2.price);if(y==null||B==null||p==null||Q==null)return;const D=Math.round(y*u),F=Math.round(p*m),_=Math.round(B*u),L=Math.round(Q*m),k=l.context;k.save(),k.beginPath(),k.strokeStyle=s.color,k.lineWidth=s.lineWidth*m,k.setLineDash([]),k.moveTo(D,F),k.lineTo(_,L),k.stroke(),k.beginPath(),k.fillStyle=s.color,k.arc(D,F,3*m,0,Math.PI*2),k.fill(),k.beginPath(),k.arc(_,L,3*m,0,Math.PI*2),k.fill();const{priceDiff:V,pricePct:Z,bars:$,days:z,angle:R}=s.info,X=V>=0?"+":"",se=[`${X}${V.toFixed(5)} (${X}${Z.toFixed(2)}%)`,`${$} bars (${z} days)`,`∠ ${R.toFixed(1)}°`],ae=Math.round(11*m);k.font=`${ae}px sans-serif`;const ye=ae*1.6,Le=8*m,Qe=Math.max(...se.map(qe=>k.measureText(qe).width))+Le*2,xe=se.length*ye+Le*2,Se=_+10*u,pe=L-xe-4*m,Be=l.bitmapSize.width,Ce=l.bitmapSize.height,Fe=Math.min(Math.max(0,Se),Be-Qe-4*u),be=Math.min(Math.max(4*m,pe),Ce-xe-4*m),le=4*m;k.beginPath(),k.moveTo(Fe+le,be),k.lineTo(Fe+Qe-le,be),k.quadraticCurveTo(Fe+Qe,be,Fe+Qe,be+le),k.lineTo(Fe+Qe,be+xe-le),k.quadraticCurveTo(Fe+Qe,be+xe,Fe+Qe-le,be+xe),k.lineTo(Fe+le,be+xe),k.quadraticCurveTo(Fe,be+xe,Fe,be+xe-le),k.lineTo(Fe,be+le),k.quadraticCurveTo(Fe,be,Fe+le,be),k.closePath(),k.fillStyle="rgba(30, 41, 59, 0.92)",k.fill(),k.strokeStyle=s.color,k.lineWidth=1*m,k.stroke(),k.fillStyle="#e2e8f0",k.textAlign="left",se.forEach((qe,Ie)=>{k.fillText(qe,Fe+Le,be+Le+ae+Ie*ye)}),k.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class td{constructor(e,A,t){this.p1=e,this.p2=A,this.info=t,this.visible=!0,this._chart=null,this._series=null;const i=A.price>=e.price;this.color=i?"#3b82f6":"#ef5350",this.fillColor=i?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,a=n._series;if(!l||!a)return;const c=o.horizontalPixelRatio,u=o.verticalPixelRatio,m=l.timeScale().timeToCoordinate(n.p1.rawTime),y=l.timeScale().timeToCoordinate(n.p2.rawTime),B=a.priceToCoordinate(n.p1.price),p=a.priceToCoordinate(n.p2.price);if(m==null||y==null||B==null||p==null)return;const Q=Math.round(m*c),D=Math.round(B*u),F=Math.round(y*c),_=Math.round(p*u),L=o.context;L.save(),L.fillStyle=n.fillColor,L.fillRect(Math.min(Q,F),Math.min(D,_),Math.abs(F-Q),Math.abs(_-D)),L.strokeStyle=n.color,L.lineWidth=1*u,L.setLineDash([]),L.strokeRect(Math.min(Q,F),Math.min(D,_),Math.abs(F-Q),Math.abs(_-D)),L.beginPath(),L.strokeStyle=n.color,L.lineWidth=2*u,L.moveTo(Q,D),L.lineTo(F,_),L.stroke(),L.fillStyle=n.color,L.beginPath(),L.arc(Q,D,3*u,0,Math.PI*2),L.fill(),L.beginPath(),L.arc(F,_,3*u,0,Math.PI*2),L.fill();const{priceDiff:k,pricePct:V,bars:Z,days:$}=n.info,z=k>=0?"+":"",R=[`${z}${k.toFixed(5)} (${z}${V.toFixed(2)}%)`,`${Z} bars (${$} days)`],X=Math.round(11*u);L.font=`${X}px sans-serif`;const se=X*1.6,ae=8*u,ye=Math.max(...R.map(be=>L.measureText(be).width))+ae*2,Le=R.length*se+ae*2,Qe=o.bitmapSize.width,xe=o.bitmapSize.height,Se=F+10*c,pe=_-Le-4*u,Be=Math.min(Math.max(0,Se),Qe-ye-4*c),Ce=Math.min(Math.max(4*u,pe),xe-Le-4*u),Fe=4*u;L.beginPath(),L.moveTo(Be+Fe,Ce),L.lineTo(Be+ye-Fe,Ce),L.quadraticCurveTo(Be+ye,Ce,Be+ye,Ce+Fe),L.lineTo(Be+ye,Ce+Le-Fe),L.quadraticCurveTo(Be+ye,Ce+Le,Be+ye-Fe,Ce+Le),L.lineTo(Be+Fe,Ce+Le),L.quadraticCurveTo(Be,Ce+Le,Be,Ce+Le-Fe),L.lineTo(Be,Ce+Fe),L.quadraticCurveTo(Be,Ce,Be+Fe,Ce),L.closePath(),L.fillStyle="rgba(30, 41, 59, 0.92)",L.fill(),L.strokeStyle=n.color,L.lineWidth=1*u,L.stroke(),L.fillStyle="#e2e8f0",L.textAlign="left",R.forEach((be,le)=>{L.fillText(be,Be+ae,Ce+ae+X+le*se)}),L.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class uv{constructor(e,A,t={}){this.p1=e,this.p2=A,this.visible=!0,this.strokeColor=t.strokeColor??"#7aa6ae",this.fillColor=t.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=t.lineWidth??1,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,l=i._series;if(!o||!l)return;const a=s.horizontalPixelRatio,c=s.verticalPixelRatio,u=o.timeScale().timeToCoordinate(i.p1.rawTime),m=o.timeScale().timeToCoordinate(i.p2.rawTime),y=l.priceToCoordinate(i.p1.price),B=l.priceToCoordinate(i.p2.price);if(u==null||m==null||y==null||B==null)return;const p=Math.min(u,m)*a,Q=Math.max(u,m)*a,D=Math.min(y,B)*c,F=Math.max(y,B)*c,_=Q-p,L=F-D;if(_<.5||L<.5)return;const k=s.context;k.save(),k.fillStyle=i.fillColor,k.fillRect(p,D,_,L),k.strokeStyle=i.strokeColor,k.lineWidth=i.lineWidth*c,k.setLineDash([]),k.strokeRect(p,D,_,L),k.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class dv{constructor(e,A,t={}){this.p1=e,this.p2=A,this.visible=!0,this.strokeColor=t.strokeColor??"#7aa6ae",this.lineWidth=t.lineWidth??1,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,l=i._series;if(!o||!l)return;const a=s.horizontalPixelRatio,c=s.verticalPixelRatio,u=o.timeScale().timeToCoordinate(i.p1.rawTime),m=l.priceToCoordinate(i.p1.price),y=o.timeScale().timeToCoordinate(i.p2.rawTime),B=l.priceToCoordinate(i.p2.price);if(u==null||m==null||y==null||B==null)return;const p=u*a,Q=m*c,D=y*a,F=B*c,_=Math.hypot(D-p,F-Q);if(_<.5)return;const L=s.context;L.save(),L.strokeStyle=i.strokeColor,L.lineWidth=i.lineWidth*c,L.setLineDash([]),L.beginPath(),L.arc(p,Q,_,0,Math.PI*2),L.stroke(),L.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class fv{constructor(e,A,t,i={}){this.p1=e,this.p2=A,this.p3=t,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.fillColor=i.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,a=n._series;if(!l||!a)return;const c=o.horizontalPixelRatio,u=o.verticalPixelRatio,m=l.timeScale().timeToCoordinate(n.p1.rawTime),y=a.priceToCoordinate(n.p1.price),B=l.timeScale().timeToCoordinate(n.p2.rawTime),p=a.priceToCoordinate(n.p2.price),Q=l.timeScale().timeToCoordinate(n.p3.rawTime),D=a.priceToCoordinate(n.p3.price);if(m==null||y==null||B==null||p==null||Q==null||D==null)return;const F=m*c,_=y*u,L=B*c,k=p*u,V=Q*c,Z=D*u,$=o.context;$.save(),$.beginPath(),$.moveTo(F,_),$.lineTo(L,k),$.lineTo(V,Z),$.closePath(),$.fillStyle=n.fillColor,$.fill(),$.strokeStyle=n.strokeColor,$.lineWidth=n.lineWidth*u,$.setLineDash([]),$.stroke(),$.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class pv{constructor(e,A,t={}){this.p1=e,this.p2=A,this.minorRatio=t.minorRatio??.45,this.previewAsLine=t.previewAsLine??!1,this.visible=!0,this.strokeColor=t.strokeColor??"#7aa6ae",this.lineWidth=t.lineWidth??1,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,l=i._series;if(!o||!l)return;const a=s.horizontalPixelRatio,c=s.verticalPixelRatio,u=o.timeScale().timeToCoordinate(i.p1.rawTime),m=l.priceToCoordinate(i.p1.price),y=o.timeScale().timeToCoordinate(i.p2.rawTime),B=l.priceToCoordinate(i.p2.price);if(u==null||m==null||y==null||B==null)return;const p=u*a,Q=m*c,D=y*a,F=B*c,_=D-p,L=F-Q,k=Math.hypot(_,L);if(k<.5)return;const V=s.context;if(V.save(),V.strokeStyle=i.strokeColor,V.lineWidth=i.lineWidth*c,V.setLineDash([]),i.previewAsLine)V.beginPath(),V.moveTo(p,Q),V.lineTo(D,F),V.stroke();else{const Z=(p+D)/2,$=(Q+F)/2,z=Math.atan2(L,_),R=k/2,X=Math.max(1,R*Math.max(.05,i.minorRatio));V.beginPath(),V.ellipse(Z,$,R,X,z,0,Math.PI*2),V.stroke()}V.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class rd{constructor(e,A,t="#f59e0b",i=2){this.p1=e,this.p2=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,a=n._series;if(!l||!a)return;const c=o.horizontalPixelRatio,u=o.verticalPixelRatio,m=l.timeScale().timeToCoordinate(n.p1.rawTime),y=l.timeScale().timeToCoordinate(n.p2.rawTime),B=a.priceToCoordinate(n.p1.price),p=a.priceToCoordinate(n.p2.price);if(m==null||y==null||B==null||p==null)return;const Q=Math.round(m*c),D=Math.round(B*u),F=Math.round(y*c),_=Math.round(p*u),L=o.context;L.save(),L.beginPath(),L.strokeStyle=n.color,L.lineWidth=n.lineWidth*u,L.setLineDash([]),L.moveTo(Q,D),L.lineTo(F,_),L.stroke();const k=Math.atan2(_-D,F-Q),V=11*u,Z=Math.PI/7,$=F-V*Math.cos(k-Z),z=_-V*Math.sin(k-Z),R=F-V*Math.cos(k+Z),X=_-V*Math.sin(k+Z);L.beginPath(),L.fillStyle=n.color,L.moveTo(F,_),L.lineTo($,z),L.lineTo(R,X),L.closePath(),L.fill(),L.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class gv{constructor(e,A,t="#7aa6ae",i=2){this.p1=e,this.p2=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,a=n._series;if(!l||!a)return;const c=o.horizontalPixelRatio,u=o.verticalPixelRatio,m=l.timeScale().timeToCoordinate(n.p1.rawTime),y=l.timeScale().timeToCoordinate(n.p2.rawTime),B=a.priceToCoordinate(n.p1.price),p=a.priceToCoordinate(n.p2.price);if(m==null||y==null||B==null||p==null)return;const Q=m*c,D=B*u;let F=y-m,_=p-B;F<0&&(F=-F,_=-_),Math.abs(F)<1e-4&&(F=1e-4);const L=_*u/(F*c),k=Math.max(0,Q),V=D+L*(k-Q),Z=o.bitmapSize.width,$=D+L*(Z-Q),z=o.context;z.save(),z.beginPath(),z.strokeStyle=n.color,z.lineWidth=n.lineWidth*u,z.setLineDash([]),z.moveTo(k,V),z.lineTo(Z,$),z.stroke(),z.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class mv{constructor(e,A,t="#7aa6ae",i=2){this.p1=e,this.p2=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,a=n._series;if(!l||!a)return;const c=o.horizontalPixelRatio,u=o.verticalPixelRatio,m=l.timeScale().timeToCoordinate(n.p1.rawTime),y=l.timeScale().timeToCoordinate(n.p2.rawTime),B=a.priceToCoordinate(n.p1.price),p=a.priceToCoordinate(n.p2.price);if(m==null||y==null||B==null||p==null)return;const Q=m*c,D=B*u;let F=y-m,_=p-B;Math.abs(F)<1e-4&&(F=1e-4);const L=_*u/(F*c),k=0,V=D+L*(k-Q),Z=o.bitmapSize.width,$=D+L*(Z-Q),z=o.context;z.save(),z.beginPath(),z.strokeStyle=n.color,z.lineWidth=n.lineWidth*u,z.setLineDash([]),z.moveTo(k,V),z.lineTo(Z,$),z.stroke(),z.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Bv{constructor(e,A="#7aa6ae",t=2){this.center=e,this.color=A,this.lineWidth=t,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,l=i._series;if(!o||!l)return;const a=s.horizontalPixelRatio,c=s.verticalPixelRatio,u=o.timeScale().timeToCoordinate(i.center.rawTime),m=l.priceToCoordinate(i.center.price);if(u==null||m==null)return;const y=Math.round(u*a),B=Math.round(m*c),p=s.bitmapSize.width,Q=s.bitmapSize.height,D=s.context;D.save(),D.strokeStyle=i.color,D.lineWidth=i.lineWidth*c,D.setLineDash([]),D.beginPath(),D.moveTo(0,B),D.lineTo(p,B),D.stroke(),D.beginPath(),D.moveTo(y,0),D.lineTo(y,Q),D.stroke(),D.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class wv{constructor(e,A,t="#7aa6ae",i=2){this.p1=e,this.p2=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const l=n._chart,a=n._series;if(!l||!a)return;const c=o.horizontalPixelRatio,u=o.verticalPixelRatio,m=l.timeScale().timeToCoordinate(n.p1.rawTime),y=l.timeScale().timeToCoordinate(n.p2.rawTime),B=a.priceToCoordinate(n.p1.price),p=a.priceToCoordinate(n.p2.price);if(m==null||y==null||B==null||p==null)return;const Q=m*c,D=B*u,F=y*c,_=p*u,L=Q-F,k=D-_;if(Math.hypot(L,k)<1e-4)return;const Z=Math.atan2(k,L),$=Math.round(Math.abs(Z*180/Math.PI)),z=o.context;z.save(),z.strokeStyle=n.color,z.lineWidth=n.lineWidth*u,z.setLineDash([]),z.beginPath(),z.moveTo(Q,D),z.lineTo(F,_),z.stroke();const R=28*u;z.beginPath(),z.lineWidth=1*u,z.strokeStyle="rgba(122,166,174,0.55)",z.moveTo(F,_),z.lineTo(F+R,_),z.stroke(),z.beginPath(),z.strokeStyle="rgba(122,166,174,0.45)",z.arc(F,_,R,0,Z,Z<0),z.stroke(),z.fillStyle="#4b7c86",z.font=`${Math.round(10*u)}px sans-serif`,z.textAlign="left",z.textBaseline="middle";const X=F+(R+10*u)*Math.cos(Z/2),se=_+(R+10*u)*Math.sin(Z/2);z.fillText(`${$}°`,X,se),z.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Cv{constructor(e,A,t){this.p1=e,this.p2=A,this.p3=t,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,l=i._series;if(!o||!l)return;const a=s.horizontalPixelRatio,c=s.verticalPixelRatio,u=s.context,m=o.timeScale().timeToCoordinate(i.p1.rawTime),y=l.priceToCoordinate(i.p1.price),B=o.timeScale().timeToCoordinate(i.p2.rawTime),p=l.priceToCoordinate(i.p2.price),Q=o.timeScale().timeToCoordinate(i.p3.rawTime),D=l.priceToCoordinate(i.p3.price);if(m==null||y==null||B==null||p==null||Q==null||D==null)return;const F=m*a,_=y*c,L=B*a,k=p*c,V=Q*a,Z=D*c,$=(L+V)/2,z=(k+Z)/2;let R=$-F,X=z-_;Math.abs(R)<1e-4&&(R=1e-4);const se=X/R,ae=s.bitmapSize.width,ye=(L-V)/2,Le=(k-Z)/2,Qe=be=>({x:$+ye*be,y:z+Le*be}),xe=(be,le)=>({x:ae,y:le+se*(ae-be)}),Se=Qe(1),pe=Qe(-1),Be=xe(Se.x,Se.y),Ce=xe(pe.x,pe.y);u.save(),u.beginPath(),u.moveTo(Se.x,Se.y),u.lineTo(Be.x,Be.y),u.lineTo(Ce.x,Ce.y),u.lineTo(pe.x,pe.y),u.closePath(),u.fillStyle="rgba(148, 163, 184, 0.2)",u.fill(),u.beginPath(),u.strokeStyle="rgba(148, 163, 184, 0.9)",u.lineWidth=1*c,u.moveTo(L,k),u.lineTo(V,Z),u.stroke(),i._levels.forEach(be=>{const le=Qe(be.k),qe=xe(le.x,le.y);u.beginPath(),u.strokeStyle=be.color,u.lineWidth=be.width*c,u.moveTo(le.x,le.y),u.lineTo(qe.x,qe.y),u.stroke()});const Fe=xe(F,_);u.beginPath(),u.strokeStyle="rgba(161, 98, 7, 0.9)",u.lineWidth=1.1*c,u.moveTo(F,_),u.lineTo(Fe.x,Fe.y),u.stroke(),u.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class vv{constructor(e,A){this.p1=e,this.p2=A,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const t=this;this._paneView={renderer(){return{draw(i){i.useBitmapCoordinateSpace(n=>{if(!t.visible)return;const s=t._chart,o=t._series;if(!s||!o)return;const l=n.horizontalPixelRatio,a=n.verticalPixelRatio,c=n.context,u=s.timeScale().timeToCoordinate(t.p1.rawTime),m=o.priceToCoordinate(t.p1.price),y=s.timeScale().timeToCoordinate(t.p2.rawTime),B=o.priceToCoordinate(t.p2.price);if(u==null||m==null||y==null||B==null)return;const p=u*l,Q=m*a,D=y*l,F=B*a,_=n.bitmapSize.width,L=Math.abs(D-p)<1e-4?1:D-p,k=(F-Q)/L,V=D>=p?1:-1,Z=V>0?_:0,$=p+V*Math.min(220*l,Math.max(80*l,_*.35)),z=t._rays.map(X=>{const se=k*X.ratio;return{...X,yEnd:Q+se*(Z-p),yLabel:Q+se*($-p)}});c.save();const R=(X,se,ae)=>{!X||!se||(c.beginPath(),c.moveTo(p,Q),c.lineTo(Z,X.yEnd),c.lineTo(Z,se.yEnd),c.closePath(),c.fillStyle=ae,c.fill())};R(z[0],z[3],"rgba(161, 98, 7, 0.10)"),R(z[3],z[4],"rgba(5, 150, 105, 0.10)"),R(z[4],z[5],"rgba(107, 114, 128, 0.12)"),z.forEach(X=>{c.beginPath(),c.strokeStyle=X.color,c.lineWidth=1*a,c.moveTo(p,Q),c.lineTo(Z,X.yEnd),c.stroke()}),c.font=`${Math.max(10,Math.round(10*a))}px sans-serif`,c.textAlign=V>0?"left":"right",c.textBaseline="middle",z.forEach(X=>{c.fillStyle=X.color;const se=$+(V>0?4*l:-4*l),ae=X.yLabel;ae<-20||ae>n.bitmapSize.height+20||c.fillText(X.label,se,ae)}),c.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class yv{constructor(e,A,t=8){this.p1=e,this.p2=A,this.divisions=Math.max(2,t),this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,l=i._series;if(!o||!l)return;const a=s.horizontalPixelRatio,c=s.verticalPixelRatio,u=s.context,m=o.timeScale().timeToCoordinate(i.p1.rawTime),y=l.priceToCoordinate(i.p1.price),B=o.timeScale().timeToCoordinate(i.p2.rawTime),p=l.priceToCoordinate(i.p2.price);if(m==null||y==null||B==null||p==null)return;const Q=m*a,D=y*c,F=B*a,_=p*c,L=F-Q,k=_-D,V=Math.hypot(L,k);if(V<1e-4)return;const Z=L/V,$=k/V,z=-$,R=Z,X=F+z*V,se=_+R*V,ae=Q+z*V,ye=D+R*V,Le=(xe,Se)=>({x:Q+Z*V*xe+z*V*Se,y:D+$*V*xe+R*V*Se});u.save();const Qe=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let xe=0;xe<i.divisions;xe++){const Se=xe/i.divisions,pe=(xe+1)/i.divisions,Be=Le(0,Se),Ce=Le(1,Se),Fe=Le(1,pe),be=Le(0,pe);u.beginPath(),u.moveTo(Be.x,Be.y),u.lineTo(Ce.x,Ce.y),u.lineTo(Fe.x,Fe.y),u.lineTo(be.x,be.y),u.closePath(),u.fillStyle=Qe[xe%Qe.length],u.fill()}u.lineWidth=1*c,u.strokeStyle="rgba(148, 163, 184, 0.55)";for(let xe=0;xe<=i.divisions;xe++){const Se=xe/i.divisions,pe=Le(0,Se),Be=Le(1,Se),Ce=Le(Se,0),Fe=Le(Se,1);u.beginPath(),u.moveTo(pe.x,pe.y),u.lineTo(Be.x,Be.y),u.stroke(),u.beginPath(),u.moveTo(Ce.x,Ce.y),u.lineTo(Fe.x,Fe.y),u.stroke()}u.strokeStyle="rgba(100, 116, 139, 0.85)",u.lineWidth=1*c,u.beginPath(),u.moveTo(Q,D),u.lineTo(X,se),u.stroke(),u.beginPath(),u.moveTo(F,_),u.lineTo(ae,ye),u.stroke(),u.strokeStyle="rgba(122, 166, 174, 0.95)",u.lineWidth=1.2*c,u.beginPath(),u.moveTo(Q,D),u.lineTo(F,_),u.lineTo(X,se),u.lineTo(ae,ye),u.closePath(),u.stroke(),u.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hl{constructor(e,A,t,i,n="#16a34a",s=2,o="rgba(22, 163, 74, 0.12)"){this.p1=e,this.p2=A,this.p3=t,this.p4=i,this.color=n,this.lineWidth=s,this.fillColor=o,this.visible=!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(a){a.useBitmapCoordinateSpace(c=>{if(!l.visible)return;const u=l._chart,m=l._series;if(!u||!m)return;const y=c.horizontalPixelRatio,B=c.verticalPixelRatio,p=[l.p1,l.p3,l.p4,l.p2].map(Z=>{const $=u.timeScale().timeToCoordinate(Z.rawTime),z=m.priceToCoordinate(Z.price);return $==null||z==null?null:{x:$*y,y:z*B}}).filter(Boolean);if(p.length!==4)return;const[Q,D,F,_]=p,L=c.context;L.save(),L.beginPath(),L.moveTo(Q.x,Q.y),L.lineTo(D.x,D.y),L.lineTo(F.x,F.y),L.lineTo(_.x,_.y),L.closePath(),L.fillStyle=l.fillColor,L.fill(),L.strokeStyle=l.color,L.lineWidth=l.lineWidth*B,L.setLineDash([]),L.beginPath(),L.moveTo(Q.x,Q.y),L.lineTo(D.x,D.y),L.moveTo(_.x,_.y),L.lineTo(F.x,F.y),L.moveTo(Q.x,Q.y),L.lineTo(_.x,_.y),L.moveTo(D.x,D.y),L.lineTo(F.x,F.y),L.stroke(),L.fillStyle="#ffffff",L.strokeStyle="#3b82f6",L.lineWidth=2*B,[Q,D,F,_].forEach(Z=>{L.beginPath(),L.arc(Z.x,Z.y,6*B,0,Math.PI*2),L.fill(),L.stroke()});const k=[l.p1,l.p3,l.p2,l.p4],V=[Q,D,_,F];L.fillStyle=l.color,L.font=`${Math.round(10*B)}px sans-serif`,L.textAlign="left",L.textBaseline="middle",V.forEach((Z,$)=>{const z=k[$]?.price;typeof z=="number"&&L.fillText(z.toFixed(5),Z.x+8*y,Z.y)}),L.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class id extends hl{constructor(e,A,t,i,n="#3b82f6",s=2){super(e,A,t,i,n,s,"rgba(59, 130, 246, 0.12)")}}class nd{constructor(e,A,t,i,n,s={}){this.p1=e,this.p2=A,this.b1=t,this.b2=i,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(a=>{if(!o.visible)return;const c=o._chart,u=o._series;if(!c||!u)return;const m=a.horizontalPixelRatio,y=a.verticalPixelRatio,B=a.context,p=L=>{const k=c.timeScale().timeToCoordinate(L.rawTime),V=u.priceToCoordinate(L.price);return k==null||V==null?null:{x:k*m,y:V*y}},Q=p(o.p1),D=p(o.p2),F=p(o.b2),_=p(o.b1);!Q||!D||!F||!_||(B.save(),B.beginPath(),B.moveTo(Q.x,Q.y),B.lineTo(D.x,D.y),B.lineTo(F.x,F.y),B.lineTo(_.x,_.y),B.closePath(),B.fillStyle=o.fillColor,B.fill(),B.strokeStyle=o.strokeColor,B.lineWidth=o.lineWidth*y,B.setLineDash([]),B.beginPath(),B.moveTo(Q.x,Q.y),B.lineTo(D.x,D.y),B.stroke(),B.beginPath(),B.moveTo(_.x,_.y),B.lineTo(F.x,F.y),B.stroke(),B.restore())})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ul{constructor(e,A,t,i,n,s,o={}){this.mid1=e,this.mid2=A,this.top1=t,this.top2=i,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const l=this;this._paneView={renderer(){return{draw(a){a.useBitmapCoordinateSpace(c=>{if(!l.visible)return;const u=l._chart,m=l._series;if(!u||!m)return;const y=c.horizontalPixelRatio,B=c.verticalPixelRatio,p=c.context,Q=$=>{const z=u.timeScale().timeToCoordinate($.rawTime),R=m.priceToCoordinate($.price);return z==null||R==null?null:{x:z*y,y:R*B}},D=Q(l.mid1),F=Q(l.mid2),_=Q(l.top1),L=Q(l.top2),k=Q(l.bot1),V=Q(l.bot2);if(!D||!F||!_||!L||!k||!V)return;p.save(),p.beginPath(),p.moveTo(D.x,D.y),p.lineTo(F.x,F.y),p.lineTo(L.x,L.y),p.lineTo(_.x,_.y),p.closePath(),p.fillStyle=l.upperFillColor,p.fill(),p.beginPath(),p.moveTo(k.x,k.y),p.lineTo(V.x,V.y),p.lineTo(F.x,F.y),p.lineTo(D.x,D.y),p.closePath(),p.fillStyle=l.lowerFillColor,p.fill();const Z=($,z,R)=>{p.beginPath(),p.strokeStyle=R,p.lineWidth=l.lineWidth*B,p.setLineDash([]),p.moveTo($.x,$.y),p.lineTo(z.x,z.y),p.stroke()};if(Z(_,L,l.upperStrokeColor),Z(D,F,l.centerStrokeColor),Z(k,V,l.lowerStrokeColor),l.showDeviationLabel){const $=Math.abs(l.top1.price-l.mid1.price),z=Number.isFinite($)?$.toFixed(5):null;if(z){const R=Math.max(10,Math.round(10*B));p.fillStyle=l.labelColor,p.font=`${R}px sans-serif`,p.textAlign="left",p.textBaseline="top",p.fillText(z,k.x+2*y,k.y+10*B)}}p.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class sd extends ul{}class od{constructor(e,A){this.p1=e,this.p2=A,this.visible=!0,this._chart=null,this._series=null,this._levels=[{ratio:0,label:"0.000"},{ratio:.236,label:"0.236"},{ratio:.382,label:"0.382"},{ratio:.5,label:"0.500"},{ratio:.618,label:"0.618"},{ratio:.786,label:"0.786"},{ratio:1,label:"1.000"},{ratio:1.618,label:"1.618"},{ratio:2.618,label:"2.618"},{ratio:3.618,label:"3.618"},{ratio:4.236,label:"4.236"}],this._levelColors={0:"#ff0000",.236:"#ff0000",.382:"#00c853",.5:"#00c853",.618:"#00bcd4",.786:"#00bcd4",1:"#2962ff",1.618:"#2962ff",2.618:"#ff0000",3.618:"#ff0000",4.236:"#e040fb"},this._zoneFills=[{from:0,to:.236,color:"rgba(255, 0, 0, 0.06)"},{from:.236,to:.382,color:"rgba(0, 200, 83, 0.06)"},{from:.382,to:.5,color:"rgba(0, 200, 83, 0.06)"},{from:.5,to:.618,color:"rgba(0, 200, 83, 0.06)"},{from:.618,to:.786,color:"rgba(0, 188, 212, 0.06)"},{from:.786,to:1,color:"rgba(41, 98, 255, 0.08)"},{from:1,to:1.618,color:"rgba(255, 138, 128, 0.10)"},{from:1.618,to:2.618,color:"rgba(255, 138, 128, 0.10)"},{from:2.618,to:3.618,color:"rgba(224, 64, 251, 0.08)"},{from:3.618,to:4.236,color:"rgba(224, 64, 251, 0.08)"}];const t=this;this._paneView={renderer(){return{draw(i){i.useBitmapCoordinateSpace(n=>{if(!t.visible)return;const s=t._chart,o=t._series;if(!s||!o)return;const l=n.horizontalPixelRatio,a=n.verticalPixelRatio,c=n.context,u=n.bitmapSize.width;n.bitmapSize.height;const m=t.p1.price,y=t.p2.price,B=m-y,p=$=>y+B*$,Q=s.timeScale().timeToCoordinate(t.p1.rawTime),D=s.timeScale().timeToCoordinate(t.p2.rawTime),F=o.priceToCoordinate(m),_=o.priceToCoordinate(y),L=Q!=null&&D!=null?Math.round(Math.min(Q,D)*l):0,k=Q!=null&&D!=null?Math.round(Math.max(Q,D)*l):u,V=k-L;c.save(),t._zoneFills.forEach(({from:$,to:z,color:R})=>{const X=p($),se=p(z),ae=o.priceToCoordinate(X),ye=o.priceToCoordinate(se);if(ae==null||ye==null)return;const Le=Math.round(ae*a),Qe=Math.round(ye*a);c.fillStyle=R,c.fillRect(L,Math.min(Le,Qe),V,Math.abs(Qe-Le))}),t._levels.forEach(({ratio:$,label:z})=>{const R=p($),X=o.priceToCoordinate(R);if(X==null)return;const se=Math.round(X*a),ae=t._levelColors[$]||"#888888";c.beginPath(),c.strokeStyle=ae,c.lineWidth=$===0||$===1?1.5*a:1*a,$!==0&&$!==1&&$<1?c.setLineDash([4*l,4*l]):c.setLineDash([]),c.moveTo(L,se),c.lineTo(k,se),c.stroke(),c.setLineDash([])});const Z=Math.round(11*a);if(c.font=`${Z}px sans-serif`,c.textAlign="left",t._levels.forEach(({ratio:$,label:z})=>{const R=p($),X=o.priceToCoordinate(R);if(X==null)return;const se=Math.round(X*a),ae=t._levelColors[$]||"#888888",ye=`${z} (${R.toFixed(5)})`;c.fillStyle=ae,c.textAlign="right",c.fillText(ye,L-4*l,se-4*a)}),Q!=null&&D!=null&&F!=null&&_!=null){const $=Math.round(Q*l),z=Math.round(F*a),R=Math.round(D*l),X=Math.round(_*a);c.beginPath(),c.strokeStyle="rgba(128, 128, 128, 0.6)",c.lineWidth=1*a,c.setLineDash([]),c.moveTo($,z),c.lineTo(R,X),c.stroke(),c.beginPath(),c.fillStyle="#2962ff",c.arc($,z,4*a,0,Math.PI*2),c.fill(),c.strokeStyle="#ffffff",c.lineWidth=1*a,c.stroke(),c.beginPath(),c.fillStyle="#2962ff",c.arc(R,X,4*a,0,Math.PI*2),c.fill(),c.strokeStyle="#ffffff",c.lineWidth=1*a,c.stroke()}c.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class bv{constructor(e,A="#3b82f6",t=2){this.time=e,this.color=A,this.lineWidth=t,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart;if(!o)return;const l=o.timeScale().timeToCoordinate(i.time);if(l==null)return;const a=Math.round(l*s.horizontalPixelRatio),c=s.bitmapSize.height,u=s.context;u.save(),u.beginPath(),u.strokeStyle=i.color,u.lineWidth=i.lineWidth*s.horizontalPixelRatio,u.setLineDash([]),u.moveTo(a,0),u.lineTo(a,c),u.stroke(),u.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const Tv={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function ld(r){if(!r)return 7;const e=String(r).toUpperCase();return Tv[e]??7}function Qv(r,e){const A=String(r||"").toUpperCase(),t=e||ld(r),i={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[A]||96,n=Math.ceil(t*(typeof i=="number"?i:96));return Math.min(Math.max(n,500),5e3)}const qt=r=>{if(!Array.isArray(r)||r.length===0)return[];const e=r.map(t=>({...t,time:Ae(t.time)})).filter(t=>t.time!=null);e.sort((t,i)=>t.time-i.time);const A=new Map;for(const t of e)A.set(t.time,t);return Array.from(A.values()).sort((t,i)=>t.time-i.time)};function Ze(r,e,A,t,i,n){const s=i-A,o=n-t,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(r-A,e-t);let a=((r-A)*s+(e-t)*o)/(l*l);a=Math.max(0,Math.min(1,a));const c=A+a*s,u=t+a*o;return Math.hypot(r-c,e-u)}function xv(r,e,A,t,i,n){const s=i-A,o=n-t,l=s*s+o*o;if(l===0)return Math.hypot(r-A,e-t);let a=((r-A)*s+(e-t)*o)/l;a<0&&(a=0);const c=A+a*s,u=t+a*o;return Math.hypot(r-c,e-u)}function Fv(r,e,A,t,i,n){const s=i-A,o=n-t,l=s*s+o*o;if(l===0)return Math.hypot(r-A,e-t);const a=((r-A)*s+(e-t)*o)/l,c=A+a*s,u=t+a*o;return Math.hypot(r-c,e-u)}function Mt(r,e,A){let t=!1;for(let i=0,n=A.length-1;i<A.length;n=i++){const s=A[i].x,o=A[i].y,l=A[n].x,a=A[n].y;o>e!=a>e&&r<(l-s)*(e-o)/(a-o+1e-7)+s&&(t=!t)}return t}function ad(r,e,A){if(!r||!e||!A)return null;const t=r.normalizedTime??Ae(r.rawTime),i=e.normalizedTime??Ae(e.rawTime),n=A.normalizedTime??Ae(A.rawTime);if(t==null||i==null||n==null)return null;const s=i-t;if(Math.abs(s)<1e-9)return null;const o=(e.price-r.price)/s,l=A.price+o*(t-n),a=A.price+o*(i-n),c=Ae((t+i)/2),u=(l+a)/2;return c==null?null:{b1:{rawTime:r.rawTime,normalizedTime:t,price:l},b2:{rawTime:e.rawTime,normalizedTime:i,price:a},p3:{rawTime:A.rawTime,normalizedTime:n,price:A.price},bottomMid:{rawTime:c,normalizedTime:c,price:u}}}function qn(r,e,A,t=1){if(!Array.isArray(r)||r.length<2||!e||!A)return null;const i=e.normalizedTime??Ae(e.rawTime),n=A.normalizedTime??Ae(A.rawTime);if(i==null||n==null)return null;const s=Math.min(i,n),o=Math.max(i,n),l=r.map($=>({time:Ae($.time),close:typeof $.close=="number"?$.close:parseFloat($.close)})).filter($=>$.time!=null&&Number.isFinite($.close)&&$.time>=s&&$.time<=o).sort(($,z)=>$.time-z.time);if(l.length<2)return null;const a=l.length;let c=0,u=0,m=0,y=0;for(let $=0;$<a;$++){const z=$,R=l[$].close;c+=z,u+=R,m+=z*R,y+=z*z}const B=a*y-c*c,p=Math.abs(B)<1e-12?0:(a*m-c*u)/B,Q=(u-p*c)/a;let D=0;for(let $=0;$<a;$++){const z=Q+p*$,R=l[$].close-z;D+=R*R}const F=Math.sqrt(D/a),_=Math.max(F*t,1e-8),L=l[0].time,k=l[a-1].time,V=Q,Z=Q+p*(a-1);return{slope:p,intercept:Q,stdDev:F,offset:_,barCount:a,p1:{rawTime:L,normalizedTime:L,price:V},p2:{rawTime:k,normalizedTime:k,price:Z},top1:{rawTime:L,normalizedTime:L,price:V+_},top2:{rawTime:k,normalizedTime:k,price:Z+_},bot1:{rawTime:L,normalizedTime:L,price:V-_},bot2:{rawTime:k,normalizedTime:k,price:Z-_}}}function dl(r,e,A,t=1){return qn(r,e,A,t)}const Uv={trendline:{requiredKeys:["point1","point2"],handleCount:2},gannline:{requiredKeys:["point1","point2"],handleCount:3},rectangle:{requiredKeys:["p1","p2"],handleCount:8},circle:{requiredKeys:["p1","p2"],handleCount:2},triangle:{requiredKeys:["p1","p2","p3"],handleCount:3},ellipse:{requiredKeys:["p1","p2"],handleCount:4},arrowedline:{requiredKeys:["p1","p2"],handleCount:2},rayline:{requiredKeys:["p1","p2"],handleCount:2},extendedline:{requiredKeys:["p1","p2"],handleCount:2},crossline:{requiredKeys:["p"],handleCount:1},trendbyangle:{requiredKeys:["p1","p2"],handleCount:2},equidistantchannel:{requiredKeys:["p1","p2","p3"],handleCount:3},regressionchannel:{requiredKeys:["p1","p2"],handleCount:2},stddevchannel:{requiredKeys:["p1","p2"],handleCount:2},gannfan:{requiredKeys:["p1","p2"],handleCount:2},ganngrid:{requiredKeys:["p1","p2"],handleCount:2},andrewspitchfork:{requiredKeys:["p1","p2","p3"],handleCount:3},disjointchannel:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},flattopbottom:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},rulerline:{requiredKeys:["p1","p2"],handleCount:3}},Ev={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6"};function Sv(r,e){if(!r||!r.type)return!1;const A=Uv[r.type];return!A||e.length!==A.handleCount?!1:A.requiredKeys.every(t=>!!r[t])}function Hv(r){return r?Ev[r]??"#22c55e":"#22c55e"}const Lv=J.forwardRef(function({bidPrice:e="113.638",askPrice:A="113.649",showBuySellPanel:t=!0,onBuyClick:i,onSellClick:n},s){const o=J.useRef(null),l=J.useRef(null),a=J.useRef(null),c=J.useRef(null),u=J.useRef([]),m=J.useRef(!1),y=J.useRef(null),B=J.useRef(null),p=J.useRef(null),Q=J.useRef(null),D=J.useRef([]),[F,_]=J.useState(null),[L,k]=J.useState([]),[V,Z]=J.useState(null),[$,z]=J.useState([]),R=J.useRef(null),X=J.useRef(null),se=J.useRef(null),ae=J.useRef(!1);J.useEffect(()=>{se.current=F},[F]);const ye=J.useRef(new Map),Le=J.useRef(null),Qe=(v,C)=>`${v}_${C}`,xe=()=>{const v=Qe(Ie,we);return ye.current.get(v)||null},Se=v=>{if(!v)return;const C=Qe(Ie,we);ye.current.set(C,v)},{activeTool:pe,setActiveTool:Be,showGrid:Ce,snapToGrid:Fe,chartObjects:be,setChartObjects:le,orders:qe,selectedSymbol:Ie,selectedTimeframe:we,drawingsVisible:Ke,chartType:ce,chartLocked:De,theme:Ye,baseUrl:je,endpoints:Oe,endpointParams:We}=TA(),Pe=J.useRef([]),[tA,ge]=J.useState(!1),[oe,Ee]=J.useState(null),[ne,de]=J.useState([]),[ke,Me]=J.useState(!0),Je=J.useRef(null),hA=J.useRef(new Map);J.useRef(null);const pi=J.useRef(0);J.useImperativeHandle(s,()=>({zoomIn:()=>{const v=l.current?.timeScale();if(!v)return;const C=v.getVisibleRange();if(!C||!C.from||!C.to)return;const P=C.to-C.from,He=(C.from+C.to)/2,x=P*.8;try{v.setVisibleRange({from:He-x/2,to:He+x/2}),Se(v.getVisibleRange())}catch{}},zoomOut:()=>{const v=l.current?.timeScale();if(!v)return;const C=v.getVisibleRange();if(!C||!C.from||!C.to)return;const P=C.to-C.from,He=(C.from+C.to)/2,x=P*1.25;try{v.setVisibleRange({from:He-x/2,to:He+x/2}),Se(v.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const v=o.current;if(!v){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const C=v.querySelectorAll("canvas"),P=Ye==="light"?"#ffffff":"#12161d";let He=null,x=0;if(C.forEach(q=>{if(q.width>0&&q.height>0){const re=q.width*q.height;re>x&&(x=re,He=q)}}),He)try{const q=document.createElement("canvas");q.width=He.width,q.height=He.height;const re=q.getContext("2d");re.fillStyle=P,re.fillRect(0,0,q.width,q.height),re.drawImage(He,0,0);const ee=document.createElement("a");ee.download=`chart-${Ie}-${we}-${Date.now()}.png`,ee.href=q.toDataURL("image/png"),ee.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(q){console.warn("Canvas export failed, trying html2canvas",q)}sv(v,{useCORS:!0,allowTaint:!0,backgroundColor:P,scale:2,logging:!1}).then(q=>{const re=document.createElement("a");re.download=`chart-${Ie}-${we}-${Date.now()}.png`,re.href=q.toDataURL("image/png"),re.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(q=>{console.error("Chart screenshot failed",q),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Ie,we,Ye]);const vr=J.useMemo(()=>ne.length===0?[]:ce==="line"||ce==="area"?ne.map(v=>({time:v.time,value:v.close})):ne,[ne,ce]),It=v=>{i?i(v):(Ee("BUY"),ge(!0))},jn=v=>{n?n(v):(Ee("SELL"),ge(!0))},gl=()=>{ge(!1),Ee(null)};J.useEffect(()=>{const v=o.current;if(!v)return;const C=v.getBoundingClientRect(),P=M=>{const K=Math.abs(Number(M));return Number.isFinite(K)?K>=1e3?K.toFixed(2):K>=1?K.toFixed(4):K.toFixed(5):"0"},He=Ye==="light",x=qp(v,{width:C.width||v.clientWidth,height:C.height||v.clientHeight,autoSize:!0,localization:{priceFormatter:P},layout:{background:{color:He?"#FFFFFF":"#0d1117",type:"solid"},textColor:He?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ce,color:Ce?He?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ce?2:0},horzLines:{visible:Ce,color:Ce?He?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ce?2:0}},rightPriceScale:{borderColor:He?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,textColor:He?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:He?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:pe===1?1:0,vertLine:{width:1,color:He?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:He?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:He?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:He?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:pe===1,horzLineVisible:pe===1},handleScroll:{mouseWheel:!0,pressedMouseMove:pe===null||pe===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}}),q=x.addCandlestickSeries({upColor:He?"#089981":"#26a69a",downColor:He?"#f23645":"#ef5350",wickUpColor:He?"#089981":"#26a69a",wickDownColor:He?"#f23645":"#ef5350",borderUpColor:He?"#089981":"#26a69a",borderDownColor:He?"#f23645":"#ef5350",borderVisible:!0});l.current=x,a.current=q,requestAnimationFrame(()=>{if(v&&x){const M=v.getBoundingClientRect();M.width>0&&M.height>0&&x.resize(M.width,M.height)}});const re=x.timeScale(),ee=()=>{if(ae.current&&hA.current.size>0){const M=re.getVisibleRange();M&&Se(M)}};re.subscribeVisibleTimeRangeChange(ee);const he=new ResizeObserver(M=>{for(const K of M){const{width:ie,height:te}=K.contentRect;if(ie>0&&te>0&&x){const w=re.getVisibleRange();x.resize(ie,te),w&&setTimeout(()=>{try{re.setVisibleRange(w)}catch{}},0)}}});return he.observe(v),()=>{re.unsubscribeVisibleTimeRangeChange(ee),he.disconnect(),x.remove(),l.current=null,a.current=null,c.current=null,u.current=[]}},[]),J.useEffect(()=>{l.current&&l.current.applyOptions({grid:{vertLines:{visible:Ce,color:Ce?"rgba(110, 118, 129, 0.15)":"transparent",style:Ce?2:0},horzLines:{visible:Ce,color:Ce?"rgba(110, 118, 129, 0.15)":"transparent",style:Ce?2:0}}})},[Ce]),J.useEffect(()=>{const v=l.current;if(!v)return;const C=Ye==="light";v.applyOptions({layout:{background:{color:C?"#FFFFFF":"#12161d"},textColor:C?"#020617":"#fff"},grid:{vertLines:{color:Ce?C?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ce?C?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:C?"#e5e7eb":"#1e293b"},timeScale:{borderColor:C?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:C?"#3b82f6":"#58a6ff",labelBackgroundColor:C?"#eff6ff":"#161b22",width:1},horzLine:{color:C?"#3b82f6":"#58a6ff",labelBackgroundColor:C?"#eff6ff":"#161b22",width:1}}})},[Ye,Ce]),J.useEffect(()=>{if(!l.current)return;const C=!De&&!(pe!==null&&pe!==1&&pe!==0),P=!De;l.current.applyOptions({crosshair:{mode:pe===1?1:0,vertLine:{visible:pe===1,width:1,color:Ye==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ye==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:pe===1,width:1,color:Ye==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ye==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:P,pressedMouseMove:C,horzTouchDrag:C,vertTouchDrag:C},handleScale:{axisPressedMouseMove:{time:C,price:C},axisDoubleClickReset:{time:P,price:P},axisTouch:{time:C,price:C},mouseWheel:P,pinch:P}})},[pe,De]),J.useEffect(()=>{(async()=>{if(!Ie||!we){de([]),ae.current=!1;return}try{if(Me(!0),de([]),ae.current=!1,a.current)try{a.current.setData([])}catch{}console.log(`📊 Fetching candles for ${Ie} @ ${we}`);const C=ld(we),P=Qv(we,C),He=je||av?.VITE_BASE_URL||"ws://localhost:8000",x=Oe?.candles||"/api/chart/candles",q=We?.candles||{},re={symbol:q.symbol||"symbol",timeframe:q.timeframe||"timeframe",limit:q.limit||"limit",daysBack:q.daysBack||"daysBack"},ee={};ee[re.symbol]=Ie,ee[re.timeframe]=we,ee[re.limit]=P,q.daysBack!==!1&&(ee[re.daysBack]=C);const he=await oA.get(`${He}${x}`,{params:ee,timeout:1e4});let M=[];if(Array.isArray(he.data)?M=he.data:he.data&&he.data.data&&Array.isArray(he.data.data)?M=he.data.data:he.data&&Array.isArray(he.data)&&(M=he.data),M&&M.length>0){console.log(`✅ Loaded ${M.length} raw candles from server`);const{candles:K,stats:ie}=Yc(M,Ie,we);K.length>0?(de(K),hA.current=new Map,K.forEach(te=>{hA.current.set(te.time,te)})):(console.warn(`⚠️ No valid candles after processing for ${Ie}`),de([]))}else console.warn(`⚠️ No candle data returned for ${Ie}`),de([])}catch(C){console.error(`❌ Error fetching ${Ie}:`,C.message),de([])}finally{Me(!1)}})()},[Ie,we]),J.useEffect(()=>{console.log("🔧 [CANDLES DEBUG] Setting up WebSocket for candles:",{baseUrl:je,symbol:Ie,timeframe:we}),Je.current=en.getSocket();const v=Je.current;console.log("🔌 [CANDLES DEBUG] Socket status for CandlesGateway (ROOT namespace):",{socketId:v.id,connected:v.connected,baseUrl:je,socketUrl:v.io?.uri||"unknown",namespace:v.nsp?.name||"/",hasAuth:!!v.auth,note:"This socket MUST connect to root namespace for CandlesGateway"});const C=()=>{if(console.log("📡 [CANDLES DEBUG] subscribeToCandles called:",{selectedSymbol:Ie,selectedTimeframe:we,connected:v.connected,socketId:v.id}),Ie&&we&&v.connected){const ee={symbol:Ie,timeframe:we};console.log("📡 [CANDLES DEBUG] Emitting subscribeCandles:",ee),v.emit("subscribeCandles",ee),console.log("✅ [CANDLES DEBUG] subscribeCandles event emitted successfully")}else console.warn("⚠️ [CANDLES DEBUG] Cannot subscribe to candles:",{selectedSymbol:Ie,selectedTimeframe:we,connected:v.connected,socketId:v.id,reason:Ie?we?"Not connected":"No timeframe":"No symbol"})},P=()=>{console.log("✅ [CANDLES DEBUG] Chart WebSocket connected to backend, socket ID:",v.id),setTimeout(()=>{Ie&&we&&(console.log("📡 [CANDLES DEBUG] Backend connected, subscribing to candles..."),C())},200)},He=ee=>{console.log("⚠️ [CANDLES DEBUG] Chart WebSocket disconnected:",ee)},x=ee=>{console.error("❌ [CANDLES DEBUG] Chart WebSocket connection error:",ee),console.error("❌ [CANDLES DEBUG] Error details:",{message:ee.message,description:ee.description,context:ee.context,type:ee.type})};v.on("connect",P),v.on("disconnect",He),v.on("connect_error",x),v.on("subscription:confirmed",ee=>{console.log("✅ [CANDLES DEBUG] Subscription confirmed:",ee),ee.type==="candles"&&console.log("✅ [CANDLES DEBUG] Candle subscription confirmed for:",{symbol:ee.symbol,timeframe:ee.timeframe})});const q=ee=>{if(console.log("📊 [CANDLES DEBUG] candleUpdate event received:",ee),!ee||!ee.candle||!ee.symbol){console.warn("⚠️ [CANDLES DEBUG] Invalid candleUpdate data:",ee);return}if(console.log("✅ [CANDLES DEBUG] Valid candleUpdate received:",{symbol:ee.symbol,timeframe:ee.timeframe,candle:ee.candle,selectedSymbol:Ie,selectedTimeframe:we}),ee.symbol.toUpperCase()!==Ie?.toUpperCase()){console.log(`⚠️ [CANDLES DEBUG] Symbol mismatch: received ${ee.symbol}, selected ${Ie}`);return}const{candle:he}=ee;console.log("✅ [CANDLES DEBUG] Processing candle update:",{symbol:ee.symbol,timeframe:ee.timeframe,candle:he,candleTime:he.time,candleClose:he.close});const M=jc(he,Ie,we);if(!M){console.warn("⚠️ [CANDLES DEBUG] Rejected realtime candle (invalid):",{symbol:ee.symbol,candle:he});return}console.log("✅ [CANDLES DEBUG] Processed candle:",{time:M.time,open:M.open,high:M.high,low:M.low,close:M.close});const K=Date.now();if(K-pi.current<200)return;pi.current=K;const ie=l.current?.timeScale(),te=ie?.getVisibleRange(),w=a.current,T=l.current;if(!w||!T||!ae.current){console.warn("⚠️ [CANDLES DEBUG] Chart not ready for update:",{hasSeries:!!w,hasChart:!!T,hasInitialized:ae.current});return}const E=w?.seriesType?.(),g=ce==="line"?"Line":ce==="area"?"Area":ce==="bars"?"Bar":"Candlestick";if(E!==g){console.warn("⚠️ [CANDLES DEBUG] Series type mismatch:",{expected:g,actual:E,chartType:ce,note:"Chart type switch might be in progress, skipping update"});return}try{const d=hA.current.get(M.time),S=d?{time:M.time,open:d.open,high:Math.max(d.high,M.close),low:Math.min(d.low,M.close),close:M.close}:M;hA.current.set(M.time,S);try{ce==="line"||ce==="area"?w.update({time:S.time,value:S.close}):w.update(S),ie&&te&&Se(te),console.log("✅ [CANDLES DEBUG] Candle update completed successfully")}catch(I){throw console.error("❌ [CANDLES DEBUG] Error in s.update():",I),console.error("❌ [CANDLES DEBUG] Series type:",w?.seriesType?.()),console.error("❌ [CANDLES DEBUG] Processed candle:",M),I}}catch(d){console.error("❌ [CANDLES DEBUG] Error updating candle:",d),console.error("❌ [CANDLES DEBUG] Error stack:",d.stack)}};v.on("candleUpdate",q);const re=()=>{v.connected&&Ie&&we?(console.log("✅ [CANDLES DEBUG] Socket connected, subscribing to backend..."),C()):console.log("⏳ [CANDLES DEBUG] Waiting for socket connection...",{connected:v.connected,hasSymbol:!!Ie,hasTimeframe:!!we})};if(v.connected)re();else{const ee=()=>{console.log("✅ [CANDLES DEBUG] Socket connected to backend, subscribing..."),setTimeout(re,200)};v.once("connect",ee),setTimeout(()=>{v.connected&&re()},500)}return()=>{v.off("candleUpdate",q),v.off("connect",P),v.off("disconnect",He),v.off("connect_error",x),v.off("subscription:confirmed"),Ie&&we&&v.connected&&(console.log(`🔌 Unsubscribing from: ${Ie}@${we}`),v.emit("unsubscribeCandles",{symbol:Ie,timeframe:we}))}},[Ie,we,je]),J.useEffect(()=>{const v=a.current,C=l.current;if(!(!v||!C)&&!(ne.length===0&&ae.current)){if(ne.length===0&&!ae.current){if(ke)return;const P=C.timeScale();v.setData([]),P.fitContent();return}if(!ae.current){const P=C.timeScale(),He=Qe(Ie,we);Le.current,Le.current=He,console.log("sorted candles 1");const x=[...ne].sort((re,ee)=>re.time-ee.time);if(console.log("📊 [CANDLES DEBUG] Initializing chart with candles:",{candleCount:x?.length,chartType:ce,seriesType:v?.seriesType?.()||"unknown",firstCandle:x[0],lastCandle:x[x?.length-1]}),console.log("sorted candles 2"),ce==="line"||ce==="area"){const re=x?.map(ee=>({time:ee.time,value:ee.close})).filter(ee=>ee.time!=null);re.length>0&&(console.log("📊 [CANDLES DEBUG] Setting line/area data:",re.length,"points"),v.setData(re),console.log("✅ [CANDLES DEBUG] Line/area data set successfully"))}else console.log("sorted candles 3"),x?.length>0&&(console.log("📊 [CANDLES DEBUG] Setting candlestick data:",x?.length,"candles"),console.log("📊 [CANDLES DEBUG] First candle sample:",x[0]),console.log("📊 [CANDLES DEBUG] Last candle sample:",x[x?.length-1]),v.setData(x),console.log("✅ [CANDLES DEBUG] Candlestick data set successfully"));if(console.log("sorted candles 4"),x?.length>0){const re=x[x?.length-1].time,ee=Wt(we)||60,he=we==="M1"?150:we==="M5"?120:100,M=re-he*ee;console.log("📊 [CANDLES DEBUG] Setting visible range:",{from:M,to:re+ee*2,visibleBars:he,timeframeSeconds:ee});try{P.setVisibleRange({from:M,to:re+ee*2}),console.log("✅ [CANDLES DEBUG] Visible range set successfully")}catch(K){console.warn("⚠️ [CANDLES DEBUG] Failed to set visible range, using fitContent:",K),P.fitContent()}}else console.warn("⚠️ [CANDLES DEBUG] No candles to set visible range, using fitContent"),P.fitContent();try{C.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0}),console.log("✅ [CANDLES DEBUG] Price scale configured successfully")}catch{console.warn("⚠️ [CANDLES DEBUG] Failed to configure price scale")}ae.current=!0;const q=P.getVisibleRange();Se(q),console.log("sorted candles 5"),console.log("✅ [CANDLES DEBUG] Chart initialization completed:",{hasInitialized:ae.current,visibleRange:q,candleCount:x?.length})}}},[ne.length,ce,Ie,we]),J.useEffect(()=>{const v=l.current;if(!v||!ae.current||ne.length===0){console.log("⏳ [CANDLES DEBUG] Chart type switch skipped:",{hasChart:!!v,hasInitialized:ae.current,candleCount:ne.length,chartType:ce});return}console.log("🔄 [CANDLES DEBUG] Switching chart type:",{from:a.current?.seriesType?.()||"unknown",to:ce,candleCount:ne.length});const C=v.timeScale(),P=C.getVisibleRange()||xe();if(a.current)try{v.removeSeries(a.current)}catch{}if(c.current)try{v.removeSeries(c.current),c.current=null}catch{}let He;if(ce==="bars"){const x=Ye==="light";He=v.addBarSeries({upColor:x?"#089981":"#26A69A",downColor:x?"#f23645":"#EF5350",borderUpColor:x?"#089981":"#26A69A",borderDownColor:x?"#f23645":"#EF5350",scaleMargins:{top:.1,bottom:.1}}),console.log("sorted candles 6");const q=[...ne].sort((re,ee)=>re.time-ee.time);q?.length>0&&He.setData(q)}else if(ce==="line"){He=v.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const x=qt(vr);x.length>0&&He.setData(x)}else if(ce==="area"){He=v.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 x=qt(vr);x.length>0&&He.setData(x)}else if(ce==="volume ticks"||ce==="volume"){const x=Ye==="light";He=v.addCandlestickSeries({upColor:x?"#089981":"#26A69A",downColor:x?"#f23645":"#EF5350",wickUpColor:x?"#089981":"#26A69A",wickDownColor:x?"#f23645":"#EF5350",borderUpColor:x?"#089981":"#26A69A",borderDownColor:x?"#f23645":"#EF5350",borderVisible:!0,priceScaleId:"right"}),console.log("sorted candles 7");const q=[...ne].sort((he,M)=>he.time-M.time);q?.length>0&&He.setData(q);const re=v.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});v.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),v.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1}),console.log("sorted candles 8");const ee=q?.map(he=>({time:he.time,value:he.volume||0,color:he.close>=he.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));ee.length>0&&re.setData(ee),c.current=re}else{const x=Ye==="light";He=v.addCandlestickSeries({upColor:x?"#089981":"#26A69A",downColor:x?"#f23645":"#EF5350",wickUpColor:x?"#089981":"#26A69A",wickDownColor:x?"#f23645":"#EF5350",borderUpColor:x?"#089981":"#26A69A",borderDownColor:x?"#f23645":"#EF5350",borderVisible:!0,scaleMargins:{top:.1,bottom:.1}}),console.log("sorted candles 9");const q=[...ne].sort((re,ee)=>re.time-ee.time);q?.length>0&&He.setData(q)}if(a.current=He,P&&ae.current)setTimeout(()=>{try{C.setVisibleRange(P),Se(P)}catch{if(ne.length>0)try{const q=ne[ne.length-1].time,re=q-6e3;C.setVisibleRange({from:re,to:q}),Se(C.getVisibleRange())}catch{C.fitContent(),Se(C.getVisibleRange())}}try{v.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!ae.current){C.fitContent();try{v.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0,Se(C.getVisibleRange())}},[ce,ne.length,vr.length]),J.useEffect(()=>{const v=l.current,C=c.current;if(!v||!C||!ae.current||ne.length===0||ce!=="volume"&&ce!=="volume ticks")return;console.log("sorted candles 10");const P=[...ne].sort((x,q)=>x.time-q.time);console.log("sorted candles 11");const He=P?.map(x=>({time:x.time,value:x.volume||0,color:x.close>=x.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));He.length>0&&C.setData(He)},[ne,ce]),J.useEffect(()=>{const v=l.current,C=a.current,P=o.current;if(!v||!C||!P)return;const x=pe!==null?[null,null,"trendline","parallellines","fibonacci","rectangle",null,"text",null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][pe]:null,q=(M,K)=>{const ie=Math.min(M.time,K.time),te=Math.max(M.time,K.time),w=M.time<=K.time?M.rawTime:K.rawTime,T=M.time<=K.time?K.rawTime:M.rawTime,E=Math.max(M.price,K.price),g=Math.min(M.price,K.price),d=Ae(Math.round((ie+te)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:E},p2:{rawTime:w,normalizedTime:ie,price:g},p3:{rawTime:T,normalizedTime:te,price:g}}};if(!x){if(m.current=!1,y.current=null,B.current=null,Q.current=null,p.current?.series)try{v.removeSeries(p.current.series)}catch{}if(p.current?.primitive)try{C.detachPrimitive(p.current.primitive)}catch{}p.current=null;return}if(x==="pricelevel"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const d={type:"pricelevel",priceLine:C.createPriceLine({price:E,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:E.toFixed(5)}),price:E};le(S=>[...S,d]),u.current.push(d)};return P.addEventListener("click",M),()=>{P.removeEventListener("click",M)}}if(x==="horizontalray"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const g=new cv(E,T);C.attachPrimitive(g);const d=Ae(T),S={type:"horizontalray",primitive:g,price:E,originTime:d};le(I=>[...I,S]),u.current.push(S)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="verticalline"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=v.timeScale().coordinateToTime(te);if(w==null)return;const T=new bv(w);C.attachPrimitive(T);const E=Ae(w),g={type:"verticalline",primitive:T,time:E};le(d=>[...d,g]),u.current.push(g)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="infoline"){let M=null,K=null;const ie=w=>{if(!M)return;const T=P.getBoundingClientRect(),E=w.clientX-T.left,g=w.clientY-T.top,d=v.timeScale().coordinateToTime(E),S=C.coordinateToPrice(g);if(d==null||S==null)return;K||(K=v.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const I=M.normalizedTime,U=Ae(d);if(I==null||U==null||I===U)return;const f=I<=U?[{time:I,value:M.price},{time:U,value:S}]:[{time:U,value:S},{time:I,value:M.price}];try{K.setData(f)}catch{}},te=w=>{const T=P.getBoundingClientRect(),E=w.clientX-T.left,g=w.clientY-T.top,d=v.timeScale().coordinateToTime(E),S=C.coordinateToPrice(g);if(d==null||S==null)return;if(!M){M={rawTime:d,price:S,normalizedTime:Ae(d),x:E,y:g};return}if(K){try{v.removeSeries(K)}catch{}K=null}const I=M.normalizedTime,U=Ae(d);if(I==null||U==null)return;const f=S-M.price,b=f/Math.abs(M.price)*100,H=Wt(we)||3600,O=Math.abs(U-I),N=Math.max(1,Math.round(O/H)),W=Math.max(1,Math.round(O/86400)),G=M.x,j=M.y,fe=E,Ue=Math.atan2(-(g-j),fe-G)*(180/Math.PI),_e={priceDiff:f,pricePct:b,bars:N,days:W,angle:Ue},ze=new hv({rawTime:M.rawTime,price:M.price},{rawTime:d,price:S},_e);C.attachPrimitive(ze);const Re={type:"infoline",primitive:ze,p1:{time:I,price:M.price},p2:{time:U,price:S}};le(rA=>[...rA,Re]),u.current.push(Re),M=null,Be(null)};return P.addEventListener("mousemove",ie),P.addEventListener("click",te),()=>{if(P.removeEventListener("mousemove",ie),P.removeEventListener("click",te),K)try{v.removeSeries(K)}catch{}}}if(x==="rulerline"){let M=null,K=null;const ie=(T,E,g,d)=>{const S=Ae(T),I=Ae(g),U=d-E,f=U/Math.abs(E)*100,b=Wt(we)||3600,H=Math.abs((I??0)-(S??0)),O=Math.max(1,Math.round(H/b)),N=Math.max(1,Math.round(H/86400));return{priceDiff:U,pricePct:f,bars:O,days:N}},te=T=>{if(!M)return;const E=P.getBoundingClientRect(),g=T.clientX-E.left,d=T.clientY-E.top,S=v.timeScale().coordinateToTime(g),I=C.coordinateToPrice(d);if(S==null||I==null)return;const U=Ae(S);if(U==null||U===M.normalizedTime)return;const f=ie(M.rawTime,M.price,S,I);if(!K)K=new td({rawTime:M.rawTime,price:M.price},{rawTime:S,price:I},f),C.attachPrimitive(K);else{K.p2={rawTime:S,price:I},K.info=f;const b=I>=M.price;K.color=b?"#3b82f6":"#ef5350",K.fillColor=b?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{l.current?.applyOptions({})}catch{}}},w=T=>{const E=P.getBoundingClientRect(),g=T.clientX-E.left,d=T.clientY-E.top,S=v.timeScale().coordinateToTime(g),I=C.coordinateToPrice(d);if(S==null||I==null)return;if(!M){M={rawTime:S,price:I,normalizedTime:Ae(S)};return}if(K){try{C.detachPrimitive(K)}catch{}K=null}const U=M.normalizedTime,f=Ae(S);if(U==null||f==null)return;const b=ie(M.rawTime,M.price,S,I),H=new td({rawTime:M.rawTime,price:M.price},{rawTime:S,price:I},b);C.attachPrimitive(H);const O={type:"rulerline",primitive:H,p1:{rawTime:M.rawTime,normalizedTime:U,price:M.price},p2:{rawTime:S,normalizedTime:f,price:I}};le(N=>[...N,O]),u.current.push(O),M=null,Be(null)};return P.addEventListener("mousemove",te),P.addEventListener("click",w),()=>{if(P.removeEventListener("mousemove",te),P.removeEventListener("click",w),K)try{C.detachPrimitive(K)}catch{}}}if(x==="arrowedline"){let M=null,K=null;const ie=w=>{if(!M)return;const T=P.getBoundingClientRect(),E=w.clientX-T.left,g=w.clientY-T.top,d=v.timeScale().coordinateToTime(E),S=C.coordinateToPrice(g);if(d==null||S==null)return;const I=Ae(d);if(!(I==null||I===M.normalizedTime))if(!K)K=new rd({rawTime:M.rawTime,price:M.price},{rawTime:d,price:S}),C.attachPrimitive(K);else{K.p2={rawTime:d,price:S};try{l.current?.applyOptions({})}catch{}}},te=w=>{const T=P.getBoundingClientRect(),E=w.clientX-T.left,g=w.clientY-T.top,d=v.timeScale().coordinateToTime(E),S=C.coordinateToPrice(g);if(d==null||S==null)return;if(!M){M={rawTime:d,price:S,normalizedTime:Ae(d)};return}if(K){try{C.detachPrimitive(K)}catch{}K=null}const I=M.normalizedTime,U=Ae(d);if(I==null||U==null||I===U)return;const f=new rd({rawTime:M.rawTime,price:M.price},{rawTime:d,price:S});C.attachPrimitive(f);const b={type:"arrowedline",primitive:f,p1:{rawTime:M.rawTime,normalizedTime:I,price:M.price},p2:{rawTime:d,normalizedTime:U,price:S}};le(H=>[...H,b]),u.current.push(b),M=null,Be(null)};return P.addEventListener("mousemove",ie),P.addEventListener("click",te),()=>{if(P.removeEventListener("mousemove",ie),P.removeEventListener("click",te),K)try{C.detachPrimitive(K)}catch{}}}if(x==="rayline"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const g=te+140,d=v.timeScale().coordinateToTime(g);if(d==null)return;const S=Ae(T),I=Ae(d);if(S==null||I==null)return;const U=new gv({rawTime:T,price:E},{rawTime:d,price:E});C.attachPrimitive(U);const f={type:"rayline",primitive:U,p1:{rawTime:T,normalizedTime:S,price:E},p2:{rawTime:d,normalizedTime:I,price:E}};le(b=>[...b,f]),u.current.push(f),Be(null)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="extendedline"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const g=te+140,d=v.timeScale().coordinateToTime(g);if(d==null)return;const S=Ae(T),I=Ae(d);if(S==null||I==null)return;const U=new mv({rawTime:T,price:E},{rawTime:d,price:E});C.attachPrimitive(U);const f={type:"extendedline",primitive:U,p1:{rawTime:T,normalizedTime:S,price:E},p2:{rawTime:d,normalizedTime:I,price:E}};le(b=>[...b,f]),u.current.push(f),Be(null)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="crossline"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const g=Ae(T);if(g==null)return;const d=new Bv({rawTime:T,price:E});C.attachPrimitive(d);const S={type:"crossline",primitive:d,p:{rawTime:T,normalizedTime:g,price:E}};le(I=>[...I,S]),u.current.push(S),Be(null)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="trendbyangle"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const g=te+140,d=v.timeScale().coordinateToTime(g);if(d==null)return;const S=Ae(T),I=Ae(d);if(S==null||I==null)return;const U=new wv({rawTime:T,price:E},{rawTime:d,price:E});C.attachPrimitive(U);const f={type:"trendbyangle",primitive:U,p1:{rawTime:T,normalizedTime:S,price:E},p2:{rawTime:d,normalizedTime:I,price:E}};le(b=>[...b,f]),u.current.push(f),Be(null)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="disjointchannel"){let M=null,K=null,ie=null,te=null,w=0,T=null;const E=(S,I,U,f)=>{if(!T)T=new hl(S,I,U,f),C.attachPrimitive(T);else{T.p1=S,T.p2=I,T.p3=U,T.p4=f;try{l.current?.applyOptions({})}catch{}}},g=S=>{if(w===0||!M)return;const I=P.getBoundingClientRect(),U=S.clientX-I.left,f=S.clientY-I.top;if(w===1){const b=C.coordinateToPrice(f);if(b==null)return;K={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:b},E({rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price},{rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price});return}if(w===2&&K){const b=v.timeScale().coordinateToTime(U),H=C.coordinateToPrice(f);if(b==null||H==null)return;const O=Ae(b);if(O==null)return;const N=(M.price+K.price)/2;H>=N?(ie={rawTime:b,normalizedTime:O,price:H},te={rawTime:b,normalizedTime:O,price:2*N-H}):(te={rawTime:b,normalizedTime:O,price:H},ie={rawTime:b,normalizedTime:O,price:2*N-H}),E({rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price},{rawTime:ie.rawTime,price:ie.price},{rawTime:te.rawTime,price:te.price})}},d=S=>{const I=P.getBoundingClientRect(),U=S.clientX-I.left,f=S.clientY-I.top,b=v.timeScale().coordinateToTime(U),H=C.coordinateToPrice(f);if(b==null||H==null)return;const O=Ae(b);if(O!=null){if(w===0){M={rawTime:b,normalizedTime:O,price:H},K={rawTime:b,normalizedTime:O,price:H},w=1,E({rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price},{rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price});return}if(w===1){const N=C.coordinateToPrice(f);if(N==null||Math.abs(N-M.price)<1e-7)return;K={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:N},w=2;return}if(w===2&&T){try{C.detachPrimitive(T)}catch{}const N=new hl(T.p1,T.p2,T.p3,T.p4);C.attachPrimitive(N);const W={type:"disjointchannel",primitive:N,p1:M,p2:K,p3:{rawTime:T.p3.rawTime,normalizedTime:Ae(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:Ae(T.p4.rawTime),price:T.p4.price}};le(G=>[...G,W]),u.current.push(W),Be(null)}}};return P.addEventListener("mousemove",g),P.addEventListener("click",d),()=>{if(P.removeEventListener("mousemove",g),P.removeEventListener("click",d),T)try{C.detachPrimitive(T)}catch{}}}if(x==="flattopbottom"){let M=null,K=null,ie=null,te=null,w=0,T=null;const E=(S,I,U,f)=>{if(!T)T=new id(S,I,U,f),C.attachPrimitive(T);else{T.p1=S,T.p2=I,T.p3=U,T.p4=f;try{l.current?.applyOptions({})}catch{}}},g=S=>{if(w===0||!M)return;const I=P.getBoundingClientRect(),U=S.clientX-I.left,f=S.clientY-I.top;if(w===1){const b=C.coordinateToPrice(f);if(b==null)return;K={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:b},E({rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price},{rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price});return}if(w===2&&K){const b=v.timeScale().coordinateToTime(U),H=C.coordinateToPrice(f);if(b==null||H==null)return;const O=Ae(b);if(O==null)return;ie={rawTime:b,normalizedTime:O,price:H},te={rawTime:b,normalizedTime:O,price:K.price},E({rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price},{rawTime:ie.rawTime,price:ie.price},{rawTime:te.rawTime,price:te.price})}},d=S=>{const I=P.getBoundingClientRect(),U=S.clientX-I.left,f=S.clientY-I.top,b=v.timeScale().coordinateToTime(U),H=C.coordinateToPrice(f);if(b==null||H==null)return;const O=Ae(b);if(O!=null){if(w===0){M={rawTime:b,normalizedTime:O,price:H},K={rawTime:b,normalizedTime:O,price:H},w=1,E({rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price},{rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price});return}if(w===1){const N=C.coordinateToPrice(f);if(N==null||Math.abs(N-M.price)<1e-7)return;K={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:N},w=2;return}if(w===2&&T){try{C.detachPrimitive(T)}catch{}const N=new id(T.p1,T.p2,T.p3,T.p4);C.attachPrimitive(N);const W={type:"flattopbottom",primitive:N,p1:M,p2:K,p3:{rawTime:T.p3.rawTime,normalizedTime:Ae(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:Ae(T.p4.rawTime),price:T.p4.price}};le(G=>[...G,W]),u.current.push(W),Be(null)}}};return P.addEventListener("mousemove",g),P.addEventListener("click",d),()=>{if(P.removeEventListener("mousemove",g),P.removeEventListener("click",d),T)try{C.detachPrimitive(T)}catch{}}}if(x==="regressionchannel"){let M=null,K=null;const ie=(T,E)=>{T.mid1={rawTime:E.p1.rawTime,price:E.p1.price},T.mid2={rawTime:E.p2.rawTime,price:E.p2.price},T.top1={rawTime:E.top1.rawTime,price:E.top1.price},T.top2={rawTime:E.top2.rawTime,price:E.top2.price},T.bot1={rawTime:E.bot1.rawTime,price:E.bot1.price},T.bot2={rawTime:E.bot2.rawTime,price:E.bot2.price}},te=T=>{if(!M)return;const E=P.getBoundingClientRect(),g=T.clientX-E.left,d=T.clientY-E.top,S=v.timeScale().coordinateToTime(g),I=C.coordinateToPrice(d);if(S==null||I==null)return;const U=Ae(S);if(U==null)return;const b=qn(ne,M,{rawTime:S,normalizedTime:U},1);if(b)if(!K)K=new ul({rawTime:b.p1.rawTime,price:b.p1.price},{rawTime:b.p2.rawTime,price:b.p2.price},{rawTime:b.top1.rawTime,price:b.top1.price},{rawTime:b.top2.rawTime,price:b.top2.price},{rawTime:b.bot1.rawTime,price:b.bot1.price},{rawTime:b.bot2.rawTime,price:b.bot2.price}),C.attachPrimitive(K);else{ie(K,b);try{v.applyOptions({})}catch{}}},w=T=>{const E=P.getBoundingClientRect(),g=T.clientX-E.left,d=T.clientY-E.top,S=v.timeScale().coordinateToTime(g),I=C.coordinateToPrice(d);if(S==null||I==null)return;const U=Ae(S);if(U==null)return;if(!M){M={rawTime:S,normalizedTime:U,price:I};return}const b=qn(ne,M,{rawTime:S,normalizedTime:U},1);if(!b)return;if(K){try{C.detachPrimitive(K)}catch{}K=null}const H=new ul({rawTime:b.p1.rawTime,price:b.p1.price},{rawTime:b.p2.rawTime,price:b.p2.price},{rawTime:b.top1.rawTime,price:b.top1.price},{rawTime:b.top2.rawTime,price:b.top2.price},{rawTime:b.bot1.rawTime,price:b.bot1.price},{rawTime:b.bot2.rawTime,price:b.bot2.price});C.attachPrimitive(H);const O={type:"regressionchannel",primitive:H,p1:b.p1,p2:b.p2,top1:b.top1,top2:b.top2,bot1:b.bot1,bot2:b.bot2,slope:b.slope,intercept:b.intercept,stdDev:b.stdDev,offset:b.offset,barCount:b.barCount,stdMultiplier:1};le(N=>[...N,O]),u.current.push(O),M=null,Be(null)};return P.addEventListener("mousemove",te),P.addEventListener("click",w),()=>{if(P.removeEventListener("mousemove",te),P.removeEventListener("click",w),K)try{C.detachPrimitive(K)}catch{}}}if(x==="stddevchannel"){let M=null,K=null;const ie=(T,E)=>{T.mid1={rawTime:E.p1.rawTime,price:E.p1.price},T.mid2={rawTime:E.p2.rawTime,price:E.p2.price},T.top1={rawTime:E.top1.rawTime,price:E.top1.price},T.top2={rawTime:E.top2.rawTime,price:E.top2.price},T.bot1={rawTime:E.bot1.rawTime,price:E.bot1.price},T.bot2={rawTime:E.bot2.rawTime,price:E.bot2.price}},te=T=>{if(!M)return;const E=P.getBoundingClientRect(),g=T.clientX-E.left,d=T.clientY-E.top,S=v.timeScale().coordinateToTime(g),I=C.coordinateToPrice(d);if(S==null||I==null)return;const U=Ae(S);if(U==null)return;const b=dl(ne,M,{rawTime:S,normalizedTime:U},1);if(b)if(!K)K=new sd({rawTime:b.p1.rawTime,price:b.p1.price},{rawTime:b.p2.rawTime,price:b.p2.price},{rawTime:b.top1.rawTime,price:b.top1.price},{rawTime:b.top2.rawTime,price:b.top2.price},{rawTime:b.bot1.rawTime,price:b.bot1.price},{rawTime:b.bot2.rawTime,price:b.bot2.price}),C.attachPrimitive(K);else{ie(K,b);try{v.applyOptions({})}catch{}}},w=T=>{const E=P.getBoundingClientRect(),g=T.clientX-E.left,d=T.clientY-E.top,S=v.timeScale().coordinateToTime(g),I=C.coordinateToPrice(d);if(S==null||I==null)return;const U=Ae(S);if(U==null)return;if(!M){M={rawTime:S,normalizedTime:U,price:I};return}const b=dl(ne,M,{rawTime:S,normalizedTime:U},1);if(!b)return;if(K){try{C.detachPrimitive(K)}catch{}K=null}const H=new sd({rawTime:b.p1.rawTime,price:b.p1.price},{rawTime:b.p2.rawTime,price:b.p2.price},{rawTime:b.top1.rawTime,price:b.top1.price},{rawTime:b.top2.rawTime,price:b.top2.price},{rawTime:b.bot1.rawTime,price:b.bot1.price},{rawTime:b.bot2.rawTime,price:b.bot2.price});C.attachPrimitive(H);const O={type:"stddevchannel",primitive:H,p1:b.p1,p2:b.p2,top1:b.top1,top2:b.top2,bot1:b.bot1,bot2:b.bot2,slope:b.slope,stdDev:b.stdDev,offset:b.offset,barCount:b.barCount,stdMultiplier:1};le(N=>[...N,O]),u.current.push(O),M=null,Be(null)};return P.addEventListener("mousemove",te),P.addEventListener("click",w),()=>{if(P.removeEventListener("mousemove",te),P.removeEventListener("click",w),K)try{C.detachPrimitive(K)}catch{}}}if(x==="andrewspitchfork"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const g=Ae(T);if(g==null)return;const d=te+140,S=v.timeScale().coordinateToTime(d);if(S==null)return;const I=Ae(S);if(I==null)return;const U={rawTime:T,normalizedTime:g,price:E},f={rawTime:S,normalizedTime:I,price:E},b={rawTime:T,normalizedTime:g,price:E},H=new Cv({rawTime:U.rawTime,price:U.price},{rawTime:f.rawTime,price:f.price},{rawTime:b.rawTime,price:b.price});C.attachPrimitive(H);const O={type:"andrewspitchfork",primitive:H,p1:U,p2:f,p3:b};le(N=>[...N,O]),u.current.push(O),_(O),se.current=O,Be(null)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="gannfan"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const g=Ae(T);if(g==null)return;const d={rawTime:T,normalizedTime:g,price:E},S={rawTime:T,normalizedTime:g,price:E},I=new vv({rawTime:d.rawTime,price:d.price},{rawTime:S.rawTime,price:S.price});C.attachPrimitive(I);const U={type:"gannfan",primitive:I,p1:d,p2:S};le(f=>[...f,U]),u.current.push(U),_(U),se.current=U,Be(null)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="ganngrid"){const M=K=>{const ie=P.getBoundingClientRect(),te=K.clientX-ie.left,w=K.clientY-ie.top,T=v.timeScale().coordinateToTime(te),E=C.coordinateToPrice(w);if(T==null||E==null)return;const g=Ae(T);if(g==null)return;const d={rawTime:T,normalizedTime:g,price:E},S={rawTime:T,normalizedTime:g,price:E},I=new yv({rawTime:d.rawTime,price:d.price},{rawTime:S.rawTime,price:S.price});C.attachPrimitive(I);const U={type:"ganngrid",primitive:I,p1:d,p2:S};le(f=>[...f,U]),u.current.push(U),_(U),se.current=U,Be(null)};return P.addEventListener("click",M),()=>P.removeEventListener("click",M)}if(x==="trendline"||x==="gannline"){const M=x,K=M==="gannline"?"#7aa6ae":"#22c55e",ie=E=>{E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const g=P.getBoundingClientRect(),d=E.clientX-g.left,S=E.clientY-g.top;let I=v.timeScale().coordinateToTime(d);const U=C.coordinateToPrice(S);if(!(I==null||U==null)&&(I=Ae(I),I!=null))if(Q.current===null){Q.current={time:I,price:U};const f=v.addLineSeries({color:K,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});p.current={type:M,series:f},f.setData([{time:I,value:U}])}else{const f=Q.current,b={time:I,price:U},H=1,O=1e-5,N=Math.abs(b.time-f.time),W=Math.abs(b.price-f.price);if(N<H&&W<O){try{v.removeSeries(p.current.series)}catch{}Q.current=null,p.current=null;return}const G={time:f.time,price:f.price},j={time:b.time,price:b.price},fe=qt([{time:G.time,value:G.price},{time:j.time,value:j.price}]);if(fe.length>0){p.current.series.setData(fe);const me={type:M,series:p.current.series,point1:G,point2:j};le(Ue=>[...Ue,me]),u.current.push(me)}Be(null),Q.current=null,p.current=null}},te=E=>{if(Q.current===null||p.current?.type!=="trendline"&&p.current?.type!=="gannline")return;E.preventDefault(),E.stopPropagation();const g=P.getBoundingClientRect(),d=E.clientX-g.left,S=E.clientY-g.top;let I=v.timeScale().coordinateToTime(d);const U=C.coordinateToPrice(S);if(I==null||U==null||(I=Ae(I),I==null))return;const f=Q.current,b=qt([{time:f.time,value:f.price},{time:I,value:U}]);b.length>0&&p.current.series.setData(b)},w=E=>{E.stopPropagation()},T={capture:!0,passive:!1};return P.addEventListener("click",ie,T),P.addEventListener("mousemove",te,T),P.addEventListener("mousemove",w,T),()=>{if(Q.current=null,(p.current?.type==="trendline"||p.current?.type==="gannline")&&p.current?.series){try{v.removeSeries(p.current.series)}catch{}p.current=null}P.removeEventListener("click",ie,T),P.removeEventListener("mousemove",te,T),P.removeEventListener("mousemove",w,T)}}if(x==="parallellines"){let M=null,K=null,ie=null,te=0,w=null;const T=(U,f,b,H)=>{U.p1={rawTime:f.rawTime,price:f.price},U.p2={rawTime:b.rawTime,price:b.price},U.b1={rawTime:H.b1.rawTime,price:H.b1.price},U.b2={rawTime:H.b2.rawTime,price:H.b2.price},U.p3={rawTime:H.bottomMid.rawTime,price:H.bottomMid.price}},E=(U,f,b)=>{const H=ad(U,f,b);if(!H)return null;if(!w)w=new nd({rawTime:U.rawTime,price:U.price},{rawTime:f.rawTime,price:f.price},{rawTime:H.b1.rawTime,price:H.b1.price},{rawTime:H.b2.rawTime,price:H.b2.price},{rawTime:H.bottomMid.rawTime,price:H.bottomMid.price}),C.attachPrimitive(w);else{T(w,U,f,H);try{v.applyOptions({})}catch{}}return H},g=U=>{U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation();const f=P.getBoundingClientRect(),b=U.clientX-f.left,H=U.clientY-f.top,O=v.timeScale().coordinateToTime(b),N=C.coordinateToPrice(H);if(O==null||N==null)return;const W=Ae(O);if(W!=null){if(te===0){M={rawTime:O,normalizedTime:W,price:N},te=1;return}if(te===1){if(K={rawTime:O,normalizedTime:W,price:N},Math.abs(K.normalizedTime-M.normalizedTime)<1)return;const G=Ae((M.normalizedTime+K.normalizedTime)/2);if(G==null)return;const j=(M.price+K.price)/2;ie={rawTime:G,normalizedTime:G,price:j},E(M,K,ie),te=2;return}if(te===2&&M&&K){ie={rawTime:O,normalizedTime:W,price:N};const G=E(M,K,ie);if(!G||!w)return;try{C.detachPrimitive(w)}catch{}const j=new nd({rawTime:M.rawTime,price:M.price},{rawTime:K.rawTime,price:K.price},{rawTime:G.b1.rawTime,price:G.b1.price},{rawTime:G.b2.rawTime,price:G.b2.price},{rawTime:G.bottomMid.rawTime,price:G.bottomMid.price});C.attachPrimitive(j);const fe={type:"equidistantchannel",primitive:j,p1:M,p2:K,p3:G.bottomMid,b1:G.b1,b2:G.b2,bottomMid:G.bottomMid};le(me=>[...me,fe]),u.current.push(fe),Be(null),te=0,M=null,K=null,ie=null,w=null}}},d=U=>{if(te===0||!M)return;const f=P.getBoundingClientRect(),b=U.clientX-f.left,H=U.clientY-f.top,O=v.timeScale().coordinateToTime(b),N=C.coordinateToPrice(H);if(O==null||N==null)return;const W=Ae(O);if(W!=null){if(te===1){const G={rawTime:O,normalizedTime:W,price:N},j=Ae((M.normalizedTime+G.normalizedTime)/2);if(j==null)return;const fe=(M.price+G.price)/2;E(M,G,{rawTime:j,normalizedTime:j,price:fe});return}te===2&&K&&E(M,K,{rawTime:O,normalizedTime:W,price:N})}},S=U=>{U.stopPropagation()},I={capture:!0,passive:!1};return P.addEventListener("click",g,I),P.addEventListener("mousemove",d,I),P.addEventListener("mousemove",S,I),()=>{if(te=0,M=null,K=null,ie=null,D.current=[],w)try{C.detachPrimitive(w)}catch{}w=null,P.removeEventListener("click",g,I),P.removeEventListener("mousemove",d,I),P.removeEventListener("mousemove",S,I)}}if(x==="fibonacci"){let M=null,K=null;const ie=w=>{if(!M)return;const T=P.getBoundingClientRect(),E=w.clientX-T.left,g=w.clientY-T.top,d=v.timeScale().coordinateToTime(E),S=C.coordinateToPrice(g);if(!(d==null||S==null))if(!K)K=new od({rawTime:M.rawTime,price:M.price},{rawTime:d,price:S}),C.attachPrimitive(K);else{K.p2={rawTime:d,price:S};try{v.applyOptions({})}catch{}}},te=w=>{const T=P.getBoundingClientRect(),E=w.clientX-T.left,g=w.clientY-T.top,d=v.timeScale().coordinateToTime(E),S=C.coordinateToPrice(g);if(d==null||S==null)return;if(!M){M={rawTime:d,price:S,normalizedTime:Ae(d)};return}if(K){try{C.detachPrimitive(K)}catch{}K=null}const I=M.normalizedTime,U=Ae(d);if(I==null||U==null)return;if(Math.abs(S-M.price)<1e-5){M=null;return}const f=new od({rawTime:M.rawTime,price:M.price},{rawTime:d,price:S});C.attachPrimitive(f);const b={type:"fibonacci",primitive:f,p1:{rawTime:M.rawTime,normalizedTime:I,price:M.price},p2:{rawTime:d,normalizedTime:U,price:S}};le(H=>[...H,b]),u.current.push(b),M=null,Be(null)};return P.addEventListener("mousemove",ie),P.addEventListener("click",te),()=>{if(P.removeEventListener("mousemove",ie),P.removeEventListener("click",te),K)try{C.detachPrimitive(K)}catch{}}}if(Q.current=null,(p.current?.type==="trendline"||p.current?.type==="gannline")&&p.current?.series){try{v.removeSeries(p.current.series)}catch{}p.current=null}const re=M=>{if(M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation(),x==="trendline"||x==="gannline"||x==="parallellines"||x==="fibonacci"||x!=="rectangle"&&x!=="circle"&&x!=="triangle"&&x!=="ellipse")return;const K=P.getBoundingClientRect(),ie=M.clientX-K.left,te=M.clientY-K.top;let w=v.timeScale().coordinateToTime(ie);const T=C.coordinateToPrice(te);if(w==null||T==null)return;const E=w;if(w=Ae(w),w!=null){if(m.current=!0,y.current={time:w,normalizedTime:w,rawTime:E,price:T},B.current=null,x==="rectangle"){const g=new uv({rawTime:E,price:T},{rawTime:E,price:T},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});C.attachPrimitive(g),p.current={type:"rectangle",primitive:g}}if(x==="circle"){const g=new dv({rawTime:E,price:T},{rawTime:E,price:T},{strokeColor:"#7aa6ae",lineWidth:1});C.attachPrimitive(g),p.current={type:"circle",primitive:g}}if(x==="triangle"){const g=new fv({rawTime:E,price:T},{rawTime:E,price:T},{rawTime:E,price:T},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});C.attachPrimitive(g),p.current={type:"triangle",primitive:g}}if(x==="ellipse"){const g=new pv({rawTime:E,price:T},{rawTime:E,price:T},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});C.attachPrimitive(g),p.current={type:"ellipse",primitive:g}}if(x==="parallellines"){const g=v.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});p.current={type:"parallellines",series:g,firstLine:null,secondLine:null}}}},ee=M=>{if(!m.current||!y.current||!p.current)return;M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation();const K=P.getBoundingClientRect(),ie=M.clientX-K.left,te=M.clientY-K.top;let w=v.timeScale().coordinateToTime(ie);const T=C.coordinateToPrice(te);if(w==null||T==null)return;const E=w;if(w=Ae(w),w==null)return;B.current={time:w,normalizedTime:w,rawTime:E,price:T};const g=y.current;if(p.current.type==="rectangle"){const d=p.current.primitive;d.p1={rawTime:g.rawTime,price:g.price},d.p2={rawTime:E,price:T};try{l.current?.applyOptions({})}catch{}}if(p.current.type==="circle"){const d=p.current.primitive;d.p1={rawTime:g.rawTime,price:g.price},d.p2={rawTime:E,price:T};try{l.current?.applyOptions({})}catch{}}if(p.current.type==="triangle"){const d=p.current.primitive,S=q(g,{time:w,rawTime:E,price:T});if(!S)return;d.p1={rawTime:S.p1.rawTime,price:S.p1.price},d.p2={rawTime:S.p2.rawTime,price:S.p2.price},d.p3={rawTime:S.p3.rawTime,price:S.p3.price};try{l.current?.applyOptions({})}catch{}}if(p.current.type==="ellipse"){const d=p.current.primitive;d.p1={rawTime:g.rawTime,price:g.price},d.p2={rawTime:E,price:T};try{l.current?.applyOptions({})}catch{}}if(p.current.type==="parallellines")if(p.current.firstLine){const d=p.current.firstLine;d.endTime-d.startTime;const S=d.endPrice-d.startPrice,I=T,U=I+S;if(p.current.secondLine)p.current.secondLine.setData([{time:g.time,value:I},{time:w,value:U}]);else{const f=v.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});f.setData([{time:g.time,value:I},{time:w,value:U}]),p.current.secondLine=f}}else p.current.series.setData([{time:g.time,value:g.price},{time:w,value:T}])},he=M=>{if(M&&(M.preventDefault(),M.stopPropagation()),!m.current||!p.current||!y.current)return;const K=y.current,ie=B.current||K;if(p.current.type==="parallellines")if(p.current.firstLine){const te={type:"parallellines",firstLine:p.current.series,secondLine:p.current.secondLine,firstLineData:p.current.firstLine};le(w=>[...w,te]),u.current.push(te),Be(null),p.current=null,m.current=!1,y.current=null,B.current=null;return}else{p.current.firstLine={startTime:K.time,startPrice:K.price,endTime:ie.time,endPrice:ie.price},m.current=!1,y.current=null,B.current=null;return}if(p.current.type==="rectangle"){const te=y.current,w=B.current||te,T=Math.max(te.price,w.price),E=Math.min(te.price,w.price),g=Ae(Math.min(te.time,w.time)),d=Ae(Math.max(te.time,w.time));if(g!=null&&d!=null&&Math.abs(d-g)>=1&&Math.abs(T-E)>=1e-5){const S=p.current.primitive,I=te.time<=w.time?te.rawTime:w.rawTime,U=te.time<=w.time?w.rawTime:te.rawTime,f={rawTime:I,normalizedTime:g,price:T},b={rawTime:U,normalizedTime:d,price:E};S.p1={rawTime:f.rawTime,price:f.price},S.p2={rawTime:b.rawTime,price:b.price};const H={type:"rectangle",primitive:S,p1:f,p2:b};le(O=>[...O,H]),u.current.push(H),Be(null)}else try{C.detachPrimitive(p.current.primitive)}catch{}}if(p.current.type==="circle"){const te=p.current.primitive,w={rawTime:K.rawTime,normalizedTime:K.time,price:K.price},T={rawTime:ie.rawTime,normalizedTime:ie.time,price:ie.price},E=v.timeScale().timeToCoordinate(w.rawTime),g=C.priceToCoordinate(w.price),d=v.timeScale().timeToCoordinate(T.rawTime),S=C.priceToCoordinate(T.price);if((E!=null&&g!=null&&d!=null&&S!=null?Math.hypot(d-E,S-g):0)>=3){te.p1={rawTime:w.rawTime,price:w.price},te.p2={rawTime:T.rawTime,price:T.price};const U={type:"circle",primitive:te,p1:w,p2:T};le(f=>[...f,U]),u.current.push(U),Be(null)}else try{C.detachPrimitive(p.current.primitive)}catch{}}if(p.current.type==="triangle"){const te=p.current.primitive,w=q(K,ie);if(w){const T=Math.abs(w.p3.normalizedTime-w.p2.normalizedTime),E=Math.abs(w.p1.price-w.p2.price);if(T>=1&&E>=1e-5){te.p1={rawTime:w.p1.rawTime,price:w.p1.price},te.p2={rawTime:w.p2.rawTime,price:w.p2.price},te.p3={rawTime:w.p3.rawTime,price:w.p3.price};const g={type:"triangle",primitive:te,p1:w.p1,p2:w.p2,p3:w.p3};le(d=>[...d,g]),u.current.push(g),Be(null)}else try{C.detachPrimitive(p.current.primitive)}catch{}}else try{C.detachPrimitive(p.current.primitive)}catch{}}if(p.current.type==="ellipse"){const te=p.current.primitive,w={rawTime:K.rawTime,normalizedTime:K.time,price:K.price},T={rawTime:ie.rawTime,normalizedTime:ie.time,price:ie.price},E=v.timeScale().timeToCoordinate(w.rawTime),g=C.priceToCoordinate(w.price),d=v.timeScale().timeToCoordinate(T.rawTime),S=C.priceToCoordinate(T.price);if((E!=null&&g!=null&&d!=null&&S!=null?Math.hypot(d-E,S-g):0)>=4){te.p1={rawTime:w.rawTime,price:w.price},te.p2={rawTime:T.rawTime,price:T.price},te.previewAsLine=!1,te.minorRatio=.45;const U={type:"ellipse",primitive:te,p1:w,p2:T,minorRatio:.45};le(f=>[...f,U]),u.current.push(U),Be(null)}else try{C.detachPrimitive(p.current.primitive)}catch{}}m.current=!1,y.current=null,B.current=null,p.current=null};if(x==="rectangle"||x==="circle"||x==="triangle"||x==="ellipse"){const M={capture:!0,passive:!1},K=ie=>{m.current||ie.stopPropagation()};return P.addEventListener("mousedown",re,M),P.addEventListener("mousemove",ee,M),P.addEventListener("mousemove",K,M),P.addEventListener("mouseup",he,M),()=>{if((p.current?.type==="rectangle"||p.current?.type==="circle"||p.current?.type==="triangle"||p.current?.type==="ellipse")&&p.current?.primitive)try{C.detachPrimitive(p.current.primitive)}catch{}p.current=null,m.current=!1,y.current=null,B.current=null,P.removeEventListener("mousedown",re,M),P.removeEventListener("mousemove",ee,M),P.removeEventListener("mousemove",K,M),P.removeEventListener("mouseup",he,M)}}},[pe,ne,le,Be]),J.useEffect(()=>{const v=l.current,C=a.current,P=o.current,He=pe===null||pe===1;if(!He||!v||!C||!P){He||(_(null),k([]),Z(null),z([]));return}const x=10,q=8;function re(w){if(!w)return[];if(w.type==="trendline"&&w.point1&&w.point2){const T=v.timeScale().timeToCoordinate(w.point1.time),E=C.priceToCoordinate(w.point1.price),g=v.timeScale().timeToCoordinate(w.point2.time),d=C.priceToCoordinate(w.point2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="gannline"&&w.point1&&w.point2){const T=v.timeScale().timeToCoordinate(w.point1.time),E=C.priceToCoordinate(w.point1.price),g=v.timeScale().timeToCoordinate(w.point2.time),d=C.priceToCoordinate(w.point2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:(T+g)/2,y:(E+d)/2},{x:g,y:d}]}if(w.type==="rectangle"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);if(T==null||E==null||g==null||d==null)return[];const S=Math.min(T,g),I=Math.max(T,g),U=Math.min(E,d),f=Math.max(E,d),b=(S+I)/2,H=(U+f)/2;return[{x:S,y:U},{x:b,y:U},{x:I,y:U},{x:S,y:H},{x:I,y:H},{x:S,y:f},{x:b,y:f},{x:I,y:f}]}if(w.type==="circle"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price),S=v.timeScale().timeToCoordinate(w.p3.rawTime),I=C.priceToCoordinate(w.p3.price);return T==null||E==null||g==null||d==null||S==null||I==null?[]:[{x:T,y:E},{x:g,y:d},{x:S,y:I}]}if(w.type==="ellipse"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);if(T==null||E==null||g==null||d==null)return[];const S=(T+g)/2,I=(E+d)/2,U=g-T,f=d-E,b=Math.hypot(U,f);if(b<.001)return[];const H=U/b,O=f/b,N=-O,W=H,G=b/2,j=G*Math.max(.05,w.minorRatio??.45);return[{x:S-H*G,y:I-O*G},{x:S+N*j,y:I+W*j},{x:S+H*G,y:I+O*G},{x:S-N*j,y:I-W*j}]}if(w.type==="gannfan"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="ganngrid"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="arrowedline"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="rayline"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="extendedline"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="crossline"&&w.p){const T=v.timeScale().timeToCoordinate(w.p.rawTime),E=C.priceToCoordinate(w.p.price);return T==null||E==null?[]:[{x:T,y:E}]}if(w.type==="trendbyangle"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price),S=v.timeScale().timeToCoordinate(w.p3.rawTime),I=C.priceToCoordinate(w.p3.price);return T==null||E==null||g==null||d==null||S==null||I==null?[]:[{x:T,y:E},{x:g,y:d},{x:S,y:I}]}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price),S=v.timeScale().timeToCoordinate(w.b1.rawTime),I=C.priceToCoordinate(w.b1.price),U=v.timeScale().timeToCoordinate(w.b2.rawTime),f=C.priceToCoordinate(w.b2.price);return T==null||E==null||g==null||d==null||S==null||I==null||U==null||f==null?[]:[{x:T,y:E},{x:g,y:d},{x:(S+U)/2,y:(I+f)/2}]}if(w.type==="regressionchannel"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="stddevchannel"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price),S=v.timeScale().timeToCoordinate(w.p3.rawTime),I=C.priceToCoordinate(w.p3.price),U=v.timeScale().timeToCoordinate(w.p4.rawTime),f=C.priceToCoordinate(w.p4.price);return T==null||E==null||g==null||d==null||S==null||I==null||U==null||f==null?[]:[{x:T,y:E},{x:g,y:d},{x:S,y:I},{x:U,y:f}]}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price),S=v.timeScale().timeToCoordinate(w.p3.rawTime),I=C.priceToCoordinate(w.p3.price),U=v.timeScale().timeToCoordinate(w.p4.rawTime),f=C.priceToCoordinate(w.p4.price);return T==null||E==null||g==null||d==null||S==null||I==null||U==null||f==null?[]:[{x:T,y:E},{x:g,y:d},{x:S,y:I},{x:U,y:f}]}if(w.type==="rulerline"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:(T+g)/2,y:(E+d)/2},{x:g,y:d}]}if(w.type==="fibonacci"&&w.p1&&w.p2){const T=v.timeScale().timeToCoordinate(w.p1.rawTime),E=C.priceToCoordinate(w.p1.price),g=v.timeScale().timeToCoordinate(w.p2.rawTime),d=C.priceToCoordinate(w.p2.price);return T==null||E==null||g==null||d==null?[]:[{x:T,y:E},{x:g,y:d}]}return[]}function ee(w,T){for(let E=be.length-1;E>=0;E--){const g=be[E];if(g.type==="trendline"&&g.point1&&g.point2){const d=v.timeScale().timeToCoordinate(g.point1.time),S=C.priceToCoordinate(g.point1.price),I=v.timeScale().timeToCoordinate(g.point2.time),U=C.priceToCoordinate(g.point2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(w-d,T-S),b=Math.hypot(w-I,T-U);if(f<x)return{object:g,mode:"handle1"};if(b<x)return{object:g,mode:"handle2"};if(Ze(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="gannline"&&g.point1&&g.point2){const d=v.timeScale().timeToCoordinate(g.point1.time),S=C.priceToCoordinate(g.point1.price),I=v.timeScale().timeToCoordinate(g.point2.time),U=C.priceToCoordinate(g.point2.price);if(d==null||S==null||I==null||U==null)continue;const f=(d+I)/2,b=(S+U)/2,H=Math.hypot(w-d,T-S),O=Math.hypot(w-I,T-U),N=Math.hypot(w-f,T-b);if(H<x)return{object:g,mode:"handle1"};if(O<x)return{object:g,mode:"handle2"};if(N<x)return{object:g,mode:"line"};if(Ze(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="rectangle"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.min(d,I),b=Math.max(d,I),H=Math.min(S,U),O=Math.max(S,U),N=(f+b)/2,W=(H+O)/2,G=[{x:f,y:H,mode:"handle1"},{x:N,y:H,mode:"handle2"},{x:b,y:H,mode:"handle3"},{x:f,y:W,mode:"handle4"},{x:b,y:W,mode:"handle5"},{x:f,y:O,mode:"handle6"},{x:N,y:O,mode:"handle7"},{x:b,y:O,mode:"handle8"}];for(const _e of G)if(Math.hypot(w-_e.x,T-_e.y)<x)return{object:g,mode:_e.mode};const j=Ze(w,T,f,H,b,H),fe=Ze(w,T,f,O,b,O),me=Ze(w,T,f,H,f,O),Ue=Ze(w,T,b,H,b,O);if(j<q||fe<q||me<q||Ue<q||Mt(w,T,[{x:f,y:H},{x:b,y:H},{x:b,y:O},{x:f,y:O}]))return{object:g,mode:"line"}}if(g.type==="circle"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(I-d,U-S);if(f<2)continue;const b=Math.hypot(w-d,T-S),H=Math.hypot(w-I,T-U);if(b<x)return{object:g,mode:"handle1"};if(H<x)return{object:g,mode:"handle2"};if(Math.abs(b-f)<q||b<f)return{object:g,mode:"line"}}if(g.type==="triangle"&&g.p1&&g.p2&&g.p3){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price),f=v.timeScale().timeToCoordinate(g.p3.rawTime),b=C.priceToCoordinate(g.p3.price);if(d==null||S==null||I==null||U==null||f==null||b==null)continue;const H=Math.hypot(w-d,T-S),O=Math.hypot(w-I,T-U),N=Math.hypot(w-f,T-b);if(H<x)return{object:g,mode:"handle1"};if(O<x)return{object:g,mode:"handle2"};if(N<x)return{object:g,mode:"handle3"};const W=Ze(w,T,d,S,I,U),G=Ze(w,T,I,U,f,b),j=Ze(w,T,f,b,d,S);if(W<q||G<q||j<q||Mt(w,T,[{x:d,y:S},{x:I,y:U},{x:f,y:b}]))return{object:g,mode:"line"}}if(g.type==="ellipse"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=(d+I)/2,b=(S+U)/2,H=I-d,O=U-S,N=Math.hypot(H,O);if(N<2)continue;const W=H/N,G=O/N,j=-G,fe=W,me=N/2,Ue=me*Math.max(.05,g.minorRatio??.45);if(me<2||Ue<2)continue;const _e=f-W*me,ze=b-G*me,Re=f+j*Ue,rA=b+fe*Ue,iA=f+W*me,wA=b+G*me,LA=f-j*Ue,At=b-fe*Ue,dt=Math.hypot(w-_e,T-ze),ft=Math.hypot(w-Re,T-rA),Yt=Math.hypot(w-iA,T-wA),As=Math.hypot(w-LA,T-At);if(dt<x)return{object:g,mode:"handle1"};if(ft<x)return{object:g,mode:"handle2"};if(Yt<x)return{object:g,mode:"handle3"};if(As<x)return{object:g,mode:"handle4"};const Zv=(w-f)*W+(T-b)*G,qv=(w-f)*j+(T-b)*fe,gd=Zv/me,md=qv/Ue,Bd=gd*gd+md*md;if(Math.abs(Bd-1)<.2||Bd<1)return{object:g,mode:"line"}}if(g.type==="gannfan"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(w-I,T-U),b=Math.hypot(w-d,T-S);if(f<x)return{object:g,mode:"handle2"};if(b<x)return{object:g,mode:"handle1"};if(Ze(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="ganngrid"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(w-I,T-U),b=Math.hypot(w-d,T-S);if(f<x)return{object:g,mode:"handle2"};if(b<x)return{object:g,mode:"handle1"};if(Ze(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="arrowedline"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(w-d,T-S),b=Math.hypot(w-I,T-U);if(f<x)return{object:g,mode:"handle1"};if(b<x)return{object:g,mode:"handle2"};if(Ze(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="rayline"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(w-d,T-S),b=Math.hypot(w-I,T-U);if(f<x)return{object:g,mode:"handle1"};if(b<x)return{object:g,mode:"handle2"};if(xv(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="extendedline"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(w-d,T-S),b=Math.hypot(w-I,T-U);if(f<x)return{object:g,mode:"handle1"};if(b<x)return{object:g,mode:"handle2"};if(Fv(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="crossline"&&g.p){const d=v.timeScale().timeToCoordinate(g.p.rawTime),S=C.priceToCoordinate(g.p.price);if(d==null||S==null)continue;if(Math.hypot(w-d,T-S)<x)return{object:g,mode:"handle1"};const U=Math.abs(T-S),f=Math.abs(w-d);if(U<q||f<q)return{object:g,mode:"line"}}if(g.type==="trendbyangle"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(w-d,T-S),b=Math.hypot(w-I,T-U);if(f<x)return{object:g,mode:"handle1"};if(b<x)return{object:g,mode:"handle2"};if(Ze(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="equidistantchannel"&&g.p1&&g.p2&&g.b1&&g.b2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price),f=v.timeScale().timeToCoordinate(g.b1.rawTime),b=C.priceToCoordinate(g.b1.price),H=v.timeScale().timeToCoordinate(g.b2.rawTime),O=C.priceToCoordinate(g.b2.price),N=f!=null&&H!=null?(f+H)/2:null,W=b!=null&&O!=null?(b+O)/2:null;if(d==null||S==null||I==null||U==null||N==null||W==null||f==null||b==null||H==null||O==null)continue;const G=Math.hypot(w-d,T-S),j=Math.hypot(w-I,T-U),fe=Math.hypot(w-N,T-W),me=Math.hypot(d-N,S-W)<x*1.5;if(me&&Math.min(G,fe)<x*1.5)return{object:g,mode:"handle3"};if(fe<x)return{object:g,mode:"handle3"};if(j<x)return{object:g,mode:"handle2"};if(me)continue;if(G<x)return{object:g,mode:"handle1"};const Ue=Ze(w,T,d,S,I,U),_e=Ze(w,T,f,b,H,O);if(Ue<q||_e<q||Mt(w,T,[{x:d,y:S},{x:I,y:U},{x:H,y:O},{x:f,y:b}]))return{object:g,mode:"line"}}if(g.type==="regressionchannel"&&g.p1&&g.p2&&g.top1&&g.top2&&g.bot1&&g.bot2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price),f=v.timeScale().timeToCoordinate(g.top1.rawTime),b=C.priceToCoordinate(g.top1.price),H=v.timeScale().timeToCoordinate(g.top2.rawTime),O=C.priceToCoordinate(g.top2.price),N=v.timeScale().timeToCoordinate(g.bot1.rawTime),W=C.priceToCoordinate(g.bot1.price),G=v.timeScale().timeToCoordinate(g.bot2.rawTime),j=C.priceToCoordinate(g.bot2.price);if(d==null||S==null||I==null||U==null||f==null||b==null||H==null||O==null||N==null||W==null||G==null||j==null)continue;const fe=Math.hypot(w-d,T-S),me=Math.hypot(w-I,T-U);if(fe<x)return{object:g,mode:"handle1"};if(me<x)return{object:g,mode:"handle2"};const Ue=Ze(w,T,d,S,I,U),_e=Ze(w,T,f,b,H,O),ze=Ze(w,T,N,W,G,j);if(Ue<q||_e<q||ze<q||Mt(w,T,[{x:f,y:b},{x:H,y:O},{x:G,y:j},{x:N,y:W}]))return{object:g,mode:"line"}}if(g.type==="stddevchannel"&&g.p1&&g.p2&&g.top1&&g.top2&&g.bot1&&g.bot2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price),f=v.timeScale().timeToCoordinate(g.top1.rawTime),b=C.priceToCoordinate(g.top1.price),H=v.timeScale().timeToCoordinate(g.top2.rawTime),O=C.priceToCoordinate(g.top2.price),N=v.timeScale().timeToCoordinate(g.bot1.rawTime),W=C.priceToCoordinate(g.bot1.price),G=v.timeScale().timeToCoordinate(g.bot2.rawTime),j=C.priceToCoordinate(g.bot2.price);if(d==null||S==null||I==null||U==null||f==null||b==null||H==null||O==null||N==null||W==null||G==null||j==null)continue;const fe=Math.hypot(w-d,T-S),me=Math.hypot(w-I,T-U);if(fe<x)return{object:g,mode:"handle1"};if(me<x)return{object:g,mode:"handle2"};const Ue=Ze(w,T,d,S,I,U),_e=Ze(w,T,f,b,H,O),ze=Ze(w,T,N,W,G,j);if(Ue<q||_e<q||ze<q||Mt(w,T,[{x:f,y:b},{x:H,y:O},{x:G,y:j},{x:N,y:W}]))return{object:g,mode:"line"}}if(g.type==="andrewspitchfork"&&g.p1&&g.p2&&g.p3){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price),f=v.timeScale().timeToCoordinate(g.p3.rawTime),b=C.priceToCoordinate(g.p3.price);if(d==null||S==null||I==null||U==null||f==null||b==null)continue;const H=Math.hypot(w-d,T-S),O=Math.hypot(w-I,T-U),N=Math.hypot(w-f,T-b);if(H<x)return{object:g,mode:"handle1"};if(O<x)return{object:g,mode:"handle2"};if(N<x)return{object:g,mode:"handle3"};const W=(I+f)/2,G=(U+b)/2;let j=W-d,fe=G-S;Math.abs(j)<1e-4&&(j=1e-4);const me=fe/j,Ue=P.clientWidth,_e=U+me*(Ue-I),ze=b+me*(Ue-f),Re=Ze(w,T,I,U,Ue,_e),rA=Ze(w,T,f,b,Ue,ze);if(Re<q||rA<q||Mt(w,T,[{x:I,y:U},{x:Ue,y:_e},{x:Ue,y:ze},{x:f,y:b}]))return{object:g,mode:"line"}}if(g.type==="disjointchannel"&&g.p1&&g.p2&&g.p3&&g.p4){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price),f=v.timeScale().timeToCoordinate(g.p3.rawTime),b=C.priceToCoordinate(g.p3.price),H=v.timeScale().timeToCoordinate(g.p4.rawTime),O=C.priceToCoordinate(g.p4.price);if(d==null||S==null||I==null||U==null||f==null||b==null||H==null||O==null)continue;const N=Math.hypot(w-d,T-S),W=Math.hypot(w-I,T-U),G=Math.hypot(w-f,T-b),j=Math.hypot(w-H,T-O);if(N<x)return{object:g,mode:"handle1"};if(W<x)return{object:g,mode:"handle2"};if(G<x)return{object:g,mode:"handle3"};if(j<x)return{object:g,mode:"handle4"};const fe=Ze(w,T,d,S,f,b),me=Ze(w,T,I,U,H,O),Ue=Ze(w,T,d,S,I,U),_e=Ze(w,T,f,b,H,O);if(fe<q||me<q||Ue<q||_e<q||Mt(w,T,[{x:d,y:S},{x:f,y:b},{x:H,y:O},{x:I,y:U}]))return{object:g,mode:"line"}}if(g.type==="flattopbottom"&&g.p1&&g.p2&&g.p3&&g.p4){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price),f=v.timeScale().timeToCoordinate(g.p3.rawTime),b=C.priceToCoordinate(g.p3.price),H=v.timeScale().timeToCoordinate(g.p4.rawTime),O=C.priceToCoordinate(g.p4.price);if(d==null||S==null||I==null||U==null||f==null||b==null||H==null||O==null)continue;const N=Math.hypot(w-d,T-S),W=Math.hypot(w-I,T-U),G=Math.hypot(w-f,T-b),j=Math.hypot(w-H,T-O);if(N<x)return{object:g,mode:"handle1"};if(W<x)return{object:g,mode:"handle2"};if(G<x)return{object:g,mode:"handle3"};if(j<x)return{object:g,mode:"handle4"};const fe=Ze(w,T,d,S,f,b),me=Ze(w,T,I,U,H,O),Ue=Ze(w,T,d,S,I,U),_e=Ze(w,T,f,b,H,O);if(fe<q||me<q||Ue<q||_e<q||Mt(w,T,[{x:d,y:S},{x:f,y:b},{x:H,y:O},{x:I,y:U}]))return{object:g,mode:"line"}}if(g.type==="rulerline"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=(d+I)/2,b=(S+U)/2,H=Math.hypot(w-d,T-S),O=Math.hypot(w-I,T-U),N=Math.hypot(w-f,T-b);if(H<x)return{object:g,mode:"handle1"};if(O<x)return{object:g,mode:"handle2"};if(N<x)return{object:g,mode:"line"};if(Ze(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}if(g.type==="fibonacci"&&g.p1&&g.p2){const d=v.timeScale().timeToCoordinate(g.p1.rawTime),S=C.priceToCoordinate(g.p1.price),I=v.timeScale().timeToCoordinate(g.p2.rawTime),U=C.priceToCoordinate(g.p2.price);if(d==null||S==null||I==null||U==null)continue;const f=Math.hypot(w-d,T-S),b=Math.hypot(w-I,T-U);if(f<x)return{object:g,mode:"handle1"};if(b<x)return{object:g,mode:"handle2"};if(Ze(w,T,d,S,I,U)<q)return{object:g,mode:"line"}}}return null}const he=w=>{const T=P.getBoundingClientRect(),E=w.clientX-T.left,g=w.clientY-T.top,d=ee(E,g);d?(w.preventDefault(),w.stopPropagation(),_(d.object),Z(null),z([]),R.current=d.mode,d.object.type==="rayline"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="extendedline"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="crossline"&&(d.mode==="handle1"||d.mode==="line")&&(X.current={x:E,y:g,p:{...d.object.p}}),d.object.type==="trendbyangle"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="equidistantchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="andrewspitchfork"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="regressionchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="stddevchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="disjointchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="flattopbottom"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="fibonacci"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="gannfan"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="ganngrid"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="rectangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4"||d.mode==="handle5"||d.mode==="handle6"||d.mode==="handle7"||d.mode==="handle8")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="circle"&&(d.mode==="handle1"||d.mode==="handle2")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="triangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="ellipse"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}),d.mode==="line"&&(d.object.type==="rulerline"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="arrowedline"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rayline"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="extendedline"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="crossline"?X.current={x:E,y:g,p:{...d.object.p}}:d.object.type==="trendbyangle"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="equidistantchannel"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="andrewspitchfork"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="regressionchannel"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="stddevchannel"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="disjointchannel"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="flattopbottom"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="fibonacci"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="gannfan"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rectangle"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="circle"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="triangle"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="ellipse"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}:d.object.type==="ganngrid"?X.current={x:E,y:g,p1:{...d.object.p1},p2:{...d.object.p2}}:X.current={x:E,y:g,point1:{...d.object.point1},point2:{...d.object.point2}})):(_(null),R.current=null,k([]),Z(null),z([]))},M=w=>{const T=P.getBoundingClientRect(),E=w.clientX-T.left,g=w.clientY-T.top;if(!R.current){const U=ee(E,g);if(U?.object&&!se.current){const f=re(U.object);Z(b=>b===U.object?b:U.object),z(b=>b.length===f.length&&b.every((H,O)=>H.x===f[O].x&&H.y===f[O].y)?b:f)}else Z(f=>f==null?f:null),z(f=>f.length===0?f:[]);return}const d=se.current;if(!d)return;let S=v.timeScale().coordinateToTime(E);const I=C.coordinateToPrice(g);if(!(S==null||I==null)&&(S=Ae(S),S!=null)){if(d.type==="rulerline"&&d.p1&&d.p2){const U=(f,b)=>{const H=f.normalizedTime??f.rawTime,O=b.normalizedTime??b.rawTime,N=b.price-f.price,W=N/Math.abs(f.price)*100,G=Wt(we)||3600,j=Math.abs(O-H),fe=Math.max(1,Math.round(j/G)),me=Math.max(1,Math.round(j/86400)),Ue={priceDiff:N,pricePct:W,bars:fe,days:me},_e=d.primitive;if(_e){_e.p1={rawTime:f.rawTime,price:f.price},_e.p2={rawTime:b.rawTime,price:b.price},_e.info=Ue;const Re=b.price>=f.price;_e.color=Re?"#3b82f6":"#ef5350",_e.fillColor=Re?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{l.current?.applyOptions({})}catch{}}const ze={...d,p1:f,p2:b};le(Re=>{const rA=Re.map(iA=>iA===d?ze:iA);return u.current=rA,rA}),_(ze),se.current=ze};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2)}else if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S,price:I})}else if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const U=(f,b)=>{const H=d.primitive;if(H){H.p1={rawTime:f.rawTime,price:f.price},H.p2={rawTime:b.rawTime,price:b.price};try{l.current?.applyOptions({})}catch{}}const O={...d,p1:f,p2:b};le(N=>{const W=N.map(G=>G===d?O:G);return u.current=W,W}),_(O),se.current=O};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2)}else if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S,price:I})}else if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N})}return}if(d.type==="rayline"&&d.p1&&d.p2){const U=(f,b)=>{const H=d.primitive;if(H){H.p1={rawTime:f.rawTime,price:f.price},H.p2={rawTime:b.rawTime,price:b.price};try{l.current?.applyOptions({})}catch{}}const O={...d,p1:f,p2:b};le(N=>{const W=N.map(G=>G===d?O:G);return u.current=W,W}),_(O),se.current=O};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2)}else if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;const b=Ae(f);if(b==null)return;U(d.p1,{rawTime:f,normalizedTime:b,price:I})}else if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const U=(f,b)=>{const H=d.primitive;if(H){H.p1={rawTime:f.rawTime,price:f.price},H.p2={rawTime:b.rawTime,price:b.price};try{l.current?.applyOptions({})}catch{}}const O={...d,p1:f,p2:b};le(N=>{const W=N.map(G=>G===d?O:G);return u.current=W,W}),_(O),se.current=O};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2)}else if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S,price:I})}else if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N})}return}if(d.type==="crossline"&&d.p){const U=b=>{const H=d.primitive;if(H){H.center={rawTime:b.rawTime,price:b.price};try{l.current?.applyOptions({})}catch{}}const O={...d,p:b};le(N=>{const W=N.map(G=>G===d?O:G);return u.current=W,W}),_(O),se.current=O},f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I});return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const U=(f,b)=>{const H=d.primitive;if(H){H.p1={rawTime:f.rawTime,price:f.price},H.p2={rawTime:b.rawTime,price:b.price};try{l.current?.applyOptions({})}catch{}}const O={...d,p1:f,p2:b};le(N=>{const W=N.map(G=>G===d?O:G);return u.current=W,W}),_(O),se.current=O};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2)}else if(R.current==="handle2"||R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const U=(f,b,H)=>{const O=ad(f,b,H);if(!O)return;const N=d.primitive;if(N){N.p1={rawTime:f.rawTime,price:f.price},N.p2={rawTime:b.rawTime,price:b.price},N.b1={rawTime:O.b1.rawTime,price:O.b1.price},N.b2={rawTime:O.b2.rawTime,price:O.b2.price},N.p3={rawTime:O.bottomMid.rawTime,price:O.bottomMid.price};try{l.current?.applyOptions({})}catch{}}const W={...d,p1:f,p2:b,p3:O.bottomMid,b1:O.b1,b2:O.b2,bottomMid:O.bottomMid};le(G=>{const j=G.map(fe=>fe===d?W:fe);return u.current=j,j}),_(W),se.current=W};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2,d.p3);return}if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S,price:I},d.p3);return}if(R.current==="handle3"){U(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??Ae(d.p3.rawTime),price:I});return}if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O),j=Ae(f.p3.normalizedTime+O);if(W==null||G==null||j==null)return;const fe=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+fe,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+fe,normalizedTime:G,price:f.p2.price+N},{rawTime:f.p3.rawTime+fe,normalizedTime:j,price:f.p3.price+N});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const U=(f,b)=>{const H=qn(ne,f,b,d.stdMultiplier??1);if(!H)return;const O=d.primitive;if(O){O.mid1={rawTime:H.p1.rawTime,price:H.p1.price},O.mid2={rawTime:H.p2.rawTime,price:H.p2.price},O.top1={rawTime:H.top1.rawTime,price:H.top1.price},O.top2={rawTime:H.top2.rawTime,price:H.top2.price},O.bot1={rawTime:H.bot1.rawTime,price:H.bot1.price},O.bot2={rawTime:H.bot2.rawTime,price:H.bot2.price};try{l.current?.applyOptions({})}catch{}}const N={...d,p1:H.p1,p2:H.p2,top1:H.top1,top2:H.top2,bot1:H.bot1,bot2:H.bot2,slope:H.slope,intercept:H.intercept,stdDev:H.stdDev,offset:H.offset,barCount:H.barCount};le(W=>{const G=W.map(j=>j===d?N:j);return u.current=G,G}),_(N),se.current=N};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S},d.p2);return}if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S});return}if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const U=(f,b)=>{const H=dl(ne,f,b,d.stdMultiplier??1);if(!H)return;const O=d.primitive;if(O){O.mid1={rawTime:H.p1.rawTime,price:H.p1.price},O.mid2={rawTime:H.p2.rawTime,price:H.p2.price},O.top1={rawTime:H.top1.rawTime,price:H.top1.price},O.top2={rawTime:H.top2.rawTime,price:H.top2.price},O.bot1={rawTime:H.bot1.rawTime,price:H.bot1.price},O.bot2={rawTime:H.bot2.rawTime,price:H.bot2.price};try{l.current?.applyOptions({})}catch{}}const N={...d,p1:H.p1,p2:H.p2,top1:H.top1,top2:H.top2,bot1:H.bot1,bot2:H.bot2,slope:H.slope,stdDev:H.stdDev,offset:H.offset,barCount:H.barCount};le(W=>{const G=W.map(j=>j===d?N:j);return u.current=G,G}),_(N),se.current=N};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S},d.p2);return}if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S});return}if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const U=(f,b,H)=>{const O=d.primitive;if(O){O.p1={rawTime:f.rawTime,price:f.price},O.p2={rawTime:b.rawTime,price:b.price},O.p3={rawTime:H.rawTime,price:H.price};try{l.current?.applyOptions({})}catch{}}const N={...d,p1:f,p2:b,p3:H};le(W=>{const G=W.map(j=>j===d?N:j);return u.current=G,G}),_(N),se.current=N};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2,d.p3);return}if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S,price:I},d.p3);return}if(R.current==="handle3"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,d.p2,{rawTime:f,normalizedTime:S,price:I});return}if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O),j=Ae(f.p3.normalizedTime+O);if(W==null||G==null||j==null)return;const fe=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+fe,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+fe,normalizedTime:G,price:f.p2.price+N},{rawTime:f.p3.rawTime+fe,normalizedTime:j,price:f.p3.price+N});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const U=(N,W,G,j)=>{const fe=d.primitive;if(fe){fe.p1={rawTime:N.rawTime,price:N.price},fe.p2={rawTime:W.rawTime,price:W.price},fe.p3={rawTime:G.rawTime,price:G.price},fe.p4={rawTime:j.rawTime,price:j.price};try{l.current?.applyOptions({})}catch{}}const me={...d,p1:N,p2:W,p3:G,p4:j};le(Ue=>{const _e=Ue.map(ze=>ze===d?me:ze);return u.current=_e,_e}),_(me),se.current=me},f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(E);if(b==null)return;const H=Ae(b);if(H==null)return;const O=(N,W,G,j)=>{const fe=N.normalizedTime??Ae(N.rawTime);if(fe==null)return null;const me=Ae(fe+G);return me==null?null:{rawTime:N.rawTime+W,normalizedTime:me,price:N.price+j}};if(R.current==="line"){const N=v.timeScale().coordinateToTime(f.x),W=C.coordinateToPrice(f.y);if(N==null||W==null)return;const G=Ae(N);if(G==null)return;const j=b-N,fe=H-G,me=I-W,Ue=O(f.p1,j,fe,me),_e=O(f.p2,j,fe,me),ze=O(f.p3,j,fe,me),Re=O(f.p4,j,fe,me);if(!Ue||!_e||!ze||!Re)return;U(Ue,_e,ze,Re);return}if(R.current==="handle1"){const N=(f.p1.price+f.p2.price)/2,W={rawTime:b,normalizedTime:H,price:I},G={rawTime:b,normalizedTime:H,price:2*N-I};U(W,G,f.p3,f.p4);return}if(R.current==="handle3"){const N=(f.p3.price+f.p4.price)/2,W={rawTime:b,normalizedTime:H,price:I},G={rawTime:b,normalizedTime:H,price:2*N-I};U(f.p1,f.p2,W,G);return}if(R.current==="handle2"){const N=(f.p1.price+f.p2.price)/2,W={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??Ae(f.p1.rawTime),price:I};if(W.normalizedTime==null)return;const G={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??Ae(f.p1.rawTime),price:2*N-I};if(G.normalizedTime==null)return;U(G,W,f.p3,f.p4);return}if(R.current==="handle4"){const N=I-f.p4.price,W={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??Ae(f.p3.rawTime),price:f.p4.price+N};if(W.normalizedTime==null)return;const G={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??Ae(f.p1.rawTime),price:f.p2.price+N};if(G.normalizedTime==null)return;U(f.p1,G,f.p3,W);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const U=(N,W,G,j)=>{const fe=d.primitive;if(fe){fe.p1={rawTime:N.rawTime,price:N.price},fe.p2={rawTime:W.rawTime,price:W.price},fe.p3={rawTime:G.rawTime,price:G.price},fe.p4={rawTime:j.rawTime,price:j.price};try{l.current?.applyOptions({})}catch{}}const me={...d,p1:N,p2:W,p3:G,p4:j};le(Ue=>{const _e=Ue.map(ze=>ze===d?me:ze);return u.current=_e,_e}),_(me),se.current=me},f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(E);if(b==null)return;const H=Ae(b);if(H==null)return;const O=(N,W,G,j)=>{const fe=N.normalizedTime??Ae(N.rawTime);if(fe==null)return null;const me=Ae(fe+G);return me==null?null:{rawTime:N.rawTime+W,normalizedTime:me,price:N.price+j}};if(R.current==="line"){const N=v.timeScale().coordinateToTime(f.x),W=C.coordinateToPrice(f.y);if(N==null||W==null)return;const G=Ae(N);if(G==null)return;const j=b-N,fe=H-G,me=I-W,Ue=O(f.p1,j,fe,me),_e=O(f.p2,j,fe,me),ze=O(f.p3,j,fe,me),Re=O(f.p4,j,fe,me);if(!Ue||!_e||!ze||!Re)return;U(Ue,_e,ze,Re);return}if(R.current==="handle1"){const N={rawTime:b,normalizedTime:H,price:I},W={rawTime:b,normalizedTime:H,price:f.p2.price};U(N,W,f.p3,f.p4);return}if(R.current==="handle3"){const N={rawTime:b,normalizedTime:H,price:I},W={rawTime:b,normalizedTime:H,price:f.p4.price};U(f.p1,f.p2,N,W);return}if(R.current==="handle2"||R.current==="handle4"){const N=R.current==="handle2"?f.p2:f.p4,W=I-N.price,G={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??Ae(f.p1.rawTime),price:f.p2.price+W},j={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??Ae(f.p3.rawTime),price:f.p4.price+W};if(G.normalizedTime==null||j.normalizedTime==null)return;U(f.p1,G,f.p3,j);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const U=(f,b)=>{const H=d.primitive;if(H){H.p1={rawTime:f.rawTime,price:f.price},H.p2={rawTime:b.rawTime,price:b.price};try{l.current?.applyOptions({})}catch{}}const O={...d,p1:f,p2:b};le(N=>{const W=N.map(G=>G===d?O:G);return u.current=W,W}),_(O),se.current=O};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2)}else if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S,price:I})}else if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const U=(iA,wA)=>{const LA=d.primitive;if(LA){LA.p1={rawTime:iA.rawTime,price:iA.price},LA.p2={rawTime:wA.rawTime,price:wA.price};try{l.current?.applyOptions({})}catch{}}const At={...d,p1:iA,p2:wA};le(dt=>{const ft=dt.map(Yt=>Yt===d?At:Yt);return u.current=ft,ft}),_(At),se.current=At},f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(E);if(b==null)return;const H=Ae(b);if(H==null)return;if(R.current==="line"){const iA=v.timeScale().coordinateToTime(f.x),wA=C.coordinateToPrice(f.y);if(iA==null||wA==null)return;const LA=Ae(iA);if(LA==null)return;const At=H-LA,dt=I-wA,ft=Ae(f.p1.normalizedTime+At),Yt=Ae(f.p2.normalizedTime+At);if(ft==null||Yt==null)return;const As=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+As,normalizedTime:ft,price:f.p1.price+dt},{rawTime:f.p2.rawTime+As,normalizedTime:Yt,price:f.p2.price+dt});return}const O=Math.min(f.p1.normalizedTime,f.p2.normalizedTime),N=Math.max(f.p1.normalizedTime,f.p2.normalizedTime),W=Math.max(f.p1.price,f.p2.price),G=Math.min(f.p1.price,f.p2.price),j=f.p1.normalizedTime<=f.p2.normalizedTime?f.p1.rawTime:f.p2.rawTime,fe=f.p1.normalizedTime<=f.p2.normalizedTime?f.p2.rawTime:f.p1.rawTime;let me=O,Ue=N,_e=W,ze=G,Re=j,rA=fe;if((R.current==="handle1"||R.current==="handle4"||R.current==="handle6")&&(me=H,Re=b),(R.current==="handle3"||R.current==="handle5"||R.current==="handle8")&&(Ue=H,rA=b),(R.current==="handle1"||R.current==="handle2"||R.current==="handle3")&&(_e=I),(R.current==="handle6"||R.current==="handle7"||R.current==="handle8")&&(ze=I),me>Ue){const iA=me,wA=Re;me=Ue,Re=rA,Ue=iA,rA=wA}if(_e<ze){const iA=_e;_e=ze,ze=iA}U({rawTime:Re,normalizedTime:me,price:_e},{rawTime:rA,normalizedTime:Ue,price:ze});return}if(d.type==="circle"&&d.p1&&d.p2){const U=(_e,ze)=>{const Re=d.primitive;if(Re){Re.p1={rawTime:_e.rawTime,price:_e.price},Re.p2={rawTime:ze.rawTime,price:ze.price};try{l.current?.applyOptions({})}catch{}}const rA={...d,p1:_e,p2:ze};le(iA=>{const wA=iA.map(LA=>LA===d?rA:LA);return u.current=wA,wA}),_(rA),se.current=rA},f=v.timeScale().coordinateToTime(E);if(f==null)return;const b=Ae(f);if(b==null)return;if(R.current==="handle2"){U(d.p1,{rawTime:f,normalizedTime:b,price:I});return}const H=X.current;if(!H)return;const O=v.timeScale().coordinateToTime(H.x),N=C.coordinateToPrice(H.y);if(O==null||N==null)return;const W=Ae(O);if(W==null)return;const G=b-W,j=I-N,fe=Ae(H.p1.normalizedTime+G),me=Ae(H.p2.normalizedTime+G);if(fe==null||me==null)return;const Ue=(v.timeScale().coordinateToTime(E)??H.p1.rawTime)-H.p1.rawTime;U({rawTime:H.p1.rawTime+Ue,normalizedTime:fe,price:H.p1.price+j},{rawTime:H.p2.rawTime+Ue,normalizedTime:me,price:H.p2.price+j});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const U=(Re,rA,iA)=>{const wA=d.primitive;if(wA){wA.p1={rawTime:Re.rawTime,price:Re.price},wA.p2={rawTime:rA.rawTime,price:rA.price},wA.p3={rawTime:iA.rawTime,price:iA.price};try{l.current?.applyOptions({})}catch{}}const LA={...d,p1:Re,p2:rA,p3:iA};le(At=>{const dt=At.map(ft=>ft===d?LA:ft);return u.current=dt,dt}),_(LA),se.current=LA},f=v.timeScale().coordinateToTime(E);if(f==null)return;const b=Ae(f);if(b==null)return;if(R.current==="handle1"){U({rawTime:f,normalizedTime:b,price:I},d.p2,d.p3);return}if(R.current==="handle2"){U(d.p1,{rawTime:f,normalizedTime:b,price:I},d.p3);return}if(R.current==="handle3"){U(d.p1,d.p2,{rawTime:f,normalizedTime:b,price:I});return}const H=X.current;if(!H)return;const O=v.timeScale().coordinateToTime(H.x),N=C.coordinateToPrice(H.y);if(O==null||N==null)return;const W=Ae(O);if(W==null)return;const G=b-W,j=I-N,fe=(v.timeScale().coordinateToTime(E)??H.p1.rawTime)-H.p1.rawTime,me=Re=>{const rA=Re.normalizedTime??Ae(Re.rawTime);if(rA==null)return null;const iA=Ae(rA+G);return iA==null?null:{rawTime:Re.rawTime+fe,normalizedTime:iA,price:Re.price+j}},Ue=me(H.p1),_e=me(H.p2),ze=me(H.p3);if(!Ue||!_e||!ze)return;U(Ue,_e,ze);return}if(d.type==="ellipse"&&d.p1&&d.p2){const U=(O,N,W=d.minorRatio??.45)=>{const G=d.primitive;if(G){G.p1={rawTime:O.rawTime,price:O.price},G.p2={rawTime:N.rawTime,price:N.price},G.minorRatio=Math.max(.05,W);try{l.current?.applyOptions({})}catch{}}const j={...d,p1:O,p2:N,minorRatio:Math.max(.05,W)};le(fe=>{const me=fe.map(Ue=>Ue===d?j:Ue);return u.current=me,me}),_(j),se.current=j},f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(E);if(b==null)return;const H=Ae(b);if(H==null)return;if(R.current==="line"){const O=v.timeScale().coordinateToTime(f.x),N=C.coordinateToPrice(f.y);if(O==null||N==null)return;const W=Ae(O);if(W==null)return;const G=H-W,j=I-N,fe=Ae(f.p1.normalizedTime+G),me=Ae(f.p2.normalizedTime+G);if(fe==null||me==null)return;const Ue=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+Ue,normalizedTime:fe,price:f.p1.price+j},{rawTime:f.p2.rawTime+Ue,normalizedTime:me,price:f.p2.price+j},f.minorRatio??d.minorRatio??.45);return}if(R.current==="handle1"){U({rawTime:b,normalizedTime:H,price:I},d.p2,d.minorRatio??.45);return}if(R.current==="handle3"){U(d.p1,{rawTime:b,normalizedTime:H,price:I},d.minorRatio??.45);return}if(R.current==="handle2"||R.current==="handle4"){const O=v.timeScale().timeToCoordinate(d.p1.rawTime),N=C.priceToCoordinate(d.p1.price),W=v.timeScale().timeToCoordinate(d.p2.rawTime),G=C.priceToCoordinate(d.p2.price);if(O==null||N==null||W==null||G==null)return;const j=(O+W)/2,fe=(N+G)/2,me=W-O,Ue=G-N,_e=Math.hypot(me,Ue);if(_e<.001)return;const ze=-Ue/_e,Re=me/_e,rA=Math.abs((E-j)*ze+(g-fe)*Re),iA=Math.max(.05,rA*2/_e);U(d.p1,d.p2,iA);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const U=(f,b)=>{const H=d.primitive;if(H){H.p1={rawTime:f.rawTime,price:f.price},H.p2={rawTime:b.rawTime,price:b.price};try{l.current?.applyOptions({})}catch{}}const O={...d,p1:f,p2:b};le(N=>{const W=N.map(G=>G===d?O:G);return u.current=W,W}),_(O),se.current=O};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2)}else if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S,price:I})}else if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const U=(f,b)=>{const H=d.primitive;if(H){H.p1={rawTime:f.rawTime,price:f.price},H.p2={rawTime:b.rawTime,price:b.price};try{l.current?.applyOptions({})}catch{}}const O={...d,p1:f,p2:b};le(N=>{const W=N.map(G=>G===d?O:G);return u.current=W,W}),_(O),se.current=O};if(R.current==="handle1"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U({rawTime:f,normalizedTime:S,price:I},d.p2)}else if(R.current==="handle2"){const f=v.timeScale().coordinateToTime(E);if(f==null)return;U(d.p1,{rawTime:f,normalizedTime:S,price:I})}else if(R.current==="line"){const f=X.current;if(!f)return;const b=v.timeScale().coordinateToTime(f.x),H=C.coordinateToPrice(f.y);if(b==null||H==null)return;const O=S-Ae(b),N=I-H,W=Ae(f.p1.normalizedTime+O),G=Ae(f.p2.normalizedTime+O);if(W==null||G==null)return;const j=(v.timeScale().coordinateToTime(E)??f.p1.rawTime)-f.p1.rawTime;U({rawTime:f.p1.rawTime+j,normalizedTime:W,price:f.p1.price+N},{rawTime:f.p2.rawTime+j,normalizedTime:G,price:f.p2.price+N})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(R.current==="handle1"){const U={time:S,price:I},f=qt([{time:U.time,value:U.price},{time:d.point2.time,value:d.point2.price}]);f.length>0&&d.series.setData(f);const b={...d,point1:U};le(H=>{const O=H.map(N=>N===d?b:N);return u.current=O,O}),_(b),se.current=b}else if(R.current==="handle2"){const U={time:S,price:I},f=qt([{time:d.point1.time,value:d.point1.price},{time:U.time,value:U.price}]);f.length>0&&d.series.setData(f);const b={...d,point2:U};le(H=>{const O=H.map(N=>N===d?b:N);return u.current=O,O}),_(b),se.current=b}else if(R.current==="line"){const U=X.current;if(!U)return;const f=v.timeScale().coordinateToTime(U.x),b=C.coordinateToPrice(U.y);if(f==null||b==null)return;const H=S-f,O=I-b,N={time:Ae(U.point1.time+H),price:U.point1.price+O},W={time:Ae(U.point2.time+H),price:U.point2.price+O},G=qt([{time:N.time,value:N.price},{time:W.time,value:W.price}]);G.length>0&&d.series.setData(G);const j={...d,point1:N,point2:W};le(fe=>{const me=fe.map(Ue=>Ue===d?j:Ue);return u.current=me,me}),_(j),se.current=j}}}},K=()=>{R.current=null,X.current=null},ie=()=>{R.current||se.current||(Z(null),z([]))},te={capture:!0,passive:!1};return P.addEventListener("mousedown",he,te),P.addEventListener("mousemove",M,te),P.addEventListener("mouseup",K,te),P.addEventListener("mouseleave",ie,te),()=>{P.removeEventListener("mousedown",he,te),P.removeEventListener("mousemove",M,te),P.removeEventListener("mouseup",K,te),P.removeEventListener("mouseleave",ie,te)}},[pe,ne,be,le]),J.useEffect(()=>{const v=l.current,C=a.current;if(!v||!C)return;const P=()=>{const x=F;if(!x){k([]);return}const q=v.timeScale();if(x.type==="rulerline"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:(re+he)/2,y:(ee+M)/2},{x:he,y:M}]):k([]);return}if(x.type==="arrowedline"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="rayline"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="extendedline"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="crossline"&&x.p){const re=q.timeToCoordinate(x.p.rawTime),ee=C.priceToCoordinate(x.p.price);re!=null&&ee!=null?k([{x:re,y:ee}]):k([]);return}if(x.type==="trendbyangle"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="equidistantchannel"&&x.p1&&x.p2&&x.b1&&x.b2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price),K=q.timeToCoordinate(x.b1.rawTime),ie=C.priceToCoordinate(x.b1.price),te=q.timeToCoordinate(x.b2.rawTime),w=C.priceToCoordinate(x.b2.price);re!=null&&ee!=null&&he!=null&&M!=null&&K!=null&&ie!=null&&te!=null&&w!=null?k([{x:re,y:ee},{x:he,y:M},{x:(K+te)/2,y:(ie+w)/2}]):k([]);return}if(x.type==="regressionchannel"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="stddevchannel"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="andrewspitchfork"&&x.p1&&x.p2&&x.p3){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price),K=q.timeToCoordinate(x.p3.rawTime),ie=C.priceToCoordinate(x.p3.price);re!=null&&ee!=null&&he!=null&&M!=null&&K!=null&&ie!=null?k([{x:re,y:ee},{x:he,y:M},{x:K,y:ie}]):k([]);return}if(x.type==="disjointchannel"&&x.p1&&x.p2&&x.p3&&x.p4){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price),K=q.timeToCoordinate(x.p3.rawTime),ie=C.priceToCoordinate(x.p3.price),te=q.timeToCoordinate(x.p4.rawTime),w=C.priceToCoordinate(x.p4.price);re!=null&&ee!=null&&he!=null&&M!=null&&K!=null&&ie!=null&&te!=null&&w!=null?k([{x:re,y:ee},{x:he,y:M},{x:K,y:ie},{x:te,y:w}]):k([]);return}if(x.type==="flattopbottom"&&x.p1&&x.p2&&x.p3&&x.p4){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price),K=q.timeToCoordinate(x.p3.rawTime),ie=C.priceToCoordinate(x.p3.price),te=q.timeToCoordinate(x.p4.rawTime),w=C.priceToCoordinate(x.p4.price);re!=null&&ee!=null&&he!=null&&M!=null&&K!=null&&ie!=null&&te!=null&&w!=null?k([{x:re,y:ee},{x:he,y:M},{x:K,y:ie},{x:te,y:w}]):k([]);return}if(x.type==="fibonacci"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="trendline"&&x.point1&&x.point2){const re=q.timeToCoordinate(x.point1.time),ee=C.priceToCoordinate(x.point1.price),he=q.timeToCoordinate(x.point2.time),M=C.priceToCoordinate(x.point2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="gannline"&&x.point1&&x.point2){const re=q.timeToCoordinate(x.point1.time),ee=C.priceToCoordinate(x.point1.price),he=q.timeToCoordinate(x.point2.time),M=C.priceToCoordinate(x.point2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:(re+he)/2,y:(ee+M)/2},{x:he,y:M}]):k([]);return}if(x.type==="rectangle"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);if(re!=null&&ee!=null&&he!=null&&M!=null){const K=Math.min(re,he),ie=Math.max(re,he),te=Math.min(ee,M),w=Math.max(ee,M),T=(K+ie)/2,E=(te+w)/2;k([{x:K,y:te},{x:T,y:te},{x:ie,y:te},{x:K,y:E},{x:ie,y:E},{x:K,y:w},{x:T,y:w},{x:ie,y:w}])}else k([]);return}if(x.type==="circle"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="triangle"&&x.p1&&x.p2&&x.p3){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price),K=q.timeToCoordinate(x.p3.rawTime),ie=C.priceToCoordinate(x.p3.price);re!=null&&ee!=null&&he!=null&&M!=null&&K!=null&&ie!=null?k([{x:re,y:ee},{x:he,y:M},{x:K,y:ie}]):k([]);return}if(x.type==="ellipse"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);if(re!=null&&ee!=null&&he!=null&&M!=null){const K=(re+he)/2,ie=(ee+M)/2,te=he-re,w=M-ee,T=Math.hypot(te,w);if(T<.001){k([]);return}const E=te/T,g=w/T,d=-g,S=E,I=T/2,U=I*Math.max(.05,x.minorRatio??.45);k([{x:K-E*I,y:ie-g*I},{x:K+d*U,y:ie+S*U},{x:K+E*I,y:ie+g*I},{x:K-d*U,y:ie-S*U}])}else k([]);return}if(x.type==="gannfan"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}if(x.type==="ganngrid"&&x.p1&&x.p2){const re=q.timeToCoordinate(x.p1.rawTime),ee=C.priceToCoordinate(x.p1.price),he=q.timeToCoordinate(x.p2.rawTime),M=C.priceToCoordinate(x.p2.price);re!=null&&ee!=null&&he!=null&&M!=null?k([{x:re,y:ee},{x:he,y:M}]):k([]);return}k([])};P();const He=v.timeScale();return He.subscribeVisibleTimeRangeChange(P),()=>{He.unsubscribeVisibleTimeRangeChange(P)}},[F]),J.useEffect(()=>{!l.current||!a.current||u.current.forEach(v=>{if(v.series&&v.series.applyOptions({visible:Ke}),v.priceLine&&v.priceLine.applyOptions(Ke?{color:"#3b82f6",axisLabelVisible:!0,title:typeof v.price=="number"?v.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""}),v.type==="fibonacci"&&v.primitive){v.primitive.visible=Ke;try{l.current?.applyOptions({})}catch{}}if(v.type==="rectangle"&&v.primitive){v.primitive.visible=Ke;try{l.current?.applyOptions({})}catch{}}if(v.type==="parallellines"&&(v.baseLine&&v.baseLine.applyOptions({visible:Ke}),v.parallelLine&&v.parallelLine.applyOptions({visible:Ke}),v.firstLine&&v.firstLine.applyOptions({visible:Ke}),v.secondLine&&v.secondLine.applyOptions({visible:Ke})),(v.type==="horizontalray"||v.type==="verticalline"||v.type==="infoline"||v.type==="rulerline"||v.type==="arrowedline"||v.type==="rayline"||v.type==="extendedline"||v.type==="crossline"||v.type==="trendbyangle"||v.type==="equidistantchannel"||v.type==="regressionchannel"||v.type==="stddevchannel"||v.type==="gannfan"||v.type==="ganngrid"||v.type==="andrewspitchfork"||v.type==="disjointchannel"||v.type==="flattopbottom"||v.type==="circle"||v.type==="triangle"||v.type==="ellipse")&&v.primitive){v.primitive.visible=Ke;try{l.current?.applyOptions({})}catch{}}})},[Ke,be]),J.useEffect(()=>{!Ke&&F&&(_(null),k([]))},[Ke,F]),J.useEffect(()=>{if(u.current.length>be.length){const v=u.current.filter((C,P)=>!be.includes(C));F&&v.some(C=>C===F)&&(_(null),k([])),v.forEach(C=>{if(C.series&&l.current?.removeSeries(C.series),C.priceLine&&a.current?.removePriceLine(C.priceLine),C.type==="horizontalray"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="verticalline"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="infoline"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="rulerline"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="arrowedline"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="rayline"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="extendedline"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="crossline"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="trendbyangle"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="equidistantchannel"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="regressionchannel"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="stddevchannel"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="gannfan"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="ganngrid"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="andrewspitchfork"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="disjointchannel"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="flattopbottom"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="fibonacci"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="rectangle"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="circle"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="triangle"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="ellipse"&&C.primitive)try{a.current?.detachPrimitive(C.primitive)}catch{}if(C.type==="parallellines")try{C.baseLine&&l.current?.removeSeries(C.baseLine),C.parallelLine&&l.current?.removeSeries(C.parallelLine),C.firstLine&&l.current?.removeSeries(C.firstLine),C.secondLine&&l.current?.removeSeries(C.secondLine)}catch{}}),u.current=be}},[be,F]),J.useEffect(()=>{const v=a.current;return v?(Pe.current.forEach(P=>{try{v.removePriceLine(P)}catch{}}),Pe.current=[],qe.filter(P=>P.symbol===Ie).forEach(P=>{const He=parseFloat(P.price);if(isNaN(He))return;const q=P.type==="BUY"?"#26A69A":"#EF5350",re=v.createPriceLine({price:He,color:q,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${P.type} ${P.volume} @ ${P.price}`,textColor:q});Pe.current.push(re)}),()=>{Pe.current.forEach(P=>{try{v.removePriceLine(P)}catch{}}),Pe.current=[]}):void 0},[qe,Ie]);const es=F??V,_t=F?L:$,gi=Ke&&Sv(es,_t),KA=Hv(es?.type);return h.jsx("div",{className:`flex-1 flex flex-col min-w-0 overflow-hidden ${Ye==="light"?"bg-white":"bg-[#12161d]"}`,children:h.jsxs("div",{ref:o,className:"flex-1 w-full h-full relative",style:{cursor:pe===1||pe!==null?"crosshair":"default",minHeight:0,minWidth:0},onDoubleClick:v=>{l.current&&!m.current&&(v.preventDefault(),v.stopPropagation(),l.current.timeScale().fitContent(),Se(l.current.timeScale().getVisibleRange()))},children:[t&&h.jsx("div",{className:"absolute top-3 left-3 z-50",children:h.jsx(Gc,{bidPrice:e,askPrice:A,onBuyClick:It,onSellClick:jn})}),h.jsx(Wc,{isOpen:tA,onClose:gl,orderType:oe,bidPrice:e,askPrice:A}),gi&&h.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none","aria-hidden":!0,children:_t.map((v,C)=>h.jsx("div",{className:"absolute w-[10px] h-[10px] rounded-full border-2 border-white shadow",style:{left:v.x-5,top:v.y-5,backgroundColor:KA}},C))})]})})}),aA={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 cd({style:r,className:e}){const{selectedSymbol:A,setSelectedSymbol:t,symbols:i,symbolsLoading:n}=TA(),[s,o]=J.useState(!1),[l,a]=J.useState(""),[c,u]=J.useState(-1),m=J.useRef(null),y=J.useRef(null);J.useEffect(()=>{const F=_=>{m.current&&!m.current.contains(_.target)&&(o(!1),a(""))};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]),J.useEffect(()=>{s&&y.current&&y.current.focus()},[s]);const B=i.filter(F=>F.symbol.toLowerCase().includes(l.toLowerCase())),p=B.filter(F=>!F.symbol.endsWith("USDT")),Q=B.filter(F=>F.symbol.endsWith("USDT")),D=F=>{t(F),o(!1),a("")};return i.find(F=>F.symbol===A),h.jsxs("div",{ref:m,style:{...aA.container,...r},className:e,children:[h.jsxs("button",{style:aA.button,onClick:()=>o(!s),onMouseEnter:F=>Object.assign(F.currentTarget.style,aA.buttonHover),onMouseLeave:F=>{F.currentTarget.style.borderColor="#334155",F.currentTarget.style.backgroundColor="#1e293b"},children:[h.jsx("span",{children:n?"Loading...":A||"Select Coin"}),h.jsx("span",{style:{...aA.arrow,...s?aA.arrowOpen:{}},children:"▼"})]}),s&&h.jsxs("div",{style:aA.dropdown,children:[h.jsx("div",{style:aA.searchContainer,children:h.jsx("input",{ref:y,style:aA.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:F=>a(F.target.value)})}),h.jsx("div",{style:aA.list,children:B.length===0?h.jsx("div",{style:aA.empty,children:"No symbols found"}):h.jsxs(h.Fragment,{children:[p.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{style:aA.categoryLabel,children:"Forex & Metals"}),p.map(F=>h.jsxs("div",{style:{...aA.item,...F.symbol===A?aA.itemSelected:{}},onClick:()=>D(F.symbol),onMouseEnter:_=>{F.symbol!==A&&(_.currentTarget.style.backgroundColor="#334155")},onMouseLeave:_=>{F.symbol!==A&&(_.currentTarget.style.backgroundColor="transparent")},children:[h.jsx("span",{style:aA.symbolName,children:F.symbol}),F.bid&&h.jsx("span",{style:{...aA.symbolPrice,...parseFloat(F.change)>=0?aA.priceUp:aA.priceDown},children:parseFloat(F.bid).toFixed(5)})]},F.symbol))]}),Q.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{style:aA.categoryLabel,children:"Crypto"}),Q.map(F=>h.jsxs("div",{style:{...aA.item,...F.symbol===A?aA.itemSelected:{}},onClick:()=>D(F.symbol),onMouseEnter:_=>{F.symbol!==A&&(_.currentTarget.style.backgroundColor="#334155")},onMouseLeave:_=>{F.symbol!==A&&(_.currentTarget.style.backgroundColor="transparent")},children:[h.jsx("span",{style:aA.symbolName,children:F.symbol}),F.bid&&h.jsx("span",{style:{...aA.symbolPrice,...parseFloat(F.change)>=0?aA.priceUp:aA.priceDown},children:parseFloat(F.bid).toFixed(2)})]},F.symbol))]})]})})]})]})}const ht={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"}},Mv=[.01,.05,.1,.5,1];function hd({value:r,onChange:e,min:A=.01,max:t=100,step:i=.01,presets:n=Mv,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:a,className:c}){const[u,m]=J.useState(.1),y=r!==void 0?r:u,B=J.useCallback(F=>{const _=Math.max(A,Math.min(t,parseFloat(F)||A)),L=Math.round(_/i)*i,k=parseFloat(L.toFixed(8));r!==void 0||m(k),e?.(k)},[A,t,i,r,e]),p=()=>B(y+i),Q=()=>B(y-i),D=(y>=1,y.toFixed(2));return h.jsxs("div",{style:{...ht.container,...a},className:c,children:[o&&h.jsx("span",{style:ht.label,children:l}),h.jsx("button",{style:ht.btn,onClick:Q,onMouseEnter:F=>Object.assign(F.currentTarget.style,ht.btnHover),onMouseLeave:F=>{F.currentTarget.style.borderColor="#334155",F.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),h.jsx("input",{style:ht.input,type:"text",value:D,onChange:F=>{const _=F.target.value;if(_===""||_==="."||_==="0.")return;const L=parseFloat(_);isNaN(L)||B(L)},onBlur:()=>B(y)}),h.jsx("button",{style:ht.btn,onClick:p,onMouseEnter:F=>Object.assign(F.currentTarget.style,ht.btnHover),onMouseLeave:F=>{F.currentTarget.style.borderColor="#334155",F.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&h.jsx("div",{style:ht.presets,children:n.map(F=>h.jsx("button",{style:{...ht.preset,...Math.abs(y-F)<1e-4?ht.presetActive:{}},onClick:()=>B(F),onMouseEnter:_=>{Math.abs(y-F)>=1e-4&&Object.assign(_.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:_=>{Math.abs(y-F)>=1e-4&&(_.currentTarget.style.borderColor="#334155")},children:F},F))})]})}const OA={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 ud({value:r,onChange:e,enabled:A,onEnabledChange:t,mode:i,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:a="SL",style:c,className:u}){const{currentSymbolData:m}=TA(),[y,B]=J.useState(""),[p,Q]=J.useState(!1),[D,F]=J.useState("price"),_=r!==void 0?r:y,L=A!==void 0?A:p,k=i!==void 0?i:D,V=J.useCallback(X=>{A!==void 0||Q(X),t?.(X)},[A,t]),Z=J.useCallback(X=>{i!==void 0||F(X),n?.(X)},[i,n]),$=J.useCallback(X=>{r!==void 0||B(X),e?.(X)},[r,e]),z=X=>{const se=X.target.value;if(se===""||se==="."||se==="0."){$(se);return}const ae=parseFloat(se);isNaN(ae)||$(se)},R=k==="price"?m?.bid?parseFloat(m.bid).toFixed(5):"0.00000":"50";return h.jsxs("div",{style:{...OA.container,...c},className:u,children:[l&&h.jsx("span",{style:OA.label,children:a}),s&&h.jsx("button",{style:{...OA.toggle,...L?OA.toggleOn:OA.toggleOff},onClick:()=>V(!L),children:h.jsx("div",{style:{...OA.toggleKnob,...L?OA.knobOn:OA.knobOff}})}),(L||!s)&&h.jsxs("div",{style:OA.inputGroup,children:[h.jsx("input",{style:OA.input,type:"text",value:_,onChange:z,placeholder:R,onFocus:X=>X.currentTarget.style.borderColor="#EF5350",onBlur:X=>X.currentTarget.style.borderColor="#334155"}),o&&h.jsxs(h.Fragment,{children:[h.jsx("button",{style:{...OA.modeBtn,...k==="price"?OA.modeBtnActive:{}},onClick:()=>Z("price"),children:"Price"}),h.jsx("button",{style:{...OA.modeBtn,...k==="pips"?OA.modeBtnActive:{}},onClick:()=>Z("pips"),children:"Pips"})]})]})]})}const NA={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 dd({value:r,onChange:e,enabled:A,onEnabledChange:t,mode:i,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:a="TP",style:c,className:u}){const{currentSymbolData:m}=TA(),[y,B]=J.useState(""),[p,Q]=J.useState(!1),[D,F]=J.useState("price"),_=r!==void 0?r:y,L=A!==void 0?A:p,k=i!==void 0?i:D,V=J.useCallback(X=>{A!==void 0||Q(X),t?.(X)},[A,t]),Z=J.useCallback(X=>{i!==void 0||F(X),n?.(X)},[i,n]),$=J.useCallback(X=>{r!==void 0||B(X),e?.(X)},[r,e]),z=X=>{const se=X.target.value;if(se===""||se==="."||se==="0."){$(se);return}const ae=parseFloat(se);isNaN(ae)||$(se)},R=k==="price"?m?.ask?parseFloat(m.ask).toFixed(5):"0.00000":"50";return h.jsxs("div",{style:{...NA.container,...c},className:u,children:[l&&h.jsx("span",{style:NA.label,children:a}),s&&h.jsx("button",{style:{...NA.toggle,...L?NA.toggleOn:NA.toggleOff},onClick:()=>V(!L),children:h.jsx("div",{style:{...NA.toggleKnob,...L?NA.knobOn:NA.knobOff}})}),(L||!s)&&h.jsxs("div",{style:NA.inputGroup,children:[h.jsx("input",{style:NA.input,type:"text",value:_,onChange:z,placeholder:R,onFocus:X=>X.currentTarget.style.borderColor="#26A69A",onBlur:X=>X.currentTarget.style.borderColor="#334155"}),o&&h.jsxs(h.Fragment,{children:[h.jsx("button",{style:{...NA.modeBtn,...k==="price"?NA.modeBtnActive:{}},onClick:()=>Z("price"),children:"Price"}),h.jsx("button",{style:{...NA.modeBtn,...k==="pips"?NA.modeBtnActive:{}},onClick:()=>Z("pips"),children:"Pips"})]})]})]})}const Iv=[{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:"─"}],ut={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 fd({showLabel:r=!0,showDelete:e=!0,showVisibility:A=!0,tools:t,label:i="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:a,setDrawingsVisible:c,chartObjects:u,setChartObjects:m}=TA(),[y,B]=J.useState(null),p=t||Iv,Q=_=>{l(o===_?null:_)},D=()=>{m([]),l(null)},F=()=>{c(!a)};return h.jsxs("div",{style:{...ut.container,...n},className:s,children:[r&&h.jsx("span",{style:ut.label,children:i}),p.map(_=>h.jsxs("button",{style:{...ut.btn,...o===_.id?ut.btnActive:{}},onClick:()=>Q(_.id),onMouseEnter:L=>{B(_.id),o!==_.id&&Object.assign(L.currentTarget.style,ut.btnHover)},onMouseLeave:L=>{B(null),o!==_.id&&(L.currentTarget.style.borderColor="#334155",L.currentTarget.style.backgroundColor="#1e293b",L.currentTarget.style.color="#94a3b8")},title:_.name,children:[_.icon,y===_.id&&h.jsx("div",{style:ut.tooltip,children:_.name})]},_.id)),(e||A)&&h.jsx("div",{style:ut.divider}),A&&h.jsx("button",{style:{...ut.visibilityBtn,...a?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:F,onMouseEnter:_=>{_.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:_=>{_.currentTarget.style.borderColor="#334155"},title:a?"Hide Drawings":"Show Drawings",children:a?"👁":"○"}),e&&h.jsx("button",{style:ut.deleteBtn,onClick:D,onMouseEnter:_=>Object.assign(_.currentTarget.style,ut.deleteBtnHover),onMouseLeave:_=>{_.currentTarget.style.borderColor="#334155",_.currentTarget.style.backgroundColor="#1e293b",_.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const pd={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 _v({showCoinSelector:r=!0,showVolumeControl:e=!0,showStopLoss:A=!0,showTakeProfit:t=!0,showDrawingTools:i=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:a,stopLossEnabled:c,onStopLossEnabledChange:u,takeProfit:m,onTakeProfitChange:y,takeProfitEnabled:B,onTakeProfitEnabledChange:p,coinSelectorProps:Q={},volumeControlProps:D={},stopLossProps:F={},takeProfitProps:_={},drawingToolsProps:L={},style:k,className:V}){const Z=[];r&&Z.push(h.jsx(cd,{...Q},"coin")),e&&Z.push(h.jsx(hd,{value:s,onChange:o,...D},"volume")),A&&Z.push(h.jsx(ud,{value:l,onChange:a,enabled:c,onEnabledChange:u,...F},"sl")),t&&Z.push(h.jsx(dd,{value:m,onChange:y,enabled:B,onEnabledChange:p,..._},"tp")),i&&Z.push(h.jsx(fd,{...L},"draw"));const $=[];return Z.forEach((z,R)=>{$.push(z),n&&R<Z.length-1&&$.push(h.jsx("div",{style:pd.divider},`div-${R}`))}),h.jsx("div",{style:{...pd.toolbar,...k},className:V,children:$})}const Dv=[{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"}],fl={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 kv({style:r,className:e}){const{selectedTimeframe:A,setSelectedTimeframe:t}=TA();return h.jsx("div",{style:{...fl.container,...r},className:e,children:Dv.map(i=>h.jsx("button",{style:{...fl.btn,...A===i.value?fl.btnActive:{}},onClick:()=>t(i.value),onMouseEnter:n=>{A!==i.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{A!==i.value&&(n.currentTarget.style.borderColor="#334155")},children:i.label},i.value))})}const Ov=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],pl={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 Nv({style:r,className:e}){const{chartType:A,setChartType:t}=TA();return h.jsx("div",{style:{...pl.container,...r},className:e,children:Ov.map(i=>h.jsxs("button",{style:{...pl.btn,...A===i.value?pl.btnActive:{}},onClick:()=>t(i.value),onMouseEnter:n=>{A!==i.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{A!==i.value&&(n.currentTarget.style.borderColor="#334155")},title:i.label,children:[h.jsx("span",{children:i.icon}),h.jsx("span",{children:i.label})]},i.value))})}const HA={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 Kv({volume:r=.1,stopLoss:e,takeProfit:A,onTradeExecuted:t,style:i,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:a}=TA(),[c,u]=J.useState(null),m=parseFloat(o?.bid||0),y=parseFloat(o?.ask||0),B=y>0&&m>0?Math.abs(y-m):0,p=F=>!F||F===0?"-.-----":F>=1e3?F.toFixed(2):F>=1?F.toFixed(4):F.toFixed(5),Q=F=>F===0?"-":F>=1?F.toFixed(1):F>=.01?F.toFixed(3):(F*1e4).toFixed(1)+"p",D=J.useCallback(F=>{if(!s)return;const _=F==="BUY"?y:m;if(!_||_<=0){u({type:"error",message:"No price available"});return}const L={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:F,volume:r,price:_,stopLoss:e?parseFloat(e):null,takeProfit:A?parseFloat(A):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(V=>[...V,L]);const k=r*_*.01;a(V=>V-k),u({type:"success",message:`${F} executed`}),t?.(L),setTimeout(()=>u(null),3e3)},[s,y,m,r,e,A,l,a,t]);return h.jsxs("div",{style:{...HA.container,...i},className:n,children:[h.jsx("button",{style:HA.sellBtn,onClick:()=>D("SELL"),onMouseEnter:F=>{Object.assign(F.currentTarget.style,HA.sellBtnHover)},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#7f1d1d",F.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),h.jsxs("div",{style:HA.priceBox,children:[h.jsx("span",{style:HA.priceLabel,children:"Bid"}),h.jsx("span",{style:{...HA.priceValue,color:"#EF5350"},children:p(m)})]}),h.jsxs("div",{style:HA.spread,children:[h.jsx("span",{style:HA.spreadLabel,children:"Spread"}),h.jsx("span",{style:HA.spreadValue,children:Q(B)})]}),h.jsxs("div",{style:HA.priceBox,children:[h.jsx("span",{style:HA.priceLabel,children:"Ask"}),h.jsx("span",{style:{...HA.priceValue,color:"#26A69A"},children:p(y)})]}),h.jsx("button",{style:HA.buyBtn,onClick:()=>D("BUY"),onMouseEnter:F=>{Object.assign(F.currentTarget.style,HA.buyBtnHover)},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#14532d",F.currentTarget.style.borderColor="#166534"},children:"Buy"}),c&&h.jsx("span",{style:{...HA.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 Ge={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:e,maxHeight:A=200}){const{orders:t,setOrders:i,symbols:n,accountSummary:s,setUserBalance:o}=TA(),[l,a]=J.useState(null),c=t.filter(p=>p.status==="OPEN"||!p.closeAt),u=J.useCallback((p,Q)=>{const D=n.find(F=>F.symbol===p);return D?parseFloat(Q==="BUY"?D.bid||0:D.ask||0):0},[n]),m=J.useCallback(p=>{if(l)return;a(p.id);const Q=u(p.symbol,p.type),F=(p.type==="BUY"?Q-p.price:p.price-Q)*p.volume,_=p.volume*p.price*.01;i(L=>L.filter(k=>k.id!==p.id)),o(L=>L+_+F),a(null)},[l,u,i,o]),y=p=>{const Q=parseFloat(p);return!Q||isNaN(Q)?"-":Q>=1e3?Q.toFixed(2):Q>=1?Q.toFixed(4):Q.toFixed(5)},B=p=>{const Q=parseFloat(p);return isNaN(Q)?"-":(Q>=0?"+":"")+Q.toFixed(2)};return h.jsxs("div",{style:{...Ge.container,...r},className:e,children:[h.jsxs("div",{style:Ge.header,children:[h.jsxs("span",{style:Ge.headerTitle,children:["Positions (",c.length,")"]}),h.jsxs("div",{style:Ge.summary,children:[h.jsxs("div",{style:Ge.summaryItem,children:[h.jsx("span",{style:Ge.summaryLabel,children:"Balance:"}),h.jsxs("span",{style:{...Ge.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),h.jsxs("div",{style:Ge.summaryItem,children:[h.jsx("span",{style:Ge.summaryLabel,children:"Equity:"}),h.jsxs("span",{style:{...Ge.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),h.jsxs("div",{style:Ge.summaryItem,children:[h.jsx("span",{style:Ge.summaryLabel,children:"Free:"}),h.jsxs("span",{style:{...Ge.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),h.jsx("div",{style:{...Ge.scrollArea,maxHeight:A},children:h.jsxs("table",{style:Ge.table,children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{style:Ge.th,children:"Symbol"}),h.jsx("th",{style:Ge.th,children:"Type"}),h.jsx("th",{style:Ge.th,children:"Volume"}),h.jsx("th",{style:Ge.th,children:"Open Price"}),h.jsx("th",{style:Ge.th,children:"Current"}),h.jsx("th",{style:Ge.th,children:"SL"}),h.jsx("th",{style:Ge.th,children:"TP"}),h.jsx("th",{style:Ge.th,children:"Profit"}),h.jsx("th",{style:Ge.th,children:"Action"})]})}),h.jsx("tbody",{children:c.length===0?h.jsx("tr",{children:h.jsx("td",{colSpan:9,style:Ge.emptyRow,children:"No open positions"})}):c.map(p=>{const Q=u(p.symbol,p.type),D=p.profit||0;return h.jsxs("tr",{children:[h.jsx("td",{style:{...Ge.td,fontWeight:700,color:"#e2e8f0"},children:p.symbol}),h.jsx("td",{style:{...Ge.td,...p.type==="BUY"?Ge.typeBuy:Ge.typeSell},children:p.type}),h.jsx("td",{style:Ge.td,children:p.volume}),h.jsx("td",{style:Ge.td,children:y(p.price)}),h.jsx("td",{style:Ge.td,children:y(Q)}),h.jsx("td",{style:Ge.td,children:p.stopLoss?y(p.stopLoss):"-"}),h.jsx("td",{style:Ge.td,children:p.takeProfit?y(p.takeProfit):"-"}),h.jsx("td",{style:{...Ge.td,color:D>=0?"#26A69A":"#EF5350",fontWeight:700},children:B(D)}),h.jsx("td",{style:Ge.td,children:h.jsx("button",{style:{...Ge.closeBtn,...l===p.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>m(p),disabled:l===p.id,onMouseEnter:F=>{l!==p.id&&(F.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#7f1d1d"},children:l===p.id?"...":"Close"})})]},p.id)})})]})})]})}function Vv(r){return Vr({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 zv(r){return Vr({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 Gv=({selectedSymbol:r,selectedTimeframe:e,onTimeframeChange:A,chartType:t="candles",onChartTypeChange:i,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:a,onToggleFullscreen:c,marketWatchOpen:u=!0,onToggleMarketWatch:m,buySellPanelOpen:y,onMove:B})=>{const{theme:p}=TA(),Q=p==="light",D=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],F={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 ${Q?"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 ${Q?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(_=>h.jsx("button",{onClick:()=>i(_),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
11
- ${t===_?Q?"text-sky-600":"text-sky-400":Q?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
12
- `,title:_,children:F[_]},_))}),h.jsx("div",{className:`flex items-center gap-1 border-r ${Q?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(_=>h.jsx("button",{onClick:()=>i(_),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
13
- ${t===_?Q?"text-sky-600":"text-sky-400":Q?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
- `,title:_,children:F[_]},_))}),h.jsxs("div",{className:"flex items-center gap-2",children:[D.map(_=>h.jsx("button",{onClick:()=>A(_),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===_?Q?"text-sky-600":"text-sky-400":Q?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:_},_)),h.jsx("div",{className:`border-r h-6 mx-1 ${Q?"border-slate-200":"border-slate-700"}`}),h.jsx("button",{onClick:()=>l?.(),title:y?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${y?Q?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":Q?"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:n,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${Q?"text-slate-700 hover:text-slate-900 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 ${Q?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:s,className:`p-1 ${Q?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:h.jsx(Vv,{className:"w-5 h-5"})}),h.jsx("button",{onClick:o,className:`p-2 ${Q?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:h.jsx(zv,{className:"w-5 h-5"})}),h.jsx("div",{className:`border-r ${Q?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsx("button",{onClick:B,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${Q?"text-slate-700 hover:text-slate-900 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 ${Q?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsx("button",{type:"button",onClick:()=>m?.(),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?Q?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":Q?"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:()=>a?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${Q?"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 ${Q?"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"})})})]})]})},hi=[{label:"Trendline",toolId:2,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 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:"Horizontal Line",toolId:20,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),h.jsx("path",{d:"M19 9l3 3-3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Vertical Line",toolId:22,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[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"}),h.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),h.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[h.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),h.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),h.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),h.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),h.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),h.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{fillRule:"evenodd",d:"M5.054 17.988a2.988 2.988 0 0 1-1.31-.312 2.994 2.994 0 1 1 2.69 1.693 2.988 2.988 0 0 1-1.38-.381Zm-1 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),h.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),h.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),h.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),h.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],ui=[{label:"Regression Channel",toolId:40,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",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",clipRule:"evenodd",fill:"currentColor"})})},{label:"Equidistant Channel",toolId:3,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"M15 8a2.966 2.966 0 0 1-1.308-.312l-6 6c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l6-6A2.992 2.992 0 1 1 15 8ZM5 14a1 1 0 1 0 0 2.001A1 1 0 0 0 5 14ZM15 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm6.714 6.666-7.026 7.026a3.03 3.03 0 1 1-1.381-1.381l7.026-7.026a.977.977 0 1 1 1.381 1.381ZM12 18a1 1 0 1 0 0 2.001A1 1 0 0 0 12 18Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"StdDev Channel",toolId:41,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.381-1.382ZM10 15H9v4a1 1 0 1 1-2 0v-1H6a1 1 0 0 1 0-2h1v-4a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm7-7h-1v4a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1V5a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm-4.714 12.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.382-1.382h.001Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Andrews Pitchfork",toolId:42,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"m21.714 13.666-4.026 4.026c.203.406.31.854.312 1.308a3 3 0 0 1-6 0c.002-.454.11-.902.312-1.308L10 15.381l-2.312 2.311a3.03 3.03 0 1 1-1.381-1.381L8.619 14l-2.311-2.312a3 3 0 1 1-.001-5.377l4.026-4.026a.976.976 0 1 1 1.381 1.381L7.688 7.692a2.9 2.9 0 0 1 0 2.615L10 12.619l8.333-8.334a.976.976 0 1 1 1.381 1.381L11.381 14l2.312 2.312a2.9 2.9 0 0 1 2.614 0l4.026-4.026a.977.977 0 1 1 1.381 1.38ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],di=[{label:"Gann Line",toolId:43,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3 3 0 0 1-3 3 2.965 2.965 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l3-3a2.98 2.98 0 0 1 4-4l3-3A2.992 2.992 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2.001A1 1 0 0 0 5 18Zm7-7a1 1 0 1 0 0 2.001A1 1 0 0 0 12 11Zm7-7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Fan",toolId:44,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"M21.72 3.584 17.694 7.61c.202.407.31.854.312 1.308a3 3 0 0 1-3 3 2.967 2.967 0 0 1-1.308-.312l-4.45 4.45 10.109-4.042a.987.987 0 0 1 .834 1.79L8.167 18.61l7.75-.7a1.004 1.004 0 1 1 .18 2l-8.684.79a2.992 2.992 0 1 1-4.2-4.164l.794-8.7a1.004 1.004 0 1 1 2 .181L5.3 15.765 9.673 4.591a.969.969 0 0 1 1.3-.48 1 1 0 0 1 .47 1.32L7.79 14.77l4.538-4.538a2.98 2.98 0 0 1 4-4l4.026-4.026a.977.977 0 0 1 1.367 1.377ZM5.006 19.918a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm10-12a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Grid",toolId:45,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-.5.5L21 12l-3.809 3.809.5.5a3.034 3.034 0 1 1-1.381 1.381l-.5-.5L12 21l-3.809-3.809-.5.5c.202.407.308.855.309 1.309a3.03 3.03 0 1 1-1.693-2.689l.5-.5L3 12l3.81-3.81-.5-.5A2.966 2.966 0 0 1 5 8a3.031 3.031 0 1 1 2.689-1.693l.5.5L12 3l3.809 3.81.5-.5A2.993 2.993 0 1 1 19 8Zm0 12a1 1 0 1 0 0-2.002A1 1 0 0 0 19 20ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm7 14.452 2.536-2.536L12 13.381l-2.536 2.535L12 18.452ZM5.547 12l2.536 2.535L10.619 12 8.083 9.464 5.547 12ZM12 5.547 9.464 8.083 12 10.619l2.535-2.536L12 5.547Zm3.916 3.917L13.381 12l2.536 2.535L18.452 12l-2.536-2.536ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],fi=[{label:"Rectangle",toolId:5,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",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:"Circle",toolId:46,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12C22 10.2504 21.5507 8.60571 20.7611 7.17509C20.9149 6.81421 21 6.41704 21 6C21 4.34315 19.6569 3 18 3C17.583 3 17.1858 3.0851 16.8249 3.23888C15.3943 2.44933 13.7496 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12ZM12 20C16.4183 20 20 16.4183 20 12C20 10.8264 19.7473 9.7118 19.2933 8.70768C18.9017 8.89507 18.4631 9 18 9C17.5369 9 17.0983 8.89506 16.7066 8.70766L14.7077 10.7066C14.8951 11.0983 15 11.5369 15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.4632 9 12.9018 9.10496 13.2935 9.2924L15.2924 7.29348C15.105 6.90183 15 6.46317 15 6C15 5.5369 15.1049 5.09831 15.2923 4.7067C14.2882 4.25272 13.1736 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12ZM18 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 7Z",fill:"currentColor"})})},{label:"Triangle",toolId:47,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 6C15 7.65685 13.6569 9 12 9C11.763 9 11.5324 8.97252 11.3113 8.92057L7.37081 16.1613C6.95686 15.6284 6.36717 15.2388 5.68872 15.0794L9.62925 7.83858C9.23484 7.33074 9 6.6928 9 6C9 4.34315 10.3431 3 12 3C13.6569 3 15 4.34315 15 6ZM13 6C13 6.55228 12.5523 7 12 7C11.4477 7 11 6.55228 11 6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6Z",fill:"currentColor"}),h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.3708 7.83867C13.9569 8.37162 13.3672 8.76126 12.6887 8.9206L16.6292 16.1614C16.4344 16.4122 16.2786 16.6948 16.1707 17H7.82941C7.93996 17.3128 8.00012 17.6494 8.00012 18C8.00012 18.3506 7.93996 18.6872 7.8294 19H16.1707C16.5826 20.1652 17.6938 21 19 21C20.6569 21 22 19.6569 22 18C22 16.3431 20.6569 15 19 15C18.763 15 18.5324 15.0275 18.3113 15.0794L14.3708 7.83867ZM19 19C19.5523 19 20 18.5523 20 18C20 17.4477 19.5523 17 19 17C18.4477 17 18 17.4477 18 18C18 18.5523 18.4477 19 19 19Z",fill:"currentColor"}),h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00012 18C8.00012 19.6569 6.65685 21 5 21C3.34315 21 2 19.6569 2 18C2 16.3431 3.34315 15 5 15C6.65685 15 8.00012 16.3431 8.00012 18ZM6 18C6 18.5523 5.55228 19 5 19C4.44772 19 4 18.5523 4 18C4 17.4477 4.44772 17 5 17C5.55228 17 6 17.4477 6 18Z",fill:"currentColor"})]})},{label:"Ellipse",toolId:48,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3a3.001 3.001 0 0 0-2.935 2.378c-1.25.333-2.381.874-3.322 1.58a7.344 7.344 0 0 0-1.886 2.045 3 3 0 0 0 0 5.994 7.343 7.343 0 0 0 1.886 2.046C7.38 18.27 9.595 19 12 19s4.62-.73 6.257-1.957a7.343 7.343 0 0 0 1.886-2.046 3 3 0 0 0 0-5.994 7.344 7.344 0 0 0-1.886-2.046c-.94-.705-2.073-1.246-3.322-1.579A3.001 3.001 0 0 0 12 3Zm-1 3a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm7.156 3.634a5.584 5.584 0 0 0-1.1-1.077 7.61 7.61 0 0 0-2.391-1.177 3 3 0 0 1-5.33 0 7.61 7.61 0 0 0-2.392 1.177c-.437.328-.805.69-1.099 1.076A2.995 2.995 0 0 1 7 12c0 .962-.452 1.818-1.156 2.367.294.386.662.748 1.1 1.076C8.201 16.387 9.985 17 12 17c2.014 0 3.798-.613 5.057-1.557.437-.328.805-.69 1.099-1.077A2.995 2.995 0 0 1 17 12c0-.961.452-1.817 1.156-2.366ZM3 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm16 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z",fill:"currentColor"})})}],Yn=({children:r,top:e,panelRef:A,isLight:t})=>h.jsx("div",{ref:A,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${t?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:h.jsx("div",{className:"py-1",children:r})}),Wv=({AccountId:r,UserName:e,UserId:A})=>{const{activeTool:t,setActiveTool:i,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:a,setChartObjects:c,drawingsVisible:u,setDrawingsVisible:m,chartLocked:y,setChartLocked:B,theme:p,setTheme:Q}=TA(),[D,F]=J.useState(!1),[_,L]=J.useState(null),[k,V]=J.useState(null),[Z,$]=J.useState(0),[z,R]=J.useState(!1),[X,se]=J.useState(0),[ae,ye]=J.useState(!1),[Le,Qe]=J.useState(0),[xe,Se]=J.useState(!1),[pe,Be]=J.useState(0),[Ce,Fe]=J.useState(!1),[be,le]=J.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),qe=J.useRef(null),Ie=J.useRef(null),we=J.useRef(null),Ke=J.useRef(null),ce=J.useRef(null),De=J.useRef(null);J.useEffect(()=>{const oe=Ee=>{const ne=qe.current;D&&ne&&!ne.contains(Ee.target)&&(F(!1),L(null));const de=Ie.current;k==="line"&&de&&!de.contains(Ee.target)&&V(null);const ke=we.current;k==="channel"&&ke&&!ke.contains(Ee.target)&&V(null);const Me=Ke.current;k==="gann"&&Me&&!Me.contains(Ee.target)&&V(null);const Je=ce.current;k==="shape"&&Je&&!Je.contains(Ee.target)&&V(null)};return window.addEventListener("mousedown",oe),()=>window.removeEventListener("mousedown",oe)},[D,k]),J.useEffect(()=>{const oe=Ee=>{Ee.key==="Escape"&&(F(!1),L(null),V(null))};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[]);const Ye=J.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:"20",height:"20",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:"20",height:"20",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:"20",height:"20",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:"20",height:"20",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",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",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:"20",height:"20",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:"20",height:"20",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:"20",height:"20",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:"20",height:"20",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"}],[]),je=oe=>{const Ee=Ye[oe].label;if(Ee==="Menu"){F(ne=>!ne),L(null);return}if(Ee==="Grid"){s(!n);return}if(Ee==="Magnet"){l(!o),i(o?null:oe);return}if(Ee==="Delete"){if(a.length>0){const ne=[...a];ne.pop(),c(ne)}return}if(Ee==="Eye"){m(!u);return}if(Ee==="Lock"){B(!y);return}if(Ee==="Light Theme"||Ee==="Dark Theme"){Q(p==="light"?"dark":"light"),F(!1),L(null);return}i(t===oe?null:oe)};Ye.slice(0,12);const Oe=Ye.slice(12),We=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],Pe=[{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:p==="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:"20",height:"20",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"})]})}],tA=({item:oe})=>{const Ee=!!oe.submenu?.length;return h.jsxs("div",{className:"relative",onMouseEnter:()=>{De.current&&(clearTimeout(De.current),De.current=null),Ee&&L(oe.key)},onMouseLeave:()=>{Ee&&(De.current=setTimeout(()=>L(null),120))},children:[h.jsxs("button",{type:"button",onClick:()=>{Ee?L(ne=>ne===oe.key?null:oe.key):(oe.key==="theme"&&Q(ne=>ne==="light"?"dark":"light"),F(!1),L(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${ge?"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 ${ge?"text-slate-500":"text-slate-400"}`,children:oe.icon}),h.jsx("span",{className:"flex-1 text-[15px]",children:oe.label}),oe.rightText&&h.jsx("span",{className:`text-xs ${ge?"text-slate-500":"text-slate-400"}`,children:oe.rightText}),Ee&&h.jsx("svg",{className:`w-4 h-4 ${ge?"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"})})]}),Ee&&_===oe.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 ${ge?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:h.jsx("div",{className:"py-1",children:oe.submenu.map((ne,de)=>{const ke=be[oe.key]===ne.label||ne.selected&&be[oe.key]==null;return h.jsxs("button",{type:"button",onClick:()=>{le(Me=>({...Me,[oe.key]:ne.label})),console.log("Sub selected:",oe.key,ne.label)},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${ge?"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 ${ge?"text-slate-500":"text-slate-400"}`,children:ne.icon||null}),h.jsx("span",{className:"flex-1 min-w-0",children:ne.label}),ke&&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"})})})]},de)})})})]})},ge=p==="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 ${ge?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[h.jsx("div",{className:"flex flex-col items-center gap-2",children:We.map((oe,Ee)=>{const ne=oe==="gann",de=ne?null:Ye[oe],ke=ne?-1:oe;return h.jsxs(J.Fragment,{children:[ke===2?h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>{const Me=hi[Z].toolId;i(t===Me?null:Me)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
15
- ${t===hi[Z].toolId?ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:hi[Z].label,children:hi[Z].icon}),h.jsx("span",{onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),onMouseDown:Me=>{Me.stopPropagation(),V(Je=>Je==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:z?10:7,height:z?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More line tools",children:h.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("polygon",{points:"10,10 0,10 10,0",fill:ge?"#64748b":"#94a3b8"})})})]}):ke===3?h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>{const Me=ui[X].toolId;i(t===Me?null:Me)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
16
- ${t===ui[X].toolId?ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:ui[X].label,children:ui[X].icon}),h.jsx("span",{onMouseEnter:()=>ye(!0),onMouseLeave:()=>ye(!1),onMouseDown:Me=>{Me.stopPropagation(),V(Je=>Je==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:ae?10:7,height:ae?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More channel tools",children:h.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("polygon",{points:"10,10 0,10 10,0",fill:ge?"#64748b":"#94a3b8"})})})]}):ne?h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>{const Me=di[Le].toolId;i(t===Me?null:Me)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
- ${t===di[Le].toolId?ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:di[Le].label,children:di[Le].icon}),h.jsx("span",{onMouseEnter:()=>Se(!0),onMouseLeave:()=>Se(!1),onMouseDown:Me=>{Me.stopPropagation(),V(Je=>Je==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:xe?10:7,height:xe?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More Gann tools",children:h.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("polygon",{points:"10,10 0,10 10,0",fill:ge?"#64748b":"#94a3b8"})})})]}):ke===5?h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>{const Me=fi[pe].toolId;i(t===Me?null:Me)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
- ${t===fi[pe].toolId?ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:fi[pe].label,children:fi[pe].icon}),h.jsx("span",{onMouseEnter:()=>Fe(!0),onMouseLeave:()=>Fe(!1),onMouseDown:Me=>{Me.stopPropagation(),V(Je=>Je==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:Ce?10:7,height:Ce?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More shape tools",children:h.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("polygon",{points:"10,10 0,10 10,0",fill:ge?"#64748b":"#94a3b8"})})})]}):h.jsx("button",{onClick:()=>je(ke),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
19
- ${de.label==="Grid"&&n||de.label==="Eye"&&!u||de.label==="Lock"&&y||t===ke?ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${de.label}: ${de.description}`,children:de.icon}),!ne&&de.label==="Text"&&h.jsx("div",{className:`w-8 border-t my-1 ${ge?"border-slate-200":"border-slate-700"}`})]},ne?"gann-slot":`${de.label}-${oe}`)})}),h.jsx("div",{className:"flex-1"}),h.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:Oe.map((oe,Ee)=>{const ne=12+Ee;return h.jsx("button",{onClick:()=>je(ne),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
20
- ${oe.label==="Grid"&&n||oe.label==="Eye"&&!u||oe.label==="Lock"&&y||t===ne?ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${oe.label}: ${oe.description}`,children:oe.icon},oe.label)})})]}),k==="line"&&h.jsx(Yn,{top:84,panelRef:Ie,isLight:ge,children:hi.map((oe,Ee)=>{const ne=Z===Ee;return h.jsxs("button",{type:"button",onMouseDown:de=>{de.stopPropagation(),$(Ee),i(oe.toolId),V(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${ge?"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 ${ge?"text-slate-500":"text-slate-400"}`,children:oe.icon}),h.jsx("span",{className:"flex-1",children:oe.label}),ne&&h.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{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"})})})]},oe.toolId)})}),k==="channel"&&h.jsx(Yn,{top:128,panelRef:we,isLight:ge,children:ui.map((oe,Ee)=>{const ne=X===Ee;return h.jsxs("button",{type:"button",onMouseDown:de=>{de.stopPropagation(),se(Ee),i(oe.toolId),V(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${ge?"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 ${ge?"text-slate-500":"text-slate-400"}`,children:oe.icon}),h.jsx("span",{className:"flex-1",children:oe.label}),ne&&h.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{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"})})})]},oe.toolId)})}),k==="gann"&&h.jsx(Yn,{top:210,panelRef:Ke,isLight:ge,children:di.map((oe,Ee)=>{const ne=Le===Ee;return h.jsxs("button",{type:"button",onMouseDown:de=>{de.stopPropagation(),Qe(Ee),i(oe.toolId),V(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${ge?"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 ${ge?"text-slate-500":"text-slate-400"}`,children:oe.icon}),h.jsx("span",{className:"flex-1",children:oe.label}),ne&&h.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{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"})})})]},oe.toolId)})}),k==="shape"&&h.jsx(Yn,{top:250,panelRef:ce,isLight:ge,children:fi.map((oe,Ee)=>{const ne=pe===Ee;return h.jsxs("button",{type:"button",onMouseDown:de=>{de.stopPropagation(),Be(Ee),i(oe.toolId),V(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${ge?"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 ${ge?"text-slate-500":"text-slate-400"}`,children:oe.icon}),h.jsx("span",{className:"flex-1",children:oe.label}),ne&&h.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{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"})})})]},oe.toolId)})}),D&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{F(!1),L(null)},"aria-hidden":"true"}),h.jsxs("div",{ref:qe,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${ge?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[h.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${ge?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[h.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${ge?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),h.jsx("div",{className:`text-[12px] mt-0.5 ${ge?"text-slate-500":"text-slate-400"}`,children:r})]}),h.jsx("div",{className:"py-2",children:Pe.map(oe=>h.jsx(tA,{item:oe},oe.key))})]})]})]})};function Rv(r){return Vr({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 $v=({width:r=256,symbols:e=[],selectedSymbol:A,onSymbolSelect:t,symbolsLoading:i=!1,isOpen:n})=>{const{theme:s}=TA(),o=s==="light",[l,a]=J.useState(""),c=e.filter(y=>y.symbol.toLowerCase().includes(l.toLowerCase())),u=c.filter(y=>!y.symbol.toUpperCase().endsWith("USDT")),m=c.filter(y=>y.symbol.toUpperCase().endsWith("USDT"));return h.jsxs(h.Fragment,{children:[h.jsx("style",{children:`
9
+ }`,S2=function(r){H2(r,"."+aa+U2+Zu+`
10
+ .`+la+E2+Zu)},H2=function(r,e){var A=r.ownerDocument;if(A){var t=A.createElement("style");t.textContent=e,r.appendChild(t)}},qu=(function(){function r(){}return r.getOrigin=function(e){var A=r._link;return A?(A.href=e,A.href=A.href,A.protocol+A.hostname+A.port):"about:blank"},r.isSameOrigin=function(e){return r.getOrigin(e)===r._origin},r.setContext=function(e){r._link=e.document.createElement("a"),r._origin=r.getOrigin(e.location.href)},r._origin="about:blank",r})(),L2=(function(){function r(e,A){this.context=e,this._options=A,this._cache={}}return r.prototype.addImage=function(e){var A=Promise.resolve();return this.has(e)||(ha(e)||D2(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),A},r.prototype.match=function(e){return this._cache[e]},r.prototype.loadImage=function(e){return MA(this,void 0,void 0,function(){var A,t,i,n,s=this;return SA(this,function(o){switch(o.label){case 0:return A=qu.isSameOrigin(e),t=!ca(e)&&this._options.useCORS===!0&&TA.SUPPORT_CORS_IMAGES&&!A,i=!ca(e)&&!A&&!ha(e)&&typeof this._options.proxy=="string"&&TA.SUPPORT_CORS_XHR&&!t,!A&&this._options.allowTaint===!1&&!ca(e)&&!ha(e)&&!i&&!t?[2]:(n=e,i?[4,this.proxy(n)]:[3,2]);case 1:n=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,l){var c=new Image;c.onload=function(){return a(c)},c.onerror=l,(k2(n)||t)&&(c.crossOrigin="anonymous"),c.src=n,c.complete===!0&&setTimeout(function(){return a(c)},500),s._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(e){return typeof this._cache[e]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(e){var A=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(n,s){var o=TA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")n(a.response);else{var d=new FileReader;d.addEventListener("load",function(){return n(d.result)},!1),d.addEventListener("error",function(p){return s(p)},!1),d.readAsDataURL(a.response)}else s("Failed to proxy resource "+i+" with status code "+a.status)},a.onerror=s;var l=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+l+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),A._options.imageTimeout){var c=A._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return s("Timed out ("+c+"ms) proxying "+i)}}a.send()})},r})(),M2=/^data:image\/svg\+xml/i,I2=/^data:image\/.*;base64,/i,_2=/^data:image\/.*/i,D2=function(r){return TA.SUPPORT_SVG_DRAWING||!O2(r)},ca=function(r){return _2.test(r)},k2=function(r){return I2.test(r)},ha=function(r){return r.substr(0,4)==="blob"},O2=function(r){return r.substr(-3).toLowerCase()==="svg"||M2.test(r)},be=(function(){function r(e,A){this.type=0,this.x=e,this.y=A}return r.prototype.add=function(e,A){return new r(this.x+e,this.y+A)},r})(),yr=function(r,e,A){return new be(r.x+(e.x-r.x)*A,r.y+(e.y-r.y)*A)},$n=(function(){function r(e,A,t,i){this.type=1,this.start=e,this.startControl=A,this.endControl=t,this.end=i}return r.prototype.subdivide=function(e,A){var t=yr(this.start,this.startControl,e),i=yr(this.startControl,this.endControl,e),n=yr(this.endControl,this.end,e),s=yr(t,i,e),o=yr(i,n,e),a=yr(s,o,e);return A?new r(this.start,t,s,a):new r(a,o,n,this.end)},r.prototype.add=function(e,A){return new r(this.start.add(e,A),this.startControl.add(e,A),this.endControl.add(e,A),this.end.add(e,A))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r})(),YA=function(r){return r.type===1},N2=(function(){function r(e){var A=e.styles,t=e.bounds,i=oi(A.borderTopLeftRadius,t.width,t.height),n=i[0],s=i[1],o=oi(A.borderTopRightRadius,t.width,t.height),a=o[0],l=o[1],c=oi(A.borderBottomRightRadius,t.width,t.height),d=c[0],p=c[1],y=oi(A.borderBottomLeftRadius,t.width,t.height),w=y[0],C=y[1],v=[];v.push((n+a)/t.width),v.push((w+d)/t.width),v.push((s+C)/t.height),v.push((l+p)/t.height);var S=Math.max.apply(Math,v);S>1&&(n/=S,s/=S,a/=S,l/=S,d/=S,p/=S,w/=S,C/=S);var F=t.width-a,k=t.height-p,x=t.width-d,V=t.height-C,N=A.borderTopWidth,Z=A.borderRightWidth,X=A.borderBottomWidth,W=A.borderLeftWidth,ae=rA(A.paddingTop,e.bounds.width),G=rA(A.paddingRight,e.bounds.width),ee=rA(A.paddingBottom,e.bounds.width),oe=rA(A.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?aA(t.left+W/3,t.top+N/3,n-W/3,s-N/3,AA.TOP_LEFT):new be(t.left+W/3,t.top+N/3),this.topRightBorderDoubleOuterBox=n>0||s>0?aA(t.left+F,t.top+N/3,a-Z/3,l-N/3,AA.TOP_RIGHT):new be(t.left+t.width-Z/3,t.top+N/3),this.bottomRightBorderDoubleOuterBox=d>0||p>0?aA(t.left+x,t.top+k,d-Z/3,p-X/3,AA.BOTTOM_RIGHT):new be(t.left+t.width-Z/3,t.top+t.height-X/3),this.bottomLeftBorderDoubleOuterBox=w>0||C>0?aA(t.left+W/3,t.top+V,w-W/3,C-X/3,AA.BOTTOM_LEFT):new be(t.left+W/3,t.top+t.height-X/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?aA(t.left+W*2/3,t.top+N*2/3,n-W*2/3,s-N*2/3,AA.TOP_LEFT):new be(t.left+W*2/3,t.top+N*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?aA(t.left+F,t.top+N*2/3,a-Z*2/3,l-N*2/3,AA.TOP_RIGHT):new be(t.left+t.width-Z*2/3,t.top+N*2/3),this.bottomRightBorderDoubleInnerBox=d>0||p>0?aA(t.left+x,t.top+k,d-Z*2/3,p-X*2/3,AA.BOTTOM_RIGHT):new be(t.left+t.width-Z*2/3,t.top+t.height-X*2/3),this.bottomLeftBorderDoubleInnerBox=w>0||C>0?aA(t.left+W*2/3,t.top+V,w-W*2/3,C-X*2/3,AA.BOTTOM_LEFT):new be(t.left+W*2/3,t.top+t.height-X*2/3),this.topLeftBorderStroke=n>0||s>0?aA(t.left+W/2,t.top+N/2,n-W/2,s-N/2,AA.TOP_LEFT):new be(t.left+W/2,t.top+N/2),this.topRightBorderStroke=n>0||s>0?aA(t.left+F,t.top+N/2,a-Z/2,l-N/2,AA.TOP_RIGHT):new be(t.left+t.width-Z/2,t.top+N/2),this.bottomRightBorderStroke=d>0||p>0?aA(t.left+x,t.top+k,d-Z/2,p-X/2,AA.BOTTOM_RIGHT):new be(t.left+t.width-Z/2,t.top+t.height-X/2),this.bottomLeftBorderStroke=w>0||C>0?aA(t.left+W/2,t.top+V,w-W/2,C-X/2,AA.BOTTOM_LEFT):new be(t.left+W/2,t.top+t.height-X/2),this.topLeftBorderBox=n>0||s>0?aA(t.left,t.top,n,s,AA.TOP_LEFT):new be(t.left,t.top),this.topRightBorderBox=a>0||l>0?aA(t.left+F,t.top,a,l,AA.TOP_RIGHT):new be(t.left+t.width,t.top),this.bottomRightBorderBox=d>0||p>0?aA(t.left+x,t.top+k,d,p,AA.BOTTOM_RIGHT):new be(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=w>0||C>0?aA(t.left,t.top+V,w,C,AA.BOTTOM_LEFT):new be(t.left,t.top+t.height),this.topLeftPaddingBox=n>0||s>0?aA(t.left+W,t.top+N,Math.max(0,n-W),Math.max(0,s-N),AA.TOP_LEFT):new be(t.left+W,t.top+N),this.topRightPaddingBox=a>0||l>0?aA(t.left+Math.min(F,t.width-Z),t.top+N,F>t.width+Z?0:Math.max(0,a-Z),Math.max(0,l-N),AA.TOP_RIGHT):new be(t.left+t.width-Z,t.top+N),this.bottomRightPaddingBox=d>0||p>0?aA(t.left+Math.min(x,t.width-W),t.top+Math.min(k,t.height-X),Math.max(0,d-Z),Math.max(0,p-X),AA.BOTTOM_RIGHT):new be(t.left+t.width-Z,t.top+t.height-X),this.bottomLeftPaddingBox=w>0||C>0?aA(t.left+W,t.top+Math.min(V,t.height-X),Math.max(0,w-W),Math.max(0,C-X),AA.BOTTOM_LEFT):new be(t.left+W,t.top+t.height-X),this.topLeftContentBox=n>0||s>0?aA(t.left+W+oe,t.top+N+ae,Math.max(0,n-(W+oe)),Math.max(0,s-(N+ae)),AA.TOP_LEFT):new be(t.left+W+oe,t.top+N+ae),this.topRightContentBox=a>0||l>0?aA(t.left+Math.min(F,t.width+W+oe),t.top+N+ae,F>t.width+W+oe?0:a-W+oe,l-(N+ae),AA.TOP_RIGHT):new be(t.left+t.width-(Z+G),t.top+N+ae),this.bottomRightContentBox=d>0||p>0?aA(t.left+Math.min(x,t.width-(W+oe)),t.top+Math.min(k,t.height+N+ae),Math.max(0,d-(Z+G)),p-(X+ee),AA.BOTTOM_RIGHT):new be(t.left+t.width-(Z+G),t.top+t.height-(X+ee)),this.bottomLeftContentBox=w>0||C>0?aA(t.left+W+oe,t.top+V,Math.max(0,w-(W+oe)),C-(X+ee),AA.BOTTOM_LEFT):new be(t.left+W+oe,t.top+t.height-(X+ee))}return r})(),AA;(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"})(AA||(AA={}));var aA=function(r,e,A,t,i){var n=4*((Math.sqrt(2)-1)/3),s=A*n,o=t*n,a=r+A,l=e+t;switch(i){case AA.TOP_LEFT:return new $n(new be(r,l),new be(r,l-o),new be(a-s,e),new be(a,e));case AA.TOP_RIGHT:return new $n(new be(r,e),new be(r+s,e),new be(a,l-o),new be(a,l));case AA.BOTTOM_RIGHT:return new $n(new be(a,e),new be(a,e+o),new be(r+s,l),new be(r,l));case AA.BOTTOM_LEFT:default:return new $n(new be(a,l),new be(a-s,l),new be(r,e+o),new be(r,e))}},Xn=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},K2=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},Jn=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},P2=(function(){function r(e,A,t){this.offsetX=e,this.offsetY=A,this.matrix=t,this.type=0,this.target=6}return r})(),Zn=(function(){function r(e,A){this.path=e,this.target=A,this.type=1}return r})(),V2=(function(){function r(e){this.opacity=e,this.type=2,this.target=6}return r})(),z2=function(r){return r.type===0},Yu=function(r){return r.type===1},G2=function(r){return r.type===2},ju=function(r,e){return r.length===e.length?r.some(function(A,t){return A===e[t]}):!1},R2=function(r,e,A,t,i){return r.map(function(n,s){switch(s){case 0:return n.add(e,A);case 1:return n.add(e+t,A);case 2:return n.add(e+t,A+i);case 3:return n.add(e,A+i)}return n})},ed=(function(){function r(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r})(),Ad=(function(){function r(e,A){if(this.container=e,this.parent=A,this.effects=[],this.curves=new N2(this.container),this.container.styles.opacity<1&&this.effects.push(new V2(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new P2(t,i,n))}if(this.container.styles.overflowX!==0){var s=Xn(this.curves),o=Jn(this.curves);ju(s,o)?this.effects.push(new Zn(s,6)):(this.effects.push(new Zn(s,2)),this.effects.push(new Zn(o,4)))}}return r.prototype.getEffects=function(e){for(var A=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,i=this.effects.slice(0);t;){var n=t.effects.filter(function(a){return!Yu(a)});if(A||t.container.styles.position!==0||!t.parent){if(i.unshift.apply(i,n),A=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var s=Xn(t.curves),o=Jn(t.curves);ju(s,o)||i.unshift(new Zn(o,6))}}else i.unshift.apply(i,n);t=t.parent}return i.filter(function(a){return wA(a.target,e)})},r})(),ua=function(r,e,A,t){r.container.elements.forEach(function(i){var n=wA(i.flags,4),s=wA(i.flags,2),o=new Ad(i,r);wA(i.styles.display,2048)&&t.push(o);var a=wA(i.flags,8)?[]:t;if(n||s){var l=n||i.styles.isPositioned()?A:e,c=new ed(o);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var d=i.styles.zIndex.order;if(d<0){var p=0;l.negativeZIndex.some(function(w,C){return d>w.element.container.styles.zIndex.order?(p=C,!1):p>0}),l.negativeZIndex.splice(p,0,c)}else if(d>0){var y=0;l.positiveZIndex.some(function(w,C){return d>=w.element.container.styles.zIndex.order?(y=C+1,!1):y>0}),l.positiveZIndex.splice(y,0,c)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else i.styles.isFloating()?l.nonPositionedFloats.push(c):l.nonPositionedInlineLevel.push(c);ua(o,c,n?c:A,a)}else i.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),ua(o,e,A,a);wA(i.flags,8)&&td(i,a)})},td=function(r,e){for(var A=r instanceof Aa?r.start:1,t=r instanceof Aa?r.reversed:!1,i=0;i<e.length;i++){var n=e[i];n.container instanceof Fu&&typeof n.container.value=="number"&&n.container.value!==0&&(A=n.container.value),n.listValue=di(A,n.container.styles.listStyleType,!0),A+=t?-1:1}},W2=function(r){var e=new Ad(r,null),A=new ed(e),t=[];return ua(e,A,A,t),td(e.container,t),A},rd=function(r,e){switch(e){case 0:return jA(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return jA(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return jA(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);default:return jA(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},$2=function(r,e){switch(e){case 0:return jA(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return jA(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return jA(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);default:return jA(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},X2=function(r,e){switch(e){case 0:return jA(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return jA(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return jA(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);default:return jA(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},J2=function(r,e){switch(e){case 0:return qn(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return qn(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return qn(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);default:return qn(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},qn=function(r,e){var A=[];return YA(r)?A.push(r.subdivide(.5,!1)):A.push(r),YA(e)?A.push(e.subdivide(.5,!0)):A.push(e),A},jA=function(r,e,A,t){var i=[];return YA(r)?i.push(r.subdivide(.5,!1)):i.push(r),YA(A)?i.push(A.subdivide(.5,!0)):i.push(A),YA(t)?i.push(t.subdivide(.5,!0).reverse()):i.push(t),YA(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},id=function(r){var e=r.bounds,A=r.styles;return e.add(A.borderLeftWidth,A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth),-(A.borderTopWidth+A.borderBottomWidth))},Yn=function(r){var e=r.styles,A=r.bounds,t=rA(e.paddingLeft,A.width),i=rA(e.paddingRight,A.width),n=rA(e.paddingTop,A.width),s=rA(e.paddingBottom,A.width);return A.add(t+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+t+i),-(e.borderTopWidth+e.borderBottomWidth+n+s))},Z2=function(r,e){return r===0?e.bounds:r===2?Yn(e):id(e)},q2=function(r,e){return r===0?e.bounds:r===2?Yn(e):id(e)},da=function(r,e,A){var t=Z2(Tr(r.styles.backgroundOrigin,e),r),i=q2(Tr(r.styles.backgroundClip,e),r),n=Y2(Tr(r.styles.backgroundSize,e),A,t),s=n[0],o=n[1],a=oi(Tr(r.styles.backgroundPosition,e),t.width-s,t.height-o),l=j2(Tr(r.styles.backgroundRepeat,e),a,n,t,i),c=Math.round(t.left+a[0]),d=Math.round(t.top+a[1]);return[l,c,d,s,o]},br=function(r){return tA(r)&&r.value===Br.AUTO},jn=function(r){return typeof r=="number"},Y2=function(r,e,A){var t=e[0],i=e[1],n=e[2],s=r[0],o=r[1];if(!s)return[0,0];if(mA(s)&&o&&mA(o))return[rA(s,A.width),rA(o,A.height)];var a=jn(n);if(tA(s)&&(s.value===Br.CONTAIN||s.value===Br.COVER)){if(jn(n)){var l=A.width/A.height;return l<n!=(s.value===Br.COVER)?[A.width,A.width/n]:[A.height*n,A.height]}return[A.width,A.height]}var c=jn(t),d=jn(i),p=c||d;if(br(s)&&(!o||br(o))){if(c&&d)return[t,i];if(!a&&!p)return[A.width,A.height];if(p&&a){var y=c?t:i*n,w=d?i:t/n;return[y,w]}var C=c?t:A.width,v=d?i:A.height;return[C,v]}if(a){var S=0,F=0;return mA(s)?S=rA(s,A.width):mA(o)&&(F=rA(o,A.height)),br(s)?S=F*n:(!o||br(o))&&(F=S/n),[S,F]}var k=null,x=null;if(mA(s)?k=rA(s,A.width):o&&mA(o)&&(x=rA(o,A.height)),k!==null&&(!o||br(o))&&(x=c&&d?k/t*i:A.height),x!==null&&br(s)&&(k=c&&d?x/i*t:A.width),k!==null&&x!==null)return[k,x];throw new Error("Unable to calculate background-size for element")},Tr=function(r,e){var A=r[e];return typeof A>"u"?r[0]:A},j2=function(r,e,A,t,i){var n=e[0],s=e[1],o=A[0],a=A[1];switch(r){case 2:return[new be(Math.round(t.left),Math.round(t.top+s)),new be(Math.round(t.left+t.width),Math.round(t.top+s)),new be(Math.round(t.left+t.width),Math.round(a+t.top+s)),new be(Math.round(t.left),Math.round(a+t.top+s))];case 3:return[new be(Math.round(t.left+n),Math.round(t.top)),new be(Math.round(t.left+n+o),Math.round(t.top)),new be(Math.round(t.left+n+o),Math.round(t.height+t.top)),new be(Math.round(t.left+n),Math.round(t.height+t.top))];case 1:return[new be(Math.round(t.left+n),Math.round(t.top+s)),new be(Math.round(t.left+n+o),Math.round(t.top+s)),new be(Math.round(t.left+n+o),Math.round(t.top+s+a)),new be(Math.round(t.left+n),Math.round(t.top+s+a))];default:return[new be(Math.round(i.left),Math.round(i.top)),new be(Math.round(i.left+i.width),Math.round(i.top)),new be(Math.round(i.left+i.width),Math.round(i.height+i.top)),new be(Math.round(i.left),Math.round(i.height+i.top))]}},ev="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",nd="Hidden Text",Av=(function(){function r(e){this._data={},this._document=e}return r.prototype.parseMetrics=function(e,A){var t=this._document.createElement("div"),i=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;t.style.visibility="hidden",t.style.fontFamily=e,t.style.fontSize=A,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",s.appendChild(t),i.src=ev,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=A,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(nd)),t.appendChild(n),t.appendChild(i);var o=i.offsetTop-n.offsetTop+2;t.removeChild(n),t.appendChild(this._document.createTextNode(nd)),t.style.lineHeight="normal",i.style.verticalAlign="super";var a=i.offsetTop-t.offsetTop+2;return s.removeChild(t),{baseline:o,middle:a}},r.prototype.getMetrics=function(e,A){var t=e+" "+A;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(e,A)),this._data[t]},r})(),sd=(function(){function r(e,A){this.context=e,this.options=A}return r})(),tv=1e4,rv=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i._activeEffects=[],i.canvas=t.canvas?t.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),t.canvas||(i.canvas.width=Math.floor(t.width*t.scale),i.canvas.height=Math.floor(t.height*t.scale),i.canvas.style.width=t.width+"px",i.canvas.style.height=t.height+"px"),i.fontMetrics=new Av(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-t.x,-t.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),i}return e.prototype.applyEffects=function(A){for(var t=this;this._activeEffects.length;)this.popEffect();A.forEach(function(i){return t.applyEffect(i)})},e.prototype.applyEffect=function(A){this.ctx.save(),G2(A)&&(this.ctx.globalAlpha=A.opacity),z2(A)&&(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)),Yu(A)&&(this.path(A.path),this.ctx.clip()),this._activeEffects.push(A)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(A){return MA(this,void 0,void 0,function(){var t;return SA(this,function(i){switch(i.label){case 0:return t=A.element.container.styles,t.isVisible()?[4,this.renderStackContent(A)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(A){return MA(this,void 0,void 0,function(){return SA(this,function(t){switch(t.label){case 0:if(wA(A.container.flags,16))debugger;return A.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(A)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(A)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(A,t,i){var n=this;if(t===0)this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+i);else{var s=ea(A.text);s.reduce(function(o,a){return n.ctx.fillText(a,o,A.bounds.top+i),o+n.ctx.measureText(a).width},A.bounds.left)}},e.prototype.createFontStyle=function(A){var t=A.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=av(A.fontFamily).join(", "),n=si(A.fontSize)?""+A.fontSize.number+A.fontSize.unit:A.fontSize.number+"px";return[[A.fontStyle,t,A.fontWeight,n,i].join(" "),i,n]},e.prototype.renderTextNode=function(A,t){return MA(this,void 0,void 0,function(){var i,n,s,o,a,l,c,d,p=this;return SA(this,function(y){return i=this.createFontStyle(t),n=i[0],s=i[1],o=i[2],this.ctx.font=n,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(s,o),l=a.baseline,c=a.middle,d=t.paintOrder,A.textBounds.forEach(function(w){d.forEach(function(C){switch(C){case 0:p.ctx.fillStyle=vA(t.color),p.renderTextWithLetterSpacing(w,t.letterSpacing,l);var v=t.textShadow;v.length&&w.text.trim().length&&(v.slice(0).reverse().forEach(function(S){p.ctx.shadowColor=vA(S.color),p.ctx.shadowOffsetX=S.offsetX.number*p.options.scale,p.ctx.shadowOffsetY=S.offsetY.number*p.options.scale,p.ctx.shadowBlur=S.blur.number,p.renderTextWithLetterSpacing(w,t.letterSpacing,l)}),p.ctx.shadowColor="",p.ctx.shadowOffsetX=0,p.ctx.shadowOffsetY=0,p.ctx.shadowBlur=0),t.textDecorationLine.length&&(p.ctx.fillStyle=vA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(S){switch(S){case 1:p.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top+l),w.bounds.width,1);break;case 2:p.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top),w.bounds.width,1);break;case 3:p.ctx.fillRect(w.bounds.left,Math.ceil(w.bounds.top+c),w.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&w.text.trim().length&&(p.ctx.strokeStyle=vA(t.webkitTextStrokeColor),p.ctx.lineWidth=t.webkitTextStrokeWidth,p.ctx.lineJoin=window.chrome?"miter":"round",p.ctx.strokeText(w.text,w.bounds.left,w.bounds.top+l)),p.ctx.strokeStyle="",p.ctx.lineWidth=0,p.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(A,t,i){if(i&&A.intrinsicWidth>0&&A.intrinsicHeight>0){var n=Yn(A),s=Jn(t);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,A.intrinsicWidth,A.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(A){return MA(this,void 0,void 0,function(){var t,i,n,s,o,a,F,F,l,c,d,p,x,y,w,V,C,v,S,F,k,x,V;return SA(this,function(N){switch(N.label){case 0:this.applyEffects(A.getEffects(4)),t=A.container,i=A.curves,n=t.styles,s=0,o=t.textNodes,N.label=1;case 1:return s<o.length?(a=o[s],[4,this.renderTextNode(a,n)]):[3,4];case 2:N.sent(),N.label=3;case 3:return s++,[3,1];case 4:if(!(t instanceof Tu))return[3,8];N.label=5;case 5:return N.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return F=N.sent(),this.renderReplacedElement(t,i,F),[3,8];case 7:return N.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Qu&&this.renderReplacedElement(t,i,t.canvas),!(t instanceof xu))return[3,12];N.label=9;case 9:return N.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return F=N.sent(),this.renderReplacedElement(t,i,F),[3,12];case 11:return N.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Hu&&t.tree?(l=new e(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=N.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),N.label=14;case 14:if(t instanceof ta&&(d=Math.min(t.bounds.width,t.bounds.height),t.type===Pn?t.checked&&(this.ctx.save(),this.path([new be(t.bounds.left+d*.39363,t.bounds.top+d*.79),new be(t.bounds.left+d*.16,t.bounds.top+d*.5549),new be(t.bounds.left+d*.27347,t.bounds.top+d*.44071),new be(t.bounds.left+d*.39694,t.bounds.top+d*.5649),new be(t.bounds.left+d*.72983,t.bounds.top+d*.23),new be(t.bounds.left+d*.84,t.bounds.top+d*.34085),new be(t.bounds.left+d*.39363,t.bounds.top+d*.79)]),this.ctx.fillStyle=vA(Uu),this.ctx.fill(),this.ctx.restore()):t.type===Vn&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+d/2,t.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=vA(Uu),this.ctx.fill(),this.ctx.restore())),iv(t)&&t.value.length){switch(p=this.createFontStyle(n),x=p[0],y=p[1],w=this.fontMetrics.getMetrics(x,y).baseline,this.ctx.font=x,this.ctx.fillStyle=vA(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=sv(t.styles.textAlign),V=Yn(t),C=0,t.styles.textAlign){case 1:C+=V.width/2;break;case 2:C+=V.width;break}v=V.add(C,0,0,-V.height/2+1),this.ctx.save(),this.path([new be(V.left,V.top),new be(V.left+V.width,V.top),new be(V.left+V.width,V.top+V.height),new be(V.left,V.top+V.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new hi(t.value,v),n.letterSpacing,w),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!wA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(S=t.styles.listStyleImage,S.type!==0)return[3,18];F=void 0,k=S.url,N.label=15;case 15:return N.trys.push([15,17,,18]),[4,this.context.cache.match(k)];case 16:return F=N.sent(),this.ctx.drawImage(F,t.bounds.left-(F.width+10),t.bounds.top),[3,18];case 17:return N.sent(),this.context.logger.error("Error loading list-style-image "+k),[3,18];case 18:return[3,20];case 19:A.listValue&&t.styles.listStyleType!==-1&&(x=this.createFontStyle(n)[0],this.ctx.font=x,this.ctx.fillStyle=vA(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",V=new yt(t.bounds.left,t.bounds.top+rA(t.styles.paddingTop,t.bounds.width),t.bounds.width,nu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new hi(A.listValue,V),n.letterSpacing,nu(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),N.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(A){return MA(this,void 0,void 0,function(){var t,i,S,n,s,S,o,a,S,l,c,S,d,p,S,y,w,S,C,v,S;return SA(this,function(F){switch(F.label){case 0:if(wA(A.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(A.element)];case 1:F.sent(),t=0,i=A.negativeZIndex,F.label=2;case 2:return t<i.length?(S=i[t],[4,this.renderStack(S)]):[3,5];case 3:F.sent(),F.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(A.element)];case 6:F.sent(),n=0,s=A.nonInlineLevel,F.label=7;case 7:return n<s.length?(S=s[n],[4,this.renderNode(S)]):[3,10];case 8:F.sent(),F.label=9;case 9:return n++,[3,7];case 10:o=0,a=A.nonPositionedFloats,F.label=11;case 11:return o<a.length?(S=a[o],[4,this.renderStack(S)]):[3,14];case 12:F.sent(),F.label=13;case 13:return o++,[3,11];case 14:l=0,c=A.nonPositionedInlineLevel,F.label=15;case 15:return l<c.length?(S=c[l],[4,this.renderStack(S)]):[3,18];case 16:F.sent(),F.label=17;case 17:return l++,[3,15];case 18:d=0,p=A.inlineLevel,F.label=19;case 19:return d<p.length?(S=p[d],[4,this.renderNode(S)]):[3,22];case 20:F.sent(),F.label=21;case 21:return d++,[3,19];case 22:y=0,w=A.zeroOrAutoZIndexOrTransformedOrOpacity,F.label=23;case 23:return y<w.length?(S=w[y],[4,this.renderStack(S)]):[3,26];case 24:F.sent(),F.label=25;case 25:return y++,[3,23];case 26:C=0,v=A.positiveZIndex,F.label=27;case 27:return C<v.length?(S=v[C],[4,this.renderStack(S)]):[3,30];case 28:F.sent(),F.label=29;case 29:return C++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(A){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(A.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()},e.prototype.formatPath=function(A){var t=this;A.forEach(function(i,n){var s=YA(i)?i.start:i;n===0?t.ctx.moveTo(s.x,s.y):t.ctx.lineTo(s.x,s.y),YA(i)&&t.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(A,t,i,n){this.path(A),this.ctx.fillStyle=t,this.ctx.translate(i,n),this.ctx.fill(),this.ctx.translate(-i,-n)},e.prototype.resizeImage=function(A,t,i){var n;if(A.width===t&&A.height===i)return A;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,t),o.height=Math.max(1,i);var a=o.getContext("2d");return a.drawImage(A,0,0,A.width,A.height,0,0,t,i),o},e.prototype.renderBackgroundImage=function(A){return MA(this,void 0,void 0,function(){var t,i,n,s,o,a;return SA(this,function(l){switch(l.label){case 0:t=A.styles.backgroundImage.length-1,i=function(c){var d,p,y,ae,Ue,Fe,oe,me,X,w,ae,Ue,Fe,oe,me,C,v,S,F,k,x,V,N,Z,X,W,ae,G,ee,oe,me,Le,Ue,Fe,ke,ye,ve,Ce,ge,Me,_e,Be;return SA(this,function(iA){switch(iA.label){case 0:if(c.type!==0)return[3,5];d=void 0,p=c.url,iA.label=1;case 1:return iA.trys.push([1,3,,4]),[4,n.context.cache.match(p)];case 2:return d=iA.sent(),[3,4];case 3:return iA.sent(),n.context.logger.error("Error loading background-image "+p),[3,4];case 4:return d&&(y=da(A,t,[d.width,d.height,d.width/d.height]),ae=y[0],Ue=y[1],Fe=y[2],oe=y[3],me=y[4],X=n.ctx.createPattern(n.resizeImage(d,oe,me),"repeat"),n.renderRepeat(ae,X,Ue,Fe)),[3,6];case 5:zB(c)?(w=da(A,t,[null,null,null]),ae=w[0],Ue=w[1],Fe=w[2],oe=w[3],me=w[4],C=OB(c.angle,oe,me),v=C[0],S=C[1],F=C[2],k=C[3],x=C[4],V=document.createElement("canvas"),V.width=oe,V.height=me,N=V.getContext("2d"),Z=N.createLinearGradient(S,k,F,x),Xh(c.stops,v).forEach(function(Ee){return Z.addColorStop(Ee.stop,vA(Ee.color))}),N.fillStyle=Z,N.fillRect(0,0,oe,me),oe>0&&me>0&&(X=n.ctx.createPattern(V,"repeat"),n.renderRepeat(ae,X,Ue,Fe))):GB(c)&&(W=da(A,t,[null,null,null]),ae=W[0],G=W[1],ee=W[2],oe=W[3],me=W[4],Le=c.position.length===0?[No]:c.position,Ue=rA(Le[0],oe),Fe=rA(Le[Le.length-1],me),ke=NB(c,Ue,Fe,oe,me),ye=ke[0],ve=ke[1],ye>0&&ve>0&&(Ce=n.ctx.createRadialGradient(G+Ue,ee+Fe,0,G+Ue,ee+Fe,ye),Xh(c.stops,ye*2).forEach(function(Ee){return Ce.addColorStop(Ee.stop,vA(Ee.color))}),n.path(ae),n.ctx.fillStyle=Ce,ye!==ve?(ge=A.bounds.left+.5*A.bounds.width,Me=A.bounds.top+.5*A.bounds.height,_e=ve/ye,Be=1/_e,n.ctx.save(),n.ctx.translate(ge,Me),n.ctx.transform(1,0,0,_e,0,0),n.ctx.translate(-ge,-Me),n.ctx.fillRect(G,Be*(ee-Me)+Me,oe,me*Be),n.ctx.restore()):n.ctx.fill())),iA.label=6;case 6:return t--,[2]}})},n=this,s=0,o=A.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return s<o.length?(a=o[s],[5,i(a)]):[3,4];case 2:l.sent(),l.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(A,t,i){return MA(this,void 0,void 0,function(){return SA(this,function(n){return this.path(rd(i,t)),this.ctx.fillStyle=vA(A),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(A,t,i,n){return MA(this,void 0,void 0,function(){var s,o;return SA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(A,i,n)]:[3,2];case 1:return a.sent(),[2];case 2:return s=$2(n,i),this.path(s),this.ctx.fillStyle=vA(A),this.ctx.fill(),o=X2(n,i),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(A){return MA(this,void 0,void 0,function(){var t,i,n,s,o,a,l,c,d=this;return SA(this,function(p){switch(p.label){case 0:return this.applyEffects(A.getEffects(2)),t=A.container.styles,i=!_t(t.backgroundColor)||t.backgroundImage.length,n=[{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}],s=nv(Tr(t.backgroundClip,0),A.curves),i||t.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),_t(t.backgroundColor)||(this.ctx.fillStyle=vA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(A.container)]):[3,2];case 1:p.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(y){d.ctx.save();var w=Xn(A.curves),C=y.inset?0:tv,v=R2(w,-C+(y.inset?1:-1)*y.spread.number,(y.inset?1:-1)*y.spread.number,y.spread.number*(y.inset?-2:2),y.spread.number*(y.inset?-2:2));y.inset?(d.path(w),d.ctx.clip(),d.mask(v)):(d.mask(w),d.ctx.clip(),d.path(v)),d.ctx.shadowOffsetX=y.offsetX.number+C,d.ctx.shadowOffsetY=y.offsetY.number,d.ctx.shadowColor=vA(y.color),d.ctx.shadowBlur=y.blur.number,d.ctx.fillStyle=y.inset?vA(y.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),p.label=2;case 2:o=0,a=0,l=n,p.label=3;case 3:return a<l.length?(c=l[a],c.style!==0&&!_t(c.color)&&c.width>0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,o,A.curves,2)]:[3,11]):[3,13];case 4:return p.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,o,A.curves,3)];case 6:return p.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,o,A.curves)];case 8:return p.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,o,A.curves)];case 10:p.sent(),p.label=11;case 11:o++,p.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(A,t,i,n,s){return MA(this,void 0,void 0,function(){var o,a,l,c,d,p,y,w,C,v,S,F,k,x,V,N,V,N;return SA(this,function(Z){return this.ctx.save(),o=J2(n,i),a=rd(n,i),s===2&&(this.path(a),this.ctx.clip()),YA(a[0])?(l=a[0].start.x,c=a[0].start.y):(l=a[0].x,c=a[0].y),YA(a[1])?(d=a[1].end.x,p=a[1].end.y):(d=a[1].x,p=a[1].y),i===0||i===2?y=Math.abs(l-d):y=Math.abs(c-p),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(a.slice(0,2)),w=t<3?t*3:t*2,C=t<3?t*2:t,s===3&&(w=t,C=t),v=!0,y<=w*2?v=!1:y<=w*2+C?(S=y/(2*w+C),w*=S,C*=S):(F=Math.floor((y+C)/(w+C)),k=(y-F*w)/(F-1),x=(y-(F+1)*w)/F,C=x<=0||Math.abs(C-k)<Math.abs(C-x)?k:x),v&&(s===3?this.ctx.setLineDash([0,w+C]):this.ctx.setLineDash([w,C])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=vA(A),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(YA(a[0])&&(V=a[3],N=a[0],this.ctx.beginPath(),this.formatPath([new be(V.end.x,V.end.y),new be(N.start.x,N.start.y)]),this.ctx.stroke()),YA(a[1])&&(V=a[1],N=a[2],this.ctx.beginPath(),this.formatPath([new be(V.end.x,V.end.y),new be(N.start.x,N.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(A){return MA(this,void 0,void 0,function(){var t;return SA(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=vA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=W2(A),[4,this.renderStack(t)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(sd),iv=function(r){return r instanceof Su||r instanceof Eu?!0:r instanceof ta&&r.type!==Vn&&r.type!==Pn},nv=function(r,e){switch(r){case 0:return Xn(e);case 2:return K2(e);default:return Jn(e)}},sv=function(r){switch(r){case 1:return"center";case 2:return"right";default:return"left"}},ov=["-apple-system","system-ui"],av=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(e){return ov.indexOf(e)===-1}):r},lv=(function(r){nt(e,r);function e(A,t){var i=r.call(this,A,t)||this;return i.canvas=t.canvas?t.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=t,i.canvas.width=Math.floor(t.width*t.scale),i.canvas.height=Math.floor(t.height*t.scale),i.canvas.style.width=t.width+"px",i.canvas.style.height=t.height+"px",i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-t.x,-t.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),i}return e.prototype.render=function(A){return MA(this,void 0,void 0,function(){var t,i;return SA(this,function(n){switch(n.label){case 0:return t=jo(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,A),[4,cv(t)];case 1:return i=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=vA(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(sd),cv=function(r){return new Promise(function(e,A){var t=new Image;t.onload=function(){e(t)},t.onerror=A,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},hv=(function(){function r(e){var A=e.id,t=e.enabled;this.id=A,this.enabled=t,this.start=Date.now()}return r.prototype.debug=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,on([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,on([this.id,this.getTime()+"ms"],e))},r.prototype.warn=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,on([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.prototype.error=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,on([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.instances={},r})(),uv=(function(){function r(e,A){var t;this.windowBounds=A,this.instanceName="#"+r.instanceCount++,this.logger=new hv({id:this.instanceName,enabled:e.logging}),this.cache=(t=e.cache)!==null&&t!==void 0?t:new L2(this,e)}return r.instanceCount=1,r})(),dv=function(r,e){return e===void 0&&(e={}),fv(r,e)};typeof window<"u"&&qu.setContext(window);var fv=function(r,e){return MA(void 0,void 0,void 0,function(){var A,t,i,n,s,o,a,l,c,d,p,y,w,C,v,S,F,k,x,V,Z,N,Z,X,W,ae,G,ee,oe,me,Le,Ue,Fe,ke,ye,ve,Ce,ge,Me,_e;return SA(this,function(Be){switch(Be.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(A=r.ownerDocument,!A)throw new Error("Element is not attached to a Document");if(t=A.defaultView,!t)throw new Error("Document is not attached to a Window");return i={allowTaint:(X=e.allowTaint)!==null&&X!==void 0?X:!1,imageTimeout:(W=e.imageTimeout)!==null&&W!==void 0?W:15e3,proxy:e.proxy,useCORS:(ae=e.useCORS)!==null&&ae!==void 0?ae:!1},n=Bo({logging:(G=e.logging)!==null&&G!==void 0?G:!0,cache:e.cache},i),s={windowWidth:(ee=e.windowWidth)!==null&&ee!==void 0?ee:t.innerWidth,windowHeight:(oe=e.windowHeight)!==null&&oe!==void 0?oe:t.innerHeight,scrollX:(me=e.scrollX)!==null&&me!==void 0?me:t.pageXOffset,scrollY:(Le=e.scrollY)!==null&&Le!==void 0?Le:t.pageYOffset},o=new yt(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),a=new uv(n,o),l=(Ue=e.foreignObjectRendering)!==null&&Ue!==void 0?Ue:!1,c={allowTaint:(Fe=e.allowTaint)!==null&&Fe!==void 0?Fe:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:l,copyStyles:l},a.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),d=new Ju(a,r,c),p=d.clonedReferenceElement,p?[4,d.toIFrame(A,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return y=Be.sent(),w=ia(p)||p2(p)?Rg(p.ownerDocument):an(a,p),C=w.width,v=w.height,S=w.left,F=w.top,k=pv(a,p,e.backgroundColor),x={canvas:e.canvas,backgroundColor:k,scale:(ye=(ke=e.scale)!==null&&ke!==void 0?ke:t.devicePixelRatio)!==null&&ye!==void 0?ye:1,x:((ve=e.x)!==null&&ve!==void 0?ve:0)+S,y:((Ce=e.y)!==null&&Ce!==void 0?Ce:0)+F,width:(ge=e.width)!==null&&ge!==void 0?ge:Math.ceil(C),height:(Me=e.height)!==null&&Me!==void 0?Me:Math.ceil(v)},l?(a.logger.debug("Document cloned, using foreign object rendering"),Z=new lv(a,x),[4,Z.render(p)]):[3,3];case 2:return V=Be.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+S+","+F+" with size "+C+"x"+v+" using computed rendering"),a.logger.debug("Starting DOM parsing"),N=Mu(a,p),k===N.styles.backgroundColor&&(N.styles.backgroundColor=Tt.TRANSPARENT),a.logger.debug("Starting renderer for element at "+x.x+","+x.y+" with size "+x.width+"x"+x.height),Z=new rv(a,x),[4,Z.render(N)];case 4:V=Be.sent(),Be.label=5;case 5:return(!((_e=e.removeContainer)!==null&&_e!==void 0)||_e)&&(Ju.destroy(y)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,V]}})})},pv=function(r,e,A){var t=e.ownerDocument,i=t.documentElement?ai(r,getComputedStyle(t.documentElement).backgroundColor):Tt.TRANSPARENT,n=t.body?ai(r,getComputedStyle(t.body).backgroundColor):Tt.TRANSPARENT,s=typeof A=="string"?ai(r,A):A===null?Tt.TRANSPARENT:4294967295;return e===t.documentElement?_t(i)?_t(n)?s:n:i:s};const gv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class mv{constructor(e,A,t="#3b82f6",i=2){this.price=e,this.originTime=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=o.context,l=n._chart,c=n._series;if(!l||!c)return;const d=c.priceToCoordinate(n.price);if(d==null)return;const p=Math.round(d*o.verticalPixelRatio),y=l.timeScale().timeToCoordinate(n.originTime),w=y==null?0:Math.max(0,Math.round(y*o.horizontalPixelRatio)),C=o.bitmapSize.width;if(w>=C)return;a.save(),a.beginPath(),a.strokeStyle=n.color,a.lineWidth=n.lineWidth*o.verticalPixelRatio,a.setLineDash([]),a.moveTo(w,p),a.lineTo(C,p),a.stroke(),a.beginPath(),a.fillStyle=n.color;const v=3*o.verticalPixelRatio;a.arc(w,p,v,0,Math.PI*2),a.fill(),a.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Bv{constructor(e,A,t,i="#3b82f6",n=2){this.p1=e,this.p2=A,this.info=t,this.color=i,this.lineWidth=n,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(a=>{if(!s.visible)return;const l=s._chart,c=s._series;if(!l||!c)return;const d=a.horizontalPixelRatio,p=a.verticalPixelRatio,y=l.timeScale().timeToCoordinate(s.p1.rawTime),w=l.timeScale().timeToCoordinate(s.p2.rawTime),C=c.priceToCoordinate(s.p1.price),v=c.priceToCoordinate(s.p2.price);if(y==null||w==null||C==null||v==null)return;const S=Math.round(y*d),F=Math.round(C*p),k=Math.round(w*d),x=Math.round(v*p),V=a.context;V.save(),V.beginPath(),V.strokeStyle=s.color,V.lineWidth=s.lineWidth*p,V.setLineDash([]),V.moveTo(S,F),V.lineTo(k,x),V.stroke(),V.beginPath(),V.fillStyle=s.color,V.arc(S,F,3*p,0,Math.PI*2),V.fill(),V.beginPath(),V.arc(k,x,3*p,0,Math.PI*2),V.fill();const{priceDiff:N,pricePct:Z,bars:X,days:W,angle:ae}=s.info,G=N>=0?"+":"",ee=[`${G}${N.toFixed(5)} (${G}${Z.toFixed(2)}%)`,`${X} bars (${W} days)`,`∠ ${ae.toFixed(1)}°`],oe=Math.round(11*p);V.font=`${oe}px sans-serif`;const me=oe*1.6,Le=8*p,Ue=Math.max(...ee.map(Be=>V.measureText(Be).width))+Le*2,Fe=ee.length*me+Le*2,ke=k+10*d,ye=x-Fe-4*p,ve=a.bitmapSize.width,Ce=a.bitmapSize.height,ge=Math.min(Math.max(0,ke),ve-Ue-4*d),Me=Math.min(Math.max(4*p,ye),Ce-Fe-4*p),_e=4*p;V.beginPath(),V.moveTo(ge+_e,Me),V.lineTo(ge+Ue-_e,Me),V.quadraticCurveTo(ge+Ue,Me,ge+Ue,Me+_e),V.lineTo(ge+Ue,Me+Fe-_e),V.quadraticCurveTo(ge+Ue,Me+Fe,ge+Ue-_e,Me+Fe),V.lineTo(ge+_e,Me+Fe),V.quadraticCurveTo(ge,Me+Fe,ge,Me+Fe-_e),V.lineTo(ge,Me+_e),V.quadraticCurveTo(ge,Me,ge+_e,Me),V.closePath(),V.fillStyle="rgba(30, 41, 59, 0.92)",V.fill(),V.strokeStyle=s.color,V.lineWidth=1*p,V.stroke(),V.fillStyle="#e2e8f0",V.textAlign="left",ee.forEach((Be,iA)=>{V.fillText(Be,ge+Le,Me+Le+oe+iA*me)}),V.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class od{constructor(e,A,t){this.p1=e,this.p2=A,this.info=t,this.visible=!0,this._chart=null,this._series=null;const i=A.price>=e.price;this.color=i?"#3b82f6":"#ef5350",this.fillColor=i?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,l=n._series;if(!a||!l)return;const c=o.horizontalPixelRatio,d=o.verticalPixelRatio,p=a.timeScale().timeToCoordinate(n.p1.rawTime),y=a.timeScale().timeToCoordinate(n.p2.rawTime),w=l.priceToCoordinate(n.p1.price),C=l.priceToCoordinate(n.p2.price);if(p==null||y==null||w==null||C==null)return;const v=Math.round(p*c),S=Math.round(w*d),F=Math.round(y*c),k=Math.round(C*d),x=o.context;x.save(),x.fillStyle=n.fillColor,x.fillRect(Math.min(v,F),Math.min(S,k),Math.abs(F-v),Math.abs(k-S)),x.strokeStyle=n.color,x.lineWidth=1*d,x.setLineDash([]),x.strokeRect(Math.min(v,F),Math.min(S,k),Math.abs(F-v),Math.abs(k-S)),x.beginPath(),x.strokeStyle=n.color,x.lineWidth=2*d,x.moveTo(v,S),x.lineTo(F,k),x.stroke(),x.fillStyle=n.color,x.beginPath(),x.arc(v,S,3*d,0,Math.PI*2),x.fill(),x.beginPath(),x.arc(F,k,3*d,0,Math.PI*2),x.fill();const{priceDiff:V,pricePct:N,bars:Z,days:X}=n.info,W=V>=0?"+":"",ae=[`${W}${V.toFixed(5)} (${W}${N.toFixed(2)}%)`,`${Z} bars (${X} days)`],G=Math.round(11*d);x.font=`${G}px sans-serif`;const ee=G*1.6,oe=8*d,me=Math.max(...ae.map(Me=>x.measureText(Me).width))+oe*2,Le=ae.length*ee+oe*2,Ue=o.bitmapSize.width,Fe=o.bitmapSize.height,ke=F+10*c,ye=k-Le-4*d,ve=Math.min(Math.max(0,ke),Ue-me-4*c),Ce=Math.min(Math.max(4*d,ye),Fe-Le-4*d),ge=4*d;x.beginPath(),x.moveTo(ve+ge,Ce),x.lineTo(ve+me-ge,Ce),x.quadraticCurveTo(ve+me,Ce,ve+me,Ce+ge),x.lineTo(ve+me,Ce+Le-ge),x.quadraticCurveTo(ve+me,Ce+Le,ve+me-ge,Ce+Le),x.lineTo(ve+ge,Ce+Le),x.quadraticCurveTo(ve,Ce+Le,ve,Ce+Le-ge),x.lineTo(ve,Ce+ge),x.quadraticCurveTo(ve,Ce,ve+ge,Ce),x.closePath(),x.fillStyle="rgba(30, 41, 59, 0.92)",x.fill(),x.strokeStyle=n.color,x.lineWidth=1*d,x.stroke(),x.fillStyle="#e2e8f0",x.textAlign="left",ae.forEach((Me,_e)=>{x.fillText(Me,ve+oe,Ce+oe+G+_e*ee)}),x.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class wv{constructor(e,A,t={}){this.p1=e,this.p2=A,this.visible=!0,this.strokeColor=t.strokeColor??"#7aa6ae",this.fillColor=t.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=t.lineWidth??1,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const l=s.horizontalPixelRatio,c=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),p=o.timeScale().timeToCoordinate(i.p2.rawTime),y=a.priceToCoordinate(i.p1.price),w=a.priceToCoordinate(i.p2.price);if(d==null||p==null||y==null||w==null)return;const C=Math.min(d,p)*l,v=Math.max(d,p)*l,S=Math.min(y,w)*c,F=Math.max(y,w)*c,k=v-C,x=F-S;if(k<.5||x<.5)return;const V=s.context;V.save(),V.fillStyle=i.fillColor,V.fillRect(C,S,k,x),V.strokeStyle=i.strokeColor,V.lineWidth=i.lineWidth*c,V.setLineDash([]),V.strokeRect(C,S,k,x),V.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Cv{constructor(e,A,t={}){this.p1=e,this.p2=A,this.visible=!0,this.strokeColor=t.strokeColor??"#7aa6ae",this.lineWidth=t.lineWidth??1,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const l=s.horizontalPixelRatio,c=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),p=a.priceToCoordinate(i.p1.price),y=o.timeScale().timeToCoordinate(i.p2.rawTime),w=a.priceToCoordinate(i.p2.price);if(d==null||p==null||y==null||w==null)return;const C=d*l,v=p*c,S=y*l,F=w*c,k=Math.hypot(S-C,F-v);if(k<.5)return;const x=s.context;x.save(),x.strokeStyle=i.strokeColor,x.lineWidth=i.lineWidth*c,x.setLineDash([]),x.beginPath(),x.arc(C,v,k,0,Math.PI*2),x.stroke(),x.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class vv{constructor(e,A,t,i={}){this.p1=e,this.p2=A,this.p3=t,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.fillColor=i.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,l=n._series;if(!a||!l)return;const c=o.horizontalPixelRatio,d=o.verticalPixelRatio,p=a.timeScale().timeToCoordinate(n.p1.rawTime),y=l.priceToCoordinate(n.p1.price),w=a.timeScale().timeToCoordinate(n.p2.rawTime),C=l.priceToCoordinate(n.p2.price),v=a.timeScale().timeToCoordinate(n.p3.rawTime),S=l.priceToCoordinate(n.p3.price);if(p==null||y==null||w==null||C==null||v==null||S==null)return;const F=p*c,k=y*d,x=w*c,V=C*d,N=v*c,Z=S*d,X=o.context;X.save(),X.beginPath(),X.moveTo(F,k),X.lineTo(x,V),X.lineTo(N,Z),X.closePath(),X.fillStyle=n.fillColor,X.fill(),X.strokeStyle=n.strokeColor,X.lineWidth=n.lineWidth*d,X.setLineDash([]),X.stroke(),X.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class yv{constructor(e,A,t={}){this.p1=e,this.p2=A,this.minorRatio=t.minorRatio??.45,this.previewAsLine=t.previewAsLine??!1,this.visible=!0,this.strokeColor=t.strokeColor??"#7aa6ae",this.lineWidth=t.lineWidth??1,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const l=s.horizontalPixelRatio,c=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),p=a.priceToCoordinate(i.p1.price),y=o.timeScale().timeToCoordinate(i.p2.rawTime),w=a.priceToCoordinate(i.p2.price);if(d==null||p==null||y==null||w==null)return;const C=d*l,v=p*c,S=y*l,F=w*c,k=S-C,x=F-v,V=Math.hypot(k,x);if(V<.5)return;const N=s.context;if(N.save(),N.strokeStyle=i.strokeColor,N.lineWidth=i.lineWidth*c,N.setLineDash([]),i.previewAsLine)N.beginPath(),N.moveTo(C,v),N.lineTo(S,F),N.stroke();else{const Z=(C+S)/2,X=(v+F)/2,W=Math.atan2(x,k),ae=V/2,G=Math.max(1,ae*Math.max(.05,i.minorRatio));N.beginPath(),N.ellipse(Z,X,ae,G,W,0,Math.PI*2),N.stroke()}N.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ad{constructor(e,A,t="#f59e0b",i=2){this.p1=e,this.p2=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,l=n._series;if(!a||!l)return;const c=o.horizontalPixelRatio,d=o.verticalPixelRatio,p=a.timeScale().timeToCoordinate(n.p1.rawTime),y=a.timeScale().timeToCoordinate(n.p2.rawTime),w=l.priceToCoordinate(n.p1.price),C=l.priceToCoordinate(n.p2.price);if(p==null||y==null||w==null||C==null)return;const v=Math.round(p*c),S=Math.round(w*d),F=Math.round(y*c),k=Math.round(C*d),x=o.context;x.save(),x.beginPath(),x.strokeStyle=n.color,x.lineWidth=n.lineWidth*d,x.setLineDash([]),x.moveTo(v,S),x.lineTo(F,k),x.stroke();const V=Math.atan2(k-S,F-v),N=11*d,Z=Math.PI/7,X=F-N*Math.cos(V-Z),W=k-N*Math.sin(V-Z),ae=F-N*Math.cos(V+Z),G=k-N*Math.sin(V+Z);x.beginPath(),x.fillStyle=n.color,x.moveTo(F,k),x.lineTo(X,W),x.lineTo(ae,G),x.closePath(),x.fill(),x.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class bv{constructor(e,A,t="#7aa6ae",i=2){this.p1=e,this.p2=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,l=n._series;if(!a||!l)return;const c=o.horizontalPixelRatio,d=o.verticalPixelRatio,p=a.timeScale().timeToCoordinate(n.p1.rawTime),y=a.timeScale().timeToCoordinate(n.p2.rawTime),w=l.priceToCoordinate(n.p1.price),C=l.priceToCoordinate(n.p2.price);if(p==null||y==null||w==null||C==null)return;const v=p*c,S=w*d;let F=y-p,k=C-w;F<0&&(F=-F,k=-k),Math.abs(F)<1e-4&&(F=1e-4);const x=k*d/(F*c),V=Math.max(0,v),N=S+x*(V-v),Z=o.bitmapSize.width,X=S+x*(Z-v),W=o.context;W.save(),W.beginPath(),W.strokeStyle=n.color,W.lineWidth=n.lineWidth*d,W.setLineDash([]),W.moveTo(V,N),W.lineTo(Z,X),W.stroke(),W.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Tv{constructor(e,A,t="#7aa6ae",i=2){this.p1=e,this.p2=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,l=n._series;if(!a||!l)return;const c=o.horizontalPixelRatio,d=o.verticalPixelRatio,p=a.timeScale().timeToCoordinate(n.p1.rawTime),y=a.timeScale().timeToCoordinate(n.p2.rawTime),w=l.priceToCoordinate(n.p1.price),C=l.priceToCoordinate(n.p2.price);if(p==null||y==null||w==null||C==null)return;const v=p*c,S=w*d;let F=y-p,k=C-w;Math.abs(F)<1e-4&&(F=1e-4);const x=k*d/(F*c),V=0,N=S+x*(V-v),Z=o.bitmapSize.width,X=S+x*(Z-v),W=o.context;W.save(),W.beginPath(),W.strokeStyle=n.color,W.lineWidth=n.lineWidth*d,W.setLineDash([]),W.moveTo(V,N),W.lineTo(Z,X),W.stroke(),W.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Qv{constructor(e,A="#7aa6ae",t=2){this.center=e,this.color=A,this.lineWidth=t,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const l=s.horizontalPixelRatio,c=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.center.rawTime),p=a.priceToCoordinate(i.center.price);if(d==null||p==null)return;const y=Math.round(d*l),w=Math.round(p*c),C=s.bitmapSize.width,v=s.bitmapSize.height,S=s.context;S.save(),S.strokeStyle=i.color,S.lineWidth=i.lineWidth*c,S.setLineDash([]),S.beginPath(),S.moveTo(0,w),S.lineTo(C,w),S.stroke(),S.beginPath(),S.moveTo(y,0),S.lineTo(y,v),S.stroke(),S.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class xv{constructor(e,A,t="#7aa6ae",i=2){this.p1=e,this.p2=A,this.color=t,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,l=n._series;if(!a||!l)return;const c=o.horizontalPixelRatio,d=o.verticalPixelRatio,p=a.timeScale().timeToCoordinate(n.p1.rawTime),y=a.timeScale().timeToCoordinate(n.p2.rawTime),w=l.priceToCoordinate(n.p1.price),C=l.priceToCoordinate(n.p2.price);if(p==null||y==null||w==null||C==null)return;const v=p*c,S=w*d,F=y*c,k=C*d,x=v-F,V=S-k;if(Math.hypot(x,V)<1e-4)return;const Z=Math.atan2(V,x),X=Math.round(Math.abs(Z*180/Math.PI)),W=o.context;W.save(),W.strokeStyle=n.color,W.lineWidth=n.lineWidth*d,W.setLineDash([]),W.beginPath(),W.moveTo(v,S),W.lineTo(F,k),W.stroke();const ae=28*d;W.beginPath(),W.lineWidth=1*d,W.strokeStyle="rgba(122,166,174,0.55)",W.moveTo(F,k),W.lineTo(F+ae,k),W.stroke(),W.beginPath(),W.strokeStyle="rgba(122,166,174,0.45)",W.arc(F,k,ae,0,Z,Z<0),W.stroke(),W.fillStyle="#4b7c86",W.font=`${Math.round(10*d)}px sans-serif`,W.textAlign="left",W.textBaseline="middle";const G=F+(ae+10*d)*Math.cos(Z/2),ee=k+(ae+10*d)*Math.sin(Z/2);W.fillText(`${X}°`,G,ee),W.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Fv{constructor(e,A,t){this.p1=e,this.p2=A,this.p3=t,this.visible=!0,this._chart=null,this._series=null,this._levels=[{k:-2,color:"rgba(239, 68, 68, 0.9)",width:1},{k:-1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:-1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:-.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:-.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:-.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:0,color:"rgba(161, 98, 7, 0.75)",width:1.1},{k:.25,color:"rgba(132, 204, 22, 0.9)",width:1},{k:.5,color:"rgba(34, 197, 94, 0.9)",width:1},{k:.75,color:"rgba(14, 165, 233, 0.9)",width:1},{k:1,color:"rgba(59, 130, 246, 0.9)",width:1.1},{k:1.5,color:"rgba(168, 85, 247, 0.9)",width:1},{k:2,color:"rgba(239, 68, 68, 0.9)",width:1}];const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const l=s.horizontalPixelRatio,c=s.verticalPixelRatio,d=s.context,p=o.timeScale().timeToCoordinate(i.p1.rawTime),y=a.priceToCoordinate(i.p1.price),w=o.timeScale().timeToCoordinate(i.p2.rawTime),C=a.priceToCoordinate(i.p2.price),v=o.timeScale().timeToCoordinate(i.p3.rawTime),S=a.priceToCoordinate(i.p3.price);if(p==null||y==null||w==null||C==null||v==null||S==null)return;const F=p*l,k=y*c,x=w*l,V=C*c,N=v*l,Z=S*c,X=(x+N)/2,W=(V+Z)/2;let ae=X-F,G=W-k;Math.abs(ae)<1e-4&&(ae=1e-4);const ee=G/ae,oe=s.bitmapSize.width,me=(x-N)/2,Le=(V-Z)/2,Ue=Me=>({x:X+me*Me,y:W+Le*Me}),Fe=(Me,_e)=>({x:oe,y:_e+ee*(oe-Me)}),ke=Ue(1),ye=Ue(-1),ve=Fe(ke.x,ke.y),Ce=Fe(ye.x,ye.y);d.save(),d.beginPath(),d.moveTo(ke.x,ke.y),d.lineTo(ve.x,ve.y),d.lineTo(Ce.x,Ce.y),d.lineTo(ye.x,ye.y),d.closePath(),d.fillStyle="rgba(148, 163, 184, 0.2)",d.fill(),d.beginPath(),d.strokeStyle="rgba(148, 163, 184, 0.9)",d.lineWidth=1*c,d.moveTo(x,V),d.lineTo(N,Z),d.stroke(),i._levels.forEach(Me=>{const _e=Ue(Me.k),Be=Fe(_e.x,_e.y);d.beginPath(),d.strokeStyle=Me.color,d.lineWidth=Me.width*c,d.moveTo(_e.x,_e.y),d.lineTo(Be.x,Be.y),d.stroke()});const ge=Fe(F,k);d.beginPath(),d.strokeStyle="rgba(161, 98, 7, 0.9)",d.lineWidth=1.1*c,d.moveTo(F,k),d.lineTo(ge.x,ge.y),d.stroke(),d.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Uv{constructor(e,A){this.p1=e,this.p2=A,this.visible=!0,this._chart=null,this._series=null,this._rays=[{ratio:.125,color:"rgba(161, 98, 7, 0.9)",label:"0.13"},{ratio:.25,color:"rgba(132, 204, 22, 0.9)",label:"0.25"},{ratio:.333333,color:"rgba(34, 197, 94, 0.9)",label:"0.30"},{ratio:.5,color:"rgba(5, 150, 105, 0.9)",label:"0.50"},{ratio:1,color:"rgba(107, 114, 128, 0.9)",label:"1.00"},{ratio:2,color:"rgba(37, 99, 235, 0.9)",label:"2.00"},{ratio:3,color:"rgba(67, 56, 202, 0.9)",label:"3.00"},{ratio:4,color:"rgba(124, 58, 237, 0.9)",label:"4.00"},{ratio:8,color:"rgba(220, 38, 38, 0.9)",label:"8.00"}];const t=this;this._paneView={renderer(){return{draw(i){i.useBitmapCoordinateSpace(n=>{if(!t.visible)return;const s=t._chart,o=t._series;if(!s||!o)return;const a=n.horizontalPixelRatio,l=n.verticalPixelRatio,c=n.context,d=s.timeScale().timeToCoordinate(t.p1.rawTime),p=o.priceToCoordinate(t.p1.price),y=s.timeScale().timeToCoordinate(t.p2.rawTime),w=o.priceToCoordinate(t.p2.price);if(d==null||p==null||y==null||w==null)return;const C=d*a,v=p*l,S=y*a,F=w*l,k=n.bitmapSize.width,x=Math.abs(S-C)<1e-4?1:S-C,V=(F-v)/x,N=S>=C?1:-1,Z=N>0?k:0,X=C+N*Math.min(220*a,Math.max(80*a,k*.35)),W=t._rays.map(G=>{const ee=V*G.ratio;return{...G,yEnd:v+ee*(Z-C),yLabel:v+ee*(X-C)}});c.save();const ae=(G,ee,oe)=>{!G||!ee||(c.beginPath(),c.moveTo(C,v),c.lineTo(Z,G.yEnd),c.lineTo(Z,ee.yEnd),c.closePath(),c.fillStyle=oe,c.fill())};ae(W[0],W[3],"rgba(161, 98, 7, 0.10)"),ae(W[3],W[4],"rgba(5, 150, 105, 0.10)"),ae(W[4],W[5],"rgba(107, 114, 128, 0.12)"),W.forEach(G=>{c.beginPath(),c.strokeStyle=G.color,c.lineWidth=1*l,c.moveTo(C,v),c.lineTo(Z,G.yEnd),c.stroke()}),c.font=`${Math.max(10,Math.round(10*l))}px sans-serif`,c.textAlign=N>0?"left":"right",c.textBaseline="middle",W.forEach(G=>{c.fillStyle=G.color;const ee=X+(N>0?4*a:-4*a),oe=G.yLabel;oe<-20||oe>n.bitmapSize.height+20||c.fillText(G.label,ee,oe)}),c.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ev{constructor(e,A,t=8){this.p1=e,this.p2=A,this.divisions=Math.max(2,t),this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const l=s.horizontalPixelRatio,c=s.verticalPixelRatio,d=s.context,p=o.timeScale().timeToCoordinate(i.p1.rawTime),y=a.priceToCoordinate(i.p1.price),w=o.timeScale().timeToCoordinate(i.p2.rawTime),C=a.priceToCoordinate(i.p2.price);if(p==null||y==null||w==null||C==null)return;const v=p*l,S=y*c,F=w*l,k=C*c,x=F-v,V=k-S,N=Math.hypot(x,V);if(N<1e-4)return;const Z=x/N,X=V/N,W=-X,ae=Z,G=F+W*N,ee=k+ae*N,oe=v+W*N,me=S+ae*N,Le=(Fe,ke)=>({x:v+Z*N*Fe+W*N*ke,y:S+X*N*Fe+ae*N*ke});d.save();const Ue=["rgba(161, 98, 7, 0.08)","rgba(132, 204, 22, 0.08)","rgba(5, 150, 105, 0.08)","rgba(37, 99, 235, 0.08)"];for(let Fe=0;Fe<i.divisions;Fe++){const ke=Fe/i.divisions,ye=(Fe+1)/i.divisions,ve=Le(0,ke),Ce=Le(1,ke),ge=Le(1,ye),Me=Le(0,ye);d.beginPath(),d.moveTo(ve.x,ve.y),d.lineTo(Ce.x,Ce.y),d.lineTo(ge.x,ge.y),d.lineTo(Me.x,Me.y),d.closePath(),d.fillStyle=Ue[Fe%Ue.length],d.fill()}d.lineWidth=1*c,d.strokeStyle="rgba(148, 163, 184, 0.55)";for(let Fe=0;Fe<=i.divisions;Fe++){const ke=Fe/i.divisions,ye=Le(0,ke),ve=Le(1,ke),Ce=Le(ke,0),ge=Le(ke,1);d.beginPath(),d.moveTo(ye.x,ye.y),d.lineTo(ve.x,ve.y),d.stroke(),d.beginPath(),d.moveTo(Ce.x,Ce.y),d.lineTo(ge.x,ge.y),d.stroke()}d.strokeStyle="rgba(100, 116, 139, 0.85)",d.lineWidth=1*c,d.beginPath(),d.moveTo(v,S),d.lineTo(G,ee),d.stroke(),d.beginPath(),d.moveTo(F,k),d.lineTo(oe,me),d.stroke(),d.strokeStyle="rgba(122, 166, 174, 0.95)",d.lineWidth=1.2*c,d.beginPath(),d.moveTo(v,S),d.lineTo(F,k),d.lineTo(G,ee),d.lineTo(oe,me),d.closePath(),d.stroke(),d.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class fa{constructor(e,A,t,i,n="#16a34a",s=2,o="rgba(22, 163, 74, 0.12)"){this.p1=e,this.p2=A,this.p3=t,this.p4=i,this.color=n,this.lineWidth=s,this.fillColor=o,this.visible=!0,this._chart=null,this._series=null;const a=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!a.visible)return;const d=a._chart,p=a._series;if(!d||!p)return;const y=c.horizontalPixelRatio,w=c.verticalPixelRatio,C=[a.p1,a.p3,a.p4,a.p2].map(Z=>{const X=d.timeScale().timeToCoordinate(Z.rawTime),W=p.priceToCoordinate(Z.price);return X==null||W==null?null:{x:X*y,y:W*w}}).filter(Boolean);if(C.length!==4)return;const[v,S,F,k]=C,x=c.context;x.save(),x.beginPath(),x.moveTo(v.x,v.y),x.lineTo(S.x,S.y),x.lineTo(F.x,F.y),x.lineTo(k.x,k.y),x.closePath(),x.fillStyle=a.fillColor,x.fill(),x.strokeStyle=a.color,x.lineWidth=a.lineWidth*w,x.setLineDash([]),x.beginPath(),x.moveTo(v.x,v.y),x.lineTo(S.x,S.y),x.moveTo(k.x,k.y),x.lineTo(F.x,F.y),x.moveTo(v.x,v.y),x.lineTo(k.x,k.y),x.moveTo(S.x,S.y),x.lineTo(F.x,F.y),x.stroke(),x.fillStyle="#ffffff",x.strokeStyle="#3b82f6",x.lineWidth=2*w,[v,S,F,k].forEach(Z=>{x.beginPath(),x.arc(Z.x,Z.y,6*w,0,Math.PI*2),x.fill(),x.stroke()});const V=[a.p1,a.p3,a.p2,a.p4],N=[v,S,k,F];x.fillStyle=a.color,x.font=`${Math.round(10*w)}px sans-serif`,x.textAlign="left",x.textBaseline="middle",N.forEach((Z,X)=>{const W=V[X]?.price;typeof W=="number"&&x.fillText(W.toFixed(5),Z.x+8*y,Z.y)}),x.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ld extends fa{constructor(e,A,t,i,n="#3b82f6",s=2){super(e,A,t,i,n,s,"rgba(59, 130, 246, 0.12)")}}class cd{constructor(e,A,t,i,n,s={}){this.p1=e,this.p2=A,this.b1=t,this.b2=i,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(a){a.useBitmapCoordinateSpace(l=>{if(!o.visible)return;const c=o._chart,d=o._series;if(!c||!d)return;const p=l.horizontalPixelRatio,y=l.verticalPixelRatio,w=l.context,C=x=>{const V=c.timeScale().timeToCoordinate(x.rawTime),N=d.priceToCoordinate(x.price);return V==null||N==null?null:{x:V*p,y:N*y}},v=C(o.p1),S=C(o.p2),F=C(o.b2),k=C(o.b1);!v||!S||!F||!k||(w.save(),w.beginPath(),w.moveTo(v.x,v.y),w.lineTo(S.x,S.y),w.lineTo(F.x,F.y),w.lineTo(k.x,k.y),w.closePath(),w.fillStyle=o.fillColor,w.fill(),w.strokeStyle=o.strokeColor,w.lineWidth=o.lineWidth*y,w.setLineDash([]),w.beginPath(),w.moveTo(v.x,v.y),w.lineTo(S.x,S.y),w.stroke(),w.beginPath(),w.moveTo(k.x,k.y),w.lineTo(F.x,F.y),w.stroke(),w.restore())})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class pa{constructor(e,A,t,i,n,s,o={}){this.mid1=e,this.mid2=A,this.top1=t,this.top2=i,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const a=this;this._paneView={renderer(){return{draw(l){l.useBitmapCoordinateSpace(c=>{if(!a.visible)return;const d=a._chart,p=a._series;if(!d||!p)return;const y=c.horizontalPixelRatio,w=c.verticalPixelRatio,C=c.context,v=X=>{const W=d.timeScale().timeToCoordinate(X.rawTime),ae=p.priceToCoordinate(X.price);return W==null||ae==null?null:{x:W*y,y:ae*w}},S=v(a.mid1),F=v(a.mid2),k=v(a.top1),x=v(a.top2),V=v(a.bot1),N=v(a.bot2);if(!S||!F||!k||!x||!V||!N)return;C.save(),C.beginPath(),C.moveTo(S.x,S.y),C.lineTo(F.x,F.y),C.lineTo(x.x,x.y),C.lineTo(k.x,k.y),C.closePath(),C.fillStyle=a.upperFillColor,C.fill(),C.beginPath(),C.moveTo(V.x,V.y),C.lineTo(N.x,N.y),C.lineTo(F.x,F.y),C.lineTo(S.x,S.y),C.closePath(),C.fillStyle=a.lowerFillColor,C.fill();const Z=(X,W,ae)=>{C.beginPath(),C.strokeStyle=ae,C.lineWidth=a.lineWidth*w,C.setLineDash([]),C.moveTo(X.x,X.y),C.lineTo(W.x,W.y),C.stroke()};if(Z(k,x,a.upperStrokeColor),Z(S,F,a.centerStrokeColor),Z(V,N,a.lowerStrokeColor),a.showDeviationLabel){const X=Math.abs(a.top1.price-a.mid1.price),W=Number.isFinite(X)?X.toFixed(5):null;if(W){const ae=Math.max(10,Math.round(10*w));C.fillStyle=a.labelColor,C.font=`${ae}px sans-serif`,C.textAlign="left",C.textBaseline="top",C.fillText(W,V.x+2*y,V.y+10*w)}}C.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hd extends pa{}class ud{constructor(e,A){this.p1=e,this.p2=A,this.visible=!0,this._chart=null,this._series=null,this._levels=[{ratio:0,label:"0.000"},{ratio:.236,label:"0.236"},{ratio:.382,label:"0.382"},{ratio:.5,label:"0.500"},{ratio:.618,label:"0.618"},{ratio:.786,label:"0.786"},{ratio:1,label:"1.000"},{ratio:1.618,label:"1.618"},{ratio:2.618,label:"2.618"},{ratio:3.618,label:"3.618"},{ratio:4.236,label:"4.236"}],this._levelColors={0:"#ff0000",.236:"#ff0000",.382:"#00c853",.5:"#00c853",.618:"#00bcd4",.786:"#00bcd4",1:"#2962ff",1.618:"#2962ff",2.618:"#ff0000",3.618:"#ff0000",4.236:"#e040fb"},this._zoneFills=[{from:0,to:.236,color:"rgba(255, 0, 0, 0.06)"},{from:.236,to:.382,color:"rgba(0, 200, 83, 0.06)"},{from:.382,to:.5,color:"rgba(0, 200, 83, 0.06)"},{from:.5,to:.618,color:"rgba(0, 200, 83, 0.06)"},{from:.618,to:.786,color:"rgba(0, 188, 212, 0.06)"},{from:.786,to:1,color:"rgba(41, 98, 255, 0.08)"},{from:1,to:1.618,color:"rgba(255, 138, 128, 0.10)"},{from:1.618,to:2.618,color:"rgba(255, 138, 128, 0.10)"},{from:2.618,to:3.618,color:"rgba(224, 64, 251, 0.08)"},{from:3.618,to:4.236,color:"rgba(224, 64, 251, 0.08)"}];const t=this;this._paneView={renderer(){return{draw(i){i.useBitmapCoordinateSpace(n=>{if(!t.visible)return;const s=t._chart,o=t._series;if(!s||!o)return;const a=n.horizontalPixelRatio,l=n.verticalPixelRatio,c=n.context,d=n.bitmapSize.width;n.bitmapSize.height;const p=t.p1.price,y=t.p2.price,w=p-y,C=X=>y+w*X,v=s.timeScale().timeToCoordinate(t.p1.rawTime),S=s.timeScale().timeToCoordinate(t.p2.rawTime),F=o.priceToCoordinate(p),k=o.priceToCoordinate(y),x=v!=null&&S!=null?Math.round(Math.min(v,S)*a):0,V=v!=null&&S!=null?Math.round(Math.max(v,S)*a):d,N=V-x;c.save(),t._zoneFills.forEach(({from:X,to:W,color:ae})=>{const G=C(X),ee=C(W),oe=o.priceToCoordinate(G),me=o.priceToCoordinate(ee);if(oe==null||me==null)return;const Le=Math.round(oe*l),Ue=Math.round(me*l);c.fillStyle=ae,c.fillRect(x,Math.min(Le,Ue),N,Math.abs(Ue-Le))}),t._levels.forEach(({ratio:X,label:W})=>{const ae=C(X),G=o.priceToCoordinate(ae);if(G==null)return;const ee=Math.round(G*l),oe=t._levelColors[X]||"#888888";c.beginPath(),c.strokeStyle=oe,c.lineWidth=X===0||X===1?1.5*l:1*l,X!==0&&X!==1&&X<1?c.setLineDash([4*a,4*a]):c.setLineDash([]),c.moveTo(x,ee),c.lineTo(V,ee),c.stroke(),c.setLineDash([])});const Z=Math.round(11*l);if(c.font=`${Z}px sans-serif`,c.textAlign="left",t._levels.forEach(({ratio:X,label:W})=>{const ae=C(X),G=o.priceToCoordinate(ae);if(G==null)return;const ee=Math.round(G*l),oe=t._levelColors[X]||"#888888",me=`${W} (${ae.toFixed(5)})`;c.fillStyle=oe,c.textAlign="right",c.fillText(me,x-4*a,ee-4*l)}),v!=null&&S!=null&&F!=null&&k!=null){const X=Math.round(v*a),W=Math.round(F*l),ae=Math.round(S*a),G=Math.round(k*l);c.beginPath(),c.strokeStyle="rgba(128, 128, 128, 0.6)",c.lineWidth=1*l,c.setLineDash([]),c.moveTo(X,W),c.lineTo(ae,G),c.stroke(),c.beginPath(),c.fillStyle="#2962ff",c.arc(X,W,4*l,0,Math.PI*2),c.fill(),c.strokeStyle="#ffffff",c.lineWidth=1*l,c.stroke(),c.beginPath(),c.fillStyle="#2962ff",c.arc(ae,G,4*l,0,Math.PI*2),c.fill(),c.strokeStyle="#ffffff",c.lineWidth=1*l,c.stroke()}c.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Sv{constructor(e,A="#3b82f6",t=2){this.time=e,this.color=A,this.lineWidth=t,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart;if(!o)return;const a=o.timeScale().timeToCoordinate(i.time);if(a==null)return;const l=Math.round(a*s.horizontalPixelRatio),c=s.bitmapSize.height,d=s.context;d.save(),d.beginPath(),d.strokeStyle=i.color,d.lineWidth=i.lineWidth*s.horizontalPixelRatio,d.setLineDash([]),d.moveTo(l,0),d.lineTo(l,c),d.stroke(),d.restore()})}}}}}attached({chart:e,series:A}){this._chart=e,this._series=A}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const Hv={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function dd(r){if(!r)return 7;const e=String(r).toUpperCase();return Hv[e]??7}function Lv(r,e){const A=String(r||"").toUpperCase(),t=e||dd(r),i={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[A]||96,n=Math.ceil(t*(typeof i=="number"?i:96));return Math.min(Math.max(n,500),5e3)}const Ar=r=>{if(!Array.isArray(r)||r.length===0)return[];const e=r.map(t=>({...t,time:Y(t.time)})).filter(t=>t.time!=null);e.sort((t,i)=>t.time-i.time);const A=new Map;for(const t of e)A.set(t.time,t);return Array.from(A.values()).sort((t,i)=>t.time-i.time)};function qe(r,e,A,t,i,n){const s=i-A,o=n-t,a=Math.sqrt(s*s+o*o);if(a===0)return Math.hypot(r-A,e-t);let l=((r-A)*s+(e-t)*o)/(a*a);l=Math.max(0,Math.min(1,l));const c=A+l*s,d=t+l*o;return Math.hypot(r-c,e-d)}function Mv(r,e,A,t,i,n){const s=i-A,o=n-t,a=s*s+o*o;if(a===0)return Math.hypot(r-A,e-t);let l=((r-A)*s+(e-t)*o)/a;l<0&&(l=0);const c=A+l*s,d=t+l*o;return Math.hypot(r-c,e-d)}function Iv(r,e,A,t,i,n){const s=i-A,o=n-t,a=s*s+o*o;if(a===0)return Math.hypot(r-A,e-t);const l=((r-A)*s+(e-t)*o)/a,c=A+l*s,d=t+l*o;return Math.hypot(r-c,e-d)}function Nt(r,e,A){let t=!1;for(let i=0,n=A.length-1;i<A.length;n=i++){const s=A[i].x,o=A[i].y,a=A[n].x,l=A[n].y;o>e!=l>e&&r<(a-s)*(e-o)/(l-o+1e-7)+s&&(t=!t)}return t}function fd(r,e,A){if(!r||!e||!A)return null;const t=r.normalizedTime??Y(r.rawTime),i=e.normalizedTime??Y(e.rawTime),n=A.normalizedTime??Y(A.rawTime);if(t==null||i==null||n==null)return null;const s=i-t;if(Math.abs(s)<1e-9)return null;const o=(e.price-r.price)/s,a=A.price+o*(t-n),l=A.price+o*(i-n),c=Y((t+i)/2),d=(a+l)/2;return c==null?null:{b1:{rawTime:r.rawTime,normalizedTime:t,price:a},b2:{rawTime:e.rawTime,normalizedTime:i,price:l},p3:{rawTime:A.rawTime,normalizedTime:n,price:A.price},bottomMid:{rawTime:c,normalizedTime:c,price:d}}}function es(r,e,A,t=1){if(!Array.isArray(r)||r.length<2||!e||!A)return null;const i=e.normalizedTime??Y(e.rawTime),n=A.normalizedTime??Y(A.rawTime);if(i==null||n==null)return null;const s=Math.min(i,n),o=Math.max(i,n),a=r.map(X=>({time:Y(X.time),close:typeof X.close=="number"?X.close:parseFloat(X.close)})).filter(X=>X.time!=null&&Number.isFinite(X.close)&&X.time>=s&&X.time<=o).sort((X,W)=>X.time-W.time);if(a.length<2)return null;const l=a.length;let c=0,d=0,p=0,y=0;for(let X=0;X<l;X++){const W=X,ae=a[X].close;c+=W,d+=ae,p+=W*ae,y+=W*W}const w=l*y-c*c,C=Math.abs(w)<1e-12?0:(l*p-c*d)/w,v=(d-C*c)/l;let S=0;for(let X=0;X<l;X++){const W=v+C*X,ae=a[X].close-W;S+=ae*ae}const F=Math.sqrt(S/l),k=Math.max(F*t,1e-8),x=a[0].time,V=a[l-1].time,N=v,Z=v+C*(l-1);return{slope:C,intercept:v,stdDev:F,offset:k,barCount:l,p1:{rawTime:x,normalizedTime:x,price:N},p2:{rawTime:V,normalizedTime:V,price:Z},top1:{rawTime:x,normalizedTime:x,price:N+k},top2:{rawTime:V,normalizedTime:V,price:Z+k},bot1:{rawTime:x,normalizedTime:x,price:N-k},bot2:{rawTime:V,normalizedTime:V,price:Z-k}}}function ga(r,e,A,t=1){return es(r,e,A,t)}const _v={trendline:{requiredKeys:["point1","point2"],handleCount:2},gannline:{requiredKeys:["point1","point2"],handleCount:3},rectangle:{requiredKeys:["p1","p2"],handleCount:8},circle:{requiredKeys:["p1","p2"],handleCount:2},triangle:{requiredKeys:["p1","p2","p3"],handleCount:3},ellipse:{requiredKeys:["p1","p2"],handleCount:4},infoline:{requiredKeys:["p1","p2"],handleCount:2},arrowedline:{requiredKeys:["p1","p2"],handleCount:2},rayline:{requiredKeys:["p1","p2"],handleCount:2},extendedline:{requiredKeys:["p1","p2"],handleCount:2},crossline:{requiredKeys:["p"],handleCount:1},trendbyangle:{requiredKeys:["p1","p2"],handleCount:2},equidistantchannel:{requiredKeys:["p1","p2","p3"],handleCount:3},regressionchannel:{requiredKeys:["p1","p2"],handleCount:2},stddevchannel:{requiredKeys:["p1","p2"],handleCount:2},gannfan:{requiredKeys:["p1","p2"],handleCount:2},ganngrid:{requiredKeys:["p1","p2"],handleCount:2},andrewspitchfork:{requiredKeys:["p1","p2","p3"],handleCount:3},disjointchannel:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},flattopbottom:{requiredKeys:["p1","p2","p3","p4"],handleCount:4},rulerline:{requiredKeys:["p1","p2"],handleCount:3}},Dv={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",infoline:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6"};function kv(r,e){if(!r||!r.type)return!1;const A=_v[r.type];return!A||e.length!==A.handleCount?!1:A.requiredKeys.every(t=>!!r[t])}function Ov(r){return r?Dv[r]??"#22c55e":"#22c55e"}const Nv=300,pd=24,Kv=150,gd=150;function ma(r,e,A=Nv){if(!Array.isArray(r)||r.length===0)return[];const t=it(e),i=Number.isFinite(t)&&t>0?t:60;let n=null;for(const o of r){const a=Y(o?.time);a!=null&&(n==null||a>n)&&(n=a)}if(n==null)return[];const s=[];for(let o=1;o<=A;o++)s.push({time:n+i*o});return s}function Pv(r){if(!Array.isArray(r)||r.length===0)return null;let e=null;for(const A of r){const t=Y(A?.time);t!=null&&(e==null||t>e)&&(e=t)}return e}function Vv(r,e,A){if(!r)return!1;const t=r.timeScale();if(!t)return!1;const i=Pv(e);if(i==null)return!1;const n=t.timeToCoordinate(i);if(Number.isFinite(n)){const l=t.coordinateToLogical(n);if(Number.isFinite(l)){const c=t.getVisibleLogicalRange(),d=Number.isFinite(c?.from)&&Number.isFinite(c?.to)?c.to-c.from:null,p=Number.isFinite(d)&&d>20?d:120,y=Math.min(gd,p/2),w=Math.max(20,p-y),C={from:l-w,to:l+y};try{return t.setVisibleLogicalRange(C),!0}catch{}}}const s=it(A),o=Number.isFinite(s)&&s>0?s:60,a={from:i-Kv*o,to:i+gd*o};try{return t.setVisibleRange(a),!0}catch{return!1}}const zv=J.forwardRef(function({bidPrice:e="113.638",askPrice:A="113.649",showBuySellPanel:t=!0,onBuyClick:i,onSellClick:n},s){const o=J.useRef(null),a=J.useRef(null),l=J.useRef(null),c=J.useRef(null),d=J.useRef(null),p=J.useRef([]),y=J.useRef(!1),w=J.useRef(null),C=J.useRef(null),v=J.useRef(null),S=J.useRef(null),F=J.useRef([]),[k,x]=J.useState(null),[V,N]=J.useState([]),[Z,X]=J.useState(null),[W,ae]=J.useState([]),G=J.useRef(null),ee=J.useRef(null),oe=J.useRef(null),me=J.useRef(!1);J.useEffect(()=>{oe.current=k},[k]);const Le=J.useRef(new Map),Ue=J.useRef(null),Fe=(b,m)=>`${b}_${m}`,ke=()=>{const b=Fe(Ee,Te);return Le.current.get(b)||null},ye=b=>{if(!b)return;const m=Fe(Ee,Te);Le.current.set(m,b)},{activeTool:ve,setActiveTool:Ce,showGrid:ge,snapToGrid:Me,chartObjects:_e,setChartObjects:Be,orders:iA,selectedSymbol:Ee,selectedTimeframe:Te,drawingsVisible:de,chartType:Qe,chartLocked:cA,theme:Re,baseUrl:Ke,endpoints:Xe,endpointParams:We}=FA(),je=J.useRef([]),[we,le]=J.useState(!1),[Ie,fe]=J.useState(null),[ne,Oe]=J.useState([]),[De,Ye]=J.useState(!0),CA=J.useRef(null),xt=J.useRef(new Map);J.useRef(null);const wi=J.useRef(0);J.useEffect(()=>{const b=c.current;b&&b.setData(ma(ne,Te))},[ne,Te]),J.useImperativeHandle(s,()=>({zoomIn:()=>{const b=a.current?.timeScale();if(!b)return;const m=b.getVisibleRange();if(!m||!m.from||!m.to)return;const R=m.to-m.from,Se=(m.from+m.to)/2,Q=R*.8;try{b.setVisibleRange({from:Se-Q/2,to:Se+Q/2}),ye(b.getVisibleRange())}catch{}},zoomOut:()=>{const b=a.current?.timeScale();if(!b)return;const m=b.getVisibleRange();if(!m||!m.from||!m.to)return;const R=m.to-m.from,Se=(m.from+m.to)/2,Q=R*1.25;try{b.setVisibleRange({from:Se-Q/2,to:Se+Q/2}),ye(b.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const b=o.current;if(!b){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const m=b.querySelectorAll("canvas"),R=Re==="light"?"#ffffff":"#12161d";let Se=null,Q=0;if(m.forEach(q=>{if(q.width>0&&q.height>0){const se=q.width*q.height;se>Q&&(Q=se,Se=q)}}),Se)try{const q=document.createElement("canvas");q.width=Se.width,q.height=Se.height;const se=q.getContext("2d");se.fillStyle=R,se.fillRect(0,0,q.width,q.height),se.drawImage(Se,0,0);const ie=document.createElement("a");ie.download=`chart-${Ee}-${Te}-${Date.now()}.png`,ie.href=q.toDataURL("image/png"),ie.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(q){console.warn("Canvas export failed, trying html2canvas",q)}dv(b,{useCORS:!0,allowTaint:!0,backgroundColor:R,scale:2,logging:!1}).then(q=>{const se=document.createElement("a");se.download=`chart-${Ee}-${Te}-${Date.now()}.png`,se.href=q.toDataURL("image/png"),se.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(q=>{console.error("Chart screenshot failed",q),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Ee,Te,Re]);const Bt=J.useMemo(()=>ne.length===0?[]:Qe==="line"||Qe==="area"?ne.map(b=>({time:b.time,value:b.close})):ne,[ne,Qe]),ts=b=>{i?i(b):(fe("BUY"),le(!0))},Ca=b=>{n?n(b):(fe("SELL"),le(!0))},va=()=>{le(!1),fe(null)};J.useEffect(()=>{const b=o.current;if(!b)return;const m=b.getBoundingClientRect(),R=P=>{const re=Math.abs(Number(P));return Number.isFinite(re)?re>=1e3?re.toFixed(2):re>=1?re.toFixed(4):re.toFixed(5):"0"},Se=Re==="light",Q=i0(b,{width:m.width||b.clientWidth,height:m.height||b.clientHeight,autoSize:!0,localization:{priceFormatter:R},layout:{background:{color:Se?"#FFFFFF":"#0d1117",type:"solid"},textColor:Se?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:ge,color:ge?Se?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:ge?2:0},horzLines:{visible:ge,color:ge?Se?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:ge?2:0}},rightPriceScale:{borderColor:Se?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,textColor:Se?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:Se?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:ve===1?1:0,vertLine:{width:1,color:Se?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:Se?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:Se?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:Se?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:ve===1,horzLineVisible:ve===1},handleScroll:{mouseWheel:!0,pressedMouseMove:ve===null||ve===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),q=Q.addCandlestickSeries({upColor:Se?"#089981":"#26a69a",downColor:Se?"#f23645":"#ef5350",wickUpColor:Se?"#089981":"#26a69a",wickDownColor:Se?"#f23645":"#ef5350",borderUpColor:Se?"#089981":"#26a69a",borderDownColor:Se?"#f23645":"#ef5350",borderVisible:!0}),se=Q.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)"});a.current=Q,l.current=q,c.current=se,se.setData(ma(ne,Te)),requestAnimationFrame(()=>{if(b&&Q){const P=b.getBoundingClientRect();P.width>0&&P.height>0&&Q.resize(P.width,P.height)}});const ie=Q.timeScale(),ce=()=>{if(me.current&&xt.current.size>0){const P=ie.getVisibleRange();P&&ye(P)}};ie.subscribeVisibleTimeRangeChange(ce);const M=new ResizeObserver(P=>{for(const re of P){const{width:Ae,height:B}=re.contentRect;if(Ae>0&&B>0&&Q){const T=ie.getVisibleRange();Q.resize(Ae,B),T&&setTimeout(()=>{try{ie.setVisibleRange(T)}catch{}},0)}}});return M.observe(b),()=>{ie.unsubscribeVisibleTimeRangeChange(ce),M.disconnect(),Q.remove(),a.current=null,l.current=null,c.current=null,d.current=null,p.current=[]}},[]),J.useEffect(()=>{a.current&&a.current.applyOptions({grid:{vertLines:{visible:ge,color:ge?"rgba(110, 118, 129, 0.15)":"transparent",style:ge?2:0},horzLines:{visible:ge,color:ge?"rgba(110, 118, 129, 0.15)":"transparent",style:ge?2:0}}})},[ge]),J.useEffect(()=>{const b=a.current;if(!b)return;const m=Re==="light";b.applyOptions({layout:{background:{color:m?"#FFFFFF":"#12161d"},textColor:m?"#020617":"#fff"},grid:{vertLines:{color:ge?m?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:ge?m?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:m?"#e5e7eb":"#1e293b"},timeScale:{borderColor:m?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:m?"#3b82f6":"#58a6ff",labelBackgroundColor:m?"#eff6ff":"#161b22",width:1},horzLine:{color:m?"#3b82f6":"#58a6ff",labelBackgroundColor:m?"#eff6ff":"#161b22",width:1}}})},[Re,ge]),J.useEffect(()=>{if(!a.current)return;const m=!cA&&!(ve!==null&&ve!==1&&ve!==0),R=!cA;a.current.applyOptions({crosshair:{mode:ve===1?1:0,vertLine:{visible:ve===1,width:1,color:Re==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Re==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:ve===1,width:1,color:Re==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Re==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:R,pressedMouseMove:m,horzTouchDrag:m,vertTouchDrag:m},handleScale:{axisPressedMouseMove:{time:m,price:m},axisDoubleClickReset:{time:!1,price:R},axisTouch:{time:m,price:m},mouseWheel:R,pinch:R}})},[ve,cA]),J.useEffect(()=>{(async()=>{if(!Ee||!Te){Oe([]),me.current=!1;return}try{if(Ye(!0),Oe([]),me.current=!1,l.current)try{l.current.setData([])}catch{}const m=dd(Te),R=Lv(Te,m),Se=Ke||gv?.VITE_BASE_URL||"ws://localhost:8000",Q=Xe?.candles||"/api/chart/candles",q=We?.candles||{},se={symbol:q.symbol||"symbol",timeframe:q.timeframe||"timeframe",limit:q.limit||"limit",daysBack:q.daysBack||"daysBack"},ie={};ie[se.symbol]=Ee,ie[se.timeframe]=Te,ie[se.limit]=R,q.daysBack!==!1&&(ie[se.daysBack]=m);const ce=await oA.get(`${Se}${Q}`,{params:ie,timeout:1e4});let M=[];if(Array.isArray(ce.data)?M=ce.data:ce.data&&ce.data.data&&Array.isArray(ce.data.data)?M=ce.data.data:ce.data&&Array.isArray(ce.data)&&(M=ce.data),M&&M.length>0){const{candles:P,stats:re}=rh(M,Ee,Te);P.length>0?(Oe(P),xt.current=new Map,P.forEach(Ae=>{xt.current.set(Ae.time,Ae)})):(console.warn(`⚠️ No valid candles after processing for ${Ee}`),Oe([]))}else console.warn(`⚠️ No candle data returned for ${Ee}`),Oe([])}catch(m){console.error(`❌ Error fetching ${Ee}:`,m.message),Oe([])}finally{Ye(!1)}})()},[Ee,Te]),J.useEffect(()=>{CA.current=rn.getSocket();const b=CA.current,m=()=>{if(Ee&&Te&&b.connected){const ie={symbol:Ee,timeframe:Te};b.emit("subscribeCandles",ie)}},R=()=>{setTimeout(()=>{Ee&&Te&&m()},200)},Se=ie=>{},Q=ie=>{};b.on("connect",R),b.on("disconnect",Se),b.on("connect_error",Q),b.on("subscription:confirmed",ie=>{ie.type});const q=ie=>{if(!ie||!ie.candle||!ie.symbol||ie.symbol.toUpperCase()!==Ee?.toUpperCase())return;const{candle:ce}=ie,M=ih(ce,Ee,Te);if(!M)return;const P=Date.now();if(P-wi.current<200)return;wi.current=P;const re=a.current?.timeScale(),Ae=re?.getVisibleRange(),B=l.current,T=a.current;if(!(!B||!T||!me.current||B?.seriesType?.()!==(Qe==="line"?"Line":Qe==="area"?"Area":Qe==="bars"?"Bar":"Candlestick")))try{const u=xt.current.get(M.time),I=!u,E=u?{time:M.time,open:u.open,high:Math.max(u.high,M.close),low:Math.min(u.low,M.close),close:M.close}:M;xt.current.set(M.time,E),I&&c.current&&c.current.setData(ma(Array.from(xt.current.values()),Te));try{Qe==="line"||Qe==="area"?B.update({time:E.time,value:E.close}):B.update(E),re&&Ae&&ye(Ae)}catch(_){throw _}}catch{}};b.on("candleUpdate",q);const se=()=>{b.connected&&Ee&&Te&&m()};if(b.connected)se();else{const ie=()=>{setTimeout(se,200)};b.once("connect",ie),setTimeout(()=>{b.connected&&se()},500)}return()=>{b.off("candleUpdate",q),b.off("connect",R),b.off("disconnect",Se),b.off("connect_error",Q),b.off("subscription:confirmed"),Ee&&Te&&b.connected&&b.emit("unsubscribeCandles",{symbol:Ee,timeframe:Te})}},[Ee,Te,Ke]),J.useEffect(()=>{const b=l.current,m=a.current;if(!(!b||!m)&&!(ne.length===0&&me.current)){if(ne.length===0&&!me.current){if(De)return;const R=m.timeScale();b.setData([]),R.fitContent();return}if(!me.current){const R=m.timeScale(),Se=Fe(Ee,Te);Ue.current,Ue.current=Se;const Q=[...ne].sort((se,ie)=>se.time-ie.time);if(Qe==="line"||Qe==="area"){const se=Q?.map(ie=>({time:ie.time,value:ie.close})).filter(ie=>ie.time!=null);se.length>0&&b.setData(se)}else Q?.length>0&&b.setData(Q);if(Q?.length>0){const se=Q[Q?.length-1].time,ie=it(Te)||60,M=se-(Te==="M1"?150:Te==="M5"?120:100)*ie;try{R.setVisibleRange({from:M,to:se+ie*pd})}catch{R.fitContent()}}else R.fitContent();try{m.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0;const q=R.getVisibleRange();ye(q)}}},[ne.length,Qe,Ee,Te]),J.useEffect(()=>{const b=a.current;if(!b||!me.current||ne.length===0)return;const m=b.timeScale(),R=m.getVisibleRange()||ke();if(l.current)try{b.removeSeries(l.current)}catch{}if(d.current)try{b.removeSeries(d.current),d.current=null}catch{}let Se;if(Qe==="bars"){const Q=Re==="light";Se=b.addBarSeries({upColor:Q?"#089981":"#26A69A",downColor:Q?"#f23645":"#EF5350",borderUpColor:Q?"#089981":"#26A69A",borderDownColor:Q?"#f23645":"#EF5350",scaleMargins:{top:.1,bottom:.1}});const q=[...ne].sort((se,ie)=>se.time-ie.time);q?.length>0&&Se.setData(q)}else if(Qe==="line"){Se=b.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const Q=Ar(Bt);Q.length>0&&Se.setData(Q)}else if(Qe==="area"){Se=b.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 Q=Ar(Bt);Q.length>0&&Se.setData(Q)}else if(Qe==="volume ticks"||Qe==="volume"){const Q=Re==="light";Se=b.addCandlestickSeries({upColor:Q?"#089981":"#26A69A",downColor:Q?"#f23645":"#EF5350",wickUpColor:Q?"#089981":"#26A69A",wickDownColor:Q?"#f23645":"#EF5350",borderUpColor:Q?"#089981":"#26A69A",borderDownColor:Q?"#f23645":"#EF5350",borderVisible:!0,priceScaleId:"right"});const q=[...ne].sort((ce,M)=>ce.time-M.time);q?.length>0&&Se.setData(q);const se=b.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});b.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),b.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const ie=q?.map(ce=>({time:ce.time,value:ce.volume||0,color:ce.close>=ce.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));ie.length>0&&se.setData(ie),d.current=se}else{const Q=Re==="light";Se=b.addCandlestickSeries({upColor:Q?"#089981":"#26A69A",downColor:Q?"#f23645":"#EF5350",wickUpColor:Q?"#089981":"#26A69A",wickDownColor:Q?"#f23645":"#EF5350",borderUpColor:Q?"#089981":"#26A69A",borderDownColor:Q?"#f23645":"#EF5350",borderVisible:!0,scaleMargins:{top:.1,bottom:.1}});const q=[...ne].sort((se,ie)=>se.time-ie.time);q?.length>0&&Se.setData(q)}if(l.current=Se,R&&me.current)setTimeout(()=>{try{m.setVisibleRange(R),ye(R)}catch{if(ne.length>0)try{const q=ne[ne.length-1].time,se=it(Te)||60,ie=q-100*se;m.setVisibleRange({from:ie,to:q+se*pd}),ye(m.getVisibleRange())}catch{m.fitContent(),ye(m.getVisibleRange())}}try{b.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!me.current){m.fitContent();try{b.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0,ye(m.getVisibleRange())}},[Qe,ne.length,Bt.length]),J.useEffect(()=>{const b=a.current,m=d.current;if(!b||!m||!me.current||ne.length===0||Qe!=="volume"&&Qe!=="volume ticks")return;const Se=[...ne].sort((Q,q)=>Q.time-q.time)?.map(Q=>({time:Q.time,value:Q.volume||0,color:Q.close>=Q.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));Se.length>0&&m.setData(Se)},[ne,Qe]),J.useEffect(()=>{const b=a.current,m=l.current,R=o.current;if(!b||!m||!R)return;const Q=ve!==null?[null,null,"trendline","parallellines","fibonacci","rectangle",null,"text",null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][ve]:null,q=(M,P)=>{const re=Math.min(M.time,P.time),Ae=Math.max(M.time,P.time),B=M.time<=P.time?M.rawTime:P.rawTime,T=M.time<=P.time?P.rawTime:M.rawTime,U=Math.max(M.price,P.price),g=Math.min(M.price,P.price),u=Y(Math.round((re+Ae)/2));return u==null?null:{p1:{rawTime:u,normalizedTime:u,price:U},p2:{rawTime:B,normalizedTime:re,price:g},p3:{rawTime:T,normalizedTime:Ae,price:g}}};if(!Q){if(y.current=!1,w.current=null,C.current=null,S.current=null,v.current?.series)try{b.removeSeries(v.current.series)}catch{}if(v.current?.primitive)try{m.detachPrimitive(v.current.primitive)}catch{}v.current=null;return}if(Q==="pricelevel"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const u={type:"pricelevel",priceLine:m.createPriceLine({price:U,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:U.toFixed(5)}),price:U};Be(I=>[...I,u]),p.current.push(u)};return R.addEventListener("click",M),()=>{R.removeEventListener("click",M)}}if(Q==="horizontalray"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const g=new mv(U,T);m.attachPrimitive(g);const u=Y(T),I={type:"horizontalray",primitive:g,price:U,originTime:u};Be(E=>[...E,I]),p.current.push(I)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="verticalline"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=b.timeScale().coordinateToTime(Ae);if(B==null)return;const T=new Sv(B);m.attachPrimitive(T);const U=Y(B),g={type:"verticalline",primitive:T,time:U};Be(u=>[...u,g]),p.current.push(g)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="infoline"){let M=null,P=null;const re=B=>{if(!M)return;const T=R.getBoundingClientRect(),U=B.clientX-T.left,g=B.clientY-T.top,u=b.timeScale().coordinateToTime(U),I=m.coordinateToPrice(g);if(u==null||I==null)return;P||(P=b.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const E=M.normalizedTime,_=Y(u);if(E==null||_==null||E===_)return;const H=E<=_?[{time:E,value:M.price},{time:_,value:I}]:[{time:_,value:I},{time:E,value:M.price}];try{P.setData(H)}catch{}},Ae=B=>{const T=R.getBoundingClientRect(),U=B.clientX-T.left,g=B.clientY-T.top,u=b.timeScale().coordinateToTime(U),I=m.coordinateToPrice(g);if(u==null||I==null)return;if(!M){M={rawTime:u,price:I,normalizedTime:Y(u),x:U,y:g};return}if(P){try{b.removeSeries(P)}catch{}P=null}const E=M.normalizedTime,_=Y(u);if(E==null||_==null)return;const H=I-M.price,f=H/Math.abs(M.price)*100,L=it(Te)||3600,D=Math.abs(_-E),O=Math.max(1,Math.round(D/L)),K=Math.max(1,Math.round(D/86400)),z=M.x,$=M.y,te=U,pe=Math.atan2(-(g-$),te-z)*(180/Math.PI),He={priceDiff:H,pricePct:f,bars:O,days:K,angle:pe},Ne=new Bv({rawTime:M.rawTime,price:M.price},{rawTime:u,price:I},He);m.attachPrimitive(Ne);const Ge={type:"infoline",primitive:Ne,p1:{rawTime:M.rawTime,normalizedTime:E,price:M.price},p2:{rawTime:u,normalizedTime:_,price:I}};Be(Ve=>[...Ve,Ge]),p.current.push(Ge),M=null,Ce(null)};return R.addEventListener("mousemove",re),R.addEventListener("click",Ae),()=>{if(R.removeEventListener("mousemove",re),R.removeEventListener("click",Ae),P)try{b.removeSeries(P)}catch{}}}if(Q==="rulerline"){let M=null,P=null;const re=(T,U,g,u)=>{const I=Y(T),E=Y(g),_=u-U,H=_/Math.abs(U)*100,f=it(Te)||3600,L=Math.abs((E??0)-(I??0)),D=Math.max(1,Math.round(L/f)),O=Math.max(1,Math.round(L/86400));return{priceDiff:_,pricePct:H,bars:D,days:O}},Ae=T=>{if(!M)return;const U=R.getBoundingClientRect(),g=T.clientX-U.left,u=T.clientY-U.top,I=b.timeScale().coordinateToTime(g),E=m.coordinateToPrice(u);if(I==null||E==null)return;const _=Y(I);if(_==null||_===M.normalizedTime)return;const H=re(M.rawTime,M.price,I,E);if(!P)P=new od({rawTime:M.rawTime,price:M.price},{rawTime:I,price:E},H),m.attachPrimitive(P);else{P.p2={rawTime:I,price:E},P.info=H;const f=E>=M.price;P.color=f?"#3b82f6":"#ef5350",P.fillColor=f?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{a.current?.applyOptions({})}catch{}}},B=T=>{const U=R.getBoundingClientRect(),g=T.clientX-U.left,u=T.clientY-U.top,I=b.timeScale().coordinateToTime(g),E=m.coordinateToPrice(u);if(I==null||E==null)return;if(!M){M={rawTime:I,price:E,normalizedTime:Y(I)};return}if(P){try{m.detachPrimitive(P)}catch{}P=null}const _=M.normalizedTime,H=Y(I);if(_==null||H==null)return;const f=re(M.rawTime,M.price,I,E),L=new od({rawTime:M.rawTime,price:M.price},{rawTime:I,price:E},f);m.attachPrimitive(L);const D={type:"rulerline",primitive:L,p1:{rawTime:M.rawTime,normalizedTime:_,price:M.price},p2:{rawTime:I,normalizedTime:H,price:E}};Be(O=>[...O,D]),p.current.push(D),M=null,Ce(null)};return R.addEventListener("mousemove",Ae),R.addEventListener("click",B),()=>{if(R.removeEventListener("mousemove",Ae),R.removeEventListener("click",B),P)try{m.detachPrimitive(P)}catch{}}}if(Q==="arrowedline"){let M=null,P=null;const re=B=>{if(!M)return;const T=R.getBoundingClientRect(),U=B.clientX-T.left,g=B.clientY-T.top,u=b.timeScale().coordinateToTime(U),I=m.coordinateToPrice(g);if(u==null||I==null)return;const E=Y(u);if(!(E==null||E===M.normalizedTime))if(!P)P=new ad({rawTime:M.rawTime,price:M.price},{rawTime:u,price:I}),m.attachPrimitive(P);else{P.p2={rawTime:u,price:I};try{a.current?.applyOptions({})}catch{}}},Ae=B=>{const T=R.getBoundingClientRect(),U=B.clientX-T.left,g=B.clientY-T.top,u=b.timeScale().coordinateToTime(U),I=m.coordinateToPrice(g);if(u==null||I==null)return;if(!M){M={rawTime:u,price:I,normalizedTime:Y(u)};return}if(P){try{m.detachPrimitive(P)}catch{}P=null}const E=M.normalizedTime,_=Y(u);if(E==null||_==null||E===_)return;const H=new ad({rawTime:M.rawTime,price:M.price},{rawTime:u,price:I});m.attachPrimitive(H);const f={type:"arrowedline",primitive:H,p1:{rawTime:M.rawTime,normalizedTime:E,price:M.price},p2:{rawTime:u,normalizedTime:_,price:I}};Be(L=>[...L,f]),p.current.push(f),M=null,Ce(null)};return R.addEventListener("mousemove",re),R.addEventListener("click",Ae),()=>{if(R.removeEventListener("mousemove",re),R.removeEventListener("click",Ae),P)try{m.detachPrimitive(P)}catch{}}}if(Q==="rayline"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const g=Ae+140,u=b.timeScale().coordinateToTime(g);if(u==null)return;const I=Y(T),E=Y(u);if(I==null||E==null)return;const _=new bv({rawTime:T,price:U},{rawTime:u,price:U});m.attachPrimitive(_);const H={type:"rayline",primitive:_,p1:{rawTime:T,normalizedTime:I,price:U},p2:{rawTime:u,normalizedTime:E,price:U}};Be(f=>[...f,H]),p.current.push(H),Ce(null)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="extendedline"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const g=Ae+140,u=b.timeScale().coordinateToTime(g);if(u==null)return;const I=Y(T),E=Y(u);if(I==null||E==null)return;const _=new Tv({rawTime:T,price:U},{rawTime:u,price:U});m.attachPrimitive(_);const H={type:"extendedline",primitive:_,p1:{rawTime:T,normalizedTime:I,price:U},p2:{rawTime:u,normalizedTime:E,price:U}};Be(f=>[...f,H]),p.current.push(H),Ce(null)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="crossline"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const g=Y(T);if(g==null)return;const u=new Qv({rawTime:T,price:U});m.attachPrimitive(u);const I={type:"crossline",primitive:u,p:{rawTime:T,normalizedTime:g,price:U}};Be(E=>[...E,I]),p.current.push(I),Ce(null)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="trendbyangle"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const g=Ae+140,u=b.timeScale().coordinateToTime(g);if(u==null)return;const I=Y(T),E=Y(u);if(I==null||E==null)return;const _=new xv({rawTime:T,price:U},{rawTime:u,price:U});m.attachPrimitive(_);const H={type:"trendbyangle",primitive:_,p1:{rawTime:T,normalizedTime:I,price:U},p2:{rawTime:u,normalizedTime:E,price:U}};Be(f=>[...f,H]),p.current.push(H),Ce(null)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="disjointchannel"){let M=null,P=null,re=null,Ae=null,B=0,T=null;const U=(I,E,_,H)=>{if(!T)T=new fa(I,E,_,H),m.attachPrimitive(T);else{T.p1=I,T.p2=E,T.p3=_,T.p4=H;try{a.current?.applyOptions({})}catch{}}},g=I=>{if(B===0||!M)return;const E=R.getBoundingClientRect(),_=I.clientX-E.left,H=I.clientY-E.top;if(B===1){const f=m.coordinateToPrice(H);if(f==null)return;P={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:f},U({rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price},{rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price});return}if(B===2&&P){const f=b.timeScale().coordinateToTime(_),L=m.coordinateToPrice(H);if(f==null||L==null)return;const D=Y(f);if(D==null)return;const O=(M.price+P.price)/2;L>=O?(re={rawTime:f,normalizedTime:D,price:L},Ae={rawTime:f,normalizedTime:D,price:2*O-L}):(Ae={rawTime:f,normalizedTime:D,price:L},re={rawTime:f,normalizedTime:D,price:2*O-L}),U({rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price},{rawTime:re.rawTime,price:re.price},{rawTime:Ae.rawTime,price:Ae.price})}},u=I=>{const E=R.getBoundingClientRect(),_=I.clientX-E.left,H=I.clientY-E.top,f=b.timeScale().coordinateToTime(_),L=m.coordinateToPrice(H);if(f==null||L==null)return;const D=Y(f);if(D!=null){if(B===0){M={rawTime:f,normalizedTime:D,price:L},P={rawTime:f,normalizedTime:D,price:L},B=1,U({rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price},{rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price});return}if(B===1){const O=m.coordinateToPrice(H);if(O==null||Math.abs(O-M.price)<1e-7)return;P={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:O},B=2;return}if(B===2&&T){try{m.detachPrimitive(T)}catch{}const O=new fa(T.p1,T.p2,T.p3,T.p4);m.attachPrimitive(O);const K={type:"disjointchannel",primitive:O,p1:M,p2:P,p3:{rawTime:T.p3.rawTime,normalizedTime:Y(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:Y(T.p4.rawTime),price:T.p4.price}};Be(z=>[...z,K]),p.current.push(K),Ce(null)}}};return R.addEventListener("mousemove",g),R.addEventListener("click",u),()=>{if(R.removeEventListener("mousemove",g),R.removeEventListener("click",u),T)try{m.detachPrimitive(T)}catch{}}}if(Q==="flattopbottom"){let M=null,P=null,re=null,Ae=null,B=0,T=null;const U=(I,E,_,H)=>{if(!T)T=new ld(I,E,_,H),m.attachPrimitive(T);else{T.p1=I,T.p2=E,T.p3=_,T.p4=H;try{a.current?.applyOptions({})}catch{}}},g=I=>{if(B===0||!M)return;const E=R.getBoundingClientRect(),_=I.clientX-E.left,H=I.clientY-E.top;if(B===1){const f=m.coordinateToPrice(H);if(f==null)return;P={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:f},U({rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price},{rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price});return}if(B===2&&P){const f=b.timeScale().coordinateToTime(_),L=m.coordinateToPrice(H);if(f==null||L==null)return;const D=Y(f);if(D==null)return;re={rawTime:f,normalizedTime:D,price:L},Ae={rawTime:f,normalizedTime:D,price:P.price},U({rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price},{rawTime:re.rawTime,price:re.price},{rawTime:Ae.rawTime,price:Ae.price})}},u=I=>{const E=R.getBoundingClientRect(),_=I.clientX-E.left,H=I.clientY-E.top,f=b.timeScale().coordinateToTime(_),L=m.coordinateToPrice(H);if(f==null||L==null)return;const D=Y(f);if(D!=null){if(B===0){M={rawTime:f,normalizedTime:D,price:L},P={rawTime:f,normalizedTime:D,price:L},B=1,U({rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price},{rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price});return}if(B===1){const O=m.coordinateToPrice(H);if(O==null||Math.abs(O-M.price)<1e-7)return;P={rawTime:M.rawTime,normalizedTime:M.normalizedTime,price:O},B=2;return}if(B===2&&T){try{m.detachPrimitive(T)}catch{}const O=new ld(T.p1,T.p2,T.p3,T.p4);m.attachPrimitive(O);const K={type:"flattopbottom",primitive:O,p1:M,p2:P,p3:{rawTime:T.p3.rawTime,normalizedTime:Y(T.p3.rawTime),price:T.p3.price},p4:{rawTime:T.p4.rawTime,normalizedTime:Y(T.p4.rawTime),price:T.p4.price}};Be(z=>[...z,K]),p.current.push(K),Ce(null)}}};return R.addEventListener("mousemove",g),R.addEventListener("click",u),()=>{if(R.removeEventListener("mousemove",g),R.removeEventListener("click",u),T)try{m.detachPrimitive(T)}catch{}}}if(Q==="regressionchannel"){let M=null,P=null;const re=(T,U)=>{T.mid1={rawTime:U.p1.rawTime,price:U.p1.price},T.mid2={rawTime:U.p2.rawTime,price:U.p2.price},T.top1={rawTime:U.top1.rawTime,price:U.top1.price},T.top2={rawTime:U.top2.rawTime,price:U.top2.price},T.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},T.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price}},Ae=T=>{if(!M)return;const U=R.getBoundingClientRect(),g=T.clientX-U.left,u=T.clientY-U.top,I=b.timeScale().coordinateToTime(g),E=m.coordinateToPrice(u);if(I==null||E==null)return;const _=Y(I);if(_==null)return;const f=es(ne,M,{rawTime:I,normalizedTime:_},1);if(f)if(!P)P=new pa({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),m.attachPrimitive(P);else{re(P,f);try{b.applyOptions({})}catch{}}},B=T=>{const U=R.getBoundingClientRect(),g=T.clientX-U.left,u=T.clientY-U.top,I=b.timeScale().coordinateToTime(g),E=m.coordinateToPrice(u);if(I==null||E==null)return;const _=Y(I);if(_==null)return;if(!M){M={rawTime:I,normalizedTime:_,price:E};return}const f=es(ne,M,{rawTime:I,normalizedTime:_},1);if(!f)return;if(P){try{m.detachPrimitive(P)}catch{}P=null}const L=new pa({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});m.attachPrimitive(L);const D={type:"regressionchannel",primitive:L,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,intercept:f.intercept,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};Be(O=>[...O,D]),p.current.push(D),M=null,Ce(null)};return R.addEventListener("mousemove",Ae),R.addEventListener("click",B),()=>{if(R.removeEventListener("mousemove",Ae),R.removeEventListener("click",B),P)try{m.detachPrimitive(P)}catch{}}}if(Q==="stddevchannel"){let M=null,P=null;const re=(T,U)=>{T.mid1={rawTime:U.p1.rawTime,price:U.p1.price},T.mid2={rawTime:U.p2.rawTime,price:U.p2.price},T.top1={rawTime:U.top1.rawTime,price:U.top1.price},T.top2={rawTime:U.top2.rawTime,price:U.top2.price},T.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},T.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price}},Ae=T=>{if(!M)return;const U=R.getBoundingClientRect(),g=T.clientX-U.left,u=T.clientY-U.top,I=b.timeScale().coordinateToTime(g),E=m.coordinateToPrice(u);if(I==null||E==null)return;const _=Y(I);if(_==null)return;const f=ga(ne,M,{rawTime:I,normalizedTime:_},1);if(f)if(!P)P=new hd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),m.attachPrimitive(P);else{re(P,f);try{b.applyOptions({})}catch{}}},B=T=>{const U=R.getBoundingClientRect(),g=T.clientX-U.left,u=T.clientY-U.top,I=b.timeScale().coordinateToTime(g),E=m.coordinateToPrice(u);if(I==null||E==null)return;const _=Y(I);if(_==null)return;if(!M){M={rawTime:I,normalizedTime:_,price:E};return}const f=ga(ne,M,{rawTime:I,normalizedTime:_},1);if(!f)return;if(P){try{m.detachPrimitive(P)}catch{}P=null}const L=new hd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});m.attachPrimitive(L);const D={type:"stddevchannel",primitive:L,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};Be(O=>[...O,D]),p.current.push(D),M=null,Ce(null)};return R.addEventListener("mousemove",Ae),R.addEventListener("click",B),()=>{if(R.removeEventListener("mousemove",Ae),R.removeEventListener("click",B),P)try{m.detachPrimitive(P)}catch{}}}if(Q==="andrewspitchfork"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const g=Y(T);if(g==null)return;const u=Ae+140,I=b.timeScale().coordinateToTime(u);if(I==null)return;const E=Y(I);if(E==null)return;const _={rawTime:T,normalizedTime:g,price:U},H={rawTime:I,normalizedTime:E,price:U},f={rawTime:T,normalizedTime:g,price:U},L=new Fv({rawTime:_.rawTime,price:_.price},{rawTime:H.rawTime,price:H.price},{rawTime:f.rawTime,price:f.price});m.attachPrimitive(L);const D={type:"andrewspitchfork",primitive:L,p1:_,p2:H,p3:f};Be(O=>[...O,D]),p.current.push(D),x(D),oe.current=D,Ce(null)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="gannfan"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const g=Y(T);if(g==null)return;const u={rawTime:T,normalizedTime:g,price:U},I={rawTime:T,normalizedTime:g,price:U},E=new Uv({rawTime:u.rawTime,price:u.price},{rawTime:I.rawTime,price:I.price});m.attachPrimitive(E);const _={type:"gannfan",primitive:E,p1:u,p2:I};Be(H=>[...H,_]),p.current.push(_),x(_),oe.current=_,Ce(null)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="ganngrid"){const M=P=>{const re=R.getBoundingClientRect(),Ae=P.clientX-re.left,B=P.clientY-re.top,T=b.timeScale().coordinateToTime(Ae),U=m.coordinateToPrice(B);if(T==null||U==null)return;const g=Y(T);if(g==null)return;const u={rawTime:T,normalizedTime:g,price:U},I={rawTime:T,normalizedTime:g,price:U},E=new Ev({rawTime:u.rawTime,price:u.price},{rawTime:I.rawTime,price:I.price});m.attachPrimitive(E);const _={type:"ganngrid",primitive:E,p1:u,p2:I};Be(H=>[...H,_]),p.current.push(_),x(_),oe.current=_,Ce(null)};return R.addEventListener("click",M),()=>R.removeEventListener("click",M)}if(Q==="trendline"||Q==="gannline"){const M=Q,P=M==="gannline"?"#7aa6ae":"#22c55e",re=U=>{U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation();const g=R.getBoundingClientRect(),u=U.clientX-g.left,I=U.clientY-g.top;let E=b.timeScale().coordinateToTime(u);const _=m.coordinateToPrice(I);if(!(E==null||_==null)&&(E=Y(E),E!=null))if(S.current===null){S.current={time:E,price:_};const H=b.addLineSeries({color:P,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});v.current={type:M,series:H},H.setData([{time:E,value:_}])}else{const H=S.current,f={time:E,price:_},L=1,D=1e-5,O=Math.abs(f.time-H.time),K=Math.abs(f.price-H.price);if(O<L&&K<D){try{b.removeSeries(v.current.series)}catch{}S.current=null,v.current=null;return}const z={time:H.time,price:H.price},$={time:f.time,price:f.price},te=Ar([{time:z.time,value:z.price},{time:$.time,value:$.price}]);if(te.length>0){v.current.series.setData(te);const he={type:M,series:v.current.series,point1:z,point2:$};Be(pe=>[...pe,he]),p.current.push(he)}Ce(null),S.current=null,v.current=null}},Ae=U=>{if(S.current===null||v.current?.type!=="trendline"&&v.current?.type!=="gannline")return;U.preventDefault(),U.stopPropagation();const g=R.getBoundingClientRect(),u=U.clientX-g.left,I=U.clientY-g.top;let E=b.timeScale().coordinateToTime(u);const _=m.coordinateToPrice(I);if(E==null||_==null||(E=Y(E),E==null))return;const H=S.current,f=Ar([{time:H.time,value:H.price},{time:E,value:_}]);f.length>0&&v.current.series.setData(f)},B=U=>{U.stopPropagation()},T={capture:!0,passive:!1};return R.addEventListener("click",re,T),R.addEventListener("mousemove",Ae,T),R.addEventListener("mousemove",B,T),()=>{if(S.current=null,(v.current?.type==="trendline"||v.current?.type==="gannline")&&v.current?.series){try{b.removeSeries(v.current.series)}catch{}v.current=null}R.removeEventListener("click",re,T),R.removeEventListener("mousemove",Ae,T),R.removeEventListener("mousemove",B,T)}}if(Q==="parallellines"){let M=null,P=null,re=null,Ae=0,B=null;const T=(_,H,f,L)=>{_.p1={rawTime:H.rawTime,price:H.price},_.p2={rawTime:f.rawTime,price:f.price},_.b1={rawTime:L.b1.rawTime,price:L.b1.price},_.b2={rawTime:L.b2.rawTime,price:L.b2.price},_.p3={rawTime:L.bottomMid.rawTime,price:L.bottomMid.price}},U=(_,H,f)=>{const L=fd(_,H,f);if(!L)return null;if(!B)B=new cd({rawTime:_.rawTime,price:_.price},{rawTime:H.rawTime,price:H.price},{rawTime:L.b1.rawTime,price:L.b1.price},{rawTime:L.b2.rawTime,price:L.b2.price},{rawTime:L.bottomMid.rawTime,price:L.bottomMid.price}),m.attachPrimitive(B);else{T(B,_,H,L);try{b.applyOptions({})}catch{}}return L},g=_=>{_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation();const H=R.getBoundingClientRect(),f=_.clientX-H.left,L=_.clientY-H.top,D=b.timeScale().coordinateToTime(f),O=m.coordinateToPrice(L);if(D==null||O==null)return;const K=Y(D);if(K!=null){if(Ae===0){M={rawTime:D,normalizedTime:K,price:O},Ae=1;return}if(Ae===1){if(P={rawTime:D,normalizedTime:K,price:O},Math.abs(P.normalizedTime-M.normalizedTime)<1)return;const z=Y((M.normalizedTime+P.normalizedTime)/2);if(z==null)return;const $=(M.price+P.price)/2;re={rawTime:z,normalizedTime:z,price:$},U(M,P,re),Ae=2;return}if(Ae===2&&M&&P){re={rawTime:D,normalizedTime:K,price:O};const z=U(M,P,re);if(!z||!B)return;try{m.detachPrimitive(B)}catch{}const $=new cd({rawTime:M.rawTime,price:M.price},{rawTime:P.rawTime,price:P.price},{rawTime:z.b1.rawTime,price:z.b1.price},{rawTime:z.b2.rawTime,price:z.b2.price},{rawTime:z.bottomMid.rawTime,price:z.bottomMid.price});m.attachPrimitive($);const te={type:"equidistantchannel",primitive:$,p1:M,p2:P,p3:z.bottomMid,b1:z.b1,b2:z.b2,bottomMid:z.bottomMid};Be(he=>[...he,te]),p.current.push(te),Ce(null),Ae=0,M=null,P=null,re=null,B=null}}},u=_=>{if(Ae===0||!M)return;const H=R.getBoundingClientRect(),f=_.clientX-H.left,L=_.clientY-H.top,D=b.timeScale().coordinateToTime(f),O=m.coordinateToPrice(L);if(D==null||O==null)return;const K=Y(D);if(K!=null){if(Ae===1){const z={rawTime:D,normalizedTime:K,price:O},$=Y((M.normalizedTime+z.normalizedTime)/2);if($==null)return;const te=(M.price+z.price)/2;U(M,z,{rawTime:$,normalizedTime:$,price:te});return}Ae===2&&P&&U(M,P,{rawTime:D,normalizedTime:K,price:O})}},I=_=>{_.stopPropagation()},E={capture:!0,passive:!1};return R.addEventListener("click",g,E),R.addEventListener("mousemove",u,E),R.addEventListener("mousemove",I,E),()=>{if(Ae=0,M=null,P=null,re=null,F.current=[],B)try{m.detachPrimitive(B)}catch{}B=null,R.removeEventListener("click",g,E),R.removeEventListener("mousemove",u,E),R.removeEventListener("mousemove",I,E)}}if(Q==="fibonacci"){let M=null,P=null;const re=B=>{if(!M)return;const T=R.getBoundingClientRect(),U=B.clientX-T.left,g=B.clientY-T.top,u=b.timeScale().coordinateToTime(U),I=m.coordinateToPrice(g);if(!(u==null||I==null))if(!P)P=new ud({rawTime:M.rawTime,price:M.price},{rawTime:u,price:I}),m.attachPrimitive(P);else{P.p2={rawTime:u,price:I};try{b.applyOptions({})}catch{}}},Ae=B=>{const T=R.getBoundingClientRect(),U=B.clientX-T.left,g=B.clientY-T.top,u=b.timeScale().coordinateToTime(U),I=m.coordinateToPrice(g);if(u==null||I==null)return;if(!M){M={rawTime:u,price:I,normalizedTime:Y(u)};return}if(P){try{m.detachPrimitive(P)}catch{}P=null}const E=M.normalizedTime,_=Y(u);if(E==null||_==null)return;if(Math.abs(I-M.price)<1e-5){M=null;return}const H=new ud({rawTime:M.rawTime,price:M.price},{rawTime:u,price:I});m.attachPrimitive(H);const f={type:"fibonacci",primitive:H,p1:{rawTime:M.rawTime,normalizedTime:E,price:M.price},p2:{rawTime:u,normalizedTime:_,price:I}};Be(L=>[...L,f]),p.current.push(f),M=null,Ce(null)};return R.addEventListener("mousemove",re),R.addEventListener("click",Ae),()=>{if(R.removeEventListener("mousemove",re),R.removeEventListener("click",Ae),P)try{m.detachPrimitive(P)}catch{}}}if(S.current=null,(v.current?.type==="trendline"||v.current?.type==="gannline")&&v.current?.series){try{b.removeSeries(v.current.series)}catch{}v.current=null}const se=M=>{if(M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation(),Q==="trendline"||Q==="gannline"||Q==="parallellines"||Q==="fibonacci"||Q!=="rectangle"&&Q!=="circle"&&Q!=="triangle"&&Q!=="ellipse")return;const P=R.getBoundingClientRect(),re=M.clientX-P.left,Ae=M.clientY-P.top;let B=b.timeScale().coordinateToTime(re);const T=m.coordinateToPrice(Ae);if(B==null||T==null)return;const U=B;if(B=Y(B),B!=null){if(y.current=!0,w.current={time:B,normalizedTime:B,rawTime:U,price:T},C.current=null,Q==="rectangle"){const g=new wv({rawTime:U,price:T},{rawTime:U,price:T},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});m.attachPrimitive(g),v.current={type:"rectangle",primitive:g}}if(Q==="circle"){const g=new Cv({rawTime:U,price:T},{rawTime:U,price:T},{strokeColor:"#7aa6ae",lineWidth:1});m.attachPrimitive(g),v.current={type:"circle",primitive:g}}if(Q==="triangle"){const g=new vv({rawTime:U,price:T},{rawTime:U,price:T},{rawTime:U,price:T},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});m.attachPrimitive(g),v.current={type:"triangle",primitive:g}}if(Q==="ellipse"){const g=new yv({rawTime:U,price:T},{rawTime:U,price:T},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});m.attachPrimitive(g),v.current={type:"ellipse",primitive:g}}if(Q==="parallellines"){const g=b.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});v.current={type:"parallellines",series:g,firstLine:null,secondLine:null}}}},ie=M=>{if(!y.current||!w.current||!v.current)return;M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation();const P=R.getBoundingClientRect(),re=M.clientX-P.left,Ae=M.clientY-P.top;let B=b.timeScale().coordinateToTime(re);const T=m.coordinateToPrice(Ae);if(B==null||T==null)return;const U=B;if(B=Y(B),B==null)return;C.current={time:B,normalizedTime:B,rawTime:U,price:T};const g=w.current;if(v.current.type==="rectangle"){const u=v.current.primitive;u.p1={rawTime:g.rawTime,price:g.price},u.p2={rawTime:U,price:T};try{a.current?.applyOptions({})}catch{}}if(v.current.type==="circle"){const u=v.current.primitive;u.p1={rawTime:g.rawTime,price:g.price},u.p2={rawTime:U,price:T};try{a.current?.applyOptions({})}catch{}}if(v.current.type==="triangle"){const u=v.current.primitive,I=q(g,{time:B,rawTime:U,price:T});if(!I)return;u.p1={rawTime:I.p1.rawTime,price:I.p1.price},u.p2={rawTime:I.p2.rawTime,price:I.p2.price},u.p3={rawTime:I.p3.rawTime,price:I.p3.price};try{a.current?.applyOptions({})}catch{}}if(v.current.type==="ellipse"){const u=v.current.primitive;u.p1={rawTime:g.rawTime,price:g.price},u.p2={rawTime:U,price:T};try{a.current?.applyOptions({})}catch{}}if(v.current.type==="parallellines")if(v.current.firstLine){const u=v.current.firstLine;u.endTime-u.startTime;const I=u.endPrice-u.startPrice,E=T,_=E+I;if(v.current.secondLine)v.current.secondLine.setData([{time:g.time,value:E},{time:B,value:_}]);else{const H=b.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});H.setData([{time:g.time,value:E},{time:B,value:_}]),v.current.secondLine=H}}else v.current.series.setData([{time:g.time,value:g.price},{time:B,value:T}])},ce=M=>{if(M&&(M.preventDefault(),M.stopPropagation()),!y.current||!v.current||!w.current)return;const P=w.current,re=C.current||P;if(v.current.type==="parallellines")if(v.current.firstLine){const Ae={type:"parallellines",firstLine:v.current.series,secondLine:v.current.secondLine,firstLineData:v.current.firstLine};Be(B=>[...B,Ae]),p.current.push(Ae),Ce(null),v.current=null,y.current=!1,w.current=null,C.current=null;return}else{v.current.firstLine={startTime:P.time,startPrice:P.price,endTime:re.time,endPrice:re.price},y.current=!1,w.current=null,C.current=null;return}if(v.current.type==="rectangle"){const Ae=w.current,B=C.current||Ae,T=Math.max(Ae.price,B.price),U=Math.min(Ae.price,B.price),g=Y(Math.min(Ae.time,B.time)),u=Y(Math.max(Ae.time,B.time));if(g!=null&&u!=null&&Math.abs(u-g)>=1&&Math.abs(T-U)>=1e-5){const I=v.current.primitive,E=Ae.time<=B.time?Ae.rawTime:B.rawTime,_=Ae.time<=B.time?B.rawTime:Ae.rawTime,H={rawTime:E,normalizedTime:g,price:T},f={rawTime:_,normalizedTime:u,price:U};I.p1={rawTime:H.rawTime,price:H.price},I.p2={rawTime:f.rawTime,price:f.price};const L={type:"rectangle",primitive:I,p1:H,p2:f};Be(D=>[...D,L]),p.current.push(L),Ce(null)}else try{m.detachPrimitive(v.current.primitive)}catch{}}if(v.current.type==="circle"){const Ae=v.current.primitive,B={rawTime:P.rawTime,normalizedTime:P.time,price:P.price},T={rawTime:re.rawTime,normalizedTime:re.time,price:re.price},U=b.timeScale().timeToCoordinate(B.rawTime),g=m.priceToCoordinate(B.price),u=b.timeScale().timeToCoordinate(T.rawTime),I=m.priceToCoordinate(T.price);if((U!=null&&g!=null&&u!=null&&I!=null?Math.hypot(u-U,I-g):0)>=3){Ae.p1={rawTime:B.rawTime,price:B.price},Ae.p2={rawTime:T.rawTime,price:T.price};const _={type:"circle",primitive:Ae,p1:B,p2:T};Be(H=>[...H,_]),p.current.push(_),Ce(null)}else try{m.detachPrimitive(v.current.primitive)}catch{}}if(v.current.type==="triangle"){const Ae=v.current.primitive,B=q(P,re);if(B){const T=Math.abs(B.p3.normalizedTime-B.p2.normalizedTime),U=Math.abs(B.p1.price-B.p2.price);if(T>=1&&U>=1e-5){Ae.p1={rawTime:B.p1.rawTime,price:B.p1.price},Ae.p2={rawTime:B.p2.rawTime,price:B.p2.price},Ae.p3={rawTime:B.p3.rawTime,price:B.p3.price};const g={type:"triangle",primitive:Ae,p1:B.p1,p2:B.p2,p3:B.p3};Be(u=>[...u,g]),p.current.push(g),Ce(null)}else try{m.detachPrimitive(v.current.primitive)}catch{}}else try{m.detachPrimitive(v.current.primitive)}catch{}}if(v.current.type==="ellipse"){const Ae=v.current.primitive,B={rawTime:P.rawTime,normalizedTime:P.time,price:P.price},T={rawTime:re.rawTime,normalizedTime:re.time,price:re.price},U=b.timeScale().timeToCoordinate(B.rawTime),g=m.priceToCoordinate(B.price),u=b.timeScale().timeToCoordinate(T.rawTime),I=m.priceToCoordinate(T.price);if((U!=null&&g!=null&&u!=null&&I!=null?Math.hypot(u-U,I-g):0)>=4){Ae.p1={rawTime:B.rawTime,price:B.price},Ae.p2={rawTime:T.rawTime,price:T.price},Ae.previewAsLine=!1,Ae.minorRatio=.45;const _={type:"ellipse",primitive:Ae,p1:B,p2:T,minorRatio:.45};Be(H=>[...H,_]),p.current.push(_),Ce(null)}else try{m.detachPrimitive(v.current.primitive)}catch{}}y.current=!1,w.current=null,C.current=null,v.current=null};if(Q==="rectangle"||Q==="circle"||Q==="triangle"||Q==="ellipse"){const M={capture:!0,passive:!1},P=re=>{y.current||re.stopPropagation()};return R.addEventListener("mousedown",se,M),R.addEventListener("mousemove",ie,M),R.addEventListener("mousemove",P,M),R.addEventListener("mouseup",ce,M),()=>{if((v.current?.type==="rectangle"||v.current?.type==="circle"||v.current?.type==="triangle"||v.current?.type==="ellipse")&&v.current?.primitive)try{m.detachPrimitive(v.current.primitive)}catch{}v.current=null,y.current=!1,w.current=null,C.current=null,R.removeEventListener("mousedown",se,M),R.removeEventListener("mousemove",ie,M),R.removeEventListener("mousemove",P,M),R.removeEventListener("mouseup",ce,M)}}},[ve,ne,Be,Ce]),J.useEffect(()=>{const b=a.current,m=l.current,R=o.current,Se=ve===null||ve===1;if(!Se||!b||!m||!R){Se||(x(null),N([]),X(null),ae([]));return}const Q=10,q=8;function se(B){if(!B)return[];if(B.type==="trendline"&&B.point1&&B.point2){const T=b.timeScale().timeToCoordinate(B.point1.time),U=m.priceToCoordinate(B.point1.price),g=b.timeScale().timeToCoordinate(B.point2.time),u=m.priceToCoordinate(B.point2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="gannline"&&B.point1&&B.point2){const T=b.timeScale().timeToCoordinate(B.point1.time),U=m.priceToCoordinate(B.point1.price),g=b.timeScale().timeToCoordinate(B.point2.time),u=m.priceToCoordinate(B.point2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:(T+g)/2,y:(U+u)/2},{x:g,y:u}]}if(B.type==="rectangle"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);if(T==null||U==null||g==null||u==null)return[];const I=Math.min(T,g),E=Math.max(T,g),_=Math.min(U,u),H=Math.max(U,u),f=(I+E)/2,L=(_+H)/2;return[{x:I,y:_},{x:f,y:_},{x:E,y:_},{x:I,y:L},{x:E,y:L},{x:I,y:H},{x:f,y:H},{x:E,y:H}]}if(B.type==="circle"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="triangle"&&B.p1&&B.p2&&B.p3){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price),I=b.timeScale().timeToCoordinate(B.p3.rawTime),E=m.priceToCoordinate(B.p3.price);return T==null||U==null||g==null||u==null||I==null||E==null?[]:[{x:T,y:U},{x:g,y:u},{x:I,y:E}]}if(B.type==="ellipse"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);if(T==null||U==null||g==null||u==null)return[];const I=(T+g)/2,E=(U+u)/2,_=g-T,H=u-U,f=Math.hypot(_,H);if(f<.001)return[];const L=_/f,D=H/f,O=-D,K=L,z=f/2,$=z*Math.max(.05,B.minorRatio??.45);return[{x:I-L*z,y:E-D*z},{x:I+O*$,y:E+K*$},{x:I+L*z,y:E+D*z},{x:I-O*$,y:E-K*$}]}if(B.type==="gannfan"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="ganngrid"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="arrowedline"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="rayline"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="extendedline"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="crossline"&&B.p){const T=b.timeScale().timeToCoordinate(B.p.rawTime),U=m.priceToCoordinate(B.p.price);return T==null||U==null?[]:[{x:T,y:U}]}if(B.type==="trendbyangle"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="andrewspitchfork"&&B.p1&&B.p2&&B.p3){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price),I=b.timeScale().timeToCoordinate(B.p3.rawTime),E=m.priceToCoordinate(B.p3.price);return T==null||U==null||g==null||u==null||I==null||E==null?[]:[{x:T,y:U},{x:g,y:u},{x:I,y:E}]}if(B.type==="equidistantchannel"&&B.p1&&B.p2&&B.b1&&B.b2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price),I=b.timeScale().timeToCoordinate(B.b1.rawTime),E=m.priceToCoordinate(B.b1.price),_=b.timeScale().timeToCoordinate(B.b2.rawTime),H=m.priceToCoordinate(B.b2.price);return T==null||U==null||g==null||u==null||I==null||E==null||_==null||H==null?[]:[{x:T,y:U},{x:g,y:u},{x:(I+_)/2,y:(E+H)/2}]}if(B.type==="regressionchannel"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="stddevchannel"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}if(B.type==="disjointchannel"&&B.p1&&B.p2&&B.p3&&B.p4){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price),I=b.timeScale().timeToCoordinate(B.p3.rawTime),E=m.priceToCoordinate(B.p3.price),_=b.timeScale().timeToCoordinate(B.p4.rawTime),H=m.priceToCoordinate(B.p4.price);return T==null||U==null||g==null||u==null||I==null||E==null||_==null||H==null?[]:[{x:T,y:U},{x:g,y:u},{x:I,y:E},{x:_,y:H}]}if(B.type==="flattopbottom"&&B.p1&&B.p2&&B.p3&&B.p4){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price),I=b.timeScale().timeToCoordinate(B.p3.rawTime),E=m.priceToCoordinate(B.p3.price),_=b.timeScale().timeToCoordinate(B.p4.rawTime),H=m.priceToCoordinate(B.p4.price);return T==null||U==null||g==null||u==null||I==null||E==null||_==null||H==null?[]:[{x:T,y:U},{x:g,y:u},{x:I,y:E},{x:_,y:H}]}if(B.type==="infoline"&&B.p1&&B.p2){const T=B.p1.rawTime??B.p1.time,U=B.p2.rawTime??B.p2.time,g=b.timeScale().timeToCoordinate(T),u=m.priceToCoordinate(B.p1.price),I=b.timeScale().timeToCoordinate(U),E=m.priceToCoordinate(B.p2.price);return g==null||u==null||I==null||E==null?[]:[{x:g,y:u},{x:I,y:E}]}if(B.type==="rulerline"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:(T+g)/2,y:(U+u)/2},{x:g,y:u}]}if(B.type==="fibonacci"&&B.p1&&B.p2){const T=b.timeScale().timeToCoordinate(B.p1.rawTime),U=m.priceToCoordinate(B.p1.price),g=b.timeScale().timeToCoordinate(B.p2.rawTime),u=m.priceToCoordinate(B.p2.price);return T==null||U==null||g==null||u==null?[]:[{x:T,y:U},{x:g,y:u}]}return[]}function ie(B,T){for(let U=_e.length-1;U>=0;U--){const g=_e[U];if(g.type==="trendline"&&g.point1&&g.point2){const u=b.timeScale().timeToCoordinate(g.point1.time),I=m.priceToCoordinate(g.point1.price),E=b.timeScale().timeToCoordinate(g.point2.time),_=m.priceToCoordinate(g.point2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(B-u,T-I),f=Math.hypot(B-E,T-_);if(H<Q)return{object:g,mode:"handle1"};if(f<Q)return{object:g,mode:"handle2"};if(qe(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="gannline"&&g.point1&&g.point2){const u=b.timeScale().timeToCoordinate(g.point1.time),I=m.priceToCoordinate(g.point1.price),E=b.timeScale().timeToCoordinate(g.point2.time),_=m.priceToCoordinate(g.point2.price);if(u==null||I==null||E==null||_==null)continue;const H=(u+E)/2,f=(I+_)/2,L=Math.hypot(B-u,T-I),D=Math.hypot(B-E,T-_),O=Math.hypot(B-H,T-f);if(L<Q)return{object:g,mode:"handle1"};if(D<Q)return{object:g,mode:"handle2"};if(O<Q)return{object:g,mode:"line"};if(qe(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="rectangle"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.min(u,E),f=Math.max(u,E),L=Math.min(I,_),D=Math.max(I,_),O=(H+f)/2,K=(L+D)/2,z=[{x:H,y:L,mode:"handle1"},{x:O,y:L,mode:"handle2"},{x:f,y:L,mode:"handle3"},{x:H,y:K,mode:"handle4"},{x:f,y:K,mode:"handle5"},{x:H,y:D,mode:"handle6"},{x:O,y:D,mode:"handle7"},{x:f,y:D,mode:"handle8"}];for(const He of z)if(Math.hypot(B-He.x,T-He.y)<Q)return{object:g,mode:He.mode};const $=qe(B,T,H,L,f,L),te=qe(B,T,H,D,f,D),he=qe(B,T,H,L,H,D),pe=qe(B,T,f,L,f,D);if($<q||te<q||he<q||pe<q||Nt(B,T,[{x:H,y:L},{x:f,y:L},{x:f,y:D},{x:H,y:D}]))return{object:g,mode:"line"}}if(g.type==="circle"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(E-u,_-I);if(H<2)continue;const f=Math.hypot(B-u,T-I),L=Math.hypot(B-E,T-_);if(f<Q)return{object:g,mode:"handle1"};if(L<Q)return{object:g,mode:"handle2"};if(Math.abs(f-H)<q||f<H)return{object:g,mode:"line"}}if(g.type==="triangle"&&g.p1&&g.p2&&g.p3){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),f=m.priceToCoordinate(g.p3.price);if(u==null||I==null||E==null||_==null||H==null||f==null)continue;const L=Math.hypot(B-u,T-I),D=Math.hypot(B-E,T-_),O=Math.hypot(B-H,T-f);if(L<Q)return{object:g,mode:"handle1"};if(D<Q)return{object:g,mode:"handle2"};if(O<Q)return{object:g,mode:"handle3"};const K=qe(B,T,u,I,E,_),z=qe(B,T,E,_,H,f),$=qe(B,T,H,f,u,I);if(K<q||z<q||$<q||Nt(B,T,[{x:u,y:I},{x:E,y:_},{x:H,y:f}]))return{object:g,mode:"line"}}if(g.type==="ellipse"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=(u+E)/2,f=(I+_)/2,L=E-u,D=_-I,O=Math.hypot(L,D);if(O<2)continue;const K=L/O,z=D/O,$=-z,te=K,he=O/2,pe=he*Math.max(.05,g.minorRatio??.45);if(he<2||pe<2)continue;const He=H-K*he,Ne=f-z*he,Ge=H+$*pe,Ve=f+te*pe,nA=H+K*he,eA=f+z*he,pA=H-$*pe,QA=f-te*pe,WA=Math.hypot(B-He,T-Ne),_A=Math.hypot(B-Ge,T-Ve),zA=Math.hypot(B-nA,T-eA),wt=Math.hypot(B-pA,T-QA);if(WA<Q)return{object:g,mode:"handle1"};if(_A<Q)return{object:g,mode:"handle2"};if(zA<Q)return{object:g,mode:"handle3"};if(wt<Q)return{object:g,mode:"handle4"};const tr=(B-H)*K+(T-f)*z,rs=(B-H)*$+(T-f)*te,bd=tr/he,Td=rs/pe,Qd=bd*bd+Td*Td;if(Math.abs(Qd-1)<.2||Qd<1)return{object:g,mode:"line"}}if(g.type==="gannfan"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(B-E,T-_),f=Math.hypot(B-u,T-I);if(H<Q)return{object:g,mode:"handle2"};if(f<Q)return{object:g,mode:"handle1"};if(qe(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="ganngrid"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(B-E,T-_),f=Math.hypot(B-u,T-I);if(H<Q)return{object:g,mode:"handle2"};if(f<Q)return{object:g,mode:"handle1"};if(qe(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="arrowedline"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(B-u,T-I),f=Math.hypot(B-E,T-_);if(H<Q)return{object:g,mode:"handle1"};if(f<Q)return{object:g,mode:"handle2"};if(qe(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="rayline"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(B-u,T-I),f=Math.hypot(B-E,T-_);if(H<Q)return{object:g,mode:"handle1"};if(f<Q)return{object:g,mode:"handle2"};if(Mv(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="extendedline"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(B-u,T-I),f=Math.hypot(B-E,T-_);if(H<Q)return{object:g,mode:"handle1"};if(f<Q)return{object:g,mode:"handle2"};if(Iv(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="crossline"&&g.p){const u=b.timeScale().timeToCoordinate(g.p.rawTime),I=m.priceToCoordinate(g.p.price);if(u==null||I==null)continue;if(Math.hypot(B-u,T-I)<Q)return{object:g,mode:"handle1"};const _=Math.abs(T-I),H=Math.abs(B-u);if(_<q||H<q)return{object:g,mode:"line"}}if(g.type==="trendbyangle"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(B-u,T-I),f=Math.hypot(B-E,T-_);if(H<Q)return{object:g,mode:"handle1"};if(f<Q)return{object:g,mode:"handle2"};if(qe(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="equidistantchannel"&&g.p1&&g.p2&&g.b1&&g.b2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.b1.rawTime),f=m.priceToCoordinate(g.b1.price),L=b.timeScale().timeToCoordinate(g.b2.rawTime),D=m.priceToCoordinate(g.b2.price),O=H!=null&&L!=null?(H+L)/2:null,K=f!=null&&D!=null?(f+D)/2:null;if(u==null||I==null||E==null||_==null||O==null||K==null||H==null||f==null||L==null||D==null)continue;const z=Math.hypot(B-u,T-I),$=Math.hypot(B-E,T-_),te=Math.hypot(B-O,T-K),he=Math.hypot(u-O,I-K)<Q*1.5;if(he&&Math.min(z,te)<Q*1.5)return{object:g,mode:"handle3"};if(te<Q)return{object:g,mode:"handle3"};if($<Q)return{object:g,mode:"handle2"};if(he)continue;if(z<Q)return{object:g,mode:"handle1"};const pe=qe(B,T,u,I,E,_),He=qe(B,T,H,f,L,D);if(pe<q||He<q||Nt(B,T,[{x:u,y:I},{x:E,y:_},{x:L,y:D},{x:H,y:f}]))return{object:g,mode:"line"}}if(g.type==="regressionchannel"&&g.p1&&g.p2&&g.top1&&g.top2&&g.bot1&&g.bot2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.top1.rawTime),f=m.priceToCoordinate(g.top1.price),L=b.timeScale().timeToCoordinate(g.top2.rawTime),D=m.priceToCoordinate(g.top2.price),O=b.timeScale().timeToCoordinate(g.bot1.rawTime),K=m.priceToCoordinate(g.bot1.price),z=b.timeScale().timeToCoordinate(g.bot2.rawTime),$=m.priceToCoordinate(g.bot2.price);if(u==null||I==null||E==null||_==null||H==null||f==null||L==null||D==null||O==null||K==null||z==null||$==null)continue;const te=Math.hypot(B-u,T-I),he=Math.hypot(B-E,T-_);if(te<Q)return{object:g,mode:"handle1"};if(he<Q)return{object:g,mode:"handle2"};const pe=qe(B,T,u,I,E,_),He=qe(B,T,H,f,L,D),Ne=qe(B,T,O,K,z,$);if(pe<q||He<q||Ne<q||Nt(B,T,[{x:H,y:f},{x:L,y:D},{x:z,y:$},{x:O,y:K}]))return{object:g,mode:"line"}}if(g.type==="stddevchannel"&&g.p1&&g.p2&&g.top1&&g.top2&&g.bot1&&g.bot2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.top1.rawTime),f=m.priceToCoordinate(g.top1.price),L=b.timeScale().timeToCoordinate(g.top2.rawTime),D=m.priceToCoordinate(g.top2.price),O=b.timeScale().timeToCoordinate(g.bot1.rawTime),K=m.priceToCoordinate(g.bot1.price),z=b.timeScale().timeToCoordinate(g.bot2.rawTime),$=m.priceToCoordinate(g.bot2.price);if(u==null||I==null||E==null||_==null||H==null||f==null||L==null||D==null||O==null||K==null||z==null||$==null)continue;const te=Math.hypot(B-u,T-I),he=Math.hypot(B-E,T-_);if(te<Q)return{object:g,mode:"handle1"};if(he<Q)return{object:g,mode:"handle2"};const pe=qe(B,T,u,I,E,_),He=qe(B,T,H,f,L,D),Ne=qe(B,T,O,K,z,$);if(pe<q||He<q||Ne<q||Nt(B,T,[{x:H,y:f},{x:L,y:D},{x:z,y:$},{x:O,y:K}]))return{object:g,mode:"line"}}if(g.type==="andrewspitchfork"&&g.p1&&g.p2&&g.p3){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),f=m.priceToCoordinate(g.p3.price);if(u==null||I==null||E==null||_==null||H==null||f==null)continue;const L=Math.hypot(B-u,T-I),D=Math.hypot(B-E,T-_),O=Math.hypot(B-H,T-f);if(L<Q)return{object:g,mode:"handle1"};if(D<Q)return{object:g,mode:"handle2"};if(O<Q)return{object:g,mode:"handle3"};const K=(E+H)/2,z=(_+f)/2;let $=K-u,te=z-I;Math.abs($)<1e-4&&($=1e-4);const he=te/$,pe=R.clientWidth,He=_+he*(pe-E),Ne=f+he*(pe-H),Ge=qe(B,T,E,_,pe,He),Ve=qe(B,T,H,f,pe,Ne);if(Ge<q||Ve<q||Nt(B,T,[{x:E,y:_},{x:pe,y:He},{x:pe,y:Ne},{x:H,y:f}]))return{object:g,mode:"line"}}if(g.type==="disjointchannel"&&g.p1&&g.p2&&g.p3&&g.p4){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),f=m.priceToCoordinate(g.p3.price),L=b.timeScale().timeToCoordinate(g.p4.rawTime),D=m.priceToCoordinate(g.p4.price);if(u==null||I==null||E==null||_==null||H==null||f==null||L==null||D==null)continue;const O=Math.hypot(B-u,T-I),K=Math.hypot(B-E,T-_),z=Math.hypot(B-H,T-f),$=Math.hypot(B-L,T-D);if(O<Q)return{object:g,mode:"handle1"};if(K<Q)return{object:g,mode:"handle2"};if(z<Q)return{object:g,mode:"handle3"};if($<Q)return{object:g,mode:"handle4"};const te=qe(B,T,u,I,H,f),he=qe(B,T,E,_,L,D),pe=qe(B,T,u,I,E,_),He=qe(B,T,H,f,L,D);if(te<q||he<q||pe<q||He<q||Nt(B,T,[{x:u,y:I},{x:H,y:f},{x:L,y:D},{x:E,y:_}]))return{object:g,mode:"line"}}if(g.type==="flattopbottom"&&g.p1&&g.p2&&g.p3&&g.p4){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),f=m.priceToCoordinate(g.p3.price),L=b.timeScale().timeToCoordinate(g.p4.rawTime),D=m.priceToCoordinate(g.p4.price);if(u==null||I==null||E==null||_==null||H==null||f==null||L==null||D==null)continue;const O=Math.hypot(B-u,T-I),K=Math.hypot(B-E,T-_),z=Math.hypot(B-H,T-f),$=Math.hypot(B-L,T-D);if(O<Q)return{object:g,mode:"handle1"};if(K<Q)return{object:g,mode:"handle2"};if(z<Q)return{object:g,mode:"handle3"};if($<Q)return{object:g,mode:"handle4"};const te=qe(B,T,u,I,H,f),he=qe(B,T,E,_,L,D),pe=qe(B,T,u,I,E,_),He=qe(B,T,H,f,L,D);if(te<q||he<q||pe<q||He<q||Nt(B,T,[{x:u,y:I},{x:H,y:f},{x:L,y:D},{x:E,y:_}]))return{object:g,mode:"line"}}if(g.type==="rulerline"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=(u+E)/2,f=(I+_)/2,L=Math.hypot(B-u,T-I),D=Math.hypot(B-E,T-_),O=Math.hypot(B-H,T-f);if(L<Q)return{object:g,mode:"handle1"};if(D<Q)return{object:g,mode:"handle2"};if(O<Q)return{object:g,mode:"line"};if(qe(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}if(g.type==="infoline"&&g.p1&&g.p2){const u=g.p1.rawTime??g.p1.time,I=g.p2.rawTime??g.p2.time,E=b.timeScale().timeToCoordinate(u),_=m.priceToCoordinate(g.p1.price),H=b.timeScale().timeToCoordinate(I),f=m.priceToCoordinate(g.p2.price);if(E==null||_==null||H==null||f==null)continue;const L=Math.hypot(B-E,T-_),D=Math.hypot(B-H,T-f);if(L<Q)return{object:g,mode:"handle1"};if(D<Q)return{object:g,mode:"handle2"};if(qe(B,T,E,_,H,f)<q)return{object:g,mode:"line"}}if(g.type==="fibonacci"&&g.p1&&g.p2){const u=b.timeScale().timeToCoordinate(g.p1.rawTime),I=m.priceToCoordinate(g.p1.price),E=b.timeScale().timeToCoordinate(g.p2.rawTime),_=m.priceToCoordinate(g.p2.price);if(u==null||I==null||E==null||_==null)continue;const H=Math.hypot(B-u,T-I),f=Math.hypot(B-E,T-_);if(H<Q)return{object:g,mode:"handle1"};if(f<Q)return{object:g,mode:"handle2"};if(qe(B,T,u,I,E,_)<q)return{object:g,mode:"line"}}}return null}const ce=B=>{const T=R.getBoundingClientRect(),U=B.clientX-T.left,g=B.clientY-T.top,u=ie(U,g);u?(B.preventDefault(),B.stopPropagation(),x(u.object),X(null),ae([]),G.current=u.mode,u.object.type==="rayline"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="extendedline"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="crossline"&&(u.mode==="handle1"||u.mode==="line")&&(ee.current={x:U,y:g,p:{...u.object.p}}),u.object.type==="trendbyangle"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="equidistantchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="andrewspitchfork"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="regressionchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="stddevchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="disjointchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="flattopbottom"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="fibonacci"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="gannfan"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="ganngrid"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="rectangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4"||u.mode==="handle5"||u.mode==="handle6"||u.mode==="handle7"||u.mode==="handle8")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="circle"&&(u.mode==="handle1"||u.mode==="handle2")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="triangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="ellipse"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}),u.mode==="line"&&(u.object.type==="rulerline"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="infoline"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="arrowedline"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rayline"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="extendedline"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="crossline"?ee.current={x:U,y:g,p:{...u.object.p}}:u.object.type==="trendbyangle"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="equidistantchannel"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="andrewspitchfork"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="regressionchannel"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="stddevchannel"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="disjointchannel"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="flattopbottom"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="fibonacci"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="gannfan"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rectangle"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="circle"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="triangle"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="ellipse"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}:u.object.type==="ganngrid"?ee.current={x:U,y:g,p1:{...u.object.p1},p2:{...u.object.p2}}:ee.current={x:U,y:g,point1:{...u.object.point1},point2:{...u.object.point2}})):(x(null),G.current=null,N([]),X(null),ae([]))},M=B=>{const T=R.getBoundingClientRect(),U=B.clientX-T.left,g=B.clientY-T.top;if(!G.current){const H=ie(U,g);if(H?.object&&!oe.current){const f=se(H.object);X(L=>L===H.object?L:H.object),ae(L=>L.length===f.length&&L.every((D,O)=>D.x===f[O].x&&D.y===f[O].y)?L:f)}else X(f=>f==null?f:null),ae(f=>f.length===0?f:[]);return}const u=oe.current;if(!u)return;const I=b.timeScale().coordinateToTime(U),E=m.coordinateToPrice(g);if(I==null||E==null)return;let _=Y(I);if(_!=null){if(u.type==="infoline"&&u.p1&&u.p2){const H=O=>{const K=O.rawTime??O.time,z=O.normalizedTime??Y(K);return{rawTime:K,normalizedTime:z,price:O.price}},f=(O,K)=>{const z=O.normalizedTime??Y(O.rawTime),$=K.normalizedTime??Y(K.rawTime);if(z==null||$==null)return;const te=K.price-O.price,he=te/Math.abs(O.price)*100,pe=it(Te)||3600,He=Math.abs($-z),Ne=Math.max(1,Math.round(He/pe)),Ge=Math.max(1,Math.round(He/86400)),Ve=b.timeScale().timeToCoordinate(O.rawTime),nA=m.priceToCoordinate(O.price),eA=b.timeScale().timeToCoordinate(K.rawTime),pA=m.priceToCoordinate(K.price),QA=Ve!=null&&nA!=null&&eA!=null&&pA!=null?Math.atan2(-(pA-nA),eA-Ve)*(180/Math.PI):u.primitive?.info?.angle??0,WA={priceDiff:te,pricePct:he,bars:Ne,days:Ge,angle:QA},_A=u.primitive;if(_A){_A.p1={rawTime:O.rawTime,price:O.price},_A.p2={rawTime:K.rawTime,price:K.price},_A.info=WA;try{a.current?.applyOptions({})}catch{}}const zA={...u,p1:{rawTime:O.rawTime,normalizedTime:z,price:O.price},p2:{rawTime:K.rawTime,normalizedTime:$,price:K.price}};Be(wt=>{const tr=wt.map(rs=>rs===u?zA:rs);return p.current=tr,tr}),x(zA),oe.current=zA},L=H(u.p1),D=H(u.p2);if(L.rawTime==null||L.normalizedTime==null||D.rawTime==null||D.normalizedTime==null)return;if(G.current==="handle1"){const O=b.timeScale().coordinateToTime(U);if(O==null)return;f({rawTime:O,normalizedTime:_,price:E},D)}else if(G.current==="handle2"){const O=b.timeScale().coordinateToTime(U);if(O==null)return;f(L,{rawTime:O,normalizedTime:_,price:E})}else if(G.current==="line"){const O=ee.current;if(!O)return;const K=H(O.p1),z=H(O.p2);if(K.rawTime==null||K.normalizedTime==null||z.rawTime==null||z.normalizedTime==null)return;const $=b.timeScale().coordinateToTime(O.x),te=m.coordinateToPrice(O.y);if($==null||te==null)return;const he=Y($);if(he==null)return;const pe=_-he,He=E-te,Ne=Y(K.normalizedTime+pe),Ge=Y(z.normalizedTime+pe);if(Ne==null||Ge==null)return;const Ve=I-$;f({rawTime:K.rawTime+Ve,normalizedTime:Ne,price:K.price+He},{rawTime:z.rawTime+Ve,normalizedTime:Ge,price:z.price+He})}return}if(u.type==="rulerline"&&u.p1&&u.p2){const H=(f,L)=>{const D=f.normalizedTime??f.rawTime,O=L.normalizedTime??L.rawTime,K=L.price-f.price,z=K/Math.abs(f.price)*100,$=it(Te)||3600,te=Math.abs(O-D),he=Math.max(1,Math.round(te/$)),pe=Math.max(1,Math.round(te/86400)),He={priceDiff:K,pricePct:z,bars:he,days:pe},Ne=u.primitive;if(Ne){Ne.p1={rawTime:f.rawTime,price:f.price},Ne.p2={rawTime:L.rawTime,price:L.price},Ne.info=He;const Ve=L.price>=f.price;Ne.color=Ve?"#3b82f6":"#ef5350",Ne.fillColor=Ve?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{a.current?.applyOptions({})}catch{}}const Ge={...u,p1:f,p2:L};Be(Ve=>{const nA=Ve.map(eA=>eA===u?Ge:eA);return p.current=nA,nA}),x(Ge),oe.current=Ge};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2)}else if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_,price:E})}else if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K})}return}if(u.type==="arrowedline"&&u.p1&&u.p2){const H=(f,L)=>{const D=u.primitive;if(D){D.p1={rawTime:f.rawTime,price:f.price},D.p2={rawTime:L.rawTime,price:L.price};try{a.current?.applyOptions({})}catch{}}const O={...u,p1:f,p2:L};Be(K=>{const z=K.map($=>$===u?O:$);return p.current=z,z}),x(O),oe.current=O};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2)}else if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_,price:E})}else if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K})}return}if(u.type==="rayline"&&u.p1&&u.p2){const H=(f,L)=>{const D=u.primitive;if(D){D.p1={rawTime:f.rawTime,price:f.price},D.p2={rawTime:L.rawTime,price:L.price};try{a.current?.applyOptions({})}catch{}}const O={...u,p1:f,p2:L};Be(K=>{const z=K.map($=>$===u?O:$);return p.current=z,z}),x(O),oe.current=O};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2)}else if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;const L=Y(f);if(L==null)return;H(u.p1,{rawTime:f,normalizedTime:L,price:E})}else if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K})}return}if(u.type==="extendedline"&&u.p1&&u.p2){const H=(f,L)=>{const D=u.primitive;if(D){D.p1={rawTime:f.rawTime,price:f.price},D.p2={rawTime:L.rawTime,price:L.price};try{a.current?.applyOptions({})}catch{}}const O={...u,p1:f,p2:L};Be(K=>{const z=K.map($=>$===u?O:$);return p.current=z,z}),x(O),oe.current=O};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2)}else if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_,price:E})}else if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K})}return}if(u.type==="crossline"&&u.p){const H=L=>{const D=u.primitive;if(D){D.center={rawTime:L.rawTime,price:L.price};try{a.current?.applyOptions({})}catch{}}const O={...u,p:L};Be(K=>{const z=K.map($=>$===u?O:$);return p.current=z,z}),x(O),oe.current=O},f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E});return}if(u.type==="trendbyangle"&&u.p1&&u.p2){const H=(f,L)=>{const D=u.primitive;if(D){D.p1={rawTime:f.rawTime,price:f.price},D.p2={rawTime:L.rawTime,price:L.price};try{a.current?.applyOptions({})}catch{}}const O={...u,p1:f,p2:L};Be(K=>{const z=K.map($=>$===u?O:$);return p.current=z,z}),x(O),oe.current=O};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2)}else if(G.current==="handle2"||G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K})}return}if(u.type==="equidistantchannel"&&u.p1&&u.p2&&u.p3){const H=(f,L,D)=>{const O=fd(f,L,D);if(!O)return;const K=u.primitive;if(K){K.p1={rawTime:f.rawTime,price:f.price},K.p2={rawTime:L.rawTime,price:L.price},K.b1={rawTime:O.b1.rawTime,price:O.b1.price},K.b2={rawTime:O.b2.rawTime,price:O.b2.price},K.p3={rawTime:O.bottomMid.rawTime,price:O.bottomMid.price};try{a.current?.applyOptions({})}catch{}}const z={...u,p1:f,p2:L,p3:O.bottomMid,b1:O.b1,b2:O.b2,bottomMid:O.bottomMid};Be($=>{const te=$.map(he=>he===u?z:he);return p.current=te,te}),x(z),oe.current=z};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2,u.p3);return}if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_,price:E},u.p3);return}if(G.current==="handle3"){H(u.p1,u.p2,{rawTime:u.p3.rawTime,normalizedTime:u.p3.normalizedTime??Y(u.p3.rawTime),price:E});return}if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O),te=Y(f.p3.normalizedTime+O);if(z==null||$==null||te==null)return;const he=I-L;H({rawTime:f.p1.rawTime+he,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+he,normalizedTime:$,price:f.p2.price+K},{rawTime:f.p3.rawTime+he,normalizedTime:te,price:f.p3.price+K});return}}if(u.type==="regressionchannel"&&u.p1&&u.p2){const H=(f,L)=>{const D=es(ne,f,L,u.stdMultiplier??1);if(!D)return;const O=u.primitive;if(O){O.mid1={rawTime:D.p1.rawTime,price:D.p1.price},O.mid2={rawTime:D.p2.rawTime,price:D.p2.price},O.top1={rawTime:D.top1.rawTime,price:D.top1.price},O.top2={rawTime:D.top2.rawTime,price:D.top2.price},O.bot1={rawTime:D.bot1.rawTime,price:D.bot1.price},O.bot2={rawTime:D.bot2.rawTime,price:D.bot2.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:D.p1,p2:D.p2,top1:D.top1,top2:D.top2,bot1:D.bot1,bot2:D.bot2,slope:D.slope,intercept:D.intercept,stdDev:D.stdDev,offset:D.offset,barCount:D.barCount};Be(z=>{const $=z.map(te=>te===u?K:te);return p.current=$,$}),x(K),oe.current=K};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_},u.p2);return}if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_});return}if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K});return}}if(u.type==="stddevchannel"&&u.p1&&u.p2){const H=(f,L)=>{const D=ga(ne,f,L,u.stdMultiplier??1);if(!D)return;const O=u.primitive;if(O){O.mid1={rawTime:D.p1.rawTime,price:D.p1.price},O.mid2={rawTime:D.p2.rawTime,price:D.p2.price},O.top1={rawTime:D.top1.rawTime,price:D.top1.price},O.top2={rawTime:D.top2.rawTime,price:D.top2.price},O.bot1={rawTime:D.bot1.rawTime,price:D.bot1.price},O.bot2={rawTime:D.bot2.rawTime,price:D.bot2.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:D.p1,p2:D.p2,top1:D.top1,top2:D.top2,bot1:D.bot1,bot2:D.bot2,slope:D.slope,stdDev:D.stdDev,offset:D.offset,barCount:D.barCount};Be(z=>{const $=z.map(te=>te===u?K:te);return p.current=$,$}),x(K),oe.current=K};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_},u.p2);return}if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_});return}if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K});return}}if(u.type==="andrewspitchfork"&&u.p1&&u.p2&&u.p3){const H=(f,L,D)=>{const O=u.primitive;if(O){O.p1={rawTime:f.rawTime,price:f.price},O.p2={rawTime:L.rawTime,price:L.price},O.p3={rawTime:D.rawTime,price:D.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:f,p2:L,p3:D};Be(z=>{const $=z.map(te=>te===u?K:te);return p.current=$,$}),x(K),oe.current=K};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2,u.p3);return}if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_,price:E},u.p3);return}if(G.current==="handle3"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,u.p2,{rawTime:f,normalizedTime:_,price:E});return}if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O),te=Y(f.p3.normalizedTime+O);if(z==null||$==null||te==null)return;const he=I-L;H({rawTime:f.p1.rawTime+he,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+he,normalizedTime:$,price:f.p2.price+K},{rawTime:f.p3.rawTime+he,normalizedTime:te,price:f.p3.price+K});return}}if(u.type==="disjointchannel"&&u.p1&&u.p2&&u.p3&&u.p4){const H=(K,z,$,te)=>{const he=u.primitive;if(he){he.p1={rawTime:K.rawTime,price:K.price},he.p2={rawTime:z.rawTime,price:z.price},he.p3={rawTime:$.rawTime,price:$.price},he.p4={rawTime:te.rawTime,price:te.price};try{a.current?.applyOptions({})}catch{}}const pe={...u,p1:K,p2:z,p3:$,p4:te};Be(He=>{const Ne=He.map(Ge=>Ge===u?pe:Ge);return p.current=Ne,Ne}),x(pe),oe.current=pe},f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(U);if(L==null)return;const D=Y(L);if(D==null)return;const O=(K,z,$,te)=>{const he=K.normalizedTime??Y(K.rawTime);if(he==null)return null;const pe=Y(he+$);return pe==null?null:{rawTime:K.rawTime+z,normalizedTime:pe,price:K.price+te}};if(G.current==="line"){const K=b.timeScale().coordinateToTime(f.x),z=m.coordinateToPrice(f.y);if(K==null||z==null)return;const $=Y(K);if($==null)return;const te=L-K,he=D-$,pe=E-z,He=O(f.p1,te,he,pe),Ne=O(f.p2,te,he,pe),Ge=O(f.p3,te,he,pe),Ve=O(f.p4,te,he,pe);if(!He||!Ne||!Ge||!Ve)return;H(He,Ne,Ge,Ve);return}if(G.current==="handle1"){const K=(f.p1.price+f.p2.price)/2,z={rawTime:L,normalizedTime:D,price:E},$={rawTime:L,normalizedTime:D,price:2*K-E};H(z,$,f.p3,f.p4);return}if(G.current==="handle3"){const K=(f.p3.price+f.p4.price)/2,z={rawTime:L,normalizedTime:D,price:E},$={rawTime:L,normalizedTime:D,price:2*K-E};H(f.p1,f.p2,z,$);return}if(G.current==="handle2"){const K=(f.p1.price+f.p2.price)/2,z={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??Y(f.p1.rawTime),price:E};if(z.normalizedTime==null)return;const $={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??Y(f.p1.rawTime),price:2*K-E};if($.normalizedTime==null)return;H($,z,f.p3,f.p4);return}if(G.current==="handle4"){const K=E-f.p4.price,z={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??Y(f.p3.rawTime),price:f.p4.price+K};if(z.normalizedTime==null)return;const $={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??Y(f.p1.rawTime),price:f.p2.price+K};if($.normalizedTime==null)return;H(f.p1,$,f.p3,z);return}}if(u.type==="flattopbottom"&&u.p1&&u.p2&&u.p3&&u.p4){const H=(K,z,$,te)=>{const he=u.primitive;if(he){he.p1={rawTime:K.rawTime,price:K.price},he.p2={rawTime:z.rawTime,price:z.price},he.p3={rawTime:$.rawTime,price:$.price},he.p4={rawTime:te.rawTime,price:te.price};try{a.current?.applyOptions({})}catch{}}const pe={...u,p1:K,p2:z,p3:$,p4:te};Be(He=>{const Ne=He.map(Ge=>Ge===u?pe:Ge);return p.current=Ne,Ne}),x(pe),oe.current=pe},f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(U);if(L==null)return;const D=Y(L);if(D==null)return;const O=(K,z,$,te)=>{const he=K.normalizedTime??Y(K.rawTime);if(he==null)return null;const pe=Y(he+$);return pe==null?null:{rawTime:K.rawTime+z,normalizedTime:pe,price:K.price+te}};if(G.current==="line"){const K=b.timeScale().coordinateToTime(f.x),z=m.coordinateToPrice(f.y);if(K==null||z==null)return;const $=Y(K);if($==null)return;const te=L-K,he=D-$,pe=E-z,He=O(f.p1,te,he,pe),Ne=O(f.p2,te,he,pe),Ge=O(f.p3,te,he,pe),Ve=O(f.p4,te,he,pe);if(!He||!Ne||!Ge||!Ve)return;H(He,Ne,Ge,Ve);return}if(G.current==="handle1"){const K={rawTime:L,normalizedTime:D,price:E},z={rawTime:L,normalizedTime:D,price:f.p2.price};H(K,z,f.p3,f.p4);return}if(G.current==="handle3"){const K={rawTime:L,normalizedTime:D,price:E},z={rawTime:L,normalizedTime:D,price:f.p4.price};H(f.p1,f.p2,K,z);return}if(G.current==="handle2"||G.current==="handle4"){const K=G.current==="handle2"?f.p2:f.p4,z=E-K.price,$={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??Y(f.p1.rawTime),price:f.p2.price+z},te={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??Y(f.p3.rawTime),price:f.p4.price+z};if($.normalizedTime==null||te.normalizedTime==null)return;H(f.p1,$,f.p3,te);return}}if(u.type==="fibonacci"&&u.p1&&u.p2){const H=(f,L)=>{const D=u.primitive;if(D){D.p1={rawTime:f.rawTime,price:f.price},D.p2={rawTime:L.rawTime,price:L.price};try{a.current?.applyOptions({})}catch{}}const O={...u,p1:f,p2:L};Be(K=>{const z=K.map($=>$===u?O:$);return p.current=z,z}),x(O),oe.current=O};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2)}else if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_,price:E})}else if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K})}return}if(u.type==="rectangle"&&u.p1&&u.p2){const H=(eA,pA)=>{const QA=u.primitive;if(QA){QA.p1={rawTime:eA.rawTime,price:eA.price},QA.p2={rawTime:pA.rawTime,price:pA.price};try{a.current?.applyOptions({})}catch{}}const WA={...u,p1:eA,p2:pA};Be(_A=>{const zA=_A.map(wt=>wt===u?WA:wt);return p.current=zA,zA}),x(WA),oe.current=WA},f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(U);if(L==null)return;const D=Y(L);if(D==null)return;if(G.current==="line"){const eA=b.timeScale().coordinateToTime(f.x),pA=m.coordinateToPrice(f.y);if(eA==null||pA==null)return;const QA=Y(eA);if(QA==null)return;const WA=D-QA,_A=E-pA,zA=Y(f.p1.normalizedTime+WA),wt=Y(f.p2.normalizedTime+WA);if(zA==null||wt==null)return;const tr=I-eA;H({rawTime:f.p1.rawTime+tr,normalizedTime:zA,price:f.p1.price+_A},{rawTime:f.p2.rawTime+tr,normalizedTime:wt,price:f.p2.price+_A});return}const O=Math.min(f.p1.normalizedTime,f.p2.normalizedTime),K=Math.max(f.p1.normalizedTime,f.p2.normalizedTime),z=Math.max(f.p1.price,f.p2.price),$=Math.min(f.p1.price,f.p2.price),te=f.p1.normalizedTime<=f.p2.normalizedTime?f.p1.rawTime:f.p2.rawTime,he=f.p1.normalizedTime<=f.p2.normalizedTime?f.p2.rawTime:f.p1.rawTime;let pe=O,He=K,Ne=z,Ge=$,Ve=te,nA=he;if((G.current==="handle1"||G.current==="handle4"||G.current==="handle6")&&(pe=D,Ve=L),(G.current==="handle3"||G.current==="handle5"||G.current==="handle8")&&(He=D,nA=L),(G.current==="handle1"||G.current==="handle2"||G.current==="handle3")&&(Ne=E),(G.current==="handle6"||G.current==="handle7"||G.current==="handle8")&&(Ge=E),pe>He){const eA=pe,pA=Ve;pe=He,Ve=nA,He=eA,nA=pA}if(Ne<Ge){const eA=Ne;Ne=Ge,Ge=eA}H({rawTime:Ve,normalizedTime:pe,price:Ne},{rawTime:nA,normalizedTime:He,price:Ge});return}if(u.type==="circle"&&u.p1&&u.p2){const H=(Ne,Ge)=>{const Ve=u.primitive;if(Ve){Ve.p1={rawTime:Ne.rawTime,price:Ne.price},Ve.p2={rawTime:Ge.rawTime,price:Ge.price};try{a.current?.applyOptions({})}catch{}}const nA={...u,p1:Ne,p2:Ge};Be(eA=>{const pA=eA.map(QA=>QA===u?nA:QA);return p.current=pA,pA}),x(nA),oe.current=nA},f=b.timeScale().coordinateToTime(U);if(f==null)return;const L=Y(f);if(L==null)return;if(G.current==="handle2"){H(u.p1,{rawTime:f,normalizedTime:L,price:E});return}const D=ee.current;if(!D)return;const O=b.timeScale().coordinateToTime(D.x),K=m.coordinateToPrice(D.y);if(O==null||K==null)return;const z=Y(O);if(z==null)return;const $=L-z,te=E-K,he=Y(D.p1.normalizedTime+$),pe=Y(D.p2.normalizedTime+$);if(he==null||pe==null)return;const He=I-O;H({rawTime:D.p1.rawTime+He,normalizedTime:he,price:D.p1.price+te},{rawTime:D.p2.rawTime+He,normalizedTime:pe,price:D.p2.price+te});return}if(u.type==="triangle"&&u.p1&&u.p2&&u.p3){const H=(Ve,nA,eA)=>{const pA=u.primitive;if(pA){pA.p1={rawTime:Ve.rawTime,price:Ve.price},pA.p2={rawTime:nA.rawTime,price:nA.price},pA.p3={rawTime:eA.rawTime,price:eA.price};try{a.current?.applyOptions({})}catch{}}const QA={...u,p1:Ve,p2:nA,p3:eA};Be(WA=>{const _A=WA.map(zA=>zA===u?QA:zA);return p.current=_A,_A}),x(QA),oe.current=QA},f=b.timeScale().coordinateToTime(U);if(f==null)return;const L=Y(f);if(L==null)return;if(G.current==="handle1"){H({rawTime:f,normalizedTime:L,price:E},u.p2,u.p3);return}if(G.current==="handle2"){H(u.p1,{rawTime:f,normalizedTime:L,price:E},u.p3);return}if(G.current==="handle3"){H(u.p1,u.p2,{rawTime:f,normalizedTime:L,price:E});return}const D=ee.current;if(!D)return;const O=b.timeScale().coordinateToTime(D.x),K=m.coordinateToPrice(D.y);if(O==null||K==null)return;const z=Y(O);if(z==null)return;const $=L-z,te=E-K,he=I-O,pe=Ve=>{const nA=Ve.normalizedTime??Y(Ve.rawTime);if(nA==null)return null;const eA=Y(nA+$);return eA==null?null:{rawTime:Ve.rawTime+he,normalizedTime:eA,price:Ve.price+te}},He=pe(D.p1),Ne=pe(D.p2),Ge=pe(D.p3);if(!He||!Ne||!Ge)return;H(He,Ne,Ge);return}if(u.type==="ellipse"&&u.p1&&u.p2){const H=(O,K,z=u.minorRatio??.45)=>{const $=u.primitive;if($){$.p1={rawTime:O.rawTime,price:O.price},$.p2={rawTime:K.rawTime,price:K.price},$.minorRatio=Math.max(.05,z);try{a.current?.applyOptions({})}catch{}}const te={...u,p1:O,p2:K,minorRatio:Math.max(.05,z)};Be(he=>{const pe=he.map(He=>He===u?te:He);return p.current=pe,pe}),x(te),oe.current=te},f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(U);if(L==null)return;const D=Y(L);if(D==null)return;if(G.current==="line"){const O=b.timeScale().coordinateToTime(f.x),K=m.coordinateToPrice(f.y);if(O==null||K==null)return;const z=Y(O);if(z==null)return;const $=D-z,te=E-K,he=Y(f.p1.normalizedTime+$),pe=Y(f.p2.normalizedTime+$);if(he==null||pe==null)return;const He=I-O;H({rawTime:f.p1.rawTime+He,normalizedTime:he,price:f.p1.price+te},{rawTime:f.p2.rawTime+He,normalizedTime:pe,price:f.p2.price+te},f.minorRatio??u.minorRatio??.45);return}if(G.current==="handle1"){H({rawTime:L,normalizedTime:D,price:E},u.p2,u.minorRatio??.45);return}if(G.current==="handle3"){H(u.p1,{rawTime:L,normalizedTime:D,price:E},u.minorRatio??.45);return}if(G.current==="handle2"||G.current==="handle4"){const O=b.timeScale().timeToCoordinate(u.p1.rawTime),K=m.priceToCoordinate(u.p1.price),z=b.timeScale().timeToCoordinate(u.p2.rawTime),$=m.priceToCoordinate(u.p2.price);if(O==null||K==null||z==null||$==null)return;const te=(O+z)/2,he=(K+$)/2,pe=z-O,He=$-K,Ne=Math.hypot(pe,He);if(Ne<.001)return;const Ge=-He/Ne,Ve=pe/Ne,nA=Math.abs((U-te)*Ge+(g-he)*Ve),eA=Math.max(.05,nA*2/Ne);H(u.p1,u.p2,eA);return}return}if(u.type==="gannfan"&&u.p1&&u.p2){const H=(f,L)=>{const D=u.primitive;if(D){D.p1={rawTime:f.rawTime,price:f.price},D.p2={rawTime:L.rawTime,price:L.price};try{a.current?.applyOptions({})}catch{}}const O={...u,p1:f,p2:L};Be(K=>{const z=K.map($=>$===u?O:$);return p.current=z,z}),x(O),oe.current=O};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2)}else if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_,price:E})}else if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K})}return}if(u.type==="ganngrid"&&u.p1&&u.p2){const H=(f,L)=>{const D=u.primitive;if(D){D.p1={rawTime:f.rawTime,price:f.price},D.p2={rawTime:L.rawTime,price:L.price};try{a.current?.applyOptions({})}catch{}}const O={...u,p1:f,p2:L};Be(K=>{const z=K.map($=>$===u?O:$);return p.current=z,z}),x(O),oe.current=O};if(G.current==="handle1"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H({rawTime:f,normalizedTime:_,price:E},u.p2)}else if(G.current==="handle2"){const f=b.timeScale().coordinateToTime(U);if(f==null)return;H(u.p1,{rawTime:f,normalizedTime:_,price:E})}else if(G.current==="line"){const f=ee.current;if(!f)return;const L=b.timeScale().coordinateToTime(f.x),D=m.coordinateToPrice(f.y);if(L==null||D==null)return;const O=_-Y(L),K=E-D,z=Y(f.p1.normalizedTime+O),$=Y(f.p2.normalizedTime+O);if(z==null||$==null)return;const te=I-L;H({rawTime:f.p1.rawTime+te,normalizedTime:z,price:f.p1.price+K},{rawTime:f.p2.rawTime+te,normalizedTime:$,price:f.p2.price+K})}return}if(!(u.type!=="trendline"&&u.type!=="gannline")&&!(!u.point1||!u.point2)){if(G.current==="handle1"){const H={time:_,price:E},f=Ar([{time:H.time,value:H.price},{time:u.point2.time,value:u.point2.price}]);f.length>0&&u.series.setData(f);const L={...u,point1:H};Be(D=>{const O=D.map(K=>K===u?L:K);return p.current=O,O}),x(L),oe.current=L}else if(G.current==="handle2"){const H={time:_,price:E},f=Ar([{time:u.point1.time,value:u.point1.price},{time:H.time,value:H.price}]);f.length>0&&u.series.setData(f);const L={...u,point2:H};Be(D=>{const O=D.map(K=>K===u?L:K);return p.current=O,O}),x(L),oe.current=L}else if(G.current==="line"){const H=ee.current;if(!H)return;const f=b.timeScale().coordinateToTime(H.x),L=m.coordinateToPrice(H.y);if(f==null||L==null)return;const D=_-f,O=E-L,K={time:Y(H.point1.time+D),price:H.point1.price+O},z={time:Y(H.point2.time+D),price:H.point2.price+O},$=Ar([{time:K.time,value:K.price},{time:z.time,value:z.price}]);$.length>0&&u.series.setData($);const te={...u,point1:K,point2:z};Be(he=>{const pe=he.map(He=>He===u?te:He);return p.current=pe,pe}),x(te),oe.current=te}}}},P=()=>{G.current=null,ee.current=null},re=()=>{G.current||oe.current||(X(null),ae([]))},Ae={capture:!0,passive:!1};return R.addEventListener("mousedown",ce,Ae),R.addEventListener("mousemove",M,Ae),R.addEventListener("mouseup",P,Ae),R.addEventListener("mouseleave",re,Ae),()=>{R.removeEventListener("mousedown",ce,Ae),R.removeEventListener("mousemove",M,Ae),R.removeEventListener("mouseup",P,Ae),R.removeEventListener("mouseleave",re,Ae)}},[ve,ne,_e,Be]),J.useEffect(()=>{const b=a.current,m=l.current;if(!b||!m)return;const R=()=>{const Q=k;if(!Q){N([]);return}const q=b.timeScale();if(Q.type==="infoline"&&Q.p1&&Q.p2){const se=Q.p1.rawTime??Q.p1.time,ie=Q.p2.rawTime??Q.p2.time,ce=q.timeToCoordinate(se),M=m.priceToCoordinate(Q.p1.price),P=q.timeToCoordinate(ie),re=m.priceToCoordinate(Q.p2.price);ce!=null&&M!=null&&P!=null&&re!=null?N([{x:ce,y:M},{x:P,y:re}]):N([]);return}if(Q.type==="rulerline"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:(se+ce)/2,y:(ie+M)/2},{x:ce,y:M}]):N([]);return}if(Q.type==="arrowedline"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="rayline"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="extendedline"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="crossline"&&Q.p){const se=q.timeToCoordinate(Q.p.rawTime),ie=m.priceToCoordinate(Q.p.price);se!=null&&ie!=null?N([{x:se,y:ie}]):N([]);return}if(Q.type==="trendbyangle"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="equidistantchannel"&&Q.p1&&Q.p2&&Q.b1&&Q.b2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price),P=q.timeToCoordinate(Q.b1.rawTime),re=m.priceToCoordinate(Q.b1.price),Ae=q.timeToCoordinate(Q.b2.rawTime),B=m.priceToCoordinate(Q.b2.price);se!=null&&ie!=null&&ce!=null&&M!=null&&P!=null&&re!=null&&Ae!=null&&B!=null?N([{x:se,y:ie},{x:ce,y:M},{x:(P+Ae)/2,y:(re+B)/2}]):N([]);return}if(Q.type==="regressionchannel"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="stddevchannel"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="andrewspitchfork"&&Q.p1&&Q.p2&&Q.p3){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price),P=q.timeToCoordinate(Q.p3.rawTime),re=m.priceToCoordinate(Q.p3.price);se!=null&&ie!=null&&ce!=null&&M!=null&&P!=null&&re!=null?N([{x:se,y:ie},{x:ce,y:M},{x:P,y:re}]):N([]);return}if(Q.type==="disjointchannel"&&Q.p1&&Q.p2&&Q.p3&&Q.p4){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price),P=q.timeToCoordinate(Q.p3.rawTime),re=m.priceToCoordinate(Q.p3.price),Ae=q.timeToCoordinate(Q.p4.rawTime),B=m.priceToCoordinate(Q.p4.price);se!=null&&ie!=null&&ce!=null&&M!=null&&P!=null&&re!=null&&Ae!=null&&B!=null?N([{x:se,y:ie},{x:ce,y:M},{x:P,y:re},{x:Ae,y:B}]):N([]);return}if(Q.type==="flattopbottom"&&Q.p1&&Q.p2&&Q.p3&&Q.p4){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price),P=q.timeToCoordinate(Q.p3.rawTime),re=m.priceToCoordinate(Q.p3.price),Ae=q.timeToCoordinate(Q.p4.rawTime),B=m.priceToCoordinate(Q.p4.price);se!=null&&ie!=null&&ce!=null&&M!=null&&P!=null&&re!=null&&Ae!=null&&B!=null?N([{x:se,y:ie},{x:ce,y:M},{x:P,y:re},{x:Ae,y:B}]):N([]);return}if(Q.type==="fibonacci"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="trendline"&&Q.point1&&Q.point2){const se=q.timeToCoordinate(Q.point1.time),ie=m.priceToCoordinate(Q.point1.price),ce=q.timeToCoordinate(Q.point2.time),M=m.priceToCoordinate(Q.point2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="gannline"&&Q.point1&&Q.point2){const se=q.timeToCoordinate(Q.point1.time),ie=m.priceToCoordinate(Q.point1.price),ce=q.timeToCoordinate(Q.point2.time),M=m.priceToCoordinate(Q.point2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:(se+ce)/2,y:(ie+M)/2},{x:ce,y:M}]):N([]);return}if(Q.type==="rectangle"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);if(se!=null&&ie!=null&&ce!=null&&M!=null){const P=Math.min(se,ce),re=Math.max(se,ce),Ae=Math.min(ie,M),B=Math.max(ie,M),T=(P+re)/2,U=(Ae+B)/2;N([{x:P,y:Ae},{x:T,y:Ae},{x:re,y:Ae},{x:P,y:U},{x:re,y:U},{x:P,y:B},{x:T,y:B},{x:re,y:B}])}else N([]);return}if(Q.type==="circle"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="triangle"&&Q.p1&&Q.p2&&Q.p3){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price),P=q.timeToCoordinate(Q.p3.rawTime),re=m.priceToCoordinate(Q.p3.price);se!=null&&ie!=null&&ce!=null&&M!=null&&P!=null&&re!=null?N([{x:se,y:ie},{x:ce,y:M},{x:P,y:re}]):N([]);return}if(Q.type==="ellipse"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);if(se!=null&&ie!=null&&ce!=null&&M!=null){const P=(se+ce)/2,re=(ie+M)/2,Ae=ce-se,B=M-ie,T=Math.hypot(Ae,B);if(T<.001){N([]);return}const U=Ae/T,g=B/T,u=-g,I=U,E=T/2,_=E*Math.max(.05,Q.minorRatio??.45);N([{x:P-U*E,y:re-g*E},{x:P+u*_,y:re+I*_},{x:P+U*E,y:re+g*E},{x:P-u*_,y:re-I*_}])}else N([]);return}if(Q.type==="gannfan"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}if(Q.type==="ganngrid"&&Q.p1&&Q.p2){const se=q.timeToCoordinate(Q.p1.rawTime),ie=m.priceToCoordinate(Q.p1.price),ce=q.timeToCoordinate(Q.p2.rawTime),M=m.priceToCoordinate(Q.p2.price);se!=null&&ie!=null&&ce!=null&&M!=null?N([{x:se,y:ie},{x:ce,y:M}]):N([]);return}N([])};R();const Se=b.timeScale();return Se.subscribeVisibleTimeRangeChange(R),()=>{Se.unsubscribeVisibleTimeRangeChange(R)}},[k]),J.useEffect(()=>{!a.current||!l.current||p.current.forEach(b=>{if(b.series&&b.series.applyOptions({visible:de}),b.priceLine&&b.priceLine.applyOptions(de?{color:"#3b82f6",axisLabelVisible:!0,title:typeof b.price=="number"?b.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""}),b.type==="fibonacci"&&b.primitive){b.primitive.visible=de;try{a.current?.applyOptions({})}catch{}}if(b.type==="rectangle"&&b.primitive){b.primitive.visible=de;try{a.current?.applyOptions({})}catch{}}if(b.type==="parallellines"&&(b.baseLine&&b.baseLine.applyOptions({visible:de}),b.parallelLine&&b.parallelLine.applyOptions({visible:de}),b.firstLine&&b.firstLine.applyOptions({visible:de}),b.secondLine&&b.secondLine.applyOptions({visible:de})),(b.type==="horizontalray"||b.type==="verticalline"||b.type==="infoline"||b.type==="rulerline"||b.type==="arrowedline"||b.type==="rayline"||b.type==="extendedline"||b.type==="crossline"||b.type==="trendbyangle"||b.type==="equidistantchannel"||b.type==="regressionchannel"||b.type==="stddevchannel"||b.type==="gannfan"||b.type==="ganngrid"||b.type==="andrewspitchfork"||b.type==="disjointchannel"||b.type==="flattopbottom"||b.type==="circle"||b.type==="triangle"||b.type==="ellipse")&&b.primitive){b.primitive.visible=de;try{a.current?.applyOptions({})}catch{}}})},[de,_e]),J.useEffect(()=>{!de&&k&&(x(null),N([]))},[de,k]),J.useEffect(()=>{if(p.current.length>_e.length){const b=p.current.filter((m,R)=>!_e.includes(m));k&&b.some(m=>m===k)&&(x(null),N([])),b.forEach(m=>{if(m.series&&a.current?.removeSeries(m.series),m.priceLine&&l.current?.removePriceLine(m.priceLine),m.type==="horizontalray"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="verticalline"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="infoline"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="rulerline"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="arrowedline"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="rayline"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="extendedline"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="crossline"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="trendbyangle"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="equidistantchannel"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="regressionchannel"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="stddevchannel"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="gannfan"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="ganngrid"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="andrewspitchfork"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="disjointchannel"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="flattopbottom"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="fibonacci"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="rectangle"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="circle"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="triangle"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="ellipse"&&m.primitive)try{l.current?.detachPrimitive(m.primitive)}catch{}if(m.type==="parallellines")try{m.baseLine&&a.current?.removeSeries(m.baseLine),m.parallelLine&&a.current?.removeSeries(m.parallelLine),m.firstLine&&a.current?.removeSeries(m.firstLine),m.secondLine&&a.current?.removeSeries(m.secondLine)}catch{}}),p.current=_e}},[_e,k]),J.useEffect(()=>{const b=l.current;return b?(je.current.forEach(R=>{try{b.removePriceLine(R)}catch{}}),je.current=[],iA.filter(R=>R.symbol===Ee).forEach(R=>{const Se=parseFloat(R.price);if(isNaN(Se))return;const q=R.type==="BUY"?"#26A69A":"#EF5350",se=b.createPriceLine({price:Se,color:q,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${R.type} ${R.volume} @ ${R.price}`,textColor:q});je.current.push(se)}),()=>{je.current.forEach(R=>{try{b.removePriceLine(R)}catch{}}),je.current=[]}):void 0},[iA,Ee]),J.useEffect(()=>{const b=o.current;if(!b)return;const m=R=>{y.current||!a.current||(R.preventDefault(),R.stopPropagation(),typeof R.stopImmediatePropagation=="function"&&R.stopImmediatePropagation(),setTimeout(()=>{if(!a.current)return;Vv(a.current,ne,Te)||a.current.timeScale().fitContent();const Q=a.current.timeScale().getVisibleRange();ye(Q)},80))};return b.addEventListener("dblclick",m,!0),()=>{b.removeEventListener("dblclick",m,!0)}},[ne,Te]);const Kt=k??Z,Qr=k?V:W,VA=de&&kv(Kt,Qr),BA=Ov(Kt?.type);return h.jsx("div",{className:`flex-1 flex flex-col min-w-0 overflow-hidden ${Re==="light"?"bg-white":"bg-[#12161d]"}`,children:h.jsxs("div",{ref:o,className:"flex-1 w-full h-full relative",style:{cursor:ve===1||ve!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[t&&h.jsx("div",{className:"absolute top-3 left-3 z-50",children:h.jsx(Jc,{bidPrice:e,askPrice:A,onBuyClick:ts,onSellClick:Ca})}),h.jsx(Zc,{isOpen:we,onClose:va,orderType:Ie,bidPrice:e,askPrice:A}),VA&&h.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none","aria-hidden":!0,children:Qr.map((b,m)=>h.jsx("div",{className:"absolute w-[10px] h-[10px] rounded-full border-2 border-white shadow",style:{left:b.x-5,top:b.y-5,backgroundColor:BA}},m))})]})})}),lA={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 md({style:r,className:e}){const{selectedSymbol:A,setSelectedSymbol:t,symbols:i,symbolsLoading:n}=FA(),[s,o]=J.useState(!1),[a,l]=J.useState(""),[c,d]=J.useState(-1),p=J.useRef(null),y=J.useRef(null);J.useEffect(()=>{const F=k=>{p.current&&!p.current.contains(k.target)&&(o(!1),l(""))};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]),J.useEffect(()=>{s&&y.current&&y.current.focus()},[s]);const w=i.filter(F=>F.symbol.toLowerCase().includes(a.toLowerCase())),C=w.filter(F=>!F.symbol.endsWith("USDT")),v=w.filter(F=>F.symbol.endsWith("USDT")),S=F=>{t(F),o(!1),l("")};return i.find(F=>F.symbol===A),h.jsxs("div",{ref:p,style:{...lA.container,...r},className:e,children:[h.jsxs("button",{style:lA.button,onClick:()=>o(!s),onMouseEnter:F=>Object.assign(F.currentTarget.style,lA.buttonHover),onMouseLeave:F=>{F.currentTarget.style.borderColor="#334155",F.currentTarget.style.backgroundColor="#1e293b"},children:[h.jsx("span",{children:n?"Loading...":A||"Select Coin"}),h.jsx("span",{style:{...lA.arrow,...s?lA.arrowOpen:{}},children:"▼"})]}),s&&h.jsxs("div",{style:lA.dropdown,children:[h.jsx("div",{style:lA.searchContainer,children:h.jsx("input",{ref:y,style:lA.searchInput,type:"text",placeholder:"Search symbol...",value:a,onChange:F=>l(F.target.value)})}),h.jsx("div",{style:lA.list,children:w.length===0?h.jsx("div",{style:lA.empty,children:"No symbols found"}):h.jsxs(h.Fragment,{children:[C.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{style:lA.categoryLabel,children:"Forex & Metals"}),C.map(F=>h.jsxs("div",{style:{...lA.item,...F.symbol===A?lA.itemSelected:{}},onClick:()=>S(F.symbol),onMouseEnter:k=>{F.symbol!==A&&(k.currentTarget.style.backgroundColor="#334155")},onMouseLeave:k=>{F.symbol!==A&&(k.currentTarget.style.backgroundColor="transparent")},children:[h.jsx("span",{style:lA.symbolName,children:F.symbol}),F.bid&&h.jsx("span",{style:{...lA.symbolPrice,...parseFloat(F.change)>=0?lA.priceUp:lA.priceDown},children:parseFloat(F.bid).toFixed(5)})]},F.symbol))]}),v.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{style:lA.categoryLabel,children:"Crypto"}),v.map(F=>h.jsxs("div",{style:{...lA.item,...F.symbol===A?lA.itemSelected:{}},onClick:()=>S(F.symbol),onMouseEnter:k=>{F.symbol!==A&&(k.currentTarget.style.backgroundColor="#334155")},onMouseLeave:k=>{F.symbol!==A&&(k.currentTarget.style.backgroundColor="transparent")},children:[h.jsx("span",{style:lA.symbolName,children:F.symbol}),F.bid&&h.jsx("span",{style:{...lA.symbolPrice,...parseFloat(F.change)>=0?lA.priceUp:lA.priceDown},children:parseFloat(F.bid).toFixed(2)})]},F.symbol))]})]})})]})]})}const gt={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"}},Gv=[.01,.05,.1,.5,1];function Bd({value:r,onChange:e,min:A=.01,max:t=100,step:i=.01,presets:n=Gv,showPresets:s=!0,showLabel:o=!0,label:a="Vol",style:l,className:c}){const[d,p]=J.useState(.1),y=r!==void 0?r:d,w=J.useCallback(F=>{const k=Math.max(A,Math.min(t,parseFloat(F)||A)),x=Math.round(k/i)*i,V=parseFloat(x.toFixed(8));r!==void 0||p(V),e?.(V)},[A,t,i,r,e]),C=()=>w(y+i),v=()=>w(y-i),S=(y>=1,y.toFixed(2));return h.jsxs("div",{style:{...gt.container,...l},className:c,children:[o&&h.jsx("span",{style:gt.label,children:a}),h.jsx("button",{style:gt.btn,onClick:v,onMouseEnter:F=>Object.assign(F.currentTarget.style,gt.btnHover),onMouseLeave:F=>{F.currentTarget.style.borderColor="#334155",F.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),h.jsx("input",{style:gt.input,type:"text",value:S,onChange:F=>{const k=F.target.value;if(k===""||k==="."||k==="0.")return;const x=parseFloat(k);isNaN(x)||w(x)},onBlur:()=>w(y)}),h.jsx("button",{style:gt.btn,onClick:C,onMouseEnter:F=>Object.assign(F.currentTarget.style,gt.btnHover),onMouseLeave:F=>{F.currentTarget.style.borderColor="#334155",F.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&h.jsx("div",{style:gt.presets,children:n.map(F=>h.jsx("button",{style:{...gt.preset,...Math.abs(y-F)<1e-4?gt.presetActive:{}},onClick:()=>w(F),onMouseEnter:k=>{Math.abs(y-F)>=1e-4&&Object.assign(k.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:k=>{Math.abs(y-F)>=1e-4&&(k.currentTarget.style.borderColor="#334155")},children:F},F))})]})}const KA={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 wd({value:r,onChange:e,enabled:A,onEnabledChange:t,mode:i,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:a=!0,label:l="SL",style:c,className:d}){const{currentSymbolData:p}=FA(),[y,w]=J.useState(""),[C,v]=J.useState(!1),[S,F]=J.useState("price"),k=r!==void 0?r:y,x=A!==void 0?A:C,V=i!==void 0?i:S,N=J.useCallback(G=>{A!==void 0||v(G),t?.(G)},[A,t]),Z=J.useCallback(G=>{i!==void 0||F(G),n?.(G)},[i,n]),X=J.useCallback(G=>{r!==void 0||w(G),e?.(G)},[r,e]),W=G=>{const ee=G.target.value;if(ee===""||ee==="."||ee==="0."){X(ee);return}const oe=parseFloat(ee);isNaN(oe)||X(ee)},ae=V==="price"?p?.bid?parseFloat(p.bid).toFixed(5):"0.00000":"50";return h.jsxs("div",{style:{...KA.container,...c},className:d,children:[a&&h.jsx("span",{style:KA.label,children:l}),s&&h.jsx("button",{style:{...KA.toggle,...x?KA.toggleOn:KA.toggleOff},onClick:()=>N(!x),children:h.jsx("div",{style:{...KA.toggleKnob,...x?KA.knobOn:KA.knobOff}})}),(x||!s)&&h.jsxs("div",{style:KA.inputGroup,children:[h.jsx("input",{style:KA.input,type:"text",value:k,onChange:W,placeholder:ae,onFocus:G=>G.currentTarget.style.borderColor="#EF5350",onBlur:G=>G.currentTarget.style.borderColor="#334155"}),o&&h.jsxs(h.Fragment,{children:[h.jsx("button",{style:{...KA.modeBtn,...V==="price"?KA.modeBtnActive:{}},onClick:()=>Z("price"),children:"Price"}),h.jsx("button",{style:{...KA.modeBtn,...V==="pips"?KA.modeBtnActive:{}},onClick:()=>Z("pips"),children:"Pips"})]})]})]})}const PA={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 Cd({value:r,onChange:e,enabled:A,onEnabledChange:t,mode:i,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:a=!0,label:l="TP",style:c,className:d}){const{currentSymbolData:p}=FA(),[y,w]=J.useState(""),[C,v]=J.useState(!1),[S,F]=J.useState("price"),k=r!==void 0?r:y,x=A!==void 0?A:C,V=i!==void 0?i:S,N=J.useCallback(G=>{A!==void 0||v(G),t?.(G)},[A,t]),Z=J.useCallback(G=>{i!==void 0||F(G),n?.(G)},[i,n]),X=J.useCallback(G=>{r!==void 0||w(G),e?.(G)},[r,e]),W=G=>{const ee=G.target.value;if(ee===""||ee==="."||ee==="0."){X(ee);return}const oe=parseFloat(ee);isNaN(oe)||X(ee)},ae=V==="price"?p?.ask?parseFloat(p.ask).toFixed(5):"0.00000":"50";return h.jsxs("div",{style:{...PA.container,...c},className:d,children:[a&&h.jsx("span",{style:PA.label,children:l}),s&&h.jsx("button",{style:{...PA.toggle,...x?PA.toggleOn:PA.toggleOff},onClick:()=>N(!x),children:h.jsx("div",{style:{...PA.toggleKnob,...x?PA.knobOn:PA.knobOff}})}),(x||!s)&&h.jsxs("div",{style:PA.inputGroup,children:[h.jsx("input",{style:PA.input,type:"text",value:k,onChange:W,placeholder:ae,onFocus:G=>G.currentTarget.style.borderColor="#26A69A",onBlur:G=>G.currentTarget.style.borderColor="#334155"}),o&&h.jsxs(h.Fragment,{children:[h.jsx("button",{style:{...PA.modeBtn,...V==="price"?PA.modeBtnActive:{}},onClick:()=>Z("price"),children:"Price"}),h.jsx("button",{style:{...PA.modeBtn,...V==="pips"?PA.modeBtnActive:{}},onClick:()=>Z("pips"),children:"Pips"})]})]})]})}const Rv=[{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:"─"}],mt={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 vd({showLabel:r=!0,showDelete:e=!0,showVisibility:A=!0,tools:t,label:i="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:a,drawingsVisible:l,setDrawingsVisible:c,chartObjects:d,setChartObjects:p}=FA(),[y,w]=J.useState(null),C=t||Rv,v=k=>{a(o===k?null:k)},S=()=>{p([]),a(null)},F=()=>{c(!l)};return h.jsxs("div",{style:{...mt.container,...n},className:s,children:[r&&h.jsx("span",{style:mt.label,children:i}),C.map(k=>h.jsxs("button",{style:{...mt.btn,...o===k.id?mt.btnActive:{}},onClick:()=>v(k.id),onMouseEnter:x=>{w(k.id),o!==k.id&&Object.assign(x.currentTarget.style,mt.btnHover)},onMouseLeave:x=>{w(null),o!==k.id&&(x.currentTarget.style.borderColor="#334155",x.currentTarget.style.backgroundColor="#1e293b",x.currentTarget.style.color="#94a3b8")},title:k.name,children:[k.icon,y===k.id&&h.jsx("div",{style:mt.tooltip,children:k.name})]},k.id)),(e||A)&&h.jsx("div",{style:mt.divider}),A&&h.jsx("button",{style:{...mt.visibilityBtn,...l?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:F,onMouseEnter:k=>{k.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:k=>{k.currentTarget.style.borderColor="#334155"},title:l?"Hide Drawings":"Show Drawings",children:l?"👁":"○"}),e&&h.jsx("button",{style:mt.deleteBtn,onClick:S,onMouseEnter:k=>Object.assign(k.currentTarget.style,mt.deleteBtnHover),onMouseLeave:k=>{k.currentTarget.style.borderColor="#334155",k.currentTarget.style.backgroundColor="#1e293b",k.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const yd={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 Wv({showCoinSelector:r=!0,showVolumeControl:e=!0,showStopLoss:A=!0,showTakeProfit:t=!0,showDrawingTools:i=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:a,onStopLossChange:l,stopLossEnabled:c,onStopLossEnabledChange:d,takeProfit:p,onTakeProfitChange:y,takeProfitEnabled:w,onTakeProfitEnabledChange:C,coinSelectorProps:v={},volumeControlProps:S={},stopLossProps:F={},takeProfitProps:k={},drawingToolsProps:x={},style:V,className:N}){const Z=[];r&&Z.push(h.jsx(md,{...v},"coin")),e&&Z.push(h.jsx(Bd,{value:s,onChange:o,...S},"volume")),A&&Z.push(h.jsx(wd,{value:a,onChange:l,enabled:c,onEnabledChange:d,...F},"sl")),t&&Z.push(h.jsx(Cd,{value:p,onChange:y,enabled:w,onEnabledChange:C,...k},"tp")),i&&Z.push(h.jsx(vd,{...x},"draw"));const X=[];return Z.forEach((W,ae)=>{X.push(W),n&&ae<Z.length-1&&X.push(h.jsx("div",{style:yd.divider},`div-${ae}`))}),h.jsx("div",{style:{...yd.toolbar,...V},className:N,children:X})}const $v=[{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"}],Ba={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 Xv({style:r,className:e}){const{selectedTimeframe:A,setSelectedTimeframe:t}=FA();return h.jsx("div",{style:{...Ba.container,...r},className:e,children:$v.map(i=>h.jsx("button",{style:{...Ba.btn,...A===i.value?Ba.btnActive:{}},onClick:()=>t(i.value),onMouseEnter:n=>{A!==i.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{A!==i.value&&(n.currentTarget.style.borderColor="#334155")},children:i.label},i.value))})}const Jv=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],wa={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 Zv({style:r,className:e}){const{chartType:A,setChartType:t}=FA();return h.jsx("div",{style:{...wa.container,...r},className:e,children:Jv.map(i=>h.jsxs("button",{style:{...wa.btn,...A===i.value?wa.btnActive:{}},onClick:()=>t(i.value),onMouseEnter:n=>{A!==i.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{A!==i.value&&(n.currentTarget.style.borderColor="#334155")},title:i.label,children:[h.jsx("span",{children:i.icon}),h.jsx("span",{children:i.label})]},i.value))})}const IA={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 qv({volume:r=.1,stopLoss:e,takeProfit:A,onTradeExecuted:t,style:i,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:a,setUserBalance:l}=FA(),[c,d]=J.useState(null),p=parseFloat(o?.bid||0),y=parseFloat(o?.ask||0),w=y>0&&p>0?Math.abs(y-p):0,C=F=>!F||F===0?"-.-----":F>=1e3?F.toFixed(2):F>=1?F.toFixed(4):F.toFixed(5),v=F=>F===0?"-":F>=1?F.toFixed(1):F>=.01?F.toFixed(3):(F*1e4).toFixed(1)+"p",S=J.useCallback(F=>{if(!s)return;const k=F==="BUY"?y:p;if(!k||k<=0){d({type:"error",message:"No price available"});return}const x={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:F,volume:r,price:k,stopLoss:e?parseFloat(e):null,takeProfit:A?parseFloat(A):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};a(N=>[...N,x]);const V=r*k*.01;l(N=>N-V),d({type:"success",message:`${F} executed`}),t?.(x),setTimeout(()=>d(null),3e3)},[s,y,p,r,e,A,a,l,t]);return h.jsxs("div",{style:{...IA.container,...i},className:n,children:[h.jsx("button",{style:IA.sellBtn,onClick:()=>S("SELL"),onMouseEnter:F=>{Object.assign(F.currentTarget.style,IA.sellBtnHover)},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#7f1d1d",F.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),h.jsxs("div",{style:IA.priceBox,children:[h.jsx("span",{style:IA.priceLabel,children:"Bid"}),h.jsx("span",{style:{...IA.priceValue,color:"#EF5350"},children:C(p)})]}),h.jsxs("div",{style:IA.spread,children:[h.jsx("span",{style:IA.spreadLabel,children:"Spread"}),h.jsx("span",{style:IA.spreadValue,children:v(w)})]}),h.jsxs("div",{style:IA.priceBox,children:[h.jsx("span",{style:IA.priceLabel,children:"Ask"}),h.jsx("span",{style:{...IA.priceValue,color:"#26A69A"},children:C(y)})]}),h.jsx("button",{style:IA.buyBtn,onClick:()=>S("BUY"),onMouseEnter:F=>{Object.assign(F.currentTarget.style,IA.buyBtnHover)},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#14532d",F.currentTarget.style.borderColor="#166534"},children:"Buy"}),c&&h.jsx("span",{style:{...IA.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 $e={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 Yv({style:r,className:e,maxHeight:A=200}){const{orders:t,setOrders:i,symbols:n,accountSummary:s,setUserBalance:o}=FA(),[a,l]=J.useState(null),c=t.filter(C=>C.status==="OPEN"||!C.closeAt),d=J.useCallback((C,v)=>{const S=n.find(F=>F.symbol===C);return S?parseFloat(v==="BUY"?S.bid||0:S.ask||0):0},[n]),p=J.useCallback(C=>{if(a)return;l(C.id);const v=d(C.symbol,C.type),F=(C.type==="BUY"?v-C.price:C.price-v)*C.volume,k=C.volume*C.price*.01;i(x=>x.filter(V=>V.id!==C.id)),o(x=>x+k+F),l(null)},[a,d,i,o]),y=C=>{const v=parseFloat(C);return!v||isNaN(v)?"-":v>=1e3?v.toFixed(2):v>=1?v.toFixed(4):v.toFixed(5)},w=C=>{const v=parseFloat(C);return isNaN(v)?"-":(v>=0?"+":"")+v.toFixed(2)};return h.jsxs("div",{style:{...$e.container,...r},className:e,children:[h.jsxs("div",{style:$e.header,children:[h.jsxs("span",{style:$e.headerTitle,children:["Positions (",c.length,")"]}),h.jsxs("div",{style:$e.summary,children:[h.jsxs("div",{style:$e.summaryItem,children:[h.jsx("span",{style:$e.summaryLabel,children:"Balance:"}),h.jsxs("span",{style:{...$e.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),h.jsxs("div",{style:$e.summaryItem,children:[h.jsx("span",{style:$e.summaryLabel,children:"Equity:"}),h.jsxs("span",{style:{...$e.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),h.jsxs("div",{style:$e.summaryItem,children:[h.jsx("span",{style:$e.summaryLabel,children:"Free:"}),h.jsxs("span",{style:{...$e.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),h.jsx("div",{style:{...$e.scrollArea,maxHeight:A},children:h.jsxs("table",{style:$e.table,children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{style:$e.th,children:"Symbol"}),h.jsx("th",{style:$e.th,children:"Type"}),h.jsx("th",{style:$e.th,children:"Volume"}),h.jsx("th",{style:$e.th,children:"Open Price"}),h.jsx("th",{style:$e.th,children:"Current"}),h.jsx("th",{style:$e.th,children:"SL"}),h.jsx("th",{style:$e.th,children:"TP"}),h.jsx("th",{style:$e.th,children:"Profit"}),h.jsx("th",{style:$e.th,children:"Action"})]})}),h.jsx("tbody",{children:c.length===0?h.jsx("tr",{children:h.jsx("td",{colSpan:9,style:$e.emptyRow,children:"No open positions"})}):c.map(C=>{const v=d(C.symbol,C.type),S=C.profit||0;return h.jsxs("tr",{children:[h.jsx("td",{style:{...$e.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),h.jsx("td",{style:{...$e.td,...C.type==="BUY"?$e.typeBuy:$e.typeSell},children:C.type}),h.jsx("td",{style:$e.td,children:C.volume}),h.jsx("td",{style:$e.td,children:y(C.price)}),h.jsx("td",{style:$e.td,children:y(v)}),h.jsx("td",{style:$e.td,children:C.stopLoss?y(C.stopLoss):"-"}),h.jsx("td",{style:$e.td,children:C.takeProfit?y(C.takeProfit):"-"}),h.jsx("td",{style:{...$e.td,color:S>=0?"#26A69A":"#EF5350",fontWeight:700},children:w(S)}),h.jsx("td",{style:$e.td,children:h.jsx("button",{style:{...$e.closeBtn,...a===C.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>p(C),disabled:a===C.id,onMouseEnter:F=>{a!==C.id&&(F.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#7f1d1d"},children:a===C.id?"...":"Close"})})]},C.id)})})]})})]})}function jv(r){return Wr({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 ey(r){return Wr({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 Ay=({selectedSymbol:r,selectedTimeframe:e,onTimeframeChange:A,chartType:t="candles",onChartTypeChange:i,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:a,onDownloadChartPNG:l,onToggleFullscreen:c,marketWatchOpen:d=!0,onToggleMarketWatch:p,buySellPanelOpen:y,onMove:w})=>{const{theme:C}=FA(),v=C==="light",S=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],F={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 ${v?"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 ${v?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(k=>h.jsx("button",{onClick:()=>i(k),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
11
+ ${t===k?v?"text-sky-600":"text-sky-400":v?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
12
+ `,title:k,children:F[k]},k))}),h.jsx("div",{className:`flex items-center gap-1 border-r ${v?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(k=>h.jsx("button",{onClick:()=>i(k),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
13
+ ${t===k?v?"text-sky-600":"text-sky-400":v?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
+ `,title:k,children:F[k]},k))}),h.jsxs("div",{className:"flex items-center gap-2",children:[S.map(k=>h.jsx("button",{onClick:()=>A(k),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===k?v?"text-sky-600":"text-sky-400":v?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:k},k)),h.jsx("div",{className:`border-r h-6 mx-1 ${v?"border-slate-200":"border-slate-700"}`}),h.jsx("button",{onClick:()=>a?.(),title:y?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${y?v?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":v?"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:n,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${v?"text-slate-700 hover:text-slate-900 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 ${v?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:s,className:`p-1 ${v?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:h.jsx(jv,{className:"w-5 h-5"})}),h.jsx("button",{onClick:o,className:`p-2 ${v?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:h.jsx(ey,{className:"w-5 h-5"})}),h.jsx("div",{className:`border-r ${v?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsx("button",{onClick:w,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${v?"text-slate-700 hover:text-slate-900 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 ${v?"border-slate-200":"border-slate-700"} h-6 mx-1`}),h.jsx("button",{type:"button",onClick:()=>p?.(),title:d?"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 ${d?v?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":v?"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 ${v?"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 ${v?"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"})})})]})]})},pi=[{label:"Trendline",toolId:2,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 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:"Horizontal Line",toolId:20,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),h.jsx("path",{d:"M19 9l3 3-3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Vertical Line",toolId:22,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[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"}),h.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),h.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[h.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),h.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),h.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),h.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),h.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),h.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{fillRule:"evenodd",d:"M5.054 17.988a2.988 2.988 0 0 1-1.31-.312 2.994 2.994 0 1 1 2.69 1.693 2.988 2.988 0 0 1-1.38-.381Zm-1 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),h.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),h.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),h.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),h.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],gi=[{label:"Regression Channel",toolId:40,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",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",clipRule:"evenodd",fill:"currentColor"})})},{label:"Equidistant Channel",toolId:3,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"M15 8a2.966 2.966 0 0 1-1.308-.312l-6 6c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l6-6A2.992 2.992 0 1 1 15 8ZM5 14a1 1 0 1 0 0 2.001A1 1 0 0 0 5 14ZM15 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm6.714 6.666-7.026 7.026a3.03 3.03 0 1 1-1.381-1.381l7.026-7.026a.977.977 0 1 1 1.381 1.381ZM12 18a1 1 0 1 0 0 2.001A1 1 0 0 0 12 18Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"StdDev Channel",toolId:41,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.381-1.382ZM10 15H9v4a1 1 0 1 1-2 0v-1H6a1 1 0 0 1 0-2h1v-4a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm7-7h-1v4a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1V5a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm-4.714 12.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.382-1.382h.001Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Andrews Pitchfork",toolId:42,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"m21.714 13.666-4.026 4.026c.203.406.31.854.312 1.308a3 3 0 0 1-6 0c.002-.454.11-.902.312-1.308L10 15.381l-2.312 2.311a3.03 3.03 0 1 1-1.381-1.381L8.619 14l-2.311-2.312a3 3 0 1 1-.001-5.377l4.026-4.026a.976.976 0 1 1 1.381 1.381L7.688 7.692a2.9 2.9 0 0 1 0 2.615L10 12.619l8.333-8.334a.976.976 0 1 1 1.381 1.381L11.381 14l2.312 2.312a2.9 2.9 0 0 1 2.614 0l4.026-4.026a.977.977 0 1 1 1.381 1.38ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],mi=[{label:"Gann Line",toolId:43,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3 3 0 0 1-3 3 2.965 2.965 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l3-3a2.98 2.98 0 0 1 4-4l3-3A2.992 2.992 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2.001A1 1 0 0 0 5 18Zm7-7a1 1 0 1 0 0 2.001A1 1 0 0 0 12 11Zm7-7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Fan",toolId:44,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"M21.72 3.584 17.694 7.61c.202.407.31.854.312 1.308a3 3 0 0 1-3 3 2.967 2.967 0 0 1-1.308-.312l-4.45 4.45 10.109-4.042a.987.987 0 0 1 .834 1.79L8.167 18.61l7.75-.7a1.004 1.004 0 1 1 .18 2l-8.684.79a2.992 2.992 0 1 1-4.2-4.164l.794-8.7a1.004 1.004 0 1 1 2 .181L5.3 15.765 9.673 4.591a.969.969 0 0 1 1.3-.48 1 1 0 0 1 .47 1.32L7.79 14.77l4.538-4.538a2.98 2.98 0 0 1 4-4l4.026-4.026a.977.977 0 0 1 1.367 1.377ZM5.006 19.918a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm10-12a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Grid",toolId:45,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-.5.5L21 12l-3.809 3.809.5.5a3.034 3.034 0 1 1-1.381 1.381l-.5-.5L12 21l-3.809-3.809-.5.5c.202.407.308.855.309 1.309a3.03 3.03 0 1 1-1.693-2.689l.5-.5L3 12l3.81-3.81-.5-.5A2.966 2.966 0 0 1 5 8a3.031 3.031 0 1 1 2.689-1.693l.5.5L12 3l3.809 3.81.5-.5A2.993 2.993 0 1 1 19 8Zm0 12a1 1 0 1 0 0-2.002A1 1 0 0 0 19 20ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm7 14.452 2.536-2.536L12 13.381l-2.536 2.535L12 18.452ZM5.547 12l2.536 2.535L10.619 12 8.083 9.464 5.547 12ZM12 5.547 9.464 8.083 12 10.619l2.535-2.536L12 5.547Zm3.916 3.917L13.381 12l2.536 2.535L18.452 12l-2.536-2.536ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],Bi=[{label:"Rectangle",toolId:5,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",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:"Circle",toolId:46,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12C22 10.2504 21.5507 8.60571 20.7611 7.17509C20.9149 6.81421 21 6.41704 21 6C21 4.34315 19.6569 3 18 3C17.583 3 17.1858 3.0851 16.8249 3.23888C15.3943 2.44933 13.7496 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12ZM12 20C16.4183 20 20 16.4183 20 12C20 10.8264 19.7473 9.7118 19.2933 8.70768C18.9017 8.89507 18.4631 9 18 9C17.5369 9 17.0983 8.89506 16.7066 8.70766L14.7077 10.7066C14.8951 11.0983 15 11.5369 15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.4632 9 12.9018 9.10496 13.2935 9.2924L15.2924 7.29348C15.105 6.90183 15 6.46317 15 6C15 5.5369 15.1049 5.09831 15.2923 4.7067C14.2882 4.25272 13.1736 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12ZM18 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 7Z",fill:"currentColor"})})},{label:"Triangle",toolId:47,icon:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 6C15 7.65685 13.6569 9 12 9C11.763 9 11.5324 8.97252 11.3113 8.92057L7.37081 16.1613C6.95686 15.6284 6.36717 15.2388 5.68872 15.0794L9.62925 7.83858C9.23484 7.33074 9 6.6928 9 6C9 4.34315 10.3431 3 12 3C13.6569 3 15 4.34315 15 6ZM13 6C13 6.55228 12.5523 7 12 7C11.4477 7 11 6.55228 11 6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6Z",fill:"currentColor"}),h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.3708 7.83867C13.9569 8.37162 13.3672 8.76126 12.6887 8.9206L16.6292 16.1614C16.4344 16.4122 16.2786 16.6948 16.1707 17H7.82941C7.93996 17.3128 8.00012 17.6494 8.00012 18C8.00012 18.3506 7.93996 18.6872 7.8294 19H16.1707C16.5826 20.1652 17.6938 21 19 21C20.6569 21 22 19.6569 22 18C22 16.3431 20.6569 15 19 15C18.763 15 18.5324 15.0275 18.3113 15.0794L14.3708 7.83867ZM19 19C19.5523 19 20 18.5523 20 18C20 17.4477 19.5523 17 19 17C18.4477 17 18 17.4477 18 18C18 18.5523 18.4477 19 19 19Z",fill:"currentColor"}),h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00012 18C8.00012 19.6569 6.65685 21 5 21C3.34315 21 2 19.6569 2 18C2 16.3431 3.34315 15 5 15C6.65685 15 8.00012 16.3431 8.00012 18ZM6 18C6 18.5523 5.55228 19 5 19C4.44772 19 4 18.5523 4 18C4 17.4477 4.44772 17 5 17C5.55228 17 6 17.4477 6 18Z",fill:"currentColor"})]})},{label:"Ellipse",toolId:48,icon:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3a3.001 3.001 0 0 0-2.935 2.378c-1.25.333-2.381.874-3.322 1.58a7.344 7.344 0 0 0-1.886 2.045 3 3 0 0 0 0 5.994 7.343 7.343 0 0 0 1.886 2.046C7.38 18.27 9.595 19 12 19s4.62-.73 6.257-1.957a7.343 7.343 0 0 0 1.886-2.046 3 3 0 0 0 0-5.994 7.344 7.344 0 0 0-1.886-2.046c-.94-.705-2.073-1.246-3.322-1.579A3.001 3.001 0 0 0 12 3Zm-1 3a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm7.156 3.634a5.584 5.584 0 0 0-1.1-1.077 7.61 7.61 0 0 0-2.391-1.177 3 3 0 0 1-5.33 0 7.61 7.61 0 0 0-2.392 1.177c-.437.328-.805.69-1.099 1.076A2.995 2.995 0 0 1 7 12c0 .962-.452 1.818-1.156 2.367.294.386.662.748 1.1 1.076C8.201 16.387 9.985 17 12 17c2.014 0 3.798-.613 5.057-1.557.437-.328.805-.69 1.099-1.077A2.995 2.995 0 0 1 17 12c0-.961.452-1.817 1.156-2.366ZM3 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm16 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z",fill:"currentColor"})})}],As=({children:r,top:e,panelRef:A,isLight:t})=>h.jsx("div",{ref:A,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${t?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:h.jsx("div",{className:"py-1",children:r})}),ty=({AccountId:r,UserName:e,UserId:A})=>{const{activeTool:t,setActiveTool:i,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:a,chartObjects:l,setChartObjects:c,drawingsVisible:d,setDrawingsVisible:p,chartLocked:y,setChartLocked:w,theme:C,setTheme:v}=FA(),[S,F]=J.useState(!1),[k,x]=J.useState(null),[V,N]=J.useState(null),[Z,X]=J.useState(0),[W,ae]=J.useState(!1),[G,ee]=J.useState(0),[oe,me]=J.useState(!1),[Le,Ue]=J.useState(0),[Fe,ke]=J.useState(!1),[ye,ve]=J.useState(0),[Ce,ge]=J.useState(!1),[Me,_e]=J.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Be=J.useRef(null),iA=J.useRef(null),Ee=J.useRef(null),Te=J.useRef(null),de=J.useRef(null),Qe=J.useRef(null);J.useEffect(()=>{const le=Ie=>{const fe=Be.current;S&&fe&&!fe.contains(Ie.target)&&(F(!1),x(null));const ne=iA.current;V==="line"&&ne&&!ne.contains(Ie.target)&&N(null);const Oe=Ee.current;V==="channel"&&Oe&&!Oe.contains(Ie.target)&&N(null);const De=Te.current;V==="gann"&&De&&!De.contains(Ie.target)&&N(null);const Ye=de.current;V==="shape"&&Ye&&!Ye.contains(Ie.target)&&N(null)};return window.addEventListener("mousedown",le),()=>window.removeEventListener("mousedown",le)},[S,V]),J.useEffect(()=>{const le=Ie=>{Ie.key==="Escape"&&(F(!1),x(null),N(null))};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[]);const cA=J.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:"20",height:"20",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:"20",height:"20",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:"20",height:"20",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:"20",height:"20",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",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",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:"20",height:"20",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:"20",height:"20",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:"20",height:"20",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:"20",height:"20",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"}],[]),Re=le=>{const Ie=cA[le].label;if(Ie==="Menu"){F(fe=>!fe),x(null);return}if(Ie==="Grid"){s(!n);return}if(Ie==="Magnet"){a(!o),i(o?null:le);return}if(Ie==="Delete"){if(l.length>0){const fe=[...l];fe.pop(),c(fe)}return}if(Ie==="Eye"){p(!d);return}if(Ie==="Lock"){w(!y);return}if(Ie==="Light Theme"||Ie==="Dark Theme"){v(C==="light"?"dark":"light"),F(!1),x(null);return}i(t===le?null:le)};cA.slice(0,12);const Ke=cA.slice(12),Xe=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],We=[{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:C==="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:"20",height:"20",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"})]})}],je=({item:le})=>{const Ie=!!le.submenu?.length;return h.jsxs("div",{className:"relative",onMouseEnter:()=>{Qe.current&&(clearTimeout(Qe.current),Qe.current=null),Ie&&x(le.key)},onMouseLeave:()=>{Ie&&(Qe.current=setTimeout(()=>x(null),120))},children:[h.jsxs("button",{type:"button",onClick:()=>{Ie?x(fe=>fe===le.key?null:le.key):(le.key==="theme"&&v(fe=>fe==="light"?"dark":"light"),F(!1),x(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${we?"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 ${we?"text-slate-500":"text-slate-400"}`,children:le.icon}),h.jsx("span",{className:"flex-1 text-[15px]",children:le.label}),le.rightText&&h.jsx("span",{className:`text-xs ${we?"text-slate-500":"text-slate-400"}`,children:le.rightText}),Ie&&h.jsx("svg",{className:`w-4 h-4 ${we?"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"})})]}),Ie&&k===le.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 ${we?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:h.jsx("div",{className:"py-1",children:le.submenu.map((fe,ne)=>{const Oe=Me[le.key]===fe.label||fe.selected&&Me[le.key]==null;return h.jsxs("button",{type:"button",onClick:()=>{_e(De=>({...De,[le.key]:fe.label}))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${we?"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 ${we?"text-slate-500":"text-slate-400"}`,children:fe.icon||null}),h.jsx("span",{className:"flex-1 min-w-0",children:fe.label}),Oe&&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"})})})]},ne)})})})]})},we=C==="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 ${we?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[h.jsx("div",{className:"flex flex-col items-center gap-2",children:Xe.map((le,Ie)=>{const fe=le==="gann",ne=fe?null:cA[le],Oe=fe?-1:le;return h.jsxs(J.Fragment,{children:[Oe===2?h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>{const De=pi[Z].toolId;i(t===De?null:De)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
15
+ ${t===pi[Z].toolId?we?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":we?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:pi[Z].label,children:pi[Z].icon}),h.jsx("span",{onMouseEnter:()=>ae(!0),onMouseLeave:()=>ae(!1),onMouseDown:De=>{De.stopPropagation(),N(Ye=>Ye==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:W?10:7,height:W?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More line tools",children:h.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("polygon",{points:"10,10 0,10 10,0",fill:we?"#64748b":"#94a3b8"})})})]}):Oe===3?h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>{const De=gi[G].toolId;i(t===De?null:De)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
16
+ ${t===gi[G].toolId?we?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":we?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:gi[G].label,children:gi[G].icon}),h.jsx("span",{onMouseEnter:()=>me(!0),onMouseLeave:()=>me(!1),onMouseDown:De=>{De.stopPropagation(),N(Ye=>Ye==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:oe?10:7,height:oe?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More channel tools",children:h.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("polygon",{points:"10,10 0,10 10,0",fill:we?"#64748b":"#94a3b8"})})})]}):fe?h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>{const De=mi[Le].toolId;i(t===De?null:De)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
+ ${t===mi[Le].toolId?we?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":we?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:mi[Le].label,children:mi[Le].icon}),h.jsx("span",{onMouseEnter:()=>ke(!0),onMouseLeave:()=>ke(!1),onMouseDown:De=>{De.stopPropagation(),N(Ye=>Ye==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:Fe?10:7,height:Fe?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More Gann tools",children:h.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("polygon",{points:"10,10 0,10 10,0",fill:we?"#64748b":"#94a3b8"})})})]}):Oe===5?h.jsxs("div",{className:"relative",children:[h.jsx("button",{onClick:()=>{const De=Bi[ye].toolId;i(t===De?null:De)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
+ ${t===Bi[ye].toolId?we?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":we?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Bi[ye].label,children:Bi[ye].icon}),h.jsx("span",{onMouseEnter:()=>ge(!0),onMouseLeave:()=>ge(!1),onMouseDown:De=>{De.stopPropagation(),N(Ye=>Ye==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:Ce?10:7,height:Ce?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More shape tools",children:h.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("polygon",{points:"10,10 0,10 10,0",fill:we?"#64748b":"#94a3b8"})})})]}):h.jsx("button",{onClick:()=>Re(Oe),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
19
+ ${ne.label==="Grid"&&n||ne.label==="Eye"&&!d||ne.label==="Lock"&&y||t===Oe?we?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":we?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${ne.label}: ${ne.description}`,children:ne.icon}),!fe&&ne.label==="Text"&&h.jsx("div",{className:`w-8 border-t my-1 ${we?"border-slate-200":"border-slate-700"}`})]},fe?"gann-slot":`${ne.label}-${le}`)})}),h.jsx("div",{className:"flex-1"}),h.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:Ke.map((le,Ie)=>{const fe=12+Ie;return h.jsx("button",{onClick:()=>Re(fe),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
20
+ ${le.label==="Grid"&&n||le.label==="Eye"&&!d||le.label==="Lock"&&y||t===fe?we?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":we?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${le.label}: ${le.description}`,children:le.icon},le.label)})})]}),V==="line"&&h.jsx(As,{top:84,panelRef:iA,isLight:we,children:pi.map((le,Ie)=>{const fe=Z===Ie;return h.jsxs("button",{type:"button",onMouseDown:ne=>{ne.stopPropagation(),X(Ie),i(le.toolId),N(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${we?"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 ${we?"text-slate-500":"text-slate-400"}`,children:le.icon}),h.jsx("span",{className:"flex-1",children:le.label}),fe&&h.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{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"})})})]},le.toolId)})}),V==="channel"&&h.jsx(As,{top:128,panelRef:Ee,isLight:we,children:gi.map((le,Ie)=>{const fe=G===Ie;return h.jsxs("button",{type:"button",onMouseDown:ne=>{ne.stopPropagation(),ee(Ie),i(le.toolId),N(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${we?"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 ${we?"text-slate-500":"text-slate-400"}`,children:le.icon}),h.jsx("span",{className:"flex-1",children:le.label}),fe&&h.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{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"})})})]},le.toolId)})}),V==="gann"&&h.jsx(As,{top:210,panelRef:Te,isLight:we,children:mi.map((le,Ie)=>{const fe=Le===Ie;return h.jsxs("button",{type:"button",onMouseDown:ne=>{ne.stopPropagation(),Ue(Ie),i(le.toolId),N(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${we?"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 ${we?"text-slate-500":"text-slate-400"}`,children:le.icon}),h.jsx("span",{className:"flex-1",children:le.label}),fe&&h.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{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"})})})]},le.toolId)})}),V==="shape"&&h.jsx(As,{top:250,panelRef:de,isLight:we,children:Bi.map((le,Ie)=>{const fe=ye===Ie;return h.jsxs("button",{type:"button",onMouseDown:ne=>{ne.stopPropagation(),ve(Ie),i(le.toolId),N(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${we?"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 ${we?"text-slate-500":"text-slate-400"}`,children:le.icon}),h.jsx("span",{className:"flex-1",children:le.label}),fe&&h.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:h.jsx("svg",{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"})})})]},le.toolId)})}),S&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{F(!1),x(null)},"aria-hidden":"true"}),h.jsxs("div",{ref:Be,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${we?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[h.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${we?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[h.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${we?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),h.jsx("div",{className:`text-[12px] mt-0.5 ${we?"text-slate-500":"text-slate-400"}`,children:r})]}),h.jsx("div",{className:"py-2",children:We.map(le=>h.jsx(je,{item:le},le.key))})]})]})]})};function ry(r){return Wr({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 iy=({width:r=256,symbols:e=[],selectedSymbol:A,onSymbolSelect:t,symbolsLoading:i=!1,isOpen:n})=>{const{theme:s}=FA(),o=s==="light",[a,l]=J.useState(""),c=e.filter(y=>y.symbol.toLowerCase().includes(a.toLowerCase())),d=c.filter(y=>!y.symbol.toUpperCase().endsWith("USDT")),p=c.filter(y=>y.symbol.toUpperCase().endsWith("USDT"));return h.jsxs(h.Fragment,{children:[h.jsx("style",{children:`
21
21
  .scrollbar-dark::-webkit-scrollbar {
22
22
  width: 8px;
23
23
  }
@@ -44,4 +44,4 @@
44
44
  .scrollbar-light::-webkit-scrollbar-thumb:hover {
45
45
  background: #94a3b8;
46
46
  }
47
- `}),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(Rv,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),h.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:y=>a(y.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:i?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:e.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(y=>h.jsxs("tr",{onClick:()=>t(y.symbol),className:`cursor-pointer transition-colors ${A===y.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:y.symbol}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${y.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:y.bid}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${y.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:y.ask}),h.jsxs("td",{className:`px-3 py-2 text-right font-medium ${y.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[y.change>=0?"+":"",y.change,"%"]})]},y.symbol)),m.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"})}),m.map(y=>h.jsxs("tr",{onClick:()=>t(y.symbol),className:`cursor-pointer transition-colors ${A===y.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:y.symbol}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${y.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:y.bid}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${y.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:y.ask}),h.jsxs("td",{className:`px-3 py-2 text-right font-medium ${y.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[y.change>=0?"+":"",y.change,"%"]})]},y.symbol))]})]})})]})]})},Xv=({accountSummary:r,orders:e,onClose:A,onModify:t,height:i})=>{const{accountSummary:n,orders:s,theme:o}=TA(),l=r||n,a=e||s,c=o==="light",[u,m]=J.useState("trade"),y="#26A69A",B="#EF5350",p=c?"#f8fafc":"#0f172a",Q=c?"#e2e8f0":"#1e293b",D=c?"#f1f5f9":"#0f172a",F=c?"#f8fafc":"#131c2e",_=c?"#0f172a":"#e2e8f0",L="#64748b",k=(a||[]).filter(ce=>ce.status==="OPEN"||!ce.closeAt),V=(a||[]).filter(ce=>ce.closeAt||ce.closedAt),Z=l?.balance||0,$=l?.equity??Z,z=l?.margin||0,R=l?.freeMargin??$-z,X=z>0?$/z*100:0,se=k.reduce((ce,De)=>ce+(De.livePnL??De.profit??0),0),ae=ce=>{const De=parseFloat(ce);return Number.isFinite(De)?De.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},ye=ce=>{const De=parseFloat(ce);return!De||isNaN(De)?"—":De>=1e4?De.toFixed(2):De>=10?De.toFixed(4):De.toFixed(5)},Le=ce=>{const De=parseFloat(ce);return isNaN(De)?"—":(De>=0?"+":"")+De.toFixed(2)},Qe=ce=>{const De=parseFloat(ce);return isNaN(De)?"—":De.toFixed(2)},xe=ce=>{if(!ce)return"—";const De=new Date(ce);return isNaN(De.getTime())?String(ce):`${De.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${De.toTimeString().slice(0,8)}`},Se=J.useCallback((ce,De)=>{ce.stopPropagation(),A&&A(De.id)},[A]),pe=J.useCallback((ce,De)=>{ce.stopPropagation(),t&&t(De)},[t]),Be={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:p,borderTop:`1px solid ${Q}`,display:"flex",flexDirection:"column",height:i?`${i}px`:"auto",overflow:"hidden",fontSize:"11px",color:_},Ce={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:D,borderBottom:`1px solid ${Q}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Fe={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${Q}`,whiteSpace:"nowrap"},be={color:L,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},le={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},qe={display:"flex",borderBottom:`1px solid ${Q}`,flexShrink:0,backgroundColor:D},Ie=ce=>({padding:"5px 14px",fontSize:"11px",fontWeight:ce?700:500,color:ce?c?"#0ea5e9":"#38bdf8":L,borderBottom:ce?`2px solid ${c?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),we={padding:"4px 8px",textAlign:"left",color:L,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${Q}`,whiteSpace:"nowrap",backgroundColor:D,position:"sticky",top:0,zIndex:1},Ke={padding:"3px 8px",borderBottom:`1px solid ${Q}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:_};return h.jsxs("div",{style:Be,children:[h.jsxs("div",{style:Ce,children:[h.jsxs("div",{style:Fe,children:[h.jsx("span",{style:be,children:"Balance:"}),h.jsxs("span",{style:{...le,color:_},children:["$",ae(Z)]})]}),h.jsxs("div",{style:Fe,children:[h.jsx("span",{style:be,children:"Equity:"}),h.jsxs("span",{style:{...le,color:$>=Z?y:B},children:["$",ae($)]})]}),h.jsxs("div",{style:Fe,children:[h.jsx("span",{style:be,children:"Margin:"}),h.jsxs("span",{style:{...le,color:_},children:["$",ae(z)]})]}),h.jsxs("div",{style:Fe,children:[h.jsx("span",{style:be,children:"Free Margin:"}),h.jsxs("span",{style:{...le,color:R>=0?_:B},children:["$",ae(R)]})]}),h.jsxs("div",{style:{...Fe,borderRight:"none",marginRight:0,paddingRight:0},children:[h.jsx("span",{style:be,children:"Margin Level:"}),h.jsx("span",{style:{...le,color:X>=100?y:B},children:z>0?X.toFixed(2)+"%":"—"})]}),k.length>0&&h.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[h.jsx("span",{style:be,children:"Float P/L:"}),h.jsxs("span",{style:{...le,color:se>=0?y:B,fontWeight:700},children:[se>=0?"+":"",ae(se)]})]})]}),h.jsxs("div",{style:qe,children:[h.jsxs("button",{style:Ie(u==="trade"),onClick:()=>m("trade"),children:["Trade (",k.length,")"]}),h.jsxs("button",{style:Ie(u==="history"),onClick:()=>m("history"),children:["History (",V.length,")"]})]}),h.jsxs("div",{style:{flex:1,overflowY:"auto",overflowX:"auto"},children:[u==="trade"&&h.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{style:we,children:"Ticket"}),h.jsx("th",{style:we,children:"Open Time"}),h.jsx("th",{style:we,children:"Symbol"}),h.jsx("th",{style:we,children:"Type"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"Volume"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"Open Price"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"S/L"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"T/P"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"Current"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"Profit"}),h.jsx("th",{style:{...we,textAlign:"center"},children:"Action"})]})}),h.jsx("tbody",{children:k.length===0?h.jsx("tr",{children:h.jsx("td",{colSpan:11,style:{...Ke,textAlign:"center",padding:"16px",color:L},children:"No open positions"})}):k.map(ce=>{const De=ce.livePnL??ce.profit??0,Ye=De>=0?y:B;return h.jsxs("tr",{style:{cursor:"default"},onMouseEnter:je=>je.currentTarget.style.backgroundColor=F,onMouseLeave:je=>je.currentTarget.style.backgroundColor="transparent",children:[h.jsx("td",{style:{...Ke,color:L,fontSize:"10px"},children:String(ce.id||"").slice(0,8).toUpperCase()}),h.jsx("td",{style:{...Ke,color:L},children:xe(ce.openAt||ce.time)}),h.jsx("td",{style:{...Ke,fontWeight:700,color:_,letterSpacing:"0.02em"},children:ce.symbol}),h.jsx("td",{style:{...Ke,fontWeight:700,color:ce.type==="BUY"?y:B},children:ce.type}),h.jsx("td",{style:{...Ke,textAlign:"right"},children:Qe(ce.volume)}),h.jsx("td",{style:{...Ke,textAlign:"right"},children:ye(ce.price??ce.openPrice)}),h.jsx("td",{style:{...Ke,textAlign:"right",color:ce.stopLoss?B:L},children:ce.stopLoss?ye(ce.stopLoss):"—"}),h.jsx("td",{style:{...Ke,textAlign:"right",color:ce.takeProfit?y:L},children:ce.takeProfit?ye(ce.takeProfit):"—"}),h.jsx("td",{style:{...Ke,textAlign:"right",color:L},children:ce.currentPrice?ye(ce.currentPrice):"—"}),h.jsx("td",{style:{...Ke,textAlign:"right",fontWeight:700,color:Ye},children:Le(De)}),h.jsx("td",{style:{...Ke,textAlign:"center"},children:h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"4px"},children:[t&&h.jsx("button",{onClick:je=>pe(je,ce),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:L,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:je=>je.currentTarget.style.color="#f59e0b",onMouseLeave:je=>je.currentTarget.style.color=L,children:"✎"}),A&&h.jsx("button",{onClick:je=>Se(je,ce),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:je=>je.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:je=>je.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})]})})]},ce.id)})})]}),u==="history"&&h.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"700px"},children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{style:we,children:"Ticket"}),h.jsx("th",{style:we,children:"Open Time"}),h.jsx("th",{style:we,children:"Close Time"}),h.jsx("th",{style:we,children:"Symbol"}),h.jsx("th",{style:we,children:"Type"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"Volume"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"Open Price"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"Close Price"}),h.jsx("th",{style:{...we,textAlign:"right"},children:"Profit"})]})}),h.jsx("tbody",{children:V.length===0?h.jsx("tr",{children:h.jsx("td",{colSpan:9,style:{...Ke,textAlign:"center",padding:"16px",color:L},children:"No trade history"})}):V.map(ce=>{const De=ce.profit??0,Ye=De>=0?y:B;return h.jsxs("tr",{onMouseEnter:je=>je.currentTarget.style.backgroundColor=F,onMouseLeave:je=>je.currentTarget.style.backgroundColor="transparent",children:[h.jsx("td",{style:{...Ke,color:L,fontSize:"10px"},children:String(ce.id||"").slice(0,8).toUpperCase()}),h.jsx("td",{style:{...Ke,color:L},children:xe(ce.openAt)}),h.jsx("td",{style:{...Ke,color:L},children:xe(ce.closeAt||ce.closedAt)}),h.jsx("td",{style:{...Ke,fontWeight:700,color:_},children:ce.symbol}),h.jsx("td",{style:{...Ke,fontWeight:700,color:ce.type==="BUY"?y:B},children:ce.type}),h.jsx("td",{style:{...Ke,textAlign:"right"},children:Qe(ce.volume)}),h.jsx("td",{style:{...Ke,textAlign:"right"},children:ye(ce.price??ce.openPrice)}),h.jsx("td",{style:{...Ke,textAlign:"right"},children:ye(ce.closePrice)}),h.jsx("td",{style:{...Ke,textAlign:"right",fontWeight:700,color:Ye},children:Le(De)})]},ce.id)})})]})]})]})},Jv="1.2.1";Ve.AccountPanel=Xv,Ve.BuySellPanel=Gc,Ve.Chart=Lv,Ve.ChartTypeSelector=Nv,Ve.CoinSelector=cd,Ve.DrawingTools=fd,Ve.LeftSidebar=Wv,Ve.MarketExecutionModal=Wc,Ve.MarketWatch=$v,Ve.PositionsPanel=Pv,Ve.SYMBOL_CONFIG=$c,Ve.StopLoss=ud,Ve.TakeProfit=dd,Ve.TimeframeSelector=kv,Ve.TopBar=Gv,Ve.TradePanel=Kv,Ve.TradingProvider=wg,Ve.TradingToolbar=_v,Ve.VolumeControl=hd,Ve.alignToTimeframe=lr,Ve.detectGaps=Sg,Ve.getSymbolConfig=zr,Ve.is24x7Symbol=_g,Ve.isCryptoSymbol=Ig,Ve.isForexSymbol=Mg,Ve.isWithinTradingSession=Hg,Ve.normalizeCandleTimes=Rc,Ve.normalizeTime=Ae,Ve.processCandles=Yc,Ve.processSingleCandle=jc,Ve.setSocketBaseUrl=Oc,Ve.timeframeToSeconds=Wt,Ve.useTrading=TA,Ve.validateTimeOrdering=Lg,Ve.version=Jv,Object.defineProperty(Ve,Symbol.toStringTag,{value:"Module"})}));
47
+ `}),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(ry,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),h.jsx("input",{type:"text",placeholder:"Search symbol",value:a,onChange:y=>l(y.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:i?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:e.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:[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-sky-600":"text-sky-400"}`,children:"FOREX"})}),d.map(y=>h.jsxs("tr",{onClick:()=>t(y.symbol),className:`cursor-pointer transition-colors ${A===y.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:y.symbol}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${y.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:y.bid}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${y.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:y.ask}),h.jsxs("td",{className:`px-3 py-2 text-right font-medium ${y.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[y.change>=0?"+":"",y.change,"%"]})]},y.symbol)),p.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"})}),p.map(y=>h.jsxs("tr",{onClick:()=>t(y.symbol),className:`cursor-pointer transition-colors ${A===y.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:y.symbol}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${y.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:y.bid}),h.jsx("td",{className:`px-3 py-2 text-right text-md ${y.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:y.ask}),h.jsxs("td",{className:`px-3 py-2 text-right font-medium ${y.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[y.change>=0?"+":"",y.change,"%"]})]},y.symbol))]})]})})]})]})},ny=({accountSummary:r,orders:e,onClose:A,onModify:t,height:i})=>{const{accountSummary:n,orders:s,theme:o}=FA(),a=r||n,l=e||s,c=o==="light",[d,p]=J.useState("trade"),y="#26A69A",w="#EF5350",C=c?"#f8fafc":"#0f172a",v=c?"#e2e8f0":"#1e293b",S=c?"#f1f5f9":"#0f172a",F=c?"#f8fafc":"#131c2e",k=c?"#0f172a":"#e2e8f0",x="#64748b",V=(l||[]).filter(de=>de.status==="OPEN"||!de.closeAt),N=(l||[]).filter(de=>de.closeAt||de.closedAt),Z=a?.balance||0,X=a?.equity??Z,W=a?.margin||0,ae=a?.freeMargin??X-W,G=W>0?X/W*100:0,ee=V.reduce((de,Qe)=>de+(Qe.livePnL??Qe.profit??0),0),oe=de=>{const Qe=parseFloat(de);return Number.isFinite(Qe)?Qe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},me=de=>{const Qe=parseFloat(de);return!Qe||isNaN(Qe)?"—":Qe>=1e4?Qe.toFixed(2):Qe>=10?Qe.toFixed(4):Qe.toFixed(5)},Le=de=>{const Qe=parseFloat(de);return isNaN(Qe)?"—":(Qe>=0?"+":"")+Qe.toFixed(2)},Ue=de=>{const Qe=parseFloat(de);return isNaN(Qe)?"—":Qe.toFixed(2)},Fe=de=>{if(!de)return"—";const Qe=new Date(de);return isNaN(Qe.getTime())?String(de):`${Qe.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${Qe.toTimeString().slice(0,8)}`},ke=J.useCallback((de,Qe)=>{de.stopPropagation(),A&&A(Qe.id)},[A]),ye=J.useCallback((de,Qe)=>{de.stopPropagation(),t&&t(Qe)},[t]),ve={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:C,borderTop:`1px solid ${v}`,display:"flex",flexDirection:"column",height:i?`${i}px`:"auto",overflow:"hidden",fontSize:"11px",color:k},Ce={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:S,borderBottom:`1px solid ${v}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},ge={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${v}`,whiteSpace:"nowrap"},Me={color:x,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},_e={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Be={display:"flex",borderBottom:`1px solid ${v}`,flexShrink:0,backgroundColor:S},iA=de=>({padding:"5px 14px",fontSize:"11px",fontWeight:de?700:500,color:de?c?"#0ea5e9":"#38bdf8":x,borderBottom:de?`2px solid ${c?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),Ee={padding:"4px 8px",textAlign:"left",color:x,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${v}`,whiteSpace:"nowrap",backgroundColor:S,position:"sticky",top:0,zIndex:1},Te={padding:"3px 8px",borderBottom:`1px solid ${v}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:k};return h.jsxs("div",{style:ve,children:[h.jsxs("div",{style:Ce,children:[h.jsxs("div",{style:ge,children:[h.jsx("span",{style:Me,children:"Balance:"}),h.jsxs("span",{style:{..._e,color:k},children:["$",oe(Z)]})]}),h.jsxs("div",{style:ge,children:[h.jsx("span",{style:Me,children:"Equity:"}),h.jsxs("span",{style:{..._e,color:X>=Z?y:w},children:["$",oe(X)]})]}),h.jsxs("div",{style:ge,children:[h.jsx("span",{style:Me,children:"Margin:"}),h.jsxs("span",{style:{..._e,color:k},children:["$",oe(W)]})]}),h.jsxs("div",{style:ge,children:[h.jsx("span",{style:Me,children:"Free Margin:"}),h.jsxs("span",{style:{..._e,color:ae>=0?k:w},children:["$",oe(ae)]})]}),h.jsxs("div",{style:{...ge,borderRight:"none",marginRight:0,paddingRight:0},children:[h.jsx("span",{style:Me,children:"Margin Level:"}),h.jsx("span",{style:{..._e,color:G>=100?y:w},children:W>0?G.toFixed(2)+"%":"—"})]}),V.length>0&&h.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[h.jsx("span",{style:Me,children:"Float P/L:"}),h.jsxs("span",{style:{..._e,color:ee>=0?y:w,fontWeight:700},children:[ee>=0?"+":"",oe(ee)]})]})]}),h.jsxs("div",{style:Be,children:[h.jsxs("button",{style:iA(d==="trade"),onClick:()=>p("trade"),children:["Trade (",V.length,")"]}),h.jsxs("button",{style:iA(d==="history"),onClick:()=>p("history"),children:["History (",N.length,")"]})]}),h.jsxs("div",{style:{flex:1,overflowY:"auto",overflowX:"auto"},children:[d==="trade"&&h.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{style:Ee,children:"Ticket"}),h.jsx("th",{style:Ee,children:"Open Time"}),h.jsx("th",{style:Ee,children:"Symbol"}),h.jsx("th",{style:Ee,children:"Type"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"Volume"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"Open Price"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"S/L"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"T/P"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"Current"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"Profit"}),h.jsx("th",{style:{...Ee,textAlign:"center"},children:"Action"})]})}),h.jsx("tbody",{children:V.length===0?h.jsx("tr",{children:h.jsx("td",{colSpan:11,style:{...Te,textAlign:"center",padding:"16px",color:x},children:"No open positions"})}):V.map(de=>{const Qe=de.livePnL??de.profit??0,cA=Qe>=0?y:w;return h.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Re=>Re.currentTarget.style.backgroundColor=F,onMouseLeave:Re=>Re.currentTarget.style.backgroundColor="transparent",children:[h.jsx("td",{style:{...Te,color:x,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),h.jsx("td",{style:{...Te,color:x},children:Fe(de.openAt||de.time)}),h.jsx("td",{style:{...Te,fontWeight:700,color:k,letterSpacing:"0.02em"},children:de.symbol}),h.jsx("td",{style:{...Te,fontWeight:700,color:de.type==="BUY"?y:w},children:de.type}),h.jsx("td",{style:{...Te,textAlign:"right"},children:Ue(de.volume)}),h.jsx("td",{style:{...Te,textAlign:"right"},children:me(de.price??de.openPrice)}),h.jsx("td",{style:{...Te,textAlign:"right",color:de.stopLoss?w:x},children:de.stopLoss?me(de.stopLoss):"—"}),h.jsx("td",{style:{...Te,textAlign:"right",color:de.takeProfit?y:x},children:de.takeProfit?me(de.takeProfit):"—"}),h.jsx("td",{style:{...Te,textAlign:"right",color:x},children:de.currentPrice?me(de.currentPrice):"—"}),h.jsx("td",{style:{...Te,textAlign:"right",fontWeight:700,color:cA},children:Le(Qe)}),h.jsx("td",{style:{...Te,textAlign:"center"},children:h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"4px"},children:[t&&h.jsx("button",{onClick:Re=>ye(Re,de),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:x,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:Re=>Re.currentTarget.style.color="#f59e0b",onMouseLeave:Re=>Re.currentTarget.style.color=x,children:"✎"}),A&&h.jsx("button",{onClick:Re=>ke(Re,de),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:Re=>Re.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:Re=>Re.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})]})})]},de.id)})})]}),d==="history"&&h.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"700px"},children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{style:Ee,children:"Ticket"}),h.jsx("th",{style:Ee,children:"Open Time"}),h.jsx("th",{style:Ee,children:"Close Time"}),h.jsx("th",{style:Ee,children:"Symbol"}),h.jsx("th",{style:Ee,children:"Type"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"Volume"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"Open Price"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"Close Price"}),h.jsx("th",{style:{...Ee,textAlign:"right"},children:"Profit"})]})}),h.jsx("tbody",{children:N.length===0?h.jsx("tr",{children:h.jsx("td",{colSpan:9,style:{...Te,textAlign:"center",padding:"16px",color:x},children:"No trade history"})}):N.map(de=>{const Qe=de.profit??0,cA=Qe>=0?y:w;return h.jsxs("tr",{onMouseEnter:Re=>Re.currentTarget.style.backgroundColor=F,onMouseLeave:Re=>Re.currentTarget.style.backgroundColor="transparent",children:[h.jsx("td",{style:{...Te,color:x,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),h.jsx("td",{style:{...Te,color:x},children:Fe(de.openAt)}),h.jsx("td",{style:{...Te,color:x},children:Fe(de.closeAt||de.closedAt)}),h.jsx("td",{style:{...Te,fontWeight:700,color:k},children:de.symbol}),h.jsx("td",{style:{...Te,fontWeight:700,color:de.type==="BUY"?y:w},children:de.type}),h.jsx("td",{style:{...Te,textAlign:"right"},children:Ue(de.volume)}),h.jsx("td",{style:{...Te,textAlign:"right"},children:me(de.price??de.openPrice)}),h.jsx("td",{style:{...Te,textAlign:"right"},children:me(de.closePrice)}),h.jsx("td",{style:{...Te,textAlign:"right",fontWeight:700,color:cA},children:Le(Qe)})]},de.id)})})]})]})]})},sy="1.2.1";ze.AccountPanel=ny,ze.BuySellPanel=Jc,ze.Chart=zv,ze.ChartTypeSelector=Zv,ze.CoinSelector=md,ze.DrawingTools=vd,ze.LeftSidebar=ty,ze.MarketExecutionModal=Zc,ze.MarketWatch=iy,ze.PositionsPanel=Yv,ze.SYMBOL_CONFIG=Yc,ze.StopLoss=wd,ze.TakeProfit=Cd,ze.TimeframeSelector=Xv,ze.TopBar=Ay,ze.TradePanel=qv,ze.TradingProvider=xg,ze.TradingToolbar=Wv,ze.VolumeControl=Bd,ze.alignToTimeframe=ur,ze.detectGaps=kg,ze.getSymbolConfig=$r,ze.is24x7Symbol=Vg,ze.isCryptoSymbol=Pg,ze.isForexSymbol=Kg,ze.isWithinTradingSession=Og,ze.normalizeCandleTimes=qc,ze.normalizeTime=Y,ze.processCandles=rh,ze.processSingleCandle=ih,ze.setSocketBaseUrl=zc,ze.timeframeToSeconds=it,ze.useTrading=FA,ze.validateTimeOrdering=Ng,ze.version=sy,Object.defineProperty(ze,Symbol.toStringTag,{value:"Module"})}));